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