#!/usr/bin/python
# -*- coding: GBK -*-
#
# @todo:
#
# @author: Alee
# @date 2017-12-1 ÏÂÎç01:37:09
# @version 1.0
#
# @note:
#
#---------------------------------------------------------------------
#µ¼Èë
import PlayerState
import IPY_GameWorld
import GameWorld
import PlayerControl
import GameMap
import ChConfig
import EventShell
import BuffSkill
import PlayerEventCounter
import PlayerTeam
import PlayerHorse
import PlayerTruck
import NPCCommon
import PlayerGameEvent
import SkillCommon
import FBLogic
import ChItem
import ItemCommon
import ItemControler
import ChEquip
import FunctionNPCCommon
import PlayerGMOper
import ReadChConfig
import PetControl
import OperControlManager
import ShareDefine
import PlayerAutoCheckOnline
import PlayerGameWallow
import NetPackCommon
import ChPyNetSendPack
import Operate_PlayerBuyZhenQi
import DataRecordPack
import PlayerBillboard
import UpdatePlayerName
import PlayerOnlinePrize
import PlayerLVAward
import PlayerGoldGift
import PlayerSignDay
import PlayerPet
import PlayerPrestigeSys
import PlayerFamily
import PlayerLoginDayAward
import PlayerGodWeapon
import PlayerWorldAverageLv
import PlayerGoldInvest
import PlayerActivity
import FBCommon
import PlayerBindJadeWheel
import BossHurtMng
import PlayerWishingWell
import PlayerAttrFruit
import PlayerSuccess
import PlayerDienstgrad
import PlayerFreeGoods
import PlayerRecover
import GameLogic_IceLode
import GameLogic_SkyTower
import PlayerEquipDecompose
import PlayerGreatMaster
import PlayerGatherSoul
import PlayerGatherTheSoul
import PlayerFairyDomain
import PlayerCrossRealmPK
import PlayerCrossChampionship
import PlayerCrossBattlefield
import GameFuncComm
import PlayerMagicWeapon
import GameLogic_FamilyBoss
import GameLogic_TrialTower
import GameLogic_FamilyWar
import PlayerBossReborn
import PlayerWeekParty
import PlayerFeastWeekParty
import PlayerFeastTravel
import PlayerFeastLogin
import PlayerFeastWish
import PlayerActLogin
import PlayerTreasure
import GameLogic_GodArea
import PlayerRune
import PlayerFamilyRedPacket
import IpyGameDataPY
import EventReport
import OpenServerCampaign
import PlayerVip
import PlayerRefineStove
import PassiveBuffEffMng
import PlayerDiceEx
import QuestCommon
import PlayerTJG
import GameLogic_XMZZ
import PlayerFlashSale
import PlayerFlashGiftbag
import PlayerDailyGiftbag
import PlayerCostRebate
import PlayerActBuyOne
import PlayerActGrowupBuy
import PlayerActCollectWords
import PlayerActTotalRecharge
import PlayerActRechargePrize
import PlayerActGarbageSorting
import PlayerActXianXiaMJ
import PlayerActGubao
import PlayerActHorsePetTrain
import PlayerActGodGift
import PlayerActFamilyCTGAssist
import PlayerActRechargeRebateGold
import PlayerActManyDayRecharge
import PlayerActSingleRecharge
import PlayerActHorsePetFeast
import PlayerActBossTrial
import PlayerSpringSale
import PlayerFairyCeremony
import PlayerNewFairyCeremony
import GY_Query_BossFirstKill
import PlayerCrossYaomoBoss
import PlayerFeastRedPacket
import PlayerLuckyCloudBuy
import PlayerLuckyTreasure
import Item_ResetAttrPoint
import CrossActCTGBillboard
import CrossActAllRecharge
import PlayerFuncSysPrivilege
import PlayerActTurntable
import PlayerTongTianLing
import CrossRealmPlayer
import ChNetSendPack
import FamilyRobBoss
import FBHelpBattle
import PlayerAssist
import PlayerArena
import PyGameData
import PlayerCoin
import PlayerGeTui
import PlayerCharm
import PlayerDogz
import PlayerCoat
import PlayerFB
import PlayerFaQi
import SkillShell
import PlayerGubao
import PlayerShentong
import PlayerCustomAward
import PlayerZhanling
import PlayerLianTi
import PlayerYinji
import PlayerLove
import GameObj
import PlayerChangeJob
import PlayerGuaji
import PlayerFace
import PlayerChatBox
import PlayerXiangong
import PlayerMineArea
import PlayerActLoginNew
import PlayerActBuyCountGift
import PlayerActLunhuidian
import PlayerActYunshi
import PlayerActTask
import datetime
import time
import math
import re
#---------------------------------------------------------------------
#---------------------------------------------------------------------
##C++µ÷Ó÷â°ü, µØͼ¿ªÆô³É¹¦, ³õʼ»¯ÐÅÏ¢
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks µØͼ¿ªÆô³É¹¦, ³õʼ»¯ÐÅÏ¢
def InitPlayer(tick):
return
#---------------------------------------------------------------------
##Íæ¼ÒµÇ½ÓÎÏ·³õʼ»¯
#@param curPlayer Íæ¼ÒʵÀý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Íæ¼ÒµÇ½ÓÎÏ·³õʼ»¯
def InitLoginPlayer(curPlayer, tick):
##³õʼ»¯½»Ò×Áбí
if curPlayer.GetTradeList().GetTradeItemCount() == 0:
curPlayer.GetTradeList().SetTradeListCount(ChConfig.Def_PlayerTradeMaxItemCount)
#³õʼ»¯Íæ¼ÒµÄʱÖÓ¸öÊý
if curPlayer.GetTickTypeCount() == 0:
curPlayer.SetTickTypeCount(ChConfig.TYPE_Player_Tick_Count)
#³õʼ»¯Íæ¼ÒÁÄÌìƵµÀ
if curPlayer.GetMaxChannelCount() == 0:
curPlayer.SetMaxChannelCount(ChConfig.Def_PlayerTalkChannelMaxCount)
#===============================================================================
# #³õʼ»¯Íæ¼Ò¼ø¶¨¹ÜÀíÆ÷ÎïÆ·×î´ó¸öÊý
# identifyItemManager = curPlayer.GetIdentifyManager()
#
# #ÉèÖÃ×î´óÊýÁ¿
# if identifyItemManager.GetCount() == 0:
# identifyItemManager.SetCount(ChConfig.TYPE_Player_identifyManagerCount)
#
# #³õʼ»¯±¦Ê¯ÍÚ³ý¹ÜÀíÆ÷×î´ó¸öÊý
# stoneBreakManager = curPlayer.GetStoneBreakManager()
#
# if stoneBreakManager.GetCount() == 0:
# stoneBreakManager.SetCount(ChConfig.TYPE_Player_StoneBreakManagerCount)
#===============================================================================
#³õʼ»¯ÎïÆ·
#ChItem.InitPlayerLoginItem(curPlayer, tick)
return
#---------------------------------------------------------------------
##C++·â°üGameServer_InitOK ´¦Àí
#@param curPlayer Íæ¼ÒʵÀý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ×Ô¶¨Ò庯Êý, C++·â°üGameServer_InitOK ´¦Àí
def OnAllServerInitOK(curPlayer, tick):
if FBLogic.PlayerLoginInFBCheck(curPlayer, tick):
#Íæ¼ÒÊǵÚÒ»´ÎµÇ¼, ²¢ÇÒÍæ¼ÒÐèÒªÌß»ØÔÀ´µØͼ
return
#--------------------------------֪ͨ¿Í»§¶ËÈÎÎñ-------------
#ÏÈ·¢ËÍËùÓÐÈÎÎñ, ÔÙË¢ÐÂÈÕÆÚ, ·ñÔò»áÓÐ2¸öÏàͬµÄÈÎÎñÔÚÍæ¼ÒÉíÉÏ
#°ÑÍæ¼Òµ±Ç°µÄËùÓÐÈÎÎñ·¢Ë͸ø¿Í»§¶Ë
#GameWorld.Log('EventShell.NotifyAllQuestDetail')
if not GameWorld.IsCrossServer():
EventShell.NotifyAllQuestDetail(curPlayer, True)
#Ë¢ÐÂÈËÎïÈÕÆÚ״̬
#GameWorld.Log('PlayerEventCounter.UpdatePlayerLoginTime')
PlayerEventCounter.UpdatePlayerLoginTime(curPlayer)
#2010/4/20 Õâ¸öʼþÔÚ EventResponse_OnLoginÖд¥·¢,ÕâÀïÖظ´´¥·¢ÁË
#GameWorld.Log('EventShell.PlayerGMEventTrig')
#EventShell.PlayerGMEventTrig(curPlayer)
#--------------------------------------------------------
return
##·ÇͬһÌì¶þ´ÎµÇ½
# @param curPlayer Íæ¼ÒʵÀý
# @return None
def NoteOtherDayLogin(curPlayer):
#¼Ç¼¹ý»òÕßδµÇ½¹ý ²»¼Ç¼
if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_OtherDayLogin) != 1:
return
logoffTimeStr = curPlayer.GetLogoffTime().strip()
loginTimeStr = curPlayer.GetLoginTime().strip()
#curTimeStr = GameWorld.GetCurrentDataTimeStr()
#·À·¶ÍⲿÂß¼´íÎ󣬻òÒì³£Çé¿ö
if logoffTimeStr in ['', '0'] or loginTimeStr in ['', '0']:
return
logoffTimeDate = GameWorld.GetDateTimeByStr(logoffTimeStr.split()[0], ChConfig.TYPE_Time_Format_Day)
#ͬһÌì²»¼Ç¼
if logoffTimeDate == GameWorld.GetDateTimeByStr(loginTimeStr.split()[0], ChConfig.TYPE_Time_Format_Day):
return
#GameWorld.Log("OtherDayLogin offtime = %s" % logoffTimeDate)
DataRecordPack.DR_OtherDayLogin(curPlayer.GetAccID(), curPlayer.GetIP(), curPlayer)
#±ê¼ÇΪÒѼǼ
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_OtherDayLogin, 2)
return
#// A1 20 »õ±Ò¶Ò»» #tagCMMoneyExchange
#
#struct tagCMMoneyExchange
#{
# tagHead Head;
# BYTE SrcMoneyType; // Ô´»õ±ÒÀàÐÍ
# BYTE TagMoneyType; // Ä¿±ê»õ±ÒÀàÐÍ
# DWORD ExchangeValue; // ¶Ò»»ÊýÁ¿£¨ÏûºÄÔ´»õ±ÒµÄÊýÁ¿£©
#};
def OnMoneyExchange(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
srcMoneyType = clientData.SrcMoneyType
tagMoneyType = clientData.TagMoneyType
exchangeValue = clientData.ExchangeValue
exchangeMoneyInfo = IpyGameDataPY.GetFuncEvalCfg("EqualValueMoney", 1, {})
if str(srcMoneyType) not in exchangeMoneyInfo:
return
exchangeInfo = exchangeMoneyInfo[str(srcMoneyType)]
if tagMoneyType != exchangeInfo[0]:
return
multiple = exchangeInfo[1]
if exchangeValue <= 0:
return
if not PlayerControl.PayMoney(curPlayer, srcMoneyType, exchangeValue, "MoneyExchange"):
return
tagMoneyAdd = exchangeValue * multiple
PlayerControl.GiveMoney(curPlayer, tagMoneyType, tagMoneyAdd, "MoneyExchange")
GameWorld.Log("»õ±Ò¶Ò»»: srcMoneyType=%s,exchangeValue=%s,tagMoneyType=%s,tagMoneyAdd=%s"
% (srcMoneyType, exchangeValue, tagMoneyType, tagMoneyAdd), curPlayer.GetPlayerID())
return
#// A1 21 תְҵ #tagCMChangeJob
#
#struct tagCMChangeJob
#{
# tagHead Head;
# BYTE TagJob;
#};
def OnChangeJob(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
PlayerChangeJob.DoChangeJob(curPlayer, curPlayer.GetJob(), clientData.TagJob)
return
#// A1 08 Ë¢ÐÂÖ÷·þ½ÇÉ«ÐÅÏ¢ #tagCMRefreshMainServerRole
#
#struct tagCMRefreshMainServerRole
#{
# tagHead Head;
#};
def OnRefreshMainServerRole(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
Sync_DBPlayer(curPlayer)
# ËÀÍö¸´»î
if GameObj.GetHP(curPlayer) <=0 or curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
PlayerRebornByType(curPlayer, ChConfig.rebornType_System, tick)
# Ç¿Ë¢Ò»´ÎÊôÐÔ£¬Ë¢Ö®Ç°ÖØÖû¹Ã»Í¬²½¹ýËùÓÐÊôÐÔ
curPlayer.SetDict(ChConfig.Def_PlayerKey_NotifyAllAttrState, 0)
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):
PlayerFB.DoExitCustomScene(curPlayer)
PetControl.DoLogic_PetLoadMapOK(curPlayer)
# »Ö¸´ÊÓÒ°£¬Ë¢ÐÂ×Ô¼ºµÄÊÓÒ°
curPlayer.SetVisible(True)
PlayerControl.SetSight(curPlayer, 0)
curPlayer.RefreshView()
PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default)
curPlayer.RefreshView()
msgInfo = ""
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetPlayerID(), 0, 0, "RefreshMainServerRole", msgInfo, len(msgInfo))
return
def Sync_DBPlayer(curPlayer):
## ͬ²½DBPlayerÐÅÏ¢£¬Í¬0102·â°ü
dbPlayer = ChPyNetSendPack.tagMCDBPlayer()
dbPlayer.AccID = curPlayer.GetAccID()
dbPlayer.PlayerID = curPlayer.GetPlayerID()
dbPlayer.PlayerName = curPlayer.GetPlayerName()
dbPlayer.AccState = curPlayer.GetAccState()
dbPlayer.GMLevel = curPlayer.GetGMLevel()
dbPlayer.Sex = curPlayer.GetSex()
dbPlayer.Job = curPlayer.GetJob()
dbPlayer.ReincarnationLv = curPlayer.GetReincarnationLv()
dbPlayer.LV = curPlayer.GetLV()
dbPlayer.LVEx = curPlayer.GetLVEx()
dbPlayer.LV2 = curPlayer.GetLV2()
dbPlayer.ExpPoint = curPlayer.GetExpPoint()
dbPlayer.TotalExp = curPlayer.GetTotalExp()
dbPlayer.Family = curPlayer.GetFamilyID()
dbPlayer.FamilyName = curPlayer.GetFamilyName()
dbPlayer.TeamHornor = curPlayer.GetTeamHornor()
dbPlayer.FamilyHornor = curPlayer.GetFamilyHornor()
dbPlayer.FamilyActiveValue = curPlayer.GetFamilyActiveValue()
dbPlayer.LastWeekFamilyActiveValue = curPlayer.GetLastWeekFamilyActiveValue()
dbPlayer.CountryHornor = curPlayer.GetCountryHornor()
dbPlayer.CountryLastWeekHornor = curPlayer.GetCountryLastWeekHornor()
dbPlayer.Mate = curPlayer.GetMate()
dbPlayer.Gold = curPlayer.GetGold()
dbPlayer.GoldPaper = curPlayer.GetGoldPaper()
dbPlayer.Silver = curPlayer.GetSilver()
dbPlayer.SilverPaper = curPlayer.GetSilverPaper()
dbPlayer.FightPoint = curPlayer.GetFightPoint()
dbPlayer.HappyPoint = curPlayer.GetHappyPoint()
dbPlayer.LineID = curPlayer.GetLineID()
dbPlayer.MapID = curPlayer.GetMapID() # Íæ¼ÒÉíÉ쵀 GetMapID ·µ»ØµÄ¾ÍÊÇ GetDataMapID
dbPlayer.PosX = curPlayer.GetPosX()
dbPlayer.PosY = curPlayer.GetPosY()
dbPlayer.RebornMapID = curPlayer.GetRebornMapID()
dbPlayer.RebornPosX = curPlayer.GetRebornPosX()
dbPlayer.RebornPosY = curPlayer.GetRebornPosY()
dbPlayer.State = curPlayer.GetState()
dbPlayer.HP = curPlayer.GetHP()
dbPlayer.HPEx = curPlayer.GetHPEx()
dbPlayer.XP = curPlayer.GetXP()
dbPlayer.HPRestoreSetting = curPlayer.GetHPRestoreSetting()
dbPlayer.MPRestoreSetting = curPlayer.GetMPRestoreSetting()
dbPlayer.FreePoint = curPlayer.GetFreePoint()
dbPlayer.FreeSkillPoint = curPlayer.GetFreeSkillPoint()
dbPlayer.BaseSTR = curPlayer.GetBaseSTR()
dbPlayer.BasePNE = curPlayer.GetBasePNE()
dbPlayer.BasePHY = curPlayer.GetBasePHY()
dbPlayer.BaseCON = curPlayer.GetBaseCON()
dbPlayer.STR = curPlayer.GetSTR()
dbPlayer.PNE = curPlayer.GetPNE()
dbPlayer.PHY = curPlayer.GetPHY()
dbPlayer.CON = curPlayer.GetCON()
#dbPlayer.Setting = curPlayer.GetSetting() # ûÓÐ
dbPlayer.PKValue = curPlayer.GetPKValue()
#dbPlayer.ActiveValue = curPlayer.GetActiveValue() # ûÓÐ
dbPlayer.BackpackLV = curPlayer.GetBackpackLV()
dbPlayer.WarehouseLV = curPlayer.GetWarehouseLV()
dbPlayer.TeamID = curPlayer.GetTeamID()
dbPlayer.UseGoldType = curPlayer.GetUseGoldType()
dbPlayer.UseSilverType = curPlayer.GetUseSilverType()
dbPlayer.AttackMode = curPlayer.GetAttackMode()
dbPlayer.LastWeekOnlineTime = curPlayer.GetLastWeekOnlineTime()
dbPlayer.FBID = curPlayer.GetClientLineID()
dbPlayer.FamilyLV = curPlayer.GetFamilyLV()
dbPlayer.FriendFavor = curPlayer.GetFriendFavor()
dbPlayer.Energy = curPlayer.GetEnergy()
dbPlayer.EquipShowSwitch = curPlayer.GetEquipShowSwitch()
dbPlayer.LuckValue = curPlayer.GetLuckValue()
dbPlayer.ExAttr1 = curPlayer.GetExAttr1()
dbPlayer.ExAttr2 = curPlayer.GetExAttr2()
dbPlayer.ExAttr3 = curPlayer.GetExAttr3()
dbPlayer.ExAttr4 = curPlayer.GetExAttr4()
dbPlayer.ExAttr5 = curPlayer.GetExAttr5()
dbPlayer.Faction = curPlayer.GetFaction()
dbPlayer.InfamyValue = curPlayer.GetInfamyValue()
dbPlayer.OfficialRank = curPlayer.GetOfficialRank()
dbPlayer.ChangeCoinPointTotal = curPlayer.GetChangeCoinPointTotal()
dbPlayer.VIPLv = curPlayer.GetVIPLv()
dbPlayer.VIPLvForPhone = curPlayer.GetVIPLvForPhone()
dbPlayer.ExAttr6 = curPlayer.GetExAttr6()
dbPlayer.ExAttr7 = curPlayer.GetExAttr7()
dbPlayer.ExAttr8 = curPlayer.GetExAttr8()
dbPlayer.ExAttr9 = curPlayer.GetExAttr9()
dbPlayer.ExAttr10 = curPlayer.GetExAttr10()
dbPlayer.ModelMark = curPlayer.GetModelMark()
dbPlayer.ExAttr11 = curPlayer.GetExAttr11()
dbPlayer.ExAttr12 = curPlayer.GetExAttr12()
dbPlayer.ExAttr13 = curPlayer.GetExAttr13()
dbPlayer.ExAttr14 = curPlayer.GetExAttr14()
dbPlayer.OperateInfo = curPlayer.GetOperateInfo()
dbPlayer.Operate = curPlayer.GetOperate()
dbPlayer.ServerID = curPlayer.GetServerID()
dbPlayer.ExAttr15 = curPlayer.GetExAttr15()
dbPlayer.ExAttr16 = curPlayer.GetExAttr16()
dbPlayer.ExAttr17 = curPlayer.GetExAttr17()
dbPlayer.ExAttr18 = curPlayer.GetExAttr18()
dbPlayer.ExAttr19 = curPlayer.GetExAttr19()
dbPlayer.ExAttr20 = curPlayer.GetExAttr20()
dbPlayer.Face = curPlayer.GetFace()
dbPlayer.FacePic = curPlayer.GetFacePic()
dbPlayer.RoleType = curPlayer.GetRoleType()
NetPackCommon.SendFakePack(curPlayer, dbPlayer)
return
#---------------------------------------------------------------------
'''
µÇ¼Á÷³Ì
MapServer
ChPlayer:def PlayerLogin(index, tick)
DoPlayerLogin
curPlayer.Sync_ClientPlayerLogin()
curPlayer.Sync_GameServer_MapID() #ͬ²½GameServer×Ô¼ºµÄµØͼID
curPlayer.BalanceServer_PlayerLoginInitOK()
GameServer
ChPlayer:def PlayerLoadMapState(index, tick) pack.GetLoadState()=0 ´ËʱµÄ LoadState Ϊ0
curPlayer.SetIsLoadMap(True) ÉèÖÃÔÚ¼ÓÔصØͼ
ChPlayer:def PlayerLogin(index, tick)
curPlayer.MapServer_InitOK() ֪ͨµØͼ×Ô¼ºOKÁË
MapServer
PlayerEventCounter:def GameServer_InitOK(index, tick)
curPlayer.SendToBServerServerInitOK() #֪ͨBServer×Ô¼ºOKÁË
ChPlayer:def OnAllServerInitOK(curPlayer, tick)
ChPlayer:def LoadMapOK(curPlayer, tick)
curPlayer.GameServer_SetLoadMapState(1) #֪ͨGameServerÇл»µØͼֹͣ
curPlayer.SetMapLoadOK(True)
curPlayer.SetInitOK(True)
curPlayer.EndLoadMap()
GameServer
ChPlayer:def PlayerLoadMapState(index, tick) pack.GetLoadState()=1 ´ËʱµÄ LoadState Ϊ1
PlayerLoginLoadMapOK
curPlayer.SetInitOK(True)
curPlayer.MapServer_GameServerRefreshOK() #֪ͨµØͼ·þÎñÆ÷Íæ¼Ò³õʼ»¯³É¹¦
curPlayer.SetIsLoadMap(False)
MapServer
GameServerRefresh:GameSever_PlayerInitOK curPlayer.GetGameServerInitOK()=0
curPlayer.SetGameServerInitOK(True)
ºóÐø²¹³äÁ÷³Ì
MapServer
ChPlayer:def DoPlayerRealLoginOK(curPlayer, tick)
Íæ¼ÒÕæÕýµÇ¼³É¹¦´¦Àí£¬ÓÃÓÚÌæ»» __DoPlayerLoginServer ÖеŦÄܵǼÂß¼
֪ͨGameServerµØͼ×îÖյǼ³É¹¦ÁË
GameServer
ChPlayer:def DoPlayerRealLoginOK(curPlayer, tick)
Íæ¼ÒÕæÕýµÇ¼³É¹¦´¦Àí£¬ÓÃÓÚÌæ»» __DoPlayerLoginServer ÖеŦÄܵǼÂß¼
'''
##Íæ¼ÒµÇ½ÓÎÏ·Âß¼´¦Àí
#@param curPlayer Íæ¼ÒʵÀý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Íæ¼ÒµÇ½ÓÎÏ·Âß¼´¦Àí
def DoPlayerLogin(curPlayer, tick):
#ÕâÀïÖ»×ö³õʼ»¯Âß¼
curPlayer.SetDict(ChConfig.Def_PlayerKey_LoadMapIsLogin, 1)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_RealLoginOK, 0) # ÿ´ÎµÇ¼ÖØÖÃ
#֪ͨʱ¼ä
Sync_PyServerDataTimeToClient(curPlayer)
Sync_OpenServerDay(curPlayer)
#֪ͨÍæ¼Ò»ù±¾ÐÅÏ¢
curPlayer.Sync_ClientPlayerLogin()
#ͬ²½GameServer×Ô¼ºµÄµØͼID
curPlayer.Sync_GameServer_MapID()
# ÆÁ±Î¿ç·þϹرպÍ×Ó·þÖظ´µÄÊý¾ÝµÄ·¢ËÍ pushsend½Ó¿Ú£¬ notifyallÕý³£·¢ËÍ
# £¡£¡£¡±ØÒª·¢Ë͵ÄÊý¾ÝҪעÒâλÖÃ
if GameWorld.IsCrossServer():
curPlayer.SetForbiddenSyncClientState(True)
__DoPlayerLoginServer(curPlayer, tick)
# ÆÁ±Î¿ç·þϹرպÍ×Ó·þÖظ´µÄÊý¾ÝµÄ·¢ËÍ pushsend½Ó¿Ú£¬ notifyallÕý³£·¢ËÍ
# £¡£¡£¡±ØÒª·¢Ë͵ÄÊý¾ÝҪעÒâλÖÃ
if GameWorld.IsCrossServer():
curPlayer.SetForbiddenSyncClientState(False)
PlayerControl.SetCrossMapID(curPlayer, curPlayer.GetMapID()) # ÒòΪÖ÷·þÉÏ´«Êý¾Ý֮ǰ¸ÃֵΪ0£¬ËùÒԵǼ¿ç·þºóÔÚ¿ç·þ·þÎñÆ÷ÒªÉèÖÃΪ¶ÔÓ¦µØͼ
#֪ͨÔËÐгɹ¦
curPlayer.BalanceServer_PlayerLoginInitOK()
return
def __DoPlayerLoginServer(curPlayer, tick):
''' Íæ¼ÒµÇ¼ÐèÒª´¦ÀíµÄÄÚÈÝ£¬±¾·þ¼°¿ç·þ·þÎñÆ÷·Ö¿ª
'''
#ÉèÖÃÉÏÏßʱ¼ä
curPlayer.SetLoginTime(GameWorld.GetCurrentDataTimeStr())
#³õʼ»¯Íæ¼Ò±³°ü
InitPlayerPack(curPlayer)
#֪ͨÍæ¼ÒÎïÆ·ÐÅÏ¢
__Sync_PackDetel(curPlayer)
if GameWorld.IsCrossServer():
SkillCommon.PlayerLoginMergeServerSkillLogic(curPlayer, tick)
# ÖØÖÃËùÓм¼ÄÜCD
DoPlayerLoginInMap(curPlayer, tick)
DataRecordPack.DR_PlayerLogin(curPlayer)
EventReport.WriteEvent_login(curPlayer)
#---Íæ¼ÒÉÏÏß, ³èÎïÂß¼´¦Àí---
PetControl.DoLogic_PetInfo_OnLogin(curPlayer, tick)
PlayerFamily.FamilyPlayerOnLoginCross(curPlayer)
PlayerTeam.OnPlayerLoginCrossServer(curPlayer)
return
leaveServerSecond = PlayerControl.GetPlayerLeaveServerSecond(curPlayer)
if leaveServerSecond > ChConfig.Def_PlayerOfflineProtectTime / 1000:
# ÀëÏß³¬¹ýÀëÏß±£»¤ÖØÖÃÇÐÏßÁÙʱ±£´æµÄÏà¹Ø¼Ç¼ֵ
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_PlayChangeLineID, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FuncChangeLineID, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HighChangeLineID, 0)
#GameWorld.DebugLog("ÀëÏß³¬¹ý10ÃëÖØÖÃÇÐÏßÁÙʱ±£´æµÄÏà¹Ø¼Ç¼ֵ!leaveServerSecond=%s" % leaveServerSecond, curPlayer.GetPlayerID())
# ÀëÏß¹ý¾Ã»Ö¸´Îª·Ç¿ç·þ״̬
if PlayerControl.GetCrossMapID(curPlayer):
PlayerControl.SetCrossMapID(curPlayer, 0)
SyncGuideState(curPlayer)
#ÉÏÏß¼ì²éÒ»´Î×°±¸ÊôÐÔ
ItemControler.OnPlayerLogin(curPlayer)
#¸üзþÎñÆ÷×éID
PlayerControl.UpdPlayerServerGroupID(curPlayer)
#ÉÏÏßѧϰ¼¼ÄÜ
SkillCommon.PlayerLoginCheckLearnSkill(curPlayer)
#ˢм¼ÄÜCD
SkillCommon.PlayerLoginUpdateSkillCD(curPlayer, tick)
#֪ͨÍæ¼Ò¼¼ÄÜÐÅÏ¢
__Sync_ClientSkill(curPlayer)
#Çå³ý¹ú¼Ò´ðÌâBuff
#PlayerExam.DoLogic_ExitExam(curPlayer, tick, needRefresh = False)
#Çå³ýVIPbuff
#BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_VIPExp_SkillTypeID, tick)
#֪ͨÍæ¼ÒµÄbuff
__Sync_ClientBuff(curPlayer)
#³õʼ»¯ÏÖʵʱ¼äÎïÆ·
InitRealityTimeItem(curPlayer, tick)
#---Ë¢ÐÂÁËÍæ¼ÒÊôÐÔ, µÇ½ֻˢÐÂÒ»´Î£¬ÆäËûµØ·½²»ÓÃË¢
DoPlayerLoginInMap(curPlayer, tick)
PlayerControl.SyncOnLineTimeTotal(curPlayer)
#PlayerControl.SyncOnLineTimeLastOpenPack(curPlayer, IPY_GameWorld.rptItem)
PlayerControl.SyncTrainRealmLV(curPlayer)
PlayerGodWeapon.OnLogin(curPlayer)
PlayerPrestigeSys.OnLogin(curPlayer)
#DataRecordPack.DR_PlayerLogin(curPlayer)
EventReport.WriteEvent_login(curPlayer)
# ºÏ·þÊ׵Ǵ¦Àí
__DoMixServerFirstLogin(curPlayer)
PlayerBillboard.BillboardOnLogin(curPlayer)
#·ÇͬһÌì¶þ´ÎµÇ½, Ó¦¸Ã·ÅÔڸú¯ÊýÖеÄSetLoginTimeÖ®ºó£¬EventResponse_OnEnter֮ǰ
NoteOtherDayLogin(curPlayer)
#ÉÏÏßʱ֪ͨÍÑ»ú¹Òʱ±»»÷ɱµÄÀëÏßʱ¼ä
__Sync_PlayerOffline(curPlayer, tick)
#Íæ¼ÒÀ©Õ¹ÐÅÏ¢
__SyncPlayerInfoEx(curPlayer)
#²¹¶¡°üÏÂÔؽ±Àø
GiveDownloadPatchAward(curPlayer)
#PKģʽ
SyncPKModel(curPlayer)
#×°±¸Ïà¹ØÐÅÏ¢
ChEquip.OnPlayerEquipLoginLogic(curPlayer)
#´óʦ
PlayerGreatMaster.MasterOnLogin(curPlayer)
# ÍÆËÍÌáÐÑ
PlayerGeTui.LoginNotifySetting(curPlayer)
#֪ͨVIP
PlayerVip.DoOnLogin(curPlayer, tick)
#֪ͨ·¨±¦¾«Á¶µÈ¼¶
PlayerRefineStove.DoOnLogin(curPlayer, tick)
#---Íæ¼ÒÉÏÏß, ³èÎïÂß¼´¦Àí---
PetControl.DoLogic_PetInfo_OnLogin(curPlayer, tick)
PlayerPet.OnPlayerPetLogin(curPlayer)
#ÒªÔÚSetCanMoveÖ®ºó×öÕâ¸öÊÂÇé, ·ñÔòOnEnter²»»á¿¨×¡Íæ¼Ò
EventShell.EventResponse_OnEnter(curPlayer)
EventShell.EventResponse_OnLogin(curPlayer)
#֪ͨ»·½±Àø¼Ç¼
EventShell.NotifyRunEndAward(curPlayer)
#֪ͨÍæ¼ÒÓв¹³¥¿ÉÒÔÁìÈ¡
#curPlayer.DataServer_GetExpiationCount()
#֪ͨÍæ¼ÒÓгèÎï²¹³¥¿ÉÒÔÁìÈ¡
#curPlayer.DataServer_GetPetExpiationCount()
#Íæ¼ÒÀëÏßÓʼþ֪ͨ
#curPlayer.DataServer_GetMailListReq()
#Çå¿ÕÍæ¼ÒÍòÄܱ³°üÖеÄÈÎÎñÎïÆ·
ItemControler.ClearPackEventItem(curPlayer, IPY_GameWorld.rptAnyWhere)
#PlayerLoginNotify(curPlayer, tick)
#·À³ÁÃÔ¼ÆËãÏÂÏßÀÛ»ýʱ¼ä
PlayerGameWallow.Calc_Wallow_OfflineTime(curPlayer, tick)
# ֪ͨµÈ¼¶½±ÀøÁìÈ¡¼Ç¼
PlayerLVAward.Sync_LVAwardGetRecordInfo(curPlayer)
PlayerCoin.OnLogin(curPlayer)
# Ê׳ä/ÌìÌìÊ׳ä/³äÖµºÀÀñ
PlayerGoldGift.OnLogin(curPlayer)
#֪ͨ¹ºÂò¹¦ÄÜÖи÷¹ºÂòÀàÐ͵ÄÒѹºÂòºÍ¿É¹ºÂò´ÎÊý
Operate_PlayerBuyZhenQi.DoPlayerLogin(curPlayer)
#
# #֪ͨ¹¦ÄÜÊ״δ¥·¢Çé¿ö
GameFuncComm.Sync_FuncOpenState(curPlayer)
#
# #֪ͨ¿Í»§¶ËÇ©µ½ÐÅÏ¢
PlayerSignDay.SignDayOnLogin(curPlayer)
#
# #֪ͨ¿Í»§¶ËïÚ³µAIģʽ
# PlayerTruck.Sync_TruckMode(curPlayer)
#֪ͨÍæ¼ÒËÀÍöʱ¼ä
PlayerControl.PlayerControl(curPlayer).NotifyPlayerDeadTime(curPlayer)
#ClearPlayerDeadInfo(curPlayer)
#³äÖµ»î¶¯Íæ¼ÒµÇÈë´¦Àí
#PlayerGoldAction.DoLogic_PlayerOnLogin(curPlayer)
# ֪ͨÍæ¼ÒÊÇ·ñ¿ÉÒԲμӼÒ×å»î¶¯
#PlayerFamily.SendClientForbidFamilyAction(curPlayer)
# Ìáʾ¹ó±ö¾ãÀÖ²¿ÐÅÏ¢
#PlayerVip.NoteVIPClubInfo(curPlayer)
#½ÇÉ«¸ÄÃû´ÎÊý
UpdatePlayerName.Sync_UpdatePlayerNameCount(curPlayer)
# ×øÆïÏà¹Ø֪ͨ
PlayerHorse.PlayerHorseLogin(curPlayer)
# ·¨Æ÷
PlayerFaQi.PlayerFaQiLogin(curPlayer)
# Á¶Ìå
PlayerLianTi.OnPlayerLogin(curPlayer)
PlayerTreasure.OnTreasureLogin(curPlayer)
# ֪ͨÀۼƵǽÀñ
PlayerLoginDayAward.OnLoginNotifyLoginDayAward(curPlayer)
# ¿ª·þ»î¶¯½±ÀøÐÅÏ¢
OpenServerCampaign.OnOpenServerCampaignLogin(curPlayer)
# ÊÔÁ¶Ö®Ëþ
GameLogic_TrialTower.OnFBPlayerLogin(curPlayer)
# ¹ÅÉñ½ûµØ
GameLogic_GodArea.GodAreaOnLogin(curPlayer)
# ²É¼¯NPC´ÎÊý֪ͨ
NPCCommon.SyncCollNPCTime(curPlayer)
# ÿÈÕ»îÔ¾¶È
PlayerActivity.OnLogin(curPlayer)
# ¸±±¾½øÈëʱ¼ä
FBCommon.FBOnLogin(curPlayer)
#ÊÀ½çµÈ¼¶
PlayerWorldAverageLv.OnLogin(curPlayer)
# Ͷ×ÊÀí²Æ
PlayerGoldInvest.OnLogin(curPlayer)
#ÊôÐÔ¹ûʵʹÓÃÇé¿ö
PlayerAttrFruit.AttrFruitOnLogin(curPlayer)
#³É¾Í
PlayerSuccess.SuccOnLogin(curPlayer)
#÷ÈÁ¦
PlayerCharm.OnPlayerLogin(curPlayer)
#ÇéÔµ
PlayerLove.DoPlayerLogin(curPlayer)
#ͬ²½×Ô¶¯Õ½¶·ÅäÖüǼ
# Sync_AutoFightSetting(curPlayer)
PlayerFamily.FamilyPlayerOnLogin(curPlayer, tick)
#¸Äµ½ GameServerRefresh GameSever_PlayerInitOKºó´¦Àí²ÅÄܱ£Ö¤Íæ¼ÒÒѾÔÚGameserver×¢²á
#PlayerDienstgrad.RefreshBillBoardDienstgrad(curPlayer)
# ³ÆºÅ
PlayerDienstgrad.Sync_AllDienstgradOnLogin(curPlayer)
# ×ÊÔ´ÕÒ»ØOnLogin
PlayerRecover.RecoverOnLogin(curPlayer)
# ʱװ
PlayerCoat.OnLogin_Coat(curPlayer)
# ¿ç·þPK
PlayerCrossRealmPK.DoPlayerLogin(curPlayer)
PlayerCrossChampionship.DoPlayerLogin(curPlayer)
PlayerCrossBattlefield.DoPlayerLogin(curPlayer)
# ÐÒÔËÔƹº
PlayerLuckyCloudBuy.OnPlayerLogin(curPlayer)
# ¾º¼¼³¡
PlayerArena.OnLogin(curPlayer)
# ×Ô¶¨Òå»õ±Òֵͬ²½
PlayerControl.NotifyPlayerAllCurrency(curPlayer)
PlayerControl.NotifyUseMoneyTotal(curPlayer)
#֪ͨ»ù´¡ÊôÐÔ
NotifyPlayerBasePoint(curPlayer)
#¿ç·þ³äÖµÅÅÐÐ
CrossActCTGBillboard.OnPlayerLogin(curPlayer)
#¿ç·þÈ«Ãñ³äÖµ
CrossActAllRecharge.OnPlayerLogin(curPlayer)
#Ïû·Ñ·µÀû
PlayerCostRebate.OnPlayerLogin(curPlayer)
#ÀۼƳäÖµ
PlayerActTotalRecharge.OnPlayerLogin(curPlayer)
#ÀۼƳäÖµ·µÀûÏÉÓñ
PlayerActRechargeRebateGold.OnPlayerLogin(curPlayer)
#³äÖµ·µÀû
PlayerActRechargePrize.OnPlayerLogin(curPlayer)
#³É³¤±ØÂò
PlayerActGrowupBuy.OnPlayerLogin(curPlayer)
#ÏÞʱÌØ»Ý
PlayerSpringSale.OnPlayerLogin(curPlayer)
#ÏÞʱÀñ°ü
PlayerFlashGiftbag.OnPlayerLogin(curPlayer)
#ÿÈÕÀñ°ü
PlayerDailyGiftbag.OnPlayerLogin(curPlayer)
#ÏÞʱÇÀ¹º
PlayerFlashSale.OnPlayerLogin(curPlayer)
#ÂòÒ»ËͶà»î¶¯
PlayerActBuyOne.OnPlayerLogin(curPlayer)
#ÏÉÃ˳äÖµ»¥Öú
PlayerActFamilyCTGAssist.OnPlayerLogin(curPlayer)
#¼¯×ֻ
PlayerActCollectWords.OnPlayerLogin(curPlayer)
# ÊÀ½çboss
BossHurtMng.OnLogin(curPlayer)
ChItem.Sync_ItemDayUseCnt(curPlayer)
# ÐüÉ͵Ǽ֪ͨ
#PlayerArrestTask.OnLogin(curPlayer)
# ·ûÓ¡µÇ¼֪ͨ
PlayerRune.PlayerRuneLogin(curPlayer)
# ÏÉÃ˺ì°üµÇ¼֪ͨ
PlayerFamilyRedPacket.OnPlayerLogin(curPlayer)
PlayerFeastRedPacket.DoPlayerOnLogin(curPlayer)
# ·¨±¦µÇ¼֪ͨ
PlayerMagicWeapon.PlayerMagicWeaponLogin(curPlayer)
# É̵êÎïÆ·¹ºÂò´ÎÊýµÇ¼֪ͨ
FunctionNPCCommon.ShopItemOnLogin(curPlayer)
# ֪ͨÉèÖõı»¶¯¹¦·¨
#PassiveBuffEffMng.OnLoginGFPassive(curPlayer)
#ÎÒҪ̫¼«
PlayerDiceEx.DiceExOnLogin(curPlayer)
# ¾çÇéÈÎÎñÍê³É״̬
QuestCommon.Sync_StoryMissionState(curPlayer)
#ÏÉħ֮Õù
GameLogic_XMZZ.OnXMZZLogin(curPlayer)
PlayerOnlinePrize.OnPlayerLogin(curPlayer)
#×°±¸·Ö½â
PlayerEquipDecompose.PlayerLogin(curPlayer)
#·À³ÁÃÔ
PlayerGameWallow.DoLogic_CheckWallow(curPlayer, tick)
# ֪ͨÍÑ»ú¹ÒÐÅÏ¢
#PlayerTJG.NotifyTJGInfo(curPlayer)
# ÐÖú
PlayerAssist.OnPlayerLogin(curPlayer)
# ¼«Æ·°×ÄÃ
PlayerFreeGoods.OnLogin(curPlayer)
# BOSS¸´»î»î¶¯
PlayerBossReborn.OnLogin(curPlayer)
# bossÀúÁ·
PlayerActBossTrial.OnPlayerLogin(curPlayer)
# Æï³èÊ¢Ñç»î¶¯
PlayerActHorsePetFeast.OnLogin(curPlayer)
# ÖÜ¿ñ»¶»î¶¯
PlayerWeekParty.OnLogin(curPlayer)
# ¹ºÂò´ÎÊýÀñ°ü»î¶¯
PlayerActBuyCountGift.OnPlayerLogin(curPlayer)
# ÈÎÎñ»î¶¯
PlayerActTask.OnPlayerLogin(curPlayer)
# ÔËÊƻ
PlayerActYunshi.OnPlayerLogin(curPlayer)
# Âֻصî»î¶¯
PlayerActLunhuidian.OnPlayerLogin(curPlayer)
# µÇ¼»î¶¯
PlayerActLoginNew.OnPlayerLogin(curPlayer)
# ½ÚÈÕѲÀñ»î¶¯
PlayerFeastWeekParty.OnLogin(curPlayer)
# ½ÚÈյǼ»î¶¯
PlayerFeastLogin.OnPlayerLogin(curPlayer)
# ½ÚÈÕ×£¸£»î¶¯
PlayerFeastWish.OnPlayerLogin(curPlayer)
# ½ÚÈÕÓÎÀú»î¶¯
PlayerFeastTravel.OnPlayerLogin(curPlayer)
# µÇ¼½±Àø»î¶¯
PlayerActLogin.OnLogin(curPlayer)
# À¬»ø·ÖÀà»î¶¯
PlayerActGarbageSorting.OnPlayerLogin(curPlayer)
# ÏÉÏ»Ãؾ³»î¶¯
PlayerActXianXiaMJ.OnPlayerLogin(curPlayer)
# ¹Å±¦Ñø³É»î¶¯
PlayerActGubao.OnPlayerLogin(curPlayer)
# Æï³èÑø³É»î¶¯
PlayerActHorsePetTrain.OnPlayerLogin(curPlayer)
# ÌìµÛÀñ°ü»î¶¯
PlayerActGodGift.OnPlayerLogin(curPlayer)
# ¶àÈÕÁ¬³ä»î¶¯
PlayerActManyDayRecharge.OnPlayerLogin(curPlayer)
# µ¥±ÊÀÛ³ä»î¶¯
PlayerActSingleRecharge.OnPlayerLogin(curPlayer)
# תÅ̻
PlayerActTurntable.OnPlayerLogin(curPlayer)
# ÏɽçÊ¢µä»î¶¯
PlayerFairyCeremony.OnLogin(curPlayer)
# ÐÂÏɽçÊ¢µä»î¶¯
PlayerNewFairyCeremony.OnLogin(curPlayer)
# ·ÖÖ§ÏÂÔؽ±Àø¼Ç¼֪ͨ
SyncPackDownloadAward(curPlayer)
# µÇ¼´¥·¢¹¦ÄÜ¿ªÆô£¨ÀϺŴ¦Àí£©
GameFuncComm.DoFuncOpenLogic(curPlayer)
# ÉñÊÞ
PlayerDogz.OnPlayerLogin(curPlayer)
# Æï³è
FamilyRobBoss.OnPlayerLogin(curPlayer)
# °óÓñתÅÌ
PlayerBindJadeWheel.OnLogin(curPlayer)
# ÐíÔ¸³Ø
PlayerWishingWell.OnLogin(curPlayer)
#ÐÒÔ˼ø±¦
PlayerLuckyTreasure.OnLogin(curPlayer)
# СÖúÊÖ
SyncLittleHelper(curPlayer)
# ¸±±¾ÖúÕ½
FBHelpBattle.DoPlayerLogin(curPlayer)
# ¾Û»ê
PlayerGatherSoul.PlayerLogin(curPlayer)
PlayerGatherTheSoul.OnPlayerLogin(curPlayer)
#çÎç¿ÏÉÓò
PlayerFairyDomain.OnLogin(curPlayer)
PlayerFB.OnLogin(curPlayer)
#¼¼ÄÜר¾«ÐÅÏ¢
SkillShell.NotifyElementSkillInfo(curPlayer)
#BossÊ×ɱ
GY_Query_BossFirstKill.OnPlayerLogin(curPlayer)
#ͨÌìÁî
PlayerTongTianLing.OnPlayerLogin(curPlayer)
#´´½Ç½±Àø
Sync_CreateRoleAwardInfo(curPlayer)
#×Ô¶¨Òå½±Àø
PlayerCustomAward.OnPlayerLogin(curPlayer)
#¹¦ÄÜϵͳÌØȨ
PlayerFuncSysPrivilege.OnPlayerLogin(curPlayer)
#Í淨ǰհ½±Àø
gameNoticeAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GameNoticeAwardState)
if gameNoticeAwardState:
Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_GameNotice, gameNoticeAwardState)
#ÿÈÕ·ÖÏí½±Àø
shareGameAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShareGameAwardState)
if shareGameAwardState:
Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_ShareGame, shareGameAwardState)
#ÓÎÏ·ºÃÆÀ½±Àø
goodGameAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoodGameAwardState)
if goodGameAwardState:
Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_GoodGame, goodGameAwardState)
#ÓÎÏ·µãÔÞ½±Àø
likeGameAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LikeGameAwardState)
if likeGameAwardState:
Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_LikeGame, likeGameAwardState)
#¿ª·þÿÈÕ½±Àø
awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OpenSererDailyAward)
if awardState:
Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_OpenServerDailyAward, awardState)
curPlayer.SetState(0) # ÍÑ»ú¹Ò»Ö¸´ÎªÕý³£ÉÏÏß
curPlayer.SetCountryLastWeekHornor(0) # ֪ͨÊý¾Ý¿âÊÇ·ñ±£´æ»¹ÊÇÏÂÏߣ¬×öÒ»´Î»Ö¸´£¬1Ϊ±£´æ 0ΪÕý³£ÏÂÏß
#tjgTime = PlayerTJG.GetTJGTime(curPlayer)
#if tjgTime:
# PlayerControl.SendGameServerRefreshState(curPlayer, IPY_GameWorld.CDBPlayerRefresh_HappyPoint, tjgTime)
PlayerControl.DoGMForbidenTalkOnLogin(curPlayer)
DataRecordPack.DR_PlayerLogin(curPlayer) # ·Å×îºó£¬¼Ç¼µÈ¼¶¡¢¾ÑéµÈÐÅÏ¢
return
def DoPlayerRealLoginOK(curPlayer, tick):
''' Íæ¼Ò×îÖյǼ³É¹¦´¦Àí£¬ ÓÉ GameServerRefresh GameSever_PlayerInitOK µ÷ÓÃ
¸Ãº¯ÊýΪµØͼ×îÖյǼ³É¹¦²Å»áÖ´Ðе½£¬ÒÔºóһЩ¹¦ÄÜÀàµÄµÇ¼´¦Àí½¨Òé¾ùдµ½ÕâÀï
¾ÉµÄ¹¦ÄÜÏȲ»¶¯( __DoPlayerLoginServer º¯ÊýÖеŦÄÜ)£¬Èç¹ûÓеǼÏà¹ØµÄbugÔÙ¿¼ÂÇÊÇ·ñÒƶ¯µ½´Ëº¯Êý
'''
if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RealLoginOK):
#ÇеØͼµÄ²»´¦Àí£¬ÇеØͼµÄÒ²»á´¥·¢¸Ãº¯Êý
return
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_RealLoginOK, 1)
GameWorld.Log("MapServer->DoPlayerRealLoginOK", curPlayer.GetPlayerID())
if GameWorld.IsCrossServer():
pass
else:
PlayerChatBox.OnPlayerLogin(curPlayer)
PlayerFace.OnPlayerLogin(curPlayer)
PlayerXiangong.OnPlayerLogin(curPlayer)
PlayerGubao.OnPlayerLogin(curPlayer)
PlayerShentong.OnPlayerLogin(curPlayer)
PlayerZhanling.OnPlayerLogin(curPlayer)
PlayerMineArea.OnPlayerLogin(curPlayer)
PlayerGuaji.OnPlayerLogin(curPlayer)
# ÉÏÏß²éѯһ´Î³äÖµ¶©µ¥
curPlayer.SendDBQueryRecharge()
# ֪ͨGameServerµØͼ×îÖյǼ³É¹¦ÁË
isMixServerFirstLogin = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MixServerFirstLogin)
msg = str([isMixServerFirstLogin])
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, "PlayerRealLoginOK", msg, len(msg))
return
## Íæ¼ÒÀ©Õ¹ÐÅϢͬ²½
# @param curPlayer
# @return None
def __SyncPlayerInfoEx(curPlayer):
playerInfoEx = ChPyNetSendPack.tagMCPlayerInfo()
playerInfoEx.Clear()
playerInfoEx.IsAdult = curPlayer.IsAdult()
playerInfoEx.CreateRoleTime = curPlayer.GetCreateRoleTime()
NetPackCommon.SendFakePack(curPlayer, playerInfoEx)
return
## ºÏ·þÊ׵Ǵ¦Àí
# @param curPlayer
# @return None
def __DoMixServerFirstLogin(curPlayer):
isMixServer = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_IsMixServer)
if not isMixServer:
return
playerID = curPlayer.GetPlayerID()
lastMixServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_LastMixServerDay)
playerDay = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MixLoginDay)
if playerDay == lastMixServerDay:
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)
if curPlayer.GetLV() <= 1:
GameWorld.Log(" кŲ»¸øºÏ·þ½±Àø!", playerID)
return
curPlayer.SetDict(ChConfig.Def_PlayerKey_MixServerFirstLogin, 1)
# ÖØÖÃÊ׳äË«±¶
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)
worldLVDown = IpyGameDataPY.GetFuncCfg("MixServerMail", 5) # µÈ¼¶µ¤Ïà¶ÔºÏ·þÊÀ½çµÈ¼¶²îÖµ
itemWorldLV = max(150, mixServerWorldLV - worldLVDown)
gold, 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 <= itemWorldLV:
worldLVItemList = [[itemID, itemCount, isBind]]
else:
break
detailDict = {"MixServerWorldLV":mixServerWorldLV, "LastMixServerDay":lastMixServerDay, "ItemWorldLV":itemWorldLV}
addItemList = mailItemList + worldLVItemList
GameWorld.Log(" ·¢ËͺϷþ²¹³¥Óʼþ: itemWorldLV=%s,addItemList=%s" % (itemWorldLV, addItemList), playerID)
PlayerControl.SendMailByKey("MixServer1", [playerID], addItemList, gold=gold, silver=silver, detail=detailDict)
# ͬ²½ÅÅÐаñ
PlayerBillboard.UpdatePlayerBillboardOnLeaveServer(curPlayer, isAll=True)
# ÌìÐÇËþÈ«·þ¹ý¹Ø¼Ç¼
GameLogic_SkyTower.OnMixFirstLogin(curPlayer)
# bossƾ֤
PlayerActBossTrial.OnMixFirstLogin(curPlayer)
# ÏÉÏ»Ãؾ³
PlayerActXianXiaMJ.OnMixFirstLogin(curPlayer)
# ¹Å±¦Ñø³É
PlayerActGubao.OnMixFirstLogin(curPlayer)
# Æï³èÑø³É
PlayerActHorsePetTrain.OnMixFirstLogin(curPlayer)
# ÖØÖÃÍæ¼Ò¸ÄÃû´ÎÊý
#UpdatePlayerName.ResetChangeNameCnt(curPlayer)
return
#---------------------------------------------------------------------
##Çå³ýÍæ¼ÒËÀÍöÐÅÏ¢
# @param curPlayer Ö÷½Ç
# @return None
def ClearPlayerDeadInfo(curPlayer):
#¼Ç¼µ±Ç°ËÀÍö´ÎÊý£¬Ê±¼ä
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_PlayerDeadCnt, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_DeadTime, 0)
return
##Íæ¼ÒµÇ½, Ïà¹Ø»î¶¯Í¨Öª
#@param curPlayer Íæ¼ÒʵÀý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Íæ¼ÒµÇ½, Ïà¹Ø»î¶¯Í¨Öª
def PlayerLoginNotify(curPlayer, tick):
curTime = GameWorld.GetCurrentTime()
#¶ÁÈ¡ÉÏÏßÌáʾ±í
notifyByTimeSect = ReadChConfig.GetEvalChConfig('PlayerLoginNotify_TimeSect') #ijʱ¼ä¶ÎÄÚÉÏÏßÌáʾ
notifyByDict = ReadChConfig.GetEvalChConfig('PlayerLoginNotify_Dict') #¸ù¾Ý×ÖµäÖµ¸øÌáʾ
#Ôڹ涨ʱ¼ä¶ÎÄÚÉÏÏ߸øÌáʾ
DoNotifyByTimeSect(curPlayer, curTime, notifyByTimeSect)
#Ö¸¶¨×ÖµäÖµÄÚÌáʾ
DoNotifyByDict(curPlayer, notifyByDict)
return
#---------------------------------------------------------------------
##Ôڻ¹æ¶¨Ê±¼ä¶ÎÄÚÉÏÏ߸øÌáʾ
#@param curPlayer Íæ¼ÒË÷Òý
#@param curTime ´«Èëʱ¼ä
#@param notifyInfo ÌáʾÐÅÏ¢
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Ôڻ¹æ¶¨Ê±¼ä¶ÎÄÚÉÏÏ߸øÌáʾ
def DoNotifyByTimeSect(curPlayer, curTime, notifyInfo):
for curNotify in notifyInfo:
#ÓÐʱ¼ä¶ÎÏÞÖÆ£¬Ñé֤ʱ¼ä¶Î
if not GameWorld.IsAtActTime(curTime, curNotify[0]):
continue
PlayerControl.NotifyCode(curPlayer, curNotify[1], curNotify[2])
#---------------------------------------------------------------------
##Ö¸¶¨×ÖµäÖµÄÚÌáʾ
#@param curPlayer Íæ¼ÒʵÀý
#@param notifyInfo ÌáʾÐÅÏ¢
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Ö¸¶¨×ÖµäÖµÄÚÌáʾ
def DoNotifyByDict(curPlayer, notifyInfo):
gameWorld = GameWorld.GetGameWorld()
for curNotify in notifyInfo:
if gameWorld.GetGameWorldDictByKey(curNotify[0]) in curNotify[1]:
PlayerControl.NotifyCode(curPlayer, curNotify[2], curNotify[3])
#---------------------------------------------------------------------
##֪ͨ±³°üÏêϸÐÅÏ¢
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ֪ͨ±³°üÏêϸÐÅÏ¢
def __Sync_PackDetel(curPlayer):
itemManager = curPlayer.GetItemManager()
for packIndex in ChConfig.Def_PlayerLoginInitPackIndexList:
rolePack = itemManager.GetPack(packIndex)
rolePack.Sync_Refresh()
# Ë¢ÏÂ×°±¸ÆÀ·Ö£¬²Ö¿â¿ÉÒÔÔݲ»´¦Àí£¬È¡³ö×°±¸ºóµÇ¼´¥·¢Ë¢ÐÂ
for i in xrange(rolePack.GetCount()):
curItem = rolePack.GetAt(i)
if curItem.IsEmpty():
continue
newScore = ItemCommon.CalcEquipGS(curItem)
hisScore = ItemCommon.GetEquipGearScore(curItem)
if hisScore != newScore:
ItemCommon.SetEquipGearScore(curItem, newScore)
GameWorld.Log("µÇ¼¸üÐÂ×°±¸ÆÀ·Ö: packType=%s,i=%s,hisScore=%s,newScore=%s,itemID=%s,guid=%s"
% (packIndex, i, hisScore, newScore, curItem.GetItemTypeID(), curItem.GetGUID()), curPlayer.GetPlayerID())
for packIndex in ChConfig.Def_VPackCnt_Dict.keys():
ItemControler.Sync_VPackItem_Refresh(curPlayer, packIndex)
#===============================================================================
#
# itemManager.GetPack(IPY_GameWorld.rptEquip).Sync_Refresh()
# itemManager.GetPack(IPY_GameWorld.rptItem).Sync_Refresh()
# itemManager.GetPack(IPY_GameWorld.rptRecycle).Sync_Refresh()
# itemManager.GetPack(IPY_GameWorld.rptTitle).Sync_Refresh()
# #itemManager.GetPack(IPY_GameWorld.rptInvestiture).Sync_Refresh()
# itemManager.GetPack(IPY_GameWorld.rptHorse).Sync_Refresh()
# itemManager.GetPack(IPY_GameWorld.rptAnyWhere).Sync_Refresh()
# #itemManager.GetPack(IPY_GameWorld.rptFabao).Sync_Refresh()
# #itemManager.GetPack(IPY_GameWorld.rptHorseEquip).Sync_Refresh()
# #ʱװ±³°ü
# itemManager.GetPack(IPY_GameWorld.rptCabinetWeaponCoat).Sync_Refresh()
# itemManager.GetPack(IPY_GameWorld.rptCabinetHorse).Sync_Refresh()
# itemManager.GetPack(IPY_GameWorld.rptCabinetDressCoat).Sync_Refresh()
# #³èÎï´¢Îï¹ñ
# itemManager.GetPack(IPY_GameWorld.rptPetCabinetPet).Sync_Refresh()
# #´òÔì±³°ü(Òò´òÔì¸ÄΪԶ³Ì´òÔì,ÐèÒªÉÏÏß֪ͨ±³°üÄÚÈÝ)
# itemManager.GetPack(IPY_GameWorld.rptCompose).Sync_Refresh()
# itemManager.GetPack(IPY_GameWorld.rptResult).Sync_Refresh()
#
# itemManager.GetPack(IPY_GameWorld.rptJewelMerge).Sync_Refresh()
# itemManager.GetPack(IPY_GameWorld.rptJewelMergeResult).Sync_Refresh()
# itemManager.GetPack(IPY_GameWorld.rptFineSoulSlot).Sync_Refresh()
# #itemManager.GetPack(IPY_GameWorld.rptBreakPrepare).Sync_Refresh()
# #itemManager.GetPack(IPY_GameWorld.rptBreakItem).Sync_Refresh()
#===============================================================================
return
#---------------------------------------------------------------------
##³õʼ»¯ÏÖʵʱ¼äÎïÆ·
#@param curPlayer Íæ¼ÒʵÀý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ³õʼ»¯ÏÖʵʱ¼äÎïÆ·
def InitRealityTimeItem(curPlayer, tick):
PlayerState.ProcessTimeEquip(curPlayer, tick)
return
#---------------------------------------------------------------------
##֪ͨÍæ¼Ò¼¼ÄÜÐÅÏ¢
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ֪ͨÍæ¼Ò¼¼ÄÜÐÅÏ¢
def __Sync_ClientSkill(curPlayer):
sendPack = ChPyNetSendPack.tagMCPlayerSkills()
sendPack.Clear()
sendPack.Skills = []
skillManager = curPlayer.GetSkillManager()
for i in range(skillManager.GetSkillCount()):
curSkill = skillManager.GetSkillByIndex(i)
#curSkill.Sync_Skill()
skillInfo = ChPyNetSendPack.tagPlayerSkill()
skillInfo.SkillID = curSkill.GetSkillID()
skillInfo.RemainTime = curSkill.GetRemainTime()
skillInfo.Proficiency = curSkill.GetProficiency()
sendPack.Skills.append(skillInfo)
sendPack.Count = len(sendPack.Skills)
NetPackCommon.SendFakePack(curPlayer, sendPack)
return
#---------------------------------------------------------------------
##֪ͨÍæ¼ÒbuffÐÅÏ¢
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ֪ͨÍæ¼ÒbuffÐÅÏ¢
def __Sync_ClientBuff(curPlayer):
curPlayer.GetBuffState().Sync_Buff()
curPlayer.GetDeBuffState().Sync_Buff()
curPlayer.GetAura().Sync_Buff()
curPlayer.GetIncBuff().Sync_Buff()
curPlayer.GetProcessBuffState().Sync_Buff()
curPlayer.GetProcessDeBuffState().Sync_Buff()
#---------------------------------------------------------------------
##ÉÏÏßʱ֪ͨÀëÏßʱ¼ä£¨ÀëÏß¹Ò»ú¹¦ÄÜ£©
# @param curPlayer Íæ¼ÒʵÀý
# @param tick ʱ¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ÉÏÏßʱ֪ͨÀëÏßʱ¼ä£¨ÀëÏß¹Ò»ú¹¦ÄÜ£©
def __Sync_PlayerOffline(curPlayer, tick):
#---µÈ¼¶ÏÞÖÆ---
if GameWorld.IsCrossServer():
return
#PlayerTJG.TJGDeadOffline(curPlayer)
#===============================================================================
# #---µÈ¼¶ÏÞÖÆ---
# lvLimit = ReadChConfig.GetEvalChConfig('OfflineSys_LVLimit')
# if curPlayer.GetLV() < lvLimit:
# return
#
# if GameWorld.IsCrossServer():
# return
#
# #µ±Ç°ÀëÏßʱ¼ä£¨·Ö£©
# curOfflineMinutes = min(PlayerControl.GetPlayerLeaveServerMinute(curPlayer),
# ChConfig.Def_UpperLimit_DWord)
#
# #·ÀÖ¹·þÎñÆ÷ʱ¼äÐ޸ĵ½¹ýÈ¥µÃµ½¸ºÖµ
# if curOfflineMinutes < 0:
# GameWorld.ErrLog("Login Time Error, outTime: %s - loginTime :%s" %
# (curPlayer.GetLogoffTime(), GameWorld.GetCurrentDataTimeStr()),
# curPlayer.GetPlayerID())
# curOfflineMinutes = 0
#
# #ʱ¼äΪ·ÖÖÓ
# minTimeLimit, maxTimeLimit = ReadChConfig.GetEvalChConfig("OfflineSys_AllTimeUpperLimit")
# if curOfflineMinutes >= minTimeLimit:
# #×ÜÀëÏßʱ¼ä£¨·Ö£©
# allOfflineMinutes = min(curPlayer.GetOfflineMinutes() + curOfflineMinutes, maxTimeLimit)
# #¼Ç¼ÀëÏß×Üʱ¼ä
# curPlayer.SetOfflineMinutes(int(allOfflineMinutes))
# GameWorld.DebugLog("ÉèÖÃÀëÏß½±Àøʱ¼ä %s,curOfflineMinutes=%s" % (allOfflineMinutes, curOfflineMinutes), curPlayer.GetPlayerID())
# else:
# GameWorld.DebugLog("ÀëÏßʱ¼ä¹ý¶Ì,²»¼ÆÈëÀëÏß½±Àø!curOfflineMinutes=%s" % curOfflineMinutes, curPlayer.GetPlayerID())
#
# #֪ͨ¿Í»§¶ËÀëÏßʱ¼ä
# # curPlayer.Syn_OfflineTimeRefresh(int(curOfflineMinutes))
# curPlayer.Syn_OfflineTimeQueryResult()
#===============================================================================
return
#---------------------------------------------------------------------
##Íæ¼ÒÔÚµØͼ·þÎñÆ÷ÖеǼok,³õʼ»¯×Ô¼º
#@param curPlayer Íæ¼ÒʵÀý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Íæ¼ÒÔÚµØͼ·þÎñÆ÷ÖеǼok,³õʼ»¯×Ô¼º
def DoPlayerLoginInMap(curPlayer, tick):
#֪ͨGameServerÇл»µØͼ¿ªÊ¼
curPlayer.GameServer_SetLoadMapState(0)
#ÔÚÍæ¼ÒÇл»³¡¾°µÄʱºò, ²»»áµ÷Óõ½ÕâÀï
curPlayer.SetCanMove(False)
curPlayer.SetInitOK(False)
#Íæ¼ÒµÇ¼³É¹¦
curPlayer.SetMapLoadOK(False)
curPlayer.SetVisible(False)
curPlayer.SetCanAttack(False)
#Í˳öµöÓãÇå³ýÓæ·ò×°
if curPlayer.GetPlayerAction() == IPY_GameWorld.paGameEvent:
PlayerGameEvent.StopGameEvent(curPlayer, tick)
else:
PlayerGameEvent.TakeoffFishermanEquipment(curPlayer)
#ÇеØͼҪÇå³ýµÄbuff
__CheckClearBuffOnMapChange(curPlayer, tick)
if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
#¸±±¾µØͼÉÏÏßÇл»²Å¼ÓÎÞµÐbuff
SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer, ChConfig.Def_SkillID_LimitSuperBuff, tick)
#Ë¢ÐÂÍæ¼ÒµÄÊÓÒ°
if not GameWorld.IsCrossServer() and (PlayerControl.GetCrossMapID(curPlayer) or PlayerControl.GetCustomMapID(curPlayer)):
GameWorld.DebugLog("===µÇ¼±¾·þµØͼʱ£¬´¦ÓÚ¿ç·þ»ò×Ô¶¨Ò峡¾°×´Ì¬£¬²»Ë¢ÐÂÊÓÒ°!", curPlayer.GetPlayerID())
PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
elif not GameWorld.IsCrossServer():
realmDifficulty = PlayerControl.GetMapRealmDifficulty(curPlayer)
if realmDifficulty:
GameWorld.DebugLog("===µÇ¼±¾·þµØͼʱ£¬´¦ÓÚ¾³½çÄѶȵØͼ£¬×Ô¶¯ÉèÖÃÄѶÈ! realmDifficulty=%s" % realmDifficulty, curPlayer.GetPlayerID())
PlayerControl.SetRealmDifficulty(curPlayer, realmDifficulty)
PlayerState.ChangePlayerSigh(curPlayer, tick)
if GameWorld.IsCrossServer():
curPlayer.SetForbiddenSyncClientState(False)
playerControl = PlayerControl.PlayerControl(curPlayer)
#Ë¢ÐÂËùÓÐ״̬
playerControl.ReCalcAllState()
if GameWorld.IsCrossServer():
curPlayer.SetForbiddenSyncClientState(True)
#Ë¢ÐÂÒÑ·ÖÖÓµ¥Î»ÏûºÄµÄÎïÆ·(²»ÈÃÍæ¼ÒÒ»ÉÏÏ߾͵ôÄ;Ã)
curPlayer.SetProcessEquipDurgTick(tick)
#³õʼ»¯Íæ¼Òµ±Ç°ÉÏÏßʱ¼ä
curPlayer.SetLoginTick(tick)
#µÇ¼ÐµØͼ£¬ÖØÖüÆËãÔÚÏßʱ³¤tick
curPlayer.SetDict(ChConfig.Def_PlayerKey_CalcOLTimeTick, tick)
#³õʼ»¯Íæ¼ÒµÄÖØÉúµã
PlayerControl.RefreshRebornPoint(curPlayer, tick)
#Ç¿ÖƼǼÍæ¼ÒµÄһЩÐÅÏ¢
SavePlayerMessionInDataServer(curPlayer)
#¼ì²é¸üÐÂ×ÜÕ½¶·Á¦
#PlayerBillboard.UpdatePlayerFPTotalBillboard(curPlayer, True)
EventReport.WriteEvent_FightPower(curPlayer)
#Çå³ýÔÚ±¾µØͼÀëÏ߼ǼÐÅÏ¢
PlayerControl.RemoveLeaveServerPlayerInfo(curPlayer.GetPlayerID())
PyGameData.g_needRefreshMapServerState = True # ÓÐÍæ¼ÒµÇ¼µØͼʱÉèÖÃÐèҪˢÐÂ
return
##¼ì²éÇеØͼÇå³ý¸±±¾ÌØÊâbuff
#@param curPlayer Íæ¼ÒʵÀý
#@return
def __CheckClearBuffOnMapChange(curPlayer, tick):
curMapID = GameWorld.GetMap().GetMapID()
fbBuffDict = ReadChConfig.GetEvalChConfig("FBBuff")
buffIDList = []
for buffID, mapIDList in fbBuffDict.items():
# ²»ÊǸõØͼµÄbuffÇå³ý
if not mapIDList or curMapID not in mapIDList:
if BuffSkill.DelBuffBySkillID(curPlayer, buffID, tick):
GameWorld.DebugLog("ÇеØͼɾ³ý¶àÓàbuff: %s" % buffID)
buffIDList.append(buffID)
# Çл»µØͼ²»»á´øBUFFeffect£¬ReCalcAllStateͳһ´¦Àí
for buffID in ChConfig.ClearBuffOnMapChangeList:
BuffSkill.DelBuffBySkillID(curPlayer, buffID, tick)
return
#---------------------------------------------------------------------
##Ç¿ÖƼǼÍæ¼ÒµÄһЩÐÅÏ¢
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Ç¿ÖƼǼÍæ¼ÒµÄһЩÐÅÏ¢
def SavePlayerMessionInDataServer(curPlayer):
#mapID = curPlayer.GetMapID()
#lineID = PlayerControl.GetPlayerLineID(curPlayer)
#¼Ç¼µØͼÏß·£¬µ±Ç°¾ÑéºÍ½ðÇ®
return
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒµÇ½ÓÎÏ·
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒµÇ½ÓÎÏ·
def PlayerLogin(index, tick):
GameWorld.GetPsycoFunc(__Func_PlayerLogin)(index, tick)
return
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒµÇ½ÓÎÏ·
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒµÇ½ÓÎÏ·
def __Func_PlayerLogin(index, tick):
#ÕâÀïÖ»×ö³õʼ»¯Âß¼
#ÔÚÍæ¼ÒÇл»³¡¾°µÄʱºò, ²»»áµ÷Óõ½ÕâÀï
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
try:
InitLoginPlayer(curPlayer, tick)
DoPlayerLogin(curPlayer, tick)
#ËøסÍæ¼Ò, µÈµ½¶ÁÈ¡µØͼ³É¹¦, ÔÙ½âËø
curPlayer.SetCanMove(False)
#µÇ½·¢Í¼ÐÎÑéÖ¤Âë
PlayerAutoCheckOnline.PlayerLoginCaptcha(curPlayer, tick)
except:
curPlayer.Kick(IPY_GameWorld.disWaitForPlayerLoinError)
import traceback
GameWorld.RaiseException("Íæ¼ÒÉÏÏßÂß¼´íÎó\r\n%s" % traceback.format_exc())
return
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒÇл»µØͼµÄʱºò, ÔÚ±¾µØͼµÇ¼
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÇл»µØͼµÄʱºò, ÔÚ±¾µØͼµÇ¼
def ChangeMapInit(index, tick):
GameWorld.GetPsycoFunc(__Func_ChangeMapInit)(index, tick)
return
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒÇл»µØͼµÄʱºò, ÔÚ±¾µØͼµÇ¼
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÇл»µØͼµÄʱºò, ÔÚ±¾µØͼµÇ¼
def __Func_ChangeMapInit(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
InitLoginPlayer(curPlayer, tick)
#===============================================================================
# #Çл»µØͼ£¬
# #ÖØË¢Íæ¼ÒÊôÐÔ,ÖØÉèѪÁ¿(ÒòÇл»µØͼʱ,·â°ü¿ÉÄܱ»½Ø¶Ï,µ¼Ö¶ª°ü,ÐèÖØË¢ÊôÐÔ°ü)
# #ÖØËãÊôÐÔ
# playerControl = PlayerControl.PlayerControl(curPlayer)
# playerControl.RefreshAllState()
#===============================================================================
#ÉèÖÃÍæ¼ÒµÄ¼¼ÄÜCD
SkillCommon.PlayerChangeMapUpdateSkillCD(curPlayer, tick)
#³õʼ»¯Íæ¼Ò±³°ü
InitPlayerPack(curPlayer)
#ÔÚÕâ¸öÀïÃæ»áÖØË¢ËùÓÐÊôÐÔ, ±ØÐëÔÚÕÙ»½ÊÞ³öÏÖÇ°×ö, ÕâÑùºÍ×°±¸Ïà¹ØµÄ±»¶¯¼¼ÄܲÅÄÜ×÷ÓÃÔÚÕÙ»½ÊÞÉíÉÏ
DoPlayerLoginInMap(curPlayer, tick)
#----------±ØÐëÔÚÕâ¸öʱºò×ö, ²»ÄÜÔÚÍæ¼Ò·¢À´µØͼ¶ÁÈ¡okµÄʱºò×ö, ·ñÔò, Íæ¼ÒÈç¹û²»·¢À´µØͼ¶ÁÈ¡³É¹¦·â°ü, ¾Í²»ÄÜ´´½¨ÕâЩ¶«Î÷ÁË
# -------------------------------------
# Íæ¼ÒÇл»µØͼ³É¹¦Ö®ºó,
# 1.ҪˢÐÂGameServerÖÐæô³µµÄMapID
# 2.ҪˢÐÂ×Ô¼ºÕÙ»½ÊÞµÄ״̬
# ------------------------------------------------------
#Íæ¼ÒÇл»µØͼ³É¹¦, ³õʼ»¯Íæ¼ÒµÄ¸½¼ÓÐÅÏ¢(æô³µ, ÕÙ»½ÊÞ)
curPlayer.InitChangeMapPlayerSummonInfo()
#֪ͨGameServeræô³µÏÖÔڵĵØͼλÖÃ
curTruck = curPlayer.GetTruck()
if curTruck != None:
curTruck.GameServer_Sync_TruckMapID()
#ïÚ³µÎÞµÐ
SkillCommon.AddBuffBySkillType_NoRefurbish(curTruck, ChConfig.Def_SkillID_LimitSuperBuff, tick)
#ÉèÖÃïÚ³µµÈ¼¶
truckLv = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PawnTruckLV)
curTruck.SetLV(truckLv)
#¸ü¸ÄïÚ³µ¼Ç¼µÄ²¿·ÖÖ÷ÈËÐÅÏ¢
PlayerTruck.ChangeTruckNoteInfo(curPlayer)
#¸üÐÂïÚ³µ½øÅÅÐаñ
PlayerBillboard.UpdateBillboardPlayerTruck(curPlayer.GetPlayerID(), curPlayer.GetName(), curPlayer.GetOperateInfo(),
curPlayer.GetLV(), truckLv, curPlayer.GetMapID())
#---³õʼ»¯×Ô¼ºµÄÕÙ»½ÊÞ---
#===========================================================================
# for i in range(curPlayer.GetSummonCount()):
# curSummon = curPlayer.GetSummonNPCAt(i)
# #³õʼ»¯µ±Ç°ÕÙ»½ÊÞ״̬
# SkillCommon.SetSummonNPCProperty(curPlayer, curSummon)
# summonControl = NPCCommon.NPCControl(curSummon)
# #¸üгðºÞ
# summonControl.ClearNPCAngry()
# #Ë¢ÐÂNPC״̬/buff
# summonControl.RefreshNPCState()
# #Òòµ±Ç°ÑªÁ¿ÏÈË¢,×î´óѪÁ¿ºóË¢£¬ÓпÉÄܵ±Ç°ÑªÁ¿´óÓÚ×î´óѪÁ¿
# GameObj.SetHPFull(curSummon)
#===========================================================================
#³õʼ»¯³èÎï ֪ͨ¿Í»§¶Ë
PetControl.Sync_PetInfo_ChangeMap(curPlayer, tick)
#֪ͨGameServer×Ô¼ºÏÖÔڵĵØͼ
curPlayer.Sync_GameServer_MapID()
#Èç¹û±¾µØͼÊǸ±±¾µÄ»°, Ôò֪ͨGameServerÍæ¼Ò½øÈ븱±¾
if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtTeam:
curPlayer.GameServer_TeamEnterFB(1)
else:
curPlayer.GameServer_TeamEnterFB(0)
#֪ͨÔËÐгɹ¦
curPlayer.BalanceServer_PlayerChangeMapInitOK()
#ËøסÍæ¼Ò, µÈµ½¶ÁÈ¡µØͼ³É¹¦, ÔÙ½âËø
curPlayer.SetCanMove(False)
#---------------------------------------------------------------------
##³õʼ»¯Íæ¼Ò±³°ü
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ³õʼ»¯Íæ¼Ò±³°ü
def InitPlayerPack(curPlayer) :
itemManager = curPlayer.GetItemManager()
#³õʼ»¯Íæ¼Ò±³°ü
PlayerControl.Init_ItemPack(curPlayer)
#³õʼ»¯Íæ¼Ò²Ö¿â
PlayerControl.Init_Warehouse(curPlayer)
#³õʼ»¯Ñ°±¦±³°ü
PlayerControl.Init_TreasurePack(curPlayer)
#³õʼ»¯ÉñÊÞÎïÆ·±³°ü
curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptDogzItem)
curPack.SetCount(ItemCommon.GetPackInitCount(ShareDefine.rptDogzItem))
curPack.Sync_PackCanUseCount()
#³õʼ»¯ÉñÊÞ×°±¸±³°ü
curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptDogzEquip)
curPack.SetCount(ItemCommon.GetPackInitCount(ShareDefine.rptDogzEquip))
curPack.Sync_PackCanUseCount()
#³õʼ»¯À¬»ø·ÖÀà±³°ü
curPack = itemManager.GetPack(ShareDefine.rptGarbage)
curPack.SetCount(ItemCommon.GetPackInitCount(ShareDefine.rptGarbage))
curPack.Sync_PackCanUseCount()
#³õʼ»¯ÁÙʱ½»»»±³°ü
curPack = itemManager.GetPack(ShareDefine.rptTempSwap)
curPack.SetCount(ChConfig.Def_PackCnt_TempSwap)
#³õʼ»¯ÁÙʱ´æ·Å±³°ü
curPack = itemManager.GetPack(ShareDefine.rptTempItem)
curPack.SetCount(ChConfig.Def_PackCnt_TempItem)
#ÉèÖÃ×°±¸Êµ¼Ê¸öÊý
curPack = itemManager.GetPack(IPY_GameWorld.rptEquip)
curPack.SetCount(ItemCommon.GetPackInitCount(IPY_GameWorld.rptEquip))
#³õʼ»¯À¬»øÍ°
#curPack = itemManager.GetPack(IPY_GameWorld.rptRecycle)
#curPack.SetCount(ChConfig.Def_PackCnt_Recycle)
#³õʼ»¯ÍòÄܱ³°ü
curPack = itemManager.GetPack(IPY_GameWorld.rptAnyWhere)
curPack.SetCount(IPY_GameWorld.Def_AnyWherePackCount)
#³õʼ»¯³èÎï±³°ü
curPack = itemManager.GetPack(ShareDefine.rptPet)
curPack.SetCount(ItemCommon.GetPackInitCount(ShareDefine.rptPet))
#curPack.Sync_PackCanUseCount()
return
#---------------------------------------------------------------------
##ÊÇ·ñÓÐÎÞµÐBuff
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÕæ, ÓÐÎÞµÐBuff
#@remarks ×Ô¶¨Ò庯Êý, ÊÇ·ñÓÐÎÞµÐBuff
def __CheckLimitSuperBuff(curPlayer):
skillID = ChConfig.Def_SkillID_LimitSuperBuff
return CheckHasBuffBySkillID(curPlayer, skillID)
## ÅжÏÊÇ·ñÓÐij¼¼ÄÜbuff
# @param curPlayer Íæ¼ÒʵÀý
# @param skillID
# @return ·µ»ØÖµÕæ
def CheckHasBuffBySkillID(curPlayer, skillID):
buffSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
#Òì³£´íÎó
if not buffSkill:
GameWorld.Log("Íæ¼ÒÈ¡Ïûbuffʧ°Ü,Êý¾Ý¿âÎÞ´Ëbuff,buffid = %s " % (skillID) , curPlayer.GetPlayerID())
return False
buffType = SkillCommon.GetBuffType(buffSkill)
buffTuple = SkillCommon.GetBuffManagerByBuffType(curPlayer, buffType)
#ͨ¹ýÀàÐÍ»ñÈ¡Ä¿±êµÄbuff¹ÜÀíÆ÷Ϊ¿Õ£¬ÔòÌø³ö
if buffTuple == ():
return False
buffState = buffTuple[0]
#ÅжÏÊÇ·ñ´æÔÚµÄBUFF
buffSkillTypeID = buffSkill.GetSkillTypeID()
curBuff = buffState.FindBuff(buffSkillTypeID)
if not curBuff:
return False
return True
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Çл»µØͼ³É¹¦( Ä¿±êµØͼ )
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Çл»µØͼ³É¹¦( Ä¿±êµØͼ )
def LoadMapOK(index, tick):
GameWorld.GetPsycoFunc(__Func_LoadMapOK)(index, tick)
return
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Çл»µØͼ³É¹¦( Ä¿±êµØͼ )
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Çл»µØͼ³É¹¦( Ä¿±êµØͼ )
def __Func_LoadMapOK(index, tick):
#ÔÚÍæ¼ÒÇл»³¡¾°/µÇ¼µÄʱºò, »áµ÷Óõ½ÕâÀï, µØͼ¶ÁÈ¡³É¹¦
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
if curPlayer.GetMapLoadOK():
#Íæ¼ÒÒѾ¶ÁÈ¡µØͼOK, ÎÞÐèÔÙ³õʼ»¯
#GameWorld.Log("Íæ¼ÒÒѾ¶ÁÈ¡µØͼOK, ÎÞÐèÔÙ³õʼ»¯" , curPlayer.GetPlayerID())
resetFBLinePosX = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ResetFBLinePosX)
resetFBLinePosY = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ResetFBLinePosY)
if resetFBLinePosX and resetFBLinePosY:
GameWorld.Log("Íæ¼Ò¸±±¾Öбä¸ü¹¦ÄÜÏß·ÐéÄâÇеØͼ³É¹¦!!!", curPlayer.GetPlayerID())
curPlayer.SetDict(ChConfig.Def_PlayerKey_ResetFBLinePosX, 0)
curPlayer.SetDict(ChConfig.Def_PlayerKey_ResetFBLinePosY, 0)
#curPlayer.ResetPos(resetFBLinePosX, resetFBLinePosY)
# »Ö¸´ÊÓÒ°£¬Ë¢ÐÂ×Ô¼ºµÄÊÓÒ°
curPlayer.SetVisible(True)
PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default)
curPlayer.RefreshView()
FBLogic.DoEnterFB(curPlayer, tick)
return
#¼ì²éGMÕʺÅÊÇ·ñÓÐȨÏ޵ǽ
#if not __CheckGMCanLoadMapOK(curPlayer):
# return
#¼ì²âÕ˺ÅÊÇ·ñËø¶¨
if not __CheckForbidLogin(curPlayer):
return
GameWorld.Log("µØͼ¶ÁÈ¡³É¹¦" , curPlayer.GetPlayerID())
#֪ͨGameServerÇл»µØͼֹͣ
curPlayer.GameServer_SetLoadMapState(1)
curPlayer.SetMapLoadOK(True)
#½«Íæ¼Ò·ÅÖÃÔÚÕâ¸öµØͼÉÏ
curPlayer.InitPos(curPlayer.GetPosX(), curPlayer.GetPosY())
firstMission = QuestCommon.GetCommonMission(curPlayer)
if not (firstMission and firstMission.GetProperty(QuestCommon.Def_NewGuyNoSight) == 1):
#Ë¢ÐÂ×Ô¼ºµÄÊÓÒ°
if not GameWorld.IsCrossServer() and (PlayerControl.GetCrossMapID(curPlayer) or curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene)):
GameWorld.DebugLog("===±¾·þLoadMapOKʱÍæ¼Ò´¦ÓÚ¿ç·þ»ò×Ô¶¨Ò峡¾°×´Ì¬£¬²»ÉèÖÿɼû£¡", curPlayer.GetPlayerID())
PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
elif not GameWorld.IsCrossServer():
realmDifficulty = PlayerControl.GetMapRealmDifficulty(curPlayer)
if realmDifficulty:
GameWorld.DebugLog("===±¾·þLoadMapOKʱÍæ¼Ò´¦ÓÚ¾³½çÄѶȵØͼ£¬×Ô¶¯ÉèÖÃÄѶȣ¡realmDifficulty=%s" % realmDifficulty, curPlayer.GetPlayerID())
PlayerControl.SetRealmDifficulty(curPlayer, realmDifficulty)
curPlayer.RefreshView()
curPlayer.SetVisible(True)
#Èç¹ûÍæ¼ÒhpΪ0,ÉèÖÃÍæ¼ÒΪËÀÍö״̬
if GameObj.GetHP(curPlayer) <= 0:
curPlayer.SetPlayerAction(IPY_GameWorld.paDie)
#curPlayer.SetDead()
#°ÑÍæ¼ÒÉèÖÃΪ³õʼ»¯³É¹¦×´Ì¬
curPlayer.SetInitOK(True)
#===========================================================================
# #bug:GMºÅ·´ÒþÐÎÔÚÍæ¼ÒÇл»µØͼ֮ºó,½Å±¾Î´ÉèÖÃÍæ¼ÒÊôÐÔ֮ǰ£¬C++֪ͨºÏ²¢·â°üµ¼Ö¿ͻ§¶ËËÀB
# #½«·´ÒþÐοªÆôתÒƵ½½Å±¾
# if curPlayer.GetGMLevel():
# curPlayer.SetIsDefVisible(True)
#===========================================================================
#ÓÐÏÞÎÞµÐBuff
if not __CheckLimitSuperBuff(curPlayer):
curPlayer.SetCanAttack(True)
#Èç¹ûÔÚʼþ״̬ , ¾Í²»½â³ýËø¶¨ ÈÎÎñ1ËøËÀÁË
#if curPlayer.GetPlayerAction() != IPY_GameWorld.paEvent:
curPlayer.SetCanMove(True)
#ͬ²½¿Í»§¶Ëtick
#Õâ¸ö·â°üÒªÔÚEndLoadMap, ÉÏÂí֮ǰ·¢, ·ñÔò¿Í»§¶Ë´¦Àíʱ»ú²»¶Ô(¿Í»§¶Ë·â°ü»º´æ»úÖÆ)
#curPlayer.Sync_ClientTick()
#×öÉÏÒ»¸öµØͼµÄÉÏÂí/æô³µÂß¼
#»Ö¸´×Ô¼ºµÄ״̬
playerVehicle = curPlayer.GetLastMapPlayerVehicle()
if playerVehicle == IPY_GameWorld.pvHorse:
#Íæ¼ÒÔÚÆïÂíÖÐ
if not PlayerHorse.PlayerRideHorseUp(curPlayer, False, False):
#=======================================================================
# playerHorseState = curPlayer.GetLastMapPlayerRidehorseState()
# if playerHorseState != IPY_GameWorld.prsNormal:
# #Çл»µØͼ, »Ö¸´¼±ÐÐ״̬
# curPlayer.SetPlayerRidehorseState(playerHorseState)
#
# #Ë¢ÐÂÈËÎïÊôÐÔ ËùÓÐ״̬
# playerControl = PlayerControl.PlayerControl(curPlayer)
# playerControl.RefreshAllState()
# else:
#=======================================================================
#´ËʱÒѾÊÇÏÂÂí״̬²»ÐèҪˢ״̬ µ«ÊÇÐèҪ֪ͨ¿Í»§¶ËÏÂÂí
PlayerHorse.PlayerRideHorseDown(curPlayer, False)
elif playerVehicle == IPY_GameWorld.pvTruck:
#Íæ¼ÒÉÏæô³µ, ²»ÖØÖÃ×Ô¼ºµÄλÖÃ, ÒòΪÍæ¼ÒÏÖÔÚ»¹ÔÚÇл»µØͼÖÐ(Ç¿ÖÆÉϳµ,ÒòΪÓпÉÄܱ»¹¥»÷)
PlayerTruck.PlayerTruckUP(curPlayer, False , False , False)
InitPlayerTruck(curPlayer, tick)
PlayerTeam.PlayerLoginSetTeam(curPlayer, tick)
#¼¤»îÍæ¼Ò(±£Ö¤³ÖÐøÐÔBuff´¦Àí¼ä¸ô)
PlayerControl.SetIsNeedProcess(curPlayer, True)
#³õʼ»¯GM²Ù×÷
PlayerGMOper.DoGMOperLogic(curPlayer, tick)
#Èç¹ûµÇ¼µÄ¸±±¾,Ö´ÐнøÈ븱±¾Âß¼, ÒòΪÓÐʱ¼äÏìÓ¦, ±ØÐëÔÚEndLoadMapÖ®ºó...
FBLogic.DoEnterFBLogic(curPlayer, tick)
#´¥·¢Íæ¼Ò½øÈëµØͼµÄʼþ
EventShell.EventResponse_OnMap(curPlayer)
#´¥·¢Íæ¼Ò½øÈëµØͼµÄʼþ
EventShell.EventResponse_OnMapEx(curPlayer)
#´¥·¢Çл»µØͼ³èÎïÂß¼
PetControl.DoLogic_PetLoadMapOK(curPlayer)
#---¼ì²éÊÇ·ñ¿¨ÕÏ°---
curMap = GameWorld.GetMap()
posX = curPlayer.GetPosX()
posY = curPlayer.GetPosY()
# ¸´»îËæ»úλÖÃ
if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsReBorn):
if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsReBorn) == 2:
PlayerControl.PlayerControl(curPlayer).SetToBornPlace()
else:
posX, posY = GameMap.GetNearbyPosByDis(posX, posY, ChConfig.Def_RebornPos_Area_Range)
curPlayer.ResetPos(posX, posY)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsReBorn, 0)
if GameObj.GetHP(curPlayer) <= 0 or curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
#Èç¹ûÍæ¼ÒÉÏÏߺóËÀÍö,»Ø³Ì¸´»î
isLogin = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_LoadMapIsLogin)
rebornType = ChConfig.rebornType_City if isLogin else ChConfig.rebornType_System
if GameWorld.IsCrossServer():
rebornType = ChConfig.rebornType_System
PlayerRebornByType(curPlayer, rebornType, tick)
elif curMap.CanMove(posX, posY) != True:
nearPosX, nearPosY = GameMap.GetNearbyPosByDis(posX, posY, ChConfig.Def_RebornPos_Area_Range)
if nearPosX == 0 and nearPosY == 0:
GameWorld.Log('Íæ¼ÒµÇ¼ÖØÖÃλÖÃʧ°Ü, °ÑÍæ¼Ò´ò»ØÖØÉúµã posX = %s posY = %s' % (posX, posY) , curPlayer.GetPlayerID())
playerControl = PlayerControl.PlayerControl(curPlayer)
playerControl.SetToBornPlace()
else:
curPlayer.ResetPos(nearPosX, nearPosY)
GameWorld.Log('Íæ¼ÒµÇ¼ÖØÖÃλÖÃʧ°Ü, ÉèÖø½½üµã nearPosX = %s nearPosY = %s' % (nearPosX, nearPosY) , curPlayer.GetPlayerID())
#ÉêÇëµÃµ½½±ÀøÎïÆ·
#curPlayer.DataServer_CheckPrizeItem()
#===========================================================================
# #if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_Frist_Lock) == 1 \
# if PlayerAutoCheckOnline.CheckBeginEvent(curPlayer):
# #·ÀÍâ¹ÒËø¶¨
# #Íæ¼ÒµÚÒ»´Î½øÈë, ´¥·¢ÁËOnEnter, OnEnter»áËøסÍæ¼Ò
# #µ«ÊÇÔÚÉÏÃæ»á½âËøÍæ¼Ò
# #ËùÒÔÔÚÕâÀïÇ¿ÖÆÅж¨, Èç¹û´¥·¢ÁËOnEnter, ÄÇôÔÚÕâÀï¼ÓËø
# curPlayer.BeginEvent()
#===========================================================================
#·ÀÖ¹Íæ¼Ò¶ÁÈ¡µØͼʱδ´¥·¢OnDay£¬¶ÁÈ¡µØͼºóÔÙ´ÎÑéÖ¤(2009.9.11)
PlayerEventCounter.UpdatePlayerLoginTime(curPlayer)
#ÉèÖÃÕóÓª
if curPlayer.GetFaction() != ChConfig.CampType_Neutral \
and FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID()) not in ChConfig.Def_MapID_NeedCamp:
#ÖØÖÃÕóÓª
curPlayer.SetFaction(ChConfig.CampType_Neutral)
BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_SkillID_Justice, tick)
BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_SkillID_Evil, tick)
#ÔÙ´ÎÇëÇóË«±¶¾ÑéÊÇ·ñÁìÈ¡
#PlayerDoubleExpSys.ChangeMapAfter_CalcDoubleExpTime(curPlayer, tick)
#PlayerVip.SetStartCalcVIPTick(curPlayer, tick)
#Ç¿ÖÆÇл»PKģʽ
initAttackModel = curMap.GetInitAttackModel()
if curPlayer.GetAttackMode() != initAttackModel:
curPlayer.SetAttackMode(initAttackModel)
SyncPKModel(curPlayer)
GameWorld.DebugLog("½øÈëµØͼǿÖÆÇл»PKģʽ: %s" % initAttackModel)
PassiveBuffEffMng.OnLoadMapGFPassive(curPlayer)
PlayerYinji.OnLoadMap(curPlayer)
ItemControler.PlayerItemControler(curPlayer).RefreshStartEquipCount() # Ë¢ÐÂ×°±¸ÕäÆ·ÐǼ¶
#EndLoadMapÐè·ÅÔÚ×îºó
curPlayer.EndLoadMap()
return True
## Çл»µØͼͬ²½Ò»´ÎPKģʽ
# @param curPlayer
# @return None
def SyncPKModel(curPlayer):
# ͬ²½¿Í»§¶ËPKģʽ
sendPack = ChPyNetSendPack.tagMCAttackMode()
sendPack.Clear()
sendPack.Mode = curPlayer.GetAttackMode()
NetPackCommon.SendFakePack(curPlayer, sendPack)
return
#---------------------------------------------------------------------
##¼ì²éGMÊÇ·ñ¿ÉÒԵǽµØͼ
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÕæ, ¿ÉÒԵǽ
#@remarks ¼ì²éGMÊÇ·ñ¿ÉÒԵǽµØͼ
def __CheckGMCanLoadMapOK(curPlayer):
return True
# if not curPlayer.GetGMLevel() :
# #²»ÊÇGM, ¿ÉÒԵǽ
# return True
#
# curPlayerIP = curPlayer.GetIP()
#
# if curPlayerIP.find('192.168.') == 0 or curPlayerIP.find('10.30.') == 0:
# GameWorld.Log('ÄÚÍøGM = %s , %s IP = %s,µÇ½µØͼ·þÎñÆ÷, ²»ÑéÖ¤IP' % (curPlayer.GetID() , curPlayer.GetName() , curPlayerIP))
# return True
#
# #GM, IPÑéÖ¤²»Í¨¹ý
# if not curPlayer.IsPlayerInPermitIP():
# curPlayer.Kick(IPY_GameWorld.disIPNotPermit)
# return
#
# #IPÑé֤ͨ¹ý
# return True
## ¼ì²âÕ˺ÅÊÇ·ñËø¶¨
#@param curPlayer Íæ¼ÒʵÀý
#@return ÊÇ·ñËø¶¨
def __CheckForbidLogin(curPlayer):
if (curPlayer.GetAccState() & pow(2, ChConfig.Def_PysForbidByPy)) <= 0:
return True
curPlayer.Kick(IPY_GameWorld.disGMKick)
return
#---------------------------------------------------------------------
##³õʼ»¯Íæ¼ÒïÚ³µ
#@param curPlayer Íæ¼ÒʵÀý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ³õʼ»¯Íæ¼ÒïÚ³µ
def InitPlayerTruck(curPlayer, tick):
curPlayer.SetTruckCalcStartTime(tick)
#Íæ¼Òæô³µÂß¼:
#Íæ¼ÒÈç¹ûÓÐæô³µ:
#1. ÔÚ±¾µØͼÕÒÑ°×Ô¼ºµÄæô³µ
#2. Èç¹ûûÓÐÕÒµ½, ·¢¸øGameServerÒªÇó×Ô¼ºæô³µ
truckID = curPlayer.GetTruckID()
GameWorld.Log("³õʼ»¯æô³µ ID = %d ..." % (truckID) , curPlayer.GetPlayerID())
if truckID == 0:
#2009.9.24 bug
#Íæ¼ÒûÓÐïÚ³µID, µ«ÊÇÓÐïÚ³µ×´Ì¬, Ç¿ÖƸÄΪ0
if curPlayer.GetTruckState() != 0:
GameWorld.Log("###Fix Truck State!", curPlayer.GetPlayerID())
curPlayer.SetTruckState(0)
return
#֪ͨgameserverË¢ÐÂ×Ô¼ºµÄæô³µ
curPlayer.GameServer_RefreshTruckReq()
GameWorld.Log("֪ͨgameserverË¢ÐÂ×Ô¼ºµÄæô³µ id = %d" % (truckID) , curPlayer.GetPlayerID())
curTruck = GameWorld.GetNPCManager().FindTruckByID(truckID)
if not curTruck:
return
curPlayer.SetTruck(curTruck)
#Õâ¾ä»°Ò»¶¨Òª¼Ó, ÓÃÀ´Í¨Öª¿Í»§¶Ëæô³µ¿ªÊ¼, ÏÔʾæô³µ²Ù¿ØÃæ°å
curPlayer.SetTruckID(curTruck.GetID())
curTruck.SetOwner(curPlayer)
# GameWorld.Log("Íæ¼ÒÒÑÓÐæô³µ" , curPlayer.GetPlayerID())
#===============================================================================
# #¼Ó¾ÑéÖµ
# def AddExp(index, tick):
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
# sendTest = IPY_GameWorld.IPY_CSendTest()
# addExp = sendTest.GetExp()
# playerControl = PlayerControl.PlayerControl(curPlayer)
# playerControl.AddExp(addExp,True)
#===============================================================================
#---------------------------------------------------------------------
#===============================================================================
# //03 01 ¼ÓÊôÐÔµã#tagCAddPoint
# tagCAddPoint * GettagCAddPoint();
#
# class IPY_CAddPoint
# {
# public:
# //0:Á¦Á¿ 1:¾«Éñ 2:Ãô½Ý 3:ÌåÆÇ 4:ÖÇÁ¦ 5:ÐÒÔË
# int GetType();
#
# int GetPoint();
# };
#===============================================================================
##//03 01 ¼ÓÊôÐÔµã#tagCAddPoint
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks //03 01 ¼ÓÊôÐÔµã#tagCAddPoint
def AddPoint(index, tick):
return
#// B2 06 Íæ¼Ò¼Óµã #tagCMAddPoint
#
#struct tagCMAddPoint
#{
# tagHead Head;
# BYTE PointAttrIDCount; // ¼ÓµãÊôÐÔID¸öÊý
# BYTE PointAttrIDList[PointAttrIDCount]; // ¼ÓµãÊôÐÔIDÁбí
# WORD PointValueList[PointAttrIDCount]; // ¼ÓµãÊôÐÔID¶ÔÓ¦µÄµãÊýÁбí
#};
def OnAddPoint(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
pointAttrIDList = clientData.PointAttrIDList
pointValueList = clientData.PointValueList
if not pointAttrIDList or not pointValueList or len(pointAttrIDList) != len(pointValueList):
return
needTotalPoint = 0
for i, attrID in enumerate(pointAttrIDList):
if not IpyGameDataPY.GetIpyGameData("RolePoint", attrID):
return
needTotalPoint += pointValueList[i]
curFreePoint = curPlayer.GetFreePoint()
if needTotalPoint > curFreePoint:
GameWorld.DebugLog("Ê£ÓàµãÊý²»×ã! curFreePoint(%s) < needTotalPoint(%s)" % (curFreePoint, needTotalPoint))
return
curPlayer.SetFreePoint(curFreePoint - needTotalPoint)
for i, attrID in enumerate(pointAttrIDList):
addPoint = pointValueList[i]
curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID)
updPoint = curPoint + addPoint
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AddPointValue % attrID, updPoint)
GameWorld.DebugLog("Íæ¼Ò¼Óµã: attrID=%s,curPoint=%s,addPoint=%s,updPoint=%s" % (attrID, curPoint, addPoint, updPoint))
NotifyPlayerBasePoint(curPlayer, pointAttrIDList)
playerControl = PlayerControl.PlayerControl(curPlayer)
playerControl.RefreshPlayerAttrState()
EventShell.EventRespons_AddPoint(curPlayer)
PlayerControl.SetLingGenMaxIndex(curPlayer)
return
#// B2 07 ÖØÖüӵã #tagCMResetAttrPoint
#struct tagCMResetAttrPoint
#{
# tagHead Head;
#};
def OnResetAttrPoint(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
ipyDataMgr = IpyGameDataPY.IPY_Data()
canResetIDList = [ipyDataMgr.GetRolePointByIndex(index).GetAttrID() for index in xrange(ipyDataMgr.GetRolePointCount())]
canReset = False
for attrID in canResetIDList:
curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID)
if curPoint:
canReset = True
break
if not canReset:
GameWorld.DebugLog('ÖØÖüӵã ûÓеãÊýÐèÒªÖØÖÃ')
return
isFree = curPlayer.GetLV() < IpyGameDataPY.GetFuncCfg('LVUPAddPoint', 4)
if not isFree:
#ÓÅÏÈʹÓÃÊ£Óàʱ¼ä×î¶ÌµÄʱЧÎïÆ·
needItemIDList = IpyGameDataPY.GetFuncEvalCfg('LVUPAddPoint', 5)
itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
delIndex = -1
expireTime = 0
for itemID in needItemIDList:
hasEnough, itemIndexList = ItemCommon.GetItem_FromPack_ByID(itemID, itemPack, 10)
if not itemIndexList:
#GameWorld.DebugLog("ÖØÖüӵã item(%s) isn't enough" % (needItemID))
continue
for itemIndex in itemIndexList:
curItem = itemPack.GetAt(itemIndex)
if not ItemCommon.CheckItemCanUse(curItem):
continue
isExpireItem, remainingTime = ItemCommon.GetItemRemainingTime(curItem)
if isExpireItem:
if remainingTime <= 0:
#¹ýÆÚ
continue
if not expireTime or remainingTime < expireTime:
expireTime = remainingTime
delIndex = itemIndex
else:
delIndex = itemIndex
break
if delIndex != -1:
break
if delIndex is -1:
return
ItemCommon.ReduceItem(curPlayer, itemPack, [delIndex], 1, False, ChConfig.ItemDel_ResetAttrPoint)
Item_ResetAttrPoint.DoResetAttrPoint(curPlayer, 0, 0, 0)
EventShell.EventRespons_LingGenReset(curPlayer)
return
def NotifyPlayerBasePoint(curPlayer, syncAttrIDList=[]):
# ֪ͨ»ù´¡ÊôÐԵ㣬ÒÑ·ÖÅäµÄ×ÔÓɵãÊý
if not syncAttrIDList:
ipyDataMgr = IpyGameDataPY.IPY_Data()
syncAttrIDList = [ipyDataMgr.GetRolePointByIndex(index).GetAttrID() for index in xrange(ipyDataMgr.GetRolePointCount())]
pointAttrIDList = []
pointValueList = []
for attrID in syncAttrIDList:
curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % attrID)
pointAttrIDList.append(attrID)
pointValueList.append(curPoint)
pointInfo = ChPyNetSendPack.tagMCRolePointInfo()
pointInfo.PointAttrIDList = pointAttrIDList
pointInfo.PointValueList = pointValueList
pointInfo.PointAttrIDCount = len(pointAttrIDList)
NetPackCommon.SendFakePack(curPlayer, pointInfo)
return
#===============================================================================
# //B4 14 ¸ù¾ÝÀàÐÍÀ´¾ö¶¨Òƶ¯µÄ·½Ê½ #tagMCMoveByType
#
# struct tagMCMoveByType
# {
# tagHead Head;
# DWORD ID; //Íæ¼ÒID
# WORD PosX; // Ä¿±êX
# WORD PosY; // Ä¿±êY
# BYTE MoveType; //Òƶ¯·½Ê½
# };
#===============================================================================
def OnMoveByType(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#Íæ¼ÒÒƶ¯Í¨Óüì²é
if not __CheckPlayerCanMove(curPlayer):
return
#ÏÈÑé֤Ŀ±êµãÊÇ·ñºÏ·¨
if not GameWorld.GetMap().CanMove(clientData.PosX, clientData.PosY):
return
curPlayer.StopMove()
curPlayer.ChangePos(clientData.PosX, clientData.PosY)
sendPack = ChPyNetSendPack.tagMCMoveByType()
sendPack.Clear()
sendPack.ID = curPlayer.GetID()
sendPack.ObjType = curPlayer.GetGameObjType()
sendPack.PosX = clientData.PosX
sendPack.PosY = clientData.PosY
sendPack.MoveType = clientData.MoveType
PlayerControl.PyNotifyAll(curPlayer, sendPack, False, -1)
return
#===============================================================================
# //B4 04 սǰ³å·æ #tagCMRush
#
# struct tagCMRush
# {
# tagHead Head;
# DWORD ObjID; //·ÇÅä±íNPCID£¬Ä¿Ç°Ö»Ö§³ÖNPC
# BYTE PosX; // Ä¿±êX
# BYTE PosY; // Ä¿±êY
# };
#===============================================================================
# Óë¿Í»§¶ËÔ¼¶¨³å·æµ½Ä¿±êºó·¢°ü Óë¼¼Äܳå·æ²»Í¬
def OnPlayerRush(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_Rush) <= ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_Rush]:
return
curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_Rush, tick)
#ÎÞ·¨Ñé֤Ŀ±ê
#===========================================================================
# curTag = GameWorld.GetObj(clientData.ObjID, IPY_GameWorld.gotNPC)
# if not curTag or GameObj.GetHP(curTag) ==0:
# return
#
# #ÓëÄ¿±êÏà²îÌ«Ô¶
# if GameWorld.GetDist(curTag.GetPosX(), curTag.GetPosY(), clientData.PosX, clientData.PosY) > 6:
# return
#===========================================================================
#³¬³öÊÓÒ°
if curPlayer.GetSight() and GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), clientData.PosX, clientData.PosY) > curPlayer.GetSight():
return
#Íæ¼ÒÒƶ¯Í¨Óüì²é
if not __CheckPlayerCanMove(curPlayer):
return
#ÏÈÑé֤Ŀ±êµãÊÇ·ñºÏ·¨
if not GameWorld.GetMap().CanMove(clientData.PosX, clientData.PosY):
return
curPlayer.StopMove()
#GameWorld.DebugLog("սǰ³å·æ %s %s"%([curPlayer.GetPosX(), curPlayer.GetPosY()], [clientData.PosX, clientData.PosY]))
curPlayer.ChangePos(clientData.PosX, clientData.PosY)
sendPack = ChPyNetSendPack.tagMCRush()
sendPack.Clear()
sendPack.ID = curPlayer.GetID()
sendPack.ObjType = curPlayer.GetGameObjType()
sendPack.PosX = clientData.PosX
sendPack.PosY = clientData.PosY
PlayerControl.PyNotifyAll(curPlayer, sendPack, False, -1)
return
#===============================================================================
# //B4 06 Õ½¶·Òƶ¯ # tagCMFightMove
#
# struct tagCMFightMove
# {
# tagHead Head;
# WORD StartX;
# WORD StartY;
# WORD DestX;
# WORD DestY;
# DWORD WorldTick;
# };
#===============================================================================
# ÓëÒƶ¯µÄÇø±ðÔÚÓÚ²»¹ã²¥
def PlayerFightMove(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#·ÀÍâ¹Ò ²»¿ÉÒƶ¯
if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_AutoCheckHack_State) \
== ChConfig.Def_AutoCheck_State_Danger:
return
#²»¿ÉÒƶ¯ÐÐΪ״̬, ÅжϿͻ§¶ËÏÞÖÆ
if not OperControlManager.IsObjCanDoAction(
curPlayer,
ChConfig.Def_Obj_ActState_ServerAct,
IPY_GameWorld.oalMove
):
return False
#Íæ¼ÒÒƶ¯Í¨Óüì²é
if not __CheckPlayerCanMove(curPlayer):
return
#·â°ü²ÎÊý
sendPack_StartX = clientData.StartX
sendPack_StartY = clientData.StartY
sendPack_DestX = clientData.DestX
sendPack_DestY = clientData.DestY
sendPack_WorldTick = clientData.WorldTick
#Ïàͬµã²»Òƶ¯
if (sendPack_StartX == sendPack_DestX) and (sendPack_StartY == sendPack_DestY):
#GameWorld.ErrLog('PlayerMove Ïàͬµã²»Òƶ¯', curPlayer.GetID())
return
#ÏÈÑé֤Ŀ±êµãÊÇ·ñºÏ·¨
if not GameWorld.GetMap().CanMove(sendPack_DestX, sendPack_DestY):
curPlayer.ResetPos(curPlayer.GetPosX(), curPlayer.GetPosY())
return
if tick - curPlayer.GetDictByKey("FightMoveTick") < 50:
#curPlayer.ResetPos(curPlayer.GetPosX(), curPlayer.GetPosY())
return
curPlayer.SetDict("FightMoveTick", tick)
#---Õý³£Òƶ¯---
vehicle = curPlayer.GetPlayerVehicle()
if vehicle not in [IPY_GameWorld.pvNull, IPY_GameWorld.pvHorse]:
#GameWorld.ErrLog("²»ÄÜÒƶ¯, ½»Í¨¹¤¾ß²»Ã÷ %d" % (vehicle), curPlayer.GetID())
return
curMap = GameWorld.GetMap()
#УÑé¿Í»§¶Ëʱ¼ä
#if not PlayerControl.PlayerMoveCheckClientWorldTick(curPlayer, sendPack_WorldTick, sendPack_StartX, sendPack_StartY):
# return
#Òƶ¯µã¼ì²é
if not CheckMovePos(curPlayer, curPlayer, curMap, sendPack_StartX, sendPack_StartY, sendPack_DestX, sendPack_DestY):
return
if GameWorld.GetDist(sendPack_StartX, sendPack_StartY, sendPack_DestX, sendPack_DestY) > 20:
curPlayer.ResetPos(curPlayer.GetPosX(), curPlayer.GetPosY())
return
#Èç¹ûÊÇСÓÎÏ·ÖÐÔòֹͣСÓÎÏ·
if curPlayer.GetPlayerAction() == IPY_GameWorld.paGameEvent:
PlayerGameEvent.StopGameEvent(curPlayer, tick)
#ɾ³ýÓÐÏÞÎÞµÐBUFF
PlayerControl.DelLimitSuperBuff(curPlayer, tick)
curPlayer.ChangePos(sendPack_DestX, sendPack_DestY)
#curPlayer.SetClientMoveTick(sendPack_WorldTick)
fightPet = curPlayer.GetPetMgr().GetFightPet()
#ÎÞ³öÕ½³èÎï
if fightPet == None:
return
if GameWorld.GetDist(fightPet.GetPosX(), fightPet.GetPosY(), sendPack_DestX, sendPack_DestY) <= 4:
#Õ½¶·Öв»Æµ·±Òƶ¯
return
#³öÕ½³èÎïͬʱÒƶ¯
PetControl.FightPetFollowMove(curPlayer, sendPack_StartX, sendPack_StartY)
return
#---------------------------------------------------------------------
#===============================================================================
# //05 01Íæ¼ÒÒƶ¯#tagCPlayerMove
# tagCPlayerMove * GettagCPlayerMove();
#
# class IPY_CPlayerMove
# {
# public:
#
# int GetStartX();
#
# int GetStartY();
#
# int GetDestX();
#
# int GetDestY();
#
# int GetWorldTick();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦//05 01Íæ¼ÒÒƶ¯#tagCPlayerMove
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦//05 01Íæ¼ÒÒƶ¯#tagCPlayerMove
def PlayerMove(index, tick):
GameWorld.GetPsycoFunc(__Func_PlayerMove)(index, tick)
return
##¿Í»§¶Ë·â°üÏìÓ¦//05 01Íæ¼ÒÒƶ¯#tagCPlayerMove
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦//05 01Íæ¼ÒÒƶ¯#tagCPlayerMove
def __Func_PlayerMove(index, tick):
return
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#·ÀÍâ¹Ò ²»¿ÉÒƶ¯
if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_AutoCheckHack_State) \
== ChConfig.Def_AutoCheck_State_Danger:
return
#²»¿ÉÒƶ¯ÐÐΪ״̬, ÅжϿͻ§¶ËÏÞÖÆ
if not OperControlManager.IsObjCanDoAction(
curPlayer,
ChConfig.Def_Obj_ActState_ServerAct,
IPY_GameWorld.oalMove
):
return False
#Íæ¼ÒÒƶ¯Í¨Óüì²é
if not __CheckPlayerCanMove(curPlayer):
return
#·â°ü²ÎÊý
sendPack = IPY_GameWorld.IPY_CPlayerMove()
sendPack_StartX = sendPack.GetStartX()
sendPack_StartY = sendPack.GetStartY()
sendPack_DestX = sendPack.GetDestX()
sendPack_DestY = sendPack.GetDestY()
sendPack_WorldTick = sendPack.GetWorldTick()
#ÏÈÑé֤Ŀ±êµãÊÇ·ñºÏ·¨
if not GameWorld.GetMap().CanMove(sendPack_DestX, sendPack_DestY):
return
#Ïàͬµã²»Òƶ¯
if (sendPack_StartX == sendPack_DestX) and (sendPack_StartY == sendPack_DestY):
#GameWorld.ErrLog('PlayerMove Ïàͬµã²»Òƶ¯', curPlayer.GetID())
return
#---¸±±¾µØͼÒƶ¯¼ì²é---
if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
if not FBLogic.DoFBCanMove(curPlayer, sendPack_DestX, sendPack_DestY, tick):
return
#---Õý³£Òƶ¯---
vehicle = curPlayer.GetPlayerVehicle()
if vehicle not in [IPY_GameWorld.pvNull, IPY_GameWorld.pvHorse]:
#GameWorld.ErrLog("²»ÄÜÒƶ¯, ½»Í¨¹¤¾ß²»Ã÷ %d" % (vehicle), curPlayer.GetID())
return
#Íæ¼ÒÕý³£Òƶ¯
PlayerNormalMove(curPlayer, sendPack_StartX, sendPack_StartY, sendPack_DestX,
sendPack_DestY, sendPack_WorldTick, tick)
#===============================================================================
# attackTime = tick - curPlayer.GetPlayerAttackTick()
# if attackTime <= curPlayer.GetAtkInterval() / 2:
# #Íæ¼Ò¹¥»÷ÔÚ½©Ö±Ê±¼äÖÐ, ²»ÄÜ×ß·
# #GameWorld.Log("Íæ¼Ò¹¥»÷ÔÚ½©Ö±Ê±¼äÖÐ, ²»ÄÜ×ß· %d" %(attackTime) , curPlayer.GetPlayerID())
# return
#===============================================================================
#===============================================================================
# #Íæ¼ÒÆï³Ë״̬
# vehicle = curPlayer.GetPlayerVehicle()
#
# #Èç¹ûÔÚÆïÂí״̬£¬ÐèÒªÅж¨ÌØÊâ×øÆï
# if vehicle == IPY_GameWorld.pvHorse and not __CheckHorseCanMove( curPlayer ):
# __DoLogic_DropHorse( curPlayer , tick )
# return
#
# #Íæ¼ÒÕý³£Òƶ¯
# if vehicle == IPY_GameWorld.pvNull or vehicle == IPY_GameWorld.pvHorse:
# #Íæ¼ÒÕý³£Òƶ¯
# PlayerNormalMove(curPlayer , moveData)
# elif curPlayer.GetPlayerVehicle() == IPY_GameWorld.pvTruck :
# #ÈËïÚºÏÒ»,Íæ¼ÒÒƶ¯
# PlayerMoveByCarryerTruck(curPlayer , moveData)
# else:
# GameWorld.Log("²»ÄÜÒƶ¯, ½»Í¨¹¤¾ß²»Ã÷ %d"%(vehicle) , curPlayer.GetPlayerID())
#===============================================================================
return
#---------------------------------------------------------------------
##ÑéÖ¤Íæ¼ÒÊÇ·ñ¿ÉÒÔÒƶ¯.
# @param curPlayer Íæ¼ÒʵÀý
# @return ²¼¶ûÖµ
# @remarks ¿Í»§¶Ë·â°üÏìÓ¦
def __CheckPlayerCanMove(curPlayer):
if not curPlayer.GetMapLoadOK():
#Íæ¼ÒµØͼ¶Áȡδ³É¹¦, Ìß³öÕâÈË
#curPlayer.Kick(IPY_GameWorld.disPlayerMovedWhenNotPrepare)
return False
#Ëø¶¨²»¿ÉÒƶ¯
if not curPlayer.GetCanMove():
return False
#Íæ¼ÒÒѾËÀÍö
if GameObj.GetHP(curPlayer) <= 0:
return False
# #Ñ£ÔÎʱ£¬²»¿ÉÒƶ¯ zhengyang 2010-6-2
# if curPlayer.GetAbnormalState() == IPY_GameWorld.sctFaint:
# return False
#²»¿ÉÒƶ¯ÐÐΪ״̬, ÅжϷþÎñ¶ËÏÞÖÆ
if not OperControlManager.IsObjCanDoAction(
curPlayer,
ChConfig.Def_Obj_ActState_ServerAct,
IPY_GameWorld.oalMove
):
return False
#Íæ¼ÒͨÓõÄ״̬ת»»¼ì²é
if not PlayerControl.PlayerCanStateTransfer(curPlayer):
return False
return True
#---------------------------------------------------------------------
##Íæ¼ÒÆÕͨÒƶ¯
#@param curPlayer Íæ¼ÒʵÀý
#@param client_StartX ¿Í»§¶ËÆðµãX
#@param client_StartX ¿Í»§¶ËÆðµãY
#@param client_DestX ¿Í»§¶ËÄ¿±êµãX
#@param client_DestY ¿Í»§¶ËÄ¿±êµãY
#@param tick ʱ¼ä
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks Íæ¼ÒÆÕͨÒƶ¯
def PlayerNormalMove(curPlayer, client_StartX, client_StartY, client_DestX,
client_DestY, clientWorldTick, tick) :
# ·ÏÆú¸Ä³ÉPYÒƶ¯
return
#Èç¹ûÍæ¼ÒʼþÖÐ, Í˳öÈÎÎñ
# if curPlayer.GetPlayerAction() == IPY_GameWorld.paEvent:
# EventShell.DoExitEvent(curPlayer)
curMap = GameWorld.GetMap()
#УÑé¿Í»§¶Ëʱ¼ä
if not PlayerControl.PlayerMoveCheckClientWorldTick(curPlayer, clientWorldTick, client_StartX, client_StartY):
curPlayer.Sync_ClientTick()
return
#Òƶ¯µã¼ì²é
if not CheckMovePos(curPlayer, curPlayer, curMap, client_StartX, client_StartY, client_DestX, client_DestY):
return
#¼ÙÉè¿Í»§¶Ë¶¼ÊÇÕýÈ·µÄ£¬¿ÉÐÐ×ßÕÏ°µã
#if PlayerControl.DoLogic_PlayerInBarrierPoint(curPlayer):
# return
#Èç¹ûÊÇСÓÎÏ·ÖÐÔòֹͣСÓÎÏ·
if curPlayer.GetPlayerAction() == IPY_GameWorld.paGameEvent:
PlayerGameEvent.StopGameEvent(curPlayer, tick)
#2010/04/30 Òƶ¯ÐÞ¸ÄΪȫC++¿ØÖÆ, Python״̬»úÉèÖÃΪ¿ÕÏÐ(Çå¿Õ²É¼¯µÈ״̬)
PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)
#ɾ³ýÓÐÏÞÎÞµÐBUFF
#PlayerControl.DelLimitSuperBuff(curPlayer, tick)
#GameWorld.DebugLog("Òƶ¯Ç°-----Íæ¼Ò×ø±ê %s-%s Ä¿µÄµØ%s -%s"%(curPlayer.GetPosX(), curPlayer.GetPosY(), client_DestX, client_DestY))
# ÔÚUpdatePos µ÷Óüä¸ôÄÚ¶à´Îµ÷ÓÃmove»áʹ m_StartMoveTick ÖØÖ㬵¼ÖÂÎÞ·¨Òƶ¯
# ¶øÔÚ CheckMovePos -> PlayerRefreshPos -> __FixPlayerPos -> ChangePos Ôì³ÉÒƶ¯µÄÏÖÏó
curPlayer.Move(client_DestX, client_DestY)
#³öÕ½³èÎïͬʱÒƶ¯
#PetControl.FightPetFollowMove(curPlayer, client_DestX, client_DestY, client_StartX, client_StartY)
return
#---------------------------------------------------------------------
##ÈËïÚºÏÒ»,Íæ¼ÒÒƶ¯
#@param curPlayer Íæ¼ÒʵÀý
#@param moveData Òƶ¯·â°ü
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ÈËïÚºÏÒ»,Íæ¼ÒÒƶ¯
#===============================================================================
# def PlayerMoveByCarryerTruck(curPlayer , moveData) :
# curPlayerTruck = curPlayer.GetTruck()
# curMap = GameWorld.GetMap()
#
# #²»¿ÉÒƶ¯ÐÐΪ״̬, ·þÎñ¶ËÏÞÖÆ
# if not OperControlManager.IsObjCanDoAction(curPlayerTruck,
# ChConfig.Def_Obj_ActState_ServerAct,
# IPY_GameWorld.oalMove):
# return
#
#
# if curPlayerTruck == None:
# #À뿪ÈËïÚºÏһ״̬
# GameWorld.Log("À뿪ÈËïÚºÏһ״̬" , curPlayer.GetPlayerID())
# return
#
# if CheckMovePos(curPlayer, curPlayerTruck, curMap, moveData.GetStartX(), moveData.GetStartY(), moveData.GetDestX(), moveData.GetDestY()) != True :
# return
#
# #ïÚ³µÒƶ¯
# #curPlayer.SetSpeed(curPlayerTruck.GetSpeed())
# curPlayerTruck.Move(moveData.GetDestX(), moveData.GetDestY())
# curPlayer.Sync_Move(moveData.GetDestX(), moveData.GetDestY())
# return
#===============================================================================
#---------------------------------------------------------------------
##Òƶ¯µã¼ì²é, checkObj ÊÇÒƶ¯¶ÔÏó(ÔÚÈËïÚºÏһ״̬ÏÂ, ÊäÈëΪæô³µ
#@param curPlayer Íæ¼ÒʵÀý
#@param checkObj Òƶ¯¶ÔÏó
#@param curMap µ±Ç°µØͼ
#@param startX ¿ªÊ¼Òƶ¯×ø±êX
#@param startY ¿ªÊ¼Òƶ¯×ø±êY
#@param destX Òƶ¯Ä¿±êX
#@param destY Òƶ¯Ä¿±êY
#@param sendPlayerMoveFail ÊÇ·ñ·¢ËÍÒƶ¯Ê§°Ü
#@return ·µ»ØÖµÕæ, ¼ì²é³É¹¦
#@remarks Òƶ¯µã¼ì²é, checkObj ÊÇÒƶ¯¶ÔÏó(ÔÚÈËïÚºÏһ״̬ÏÂ, ÊäÈëΪæô³µ
def CheckMovePos(curPlayer, checkObj, curMap, startX, startY, destX, destY, sendPlayerMoveFail=True):
#Æðʼµã,Ä¿±êµã
#Ë¢ÐÂÍæ¼Òµ±Ç°Î»ÖÃ
if not PlayerControl.PlayerRefreshPos(curPlayer, checkObj, startX, startY):
#Íæ¼Òµ±Ç°Î»ÖÃË¢ÐÂʧ°Ü
#GameWorld.Log("Íæ¼Òµ±Ç°Î»ÖÃË¢ÐÂʧ°Ü" , curPlayer.GetPlayerID())
if sendPlayerMoveFail and curPlayer.GetID() == checkObj.GetID():
#Ô˶¯ÕßÊÇÍæ¼Ò, ÄÇôÖØÖÃÍæ¼ÒλÖÃ
curPlayer.ResetPos(curPlayer.GetPosX(), curPlayer.GetPosY())
return False
#µ±Ç°¶ÔÏó×ø±ê
objPosX = checkObj.GetPosX()
objPosY = checkObj.GetPosY()
#Ä¿µÄµØÊÇ·ñ¿ÉÒÔµ½´ï
if not curMap.CanMove(destX, destY):
#µØ·½²»¿É×ß, ÖØÖÃÍæ¼ÒµÄλÖÃ
#GameWorld.Log("µØ·½²»¿É×ß, ÖØÖÃÍæ¼ÒµÄλÖÃ" , curPlayer.GetPlayerID())
if sendPlayerMoveFail:
curPlayer.MoveFail()
return False
#¼ì²éÍæ¼ÒÒƶ¯¾àÀëÊÇ·ñ¹ýÔ¶
moveDist = GameWorld.GetDist(objPosX, objPosY, destX, destY)
if moveDist > ChConfig.Def_PlayerMaxMoveDist:
#GameWorld.Log("Òƶ¯Ê§°Ü£¬¼ì²éÍæ¼ÒÒƶ¯¾àÀëÊÇ·ñ¹ýÔ¶" , curPlayer.GetPlayerID())
if sendPlayerMoveFail:
curPlayer.MoveFail()
return False
#===============================================================================
# ¿¼Âǵ½»á²»Í¬²½µÄÎÊÌâ, ²»¼ÓÕâ¸öÅж¨
# #¼ì²éÄ¿±êµãÉÏ,ÊÇ·ñÓжÔÏó,Óв»ÈÃÒƶ¯
# mapObj = GameWorld.GetMap().GetPosObj(destX, destY)
#
# if not mapObj:
# return
#
# for i in range(0, mapObj.GetObjCount()):
# curObj = mapObj.GetObjByIndex(i)
# #Ö»ÓÐÒ»ÖÖÇé¿öÌØÊâ:ËÀÍöµÄNPC¿ÉÒÔÈÃÍæ¼Ò×ß¹ýÈ¥
# if curObj.GetGameObjType() == IPY_GameWorld.gotNPC and \
# GameObj.GetHP(curObj) <= 0 :
# continue
# curPlayer.MoveFail()
# GameWorld.Log("Òƶ¯Ê§°Ü£¬Ä¿±êµãÓÐÍæ¼Ò»òÕßNPC")
# return
#===============================================================================
#¼ì²éÍæ¼Òµ½Ä¿µÄµØ2µãÖ®¼äÊÇ·ñ¿ÉÒÔÖ±½Ó×ß
#===========================================================================
# if moveDist > 15 and (not curMap.CanLineTo(destX, destY, objPosX, objPosY) \
# and not curMap.CanLineTo(objPosX, objPosY, destX, destY)):
#
# #Õý·´·½ÏòÓÐÒ»µã²»¿É×ß, Ôò²»¿É×ß
# #GameWorld.Log("Òƶ¯Ê§°Ü£¬¼ì²éÍæ¼Òµ½Ä¿µÄµØ2µãÖ®¼äÊÇ·ñ¿ÉÒÔÖ±½Ó×ß(%d,%d)->(%d,%d), ClientCurPos:(%d,%d)"%(
# # objPosX, objPosY,destX, destY,startX,startY ) , curPlayer.GetPlayerID())
# #µØ·½²»¿É×ß
# if sendPlayerMoveFail:
# curPlayer.MoveFail()
#
# return False
#===========================================================================
return True
#---------------------------------------------------------------------
#===============================================================================
# //05 02 Íæ¼ÒÍ£Ö¹Òƶ¯#tagCPlayerStopMove
# tagCPlayerStopMove * GettagCPlayerStopMove();
#
# class IPY_CPlayerStopMove
# {
# public:
#
# int GetPosX();
#
# int GetPosY();
#
# int GetDir();
#
# int GetWorldTick();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //05 02 Íæ¼ÒÍ£Ö¹Òƶ¯#tagCPlayerStopMove
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //05 02 Íæ¼ÒÍ£Ö¹Òƶ¯#tagCPlayerStopMove
def PlayerStopMove(index, tick):
GameWorld.GetPsycoFunc(__Func_PlayerStopMove)(index, tick)
return
##¿Í»§¶Ë·â°üÏìÓ¦ //05 02 Íæ¼ÒÍ£Ö¹Òƶ¯#tagCPlayerStopMove
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //05 02 Íæ¼ÒÍ£Ö¹Òƶ¯#tagCPlayerStopMove
def __Func_PlayerStopMove(index, tick):
#===========================================================================
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#
# #»ñÈ¡·â°ü²ÎÊý
# sendPack = IPY_GameWorld.IPY_CPlayerStopMove()
# sendPack_Tick = sendPack.GetWorldTick()
# sendPack_PosX = sendPack.GetPosX()
# sendPack_PosY = sendPack.GetPosY()
# sendPack_Dir = sendPack.GetDir()
#
# #½»Í¨¹¤¾ß
# vehicle = curPlayer.GetPlayerVehicle()
#
# #Íæ¼ÒÍ£Ö¹Òƶ¯
# if curPlayer.GetPlayerVehicle() == IPY_GameWorld.pvNull or vehicle == IPY_GameWorld.pvHorse:
# PlayerNormalStopMove(curPlayer, sendPack_Tick, sendPack_PosX, sendPack_PosY, sendPack_Dir)
#
# #ÈËïÚºÏһֹͣÒƶ¯
# elif vehicle == IPY_GameWorld.pvTruck :
# #ÈËïÚºÏһֹͣÒƶ¯
# PlayerStopMoveByCarryTruck(curPlayer, sendPack_Tick, sendPack_PosX, sendPack_PosY)
#
# else:
# GameWorld.Log("²»ÄÜÒƶ¯, ½»Í¨¹¤¾ß²»Ã÷%d" % (vehicle) , curPlayer.GetPlayerID())
#===========================================================================
return
#---------------------------------------------------------------------
##Íæ¼ÒÍ£Ö¹Òƶ¯
#@param curPlayer Íæ¼ÒʵÀý
#@param sendPack_Tick ʱ¼ä´Á
#@param sendPack_PosX Ä¿±êX×ø±ê
#@param sendPack_PosY Ä¿±êY×ø±ê
#@param sendPack_Dir ÃæÏò
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ×Ô¶¨Ò庯Êý Íæ¼ÒÍ£Ö¹Òƶ¯
#===============================================================================
# def PlayerNormalStopMove(curPlayer, sendPack_Tick, sendPack_PosX, sendPack_PosY, sendPack_Dir) :
# #Íæ¼ÒÍ£Ö¹Òƶ¯¼ì²é
# if CheckPlayerStopMove(curPlayer) != True :
# return
#
# if not PlayerControl.PlayerMoveCheckClientWorldTick(curPlayer, sendPack_Tick, sendPack_PosX, sendPack_PosY):
# return
#
# if PlayerControl.PlayerRefreshPos(curPlayer, curPlayer, sendPack_PosX, sendPack_PosY) != True:
# return
#
# #curPlayer.SetFaceDir(sendPack_Dir)
# curPlayer.StopMove()
# return True
#
# #---------------------------------------------------------------------
# ##ÈËïÚºÏһֹͣÒƶ¯
# #@param curPlayer Íæ¼ÒʵÀý
# #@param sendPack_Tick ʱ¼ä´Á
# #@return ·µ»ØÖµÎÞÒâÒå
# #@remarks ×Ô¶¨Ò庯Êý ÈËïÚºÏһֹͣÒƶ¯
# def PlayerStopMoveByCarryTruck(curPlayer, clientWorldTick, sendPack_PosX, sendPack_PosY):
# curPlayerTruck = curPlayer.GetTruck()
# if curPlayerTruck == None:
# GameWorld.Log("ÈËïÚºÏһֹͣÒƶ¯ -> ûÓÐæô³µ!" , curPlayer.GetPlayerID())
# return
#
# if curPlayerTruck.GetCurAction() != IPY_GameWorld.laNPCMove :
# return
#
# if not PlayerControl.PlayerMoveCheckClientWorldTick(curPlayer, clientWorldTick, sendPack_PosX, sendPack_PosY):
# return
#
# curPlayerTruck.StopMove()
# return True
#===============================================================================
#---------------------------------------------------------------------
#===============================================================================
# //03 05Ö÷½Çµã»÷¸´»î#tagCCliectReborn
# tagCCliectReborn * GettagCCliectReborn();
#
# class IPY_CCliectReborn
# {
# public:
#
# int GetType();
# //0: ÒøƱ 1:Òø×Ó
# int GetMoneyType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 05Ö÷½Çµã»÷¸´»î#tagCCliectReborn
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 05Ö÷½Çµã»÷¸´»î#tagCCliectReborn
def PlayerClickReborn(index, tick):
#Íæ¼Òµã»÷: ÖØÉú
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#¸ù¾ÝÍæ¼ÒÑ¡ÔñÖØÉúÑ¡ÏîÖØÉú
sendPack = IPY_GameWorld.IPY_CCliectReborn()
#¸´»îÀàÐÍ
rebornType = sendPack.GetType()
GameWorld.DebugLog("Íæ¼Òµã»÷¸´»î: rebornType=%s" % rebornType, curPlayer.GetPlayerID())
if GameWorld.IsCrossServer():
GameWorld.DebugLog("¿ç·þ·þÎñÆ÷²»½ÓÊܸ´»îÇëÇó!")
return
if PlayerControl.GetCrossMapID(curPlayer):
OnReqCrossServerReborn(curPlayer, rebornType)
return
#FBÖнûÖ¹¸´»î
if FBLogic.DoFBForbidReborn(curPlayer, rebornType):
PlayerControl.NotifyCode(curPlayer, "Reborn_lhs_31379")
return
#Íæ¼Ò¸´»î
if PlayerRebornByType(curPlayer, rebornType, tick):
#Íæ¼Ò¸´»î³É¹¦,ÅжÏÊÇ·ñÔÚ¸±±¾Öи´»î
PlayerReborn_InFB(curPlayer, rebornType, tick)
return
def OnReqCrossServerReborn(curPlayer, rebornType):
## ÇëÇó¿ç·þ·þÎñÆ÷¸´»îÍæ¼Ò
crossMapID = PlayerControl.GetCrossMapID(curPlayer)
if not crossMapID:
GameWorld.DebugLog("µ±Ç°ÎÞ¿ç·þµØͼ!")
return
if not __CheckCanReborn(curPlayer, rebornType, checkHPState=False):
return
msgDict = {"PlayerID":curPlayer.GetPlayerID(), "RebornType":rebornType}
GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_Reborn, msgDict)
GameWorld.DebugLog("¿ç·þÖÐÇëÇó¸´»î, crossMapID=%s,msgDict=%s" % (crossMapID, msgDict), curPlayer.GetPlayerID())
return
def ClientServerMsg_Reborn(curPlayer, msgData, serverGroupID, tick):
## ÊÕµ½×Ó·þÇëÇó¸´»îÐÅÏ¢
rebornType = msgData["RebornType"]
gameMap = GameWorld.GetMap()
if not __CheckCanReborn(curPlayer, rebornType, gameMap):
return
isAddReviveTired = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsAddReviveTired)
# ¿ç·þ·þÎñÆ÷²»Ö´ÐÐÏûºÄ£¬¸´»îºóͬ²½ÏûÏ¢»ØÖ÷·þ¿Û³ýÏûºÄ
__DoPlayerReborn(curPlayer, rebornType, tick)
# ·¢Ëͻر¾·þ¸´»î½á¹û
msgInfo = {"Result":1, "ReviveTired":isAddReviveTired}
msgInfo.update(msgData)
GameWorld.SendMsgToClientServer(ShareDefine.CrossServerMsg_RebornRet, msgInfo, [serverGroupID])
return
def CrossServerMsg_RebornRet(curPlayer, msgData, tick):
## ÊÕµ½¿ç·þ·þÎñÆ÷¸´»î½á¹û
result = msgData["Result"]
if result != 1:
return
rebornType = msgData["RebornType"]
isAddReviveTired = msgData["ReviveTired"]
__RebornCost(curPlayer, rebornType, True)
if isAddReviveTired:
__AddReviveTired(curPlayer, tick)
return
def SyncPlayerReborn(curPlayer, rebornType):
rebornInfo = ChNetSendPack.tagPlayerReborn()
rebornInfo.Clear()
rebornInfo.PlayerID = curPlayer.GetPlayerID()
rebornInfo.Type = rebornType
rebornInfo.PosX = curPlayer.GetPosX()
rebornInfo.PosY = curPlayer.GetPosY()
NetPackCommon.SendFakePack(curPlayer, rebornInfo)
return
#---------------------------------------------------------------------
#===============================================================================
# //04 01 »ñÈ¡ÇøÓòÄÚ¶ÔÏóÐÅÏ¢#tagCAreaObjInfo
# tagCAreaObjInfo * GettagCAreaObjInfo();
#
# class IPY_CAreaObjInfo
# {
# public:
#
# int GetObjType();
#
# int GetObjID();
# };
#===============================================================================
##//04 01 »ñÈ¡ÇøÓòÄÚ¶ÔÏóÐÅÏ¢#tagCAreaObjInfo
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks //04 01 »ñÈ¡ÇøÓòÄÚ¶ÔÏóÐÅÏ¢#tagCAreaObjInfo
def PlayerNeedSeeOther(index, tick):
#ÏÖÔÚ¸ÄΪ, Ö±½Ó·¢ËÍÐÅÏ¢¸ø¿Í»§¶Ë, Õâ¸ö·â°ü²»´¦ÀíÁË
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
# sendReq = IPY_GameWorld.IPY_CAreaObjInfo()
# tagObj = GameWorld.GetObj(sendReq.GetObjID(), sendReq.GetObjType())
#
# if tagObj == None:
# GameWorld.Log("Íæ¼ÒÇëÇóÆäËûÍæ¼ÒµÄÏàòÐÅϢʧ°Ü, ¶ÔÏó²»´æÔÚ")
# return
#
# if GameWorld.IsSameObj(curPlayer, tagObj):
# #×Ô¼º²»Äܵõ½×Ô¼ºµÄÐÅÏ¢
# return
#
# dist = GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), tagObj.GetPosX(), tagObj.GetPosY())
# #¶ÔÏóÔÚ×Ô¼ºÁ½±¶ÊÓÒ°ÍâÃæ, Ôò¾Ü¾ø
# if dist > curPlayer.GetSight() * 2:
# #Ä¿±êÍæ¼ÒÔÚÊÓÒ°ÍâÃæ
# GameWorld.Log("Íæ¼ÒÇëÇóÆäËûÍæ¼ÒµÄÏàòÐÅϢʧ°Ü£¬Ä¿±êÍæ¼ÒÔÚÊÓÒ°ÍâÃæ %d" % dist)
# curPlayer.Sync_GetPlayerInfoFail(sendReq.GetObjID())
# return
#
# if tagObj.GetGameObjType() != IPY_GameWorld.gotPlayer:
# return
# curPlayer.SeeOtherPlayer(tagObj)
return
#---------------------------------------------------------------------
#===============================================================================
# //04 02 »ñÈ¡Êó±ê×ó¼üµã»÷Ö®ºó¶ÔÏóµÄÏêϸÐÅÏ¢#tagCClickObjGetInfo
# tagCClickObjGetInfo * GettagCClickObjGetInfo();
#
# class IPY_CClickObjGetInfo
# {
# public:
#
# int GetObjID();
#
# int GetObjType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦//04 02 »ñÈ¡Êó±ê×ó¼üµã»÷Ö®ºó¶ÔÏóµÄÏêϸÐÅÏ¢#tagCClickObjGetInfo
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦//04 02 »ñÈ¡Êó±ê×ó¼üµã»÷Ö®ºó¶ÔÏóµÄÏêϸÐÅÏ¢#tagCClickObjGetInfo
def PlayerClickOtherPlayerGetInfo(index, tick):
GameWorld.GetPsycoFunc(__Func_PlayerClickOtherPlayerGetInfo)(index, tick)
return
##¿Í»§¶Ë·â°üÏìÓ¦//04 02 »ñÈ¡Êó±ê×ó¼üµã»÷Ö®ºó¶ÔÏóµÄÏêϸÐÅÏ¢#tagCClickObjGetInfo
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦//04 02 »ñÈ¡Êó±ê×ó¼üµã»÷Ö®ºó¶ÔÏóµÄÏêϸÐÅÏ¢#tagCClickObjGetInfo
def __Func_PlayerClickOtherPlayerGetInfo(index, tick):
#===========================================================================
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#
# sendPack = IPY_GameWorld.IPY_CClickObjGetInfo()
# sendPack_ID = sendPack.GetObjID()
# sendPack_Type = sendPack.GetObjType()
#
# tagObj = GameWorld.GetObj(sendPack_ID, sendPack_Type)
#
# if tagObj == None:
# #GameWorld.Log("Íæ¼ÒÇëÇóÆäËûÍæ¼ÒµÄÏàòÐÅϢʧ°Ü, ¶ÔÏó²»´æÔÚ", curPlayer.GetPlayerID())
# return
#
# dist = GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), tagObj.GetPosX(), tagObj.GetPosY())
# #ÊÇ·ñ¿ÉÒÔÄ¿±êÏêϸÐÅÏ¢
# canGetDetail = (dist <= curPlayer.GetSight())
# #Ä¿±êÀàÐÍ
# tagObjType = tagObj.GetGameObjType()
#
# #½ö´¦ÀíPlayerºÍNPC
# if tagObjType not in [IPY_GameWorld.gotPlayer, IPY_GameWorld.gotNPC]:
# return
#
# #---Íæ¼Ò´¦Àí---
# if tagObjType == IPY_GameWorld.gotPlayer:
# #»ñÈ¡Íæ¼ÒÏêϸÐÅÏ¢³É¹¦
# if canGetDetail:
# extendDataDict = {}
# extendDataDict['maxHP'] = GameObj.GetMaxHP(tagObj)
# extendDataDict['maxMP'] = tagObj.GetMaxMP()
# extendDataDict['hit'] = tagObj.GetHit()
# extendDataDict['miss'] = tagObj.GetMiss()
# extendDataDict['atkSpeed'] = PlayerControl.GetAtkSpeed(tagObj)
# extendDataDict['superHitRate'] = tagObj.GetSuperHitRate()
# extendDataDict['superHit'] = tagObj.GetSuperHit()
# extendDataDict['luckyHitRate'] = tagObj.GetLuckyHitRate()
# extendDataDict['greatHitRate'] = tagObj.GetGreatHitRate()
# extendDataDict['ignoreDefRate'] = tagObj.GetIgnoreDefRate()
# extendDataDict['damageReduceRate'] = tagObj.GetDamageReduceRate()
# extendDataDict['damageBackRate'] = tagObj.GetDamageBackRate()
#
# extendData = str(extendDataDict)
# extendDataLen = len(extendData)
# curPlayer.PlayerClickOtherPlayerDetail(tagObj, extendDataLen, extendData)
# return
#
# #»ñÈ¡Íæ¼ÒÏêϸÐÅϢʧ°Ü
# curPlayer.Sync_GetPlayerInfoFail(sendPack_ID)
# return
#
# #---NPC´¦Àí---
#
# #»ñÈ¡NPCÏêϸÐÅÏ¢³É¹¦
# if canGetDetail:
# curPlayer.PlayerClickOtherNPCDetail(tagObj)
# return
#
#===========================================================================
#»ñÈ¡NPCÏêϸÐÅϢʧ°Ü
#Ôݲ»´¦Àí
return
#---------------------------------------------------------------------
#===============================================================================
# //03 02 Íæ¼Ò×øÏÂ/Õ¾Á¢#tagCSit
# tagCSit * GettagCSit();
#
# class IPY_CSit
# {
# public:
# //0:×øÏ 1:Õ¾Á¢
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 02 Íæ¼Ò×øÏÂ/Õ¾Á¢#tagCSit
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 02 Íæ¼Ò×øÏÂ/Õ¾Á¢#tagCSit
def PlayerSit(index, tick):
GameWorld.DebugLog("PlayerSit...")
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#¹¦ÄÜ¿ªÆôÅжϻ»³É
#GameFuncComm.GetFuncCanUse(curPlayer, funcID)
#¹¦ÄÜ¿ªÆôÅжϻ»³É
#GameFuncComm.GetFuncCanUse(curPlayer, funcID)
if GameObj.GetHP(curPlayer) <= 0:
return
sendPack = IPY_GameWorld.IPY_CSit()
setType = sendPack.GetType()
if setType == 1: #ÊÖÓΰæ Ö»×öÕ¾Á¢
PlayerControl.DoPlayerStand(curPlayer)
return
if curPlayer.IsMoving():
PlayerControl.NotifyCode(curPlayer, "CanNotSitWrongState")
return
#ÔÚ½»Í¨¹¤¾ßÖÐ, ²»¿É´ò×ø
if curPlayer.GetPlayerVehicle() != IPY_GameWorld.pvNull:
return
#´ò×øÐÐΪ£¬¿Í»§¶ËÏÞÖÆ
if not OperControlManager.IsObjCanDoAction(curPlayer,
ChConfig.Def_Obj_ActState_ServerAct,
IPY_GameWorld.oalSit):
return
#ÉèÖûØѪ/»Øħ¿ªÊ¼±êʾλ
curPlayer.SetRestoreTime(tick)
#»ñµÃ·â°ü
sendPack = IPY_GameWorld.IPY_CSit()
setType = sendPack.GetType()
playAction = curPlayer.GetPlayerAction()
#---Ïë×øÏÂ---
if setType == 0 and playAction == IPY_GameWorld.paNull:
PlayerControl.DoPlayerSit(curPlayer, tick)
return
#---ÏëÕ¾ÆðÀ´---
PlayerControl.DoPlayerStand(curPlayer)
return
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒÏÂÏß
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÏÂÏß
def PlayerDisconnect(index, tick):
GameWorld.GetPsycoFunc(__Func_PlayerDisconnect)(index, tick)
return
#---------------------------------------------------------------------
##¼Ç¼ÐÂÔöÓÐЧµÇ½Íæ¼Ò£¬µÇ½10·ÖÖÓÒÔÉÏÍæ¼Ò²ÅËãÓÐЧ
# @param curPlayer Íæ¼ÒʵÀý
# @return None
def NoteLoginValid(curPlayer):
if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_LoginValid) == 1:
#ÒѼǼ
return
#¼ÆËãʱ¼ä, µ±Ç°¼õÈ¥µÇ½ʱ¼ä
diffTime = GameWorld.GetCurrentTime() - GameWorld.GetDateTimeByStr(curPlayer.GetLoginTime().strip())
#10·ÖÖÓÒÔÉϲÅËãÓÐЧÍæ¼Ò
if diffTime.days == 0 and diffTime.seconds < 10 * 60:
return
DataRecordPack.DR_LoginValid(curPlayer.GetAccID(), curPlayer.GetIP(), curPlayer)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_LoginValid, 1)
return
##C++·â°ü´¥·¢, Íæ¼ÒÏÂÏß
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÏÂÏß
def __Func_PlayerDisconnect(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
try:
# ±ÜÃâÒòÂß¼´íÎóµ¼ÖÂÏÂÏßʧ°Ü£¬¿ÉÄܵ¼Ö»صµµÄÇé¿ö
DoPlayerDisconnect(curPlayer, tick)
except:
import traceback
GameWorld.RaiseException("Íæ¼ÒÏÂÏßÂß¼´íÎó\r\n%s" % traceback.format_exc())
#µ÷ÓõײãʹÍæ¼ÒÏÂÏß
curPlayer.DoDisconnect(tick)
##Íæ¼ÒÕý³£ÏÂÏß
#@param curPlayer Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÏÂÏß
def DoPlayerDisconnect(curPlayer, tick):
GameWorld.Log("PlayerDisconnect!" , curPlayer.GetPlayerID())
#ÏÂÏßÁË£¬½«´æ´¢ÔÚ×ÖµäÖеÄÕæʵXPÖµ£¬ÉèÖøøÍæ¼Ò£¬Íê³É֪ͨºÍ´æ´¢
#curPlayer.SetXP(curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_RecordXPValue))
#######################################################################
#ÏÂÏßÂß¼
PlayerControl.PlayerLeaveServer(curPlayer, tick)
#######################################################################
#É趨Íæ¼ÒµÄÏÂÏßʱ¼ä
curPlayer.SetLogoffTime(GameWorld.GetCurrentDataTimeStr())
#Á÷Ïò¼Ç¼Íæ¼ÒÏÂÏß
DataRecordPack.DR_PlayerDisconnect(curPlayer)
#¼Ç¼ÐÂÔöÓÐЧµÇ½Íæ¼Ò
NoteLoginValid(curPlayer)
#VIPʱ¼ä
#PlayerVip.CalcVIPTimeByTick(curPlayer, tick, False)
#ÔÚÏßʱ¼ä
PlayerOnlinePrize.CalcOnlineTime(curPlayer)
#Ê׳äÌáʾʱ¼ä
PlayerGoldGift.UpdateFirstGoldTime(curPlayer)
#Íæ¼Òδ»ØͼÐÎÑéÖ¤ÂëÏÂÏß½«»á¼Ç¼´íÎó´ÎÊý
#===========================================================================
# if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_Captcha_WaitSign) \
# == PlayerAutoCheckOnline.Def_Captcha_WaitAnswer:
# PlayerAutoCheckOnline.CaptchaAnswerErr(curPlayer, tick, False)
#
# PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_Captcha_WaitSign, PlayerAutoCheckOnline.Def_Captcha_Safe)
#
#===========================================================================
#@warning: µÈ×Ö¶ÎͳһÐ޸ģ¬É¾³ýË«±¶¾ÑéBUFF
#PlayerDoubleExpSys.DeleteDoubleExpBuff(curPlayer, ChConfig.Def_DoubleExpNote_StopOff)
#ÉèÖÃRouteServerInitOK×Öµä
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_RouteServerInitOK, 0)
#È¡Ïû×Ô¶¯ÔËïÚ״̬
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_AutoTruck, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_CrossRegisterMap, 0)
#ÏÂÏßÕٻسèÎï
PetControl.ReCallFightPet(curPlayer)
#PlayerTJG.CalcPlayerTJG(curPlayer, tick)
#ÀëÏßsession
EventReport.WriteEvent_session(curPlayer)
return
#---------------------------------------------------------------------
#===============================================================================
# //03 03 ÉèÖÿì½ÝÀ¸±£´æ#tagCSetShutCutData
# tagCSetShutCutData * GettagCSetShutCutData();
#
# class IPY_CSetShutCutData
# {
# public:
#
# char * GetSetting();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 03 ÉèÖÿì½ÝÀ¸±£´æ#tagCSetShutCutData
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 03 ÉèÖÿì½ÝÀ¸±£´æ#tagCSetShutCutData
def SetShutcutSettingHV(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
sendPack = IPY_GameWorld.IPY_CSetShutCutData()
setting = sendPack.GetSetting()
if not GameWorld.EncodingToUnicode(setting):
#±àÂë¸ñʽ²»ºÏ·¨
setting = ""
GameWorld.ErrLog("SetShutCutData Encoding Err", curPlayer.GetID())
return
if len(setting) > 100:
return
curPlayer.SetSetting(setting)
return
#// A2 29 ÉèÖÃСÖúÊÖ #tagCMSetLittleHelper
#
#struct tagCMSetLittleHelper
#{
# tagHead Head;
# BYTE SetNum; // Íйܹ¦ÄÜÉèÖñàºÅ1~20£¬Ã¿¸ö±àºÅ¶ÔÓ¦µÄÍйܹ¦ÄÜÇ°¶Ë×Ô¶¨Òå
# DWORD Value1; // ×Ô¶¨ÒåÖµ1
# DWORD Value2; // ×Ô¶¨ÒåÖµ2
# DWORD Value3; // ×Ô¶¨ÒåÖµ3
# DWORD Value4; // ×Ô¶¨ÒåÖµ4
# DWORD Value5; // ×Ô¶¨ÒåÖµ5
# DWORD Value6; // ×Ô¶¨ÒåÖµ6
#};
def OnSetLittleHelper(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
setNum = clientData.SetNum
if setNum > ChConfig.LittleHelperSetNumCount:
GameWorld.ErrLog("СÖúÊÖ²»Ö§³Ö¸ÃÉèÖñàºÅ! setNum=%s" % setNum, curPlayer.GetPlayerID())
return
for i in xrange(1, ChConfig.LittleHelperValueCount + 1):
if not hasattr(clientData, "Value%s" % i):
GameWorld.ErrLog("СÖúÊÖ²»Ö§³Ö¸ÃÖµ±àºÅÉèÖÃ! setNum=%s,value%s" % (setNum, i), curPlayer.GetPlayerID())
continue
value = getattr(clientData, "Value%s" % i)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_LittleHelperValue % (setNum, i), value)
GameWorld.DebugLog("СÖúÊÖÖµÉèÖÃ: setNum=%s,value%s=%s" % (setNum, i, value), curPlayer.GetPlayerID())
return
def SyncLittleHelper(curPlayer):
## ͬ²½Ð¡ÖúÊÖÉèÖ㬽öÓÐÖµµÄͬ²½
funcSetList = []
for setNum in xrange(ChConfig.LittleHelperSetNumCount + 1):
funcSet = None
for i in xrange(1, ChConfig.LittleHelperValueCount + 1):
value = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_LittleHelperValue % (setNum, i))
if not value:
continue
if not funcSet:
funcSet = ChPyNetSendPack.tagMCLittleHelperFuncSet()
funcSet.SetNum = setNum
if hasattr(funcSet, "Value%s" % i):
setattr(funcSet, "Value%s" % i, value)
if funcSet:
funcSetList.append(funcSet)
if not funcSetList:
return
setPack = ChPyNetSendPack.tagMCLittleHelperSet()
setPack.FuncSetList = funcSetList
setPack.FuncSetCount = len(setPack.FuncSetList)
NetPackCommon.SendFakePack(curPlayer, setPack)
return
#// A2 22 ÉèÖÃÒýµ¼³É¹¦ #tagCMSetGuideOK
#
#struct tagCMSetGuideOK
#{
# tagHead Head;
# BYTE GuideIndex; // ¼Ç¼λË÷Òý, ·¢ËÍ255ʱ,´ú±íÉèÖÃÈ«²¿
# BYTE IsOK;
#};
def OnSetGuideOK(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
guideIndex = clientData.GuideIndex
isOK = clientData.IsOK
# È«²¿ÉèÖÃ
if guideIndex == 255:
value = 0 if not isOK else (pow(2, 31) - 1)
for i in xrange(ChConfig.Def_GuideStateKeyCount):
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_GuideState % i, value)
GameWorld.DebugLog("ÉèÖÃÈ«²¿Òýµ¼×´Ì¬: isOK=%s,value=%s" % (isOK, value))
else:
if guideIndex >= 31*ChConfig.Def_GuideStateKeyCount:
GameWorld.ErrLog("ÉèÖÃÒýµ¼Ê§°Ü, ³¬¹ý×î´óÖ§³Ö¼Ç¼λ£¡ guideIndex=%s" % guideIndex)
return
GameWorld.DebugLog("ÉèÖÃÒýµ¼³É¹¦ guideIndex=%s,isOK=%s" % (guideIndex, isOK))
isOK = 1 if isOK else 0
GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_GuideState, guideIndex, isOK)
# ÕâÀïÖ»¸üÐÂ״ֵ̬
#SyncGuideState(curPlayer)
return
def SyncGuideState(curPlayer):
# ͬ²½Òýµ¼×´Ì¬¼Ç¼
guideStatePack = ChPyNetSendPack.tagMCGuideState()
guideStatePack.GuideState = []
for i in xrange(ChConfig.Def_GuideStateKeyCount):
guideStatePack.GuideState.append(curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_GuideState % i))
guideStatePack.Count = len(guideStatePack.GuideState)
NetPackCommon.SendFakePack(curPlayer, guideStatePack)
return
def ShowGuide(curPlayer, guideID):
# ֪ͨ¿Í»§¶ËÏÔʾÒýµ¼
showGuide = ChPyNetSendPack.tagMCShowGuide()
showGuide.GuideID = guideID
NetPackCommon.SendFakePack(curPlayer, showGuide)
return
#---------------------------------------------------------------------
#===============================================================================
# //05 03 Íæ¼ÒÌøÔ¾#tagCJump
# tagCJump * GettagCJump();
#
# class IPY_CJump
# {
# public:
#
# int GetSkillID();
#
# int GetStartPosX();
#
# int GetStartPosY();
#
# int GetEndPosX();
#
# int GetEndPosY();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //05 03 Íæ¼ÒÌøÔ¾#tagCJump
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //05 03 Íæ¼ÒÌøÔ¾#tagCJump
def PlayerJump(index, tick):
#ûÕâ¸ö¹¦ÄÜÁË
return
## Íæ¼Ò״̬±ä¸ü
# @param index Íæ¼ÒË÷Òý
# @param tick µ±Ç°Ê±¼ä
# @return None
def OnPlayerChangeAction(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
if not curPlayer:
return
lastAction = curPlayer.GetPlayerLastAction()
curAction = curPlayer.GetPlayerAction()
if lastAction == curAction:
return
#Èç¹ûÉÏÒ»¸ö״̬ÊÇСÓÎϷ״̬
if lastAction == IPY_GameWorld.paGameEvent:
PlayerGameEvent.TakeoffFishermanEquipment(curPlayer)
return
#---------------------------------------------------------------------
#===============================================================================
# //03 06 ÉèÖÃÉúÃü»Ö¸´ÊýÖµ#tagCSetHPRestore
# tagCSetHPRestore * GettagCSetHPRestore();
#
# class IPY_CSetHPRestore
# {
# public:
#
# int GetValue();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 06 ÉèÖÃÉúÃü»Ö¸´ÊýÖµ#tagCSetHPRestore
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 06 ÉèÖÃÉúÃü»Ö¸´ÊýÖµ#tagCSetHPRestore
def HPRestoreSetting(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
sendPack = IPY_GameWorld.IPY_CSetHPRestore()
curValue = sendPack.GetValue()
if curValue < 0 or curValue > 100:
return
curPlayer.SetHPRestoreSetting(curValue)
#Íæ¼Ò»î×ŵÄʱºòµ÷ÓÃ
if GameObj.GetHP(curPlayer) > 0 :
#µ÷ÓÃ×Ô¶¯»ØѪ
PlayerControl.PlayerAutoRestoreHP(curPlayer, tick)
return
#---------------------------------------------------------------------
#===============================================================================
# //03 07 ÉèÖÃħ·¨»Ö¸´ÊýÖµ#tagCSetMPRestore
# tagCSetMPRestore * GettagCSetMPRestore();
#
# class IPY_CSetMPRestore
# {
# public:
#
# int GetValue();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 07 ÉèÖÃħ·¨»Ö¸´ÊýÖµ#tagCSetMPRestore
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 07 ÉèÖÃħ·¨»Ö¸´ÊýÖµ#tagCSetMPRestore
def MPRestoreSetting(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
sendPack = IPY_GameWorld.IPY_CSetMPRestore()
curValue = sendPack.GetValue()
if curValue < 0 or curValue > 100:
return
curPlayer.SetMPRestoreSetting(curValue)
#Íæ¼Ò»î×ŵÄʱºòµ÷ÓÃ
if GameObj.GetHP(curPlayer) > 0 :
#µ÷ÓÃ×Ô¶¯»Øħ
PlayerControl.PlayerAutoRestoreMP(curPlayer, tick)
return
#---------------------------------------------------------------------
#===============================================================================
# //03 0B ÉèÖýðÇ®ÀàÐÍ#tagCSetMoneyType
# tagCSetMoneyType * GettagCSetMoneyType();
#
# class IPY_CSetMoneyType
# {
# public:
# //1:½ð×Ó/½ðƱ 2:Òø×Ó/ÒøƱ
# int GetType();
# //TMoneyType
# int GetMoneyType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 0B ÉèÖýðÇ®ÀàÐÍ#tagCSetMoneyType
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 0B ÉèÖýðÇ®ÀàÐÍ#tagCSetMoneyType
def SetMoneyType(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
sendPack = IPY_GameWorld.IPY_CSetMoneyType()
curType = sendPack.GetType()
curMoneyType = sendPack.GetMoneyType()
if curType == 1 and curMoneyType == IPY_GameWorld.TYPE_Price_Gold_Money :
curPlayer.SetUseGoldType(IPY_GameWorld.TYPE_Price_Gold_Money)
elif curType == 1 and curMoneyType == IPY_GameWorld.TYPE_Price_Gold_Paper :
curPlayer.SetUseGoldType(IPY_GameWorld.TYPE_Price_Gold_Paper)
elif curType == 2 and curMoneyType == IPY_GameWorld.TYPE_Price_Silver_Money :
curPlayer.SetUseSilverType(IPY_GameWorld.TYPE_Price_Silver_Money)
elif curType == 2 and curMoneyType == IPY_GameWorld.TYPE_Price_Silver_Paper :
curPlayer.SetUseSilverType(IPY_GameWorld.TYPE_Price_Silver_Paper)
else:
GameWorld.Log("SetMoneyType = > ½ðÇ®ÀàÐÍ = %s´íÎó" % (curType) , curPlayer.GetPlayerID())
return
return
#---------------------------------------------------------------------
#===============================================================================
# //03 08 ´ò¿ª´óµØͼ#tagCOpenMap
# tagCOpenMap * GettagCOpenMap();
#
# class IPY_COpenMap
# {
# public:
#
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 08 ´ò¿ª´óµØͼ#tagCOpenMap
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 08 ´ò¿ª´óµØͼ#tagCOpenMap
def PlayerMapInfo(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
if tick - curPlayer.GetPosInfoTick() < ChConfig.Def_GetOtherPosInterval:
return
curPlayer.SetPosInfoTick(tick)
#¶ÓÎéÐÅϢͬ²½
PlayerTeam.NotifyPosInfoToPlayer(curPlayer, tick)
#æô³µÐÅϢͬ²½
PlayerTruck.NotifyPosInfoToPlayer(curPlayer, tick)
#֪ͨ´óµØͼ±ê¼ÇµãÊýÁ¿
OnSendMapSignCnt(curPlayer)
return
#---------------------------------------------------------------------
#===============================================================================
# //03 0A ¸ü¸Ä¹¥»÷ģʽ#tagCChangeAttackMode
# tagCChangeAttackMode * GettagCChangeAttackMode();
#
# class IPY_CChangeAttackMode
# {
# public:
# //TAttackMode
# int GetMode();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 0A ¸ü¸Ä¹¥»÷ģʽ#tagCChangeAttackMode
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 0A ¸ü¸Ä¹¥»÷ģʽ#tagCChangeAttackMode
def PlayerChangeAttackMode(index, tick) :
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
sendPack = IPY_GameWorld.IPY_CChangeAttackMode()
sendPackMode = sendPack.GetMode()
#²»¿ÉÇл»Ä£Ê½µÄµØͼ
mapID = GameWorld.GetMap().GetMapID()
if mapID in ChConfig.Def_CanNotChangeAtkModelMap:
GameWorld.Log("±¾µØͼ²»¿ÉÇл»PKģʽ,mapID=%s" % (mapID), curPlayer.GetPlayerID())
return
#===============================================================================================
# #Ö»ÓÐamPeaceºÍamAll
# #if sendPackMode < 0 or sendPackMode > IPY_GameWorld.amAll :
# if sendPackMode not in [IPY_GameWorld.amPeace, IPY_GameWorld.amAll, IPY_GameWorld.amFamily]:
# GameWorld.Log("Çл»¹¥»÷ģʽ·â°ü,ÀàÐÍ = %s´íÎó" % (sendPackMode) , curPlayer.GetPlayerID())
# return
#===============================================================================================
ChangeAttackMode(curPlayer, sendPackMode)
return
##¸Ä±äÍæ¼ÒPKģʽ
#@param curPlayer Íæ¼Ò
#@param attackMode
#@return
def ChangeAttackMode(curPlayer, attackMode):
if attackMode < IPY_GameWorld.amPeace or attackMode >= IPY_GameWorld.amMax:
GameWorld.DebugLog("±ä¸üPKģʽÒì³££¬²»´æÔÚ¸Ãģʽ!attackMode=%s" % attackMode)
return
if curPlayer.GetAttackMode() == attackMode:
GameWorld.DebugLog("PKģʽÏàͬ£¬²»±ä¸ü!attackMode=%s" % attackMode)
return
attackModels = GameWorld.GetMap().GetAttackModels()
if not attackModels & pow(2, attackMode):
GameWorld.DebugLog("±¾µØͼ½ûÖ¹Çл»¸Ãģʽ£¡attackModels=%s,changeMode=%s" % (attackModels, attackMode))
return
#Èç¹ûÇл»µ½ºÍƽģʽ,Çå¿ÕËùÓÐÕÙ»½Ê޵ijðºÞ
if attackMode == IPY_GameWorld.amPeace:
NPCCommon.ClearSummonAngry_Player(curPlayer)
curPlayer.SetAttackMode(attackMode)
# ͬ²½¿Í»§¶ËPKģʽ
SyncPKModel(curPlayer)
return
#---------------------------------------------------------------------
#===============================================================================
# //06 06 È¡ÏûBuff#tagCCancelBuff
# tagCCancelBuff * GettagCCancelBuff();
#
# class IPY_CCancelBuff
# {
# public:
#
# int GetBuffID();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //06 06 È¡ÏûBuff#tagCCancelBuff
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //06 06 È¡ÏûBuff#tagCCancelBuff
def PlayerCancelBuff(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
sendPack = IPY_GameWorld.IPY_CCancelBuff()
skillID = sendPack.GetBuffID()
#---²éÕÒÈ¡ÏûµÄ¼¼ÄÜ---
#---Çå¿ÕBuff---
#@bug 2607: ³ÖÐøÐÔ¼¼Äܵ÷ÓÃDoBuffDisApper, µ¼Ö³ÖÐøÐÔ»ØѪBuff, Ò»´ÎÐÔ½«Ê£ÓàµÄ»Ø¸´Á¿¶¼¼ÓÉÏÁË
#===========================================================================
# if buffSkill.GetSkillType() not in ChConfig.Def_LstBuff_List:
# BuffSkill.DoBuffDisApper(curPlayer, curPlayerCancelbuff, tick)
#===========================================================================
BuffSkill.DelBuffBySkillID(curPlayer, skillID, tick)
#Ë¢ÐÂÈËÎïÊôÐÔ
playerControl = PlayerControl.PlayerControl(curPlayer)
#Ë¢ÐÂËùÓÐ״̬
playerControl.RefreshPlayerAttrByBuff()
#GameWorld.Log("Íæ¼ÒÈ¡Ïûbuff³É¹¦,buffTypeID = %s"%(buffSkillTypeID) , curPlayer.GetPlayerID())
return
#---------------------------------------------------------------------
#===============================================================================
# //03 0C ¿ªÊ¼ÌøÎè/µöÓã#tagCStartGameEvent
# tagCStartGameEvent * GettagCStartGameEvent();
#
# class IPY_CStartGameEvent
# {
# public:
# //ÓÎϷʼþ Type = TGameEvent
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 0C ¿ªÊ¼ÌøÎè/µöÓã#tagCStartGameEvent
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 0C ¿ªÊ¼ÌøÎè/µöÓã#tagCStartGameEvent
def StartGameEvent(index, tick):
GameWorld.GetPsycoFunc(__Func_StartGameEvent)(index, tick)
return
##¿Í»§¶Ë·â°üÏìÓ¦ //03 0C ¿ªÊ¼ÌøÎè/µöÓã#tagCStartGameEvent
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 0C ¿ªÊ¼ÌøÎè/µöÓã#tagCStartGameEvent
def __Func_StartGameEvent(index, tick):
#ÓÎϷʼþ Type = TGameEvent
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
if GameObj.GetHP(curPlayer) == 0:
#GameWorld.Log("Íæ¼ÒËÀÍö£¬Ã»ÓÐʼþ")
return
sendPack = IPY_GameWorld.IPY_CStartGameEvent()
eventType = sendPack.GetType()
#---Í£Ö¹ÓÎϷʼþ---
if eventType == IPY_GameWorld.geNull:
PlayerGameEvent.StopGameEvent(curPlayer, tick)
return
#2010-5-26 Ö»¿ªÆôµöÓã,¹Ø±ÕÌøÎè
if eventType != IPY_GameWorld.geFish:
return
#ͨ¹ý¶¯×÷»ñµÃÏàÓ¦¶¯×÷λ
curActBit = OperControlManager.GetActBitByAction(ChConfig.Def_ActBit_GameEvent, eventType)
if curActBit != None:
#À½ø¶ÈÌõÖР״̬,¿Í»§¶ËÏÞÖÆ
if not OperControlManager.IsObjCanDoAction(curPlayer,
ChConfig.Def_Obj_ActState_ClientAct,
curActBit):
return
#---ÑéÖ¤ÊÇ·ñ¿ÉÒÔ¿ªÊ¼Ð¡ÓÎϷʼþ---
lastShowEventTick = curPlayer.GetGameEventTick()
if tick - lastShowEventTick < ChConfig.Def_ShowEventTime:
#GameWorld.Log("ʼþ²¥·Å¼ä¸ôÌ«¶Ì")
return
#¼ì²éÊÇ·ñ¿ÉÒÔ¿ªÊ¼Ð¡ÓÎÏ·
if not PlayerGameEvent.CheckCanBeginGameEvent(curPlayer, tick):
return
if not PlayerGameEvent.CanProcessGameEvent(curPlayer, eventType, tick):
#PlayerGameEvent.StopGameEvent(curPlayer,tick)
return
#---¿ªÊ¼Ö´ÐÐСÓÎϷʼþ---
#ÉèÖÃÍæ¼Òµ±ÆÚΪÓÎϷʼþ״̬
PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paGameEvent)
#É趨¿ªÊ¼ÓÎϷʼþ
PlayerGameEvent.StartGameEvent(curPlayer, eventType, tick)
return
#// B0 50 µöÓãÊÕ¸Ë #tagCMDoFish
#
#struct tagCMDoFish
#
#{
# tagHead Head;
# BYTE FishNum; // µöÓã±àºÅ1~N
# BYTE PosIndex; // Í£ÁôλÖÃ1~N
#};
## µöÓãÊÕ¸Ë
# @param curPlayer
# @return None
#===============================================================================
# def OnDoFish(index, clientData, tick):
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
# if not curPlayer:
# return
#
# if curPlayer.GetPlayerAction() != IPY_GameWorld.paGameEvent:
# GameWorld.DebugLog("·ÇСÓÎϷ״̬Ï£¬²»¿ÉÊոˣ¡", curPlayer.GetPlayerID())
# return
#
# if curPlayer.GetPlayerGameEvent() != IPY_GameWorld.geFish:
# GameWorld.DebugLog("·ÇµöÓã״̬Ï£¬²»¿ÉÊոˣ¡", curPlayer.GetPlayerID())
# return
#
# fishType = clientData.PosIndex
# PlayerGameEvent.DoFishLogic(curPlayer, fishType)
# return
#===============================================================================
#===============================================================================
# //A1 03 ÉèÖÃÊÇ·ñ³ÉÄê #tagCMAdult
#
# struct tagCMAdult
# {
# tagHead Head;
# BYTE Adult;
# };
#===============================================================================
# Ö»Ð޸ĵØͼµÄadult£¬Ï´εǼ»áÔڵǼ°ü·¢£¬×¢Òâ²âÊÔÇл»µØͼ
def PySetAdult(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
adult = 1 if clientData.Adult else 0
curPlayer.ChangeAdult(adult)
return
#---------------------------------------------------------------------
#===============================================================================
# //03 0D Íæ¼Ò×Ô¶¨Ò嶯×÷#tagCShowFace
# tagCShowFace * GettagCShowFace();
#
# class IPY_CShowFace
# {
# public:
# //±íÇéÀàÐÍ, ¿Í»§¶Ë×Ô¶¨, ·þÎñÆ÷¹ã²¥Õâ¸öType
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 0D Íæ¼Ò×Ô¶¨Ò嶯×÷#tagCShowFace
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 0D Íæ¼Ò×Ô¶¨Ò嶯×÷#tagCShowFace
def ShowFace(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
if tick - curPlayer.GetShowFaceTick() < ChConfig.Def_ShowEventTime:
return
if GameObj.GetHP(curPlayer) <= 0:
return
#±íÇéÐÐΪ£¬ ¿Í»§¶ËÏÞÖÆ
if not OperControlManager.IsObjCanDoAction(curPlayer,
ChConfig.Def_Obj_ActState_ClientAct,
IPY_GameWorld.oalLook):
return
#Òƶ¯Öв»Ö´Ðд˲Ù×÷
if curPlayer.IsMoving():
#PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_0")
return
if curPlayer.GetPlayerAction() != IPY_GameWorld.paNull:
return
if curPlayer.GetPlayerVehicle() != IPY_GameWorld.pvNull:
return
#ÉèÖüä¸ô
curPlayer.SetShowFaceTick(tick)
sendPack = IPY_GameWorld.IPY_CShowFace()
PlayerControl.DoPlayerShowPlayerFace(curPlayer, sendPack.GetType())
return True
#----------------------------×Ô¶¨Òå·½·¨
#---------------------------------------------------------------------
##¼ì²éÍæ¼ÒÊÇ·ñ¿ÉÒÔÍ£Ö¹Òƶ¯
#@param curPlayer Íæ¼ÒʵÀý
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¼ì²éÍæ¼ÒÊÇ·ñ¿ÉÒÔÍ£Ö¹Òƶ¯
def CheckPlayerStopMove(curPlayer):
if not curPlayer.GetMapLoadOK() :
#Íæ¼ÒµØͼ¶ÁȡΪ³É¹¦, Ìß³öÕâÈË
#curPlayer.Kick(IPY_GameWorld.disPlayerMovedWhenNotPrepare)
#GameWorld.Log("Íæ¼ÒµØͼ¶ÁȡûÓгɹ¦")
return
if GameObj.GetHP(curPlayer) == 0:
#Íæ¼ÒÒѾËÀÍö
#GameWorld.Log("Íæ¼ÒÍ£Ö¹Òƶ¯,Íæ¼ÒÒѾËÀÍö")
return
if PlayerControl.PlayerCanStateTransfer(curPlayer) != True:
#GameWorld.Log("Òƶ¯×´Ì¬´íÎó")
return
if curPlayer.GetCanMove() != True:
#GameWorld.Log("Íæ¼Ò²»¿ÉÍ£Ö¹")
return
return True
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒÄܹ»ÖØÖÃ×Ô¼ºµÄλÖÃ
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÄܹ»ÖØÖÃ×Ô¼ºµÄλÖÃ
def PlayerCanResetWorldPos(index, tick):
GameWorld.GetPsycoFunc(__Func_PlayerCanResetWorldPos)(index, tick)
return
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Íæ¼ÒÄܹ»ÖØÖÃ×Ô¼ºµÄλÖÃ
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Íæ¼ÒÄܹ»ÖØÖÃ×Ô¼ºµÄλÖÃ
def __Func_PlayerCanResetWorldPos(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
PlayerControl.DoPlayerResetWorldPos(curPlayer, tick)
return
#---------------------------------------------------------------------
##C++·â°ü´¥·¢, Çл»µØͼʧ°Ü·â°ü´¥·¢
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks C++·â°ü´¥·¢, Çл»µØͼʧ°Ü·â°ü´¥·¢
def PlayerChangeMapFailCallback(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#´«ËÍʱ, Ëø¶¨Íæ¼Ò, ´«Ëͳɹ¦, ÔÚÄ¿±êµØͼ½âËø, ´«ËÍʧ°Ü, ÔÚ´«Ëͻص÷º¯ÊýPlayerChangeMapFailCallbackÖнâËø
curPlayer.ExitEvent()
NotifyChangeMapFail(curPlayer)
return
# ֪ͨÇл»µØͼʧ°Ü
def NotifyChangeMapFail(curPlayer):
curPlayer.SetVisible(True)
sendPack = ChPyNetSendPack.tagMCChangeMapFail()
sendPack.Clear()
NetPackCommon.SendFakePack(curPlayer, sendPack)
GameWorld.Log("µØͼÇл»Ê§°Ü", curPlayer.GetID())
return
#---------------------------------------------------------------------
#===============================================================================
# //01 04 ÔÚÏß»ØÓ¦#tagCOnlineReturn
# tagCOnlineReturn * GettagCOnlineReturn();
#
# class IPY_COnlineReturn
# {
# public:
#
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //01 04 ÔÚÏß»ØÓ¦#tagCOnlineReturn
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //01 04 ÔÚÏß»ØÓ¦#tagCOnlineReturn
def OnlineReply(index, tick):
#Ä¿Ç°×öµ½RouteServerÖÐÈ¥ÁË
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#
# lastOnlineReplyTick = curPlayer.GetLastOnlineReplyTick()
#
# #»ØÓ¦´ÎÊý+1
# curPlayer.SetLastOnlineReplyTick(tick)
# curPlayer.SetOnlineReplyCount(curPlayer.GetOnlineReplyCount() + 1)
# if lastOnlineReplyTick == 0:
# GameWorld.Log("³õʼ»¯ÔÚÏß»ØÓ¦")
# #GameWorld.Log("GetLastOnlineReplyTick %d"%curPlayer.GetLastOnlineReplyTick())
# return
#
# #GameWorld.Log("tick %d"%tick)
# diffTick = tick - lastOnlineReplyTick - ChConfig.Def_PlayerOnLineReply_ClientReply
# if diffTick < -ChConfig.Def_PlayerOnLineReply_ClientReply:
# GameWorld.Log("ÔÚÏß»ØÓ¦¼ä¸ô´íÎó = %d"%diffTick)
# curPlayer.Kick(IPY_GameWorld.disOnlineReplyError)
# return
#
#
## GameWorld.Log(str(curPlayer.GetTotalOnlineReplyTick()))
## GameWorld.Log(str(diffTick))
# curPlayer.SetTotalOnlineReplyTick(curPlayer.GetTotalOnlineReplyTick() + diffTick)
#
# GameWorld.Log("ÔÚÏß»ØÓ¦´ÎÊý = %d ×Üʱ¼ä = %d"%(curPlayer.GetOnlineReplyCount(), curPlayer.GetTotalOnlineReplyTick()))
return
#---------------------------------------------------------------------
#===============================================================================
# //06 08 ÕÙ»½ÊÞÒƶ¯#tagCSummonMove
# tagCSummonMove * GettagCSummonMove();
#
# class IPY_CSummonMove
# {
# public:
#
# int GetSummonID();
#
# int GetPosX();
#
# int GetPosY();
#
# int GetDestPosX();
#
# int GetDestPosY();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //06 08 ÕÙ»½ÊÞÒƶ¯#tagCSummonMove
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //06 08 ÕÙ»½ÊÞÒƶ¯#tagCSummonMove
def PlayerSummonMove(index, tick):
#Âß¼×ö·þÎñÆ÷¶Ë
return
#===============================================================================
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
# sendPack = IPY_GameWorld.IPY_CSummonMove()
# summonID = sendPack.GetSummonID()
# posX = sendPack.GetPosX()
# posY = sendPack.GetPosY()
# destX = sendPack.GetDestPosX()
# destY = sendPack.GetDestPosY()
# #ÕÒµ½Õâ¸öÕÙ»½ÊÞ
# summonNPC = curPlayer.FindSummonByID(summonID)
# #ÎÞ·¨²éÕÒµ½Õâ¸öÕÙ»½ÊÞ
# if summonNPC == None or GameObj.GetHP(summonNPC) <= 0:
# GameWorld.Log('ÎÞ·¨²éÕÒµ½Õâ¸öÕÙ»½ÊÞ summonID=%d'%summonID)
# return
#
# if ChConfig.Def_ClientControlSummonNPCID.count(summonNPC.GetFunctionType()) == 0:
# #Õâ¸öÕÙ»½ÊÞ¿Í»§¶Ë²»ÄÜ¿ØÖÆ
# #GameWorld.Log('Õâ¸öÕÙ»½ÊÞ¿Í»§¶Ë²»ÄÜ¿ØÖÆ')
# return
#
#
# #Ä¿µÄµØÊÇ·ñ¿ÉÒÔµ½´ï
# curMap = GameWorld.GetMap()
# if curMap.CanMove(destX, destY) != True:
# #µØ·½²»¿É×ß, ÖØÖÃÍæ¼ÒµÄλÖÃ
# GameWorld.Log("ÕÙ»½Ê޵ط½²»¿É×ß, destX=%s, destY=%s"%(destX, destY))
# return
# #===============================================================================
# # curMap = GameWorld.GetMap()
# # if CheckMovePos(curPlayer, summonNPC,curMap, posX, posY, destX, destY, sendPlayerMoveFail = False) != True :
# # #·â°üÐÅÏ¢´íÎó
# # return
# #===============================================================================
#
#
# #Òƶ¯µã×ø±ê
# dist = GameWorld.GetDist(posX, posY, destX, destY)
# if dist > 20 :
# #˲ÒÆ
# GameWorld.Log('ÕÙ»½ÊÞ˲ÒÆsummonID=%d'%summonID)
# summonNPC.ResetPos(destX, destY)
# return
#
# #Õý³£Òƶ¯
# summonNPC.Move(destX, destY)
# return
#===============================================================================
#---------------------------------------------------------------------
#===============================================================================
# //06 09 ÕÙ»½ÊÞ¹¥»÷#tagCSummonAttack
# tagCSummonAttack * GettagCSummonAttack();
#
# class IPY_CSummonAttack
# {
# public:
#
# int GetSummonID();
#
# int GetObjType();
#
# int GetObjID();
#
# int GetPosX();
#
# int GetPosY();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //06 09 ÕÙ»½ÊÞ¹¥»÷#tagCSummonAttack
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //06 09 ÕÙ»½ÊÞ¹¥»÷#tagCSummonAttack
def PlayerSummonAttack(index, tick):
#Âß¼×ö·þÎñÆ÷¶Ë
return
#===============================================================================
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
# sendPack = IPY_GameWorld.IPY_CSummonAttack()
# summonID = sendPack.GetSummonID()
# posX = sendPack.GetPosX()
# posY = sendPack.GetPosY()
# attackType = sendPack.GetObjType()
# attackID = sendPack.GetObjID()
#
# #ÕÒµ½Õâ¸öÕÙ»½ÊÞ
# summonNPC = curPlayer.FindSummonByID(summonID)
# #ÎÞ·¨²éÕÒµ½Õâ¸öÕÙ»½ÊÞ
# if summonNPC == None or GameObj.GetHP(summonNPC) <= 0:
# GameWorld.Log('ÕÒ²»µ½ÕÙ»½ÊÞ')
# return
#
# if ChConfig.Def_ClientControlSummonNPCID.count(summonNPC.GetFunctionType()) == 0:
# #Õâ¸öÕÙ»½ÊÞ¿Í»§¶Ë²»ÄÜ¿ØÖÆ
# GameWorld.Log('Õâ¸öÕÙ»½ÊÞ¿Í»§¶Ë²»ÄÜ¿ØÖÆ')
# return
#
# #ÅжϹ«¹²CD
# if tick - summonNPC.GetAttackTick() < summonNPC.GetAtkInterval():
# GameWorld.Log("¹¥»÷¼ä¸ôûÓе½")
# return
#
# if PlayerControl.PlayerRefreshPos(curPlayer, summonNPC, posX, posY) != True:
# #µ±Ç°Î»ÖÃË¢ÐÂʧ°Ü
# GameWorld.Log("ÕÙ»½ÊÞ¹¥»÷µ±Ç°Î»ÖÃË¢ÐÂʧ°Ü")
# return
#
# #±»¹¥»÷Õß
# attackTag = None
# if attackType == IPY_GameWorld.gotPlayer:
# attackTag = GameWorld.GetPlayerManager().FindPlayerByID(attackID)
# elif attackType == IPY_GameWorld.gotNPC:
# attackTag = GameWorld.FindNPCByID(attackID)
# else:
# #·â°üÀàÐÍ´íÎó,»ò¶ÔÏóÎÞ·¨¹¥»÷
# GameWorld.Log("ÕÙ»½ÊÞ·â°ü¹¥»÷ÀàÐÍ´íÎó attackType = %s"%(attackType))
# return
#
# #ÎÞ·¨²éÕÒ¹¥»÷Ä¿±ê
# if attackTag == None :
# GameWorld.Log("ÎÞ·¨²éÕÒ¹¥»÷Ä¿±ê,attackID = %s"%(attackID))
# return
#
# if not BaseAttack.GetCanAttack(summonNPC, attackTag, None, tick):
# return
#
# if not __CheckPlayerSummonAttack(curPlayer , summonNPC , attackTag , tick):
# return
#
# #ÆÕͨ¹¥»÷
# BaseAttack.Attack(summonNPC,attackTag, None, 0, 1,tick)
#
# return
#===============================================================================
#===============================================================================
# def __CheckPlayerSummonAttack(curPlayer , summonNPC , attackTag , tick):
# #1. Èç¹ûÖ÷ÈËÔÚÕ½¶·×´Ì¬, ²¢ÇÒ¹¥»÷¶ÔÏóΪ·â°üÖеĹ¥»÷¶ÔÏó, ·µ»ØTrue
# #Õâ¸öÂß¼,½«»áµ¼ÖÂ,Èç¹ûÍæ¼ÒÍ£Ö¹¹¥»÷ÊØÎÀ,ÄÇôÕÙ»½ÊÞ½«²»¹¥»÷ÊØÎÀ
# if curPlayer.IsBattleState() :
# curOwnerActionObj = curPlayer.GetActionObj()
# if curOwnerActionObj != None and GameWorld.IsSameObj(curOwnerActionObj, attackTag):
# return True
#
# #2. Åж¨¹Øϵ
# #ÅжÏÊÇ·ñµÐ¶Ô¹Øϵ
# relation = BaseAttack.GetTagRelation(summonNPC, attackTag, None, tick)
#
# if relation[0] != ChConfig.Type_Relation_Enemy :
# GameWorld.Log("Attack Fail : Message = %s"%relation[1])
# AttackCommon.PlayerAttackFailSysMessanage(curPlayer,relation[1])
# return False
#
# return True
#===============================================================================
#---------------------------------------------------------------------
#===============================================================================
# //06 0A ÕÙ»½ÊÞÍ£Ö¹#tagCSummonStop
# tagCSummonStop * GettagCSummonStop();
#
# class IPY_CSummonStop
# {
# public:
#
# int GetSummonID();
#
# int GetPosX();
#
# int GetPosY();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //06 0A ÕÙ»½ÊÞÍ£Ö¹#tagCSummonStop
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //06 0A ÕÙ»½ÊÞÍ£Ö¹#tagCSummonStop
def PlayerSummonStop(index , tick):
#Âß¼×ö·þÎñÆ÷¶Ë
return
#===============================================================================
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
# sendPack = IPY_GameWorld.IPY_CSummonStop()
# summonID = sendPack.GetSummonID()
# posX = sendPack.GetPosX()
# posY = sendPack.GetPosY()
#
# #ÕÒµ½Õâ¸öÕÙ»½ÊÞ
# summonNPC = curPlayer.FindSummonByID(summonID)
#
# #ÎÞ·¨²éÕÒµ½Õâ¸öÕÙ»½ÊÞ
# if summonNPC == None or GameObj.GetHP(summonNPC) <= 0:
# return
#
# if ChConfig.Def_ClientControlSummonNPCID.count(summonNPC.GetFunctionType()) == 0:
# #Õâ¸öÕÙ»½ÊÞ¿Í»§¶Ë²»ÄÜ¿ØÖÆ
# #GameWorld.Log('Õâ¸öÕÙ»½ÊÞ¿Í»§¶Ë²»ÄÜ¿ØÖÆ')
# return
#
# if PlayerControl.PlayerRefreshPos(curPlayer, summonNPC, posX, posY) != True:
# #µ±Ç°Î»ÖÃË¢ÐÂʧ°Ü
# GameWorld.Log("ÕÙ»½ÊÞ¹¥»÷µ±Ç°Î»ÖÃË¢ÐÂʧ°Ü")
# return
#
# summonNPC.StopMove()
#
# return
#===============================================================================
#---------------------------------------------------------------------
#===============================================================================
# //03 0F ÊÇ·ñÒþ²ØÃæ¾ß#tagCHideMask
# tagCHideMask * GettagCHideMask();
#
# class IPY_CHideMask
# {
# public:
# //ÊÇ·ñÒþ²Ø
# int GetIsHide();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 0F ÊÇ·ñÒþ²ØÃæ¾ß#tagCHideMask
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 0F ÊÇ·ñÒþ²ØÃæ¾ß#tagCHideMask
def HideMask(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
sendPack = IPY_GameWorld.IPY_CHideMask()
isHide = sendPack.GetIsHide()
if isHide != 0 and isHide != 1:
GameWorld.Log("HideMask -> ·â°üÀàÐÍ´íÎóisHide = %s" % (isHide) , curPlayer.GetPlayerID())
return
if curPlayer.GetIsHideMask() == isHide:
return
curPlayer.SetIsHideMask(isHide)
return
#---------------------------------------------------------------------
#===============================================================================
# //03 10 Í˳ö¸±±¾#tagCExitFB
# tagCExitFB * GettagCExitFB();
#
# class IPY_CExitFB
# {
# public:
# //ÎÞÒâÒå
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 10 Í˳ö¸±±¾#tagCExitFB
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 10 Í˳ö¸±±¾#tagCExitFB
def ExitFB(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
__Func_ExitFB(curPlayer, tick)
return
##¿Í»§¶Ë·â°üÏìÓ¦ //03 10 Í˳ö¸±±¾#tagCExitFB
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 10 Í˳ö¸±±¾#tagCExitFB
def __Func_ExitFB(curPlayer, tick):
if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull and curPlayer.GetMapID() not in IpyGameDataPY.GetFuncEvalCfg("MapLine", 4):
return
GameWorld.Log('Íæ¼Ò = %s , Ö÷¶¯À뿪¸±±¾' % (curPlayer.GetName()) , curPlayer.GetID())
if not FBLogic.CanPlayerLeaveFB(curPlayer):
return
#Íæ¼ÒÖ÷¶¯Í˳öFB,ÏÈ´¦ÀíFBÏà¹ØÐÅÏ¢£¬ÔÙÈÃÍæ¼ÒÍ˳ö
FBLogic.DoPlayerLeaveFB(curPlayer, tick)
#Íæ¼ÒÖ÷¶¯À뿪¸±±¾
PlayerControl.PlayerLeaveFB(curPlayer)
return
#---------------------------------------------------------------------
#===============================================================================
# //01 0B Çл»·ÖÁ÷#tagCChangeLine
# tagCChangeLine * GettagCChangeLine();
#
# class IPY_CChangeLine
# {
# public:
# //»»µ½¼¸Ïß
# int GetLine();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //01 0B Çл»·ÖÁ÷#tagCChangeLine
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //01 0B Çл»·ÖÁ÷#tagCChangeLine
def ChangeLine(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
sendPack = IPY_GameWorld.IPY_CChangeLine()
changLineID = sendPack.GetLine()
if changLineID < 0:
GameWorld.ErrLog("ChangeLine -> ·â°ü´íÎó, ÎÞ´ËÏß· = %s" % (changLineID), curPlayer.GetID())
return
if GameWorld.IsCrossServer():
# ¿ç·þ·þÎñÆ÷ÎÞ·¨ÇÐÏß
return
mapID = curPlayer.GetMapID()
activityLineID = 0 # »î¶¯Ïß, ĬÈÏ1Ïß
activityMapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 2, {})
if mapID in activityMapLineDict:
activityLineID = max(0, activityMapLineDict[mapID] - 1)
mapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 1)
if changLineID != activityLineID and mapID in mapLineDict and changLineID >= mapLineDict[mapID]:
GameWorld.ErrLog("¸ÃµØͼûÓпª·Å´ËÏß·£¬ÎÞ·¨ÊÖ¶¯Çл»£¡mapID=%s,changLineID=%s,maxLine=%s"
% (mapID, changLineID, mapLineDict[mapID]), curPlayer.GetID())
return
#¼ì²éÊÇ·ñ¿ÉÒÔ»»Ïß
if not __CheckCanChangLine(curPlayer, tick):
return
#¿ªÊ¼»»Ïß
PlayerControl.PlayerChangeLine(curPlayer, changLineID)
return
#---------------------------------------------------------------------
##Çл»·ÖÁ÷¼ì²âº¯Êý
#@param curPlayer Íæ¼ÒʵÀý
#@param tick ʱ¼ä´Á
#@return ²¼¶ûÖµ
#@remarks Çл»·ÖÁ÷¼ì²âº¯Êý
def __CheckCanChangLine(curPlayer, tick):
#---¼ä¸ô¼ì²é---
if tick - curPlayer.GetLoginTick() < ChConfig.Def_PlayerChangLine_Tick:
#PK_liubo_500807 ¶Ô²»Æð£¬ÄúÇл»ÓÎÏ·Ïß·¹ýÓÚƵ·±£¬ÇëÉÔºóÖØÊÔ! 256 -
PlayerControl.NotifyCode(curPlayer, "PK_liubo_500807")
#GameWorld.Log("µÇ¼¼ä¸ôСÓÚ%s,ÎÞ·¨»»Ïß"%ChConfig.Def_PlayerChangLine_Tick)
return False
#---״̬¼ì²é---
playerAction = curPlayer.GetPlayerAction()
if playerAction == IPY_GameWorld.paSit:
PlayerControl.DoPlayerStand(curPlayer)
elif playerAction not in ChConfig.Def_PlayerChangLine_State:
#GeRen_liubo_71563 ¶Ô²»Æð£¬Äú´¦ÓÚʼþ״̬ÖУ¬ÎÞ·¨Çл»Ïß·! 256 -
PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_71563")
#GameWorld.Log("·Ç¿ÕÏÐ״̬ÎÞ·¨»»Ïß")
return False
#---Õ½¶·ÖÐ---
if PlayerControl.IsPlayerInFight(curPlayer):
#GeRen_liubo_850801 ¶Ô²»Æð£¬Äú´¦ÓÚÕ½¶·×´Ì¬ÖУ¬ÎÞ·¨Çл»Ïß·! 256 -
PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_850801")
#GameWorld.Log("Õ½¶·ÖÐÎÞ·¨»»Ïß")
return False
#---ÓÐïÚ³µ---
if curPlayer.GetTruck() != None:
#GeRen_liubo_760310 ¶Ô²»Æð£¬Äú´¦ÓÚѺÔË״̬ÖУ¬ÎÞ·¨Çл»Ïß·! 256 -
PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_760310")
return False
if curPlayer.GetPlayerVehicle() not in ChConfig.Def_PlayerChangLine_Vehicle:
#GeRen_liubo_760310 ¶Ô²»Æð£¬Äú´¦ÓÚѺÔË״̬ÖУ¬ÎÞ·¨Çл»Ïß·! 256 -
PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_760310")
return False
return True
#---------------------------------------------------------------------
#===============================================================================
# //01 0C µÃµ½µ±Ç°·þÎñÆ÷Ïß·״̬#tagCGetLineState
# tagCGetLineState * GettagCGetLineState();
#
# class IPY_CGetLineState
# {
# public:
# //ÎÞÒâÒå
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //01 0C µÃµ½µ±Ç°·þÎñÆ÷Ïß·״̬#tagCGetLineState
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //01 0C µÃµ½µ±Ç°·þÎñÆ÷Ïß·״̬#tagCGetLineState
def LineState(index, tick):
#¸ÄΪGameServerͬ²½Òª²éѯµÄµØͼID
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
# #1. Ö»ÓÐÆÕͨµØͼ²é¿´Ïß·
# gameMap = GameWorld.GetMap()
#
# if gameMap.GetMapFBType() != IPY_GameWorld.fbtNull:
# #Line_lose_Examine `o¶Ô²»Æð£¬Ä¿Ç°¸ÃµØͼûÓпª·Å·ÖÁ÷,ÎÞ·¨²é¿´Ïß·״̬!
# #PlayerControl.NotifyCode(curPlayer, "Line_lose_Examine")
# return
#
# if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_LineState) <= ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_LineState]:
# #Line_Examinelose_Frequent `o¶Ô²»Æ𣬶Բ»Æð£¬Äú²é¿´ÓÎÏ·Ïß·״̬¹ýÓÚƵ·±£¬ÇëÉÔºóÖØÊÔ! 256
# #PlayerControl.NotifyCode(curPlayer, "Line_Examinelose_Frequent")
# return
#
# curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_LineState, tick)
# #GameWorld.Log("²é¿´·ÖÁ÷³É¹¦" , curPlayer.GetPlayerID())
# curPlayer.GameServer_LineState()
return
def GetRebronTime(curPlayer, rebornType):
''' ËÀÍö״̬²ÅÑé֤ʱ¼ä£¬±¾·þ¿ç·þͨÓÃ
¿ç·þ·þÎñÆ÷ËÀÍöµÄ¸´»îÒ²ÊÇÏÈ·¢µ½±¾·þ£¬Õý³£Çé¿öϱ¾·þÊÇ»î×ŵģ¬ÎÞ·¨ÑéÖ¤
ËùÒÔ¿É·ñ¸´»îÓÉ¿ç·þ·þÎñÆ÷ËÀÍö״̬ϵÄÍæ¼ÒʵÀýÅжϣ¬¼òµ¥½²¾ÍÊÇÄĸö·þÎñÆ÷ËÀÍöµÄÄĸö·þÎñÆ÷ÅжÏ
ËùÒԸú¯Êý¿ÉÒÔÖ±½ÓʹÓÃÍæ¼ÒËùÔڵĵØͼÅжÏ
'''
# ·ÇËÀÍö״̬Ï£¬Ò²¾ÍÊÇÄĸö·þÎñÆ÷½ÇÉ«ËÀÍöÓÉÄĸö·þÎñÆ÷ÅжÏ
if GameObj.GetHP(curPlayer) > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie:
return 0
# »Ø³Ç¸´»îµÄ²ÅÐèÒªCD
if rebornType not in [ChConfig.rebornType_City, ChConfig.rebornType_MainCity]:
return 0
# ¸±±¾µØͼCD
mapType = GameWorld.GetMap().GetMapFBType()
if mapType != IPY_GameWorld.fbtNull:
fbRebornTimeDict = IpyGameDataPY.GetFuncEvalCfg('DuplicatesRebornTime', 1)
curMapID = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID())
if curMapID in fbRebornTimeDict:
return fbRebornTimeDict[curMapID]
return fbRebornTimeDict.get(0, 0)
if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsAddReviveTired):
findBuff = SkillCommon.FindBuffByID(curPlayer, ChConfig.Def_SkillID_ReviveTired)[0]
if findBuff:
if findBuff.GetSkill().GetSkillLV() == findBuff.GetSkill().GetSkillMaxLV():
return IpyGameDataPY.GetFuncEvalCfg('RebornArguments', 1)[1]
return 0
## ËÀÍöÀäȴʱ¼äÊÇ·ñÍêÁË
#@param curPlayer Íæ¼ÒʵÀý
#@param rebornTime ËÀÍöÀäȴʱ¼ä
#@return boolean
def CanRebornByTimeOver(curPlayer, rebornTime):
#ºÁÃë
playerDeadTimeTick = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_DeadTime)
curGameWorldTick = int(time.time())
GameWorld.DebugLog("¸´»îÀäȴʱ¼ä=%s,passTime=%s"%(rebornTime, max(0, curGameWorldTick - playerDeadTimeTick)))
return max(0, curGameWorldTick - playerDeadTimeTick) >= rebornTime
#---------------------------------------------------------------------
def __CheckCanReborn(curPlayer, rebornType, gameMap=None, checkHPState=True):
''' ¼ì²é¿É·ñ¸´»î£¬ÎªÁËÂ߼ͳһ£¬ÕâÀï²»ÊÊÓÃÍæ¼ÒËùÔڵĵØͼ£¬Ö§³Ö¿ç·þ״̬ÏÂÅжϿç·þµØͼ
±¾º¯Êý²»ÑéÖ¤Íæ¼ÒËÀÍö״̬µÈ£¬ÒòΪÓпÉÄÜÇ°ºó¶Ë¸´»î״̬²»Ò»Ö£¬Èç¹ûÕâÀïÀ¹×¡¿ÉÄܵ¼ÖÂÇ°¶ËÌÉʬ¸´»î²»ÁË
'''
if checkHPState and GameObj.GetHP(curPlayer) > 0 and curPlayer.GetPlayerAction() != IPY_GameWorld.paDie:
# µ±ÑªÁ¿´óÓÚ0ÊÕµ½¸´»îÇëÇóʱ£¬Ò»°ãÊÇÇ°ºó¶Ë¸´»î״̬²»Ò»ÖµÄÇé¿öϵ¼ÖµÄ
# ÓÉÓÚÇ°¶ËÐèÒª¸ù¾Ý¸´»î״̬Åжϸ´»î½çÃæÏà¹ØÂß¼£¬ËùÒÔÕâÀïÐèÒª×öһЩÌØÊâ´¦Àí£¬·ÀֹijЩÇé¿öÏÂÇ°ºó¶Ë¸´»î״̬²»Ò»Öµ¼ÖµÄһЩÒì³£ÎÊÌâ
# ºó¶Ë·ÇËÀÍö״̬µÄÇé¿ö£¬²¹Í¬²½Ò»´Î¸´»î°ü¸øÇ°¶Ë
SyncPlayerReborn(curPlayer, rebornType)
return
if rebornType not in ChConfig.Def_RebornTypeList:
return
## ÓÉÓÚ±¾·þ¼°¿ç·þµØͼÊý¾Ý²»»¥Í¨£¬ËùÒÔÕâÀï¸ù¾ÝÊÇ·ñÓеØͼÊý¾Ý½øÐÐÅжϴ¦Àí
if gameMap:
playerID = curPlayer.GetPlayerID()
if rebornType in [ChConfig.rebornType_Health, ChConfig.rebornType_UseItem] and not gameMap.GetLocalReborn():
GameWorld.ErrLog("¸ÃµØͼ²»¿ÉԵظ´»î! mapID=%s,rebornType=%s" % (gameMap.GetMapID(), rebornType), curPlayer.GetPlayerID())
return
# ÑéÖ¤¸´»îCD
rebornCD = GetRebronTime(curPlayer, rebornType)
if rebornCD:
curTime = int(time.time())
deadTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_DeadTime)
if curTime - deadTime < rebornCD:
PlayerControl.NotifyCode(curPlayer, "RebornCD")
GameWorld.Log("¸´»îÀäȴʱ¼äÖУ¬ÎÞ·¨¸´»î! curTime(%s) - deadTime(%s) < rebornCD(%s)" % (curTime, deadTime, rebornCD), playerID)
return
# ÑéÖ¤¸´»îÏûºÄ£¬ÔÚ±¾·þÑéÖ¤£¬¿ç·þ·þÎñÆ÷Ö»Ñé֤״̬
if not GameWorld.IsCrossServer():
if not __RebornCost(curPlayer, rebornType, False):
return
# ¸±±¾¶îÍâÑéÖ¤
if not FBLogic.OnCanFBReborn(curPlayer, rebornType):
return
return True
def __RebornCost(curPlayer, rebornType, isDoCost):
## ¿Û³ý¸´»îÏûºÄ
# @param isDoCost: ÊÇ·ñÖ´ÐÐÏûºÄ
crossMapID = PlayerControl.GetCrossMapID(curPlayer)
playerID = curPlayer.GetPlayerID()
if rebornType == ChConfig.rebornType_Health:
rebornCfg = IpyGameDataPY.GetFuncEvalCfg('RebornArguments', 1)
moneyPrice = rebornCfg[2]
costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, moneyPrice)
if not costMoneyList:
GameWorld.ErrLog("»õ±Ò²»×㣬ÎÞ·¨ÔµØ¸´»î! moneyPrice=%s" % (moneyPrice), playerID)
return
if isDoCost:
for moneyType, moneyCnt in costMoneyList:
if not PlayerControl.PayMoney(curPlayer, moneyType, moneyCnt, ChConfig.Def_Cost_Revive):
return
elif rebornType == ChConfig.rebornType_UseItem:
if crossMapID == ChConfig.Def_FBMapID_CrossBattlefield:
rebornItemID = IpyGameDataPY.GetFuncCfg("CrossBattlefieldReborn", 1)
rebornItem = ItemCommon.FindItemInPackByItemID(curPlayer, rebornItemID, IPY_GameWorld.rptItem)
else:
rebornItem = ItemCommon.FindItemInPackByEffectEx(curPlayer, ChConfig.Def_Effect_Reborn)
if not rebornItem:
GameWorld.ErrLog("¸´»îµÀ¾ß²»×㣬ÎÞ·¨ÔµØ¸´»î! ", playerID)
return
if isDoCost:
ItemCommon.DelItem(curPlayer, rebornItem, 1, True, "Reborn")
return True
def __DoPlayerReborn(curPlayer, rebornType, tick, mapBornPlace=0, isAddSuperBuff=True):
## Ö´ÐÐÍæ¼Ò¸´»îÂß¼£¬¸Ãº¯ÊýûÓÐÖ´ÐÐÑéÖ¤ÊÇ·ñ¿É¸´»îµÈ£¬²»¿ÉÖ±½Óµ÷ÓÃ
resetHpPercent = ChConfig.Def_MaxRateValue
isFBReborn = False
if rebornType == ChConfig.rebornType_City:
if FBLogic.OnPlayerReborn():
isFBReborn = True
else:
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsReBorn, 1)
elif rebornType == ChConfig.rebornType_MainCity:
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsReBorn, 2)
#֪ͨ¿Í»§¶ËÍæ¼Ò¸´»î³É¹¦
curPlayer.Reborn(rebornType)
#Ö´ÐÐÍæ¼Ò¸±±¾¸´»î
if isFBReborn:
FBLogic.OnResetFBRebornPlacePos(curPlayer, mapBornPlace, tick)
#¸´»î¼ÓÎÞµÐBuff
if isAddSuperBuff:
SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer , ChConfig.Def_SkillID_LimitSuperBuff, tick)
#¸´»îÆ£ÀÍBUff
if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IsAddReviveTired):
__AddReviveTired(curPlayer, tick)
#¸´»îºóÇå³ý½ÇÉ«ÉíÉϵĴòBOSSºÍPK״̬
validTime = IpyGameDataPY.GetFuncCfg("PKConfig", 4) * 1000
if PlayerState.IsInPKState(curPlayer):
PlayerState.SetPKStateTick(curPlayer, tick - validTime)
if PlayerState.IsInBossState(curPlayer):
PlayerState.SetBossStateTick(curPlayer, tick- validTime)
#ÖØËãÊôÐÔ
playerControl = PlayerControl.PlayerControl(curPlayer)
playerControl.RefreshAllState()
#ÉèÖÃѪÁ¿
GameObj.SetHP(curPlayer, GameObj.GetMaxHP(curPlayer) * resetHpPercent / ChConfig.Def_MaxRateValue)
#curPlayer.SetMP(curPlayer.GetMaxMP() * resetMpPercent / ChConfig.Def_MaxRateValue)
#»¤¶Ü
PlayerControl.SetProDef(curPlayer, PlayerControl.GetMaxProDef(curPlayer))
#Íæ¼Ò¸´»îºó¸±±¾´¦Àí
FBLogic.OnPlayerRebornOver(curPlayer, rebornType)
gameMap = GameWorld.GetMap()
#ÕÏ°µãÖÐԵظ´»î, ´ò»ØÖØÉúµã
if (rebornType == ChConfig.rebornType_City and not isFBReborn) \
or not GameWorld.GetMap().CanMove(curPlayer.GetPosX(), curPlayer.GetPosY()) \
or (rebornType == ChConfig.rebornType_MainCity and gameMap.GetRebornMapID() == curPlayer.GetMapID()):
#Íæ¼ÒÇл»µ½ÖØÉúµã
playerControl.SetToBornPlace()
elif rebornType == ChConfig.rebornType_MainCity:
#Ö±½ÓÈ¡dbÖÐÅäÖõĸ´»îµã
PlayerControl.PlayerResetWorldPos(curPlayer, gameMap.GetRebornMapID(), gameMap.GetRebornMapX(), gameMap.GetRebornMapY(), False)
#ÖØÐÂÕÙ»½³èÎï
PlayerPet.AutoSummonPet(curPlayer)
#¸´»î³É¹¦,ÖØÖÃ״̬
PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)
return
def __AddReviveTired(curPlayer, tick):
## Ôö¼Ó¸´»îÆ£ÀÍ
findBuff = SkillCommon.FindBuffByID(curPlayer, ChConfig.Def_SkillID_ReviveTired)[0]
if findBuff:
buffSkillLV = findBuff.GetSkill().GetSkillLV()
if findBuff.GetSkill().GetSkillMaxLV() != buffSkillLV:
buffSkillLV = buffSkillLV + 1
else:
buffSkillLV = 1
SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer , ChConfig.Def_SkillID_ReviveTired, tick, buffSkillLV)
GameWorld.DebugLog(' ¸´»îÆ£ÀÍBUff buffSkillLV=%s'%(buffSkillLV))
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IsAddReviveTired,0)
return
def PlayerRebornByType(curPlayer, rebornType, tick, mapBornPlace=0, isAddSuperBuff=True):
''' Íæ¼Ò¸´»î
'''
gameMap = GameWorld.GetMap()
if not __CheckCanReborn(curPlayer, rebornType, gameMap):
return
if not GameWorld.IsCrossServer():
if not __RebornCost(curPlayer, rebornType, True):
return
__DoPlayerReborn(curPlayer, rebornType, tick, mapBornPlace, isAddSuperBuff)
return True
#---------------------------------------------------------------------
##¸±±¾½Ó¿Ú:Íæ¼Ò¸´»î
#@param curPlayer Íæ¼ÒʵÀý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¸±±¾½Ó¿Ú:Íæ¼Ò¸´»î
def PlayerReborn_InFB(curPlayer, rebornType, tick):
mapType = GameWorld.GetMap().GetMapFBType()
#²»ÔÚ¸±±¾ÖÐ
if mapType == IPY_GameWorld.fbtNull:
return
FBLogic.DoFBOnReborn(curPlayer, rebornType, tick)
return
#---------------------------------------------------------------------
#===============================================================================
# //03 11 ʹÓöÍÔì¯#tagCUseMakeStove
# tagCUseMakeStove * GettagCUseMakeStove();
#
# class IPY_CUseMakeStove
# {
# public:
# //ÎÞÒâÒå
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 11 ʹÓöÍÔì¯#tagCUseMakeStove
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 11 ʹÓöÍÔì¯#tagCUseMakeStove
def PlayerUseMakeStove(index , tick):
#===============================================================================================
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#
# #¹¦ÄÜ¿ªÆôÅжϻ»³É
# #GameFuncComm.GetFuncCanUse(curPlayer, funcID)
#
# #·Ç¿ÕÏÐ״̬ÎÞ·¨Ê¹ÓÃ
# if curPlayer.GetPlayerAction() not in ChConfig.Def_Player_DoEvent_State:
# PlayerControl.NotifyCode(curPlayer, "Factory_Execution_Wrong")
# return
#
# #Òƶ¯Öв»Ö´Ðд˲Ù×÷
# if curPlayer.IsMoving():
# #PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_0")
# return False
#
# #¿ªÊ¼¶ÍÔìʼþ
# ItemCommon.DoLogic_UseStoveEvent(curPlayer)
#===============================================================================================
return
#---------------------------------------------------------------------
#===============================================================================
# //03 12 ²é¿´¼Ò×åÕ½ÅÅÆÚ#tagCGetFamilyWarTime
# tagCGetFamilyWarTime * GettagCGetFamilyWarTime();
#
# class IPY_CGetFamilyWarTime
# {
# public:
# //ÎÞÒâÒå
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 12 ²é¿´¼Ò×åÕ½ÅÅÆÚ#tagCGetFamilyWarTime
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 12 ²é¿´¼Ò×åÕ½ÅÅÆÚ#tagCGetFamilyWarTime
def QueryFamilyWarPlan(index, tick):
#===================================================================================================
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#
# if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_QueryFamilyWar, tick):
# #²Ù×÷¹ýÓÚƵ·±
# return
#
# if curPlayer.GetFamilyID() == 0:
# #ÎÞ¼Ò×å²»²éѯ
# return
#
# #¿ªÊ¼²éѯ
# curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_sqtFamilyWar, 0, '', '', 0)
#===================================================================================================
return
#-------------------------------------------------------------------
#===============================================================================
# //03 13 ²éѯïÚ³µÎ»ÖÃ#tagCGetTruckPos
# tagCGetTruckPos * GettagCGetTruckPos();
#
# class IPY_CGetTruckPos
# {
# public:
# //ÎÞÒâÒå
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 13 ²éѯïÚ³µÎ»ÖÃ#tagCGetTruckPos
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 13 ²éѯïÚ³µÎ»ÖÃ#tagCGetTruckPos
def QueryTruckPos(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
# GameWorld.Log('½øÈëïÚ³µ²éѯ ID:%s'%curPlayer.GetID())
if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_QueryTruckPos) <= ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_QueryTruckPos]:
#²éѯ¹ýÓÚƵ·±
PlayerControl.NotifyCode(curPlayer, "Old_hgg_31379")
return
curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_QueryTruckPos, tick)
#¿ªÊ¼²éѯ
curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_sqtTruck, curPlayer.GetTruckID(), 'TruckPos', '', 0)
return
#---------------------------------------------------------------------
#===============================================================================
# //03 14 ´«ËÍïÚ³µÎ»ÖÃ#tagCMoveToTruckPos
# tagCMoveToTruckPos * GettagCMoveToTruckPos();
#
# class IPY_CMoveToTruckPos
# {
# public:
# //ÎÞÒâÒå
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 14 ´«ËÍïÚ³µÎ»ÖÃ#tagCMoveToTruckPos
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 14 ´«ËÍïÚ³µÎ»ÖÃ#tagCMoveToTruckPos
def MoveToTruckPos(index, tick):
#===============================================================================
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#
# if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_MoveToTruckPos) <= ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_MoveToTruckPos]:
# #´«Ë͹ýÓÚƵ·±
# PlayerControl.NotifyCode(curPlayer, "Convey_Car_Frequently")
# return
#
# curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_MoveToTruckPos, tick)
#
# #Åж¨Íæ¼Ò״̬
# if not PlayerControl.CheckTransState(curPlayer):
# return
#
# #Õ½¶·×´Ì¬²»ÈÃÍæ¼Ò´«ËÍ
# if curPlayer.IsBattleState():
# PlayerControl.NotifyCode(curPlayer, "CannotAtk09")
# return
#
# #¿ªÊ¼´«ËÍ
# curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_sqtTruck, curPlayer.GetTruckID(), 'MoveToTruck', '', 0)
#===============================================================================
return
#---------------------------------------------------------------------
#===============================================================================
# //03 15 ¿ªÊ¼Ô¶³Ì¼ø¶¨#tagCRemoteIdentify
# tagCRemoteIdentify * GettagCRemoteIdentify();
#
# class IPY_CRemoteIdentify
# {
# public:
# //ÎÞÒâÒå
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 15 ¿ªÊ¼Ô¶³Ì¼ø¶¨#tagCRemoteIdentify
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 15 ¿ªÊ¼Ô¶³Ì¼ø¶¨#tagCRemoteIdentify
def FarIdentify(index, tick):
#¹Ø±Õ´Ë¹¦ÄÜ
return
#---------------------------------------------------------------------
#===============================================================================
# //03 16 µÃµ½¸±±¾×´Ì¬#tagCGetFBState
# tagCGetFBState * GettagCGetFBState();
#
# class IPY_CGetFBState
# {
# public:
# //ÎÞÒâÒå
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦//03 16 µÃµ½¸±±¾×´Ì¬#tagCGetFBState
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦//03 16 µÃµ½¸±±¾×´Ì¬#tagCGetFBState
def GetFBState(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_FBState) < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_FBState]:
#²éѯ¹ýÓÚƵ·±
return
curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_FBState, tick)
if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull:
#ÆÕͨµØͼ²»²éѯ
return
FBLogic.DoGetFBState(curPlayer , tick)
return
#---------------------------------------------------------------------
#===============================================================================
# //03 19 ¸±±¾°ïÖú½çÃæ#tagCFbHelp
# tagCFbHelp * GettagCFbHelp();
#
# class IPY_CFbHelp
# {
# public:
# //ÎÞÒâÒå
# int GetType();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 19 ¸±±¾°ïÖú½çÃæ#tagCFbHelp
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 19 ¸±±¾°ïÖú½çÃæ#tagCFbHelp
#¸±±¾°ïÖú½çÃæ
def FBHelp(index , tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
if not curPlayer.GetMapLoadOK():
#Íæ¼ÒδµÇ½³É¹¦¸±±¾²»´¦Àí
return
if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_FBHelp) < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_FBHelp]:
#²éѯ¹ýÓÚƵ·±
return
curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_FBHelp, tick)
# if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull:
# #ÆÕͨµØͼ²»²éѯ
# return
FBLogic.DoFBHelp(curPlayer , tick)
return
#---------------------------------------------------------------------
#---------------------------------------------------------------------
#// C1 05 ½øÈë¿ç·þµØͼ #tagCMEnterCrossServer
#
#struct tagCMEnterCrossServer
#{
# tagHead Head;
# DWORD DataMapID;
# WORD LineID;
#};
def OnEnterCrossServer(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
PlayerControl.PlayerEnterCrossServer(curPlayer, clientData.DataMapID, clientData.LineID)
return
#===============================================================================
# //03 21 ½øÈ븱±¾»î¶¯#tagCEnterFbGameEvent
# tagCEnterFbGameEvent * GettagCEnterFbGameEvent();
#
# class IPY_CEnterFbGameEvent
# {
# public:
# //µØͼID
# int GetMapID();
# //ÏßID
# int GetLineID();
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 21 ½øÈ븱±¾»î¶¯#tagCEnterFbGameEvent
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 21 ½øÈ븱±¾»î¶¯#tagCEnterFbGameEvent
def EnterFbGameEvent(index, tick):
GameWorld.GetPsycoFunc(__Func_EnterFbGameEvent)(index, tick)
return
##¿Í»§¶Ë·â°üÏìÓ¦ //03 21 ½øÈ븱±¾»î¶¯#tagCEnterFbGameEvent
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 21 ½øÈ븱±¾»î¶¯#tagCEnterFbGameEvent
def __Func_EnterFbGameEvent(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
sendPack = IPY_GameWorld.IPY_CEnterFbGameEvent()
#ÊÕ µØͼºÍÏß·ID
mapID = sendPack.GetMapID()
clientSendLineID = sendPack.GetLineID()
PlayerControl.PlayerEnterFB(curPlayer, mapID, clientSendLineID)
return
#---------------------------------------------------------------------
#===============================================================================
#//07 24 ¶¨µã´«ËÍ#tagCDingDianTransport
#tagHead Head;
#BYTE ItemIndex;
#WORD TransportIndex;
## ¶¨µã´«ËÍ
# @param index Íæ¼ÒË÷Òý
# @param tick µ±Ç°Ê±¼ä
# @return None
# @remarks º¯ÊýÏêϸ˵Ã÷.
def PointTransport(index, tick):
#===============================================================================
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
# # if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_WorldTransport, tick):
# # #¼ä¸ôδµ½
# # return
# sendPack = IPY_GameWorld.IPY_CDingDianTransport()
# lineID = sendPack.GetItemIndex() #±¾ÏîÄ¿ÓÃÀ´Ö¸¶¨´«Ë͵ÄÄ¿±êÏß·, -1ΪĬÈÏ
# sendPack_TransportIndex = sendPack.GetTransportIndex() #´«Ë͵ãË÷Òý
# lineID = lineID if lineID > 0 else -1
#
# if not PlayerControl.CheckPlayerTransport(curPlayer):
# #Íæ¼Òµ±Ç°×´Ì¬²»¿É´«ËÍ
# return
# PointTransportList = ReadChConfig.GetEvalChConfig('PointTransport')
# PointCount = len(PointTransportList)
# #Ë÷Òý´íÎó
# if sendPack_TransportIndex < 0 or sendPack_TransportIndex >= PointCount:
# return
# curPointDict = PointTransportList[sendPack_TransportIndex]
#
# mapID = curPointDict["MapID"]
# lvLimit = curPointDict["LVLimit"]
# posX = curPointDict["PosX"]
# posY = curPointDict["PosY"]
# money = curPointDict["Money"]
# moneyType = curPointDict["MoneyType"]
#
# #Ö°ÒµÏÞÖÆ
# if lvLimit > curPlayer.GetLV():
# #¶Ô²»Æ𣬸ó¡¾°ÐèÒªXX¼¶²ÅÄܽøÈë!
# PlayerControl.NotifyCode(curPlayer, "Carry_hwj35_0", [lvLimit])
# return
# #½ðÇ®ÏÞÖÆ
# if not PlayerControl.HaveMoneyEx(curPlayer, moneyType, money):
# return
# #Ä¿±êµØͼÅжϣ¨´æÔÚ·ñ£¬µÐ¹ú£¬¸±±¾£©
# if not PlayerControl.CheckTagCountry(curPlayer, mapID):
# return
#
# #×ø±êµãÅжÏ
# posX, posY = GetTransportPos(curPlayer, 0, mapID, posX, posY)
# if (posX, posY) == (0, 0):
# #04BBF813-7A30-47A8-927DE1ACCC4F378E Ä¿±êµãΪÕÏ°µã
# PlayerControl.NotifyCode(curPlayer, "04BBF813-7A30-47A8-927DE1ACCC4F378E")
# return
#
# if BeginTrans(curPlayer, mapID, posX, posY, lineID=lineID):
# curPlayer.SetDict(ChConfig.Def_PlayerKey_TransMoney, money)
# curPlayer.SetDict(ChConfig.Def_PlayerKey_TransMoneyType, moneyType)
# curPlayer.SetDict(ChConfig.Def_PlayerKey_TransType, ChConfig.Def_Transport_Type_FixedPoint)
# else:
# #ûÓнø¶ÈÌõ£¬Ö±½Ó¿ÛÈ¡
# infoDict = {ChConfig.Def_Cost_Reason_SonKey:mapID}
# PlayerControl.PayMoney(curPlayer, moneyType, money, ChConfig.Def_Cost_Transport, infoDict)
#
#===============================================================================
#PlayerControl.PlayerResetWorldPos(curPlayer, MapID, PosX, PosY, False)
#PlayerControl.NotifyCode(curPlayer, "Map_Deliver_Succeed", [MapID])
return
#===============================================================================
# # 04 04 ºÃÓÑ´«ËÍ #tagCFriendTransport
# #
# #struct tagCFriendTransport
# #{
# # tagHead Head;
# # DWORD FriendID;
# # Byte ExtField1;
# #};
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ 04 04 ºÃÓÑ´«ËÍ #tagCFriendTransport
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ 04 04 ºÃÓÑ´«ËÍ #tagCFriendTransport
def FriendTransPort(index, tick):
return
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#
# if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_FlyToFriend, tick):
# #¼ä¸ôδµ½
# return
#
# sendPack = IPY_GameWorld.IPY_CFriendTransport()
# sendPack_FriendID = sendPack.GetFriendID()
# sendPack_IsAutoBuy = sendPack.GetExtField1()
#
# if not curPlayer.FindFriend(sendPack_FriendID):
# #È·ÈϺÃÓÑʧ°Ü
# return
#
# if not PlayerControl.CheckPlayerTransport(curPlayer):
# #Íæ¼Òµ±Ç°×´Ì¬²»¿É´«ËÍ
# return
#
# type = ChConfig.Def_Transport_Type_Friend
# if not TransportVipLvRestrict(curPlayer, type):
# #vipµÈ¼¶ÏÞÖÆ
# return
#
# transportPayDict = ReadChConfig.GetEvalChConfig('TransportPay')
# payInfo = transportPayDict.get(type)
#
# if payInfo == None:
# GameWorld.ErrLog("±íTransportPayÐÅÏ¢´íÎó ûÓжÔÓ¦ÀàÐÍ %s" % (type))
# return
#
#
# #ÎïÆ·ID£¬ ÎïƷЧ¹ûÖµ£¬ ¸¶·ÑÀàÐÍ£¬½ð¶î
# itemID, itemEffectID, moneyType, money = payInfo
#
# #֪ͨÏû·Ñ·½Ê½
# sendPayType = ChConfig.Def_FriendTransPort_UseItem
# #ʹÓõÀ¾ß´«ËÍ
# useItem = ItemCommon.FindItemInPackByEffectEx(curPlayer, itemEffectID)
#
# #ûÓÐÎïÆ·
# if useItem == None:
# if sendPack_IsAutoBuy:
# #ûÓÐÇ®
# if not PlayerControl.HaveMoneyEx(curPlayer, moneyType, money):
# return
#
# #½ðÇ®Ïû·Ñ
# sendPayType = ChConfig.Def_FriendTransPort_UseMoney
# else:
# #ÎïÆ·²»×ã
# PlayerControl.NotifyCode(curPlayer, "GeRen_pan_861048", [itemID])
# return
#
# sendMsg = '%s' % (sendPayType)
#
# #²éѯ²¢´«ËÍ
# curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_sqtPlayer, sendPack_FriendID,
# 'FlytoFriendByID', sendMsg, len(sendMsg))
#---------------------------------------------------------------------
#===============================================================================
#04 05 ÊÀ½ç´«ËÍtagCWorldTransfer
#
# struct tagCWorldTransfer
# {
# tagHead Head;
# DWORD MapID;
# WORD PosX;
# WORD posY;
# BYTE ExtField1;
# };
#===============================================================================
##
##¿Í»§¶Ë·â°üÏìÓ¦ 04 05 ÊÀ½ç´«ËÍtagCWorldTransfer
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ 04 05 ÊÀ½ç´«ËÍtagCWorldTransfer
def WorldTransPort(index, tick):
#---»ñÈ¡·â°üÐÅÏ¢---
packUseItem = IPY_GameWorld.IPY_CWorldTransfer()
packTransportType = packUseItem.GetType()
mapID = packUseItem.GetMapID()
posX = packUseItem.GetPosX()
posY = packUseItem.GetPosY()
lineID = packUseItem.GetExtField1()
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
__Func_WorldTransPort(curPlayer, packTransportType, mapID, posX, posY, tick, lineID)
return
#// B0 05 ¿ªÊ¼ÊÀ½ç´«ËÍ #tagCMWorldTransfer
#
#struct tagCMWorldTransfer
#{
# tagHead Head;
# BYTE Type;
# DWORD MapID;
# BYTE LineID;
# WORD PosX;
# WORD PosY;
# DWORD ExData1; //À©Õ¹×Ö¶Î1£¬¸÷¸öÏîÄ¿¸ù¾Ý×Ô¼ºµÄÐèÒª¾ö¶¨ÓÃ;
#};
def PYWorldTransPort(index, clientPack, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
packTransportType = clientPack.Type
mapID = clientPack.MapID
lineID = clientPack.LineID
posX = clientPack.PosX
posY = clientPack.PosY
exData1 = clientPack.ExData1
__Func_WorldTransPort(curPlayer, packTransportType, mapID, posX, posY, tick, lineID, exData1)
return
def __Func_WorldTransPort(curPlayer, packTransportType, mapID, posX, posY, tick, lineID=-1, exData1=0):
if curPlayer.GetMapID() != mapID:
#ÑéÖ¤¼ä¸ô
if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_WorldTransport) < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_WorldTransport]:
#ûµ½¼ä¸ô
return
curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_WorldTransport, tick)
playerID = curPlayer.GetPlayerID()
GameWorld.DebugLog("WorldTransPort packTransportType=%s,mapID=%s,lineID=%s,exData1=%s"
% (packTransportType, mapID, lineID, exData1), playerID)
lineID = -1 if lineID == 255 else lineID
if GameWorld.IsCrossServer():
if curPlayer.GetMapID() != mapID:
return
lineID = -1 # ¿ç·þĬÈÏÖ»Äܱ¾Ïß
#ÊÀ½ç´«ËÍ·â°üÔÊÐíÀàÐÍ£¨ÊÀ½ç£¬´óµØͼ£¬ÈÎÎñ£©
if packTransportType not in ChConfig.Def_PackType_TransportType.keys():
GameWorld.ErrLog('WorldTransPort packTransportType = %s, NoFind' % (packTransportType), playerID)
return
transportType = ChConfig.Def_PackType_TransportType.get(packTransportType)
# ·þÎñ¶ËÔݲ»×öVIPµÈ¼¶´«ËÍÏÞÖÆ£¬ÓÉ¿Í»§¶Ë¿ØÖÆ
# if not TransportVipLvRestrict(curPlayer, transportType):
# return
#¼ì²éÍæ¼Ò״̬
if not PlayerControl.CheckPlayerTransport(curPlayer):
return
#Ä¿±êµØͼÅжϣ¨´æÔÚ·ñ£¬µÐ¹ú£¬¸±±¾£©
if not PlayerControl.CheckTagCountry(curPlayer, mapID):
return
#×ø±êµãÅжÏ
posX, posY = GetTransportPos(curPlayer, packTransportType, mapID, posX, posY)
if (posX, posY) == (0, 0):
#04BBF813-7A30-47A8-927DE1ACCC4F378E Ä¿±êµãΪÕÏ°µã
PlayerControl.NotifyCode(curPlayer, "04BBF813-7A30-47A8-927DE1ACCC4F378E")
return
#ÊÇÈÎÎñ´«ËÍ£¬VIPµÈ¼¶²»¹»£¬ÇÒ´«ËÍ·û²»×㣬²»´¦Àí
if transportType == ChConfig.Def_Transport_Type_Mission and \
not TransportVipLvRestrict(curPlayer, transportType) and \
not PayForTransport(curPlayer, transportType):
return
#¿ªÊ¼´«ËÍ
curPlayer.SetDict(ChConfig.Def_PlayerKey_TransType, transportType)
#curPlayer.SetDict(ChConfig.Def_PlayerKey_TransAutoBuyItem, isAutoBuy)
BeginTrans(curPlayer, mapID, posX, posY, lineID=lineID, exData1=exData1)
return
## ¿ªÊ¼´«ËÍ
# @param curPlayer Íæ¼ÒʵÀý
# @param mapID µØͼID
# @param posX ×ø±êX
# @param posY ×ø±êY
# @param takeTruck ÊÇ·ñЯ´øïÚ³µ
# @param lineID Ïß·ID -1´ú±íµ±Ç°Ïß
# @param msg Çл»µØͼЯ´øµÄÐÅÏ¢
# @param canLock ÊÇ·ñ¿ÉÒÔËø¶¨Íæ¼Ò(´«Ë͵㲻¿ÉËø¶¨, ÒòΪҪ¿çµØͼѰ·)
# @return: ÊÇ·ñÔÚÀ½ø¶ÈÌõ
def BeginTrans(curPlayer, mapID, posX, posY, takeTruck=False, lineID= -1, msg='', canLock=True, exData1=0):
#===========================================================================
# if PlayerControl.IsPlayerInFight(curPlayer):
# #¼Ç¼´«ËÍ×ø±ê, ÓÃÓÚ½ø¶ÈÌõ½áÊøºó´«ËÍ
# curPlayer.SetDict(ChConfig.Def_PlayerKey_TransMapId, mapID)
# curPlayer.SetDict(ChConfig.Def_PlayerKey_TransPosX, posX)
# curPlayer.SetDict(ChConfig.Def_PlayerKey_TransPosY, posY)
#
# #Õ½¶·×´Ì¬ÖÐÀ½ø¶ÈÌõ
# PlayerControl.Sync_PrepareBegin(curPlayer, ChConfig.Def_TransTime,
# ShareDefine.Def_PstTrans)
# return True
#===========================================================================
PlayerControl.PlayerResetWorldPos(curPlayer, mapID, posX, posY, takeTruck, lineID, msg, canLock, exData1)
#PlayerControl.NotifyCode(curPlayer, "Map_Deliver_Succeed", [mapID])
return False
##È¡µÃÕýÈ·´«ËÍ×ø±ê
#@param curPlayer Íæ¼ÒʵÀý
#@param transportType ´«ËÍÀàÐÍ
#@param transportMapID ·â°üµØͼID
#@param posX ·â°üµØͼposX
#@param posY ·â°üµØͼposY
#@return ×ø±êµã
#@remarks È¡µÃÕýÈ·´«ËÍ×ø±ê
def GetTransportPos(curPlayer, transportType, transportMapID, transportPosX, transportPosY):
#---ÊÀ½ç´«ËÍÂß¼ÌØÊâ´¦Àí---
#===========================================================================
# if transportType == ShareDefine.Def_Transport_World:
# cityPosDict = ReadChConfig.GetEvalChConfig('Def_List_City_Pos')
#
# posInfo = cityPosDict.get(transportMapID)
#
# if posInfo == None:
# #ÎÞ·¨²éÕÒºÏÊʵÄ×ø±ê
# return 0, 0
#
# transportPosX, transportPosY = posInfo
#===========================================================================
#---¹«ÓÃ×ø±êµã¼ì²âÂß¼---
if curPlayer.GetMapID() == transportMapID:
#±¾µØͼÐèÒªÑéÖ¤ÊÇ·ñÕÏ°µã
if not GameWorld.GetMap().CanMove(transportPosX, transportPosY):
transportPosX, transportPosY = GameMap.GetNearbyPosByDis(transportPosX, transportPosY, ChConfig.Def_RebornPos_Area_Range)
return transportPosX, transportPosY
##´«ËÍÏûºÄ´¦Àí
#@param curPlayer Íæ¼Ò
#@param transportType ´«ËÍÀàÐÍ
#@return BOOL Ö§¸¶ÊÇ·ñ³É¹¦
#@remarks ´«ËÍÏûºÄ´¦Àí
def PayForTransport(curPlayer, transportType):
itemID = IpyGameDataPY.GetFuncCfg('TransportPay')
if not itemID:
return True
useCount = 1 # ÏûºÄÊýÁ¿
itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
hasEnough, itemList = ItemCommon.GetItem_FromPack_ByID(itemID, itemPack, useCount)
if not hasEnough:
#µÀ¾ß²»¹»Ä¬ÈÏ¿ÛÇ®
costMoney = IpyGameDataPY.GetFuncCfg('TransportPay', 2)
if not TransportPayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Paper, costMoney, transportType, ChConfig.GMTool_Offline_WorldTransfer):
GameWorld.DebugLog(' ´«ËÍÏûºÄ´¦Àí ´«Ë͵À¾ß²»×ã itemID=%s, ǮҲ²»¹»costMoney=%s'%(itemID, costMoney))
return False
else:
ItemCommon.ReduceItem(curPlayer, itemPack, itemList, useCount, False)
return True
## ´«ËÍvipµÈ¼¶ÏÞÖÆ
# @param curPlayer Íæ¼ÒʵÀý
# @param transportType ´«ËÍÀàÐÍ
# @return ÊÇ·ñvipµÈ¼¶ÏÞÖÆ
def TransportVipLvRestrict(curPlayer, transportType):
return PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_FreeTransport)
#---------------------------------------------------------------------
##´«Ë͸¶·Ñ¼Ç¼
#@param curPlayer Íæ¼ÒʵÀý
#@param moneyType ¸¶·ÑÀàÐÍ
#@param money ¼Û¸ñ
#@param transportType ´«ËÍÀàÐÍ
#@param noteMark ¼Ç¼ÀàÐÍ
#@return ·µ»ØÖµÕæ, ¿Û·Ñ³É¹¦
#@remarks ´«Ë͸¶·Ñ¼Ç¼
def TransportPayMoney(curPlayer, moneyType, money, transportType, noteMark):
moneyList = PlayerControl.HaveMoneyEx(curPlayer, moneyType, money)
if moneyList == []:
return False
for moneyType, money in moneyList:
if money > 0:
PlayerControl.PayMoney(curPlayer, moneyType, money, ChConfig.Def_Cost_Transport,
{"TransportType":transportType})
GameWorld.Login_Interface_GoldRec(curPlayer, transportType, 0, 'TransportType',
moneyType, money)
return True
#//03 26 ÊÖ¶¯Éý¼¶#tagCUserLVUp
#////////////////////////////////////////////////////////////////
#
#class IPY_CUserLVUp
#{
#private:
# CUserLVUp * m_Instance;
#public:
# //³õʼ»¯
# IPY_CUserLVUp();
#----------------------------
##¿Í»§¶Ë·â°üÏìÓ¦ //03 26 Íæ¼ÒÉý¼¶ÇëÇó#tagCUserLVUp
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ 03 26 Íæ¼ÒÉý¼¶ÇëÇó#tagCUserLVUp
def PlayerLvUpRequest(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#---¿ªÊ¼Éý¼¶---
playerControl = PlayerControl.PlayerControl(curPlayer)
#²ÎÊýÌîTrue±íʾÊÖ¶¯Éý¼¶ ÔÚÈËÎï´ïµ½20¼¶ÒÔºó»áµ÷ÓÃÒ»´ÎÈËÎï»áÉýÒ»¼¶
playerControl.PlayerLvUp(True)
return
#---------------------------------------------------------------------
#===============================================================================
# //03 2B Ë«±¶¾Ñ鼤»î/Í£Ö¹/²éѯ#tagCDoubleExp
#
# struct tagCDoubleExp
# {
# tagHead Head;
# BYTE Type; //1-¼¤»î;2-Í£Ö¹;3-²éѯ
#
# };
#===============================================================================
##¿Í»§¶Ë·â°üÏìÓ¦ //03 2B Ë«±¶¾Ñ鼤»î/Í£Ö¹/²éѯ#tagCDoubleExp
#@param index Íæ¼ÒË÷Òý
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 2B Ë«±¶¾Ñ鼤»î/Í£Ö¹/²éѯ#tagCDoubleExp
def DoubleExpState(index, tick):
return
## 03 31 ¸±±¾Íæ¼Ò¼¤»îÌØÊâ¼¼ÄÜ
# @param index Íæ¼ÒË÷Òý
# @param tick ʱ¼ä´Á
# @return ÎÞ·µ»ØÖµ
# @remarks ¸±±¾Íæ¼Ò¼¤»îÌØÊâ¼¼ÄÜ
def UseFBSpecilSkill(index, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
fbSkillPack = IPY_GameWorld.IPY_CFBSpecilSkill()
useType = fbSkillPack.GetType()
useState = fbSkillPack.GetState()
FBLogic.UseFBSpecilSkill(curPlayer, useType, useState, tick)
#---------------------------------------------------------------------
#===============================================================================
#//A2 05 ÇëÇó¶Ò»»ÀëÏß¾Ñé·â°ü#tagPyCMOfflineExpExchange
#struct tagPyCMOfflineExpExchange
#{
# tagHead Head;
# BYTE Index; //¾Ñ鱶ÂÊË÷Òý
# DWORD ExchangeTime; //¶Ò»»Ê±¼ä
#};
#===============================================================================
##//A2 05 ÇëÇó¶Ò»»ÀëÏß¾Ñé·â°ü#tagPyCMOfflineExpExchange
#@param index Íæ¼ÒË÷Òý
#@param curPackData ·â°ü½á¹¹Ìå
#@param tick ʱ¼ä´Á
#@return ·µ»ØÖµÎÞÒâÒå
#@remarks ÀëÏß¾Ñé¶Ò»»
def PlayerExpExchange(index, curPackData, tick):
# ¿ç·þ·þÎñÆ÷¹¦ÄÜÏÞÖÆ
if GameWorld.IsCrossServer():
return
#¶Ò»»¹«Ê½×Öµä
OfflineExpChangeDict = ReadChConfig.GetEvalChConfig("OfflineSys_ExpChange")
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#ÊÕ°ü×Ö¶Î
mulIndex = curPackData.Index # ¾Ñ鱶ÂÊË÷Òý
exchangeTime = curPackData.ExchangeTime #¶Ò»»Ê±¼ä£¨·ÖÖÓ£©
recList = OfflineExpChangeDict.get(int(mulIndex)) # ¸ù¾ÝË÷Òý»ñÈ¡¼Ç¼
if not recList: # ÕÒ²»µ½¼Ç¼
GameWorld.ErrLog('ÀëÏß¾Ñé¶Ò»»Ë÷Òý´íÎóindex=%s' % mulIndex)
return
#×îСvipµÈ¼¶ÏÞÖÆ
minVIPLv = recList[0]
#vipµÈ¼¶
VIPLv = curPlayer.GetVIPLv()
#ҪʹÓõÄʱ¼ä
useMinutes = exchangeTime
#ÀëÏßÀÛ»ýʱ¼ä
haveMinutes = curPlayer.GetOfflineMinutes()
if VIPLv < minVIPLv:
GameWorld.ErrLog("ÀëÏß¹Ò»ú·â°ü¶Ò»»¾ÑéÒì³££¬Íæ¼ÒvipµÈ¼¶ %s, ÏÔʾµÄvipµÈ¼¶ %s £¬" % (VIPLv, minVIPLv))
return
if useMinutes > haveMinutes :
GameWorld.ErrLog("ÀëÏß¹Ò»ú·â°ü¶Ò»»¾ÑéÒì³££¬¶Ò»»Ê±¼ä %s, ÀÛ»ýʱ¼ä %s £¬" % (useMinutes, haveMinutes))
return
#²Î¿¼¾Ñé
rExp = PlayerControl.GetPlayerReExp(curPlayer)
reLV = curPlayer.GetLV() #²Î¿¼µÈ¼¶
worldLvExpRate = PlayerWorldAverageLv.GetWorldAverageLvExpRate(curPlayer) #ÊÀ½çµÈ¼¶¾Ñé¼Ó³É
#¾Ñ鹫ʽ
redeemExp = int(eval(recList[1]))
#»õ±ÒÐÅÏ¢Áбí
moneyInfoList = recList[2]
#»õ±ÒÀàÐÍ
moneyType = int(moneyInfoList[0])
#ÏûºÄµÄ»õ±Ò¹«Ê½
costMoney = int(eval(moneyInfoList[1]))
playerControl = PlayerControl.PlayerControl(curPlayer)
# #³¬¹ý¾Ñé´¢´æÉÏÏÞ£¬²»Óè¶Ò»»¾Ñé
# if redeemExp + curPlayer.GetTotalExp() > ChConfig.Def_UpperLimit_DWord:
# PlayerControl.NotifyCode(curPlayer, "ExpChange_lhs_31379")
# return
haveMoneyList = PlayerControl.HaveMoneyEx(curPlayer, moneyType, costMoney)
if not haveMoneyList:#½ðÇ®²»×ã
return
#¿Û½ðÇ®
for moneyType, moneyCnt in haveMoneyList:
if not PlayerControl.PayMoney(curPlayer, moneyType, moneyCnt, ChConfig.Def_Cost_OffLineExp,
{"ChangeTime":useMinutes, "Index":mulIndex, ChConfig.Def_Cost_Reason_SonKey:mulIndex}): # ½ðÇ®²»×ã
GameWorld.ErrLog('¸ßЧÁ·¹¦£¬£¬½ðÇ®²»×ã##PlayerControl=%s,,moneyCnt=%s' % (PlayerControl, moneyCnt))
return
playerControl.AddExp(redeemExp) # ¼Ó¾Ñé
offlineTime = int(max(haveMinutes - useMinutes, 0)) # ¿ÛÀëÏßʱ¼ä
curPlayer.SetOfflineMinutes(offlineTime) # ÉèÖÃÀëÏßʱ¼ä
curPlayer.Syn_OfflineTimeQueryResult() # ֪ͨ¿Í·þ¶ËÀëÏßʱ¼ä
return
#------------------------------------------------------------------------------
## //A0 09 ¹ºÂò´óµØͼ±ê¼Çµã# tagPyBuyMapSignPoint
# @param index Íæ¼ÒË÷Òý
# @param curPackData ·â°ü½á¹¹Ìå
# @param tick ʱ¼ä´Á
# @return None
def BuyMapSignCount(index, curPackData, tick):
# curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
# curVipLv = curPlayer.GetVIPLv()
#
# curMapsignCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PlayerMapSignCnt)
#
# #if curMapsignCnt >= min(PlayerVip.GetVipCanBuyTransportPointCnt(curVipLv), ChConfig.Def_Player_MapSignPointMaxCount):
# # #ÒѾȫ²¿¿ªÍ¨»òµ±Ç°vipµÈ¼¶Ö»ÄÜÂòÕâô¶à
# # return
# if curMapsignCnt >= ChConfig.Def_Player_MapSignPointMaxCount:
# #ÒѾȫ²¿¿ªÍ¨»òµ±Ç°vipµÈ¼¶Ö»ÄÜÂòÕâô¶à
# return
#
# buyCountIndex = curMapsignCnt + 1
# buyMoneyCostDict = ReadChConfig.GetEvalChConfig("MapSignCountBuyMoney")
# buyMoneyList = buyMoneyCostDict.get(buyCountIndex)
# if buyMoneyList == None:
# GameWorld.ErrLog("¹ºÂò´óµØͼ±êʶλÖà = %s ÔÚMapSignCountBuyMoney.txt±íÖÐÕÒ²»µ½¹ºÂò¼Û¸ñ" % buyCountIndex)
# return
#
# buyMoney = buyMoneyList[0] # ½ðÇ®ÊýÁ¿
# buyMoneyType = buyMoneyList[1] # ½ðÇ®ÀàÐÍ
#
# #¿ÛÇ®
# moneyList = PlayerControl.HaveMoneyEx(curPlayer, buyMoneyType, buyMoney)
# if moneyList == []:
# #½ðÇ®²»×ã
# return
#
# for moneyType, moneyCount in moneyList:
# PlayerControl.PayMoney(curPlayer, moneyType, moneyCount, 'BuyMapSignCount')
#
# curMapsignCnt = PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_PlayerMapSignCnt, buyCountIndex)
#
# #֪ͨ¿Í»§¶ËÊýÁ¿
# OnSendMapSignCnt(curPlayer)
return
## ֪ͨ´óµØͼ±ê¼ÇÊýÁ¿
# @param curPlayer Íæ¼ÒʵÀý
# @return None
def OnSendMapSignCnt(curPlayer):
# curMapsignCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PlayerMapSignCnt)
# mapsignCnt = ChConfig.Def_Player_InitMapSignPointCount + curMapsignCnt
#
# mapSignPointCount = ChPyNetSendPack.tagPyMapSignPointCount()
# mapSignPointCount.Count = mapsignCnt
# NetPackCommon.SendFakePack(curPlayer, mapSignPointCount)
return
#//B0 24 ÁìÈ¡¼Ò×åÐüÉͽ±Àø #tagReceiveFamilyArrestAward
#
#struct tagReceiveFamilyArrestAward
#
#{
# tagHead Head;
# DWORD ArrestID; //ÐüÉÍÈÎÎñID
#};
## ÁìÈ¡¼Ò×åÐüÉͽ±Àø
# @param index: Íæ¼ÒË÷Òý
# @param clientData: ·â°ü½á¹¹Ìå
# @param tick: ʱ¼ä´Á
# @return: None
def ReceiveFamilyArrestAward(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
arrestID = clientData.ArrestID
bit = ShareDefine.Def_ArrestOverState_BitDic.get(arrestID)
if bit == None:
#ûÓÐÕâ¸ö¼Ò×åÐüÉÍÈÎÎñ
GameWorld.DebugLog("ûÓÐÕâ¸ö¼Ò×åÐüÉÍÈÎÎñ arrestID=%s" % arrestID)
return
receiveState = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyArrestAwardState)
if receiveState & pow(2, bit):
#¸ÃÈÎÎñ½±ÀøÒѾÁìÈ¡
GameWorld.DebugLog("¸ÃÈÎÎñ½±ÀøÒѾÁìÈ¡ arrestID=%s" % arrestID)
return
if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_FamilyArrestQueryState) == 1:
#ÒѾÔÚ²éѯÖÐ, ²»Öظ´²éѯ
GameWorld.DebugLog("ÒѾÔÚ²éѯÖÐ, ²»Öظ´²éѯ arrestID=%s" % arrestID)
return
sendMsg = '%s' % arrestID
#ÏòGameServerÇëÇó¸ÃÐüÉÍÈÎÎñÊÇ·ñÒѾÍê³É
curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_FamilyArrest, 0, 'FamilyArrestAward', sendMsg, len(sendMsg))
#ÉèÖÃ״̬²éѯÖÐ
curPlayer.SetDict(ChConfig.Def_PlayerKey_FamilyArrestQueryState, 1)
return
#//B0 26 ÇëÇó¼Ò×åÐüÉͽ±ÀøÁìÈ¡Çé¿ö #tagQueryFamilyArrestAwardReceiveState
#
#struct tagQueryFamilyArrestAwardReceiveState
#
#{
# tagHead Head;
#};
## ÇëÇó¼Ò×åÐüÉͽ±ÀøÁìÈ¡Çé¿ö
# @param index: Íæ¼ÒË÷Òý
# @param clientData: ·â°ü½á¹¹Ìå
# @param tick: ʱ¼ä´Á
# @return: None
def QueryFamilyArrestAwardReceiveState(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
Sync_FamilyArrestAwardReceiveState(curPlayer)
return
## ֪ͨ¿Í»§¶Ë¼Ò×åÐüÉÍÈÎÎñ½±ÀøÁìÈ¡Çé¿ö
# @param curPlayer: Íæ¼ÒʵÀý
# @return: None
def Sync_FamilyArrestAwardReceiveState(curPlayer):
awardReceiveState = ChPyNetSendPack.tagFamilyArrestAwardReceiveState()
awardReceiveState.Clear()
state = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyArrestAwardState)
awardReceiveState.ReceiveState = state
NetPackCommon.SendFakePack(curPlayer, awardReceiveState)
return
## ²éѯÊÇ·ñ»¹ÔÚ¼Ò×åµÄÉêÇëÁбíÖÐ(²»ÔÚÏßʱ±»¾Ü¾øÁË)
# @param curPlayer: Íæ¼ÒʵÀý
# @return: None
def QueryIsResFamily(curPlayer):
familyIDList = []
for index in range(0, ChConfig.Def_Player_RequestAddFamilyMaxCnt):
familyID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RequestAddFamilyID % index)
if familyID == 0:
continue
familyIDList.append(familyID)
#ÏòGameServerÇëÇóÊÇ·ñ»¹ÔڸüÒ×åÉêÇëÁбíÖÐ
sendMsg = str(familyIDList)
curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_RequestIsFamily, curPlayer.GetID(),
'RequestIsFamily', sendMsg, len(sendMsg))
return
#===============================================================================
## ÁìÈ¡½±Àø±í½±Àø
# @param None None
# @return None
def ClientPlayerGetReward(index, clientData, tick):
playerManager = GameWorld.GetPlayerManager()
curPlayer = playerManager.GetPlayerByIndex(index)
# ±³°ü¿Õ¼ä²»×ã
if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem):
PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [IPY_GameWorld.rptItem])
return
rewardType = clientData.RewardType
#֪ͨGameServerÁìÈ¡½±Àø
resultName = str(rewardType)
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, 'PlayerGetReward',
resultName, len(resultName))
return
#//A5 04 Íæ¼ÒÁìÈ¡½±Àø #tagCMPlayerGetReward
#
#struct tagCMPlayerGetReward
#
#{
# tagHead Head;
# BYTE RewardType; //½±ÀøÀàÐÍ
# DWORD DataEx; //¸½´øÐÅÏ¢
# BYTE DataExStrLen; //¸½¼Ó×Ö·ûÐÅÏ¢³¤¶È
# char DataExStr[DataExStrLen]; //¸½¼Ó×Ö·ûÐÅÏ¢
#};
def PlayerGetReward(index, clientData, tick):
playerManager = GameWorld.GetPlayerManager()
curPlayer = playerManager.GetPlayerByIndex(index)
rewardType = clientData.RewardType # ½±ÀøÀàÐÍ
dataEx = clientData.DataEx # ¸½¼ÓÐÅÏ¢
dataExStr = clientData.DataExStr # ¸½¼Ó×Ö·ûÐÅÏ¢
GameWorld.DebugLog("PlayerGetReward: rewardType=%s,dataEx=%s,dataExStr=%s" % (rewardType, dataEx, dataExStr))
# »îÔ¾¶È½±Àø
if rewardType == ChConfig.Def_RewardType_Activity:
PlayerActivity.GetActivityAward(curPlayer, dataEx)
# »îÔ¾·ÅÖý±Àø
elif rewardType == ChConfig.Def_RewardType_ActivityPlace:
PlayerActivity.GetActivityPlaceReward(curPlayer)
# ¹Ò»ú½±Àø
elif rewardType == ChConfig.Def_RewardType_Guaji:
PlayerGuaji.OnGetGuajiAward(curPlayer, dataEx)
# ÿÈÕÃâ·ÑÖ±¹ºÀñ°ü
elif rewardType == ChConfig.Def_RewardType_DayFreeGoldGift:
PlayerDailyGiftbag.OnGetDailyFreeGiftbag(curPlayer)
# ÏÉÃË»îÔ¾¶È½±Àø
elif rewardType == ChConfig.Def_RewardType_FamilyActivity:
PlayerFamily.GetFamilyActivityAward(curPlayer, dataEx)
# ÏÉÃËÁªÈü¹Ú¾üÏÉÃËÿÈÕٺ»½±Àø
elif rewardType == ChConfig.Def_RewardType_ChampionFamilyDailyReward:
GameLogic_FamilyWar.GetChampionFamilyDailyReward(curPlayer)
# ÏÉħ֮ÕùʤÀû³¡Êý½±Àø
elif rewardType == ChConfig.Def_RewardType_XMZZWinCnt:
GameLogic_XMZZ.GetXMZZWinPrize(curPlayer, dataEx)
# ÏÉÃËÿÈÕ¸£Àû½±Àø
elif rewardType == ChConfig.Def_RewardType_FamilyDayAward:
PlayerFamily.GetFamilyDayAward(curPlayer)
# Íæ¼ÒµÈ¼¶½±Àø
elif rewardType == ChConfig.Def_RewardType_LVAward:
PlayerLVAward.GetPlayerLVAward(curPlayer, dataEx)
# Ïɱ¦Ñ°Ö÷½±Àø
elif rewardType == ChConfig.Def_RewardType_XBXZ:
PlayerMagicWeapon.OnGetXBXZAward(curPlayer, dataEx)
# Ê׳äÀñ°ü½±Àø
elif rewardType == ChConfig.Def_RewardType_GoldGiftFirst:
PlayerGoldGift.GetPlayerGoldGiftFirst(curPlayer, dataEx)
# ÁìÈ¡¼«Æ·°×ÄÃ
elif rewardType == ChConfig.Def_RewardType_FreeGoods:
PlayerFreeGoods.OnGetFreeGoods(curPlayer, dataEx)
# ÁìÈ¡Ïû·Ñ·µÀû½±Àø
elif rewardType == ChConfig.Def_RewardType_CostRebate:
PlayerCostRebate.OnGetCostRebateAward(curPlayer, dataEx, dataExStr)
# ÁìÈ¡ÀۼƳäÖµ½±Àø
elif rewardType == ChConfig.Def_RewardType_TotalRecharge:
PlayerActTotalRecharge.OnGetTotalRechargeAward(curPlayer, dataEx, dataExStr)
# ÁìÈ¡¶àÈÕÁ¬³äÁìÈ¡
elif rewardType == ChConfig.Def_RewardType_ManyDayRecharge:
PlayerActManyDayRecharge.OnGetManyDayRechargeAward(curPlayer, dataEx, dataExStr)
# ÁìÈ¡µ¥±ÊÀÛ³äÁìÈ¡
elif rewardType == ChConfig.Def_RewardType_SingleRecharge:
PlayerActSingleRecharge.OnGetSingleRechargeAward(curPlayer, dataEx, dataExStr)
# ÁìÈ¡boss¸´»î»î¶¯½±Àø
elif rewardType == ChConfig.Def_RewardType_BossReborn:
PlayerBossReborn.GetBossRebornActionAward(curPlayer, dataEx)
# ÁìÈ¡ÏɽçÊ¢µä³äÖµ´óÀñ
elif rewardType == ChConfig.Def_RewardType_FCRecharge:
PlayerFairyCeremony.GetFCRechargeAward(curPlayer)
# ÁìÈ¡ÏɽçÊ¢µäÈ«ÃñÀ´àË
elif rewardType == ChConfig.Def_RewardType_FCParty:
PlayerFairyCeremony.GetFCPartyAward(curPlayer, dataEx)
# ÁìÈ¡·Ö°üÏÂÔؽ±Àø
elif rewardType == ChConfig.Def_RewardType_DownLoad:
GetDownloadAward(curPlayer, dataEx)
# ÁìÈ¡ÐíÔ¸³Ø½±Àø
elif rewardType == ChConfig.Def_RewardType_WishingWell:
PlayerWishingWell.DoGetWishingAward(curPlayer)
# ¹¦ÄÜ¿ªÆô½±Àø
elif rewardType == ChConfig.Def_RewardType_OpenFunc:
GameFuncComm.GetFuncOpenAward(curPlayer, dataEx)
# ±ù¾§¿óÂöÐǼ¶½±Àø
elif rewardType == ChConfig.Def_RewardType_IceLodeStar:
GameLogic_IceLode.GetIceLodeStarAward(curPlayer, dataEx)
# ÁìÈ¡ÖÜ¿ñ»¶»î¶¯½±Àø
elif rewardType == ChConfig.Def_RewardType_WeekPartyAct:
PlayerWeekParty.GetWeekPartyActionAward(curPlayer, dataEx, dataExStr)
# ÁìÈ¡ÖÜ¿ñ»¶»ý·Ö½±Àø
elif rewardType == ChConfig.Def_RewardType_WeekPartyPoint:
PlayerWeekParty.GetWeekPartyPointAward(curPlayer, dataEx, dataExStr)
# ÁìÈ¡µÇ¼½±Àø»î¶¯½±Àø
elif rewardType == ChConfig.Def_RewardType_ActLoginAwardAct:
PlayerActLogin.GetLoginAwardActionAward(curPlayer, dataEx, dataExStr)
# ÁìÈ¡ÐÂÏɽçÊ¢µä³äÖµ´óÀñ
elif rewardType == ChConfig.Def_RewardType_NewFairyCRecharge:
PlayerNewFairyCeremony.GetFCRechargeAward(curPlayer)
# ÁìÈ¡ÐÂÏɽçÊ¢µäÈ«ÃñÀ´àË
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)
# ÁìÈ¡½ÚÈյǼ½±Àø
elif rewardType == ChConfig.Def_RewardType_FeastLogin:
PlayerFeastLogin.GetFeastLoginAward(curPlayer, dataEx)
# ÁìÈ¡½ÚÈÕÓÎÀú½±Àø
elif rewardType == ChConfig.Def_RewardType_FeastTravel:
PlayerFeastTravel.GetFeastTravelAward(curPlayer, dataEx)
# ÁìÈ¡µÇ¼»î¶¯½±Àø
elif rewardType == ChConfig.Def_RewardType_ActLoginAwardNew:
PlayerActLoginNew.OnGetActLoginAward(curPlayer, dataEx, dataExStr)
# ÁìÈ¡¹ºÂò´ÎÊýÀñ°ü»î¶¯
elif rewardType == ChConfig.Def_RewardType_ActBuyCountGift:
PlayerActBuyCountGift.OnGetBuyCountGiftAward(curPlayer, dataEx, dataExStr)
# ÁìÈ¡ÈÎÎñ»î¶¯½±Àø
elif rewardType == ChConfig.Def_RewardType_ActTask:
PlayerActTask.OnGetActTaskAward(curPlayer, dataEx, dataExStr)
# ÁìÈ¡¿ç·þ³äÖµÅÅÐл´ï±ê½±Àø
elif rewardType == ChConfig.Def_RewardType_CACTGBillboardDabiao:
CrossActCTGBillboard.GetDabiaoAward(curPlayer, dataEx)
# ¿ç·þÈ«Ãñ³äÖµ½±Àø
elif rewardType == ChConfig.Def_RewardType_CAAllRecharge:
CrossActAllRecharge.GetCrossActAllRechargeAward(curPlayer, dataEx)
# ¿ç·þÑýħbossÉ˺¦½±Àø
elif rewardType == ChConfig.Def_RewardType_CrossYaomoBossHurt:
PlayerCrossYaomoBoss.GetCrossYaomoBossHurtAward(curPlayer, dataEx, tick)
# ¹Å±¦ÌØÊâЧ¹ûÎïÆ·½±Àø
elif rewardType == ChConfig.Def_RewardType_GubaoItemEff:
PlayerGubao.GetGubaoItemEffAward(curPlayer, dataEx, dataExStr)
# ³É¾Í»ý·Ö½±Àø
elif rewardType == ChConfig.Def_RewardType_SuccessScore:
PlayerSuccess.GetSuccessScoreAward(curPlayer, dataEx)
# ÂòÒ»ËͶà»î¶¯Ãâ·Ñ½±Àø
elif rewardType == ChConfig.Def_RewardType_BuyOne:
PlayerActBuyOne.GetBuyOneFreeAward(curPlayer, dataEx, dataExStr)
# ÏÉÃ˳äÖµ»¥Öú»î¶¯½±Àø
elif rewardType == ChConfig.Def_RewardType_FamilyCTGAssist:
PlayerActFamilyCTGAssist.GetFamilyCTGAssistAward(curPlayer, dataEx, dataExStr)
# ÌìµÀÊ÷½±Àø
elif rewardType == ChConfig.Def_RewardType_TiandaoTree:
PlayerXiangong.GetTiandaoTreeAward(curPlayer, dataEx)
# Ñ°±¦ÀۼƴÎÊý½±Àø
elif rewardType == ChConfig.Def_RewardType_TreasureCntAward:
PlayerTreasure.GetTreasureCntAward(curPlayer, dataEx, dataExStr)
# ÂֻصÀø
elif rewardType == ChConfig.Def_RewardType_LunhuidianAward:
PlayerActLunhuidian.GetLunhuidianAward(curPlayer, dataEx, dataExStr)
#çÎç¿ÆæÓöÁìÈ¡
elif rewardType == ChConfig.Def_RewardType_FairyAdventuresAward:
PlayerFairyDomain.GetFairyAdventuresAward(curPlayer, dataEx, dataExStr)
#ÀúÊ·ÀۼƳäÖµÁìÈ¡
elif rewardType == ChConfig.Def_RewardType_HistoryChargeAward:
PlayerGoldGift.OnGetHistoryRechargeAward(curPlayer, dataEx)
#ÔÚÏßÌػݳäÖµ¶îÍâ½±Àø
elif rewardType == ChConfig.Def_RewardType_OnlineRechargeTH:
PlayerCoin.OnGetOnlineRechargeTH(curPlayer)
#ÌìÐÇËþÈ«·þÌôÕ½²ãÁì½±
elif rewardType == ChConfig.Def_RewardType_SkyTowerServerChallengeReward:
GameLogic_SkyTower.OnGetSkyTowerServerChallengeReward(curPlayer, dataEx, dataExStr)
#´´½Ç½±Àø
elif rewardType == ChConfig.Def_RewardType_CreateRole:
OnGetCreateRoleAward(curPlayer)
#×Ô¶¨Òå½±Àø
elif rewardType == ChConfig.Def_RewardType_CustomAward:
PlayerCustomAward.OnGetCustomAward(curPlayer, dataEx)
#¾³½çÐÞÏÉ֮·½±Àø
elif rewardType == ChConfig.Def_RewardType_RealmXXZL:
PlayerPrestigeSys.GetXXZLAward(curPlayer, dataEx)
#¾³½ç¶É½ÙÈÎÎñÌõ¼þ½±Àø
elif rewardType == ChConfig.Def_RewardType_RealmLVUpTask:
PlayerPrestigeSys.GetRealmLVUpTaskAward(curPlayer, dataEx)
#ÏÉÃËbossÉ˺¦½±Àø
elif rewardType == ChConfig.Def_RewardType_FamilyBossHurt:
GameLogic_FamilyBoss.GetFamilyBossHurtAward(curPlayer, dataEx, dataExStr)
#´ò°üÖ±¹ºÀñ°ü½±Àø
elif rewardType == ChConfig.Def_RewardType_DailyPackBuyGift:
PlayerGoldGift.GetDailyPackBuyGift(curPlayer, dataEx)
#Õ½Áî½±Àø
elif rewardType == ChConfig.Def_RewardType_Zhanling:
PlayerZhanling.GetZhanlingReward(curPlayer, dataEx, dataExStr)
#¸£µØ¾Û±¦Åè½±Àø
elif rewardType == ChConfig.Def_RewardType_MineTreasure:
PlayerMineArea.GetMineTreasureAward(curPlayer, dataEx)
#Í淨ǰհ½±Àø
elif rewardType == ChConfig.Def_RewardType_GameNotice:
OnGiveAwardByClient(curPlayer, rewardType, ChConfig.Def_PDict_GameNoticeAwardState, IpyGameDataPY.GetFuncEvalCfg("GameNoticeReward", 1))
#ÿÈÕ·ÖÏí½±Àø34
elif rewardType == ChConfig.Def_RewardType_ShareGame:
OnGiveAwardByClient(curPlayer, rewardType, ChConfig.Def_PDict_ShareGameAwardState, IpyGameDataPY.GetFuncEvalCfg("ShareGameReward", 1))
#ÓÎÏ·ºÃÆÀ½±Àø35
elif rewardType == ChConfig.Def_RewardType_GoodGame:
OnGiveAwardByClient(curPlayer, rewardType, ChConfig.Def_PDict_GoodGameAwardState, IpyGameDataPY.GetFuncEvalCfg("GoodGameReward", 1))
#ÓÎÏ·µãÔÞ½±Àø67
elif rewardType == ChConfig.Def_RewardType_LikeGame:
OnGiveAwardByClient(curPlayer, rewardType, ChConfig.Def_PDict_LikeGameAwardState, IpyGameDataPY.GetFuncEvalCfg("GoodGameReward", 4))
#ÁìÈ¡¿ª·þÿÈÕ½±Àø
elif rewardType == ChConfig.Def_RewardType_OpenServerDailyAward:
openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
openServerDayLimit = IpyGameDataPY.GetFuncCfg("OpenServerDailyAward", 1)
if openServerDay >= openServerDayLimit:
OnGiveAwardByClient(curPlayer, rewardType, ChConfig.Def_PDict_OpenSererDailyAward, IpyGameDataPY.GetFuncEvalCfg("OpenServerDailyAward", 2), "OpenServerDailyAward")
return
## ÁìÈ¡´´½Ç½±Àø
def OnGetCreateRoleAward(curPlayer):
if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CreateRoleAwardState):
GameWorld.DebugLog("ÒÑÁìÈ¡´´½Ç½±Àø!")
return
if not ItemCommon.GiveAwardItem(curPlayer, IpyGameDataPY.GetFuncEvalCfg("CreateRoleAward")):
return
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CreateRoleAwardState, 1)
Sync_CreateRoleAwardInfo(curPlayer)
return
## ֪ͨ´´½ÇÁì½±¼Ç¼
def Sync_CreateRoleAwardInfo(curPlayer):
sendPack = ChPyNetSendPack.tagMCCreateRoleAwardState()
sendPack.Clear()
sendPack.GetState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CreateRoleAwardState)
NetPackCommon.SendFakePack(curPlayer, sendPack)
return
def OnGiveAwardByClient(curPlayer, rewardType, dictKey, awardCfg, eventName=""):
## ·¢·ÅÇ°¶Ë¿ØÖƵĽ±Àø£¬ºó¶ËÖ»¸ºÔ𷢷Ž±Àø£¬ÊÇ·ñ¿ÉÁ콱ǰ¶Ë×ÔÐÐÅжÏ
if curPlayer.NomalDictGetProperty(dictKey):
GameWorld.DebugLog("ÒÑÁìÈ¡¹ý¸Ã½±Àø! rewardType=%s, dictKey=%s" % (rewardType, dictKey))
return
if not ItemCommon.GiveAwardItem(curPlayer, awardCfg, eventName):
return
PlayerControl.NomalDictSetProperty(curPlayer, dictKey, 1)
Sync_RewardGetRecordInfo(curPlayer, rewardType, 1)
return
## ֪ͨ¸÷½±ÀøÁìÈ¡¼Ç¼ÐÅÏ¢
# @param curPlayer: Íæ¼ÒʵÀý
# @param rewardType: ½±ÀøÀàÐÍ
# @param rewardGetRecord: Áì½±¼Ç¼
# @return None
def Sync_RewardGetRecordInfo(curPlayer, rewardType, rewardGetRecord):
sendPack = ChPyNetSendPack.tagMCPlayerRewardGetRecord()
sendPack.Clear()
sendPack.RewardType = rewardType
sendPack.RewardGetRecord = rewardGetRecord
NetPackCommon.SendFakePack(curPlayer, sendPack)
return
##A5 1A Íæ¼Ò×Ô¶¯Õ½¶·ÉèÖÃÐÅÏ¢´¢´æ#tagCMSaveAutoFightSetting
# @param index, clientData, tick
# @return None
def OnSaveAutoFightSetting(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
settingDict = eval(clientData.Data) #×ֵ䱣´æ
#×Ô¶¯Õ½¶·ÅäÖÃ
#¼¼ÄÜÊý
BasicSkillCount, AreaSkillCount, BuffSkillCount = ReadChConfig.GetEvalChConfig("AutoFightSetting")
BasicSkillList = settingDict.get("BasicSkill",[0]*BasicSkillCount)
Key = "BasicSkill"
for ValueIndex, Value in enumerate(BasicSkillList):
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AutoFightSetting%(Key, ValueIndex), Value)
AreaSkillList = settingDict.get("AreaSkill",[0]*AreaSkillCount)
Key = "AreaSkill"
for ValueIndex, Value in enumerate(AreaSkillList):
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AutoFightSetting%(Key, ValueIndex), Value)
BuffSkillList = settingDict.get("BuffSkill",[0]*BuffSkillCount)
Key = "BuffSkill"
for ValueIndex, Value in enumerate(BuffSkillList):
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AutoFightSetting%(Key, ValueIndex), Value)
Key = "HPPackagePercent"
Value = settingDict.get(Key,0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AutoFightSetting%(Key, 0), Value)
return
## ֪ͨ¿Í»§¶Ë×Ô¶¯Õ½¶·ÅäÖÃ
# @param curPlayer
# @return None
def Sync_AutoFightSetting(curPlayer):
BasicSkillCount, AreaSkillCount, BuffSkillCount = ReadChConfig.GetEvalChConfig("AutoFightSetting")
settingDict = {}
Key = "BasicSkill"
BasicSkillList = []
for ValueIndex in xrange(BasicSkillCount):
Value = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AutoFightSetting%(Key, ValueIndex), 0)
BasicSkillList.append(Value)
settingDict[Key] = BasicSkillList
Key = "AreaSkill"
AreaSkillList = []
for ValueIndex in xrange(AreaSkillCount):
Value = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AutoFightSetting%(Key, ValueIndex), 0)
AreaSkillList.append(Value)
settingDict[Key] = AreaSkillList
Key = "BuffSkill"
BuffSkillList = []
for ValueIndex in xrange(BuffSkillCount):
Value = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AutoFightSetting%(Key, ValueIndex), 0)
BuffSkillList.append(Value)
settingDict[Key] = BuffSkillList
Key = "HPPackagePercent"
Value = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AutoFightSetting%(Key, 0), 0)
settingDict[Key] = Value
#½«ÉèÖÃÄÚÈÝ֪ͨµ½¿Í»§¶Ë
sendPack = ChPyNetSendPack.tagMCAutoFightSetting()
sendPack.Clear()
sendPack.Data = "%s"%settingDict
sendPack.Size = len(sendPack.Data)
NetPackCommon.SendFakePack(curPlayer, sendPack)
return
## bossÉËѪÁбí·â°ü²éѯ
# @param curPlayer
# @return None
def OnQueryBossHurtList(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
if not curPlayer:
return
BossHurtMng.OnQueryBossHurtList(curPlayer, clientData)
return
## µØͼNPCÐÅÏ¢²éѯ·â°ü
# @param curPlayer
# @return None
def OnQueryMapNPCInfo(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
if not curPlayer:
return
# ²éѯ¼ä¸ô¿ØÖÆ
if not clientData.IsNoTimeLimit:
tickType = ChConfig.TYPE_Player_Tick_QueryMapNPCInfo
if tick - curPlayer.GetTickByType(tickType) <= ChConfig.TYPE_Player_Tick_Time[tickType]:
GameWorld.DebugLog("OnQueryMapNPCInfo ²éѯ¹ýÓÚƵ·±£¡")
return
curPlayer.SetTickByType(tickType, tick)
tagMapID = clientData.MapID
tagLineID = clientData.LineID
queryNPCStr = clientData.NPCIDList
npcIDList = []
if queryNPCStr:
try:
npcIDList = eval(clientData.NPCIDList)
except BaseException:
GameWorld.ErrLog("OnQueryMapNPCInfo, npcIDList=%s" % clientData.NPCIDList)
return
if not isinstance(npcIDList, list):
GameWorld.ErrLog("OnQueryMapNPCInfo, npcIDList=%s is not list£¡" % str(npcIDList))
return
GameWorld.DebugLog("OnQueryMapNPCInfo tagMapID=%s,tagLineID=%s,npcIDList=%s"
% (tagMapID, tagLineID, str(npcIDList)))
curMapID = GameWorld.GetMap().GetMapID()
# Èç¹ûÊÇͬÕŵØͼ£¬Ö±½Ó²éѯ֪ͨ
if curMapID == tagMapID:
npcInfoDict = NPCCommon.GetNPCInfo(npcIDList, tick)
gameWorld = IPY_GameWorld.IPY_GameWorld(tagLineID)
playerManager = gameWorld.GetMapCopyPlayerManagerByFbIndex(tagLineID)
playerCnt = 0
if playerManager:
playerCnt = playerManager.GetPlayerCount()
GameWorld.DebugLog(" ͬµØͼ²éѯcurMapID=%s,tagLineID=%s,playerCnt=%s,npcInfoDict=%s"
% (curMapID, tagLineID, playerCnt, str(npcInfoDict)))
NPCCommon.SyncNPCInfo(curPlayer, tagMapID, playerCnt, npcInfoDict)
else:
# ÇëÇóGameServerÄ¿±êµØͼNPCÐÅÏ¢
sendMsg = "%s" % str([tagMapID, tagLineID, npcIDList])
curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_NPCInfo, 0,
'NPCInfo', sendMsg, len(sendMsg))
return
#// A2 27 ²éѯµØͼNPCÊýÁ¿ÐÅÏ¢ #tagCMQueryNPCCntInfo
#
#struct tagCMQueryNPCCntInfo
#{
# tagHead Head;
# DWORD MapID; // Ä¿±êµØͼID
# WORD LineID; // Ïß·ID
# BYTE IsNoTimeLimit;//ÊÇ·ñûÓвéѯʱ¼äÏÞÖÆ,ĬÈÏÓÐÏÞÖÆ
# BYTE NPCIDListLen;
# char NPCIDList[NPCIDListLen]; // ÐèÒª²éѯµÄNPCIDÁбí
#};
def OnQueryMapNPCCntInfo(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
if not curPlayer:
return
# ²éѯ¼ä¸ô¿ØÖÆ
if not clientData.IsNoTimeLimit:
if not GameWorld.CheckPlayerTick(curPlayer, ChConfig.TYPE_Player_Tick_QueryMapNPCInfo, tick):
GameWorld.DebugLog("OnQueryMapNPCCntInfo ²éѯ¹ýÓÚƵ·±£¡")
return
tagMapID = clientData.MapID
tagLineID = clientData.LineID
queryNPCStr = clientData.NPCIDList
npcIDList = []
if queryNPCStr:
try:
npcIDList = eval(clientData.NPCIDList)
except BaseException:
GameWorld.ErrLog("OnQueryMapNPCCntInfo, npcIDList=%s" % clientData.NPCIDList)
return
if not isinstance(npcIDList, list):
GameWorld.ErrLog("OnQueryMapNPCCntInfo, npcIDList=%s is not list£¡" % str(npcIDList))
return
GameWorld.DebugLog("OnQueryMapNPCCntInfo tagMapID=%s,tagLineID=%s,npcIDList=%s"
% (tagMapID, tagLineID, str(npcIDList)))
curMapID = GameWorld.GetMap().GetMapID()
# Èç¹ûÊÇͬÕŵØͼ£¬Ö±½Ó²éѯ֪ͨ
if curMapID == tagMapID:
npcInfoDict = NPCCommon.GetNPCCntInfo(npcIDList, tick)
GameWorld.DebugLog(" ͬµØͼ²éѯcurMapID=%s,tagLineID=%s,npcInfoDict=%s"
% (curMapID, tagLineID, str(npcInfoDict)))
NPCCommon.SyncNPCCntInfo(curPlayer, tagMapID, npcInfoDict)
else:
# ÇëÇóGameServerÄ¿±êµØͼNPCÐÅÏ¢
sendMsg = "%s" % str([tagMapID, tagLineID, npcIDList])
curPlayer.GameServer_QueryPlayerByID(ChConfig.queryType_NPCCnt, 0,
'NPCCnt', sendMsg, len(sendMsg))
return
# ¸ÄΪ¿Í»§¶ËÖ÷¶¯ÇëÇótick A1 02
def QueryWorldTick(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
curPlayer.Sync_ClientTick()
return
## ͬ²½Ê±¼ä
# @param curPlayer
# @param tick ʱ¼ä´Á
# @return None
def Sync_PyServerDataTimeToClient(curPlayer):
# ·þÎñÆ÷ʱ¼ä
serverTime = GameWorld.GetCurrentTime()
if not serverTime:
return
serverDateTime = ChPyNetSendPack.tagServerDateTime()
serverDateTime.Clear()
serverDateTime.Year = serverTime.year
serverDateTime.Month = serverTime.month
serverDateTime.Day = serverTime.day
serverDateTime.Hour = serverTime.hour
serverDateTime.Minute = serverTime.minute
serverDateTime.Second = serverTime.second
serverDateTime.MicSecond = serverTime.microsecond
serverDateTime.CrossServerTime = GameWorld.GetCrossServerTimeStr()
# ֪ͨ¿Í»§¶Ëͬ²½Ê±¼ä
NetPackCommon.SendFakePack(curPlayer, serverDateTime)
return
## ֪ͨ¿ª·þÌìÊý
# @param curPlayer: Íæ¼ÒʵÀý
# @return: None
def Sync_OpenServerDay(curPlayer):
serverTime = GameWorld.GetCurrentTime()
if not serverTime:
return
gw = GameWorld.GetGameWorld()
packData = ChPyNetSendPack.tagOpenServerDay()
packData.Clear()
packData.Day = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)
packData.IsMixServer = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_IsMixServer)
packData.MixDay = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_MixServerDay)
packData.OpenWeekday = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_OpenServerWeekday)
packData.NowYear = serverTime.year
packData.NowMonth = serverTime.month
packData.NowDay = serverTime.day
packData.NowHour = serverTime.hour
packData.NowMinute = serverTime.minute
packData.NowSecond = serverTime.second
packData.NowMicSecond = serverTime.microsecond
packData.WeekOfYear = GameWorld.GetWeekOfYear()
NetPackCommon.SendFakePack(curPlayer, packData)
return
#===============================================================================
# //B4 09 Íæ¼ÒÒƶ¯ # tagCMPyMove
#
# struct tagCMPyMove
# {
# tagHead Head;
# WORD Dir; // ³¯Ïò
# WORD ClientPosX; // ¿Í»§¶Ë×ø±êX ºÁÃ×
# WORD ClientPosY; // ¿Í»§¶Ë×ø±êY
# WORD SeverPosX; // ·þÎñ¶Ë×ø±êX ¸ñ×Ó
# WORD SeverPosY; // ·þÎñ¶Ë×ø±êY
# DWORD WorldTick;
# BYTE MoveType; // 0 Í£Ö¹ 1Òƶ¯
# };
#===============================================================================
# python´¦ÀíеÄÒƶ¯·½Ê½
def PYPlayerMove(index, clientPack, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
#·ÀÍâ¹Ò ²»¿ÉÒƶ¯
if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_AutoCheckHack_State) \
== ChConfig.Def_AutoCheck_State_Danger:
return
if not PYPlayerNormalMove(curPlayer, clientPack, tick):
posX, posY = curPlayer.GetPosX(), curPlayer.GetPosY()
if GameWorld.GetMap().CanMove(posX, posY) != True:
resultPos = GameMap.GetEmptyPlaceInArea(posX, posY, 5)
if resultPos.GetPosX() == posX and resultPos.GetPosY() == posY:
GameWorld.ErrLog("Íæ¼Ò×ø±ê¿¨ËÀ %s %s"%(posX, posY))
return
posX = resultPos.GetPosX()
posY = resultPos.GetPosY()
curPlayer.ResetPos(posX, posY)
MoveDistCalcTick = "PYMoveDistCalcTick"
MoveDistSum = "PYMoveDistSum"
def PYPlayerNormalMove(curPlayer, clientPack, tick) :
#Íæ¼ÒÒƶ¯Í¨Óüì²é
if not __CheckPlayerCanMove(curPlayer):
return True
#·â°ü²ÎÊý
moveDir = clientPack.Dir # Òƶ¯·½Ïò
clientPosX = clientPack.ClientPosX #ºÁÃ× Ö»×÷Ϊ»Ø°üÓÃ
clientPosY = clientPack.ClientPosY
sendPack_SeverPosX = clientPack.SeverPosX #¸ñ×Ó
sendPack_SeverPosY = clientPack.SeverPosY
sendPack_WorldTick = clientPack.WorldTick
moveType = clientPack.MoveType
lastMoveTick = curPlayer.GetClientMoveTick()
if moveType != 0 and sendPack_WorldTick - lastMoveTick < 50:
GameWorld.DebugLog("move ·¢°üÌ«¿ì ÊÕ°ü%s - ÉÏÒ»´Î%s"%(sendPack_WorldTick, lastMoveTick))
# ·¢°ü¹ý¿ì
return True
#ÏÈÑé֤Ŀ±êµãÊÇ·ñºÏ·¨
if not GameWorld.GetMap().CanMove(sendPack_SeverPosX, sendPack_SeverPosY):
GameWorld.DebugLog("Òƶ¯ÕÏ°µã")
return False
if curPlayer.GetPosX() == sendPack_SeverPosX and curPlayer.GetPosY() == sendPack_SeverPosY:
curPlayer.SetDict(MoveDistCalcTick, tick)
curPlayer.SetDict(MoveDistSum, 0)
if moveType != 0 and sendPack_WorldTick - lastMoveTick < 222:
# ¼õÉÙͬ²½ÂÊ
return True
curPlayer.SetClientMoveTick(sendPack_WorldTick)
#GameWorld.DebugLog("ûÓиñ×ÓÒƶ¯µÄÒ²¹ã²¥")
# ûÓиñ×ÓÒƶ¯µÄÒ²¹ã²¥
PyNotifyPlayerMove(curPlayer, moveDir, clientPosX, clientPosY, sendPack_SeverPosX, sendPack_SeverPosY, moveType)
return True
#---¸±±¾µØͼÒƶ¯¼ì²é---
if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
if not FBLogic.DoFBCanMove(curPlayer, sendPack_SeverPosX, sendPack_SeverPosY, tick):
return False
#---Õý³£Òƶ¯---
vehicle = curPlayer.GetPlayerVehicle()
if vehicle not in [IPY_GameWorld.pvNull, IPY_GameWorld.pvHorse]:
#GameWorld.ErrLog("²»ÄÜÒƶ¯, ½»Í¨¹¤¾ß²»Ã÷ %d" % (vehicle), curPlayer.GetID())
return False
#УÑé¿Í»§¶Ëʱ¼ä
if not PlayerControl.PlayerMoveCheckClientWorldTick(curPlayer, sendPack_WorldTick, sendPack_SeverPosX, sendPack_SeverPosY):
curPlayer.Sync_ClientTick()
return False
dist = GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), sendPack_SeverPosX, sendPack_SeverPosY)
if dist > 4:
# ¶ª°ü À»Ø
GameWorld.DebugLog("Òƶ¯¾àÀë¹ý´ó£¬ Íæ¼Ò×ø±ê %s-%s ÊÕ°ü %s-%s"%(curPlayer.GetPosX(), curPlayer.GetPosY(),
sendPack_SeverPosX, sendPack_SeverPosY), curPlayer.GetID())
return False
calcTick = curPlayer.GetDictByKey(MoveDistCalcTick)
distSum = min(curPlayer.GetDictByKey(MoveDistSum) + dist, 100000000)
curPlayer.SetDict(MoveDistSum, distSum)
if distSum > IpyGameDataPY.GetFuncCfg("PyMoveCheck", 1):
speed = curPlayer.GetSpeed() # Òƶ¯Ò»¸ñËùÐèºÁÃë
passCalcTick = tick - calcTick
needTick = distSum * speed
checkNeedTick = needTick * IpyGameDataPY.GetFuncCfg("PyMoveCheck", 2) / 100.0
if passCalcTick < checkNeedTick:
GameWorld.DebugLog(" dist=%s,distSum=%s,speed=%s,needTick=%s, ËùÐèÒƶ¯Ê±¼äÒì³£ passCalcTick(%s) < (%s)"
% (dist, distSum, speed, needTick, passCalcTick, checkNeedTick), curPlayer.GetID())
return False
#GameWorld.DebugLog(" dist=%s,distSum=%s,speed=%s,needTick=%s, ÑéÖ¤Òƶ¯Ê±¼äÕý³£ passCalcTick(%s) < (%s)"
# % (dist, distSum, speed, needTick, passCalcTick, checkNeedTick), curPlayer.GetID())
curPlayer.SetDict(MoveDistCalcTick, tick)
curPlayer.SetDict(MoveDistSum, 0)
#Èç¹ûÊÇСÓÎÏ·ÖÐÔòֹͣСÓÎÏ·
if curPlayer.GetPlayerAction() == IPY_GameWorld.paGameEvent:
PlayerGameEvent.StopGameEvent(curPlayer, tick)
#2010/04/30 Òƶ¯ÐÞ¸ÄΪȫC++¿ØÖÆ, Python״̬»úÉèÖÃΪ¿ÕÏÐ(Çå¿Õ²É¼¯µÈ״̬)
PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)
#ɾ³ýÓÐÏÞÎÞµÐBUFF
#PlayerControl.DelLimitSuperBuff(curPlayer, tick)
curPlayer.ChangePos(sendPack_SeverPosX, sendPack_SeverPosY)
PyNotifyPlayerMove(curPlayer, moveDir, clientPosX, clientPosY, sendPack_SeverPosX, sendPack_SeverPosY, moveType)
curPlayer.SetClientMoveTick(sendPack_WorldTick)
# ºóÃæ±ØÐë·µ»ØTrue
fightPet = curPlayer.GetPetMgr().GetFightPet()
if fightPet:
#³öÕ½³èÎïͬʱÒƶ¯
if moveType == 0 or tick - fightPet.GetActionTick() > 300:
PetControl.FightPetFollowMove(curPlayer,sendPack_SeverPosX, sendPack_SeverPosY)
fightPet.SetCurAction(IPY_GameWorld.laNPCNull)
return True
#===============================================================================
# //B4 0A Íæ¼ÒÒƶ¯ #tagMCPYPlayerMove
#
# struct tagMCPYPlayerMove
# {
# tagHead Head;
# WORD Dir; // ³¯Ïò
# WORD ClientPosX; // ¿Í»§¶Ë×ø±êX ºÁÃ×
# WORD ClientPosY; // ¿Í»§¶Ë×ø±êY
# WORD SeverPosX; // ·þÎñ¶Ë×ø±êX ¸ñ×Ó
# WORD SeverPosY; // ·þÎñ¶Ë×ø±êY
# DWORD ObjID;
# BYTE ObjType;
# WORD Speed;
# BYTE MoveType; // 0 Í£Ö¹ 1Òƶ¯
# };
#===============================================================================
def PyNotifyPlayerMove(curPlayer, moveDir, clientPosX, clientPosY, posX, posY, moveType):
sendPack = ChPyNetSendPack.tagMCPYPlayerMove()
sendPack.Clear()
sendPack.ObjID = curPlayer.GetID()
sendPack.ObjType = IPY_GameWorld.gotPlayer
sendPack.Dir = moveDir
sendPack.ClientPosX = clientPosX
sendPack.ClientPosY = clientPosY
sendPack.SeverPosX = posX
sendPack.SeverPosY = posY
sendPack.Speed = curPlayer.GetSpeed()
sendPack.MoveType = moveType
# NotifyAll ×ö¹ýÂË»òÕßÊýÁ¿´¦Àí
PlayerControl.PyNotifyAll(curPlayer, sendPack, False, 0)
return
def GiveDownloadPatchAward(curPlayer):
## ·¢·ÅÏÂÔز¹¶¡°ü½±Àø
playerID = curPlayer.GetPlayerID()
patchAwardNum = IpyGameDataPY.GetFuncCfg('DownReward', 4)
curAwardNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DownloadPatchAward)
if curAwardNum == patchAwardNum:
GameWorld.DebugLog("ÒÑ·¢·ÅÏÂÔز¹¶¡°ü½±Àø! curAwardNum(%s) == patchAwardNum(%s)" % (curAwardNum, patchAwardNum), playerID)
return
awardItemList = IpyGameDataPY.GetFuncEvalCfg('DownReward', 3)
if not awardItemList:
return
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DownloadPatchAward, patchAwardNum)
GameWorld.DebugLog("·¢·Å²¹¶¡°üÏÂÔؽ±Àø: curAwardNum=%s,patchAwardNum=%s" % (curAwardNum, patchAwardNum), playerID)
PlayerControl.SendMailByKey("DownloadPatchAward", [playerID], awardItemList)
return
def GetDownloadAward(curPlayer, dataEx):
##·Ö°üÏÂÔؽ±Àø dataEx 0Ö±½ÓÁìÈ¡ 1·¢Óʼþ
playerID = curPlayer.GetPlayerID()
downloadAwardNum = IpyGameDataPY.GetFuncCfg('DownReward', 5)
curAwardNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DownloadAwardState)
if curAwardNum == downloadAwardNum:
GameWorld.DebugLog("ÒÑÁìÈ¡·Ö°ü½±Àø! curAwardNum(%s) == downloadAwardNum(%s)" % (curAwardNum, downloadAwardNum), playerID)
return
awardItemList = IpyGameDataPY.GetFuncEvalCfg('DownReward', 1)
if not awardItemList:
return
# ¼ì²é±³°ü
if dataEx == 0:
needSpace = len(awardItemList)
packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
if needSpace > packSpace:
PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
return
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DownloadAwardState, downloadAwardNum)
GameWorld.DebugLog("ÁìÈ¡·Ö°üÏÂÔؽ±Àø: curAwardNum=%s,downloadAwardNum=%s" % (curAwardNum, downloadAwardNum), playerID)
if dataEx == 1:
PlayerControl.SendMailByKey('SubpackageDownload', [curPlayer.GetID()], awardItemList)
else:
for itemID, itemCnt, isBind in awardItemList:
ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem])
SyncPackDownloadAward(curPlayer)
return
def SyncPackDownloadAward(curPlayer):
#·Ö°üÏÂÔؽ±Àø¼Ç¼֪ͨ
downloadAwardNum = IpyGameDataPY.GetFuncCfg('DownReward', 5)
sendPack = ChPyNetSendPack.tagMCPackDownloadRecord()
sendPack.Clear()
sendPack.Record = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DownloadAwardState) == downloadAwardNum
NetPackCommon.SendFakePack(curPlayer, sendPack)
return
def NotifyPlayerMove(curPlayer, posX, posY, npcID=0):
'''֪ͨǰ¶ËÏòij¸öµãÒƶ¯
ÕâÀïÇ°¶Ë¿ÉÄÜÐèÒªÕë¶Ôij´ÎÒƶ¯×ö¶îÍâ´¦Àí£¬±ÈÈçÒƶ¯µ½Ä³¸öµãºóÐèÒª×Ô¶¯Õ½¶·µÈ
ËùÒÔÕâÀïÖ»×ö֪ͨǰ¶Ë¿ÉÒÔÏòij¸öµãÒƶ¯£¬×îÖÕÒƶ¯ÓÉÇ°¶Ë·¢Æð
'''
sendPack = ChPyNetSendPack.tagMCNotifyPlayerMove()
sendPack.Clear()
sendPack.PosX = posX
sendPack.PosY = posY
sendPack.NPCID = npcID
NetPackCommon.SendFakePack(curPlayer, sendPack)
return
#// B4 0E Íæ¼ÒµôѪ #tagCMRoleLostHP
#
#struct tagCMRoleLostHP
#{
# tagHead Head;
# DWORD LostHP;
# DWORD LostHPEx;
#};
def OnRoleLostHP(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
lostHP = clientData.LostHP + clientData.LostHPEx * ShareDefine.Def_PerPointValue
curHP = GameObj.GetHP(curPlayer)
updHP = curHP - lostHP
if updHP <= 0:
#Íæ¼ÒÒѾËÀÍö
playerControl = PlayerControl.PlayerControl(curPlayer)
playerControl.SetDead()
else:
GameObj.SetHP(curPlayer, updHP)
return
#// A2 35 Ñ¡Ôñ¾³½çÄѶȲ㼶 #tagCMSelectRealmDifficulty
#
#struct tagCMSelectRealmDifficulty
#{
# tagHead Head;
# WORD RealmDifficulty; //¾³½çÄÑ¶È = 1000 + ËùÑ¡¾³½çµÈ¼¶£¬Èç¾³½ç13£¬Ôò·¢1013
#};
def OnSelectRealmDifficulty(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
PlayerControl.SetRealmDifficulty(curPlayer, clientData.RealmDifficulty)
return