Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,97 @@
using System;
using Server;
using Server.Gumps;
namespace Arya.Chess
{
public class ChessHelpGump : Gump
{
private const int LabelHue = 0x480;
private const int GreenHue = 0x40;
public ChessHelpGump( Mobile m ) : base( 150, 150 )
{
m.CloseGump( typeof( ChessHelpGump ) );
MakeGump();
}
private void MakeGump()
{
this.Closable=true;
this.Disposable=true;
this.Dragable=true;
this.Resizable=false;
this.AddPage(0);
this.AddBackground(0, 0, 420, 271, 9300);
this.AddAlphaRegion( 0, 0, 420, 271 );
this.AddLabel(134, 5, GreenHue, @"Chess Game Information");
this.AddButton(20, 32, 5601, 5605, 1, GumpButtonType.Reply, 0);
this.AddLabel(45, 30, LabelHue, @"Basic rules and pieces moves");
this.AddButton(20, 57, 5601, 5605, 2, GumpButtonType.Reply, 0);
this.AddLabel(45, 55, LabelHue, @"General Chess FAQ");
this.AddButton(20, 82, 5601, 5605, 3, GumpButtonType.Reply, 0);
this.AddLabel(45, 80, LabelHue, @"Check, Checkmate and Stalemate FAQ");
this.AddButton(20, 107, 5601, 5605, 4, GumpButtonType.Reply, 0);
this.AddLabel(45, 105, LabelHue, @"Castle FAQ");
this.AddLabel(45, 120, LabelHue, @"Note: To castle in Battle Chess, select the King and move it");
this.AddLabel(45, 135, LabelHue, @"on the Rook (or do exactly the opposite)");
this.AddButton(20, 162, 5601, 5605, 5, GumpButtonType.Reply, 0);
this.AddLabel(45, 160, LabelHue, @"The En Passant Move");
this.AddButton(20, 207, 5601, 5605, 6, GumpButtonType.Reply, 0);
this.AddLabel(20, 185, GreenHue, @"Pieces FAQs");
this.AddLabel(40, 205, LabelHue, @"Pawn");
this.AddButton(85, 207, 5601, 5605, 7, GumpButtonType.Reply, 0);
this.AddLabel(105, 205, LabelHue, @"Knight");
this.AddButton(155, 207, 5601, 5605, 8, GumpButtonType.Reply, 0);
this.AddLabel(175, 205, LabelHue, @"Queen");
this.AddButton(220, 207, 5601, 5605, 9, GumpButtonType.Reply, 0);
this.AddLabel(240, 205, LabelHue, @"King");
this.AddButton(20, 242, 5601, 5605, 0, GumpButtonType.Reply, 0);
this.AddLabel(40, 240, LabelHue, @"Exit");
}
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
{
string web = null;
switch ( info.ButtonID )
{
case 1 : web = "http://www.chessvariants.com/d.chess/chess.html";
break;
case 2 : web = "http://www.chessvariants.com/d.chess/faq.html";
break;
case 3 : web = "http://www.chessvariants.com/d.chess/matefaq.html";
break;
case 4 : web = "http://www.chessvariants.com/d.chess/castlefaq.html";
break;
case 5 : web = "http://www.chessvariants.com/d.chess/enpassant.html";
break;
case 6 : web = "http://www.chessvariants.com/d.chess/pawnfaq.html";
break;
case 7 : web = "http://www.chessvariants.com/d.chess/knightfaq.html";
break;
case 8 : web = "http://www.chessvariants.com/d.chess/queenfaq.html";
break;
case 9 : web = "http://www.chessvariants.com/d.chess/kingfaq.html";
break;
}
if ( web != null )
{
sender.Mobile.LaunchBrowser( web );
sender.Mobile.SendGump( this );
}
}
}
}

View File

@@ -0,0 +1,132 @@
using System;
using System.Reflection;
using Server;
using Server.Gumps;
namespace Arya.Chess
{
/// <summary>
/// Summary description for ChessSetGump.
/// </summary>
public class ChessSetGump : Gump
{
private const int LabelHue = 0x480;
private const int GreenHue = 0x40;
private static string[] m_Sets;
/// <summary>
/// Gets the list of chess sets available
/// </summary>
private static string[] Sets
{
get
{
if ( m_Sets == null )
m_Sets = Enum.GetNames( typeof( Arya.Chess.ChessSet ) );
return m_Sets;
}
}
private ChessGame m_Game;
private Mobile m_User;
private bool m_IsOwner;
private bool m_AllowSpectators;
private int m_Page = 0;
public ChessSetGump( Mobile m, ChessGame game, bool isOwner, bool allowSpectators, int page ) : base( 200, 200 )
{
m_Game = game;
m_User = m;
m_IsOwner = isOwner;
m_AllowSpectators = allowSpectators;
m_Page = page;
m_User.CloseGump( typeof( ChessSetGump ) );
MakeGump();
}
public ChessSetGump( Mobile m, ChessGame game, bool isOwner, bool allowSpectators ) : this( m, game, isOwner, allowSpectators, 0 )
{
}
private void MakeGump()
{
this.Closable=false;
this.Disposable=true;
this.Dragable=true;
this.Resizable=false;
this.AddPage(0);
this.AddBackground(0, 0, 320, 170, 9250);
this.AddAlphaRegion(0, 0, 320, 170);
for ( int i = 0; i < 4 && 4 * m_Page + i < Sets.Length; i++ )
{
AddButton( 35, 45 + i * 20, 5601, 5605, 10 + 4 * m_Page + i, GumpButtonType.Reply, 0 );
AddLabel( 60, 43 + i * 20, LabelHue, Sets[ 4 * m_Page + i ] );
}
if ( m_Page > 0 )
{
this.AddButton(15, 15, 5603, 5607, 1, GumpButtonType.Reply, 0);
}
int totalPages = ( Sets.Length - 1 ) / 4;
// Prev page : 1
// Next page : 2
if ( totalPages > m_Page )
{
this.AddButton(35, 15, 5601, 5605, 2, GumpButtonType.Reply, 0);
}
this.AddLabel(60, 13, GreenHue, @"Chess set selection");
// Cancel 3
this.AddButton(15, 130, 4020, 4021, 3, GumpButtonType.Reply, 0);
this.AddLabel(55, 130, GreenHue, @"Cancel Game");
}
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
{
switch ( info.ButtonID )
{
case 0 : return;
case 1:
sender.Mobile.SendGump( new ChessSetGump( m_User, m_Game, m_IsOwner, m_AllowSpectators, --m_Page ) );
break;
case 2:
sender.Mobile.SendGump( new ChessSetGump( m_User, m_Game, m_IsOwner, m_AllowSpectators, ++m_Page ) );
break;
case 3:
m_Game.CancelGameStart( sender.Mobile );
break;
default:
int index = info.ButtonID - 10;
ChessSet s = (ChessSet) Enum.Parse( typeof( Arya.Chess.ChessSet ), Sets[ index ], false );
m_Game.SetChessSet( s );
sender.Mobile.SendGump( new StartGameGump( sender.Mobile, m_Game, m_IsOwner, m_AllowSpectators ) );
sender.Mobile.Target = new ChessTarget( m_Game, sender.Mobile, "Please select your parnter...",
new ChessTargetCallback( m_Game.ChooseOpponent ) );
break;
}
}
}
}

View File

@@ -0,0 +1,65 @@
using System;
using Server;
using Server.Gumps;
namespace Arya.Chess
{
public class EndGameGump : Gump
{
private const int LabelHue = 0x480;
private const int GreenHue = 0x40;
private ChessGame m_Game;
private bool m_GameOver;
public EndGameGump( Mobile m, ChessGame game, bool over, string details, int timeout ) : base( 200, 200 )
{
m.CloseGump( typeof( EndGameGump ) );
m_Game = game;
m_GameOver = over;
this.Closable=false;
this.Disposable=true;
this.Dragable=true;
this.Resizable=false;
this.AddPage(0);
this.AddBackground(0, 0, 265, 160, 9250);
this.AddImageTiled(0, 0, 265, 160, 9304);
this.AddImageTiled(1, 1, 263, 158, 9274);
this.AddAlphaRegion(1, 1, 263, 158);
// Button 1 : End Game
this.AddButton(10, 127, 5601, 5605, 1, GumpButtonType.Reply, 0);
this.AddLabel(10, 10, LabelHue, string.Format( "This game is : {0}", over ? "Over" : "Pending" ) );
this.AddLabel(10, 30, LabelHue, @"Details");
this.AddLabel(30, 55, GreenHue, details);
this.AddLabel(30, 125, LabelHue, @"End Game");
if ( timeout > -1 )
{
this.AddLabel(10, 80, LabelHue, string.Format( "Wait {0} minutes before the game ends", timeout ) );
this.AddLabel(10, 95, LabelHue, @"automatically. Do not close this gump.");
}
}
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
{
if ( info.ButtonID == 1 )
{
if ( m_GameOver )
{
// Reset the game
m_Game.NotifyGameOver( sender.Mobile );
}
else
{
// Force end the game
m_Game.Cleanup();
}
}
}
}
}

View File

@@ -0,0 +1,112 @@
using System;
using Server;
using Server.Gumps;
namespace Arya.Chess
{
/// <summary>
/// Main game gump
/// </summary>
public class GameGump : Gump
{
private const int LabelHue = 0x480;
private const int GreenHue = 0x40;
private ChessGame m_Game;
private bool m_Move;
private bool m_Moving;
private string m_Message;
private ChessColor m_Color;
public GameGump( Mobile m, ChessGame game, ChessColor color, string message, bool move, bool moving ): base( 60, 25 )
{
m.CloseGump( typeof( GameGump ) );
m_Game = game;
m_Message = message;
m_Color = color;
m_Move = move;
m_Moving = moving;
if ( move && ! moving )
m_Game.SendMoveTarget( m );
MakeGump();
}
private void MakeGump()
{
this.Closable=false;
this.Disposable=true;
this.Dragable=true;
this.Resizable=false;
this.AddPage(0);
this.AddBackground(0, 0, 555, 50, 9250);
this.AddImageTiled(0, 0, 555, 50, 9304);
this.AddImageTiled(1, 1, 553, 48, 9274);
this.AddAlphaRegion(1, 1, 553, 48);
if ( m_Color == ChessColor.White )
{
this.AddImage(5, 5, 2331);
this.AddLabel(30, 5, LabelHue, @"You are WHITE");
}
else
{
this.AddImage(5, 5, 2338);
this.AddLabel(30, 5, LabelHue, @"You are BLACK");
}
string msg = null;
if ( m_Moving )
msg = "Making your move";
else if ( m_Move )
msg = "Make your move";
else
msg = "Waiting for opponent to move";
this.AddLabel(165, 5, LabelHue, msg);
// B1 : Make move
if ( m_Move )
this.AddButton(145, 7, 5601, 5605, 1, GumpButtonType.Reply, 0);
// B2 : Chess Help
this.AddButton(365, 7, 5601, 5605, 2, GumpButtonType.Reply, 0);
this.AddLabel(385, 5, LabelHue, @"Chess Help");
// B3 : End Game
this.AddButton(460, 7, 5601, 5605, 3, GumpButtonType.Reply, 0);
this.AddLabel(480, 5, LabelHue, @"End Game");
if ( m_Message != null )
this.AddLabel(5, 25, GreenHue, m_Message );
}
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
{
switch ( info.ButtonID )
{
case 1 : // Make move
sender.Mobile.SendGump( new GameGump( sender.Mobile, m_Game, m_Color, m_Message, m_Move, m_Moving ) );
break;
case 2: // Chess Help
sender.Mobile.SendGump( new ChessHelpGump( sender.Mobile ) );
sender.Mobile.SendGump( this );
break;
case 3: // End game
m_Game.Cleanup();
break;
}
}
}
}

View File

@@ -0,0 +1,83 @@
using System;
using Server;
using Server.Gumps;
namespace Arya.Chess
{
public class PawnPromotionGump : Gump
{
private const int LabelHue = 0x480;
private const int GreenHue = 0x40;
ChessGame m_Game;
public PawnPromotionGump( Mobile m, ChessGame game ) : base( 200, 200 )
{
m.CloseGump( typeof( PawnPromotionGump ) );
m_Game = game;
MakeGump();
}
private void MakeGump()
{
this.Closable=false;
this.Disposable=true;
this.Dragable=true;
this.Resizable=false;
this.AddPage(0);
this.AddBackground(0, 0, 255, 185, 9200);
this.AddImageTiled(0, 0, 255, 185, 9304);
this.AddImageTiled(1, 1, 253, 183, 9274);
this.AddAlphaRegion(1, 1, 253, 183);
this.AddLabel(20, 10, GreenHue, @"Your pawn is being promoted!");
this.AddLabel(20, 35, LabelHue, @"Promote to:");
this.AddButton(35, 70, 2337, 2344, 1, GumpButtonType.Reply, 0);
this.AddLabel(25, 120, LabelHue, @"Queen");
this.AddButton(85, 70, 2333, 2340, 2, GumpButtonType.Reply, 0);
this.AddLabel(80, 120, LabelHue, @"Rook");
this.AddButton(135, 70, 2335, 2344, 3, GumpButtonType.Reply, 0);
this.AddLabel(130, 120, LabelHue, @"Knight");
this.AddButton(195, 70, 2332, 2339, 4, GumpButtonType.Reply, 0);
this.AddLabel(185, 120, LabelHue, @"Bishop");
this.AddButton(25, 152, 9702, 248, 5, GumpButtonType.Reply, 0);
this.AddLabel(50, 150, 0, @"Do not promote pawn");
}
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
{
PawnPromotion type = PawnPromotion.None;
switch ( info.ButtonID )
{
case 0 :
return; // This fixes a crash when staff deletes the pawn being promoted
case 1 : type = PawnPromotion.Queen;
break;
case 2 : type = PawnPromotion.Rook;
break;
case 3 : type = PawnPromotion.Knight;
break;
case 4 : type = PawnPromotion.Bishop;
break;
case 5: type = PawnPromotion.None;
break;
}
m_Game.OnPawnPromoted( type );
}
}
}

View File

@@ -0,0 +1,63 @@
using System;
using Server;
using Server.Gumps;
namespace Arya.Chess
{
/// <summary>
/// Summary description for ScoreGump.
/// </summary>
public class ScoreGump : Gump
{
private ChessGame m_Game;
private const int LabelHue = 0x480;
private const int GreenHue = 0x40;
public ScoreGump( Mobile m, ChessGame game, int[] white, int[] black, int totwhite, int totblack ) : base( 0, 25 )
{
m.CloseGump( typeof( ScoreGump ) );
m_Game = game;
MakeGump( white, black, totwhite, totblack );
}
private void MakeGump( int[] white, int[] black, int whitescore, int blackscore )
{
this.Closable=true;
this.Disposable=true;
this.Dragable=true;
this.Resizable=false;
this.AddPage(0);
this.AddBackground(0, 0, 60, 345, 9350);
this.AddAlphaRegion(0, 0, 60, 345);
this.AddImage(5, 5, 2336);
this.AddImage(30, 6, 2343);
this.AddImage(5, 50, 2335);
this.AddImage(30, 50, 2342);
this.AddImage(5, 105, 2332);
this.AddImage(30, 105, 2339);
this.AddImage(5, 160, 2333);
this.AddImage(30, 160, 2340);
this.AddImage(5, 220, 2337);
this.AddImage(30, 220, 2344);
this.AddImageTiled(0, 285, 60, 1, 5124);
this.AddImage(10, 305, 2331);
this.AddImage(10, 325, 2338);
this.AddLabel(11, 33, LabelHue, white[0].ToString() );
this.AddLabel(5, 285, GreenHue, @"Score");
this.AddLabel(36, 33, LabelHue, black[0].ToString() );
this.AddLabel(11, 87, LabelHue, white[1].ToString() );
this.AddLabel(36, 87, LabelHue, black[1].ToString() );
this.AddLabel(11, 142, LabelHue, white[2].ToString() );
this.AddLabel(36, 142, LabelHue, black[2].ToString() );
this.AddLabel(11, 200, LabelHue, white[3].ToString() );
this.AddLabel(36, 200, LabelHue, black[3].ToString() );
this.AddLabel(11, 260, LabelHue, white[4].ToString() );
this.AddLabel(36, 260, LabelHue, black[4].ToString() );
this.AddLabel(30, 302, LabelHue, whitescore.ToString() );
this.AddLabel(30, 322, LabelHue, blackscore.ToString() );
}
}
}

View File

@@ -0,0 +1,125 @@
using System;
using Server;
using Server.Gumps;
namespace Arya.Chess
{
/// <summary>
/// This gump is used to start the game
/// </summary>
public class StartGameGump : Gump
{
private const int LabelHue = 0x480;
private const int GreenHue = 0x40;
private ChessGame m_Game;
private Mobile m_User;
private bool m_IsOwner;
private bool m_AllowSpectators;
public StartGameGump( Mobile m, ChessGame game, bool isOwner, bool allowSpectators ) : base( 200, 200 )
{
m_Game = game;
m_User = m;
m_IsOwner = isOwner;
m_AllowSpectators = allowSpectators;
m_User.CloseGump( typeof( StartGameGump ) );
MakeGump();
}
private void MakeGump()
{
this.Closable=false;
this.Disposable=true;
this.Dragable=true;
this.Resizable=false;
this.AddPage(0);
int height = 75;
if ( m_IsOwner )
height = 110;
this.AddBackground(0, 0, 300, height, 9250);
this.AddImageTiled(0, 0, 300, height, 9304);
this.AddImageTiled(1, 1, 298, height - 2, 9274);
this.AddAlphaRegion(1, 1, 298, height - 2);
if ( m_IsOwner )
{
if ( m_Game.Guest == null )
this.AddLabel(10, 5, GreenHue, @"Starting new chess game");
else
this.AddLabel(10, 5, GreenHue, @"Waiting for partner to accept");
this.AddImageTiled(10, 25, 280, 1, 9304);
// Bring again target : 1
if ( m_Game.Guest == null )
{
this.AddButton(15, 30, 5601, 5605, 1, GumpButtonType.Reply, 0);
this.AddLabel(35, 28, LabelHue, @"Please select your opponent...");
}
// Cancel : 0
this.AddButton(15, 50, 5601, 5605, 2, GumpButtonType.Reply, 0);
this.AddLabel(35, 48, LabelHue, @"Cancel");
int bid = m_AllowSpectators ? 2153 : 2151;
this.AddButton( 10, 75, bid, bid, 3, GumpButtonType.Reply, 0 );
this.AddLabel( 45, 80, LabelHue, "Allow spectators on the Chessboard" );
}
else
{
this.AddLabel(10, 5, GreenHue, string.Format( "Play chess with {0}?", m_Game.Owner.Name ) );
this.AddImageTiled(10, 25, 280, 1, 9304);
// Accept : 1
this.AddButton(15, 30, 5601, 5605, 1, GumpButtonType.Reply, 0);
this.AddLabel(35, 28, LabelHue, @"Accept");
// Refuse : 0
this.AddButton(15, 50, 5601, 5605, 2, GumpButtonType.Reply, 0);
this.AddLabel(35, 48, LabelHue, @"Refuse");
}
}
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
{
if ( m_IsOwner )
{
if ( info.ButtonID == 3 )
{
// Switch the allow spectators flag
m_Game.AllowSpectators = !m_AllowSpectators;
sender.Mobile.SendGump( new StartGameGump( sender.Mobile, m_Game, m_IsOwner, !m_AllowSpectators ) );
}
else if ( info.ButtonID == 2 )
{
m_Game.CancelGameStart( sender.Mobile );
}
else if ( info.ButtonID == 1 )
{
sender.Mobile.Target = new ChessTarget( m_Game, sender.Mobile, "Please select your partner...",
new ChessTargetCallback( m_Game.ChooseOpponent ) );
sender.Mobile.SendGump( new StartGameGump( sender.Mobile, m_Game, m_IsOwner, m_AllowSpectators ) );
}
}
else
{
if ( info.ButtonID == 2 )
{
m_Game.CancelGameStart( sender.Mobile );
}
else if ( info.ButtonID == 1 )
{
m_Game.AcceptGame( sender.Mobile );
}
}
}
}
}