ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSpringSale.py
@@ -36,57 +36,80 @@
    return todayShopType
def OnPlayerLogin(curPlayer):
    __CheckPlayerSpringSaleAction(curPlayer)
    for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_SpringSale, {}).values():
        actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
        __CheckPlayerSpringSaleAction(curPlayer, actNum)
    return
def RefreshSpringSaleActionInfo():
def RefreshSpringSaleActionInfo(actNum):
    ## 收到GameServer同步的活动信息,刷新活动信息
    playerManager = GameWorld.GetPlayerManager()
    for index in xrange(playerManager.GetPlayerCount()):
        curPlayer = playerManager.GetPlayerByIndex(index)
        if curPlayer.GetID() == 0:
            continue
        __CheckPlayerSpringSaleAction(curPlayer)
        __CheckPlayerSpringSaleAction(curPlayer, actNum)
    return
def __CheckPlayerSpringSaleAction(curPlayer):
def __CheckPlayerSpringSaleAction(curPlayer, actNum):
    ## 检查玩家限时特惠活动数据信息
    
    playerID = curPlayer.GetPlayerID()
    
    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_SpringSale, {})
    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_SpringSale, actNum)
    actID = actInfo.get(ShareDefine.ActKey_ID, 0)
    state = actInfo.get(ShareDefine.ActKey_State, 0)
    cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
    woldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
    playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SpringSaleID) # 玩家身上的活动ID
    playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SpringSaleID % actNum) # 玩家身上的活动ID
    isReset = False
    if actID != playerActID:
        isReset = True
        shopTypeList = GetShopTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0), woldLV)
        FunctionNPCCommon.ResetShopItemBuyCountByShopType(curPlayer, shopTypeList)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleID, actID)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleMailState, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleID % actNum, actID)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleMailState % actNum, 0)
        #Sync_SpringSaleActionInfo(curPlayer)
        GameWorld.DebugLog("限时特惠重置! actID=%s,playerActID=%s,state=%s,shopTypeList=%s" % (actID, playerActID, state, shopTypeList), playerID)
        GameWorld.DebugLog("限时特惠重置! actNum=%s,actID=%s,playerActID=%s,state=%s,shopTypeList=%s" % (actNum, actID, playerActID, state, shopTypeList), playerID)
    else:
        GameWorld.DebugLog("限时特惠活动ID不变,不处理!", playerID)
        GameWorld.DebugLog("限时特惠活动ID不变,不处理!actNum=%s,actID=%s" % (actNum, actID), playerID)
        
    playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SpringSaleMailState) # 玩家身上的活动提醒邮件状态
    playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SpringSaleMailState % actNum) # 玩家身上的活动提醒邮件状态
    if actID and state and state != playerMailState:
        springSaleIpyData = IpyGameDataPY.GetIpyGameData("ActSpringSale", cfgID)
        if springSaleIpyData and springSaleIpyData.GetMailKey() and curPlayer.GetLV() >= springSaleIpyData.GetLVLimit():
            PlayerControl.SendMailByKey(springSaleIpyData.GetMailKey(), [playerID], springSaleIpyData.GetMailItemPrize())
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleMailState, state)
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleMailState % actNum, state)
            GameWorld.DebugLog("    发送新限时特惠邮件提醒! state=%s,playerMailState=%s" % (state, playerMailState), playerID)
            
    if cfgID:
        Sync_SpringSaleActionInfo(curPlayer)
        Sync_SpringSaleActionInfo(curPlayer, actNum)
    return isReset
def Sync_SpringSaleActionInfo(curPlayer):
def IsSpringSaleShopType(shopType):
    ## 判断是否活动中的商店
    for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_SpringSale, {}).values():
        actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
        state = actInfo.get(ShareDefine.ActKey_State, 0)
        if not state:
            continue
        shopTypeList = GetShopTypeList(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0), actInfo.get(ShareDefine.ActKey_WorldLV, 0))
        if not shopTypeList:
            continue
        actShopType = shopTypeList[-1] if state > len(shopTypeList) else shopTypeList[state - 1]
        if shopType == actShopType:
            GameWorld.DebugLog("限时特惠活动中的商店类型: actNum=%s,shopType=%s" % (actNum, shopType))
            return True
    GameWorld.DebugLog("限时特惠非活动中或非活动中的商店类型!shopType=%s" % (shopType))
    return False
def Sync_SpringSaleActionInfo(curPlayer, actNum):
    ## 通知限时特惠活动信息
    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_SpringSale, {})
    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_SpringSale, actNum)
    if not actInfo:
        return
    
@@ -113,6 +136,7 @@
    job = curPlayer.GetJob()
    openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
    packInfo = ChPyNetSendPack.tagMCSpringSaleInfo()
    packInfo.ActNum = actNum
    packInfo.StartDate = GameWorld.GetOperationActionDateStr(springSaleIpyData.GetStartDate(), openServerDay)
    packInfo.EndtDate = GameWorld.GetOperationActionDateStr(springSaleIpyData.GetEndDate(), openServerDay)
    packInfo.AdvanceMinutes = springSaleIpyData.GetAdvanceMinutes()