#!/usr/bin/python # -*- coding: GBK -*- ##@package PlayerRequest # ÇëÇóÂß¼­´¦Àí # # @author Mark # @date 2010-4-28 # @version 1.0 # # ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ # VER = "2010-05-12 18:30" zhengyang Ìí¼Ó×¢ÊÍ # # Ä£¿éÏêϸ˵Ã÷ #--------------------------------------------------------------------- import GameWorld import ChConfig #--------------------------------------------------------------------- #--------------------------------------------------------------------- ## ÅжÏÍæ¼ÒÊÇ·ñÓÐÏàͬµÄÇëÇó # @param curPlayer µ±Ç°Íæ¼Ò # @param curTagPlayer Ä¿±êÍæ¼Ò # @param requestType ÇëÇóÀàÐÍ # @return True or False # @remarks º¯ÊýÏêϸ˵Ã÷. def CheckRequest(curPlayer,curTagPlayer,requestType): if curTagPlayer == None: return False curTagPlayerID = curTagPlayer.GetPlayerID() #Íæ¼ÒÇëÇó´ÎÊý requestCount = curPlayer.GetRequestCount() for i in range(0,requestCount): requestID = curPlayer.GetRequestID(i) type = curPlayer.GetRequestType(i) if requestID == curTagPlayerID and type == requestType: #GameWorld.Log("curTagID = %dÇëÇó¼ì²éͨ¹ý"%requestID) return True GameWorld.Log("Ë«·½ÇëÇóID²»Í¬»ò×é¶ÓÀàÐͲ»ÕýÈ·" , curPlayer.GetPlayerID(), curTagPlayerID) #GameWorld.Log("ÇëÇóʧ°Ü") return False ## Ë¢ÐÂÍæ¼ÒÇëÇó # @param curPlayer µ±Ç°Íæ¼Ò # @param tick µ±Ç°Ê±¼ä # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def ProcessPlayerRequest(curPlayer, tick): if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_PlayerRequest) <= ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_PlayerRequest]: #ûÓе½Ë¢Ð¼ä¸ô return curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_PlayerRequest, tick) #µ¥Î»Ê±¼äË¢ÐÂÒ»´Î #Íæ¼ÒÇëÇó´ÎÊý requestCount = curPlayer.GetRequestCount() curIndex = 0 while curIndex < requestCount: #»ñµÃÇëÇó¿ªÊ¼Ê±¼ä requestTick = curPlayer.GetRequestTick(curIndex) if requestTick == 0: curIndex += 1 continue #»ñµÃÇëÇó×î´óʱ¼ä requestMaxTick = curPlayer.GetRequestMaxTick(curIndex) if (tick - requestTick) < requestMaxTick: curIndex += 1 continue curPlayer.DeleteRequest(curIndex) #GameWorld.Log("ÇëÇóÏìÓ¦ = %s³¬Ê±,״̬ÒÑÇå³ý"%(curIndex) , curPlayer.GetPlayerID()) requestCount = curPlayer.GetRequestCount() return