#!/usr/bin/python
|
# -*- coding: GBK -*-
|
|
##@package GY_Query_MoveToTruck
|
# ²éѯïÚ³µÎ»ÖÃ
|
#
|
# @author hch
|
# @date 2010-3-31
|
# @version 1.1
|
#
|
# ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
|
# @change: "2014-10-14 14:00" hxp ϵͳÌáʾÐÞ¸Ä
|
#
|
# Ä£¿éÏêϸ˵Ã÷
|
# VER = "2014-10-14 14:00"
|
#½Å±¾ËµÃ÷
|
#---------------------------------------------------------------------
|
#µ¼Èë
|
import GameWorld
|
import PlayerControl
|
import IPY_GameWorld
|
import ChConfig
|
#---------------------------------------------------------------------
|
#È«¾Ö±äÁ¿
|
#---------------------------------------------------------------------
|
|
#---------------------------------------------------------------------
|
#Â߼ʵÏÖ
|
|
## ÇëÇóÂß¼
|
# @param query_Type ÇëÇóÀàÐÍ
|
# @param query_ID ÇëÇóµÄÍæ¼ÒID
|
# @param packCMDList ·¢°üÃüÁî []
|
# @param tick µ±Ç°Ê±¼ä
|
# @return "True" or "False" or ""
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def DoLogic(query_Type , query_ID , packCMDList , tick):
|
curTruck = GameWorld.GetNPCManager().FindNPCByID(query_ID)
|
if not curTruck:
|
return ''
|
#ïÚ³µËùÔÚµØÍ¼µÄ ×ø±ê
|
if not GameWorld.GetMap().CanMove(curTruck.GetPosX(), curTruck.GetPosY()):
|
return 'noMove'
|
# GameWorld.Log('²éѯÂß¼----mapID: %s : %s: %s'%(GameWorld.GetMap().GetMapID(),curTruck.GetPosX(), curTruck.GetPosY()))
|
return [ GameWorld.GetMap().GetMapID(), curTruck.GetPosX(), curTruck.GetPosY() ]
|
|
## Ö´Ðнá¹û
|
# @param curPlayer ·¢³öÇëÇóµÄÍæ¼Ò
|
# @param callFunName ¹¦ÄÜÃû³Æ
|
# @param funResult ²éѯµÄ½á¹û
|
# @param tick µ±Ç°Ê±¼ä
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def DoResult(curPlayer , callFunName , funResult , tick):
|
|
if funResult == '':
|
GameWorld.Log('##²éѯïÚ³µ(´«ËÍ)Òì³£! %s'%(curPlayer.GetPlayerID()))
|
return
|
if funResult == 'noMove':
|
PlayerControl.NotifyCode(curPlayer, "Convey_Car_IllegalPlace")#ïÚ³µËùÔÚµÄ×ø±êΪ²»¿ÉÒÆ¶¯µãÎÞ·¨´«ËÍ
|
return
|
#»¹Ô¸ñʽ '[]' -> []
|
funResult = eval(funResult)
|
mapID = int(funResult[0])
|
posX = int(funResult[1])
|
posY = int(funResult[2])
|
|
# GameWorld.Log('²éѯ½á¹û(´«ËÍ)---µØÍ¼ID %s £¬×ø±êX %s ×ø±êY%s'%(mapID, posX, posY))
|
#===============================================================================
|
#ÅжÏÊÇ·ñ¿ÉÒÔ ´«ËÍ
|
if curPlayer.GetPlayerVehicle() == IPY_GameWorld.pvTruck :
|
PlayerControl.NotifyCode(curPlayer, "Old_hgg_0")
|
return
|
|
if curPlayer.IsBattleState():
|
PlayerControl.NotifyCode(curPlayer, "Convey_Car_InFighting")#Õ½¶·×´Ì¬ÎÞ·¨´«ËÍÖÁïÚ³µ
|
return
|
mapCountry = GameWorld.GetMap().GetCountryByMapID(mapID)
|
|
if not GameWorld.IsSameCountry_Name( mapCountry, curPlayer.GetCountry() ):#µÐ¹úÎÞ·¨´«ËÍ
|
PlayerControl.NotifyCode(curPlayer, "Enemy_State_No_Trans")
|
return
|
#===============================================================================
|
|
#´ýÐÞ¸Ä 1.»¨·ÑÀàÐÍ£¬2.»¨·Ñ½ð¶î¿ÉÌí¼ÓÓÚChConfig
|
type_Price = curPlayer.GetUseSilverType()
|
price = ChConfig.Def_MoveToTruck_Cost
|
if not PlayerControl.PayMoney(curPlayer,type_Price,price):
|
return
|
|
PlayerControl.PlayerResetWorldPos(curPlayer,mapID, posX, posY, False)
|
|
|