From 2638c8b67d1dcac1c774f942ac144579c6f82ec1 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 11 九月 2018 21:41:11 +0800
Subject: [PATCH] 3479 【后端】【主干】【1.0.15】助战发送喊话时新增逻辑(自动加入匹配中的队伍);

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py |   60 ++++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 38 insertions(+), 22 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
index 9c3d2dd..c7ea0f9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_ItemCompound.py
@@ -25,6 +25,7 @@
 import IpyGameDataPY
 import ChConfig
 import PlayerSuccess
+import DataRecordPack
 import PlayerWing
 import PlayerDogz
 
@@ -90,7 +91,6 @@
     successRate = ipyData.GetSuccessRate()
     successRateMax = ipyData.GetSuccessRateMax()
     addonsCountMax = ipyData.GetAddonsCountMax() # 可叠加的算叠加数量
-    msgMark = ipyData.GetSysMark()
     # 可使用非固定道具 或 附加道具的 单次合成数默认为1
     if unfixedItemIDList or addonsCountMax > 0:
         compoundCnt = 1
@@ -126,11 +126,12 @@
         fixedItemIndexDict, fixedItemNeedCntDict, compoundBindCnt = fixedItemInfo
     
     # 检查附加道具增加成功率消耗
-    addSuccRate = 0
+    addSuccRate, addSuccRateItemInfo = 0, []
     if addonsCountMax > 0:
-        addSuccRate = __CheckAddonsItem(playerID, compoundID, itemPack, addonsItemIndexList, addonsItemCountList, addonsCountMax)
-        if addSuccRate == None:
+        addSuccRateInfo = __CheckAddonsItem(playerID, compoundID, itemPack, addonsItemIndexList, addonsItemCountList, addonsCountMax)
+        if addSuccRateInfo == None:
             return
+        addSuccRate, addSuccRateItemInfo = addSuccRateInfo
     
     # 扣铜钱
     PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, totalNeedMoney, ChConfig.Def_Cost_ItemProduce, 
@@ -181,9 +182,33 @@
             GameWorld.DebugLog("首次合成一代翅膀,必定成功!totalSuccRate=%s" % totalSuccRate, playerID)
             
     # 合成成功
-    if GameWorld.CanHappen(totalSuccRate, ShareDefine.Def_MaxRateValue):
+    maxRateValue = ShareDefine.Def_MaxRateValue
+    randValue = random.randint(1, maxRateValue)
+    canHappen = randValue <= totalSuccRate
+    GameWorld.DebugLog("canHappen=%s,randValue=%s,totalSuccRate=%s,maxRateValue=%s" 
+                       % (canHappen, randValue, totalSuccRate, maxRateValue), playerID)
+    # 不是百分百成功的记录合成流向
+    if successRate != maxRateValue:
+        drDict = {"PlayerID":curPlayer.GetPlayerID(), "AccID":curPlayer.GetAccID(), "ID":compoundID, "MakeItemID":makeItemID, "IsSuccess":canHappen,
+                  "RateInfo":{"totalSuccRate":"%s(%s+%s)" % (totalSuccRate, successRate, addSuccRate), "randValue":randValue, "maxRateValue":maxRateValue},
+                  "AddSuccRateItemInfo":addSuccRateItemInfo
+                  }
+        DataRecordPack.SendEventPack("ItemCompound", drDict, curPlayer)
+        
+    if canHappen:
         GameWorld.DebugLog("合成成功: makeItemID=%s,compoundCnt=%s,compoundBindCnt=%s" % (makeItemID, compoundCnt, compoundBindCnt), playerID)
-        GiveNewCompoundItem(curPlayer, makeItemID, compoundCnt, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, msgMark)
+        userData = GiveNewCompoundItem(curPlayer, makeItemID, compoundCnt, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp)
+        
+        msgMark = ipyData.GetSysMark()
+        paramType = ipyData.GetSysMarkParamType()
+        if msgMark not in ['0', '', '-']:
+            if paramType == 2 and fixedItemIDList and fixedItemCountList:
+                PlayerControl.WorldNotify(0, msgMark, [curPlayer.GetName(), fixedItemCountList[0], fixedItemIDList[0], makeItemID, userData])
+            else:
+                PlayerControl.WorldNotify(0, msgMark, [curPlayer.GetName(), makeItemID, userData])
+                
+        # 通知合成成功
+        ItemCommon.SyncMakeItemAnswer(curPlayer, ShareDefine.Def_mitItemCompound, ChConfig.Def_ComposeState_Sucess, makeItemID)
         #成功合成1个物品成就
         PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_CompoundItemEx, compoundCnt, [makeItemID])
         #合成X阶X颜色X星级以上装备
@@ -367,6 +392,7 @@
 #    ComposeAddonsQuality    4|2    0    0    0    0        阶数和颜色
 #    ComposeAddonsFormula    level*10    0    0    0    0        计算合成时附加材料增加的几率公式
 
+    addSuccRateItemInfo = []
     composeAddonsTypeList = IpyGameDataPY.GetFuncEvalCfg("ComposeAddonsType")
     classLV, color = IpyGameDataPY.GetFuncEvalCfg("ComposeAddonsQuality", 1)
     ComposeAddonsFormula = IpyGameDataPY.GetFuncCfg("ComposeAddonsFormula")
@@ -418,8 +444,9 @@
         
         addSuccRate = eval(FormulaControl.GetCompileFormula("ComposeAddonsFormula", ComposeAddonsFormula))
         addTotalSuccRate += (addSuccRate*costCount)
+        addSuccRateItemInfo.append({"ItemID":itemID, "ItemColor":itemColor, "ItemClassLV":itemClassLV, "addSuccRate":addSuccRate, "costCount":costCount})
         
-    return int(addTotalSuccRate)
+    return int(addTotalSuccRate), addSuccRateItemInfo
 
 
 def __CheckItemCanUseCompound(playerID, index, curItem):
@@ -446,7 +473,7 @@
 #  @param newItem: 新物品
 #  @param itemCount: 合成数量
 #  @return None
-def GiveNewCompoundItem(curPlayer, newItemID, itemCount, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp, msgMark):
+def GiveNewCompoundItem(curPlayer, newItemID, itemCount, compoundBindCnt, wingItemExpInfo, dogzEquipPlusExp):
     compoundUnBindCnt = itemCount - compoundBindCnt
     
     if compoundBindCnt > 0:
@@ -454,20 +481,9 @@
     if compoundUnBindCnt > 0:
         userData = __GivePlayerCompoundItem(curPlayer, newItemID, compoundUnBindCnt, False, wingItemExpInfo, dogzEquipPlusExp)
         
-    if userData == None:
-        return
-    
-    if msgMark not in ['0', '', '-']:
-        PlayerControl.WorldNotify(0, msgMark, [curPlayer.GetName(), newItemID, userData])
-    
-    # 您获得了物品XX XX个
-    #PlayerControl.NotifyCode(curPlayer, "ObtainRes01", [newItemID, itemCount])    
-    # 通知放入特效
-    #curPlayer.Sync_GetItemView(newItemID, itemCount)  
-    # 通知合成成功
-    ItemCommon.SyncMakeItemAnswer(curPlayer, ShareDefine.Def_mitItemCompound, ChConfig.Def_ComposeState_Sucess, newItemID)
-    #curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitItemCompound, ChConfig.Def_ComposeState_Sucess)
-    return True
+    if not userData:
+        return ""
+    return userData
 
 def __GivePlayerCompoundItem(curPlayer, newItemID, itemCount, isBind, wingItemExpInfo, dogzEquipPlusExp):
     playerID = curPlayer.GetPlayerID()

--
Gitblit v1.8.0