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,4 +32,20 @@ function _M.get(role, pms) | ||
| 32 | return "成功" | 32 | return "成功" |
| 33 | end | 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 | return _M | 51 | return _M |
| 36 | \ No newline at end of file | 52 | \ No newline at end of file |
src/actions/HangAction.lua
| @@ -33,6 +33,7 @@ local function checkReward(role) | @@ -33,6 +33,7 @@ local function checkReward(role) | ||
| 33 | local items = role:getProperty("hangBag") | 33 | local items = role:getProperty("hangBag") |
| 34 | items[ItemId.Gold] = (items[ItemId.Gold] or 0) + coinCount * carbonData.money | 34 | items[ItemId.Gold] = (items[ItemId.Gold] or 0) + coinCount * carbonData.money |
| 35 | items[ItemId.Exp] = (items[ItemId.Exp] or 0) + coinCount * carbonData.exp | 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 | local pool = {} | 38 | local pool = {} |
| 38 | for _, temp in pairs(carbonData.item:toArray()) do | 39 | for _, temp in pairs(carbonData.item:toArray()) do |
src/actions/HeroAction.lua
| @@ -105,7 +105,13 @@ function _M.talentRpc(agent, data) | @@ -105,7 +105,13 @@ function _M.talentRpc(agent, data) | ||
| 105 | 105 | ||
| 106 | local talentData = curData[level] | 106 | local talentData = curData[level] |
| 107 | if not talentData then return end | 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 | if not role:checkItemEnough(cost) then return end | 115 | if not role:checkItemEnough(cost) then return end |
| 110 | role:costItems(cost, {}) | 116 | role:costItems(cost, {}) |
| 111 | talent = talent:incrv(index, 1) | 117 | talent = talent:incrv(index, 1) |
src/adv/Adv.lua
| @@ -443,7 +443,7 @@ function Adv:over(success) | @@ -443,7 +443,7 @@ function Adv:over(success) | ||
| 443 | end | 443 | end |
| 444 | 444 | ||
| 445 | function Adv:exit() | 445 | function Adv:exit() |
| 446 | - self:over(-1) | 446 | + self:over(false) |
| 447 | self:saveDB() | 447 | self:saveDB() |
| 448 | end | 448 | end |
| 449 | 449 | ||
| @@ -923,9 +923,13 @@ function Adv:enemyDead(roomId, blockId, escape) | @@ -923,9 +923,13 @@ function Adv:enemyDead(roomId, blockId, escape) | ||
| 923 | item = dropData["range"]:randWeight(true) | 923 | item = dropData["range"]:randWeight(true) |
| 924 | end | 924 | end |
| 925 | end | 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 | end | 933 | end |
| 930 | end | 934 | end |
| 931 | self:backBlockChange(roomId, blockId) | 935 | self:backBlockChange(roomId, blockId) |
src/adv/AdvBattle.lua
src/models/Role.lua
| @@ -31,7 +31,8 @@ Role.schema = { | @@ -31,7 +31,8 @@ Role.schema = { | ||
| 31 | diamond = {"number", 0}, | 31 | diamond = {"number", 0}, |
| 32 | reDiamond = {"number", 0}, | 32 | reDiamond = {"number", 0}, |
| 33 | -- roleInfo | 33 | -- roleInfo |
| 34 | - level = {"number", 0}, | 34 | + level = {"number", 1}, |
| 35 | + exp = {"number", 0}, | ||
| 35 | items = {"string", ""}, | 36 | items = {"string", ""}, |
| 36 | loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL | 37 | loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL |
| 37 | 38 | ||
| @@ -148,6 +149,7 @@ function Role:data() | @@ -148,6 +149,7 @@ function Role:data() | ||
| 148 | id = self:getProperty("id"), | 149 | id = self:getProperty("id"), |
| 149 | name = self:getProperty("name"), | 150 | name = self:getProperty("name"), |
| 150 | level = self:getProperty("level"), | 151 | level = self:getProperty("level"), |
| 152 | + exp = self:getProperty("exp"), | ||
| 151 | items = self:getProperty("items"):toNumMap(), | 153 | items = self:getProperty("items"):toNumMap(), |
| 152 | loveStatus = self:getProperty("loveStatus"):toNumMap(), | 154 | loveStatus = self:getProperty("loveStatus"):toNumMap(), |
| 153 | diamond = self:getAllDiamond(), | 155 | diamond = self:getAllDiamond(), |
src/models/RolePlugin.lua
| @@ -64,6 +64,12 @@ function RolePlugin.bind(Role) | @@ -64,6 +64,12 @@ function RolePlugin.bind(Role) | ||
| 64 | local curType = itemData.type | 64 | local curType = itemData.type |
| 65 | local change = {} -- 奖励被转化为了其他奖励 id = count | 65 | local change = {} -- 奖励被转化为了其他奖励 id = count |
| 66 | 66 | ||
| 67 | + local itemIdAward = { | ||
| 68 | + [ItemId.PlayerExp] = function() | ||
| 69 | + self:addPlayExp(count) | ||
| 70 | + end, | ||
| 71 | + } | ||
| 72 | + | ||
| 67 | local itemTypeAward = { | 73 | local itemTypeAward = { |
| 68 | [ItemType.Hero] = function() | 74 | [ItemType.Hero] = function() |
| 69 | params.type = itemId - ItemStartId.Hero | 75 | params.type = itemId - ItemStartId.Hero |
| @@ -75,7 +81,9 @@ function RolePlugin.bind(Role) | @@ -75,7 +81,9 @@ function RolePlugin.bind(Role) | ||
| 75 | -- 对数量筛查 | 81 | -- 对数量筛查 |
| 76 | local count = checkItemCount(self, itemId, count) | 82 | local count = checkItemCount(self, itemId, count) |
| 77 | if count ~= 0 then | 83 | if count ~= 0 then |
| 78 | - if itemTypeAward[curType] then | 84 | + if itemIdAward[itemId] then |
| 85 | + itemIdAward[itemId]() | ||
| 86 | + elseif itemTypeAward[curType] then | ||
| 79 | itemTypeAward[curType]() | 87 | itemTypeAward[curType]() |
| 80 | else | 88 | else |
| 81 | params.itemId = itemId | 89 | params.itemId = itemId |
| @@ -118,6 +126,25 @@ function RolePlugin.bind(Role) | @@ -118,6 +126,25 @@ function RolePlugin.bind(Role) | ||
| 118 | return reward, allChange --实际获得的奖励 和 最高级奖励转化过程 | 126 | return reward, allChange --实际获得的奖励 和 最高级奖励转化过程 |
| 119 | end | 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 | function Role:addItem(params) | 148 | function Role:addItem(params) |
| 122 | params = params or {} | 149 | params = params or {} |
| 123 | if params.itemId == ItemId.Diamond then | 150 | if params.itemId == ItemId.Diamond then |