Commit 056c01a07602117c9543bb5cb6157bfa00477da8
1 parent
2c63e6a0
简化装备
Showing
8 changed files
with
120 additions
and
120 deletions
Show diff stats
src/ProtocolCode.lua
@@ -23,7 +23,6 @@ actionCodes = { | @@ -23,7 +23,6 @@ actionCodes = { | ||
23 | Role_pipelining = 109, | 23 | Role_pipelining = 109, |
24 | Role_saleItemRpc = 110, | 24 | Role_saleItemRpc = 110, |
25 | Role_openItemRpc = 111, | 25 | Role_openItemRpc = 111, |
26 | - Role_updateEquip = 112, | ||
27 | Role_updateRune = 113, | 26 | Role_updateRune = 113, |
28 | Role_storyBookRewardRpc = 114, | 27 | Role_storyBookRewardRpc = 114, |
29 | Role_unLockStoryBookRpc = 115, | 28 | Role_unLockStoryBookRpc = 115, |
@@ -81,6 +80,7 @@ actionCodes = { | @@ -81,6 +80,7 @@ actionCodes = { | ||
81 | Car_makePotionRpc = 400, | 80 | Car_makePotionRpc = 400, |
82 | Car_equipUpRpc = 401, | 81 | Car_equipUpRpc = 401, |
83 | Car_runeUpRpc = 402, | 82 | Car_runeUpRpc = 402, |
83 | + Car_saleEquipRpc = 403, | ||
84 | } | 84 | } |
85 | 85 | ||
86 | rpcResponseBegin = 10000 | 86 | rpcResponseBegin = 10000 |
src/RedisKeys.lua
@@ -5,7 +5,6 @@ R_HERO = "hero:%d:%d" | @@ -5,7 +5,6 @@ R_HERO = "hero:%d:%d" | ||
5 | R_DAILY = "role:%d:daily" | 5 | R_DAILY = "role:%d:daily" |
6 | R_DINER = "role:%d:diner" -- 餐厅 | 6 | R_DINER = "role:%d:diner" -- 餐厅 |
7 | R_EQUIP_ROOT = "role:%d:equip*" -- 装备根目录 | 7 | R_EQUIP_ROOT = "role:%d:equip*" -- 装备根目录 |
8 | -R_EQUIP = "role:%d:equip:%d:%d" -- 装备type:level | ||
9 | R_RUNEIDS = "role:%d:runeIds" -- 玩家拥有符文自增id | 8 | R_RUNEIDS = "role:%d:runeIds" -- 玩家拥有符文自增id |
10 | R_RUNE = "role:%d:rune:%d" -- 符文详细信息 | 9 | R_RUNE = "role:%d:rune:%d" -- 符文详细信息 |
11 | 10 |
src/actions/CarAction.lua
@@ -47,7 +47,7 @@ function _M.equipUpRpc( agent, data ) | @@ -47,7 +47,7 @@ function _M.equipUpRpc( agent, data ) | ||
47 | local msg = MsgPack.unpack(data) | 47 | local msg = MsgPack.unpack(data) |
48 | local id = msg.id | 48 | local id = msg.id |
49 | local count = msg.count | 49 | local count = msg.count |
50 | - if count < 1 then return 0 end | 50 | + |
51 | local typ = math.floor((id-7000)/100) | 51 | local typ = math.floor((id-7000)/100) |
52 | local lv = (id-7000)%100 | 52 | local lv = (id-7000)%100 |
53 | 53 | ||
@@ -56,6 +56,7 @@ function _M.equipUpRpc( agent, data ) | @@ -56,6 +56,7 @@ function _M.equipUpRpc( agent, data ) | ||
56 | local equipData = dataSet[lv] | 56 | local equipData = dataSet[lv] |
57 | if not equipData then return 21 end | 57 | if not equipData then return 21 end |
58 | if equipData.merge < 1 then return 22 end | 58 | if equipData.merge < 1 then return 22 end |
59 | + | ||
59 | local maxLv = 3 | 60 | local maxLv = 3 |
60 | local nextLv = lv+1 | 61 | local nextLv = lv+1 |
61 | if nextLv%10 > maxLv then | 62 | if nextLv%10 > maxLv then |
@@ -64,13 +65,12 @@ function _M.equipUpRpc( agent, data ) | @@ -64,13 +65,12 @@ function _M.equipUpRpc( agent, data ) | ||
64 | local nextEquip = dataSet[nextLv] | 65 | local nextEquip = dataSet[nextLv] |
65 | if not nextEquip then return 23 end | 66 | if not nextEquip then return 23 end |
66 | 67 | ||
67 | - local ownSet = role.equipBag[typ] | ||
68 | - if not ownSet then return 31 end | ||
69 | - local ownData = ownSet[lv] | ||
70 | - if not ownData then return 32 end | 68 | + local limit = csvdb["ItemCsv"][nextEquip.id].limit ~= 0 and csvdb["ItemCsv"][nextEquip.id].limit or math.huge |
69 | + | ||
70 | + if math.illegalNum(count, 1, limit) then return 0 end | ||
71 | 71 | ||
72 | local own = role:getEquipCount(typ,lv) | 72 | local own = role:getEquipCount(typ,lv) |
73 | - local costCount = equipData.merge*count | 73 | + local costCount = equipData.merge * count |
74 | if own < costCount then | 74 | if own < costCount then |
75 | return 3 | 75 | return 3 |
76 | end | 76 | end |
@@ -84,8 +84,9 @@ function _M.equipUpRpc( agent, data ) | @@ -84,8 +84,9 @@ function _M.equipUpRpc( agent, data ) | ||
84 | end | 84 | end |
85 | 85 | ||
86 | role:costItems(cost) | 86 | role:costItems(cost) |
87 | - role:addEquip({type=typ,level=lv,count=-costCount}) | ||
88 | - role:addEquip({type=typ,level=nextLv,count=count}) | 87 | + role:addEquip(typ, lv, -costCount) |
88 | + role:addEquip(typ, nextLv ,count) | ||
89 | + | ||
89 | SendPacket(actionCodes.Car_equipUpRpc, '') | 90 | SendPacket(actionCodes.Car_equipUpRpc, '') |
90 | return true | 91 | return true |
91 | end | 92 | end |
@@ -121,4 +122,31 @@ function _M.runeUpRpc( agent, data ) | @@ -121,4 +122,31 @@ function _M.runeUpRpc( agent, data ) | ||
121 | return true | 122 | return true |
122 | end | 123 | end |
123 | 124 | ||
125 | +function _M.Car_saleEquipRpc(agent, data ) | ||
126 | + local role = agent.role | ||
127 | + local msg = MsgPack.unpack(data) | ||
128 | + | ||
129 | + local id = msg.id | ||
130 | + local count = msg.count | ||
131 | + | ||
132 | + local itemData = csvdb["ItemCsv"][id] | ||
133 | + if not itemData then return end | ||
134 | + | ||
135 | + local typ = math.floor((id-7000)/100) | ||
136 | + local lv = (id-7000)%100 | ||
137 | + | ||
138 | + local own = role:getEquipCount(typ,lv) | ||
139 | + if math.illegalNum(count, 1, own) then return end | ||
140 | + | ||
141 | + role:addEquip(typ, lv, -count) -- 删掉装备 | ||
142 | + -- 发奖励 | ||
143 | + local reward = itemData.sell_effect:toNumMap() | ||
144 | + for k ,v in pairs(reward) do | ||
145 | + reward[k] = v * count | ||
146 | + end | ||
147 | + role:award(reward) | ||
148 | + SendPacket(actionCodes.Car_saleEquipRpc, MsgPack.pack({reward = reward})) | ||
149 | + return true | ||
150 | +end | ||
151 | + | ||
124 | return _M | 152 | return _M |
125 | \ No newline at end of file | 153 | \ No newline at end of file |
src/actions/GmAction.lua
@@ -18,7 +18,9 @@ end | @@ -18,7 +18,9 @@ end | ||
18 | 18 | ||
19 | function _M.hero(role, pms) | 19 | function _M.hero(role, pms) |
20 | local heroType = tonum(pms.pm1) | 20 | local heroType = tonum(pms.pm1) |
21 | - role:addHero({type = heroType}) | 21 | + if not role:addHero({type = heroType}) then |
22 | + return "失败" | ||
23 | + end | ||
22 | return "成功" | 24 | return "成功" |
23 | end | 25 | end |
24 | 26 | ||
@@ -39,9 +41,9 @@ end | @@ -39,9 +41,9 @@ end | ||
39 | 41 | ||
40 | function _M.get(role, pms) | 42 | function _M.get(role, pms) |
41 | if pms.pm1 == "ALL" then | 43 | if pms.pm1 == "ALL" then |
42 | - for id,data in pairs(csvdb["itemCsv"]) do | ||
43 | - if data.type ~= 4 and data.type ~= 5 then | ||
44 | - role:award({[id] = 10}) | 44 | + for itemId = 1, 100 do |
45 | + if csvdb["itemCsv"][itemId] then | ||
46 | + role:award({[itemId] = 1000000}) | ||
45 | end | 47 | end |
46 | end | 48 | end |
47 | else | 49 | else |
src/actions/HeroAction.lua
@@ -506,32 +506,36 @@ function _M.referEquipsRpc(agent, data) | @@ -506,32 +506,36 @@ function _M.referEquipsRpc(agent, data) | ||
506 | local equips = msg.equips | 506 | local equips = msg.equips |
507 | if not equips or not next(equips) then return 11 end | 507 | if not equips or not next(equips) then return 11 end |
508 | 508 | ||
509 | - for typ,level in pairs(equips) do | ||
510 | - local ownLv = hero:getProperty("equip"):getv(typ,0) | ||
511 | - if level == 0 then | ||
512 | - if ownLv == 0 then return 2 end | ||
513 | - else | ||
514 | - if role:getEquipCount(typ,level) < 1 then return 3 end | ||
515 | - local equipSet = csvdb["equipCsv"][typ] | ||
516 | - if not equipSet then return 4 end | ||
517 | - local equipData = equipSet[level] | ||
518 | - if not equipData then return 5 end | 509 | + for typ = 1, 4 do -- 4件装备 |
510 | + if equips[typ] and equips[typ] ~= 0 then | ||
511 | + if role:getEquipCount(typ, equips[typ]) <= 0 then | ||
512 | + return | ||
513 | + end | ||
519 | end | 514 | end |
520 | end | 515 | end |
521 | - | ||
522 | - for typ,level in pairs(equips) do | ||
523 | - local ownLv = hero:getProperty("equip"):getv(typ,0) | ||
524 | - if level == 0 then | ||
525 | - role:addEquip({type=typ,level=ownLv,count=1,isRefer=true}) | ||
526 | - else | ||
527 | - role:addEquip({type=typ,level=level,count=-1,isRefer=true}) | ||
528 | - if ownLv > 0 then | ||
529 | - role:addEquip({type=typ,level=ownLv,count=1,isRefer=true}) | 516 | + local curEquip = hero:getProperty("equip") |
517 | + for typ = 1, 4 do -- 4件装备 | ||
518 | + if equips[typ] then | ||
519 | + local cur = curEquip:getv(typ, 0) | ||
520 | + if equips[typ] == 0 then | ||
521 | + if cur ~= 0 then | ||
522 | + role:addEquip(typ, cur, 1) -- 脱掉 | ||
523 | + curEquip = curEquip:delk(typ) | ||
524 | + end | ||
525 | + else | ||
526 | + if cur ~= equips[typ] then | ||
527 | + if cur ~= 0 then | ||
528 | + role:addEquip(typ, cur, 1) -- 脱掉 | ||
529 | + end | ||
530 | + role:addEquip(typ, equips[typ], -1) -- 穿上 | ||
531 | + curEquip = curEquip:setv(typ, equips[typ]) | ||
532 | + end | ||
530 | end | 533 | end |
531 | end | 534 | end |
532 | - local x = hero:getProperty("equip"):setv(typ, level) | ||
533 | - hero:updateProperty({field = "equip", value = x}) | ||
534 | end | 535 | end |
536 | + -- 更新角色 | ||
537 | + hero:updateProperty({field = "equip", value = curEquip}) | ||
538 | + | ||
535 | SendPacket(actionCodes.Hero_referEquipsRpc, "") | 539 | SendPacket(actionCodes.Hero_referEquipsRpc, "") |
536 | return true | 540 | return true |
537 | end | 541 | end |
src/actions/RoleAction.lua
@@ -15,7 +15,6 @@ local tconcat = table.concat | @@ -15,7 +15,6 @@ local tconcat = table.concat | ||
15 | local httpc = require("http.httpc") | 15 | local httpc = require("http.httpc") |
16 | 16 | ||
17 | local WAVE_HERO_NUMS = 150 | 17 | local WAVE_HERO_NUMS = 150 |
18 | -local WAVE_EQUIP_NUMS = 150 | ||
19 | 18 | ||
20 | local function validName(name) | 19 | local function validName(name) |
21 | name = string.upper(name) | 20 | name = string.upper(name) |
@@ -149,19 +148,10 @@ function _M.loginRpc( agent, data ) | @@ -149,19 +148,10 @@ function _M.loginRpc( agent, data ) | ||
149 | end | 148 | end |
150 | end | 149 | end |
151 | 150 | ||
152 | - response.wave = 3 + heroWave | 151 | + response.wave = 2 + heroWave |
153 | 152 | ||
154 | SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(response)) | 153 | SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(response)) |
155 | 154 | ||
156 | - local equipResp = {equipBag = {}} | ||
157 | - for typ,set in pairs(role.equipBag) do | ||
158 | - for level,equip in pairs(set) do | ||
159 | - if not equipResp.equipBag[typ] then equipResp.equipBag[typ] = {} end | ||
160 | - equipResp.equipBag[typ][level] = equip:data() | ||
161 | - end | ||
162 | - end | ||
163 | - SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(equipResp)) | ||
164 | - | ||
165 | local runeResp = {runeBag = {}} | 155 | local runeResp = {runeBag = {}} |
166 | for _,rune in pairs(role.runeBag) do | 156 | for _,rune in pairs(role.runeBag) do |
167 | runeResp.runeBag[rune:getProperty("uid")]=rune:data() | 157 | runeResp.runeBag[rune:getProperty("uid")]=rune:data() |
@@ -169,7 +159,7 @@ function _M.loginRpc( agent, data ) | @@ -169,7 +159,7 @@ function _M.loginRpc( agent, data ) | ||
169 | SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(runeResp)) | 159 | SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(runeResp)) |
170 | 160 | ||
171 | local heroIndex = 1 | 161 | local heroIndex = 1 |
172 | - for index = 2, 1 + heroWave do | 162 | + for index = 3, heroWave + 2 do |
173 | local heroResponse = {heros = {}} | 163 | local heroResponse = {heros = {}} |
174 | for i = heroIndex, heroIndex + WAVE_HERO_NUMS do | 164 | for i = heroIndex, heroIndex + WAVE_HERO_NUMS do |
175 | local heroId = heroIds[i] | 165 | local heroId = heroIds[i] |
src/models/Role.lua
@@ -13,7 +13,6 @@ function Role:ctor( properties ) | @@ -13,7 +13,6 @@ function Role:ctor( properties ) | ||
13 | Role.super.ctor(self, properties) | 13 | Role.super.ctor(self, properties) |
14 | self.ignoreHeartbeat = false | 14 | self.ignoreHeartbeat = false |
15 | self.heros = {} | 15 | self.heros = {} |
16 | - self.equipBag = {} | ||
17 | self.runeBag = {} | 16 | self.runeBag = {} |
18 | self.advData = nil | 17 | self.advData = nil |
19 | end | 18 | end |
@@ -57,6 +56,8 @@ Role.schema = { | @@ -57,6 +56,8 @@ Role.schema = { | ||
57 | potionBag = {"table", {}}, -- 营养剂背包 | 56 | potionBag = {"table", {}}, -- 营养剂背包 |
58 | 57 | ||
59 | storyB = {"table", {}}, -- 剧情记录 | 58 | storyB = {"table", {}}, -- 剧情记录 |
59 | + | ||
60 | + equips = {"table", {}}, -- 装备简化下, 目前的设计足够支撑 -- {t = {l = c}} -- 接口设计好 底层扩展就重写~ | ||
60 | } | 61 | } |
61 | 62 | ||
62 | 63 | ||
@@ -180,7 +181,8 @@ function Role:data() | @@ -180,7 +181,8 @@ function Role:data() | ||
180 | 181 | ||
181 | potionBag = self:getProperty("potionBag"), | 182 | potionBag = self:getProperty("potionBag"), |
182 | storyB = self:getProperty("storyB"), | 183 | storyB = self:getProperty("storyB"), |
183 | - | 184 | + equips = self:getProperty("equips"), |
185 | + | ||
184 | } | 186 | } |
185 | end | 187 | end |
186 | 188 |
src/models/RolePlugin.lua
@@ -62,6 +62,9 @@ function RolePlugin.bind(Role) | @@ -62,6 +62,9 @@ function RolePlugin.bind(Role) | ||
62 | local function _award(self, itemId, count, params) | 62 | local function _award(self, itemId, count, params) |
63 | local pms = clone(params) | 63 | local pms = clone(params) |
64 | local itemData = csvdb["itemCsv"][itemId] | 64 | local itemData = csvdb["itemCsv"][itemId] |
65 | + if not itemData then -- 加一层保护 | ||
66 | + return 0, {} | ||
67 | + end | ||
65 | local curType = itemData.type | 68 | local curType = itemData.type |
66 | local change = {} -- 奖励被转化为了其他奖励 id = count | 69 | local change = {} -- 奖励被转化为了其他奖励 id = count |
67 | 70 | ||
@@ -81,7 +84,7 @@ function RolePlugin.bind(Role) | @@ -81,7 +84,7 @@ function RolePlugin.bind(Role) | ||
81 | [ItemType.EquipBase] = function() | 84 | [ItemType.EquipBase] = function() |
82 | local typ = math.floor((itemId-7000)/100) | 85 | local typ = math.floor((itemId-7000)/100) |
83 | local lv = (itemId-7000)%100 | 86 | local lv = (itemId-7000)%100 |
84 | - self:addEquip({type = typ,level = lv,count = count}) | 87 | + self:addEquip(typ, lv, count ,pms) |
85 | end, | 88 | end, |
86 | [ItemType.Rune] = function() | 89 | [ItemType.Rune] = function() |
87 | local typ = math.floor((itemId-2000)/100) | 90 | local typ = math.floor((itemId-2000)/100) |
@@ -285,8 +288,12 @@ function RolePlugin.bind(Role) | @@ -285,8 +288,12 @@ function RolePlugin.bind(Role) | ||
285 | 288 | ||
286 | function Role:addHero(params) | 289 | function Role:addHero(params) |
287 | local roleId = self:getProperty("id") | 290 | local roleId = self:getProperty("id") |
288 | - local heroId = tonum(redisproxy:hincrby(string.format(R_INCR, roleId), "hero", 1)) | ||
289 | local heroType = params.type | 291 | local heroType = params.type |
292 | + if self:isHaveHero(heroType) then return end | ||
293 | + if not csvdb["unitCsv"][heroType] then return false end | ||
294 | + | ||
295 | + local heroId = tonum(redisproxy:hincrby(string.format(R_INCR, roleId), "hero", 1)) | ||
296 | + | ||
290 | 297 | ||
291 | redisproxy:sadd(string.format(R_HEROS, roleId), heroId) | 298 | redisproxy:sadd(string.format(R_HEROS, roleId), heroId) |
292 | 299 | ||
@@ -308,6 +315,16 @@ function RolePlugin.bind(Role) | @@ -308,6 +315,16 @@ function RolePlugin.bind(Role) | ||
308 | local bin = MsgPack.pack(heroResponse) | 315 | local bin = MsgPack.pack(heroResponse) |
309 | SendPacket(actionCodes.Hero_loadInfos, bin) | 316 | SendPacket(actionCodes.Hero_loadInfos, bin) |
310 | end | 317 | end |
318 | + return true | ||
319 | + end | ||
320 | + | ||
321 | + function Role:isHaveHero(heroType) | ||
322 | + if not csvdb["unitCsv"][heroType] then return false end | ||
323 | + for _, hero in pairs(self.heros) do | ||
324 | + if hero:getProperty("type") == heroType then | ||
325 | + return true | ||
326 | + end | ||
327 | + end | ||
311 | end | 328 | end |
312 | 329 | ||
313 | function Role:delHero(heroId) | 330 | function Role:delHero(heroId) |
@@ -365,82 +382,40 @@ function RolePlugin.bind(Role) | @@ -365,82 +382,40 @@ function RolePlugin.bind(Role) | ||
365 | end | 382 | end |
366 | 383 | ||
367 | function Role:loadEquips() | 384 | function Role:loadEquips() |
368 | - local roleId = self:getProperty("id") | ||
369 | - self.equipBag = {} | ||
370 | - local keys = redisproxy:keys(string.format(R_EQUIP_ROOT, roleId)) | ||
371 | - if keys and next(keys) then | ||
372 | - for _,v in pairs(keys) do | ||
373 | - local equip = require("models.Equip").new({key = v}) | ||
374 | - equip:load() | ||
375 | - local typ,lv = equip:getProperty("type"),equip:getProperty("level") | ||
376 | - equip.owner = self | ||
377 | - if not self.equipBag[typ] then self.equipBag[typ] = {} end | ||
378 | - self.equipBag[typ][lv] = equip | ||
379 | - end | ||
380 | - end | 385 | + -- 放role 里面了 |
381 | end | 386 | end |
382 | 387 | ||
383 | - function Role:addEquip(params) | ||
384 | - if params.type and params.level and params.count then | ||
385 | - local equipType = params.type | ||
386 | - local equipLv = params.level | ||
387 | - local count = params.count | ||
388 | - -- isRefer为true时count>0为卸载操作,<0为装备操作 | ||
389 | - local isRefer = params.isRefer or false | ||
390 | - local equip = nil | ||
391 | - local equipSet = self.equipBag[equipType] | ||
392 | - if equipSet then | ||
393 | - equip = self.equipBag[equipType][equipLv] | ||
394 | - else | ||
395 | - self.equipBag[equipType] = {} | ||
396 | - end | 388 | + function Role:addEquip(equipType, equipLv, count, pms) |
389 | + pms = pms or {} | ||
390 | + if count ~= count then return end | ||
391 | + local equipCsv = (csvdb["equipCsv"][equipType] or {})[equipLv] | ||
392 | + if not equipCsv then return end | ||
393 | + local equips = self:getProperty("equips") | ||
394 | + local curTypeEquips = equips[equipType] or {} | ||
395 | + local curCount = (curTypeEquips[equipLv] or 0) + count | ||
396 | + | ||
397 | + -- 是否足够上层判断 | ||
398 | + if curCount < 0 then | ||
399 | + curCount = 0 | ||
400 | + curTypeEquips[equipLv] = nil | ||
401 | + else | ||
402 | + curTypeEquips[equipLv] = curCount | ||
403 | + end | ||
397 | 404 | ||
398 | - if equip then | ||
399 | - local originCount = equip:getProperty("count") | ||
400 | - if isRefer then | ||
401 | - if count < 0 then | ||
402 | - if count+originCount<0 then | ||
403 | - return | ||
404 | - end | ||
405 | - else | ||
406 | - if equip:getProperty("refer")+count<0 then | ||
407 | - return | ||
408 | - end | ||
409 | - end | ||
410 | - end | ||
411 | - count = originCount+count | ||
412 | - else | ||
413 | - if isRefer then return end | ||
414 | - local roleId = self:getProperty("id") | ||
415 | - local data = { | ||
416 | - key = string.format(R_EQUIP,roleId,equipType,equipLv), | ||
417 | - type = equipType, | ||
418 | - level = equipLv, | ||
419 | - } | ||
420 | - equip = require("models.Equip").new(data) | ||
421 | - equip.owner = self | ||
422 | - equip:create() | ||
423 | - end | ||
424 | - equip:updateProperty({field = "count", value = count}) | ||
425 | - if isRefer then | ||
426 | - equip:updateProperty({field = "refer", value = equip:getProperty("refer")+params.count}) | ||
427 | - end | ||
428 | - self.equipBag[equipType][equipLv] = equip | 405 | + if next(curTypeEquips) then |
406 | + equips[equipType] = curTypeEquips | ||
407 | + else | ||
408 | + equips[equipType] = nil | ||
409 | + end | ||
410 | + | ||
411 | + self:setProperty("equips", equips) | ||
412 | + if not pms.notNotify then | ||
413 | + self:changeUpdates({{type = "equips", field = {equipType, equipLv}, value = curCount, isOnlyToC = true}}) -- 通知客户端 | ||
429 | end | 414 | end |
430 | end | 415 | end |
431 | 416 | ||
432 | function Role:getEquipCount(typ,lv) | 417 | function Role:getEquipCount(typ,lv) |
433 | - local equipSet = self.equipBag[typ] | ||
434 | - if equipSet then | ||
435 | - local equip = equipSet[lv] | ||
436 | - if equip then | ||
437 | - return equip:getProperty("count") | ||
438 | - else | ||
439 | - return 0 | ||
440 | - end | ||
441 | - else | ||
442 | - return 0 | ||
443 | - end | 418 | + return (self:getProperty("equips")[typ] or {})[lv] or 0 |
444 | end | 419 | end |
445 | 420 | ||
446 | function Role:loadRunes() | 421 | function Role:loadRunes() |