Commit c59e058bb64a46564c1df6deefc4a98f7906efe7
1 parent
a3e69a31
新一批日志记录
Showing
11 changed files
with
418 additions
and
595 deletions
Show diff stats
src/actions/ActivityAction.lua
| ... | ... | @@ -65,7 +65,11 @@ function _M.sudokuRpc(agent, data) |
| 65 | 65 | |
| 66 | 66 | role:updateProperty({field = "sudoku", value = sudoku}) |
| 67 | 67 | |
| 68 | - role:log("act_action", {desc = "sudoku", int1 = id, int2 = phase}) | |
| 68 | + role:log("activity", { | |
| 69 | + activity_id = id, -- 活动ID(或活动指定任务的ID) | |
| 70 | + activity_type = 0, -- 活动类型,见活动类型枚举表 | |
| 71 | + activity_reward = json.encode(reward), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
| 72 | + }) | |
| 69 | 73 | |
| 70 | 74 | SendPacket(actionCodes.Activity_sudokuRpc, MsgPack.pack({task = role:packReward(task, tchange), reward = role:packReward(reward, rchange), rId = rId})) |
| 71 | 75 | return true |
| ... | ... | @@ -100,6 +104,12 @@ function _M.sudokuRewardRpc(agent, data) |
| 100 | 104 | end |
| 101 | 105 | role:updateProperty({field = "sudoku", value = sudoku}) |
| 102 | 106 | |
| 107 | + role:log("activity", { | |
| 108 | + activity_id = 10000 + phase, -- 活动ID(或活动指定任务的ID) | |
| 109 | + activity_type = 0, -- 活动类型,见活动类型枚举表 | |
| 110 | + activity_reward = json.encode(reward), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
| 111 | + }) | |
| 112 | + | |
| 103 | 113 | SendPacket(actionCodes.Activity_sudokuRewardRpc, MsgPack.pack(role:packReward(reward, change))) |
| 104 | 114 | return true |
| 105 | 115 | end |
| ... | ... | @@ -156,6 +166,13 @@ function _M.actSignRpc(agent, data) |
| 156 | 166 | role.activity:updateActData("Sign", curData) |
| 157 | 167 | reward, change = role:award(reward, {log = {desc = "actSign"}}) |
| 158 | 168 | end |
| 169 | + | |
| 170 | + role:log("activity", { | |
| 171 | + activity_id = curData[0], -- 活动ID(或活动指定任务的ID) | |
| 172 | + activity_type = role.activity.ActivityType.Sign, -- 活动类型,见活动类型枚举表 | |
| 173 | + activity_reward = json.encode(reward), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
| 174 | + }) | |
| 175 | + | |
| 159 | 176 | SendPacket(actionCodes.Activity_actSignRpc, MsgPack.pack(role:packReward(reward, change))) |
| 160 | 177 | return true |
| 161 | 178 | end | ... | ... |
src/actions/CarAction.lua
| ... | ... | @@ -41,6 +41,13 @@ function _M.makePotionRpc( agent, data ) |
| 41 | 41 | role:checkTaskEnter("PotionMake", {count = count, id = potionId}) |
| 42 | 42 | |
| 43 | 43 | role:log("role_action", {desc = "makePotion", int1 = potionId, int2 = count}) |
| 44 | + role:log("carriage_cook", { | |
| 45 | + item_id = potionId, -- 道具id | |
| 46 | + item_level = potionLv, -- 道具等级 | |
| 47 | + item_type = 0, -- 道具类型,具体见枚举表中道具类型枚举表 | |
| 48 | + carriage_cook_amount = count, -- 制作总量 | |
| 49 | + carriage_cook_cost = json.encode(cost), -- 制作消耗道具,json格式记录,{'itemid1':10,'itemid2':5,…………..} | |
| 50 | + }) | |
| 44 | 51 | SendPacket(actionCodes.Car_makePotionRpc, MsgPack.pack({potionBag = potionBag})) |
| 45 | 52 | return true |
| 46 | 53 | end |
| ... | ... | @@ -91,7 +98,14 @@ function _M.equipUpRpc( agent, data ) |
| 91 | 98 | role:addEquip(typ, nextLv ,count, {log = {desc = "equipUp"}}) |
| 92 | 99 | role:checkTaskEnter("EquipUp", {count = count}) |
| 93 | 100 | |
| 94 | - role:log("role_action", {desc = "equipUp", int1 = id, int2 = count}) | |
| 101 | + role:log("equip_upgrade", { | |
| 102 | + equip_upgrade_part = typ, -- 升级部位,记录部位ID | |
| 103 | + equip_id = nextLv, -- 升级后的装备ID | |
| 104 | + equip_upgrade_amount = count, -- 升级获取的装备数量 | |
| 105 | + equip_upgrade_usedid = lv, -- 升级消耗的装备ID | |
| 106 | + equip_upgrade_cost = costCount, -- 升级操作消耗装备数量 | |
| 107 | + equip_upgrade_current = json.encode(cost), -- 升级消耗的货币类型 | |
| 108 | + }) | |
| 95 | 109 | |
| 96 | 110 | SendPacket(actionCodes.Car_equipUpRpc, '') |
| 97 | 111 | return true | ... | ... |
src/actions/DinerAction.lua
| ... | ... | @@ -140,7 +140,7 @@ function _M.removeSellRpc( agent, data ) |
| 140 | 140 | return 5 |
| 141 | 141 | end |
| 142 | 142 | |
| 143 | - role.dinerData:updateSell(slot) | |
| 143 | + local temp = role.dinerData:updateSell(slot) | |
| 144 | 144 | local reward, change = {} |
| 145 | 145 | local cost = dishData.material:toNumMap() |
| 146 | 146 | for k, n in pairs(cost) do |
| ... | ... | @@ -150,7 +150,14 @@ function _M.removeSellRpc( agent, data ) |
| 150 | 150 | reward, change = role:award(reward, {log = {desc = "removeSell"}}) |
| 151 | 151 | sells[slot].count = 0 |
| 152 | 152 | |
| 153 | - role:log("diner_action", {desc = "removeSell", int1 = dish}) | |
| 153 | + role:log("restaurant_sale", { | |
| 154 | + item_id = dish, -- 售卖物品ID | |
| 155 | + restaurant_sale_seat = slot, -- 售卖物品所在位置 | |
| 156 | + restaurant_sale_time = temp.deltaTime or 0, -- 售卖时长 | |
| 157 | + restaurant_sale_type = 2, -- 售卖方式,正常售卖:0, 加速:1,移除售卖:2 | |
| 158 | + restaurant_sale_coin = reward[ItemId.DinerCoin] or 0, -- 售卖获得美食币 | |
| 159 | + restaurant_sale_gear = reward[ItemId.Gold] or 0, -- 售卖获得齿轮 | |
| 160 | + }) | |
| 154 | 161 | |
| 155 | 162 | role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) |
| 156 | 163 | SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward, change = change})) |
| ... | ... | @@ -162,8 +169,11 @@ function _M.getSellRewardRpc( agent, data ) |
| 162 | 169 | local dirty = false |
| 163 | 170 | local reward, popular = "", 0 |
| 164 | 171 | local sells = json.decode(role.dinerData:getProperty("sells")) |
| 172 | + | |
| 173 | + local deltaTimes = {} | |
| 165 | 174 | for slot, _ in pairs(sells) do |
| 166 | - role.dinerData:updateSell(slot) | |
| 175 | + local temp = role.dinerData:updateSell(slot) | |
| 176 | + deltaTimes[slot] = temp.deltaTime | |
| 167 | 177 | end |
| 168 | 178 | sells = json.decode(role.dinerData:getProperty("sells")) |
| 169 | 179 | for slot, sell in pairs(sells) do |
| ... | ... | @@ -187,6 +197,15 @@ function _M.getSellRewardRpc( agent, data ) |
| 187 | 197 | end |
| 188 | 198 | sells[slot].reward = "" |
| 189 | 199 | sells[slot].popular = 0 |
| 200 | + | |
| 201 | + role:log("restaurant_sale", { | |
| 202 | + item_id = sell.dish, -- 售卖物品ID | |
| 203 | + restaurant_sale_seat = slot, -- 售卖物品所在位置 | |
| 204 | + restaurant_sale_time = deltaTimes[slot] or 0, -- 售卖时长 | |
| 205 | + restaurant_sale_type = 0, -- 售卖方式,正常售卖:0, 加速:1,移除售卖:2 | |
| 206 | + restaurant_sale_coin = rewards[ItemId.DinerCoin] or 0, -- 售卖获得美食币 | |
| 207 | + restaurant_sale_gear = rewards[ItemId.Gold] or 0, -- 售卖获得齿轮 | |
| 208 | + }) | |
| 190 | 209 | end |
| 191 | 210 | role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) |
| 192 | 211 | local gift = reward:toNumMap() |
| ... | ... | @@ -204,7 +223,7 @@ function _M.getSellRewardRpc( agent, data ) |
| 204 | 223 | role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) |
| 205 | 224 | end |
| 206 | 225 | |
| 207 | - role:log("diner_action", {desc = "sell"}) | |
| 226 | + | |
| 208 | 227 | |
| 209 | 228 | SendPacket(actionCodes.Diner_getSellRewardRpc, MsgPack.pack({reward = reward, change = change})) |
| 210 | 229 | return true |
| ... | ... | @@ -254,6 +273,15 @@ function _M.expediteSellRpc( agent, data ) |
| 254 | 273 | dirty = true |
| 255 | 274 | end |
| 256 | 275 | end |
| 276 | + | |
| 277 | + role:log("restaurant_sale", { | |
| 278 | + item_id = sell.dish, -- 售卖物品ID | |
| 279 | + restaurant_sale_seat = slot, -- 售卖物品所在位置 | |
| 280 | + restaurant_sale_time = result.deltaTime or 0, -- 售卖时长 | |
| 281 | + restaurant_sale_type = 1, -- 售卖方式,正常售卖:0, 加速:1,移除售卖:2 | |
| 282 | + restaurant_sale_coin = rewards[ItemId.DinerCoin] or 0, -- 售卖获得美食币 | |
| 283 | + restaurant_sale_gear = rewards[ItemId.Gold] or 0, -- 售卖获得齿轮 | |
| 284 | + }) | |
| 257 | 285 | end |
| 258 | 286 | end |
| 259 | 287 | |
| ... | ... | @@ -325,7 +353,13 @@ function _M.levelUpRpc( agent, data ) |
| 325 | 353 | role.dinerData:updateProperty({field = "buildL", value = buildL:setv(index, curLevel + 1)}) |
| 326 | 354 | role:checkTaskEnter("DinerLevelUp", {type = index, level = curLevel + 1}) |
| 327 | 355 | |
| 328 | - role:log("diner_action", {desc = "buildUp", int1 = index, int2 = curLevel + 1}) | |
| 356 | + role:log("restaurant_up", { | |
| 357 | + restaurant_up_type = index - 1, --升级部件类型,店面:0, 接客:1, 满意度:2, 宣传:3, 广告:4, 周边:5 | |
| 358 | + restaurant_up_gear = cost[ItemId.Gold] or 0, --消耗齿轮数量 | |
| 359 | + restaurant_up_coin = cost[ItemId.DinerCoin] or 0, --花费美食币数量 | |
| 360 | + restaurant_up_effectbef = curLevel, --升级前加成 | |
| 361 | + restaurant_up_effect = curLevel + 1, --升级后加成 | |
| 362 | + }) | |
| 329 | 363 | |
| 330 | 364 | SendPacket(actionCodes.Diner_levelUpRpc, '') |
| 331 | 365 | return true |
| ... | ... | @@ -409,7 +443,13 @@ function _M.talentUpRpc( agent, data ) |
| 409 | 443 | role:checkTaskEnter("DinerTalentUp", {type = talentData.effect:toArray(true,"=")[1], level = dishLevel + 1}) |
| 410 | 444 | role:finishGuide(27) |
| 411 | 445 | role:log("diner_action", {desc = "talentUp", int1 = dish, int2 = dishLevel + 1}) |
| 412 | - | |
| 446 | + role:log("carriage_logistics", { | |
| 447 | + carriage_logistics_type = typ, -- 后勤室制作类型ID,变异:0,通常:1,魔法:2 | |
| 448 | + carriage_logistics_itemid = dish, -- 后勤室升级物品或技能ID | |
| 449 | + carriage_logistics_itemlv = dishLevel + 1, -- 升级后物品或技能等级 | |
| 450 | + carriage_logistics_gear = cost[ItemId.Gold] or 0, -- 后勤室升级花费齿轮数量 | |
| 451 | + carriage_logistics_coin = cost[ItemId.DinerCoin] or 0, -- 后勤室升级花费美食币数量 | |
| 452 | + }) | |
| 413 | 453 | SendPacket(actionCodes.Diner_talentUpRpc, '') |
| 414 | 454 | return true |
| 415 | 455 | end |
| ... | ... | @@ -509,8 +549,6 @@ function _M.updateTaskRpc( agent, data ) |
| 509 | 549 | orders[index].status = 1 |
| 510 | 550 | orders[index].lock = 1 |
| 511 | 551 | |
| 512 | - role:log("diner_action", {desc = "getTask", int1 = order.id}) | |
| 513 | - | |
| 514 | 552 | role:checkTaskEnter("GetOderTask", {rarity = taskSet.rarity}) |
| 515 | 553 | elseif cmd == 1 then |
| 516 | 554 | if order.status ~= 1 then |
| ... | ... | @@ -519,8 +557,6 @@ function _M.updateTaskRpc( agent, data ) |
| 519 | 557 | orders[index].status = 0 |
| 520 | 558 | orders[index].lock = 0 |
| 521 | 559 | |
| 522 | - role:log("diner_action", {desc = "deleteTask", int1 = order.id}) | |
| 523 | - | |
| 524 | 560 | elseif cmd == 2 then |
| 525 | 561 | if order.status ~= 1 then |
| 526 | 562 | return 32 |
| ... | ... | @@ -528,7 +564,6 @@ function _M.updateTaskRpc( agent, data ) |
| 528 | 564 | if order.n < taskData.value then |
| 529 | 565 | return 6 |
| 530 | 566 | end |
| 531 | - role:log("diner_action", {desc = "finishTask", int1 = order.id}) | |
| 532 | 567 | |
| 533 | 568 | reward, change = role:award(taskData.reward, {log = {desc = "dinerFinishTask", int1 = order.id}}) |
| 534 | 569 | table.remove(orders,index) |
| ... | ... | @@ -537,6 +572,14 @@ function _M.updateTaskRpc( agent, data ) |
| 537 | 572 | return 33 |
| 538 | 573 | end |
| 539 | 574 | |
| 575 | + | |
| 576 | + role:log("restaurant_order", { | |
| 577 | + restaurant_order_id = order.id, -- 订单任务ID | |
| 578 | + restaurant_order_status = cmd, -- 订单任务状态,接受:0, 拒绝:1, 完成:2 | |
| 579 | + restaurant_order_rwd = json.encode(reward), -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | |
| 580 | + restaurant_order_lv = taskSet.rarity, -- 订单品质等级,普通:0, 稀有:1, 顶级:2, 豪华:3 | |
| 581 | + }) | |
| 582 | + | |
| 540 | 583 | role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) |
| 541 | 584 | SendPacket(actionCodes.Diner_updateTaskRpc, MsgPack.pack({reward = reward, change = change})) |
| 542 | 585 | return true |
| ... | ... | @@ -687,12 +730,19 @@ function _M.getGreenhouseRpc( agent, data ) |
| 687 | 730 | else |
| 688 | 731 | gfood[k].st = st + speed * reward[itemId] |
| 689 | 732 | end |
| 733 | + | |
| 734 | + role:log("restaurant_material", { | |
| 735 | + item_id = itemId, -- 获取物品ID | |
| 736 | + restaurant_material_start = st, -- 申请获取时间 | |
| 737 | + restaurant_material_time = endTime2 - st, -- 申请到领取耗时 | |
| 738 | + restaurant_material_num = reward[itemId], -- 获取物品数量 | |
| 739 | + }) | |
| 740 | + | |
| 690 | 741 | end |
| 691 | 742 | role.dinerData:updateProperty({field = "gfood", value = gfood}) |
| 692 | 743 | local reward, change = role:award(reward, {log = {desc = "greenHourse", int1 = level}}) |
| 693 | 744 | role:checkTaskEnter("FoodMGet") |
| 694 | 745 | |
| 695 | - role:log("diner_action", {desc = "greenHourse"}) | |
| 696 | 746 | |
| 697 | 747 | SendPacket(actionCodes.Diner_getGreenhouseRpc, MsgPack.pack({reward = reward, change = change})) |
| 698 | 748 | return true |
| ... | ... | @@ -858,7 +908,17 @@ function _M.collectRpc(agent , data) |
| 858 | 908 | local reward, change = role:award(customerData.reward, {log = {desc = "dinerCollect", int1 = id}}) |
| 859 | 909 | customer[id] = 1 |
| 860 | 910 | role.dinerData:updateProperty({field = "customer", value = customer}) -- 解锁了 |
| 861 | - role:log("diner_action", {desc = "collect", int1 = id}) | |
| 911 | + | |
| 912 | + local count = 0 | |
| 913 | + for c_, v in pairs(customer) do | |
| 914 | + count = count + 1 | |
| 915 | + end | |
| 916 | + | |
| 917 | + role:log("restaurant_collect", { | |
| 918 | + restaurant_collect_id = id, -- 图谱收集ID | |
| 919 | + restaurant_collect_rwd = json.encode(reward), -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | |
| 920 | + restaurant_collect_plan = count, -- 收集进度,即解锁顾客,数字表示 | |
| 921 | + }) | |
| 862 | 922 | |
| 863 | 923 | SendPacket(actionCodes.Diner_collectRpc, MsgPack.pack({reward = reward, change = change})) |
| 864 | 924 | return true | ... | ... |
src/actions/FriendAction.lua
| ... | ... | @@ -217,6 +217,7 @@ local function checkHandleApply(roleId, objectId, needAddNew) |
| 217 | 217 | red:sismember(FRIEND_BLACK_KEY:format(objectId), roleId) |
| 218 | 218 | red:sismember(FRIEND_BLACK_KEY:format(roleId), objectId) |
| 219 | 219 | end) |
| 220 | + | |
| 220 | 221 | --自己好友满了 |
| 221 | 222 | if (redret[1] + needAddNew) >= globalCsv.friendListLimit then |
| 222 | 223 | return 1 |
| ... | ... | @@ -233,6 +234,8 @@ local function checkHandleApply(roleId, objectId, needAddNew) |
| 233 | 234 | if redret[4] == 1 then |
| 234 | 235 | return 4 |
| 235 | 236 | end |
| 237 | + | |
| 238 | + return nil, redret[1] | |
| 236 | 239 | end |
| 237 | 240 | |
| 238 | 241 | function _M.handleApplyRpc(agent, data) |
| ... | ... | @@ -251,7 +254,8 @@ function _M.handleApplyRpc(agent, data) |
| 251 | 254 | if not redisproxy:zscore(FRIEND_APPLY_KEY:format(roleId), objectId) then |
| 252 | 255 | return |
| 253 | 256 | end |
| 254 | - result = checkHandleApply(roleId, objectId) | |
| 257 | + local curCount | |
| 258 | + result, curCount = checkHandleApply(roleId, objectId) | |
| 255 | 259 | |
| 256 | 260 | if not result then |
| 257 | 261 | redisproxy:pipelining(function (red) |
| ... | ... | @@ -277,8 +281,11 @@ function _M.handleApplyRpc(agent, data) |
| 277 | 281 | otherInfo.pGet = redret[2] == 1 and 1 or nil |
| 278 | 282 | SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {otherInfo}})) |
| 279 | 283 | |
| 280 | - role:log("role_action", {desc = "addFriend", int1 = 1}) | |
| 281 | - | |
| 284 | + role:log("friend_opt", { | |
| 285 | + friend_opt_type = 100, -- 好友操作类型,见枚举表中 好友操作类型枚举表 | |
| 286 | + friend_roleid = objectId, -- 好友账户下的角色id | |
| 287 | + friend_cnt = curCount + 1, -- 操作后好友数量 | |
| 288 | + }) | |
| 282 | 289 | end |
| 283 | 290 | |
| 284 | 291 | elseif cmd == 0 then -- 不同意 |
| ... | ... | @@ -301,7 +308,7 @@ function _M.handleApplyRpc(agent, data) |
| 301 | 308 | local needAddInfo = {} |
| 302 | 309 | for _, objId in ipairs(allIds) do |
| 303 | 310 | objId = tonumber(objId) |
| 304 | - local cr = checkHandleApply(roleId, objId, #needAdd) | |
| 311 | + local cr, curCount = checkHandleApply(roleId, objId, #needAdd) | |
| 305 | 312 | if not cr then |
| 306 | 313 | table.insert(needAdd, objId) |
| 307 | 314 | table.insert(needAddMy, objId) |
| ... | ... | @@ -312,6 +319,12 @@ function _M.handleApplyRpc(agent, data) |
| 312 | 319 | otherInfo.isFriend = true |
| 313 | 320 | otherInfo.pGet = fpoint[objId] and 1 or nil |
| 314 | 321 | table.insert(needAddInfo, otherInfo) |
| 322 | + | |
| 323 | + role:log("friend_opt", { | |
| 324 | + friend_opt_type = 100, -- 好友操作类型,见枚举表中 好友操作类型枚举表 | |
| 325 | + friend_roleid = objId, -- 好友账户下的角色id | |
| 326 | + friend_cnt = curCount + 1, -- 操作后好友数量 | |
| 327 | + }) | |
| 315 | 328 | end |
| 316 | 329 | end |
| 317 | 330 | |
| ... | ... | @@ -420,6 +433,11 @@ function _M.deleteRpc(agent, data) |
| 420 | 433 | end |
| 421 | 434 | rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({deleteFriend = 1, roleId = roleId})) |
| 422 | 435 | |
| 436 | + role:log("friend_opt", { | |
| 437 | + friend_opt_type = 200, -- 好友操作类型,见枚举表中 好友操作类型枚举表 | |
| 438 | + friend_roleid = objectId, -- 好友账户下的角色id | |
| 439 | + friend_cnt = 0, -- 操作后好友数量 | |
| 440 | + }) | |
| 423 | 441 | SendPacket(actionCodes.Friend_deleteRpc, MsgPack.pack("")) |
| 424 | 442 | return true |
| 425 | 443 | end |
| ... | ... | @@ -449,15 +467,18 @@ function _M.blockRpc(agent, data) |
| 449 | 467 | red:ZREM(FRIEND_APPLY_KEY:format(objectId), roleId) |
| 450 | 468 | red:sadd(FRIEND_BLACK_KEY:format(roleId), objectId) |
| 451 | 469 | end) |
| 452 | - rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({deleteFriend = 1, roleId = roleId})) | |
| 453 | - | |
| 470 | + rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({deleteFriend = 1, roleId = roleId})) | |
| 471 | + role:log("friend_opt", { | |
| 472 | + friend_opt_type = 300, -- 好友操作类型,见枚举表中 好友操作类型枚举表 | |
| 473 | + friend_roleid = objectId, -- 好友账户下的角色id | |
| 474 | + friend_cnt = 0, -- 操作后好友数量 | |
| 475 | + }) | |
| 454 | 476 | end |
| 455 | 477 | elseif cmd == 2 then |
| 456 | 478 | redisproxy:SREM(FRIEND_BLACK_KEY:format(roleId), objectId) |
| 457 | 479 | else |
| 458 | 480 | return |
| 459 | 481 | end |
| 460 | - | |
| 461 | 482 | SendPacket(actionCodes.Friend_blockRpc, MsgPack.pack({result = result})) |
| 462 | 483 | return true |
| 463 | 484 | end | ... | ... |
src/actions/HeroAction.lua
| ... | ... | @@ -16,6 +16,18 @@ local table_unpack = table.unpack |
| 16 | 16 | |
| 17 | 17 | local _M = {} |
| 18 | 18 | |
| 19 | +local function getChangeAttrJson(oldAttr, newAttr) | |
| 20 | + local change = {} | |
| 21 | + for k, v in pairs(newAttr) do | |
| 22 | + change[k] = v - oldAttr[k] | |
| 23 | + change[k] = math.ceil(change[k]) | |
| 24 | + if change[k] == 0 then | |
| 25 | + change[k] = nil | |
| 26 | + end | |
| 27 | + end | |
| 28 | + return json.encode(change) | |
| 29 | +end | |
| 30 | + | |
| 19 | 31 | function _M.levelUpRpc( agent, data ) |
| 20 | 32 | local role = agent.role |
| 21 | 33 | local msg = MsgPack.unpack(data) |
| ... | ... | @@ -28,9 +40,19 @@ function _M.levelUpRpc( agent, data ) |
| 28 | 40 | local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold} |
| 29 | 41 | if not role:checkItemEnough(cost) then return 3 end |
| 30 | 42 | role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}}) |
| 43 | + | |
| 44 | + local oldAttr = hero:getTotalAttrs() | |
| 45 | + local oldBattleV = hero:getProperty("battleV") | |
| 31 | 46 | hero:updateProperty({field = "level", delta = 1}) |
| 32 | 47 | |
| 33 | - hero:log({desc = "levelUp", int1 = hero:getProperty("level")}) | |
| 48 | + role:log("hero_upgrade", { | |
| 49 | + hero_id = hero:getProperty("type"), --英雄ID | |
| 50 | + hero_upgrade_cost = json.encode(cost), -- 英雄升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} | |
| 51 | + hero_upgrade_result = getChangeAttrJson(oldAttr, hero:getTotalAttrs()), -- 英雄升级效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} | |
| 52 | + hero_upgrade_type = 0, -- 英雄升级方式,连续升级:1,单击升级:0 | |
| 53 | + hero_upgrade_score = hero:getProperty("battleV"), -- 英雄升级后评分 | |
| 54 | + hero_upgrade_scoreget = hero:getProperty("battleV") - oldBattleV, -- 通过英雄升级提升的评分 | |
| 55 | + }) | |
| 34 | 56 | |
| 35 | 57 | if hero:getProperty("type") == 103 then |
| 36 | 58 | role:finishGuide(7) |
| ... | ... | @@ -53,9 +75,15 @@ function _M.breakRpc( agent, data ) |
| 53 | 75 | local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold} |
| 54 | 76 | if not role:checkItemEnough(cost) then return 4 end |
| 55 | 77 | role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) |
| 78 | + local oldAttr = hero:getTotalAttrs() | |
| 56 | 79 | hero:updateProperty({field = "breakL", delta = 1}) |
| 57 | 80 | |
| 58 | - hero:log({desc = "break", int1 = hero:getProperty("breakL")}) | |
| 81 | + role:log("hero_break", { | |
| 82 | + hero_id = hero:getProperty("type"), --英雄ID | |
| 83 | + hero_break_cost = json.encode(cost), -- 英雄突破消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} | |
| 84 | + hero_break_result = getChangeAttrJson(oldAttr, hero:getTotalAttrs()), -- 英雄突破效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} | |
| 85 | + hero_break_level = hero:getMaxLevel(), -- 英雄突破后等级上限 | |
| 86 | + }) | |
| 59 | 87 | |
| 60 | 88 | SendPacket(actionCodes.Hero_breakRpc, '') |
| 61 | 89 | return true |
| ... | ... | @@ -78,6 +106,7 @@ function _M.wakeRpc(agent, data) |
| 78 | 106 | |
| 79 | 107 | role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}}) |
| 80 | 108 | |
| 109 | + local oldAttr = hero:getTotalAttrs() | |
| 81 | 110 | hero:updateProperty({field = "wakeL", delta = 1}) |
| 82 | 111 | |
| 83 | 112 | local curLevel = hero:getProperty("wakeL") |
| ... | ... | @@ -85,9 +114,14 @@ function _M.wakeRpc(agent, data) |
| 85 | 114 | if curLevel == 4 then -- 解锁cg |
| 86 | 115 | role:checkTaskEnter("WakeCG", {heroType = typ}) |
| 87 | 116 | end |
| 88 | - hero:log({desc = "wake", int1 = hero:getProperty("wakeL")}) | |
| 89 | 117 | |
| 90 | - | |
| 118 | + role:log("hero_rise", { | |
| 119 | + hero_id = typ, --英雄ID | |
| 120 | + hero_rise_cost = json.encode(cost), --英雄觉醒消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} | |
| 121 | + hero_rise_score = hero:getProperty("battleV"), --英雄觉醒后评分提升 | |
| 122 | + hero_rise_result = getChangeAttrJson(oldAttr, hero:getTotalAttrs()), --英雄觉醒效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} | |
| 123 | + }) | |
| 124 | + | |
| 91 | 125 | SendPacket(actionCodes.Hero_wakeRpc, '') |
| 92 | 126 | return true |
| 93 | 127 | end |
| ... | ... | @@ -107,7 +141,10 @@ function _M.talentRpc(agent, data) |
| 107 | 141 | local curStage = talent:getv(0, 1) |
| 108 | 142 | local curData = csvdb["unit_talentCsv"][curStage] |
| 109 | 143 | if not curData then return 4 end |
| 144 | + local oldSkillLv = hero:getSkillLevel(1) | |
| 145 | + | |
| 110 | 146 | |
| 147 | + local cost = {} | |
| 111 | 148 | if index == 0 then |
| 112 | 149 | --是否进阶 |
| 113 | 150 | local max = true |
| ... | ... | @@ -135,7 +172,7 @@ function _M.talentRpc(agent, data) |
| 135 | 172 | |
| 136 | 173 | if talentData.lvRequire > hero:getProperty("level") then return 6 end |
| 137 | 174 | |
| 138 | - local cost = talentData.money:toNumMap() | |
| 175 | + cost = talentData.money:toNumMap() | |
| 139 | 176 | local cost2 = talentData.cost:toNumMap() |
| 140 | 177 | for k,v in pairs(cost2) do |
| 141 | 178 | cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v |
| ... | ... | @@ -156,7 +193,12 @@ function _M.talentRpc(agent, data) |
| 156 | 193 | |
| 157 | 194 | hero:updateProperty({field = "talent", value = talent}) |
| 158 | 195 | |
| 159 | - hero:log({desc = "talent", int1 = index, int2 = talent:getv(index, 0)}) | |
| 196 | + role:log("hero_talent", { | |
| 197 | + hero_id = hero:getProperty("type"), --英雄ID | |
| 198 | + hero_talent_cost = json.encode(cost), -- 英雄天赋升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} | |
| 199 | + hero_talent_levelbef = oldSkillLv, -- 英雄技能升级前等级 | |
| 200 | + hero_talent_level = hero:getSkillLevel(1), -- 英雄技能升级后等级 | |
| 201 | + }) | |
| 160 | 202 | |
| 161 | 203 | SendPacket(actionCodes.Hero_talentRpc, '') |
| 162 | 204 | return true |
| ... | ... | @@ -256,6 +298,14 @@ function _M.commentHeroRpc(agent, data) |
| 256 | 298 | comment.like = 0 |
| 257 | 299 | result.comment = comment |
| 258 | 300 | role.dailyData:setProperty("commentHero", curStutus:setv(heroType, 1)) |
| 301 | + | |
| 302 | + | |
| 303 | + role:log("hero_note", { | |
| 304 | + hero_id = heroType, -- 英雄ID | |
| 305 | + hero_note_action = 0, -- 英雄评价界面操作,发布评论:0,点赞:1,反对:2 | |
| 306 | + hero_note_id = commentId, -- 操作的评价ID | |
| 307 | + hero_note_text = content, -- 操作的评价内容 | |
| 308 | + }) | |
| 259 | 309 | end |
| 260 | 310 | SendPacket(actionCodes.Hero_commentHeroRpc, MsgPack.pack(result)) |
| 261 | 311 | return true |
| ... | ... | @@ -326,7 +376,7 @@ function _M.likeCommentRpc(agent, data) |
| 326 | 376 | local commentIndex = heroType .. ":" .. commentId |
| 327 | 377 | local commentRoleKey = string.format("comment:%d:like", role:getProperty("id")) |
| 328 | 378 | local redret = redisproxy:pipelining(function (red) |
| 329 | - red:hexists(commentKey.commentKey, commentId) | |
| 379 | + red:hget(commentKey.commentKey, commentId) | |
| 330 | 380 | red:lrem(commentRoleKey, 1, commentIndex) |
| 331 | 381 | red:lpush(commentRoleKey, commentIndex) |
| 332 | 382 | red:ltrim(commentRoleKey, 0, 999) |
| ... | ... | @@ -334,7 +384,8 @@ function _M.likeCommentRpc(agent, data) |
| 334 | 384 | if (tonumber(redret[2]) or 0) > 0 then |
| 335 | 385 | result.status = 1 |
| 336 | 386 | else |
| 337 | - if redret[1] == 1 then-- 查不到也返回ture | |
| 387 | + if redret[1] then-- 查不到也返回ture | |
| 388 | + local comment = json.decode(redret[1]) | |
| 338 | 389 | local redret2 = redisproxy:pipelining(function (red) |
| 339 | 390 | red:zrevrange(commentKey.commentRankKey, 0, RankLikeNum - 1) --热门 |
| 340 | 391 | red:zincrby(commentKey.commentRankKey, add, commentId) |
| ... | ... | @@ -360,6 +411,13 @@ function _M.likeCommentRpc(agent, data) |
| 360 | 411 | red:lrem(commentKey.commentListKey, 0, tempId) |
| 361 | 412 | end |
| 362 | 413 | end) |
| 414 | + | |
| 415 | + role:log("hero_note", { | |
| 416 | + hero_id = heroType, -- 英雄ID | |
| 417 | + hero_note_action = add > 0 and 1 or 2, -- 英雄评价界面操作,发布评论:0,点赞:1,反对:2 | |
| 418 | + hero_note_id = commentId, -- 操作的评价ID | |
| 419 | + hero_note_text = comment.content, -- 操作的评价内容 | |
| 420 | + }) | |
| 363 | 421 | end |
| 364 | 422 | end |
| 365 | 423 | |
| ... | ... | @@ -367,108 +425,6 @@ function _M.likeCommentRpc(agent, data) |
| 367 | 425 | return true |
| 368 | 426 | end |
| 369 | 427 | |
| 370 | --- function _M.loveItemRpc(agent, data) | |
| 371 | --- local role = agent.role | |
| 372 | --- local msg = MsgPack.unpack(data) | |
| 373 | --- local hero = role.heros[msg.heroId] | |
| 374 | --- if not hero then | |
| 375 | --- return | |
| 376 | --- end | |
| 377 | --- local curL = hero:getProperty("loveL") | |
| 378 | --- local curExp = hero:getProperty("loveExp") | |
| 379 | --- local curType = hero:getProperty("type") | |
| 380 | --- local curPlus = csvdb["unit_love_plusCsv"][curType] | |
| 381 | --- if not curPlus then | |
| 382 | --- return | |
| 383 | --- end | |
| 384 | --- if curL >= curPlus.limit then | |
| 385 | --- SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 1})) --已满级 | |
| 386 | --- return true | |
| 387 | --- end | |
| 388 | --- local curEffect = csvdb["unit_love_effectCsv"][curL] | |
| 389 | --- if not curEffect then | |
| 390 | --- return | |
| 391 | --- end | |
| 392 | --- if curExp >= curEffect.loveValue and not msg.bBreak then | |
| 393 | --- SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 2})) --当前等级经验已满 | |
| 394 | --- return true | |
| 395 | --- end | |
| 396 | - | |
| 397 | --- if msg.bBreak then | |
| 398 | --- local cost = curEffect.cost:toArray(true, "=") | |
| 399 | --- if not role:checkItemEnough({[cost[1]] = cost[2]}) then | |
| 400 | --- SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 3, itemId = cost[1]})) --物品不足 | |
| 401 | --- return true | |
| 402 | --- end | |
| 403 | --- role:costItems({[cost[1]] = cost[2]}) | |
| 404 | --- local newLevel = curL + 1 | |
| 405 | --- hero:updateProperty({field = "loveL", value = newLevel}) | |
| 406 | --- hero:updateProperty({field = "loveExp", value = 0}) | |
| 407 | - | |
| 408 | --- if role:getProperty("loveStatus"):getv(curType, 0) < newLevel then | |
| 409 | --- role:changeUpdates({{type = "loveStatus", field = curType, value = newLevel}}) -- 总的 | |
| 410 | --- end | |
| 411 | - | |
| 412 | --- role:checkTaskEnter("LoveBreak", {heroType = curType, loveL = newLevel}) | |
| 413 | - | |
| 414 | --- else | |
| 415 | --- local delta = globalCsv.unit_love_presentValue[msg.itemId] | |
| 416 | --- if not delta then | |
| 417 | --- return | |
| 418 | --- end | |
| 419 | --- if not role:checkItemEnough({[msg.itemId] = 1}) then | |
| 420 | --- SendPacket(actionCodes.Hero_loveItemRpc, MsgPack.pack({errMsg = 3, itemId = msg.itemId})) | |
| 421 | --- return true | |
| 422 | --- end | |
| 423 | --- local newExp = curExp + delta | |
| 424 | --- if newExp > curEffect.loveValue then | |
| 425 | --- newExp = curEffect.loveValue | |
| 426 | --- end | |
| 427 | --- role:costItems({[msg.itemId] = 1}) | |
| 428 | --- hero:updateProperty({field = "loveExp", value = newExp}) | |
| 429 | --- end | |
| 430 | --- SendPacket(actionCodes.Hero_loveItemRpc, "") | |
| 431 | --- return true | |
| 432 | --- end | |
| 433 | - | |
| 434 | --- function _M.loveTaskRpc(agent, data) | |
| 435 | --- local role = agent.role | |
| 436 | --- local msg = MsgPack.unpack(data) | |
| 437 | --- local hero = role.heros[msg.id] | |
| 438 | --- if not hero then return end | |
| 439 | - | |
| 440 | --- local curL = hero:getProperty("loveL") | |
| 441 | --- local curExp = hero:getProperty("loveExp") | |
| 442 | --- local curType = hero:getProperty("type") | |
| 443 | --- local curPlus = csvdb["unit_love_plusCsv"][curType] | |
| 444 | --- if not curPlus or curL >= curPlus.limit then return end | |
| 445 | - | |
| 446 | --- local curEffect = csvdb["unit_love_effectCsv"][curL] | |
| 447 | --- if not curEffect or curExp < curEffect.loveValue then return end | |
| 448 | - | |
| 449 | --- local lastEffect = csvdb["unit_love_effectCsv"][curL + 1] | |
| 450 | --- local newExp = curExp - curEffect.loveValue | |
| 451 | --- if lastEffect and curL + 1 < curPlus.limit then | |
| 452 | --- if newExp >= lastEffect.loveValue then | |
| 453 | --- -- todo 发任务 | |
| 454 | --- end | |
| 455 | --- else | |
| 456 | --- newExp = 0 | |
| 457 | --- end | |
| 458 | --- local newLevel = curL + 1 | |
| 459 | --- hero:updateProperty({field = "loveExp", value = newExp}) | |
| 460 | --- hero:updateProperty({field = "loveL", value = newLevel}) | |
| 461 | - | |
| 462 | --- if role:getProperty("loveStatus"):getv(curType, 0) < newLevel then | |
| 463 | --- role:changeUpdates({{type = "loveStatus", field = curType, value = newLevel}}) -- 总的 | |
| 464 | --- end | |
| 465 | - | |
| 466 | --- role:checkTaskEnter("LoveBreak", {heroType = curType, loveL = newLevel}) | |
| 467 | - | |
| 468 | --- SendPacket(actionCodes.Hero_loveTaskRpc, "") | |
| 469 | --- return true | |
| 470 | --- end | |
| 471 | - | |
| 472 | 428 | function _M.createHeroRpc(agent, data) |
| 473 | 429 | local role = agent.role |
| 474 | 430 | local msg = MsgPack.unpack(data) |
| ... | ... | @@ -497,6 +453,7 @@ function _M.referEquipsRpc(agent, data) |
| 497 | 453 | local hero = role.heros[msg.id] |
| 498 | 454 | if not hero then return 10 end |
| 499 | 455 | local equips = msg.equips |
| 456 | + local isAuto = msg.isAuth | |
| 500 | 457 | if not equips or not next(equips) then return 11 end |
| 501 | 458 | |
| 502 | 459 | for typ = 1, 4 do -- 4件装备 |
| ... | ... | @@ -506,6 +463,11 @@ function _M.referEquipsRpc(agent, data) |
| 506 | 463 | end |
| 507 | 464 | end |
| 508 | 465 | end |
| 466 | + | |
| 467 | + local oldAttr = hero:getTotalAttrs() | |
| 468 | + local oldBattleV = hero:getProperty("battleV") | |
| 469 | + local wear = {} | |
| 470 | + | |
| 509 | 471 | local curEquip = hero:getProperty("equip") |
| 510 | 472 | for typ = 1, 4 do -- 4件装备 |
| 511 | 473 | if equips[typ] then |
| ... | ... | @@ -516,19 +478,37 @@ function _M.referEquipsRpc(agent, data) |
| 516 | 478 | else |
| 517 | 479 | role:addEquip(typ, equips[typ], -1, {log = {desc = "refer"}}) -- 穿上 |
| 518 | 480 | curEquip = curEquip:setv(typ, equips[typ]) |
| 481 | + | |
| 482 | + wear[typ] = {id = equips[typ], act = 0} | |
| 519 | 483 | end |
| 520 | 484 | |
| 521 | 485 | if cur ~= 0 then |
| 522 | 486 | role:addEquip(typ, cur, 1, {log = {desc = "refer"}}) -- 脱掉 |
| 487 | + | |
| 488 | + wear[typ] = {id = cur, act = 1} | |
| 523 | 489 | end |
| 524 | 490 | end |
| 525 | 491 | end |
| 526 | 492 | end |
| 493 | + | |
| 527 | 494 | -- 更新角色 |
| 528 | 495 | hero:updateProperty({field = "equip", value = curEquip}) |
| 529 | 496 | |
| 530 | 497 | role:finishGuide(23) |
| 531 | 498 | |
| 499 | + local curAttr = hero:getTotalAttrs() | |
| 500 | + local attrChange = getChangeAttrJson(oldAttr, curAttr) | |
| 501 | + for typ, data in pairs(wear) do | |
| 502 | + role:log("hero_jewel", { | |
| 503 | + hero_id = hero:getProperty("type"), --英雄ID | |
| 504 | + equip_id = data.id, --装备ID | |
| 505 | + equip_wear_action = data.act, --装备操作类型:装备:0,卸载:1 | |
| 506 | + equip_wear_part = typ, --装备部位,记录部位ID | |
| 507 | + equip_wear_result = curAttr, --装备操作后结果,记录属性变化,json格式记录,{“aa”:1234,"bb":4567} | |
| 508 | + equip_wear_change = attrChange, --装备操作变化值,记录属性变化,记录正负值,json格式记录,{“aa”:1234,"bb":-45} | |
| 509 | + equip_wear_mode = isAuto and 0 or 1, --用以区分自动装备还是手动装备,自动记录为0,手动记录为1 | |
| 510 | + }) | |
| 511 | + end | |
| 532 | 512 | SendPacket(actionCodes.Hero_referEquipsRpc, "") |
| 533 | 513 | return true |
| 534 | 514 | end |
| ... | ... | @@ -565,6 +545,9 @@ function _M.referRunesRpc(agent, data) |
| 565 | 545 | chero:updateProperty({field = "rune", value = hrunes}) |
| 566 | 546 | end |
| 567 | 547 | |
| 548 | + local oldAttr = hero:getTotalAttrs() | |
| 549 | + local oldBattleV = hero:getProperty("battleV") | |
| 550 | + local wear = {} | |
| 568 | 551 | local curRune = hero:getProperty("rune") |
| 569 | 552 | for typ = 1, 6 do |
| 570 | 553 | if runes[typ] then |
| ... | ... | @@ -576,6 +559,7 @@ function _M.referRunesRpc(agent, data) |
| 576 | 559 | local newRune = role.runeBag[runes[typ]] |
| 577 | 560 | newRune:updateProperty({field = "refer",value = hero:getProperty("id")}) |
| 578 | 561 | curRune = curRune:setv(typ, runes[typ]) |
| 562 | + wear[runes[typ]] = typ | |
| 579 | 563 | end |
| 580 | 564 | |
| 581 | 565 | if cur ~= 0 then |
| ... | ... | @@ -587,7 +571,22 @@ function _M.referRunesRpc(agent, data) |
| 587 | 571 | end |
| 588 | 572 | end |
| 589 | 573 | end |
| 574 | + | |
| 590 | 575 | hero:updateProperty({field = "rune", value = curRune}) |
| 576 | + | |
| 577 | + local attrChange = getChangeAttrJson(oldAttr, hero:getTotalAttrs()) | |
| 578 | + for runeId, typ in pairs(wear) do | |
| 579 | + local ownRune = role.runeBag[runeId] | |
| 580 | + role:log("hero_jewel", { | |
| 581 | + hero_id = hero:getProperty("type"), -- 英雄ID | |
| 582 | + hero_jewel_id = ownRune:getProperty("id"), -- 铭文ID | |
| 583 | + hero_jewel_part = typ, -- 铭文装备部位 | |
| 584 | + hero_jewel_score = hero:getProperty("battleV"), -- 铭文装备后的英雄分值 | |
| 585 | + hero_jewel_scorebefore = oldBattleV, -- 铭文装备前的英雄分值 | |
| 586 | + hero_jewel_result = attrChange, -- 铭文装备后效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} | |
| 587 | + }) | |
| 588 | + end | |
| 589 | + | |
| 591 | 590 | SendPacket(actionCodes.Hero_referRunesRpc, "") |
| 592 | 591 | return true |
| 593 | 592 | end |
| ... | ... | @@ -675,7 +674,6 @@ function _M.getResetRewardRpc(agent, data) |
| 675 | 674 | hero:updateProperty({field = "level", value = level}) |
| 676 | 675 | hero:updateProperty({field = "breakL", value = breakL}) |
| 677 | 676 | hero:updateProperty({field = "talent", value = ""}) |
| 678 | - hero:log({desc = "resetHero"}) | |
| 679 | 677 | |
| 680 | 678 | for itemId, count in pairs(reward) do |
| 681 | 679 | reward[itemId] = math.floor(count * globalCsv.unit_back_discount) |
| ... | ... | @@ -683,259 +681,15 @@ function _M.getResetRewardRpc(agent, data) |
| 683 | 681 | local change |
| 684 | 682 | reward, change = role:award(reward, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}}) |
| 685 | 683 | |
| 684 | + role:log("hero_recycle", { | |
| 685 | + hero_recycle_list = hero:getProperty("type"), -- 回收的英雄id列表,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | |
| 686 | + hero_recycle_reward = json.encode(reward), -- 回收后获得的奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | |
| 687 | + hero_recycle_cnt = 1, -- 总回收英雄量 | |
| 688 | + }) | |
| 686 | 689 | SendPacket(actionCodes.Hero_getResetRewardRpc, MsgPack.pack(role:packReward(reward, change))) |
| 687 | 690 | return true |
| 688 | 691 | end |
| 689 | 692 | |
| 690 | -function _M.unuse_drawHeroRpc(agent, data) | |
| 691 | - local role = agent.role | |
| 692 | - local msg = MsgPack.unpack(data) | |
| 693 | - | |
| 694 | - if not role:isFuncUnlock(FuncUnlock.GetHero) then return end | |
| 695 | - local btype = msg.pool -- 1 2 3 4 | |
| 696 | - local drawType = msg.type -- 1 单抽 2 十连 | |
| 697 | - | |
| 698 | - local buildTypeData = csvdb["build_typeCsv"][btype] | |
| 699 | - if not buildTypeData then return 1 end | |
| 700 | - | |
| 701 | - local drawCount = {1, 10} -- 抽取次数 | |
| 702 | - if not drawCount[drawType] then return 2 end | |
| 703 | - | |
| 704 | - local newerDraw | |
| 705 | - if btype == 4 then | |
| 706 | - newerDraw = role:getProperty("newerDraw") | |
| 707 | - if math.illegalNum(globalCsv.draw_newer[2] - (newerDraw[1] or 0), drawCount[drawType], globalCsv.draw_newer[2]) then return 11 end | |
| 708 | - end | |
| 709 | - | |
| 710 | - local cost = {} | |
| 711 | - local lastCount = drawCount[drawType] | |
| 712 | - for _, costType in ipairs({"draw_card", "draw_coin"}) do | |
| 713 | - if buildTypeData[costType] ~= "" then | |
| 714 | - local curCost = buildTypeData[costType]:toArray(true, "=") | |
| 715 | - local hadCount = role:getItemCount(curCost[1]) | |
| 716 | - local curCount = math.floor(hadCount / curCost[2]) | |
| 717 | - if curCount >= lastCount then | |
| 718 | - cost[curCost[1]] = curCost[2] * lastCount | |
| 719 | - lastCount = 0 | |
| 720 | - break | |
| 721 | - elseif curCount > 0 then | |
| 722 | - cost[curCost[1]] = curCost[2] * curCount | |
| 723 | - lastCount = lastCount - curCount | |
| 724 | - end | |
| 725 | - end | |
| 726 | - end | |
| 727 | - if lastCount > 0 then -- 钱不够 | |
| 728 | - return 3 | |
| 729 | - end | |
| 730 | - | |
| 731 | - -- pool 固定的 | |
| 732 | - local poolEnum = { | |
| 733 | - [1] = { | |
| 734 | - [1] = 1, | |
| 735 | - [2] = 2, | |
| 736 | - [3] = 3, | |
| 737 | - }, | |
| 738 | - [2] = 10, | |
| 739 | - [3] = 11, | |
| 740 | - [4] = 12, | |
| 741 | - } | |
| 742 | - | |
| 743 | - -- 抽取的池子 | |
| 744 | - local pool = poolEnum[btype] | |
| 745 | - if btype == 1 then | |
| 746 | - -- 超级卡池子 每周轮换 有活动覆盖之 | |
| 747 | - --TODO 活动判断 | |
| 748 | - if false then | |
| 749 | - else | |
| 750 | - for idx, poolId in pairs(pool) do | |
| 751 | - if role:isTimeResetOpen(TimeReset["DrawType" .. idx]) then | |
| 752 | - pool = poolId | |
| 753 | - break | |
| 754 | - end | |
| 755 | - end | |
| 756 | - if type(pool) ~= "number" then | |
| 757 | - pool = -1 | |
| 758 | - end | |
| 759 | - end | |
| 760 | - end | |
| 761 | - local unitPool = csvdb["build_unitCsv"][pool] | |
| 762 | - if not unitPool then return 4 end | |
| 763 | - | |
| 764 | - -- 开始抽 | |
| 765 | - local resultPool = {} | |
| 766 | - local function fillDrawPool(fixRare, fixCamp, ssrUp, floorBack) | |
| 767 | - local condition = {"rare", "camp"} | |
| 768 | - local values = {fixRare, fixCamp} | |
| 769 | - | |
| 770 | - for idx, field in ipairs(condition) do | |
| 771 | - if not values[idx] then | |
| 772 | - local lpool = {} | |
| 773 | - local curIdx = 1 | |
| 774 | - while unitPool[field .. "_" .. curIdx] do | |
| 775 | - lpool[curIdx] = {unitPool[field .. "_" .. curIdx]} | |
| 776 | - curIdx = curIdx + 1 | |
| 777 | - end | |
| 778 | - | |
| 779 | - -- 稀有度 ssr up | |
| 780 | - if field == "rare" then | |
| 781 | - local all = 0 | |
| 782 | - for _, weight in pairs(lpool) do | |
| 783 | - all = all + weight[1] | |
| 784 | - end | |
| 785 | - --[[ | |
| 786 | - SSR概率值:初始概率 + 步长概率 | |
| 787 | - SR概率值:初始概率 * [ (初始概率+R初始概率) - 步长概率 ] /(初始概率+R初始概率) | |
| 788 | - R概率值:初始概率 * [ (初始概率+SR初始概率) - 步长概率 ] /(初始概率+SR初始概率) | |
| 789 | - ]] | |
| 790 | - local ssrAdd = (ssrUp or 0) * all | |
| 791 | - local last = all - lpool[4][1] | |
| 792 | - lpool[4][1] = lpool[4][1] + ssrAdd | |
| 793 | - lpool[3][1] = lpool[3][1] * (last - ssrAdd) / last | |
| 794 | - lpool[2][1] = lpool[2][1] * (last - ssrAdd) / last | |
| 795 | - end | |
| 796 | - | |
| 797 | - if next(lpool) then | |
| 798 | - values[idx] = math.randWeight(lpool, 1) | |
| 799 | - end | |
| 800 | - end | |
| 801 | - end | |
| 802 | - | |
| 803 | - for itemId, oneData in pairs(floorBack and csvdb["build_floorCsv"] or csvdb["build_poolCsv"]) do | |
| 804 | - if oneData["pool_" .. pool] and oneData["pool_" .. pool] ~= "" then | |
| 805 | - local itemData = csvdb["itemCsv"][itemId] | |
| 806 | - while itemData do | |
| 807 | - if itemData.type ~= ItemType.Hero then break end | |
| 808 | - local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] | |
| 809 | - if not heroData then break end | |
| 810 | - local ok = true | |
| 811 | - for idx, field in ipairs(condition) do | |
| 812 | - if heroData[field] ~= values[idx] then ok = false break end | |
| 813 | - end | |
| 814 | - if not ok then break end | |
| 815 | - if oneData["pool_" .. pool] > 0 then | |
| 816 | - resultPool[itemId] = {oneData["pool_" .. pool]} -- itemId, count, 概率 | |
| 817 | - end | |
| 818 | - break | |
| 819 | - end | |
| 820 | - end | |
| 821 | - end | |
| 822 | - end | |
| 823 | - | |
| 824 | - role:costItems(cost, {log = {desc = "drawHero", short1 = btype, int1 = pool}}) | |
| 825 | - | |
| 826 | - local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] | |
| 827 | - local draw_ssr_up_count_rate = globalCsv.draw_ssr_up_count_rate[btype] | |
| 828 | - local floorHeroCount = role:getProperty("floorHero")[btype] or 0 | |
| 829 | - local ssrUpCount = role:getProperty("ssrUp")[btype] or 0 | |
| 830 | - | |
| 831 | - local newerDrawCount, newerHadSSR | |
| 832 | - if btype == 4 then | |
| 833 | - newerDrawCount = newerDraw[1] or 0 | |
| 834 | - newerHadSSR = newerDraw[2] or 0 | |
| 835 | - end | |
| 836 | - | |
| 837 | - local guideHero | |
| 838 | - local funcGuide = role:getProperty("funcGuide") | |
| 839 | - if funcGuide:getv(11001,0) == 1 and funcGuide:getv(12001,0) == 0 then | |
| 840 | - guideHero = 613 | |
| 841 | - end | |
| 842 | - | |
| 843 | - local ssrCount = 0 | |
| 844 | - local reward = {} | |
| 845 | - for i = 1, drawCount[drawType] do | |
| 846 | - floorHeroCount = floorHeroCount + 1 | |
| 847 | - if btype == 4 then | |
| 848 | - newerDrawCount = newerDrawCount + 1 | |
| 849 | - end | |
| 850 | - | |
| 851 | - resultPool = {} | |
| 852 | - local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts | |
| 853 | - local isNewerSSR = btype == 4 and (newerHadSSR == 0 and newerDrawCount >= globalCsv.draw_newer[1]) or false | |
| 854 | - | |
| 855 | - local ssrUp = 0 | |
| 856 | - if draw_ssr_up_count_rate and ssrUpCount > draw_ssr_up_count_rate[1] then | |
| 857 | - ssrUp = math.min((ssrUpCount - draw_ssr_up_count_rate[1]) * draw_ssr_up_count_rate[2], draw_ssr_up_count_rate[3]) / 100 | |
| 858 | - end | |
| 859 | - while not next(resultPool) do | |
| 860 | - if isNewerSSR then | |
| 861 | - fillDrawPool(4) -- 新手保底的 ssr | |
| 862 | - elseif isFloorBack then | |
| 863 | - -- 保底 sr 【郑斌】明确 | |
| 864 | - -- 保底 sr 改为 池子随机 sr 或者 ssr【郑斌】 | |
| 865 | - fillDrawPool(nil, nil, nil, true) | |
| 866 | - else | |
| 867 | - fillDrawPool(nil, nil, ssrUp) | |
| 868 | - end | |
| 869 | - end | |
| 870 | - | |
| 871 | - -- 引导必送 613 丝路德 | |
| 872 | - local itemId = math.randWeight(resultPool, 1) | |
| 873 | - if guideHero then | |
| 874 | - itemId = guideHero | |
| 875 | - guideHero = nil | |
| 876 | - end | |
| 877 | - local itemData = csvdb["itemCsv"][itemId] | |
| 878 | - if itemData.quality == 4 then | |
| 879 | - ssrCount = ssrCount + 1 | |
| 880 | - ssrUpCount = 0 | |
| 881 | - if btype == 4 then | |
| 882 | - newerHadSSR = newerHadSSR + 1 | |
| 883 | - end | |
| 884 | - else | |
| 885 | - ssrUpCount = ssrUpCount + 1 | |
| 886 | - end | |
| 887 | - | |
| 888 | - if itemData.quality >= 3 then | |
| 889 | - floorHeroCount = 0 | |
| 890 | - end | |
| 891 | - | |
| 892 | - if role:isHaveHero(itemData.id - ItemStartId.Hero) then | |
| 893 | - local fragId = itemData.id - ItemStartId.Hero | |
| 894 | - local heroData = csvdb["unitCsv"][fragId] | |
| 895 | - local count = globalCsv.draw_unit_tofragment[heroData.rare] | |
| 896 | - role:award({[fragId] = count}, {log = {desc = "drawHero", short1 = btype, int1 = pool}}) | |
| 897 | - table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) | |
| 898 | - else | |
| 899 | - role:award({[itemId] = 1}, {log = {desc = "drawHero", short1 = btype, int1 = pool}}) | |
| 900 | - table.insert(reward, {id = itemId, count = 1}) | |
| 901 | - end | |
| 902 | - end | |
| 903 | - | |
| 904 | - if draw_floor_back_counts then | |
| 905 | - local floorHero = role:getProperty("floorHero") | |
| 906 | - floorHero[btype] = floorHeroCount | |
| 907 | - role:setProperty("floorHero", floorHero) | |
| 908 | - end | |
| 909 | - | |
| 910 | - if draw_ssr_up_count_rate then | |
| 911 | - local ssrUp = role:getProperty("ssrUp") | |
| 912 | - ssrUp[btype] = ssrUpCount | |
| 913 | - role:setProperty("ssrUp", ssrUp) | |
| 914 | - end | |
| 915 | - | |
| 916 | - if btype == 4 then | |
| 917 | - newerDraw[1] = newerDrawCount | |
| 918 | - newerDraw[2] = newerHadSSR | |
| 919 | - role:updateProperty({field = "newerDraw", value = newerDraw}) | |
| 920 | - end | |
| 921 | - | |
| 922 | - -- if pool == 1 then | |
| 923 | - -- local repayHero = role:getProperty("repayHero") | |
| 924 | - -- repayHero = math.min(globalCsv.draw_super_repay_count, repayHero + drawCount[drawType]) | |
| 925 | - -- role:updateProperty({field = "repayHero", value = repayHero}) | |
| 926 | - -- end | |
| 927 | - | |
| 928 | - role:finishGuide(11) | |
| 929 | - | |
| 930 | - role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]}) | |
| 931 | - if ssrCount > 0 then | |
| 932 | - role:checkTaskEnter("DrawSSR", {count = ssrCount}) | |
| 933 | - end | |
| 934 | - role:log("hero_action", {desc = "drawHero", short1 = btype, int1 = drawCount[drawType], int2 = pool}) | |
| 935 | - SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 | |
| 936 | - return true | |
| 937 | -end | |
| 938 | - | |
| 939 | 693 | function _M.drawHeroRpc(agent, data) |
| 940 | 694 | local role = agent.role |
| 941 | 695 | local msg = MsgPack.unpack(data) |
| ... | ... | @@ -1048,7 +802,7 @@ function _M.drawHeroRpc(agent, data) |
| 1048 | 802 | end |
| 1049 | 803 | end |
| 1050 | 804 | |
| 1051 | - role:costItems(cost, {log = {desc = "drawHero", short1 = btype, int1 = poolId}}) | |
| 805 | + role:costItems(cost, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | |
| 1052 | 806 | |
| 1053 | 807 | local ssrCount = 0 |
| 1054 | 808 | local reward = {} |
| ... | ... | @@ -1077,10 +831,10 @@ function _M.drawHeroRpc(agent, data) |
| 1077 | 831 | local fragId = itemData.id - ItemStartId.Hero |
| 1078 | 832 | local heroData = csvdb["unitCsv"][fragId] |
| 1079 | 833 | local count = globalCsv.draw_unit_tofragment[heroData.rare] |
| 1080 | - role:award({[fragId] = count}, {log = {desc = "drawHero", short1 = btype, int1 = poolId}}) | |
| 834 | + role:award({[fragId] = count}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | |
| 1081 | 835 | table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) |
| 1082 | 836 | else |
| 1083 | - role:award({[itemId] = 1}, {log = {desc = "drawHero", short1 = btype, int1 = poolId}}) | |
| 837 | + role:award({[itemId] = 1}, {log = {desc = "drawHero", int1 = btype, int2 = poolId}}) | |
| 1084 | 838 | table.insert(reward, {id = itemId, count = 1}) |
| 1085 | 839 | end |
| 1086 | 840 | end |
| ... | ... | @@ -1101,7 +855,16 @@ function _M.drawHeroRpc(agent, data) |
| 1101 | 855 | if ssrCount > 0 then |
| 1102 | 856 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) |
| 1103 | 857 | end |
| 1104 | - role:log("hero_action", {desc = "drawHero", short1 = btype, int1 = drawCount[drawType], int2 = poolId}) | |
| 858 | + role:finishGuide(11) | |
| 859 | + | |
| 860 | + role:log("gacha", { | |
| 861 | + gacha_id = poolId, -- 卡池ID | |
| 862 | + gacha_type = btype, -- 卡池类型 | |
| 863 | + gacha_up = 0, -- 卡池UP角色 | |
| 864 | + gacha_times = drawCount[drawType], -- 抽卡次数 | |
| 865 | + gacha_reward = json.encode(reward), -- 抽卡结果,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | |
| 866 | + currency = json.encode(cost), -- 购买道具消耗的货币 | |
| 867 | + }) | |
| 1105 | 868 | SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 |
| 1106 | 869 | return true |
| 1107 | 870 | end |
| ... | ... | @@ -1131,7 +894,6 @@ function _M.repayHeroRpc(agent, data) |
| 1131 | 894 | role:award({[id] = 1}, {log = {desc = "heroRepay"}}) |
| 1132 | 895 | reward = {id = id, count = 1} |
| 1133 | 896 | end |
| 1134 | - role:log("hero_action", {desc = "heroRepay", int1=result}) | |
| 1135 | 897 | SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward})) |
| 1136 | 898 | return true |
| 1137 | 899 | end |
| ... | ... | @@ -1168,4 +930,20 @@ function _M.unlockPoolRpc(agent, data) |
| 1168 | 930 | return true |
| 1169 | 931 | end |
| 1170 | 932 | |
| 933 | +function _M.changeCrownRpc(agnet, data) | |
| 934 | + local role = agent.role | |
| 935 | + local msg = MsgPack.unpack(data) | |
| 936 | + | |
| 937 | + local heroType = msg.heroType | |
| 938 | + | |
| 939 | + if not role:isHaveHero(heroType) then return end | |
| 940 | + role:setProperty("crown", heroType) | |
| 941 | + | |
| 942 | + role:log("hero_show", { | |
| 943 | + hero_id = heroType, | |
| 944 | + }) | |
| 945 | + SendPacket(actionCodes.Hero_changeCrownRpc, "") | |
| 946 | + return true | |
| 947 | +end | |
| 948 | + | |
| 1171 | 949 | return _M |
| 1172 | 950 | \ No newline at end of file | ... | ... |
src/actions/RoleAction.lua
| ... | ... | @@ -453,11 +453,21 @@ function _M.saleItemRpc(agent, data) |
| 453 | 453 | end |
| 454 | 454 | local sellEffect = itemData.sell_effect:toArray(true, "=") |
| 455 | 455 | reward[sellEffect[1]] = (reward[sellEffect[1]] or 0) + sellEffect[2] * count |
| 456 | + | |
| 457 | + role:log("carriage_decals", { | |
| 458 | + item_id = itemId, --道具id | |
| 459 | + item_type = itemData.type, --道具类型,具体见枚举表中道具类型枚举表 | |
| 460 | + item_level = 0, --道具等级 | |
| 461 | + item_number = count, --道具变化数量的绝对值 | |
| 462 | + carriage_decals_rwdid = sellEffect[1], --拆解获得物资ID | |
| 463 | + carriage_decals_rwdnum = sellEffect[2] * count, --拆解获得物资数量 | |
| 464 | + }) | |
| 456 | 465 | end |
| 457 | 466 | |
| 458 | 467 | role:costItems(backs, {log = {desc = "saleItem"}}) |
| 459 | 468 | local reward, change = role:award(reward, {log = {desc = "saleItem"}}) |
| 460 | 469 | role:checkTaskEnter("DecoFrag", {count = fragCount}) |
| 470 | + | |
| 461 | 471 | SendPacket(actionCodes.Role_saleItemRpc, MsgPack.pack(role:packReward(reward, change))) |
| 462 | 472 | return true |
| 463 | 473 | end |
| ... | ... | @@ -530,12 +540,14 @@ function _M.openTimeBoxRpc(agent, data) |
| 530 | 540 | elseif oper == 2 then -- 领取 |
| 531 | 541 | local quick = msg.quick |
| 532 | 542 | if not boxL[slot] then return end |
| 543 | + local costKey = 0 | |
| 544 | + local costTime = skynet.timex() - boxL[slot].time | |
| 533 | 545 | if boxL[slot].time > skynet.timex() then -- 没开完 |
| 534 | 546 | if not quick then return end |
| 535 | 547 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") |
| 536 | - local costD = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2] | |
| 537 | - if not role:checkItemEnough({[ItemId.BoxKey] = costD}) then return end | |
| 538 | - role:costItems({[ItemId.BoxKey] = costD}, {log = {desc = "openTimeBox"}}) | |
| 548 | + local costKey = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2] | |
| 549 | + if not role:checkItemEnough({[ItemId.BoxKey] = costKey}) then return end | |
| 550 | + role:costItems({[ItemId.BoxKey] = costKey}, {log = {desc = "openTimeBox"}}) | |
| 539 | 551 | end |
| 540 | 552 | local boxId = boxL[slot].id |
| 541 | 553 | local itemData = csvdb["itemCsv"][boxId] |
| ... | ... | @@ -565,6 +577,17 @@ function _M.openTimeBoxRpc(agent, data) |
| 565 | 577 | boxL[slot] = nil |
| 566 | 578 | reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = boxId}}) |
| 567 | 579 | role:checkTaskEnter("OpenBox", {id = boxId, count=1}) |
| 580 | + | |
| 581 | + role:log("carriage_dismantle", { | |
| 582 | + item_id = boxId, -- 道具id | |
| 583 | + item_type = itemData.type, -- 道具类型,具体见枚举表中道具类型枚举表 | |
| 584 | + item_level = 0, -- 道具等级 | |
| 585 | + item_number = 1, -- 道具变化数量的绝对值 | |
| 586 | + carriage_dismantle_type = quick and 1 or 0, -- 拆解方式,时间到期:0,钥匙开启:1 | |
| 587 | + carriage_dismantle_time = costTime, -- 拆解耗时,填写实际耗时 | |
| 588 | + carriage_dismantle_cost = costKey, -- 拆解花费钥匙数量,未使用填写0 | |
| 589 | + carriage_dismantle_rwd = json.encode(reward), -- 拆解获得物资,json格式记录,{'itemid1':2,'itemid2':3,…………..} | |
| 590 | + }) | |
| 568 | 591 | else |
| 569 | 592 | return |
| 570 | 593 | end |
| ... | ... | @@ -652,6 +675,15 @@ function _M.storyBookRewardRpc(agent, data) |
| 652 | 675 | storyStatus[storyId].s = -1 |
| 653 | 676 | role:changeUpdates({{ type = "storyB", field = storyId, value = storyStatus[storyId] }}) |
| 654 | 677 | local reward, change = role:award(storyBookData.gift, {log = {desc = "storybookReward", int1 = storyId}}) |
| 678 | + | |
| 679 | + role:log("carriage_decals", { | |
| 680 | + carriage_video_type = storyBookData.type, --放映室类型,剧情CG:0, 角色CG:1, 主线剧情:2, 角色剧情:3, 活动剧情:4, 图鉴:5 | |
| 681 | + carriage_video_id = storyId, --放映室片段ID | |
| 682 | + carriage_video_coinid = reward[ItemId.Gold] and ItemId.Gold or 0, --放映奖励货币类型,无奖励则填写0 | |
| 683 | + carriage_video_coinnum = reward[ItemId.Gold] or 0, --放映奖励货币数量,无奖励则填写0 | |
| 684 | + carriage_video_item = json.encode(reward), --放映奖励其他物品数量,json格式记录,{'itemid1':10,'itemid2':5,…………..},无奖励则填写0 | |
| 685 | + }) | |
| 686 | + | |
| 655 | 687 | SendPacket(actionCodes.Role_storyBookRewardRpc, MsgPack.pack(role:packReward(reward, change))) |
| 656 | 688 | return true |
| 657 | 689 | end |
| ... | ... | @@ -714,6 +746,12 @@ function _M.taskRpc(agent, data) |
| 714 | 746 | local oldVal = role:getProperty("battlePoint") or 0 |
| 715 | 747 | role:updateProperty({field = "battlePoint", value = oldVal + taskData.active}) |
| 716 | 748 | |
| 749 | + role:log("task_reward", { | |
| 750 | + task_reward_id = taskId, --任务奖励ID | |
| 751 | + task_reward_type = taskType, --任务奖励类型,见 任务奖励类型枚举表 | |
| 752 | + task_reward_detail = json.encode(reward), --任务奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
| 753 | + }) | |
| 754 | + | |
| 717 | 755 | SendPacket(actionCodes.Role_taskRpc, MsgPack.pack(role:packReward(reward, change))) |
| 718 | 756 | return true |
| 719 | 757 | end |
| ... | ... | @@ -803,6 +841,12 @@ function _M.achiveRpc(agent, data) |
| 803 | 841 | end |
| 804 | 842 | end |
| 805 | 843 | |
| 844 | + role:log("achievement", { | |
| 845 | + achievement_id = taskId, -- 成就id | |
| 846 | + achievement_type = achiveTask.type, -- 成就类型,具体枚举表中成就类型枚举表 | |
| 847 | + achievement_reward = json.encode(reward), -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | |
| 848 | + }) | |
| 849 | + | |
| 806 | 850 | SendPacket(actionCodes.Role_achiveRpc, MsgPack.pack(role:packReward(reward, change))) |
| 807 | 851 | return true |
| 808 | 852 | end |
| ... | ... | @@ -921,6 +965,13 @@ function _M.chatRpc(agent, data) |
| 921 | 965 | if not result then |
| 922 | 966 | check[cmd]() |
| 923 | 967 | end |
| 968 | + | |
| 969 | + role:log("communication", { | |
| 970 | + publish_type = cmd, --发言类型,1,世界 2私聊 | |
| 971 | + publish_status = 0, --发送状态,发送成功:0,发送失败:1,被屏蔽:2,其他:3 | |
| 972 | + publish_receive_roleid = msg.roleId, --接收者角色ID | |
| 973 | + publish_text = content, --发言内容 | |
| 974 | + }) | |
| 924 | 975 | SendPacket(actionCodes.Role_chatRpc, MsgPack.pack({result = result, waitTime = waitTime})) |
| 925 | 976 | return true |
| 926 | 977 | end |
| ... | ... | @@ -979,8 +1030,15 @@ function _M.drawCodeRpc(agent, data) |
| 979 | 1030 | if ret == 0 then |
| 980 | 1031 | local giftId = tonumber(result.giftId) |
| 981 | 1032 | role:setProperty("codeStr", codestr:setv(giftId, 1)) |
| 982 | - local reward, change = role:award(result.gift, {log = {desc = "drawCode", key1 = code, int1 = giftId}}) | |
| 1033 | + local reward, change = role:award(result.gift, {log = {desc = "drawCode", int1 = giftId}}) | |
| 983 | 1034 | |
| 1035 | + role:log("get_gift", { | |
| 1036 | + gift_id = giftId, -- 礼包ID | |
| 1037 | + gift_key = code, -- 礼包key | |
| 1038 | + gift_reward = json.encode(reward), -- 礼包奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | |
| 1039 | + gift_name = "", -- 礼包名称 | |
| 1040 | + gift_reason = 0, -- 礼包发放原因,见发放原因枚举表 | |
| 1041 | + }) | |
| 984 | 1042 | SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({ |
| 985 | 1043 | result = ret, |
| 986 | 1044 | reward = reward, | ... | ... |
src/actions/StoreAction.lua
| ... | ... | @@ -195,82 +195,6 @@ function _M.purchaseOrderResult(agent, data) |
| 195 | 195 | end |
| 196 | 196 | |
| 197 | 197 | |
| 198 | -function _M.dailyBuyRpc(agent , data) | |
| 199 | - local role = agent.role | |
| 200 | - local msg = MsgPack.unpack(data) | |
| 201 | - local id = msg.id | |
| 202 | - local count = msg.count or 1 | |
| 203 | - | |
| 204 | - local dataSet = csvdb["shop_diamondCsv"][id] | |
| 205 | - if not dataSet then return 1 end | |
| 206 | - | |
| 207 | - local dailySDC = role.dailyData:getProperty("dailySDC") | |
| 208 | - | |
| 209 | - if math.illegalNum(count, 1, (dataSet.limit == 0 and math.huge or dataSet.limit - (dailySDC[id] or 0))) then return 1 end | |
| 210 | - | |
| 211 | - local cost = dataSet.cost | |
| 212 | - | |
| 213 | - local dailySDD = role.dailyData:getProperty("dailySDD") | |
| 214 | - if dailySDD[id] then -- 折扣 | |
| 215 | - cost = math.ceil(cost * (1 - dataSet.disount / 100)) | |
| 216 | - end | |
| 217 | - | |
| 218 | - if not role:costDiamond({count = cost * count, log = {desc = "dailyShop", int1 = id, int2 = count}}) then | |
| 219 | - return 4 | |
| 220 | - end | |
| 221 | - | |
| 222 | - if dataSet.limit ~= 0 then | |
| 223 | - dailySDC[id] = (dailySDC[id] or 0) + count | |
| 224 | - role.dailyData:updateProperty({field = "dailySDC", value = dailySDC}) | |
| 225 | - end | |
| 226 | - local gift = {} | |
| 227 | - for itemId, count_ in pairs(dataSet.gift:toNumMap()) do | |
| 228 | - gift[itemId] = count_ * count | |
| 229 | - end | |
| 230 | - local reward = role:award(gift, {log = {desc = "dailyShop", int1 = id, int2 = count}}) | |
| 231 | - role:checkTaskEnter("ShopAll", {count = count}) | |
| 232 | - | |
| 233 | - role:log("role_action", {desc = "dailyShop", int1 = id, int2 = count}) | |
| 234 | - | |
| 235 | - SendPacket(actionCodes.Store_dailyBuyRpc, MsgPack.pack({reward = reward})) | |
| 236 | - return true | |
| 237 | -end | |
| 238 | - | |
| 239 | - | |
| 240 | -function _M.dinerBuyRpc(agent , data) | |
| 241 | - local role = agent.role | |
| 242 | - local msg = MsgPack.unpack(data) | |
| 243 | - local id = msg.id | |
| 244 | - local count = msg.count or 1 | |
| 245 | - | |
| 246 | - local dataSet = csvdb["shop_dinerCsv"][id] | |
| 247 | - if not dataSet then return end | |
| 248 | - | |
| 249 | - local dinerS = role:getProperty("dinerS") | |
| 250 | - if math.illegalNum(count, 1, (dataSet.limit == 0 and math.huge or dataSet.limit - (dinerS[id] or 0))) then return 1 end | |
| 251 | - | |
| 252 | - local cost = {[ItemId.DinerCoin] = dataSet.cost * count} | |
| 253 | - if not role:checkItemEnough(cost) then return end | |
| 254 | - | |
| 255 | - if dataSet.limit ~= 0 then | |
| 256 | - dinerS[id] = (dinerS[id] or 0) + count | |
| 257 | - role:updateProperty({field = "dinerS", value = dinerS}) | |
| 258 | - end | |
| 259 | - | |
| 260 | - role:costItems(cost, {log = {desc = "dinerShop", int1 = id, int2 = count}}) | |
| 261 | - | |
| 262 | - local gift = {} | |
| 263 | - for _id, _count in pairs(dataSet.gift:toNumMap()) do | |
| 264 | - gift[_id] = _count * count | |
| 265 | - end | |
| 266 | - local reward = role:award(gift, {log = {desc = "dinerShop", int1 = id, int2 = count}}) | |
| 267 | - | |
| 268 | - role:log("role_action", {desc = "dinerShop", int1 = id, int2 = count}) | |
| 269 | - | |
| 270 | - SendPacket(actionCodes.Store_dinerBuyRpc, MsgPack.pack({reward = reward})) | |
| 271 | - return true | |
| 272 | -end | |
| 273 | - | |
| 274 | 198 | function _M.shopBuyRpc(agent , data) |
| 275 | 199 | local role = agent.role |
| 276 | 200 | local msg = MsgPack.unpack(data) |
| ... | ... | @@ -325,8 +249,17 @@ function _M.shopBuyRpc(agent , data) |
| 325 | 249 | if dataSet.shop == 1 then |
| 326 | 250 | role:checkTaskEnter("ShopAll", {count = count}) |
| 327 | 251 | end |
| 328 | - role:log("role_action", {desc = desc, int1 = id, int2 = count}) | |
| 329 | - | |
| 252 | + local costId, costCount = next(cost) | |
| 253 | + | |
| 254 | + role:log("shop_purchase", { | |
| 255 | + item_id = id, -- 道具id | |
| 256 | + item_type = 0, -- 道具类型,具体见枚举表中道具类型枚举表 | |
| 257 | + item_level = 0, -- 道具等级 | |
| 258 | + item_cnt = count, -- 购买数量技术 | |
| 259 | + currency_type = costId or 0, -- 购买道具消耗的货币类型,记录货币ID | |
| 260 | + shop_purchase_current = costCount or 0, -- 购买道具消耗的货币数量 | |
| 261 | + shop_id = dataSet.shop, -- 商店ID | |
| 262 | + }) | |
| 330 | 263 | SendPacket(actionCodes.Store_shopBuyRpc, MsgPack.pack({reward = reward})) |
| 331 | 264 | return true |
| 332 | 265 | end | ... | ... |
src/models/Activity.lua
| ... | ... | @@ -215,6 +215,13 @@ function Activity:checkWeeklyAct(actType, notify, count, pool) |
| 215 | 215 | end |
| 216 | 216 | if not curData[cfg.id] and curData[0] >= cfg.condition1 then |
| 217 | 217 | if info.mailId then |
| 218 | + | |
| 219 | + self.owner:log("activity", { | |
| 220 | + activity_id = cfg.id, -- 活动ID(或活动指定任务的ID) | |
| 221 | + activity_type = actType, -- 活动类型,见活动类型枚举表 | |
| 222 | + activity_reward = json.encode(cfg.reward:toNumMap()), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
| 223 | + }) | |
| 224 | + | |
| 218 | 225 | self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1}) |
| 219 | 226 | curData[cfg.id] = 1 |
| 220 | 227 | end | ... | ... |
src/models/Diner.lua
src/models/RoleLog.lua
| ... | ... | @@ -119,7 +119,7 @@ local MethodType = { |
| 119 | 119 | onLogout = { -- 登出 |
| 120 | 120 | logtime = true, --登录时长 |
| 121 | 121 | }, |
| 122 | - setLevel = { -- 设置等级 --TODO | |
| 122 | + setLevel = { -- 设置等级 | |
| 123 | 123 | level_before = true, -- 变动前的等级,可以跳级 |
| 124 | 124 | level_changemain = true, -- 等级变动原因,副本通关:mission,领取奖励:reward |
| 125 | 125 | level_changedetail = true, -- 等级变动原因明细,副本通关则记录关卡ID,领取奖励则记录奖励ID |
| ... | ... | @@ -157,7 +157,7 @@ local MethodType = { |
| 157 | 157 | mail_friend_id = true, -- 收件方账号id |
| 158 | 158 | mail_friend_roleid = true, -- 收件方角色id |
| 159 | 159 | }, |
| 160 | - onItems = { --道具流通 --TODO | |
| 160 | + onItems = { --道具流通 | |
| 161 | 161 | item_id = true, -- 道具id |
| 162 | 162 | item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形 |
| 163 | 163 | item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表 |
| ... | ... | @@ -203,13 +203,13 @@ local MethodType = { |
| 203 | 203 | residence_time = true, --挂机或排名时长 |
| 204 | 204 | residence_reward = true, --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} |
| 205 | 205 | }, |
| 206 | - hero_rise = { --英雄觉醒 --TODO | |
| 206 | + hero_rise = { --英雄觉醒 | |
| 207 | 207 | hero_id = true, --英雄ID |
| 208 | 208 | hero_rise_cost = true, --英雄觉醒消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} |
| 209 | 209 | hero_rise_score = true, --英雄觉醒后评分提升 |
| 210 | 210 | hero_rise_result = true, --英雄觉醒效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} |
| 211 | 211 | }, |
| 212 | - hero_upgrade = { --英雄升级 --TODO | |
| 212 | + hero_upgrade = { --英雄升级 | |
| 213 | 213 | hero_id = true, -- 英雄ID |
| 214 | 214 | hero_upgrade_cost = true, -- 英雄升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} |
| 215 | 215 | hero_upgrade_result = true, -- 英雄升级效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} |
| ... | ... | @@ -217,34 +217,34 @@ local MethodType = { |
| 217 | 217 | hero_upgrade_score = true, -- 英雄升级后评分 |
| 218 | 218 | hero_upgrade_scoreget = true, -- 通过英雄升级提升的评分 |
| 219 | 219 | }, |
| 220 | - hero_break = { --英雄突破 --TODO | |
| 220 | + hero_break = { --英雄突破 | |
| 221 | 221 | hero_id = true, -- 英雄ID |
| 222 | 222 | hero_break_cost = true, -- 英雄突破消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} |
| 223 | 223 | hero_break_result = true, -- 英雄突破效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} |
| 224 | 224 | hero_break_level = true, -- 英雄突破后等级上限 |
| 225 | 225 | }, |
| 226 | - hero_talent = { --英雄天赋升级 --TODO | |
| 226 | + hero_talent = { --英雄天赋升级 | |
| 227 | 227 | hero_id = true, -- 英雄ID |
| 228 | 228 | hero_talent_cost = true, -- 英雄天赋升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} |
| 229 | 229 | hero_talent_levelbef = true, -- 英雄技能升级前等级 |
| 230 | 230 | hero_talent_level = true, -- 英雄技能升级后等级 |
| 231 | 231 | }, |
| 232 | - hero_jewel = { --英雄铭文 --TODO | |
| 232 | + hero_jewel = { --英雄铭文 | |
| 233 | 233 | hero_id = true, -- 英雄ID |
| 234 | - hero_jewel_sequence = true, -- 铭文装备编号,用以关联一次装备时产生的多条日志 | |
| 234 | + hero_jewel_sequence = "ucode", -- 铭文装备编号,用以关联一次装备时产生的多条日志 | |
| 235 | 235 | hero_jewel_id = true, -- 铭文ID |
| 236 | 236 | hero_jewel_part = true, -- 铭文装备部位 |
| 237 | 237 | hero_jewel_score = true, -- 铭文装备后的英雄分值 |
| 238 | 238 | hero_jewel_scorebefore = true, -- 铭文装备前的英雄分值 |
| 239 | 239 | hero_jewel_result = true, -- 铭文装备后效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} |
| 240 | 240 | }, |
| 241 | - hero_note = { --英雄评价 --TODO | |
| 241 | + hero_note = { --英雄评价 | |
| 242 | 242 | hero_id = true, -- 英雄ID |
| 243 | 243 | hero_note_action = true, -- 英雄评价界面操作,发布评论:0,点赞:1,反对:2 |
| 244 | 244 | hero_note_id = true, -- 操作的评价ID |
| 245 | 245 | hero_note_text = true, -- 操作的评价内容 |
| 246 | 246 | }, |
| 247 | - hero_show = { --展示英雄 --TODO | |
| 247 | + hero_show = { --展示英雄 | |
| 248 | 248 | hero_id = true, -- 英雄ID |
| 249 | 249 | }, |
| 250 | 250 | hero_recycle = { --英雄回收 |
| ... | ... | @@ -252,17 +252,15 @@ local MethodType = { |
| 252 | 252 | hero_recycle_reward = true, -- 回收后获得的奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} |
| 253 | 253 | hero_recycle_cnt = true, -- 总回收英雄量 |
| 254 | 254 | }, |
| 255 | - gacha = { --英雄招募 --TODO | |
| 255 | + gacha = { --英雄招募 | |
| 256 | 256 | gacha_id = true, -- 卡池ID |
| 257 | 257 | gacha_type = true, -- 卡池类型 |
| 258 | 258 | gacha_up = true, -- 卡池UP角色 |
| 259 | 259 | gacha_times = true, -- 抽卡次数 |
| 260 | 260 | gacha_reward = true, -- 抽卡结果,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} |
| 261 | - currency_type = true, -- 购买道具消耗的货币类型,记录货币ID | |
| 262 | - gacha_current = true, -- 购买道具消耗的货币数量 | |
| 263 | - gacha_cnt = true, -- 此卡池内的计数器 | |
| 261 | + currency = true, -- 消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} | |
| 264 | 262 | }, |
| 265 | - equip_wear = { --装备穿戴与卸载 --TODO | |
| 263 | + equip_wear = { --装备穿戴与卸载 | |
| 266 | 264 | hero_id = true, --英雄ID |
| 267 | 265 | equip_id = true, --装备ID |
| 268 | 266 | equip_wear_action = true, --装备操作类型:装备:0,卸载:1 |
| ... | ... | @@ -270,19 +268,17 @@ local MethodType = { |
| 270 | 268 | equip_wear_result = true, --装备操作后结果,记录属性变化,json格式记录,{“aa”:1234,"bb":4567} |
| 271 | 269 | equip_wear_change = true, --装备操作变化值,记录属性变化,记录正负值,json格式记录,{“aa”:1234,"bb":-45} |
| 272 | 270 | equip_wear_mode = true, --用以区分自动装备还是手动装备,自动记录为0,手动记录为1 |
| 273 | - equip_wear_seqid = true, --自动穿戴时记录的系列ID,用以关联一次性装备时候产生的多条记录 | |
| 271 | + equip_wear_seqid = "ucode", --自动穿戴时记录的系列ID,用以关联一次性装备时候产生的多条记录 | |
| 274 | 272 | }, |
| 275 | - equip_upgrade = { --装备升级 --TODO | |
| 276 | - hero_id = true, -- 英雄ID | |
| 273 | + equip_upgrade = { --装备升级 | |
| 277 | 274 | equip_upgrade_part = true, -- 升级部位,记录部位ID |
| 278 | 275 | equip_id = true, -- 升级后的装备ID |
| 279 | 276 | equip_upgrade_amount = true, -- 升级获取的装备数量 |
| 280 | 277 | equip_upgrade_usedid = true, -- 升级消耗的装备ID |
| 281 | 278 | equip_upgrade_cost = true, -- 升级操作消耗装备数量 |
| 282 | - equip_upgrade_currentid = true, -- 升级消耗的货币类型 | |
| 283 | 279 | equip_upgrade_current = true, -- 升级操作消耗货币数量 |
| 284 | 280 | }, |
| 285 | - carriage_dismantle = { --物资拆解 --TODO | |
| 281 | + carriage_dismantle = { --物资拆解 | |
| 286 | 282 | item_id = true, -- 道具id |
| 287 | 283 | item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形 |
| 288 | 284 | item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表 |
| ... | ... | @@ -293,14 +289,14 @@ local MethodType = { |
| 293 | 289 | carriage_dismantle_cost = true, -- 拆解花费钥匙数量,未使用填写0 |
| 294 | 290 | carriage_dismantle_rwd = true, -- 拆解获得物资,json格式记录,{'itemid1':2,'itemid2':3,…………..} |
| 295 | 291 | }, |
| 296 | - carriage_logistics = { --后勤室 --TODO | |
| 292 | + carriage_logistics = { --后勤室 | |
| 297 | 293 | carriage_logistics_type = true, -- 后勤室制作类型ID,变异:0,通常:1,魔法:2 |
| 298 | 294 | carriage_logistics_itemid = true, -- 后勤室升级物品或技能ID |
| 299 | 295 | carriage_logistics_itemlv = true, -- 升级后物品或技能等级 |
| 300 | 296 | carriage_logistics_gear = true, -- 后勤室升级花费齿轮数量 |
| 301 | 297 | carriage_logistics_coin = true, -- 后勤室升级花费美食币数量 |
| 302 | 298 | }, |
| 303 | - carriage_decals = { --贴纸拆解 --TODO | |
| 299 | + carriage_decals = { --贴纸拆解 | |
| 304 | 300 | item_id = true, --道具id |
| 305 | 301 | item_sequenceid = "ucode", --道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形 |
| 306 | 302 | item_type = true, --道具类型,具体见枚举表中道具类型枚举表 |
| ... | ... | @@ -309,31 +305,31 @@ local MethodType = { |
| 309 | 305 | carriage_decals_rwdid = true, --拆解获得物资ID |
| 310 | 306 | carriage_decals_rwdnum = true, --拆解获得物资数量 |
| 311 | 307 | }, |
| 312 | - carriage_video = { --放映室 --TODO | |
| 308 | + carriage_video = { --放映室 | |
| 313 | 309 | carriage_video_type = true, --放映室类型,剧情CG:0, 角色CG:1, 主线剧情:2, 角色剧情:3, 活动剧情:4, 图鉴:5 |
| 314 | 310 | carriage_video_id = true, --放映室片段ID |
| 315 | 311 | carriage_video_coinid = true, --放映奖励货币类型,无奖励则填写0 |
| 316 | 312 | carriage_video_coinnum = true, --放映奖励货币数量,无奖励则填写0 |
| 317 | 313 | carriage_video_item = true, --放映奖励其他物品数量,json格式记录,{'itemid1':10,'itemid2':5,…………..},无奖励则填写0 |
| 318 | 314 | }, |
| 319 | - carriage_cook = { --调理室 --TODO | |
| 315 | + carriage_cook = { --调理室 | |
| 320 | 316 | item_id = true, -- 道具id |
| 321 | 317 | item_level = true, -- 道具等级 |
| 322 | 318 | item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表 |
| 323 | 319 | carriage_cook_amount = true, -- 制作总量 |
| 324 | 320 | carriage_cook_cost = true, -- 制作消耗道具,json格式记录,{'itemid1':10,'itemid2':5,…………..} |
| 325 | 321 | }, |
| 326 | - activity = { --活动或指南奖励 --TODO | |
| 322 | + activity = { --活动或指南奖励 | |
| 327 | 323 | activity_id = true, -- 活动ID(或活动指定任务的ID) |
| 328 | 324 | activity_type = true, -- 活动类型,见活动类型枚举表 |
| 329 | 325 | activity_reward = true, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} |
| 330 | 326 | }, |
| 331 | - task_reward = { --任务奖励 --TODO | |
| 327 | + task_reward = { --任务奖励 | |
| 332 | 328 | task_reward_id = true, --任务奖励ID |
| 333 | 329 | task_reward_type = true, --任务奖励类型,见 任务奖励类型枚举表 |
| 334 | 330 | task_reward_detail = true, --任务奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} |
| 335 | 331 | }, |
| 336 | - shop_purchase = { --商店购买行为 --TODO | |
| 332 | + shop_purchase = { --商店购买行为 | |
| 337 | 333 | item_id = true, -- 道具id |
| 338 | 334 | item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个购买礼包多个物品等情形 |
| 339 | 335 | item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表 |
| ... | ... | @@ -343,7 +339,13 @@ local MethodType = { |
| 343 | 339 | shop_purchase_current = true, -- 购买道具消耗的货币数量 |
| 344 | 340 | shop_id = true, -- 商店ID |
| 345 | 341 | }, |
| 346 | - friend_opt = { --好友操作 --TODO | |
| 342 | + --[[ | |
| 343 | + 100 添加好友 | |
| 344 | + 200 删除好友 | |
| 345 | + 300 屏蔽/拉黑 | |
| 346 | + 1000 其他 | |
| 347 | + --]] | |
| 348 | + friend_opt = { --好友操作 | |
| 347 | 349 | friend_opt_type = true, -- 好友操作类型,见枚举表中 好友操作类型枚举表 |
| 348 | 350 | friend_accountid = true, -- 好友账户id |
| 349 | 351 | friend_roleid = true, -- 好友账户下的角色id |
| ... | ... | @@ -357,21 +359,20 @@ local MethodType = { |
| 357 | 359 | friend_accountid = true, -- 好友账户id |
| 358 | 360 | friend_roleid = true, -- 好友账户下的角色id |
| 359 | 361 | }, |
| 360 | - communication = { --玩家发言 --TODO | |
| 362 | + communication = { --玩家发言 | |
| 361 | 363 | publish_type = true, --发言类型,全部:0,公告:1,世界:2,联盟:3,私聊:4 |
| 362 | 364 | publish_status = true, --发送状态,发送成功:0,发送失败:1,被屏蔽:2,其他:3 |
| 363 | - publish_receive_accid = true, --接收者账户ID | |
| 364 | 365 | publish_receive_roleid = true, --接收者角色ID |
| 365 | 366 | publish_text = true, --发言内容 |
| 366 | 367 | }, |
| 367 | - restaurant_up = { --摊位升级 --TODO | |
| 368 | + restaurant_up = { --摊位升级 | |
| 368 | 369 | restaurant_up_type = true, --升级部件类型,店面:0, 接客:1, 满意度:2, 宣传:3, 广告:4, 周边:5 |
| 369 | 370 | restaurant_up_gear = true, --消耗齿轮数量 |
| 370 | 371 | restaurant_up_coin = true, --花费美食币数量 |
| 371 | 372 | restaurant_up_effectbef = true, --升级前加成 |
| 372 | 373 | restaurant_up_effect = true, --升级后加成 |
| 373 | 374 | }, |
| 374 | - restaurant_sale = { --摊位售卖 --TODO | |
| 375 | + restaurant_sale = { --摊位售卖 | |
| 375 | 376 | item_id = true, -- 售卖物品ID |
| 376 | 377 | restaurant_sale_seat = true, -- 售卖物品所在位置 |
| 377 | 378 | restaurant_sale_time = true, -- 售卖时长 |
| ... | ... | @@ -379,34 +380,30 @@ local MethodType = { |
| 379 | 380 | restaurant_sale_coin = true, -- 售卖获得美食币 |
| 380 | 381 | restaurant_sale_gear = true, -- 售卖获得齿轮 |
| 381 | 382 | }, |
| 382 | - restaurant_material = { --食材获取 --TODO | |
| 383 | + restaurant_material = { --食材获取 | |
| 383 | 384 | item_id = true, -- 获取物品ID |
| 384 | - restaurant_material_seqid = true, -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一次获取两件道具情况 | |
| 385 | + restaurant_material_seqid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一次获取两件道具情况 | |
| 385 | 386 | restaurant_material_start = true, -- 申请获取时间 |
| 386 | 387 | restaurant_material_time = true, -- 申请到领取耗时 |
| 387 | 388 | restaurant_material_num = true, -- 获取物品数量 |
| 388 | 389 | }, |
| 389 | - restaurant_order = { --订单任务 --TODO | |
| 390 | + restaurant_order = { --订单任务 | |
| 390 | 391 | restaurant_order_id = true, -- 订单任务ID |
| 391 | 392 | restaurant_order_status = true, -- 订单任务状态,接受:0, 拒绝:1, 完成:2 |
| 392 | - restaurant_order_start = true, -- 订单接收时间,timestamp格式记录 | |
| 393 | 393 | restaurant_order_rwd = true, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} |
| 394 | 394 | restaurant_order_lv = true, -- 订单品质等级,普通:0, 稀有:1, 顶级:2, 豪华:3 |
| 395 | 395 | }, |
| 396 | - restaurant_collect = { --餐厅顾客图谱 --TODO | |
| 396 | + restaurant_collect = { --餐厅顾客图谱 | |
| 397 | 397 | restaurant_collect_id = true, -- 图谱收集ID |
| 398 | 398 | restaurant_collect_rwd = true, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} |
| 399 | 399 | restaurant_collect_plan = true, -- 收集进度,即解锁顾客,数字表示 |
| 400 | 400 | }, |
| 401 | - achievement = { --成就达成 --TODO | |
| 401 | + achievement = { --成就达成 | |
| 402 | 402 | achievement_id = true, -- 成就id |
| 403 | 403 | achievement_type = true, -- 成就类型,具体枚举表中成就类型枚举表 |
| 404 | - achievement_name = true, -- 成就名称 | |
| 405 | - achievement_score = true, -- 领取成就后成就点数 | |
| 406 | - achievement_subscore = true, -- 领取成就后小类成就点数 | |
| 407 | 404 | achievement_reward = true, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} |
| 408 | 405 | }, |
| 409 | - get_gift = { --礼包兑换 --TODO | |
| 406 | + get_gift = { --礼包兑换 | |
| 410 | 407 | gift_id = true, -- 礼包ID |
| 411 | 408 | gift_key = true, -- 礼包key |
| 412 | 409 | gift_reward = true, -- 礼包奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} |
| ... | ... | @@ -493,7 +490,14 @@ function RoleLog.bind(Role) |
| 493 | 490 | pcall(skynet.send, logd, "lua", "log", doc) |
| 494 | 491 | end |
| 495 | 492 | |
| 496 | - function Role:logItems(itemId, before, after, reason, subreason, other) | |
| 493 | + function Role:logItems(itemId, before, after, log) | |
| 494 | + if not log then | |
| 495 | + print("logItems no log ", debug.traceback()) | |
| 496 | + end | |
| 497 | + local reason = log.desc | |
| 498 | + local subreason = log.int1 or 0 | |
| 499 | + local other = log.int2 or 0 | |
| 500 | + | |
| 497 | 501 | local reasonType = ItemReason[reason] |
| 498 | 502 | if not reasonType then |
| 499 | 503 | printError(string.format("LOG ERROR: onItems no reasonType [%s].", reason)) | ... | ... |
src/models/RolePlugin.lua
| ... | ... | @@ -258,12 +258,7 @@ function RolePlugin.bind(Role) |
| 258 | 258 | items = items:incrv(params.itemId, params.count) |
| 259 | 259 | end |
| 260 | 260 | |
| 261 | - if params.log then | |
| 262 | - local log = params.log | |
| 263 | - self:logItems(params.itemId, origin, nums, log.desc, log.sub, log.other) | |
| 264 | - else | |
| 265 | - print("addItem no log ", debug.traceback()) | |
| 266 | - end | |
| 261 | + self:logItems(params.itemId, origin, nums, params.log) | |
| 267 | 262 | |
| 268 | 263 | self:setProperty("items", items) |
| 269 | 264 | if not params.notNotify then |
| ... | ... | @@ -333,13 +328,7 @@ function RolePlugin.bind(Role) |
| 333 | 328 | self:incrProperty("diamond", count) |
| 334 | 329 | end |
| 335 | 330 | |
| 336 | - if params.log then | |
| 337 | - local log = clone(params.log) | |
| 338 | - self:logItems(ItemId.Diamond, origin, count, log.desc, log.sub, log.other) | |
| 339 | - else | |
| 340 | - print("gainDiamond no log ", debug.traceback()) | |
| 341 | - end | |
| 342 | - | |
| 331 | + self:logItems(ItemId.Diamond, origin, count, params.log) | |
| 343 | 332 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) |
| 344 | 333 | return true |
| 345 | 334 | end |
| ... | ... | @@ -377,12 +366,8 @@ function RolePlugin.bind(Role) |
| 377 | 366 | self:incrProperty(costFirst[2], -last) |
| 378 | 367 | end |
| 379 | 368 | |
| 380 | - if params.log then | |
| 381 | - local log = clone(params.log) | |
| 382 | - self:logItems(ItemId.Diamond, origin, count, log.desc, log.sub, log.other) | |
| 383 | - else | |
| 384 | - print("costDiamond no log ", debug.traceback()) | |
| 385 | - end | |
| 369 | + | |
| 370 | + self:logItems(ItemId.Diamond, origin, count, params.log) | |
| 386 | 371 | |
| 387 | 372 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) |
| 388 | 373 | return true |
| ... | ... | @@ -418,12 +403,9 @@ function RolePlugin.bind(Role) |
| 418 | 403 | local bin = MsgPack.pack(heroResponse) |
| 419 | 404 | SendPacket(actionCodes.Hero_loadInfos, bin) |
| 420 | 405 | end |
| 421 | - if params.log then | |
| 422 | - local log = clone(params.log) | |
| 423 | - self:logItems(heroType + ItemStartId.Hero, 0, 1, log.desc, log.sub, log.other) | |
| 424 | - else | |
| 425 | - print("addHero no log ", debug.traceback()) | |
| 426 | - end | |
| 406 | + | |
| 407 | + self:logItems(heroType + ItemStartId.Hero, 0, 1, params.log) | |
| 408 | + | |
| 427 | 409 | return true, newHero |
| 428 | 410 | end |
| 429 | 411 | |
| ... | ... | @@ -514,7 +496,8 @@ function RolePlugin.bind(Role) |
| 514 | 496 | if not equipCsv then return end |
| 515 | 497 | local equips = self:getProperty("equips") |
| 516 | 498 | local curTypeEquips = equips[equipType] or {} |
| 517 | - local curCount = (curTypeEquips[equipLv] or 0) + count | |
| 499 | + local oldCount = curTypeEquips[equipLv] or 0 | |
| 500 | + local curCount = oldCount + count | |
| 518 | 501 | |
| 519 | 502 | -- 是否足够上层判断 |
| 520 | 503 | if curCount < 0 then |
| ... | ... | @@ -532,22 +515,7 @@ function RolePlugin.bind(Role) |
| 532 | 515 | |
| 533 | 516 | self:setProperty("equips", equips) |
| 534 | 517 | |
| 535 | - if pms.log then | |
| 536 | - local log = clone(pms.log) | |
| 537 | - if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 538 | - print("addEquip error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 539 | - end | |
| 540 | - log["cint1"] = equipType | |
| 541 | - log["cint2"] = equipLv | |
| 542 | - log["cint3"] = math.abs(count) | |
| 543 | - if count < 0 then | |
| 544 | - self:log("out_equip", log) | |
| 545 | - else | |
| 546 | - self:log("in_equip", log) | |
| 547 | - end | |
| 548 | - else | |
| 549 | - print("addEquip no log ", debug.traceback()) | |
| 550 | - end | |
| 518 | + self:logItems(equipCsv.id, oldCount, curCount, pms.log) | |
| 551 | 519 | |
| 552 | 520 | if not pms.notNotify then |
| 553 | 521 | self:changeUpdates({{type = "equips", field = {equipType, equipLv}, value = curCount, isOnlyToC = true}}) -- 通知客户端 |
| ... | ... | @@ -607,20 +575,7 @@ function RolePlugin.bind(Role) |
| 607 | 575 | end |
| 608 | 576 | self:checkTaskEnter("AddRune", {id = params.id, type = params.type, rarity = data.rarity}, params.notNotify) |
| 609 | 577 | |
| 610 | - if params.log then | |
| 611 | - local log = clone(params.log) | |
| 612 | - if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 613 | - print("addRune error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 614 | - end | |
| 615 | - | |
| 616 | - log["cint1"] = runeUid | |
| 617 | - log["cint2"] = params.type | |
| 618 | - log["cint3"] = params.id | |
| 619 | - | |
| 620 | - self:log("in_rune", log) | |
| 621 | - else | |
| 622 | - print("addRune no log ", debug.traceback()) | |
| 623 | - end | |
| 578 | + self:logItems(params.id, 0, 1, params.log) | |
| 624 | 579 | |
| 625 | 580 | return 0, newRune |
| 626 | 581 | else |
| ... | ... | @@ -636,20 +591,7 @@ function RolePlugin.bind(Role) |
| 636 | 591 | local rune = self.runeBag[runeId] |
| 637 | 592 | if rune and rune:getProperty("refer") == 0 then |
| 638 | 593 | |
| 639 | - if params.log then | |
| 640 | - local log = clone(params.log) | |
| 641 | - if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 642 | - print("delRunes error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 643 | - end | |
| 644 | - | |
| 645 | - log["cint1"] = runeId | |
| 646 | - log["cint2"] = rune:getProperty("type") | |
| 647 | - log["cint3"] = rune:getProperty("id") | |
| 648 | - | |
| 649 | - self:log("out_rune", log) | |
| 650 | - else | |
| 651 | - print("delRunes no log ", debug.traceback()) | |
| 652 | - end | |
| 594 | + self:logItems(rune:getProperty("id"), 1, 0, params.log) | |
| 653 | 595 | |
| 654 | 596 | self.runeBag[runeId] = nil |
| 655 | 597 | table.insert(bDel, runeId) |
| ... | ... | @@ -895,19 +837,7 @@ function RolePlugin.bind(Role) |
| 895 | 837 | |
| 896 | 838 | count = count or 1 |
| 897 | 839 | |
| 898 | - if params.log then | |
| 899 | - local log = clone(params.log) | |
| 900 | - if log["cint1"] or log["cint2"] or log["cint3"] then | |
| 901 | - print("funcOpen error log have cint1 or cint2 or cint3 ", debug.traceback()) | |
| 902 | - end | |
| 903 | - | |
| 904 | - log["cint1"] = func | |
| 905 | - log["cint2"] = count | |
| 906 | - | |
| 907 | - self:log("func_open", log) | |
| 908 | - else | |
| 909 | - print("funcOpen no log ", debug.traceback()) | |
| 910 | - end | |
| 840 | + self:logItems(equipCsv.id, 0, count, params.log) | |
| 911 | 841 | |
| 912 | 842 | if csvdb["itemCsv"][func] and csvdb["itemCsv"][func].type == ItemType.FuncOpen then |
| 913 | 843 | local unlockData = csvdb["unlockCsv"][func] | ... | ... |