87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
1
2
3
4
5
6
7
8
9
10
11
|
local ipairs = ipairs
local table = table
local math = math
local redisproxy = redisproxy
local MsgPack = MsgPack
local _M = {}
function _M.addSellRpc( agent, data )
local role = agent.role
local msg = MsgPack.unpack(data)
|
03a6166a
zhouhaihai
餐厅优化
|
12
|
local sellData = msg
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
13
|
|
03a6166a
zhouhaihai
餐厅优化
|
14
15
16
17
18
19
20
21
22
|
local slot = sellData.slot
local sells = json.decode(role.dinerData:getProperty("sells"))
if sells[slot] and sells[slot].count and sells[slot].count ~= 0 then
return 0
end
if math.illegalNum(slot, 1, role.dinerData:getMaxSlots()) then
return 1
end
slot = tostring(slot)
|
36204e3c
zhengshouren
贩卖逻辑
|
23
|
|
03a6166a
zhouhaihai
餐厅优化
|
24
25
26
27
28
29
30
31
32
33
34
35
36
|
local dish = sellData.dish
local dishSet = csvdb["diner_dishCsv"][dish]
if not dishSet then
return 2
end
local dishLevel = role.dinerData:getProperty("dishTree"):getv(dish, 0)
if dishLevel == 0 then
return 3
end
local dishData = dishSet[dishLevel]
if not dishData then
return 4
end
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
37
|
|
03a6166a
zhouhaihai
餐厅优化
|
38
39
40
41
42
|
local calSell = role.dinerData:updateSell(slot, true) or {
deltaCount = 0,
deltaTime = 0,
lastCount = 0,
}
|
d8ba6e11
zhouhaihai
保护
|
43
|
local count = sellData.count or 0
|
03a6166a
zhouhaihai
餐厅优化
|
44
45
46
47
|
local maxDishCount = role.dinerData:getMaxDishs()
if math.illegalNum(count + calSell.lastCount, 1, maxDishCount) then
return 5
end
|
36204e3c
zhengshouren
贩卖逻辑
|
48
|
|
03a6166a
zhouhaihai
餐厅优化
|
49
50
51
52
53
54
55
|
local cost = dishData.material:toNumMap()
for k, n in pairs(cost) do
cost[k] = n * count
end
if not role:checkItemEnough(cost) then
return 6
end
|
36204e3c
zhengshouren
贩卖逻辑
|
56
|
|
3133cb76
zhouhaihai
日志
|
57
|
role:costItems(cost, {log = {desc = "addSell"}})
|
03a6166a
zhouhaihai
餐厅优化
|
58
|
role.dinerData:updateSell(slot)
|
cc796aaf
zhengshouren
增加餐厅任务计数逻辑
|
59
|
|
03a6166a
zhouhaihai
餐厅优化
|
60
61
62
63
64
65
66
67
68
69
|
role:checkTaskEnter("MakeFood", {id = dish, count = count})
-- local dirty = false
-- if dirty then
-- role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order"))
-- end
sells = json.decode(role.dinerData:getProperty("sells"))
if not sells[slot] then
sells[slot] = {
reward = "",
|
59835765
zhouhaihai
排行榜
|
70
|
popular = 0,
|
03a6166a
zhouhaihai
餐厅优化
|
71
|
}
|
36204e3c
zhengshouren
贩卖逻辑
|
72
|
end
|
03a6166a
zhouhaihai
餐厅优化
|
73
74
75
76
|
sells[slot].dish = dish
sells[slot].level = dishLevel
sells[slot].count = count
sells[slot].time = skynet.timex() - calSell.deltaTime
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
77
|
|
40b19300
chenyueqi
电波塔激活加成效果后对各个系统的加成
|
78
79
|
local timeSub = role:getBnousDiner(3,dishData.sell_time)
local needTime = sells[slot].count * (dishData.sell_time + timeSub) + sells[slot].time - skynet.timex()
|
072db127
zhouhaihai
推送
|
80
81
|
role:pushMsg({type = "food", slot = slot, time = needTime})
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
82
83
84
85
86
87
88
89
|
-- 检查解锁的顾客
local had = {}
for _, sell in pairs(sells) do
if sell.dish then
had[sell.dish] = sell.level
end
end
|
ae820b73
zhouhaihai
bug
|
90
|
local customer = role.dinerData:getProperty("customer")
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
local change = false
for cId, cData in pairs(csvdb["diner_customerCsv"]) do
if not customer[cId] then
local unlock = true
for needId, lv in pairs(cData.unlock:toNumMap()) do
if not had[needId] or had[needId] < lv then
unlock = false
break
end
end
if unlock then
change = true
customer[cId] = 0
end
end
end
if change then
role.dinerData:updateProperty({field = "customer", value = customer})
end
|
1e9cb217
chenyueqi
服务器记录控制引导过程
|
111
|
role:finishGuide(28)
|
3133cb76
zhouhaihai
日志
|
112
|
|
f22a33af
zhouhaihai
自己的日志
|
113
114
|
role:mylog("diner_action", {desc = "addSell", int1 = dish, int2 = count})
|
03a6166a
zhouhaihai
餐厅优化
|
115
|
role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
|
36204e3c
zhengshouren
贩卖逻辑
|
116
|
SendPacket(actionCodes.Diner_addSellRpc, "")
|
36204e3c
zhengshouren
贩卖逻辑
|
117
|
return true
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
118
119
|
end
|
1ab9458f
gaofengduan
add 下菜操作
|
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
function _M.removeSellRpc( agent, data )
local role = agent.role
local msg = MsgPack.unpack(data)
local slot = msg.slot
if math.illegalNum(slot, 1, role.dinerData:getMaxSlots()) then
return 1
end
slot = tostring(slot)
local sells = json.decode(role.dinerData:getProperty("sells"))
local sell = sells[slot]
if not sell then
return 2
end
|
1ab9458f
gaofengduan
add 下菜操作
|
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
local dish = sell.dish
local dishSet = csvdb["diner_dishCsv"][dish]
if not dishSet then
return 3
end
local dishLevel = role.dinerData:getProperty("dishTree"):getv(dish, 0)
if dishLevel == 0 then
return 4
end
local dishData = dishSet[dishLevel]
if not dishData then
return 5
end
|
b8c1be12
zhouhaihai
一些 bug
|
148
149
150
151
152
|
local temp = role.dinerData:updateSell(slot) or {
deltaCount = 0,
deltaTime = 0,
lastCount = 0,
}
|
7bb30dca
zhouhaihai
修改发奖
|
153
|
local reward, change = {}
|
1ab9458f
gaofengduan
add 下菜操作
|
154
155
156
|
local cost = dishData.material:toNumMap()
for k, n in pairs(cost) do
local sum = n*sell.count
|
1ab9458f
gaofengduan
add 下菜操作
|
157
158
|
reward[k] = sum
end
|
7bb30dca
zhouhaihai
修改发奖
|
159
|
reward, change = role:award(reward, {log = {desc = "removeSell"}})
|
5a307eb6
gaofengduan
fix diner
|
160
|
sells[slot].count = 0
|
3133cb76
zhouhaihai
日志
|
161
|
|
072db127
zhouhaihai
推送
|
162
|
role:pushCancel({type = "food", slot = slot})
|
c59e058b
zhouhaihai
新一批日志记录
|
163
164
165
166
167
168
169
170
|
role:log("restaurant_sale", {
item_id = dish, -- 售卖物品ID
restaurant_sale_seat = slot, -- 售卖物品所在位置
restaurant_sale_time = temp.deltaTime or 0, -- 售卖时长
restaurant_sale_type = 2, -- 售卖方式,正常售卖:0, 加速:1,移除售卖:2
restaurant_sale_coin = reward[ItemId.DinerCoin] or 0, -- 售卖获得美食币
restaurant_sale_gear = reward[ItemId.Gold] or 0, -- 售卖获得齿轮
})
|
f22a33af
zhouhaihai
自己的日志
|
171
|
role:mylog("diner_action", {desc = "removeSell", int1 = dish})
|
3133cb76
zhouhaihai
日志
|
172
|
|
1ab9458f
gaofengduan
add 下菜操作
|
173
|
role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
|
7bb30dca
zhouhaihai
修改发奖
|
174
|
SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward, change = change}))
|
1ab9458f
gaofengduan
add 下菜操作
|
175
176
177
|
return true
end
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
178
|
function _M.getSellRewardRpc( agent, data )
|
5d57bd79
gaofengduan
add 餐车 getSellRew...
|
179
|
local role = agent.role
|
cc796aaf
zhengshouren
增加餐厅任务计数逻辑
|
180
|
local dirty = false
|
59835765
zhouhaihai
排行榜
|
181
|
local reward, popular = "", 0
|
5d57bd79
gaofengduan
add 餐车 getSellRew...
|
182
|
local sells = json.decode(role.dinerData:getProperty("sells"))
|
c59e058b
zhouhaihai
新一批日志记录
|
183
184
|
local deltaTimes = {}
|
70fb62d1
liuzujun
服务器数据打点
|
185
186
187
|
for slot, sell in pairs(sells) do
local oldCount = sell.count
local sellDish = sell.dish
|
b8c1be12
zhouhaihai
一些 bug
|
188
189
190
191
192
|
local temp = role.dinerData:updateSell(slot) or {
deltaCount = 0,
deltaTime = 0,
lastCount = 0,
}
|
c59e058b
zhouhaihai
新一批日志记录
|
193
|
deltaTimes[slot] = temp.deltaTime
|
70fb62d1
liuzujun
服务器数据打点
|
194
195
|
local sellCount = oldCount - temp.lastCount
role:mylog("diner_action", {desc = "sell", int1 = sellDish, int2 = sellCount})
|
32161569
gaofengduan
fix diner
|
196
197
198
|
end
sells = json.decode(role.dinerData:getProperty("sells"))
for slot, sell in pairs(sells) do
|
cc796aaf
zhengshouren
增加餐厅任务计数逻辑
|
199
200
|
local rewards = sell.reward:toNumMap()
for k,v in pairs(rewards) do
|
f5c07b1b
gaofengduan
fix diner
|
201
|
reward = reward:incrv(k, v)
|
5d57bd79
gaofengduan
add 餐车 getSellRew...
|
202
|
end
|
59835765
zhouhaihai
排行榜
|
203
|
popular = popular + (sell.popular or 0)
|
77302523
zhouhaihai
任务
|
204
|
|
cc796aaf
zhengshouren
增加餐厅任务计数逻辑
|
205
|
if rewards[ItemId.Gold] and rewards[ItemId.Gold] > 0 then
|
da6362db
gaofengduan
fix dinerData
|
206
|
if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then
|
cc796aaf
zhengshouren
增加餐厅任务计数逻辑
|
207
208
|
dirty = true
end
|
77302523
zhouhaihai
任务
|
209
210
211
212
213
214
215
|
if role.dinerData:checkDinerTask(DinerTask.DishWithGoldType, rewards[ItemId.Gold], math.ceil(sell.dish / 100), nil, true) then
dirty = true
end
local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level]
if role.dinerData:checkDinerTask(DinerTask.DishWithGoldRare, rewards[ItemId.Gold], dishData.rarity, nil, true) then
dirty = true
end
|
cc796aaf
zhengshouren
增加餐厅任务计数逻辑
|
216
|
end
|
32161569
gaofengduan
fix diner
|
217
|
sells[slot].reward = ""
|
59835765
zhouhaihai
排行榜
|
218
|
sells[slot].popular = 0
|
c59e058b
zhouhaihai
新一批日志记录
|
219
220
221
222
223
224
225
226
227
|
role:log("restaurant_sale", {
item_id = sell.dish, -- 售卖物品ID
restaurant_sale_seat = slot, -- 售卖物品所在位置
restaurant_sale_time = deltaTimes[slot] or 0, -- 售卖时长
restaurant_sale_type = 0, -- 售卖方式,正常售卖:0, 加速:1,移除售卖:2
restaurant_sale_coin = rewards[ItemId.DinerCoin] or 0, -- 售卖获得美食币
restaurant_sale_gear = rewards[ItemId.Gold] or 0, -- 售卖获得齿轮
})
|
5d57bd79
gaofengduan
add 餐车 getSellRew...
|
228
|
end
|
f5c07b1b
gaofengduan
fix diner
|
229
|
role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
|
3133cb76
zhouhaihai
日志
|
230
231
|
local gift = reward:toNumMap()
for k, v in pairs(gift) do
|
53e8037e
zhouhaihai
任务
|
232
233
234
|
if k == ItemId.Gold then
role:checkTaskEnter("FoodSellGold", {count = v})
end
|
5d57bd79
gaofengduan
add 餐车 getSellRew...
|
235
|
end
|
7bb30dca
zhouhaihai
修改发奖
|
236
|
local reward, change = role:award(gift, {log = {desc = "dinerSell"}})
|
3133cb76
zhouhaihai
日志
|
237
|
|
32161569
gaofengduan
fix diner
|
238
|
|
59835765
zhouhaihai
排行榜
|
239
240
|
role.dinerData:popularAdd(popular)
|
cc796aaf
zhengshouren
增加餐厅任务计数逻辑
|
241
|
if dirty then
|
da6362db
gaofengduan
fix dinerData
|
242
|
role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order"))
|
cc796aaf
zhengshouren
增加餐厅任务计数逻辑
|
243
|
end
|
3133cb76
zhouhaihai
日志
|
244
|
|
70fb62d1
liuzujun
服务器数据打点
|
245
|
--role:mylog("diner_action", {desc = "sell"})
|
3133cb76
zhouhaihai
日志
|
246
|
|
7bb30dca
zhouhaihai
修改发奖
|
247
|
SendPacket(actionCodes.Diner_getSellRewardRpc, MsgPack.pack({reward = reward, change = change}))
|
5d57bd79
gaofengduan
add 餐车 getSellRew...
|
248
|
return true
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
249
250
|
end
|
2050d40d
gaofengduan
add diner expedit...
|
251
252
|
function _M.expediteSellRpc( agent, data )
local role = agent.role
|
020fc7ed
gaofengduan
fix diner expedit...
|
253
254
|
local count = role.dinerData:getProperty("expedite")
local max = #globalCsv.diner_sell_quick_cost
|
2c63e6a0
gaofengduan
fix dienr
|
255
|
if count > max then
|
020fc7ed
gaofengduan
fix diner expedit...
|
256
257
|
return 1
end
|
10974097
gaofengduan
fix diner
|
258
259
|
local diamond = globalCsv.diner_sell_quick_cost[count]
if diamond > 0 then
|
3d8050ef
liuzujun
钻石3改成虹光玉8
|
260
|
local cost = {[ItemId.Jade] = diamond}
|
10974097
gaofengduan
fix diner
|
261
262
263
|
if not role:checkItemEnough(cost) then
return 2
end
|
3133cb76
zhouhaihai
日志
|
264
|
role:costItems(cost, {log = {desc = "dinerSellQ"}})
|
020fc7ed
gaofengduan
fix diner expedit...
|
265
|
end
|
020fc7ed
gaofengduan
fix diner expedit...
|
266
|
|
2050d40d
gaofengduan
add diner expedit...
|
267
|
local dirty = false
|
59835765
zhouhaihai
排行榜
|
268
|
local reward,popular = "", 0
|
2050d40d
gaofengduan
add diner expedit...
|
269
270
271
272
273
274
|
local sells = json.decode(role.dinerData:getProperty("sells"))
for slot, _ in pairs(sells) do
role.dinerData:updateSell(slot)
end
sells = json.decode(role.dinerData:getProperty("sells"))
for slot, sell in pairs(sells) do
|
020fc7ed
gaofengduan
fix diner expedit...
|
275
|
local result = role.dinerData:expediteSell(slot)
|
6991df1b
gaofengduan
fix bug
|
276
277
278
279
280
281
|
if result then
local rewards = result.reward:toNumMap()
for k,v in pairs(result.reward:toNumMap()) do
reward = reward:incrv(k,v)
end
popular = popular + result.popular
|
2050d40d
gaofengduan
add diner expedit...
|
282
|
|
6991df1b
gaofengduan
fix bug
|
283
284
285
286
|
if rewards[ItemId.Gold] and rewards[ItemId.Gold] > 0 then
if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then
dirty = true
end
|
77302523
zhouhaihai
任务
|
287
288
289
290
291
292
293
|
if role.dinerData:checkDinerTask(DinerTask.DishWithGoldType, rewards[ItemId.Gold], math.ceil(sell.dish / 100), nil, true) then
dirty = true
end
local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level]
if role.dinerData:checkDinerTask(DinerTask.DishWithGoldRare, rewards[ItemId.Gold], dishData.rarity, nil, true) then
dirty = true
end
|
2050d40d
gaofengduan
add diner expedit...
|
294
|
end
|
c59e058b
zhouhaihai
新一批日志记录
|
295
296
297
298
299
300
301
302
303
|
role:log("restaurant_sale", {
item_id = sell.dish, -- 售卖物品ID
restaurant_sale_seat = slot, -- 售卖物品所在位置
restaurant_sale_time = result.deltaTime or 0, -- 售卖时长
restaurant_sale_type = 1, -- 售卖方式,正常售卖:0, 加速:1,移除售卖:2
restaurant_sale_coin = rewards[ItemId.DinerCoin] or 0, -- 售卖获得美食币
restaurant_sale_gear = rewards[ItemId.Gold] or 0, -- 售卖获得齿轮
})
|
2050d40d
gaofengduan
add diner expedit...
|
304
305
306
|
end
end
|
020fc7ed
gaofengduan
fix diner expedit...
|
307
308
309
|
role.dinerData:notifyUpdateProperty("sells", role.dinerData:getProperty("sells"))
role.dinerData:setProperty("expedite",count+1)
role.dinerData:notifyUpdateProperty("expedite", count+1)
|
3133cb76
zhouhaihai
日志
|
310
|
local gift = reward:toNumMap()
|
317a46a9
liuzujun
添加特权卡
|
311
312
|
-- 特权卡获取加速获得额外道具
|
e089be2e
liuzujun
取消特权卡餐厅加速获得额外道具功能
|
313
|
local coef = 1 --role.storeData:getProduceItemSpeedCoef()
|
3133cb76
zhouhaihai
日志
|
314
|
for k, v in pairs(gift) do
|
317a46a9
liuzujun
添加特权卡
|
315
316
317
318
|
if coef > 1 then
v = math.floor(v * coef)
gift[k] = v
end
|
f60b89b1
zhouhaihai
奖励副本
|
319
320
321
|
if k == ItemId.Gold then
role:checkTaskEnter("FoodSellGold", {count = v})
end
|
2050d40d
gaofengduan
add diner expedit...
|
322
|
end
|
7bb30dca
zhouhaihai
修改发奖
|
323
324
|
local change
reward, change = role:award(gift, {log = {desc = "dinerSell"}})
|
3133cb76
zhouhaihai
日志
|
325
|
|
2050d40d
gaofengduan
add diner expedit...
|
326
|
|
59835765
zhouhaihai
排行榜
|
327
328
|
role.dinerData:popularAdd(popular)
|
2050d40d
gaofengduan
add diner expedit...
|
329
330
331
|
if dirty then
role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order"))
end
|
53e8037e
zhouhaihai
任务
|
332
|
role:checkTaskEnter("FoodSellQuick")
|
3133cb76
zhouhaihai
日志
|
333
|
|
70fb62d1
liuzujun
服务器数据打点
|
334
|
role:mylog("diner_action", {desc = "sellQ", int1 = count + 1})
|
f22a33af
zhouhaihai
自己的日志
|
335
|
|
7bb30dca
zhouhaihai
修改发奖
|
336
|
SendPacket(actionCodes.Diner_expediteSellRpc, MsgPack.pack({reward = reward, change = change, popular = popular}))
|
2050d40d
gaofengduan
add diner expedit...
|
337
338
339
|
return true
end
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
340
341
342
343
344
|
function _M.levelUpRpc( agent, data )
local role = agent.role
local msg = MsgPack.unpack(data)
local index = msg.index
|
f9c6cac9
zhengshouren
建筑升级增加 其他建筑物等级限制
|
345
346
|
local buildingSet = csvdb["diner_buildingCsv"][index]
if not buildingSet then
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
347
348
349
350
351
|
return
end
local buildL = role.dinerData:getProperty("buildL")
local curLevel = buildL:getv(index, 1)
|
f9c6cac9
zhengshouren
建筑升级增加 其他建筑物等级限制
|
352
|
if curLevel >= #buildingSet then
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
353
354
|
return
end
|
f9c6cac9
zhengshouren
建筑升级增加 其他建筑物等级限制
|
355
356
357
358
359
|
local buildingData = buildingSet[curLevel]
if not buildingData then
return
end
if buildingData.upLimit ~= "" then
|
4a969fc5
gaofengduan
fix diner levelUpRpc
|
360
|
local id, level = buildingData.upLimit:match("(%d+)=(%d+)")
|
f9c6cac9
zhengshouren
建筑升级增加 其他建筑物等级限制
|
361
362
363
364
|
if buildL:getv(tonumber(id), 1) < tonumber(level) then
return
end
end
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
365
|
|
f9c6cac9
zhengshouren
建筑升级增加 其他建筑物等级限制
|
366
|
local cost = buildingData.starCost:toNumMap()
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
367
|
if not role:checkItemEnough(cost) then
|
289a4927
gaofengduan
fix diner talent
|
368
|
return
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
369
370
|
end
|
3133cb76
zhouhaihai
日志
|
371
|
role:costItems(cost, {log = {desc = "dinerBuildUp", int1 = index}})
|
d96fae59
gaofengduan
fix diner levelUpRpc
|
372
|
role.dinerData:updateProperty({field = "buildL", value = buildL:setv(index, curLevel + 1)})
|
53e8037e
zhouhaihai
任务
|
373
|
role:checkTaskEnter("DinerLevelUp", {type = index, level = curLevel + 1})
|
3133cb76
zhouhaihai
日志
|
374
|
|
c59e058b
zhouhaihai
新一批日志记录
|
375
376
377
378
379
380
381
|
role:log("restaurant_up", {
restaurant_up_type = index - 1, --升级部件类型,店面:0, 接客:1, 满意度:2, 宣传:3, 广告:4, 周边:5
restaurant_up_gear = cost[ItemId.Gold] or 0, --消耗齿轮数量
restaurant_up_coin = cost[ItemId.DinerCoin] or 0, --花费美食币数量
restaurant_up_effectbef = curLevel, --升级前加成
restaurant_up_effect = curLevel + 1, --升级后加成
})
|
f22a33af
zhouhaihai
自己的日志
|
382
|
role:mylog("diner_action", {desc = "buildUp", int1 = index, int2 = curLevel + 1})
|
3133cb76
zhouhaihai
日志
|
383
|
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
384
385
386
387
|
SendPacket(actionCodes.Diner_levelUpRpc, '')
return true
end
|
b67180e8
zhengshouren
餐厅天赋升级
|
388
389
390
|
function _M.talentUpRpc( agent, data )
local role = agent.role
local msg = MsgPack.unpack(data)
|
b67180e8
zhengshouren
餐厅天赋升级
|
391
|
local dish = msg.dish
|
b67180e8
zhengshouren
餐厅天赋升级
|
392
|
local dishTree = role.dinerData:getProperty("dishTree")
|
289a4927
gaofengduan
fix diner talent
|
393
394
395
396
397
398
|
local talentSet = csvdb["diner_talentCsv"][dish]
if not talentSet then
return 1
end
|
289a4927
gaofengduan
fix diner talent
|
399
400
401
402
403
404
405
406
407
408
409
|
local typ = math.floor(dish/100 + 1)
local treeSet = csvdb["diner_treeCsv"][typ]
if not treeSet then
return 3
end
local treeData = treeSet[dish]
if not treeData then
return 4
end
|
0027e33b
chenyueqi
调理剂生产和使用逻辑优化
|
410
411
412
413
414
415
416
417
418
419
420
|
-- 调理剂的默认等级是1级
local dishLevel = dishTree:getv(dish, treeData.rarity == 2 and 1 or 0)
local talentData = talentSet[dishLevel]
if not talentData then
return 2
end
if not talentSet[dishLevel+1] then
return 21
end
|
653e7a15
zhouhaihai
talent 前置调整
|
421
|
local limit = talentData.pointFront:toNumMap()
|
289a4927
gaofengduan
fix diner talent
|
422
423
424
425
|
for k,v in pairs(limit) do
local lv = dishTree:getv(k, 0)
if lv < v then
return 5
|
b67180e8
zhengshouren
餐厅天赋升级
|
426
|
end
|
b67180e8
zhengshouren
餐厅天赋升级
|
427
|
end
|
289a4927
gaofengduan
fix diner talent
|
428
|
|
f02087ed
chenyueqi
调理室解锁技能点增加前置关卡条件判定
|
429
|
if talentData.levelFront ~= "" then
|
33be3111
zhouhaihai
修改hangPass 结构
|
430
|
if not role:checkHangPass(tonumber(talentData.levelFront)) then
|
f02087ed
chenyueqi
调理室解锁技能点增加前置关卡条件判定
|
431
432
433
434
|
return 9
end
end
|
289a4927
gaofengduan
fix diner talent
|
435
|
local cost = talentData.cost:toNumMap()
|
b67180e8
zhengshouren
餐厅天赋升级
|
436
|
if not role:checkItemEnough(cost) then
|
289a4927
gaofengduan
fix diner talent
|
437
438
439
|
return 6
end
|
dbd0ca58
gaofengduan
car 营养剂制作
|
440
|
-- 正在贩卖不能升级料理天赋
|
289a4927
gaofengduan
fix diner talent
|
441
442
443
444
445
446
|
local sells = json.decode(role.dinerData:getProperty("sells"))
for slot, _ in pairs(sells) do
role.dinerData:updateSell(slot)
end
sells = json.decode(role.dinerData:getProperty("sells"))
for _, sell in pairs(sells) do
|
6991df1b
gaofengduan
fix bug
|
447
|
if sell.dish == msg.dish and sell.count > 0 then
|
289a4927
gaofengduan
fix diner talent
|
448
449
|
return 7
end
|
b67180e8
zhengshouren
餐厅天赋升级
|
450
451
|
end
|
dbd0ca58
gaofengduan
car 营养剂制作
|
452
|
-- 正在冒险不能升级营养剂天赋
|
69d686f8
gaofengduan
暂时取消营养剂天赋升级限制
|
453
454
455
|
-- if talentData.effect:toArray(true,"=")[1] == 2 then
-- if next(role:getProperty("advTeam")) then return 8 end
-- end
|
dbd0ca58
gaofengduan
car 营养剂制作
|
456
|
|
3133cb76
zhouhaihai
日志
|
457
|
role:costItems(cost, {log = {desc = "talentUp", int1 = dish, int2 = dishLevel + 1}})
|
b67180e8
zhengshouren
餐厅天赋升级
|
458
|
role.dinerData:updateProperty({field = "dishTree", value = dishTree:setv(dish, dishLevel + 1)})
|
08bfcb88
zhouhaihai
策划要求删掉
|
459
460
461
462
|
-- local treePoint = talentData.tree_point:toNumMap()
-- if next(treePoint) then
-- role:award(treePoint)
-- end
|
b67180e8
zhengshouren
餐厅天赋升级
|
463
|
|
d763fb14
zhouhaihai
签到 九宫格
|
464
|
role:checkTaskEnter("DinerTalentUp", {type = talentData.effect:toArray(true,"=")[1], level = dishLevel + 1})
|
1e9cb217
chenyueqi
服务器记录控制引导过程
|
465
|
role:finishGuide(27)
|
c59e058b
zhouhaihai
新一批日志记录
|
466
467
468
469
470
471
472
|
role:log("carriage_logistics", {
carriage_logistics_type = typ, -- 后勤室制作类型ID,变异:0,通常:1,魔法:2
carriage_logistics_itemid = dish, -- 后勤室升级物品或技能ID
carriage_logistics_itemlv = dishLevel + 1, -- 升级后物品或技能等级
carriage_logistics_gear = cost[ItemId.Gold] or 0, -- 后勤室升级花费齿轮数量
carriage_logistics_coin = cost[ItemId.DinerCoin] or 0, -- 后勤室升级花费美食币数量
})
|
f22a33af
zhouhaihai
自己的日志
|
473
474
|
role:mylog("diner_action", {desc = "talentUp", int1 = dish, int2 = dishLevel + 1})
|
b67180e8
zhengshouren
餐厅天赋升级
|
475
476
477
478
|
SendPacket(actionCodes.Diner_talentUpRpc, '')
return true
end
|
7d44dca2
zhengshouren
支援技能升级逻辑
|
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
|
function _M.skillUpRpc( agent, data )
local role = agent.role
local msg = MsgPack.unpack(data)
local skill = msg.skill
local skillSet = csvdb["diner_skillCsv"][skill]
if not skillSet then
return
end
local skillTree = role.dinerData:getProperty("skillTree")
local skillLevel = skillTree:getv(skill, 1)
local skillData = skillSet[skillLevel]
if not skillData then
return
end
if skillData.unlock ~= "" then
local id, level = skillData.unlock:math("(%d+)=(%d+)")
if skillTree:getv(tonumber(id), 1) < tonumber(level) then
return
end
end
local cost = skillData.cost:toNumMap()
if not role:checkItemEnough(cost) then
return
end
|
3133cb76
zhouhaihai
日志
|
506
|
role:costItems(cost, {log = {desc = "dinerSkillUp", int1 = skill, int2 = skillLevel + 1}})
|
7d44dca2
zhengshouren
支援技能升级逻辑
|
507
|
role.dinerData:updateProperty({field = "skillTree", value = skillTree:setv(skill, skillLevel + 1)})
|
f22a33af
zhouhaihai
自己的日志
|
508
|
role:mylog("diner_action", {desc = "skillUp", int1 = skill, int2 = skillLevel + 1})
|
7d44dca2
zhengshouren
支援技能升级逻辑
|
509
510
511
512
513
|
SendPacket(actionCodes.Diner_skillUpRpc, '')
return true
end
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
514
515
516
517
518
|
function _M.lockTaskRpc( agent, data )
local role = agent.role
local msg = MsgPack.unpack(data)
local index = msg.index
|
550ba7e7
zhouhaihai
订单
|
519
520
521
|
local orders = json.decode(role.dinerData:getProperty("order"))
if math.illegalNum(index, 1, #orders) then
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
522
523
|
return 1
end
|
550ba7e7
zhouhaihai
订单
|
524
|
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
525
526
527
528
|
local order = orders[index]
if not order then
return 2
end
|
fdb86cad
gaofengduan
fix diner task
|
529
530
531
532
|
if order.lock == 0 then
order.lock = 1
else
order.lock = 0
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
533
|
end
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
534
|
role.dinerData:updateProperty({field = "order", value = json.encode(orders)})
|
3133cb76
zhouhaihai
日志
|
535
|
|
f22a33af
zhouhaihai
自己的日志
|
536
537
|
role:mylog("diner_action", {desc = "lockTask", int1 = order.id})
|
fdb86cad
gaofengduan
fix diner task
|
538
|
SendPacket(actionCodes.Diner_lockTaskRpc, MsgPack.pack({lock = order.lock}))
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
539
540
541
|
return true
end
|
fdb86cad
gaofengduan
fix diner task
|
542
|
function _M.updateTaskRpc( agent, data )
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
543
544
|
local role = agent.role
local msg = MsgPack.unpack(data)
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
545
|
local index = msg.index
|
550ba7e7
zhouhaihai
订单
|
546
|
-- 0 接受任务,1 放弃已接受任务,2 完成已接受任务
|
fdb86cad
gaofengduan
fix diner task
|
547
|
local cmd = msg.cmd
|
550ba7e7
zhouhaihai
订单
|
548
549
|
local orders = json.decode(role.dinerData:getProperty("order"))
if math.illegalNum(index, 1, #orders) then
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
550
551
|
return 1
end
|
550ba7e7
zhouhaihai
订单
|
552
|
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
553
554
555
556
|
local order = orders[index]
if not order then
return 2
end
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
557
558
559
560
561
562
563
564
|
local taskSet = csvdb["diner_questCsv"][order.lv]
if not taskSet then
return 4
end
local taskData = taskSet[order.id]
if not taskData then
return 5
end
|
289a4927
gaofengduan
fix diner talent
|
565
|
|
7bb30dca
zhouhaihai
修改发奖
|
566
|
local reward, change
|
fdb86cad
gaofengduan
fix diner task
|
567
568
569
570
571
572
|
if cmd == 0 then
if order.status ~= 0 then
return 30
end
orders[index].status = 1
orders[index].lock = 1
|
3133cb76
zhouhaihai
日志
|
573
|
|
f22a33af
zhouhaihai
自己的日志
|
574
575
|
role:checkTaskEnter("GetOderTask", {rarity = taskData.rarity})
role:mylog("diner_action", {desc = "getTask", int1 = order.id})
|
fdb86cad
gaofengduan
fix diner task
|
576
577
578
579
580
581
|
elseif cmd == 1 then
if order.status ~= 1 then
return 31
end
orders[index].status = 0
orders[index].lock = 0
|
3133cb76
zhouhaihai
日志
|
582
|
|
f22a33af
zhouhaihai
自己的日志
|
583
584
|
role:mylog("diner_action", {desc = "deleteTask", int1 = order.id})
|
fdb86cad
gaofengduan
fix diner task
|
585
|
elseif cmd == 2 then
|
452d6146
gaofengduan
fix diner task
|
586
|
if order.status ~= 1 then
|
fdb86cad
gaofengduan
fix diner task
|
587
588
|
return 32
end
|
452d6146
gaofengduan
fix diner task
|
589
|
if order.n < taskData.value then
|
fdb86cad
gaofengduan
fix diner task
|
590
591
|
return 6
end
|
f22a33af
zhouhaihai
自己的日志
|
592
|
role:mylog("diner_action", {desc = "finishTask", int1 = order.id})
|
3133cb76
zhouhaihai
日志
|
593
|
|
7bb30dca
zhouhaihai
修改发奖
|
594
|
reward, change = role:award(taskData.reward, {log = {desc = "dinerFinishTask", int1 = order.id}})
|
452d6146
gaofengduan
fix diner task
|
595
|
table.remove(orders,index)
|
f22a33af
zhouhaihai
自己的日志
|
596
|
role:checkTaskEnter("OverOderTask", {rarity = taskData.rarity})
|
fdb86cad
gaofengduan
fix diner task
|
597
598
|
else
return 33
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
599
600
|
end
|
c59e058b
zhouhaihai
新一批日志记录
|
601
602
603
604
|
role:log("restaurant_order", {
restaurant_order_id = order.id, -- 订单任务ID
restaurant_order_status = cmd, -- 订单任务状态,接受:0, 拒绝:1, 完成:2
|
f22a33af
zhouhaihai
自己的日志
|
605
606
|
restaurant_order_rwd = reward or {}, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
restaurant_order_lv = taskData.rarity, -- 订单品质等级,普通:0, 稀有:1, 顶级:2, 豪华:3
|
9be3f3ea
zhouhaihai
日志需求
|
607
|
restaurant_order_type = 1, -- 订单任务类型,0:特殊顾客,1:特别订单
|
c59e058b
zhouhaihai
新一批日志记录
|
608
609
|
})
|
fdb86cad
gaofengduan
fix diner task
|
610
|
role.dinerData:updateProperty({field = "order", value = json.encode(orders)})
|
7bb30dca
zhouhaihai
修改发奖
|
611
|
SendPacket(actionCodes.Diner_updateTaskRpc, MsgPack.pack({reward = reward, change = change}))
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
612
613
614
|
return true
end
|
fdb86cad
gaofengduan
fix diner task
|
615
|
function _M.refreshTaskRpc( agent, data )
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
616
617
618
|
local role = agent.role
local msg = MsgPack.unpack(data)
|
3d8050ef
liuzujun
钻石3改成虹光玉8
|
619
|
--local cost = {[ItemId.Jade] = 40}
|
8efb24c9
liuzujun
天赋系统属性加成改为百分比
|
620
621
622
|
--if not role:checkItemEnough(cost) then
-- return 1
--end
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
623
624
|
local orders = json.decode(role.dinerData:getProperty("order"))
|
550ba7e7
zhouhaihai
订单
|
625
626
|
local hadTask = {}
|
7898054a
zhouhaihai
新随机订单
|
627
|
local needCount = 0
|
550ba7e7
zhouhaihai
订单
|
628
|
for idx, temp in pairs(orders) do
|
7898054a
zhouhaihai
新随机订单
|
629
|
if temp.lock ~= 0 or temp.status ~= 0 then
|
550ba7e7
zhouhaihai
订单
|
630
|
hadTask[temp.id] = 1
|
7898054a
zhouhaihai
新随机订单
|
631
632
|
else
needCount = needCount + 1
|
550ba7e7
zhouhaihai
订单
|
633
|
end
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
634
635
|
end
|
550ba7e7
zhouhaihai
订单
|
636
637
|
if needCount <= 0 then return 2 end
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
638
639
640
641
642
|
local taskLevel = role.dinerData:getProperty("buildL"):getv(5, 1)
local taskData = csvdb["diner_questCsv"][taskLevel]
if not taskData then
return 3
end
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
643
|
|
550ba7e7
zhouhaihai
订单
|
644
|
local pool = {}
|
f4bbb208
zhouhaihai
餐厅任务解锁
|
645
646
|
local dishTree = role.dinerData:getProperty("dishTree")
|
550ba7e7
zhouhaihai
订单
|
647
|
for id, temp in pairs(taskData) do
|
f4bbb208
zhouhaihai
餐厅任务解锁
|
648
649
650
651
652
653
654
655
|
local unlock = true
for _, front in ipairs(temp.front:toArray(true, "=")) do
if dishTree:getv(front, 0) == 0 then
unlock = false
break
end
end
if not hadTask[id] and unlock then
|
550ba7e7
zhouhaihai
订单
|
656
657
658
659
660
661
662
663
664
665
666
667
668
|
table.insert(pool, temp)
end
end
local needCount = math.min(#pool, needCount) -- 需要的任务个数
if needCount <= 0 then return end
local cost = globalCsv.diner_task_refresh_cost:toNumMap()
for itemId, count in pairs(cost) do
cost[itemId] = count * needCount
end
if not role:checkItemEnough(cost) then return end
|
3133cb76
zhouhaihai
日志
|
669
|
role:costItems(cost, {log = {desc = "dinerReTask"}})
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
670
|
|
7898054a
zhouhaihai
新随机订单
|
671
672
673
|
for idx, order in ipairs(orders) do
if (order.lock == 0 and order.status == 0) then
|
550ba7e7
zhouhaihai
订单
|
674
675
676
677
678
679
680
|
if needCount > 0 then
local index = math.randWeight(pool, "chance")
local data = pool[index]
orders[idx] = {lv = taskLevel, id = data.id, n = 0, lock = 0, status = 0}
needCount = needCount - 1
table.remove(pool, index)
end
|
ca232abd
gaofengduan
fix diner task re...
|
681
682
|
end
end
|
550ba7e7
zhouhaihai
订单
|
683
|
|
1e9cb217
chenyueqi
服务器记录控制引导过程
|
684
|
role:finishGuide(41)
|
f22a33af
zhouhaihai
自己的日志
|
685
686
|
role:mylog("diner_action", {desc = "reTask"})
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
687
|
role.dinerData:updateProperty({field = "order", value = json.encode(orders)})
|
289a4927
gaofengduan
fix diner talent
|
688
689
|
SendPacket(actionCodes.Diner_refreshTaskRpc, '')
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
690
691
692
|
return true
end
|
6d272f65
zhouhaihai
餐厅 食材
|
693
|
function _M.addWantFoodRpc(agent , data)
|
4288160b
gaofengduan
add Diner_getGree...
|
694
695
696
|
local role = agent.role
local msg = MsgPack.unpack(data)
|
6d272f65
zhouhaihai
餐厅 食材
|
697
698
|
local ids = msg.ids -- list
|
4288160b
gaofengduan
add Diner_getGree...
|
699
700
701
|
local buildType = 6
local level = role.dinerData:getProperty("buildL"):getv(buildType, 1)
local buildingData = csvdb["diner_buildingCsv"][buildType][level]
|
6d272f65
zhouhaihai
餐厅 食材
|
702
|
|
4288160b
gaofengduan
add Diner_getGree...
|
703
704
705
|
if not buildingData then
return 1
end
|
6d272f65
zhouhaihai
餐厅 食材
|
706
707
708
709
|
if #ids > buildingData.business then return 2 end
local had = {}
|
0df83fa9
liuzujun
料理解锁bug
|
710
711
712
713
714
715
716
717
718
719
720
721
722
723
|
-- 遍历adv_potion
for potionId, potionData in pairs(csvdb["adv_potionCsv"]) do
local potionLv = role:getPotionLevel(potionId)
if potionLv > 0 then
local cfg = potionData[potionLv]
if cfg then
local cost = cfg.material:toNumMap()
for id, _ in pairs(cost) do
local itemData = csvdb["itemCsv"][id]
local mData = csvdb["diner_materialCsv"][id]
if itemData.type == ItemType.Cuisine and not had[id] then
had[id] = true
end
end
|
e6845afa
liuzujun
餐厅食材供应商供应食材条件调整
|
724
|
end
|
0df83fa9
liuzujun
料理解锁bug
|
725
726
727
728
729
730
731
732
733
734
735
736
737
|
end
end
-- 遍历dish
for id, lv in pairs(role.dinerData:getProperty("dishTree"):toNumMap()) do
if csvdb["diner_dishCsv"][id] and csvdb["diner_dishCsv"][id][lv] then
local data = csvdb["diner_dishCsv"][id][lv]
local costs = data.material:toNumMap()
for id, _ in pairs(costs) do
local itemData = csvdb["itemCsv"][id]
local mData = csvdb["diner_materialCsv"][id]
if itemData.type == ItemType.Cuisine and not had[id] then
had[id] = true
end
|
6d272f65
zhouhaihai
餐厅 食材
|
738
739
740
|
end
end
end
|
0df83fa9
liuzujun
料理解锁bug
|
741
742
743
744
|
for _, itemId in ipairs(ids) do
if not had[itemId] then return 3 end
end
|
6d272f65
zhouhaihai
餐厅 食材
|
745
746
747
|
local gfood = {}
for slot, itemId in ipairs(ids) do
gfood[slot] = {id = itemId, st = skynet.timex()}
|
4288160b
gaofengduan
add Diner_getGree...
|
748
749
|
end
|
1e9cb217
chenyueqi
服务器记录控制引导过程
|
750
|
role:finishGuide(36)
|
f22a33af
zhouhaihai
自己的日志
|
751
752
|
role:mylog("diner_action", {desc = "wantFood"})
|
6d272f65
zhouhaihai
餐厅 食材
|
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
|
role.dinerData:updateProperty({field = "gfood", value = gfood})
SendPacket(actionCodes.Diner_addWantFoodRpc, '')
return true
end
function _M.getGreenhouseRpc( agent, data )
local role = agent.role
-- local msg = MsgPack.unpack(data)
local buildType = 6
local level = role.dinerData:getProperty("buildL"):getv(buildType, 1)
local buildingData = csvdb["diner_buildingCsv"][buildType][level]
if not buildingData then
return 1
|
4288160b
gaofengduan
add Diner_getGree...
|
768
|
end
|
6d272f65
zhouhaihai
餐厅 食材
|
769
770
771
772
773
|
local reward = {}
local now = skynet.timex()
local gfood = role.dinerData:getProperty("gfood")
if not next(gfood) then return end
|
40b19300
chenyueqi
电波塔激活加成效果后对各个系统的加成
|
774
|
|
40b19300
chenyueqi
电波塔激活加成效果后对各个系统的加成
|
775
776
|
local timeAdd = role:getBnousDiner(2,globalCsv.diner_get_food_time_max)
|
6d272f65
zhouhaihai
餐厅 食材
|
777
778
779
|
for k , v in pairs(gfood) do
local itemId = v.id
local st = v.st
|
664e0e07
chenyueqi
电波塔对食材的加成计算错误
|
780
781
|
local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100
speed = speed + role:getBnousDiner(1,speed)
|
40b19300
chenyueqi
电波塔激活加成效果后对各个系统的加成
|
782
|
local endTime = st + globalCsv.diner_get_food_time_max + timeAdd
|
6d272f65
zhouhaihai
餐厅 食材
|
783
784
785
786
787
788
789
|
local endTime2 = math.min(now, endTime)
reward[itemId] = math.floor((endTime2 - st) / speed)
if endTime2 == endTime then
gfood[k].st = now
else
gfood[k].st = st + speed * reward[itemId]
end
|
c59e058b
zhouhaihai
新一批日志记录
|
790
791
792
793
794
795
796
797
|
role:log("restaurant_material", {
item_id = itemId, -- 获取物品ID
restaurant_material_start = st, -- 申请获取时间
restaurant_material_time = endTime2 - st, -- 申请到领取耗时
restaurant_material_num = reward[itemId], -- 获取物品数量
})
|
4288160b
gaofengduan
add Diner_getGree...
|
798
|
end
|
6d272f65
zhouhaihai
餐厅 食材
|
799
|
role.dinerData:updateProperty({field = "gfood", value = gfood})
|
7bb30dca
zhouhaihai
修改发奖
|
800
|
local reward, change = role:award(reward, {log = {desc = "greenHourse", int1 = level}})
|
53e8037e
zhouhaihai
任务
|
801
|
role:checkTaskEnter("FoodMGet")
|
3133cb76
zhouhaihai
日志
|
802
|
|
f22a33af
zhouhaihai
自己的日志
|
803
|
role:mylog("diner_action", {desc = "greenHourse"})
|
3133cb76
zhouhaihai
日志
|
804
|
|
7bb30dca
zhouhaihai
修改发奖
|
805
|
SendPacket(actionCodes.Diner_getGreenhouseRpc, MsgPack.pack({reward = reward, change = change}))
|
4288160b
gaofengduan
add Diner_getGree...
|
806
807
|
return true
end
|
4864d579
zhengshouren
领取任务,锁定任务,获得特殊任务
|
808
|
|
03a6166a
zhouhaihai
餐厅优化
|
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
|
local function refreshTaskRpc(role, task)
local hadType = {}
if task.id and csvdb["task_specialCsv"][task.id] then
hadType[csvdb["task_specialCsv"][task.id].type] = 1
end
local spTask = role:getProperty("spTask")
local taskCount = 0
for id ,_ in pairs(spTask) do
hadType[csvdb["task_specialCsv"][id].type] = 1
taskCount = taskCount + 1
end
local pool = {}
if taskCount < globalCsv.diner_get_task_count_max then
local curLevel = role:getProperty("level")
for id, data in pairs(csvdb["task_specialCsv"]) do
if not hadType[data.type] then
local level = data.level:toArray(true, "=")
if curLevel >= level[1] and curLevel <= level[2] then
table.insert(pool, id)
end
end
end
end
if not next(pool) then --每次进都看看有没有任务可以领
task.id = nil
task.et = 0
else
local id = pool[math.randomInt(1, #pool)]
task.id = id
task.et = skynet.timex() + globalCsv.diner_get_task_time_max
end
return task
end
-- 进入餐厅界面调用
function _M.initTaskRpc(agent, data)
local role = agent.role
local task = role.dinerData:getProperty("task")
local now = skynet.timex()
if not task.et or task.et <= now then --刷新了
task = refreshTaskRpc(role, task)
role.dinerData:updateProperty({field = "task", value = task})
end
SendPacket(actionCodes.Diner_initTaskRpc, '')
return true
end
-- 对任务进行处理调用
function _M.handleTaskRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local cmd = msg.cmd -- 1 领取任务 2 拒绝任务
local task = role.dinerData:getProperty("task")
local now = skynet.timex()
if cmd == 1 then
if not task.id then return end
if task.et > now then
--领取任务
task.id = nil
task.et = now + globalCsv.diner_get_task_time_max
task.refuse = nil
else
return
end
elseif cmd == 2 then -- 拒绝任务(重新领取)
if not task.id then return end
if (task.refuse or 0) >= globalCsv.diner_get_task_refuse_max then
-- 等待时间
task.refuse = nil
task.id = nil
task.et = now + globalCsv.diner_get_task_time_max
else
task.refuse = (task.refuse or 0) + 1
--刷新任务
task = refreshTaskRpc(role, task)
end
else
return
end
role.dinerData:updateProperty({field = "task", value = task})
SendPacket(actionCodes.Diner_handleTaskRpc, '')
return true
end
|
59835765
zhouhaihai
排行榜
|
899
900
901
902
903
904
905
906
|
function _M.rankRpc(agent , data)
local role = agent.role
local rankInfo = role.dinerData:getPopularRank()
SendPacket(actionCodes.Diner_rankRpc, MsgPack.pack(rankInfo))
return true
end
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
907
908
909
910
911
912
913
|
function _M.entrustRpc(agent , data)
local role = agent.role
local msg = MsgPack.unpack(data)
local ctype = msg.ctype
local entrust = role.dinerData:getProperty("entrust")
|
3133cb76
zhouhaihai
日志
|
914
915
|
local entrustId = entrust[1]
if not entrustId then return end
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
916
|
|
7bb30dca
zhouhaihai
修改发奖
|
917
|
local reward, change
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
918
|
if ctype == 1 then -- 完成
|
3133cb76
zhouhaihai
日志
|
919
|
local curData = csvdb["diner_missionCsv"][entrustId]
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
920
921
922
923
924
|
if not curData then return end
if curData.type == 1 then
local cost = curData.condition:toNumMap()
if not role:checkItemEnough(cost) then return end
|
3133cb76
zhouhaihai
日志
|
925
|
role:costItems(cost, {log = {desc = "dinerEntrus", int1 = entrustId}})
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
926
927
928
929
930
931
|
elseif curData.type == 2 then
-- todo 数据校验
else
return
end
|
7bb30dca
zhouhaihai
修改发奖
|
932
|
reward, change = role:award(curData.reward, {log = {desc = "dinerEntrus", int1 = entrustId}})
|
4c5d72ab
zhouhaihai
高级pvp
|
933
|
table.remove(entrust, 1)
|
9be3f3ea
zhouhaihai
日志需求
|
934
935
936
937
938
939
940
941
|
role:log("restaurant_order", {
restaurant_order_id = entrustId, -- 订单任务ID
restaurant_order_status = 2, -- 订单任务状态,接受:0, 拒绝:1, 完成:2
restaurant_order_rwd = reward or {}, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
restaurant_order_lv = curData.type, -- 订单品质等级,普通:0, 稀有:1, 顶级:2, 豪华:3
restaurant_order_type = 0, -- 订单任务类型,0:特殊顾客,1:特别订单
})
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
942
943
944
945
946
947
948
|
elseif ctype == 2 then -- 放弃
table.remove(entrust, 1)
else
return
end
role.dinerData:updateProperty({field = "entrust", value = entrust})
|
a7b824ac
chenyueqi
记录新手引导步骤的代码存在bug
|
949
|
role:finishGuide(26)
|
f22a33af
zhouhaihai
自己的日志
|
950
|
role:mylog("diner_action", {desc = "entrus", short1 = ctype, int1 = entrustId})
|
accf94c4
liuzujun
活动以类型标识,修改双倍活动bug
|
951
|
role:checkTaskEnter("VillageApply", {})
|
a7b824ac
chenyueqi
记录新手引导步骤的代码存在bug
|
952
|
|
7bb30dca
zhouhaihai
修改发奖
|
953
|
SendPacket(actionCodes.Diner_entrustRpc, MsgPack.pack({reward = reward, change = change}))
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
954
955
956
957
958
959
960
961
|
return true
end
function _M.collectRpc(agent , data)
local role = agent.role
local msg = MsgPack.unpack(data)
local id = msg.id
|
a4e66eda
zhouhaihai
餐厅协议
|
962
963
|
local customerData = csvdb["diner_customerCsv"][id]
if not id or not customerData then return end
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
964
965
966
967
968
969
970
971
972
973
|
local customer = role.dinerData:getProperty("customer")
if customer[id] ~= 0 then
return
end
-- 完成前更新一波 后面 加成可能不一样
local sells = json.decode(role.dinerData:getProperty("sells"))
for slot, _ in pairs(sells) do
role.dinerData:updateSell(slot)
end
|
7bb30dca
zhouhaihai
修改发奖
|
974
|
local reward, change = role:award(customerData.reward, {log = {desc = "dinerCollect", int1 = id}})
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
975
976
|
customer[id] = 1
role.dinerData:updateProperty({field = "customer", value = customer}) -- 解锁了
|
c59e058b
zhouhaihai
新一批日志记录
|
977
978
979
980
981
982
983
984
|
local count = 0
for c_, v in pairs(customer) do
count = count + 1
end
role:log("restaurant_collect", {
restaurant_collect_id = id, -- 图谱收集ID
|
887c1843
zhouhaihai
日志新一批
|
985
|
restaurant_collect_rwd = reward, -- 订单完成奖励,json格式记录,{"itemid1":123,"itemid2":12,……….}
|
c59e058b
zhouhaihai
新一批日志记录
|
986
987
|
restaurant_collect_plan = count, -- 收集进度,即解锁顾客,数字表示
})
|
f22a33af
zhouhaihai
自己的日志
|
988
|
role:mylog("diner_action", {desc = "collect", int1 = id})
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
989
|
|
7bb30dca
zhouhaihai
修改发奖
|
990
|
SendPacket(actionCodes.Diner_collectRpc, MsgPack.pack({reward = reward, change = change}))
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
|
return true
end
function _M.comboRewardRpc(agent , data)
local role = agent.role
local msg = MsgPack.unpack(data)
local id = msg.id
local comboData = csvdb["diner_customer_comboCsv"][id]
if not id or not comboData then return end
local comboStatus = role.dinerData:getProperty("comboStatus")
if comboStatus[id] == -1 then return end
local customer = role.dinerData:getProperty("customer")
for _, nId in ipairs(comboData.customer:toArray(true, "=")) do
if customer[nId] ~= 1 then
return
end
end
comboStatus[id] = 1
|
7bb30dca
zhouhaihai
修改发奖
|
1014
|
local reward, change = role:award(comboData.reward, {log = {desc = "dinerCombo", int1 = id}})
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
1015
1016
1017
|
role.dinerData:updateProperty({field = "comboStatus", value = comboStatus}) -- 解锁了
|
f22a33af
zhouhaihai
自己的日志
|
1018
1019
|
role:mylog("diner_action", {desc = "combo", int1 = id})
|
7bb30dca
zhouhaihai
修改发奖
|
1020
|
SendPacket(actionCodes.Diner_comboRewardRpc, MsgPack.pack({reward = reward, change = change}))
|
ed322ed2
zhouhaihai
餐厅 顾客 系统
|
1021
1022
1023
1024
|
return true
end
|
59835765
zhouhaihai
排行榜
|
1025
|
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
1026
|
return _M
|