public override void OnDoubleClick(Mobile from) { if (this.Parent != null) { return; } // check the range between the player and weapon if (!from.InRange(this.Location, this.MinFiringRange) || from.Map != this.Map) { from.SendLocalizedMessage(500446); // That is too far away. return; } if (this.Storing) { from.SendMessage("{0} being stored", this.Name); return; } if (this.Projectile == null || this.Projectile.Deleted) { from.SendMessage("{0} empty", this.Name); return; } // check if the cannon is cool enough to fire if (this.NextFiring.Seconds > 0) { from.SendMessage("Not ready yet."); return; } //new way to fire Map map = Map; if (map == null) { return; } int rx = 0, ry = 0; if (Facing == 0) { rx = -1; } else if (Facing == 1) { ry = -1; } else if (Facing == 2) { rx = 1; } else if (Facing == 3) { ry = 1; } for (int i = 1; i <= 15; ++i) { int x = X + (i * rx); int y = Y + (i * ry); int z; for (int j = -16; j <= 16; ++j) { z = from.Z + j; Point3D currentLocation = new Point3D(x, y, z); Item goldToken = new Gold(100); goldToken.Visible = false; goldToken.Map = Map; goldToken.Location = currentLocation; foreach (Item item in goldToken.GetItemsInRange(10)) { if (item is BaseShip) { BaseShip target = (BaseShip)item; //Console.WriteLine("attacking {0} at {1}:{2}", multiitem, tileloc, ((StaticTarget)targeted).Location); // may have to reconsider the use tileloc vs target loc //m_cannon.AttackTarget(from, multiitem, ((StaticTarget)targeted).Location); if (target != this.Transport) { goldToken.Delete(); return; } } } goldToken.Delete(); } z = map.GetAverageZ(x, y); Point3D currentLocation2 = new Point3D(x, y, z); Item goldToken2 = new Gold(100); goldToken2.Visible = false; goldToken2.Map = Map; goldToken2.Location = currentLocation2; foreach (Item item in goldToken2.GetItemsInRange(10)) { if (item is BaseShip) { BaseShip target = (BaseShip)item; //Console.WriteLine("attacking {0} at {1}:{2}", multiitem, tileloc, ((StaticTarget)targeted).Location); // may have to reconsider the use tileloc vs target loc //m_cannon.AttackTarget(from, multiitem, ((StaticTarget)targeted).Location); if (target != this.Transport) { goldToken2.Delete(); return; } } } goldToken2.Delete(); } }
public override void OnDoubleClick(Mobile from) { if (this.Parent != null) return; // check the range between the player and weapon if (!from.InRange(this.Location, this.MinFiringRange) || from.Map != this.Map) { from.SendLocalizedMessage(500446); // That is too far away. return; } if (this.Storing) { from.SendMessage("{0} being stored", this.Name); return; } if (this.Projectile == null || this.Projectile.Deleted) { from.SendMessage("{0} empty", this.Name); return; } // check if the cannon is cool enough to fire if (this.NextFiring.Seconds > 0) { from.SendMessage("Not ready yet."); return; } //new way to fire Map map = Map; if ( map == null ) return; int rx = 0, ry = 0; if ( Facing == 0 ) rx = -1; else if ( Facing == 1 ) ry = -1; else if ( Facing == 2 ) rx = 1; else if ( Facing == 3 ) ry = 1; for ( int i = 1; i <= 15; ++i ) { int x = X + (i*rx); int y = Y + (i*ry); int z; for ( int j = -16; j <= 16; ++j ) { z = from.Z + j; Point3D currentLocation = new Point3D( x, y, z ); Item goldToken = new Gold(100); goldToken.Visible = false; goldToken.Map = Map; goldToken.Location = currentLocation; foreach (Item item in goldToken.GetItemsInRange(10)) if (item is BaseShip) { BaseShip target = (BaseShip) item; //Console.WriteLine("attacking {0} at {1}:{2}", multiitem, tileloc, ((StaticTarget)targeted).Location); // may have to reconsider the use tileloc vs target loc //m_cannon.AttackTarget(from, multiitem, ((StaticTarget)targeted).Location); if (target != this.Transport) { goldToken.Delete(); return; } } goldToken.Delete(); } z = map.GetAverageZ( x, y ); Point3D currentLocation2 = new Point3D( x, y, z ); Item goldToken2 = new Gold(100); goldToken2.Visible = false; goldToken2.Map = Map; goldToken2.Location = currentLocation2; foreach (Item item in goldToken2.GetItemsInRange(10)) if (item is BaseShip) { BaseShip target = (BaseShip) item; //Console.WriteLine("attacking {0} at {1}:{2}", multiitem, tileloc, ((StaticTarget)targeted).Location); // may have to reconsider the use tileloc vs target loc //m_cannon.AttackTarget(from, multiitem, ((StaticTarget)targeted).Location); if (target != this.Transport) { goldToken2.Delete(); return; } } goldToken2.Delete(); } }