コード例 #1
0
		public FactionTownStoneGump( PlayerMobile from, Faction faction, Town town ) : base( 50, 50 )
		{
			m_From = from;
			m_Faction = faction;
			m_Town = town;

			AddPage( 0 );

			AddBackground( 0, 0, 320, 250, 5054 );
			AddBackground( 10, 10, 300, 230, 3000 );

			AddHtmlText( 25, 30, 250, 25, town.Definition.FactionTownStoneHeader, false, false );

			AddHtmlLocalized( 55, 60, 150, 25, 1011557, false, false ); // Hire Sheriff
			AddButton( 20, 60, 4005, 4007, 1, GumpButtonType.Reply, 0 );

			AddHtmlLocalized( 55, 90, 150, 25, 1011559, false, false ); // Hire Finance Minister
			AddButton( 20, 90, 4005, 4007, 2, GumpButtonType.Reply, 0 );

			AddHtmlLocalized( 55, 120, 150, 25, 1011558, false, false ); // Fire Sheriff
			AddButton( 20, 120, 4005, 4007, 3, GumpButtonType.Reply, 0 );

			AddHtmlLocalized( 55, 150, 150, 25, 1011560, false, false ); // Fire Finance Minister
			AddButton( 20, 150, 4005, 4007, 4, GumpButtonType.Reply, 0 );

			AddHtmlLocalized( 55, 210, 150, 25, 1011441, false, false ); // EXIT
			AddButton( 20, 210, 4005, 4007, 0, GumpButtonType.Reply, 0 );
		}
コード例 #2
0
 public FactionHorseVendor( Town town, Faction faction )
     : base(town, faction, "the Horse Breeder")
 {
     SetSkill( SkillName.AnimalLore, 64.0, 100.0 );
     SetSkill( SkillName.AnimalTaming, 90.0, 100.0 );
     SetSkill( SkillName.Veterinary, 65.0, 88.0 );
 }
コード例 #3
0
		public BaseMonolith( Town town, Faction faction ) : base( 0x1183 )
		{
			Movable = false;
			Town = town;
			Faction = faction;
			m_Monoliths.Add( this );
		}
コード例 #4
0
 public FactionOreVendor( Town town, Faction faction )
     : base(town, faction, "the Ore Man")
 {
     // NOTE: Skills verified
     SetSkill( SkillName.Carpentry, 85.0, 100.0 );
     SetSkill( SkillName.Lumberjacking, 60.0, 83.0 );
 }
コード例 #5
0
        public Sigil( Town town )
            : base(0x1869)
        {
            Movable = false;
            Town = town;

            m_Sigils.Add( this );
        }
コード例 #6
0
        public TownStone( Town town )
            : base(0xEDE)
        {
            Movable = false;
            Town = town;

            // Blocked
            this.Delete();
        }
コード例 #7
0
		public FactionReagentVendor( Town town, Faction faction ) : base( town, faction, "the Reagent Man" )
		{
			SetSkill( SkillName.EvalInt, 65.0, 88.0 );
			SetSkill( SkillName.Inscribe, 60.0, 83.0 );
			SetSkill( SkillName.Magery, 64.0, 100.0 );
			SetSkill( SkillName.Meditation, 60.0, 83.0 );
			SetSkill( SkillName.MagicResist, 65.0, 88.0 );
			SetSkill( SkillName.Wrestling, 36.0, 68.0 );
		}
コード例 #8
0
ファイル: VendorList.cs プロジェクト: Crome696/ServUO
 public BaseFactionVendor Construct(Town town, Faction faction)
 {
     try
     {
         return Activator.CreateInstance(this.m_Definition.Type, new object[] { town, faction }) as BaseFactionVendor;
     }
     catch
     {
         return null;
     }
 }
コード例 #9
0
ファイル: BaseFactionVendor.cs プロジェクト: Godkong/RunUO
		public BaseFactionVendor( Town town, Faction faction, string title ) : base( title )
		{
			Frozen = true;
			CantWalk = true;
			Female = false;
			BodyValue = 400;
			Name = NameList.RandomName( "male" );

			RangeHome = 0;

			m_Town = town;
			m_Faction = faction;
			Register();
		}
コード例 #10
0
ファイル: TownStone.cs プロジェクト: justdanofficial/khaeros
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                {
                    Town = Town.ReadReference( reader );
                    break;
                }
            }
        }
コード例 #11
0
ファイル: BaseFactionVendor.cs プロジェクト: Crome696/ServUO
        public BaseFactionVendor(Town town, Faction faction, string title)
            : base(title)
        {
            this.Frozen = true;
            this.CantWalk = true;
            this.Female = false;
            this.BodyValue = 400;
            this.Name = NameList.RandomName("male");

            this.RangeHome = 0;

            this.m_Town = town;
            this.m_Faction = faction;
            this.Register();
        }
コード例 #12
0
ファイル: Generator.cs プロジェクト: Godkong/RunUO
		public static void Generate( Town town )
		{
			Map facet = Faction.Facet;

			TownDefinition def = town.Definition;

			if ( !CheckExistance( def.Monolith, facet, typeof( TownMonolith ) ) )
			{
				TownMonolith mono = new TownMonolith( town );
				mono.MoveToWorld( def.Monolith, facet );
				mono.Sigil = new Sigil( town );
			}

			if ( !CheckExistance( def.TownStone, facet, typeof( TownStone ) ) )
				new TownStone( town ).MoveToWorld( def.TownStone, facet );
		}
コード例 #13
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                {
                    m_Town = Town.ReadReference( reader );
                    m_Faction = Faction.ReadReference( reader );
                    Register();
                    break;
                }
            }

            Frozen = true;
        }
コード例 #14
0
ファイル: Generator.cs プロジェクト: Crome696/ServUO
        public static void Generate(Town town)
        {
            Map facet = Faction.Facet;

            TownDefinition def = town.Definition;

            if (!CheckExistance(def.Monolith, facet, typeof(TownMonolith)))
            {
                TownMonolith mono = new TownMonolith(town);
                mono.MoveToWorld(def.Monolith, facet);
                mono.Sigil = new Sigil(town);
				WeakEntityCollection.Add("factions", mono);
				WeakEntityCollection.Add("factions", mono.Sigil);
			}

			if (!CheckExistance(def.TownStone, facet, typeof(TownStone)))
			{
				TownStone stone = new TownStone(town);
				WeakEntityCollection.Add("factions", stone);
				stone.MoveToWorld(def.TownStone, facet);
			}
        }
コード例 #15
0
ファイル: TownState.cs プロジェクト: justdanofficial/khaeros
        public TownState( GenericReader reader )
        {
            int version = reader.ReadEncodedInt();

            switch ( version )
            {
                case 3:
                {
                    m_LastIncome = reader.ReadDateTime();

                    goto case 2;
                }
                case 2:
                {
                    m_Tax = reader.ReadEncodedInt();
                    m_LastTaxChange = reader.ReadDateTime();

                    goto case 1;
                }
                case 1:
                {
                    m_Silver = reader.ReadEncodedInt();

                    goto case 0;
                }
                case 0:
                {
                    m_Town = Town.ReadReference( reader );
                    m_Owner = Faction.ReadReference( reader );

                    m_Sheriff = reader.ReadMobile();
                    m_Finance = reader.ReadMobile();

                    m_Town.State = this;

                    break;
                }
            }
        }
コード例 #16
0
 public TownState(Town town)
 {
     m_Town   = town;
     m_Active = true;
 }
コード例 #17
0
 public FactionHorseVendor(Town town, Faction faction) : base(town, faction, "the Horse Breeder")
 {
     SetSkill(SkillName.AnimalLore, 64.0, 100.0);
     SetSkill(SkillName.AnimalTaming, 90.0, 100.0);
     SetSkill(SkillName.Veterinary, 65.0, 88.0);
 }
コード例 #18
0
ファイル: TownState.cs プロジェクト: Godkong/Origins
		public TownState( Town town )
		{
			m_Town = town;
		}
コード例 #19
0
		public StrongholdMonolith( Town town, Faction faction )
			: base( town, faction )
		{
		}
コード例 #20
0
 public FactionBottleVendor( Town town, Faction faction )
     : base(town, faction, "the Bottle Seller")
 {
     SetSkill( SkillName.Alchemy, 85.0, 100.0 );
     SetSkill( SkillName.HerbalLore, 65.0, 88.0 );
 }
コード例 #21
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (!m_Town.IsFinance(m_From) || m_Town.Owner != m_Faction)
            {
                m_From.SendLocalizedMessage(1010339);                   // You no longer control this city
                return;
            }

            int type, index;

            if (!FromButtonID(info.ButtonID, out type, out index))
            {
                return;
            }

            switch (type)
            {
            case 0:                     // general
            {
                switch (index)
                {
                case 0:                                 // set price
                {
                    int[] switches = info.Switches;

                    if (switches.Length == 0)
                    {
                        break;
                    }

                    int opt    = switches[0];
                    int newTax = 0;

                    if (opt >= 1 && opt <= m_PriceOffsets.Length)
                    {
                        newTax = m_PriceOffsets[opt - 1];
                    }

                    if (m_Town.Tax == newTax)
                    {
                        break;
                    }

                    if (m_From.AccessLevel == AccessLevel.Player && !m_Town.TaxChangeReady)
                    {
                        TimeSpan remaining = DateTime.Now - (m_Town.LastTaxChange + Town.TaxChangePeriod);

                        if (remaining.TotalMinutes < 4)
                        {
                            m_From.SendLocalizedMessage(1042165);                                               // You must wait a short while before changing prices again.
                        }
                        else if (remaining.TotalMinutes < 10)
                        {
                            m_From.SendLocalizedMessage(1042166);                                               // You must wait several minutes before changing prices again.
                        }
                        else if (remaining.TotalHours < 1)
                        {
                            m_From.SendLocalizedMessage(1042167);                                               // You must wait up to an hour before changing prices again.
                        }
                        else if (remaining.TotalHours < 4)
                        {
                            m_From.SendLocalizedMessage(1042168);                                               // You must wait a few hours before changing prices again.
                        }
                        else
                        {
                            m_From.SendLocalizedMessage(1042169);                                               // You must wait several hours before changing prices again.
                        }
                    }
                    else
                    {
                        m_Town.Tax = newTax;

                        if (m_From.AccessLevel == AccessLevel.Player)
                        {
                            m_Town.LastTaxChange = DateTime.Now;
                        }
                    }

                    break;
                }
                }

                break;
            }

            case 1:                     // make vendor
            {
                VendorListCollection vendorLists = m_Town.VendorLists;

                if (index >= 0 && index < vendorLists.Count)
                {
                    VendorList vendorList = vendorLists[index];

                    if (Town.FromRegion(m_From.Region) != m_Town)
                    {
                        m_From.SendLocalizedMessage(1010305);                                   // You must be in your controlled city to buy Items
                    }
                    else if (vendorList.Vendors.Count >= vendorList.Definition.Maximum)
                    {
                        m_From.SendLocalizedMessage(1010306);                                   // You currently have too many of this enhancement type to place another
                    }
                    else if (m_Town.Silver >= vendorList.Definition.Price)
                    {
                        BaseFactionVendor vendor = vendorList.Construct(m_Town, m_Faction);

                        if (vendor != null)
                        {
                            m_Town.Silver -= vendorList.Definition.Price;

                            vendor.MoveToWorld(m_From.Location, m_From.Map);
                            vendor.Home = vendor.Location;
                        }
                    }
                }

                break;
            }
            }
        }
コード例 #22
0
ファイル: FactionBoardVendor.cs プロジェクト: jaedan/runuo
 public FactionBoardVendor(Town town, Faction faction) : base(town, faction, "the LumberMan") // NOTE: title inconsistant, as OSI
 {
     SetSkill(SkillName.Carpentry, 85.0, 100.0);
     SetSkill(SkillName.Lumberjacking, 60.0, 83.0);
 }
コード例 #23
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            base.OnSpeech(e);

            Mobile from = e.Mobile;

            if (!e.Handled && InRange(from, ListenRange) && from.Alive)
            {
                if (e.HasKeyword(0xE6) && (Insensitive.Equals(e.Speech, "orders") || WasNamed(e.Speech)))                         // *orders*
                {
                    if (m_Town == null || !m_Town.IsSheriff(from))
                    {
                        this.Say(1042189);                           // I don't work for you!
                    }
                    else if (Town.FromRegion(this.Region) == m_Town)
                    {
                        this.Say(1042180);                           // Your orders, sire?
                        m_OrdersEnd = DateTime.Now + TimeSpan.FromSeconds(10.0);
                    }
                }
                else if (DateTime.Now < m_OrdersEnd)
                {
                    if (m_Town != null && m_Town.IsSheriff(from) && Town.FromRegion(this.Region) == m_Town)
                    {
                        m_OrdersEnd = DateTime.Now + TimeSpan.FromSeconds(10.0);

                        bool         understood = true;
                        ReactionType newType    = 0;

                        if (Insensitive.Contains(e.Speech, "attack"))
                        {
                            newType = ReactionType.Attack;
                        }
                        else if (Insensitive.Contains(e.Speech, "warn"))
                        {
                            newType = ReactionType.Warn;
                        }
                        else if (Insensitive.Contains(e.Speech, "ignore"))
                        {
                            newType = ReactionType.Ignore;
                        }
                        else
                        {
                            understood = false;
                        }

                        if (understood)
                        {
                            understood = false;

                            if (Insensitive.Contains(e.Speech, "civil"))
                            {
                                ChangeReaction(null, newType);
                                understood = true;
                            }

                            List <Faction> factions = Faction.Factions;

                            for (int i = 0; i < factions.Count; ++i)
                            {
                                Faction faction = factions[i];

                                if (faction != m_Faction && Insensitive.Contains(e.Speech, faction.Definition.Keyword))
                                {
                                    ChangeReaction(faction, newType);
                                    understood = true;
                                }
                            }
                        }
                        else if (Insensitive.Contains(e.Speech, "patrol"))
                        {
                            Home              = Location;
                            RangeHome         = 6;
                            Combatant         = null;
                            m_Orders.Movement = MovementType.Patrol;
                            Say(1005146);                               // This spot looks like it needs protection!  I shall guard it with my life.
                            understood = true;
                        }
                        else if (Insensitive.Contains(e.Speech, "follow"))
                        {
                            Home              = Location;
                            RangeHome         = 6;
                            Combatant         = null;
                            m_Orders.Follow   = from;
                            m_Orders.Movement = MovementType.Follow;
                            Say(1005144);                               // Yes, Sire.
                            understood = true;
                        }

                        if (!understood)
                        {
                            Say(1042183);                               // I'm sorry, I don't understand your orders...
                        }
                    }
                }
            }
        }
コード例 #24
0
 public FactionOreVendor(Town town, Faction faction) : base(town, faction, "the Ore Man")
 {
     // NOTE: Skills verified
     SetSkill(SkillName.Carpentry, 85.0, 100.0);
     SetSkill(SkillName.Lumberjacking, 60.0, 83.0);
 }
コード例 #25
0
        public override bool Think()
        {
            if (m_Mobile.Deleted)
            {
                return(false);
            }

            Mobile combatant = m_Guard.Combatant;

            if (combatant == null || combatant.Deleted || !combatant.Alive || combatant.IsDeadBondedPet || !m_Mobile.CanSee(combatant) || !m_Mobile.CanBeHarmful(combatant, false) || combatant.Map != m_Mobile.Map)
            {
                // Our combatant is deleted, dead, hidden, or we cannot hurt them
                // Try to find another combatant

                if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, m_Mobile.IsScaryToPets, false, true))
                {
                    m_Mobile.Combatant = combatant = m_Mobile.FocusMob;
                    m_Mobile.FocusMob  = null;
                }
                else
                {
                    m_Mobile.Combatant = combatant = null;
                }
            }

            if (combatant != null && (!m_Mobile.InLOS(combatant) || !m_Mobile.InRange(combatant, 12)))
            {
                if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, m_Mobile.IsScaryToPets, false, true))
                {
                    m_Mobile.Combatant = combatant = m_Mobile.FocusMob;
                    m_Mobile.FocusMob  = null;
                }
                else if (!m_Mobile.InRange(combatant, 36))
                {
                    m_Mobile.Combatant = combatant = null;
                }
            }

            Mobile dispelTarget = FindDispelTarget(true);

            if (m_Guard.Target != null && m_ReleaseTarget == DateTime.MinValue)
            {
                m_ReleaseTarget = DateTime.UtcNow + TimeSpan.FromSeconds(10.0);
            }

            if (m_Guard.Target != null && DateTime.UtcNow > m_ReleaseTarget)
            {
                Target targ = m_Guard.Target;

                Mobile toHarm = (dispelTarget == null ? combatant : dispelTarget);

                if ((targ.Flags & TargetFlags.Harmful) != 0 && toHarm != null)
                {
                    if (m_Guard.Map == toHarm.Map && (targ.Range < 0 || m_Guard.InRange(toHarm, targ.Range)) && m_Guard.CanSee(toHarm) && m_Guard.InLOS(toHarm))
                    {
                        targ.Invoke(m_Guard, toHarm);
                    }
                    else if (targ is DispelSpell.InternalTarget)
                    {
                        targ.Cancel(m_Guard, TargetCancelType.Canceled);
                    }
                }
                else if ((targ.Flags & TargetFlags.Beneficial) != 0)
                {
                    targ.Invoke(m_Guard, m_Guard);
                }
                else
                {
                    targ.Cancel(m_Guard, TargetCancelType.Canceled);
                }

                m_ReleaseTarget = DateTime.MinValue;
            }

            if (dispelTarget != null)
            {
                if (Action != ActionType.Combat)
                {
                    Action = ActionType.Combat;
                }

                m_Guard.Warmode = true;

                RunFrom(dispelTarget);
            }
            else if (combatant != null)
            {
                if (Action != ActionType.Combat)
                {
                    Action = ActionType.Combat;
                }

                m_Guard.Warmode = true;

                RunTo(combatant);
            }
            else if (m_Guard.Orders.Movement != MovementType.Stand)
            {
                Mobile toFollow = null;

                if (m_Guard.Town != null && m_Guard.Orders.Movement == MovementType.Follow)
                {
                    toFollow = m_Guard.Orders.Follow;

                    if (toFollow == null)
                    {
                        toFollow = m_Guard.Town.Sheriff;
                    }
                }

                if (toFollow != null && toFollow.Map == m_Guard.Map && toFollow.InRange(m_Guard, m_Guard.RangePerception * 3) && Town.FromRegion(toFollow.Region) == m_Guard.Town)
                {
                    if (Action != ActionType.Combat)
                    {
                        Action = ActionType.Combat;
                    }

                    if (m_Mobile.CurrentSpeed != m_Mobile.ActiveSpeed)
                    {
                        m_Mobile.CurrentSpeed = m_Mobile.ActiveSpeed;
                    }

                    m_Guard.Warmode = true;

                    RunTo(toFollow);
                }
                else
                {
                    if (Action != ActionType.Wander)
                    {
                        Action = ActionType.Wander;
                    }

                    if (m_Mobile.CurrentSpeed != m_Mobile.PassiveSpeed)
                    {
                        m_Mobile.CurrentSpeed = m_Mobile.PassiveSpeed;
                    }

                    m_Guard.Warmode = false;

                    WalkRandomInHome(2, 2, 1);
                }
            }
            else
            {
                if (Action != ActionType.Wander)
                {
                    Action = ActionType.Wander;
                }

                m_Guard.Warmode = false;
            }

            if ((IsDamaged || IsPoisoned) && m_Guard.Skills.Healing.Base > 20.0)
            {
                TimeSpan ts = TimeUntilBandage;

                if (ts == TimeSpan.MaxValue)
                {
                    StartBandage();
                }
            }

            if (m_Mobile.Spell == null && DateTime.UtcNow >= m_Mobile.NextSpellTime)
            {
                Spell spell = null;

                DateTime toRelease = DateTime.MinValue;

                if (IsPoisoned)
                {
                    Poison p = m_Guard.Poison;

                    TimeSpan ts = TimeUntilBandage;

                    if (p != Poison.Lesser || ts == TimeSpan.MaxValue || TimeUntilBandage < TimeSpan.FromSeconds(1.5) || (m_Guard.HitsMax - m_Guard.Hits) > Utility.Random(250))
                    {
                        if (IsAllowed(GuardAI.Bless))
                        {
                            spell = new CureSpell(m_Guard, null);
                        }
                        else
                        {
                            UseItemByType(typeof(BaseCurePotion));
                        }
                    }
                }
                else if (IsDamaged && (m_Guard.HitsMax - m_Guard.Hits) > Utility.Random(200))
                {
                    if (IsAllowed(GuardAI.Magic) && ((m_Guard.Hits * 100) / Math.Max(m_Guard.HitsMax, 1)) < 10 && m_Guard.Home != Point3D.Zero && !Utility.InRange(m_Guard.Location, m_Guard.Home, 15) && m_Guard.Mana >= 11)
                    {
                        spell = new RecallSpell(m_Guard, null, new RunebookEntry(m_Guard.Home, m_Guard.Map, "Guard's Home", null, 0), null);
                    }
                    else if (IsAllowed(GuardAI.Bless))
                    {
                        if (m_Guard.Mana >= 11 && (m_Guard.Hits + 30) < m_Guard.HitsMax)
                        {
                            spell = new GreaterHealSpell(m_Guard, null);
                        }
                        else if ((m_Guard.Hits + 10) < m_Guard.HitsMax && (m_Guard.Mana < 11 || (m_Guard.NextCombatTime - DateTime.UtcNow) > TimeSpan.FromSeconds(2.0)))
                        {
                            spell = new HealSpell(m_Guard, null);
                        }
                    }
                    else if (m_Guard.CanBeginAction(typeof(BaseHealPotion)))
                    {
                        UseItemByType(typeof(BaseHealPotion));
                    }
                }
                else if (dispelTarget != null && (IsAllowed(GuardAI.Magic) || IsAllowed(GuardAI.Bless) || IsAllowed(GuardAI.Curse)))
                {
                    if (!dispelTarget.Paralyzed && m_Guard.Mana > (ManaReserve + 20) && 40 > Utility.Random(100))
                    {
                        spell = new ParalyzeSpell(m_Guard, null);
                    }
                    else
                    {
                        spell = new DispelSpell(m_Guard, null);
                    }
                }

                if (combatant != null)
                {
                    if (m_Combo != null)
                    {
                        if (spell == null)
                        {
                            spell = SpellCombo.Process(m_Guard, combatant, ref m_Combo, ref m_ComboIndex, ref toRelease);
                        }
                        else
                        {
                            m_Combo      = null;
                            m_ComboIndex = -1;
                        }
                    }
                    else if (20 > Utility.Random(100) && IsAllowed(GuardAI.Magic))
                    {
                        if (80 > Utility.Random(100))
                        {
                            m_Combo      = (IsAllowed(GuardAI.Smart) ? SpellCombo.Simple : SpellCombo.Strong);
                            m_ComboIndex = -1;

                            if (m_Guard.Mana >= (ManaReserve + m_Combo.Mana))
                            {
                                spell = SpellCombo.Process(m_Guard, combatant, ref m_Combo, ref m_ComboIndex, ref toRelease);
                            }
                            else
                            {
                                m_Combo = null;

                                if (m_Guard.Mana >= (ManaReserve + 40))
                                {
                                    spell = RandomOffenseSpell();
                                }
                            }
                        }
                        else if (m_Guard.Mana >= (ManaReserve + 40))
                        {
                            spell = RandomOffenseSpell();
                        }
                    }

                    if (spell == null && 2 > Utility.Random(100) && m_Guard.Mana >= (ManaReserve + 10))
                    {
                        int strMod = GetStatMod(m_Guard, StatType.Str);
                        int dexMod = GetStatMod(m_Guard, StatType.Dex);
                        int intMod = GetStatMod(m_Guard, StatType.Int);

                        List <Type> types = new List <Type>();

                        if (strMod <= 0)
                        {
                            types.Add(typeof(StrengthSpell));
                        }

                        if (dexMod <= 0 && IsAllowed(GuardAI.Melee))
                        {
                            types.Add(typeof(AgilitySpell));
                        }

                        if (intMod <= 0 && IsAllowed(GuardAI.Magic))
                        {
                            types.Add(typeof(CunningSpell));
                        }

                        if (IsAllowed(GuardAI.Bless))
                        {
                            if (types.Count > 1)
                            {
                                spell = new BlessSpell(m_Guard, null);
                            }
                            else if (types.Count == 1)
                            {
                                spell = (Spell)Activator.CreateInstance(types[0], new object[] { m_Guard, null });
                            }
                        }
                        else if (types.Count > 0)
                        {
                            if (types[0] == typeof(StrengthSpell))
                            {
                                UseItemByType(typeof(BaseStrengthPotion));
                            }
                            else if (types[0] == typeof(AgilitySpell))
                            {
                                UseItemByType(typeof(BaseAgilityPotion));
                            }
                        }
                    }

                    if (spell == null && 2 > Utility.Random(100) && m_Guard.Mana >= (ManaReserve + 10) && IsAllowed(GuardAI.Curse))
                    {
                        if (!combatant.Poisoned && 40 > Utility.Random(100))
                        {
                            spell = new PoisonSpell(m_Guard, null);
                        }
                        else
                        {
                            int strMod = GetStatMod(combatant, StatType.Str);
                            int dexMod = GetStatMod(combatant, StatType.Dex);
                            int intMod = GetStatMod(combatant, StatType.Int);

                            List <Type> types = new List <Type>();

                            if (strMod >= 0)
                            {
                                types.Add(typeof(WeakenSpell));
                            }

                            if (dexMod >= 0 && IsAllowed(GuardAI.Melee))
                            {
                                types.Add(typeof(ClumsySpell));
                            }

                            if (intMod >= 0 && IsAllowed(GuardAI.Magic))
                            {
                                types.Add(typeof(FeeblemindSpell));
                            }

                            if (types.Count > 1)
                            {
                                spell = new CurseSpell(m_Guard, null);
                            }
                            else if (types.Count == 1)
                            {
                                spell = (Spell)Activator.CreateInstance(types[0], new object[] { m_Guard, null });
                            }
                        }
                    }
                }

                if (spell != null && (m_Guard.HitsMax - m_Guard.Hits + 10) > Utility.Random(100))
                {
                    Type type = null;

                    if (spell is GreaterHealSpell)
                    {
                        type = typeof(BaseHealPotion);
                    }
                    else if (spell is CureSpell)
                    {
                        type = typeof(BaseCurePotion);
                    }
                    else if (spell is StrengthSpell)
                    {
                        type = typeof(BaseStrengthPotion);
                    }
                    else if (spell is AgilitySpell)
                    {
                        type = typeof(BaseAgilityPotion);
                    }

                    if (type == typeof(BaseHealPotion) && !m_Guard.CanBeginAction(type))
                    {
                        type = null;
                    }

                    if (type != null && m_Guard.Target == null && UseItemByType(type))
                    {
                        if (spell is GreaterHealSpell)
                        {
                            if ((m_Guard.Hits + 30) > m_Guard.HitsMax && (m_Guard.Hits + 10) < m_Guard.HitsMax)
                            {
                                spell = new HealSpell(m_Guard, null);
                            }
                        }
                        else
                        {
                            spell = null;
                        }
                    }
                }
                else if (spell == null && m_Guard.Stam < (m_Guard.StamMax / 3) && IsAllowed(GuardAI.Melee))
                {
                    UseItemByType(typeof(BaseRefreshPotion));
                }

                if (spell == null || !spell.Cast())
                {
                    EquipWeapon();
                }
            }
            else if (m_Mobile.Spell is Spell && ((Spell)m_Mobile.Spell).State == SpellState.Sequencing)
            {
                EquipWeapon();
            }

            return(true);
        }
コード例 #26
0
 public FactionBottleVendor(Town town, Faction faction) : base(town, faction, "the Bottle Seller")
 {
     SetSkill(SkillName.Alchemy, 85.0, 100.0);
     SetSkill(SkillName.TasteID, 65.0, 88.0);
 }
コード例 #27
0
 public StrongholdMonolith(Town town, Faction faction) : base(town, faction)
 {
 }
コード例 #28
0
		public BaseMonolith( Town town, Faction faction ) : base( 0x1183 )
		{
			Movable = false;
			Town = town;
			Faction = faction;

			Active = town == null || town.State.Active;

			m_Monoliths.Add( this );
		}
コード例 #29
0
        public FinanceGump(PlayerMobile from, Faction faction, Town town) : base(50, 50)
        {
            m_From    = from;
            m_Faction = faction;
            m_Town    = town;


            AddPage(0);

            AddBackground(0, 0, 320, 410, 5054);
            AddBackground(10, 10, 300, 390, 3000);

            #region General
            AddPage(1);

            AddHtmlLocalized(20, 30, 260, 25, 1011541, false, false);               // FINANCE MINISTER


            AddHtmlLocalized(55, 90, 200, 25, 1011539, false, false);               // CHANGE PRICES
            AddButton(20, 90, 4005, 4007, 0, GumpButtonType.Page, 2);

            AddHtmlLocalized(55, 120, 200, 25, 1011540, false, false);               // BUY SHOPKEEPERS
            AddButton(20, 120, 4005, 4007, 0, GumpButtonType.Page, 3);

            AddHtmlLocalized(55, 150, 200, 25, 1011495, false, false);               // VIEW FINANCES
            AddButton(20, 150, 4005, 4007, 0, GumpButtonType.Page, 4);

            AddHtmlLocalized(55, 360, 200, 25, 1011441, false, false);               // EXIT
            AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Reply, 0);
            #endregion

            #region Change Prices
            AddPage(2);

            AddHtmlLocalized(20, 30, 200, 25, 1011539, false, false);               // CHANGE PRICES

            for (int i = 0; i < m_PriceOffsets.Length; ++i)
            {
                int ofs = m_PriceOffsets[i];

                int x = 20 + ((i / 6) * 150);
                int y = 90 + ((i % 6) * 30);

                AddRadio(x, y, 208, 209, (town.Tax == ofs), i + 1);

                if (ofs < 0)
                {
                    AddLabel(x + 35, y, 0x26, String.Concat("- ", -ofs, "%"));
                }
                else
                {
                    AddLabel(x + 35, y, 0x12A, String.Concat("+ ", ofs, "%"));
                }
            }

            AddRadio(20, 270, 208, 209, (town.Tax == 0), 0);
            AddHtmlLocalized(55, 270, 90, 25, 1011542, false, false);               // normal

            AddHtmlLocalized(55, 330, 200, 25, 1011509, false, false);              // Set Prices
            AddButton(20, 330, 4005, 4007, ToButtonID(0, 0), GumpButtonType.Reply, 0);

            AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false);               // Previous page
            AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
            #endregion

            #region Buy Shopkeepers
            AddPage(3);

            AddHtmlLocalized(20, 30, 200, 25, 1011540, false, false);               // BUY SHOPKEEPERS

            VendorListCollection vendorLists = town.VendorLists;

            for (int i = 0; i < vendorLists.Count; ++i)
            {
                VendorList list = vendorLists[i];

                AddButton(20, 90 + (i * 40), 4005, 4007, 0, GumpButtonType.Page, 5 + i);
                AddItem(55, 90 + (i * 40), list.Definition.ItemID);
                AddHtmlText(100, 90 + (i * 40), 200, 25, list.Definition.Label, false, false);
            }

            AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false);                  //	Previous page
            AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
            #endregion

            #region View Finances
            AddPage(4);

            int financeUpkeep = town.FinanceUpkeep;
            int sheriffUpkeep = town.SheriffUpkeep;
            int dailyIncome   = town.DailyIncome;
            int netCashFlow   = town.NetCashFlow;


            AddHtmlLocalized(20, 30, 300, 25, 1011524, false, false);               // FINANCE STATEMENT

            AddHtmlLocalized(20, 80, 300, 25, 1011538, false, false);               // Current total money for town :
            AddLabel(20, 100, 0x44, town.Silver.ToString());

            AddHtmlLocalized(20, 130, 300, 25, 1011520, false, false);           // Finance Minister Upkeep :
            AddLabel(20, 150, 0x44, financeUpkeep.ToString("N0"));               // NOTE: Added 'N0'

            AddHtmlLocalized(20, 180, 300, 25, 1011521, false, false);           // Sheriff Upkeep :
            AddLabel(20, 200, 0x44, sheriffUpkeep.ToString("N0"));               // NOTE: Added 'N0'

            AddHtmlLocalized(20, 230, 300, 25, 1011522, false, false);           // Town Income :
            AddLabel(20, 250, 0x44, dailyIncome.ToString("N0"));                 // NOTE: Added 'N0'

            AddHtmlLocalized(20, 280, 300, 25, 1011523, false, false);           // Net Cash flow per day :
            AddLabel(20, 300, 0x44, netCashFlow.ToString("N0"));                 // NOTE: Added 'N0'

            AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false);           // Previous page
            AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
            #endregion

            #region Shopkeeper Pages
            for (int i = 0; i < vendorLists.Count; ++i)
            {
                VendorList vendorList = vendorLists[i];

                AddPage(5 + i);

                AddHtmlText(60, 30, 300, 25, vendorList.Definition.Header, false, false);
                AddItem(20, 30, vendorList.Definition.ItemID);

                AddHtmlLocalized(20, 90, 200, 25, 1011514, false, false);                   // You have :
                AddLabel(230, 90, 0x26, vendorList.Vendors.Count.ToString());

                AddHtmlLocalized(20, 120, 200, 25, 1011515, false, false);                   // Maximum :
                AddLabel(230, 120, 0x256, vendorList.Definition.Maximum.ToString());

                AddHtmlLocalized(20, 150, 200, 25, 1011516, false, false);                // Cost :
                AddLabel(230, 150, 0x44, vendorList.Definition.Price.ToString("N0"));     // NOTE: Added 'N0'

                AddHtmlLocalized(20, 180, 200, 25, 1011517, false, false);                // Daily Pay :
                AddLabel(230, 180, 0x37, vendorList.Definition.Upkeep.ToString("N0"));    // NOTE: Added 'N0'

                AddHtmlLocalized(20, 210, 200, 25, 1011518, false, false);                // Current Silver :
                AddLabel(230, 210, 0x44, town.Silver.ToString("N0"));                     // NOTE: Added 'N0'

                AddHtmlLocalized(20, 240, 200, 25, 1011519, false, false);                // Current Payroll :
                AddLabel(230, 240, 0x44, financeUpkeep.ToString("N0"));                   // NOTE: Added 'N0'

                AddHtmlText(55, 300, 200, 25, vendorList.Definition.Label, false, false);
                if (town.Silver >= vendorList.Definition.Price)
                {
                    AddButton(20, 300, 4005, 4007, ToButtonID(1, i), GumpButtonType.Reply, 0);
                }
                else
                {
                    AddImage(20, 300, 4020);
                }

                AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false);                   // Previous page
                AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 3);
            }
            #endregion
        }
コード例 #30
0
        public SheriffGump(PlayerMobile from, Faction faction, Town town) : base(50, 50)
        {
            m_From    = from;
            m_Faction = faction;
            m_Town    = town;


            AddPage(0);

            AddBackground(0, 0, 320, 410, 5054);
            AddBackground(10, 10, 300, 390, 3000);

            #region General
            AddPage(1);

            AddHtmlLocalized(20, 30, 260, 25, 1011431, false, false);               // Sheriff

            AddHtmlLocalized(55, 90, 200, 25, 1011494, false, false);               // HIRE GUARDS
            AddButton(20, 90, 4005, 4007, 0, GumpButtonType.Page, 3);

            AddHtmlLocalized(55, 120, 200, 25, 1011495, false, false);               // VIEW FINANCES
            AddButton(20, 120, 4005, 4007, 0, GumpButtonType.Page, 2);

            AddHtmlLocalized(55, 360, 200, 25, 1011441, false, false);               // Exit
            AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Reply, 0);
            #endregion

            #region Finances
            AddPage(2);

            int financeUpkeep = town.FinanceUpkeep;
            int sheriffUpkeep = town.SheriffUpkeep;
            int dailyIncome   = town.DailyIncome;
            int netCashFlow   = town.NetCashFlow;

            AddHtmlLocalized(20, 30, 300, 25, 1011524, false, false);            // FINANCE STATEMENT

            AddHtmlLocalized(20, 80, 300, 25, 1011538, false, false);            // Current total money for town :
            AddLabel(20, 100, 0x44, town.Silver.ToString("N0"));                 // NOTE: Added 'N0'

            AddHtmlLocalized(20, 130, 300, 25, 1011520, false, false);           // Finance Minister Upkeep :
            AddLabel(20, 150, 0x44, financeUpkeep.ToString("N0"));               // NOTE: Added 'N0'

            AddHtmlLocalized(20, 180, 300, 25, 1011521, false, false);           // Sheriff Upkeep :
            AddLabel(20, 200, 0x44, sheriffUpkeep.ToString("N0"));               // NOTE: Added 'N0'

            AddHtmlLocalized(20, 230, 300, 25, 1011522, false, false);           // Town Income :
            AddLabel(20, 250, 0x44, dailyIncome.ToString("N0"));                 // NOTE: Added 'N0'

            AddHtmlLocalized(20, 280, 300, 25, 1011523, false, false);           // Net Cash flow per day :
            AddLabel(20, 300, 0x44, netCashFlow.ToString("N0"));                 // NOTE: Added 'N0'

            AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false);           // Previous page
            AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
            #endregion

            #region Hire Guards
            AddPage(3);

            AddHtmlLocalized(20, 30, 300, 25, 1011494, false, false);               // HIRE GUARDS

            List <GuardList> guardLists = town.GuardLists;

            for (int i = 0; i < guardLists.Count; ++i)
            {
                GuardList guardList = guardLists[i];
                int       y         = 90 + (i * 60);

                AddButton(20, y, 4005, 4007, 0, GumpButtonType.Page, 4 + i);
                CenterItem(guardList.Definition.ItemID, 50, y - 20, 70, 60);
                AddHtmlText(120, y, 200, 25, guardList.Definition.Header, false, false);
            }

            AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false);               // Previous page
            AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
            #endregion

            #region Guard Pages
            for (int i = 0; i < guardLists.Count; ++i)
            {
                GuardList guardList = guardLists[i];

                AddPage(4 + i);

                AddHtmlText(90, 30, 300, 25, guardList.Definition.Header, false, false);
                CenterItem(guardList.Definition.ItemID, 10, 10, 80, 80);

                AddHtmlLocalized(20, 90, 200, 25, 1011514, false, false);                   // You have :
                AddLabel(230, 90, 0x26, guardList.Guards.Count.ToString());

                AddHtmlLocalized(20, 120, 200, 25, 1011515, false, false);                   // Maximum :
                AddLabel(230, 120, 0x12A, guardList.Definition.Maximum.ToString());

                AddHtmlLocalized(20, 150, 200, 25, 1011516, false, false);                // Cost :
                AddLabel(230, 150, 0x44, guardList.Definition.Price.ToString("N0"));      // NOTE: Added 'N0'

                AddHtmlLocalized(20, 180, 200, 25, 1011517, false, false);                // Daily Pay :
                AddLabel(230, 180, 0x37, guardList.Definition.Upkeep.ToString("N0"));     // NOTE: Added 'N0'

                AddHtmlLocalized(20, 210, 200, 25, 1011518, false, false);                // Current Silver :
                AddLabel(230, 210, 0x44, town.Silver.ToString("N0"));                     // NOTE: Added 'N0'

                AddHtmlLocalized(20, 240, 200, 25, 1011519, false, false);                // Current Payroll :
                AddLabel(230, 240, 0x44, sheriffUpkeep.ToString("N0"));                   // NOTE: Added 'N0'

                AddHtmlText(55, 300, 200, 25, guardList.Definition.Label, false, false);
                AddButton(20, 300, 4005, 4007, 1 + i, GumpButtonType.Reply, 0);

                AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false);                   // Previous page
                AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 3);
            }
            #endregion
        }
コード例 #31
0
ファイル: TownState.cs プロジェクト: silky/ModernUO
 public TownState(Town town) => Town = town;
コード例 #32
0
ファイル: TownState.cs プロジェクト: FreeReign/forkuo
 public TownState(Town town)
 {
     this.m_Town = town;
 }
コード例 #33
0
        public FactionStoneGump(PlayerMobile from, Faction faction) : base(20, 30)
        {
            m_From    = from;
            m_Faction = faction;

            AddPage(0);

            AddBackground(0, 0, 550, 440, 5054);
            AddBackground(10, 10, 530, 420, 3000);

            #region General
            AddPage(1);

            AddHtmlText(20, 30, 510, 20, faction.Definition.Header, false, false);

            AddHtmlLocalized(20, 60, 100, 20, 1011429, false, false);               // Led By :
            AddHtml(125, 60, 200, 20, faction.Commander != null ? faction.Commander.Name : "Nobody", false, false);

            AddHtmlLocalized(20, 80, 100, 20, 1011457, false, false);               // Tithe rate :
            if (faction.Tithe >= 0 && faction.Tithe <= 100 && (faction.Tithe % 10) == 0)
            {
                AddHtmlLocalized(125, 80, 350, 20, 1011480 + (faction.Tithe / 10), false, false);
            }
            else
            {
                AddHtml(125, 80, 350, 20, faction.Tithe + "%", false, false);
            }

            AddHtmlLocalized(20, 100, 100, 20, 1011458, false, false);               // Traps placed :
            AddHtml(125, 100, 50, 20, faction.Traps.Count.ToString(), false, false);

            AddHtmlLocalized(55, 225, 200, 20, 1011428, false, false);               // VOTE FOR LEADERSHIP
            AddButton(20, 225, 4005, 4007, ToButtonID(0, 0), GumpButtonType.Reply, 0);

            AddHtmlLocalized(55, 150, 100, 20, 1011430, false, false);               // CITY STATUS
            AddButton(20, 150, 4005, 4007, 0, GumpButtonType.Page, 2);

            AddHtmlLocalized(55, 175, 100, 20, 1011444, false, false);               // STATISTICS
            AddButton(20, 175, 4005, 4007, 0, GumpButtonType.Page, 4);

            bool isMerchantQualified = MerchantTitles.HasMerchantQualifications(from);

            PlayerState pl = PlayerState.Find(from);

            if (pl != null && pl.MerchantTitle != MerchantTitle.None)
            {
                AddHtmlLocalized(55, 200, 250, 20, 1011460, false, false);                   // UNDECLARE FACTION MERCHANT
                AddButton(20, 200, 4005, 4007, ToButtonID(1, 0), GumpButtonType.Reply, 0);
            }
            else if (isMerchantQualified)
            {
                AddHtmlLocalized(55, 200, 250, 20, 1011459, false, false);                   // DECLARE FACTION MERCHANT
                AddButton(20, 200, 4005, 4007, 0, GumpButtonType.Page, 5);
            }
            else
            {
                AddHtmlLocalized(55, 200, 250, 20, 1011467, false, false);                   // MERCHANT OPTIONS
                AddImage(20, 200, 4020);
            }

            AddHtmlLocalized(55, 250, 300, 20, 1011461, false, false);               // COMMANDER OPTIONS
            if (faction.IsCommander(from))
            {
                AddButton(20, 250, 4005, 4007, 0, GumpButtonType.Page, 6);
            }
            else
            {
                AddImage(20, 250, 4020);
            }

            AddHtmlLocalized(55, 275, 300, 20, 1011426, false, false);               // LEAVE THIS FACTION
            AddButton(20, 275, 4005, 4007, ToButtonID(0, 1), GumpButtonType.Reply, 0);

            AddHtmlLocalized(55, 300, 200, 20, 1011441, false, false);               // EXIT
            AddButton(20, 300, 4005, 4007, 0, GumpButtonType.Reply, 0);
            #endregion

            #region City Status
            AddPage(2);

            AddHtmlLocalized(20, 30, 250, 20, 1011430, false, false);               // CITY STATUS

            TownCollection towns = Town.Towns;

            for (int i = 0; i < towns.Count; ++i)
            {
                Town town = towns[i];

                AddHtmlText(40, 55 + (i * 30), 150, 20, town.Definition.TownName, false, false);

                if (town.Owner == null)
                {
                    AddHtmlLocalized(200, 55 + (i * 30), 150, 20, 1011462, false, false);                       // : Neutral
                }
                else
                {
                    AddHtmlLocalized(200, 55 + (i * 30), 150, 20, town.Owner.Definition.OwnerLabel, false, false);

                    BaseMonolith monolith = town.Monolith;

                    AddImage(20, 60 + (i * 30), (monolith != null && monolith.Sigil != null && monolith.Sigil.IsPurifying) ? 0x938 : 0x939);
                }
            }


            AddImage(20, 300, 2361);
            AddHtmlLocalized(45, 295, 300, 20, 1011491, false, false);               // sigil may be recaptured

            AddImage(20, 320, 2360);
            AddHtmlLocalized(45, 315, 300, 20, 1011492, false, false);               // sigil may not be recaptured

            AddHtmlLocalized(55, 350, 100, 20, 1011447, false, false);               // BACK
            AddButton(20, 350, 4005, 4007, 0, GumpButtonType.Page, 1);
            #endregion

            #region Statistics
            AddPage(4);

            AddHtmlLocalized(20, 30, 150, 20, 1011444, false, false);               // STATISTICS

            AddHtmlLocalized(20, 100, 100, 20, 1011445, false, false);              // Name :
            AddHtml(120, 100, 150, 20, from.Name, false, false);

            AddHtmlLocalized(20, 130, 100, 20, 1018064, false, false);               // score :
            AddHtml(120, 130, 100, 20, (pl != null ? pl.KillPoints : 0).ToString(), false, false);

            AddHtmlLocalized(20, 160, 100, 20, 1011446, false, false);               // Rank :
            AddHtml(120, 160, 100, 20, (pl != null ? pl.Rank.Rank : 0).ToString(), false, false);

            AddHtmlLocalized(55, 250, 100, 20, 1011447, false, false);               // BACK
            AddButton(20, 250, 4005, 4007, 0, GumpButtonType.Page, 1);
            #endregion

            #region Merchant Options
            if ((pl == null || pl.MerchantTitle == MerchantTitle.None) && isMerchantQualified)
            {
                AddPage(5);

                AddHtmlLocalized(20, 30, 250, 20, 1011467, false, false);                   // MERCHANT OPTIONS

                AddHtmlLocalized(20, 80, 300, 20, 1011473, false, false);                   // Select the title you wish to display

                MerchantTitleInfo[] infos = MerchantTitles.Info;

                for (int i = 0; i < infos.Length; ++i)
                {
                    MerchantTitleInfo info = infos[i];

                    if (MerchantTitles.IsQualified(from, info))
                    {
                        AddButton(20, 100 + (i * 30), 4005, 4007, ToButtonID(1, i + 1), GumpButtonType.Reply, 0);
                    }
                    else
                    {
                        AddImage(20, 100 + (i * 30), 4020);
                    }

                    AddHtmlText(55, 100 + (i * 30), 200, 20, info.Label, false, false);
                }

                AddHtmlLocalized(55, 340, 100, 20, 1011447, false, false);                   // BACK
                AddButton(20, 340, 4005, 4007, 0, GumpButtonType.Page, 1);
            }
            #endregion

            #region Commander Options
            if (faction.IsCommander(from))
            {
                #region General
                AddPage(6);

                AddHtmlLocalized(20, 30, 200, 20, 1011461, false, false);                   // COMMANDER OPTIONS

                AddHtmlLocalized(20, 70, 120, 20, 1011457, false, false);                   // Tithe rate :
                if (faction.Tithe >= 0 && faction.Tithe <= 100 && (faction.Tithe % 10) == 0)
                {
                    AddHtmlLocalized(140, 70, 250, 20, 1011480 + (faction.Tithe / 10), false, false);
                }
                else
                {
                    AddHtml(140, 70, 250, 20, faction.Tithe + "%", false, false);
                }

                AddHtmlLocalized(20, 100, 120, 20, 1011474, false, false);                   // Silver available :
                AddHtml(140, 100, 50, 20, faction.Silver.ToString("N0"), false, false);      // NOTE: Added 'N0' formatting

                AddHtmlLocalized(55, 130, 200, 20, 1011478, false, false);                   // CHANGE TITHE RATE
                AddButton(20, 130, 4005, 4007, 0, GumpButtonType.Page, 8);

                AddHtmlLocalized(55, 160, 200, 20, 1018301, false, false);                   // TRANSFER SILVER
                if (faction.Silver >= 10000)
                {
                    AddButton(20, 160, 4005, 4007, 0, GumpButtonType.Page, 7);
                }
                else
                {
                    AddImage(20, 160, 4020);
                }

                AddHtmlLocalized(55, 310, 100, 20, 1011447, false, false);                   // BACK
                AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1);
                #endregion

                #region Town Finance
                if (faction.Silver >= 10000)
                {
                    AddPage(7);

                    AddHtmlLocalized(20, 30, 250, 20, 1011476, false, false);                       // TOWN FINANCE

                    AddHtmlLocalized(20, 50, 400, 20, 1011477, false, false);                       // Select a town to transfer 10000 silver to

                    for (int i = 0; i < towns.Count; ++i)
                    {
                        Town town = towns[i];

                        AddHtmlText(55, 75 + (i * 30), 200, 20, town.Definition.TownName, false, false);

                        if (town.Owner == faction)
                        {
                            AddButton(20, 75 + (i * 30), 4005, 4007, ToButtonID(2, i), GumpButtonType.Reply, 0);
                        }
                        else
                        {
                            AddImage(20, 75 + (i * 30), 4020);
                        }
                    }

                    AddHtmlLocalized(55, 310, 100, 20, 1011447, false, false);                       // BACK
                    AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1);
                }
                #endregion

                #region Change Tithe Rate
                AddPage(8);

                AddHtmlLocalized(20, 30, 400, 20, 1011479, false, false);                   // Select the % for the new tithe rate

                int y = 55;

                for (int i = 0; i <= 10; ++i)
                {
                    if (i == 5)
                    {
                        y += 5;
                    }

                    AddHtmlLocalized(55, y, 300, 20, 1011480 + i, false, false);
                    AddButton(20, y, 4005, 4007, ToButtonID(3, i), GumpButtonType.Reply, 0);

                    y += 20;

                    if (i == 5)
                    {
                        y += 5;
                    }
                }

                AddHtmlLocalized(55, 310, 300, 20, 1011447, false, false);                   // BACK
                AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1);
                #endregion
            }
            #endregion
        }
コード例 #34
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                {
                    Town = Town.ReadReference( reader );
                    Faction = Faction.ReadReference( reader );
                    m_Sigil = reader.ReadItem() as Sigil;
                    break;
                }
            }

            Visible = false; //disable
        }
コード例 #35
0
ファイル: SheriffGump.cs プロジェクト: Crome696/ServUO
        public SheriffGump(PlayerMobile from, Faction faction, Town town)
            : base(50, 50)
        {
            this.m_From = from;
            this.m_Faction = faction;
            this.m_Town = town;

            this.AddPage(0);

            this.AddBackground(0, 0, 320, 410, 5054);
            this.AddBackground(10, 10, 300, 390, 3000);

            #region General
            this.AddPage(1);

            this.AddHtmlLocalized(20, 30, 260, 25, 1011431, false, false); // Sheriff

            this.AddHtmlLocalized(55, 90, 200, 25, 1011494, false, false); // HIRE GUARDS
            this.AddButton(20, 90, 4005, 4007, 0, GumpButtonType.Page, 3);

            this.AddHtmlLocalized(55, 120, 200, 25, 1011495, false, false); // VIEW FINANCES
            this.AddButton(20, 120, 4005, 4007, 0, GumpButtonType.Page, 2);

            this.AddHtmlLocalized(55, 360, 200, 25, 1011441, false, false); // Exit
            this.AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Reply, 0);
            #endregion

            #region Finances
            this.AddPage(2);

            int financeUpkeep = town.FinanceUpkeep;
            int sheriffUpkeep = town.SheriffUpkeep;
            int dailyIncome = town.DailyIncome;
            int netCashFlow = town.NetCashFlow;

            this.AddHtmlLocalized(20, 30, 300, 25, 1011524, false, false); // FINANCE STATEMENT
			
            this.AddHtmlLocalized(20, 80, 300, 25, 1011538, false, false); // Current total money for town : 
            this.AddLabel(20, 100, 0x44, town.Silver.ToString("N0")); // NOTE: Added 'N0'

            this.AddHtmlLocalized(20, 130, 300, 25, 1011520, false, false); // Finance Minister Upkeep : 
            this.AddLabel(20, 150, 0x44, financeUpkeep.ToString("N0")); // NOTE: Added 'N0'
	
            this.AddHtmlLocalized(20, 180, 300, 25, 1011521, false, false); // Sheriff Upkeep : 
            this.AddLabel(20, 200, 0x44, sheriffUpkeep.ToString("N0")); // NOTE: Added 'N0'

            this.AddHtmlLocalized(20, 230, 300, 25, 1011522, false, false); // Town Income : 
            this.AddLabel(20, 250, 0x44, dailyIncome.ToString("N0")); // NOTE: Added 'N0'

            this.AddHtmlLocalized(20, 280, 300, 25, 1011523, false, false); // Net Cash flow per day : 
            this.AddLabel(20, 300, 0x44, netCashFlow.ToString("N0")); // NOTE: Added 'N0'

            this.AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
            this.AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
            #endregion

            #region Hire Guards
            this.AddPage(3);

            this.AddHtmlLocalized(20, 30, 300, 25, 1011494, false, false); // HIRE GUARDS

            List<GuardList> guardLists = town.GuardLists;

            for (int i = 0; i < guardLists.Count; ++i)
            {
                GuardList guardList = guardLists[i];
                int y = 90 + (i * 60);

                this.AddButton(20, y, 4005, 4007, 0, GumpButtonType.Page, 4 + i);
                this.CenterItem(guardList.Definition.ItemID, 50, y - 20, 70, 60);
                this.AddHtmlText(120, y, 200, 25, guardList.Definition.Header, false, false);
            }

            this.AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
            this.AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
            #endregion

            #region Guard Pages
            for (int i = 0; i < guardLists.Count; ++i)
            {
                GuardList guardList = guardLists[i];

                this.AddPage(4 + i);

                this.AddHtmlText(90, 30, 300, 25, guardList.Definition.Header, false, false);
                this.CenterItem(guardList.Definition.ItemID, 10, 10, 80, 80);

                this.AddHtmlLocalized(20, 90, 200, 25, 1011514, false, false); // You have : 
                this.AddLabel(230, 90, 0x26, guardList.Guards.Count.ToString());

                this.AddHtmlLocalized(20, 120, 200, 25, 1011515, false, false); // Maximum : 
                this.AddLabel(230, 120, 0x12A, guardList.Definition.Maximum.ToString());

                this.AddHtmlLocalized(20, 150, 200, 25, 1011516, false, false); // Cost : 
                this.AddLabel(230, 150, 0x44, guardList.Definition.Price.ToString("N0")); // NOTE: Added 'N0'

                this.AddHtmlLocalized(20, 180, 200, 25, 1011517, false, false); // Daily Pay :
                this.AddLabel(230, 180, 0x37, guardList.Definition.Upkeep.ToString("N0")); // NOTE: Added 'N0'

                this.AddHtmlLocalized(20, 210, 200, 25, 1011518, false, false); // Current Silver : 
                this.AddLabel(230, 210, 0x44, town.Silver.ToString("N0")); // NOTE: Added 'N0'

                this.AddHtmlLocalized(20, 240, 200, 25, 1011519, false, false); // Current Payroll : 
                this.AddLabel(230, 240, 0x44, sheriffUpkeep.ToString("N0")); // NOTE: Added 'N0'

                this.AddHtmlText(55, 300, 200, 25, guardList.Definition.Label, false, false);
                this.AddButton(20, 300, 4005, 4007, 1 + i, GumpButtonType.Reply, 0);

                this.AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
                this.AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 3);
            }
            #endregion
        }
コード例 #36
0
 public TownStone(Town town)
     : base(0xEDE)
 {
     this.Movable = false;
     this.Town    = town;
 }
コード例 #37
0
 public TownStone(Town town = null) : base(0xEDE)
 {
     Movable = false;
     Town    = town;
 }
コード例 #38
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            /*int version = */reader.ReadInt();

            m_Faction = Faction.ReadReference( reader );
            m_Town = Town.ReadReference( reader );
            m_Orders = new Orders( this, reader );

            Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Register ) );
        }
コード例 #39
0
ファイル: VendorList.cs プロジェクト: rberiot/imaginenation
 public BaseFactionVendor Construct(Town town, Faction faction)
 {
     try{ return(Activator.CreateInstance(m_Definition.Type, new object[] { town, faction }) as BaseFactionVendor); }
     catch { return(null); }
 }
コード例 #40
0
ファイル: TownMonolith.cs プロジェクト: xrunuo/xrunuo
		public TownMonolith( Town town )
			: base( town, null )
		{
		}
コード例 #41
0
        public static void WriteReference(GenericWriter writer, Town town)
        {
            int idx = Towns.IndexOf(town);

            writer.WriteEncodedInt((int)(idx + 1));
        }
コード例 #42
0
ファイル: FinanceGump.cs プロジェクト: nathanvy/runuo
		public FinanceGump( PlayerMobile from, Faction faction, Town town ) : base( 50, 50 )
		{
			m_From = from;
			m_Faction = faction;
			m_Town = town;


			AddPage( 0 );

			AddBackground( 0, 0, 320, 410, 5054 );
			AddBackground( 10, 10, 300, 390, 3000 );

			#region General
			AddPage( 1 );

			AddHtmlLocalized( 20, 30, 260, 25, 1011541, false, false ); // FINANCE MINISTER


			AddHtmlLocalized( 55, 90, 200, 25, 1011539, false, false ); // CHANGE PRICES
			AddButton( 20, 90, 4005, 4007, 0, GumpButtonType.Page, 2 );

			AddHtmlLocalized( 55, 120, 200, 25, 1011540, false, false ); // BUY SHOPKEEPERS	
			AddButton( 20, 120, 4005, 4007, 0, GumpButtonType.Page, 3 );

			AddHtmlLocalized( 55, 150, 200, 25, 1011495, false, false ); // VIEW FINANCES
			AddButton( 20, 150, 4005, 4007, 0, GumpButtonType.Page, 4 );

			AddHtmlLocalized( 55, 360, 200, 25, 1011441, false, false ); // EXIT
			AddButton( 20, 360, 4005, 4007, 0, GumpButtonType.Reply, 0 );
			#endregion

			#region Change Prices
			AddPage( 2 );

			AddHtmlLocalized( 20, 30, 200, 25, 1011539, false, false ); // CHANGE PRICES

			for ( int i = 0; i < m_PriceOffsets.Length; ++i )
			{
				int ofs = m_PriceOffsets[i];

				int x = 20 + ((i / 6) * 150);
				int y = 90 + ((i % 6) * 30);

				AddRadio( x, y, 208, 209, ( town.Tax == ofs ), i+1 );

				if ( ofs < 0 )
					AddLabel( x + 35, y, 0x26, String.Concat( "- ", -ofs, "%" ) );
				else
					AddLabel( x + 35, y, 0x12A, String.Concat( "+ ", ofs, "%" ) );
			}

			AddRadio( 20, 270, 208, 209, ( town.Tax == 0 ), 0 );
			AddHtmlLocalized( 55, 270, 90, 25, 1011542, false, false ); // normal

			AddHtmlLocalized( 55, 330, 200, 25, 1011509, false, false ); // Set Prices
			AddButton( 20, 330, 4005, 4007, ToButtonID( 0, 0 ), GumpButtonType.Reply, 0 );

			AddHtmlLocalized( 55, 360, 200, 25, 1011067, false, false ); // Previous page
			AddButton( 20, 360, 4005, 4007, 0, GumpButtonType.Page, 1 );
			#endregion

			#region Buy Shopkeepers
			AddPage( 3 );

			AddHtmlLocalized( 20, 30, 200, 25, 1011540, false, false ); // BUY SHOPKEEPERS

			List<VendorList> vendorLists = town.VendorLists;

			for ( int i = 0; i < vendorLists.Count; ++i )
			{
				VendorList list = vendorLists[i];

				AddButton( 20, 90 + (i * 40), 4005, 4007, 0, GumpButtonType.Page, 5 + i );
				AddItem( 55, 90 + (i * 40), list.Definition.ItemID );
				AddHtmlText( 100, 90 + (i * 40), 200, 25, list.Definition.Label, false, false );
			}

			AddHtmlLocalized( 55, 360, 200, 25, 1011067, false, false );	//	Previous page
			AddButton( 20, 360, 4005, 4007, 0, GumpButtonType.Page, 1 );
			#endregion

			#region View Finances
			AddPage( 4 );

			int financeUpkeep = town.FinanceUpkeep;
			int sheriffUpkeep = town.SheriffUpkeep;
			int dailyIncome = town.DailyIncome;
			int netCashFlow = town.NetCashFlow;


			AddHtmlLocalized( 20, 30, 300, 25, 1011524, false, false ); // FINANCE STATEMENT
	
			AddHtmlLocalized( 20, 80, 300, 25, 1011538, false, false ); // Current total money for town : 
			AddLabel( 20, 100, 0x44, town.Silver.ToString() );

			AddHtmlLocalized( 20, 130, 300, 25, 1011520, false, false ); // Finance Minister Upkeep : 
			AddLabel( 20, 150, 0x44, financeUpkeep.ToString( "N0" ) ); // NOTE: Added 'N0'

			AddHtmlLocalized( 20, 180, 300, 25, 1011521, false, false ); // Sheriff Upkeep : 
			AddLabel( 20, 200, 0x44, sheriffUpkeep.ToString( "N0" ) ); // NOTE: Added 'N0'

			AddHtmlLocalized( 20, 230, 300, 25, 1011522, false, false ); // Town Income : 
			AddLabel( 20, 250, 0x44, dailyIncome.ToString( "N0" ) ); // NOTE: Added 'N0'

			AddHtmlLocalized( 20, 280, 300, 25, 1011523, false, false ); // Net Cash flow per day : 
			AddLabel( 20, 300, 0x44, netCashFlow.ToString( "N0" ) ); // NOTE: Added 'N0'

			AddHtmlLocalized( 55, 360, 200, 25, 1011067, false, false ); // Previous page
			AddButton( 20, 360, 4005, 4007, 0, GumpButtonType.Page, 1 );
			#endregion

			#region Shopkeeper Pages
			for ( int i = 0; i < vendorLists.Count; ++i )
			{
				VendorList vendorList = vendorLists[i];

				AddPage( 5 + i );

				AddHtmlText( 60, 30, 300, 25, vendorList.Definition.Header, false, false );
				AddItem( 20, 30, vendorList.Definition.ItemID );

				AddHtmlLocalized( 20, 90, 200, 25, 1011514, false, false ); // You have : 
				AddLabel( 230, 90, 0x26, vendorList.Vendors.Count.ToString() );

				AddHtmlLocalized( 20, 120, 200, 25, 1011515, false, false ); // Maximum : 
				AddLabel( 230, 120, 0x256, vendorList.Definition.Maximum.ToString() );

				AddHtmlLocalized( 20, 150, 200, 25, 1011516, false, false ); // Cost :
				AddLabel( 230, 150, 0x44, vendorList.Definition.Price.ToString( "N0" ) ); // NOTE: Added 'N0'

				AddHtmlLocalized( 20, 180, 200, 25, 1011517, false, false ); // Daily Pay :
				AddLabel( 230, 180, 0x37, vendorList.Definition.Upkeep.ToString( "N0" ) ); // NOTE: Added 'N0'

				AddHtmlLocalized( 20, 210, 200, 25, 1011518, false, false ); // Current Silver :
				AddLabel( 230, 210, 0x44, town.Silver.ToString( "N0" ) ); // NOTE: Added 'N0'

				AddHtmlLocalized( 20, 240, 200, 25, 1011519, false, false ); // Current Payroll :
				AddLabel( 230, 240, 0x44, financeUpkeep.ToString( "N0" ) ); // NOTE: Added 'N0'

				AddHtmlText( 55, 300, 200, 25, vendorList.Definition.Label, false, false );
				if ( town.Silver >= vendorList.Definition.Price )
					AddButton( 20, 300, 4005, 4007, ToButtonID( 1, i ), GumpButtonType.Reply, 0 );
				else
					AddImage( 20, 300, 4020 );

				AddHtmlLocalized( 55, 360, 200, 25, 1011067, false, false ); // Previous page
				AddButton( 20, 360, 4005, 4007, 0, GumpButtonType.Page, 3 );
			}
			#endregion
		}
コード例 #43
0
        private static void EventSink_Speech(SpeechEventArgs e)
        {
            Mobile from = e.Mobile;

            int[] keywords = e.Keywords;

            for (int i = 0; i < keywords.Length; ++i)
            {
                switch (keywords[i])
                {
                case 0x00E4:                         // *i wish to access the city treasury*
                {
                    Town town = Town.FromRegion(from.Region);

                    if (town == null || !town.IsFinance(from) || !from.Alive)
                    {
                        break;
                    }

                    if (FactionGump.Exists(from))
                    {
                        from.SendLocalizedMessage(1042160);                                         // You already have a faction menu open.
                    }
                    else if (town.Owner != null && from is PlayerMobile)
                    {
                        from.SendGump(new FinanceGump((PlayerMobile)from, town.Owner, town));
                    }

                    break;
                }

                case 0x0ED:                         // *i am sheriff*
                {
                    Town town = Town.FromRegion(from.Region);

                    if (town == null || !town.IsSheriff(from) || !from.Alive)
                    {
                        break;
                    }

                    if (FactionGump.Exists(from))
                    {
                        from.SendLocalizedMessage(1042160);                                         // You already have a faction menu open.
                    }
                    else if (town.Owner != null)
                    {
                        from.SendGump(new SheriffGump((PlayerMobile)from, town.Owner, town));
                    }

                    break;
                }

                case 0x00EF:                         // *you are fired*
                {
                    Town town = Town.FromRegion(from.Region);

                    if (town == null)
                    {
                        break;
                    }

                    if (town.IsFinance(from) || town.IsSheriff(from))
                    {
                        town.BeginOrderFiring(from);
                    }

                    break;
                }

                case 0x00E5:                         // *i wish to resign as finance minister*
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null && pl.Finance != null)
                    {
                        pl.Finance.Finance = null;
                        from.SendLocalizedMessage(1005081);                                         // You have been fired as Finance Minister
                    }

                    break;
                }

                case 0x00EE:                         // *i wish to resign as sheriff*
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null && pl.Sheriff != null)
                    {
                        pl.Sheriff.Sheriff = null;
                        from.SendLocalizedMessage(1010270);                                         // You have been fired as Sheriff
                    }

                    break;
                }

                case 0x00E9:                         // *what is my faction term status*
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null && pl.IsLeaving)
                    {
                        if (Faction.CheckLeaveTimer(from))
                        {
                            break;
                        }

                        TimeSpan remaining = (pl.Leaving + Faction.LeavePeriod) - DateTime.UtcNow;

                        if (remaining.TotalDays >= 1)
                        {
                            from.SendLocalizedMessage(1042743, remaining.TotalDays.ToString("N0"));                                            // Your term of service will come to an end in ~1_DAYS~ days.
                        }
                        else if (remaining.TotalHours >= 1)
                        {
                            from.SendLocalizedMessage(1042741, remaining.TotalHours.ToString("N0"));                                             // Your term of service will come to an end in ~1_HOURS~ hours.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042742);                                             // Your term of service will come to an end in less than one hour.
                        }
                    }
                    else if (pl != null)
                    {
                        from.SendLocalizedMessage(1042233);                                         // You are not in the process of quitting the faction.
                    }

                    break;
                }

                case 0x00EA:                         // *message faction*
                {
                    Faction faction = Faction.Find(from);

                    if (faction == null || !faction.IsCommander(from))
                    {
                        break;
                    }

                    if (from.AccessLevel == AccessLevel.Player && !faction.FactionMessageReady)
                    {
                        from.SendLocalizedMessage(1010264);                                         // The required time has not yet passed since the last message was sent
                    }
                    else
                    {
                        faction.BeginBroadcast(from);
                    }

                    break;
                }

                case 0x00EC:                         // *showscore*
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null)
                    {
                        Timer.DelayCall(TimeSpan.Zero, new TimerStateCallback(ShowScore_Sandbox), pl);
                    }

                    break;
                }

                case 0x0178:                         // i honor your leadership
                {
                    Faction faction = Faction.Find(from);

                    if (faction != null)
                    {
                        faction.BeginHonorLeadership(from);
                    }

                    break;
                }
                }
            }
        }
コード例 #44
0
 public TownState(Town town)
 {
     this.m_Town = town;
 }
コード例 #45
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int type, index;

            if (!FromButtonID(info.ButtonID, out type, out index))
            {
                return;
            }

            switch (type)
            {
            case 0:                     // general
            {
                switch (index)
                {
                case 0:                                 // vote
                {
                    m_From.SendGump(new ElectionGump(m_From, m_Faction.Election));
                    break;
                }

                case 1:                                 // leave
                {
                    m_From.SendGump(new LeaveFactionGump(m_From, m_Faction));
                    break;
                }
                }

                break;
            }

            case 1:                     // merchant title
            {
                if (index >= 0 && index <= MerchantTitles.Info.Length)
                {
                    PlayerState pl = PlayerState.Find(m_From);

                    MerchantTitle     newTitle = (MerchantTitle)index;
                    MerchantTitleInfo mti      = MerchantTitles.GetInfo(newTitle);

                    if (mti == null)
                    {
                        m_From.SendLocalizedMessage(1010120);                                   // Your merchant title has been removed

                        if (pl != null)
                        {
                            pl.MerchantTitle = newTitle;
                        }
                    }
                    else if (MerchantTitles.IsQualified(m_From, mti))
                    {
                        m_From.SendLocalizedMessage(mti.Assigned);

                        if (pl != null)
                        {
                            pl.MerchantTitle = newTitle;
                        }
                    }
                }

                break;
            }

            case 2:                     // transfer silver
            {
                if (!m_Faction.IsCommander(m_From))
                {
                    return;
                }

                TownCollection towns = Town.Towns;

                if (index >= 0 && index < towns.Count)
                {
                    Town town = towns[index];

                    if (town.Owner == m_Faction)
                    {
                        if (m_Faction.Silver >= 10000)
                        {
                            m_Faction.Silver -= 10000;
                            town.Silver      += 10000;

                            // 10k in silver has been received by:
                            m_From.SendLocalizedMessage(1042726, true, " " + town.Definition.FriendlyName);
                        }
                    }
                }

                break;
            }

            case 3:                     // change tithe
            {
                if (!m_Faction.IsCommander(m_From))
                {
                    return;
                }

                if (index >= 0 && index <= 10)
                {
                    m_Faction.Tithe = index * 10;
                }

                break;
            }
            }
        }
コード例 #46
0
ファイル: Town.cs プロジェクト: Godkong/RunUO
		public static void WriteReference( GenericWriter writer, Town town )
		{
			int idx = Towns.IndexOf( town );

			writer.WriteEncodedInt( (int) (idx + 1) );
		}
コード例 #47
0
ファイル: TownStone.cs プロジェクト: FreeReign/forkuo
 public TownStone(Town town)
     : base(0xEDE)
 {
     this.Movable = false;
     this.Town = town;
 }
コード例 #48
0
        private static void EventSink_Speech(SpeechEventArgs e)
        {
            Mobile from = e.Mobile;

            // jakob, added 2 new commands
            if (e.Speech.ToLower().IndexOf("i wish to appoint a deputy commander") > -1)
            {
                Faction faction = Faction.Find(from);
                if (faction != null && faction.IsCommander(from) && !faction.IsDeputyCommander(from))
                {
                    faction.BeginAppointDeputyCommander(from);
                }
            }
            else if (e.Speech.ToLower().IndexOf("i wish to demote the deputy commander") > -1)
            {
                Faction faction = Faction.Find(from);
                if (faction != null && faction.IsCommander(from) && !faction.IsDeputyCommander(from) && faction.DeputyCommander != null)
                {
                    faction.DeputyCommander = null;
                    from.SendMessage("You have fired the deputy commander.");
                }
            }
            // Kamron, added this
            else if (e.Speech.ToLower().IndexOf("i wish to renew my spirit") > -1)
            {
                PlayerState ps = PlayerState.Find(from);
                if (ps != null && from is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)from;

                    if (ps.KillPoints <= 1)
                    {
                        from.SendMessage("Your spirit cannot be cleansed.");
                    }
                    else if (Faction.InSkillLoss(pm))
                    {
                        ps.KillPoints--;
                        Faction.ClearSkillLoss(pm);
                        from.SendMessage("You cleanse your spirit and remove your sins.");
                    }
                    else
                    {
                        from.SendMessage("Your spirit does not need cleansing.");
                    }
                }
            }
            // end


            int[] keywords = e.Keywords;

            for (int i = 0; i < keywords.Length; ++i)
            {
                switch (keywords[i])
                {
                case 0x00E4:                         // *i wish to access the city treasury*
                {
                    Town town = Town.FromRegion(from.Region);

                    if (town == null || !town.IsFinance(from) || !from.Alive)
                    {
                        break;
                    }

                    if (FactionGump.Exists(from))
                    {
                        from.SendLocalizedMessage(1042160);                                   // You already have a faction menu open.
                    }
                    else if (town.Owner != null && from is PlayerMobile)
                    {
                        from.SendGump(new FinanceGump((PlayerMobile)from, town.Owner, town));
                    }

                    break;
                }

                case 0x0ED:                         // *i am sheriff*
                {
                    Town town = Town.FromRegion(from.Region);

                    if (town == null || !town.IsSheriff(from) || !from.Alive)
                    {
                        break;
                    }

                    if (FactionGump.Exists(from))
                    {
                        from.SendLocalizedMessage(1042160);                                   // You already have a faction menu open.
                    }
                    else if (town.Owner != null)
                    {
                        from.SendGump(new SheriffGump((PlayerMobile)from, town.Owner, town));
                    }

                    break;
                }

                case 0x00EF:                         // *you are fired*
                {
                    Town town = Town.FromRegion(from.Region);

                    if (town == null)
                    {
                        break;
                    }

                    if (town.IsFinance(from) || town.IsSheriff(from))
                    {
                        town.BeginOrderFiring(from);
                    }

                    break;
                }

                case 0x00E5:                         // *i wish to resign as finance minister*
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null && pl.Finance != null)
                    {
                        pl.Finance.Finance = null;
                        from.SendLocalizedMessage(1005081);                                   // You have been fired as Finance Minister
                    }

                    break;
                }

                case 0x00EE:                         // *i wish to resign as sheriff*
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null && pl.Sheriff != null)
                    {
                        pl.Sheriff.Sheriff = null;
                        from.SendLocalizedMessage(1010270);                                   // You have been fired as Sheriff
                    }

                    break;
                }

                case 0x00E9:                         // *what is my faction term status*
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null && pl.IsLeaving)
                    {
                        if (Faction.CheckLeaveTimer(from))
                        {
                            break;
                        }

                        TimeSpan remaining = (pl.Leaving + Faction.LeavePeriod) - DateTime.Now;

                        if (remaining.TotalDays >= 1)
                        {
                            from.SendLocalizedMessage(1042743, remaining.TotalDays.ToString("N0"));                                         // Your term of service will come to an end in ~1_DAYS~ days.
                        }
                        else if (remaining.TotalHours >= 1)
                        {
                            from.SendLocalizedMessage(1042741, remaining.TotalHours.ToString("N0"));                                         // Your term of service will come to an end in ~1_HOURS~ hours.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042742);                                       // Your term of service will come to an end in less than one hour.
                        }
                    }
                    else if (pl != null)
                    {
                        from.SendLocalizedMessage(1042233);                                   // You are not in the process of quitting the faction.
                    }

                    break;
                }

                case 0x00EA:                         // *message faction*
                {
                    Faction faction = Faction.Find(from);

                    if (faction == null || !faction.IsCommander(from))
                    {
                        break;
                    }

                    if (from.AccessLevel == AccessLevel.Player && !faction.FactionMessageReady)
                    {
                        from.SendLocalizedMessage(1010264);                                   // The required time has not yet passed since the last message was sent
                    }
                    else
                    {
                        faction.BeginBroadcast(from);
                    }

                    break;
                }

                case 0x00EC:                         // *showscore*
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null)
                    {
                        Timer.DelayCall(TimeSpan.Zero, new TimerStateCallback(ShowScore_Sandbox), pl);
                    }

                    break;
                }                         /*
                                           * case 0x0178: // i honor your leadership
                                           * {
                                           *    Faction faction = Faction.Find( from );
                                           *
                                           *    if ( faction != null )
                                           *            faction.BeginHonorLeadership( from );
                                           *
                                           *    break;
                                           * } */
                }
            }
        }
コード例 #49
0
 // NOTE: title inconsistant, as OSI
 public FactionBoardVendor( Town town, Faction faction )
     : base(town, faction, "the LumberMan")
 {
     SetSkill( SkillName.Carpentry, 85.0, 100.0 );
     SetSkill( SkillName.Lumberjacking, 60.0, 83.0 );
 }
コード例 #50
0
ファイル: TownStone.cs プロジェクト: justdanofficial/khaeros
 public TownStone( Town town )
     : base(0xEDE)
 {
     Movable = false;
     Town = town;
 }
コード例 #51
0
ファイル: TownState.cs プロジェクト: Evad-lab/ServUOX
 public TownState(Town town)
 {
     m_Town = town;
 }
コード例 #52
0
ファイル: Sigil.cs プロジェクト: greeduomacro/last-wish
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 0:
				{
					m_Town = Town.ReadReference( reader );
					m_Corrupted = Faction.ReadReference( reader );
					m_Corrupting = Faction.ReadReference( reader );

					m_LastMonolith = reader.ReadItem() as BaseMonolith;

					m_LastStolen = reader.ReadDateTime();
					m_GraceStart = reader.ReadDateTime();
					m_CorruptionStart = reader.ReadDateTime();
					m_PurificationStart = reader.ReadDateTime();

					Update();

					Mobile mob = RootParent as Mobile;

					if ( mob != null )
						mob.SolidHueOverride = OwnershipHue;

					break;
				}
			}
		}
コード例 #53
0
ファイル: TownMonolith.cs プロジェクト: phpjunkie420/RunUO
 public TownMonolith(Town town) : base(town, null)
 {
 }