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,7 +65,11 @@ function _M.sudokuRpc(agent, data) | ||
65 | 65 | ||
66 | role:updateProperty({field = "sudoku", value = sudoku}) | 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 | SendPacket(actionCodes.Activity_sudokuRpc, MsgPack.pack({task = role:packReward(task, tchange), reward = role:packReward(reward, rchange), rId = rId})) | 74 | SendPacket(actionCodes.Activity_sudokuRpc, MsgPack.pack({task = role:packReward(task, tchange), reward = role:packReward(reward, rchange), rId = rId})) |
71 | return true | 75 | return true |
@@ -100,6 +104,12 @@ function _M.sudokuRewardRpc(agent, data) | @@ -100,6 +104,12 @@ function _M.sudokuRewardRpc(agent, data) | ||
100 | end | 104 | end |
101 | role:updateProperty({field = "sudoku", value = sudoku}) | 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 | SendPacket(actionCodes.Activity_sudokuRewardRpc, MsgPack.pack(role:packReward(reward, change))) | 113 | SendPacket(actionCodes.Activity_sudokuRewardRpc, MsgPack.pack(role:packReward(reward, change))) |
104 | return true | 114 | return true |
105 | end | 115 | end |
@@ -156,6 +166,13 @@ function _M.actSignRpc(agent, data) | @@ -156,6 +166,13 @@ function _M.actSignRpc(agent, data) | ||
156 | role.activity:updateActData("Sign", curData) | 166 | role.activity:updateActData("Sign", curData) |
157 | reward, change = role:award(reward, {log = {desc = "actSign"}}) | 167 | reward, change = role:award(reward, {log = {desc = "actSign"}}) |
158 | end | 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 | SendPacket(actionCodes.Activity_actSignRpc, MsgPack.pack(role:packReward(reward, change))) | 176 | SendPacket(actionCodes.Activity_actSignRpc, MsgPack.pack(role:packReward(reward, change))) |
160 | return true | 177 | return true |
161 | end | 178 | end |
src/actions/CarAction.lua
@@ -41,6 +41,13 @@ function _M.makePotionRpc( agent, data ) | @@ -41,6 +41,13 @@ function _M.makePotionRpc( agent, data ) | ||
41 | role:checkTaskEnter("PotionMake", {count = count, id = potionId}) | 41 | role:checkTaskEnter("PotionMake", {count = count, id = potionId}) |
42 | 42 | ||
43 | role:log("role_action", {desc = "makePotion", int1 = potionId, int2 = count}) | 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 | SendPacket(actionCodes.Car_makePotionRpc, MsgPack.pack({potionBag = potionBag})) | 51 | SendPacket(actionCodes.Car_makePotionRpc, MsgPack.pack({potionBag = potionBag})) |
45 | return true | 52 | return true |
46 | end | 53 | end |
@@ -91,7 +98,14 @@ function _M.equipUpRpc( agent, data ) | @@ -91,7 +98,14 @@ function _M.equipUpRpc( agent, data ) | ||
91 | role:addEquip(typ, nextLv ,count, {log = {desc = "equipUp"}}) | 98 | role:addEquip(typ, nextLv ,count, {log = {desc = "equipUp"}}) |
92 | role:checkTaskEnter("EquipUp", {count = count}) | 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 | SendPacket(actionCodes.Car_equipUpRpc, '') | 110 | SendPacket(actionCodes.Car_equipUpRpc, '') |
97 | return true | 111 | return true |
src/actions/DinerAction.lua
@@ -140,7 +140,7 @@ function _M.removeSellRpc( agent, data ) | @@ -140,7 +140,7 @@ function _M.removeSellRpc( agent, data ) | ||
140 | return 5 | 140 | return 5 |
141 | end | 141 | end |
142 | 142 | ||
143 | - role.dinerData:updateSell(slot) | 143 | + local temp = role.dinerData:updateSell(slot) |
144 | local reward, change = {} | 144 | local reward, change = {} |
145 | local cost = dishData.material:toNumMap() | 145 | local cost = dishData.material:toNumMap() |
146 | for k, n in pairs(cost) do | 146 | for k, n in pairs(cost) do |
@@ -150,7 +150,14 @@ function _M.removeSellRpc( agent, data ) | @@ -150,7 +150,14 @@ function _M.removeSellRpc( agent, data ) | ||
150 | reward, change = role:award(reward, {log = {desc = "removeSell"}}) | 150 | reward, change = role:award(reward, {log = {desc = "removeSell"}}) |
151 | sells[slot].count = 0 | 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 | role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) | 162 | role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) |
156 | SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward, change = change})) | 163 | SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward, change = change})) |
@@ -162,8 +169,11 @@ function _M.getSellRewardRpc( agent, data ) | @@ -162,8 +169,11 @@ function _M.getSellRewardRpc( agent, data ) | ||
162 | local dirty = false | 169 | local dirty = false |
163 | local reward, popular = "", 0 | 170 | local reward, popular = "", 0 |
164 | local sells = json.decode(role.dinerData:getProperty("sells")) | 171 | local sells = json.decode(role.dinerData:getProperty("sells")) |
172 | + | ||
173 | + local deltaTimes = {} | ||
165 | for slot, _ in pairs(sells) do | 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 | end | 177 | end |
168 | sells = json.decode(role.dinerData:getProperty("sells")) | 178 | sells = json.decode(role.dinerData:getProperty("sells")) |
169 | for slot, sell in pairs(sells) do | 179 | for slot, sell in pairs(sells) do |
@@ -187,6 +197,15 @@ function _M.getSellRewardRpc( agent, data ) | @@ -187,6 +197,15 @@ function _M.getSellRewardRpc( agent, data ) | ||
187 | end | 197 | end |
188 | sells[slot].reward = "" | 198 | sells[slot].reward = "" |
189 | sells[slot].popular = 0 | 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 | end | 209 | end |
191 | role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) | 210 | role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) |
192 | local gift = reward:toNumMap() | 211 | local gift = reward:toNumMap() |
@@ -204,7 +223,7 @@ function _M.getSellRewardRpc( agent, data ) | @@ -204,7 +223,7 @@ function _M.getSellRewardRpc( agent, data ) | ||
204 | role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) | 223 | role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) |
205 | end | 224 | end |
206 | 225 | ||
207 | - role:log("diner_action", {desc = "sell"}) | 226 | + |
208 | 227 | ||
209 | SendPacket(actionCodes.Diner_getSellRewardRpc, MsgPack.pack({reward = reward, change = change})) | 228 | SendPacket(actionCodes.Diner_getSellRewardRpc, MsgPack.pack({reward = reward, change = change})) |
210 | return true | 229 | return true |
@@ -254,6 +273,15 @@ function _M.expediteSellRpc( agent, data ) | @@ -254,6 +273,15 @@ function _M.expediteSellRpc( agent, data ) | ||
254 | dirty = true | 273 | dirty = true |
255 | end | 274 | end |
256 | end | 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 | end | 285 | end |
258 | end | 286 | end |
259 | 287 | ||
@@ -325,7 +353,13 @@ function _M.levelUpRpc( agent, data ) | @@ -325,7 +353,13 @@ function _M.levelUpRpc( agent, data ) | ||
325 | role.dinerData:updateProperty({field = "buildL", value = buildL:setv(index, curLevel + 1)}) | 353 | role.dinerData:updateProperty({field = "buildL", value = buildL:setv(index, curLevel + 1)}) |
326 | role:checkTaskEnter("DinerLevelUp", {type = index, level = curLevel + 1}) | 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 | SendPacket(actionCodes.Diner_levelUpRpc, '') | 364 | SendPacket(actionCodes.Diner_levelUpRpc, '') |
331 | return true | 365 | return true |
@@ -409,7 +443,13 @@ function _M.talentUpRpc( agent, data ) | @@ -409,7 +443,13 @@ function _M.talentUpRpc( agent, data ) | ||
409 | role:checkTaskEnter("DinerTalentUp", {type = talentData.effect:toArray(true,"=")[1], level = dishLevel + 1}) | 443 | role:checkTaskEnter("DinerTalentUp", {type = talentData.effect:toArray(true,"=")[1], level = dishLevel + 1}) |
410 | role:finishGuide(27) | 444 | role:finishGuide(27) |
411 | role:log("diner_action", {desc = "talentUp", int1 = dish, int2 = dishLevel + 1}) | 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 | SendPacket(actionCodes.Diner_talentUpRpc, '') | 453 | SendPacket(actionCodes.Diner_talentUpRpc, '') |
414 | return true | 454 | return true |
415 | end | 455 | end |
@@ -509,8 +549,6 @@ function _M.updateTaskRpc( agent, data ) | @@ -509,8 +549,6 @@ function _M.updateTaskRpc( agent, data ) | ||
509 | orders[index].status = 1 | 549 | orders[index].status = 1 |
510 | orders[index].lock = 1 | 550 | orders[index].lock = 1 |
511 | 551 | ||
512 | - role:log("diner_action", {desc = "getTask", int1 = order.id}) | ||
513 | - | ||
514 | role:checkTaskEnter("GetOderTask", {rarity = taskSet.rarity}) | 552 | role:checkTaskEnter("GetOderTask", {rarity = taskSet.rarity}) |
515 | elseif cmd == 1 then | 553 | elseif cmd == 1 then |
516 | if order.status ~= 1 then | 554 | if order.status ~= 1 then |
@@ -519,8 +557,6 @@ function _M.updateTaskRpc( agent, data ) | @@ -519,8 +557,6 @@ function _M.updateTaskRpc( agent, data ) | ||
519 | orders[index].status = 0 | 557 | orders[index].status = 0 |
520 | orders[index].lock = 0 | 558 | orders[index].lock = 0 |
521 | 559 | ||
522 | - role:log("diner_action", {desc = "deleteTask", int1 = order.id}) | ||
523 | - | ||
524 | elseif cmd == 2 then | 560 | elseif cmd == 2 then |
525 | if order.status ~= 1 then | 561 | if order.status ~= 1 then |
526 | return 32 | 562 | return 32 |
@@ -528,7 +564,6 @@ function _M.updateTaskRpc( agent, data ) | @@ -528,7 +564,6 @@ function _M.updateTaskRpc( agent, data ) | ||
528 | if order.n < taskData.value then | 564 | if order.n < taskData.value then |
529 | return 6 | 565 | return 6 |
530 | end | 566 | end |
531 | - role:log("diner_action", {desc = "finishTask", int1 = order.id}) | ||
532 | 567 | ||
533 | reward, change = role:award(taskData.reward, {log = {desc = "dinerFinishTask", int1 = order.id}}) | 568 | reward, change = role:award(taskData.reward, {log = {desc = "dinerFinishTask", int1 = order.id}}) |
534 | table.remove(orders,index) | 569 | table.remove(orders,index) |
@@ -537,6 +572,14 @@ function _M.updateTaskRpc( agent, data ) | @@ -537,6 +572,14 @@ function _M.updateTaskRpc( agent, data ) | ||
537 | return 33 | 572 | return 33 |
538 | end | 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 | role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) | 583 | role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) |
541 | SendPacket(actionCodes.Diner_updateTaskRpc, MsgPack.pack({reward = reward, change = change})) | 584 | SendPacket(actionCodes.Diner_updateTaskRpc, MsgPack.pack({reward = reward, change = change})) |
542 | return true | 585 | return true |
@@ -687,12 +730,19 @@ function _M.getGreenhouseRpc( agent, data ) | @@ -687,12 +730,19 @@ function _M.getGreenhouseRpc( agent, data ) | ||
687 | else | 730 | else |
688 | gfood[k].st = st + speed * reward[itemId] | 731 | gfood[k].st = st + speed * reward[itemId] |
689 | end | 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 | end | 741 | end |
691 | role.dinerData:updateProperty({field = "gfood", value = gfood}) | 742 | role.dinerData:updateProperty({field = "gfood", value = gfood}) |
692 | local reward, change = role:award(reward, {log = {desc = "greenHourse", int1 = level}}) | 743 | local reward, change = role:award(reward, {log = {desc = "greenHourse", int1 = level}}) |
693 | role:checkTaskEnter("FoodMGet") | 744 | role:checkTaskEnter("FoodMGet") |
694 | 745 | ||
695 | - role:log("diner_action", {desc = "greenHourse"}) | ||
696 | 746 | ||
697 | SendPacket(actionCodes.Diner_getGreenhouseRpc, MsgPack.pack({reward = reward, change = change})) | 747 | SendPacket(actionCodes.Diner_getGreenhouseRpc, MsgPack.pack({reward = reward, change = change})) |
698 | return true | 748 | return true |
@@ -858,7 +908,17 @@ function _M.collectRpc(agent , data) | @@ -858,7 +908,17 @@ function _M.collectRpc(agent , data) | ||
858 | local reward, change = role:award(customerData.reward, {log = {desc = "dinerCollect", int1 = id}}) | 908 | local reward, change = role:award(customerData.reward, {log = {desc = "dinerCollect", int1 = id}}) |
859 | customer[id] = 1 | 909 | customer[id] = 1 |
860 | role.dinerData:updateProperty({field = "customer", value = customer}) -- 解锁了 | 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 | SendPacket(actionCodes.Diner_collectRpc, MsgPack.pack({reward = reward, change = change})) | 923 | SendPacket(actionCodes.Diner_collectRpc, MsgPack.pack({reward = reward, change = change})) |
864 | return true | 924 | return true |
src/actions/FriendAction.lua
@@ -217,6 +217,7 @@ local function checkHandleApply(roleId, objectId, needAddNew) | @@ -217,6 +217,7 @@ local function checkHandleApply(roleId, objectId, needAddNew) | ||
217 | red:sismember(FRIEND_BLACK_KEY:format(objectId), roleId) | 217 | red:sismember(FRIEND_BLACK_KEY:format(objectId), roleId) |
218 | red:sismember(FRIEND_BLACK_KEY:format(roleId), objectId) | 218 | red:sismember(FRIEND_BLACK_KEY:format(roleId), objectId) |
219 | end) | 219 | end) |
220 | + | ||
220 | --自己好友满了 | 221 | --自己好友满了 |
221 | if (redret[1] + needAddNew) >= globalCsv.friendListLimit then | 222 | if (redret[1] + needAddNew) >= globalCsv.friendListLimit then |
222 | return 1 | 223 | return 1 |
@@ -233,6 +234,8 @@ local function checkHandleApply(roleId, objectId, needAddNew) | @@ -233,6 +234,8 @@ local function checkHandleApply(roleId, objectId, needAddNew) | ||
233 | if redret[4] == 1 then | 234 | if redret[4] == 1 then |
234 | return 4 | 235 | return 4 |
235 | end | 236 | end |
237 | + | ||
238 | + return nil, redret[1] | ||
236 | end | 239 | end |
237 | 240 | ||
238 | function _M.handleApplyRpc(agent, data) | 241 | function _M.handleApplyRpc(agent, data) |
@@ -251,7 +254,8 @@ function _M.handleApplyRpc(agent, data) | @@ -251,7 +254,8 @@ function _M.handleApplyRpc(agent, data) | ||
251 | if not redisproxy:zscore(FRIEND_APPLY_KEY:format(roleId), objectId) then | 254 | if not redisproxy:zscore(FRIEND_APPLY_KEY:format(roleId), objectId) then |
252 | return | 255 | return |
253 | end | 256 | end |
254 | - result = checkHandleApply(roleId, objectId) | 257 | + local curCount |
258 | + result, curCount = checkHandleApply(roleId, objectId) | ||
255 | 259 | ||
256 | if not result then | 260 | if not result then |
257 | redisproxy:pipelining(function (red) | 261 | redisproxy:pipelining(function (red) |
@@ -277,8 +281,11 @@ function _M.handleApplyRpc(agent, data) | @@ -277,8 +281,11 @@ function _M.handleApplyRpc(agent, data) | ||
277 | otherInfo.pGet = redret[2] == 1 and 1 or nil | 281 | otherInfo.pGet = redret[2] == 1 and 1 or nil |
278 | SendPacket(actionCodes.Friend_updateProperty, MsgPack.pack({newFriend = 1, info = {otherInfo}})) | 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 | end | 289 | end |
283 | 290 | ||
284 | elseif cmd == 0 then -- 不同意 | 291 | elseif cmd == 0 then -- 不同意 |
@@ -301,7 +308,7 @@ function _M.handleApplyRpc(agent, data) | @@ -301,7 +308,7 @@ function _M.handleApplyRpc(agent, data) | ||
301 | local needAddInfo = {} | 308 | local needAddInfo = {} |
302 | for _, objId in ipairs(allIds) do | 309 | for _, objId in ipairs(allIds) do |
303 | objId = tonumber(objId) | 310 | objId = tonumber(objId) |
304 | - local cr = checkHandleApply(roleId, objId, #needAdd) | 311 | + local cr, curCount = checkHandleApply(roleId, objId, #needAdd) |
305 | if not cr then | 312 | if not cr then |
306 | table.insert(needAdd, objId) | 313 | table.insert(needAdd, objId) |
307 | table.insert(needAddMy, objId) | 314 | table.insert(needAddMy, objId) |
@@ -312,6 +319,12 @@ function _M.handleApplyRpc(agent, data) | @@ -312,6 +319,12 @@ function _M.handleApplyRpc(agent, data) | ||
312 | otherInfo.isFriend = true | 319 | otherInfo.isFriend = true |
313 | otherInfo.pGet = fpoint[objId] and 1 or nil | 320 | otherInfo.pGet = fpoint[objId] and 1 or nil |
314 | table.insert(needAddInfo, otherInfo) | 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 | end | 328 | end |
316 | end | 329 | end |
317 | 330 | ||
@@ -420,6 +433,11 @@ function _M.deleteRpc(agent, data) | @@ -420,6 +433,11 @@ function _M.deleteRpc(agent, data) | ||
420 | end | 433 | end |
421 | rpcRole(objectId, "SendPacket", actionCodes.Friend_updateProperty, MsgPack.pack({deleteFriend = 1, roleId = roleId})) | 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 | SendPacket(actionCodes.Friend_deleteRpc, MsgPack.pack("")) | 441 | SendPacket(actionCodes.Friend_deleteRpc, MsgPack.pack("")) |
424 | return true | 442 | return true |
425 | end | 443 | end |
@@ -449,15 +467,18 @@ function _M.blockRpc(agent, data) | @@ -449,15 +467,18 @@ function _M.blockRpc(agent, data) | ||
449 | red:ZREM(FRIEND_APPLY_KEY:format(objectId), roleId) | 467 | red:ZREM(FRIEND_APPLY_KEY:format(objectId), roleId) |
450 | red:sadd(FRIEND_BLACK_KEY:format(roleId), objectId) | 468 | red:sadd(FRIEND_BLACK_KEY:format(roleId), objectId) |
451 | end) | 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 | end | 476 | end |
455 | elseif cmd == 2 then | 477 | elseif cmd == 2 then |
456 | redisproxy:SREM(FRIEND_BLACK_KEY:format(roleId), objectId) | 478 | redisproxy:SREM(FRIEND_BLACK_KEY:format(roleId), objectId) |
457 | else | 479 | else |
458 | return | 480 | return |
459 | end | 481 | end |
460 | - | ||
461 | SendPacket(actionCodes.Friend_blockRpc, MsgPack.pack({result = result})) | 482 | SendPacket(actionCodes.Friend_blockRpc, MsgPack.pack({result = result})) |
462 | return true | 483 | return true |
463 | end | 484 | end |
src/actions/HeroAction.lua
@@ -16,6 +16,18 @@ local table_unpack = table.unpack | @@ -16,6 +16,18 @@ local table_unpack = table.unpack | ||
16 | 16 | ||
17 | local _M = {} | 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 | function _M.levelUpRpc( agent, data ) | 31 | function _M.levelUpRpc( agent, data ) |
20 | local role = agent.role | 32 | local role = agent.role |
21 | local msg = MsgPack.unpack(data) | 33 | local msg = MsgPack.unpack(data) |
@@ -28,9 +40,19 @@ function _M.levelUpRpc( agent, data ) | @@ -28,9 +40,19 @@ function _M.levelUpRpc( agent, data ) | ||
28 | local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold} | 40 | local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold} |
29 | if not role:checkItemEnough(cost) then return 3 end | 41 | if not role:checkItemEnough(cost) then return 3 end |
30 | role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}}) | 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 | hero:updateProperty({field = "level", delta = 1}) | 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 | if hero:getProperty("type") == 103 then | 57 | if hero:getProperty("type") == 103 then |
36 | role:finishGuide(7) | 58 | role:finishGuide(7) |
@@ -53,9 +75,15 @@ function _M.breakRpc( agent, data ) | @@ -53,9 +75,15 @@ function _M.breakRpc( agent, data ) | ||
53 | local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold} | 75 | local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold} |
54 | if not role:checkItemEnough(cost) then return 4 end | 76 | if not role:checkItemEnough(cost) then return 4 end |
55 | role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) | 77 | role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) |
78 | + local oldAttr = hero:getTotalAttrs() | ||
56 | hero:updateProperty({field = "breakL", delta = 1}) | 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 | SendPacket(actionCodes.Hero_breakRpc, '') | 88 | SendPacket(actionCodes.Hero_breakRpc, '') |
61 | return true | 89 | return true |
@@ -78,6 +106,7 @@ function _M.wakeRpc(agent, data) | @@ -78,6 +106,7 @@ function _M.wakeRpc(agent, data) | ||
78 | 106 | ||
79 | role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}}) | 107 | role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}}) |
80 | 108 | ||
109 | + local oldAttr = hero:getTotalAttrs() | ||
81 | hero:updateProperty({field = "wakeL", delta = 1}) | 110 | hero:updateProperty({field = "wakeL", delta = 1}) |
82 | 111 | ||
83 | local curLevel = hero:getProperty("wakeL") | 112 | local curLevel = hero:getProperty("wakeL") |
@@ -85,9 +114,14 @@ function _M.wakeRpc(agent, data) | @@ -85,9 +114,14 @@ function _M.wakeRpc(agent, data) | ||
85 | if curLevel == 4 then -- 解锁cg | 114 | if curLevel == 4 then -- 解锁cg |
86 | role:checkTaskEnter("WakeCG", {heroType = typ}) | 115 | role:checkTaskEnter("WakeCG", {heroType = typ}) |
87 | end | 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 | SendPacket(actionCodes.Hero_wakeRpc, '') | 125 | SendPacket(actionCodes.Hero_wakeRpc, '') |
92 | return true | 126 | return true |
93 | end | 127 | end |
@@ -107,7 +141,10 @@ function _M.talentRpc(agent, data) | @@ -107,7 +141,10 @@ function _M.talentRpc(agent, data) | ||
107 | local curStage = talent:getv(0, 1) | 141 | local curStage = talent:getv(0, 1) |
108 | local curData = csvdb["unit_talentCsv"][curStage] | 142 | local curData = csvdb["unit_talentCsv"][curStage] |
109 | if not curData then return 4 end | 143 | if not curData then return 4 end |
144 | + local oldSkillLv = hero:getSkillLevel(1) | ||
145 | + | ||
110 | 146 | ||
147 | + local cost = {} | ||
111 | if index == 0 then | 148 | if index == 0 then |
112 | --是否进阶 | 149 | --是否进阶 |
113 | local max = true | 150 | local max = true |
@@ -135,7 +172,7 @@ function _M.talentRpc(agent, data) | @@ -135,7 +172,7 @@ function _M.talentRpc(agent, data) | ||
135 | 172 | ||
136 | if talentData.lvRequire > hero:getProperty("level") then return 6 end | 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 | local cost2 = talentData.cost:toNumMap() | 176 | local cost2 = talentData.cost:toNumMap() |
140 | for k,v in pairs(cost2) do | 177 | for k,v in pairs(cost2) do |
141 | cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v | 178 | cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v |
@@ -156,7 +193,12 @@ function _M.talentRpc(agent, data) | @@ -156,7 +193,12 @@ function _M.talentRpc(agent, data) | ||
156 | 193 | ||
157 | hero:updateProperty({field = "talent", value = talent}) | 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 | SendPacket(actionCodes.Hero_talentRpc, '') | 203 | SendPacket(actionCodes.Hero_talentRpc, '') |
162 | return true | 204 | return true |
@@ -256,6 +298,14 @@ function _M.commentHeroRpc(agent, data) | @@ -256,6 +298,14 @@ function _M.commentHeroRpc(agent, data) | ||
256 | comment.like = 0 | 298 | comment.like = 0 |
257 | result.comment = comment | 299 | result.comment = comment |
258 | role.dailyData:setProperty("commentHero", curStutus:setv(heroType, 1)) | 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 | end | 309 | end |
260 | SendPacket(actionCodes.Hero_commentHeroRpc, MsgPack.pack(result)) | 310 | SendPacket(actionCodes.Hero_commentHeroRpc, MsgPack.pack(result)) |
261 | return true | 311 | return true |
@@ -326,7 +376,7 @@ function _M.likeCommentRpc(agent, data) | @@ -326,7 +376,7 @@ function _M.likeCommentRpc(agent, data) | ||
326 | local commentIndex = heroType .. ":" .. commentId | 376 | local commentIndex = heroType .. ":" .. commentId |
327 | local commentRoleKey = string.format("comment:%d:like", role:getProperty("id")) | 377 | local commentRoleKey = string.format("comment:%d:like", role:getProperty("id")) |
328 | local redret = redisproxy:pipelining(function (red) | 378 | local redret = redisproxy:pipelining(function (red) |
329 | - red:hexists(commentKey.commentKey, commentId) | 379 | + red:hget(commentKey.commentKey, commentId) |
330 | red:lrem(commentRoleKey, 1, commentIndex) | 380 | red:lrem(commentRoleKey, 1, commentIndex) |
331 | red:lpush(commentRoleKey, commentIndex) | 381 | red:lpush(commentRoleKey, commentIndex) |
332 | red:ltrim(commentRoleKey, 0, 999) | 382 | red:ltrim(commentRoleKey, 0, 999) |
@@ -334,7 +384,8 @@ function _M.likeCommentRpc(agent, data) | @@ -334,7 +384,8 @@ function _M.likeCommentRpc(agent, data) | ||
334 | if (tonumber(redret[2]) or 0) > 0 then | 384 | if (tonumber(redret[2]) or 0) > 0 then |
335 | result.status = 1 | 385 | result.status = 1 |
336 | else | 386 | else |
337 | - if redret[1] == 1 then-- 查不到也返回ture | 387 | + if redret[1] then-- 查不到也返回ture |
388 | + local comment = json.decode(redret[1]) | ||
338 | local redret2 = redisproxy:pipelining(function (red) | 389 | local redret2 = redisproxy:pipelining(function (red) |
339 | red:zrevrange(commentKey.commentRankKey, 0, RankLikeNum - 1) --热门 | 390 | red:zrevrange(commentKey.commentRankKey, 0, RankLikeNum - 1) --热门 |
340 | red:zincrby(commentKey.commentRankKey, add, commentId) | 391 | red:zincrby(commentKey.commentRankKey, add, commentId) |
@@ -360,6 +411,13 @@ function _M.likeCommentRpc(agent, data) | @@ -360,6 +411,13 @@ function _M.likeCommentRpc(agent, data) | ||
360 | red:lrem(commentKey.commentListKey, 0, tempId) | 411 | red:lrem(commentKey.commentListKey, 0, tempId) |
361 | end | 412 | end |
362 | end) | 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 | end | 421 | end |
364 | end | 422 | end |
365 | 423 | ||
@@ -367,108 +425,6 @@ function _M.likeCommentRpc(agent, data) | @@ -367,108 +425,6 @@ function _M.likeCommentRpc(agent, data) | ||
367 | return true | 425 | return true |
368 | end | 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 | function _M.createHeroRpc(agent, data) | 428 | function _M.createHeroRpc(agent, data) |
473 | local role = agent.role | 429 | local role = agent.role |
474 | local msg = MsgPack.unpack(data) | 430 | local msg = MsgPack.unpack(data) |
@@ -497,6 +453,7 @@ function _M.referEquipsRpc(agent, data) | @@ -497,6 +453,7 @@ function _M.referEquipsRpc(agent, data) | ||
497 | local hero = role.heros[msg.id] | 453 | local hero = role.heros[msg.id] |
498 | if not hero then return 10 end | 454 | if not hero then return 10 end |
499 | local equips = msg.equips | 455 | local equips = msg.equips |
456 | + local isAuto = msg.isAuth | ||
500 | if not equips or not next(equips) then return 11 end | 457 | if not equips or not next(equips) then return 11 end |
501 | 458 | ||
502 | for typ = 1, 4 do -- 4件装备 | 459 | for typ = 1, 4 do -- 4件装备 |
@@ -506,6 +463,11 @@ function _M.referEquipsRpc(agent, data) | @@ -506,6 +463,11 @@ function _M.referEquipsRpc(agent, data) | ||
506 | end | 463 | end |
507 | end | 464 | end |
508 | end | 465 | end |
466 | + | ||
467 | + local oldAttr = hero:getTotalAttrs() | ||
468 | + local oldBattleV = hero:getProperty("battleV") | ||
469 | + local wear = {} | ||
470 | + | ||
509 | local curEquip = hero:getProperty("equip") | 471 | local curEquip = hero:getProperty("equip") |
510 | for typ = 1, 4 do -- 4件装备 | 472 | for typ = 1, 4 do -- 4件装备 |
511 | if equips[typ] then | 473 | if equips[typ] then |
@@ -516,19 +478,37 @@ function _M.referEquipsRpc(agent, data) | @@ -516,19 +478,37 @@ function _M.referEquipsRpc(agent, data) | ||
516 | else | 478 | else |
517 | role:addEquip(typ, equips[typ], -1, {log = {desc = "refer"}}) -- 穿上 | 479 | role:addEquip(typ, equips[typ], -1, {log = {desc = "refer"}}) -- 穿上 |
518 | curEquip = curEquip:setv(typ, equips[typ]) | 480 | curEquip = curEquip:setv(typ, equips[typ]) |
481 | + | ||
482 | + wear[typ] = {id = equips[typ], act = 0} | ||
519 | end | 483 | end |
520 | 484 | ||
521 | if cur ~= 0 then | 485 | if cur ~= 0 then |
522 | role:addEquip(typ, cur, 1, {log = {desc = "refer"}}) -- 脱掉 | 486 | role:addEquip(typ, cur, 1, {log = {desc = "refer"}}) -- 脱掉 |
487 | + | ||
488 | + wear[typ] = {id = cur, act = 1} | ||
523 | end | 489 | end |
524 | end | 490 | end |
525 | end | 491 | end |
526 | end | 492 | end |
493 | + | ||
527 | -- 更新角色 | 494 | -- 更新角色 |
528 | hero:updateProperty({field = "equip", value = curEquip}) | 495 | hero:updateProperty({field = "equip", value = curEquip}) |
529 | 496 | ||
530 | role:finishGuide(23) | 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 | SendPacket(actionCodes.Hero_referEquipsRpc, "") | 512 | SendPacket(actionCodes.Hero_referEquipsRpc, "") |
533 | return true | 513 | return true |
534 | end | 514 | end |
@@ -565,6 +545,9 @@ function _M.referRunesRpc(agent, data) | @@ -565,6 +545,9 @@ function _M.referRunesRpc(agent, data) | ||
565 | chero:updateProperty({field = "rune", value = hrunes}) | 545 | chero:updateProperty({field = "rune", value = hrunes}) |
566 | end | 546 | end |
567 | 547 | ||
548 | + local oldAttr = hero:getTotalAttrs() | ||
549 | + local oldBattleV = hero:getProperty("battleV") | ||
550 | + local wear = {} | ||
568 | local curRune = hero:getProperty("rune") | 551 | local curRune = hero:getProperty("rune") |
569 | for typ = 1, 6 do | 552 | for typ = 1, 6 do |
570 | if runes[typ] then | 553 | if runes[typ] then |
@@ -576,6 +559,7 @@ function _M.referRunesRpc(agent, data) | @@ -576,6 +559,7 @@ function _M.referRunesRpc(agent, data) | ||
576 | local newRune = role.runeBag[runes[typ]] | 559 | local newRune = role.runeBag[runes[typ]] |
577 | newRune:updateProperty({field = "refer",value = hero:getProperty("id")}) | 560 | newRune:updateProperty({field = "refer",value = hero:getProperty("id")}) |
578 | curRune = curRune:setv(typ, runes[typ]) | 561 | curRune = curRune:setv(typ, runes[typ]) |
562 | + wear[runes[typ]] = typ | ||
579 | end | 563 | end |
580 | 564 | ||
581 | if cur ~= 0 then | 565 | if cur ~= 0 then |
@@ -587,7 +571,22 @@ function _M.referRunesRpc(agent, data) | @@ -587,7 +571,22 @@ function _M.referRunesRpc(agent, data) | ||
587 | end | 571 | end |
588 | end | 572 | end |
589 | end | 573 | end |
574 | + | ||
590 | hero:updateProperty({field = "rune", value = curRune}) | 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 | SendPacket(actionCodes.Hero_referRunesRpc, "") | 590 | SendPacket(actionCodes.Hero_referRunesRpc, "") |
592 | return true | 591 | return true |
593 | end | 592 | end |
@@ -675,7 +674,6 @@ function _M.getResetRewardRpc(agent, data) | @@ -675,7 +674,6 @@ function _M.getResetRewardRpc(agent, data) | ||
675 | hero:updateProperty({field = "level", value = level}) | 674 | hero:updateProperty({field = "level", value = level}) |
676 | hero:updateProperty({field = "breakL", value = breakL}) | 675 | hero:updateProperty({field = "breakL", value = breakL}) |
677 | hero:updateProperty({field = "talent", value = ""}) | 676 | hero:updateProperty({field = "talent", value = ""}) |
678 | - hero:log({desc = "resetHero"}) | ||
679 | 677 | ||
680 | for itemId, count in pairs(reward) do | 678 | for itemId, count in pairs(reward) do |
681 | reward[itemId] = math.floor(count * globalCsv.unit_back_discount) | 679 | reward[itemId] = math.floor(count * globalCsv.unit_back_discount) |
@@ -683,259 +681,15 @@ function _M.getResetRewardRpc(agent, data) | @@ -683,259 +681,15 @@ function _M.getResetRewardRpc(agent, data) | ||
683 | local change | 681 | local change |
684 | reward, change = role:award(reward, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}}) | 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 | SendPacket(actionCodes.Hero_getResetRewardRpc, MsgPack.pack(role:packReward(reward, change))) | 689 | SendPacket(actionCodes.Hero_getResetRewardRpc, MsgPack.pack(role:packReward(reward, change))) |
687 | return true | 690 | return true |
688 | end | 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 | function _M.drawHeroRpc(agent, data) | 693 | function _M.drawHeroRpc(agent, data) |
940 | local role = agent.role | 694 | local role = agent.role |
941 | local msg = MsgPack.unpack(data) | 695 | local msg = MsgPack.unpack(data) |
@@ -1048,7 +802,7 @@ function _M.drawHeroRpc(agent, data) | @@ -1048,7 +802,7 @@ function _M.drawHeroRpc(agent, data) | ||
1048 | end | 802 | end |
1049 | end | 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 | local ssrCount = 0 | 807 | local ssrCount = 0 |
1054 | local reward = {} | 808 | local reward = {} |
@@ -1077,10 +831,10 @@ function _M.drawHeroRpc(agent, data) | @@ -1077,10 +831,10 @@ function _M.drawHeroRpc(agent, data) | ||
1077 | local fragId = itemData.id - ItemStartId.Hero | 831 | local fragId = itemData.id - ItemStartId.Hero |
1078 | local heroData = csvdb["unitCsv"][fragId] | 832 | local heroData = csvdb["unitCsv"][fragId] |
1079 | local count = globalCsv.draw_unit_tofragment[heroData.rare] | 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 | table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) | 835 | table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) |
1082 | else | 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 | table.insert(reward, {id = itemId, count = 1}) | 838 | table.insert(reward, {id = itemId, count = 1}) |
1085 | end | 839 | end |
1086 | end | 840 | end |
@@ -1101,7 +855,16 @@ function _M.drawHeroRpc(agent, data) | @@ -1101,7 +855,16 @@ function _M.drawHeroRpc(agent, data) | ||
1101 | if ssrCount > 0 then | 855 | if ssrCount > 0 then |
1102 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) | 856 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) |
1103 | end | 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 | SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 | 868 | SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 |
1106 | return true | 869 | return true |
1107 | end | 870 | end |
@@ -1131,7 +894,6 @@ function _M.repayHeroRpc(agent, data) | @@ -1131,7 +894,6 @@ function _M.repayHeroRpc(agent, data) | ||
1131 | role:award({[id] = 1}, {log = {desc = "heroRepay"}}) | 894 | role:award({[id] = 1}, {log = {desc = "heroRepay"}}) |
1132 | reward = {id = id, count = 1} | 895 | reward = {id = id, count = 1} |
1133 | end | 896 | end |
1134 | - role:log("hero_action", {desc = "heroRepay", int1=result}) | ||
1135 | SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward})) | 897 | SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward})) |
1136 | return true | 898 | return true |
1137 | end | 899 | end |
@@ -1168,4 +930,20 @@ function _M.unlockPoolRpc(agent, data) | @@ -1168,4 +930,20 @@ function _M.unlockPoolRpc(agent, data) | ||
1168 | return true | 930 | return true |
1169 | end | 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 | return _M | 949 | return _M |
1172 | \ No newline at end of file | 950 | \ No newline at end of file |
src/actions/RoleAction.lua
@@ -453,11 +453,21 @@ function _M.saleItemRpc(agent, data) | @@ -453,11 +453,21 @@ function _M.saleItemRpc(agent, data) | ||
453 | end | 453 | end |
454 | local sellEffect = itemData.sell_effect:toArray(true, "=") | 454 | local sellEffect = itemData.sell_effect:toArray(true, "=") |
455 | reward[sellEffect[1]] = (reward[sellEffect[1]] or 0) + sellEffect[2] * count | 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 | end | 465 | end |
457 | 466 | ||
458 | role:costItems(backs, {log = {desc = "saleItem"}}) | 467 | role:costItems(backs, {log = {desc = "saleItem"}}) |
459 | local reward, change = role:award(reward, {log = {desc = "saleItem"}}) | 468 | local reward, change = role:award(reward, {log = {desc = "saleItem"}}) |
460 | role:checkTaskEnter("DecoFrag", {count = fragCount}) | 469 | role:checkTaskEnter("DecoFrag", {count = fragCount}) |
470 | + | ||
461 | SendPacket(actionCodes.Role_saleItemRpc, MsgPack.pack(role:packReward(reward, change))) | 471 | SendPacket(actionCodes.Role_saleItemRpc, MsgPack.pack(role:packReward(reward, change))) |
462 | return true | 472 | return true |
463 | end | 473 | end |
@@ -530,12 +540,14 @@ function _M.openTimeBoxRpc(agent, data) | @@ -530,12 +540,14 @@ function _M.openTimeBoxRpc(agent, data) | ||
530 | elseif oper == 2 then -- 领取 | 540 | elseif oper == 2 then -- 领取 |
531 | local quick = msg.quick | 541 | local quick = msg.quick |
532 | if not boxL[slot] then return end | 542 | if not boxL[slot] then return end |
543 | + local costKey = 0 | ||
544 | + local costTime = skynet.timex() - boxL[slot].time | ||
533 | if boxL[slot].time > skynet.timex() then -- 没开完 | 545 | if boxL[slot].time > skynet.timex() then -- 没开完 |
534 | if not quick then return end | 546 | if not quick then return end |
535 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") | 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 | end | 551 | end |
540 | local boxId = boxL[slot].id | 552 | local boxId = boxL[slot].id |
541 | local itemData = csvdb["itemCsv"][boxId] | 553 | local itemData = csvdb["itemCsv"][boxId] |
@@ -565,6 +577,17 @@ function _M.openTimeBoxRpc(agent, data) | @@ -565,6 +577,17 @@ function _M.openTimeBoxRpc(agent, data) | ||
565 | boxL[slot] = nil | 577 | boxL[slot] = nil |
566 | reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = boxId}}) | 578 | reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = boxId}}) |
567 | role:checkTaskEnter("OpenBox", {id = boxId, count=1}) | 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 | else | 591 | else |
569 | return | 592 | return |
570 | end | 593 | end |
@@ -652,6 +675,15 @@ function _M.storyBookRewardRpc(agent, data) | @@ -652,6 +675,15 @@ function _M.storyBookRewardRpc(agent, data) | ||
652 | storyStatus[storyId].s = -1 | 675 | storyStatus[storyId].s = -1 |
653 | role:changeUpdates({{ type = "storyB", field = storyId, value = storyStatus[storyId] }}) | 676 | role:changeUpdates({{ type = "storyB", field = storyId, value = storyStatus[storyId] }}) |
654 | local reward, change = role:award(storyBookData.gift, {log = {desc = "storybookReward", int1 = storyId}}) | 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 | SendPacket(actionCodes.Role_storyBookRewardRpc, MsgPack.pack(role:packReward(reward, change))) | 687 | SendPacket(actionCodes.Role_storyBookRewardRpc, MsgPack.pack(role:packReward(reward, change))) |
656 | return true | 688 | return true |
657 | end | 689 | end |
@@ -714,6 +746,12 @@ function _M.taskRpc(agent, data) | @@ -714,6 +746,12 @@ function _M.taskRpc(agent, data) | ||
714 | local oldVal = role:getProperty("battlePoint") or 0 | 746 | local oldVal = role:getProperty("battlePoint") or 0 |
715 | role:updateProperty({field = "battlePoint", value = oldVal + taskData.active}) | 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 | SendPacket(actionCodes.Role_taskRpc, MsgPack.pack(role:packReward(reward, change))) | 755 | SendPacket(actionCodes.Role_taskRpc, MsgPack.pack(role:packReward(reward, change))) |
718 | return true | 756 | return true |
719 | end | 757 | end |
@@ -803,6 +841,12 @@ function _M.achiveRpc(agent, data) | @@ -803,6 +841,12 @@ function _M.achiveRpc(agent, data) | ||
803 | end | 841 | end |
804 | end | 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 | SendPacket(actionCodes.Role_achiveRpc, MsgPack.pack(role:packReward(reward, change))) | 850 | SendPacket(actionCodes.Role_achiveRpc, MsgPack.pack(role:packReward(reward, change))) |
807 | return true | 851 | return true |
808 | end | 852 | end |
@@ -921,6 +965,13 @@ function _M.chatRpc(agent, data) | @@ -921,6 +965,13 @@ function _M.chatRpc(agent, data) | ||
921 | if not result then | 965 | if not result then |
922 | check[cmd]() | 966 | check[cmd]() |
923 | end | 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 | SendPacket(actionCodes.Role_chatRpc, MsgPack.pack({result = result, waitTime = waitTime})) | 975 | SendPacket(actionCodes.Role_chatRpc, MsgPack.pack({result = result, waitTime = waitTime})) |
925 | return true | 976 | return true |
926 | end | 977 | end |
@@ -979,8 +1030,15 @@ function _M.drawCodeRpc(agent, data) | @@ -979,8 +1030,15 @@ function _M.drawCodeRpc(agent, data) | ||
979 | if ret == 0 then | 1030 | if ret == 0 then |
980 | local giftId = tonumber(result.giftId) | 1031 | local giftId = tonumber(result.giftId) |
981 | role:setProperty("codeStr", codestr:setv(giftId, 1)) | 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 | SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({ | 1042 | SendPacket(actionCodes.Role_drawCodeRpc, MsgPack.pack({ |
985 | result = ret, | 1043 | result = ret, |
986 | reward = reward, | 1044 | reward = reward, |
src/actions/StoreAction.lua
@@ -195,82 +195,6 @@ function _M.purchaseOrderResult(agent, data) | @@ -195,82 +195,6 @@ function _M.purchaseOrderResult(agent, data) | ||
195 | end | 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 | function _M.shopBuyRpc(agent , data) | 198 | function _M.shopBuyRpc(agent , data) |
275 | local role = agent.role | 199 | local role = agent.role |
276 | local msg = MsgPack.unpack(data) | 200 | local msg = MsgPack.unpack(data) |
@@ -325,8 +249,17 @@ function _M.shopBuyRpc(agent , data) | @@ -325,8 +249,17 @@ function _M.shopBuyRpc(agent , data) | ||
325 | if dataSet.shop == 1 then | 249 | if dataSet.shop == 1 then |
326 | role:checkTaskEnter("ShopAll", {count = count}) | 250 | role:checkTaskEnter("ShopAll", {count = count}) |
327 | end | 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 | SendPacket(actionCodes.Store_shopBuyRpc, MsgPack.pack({reward = reward})) | 263 | SendPacket(actionCodes.Store_shopBuyRpc, MsgPack.pack({reward = reward})) |
331 | return true | 264 | return true |
332 | end | 265 | end |
src/models/Activity.lua
@@ -215,6 +215,13 @@ function Activity:checkWeeklyAct(actType, notify, count, pool) | @@ -215,6 +215,13 @@ function Activity:checkWeeklyAct(actType, notify, count, pool) | ||
215 | end | 215 | end |
216 | if not curData[cfg.id] and curData[0] >= cfg.condition1 then | 216 | if not curData[cfg.id] and curData[0] >= cfg.condition1 then |
217 | if info.mailId then | 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 | self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1}) | 225 | self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1}) |
219 | curData[cfg.id] = 1 | 226 | curData[cfg.id] = 1 |
220 | end | 227 | end |
src/models/Diner.lua
@@ -304,6 +304,7 @@ function Diner:expediteSell(slot) | @@ -304,6 +304,7 @@ function Diner:expediteSell(slot) | ||
304 | lastCount = lastCount, | 304 | lastCount = lastCount, |
305 | reward = reward, | 305 | reward = reward, |
306 | popular = popular, | 306 | popular = popular, |
307 | + deltaTime = deltaTime, | ||
307 | } | 308 | } |
308 | end | 309 | end |
309 | 310 |
src/models/RoleLog.lua
@@ -119,7 +119,7 @@ local MethodType = { | @@ -119,7 +119,7 @@ local MethodType = { | ||
119 | onLogout = { -- 登出 | 119 | onLogout = { -- 登出 |
120 | logtime = true, --登录时长 | 120 | logtime = true, --登录时长 |
121 | }, | 121 | }, |
122 | - setLevel = { -- 设置等级 --TODO | 122 | + setLevel = { -- 设置等级 |
123 | level_before = true, -- 变动前的等级,可以跳级 | 123 | level_before = true, -- 变动前的等级,可以跳级 |
124 | level_changemain = true, -- 等级变动原因,副本通关:mission,领取奖励:reward | 124 | level_changemain = true, -- 等级变动原因,副本通关:mission,领取奖励:reward |
125 | level_changedetail = true, -- 等级变动原因明细,副本通关则记录关卡ID,领取奖励则记录奖励ID | 125 | level_changedetail = true, -- 等级变动原因明细,副本通关则记录关卡ID,领取奖励则记录奖励ID |
@@ -157,7 +157,7 @@ local MethodType = { | @@ -157,7 +157,7 @@ local MethodType = { | ||
157 | mail_friend_id = true, -- 收件方账号id | 157 | mail_friend_id = true, -- 收件方账号id |
158 | mail_friend_roleid = true, -- 收件方角色id | 158 | mail_friend_roleid = true, -- 收件方角色id |
159 | }, | 159 | }, |
160 | - onItems = { --道具流通 --TODO | 160 | + onItems = { --道具流通 |
161 | item_id = true, -- 道具id | 161 | item_id = true, -- 道具id |
162 | item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形 | 162 | item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形 |
163 | item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表 | 163 | item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表 |
@@ -203,13 +203,13 @@ local MethodType = { | @@ -203,13 +203,13 @@ local MethodType = { | ||
203 | residence_time = true, --挂机或排名时长 | 203 | residence_time = true, --挂机或排名时长 |
204 | residence_reward = true, --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | 204 | residence_reward = true, --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} |
205 | }, | 205 | }, |
206 | - hero_rise = { --英雄觉醒 --TODO | 206 | + hero_rise = { --英雄觉醒 |
207 | hero_id = true, --英雄ID | 207 | hero_id = true, --英雄ID |
208 | hero_rise_cost = true, --英雄觉醒消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} | 208 | hero_rise_cost = true, --英雄觉醒消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} |
209 | hero_rise_score = true, --英雄觉醒后评分提升 | 209 | hero_rise_score = true, --英雄觉醒后评分提升 |
210 | hero_rise_result = true, --英雄觉醒效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} | 210 | hero_rise_result = true, --英雄觉醒效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} |
211 | }, | 211 | }, |
212 | - hero_upgrade = { --英雄升级 --TODO | 212 | + hero_upgrade = { --英雄升级 |
213 | hero_id = true, -- 英雄ID | 213 | hero_id = true, -- 英雄ID |
214 | hero_upgrade_cost = true, -- 英雄升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} | 214 | hero_upgrade_cost = true, -- 英雄升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} |
215 | hero_upgrade_result = true, -- 英雄升级效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} | 215 | hero_upgrade_result = true, -- 英雄升级效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} |
@@ -217,34 +217,34 @@ local MethodType = { | @@ -217,34 +217,34 @@ local MethodType = { | ||
217 | hero_upgrade_score = true, -- 英雄升级后评分 | 217 | hero_upgrade_score = true, -- 英雄升级后评分 |
218 | hero_upgrade_scoreget = true, -- 通过英雄升级提升的评分 | 218 | hero_upgrade_scoreget = true, -- 通过英雄升级提升的评分 |
219 | }, | 219 | }, |
220 | - hero_break = { --英雄突破 --TODO | 220 | + hero_break = { --英雄突破 |
221 | hero_id = true, -- 英雄ID | 221 | hero_id = true, -- 英雄ID |
222 | hero_break_cost = true, -- 英雄突破消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} | 222 | hero_break_cost = true, -- 英雄突破消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} |
223 | hero_break_result = true, -- 英雄突破效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} | 223 | hero_break_result = true, -- 英雄突破效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} |
224 | hero_break_level = true, -- 英雄突破后等级上限 | 224 | hero_break_level = true, -- 英雄突破后等级上限 |
225 | }, | 225 | }, |
226 | - hero_talent = { --英雄天赋升级 --TODO | 226 | + hero_talent = { --英雄天赋升级 |
227 | hero_id = true, -- 英雄ID | 227 | hero_id = true, -- 英雄ID |
228 | hero_talent_cost = true, -- 英雄天赋升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} | 228 | hero_talent_cost = true, -- 英雄天赋升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...} |
229 | hero_talent_levelbef = true, -- 英雄技能升级前等级 | 229 | hero_talent_levelbef = true, -- 英雄技能升级前等级 |
230 | hero_talent_level = true, -- 英雄技能升级后等级 | 230 | hero_talent_level = true, -- 英雄技能升级后等级 |
231 | }, | 231 | }, |
232 | - hero_jewel = { --英雄铭文 --TODO | 232 | + hero_jewel = { --英雄铭文 |
233 | hero_id = true, -- 英雄ID | 233 | hero_id = true, -- 英雄ID |
234 | - hero_jewel_sequence = true, -- 铭文装备编号,用以关联一次装备时产生的多条日志 | 234 | + hero_jewel_sequence = "ucode", -- 铭文装备编号,用以关联一次装备时产生的多条日志 |
235 | hero_jewel_id = true, -- 铭文ID | 235 | hero_jewel_id = true, -- 铭文ID |
236 | hero_jewel_part = true, -- 铭文装备部位 | 236 | hero_jewel_part = true, -- 铭文装备部位 |
237 | hero_jewel_score = true, -- 铭文装备后的英雄分值 | 237 | hero_jewel_score = true, -- 铭文装备后的英雄分值 |
238 | hero_jewel_scorebefore = true, -- 铭文装备前的英雄分值 | 238 | hero_jewel_scorebefore = true, -- 铭文装备前的英雄分值 |
239 | hero_jewel_result = true, -- 铭文装备后效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} | 239 | hero_jewel_result = true, -- 铭文装备后效果,可记录效果ID,或json格式记录提升效果,{攻击:20,闪避:20,……..} |
240 | }, | 240 | }, |
241 | - hero_note = { --英雄评价 --TODO | 241 | + hero_note = { --英雄评价 |
242 | hero_id = true, -- 英雄ID | 242 | hero_id = true, -- 英雄ID |
243 | hero_note_action = true, -- 英雄评价界面操作,发布评论:0,点赞:1,反对:2 | 243 | hero_note_action = true, -- 英雄评价界面操作,发布评论:0,点赞:1,反对:2 |
244 | hero_note_id = true, -- 操作的评价ID | 244 | hero_note_id = true, -- 操作的评价ID |
245 | hero_note_text = true, -- 操作的评价内容 | 245 | hero_note_text = true, -- 操作的评价内容 |
246 | }, | 246 | }, |
247 | - hero_show = { --展示英雄 --TODO | 247 | + hero_show = { --展示英雄 |
248 | hero_id = true, -- 英雄ID | 248 | hero_id = true, -- 英雄ID |
249 | }, | 249 | }, |
250 | hero_recycle = { --英雄回收 | 250 | hero_recycle = { --英雄回收 |
@@ -252,17 +252,15 @@ local MethodType = { | @@ -252,17 +252,15 @@ local MethodType = { | ||
252 | hero_recycle_reward = true, -- 回收后获得的奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | 252 | hero_recycle_reward = true, -- 回收后获得的奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} |
253 | hero_recycle_cnt = true, -- 总回收英雄量 | 253 | hero_recycle_cnt = true, -- 总回收英雄量 |
254 | }, | 254 | }, |
255 | - gacha = { --英雄招募 --TODO | 255 | + gacha = { --英雄招募 |
256 | gacha_id = true, -- 卡池ID | 256 | gacha_id = true, -- 卡池ID |
257 | gacha_type = true, -- 卡池类型 | 257 | gacha_type = true, -- 卡池类型 |
258 | gacha_up = true, -- 卡池UP角色 | 258 | gacha_up = true, -- 卡池UP角色 |
259 | gacha_times = true, -- 抽卡次数 | 259 | gacha_times = true, -- 抽卡次数 |
260 | gacha_reward = true, -- 抽卡结果,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | 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 | hero_id = true, --英雄ID | 264 | hero_id = true, --英雄ID |
267 | equip_id = true, --装备ID | 265 | equip_id = true, --装备ID |
268 | equip_wear_action = true, --装备操作类型:装备:0,卸载:1 | 266 | equip_wear_action = true, --装备操作类型:装备:0,卸载:1 |
@@ -270,19 +268,17 @@ local MethodType = { | @@ -270,19 +268,17 @@ local MethodType = { | ||
270 | equip_wear_result = true, --装备操作后结果,记录属性变化,json格式记录,{“aa”:1234,"bb":4567} | 268 | equip_wear_result = true, --装备操作后结果,记录属性变化,json格式记录,{“aa”:1234,"bb":4567} |
271 | equip_wear_change = true, --装备操作变化值,记录属性变化,记录正负值,json格式记录,{“aa”:1234,"bb":-45} | 269 | equip_wear_change = true, --装备操作变化值,记录属性变化,记录正负值,json格式记录,{“aa”:1234,"bb":-45} |
272 | equip_wear_mode = true, --用以区分自动装备还是手动装备,自动记录为0,手动记录为1 | 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 | equip_upgrade_part = true, -- 升级部位,记录部位ID | 274 | equip_upgrade_part = true, -- 升级部位,记录部位ID |
278 | equip_id = true, -- 升级后的装备ID | 275 | equip_id = true, -- 升级后的装备ID |
279 | equip_upgrade_amount = true, -- 升级获取的装备数量 | 276 | equip_upgrade_amount = true, -- 升级获取的装备数量 |
280 | equip_upgrade_usedid = true, -- 升级消耗的装备ID | 277 | equip_upgrade_usedid = true, -- 升级消耗的装备ID |
281 | equip_upgrade_cost = true, -- 升级操作消耗装备数量 | 278 | equip_upgrade_cost = true, -- 升级操作消耗装备数量 |
282 | - equip_upgrade_currentid = true, -- 升级消耗的货币类型 | ||
283 | equip_upgrade_current = true, -- 升级操作消耗货币数量 | 279 | equip_upgrade_current = true, -- 升级操作消耗货币数量 |
284 | }, | 280 | }, |
285 | - carriage_dismantle = { --物资拆解 --TODO | 281 | + carriage_dismantle = { --物资拆解 |
286 | item_id = true, -- 道具id | 282 | item_id = true, -- 道具id |
287 | item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形 | 283 | item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形 |
288 | item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表 | 284 | item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表 |
@@ -293,14 +289,14 @@ local MethodType = { | @@ -293,14 +289,14 @@ local MethodType = { | ||
293 | carriage_dismantle_cost = true, -- 拆解花费钥匙数量,未使用填写0 | 289 | carriage_dismantle_cost = true, -- 拆解花费钥匙数量,未使用填写0 |
294 | carriage_dismantle_rwd = true, -- 拆解获得物资,json格式记录,{'itemid1':2,'itemid2':3,…………..} | 290 | carriage_dismantle_rwd = true, -- 拆解获得物资,json格式记录,{'itemid1':2,'itemid2':3,…………..} |
295 | }, | 291 | }, |
296 | - carriage_logistics = { --后勤室 --TODO | 292 | + carriage_logistics = { --后勤室 |
297 | carriage_logistics_type = true, -- 后勤室制作类型ID,变异:0,通常:1,魔法:2 | 293 | carriage_logistics_type = true, -- 后勤室制作类型ID,变异:0,通常:1,魔法:2 |
298 | carriage_logistics_itemid = true, -- 后勤室升级物品或技能ID | 294 | carriage_logistics_itemid = true, -- 后勤室升级物品或技能ID |
299 | carriage_logistics_itemlv = true, -- 升级后物品或技能等级 | 295 | carriage_logistics_itemlv = true, -- 升级后物品或技能等级 |
300 | carriage_logistics_gear = true, -- 后勤室升级花费齿轮数量 | 296 | carriage_logistics_gear = true, -- 后勤室升级花费齿轮数量 |
301 | carriage_logistics_coin = true, -- 后勤室升级花费美食币数量 | 297 | carriage_logistics_coin = true, -- 后勤室升级花费美食币数量 |
302 | }, | 298 | }, |
303 | - carriage_decals = { --贴纸拆解 --TODO | 299 | + carriage_decals = { --贴纸拆解 |
304 | item_id = true, --道具id | 300 | item_id = true, --道具id |
305 | item_sequenceid = "ucode", --道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形 | 301 | item_sequenceid = "ucode", --道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个礼包多个物品等情形 |
306 | item_type = true, --道具类型,具体见枚举表中道具类型枚举表 | 302 | item_type = true, --道具类型,具体见枚举表中道具类型枚举表 |
@@ -309,31 +305,31 @@ local MethodType = { | @@ -309,31 +305,31 @@ local MethodType = { | ||
309 | carriage_decals_rwdid = true, --拆解获得物资ID | 305 | carriage_decals_rwdid = true, --拆解获得物资ID |
310 | carriage_decals_rwdnum = true, --拆解获得物资数量 | 306 | carriage_decals_rwdnum = true, --拆解获得物资数量 |
311 | }, | 307 | }, |
312 | - carriage_video = { --放映室 --TODO | 308 | + carriage_video = { --放映室 |
313 | carriage_video_type = true, --放映室类型,剧情CG:0, 角色CG:1, 主线剧情:2, 角色剧情:3, 活动剧情:4, 图鉴:5 | 309 | carriage_video_type = true, --放映室类型,剧情CG:0, 角色CG:1, 主线剧情:2, 角色剧情:3, 活动剧情:4, 图鉴:5 |
314 | carriage_video_id = true, --放映室片段ID | 310 | carriage_video_id = true, --放映室片段ID |
315 | carriage_video_coinid = true, --放映奖励货币类型,无奖励则填写0 | 311 | carriage_video_coinid = true, --放映奖励货币类型,无奖励则填写0 |
316 | carriage_video_coinnum = true, --放映奖励货币数量,无奖励则填写0 | 312 | carriage_video_coinnum = true, --放映奖励货币数量,无奖励则填写0 |
317 | carriage_video_item = true, --放映奖励其他物品数量,json格式记录,{'itemid1':10,'itemid2':5,…………..},无奖励则填写0 | 313 | carriage_video_item = true, --放映奖励其他物品数量,json格式记录,{'itemid1':10,'itemid2':5,…………..},无奖励则填写0 |
318 | }, | 314 | }, |
319 | - carriage_cook = { --调理室 --TODO | 315 | + carriage_cook = { --调理室 |
320 | item_id = true, -- 道具id | 316 | item_id = true, -- 道具id |
321 | item_level = true, -- 道具等级 | 317 | item_level = true, -- 道具等级 |
322 | item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表 | 318 | item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表 |
323 | carriage_cook_amount = true, -- 制作总量 | 319 | carriage_cook_amount = true, -- 制作总量 |
324 | carriage_cook_cost = true, -- 制作消耗道具,json格式记录,{'itemid1':10,'itemid2':5,…………..} | 320 | carriage_cook_cost = true, -- 制作消耗道具,json格式记录,{'itemid1':10,'itemid2':5,…………..} |
325 | }, | 321 | }, |
326 | - activity = { --活动或指南奖励 --TODO | 322 | + activity = { --活动或指南奖励 |
327 | activity_id = true, -- 活动ID(或活动指定任务的ID) | 323 | activity_id = true, -- 活动ID(或活动指定任务的ID) |
328 | activity_type = true, -- 活动类型,见活动类型枚举表 | 324 | activity_type = true, -- 活动类型,见活动类型枚举表 |
329 | activity_reward = true, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | 325 | activity_reward = true, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} |
330 | }, | 326 | }, |
331 | - task_reward = { --任务奖励 --TODO | 327 | + task_reward = { --任务奖励 |
332 | task_reward_id = true, --任务奖励ID | 328 | task_reward_id = true, --任务奖励ID |
333 | task_reward_type = true, --任务奖励类型,见 任务奖励类型枚举表 | 329 | task_reward_type = true, --任务奖励类型,见 任务奖励类型枚举表 |
334 | task_reward_detail = true, --任务奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | 330 | task_reward_detail = true, --任务奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} |
335 | }, | 331 | }, |
336 | - shop_purchase = { --商店购买行为 --TODO | 332 | + shop_purchase = { --商店购买行为 |
337 | item_id = true, -- 道具id | 333 | item_id = true, -- 道具id |
338 | item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个购买礼包多个物品等情形 | 334 | item_sequenceid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一个购买礼包多个物品等情形 |
339 | item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表 | 335 | item_type = true, -- 道具类型,具体见枚举表中道具类型枚举表 |
@@ -343,7 +339,13 @@ local MethodType = { | @@ -343,7 +339,13 @@ local MethodType = { | ||
343 | shop_purchase_current = true, -- 购买道具消耗的货币数量 | 339 | shop_purchase_current = true, -- 购买道具消耗的货币数量 |
344 | shop_id = true, -- 商店ID | 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 | friend_opt_type = true, -- 好友操作类型,见枚举表中 好友操作类型枚举表 | 349 | friend_opt_type = true, -- 好友操作类型,见枚举表中 好友操作类型枚举表 |
348 | friend_accountid = true, -- 好友账户id | 350 | friend_accountid = true, -- 好友账户id |
349 | friend_roleid = true, -- 好友账户下的角色id | 351 | friend_roleid = true, -- 好友账户下的角色id |
@@ -357,21 +359,20 @@ local MethodType = { | @@ -357,21 +359,20 @@ local MethodType = { | ||
357 | friend_accountid = true, -- 好友账户id | 359 | friend_accountid = true, -- 好友账户id |
358 | friend_roleid = true, -- 好友账户下的角色id | 360 | friend_roleid = true, -- 好友账户下的角色id |
359 | }, | 361 | }, |
360 | - communication = { --玩家发言 --TODO | 362 | + communication = { --玩家发言 |
361 | publish_type = true, --发言类型,全部:0,公告:1,世界:2,联盟:3,私聊:4 | 363 | publish_type = true, --发言类型,全部:0,公告:1,世界:2,联盟:3,私聊:4 |
362 | publish_status = true, --发送状态,发送成功:0,发送失败:1,被屏蔽:2,其他:3 | 364 | publish_status = true, --发送状态,发送成功:0,发送失败:1,被屏蔽:2,其他:3 |
363 | - publish_receive_accid = true, --接收者账户ID | ||
364 | publish_receive_roleid = true, --接收者角色ID | 365 | publish_receive_roleid = true, --接收者角色ID |
365 | publish_text = true, --发言内容 | 366 | publish_text = true, --发言内容 |
366 | }, | 367 | }, |
367 | - restaurant_up = { --摊位升级 --TODO | 368 | + restaurant_up = { --摊位升级 |
368 | restaurant_up_type = true, --升级部件类型,店面:0, 接客:1, 满意度:2, 宣传:3, 广告:4, 周边:5 | 369 | restaurant_up_type = true, --升级部件类型,店面:0, 接客:1, 满意度:2, 宣传:3, 广告:4, 周边:5 |
369 | restaurant_up_gear = true, --消耗齿轮数量 | 370 | restaurant_up_gear = true, --消耗齿轮数量 |
370 | restaurant_up_coin = true, --花费美食币数量 | 371 | restaurant_up_coin = true, --花费美食币数量 |
371 | restaurant_up_effectbef = true, --升级前加成 | 372 | restaurant_up_effectbef = true, --升级前加成 |
372 | restaurant_up_effect = true, --升级后加成 | 373 | restaurant_up_effect = true, --升级后加成 |
373 | }, | 374 | }, |
374 | - restaurant_sale = { --摊位售卖 --TODO | 375 | + restaurant_sale = { --摊位售卖 |
375 | item_id = true, -- 售卖物品ID | 376 | item_id = true, -- 售卖物品ID |
376 | restaurant_sale_seat = true, -- 售卖物品所在位置 | 377 | restaurant_sale_seat = true, -- 售卖物品所在位置 |
377 | restaurant_sale_time = true, -- 售卖时长 | 378 | restaurant_sale_time = true, -- 售卖时长 |
@@ -379,34 +380,30 @@ local MethodType = { | @@ -379,34 +380,30 @@ local MethodType = { | ||
379 | restaurant_sale_coin = true, -- 售卖获得美食币 | 380 | restaurant_sale_coin = true, -- 售卖获得美食币 |
380 | restaurant_sale_gear = true, -- 售卖获得齿轮 | 381 | restaurant_sale_gear = true, -- 售卖获得齿轮 |
381 | }, | 382 | }, |
382 | - restaurant_material = { --食材获取 --TODO | 383 | + restaurant_material = { --食材获取 |
383 | item_id = true, -- 获取物品ID | 384 | item_id = true, -- 获取物品ID |
384 | - restaurant_material_seqid = true, -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一次获取两件道具情况 | 385 | + restaurant_material_seqid = "ucode", -- 道具变动关联ID,用于关联一次动作产生多条不同类型的日志,如一次获取两件道具情况 |
385 | restaurant_material_start = true, -- 申请获取时间 | 386 | restaurant_material_start = true, -- 申请获取时间 |
386 | restaurant_material_time = true, -- 申请到领取耗时 | 387 | restaurant_material_time = true, -- 申请到领取耗时 |
387 | restaurant_material_num = true, -- 获取物品数量 | 388 | restaurant_material_num = true, -- 获取物品数量 |
388 | }, | 389 | }, |
389 | - restaurant_order = { --订单任务 --TODO | 390 | + restaurant_order = { --订单任务 |
390 | restaurant_order_id = true, -- 订单任务ID | 391 | restaurant_order_id = true, -- 订单任务ID |
391 | restaurant_order_status = true, -- 订单任务状态,接受:0, 拒绝:1, 完成:2 | 392 | restaurant_order_status = true, -- 订单任务状态,接受:0, 拒绝:1, 完成:2 |
392 | - restaurant_order_start = true, -- 订单接收时间,timestamp格式记录 | ||
393 | restaurant_order_rwd = true, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | 393 | restaurant_order_rwd = true, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} |
394 | restaurant_order_lv = true, -- 订单品质等级,普通:0, 稀有:1, 顶级:2, 豪华:3 | 394 | restaurant_order_lv = true, -- 订单品质等级,普通:0, 稀有:1, 顶级:2, 豪华:3 |
395 | }, | 395 | }, |
396 | - restaurant_collect = { --餐厅顾客图谱 --TODO | 396 | + restaurant_collect = { --餐厅顾客图谱 |
397 | restaurant_collect_id = true, -- 图谱收集ID | 397 | restaurant_collect_id = true, -- 图谱收集ID |
398 | restaurant_collect_rwd = true, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | 398 | restaurant_collect_rwd = true, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} |
399 | restaurant_collect_plan = true, -- 收集进度,即解锁顾客,数字表示 | 399 | restaurant_collect_plan = true, -- 收集进度,即解锁顾客,数字表示 |
400 | }, | 400 | }, |
401 | - achievement = { --成就达成 --TODO | 401 | + achievement = { --成就达成 |
402 | achievement_id = true, -- 成就id | 402 | achievement_id = true, -- 成就id |
403 | achievement_type = true, -- 成就类型,具体枚举表中成就类型枚举表 | 403 | achievement_type = true, -- 成就类型,具体枚举表中成就类型枚举表 |
404 | - achievement_name = true, -- 成就名称 | ||
405 | - achievement_score = true, -- 领取成就后成就点数 | ||
406 | - achievement_subscore = true, -- 领取成就后小类成就点数 | ||
407 | achievement_reward = true, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | 404 | achievement_reward = true, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} |
408 | }, | 405 | }, |
409 | - get_gift = { --礼包兑换 --TODO | 406 | + get_gift = { --礼包兑换 |
410 | gift_id = true, -- 礼包ID | 407 | gift_id = true, -- 礼包ID |
411 | gift_key = true, -- 礼包key | 408 | gift_key = true, -- 礼包key |
412 | gift_reward = true, -- 礼包奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | 409 | gift_reward = true, -- 礼包奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} |
@@ -493,7 +490,14 @@ function RoleLog.bind(Role) | @@ -493,7 +490,14 @@ function RoleLog.bind(Role) | ||
493 | pcall(skynet.send, logd, "lua", "log", doc) | 490 | pcall(skynet.send, logd, "lua", "log", doc) |
494 | end | 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 | local reasonType = ItemReason[reason] | 501 | local reasonType = ItemReason[reason] |
498 | if not reasonType then | 502 | if not reasonType then |
499 | printError(string.format("LOG ERROR: onItems no reasonType [%s].", reason)) | 503 | printError(string.format("LOG ERROR: onItems no reasonType [%s].", reason)) |
src/models/RolePlugin.lua
@@ -258,12 +258,7 @@ function RolePlugin.bind(Role) | @@ -258,12 +258,7 @@ function RolePlugin.bind(Role) | ||
258 | items = items:incrv(params.itemId, params.count) | 258 | items = items:incrv(params.itemId, params.count) |
259 | end | 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 | self:setProperty("items", items) | 263 | self:setProperty("items", items) |
269 | if not params.notNotify then | 264 | if not params.notNotify then |
@@ -333,13 +328,7 @@ function RolePlugin.bind(Role) | @@ -333,13 +328,7 @@ function RolePlugin.bind(Role) | ||
333 | self:incrProperty("diamond", count) | 328 | self:incrProperty("diamond", count) |
334 | end | 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 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) | 332 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) |
344 | return true | 333 | return true |
345 | end | 334 | end |
@@ -377,12 +366,8 @@ function RolePlugin.bind(Role) | @@ -377,12 +366,8 @@ function RolePlugin.bind(Role) | ||
377 | self:incrProperty(costFirst[2], -last) | 366 | self:incrProperty(costFirst[2], -last) |
378 | end | 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 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) | 372 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) |
388 | return true | 373 | return true |
@@ -418,12 +403,9 @@ function RolePlugin.bind(Role) | @@ -418,12 +403,9 @@ function RolePlugin.bind(Role) | ||
418 | local bin = MsgPack.pack(heroResponse) | 403 | local bin = MsgPack.pack(heroResponse) |
419 | SendPacket(actionCodes.Hero_loadInfos, bin) | 404 | SendPacket(actionCodes.Hero_loadInfos, bin) |
420 | end | 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 | return true, newHero | 409 | return true, newHero |
428 | end | 410 | end |
429 | 411 | ||
@@ -514,7 +496,8 @@ function RolePlugin.bind(Role) | @@ -514,7 +496,8 @@ function RolePlugin.bind(Role) | ||
514 | if not equipCsv then return end | 496 | if not equipCsv then return end |
515 | local equips = self:getProperty("equips") | 497 | local equips = self:getProperty("equips") |
516 | local curTypeEquips = equips[equipType] or {} | 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 | if curCount < 0 then | 503 | if curCount < 0 then |
@@ -532,22 +515,7 @@ function RolePlugin.bind(Role) | @@ -532,22 +515,7 @@ function RolePlugin.bind(Role) | ||
532 | 515 | ||
533 | self:setProperty("equips", equips) | 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 | if not pms.notNotify then | 520 | if not pms.notNotify then |
553 | self:changeUpdates({{type = "equips", field = {equipType, equipLv}, value = curCount, isOnlyToC = true}}) -- 通知客户端 | 521 | self:changeUpdates({{type = "equips", field = {equipType, equipLv}, value = curCount, isOnlyToC = true}}) -- 通知客户端 |
@@ -607,20 +575,7 @@ function RolePlugin.bind(Role) | @@ -607,20 +575,7 @@ function RolePlugin.bind(Role) | ||
607 | end | 575 | end |
608 | self:checkTaskEnter("AddRune", {id = params.id, type = params.type, rarity = data.rarity}, params.notNotify) | 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 | return 0, newRune | 580 | return 0, newRune |
626 | else | 581 | else |
@@ -636,20 +591,7 @@ function RolePlugin.bind(Role) | @@ -636,20 +591,7 @@ function RolePlugin.bind(Role) | ||
636 | local rune = self.runeBag[runeId] | 591 | local rune = self.runeBag[runeId] |
637 | if rune and rune:getProperty("refer") == 0 then | 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 | self.runeBag[runeId] = nil | 596 | self.runeBag[runeId] = nil |
655 | table.insert(bDel, runeId) | 597 | table.insert(bDel, runeId) |
@@ -895,19 +837,7 @@ function RolePlugin.bind(Role) | @@ -895,19 +837,7 @@ function RolePlugin.bind(Role) | ||
895 | 837 | ||
896 | count = count or 1 | 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 | if csvdb["itemCsv"][func] and csvdb["itemCsv"][func].type == ItemType.FuncOpen then | 842 | if csvdb["itemCsv"][func] and csvdb["itemCsv"][func].type == ItemType.FuncOpen then |
913 | local unlockData = csvdb["unlockCsv"][func] | 843 | local unlockData = csvdb["unlockCsv"][func] |