hxp
2019-02-19 cda5e4e81f17542946ac53e77d2cd625ac2ea3d4
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -49,7 +49,6 @@
import PlayerLVAward
import PlayerGoldGift
import PlayerSignDay
import MixServerCampaign
import PlayerPet
import PlayerPrestigeSys
import PlayerFamily
@@ -65,7 +64,6 @@
import PlayerAttrFruit
import PlayerSuccess
import PlayerDienstgrad
import PlayerMixLoginDayAward
import PlayerFreeGoods
import PlayerRecover
import GameLogic_IceLode
@@ -79,6 +77,7 @@
import GameLogic_FamilyWar
import PlayerBossReborn
import PlayerWeekParty
import PlayerFeastWeekParty
import PlayerActLogin
import Operate_EquipWash
import PlayerTreasure
@@ -103,6 +102,8 @@
import PlayerSpringSale
import PlayerFairyCeremony
import PlayerNewFairyCeremony
import PlayerFeastRedPacket
import PlayerLuckyTreasure
import CrossRealmPlayer
import ChNetSendPack
import FamilyRobBoss
@@ -227,6 +228,45 @@
    
    return
#// A2 31 前端开始自定义场景 #tagCMClientStartCustomScene
#
#struct    tagCMClientStartCustomScene
#{
#    tagHead        Head;
#};
def OnClientStartCustomScene(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    DoEnterCustomScene(curPlayer)
    return
def DoEnterCustomScene(curPlayer):
    ## 进入自定义场景状态
    curPlayer.SetCanAttack(False)
    curPlayer.SetVisible(False)
    curPlayer.SetSight(0)
    curPet = curPlayer.GetPetMgr().GetFightPet()
    if curPet:
        curPet.SetVisible(False)
    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 1)
    GameWorld.Log("玩家开始自定义场景!", curPlayer.GetPlayerID())
    return
def DoExitCustomScene(curPlayer):
    ## 退出自定义场景状态
    curPlayer.SetCanAttack(True)
    curPlayer.SetVisible(True)
    curPlayer.SetSight(1)
    curPlayer.RefreshView()
    curPlayer.SetSight(ChConfig.Def_PlayerSight_Default)
    curPlayer.RefreshView()
    curPet = curPlayer.GetPetMgr().GetFightPet()
    if curPet:
        curPet.SetVisible(True)
    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 0)
    GameWorld.Log("玩家退出自定义场景!", curPlayer.GetPlayerID())
    return
#// A1 08 刷新主服角色信息 #tagCMRefreshMainServerRole
#
#struct tagCMRefreshMainServerRole
@@ -247,8 +287,16 @@
    playerControl = PlayerControl.PlayerControl(curPlayer)
    playerControl.ReCalcAllState()
    
    # 同步所有buff
    __Sync_ClientBuff(curPlayer)
    PlayerState.Sync_PKBossState(curPlayer)
    if PlayerControl.GetCrossMapID(curPlayer):
        CrossRealmPlayer.DoExitCrossRealm(curPlayer)
    if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
        DoExitCustomScene(curPlayer)
        
    msgInfo = ""
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetPlayerID(), 0, 0, "RefreshMainServerRole", msgInfo, len(msgInfo))
@@ -588,12 +636,6 @@
    # 开服活动奖励信息
    OpenServerCampaign.OnOpenServerCampaignLogin(curPlayer)
#    
#    # 通知合服奖励领取状态
#    PlayerMixLoginDayAward.OnLoginNotifyMixLoginDayAward(curPlayer)
#
#    # 通知合服奖励
#    MixServerCampaign.OnMixServerCampaignLogin(curPlayer)
#
#    # 节日登陆奖励
#    PlayerFestivalLogin.OnLoginFestivalLogin(curPlayer)
@@ -681,6 +723,7 @@
    PlayerRune.PlayerRuneLogin(curPlayer)
    # 仙盟红包登录通知
    PlayerFamilyRedPacket.OnPlayerLogin(curPlayer)
    PlayerFeastRedPacket.DoPlayerOnLogin(curPlayer)
    # 法宝登录通知
    PlayerMagicWeapon.PlayerMagicWeaponLogin(curPlayer)
    # 商店物品购买次数登录通知
@@ -708,6 +751,8 @@
    PlayerBossReborn.OnLogin(curPlayer)
    # 周狂欢活动
    PlayerWeekParty.OnLogin(curPlayer)
    # 节日巡礼活动
    PlayerFeastWeekParty.OnLogin(curPlayer)
    # 登录奖励活动
    PlayerActLogin.OnLogin(curPlayer)
    # 仙界盛典活动
@@ -726,6 +771,8 @@
    PlayerBindJadeWheel.OnLogin(curPlayer)
    # 许愿池
    PlayerWishingWell.OnLogin(curPlayer)
    #幸运鉴宝
    PlayerLuckyTreasure.OnLogin(curPlayer)
    # 上线查询一次充值订单
    curPlayer.SendDBQueryRecharge()
    # 小助手
@@ -769,37 +816,55 @@
    if not isMixServer:
        return
    
    lastMixServerDayKey = ShareDefine.Def_Notify_WorldKey_LastMixServerDay
    lastMixServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(lastMixServerDayKey)
    GameWorld.DebugLog("合服首登处理lastMixServerDay=%s" % lastMixServerDay, curPlayer.GetPlayerID())
    playerID = curPlayer.GetPlayerID()
    lastMixServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_LastMixServerDay)
    
    playerDay = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MixLoginDay)
    
    if playerDay == lastMixServerDay:
        GameWorld.DebugLog("本次合服已经登录过.")
        GameWorld.DebugLog("本次合服已经登录过. lastMixServerDay=%s" % (lastMixServerDay), playerID)
        return
    mixServerWorldLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_LastMixServerWorldLV) # 合服时的世界等级
    GameWorld.Log("玩家合服首登处理! lastMixServerDay=%s,mixServerWorldLV=%s" % (lastMixServerDay, mixServerWorldLV), playerID)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MixLoginDay, lastMixServerDay)
    
    # 重置首充双倍
    PlayerCoin.DoResetCTGCount(curPlayer, "MixServer")
    # 重置商店购买次数,暂定只重置类型 7 的
    FunctionNPCCommon.ResetShopItemBuyCount(curPlayer, [7])
    # 合服邮件,盟主专属邮件在GameServer处理
    mailItemList = IpyGameDataPY.GetFuncEvalCfg("MixServerMail", 1)
    worldLVMailItemList = IpyGameDataPY.GetFuncEvalCfg("MixServerMail", 2)
    mailMoneyList = IpyGameDataPY.GetFuncEvalCfg("MixServerMail", 3)
    goldPaper, silver = mailMoneyList
    worldLVItemList = []
    for itemID, itemCount, isBind in worldLVMailItemList:
        itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
        if not itemData:
            continue
        curEff = itemData.GetEffectByIndex(0)
        curEffID = curEff.GetEffectID()
        if curEffID != ChConfig.Def_Effect_ItemAddLV:
            continue
        lvLimit = curEff.GetEffectValue(1)
        if not lvLimit:
            continue
        if lvLimit <= mixServerWorldLV:
            worldLVItemList = [[itemID, itemCount, isBind]]
        else:
            break
    detailDict = {"MixServerWorldLV":mixServerWorldLV, "LastMixServerDay":lastMixServerDay}
    addItemList = mailItemList + worldLVItemList
    PlayerControl.SendMailByKey("MixServer1", [playerID], addItemList, goldPaper=goldPaper, silver=silver, detail=detailDict)
    GameWorld.Log("    发送合服补偿邮件: addItemList=%s" % (addItemList), playerID)
    # 同步排行榜
    PlayerBillboard.UpdBillboardOnMixServerFirstLogin(curPlayer, lastMixServerDay)
    # 其他
    # ...
    # 重置登录奖励领取状态
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MixLoginDayState, 0)
    PlayerMixLoginDayAward.NotifyPlayerAwardState(curPlayer)
    # 重置各合服活动数据
    for campaignType in ShareDefine.Def_MixCampaign_Type_List:
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MixServerCampaign_AwardRecord \
                                % campaignType, 0, ChConfig.Def_PDictType_OpenServerCampaign)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MixServerCampaign_RecordData \
                                % campaignType, 0, ChConfig.Def_PDictType_OpenServerCampaign)
    PlayerBillboard.UpdatePlayerBillboardOnLeaveServer(curPlayer, isAll=True)
    
    # 重置玩家改名次数
    UpdatePlayerName.ResetChangeNameCnt(curPlayer)
    #UpdatePlayerName.ResetChangeNameCnt(curPlayer)
    return
#---------------------------------------------------------------------
        
@@ -5167,81 +5232,6 @@
                                         'RequestIsFamily', sendMsg, len(sendMsg))
    return
#===============================================================================
#// AF 02 合服活动奖励 #tagCMMixCampaignAward
#
#struct    tagCMMixCampaignAward
#
#{
#    tagHead         Head;
#    BYTE        Type;    //0-查询;1-领取
#    DWORD        CampaignType;        //奖励类型
#    BYTE        Index;    //奖励位,领取时用
#};
#===============================================================================
## 合服活动奖励
#  @param index: 玩家索引
#  @param clientData: 封包结构体
#  @param tick: 时间戳
#  @return:
def GiveMixServerCampaignAward(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    campaignType = clientData.CampaignType
    queryType = clientData.Type
    awardIndex = clientData.Index # 奖励位
    GameWorld.DebugLog("GiveMixServerCampaignAward campaignType=%s,queryType=%s,awardIndex=%s"
                       % (campaignType, queryType, awardIndex))
    if queryType == ShareDefine.Def_MSCGameServerQuery_MailAward:
        GameWorld.DebugLog("    客户端不可发领取合服邮件奖励类型")
        return
    isMix = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_IsMixServer)
    if not isMix:
        GameWorld.ErrLog("    当前非合服状态!")
        return
    if campaignType not in ShareDefine.Def_MixCampaign_Type_List:
        GameWorld.ErrLog("    合服活动类型错误campaignType=%s error! not define" % campaignType)
        return
    # 如果直接在MapServer中处理,则返回
    if MixServerCampaign.DoMixServerCampaignOnMapServer(curPlayer, campaignType, queryType, awardIndex):
        return
    awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MixServerCampaign_AwardRecord \
                                % campaignType, 0, ChConfig.Def_PDictType_OpenServerCampaign)
    awardState = GameWorld.GetDataByDigitPlace(awardRecord, awardIndex)
    if awardState == MixServerCampaign.Def_AwardState_Got:
        if queryType == ShareDefine.Def_MSCGameServerQuery_QueryAward:
            recordData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MixServerCampaign_RecordData \
                                % campaignType, 0, ChConfig.Def_PDictType_OpenServerCampaign)
            MixServerCampaign.Sync_MixServerCampaignAward(curPlayer, campaignType, awardState, recordData)
        GameWorld.DebugLog("    已经领取过该奖励...")
        return
    #领奖的需要等待GameServer回包以后才处理下一个封包
    if queryType != ShareDefine.Def_MSCGameServerQuery_QueryAward:
        if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_QueryMixServerAwardState) == 1:
            GameWorld.DebugLog("    已经在查询中...")
            return
    curPlayer.SetDict(ChConfig.Def_PlayerKey_QueryMixServerAwardState, 1)
    familyID = curPlayer.GetFamilyID()
    #[请求类型, 活动类型, 领取索引, 家族ID]
    msgList = [queryType, campaignType, awardIndex, familyID]
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, 'MixServerCampaignAward', \
            '%s' % (msgList), len(str(msgList)))
    GameWorld.DebugLog("    msgList=%s" % str(msgList))
    return
#===============================================================================
## 领取奖励表奖励
@@ -5353,6 +5343,12 @@
    # 领取新仙界盛典全民来嗨
    elif rewardType == ChConfig.Def_RewardType_NewFairyCParty:
        PlayerNewFairyCeremony.GetFCPartyAward(curPlayer, dataEx)
    # 领取节日巡礼活动奖励
    elif rewardType == ChConfig.Def_RewardType_FeastWeekPartyAct:
        PlayerFeastWeekParty.GetFeastWeekPartyActionAward(curPlayer, dataEx, dataExStr)
    # 领取节日巡礼积分奖励
    elif rewardType == ChConfig.Def_RewardType_FeastWeekPartyPoint:
        PlayerFeastWeekParty.GetFeastWeekPartyPointAward(curPlayer, dataEx, dataExStr)
    return