public bool SetTripwire(VvVTrapKit deed, Point3D myLocation, Point3D wireLocation, Map map) { Links = new List <VvVTrap>(); MovementPath path = new MovementPath(myLocation, wireLocation, map); int x = myLocation.X; int y = myLocation.Y; if (path.Success) { for (int i = 0; i < path.Directions.Length; ++i) { Movement.Movement.Offset(path.Directions[i], ref x, ref y); Point3D p = new Point3D(x, y, Map.GetAverageZ(x, y)); if (p == myLocation) { continue; } VvVTrap trap = deed.ConstructTrap(Owner); Links.Add(trap); trap.ParentTrap = this; trap.MoveToWorld(p, map); } return(true); } return(false); }
public void TryDeployTrap(Mobile m, Point3D trapLocation) { VvVTrap trap = null; if (DeploymentType == DeploymentType.Tripwire) { m.SendLocalizedMessage(1155410); // Target the location to run the tripwire... m.BeginTarget(5, true, TargetFlags.None, (from, targeted) => { IPoint3D p = targeted as IPoint3D; if (p != null) { Point3D point = new Point3D(p); //TODO: Rules? For now, must be within 3 tiles of trap if (!Utility.InRange(point, trapLocation, 3) || point == trapLocation) { m.SendLocalizedMessage(1011577); // This is an invalid location. } else { trap = ConstructTrap(m); if (!trap.SetTripwire(this, trapLocation, point, m.Map)) { trap.Delete(); m.SendLocalizedMessage(1042261); // You cannot place the trap there. return; } else { m.PrivateOverheadMessage(Network.MessageType.Regular, 1154, 1155411, m.NetState); // *You successfully lay the tripwire* } } } else { m.SendLocalizedMessage(1042261); // You cannot place the trap there. } }); } else { m.PrivateOverheadMessage(Network.MessageType.Regular, 1154, 1155412, m.NetState); // *You successfully set the trap* trap = ConstructTrap(m); } if (trap != null) { trap.MoveToWorld(trapLocation, m.Map); Delete(); ViceVsVirtueSystem.Instance.Battle.Traps.Add(trap); AddToCooldown(m); } }