UnionTecLogic.lua 21 KB

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