public void Target(TrapableContainer item) { if (!Caster.CanSee(item)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap) { base.DoFizzle(); } else if (CheckSequence()) { SpellHelper.Turn(Caster, item); item.TrapType = TrapType.MagicTrap; item.TrapPower = Core.AOS ? Utility.RandomMinMax(10, 50) : 1; item.TrapLevel = 0; Point3D loc = item.GetWorldLocation(); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X + 1, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X, loc.Y - 1, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X - 1, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X, loc.Y + 1, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc.X, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0, 0, 0, 5014); Effects.PlaySound(loc, item.Map, 0x1EF); } FinishSequence(); }
public void Target(TrapableContainer item) { if (!Caster.CanSee(item)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (item.Trapped && item.TrapType != TrapType.MagicTrap) { base.DoFizzle(); } else if (CheckSequence()) { SpellHelper.Turn(Caster, item); Point3D loc = item.GetWorldLocation(); Effects.SendLocationParticles(EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5015); Effects.PlaySound(loc, item.Map, 0x1F0); item.TrapType = TrapType.None; item.Trapped = false; item.TrapPower = 0; } FinishSequence(); }
public void Target(TrapableContainer item) { if (!Caster.CanSee(item)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap) { base.DoFizzle(); } else if (CheckSequence()) { SpellHelper.Turn(Caster, item); Point3D loc = item.GetWorldLocation(); Effects.SendLocationParticles(EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5015); Effects.PlaySound(loc, item.Map, 0x1F0); TreasureMapChest chest = item as TreasureMapChest; double skill = Caster.Skills[SkillName.Magery].Value; if ((chest != null && skill >= 100.0 && chest.TrapLevel <= 2) || (chest == null && ((item.TrapCreator == null && item.TrapLevel <= (int)(skill / 33.3)) || (item.TrapCreator != null && item.TrapLevel <= (int)(skill / 20.0))))) { //Treasure Chests: Must be GM, up to level 2 //Non Treasure Chests: Up to level 3, Player constructed, up to level 5. item.TrapType = TrapType.None; item.TrapPower = 0; item.TrapLevel = 0; } } FinishSequence(); }
public void Target(TrapableContainer item) { if (!Caster.CanSee(item)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { int nTrapLevel = item.TrapLevel * 12; if ((int)(Caster.Skills[SkillName.Magery].Value) > nTrapLevel) { Point3D loc = item.GetWorldLocation(); Effects.SendLocationParticles(EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5015, 0); Effects.PlaySound(loc, item.Map, 0x1F0); Caster.SendMessage("Any traps on that container are now disabled."); item.TrapType = TrapType.None; item.TrapPower = 0; item.TrapLevel = 0; } else { Caster.SendMessage("That trap seems to complicated to be affected by your magic."); base.DoFizzle(); } } FinishSequence(); }
public void Target(TrapableContainer item) { if (!Caster.CanSee(item)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (item.TrapLevel > (int)(Caster.Skills[SkillName.Necromancy].Value)) { base.DoFizzle(); } else if (item.TrapType == TrapType.None) { Caster.PrivateOverheadMessage(MessageType.Regular, 0x14C, false, "That does not seem to be trapped.", Caster.NetState); } else if (CheckSequence()) { SpellHelper.Turn(Caster, item); Point3D loc = item.GetWorldLocation(); Effects.SendLocationParticles(EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5015); Effects.PlaySound(loc, item.Map, 0x37D); item.TrapType = TrapType.None; item.TrapPower = 0; item.TrapLevel = 0; } FinishSequence(); }
public void Target(TrapableContainer item) { Item checkBackpack = Caster.Backpack.FindItemByType(typeof(TrapableContainer)); if (!Caster.CanSee(item)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (!CheckLineOfSight(item) && checkBackpack == null) { this.DoFizzle(); Caster.SendAsciiMessage("Target is not in line of sight"); } else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap) { base.DoFizzle(); } else if (CheckSequence()) { SpellHelper.Turn(Caster, item); Point3D loc = item.GetWorldLocation(); Effects.SendLocationParticles(EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5015); Effects.PlaySound(loc, item.Map, 0x1F0); item.TrapType = TrapType.None; item.TrapPower = 0; item.TrapLevel = 0; } FinishSequence(); }
public void Target(TrapableContainer item) { if (!Caster.CanSee(item)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap) { base.DoFizzle(); } else if (CheckSequence()) { SpellHelper.Turn(Caster, item); var pouch = item as ChargeableTrapPouch; if (pouch != null) { if (pouch.Charges == 0) { item.TrapType = TrapType.MagicTrap; item.TrapPower = Caster.EraAOS ? Utility.RandomMinMax(10, 50) : 4; //Change to depend on magery skill? item.TrapLevel = 0; pouch.Charges++; } else if (pouch.Charges < 30) { pouch.Charges++; } else { Caster.SendMessage(54, "This pouch can only hold 30 charges."); } } else { item.TrapType = TrapType.MagicTrap; item.TrapPower = Caster.EraAOS ? Utility.RandomMinMax(10, 50) : 4; //Change to depend on magery skill? item.TrapLevel = 0; } Point3D loc = item.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create(new Point3D(loc.X + 1, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles( EffectItem.Create(new Point3D(loc.X, loc.Y - 1, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles( EffectItem.Create(new Point3D(loc.X - 1, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles( EffectItem.Create(new Point3D(loc.X, loc.Y + 1, loc.Z), item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 9502); Effects.SendLocationParticles( EffectItem.Create(new Point3D(loc.X, loc.Y, loc.Z), item.Map, EffectItem.DefaultDuration), 0, 0, 0, 5014); Effects.PlaySound(loc, item.Map, 0x1EF); } FinishSequence(); }
public void Target(TrapableContainer item) { if (!Caster.CanSee(item)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap) { base.DoFizzle(); } else if (Core.AOS && !item.IsChildOf(Caster.Backpack)) { Caster.SendLocalizedMessage(1045158); // You must have the item in your backpack to target it. } else if (CheckSequence()) { Point3D loc; SpellHelper.Turn(Caster, item); item.TrapType = TrapType.MagicTrap; item.TrapPower = Core.AOS ? Utility.RandomMinMax(10, 50) : 1; item.TrapLevel = 0; if (!item.IsChildOf(Caster.Backpack)) { loc = item.GetWorldLocation(); } else { loc = Caster.Location; } loc.X++; NewTimer(item, loc, Caster.Map, 0); loc.X--; loc.Y--; NewTimer(item, loc, Caster.Map, .75); loc.X--; loc.Y++; NewTimer(item, loc, Caster.Map, 1.5); loc.X++; loc.Y++; NewTimer(item, loc, Caster.Map, 2.25); Effects.PlaySound(loc, item.Map, 0x1EF); } FinishSequence(); }
private void OnTrapTarget(TrapType type, object target) { if (m_Mobile.Deleted || !m_Mobile.Alive || !CheckTool()) { End(); return; } if (!HasResources(1, typeof(TrapableContainer))) { OnNotEnoughResources(); End(); return; } if (target is TrapableContainer && !(target is Pouch)) { TrapableContainer cont = (TrapableContainer)target; if (cont.RootParent != m_Mobile && cont.RootParent != null) { End(); m_Mobile.SendAsciiMessage("That does not belong to you."); return; } else if (!m_Mobile.InRange(cont.GetWorldLocation(), 1)) { End(); m_Mobile.SendAsciiMessage("That is too far away."); return; } else if (cont.Trapped) { End(); m_Mobile.SendAsciiMessage("You can only place one trap at a time."); return; } else if (cont is LockableContainer && ((LockableContainer)cont).Locked) { End(); m_Mobile.SendAsciiMessage("You cannot trap a locked container."); return; } Container pack = m_Mobile.Backpack; if (pack == null) { End(); m_Mobile.SendAsciiMessage("You need additional resources to create the trap."); return; } Item xres = null; switch (type) { case TrapType.DartTrap: xres = pack.FindItemByType(typeof(Bolt)); if (xres == null) { m_Mobile.SendAsciiMessage("You need a crossbow bolt to make that trap."); } else { cont.TrapPower = (int)(m_Mobile.Skills[SkillName.Tinkering].Value / 10.0); } break; case TrapType.PoisonTrap: xres = pack.FindItemByType(typeof(BasePoisonPotion)); if (xres == null) { m_Mobile.SendAsciiMessage("You need a green potion to make that trap."); } else { cont.TrapPower = ((BasePoisonPotion)xres).Poison.Level + 1; } break; case TrapType.ExplosionTrap: xres = pack.FindItemByType(typeof(BaseExplosionPotion)); if (xres == null) { m_Mobile.SendAsciiMessage("You need a purple potion to make that trap."); } else { //BaseExplosionPotion pot = (BaseExplosionPotion)xres; //cont.TrapPower = (int)(Utility.RandomMinMax( pot.MinDamage, pot.MaxDamage ) * ( m_Mobile.Skills[SkillName.Tinkering].Value / 10.0 )); if (xres is ExplosionPotion) { cont.TrapPower = 3; } else if (xres is GreaterExplosionPotion) { cont.TrapPower = 5; } else //if ( xres is LesserExplosionPotion ) { cont.TrapPower = 1; } } break; } if (xres == null || xres.Amount < 1 || !ConsumeResources(1, typeof(TrapableContainer))) { OnNotEnoughResources(); End(); return; } xres.Consume(1); if (m_Mobile.CheckSkill(SkillName.Tinkering, 0, 100)) { cont.TrapType = type; cont.Trapped = true; cont.Trapper = m_Mobile; m_Mobile.SendAsciiMessage("You carefully set a trap on the container..."); } else { cont.TrapPower = 0; m_Mobile.SendAsciiMessage("You failed to set the trap."); } } else { m_Mobile.SendAsciiMessage("You can't trap that."); } End(); }