Exemplo n.º 1
0
 protected internal IntelligentCreatureObject(MonsterInfo info)
     : base(info)
 {
     ActionTime = Envir.Time + 1000;
     petType = (IntelligentCreatureType)info.Effect;
     CustomName = info.Name;
 }
Exemplo n.º 2
0
        public void Load(S.UserInformation info)
        {
            Id            = info.RealId;
            Name          = info.Name;
            NameColour    = info.NameColour;
            GuildName     = info.GuildName;
            GuildRankName = info.GuildRank;
            Class         = info.Class;
            Gender        = info.Gender;
            Level         = info.Level;

            CurrentLocation = info.Location;
            MapLocation     = info.Location;
            GameScene.Scene.MapControl.AddObject(this);

            Direction = info.Direction;
            Hair      = info.Hair;

            HP = info.HP;
            MP = info.MP;

            Experience    = info.Experience;
            MaxExperience = info.MaxExperience;

            LevelEffects = info.LevelEffects;

            Inventory      = info.Inventory;
            Equipment      = info.Equipment;
            QuestInventory = info.QuestInventory;

            Magics = info.Magics;

            IntelligentCreatures = info.IntelligentCreatures; //IntelligentCreature
            SummonedCreatureType = info.SummonedCreatureType; //IntelligentCreature
            CreatureSummoned     = info.CreatureSummoned;     //IntelligentCreature

            BindAllItems();

            RefreshStats();

            SetAction();
        }
Exemplo n.º 3
0
        public UserIntelligentCreature(IntelligentCreatureType creatureType, int slot, byte effect = 0)
        {
            PetType    = creatureType;
            Info       = IntelligentCreatureInfo.GetCreatureInfo(PetType);
            CustomName = Settings.IntelligentCreatureNameList[(byte)PetType];
            Fullness   = 7500;//starts at 75% food
            SlotIndex  = slot;

            if (effect > 0)
            {
                ExpireTime = effect * 86400;            //effect holds the amount in days
            }
            else
            {
                ExpireTime = -9999; //permanent
            }
            BlackstoneTime = 0;

            Filter = new IntelligentCreatureItemFilter();
        }
Exemplo n.º 4
0
    public ClientIntelligentCreature(BinaryReader reader)
    {
        PetType = (IntelligentCreatureType)reader.ReadByte();
        Icon    = reader.ReadInt32();

        CustomName     = reader.ReadString();
        Fullness       = reader.ReadInt32();
        SlotIndex      = reader.ReadInt32();
        ExpireTime     = reader.ReadInt64();
        BlackstoneTime = reader.ReadInt64();

        petMode = (IntelligentCreaturePickupMode)reader.ReadByte();

        CreatureRules = new IntelligentCreatureRules(reader);
        Filter        = new IntelligentCreatureItemFilter(reader)
        {
            PickupGrade = (ItemGrade)reader.ReadByte()
        };
        MaintainFoodTime = reader.ReadInt64();
    }
Exemplo n.º 5
0
        public UserIntelligentCreature(IntelligentCreatureType creatureType, int slot, byte effect = 0)
        {
            PetType    = creatureType;
            Info       = IntelligentCreatureInfo.GetCreatureInfo(PetType);
            CustomName = Envir.Main.GetMonsterInfo(64, (byte)PetType)?.Name ?? PetType.ToString();
            Fullness   = 7500;//starts at 75% food
            SlotIndex  = slot;

            if (effect > 0)
            {
                Expire = DateTime.Now.AddDays(effect);            //effect holds the amount in days
            }
            else
            {
                Expire = DateTime.MinValue; //permanent
            }
            BlackstoneTime   = 0;
            MaintainFoodTime = 0;

            Filter = new IntelligentCreatureItemFilter();
        }
Exemplo n.º 6
0
        public UserIntelligentCreature(BinaryReader reader)
        {
            PetType = (IntelligentCreatureType)reader.ReadByte();
            Info    = IntelligentCreatureInfo.GetCreatureInfo(PetType);

            CustomName     = reader.ReadString();
            Fullness       = reader.ReadInt32();
            SlotIndex      = reader.ReadInt32();
            ExpireTime     = reader.ReadInt64();
            BlackstoneTime = reader.ReadInt64();

            petMode = (IntelligentCreaturePickupMode)reader.ReadByte();

            Filter = new IntelligentCreatureItemFilter(reader);
            if (Envir.LoadVersion > 48)
            {
                Filter.PickupGrade = (ItemGrade)reader.ReadByte();

                MaintainFoodTime = reader.ReadInt64();//maintain food buff
            }
        }
Exemplo n.º 7
0
        public UserIntelligentCreature(IntelligentCreatureType creatureType, int slot, byte effect = 0)
        {
            PetType = creatureType;
            Info = IntelligentCreatureInfo.GetCreatureInfo(PetType);
            CustomName = Settings.IntelligentCreatureNameList[(byte)PetType];
            Fullness = 7500;//starts at 75% food
            SlotIndex = slot;

            if (effect > 0) ExpireTime = effect * 86400;//effect holds the amount in days
            else ExpireTime = -9999;//permanent

            BlackstoneTime = 0;
            MaintainFoodTime = 0;

            Filter = new IntelligentCreatureItemFilter();
        }
Exemplo n.º 8
0
 public static IntelligentCreatureInfo GetCreatureInfo(IntelligentCreatureType petType)
 {
     for (int i = 0; i < Creatures.Count; i++)
     {
         IntelligentCreatureInfo info = Creatures[i];
         if (info.PetType != petType) continue;
         return info;
     }
     return null;
 }
Exemplo n.º 9
0
 public bool CheckHasIntelligentCreature(IntelligentCreatureType petType)
 {
     for (int i = 0; i < IntelligentCreatures.Count; i++)
         if (IntelligentCreatures[i].PetType == petType) return true;
     return false;
 }
Exemplo n.º 10
0
 protected override void ReadPacket(BinaryReader reader)
 {
     int count = reader.ReadInt32();
     for (int i = 0; i < count; i++)
         CreatureList.Add(new ClientIntelligentCreature(reader));
     CreatureSummoned = reader.ReadBoolean();
     SummonedCreatureType = (IntelligentCreatureType)reader.ReadByte();
     PearlCount = reader.ReadInt32();
 }
Exemplo n.º 11
0
        public bool CreatureSummoned;//IntelligentCreature

        protected override void ReadPacket(BinaryReader reader)
        {
            ObjectID = reader.ReadUInt32();
            RealId = reader.ReadUInt32();
            Name = reader.ReadString();
            GuildName = reader.ReadString();
            GuildRank = reader.ReadString();
            NameColour = Color.FromArgb(reader.ReadInt32());
            Class = (MirClass)reader.ReadByte();
            Gender = (MirGender)reader.ReadByte();
            Level = reader.ReadByte();
            Location = new Point(reader.ReadInt32(), reader.ReadInt32());
            Direction = (MirDirection)reader.ReadByte();
            Hair = reader.ReadByte();
            HP = reader.ReadUInt16();
            MP = reader.ReadUInt16();

            Experience = reader.ReadInt64();
            MaxExperience = reader.ReadInt64();

            LevelEffects = (LevelEffects)reader.ReadByte();

            if (reader.ReadBoolean())
            {
                Inventory = new UserItem[reader.ReadInt32()];
                for (int i = 0; i < Inventory.Length; i++)
                {
                    if (!reader.ReadBoolean()) continue;
                    Inventory[i] = new UserItem(reader);
                }
            }

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

            if (reader.ReadBoolean())
            {
                QuestInventory = new UserItem[reader.ReadInt32()];
                for (int i = 0; i < QuestInventory.Length; i++)
                {
                    if (!reader.ReadBoolean()) continue;
                    QuestInventory[i] = new UserItem(reader);
                }
            }

            Gold = reader.ReadUInt32();

            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
                Magics.Add(new ClientMagic(reader));

            //IntelligentCreature
            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
                IntelligentCreatures.Add(new ClientIntelligentCreature(reader));
            SummonedCreatureType = (IntelligentCreatureType)reader.ReadByte();
            CreatureSummoned = reader.ReadBoolean();
        }
Exemplo n.º 12
0
        public void SummonIntelligentCreature(IntelligentCreatureType pType)
        {
            if (pType == IntelligentCreatureType.None) return;

            if (CreatureSummoned == true || SummonedCreatureType != IntelligentCreatureType.None) return;

            for (int i = 0; i < Info.IntelligentCreatures.Count; i++)
            {
                if (Info.IntelligentCreatures[i].PetType != pType) continue;

                MonsterInfo mInfo = Envir.GetMonsterInfo(Settings.IntelligentCreatureNameList[(byte)pType]);
                if (mInfo == null) return;

                byte petlevel = 0;//for future use

                MonsterObject monster = MonsterObject.GetMonster(mInfo);
                if (monster == null) return;
                monster.PetLevel = petlevel;
                monster.Master = this;
                monster.MaxPetLevel = 7;
                monster.Direction = Direction;
                monster.ActionTime = Envir.Time + 1000;
                ((IntelligentCreatureObject)monster).CustomName = Info.IntelligentCreatures[i].CustomName;
                ((IntelligentCreatureObject)monster).CreatureRules = new IntelligentCreatureRules
                {
                    MinimalFullness = Info.IntelligentCreatures[i].Info.MinimalFullness,
                    MousePickupEnabled = Info.IntelligentCreatures[i].Info.MousePickupEnabled,
                    MousePickupRange = Info.IntelligentCreatures[i].Info.MousePickupRange,
                    AutoPickupEnabled = Info.IntelligentCreatures[i].Info.AutoPickupEnabled,
                    AutoPickupRange = Info.IntelligentCreatures[i].Info.AutoPickupRange,
                    SemiAutoPickupEnabled = Info.IntelligentCreatures[i].Info.SemiAutoPickupEnabled,
                    SemiAutoPickupRange = Info.IntelligentCreatures[i].Info.SemiAutoPickupRange,
                    CanProduceBlackStone = Info.IntelligentCreatures[i].Info.CanProduceBlackStone
                };
                ((IntelligentCreatureObject)monster).ItemFilter = Info.IntelligentCreatures[i].Filter;
                ((IntelligentCreatureObject)monster).CurrentPickupMode = Info.IntelligentCreatures[i].petMode;
                ((IntelligentCreatureObject)monster).Fullness = Info.IntelligentCreatures[i].Fullness;
                ((IntelligentCreatureObject)monster).blackstoneTime = Info.IntelligentCreatures[i].BlackstoneTime;
                ((IntelligentCreatureObject)monster).maintainfoodTime = Info.IntelligentCreatures[i].MaintainFoodTime;

                if (!CurrentMap.ValidPoint(Front)) return;
                monster.Spawn(CurrentMap, Front);
                Pets.Add(monster);//make a new creaturelist ? 

                CreatureSummoned = true;
                SummonedCreatureType = pType;

                ReceiveChat((string.Format("Creature {0} has been summoned.", Info.IntelligentCreatures[i].CustomName)), ChatType.System);
                break;
            }
            //update client
            GetCreaturesInfo();
        }
Exemplo n.º 13
0
 public void Clear()
 {
     PetType = IntelligentCreatureType.None;
     Visible = false;
     SelectButton(false);
 }
Exemplo n.º 14
0
        public void UpdateCreatureMaintainFoodTime(IntelligentCreatureType pType, long maintainfoodtime)
        {
            if (pType == IntelligentCreatureType.None) return;

            for (int i = 0; i < Info.IntelligentCreatures.Count; i++)
            {
                if (Info.IntelligentCreatures[i].PetType != pType) continue;
                Info.IntelligentCreatures[i].MaintainFoodTime = maintainfoodtime;
                break;
            }

            //update client
            //GetCreaturesInfo();
        }
Exemplo n.º 15
0
        public void UpdateCreatureBlackstoneTime(IntelligentCreatureType pType, long blackstonetime)
        {
            if (pType == IntelligentCreatureType.None) return;

            for (int i = 0; i < Info.IntelligentCreatures.Count; i++)
            {
                if (Info.IntelligentCreatures[i].PetType != pType) continue;
                Info.IntelligentCreatures[i].BlackstoneTime = blackstonetime;
                break;
            }

            //update client
            //GetCreaturesInfo();
        }
Exemplo n.º 16
0
        public void UpdateCreatureFullness(IntelligentCreatureType pType, int fullness)
        {
            if (pType == IntelligentCreatureType.None) return;

            for (int i = 0; i < Info.IntelligentCreatures.Count; i++)
            {
                if (Info.IntelligentCreatures[i].PetType != pType) continue;
                Info.IntelligentCreatures[i].Fullness = fullness;
                break;
            }

            //update client
            //GetCreaturesInfo();
        }
Exemplo n.º 17
0
        public void UpdateSummonedCreature(IntelligentCreatureType pType)
        {
            if (pType == IntelligentCreatureType.None) return;

            UserIntelligentCreature creatureInfo = null;
            for (int i = 0; i < Info.IntelligentCreatures.Count; i++)
            {
                if (Info.IntelligentCreatures[i].PetType != pType) continue;

                creatureInfo = Info.IntelligentCreatures[i];
                break;
            }
            if (creatureInfo == null) return;

            for (int i = 0; i < Pets.Count; i++)
            {
                if (Pets[i].Info.AI != 64) continue;
                if (((IntelligentCreatureObject)Pets[i]).petType != pType) continue;

                ((IntelligentCreatureObject)Pets[i]).CustomName = creatureInfo.CustomName;
                ((IntelligentCreatureObject)Pets[i]).ItemFilter = creatureInfo.Filter;
                ((IntelligentCreatureObject)Pets[i]).CurrentPickupMode = creatureInfo.petMode;
                break;
            }
        }
Exemplo n.º 18
0
        public void ReleaseIntelligentCreature(IntelligentCreatureType pType, bool doUpdate = true)
        {
            if (pType == IntelligentCreatureType.None) return;

            //remove creature
            for (int i = 0; i < Info.IntelligentCreatures.Count; i++)
            {
                if (Info.IntelligentCreatures[i].PetType != pType) continue;

                if (doUpdate) ReceiveChat((string.Format("Creature {0} has been released.", Info.IntelligentCreatures[i].CustomName)), ChatType.System);

                Info.IntelligentCreatures.Remove(Info.IntelligentCreatures[i]);
                break;
            }

            //re-arange slots
            for (int i = 0; i < Info.IntelligentCreatures.Count; i++)
                Info.IntelligentCreatures[i].SlotIndex = i;

            //update client
            if (doUpdate) GetCreaturesInfo();
        }
Exemplo n.º 19
0
        public void UnSummonIntelligentCreature(IntelligentCreatureType pType, bool doUpdate = true)
        {
            if (pType == IntelligentCreatureType.None) return;

            for (int i = 0; i < Pets.Count; i++)
            {
                if (Pets[i].Info.AI != 64) continue;
                if (((IntelligentCreatureObject)Pets[i]).petType != pType) continue;

                if (doUpdate) ReceiveChat((string.Format("Creature {0} has been dismissed.", ((IntelligentCreatureObject)Pets[i]).CustomName)), ChatType.System);

                Pets[i].Die();

                CreatureSummoned = false;
                SummonedCreatureType = IntelligentCreatureType.None;
                break;
            }
            //update client
            if (doUpdate) GetCreaturesInfo();
        }
Exemplo n.º 20
0
        public UserIntelligentCreature(BinaryReader reader)
        {
            PetType = (IntelligentCreatureType)reader.ReadByte();
            Info = IntelligentCreatureInfo.GetCreatureInfo(PetType);

            CustomName = reader.ReadString();
            Fullness = reader.ReadInt32();
            SlotIndex = reader.ReadInt32();
            ExpireTime = reader.ReadInt64();
            BlackstoneTime = reader.ReadInt64();

            petMode = (IntelligentCreaturePickupMode)reader.ReadByte();

            Filter = new IntelligentCreatureItemFilter(reader);
            if (Envir.LoadVersion > 48)
            {
                Filter.PickupGrade = (ItemGrade)reader.ReadByte();

                MaintainFoodTime = reader.ReadInt64();//maintain food buff
            }
        }
Exemplo n.º 21
0
        private void SetButtonInfo(ClientIntelligentCreature pet)
        {
            if (pet == null) return;

            PetType = pet.PetType;

            NameLabel.Text = pet.CustomName.ToString();

            PetButton.Index = pet.Icon;
            PetButton.PressedIndex = pet.Icon;

            SetCreatureFrames();
        }
Exemplo n.º 22
0
 public IntelligentCreatureObject(MonsterInfo info) : base(info)
 {
     ActionTime = Envir.Time + 1000;
     PetType    = (IntelligentCreatureType)info.Effect;
 }
Exemplo n.º 23
0
 public void RefreshCreatureSummoned()
 {
     if (SummonedCreatureType == IntelligentCreatureType.None || !CreatureSummoned)
     {
         //make sure both are in the unsummoned state
         CreatureSummoned = false;
         SummonedCreatureType = IntelligentCreatureType.None;
         return;
     }
     bool petFound = false;
     for (int i = 0; i < Pets.Count; i++)
     {
         if (Pets[i].Info.AI != 64) continue;
         if (((IntelligentCreatureObject)Pets[i]).petType != SummonedCreatureType) continue;
         petFound = true;
         break;
     }
     if (!petFound)
     {
         SMain.EnqueueDebugging(string.Format("{0}: SummonedCreature no longer exists?!?. {1}", Name, SummonedCreatureType.ToString()));
         CreatureSummoned = false;
         SummonedCreatureType = IntelligentCreatureType.None;
     }
 }
Exemplo n.º 24
0
        public void Load(S.UserInformation info)
        {
            Id = info.RealId;
            Name = info.Name;
            NameColour = info.NameColour;
            GuildName = info.GuildName;
            GuildRankName = info.GuildRank;
            Class = info.Class;
            Gender = info.Gender;
            Level = info.Level;

            CurrentLocation = info.Location;
            MapLocation = info.Location;
            GameScene.Scene.MapControl.AddObject(this);

            Direction = info.Direction;
            Hair = info.Hair;

            HP = info.HP;
            MP = info.MP;

            Experience = info.Experience;
            MaxExperience = info.MaxExperience;

            LevelEffects = info.LevelEffects;

            Inventory = info.Inventory;
            Equipment = info.Equipment;
            QuestInventory = info.QuestInventory;

            Magics = info.Magics;

            IntelligentCreatures = info.IntelligentCreatures;//IntelligentCreature
            SummonedCreatureType = info.SummonedCreatureType;//IntelligentCreature
            CreatureSummoned = info.CreatureSummoned;//IntelligentCreature

            BindAllItems();

            RefreshStats();

            SetAction();
        }
Exemplo n.º 25
0
    public ClientIntelligentCreature(BinaryReader reader)
    {
        PetType = (IntelligentCreatureType)reader.ReadByte();
        Icon = reader.ReadInt32();

        CustomName = reader.ReadString();
        Fullness = reader.ReadInt32();
        SlotIndex = reader.ReadInt32();
        ExpireTime = reader.ReadInt64();
        BlackstoneTime = reader.ReadInt64();

        petMode = (IntelligentCreaturePickupMode)reader.ReadByte();

        CreatureRules = new IntelligentCreatureRules(reader);
        Filter = new IntelligentCreatureItemFilter(reader);
        Filter.PickupGrade = (ItemGrade)reader.ReadByte();
        MaintainFoodTime = reader.ReadInt64();
    }
Exemplo n.º 26
0
        public void IntelligentCreatureSay(IntelligentCreatureType pType, string message)
        {
            if (!CreatureSummoned || message == "") return;
            if (pType != SummonedCreatureType) return;

            for (int i = 0; i < Pets.Count; i++)
            {
                if (Pets[i].Info.AI != 64) continue;
                if (((IntelligentCreatureObject)Pets[i]).petType != pType) continue;

                Enqueue(new S.ObjectChat { ObjectID = Pets[i].ObjectID, Text = message, Type = ChatType.Normal });
                return;
            }
        }