HeroStrategyLogic.lua 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. local RoleLogic = require("role.RoleLogic")
  2. local HeroExcel = require("excel.hero")
  3. local Msg = require("core.Msg")
  4. local Config = require("Config")
  5. local HeroGrid = require("hero.HeroGrid")
  6. local Grid = require("bag.Grid")
  7. local HeroDefine = require("hero.HeroDefine")
  8. local ItemDefine = require("bag.ItemDefine")
  9. local HeroLogic = require("hero.HeroLogic")
  10. local RoleDefine = require("role.RoleDefine")
  11. local Lang = require("common.Lang")
  12. function StrategyQueryByHeroID(human,heroID)
  13. if HeroExcel.hero[heroID] == nil then
  14. return
  15. end
  16. human.db.lookGl = 1
  17. local fatherID = HeroExcel.hero[heroID].id
  18. local msgRet = Msg.gc.GC_HERO_STRATEGY_QUERY
  19. msgRet.simpleMsg.icon = HeroExcel.hero[heroID].head
  20. msgRet.simpleMsg.name = HeroExcel.hero[heroID].name
  21. msgRet.simpleMsg.weightLv = HeroExcel.hero[heroID].grade
  22. local strategyConfig = HeroExcel.strategy
  23. if strategyConfig[fatherID] == nil then
  24. return
  25. end
  26. local totalPoint = 0
  27. for i = 1,#strategyConfig[fatherID].stats do
  28. msgRet.stats.power[i] = strategyConfig[fatherID].stats[i]
  29. totalPoint = totalPoint + strategyConfig[fatherID].stats[i]
  30. end
  31. msgRet.stats.power[0] = #strategyConfig[fatherID].stats
  32. msgRet.stats.totalPoint = totalPoint
  33. msgRet.stats.dingwei = strategyConfig[fatherID].dingwei
  34. -- xy todo ³Ùµã²¹ÉÏÏà¹ØÂß¼­
  35. local heroData = {}
  36. local allHeroData = {}
  37. local len = 0
  38. local camp = HeroExcel.hero[heroID].camp
  39. if allHeroData[camp] ~= nil then
  40. for i = 1,#allHeroData[camp] do
  41. if allHeroData[camp][i].id == fatherID then
  42. len = len + 1
  43. heroData[len] = {}
  44. heroData[len] = allHeroData[camp][i]
  45. end
  46. end
  47. end
  48. local cnt = #heroData
  49. local count = 0
  50. for i = 1,cnt do
  51. count = count + 1
  52. HeroGrid.makeHeroInfo(msgRet.manito[count].heroInfo, heroData[count])
  53. RoleLogic.makeRoleBase(heroData[count].roleBase,msgRet.manito[count].player)
  54. msgRet.manito[count].heroIndex = heroData[count].index
  55. msgRet.manito[count].svrName = heroData[count].srvName or ""
  56. msgRet.manito[count].zhandouli = heroData[count].zhandouli
  57. if count >= 3 then
  58. break
  59. end
  60. end
  61. if cnt < 3 then
  62. count = count + 1
  63. local config = HeroExcel.hero
  64. local mobanId = strategyConfig[fatherID].heroID
  65. local heroSimple = {}
  66. local heroDynamic = {}
  67. local heroStatic = {}
  68. local heroGrid = HeroGrid.getCacheHeroGrid(mobanId)
  69. HeroGrid.makeHeroSimple(heroSimple, heroGrid)
  70. HeroGrid.makeHeroInfo(msgRet.manito[count].heroInfo, heroGrid)
  71. local player = {}
  72. player.name = Lang.TUIJIAN_HERO
  73. RoleLogic.makeRoleBase(player,msgRet.manito[count].player)
  74. msgRet.manito[count].heroIndex = 0
  75. msgRet.manito[count].svrName = Config.SVR_NAME
  76. msgRet.manito[count].zhandouli = heroSimple.zhandouli
  77. end
  78. msgRet.manito[0] = count
  79. msgRet.strategy = strategyConfig[fatherID].strategy
  80. msgRet.last = strategyConfig[fatherID].last or 0
  81. msgRet.next = strategyConfig[fatherID].next or 0
  82. local heroGrid = HeroGrid.getCacheHeroGrid(heroID)
  83. HeroGrid.makeHeroSimple(msgRet.heroSimple, heroGrid, nil, human)
  84. HeroGrid.makeHeroDynamic(msgRet.heroDynamic, heroGrid, nil, human)
  85. HeroGrid.makeHeroStatic(msgRet.heroStatic,heroGrid.id)
  86. Msg.send(msgRet,human.fd)
  87. end
  88. function heroDetailMsgQuery(human,uuid,heroIndex,heroId)
  89. end
  90. function heroGlDot(human)
  91. local msgRet = Msg.gc.GC_HERO_GL_DOT_QUERY
  92. msgRet.isDot = 1
  93. if human.db.lookGl ~= nil then
  94. msgRet.isDot = 0
  95. end
  96. Msg.send(msgRet,human.fd)
  97. end