cccc9c70
 
  zhouhaihai
 
商城
 | 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 
 | 
  local _M = {}
  
  function _M.rechargeRpc(agent , data)
  	local role = agent.role
  	local msg = MsgPack.unpack(data)
  	local id = msg.id
  	local dataSet = csvdb["shop_rechargeCsv"][id]
  	if not dataSet then return end
  	local diamondCount
  	if dataSet.type == 0 then -- 钻石
  		local rechargeF = role:getProperty("rechargeF")
  		diamondCount = dataSet.diamond + dataSet.diamondExtra
  		if not rechargeF[id] then
  			diamondCount = diamondCount + dataSet.diamondFirst
  			rechargeF[id] = 1
  			role:updateProperty({field = "rechargeF", value = rechargeF})
  		end
 
 | 
3133cb76
 
  zhouhaihai
 
日志
 | 
18 
 | 
  		role:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}})
 
 | 
cccc9c70
 
  zhouhaihai
 
商城
 | 
19
20
21
22
23
24
25
26
27
28
29
30 
 | 
  	elseif dataSet.type == 1 then  --月卡
  		return
  	elseif dataSet.type == 2 then  -- 赛季通行证
  		return
  	else
  		return
  	end
  
  	-- 累充
  	local rmb = dataSet.rmb
  	role:updateProperty({field = "rmbC", delta = rmb})
  	
 
 | 
cbc6973f
 
  zhouhaihai
 
天赋bug 日志调整
 | 
31 
 | 
  	role:log("role_action", {desc = "recharge", int1 = id, int2 = rmb})
 
 | 
3133cb76
 
  zhouhaihai
 
日志
 | 
32 
 | 
  
 
 | 
cccc9c70
 
  zhouhaihai
 
商城
 | 
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 
 | 
  	SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({diamond = diamondCount}))
  	return true
  end
  
  
  function _M.dailyBuyRpc(agent , data)
  	local role = agent.role
  	local msg = MsgPack.unpack(data)
  	local id = msg.id
  	local count = msg.count or 1
  
  	local dataSet = csvdb["shop_diamondCsv"][id]
  	if not dataSet then return 1 end
  
  	local dailySDC = role.dailyData:getProperty("dailySDC")
  
  	if math.illegalNum(count, 1, (dataSet.limit == 0 and math.huge or dataSet.limit - (dailySDC[id] or 0))) then return 1 end
  
  	local cost = dataSet.cost
 
 | 
2ab0d91b
 
  zhouhaihai
 
每日商店删掉 type [王宇杰]
 | 
52
53
54
55 
 | 
  
  	local dailySDD = role.dailyData:getProperty("dailySDD")
  	if dailySDD[id] then -- 折扣
  		cost = math.ceil(cost * (1 - dataSet.disount / 100))
 
 | 
cccc9c70
 
  zhouhaihai
 
商城
 | 
56
57 
 | 
  	end
  
 
 | 
b216676d
 
  zhouhaihai
 
log
 | 
58 
 | 
  	if not role:costDiamond({count = cost * count, log = {desc = "dailyShop", int1 = id, int2 = count}}) then
 
 | 
cccc9c70
 
  zhouhaihai
 
商城
 | 
59
60
61
62
63
64
65 
 | 
  		return 4 
  	end
  
  	if dataSet.limit ~= 0 then
  		dailySDC[id] = (dailySDC[id] or 0) + count
  		role.dailyData:updateProperty({field = "dailySDC", value = dailySDC})
  	end
 
 | 
aa5cbb54
 
  zhouhaihai
 
商店bug
 | 
66
67
68
69
70 
 | 
  	local gift = {}
  	for itemId, count_ in pairs(dataSet.gift:toNumMap()) do
  		gift[itemId] = count_ * count
  	end
  	local reward = role:award(gift, {log = {desc = "dailyShop", int1 = id, int2 = count}})
 
 | 
3133cb76
 
  zhouhaihai
 
日志
 | 
71
72 
 | 
  
  	role:log("role_action", {desc = "dailyShop", int1 = id, int2 = count})
 
 | 
cccc9c70
 
  zhouhaihai
 
商城
 | 
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98 
 | 
  
  	SendPacket(actionCodes.Store_dailyBuyRpc, MsgPack.pack({reward = reward}))
  	return true
  end
  
  
  function _M.dinerBuyRpc(agent , data)
  	local role = agent.role
  	local msg = MsgPack.unpack(data)
  	local id = msg.id
  	local count = msg.count or 1
  
  	local dataSet = csvdb["shop_dinerCsv"][id]
  	if not dataSet then return end
  
  	local dinerS = role:getProperty("dinerS")
  	if math.illegalNum(count, 1, (dataSet.limit == 0 and math.huge or dataSet.limit - (dinerS[id] or 0))) then return 1 end
  
  	local cost = {[ItemId.DinerCoin] = dataSet.cost}
  	if not role:checkItemEnough(cost) then return end
  
  	if dataSet.limit ~= 0 then
  		dinerS[id] = (dinerS[id] or 0) + count
  		role:updateProperty({field = "dinerS", value = dinerS})
  	end
  
 
 | 
3133cb76
 
  zhouhaihai
 
日志
 | 
99 
 | 
  	role:costItems(cost, {log = {desc = "dinerShop", int1 = id, int2 = count}})
 
 | 
cccc9c70
 
  zhouhaihai
 
商城
 | 
100
101
102
103
104 
 | 
  
  	local gift = {}
  	for _id, _count in pairs(dataSet.gift:toNumMap()) do
  		gift[_id] = _count * count
  	end
 
 | 
3133cb76
 
  zhouhaihai
 
日志
 | 
105
106
107 
 | 
  	local reward = role:award(gift, {log = {desc = "dinerShop", int1 = id, int2 = count}})
  	
  	role:log("role_action", {desc = "dinerShop", int1 = id, int2 = count})
 
 | 
cccc9c70
 
  zhouhaihai
 
商城
 | 
108
109
110
111
112
113 
 | 
  
  	SendPacket(actionCodes.Store_dinerBuyRpc, MsgPack.pack({reward = reward}))
  	return true
  end
  
  return _M
 
 |