UnionTecLogic.lua 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. Json = Json or require("common.Json")
  2. local Log = require("common.Log")
  3. local Msg = require("core.Msg")
  4. local Broadcast = require("broadcast.Broadcast")
  5. local Grid = require("bag.Grid")
  6. local UnionExcel = require("excel.union")
  7. local ItemDefine = require("bag.ItemDefine")
  8. local BagLogic = require("bag.BagLogic")
  9. local ObjHuman = require("core.ObjHuman")
  10. local Lang = require("common.Lang")
  11. local HeroExcel = require("excel.hero")
  12. local RoleAttr = require("role.RoleAttr")
  13. local ChengjiuLogic = require("chengjiu.ChengjiuLogic")
  14. local UnionDBLogic = require("union.UnionDBLogic")
  15. local Util = require("common.Util")
  16. local UnionLivenessLogic = require("union.UnionLivenessLogic")
  17. local UnionDefine = require("union.UnionDefine")
  18. local RoleDefine = require("role.RoleDefine")
  19. local TriggerDefine = require("trigger.TriggerDefine")
  20. local TriggerLogic = require("trigger.TriggerLogic")
  21. TEC_OCCU_CNT = 4
  22. TEC_TIER_CNT = 6
  23. -- 获取科技配置
  24. local function getTechnologyCfg(job, tier)
  25. local config = UnionExcel.technology
  26. local cfg = nil
  27. for i = 1, #config do
  28. cfg = config[i]
  29. if cfg ~= nil and cfg.occu == job and cfg.tier == tier then
  30. return cfg
  31. end
  32. end
  33. end
  34. -- 计算科技属性
  35. function doCalcHero(human, grid, attrs)
  36. if not human then return end
  37. if not human.db.unionUuid or human.db.unionUuid == "" then
  38. return
  39. end
  40. if not human.db.technology then return end
  41. local heroConfig = HeroExcel.hero[grid.id]
  42. local technology = human.db.technology[heroConfig.job]
  43. if technology == nil then return end
  44. local techCfg = nil
  45. for i = 1,TEC_TIER_CNT do
  46. local tech = technology[i]
  47. if tech ~= nil and tech.lv ~= nil then
  48. techCfg = getTechnologyCfg(heroConfig.job, i)
  49. if techCfg ~= nil then
  50. for k, v in pairs(techCfg.fortify) do
  51. local addValue = v[2] * tech.lv
  52. RoleAttr.updateValue(v[1],addValue,attrs)
  53. end
  54. end
  55. end
  56. end
  57. end
  58. function getTechLvByJob(human, job)
  59. if not human then return 0 end
  60. if not human.db.technology then return 0 end
  61. local technology = human.db.technology[job]
  62. return technology and technology.lv or 0
  63. end
  64. function lvAllUpByGm(human)
  65. if human.db.unionUuid == nil then
  66. return
  67. end
  68. human.db.technology = human.db.technology or {}
  69. local technology = human.db.technology
  70. local config = UnionExcel.technology
  71. local len = #config
  72. for i = 1, TEC_OCCU_CNT do
  73. technology[i] = technology[i] or {}
  74. local techOccu = technology[i]
  75. for j = 1, TEC_TIER_CNT do
  76. techOccu[j] = techOccu[j] or {}
  77. for z = 1, len do
  78. local v = config[z]
  79. if v.occu == i and v.tier == j then
  80. techOccu[j].lv = v.lvMax
  81. break
  82. end
  83. end
  84. end
  85. end
  86. end
  87. -- 获取其他科技的总等级
  88. function getOtherLv(human, occu)
  89. local lv = 9999
  90. if human.db.technology then
  91. local technology = human.db.technology
  92. for i = 1, TEC_OCCU_CNT do
  93. if technology[i] and i ~= occu then
  94. local thisLv = technology[i].lv or 0
  95. if lv >= thisLv then
  96. lv = thisLv
  97. end
  98. elseif not technology[i] then
  99. lv = 0
  100. end
  101. end
  102. end
  103. lv = lv ~= 9999 and lv or 0
  104. return lv
  105. end
  106. function getID(occu, tier)
  107. local id = 0
  108. for k, v in ipairs(UnionExcel.technology) do
  109. if v and v.occu == occu and v.tier == tier then
  110. id = k
  111. break
  112. end
  113. end
  114. return id
  115. end
  116. -- 获取该等级所需要的 磨坊等级 和其他 科技等级
  117. function getNeedMillOhter(lv, occu, tier)
  118. local needMill = 0
  119. local needOther = 0
  120. local id = getID(occu, tier)
  121. local config = UnionExcel.technology[id]
  122. for k, v in ipairs(config.needMill) do
  123. if v and v[1] <= lv then
  124. needMill = v[2]
  125. end
  126. end
  127. local changeLv = config.needSumLv[1]
  128. local initLv = config.needSumLv[2]
  129. if lv < changeLv then
  130. needOther = 0
  131. else
  132. needOther = initLv + (lv - changeLv ) * 1
  133. end
  134. return needMill,needOther
  135. end
  136. function techQuery(human, occu)
  137. -- 没有加入公会查什么科技
  138. if human.db.unionUuid == nil then
  139. return
  140. end
  141. -- 对不起,你要查的科技这里没得卖,请你出去
  142. if occu == nil then return end
  143. if occu < 1 or occu > TEC_OCCU_CNT then
  144. return
  145. end
  146. local union = UnionDBLogic.getUnion(human.db.unionUuid)
  147. if not union then
  148. return Broadcast.sendErr(human, Lang.UNION_PLAYER_IN_NO)
  149. end
  150. local millLv = UnionDBLogic.getMillLv(union)
  151. local config = UnionExcel.technology
  152. local msgRet = Msg.gc.GC_UNION_TECHNOLOGY_QUERY
  153. if human.db.technology == nil or human.db.technology[occu] == nil then
  154. msgRet.techLv = 1
  155. local consumeConfig = UnionExcel.tecConsume[1]
  156. for i = 1,TEC_TIER_CNT do
  157. if i == 1 then
  158. msgRet.technology[i].canLvUp = 1
  159. else
  160. msgRet.technology[i].canLvUp = 3
  161. end
  162. local getID = getID(occu, i)
  163. local needMillLv, needOther = getNeedMillOhter(0, occu, i)
  164. local thisConfig = UnionExcel.technology[getID]
  165. msgRet.technology[i].lv = 0
  166. msgRet.technology[i].tier = i
  167. msgRet.technology[i].techMsg[0] = 0
  168. msgRet.technology[i].techMsgNext[0] = 0
  169. msgRet.technology[i].name = thisConfig.name
  170. msgRet.technology[i].maxLV = thisConfig.lvMax
  171. -- msgRet.technology[i].needMillLv = needMillLv
  172. -- msgRet.technology[i].otherLv = getOtherLv(human, occu)
  173. -- msgRet.technology[i].needOhterLv = needOther
  174. msgRet.technology[i].banner = thisConfig.banner
  175. for k = 1, #thisConfig.fortify do
  176. msgRet.technology[i].techMsg[k].key = thisConfig.fortify[k][1]
  177. msgRet.technology[i].techMsg[k].value = thisConfig.fortify[k][2] * msgRet.technology[i].lv
  178. -- msgRet.technology[i].techMsg[k].name = thisConfig.techName[k]
  179. msgRet.technology[i].techMsg[0] = msgRet.technology[i].techMsg[0] + 1
  180. msgRet.technology[i].techMsgNext[k].key = thisConfig.fortify[k][1]
  181. msgRet.technology[i].techMsgNext[k].value = thisConfig.fortify[k][2] * (msgRet.technology[i].lv + 1)
  182. -- msgRet.technology[i].techMsgNext[k].name = thisConfig.techName[k]
  183. msgRet.technology[i].techMsgNext[0] = msgRet.technology[i].techMsgNext[0] + 1
  184. end
  185. msgRet.technology[i].lvUpNeed[0] = 2
  186. msgRet.technology[i].tier = i
  187. local jinbiCnt = consumeConfig["location"..i][1][2]
  188. local coinCnt = consumeConfig["location"..i][2][2]
  189. Grid.makeItem(msgRet.technology[i].lvUpNeed[1], ItemDefine.ITEM_JINBI_ID, jinbiCnt)
  190. Grid.makeItem(msgRet.technology[i].lvUpNeed[2], ItemDefine.ITEM_UNION_COIN_ID, coinCnt)
  191. -- msgRet.technology[i].needMillLv = 0
  192. end
  193. msgRet.technology[0] = TEC_TIER_CNT
  194. else
  195. msgRet.techLv = 1
  196. if human.db.technology[occu] and human.db.technology[occu].lv then
  197. msgRet.techLv = human.db.technology[occu].lv
  198. end
  199. for i = 1, TEC_TIER_CNT do
  200. human.db.technology[occu][i] = human.db.technology[occu][i] or {}
  201. human.db.technology[occu][i].lv = human.db.technology[occu][i].lv or 0
  202. if i == 1 then
  203. if human.db.technology[occu][i].lv >= config[i].lvMax then
  204. msgRet.technology[i].canLvUp = 2
  205. msgRet.techLv = config[i].lvMax
  206. else
  207. if human.db.technology[occu][i].lv == 0 then
  208. msgRet.technology[i].canLvUp = 1
  209. else
  210. if human.db.technology[occu][TEC_TIER_CNT] and human.db.technology[occu][TEC_TIER_CNT].lv == human.db.technology[occu][i].lv then
  211. msgRet.technology[i].canLvUp = 1
  212. else
  213. msgRet.technology[i].canLvUp = 2
  214. end
  215. end
  216. end
  217. else
  218. if human.db.technology[occu][i].lv >= config[i].lvMax then
  219. msgRet.technology[i].canLvUp = 2
  220. else
  221. if human.db.technology[occu][i - 1].lv == human.db.technology[occu][i].lv + 1 then
  222. msgRet.technology[i].canLvUp = 1
  223. elseif human.db.technology[occu][i].lv == human.db.technology[occu][1].lv and human.db.technology[occu][1].lv ~= 0 then
  224. if human.db.technology[occu].lv == human.db.technology[occu][i].lv then
  225. msgRet.technology[i].canLvUp = 3
  226. else
  227. msgRet.technology[i].canLvUp = 2
  228. end
  229. else
  230. msgRet.technology[i].canLvUp = 3
  231. end
  232. end
  233. end
  234. local getID = getID(occu, i)
  235. local needMillLv, needOther = getNeedMillOhter(human.db.technology[occu][i].lv , occu, i)
  236. local thisConfig = UnionExcel.technology[getID]
  237. msgRet.technology[i].lv = human.db.technology[occu][i].lv
  238. msgRet.technology[i].tier = i
  239. msgRet.technology[i].techMsg[0] = 0
  240. msgRet.technology[i].techMsgNext[0] = 0
  241. -- msgRet.technology[i].needMillLv = needMillLv
  242. -- msgRet.technology[i].otherLv = getOtherLv(human, occu)
  243. -- msgRet.technology[i].needOhterLv = needOther
  244. msgRet.technology[i].maxLV = thisConfig.lvMax
  245. msgRet.technology[i].name = thisConfig.name
  246. msgRet.technology[i].banner = thisConfig.banner
  247. for k = 1, #thisConfig.fortify do
  248. msgRet.technology[i].techMsg[k].key = thisConfig.fortify[k][1]
  249. msgRet.technology[i].techMsg[k].value = thisConfig.fortify[k][2] * msgRet.technology[i].lv
  250. -- msgRet.technology[i].techMsg[k].name = thisConfig.techName[k]
  251. msgRet.technology[i].techMsg[0] = msgRet.technology[i].techMsg[0] + 1
  252. if msgRet.technology[i].lv < config[i].lvMax then
  253. msgRet.technology[i].techMsgNext[k].key = thisConfig.fortify[k][1]
  254. msgRet.technology[i].techMsgNext[k].value = thisConfig.fortify[k][2] * (msgRet.technology[i].lv + 1)
  255. -- msgRet.technology[i].techMsgNext[k].name = thisConfig.techName[k]
  256. msgRet.technology[i].techMsgNext[0] = msgRet.technology[i].techMsgNext[0] + 1
  257. end
  258. end
  259. msgRet.technology[i].lvUpNeed[0] = 2
  260. local consumeConfig = UnionExcel.tecConsume[msgRet.technology[i].lv + 1]
  261. if consumeConfig then
  262. local jinbiCnt = consumeConfig["location"..i][1][2]
  263. local coinCnt = consumeConfig["location"..i][2][2]
  264. Grid.makeItem(msgRet.technology[i].lvUpNeed[1], ItemDefine.ITEM_JINBI_ID, jinbiCnt)
  265. Grid.makeItem(msgRet.technology[i].lvUpNeed[2], ItemDefine.ITEM_UNION_COIN_ID, coinCnt)
  266. else
  267. msgRet.technology[i].lvUpNeed[0] = 0
  268. end
  269. end
  270. msgRet.technology[0] = TEC_TIER_CNT
  271. end
  272. Msg.send(msgRet,human.fd)
  273. --Msg.trace(msgRet)
  274. end
  275. function techLvUp(human,occu,tier)
  276. -- 没公会升什么玩意科技
  277. if human.db.unionUuid == nil then
  278. return Broadcast.sendErr(human,Lang.UNION_PLAYER_IN_NO)
  279. end
  280. if occu < 1 or occu >TEC_OCCU_CNT then
  281. return
  282. end
  283. if tier < 1 or tier >TEC_TIER_CNT then
  284. return
  285. end
  286. --
  287. local config = UnionExcel.technology
  288. local flag = 1
  289. local isFirst = false
  290. if human.db.technology == nil then-- 先升第一层的科技嘛,干啥要跳级呢
  291. if tier ~= 1 then
  292. return Broadcast.sendErr(human,Lang.UNION_TECH_LAST_LV_ERR)
  293. end
  294. local consumeConfig = UnionExcel.tecConsume[1]
  295. local jinbiCnt = consumeConfig["location"..tier][1][2]
  296. local coinCnt = consumeConfig["location"..tier][2][2]
  297. if human.db.jinbi < jinbiCnt or human.db.bag[ItemDefine.ITEM_UNION_COIN_ID] == nil or human.db.bag[ItemDefine.ITEM_UNION_COIN_ID] < coinCnt then
  298. return Broadcast.sendErr(human,Lang.UNION_TECH_LV_MATERIALS)
  299. end
  300. human.db.technology = {}
  301. human.db.technology[occu] = {}
  302. ObjHuman.updateJinbi(human,-jinbiCnt,"techUp")
  303. BagLogic.delItem(human, ItemDefine.ITEM_UNION_COIN_ID,coinCnt, "techUp")
  304. human.db.technology[occu][tier] = human.db.technology[occu][tier] or {}
  305. human.db.technology[occu][tier].lv = human.db.technology[occu][tier].lv or 0
  306. human.db.technology[occu][tier].lv = human.db.technology[occu][tier].lv + 1
  307. isFirst = true
  308. else
  309. -- 不要跳级
  310. if tier ~= 1 then
  311. if not human.db.technology or not human.db.technology[occu] or next(human.db.technology[occu]) == nil then
  312. return
  313. end
  314. end
  315. local union = UnionDBLogic.getUnion(human.db.unionUuid)
  316. if not union then
  317. return Broadcast.sendErr(human, Lang.UNION_PLAYER_IN_NO)
  318. end
  319. human.db.technology[occu] = human.db.technology[occu] or {}
  320. human.db.technology[occu][tier] = human.db.technology[occu][tier] or {}
  321. human.db.technology[occu][tier].lv = human.db.technology[occu][tier].lv or 0
  322. local getID = getID(occu, tier)
  323. local thisConfig = UnionExcel.technology[getID]
  324. -- 都顶级了还升个锤子
  325. if human.db.technology[occu][tier].lv >= thisConfig.lvMax then
  326. return Broadcast.sendErr(human,Lang.UNION_TECH_LV_ERR)
  327. end
  328. -- 前置科技等级没有达标
  329. if tier~= 1 then
  330. if human.db.technology[occu][tier - 1] == nil or human.db.technology[occu][tier - 1].lv == nil or human.db.technology[occu][tier - 1].lv <= human.db.technology[occu][tier].lv then
  331. return Broadcast.sendErr(human,Lang.UNION_TECH_LAST_LV_ERR)
  332. end
  333. else
  334. if human.db.technology[occu][tier].lv > 0 and human.db.technology[occu][TEC_TIER_CNT].lv ~= human.db.technology[occu][tier].lv then
  335. return Broadcast.sendErr(human,Lang.UNION_TECH_LAST_LV_ERR)
  336. end
  337. end
  338. local millLv = UnionDBLogic.getMillLv(union)
  339. local needMillLv, needOther = getNeedMillOhter(human.db.technology[occu][tier].lv, occu, tier)
  340. local otherLv = getOtherLv(human, occu)
  341. -- 公会聚义堂 等级没有达到需求
  342. -- if millLv < needMillLv then
  343. -- return Broadcast.sendErr(human, Util.format(Lang.UNION_TECH_MILL_ERR, needMillLv) )
  344. -- end
  345. -- 其他科技没有达标
  346. if otherLv < needOther then
  347. return Broadcast.sendErr(human, Util.format(Lang.UNION_TECH_OTHER_ERR, needOther ) )
  348. end
  349. local consumeConfig = UnionExcel.tecConsume[human.db.technology[occu][tier].lv + 1]
  350. if not consumeConfig then return end
  351. local jinbiCnt = consumeConfig["location"..tier][1][2]
  352. local coinCnt = consumeConfig["location"..tier][2][2]
  353. if human.db.jinbi < jinbiCnt or human.db.bag[ItemDefine.ITEM_UNION_COIN_ID] == nil or human.db.bag[ItemDefine.ITEM_UNION_COIN_ID] < coinCnt then
  354. return Broadcast.sendErr(human,Lang.UNION_TECH_LV_MATERIALS)
  355. end
  356. ObjHuman.updateJinbi(human,-jinbiCnt,"techUp")
  357. BagLogic.delItem(human, ItemDefine.ITEM_UNION_COIN_ID,coinCnt, "techUp")
  358. human.db.technology[occu][tier].lv = human.db.technology[occu][tier].lv or 0
  359. human.db.technology[occu][tier].lv = human.db.technology[occu][tier].lv + 1
  360. if tier == TEC_TIER_CNT then
  361. human.db.technology[occu].lv = human.db.technology[occu][tier].lv
  362. -- 公会科技等级记录
  363. --Log.write(Log.LOGID_OSS_UNION_TECH, human.db._id, human.db.account, human.db.name, occu, human.db.technology[occu].lv or 0)
  364. Log.write(Log.LOGID_OSS_UNION_TECH, human.db._id, human.db.newUniqueTag, human.db.name, occu, human.db.technology[occu].lv or 0)
  365. end
  366. end
  367. if isFirst then
  368. Broadcast.sendErr(human,Lang.UNION_TECH_LV_UP_OPEN)
  369. -- else
  370. -- Broadcast.sendErr(human,Lang.UNION_TECH_LV_UP_SUCCESS)
  371. end
  372. ObjHuman.save(human)
  373. techQuery(human,occu)
  374. UnionLivenessLogic.touchLiveness(human,UnionDefine.UNION_LIVENESS_TEC,1)
  375. RoleAttr.cleanHeroAttrCache(human)
  376. RoleAttr.doCalc(human)
  377. ObjHuman.sendAttr(human, RoleDefine.ZHANDOULI)
  378. print("[techLvUp] 111111\n")
  379. TriggerLogic.PublishEvent(TriggerDefine.EVENT_TYPE_UNIONSKILLUP, human.db._id, 1)
  380. print("[techLvUp] 222222\n")
  381. end
  382. function checkisFirstRest(human)
  383. local isFirst = true
  384. if human.db.technology and human.db.technology.restCnt and human.db.technology.restCnt > 0 then
  385. isFirst = false
  386. end
  387. return isFirst
  388. end
  389. function getResetNeedZuanshi(human, lv)
  390. local config = UnionExcel.techReset[1]
  391. if checkisFirstRest(human) then
  392. return config.firstRest
  393. else
  394. local surLv = lv - config.lv
  395. surLv = surLv > 0 and surLv or 0
  396. return config.consume + surLv * config.add
  397. end
  398. end
  399. -- 重置 返回道具查询
  400. function techResetQuery(human, occu)
  401. -- 没点科技,你重置个锤子
  402. if human.db.technology == nil then
  403. return Broadcast.sendErr(human,Lang.UNION_TECH_LV_ZERO_ERR)
  404. end
  405. if human.db.technology[occu] == nil or human.db.technology[occu][1].lv == 0 then
  406. return Broadcast.sendErr(human, Lang.UNION_TECH_LV_ZERO_ERR)
  407. end
  408. -- 先把消耗计算出来
  409. local jinbiCnt = 0
  410. local coinCnt = 0
  411. local config = UnionExcel.tecConsume
  412. local lv = human.db.technology[occu][1].lv
  413. for j = 1,#human.db.technology[occu] do
  414. for k = 1,human.db.technology[occu][j].lv do
  415. jinbiCnt = jinbiCnt + config[k]["location"..j][1][2]
  416. coinCnt = coinCnt + config[k]["location"..j][2][2]
  417. end
  418. end
  419. jinbiCnt = math.floor(jinbiCnt * 0.5)
  420. local zuanshiCnt = getResetNeedZuanshi(human, human.db.technology[occu][1].lv )
  421. local msgRet = Msg.gc.GC_UNION_TECHNOLOGY_RESET_QUERY
  422. Grid.makeItem(msgRet.item[1], ItemDefine.ITEM_JINBI_ID, jinbiCnt)
  423. Grid.makeItem(msgRet.item[2], ItemDefine.ITEM_UNION_COIN_ID, coinCnt)
  424. msgRet.zuanshiCnt = zuanshiCnt
  425. msgRet.item[0] = 2
  426. Msg.send(msgRet,human.fd)
  427. end
  428. function techReset(human,occu)
  429. if occu < 1 or occu >TEC_OCCU_CNT then
  430. return
  431. end
  432. local flag = 1
  433. -- 没点科技,你重置个锤子
  434. if human.db.technology == nil then
  435. return Broadcast.sendErr(human,Lang.UNION_TECH_LV_ZERO_ERR)
  436. end
  437. human.db.technology.restCnt = human.db.technology.restCnt or 0
  438. if human.db.technology[occu] == nil or human.db.technology[occu][1].lv == 0 then
  439. return Broadcast.sendErr(human, Lang.UNION_TECH_LV_ZERO_ERR)
  440. else
  441. local zuanshiCnt = getResetNeedZuanshi(human, human.db.technology[occu][1].lv )
  442. if not ObjHuman.checkRMB(human, zuanshiCnt) then
  443. return
  444. end
  445. ObjHuman.decZuanshi(human, -zuanshiCnt, "reset_technology")
  446. end
  447. -- 先把消耗计算出来
  448. local jinbiCnt = 0
  449. local coinCnt = 0
  450. local config = UnionExcel.tecConsume
  451. for j = 1,#human.db.technology[occu] do
  452. for k = 1,human.db.technology[occu][j].lv do
  453. jinbiCnt = jinbiCnt + config[k]["location"..j][1][2]
  454. coinCnt = coinCnt + config[k]["location"..j][2][2]
  455. end
  456. end
  457. jinbiCnt = math.floor(jinbiCnt * 0.5)
  458. human.db.technology.restCnt = human.db.technology.restCnt + 1
  459. human.db.technology[occu] = nil
  460. BagLogic.cleanMomentItemList()
  461. BagLogic.updateMomentItem(2, ItemDefine.ITEM_JINBI_ID, jinbiCnt)
  462. BagLogic.updateMomentItem(2, ItemDefine.ITEM_UNION_COIN_ID, coinCnt)
  463. BagLogic.addMomentItemList(human, "reset_technology")
  464. Broadcast.sendErr(human,Lang.UNION_TECH_LV_RESET_SUCCESS)
  465. techQuery(human,occu)
  466. RoleAttr.cleanHeroAttrCache(human)
  467. local msgRet = Msg.gc.GC_UNION_TECHNOLOGY_RESET
  468. msgRet.flag = 1
  469. Msg.send(msgRet,human.fd)
  470. end
  471. function getTechnologyLv(human)
  472. local lv = 0
  473. if human.db.technology then
  474. for k, v in pairs(human.db.technology) do
  475. if v then
  476. for j, h in pairs(v) do
  477. if h and h.lv and h.lv > 0 then
  478. lv = lv + h.lv
  479. end
  480. end
  481. end
  482. end
  483. end
  484. return lv
  485. end