|
@@ -190,57 +190,88 @@ end
|
190
|
190
|
|
191
|
191
|
-- 消耗增加概率
|
192
|
192
|
function ItemSynthesis.consum_add_rate(actor, consumeItems, special, assistantItem)
|
193
|
|
- local configList = ConfigDataManager.getList("cfg_synthesis_material")
|
|
193
|
+ local confMaterialList = ConfigDataManager.getList("cfg_synthesis_material")
|
|
194
|
+ local confAssistantList = ConfigDataManager.getList("cfg_synthesis_assistant")
|
194
|
195
|
local allEquip = EquipAndAppear.getLuaItemExtData(actor)
|
195
|
196
|
-- 获取合成增加概率
|
196
|
|
- local function _get_item_rate(actor, itemId)
|
197
|
|
- for _, v in ipairs(configList) do
|
198
|
|
- if v.materialId == itemId then
|
199
|
|
- -- 材料
|
200
|
|
- if v.type == 0 then
|
201
|
|
- return v.addRateBase or 0
|
202
|
|
- end
|
203
|
|
- -- 装备
|
204
|
|
- if v.type == 2 then
|
205
|
|
- local isMatch = true
|
206
|
|
- local equip = getequipinfo(actor, itemId, 1)
|
207
|
|
- if equip == nil or allEquip[itemId] == nil then
|
208
|
|
- isMatch = false
|
209
|
|
- else
|
210
|
|
- -- 装备强化等级
|
211
|
|
- local strengthlv = allEquip[itemId].strengthlv
|
212
|
|
- -- 装备追加等级
|
213
|
|
- local appendlv = allEquip[itemId].appendlv
|
|
197
|
+ local function _get_item_rate(actor, itemId, groupId)
|
|
198
|
+ -- 装备强化等级
|
|
199
|
+ local strengthlv = 0
|
|
200
|
+ -- 装备追加等级
|
|
201
|
+ local appendlv = 0
|
|
202
|
+ local equip = getequipinfo(actor, itemId, 1)
|
|
203
|
+ if equip and allEquip[itemId] then
|
|
204
|
+ strengthlv = allEquip[itemId].strengthlv
|
|
205
|
+ appendlv = allEquip[itemId].appendlv
|
|
206
|
+ end
|
|
207
|
+ -- 获取配置
|
|
208
|
+ local conf = nil
|
|
209
|
+ if groupId == nil then
|
|
210
|
+ for _, v in ipairs(confMaterialList) do
|
|
211
|
+ if v.materialId == itemId then
|
|
212
|
+ -- 装备,增加等级判断
|
|
213
|
+ if v.type == 2 then
|
214
|
214
|
-- 是否符合等级要求
|
215
|
215
|
if v.related == 1 then
|
216
|
216
|
-- 同时满足强化等级以及追加等级
|
217
|
|
- if strengthlv < v.minLevel or appendlv < v.minAppend then
|
218
|
|
- isMatch = false
|
|
217
|
+ if strengthlv >= v.minLevel and appendlv >= v.minAppend then
|
|
218
|
+ conf = table.copy(v)
|
|
219
|
+ break
|
219
|
220
|
end
|
220
|
221
|
end
|
221
|
222
|
if v.related == 2 then
|
222
|
223
|
-- 强化等级或追加等级满足其中一个
|
223
|
|
- if strengthlv < v.minLevel and appendlv < v.minAppend then
|
224
|
|
- isMatch = false
|
|
224
|
+ if strengthlv >= v.minLevel or appendlv >= v.minAppend then
|
|
225
|
+ conf = table.copy(v)
|
|
226
|
+ break
|
225
|
227
|
end
|
226
|
228
|
end
|
|
229
|
+ else
|
|
230
|
+ conf = table.copy(v)
|
|
231
|
+ break
|
227
|
232
|
end
|
228
|
|
- if isMatch then
|
229
|
|
- local addRate = v.addRateBase or 0
|
230
|
|
- local addStrengthRate = (strengthlv - v.minLevel) * (v.perAddRateLevel or 0)
|
231
|
|
- local addAppendRate = (appendlv - v.minAppend) * (v.perAddRateAppend or 0)
|
|
233
|
+ end
|
|
234
|
+ end
|
|
235
|
+ else
|
|
236
|
+ for _, v in ipairs(confMaterialList) do
|
|
237
|
+ if v.groupId == groupId and v.itemId == itemId then
|
|
238
|
+ -- 装备,增加等级判断
|
|
239
|
+ if v.type == 2 then
|
|
240
|
+ -- 是否符合等级要求
|
232
|
241
|
if v.related == 1 then
|
233
|
|
- addRate = addRate + addStrengthRate + addAppendRate
|
|
242
|
+ -- 同时满足强化等级以及追加等级
|
|
243
|
+ if strengthlv >= v.minLevel and appendlv >= v.minAppend then
|
|
244
|
+ conf = table.copy(v)
|
|
245
|
+ break
|
|
246
|
+ end
|
234
|
247
|
end
|
235
|
|
-
|
236
|
248
|
if v.related == 2 then
|
237
|
|
- addRate = addRate + math.max(addStrengthRate, addAppendRate)
|
|
249
|
+ -- 强化等级或追加等级满足其中一个
|
|
250
|
+ if strengthlv >= v.minLevel or appendlv >= v.minAppend then
|
|
251
|
+ conf = table.copy(v)
|
|
252
|
+ break
|
|
253
|
+ end
|
238
|
254
|
end
|
239
|
|
- return addRate
|
|
255
|
+ else
|
|
256
|
+ conf = table.copy(v)
|
|
257
|
+ break
|
240
|
258
|
end
|
241
|
259
|
end
|
242
|
260
|
end
|
243
|
261
|
end
|
|
262
|
+ if conf then
|
|
263
|
+ local addRate = conf.addRateBase or 0
|
|
264
|
+ local addStrengthRate = (strengthlv - (conf.minLevel or 0)) * (conf.perAddRateLevel or 0)
|
|
265
|
+ local addAppendRate = (appendlv - (conf.minAppend or 0)) * (conf.perAddRateAppend or 0)
|
|
266
|
+ if conf.related == 1 then
|
|
267
|
+ addRate = addRate + addStrengthRate + addAppendRate
|
|
268
|
+ end
|
|
269
|
+
|
|
270
|
+ if conf.related == 2 then
|
|
271
|
+ addRate = addRate + math.max(addStrengthRate, addAppendRate)
|
|
272
|
+ end
|
|
273
|
+ return addRate
|
|
274
|
+ end
|
244
|
275
|
return 0
|
245
|
276
|
end
|
246
|
277
|
|
|
@@ -258,7 +289,8 @@ function ItemSynthesis.consum_add_rate(actor, consumeItems, special, assistantIt
|
258
|
289
|
for index, value in pairs(special) do
|
259
|
290
|
local itemId = value["itemId"]
|
260
|
291
|
local itemIndex = value["itemIndex"]
|
261
|
|
- addRate = addRate + _get_item_rate(actor, itemId)
|
|
292
|
+ local groupId = value["groupId"]
|
|
293
|
+ addRate = addRate + _get_item_rate(actor, itemId, groupId)
|
262
|
294
|
end
|
263
|
295
|
end
|
264
|
296
|
-- 辅助消耗道具
|
|
@@ -266,7 +298,8 @@ function ItemSynthesis.consum_add_rate(actor, consumeItems, special, assistantIt
|
266
|
298
|
for index, value in pairs(assistantItem) do
|
267
|
299
|
local itemId = value["itemId"]
|
268
|
300
|
local itemIndex = value["itemIndex"]
|
269
|
|
- addRate = addRate + _get_item_rate(actor, itemId)
|
|
301
|
+ local groupId = value["groupId"]
|
|
302
|
+ addRate = addRate + _get_item_rate(actor, itemId, groupId)
|
270
|
303
|
end
|
271
|
304
|
end
|
272
|
305
|
|