Esempio n. 1
0
            public TurnInEntry(Mobile player, TradeMinister minister) : base(1151729, 3) // Turn in a trade order
            {
                Player   = player;
                Minister = minister;

                Enabled = CityTradeSystem.HasTrade(Player);
            }
Esempio n. 2
0
            public TradeOrderEntry(Mobile player, TradeMinister minister) : base(1114453, 5) // Get Trade Order
            {
                Player   = player;
                Minister = minister;

                Enabled = !CityTradeSystem.HasTrade(Player);
            }
Esempio n. 3
0
        public bool TryOfferTrade(Mobile from, TradeMinister minister)
        {
            if (from == null || from.Backpack == null)
            {
                return(true);
            }

            if (ActiveTrades.ContainsKey(from))
            {
                minister.SayTo(from, 1151722);                 // It appears you are already delivering a trade order. Deliver your current order before requesting another.
            }
            else
            {
                City origin = minister.City;
                City destination;

                do
                {
                    destination = CityLoyaltySystem.GetRandomCity();
                }while (destination == origin);

                int             distance = GetDistance(minister, destination);
                int             trades   = Utility.RandomMinMax(1, GetMaxTrades(from));
                TradeEntry      entry    = new TradeEntry(destination, origin, distance);
                TradeOrderCrate crate    = new TradeOrderCrate(from, entry);

                GetPlayerEntry <CityTradeEntry>(from as PlayerMobile, true);

                for (int i = 0; i < trades; i++)
                {
                    int    worth = 1;
                    string name  = null;

                    Type t = GetRandomTrade(origin, destination, ref worth, ref name);

                    if (t != null)
                    {
                        int amount = Utility.RandomList(5, 10, 15, 20);
                        entry.Details.Add(new TradeEntry.TradeDetails(t, worth, amount, name));
                    }
                    else
                    {
                        minister.SayTo(from, "There are no trades available at this time.");
                        return(false);
                    }
                }

                if (from.Backpack == null || !from.Backpack.TryDropItem(from, crate, false))
                {
                    crate.Delete();
                    from.SendLocalizedMessage(114456);                     // Your backpack cannot hold the Trade Order.  Free up space and speak to the Trade Minister again.
                }

                ActiveTrades[from] = crate;

                return(true);
            }

            return(false);
        }
Esempio n. 4
0
            public InternalTradeOrderGump(PlayerMobile user, TradeMinister minister)
                : base(100, 100)
            {
                Minister = minister;
                User     = user;

                AddGumpLayout();
            }
Esempio n. 5
0
        public CityPetDonation(City city, TradeMinister minister) : base(city, minister, 0x14E7)
        {
            Table = PetTable;

            if (CitySystem != null && CitySystem.Minister != null)
            {
                CitySystem.Minister.DonationPost = this;
            }
        }
Esempio n. 6
0
        public CityItemDonation(City city, TradeMinister minister) : base(city, minister, 0xE3C)
        {
            Table = ItemTable;

            if (CitySystem != null && CitySystem.Minister != null)
            {
                CitySystem.Minister.DonationCrate = this;
            }
        }
Esempio n. 7
0
        public bool HasTurnIn(Mobile from, TradeMinister minister)
        {
            if (from == null || minister == null || !ActiveTrades.ContainsKey(from) || ActiveTrades[from] == null)
            {
                return(false);
            }

            TradeOrderCrate crate = ActiveTrades[from];

            return(crate.Entry != null && crate.Entry.Origin != minister.City);
        }
Esempio n. 8
0
        public static int GetDistance(TradeMinister origin, City destination)
        {
            TradeMinister destMinister = TradeMinister.Ministers.FirstOrDefault(m => m.City == destination);

            if (destMinister != null)
            {
                return((int)origin.GetDistanceToSqrt(destMinister.Location));
            }

            return(0);
        }
Esempio n. 9
0
        public bool TryTurnIn(Mobile from, TradeOrderCrate order, Mobile turninMobile)
        {
            if (order == null || from == null || turninMobile == null || order.Entry == null)
            {
                return(false);
            }

            TradeEntry    entry    = order.Entry;
            TradeMinister minister = turninMobile as TradeMinister;

            if (from.AccessLevel == AccessLevel.Player && minister != null && minister.City != entry.Destination)
            {
                turninMobile.SayTo(from, 1151738, string.Format("#{0}", CityLoyaltySystem.GetCityLocalization(entry.Destination))); // Begging thy pardon, but those goods are destined for the City of ~1_city~
            }
            else if (!order.Fulfilled)
            {
                turninMobile.SayTo(from, 1151732); // This trade order has not been fulfilled.  Fill the trade order with all necessary items and try again.
            }
            else
            {
                CityLoyaltySystem.OnTradeComplete(from, order.Entry);
                CityTradeEntry pentry = GetPlayerEntry <CityTradeEntry>(from as PlayerMobile);

                if (pentry != null)
                {
                    pentry.Points++;
                    pentry.DistanceTraveled += entry.Distance;
                    pentry.Completed++;
                    CheckTitle(pentry);
                }

                order.Delete();
                return(true);
            }

            return(false);
        }
Esempio n. 10
0
        public bool TryOfferTrade(Mobile from, TradeMinister minister)
        {
            if (from == null || from.Backpack == null)
            {
                return(true);
            }

            if (ActiveTrades.ContainsKey(from))
            {
                minister.SayTo(from, 1151722); // It appears you are already delivering a trade order. Deliver your current order before requesting another.
            }
            else if (KrampusEncounterActive && (KrampusEvent.Instance.Krampus != null || KrampusEvent.Instance.KrampusSpawning))
            {
                Point3D p   = KrampusEvent.Instance.SpawnLocation;
                Map     map = KrampusEvent.Instance.SpawnMap;

                minister.SayTo(
                    from,
                    1158790,
                    string.Format("{0}\t{1}",
                                  WorldLocationInfo.GetLocationString(p, map),
                                  Sextant.GetCoords(p, map)), 1150);
                // Take notice! The vile Krampus has been spotted near ~2_where~ at ~1_coords~!  New Trade Orders are suspended until Krampus has been defeated!
            }
            else
            {
                City origin = minister.City;
                City destination;

                do
                {
                    destination = CityLoyaltySystem.GetRandomCity();
                }while (destination == origin);

                int             distance = GetDistance(minister, destination);
                int             trades   = Utility.RandomMinMax(1, GetMaxTrades(from));
                TradeEntry      entry    = new TradeEntry(destination, origin, distance);
                TradeOrderCrate crate    = new TradeOrderCrate(from, entry);

                GetPlayerEntry <CityTradeEntry>(from as PlayerMobile, true);

                for (int i = 0; i < trades; i++)
                {
                    int    worth = 1;
                    string name  = null;

                    Type t = GetRandomTrade(origin, destination, ref worth, ref name);

                    if (t != null)
                    {
                        if (entry.Details.Any(x => x.ItemType.Name == t.Name))
                        {
                            continue;
                        }

                        int amount = Utility.RandomList(5, 10, 15, 20);
                        entry.Details.Add(new TradeEntry.TradeDetails(t, worth, amount, name));
                    }
                    else
                    {
                        minister.SayTo(from, "There are no trades available at this time.");
                        return(false);
                    }
                }

                if (from.Backpack == null || !from.Backpack.TryDropItem(from, crate, false))
                {
                    crate.Delete();
                    from.SendLocalizedMessage(114456); // Your backpack cannot hold the Trade Order.  Free up space and speak to the Trade Minister again.
                }

                ActiveTrades[from] = crate;

                return(true);
            }

            return(false);
        }
Esempio n. 11
0
        public static void Setup(CommandEventArgs e)
        {
            Mobile m = e.Mobile;

            TradeMinister    minister;
            CityHerald       herald;
            GuardCaptain     capt;
            CityStone        stone;
            CityItemDonation itemdonation;
            CityPetDonation  petdonation;
            BoxOfRopes       box;
            CityMessageBoard board;

            foreach (int c in Enum.GetValues(typeof(City)))
            {
                City city             = (City)c;
                CityLoyaltySystem sys = null;

                switch (city)
                {
                case City.Moonglow: sys = CityLoyaltySystem.Moonglow; break;

                case City.Britain: sys = CityLoyaltySystem.Britain; break;

                case City.Jhelom: sys = CityLoyaltySystem.Jhelom; break;

                case City.Yew: sys = CityLoyaltySystem.Yew; break;

                case City.Minoc: sys = CityLoyaltySystem.Minoc; break;

                case City.Trinsic: sys = CityLoyaltySystem.Trinsic; break;

                case City.SkaraBrae: sys = CityLoyaltySystem.SkaraBrae; break;

                case City.NewMagincia: sys = CityLoyaltySystem.NewMagincia; break;

                case City.Vesper: sys = CityLoyaltySystem.Vesper; break;
                }

                if (sys != null)
                {
                    minister     = new TradeMinister(sys.City);
                    herald       = new CityHerald(sys.City);
                    capt         = new GuardCaptain(sys.City);
                    stone        = new CityStone(sys);
                    itemdonation = new CityItemDonation(sys.City, minister);
                    petdonation  = new CityPetDonation(sys.City, minister);
                    box          = new BoxOfRopes(sys.City);
                    board        = new CityMessageBoard(sys.City, sys.City == City.Trinsic ? 7775 : 7774);

                    if (!HasType(sys, minister.GetType()))
                    {
                        sys.Minister = minister;
                        minister.MoveToWorld(sys.Definition.TradeMinisterLocation, Map.Trammel);
                    }
                    else
                    {
                        minister.Delete();
                    }

                    if (!HasType(sys, herald.GetType()))
                    {
                        sys.Herald = herald;
                        herald.MoveToWorld(sys.Definition.HeraldLocation, Map.Trammel);
                    }
                    else
                    {
                        herald.Delete();
                    }

                    if (!HasType(sys, capt.GetType()))
                    {
                        sys.Captain = capt;
                        capt.MoveToWorld(sys.Definition.GuardsmanLocation, Map.Trammel);
                    }
                    else
                    {
                        capt.Delete();
                    }

                    if (!HasType(sys, stone.GetType()))
                    {
                        sys.Stone = stone;
                        stone.MoveToWorld(sys.Definition.StoneLocation, Map.Trammel);
                    }
                    else
                    {
                        stone.Delete();
                    }

                    if (!HasType(sys, itemdonation.GetType()))
                    {
                        itemdonation.MoveToWorld(new Point3D(sys.Definition.TradeMinisterLocation.X, sys.Definition.TradeMinisterLocation.Y - 1, sys.Definition.TradeMinisterLocation.Z), Map.Trammel);
                    }
                    else
                    {
                        itemdonation.Delete();
                    }

                    if (!HasType(sys, petdonation.GetType()))
                    {
                        petdonation.MoveToWorld(new Point3D(sys.Definition.TradeMinisterLocation.X, sys.Definition.TradeMinisterLocation.Y - 2, sys.Definition.TradeMinisterLocation.Z), Map.Trammel);
                    }
                    else
                    {
                        petdonation.Delete();
                    }

                    if (!HasType(sys, box.GetType()))
                    {
                        box.MoveToWorld(new Point3D(sys.Definition.GuardsmanLocation.X, sys.Definition.GuardsmanLocation.Y - 1, sys.Definition.GuardsmanLocation.Z), Map.Trammel);
                    }
                    else
                    {
                        box.Delete();
                    }

                    if (!HasType(sys, board.GetType()))
                    {
                        board.MoveToWorld(sys.Definition.BoardLocation, Map.Trammel);
                    }
                    else
                    {
                        board.Delete();
                    }

                    sys.CanUtilize = true;

                    m.SendMessage("{0} setup!", sys.Definition.Name);
                }
            }

            for (int i = 0; i < 3; i++)
            {
                string  name;
                Point3D p;

                switch (i)
                {
                default:
                case 0:
                    name = "Ocllo";
                    p    = new Point3D(3674, 2648, 0);
                    break;

                case 1:
                    name = "Nujel'm";
                    p    = new Point3D(3765, 1219, 0);
                    break;

                case 2:
                    name = "Serpent's Hold";
                    p    = new Point3D(3017, 3452, 15);
                    break;
                }

                Region r = Region.Regions.FirstOrDefault(reg => reg.Map == Map.Felucca && reg.Name == name);

                if (r != null)
                {
                    var slim = new SlimTheFence();

                    if (!HasType(r, slim.GetType()))
                    {
                        slim.MoveToWorld(p, Map.Felucca);
                    }
                    else
                    {
                        slim.Delete();
                    }
                }
                else
                {
                    Console.WriteLine("WARNING: {0} Region not found!", name);
                }
            }
        }
Esempio n. 12
0
 public CityDonationItem(City city, TradeMinister minister, int itemid) : base(itemid)
 {
     City     = city;
     Minister = minister;
     Movable  = false;
 }
Esempio n. 13
0
 public InternalTarget(TradeMinister minister) : base(-1, false, TargetFlags.None)
 {
     Minister = minister;
 }