Compare View
Commits (3)
Showing
2 changed files
Show diff stats
src/actions/HeroAction.lua
| @@ -202,11 +202,8 @@ function _M.talentRpc(agent, data) | @@ -202,11 +202,8 @@ function _M.talentRpc(agent, data) | ||
| 202 | 202 | ||
| 203 | 203 | ||
| 204 | local cost = {} | 204 | local cost = {} |
| 205 | - if curLevel == #curData then | ||
| 206 | - talent = talent:setv(0, curStage + 1) | ||
| 207 | - talent = talent:setv(1, 1) | ||
| 208 | - else | ||
| 209 | - if curLevel > #curData then return 2 end | 205 | + if curLevel < #curData then |
| 206 | + --if curLevel > #curData then return 2 end | ||
| 210 | 207 | ||
| 211 | local talentData = curData[curLevel] | 208 | local talentData = curData[curLevel] |
| 212 | if not talentData then return 3 end | 209 | if not talentData then return 3 end |
| @@ -217,6 +214,13 @@ function _M.talentRpc(agent, data) | @@ -217,6 +214,13 @@ function _M.talentRpc(agent, data) | ||
| 217 | if not role:checkItemEnough(cost) then return 5 end | 214 | if not role:checkItemEnough(cost) then return 5 end |
| 218 | if not role:costItems(cost, {log = {desc = "heroTalent", int1 = msg.id, int2 = hero:getProperty("type")}}) then return 6 end | 215 | if not role:costItems(cost, {log = {desc = "heroTalent", int1 = msg.id, int2 = hero:getProperty("type")}}) then return 6 end |
| 219 | talent = talent:setv(1, curLevel + 1) | 216 | talent = talent:setv(1, curLevel + 1) |
| 217 | + | ||
| 218 | + if curLevel + 1 == #curData then | ||
| 219 | + talent = talent:setv(0, curStage + 1) | ||
| 220 | + talent = talent:setv(1, 1) | ||
| 221 | + end | ||
| 222 | + else | ||
| 223 | + return 2 | ||
| 220 | end | 224 | end |
| 221 | curStage = talent:getv(0, 1) | 225 | curStage = talent:getv(0, 1) |
| 222 | role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = curStage, count = 1}) | 226 | role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = curStage, count = 1}) |
src/actions/RoleAction.lua
| @@ -100,6 +100,18 @@ function _M.loginRpc( agent, data ) | @@ -100,6 +100,18 @@ function _M.loginRpc( agent, data ) | ||
| 100 | role:startActionUcode() | 100 | role:startActionUcode() |
| 101 | else | 101 | else |
| 102 | role:reloadWhenLogin() | 102 | role:reloadWhenLogin() |
| 103 | + if role:getProperty("del") == 1 then | ||
| 104 | + local ret, res= roleByUid(role:getProperty("uid")) | ||
| 105 | + if not ret then | ||
| 106 | + response.result = "NOT_EXIST" | ||
| 107 | + SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(response)) | ||
| 108 | + end | ||
| 109 | + role = require("models.Role").new({key = tostring(res["id"])}) | ||
| 110 | + role:load() | ||
| 111 | + role:loadAll() | ||
| 112 | + role:startActionUcode() | ||
| 113 | + agent.role = role | ||
| 114 | + end | ||
| 103 | end | 115 | end |
| 104 | 116 | ||
| 105 | 117 | ||
| @@ -490,7 +502,7 @@ function _M.createRpc(agent, data) | @@ -490,7 +502,7 @@ function _M.createRpc(agent, data) | ||
| 490 | skynet.error("[ERROR] cbbackd cant call center uid: " .. uid .. " roleId:" .. roleId) | 502 | skynet.error("[ERROR] cbbackd cant call center uid: " .. uid .. " roleId:" .. roleId) |
| 491 | end | 503 | end |
| 492 | end) | 504 | end) |
| 493 | - | 505 | + |
| 494 | -- cb1活跃回馈 | 506 | -- cb1活跃回馈 |
| 495 | onCb1Back(newRole) | 507 | onCb1Back(newRole) |
| 496 | 508 | ||
| @@ -506,7 +518,8 @@ function _M.unRegisterRpc(agent, data) | @@ -506,7 +518,8 @@ function _M.unRegisterRpc(agent, data) | ||
| 506 | return 0 | 518 | return 0 |
| 507 | end | 519 | end |
| 508 | 520 | ||
| 509 | - if not roleUnRegister(roleId) then return 1 end | 521 | + role:setProperty("del", 1) |
| 522 | + --if not roleUnRegister(roleId) then return 1 end | ||
| 510 | SendPacket(actionCodes.Role_unRegisterRpc, MsgPack.pack({})) | 523 | SendPacket(actionCodes.Role_unRegisterRpc, MsgPack.pack({})) |
| 511 | return true | 524 | return true |
| 512 | end | 525 | end |