| | |
| | | import GameWorld
|
| | | import ChConfig
|
| | | import PlayerControl
|
| | | import PlayerBillboard
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import PlayerViewCacheTube
|
| | |
| | | def DoPlayerOnDay(curPlayer):
|
| | | checkInInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HelpBattleCheckInCount)
|
| | | checkInCount = checkInInfo / 10 # 累计登记
|
| | | checkInInfo = (checkInCount + 1) * 10 + 0
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HelpBattleCheckInCount, checkInInfo)
|
| | | todayIsCheckIn = checkInInfo % 10 # 今天是否已登记
|
| | | if todayIsCheckIn:
|
| | | checkInInfo = (checkInCount + 1) * 10 + 0
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HelpBattleCheckInCount, checkInInfo)
|
| | | SyncCheckInState(curPlayer, 0, False)
|
| | | return
|
| | |
|
| | | def DoPlayerLogin(curPlayer):
|
| | | checkInInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HelpBattleCheckInCount)
|
| | | todayIsCheckIn = checkInInfo % 10 # 今天是否已登记
|
| | | if todayIsCheckIn:
|
| | | SyncCheckInState(curPlayer, 1, True)
|
| | | return
|
| | |
|
| | | def SyncCheckInState(curPlayer, checkInState, isLogin):
|
| | | ## 同步登记状态
|
| | | checkInPack = ChPyNetSendPack.tagMCHelpBattleCheckInResult()
|
| | | checkInPack.IsOK = checkInState
|
| | | checkInPack.IsLogin = int(isLogin)
|
| | | NetPackCommon.SendFakePack(curPlayer, checkInPack)
|
| | | return
|
| | |
|
| | | def GameServer_FBHelpBattleResult(curPlayer, msgList, tick):
|
| | |
| | | if not haveViewCache:
|
| | | PlayerViewCacheTube.UpdateGameServerPlayerCache(curPlayer, tick, False)
|
| | |
|
| | | checkInPack = ChPyNetSendPack.tagMCHelpBattleCheckInResult()
|
| | | checkInPack.IsOK = isOK
|
| | | NetPackCommon.SendFakePack(curPlayer, checkInPack)
|
| | | SyncCheckInState(curPlayer, 1, False)
|
| | |
|
| | | GameWorld.DebugLog("FBHelpBattleResult: %s,checkInCount=%s,fightPower=%s,isOK=%s,haveViewCache=%s"
|
| | | % (cmd, checkInCount, fightPower, isOK, haveViewCache), curPlayer.GetPlayerID())
|
| | |
| | | return
|
| | |
|
| | | def __OnHelpBattleRecord(curPlayer, msgList, tick):
|
| | | ## 助战记录同步
|
| | | cmd, helpRecordList = msgList
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("__OnHelpBattleRecord %s,helpRecordList=%s" % (cmd, helpRecordList), playerID)
|
| | |
| | | addXianyuanCoinTotalTotay = 0 # 累计需要增加的今日仙缘币
|
| | | drList = []
|
| | |
|
| | | totalHelpCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HelpBattleTotalCount)
|
| | | recordPack = ChPyNetSendPack.tagMCHelpBattleRecordList()
|
| | | recordPack.RecordList = []
|
| | | for recordInfo in helpRecordList:
|
| | |
| | | addXianyuanCoinTotal += xianyuanCoinAdd
|
| | | if isSameDay:
|
| | | addXianyuanCoinTotalTotay += xianyuanCoinAdd
|
| | | |
| | | totalHelpCount += 1
|
| | | |
| | | recordPack.RecordCount = len(recordPack.RecordList)
|
| | | NetPackCommon.SendFakePack(curPlayer, recordPack)
|
| | |
|
| | | addDataDict = {"HelpList":drList}
|
| | | GameWorld.DebugLog(" addXianyuanCoinTotal=%s,addXianyuanCoinTotalTotay=%s" % (addXianyuanCoinTotal, addXianyuanCoinTotalTotay), playerID)
|
| | | GameWorld.DebugLog(" addXianyuanCoinTotal=%s,addXianyuanCoinTotalTotay=%s,totalHelpCount=%s" |
| | | % (addXianyuanCoinTotal, addXianyuanCoinTotalTotay, totalHelpCount), playerID)
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_XianyuanCoin, addXianyuanCoinTotal, addDataDict=addDataDict, isSysHint=False)
|
| | | if addXianyuanCoinTotalTotay:
|
| | | PlayerControl.AddTodayXianyuanCoin(curPlayer, addXianyuanCoinTotalTotay)
|
| | | |
| | | |
| | | # 更新总助战次数,更新排行榜
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HelpBattleTotalCount, totalHelpCount)
|
| | | if totalHelpCount >= IpyGameDataPY.GetFuncCfg("HelpBattleRefresh", 4):
|
| | | PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_FBHelpBattle, totalHelpCount)
|
| | | return
|
| | |
|
| | | def DoSingleFBAddXianyuanCoin(curPlayer, mapID, lineID):
|
| | |
| | | coinAddReal = min(coinAdd, canAddMax) # 实际加仙缘币
|
| | |
|
| | | GameWorld.DebugLog("挑战单人副本增加仙缘币: coinAdd=%s,canAddMax=%s,coinAddReal=%s" % (coinAdd, canAddMax, coinAddReal), playerID)
|
| | | addDataDict = {"MapID":mapID, "FuncLineID":lineID}
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_XianyuanCoin, coinAddReal, addDataDict=addDataDict)
|
| | | PlayerControl.AddTodayXianyuanCoin(curPlayer, coinAddReal)
|
| | | if coinAddReal:
|
| | | addDataDict = {"MapID":mapID, "FuncLineID":lineID}
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_XianyuanCoin, coinAddReal, addDataDict=addDataDict)
|
| | | PlayerControl.AddTodayXianyuanCoin(curPlayer, coinAddReal)
|
| | | |
| | | # 通知自己获得仙缘币
|
| | | Sync_AddXianyuanCoinMsg(curPlayer, mapID, lineID, coinAddReal)
|
| | | return
|
| | |
|
| | | def DoTeamFBAddXianyuanCoin(curPlayer, mapID, lineID, callPlayerID, callPlayerName, relation):
|
| | | ## 挑战组队副本增加仙缘币
|
| | | return
|
| | |
|
| | |
|
| | | def Sync_AddXianyuanCoinMsg(curPlayer, mapID, funcLineID, addXianyuanCoin, callPlayerID=0, callPlayerName=""):
|
| | | '''同步自己主动战斗获得仙缘币信息
|
| | | 1. 主动发起通关镜像助战副本,此时 callPlayerID 及 name 为空
|
| | | 2. 参与通关真实助战的副本,次数如果自己是助战的,则 callPlayer 及 name 有值
|
| | | @param addXianyuanCoin: 增加的仙缘币,可能为0,代表已达本日上限,但是前端扔需要展示记录
|
| | | @param callPlayerID: 助战别人时,对方玩家的playerID
|
| | | @param callPlayerName: 助战别人时,对方玩家的名字 |
| | | '''
|
| | | msgPack = ChPyNetSendPack.tagMCAddXianyuanCoinMsg()
|
| | | msgPack.MapID = mapID
|
| | | msgPack.FuncLineID = funcLineID
|
| | | msgPack.XianyuanCoinAdd = addXianyuanCoin
|
| | | msgPack.CallPlayerID = callPlayerID
|
| | | msgPack.CallPlayerName = callPlayerName
|
| | | msgPack.NameLen = len(msgPack.CallPlayerName)
|
| | | NetPackCommon.SendFakePack(curPlayer, msgPack)
|
| | | return
|
| | |
|