Exemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            City = (City)reader.ReadInt();

            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            case 1:
            {
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Mobile   m  = reader.ReadMobile();
                    DateTime dt = reader.ReadDateTime();

                    if (m != null && dt > DateTime.UtcNow)
                    {
                        CitizenWait[m] = dt;
                    }
                }
            }
                goto case 0;

            case 0:
            {
                CompletedTrades    = reader.ReadInt();
                Governor           = reader.ReadMobile();
                GovernorElect      = reader.ReadMobile();
                PendingGovernor    = reader.ReadBool();
                Treasury           = reader.ReadLong();
                ActiveTradeDeal    = (TradeDeal)reader.ReadInt();
                TradeDealStart     = reader.ReadDateTime();
                NextTradeDealCheck = reader.ReadDateTime();
                CanUtilize         = reader.ReadBool();

                Headline = reader.ReadString();
                Body     = reader.ReadString();
                PostedOn = reader.ReadDateTime();

                if (reader.ReadInt() == 0)
                {
                    Election = new CityElection(this, reader);
                }
                else
                {
                    Election = new CityElection(this);
                }
            }
            break;
            }

            if (version == 0 && this.City == City.Britain)
            {
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Mobile   m  = reader.ReadMobile();
                    DateTime dt = reader.ReadDateTime();

                    if (m != null && dt > DateTime.UtcNow)
                    {
                        CitizenWait[m] = dt;
                    }
                }
            }

            // City Bulletin Board Location
            if (version == 1)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(10), () =>
                {
                    Board = new CityMessageBoard(City, 0xA0C5);
                    Board.MoveToWorld(Definition.BoardLocation, Map.Trammel);
                    Console.WriteLine("City Message Board for {0} Converted!", City.ToString());

                    /*if (Board != null)
                     * {
                     *  //Board.ItemID = 0xA0C5;
                     *  //board.MoveToWorld(Definition.BoardLocation, Map.Trammel);
                     *
                     *
                     *  Console.WriteLine("City Message Board for {0} Converted!", City.ToString());
                     * }
                     * else
                     * {
                     *  Console.WriteLine("City Message Board for {0} not found!", City.ToString());
                     * }*/
                });
            }
        }
Exemplo n.º 2
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);
                }
            }
        }
Exemplo n.º 3
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);
            }
            
        }