Commit a6508219f2328c5af95cef8b158c9c5456969f67
1 parent
00298f6a
挂机奖励
Showing
5 changed files
with
69 additions
and
0 deletions
Show diff stats
src/ProtocolCode.lua
@@ -98,6 +98,7 @@ actionCodes = { | @@ -98,6 +98,7 @@ actionCodes = { | ||
98 | Hang_buyBonusCountRpc = 259, | 98 | Hang_buyBonusCountRpc = 259, |
99 | Hang_startBonusBattleRpc = 260, | 99 | Hang_startBonusBattleRpc = 260, |
100 | Hang_endBonusBattleRpc = 261, | 100 | Hang_endBonusBattleRpc = 261, |
101 | + Hang_hangGiftRpc = 262, | ||
101 | 102 | ||
102 | Diner_updateProperty = 300, | 103 | Diner_updateProperty = 300, |
103 | Diner_addSellRpc = 301, | 104 | Diner_addSellRpc = 301, |
src/actions/HangAction.lua
@@ -486,6 +486,25 @@ function _M.endBonusBattleRpc(agent, data) | @@ -486,6 +486,25 @@ function _M.endBonusBattleRpc(agent, data) | ||
486 | return true | 486 | return true |
487 | end | 487 | end |
488 | 488 | ||
489 | +function _M.hangGiftRpc(agent, data) | ||
490 | + local role = agent.role | ||
491 | + local msg = MsgPack.unpack(data) | ||
492 | + | ||
493 | + local id = msg.id | ||
494 | + local carbonData = csvdb["idle_battleCsv"][id] | ||
495 | + if not carbonData or carbonData.item_clear_special == "" then return 1 end | ||
496 | + | ||
497 | + local hangGift = role:getProperty("hangGift") | ||
498 | + if hangGift[id] then return 2 end | ||
499 | + | ||
500 | + local reward = role:award(carbonData.item_clear_special, {log = {desc = "hangGift", int1 = id}}) | ||
501 | + role:log("hang_action", {desc = "hangGift", int1 = id}) | ||
502 | + | ||
503 | + role:changeUpdates({{type = "hangGift", field = id, value = 1}}) | ||
504 | + | ||
505 | + SendPacket(actionCodes.Hang_hangGiftRpc, MsgPack.pack(reward)) | ||
506 | + return true | ||
507 | +end | ||
489 | 508 | ||
490 | 509 | ||
491 | return _M | 510 | return _M |
492 | \ No newline at end of file | 511 | \ No newline at end of file |
src/models/HeroPlugin.lua
@@ -214,6 +214,52 @@ function HeroPlugin.bind(Hero) | @@ -214,6 +214,52 @@ function HeroPlugin.bind(Hero) | ||
214 | end | 214 | end |
215 | return {} | 215 | return {} |
216 | end | 216 | end |
217 | + | ||
218 | + function Hero:getRunes() | ||
219 | + local rune = self:getProperty("rune") | ||
220 | + if not rune or rune == "" then | ||
221 | + rune = "1=0 2=0 3=0 4=0 5=0 6=0" | ||
222 | + end | ||
223 | + local result = rune:toNumMap() | ||
224 | + for i = 1, 6 do | ||
225 | + if not result[i] then | ||
226 | + result[i] = 0 | ||
227 | + end | ||
228 | + end | ||
229 | + return result | ||
230 | + end | ||
231 | + | ||
232 | + -- 101 冒险战斗被动技 | ||
233 | + -- 102 挂机战斗被动技 | ||
234 | + function Hero:getRuneSkill(skillType) | ||
235 | + local suits = {} | ||
236 | + for _,uid in pairs(self:getRunes()) do | ||
237 | + if uid > 0 then | ||
238 | + local runeData = self.owner.runeBag[uid] | ||
239 | + if not runeData then return end | ||
240 | + local csvData = csvdb["runeCsv"][runeData.type][runeData.id] | ||
241 | + if not suits[csvData.suit] then suits[csvData.suit] = {} end | ||
242 | + table.insert(suits[csvData.suit],csvData) | ||
243 | + end | ||
244 | + end | ||
245 | + | ||
246 | + for suitId,runes in pairs(suits) do | ||
247 | + local suitCsv = csvdb["rune_suitCsv"][tonumber(suitId)] | ||
248 | + if not suitCsv then return end | ||
249 | + local effects = suitCsv.effect:toTableArray(true) | ||
250 | + local count = #runes | ||
251 | + if count >= 2 and effects[1][1] == skillType then | ||
252 | + return effects[1][2] | ||
253 | + end | ||
254 | + if count >= 4 and effects[2][1] == skillType then | ||
255 | + return effects[2][2] | ||
256 | + end | ||
257 | + if count >= 6 and effects[3][1] == skillType then | ||
258 | + return effects[3][2] | ||
259 | + end | ||
260 | + end | ||
261 | + return | ||
262 | + end | ||
217 | end | 263 | end |
218 | 264 | ||
219 | 265 |
src/models/Role.lua
@@ -86,6 +86,7 @@ Role.schema = { | @@ -86,6 +86,7 @@ Role.schema = { | ||
86 | 86 | ||
87 | --挂机相关 | 87 | --挂机相关 |
88 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 | 88 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 |
89 | + hangGift = {"table", {}}, -- 挂机奖励 {id = 1} | ||
89 | hangTeam = {"table", {}}, -- 挂机队伍 | 90 | hangTeam = {"table", {}}, -- 挂机队伍 |
90 | hangTS = {"table", {}}, -- 挂机队伍他人可读的队伍信息 | 91 | hangTS = {"table", {}}, -- 挂机队伍他人可读的队伍信息 |
91 | hangTB = {"table", {}}, -- 挂机队伍他人可用的战斗信息mao | 92 | hangTB = {"table", {}}, -- 挂机队伍他人可用的战斗信息mao |
@@ -321,6 +322,7 @@ function Role:data() | @@ -321,6 +322,7 @@ function Role:data() | ||
321 | advSup = self:getProperty("advSup"), | 322 | advSup = self:getProperty("advSup"), |
322 | 323 | ||
323 | hangPass = self:getProperty("hangPass"), | 324 | hangPass = self:getProperty("hangPass"), |
325 | + hangGift = self:getProperty("hangGift"), | ||
324 | hangTeam = self:getProperty("hangTeam"), | 326 | hangTeam = self:getProperty("hangTeam"), |
325 | hangInfo = self:getProperty("hangInfo"), | 327 | hangInfo = self:getProperty("hangInfo"), |
326 | hangBag = self:getProperty("hangBag"), | 328 | hangBag = self:getProperty("hangBag"), |
src/models/RolePlugin.lua
@@ -1192,6 +1192,7 @@ function RolePlugin.bind(Role) | @@ -1192,6 +1192,7 @@ function RolePlugin.bind(Role) | ||
1192 | info.level = hero:getProperty("level") | 1192 | info.level = hero:getProperty("level") |
1193 | info.blockLevel = hero:getSkillLevel(4) | 1193 | info.blockLevel = hero:getSkillLevel(4) |
1194 | info.specialLevel = hero:getSkillLevel(1) | 1194 | info.specialLevel = hero:getSkillLevel(1) |
1195 | + info.runeSkill = hero:getRuneSkill(102) | ||
1195 | teamInfo.heros[slot] = info | 1196 | teamInfo.heros[slot] = info |
1196 | end | 1197 | end |
1197 | for slot, id in pairs(team.supports or {}) do | 1198 | for slot, id in pairs(team.supports or {}) do |