0a07bdd9
zhouahaihai
角色升级 。gm
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
local ipairs = ipairs
local table = table
local math = math
local next = next
local string = string
local redisproxy = redisproxy
local MsgPack = MsgPack
local getRandomName = getRandomName
local mcast_util = mcast_util
local string_format = string.format
local tonumber = tonumber
local require = require
local table_insert = table.insert
local tconcat = table.concat
local _M = {}
function _M.levelUpRpc( agent, data )
local role = agent.role
local msg = MsgPack.unpack(data)
local hero = role.heros[msg.id]
if not hero then return end
if hero:getProperty("level") >= hero:getMaxLevel() then return end
|
8c74292c
zhouahaihai
增加item 以及 角色突破
|
24
|
local curData = csvdb["unit_expCsv"][hero:getProperty("level")]
|
997cbdfe
zhouahaihai
技能养成
|
25
|
local cost = {[ItemId.Exp] = curData.exp, [ItemId.Gold] = curData.gold}
|
8c74292c
zhouahaihai
增加item 以及 角色突破
|
26
27
|
if not role:checkItemEnough(cost) then return end
role:costItems(cost, {})
|
0a07bdd9
zhouahaihai
角色升级 。gm
|
28
29
30
31
32
33
|
hero:updateProperty({field = "level", delta = 1})
SendPacket(actionCodes.Hero_levelUpRpc, '')
return true
end
|
8c74292c
zhouahaihai
增加item 以及 角色突破
|
34
35
36
37
38
39
40
41
42
|
function _M.breakRpc( agent, data )
local role = agent.role
local msg = MsgPack.unpack(data)
local hero = role.heros[msg.id]
if not hero then return end
if hero:getProperty("level") < hero:getMaxLevel() then return end
if hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] then return end
local curData = csvdb["unit_breakCsv"][hero:getProperty("breakL")]
|
997cbdfe
zhouahaihai
技能养成
|
43
|
local cost = {[ItemId.BreakCost] = curData.cost, [ItemId.Gold] = curData.gold}
|
8c74292c
zhouahaihai
增加item 以及 角色突破
|
44
45
46
47
48
49
50
|
if not role:checkItemEnough(cost) then return end
role:costItems(cost, {})
hero:updateProperty({field = "breakL", delta = 1})
SendPacket(actionCodes.Hero_breakRpc, '')
return true
end
|
0a07bdd9
zhouahaihai
角色升级 。gm
|
51
|
|
997cbdfe
zhouahaihai
技能养成
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
function _M.wakeRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local hero = role.heros[msg.id]
if not hero then return end
if hero:getProperty("wakeL") >= #csvdb["unit_wakeCsv"] then return end
local cost = {[hero:getProperty("type")] = csvdb["unit_wakeCsv"][hero:getProperty("wakeL")].cost}
local isEnough, less = role:checkItemEnough(cost)
if not isEnough then
cost[ItemId.HeroFC[csvdb["unitCsv"][hero:getProperty("type")].rare]] = less[hero:getProperty("type")]
if not role:checkItemEnough(cost) then return end
end
role:costItems(cost, {})
hero:updateProperty({field = "wakeL", delta = 1})
SendPacket(actionCodes.Hero_wakeRpc, '')
return true
end
function _M.skillUpRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local index = msg.skillIdx -- 第几个技能 -- 1 2 3
local hero = role.heros[msg.id]
if not hero then return end
local curLevel = hero:getSkillLevel(index)
|
a22cbe63
zhouahaihai
bug
|
78
|
if hero:getLSPoint() <= 0 or curLevel >= #hero:getSkillData(index) then return end
|
997cbdfe
zhouahaihai
技能养成
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
hero:updateProperty({field = "skillL", value = hero:getProperty("skillL"):setv(index, curLevel + 1)})
SendPacket(actionCodes.Hero_skillUpRpc, '')
return true
end
function _M.talentRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local hero = role.heros[msg.id]
if not hero then return end
local index = msg.index -- 第几个天赋
local need = {[1] = 1, [2] = 1, [3] = 1, [4] = 1}
if not need[index] then return end
local talent = hero:getProperty("talent")
local curStage = talent:getv(0, 1)
if curStage > csvdb["unit_breakCsv"][hero:getProperty("breakL")].talent then return end
local curData = csvdb["unit_talentCsv"][curStage]
if not curData then return end
local level = talent:getv(index, 0)
if level >= #curData then return end
local talentData = curData[level]
if not talentData then return end
local cost = talentData.cost:toNumMap()
if not role:checkItemEnough(cost) then return end
role:costItems(cost, {})
talent = talent:incrv(index, 1)
--是否进阶
local max = true
for i = 1, 4 do
if talent:getv(i, 0) < #curData then
max = false
break
end
end
if max then
|
b9bd5cb6
zhouahaihai
天赋阶段 bug
|
121
|
talent = talent:setv(0, curStage + 1)
|
997cbdfe
zhouahaihai
技能养成
|
122
123
124
125
126
127
128
129
130
|
for i = 1, 4 do
talent = talent:setv(i, 0)
end
end
hero:updateProperty({field = "talent", value = talent})
SendPacket(actionCodes.Hero_talentRpc, '')
return true
end
|
0a07bdd9
zhouahaihai
角色升级 。gm
|
131
|
return _M
|