hch
2019-05-15 d2b70af9f597e35c8a63076e7c3312134c3c04ba
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
#!/usr/bin/python
# -*- coding: GBK -*-
#
# @todo: 
#
# @author: Alee
# @date 2018-1-3 ÏÂÎç05:54:40
# @version 1.0
#
# @note: 
#
#---------------------------------------------------------------------
# ¼òҪ˵Ã÷ µÇ¼£¬µÇ³ö´¦Àí°ü
# ÏêϸÃèÊö None
 
import base64
from AI.AIBase import *
import logging
import os
import random
from ConfigurationReader import ConfigIniReader
from DataReader import MapEventPointReader, ChinMapReader
from Protocol.PacketsSend import tagCClientVersion
from Protocol.PacketsSend import tagCRoleLoginAsk
from Protocol.PacketsSend import tagCInitMapOK, tagCCreateRole, tagCGMCMD, tagCCliectReborn
from Protocol.PacketsSend import tagCPlayerLogin, tagCWorldTransfer, tagCPlayerLogOut, tagCExitFB
 
from Robot.PlayerData import PlayerData
from Protocol.PacketsSendPY import tagCMSightZoom, tagCMWorldTick
from Robot import DataDefine
VER = "2012-08-30 16:30"
 
 
#ĬÈϵÚÒ»ÕŵØÍ¼
Def_First_MapID = 10010
 
## µÇ¼£¬µÇ³ö´¦Àí°ü
#
# ¼Ì³ÐAIBase
class AILoginout(AIBase):
    
    ## ËùÓÐAI±ØÐë²ÉÓÃÕâÖй̶¨µÄ³õʼ»¯Ô­ÐÍ£¬ÒÔ±ãAIMgr×Ô¶¯¼ÓÔØ
    #  @param None : None
    #  @return bool
    #  @remarks ´ËAI²»ÐèÒªÖÜÆÚÐÔ±»µ÷Óã¬ËùÒÔÉèÖÃΪ²»ÆôÓÃTimer
    def __init__(self, robot):
        #´ËAI²»ÐèÒªÖÜÆÚÐÔ±»µ÷Óã¬ËùÒÔÉèÖÃΪ²»ÆôÓÃTimer
        AIBase.__init__(self, robot, 0, False, False)
        self.SetActive(True)
        self.MapID = 0
        
        
    ## ÏòAIMgr×¢²áÏûÏ¢»Øµ÷º¯Êý
    #  @param None : None
    #  @return bool
    #  @remarks 
    def _RegisterPacket(self, aiMgr):
        aiMgr.RegNetMsg(0x0101, self.OnServerPrepared, False)
        aiMgr.RegNetMsg(0x0115, self.OnAskClientVersion, False)
        aiMgr.RegNetMsg(0x0107, self.OnShowLoginFrm, True)
        aiMgr.RegNetMsg(0x0109, self.OnServerPrepareOK, False)
        aiMgr.RegNetMsg(0x0103, self.OnNeedCreateRole, False)
        aiMgr.RegNetMsg(0x0102, self.OnCDBPlayer, True)
        aiMgr.RegNetMsg(0x0401, self.OnPlayerMapInit, True)
        aiMgr.RegNetMsg(0x0403, self.OnPlayerLoginLoadOK, False)
        aiMgr.RegNetMsg(0x0104, self.OnServerDisconnect, True)
        #aiMgr.RegNetMsg(0xA312, self.OnMagicWeaponData, True)
        aiMgr.RegNetMsg(0x0418, self.OnAttr, True)
        aiMgr.RegNetMsg(0xA709, self.OnAttrList, True)
        #aiMgr.RegNetMsg(0x0114, self.OnAttrList, True) Ïß·
        #aiMgr.RegNetMsg(0x0906, self.LeaveTeam, True)
        #aiMgr.RegNetMsg(0xB902, self.TeamRefresh, True)
        aiMgr.RegNetMsg(0x0609, self.PlayerDie, True)
        
    def PlayerDie(self, pack):
        if pack.PlayerID != self.robot.GetPlayerInfo().GetPlayerID():
            return
        
        sendPack = tagCCliectReborn()
        sendPack.Type = 2
        
        self.robot.Send(sendPack)
        return
        
    # À뿪¶ÓÎé
    def LeaveTeam(self, pack):
        if pack.PlayerID != self.robot.GetPlayerInfo().GetPlayerID():
            if self.robot.GetPlayerInfo().GetTeamMemberLV() == 2:
                # ×éÔ±Í˳ö ¶Ó³¤¼ÌÐøÕÒÈË×é¶Ó
                self.JoinTeam()
            return
        self.robot.GetPlayerInfo().SetTeamID(0)
        self.robot.GetPlayerInfo().SetTeamMemberLV(0)
        self.JoinTeam()
        return
    
    # ¶ÓÎéË¢ÐÂ
    def TeamRefresh(self, pack):
        logging.debug("TeamRefresh----%s"%self.robot.GetPlayerInfo().GetPlayerID())
        self.robot.GetPlayerInfo().SetTeamID(pack.TeamID)
        for member in pack.MemberList:
            if member.PlayerID == self.robot.GetPlayerInfo().GetPlayerID():
                self.robot.GetPlayerInfo().SetTeamMemberLV(member.MemberLV)
                break
        return
    
    #A709 ÊôÐÔÕûºÏ°ü
    def OnAttrList(self, pack):
        if pack.ObjID != self.robot.GetPlayerInfo().GetPlayerID():
            return
        
        if pack.ObjType != 1:
            return
        
        for i in xrange(pack.Count):
            lpack = pack.RefreshType[i]
            self.CalcAttr(lpack)
            
        return
    
    #0418
    def OnAttr(self, pack):
        if pack.ObjID != self.robot.GetPlayerInfo().GetPlayerID():
            return
        
        if pack.ObjType != 1:
            return
        
        self.CalcAttr(pack)
        return
    
    def CalcAttr(self, pack):
        if pack.RefreshType == DataDefine.CDBPlayerRefresh_LV:
            self.robot.GetPlayerInfo().SetPlayerLV(pack.Value)
            #if self.robot.GetIsLoginOK():
            #    self.RefreshPoint()
                
        elif pack.RefreshType == DataDefine.CDBPlayerRefresh_DEF:
            self.robot.GetPlayerInfo().SetDefense(pack.Value)
        elif pack.RefreshType == DataDefine.CDBPlayerRefresh_Gold:
            self.robot.GetPlayerInfo().SetGold(pack.Value)
        elif pack.RefreshType == DataDefine.CDBPlayerRefresh_TeamID:
            self.robot.GetPlayerInfo().SetTeamID(pack.Value)
            if pack.Value == 0:
                self.robot.GetPlayerInfo().SetTeamMemberLV(0)
        elif pack.RefreshType == DataDefine.CDBPlayerRefresh_HappyPoint:
            self.robot.GetPlayerInfo().SetTJGTime(pack.Value)
            # Í˳ö¶ÓÎ飬ÀëÏß
            self.TJGLeave(pack.Value)
        elif pack.RefreshType == DataDefine.CDBPlayerRefresh_Tick:
            self.robot.GetPlayerInfo().SetWorldTick(pack.Value)
            self.RefreshPoint()
        elif pack.RefreshType == DataDefine.CDBPlayerRefresh_FBID:
            self.robot.GetPlayerInfo().SetFBID(pack.Value)
        elif pack.RefreshType == DataDefine.CDBPlayerRefresh_GMLevel:
            self.robot.GetPlayerInfo().SetGMLV(pack.Value)
        elif pack.RefreshType == DataDefine.CDBPlayerRefresh_Job:
            self.robot.GetPlayerInfo().SetJob(pack.Value)
            
            
    def TJGLeave(self, tjgTime):
 
        if tjgTime != 0:
            return
        #sendPack = tagCLeaveTeam()
        #self.robot.Send(sendPack)
        
        sendPack = tagCPlayerLogOut()
        self.robot.Send(sendPack)
        
        from Robot import RobotMgr
        RobotMgr.GetRobotMgr().DisconnectServer(self.robot)
    
    def OnMagicWeaponData(self, pack):
 
        #logging.info("·¨±¦-----%s %s"%(pack.Num, pack.MagicWeaponID))
        # ½âËøµØÍ¼£¬¼¼ÄÜ
        if self.robot.GetPlayerInfo().GetMaxMapID() != 0:
            return
        
        maxfbID = 0
        for fbID in pack.MagicWeaponID:
            # 100¿ªÍ·Îª½âËøµØÍ¼
            if fbID/100 > 1:
                continue
            maxfbID = max(maxfbID, fbID)
        
        maxMapID = ChinMapReader.GetChinMapData().FindMaxMapID(self.robot.GetPlayerInfo().GetPlayerLV(), maxfbID)
        #logging.debug("----1111---%s"%(maxMapID))
        
        self.robot.GetPlayerInfo().SetMaxMapID(maxMapID)
        return
    
    ## ºÍ·þÎñÆ÷¶Ï¿ª
    #  @param None : None
    #  @return bool
    #  @remarks
    def OnServerDisconnect(self, packOnServerDisconnect):
        logging.info("RobotCheckTT  peer:0x%08X serverdisconnect, reason:%s " % \
                      (self.robot.GetPeerValue(), packOnServerDisconnect.Reason))
        self.robot.SetIsLoginOK(False)
        self.robot.SetLastDisconnectReason(packOnServerDisconnect.Reason)
        from Robot import RobotMgr
        RobotMgr.GetRobotMgr().DisconnectServer(self.robot)
        return
    
    
    ## ·þÎñÆ÷×¼±¸Íê³É
    #  @param None : None
    #  @return bool
    #  @remarks
    def OnServerPrepared(self, packOnServerPrepared):
        #=======================================================================
        # loginPack = tagCPlayerLogin()
        # loginPack.AccID =
        # logging.debug(str(loginPack.AccID))
        # loginPack.Password = base64.standard_b64encode()
        # loginPack.Version = ConfigIniReader.GetConfig().GetVersionNo()
        # logging.info("RobotCheckTT  peer:0x%08X OnServerPrepared %s,%s,%d"%  \
        #             (self.robot.GetPeerValue(), loginPack.AccID, loginPack.Password, loginPack.Version)) 
        #=======================================================================
        # Êý¾Ý¿âÈ¡³öΪunicodeÐèҪתstr
        if self.IsTokenLogOn():
            return
        
        #self.robot.Send(loginPack)
        return
    
    
    ## ÊÇ·ñTokenµÇ½
    #  @param None : None
    #  @return bool
    #  @remarks
    def IsTokenLogOn(self):
        #·¢°üTokenµÇ½
 
#===============================================================================
# class  tagCPlayerLogin(Structure):
#    Head = tagHead()
#    IDType = 0    #(BYTE IDType)//Õ˺ÅÀàÐÍ.0:ÆÕͨÕ˺Å;1:FreeSDK;
#    AccID = ""    #(char AccID[65])// ÉçȺÕ˺ŵij¤¶ÈÊÇ30
#    Password = ""    #(char Password[33])//size = Len£¬¿É·¢token
#    Version = 0    #(DWORD Version)
#    LineNO = 0    #(BYTE LineNO)
#    MAC = ""    #(char MAC[18])//MACµØÖ·
#    AppID = 0    #(DWORD AppID)//Ó¦ÓñàÂë, ½ÓFreeSDK
#    AccountID = 0    #(DWORD AccountID)//Óû§IDÓëÕ˺Ų»Í¬£¬½ÓFreeSDK
#    TokenExpire = ""    #(char TokenExpire[20])//ʱ¼ä´Á£¬ºÁÃë¼¶£¬½ÓFreeSDK
#    Phone = 0    #(BYTE Phone)//ÊÇ·ñ°ó¶¨ÊÖ»ú
#    ServerID = 0    #(DWORD ServerID)//·þÎñÆ÷ID
#    data = None
#===============================================================================
 
 
 
        #=======================================================================
        # cAccessLogin = tagCAccessLogin()
        # cAccessLogin.AccessToken = self.robot.GetRobotConfig()[0]
        # cAccessLogin.MAC = self.robot.GetRobotConfig()[2]
        # cAccessLogin.Version = ConfigIniReader.GetConfig().GetVersionNo()
        #=======================================================================
        accID, appID, sid = self.robot.GetRobotConfig()[1].split("@")
        cAccessLogin = tagCPlayerLogin()
        cAccessLogin.IDType = 1
        cAccessLogin.AccID = accID
        cAccessLogin.Password = self.robot.GetRobotConfig()[0]
        cAccessLogin.Version = ConfigIniReader.GetConfig().GetVersionNo()
        cAccessLogin.LineNO = 255
        cAccessLogin.MAC = self.robot.GetRobotConfig()[2]
        cAccessLogin.AppID = appID
        cAccessLogin.ServerID = int(sid[1:])
        cAccessLogin.Adult = self.robot.GetRobotConfig()[3]
        cAccessLogin.ExtraLen = len(appID)
        cAccessLogin.Extra = appID
        
        self.robot.Send(cAccessLogin)
        #print "New Player Login ---------- ", self.robot.GetRobotConfig()[1]
        return True
    
    
    ## ÇëÇó°æ±¾
    #  @param None : None
    #  @return bool
    #  @remarks
    def OnAskClientVersion(self, packOnAskClientVersion):
        ClientVersionPack = tagCClientVersion()
        ClientVersionPack.Version = ConfigIniReader.GetConfig().GetClientVersion()
        ClientVersionPack.VersionLen = len(ClientVersionPack.Version)
        #logging.info("RobotCheckTT  peer:0x%08X OnAskClientVersion %s,%d"% \
        #              (self.robot.GetPeerValue(), ClientVersionPack.Version, ClientVersionPack.VersionLen))
        self.robot.Send(ClientVersionPack)
        return
    
    
    ## µÇ½
    #  @param None : None
    #  @return bool
    #  @remarks
    def OnShowLoginFrm(self, packOnShowLoginFrm):
        if packOnShowLoginFrm.Type == 1:
            #ÐèÒª´´½¨½ÇÉ«
            pack = tagCRoleLoginAsk()
            pack.Type = 1
            #logging.info("RobotCheckTT  peer:0x%08X OnShowLoginFrm 1"%(self.robot.GetPeerValue()))
            self.robot.Send(pack)
            return
        if packOnShowLoginFrm.Type == 2:
            #Ñ¡Ôñ½ÇÉ«
            pack = tagCRoleLoginAsk()
            pack.Type = 2
            #logging.info("RobotCheckTT  peer:0x%08X OnShowLoginFrm 2"%(self.robot.GetPeerValue()))
            self.robot.Send(pack)
            return
        return
 
 
    ## µØÍ¼×¼±¸Íê³É
    #  @param None : None
    #  @return bool
    #  @remarks
    def OnServerPrepareOK(self, packOnServerPrepareOK):
        
        #֪ͨGameServer×Ô¼º¶ÁÈ¡µØÍ¼³É¹¦
        pack = tagCInitMapOK()
        pack.MapID = self.MapID
        self.robot.Send(pack)
        
        #ÉèÖýøÈëÍæ¼ÒÊý¾Ý
        self.robot.GetPlayerInfo().SetRoundNpcDict({})
        #logging.info("RobotCheckTT  peer:0x%08X OnServerPrepareOK"%(self.robot.GetPeerValue()))
    
    
    ## ´´½¨Ö÷½Ç
    #  @param None : None
    #  @return bool
    #  @remarks
    def OnNeedCreateRole(self, packOnNeedCreateRole):
        #logging.info("RobotCheckTT  peer:0x%08X OnNeedCreateRole"%(self.robot.GetPeerValue()))
        pack = tagCCreateRole()
        pack.Name = self.robot.GetRobotConfig()[1].split('@')[0]
        pack.Sex = 1
        pack.Hair = 10002
        pack.HairColor = 1
        pack.Face = 10006
        pack.FacePic = 11004
        
        pack.PlayerType = 1
        pack.Job = random.choice([1, 2])
        self.robot.Send(pack)
        return
    
    
    ## Ö÷½Ç³õʼ»¯
    #  @param None : None
    #  @return bool
    #  @remarks
    def OnCDBPlayer(self, packOnCDBPlayer):
        self.MapID = packOnCDBPlayer.MapID
        #=======================================================================
        # logging.info("RobotCheckTT  peer:0x%08X Player%sLogin, ID:%d, AccID:%s " \
        #                "HP:%d MP:%d, MapID:%d Pos:(%d,%d)"%(\
        #                self.robot.GetPeerValue(), packOnCDBPlayer.PlayerName,
        #                packOnCDBPlayer.PlayerID, packOnCDBPlayer.AccID, packOnCDBPlayer.HP, 
        #                packOnCDBPlayer.MP, packOnCDBPlayer.MapID,
        #                packOnCDBPlayer.PosX, packOnCDBPlayer.PosY))  
        #=======================================================================
        self.robot.SetPlayerInfo(PlayerData(packOnCDBPlayer.AccID, \
                                packOnCDBPlayer.PlayerID, packOnCDBPlayer.PlayerName, \
                                packOnCDBPlayer.MapID, packOnCDBPlayer.PosX, packOnCDBPlayer.PosY, {}, packOnCDBPlayer.Job))  
    
        self.robot.GetPlayerInfo().SetPlayerLV(packOnCDBPlayer.LV)
        self.robot.GetPlayerInfo().SetGold(packOnCDBPlayer.Gold)
        self.robot.GetPlayerInfo().SetLineID(packOnCDBPlayer.LineID)
        self.robot.GetPlayerInfo().SetTJGTime(packOnCDBPlayer.HappyPoint)
        self.robot.GetPlayerInfo().SetFBID(packOnCDBPlayer.FBID)
        
        self.robot.GetPlayerInfo().SetGMLV(packOnCDBPlayer.GMLevel)
        
        self.robot.GetPlayerInfo().SetJob(packOnCDBPlayer.Job)
        self.robot.GetPlayerInfo().SetPlayerID(packOnCDBPlayer.PlayerID)
        
    ## 04 01 ÈËÎïËùÔڵij¡¾°³õʼ»¯#tagPlayerMapInit 
    #  @param None : None
    #  @return bool
    #  @remarks   
    def OnPlayerMapInit(self, packOnPlayerMapInit):
        #logging.info("RobotCheckTT  peer:0x%08X ÈËÎïËùÔڵij¡¾°³õʼ»¯"%(self.robot.GetPeerValue()))
        self.MapID = packOnPlayerMapInit.MapID
        self.robot.GetPlayerInfo().SetMapID(self.MapID)
        self.robot.GetPlayerInfo().SetPosX(packOnPlayerMapInit.PosX)
        self.robot.GetPlayerInfo().SetPosY(packOnPlayerMapInit.PosY)
        return
    
    
    ## 04 03 Íæ¼ÒµÇ¼Êý¾Ý·¢ËÍÍê±ÏOK#tagPlayerLoginLoadOK
    #  @param None : None
    #  @return bool
    #  @remarks 
    def OnPlayerLoginLoadOK(self, packOnPlayerLoginLoadOK):
        #logging.info("RobotCheckTT  peer:0x%08X tagPlayerLoginLoadOK"%(self.robot.GetPeerValue()))
        self.robot.SetIsLoginOK(True)
        self.robot.ClearDisconnectReason()
        
        sightPack = tagCMSightZoom()
        sightPack.Sight = 18    
        self.robot.SendMapServerPYPack(sightPack)
        
        if self.GMCmd():
            if not self.robot.GetPlayerInfo().GetStartWorldTick():
                sendPack = tagCMWorldTick()
                self.robot.SendMapServerPYPack(sendPack)
            return
        
        if not self.robot.GetPlayerInfo().GetStartWorldTick():
            sendPack = tagCMWorldTick()
            self.robot.SendMapServerPYPack(sendPack)
        
        mapData = ChinMapReader.GetChinMapData().FindMapByID(self.robot.GetPlayerInfo().GetMapID())
 
        if mapData and mapData.MapFBType != 0:
 
            sendPack = tagCExitFB()
            self.robot.Send(sendPack)
            return
            
            
        #self.SendEventAnswer()
        self.RefreshPoint()
    
    
    def GMCmd(self):
        if self.robot.GetPlayerInfo().GetGMLV() != 90:
            pack = tagCGMCMD()
            pack.Clear()
            cmd = "@SetGM 90"
            pack.CmdLen = len(cmd)
            pack.Cmd = cmd
            self.robot.Send(pack)
            #logging.info("GMCmd---SetGM")
 
        
        if self.robot.GetPlayerInfo().GetPlayerLV() == 1:
            cmd = "OpenFunc 1"
            pack = tagCGMCMD()
            pack.Clear()
            pack.CmdLen = len(cmd)
            pack.Cmd = cmd
            self.robot.Send(pack)
            
            cmd = "imba %s"%random.randint(5, 300)
            pack = tagCGMCMD()
            pack.Clear()
            pack.CmdLen = len(cmd)
            pack.Cmd = cmd
            self.robot.Send(pack)
            #logging.info("GMCmd---imba")
            
            return True
        return False
    
    def GetDist(self, posX, posY, tagX, tagY):
        return max(abs(posX - tagX), abs(posY - tagY))
    
    # ÖØÉè¹Ò»úµã
    def RefreshPoint(self):
        MapEventPointReader.GetMapEventPoint().FindNPC(self.robot)
        point = self.robot.GetPlayerInfo().GetTJGPoint()
        if not point:
            return
        
        mapID, (posX, posY), npcID = point
        
        #mapID, posX, posY = 10010, 207, 105
        
        if posX == 0 and posY == 0:
            logging.info("¹Ò»úµã±í´íÎ󣡣¡£¡ npcID = %s"%npcID)
            return
        
        if self.robot.GetPlayerInfo().GetMapID() == mapID and \
        self.GetDist(posX, posY, self.robot.GetPlayerInfo().GetPosX(), self.robot.GetPlayerInfo().GetPosY()) < 10:
            # Òѵ½Ä¿±êµã
            return
        
        # 1.´«ËͰü£¬2.ÉèÖùһúNPC 3.×é¶Ó
        
        sendPack = tagCWorldTransfer()
        sendPack.Type = 1
        sendPack.MapID = mapID
        sendPack.PosX = posX + random.randint(-10, 10)
        sendPack.PosY = posY + random.randint(-10, 10)
        sendPack.ExtField1 = self.robot.GetPlayerInfo().GetFBID()#random.randint(0, 2) # ¿ÉÒÔ¸ù¾ÝÏß·Çé¿ö·ÖÅä
        self.robot.Send(sendPack)
        
        self.robot.GetPlayerInfo().SetPosX(posX)
        self.robot.GetPlayerInfo().SetPosY(posY)
        
        if mapID != self.robot.GetPlayerInfo().GetMapID():
            logging.debug("µØÍ¼Çл»¹Ò»ú----%s-%s"%(mapID,self.robot.GetPlayerInfo().GetMapID()))
            return
        
        self.JoinTeam()
        return
    
    
    def JoinTeam(self):
        if self.robot.GetPlayerInfo().GetTeamID() != 0:
            return
        if not self.robot.GetIsLoginOK():
            return
        
        #=======================================================================
        # logging.debug("×é¶ÓÉêÇë----%s"%self.robot.GetPlayerInfo().GetPlayerID())
        # sendPack = tagCGAutoMatchTeam()
        # self.robot.SendGameServerPYPack(sendPack)
        # 
        # sendPack = tagCGCreateTeam()
        # sendPack.TagMapID = 0
        # sendPack.TagMapEx = 0
        # sendPack.ReqMinLV = 1
        # sendPack.ReqMaxLV = 0
        # self.robot.SendGameServerPYPack(sendPack)
        #=======================================================================
    
 
        
 
    """
                    ÊµÏÖ¸÷ÖÖÏûÏ¢»Øµ÷º¯Êý£¬
        1. Ïò·þÎñ¶Ë·¢°ü¿ÉʹÓÃÀàËÆ
        onlineR = tagCOnlineReturn()
        self.robot.Send( onlineR )
        
        2.Èç¹ûÐèÒªÏòRobot±£´æÊý¾Ý£¬ÔòÊÂÏÈÈ·ÈÏÕâЩÊý¾ÝÊÇ·ñÖ»ÊÇAIÔËÐÐÏà¹Ø£¬
                      ¶øÓëʹÓÃRobotµÄÆäËûÀàµÄʵÀýÎÞ¹Ø
                    Èç¹ûÊÇÕâÖÖÇé¿ö£¬Çë²»Òª±£´æµ½Robot£¬¶øÓ¦¸ÃÔÚ¶ÔÓ¦µÄAIµÄ×ÓÀàÄÚ±£´æÊý¾Ý
                    
        3.Èç¹ûÐèÒªÖÜÆÚÐԻص÷£¬ÔòÔÚ__init__ʱÉèÖÃTimer£¬ÌáÊ¾ÖØÔØ_Processº¯Êý
    """