public override void OnEnter(Mobile m) { Guilds.GuildType rType = GetVirtueOwner(); if (rType != Guilds.GuildType.Regular) { Guilds.GuildType mType = Server.Guilds.GuildType.Regular; if (m.Guild != null) { mType = m.Guild.Type; } if ((mType != Server.Guilds.GuildType.Regular || this is Server.Battle.BattleVirtueRegion) && mType != rType) { m.SendAsciiMessage(0x25, "You are now entering a protected " + rType.ToString() + " area. Your kind is not permitted here!"); } else { m.SendAsciiMessage("You are entering a protected " + rType.ToString() + " area."); } //CheckGuardCandidate( m ); //done in base.OnEnter } base.OnEnter(m); }
public override void MakeGuard(Mobile focus) { BaseGuard useGuard = null; Guilds.GuildType virtue = GetVirtueOwner(); Type guardType; if (focus is BaseGuard) { return; } GuardedRegion reg = (GuardedRegion)focus.Region.GetRegion(typeof(GuardedRegion)); if (reg != null) { switch (virtue) { case Server.Guilds.GuildType.Chaos: guardType = typeof(ChaosGuard); break; case Server.Guilds.GuildType.Order: guardType = typeof(OrderGuard); break; default: guardType = m_GuardType; break; } foreach (Mobile m in focus.GetMobilesInRange(8)) { if (m.GetType() == guardType && m is BaseGuard) { BaseGuard g = (BaseGuard)m; if (g.Focus == null) // idling { useGuard = g; break; } } } if (useGuard == null) { m_GuardParams[0] = focus; try { Activator.CreateInstance(guardType, m_GuardParams); } catch { } } else { useGuard.Focus = focus; } } }
public override void OnExit(Mobile m) { Guilds.GuildType type = GetVirtueOwner(); if (type != Guilds.GuildType.Regular) { m.SendAsciiMessage("You are now leaving a protected " + type.ToString() + " area."); } base.OnExit(m); }
public override bool IsGuardCandidate(Mobile m) { if (m is BaseGuard || !m.Alive || m.AccessLevel > AccessLevel.Player || m.Blessed || IsDisabled()) { return(false); } Guilds.GuildType owner = GetVirtueOwner(); Guilds.GuildType mtype = m != null && m.Guild != null ? m.Guild.Type : Server.Guilds.GuildType.Regular; if (owner != Server.Guilds.GuildType.Regular && mtype != Server.Guilds.GuildType.Regular && owner != mtype) { return(true); } return(base.IsGuardCandidate(m)); }
public static bool IsHostileVirtueArea(Point3D p, Map map, Mobile m) { Guilds.GuildType checkType = Server.Guilds.GuildType.Regular; if (m.Guild != null) { checkType = m.Guild.Type; } VirtueGuardedRegion reg = (VirtueGuardedRegion)Region.Find(p, map).GetRegion(typeof(VirtueGuardedRegion)); if (reg != null) { Guilds.GuildType regType = reg.GetVirtueOwner(); if (regType != Server.Guilds.GuildType.Regular && (reg is Battle.BattleVirtueRegion || checkType != Server.Guilds.GuildType.Regular) && regType != checkType) { return(!reg.IsDisabled()); } } return(false); }