Преглед на файлове

修复宝箱问题和道具获取皮肤修改

SCFC преди 1 година
родител
ревизия
09d0b74617

+ 0 - 1
script/module/bag/BagLogic.lua

@@ -106,7 +106,6 @@ function addItem(human, id, cnt, logType, noSend, otherData)
 	local oldCnt = human.db.bag[id] or 0
 	local newCnt = math.min(oldCnt + cnt, ItemDefine.BAG_ITEM_MAX_CNT)
 	human.db.bag[id] = newCnt
-	print("[addItem] id = "..id .." newCnt = "..newCnt.."\n")
 	
 	if not noSend then
 		sendChange(human, id, oldCnt < 1)

+ 1 - 1
script/module/bag/ItemLogic.lua

@@ -382,7 +382,7 @@ function cmd.UseSkinItem(data, human, nMoney)
         return false
     end
 
-    HeroSkinLogic.SendSkinInfoByMoney(human, nMoney)
+    HeroSkinLogic.SendSkinInfoByMoney(human, nMoney, data.id)
 end
 
 function cmd.treasurechestadd(data, human)

+ 1 - 0
script/module/bag/Proto.lua

@@ -275,6 +275,7 @@ GC_SUIPIAN_SYNTHESIS = {
 
 -- 发送合成道具对应的皮肤信息
 GC_ITEM_SKIN_INFO = {
+	{"nItemID", 1,	"int"},
 	{"data",	1,	"string"}
 }
 

+ 1 - 0
script/module/broadcast/PanelDefine.lua

@@ -74,6 +74,7 @@ PANEL_ID_1018 = 1018 --[战报]界面
 PANEL_ID_1019 = 1019 --[羁绊]界面
 PANEL_ID_1020 = 1020 --[羁绊]英雄选择界面
 PANEL_ID_1021 = 1021 --[装备tips]新手引导用
+PANEL_ID_1022 = 1022 --[宝箱]界面
 
 PANEL_ID_1101 = 1101 --[英雄]-列表
 PANEL_ID_1102 = 1102 --[英雄]-图鉴

+ 1 - 0
script/module/combat/CombatLogic.lua

@@ -62,6 +62,7 @@ local BattleLogic = require("battle.BattleLogic")
 FieldsCombat = {
 	lv = 1, name = 1, head = 1, headFrame = 1, unionUuid = 1, lastLogoutTime = 1, 
 	combatHero = 1, heroBag = 1, moshou = 1, technology=1, chengjiu=1, realmLv = 1, talismanData = 1,
+	headList = 1, headFrameList = 1, bodyList = 1, chenghaoList = 1,animationList =1,backgroundList =1,
 }
 
 COMBAT_CACHE = COMBAT_CACHE or {}

+ 2 - 1
script/module/present/HeroSkinLogic.lua

@@ -93,7 +93,7 @@ function RefreshClient(human,type,data)
     Msg.send(msgRet,human.fd)
 end
 
-function SendSkinInfoByMoney(human, nMoney)
+function SendSkinInfoByMoney(human, nMoney, nItemID)
     if not human or 0 >= nMoney then
         return
     end
@@ -115,6 +115,7 @@ function SendSkinInfoByMoney(human, nMoney)
         list = ret
     }
     local msgRet = Msg.gc.GC_ITEM_SKIN_INFO
+    msgRet.nItemID = nItemID
     msgRet.data = Json.Encode(data)
 
     Msg.send(msgRet,human.fd)

+ 1 - 0
script/module/role/RoleAttr.lua

@@ -123,6 +123,7 @@ function calcMonsterConf(monsterID, attrID, attrInput)
 end
 
 -- 根据英雄grid重算英雄属性
+-- 如果新增加了模块用于HERO_OTHER_ATTRS计算属性, 需要同步到 CombatLogic中的FieldsCombat 
 local TEMP_HERO_ATTRS = {}
 local HERO_BASE_ATTRS = {}
 local HERO_OTHER_ATTRS = {}

+ 27 - 10
script/module/treasurechest/TreasureChestLogic.lua

@@ -52,11 +52,26 @@ local function TreasureChestLogic_GetPointPrizeConf()
             table.insert(tCacheBoxPrize[nType], v)
         end
 
+        -- 变成有序
         for _, v in pairs(tCacheBoxPrize) do
             table.sort(v, function (l, r)
                 return l.nPro < r.nPro
             end)
         end
+
+        -- 整合权重
+        for _, data in ipairs(tCacheBoxPrize) do
+            local nAllWeight = 0
+            for _, v in ipairs(data) do
+                if nAllWeight == 0 then
+                    nAllWeight = v.nPro
+                else
+                    nAllWeight = nAllWeight + v.nPro
+                end
+
+                v.nAllPro = nAllWeight
+            end
+        end
     end
 
     return tCacheBoxPrize
@@ -130,6 +145,8 @@ local function TreasureChestLogic_UpdatePointPrize(human)
             if CommonDefine.COMMON_PRIZE_STATE_NOGET == nState then
                 TreasureChestLogic_SetDBPointPrize(human, nID,  CommonDefine.COMMON_PRIZE_STATE_CANGET)
                 nNowPoint = nNowPoint - v.nPoint
+            elseif CommonDefine.COMMON_PRIZE_STATE_CANGET == nState then
+                nNowPoint = nNowPoint - v.nPoint
             end
         end
     end
@@ -144,23 +161,23 @@ local function TreasureChestLogic_OpenBox(nType, nBoxNum)
     end
 
     local nOpenNum = tBoxTypeConf[nType].nOpenNum
+    -- 获取的表是有序的
     local tBoxTypePrize = tBoxPrize[nType]
-    
-    -- 整合权重
-    local nWeight, tWeightPrize = 0, {}
-    for _, v in ipairs(tBoxTypePrize) do
-        nWeight = nWeight + v.nPro
-        tWeightPrize[nWeight] = v
-    end
+    local nLen = #tBoxTypePrize
+    local nAllWeight = tBoxTypePrize[nLen].nAllPro
+    --print("[TreasureChestLogic_OpenBox] nAllWeight = "..nAllWeight)
 
     local tOpenPrize = {}
     for i = 1, nBoxNum, 1 do
         for j = 1, nOpenNum, 1 do
             -- 随机权重
-            local nRandNum = math.random(1, nWeight)
-            for nkey, v in pairs(tWeightPrize) do
-                if nRandNum <= nkey then
+            local nRandNum = math.random(1, nAllWeight)
+            --print("[TreasureChestLogic_OpenBox] j = "..j.." nRandNum = "..nRandNum)
+            for _, v in pairs(tBoxTypePrize) do
+                --print("[TreasureChestLogic_OpenBox] nAllPro = "..v.nAllPro.." ID = "..v.tPrize[1].." num = "..v.tPrize[2].."\n")
+                if nRandNum <= v.nAllPro then
                     table.insert(tOpenPrize, v.tPrize)
+                    --print("[TreasureChestLogic_OpenBox] 获得的道具 nID = "..v.tPrize[1].." nNum = "..v.tPrize[2].." nKey "..v.nAllPro)
                     break
                 end
             end