#W# Initial Commit: Avatars Conquest

This commit is contained in:
WarrentyExpired 2026-07-04 10:35:30 -04:00
commit 5df497787a
7510 changed files with 416048 additions and 0 deletions

View file

@ -0,0 +1,53 @@
using System;
using System.Collections;
using Server.Targeting;
using Server.Items;
using Server.Engines.Harvest;
using System.Collections.Generic;
using Server.ContextMenus;
namespace Server.Items
{
public class FishingPole : BaseHarvestTool
{
public override HarvestSystem HarvestSystem{ get{ return Fishing.System; } }
[Constructable]
public FishingPole() : this( 50 )
{
}
[Constructable]
public FishingPole( int uses ) : base( uses, 0x0DC0 )
{
Layer = Layer.OneHanded;
Weight = 8.0;
}
public override void OnDoubleClick( Mobile from )
{
if ( from.Map != Map.Britannia )
from.SendMessage( "You cannot fish here!" );
else
Fishing.System.BeginHarvesting( from, this );
}
public FishingPole( 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();
}
}
}

View file

@ -0,0 +1,69 @@
using System;
using Server.Network;
using Server.Items;
namespace Server.Items
{
public class MessageInABottle : Item
{
public static int GetRandomLevel()
{
return Utility.RandomMinMax( 1, 3 );
}
public override int LabelNumber{ get{ return 1041080; } } // a message in a bottle
private int m_Level;
[CommandProperty( AccessLevel.GameMaster )]
public int Level
{
get { return m_Level; }
set { m_Level = value; InvalidateProperties(); }
}
[Constructable]
public MessageInABottle() : this( GetRandomLevel() )
{
}
[Constructable]
public MessageInABottle( int level ) : base( 0x127D )
{
Weight = 1.0;
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 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_Level = reader.ReadInt();
}
public override void OnDoubleClick( Mobile from )
{
if ( IsChildOf( from.Backpack ) )
{
Consume();
from.AddToBackpack( new SOS( 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.
}
}
}
}

View file

@ -0,0 +1,178 @@
using System;
using Server.Network;
using Server.Gumps;
using Server.Regions;
namespace Server.Items
{
public class SOS : Item
{
public override int LabelNumber
{
get
{
if ( IsAncient )
return 1063450; // an ancient SOS
return 1041081; // a waterstained SOS
}
}
private Point3D m_TargetLocation;
private int m_MessageIndex;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsAncient
{
get{ return ( m_Level >= 4 ); }
}
private int m_Level;
[CommandProperty( AccessLevel.GameMaster )]
public int Level
{
get { return m_Level; }
set { m_Level = value; InvalidateProperties(); }
}
[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( MessageInABottle.GetRandomLevel() )
{
}
[Constructable]
public SOS( int level ) : base( 0x14ED )
{
Weight = 1.0;
m_Level = level;
m_MessageIndex = Utility.Random( MessageEntry.Entries.Length );
m_TargetLocation = BaseRegion.GetOceanSpot();
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_TargetLocation );
writer.Write( m_MessageIndex );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_Level = reader.ReadInt();
m_TargetLocation = reader.ReadPoint3D();
m_MessageIndex = reader.ReadInt();
}
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_TargetLocation ) );
}
else
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
}
private class MessageGump : Gump
{
public MessageGump( MessageEntry entry, 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.Britannia, 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 );
}
}
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; }
}
}
}
}

View file

@ -0,0 +1,155 @@
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.Britannia )
{
if ( x >= 0 && y >= 0 && x < 7168 && y < 4096 )
{
xCenter = 1323; yCenter = 1624;
}
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;
}
}
}

View 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
}
}

View file

@ -0,0 +1,352 @@
using System;
using Server;
using Server.Mobiles;
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;
[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 );
// 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 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;
if ( map != Map.Britannia || p3D.Z != -5 )
{
from.SendMessage( "You cannot fish here!" );
}
else if ( !from.InRange( p3D, 6 ) )
{
from.SendLocalizedMessage( 500976 ); // You need to be closer to the water to fish!
}
else if ( !Server.Engines.Harvest.Fishing.IsOnBoat( from ) )
{
from.SendMessage( "You need to be out on your ship's deck to use this!" );
}
else if ( FullValidation( map, x, y ) )
{
Point3D p = new Point3D( x, y, map.GetAverageZ( x, y ) );
for ( int i = 1; i < Amount; ++i ) // these were stackable before, doh
from.AddToBackpack( new SpecialFishingNet() );
m_InUse = true;
Movable = false;
MoveToWorld( p, map );
from.Animate( 12, 5, 1, true, false, 0 );
Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), TimeSpan.FromSeconds( 1.0 ), 20, new TimerStateCallback( DoEffect ), new object[]{ p, 0, from } );
from.SendLocalizedMessage( 1010487 ); // You plunge the net into the sea...
}
else
{
from.SendLocalizedMessage( 1010485 ); // You can only use this net in deep 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 <= 10 || index == 20 )
{
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 );
}
Effects.PlaySound( p, Map, 0x364 );
if ( index == 20 )
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() );
}
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( 8 ) )
{
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;
case 4: spawn = new GiantEel(); break;
case 5: spawn = new GiantSquid(); break;
case 6: spawn = new SeaHydra(); break;
case 7: spawn = new GreatWhite(); 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 bool ValidateDeepWater( Map map, int x, int y )
{
Point3D loc = new Point3D( x, y, -5 );
Region reg = Region.Find( loc, map );
int tileID = map.Tiles.GetLandTile( x, y ).ID;
bool water = false;
for( int i = 0; !water && i < Server.Engines.Harvest.Fishing.m_WaterTiles.Length; i += 2 )
water = (tileID >= Server.Engines.Harvest.Fishing.m_WaterTiles[i] && tileID <= Server.Engines.Harvest.Fishing.m_WaterTiles[i + 1]);
if ( reg != map.DefaultRegion )
water = false;
return water;
}
}
public class FabledFishingNet : SpecialFishingNet
{
public override int LabelNumber{ get{ return 1063451; } } // a fabled fishing net
[Constructable]
public FabledFishingNet()
{
Hue = 0x481;
}
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();
}
}
}