ShapeShiftCardInfo.lua 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. ---@class ShapeShiftCardInfo @变身卡牌
  2. ShapeShiftCardInfo = class()
  3. local this = ShapeShiftCardInfo
  4. --region dataStruct
  5. ---@class BagShapeShiftCard
  6. ---@field id number
  7. ---@field cfgid number
  8. ---@field entry table
  9. ---@field base table
  10. ---@field type number
  11. ---@field quality number
  12. ---@field group number
  13. ---@field breakLuck number
  14. ---@field tbl cfg_card_shapeshift_column
  15. ---@class ShapeShiftMessage
  16. ---@field part ShapeShiftCardMessage[]
  17. ---@class ShapeShiftCardMessage
  18. ---@field luck number
  19. ---@field unlock boolean
  20. ---@field card CardMessage
  21. ---@class CardMessage
  22. ---@field id number
  23. ---@field cfgid number
  24. ---@field entry table
  25. ---@field base table
  26. --endregion
  27. function this:ctor()
  28. end
  29. function this:Reset()
  30. if self.timer then
  31. SL:UnSchedule(self.timer)
  32. self.timer = nil
  33. end
  34. SL:SetMetaValue(EMetaVarSetKey.SET_OUT_RELEASE_LIMIT_SKILL)
  35. SL:SetMetaValue(EMetaVarSetKey.SET_OUT_ME_SHAPE_MONSTER)
  36. self.shiftMonsterGroup = 0
  37. self.cardDataIsReady = false
  38. self.allPartsInfo = {}
  39. self.eachCardCount = {}
  40. self.shiftSkill = {}
  41. self.allTransferSkillList = {}
  42. self.transferGroupCDList = {}
  43. self.onHookTransferSkill = {}
  44. end
  45. function this:Init()
  46. self:InitData()
  47. self:RegistMessages()
  48. end
  49. function this:InitData()
  50. ---@type cfg_card_shapeshift_column[]
  51. self.cfg_card_shapeshift = SL:GetConfigTable("cfg_card_shapeshift")
  52. self.allPartsInfo = {}
  53. self.eachCardCount = {}
  54. self.shiftSkill = {}
  55. self.allTransferSkillList = {}
  56. self.transferGroupCDList = {}
  57. self.onHookTransferSkill = {}
  58. self.cardDataIsReady = false
  59. end
  60. function this:RegistMessages()
  61. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_TRANSFER_CARD_PART_INFO, self.RES_TRANSFER_CARD_PART_INFO, self)
  62. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_TRANSFER_CARD_MODEL_VIEW, self.RES_TRANSFER_CARD_MODEL_VIEW, self)
  63. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_TRANSFER_CARD_BAG, self.RES_TRANSFER_CARD_BAG, self)
  64. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_TRANSFER_CARD_REWARD_PANEL, self.RES_TRANSFER_CARD_REWARD_PANEL, self)
  65. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_TRANSFER_CARD_DURATION, self.RES_TRANSFER_CARD_DURATION, self)
  66. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_TRANSFER_CARD_CD,self.RES_TRANSFER_CARD_CD,self)
  67. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_TRANSFER_CARD_SETTING,self.RES_TRANSFER_CARD_SETTING,self)
  68. SL:RegisterLUAEvent(LUA_EVENT_TAKE_ON_EQUIP, self.RefreshShiftCardSkill, self)
  69. SL:RegisterLUAEvent(LUA_EVENT_TAKE_OFF_EQUIP, self.RefreshShiftCardSkill, self)
  70. SL:RegisterLUAEvent(LUA_EVENT_ONHOOK_STATE_CHANGE, self.LUA_EVENT_ONHOOK_STATE_CHANGE, self)
  71. end
  72. function this:RES_TRANSFER_CARD_PART_INFO(_, message)
  73. message = self:RefreshCardPartKeyToNumber(message)
  74. if message and table.count(message) > 1 then
  75. self.allPartsInfo = message
  76. else
  77. for i, v in pairs(message) do
  78. self.allPartsInfo[i] = v
  79. SL:onLUAEvent(LUA_SHAPE_CARD_PART_INFO_CHANGE, i)
  80. end
  81. end
  82. self:RefreshShiftCardSkill()
  83. ---@type KLShapeShiftCardMainPanel
  84. local ui = GUI:GetUI("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardMain/KLShapeShiftCardMainPanel")
  85. if ui then
  86. ui:RefreshMainRedPoint()
  87. else
  88. SL:RefreshPanelALLRedStateKmlByCondition("checkShapeShiftCardRedDot")
  89. end
  90. self.cardDataIsReady = true
  91. end
  92. function this:RES_TRANSFER_CARD_MODEL_VIEW(_, message)
  93. if tonumber(message["2"]) == 0 then
  94. local monsterId = AppearInfo.GetCacheMeMonsterId(tonumber(message["1"]))
  95. SL:SetMetaValue(EMetaVarSetKey.SET_OUT_ME_SHAPE_MONSTER)
  96. SL:RefreshToShowMonster(tonumber(message["1"]), monsterId)
  97. else
  98. for i, v in pairs(self.cfg_card_shapeshift) do
  99. if v.group == tonumber(message["2"]) then
  100. SL:SetMetaValue(EMetaVarSetKey.SET_OUT_ME_SHAPE_MONSTER, v.model)
  101. SL:RefreshToShowMonster(tonumber(message["1"]), v.model)
  102. break
  103. end
  104. end
  105. end
  106. if SL:GetMetaValue(EMetaVarGetKey.ACTOR_IS_MAINPLAYER, tonumber(message["1"])) then
  107. if self.cardDataIsReady then
  108. self.shiftMonsterGroup = tonumber(message["2"])
  109. SL:onLUAEvent(LUA_EVENT_REFRESH_ATTACK_SKILL)
  110. if tonumber(message["2"]) == 0 then
  111. SL:SetMetaValue(EMetaVarSetKey.SET_OUT_RELEASE_LIMIT_SKILL)
  112. self:LUA_EVENT_ONHOOK_STATE_CHANGE()
  113. else
  114. if self.shiftSkill[self.shiftMonsterGroup] then
  115. SL:SetMetaValue(EMetaVarSetKey.SET_OUT_RELEASE_LIMIT_SKILL, self:GetUnLockShiftSkill())
  116. end
  117. end
  118. ---@type KLUISystemLeftPanel
  119. local ui = GUI:GetUI("dev/ui/MainUI/Panel/KLUISystemLeft/KLUISystemLeftPanel")
  120. if ui then
  121. ui:ShapeShiftStateChangeRefreshUI()
  122. end
  123. ---@type KLUISkillInfoPanel
  124. local ui_2 = GUI:GetUI("dev/ui/Skill/Panel/KLUISkillInfo/KLUISkillInfoPanel")
  125. if ui_2 then
  126. ui_2:RefreshNormalSkillPanel()
  127. end
  128. end
  129. end
  130. end
  131. ---@param message BagShapeShiftCard[]
  132. function this:RES_TRANSFER_CARD_BAG(_, message)
  133. self.allCardInfo = {}
  134. self.eachCardCount = {}
  135. if message then
  136. for i, v in pairs(message) do
  137. ---@type cfg_item_column
  138. local item_tbl = SL:GetConfig("cfg_item", v.cfgid)
  139. ---@type cfg_card_shapeshift_column
  140. local card_tbl = SL:GetConfig("cfg_card_shapeshift", v.cfgid)
  141. local info = {}
  142. info.id = v.id
  143. info.cfgid = v.cfgid
  144. info.entry = v.entry
  145. info.base = v.base
  146. info.breakLuck = v.breakluck
  147. info.type = item_tbl.subType
  148. info.quality = card_tbl.quality
  149. info.group = card_tbl.group
  150. info.tbl = card_tbl
  151. self.allCardInfo[#self.allCardInfo + 1] = info
  152. if self.eachCardCount[info.cfgid] then
  153. self.eachCardCount[info.cfgid] = self.eachCardCount[info.cfgid] + 1
  154. else
  155. self.eachCardCount[info.cfgid] = 1
  156. end
  157. end
  158. end
  159. table.sort(self.allCardInfo, function(a, b)
  160. if a.subType ~= b.subType then
  161. return a.subType < b.subType
  162. else
  163. if a.quality ~= b.quality then
  164. return a.quality > b.quality
  165. else
  166. return a.cfgid > b.cfgid
  167. end
  168. end
  169. end)
  170. SL:onLUAEvent(LUA_SHAPE_CARD_BAG_CHANGE)
  171. ---@type KLShapeShiftCardMainPanel
  172. local ui = GUI:GetUI("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardMain/KLShapeShiftCardMainPanel")
  173. if ui then
  174. ui:RefreshMainRedPoint()
  175. else
  176. SL:RefreshPanelALLRedStateKmlByCondition("checkShapeShiftCardRedDot")
  177. end
  178. end
  179. function this:RES_TRANSFER_CARD_REWARD_PANEL(_, message)
  180. GUI:UIPanel_Open("dev/outui/ShapeShiftCard/Panel/KLShapeShiftCardAward/KLShapeShiftCardAwardPanel", nil, nil, message)
  181. end
  182. function this:RES_TRANSFER_CARD_DURATION(_, message)
  183. ---@type KLUISystemLeftPanel
  184. local ui = GUI:GetUI("dev/ui/MainUI/Panel/KLUISystemLeft/KLUISystemLeftPanel")
  185. if ui then
  186. ui:RefreshTransferDurationCD(tonumber(message["2"]))
  187. end
  188. end
  189. function this:RES_TRANSFER_CARD_CD(_, message)
  190. self.transferGroupCDList = {}
  191. for i, v in pairs(message) do
  192. self.transferGroupCDList[tonumber(i)] = v
  193. end
  194. end
  195. function this:RES_TRANSFER_CARD_SETTING(_, message)
  196. for i, v in pairs(message) do
  197. self.onHookTransferSkill[tonumber(i)] = v
  198. end
  199. end
  200. function this:isShiftMonster()
  201. if self.cardDataIsReady then
  202. if self.shiftMonsterGroup and self.shiftMonsterGroup > 0 then
  203. return true
  204. end
  205. end
  206. return false
  207. end
  208. function this:RefreshCardPartKeyToNumber(message)
  209. if message and next(message) then
  210. local tbl = {}
  211. for i, v in pairs(message) do
  212. local tbl_1 = {}
  213. for j, k in pairs(v) do
  214. tbl_1[tonumber(j)] = k
  215. end
  216. tbl[tonumber(i)] = tbl_1
  217. end
  218. return tbl
  219. end
  220. end
  221. function this:RefreshShiftCardSkill()
  222. self.equip = SL:GetTotalWearEquips()
  223. local shiftSkill = {}
  224. if self.equip[1] then
  225. for i, v in pairs(self.allPartsInfo) do
  226. if self.equip[1][i] then
  227. for ii, vv in pairs(v) do
  228. if vv.card and table.count(vv.card) > 0 then
  229. ---@type cfg_card_shapeshift_column
  230. local tbl = SL:GetConfig("cfg_card_shapeshift", vv.card.cfgid)
  231. if #tbl.skill > 0 then
  232. if shiftSkill[tbl.group] then
  233. if shiftSkill[tbl.group] < tbl.level then
  234. shiftSkill[tbl.group] = tbl.level
  235. end
  236. else
  237. shiftSkill[tbl.group] = tbl.level
  238. end
  239. end
  240. end
  241. end
  242. end
  243. end
  244. self.shiftSkill = {}
  245. for i, v in pairs(shiftSkill) do
  246. self.shiftSkill[i] = {}
  247. self.shiftSkill[i].unlockSkill = self:GetUnLockShiftSkill(i, v)
  248. self.shiftSkill[i].lockSkill = self:GetLockShiftSkill(i, v)
  249. self.shiftSkill[i].allSkill = self:GetAllShiftSkill(i, v)
  250. self.shiftSkill[i].level = v
  251. self.shiftSkill[i].group = i
  252. self:CacheAllTransferSkillByGroup(i)
  253. end
  254. SL:onLUAEvent(LUA_EVENT_SHAPE_SHIFT_CARD_SKILL_CHANGE)
  255. end
  256. end
  257. ---获取变身后解锁技能
  258. function this:GetUnLockShiftSkill(group, level)
  259. group = group or self.shiftMonsterGroup
  260. level = level or self.shiftSkill[self.shiftMonsterGroup].level
  261. local skill = {}
  262. for i, v in pairs(self.cfg_card_shapeshift) do
  263. if v.group == group and v.level == level then
  264. for j, k in pairs(v.skill) do
  265. ---@type cfg_skill_column
  266. local cfg = SL:GetConfig("cfg_skill", k[1])
  267. if cfg.type == 0 then
  268. skill[k[1]] = k[2]
  269. end
  270. end
  271. end
  272. end
  273. return skill
  274. end
  275. ---获取变身后锁定技能
  276. function this:GetLockShiftSkill(group, level)
  277. group = group or self.shiftMonsterGroup
  278. level = level or self.shiftSkill[self.shiftMonsterGroup].level
  279. local skill = {}
  280. for i, v in pairs(self.cfg_card_shapeshift) do
  281. if v.group == group and v.level > level then
  282. for j, k in pairs(v.skill) do
  283. ---@type cfg_skill_column
  284. local cfg = SL:GetConfig("cfg_skill", k[1])
  285. if cfg.type == 0 then
  286. if skill[k[1]] then
  287. if skill[k[1]] > v.level then
  288. skill[k[1]] = v.level
  289. end
  290. else
  291. skill[k[1]] = v.level
  292. end
  293. end
  294. end
  295. end
  296. end
  297. return skill
  298. end
  299. function this:GetAllShiftSkill(group, level)
  300. group = group or self.shiftMonsterGroup
  301. level = level or self.shiftSkill[self.shiftMonsterGroup].level
  302. local skill = {}
  303. for i, v in pairs(self.cfg_card_shapeshift) do
  304. if v.group == group and v.level == level then
  305. for _, k in pairs(v.skill) do
  306. ---@type cfg_skill_column
  307. local cfg = SL:GetConfig("cfg_skill", k[1])
  308. skill[k[1]] = { level = k[2], group = cfg.group, unLock = true }
  309. end
  310. elseif v.group == group and v.level > level then
  311. for _, k in pairs(v.skill) do
  312. if not skill[k[1]] then
  313. ---@type cfg_skill_column
  314. local cfg = SL:GetConfig("cfg_skill", k[1])
  315. skill[k[1]] = { level = k[2], group = cfg.group, unLock = false }
  316. end
  317. end
  318. end
  319. end
  320. return skill
  321. end
  322. function this:CacheAllTransferSkillByGroup(group)
  323. if self.shiftSkill and self.shiftSkill[group] then
  324. if not self.allTransferSkillList then
  325. self.allTransferSkillList = {}
  326. end
  327. for i, v in pairs(self.shiftSkill[group].allSkill) do
  328. self.allTransferSkillList[i] = v
  329. end
  330. end
  331. end
  332. function this:GetTransferSkillInfoBySkillId(id)
  333. if self.allTransferSkillList then
  334. return self.allTransferSkillList[id]
  335. end
  336. end
  337. ---挂机模式优先自动释放变身技能
  338. function this:LUA_EVENT_ONHOOK_STATE_CHANGE()
  339. local state = SL:GetMetaValue(EMetaVarGetKey.GET_ONHOOK_STATE)
  340. if state == EAutoOnHookStatus.OnHooking then
  341. if self:isShiftMonster() then
  342. ---已经变身
  343. return
  344. else
  345. ---是否可变身
  346. if self.shiftSkill then
  347. local nowTime = Time.GetServerTime()
  348. local maxGroup = 0
  349. local minCD
  350. ---遍历所有变身
  351. for i, v in pairs(self.shiftSkill) do
  352. ---是否设置可变身
  353. if not self.onHookTransferSkill[i] or self.onHookTransferSkill[i] == 1 then
  354. ---是否cd
  355. if not self.transferGroupCDList[i] or self.transferGroupCDList[i] <= nowTime then
  356. if maxGroup < i then
  357. maxGroup = i
  358. end
  359. else
  360. local time = self.transferGroupCDList[i] - nowTime
  361. if time > 0 then
  362. if not minCD then
  363. minCD = time
  364. elseif minCD > time then
  365. minCD = time
  366. end
  367. end
  368. end
  369. end
  370. end
  371. ---可变身
  372. if maxGroup > 0 then
  373. SL:SendLuaNetMsg(LuaMessageIdToSever.REQ_TRANSFORMATION, maxGroup)
  374. else
  375. ---全部cd则倒计时判断变身
  376. if self.timer then
  377. SL:UnSchedule(self.timer)
  378. self.timer = nil
  379. end
  380. if minCD then
  381. self.timer = SL:ScheduleOnce((minCD / 1000) + 1, function()
  382. self:LUA_EVENT_ONHOOK_STATE_CHANGE()
  383. end)
  384. end
  385. end
  386. end
  387. end
  388. else
  389. if self.timer then
  390. SL:UnSchedule(self.timer)
  391. self.timer = nil
  392. end
  393. end
  394. end
  395. function this:GetMonsterIcon(group)
  396. for i, v in pairs(self.cfg_card_shapeshift) do
  397. if v.group == group then
  398. ---@type cfg_monster_column
  399. local monster = SL:GetConfig("cfg_monster", v.model)
  400. if monster then
  401. return monster.icon, monster.name
  402. end
  403. end
  404. end
  405. end
  406. function this:GetMonsterModelId(group)
  407. group = group or self.shiftMonsterGroup
  408. for i, v in pairs(self.cfg_card_shapeshift) do
  409. if v.group == group then
  410. return v.model
  411. end
  412. end
  413. end
  414. function this:RefreshMainIconRedPoint()
  415. ---@type cfg_system_switch_column
  416. local cfg = SL:GetConfig("cfg_system_switch", 112)
  417. if cfg.needLevel <= SL:GetMetaValue("LEVEL") then
  418. if self:RefreshCardShopRedPointInfo() then
  419. return true
  420. end
  421. if self:RefreshCardInlayRedPointInfo() then
  422. return true
  423. end
  424. if self:RefreshCardSynthesisRedPointInfo() then
  425. return true
  426. end
  427. if self:RefreshCardBreakRedPointInfo() then
  428. return true
  429. end
  430. end
  431. return false
  432. end
  433. ---刷新卡牌商城红点
  434. function this:RefreshCardShopRedPointInfo()
  435. if not self.cfg_card_shop then
  436. ---@type cfg_card_shop_column[]
  437. self.cfg_card_shop = SL:GetConfigTable("cfg_card_shop")
  438. end
  439. for i, v in pairs(self.cfg_card_shop) do
  440. if SL:GetBagItemCount(v.exchangeConsume[1]) >= v.exchangeConsume[2] then
  441. return true
  442. end
  443. end
  444. return false
  445. end
  446. ---刷新卡牌镶嵌红点
  447. function this:RefreshCardInlayRedPointInfo()
  448. if self.allPartsInfo then
  449. for i, v in pairs(self.allPartsInfo) do
  450. ---@type cfg_card_inlay_column
  451. local inlay = SL:GetConfig("cfg_card_inlay", tonumber(i))
  452. for j, k in pairs(v) do
  453. if k.unlock then
  454. if not k.card or table.count(k.card) == 0 then
  455. if self:GetPartHaveCardCheck(i) then
  456. return true
  457. end
  458. end
  459. else
  460. local rank = InfoManager.shapeShiftCardInfo:GetEquipRankByPart(i)
  461. for ii, vv in ipairs(inlay.unlockParameter) do
  462. if j == vv[1] then
  463. if rank >= vv[2] then
  464. return true
  465. end
  466. end
  467. end
  468. --if inlay.unlockNormal then
  469. -- for ii, vv in ipairs(inlay.unlockNormal) do
  470. -- if vv[1] == tonumber(j) then
  471. -- if SL:GetBagItemCount(vv[2]) >= vv[3] then
  472. -- return true
  473. -- end
  474. -- end
  475. -- end
  476. --end
  477. end
  478. end
  479. end
  480. end
  481. return false
  482. end
  483. ---刷新卡牌牌库红点
  484. function this:RefreshCardHouseRedPointInfo()
  485. return false
  486. end
  487. ---刷新卡牌合成红点
  488. function this:RefreshCardSynthesisRedPointInfo()
  489. for i, v in pairs(self.eachCardCount) do
  490. ---@type cfg_card_shapeshift_column
  491. local cfg = SL:GetConfig("cfg_card_shapeshift", i)
  492. if cfg.upAmount ~= 0 then
  493. if cfg.upAmount <= v then
  494. return true
  495. end
  496. end
  497. end
  498. return false
  499. end
  500. ---刷新卡牌突破红点
  501. function this:RefreshCardBreakRedPointInfo()
  502. for i, v in pairs(self.eachCardCount) do
  503. if SL:HasConfig("cfg_card_breakthrough", i) then
  504. ---@type cfg_card_breakthrough_column
  505. local cfg = SL:GetConfig("cfg_card_breakthrough", i)
  506. if cfg.expend ~= 0 then
  507. if cfg.expend <= v then
  508. return true
  509. end
  510. end
  511. end
  512. end
  513. return false
  514. end
  515. function this:GetBagCardCountByCfgId(cfgId)
  516. return self.eachCardCount[cfgId] or 0
  517. end
  518. function this:GetPartHaveCardCheck(part)
  519. ---@type cfg_card_inlay_column
  520. local cfg = SL:GetConfig("cfg_card_inlay", part)
  521. if cfg.type == 1 then
  522. local partInfo = self.allPartsInfo[part]
  523. local limitList = {}
  524. for i, v in pairs(partInfo) do
  525. if v.card and table.count(v.card) > 0 then
  526. ---@type cfg_card_shapeshift_column
  527. local tbl = SL:GetConfig("cfg_card_shapeshift", v.card.cfgid)
  528. limitList[tbl.group] = true
  529. end
  530. end
  531. ---@type cfg_card_inlay_column
  532. local tbl = SL:GetConfig("cfg_card_inlay", part)
  533. for i, v in pairs(self.allCardInfo) do
  534. if tbl.type == v.type and not limitList[v.group] then
  535. return true
  536. end
  537. end
  538. else
  539. ---@type cfg_card_inlay_column
  540. local tbl = SL:GetConfig("cfg_card_inlay", part)
  541. for i, v in pairs(self.allCardInfo) do
  542. if tbl.type == v.type then
  543. return true
  544. end
  545. end
  546. end
  547. return false
  548. end
  549. function this:GetEquipRankByPart(part)
  550. if self.equip and self.equip[1] then
  551. if self.equip[1][part] then
  552. ---@type cfg_card_inlay_column
  553. local tbl = SL:GetConfig("cfg_card_inlay", part)
  554. if tbl.unlockType == 1 then
  555. ---@type cfg_item_column
  556. local item = SL:GetConfig("cfg_item", self.equip[1][part].cfgId)
  557. return item.rank
  558. else
  559. if self.equip[1][part].luaExtData ~= "null" and self.equip[1][part].luaExtData ~= "" then
  560. local OutEquipData = SL:JsonDecode(self.equip[1][part].luaExtData,false)---json.decode(self.equip[1][part].luaExtData)
  561. return OutEquipData.ssuplv or 0
  562. end
  563. end
  564. else
  565. return 0, true
  566. end
  567. end
  568. return 0
  569. end
  570. function this:GetNextLevelUnLockAttr(group, level)
  571. local cardNextLevelUnLockTbl = {}
  572. if not cardNextLevelUnLockTbl[group] then
  573. local info = {}
  574. for _, v in pairs(self.cfg_card_shapeshift) do
  575. if v.group == group then
  576. --if #v.specialAtt > 0 then
  577. info[v.level] = v.specialAtt
  578. --end
  579. end
  580. end
  581. if #info > 0 then
  582. cardNextLevelUnLockTbl[group] = info
  583. else
  584. return
  585. end
  586. end
  587. local normalAttr = {}
  588. if cardNextLevelUnLockTbl[group][1] then
  589. for _, v in ipairs(cardNextLevelUnLockTbl[group][1]) do
  590. normalAttr[v] = 1
  591. end
  592. end
  593. local info = {}
  594. if level < #cardNextLevelUnLockTbl[group] then
  595. for i = level + 1, #cardNextLevelUnLockTbl[group] do
  596. local attr = cardNextLevelUnLockTbl[group][i]
  597. local temp = {}
  598. if attr then
  599. for _, k in pairs(attr) do
  600. if normalAttr[k] == 1 then
  601. if not temp.normal then
  602. temp.normal = 0
  603. end
  604. temp.normal = temp.normal + 1
  605. else
  606. if not temp.special then
  607. temp.special = 0
  608. end
  609. temp.special = temp.special + 1
  610. end
  611. end
  612. end
  613. info[#info + 1] = temp
  614. end
  615. end
  616. local eachLevel = true
  617. for i, v in ipairs(info) do
  618. if not v.normal or v.normal == 0 then
  619. eachLevel = false
  620. break
  621. end
  622. end
  623. return info, eachLevel
  624. --if level < #cardNextLevelUnLockTbl[group] then
  625. -- local info = {}
  626. -- for i = level + 1, #cardNextLevelUnLockTbl[group] do
  627. -- if cardNextLevelUnLockTbl[group][i].count >= 1 then
  628. -- if normalAttr ~= then
  629. --
  630. -- end
  631. -- info[#info + 1] = cardNextLevelUnLockTbl[group][i]
  632. -- else
  633. -- info[#info + 1] = 0
  634. -- eachLevel = false
  635. -- end
  636. -- end
  637. -- return info, eachLevel
  638. --end
  639. end
  640. ---判断是否可一键
  641. ---@param funcType E_ShapeShiftCardFuncType 功能类型
  642. ---@param value number 合成-等级,突破-品质
  643. function this:GetCardLevelOrQualityCanUpgrade(funcType, cardType, value)
  644. if funcType == E_ShapeShiftCardFuncType.Synthesis then
  645. for i, v in pairs(self.eachCardCount) do
  646. ---@type cfg_card_shapeshift_column
  647. local tbl = SL:GetConfig("cfg_card_shapeshift", i)
  648. ---@type cfg_item_column
  649. local item = SL:GetConfig("cfg_item", i)
  650. if tbl.level == value and item.subType == cardType and tbl.upAmount <= v then
  651. return true
  652. end
  653. end
  654. elseif funcType == E_ShapeShiftCardFuncType.Break then
  655. for i, v in pairs(self.eachCardCount) do
  656. if SL:HasConfig("cfg_card_breakthrough", i) then
  657. ---@type cfg_card_breakthrough_column
  658. local tbl_break = SL:GetConfig("cfg_card_breakthrough", i)
  659. ---@type cfg_card_shapeshift_column
  660. local tbl_shape = SL:GetConfig("cfg_card_shapeshift", i)
  661. ---@type cfg_item_column
  662. local item = SL:GetConfig("cfg_item", i)
  663. if tbl_shape.quality == value and item.subType == cardType and tbl_break.expend <= v then
  664. return true
  665. end
  666. end
  667. end
  668. end
  669. return false
  670. end
  671. function this:GetAllCardSkillByGroup(group, level)
  672. local skill = {}
  673. for i, v in pairs(self.cfg_card_shapeshift) do
  674. if v.group == group then
  675. if v.level == level then
  676. for _, k in pairs(v.skill) do
  677. ---@type cfg_skill_info_column
  678. local cfg = SL:GetConfigMultiKeys('cfg_skill_info', k[1], k[2], 'skillID', 'skillLevel')
  679. skill[k[1]] = { lock = false, level = k[2], cardLevel = v.level, icon = cfg.icon, tips = cfg.tips, upgrade = false }
  680. end
  681. elseif v.level == level + 1 then
  682. for _, k in pairs(v.skill) do
  683. ---@type cfg_skill_info_column
  684. local cfg = SL:GetConfigMultiKeys('cfg_skill_info', k[1], k[2], 'skillID', 'skillLevel')
  685. if not skill[k[1]] then
  686. skill[k[1]] = { lock = true, level = k[2], cardLevel = v.level, icon = cfg.icon, tips = cfg.tips, upgrade = true }
  687. else
  688. if k[2] > skill[k[1]].level then
  689. skill[k[1]].upgrade = true
  690. end
  691. end
  692. end
  693. elseif v.level > level + 1 then
  694. for _, k in pairs(v.skill) do
  695. ---@type cfg_skill_info_column
  696. local cfg = SL:GetConfigMultiKeys('cfg_skill_info', k[1], k[2], 'skillID', 'skillLevel')
  697. if not skill[k[1]] then
  698. skill[k[1]] = { lock = true, level = k[2], cardLevel = v.level, icon = cfg.icon, tips = cfg.tips, upgrade = false }
  699. end
  700. end
  701. end
  702. end
  703. end
  704. return skill
  705. end