diff --git a/src/GlobalVar.lua b/src/GlobalVar.lua index 8af0bbc..d7f621a 100644 --- a/src/GlobalVar.lua +++ b/src/GlobalVar.lua @@ -126,9 +126,10 @@ ItemStartId = { ItemId = { Gold = 1, -- 金币 Exp = 2, -- 经验 - Diamond = 3, -- 钻石 + Jade = 3, -- 虹光玉 PlayerExp = 4, -- 突破材料 FriendPoint = 5, -- 友情点 + Diamond = 8, -- 钻石 BreakCost = 10, -- 突破材料 EquipUp = 11, -- 装备升级材料 DinerCoin = 12, --后勤物资 diff --git a/src/actions/ActivityAction.lua b/src/actions/ActivityAction.lua index 8384726..8750724 100644 --- a/src/actions/ActivityAction.lua +++ b/src/actions/ActivityAction.lua @@ -1275,8 +1275,8 @@ function _M.buyBattleCommandLvlRpc(agent, data) end if cost == 0 then return 5 end - if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return 6 end - role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "actBuyBpLevel", int1 = curLvl}}) + if not role:checkItemEnough({[ItemId.Jade] = cost}) then return 6 end + role:costItems({[ItemId.Jade] = cost}, {log = {desc = "actBuyBpLevel", int1 = curLvl}}) actData["lvl"] = nextLvl role.activity:updateActData("BattleCommand", actData) diff --git a/src/actions/AdvAction.lua b/src/actions/AdvAction.lua index b9442ee..820800e 100644 --- a/src/actions/AdvAction.lua +++ b/src/actions/AdvAction.lua @@ -381,8 +381,8 @@ function _M.quickHangRpc(agent, data) local cost = math.ceil((info.time - skynet.timex()) / 3600 * globalCsv.adv_idle_quicken) - if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return end - role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "advQuickHang", int1 = chapterId}}) + if not role:checkItemEnough({[ItemId.Jade] = cost}) then return end + role:costItems({[ItemId.Jade] = cost}, {log = {desc = "advQuickHang", int1 = chapterId}}) info.time = 0 role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) @@ -508,10 +508,10 @@ function _M.buyAdvCountRpc(agent , data) local cost if isEl then if math.illegalNum(count, 1, globalCsv.adv_endless_daily_buy_count - role.dailyData:getProperty("advElBC")) then return end - cost = {[ItemId.Diamond] = count * globalCsv.adv_endless_daily_buy_cost} + cost = {[ItemId.Jade] = count * globalCsv.adv_endless_daily_buy_cost} else if math.illegalNum(count, 1, globalCsv.adv_daily_buy_count - role.dailyData:getProperty("advBC")) then return end - cost = {[ItemId.Diamond] = count * globalCsv.adv_daily_buy_cost} + cost = {[ItemId.Jade] = count * globalCsv.adv_daily_buy_cost} end @@ -1029,8 +1029,8 @@ function _M.refreshSupportRpc(agent, data) if cr < al then --免费 role.dailyData:updateProperty({field = "advSupRe", delta = 1}) else -- 付费 - if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.adv_support_refresh_cost}) then return end - role:costItems({[ItemId.Diamond] = globalCsv.adv_support_refresh_cost}, {log = {desc = "advReSupport"}}) + if not role:checkItemEnough({[ItemId.Jade] = globalCsv.adv_support_refresh_cost}) then return end + role:costItems({[ItemId.Jade] = globalCsv.adv_support_refresh_cost}, {log = {desc = "advReSupport"}}) end role:advRandomSupportEffect() diff --git a/src/actions/DinerAction.lua b/src/actions/DinerAction.lua index 7497fc7..bdc0061 100644 --- a/src/actions/DinerAction.lua +++ b/src/actions/DinerAction.lua @@ -253,7 +253,7 @@ function _M.expediteSellRpc( agent, data ) end local diamond = globalCsv.diner_sell_quick_cost[count] if diamond > 0 then - local cost = {[ItemId.Diamond] = diamond} + local cost = {[ItemId.Jade] = diamond} if not role:checkItemEnough(cost) then return 2 end @@ -612,7 +612,7 @@ function _M.refreshTaskRpc( agent, data ) local role = agent.role local msg = MsgPack.unpack(data) - --local cost = {[ItemId.Diamond] = 40} + --local cost = {[ItemId.Jade] = 40} --if not role:checkItemEnough(cost) then -- return 1 --end diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index 5700d7a..a8d0917 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -424,8 +424,8 @@ function _M.quickRpc(agent , data) local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") if not costs[curCount] then return end if costs[curCount] > 0 then - if not role:checkItemEnough({[ItemId.Diamond] = costs[curCount]}) then return end - role:costItems({[ItemId.Diamond] = costs[curCount]}, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) + if not role:checkItemEnough({[ItemId.Jade] = costs[curCount]}) then return end + role:costItems({[ItemId.Jade] = costs[curCount]}, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) end role.dailyData:updateProperty({field = "hangQC", value = curCount}) @@ -502,9 +502,9 @@ function _M.buyBonusCountRpc(agent, data) local lastCount = globalCsv.bonus_daily_buy_count * coef + extraCnt - bonusC[btype]["b"] if math.illegalNum(count, 1, lastCount) then return 1 end - if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}) then return 2 end + if not role:checkItemEnough({[ItemId.Jade] = globalCsv.bonus_buy_cost * count}) then return 2 end - role:costItems({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}, {log = {desc = "buyBonusCount", int1 = btype, int2 = count}}) + role:costItems({[ItemId.Jade] = globalCsv.bonus_buy_cost * count}, {log = {desc = "buyBonusCount", int1 = btype, int2 = count}}) bonusC[btype]["b"] = bonusC[btype]["b"] + count bonusC[btype]["c"] = bonusC[btype]["c"] - count @@ -777,11 +777,11 @@ function _M.bagFieldRpc(agent, data) if not costD then return 1 end - if costD ~= 0 and not role:checkItemEnough({[ItemId.Diamond] = costD}) then + if costD ~= 0 and not role:checkItemEnough({[ItemId.Jade] = costD}) then return 2 end role:updateProperty({field = "hangBagLimit", value = curBL + 1}) - role:costItems({[ItemId.Diamond] = costD}, {log = {desc = "bagField"}}) + role:costItems({[ItemId.Jade] = costD}, {log = {desc = "bagField"}}) SendPacket(actionCodes.Hang_bagFieldRpc, '') return true end diff --git a/src/actions/HeroAction.lua b/src/actions/HeroAction.lua index 0685c14..a92c243 100644 --- a/src/actions/HeroAction.lua +++ b/src/actions/HeroAction.lua @@ -630,11 +630,11 @@ function _M.getResetRewardRpc(agent, data) totalCost[costArr[1]] = costArr[2] else local diamond = (costArr[2] - itemCount) * costArr[3] - if role:getItemCount(ItemId.Diamond) < diamond then + if role:getItemCount(ItemId.Jade) < diamond then return 1 end totalCost[costArr[1]] = itemCount - totalCost[ItemId.Diamond] = diamond + totalCost[ItemId.Jade] = diamond end --if pay and not role:costDiamond({count = globalCsv.unit_heroBack_cost or 200, log = {desc = "resetHero", int1 = msg.id}}) then diff --git a/src/actions/PvpAction.lua b/src/actions/PvpAction.lua index 6471375..60cf3c6 100644 --- a/src/actions/PvpAction.lua +++ b/src/actions/PvpAction.lua @@ -241,7 +241,7 @@ function _M.buyCountRpc(agent, data) return 1 end - local cost = {[ItemId.Diamond] = globalCsv.pvp_buy_cost * count} + local cost = {[ItemId.Jade] = globalCsv.pvp_buy_cost * count} if not role:checkItemEnough(cost) then return 2 end role:costItems(cost, {log = {desc = "buyPvpKey"}}) role:award({[ItemId.PvpKey] = count}, {log = {desc = "buyPvpKey"}}) diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index 51c5b9d..bd66d6e 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -615,8 +615,8 @@ function _M.openTimeBoxRpc(agent, data) stopTime = nowTime + quick local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") local costKey = math.ceil(quick / (cost_pre[1] * 60)) * cost_pre[2] - if not role:checkItemEnough({[ItemId.Diamond] = costKey}) then return 5 end - role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) + if not role:checkItemEnough({[ItemId.Jade] = costKey}) then return 5 end + role:costItems({[ItemId.Jade] = costKey}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) else stopTime = math.min(nowTime,time + globalCsv.box_productLine_time * 3600) end @@ -805,8 +805,8 @@ function _M.storyBookRewardRpc(agent, data) role:log("carriage_video", { carriage_video_type = storyBookData.type, --放映室类型,剧情CG:0, 角色CG:1, 主线剧情:2, 角色剧情:3, 活动剧情:4, 图鉴:5 carriage_video_id = storyId, --放映室片段ID - carriage_video_coinid = reward[ItemId.Diamond] and ItemId.Diamond or 0, --放映奖励货币类型,无奖励则填写0 - carriage_video_coinnum = reward[ItemId.Diamond] or 0, --放映奖励货币数量,无奖励则填写0 + carriage_video_coinid = reward[ItemId.Jade] and ItemId.Jade or 0, --放映奖励货币类型,无奖励则填写0 + carriage_video_coinnum = reward[ItemId.Jade] or 0, --放映奖励货币数量,无奖励则填写0 carriage_video_item = reward, --放映奖励其他物品数量,json格式记录,{'itemid1':10,'itemid2':5,…………..},无奖励则填写0 }) @@ -1337,7 +1337,7 @@ function _M.goldBuyRpc(agent, data) if not costD then return 1 end - if costD ~= 0 and not role:checkItemEnough({[ItemId.Diamond] = costD}) then + if costD ~= 0 and not role:checkItemEnough({[ItemId.Jade] = costD}) then return 2 end local goldC = 0 @@ -1359,7 +1359,7 @@ function _M.goldBuyRpc(agent, data) local coef = role.storeData:getGearExchangeCoef() goldC = goldC * coef role.dailyData:updateProperty({field = "goldBuyT", value = curT + 1}) - role:costItems({[ItemId.Diamond] = costD}, {log = {desc = "goldBuy"}}) + role:costItems({[ItemId.Jade] = costD}, {log = {desc = "goldBuy"}}) local reward, change = role:award({[ItemId.Gold] = math.floor(goldC)}, {log = {desc = "goldBuy"}}) SendPacket(actionCodes.Role_goldBuyRpc, MsgPack.pack(role:packReward(reward, change))) return true diff --git a/src/actions/SeaportAction.lua b/src/actions/SeaportAction.lua index e048b30..1d88295 100644 --- a/src/actions/SeaportAction.lua +++ b/src/actions/SeaportAction.lua @@ -198,8 +198,8 @@ function _M.taskRpc(agent, data) if quick and remainT > 0 then local cost = math.ceil(remainT / 3600) * globalCsv.seaport_task_quick - if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return 8 end - role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "seaportTask", int1 = taskId, int2 = level}}) + if not role:checkItemEnough({[ItemId.Jade] = cost}) then return 8 end + role:costItems({[ItemId.Jade] = cost}, {log = {desc = "seaportTask", int1 = taskId, int2 = level}}) end local carbonCsv = csvdb["idle_battleCsv"] diff --git a/src/models/Role.lua b/src/models/Role.lua index 01e6c3a..e2f448e 100644 --- a/src/models/Role.lua +++ b/src/models/Role.lua @@ -61,6 +61,7 @@ Role.schema = { ignoreMt = {"number", 0}, -- 忽略维护拦截 sversion = {"number", STRUCT_VERSION or 0}, -- 重整数据版本 timeReset = {"table", {}}, --重置轮回记录 + jade = {"number", 0}, -- 虹光玉 diamond = {"number", 0}, -- 免费钻 reDiamond = {"number", 0}, -- android充值钻 reDiamondIos = {"number", 0}, -- ios充值钻 diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 46ada0c..10c5477 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -346,7 +346,7 @@ function RolePlugin.bind(Role) function Role:addItem(params) params = params or {} params.count = math.floor(params.count or 0) - if params.itemId == ItemId.Diamond then + if params.itemId == ItemId.Jade then self:gainDiamond(params) return end @@ -404,14 +404,14 @@ function RolePlugin.bind(Role) function Role:costItems(itemCountT, params) local pms = clone(params or {}) - if itemCountT[ItemId.Diamond] then --优先扣除钻石 - pms.count = itemCountT[ItemId.Diamond] + if itemCountT[ItemId.Jade] then --优先扣除钻石 + pms.count = itemCountT[ItemId.Jade] if not self:costDiamond(pms) then return end end for itemId, count in pairs(itemCountT) do - if itemId ~= ItemId.Diamond then + if itemId ~= ItemId.Jade then pms.itemId = itemId pms.count = - count self:addItem(pms) @@ -453,7 +453,8 @@ function RolePlugin.bind(Role) function Role:getAllDiamond() local diamond = self:getProperty("sid") == IOS_SID and self:getProperty("reDiamondIos") or self:getProperty("reDiamond") - return self:getProperty("diamond") + diamond + --return self:getProperty("diamond") + diamond + return diamond end function Role:gainDiamond(params) @@ -462,20 +463,20 @@ function RolePlugin.bind(Role) if isnan(count) then return false end - local origind = self:getProperty("diamond") + local origind = 0 -- self:getProperty("diamond") local originr = self:getProperty("sid") == IOS_SID and self:getProperty("reDiamondIos") or self:getProperty("reDiamond") local origin = origind + originr - if params.isRecharge then + --if params.isRecharge then if params.sid == IOS_SID then self:incrProperty("reDiamondIos", count) else self:incrProperty("reDiamond", count) end - else - self:incrProperty("diamond", count) - end + --else + --self:incrProperty("diamond", count) + --end - self:logItems(ItemId.Diamond, origin, count, params.log) + self:logItems(ItemId.Jade, origin, count, params.log) if params.log then local log = clone(params.log) if log["cint1"] or log["cint2"] or log["cint3"] then @@ -502,7 +503,7 @@ function RolePlugin.bind(Role) return false end local isIos = self:getProperty("sid") == IOS_SID - local origind = self:getProperty("diamond") + local origind = 0 -- self:getProperty("diamond") local originr = isIos and self:getProperty("reDiamondIos") or self:getProperty("reDiamond") local origin = origind + originr @@ -512,18 +513,20 @@ function RolePlugin.bind(Role) if origin < count then return false end - local last = count - local costFirst = isIos and {"diamond", "reDiamondIos"} or {"diamond", "reDiamond"} - if params.isRecharge then - costFirst = isIos and {"reDiamondIos", "diamond"} or {"reDiamond", "diamond"} - end - last = math.max(last - self:getProperty(costFirst[1]), 0) - if last < count then - self:incrProperty(costFirst[1], last - count) - end - if last > 0 then - self:incrProperty(costFirst[2], -last) - end + local diamondKey = isIos and "reDiamondIos" or "reDiamond" + self:incrProperty(diamondKey, -count) + --local last = count + --local costFirst = isIos and {"diamond", "reDiamondIos"} or {"diamond", "reDiamond"} + --if params.isRecharge then + -- costFirst = isIos and {"reDiamondIos", "diamond"} or {"reDiamond", "diamond"} + --end + --last = math.max(last - self:getProperty(costFirst[1]), 0) + --if last < count then + -- self:incrProperty(costFirst[1], last - count) + --end + --if last > 0 then + -- self:incrProperty(costFirst[2], -last) + --end self:logItems(ItemId.Diamond, origin, count, params.log) @@ -2124,7 +2127,7 @@ function RolePlugin.bind(Role) end if diamondCount > 0 then - reward[ItemId.Diamond] = (reward[ItemId.Diamond] or 0) + diamondCount + reward[ItemId.Jade] = (reward[ItemId.Jade] or 0) + diamondCount end self:checkTaskEnter("Pay", {rmb = rechargeData.rmb, twd = rechargeData.twd}) diff --git a/src/services/dbseed.lua b/src/services/dbseed.lua index 625442d..46c8024 100644 --- a/src/services/dbseed.lua +++ b/src/services/dbseed.lua @@ -201,10 +201,10 @@ local steps = { handler = initAutoIncreUidTable, desc = "initialize auto_increment_uid table " }, - [3] = { - handler = initAdvSeasonTable, - desc = "initialize adv_season table " - }, + --[3] = { + -- handler = initAdvSeasonTable, + -- desc = "initialize adv_season table " + --}, [4] = { handler = checkRoleTables, desc = "check role tables " -- libgit2 0.21.2