1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/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)