hxp
2024-05-16 b4d7b98ffa412398224044aa25b85f92118ede8e
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
@@ -53,8 +53,6 @@
    if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Arena):
        return
    
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaItemAddCount, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaBattleCountDay, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaMatchRefreshCount, 0)
    Sync_ArenaInfo(curPlayer)
    
@@ -122,18 +120,41 @@
        GameWorld.DebugLog("竞技场赛季重置! preSeasonscore=%s,setScore=%s" % (preSeasonscore, setScore))
        
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaScore, setScore)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaItemAddCount, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaBattleCountDay, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaMatchRefreshCount, 0)
    Sync_ArenaInfo(curPlayer, True)
    return
def CheckArenaBattleCount(curPlayer):
    ## 验证是否还有对战次数
    todayBattleCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCountDay)
    itemAddCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaItemAddCount)
    dayFreeCount = IpyGameDataPY.GetFuncCfg("ArenaSet", 3)
    return todayBattleCount < (dayFreeCount + itemAddCount)
def AddArenaBattleCount(curPlayer, addCount):
    updCount = min(ChConfig.Def_UpperLimit_DWord, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCount) + addCount)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaBattleCount, updCount)
    Sync_ArenaInfo(curPlayer)
    return
def GetArenaBattleCount(curPlayer):
    ## 获取当前可对战次数
    return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCount)
def GetArenaBattleCountMax(curPlayer):
    ## 最大可累计挑战次数
    initMax = IpyGameDataPY.GetFuncCfg("ArenaSet", 3) # 初始最大次数
    # 其他功能增加上限...
    maxCount = initMax
    return maxCount
def CheckCanGiveBattleCountItem(curPlayer, itemID):
    ## 可否给加挑战次数道具
    itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
    if not itemData:
        return False
    itemEff = itemData.GetEffectByIndex(0)
    if itemEff.GetEffectID() != ChConfig.Def_Effect_AddArenaBattleCount:
        GameWorld.DebugLog("非挑战券可给! itemID=%s" % itemID)
        return True
    canGive = GetArenaBattleCount(curPlayer) < GetArenaBattleCountMax(curPlayer)
    GameWorld.DebugLog("可否给挑战券: canGive=%s" % canGive)
    return canGive
#// B2 09 竞技场匹配玩家 #tagCMArenaMatch
#
@@ -282,10 +303,10 @@
    updOrder = retDict["updOrder"]
    
    # 扣次数
    todayBattleCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCountDay) + 1
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaBattleCountDay, todayBattleCount)
    battleCount = max(0, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCount) - 1)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaBattleCount, battleCount)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaMatchRefreshCount, 0)
    # 更新积分
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaScore, updScore)
    highestScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaHighestScore)
@@ -362,9 +383,8 @@
    clientPack = ChPyNetSendPack.tagMCArenaPlayerInfo()
    clientPack.IsReset = 1 if isReset else 0
    clientPack.Score = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaScore)
    clientPack.BattleCountToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCountDay)
    clientPack.MatchRefreshCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaMatchRefreshCount)
    clientPack.ItemAddBattleCountToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaItemAddCount)
    clientPack.BattleCount = min(255, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCount))
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return