Exemple #1
0
        public static int GetPawneerBasePriceForHorse(HorseInfo.Breed breed)
        {
            foreach (Pawneer ppm in PawneerPriceModels)
            {
                if (ppm.BreedId == breed.Id)
                {
                    return(ppm.BasePrice);
                }
            }

            throw new Exception("No pawneeer base price found >_> for breed #" + breed.Id + " " + breed.Name);
        }
Exemple #2
0
        public TackShopGiveaway()
        {
            List <World.SpecialTile> specialTiles = new List <World.SpecialTile>();

            foreach (World.SpecialTile sTile in World.SpecialTiles)
            {
                if (sTile.Code != null)
                {
                    if (sTile.Code.StartsWith("STORE-"))
                    {
                        int  storeId  = int.Parse(sTile.Code.Split("-")[1]);
                        Shop shopData = Shop.GetShopById(storeId);

                        if (shopData.BuysItemTypes.Contains("TACK"))
                        {
                            Npc.NpcEntry[] npcShop = Npc.GetNpcByXAndY(sTile.X, sTile.Y);
                            if (npcShop.Length > 0)
                            {
                                specialTiles.Add(sTile);
                            }
                        }
                    }
                }
            }

            string npcName = "ERROR";
            string npcDesc = "OBTAINING NAME";

            int shpIdx = GameServer.RandomNumberGenerator.Next(0, specialTiles.Count);

            Location = specialTiles[shpIdx];
            Npc.NpcEntry[] npcShops = Npc.GetNpcByXAndY(Location.X, Location.Y);

            npcName = npcShops[0].Name.Split(" ")[0];
            if (npcShops[0].ShortDescription.ToLower().Contains("tack"))
            {
                npcDesc  = npcShops[0].ShortDescription.Substring(npcShops[0].ShortDescription.ToLower().IndexOf("tack"));
                ShopName = npcName + "'s " + npcDesc;
            }
            else
            {
                ShopName = npcName + "'s Gear";
            }


            while (true)
            {
                int             hrsIdx = GameServer.RandomNumberGenerator.Next(0, HorseInfo.Breeds.Count);
                HorseInfo.Breed breed  = HorseInfo.Breeds[hrsIdx];
                if (breed.SpawnInArea == "none")
                {
                    continue;
                }

                HorseGiveaway      = new HorseInstance(breed);
                HorseGiveaway.Name = "Tack Shop Giveaway";
                break;
            }

            if (World.InTown(Location.X, Location.Y))
            {
                Town = World.GetTown(Location.X, Location.Y);
            }
        }