Commit 958739a84d183b60f7eb2bce0136eadbde61aa39

Authored by zhouhaihai
2 parents 404d5bee 71003290

Merge branch 'develop' into player

src/actions/DinerAction.lua
@@ -40,7 +40,7 @@ function _M.addSellRpc( agent, data ) @@ -40,7 +40,7 @@ function _M.addSellRpc( agent, data )
40 deltaTime = 0, 40 deltaTime = 0,
41 lastCount = 0, 41 lastCount = 0,
42 } 42 }
43 - local count = sellData.count 43 + local count = sellData.count or 0
44 local maxDishCount = role.dinerData:getMaxDishs() 44 local maxDishCount = role.dinerData:getMaxDishs()
45 if math.illegalNum(count + calSell.lastCount, 1, maxDishCount) then 45 if math.illegalNum(count + calSell.lastCount, 1, maxDishCount) then
46 return 5 46 return 5
src/actions/GmAction.lua
@@ -121,7 +121,7 @@ function _M.herol(role, pms) @@ -121,7 +121,7 @@ function _M.herol(role, pms)
121 return "等级已满" 121 return "等级已满"
122 end 122 end
123 local nextLevel = math.min(addLevel + hero:getProperty("level"), MaxLv) 123 local nextLevel = math.min(addLevel + hero:getProperty("level"), MaxLv)
124 - for i = 0, 10 do 124 + for i = 0, #csvdb["unit_breakCsv"] do
125 local upLimit = csvdb["unit_breakCsv"][i].levelLimit 125 local upLimit = csvdb["unit_breakCsv"][i].levelLimit
126 local lowLimit = csvdb["unit_breakCsv"][i - 1] and csvdb["unit_breakCsv"][i - 1].levelLimit or 0 126 local lowLimit = csvdb["unit_breakCsv"][i - 1] and csvdb["unit_breakCsv"][i - 1].levelLimit or 0
127 if upLimit > nextLevel and lowLimit <= nextLevel then 127 if upLimit > nextLevel and lowLimit <= nextLevel then
@@ -356,7 +356,9 @@ function _M.adv(role, pms) @@ -356,7 +356,9 @@ function _M.adv(role, pms)
356 356
357 local advData = csvdb["adv_chapterCsv"][chapterId] 357 local advData = csvdb["adv_chapterCsv"][chapterId]
358 if not advData then return end 358 if not advData then return end
359 - layer = math.min(layer, advData.limitlevel) 359 + if math.floor(chapterId / 100) ~= 2 then
  360 + layer = math.min(layer, advData.limitlevel)
  361 + end
360 local advPass = role:getProperty("advPass") 362 local advPass = role:getProperty("advPass")
361 local addPre 363 local addPre
362 addPre = function(chapterId) 364 addPre = function(chapterId)
@@ -384,13 +386,15 @@ function _M.advt(role, pms) @@ -384,13 +386,15 @@ function _M.advt(role, pms)
384 local layer = tonum(pms.pm2) 386 local layer = tonum(pms.pm2)
385 local advData = csvdb["adv_chapterCsv"][chapterId] 387 local advData = csvdb["adv_chapterCsv"][chapterId]
386 if not advData then return "不存在的章节" end 388 if not advData then return "不存在的章节" end
387 - layer = math.min(layer, advData.limitlevel)  
388 - local advData = role:getAdvData()  
389 389
  390 + local advData = role:getAdvData()
390 if not advData.chapterId then 391 if not advData.chapterId then
391 return "先随便开启一关" 392 return "先随便开启一关"
392 end 393 end
393 - 394 + if not advData:isEndless() then
  395 + layer = math.min(layer, advData.limitlevel)
  396 + end
  397 +
394 _M.adv(role, {pm1 = chapterId, pm2 = layer - 1}) 398 _M.adv(role, {pm1 = chapterId, pm2 = layer - 1})
395 399
396 400
src/actions/HangAction.lua
@@ -120,6 +120,7 @@ function _M.checkRpc(agent, data) @@ -120,6 +120,7 @@ function _M.checkRpc(agent, data)
120 return true 120 return true
121 end 121 end
122 122
  123 +local _BattleKey = nil
123 function _M.startBattleRpc(agent, data) 124 function _M.startBattleRpc(agent, data)
124 local role = agent.role 125 local role = agent.role
125 local msg = MsgPack.unpack(data) 126 local msg = MsgPack.unpack(data)
@@ -141,12 +142,10 @@ function _M.startBattleRpc(agent, data) @@ -141,12 +142,10 @@ function _M.startBattleRpc(agent, data)
141 return 3 142 return 3
142 end 143 end
143 144
144 - local key = tostring(math.random())  
145 - hangInfo.key = key  
146 - local nowTime = skynet.timex()  
147 - role:updateProperty({field = "hangInfo", value = hangInfo}) 145 + _BattleKey = tostring(math.random())
  146 +
148 role:checkTaskEnter("HangBattle", {id = carbonId}) 147 role:checkTaskEnter("HangBattle", {id = carbonId})
149 - SendPacket(actionCodes.Hang_startBattleRpc, MsgPack.pack({key = key})) 148 + SendPacket(actionCodes.Hang_startBattleRpc, MsgPack.pack({key = _BattleKey}))
150 return true 149 return true
151 end 150 end
152 151
@@ -154,7 +153,7 @@ function _M.endBattleRpc(agent, data) @@ -154,7 +153,7 @@ function _M.endBattleRpc(agent, data)
154 local role = agent.role 153 local role = agent.role
155 local msg = MsgPack.unpack(data) 154 local msg = MsgPack.unpack(data)
156 local hangInfo = role:getProperty("hangInfo") 155 local hangInfo = role:getProperty("hangInfo")
157 - if not msg.key or msg.key ~= hangInfo.key then 156 + if not msg.key or msg.key ~= _BattleKey then
158 return 1 157 return 1
159 end 158 end
160 local carbonId = msg.carbonId 159 local carbonId = msg.carbonId
@@ -190,7 +189,6 @@ function _M.endBattleRpc(agent, data) @@ -190,7 +189,6 @@ function _M.endBattleRpc(agent, data)
190 189
191 role:checkTaskEnter("HangPass", {id = carbonId}) 190 role:checkTaskEnter("HangPass", {id = carbonId})
192 end 191 end
193 - hangInfo.key = nil  
194 role:updateProperty({field = "hangInfo", value = hangInfo}) 192 role:updateProperty({field = "hangInfo", value = hangInfo})
195 193
196 role:log("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId}) 194 role:log("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId})
@@ -202,23 +200,31 @@ function _M.endBattleRpc(agent, data) @@ -202,23 +200,31 @@ function _M.endBattleRpc(agent, data)
202 return true 200 return true
203 end 201 end
204 202
  203 +local function checkLeader(heros, leader)
  204 + if not leader then return end
  205 + for slot, heroId in pairs(heros) do
  206 + if heroId == leader then return true end
  207 + end
  208 +end
  209 +
205 function _M.roleFormatRpc(agent , data) 210 function _M.roleFormatRpc(agent , data)
206 local role = agent.role 211 local role = agent.role
207 local msg = MsgPack.unpack(data) 212 local msg = MsgPack.unpack(data)
208 local hangTeam = role:getProperty("hangTeam") 213 local hangTeam = role:getProperty("hangTeam")
209 for slot, heroId in pairs(msg.heros) do 214 for slot, heroId in pairs(msg.heros) do
210 if not role.heros[heroId] then 215 if not role.heros[heroId] then
211 - return 216 + return 1
212 end 217 end
213 end 218 end
214 219
215 local supports = {} 220 local supports = {}
216 for slot, support in pairs(msg.supports or {}) do 221 for slot, support in pairs(msg.supports or {}) do
217 - if slot ~= 1 and slot ~= 2 then return end 222 + if slot ~= 1 and slot ~= 2 then return 2 end
218 local level = role.dinerData:getProperty("dishTree"):getv(support, 0) 223 local level = role.dinerData:getProperty("dishTree"):getv(support, 0)
219 - if level <= 0 then return end 224 + if level <= 0 then return 3 end
220 supports[slot] = support 225 supports[slot] = support
221 end 226 end
  227 + if not checkLeader(msg.heros, msg.leader) then return 4 end
222 228
223 table.clear(hangTeam) 229 table.clear(hangTeam)
224 hangTeam.heros = {} 230 hangTeam.heros = {}
@@ -377,7 +383,8 @@ function _M.bonusFormatRpc(agent , data) @@ -377,7 +383,8 @@ function _M.bonusFormatRpc(agent , data)
377 if level <= 0 then return end 383 if level <= 0 then return end
378 supports[slot] = support 384 supports[slot] = support
379 end 385 end
380 - 386 + if not checkLeader(msg.heros, msg.leader) then return end
  387 +
381 table.clear(bTeam) 388 table.clear(bTeam)
382 bTeam.heros = {} 389 bTeam.heros = {}
383 for slot, heroId in pairs(msg.heros) do 390 for slot, heroId in pairs(msg.heros) do
src/actions/HeroAction.lua
@@ -815,7 +815,7 @@ function _M.drawHeroRpc(agent, data) @@ -815,7 +815,7 @@ function _M.drawHeroRpc(agent, data)
815 end 815 end
816 if not fillPoolFunc[rateTypes[rateType]] then return 4 end 816 if not fillPoolFunc[rateTypes[rateType]] then return 4 end
817 if isFloorBack then 817 if isFloorBack then
818 - fillPoolFunc[rateTypes[rateType]](4) -- 保底 818 + fillPoolFunc[rateTypes[rateType]](3) -- 保底 sr 【郑斌】明确
819 else 819 else
820 fillPoolFunc[rateTypes[rateType]]() 820 fillPoolFunc[rateTypes[rateType]]()
821 end 821 end
@@ -825,9 +825,12 @@ function _M.drawHeroRpc(agent, data) @@ -825,9 +825,12 @@ function _M.drawHeroRpc(agent, data)
825 local temp = resultPool[idx] 825 local temp = resultPool[idx]
826 local itemData = csvdb["itemCsv"][temp[1]] 826 local itemData = csvdb["itemCsv"][temp[1]]
827 827
828 - if itemData.type == ItemType.Hero and itemData.quality == 4 then  
829 - ssrCount = ssrCount + 1  
830 - floorHeroCount = 0 828 + if itemData.type == ItemType.Hero then
  829 + if itemData.quality == 4 then
  830 + ssrCount = ssrCount + 1
  831 + elseif itemData.quality == 3 then
  832 + floorHeroCount = 0
  833 + end
831 end 834 end
832 835
833 if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then 836 if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then
src/actions/StoreAction.lua
@@ -59,7 +59,7 @@ function _M.dailyBuyRpc(agent , data) @@ -59,7 +59,7 @@ function _M.dailyBuyRpc(agent , data)
59 return 3 59 return 3
60 end 60 end
61 61
62 - if not role:costDiamond({count = cost * count}, {log = {desc = "dailyShop", int1 = id, int2 = count}}) then 62 + if not role:costDiamond({count = cost * count, log = {desc = "dailyShop", int1 = id, int2 = count}}) then
63 return 4 63 return 4
64 end 64 end
65 65
src/adv/AdvBuff.lua
@@ -237,7 +237,7 @@ local BuffFactory = { @@ -237,7 +237,7 @@ local BuffFactory = {
237 _Buff._init = function(self) 237 _Buff._init = function(self)
238 for _, buff in ipairs(self.owner.buffs) do -- 挂上就清除一下子 238 for _, buff in ipairs(self.owner.buffs) do -- 挂上就清除一下子
239 if not buff.isDel and self:canEffect(buff.id) and not self.isDel then 239 if not buff.isDel and self:canEffect(buff.id) and not self.isDel then
240 - if not buff.isDel and not self.isDel then 240 + while not buff.isDel and not self.isDel do
241 self:effect() 241 self:effect()
242 buff:uncover() 242 buff:uncover()
243 end 243 end
src/models/RoleCross.lua
@@ -308,7 +308,7 @@ function CMD.pvpHInfo(roleId) @@ -308,7 +308,7 @@ function CMD.pvpHInfo(roleId)
308 end 308 end
309 309
310 -- 高级pvp 排行榜 310 -- 高级pvp 排行榜
311 -function CMD:pvpHRankInfo() 311 +function CMD:pvpHRankInfo(roleId)
312 local info = CMD.getProperties(roleId, {"name", "level", "headId", "pvpTBVH", "ltime"}) 312 local info = CMD.getProperties(roleId, {"name", "level", "headId", "pvpTBVH", "ltime"})
313 local info = { 313 local info = {
314 name = info.name, 314 name = info.name,
src/models/RoleLog.lua
@@ -71,6 +71,10 @@ local commonRoleField = { @@ -71,6 +71,10 @@ local commonRoleField = {
71 rmbC = "integer", 71 rmbC = "integer",
72 } 72 }
73 73
  74 +local function printError(info)
  75 + print(info)
  76 + print(debug.traceback())
  77 +end
74 78
75 local function checkType(logType, field, value, ctype) 79 local function checkType(logType, field, value, ctype)
76 local typecheckfunc = { 80 local typecheckfunc = {
@@ -78,10 +82,10 @@ local function checkType(logType, field, value, ctype) @@ -78,10 +82,10 @@ local function checkType(logType, field, value, ctype)
78 --长度不超过256 82 --长度不超过256
79 if type(value) ~= "string" then 83 if type(value) ~= "string" then
80 value = tostring(value) 84 value = tostring(value)
81 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [keyword], value : %s", logType, field, value)) 85 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [keyword], value : %s", logType, field, value))
82 else 86 else
83 if #value > 256 then 87 if #value > 256 then
84 - print(string.format("LOG ERROR: logType [%s] field [%s] [keyword] type to long. value : %s", logType, field, value)) 88 + printError(string.format("LOG ERROR: logType [%s] field [%s] [keyword] type to long. value : %s", logType, field, value))
85 end 89 end
86 end 90 end
87 return value 91 return value
@@ -89,26 +93,26 @@ local function checkType(logType, field, value, ctype) @@ -89,26 +93,26 @@ local function checkType(logType, field, value, ctype)
89 text = function() 93 text = function()
90 if type(value) ~= "string" then 94 if type(value) ~= "string" then
91 value = tostring(value) 95 value = tostring(value)
92 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [text], value : %s", logType, field, value)) 96 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [text], value : %s", logType, field, value))
93 end 97 end
94 return value 98 return value
95 end, 99 end,
96 integer = function() 100 integer = function()
97 if type(value) ~= "number" then 101 if type(value) ~= "number" then
98 value = tonumber(value) 102 value = tonumber(value)
99 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], value : %s", logType, field, value)) 103 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], value : %s", logType, field, value))
100 end 104 end
101 if value then 105 if value then
102 if math.type(value) ~= "integer" then 106 if math.type(value) ~= "integer" then
103 local oldValue = value 107 local oldValue = value
104 value = math.floor(value) 108 value = math.floor(value)
105 if value ~= oldValue then 109 if value ~= oldValue then
106 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], is float, value : %s", logType, field, value)) 110 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], is float, value : %s", logType, field, value))
107 end 111 end
108 end 112 end
109 if -2147483648 > value or value > 2147483647 then 113 if -2147483648 > value or value > 2147483647 then
  114 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], too big, value : %s", logType, field, value))
110 value = nil 115 value = nil
111 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [integer], too big, value : %s", logType, field, value))  
112 end 116 end
113 end 117 end
114 return value 118 return value
@@ -116,20 +120,20 @@ local function checkType(logType, field, value, ctype) @@ -116,20 +120,20 @@ local function checkType(logType, field, value, ctype)
116 short = function() 120 short = function()
117 if type(value) ~= "number" then 121 if type(value) ~= "number" then
118 value = tonumber(value) 122 value = tonumber(value)
119 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], value : %s", logType, field, value)) 123 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], value : %s", logType, field, value))
120 end 124 end
121 if value then 125 if value then
122 if math.type(value) ~= "integer" then 126 if math.type(value) ~= "integer" then
123 local oldValue = value 127 local oldValue = value
124 value = math.floor(value) 128 value = math.floor(value)
125 if value ~= oldValue then 129 if value ~= oldValue then
126 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], is float, value : %s", logType, field, value)) 130 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], is float, value : %s", logType, field, value))
127 end 131 end
128 end 132 end
129 133
130 if -32768 > value or value > 32768 then 134 if -32768 > value or value > 32768 then
  135 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], too big, value : %s", logType, field, value))
131 value = nil 136 value = nil
132 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [short], too big, value : %s", logType, field, value))  
133 end 137 end
134 end 138 end
135 return value 139 return value
@@ -137,17 +141,17 @@ local function checkType(logType, field, value, ctype) @@ -137,17 +141,17 @@ local function checkType(logType, field, value, ctype)
137 long = function() 141 long = function()
138 if type(value) ~= "number" then 142 if type(value) ~= "number" then
139 value = tonumber(value) 143 value = tonumber(value)
140 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], value : %s", logType, field, value)) 144 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], value : %s", logType, field, value))
141 end 145 end
142 if value then 146 if value then
143 if math.type(value) ~= "integer" then 147 if math.type(value) ~= "integer" then
144 local oldValue = value 148 local oldValue = value
145 value = math.floor(value) 149 value = math.floor(value)
146 if type(value) ~= "integer" then 150 if type(value) ~= "integer" then
  151 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], too big, value : %s", logType, field, value))
147 value = nil 152 value = nil
148 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], too big, value : %s", logType, field, value))  
149 elseif value ~= oldValue then 153 elseif value ~= oldValue then
150 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], is float, value : %s", logType, field, value)) 154 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [long], is float, value : %s", logType, field, value))
151 end 155 end
152 end 156 end
153 end 157 end
@@ -156,7 +160,7 @@ local function checkType(logType, field, value, ctype) @@ -156,7 +160,7 @@ local function checkType(logType, field, value, ctype)
156 float = function() 160 float = function()
157 if type(value) ~= "number" then 161 if type(value) ~= "number" then
158 value = tonumber(value) 162 value = tonumber(value)
159 - print(string.format("LOG ERROR: logType [%s] field [%s] isn't [float], value : %s", logType, field, value)) 163 + printError(string.format("LOG ERROR: logType [%s] field [%s] isn't [float], value : %s", logType, field, value))
160 end 164 end
161 return value 165 return value
162 end, 166 end,
@@ -165,7 +169,7 @@ local function checkType(logType, field, value, ctype) @@ -165,7 +169,7 @@ local function checkType(logType, field, value, ctype)
165 if typecheckfunc[ctype] then 169 if typecheckfunc[ctype] then
166 return typecheckfunc[ctype]() 170 return typecheckfunc[ctype]()
167 else 171 else
168 - print(string.format("LOG ERROR: logType [%s] field [%s] have a new type [%s] need add check.", logType, field, ctype)) 172 + printError(string.format("LOG ERROR: logType [%s] field [%s] have a new type [%s] need add check.", logType, field, ctype))
169 return nil 173 return nil
170 end 174 end
171 end 175 end
@@ -176,13 +180,13 @@ function RoleLog.bind(Role) @@ -176,13 +180,13 @@ function RoleLog.bind(Role)
176 contents = contents or {} 180 contents = contents or {}
177 local _logType = LogType[logType] 181 local _logType = LogType[logType]
178 if not _logType then 182 if not _logType then
179 - print(string.format("LOG ERROR: new logType [%s] need Add Maping.", logType)) 183 + printError(string.format("LOG ERROR: new logType [%s] need Add Maping.", logType))
180 return 184 return
181 end 185 end
182 local doc = {} 186 local doc = {}
183 for field, ctype in pairs(commonRoleField) do 187 for field, ctype in pairs(commonRoleField) do
184 if contents[field] then 188 if contents[field] then
185 - print(string.format("LOG ERROR: logType [%s] had field [%s] overwrite default.", logType, field)) 189 + printError(string.format("LOG ERROR: logType [%s] had field [%s] overwrite default.", logType, field))
186 end 190 end
187 doc[field] = checkType("commonRoleField", field, self:getProperty(field), ctype) 191 doc[field] = checkType("commonRoleField", field, self:getProperty(field), ctype)
188 end 192 end
@@ -197,7 +201,7 @@ function RoleLog.bind(Role) @@ -197,7 +201,7 @@ function RoleLog.bind(Role)
197 if ftype then 201 if ftype then
198 doc[field] = checkType(logType, field, value, ftype) 202 doc[field] = checkType(logType, field, value, ftype)
199 else 203 else
200 - print(string.format("LOG ERROR: logType [%s] have new field [%s] no type in mapping.", logType, field)) 204 + printError(string.format("LOG ERROR: logType [%s] have new field [%s] no type in mapping.", logType, field))
201 end 205 end
202 end 206 end
203 if not logd then return end 207 if not logd then return end
src/models/RoleTask.lua
@@ -343,6 +343,7 @@ function RoleTask.bind(Role) @@ -343,6 +343,7 @@ function RoleTask.bind(Role)
343 [22] = true, 343 [22] = true,
344 [23] = true, 344 [23] = true,
345 [25] = true, 345 [25] = true,
  346 + [37] = true,
346 } 347 }
347 348
348 for tId , achiveData in pairs(csvdb["achievement_typeCsv"]) do 349 for tId , achiveData in pairs(csvdb["achievement_typeCsv"]) do