public bool CheckLooting(Mobile from) { try { if (from.AccessLevel == AccessLevel.Player) { RegionControl regstone = null; CustomRegion reg = null; if (this.Deleted == false) { reg = CustomRegion.FindDRDTRegion(this); } 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); }
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 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 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 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); }
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); }