예제 #1
0
		public void HonorLeadership_OnTarget( Mobile from, object obj )
		{
			if ( obj is Mobile )
			{
				Mobile recv = (Mobile) obj;

				PlayerState giveState = PlayerState.Find( from );
				PlayerState recvState = PlayerState.Find( recv );

				if ( giveState == null )
					return;

				if ( recvState == null || recvState.Faction != giveState.Faction )
				{
					from.SendLocalizedMessage( 1042497 ); // Only faction mates can be honored this way.
				}
				else if ( giveState.KillPoints < 5 )
				{
					from.SendLocalizedMessage( 1042499 ); // You must have at least five kill points to honor them.
				}
				else
				{
					giveState.KillPoints -= 5;
					recvState.KillPoints += 4;

					// TODO: Confirm no message sent to giver
					recv.SendLocalizedMessage( 1042500 ); // You have been honored with four kill points.
				}
			}
			else
			{
				from.SendLocalizedMessage( 1042496 ); // You may only honor another player.
			}
		}
예제 #2
0
        public static Faction Find(Mobile mob, bool inherit, bool creatureAllegiances)
        {
            PlayerState pl = PlayerState.Find(mob);

            if (pl != null)
            {
                return(pl.Faction);
            }

            if (inherit && mob is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)mob;

                if (bc.Controlled)
                {
                    return(Find(bc.ControlMaster, false));
                }
                else if (bc.Summoned)
                {
                    return(Find(bc.SummonMaster, false));
                }
                else if (creatureAllegiances && mob is BaseFactionGuard)
                {
                    return(((BaseFactionGuard)mob).Faction);
                }
                else if (creatureAllegiances)
                {
                    return(bc.FactionAllegiance);
                }
            }

            return(null);
        }
예제 #3
0
        public override bool CanSelect(PlayerMobile from)
        {
            PlayerState state = PlayerState.Find(from);


            return(from.AccessLevel > AccessLevel.Player || (state != null && state.Rank.Rank >= MinRank));
        }
예제 #4
0
        public static int GetMaxWearables(Mobile mob)
        {
            var pl = PlayerState.Find(mob);

            return(pl == null ? 0 :
                   pl.Faction.IsCommander(mob) ? 9 : pl.Rank.MaxWearables);
        }
예제 #5
0
        public void RemoveMember(Mobile mob)
        {
            PlayerState pl = PlayerState.Find(mob);

            if (pl == null || !Members.Contains(pl))
            {
                return;
            }

            if (mob.Backpack != null)
            {
                //Ordinarily, through normal faction removal, this will never find any sigils.
                //Only with a leave delay less than the ReturnPeriod or a Faction Kick/Ban, will this ever do anything
                Item[] sigils = mob.Backpack.FindItemsByType(typeof(Sigil));

                for (int i = 0; i < sigils.Length; ++i)
                {
                    ((Sigil)sigils[i]).ReturnHome();
                }
            }

            Members.Remove(pl);

            if (mob is PlayerMobile)
            {
                ((PlayerMobile)mob).FactionPlayerState = null;
            }

            mob.InvalidateProperties();
            mob.Delta(MobileDelta.Noto);

            if (Election.IsCandidate(mob))
            {
                Election.RemoveCandidate(mob);
            }

            Election.RemoveVoter(mob);

            if (pl.Finance != null)
            {
                pl.Finance.Finance = null;
            }

            if (pl.Sheriff != null)
            {
                pl.Sheriff.Sheriff = null;
            }

            if (Commander == mob)
            {
                Commander = null;
            }

            if (mob is PlayerMobile)
            {
                ((PlayerMobile)mob).ValidateEquipment();
            }
        }
예제 #6
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_Faction == null)
            {
                return;
            }
            if (from.Kills >= 5)
            {
                if (MurderSystemController._MurderersCanJoinAnyFaction == false)
                {
                    if ((m_Faction.Definition.FriendlyName == "True Britannians" || m_Faction.Definition.FriendlyName == "Council of Mages"))
                    {
                        from.SendMessage("Murderers cannot join this faction!");
                        return;
                    }
                }
            }

            if (!from.InRange(GetWorldLocation(), 2))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                   // I can't reach that.
            }
            else if (FactionGump.Exists(from))
            {
                from.SendLocalizedMessage(1042160);                   // You already have a faction menu open.
            }
            else if (from is PlayerMobile)
            {
                Faction existingFaction = Faction.Find(from);

                if (existingFaction == m_Faction || from.AccessLevel >= AccessLevel.GameMaster)
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null && pl.IsLeaving)
                    {
                        from.SendLocalizedMessage(1005051);                           // You cannot use the faction stone until you have finished quitting your current faction
                    }
                    else
                    {
                        from.SendGump(new FactionStoneGump((PlayerMobile)from, m_Faction));
                    }
                }
                else if (existingFaction != null)
                {
                    // TODO: Validate
                    from.SendLocalizedMessage(1005053);                       // This is not your faction stone!
                }
                else
                {
                    from.SendGump(new JoinStoneGump((PlayerMobile)from, m_Faction));
                }
            }
        }
예제 #7
0
		public void OnJoinAccepted( Mobile mob )
		{
			PlayerMobile pm = mob as PlayerMobile;

			if ( pm == null )
				return; // sanity

			PlayerState pl = PlayerState.Find( pm );

			if ( pm.Young )
				pm.SendLocalizedMessage( 1010104 ); // You cannot join a faction as a young player
			else if ( pl != null && pl.IsLeaving )
				pm.SendLocalizedMessage( 1005051 ); // You cannot use the faction stone until you have finished quitting your current faction
			else if ( AlreadyHasCharInFaction( pm ) )
				pm.SendLocalizedMessage( 1005059 ); // You cannot join a faction because you already declared your allegiance with another character
			else if ( IsFactionBanned( mob ) )
				pm.SendLocalizedMessage( 1005052 ); // You are currently banned from the faction system
			else if ( pm.Guild != null )
			{
				Guild guild = pm.Guild as Guild;

				if ( guild.Leader != pm )
					pm.SendLocalizedMessage( 1005057 ); // You cannot join a faction because you are in a guild and not the guildmaster
				else if ( !Guild.NewGuildSystem && guild.Type != GuildType.Regular )
					pm.SendLocalizedMessage( 1042161 ); // You cannot join a faction because your guild is an Order or Chaos type.
				else if ( !Guild.NewGuildSystem && guild.Enemies != null && guild.Enemies.Count > 0 )	//CAN join w/wars in new system
					pm.SendLocalizedMessage( 1005056 ); // You cannot join a faction with active Wars	
				else if ( !CanHandleInflux( guild.Members.Count ) )
					pm.SendLocalizedMessage( 1018031 ); // In the interest of faction stability, this faction declines to accept new members for now.
				else
				{
					List<Mobile> members = new List<Mobile>( guild.Members );

					for ( int i = 0; i < members.Count; ++i )
					{
						PlayerMobile member = members[i] as PlayerMobile;

						if ( member == null )
							continue;

						JoinGuilded( member, guild );
					}
				}
			}
			else if ( !CanHandleInflux( 1 ) )
			{
				pm.SendLocalizedMessage( 1018031 ); // In the interest of faction stability, this faction declines to accept new members for now.
			}
			else
			{
				JoinAlone( mob );
			}
		}
예제 #8
0
        public override void VendorBuy(Mobile buyer)
        {
            PlayerState ps = PlayerState.Find(buyer);

            if (ps == null || ps.Faction != this.Faction)
            {
                Say("I will never deal with your kind!");
            }
            else
            {
                base.VendorBuy(buyer);
            }
        }
예제 #9
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerState pl = PlayerState.Find(from);

            if (pl == null)
                from.SendLocalizedMessage(1010366); // You cannot mount a faction war horse!
            else if (pl.Faction != this.Faction)
                from.SendLocalizedMessage(1010367); // You cannot ride an opposing faction's war horse!
            else if (pl.Rank.Rank < 2)
                from.SendLocalizedMessage(1010368); // You must achieve a faction rank of at least two before riding a war horse!
            else
                base.OnDoubleClick(from);
        }
예제 #10
0
        public void OnStolen(Mobile mob)
        {
            PlayerState ps      = PlayerState.Find(mob);
            Faction     faction = (ps == null ? null : ps.Faction);

            if (faction != null)
            {
                if (Corrupted != faction && Corrupting != faction)
                {
                    UpdateThief(mob);
                    Server.Scripts.Commands.CommandHandlers.BroadcastFactionMessage(38, "[Factions] " + this.Town + "'s sigil has been stolen!");
                }
            }
        }
예제 #11
0
        public override void OnTrigger(Mobile from)
        {
            if (!IsEnemy(from))
            {
                return;
            }

            Conceal();

            DoVisibleEffect();
            Effects.PlaySound(Location, Map, EffectSound);
            DoAttackEffect(from);

            var silverToAward = from.Alive ? 20 : 40;

            if (silverToAward > 0 && Placer != null && Faction != null)
            {
                var victimState = PlayerState.Find(from);

                if (victimState?.CanGiveSilverTo(Placer) == true && victimState.KillPoints > 0)
                {
                    var silverGiven = Faction.AwardSilver(Placer, silverToAward);

                    if (silverGiven > 0)
                    {
                        // TODO: Get real message
                        if (from.Alive)
                        {
                            Placer.SendMessage(
                                "You have earned {0} silver pieces because {1} fell for your trap.",
                                silverGiven,
                                from.Name
                                );
                        }
                        else
                        {
                            Placer.SendLocalizedMessage(
                                1042736,
                                $"{silverGiven} silver\t{from.Name}"
                                ); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
                        }
                    }

                    victimState.OnGivenSilverTo(Placer);
                }
            }

            from.LocalOverheadMessage(MessageType.Regular, MessageHue, AttackMessage);
        }
예제 #12
0
		public static bool CheckLeaveTimer( Mobile mob )
		{
			PlayerState pl = PlayerState.Find( mob );

			if ( pl == null || !pl.IsLeaving )
				return false;

			if ( (pl.Leaving + LeavePeriod) >= DateTime.Now )
				return false;

			mob.SendLocalizedMessage( 1005163 ); // You have now quit your faction

			pl.Faction.RemoveMember( mob );

			return true;
		}
예제 #13
0
        public static int GetMaxWearables(Mobile mob)
        {
            PlayerState pl = PlayerState.Find(mob);

            if (pl == null)
            {
                return(0);
            }

            if (pl.Faction.IsCommander(mob))
            {
                return(9);
            }

            return(pl.Rank.MaxWearables);
        }
예제 #14
0
        public static void OnPlayerDeath(PlayerDeathEventArgs e)
        {
            if (e.Mobile is PlayerMobile && e.Mobile.Backpack != null)
            {
                var state = PlayerState.Find(e.Mobile);

                if (state != null)
                {
                    ShrineGem gem = null;

                    foreach (var item in e.Mobile.Backpack.Items)
                    {
                        if (item is ShrineGem && ((ShrineGem)item).FactionItemState.Faction == state.Faction)
                        {
                            gem = (ShrineGem)item;
                            break;
                        }
                    }
                    Console.WriteLine("Gem: {0}", gem);
                    if (gem != null)
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(2.5), () =>
                        {
                            BaseGump.SendGump(new ConfirmCallbackGump((PlayerMobile)e.Mobile, 1094715, 1094716, gem, null,
                                                                      (m, obj) =>
                            {
                                ShrineGem g = obj as ShrineGem;

                                if (g != null && !g.Deleted && g.IsChildOf(m.Backpack))
                                {
                                    Point3D p = _ShrineLocs[Utility.Random(_ShrineLocs.Length)];

                                    Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
                                    {
                                        m.PlaySound(0x1FC);
                                        m.MoveToWorld(p, m.Map);
                                        m.PlaySound(0x1FC);

                                        g.Delete();
                                    });
                                }
                            }));
                        });
                    }
                }
            }
        }
예제 #15
0
        public void RemoveMember(Mobile mob)
        {
            PlayerState pl = PlayerState.Find(mob);

            if (pl == null || !Members.Contains(pl))
            {
                return;
            }

            Members.Remove(pl);

            if (mob is PlayerMobile)
            {
                ((PlayerMobile)mob).FactionPlayerState = null;
            }

            mob.InvalidateProperties();
            mob.Delta(MobileDelta.Noto);

            if (Election.IsCandidate(mob))
            {
                Election.RemoveCandidate(mob);
            }

            Election.RemoveVoter(mob);

            if (pl.Finance != null)
            {
                pl.Finance.Finance = null;
            }

            if (pl.Sheriff != null)
            {
                pl.Sheriff.Sheriff = null;
            }

            if (Commander == mob)
            {
                Commander = null;
            }

            if (mob is PlayerMobile)
            {
                ((PlayerMobile)mob).ValidateEquipment();
            }
        }
예제 #16
0
        public void RemoveCandidate(Mobile mob)
        {
            Candidate cd = FindCandidate(mob);

            if (cd == null)
            {
                return;
            }

            m_Candidates.Remove(cd);
            mob.SendLocalizedMessage(1038031);

            if (m_State == ElectionState.Election)
            {
                if (m_Candidates.Count == 1)
                {
                    m_Faction.Broadcast(1038031);                       // There are no longer any valid candidates in the Faction Commander election.

                    Candidate winner = m_Candidates[0];

                    Mobile      winMob = winner.Mobile;
                    PlayerState pl     = PlayerState.Find(winMob);

                    if (pl == null || pl.Faction != m_Faction || winMob == m_Faction.Commander)
                    {
                        m_Faction.Broadcast(1038026);                           // Faction leadership has not changed.
                    }
                    else
                    {
                        m_Faction.Broadcast(1038028);                           // The faction has a new commander.
                        m_Faction.Commander = winMob;
                    }

                    m_Candidates.Clear();
                    State = ElectionState.Pending;
                }
                else if (m_Candidates.Count == 0)                   // well, I guess this'll never happen
                {
                    m_Faction.Broadcast(1038031);                   // There are no longer any valid candidates in the Faction Commander election.

                    m_Candidates.Clear();
                    State = ElectionState.Pending;
                }
            }
        }
예제 #17
0
        private void HireSheriff_OnTarget(Mobile from, object obj)
        {
            if (m_Town.Owner != m_Faction || !m_Faction.IsCommander(from))
            {
                from.SendLocalizedMessage(1010339); // You no longer control this city
                return;
            }

            if (m_Town.Sheriff != null)
            {
                from.SendLocalizedMessage(1010342); // You must fire your Sheriff before you can elect a new one
            }
            else if (obj is Mobile targ)
            {
                var pl = PlayerState.Find(targ);

                if (pl == null)
                {
                    from.SendLocalizedMessage(1010337); // You must pick someone in a faction
                }
                else if (pl.Faction != m_Faction)
                {
                    from.SendLocalizedMessage(1010338); // You must pick someone in the correct faction
                }
                else if (m_Faction.Commander == targ)
                {
                    from.SendLocalizedMessage(1010335); // You cannot elect a commander to a town position
                }
                else if (pl.Sheriff != null || pl.Finance != null)
                {
                    // You must pick someone who does not already hold a city post
                    from.SendLocalizedMessage(1005245);
                }
                else
                {
                    m_Town.Sheriff = targ;
                    targ.SendLocalizedMessage(1010340); // You are now the Sheriff
                    from.SendLocalizedMessage(1010341); // You have elected a Sheriff
                }
            }
            else
            {
                from.SendLocalizedMessage(1010334); // You must select a player to hold a city position!
            }
        }
예제 #18
0
        public static void AddToCooldown(Mobile m)
        {
            Cooldown.Add(m);

            int minutes = 30;

            PlayerState ps = PlayerState.Find(m);

            if (ps != null)
            {
                minutes = 30 - (ps.Rank.Rank * 2);
            }

            Timer.DelayCall <Mobile>(TimeSpan.FromMinutes(minutes), mob =>
            {
                Cooldown.Remove(mob);
            }, m);
        }
예제 #19
0
        private void HireFinanceMinister_OnTarget(Mobile from, object obj)
        {
            if (m_Town.Owner != m_Faction || !m_Faction.IsCommander(from))
            {
                from.SendAsciiMessage("You no longer control this city.");
                return;
            }
            else if (m_Town.Finance != null)
            {
                from.SendAsciiMessage("You must fire your Sheriff before you can elect a new one.");
            }
            else if (obj is Mobile)
            {
                Mobile      targ = (Mobile)obj;
                PlayerState pl   = PlayerState.Find(targ);

                if (pl == null)
                {
                    from.SendAsciiMessage("You must pick someone in a faction.");
                }
                else if (pl.Faction != m_Faction)
                {
                    from.SendAsciiMessage("You must pick someone in the correct faction.");
                }
                else if (m_Faction.Commander == targ)
                {
                    from.SendAsciiMessage("You cannot elect a commander to a town position.");
                }
                else if (pl.Sheriff != null || pl.Finance != null)
                {
                    from.SendAsciiMessage("You must pick someone who does not already hold a city post.");
                }
                else
                {
                    m_Town.Finance = targ;
                    targ.SendAsciiMessage("You are now the Financial Minister.");
                    from.SendAsciiMessage("You have elected a Financial Minister.");
                }
            }
            else
            {
                from.SendAsciiMessage("You must select a player to hold a city position!");
            }
        }
예제 #20
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_Faction == null)
            {
                return;
            }

            if (!from.InRange(GetWorldLocation(), 2))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
            }
            else if (FactionGump.Exists(from))
            {
                from.SendLocalizedMessage(1042160); // You already have a faction menu open.
            }
            else if (from is PlayerMobile)
            {
                Faction existingFaction = Faction.Find(from);

                if (existingFaction == m_Faction || from.AccessLevel >= AccessLevel.GameMaster)
                {
                    PlayerState pl = PlayerState.Find(from);

                    if (pl != null && pl.IsLeaving)
                    {
                        from.SendLocalizedMessage(1005051); // You cannot use the faction stone until you have finished quitting your current faction
                    }
                    else
                    {
                        from.SendGump(new FactionStoneGump((PlayerMobile)from, m_Faction));
                    }
                }
                else if (existingFaction != null)
                {
                    // TODO: Validate
                    from.SendLocalizedMessage(1005053); // This is not your faction stone!
                }
                else
                {
                    from.SendGump(new JoinStoneGump((PlayerMobile)from, m_Faction));
                }
            }
        }
예제 #21
0
        public override void OnTrigger(Mobile from)
        {
            if (!IsEnemy(from))
            {
                return;
            }

            Conceal();

            DoVisibleEffect();
            Effects.PlaySound(this.Location, this.Map, this.EffectSound);
            DoAttackEffect(from);

            int silverToAward = (from.Alive ? 20 : 40);

            if (silverToAward > 0 && m_Placer != null && m_Faction != null)
            {
                PlayerState victimState = PlayerState.Find(from);

                if (victimState != null && victimState.CanGiveSilverTo(m_Placer) && victimState.KillPoints > 0)
                {
                    int silverGiven = m_Faction.AwardSilver(m_Placer, silverToAward);

                    if (silverGiven > 0)
                    {
                        // TODO: Get real message
                        if (from.Alive)
                        {
                            m_Placer.SendAsciiMessage("You have earned {0} silver pieces because {1} fell for your trap.", silverGiven, from.Name);
                        }
                        else
                        {
                            m_Placer.SendAsciiMessage("You have earned " + silverGiven + " pieces for vanquishing " + from.Name + "!");
                        }
                    }

                    victimState.OnGivenSilverTo(m_Placer);
                }
            }

            from.LocalOverheadMessage(MessageType.Regular, MessageHue, AttackMessage);
        }
예제 #22
0
        public override void OnTrigger(Mobile from)
        {
            if (!this.IsEnemy(from))
            {
                return;
            }

            this.Conceal();

            this.DoVisibleEffect();
            Effects.PlaySound(this.Location, this.Map, this.EffectSound);
            this.DoAttackEffect(from);

            int silverToAward = (from.Alive ? 20 : 40);

            if (silverToAward > 0 && this.m_Placer != null && this.m_Faction != null)
            {
                PlayerState victimState = PlayerState.Find(from);

                if (victimState != null && victimState.CanGiveSilverTo(this.m_Placer) && victimState.KillPoints > 0)
                {
                    int silverGiven = this.m_Faction.AwardSilver(this.m_Placer, silverToAward);

                    if (silverGiven > 0)
                    {
                        // TODO: Get real message
                        if (from.Alive)
                        {
                            this.m_Placer.SendMessage("You have earned {0} silver pieces because {1} fell for your trap.", silverGiven, from.Name);
                        }
                        else
                        {
                            this.m_Placer.SendLocalizedMessage(1042736, String.Format("{0} silver\t{1}", silverGiven, from.Name)); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
                        }
                    }

                    victimState.OnGivenSilverTo(this.m_Placer);
                }
            }

            from.LocalOverheadMessage(MessageType.Regular, this.MessageHue, this.AttackMessage);
        }
예제 #23
0
        public bool CanBeCandidate(Mobile mob)
        {
            if (IsCandidate(mob))
            {
                return(false);
            }

            if (m_Candidates.Count >= MaxCandidates)
            {
                return(false);
            }

            if (m_State != ElectionState.Campaign)
            {
                return(false);                // sanity..
            }
            PlayerState pl = PlayerState.Find(mob);

            return(pl != null && pl.Faction == m_Faction && pl.Rank.Rank >= CandidateRank);
        }
예제 #24
0
        public static bool CheckLeaveTimer(Mobile mob)
        {
            PlayerState pl = PlayerState.Find(mob);

            if (pl == null || !pl.IsLeaving)
            {
                return(false);
            }

            if ((pl.Leaving + LeavePeriod) >= DateTime.Now)
            {
                return(false);
            }

            mob.SendAsciiMessage("You have now quit your faction.");

            pl.Faction.RemoveMember(mob);

            return(true);
        }
예제 #25
0
        public static bool CanUse(IFactionItem item, Mobile m, int failmessage = 500294)
        {
            if (item == null)
            {
                return(true);
            }

            var state = PlayerState.Find(m);

            if (state != null && state.Faction == item.FactionItemState.Faction)
            {
                return(true);
            }

            if (failmessage > 0)
            {
                m.SendLocalizedMessage(failmessage); // You cannot use that.
            }

            return(false);
        }
예제 #26
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerState pl = PlayerState.Find(from);

            if (pl == null)
            {
                from.SendAsciiMessage("You cannot mount a faction war horse!");
            }
            else if (pl.Faction != this.Faction)
            {
                from.SendAsciiMessage("You cannot ride an opposing faction's war horse!");
            }
            else if (pl.Rank.Rank < 2)
            {
                from.SendAsciiMessage("You must achieve a faction rank of at least two before riding a war horse!");
            }
            else
            {
                base.OnDoubleClick(from);
            }
        }
예제 #27
0
        public static void FactionCommander_OnTarget(Mobile from, object obj)
        {
            if (obj is PlayerMobile)
            {
                Mobile      targ = (Mobile)obj;
                PlayerState pl   = PlayerState.Find(targ);

                if (pl != null)
                {
                    pl.Faction.Commander = targ;
                    from.SendMessage("You have appointed them as the faction commander.");
                }
                else
                {
                    from.SendMessage("They are not in a faction.");
                }
            }
            else
            {
                from.SendMessage("That is not a player.");
            }
        }
예제 #28
0
        public override bool OnMoveOver(Mobile m)
        {
            // first check: the mobile actually exists and is a live player
            if (m != null && m is PlayerMobile && m.Alive)
            {
                // second check: connected to monolith, monolith connected to town, and there is nobody currently trying to capture
                if (m_Monolith != null && m_Monolith.Town != null && m_Capturer == null)
                {
                    // third check: there is no sigil at all or a pure sigil on the monolith
                    //if ( m_Monolith.Sigil == null || !m_Monolith.Sigil.IsPurifying )
                    {
                        // fourth check: the player is a faction member and the control point is owned by another faction than the player
                        PlayerState ps = PlayerState.Find(m);
                        if (ps != null && !ps.IsLeaving && ps.Faction != m_Owner)
                        {
                            BeginCapture(m);
                        }
                    }
                }
            }

            return(base.OnMoveOver(m));
        }
예제 #29
0
        public object[] AcquireFields()
        {
            TimeSpan gameTime = TimeSpan.Zero;

            if (m_From is PlayerMobile)
            {
                gameTime = ((PlayerMobile)m_From).GameTime;
            }

            int kp = 0;

            PlayerState pl = PlayerState.Find(m_From);

            if (pl != null)
            {
                kp = pl.KillPoints;
            }

            int sk = m_From.Skills.Total;

            int factorSkills   = 50 + ((sk * 100) / 10000);
            int factorKillPts  = 100 + (kp * 2);
            int factorGameTime = 50 + (int)((gameTime.Ticks * 100) / TimeSpan.TicksPerDay);

            int totalFactor = (factorSkills * factorKillPts * Math.Max(factorGameTime, 100)) / 10000;

            if (totalFactor > 100)
            {
                totalFactor = 100;
            }
            else if (totalFactor < 0)
            {
                totalFactor = 0;
            }

            return(new object[] { m_From, m_Address, m_Time, totalFactor });
        }
예제 #30
0
        public static void FactionKick_OnTarget(Mobile from, object obj)
        {
            if (obj is Mobile)
            {
                Mobile      mob = (Mobile)obj;
                PlayerState pl  = PlayerState.Find((Mobile)mob);

                if (pl != null)
                {
                    pl.Faction.RemoveMember(mob);

                    mob.SendMessage("You have been kicked from your faction.");
                    from.SendMessage("They have been kicked from their faction.");
                }
                else
                {
                    from.SendMessage("They are not in a faction.");
                }
            }
            else
            {
                from.SendMessage("That is not a player.");
            }
        }