예제 #1
0
        public bool SpawnMinion()
        {
            if (Pets.Count >= MaxMinions)
            {
                return(false);
            }

            MonsterInfo info = Envir.GetMonsterInfo(Settings.SnakesName);

            if (info == null)
            {
                return(false);
            }

            MonsterObject monster;

            monster             = MonsterObject.GetMonster(info);
            monster.PetLevel    = PetLevel;
            monster.Master      = (Master != null) ? Master : this;
            monster.MaxPetLevel = (byte)(1 + PetLevel * 2);
            monster.Direction   = Direction;
            monster.ActionTime  = Envir.Time + 1000;
            ((Monsters.CharmedSnake)monster).AliveTime   = Envir.Time + ((PetLevel * 2000) + 10000);
            ((Monsters.CharmedSnake)monster).MasterTotem = this;

            Pets.Add(monster);
            monster.Spawn(CurrentMap, CurrentLocation);

            return(true);
        }
        void Handle(Input.AddPet action)
        {
            var p = Pets.Add();

            p.Name = "Cecil";
            p.Kind = "Hamster";
        }
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Pets.Clear();
                var pets = await _petClient.GetPetsAsync();

                foreach (var item in pets)
                {
                    Pets.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #4
0
        private static void ReadPets()
        {
            short Count = Reader.ReadInt16();

            for (short i = 0; i < Count; i++)
            {
                int     petid = Reader.ReadInt32();
                PetData pd    = new PetData();
                pd.ItemID    = petid;
                pd.Hungry    = Reader.ReadByte();
                pd.Life      = Reader.ReadByte();
                pd.Reactions = new Dictionary <byte, PetReactionData>();

                byte interacts = Reader.ReadByte();
                for (byte j = 0; j < interacts; j++)
                {
                    PetReactionData prd = new PetReactionData();
                    prd.ReactionID = Reader.ReadByte();
                    prd.Inc        = Reader.ReadByte();
                    prd.Prob       = Reader.ReadByte();
                    pd.Reactions.Add(prd.ReactionID, prd);
                }
                Pets.Add(petid, pd);
            }
        }
예제 #5
0
 public void AddPet(string type, Animal pet)
 {
     if (!Pets.ContainsKey(type))
     {
         Pets.Add(type, new List <Animal>());
     }
     Pets[type].Add(pet);
 }
예제 #6
0
        public void AddPet(Pet pet)
        {
            int max = Pets.Max(pet => pet.Id);

            pet.Id = (++max);
            Pets.Add(pet);
            WritePetsToFile();
        }
예제 #7
0
        public void CreateRoboticPet()
        {
            Robotic newPet  = new Robotic();
            bool    namePet = true;

            while (namePet)
            {
                Console.Clear();
                Console.WriteLine("Please name your new pet: ");
                newPet.Name = Console.ReadLine();
                if (newPet.Name.Length < 1)
                {
                    continue;
                }
                else
                {
                    namePet = false;
                }
            }
            Console.Clear();
            bool runNew = true;

            do
            {
                Console.WriteLine("What species is your new pet?");
                Console.WriteLine("1. Dog");
                Console.WriteLine("2. Cat");
                Console.WriteLine();
                string speciesChoice = Console.ReadLine();

                switch (speciesChoice)
                {
                case "1":
                    newPet.Species = "Dog";
                    runNew         = false;
                    break;

                case "2":
                    newPet.Species = "Cat";
                    runNew         = false;
                    break;

                default:
                    Console.WriteLine("Please choose either a dog or cat. Press ENTER to try again.");
                    Console.ReadKey();
                    Console.Clear();
                    break;
                }
            } while (runNew);

            Pets.Add(newPet);

            Console.Clear();
            Console.WriteLine("Congratulations! Your new pet " + newPet.Species + ", " + newPet.Name + ", is ready to go!");
            Console.WriteLine("Press ENTER to go to the main menu.");
            Console.ReadKey();
        }
예제 #8
0
        public async Task <Pet> AddPetAsync(Pet pet)
        {
            int max = Pets.Max(pet => pet.Id);

            pet.Id = (++max);
            Pets.Add(pet);
            WritePetsToFile();
            return(pet);
        }
예제 #9
0
 public bool BuyPet(Pet pet, int price)
 {
     if (Money >= price)
     {
         Money -= price;
         Pets.Add(pet);
         return(true);
     }
     return(false);
 }
예제 #10
0
        public bool AddPet(Pet pet)
        {
            bool added = false;

            if (!Pets.Contains(pet))
            {
                Pets.Add(pet);
                added = true;
            }
            return(added);
        }
예제 #11
0
        private void LoadData()
        {
            Pets.Clear();

            var petModels = petsData.GetPets();

            foreach (var model in petModels)
            {
                var petDescription = new PetDescription {
                    Id = model.Id, IsSelected = false, Name = model.Name, Image = model.Image
                };
                Pets.Add(petDescription);
            }
        }
예제 #12
0
파일: Inventory.cs 프로젝트: fuding/yupi
 // TODO Use visitor pattern to achieve this?
 public virtual void Add(Item item)
 {
     if (item is FloorItem)
     {
         FloorItems.Add((FloorItem)item);
     }
     else if (item is WallItem)
     {
         WallItems.Add((WallItem)item);
     }
     else if (item is PetItem)
     {
         Pets.Add((PetItem)item);
     }
 }
예제 #13
0
        public override async Task LoadAsync()
        {
            IsRefreshing = true;
            var pets = await _petsInLoveApiService.GetTagsAsync();

            //System.Diagnostics.Debug.WriteLine("FOUND {0} PETS", pets.Count);
            Pets.Clear();
            foreach (var pet in pets)
            {
                Pets.Add(pet);
            }

            OnPropertyChanged(nameof(Pets));
            IsRefreshing = false;
        }
예제 #14
0
        public async Task <bool> CreatePet(PetVm pet)
        {
            await Task.Delay(1000);

            var newPet = new Pet
            {
                Name      = pet.Name,
                Latitude  = pet.Latitude,
                Longitude = pet.Longitude,
                BreedId   = pet.Breed.Id,
                PetTypeId = pet.Type.Id
            };

            Pets.Add(newPet);
            return(true);
        }
예제 #15
0
        public void AddItem(LockerItem lockerItem, BaseItem baseItem)
        {
            Items.Add(lockerItem);

            if (baseItem is EquipItem ei)
            {
                Equips.Add(ei);
            }
            else if (baseItem is BundleItem bi)
            {
                Bundles.Add(bi);
            }
            else if (baseItem is PetItem pi)
            {
                Pets.Add(pi);
            }
        }
예제 #16
0
        internal override void Plus(XDocument xdoc)
        {
            foreach (var element in xdoc.Root.Elements())
            {
                var val = element.Value;
                int valI;
                int.TryParse(val, out valI);

                switch (element.Name.LocalName)
                {
                case "id":
                case "type":
                    break;

                case "group":
                    if (HfIds == null)
                    {
                        HfIds = new List <int>();
                    }
                    if (!HfIds.Contains(valI))
                    {
                        HfIds.Add(valI);
                    }
                    break;

                case "pets":
                    var race = World.GetAddRace(val);
                    if (Pets == null)
                    {
                        Pets = new List <Race>();
                    }
                    Pets.Add(race);
                    break;

                case "site":
                    break;

                default:
                    DFXMLParser.UnexpectedXmlElement(xdoc.Root.Name.LocalName + "\t" + Types[Type], element, xdoc.Root.ToString());
                    break;
                }
            }
        }
예제 #17
0
        async Task ExecuteLoadPetsCommand()
        {
            IsBusy = true;

            try
            {
                Pets.Clear();
                var pets = await DataStore.GetPetsAsync(true);

                foreach (var pet in pets)
                {
                    Pets.Add(pet);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #18
0
    //Should be moved to Pet class.
    public void LoadPetsFromString(string data)
    {
        string[] lines = data.Split((char)17)[0].Split((char)16);
        foreach (string line in lines)
        {
            if (line.Length > 1)
            {
                Pet      newPet = new Pet();
                string[] info   = line.Split((char)15)[0].Split((char)14);
                newPet.Name        = info[0];
                newPet.Description = info[1];
                newPet.Nickname    = info[2];

                newPet.MinLevel = int.Parse(info[3]);

                newPet.Affinity = info[4];

                newPet.Identifier = info[5];
                string skillString = line.Split((char)15)[1];

                newPet.SetSkills(Extensions.GetSkillsFromString(skillString));
                if (Pets.Find(x => x.Name == info[0]) == null)
                {
                    Pets.Add(newPet);
                }
            }
        }
        if (data.Split((char)17).Length > 1)
        {
            if (data.Split((char)17)[1] == "None")
            {
                return;
            }
            ActivePet = Pets.Find(x => x.Name == data.Split((char)17)[1]);
        }
    }
예제 #19
0
 /// <summary>
 /// Adds a pet to the pets list and also gives the parameter p an id
 /// </summary>
 /// <param name="p">The pet to be added to the list</param>
 /// <returns>the pet that was added</returns>
 public Pet AddPetToDatabase(Pet p)
 {
     p.Id = petId++;
     Pets.Add(p);
     return(p);
 }
예제 #20
0
        public override void UseItem(ulong id)
        {
            S.UseItem p = new S.UseItem {
                UniqueID = id, Grid = MirGridType.HeroInventory, Success = false
            };

            UserItem item  = null;
            int      index = -1;

            for (int i = 0; i < Info.Inventory.Length; i++)
            {
                item = Info.Inventory[i];
                if (item == null || item.UniqueID != id)
                {
                    continue;
                }
                index = i;
                break;
            }

            if (item == null || index == -1 || !CanUseItem(item))
            {
                Owner.Enqueue(p);
                return;
            }

            if (Dead && !(item.Info.Type == ItemType.Scroll && item.Info.Shape == 6))
            {
                Owner.Enqueue(p);
                return;
            }

            switch (item.Info.Type)
            {
            case ItemType.Potion:
                switch (item.Info.Shape)
                {
                case 0:         //NormalPotion
                    PotHealthAmount = (ushort)Math.Min(ushort.MaxValue, PotHealthAmount + item.Info.Stats[Stat.HP]);
                    PotManaAmount   = (ushort)Math.Min(ushort.MaxValue, PotManaAmount + item.Info.Stats[Stat.MP]);
                    break;

                case 1:         //SunPotion
                    ChangeHP(item.Info.Stats[Stat.HP]);
                    ChangeMP(item.Info.Stats[Stat.MP]);
                    break;

                case 2:         //MysteryWater
                    if (UnlockCurse)
                    {
                        ReceiveChat("You can already unequip a cursed item.", ChatType.Hint);
                        Owner.Enqueue(p);
                        return;
                    }
                    ReceiveChat("You can now unequip a cursed item.", ChatType.Hint);
                    UnlockCurse = true;
                    break;

                case 3:         //Buff
                {
                    int time = item.Info.Durability;

                    if (item.GetTotal(Stat.MaxDC) > 0)
                    {
                        AddBuff(BuffType.Impact, this, time * Settings.Minute, new Stats {
                                [Stat.MaxDC] = item.GetTotal(Stat.MaxDC)
                            });
                    }

                    if (item.GetTotal(Stat.MaxMC) > 0)
                    {
                        AddBuff(BuffType.Magic, this, time * Settings.Minute, new Stats {
                                [Stat.MaxMC] = item.GetTotal(Stat.MaxMC)
                            });
                    }

                    if (item.GetTotal(Stat.MaxSC) > 0)
                    {
                        AddBuff(BuffType.Taoist, this, time * Settings.Minute, new Stats {
                                [Stat.MaxSC] = item.GetTotal(Stat.MaxSC)
                            });
                    }

                    if (item.GetTotal(Stat.AttackSpeed) > 0)
                    {
                        AddBuff(BuffType.Storm, this, time * Settings.Minute, new Stats {
                                [Stat.AttackSpeed] = item.GetTotal(Stat.AttackSpeed)
                            });
                    }

                    if (item.GetTotal(Stat.HP) > 0)
                    {
                        AddBuff(BuffType.HealthAid, this, time * Settings.Minute, new Stats {
                                [Stat.HP] = item.GetTotal(Stat.HP)
                            });
                    }

                    if (item.GetTotal(Stat.MP) > 0)
                    {
                        AddBuff(BuffType.ManaAid, this, time * Settings.Minute, new Stats {
                                [Stat.MP] = item.GetTotal(Stat.MP)
                            });
                    }

                    if (item.GetTotal(Stat.MaxAC) > 0)
                    {
                        AddBuff(BuffType.Defence, this, time * Settings.Minute, new Stats {
                                [Stat.MaxAC] = item.GetTotal(Stat.MaxAC)
                            });
                    }

                    if (item.GetTotal(Stat.MaxMAC) > 0)
                    {
                        AddBuff(BuffType.MagicDefence, this, time * Settings.Minute, new Stats {
                                [Stat.MaxMAC] = item.GetTotal(Stat.MaxMAC)
                            });
                    }

                    if (item.GetTotal(Stat.BagWeight) > 0)
                    {
                        AddBuff(BuffType.BagWeight, this, time * Settings.Minute, new Stats {
                                [Stat.BagWeight] = item.GetTotal(Stat.BagWeight)
                            });
                    }
                }
                break;

                case 4:         //Exp
                {
                    int time = item.Info.Durability;
                    AddBuff(BuffType.Exp, this, Settings.Minute * time, new Stats {
                            [Stat.ExpRatePercent] = item.GetTotal(Stat.Luck)
                        });
                }
                break;

                case 5:         //Drop
                {
                    int time = item.Info.Durability;
                    AddBuff(BuffType.Drop, this, Settings.Minute * time, new Stats {
                            [Stat.ItemDropRatePercent] = item.GetTotal(Stat.Luck)
                        });
                }
                break;
                }
                break;

            case ItemType.Scroll:
                UserItem temp;
                switch (item.Info.Shape)
                {
                case 3:         //BenedictionOil
                    if (!TryLuckWeapon())
                    {
                        Owner.Enqueue(p);
                        return;
                    }
                    break;

                case 4:         //RepairOil
                    temp = Info.Equipment[(int)EquipmentSlot.Weapon];
                    if (temp == null || temp.MaxDura == temp.CurrentDura)
                    {
                        Owner.Enqueue(p);
                        return;
                    }
                    if (temp.Info.Bind.HasFlag(BindMode.DontRepair))
                    {
                        Owner.Enqueue(p);
                        return;
                    }
                    temp.MaxDura = (ushort)Math.Max(0, temp.MaxDura - Math.Min(5000, temp.MaxDura - temp.CurrentDura) / 30);

                    temp.CurrentDura = (ushort)Math.Min(temp.MaxDura, temp.CurrentDura + 5000);
                    temp.DuraChanged = false;

                    ReceiveChat("Your weapon has been partially repaired", ChatType.Hint);
                    Owner.Enqueue(new S.ItemRepaired {
                        UniqueID = temp.UniqueID, MaxDura = temp.MaxDura, CurrentDura = temp.CurrentDura
                    });
                    break;

                case 5:         //WarGodOil
                    temp = Info.Equipment[(int)EquipmentSlot.Weapon];
                    if (temp == null || temp.MaxDura == temp.CurrentDura)
                    {
                        Owner.Enqueue(p);
                        return;
                    }
                    if (temp.Info.Bind.HasFlag(BindMode.DontRepair) || (temp.Info.Bind.HasFlag(BindMode.NoSRepair)))
                    {
                        Owner.Enqueue(p);
                        return;
                    }
                    temp.CurrentDura = temp.MaxDura;
                    temp.DuraChanged = false;

                    ReceiveChat("Your weapon has been completely repaired", ChatType.Hint);
                    Owner.Enqueue(new S.ItemRepaired {
                        UniqueID = temp.UniqueID, MaxDura = temp.MaxDura, CurrentDura = temp.CurrentDura
                    });
                    break;

                case 6:         //ResurrectionScroll
                    if (CurrentMap.Info.NoReincarnation)
                    {
                        ReceiveChat(string.Format("Cannot use on this map"), ChatType.System);
                        Owner.Enqueue(p);
                        return;
                    }
                    if (Dead)
                    {
                        MP = Stats[Stat.MP];
                        Revive(MaxHealth, true);
                    }
                    break;
                }
                break;

            case ItemType.Book:
                UserMagic magic = new UserMagic((Spell)item.Info.Shape);

                if (magic.Info == null)
                {
                    Owner.Enqueue(p);
                    return;
                }

                Info.Magics.Add(magic);
                SendMagicInfo(magic);
                RefreshStats();
                break;

            case ItemType.Food:
                temp = Info.Equipment[(int)EquipmentSlot.Mount];
                if (temp == null || temp.MaxDura == temp.CurrentDura)
                {
                    Owner.Enqueue(p);
                    return;
                }

                switch (item.Info.Shape)
                {
                case 0:
                    temp.MaxDura = (ushort)Math.Max(0, temp.MaxDura - Math.Min(1000, temp.MaxDura - (temp.CurrentDura / 30)));
                    break;

                case 1:
                    break;
                }

                temp.CurrentDura = (ushort)Math.Min(temp.MaxDura, temp.CurrentDura + item.CurrentDura);
                temp.DuraChanged = false;

                ReceiveChat("Your mount has been fed.", ChatType.Hint);
                Owner.Enqueue(new S.ItemRepaired {
                    UniqueID = temp.UniqueID, MaxDura = temp.MaxDura, CurrentDura = temp.CurrentDura
                });

                RefreshStats();
                break;

            case ItemType.Transform:     //Transforms
            {
                AddBuff(BuffType.Transform, this, (Settings.Second * item.Info.Durability), new Stats(), values: item.Info.Shape);
            }
            break;

            case ItemType.Deco:

                DecoObject decoOb = new DecoObject
                {
                    Image           = item.Info.Shape,
                    CurrentMap      = CurrentMap,
                    CurrentLocation = CurrentLocation,
                };

                CurrentMap.AddObject(decoOb);
                decoOb.Spawned();

                Owner.Enqueue(decoOb.GetInfo());

                break;

            case ItemType.MonsterSpawn:

                var monsterID    = item.Info.Stats[Stat.HP];
                var spawnAsPet   = item.Info.Shape == 1;
                var conquestOnly = item.Info.Shape == 2;

                var monsterInfo = Envir.GetMonsterInfo(monsterID);
                if (monsterInfo == null)
                {
                    break;
                }

                MonsterObject monster = MonsterObject.GetMonster(monsterInfo);
                if (monster == null)
                {
                    break;
                }

                if (spawnAsPet)
                {
                    if (Pets.Count(t => !t.Dead && t.Race != ObjectType.Creature) >= Globals.MaxPets)
                    {
                        ReceiveChat("Maximum number of pets already reached.", ChatType.Hint);
                        Owner.Enqueue(p);
                        return;
                    }

                    monster.Master      = this;
                    monster.PetLevel    = 0;
                    monster.MaxPetLevel = 7;

                    Pets.Add(monster);
                }

                if (conquestOnly)
                {
                    var con = CurrentMap.GetConquest(CurrentLocation);
                    if (con == null)
                    {
                        ReceiveChat(string.Format("{0} can only be spawned during a conquest.", monsterInfo.GameName), ChatType.Hint);
                        Owner.Enqueue(p);
                        return;
                    }
                }

                monster.Direction  = Direction;
                monster.ActionTime = Envir.Time + 5000;

                if (!monster.Spawn(CurrentMap, Front))
                {
                    monster.Spawn(CurrentMap, CurrentLocation);
                }
                break;

            case ItemType.SiegeAmmo:
                //TODO;
                break;

            default:
                return;
            }

            if (item.Count > 1)
            {
                item.Count--;
            }
            else
            {
                Info.Inventory[index] = null;
            }
            RefreshBagWeight();

            Report?.ItemChanged(item, 1, 1);

            p.Success = true;
            Owner.Enqueue(p);
        }
예제 #21
0
        static void Main(string[] args)
        {
            Pet  thisPet = null;
            Dog  dog     = null;
            Cat  cat     = null;
            IDog iDog    = null;
            ICat iCat    = null;

            //create list of pets
            Pets pets = new Pets();

            //random num
            Random rand = new Random();

            //loop 50 times
            for (int i = 0; i < 50; i++)
            {
                // 1 in 10 chance of adding an animal
                if (rand.Next(1, 11) == 1)
                {
                    if (rand.Next(0, 2) == 0)
                    {
                        //output you bought dog
                        Console.WriteLine("You bought a dog!");

                        //get input on name, license id and age
                        Console.WriteLine("Enter the Dog's name: ");
                        string dName = Console.ReadLine();

                        Console.WriteLine("Enter the Dog's license ID: ");
                        string id = Console.ReadLine();

                        Console.WriteLine("Enter the Dog's age: ");
                        int dAge = Convert.ToInt32(Console.ReadLine());

                        // add a dog
                        thisPet = new Dog(id, dName, dAge);
                        pets.Add(thisPet);
                    }
                    else
                    {
                        // else add a cat
                        //output bought cat
                        Console.WriteLine("You bought a cat!");

                        //get input of name and age
                        Console.WriteLine("Enter the Cat's name: ");
                        string cName = Console.ReadLine();

                        Console.WriteLine("Enter the Cat's age: ");
                        int cAge = Convert.ToInt32(Console.ReadLine());

                        //add cat
                        thisPet = new Cat(cName, cAge);
                        pets.Add(thisPet);
                    }
                }
                else
                {
                    // choose a random pet from pets and choose a random activity for the pet to do
                    //if no pets, go back to loop
                    Random nRand = new Random();

                    if (thisPet == null)
                    {
                        //continue through the loop
                        continue;
                    }
                    else
                    {
                        //if dog,
                        if (thisPet.GetType() == typeof(Dog))
                        {
                            //set interface to dog
                            iDog = thisPet;
                        }
                        else if (thisPet.GetType() == typeof(Cat))
                        {
                            //set interface to cat
                            iCat = thisPet;
                        }
                    }
                }
            }
        }
예제 #22
0
        public void AddItem(WorldObject wo, bool logStats)
        {
            // Weapon Properties
            double missileDefMod = 0.00f;
            double magicDefMod   = 0.00f;
            double wield         = 0.00f;
            int    value         = 0;

            TotalItems++;

            // Loop depending on how many items you are creating
            for (int i = 0; i < 1; i++)
            {
                var testItem = wo;
                if (testItem == null)
                {
                    NullCount++;
                    continue;
                }

                switch (testItem.ItemType)
                {
                case ItemType.None:
                    break;

                case ItemType.MeleeWeapon:
                    MeleeWeaponCount++;

                    bool cantrip = false;
                    if (testItem.EpicCantrips.Count > 0)
                    {
                        cantrip = true;
                    }
                    if (testItem.LegendaryCantrips.Count > 0)
                    {
                        cantrip = true;
                    }

                    string strikeType = "N";
                    if (testItem.WeaponMagicDefense != null)
                    {
                        magicDefMod = testItem.WeaponMagicDefense.Value;
                    }
                    if (testItem.Value != null)
                    {
                        value = testItem.Value.Value;
                    }
                    if (testItem.WeaponMissileDefense != null)
                    {
                        missileDefMod = testItem.WeaponMissileDefense.Value;
                    }
                    if (testItem.WieldDifficulty != null)
                    {
                        wield = testItem.WieldDifficulty.Value;
                    }
                    if (testItem.WeaponSkill == Skill.TwoHandedCombat)
                    {
                        if (logStats)
                        {
                            MeleeWeapons.Add($"{testItem.WeaponSkill},{wield},{testItem.Damage.Value},{strikeType},{testItem.DamageVariance.Value},{testItem.WeaponDefense.Value},{magicDefMod},{missileDefMod},{cantrip},{value},{testItem.EncumbranceVal},{testItem.Name}");
                        }
                        else
                        {
                            MeleeWeapons.Add($"{testItem.WeaponSkill}\t {wield}\t {testItem.Damage.Value}\t\t {strikeType} \t\t {testItem.DamageVariance.Value}\t\t {testItem.WeaponDefense.Value}\t\t {magicDefMod}\t\t {missileDefMod}\t\t {cantrip}\t{value}\t{testItem.EncumbranceVal} \t {testItem.Name}");
                        }
                    }
                    else
                    {
                        if ((testItem.W_AttackType & AttackType.TripleStrike) != 0)
                        {
                            strikeType = "3x";
                        }
                        else if ((testItem.W_AttackType & AttackType.DoubleStrike) != 0)
                        {
                            strikeType = "2x";
                        }
                        if (logStats)
                        {
                            MeleeWeapons.Add($"{testItem.WeaponSkill},{wield},{testItem.Damage.Value},{strikeType},{testItem.DamageVariance.Value},{testItem.WeaponDefense.Value},{magicDefMod},{missileDefMod},{cantrip},{value},{testItem.EncumbranceVal},{testItem.Name}");
                        }
                        else
                        {
                            MeleeWeapons.Add($" {testItem.WeaponSkill}\t\t {wield}\t {testItem.Damage.Value}\t\t {strikeType}\t\t {testItem.DamageVariance.Value}\t\t {testItem.WeaponDefense.Value}\t\t {magicDefMod}\t\t {missileDefMod}\t\t {cantrip}\t{value}\t{testItem.EncumbranceVal} \t {testItem.Name}");
                        }
                    }
                    break;

                case ItemType.Armor:
                    ArmorCount++;
                    string equipmentSet = "None    ";
                    cantrip = false;
                    // float cantripSpells = 0;
                    var epicCantripSpells = testItem.EpicCantrips.Keys;

                    if (testItem.EpicCantrips.Count > 0)
                    {
                        cantrip = true;
                    }

                    if (testItem.LegendaryCantrips.Count > 0)
                    {
                        cantrip = true;
                    }

                    if (testItem.EquipmentSetId != null)
                    {
                        equipmentSet = testItem.EquipmentSetId.ToString();
                    }
                    if (logStats)
                    {
                        Armor.Add($"{testItem.ArmorLevel},{testItem.ItemDifficulty},{testItem.Value.Value},{testItem.EncumbranceVal},{testItem.EpicCantrips.Count},{testItem.LegendaryCantrips.Count},{equipmentSet},{testItem.Name}");
                    }
                    else
                    {
                        Armor.Add($" {testItem.ArmorLevel}\t{testItem.ItemDifficulty}\t{testItem.Value.Value}\t{testItem.EncumbranceVal}\t{testItem.EpicCantrips.Count}\t{testItem.LegendaryCantrips.Count}\t{equipmentSet}\t\t\t{testItem.Name}");
                    }
                    if (testItem.Name.Contains("Sheild"))       // typo?
                    {
                        break;
                    }
                    if (testItem.ArmorLevel > MaxAL)
                    {
                        MaxAL     = testItem.ArmorLevel.Value;
                        MaxALItem = testItem.Name;
                    }
                    if (testItem.ArmorLevel < MinAL)
                    {
                        MinAL     = testItem.ArmorLevel.Value;
                        MinALItem = testItem.Name;
                    }
                    break;

                case ItemType.Clothing:
                    if (testItem.Name.Contains("Cloak"))
                    {
                        string cloakSet = "None ";
                        if (testItem.EquipmentSetId != null)
                        {
                            cloakSet = testItem.EquipmentSetId.ToString();
                        }
                        CloakCount++;
                        if (logStats)
                        {
                            Cloaks.Add($"{testItem.ItemMaxLevel},{testItem.WieldDifficulty},{testItem.CloakWeaveProc.Value},{testItem.Value.Value},{cloakSet}");
                        }
                        else
                        {
                            Cloaks.Add($" {testItem.ItemMaxLevel}\t {testItem.WieldDifficulty}\t {testItem.CloakWeaveProc.Value}\t {testItem.Value.Value}\t {cloakSet}");
                        }
                    }
                    else
                    {
                        ClothingCount++;
                    }
                    break;

                case ItemType.Jewelry:
                    JewelryCount++;
                    string jewelrySlot = "";
                    switch (testItem.ValidLocations)
                    {
                    case EquipMask.NeckWear:
                        JewelryNecklaceCount++;
                        jewelrySlot = "Neck";
                        break;

                    case EquipMask.WristWear:
                        JewelryBraceletCount++;
                        jewelrySlot = "Brace";
                        break;

                    case EquipMask.FingerWear:
                        JewelryRingCount++;
                        jewelrySlot = "Ring";
                        break;

                    case EquipMask.TrinketOne:
                        JewelryTrinketCount++;
                        jewelrySlot = "Trink";
                        break;

                    default:
                        // Console.WriteLine(testItem.Name);
                        break;
                    }
                    if (logStats)
                    {
                        Jewelry.Add($"{jewelrySlot},{testItem.ItemDifficulty},{testItem.Value}");
                    }
                    else
                    {
                        Jewelry.Add($" {jewelrySlot}\t {testItem.ItemDifficulty}\t {testItem.Value}");
                    }


                    break;

                case ItemType.Creature:
                    break;

                case ItemType.Food:
                    Food++;
                    break;

                case ItemType.Money:
                    break;

                case ItemType.Misc:

                    string spirit  = "Spirit";
                    string potionA = "Philtre";
                    string potionB = "Elixir";
                    string potionC = "Tonic";
                    string potionD = "Brew";
                    string potionE = "Potion";
                    string potionF = "Draught";
                    string potionG = "Tincture";

                    string healingKits    = "Kit";
                    string spellcompGlyph = "Glyph";
                    string spellcompInk   = "Ink";
                    string spellcompQuill = "Quill";

                    if (testItem.Name.Contains(spirit))
                    {
                        Spirits++;
                    }
                    else if (testItem is PetDevice petDevice)
                    {
                        PetsCount++;
                        int totalRatings     = 0;
                        int damage           = 0;
                        int damageResist     = 0;
                        int crit             = 0;
                        int critDamage       = 0;
                        int critDamageResist = 0;
                        int critResist       = 0;
                        int petLevel         = 0;

                        if (petDevice.UseRequiresSkillLevel == 570)
                        {
                            petLevel = 200;
                        }
                        else if (petDevice.UseRequiresSkillLevel == 530)
                        {
                            petLevel = 180;
                        }
                        else if (petDevice.UseRequiresSkillLevel == 475)
                        {
                            petLevel = 150;
                        }
                        else if (petDevice.UseRequiresSkillLevel == 430)
                        {
                            petLevel = 125;
                        }
                        else if (petDevice.UseRequiresSkillLevel == 400)
                        {
                            petLevel = 100;
                        }
                        else if (petDevice.UseRequiresSkillLevel == 370)
                        {
                            petLevel = 80;
                        }
                        else if (petDevice.UseRequiresSkillLevel == 310)
                        {
                            petLevel = 50;
                        }

                        if (petDevice.GearDamage != null)
                        {
                            totalRatings += petDevice.GearDamage.Value;
                            damage        = petDevice.GearDamage.Value;
                        }
                        if (petDevice.GearDamageResist != null)
                        {
                            totalRatings += petDevice.GearDamageResist.Value;
                            damageResist  = petDevice.GearDamageResist.Value;
                        }
                        if (petDevice.GearCrit != null)
                        {
                            totalRatings += petDevice.GearCrit.Value;
                            crit          = petDevice.GearCrit.Value;
                        }
                        if (petDevice.GearCritDamage != null)
                        {
                            totalRatings += petDevice.GearCritDamage.Value;
                            critDamage    = petDevice.GearCritDamage.Value;
                        }
                        if (petDevice.GearCritDamageResist != null)
                        {
                            totalRatings    += petDevice.GearCritDamageResist.Value;
                            critDamageResist = petDevice.GearCritDamageResist.Value;
                        }
                        if (petDevice.GearCritResist != null)
                        {
                            totalRatings += petDevice.GearCritResist.Value;
                            critResist    = petDevice.GearCritResist.Value;
                        }
                        if (logStats)
                        {
                            Pets.Add($"{petLevel},{damage},{damageResist},{crit},{critDamage},{critDamageResist},{critResist},{totalRatings}");
                        }
                        else
                        {
                            Pets.Add($" {petLevel}\t {damage}\t {damageResist}\t {crit}\t {critDamage}\t {critDamageResist}\t {critResist}\t {totalRatings}");
                        }

                        if (totalRatings > 99)
                        {
                            PetRatingsOverHundred++;
                        }
                        else if (totalRatings > 89)
                        {
                            PetRatingsOverNinety++;
                        }
                        else if (totalRatings > 79)
                        {
                            PetRatingsOverEighty++;
                        }
                        else if (totalRatings > 69)
                        {
                            PetRatingsOverSeventy++;
                        }
                        else if (totalRatings > 59)
                        {
                            PetRatingsOverSixty++;
                        }
                        else if (totalRatings > 49)
                        {
                            PetRatingsOverFifty++;
                        }
                        else if (totalRatings > 39)
                        {
                            PetRatingsOverForty++;
                        }
                        else if (totalRatings > 29)
                        {
                            PetRatingsOverThirty++;
                        }
                        else if (totalRatings > 19)
                        {
                            PetRatingsOverTwenty++;
                        }
                        else if (totalRatings > 9)
                        {
                            PetRatingsOverTen++;
                        }
                        else if (totalRatings > 0)
                        {
                            PetRatingsEqualOne++;
                        }
                        else if (totalRatings < 1)
                        {
                            PetRatingsEqualZero++;
                        }
                    }
                    else if (testItem.Name.Contains(potionA) || testItem.Name.Contains(potionB) || testItem.Name.Contains(potionC) || testItem.Name.Contains(potionD) || testItem.Name.Contains(potionE) || testItem.Name.Contains(potionF) || testItem.Name.Contains(potionG))
                    {
                        Potions++;
                    }
                    else if (testItem.Name.Contains(spellcompGlyph) || testItem.Name.Contains(spellcompInk) || testItem.Name.Contains(spellcompQuill))
                    {
                        LevelEightComp++;
                    }
                    else if (testItem.Name.Contains(healingKits))
                    {
                        HealingKit++;
                    }
                    else
                    {
                        // Console.WriteLine($"ItemType.Misc Name={testItem.Name}");
                        Misc++;
                    }
                    break;

                case ItemType.MissileWeapon:
                    double eleBonus    = 0.00f;
                    double damageMod   = 0.00f;
                    string missileType = "Other";
                    if (testItem.AmmoType != null)
                    {
                        switch (testItem.AmmoType.Value)
                        {
                        case AmmoType.None:
                            break;

                        case AmmoType.Arrow:
                            missileType = "Bow";
                            MissileWeaponCount++;
                            break;

                        case AmmoType.Bolt:
                            missileType = "X Bow";
                            MissileWeaponCount++;
                            break;

                        case AmmoType.Atlatl:
                            missileType = "Thrown";
                            MissileWeaponCount++;
                            break;

                        case AmmoType.ArrowCrystal:
                            break;

                        case AmmoType.BoltCrystal:
                            break;

                        case AmmoType.AtlatlCrystal:
                            break;

                        case AmmoType.ArrowChorizite:
                            break;

                        case AmmoType.BoltChorizite:
                            break;

                        case AmmoType.AtlatlChorizite:
                            break;

                        default:
                            break;
                        }
                    }
                    if (testItem.WeaponMagicDefense != null)
                    {
                        magicDefMod = testItem.WeaponMagicDefense.Value;
                    }
                    if (testItem.Value != null)
                    {
                        value = testItem.Value.Value;
                    }
                    if (testItem.WeaponMissileDefense != null)
                    {
                        missileDefMod = testItem.WeaponMissileDefense.Value;
                    }
                    if (testItem.WieldDifficulty != null)
                    {
                        wield = testItem.WieldDifficulty.Value;
                    }
                    if (testItem.ElementalDamageBonus != null)
                    {
                        eleBonus = testItem.ElementalDamageBonus.Value;
                    }
                    if (testItem.DamageMod != null)
                    {
                        damageMod = testItem.DamageMod.Value;
                    }

                    if (missileType == "Other")
                    {
                        DinnerWare++;
                    }
                    else
                    {
                        if (logStats)
                        {
                            MissileWeapons.Add($"{missileType},{wield},{damageMod},{eleBonus},{testItem.WeaponDefense.Value},{magicDefMod},{missileDefMod},{value},{testItem.EncumbranceVal}");
                        }
                        else
                        {
                            MissileWeapons.Add($"{missileType}\t {wield}\t {damageMod}\t\t{eleBonus}\t\t {testItem.WeaponDefense.Value}\t\t {magicDefMod}\t\t {missileDefMod}\t\t {value}\t {testItem.EncumbranceVal}");
                        }
                    }

                    break;

                case ItemType.Container:
                    break;

                case ItemType.Useless:
                    // Console.WriteLine($"ItemType.Useless Name={testItem.Name}");
                    break;

                case ItemType.Gem:
                    string aetheriaColor = "None";
                    if (Server.Entity.Aetheria.IsAetheria(testItem.WeenieClassId))
                    {
                        AetheriaCount++;
                        if (testItem.WieldDifficulty == 75)
                        {
                            aetheriaColor = "Blue  ";
                        }
                        else if (testItem.WieldDifficulty == 150)
                        {
                            aetheriaColor = "Yellow";
                        }
                        else if (testItem.WieldDifficulty == 225)
                        {
                            aetheriaColor = "Red   ";
                        }
                        if (logStats)
                        {
                            Aetheria.Add($"{aetheriaColor},{testItem.ItemMaxLevel}");
                        }
                        else
                        {
                            Aetheria.Add($" {aetheriaColor}\t {testItem.ItemMaxLevel}");
                        }
                    }
                    else
                    {
                        GemCount++;
                    }
                    break;

                case ItemType.SpellComponents:
                    SpellComponents++;
                    break;

                case ItemType.Writable:
                    string scrolls = "Scroll";

                    if (testItem.Name.Contains(scrolls))
                    {
                        Scrolls++;
                    }
                    else
                    {
                        Console.WriteLine($"ItemType.Writeable Name={testItem.Name}");
                    }
                    break;

                case ItemType.Key:
                    Key++;
                    break;

                case ItemType.Caster:
                    CasterCount++;
                    double eleMod = 0.00f;
                    if (testItem.WeaponMagicDefense != null)
                    {
                        magicDefMod = testItem.WeaponMagicDefense.Value;
                    }
                    if (testItem.Value != null)
                    {
                        value = testItem.Value.Value;
                    }
                    if (testItem.WeaponMissileDefense != null)
                    {
                        missileDefMod = testItem.WeaponMissileDefense.Value;
                    }
                    if (testItem.WieldDifficulty != null)
                    {
                        wield = testItem.WieldDifficulty.Value;
                    }
                    if (testItem.ElementalDamageMod != null)
                    {
                        eleMod = testItem.ElementalDamageMod.Value;
                    }
                    if (testItem.ItemMaxMana != null)
                    {
                        ItemMaxMana = testItem.ItemMaxMana.Value;
                    }
                    if (logStats)
                    {
                        CasterWeapons.Add($"{wield},{eleMod},{testItem.WeaponDefense.Value},{magicDefMod},{missileDefMod},{value},{testItem.EncumbranceVal},{ItemMaxMana}");
                    }
                    else
                    {
                        CasterWeapons.Add($" {wield}\t {eleMod}\t\t {testItem.WeaponDefense.Value}\t\t  {magicDefMod}\t\t {missileDefMod}\t\t {value}\t {testItem.EncumbranceVal} \t {ItemMaxMana}");
                    }
                    break;

                case ItemType.Portal:
                    break;

                case ItemType.Lockable:
                    break;

                case ItemType.PromissoryNote:
                    break;

                case ItemType.ManaStone:
                    ManaStone++;
                    break;

                case ItemType.Service:
                    break;

                case ItemType.MagicWieldable:
                    break;

                case ItemType.CraftCookingBase:
                    OtherCount++;
                    break;

                case ItemType.CraftAlchemyBase:
                    OtherCount++;
                    break;

                case ItemType.CraftFletchingBase:
                    OtherCount++;
                    break;

                case ItemType.CraftAlchemyIntermediate:
                    OtherCount++;
                    break;

                case ItemType.CraftFletchingIntermediate:
                    OtherCount++;
                    break;

                case ItemType.LifeStone:
                    break;

                case ItemType.TinkeringTool:
                    OtherCount++;
                    break;

                case ItemType.TinkeringMaterial:
                    OtherCount++;
                    break;

                case ItemType.Gameboard:
                    break;

                case ItemType.PortalMagicTarget:
                    break;

                case ItemType.LockableMagicTarget:
                    break;

                case ItemType.Vestements:
                    break;

                case ItemType.Weapon:
                    break;

                case ItemType.WeaponOrCaster:
                    break;

                case ItemType.Item:
                    Console.WriteLine($"ItemType.item Name={testItem.Name}");
                    break;

                case ItemType.RedirectableItemEnchantmentTarget:
                    break;

                case ItemType.ItemEnchantableTarget:
                    break;

                case ItemType.VendorShopKeep:
                    break;

                case ItemType.VendorGrocer:
                    break;

                default:
                    OtherCount++;
                    break;
                }

                /*switch (testItem.ItemType)
                 * {
                 *  case ItemType.Armor:
                 *      break;
                 *  case ItemType.MeleeWeapon:
                 *      break;
                 *  case ItemType.Caster:
                 *      break;
                 *  case ItemType.MissileWeapon:
                 *      break;
                 *  case ItemType.Jewelry:
                 *      break;
                 *  case ItemType.Gem:
                 *      break;
                 *  case ItemType.Clothing:
                 *      break;
                 *  default:
                 *      break;
                 * }*/
                if (testItem.ItemMaxMana != null)
                {
                    if (testItem.ItemMaxMana > MaxMana)
                    {
                        MaxMana = testItem.ItemMaxMana.Value;
                    }
                    if (testItem.ItemMaxMana < MinMana)
                    {
                        MinMana = testItem.ItemMaxMana.Value;
                    }
                    HasManaCount++;
                    TotalMaxMana += testItem.ItemMaxMana.Value;
                }
                if (testItem.Name == null)
                {
                    Console.WriteLine("*Name is Null*");
                    continue;
                }
                if (testItem.EpicCantrips.Count > 0)
                {
                    EpicCantripCount++;
                }
                if (testItem.LegendaryCantrips.Count > 0)
                {
                    LegendaryCantripCount++;
                }
            }
        }
예제 #23
0
 public void AddPet(Pet pet)
 {
     Pets.Add(pet);
 }
예제 #24
0
 public void Add(VirtualPet pet)
 {
     Pets.Add(pet);
 }
예제 #25
0
 public void AddPet(PetEntity petEntity)
 {
     petEntity.Id = _uniqueIdentityGenerator.GetIdentityForList(Pets.Select(x => (BaseEntity)x).ToList());
     Pets.Add(petEntity);
 }
예제 #26
0
        // Add the item to the drop list
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            int dropChance;

            int.TryParse(textBoxItemOdds.Text, out dropChance);

            if (dropChance < 1)
            {
                dropChance = 1;
            }

            string quest = QuestOnlyCheckBox.Checked ? "Q" : "";

            try
            {
                switch (tabControlSeperateItems.SelectedTab.Tag.ToString())
                {
                case "Weapon":
                    Weapon.Add(new DropItem {
                        Name = listBoxWeapon.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Armour":
                    Armour.Add(new DropItem {
                        Name = listBoxArmour.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Helmet":
                    Helmet.Add(new DropItem {
                        Name = listBoxHelmet.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Necklace":
                    Necklace.Add(new DropItem {
                        Name = listBoxNecklace.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Bracelet":
                    Bracelet.Add(new DropItem {
                        Name = listBoxBracelet.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Ring":
                    Ring.Add(new DropItem {
                        Name = listBoxRing.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Amulet":
                    Amulet.Add(new DropItem {
                        Name = listBoxAmulet.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Belt":
                    Belt.Add(new DropItem {
                        Name = listBoxBelt.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Boots":
                    Boot.Add(new DropItem {
                        Name = listBoxBoot.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Stone":
                    Stone.Add(new DropItem {
                        Name = listBoxStone.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Torch":
                    Torch.Add(new DropItem {
                        Name = listBoxTorch.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Potion":
                    Potion.Add(new DropItem {
                        Name = listBoxPotion.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Ore":
                    Ore.Add(new DropItem {
                        Name = listBoxOre.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Meat":
                    Meat.Add(new DropItem {
                        Name = listBoxMeat.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "CraftingMaterial":
                    CraftingMaterial.Add(new DropItem {
                        Name = listBoxCraftingMaterial.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}"
                    });
                    break;

                case "Scroll":
                    Scrolls.Add(new DropItem {
                        Name = listBoxScroll.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Gem":
                    Gem.Add(new DropItem {
                        Name = listBoxGem.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Mount":
                    Mount.Add(new DropItem {
                        Name = listBoxMount.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Book":
                    Book.Add(new DropItem {
                        Name = listBoxBook.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Nothing":
                    Nothing.Add(new DropItem {
                        Name = listBoxNothing.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Script":
                    Script.Add(new DropItem {
                        Name = listBoxScript.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Reins":
                    Reins.Add(new DropItem {
                        Name = listBoxReins.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Bells":
                    Bells.Add(new DropItem {
                        Name = listBoxBells.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Saddle":
                    Saddle.Add(new DropItem {
                        Name = listBoxSaddle.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Ribbon":
                    Ribbon.Add(new DropItem {
                        Name = listBoxRibbon.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Mask":
                    Mask.Add(new DropItem {
                        Name = listBoxMask.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Food":
                    Food.Add(new DropItem {
                        Name = listBoxFood.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Hook":
                    Hook.Add(new DropItem {
                        Name = listBoxHook.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Float":
                    Float.Add(new DropItem {
                        Name = listBoxFloat.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Bait":
                    Bait.Add(new DropItem {
                        Name = listBoxBait.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Finder":
                    Finder.Add(new DropItem {
                        Name = listBoxFinder.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Reel":
                    Reel.Add(new DropItem {
                        Name = listBoxReel.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Fish":
                    Fish.Add(new DropItem {
                        Name = listBoxFish.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Quest":
                    Quest.Add(new DropItem {
                        Name = listBoxQuest.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Awakening":
                    Awakening.Add(new DropItem {
                        Name = listBoxAwakening.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Pets":
                    Pets.Add(new DropItem {
                        Name = listBoxPets.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;

                case "Transform":
                    Transform.Add(new DropItem {
                        Name = listBoxTransform.SelectedItem.ToString().Replace(" ", string.Empty), Odds =
                            $"1/{dropChance}", Quest = quest
                    });
                    break;
                }

                UpdateDropFile();
            }
            catch
            {
                //No item selected when trying to add an item to the drop
            }
        }
예제 #27
0
        // Load the monster.txt drop file.
        private void LoadDropFile(bool edit)
        {
            var lines = (edit == false) ? File.ReadAllLines(GetPathOfSelectedItem()) : textBoxDropList.Lines;

            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i].StartsWith(";Gold"))
                {
                    if (lines[i + 1].StartsWith("1/"))
                    {
                        var workingLine = lines[i + 1].Split(' ');
                        GoldOdds = workingLine[0].Remove(0, 2);
                        Gold     = workingLine[2];
                        break;
                    }
                    else
                    {
                        GoldOdds = "0";
                        Gold     = "0";
                    }
                }
            }

            string[] Headers = new string[37]
            {
                ";Weapons",
                ";Armours",
                ";Helmets",
                ";Necklaces",
                ";Bracelets",
                ";Rings",
                ";Amulets",
                ";Belts",
                ";Boots",
                ";Stones",
                ";Torches",
                ";Potions",
                ";Ores",
                ";Meat",
                ";Crafting Materials",
                ";Scrolls",
                ";Gems",
                ";Mount",
                ";Books",
                ";Nothing",
                ";Script",
                ";Reins",
                ";Bells",
                ";Saddle",
                ";Ribbon",
                ";Mask",
                ";Food",
                ";Hook",
                ";Float",
                ";Bait",
                ";Finder",
                ";Reel",
                ";Fish",
                ";Quest",
                ";Awakening",
                ";Pets",
                ";Transform"
            };

            for (int i = 0; i < Headers.Length; i++)
            {
                for (int j = 0; j < lines.Length; j++)
                {
                    if (lines[j].StartsWith(Headers[i]))
                    {
                        for (int k = j + 1; k < lines.Length; k++)
                        {
                            if (lines[k].StartsWith(";"))
                            {
                                break;
                            }

                            var workingLine = lines[k].Split(' ');
                            if (workingLine.Length < 2)
                            {
                                continue;
                            }

                            var quest = "";

                            if (workingLine.Length > 2 && workingLine[2] == "Q")
                            {
                                quest = workingLine[2];
                            }

                            DropItem newDropItem = new DropItem {
                                Odds = workingLine[0], Name = workingLine[1], Quest = quest
                            };
                            switch (i)
                            {
                            case 0:
                                Weapon.Add(newDropItem);
                                break;

                            case 1:
                                Armour.Add(newDropItem);
                                break;

                            case 2:
                                Helmet.Add(newDropItem);
                                break;

                            case 3:
                                Necklace.Add(newDropItem);
                                break;

                            case 4:
                                Bracelet.Add(newDropItem);
                                break;

                            case 5:
                                Ring.Add(newDropItem);
                                break;

                            case 6:
                                Amulet.Add(newDropItem);
                                break;

                            case 7:
                                Belt.Add(newDropItem);
                                break;

                            case 8:
                                Boot.Add(newDropItem);
                                break;

                            case 9:
                                Stone.Add(newDropItem);
                                break;

                            case 10:
                                Torch.Add(newDropItem);
                                break;

                            case 11:
                                Potion.Add(newDropItem);
                                break;

                            case 12:
                                Ore.Add(newDropItem);
                                break;

                            case 13:
                                Meat.Add(newDropItem);
                                break;

                            case 14:
                                CraftingMaterial.Add(newDropItem);
                                break;

                            case 15:
                                Scrolls.Add(newDropItem);
                                break;

                            case 16:
                                Gem.Add(newDropItem);
                                break;

                            case 17:
                                Mount.Add(newDropItem);
                                break;

                            case 18:
                                Book.Add(newDropItem);
                                break;

                            case 19:
                                Nothing.Add(newDropItem);
                                break;

                            case 20:
                                Script.Add(newDropItem);
                                break;

                            case 21:
                                Reins.Add(newDropItem);
                                break;

                            case 22:
                                Bells.Add(newDropItem);
                                break;

                            case 23:
                                Saddle.Add(newDropItem);
                                break;

                            case 24:
                                Ribbon.Add(newDropItem);
                                break;

                            case 25:
                                Mask.Add(newDropItem);
                                break;

                            case 26:
                                Food.Add(newDropItem);
                                break;

                            case 27:
                                Hook.Add(newDropItem);
                                break;

                            case 28:
                                Float.Add(newDropItem);
                                break;

                            case 29:
                                Bait.Add(newDropItem);
                                break;

                            case 30:
                                Finder.Add(newDropItem);
                                break;

                            case 31:
                                Reel.Add(newDropItem);
                                break;

                            case 32:
                                Fish.Add(newDropItem);
                                break;

                            case 33:
                                Quest.Add(newDropItem);
                                break;

                            case 34:
                                Awakening.Add(newDropItem);
                                break;

                            case 35:
                                Pets.Add(newDropItem);
                                break;

                            case 36:
                                Transform.Add(newDropItem);
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }