GetGuanJue() public method

public GetGuanJue ( ) : GameStruct.GUANGJUELEVEL
return GameStruct.GUANGJUELEVEL
Beispiel #1
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);
        }
Beispiel #2
0
        public void SendRoleInfo(PlayerObject play)
        {
            NetMsg.MsgRoleInfo role = new NetMsg.MsgRoleInfo();
            role.Create(null, this.GetGamePackKeyEx());
            role.role_id = play.GetTypeId();
            role.x = play.GetCurrentX();
            role.y = play.GetCurrentY();
            role.armor_id = play.GetItemSystem().GetArmorLook();
            role.wepon_id = play.GetItemSystem().GetWeaponLook();
            // role.face_sex = play.GetFace();
            role.face_sex = (uint)play.GetLookFace();
            role.face_sex1 = play.GetBaseAttr().lookface;

            role.dir = play.GetDir();
            role.action = play.GetCurrentAction();
            role.guanjue = (byte)play.GetGuanJue();
            role.hair_id = play.GetBaseAttr().hair;
            role.str.Add(play.GetName());
            role.rid_id = play.GetMountID();

            //军团
            if (play.GetLegionSystem().IsHaveLegion() && play.GetLegionSystem().GetLegion() != null)
            {
                role.legion_id = play.GetLegionSystem().GetLegion().GetBaseInfo().id;
                role.legion_title = play.GetLegionSystem().GetLegion().GetBaseInfo().title;
                role.legion_place = play.GetLegionSystem().GetPlace();
                role.legion_id1 = role.legion_id;
            }

            this.SendData(role.GetBuffer());
            //发送状态
            play.GetTimerSystem().SendState(this);
            //军团名称-
            if (role.legion_id > 0)
            {
                NetMsg.MsgLegionName legion = new NetMsg.MsgLegionName();
                legion.Create(null, this.GetGamePackKeyEx());
                legion.legion_id = role.legion_id;
                legion.legion_name = play.GetLegionSystem().GetLegion().GetBaseInfo().name;
                this.SendData(legion.GetBuffer());

            }
            //加到对方玩家可视列表
            //if (!this.GetVisibleList().ContainsKey(play.GetGameID()))
            //{
            //    RefreshObject refobj = new RefreshObject();
            //    refobj.bRefreshTag = true;
            //    refobj.obj = play;
            //    this.GetVisibleList()[play.GetGameID()] = refobj;
            //}
            this.AddVisibleObject(play, true);
            //前面发送了角色的lookface 却并没有变为鬼魂状态,用这个协议号再改变一次..偷个懒 省的去分析封包结构了。
            if (play.IsDie() && play.IsGhost())
            {
                play.ChangeAttribute(UserAttribute.LOOKFACE, play.GetLookFace(), true);
            }
        }
Beispiel #3
0
        public void SendGuanJueInfo(PlayerObject play)
        {
            //  byte[] data1 = { 25, 0, 247, 3, 0, 0, 0, 0, 113, 0, 1, 12, 49, 32, 45, 49, 32, 51, 48, 48, 48, 48, 48, 48, 0 };
            //捐献的
            ulong guanjue = play.GetBaseAttr().guanjue;
            byte[] byte_ = Coding.GetDefauleCoding().GetBytes(guanjue.ToString());
            GameBase.Network.PacketOut outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx());
            outpack.WriteUInt16((ushort)(byte_.Length + 4 + 14));
            outpack.WriteUInt16(1015);
            outpack.WriteUInt32(0);
            outpack.WriteUInt16(113);
            outpack.WriteByte(1);

            //长度--
            outpack.WriteByte((byte)(byte_.Length + 5));
            String sjuewei = ((byte)play.GetGuanJue()).ToString();
            byte[] jueweibyte_ = Coding.GetDefauleCoding().GetBytes(sjuewei);
            outpack.WriteByte(jueweibyte_[0]); //爵位
            outpack.WriteByte(32); //分隔符
            outpack.WriteByte(45);
            outpack.WriteByte(49);
            outpack.WriteByte(32); //分隔符
            outpack.WriteBuff(byte_);
            outpack.WriteByte(0);

            play.SendData(outpack.Flush());
        }