private int Verify(BaseDoor door) { if (door.RequiredSkill > (int)(From.Skills.Tinkering.Value)) { return(1); } if (door == null || door.HasLock == false) { return(1); } if (From.Map != door.Map || !From.InRange(door.GetWorldLocation(), 1)) { return(1); } if (!door.IsAccessibleTo(From)) { return(1); } if (door.Locked) { return(1); } if (door.Open == false) { return(1); } return(0); }
private string Message(BaseDoor door) { if (door.RequiredSkill > (int)(From.Skills.Tinkering.Value)) { return("You have no idea how to work this lock."); } if (door == null || door.HasLock == false) { return("This door doesn't have a lock."); } if (From.Map != door.Map || !From.InRange(door.GetWorldLocation(), 1)) { return("That is too far away."); } if (!door.IsAccessibleTo(From)) { return("That is inaccessable."); } if (door.Locked) { return("You must target an unlocked door."); } if (door.Open == false) { return("You must target an open door."); } return(null); }
protected override void OnTick() { if (m_Door != null) { Effects.PlaySound(m_Door.GetWorldLocation(), m_Door.Map, m_Sound); } if (++count >= 2) { Stop(); } }
private int Verify(BaseDoor door) { if (door is BaseHouseDoor) { BaseHouse house = ((BaseHouseDoor)door).FindHouse(); if (house != null) { if (!house.IsFriend(From)) { return(1); } } } if (door == null || door.HasLock) { return(1); } if (From.Map != door.Map || !From.InRange(door.GetWorldLocation(), 1)) { return(1); } if (!door.IsAccessibleTo(From)) { return(1); } if (door.Locked) { return(1); } if (!door.Open) { return(1); } if (door.IsPublic) { return(1); } return(0); }
private string Message(BaseDoor door) { if (door is BaseHouseDoor) { BaseHouse house = ((BaseHouseDoor)door).FindHouse(); if (house != null) { if (!house.IsFriend(From)) { return("You do not have permission to modify this lock."); } } } if (door == null || door.HasLock) { return("This door already has a lock."); } if (From.Map != door.Map || !From.InRange(door.GetWorldLocation(), 1)) { return("That is too far away."); } if (!door.IsAccessibleTo(From)) { return("That is inaccessable."); } if (door.Locked) { return("You must target an unlocked door."); } if (!door.Open) { return("You must target an open door."); } if (door.IsPublic) { return("You may not install locks on public buildings."); } return(null); }
public static AddonFitResult CheckDoors(Point3D p, int height, BaseHouse house) { List <Item> doors = house.Doors; for (int i = 0; i < doors.Count; i++) { BaseDoor door = doors[i] as BaseDoor; Point3D doorLoc = door.GetWorldLocation(); int doorHeight = door.ItemData.CalcHeight; if (Utility.InRange(doorLoc, p, 1) && (p.Z == doorLoc.Z || ((p.Z + height) > doorLoc.Z && (doorLoc.Z + doorHeight) > p.Z))) { return(AddonFitResult.DoorTooClose); } } return(AddonFitResult.Valid); }
public static AddonFitResult CheckDoors(Point3D p, int height, IHouse house) { ArrayList doors = house.Doors; for (int i = 0; i < doors.Count; i++) { BaseDoor door = doors[i] as BaseDoor; if (door != null && door.Open) { return(AddonFitResult.DoorsNotClosed); } Point3D doorLoc = door.GetWorldLocation(); int doorHeight = door.ItemData.CalcHeight; if (doorLoc.InRange(p, 1) && (p.Z == doorLoc.Z || ((p.Z + height) > doorLoc.Z && (doorLoc.Z + doorHeight) > p.Z))) { return(AddonFitResult.DoorTooClose); } } return(AddonFitResult.Valid); }
public void Target(object o) { if (o is Item) { Item targ = (Item)o; if (targ is LockableContainer) { LockableContainer box = (LockableContainer)targ; if (Multis.BaseHouse.CheckLockedDownOrSecured(box)) { // You cannot cast this on a locked down item. Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 501761); } else if (box.Locked || box.LockLevel == 0 || box is ParagonChest) { // Target must be an unlocked chest. Caster.SendLocalizedMessage(501762); } else if (CheckSequence()) { SpellHelper.Turn(Caster, box); Point3D loc = box.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create(loc, box.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5020, 0); Effects.PlaySound(loc, box.Map, 0x1FA); // The chest is now locked! Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501763); box.LockLevel = (int)(Caster.Skills[SkillName.Magery].Value); if (box.LockLevel > 90) { box.LockLevel = 90; } if (box.LockLevel < 0) { box.LockLevel = 0; } box.MaxLockLevel = box.LockLevel + 20; box.RequiredSkill = box.LockLevel; //box.LockLevel = -255; // signal magic lock box.Locked = true; } } else if (targ is BaseDoor) { BaseDoor door = (BaseDoor)targ; if (Server.Items.DoorType.IsDungeonDoor(door)) { if (door.Locked == true) { Caster.SendMessage("That door is already locked!"); } else { SpellHelper.Turn(Caster, door); Point3D loc = door.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create(loc, door.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5020, 0); Effects.PlaySound(loc, door.Map, 0x1FA); Caster.SendMessage("That door is now locked!"); door.Locked = true; Server.Items.DoorType.LockDoors(door); new InternalTimer(door, Caster).Start(); } } else { Caster.SendMessage("This spell has no effect on that!"); } } else { Caster.SendMessage("This spell has no effect on that!"); } } else if (o is PlayerMobile) { Caster.SendMessage("That soul seems too strong to trap in the flask!"); } else if (o is BaseCreature) { BaseCreature bc = (BaseCreature)o; if (!bc.Alive) { Caster.SendMessage("You cannot trap something that is dead!"); } else if (bc.Controlled is LockedCreature) { Caster.SendMessage("That creature cannot be trapped again!"); } else if (bc.Controlled == true) { Caster.SendMessage("That is under the control of another!"); } else if (bc.EmoteHue == 505 || bc.ControlSlots >= 100) // SUMMON QUEST AND QUEST MONSTERS { Server.Misc.IntelligentAction.FizzleSpell(Caster); Caster.SendMessage("You are not powerful enough to trap that!"); } else if (Caster.Backpack.FindItemByType(typeof(IronFlask)) == null) { Caster.SendMessage("You need an empty iron flask to trap them!"); } else { int level = Server.Misc.DifficultyLevel.GetCreatureLevel((Mobile)o) + 10; int magery = (int)(Caster.Skills[SkillName.Magery].Value); if (magery >= level) { int success = 10 + (magery - level); if (Utility.RandomMinMax(1, 100) > success) { Server.Misc.IntelligentAction.FizzleSpell(Caster); Caster.SendMessage("You fail to trap them in the flask!"); } else { Item flask = Caster.Backpack.FindItemByType(typeof(IronFlask)); if (flask != null) { flask.Consume(); } Caster.SendMessage("You trap " + bc.Name + " in the flask!"); IronFlaskFilled bottle = new IronFlaskFilled(); int hitpoison = 0; if (bc.HitPoison == Poison.Lesser) { hitpoison = 1; } else if (bc.HitPoison == Poison.Regular) { hitpoison = 2; } else if (bc.HitPoison == Poison.Greater) { hitpoison = 3; } else if (bc.HitPoison == Poison.Deadly) { hitpoison = 4; } else if (bc.HitPoison == Poison.Lethal) { hitpoison = 5; } int immune = 0; if (bc.PoisonImmune == Poison.Lesser) { immune = 1; } else if (bc.PoisonImmune == Poison.Regular) { immune = 2; } else if (bc.PoisonImmune == Poison.Greater) { immune = 3; } else if (bc.PoisonImmune == Poison.Deadly) { immune = 4; } else if (bc.PoisonImmune == Poison.Lethal) { immune = 5; } bottle.TrappedName = bc.Name; bottle.TrappedTitle = bc.Title; bottle.TrappedBody = bc.Body; bottle.TrappedBaseSoundID = bc.BaseSoundID; bottle.TrappedHue = bc.Hue; // TURN HUMANOIDS TO GHOSTS SO I DON'T NEED TO WORRY ABOUT CLOTHES AND GEAR if (bc.Body == 400 || bc.Body == 401 || bc.Body == 605 || bc.Body == 606) { bottle.TrappedBody = 0x3CA; bottle.TrappedHue = 0x9C4; bottle.TrappedBaseSoundID = 0x482; } bottle.TrappedAI = 2; if (bc.AI == AIType.AI_Mage) { bottle.TrappedAI = 1; } bottle.TrappedStr = bc.RawStr; bottle.TrappedDex = bc.RawDex; bottle.TrappedInt = bc.RawInt; bottle.TrappedHits = bc.HitsMax; bottle.TrappedStam = bc.StamMax; bottle.TrappedMana = bc.ManaMax; bottle.TrappedDmgMin = bc.DamageMin; bottle.TrappedDmgMax = bc.DamageMax; bottle.TrappedColdDmg = bc.ColdDamage; bottle.TrappedEnergyDmg = bc.EnergyDamage; bottle.TrappedFireDmg = bc.FireDamage; bottle.TrappedPhysicalDmg = bc.PhysicalDamage; bottle.TrappedPoisonDmg = bc.PoisonDamage; bottle.TrappedColdRst = bc.ColdResistSeed; bottle.TrappedEnergyRst = bc.EnergyResistSeed; bottle.TrappedFireRst = bc.FireResistSeed; bottle.TrappedPhysicalRst = bc.PhysicalResistanceSeed; bottle.TrappedPoisonRst = bc.PoisonResistSeed; bottle.TrappedVirtualArmor = bc.VirtualArmor; bottle.TrappedCanSwim = bc.CanSwim; bottle.TrappedCantWalk = bc.CantWalk; bottle.TrappedSkills = level + 5; bottle.TrappedPoison = hitpoison; bottle.TrappedImmune = immune; bottle.TrappedAngerSound = bc.GetAngerSound(); bottle.TrappedIdleSound = bc.GetIdleSound(); bottle.TrappedDeathSound = bc.GetDeathSound(); bottle.TrappedAttackSound = bc.GetAttackSound(); bottle.TrappedHurtSound = bc.GetHurtSound(); Caster.BoltEffect(0); Caster.PlaySound(0x665); Caster.AddToBackpack(bottle); bc.BoltEffect(0); bc.PlaySound(0x665); bc.Delete(); } } else { Server.Misc.IntelligentAction.FizzleSpell(Caster); Caster.SendMessage("You are not powerful enough to trap that!"); } } } FinishSequence(); }