Commit 4b7c7c96e96f38be58634e31aa242ddc82d920c0
1 parent
5d80aca6
增加 清空 挂机 冒险gm 角色经验
Showing
7 changed files
with
64 additions
and
8 deletions
Show diff stats
src/actions/GmAction.lua
... | ... | @@ -32,4 +32,20 @@ function _M.get(role, pms) |
32 | 32 | return "成功" |
33 | 33 | end |
34 | 34 | |
35 | +function _M.advc(role, pms) | |
36 | + role:updateProperty({field = "advInfo", value = {}}) | |
37 | + role:updateProperty({field = "advItems", value = ""}) | |
38 | + role:updateProperty({field = "advTeam", value = {}}) | |
39 | + role.advData = nil | |
40 | + return "成功" | |
41 | +end | |
42 | + | |
43 | +function _M.idlec(role, pms) | |
44 | + role:updateProperty({field = "hangTeam", value = {}}) | |
45 | + role:updateProperty({field = "hangInfo", value = {}}) | |
46 | + role:updateProperty({field = "hangBag", value = {}}) | |
47 | + role.advData = nil | |
48 | + return "成功" | |
49 | +end | |
50 | + | |
35 | 51 | return _M |
36 | 52 | \ No newline at end of file | ... | ... |
src/actions/HangAction.lua
... | ... | @@ -33,6 +33,7 @@ local function checkReward(role) |
33 | 33 | local items = role:getProperty("hangBag") |
34 | 34 | items[ItemId.Gold] = (items[ItemId.Gold] or 0) + coinCount * carbonData.money |
35 | 35 | items[ItemId.Exp] = (items[ItemId.Exp] or 0) + coinCount * carbonData.exp |
36 | + items[ItemId.PlayerExp] = (items[ItemId.PlayerExp] or 0) + coinCount * carbonData.playerExp | |
36 | 37 | |
37 | 38 | local pool = {} |
38 | 39 | for _, temp in pairs(carbonData.item:toArray()) do | ... | ... |
src/actions/HeroAction.lua
... | ... | @@ -105,7 +105,13 @@ function _M.talentRpc(agent, data) |
105 | 105 | |
106 | 106 | local talentData = curData[level] |
107 | 107 | if not talentData then return end |
108 | - local cost = talentData.cost:toNumMap() | |
108 | + local cost = {} | |
109 | + local needCost = talentData.cost:toTableArray(true) | |
110 | + cost[needCost[1][1]] = needCost[1][2] | |
111 | + if needCost[2] then | |
112 | + cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][needCost[2][1]]] = needCost[2][2] | |
113 | + end | |
114 | + | |
109 | 115 | if not role:checkItemEnough(cost) then return end |
110 | 116 | role:costItems(cost, {}) |
111 | 117 | talent = talent:incrv(index, 1) | ... | ... |
src/adv/Adv.lua
... | ... | @@ -443,7 +443,7 @@ function Adv:over(success) |
443 | 443 | end |
444 | 444 | |
445 | 445 | function Adv:exit() |
446 | - self:over(-1) | |
446 | + self:over(false) | |
447 | 447 | self:saveDB() |
448 | 448 | end |
449 | 449 | |
... | ... | @@ -923,9 +923,13 @@ function Adv:enemyDead(roomId, blockId, escape) |
923 | 923 | item = dropData["range"]:randWeight(true) |
924 | 924 | end |
925 | 925 | end |
926 | - table.clear(block.event) | |
927 | - block.event.etype = AdvEventType.Drop | |
928 | - block.event.item = item | |
926 | + if item[1] == 0 then | |
927 | + room:clearBEvent(block) | |
928 | + else | |
929 | + table.clear(block.event) | |
930 | + block.event.etype = AdvEventType.Drop | |
931 | + block.event.item = item | |
932 | + end | |
929 | 933 | end |
930 | 934 | end |
931 | 935 | self:backBlockChange(roomId, blockId) | ... | ... |
src/adv/AdvBattle.lua
src/models/Role.lua
... | ... | @@ -31,7 +31,8 @@ Role.schema = { |
31 | 31 | diamond = {"number", 0}, |
32 | 32 | reDiamond = {"number", 0}, |
33 | 33 | -- roleInfo |
34 | - level = {"number", 0}, | |
34 | + level = {"number", 1}, | |
35 | + exp = {"number", 0}, | |
35 | 36 | items = {"string", ""}, |
36 | 37 | loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL |
37 | 38 | |
... | ... | @@ -148,6 +149,7 @@ function Role:data() |
148 | 149 | id = self:getProperty("id"), |
149 | 150 | name = self:getProperty("name"), |
150 | 151 | level = self:getProperty("level"), |
152 | + exp = self:getProperty("exp"), | |
151 | 153 | items = self:getProperty("items"):toNumMap(), |
152 | 154 | loveStatus = self:getProperty("loveStatus"):toNumMap(), |
153 | 155 | diamond = self:getAllDiamond(), | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -64,6 +64,12 @@ function RolePlugin.bind(Role) |
64 | 64 | local curType = itemData.type |
65 | 65 | local change = {} -- 奖励被转化为了其他奖励 id = count |
66 | 66 | |
67 | + local itemIdAward = { | |
68 | + [ItemId.PlayerExp] = function() | |
69 | + self:addPlayExp(count) | |
70 | + end, | |
71 | + } | |
72 | + | |
67 | 73 | local itemTypeAward = { |
68 | 74 | [ItemType.Hero] = function() |
69 | 75 | params.type = itemId - ItemStartId.Hero |
... | ... | @@ -75,7 +81,9 @@ function RolePlugin.bind(Role) |
75 | 81 | -- 对数量筛查 |
76 | 82 | local count = checkItemCount(self, itemId, count) |
77 | 83 | if count ~= 0 then |
78 | - if itemTypeAward[curType] then | |
84 | + if itemIdAward[itemId] then | |
85 | + itemIdAward[itemId]() | |
86 | + elseif itemTypeAward[curType] then | |
79 | 87 | itemTypeAward[curType]() |
80 | 88 | else |
81 | 89 | params.itemId = itemId |
... | ... | @@ -118,6 +126,25 @@ function RolePlugin.bind(Role) |
118 | 126 | return reward, allChange --实际获得的奖励 和 最高级奖励转化过程 |
119 | 127 | end |
120 | 128 | |
129 | + function Role:addPlayExp(addExp) | |
130 | + local level = self:getProperty("level") | |
131 | + if not csvdb["player_expCsv"][level + 1] then | |
132 | + return | |
133 | + end | |
134 | + | |
135 | + local exp = self:getProperty("exp") | |
136 | + local newExp = exp + addExp | |
137 | + while newExp >= csvdb["player_expCsv"][level].exp do | |
138 | + if csvdb["player_expCsv"][level + 1] then -- 有下一级 | |
139 | + newExp = newExp - csvdb["player_expCsv"][level].exp | |
140 | + level = level + 1 | |
141 | + else | |
142 | + newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除 | |
143 | + end | |
144 | + end | |
145 | + self:updateProperties({level = level, exp = newExp}) | |
146 | + end | |
147 | + | |
121 | 148 | function Role:addItem(params) |
122 | 149 | params = params or {} |
123 | 150 | if params.itemId == ItemId.Diamond then | ... | ... |