Exemple #1
0
 public void method_20(PetMode petMode_0, int int_0 = 0)
 {
     this.Log.Trace <PetMode, int>("Set pet mode {petMode} ({extra})", petMode_0, int_0);
     this.Connection.SendMessage(new GClass163(new GClass257((int)petMode_0), int_0));
     this.Connection.Game.Hero.Pet.Mode      = petMode_0;
     this.Connection.Game.Hero.Pet.ModeExtra = int_0;
 }
Exemple #2
0
    public void Run(GClass256 e)
    {
        HeroPet pet  = ConnectionManager.Instance.Value.Game.Hero.Pet;
        PetMode mode = (PetMode)e.gclass257_0.Mode;

        pet.Modes[mode] = new HeroPet.PetModeData(e, mode);
    }
Exemple #3
0
 public PetModeData(GClass256 gclass256_0, PetMode petMode_0)
 {
     Class13.lOBHd9Nzn7x2T();
     base..ctor();
     this.Extra = new List <int>();
     this.Data  = gclass256_0;
     this.Mode  = petMode_0;
 }
Exemple #4
0
 public PetModeData(GClass261 gclass261_0, PetMode petMode_0)
 {
     Class13.NP5bWyNzLwONS();
     base..ctor();
     this.Extra = new List <int>();
     this.Data  = gclass261_0;
     this.Mode  = petMode_0;
 }
Exemple #5
0
        public void method_19(GClass227 gclass227_0)
        {
            PetMode mode = (PetMode)gclass227_0.Mode.Mode;

            HeroPet.PetModeData petModeData;
            if (!this.Modes.TryGetValue(mode, out petModeData))
            {
                return;
            }
            petModeData.Extra = gclass227_0.vector_0;
        }
Exemple #6
0
        public void method_18(GClass261 gclass261_0)
        {
            PetMode mode = (PetMode)gclass261_0.gclass262_0.Mode;

            HeroPet.PetModeData petModeData;
            if (!this.Modes.TryGetValue(mode, out petModeData))
            {
                petModeData = (this.Modes[mode] = new HeroPet.PetModeData(gclass261_0, mode));
            }
            petModeData.Data = gclass261_0;
        }
Exemple #7
0
        public CharacterInfo(MySqlDataReader readerCharactersListDB)
        {
            Index           = Convert.ToInt32(readerCharactersListDB["IndexID"]);
            Name            = readerCharactersListDB["Name"].ToString();
            Level           = Convert.ToUInt16(readerCharactersListDB["Level"]);
            Class           = (MirClass)Convert.ToInt32(readerCharactersListDB["Class"]);
            Gender          = (MirGender)Convert.ToInt32(readerCharactersListDB["Gender"]);
            Hair            = Convert.ToByte(readerCharactersListDB["Hair"]);
            InventoryResize = Convert.ToInt32(readerCharactersListDB["InventoryResize"]);
            Array.Resize(ref Inventory, InventoryResize);
            CreationIP   = readerCharactersListDB["CreationIP"].ToString();
            CreationDate = readerCharactersListDB.GetDateTime(readerCharactersListDB.GetOrdinal("CreationDate"));
            Banned       = Convert.ToBoolean(readerCharactersListDB["Banned"]);
            BanReason    = readerCharactersListDB["BanReason"].ToString();

            ExpiryDate = readerCharactersListDB.GetDateTime(readerCharactersListDB.GetOrdinal("ExpiryDate"));

            LastIP          = readerCharactersListDB["LastIP"].ToString();
            LastDate        = readerCharactersListDB.GetDateTime(readerCharactersListDB.GetOrdinal("LastDate"));
            Deleted         = Convert.ToBoolean(readerCharactersListDB["Deleted"]);
            DeleteDate      = readerCharactersListDB.GetDateTime(readerCharactersListDB.GetOrdinal("DeleteDate"));
            CurrentMapIndex = Convert.ToInt32(readerCharactersListDB["CurrentMapIndex"]);
            CurrentLocation = new Point(Convert.ToInt32(readerCharactersListDB["CurrentLocation_X"]), Convert.ToInt32(readerCharactersListDB["CurrentLocation_Y"]));
            Direction       = (MirDirection)Convert.ToInt32(readerCharactersListDB["Direction"]);
            BindMapIndex    = Convert.ToInt32(readerCharactersListDB["BindMapIndex"]);
            BindLocation    = new Point(Convert.ToInt32(readerCharactersListDB["BindLocation_X"]), Convert.ToInt32(readerCharactersListDB["BindLocation_Y"]));
            HP = Convert.ToUInt16(readerCharactersListDB["HP"]);
            MP = Convert.ToUInt16(readerCharactersListDB["MP"]);

            Experience    = Convert.ToInt64(readerCharactersListDB["Experience"]);
            AMode         = (AttackMode)Convert.ToInt32(readerCharactersListDB["AMode"]);
            PMode         = (PetMode)Convert.ToInt32(readerCharactersListDB["PMode"]);
            PKPoints      = Convert.ToInt32(readerCharactersListDB["PKPoints"]);
            Thrusting     = Convert.ToBoolean(readerCharactersListDB["Thrusting"]);
            HalfMoon      = Convert.ToBoolean(readerCharactersListDB["HalfMoon"]);
            CrossHalfMoon = Convert.ToBoolean(readerCharactersListDB["CrossHalfMoon"]);
            DoubleSlash   = Convert.ToBoolean(readerCharactersListDB["DoubleSlash"]);
            MentalState   = Convert.ToByte(readerCharactersListDB["MentalState"]);
            AllowGroup    = Convert.ToBoolean(readerCharactersListDB["AllowGroup"]);
            AllowTrade    = Convert.ToBoolean(readerCharactersListDB["AllowTrade"]);
            Married       = Convert.ToInt32(readerCharactersListDB["Married"]);
            MarriedDate   = readerCharactersListDB.GetDateTime(readerCharactersListDB.GetOrdinal("MarriedDate"));
            MarriedName   = readerCharactersListDB["MarriedName"].ToString();
            Mentor        = Convert.ToInt32(readerCharactersListDB["Mentor"]);
            MentorDate    = readerCharactersListDB.GetDateTime(readerCharactersListDB.GetOrdinal("MentorDate"));
            isMentor      = Convert.ToBoolean(readerCharactersListDB["isMentor"]);
            MentorExp     = Convert.ToInt64(readerCharactersListDB["MentorExp"]);
            MentorName    = readerCharactersListDB["MentorName"].ToString();
            PearlCount    = Convert.ToInt32(readerCharactersListDB["PearlCount"]);
            CollectTime   = Convert.ToInt64(readerCharactersListDB["CollectTime"]);
            CollectTime  += SMain.Envir.Time;
            GuildIndex    = Convert.ToInt32(readerCharactersListDB["GuildIndex"]);
        }
Exemple #8
0
        private void ChangePMode(S.ChangePMode p)
        {

            PMode = p.Mode;
            switch (p.Mode)
            {
                case PetMode.Both:
                    ChatDialog.ReceiveChat("[Pet Mode: Attack and Move]", ChatType.Hint);
                    break;
                case PetMode.MoveOnly:
                    ChatDialog.ReceiveChat("[Pet Mode: Do Not Attack]", ChatType.Hint);
                    break;
                case PetMode.AttackOnly:
                    ChatDialog.ReceiveChat("[Pet Mode: Do Not Move]", ChatType.Hint);
                    break;
                case PetMode.None:
                    ChatDialog.ReceiveChat("[Pet Mode: Do Not Attack or Move]", ChatType.Hint);
                    break;
            }

            MainDialog.PModeLabel.Visible = true;
        }
Exemple #9
0
        public CharacterInfo(BinaryReader reader)
        {
            Index = reader.ReadInt32();
            Name = reader.ReadString();

            Level = reader.ReadByte();
            Class = (MirClass) reader.ReadByte();
            Gender = (MirGender) reader.ReadByte();
            Hair = reader.ReadByte();

            CreationIP = reader.ReadString();
            CreationDate = DateTime.FromBinary(reader.ReadInt64());

            Banned = reader.ReadBoolean();
            BanReason = reader.ReadString();
            ExpiryDate = DateTime.FromBinary(reader.ReadInt64());

            LastIP = reader.ReadString();
            LastDate = DateTime.FromBinary(reader.ReadInt64());

            Deleted = reader.ReadBoolean();
            DeleteDate = DateTime.FromBinary(reader.ReadInt64());

            CurrentMapIndex = reader.ReadInt32();
            CurrentLocation = new Point(reader.ReadInt32(), reader.ReadInt32());
            Direction = (MirDirection)reader.ReadByte();
            BindMapIndex = reader.ReadInt32();
            BindLocation = new Point(reader.ReadInt32(), reader.ReadInt32());

            HP = reader.ReadUInt16();
            MP = reader.ReadUInt16();
            Experience = reader.ReadInt64();

            AMode = (AttackMode) reader.ReadByte();
            PMode = (PetMode) reader.ReadByte();

            if (Envir.LoadVersion > 34)
            {
                PKPoints = reader.ReadInt32();
            }

            int count = reader.ReadInt32();

            Array.Resize(ref Inventory, count);

            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean()) continue;
                UserItem item = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                if (SMain.Envir.BindItem(item) && i < Inventory.Length)
                    Inventory[i] = item;
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean()) continue;
                UserItem item = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                if (SMain.Envir.BindItem(item) && i < Equipment.Length)
                    Equipment[i] = item;
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean()) continue;
                UserItem item = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                if (SMain.Envir.BindItem(item) && i < QuestInventory.Length)
                    QuestInventory[i] = item;
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                UserMagic magic = new UserMagic(reader);
                if (magic.Info == null) continue;
                Magics.Add(magic);
            }

            if (Envir.LoadVersion < 2) return;

            Thrusting = reader.ReadBoolean();
            HalfMoon = reader.ReadBoolean();
            CrossHalfMoon = reader.ReadBoolean();
            DoubleSlash = reader.ReadBoolean();

            if(Envir.LoadVersion > 46)
            {
                MentalState = reader.ReadByte();
            }

            if (Envir.LoadVersion < 4) return;

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
                Pets.Add(new PetInfo(reader));

            if (Envir.LoadVersion < 5) return;

            AllowGroup = reader.ReadBoolean();

            if (Envir.LoadVersion < 12) return;

            if (Envir.LoadVersion == 12) count = reader.ReadInt32();

            for (int i = 0; i < Globals.FlagIndexCount; i++)
                Flags[i] = reader.ReadBoolean();

            if (Envir.LoadVersion > 27)
                GuildIndex = reader.ReadInt32();

            if (Envir.LoadVersion > 30)
                AllowTrade = reader.ReadBoolean();

            if (Envir.LoadVersion > 33)
            {
                count = reader.ReadInt32();

                for (int i = 0; i < count; i++)
                {
                    QuestProgressInfo quest = new QuestProgressInfo(reader);
                    if (SMain.Envir.BindQuest(quest))
                        CurrentQuests.Add(quest);
                }
            }

            if(Envir.LoadVersion > 42)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Buff buff = new Buff(reader);

                    if (Envir.LoadVersion == 51)
                    {
                        buff.Caster = SMain.Envir.GetObject(reader.ReadUInt32());
                    }

                    Buffs.Add(buff);
                }
            }

            if(Envir.LoadVersion > 43)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                    Mail.Add(new MailInfo(reader, Envir.LoadVersion, Envir.LoadCustomVersion));
            }

            //IntelligentCreature
            if (Envir.LoadVersion > 44)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    UserIntelligentCreature creature = new UserIntelligentCreature(reader);
                    if (creature.Info == null) continue;
                    IntelligentCreatures.Add(creature);
                }

                if (Envir.LoadVersion == 45)
                {
                    var old1 = (IntelligentCreatureType)reader.ReadByte();
                    var old2 = reader.ReadBoolean();
                }

                PearlCount = reader.ReadInt32();
            }

            if (Envir.LoadVersion > 49)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                    CompletedQuests.Add(reader.ReadInt32());
            }

            if (Envir.LoadVersion > 50 && Envir.LoadVersion < 54)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Poison poison = new Poison(reader);

                    if (Envir.LoadVersion == 51)
                    {
                        poison.Owner = SMain.Envir.GetObject(reader.ReadUInt32());
                    }

                    Poisons.Add(poison);
                }
            }

            if (Envir.LoadVersion > 56)
            {
                if (reader.ReadBoolean()) CurrentRefine = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                  if (CurrentRefine != null)
                    SMain.Envir.BindItem(CurrentRefine);

                CollectTime = reader.ReadInt64();
                CollectTime += SMain.Envir.Time;
            }

            if (Envir.LoadVersion > 58)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                    Friends.Add(new FriendInfo(reader));
            }

            if (Envir.LoadVersion > 59)
            {
                Married = reader.ReadInt32();
                MarriedDate = DateTime.FromBinary(reader.ReadInt64());
                Mentor = reader.ReadInt32();
                MentorDate = DateTime.FromBinary(reader.ReadInt64());
                isMentor = reader.ReadBoolean();
                MentorExp = reader.ReadInt64();
            }
        }
Exemple #10
0
 protected override void ReadPacket(BinaryReader reader)
 {
     Mode = (PetMode)reader.ReadByte();
 }
Exemple #11
0
        public CharacterInfo(BinaryReader reader)
        {
            Index = reader.ReadInt32();
            Name  = reader.ReadString();

            Level  = reader.ReadByte();
            Class  = (MirClass)reader.ReadByte();
            Gender = (MirGender)reader.ReadByte();
            Hair   = reader.ReadByte();

            CreationIP   = reader.ReadString();
            CreationDate = DateTime.FromBinary(reader.ReadInt64());

            Banned     = reader.ReadBoolean();
            BanReason  = reader.ReadString();
            ExpiryDate = DateTime.FromBinary(reader.ReadInt64());

            LastIP   = reader.ReadString();
            LastDate = DateTime.FromBinary(reader.ReadInt64());

            Deleted    = reader.ReadBoolean();
            DeleteDate = DateTime.FromBinary(reader.ReadInt64());

            CurrentMapIndex = reader.ReadInt32();
            CurrentLocation = new Point(reader.ReadInt32(), reader.ReadInt32());
            Direction       = (MirDirection)reader.ReadByte();
            BindMapIndex    = reader.ReadInt32();
            BindLocation    = new Point(reader.ReadInt32(), reader.ReadInt32());

            HP         = reader.ReadUInt16();
            MP         = reader.ReadUInt16();
            Experience = reader.ReadInt64();

            AMode = (AttackMode)reader.ReadByte();
            PMode = (PetMode)reader.ReadByte();

            if (Envir.LoadVersion > 34)
            {
                PKPoints = reader.ReadInt32();
            }

            int count = reader.ReadInt32();

            Array.Resize(ref Inventory, count);

            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, Envir.LoadVersion);
                if (SMain.Envir.BindItem(item) && i < Inventory.Length)
                {
                    Inventory[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, Envir.LoadVersion);
                if (SMain.Envir.BindItem(item) && i < Equipment.Length)
                {
                    Equipment[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, Envir.LoadVersion);
                if (SMain.Envir.BindItem(item) && i < QuestInventory.Length)
                {
                    QuestInventory[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                UserMagic magic = new UserMagic(reader);
                if (magic.Info == null)
                {
                    continue;
                }
                Magics.Add(magic);
            }


            if (Envir.LoadVersion < 2)
            {
                return;
            }

            Thrusting     = reader.ReadBoolean();
            HalfMoon      = reader.ReadBoolean();
            CrossHalfMoon = reader.ReadBoolean();
            DoubleSlash   = reader.ReadBoolean();

            if (Envir.LoadVersion > 46)
            {
                MentalState = reader.ReadByte();
            }

            if (Envir.LoadVersion < 4)
            {
                return;
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                Pets.Add(new PetInfo(reader));
            }


            if (Envir.LoadVersion < 5)
            {
                return;
            }

            AllowGroup = reader.ReadBoolean();

            if (Envir.LoadVersion < 12)
            {
                return;
            }

            if (Envir.LoadVersion == 12)
            {
                count = reader.ReadInt32();
            }

            for (int i = 0; i < Globals.FlagIndexCount; i++)
            {
                Flags[i] = reader.ReadBoolean();
            }

            if (Envir.LoadVersion > 27)
            {
                GuildIndex = reader.ReadInt32();
            }

            if (Envir.LoadVersion > 30)
            {
                AllowTrade = reader.ReadBoolean();
            }

            if (Envir.LoadVersion > 33)
            {
                count = reader.ReadInt32();

                for (int i = 0; i < count; i++)
                {
                    QuestProgressInfo quest = new QuestProgressInfo(reader);
                    if (SMain.Envir.BindQuest(quest))
                    {
                        CurrentQuests.Add(quest);
                    }
                }
            }

            if (Envir.LoadVersion > 42)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Buff buff = new Buff(reader);

                    if (Envir.LoadVersion == 51)
                    {
                        buff.Caster = SMain.Envir.GetObject(reader.ReadUInt32());
                    }

                    Buffs.Add(buff);
                }
            }

            if (Envir.LoadVersion > 43)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Mail.Add(new MailInfo(reader));
                }
            }

            //IntelligentCreature
            if (Envir.LoadVersion > 44)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    UserIntelligentCreature creature = new UserIntelligentCreature(reader);
                    if (creature.Info == null)
                    {
                        continue;
                    }
                    IntelligentCreatures.Add(creature);
                }

                if (Envir.LoadVersion == 45)
                {
                    var old1 = (IntelligentCreatureType)reader.ReadByte();
                    var old2 = reader.ReadBoolean();
                }

                PearlCount = reader.ReadInt32();
            }

            if (Envir.LoadVersion > 49)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    CompletedQuests.Add(reader.ReadInt32());
                }
            }

            if (Envir.LoadVersion > 50 && Envir.LoadVersion < 54)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Poison poison = new Poison(reader);

                    if (Envir.LoadVersion == 51)
                    {
                        poison.Owner = SMain.Envir.GetObject(reader.ReadUInt32());
                    }

                    Poisons.Add(poison);
                }
            }
        }
Exemple #12
0
 public bool method_20(PetMode petMode_0, int int_0)
 {
     HeroPet.PetModeData petModeData;
     return(this.Modes.TryGetValue(petMode_0, out petModeData) && petModeData.Extra.Contains(int_0));
 }
Exemple #13
0
 public bool method_14(PetMode petMode_0)
 {
     HeroPet.PetModeData petModeData;
     return(this.Modes.TryGetValue(petMode_0, out petModeData) && petModeData.Data.Enabled);
 }
Exemple #14
0
        public CharacterInfo(BinaryReader reader)
        {
            Index = reader.ReadInt32();
            Name  = reader.ReadString();

            Level  = reader.ReadByte();
            Class  = (MirClass)reader.ReadByte();
            Gender = (MirGender)reader.ReadByte();
            Hair   = reader.ReadByte();

            CreationIP   = reader.ReadString();
            CreationDate = DateTime.FromBinary(reader.ReadInt64());

            Banned     = reader.ReadBoolean();
            BanReason  = reader.ReadString();
            ExpiryDate = DateTime.FromBinary(reader.ReadInt64());

            LastIP   = reader.ReadString();
            LastDate = DateTime.FromBinary(reader.ReadInt64());

            Deleted    = reader.ReadBoolean();
            DeleteDate = DateTime.FromBinary(reader.ReadInt64());

            CurrentMapIndex = reader.ReadInt32();
            CurrentLocation = new Point(reader.ReadInt32(), reader.ReadInt32());
            Direction       = (MirDirection)reader.ReadByte();
            BindMapIndex    = reader.ReadInt32();
            BindLocation    = new Point(reader.ReadInt32(), reader.ReadInt32());

            HP         = reader.ReadUInt16();
            MP         = reader.ReadUInt16();
            Experience = reader.ReadInt64();

            AMode = (AttackMode)reader.ReadByte();
            PMode = (PetMode)reader.ReadByte();

            if (Envir.LoadVersion > 34)
            {
                PKPoints = reader.ReadInt32();
            }

            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, Envir.LoadVersion);
                if (SMain.Envir.BindItem(item) && i < Inventory.Length)
                {
                    Inventory[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, Envir.LoadVersion);
                if (SMain.Envir.BindItem(item) && i < Equipment.Length)
                {
                    Equipment[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, Envir.LoadVersion);
                if (SMain.Envir.BindItem(item) && i < QuestInventory.Length)
                {
                    QuestInventory[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                UserMagic magic = new UserMagic(reader);
                if (magic.Info == null)
                {
                    continue;
                }
                Magics.Add(magic);
            }


            if (Envir.LoadVersion < 2)
            {
                return;
            }

            Thrusting     = reader.ReadBoolean();
            HalfMoon      = reader.ReadBoolean();
            CrossHalfMoon = reader.ReadBoolean();
            DoubleSlash   = reader.ReadBoolean();

            if (Envir.LoadVersion < 4)
            {
                return;
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                Pets.Add(new PetInfo(reader));
            }


            if (Envir.LoadVersion < 5)
            {
                return;
            }

            AllowGroup = reader.ReadBoolean();

            if (Envir.LoadVersion < 12)
            {
                return;
            }

            if (Envir.LoadVersion == 12)
            {
                count = reader.ReadInt32();
            }

            for (int i = 0; i < Globals.FlagIndexCount; i++)
            {
                Flags[i] = reader.ReadBoolean();
            }

            if (Envir.LoadVersion > 27)
            {
                GuildIndex = reader.ReadInt32();
            }

            if (Envir.LoadVersion > 30)
            {
                AllowTrade = reader.ReadBoolean();
            }

            if (Envir.LoadVersion > 33)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    CurrentQuests.Add(new QuestProgressInfo(reader));
                }
            }

            if (Envir.LoadVersion > 42)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Buffs.Add(new Buff(reader));
                }
            }

            if (Envir.LoadVersion > 43)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Mail.Add(new MailInfo(reader));
                }
            }
        }
Exemple #15
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                Scene = null;
                User = null;

                MoveTime = 0;
                AttackTime = 0;
                NextRunTime = 0;
                CanMove = false;
                CanRun = false;

                MapControl = null;
                MainDialog = null;
                ChatDialog = null;
                ChatControl = null;
                InventoryDialog = null;
                CharacterDialog = null;
                StorageDialog = null;
                BeltDialog = null;
                MiniMapDialog = null;
                InspectDialog = null;
                OptionDialog = null;
                MenuDialog = null;
                NPCDialog = null;
                QuestDetailDialog = null;
                QuestListDialog = null;
                QuestLogDialog = null;
                QuestTrackingDialog = null;
                GameShopDialog = null;
                MentorDialog = null;

                RelationshipDialog = null;
                CharacterDuraPanel = null;
                DuraStatusPanel = null;

                HoverItem = null;
                SelectedCell = null;
                PickedUpGold = false;

                UseItemTime = 0;
                PickUpTime = 0;
                InspectTime = 0;

                DisposeItemLabel();

                AMode = 0;
                PMode = 0;
                Lights = 0;

                NPCTime = 0;
                NPCID = 0;
                DefaultNPCID = 0;

                for (int i = 0; i < OutputLines.Length; i++)
                    if (OutputLines[i] != null && OutputLines[i].IsDisposed)
                        OutputLines[i].Dispose();

                OutputMessages.Clear();
                OutputMessages = null;
            }

            base.Dispose(disposing);
        }
        public CharacterInfo(BinaryReader reader)
        {
            Index = reader.ReadInt32();
            Name = reader.ReadString();

            Level = reader.ReadByte();
            Class = (MirClass) reader.ReadByte();
            Gender = (MirGender) reader.ReadByte();
            Hair = reader.ReadByte();

            CreationIP = reader.ReadString();
            CreationDate = DateTime.FromBinary(reader.ReadInt64());

            Banned = reader.ReadBoolean();
            BanReason = reader.ReadString();
            ExpiryDate = DateTime.FromBinary(reader.ReadInt64());

            LastIP = reader.ReadString();
            LastDate = DateTime.FromBinary(reader.ReadInt64());

            Deleted = reader.ReadBoolean();
            DeleteDate = DateTime.FromBinary(reader.ReadInt64());

            CurrentMapIndex = reader.ReadInt32();
            CurrentLocation = new Point(reader.ReadInt32(), reader.ReadInt32());
            Direction = (MirDirection)reader.ReadByte();
            BindMapIndex = reader.ReadInt32();
            BindLocation = new Point(reader.ReadInt32(), reader.ReadInt32());

            HP = reader.ReadUInt16();
            MP = reader.ReadUInt16();
            Experience = reader.ReadInt64();

            AMode = (AttackMode) reader.ReadByte();
            PMode = (PetMode) reader.ReadByte();

            int count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean()) continue;
                UserItem item = new UserItem(reader, Envir.LoadVersion);
                if (SMain.Envir.BindItem(item) && i < Inventory.Length)
                    Inventory[i] = item;
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean()) continue;
                UserItem item = new UserItem(reader);
                if (SMain.Envir.BindItem(item) && i < Equipment.Length)
                    Equipment[i] = item;
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                UserMagic magic = new UserMagic(reader);
                if (magic.Info == null) continue;
                Magics.Add(magic);
            }

            if (Envir.LoadVersion < 2) return;

            Thrusting = reader.ReadBoolean();
            HalfMoon = reader.ReadBoolean();
            CrossHalfMoon = reader.ReadBoolean();
            DoubleSlash = reader.ReadBoolean();

            if (Envir.LoadVersion < 4) return;

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
                Pets.Add(new PetInfo(reader));

            if (Envir.LoadVersion < 5) return;

            AllowGroup = reader.ReadBoolean();
        }
Exemple #17
0
 protected override void ReadPacket(BinaryReader reader)
 {
     Mode = (PetMode)reader.ReadByte();
 }
Exemple #18
0
        public CharacterInfo(BinaryReader reader, int version, int customVersion)
        {
            Index = reader.ReadInt32();
            Name  = reader.ReadString();

            if (version < 62)
            {
                Level = (ushort)reader.ReadByte();
            }
            else
            {
                Level = reader.ReadUInt16();
            }

            Class  = (MirClass)reader.ReadByte();
            Gender = (MirGender)reader.ReadByte();
            Hair   = reader.ReadByte();

            CreationIP   = reader.ReadString();
            CreationDate = DateTime.FromBinary(reader.ReadInt64());

            Banned     = reader.ReadBoolean();
            BanReason  = reader.ReadString();
            ExpiryDate = DateTime.FromBinary(reader.ReadInt64());

            LastIP         = reader.ReadString();
            LastLogoutDate = DateTime.FromBinary(reader.ReadInt64());

            if (version > 81)
            {
                LastLoginDate = DateTime.FromBinary(reader.ReadInt64());
            }

            Deleted    = reader.ReadBoolean();
            DeleteDate = DateTime.FromBinary(reader.ReadInt64());

            CurrentMapIndex = reader.ReadInt32();
            CurrentLocation = new Point(reader.ReadInt32(), reader.ReadInt32());
            Direction       = (MirDirection)reader.ReadByte();
            BindMapIndex    = reader.ReadInt32();
            BindLocation    = new Point(reader.ReadInt32(), reader.ReadInt32());

            if (version <= 84)
            {
                HP = reader.ReadUInt16();
                MP = reader.ReadUInt16();
            }
            else
            {
                HP = reader.ReadInt32();
                MP = reader.ReadInt32();
            }

            Experience = reader.ReadInt64();

            AMode = (AttackMode)reader.ReadByte();
            PMode = (PetMode)reader.ReadByte();

            if (version > 34)
            {
                PKPoints = reader.ReadInt32();
            }

            int count = reader.ReadInt32();

            Array.Resize(ref Inventory, count);

            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, version, customVersion);
                if (Envir.BindItem(item) && i < Inventory.Length)
                {
                    Inventory[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, version, customVersion);
                if (Envir.BindItem(item) && i < Equipment.Length)
                {
                    Equipment[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, version, customVersion);
                if (Envir.BindItem(item) && i < QuestInventory.Length)
                {
                    QuestInventory[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                UserMagic magic = new UserMagic(reader, version, customVersion);
                if (magic.Info == null)
                {
                    continue;
                }

                magic.CastTime = int.MinValue;
                Magics.Add(magic);
            }

            Thrusting     = reader.ReadBoolean();
            HalfMoon      = reader.ReadBoolean();
            CrossHalfMoon = reader.ReadBoolean();
            DoubleSlash   = reader.ReadBoolean();

            MentalState = reader.ReadByte();

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                Pets.Add(new PetInfo(reader, version, customVersion));
            }

            AllowGroup = reader.ReadBoolean();

            for (int i = 0; i < Globals.FlagIndexCount; i++)
            {
                Flags[i] = reader.ReadBoolean();
            }

            GuildIndex = reader.ReadInt32();

            AllowTrade = reader.ReadBoolean();

            count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                QuestProgressInfo quest = new QuestProgressInfo(reader, version, customVersion);
                if (Envir.BindQuest(quest))
                {
                    CurrentQuests.Add(quest);
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                Buff buff = new Buff(reader, version, customVersion);

                Buffs.Add(buff);
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                Mail.Add(new MailInfo(reader, version, customVersion));
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                UserIntelligentCreature creature = new UserIntelligentCreature(reader, version, customVersion);
                if (creature.Info == null)
                {
                    continue;
                }
                IntelligentCreatures.Add(creature);
            }

            if (version == 45)
            {
                var old1 = (IntelligentCreatureType)reader.ReadByte();
                var old2 = reader.ReadBoolean();
            }

            PearlCount = reader.ReadInt32();

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                CompletedQuests.Add(reader.ReadInt32());
            }

            if (reader.ReadBoolean())
            {
                CurrentRefine = new UserItem(reader, version, customVersion);
            }

            if (CurrentRefine != null)
            {
                Envir.BindItem(CurrentRefine);
            }

            CollectTime  = reader.ReadInt64();
            CollectTime += Envir.Time;

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                Friends.Add(new FriendInfo(reader, version, customVersion));
            }

            if (version > 75)
            {
                count = reader.ReadInt32();
                for (var i = 0; i < count; i++)
                {
                    RentedItems.Add(new ItemRentalInformation(reader, version, customVersion));
                }

                HasRentedItem = reader.ReadBoolean();
            }

            Married     = reader.ReadInt32();
            MarriedDate = DateTime.FromBinary(reader.ReadInt64());
            Mentor      = reader.ReadInt32();
            MentorDate  = DateTime.FromBinary(reader.ReadInt64());
            IsMentor    = reader.ReadBoolean();
            MentorExp   = reader.ReadInt64();

            if (version >= 63)
            {
                int logCount = reader.ReadInt32();

                for (int i = 0; i < logCount; i++)
                {
                    GSpurchases.Add(reader.ReadInt32(), reader.ReadInt32());
                }
            }
        }
Exemple #19
0
        public CharacterInfo(BinaryReader reader)
        {
            Index = reader.ReadInt32();
            Name  = reader.ReadString();

            if (Envir.LoadVersion < 62)
            {
                Level = (ushort)reader.ReadByte();
            }
            else
            {
                Level = reader.ReadUInt16();
            }

            Class  = (MirClass)reader.ReadByte();
            Gender = (MirGender)reader.ReadByte();
            Hair   = reader.ReadByte();

            CreationIP   = reader.ReadString();
            CreationDate = DateTime.FromBinary(reader.ReadInt64());

            Banned     = reader.ReadBoolean();
            BanReason  = reader.ReadString();
            ExpiryDate = DateTime.FromBinary(reader.ReadInt64());

            LastIP   = reader.ReadString();
            LastDate = DateTime.FromBinary(reader.ReadInt64());

            Deleted    = reader.ReadBoolean();
            DeleteDate = DateTime.FromBinary(reader.ReadInt64());

            CurrentMapIndex = reader.ReadInt32();
            CurrentLocation = new Point(reader.ReadInt32(), reader.ReadInt32());
            Direction       = (MirDirection)reader.ReadByte();
            BindMapIndex    = reader.ReadInt32();
            BindLocation    = new Point(reader.ReadInt32(), reader.ReadInt32());

            HP         = reader.ReadUInt16();
            MP         = reader.ReadUInt16();
            Experience = reader.ReadInt64();

            AMode = (AttackMode)reader.ReadByte();
            PMode = (PetMode)reader.ReadByte();

            if (Envir.LoadVersion > 34)
            {
                PKPoints = reader.ReadInt32();
            }

            int count = reader.ReadInt32();

            Array.Resize(ref Inventory, count);

            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                if (SMain.Envir.BindItem(item) && i < Inventory.Length)
                {
                    Inventory[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                if (SMain.Envir.BindItem(item) && i < Equipment.Length)
                {
                    Equipment[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                if (SMain.Envir.BindItem(item) && i < QuestInventory.Length)
                {
                    QuestInventory[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                UserMagic magic = new UserMagic(reader);
                if (magic.Info == null)
                {
                    continue;
                }
                Magics.Add(magic);
            }
            //reset all magic cooldowns on char loading < stops ppl from having none working skills after a server crash
            for (int i = 0; i < Magics.Count; i++)
            {
                Magics[i].CastTime = 0;
            }

            if (Envir.LoadVersion < 2)
            {
                return;
            }

            Thrusting     = reader.ReadBoolean();
            HalfMoon      = reader.ReadBoolean();
            CrossHalfMoon = reader.ReadBoolean();
            DoubleSlash   = reader.ReadBoolean();

            if (Envir.LoadVersion > 46)
            {
                MentalState = reader.ReadByte();
            }

            if (Envir.LoadVersion < 4)
            {
                return;
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                Pets.Add(new PetInfo(reader));
            }


            if (Envir.LoadVersion < 5)
            {
                return;
            }

            AllowGroup = reader.ReadBoolean();

            if (Envir.LoadVersion < 12)
            {
                return;
            }

            if (Envir.LoadVersion == 12)
            {
                count = reader.ReadInt32();
            }

            for (int i = 0; i < Globals.FlagIndexCount; i++)
            {
                Flags[i] = reader.ReadBoolean();
            }

            if (Envir.LoadVersion > 27)
            {
                GuildIndex = reader.ReadInt32();
            }

            if (Envir.LoadVersion > 30)
            {
                AllowTrade = reader.ReadBoolean();
            }

            if (Envir.LoadVersion > 77)
            {
                AllowObserve = reader.ReadBoolean();
            }

            if (Envir.LoadVersion > 33)
            {
                count = reader.ReadInt32();

                for (int i = 0; i < count; i++)
                {
                    QuestProgressInfo quest = new QuestProgressInfo(reader);
                    if (SMain.Envir.BindQuest(quest))
                    {
                        CurrentQuests.Add(quest);
                    }
                }
            }

            if (Envir.LoadVersion > 42)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Buff buff = new Buff(reader);

                    if (Envir.LoadVersion == 51)
                    {
                        buff.Caster = SMain.Envir.GetObject(reader.ReadUInt32());
                    }

                    Buffs.Add(buff);
                }
            }

            if (Envir.LoadVersion > 43)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Mail.Add(new MailInfo(reader, Envir.LoadVersion, Envir.LoadCustomVersion));
                }
            }

            //IntelligentCreature
            if (Envir.LoadVersion > 44)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    UserIntelligentCreature creature = new UserIntelligentCreature(reader);
                    if (creature.Info == null)
                    {
                        continue;
                    }
                    IntelligentCreatures.Add(creature);
                }

                if (Envir.LoadVersion == 45)
                {
                    var old1 = (IntelligentCreatureType)reader.ReadByte();
                    var old2 = reader.ReadBoolean();
                }

                PearlCount = reader.ReadInt32();
            }

            if (Envir.LoadVersion > 49)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    CompletedQuests.Add(reader.ReadInt32());
                }
            }

            if (Envir.LoadVersion > 50 && Envir.LoadVersion < 54)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Poison poison = new Poison(reader);

                    if (Envir.LoadVersion == 51)
                    {
                        poison.Owner = SMain.Envir.GetObject(reader.ReadUInt32());
                    }

                    Poisons.Add(poison);
                }
            }

            if (Envir.LoadVersion > 56)
            {
                if (reader.ReadBoolean())
                {
                    CurrentRefine = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                }
                if (CurrentRefine != null)
                {
                    SMain.Envir.BindItem(CurrentRefine);
                }

                CollectTime  = reader.ReadInt64();
                CollectTime += SMain.Envir.Time;
            }

            if (Envir.LoadVersion > 58)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Friends.Add(new FriendInfo(reader));
                }
            }

            if (Envir.LoadVersion > 75)
            {
                count = reader.ReadInt32();
                for (var i = 0; i < count; i++)
                {
                    RentedItems.Add(new ItemRentalInformation(reader));
                }

                HasRentedItem = reader.ReadBoolean();
            }

            if (Envir.LoadVersion > 59)
            {
                Married     = reader.ReadInt32();
                MarriedDate = DateTime.FromBinary(reader.ReadInt64());
                Mentor      = reader.ReadInt32();
                MentorDate  = DateTime.FromBinary(reader.ReadInt64());
                isMentor    = reader.ReadBoolean();
                MentorExp   = reader.ReadInt64();
            }

            if (Envir.LoadVersion >= 63)
            {
                int logCount = reader.ReadInt32();

                for (int i = 0; i < logCount; i++)
                {
                    GSpurchases.Add(reader.ReadInt32(), reader.ReadInt32());
                }
            }

            if (Envir.LoadCustomVersion >= 1)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    int dailyEvent = reader.ReadInt32();
                    DailyEventsCompleted.Add(dailyEvent);
                }

                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    int weeklyEvent = reader.ReadInt32();
                    WeeklyEventsCompleted.Add(weeklyEvent);
                }
            }
        }
Exemple #20
0
        private void ChangePMode(S.ChangePMode p)
        {
            PMode = p.Mode;
            switch (p.Mode)
            {
                case PetMode.Both:
                    ChatDialog.ReceiveChat("[宠物模式: 辅助]", ChatType.Hint);
                    break;
                case PetMode.MoveOnly:
                    ChatDialog.ReceiveChat("[宠物模式: 跟随]", ChatType.Hint);
                    break;
                case PetMode.AttackOnly:
                    ChatDialog.ReceiveChat("[宠物模式: 站立]", ChatType.Hint);
                    break;
                case PetMode.None:
                    ChatDialog.ReceiveChat("[宠物模式: 静止]", ChatType.Hint);
                    break;
            }

            MainDialog.PModeLabel.Visible = true;
        }