hzr
2025-04-21 2d9d117228fd281aeeb0f3c173f538744f8dffd7
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
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package MoveNpc
# @todo: Í¨¹ýÖ¸¶¨NPCID·Éµ½NPCÅÔ
#
# @author: panwei
# @date 2011-02-25
# @version 1.0
#
# @note: 
#---------------------------------------------------------------------
"""Version = 2011-02-25 10:20"""
#---------------------------------------------------------------------
import GameWorld
import random
#---------------------------------------------------------------------
## GMÃüÁîÖ´ÐÐÈë¿Ú
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param cmdList ²ÎÊýÁбí
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(curPlayer, cmdList):
    if len(cmdList) != 1:
        GameWorld.DebugAnswer(curPlayer, "²ÎÊý´íÎó, ÐèÒªÒ»¸ö²ÎÊý, NPCID")
        return
 
    findNPCID = cmdList[0]
    findNPCList = []
    #---¿ªÊ¼²éÕÒNPC---
    npcManager = GameWorld.GetNPCManager()
 
    for i in range(0, npcManager.GetNPCCount()):
        curNPC = npcManager.GetNPCByIndex(i)
        if curNPC.GetNPCID() != findNPCID:
            continue
 
        findNPCList.append(curNPC)
 
    if not findNPCList:
        GameWorld.DebugAnswer(curPlayer, "µ±Ç°µØÍ¼ = %s, ÎÞ´ËNPC = %s"%(GameWorld.GetMap().GetMapID(), findNPCID))
        return
 
    #Ëæ»úÕÒÒ»Ö»´«ËÍ
    curNPC = random.choice(findNPCList)
    curPlayer.ResetPos(curNPC.GetPosX(), curNPC.GetPosY())
    return