Commit 3b069d52ce1c224ca8e1639c98d991827e335f83
1 parent
2445248d
增加获取 food 后台
Showing
3 changed files
with
33 additions
and
0 deletions
Show diff stats
src/ProtocolCode.lua
src/actions/GmAction.lua
... | ... | @@ -64,6 +64,12 @@ function _M.get(role, pms) |
64 | 64 | role:award({[itemId] = 100}) |
65 | 65 | end |
66 | 66 | end |
67 | + elseif pms.pm1 == "FOOD" then | |
68 | + for itemId = 4000 , 5000 do | |
69 | + if csvdb["itemCsv"][itemId] then | |
70 | + role:award({[itemId] = 100}) | |
71 | + end | |
72 | + end | |
67 | 73 | else |
68 | 74 | local itemId = tonum(pms.pm1) |
69 | 75 | if not csvdb["itemCsv"][itemId] then | ... | ... |
src/actions/HeroAction.lua
... | ... | @@ -581,4 +581,30 @@ function _M.referRunesRpc(agent, data) |
581 | 581 | return true |
582 | 582 | end |
583 | 583 | |
584 | +function _M.createHeroRandomRpc(agent, data) | |
585 | + local role = agent.role | |
586 | + local msg = MsgPack.unpack(data) | |
587 | + local itemId = msg.itemId | |
588 | + local itemData = csvdb["itemCsv"][itemId] | |
589 | + if not itemData or itemData.type ~= ItemType.HeroFCommon then return end | |
590 | + local cost = globalCsv.unit_fragment_cost[itemData.quality] | |
591 | + if not cost or role:getItemCount(itemId) < cost then return end | |
592 | + | |
593 | + local randomData = csvdb["item_randomCsv"][tonumber(itemData.use_effect)] | |
594 | + if not randomData then return end | |
595 | + | |
596 | + local temp = randomData.random_gift:randWeight(true) | |
597 | + if not temp or not next(temp) then return end | |
598 | + local reward = {} | |
599 | + if role:isHaveHero(temp[1]) then | |
600 | + reward = {[temp[1]] = cost} | |
601 | + else | |
602 | + reward = {[temp[1] + ItemStartId.Hero] = 1} | |
603 | + end | |
604 | + role:costItems({[itemId] = cost}) | |
605 | + reward = role:award(reward) | |
606 | + SendPacket(actionCodes.Hero_createHeroRandomRpc, MsgPack.pack({reward = reward})) | |
607 | + return true | |
608 | +end | |
609 | + | |
584 | 610 | return _M |
585 | 611 | \ No newline at end of file | ... | ... |