302 【公会】BOSS讨伐-服务端(优化可领取宝箱数统计逻辑,修复可能导致的个别情况下少领取宝箱bug;)
3个文件已修改
48 ■■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Taofa.py 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyTaofa.py 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3404,7 +3404,7 @@
Def_Player_Dict_FamilyTaofaAnger = "FamilyTaofaAnger" # 当前怒气
Def_Player_Dict_FamilyTaofaBoxTotalGetCnt = "FamilyTaofaBoxTotalGetCnt" # 累计已领取宝箱奖励数
Def_Player_Dict_FamilyTaofaBoxUnGetCnt = "FamilyTaofaBoxUnGetCnt" # 当前未领取的宝箱奖励数
Def_Player_Dict_FamilyTaofaBoxLastTime = "FamilyTaofaBoxLastTime" # 上一次统计未领取宝箱时间戳,超过该时间戳的宝箱才可以再增加未领取
Def_Player_Dict_FamilyTaofaLeaveGetCnt = "FamilyTaofaLeaveGetCnt" # 上一次离开公会时累计领取宝箱数
Def_Player_Dict_FamilyTaofaBoxContribCnt = "FamilyTaofaBoxContribCnt" # 累计贡献的宝箱奖励数
Def_Player_Dict_FamilyTaofaBoxHurt = "FamilyTaofaBoxHurt" # 宝箱奖励计算累计伤害,求余亿部分
Def_Player_Dict_FamilyTaofaBoxHurtEx = "FamilyTaofaBoxHurtEx" # 宝箱奖励计算累计伤害,整除亿部分
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Taofa.py
@@ -35,7 +35,6 @@
        GameWorld.DebugAnswer(curPlayer, "设置当前怒气: Taofa a 怒气")
        GameWorld.DebugAnswer(curPlayer, "设置讨伐次数: Taofa c 已讨伐次数  物品次数")
        GameWorld.DebugAnswer(curPlayer, "设置宝箱领取: Taofa b 已领取宝箱 未领取")
        GameWorld.DebugAnswer(curPlayer, "设置宝箱时间: Taofa t 几秒前统计的")
        GameWorld.DebugAnswer(curPlayer, "设置宝箱贡献: Taofa g 已贡献宝箱 [累计伤害 历史伤害]")
        GameWorld.DebugAnswer(curPlayer, "增加成员讨伐: Taofa m 人数 [伤害值A 到B 怒攻概率]")
        GameWorld.DebugAnswer(curPlayer, "创建仙盟相关使用命令: CreateFamily")
@@ -92,12 +91,6 @@
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxUnGetCnt, unGetCnt)
        GameWorld.DebugAnswer(curPlayer, "已领取宝箱:%s, 未领取:%s" % (totalGetCnt, unGetCnt))
        
    elif value1 == "t":
        befSeconds = msgList[1] if len(msgList) > 1 else 0
        lastTime = int(time.time()) - befSeconds
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxLastTime, lastTime)
        GameWorld.DebugAnswer(curPlayer, "上次检查宝箱时间:%s" % (GameWorld.ChangeTimeNumToStr(lastTime)))
    elif value1 == "g":
        contribCnt = msgList[1] if len(msgList) > 1 else 0
        boxHurtTotal = msgList[2] if len(msgList) > 2 else None
@@ -142,6 +135,8 @@
            break
        member = curFamily.GetAt(index)
        memID = member.GetPlayerID()
        if memID == PlayerFamilyTaofa.ActionGlobalID:
            continue
        if memID >= ShareDefine.RealPlayerIDStart:
            # 不包括真实玩家
            continue
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyTaofa.py
@@ -78,8 +78,8 @@
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBuZhenState, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaAnger, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxUnGetCnt, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaLeaveGetCnt, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxTotalGetCnt, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxLastTime, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxContribCnt, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxHurt, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxHurtEx, 0)
@@ -115,8 +115,8 @@
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBuZhenState, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaAnger, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxUnGetCnt, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaLeaveGetCnt, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxTotalGetCnt, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxLastTime, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxContribCnt, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxHurt, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxHurtEx, 0)
@@ -140,6 +140,9 @@
    ## 玩家退出了公会,针对玩家个人的处理
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaAnger, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxUnGetCnt, 0)
    totalGetCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaBoxTotalGetCnt)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaLeaveGetCnt, totalGetCnt)
    GameWorld.DebugLog("退出公会记录讨伐已累计领取宝箱数: totalGetCnt=%s" % totalGetCnt)
    SyncTaofaInfo(curPlayer)
    return
@@ -235,37 +238,33 @@
def __doUpdPlayerAwardBoxCnt(curPlayer, member, memContribDict, awardBoxMax, unSyncIDList):
    playerID = curPlayer.GetPlayerID()
    joinTime = member.GetJoinTime()
    boxLastTime = max(curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaBoxLastTime), joinTime) # 与加入时间取最大
    leaveGetCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaLeaveGetCnt) # 上次离开公会时累计领取数
    boxTotalGetCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaBoxTotalGetCnt) # 已领取宝箱数
    curFamilyGetCnt = boxTotalGetCnt - leaveGetCnt # 来到本公会后累计领取数
    boxUnGetCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaBoxUnGetCnt) # 未领取宝箱数
    canAddBoxMax = awardBoxMax - boxTotalGetCnt - boxUnGetCnt # 还可领取的箱子数
    if canAddBoxMax <= 0:
        GameWorld.DebugLog("    成员可领取宝箱已达上限不刷新: playerID=%s,boxLastTime=%s,boxTotalGetCnt(%s)+boxUnGetCnt(%s) >= %s"
                           % (playerID, boxLastTime, boxTotalGetCnt, boxUnGetCnt, awardBoxMax))
        GameWorld.DebugLog("    成员可领取宝箱已达上限不刷新: playerID=%s,boxTotalGetCnt(%s)+boxUnGetCnt(%s) >= %s"
                           % (playerID, boxTotalGetCnt, boxUnGetCnt, awardBoxMax))
        return
    
    updBoxLastTime = boxLastTime
    addUnGetBox = 0
    curFamilyCanGet = 0 # 在本公会累计可领取箱子数
    for contribList in memContribDict.values():
        if addUnGetBox >= canAddBoxMax:
            break
        for atkTime, contribBoxCnt in contribList:
            if boxLastTime >= atkTime:
            if joinTime >= atkTime:
                #GameWorld.DebugLog("    加入公会之前的箱子不能领取: joinTime=%s > atkTime(%s),contribBoxCnt=%s" % (joinTime, atkTime, contribBoxCnt))
                continue
            updBoxLastTime = max(updBoxLastTime, atkTime)
            addUnGetBox += contribBoxCnt
            if addUnGetBox >= canAddBoxMax:
                break
            curFamilyCanGet += contribBoxCnt
            
    addUnGetBox = min(curFamilyCanGet - curFamilyGetCnt - boxUnGetCnt, canAddBoxMax)
    if addUnGetBox <= 0:
        GameWorld.DebugLog("    成员当前没有可领取的宝箱不刷新: playerID=%s,boxLastTime=%s,boxTotalGetCnt=%s,boxUnGetCnt=%s,awardBoxMax=%s,canAddBoxMax=%s"
                           % (playerID, boxLastTime, boxTotalGetCnt, boxUnGetCnt, awardBoxMax, canAddBoxMax))
        GameWorld.DebugLog("    成员当前没有可领取的宝箱不刷新: playerID=%s,curFamilyCanGet=%s,curFamilyGetCnt=%s(%s-%s),boxUnGetCnt=%s,awardBoxMax=%s,canAddBoxMax=%s"
                           % (playerID, curFamilyCanGet, curFamilyGetCnt, boxTotalGetCnt, leaveGetCnt, boxUnGetCnt, awardBoxMax, canAddBoxMax))
        return
    updBoxUnGetCnt = boxUnGetCnt + addUnGetBox
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxUnGetCnt, updBoxUnGetCnt)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxLastTime, updBoxLastTime)
    GameWorld.DebugLog("    成员可领取的宝箱数: playerID=%s,addUnGetBox=%s,updBoxUnGetCnt=%s,updBoxLastTime=%s,boxLastTime=%s,boxTotalGetCnt=%s,boxUnGetCnt=%s,awardBoxMax=%s,canAddBoxMax=%s"
                       % (playerID, addUnGetBox, updBoxUnGetCnt, updBoxLastTime, boxLastTime, boxTotalGetCnt, boxUnGetCnt, awardBoxMax, canAddBoxMax))
    GameWorld.DebugLog("    成员可领取的宝箱数: playerID=%s,addUnGetBox=%s,updBoxUnGetCnt=%s,curFamilyCanGet=%s,curFamilyGetCnt=%s(%s-%s),boxUnGetCnt=%s,awardBoxMax=%s,canAddBoxMax=%s"
                       % (playerID, addUnGetBox, updBoxUnGetCnt, curFamilyCanGet, curFamilyGetCnt, boxTotalGetCnt, leaveGetCnt, boxUnGetCnt, awardBoxMax, canAddBoxMax))
    if not unSyncIDList or playerID not in unSyncIDList:
        SyncTaofaInfo(curPlayer)
    return