Exemplo n.º 1
0
def setlevel(session, args):
    from model import PlayerModel
    session.player.level = int(args[1])
    session.player.onLevelUp()
    session.player.updateLevelProp()
    # 发送属性数据
    PlayerModel.sendPropUpdateMsg(session.player)
Exemplo n.º 2
0
def setlevel(session, args):
    from model import PlayerModel
    n = session.player.angerMax
    if len(args) >= 2:
        n = int(args[1])
    session.player.addAnger(n)
    session.player.updateLevelProp()
    # 发送属性数据
    PlayerModel.sendPropUpdateMsg(session.player)
Exemplo n.º 3
0
    def callback(dbSet):
        #异步载入数据库,需要验证session是否仍然有效,有可能下线了
        db = dbSet['player']
        if session.isValid() == False or session.player:
            return False

        if len(db.result) == 0:
            ffext.dump('no this role')
            return False
        else:
            player = PlayerModel.Player(db.result[0])
            #ffext.dump(dbSet)
            session.setPlayer(player)
            if x != 0 and y != 0:
                player.x = x
                player.y = y

            #载入数据
            ffext.dump('load player =%s' % (session.player.name))
            session.verify_id(session.player.uid)
            dbTask = dbSet['task']
            dbitem = dbSet['item']
            dbFriend = dbSet['friend']
            dbEnemy = dbSet['enemy']
            dbGuild = dbSet['guild']
            dbPet = dbSet['pet']
            dbMail = dbSet['mail']
            dbLoginAct = dbSet['login_activity']
            if dbTask.isOk():
                player.taskCtrl.fromData(dbTask.result)
            if dbitem.isOk():
                player.itemCtrl.fromData(dbitem.result)
                #TaskHandler.processQueryTask(session)
            #初始化好友信息、仇人信息,屏蔽信息
            if dbFriend.isOk():
                player.friendCtrl.fromDataFriend(dbFriend.result)
            if dbEnemy.isOk():
                player.friendCtrl.fromDataEnemy(dbEnemy.result)
            #初始化行会信息
            if dbGuild.isOk():
                player.guildCtrl.fromData(dbGuild.result)
            player.petCtrl.fromData(dbPet.result)
            if dbMail.isOk():
                player.mailCtrl.fromData(dbMail.result)
            if dbLoginAct.isOk():
                player.loginActCtrl.fromData(dbLoginAct.result)
        # 发送属性数据
        PlayerModel.sendPropUpdateMsg(player)
        #发消息通知,通知上线
        tmpReq = MsgDef.EnterMapReq(player.mapname, player.x, player.y)
        processEnterMapReq(session, tmpReq, True)
        #发送技能数据
        SkillHandler.processQuerySkill(session)
        #发送包裹数据
        ItemHandler.processQueryPkg(session)
        #发送装备数据
        ItemHandler.processQueryEquip(session)
        #发送任务数据
        TaskHandler.processQueryTask(session)
        #发送好友数据
        FriendHandler.processListFriend(
            session,
            MsgDef.FriendListMsgReq(MsgDef.FriendListClientCmd.GET_FRIENDLIST))
        #发送行会数据
        GuildHandler.processGuildInfo(session)
        #发送结义数据
        TeamHandler.processBrotherOps(
            session,
            MsgDef.BrotherOpsReq(MsgDef.BrotherClientCmd.GET_BROTHERLIST))
        #发送安全码
        processMoneyBankOps(session)
        processQueryPet(session)
        from handler import MarryHandler
        MarryHandler.processMarryOPS(
            session,
            MsgDef.MarriageOpsReq(MsgDef.MarriageClientCmd.MARRY_QUERY_STATUS))
        SkillHandler.processAttackModeReq(session)  #发送攻击模式
        from handler import MailHandler
        MailHandler.processMarryOPS(session, MsgDef.MailOpsReq(0))
        #msg = MsgDef.UpdateSkillPosReq({320:1})
        #SkillHandler.processUpdateSkillPosReq(session, msg)
        #结义数据
        # if player.brotherCtrl:
        #     BrotherModel.handleQueryBrother(player)

        player.checkTimeAfterInit()
        # 登录(old)-记录log
        LogModel.logLoginData(accountid, player.uid, player.name,
                              LogModel.LoginOpType.LOGIN_PLAYER,
                              LogModel.LoginReason.OLD_LOGIN)
        return