hxp
2024-11-13 141959c90ea475111b1d021d219745c2e246f45e
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
#!/usr/bin/python
# -*- coding: GBK -*-
#
# @todo: 
#
# @author: Alee
# @date 2018-1-6 ÏÂÎç02:27:07
# @version 1.0
#
# @note: 
#
#---------------------------------------------------------------------
import GameWorld
import PlayerTJG
import ChConfig
import PlayerControl
 
#---------------------------------------------------------------------
#Âß¼­ÊµÏÖ
## GMÃüÁîÖ´ÐÐÈë¿Ú
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param msgList ²ÎÊýÁбí [npcID]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷. ²ÎÊý1 ÍÑ»ú¹Ò״̬  ²ÎÊý2 ÍÑ»ú¹ÒNPC ²ÎÊý3 Ö¸¶¨Íæ¼ÒÍÑ»ú¹Ò
def OnExec(curPlayer, msgList):
    if not msgList:
        GameWorld.DebugAnswer(curPlayer, "SetTJG ×´Ì¬ npcID ¿Éѡָ¶¨Íæ¼ÒID")
        GameWorld.DebugAnswer(curPlayer, "״̬: 0-·ÇÍÑ»ú, 1-ÍÑ»ú, 2-ÍÑ»ú±»»÷ɱ")
        return
    
    if len(msgList) == 3:
        tagPlayerID = msgList[2]
        curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(tagPlayerID)
        if not curPlayer:
            GameWorld.DebugAnswer(curPlayer, "ÕÒ²»µ½Ö¸¶¨Íæ¼Ò,(%s)" % tagPlayerID)
            return
        
    state = msgList[0]
    if state == 1:
        tick = GameWorld.GetGameWorld().GetTick()
        curPlayer.SetDict(ChConfig.Def_PlayerKey_TJGStartTime, tick)
        if not PlayerTJG.GetTJGTime(curPlayer):
            PlayerTJG.SetTJGTime(curPlayer, 3600)
            
    tjgNPCID = msgList[1] if len(msgList) > 1 else 0
    curPlayer.SetState(state)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_TJGNPC, tjgNPCID)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_LV, curPlayer.GetLV(), ChConfig.Def_PDictType_TJGNotify)
    GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÍÑ»ú״̬:%s,npcID=%s" % (state, tjgNPCID))
    if state == 2:
        curPlayer.Kick(0)
    return