Пример #1
0
 def buildEnterMapMsg(self, flag=False):
     retMsg = MsgDef.MonsterEnterMapRet(self.propCfg.appr, self.uid,
                                        self.name, self.x, self.y,
                                        self.direction, self.hp, self.hpMax,
                                        self.propCfg.cfgId)
     retMsg.level = self.propCfg.level
     if flag != False:
         retMsg = ffext.encodeMsg(retMsg)  #, flag, flag
     return retMsg
Пример #2
0
 def buildEnterMapMsg(self, flag=False):
     retPlayer = buildPlayerInfoRet(self)
     retMsg = MsgDef.EnterMapRet(retPlayer)
     retMsg2 = retMsg
     if flag != False:
         retMsg = ffext.encodeMsg(retMsg)
     #tmpTest = MsgDef.EnterMapRet()
     #ffext.thriftDecodeMsg(tmpTest, retMsg)
     #ffext.dump('buildEnterMapMsg', self.name, retMsg2, len(retMsg), tmpTest)
     return retMsg
Пример #3
0
    def broadcast(self, x, y, cmd, msg, excludePlayer=None):
        #ffext.dump('broadcast', x, y, cmd, msg)
        excludeUid = 0
        if excludePlayer:
            excludeUid = excludePlayer.uid
        ffext.ff.broadcast(self.mapname, x, y, cmd, ffext.encodeMsg(msg),
                           excludeUid)
        return True

        def cb(obj):
            if obj.getType() == Base.PLAYER and obj.uid != excludeUid:
                obj.sendMsg(cmd, msg)
            return

        self.foreachInRange(x, y, cb)
        return True
Пример #4
0
 def buildMoveMapMsg(self, newX, newY, flag=False):
     retMsg = MsgDef.MoveRet(newX, newY, self.uid, self.direction)
     if flag:
         retMsg = ffext.encodeMsg(retMsg)  #, flag, flag
     return retMsg
Пример #5
0
 def buildLeaveMapMsg(self, flag=False):
     retMsg = MsgDef.LeaveMapRet(self.uid)
     if flag != False:
         retMsg = ffext.encodeMsg(retMsg)  #, flag, flag
     return retMsg
Пример #6
0
 def buildEnterMapMsg(self, flag=False):
     retMsg = MsgDef.NpcEnterMapRet(self.appr, self.uid, self.name, self.x,
                                    self.y, self.direction, self.cfg.cfgid)
     if flag != False:
         retMsg = ffext.encodeMsg(retMsg)  #, flag, flag
     return retMsg