Exemplo n.º 1
0
		public override sealed int GetProgress(ConquestState state, object args)
		{
			// Handle multi args.
			if (args is object[])
			{
				var o = (object[])args;

				try
				{
					var item = (Item)o[0];
					var quality = (int)o[1];
					var slayer = (bool)o[2];
					var res = (CraftResource)o[3];
					var craft = (CraftSystem)o[4];

					return GetProgress(state, item, quality, slayer, res, craft);
				}
				catch
				{
					return 0;
				}
			}

			return 0;
		}
Exemplo n.º 2
0
		protected virtual int GetProgress(ConquestState state, Skill skill)
		{
            if (skill == null)
			{
				return 0;
			}

            if (state.User == null)
                return 0;

            if ((Skill != (SkillName)skill.SkillID))
            {
                if (ChangeSkillReset)
                {
                    return -state.Progress;
                }

                return 0;
            }

		    if (SkillAmount != 0 && SkillAmount > state.User.Skills[Skill].Value)
		    {
                return 0;
		    }

			return 1;
		}
        protected override int GetProgress(ConquestState state, PlayerConquestContainer args)
		{
            if (state.User == null)
                return 0;

            if (args == null || args.Mobile == null || args.Killer is PlayerMobile && args.Killer.Account != state.User.Account || !(args.Mobile is PlayerMobile) || !(args.Killer is PlayerMobile))
			{
				return 0;
			}

		    var killer = args.Killer as PlayerMobile;
		    var victim = args.Killer as PlayerMobile;

            Faction killerFaction = Faction.Find(killer, true);
            Faction victimFaction = Faction.Find(victim, true);

            if (killerFaction == null || victimFaction == null || killerFaction == victimFaction || AutoPvP.IsParticipant(victim))
            {
                return 0;
            }

            Player ethickiller = Player.Find(killer);
            Player ethicvictim = Player.Find(victim);

		    if (IsEthic && (ethickiller == null || ethicvictim == null || ethickiller.Ethic == ethicvictim.Ethic))
		    {
		        return 0;
		    }

		    return base.GetProgress(state, args);
		}
Exemplo n.º 4
0
		protected virtual int GetProgress(ConquestState state, Item item, CraftResource res, HarvestSystem harvest)
		{
			if (item == null || harvest == null)
			{
				return 0;
			}

            if (state.User == null)
                return 0;

			if (ItemType.IsNotNull && !item.TypeEquals(ItemType, ItemChildren))
			{
				if (ItemChangeReset)
				{
					return -state.Progress;
				}

				return 0;
			}

			if (Resource != CraftResource.None && res != Resource)
			{
				return 0;
			}

			if (HarvestSystem.IsNotNull && !harvest.TypeEquals(HarvestSystem, false))
			{
				return 0;
			}

			return item.Amount;
		}
Exemplo n.º 5
0
		protected virtual int GetProgress(ConquestState state, LoginEventArgs args)
		{
            if (state.User == null)
                return 0;

            if (args == null || args.Mobile is PlayerMobile && args.Mobile.Account != state.User.Account)
			{
				return 0;
			}

			if (Map != null && Map != Map.Internal && (args.Mobile.Map == null || args.Mobile.Map != Map))
			{
				if (MapChangeReset)
				{
					return -state.Progress;
				}

				return 0;
			}

			if (!String.IsNullOrWhiteSpace(Region) && (args.Mobile.Region == null || !args.Mobile.Region.IsPartOf(Region)))
			{
				if (RegionChangeReset)
				{
					return -state.Progress;
				}

				return 0;
			}

			return 1;
		}
Exemplo n.º 6
0
		public static ConquestCompletedGump Acquire(ConquestState state)
		{
			var gumps = GetInstances<ConquestCompletedGump>(state.User, true);
			var type = Conquests.ConquestCompleteGumpTypes.FirstOrDefault(t => gumps.All(g => !g.TypeEquals(t)));

			var cg = type.CreateInstanceSafe<ConquestCompletedGump>(state.User, state);

			if (cg != null)
			{
				const int xPos = 100;
				const int yPos = 80;

				cg.X = xPos;
				cg.Y = yPos;

				if (gumps.Length > 0)
				{
					const int w = 350;
					const int h = 150;

					const int rows = 2;
					const int cols = 3;

					bool escape = false;

					for (int x = 0; x < cols; x++)
					{
						int realX = xPos + (x * w);

						for (int y = 0; y < rows; y++)
						{
							int realY = yPos + (y * h);

							if (gumps.Any(g => g.X == realX && g.Y == realY))
							{
								continue;
							}

							cg.X = realX;
							cg.Y = realY;

							escape = true;
							break;
						}

						if (escape)
						{
							break;
						}
					}
				}
			}

			return cg;
		}
Exemplo n.º 7
0
		protected virtual int GetProgress(ConquestState state, Account account)
		{
            if (state.User == null)
                return 0;

			if (account == null || DateTime.UtcNow - account.Created < AccountAge)
			{
				return 0;
			}
			
			return 1;
		}
Exemplo n.º 8
0
		public ConquestStateGump(PlayerMobile user, ConquestState state)
			: base(user, null, null, null)
		{
			State = state;

			Modal = false;

			CanClose = true;
			CanDispose = true;
			CanMove = true;
			CanResize = true;

			ForceRecompile = true;
		}
Exemplo n.º 9
0
        protected virtual int GetProgress(ConquestState state, CastSpellConquestContainer args)
		{
            if (state.User == null)
                return 0;

			if (args == null || args.SpellID < 0 || args.Mobile is PlayerMobile && args.Mobile.Account != state.User.Account)
			{
				return 0;
			}

			if (CheckBook)
			{
				var book = args.Spellbook as Spellbook;

				if (book == null || !book.HasSpell(args.SpellID))
				{
					book = Spellbook.Find(args.Mobile, args.SpellID);
				}

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

			if (CheckRegs)
			{
				SpellInfo info = SpellRegistry.GetSpellInfo(args.SpellID);

				if (info != null && !args.Mobile.HasItems(info.Reagents, info.Amounts))
				{
					return 0;
				}
			}

			if (Spell.IsNotNull && SpellRegistry.GetRegistryNumber(Spell) != args.SpellID)
			{
				if (ChangeSpellReset)
				{
					return -state.Progress;
				}

				return 0;
			}

			return 1;
		}
Exemplo n.º 10
0
		protected virtual int GetProgress(ConquestState state, CommandEventArgs args)
		{
            if (state.User == null)
                return 0;

            if (args == null || args.Mobile is PlayerMobile && args.Mobile.Account != state.User.Account)
			{
				return 0;
			}

			if (!String.IsNullOrWhiteSpace(Command) && !Insensitive.Equals(args.Command, Command))
			{
				return 0;
			}

			return 1;
		}
Exemplo n.º 11
0
        protected virtual int GetProgress(ConquestState state, Faction faction)
        {
            if (state.User == null)
                return 0;

            if (faction == null && !IsFactionQuit)
            {
                return 0;
            }

            if (faction != null && !string.IsNullOrEmpty(Faction) && faction.Definition.FriendlyName != Faction)
            {
                return 0;
            }

            return 1;
        }
        protected virtual int GetProgress(ConquestState state, ISpell spell)
		{
            if (state.User == null)
                return 0;

            if (Spell.IsNotNull && !spell.TypeEquals(Spell, false))
			{
				if (ChangeSpellReset)
				{
					return -state.Progress;
				}

				return 0;
			}

			return 1;
		}
		protected virtual int GetProgress(ConquestState state, BaseHouse house)
		{
			if (house == null)
			{
				return 0;
			}

            if (state.User == null)
                return 0;

			if (House.IsNotNull && !house.TypeEquals(House, false))
			{
				return 0;
			}

			return 1;
		}
Exemplo n.º 14
0
        protected virtual int GetProgress(ConquestState state, Item stolenItem)
        {
            if (stolenItem == null)
            {
                return 0;
            }

            if (state.User == null)
                return 0;

            var creature = stolenItem.RootParent as BaseCreature;

            if (IsDungeon && !state.User.InRegion<DungeonRegion>())
            {
                return 0;
            }

            if (PlayerTarget && !(stolenItem.RootParent is PlayerMobile))
            {
                return 0;
            }

			if (Creature.IsNotNull && creature != null && !creature.TypeEquals(Creature, Children))
			{
				if (ChangeCreatureReset)
				{
					return -state.Progress;
				}

				return 0;
			}

            if (Item.IsNotNull && !stolenItem.TypeEquals(Item, ItemChildren))
            {
                if (ItemChangeReset)
                {
                    return -state.Progress;
                }

                return 0;
            }

			return 1;
		}
Exemplo n.º 15
0
        protected virtual int GetProgress(ConquestState state, MovementConquestContainer args)
        {
            if (args == null || args.Blocked)
            {
                return 0;
            }

            if (state.User == null)
                return 0;

            if (Map != null && Map != Map.Internal &&
                (args.Mobile.Map == null || args.Mobile.Map != Map ||
                 args.Mobile.Map == Map && args.Mobile.Location != Location))
            {
                return 0;
            }

            return 1;
        }
        protected override int GetProgress(ConquestState state, CreatureConquestContainer args)
        {
            if (state.User == null)
                return 0;

            if (args == null || args.Creature == null || args.Killer != null && args.Killer is PlayerMobile && args.Killer.Account != state.User.Account || !(args.Creature is BaseCreature))
            {
                return 0;
            }

            var creature = args.Creature as BaseCreature;

            if (Alignment != Alignment.None && creature.Alignment != Alignment)
            {
                return 0;
            }

            return 1;
            //return base.GetProgress(state, args);
        }
Exemplo n.º 17
0
        protected virtual int GetProgress(ConquestState state, MovementConquestContainer args)
        {
            if (args == null || args.Blocked)
            {
                return(0);
            }

            if (state.User == null)
            {
                return(0);
            }

            if (Map != null && Map != Map.Internal &&
                (args.Mobile.Map == null || args.Mobile.Map != Map ||
                 args.Mobile.Map == Map && args.Mobile.Location != Location))
            {
                return(0);
            }

            return(1);
        }
Exemplo n.º 18
0
		protected virtual int GetProgress(ConquestState state, PlayerDeathEventArgs args)
		{
            if (state.User == null)
                return 0;

            if (args == null || args.Mobile is PlayerMobile && args.Mobile.Account != state.User.Account)
			{
				return 0;
			}

            if (IsDuel && args.Killer is PlayerMobile && ((PlayerMobile)args.Killer).DuelContext == null || IsDuel && !(args.Killer is PlayerMobile))
            {
                return 0;
            }

            if (IsDungeon && !args.Killer.InRegion<DungeonRegion>())
            {
                return 0;
            }

			return 1;
		}
		protected virtual int GetProgress(ConquestState state, Mobile creature)
		{
			if (creature == null)
			{
				return 0;
			}

            if (state.User == null)
                return 0;

			if (Creature.IsNotNull && !creature.TypeEquals(Creature, Children))
			{
				if (ChangeCreatureReset)
				{
					return -state.Progress;
				}

				return 0;
			}

			return 1;
		}
		protected virtual int GetProgress(ConquestState state, ClientVersionReceivedArgs args)
		{
            if (state.User == null)
                return 0;

            if (args == null || args.State == null || args.State.Mobile is PlayerMobile && args.State.Mobile.Account != state.User.Account || args.Version == null)
			{
				return 0;
			}

			if (Version != null)
			{
				VersionInfo v = args.Version.ToString();

				if (v < Version)
				{
					return 0;
				}
			}

			return 1;
		}
Exemplo n.º 21
0
        protected virtual int GetProgress(ConquestState state, SpeechConquestContainer args)
		{
            if (state.User == null)
                return 0;

			if (args == null || String.IsNullOrEmpty(args.Speech))
			{
				return 0;
			}

			if (!Search.Execute(args.Speech, Phrase, IgnoreCase))
			{
				if (SpeechChangeReset)
				{
					return -state.Progress;
				}

				return 0;
			}

			return 1;
		}
Exemplo n.º 22
0
		public override sealed int GetProgress(ConquestState state, object args)
		{
			// Handle multi args (if any).
			if (args is object[])
			{
				var o = (object[])args;

				if (o.Length == 0)
				{
					return 0;
				}

				if (o.Length < 2)
				{
					return GetProgress(state, o[0] as Item, String.Empty);
				}

				return GetProgress(state, o[0] as Item, o[1] as string);
			}

			// Handle single item argument.
			return GetProgress(state, args as Item, String.Empty);
		}
Exemplo n.º 23
0
		public override sealed int GetProgress(ConquestState state, object args)
		{
			// Handle multi args.
			if (args is object[])
			{
				var o = (object[])args;

				try
				{
					var item = (Item)o[0];
					var res = (CraftResource)o[1];
					var harvest = (HarvestSystem)o[2];
					
					return GetProgress(state, item, res, harvest);
				}
				catch
				{
					return 0;
				}
			}

			return 0;
		}
Exemplo n.º 24
0
		protected virtual int GetProgress(ConquestState state, PlayerMobile victim)
		{
			if (victim == null)
			{
				return 0;
			}

            if (state.User == null)
                return 0;

            PvPBattle battle = AutoPvP.FindBattle(state.User);

            if (Battle.IsNotNull && !battle.TypeEquals(Battle, BattleChildren))
            {
                if (ChangeBattleReset)
                {
                    return -state.Progress;
                }

                return 0;
            }

			return 1;
		}
Exemplo n.º 25
0
		protected virtual int GetProgress(ConquestState state, Mobile mobile)
		{
			if (mobile == null || state.User == null)
			{
				return 0;
			}

            if (LastKillerCheck && mobile.LastKiller == null || LastKillerCheck && mobile is PlayerMobile && mobile.LastKiller is PlayerMobile && mobile.LastKiller.Account == state.User.Account || LastKillerCheck && !(mobile is PlayerMobile))
		    {
		        return 0;
		    }

            if (IsPlayer && !(mobile is PlayerMobile))
            {
                return 0;
            }

            if (IsCreature && !(mobile is BaseCreature))
		    {
		        return 0;
		    }

			return 1;
		}
Exemplo n.º 26
0
 public override sealed int GetProgress(ConquestState state, object args)
 {
     return(GetProgress(state, args as MovementConquestContainer));
 }
Exemplo n.º 27
0
 public override sealed int GetProgress(ConquestState state, object args)
 {
     return GetProgress(state, args as MovementConquestContainer);
 }
Exemplo n.º 28
0
		public override sealed int GetProgress(ConquestState state, object args)
		{
			return GetProgress(state, args as Skill);
		}
Exemplo n.º 29
0
		public override sealed int GetProgress(ConquestState state, object args)
		{
			return GetProgress(state, args as LoginEventArgs);
		}
Exemplo n.º 30
0
			public Sub3(PlayerMobile user, ConquestState state)
				: base(user, state)
			{ }
Exemplo n.º 31
0
		protected virtual Color GetTierColor(ConquestState entry)
		{
			if (entry == null || !entry.ConquestExists)
			{
				return Color.Yellow;
			}

			double p = entry.Tier / entry.TierMax;

			if (p < 0.50)
			{
				return Color.OrangeRed.Interpolate(Color.Yellow, p / 0.50);
			}

			if (p > 0.50)
			{
				return Color.Yellow.Interpolate(Color.LawnGreen, (p - 0.50) / 0.50);
			}

			return Color.Yellow;
		}
Exemplo n.º 32
0
		public ConquestCompletedGump(PlayerMobile user, ConquestState state)
			: base(user)
		{
			AnimDuration = DefaultAnimDuration;
			PauseDuration = DefaultPauseDuration;

			State = state;

			Modal = false;

			AutoClose = true;

			FrameIndex = 0;
			AnimState = null;

			CanClose = true;
			CanDispose = true;
			CanMove = false;
			CanResize = false;

			ForceRecompile = true;
			AutoRefresh = true;
		}