public RegionControlGump(RegionControl r) : base(25, 50) { m_Controller = r; Closable = true; Dragable = true; Resizable = false; AddPage(0); //x, y, width, high AddBackground(23, 32, 412, 186, 9270); AddAlphaRegion(19, 29, 418, 193); AddLabel(55, 60, 1152, "CUSTOM REGIONS IN A BOX"); AddLabel(75, 90, 1152, "Add Region Area"); AddButton(55, 92, 0x845, 0x846, 3, GumpButtonType.Reply, 0); AddLabel(75, 110, 1152, "Edit Restricted Spells"); AddButton(55, 112, 0x845, 0x846, 1, GumpButtonType.Reply, 0); AddLabel(75, 130, 1152, "Edit Restricted Skills"); AddButton(55, 132, 0x845, 0x846, 2, GumpButtonType.Reply, 0); AddLabel(75, 150, 1152, "Edit Other Properties"); AddButton(55, 152, 0x845, 0x846, 4, GumpButtonType.Reply, 0); AddLabel(75, 170, 1152, "See Region Bounds"); AddButton(55, 172, 0x845, 0x846, 5, GumpButtonType.Reply, 0); AddImage(353, 54, 3953); AddImage(353, 180, 3955); }
public LogoutMove(Mobile m_Mobile, RegionControl controller, TimeSpan delay) : base(delay) { Priority = TimerPriority.OneSecond; m = m_Mobile; m_Controller = controller; ((PlayerMobile)m).CurrentLogoutMoveTimer = this; }
public AreaGump(RegionControl b) : base(25, 300) { r = (RegionControl)b; Closable = true; Dragable = true; Resizable = false; AddPage(0); AddBackground(23, 32, 412, 256, 9270); AddAlphaRegion(19, 29, 418, 263); AddLabel(116, 50, 1152, "Enter Corridanates for new region"); AddTextEntry(140, 77 + 25, 1152, 20, 0xFA5, 0, "0"); AddTextEntry(140, 77 + 50, 1152, 20, 0xFA5, 1, "0"); AddTextEntry(140, 77 + 75, 1152, 20, 0xFA5, 2, "0"); AddTextEntry(140, 77 + 100, 1152, 20, 0xFA5, 3, "0"); AddLabel(105, 77 + 25, 1152, "X1:"); AddLabel(105, 77 + 50, 1152, "Y1:"); AddLabel(105, 77 + 75, 1152, "X2:"); AddLabel(105, 77 + 100, 1152, "Y2:"); AddButton(105, 77 + 125, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0); AddHtmlLocalized(140, 77 + 125, 90, 80, 1046362, false, false); // Yes }
public static bool IsInIOBRegion(Mobile m) { try { RegionControl regstone = null; //check if there is a DRDT region and also if were in a house and if so use the DRDT rules CustomRegion inHouse = null; inHouse = CustomRegion.FindDRDTRegion(m); if (inHouse != null) { regstone = inHouse.GetRegionControler(); } if ((regstone != null && regstone.IOBAlign != IOBAlignment.None) || (regstone != null && regstone.IOBZone)) { return(true); } } catch (NullReferenceException e) { LogHelper.LogException(e); Console.WriteLine("{0}", e); } catch { Console.WriteLine("Caught Exception in IOBRegions::IsInIOBRegion()"); } return(IsInIOBRegion(m.Location.X, m.Location.Y)); }
public CustomRegion(RegionControl m, Map map) : base("", "Custom Region", map, typeof(WarriorGuard)) { LoadFromXml = false; m_Controller = m; }
public MovePlayerTimer(Mobile m_Mobile, RegionControl controller) : base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0)) { Priority = TimerPriority.FiftyMS; m = m_Mobile; m_Controller = controller; }
public CustomRegion(RegionControl control) : base(control.RegionName, control.Map, control.RegionPriority, control.RegionArea) { Disabled = !control.IsGuarded; Music = control.Music; m_Controller = control; }
public override bool OnDeath(Mobile m) { try { //check if there is a DRDT region below the houses, and if so use its rules RegionControl regstone = null; CustomRegion inHouse = null; inHouse = CustomRegion.FindDRDTRegion(m); if (inHouse != null) { regstone = inHouse.GetRegionControler(); } if (regstone != null && regstone.NoMurderZone) { foreach (AggressorInfo ai in m.Aggressors) { ai.CanReportMurder = false; } } } catch (NullReferenceException e) { LogHelper.LogException(e); Console.WriteLine("{0} Caught exception.", e); } catch (Exception ex) { LogHelper.LogException(ex); } return(base.OnDeath(m)); }
public override bool OnBeginSpellCast(Mobile from, ISpell s) { try { //check if there is a DRDT region below the houses, and if so use its rules RegionControl regstone = null; CustomRegion inHouse = null; inHouse = CustomRegion.FindDRDTRegion(from); if (inHouse != null) { regstone = inHouse.GetRegionControler(); } if (regstone != null) { return(inHouse.OnBeginSpellCast(from, s)); } } catch (NullReferenceException e) { LogHelper.LogException(e); Console.WriteLine("{0} Caught exception.", e); } catch (Exception ex) { LogHelper.LogException(ex); } return(base.OnBeginSpellCast(from, s)); }
public override bool OnSkillUse(Mobile m, int skill) { try { //check if there is a DRDT region below the houses, and if so use its rules RegionControl regstone = null; CustomRegion inHouse = null; if (m != null) { inHouse = CustomRegion.FindDRDTRegion(m); } if (inHouse != null) { regstone = inHouse.GetRegionControler(); } if (m != null && regstone != null) { return(inHouse.OnSkillUse(m, skill)); } } catch (NullReferenceException e) { LogHelper.LogException(e); Console.WriteLine("{0} Caught exception.", e); } catch (Exception ex) { LogHelper.LogException(ex); } return(base.OnSkillUse(m, skill)); }
public RegionControlGump(RegionControl r) : base(25, 25) { m_Controller = r; Closable = true; Dragable = true; Resizable = false; AddPage(0); AddBackground(23, 32, 590, 270, 9270); AddAlphaRegion(19, 29, 590, 280); AddButton(55, 46, 5569, 5570, (int)Buttons.SpellButton, GumpButtonType.Reply, 0); AddButton(345, 46, 5581, 5582, (int)Buttons.SkillButton, GumpButtonType.Reply, 0); AddButton(50, 128, 7006, 7006, (int)Buttons.AreaButton, GumpButtonType.Reply, 0); AddButton(50, 205, 7006, 7006, (int)Buttons.EnterAreaButton, GumpButtonType.Reply, 0); AddButton(340, 128, 7006, 7006, (int)Buttons.AreaInnButton, GumpButtonType.Reply, 0); AddButton(340, 205, 7006, 7006, (int)Buttons.EnterInnAreaButton, GumpButtonType.Reply, 0); AddLabel(152, 70, 1152, "Edit Restricted Spells"); AddLabel(452, 70, 1152, "Edit Restricted Skills"); AddLabel(152, 157, 1152, "Add Region Area"); AddLabel(152, 235, 1152, "Enter New Region X/Y"); AddLabel(452, 157, 1152, "Add Inn Area"); AddLabel(452, 235, 1152, "Enter New Inn X/Y"); AddImage(353, 54, 3953); AddImage(353, 180, 3955); }
public override bool EquipItem(Mobile m, Item item) { try { //check if there is a DRDT region below the houses, and if so use its rules RegionControl regstone = null; CustomRegion inHouse = null; if (m != null) { inHouse = CustomRegion.FindDRDTRegion(m); } if (inHouse != null) { regstone = inHouse.GetRegionControler(); } if (regstone != null) { return(inHouse.EquipItem(m, item)); } } catch (NullReferenceException e) { LogHelper.LogException(e); Console.WriteLine("{0} Caught exception.", e); } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } return(true); }
public CustomRegion(RegionControl control) : base(control.RegionName, control.Map, control.RegionPriority, control.RegionArea) { Disabled = !control.IsGuarded; Music = control.Music; m_Controller = control; EventSink.Disconnected += OnPlayerDisconnected; EventSink.Login += OnPlayerLogin; }
public bool CheckHSequence(Mobile target) { try { RegionControl regstone = null; CustomRegion reg = null; if (target != null) { reg = CustomRegion.FindDRDTRegion(target); } if (reg != null) { regstone = reg.GetRegionControler(); } //if your in a region area spells will fail if disallowed, prevents the run outside of area precast //run back into region then release spell ability if (m_Caster != null && target != null && m_Caster.Spell != null && m_Caster.Region != target.Region && regstone != null && (regstone.IsRestrictedSpell(m_Caster.Spell, m_Caster) || regstone.IsMagicIsolated) && m_Caster.AccessLevel == AccessLevel.Player && ((m_Caster is BaseCreature && !regstone.RestrictCreatureMagic) || m_Caster is PlayerMobile)) { m_State = SpellState.None; if (m_Caster.Spell == this) { m_Caster.Spell = null; } Targeting.Target.Cancel(m_Caster); m_Caster.SendMessage("You cannot cast your spell into that area."); return(false); } } catch (NullReferenceException e) { LogHelper.LogException(e); Console.WriteLine("{0} Caught exception.", e); } catch (Exception ex) { LogHelper.LogException(ex); } if (!target.Alive) { m_Caster.SendLocalizedMessage(501857); // This spell won't work on that! return(false); } else if (Caster.CanBeHarmful(target) && CheckSequence()) { Caster.DoHarmful(target); return(true); } else { return(false); } }
public override bool OnDoubleClick(Mobile from, object o) { try { //check if there is a DRDT region below the houses, and if so use its rules RegionControl regstone = null; CustomRegion inHouse = null; if (from != null) { inHouse = CustomRegion.FindDRDTRegion(from); } if (inHouse != null) { regstone = inHouse.GetRegionControler(); } if (regstone != null) { return(inHouse.OnDoubleClick(from, o)); } } catch (NullReferenceException e) { LogHelper.LogException(e); Console.WriteLine("{0} Caught exception.", e); } catch (Exception ex) { LogHelper.LogException(ex); } if (o is Container) { Container c = (Container)o; SecureAccessResult res = m_House.CheckSecureAccess(from, c); switch (res) { case SecureAccessResult.Insecure: break; case SecureAccessResult.Accessible: return(true); case SecureAccessResult.Inaccessible: c.SendLocalizedMessageTo(from, 1010563); return(false); } } return(true); }
public static IOBAlignment GetIOBStronghold(Mobile m) { RegionControl regstone = null; //check if there is a DRDT region and also if were in a house and if so use the DRDT rules CustomRegion inHouse = null; inHouse = CustomRegion.FindDRDTRegion(m); if (inHouse != null) { regstone = inHouse.GetRegionControler(); } if (regstone != null && regstone.IOBAlign != IOBAlignment.None) { return(regstone.IOBAlign); } return(GetIOBStronghold(m.Location.X, m.Location.Y)); }
/// <summary> /// Determines if an area is within a capture area. (this will probably be deperecated) /// </summary> /// <param name="m">The mobile</param> /// <returns></returns> public static bool InCaptureArea(Mobile m) { if (m == null || m.Deleted) { return(false); } CustomRegion cr = CustomRegion.FindDRDTRegion(m); if (cr != null) { RegionControl rc = cr.GetRegionControler(); if (rc != null) { if (rc.CaptureArea) { return(true); } } } return(false); }
public RegionControlGump(RegionControl r) : base(25, 25) { m_Controller = r; Closable = true; Dragable = true; Resizable = false; AddPage(0); AddBackground(23, 32, 412, 256, 9270); AddAlphaRegion(19, 29, 418, 263); AddButton(55, 46, 5569, 5570, (int)Buttons.SpellButton, GumpButtonType.Reply, 0); AddButton(55, 128, 5581, 5582, (int)Buttons.SkillButton, GumpButtonType.Reply, 0); AddButton(50, 205, 7006, 7006, (int)Buttons.AreaButton, GumpButtonType.Reply, 0); AddLabel(152, 70, 1152, "Edit Restricted Spells"); AddLabel(152, 153, 1152, "Edit Restricted Skills"); AddLabel(152, 234, 1152, "Add Region Area"); AddImage(353, 54, 3953); AddImage(353, 180, 3955); }
public static void OnLogin(LoginEventArgs e) { // HousingRegion processing CustomRegion cr = CustomRegion.FindDRDTRegion(e.Mobile); if (cr != null) { RegionControl rc = cr.GetRegionControler(); if (rc != null) { if (rc.IsHouseRegion == true) { BaseHouse house = BaseHouse.FindHouseAt(e.Mobile); if (house != null && !house.Public && !house.IsFriend(e.Mobile)) { e.Mobile.Location = house.BanLocation; } } } } // other OnLogin processing }
public bool CheckStealing(Corpse corpse) { if (!corpse.IsCriminalAction(m_Thief)) { return(true); } try { if (m_Thief.AccessLevel == AccessLevel.Player) { RegionControl regstone = null; CustomRegion reg = null; if (corpse.Deleted == false) { reg = CustomRegion.FindDRDTRegion(corpse); } if (reg != null) { regstone = reg.GetRegionControler(); } // if this region does not allow looting, fail if (regstone != null && regstone.BlockLooting == true) { return(false); } } } catch (Exception ex) { Server.Commands.LogHelper.LogException(ex); } return(true); }
private void LbRegionSelector_SelectedIndexChanged(object sender, EventArgs e) { UpdateRegionInfo(RegionControl.FindRegionByName(lbRegionSelector.Items[0].ToString())); }
public virtual bool CheckSequence() { try { RegionControl regstone = null; CustomRegion reg = null; if (m_Caster != null) { reg = CustomRegion.FindDRDTRegion(m_Caster); } if (reg != null) { regstone = reg.GetRegionControler(); } //if your in a region area spells will fail if disallowed, prevents the run outside of area precast //run back into region then release spell ability if (m_Caster != null && m_Caster.Spell != null && regstone != null && regstone.IsRestrictedSpell(m_Caster.Spell, m_Caster) && m_Caster.AccessLevel == AccessLevel.Player && ((m_Caster is BaseCreature && !regstone.RestrictCreatureMagic) || m_Caster is PlayerMobile)) { m_State = SpellState.None; if (m_Caster.Spell == this) { m_Caster.Spell = null; } Targeting.Target.Cancel(m_Caster); if (regstone.MagicMsgFailure == null) { m_Caster.SendMessage("You cannot cast that spell here."); } else { m_Caster.SendMessage(regstone.MagicMsgFailure); } } } catch (NullReferenceException e) { LogHelper.LogException(e); Console.WriteLine("{0} Caught exception.", e); } catch (Exception ex) { LogHelper.LogException(ex); } int mana = ScaleMana(GetMana()); if (m_Caster.Deleted || !m_Caster.Alive || m_Caster.Spell != this || m_State != SpellState.Sequencing) { DoFizzle(); } else if (m_Scroll != null && !(m_Scroll is Runebook) && (m_Scroll.Amount <= 0 || m_Scroll.Deleted || m_Scroll.RootParent != m_Caster || (m_Scroll is BaseWand && (((BaseWand)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster)))) { DoFizzle(); } else if (!ConsumeReagents()) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502630); // More reagents are needed for this spell. } else if (m_Caster.Mana < mana) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana for this spell. } else if (Core.AOS && (m_Caster.Frozen || m_Caster.Paralyzed)) { m_Caster.SendLocalizedMessage(502646); // You cannot cast a spell while frozen. DoFizzle(); } else if (!CheckFizzle()) { m_Caster.Mana -= mana; if (m_Scroll is SpellScroll) { m_Scroll.Consume(); } else if (m_Scroll is BaseWand) { ((BaseWand)m_Scroll).ConsumeCharge(m_Caster); } if (m_Scroll is BaseWand) { bool m = m_Scroll.Movable; m_Scroll.Movable = false; if (ClearHandsOnCast) { m_Caster.ClearHands(); } m_Scroll.Movable = m; } else { if (ClearHandsOnCast) { m_Caster.ClearHands(); } } int karma = ComputeKarmaAward(); if (karma != 0) { Misc.Titles.AwardKarma(Caster, karma, true); } /* * if ( TransformationSpell.UnderTransformation( m_Caster, typeof( VampiricEmbraceSpell ) ) ) * { * bool garlic = false; * * for ( int i = 0; !garlic && i < m_Info.Reagents.Length; ++i ) * garlic = ( m_Info.Reagents[i] == Reagent.Garlic ); * * if ( garlic ) * { * m_Caster.SendLocalizedMessage( 1061651 ); // The garlic burns you! * AOS.Damage( m_Caster, Utility.RandomMinMax( 17, 23 ), 100, 0, 0, 0, 0 ); * } * } */ return(true); } else { DoFizzle(); } return(false); }
public RemoveAreaGump(RegionControl r) : base(25, 250) { m_Control = r; Closable = true; Dragable = true; Resizable = false; AddPage(0); AddBackground(23, 32, 412, 256, 9270); AddAlphaRegion(19, 29, 418, 263); AddLabel(186, 45, 1152, "REMOVE AREA"); //+25 between 'em. int itemsThisPage = 0; int nextPageNumber = 1; if (r.RegionArea != null) { for (int i = 0; i < r.RegionArea.Length; i++) { Rectangle3D rect = ((Rectangle3D)r.RegionArea[i]); if (itemsThisPage >= 8 || itemsThisPage == 0) { itemsThisPage = 0; if (nextPageNumber != 1) { AddButton(393, 45, 4007, 4009, 0, GumpButtonType.Page, nextPageNumber); //Forward button -> #0 } AddPage(nextPageNumber++); if (nextPageNumber != 2) { AddButton(35, 45, 4014, 4016, 1, GumpButtonType.Page, nextPageNumber - 2); //Back Button -> #1 } } AddButton(70, 75 + 25 * itemsThisPage, 4017, 4019, 100 + i, GumpButtonType.Reply, 0); //Button is 100 + i //AddLabel(116, 77 + 25*i, 0, "(1234, 5678)"); AddLabel(116, 77 + 25 * itemsThisPage, 1152, String.Format("({0}, {1}, {2})", rect.Start.X, rect.Start.Y, rect.Start.Z)); AddLabel(232, 78 + 25 * itemsThisPage, 1152, "<-->"); //AddLabel(294, 77 + 25*i, 0, "(9876, 5432)"); AddLabel(294, 77 + 25 * itemsThisPage, 1152, String.Format("({0}, {1}, {2})", rect.End.X, rect.End.Y, rect.End.Z)); itemsThisPage++; } } }
public AngelIsland(RegionControl rc, Map map) : base(rc, map) { }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Mobile) { Mobile m = (Mobile)targeted; Region r = m.Region; if (r == m.Map.DefaultRegion) { from.SendMessage("The Region is the Default region for the entire map and as such, cannot have it's bounds displayed."); return; } from.SendMessage(String.Format("That Mobile's region is of type {0}, with a priority of {1}.", r.GetType().FullName, r.Priority)); ShowRegionBounds(r, from, false, true); } else if (targeted is RegionControl) { RegionControl control = ((RegionControl)targeted); Region r = control.Region; if (control.Active) { if (control.RegionArea == null || control.RegionArea.Length == 0 || r == null) { from.SendMessage("Region area not defined for targeted RegionControl."); return; } from.SendMessage("Displaying targeted RegionControl's ACTIVE Region..."); ShowRegionBounds(r, from, true, true); } else { if (control.RegionArea == null || control.RegionArea.Length == 0) { from.SendMessage("Region area not defined for targeted RegionControl."); return; } r = new CustomRegion(control); if (r == null) { from.SendMessage("Region area not defined for targeted RegionControl."); return; } from.SendMessage("Displaying targeted RegionControl's INACTIVE Region..."); ShowRegionBounds(r, from, true, false); } } else { from.SendMessage("That is not a Mobile or a RegionControl"); } }
public CTFRegion(RegionControl rc, Map map) : base(rc, map) { Setup(); }
public static void DoCommand(CommandEventArgs e) { string output = string.Empty; List <Region> regions = Region.CreateCacheFromXML(ref output); List <RegionControl> controllers = new List <RegionControl>(); if (regions == null || regions.Count == 0) { e.Mobile.SendMessage("Regions failed to load!"); return; } foreach (Region r in regions) { //See if a DRDT region already exists for this one? Region temp = Region.GetByName(r.Name, r.Map); if (temp == null && (temp is CustomRegion)) { e.Mobile.SendMessage("Region {0} does not exist or is already a DRDT region", r.Name); continue; } RegionControl rc = null; //create new region controller if (TestCenter.Enabled && (r.Name == "Skara Brae" || new List <String>(Enum.GetNames(typeof(KinFactionCities))).Find(delegate(string s) { return(s.Equals(r.Name)); }) != null)) { rc = new Server.Engines.IOBSystem.KinCityRegionStone(); e.Mobile.SendMessage("Kin Faction Region {0} created", r.Name); } else { rc = new RegionControl(); e.Mobile.SendMessage("Region Control {0} created", r.Name); } rc.Name = r.Name; controllers.Add(rc); //upgrade this region to DRDT rc.CloneFromRegionObject(r, true); } //Now sort them alphabetically and move them to the world in rows of 7 from the mobile controllers.Sort(delegate(RegionControl rcA, RegionControl rcB) { return(rcA.Name.CompareTo(rcB.Name)); }); int x = 0; int y = 0; foreach (RegionControl rc in controllers) { Point3D current = e.Mobile.Location; current.X += x; current.Y += y; rc.MoveToWorld(current, e.Mobile.Map); x++; if (x > 7) { x = 0; y++; } } e.Mobile.SendMessage("done"); }
/// <summary> /// Initializes a new instance of the <see cref="KinCityRegion"/> class. /// </summary> /// <param name="rc">The rc.</param> /// <param name="map">The map.</param> public KinCityRegion(RegionControl rc, Map map) : base(rc, map) { Setup(); }
public TownshipRegion(RegionControl rc, Map map) : base(rc, map) { Setup(); }
public RemoveAreaGump(RegionControl r) : base(25, 300) { m_Control = r; Closable = true; Dragable = true; Resizable = false; AddPage(0); AddBackground(23, 32, 412, 256, 9270); AddAlphaRegion(19, 29, 418, 263); AddLabel(186, 45, 1152, "Remove Area"); //+25 between 'em. int itemsThisPage = 0; int nextPageNumber = 1; for (int i = 0; i < r.Coords.Count; i++) { Rectangle2D rect; if (r.Coords[i] is Rectangle2D) { rect = (Rectangle2D)r.Coords[i]; } else { continue; } if (itemsThisPage >= 8 || itemsThisPage == 0) { itemsThisPage = 0; if (nextPageNumber != 1) { AddButton(393, 45, 4007, 4009, 0, GumpButtonType.Page, nextPageNumber); //Forward button -> #0 } AddPage(nextPageNumber++); if (nextPageNumber != 2) { AddButton(35, 45, 4014, 4016, 1, GumpButtonType.Page, nextPageNumber - 2); //Back Button -> #1 } } AddButton(70, 75 + 25 * itemsThisPage, 4017, 4019, 100 + i, GumpButtonType.Reply, 0); //Button is 100 + i //AddLabel(116, 77 + 25*i, 0, "(1234, 5678)"); AddLabel(116, 77 + 25 * itemsThisPage, 1152, String.Format("({0}, {1})", rect.X, rect.Y)); AddLabel(232, 78 + 25 * itemsThisPage, 1152, "<-->"); //AddLabel(294, 77 + 25*i, 0, "(9876, 5432)"); AddLabel(294, 77 + 25 * itemsThisPage, 1152, String.Format("({0}, {1})", rect.X + rect.Width, rect.Y + rect.Height)); itemsThisPage++; } }