ItemSynthesis_1.lua 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. ItemSynthesis = {}
  2. local this = {}
  3. local SYNTHESIS_CFG_TYPE = {
  4. normal = 1,
  5. special = 2
  6. }
  7. function testsynthesis(actor)
  8. local msgData = {30001}
  9. ItemSynthesis.synthesis(actor, msgData)
  10. end
  11. function ItemSynthesis.string2table(str)
  12. local result = {}
  13. local pairs = string.split(str, "|")
  14. for _, pairStr in ipairs(pairs) do
  15. local values = string.split(pairStr, "#")
  16. table.insert(result, values)
  17. end
  18. return result
  19. end
  20. -- 道具合成
  21. function ItemSynthesis.synthesis(actor, msgData)
  22. -- 合成ID 合成数量 合成消耗
  23. local synthesisCfgId = msgData.cfgid -- 合成ID
  24. local count = msgData.count -- 合成数量
  25. local tCost = msgData.costs[1] -- 必要合成消耗
  26. local tCostEx = msgData.costs[2] -- 附加合成消耗
  27. local useluck = msgData.useluck
  28. local useprotect = msgData.useprotect
  29. local cfg_synthesis = ConfigDataManager.getTable("cfg_synthesis", "id", synthesisCfgId)[1]
  30. -- 检测合成配方所需等级
  31. local needLevel = tonumber(cfg_synthesis.level) or 0
  32. local currentLevel = getbaseinfo(actor, "level")
  33. -- info(cfg_synthesis,"cfg_synthesis","合成数据")
  34. if tonumber(needLevel) > tonumber(currentLevel) then
  35. noticeTip.noticeinfo(actor, StringIdConst.TEXT353)
  36. return
  37. end
  38. -- 检测合成配方所需职业
  39. -- 检测合成消耗
  40. local tCostItem1 = {} -- 装备消耗
  41. local tCostItem2 = {} -- 材料
  42. local consumeItem = cfg_synthesis.consumeitem1
  43. info(consumeItem, "consumeItem", "合成数据")
  44. local consumeitem2 = cfg_synthesis.consumeitem2
  45. local tConsumeItem = ItemSynthesis.string2table(consumeItem)
  46. local tConsumeItem2 = ItemSynthesis.string2table(consumeitem2)
  47. info(tConsumeItem, "tConsumeItem", "合成数据")
  48. -- 检测必选消耗
  49. -- if not tConsumeItem or next(tConsumeItem) then
  50. -- messagebox(actor,"尚未放入必选材料001!")
  51. -- return
  52. -- end
  53. local addRate = 0
  54. local luckRate = 0
  55. local isCostLuck = false
  56. if useluck and not string.isNullOrEmpty(cfg_synthesis.useluck) then
  57. local cfgId = tonumber(cfg_synthesis.useluck)
  58. local allitems = getallbagiteminfo(actor)
  59. local kk, vv = table.findByCondi(allitems, function(a)
  60. return a.cfgid == cfgId;
  61. end)
  62. if kk ~= nil then
  63. isCostLuck = true
  64. luckRate = luckRate + EquipFunc.getEquipSynValue(actor, vv.id) / 20000
  65. end
  66. end
  67. local isCostProtect = false
  68. if useprotect and not string.isNullOrEmpty(cfg_synthesis.useprotect) then
  69. local cfgId = tonumber(cfg_synthesis.useprotect)
  70. local allitems = getallbagiteminfo(actor)
  71. local kk, vv = table.findByCondi(allitems, function(a)
  72. return a.cfgid == cfgId;
  73. end)
  74. if kk ~= nil then
  75. isCostProtect = true
  76. end
  77. end
  78. local costIndex = 1
  79. for index, v in pairs(tConsumeItem) do
  80. local costType = tonumber(v[1])
  81. if costType == 1 then
  82. local cfgId = tonumber(v[2])
  83. local count = tonumber(v[3])
  84. local num = getbagitemcountbyid(actor, cfgId) or 0
  85. local itemName = ConfigDataManager.getTable("cfg_item", "id", cfgId)[1].name
  86. if num < count then
  87. messagebox(actor, itemName .. "数量不足" .. count .. "个!")
  88. return
  89. end
  90. -- table.insert(tCostItem2,{costType = costType, [cfgId]=count,})
  91. tCostItem2[cfgId] = count
  92. elseif costType == 2 then
  93. -- 检查是否有对应的装备材料放入
  94. local foundItem = nil
  95. if tCost then
  96. for i, v in ipairs(tCost) do
  97. if v and v.id and i == costIndex then
  98. foundItem = v
  99. break
  100. end
  101. end
  102. costIndex = costIndex + 1
  103. end
  104. if not foundItem then
  105. messagebox(actor, "尚未放入必选材料!")
  106. return
  107. end
  108. local itemId = foundItem.id
  109. local cfgId = foundItem.cfgId
  110. -- local item = getequipinfo(actor, itemId, 1)
  111. local itemInfo = getbagiteminfo(actor, itemId, 1)
  112. local bagIndex = itemInfo.bagindex
  113. local strenthLv = tonumber(v[2])
  114. local appendLevel = tonumber(v[3])
  115. local pz = tonumber(v[4])
  116. local itemType = tonumber(v[5])
  117. local itemCfgId = v[6] or 0
  118. -- info("itemCfgId",itemCfgId,type(itemCfgId))
  119. if itemCfgId and itemCfgId ~= 0 and itemCfgId ~= "0" then
  120. local tab = string.split(itemCfgId, "_")
  121. local idx = false
  122. -- info("tab",tab)
  123. for i = 1, #tab do
  124. if tonumber(tab[i]) ~= 0 then
  125. if cfgId == tonumber(tab[i]) then
  126. idx = true
  127. end
  128. end
  129. end
  130. if not idx then
  131. messagebox(actor, "尚未放入必选材料")
  132. return ""
  133. end
  134. end
  135. if strenthLv > 0 then
  136. if EquipFunc.getEquipStrengthLevel(actor, itemId) < strenthLv then
  137. messagebox(actor, "强化等级不符")
  138. return ""
  139. end
  140. end
  141. if appendLevel > 0 then
  142. if EquipFunc.getEquipAppendLevel(actor, itemId) < appendLevel then
  143. messagebox(actor, "追加等级不符")
  144. return ""
  145. end
  146. end
  147. if pz > 0 then
  148. if pz ~= 99 then
  149. local Outstanding = ConfigDataManager.getTableValue("cfg_item", "Outstanding", "id", cfgId)
  150. Outstanding = tonumber(Outstanding) or 0
  151. if pz ~= Outstanding then
  152. messagebox(actor, "品质不符")
  153. return ""
  154. end
  155. end
  156. end
  157. if itemType == 1 then
  158. if not EquipFunc.getEquipIsSpecial(cfgId) then
  159. messagebox(actor, "装备类型不符")
  160. return ""
  161. end
  162. -- local useLevelLimit = ConfigDataManager.getTableValue("cfg_item", "useLevelLimit", "id", cfgId)
  163. -- useLevelLimit = tonumber(useLevelLimit)
  164. -- if useLevelLimit < 380 then
  165. -- messagebox(actor,"装备类型不符")
  166. -- return ""
  167. -- end
  168. end
  169. -- info(bagIndex,"bagIndex","合成数据")
  170. table.insert(tCostItem1, {
  171. costType = costType,
  172. bagIndex = bagIndex,
  173. cfgid = cfgId,
  174. cantDestroy = isCostProtect == true and costIndex == 2, -- 因为上面自增了.所以这里是2
  175. })
  176. elseif costType == 3 then
  177. local cfgId = index
  178. if tCost[cfgId] then
  179. if tCostItem2[cfgId] == nil then
  180. tCostItem2[cfgId] = 1
  181. else
  182. tCostItem2[cfgId] = tCostItem2[cfgId] + 1
  183. end
  184. end
  185. -- local cfgId = index
  186. -- if not tCost[cfgId] then
  187. -- messagebox(actor,"道具ID不符")
  188. -- return ""
  189. -- end
  190. -- tCostItem2[cfgId] = 1
  191. -- table.insert(tCostItem2,{costType = costType, [cfgId]=1,})
  192. elseif costType == 4 then
  193. -- 检查是否有对应的装备材料放入
  194. local foundItem = nil
  195. if tCost then
  196. for _, costData in pairs(tCost) do
  197. if costData and costData.id then
  198. foundItem = costData
  199. break
  200. end
  201. end
  202. end
  203. if not foundItem then
  204. messagebox(actor, "尚未放入必选材料!")
  205. return
  206. end
  207. local itemId = foundItem.id
  208. local cfgId = foundItem.cfgId
  209. local itemCfg = ConfigDataManager.getById("cfg_item", cfgId)
  210. local itemInfo = getbagiteminfo(actor, itemId, 1)
  211. local bagIndex = itemInfo.bagindex
  212. local entrys = itemInfo.entries
  213. local count = table.count(v)
  214. local needEnyrys = {}
  215. for i = 3, count, 2 do
  216. table.insert(needEnyrys, {
  217. type = tonumber(v[i]),
  218. value = tonumber(v[i + 1])
  219. })
  220. end
  221. local matchNum = 0
  222. local needNum = table.count(needEnyrys)
  223. for k, v in pairs(needEnyrys) do
  224. local tk, tv = table.findByCondi(entrys, function(a)
  225. return a.attrid == v.type and a.value == v.value
  226. end)
  227. if tk ~= nil then
  228. matchNum = matchNum + 1
  229. end
  230. end
  231. if matchNum < needNum then
  232. messagebox(actor, "材料不符!")
  233. return
  234. end
  235. table.insert(tCostItem1, {
  236. costType = costType,
  237. bagIndex = bagIndex,
  238. cantDestroy = itemCfg ~= nil and itemCfg.outstanding == "4"
  239. })
  240. end
  241. end
  242. -- 额外材料附加概率
  243. -- 真实合成概率
  244. local successRateReal = ConfigDataManager.getTableValue("cfg_synthesis", "successRateReal", "id", synthesisCfgId)
  245. successRateReal = tonumber(successRateReal) / 100
  246. -- 最大合成概率
  247. local successRateMax = ConfigDataManager.getTableValue("cfg_synthesis", "successRateMax", "id", synthesisCfgId)
  248. successRateMax = tonumber(successRateMax) / 100
  249. info(tConsumeItem2, "tConsumeItem2", "合成数据")
  250. local costItemIds = {}
  251. for index, v in pairs(tConsumeItem2) do
  252. costItemIds[tonumber(v[2])] = v
  253. end
  254. if tCost and next(tCost) then
  255. for key, value in pairs(tCost) do
  256. local itemId = value.id
  257. local cfgId = value.cfgId
  258. -- local itemInfo = getbagiteminfo(actor, itemId, 1)
  259. local jiazhi = EquipFunc.getEquipSynValue(actor, itemId)
  260. addRate = addRate + math.floor(jiazhi / 20000)
  261. local name = ConfigDataManager.getTableValue("cfg_item", "name", "id", cfgId)
  262. if name == "合成幸运符" then
  263. luckRate = luckRate + EquipFunc.getEquipSynValue(actor, itemId) / 20000
  264. end
  265. end
  266. end
  267. if tConsumeItem2 and next(tConsumeItem2) then
  268. if tCostEx and next(tCostEx) then
  269. for key, value in pairs(tCostEx) do
  270. local costItemIdData = costItemIds[value.cfgId]
  271. if costItemIdData ~= nil then
  272. local costType = tonumber(costItemIdData[1])
  273. local itemId = value.id
  274. local cfgId = value.cfgId
  275. local itemInfo = getbagiteminfo(actor, itemId, 1)
  276. local jiazhi = EquipFunc.getEquipSynValue(actor, itemId)
  277. addRate = addRate + math.floor(jiazhi / 20000)
  278. -- local name = ConfigDataManager.getTableValue("cfg_item", "name", "id", cfgId)
  279. -- if name == "合成幸运符" then
  280. -- luckRate = luckRate + EquipFunc.getEquipSynValue(actor, itemId) / 20000
  281. -- end
  282. if costType == 2 then
  283. local bagIndex = itemInfo.bagindex
  284. table.insert(tCostItem1, {
  285. costType = costType,
  286. bagIndex = bagIndex
  287. })
  288. elseif costType == 3 then
  289. if tCostItem2[cfgId] == nil then
  290. tCostItem2[cfgId] = 1
  291. else
  292. tCostItem2[cfgId] = tCostItem2[cfgId] + 1
  293. end
  294. -- table.insert(tCostItem2,{costType = costType, [cfgId]=1,})
  295. end
  296. end
  297. end
  298. end
  299. -- for index, v in pairs(tConsumeItem2) do
  300. -- if tCostEx and tCostEx[index] and tCostEx[index].id then
  301. -- local costType = tonumber(v[1])
  302. -- local itemId = tCostEx[index].id
  303. -- local cfgId = tCostEx[index].cfgId
  304. -- -- local item = getequipinfo(actor,itemId,1)
  305. -- local itemInfo = getbagiteminfo(actor,itemId,1)
  306. -- local jiazhi = EquipFunc.getEquipJiaZhi(actor,itemId)
  307. -- addRate = addRate + math.floor( jiazhi / 20000)
  308. -- local name = ConfigDataManager.getTableValue("cfg_item", "name", "id", cfgId)
  309. -- if name == "合成幸运符" then
  310. -- luckRate = luckRate + EquipFunc.getEquipJiaZhi(actor, itemId)
  311. -- end
  312. -- if costType == 2 then
  313. -- local bagIndex = itemInfo.bagindex
  314. -- table.insert(tCostItem1,{costType = costType, bagIndex=bagIndex})
  315. -- elseif costType == 3 then
  316. -- tCostItem2[cfgId] = 1
  317. -- -- table.insert(tCostItem2,{costType = costType, [cfgId]=1,})
  318. -- end
  319. -- end
  320. -- end
  321. end
  322. -- 发放奖励 local productId = cfg_synthesis.productid --合成后的道具id字段 21310011#33|21310021#33|21310031#33
  323. local tProductId = ItemSynthesis.string2table(cfg_synthesis.productid)
  324. for i = 1, #tProductId do
  325. tProductId[i].qz = tProductId[i][2]
  326. end
  327. local qz = API.GetQZ(tProductId)
  328. local productId = tProductId[qz][1]
  329. local extraRate = 0
  330. successRateReal = successRateReal + addRate + extraRate + luckRate
  331. successRateMax = successRateMax + luckRate
  332. if successRateReal > successRateMax then
  333. successRateReal = successRateMax
  334. end
  335. info(tCostItem1, "tCostItem1", "合成数据")
  336. local isMarkEquip = false
  337. local equipStrengthlv = nil
  338. local equipAppendLv = nil
  339. local equipEntrys = {}
  340. local luckEntrys = {}
  341. for i = 1, #tCostItem1 do
  342. local bagIndex = tCostItem1[i].bagIndex
  343. if isMarkEquip == false then
  344. isMarkEquip = true
  345. local itemInfo = getbagiteminfo(actor, bagIndex, 0)
  346. local cfgItem = nil
  347. if itemInfo ~= nil then
  348. cfgItem = ConfigDataManager.getById("cfg_item", itemInfo.cfgid)
  349. end
  350. if cfgItem ~= nil and cfgItem.type == "2" then
  351. equipStrengthlv = EquipFunc.getEquipStrengthLevel(actor, itemInfo.id)
  352. equipAppendLv = EquipFunc.getEquipAppendLevel(actor, itemInfo.id)
  353. local tmpentrys = API.TableDeepcopy(itemInfo.entries)
  354. for i, v in ipairs(tmpentrys) do
  355. if EquipRandom.Config.ATTR_VALUES[v.entryid] then
  356. table.insert(luckEntrys, {
  357. value = v.value,
  358. entryid = tostring(v.entryid),
  359. attrid = tostring(v.attrid)
  360. })
  361. else
  362. table.insert(equipEntrys, {
  363. value = v.value,
  364. entryid = tostring(v.entryid),
  365. attrid = tostring(v.attrid)
  366. })
  367. end
  368. end
  369. end
  370. end
  371. if tCostItem1[i].cantDestroy == nil or tCostItem1[i].cantDestroy ~= true then
  372. destroyitemafter(actor, bagIndex, "道具合成")
  373. end
  374. end
  375. info(tCostItem2, "tCostItem2", "合成数据")
  376. if isCostLuck then
  377. Bag.costMap(actor, {
  378. [tonumber(cfg_synthesis.useluck)] = 1
  379. }, "合成扣除材料消耗")
  380. end
  381. if isCostProtect then
  382. Bag.costMap(actor, {
  383. [tonumber(cfg_synthesis.useprotect)] = 1
  384. }, "合成扣除材料消耗")
  385. end
  386. Bag.costMap(actor, tCostItem2, "合成扣除材料消耗")
  387. -- 检测概率 successRateReal
  388. local successRate = math.random(1, 100)
  389. if successRate > successRateReal then
  390. sendluamsg(actor, LuaMessageIdToClient.RES_ITEM_SYNTHESIS, {})
  391. messagebox(actor, "合成失败")
  392. return
  393. end
  394. for i = 1, #tCostItem1 do
  395. local bagIndex = tCostItem1[i].bagIndex
  396. if tCostItem1[i].cantDestroy ~= nil and tCostItem1[i].cantDestroy == true then
  397. destroyitemafter(actor, bagIndex, "道具合成")
  398. end
  399. end
  400. local itemId = ItemSynthesis.addItemToBag(actor, productId, 1, 1, 9999, "合成")
  401. -- local itemId = additemtobag(actor, productId, 1, 1, 9999, "合成")
  402. if extraRate > 0 then
  403. local itemList = MaYaJiYuan_Data.PetRevelryCfg.extraRewardList
  404. for k, v in pairs(itemList) do
  405. local itemId = CommonUtil.GetItemIdByItemName(v[1])
  406. local itemCount = v[2]
  407. ItemSynthesis.addItemToBag(actor, itemId, itemCount, 1, 9999, "玛雅纪元宠物狂欢合成额外获得")
  408. end
  409. end
  410. if not string.isNullOrEmpty(cfg_synthesis.entry) then
  411. local strEntrys = string.split(cfg_synthesis.entry, "|")
  412. local entrys = {}
  413. for i, v in ipairs(strEntrys) do
  414. local ev = string.split(v, "#")
  415. table.insert(entrys, {
  416. entryid = table.count(entrys) + 1,
  417. attrid = ev[1],
  418. value = tonumber(ev[2])
  419. })
  420. end
  421. resetequipentry(actor, itemId, entrys)
  422. if cfg_synthesis.type == "11" then
  423. local cfg_item = ConfigDataManager.getById("cfg_item", tonumber(productId))
  424. local itemName = cfg_item ~= nil and cfg_item.name or ""
  425. local playerName = getbaseinfo(actor, "rolename")
  426. noticeTip.noticeinfo(actor, StringIdConst.text35009, playerName, itemName)
  427. end
  428. end
  429. if not string.isNullOrEmpty(cfg_synthesis.fastionlevel) then
  430. local lv = tonumber(cfg_synthesis.fastionlevel)
  431. -- 刷新装备
  432. API.SetItemData(actor, itemId, "strengthlv", lv)
  433. -- 刷新流光
  434. API.refreshLiuGuang(actor, itemId)
  435. Equip_QiangHua.RefreshLevel(actor, itemId, tonumber(productId))
  436. end
  437. local transfers = cfg_synthesis.transfer
  438. if not string.isNullOrEmpty(transfers) and ConfigDataManager.getTableValue("cfg_item", "type", "id", productId) ==
  439. "2" then
  440. local ss = string.split(transfers, "#")
  441. local resultEntrys = {}
  442. for i, v in ipairs(ss) do
  443. local type = tonumber(v)
  444. if type == 1 and equipStrengthlv ~= nil and equipStrengthlv > 0 and
  445. Equip_QiangHua.canQiangHua(actor, nil, itemId) then
  446. local lv = equipStrengthlv
  447. -- 刷新装备
  448. API.SetItemData(actor, itemId, "strengthlv", lv)
  449. -- 刷新流光
  450. API.refreshLiuGuang(actor, itemId)
  451. Equip_QiangHua.RefreshLevel(actor, itemId, tonumber(productId))
  452. elseif type == 2 and equipAppendLv ~= nil and equipAppendLv > 0 and
  453. ConfigDataManager.getById("cfg_equip_appends", productId) ~= nil then
  454. EquipAndAppear.setAppendLv(actor, itemId, equipAppendLv)
  455. elseif type == 3 and table.count(luckEntrys) > 0 then
  456. for i, v in ipairs(luckEntrys) do
  457. table.insert(resultEntrys, v)
  458. end
  459. elseif type == 4 and table.count(equipEntrys) > 0 then
  460. for i, v in ipairs(equipEntrys) do
  461. table.insert(resultEntrys, v)
  462. end
  463. end
  464. end
  465. if table.count(resultEntrys) > 0 then
  466. resetequipentry(actor, itemId, resultEntrys)
  467. end
  468. end
  469. -- info(tConsumeItem,"tConsumeItem","合成数据")
  470. -- local name = getrolefield(actor, "role.basic.name")
  471. -- local itemName = ConfigDataManager.getTableValue("cfg_item", "name", "id", itemId)
  472. -- noticeTip.noticeinfo(actor, StringIdConst.TEXT503, name, itemName)
  473. sendluamsg(actor, LuaMessageIdToClient.RES_ITEM_SYNTHESIS, {})
  474. sendluamsg(actor, LuaMessageIdToClient.COMMON_REWARD_PANEL, {{
  475. id = itemId,
  476. cfgId = productId,
  477. count = 1
  478. }})
  479. -- ---触发合成任务
  480. local taskParam = {
  481. synthesisid = synthesisCfgId,
  482. num = count
  483. }
  484. TaskHandler.TriggerTaskGoal(actor, TaskTargetType.SYNTHESIS, taskParam)
  485. -- HeChengQiangHuaTiaoZhan.CheckTaskIsFinish(actor, { { itemId = itemId, itemCfgId = productId, count = 1 } })
  486. -- DaKaHuoDong.CheckTaskIsFinish(actor, DaKaHuoDong.taskType.forging, 1)
  487. end
  488. function ItemSynthesis.addItemToBag(actor, itemCfgId, num, bind, type, desc)
  489. local itemId = additemtobag(actor, itemCfgId, num, bind, type, desc)
  490. local item = getbagiteminfo(actor, itemId, 1)
  491. local cfgEquip = ConfigDataManager.getById("cfg_equip_entryLib", itemCfgId)
  492. if item ~= nil and cfgEquip ~= nil and cfgEquip.skillgemprobability ~= nil and cfgEquip.skillgemprobability ~= "" then
  493. local skillGems = string.split(cfgEquip.skillgemprobability, "#")
  494. if table.count(skillGems) == 3 then
  495. local skillId = tonumber(skillGems[1])
  496. local level = tonumber(skillGems[2])
  497. local probability = tonumber(skillGems[3])
  498. local skills = {}
  499. if math.random(1, 10000) <= probability then
  500. -- -- 添加装备技能
  501. -- local info = getbagiteminfo(actor, itemId, 1)
  502. -- if table.count(info.skill) == 0 then
  503. -- setequipskillbyid(actor, itemId, skillId, level)
  504. -- end3
  505. table.insert(skills, {
  506. skillid = skillId,
  507. skilllevel = level
  508. })
  509. end
  510. if table.count(skills) > 0 then
  511. API.SetItemData(actor, itemId, "skillinfo", skills)
  512. end
  513. end
  514. end
  515. -- 装备添加物品来源
  516. if cfgEquip ~= nil then
  517. local playerName = getbaseinfo(actor, "rolename")
  518. API.SetItemData(actor, itemId, "formt", 2)
  519. API.SetItemData(actor, itemId, "form1", "")
  520. API.SetItemData(actor, itemId, "form2", playerName)
  521. API.SetItemData(actor, itemId, "form3", getbaseinfo("now"))
  522. end
  523. return itemId
  524. end
  525. -- 合成装备增加追加属性
  526. function ItemSynthesis.changeItemAtt(actor, itemId, changeItemId)
  527. local allequip = getplaydef(actor, "T$luaitemextdata")
  528. if not allequip then
  529. return
  530. end
  531. local equipext = allequip[changeItemId]
  532. if equipext == nil then
  533. return
  534. end
  535. allequip[itemId] = equipext
  536. EquipAndAppear.SetItemExtData(actor, itemId, equipext)
  537. allequip[changeItemId] = {}
  538. setplaydef(actor, "T$luaitemextdata", allequip)
  539. end
  540. -- 前后交互
  541. GameEvent.add(EventCfg.onHandlereQuest, function(actor, msgid, sMsg)
  542. if msgid == LuaMessageIdToSever.REQ_ITEM_SYNTHESIS then
  543. ItemSynthesis.synthesis(actor, sMsg)
  544. return true
  545. end
  546. end, this.filename)
  547. -- end