Commit d99a4962c0a45518e9c0c3c9a9253373d8be58cf

Authored by 测试
2 parents ec0df561 3fbbd115

火花系统建表,新增虹光玉

@@ -25,6 +25,7 @@ MAX_SVR_ID = 10000 @@ -25,6 +25,7 @@ MAX_SVR_ID = 10000
25 MAX_ROLE_NUM = 1000000 25 MAX_ROLE_NUM = 1000000
26 MAX_HERO_NUM = 1000000 -- 英雄的id = roleId * MAX_HERO_NUM + index 26 MAX_HERO_NUM = 1000000 -- 英雄的id = roleId * MAX_HERO_NUM + index
27 MAX_RUNE_NUM = 1000000 -- 铭文的id = roleId * MAX_RUNE_NUM + index 27 MAX_RUNE_NUM = 1000000 -- 铭文的id = roleId * MAX_RUNE_NUM + index
  28 +MAX_SPARK_NUM = 1000000 -- 火花的id = roleId * MAX_SPARK_NUM + index
28 -- 属性枚举 29 -- 属性枚举
29 AttsEnum = { 30 AttsEnum = {
30 hp = 1, -- 血量 31 hp = 1, -- 血量
@@ -87,6 +88,7 @@ ItemType = { @@ -87,6 +88,7 @@ ItemType = {
87 SelectItemBox = 17, -- 自选箱子 88 SelectItemBox = 17, -- 自选箱子
88 CommonPaster = 18, -- 万能贴纸 89 CommonPaster = 18, -- 万能贴纸
89 BossTicket = 20, -- boss挑战门票 90 BossTicket = 20, -- boss挑战门票
  91 + Spark = 21, -- 火花
90 } 92 }
91 93
92 --在这个里面的会记录的是功能开放 对应类型open 而不是 ID 94 --在这个里面的会记录的是功能开放 对应类型open 而不是 ID
@@ -367,6 +369,7 @@ TriggerEventType = { @@ -367,6 +369,7 @@ TriggerEventType = {
367 SSRCount = 6, 369 SSRCount = 6,
368 AfterTs = 7, -- 某时间以后 370 AfterTs = 7, -- 某时间以后
369 DrawHeroCnt = 8, -- 每日抽卡次数 371 DrawHeroCnt = 8, -- 每日抽卡次数
  372 + Appoint = 0, -- 触发指定id礼包
370 } 373 }
371 374
372 DrawCardType = { 375 DrawCardType = {
src/ProtocolCode.lua
@@ -51,6 +51,8 @@ actionCodes = { @@ -51,6 +51,8 @@ actionCodes = {
51 Role_broadGetSSR = 135, -- 全服广播 获得ssr英雄 51 Role_broadGetSSR = 135, -- 全服广播 获得ssr英雄
52 Role_renameTeamRpc = 136, -- 编队改名 52 Role_renameTeamRpc = 136, -- 编队改名
53 Role_accuseRpc = 137, -- 举报 53 Role_accuseRpc = 137, -- 举报
  54 + Role_loadSparks = 138,
  55 + Role_updateSpark = 139, -- 更新火花
54 56
55 Adv_startAdvRpc = 151, 57 Adv_startAdvRpc = 151,
56 Adv_startHangRpc = 152, 58 Adv_startHangRpc = 152,
@@ -102,6 +104,7 @@ actionCodes = { @@ -102,6 +104,7 @@ actionCodes = {
102 Hero_drawHeroExtraRewardNtf = 224, 104 Hero_drawHeroExtraRewardNtf = 224,
103 Hero_itemComposeRpc = 225, 105 Hero_itemComposeRpc = 225,
104 Hero_setWishPoolRpc = 226, 106 Hero_setWishPoolRpc = 226,
  107 + Hero_changeSparkRpc = 227,
105 108
106 Hang_startRpc = 251, 109 Hang_startRpc = 251,
107 Hang_checkRpc = 252, 110 Hang_checkRpc = 252,
@@ -152,6 +155,8 @@ actionCodes = { @@ -152,6 +155,8 @@ actionCodes = {
152 Car_runeUpRpc = 402, 155 Car_runeUpRpc = 402,
153 Car_saleEquipRpc = 403, 156 Car_saleEquipRpc = 403,
154 Car_saleRuneRpc = 404, 157 Car_saleRuneRpc = 404,
  158 + Car_sparkLvlUpRpc = 405,
  159 + Car_sparkQualityUpRpc = 406,
155 160
156 161
157 Friend_searchRpc = 450, 162 Friend_searchRpc = 450,
@@ -241,6 +246,7 @@ actionCodes = { @@ -241,6 +246,7 @@ actionCodes = {
241 Activity_newSignRpc = 670, 246 Activity_newSignRpc = 670,
242 Activity_advLevelRpc = 671, 247 Activity_advLevelRpc = 671,
243 Activity_buyBattleCommandLvlRpc = 672, 248 Activity_buyBattleCommandLvlRpc = 672,
  249 + Activity_returnerTaskRpc = 673,
244 250
245 Radio_startQuestRpc = 700, 251 Radio_startQuestRpc = 700,
246 Radio_finishQuestRpc = 701, 252 Radio_finishQuestRpc = 701,
@@ -14,6 +14,8 @@ R_EMAIL_ITEM = "email:%d:%d" --邮件 @@ -14,6 +14,8 @@ R_EMAIL_ITEM = "email:%d:%d" --邮件
14 R_STORE = "role:%d:store" -- 商店 14 R_STORE = "role:%d:store" -- 商店
15 R_ORDERS = "role:%d:orders" -- 订单 15 R_ORDERS = "role:%d:orders" -- 订单
16 R_ORDER = "order:%d:%d" 16 R_ORDER = "order:%d:%d"
  17 +R_SPARKIDS = "role:%d:sparkIds" -- 玩家拥有火花自增id
  18 +R_SPARK = "role:%d:spark:%d" -- 火花详细信息
17 19
18 -- 通用排行榜 20 -- 通用排行榜
19 RANK_COMMON = "rank:common:" 21 RANK_COMMON = "rank:common:"
src/actions/ActivityAction.lua
@@ -140,6 +140,13 @@ function _M.signRpc(agent, data) @@ -140,6 +140,13 @@ function _M.signRpc(agent, data)
140 role:changeUpdates({{type = "sign", field = curDay, value = yearMonth}}) 140 role:changeUpdates({{type = "sign", field = curDay, value = yearMonth}})
141 role:checkTaskEnter("SignIn") 141 role:checkTaskEnter("SignIn")
142 142
  143 + if monthData[curDay].daily_sign_email ~= "" then
  144 + local emails = monthData[curDay].daily_sign_email:toArray(true,"=")
  145 + for _, emailId in pairs(emails) do
  146 + redisproxy:insertEmail({roleId = role:getProperty("id"), emailId = emailId})
  147 + end
  148 + end
  149 +
143 SendPacket(actionCodes.Activity_signRpc, MsgPack.pack(role:packReward(reward, change))) 150 SendPacket(actionCodes.Activity_signRpc, MsgPack.pack(role:packReward(reward, change)))
144 return true 151 return true
145 end 152 end
@@ -1358,4 +1365,52 @@ function _M.advLevelRpc(agent, data) @@ -1358,4 +1365,52 @@ function _M.advLevelRpc(agent, data)
1358 return true 1365 return true
1359 end 1366 end
1360 1367
  1368 +function _M.returnerTaskRpc(agent, data)
  1369 + local role = agent.role
  1370 + local msg = MsgPack.unpack(data)
  1371 +
  1372 + local taskId = msg.id or 0
  1373 + if taskId == 0 then return 0 end
  1374 +
  1375 + local returner = role:getProperty("returner") or {}
  1376 + if not returner[taskId] then return 1 end
  1377 +
  1378 + local tday = specTime({hour = 4})
  1379 + local curAllDay = (tday - returner.time) / 86400 + 1
  1380 +
  1381 + local TaskCsv = csvdb["activity_taskCsv"][76] or {}
  1382 + local taskData = TaskCsv[taskId]
  1383 + if not taskData then return 2 end
  1384 + if curAllDay < taskData.day then return 2 end
  1385 +
  1386 + local status = returner.status or {}
  1387 + if status[taskId] then return 3 end
  1388 +
  1389 + status[taskId] = 1
  1390 + returner.status = status
  1391 +
  1392 + local done = true
  1393 + for _, data in pairs(TaskCsv) do
  1394 + if not status[data.id] then
  1395 + done = false
  1396 + break
  1397 + end
  1398 + end
  1399 +
  1400 + if done then
  1401 + returner = {}
  1402 + end
  1403 +
  1404 + local reward, change = role:award(taskData.reward, {log = {desc = "returner", int1 = taskData.day, int2 = taskId}})
  1405 +
  1406 + local pack = globalCsv.returner_pack:toArray(true,"=")
  1407 + if pack[1] == taskData.id then
  1408 + role:checkTaskEnter("Appoint", {id = pack[2]})
  1409 + end
  1410 +
  1411 + role:updateProperty({field = "returner", value = returner})
  1412 + SendPacket(actionCodes.Activity_returnerTaskRpc, MsgPack.pack(role:packReward(reward, change)))
  1413 + return true
  1414 +end
  1415 +
1361 return _M 1416 return _M
src/actions/CarAction.lua
@@ -211,4 +211,92 @@ function _M.saleRuneRpc(agent, data ) @@ -211,4 +211,92 @@ function _M.saleRuneRpc(agent, data )
211 return true 211 return true
212 end 212 end
213 213
  214 +function _M.sparkQualityUpRpc( agent, data )
  215 + local role = agent.role
  216 + local msg = MsgPack.unpack(data)
  217 + local uid = msg.uid
  218 + local ownSpark = role.sparkBag[uid]
  219 + if not ownSpark then return 1 end
  220 +
  221 +
  222 + local cfg_id = ownSpark:getProperty("cfg_id")
  223 + local level = ownSpark:getProperty("level")
  224 +
  225 + local sparkSet = csvdb["sparkCsv"][cfg_id]
  226 + if not sparkSet then return 4 end
  227 + local sparkData = sparkSet[level]
  228 + if not sparkData then return 5 end
  229 +
  230 + if sparkData.star_up == 0 then return 6 end
  231 + local cost = sparkData.star_item:toNumMap()
  232 + if not role:checkItemEnough(cost) then
  233 + return 7
  234 + end
  235 +
  236 + role:costItems(cost, {log = {desc = "sparkQualityUp", int1 = uid, int2 = level}})
  237 +
  238 + local newSet = csvdb["sparkCsv"][sparkData.star_up]
  239 + if not newSet then return 8 end
  240 + local newSparkData = newSet[0]
  241 + if not newSparkData then return 9 end
  242 + local attrs = newSparkData.attr:toNumMap()
  243 + ownSpark:addAttr(attrs)
  244 + ownSpark:updateProperty({field = "level",value = 0})
  245 + ownSpark:updateProperty({field = "cfg_id",value = sparkData.star_up})
  246 + --role:checkTaskEnter("SparkQualityUp")
  247 +
  248 +
  249 + ownSpark:mylog({desc = "sparkQualityUp", int1 = sparkData.id , int2 = sparkData.star_up})
  250 +
  251 + SendPacket(actionCodes.Car_sparkQualityUpRpc, '')
  252 + return true
  253 +end
  254 +
  255 +function _M.sparkLvlUpRpc( agent, data )
  256 + local role = agent.role
  257 + local msg = MsgPack.unpack(data)
  258 + local uid = msg.uid
  259 + local ownSpark = role.sparkBag[uid]
  260 + if not ownSpark then return 1 end
  261 +
  262 +
  263 + local cfg_id = ownSpark:getProperty("cfg_id")
  264 + local level = ownSpark:getProperty("level")
  265 +
  266 + local sparkSet = csvdb["sparkCsv"][cfg_id]
  267 + if not sparkSet then return 4 end
  268 + local sparkData = sparkSet[level]
  269 + if not sparkData then return 5 end
  270 +
  271 + if level >= #sparkSet then return 6 end
  272 + local cost = sparkData.lv_up_item:toNumMap()
  273 + if not role:checkItemEnough(cost) then
  274 + return 7
  275 + end
  276 + local weight = math.random(0, 100)
  277 + local addLvl = 1
  278 + if weight < sparkData.probability then
  279 + addLvl = 2
  280 + end
  281 +
  282 + role:costItems(cost, {log = {desc = "sparkLvlUp", int1 = uid, int2 = level}})
  283 + local attrs = {}
  284 + for i = 1, addLvl do
  285 + local cfg = sparkSet[level + i]
  286 + if not cfg then break end
  287 + for k, v in pairs(cfg.attr:toNumMap()) do
  288 + attrs[k] = (attrs[k] or 0) + v
  289 + end
  290 + end
  291 + ownSpark:addAttr(attrs)
  292 + ownSpark:updateProperty({field = "level",value = level+addLvl})
  293 + --role:checkTaskEnter("SparkLvlUp")
  294 +
  295 +
  296 + ownSpark:mylog({desc = "sparkLvlUp", int1 = level + addLvl})
  297 +
  298 + SendPacket(actionCodes.Car_sparkLvlUpRpc, MsgPack.pack({big = (addLvl == 2)}))
  299 + return true
  300 +end
  301 +
214 return _M 302 return _M
215 \ No newline at end of file 303 \ No newline at end of file
src/actions/GmAction.lua
@@ -166,6 +166,15 @@ function _M.rune(role, pms) @@ -166,6 +166,15 @@ function _M.rune(role, pms)
166 return result 166 return result
167 end 167 end
168 168
  169 +table.insert(helpDes, {"获得火花" , "spark", "零件id"})
  170 +function _M.spark(role, pms)
  171 + local id = tonum(pms.pm1)
  172 + local result = role:addSpark({id = id, log = {desc = "gm"}})
  173 + role:mylog("gm_action", {desc = "spark", int1 = id, key1 = pms.sender})
  174 +
  175 + return result == 0 and "成功" or "失败"
  176 +end
  177 +
169 table.insert(helpDes, {"通关挂机副本", "fb", "挂卡id"}) 178 table.insert(helpDes, {"通关挂机副本", "fb", "挂卡id"})
170 function _M.fb(role, pms) -- 直接通关 179 function _M.fb(role, pms) -- 直接通关
171 local carbonId = tonum(pms.pm1) 180 local carbonId = tonum(pms.pm1)
@@ -594,6 +603,13 @@ function _M.clearbag(role, pms) @@ -594,6 +603,13 @@ function _M.clearbag(role, pms)
594 end 603 end
595 role:delRunes(uids, {log = {desc = "gm"}}) 604 role:delRunes(uids, {log = {desc = "gm"}})
596 605
  606 + -- 火花
  607 + uids = {}
  608 + for uid, _ in pairs(role.sparkBag) do
  609 + table.insert(uids, uid)
  610 + end
  611 + role:delSparks(uids, {log = {desc = "gm"}})
  612 +
597 return "成功" 613 return "成功"
598 end 614 end
599 615
src/actions/HangAction.lua
@@ -328,6 +328,8 @@ function _M.roleFormatRpc(agent , data) @@ -328,6 +328,8 @@ function _M.roleFormatRpc(agent , data)
328 local tactics = msg.tactics -- 战术 328 local tactics = msg.tactics -- 战术
329 local tower = msg.tower 329 local tower = msg.tower
330 local team = {} 330 local team = {}
  331 + dump(role.heros)
  332 + dump(msg)
331 for slot, heroId in pairs(msg.heros) do 333 for slot, heroId in pairs(msg.heros) do
332 if not role.heros[heroId] then 334 if not role.heros[heroId] then
333 return 1 335 return 1
src/actions/HeroAction.lua
@@ -105,6 +105,25 @@ function _M.wakeRpc(agent, data) @@ -105,6 +105,25 @@ function _M.wakeRpc(agent, data)
105 if not role:checkItemEnough(cost) then 105 if not role:checkItemEnough(cost) then
106 return 4 106 return 4
107 end 107 end
  108 + local curLevel = hero:getProperty("wakeL")
  109 + local sparkInfo = hero:getProperty("spark")
  110 + -- 大于等于7的时候需要装备火花才能升
  111 + if curLevel >= 7 then
  112 + if #sparkInfo == 0 then
  113 + return 5
  114 + end
  115 + local ok = false
  116 + for _, info in ipairs(sparkInfo) do
  117 + local cfg = csvdb["sparkCsv"][info.cfg_id][info.level or 0]
  118 + if not cfg then return 6 end
  119 + if cfg.star == curLevel then
  120 + ok = true
  121 + break
  122 + end
  123 + end
  124 + if not ok then return 7 end
  125 + end
  126 +
108 127
109 role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}}) 128 role:costItems(cost, {log = {desc = "heroWake", int1 = msg.id, int2 = hero:getProperty("type")}})
110 129
@@ -112,7 +131,6 @@ function _M.wakeRpc(agent, data) @@ -112,7 +131,6 @@ function _M.wakeRpc(agent, data)
112 local oldBattleV = hero:getProperty("battleV") 131 local oldBattleV = hero:getProperty("battleV")
113 hero:updateProperty({field = "wakeL", delta = 1}) 132 hero:updateProperty({field = "wakeL", delta = 1})
114 133
115 - local curLevel = hero:getProperty("wakeL")  
116 role:checkTaskEnter("Wake", {heroType = typ, wakeL = curLevel}) 134 role:checkTaskEnter("Wake", {heroType = typ, wakeL = curLevel})
117 if curLevel == 3 then -- 解锁cg 135 if curLevel == 3 then -- 解锁cg
118 role:checkTaskEnter("WakeCG", {heroType = typ}) 136 role:checkTaskEnter("WakeCG", {heroType = typ})
@@ -1193,4 +1211,52 @@ function _M.setWishPoolRpc(agent, data) @@ -1193,4 +1211,52 @@ function _M.setWishPoolRpc(agent, data)
1193 return true 1211 return true
1194 end 1212 end
1195 1213
  1214 +function _M.changeSparkRpc(agent, data)
  1215 + local role = agent.role
  1216 + local msg = MsgPack.unpack(data)
  1217 +
  1218 + local idx = msg.index
  1219 + local sparkId = msg.spark_id
  1220 + local heroId = msg.hero_id
  1221 + local hero = role.heros[heroId]
  1222 + if not hero then return 1 end
  1223 +
  1224 + local spark = role.sparkBag[sparkId]
  1225 + if not spark then return 2 end
  1226 +
  1227 + local lvl = spark:getProperty("level")
  1228 + local cfgId = spark:getProperty("cfg_id")
  1229 +
  1230 + local dataSet = csvdb["sparkCsv"][cfgId]
  1231 + if not dataSet then return 3 end
  1232 + local cfg = dataSet[lvl]
  1233 + if not cfg then return 4 end
  1234 +
  1235 + if hero:getProperty("wakeL") < cfg.star then return 5 end
  1236 +
  1237 + local itemCfg = csvdb["itemCsv"][cfgId]
  1238 + if not itemCfg then return 6 end
  1239 + if itemCfg.quality ~= hero:getRare() then return 6 end
  1240 +
  1241 + local sparkList = hero:getProperty("spark") or {}
  1242 + local oldSparkInfo = sparkList[idx] or {}
  1243 + sparkList[idx] = spark:data()
  1244 + hero:updateProperty({field="spark", value=sparkList})
  1245 +
  1246 + role:delSparks({sparkId}, {log = {desc = "changeSpark"}})
  1247 + local oldId = oldSparkInfo["cfg_id"] or 0
  1248 + local oldLevel = oldSparkInfo["level"] or 0
  1249 + local oldSparkSet = csvdb["sparkCsv"][oldId]
  1250 + local reward = {}
  1251 + if oldSparkSet then
  1252 + local oldSparkCfg = oldSparkSet[oldLevel]
  1253 + if oldSparkSet then
  1254 + reward = oldSparkCfg.back:toNumMap()
  1255 + end
  1256 + end
  1257 +
  1258 + SendPacket(actionCodes.Hero_changeSparkRpc, MsgPack.pack({reward = reward}))
  1259 + return true
  1260 +end
  1261 +
1196 return _M 1262 return _M
src/actions/RoleAction.lua
@@ -18,6 +18,7 @@ require &quot;utils.MysqlUtil&quot; @@ -18,6 +18,7 @@ require &quot;utils.MysqlUtil&quot;
18 18
19 local WAVE_HERO_NUMS = 150 19 local WAVE_HERO_NUMS = 150
20 local WAVE_RUNE_NUMS = 150 20 local WAVE_RUNE_NUMS = 150
  21 +local WAVE_SPARK_NUMS = 150
21 22
22 local function validName(name) 23 local function validName(name)
23 name = string.upper(name) 24 name = string.upper(name)
@@ -206,6 +207,16 @@ function _M.loginRpc( agent, data ) @@ -206,6 +207,16 @@ function _M.loginRpc( agent, data )
206 table_insert(modules, "runeBag") 207 table_insert(modules, "runeBag")
207 end 208 end
208 209
  210 + local sparkIds = {}
  211 + for id ,_ in pairs(role.sparkBag) do
  212 + table.insert(sparkIds, id)
  213 + end
  214 + local sparkWave = math.ceil(#sparkIds / WAVE_SPARK_NUMS)
  215 + if #sparkIds <= 50 then
  216 + sparkWave = 0
  217 + table_insert(modules, "sparkBag")
  218 + end
  219 +
209 for _, name in ipairs(modules) do 220 for _, name in ipairs(modules) do
210 response[name] = {} 221 response[name] = {}
211 for id, unit in pairs(role[name]) do 222 for id, unit in pairs(role[name]) do
@@ -213,12 +224,29 @@ function _M.loginRpc( agent, data ) @@ -213,12 +224,29 @@ function _M.loginRpc( agent, data )
213 end 224 end
214 end 225 end
215 226
216 - response.wave = 1 + heroWave + runeWave + 1 227 + response.wave = 1 + heroWave + runeWave + sparkWave + 1
217 228
218 SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(response)) 229 SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(response))
219 230
220 local curWave = 1 231 local curWave = 1
221 232
  233 + local sparkIndex = 1
  234 + for index = curWave + 1, curWave + sparkWave do
  235 + local sparkResponse = {sparkBag = {}}
  236 + for i = sparkIndex, sparkIndex + WAVE_SPARK_NUMS do
  237 + local sparkId = sparkIds[i]
  238 + if not sparkId then
  239 + break
  240 + end
  241 + local spark = role.sparkBag[sparkId]
  242 + table.insert(sparkResponse.sparkBag, spark:data())
  243 + sparkIndex = sparkIndex + 1
  244 + end
  245 + sparkResponse.sparkWave = index
  246 + SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(sparkResponse))
  247 + end
  248 + curWave = curWave + sparkWave
  249 +
222 local runeIndex = 1 250 local runeIndex = 1
223 for index = curWave + 1, curWave + runeWave do 251 for index = curWave + 1, curWave + runeWave do
224 local runeResponse = {runeBag = {}} 252 local runeResponse = {runeBag = {}}
@@ -358,7 +386,7 @@ function _M.createRpc(agent, data) @@ -358,7 +386,7 @@ function _M.createRpc(agent, data)
358 SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response)) 386 SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response))
359 return true 387 return true
360 end 388 end
361 - newRole:loadRoleIncre() 389 + --newRole:loadRoleIncre()
362 newRole:startActionUcode() 390 newRole:startActionUcode()
363 newRole.sysVersion = msg.sysVersion 391 newRole.sysVersion = msg.sysVersion
364 newRole.ip = agent.ip:toArray(false, ":")[1] 392 newRole.ip = agent.ip:toArray(false, ":")[1]
src/actions/StoreAction.lua
@@ -7,12 +7,13 @@ function _M.rechargeRpc(agent , data) @@ -7,12 +7,13 @@ function _M.rechargeRpc(agent , data)
7 local role = agent.role 7 local role = agent.role
8 local msg = MsgPack.unpack(data) 8 local msg = MsgPack.unpack(data)
9 local id = msg.id 9 local id = msg.id
  10 + local choose = msg.choose or ""
10 local dataSet = csvdb["shop_rechargeCsv"][id] 11 local dataSet = csvdb["shop_rechargeCsv"][id]
11 if not dataSet then return end 12 if not dataSet then return end
12 local roleId = role:getProperty("id") 13 local roleId = role:getProperty("id")
13 14
14 --创建订单号 15 --创建订单号
15 - local partnerOrderId = role:getPurchaseOrder(id) 16 + local partnerOrderId = role:getPurchaseOrder(id,nil,choose)
16 if partnerOrderId == "" then 17 if partnerOrderId == "" then
17 return 1 18 return 1
18 end 19 end
@@ -160,13 +161,14 @@ function _M.googleRechargeRpc(agent, data) @@ -160,13 +161,14 @@ function _M.googleRechargeRpc(agent, data)
160 local role = agent.role 161 local role = agent.role
161 local msg = MsgPack.unpack(data) 162 local msg = MsgPack.unpack(data)
162 local id = msg.id 163 local id = msg.id
  164 + local choose = msg.choose or ""
163 local dataSet = csvdb["shop_rechargeCsv"][id] 165 local dataSet = csvdb["shop_rechargeCsv"][id]
164 if not dataSet then return end 166 if not dataSet then return end
165 local roleId = role:getProperty("id") 167 local roleId = role:getProperty("id")
166 168
167 role.ignoreHeartbeat = true 169 role.ignoreHeartbeat = true
168 --创建订单号 170 --创建订单号
169 - local partnerOrderId = role:getPurchaseOrder(id) 171 + local partnerOrderId = role:getPurchaseOrder(id,nil,choose)
170 -- 签名 172 -- 签名
171 -- local secret_key = "b7657fa7ccd44c16a35e3f454ac7a075" 173 -- local secret_key = "b7657fa7ccd44c16a35e3f454ac7a075"
172 local secret_key = "8920e9dcf0cb4ebca87393ce48021ead" 174 local secret_key = "8920e9dcf0cb4ebca87393ce48021ead"
@@ -188,13 +190,14 @@ function _M.myCardRechargeRpc(agent, data) @@ -188,13 +190,14 @@ function _M.myCardRechargeRpc(agent, data)
188 local role = agent.role 190 local role = agent.role
189 local msg = MsgPack.unpack(data) 191 local msg = MsgPack.unpack(data)
190 local id = msg.id 192 local id = msg.id
  193 + local choose = msg.choose or ""
191 local dataSet = csvdb["shop_rechargeCsv"][id] 194 local dataSet = csvdb["shop_rechargeCsv"][id]
192 if not dataSet then return end 195 if not dataSet then return end
193 local roleId = role:getProperty("id") 196 local roleId = role:getProperty("id")
194 197
195 role.ignoreHeartbeat = true 198 role.ignoreHeartbeat = true
196 --创建订单号 199 --创建订单号
197 - local partnerOrderId = role:getPurchaseOrder(id) 200 + local partnerOrderId = role:getPurchaseOrder(id,nil,choose)
198 -- 签名 201 -- 签名
199 local secret_key = "48759e07540f46d9af17ec82669b4272" 202 local secret_key = "48759e07540f46d9af17ec82669b4272"
200 local need = { 203 local need = {
@@ -214,13 +217,14 @@ function _M.iosRechargeRpc(agent, data) @@ -214,13 +217,14 @@ function _M.iosRechargeRpc(agent, data)
214 local role = agent.role 217 local role = agent.role
215 local msg = MsgPack.unpack(data) 218 local msg = MsgPack.unpack(data)
216 local id = msg.id 219 local id = msg.id
  220 + local choose = msg.choose or ""
217 local dataSet = csvdb["shop_rechargeCsv"][id] 221 local dataSet = csvdb["shop_rechargeCsv"][id]
218 if not dataSet then return end 222 if not dataSet then return end
219 local roleId = role:getProperty("id") 223 local roleId = role:getProperty("id")
220 224
221 role.ignoreHeartbeat = true 225 role.ignoreHeartbeat = true
222 --创建订单号 226 --创建订单号
223 - local partnerOrderId = role:getPurchaseOrder(id) 227 + local partnerOrderId = role:getPurchaseOrder(id,nil,choose)
224 -- 签名 228 -- 签名
225 local secret_key = "1916d62251dd4a8aa5e452121eefc9a1" 229 local secret_key = "1916d62251dd4a8aa5e452121eefc9a1"
226 local need = { 230 local need = {
1 -Subproject commit 82e5e1f2e6dd2bbbd469d24f7a310c1210655be8 1 +Subproject commit 7253317be1301eaa5c45dc1d7d71f17d2f180a18
src/models/Hero.lua
@@ -17,6 +17,7 @@ Hero.schema = { @@ -17,6 +17,7 @@ Hero.schema = {
17 equip = {"string",""}, --装备 type=level 17 equip = {"string",""}, --装备 type=level
18 rune = {"string",""}, --零件 type=id 18 rune = {"string",""}, --零件 type=id
19 faith = {"number", 0}, -- 信赖 19 faith = {"number", 0}, -- 信赖
  20 + spark = {"table", {}}, -- 火花属性
20 } 21 }
21 22
22 function Hero:ctor( properties ) 23 function Hero:ctor( properties )
@@ -52,7 +53,7 @@ end @@ -52,7 +53,7 @@ end
52 function Hero:updateProperties(params, notNotify) 53 function Hero:updateProperties(params, notNotify)
53 self:setProperties(params) 54 self:setProperties(params)
54 55
55 - local check = {level = true, breakL = true, wakeL = true, talent = true, loveL = true, equip = true, rune = true} 56 + local check = {level = true, breakL = true, wakeL = true, talent = true, loveL = true, equip = true, rune = true, spark = true}
56 local datas = {} 57 local datas = {}
57 local updateBV = false 58 local updateBV = false
58 for k , v in pairs(params) do 59 for k , v in pairs(params) do
@@ -83,7 +84,7 @@ function Hero:updateProperty(params) @@ -83,7 +84,7 @@ function Hero:updateProperty(params)
83 local datas = {} 84 local datas = {}
84 table.insert(datas, {key = params.field, newValue = self:getProperty(params.field)}) 85 table.insert(datas, {key = params.field, newValue = self:getProperty(params.field)})
85 86
86 - local check = {level = true, breakL = true, wakeL = true, talent = true, loveL = true, equip = true, rune = true} 87 + local check = {level = true, breakL = true, wakeL = true, talent = true, loveL = true, equip = true, rune = true, spark = true}
87 if check[params.field] then 88 if check[params.field] then
88 local orginValue = self:getProperty("battleV") 89 local orginValue = self:getProperty("battleV")
89 local curValue = self:saveBattleValue() 90 local curValue = self:saveBattleValue()
@@ -108,7 +109,8 @@ function Hero:data() @@ -108,7 +109,8 @@ function Hero:data()
108 -- loveL = self:getProperty("loveL"), 109 -- loveL = self:getProperty("loveL"),
109 equip = self:getProperty("equip"), 110 equip = self:getProperty("equip"),
110 rune = self:getProperty("rune"), 111 rune = self:getProperty("rune"),
111 - faith = self:getProperty("faith") 112 + faith = self:getProperty("faith"),
  113 + spark = self:getProperty("spark"),
112 } 114 }
113 end 115 end
114 116
src/models/HeroPlugin.lua
@@ -121,11 +121,13 @@ function HeroPlugin.bind(Hero) @@ -121,11 +121,13 @@ function HeroPlugin.bind(Hero)
121 local attrs = self:getBaseAttrs() 121 local attrs = self:getBaseAttrs()
122 -- 装备零件 122 -- 装备零件
123 local equipAttrs = self:getRuneEquipAttrs() 123 local equipAttrs = self:getRuneEquipAttrs()
  124 + local sparkAttrs = self:getSparkAttrs()
124 125
125 for _, attName in pairs(AttsEnumEx) do 126 for _, attName in pairs(AttsEnumEx) do
126 attrs[attName] = attrs[attName] or 0 127 attrs[attName] = attrs[attName] or 0
127 attrs[attName] = attrs[attName] + addAttr(attrs[attName], equipAttrs.percent[attName], 1, attName) 128 attrs[attName] = attrs[attName] + addAttr(attrs[attName], equipAttrs.percent[attName], 1, attName)
128 attrs[attName] = attrs[attName] + addAttr(attrs[attName], equipAttrs.value[attName], 0, attName) 129 attrs[attName] = attrs[attName] + addAttr(attrs[attName], equipAttrs.value[attName], 0, attName)
  130 + attrs[attName] = attrs[attName] + addAttr(attrs[attName], sparkAttrs[attName], 0, attName)
129 end 131 end
130 132
131 -- 羁绊加成 133 -- 羁绊加成
@@ -225,6 +227,19 @@ function HeroPlugin.bind(Hero) @@ -225,6 +227,19 @@ function HeroPlugin.bind(Hero)
225 return attrs 227 return attrs
226 end 228 end
227 229
  230 + function Hero:getSparkAttrs()
  231 + local attrs = {}
  232 + for _, attName in pairs(AttsEnumEx) do
  233 + attrs[attName] = 0
  234 + end
  235 + for _, data in pairs(self:getProperty("spark") or {}) do
  236 + for k, v in pairs(data.attrs) do
  237 + attrs[AttsEnumEx[k]] = attrs[AttsEnumEx[k]] + v
  238 + end
  239 + end
  240 + return attrs
  241 + end
  242 +
228 243
229 -- 战斗力(当前属性)= POWER[(生命 + 防御 * 7 + 闪避 * 4)*(攻击*4 + 命中 * 2)*(1 + 暴击几率/100 * 暴击伤害/100)* 攻击速度 / 60000 ,0.8 ] 244 -- 战斗力(当前属性)= POWER[(生命 + 防御 * 7 + 闪避 * 4)*(攻击*4 + 命中 * 2)*(1 + 暴击几率/100 * 暴击伤害/100)* 攻击速度 / 60000 ,0.8 ]
230 -- function Hero:getBattleValue(activeRelation) -- isReal包括队伍加成 245 -- function Hero:getBattleValue(activeRelation) -- isReal包括队伍加成
src/models/Order.lua
@@ -14,6 +14,7 @@ Order.schema = { @@ -14,6 +14,7 @@ Order.schema = {
14 finishTime = {"number", 0}, -- 服务端验证完成时间 14 finishTime = {"number", 0}, -- 服务端验证完成时间
15 status = {"string", "create"}, 15 status = {"string", "create"},
16 sid = {"number",0}, -- 创建单号的设备的sid 16 sid = {"number",0}, -- 创建单号的设备的sid
  17 + choose = {"string", ""}, -- 自选奖励
17 } 18 }
18 19
19 Order.fields = { 20 Order.fields = {
@@ -24,6 +25,7 @@ Order.fields = { @@ -24,6 +25,7 @@ Order.fields = {
24 finishTime = true, 25 finishTime = true,
25 status = true, 26 status = true,
26 sid = true, 27 sid = true,
  28 + choose = true,
27 } 29 }
28 30
29 return Order 31 return Order
30 \ No newline at end of file 32 \ No newline at end of file
src/models/Role.lua
@@ -26,6 +26,7 @@ function Role:ctor( properties ) @@ -26,6 +26,7 @@ function Role:ctor( properties )
26 self.heros = {} 26 self.heros = {}
27 self.runeBag = {} 27 self.runeBag = {}
28 self.friends = {} 28 self.friends = {}
  29 + self.sparkBag = {}
29 self.advData = nil 30 self.advData = nil
30 self.activity = nil 31 self.activity = nil
31 self._pushToken = nil 32 self._pushToken = nil
@@ -194,6 +195,10 @@ Role.schema = { @@ -194,6 +195,10 @@ Role.schema = {
194 radioTask = {"table", {}}, -- 电台任务 {id = {time=end_ts,heros=heros}} 表crusadeCsv 195 radioTask = {"table", {}}, -- 电台任务 {id = {time=end_ts,heros=heros}} 表crusadeCsv
195 196
196 seaport = {"table", {}}, -- 海岛贸易季 {time = 1234567890, donate = {}, collect = {[1] = {team = "1=2=3", time = 1234567890}}, shop = {}} 197 seaport = {"table", {}}, -- 海岛贸易季 {time = 1234567890, donate = {}, collect = {[1] = {team = "1=2=3", time = 1234567890}}, shop = {}}
  198 +
  199 + returner = {"table", {}}, -- 回归者 {time = 12334233423, [1] = 1, [2] = 2, status = {[1] = 1}}
  200 +
  201 + roleIncre = {"table", {}}, -- 角色英雄,铭文,火花自增序列 {heroId = 1, runeId = 1, sparkId = 1}
197 } 202 }
198 203
199 204
@@ -426,6 +431,7 @@ function Role:data() @@ -426,6 +431,7 @@ function Role:data()
426 radioTask = self:getProperty("radioTask"), 431 radioTask = self:getProperty("radioTask"),
427 432
428 seaport = self:getProperty("seaport"), 433 seaport = self:getProperty("seaport"),
  434 + returner = self:getProperty("returner"),
429 } 435 }
430 end 436 end
431 437
src/models/RoleIncre.lua
@@ -9,6 +9,7 @@ RoleIncre.schema = { @@ -9,6 +9,7 @@ RoleIncre.schema = {
9 id = {"number", 0, "pri"}, 9 id = {"number", 0, "pri"},
10 heroId = {"number", 0}, 10 heroId = {"number", 0},
11 runeId = {"number", 0}, 11 runeId = {"number", 0},
  12 + sparkId = {"number", 0},
12 } 13 }
13 14
14 function RoleIncre:increBy(keyName, val) 15 function RoleIncre:increBy(keyName, val)
src/models/RoleLog.lua
@@ -127,6 +127,9 @@ local ItemReason = { @@ -127,6 +127,9 @@ local ItemReason = {
127 refer = 1210, -- 穿戴 127 refer = 1210, -- 穿戴
128 itemCompose = 1211, -- 天赋道具合成 128 itemCompose = 1211, -- 天赋道具合成
129 radioQuest = 1212, -- 电台任务奖励 129 radioQuest = 1212, -- 电台任务奖励
  130 + changeSpark = 1213, -- 穿戴火花
  131 + sparkLvlUp = 1214, -- 火花强化
  132 + sparkQualityUp = 1215, -- 火花升华
130 133
131 -- pvp 134 -- pvp
132 pvpCHead = 1301, -- pvp 跨服竞技场头像 135 pvpCHead = 1301, -- pvp 跨服竞技场头像
@@ -140,6 +143,8 @@ local ItemReason = { @@ -140,6 +143,8 @@ local ItemReason = {
140 seaportShop = 1401, -- 贸易港商店兑换 143 seaportShop = 1401, -- 贸易港商店兑换
141 seaportReward = 1402, -- 贸易港阶段奖励 144 seaportReward = 1402, -- 贸易港阶段奖励
142 seaportTask = 1403, -- 贸易港任务奖励 145 seaportTask = 1403, -- 贸易港任务奖励
  146 +
  147 + returner = 1410, -- 回归者奖励
143 } 148 }
144 149
145 150
@@ -622,6 +627,8 @@ local LogType = { @@ -622,6 +627,8 @@ local LogType = {
622 in_adv = "common", 627 in_adv = "common",
623 out_adv = "common", 628 out_adv = "common",
624 in_artifact = "common", 629 in_artifact = "common",
  630 + in_spark = "common",
  631 + out_spark = "common",
625 632
626 mail_action = "common", 633 mail_action = "common",
627 role_action = "common", 634 role_action = "common",
@@ -634,6 +641,7 @@ local LogType = { @@ -634,6 +641,7 @@ local LogType = {
634 tower_action = "common", 641 tower_action = "common",
635 gm_action = "common", 642 gm_action = "common",
636 act_action = "common", 643 act_action = "common",
  644 + spark_action = "common",
637 } 645 }
638 646
639 -- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-* 647 -- 如要修改 要提前修改 _template mapping -- 对应 mapping 为 gamelog-*
src/models/RolePlugin.lua
@@ -15,8 +15,9 @@ function RolePlugin.bind(Role) @@ -15,8 +15,9 @@ function RolePlugin.bind(Role)
15 self:loadDiner() 15 self:loadDiner()
16 self:loadActivity() 16 self:loadActivity()
17 self:loadStoreInfo() 17 self:loadStoreInfo()
18 - self:loadRoleIncre() 18 + --self:loadRoleIncre()
19 self:loadFriends() 19 self:loadFriends()
  20 + self:loadSparks()
20 end 21 end
21 22
22 function Role:reloadWhenLogin() 23 function Role:reloadWhenLogin()
@@ -101,6 +102,11 @@ function RolePlugin.bind(Role) @@ -101,6 +102,11 @@ function RolePlugin.bind(Role)
101 self:addRune({type = typ,id = itemId, notNotify = pms.notNotify, log = pms.log}) 102 self:addRune({type = typ,id = itemId, notNotify = pms.notNotify, log = pms.log})
102 end 103 end
103 end, 104 end,
  105 + [ItemType.Spark] = function()
  106 + for _= 1, count do
  107 + self:addSpark({id = itemId, notNotify = pms.notNotify, log = pms.log})
  108 + end
  109 + end,
104 [ItemType.AdvItem] = function() --冒险道具不会进入 玩家仓库 110 [ItemType.AdvItem] = function() --冒险道具不会进入 玩家仓库
105 count = 0 111 count = 0
106 end, 112 end,
@@ -346,7 +352,7 @@ function RolePlugin.bind(Role) @@ -346,7 +352,7 @@ function RolePlugin.bind(Role)
346 function Role:addItem(params) 352 function Role:addItem(params)
347 params = params or {} 353 params = params or {}
348 params.count = math.floor(params.count or 0) 354 params.count = math.floor(params.count or 0)
349 - if params.itemId == ItemId.Jade then 355 + if params.itemId == ItemId.Diamond then
350 self:gainDiamond(params) 356 self:gainDiamond(params)
351 return 357 return
352 end 358 end
@@ -476,7 +482,7 @@ function RolePlugin.bind(Role) @@ -476,7 +482,7 @@ function RolePlugin.bind(Role)
476 --self:incrProperty("diamond", count) 482 --self:incrProperty("diamond", count)
477 --end 483 --end
478 484
479 - self:logItems(ItemId.Jade, origin, count, params.log) 485 + self:logItems(ItemId.Diamond, origin, count, params.log)
480 if params.log then 486 if params.log then
481 local log = clone(params.log) 487 local log = clone(params.log)
482 if log["cint1"] or log["cint2"] or log["cint3"] then 488 if log["cint1"] or log["cint2"] or log["cint3"] then
@@ -548,6 +554,14 @@ function RolePlugin.bind(Role) @@ -548,6 +554,14 @@ function RolePlugin.bind(Role)
548 return true 554 return true
549 end 555 end
550 556
  557 + function Role:increBy(field, val)
  558 + local roleIncre = self:getProperty("roleIncre")
  559 + local curId = roleIncre[field] or 0
  560 + roleIncre[field] = curId + val
  561 + self:setProperty("roleIncre", roleIncre)
  562 + return curId + val
  563 + end
  564 +
551 function Role:addHero(params) 565 function Role:addHero(params)
552 local roleId = self:getProperty("id") 566 local roleId = self:getProperty("id")
553 local heroType = params.type 567 local heroType = params.type
@@ -555,7 +569,7 @@ function RolePlugin.bind(Role) @@ -555,7 +569,7 @@ function RolePlugin.bind(Role)
555 local unitData = csvdb["unitCsv"][heroType] 569 local unitData = csvdb["unitCsv"][heroType]
556 if not unitData then return false end 570 if not unitData then return false end
557 571
558 - local heroId = self.roleIncre:increBy("heroId" , 1) 572 + local heroId = self:increBy("heroId" , 1)
559 573
560 local heroInfo = { 574 local heroInfo = {
561 key = string.format("%d",roleId * MAX_HERO_NUM + heroId), 575 key = string.format("%d",roleId * MAX_HERO_NUM + heroId),
@@ -697,17 +711,17 @@ function RolePlugin.bind(Role) @@ -697,17 +711,17 @@ function RolePlugin.bind(Role)
697 end 711 end
698 end 712 end
699 713
700 - function Role:loadRoleIncre()  
701 - local roleId = self:getProperty("id")  
702 - local dataKey = string.format("%d", roleId)  
703 - self.roleIncre = require("models.RoleIncre").new({key = dataKey, id = roleId})  
704 - self.roleIncre.owner = self  
705 - if not self.roleIncre:checkKeyExists(dataKey) then  
706 - self.roleIncre:create()  
707 - else  
708 - self.roleIncre:load()  
709 - end  
710 - end 714 + --function Role:loadRoleIncre()
  715 + -- local roleId = self:getProperty("id")
  716 + -- local dataKey = string.format("%d", roleId)
  717 + -- self.roleIncre = require("models.RoleIncre").new({key = dataKey, id = roleId})
  718 + -- self.roleIncre.owner = self
  719 + -- if not self.roleIncre:checkKeyExists(dataKey) then
  720 + -- self.roleIncre:create()
  721 + -- else
  722 + -- self.roleIncre:load()
  723 + -- end
  724 + --end
711 725
712 function Role:addEquip(equipType, equipLv, count, pms) 726 function Role:addEquip(equipType, equipLv, count, pms)
713 pms = pms or {} 727 pms = pms or {}
@@ -774,6 +788,18 @@ function RolePlugin.bind(Role) @@ -774,6 +788,18 @@ function RolePlugin.bind(Role)
774 end 788 end
775 end 789 end
776 790
  791 + function Role:loadSparks()
  792 + local roleId = self:getProperty("id")
  793 + local res = mysqlproxy:query(string.format("SELECT * FROM `Spark` WHERE `roleid` = %s", roleId))
  794 + for _, data in ipairs(res) do
  795 + local spark = require("models.Spark").new({key = string.format("%d",data.id), id=data.id})
  796 + if spark:load(data) then
  797 + spark.owner = self
  798 + self.sparkBag[data.id] = spark
  799 + end
  800 + end
  801 + end
  802 +
777 -- 0 为操作成功 803 -- 0 为操作成功
778 function Role:addRune(params) 804 function Role:addRune(params)
779 if params.type and params.id then 805 if params.type and params.id then
@@ -783,7 +809,7 @@ function RolePlugin.bind(Role) @@ -783,7 +809,7 @@ function RolePlugin.bind(Role)
783 if not data then return 3 end 809 if not data then return 3 end
784 810
785 local roleId = self:getProperty("id") 811 local roleId = self:getProperty("id")
786 - local runeUid = self.roleIncre:increBy("runeId" , 1) 812 + local runeUid = self:increBy("runeId" , 1)
787 813
788 local runeInfo = { 814 local runeInfo = {
789 key = string.format("%d",roleId * MAX_RUNE_NUM + runeUid), 815 key = string.format("%d",roleId * MAX_RUNE_NUM + runeUid),
@@ -827,6 +853,96 @@ function RolePlugin.bind(Role) @@ -827,6 +853,96 @@ function RolePlugin.bind(Role)
827 end 853 end
828 end 854 end
829 855
  856 + -- 0 为操作成功
  857 + function Role:addSpark(params)
  858 + if params.id then
  859 + local set = csvdb["sparkCsv"][params.id]
  860 + if not set then return 2 end
  861 + local data = set[0]
  862 + if not data then return 3 end
  863 +
  864 + local roleId = self:getProperty("id")
  865 + local sparkUid = self:increBy("sparkId" , 1)
  866 +
  867 + local sparkInfo = {
  868 + key = string.format("%d",roleId * MAX_SPARK_NUM + sparkUid),
  869 + id = roleId * MAX_SPARK_NUM + sparkUid,
  870 + roleid = roleId,
  871 + cfg_id = params.id,
  872 + }
  873 + local newSpark = require("models.Spark").new(sparkInfo)
  874 + newSpark:create()
  875 + newSpark:addAttr(data.attr:toNumMap())
  876 + newSpark.owner = self
  877 + self.sparkBag[sparkUid] = newSpark
  878 + if not params.notNotify then
  879 + local response = {}
  880 + table.insert(response, newSpark:data())
  881 + SendPacket(actionCodes.Role_loadSparks, MsgPack.pack(response))
  882 + end
  883 +
  884 + --self:checkTaskEnter("AddSpark", {id = params.id, type = params.type, rarity = data.rarity}, params.notNotify)
  885 +
  886 + self:logItems(params.id, 0, 1, params.log)
  887 + if params.log then
  888 + local log = clone(params.log)
  889 + if log["cint1"] or log["cint2"] or log["cint3"] then
  890 + print("addSpark error log have cint1 or cint2 or cint3 ", debug.traceback())
  891 + end
  892 +
  893 + log["cint1"] = sparkUid
  894 + log["cint2"] = params.cfg_id
  895 +
  896 + self:mylog("in_spark", log)
  897 + else
  898 + print("addSpark no log ", debug.traceback())
  899 + end
  900 +
  901 + return 0, newSpark
  902 + else
  903 + return 1
  904 + end
  905 + end
  906 +
  907 + function Role:delSparks(sparkIds, params) -- 批量删除 {id, }
  908 + params = params or {}
  909 + local roleId = self:getProperty('id')
  910 + local bDel = {}
  911 + for _, sparkId in pairs(sparkIds) do
  912 + local spark = self.sparkBag[sparkId]
  913 + if spark then
  914 +
  915 + self:logItems(spark:getProperty("id"), 1, 0, params.log)
  916 + if params.log then
  917 + local log = clone(params.log)
  918 + if log["cint1"] or log["cint2"] then
  919 + print("delSpark error log have cint1 or cint2 ", debug.traceback())
  920 + end
  921 +
  922 + log["cint1"] = sparkId
  923 + log["cint2"] = spark:getProperty("cfg_id")
  924 +
  925 + self:mylog("out_spark", log)
  926 + else
  927 + print("delSparks no log ", debug.traceback())
  928 + end
  929 +
  930 + self.sparkBag[sparkId] = nil
  931 + table.insert(bDel, sparkId)
  932 + end
  933 + end
  934 +
  935 + -- delete spark
  936 + mysqlproxy:query(string.format("DELETE FROM `Spark` WHERE `id` in (%s)", table.concat(bDel, ",")))
  937 +
  938 + local response = {}
  939 + for _, sparkId in pairs(bDel) do
  940 + table.insert(response, {id = sparkId, bDel = true})
  941 + end
  942 +
  943 + SendPacket(actionCodes.Role_loadSparks, MsgPack.pack(response))
  944 + end
  945 +
830 function Role:delRunes(runeIds, params) -- 批量删除 {id, } 946 function Role:delRunes(runeIds, params) -- 批量删除 {id, }
831 params = params or {} 947 params = params or {}
832 local roleId = self:getProperty('id') 948 local roleId = self:getProperty('id')
@@ -1244,8 +1360,7 @@ function RolePlugin.bind(Role) @@ -1244,8 +1360,7 @@ function RolePlugin.bind(Role)
1244 local donate = seaport.donate or {} 1360 local donate = seaport.donate or {}
1245 if not reset and (not donate[1] or not donate[2]) then 1361 if not reset and (not donate[1] or not donate[2]) then
1246 local result = self:getSeaportServerProgress() 1362 local result = self:getSeaportServerProgress()
1247 - local seaportCsv = csvdb["seaport_purchaseCsv"]  
1248 - for idx, set in ipairs(seaportCsv) do 1363 + for idx, set in ipairs(csvdb["seaport_purchaseCsv"]) do
1249 local done = true 1364 local done = true
1250 for id, data in ipairs(set) do 1365 for id, data in ipairs(set) do
1251 if donate[id] or not result[idx] or not result[idx][id] or result[idx][id] < data.need_num then 1366 if donate[id] or not result[idx] or not result[idx][id] or result[idx][id] < data.need_num then
@@ -1255,7 +1370,12 @@ function RolePlugin.bind(Role) @@ -1255,7 +1370,12 @@ function RolePlugin.bind(Role)
1255 end 1370 end
1256 if done then 1371 if done then
1257 update = true 1372 update = true
1258 - self:award(set[1].phase_award, {log = {desc = "seaportReward", int1 = set[1].phase, int2 = set[1].id}}) 1373 + redisproxy:insertEmail({
  1374 + roleId = self:getProperty("id"),
  1375 + emailId = idx == 1 and 361 or 362,
  1376 + attachments = set[1].phase_award,
  1377 + })
  1378 + -- self:award(set[1].phase_award, {log = {desc = "seaportReward", int1 = set[1].phase, int2 = set[1].id}})
1259 donate[idx] = 1 1379 donate[idx] = 1
1260 end 1380 end
1261 end 1381 end
@@ -1292,6 +1412,8 @@ function RolePlugin.bind(Role) @@ -1292,6 +1412,8 @@ function RolePlugin.bind(Role)
1292 local expCarbonId = self:getProperty("hangInfo").expCarbonId 1412 local expCarbonId = self:getProperty("hangInfo").expCarbonId
1293 local taskCsv = csvdb["seaport_taskCsv"] 1413 local taskCsv = csvdb["seaport_taskCsv"]
1294 local endTime = openTime0 + 86400 * 2 1414 local endTime = openTime0 + 86400 * 2
  1415 + local reward = {}
  1416 +
1295 for slot, set in pairs(taskCsv) do 1417 for slot, set in pairs(taskCsv) do
1296 if collect[slot] then 1418 if collect[slot] then
1297 update = true 1419 update = true
@@ -1328,10 +1450,29 @@ function RolePlugin.bind(Role) @@ -1328,10 +1450,29 @@ function RolePlugin.bind(Role)
1328 itemReward[key] = math.ceil(1.5 * value) 1450 itemReward[key] = math.ceil(1.5 * value)
1329 end 1451 end
1330 end 1452 end
1331 - self:award(itemReward, {log = {desc = "seaportTask", int1 = slot, int2 = level}}) 1453 +
  1454 + for itemId, value in pairs(itemReward) do
  1455 + reward[itemId] = (reward[itemId] or 0) + value
  1456 + end
  1457 + -- self:award(itemReward, {log = {desc = "seaportTask", int1 = slot, int2 = level}})
1332 end 1458 end
1333 end 1459 end
1334 end 1460 end
  1461 +
  1462 + if next(reward) then
  1463 + local rewardStr = ""
  1464 + for itemId, value in pairs(reward) do
  1465 + if rewardStr ~= "" then
  1466 + rewardStr = rewardStr .. " "
  1467 + end
  1468 + rewardStr = rewardStr .. string.format("%s=%s",itemId,value)
  1469 + end
  1470 + redisproxy:insertEmail({
  1471 + roleId = self:getProperty("id"),
  1472 + emailId = 363,
  1473 + attachments = rewardStr,
  1474 + })
  1475 + end
1335 end 1476 end
1336 seaport.collect = {} 1477 seaport.collect = {}
1337 1478
@@ -1358,6 +1499,17 @@ function RolePlugin.bind(Role) @@ -1358,6 +1499,17 @@ function RolePlugin.bind(Role)
1358 end 1499 end
1359 end 1500 end
1360 1501
  1502 + -- 检查回归者
  1503 + function Role:checkReturner()
  1504 + local returner = self:getProperty("returner") or {}
  1505 + if next(returner) then return end
  1506 +
  1507 + local now = specTime({hour = 4})
  1508 + returner.time = now
  1509 +
  1510 + self:updateProperty({field = "returner", value = returner})
  1511 + end
  1512 +
1361 function Role:getSeaportServerProgress() 1513 function Role:getSeaportServerProgress()
1362 local result = {} 1514 local result = {}
1363 1515
@@ -1758,10 +1910,10 @@ function RolePlugin.bind(Role) @@ -1758,10 +1910,10 @@ function RolePlugin.bind(Role)
1758 for _, info in ipairs(objs) do 1910 for _, info in ipairs(objs) do
1759 info:update() 1911 info:update()
1760 end 1912 end
1761 - local tbObjs = {self.friends, self.heros, self.runeBag} 1913 + local tbObjs = {self.friends, self.heros, self.runeBag, self.sparkBag}
1762 for _, tbObj in ipairs(tbObjs) do 1914 for _, tbObj in ipairs(tbObjs) do
1763 for _, info in pairs(tbObj) do 1915 for _, info in pairs(tbObj) do
1764 - tbObj:update() 1916 + info:update()
1765 end 1917 end
1766 end 1918 end
1767 end 1919 end
@@ -1910,7 +2062,7 @@ function RolePlugin.bind(Role) @@ -1910,7 +2062,7 @@ function RolePlugin.bind(Role)
1910 return "error money" 2062 return "error money"
1911 end 2063 end
1912 -- 发现需要的id 2064 -- 发现需要的id
1913 - local partnerOrderId = self:getPurchaseOrder(k, params.transactionId) 2065 + local partnerOrderId = self:getPurchaseOrder(k, params.transactionId, params.choose)
1914 if partnerOrderId == "" then 2066 if partnerOrderId == "" then
1915 return "no product" 2067 return "no product"
1916 end 2068 end
@@ -1920,7 +2072,7 @@ function RolePlugin.bind(Role) @@ -1920,7 +2072,7 @@ function RolePlugin.bind(Role)
1920 end 2072 end
1921 2073
1922 -- 获取充值订单号 2074 -- 获取充值订单号
1923 - function Role:getPurchaseOrder(rechargeId, transactionId) 2075 + function Role:getPurchaseOrder(rechargeId, transactionId, choose)
1924 local roleId = self:getProperty("id") 2076 local roleId = self:getProperty("id")
1925 local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] 2077 local rechargeData = csvdb["shop_rechargeCsv"][rechargeId]
1926 if not rechargeData then 2078 if not rechargeData then
@@ -1932,7 +2084,24 @@ function RolePlugin.bind(Role) @@ -1932,7 +2084,24 @@ function RolePlugin.bind(Role)
1932 if limit ~= 0 and limit <= (rechargeRecord[rechargeId] or 0) then 2084 if limit ~= 0 and limit <= (rechargeRecord[rechargeId] or 0) then
1933 return "" 2085 return ""
1934 end 2086 end
1935 - 2087 + -- 检查礼包自选奖励合法
  2088 + if choose and choose ~= "" then
  2089 + if rechargeData.itemgift == "" then return "" end
  2090 + local slot = rechargeData.itemdirect or 0
  2091 + local set = choose:toTableArray(true)
  2092 + if slot ~= #set then return "" end
  2093 + local pass = {}
  2094 + local groups = rechargeData.itemgift:toTableArray(true)
  2095 + for idx, item in ipairs(set) do
  2096 + for _, group in ipairs(groups) do
  2097 + if group[2] == item[1] and group[3] == item[2] and idx == group[1] then
  2098 + pass[group[1]] = 1
  2099 + break
  2100 + end
  2101 + end
  2102 + end
  2103 + if #pass ~= slot then return "" end
  2104 + end
1936 --判断是否是活动商品 2105 --判断是否是活动商品
1937 if rechargeData.activity_id ~= 0 then 2106 if rechargeData.activity_id ~= 0 then
1938 local actCfg = csvdb["activity_ctrlCsv"][rechargeData.activity_id] 2107 local actCfg = csvdb["activity_ctrlCsv"][rechargeData.activity_id]
@@ -1962,6 +2131,7 @@ function RolePlugin.bind(Role) @@ -1962,6 +2131,7 @@ function RolePlugin.bind(Role)
1962 transactionId = transactionId, 2131 transactionId = transactionId,
1963 roleid = roleId, 2132 roleid = roleId,
1964 sid = self:getProperty("sid"), 2133 sid = self:getProperty("sid"),
  2134 + choose = choose or "",
1965 }) 2135 })
1966 order:create() 2136 order:create()
1967 -- 正在进行中的订单 缓存 2137 -- 正在进行中的订单 缓存
@@ -2038,7 +2208,7 @@ function RolePlugin.bind(Role) @@ -2038,7 +2208,7 @@ function RolePlugin.bind(Role)
2038 }) 2208 })
2039 end 2209 end
2040 2210
2041 - return true, rechargeId, sid 2211 + return true, rechargeId, sid, orderObject:getProperty("choose")
2042 end 2212 end
2043 2213
2044 -- 充值 -- 2214 -- 充值 --
@@ -2056,7 +2226,7 @@ function RolePlugin.bind(Role) @@ -2056,7 +2226,7 @@ function RolePlugin.bind(Role)
2056 local roleId = self:getProperty("id") 2226 local roleId = self:getProperty("id")
2057 local partnerOrderStr = params.order 2227 local partnerOrderStr = params.order
2058 2228
2059 - local status, back, sid = self:updatePurchaseOrder(partnerOrderStr, params.transactionId, "finsh") 2229 + local status, back, sid, choose = self:updatePurchaseOrder(partnerOrderStr, params.transactionId, "finsh")
2060 if not status then 2230 if not status then
2061 if back == "finsh" then 2231 if back == "finsh" then
2062 -- 订单已经处理 2232 -- 订单已经处理
@@ -2079,6 +2249,7 @@ function RolePlugin.bind(Role) @@ -2079,6 +2249,7 @@ function RolePlugin.bind(Role)
2079 pay_time = params.pay_time, 2249 pay_time = params.pay_time,
2080 order = partnerOrderStr, 2250 order = partnerOrderStr,
2081 sid = sid, 2251 sid = sid,
  2252 + choose = choose,
2082 }) 2253 })
2083 2254
2084 if not status then 2255 if not status then
@@ -2126,6 +2297,17 @@ function RolePlugin.bind(Role) @@ -2126,6 +2297,17 @@ function RolePlugin.bind(Role)
2126 return 3 2297 return 3
2127 end 2298 end
2128 2299
  2300 + -- 自选奖励部分
  2301 + if params.choose and params.choose ~= "" then
  2302 + local tReward, tChange = self:award(params.choose, {log = {desc = "recharge", int1 = id}})
  2303 + for itemId, value in pairs(tReward) do
  2304 + reward[itemId] = (reward[itemId] or 0) + value
  2305 + end
  2306 + for itemId, value in pairs(tChange or {}) do
  2307 + reward[itemId] = (reward[itemId] or 0) + value
  2308 + end
  2309 + end
  2310 +
2129 if diamondCount > 0 then 2311 if diamondCount > 0 then
2130 reward[ItemId.Jade] = (reward[ItemId.Jade] or 0) + diamondCount 2312 reward[ItemId.Jade] = (reward[ItemId.Jade] or 0) + diamondCount
2131 end 2313 end
src/models/RoleTask.lua
@@ -109,6 +109,7 @@ local TaskType = { @@ -109,6 +109,7 @@ local TaskType = {
109 CostDiamond = 909, -- 消耗钻石 109 CostDiamond = 909, -- 消耗钻石
110 WeekTask = 910, -- 完成每周活跃任务 110 WeekTask = 910, -- 完成每周活跃任务
111 ActBattlePass = 911, -- 活动关卡通关 -- chapterId 111 ActBattlePass = 911, -- 活动关卡通关 -- chapterId
  112 + Appoint = 912, -- 触发限时礼包,指定id
112 113
113 --功能未实现 todo 114 --功能未实现 todo
114 AdvShop = 1002, -- 冒险商城 115 AdvShop = 1002, -- 冒险商城
@@ -264,6 +265,7 @@ local StoreListener = { @@ -264,6 +265,7 @@ local StoreListener = {
264 [TaskType.AdvPassFirst] = {{TriggerEventType.AdvPass, f("id")}}, 265 [TaskType.AdvPassFirst] = {{TriggerEventType.AdvPass, f("id")}},
265 [TaskType.AddHero] = {{TriggerEventType.AddNewHero, f("heroType")}, {TriggerEventType.SSRCount, f("ssrCount")}}, 266 [TaskType.AddHero] = {{TriggerEventType.AddNewHero, f("heroType")}, {TriggerEventType.SSRCount, f("ssrCount")}},
266 [TaskType.DrawHeroLimitPack] = {{TriggerEventType.DrawHeroCnt, f("count")}}, 267 [TaskType.DrawHeroLimitPack] = {{TriggerEventType.DrawHeroCnt, f("count")}},
  268 + [TaskType.Appoint] = {{TriggerEventType.Appoint, f("id")}},
267 } 269 }
268 } 270 }
269 271
@@ -319,6 +321,11 @@ local BattleCommandTaskListener = { @@ -319,6 +321,11 @@ local BattleCommandTaskListener = {
319 listen = CalendaTaskListener["listen"] 321 listen = CalendaTaskListener["listen"]
320 } 322 }
321 323
  324 +local ReturnerTask = {
  325 + func = "checkReturnerTask",
  326 + listen = CalendaTaskListener["listen"]
  327 +}
  328 +
322 local TaskListeners = { 329 local TaskListeners = {
323 StoryListener, 330 StoryListener,
324 CommonListener, 331 CommonListener,
@@ -328,6 +335,7 @@ local TaskListeners = { @@ -328,6 +335,7 @@ local TaskListeners = {
328 StoreListener, 335 StoreListener,
329 CalendaTaskListener, 336 CalendaTaskListener,
330 BattleCommandTaskListener, 337 BattleCommandTaskListener,
  338 + ReturnerTask,
331 } 339 }
332 340
333 local RoleTask = {} 341 local RoleTask = {}
@@ -825,6 +833,15 @@ function RoleTask.bind(Role) @@ -825,6 +833,15 @@ function RoleTask.bind(Role)
825 self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2) 833 self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2)
826 end 834 end
827 835
  836 + function Role:checkReturnerTask(notNotify, mainType, subType, param1, param2)
  837 + -- print("check returner task", mainType, subType, param1, param2)
  838 + local returner = self:getProperty("returner") or {}
  839 + if not returner.time then return end
  840 + local actData = csvdb["activity_ctrlCsv"][76]
  841 + local keyName = "returner"
  842 + self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2)
  843 + end
  844 +
828 end 845 end
829 846
830 return RoleTask 847 return RoleTask
src/models/RoleTimeReset.lua
@@ -28,6 +28,11 @@ ResetFunc[&quot;CrossDay&quot;] = function(self, notify, response, now) @@ -28,6 +28,11 @@ ResetFunc[&quot;CrossDay&quot;] = function(self, notify, response, now)
28 self.storeData:resetStoreReored(3) --商店跨月重置 time_reset表关联id 28 self.storeData:resetStoreReored(3) --商店跨月重置 time_reset表关联id
29 end 29 end
30 30
  31 + -- 检查回归者
  32 + if ltime ~= 0 and (now - ltime) >= 86400 * globalCsv.returner_time then
  33 + self:checkReturner()
  34 + end
  35 +
31 response.dTask = {} 36 response.dTask = {}
32 response.advSup = self:getProperty("advSup") 37 response.advSup = self:getProperty("advSup")
33 self:log("onLogin") 38 self:log("onLogin")
src/models/Spark.lua 0 → 100644
@@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
  1 +local Spark = class("Spark", require("shared.ModelBaseMysql"))
  2 +Spark.schema = {
  3 + id = {"number", 0, "pri"}, -- 唯一自增id
  4 + roleid = {"number", 0, "index"}, -- 唯一自增id
  5 + cfg_id = {"number"},
  6 + level = {"number", 0}, -- 等级
  7 + attrs = {"table", {}} -- 基础属性值 id=value
  8 +}
  9 +
  10 +function Spark:ctor( properties )
  11 + Spark.super.ctor(self, properties)
  12 +end
  13 +
  14 +function Spark:notifyUpdateProperty(field, newValue, oldValue)
  15 + local datas = {
  16 + id = self:getProperty("id"),
  17 + datas = {
  18 + {
  19 + key = field,
  20 + newValue = newValue,
  21 + oldValue = oldValue,
  22 + }
  23 + }
  24 + }
  25 + self:notifyUpdateProperties(datas)
  26 +end
  27 +
  28 +function Spark:mylog(contents)
  29 + contents = contents or {}
  30 + if contents["cint1"] or contents["cint2"] then
  31 + print("sparkLog error log have cint1 or cint2 ", debug.traceback())
  32 + end
  33 + contents["cint1"] = self:getProperty("id")
  34 + contents["cint2"] = self:getProperty("cfg_id")
  35 +
  36 + self.owner:mylog("spark_action", contents)
  37 +end
  38 +
  39 +function Spark:notifyUpdateProperties(params)
  40 + local updateData = {
  41 + id = self:getProperty("id"),
  42 + datas = params
  43 + }
  44 + SendPacket(actionCodes.Role_updateSpark, MsgPack.pack(updateData))
  45 +end
  46 +
  47 +function Spark:updateProperty(params)
  48 + if not params.field or (not params.delta and not params.value) then
  49 + return
  50 + end
  51 + if params.delta then
  52 + self:incrProperty(params.field, params.delta)
  53 + elseif params.value then
  54 + self:setProperty(params.field, params.value)
  55 + end
  56 + local datas = {}
  57 + table.insert(datas, {key = params.field, newValue = self:getProperty(params.field)})
  58 +
  59 + self:notifyUpdateProperties(datas)
  60 +end
  61 +
  62 +function Spark:addAttr(attrs)
  63 + local curAttrs = clone(self:getProperty("attrs"))
  64 + for k, v in pairs(attrs) do
  65 + curAttrs[k] = (curAttrs[k] or 0) + v
  66 + end
  67 + self:updateProperty({field = "attrs", value = curAttrs})
  68 +end
  69 +
  70 +function Spark:data()
  71 + return {
  72 + id = self:getProperty("id"),
  73 + cfg_id = self:getProperty("cfg_id"),
  74 + level = self:getProperty("level"),
  75 + attrs = self:getProperty("attrs"),
  76 + }
  77 +end
  78 +
  79 +return Spark
0 \ No newline at end of file 80 \ No newline at end of file
src/services/dbseed.lua
@@ -140,7 +140,7 @@ local function initAdvSeasonTable() @@ -140,7 +140,7 @@ local function initAdvSeasonTable()
140 end 140 end
141 141
142 local function checkRoleTables() 142 local function checkRoleTables()
143 - local list = {"Role", "Daily", "Activity", "Diner", "Store", "Hero", "RoleIncre", "Rune", "Order", "Email", "Friend"} 143 + local list = {"Role", "Daily", "Activity", "Diner", "Store", "Hero", "Rune", "Order", "Email", "Friend", "Spark"}
144 for _, name in ipairs(list) do 144 for _, name in ipairs(list) do
145 local obj = require("models."..name).new({key = "key"}) 145 local obj = require("models."..name).new({key = "key"})
146 print("check table [" .. name .. "] begin.") 146 print("check table [" .. name .. "] begin.")
src/services/globald.lua
@@ -229,6 +229,67 @@ local function check_trade_seaport_status() @@ -229,6 +229,67 @@ local function check_trade_seaport_status()
229 skynet.timeout(interval, check_trade_seaport_status) 229 skynet.timeout(interval, check_trade_seaport_status)
230 end 230 end
231 231
  232 +-- @desc: 海港贸易捐赠作弊
  233 +local seaportTimes = {}
  234 +local function check_trade_seaport_donate()
  235 + local time1 = tonumber(redisproxy:hget("autoincrement_set", "seaportTime1")) or 0
  236 + local time2 = tonumber(redisproxy:hget("autoincrement_set", "seaportTime2")) or 0
  237 + if time1 == 0 and time2 == 0 then
  238 + seaportTimes = {}
  239 + skynet.timeout(360000, check_trade_seaport_donate)
  240 + return
  241 + end
  242 +
  243 + local csvdb = require "shared.csvdata"
  244 + local donateCsv = csvdb["seaport_purchaseCsv"]
  245 +
  246 + local times = {time1, time2}
  247 + for phase, open in ipairs(times) do
  248 + if open == 1 and not seaportTimes[phase] then
  249 + seaportTimes[phase] = {}
  250 + for _, _ in ipairs(donateCsv[phase]) do
  251 + table.insert(seaportTimes[phase],math.randomInt(1800, 3600))
  252 + end
  253 + end
  254 + end
  255 +
  256 + local interval = 3600
  257 + local phase, id = 0, 0
  258 +
  259 + for key1, data in ipairs(seaportTimes) do
  260 + for key2, temp in pairs(data) do
  261 + if times[key1] == 1 and temp < interval then
  262 + interval = temp
  263 + phase = key1
  264 + id = key2
  265 + end
  266 + end
  267 + end
  268 +
  269 + for _, data in ipairs(seaportTimes) do
  270 + for id, temp in pairs(data) do
  271 + data[id] = temp - interval
  272 + if data[id] == 0 then
  273 + data[id] = math.randomInt(1800, 3600)
  274 + end
  275 + end
  276 + end
  277 +
  278 + if phase ~= 0 and id ~= 0 then
  279 + local redisKeys = {SEAPORT_TRADE_TASK_1,SEAPORT_TRADE_TASK_2}
  280 + local all = donateCsv[phase][id].need_num
  281 + local old = tonumber(redisproxy:hget(redisKeys[phase],id)) or 0
  282 + local add = math.min(math.randomInt(math.floor(all/20),math.floor(all/12)),all - old)
  283 + if add > 0 then
  284 + redisproxy:hincrby(redisKeys[phase],id,add)
  285 + else
  286 + seaportTimes[phase][id] = nil
  287 + end
  288 + end
  289 +
  290 + skynet.timeout(interval * 100, check_trade_seaport_donate)
  291 +end
  292 +
232 local CMD = {} 293 local CMD = {}
233 294
234 295
@@ -255,6 +316,7 @@ function CMD.start() @@ -255,6 +316,7 @@ function CMD.start()
255 save_autoincrement_timer() 316 save_autoincrement_timer()
256 check_trade_seaport_status() 317 check_trade_seaport_status()
257 save_seaport_task() 318 save_seaport_task()
  319 + check_trade_seaport_donate()
258 end 320 end
259 321
260 local function __init__() 322 local function __init__()
src/shared/ModelBase.lua
@@ -178,7 +178,7 @@ function ModelBase:loadProperties(properties) @@ -178,7 +178,7 @@ function ModelBase:loadProperties(properties)
178 properties[field] = MsgPack.unpack(properties[field]) 178 properties[field] = MsgPack.unpack(properties[field])
179 end 179 end
180 180
181 - local val = properties[field] or def 181 + local val = properties[field] or clone(def)
182 if val ~= nil then 182 if val ~= nil then
183 if typ == "number" then val = tonumber(val) end 183 if typ == "number" then val = tonumber(val) end
184 assert(type(val) == typ, 184 assert(type(val) == typ,