139 lines
4.5 KiB
C#
139 lines
4.5 KiB
C#
using System;
|
|
using Server;
|
|
using Server.Items;
|
|
using Server.Mobiles;
|
|
using Server.Network;
|
|
using Server.Gumps;
|
|
|
|
namespace Server.Items
|
|
{
|
|
public class DungeonPassageRelic : Item
|
|
{
|
|
[Constructable]
|
|
public DungeonPassageRelic() : base( 0x1F14 )
|
|
{
|
|
Name = "a relic of the classic depths";
|
|
Hue = 1150; // White glowing hue
|
|
Weight = 1.0;
|
|
}
|
|
|
|
public DungeonPassageRelic( Serial serial ) : base( serial )
|
|
{
|
|
}
|
|
|
|
public override void OnDoubleClick( Mobile from )
|
|
{
|
|
if ( !IsChildOf( from.Backpack ) )
|
|
{
|
|
from.SendLocalizedMessage( 1042001 );
|
|
return;
|
|
}
|
|
|
|
from.CloseGump( typeof( DungeonPassageGump ) );
|
|
from.SendGump( new DungeonPassageGump( from, this ) );
|
|
}
|
|
|
|
public override void Serialize( GenericWriter writer )
|
|
{
|
|
base.Serialize( writer );
|
|
writer.Write( (int) 0 );
|
|
}
|
|
|
|
public override void Deserialize( GenericReader reader )
|
|
{
|
|
base.Deserialize( reader );
|
|
int version = reader.ReadInt();
|
|
}
|
|
}
|
|
}
|
|
|
|
namespace Server.Gumps
|
|
{
|
|
public class DungeonPassageGump : Gump
|
|
{
|
|
private Item m_Relic;
|
|
|
|
public DungeonPassageGump( Mobile from, Item relic ) : base( 100, 100 )
|
|
{
|
|
m_Relic = relic;
|
|
|
|
Closable = false;
|
|
Disposable = true;
|
|
Dragable = true;
|
|
Resizable = false;
|
|
|
|
AddPage(0);
|
|
|
|
AddBackground(0, 0, 320, 150, 3600);
|
|
AddHtml(0, 15, 320, 20, "<CENTER><BASEFONT COLOR=#FFFFFF>Dungeon Passage</BASEFONT></CENTER>", false, false);
|
|
AddImageTiled(25, 40, 270, 2, 96); // Divider line
|
|
|
|
AddHtml(25, 55, 270, 40, "<BASEFONT COLOR=#CCCCCC>Are you sure you wish to shatter this relic and be transported to a random classic dungeon?</BASEFONT>", false, false);
|
|
|
|
// Yes Button
|
|
AddButton(40, 105, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
|
AddLabel(80, 106, 1152, "Yes!");
|
|
|
|
// No/Cancel Button
|
|
AddButton(190, 105, 4017, 4019, 0, GumpButtonType.Reply, 0);
|
|
AddLabel(230, 106, 38, "Not Now.");
|
|
}
|
|
|
|
public override void OnResponse( NetState sender, RelayInfo info )
|
|
{
|
|
Mobile m = sender.Mobile;
|
|
|
|
if ( info.ButtonID == 1 )
|
|
{
|
|
if ( m_Relic == null || m_Relic.Deleted || !m_Relic.IsChildOf( m.Backpack ) )
|
|
{
|
|
m.SendMessage( 38, "The relic must be in your backpack to use." );
|
|
return;
|
|
}
|
|
|
|
Point3D destination = Point3D.Zero;
|
|
Map targetMap = Map.Felucca;
|
|
string dungeonName = "";
|
|
|
|
switch ( Utility.Random( 6 ) )
|
|
{
|
|
case 0: // Shame
|
|
destination = new Point3D( 3515, 174, -2 );
|
|
dungeonName = "Shame";
|
|
break;
|
|
case 1: // Deceit
|
|
destination = new Point3D( 3827, 165, 0 );
|
|
dungeonName = "Deceit";
|
|
break;
|
|
case 2: // Covetous
|
|
destination = new Point3D( 4096, 127, 0 );
|
|
dungeonName = "Covetous";
|
|
break;
|
|
case 3: // Hythloth
|
|
destination = new Point3D( 4297, 64, 59 );
|
|
dungeonName = "Hythloth";
|
|
break;
|
|
case 4: // Despise
|
|
destination = new Point3D( 4748, 183, 30 );
|
|
dungeonName = "Despise";
|
|
break;
|
|
case 5: // Destard
|
|
destination = new Point3D( 5155, 286, 0 );
|
|
dungeonName = "Destard";
|
|
break;
|
|
}
|
|
|
|
Effects.PlaySound( m.Location, m.Map, 0x1FE );
|
|
m.MoveToWorld( destination, targetMap );
|
|
Effects.PlaySound( m.Location, m.Map, 0x1FE );
|
|
|
|
m.SendMessage( 63, "The relic shatters into dust and you find yourself in the depths of {0}!", dungeonName );
|
|
m_Relic.Delete();
|
|
}
|
|
else
|
|
{
|
|
m.SendMessage( "You put the relic away for now." );
|
|
}
|
|
}
|
|
}
|
|
}
|