SetGuanJue() public method

public SetGuanJue ( GameStruct info ) : void
info GameStruct
return void
示例#1
0
        public void AddTempPlayObject(GameBase.Network.Internal.RoleInfo info)
        {
            TempPlayObject temp = new TempPlayObject();
            PlayerObject play = new PlayerObject();
            temp.play = play;
            temp.key = info.mKey;
            temp.key2 = info.mKey1;
            temp.isRole = info.isRole;
            temp.accountid = info.accountid;
            //基本属性
            m_DicTempPlayObject[play.GetGameID()] = temp;

            if (temp.isRole)
            {
                play.SetName(info.name);
                GameStruct.PlayerAttribute attr = play.GetBaseAttr();
                attr.account_id = info.accountid;
                attr.player_id = info.playerid;
                attr.mana = info.mana;
                attr.lookface = info.lookface;
                attr.hair = info.hair;
                attr.profession = info.profession;
                attr.level = info.lv;
                attr.exp = (int)info.exp;
                attr.life = info.life;
                attr.pk = info.pk;
                attr.gold = info.gold;
                attr.gamegold = info.gamegold;
                attr.stronggold = info.stronggold;
                attr.mapid = (uint)info.mapid;
                attr.guanjue = info.guanjue;
                attr.sAccount = info.sAccount;
                attr.godlevel = (byte)info.godlevel;
                attr.maxeudemon = info.maxeudemon;
                play.SetHotKeyInfo(info.hotkey);
                play.CalcSex();
                play.SetPoint(info.x, info.y);

                //官爵信息
                GameStruct.GUANGJUELEVEL gjlevel = GuanJueManager.Instance().GetLevel(play);
                play.SetGuanJue(gjlevel);
                //初始化军团信息
                play.GetLegionSystem().Init();
            }
        }
示例#2
0
        //玩家捐献爵位
        public void Donation(PlayerObject play, GameStruct.MONEYTYPE type, int value)
        {
            const int MIN_GOLD = 3000000; //最低捐献金额- 防封包
            GameStruct.GUANGJUELEVEL oldlv = play.GetGuanJue();
            int gold = 0;
            switch (type )
            {
                case GameStruct.MONEYTYPE.GOLD:
                    {
                        if (gold < MIN_GOLD)
                        {
                            play.LeftNotice("最低捐献" + MIN_GOLD.ToString() + "万金币起。");
                            return;
                        }
                        if (play.GetMoneyCount(GameStruct.MONEYTYPE.GOLD) < value)
                        {
                            play.LeftNotice("金币不足,无法捐献!");
                            return;
                        }
                        gold = value;
                        play.ChangeAttribute(GameStruct.UserAttribute.GOLD, -gold);
                        break;
                    }
                case GameStruct.MONEYTYPE.GAMEGOLD:
                    {
                        if (play.GetMoneyCount(GameStruct.MONEYTYPE.GAMEGOLD) < value)
                        {
                            play.LeftNotice("魔石不足,无法捐献!");
                            return;
                        }
                        play.ChangeAttribute(GameStruct.UserAttribute.GAMEGOLD, -value);
                        //转换成金币 一个魔石等于7100金币
                        const int _gold = 7100;
                        gold = value * _gold;
                        if (gold < MIN_GOLD)
                        {
                            play.LeftNotice("最低捐献"+MIN_GOLD.ToString()+"万金币起。");
                            return;
                        }
                        break;
                    }
            }

            play.GetBaseAttr().guanjue += (uint)gold;

            SetValue(play.GetBaseAttr().player_id,play.GetName() ,play.GetBaseAttr().guanjue);
            //通知客户端

            //重新计算一下等级
            GameStruct.GUANGJUELEVEL level = this.GetLevel(play);
            //爵位被改变- 发公告
            if (oldlv != level)
            {
                this.SendChangeGuanJueMsg(play, level);
            }
            if (level != play.GetGuanJue())
            {
                play.SetGuanJue(level);

            }
            this.SendGuanJueInfo(play);

            DB_Update(play);
        }