#!/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  
 | 
  
 | 
  
 |