예제 #1
0
 def __init__(self):
     setattr(Game, self._rpc_name_, self)
     self.max_players = config.max_players
     self.logic_players = config.logic_players
     self._users = {}
     self._players = {}
     self._sub_mgrs = {}
     self.mgr2addrs = {}
     self.logons = TimeMemCache(size=10000,
                                default_timeout=2,
                                name='rpc_player_mgr.logons')
     #        self.names = TimeMemCache(size=10000, default_timeout=1*30) #缓存保证不重名
     self.name2pids = {}
     self.pid2names = {}
     self._name_lock = RLock()
     self._new_player_lock = RLock()
     self.names4ad = {}
     self.overload_time = 0
     self._debug_ips = None
     self._debug_status = False
     self._area_url = None
     self._area_legal = None
     import app
     from game.base import msg_define
     app.sub(msg_define.MSG_START, self.start)
예제 #2
0
 def __init__(self, player):
     if 0:
         from game.player import player as player_md
         self.player = player_md.Player()
         self.rpc = ClientRpc()
     self.player = player
     self.active = True
     self.rpc = None
     self._lock = RLock()
예제 #3
0
파일: arena.py 프로젝트: hw233/twisted_zdzl
    def __init__(self):
        self.arenas = TimeMemCache(
            size=CACHE_SIZE,
            default_timeout=CACHE_TIME)  #玩家信息 {pid:PlayerArena}
        self.rivals = TimeMemCache(
            size=CACHE_SIZE, default_timeout=CACHE_TIME)  # {pid:[name, rid]}
        self.rewards = HitMemCache(size=CACHE_SIZE)
        self.bots = {}

        self._lock = RLock()
        self.stoped = True
        self._reward_task = None
        self._auto_start_task = None
        self.clear()
        app.sub(MSG_START, self.start)
        self._active_mul = 1

        self.sorts = {}  #数据库中保存,方便修改 {sort:id}
예제 #4
0
 def __init__(self):
     AllyMgr._instance = self
     #全部声望和glory_pid一起使用
     self.glorys = []
     #声望对应的pid, 和glory一起使用
     self.glory_pids = []
     #同盟的主表
     self.allys = {}
     #PID->ally
     self.pid2ally = {}
     #同盟的排名,改存储ally_id
     self.allys_rank = []
     self.clear_gm_ally()
     self._lock_modify = RLock()
     self.deco_types = {}
     self._boat_types = {}
     self.boat_lv2exp = {}
     self.boat_exp2lv = {}
     self.boat_type_num = {}
     #龙晶捐献同盟增加的建设度
     self.crystal_ally_v = 0
     #龙晶捐献玩家增加的建设度
     self.crystal_player_v = 0
예제 #5
0
GUARD_COUNT = 5  #精英怪出场数
GUARD_GOOD = 0
GUARD_NORMAL = 1
GT_NORMAL = 1
GT_GOOD = 2
GT_BOSS = 3

#状态 1=正常, 2=挂机, 3=完成
DT_NORMAL = 1
DT_AUTO = 2
DT_COMPLETE = 3

NORMAL_PER_FLOOR = FLOOR_BOSS_START

_deep_lock = RLock()


def handle_pass_day():
    """ 当天服宝箱设置 """
    status_mgr = Game.rpc_status_mgr
    with _deep_lock:
        data = status_mgr.get(STATUS_DEEP_FT)
        if not (data is None or common.is_pass_day(data['ft'])):
            return data
        data = dict(ft=int(time.time()), box={})
        boxs = data['box']
        for box in Game.res_mgr.deep_boxs.itervalues():
            floor = box.random_floor()
            if isinstance(floor, (list, tuple)):
                for fl in floor:
예제 #6
0
    def __init__(self):
        Player._wrefs[id(self)] = self

        self.data = PlayerData()
        self._game = Game.instance
        if self._game is None:
            self._game = Game
            Player.no_game = True

        self.user = None
        self._rpc = None
        self._disable_send = 0
        self._proxy = None
        self.logined = False
        self.save_time = 0
        self._save_lock = RLock()

        #保存其它的运行期对象 player保存时,调用对象方法: obj.save(store)
        self.runtimes = CustomObject()
        #保存角色退出时需要调用清理方法的对象
        self.logout_objs = set([])

        #场景
        self.rpc_scene = None
        #物品列表
        self.bag = Bag(self)
        #待收取物品列表
        self.wait_bag = PlayerWaitBag(self)
        #配将
        self.roles = PlayerRoles(self)
        #任务信息
        self.task = PlayerTask(self)
        #玩家属性
        self.play_attr = PlayerAttr(self)
        #玩家阵型
        self.positions = PlayerPositions(self)
        #玩家打坐
        self.sit = PlayerSit(self)
        #玩家地图信息
        self.maps = PlayerMap(self)
        #邮件
        self.mail = PlayerMail(self)
        #buff
        self.buffs = PlayerBuff(self)
        #vip
        self.vip = PlayerVip(self)
        #大喇叭
        self.hron = PlayHornMgr(self)
        #玩家成就信息(每日成就, 永久成就)
        self.achievement = PlayerAchievement(self)
        #角色属性
        self.property = PlayerProperty(self)

        #玩家胜利战斗id(仅内存中,不存数据库,为防止作弊)
        self.win_fights = IntBiteMap()
        self.vip_attr = PlayerVipAttr(self)

        #ally = {'aid': 同盟ID, 'n': 同盟名字}
        self.ally = None
        self.other_init()

        if 0:
            from game.scene.scene import Scene
            self.user = User()
            self._rpc = ClientRpc()
            self._game = Game()
            self.rpc_scene = Scene()
예제 #7
0
 def __init__(self, player):
     self.player = player
     #兵符任务
     self.bfTaskData = None
     self._lock = RLock()