ItemConfigProxy.lua 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. local DebugProxy = requireProxy("DebugProxy")
  2. local ItemConfigProxy = class("ItemConfigProxy", DebugProxy)
  3. ItemConfigProxy.NAME = global.ProxyTable.ItemConfigProxy
  4. local tonumber = tonumber
  5. local split = string.split
  6. local sgsub = string.gsub
  7. local ArticleType =
  8. {
  9. TYPE_DROP = 1, --禁止丢弃
  10. TYPE_TRADE = 2, --禁止交易
  11. TYPE_STORAGE_STORE = 3, --禁止存仓库
  12. TYPE_FIX = 4, --禁止修理
  13. TYPE_SELL = 5, --禁止出售
  14. TYPE_ONLINE_HIDE = 6, --上线消失
  15. TYPE_DIE_DROP = 7, --死亡必爆(和规则14二选一)
  16. TYPE_HERO_USE = 8, --禁止英雄使用
  17. TYPE_TRADE_AUCTIONA = 9, --禁止摆摊和上架拍卖行 上架交易行也走这个
  18. TYPE_STORAGE_PERSON_STORE = 10, --禁止存入个人商店
  19. TYPE_CHALLENGE = 11, --禁止挑战
  20. TYPE_GEM_UPGRADE = 12, --禁止宝石升级
  21. TYPE_DROP_TITLE = 13, --禁止掉落提示
  22. TYPE_DIE_NOT_DROP = 14, --禁止人物爆出(和规则4二选一)
  23. TYPE_STORE_DISCOUNT = 15, --禁止店铺打折
  24. TYPE_INTO = 16, --禁止捡取
  25. TYPE_OFFLINE_DROP = 17, --下线必掉
  26. TYPE_DROP_HIDE = 18, --丢弃消失
  27. TYPE_PLAYER_USE = 19, --禁止人物使用
  28. TAKE_TAKE_ARMRINGL = 20, --禁止左手镯位置穿戴
  29. }
  30. local BindArticleType =
  31. {
  32. TYPE_NODROP = 1, --禁止扔
  33. TYPE_NOTRADE = 2, --禁止交易
  34. TYPE_NOSTORE = 3, --禁止存
  35. TYPE_NOREPAIR = 4, --禁止修
  36. TYPE_NOSELL = 5, --禁止出售
  37. TYPE_NODIEDROP = 6, --禁止爆出
  38. TYPE_DROPHIDE = 7, --丢弃消失
  39. TYPE_DIEDROP = 8, --死亡必爆
  40. TYPE_NOSTALL = 9, --禁止拍卖
  41. TYPE_CHALLENGE = 10, --禁止挑战
  42. }
  43. local toItemArticeType =
  44. {
  45. [BindArticleType.TYPE_NODROP] = ArticleType.TYPE_DROP,
  46. [BindArticleType.TYPE_NOTRADE] = ArticleType.TYPE_TRADE,
  47. [BindArticleType.TYPE_NOSTORE] = ArticleType.TYPE_STORAGE_STORE,
  48. [BindArticleType.TYPE_NOREPAIR] = ArticleType.TYPE_FIX,
  49. [BindArticleType.TYPE_NOSELL] = ArticleType.TYPE_SELL,
  50. [BindArticleType.TYPE_NODIEDROP] = ArticleType.TYPE_DIE_NOT_DROP,
  51. [BindArticleType.TYPE_DROPHIDE] = ArticleType.TYPE_DROP_HIDE,
  52. [BindArticleType.TYPE_DIEDROP] = ArticleType.TYPE_DIE_DROP,
  53. [BindArticleType.TYPE_NOSTALL] = ArticleType.TYPE_TRADE_AUCTIONA,
  54. [BindArticleType.TYPE_CHALLENGE] = ArticleType.TYPE_CHALLENGE,
  55. }
  56. function ItemConfigProxy:ctor(...)
  57. ItemConfigProxy.super.ctor(self,...)
  58. self.config = {}
  59. self.nameConfig = {}
  60. self.gmConfig = {}
  61. self._item_change_look = {}
  62. self._item_change_effect = {}
  63. self._item_change_sEffect = {}
  64. end
  65. --[[ 道具属性字段 部分字段不在道具表中有配 为前端自己添加进数据 AddItemConfig(item) 补全
  66. !!!!! 服务器新增字段 要在AddItemConfig(item) 方法中加上
  67. AniCount = 0,
  68. batch = 0, 是否可以批量使用 1 可以
  69. Color = 255,
  70. Desc = "" 描述
  71. Dura = 0 当前持久
  72. DuraMax = 1 最大持久
  73. Index = 11 道具表配置
  74. Job = 0 装备职业 0 1 2 战 法 道 3通用
  75. Looks = 11 内观ID
  76. MakeIndex = 11 服务器生成 唯一ID
  77. Name = "赤血魔剑" 道具名字
  78. Need = "0" 使用条件
  79. Price = 11 出售价格
  80. Reserved = 12
  81. Shape = 30
  82. Source = 0
  83. StdMode = 5 大类
  84. Values = { --极品属性 包括强化 强化属性对应的属性ID可用 GetExAttMap() 获得 16 17 18特殊 16为强化成功星星数 17为失败 18 炼魂等级 19 精炼等级
  85. 1 = {
  86. Id = 5,
  87. Value 1
  88. }
  89. }
  90. Weight = 22 重量
  91. Where = -1 穿戴位置 当前在装备栏中位置 不在装备栏 -1
  92. attribute = "3#3#15|3#4#310" -- 装备属性
  93. honour = ""
  94. huishou = "" 回收相关
  95. nBindIdx = 0 绑定相关 不为0 即为绑定 为自己则单纯绑定 为其他 则消耗本身 不足时用对应道具做替代 默认1:1
  96. nMaxStar = 0 可强化上限
  97. nMaxLianHun = 0 可炼魂上限
  98. nQuality = 0 品质
  99. sEffect = "0" 内观特效 11#0 #前为特效ID #后为层级 0为在上层 1在下层
  100. OverLap = 0 叠加 大于一 则为叠加
  101. Level = 0 等级
  102. AutoUse = 0 自动使用
  103. refine = 1 是否可以精炼
  104. refineatt = 当前精炼属性
  105. pickCondition = "$(LEVEL) > 100|1" -- 自动拾取条件|小精灵不自动拾取开关(1)
  106. QiugouGoldList = "1#200|2#100" 货币类型1#最小200|货币类型2#最小100 --求购物品限制的货币类型和最小值
  107. QiugouMaxCnt = 100 -- 限制的求购数量最大值
  108. 装备部分配置 装备位置相关 EquipPosTypeConfig.lua
  109. 内观偏移 equipOffest.lua
  110. 内观相关头发 hairOffest.lua
  111. 道具部分前端设定 ItemsConfig.lua
  112. ]]
  113. function ItemConfigProxy:LoadConfig()
  114. local GameConfigMgrProxy = global.Facade:retrieveProxy(global.ProxyTable.GameConfigMgrProxy)
  115. local config = nil
  116. local noToClientCfg = "#" .. (SL:GetMetaValue("SERVER_OPTIONS", global.MMO.SERVER_NO_TO_CLIENT_CFG) or "") .. "#"
  117. local filePath = "data_config/Output/cfg_stditem.txt"
  118. if string.find(noToClientCfg, "#cfg_stditem#") then
  119. if global.FileUtilCtl:isFileExist(filePath) then
  120. local stdItemStr = global.FileUtilCtl:getDataFromFileEx(filePath)
  121. local cjson = require("cjson")
  122. local stdItemConfig = cjson.decode(stdItemStr)
  123. config = stdItemConfig.Value
  124. end
  125. else
  126. config = GameConfigMgrProxy:getConfigByKey("cfg_stditem")
  127. end
  128. local AuctionProxy = global.Facade:retrieveProxy(global.ProxyTable.AuctionProxy)
  129. local StallProxy = global.Facade:retrieveProxy(global.ProxyTable.StallProxy)
  130. local PurchaseProxy = global.Facade:retrieveProxy(global.ProxyTable.PurchaseProxy)
  131. AuctionProxy:clearCurrencies()
  132. StallProxy:clearCurrencies()
  133. PurchaseProxy:clearData()
  134. self.nameConfig = {}
  135. local newList = {}
  136. local drugAndSome = {}
  137. local cityStone = {}
  138. local randStone = {}
  139. local drugHY = {}
  140. local drugLY = {}
  141. local drugSHY = {}
  142. local allDrugPack = {}
  143. local fixItemDrug = {}
  144. local Currency = {}
  145. local itemList = {}
  146. if config then
  147. -- 装备道具表的一些key默认值
  148. local keyValue = {
  149. ["Index"] = 0,
  150. ["Name"] = "",
  151. ["StdMode"] = 0,
  152. ["Shape"] = 0,
  153. }
  154. local function keyDefaultValue(config)
  155. for k, v in pairs(keyValue) do
  156. if not config[k] then
  157. config[k] = v
  158. end
  159. end
  160. end
  161. -- 道具装备表的一些分割key和value
  162. local splitKeyValue = {
  163. ["Reserved"] = {"Reserved", "AutoEat"},
  164. ["NeedLevel"] = {"NeedLevel", "NeedLevelParam"}
  165. }
  166. local function splitKeys(config)
  167. for k, v in pairs(splitKeyValue) do
  168. if type(config[k]) == "string" then
  169. local splitArray = string.split(config[k], "#")
  170. config[v[1]] = splitArray[1]
  171. config[v[2]] = splitArray[2] or 0
  172. end
  173. end
  174. end
  175. for k,v in pairs(config) do
  176. keyDefaultValue(v)
  177. splitKeys(v)
  178. self.nameConfig[v.Name] = v
  179. newList[v.Index] = v
  180. newList[v.Index].Dura = v.DuraMax
  181. if v.Index < 100 then --货币
  182. table.insert(Currency, v.Index)
  183. end
  184. if v.AutoEat ~= 1 then
  185. if (v.StdMode == 3 and v.Shape == 3) or (v.StdMode == 2 and v.Shape == 1 and v.Source == 1) or (v.StdMode == 2 and v.Shape == 3) then
  186. -- 回城石
  187. table.insert(cityStone, v.Index)
  188. elseif (v.StdMode == 3 and (v.Shape == 2 or v.Shape == 1)) or (v.StdMode == 2 and v.Shape == 2) then
  189. -- 随机石
  190. table.insert(randStone, v.Index)
  191. end
  192. end
  193. if v.AutoEat ~= 1 then
  194. -- 红蓝瞬回药
  195. if v.StdMode == 0 and v.Shape == 0 and v.effectParam and string.find(v.effectParam, "%d+#0$") then
  196. -- 红药
  197. table.insert(drugHY, v.Index)
  198. elseif v.StdMode == 0 and v.Shape == 0 and v.effectParam and string.find(v.effectParam, "^0#%d+") then
  199. -- 蓝药
  200. table.insert(drugLY, v.Index)
  201. elseif v.StdMode == 0 and v.Shape == 1 and v.effectParam and string.find(v.effectParam, "[1-9]%d*#[1-9]%d*") then
  202. -- 瞬回药
  203. table.insert(drugSHY, v.Index)
  204. end
  205. end
  206. -- 药品包
  207. if v.StdMode == 31 and v.AutoEat ~= 1 then
  208. table.insert(allDrugPack, v)
  209. end
  210. -- 修复神水
  211. if v.StdMode == 2 and v.Shape == 9 and v.AutoEat ~= 1 then
  212. table.insert(fixItemDrug, v.Index)
  213. end
  214. -- 拍卖货币
  215. if v.StdMode == 41 and (v.Shape == 99 or v.Shape == 97) then
  216. AuctionProxy:addCurrency(v)
  217. end
  218. --摆摊货币
  219. if v.StdMode == 41 and (v.Shape == 99 or v.Shape == 98) then
  220. StallProxy:addCurrency(v)
  221. end
  222. if v.StdMode >=0 and v.StdMode <=3 then
  223. drugAndSome[v.Index] = newList[v.Index]
  224. end
  225. --祝福罐持久
  226. if v.StdMode == 96 then
  227. newList[v.Index].Dura = 0
  228. end
  229. --聚灵珠持久
  230. if v.StdMode == 49 then
  231. newList[v.Index].Dura = 0
  232. newList[v.Index].DuraMax = v.DuraMax * 10000
  233. end
  234. local typeItems = PurchaseProxy:GetFirstFilterItem()
  235. local function checkStdModeFit(id, itemStdMode)
  236. local stdmodeList = PurchaseProxy:GetStdModeByID(id)
  237. for _, v in ipairs(stdmodeList) do
  238. if v == itemStdMode then
  239. return true
  240. end
  241. end
  242. return false
  243. end
  244. -- 物品禁止求购 -1
  245. local function checkItemPurchase(itemData)
  246. local isForbid = itemData.QiugouMaxCnt == -1
  247. return isForbid
  248. end
  249. for firstLevel, secondItems in pairs(typeItems) do
  250. for _, item in ipairs(secondItems) do
  251. if #secondItems == 1 and not item.secondlevel then
  252. item.secondlevel = 1
  253. item.secondlevelname = "全部"
  254. end
  255. if firstLevel and item.secondlevel and string.find(item.stdmode or "", tostring(v.StdMode)) and checkStdModeFit(item.id, v.StdMode) then
  256. local key = string.format("%s_%s", firstLevel, item.secondlevel)
  257. if not itemList[key] then
  258. itemList[key] = {}
  259. end
  260. if not checkItemPurchase(v) then
  261. table.insert(itemList[key], v.Index)
  262. end
  263. end
  264. end
  265. end
  266. end
  267. end
  268. PurchaseProxy:SetTypeItemList(itemList)
  269. -- 优先级排序
  270. local function sortCB(a, b)
  271. local ac = newList[a]
  272. local bc = newList[b]
  273. if not ac or not bc then
  274. return false
  275. end
  276. if not ac.Reserved or not bc.Reserved then
  277. return false
  278. end
  279. local ar = tonumber(ac.Reserved) or 0
  280. local br = tonumber(bc.Reserved) or 0
  281. return ar < br
  282. end
  283. table.sort(cityStone, sortCB)
  284. table.sort(randStone, sortCB)
  285. table.sort(drugHY, sortCB)
  286. table.sort(drugLY, sortCB)
  287. table.sort(drugSHY, sortCB)
  288. SL:SetMetaValue("GAME_DATA","cityStone",cityStone)
  289. SL:SetMetaValue("GAME_DATA","randStone",randStone)
  290. SL:SetMetaValue("GAME_DATA","drugHY",drugHY)
  291. SL:SetMetaValue("GAME_DATA","drugLY",drugLY)
  292. SL:SetMetaValue("GAME_DATA","drugSHY",drugSHY)
  293. SL:SetMetaValue("GAME_DATA","allDrugPack",allDrugPack)
  294. SL:SetMetaValue("GAME_DATA","fixItemDrug",fixItemDrug)
  295. SL:SetMetaValue("GAME_DATA","Currency",Currency)
  296. self.config = newList
  297. self.gmConfig = clone(newList)
  298. end
  299. function ItemConfigProxy:GetItemGMConfigData()
  300. return self.gmConfig
  301. end
  302. function ItemConfigProxy:GetItemConfigData()
  303. return self.config
  304. end
  305. function ItemConfigProxy:GetItemDataByIndex(Index)
  306. Index = tonumber(Index)
  307. return self.config[Index] or {}
  308. end
  309. function ItemConfigProxy:GetItemTypeByStdMode(StdMode)
  310. if StdMode then
  311. if not self._item_type_name then
  312. self._item_type_name = {}
  313. local arrays = string.split(SL:GetMetaValue("GAME_DATA","itemTypeName") or "", "|")
  314. for i, v in ipairs(arrays) do
  315. if v and v ~= "" then
  316. local array = string.split(v, "#")
  317. if tonumber(array[1]) and array[2] then
  318. self._item_type_name[tonumber(array[1])] = array[2]
  319. end
  320. end
  321. end
  322. end
  323. return self._item_type_name[StdMode]
  324. end
  325. return nil
  326. end
  327. function ItemConfigProxy:GetItemName(Index)
  328. local itemData = self:GetItemDataByIndex(Index)
  329. if not itemData then
  330. return nil
  331. end
  332. return itemData.Name
  333. end
  334. function ItemConfigProxy:GetItemNameColor(Index)
  335. local itemData = self:GetItemDataByIndex(Index)
  336. if not itemData or not itemData.Color then
  337. return "#FFFFFF"
  338. end
  339. return GET_COLOR_BYID(self.config[Index].Color)
  340. end
  341. function ItemConfigProxy:GetItemNameColorId(Index)
  342. local itemData = self:GetItemDataByIndex(Index)
  343. if not itemData or not itemData.Color then
  344. return 1006
  345. end
  346. return itemData.Color
  347. end
  348. function ItemConfigProxy:GetItemGuangZhu(Index)
  349. local itemData = self:GetItemDataByIndex(Index)
  350. if not itemData then
  351. return nil
  352. end
  353. local splitArray = string.split(itemData.guangzhu or "", "#")
  354. return splitArray[1], tonumber(splitArray[2])~=1
  355. end
  356. function ItemConfigProxy:GetItemLooks(Index)
  357. local itemData = self:GetItemDataByIndex(Index)
  358. if not itemData then
  359. return -1
  360. end
  361. return itemData.Looks or -1
  362. end
  363. --获取优先级
  364. function ItemConfigProxy:GetItemComparison(Index)
  365. -- body
  366. local comparison = 0
  367. local job = -1
  368. if self.config[Index] then
  369. local comparisonV = self.config[Index].comparison
  370. if tonumber(comparisonV) then
  371. comparison = tonumber(comparisonV)
  372. job = 3
  373. else
  374. local array = string.split(comparisonV, "#")
  375. job = array[1] and tonumber(array[1]) or 3
  376. comparison = array[2] and tonumber(array[2]) or 0
  377. end
  378. end
  379. return comparison, job
  380. end
  381. function ItemConfigProxy:CheckItemBind(Index)
  382. local itemData = self:GetItemDataByIndex(Index)
  383. if not itemData then
  384. return false, nil
  385. end
  386. local bindIndex = itemData.nBindIdx
  387. local bind = false
  388. if bindIndex == itemData.Index then -- 等于自己单纯绑定
  389. bind = true
  390. elseif bindIndex ~= 0 then -- 绑定 并且等价 即本身消耗不够时可以用绑定道具代替
  391. bind = true
  392. end
  393. return bind, bindIndex
  394. end
  395. function ItemConfigProxy:GetSameReservedByMoneyIndex(Index)
  396. local itemData = self:GetItemDataByIndex(Index)
  397. if not itemData then
  398. return {}
  399. end
  400. local itemData2 = nil
  401. local moneys = {}
  402. local Currencys = SL:GetMetaValue("GAME_DATA","Currency") or {}
  403. if tonumber(itemData.Reserved) ~= 0 then
  404. for i, v in ipairs(Currencys) do
  405. itemData2 = self:GetItemDataByIndex(v)
  406. if itemData2.Reserved == itemData.Reserved and itemData2.Index ~= Index then
  407. table.insert(moneys, v)
  408. end
  409. end
  410. end
  411. return moneys
  412. end
  413. function ItemConfigProxy:GetItemQuality(Index)
  414. local itemData = self:GetItemDataByIndex(Index)
  415. if not itemData then
  416. return 0
  417. end
  418. return itemData.nQuality or 0
  419. end
  420. function ItemConfigProxy:GetItemNameByIndex(Index)
  421. local itemData = self:GetItemDataByIndex(Index)
  422. if not itemData then
  423. return "ERROR ITEM INDEX" .. Index
  424. end
  425. return itemData.Name or ""
  426. end
  427. function ItemConfigProxy:GetItemIndexByName(name)
  428. return self.nameConfig[name] and self.nameConfig[name].Index
  429. end
  430. function ItemConfigProxy:GetItemReservedByIndex(Index)
  431. local itemData = self:GetItemDataByIndex(Index)
  432. if not itemData then
  433. return 0
  434. end
  435. return itemData.Reserved or 0
  436. end
  437. function ItemConfigProxy:CheckItemTreasureBox(item)
  438. -- body
  439. if not item or not next(item) then
  440. return false
  441. end
  442. return item.StdMode == 31 and item.Shape >= 1 and item.Shape <= 99 and item.Reserved == 1
  443. end
  444. function ItemConfigProxy:CheckItemTreasureBoxKey(item)
  445. -- body
  446. if not item or not next(item) then
  447. return false
  448. end
  449. return item.StdMode == 40 and item.Shape >= 1 and item.Shape <= 99
  450. end
  451. function ItemConfigProxy:CheckItemOverLapById(Index)
  452. local itemData = self:GetItemDataByIndex(Index)
  453. if not itemData or not itemData.OverLap then
  454. return false
  455. end
  456. return itemData.OverLap > 1
  457. end
  458. function ItemConfigProxy:CheckItemOverLap(item)
  459. if not item or not next(item) then
  460. return false
  461. end
  462. return item.OverLap > 1
  463. end
  464. function ItemConfigProxy:CheckItemBatch(item)
  465. if not item or not next(item) then
  466. return false
  467. end
  468. return item.batch and item.batch > 0
  469. end
  470. function ItemConfigProxy:CheckItemAutoUse(item)
  471. if not item or not next(item) then
  472. return false
  473. end
  474. return item.AutoUse and item.AutoUse <= 0
  475. end
  476. --获取规则类型表
  477. function ItemConfigProxy:GetArticleType()
  478. return ArticleType
  479. end
  480. function ItemConfigProxy:GetBindArticleType()
  481. return BindArticleType
  482. end
  483. -- 道具规则转换服务端下发的禁止类型
  484. function ItemConfigProxy:GetBindArticleTypeToItemArticle(itemArticle)
  485. if not itemArticle then
  486. return nil
  487. end
  488. return toItemArticeType[itemArticle]
  489. end
  490. -- 获取item规则 Index: 道具Index itemArticles: 规则类型表 {[类型]=true}
  491. function ItemConfigProxy:GetItemArticle(Index, itemArticles)
  492. if not Index or not itemArticles then
  493. return false
  494. end
  495. local itemData = self:GetItemDataByIndex(Index)
  496. if not itemData then
  497. return false
  498. end
  499. if not itemData.Article or itemData.Article == "" then
  500. return false
  501. end
  502. local itemArticle = nil
  503. local parseArticle = string.split(itemData.Article, "|")
  504. for k, v in pairs(parseArticle) do
  505. local articleV = v and tonumber(v) or nil
  506. if articleV and itemArticles[articleV] then --禁止规则
  507. itemArticle = articleV
  508. break
  509. end
  510. end
  511. return itemArticle
  512. end
  513. --获取item改变的look, effect
  514. function ItemConfigProxy:GetChangeItemLook(MakeIndex, Index)
  515. if not MakeIndex then
  516. return nil, nil, nil
  517. end
  518. local itemData = self:GetItemDataByIndex(Index)
  519. if not itemData then
  520. return nil, nil, nil
  521. end
  522. local newLook = self._item_change_look[MakeIndex]
  523. local newEffect = self._item_change_effect[MakeIndex]
  524. local newSEffect = self._item_change_sEffect[MakeIndex]
  525. newLook = newLook and newLook > 0 and newLook or itemData.Looks
  526. newEffect = newEffect and newEffect > 0 and newEffect or itemData.bEffect
  527. newSEffect = newSEffect and newSEffect > 0 and newSEffect or itemData.sEffect
  528. return newLook, newEffect, newSEffect
  529. end
  530. --设置item改变的look MakeIndex: 唯一id newLook: 道具图片 newEffect: 背包特效 newSEffect: 内观特效
  531. function ItemConfigProxy:SetChangeItemLook(MakeIndex, newLook, newEffect, newSEffect)
  532. self._item_change_look[MakeIndex] = newLook
  533. self._item_change_effect[MakeIndex] = newEffect
  534. self._item_change_sEffect[MakeIndex] = newSEffect
  535. local BagProxy = global.Facade:retrieveProxy(global.ProxyTable.Bag)
  536. local data = BagProxy:GetItemDataByMakeIndex(MakeIndex)
  537. if data and data.Index then
  538. data.Looks, data.bEffect, data.sEffect = self:GetChangeItemLook(MakeIndex, data.Index)
  539. else
  540. local EquipProxy = global.Facade:retrieveProxy(global.ProxyTable.Equip)
  541. EquipProxy:ChangeEquipLook(MakeIndex)
  542. end
  543. end
  544. --更换item look
  545. function ItemConfigProxy:handle_MSG_SM_SETITEMLOOKS(msg)
  546. local msgHdr = msg:GetHeader()
  547. local MakeIndex = msgHdr.param1
  548. self:SetChangeItemLook(MakeIndex, msgHdr.param2, msgHdr.param3, msgHdr.recog)
  549. end
  550. function ItemConfigProxy:onRegister()
  551. ItemConfigProxy.super.onRegister(self)
  552. local msgType = global.MsgType
  553. LuaRegisterMsgHandler(msgType.MSG_SC_SETITEMLOOKS, handler(self, self.handle_MSG_SM_SETITEMLOOKS))
  554. end
  555. return ItemConfigProxy