#W# Source and Scripts added. Added Scripts/Settings.cs to expose some basic tweak able settings.
This commit is contained in:
parent
b51c58f514
commit
3045c83799
3512 changed files with 627673 additions and 0 deletions
73
Scripts/Items/Skill Items/Fishing/FishingPole.cs
Normal file
73
Scripts/Items/Skill Items/Fishing/FishingPole.cs
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
using Server.Items;
|
||||
using Server.Engines.Harvest;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class FishingPole : Item
|
||||
{
|
||||
[Constructable]
|
||||
public FishingPole() : base( 0x0DC0 )
|
||||
{
|
||||
Layer = Layer.TwoHanded;
|
||||
Weight = 8.0;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
Point3D loc = GetWorldLocation();
|
||||
|
||||
if ( !from.InLOS( loc ) || !from.InRange( loc, 2 ) )
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3E9, 1019045 ); // I can't reach that
|
||||
else
|
||||
Fishing.System.BeginHarvesting( from, this );
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
|
||||
BaseHarvestTool.AddContextMenuEntries( from, this, list, Fishing.System );
|
||||
}
|
||||
|
||||
public override bool CheckConflictingLayer( Mobile m, Item item, Layer layer )
|
||||
{
|
||||
if ( base.CheckConflictingLayer( m, item, layer ) )
|
||||
return true;
|
||||
|
||||
if ( layer == Layer.OneHanded )
|
||||
{
|
||||
m.SendLocalizedMessage( 500214 ); // You already have something in both hands.
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public FishingPole( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version < 1 && Layer == Layer.OneHanded )
|
||||
Layer = Layer.TwoHanded;
|
||||
}
|
||||
}
|
||||
}
|
||||
114
Scripts/Items/Skill Items/Fishing/Misc/MessageInABottle.cs
Normal file
114
Scripts/Items/Skill Items/Fishing/Misc/MessageInABottle.cs
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MessageInABottle : Item
|
||||
{
|
||||
public static int GetRandomLevel()
|
||||
{
|
||||
if ( Core.AOS && 1 > Utility.Random( 25 ) )
|
||||
return 4; // ancient
|
||||
|
||||
return Utility.RandomMinMax( 1, 3 );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041080; } } // a message in a bottle
|
||||
|
||||
private Map m_TargetMap;
|
||||
private int m_Level;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Map TargetMap
|
||||
{
|
||||
get{ return m_TargetMap; }
|
||||
set{ m_TargetMap = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Level
|
||||
{
|
||||
get{ return m_Level; }
|
||||
set{ m_Level = Math.Max( 1, Math.Min( value, 4 ) ); }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public MessageInABottle() : this( Map.Trammel )
|
||||
{
|
||||
}
|
||||
|
||||
public MessageInABottle( Map map ) : this( map, GetRandomLevel() )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public MessageInABottle( Map map, int level ) : base( 0x099F )
|
||||
{
|
||||
Weight = 1.0;
|
||||
m_TargetMap = map;
|
||||
m_Level = level;
|
||||
}
|
||||
|
||||
public MessageInABottle( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 3 ); // version
|
||||
|
||||
writer.Write( (int) m_Level );
|
||||
|
||||
writer.Write( m_TargetMap );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 3:
|
||||
case 2:
|
||||
{
|
||||
m_Level = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_TargetMap = reader.ReadMap();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_TargetMap = Map.Trammel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( version < 2 )
|
||||
m_Level = GetRandomLevel();
|
||||
|
||||
if( version < 3 && m_TargetMap == Map.Tokuno )
|
||||
m_TargetMap = Map.Trammel;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
{
|
||||
ReplaceWith( new SOS( m_TargetMap, m_Level ) );
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 501891 ); // You extract the message from the bottle.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
341
Scripts/Items/Skill Items/Fishing/Misc/SOS.cs
Normal file
341
Scripts/Items/Skill Items/Fishing/Misc/SOS.cs
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable( 0x14ED, 0x14EE )]
|
||||
public class SOS : Item
|
||||
{
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( IsAncient )
|
||||
return 1063450; // an ancient SOS
|
||||
|
||||
return 1041081; // a waterstained SOS
|
||||
}
|
||||
}
|
||||
|
||||
private int m_Level;
|
||||
private Map m_TargetMap;
|
||||
private Point3D m_TargetLocation;
|
||||
private int m_MessageIndex;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsAncient
|
||||
{
|
||||
get{ return ( m_Level >= 4 ); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Level
|
||||
{
|
||||
get{ return m_Level; }
|
||||
set
|
||||
{
|
||||
m_Level = Math.Max( 1, Math.Min( value, 4 ) );
|
||||
UpdateHue();
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Map TargetMap
|
||||
{
|
||||
get{ return m_TargetMap; }
|
||||
set{ m_TargetMap = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D TargetLocation
|
||||
{
|
||||
get{ return m_TargetLocation; }
|
||||
set{ m_TargetLocation = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int MessageIndex
|
||||
{
|
||||
get{ return m_MessageIndex; }
|
||||
set{ m_MessageIndex = value; }
|
||||
}
|
||||
|
||||
public void UpdateHue()
|
||||
{
|
||||
if ( IsAncient )
|
||||
Hue = 0x481;
|
||||
else
|
||||
Hue = 0;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SOS() : this( Map.Trammel )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SOS( Map map ) : this( map, MessageInABottle.GetRandomLevel() )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SOS( Map map, int level ) : base( 0x14EE )
|
||||
{
|
||||
Weight = 1.0;
|
||||
|
||||
m_Level = level;
|
||||
m_MessageIndex = Utility.Random( MessageEntry.Entries.Length );
|
||||
m_TargetMap = map;
|
||||
m_TargetLocation = FindLocation( m_TargetMap );
|
||||
|
||||
UpdateHue();
|
||||
}
|
||||
|
||||
public SOS( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 4 ); // version
|
||||
|
||||
writer.Write( m_Level );
|
||||
|
||||
writer.Write( m_TargetMap );
|
||||
writer.Write( m_TargetLocation );
|
||||
writer.Write( m_MessageIndex );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 4:
|
||||
case 3:
|
||||
case 2:
|
||||
{
|
||||
m_Level = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_TargetMap = reader.ReadMap();
|
||||
m_TargetLocation = reader.ReadPoint3D();
|
||||
m_MessageIndex = reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_TargetMap = this.Map;
|
||||
|
||||
if ( m_TargetMap == null || m_TargetMap == Map.Internal )
|
||||
m_TargetMap = Map.Trammel;
|
||||
|
||||
m_TargetLocation = FindLocation( m_TargetMap );
|
||||
m_MessageIndex = Utility.Random( MessageEntry.Entries.Length );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( version < 2 )
|
||||
m_Level = MessageInABottle.GetRandomLevel();
|
||||
|
||||
if ( version < 3 )
|
||||
UpdateHue();
|
||||
|
||||
if( version < 4 && m_TargetMap == Map.Tokuno )
|
||||
m_TargetMap = Map.Trammel;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
{
|
||||
MessageEntry entry;
|
||||
|
||||
if ( m_MessageIndex >= 0 && m_MessageIndex < MessageEntry.Entries.Length )
|
||||
entry = MessageEntry.Entries[m_MessageIndex];
|
||||
else
|
||||
entry = MessageEntry.Entries[m_MessageIndex = Utility.Random( MessageEntry.Entries.Length )];
|
||||
|
||||
//from.CloseGump( typeof( MessageGump ) );
|
||||
from.SendGump( new MessageGump( entry, m_TargetMap, m_TargetLocation ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
|
||||
private static int[] m_WaterTiles = new int[]
|
||||
{
|
||||
0x00A8, 0x00AB,
|
||||
0x0136, 0x0137
|
||||
};
|
||||
|
||||
private static Rectangle2D[] m_BritRegions = new Rectangle2D[]{ new Rectangle2D( 0, 0, 5120, 4096 ) };
|
||||
private static Rectangle2D[] m_IlshRegions = new Rectangle2D[]{ new Rectangle2D( 1472, 272, 304, 240 ), new Rectangle2D( 1240, 1000, 312, 160 ) };
|
||||
private static Rectangle2D[] m_MalasRegions = new Rectangle2D[]{ new Rectangle2D( 1376, 1520, 464, 280 ) };
|
||||
|
||||
public static Point3D FindLocation( Map map )
|
||||
{
|
||||
if ( map == null || map == Map.Internal )
|
||||
return Point3D.Zero;
|
||||
|
||||
Rectangle2D[] regions;
|
||||
|
||||
if ( map == Map.Felucca || map == Map.Trammel )
|
||||
regions = m_BritRegions;
|
||||
else if ( map == Map.Ilshenar )
|
||||
regions = m_IlshRegions;
|
||||
else if ( map == Map.Malas )
|
||||
regions = m_MalasRegions;
|
||||
else
|
||||
regions = new Rectangle2D[]{ new Rectangle2D( 0, 0, map.Width, map.Height ) };
|
||||
|
||||
if ( regions.Length == 0 )
|
||||
return Point3D.Zero;
|
||||
|
||||
for ( int i = 0; i < 50; ++i )
|
||||
{
|
||||
Rectangle2D reg = regions[Utility.Random( regions.Length )];
|
||||
int x = Utility.Random( reg.X, reg.Width );
|
||||
int y = Utility.Random( reg.Y, reg.Height );
|
||||
|
||||
if ( !ValidateDeepWater( map, x, y ) )
|
||||
continue;
|
||||
|
||||
bool valid = true;
|
||||
|
||||
for ( int j = 1, offset = 5; valid && j <= 5; ++j, offset += 5 )
|
||||
{
|
||||
if ( !ValidateDeepWater( map, x + offset, y + offset ) )
|
||||
valid = false;
|
||||
else if ( !ValidateDeepWater( map, x + offset, y - offset ) )
|
||||
valid = false;
|
||||
else if ( !ValidateDeepWater( map, x - offset, y + offset ) )
|
||||
valid = false;
|
||||
else if ( !ValidateDeepWater( map, x - offset, y - offset ) )
|
||||
valid = false;
|
||||
}
|
||||
|
||||
if ( valid )
|
||||
return new Point3D( x, y, 0 );
|
||||
}
|
||||
|
||||
return Point3D.Zero;
|
||||
}
|
||||
|
||||
private static bool ValidateDeepWater( Map map, int x, int y )
|
||||
{
|
||||
int tileID = map.Tiles.GetLandTile( x, y ).ID;
|
||||
bool water = false;
|
||||
|
||||
for ( int i = 0; !water && i < m_WaterTiles.Length; i += 2 )
|
||||
water = ( tileID >= m_WaterTiles[i] && tileID <= m_WaterTiles[i + 1] );
|
||||
|
||||
return water;
|
||||
}
|
||||
|
||||
#if false
|
||||
private class MessageGump : Gump
|
||||
{
|
||||
public MessageGump( MessageEntry entry, Map map, Point3D loc ) : base( (640 - entry.Width) / 2, (480 - entry.Height) / 2 )
|
||||
{
|
||||
int xLong = 0, yLat = 0;
|
||||
int xMins = 0, yMins = 0;
|
||||
bool xEast = false, ySouth = false;
|
||||
string fmt;
|
||||
|
||||
if ( Sextant.Format( loc, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth ) )
|
||||
fmt = String.Format( "{0}°{1}'{2},{3}°{4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
|
||||
else
|
||||
fmt = "?????";
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 0, 0, entry.Width, entry.Height, 2520 );
|
||||
AddHtml( 38, 38, entry.Width - 83, entry.Height - 86, String.Format( entry.Message, fmt ), false, false );
|
||||
}
|
||||
}
|
||||
#else
|
||||
private class MessageGump : Gump
|
||||
{
|
||||
public MessageGump( MessageEntry entry, Map map, Point3D loc ) : base( 150, 50 )
|
||||
{
|
||||
int xLong = 0, yLat = 0;
|
||||
int xMins = 0, yMins = 0;
|
||||
bool xEast = false, ySouth = false;
|
||||
string fmt;
|
||||
|
||||
if ( Sextant.Format( loc, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth ) )
|
||||
fmt = String.Format( "{0}°{1}'{2},{3}°{4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
|
||||
else
|
||||
fmt = "?????";
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 40, 350, 300, 2520 );
|
||||
|
||||
AddHtmlLocalized( 30, 80, 285, 160, 1018326, true, true ); /* This is a message hastily scribbled by a passenger aboard a sinking ship.
|
||||
* While it is probably too late to save the passengers and crew,
|
||||
* perhaps some treasure went down with the ship!
|
||||
* The message gives the ship's last known sextant co-ordinates.
|
||||
*/
|
||||
|
||||
AddHtml( 35, 240, 230, 20, fmt, false, false );
|
||||
|
||||
AddButton( 35, 265, 4005, 4007, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 70, 265, 100, 20, 1011036, false, false ); // OKAY
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private class MessageEntry
|
||||
{
|
||||
private int m_Width, m_Height;
|
||||
private string m_Message;
|
||||
|
||||
public int Width{ get{ return m_Width; } }
|
||||
public int Height{ get{ return m_Height; } }
|
||||
public string Message{ get{ return m_Message; } }
|
||||
|
||||
public MessageEntry( int width, int height, string message )
|
||||
{
|
||||
m_Width = width;
|
||||
m_Height = height;
|
||||
m_Message = message;
|
||||
}
|
||||
|
||||
private static MessageEntry[] m_Entries = new MessageEntry[]
|
||||
{
|
||||
new MessageEntry( 280, 180, "...Ar! {0} and a fair wind! No chance... storms, though--ar! Is that a sea serp...<br><br>uh oh." ),
|
||||
new MessageEntry( 280, 215, "...been inside this whale for three days now. I've run out of food I can pick out of his teeth. I took a sextant reading through the blowhole: {0}. I'll never see my treasure again..." ),
|
||||
new MessageEntry( 280, 285, "...grand adventure! Captain Quacklebush had me swab down the decks daily...<br> ...pirates came, I was in the rigging practicing with my sextant. {0} if I am not mistaken...<br> ....scuttled the ship, and our precious cargo went with her and the screaming pirates, down to the bottom of the sea..." ),
|
||||
new MessageEntry( 280, 180, "Help! Ship going dow...n heavy storms...precious cargo...st reach dest...current coordinates {0}...ve any survivors... ease!" ),
|
||||
new MessageEntry( 280, 215, "...know that the wreck is near {0} but have not found it. Could the message passed down in my family for generations be wrong? No... I swear on the soul of my grandfather, I will find..." ),
|
||||
new MessageEntry( 280, 195, "...never expected an iceberg...silly woman on bow crushed instantly...send help to {0}...ey'll never forget the tragedy of the sinking of the Miniscule..." ),
|
||||
new MessageEntry( 280, 265, "...nobody knew I was a girl. They just assumed I was another sailor...then we met the undine. {0}. It was demanded sacrifice...I was youngset, they figured...<br> ...grabbed the captain's treasure, screamed, 'It'll go down with me!'<br> ...they took me up on it." ),
|
||||
new MessageEntry( 280, 230, "...so I threw the treasure overboard, before the curse could get me too. But I was too late. Now I am doomed to wander these seas, a ghost forever. Join me: seek ye at {0} if thou wishest my company..." ),
|
||||
new MessageEntry( 280, 285, "...then the ship exploded. A dragon swooped by. The slime swallowed Bertie whole--he screamed, it was amazing. The sky glowed orange. A sextant reading put us at {0}. Norma was chattering about sailing over the edge of the world. I looked at my hands and saw through them..." ),
|
||||
new MessageEntry( 280, 285, "...trapped on a deserted island, with a magic fountain supplying wood, fresh water springs, gorgeous scenery, and my lovely young wife. I know the ship with all our life's earnings sank at {0} but I don't know what our coordinates are... someone has GOT to rescue me before Sunday's finals game or I'll go mad..." ),
|
||||
new MessageEntry( 280, 160, "WANTED: divers exp...d in shipwre...overy. Must have own vess...pply at {0}<br>...good benefits, flexible hours..." ),
|
||||
new MessageEntry( 280, 250, "...was a cad and a boor, no matter what momma s...rew him overboard! Oh, Anna, 'twas so exciting!<br> Unfort...y he grabbe...est, and all his riches went with him!<br> ...sked the captain, and he says we're at {0}<br>...so maybe..." )
|
||||
};
|
||||
|
||||
public static MessageEntry[] Entries
|
||||
{
|
||||
get{ return m_Entries; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
159
Scripts/Items/Skill Items/Fishing/Misc/Sextant.cs
Normal file
159
Scripts/Items/Skill Items/Fishing/Misc/Sextant.cs
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Sextant : Item
|
||||
{
|
||||
[Constructable]
|
||||
public Sextant() : base( 0x1058 )
|
||||
{
|
||||
Weight = 2.0;
|
||||
}
|
||||
|
||||
public Sextant( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
int xLong = 0, yLat = 0;
|
||||
int xMins = 0, yMins = 0;
|
||||
bool xEast = false, ySouth = false;
|
||||
|
||||
if ( Sextant.Format( from.Location, from.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth ) )
|
||||
{
|
||||
string location = String.Format( "{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
|
||||
from.LocalOverheadMessage( MessageType.Regular, from.SpeechHue, false, location );
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ComputeMapDetails( Map map, int x, int y, out int xCenter, out int yCenter, out int xWidth, out int yHeight )
|
||||
{
|
||||
xWidth = 5120; yHeight = 4096;
|
||||
|
||||
if ( map == Map.Trammel || map == Map.Felucca )
|
||||
{
|
||||
if ( x >= 0 && y >= 0 && x < 5120 && y < 4096 )
|
||||
{
|
||||
xCenter = 1323; yCenter = 1624;
|
||||
}
|
||||
else if ( x >= 5120 && y >= 2304 && x < 6144 && y < 4096 )
|
||||
{
|
||||
xCenter = 5936; yCenter = 3112;
|
||||
}
|
||||
else
|
||||
{
|
||||
xCenter = 0; yCenter = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ( x >= 0 && y >= 0 && x < map.Width && y < map.Height )
|
||||
{
|
||||
xCenter = 1323; yCenter = 1624;
|
||||
}
|
||||
else
|
||||
{
|
||||
xCenter = 0; yCenter = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Point3D ReverseLookup( Map map, int xLong, int yLat, int xMins, int yMins, bool xEast, bool ySouth )
|
||||
{
|
||||
if ( map == null || map == Map.Internal )
|
||||
return Point3D.Zero;
|
||||
|
||||
int xCenter, yCenter;
|
||||
int xWidth, yHeight;
|
||||
|
||||
if ( !ComputeMapDetails( map, 0, 0, out xCenter, out yCenter, out xWidth, out yHeight ) )
|
||||
return Point3D.Zero;
|
||||
|
||||
double absLong = xLong + ((double)xMins / 60);
|
||||
double absLat = yLat + ((double)yMins / 60);
|
||||
|
||||
if ( !xEast )
|
||||
absLong = 360.0 - absLong;
|
||||
|
||||
if ( !ySouth )
|
||||
absLat = 360.0 - absLat;
|
||||
|
||||
int x, y, z;
|
||||
|
||||
x = xCenter + (int)((absLong * xWidth) / 360);
|
||||
y = yCenter + (int)((absLat * yHeight) / 360);
|
||||
|
||||
if ( x < 0 )
|
||||
x += xWidth;
|
||||
else if ( x >= xWidth )
|
||||
x -= xWidth;
|
||||
|
||||
if ( y < 0 )
|
||||
y += yHeight;
|
||||
else if ( y >= yHeight )
|
||||
y -= yHeight;
|
||||
|
||||
z = map.GetAverageZ( x, y );
|
||||
|
||||
return new Point3D( x, y, z );
|
||||
}
|
||||
|
||||
public static bool Format( Point3D p, Map map, ref int xLong, ref int yLat, ref int xMins, ref int yMins, ref bool xEast, ref bool ySouth )
|
||||
{
|
||||
if ( map == null || map == Map.Internal )
|
||||
return false;
|
||||
|
||||
int x = p.X, y = p.Y;
|
||||
int xCenter, yCenter;
|
||||
int xWidth, yHeight;
|
||||
|
||||
if ( !ComputeMapDetails( map, x, y, out xCenter, out yCenter, out xWidth, out yHeight ) )
|
||||
return false;
|
||||
|
||||
double absLong = (double)((x - xCenter) * 360) / xWidth;
|
||||
double absLat = (double)((y - yCenter) * 360) / yHeight;
|
||||
|
||||
if ( absLong > 180.0 )
|
||||
absLong = -180.0 + (absLong % 180.0);
|
||||
|
||||
if ( absLat > 180.0 )
|
||||
absLat = -180.0 + (absLat % 180.0);
|
||||
|
||||
bool east = ( absLong >= 0 ), south = ( absLat >= 0 );
|
||||
|
||||
if ( absLong < 0.0 )
|
||||
absLong = -absLong;
|
||||
|
||||
if ( absLat < 0.0 )
|
||||
absLat = -absLat;
|
||||
|
||||
xLong = (int)absLong;
|
||||
yLat = (int)absLat;
|
||||
|
||||
xMins = (int)((absLong % 1.0) * 60);
|
||||
yMins = (int)((absLat % 1.0) * 60);
|
||||
|
||||
xEast = east;
|
||||
ySouth = south;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
81
Scripts/Items/Skill Items/Fishing/Misc/ShipwreckedItem.cs
Normal file
81
Scripts/Items/Skill Items/Fishing/Misc/ShipwreckedItem.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public interface IShipwreckedItem
|
||||
{
|
||||
bool IsShipwreckedItem { get; set; }
|
||||
}
|
||||
|
||||
public class ShipwreckedItem : Item, IDyable, IShipwreckedItem
|
||||
{
|
||||
public ShipwreckedItem( int itemID ) : base( itemID )
|
||||
{
|
||||
int weight = this.ItemData.Weight;
|
||||
|
||||
if ( weight >= 255 )
|
||||
weight = 1;
|
||||
|
||||
this.Weight = weight;
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
this.LabelTo( from, 1050039, String.Format( "#{0}\t#1041645", LabelNumber ) );
|
||||
}
|
||||
|
||||
public override void AddNameProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.AddNameProperties( list );
|
||||
list.Add( 1041645 ); // recovered from a shipwreck
|
||||
}
|
||||
|
||||
public ShipwreckedItem( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public bool Dye( Mobile from, DyeTub sender )
|
||||
{
|
||||
if ( Deleted )
|
||||
return false;
|
||||
|
||||
if ( ItemID >= 0x13A4 && ItemID <= 0x13AE )
|
||||
{
|
||||
Hue = sender.DyedHue;
|
||||
return true;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( sender.FailMessage );
|
||||
return false;
|
||||
}
|
||||
|
||||
#region IShipwreckedItem Members
|
||||
|
||||
public bool IsShipwreckedItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return true; //It's a ShipwreckedItem item. 'Course it's gonna be a Shipwreckeditem
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
409
Scripts/Items/Skill Items/Fishing/Misc/SpecialFishingNet.cs
Normal file
409
Scripts/Items/Skill Items/Fishing/Misc/SpecialFishingNet.cs
Normal file
|
|
@ -0,0 +1,409 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SpecialFishingNet : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1041079; } } // a special fishing net
|
||||
|
||||
private bool m_InUse;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool InUse
|
||||
{
|
||||
get{ return m_InUse; }
|
||||
set{ m_InUse = value; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SpecialFishingNet() : base( 0x0DCA )
|
||||
{
|
||||
Weight = 1.0;
|
||||
|
||||
if ( 0.01 > Utility.RandomDouble() )
|
||||
Hue = Utility.RandomList( m_Hues );
|
||||
else
|
||||
Hue = 0x8A0;
|
||||
}
|
||||
|
||||
private static int[] m_Hues = new int[]
|
||||
{
|
||||
0x09B,
|
||||
0x0CD,
|
||||
0x0D3,
|
||||
0x14D,
|
||||
0x1DD,
|
||||
0x1E9,
|
||||
0x1F4,
|
||||
0x373,
|
||||
0x451,
|
||||
0x47F,
|
||||
0x489,
|
||||
0x492,
|
||||
0x4B5,
|
||||
0x8AA
|
||||
};
|
||||
|
||||
public SpecialFishingNet( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
AddNetProperties( list );
|
||||
}
|
||||
|
||||
protected virtual void AddNetProperties( ObjectPropertyList list )
|
||||
{
|
||||
// as if the name wasn't enough..
|
||||
list.Add( 1017410 ); // Special Fishing Net
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_InUse );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_InUse = reader.ReadBool();
|
||||
|
||||
if ( m_InUse )
|
||||
Delete();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Stackable = false;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( m_InUse )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010483 ); // Someone is already using that net!
|
||||
}
|
||||
else if ( IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010484 ); // Where do you wish to use the net?
|
||||
from.BeginTarget( -1, true, TargetFlags.None, new TargetCallback( OnTarget ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool RequireDeepWater{ get{ return true; } }
|
||||
|
||||
public void OnTarget( Mobile from, object obj )
|
||||
{
|
||||
if ( Deleted || m_InUse )
|
||||
return;
|
||||
|
||||
IPoint3D p3D = obj as IPoint3D;
|
||||
|
||||
if ( p3D == null )
|
||||
return;
|
||||
|
||||
Map map = from.Map;
|
||||
|
||||
if ( map == null || map == Map.Internal )
|
||||
return;
|
||||
|
||||
int x = p3D.X, y = p3D.Y, z = map.GetAverageZ( x, y ); // OSI just takes the targeted Z
|
||||
|
||||
if ( !from.InRange( p3D, 6 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500976 ); // You need to be closer to the water to fish!
|
||||
}
|
||||
else if ( !from.InLOS( obj ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500979 ); // You cannot see that location.
|
||||
}
|
||||
else if ( RequireDeepWater ? FullValidation( map, x, y ) : ( ValidateDeepWater( map, x, y ) || ValidateUndeepWater( map, obj, ref z ) ) )
|
||||
{
|
||||
Point3D p = new Point3D( x, y, z );
|
||||
|
||||
if ( GetType() == typeof( SpecialFishingNet ) )
|
||||
{
|
||||
for ( int i = 1; i < Amount; ++i ) // these were stackable before, doh
|
||||
from.AddToBackpack( new SpecialFishingNet() );
|
||||
}
|
||||
|
||||
m_InUse = true;
|
||||
Movable = false;
|
||||
MoveToWorld( p, map );
|
||||
|
||||
SpellHelper.Turn( from, p );
|
||||
from.Animate( 12, 5, 1, true, false, 0 );
|
||||
|
||||
Effects.SendLocationEffect( p, map, 0x352D, 16, 4 );
|
||||
Effects.PlaySound( p, map, 0x364 );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.25 ), 14, new TimerStateCallback( DoEffect ), new object[]{ p, 0, from } );
|
||||
|
||||
from.SendLocalizedMessage( RequireDeepWater ? 1010487 : 1074492 ); // You plunge the net into the sea... / You plunge the net into the water...
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( RequireDeepWater ? 1010485 : 1074491 ); // You can only use this net in deep water! / You can only use this net in water!
|
||||
}
|
||||
}
|
||||
|
||||
private void DoEffect( object state )
|
||||
{
|
||||
if ( Deleted )
|
||||
return;
|
||||
|
||||
object[] states = (object[])state;
|
||||
|
||||
Point3D p = (Point3D)states[0];
|
||||
int index = (int)states[1];
|
||||
Mobile from = (Mobile)states[2];
|
||||
|
||||
states[1] = ++index;
|
||||
|
||||
if ( index == 1 )
|
||||
{
|
||||
Effects.SendLocationEffect( p, Map, 0x352D, 16, 4 );
|
||||
Effects.PlaySound( p, Map, 0x364 );
|
||||
}
|
||||
else if ( index <= 7 || index == 14 )
|
||||
{
|
||||
if ( RequireDeepWater )
|
||||
{
|
||||
for ( int i = 0; i < 3; ++i )
|
||||
{
|
||||
int x, y;
|
||||
|
||||
switch ( Utility.Random( 8 ) )
|
||||
{
|
||||
default:
|
||||
case 0: x = -1; y = -1; break;
|
||||
case 1: x = -1; y = 0; break;
|
||||
case 2: x = -1; y = +1; break;
|
||||
case 3: x = 0; y = -1; break;
|
||||
case 4: x = 0; y = +1; break;
|
||||
case 5: x = +1; y = -1; break;
|
||||
case 6: x = +1; y = 0; break;
|
||||
case 7: x = +1; y = +1; break;
|
||||
}
|
||||
|
||||
Effects.SendLocationEffect( new Point3D( p.X + x, p.Y + y, p.Z ), Map, 0x352D, 16, 4 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.SendLocationEffect( p, Map, 0x352D, 16, 4 );
|
||||
}
|
||||
|
||||
if ( Utility.RandomBool() )
|
||||
Effects.PlaySound( p, Map, 0x364 );
|
||||
|
||||
if ( index == 14 )
|
||||
FinishEffect( p, Map, from );
|
||||
else
|
||||
this.Z -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual int GetSpawnCount()
|
||||
{
|
||||
int count = Utility.RandomMinMax( 1, 3 );
|
||||
|
||||
if ( Hue != 0x8A0 )
|
||||
count += Utility.RandomMinMax( 1, 2 );
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
protected void Spawn( Point3D p, Map map, BaseCreature spawn )
|
||||
{
|
||||
if ( map == null )
|
||||
{
|
||||
spawn.Delete();
|
||||
return;
|
||||
}
|
||||
|
||||
int x = p.X, y = p.Y;
|
||||
|
||||
for ( int j = 0; j < 20; ++j )
|
||||
{
|
||||
int tx = p.X - 2 + Utility.Random( 5 );
|
||||
int ty = p.Y - 2 + Utility.Random( 5 );
|
||||
|
||||
LandTile t = map.Tiles.GetLandTile( tx, ty );
|
||||
|
||||
if ( t.Z == p.Z && ( (t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137) ) && !Spells.SpellHelper.CheckMulti( new Point3D( tx, ty, p.Z ), map ) )
|
||||
{
|
||||
x = tx;
|
||||
y = ty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
spawn.MoveToWorld( new Point3D( x, y, p.Z ), map );
|
||||
|
||||
if ( spawn is Kraken && 0.2 > Utility.RandomDouble() )
|
||||
spawn.PackItem( new MessageInABottle( map == Map.Felucca ? Map.Felucca : Map.Trammel ) );
|
||||
}
|
||||
|
||||
protected virtual void FinishEffect( Point3D p, Map map, Mobile from )
|
||||
{
|
||||
from.RevealingAction();
|
||||
|
||||
int count = GetSpawnCount();
|
||||
|
||||
for ( int i = 0; map != null && i < count; ++i )
|
||||
{
|
||||
BaseCreature spawn;
|
||||
|
||||
switch ( Utility.Random( 4 ) )
|
||||
{
|
||||
default:
|
||||
case 0: spawn = new SeaSerpent(); break;
|
||||
case 1: spawn = new DeepSeaSerpent(); break;
|
||||
case 2: spawn = new WaterElemental(); break;
|
||||
case 3: spawn = new Kraken(); break;
|
||||
}
|
||||
|
||||
Spawn( p, map, spawn );
|
||||
|
||||
spawn.Combatant = from;
|
||||
}
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public static bool FullValidation( Map map, int x, int y )
|
||||
{
|
||||
bool valid = ValidateDeepWater( map, x, y );
|
||||
|
||||
for ( int j = 1, offset = 5; valid && j <= 5; ++j, offset += 5 )
|
||||
{
|
||||
if ( !ValidateDeepWater( map, x + offset, y + offset ) )
|
||||
valid = false;
|
||||
else if ( !ValidateDeepWater( map, x + offset, y - offset ) )
|
||||
valid = false;
|
||||
else if ( !ValidateDeepWater( map, x - offset, y + offset ) )
|
||||
valid = false;
|
||||
else if ( !ValidateDeepWater( map, x - offset, y - offset ) )
|
||||
valid = false;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
private static int[] m_WaterTiles = new int[]
|
||||
{
|
||||
0x00A8, 0x00AB,
|
||||
0x0136, 0x0137
|
||||
};
|
||||
|
||||
private static bool ValidateDeepWater( Map map, int x, int y )
|
||||
{
|
||||
int tileID = map.Tiles.GetLandTile( x, y ).ID;
|
||||
bool water = false;
|
||||
|
||||
for ( int i = 0; !water && i < m_WaterTiles.Length; i += 2 )
|
||||
water = ( tileID >= m_WaterTiles[i] && tileID <= m_WaterTiles[i + 1] );
|
||||
|
||||
return water;
|
||||
}
|
||||
|
||||
private static int[] m_UndeepWaterTiles = new int[]
|
||||
{
|
||||
0x1797, 0x179C
|
||||
};
|
||||
|
||||
private static bool ValidateUndeepWater( Map map, object obj, ref int z )
|
||||
{
|
||||
if ( !( obj is StaticTarget ) )
|
||||
return false;
|
||||
|
||||
StaticTarget target = (StaticTarget)obj;
|
||||
|
||||
if ( BaseHouse.FindHouseAt( target.Location, map, 0 ) != null )
|
||||
return false;
|
||||
|
||||
int itemID = target.ItemID;
|
||||
|
||||
for ( int i = 0; i < m_UndeepWaterTiles.Length; i += 2 )
|
||||
{
|
||||
if ( itemID >= m_UndeepWaterTiles[i] && itemID <= m_UndeepWaterTiles[i + 1] )
|
||||
{
|
||||
z = target.Z;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class FabledFishingNet : SpecialFishingNet
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1063451; } } // a fabled fishing net
|
||||
|
||||
[Constructable]
|
||||
public FabledFishingNet()
|
||||
{
|
||||
Hue = 0x481;
|
||||
}
|
||||
|
||||
protected override void AddNetProperties( ObjectPropertyList list )
|
||||
{
|
||||
}
|
||||
|
||||
protected override int GetSpawnCount()
|
||||
{
|
||||
return base.GetSpawnCount() + 4;
|
||||
}
|
||||
|
||||
protected override void FinishEffect( Point3D p, Map map, Mobile from )
|
||||
{
|
||||
Spawn( p, map, new Leviathan( from ) );
|
||||
|
||||
base.FinishEffect( p, map, from );
|
||||
}
|
||||
|
||||
public FabledFishingNet( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue