Commit e51f5f1db65f537bedec42485b55abebf9995a49
Merge branch 'cn/develop' into cn/publish/release
Showing
5 changed files
with
91 additions
and
50 deletions
Show diff stats
src/actions/GmAction.lua
| @@ -1139,4 +1139,27 @@ function _M.get_draw_hero_pro(role, pms) | @@ -1139,4 +1139,27 @@ function _M.get_draw_hero_pro(role, pms) | ||
| 1139 | return json.encode(result) | 1139 | return json.encode(result) |
| 1140 | end | 1140 | end |
| 1141 | 1141 | ||
| 1142 | +function _M.decrePayR(role, pms) | ||
| 1143 | + local id = tonumber(pms.pm1) | ||
| 1144 | + local payR = role.storeData:getProperty("payR") | ||
| 1145 | + if payR[id] > 0 then | ||
| 1146 | + payR[id] = payR[id] - 1 | ||
| 1147 | + if payR[id] == 0 then | ||
| 1148 | + payR[id] = nil | ||
| 1149 | + end | ||
| 1150 | + end | ||
| 1151 | + role.storeData:updateProperty({field = "payR", value = payR}) | ||
| 1152 | + return "指令成功" | ||
| 1153 | +end | ||
| 1154 | + | ||
| 1155 | +function _M.draw_code(role, pms) | ||
| 1156 | + local code = pms.pm1 | ||
| 1157 | + if type(code) ~= "string" then return -2 end | ||
| 1158 | + if code:find("[^0-9a-zA-Z]") then return -3 end | ||
| 1159 | + | ||
| 1160 | + local ret, _, _= role:getCodeGift(code) | ||
| 1161 | + return ret | ||
| 1162 | +end | ||
| 1163 | + | ||
| 1164 | + | ||
| 1142 | return _M | 1165 | return _M |
| 1143 | \ No newline at end of file | 1166 | \ No newline at end of file |
src/actions/HangAction.lua
| @@ -570,18 +570,18 @@ function _M.buyBonusCountRpc(agent, data) | @@ -570,18 +570,18 @@ function _M.buyBonusCountRpc(agent, data) | ||
| 570 | 570 | ||
| 571 | local bonusC = role.dailyData:getProperty("bonusC") | 571 | local bonusC = role.dailyData:getProperty("bonusC") |
| 572 | local extraCnt = role.storeData:getBonusExtraFightCount() | 572 | local extraCnt = role.storeData:getBonusExtraFightCount() |
| 573 | - bonusC[btype] = bonusC[btype] or {c = 0, b = 0} | 573 | + --bonusC[btype] = bonusC[btype] or {c = 0, b = 0} |
| 574 | --local lastCount = (globalCsv.bonus_daily_buy_count + role:getBnousChangeBuyCount()) * coef + extraCnt - bonusC[btype]["b"] | 574 | --local lastCount = (globalCsv.bonus_daily_buy_count + role:getBnousChangeBuyCount()) * coef + extraCnt - bonusC[btype]["b"] |
| 575 | --if math.illegalNum(count, 1, lastCount) then return 1 end | 575 | --if math.illegalNum(count, 1, lastCount) then return 1 end |
| 576 | 576 | ||
| 577 | - local costCount = bonusC[btype]["b"] + count | 577 | + local costCount = (bonusC["b"] or 0 )+ count |
| 578 | local cost = table.findMinKeyByIndex(globalCsv.bonus_buy_cost, costCount, 1) | 578 | local cost = table.findMinKeyByIndex(globalCsv.bonus_buy_cost, costCount, 1) |
| 579 | 579 | ||
| 580 | if not role:checkItemEnough({[ItemId.Jade] = cost}) then return 2 end | 580 | if not role:checkItemEnough({[ItemId.Jade] = cost}) then return 2 end |
| 581 | 581 | ||
| 582 | role:costItems({[ItemId.Jade] = cost}, {log = {desc = "buyBonusCount", int1 = btype, int2 = count}}) | 582 | role:costItems({[ItemId.Jade] = cost}, {log = {desc = "buyBonusCount", int1 = btype, int2 = count}}) |
| 583 | - bonusC[btype]["b"] = costCount | ||
| 584 | - bonusC[btype]["c"] = bonusC[btype]["c"] - count | 583 | + bonusC["b"] = costCount |
| 584 | + bonusC["c"] = (bonusC["c"] or 0) - count | ||
| 585 | 585 | ||
| 586 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | 586 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) |
| 587 | 587 | ||
| @@ -664,7 +664,7 @@ function _M.startBonusBattleRpc(agent, data) | @@ -664,7 +664,7 @@ function _M.startBonusBattleRpc(agent, data) | ||
| 664 | 664 | ||
| 665 | if bonusStar[id] and bonusStar[id] >= (1 << #bonusData.sweep_condition:toTableArray(true)) - 1 then | 665 | if bonusStar[id] and bonusStar[id] >= (1 << #bonusData.sweep_condition:toTableArray(true)) - 1 then |
| 666 | local bonusC = role.dailyData:getProperty("bonusC") | 666 | local bonusC = role.dailyData:getProperty("bonusC") |
| 667 | - bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} | 667 | + --bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} |
| 668 | 668 | ||
| 669 | local actData = csvdb["activity_ctrlCsv"][actId] | 669 | local actData = csvdb["activity_ctrlCsv"][actId] |
| 670 | local extraCnt = role.storeData:getBonusExtraFightCount() | 670 | local extraCnt = role.storeData:getBonusExtraFightCount() |
| @@ -672,9 +672,9 @@ function _M.startBonusBattleRpc(agent, data) | @@ -672,9 +672,9 @@ function _M.startBonusBattleRpc(agent, data) | ||
| 672 | if open and actData then | 672 | if open and actData then |
| 673 | coef = tonumber(actData.condition2) | 673 | coef = tonumber(actData.condition2) |
| 674 | end | 674 | end |
| 675 | - if math.illegalNum(count, 1, (globalCsv.bonus_daily_count + role:getBnousChangeBaseCount()) * coef + extraCnt - bonusC[bonusData.type]["c"]) then return 7 end | 675 | + if math.illegalNum(count, 1, (globalCsv.bonus_daily_count + role:getBnousChangeBaseCount()) * coef + extraCnt - (bonusC["c"] or 0)) then return 7 end |
| 676 | 676 | ||
| 677 | - bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count | 677 | + bonusC["c"] = (bonusC["c"] or 0) + count |
| 678 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | 678 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) |
| 679 | 679 | ||
| 680 | local reward, change = bonusWinReward(role, bonusData, 3, count, true) | 680 | local reward, change = bonusWinReward(role, bonusData, 3, count, true) |
src/actions/RoleAction.lua
| @@ -1240,6 +1240,12 @@ function _M.chatRpc(agent, data) | @@ -1240,6 +1240,12 @@ function _M.chatRpc(agent, data) | ||
| 1240 | return | 1240 | return |
| 1241 | end | 1241 | end |
| 1242 | 1242 | ||
| 1243 | + local dailyChatTimes = role.dailyData:getProperty("chatTimes") | ||
| 1244 | + if dailyChatTimes > (globalCsv.chat_world_day_limit or 15) then | ||
| 1245 | + result = 4 | ||
| 1246 | + return | ||
| 1247 | + end | ||
| 1248 | + | ||
| 1243 | role._worldChatLimit = role._worldChatLimit or {start = 0, count = 0, canSayt = 0} --第一次开始说话时间 从第一次说话次数 能说话的时间 | 1249 | role._worldChatLimit = role._worldChatLimit or {start = 0, count = 0, canSayt = 0} --第一次开始说话时间 从第一次说话次数 能说话的时间 |
| 1244 | 1250 | ||
| 1245 | if now < role._worldChatLimit.canSayt then | 1251 | if now < role._worldChatLimit.canSayt then |
| @@ -1268,6 +1274,8 @@ function _M.chatRpc(agent, data) | @@ -1268,6 +1274,8 @@ function _M.chatRpc(agent, data) | ||
| 1268 | else | 1274 | else |
| 1269 | mcast_util.pub_world(actionCodes.Role_chat, MsgPack.pack(response)) | 1275 | mcast_util.pub_world(actionCodes.Role_chat, MsgPack.pack(response)) |
| 1270 | end | 1276 | end |
| 1277 | + dailyChatTimes = dailyChatTimes + 1 | ||
| 1278 | + role.dailyData:updateProperty({field="chatTimes", value=dailyChatTimes}) | ||
| 1271 | -- pcall(skynet.send, '.globald', "lua", "sendWorldMsg", role._channelIdx, response) | 1279 | -- pcall(skynet.send, '.globald', "lua", "sendWorldMsg", role._channelIdx, response) |
| 1272 | role:mylog("role_action", {desc = "chatWorld", text1 = content}) | 1280 | role:mylog("role_action", {desc = "chatWorld", text1 = content}) |
| 1273 | end, | 1281 | end, |
| @@ -1355,53 +1363,23 @@ end | @@ -1355,53 +1363,23 @@ end | ||
| 1355 | 1363 | ||
| 1356 | function _M.drawCodeRpc(agent, data) | 1364 | function _M.drawCodeRpc(agent, data) |
| 1357 | local msg = MsgPack.unpack(data) | 1365 | local msg = MsgPack.unpack(data) |
| 1358 | - local codeurl = skynet.getenv("codeurl") | ||
| 1359 | local role = agent.role | 1366 | local role = agent.role |
| 1360 | - local msg = MsgPack.unpack(data) | ||
| 1361 | local code = msg.code | 1367 | local code = msg.code |
| 1362 | 1368 | ||
| 1363 | - if type(code) ~= "string" then return end | ||
| 1364 | - if code:find("[^0-9a-zA-Z]") then return end | 1369 | + if type(code) ~= "string" then return 1 end |
| 1370 | + if code:find("[^0-9a-zA-Z]") then return 2 end | ||
| 1365 | 1371 | ||
| 1366 | - local codestr = role:getProperty("codeStr") | ||
| 1367 | - local content = { | ||
| 1368 | - ["platformId"] = role:getProperty("sid"), | ||
| 1369 | - ["code"] = code, | ||
| 1370 | - ["itemIds"] = codestr, | ||
| 1371 | - ["key"] = "zhaolugame20170831", | ||
| 1372 | - } | ||
| 1373 | - local status, body = httpc.get(codeurl, "/libaoma?" .. httpGetFormatData(content), {}) | ||
| 1374 | - if status == 200 then | ||
| 1375 | - local result = json.decode(body) | ||
| 1376 | - local ret = tonum(result.ret) | ||
| 1377 | - if ret == 0 then | ||
| 1378 | - local giftId = tonumber(result.giftId) | ||
| 1379 | - role:setProperty("codeStr", codestr:setv(giftId, 1)) | ||
| 1380 | - local reward, change = role:award(result.gift, {log = {desc = "drawCode", int1 = giftId}}) | ||
| 1381 | - | ||
| 1382 | - role:log("get_gift", { | ||
| 1383 | - gift_id = giftId, -- 礼包ID | ||
| 1384 | - gift_key = code, -- 礼包key | ||
| 1385 | - gift_reward = reward, -- 礼包奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | ||
| 1386 | - gift_name = "", -- 礼包名称 | ||
| 1387 | - gift_reason = 0, -- 礼包发放原因,见发放原因枚举表 | ||
| 1388 | - }) | ||
| 1389 | - role:mylog("role_action", {desc = "drawCode", int1 = giftId, key1 = code, key2 = role:getRewardLogStr(result.gift)}) | ||
| 1390 | - SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({ | ||
| 1391 | - result = ret, | ||
| 1392 | - reward = reward, | ||
| 1393 | - change = change, | ||
| 1394 | - })) | ||
| 1395 | - return true | ||
| 1396 | - end | ||
| 1397 | - -- 1 不存在的礼包码 | ||
| 1398 | - -- 2 已经领取过相同类型物品 | ||
| 1399 | - -- 3 领取数量达到上限 | ||
| 1400 | - -- 4 过期了 | ||
| 1401 | - SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({result = ret})) | ||
| 1402 | - return true | 1372 | + local ret, reward, change= role:getCodeGift(code) |
| 1373 | + if ret == 0 then | ||
| 1374 | + SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({ | ||
| 1375 | + result = ret, | ||
| 1376 | + reward = reward, | ||
| 1377 | + change = change, | ||
| 1378 | + })) | ||
| 1379 | + return true | ||
| 1403 | end | 1380 | end |
| 1404 | - SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({result = -1})) | 1381 | + |
| 1382 | + SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({result = ret})) | ||
| 1405 | return true | 1383 | return true |
| 1406 | end | 1384 | end |
| 1407 | 1385 |
src/models/Daily.lua
| @@ -17,7 +17,7 @@ Daily.schema = { | @@ -17,7 +17,7 @@ Daily.schema = { | ||
| 17 | advBC = {"number", 0}, -- 冒险次数购买次数(冒险体力购买次数) | 17 | advBC = {"number", 0}, -- 冒险次数购买次数(冒险体力购买次数) |
| 18 | advElBC = {"number", 0}, -- 无尽次数购买次数(冒险体力购买次数) | 18 | advElBC = {"number", 0}, -- 无尽次数购买次数(冒险体力购买次数) |
| 19 | advWs = {"table", {}}, -- 冒险队工坊 | 19 | advWs = {"table", {}}, -- 冒险队工坊 |
| 20 | - bonusC = {"table", {}}, -- 奖励副本 次数 {[type] = {c = 0, b = 0}} | 20 | + bonusC = {"table", {}}, -- 奖励副本 次数 {[type] = {c = 0, b = 0}} 修改为 {c=0, b=0} |
| 21 | giveFP = {"table", {}}, -- 给谁送过心心 | 21 | giveFP = {"table", {}}, -- 给谁送过心心 |
| 22 | getFP = {"table", {}}, -- 领过谁的心心 | 22 | getFP = {"table", {}}, -- 领过谁的心心 |
| 23 | pvpFree = {"number", 0}, -- pvp使用免费次数 | 23 | pvpFree = {"number", 0}, -- pvp使用免费次数 |
| @@ -36,6 +36,8 @@ Daily.schema = { | @@ -36,6 +36,8 @@ Daily.schema = { | ||
| 36 | 36 | ||
| 37 | treasureBase = {"number", 0}, -- 资源值 | 37 | treasureBase = {"number", 0}, -- 资源值 |
| 38 | treasureList = {"table", {}}, --挂机图鉴 | 38 | treasureList = {"table", {}}, --挂机图鉴 |
| 39 | + | ||
| 40 | + chatTimes = {"number", 0}, --每日发言次数 | ||
| 39 | } | 41 | } |
| 40 | 42 | ||
| 41 | function Daily:updateProperty(params) | 43 | function Daily:updateProperty(params) |
| @@ -415,6 +417,7 @@ function Daily:data() | @@ -415,6 +417,7 @@ function Daily:data() | ||
| 415 | curPool = self:getProperty("curPool"), | 417 | curPool = self:getProperty("curPool"), |
| 416 | treasureBase = self:getProperty("treasureBase"), | 418 | treasureBase = self:getProperty("treasureBase"), |
| 417 | treasureList = self:getProperty("treasureList"), | 419 | treasureList = self:getProperty("treasureList"), |
| 420 | + chatTimes = self:getProperty("chatTimes"), | ||
| 418 | } | 421 | } |
| 419 | end | 422 | end |
| 420 | 423 |
src/models/RolePlugin.lua
| @@ -3303,6 +3303,43 @@ function RolePlugin.bind(Role) | @@ -3303,6 +3303,43 @@ function RolePlugin.bind(Role) | ||
| 3303 | end | 3303 | end |
| 3304 | self:updateProperty({field = "worldChangePoints", value = worldChangePoints}) | 3304 | self:updateProperty({field = "worldChangePoints", value = worldChangePoints}) |
| 3305 | end | 3305 | end |
| 3306 | + | ||
| 3307 | + function Role:getCodeGift(code) | ||
| 3308 | + local codeurl = skynet.getenv("codeurl") | ||
| 3309 | + local codestr = self:getProperty("codeStr") | ||
| 3310 | + local content = { | ||
| 3311 | + ["platformId"] = self:getProperty("sid"), | ||
| 3312 | + ["code"] = code, | ||
| 3313 | + ["itemIds"] = codestr, | ||
| 3314 | + ["key"] = "zhaolugame20170831", | ||
| 3315 | + } | ||
| 3316 | + local status, body = httpc.get(codeurl, "/libaoma?" .. httpGetFormatData(content), {}) | ||
| 3317 | + if status == 200 then | ||
| 3318 | + local result = json.decode(body) | ||
| 3319 | + local ret = tonum(result.ret) | ||
| 3320 | + if ret == 0 then | ||
| 3321 | + local giftId = tonumber(result.giftId) | ||
| 3322 | + self:setProperty("codeStr", codestr:setv(giftId, 1)) | ||
| 3323 | + local reward, change = self:award(result.gift, {log = {desc = "drawCode", int1 = giftId}}) | ||
| 3324 | + | ||
| 3325 | + self:log("get_gift", { | ||
| 3326 | + gift_id = giftId, -- 礼包ID | ||
| 3327 | + gift_key = code, -- 礼包key | ||
| 3328 | + gift_reward = reward, -- 礼包奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | ||
| 3329 | + gift_name = "", -- 礼包名称 | ||
| 3330 | + gift_reason = 0, -- 礼包发放原因,见发放原因枚举表 | ||
| 3331 | + }) | ||
| 3332 | + self:mylog("role_action", {desc = "drawCode", int1 = giftId, key1 = code, key2 = self:getRewardLogStr(result.gift)}) | ||
| 3333 | + return ret, result, reward, change | ||
| 3334 | + end | ||
| 3335 | + -- 1 不存在的礼包码 | ||
| 3336 | + -- 2 已经领取过相同类型物品 | ||
| 3337 | + -- 3 领取数量达到上限 | ||
| 3338 | + -- 4 过期了 | ||
| 3339 | + return ret | ||
| 3340 | + end | ||
| 3341 | + return -1 | ||
| 3342 | + end | ||
| 3306 | end | 3343 | end |
| 3307 | 3344 | ||
| 3308 | return RolePlugin | 3345 | return RolePlugin |
| 3309 | \ No newline at end of file | 3346 | \ No newline at end of file |