Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Solaris.BoardGames;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
//offers a new game to a player
|
||||
public class AwaitRecruitmentGump : BoardGameGump
|
||||
{
|
||||
|
||||
public override int Height{ get{ return 200; } }
|
||||
public override int Width{ get{ return 400; } }
|
||||
|
||||
public AwaitRecruitmentGump( Mobile owner, BoardGameControlItem controlitem ) : base( owner, controlitem )
|
||||
{
|
||||
//force it so players can't close this gump
|
||||
Closable = false;
|
||||
|
||||
AddLabel( 40, 20, 1152, "Game:" );
|
||||
|
||||
AddLabel( 140, 20, 1172, _ControlItem.GameName );
|
||||
|
||||
AddHtml( 40, 50, Width - 80, 80, "You are waiting for more players to join this game. When there are enough, this window will automatically close and the game will start. If you wish to cancel waiting, click the Cancel button.", true, false );
|
||||
|
||||
AddButton( 160, 160, 0xF1, 0xF2, 1, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
protected override void DeterminePageLayout()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
int buttonid = info.ButtonID;
|
||||
|
||||
//cancel button
|
||||
if( buttonid == 1 )
|
||||
{
|
||||
_Owner.CloseGump( typeof( SelectStyleGump ) );
|
||||
_ControlItem.RemovePlayer( _Owner );
|
||||
|
||||
_Owner.SendMessage( "You are no longer waiting to play this game." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Solaris.BoardGames;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
//main gump class for boardgames
|
||||
public class BoardGameGump : Gump
|
||||
{
|
||||
public virtual int Height{ get{ return 100; } }
|
||||
public virtual int Width{ get{ return 100; } }
|
||||
|
||||
//reference to the control system for the boardgame
|
||||
protected BoardGameControlItem _ControlItem;
|
||||
protected Mobile _Owner;
|
||||
|
||||
public BoardGameGump( Mobile owner, BoardGameControlItem controlitem ) : base( 50, 50 )
|
||||
{
|
||||
_Owner = owner;
|
||||
_ControlItem = controlitem;
|
||||
|
||||
_Owner.CloseGump( typeof( BoardGameGump ) );
|
||||
|
||||
|
||||
DrawBackground();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected virtual void DrawBackground()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
//determine page layout, sizes, and what gets displayed where
|
||||
DeterminePageLayout();
|
||||
|
||||
|
||||
AddBackground( 0, 0, Width, Height, 9270 );
|
||||
AddImageTiled( 11, 10, Width - 22, Height - 20, 2624 );
|
||||
|
||||
AddAlphaRegion( 11, 10, Width - 22, Height - 20 );
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected virtual void DeterminePageLayout()
|
||||
{
|
||||
}
|
||||
|
||||
public void AddTextField( int x, int y, int width, int height, int index, string text )
|
||||
{
|
||||
AddImageTiled( x - 2, y - 2, width + 4, height + 4, 0xA2C );
|
||||
AddAlphaRegion( x -2, y - 2, width + 4, height + 4 );
|
||||
AddTextEntry( x + 2, y + 2, width - 4, height - 4, 1153, index, text );
|
||||
}
|
||||
|
||||
public string GetTextField( RelayInfo info, int index )
|
||||
{
|
||||
TextRelay relay = info.GetTextEntry( index );
|
||||
return ( relay == null ? null : relay.Text.Trim() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Solaris.BoardGames;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class BoardGameLostGump : BoardGameGump
|
||||
{
|
||||
public override int Height{ get{ return 140; } }
|
||||
public override int Width{ get{ return 300; } }
|
||||
|
||||
public BoardGameLostGump( Mobile owner, BoardGameControlItem controlitem ) : base( owner, controlitem )
|
||||
{
|
||||
AddLabel( 40, 20, 1152, "Game:" );
|
||||
|
||||
AddLabel( 140, 20, 1172, _ControlItem.GameName );
|
||||
|
||||
AddLabel( 40, 50, 1152, "You've lost the game!" );
|
||||
|
||||
//TODO: add info about points earned?
|
||||
|
||||
AddButton( 100, 80, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Solaris.BoardGames;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class BoardGameScoresGump : BoardGameGump
|
||||
{
|
||||
public const int ENTRIES_PER_PAGE = 10;
|
||||
|
||||
public override int Height{ get{ return 440; } }
|
||||
public override int Width{ get{ return 350; } }
|
||||
|
||||
protected List<BoardGamePlayerScore> _PlayerScores;
|
||||
|
||||
protected int _X;
|
||||
protected int _Y;
|
||||
|
||||
//maximum entry listing height, for multi-page calculation
|
||||
public int MaxEntryDisplayHeight{ get{ return 300; } }
|
||||
|
||||
//line spacing between entries
|
||||
public int EntryLineSpacing{ get{ return 20; } }
|
||||
|
||||
protected int _Page;
|
||||
|
||||
//this is determined based on the number of entries and the maximum number to display per page
|
||||
protected int _MaxPages;
|
||||
|
||||
public BoardGameScoresGump( Mobile owner, BoardGameControlItem controlitem ) : this( owner, controlitem, 0 )
|
||||
{
|
||||
}
|
||||
|
||||
public BoardGameScoresGump( Mobile owner, BoardGameControlItem controlitem, int page ) : base( owner, controlitem )
|
||||
{
|
||||
_Page = page;
|
||||
|
||||
AddLabel( 40, 20, 1152, "Game:" );
|
||||
|
||||
AddLabel( 140, 20, 1172, _ControlItem.GameName );
|
||||
|
||||
AddLabel( 40, 50, 1152, "Scores" );
|
||||
|
||||
_PlayerScores = BoardGameData.GetScores( controlitem.GameName );
|
||||
|
||||
if( _PlayerScores == null || _PlayerScores.Count == 0 )
|
||||
{
|
||||
AddLabel( 40, 80, 1152, "- NO SCORES SET YET -" );
|
||||
return;
|
||||
}
|
||||
|
||||
_PlayerScores.Sort();
|
||||
|
||||
_X = 20;
|
||||
_Y = 80;
|
||||
|
||||
_MaxPages = _PlayerScores.Count / ENTRIES_PER_PAGE + 1;
|
||||
|
||||
if( _PlayerScores.Count % ENTRIES_PER_PAGE == 0 )
|
||||
{
|
||||
_MaxPages -= 1;
|
||||
}
|
||||
|
||||
_Page = Math.Max( 0, Math.Min( _Page, _MaxPages ) );
|
||||
|
||||
int listingstart = _Page * ENTRIES_PER_PAGE;
|
||||
int listingend = Math.Min( _PlayerScores.Count, (_Page + 1 ) * ENTRIES_PER_PAGE );
|
||||
|
||||
AddLabel( _X, _Y, 1152, "Name" );
|
||||
AddLabel( _X + 150, _Y, 1152, "Score" );
|
||||
AddLabel( _X+ 200, _Y, 1152, "Wins" );
|
||||
AddLabel( _X + 250, _Y, 1152, "Losses" );
|
||||
|
||||
for( int i = listingstart; i < listingend; i++ )
|
||||
{
|
||||
AddLabel( _X, _Y += 20, 1152, _PlayerScores[i].Player.Name );
|
||||
AddLabel( _X + 150, _Y, 1152, _PlayerScores[i].Score.ToString() );
|
||||
AddLabel( _X + 200, _Y, 1152, _PlayerScores[i].Wins.ToString() );
|
||||
AddLabel( _X + 250, _Y, 1152, _PlayerScores[i].Losses.ToString() );
|
||||
}
|
||||
|
||||
AddPageButtons();
|
||||
|
||||
AddButton( 60, Height - 40, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
protected void AddPageButtons()
|
||||
{
|
||||
//page buttons
|
||||
_Y = Height - 90;
|
||||
|
||||
if ( _Page > 0 )
|
||||
{
|
||||
AddButton( 20, _Y, 0x15E3, 0x15E7, 4, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage( 20, _Y, 0x25EA );
|
||||
}
|
||||
AddLabel( 40, _Y, 88, "Previous Page" );
|
||||
|
||||
|
||||
if ( _Page < _MaxPages - 1 )
|
||||
{
|
||||
AddButton( Width - 40, _Y, 0x15E1, 0x15E5, 5, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage( Width - 40, _Y, 0x25E6 );
|
||||
}
|
||||
AddLabel( Width - 120, _Y, 88, "Next Page" );
|
||||
|
||||
AddLabel( Width / 2 - 10, _Y, 88, String.Format( "({0}/{1})", _Page + 1, _MaxPages ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
int buttonid = info.ButtonID;
|
||||
|
||||
if( buttonid == 4 )
|
||||
{
|
||||
_Owner.SendGump( new BoardGameScoresGump( _Owner, _ControlItem, _Page - 1 ) );
|
||||
}
|
||||
else if( buttonid == 5 )
|
||||
{
|
||||
_Owner.SendGump( new BoardGameScoresGump( _Owner, _ControlItem, _Page + 1 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Solaris.BoardGames;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class BoardGameWonGump : BoardGameGump
|
||||
{
|
||||
public override int Height{ get{ return 140; } }
|
||||
public override int Width{ get{ return 300; } }
|
||||
|
||||
public BoardGameWonGump( Mobile owner, BoardGameControlItem controlitem ) : base( owner, controlitem )
|
||||
{
|
||||
AddLabel( 40, 20, 1152, "Game:" );
|
||||
|
||||
AddLabel( 140, 20, 1172, _ControlItem.GameName );
|
||||
|
||||
AddLabel( 40, 50, 1152, "Congratulations, you won the game!!" );
|
||||
|
||||
//TODO: add info about points earned?
|
||||
|
||||
AddButton( 100, 80, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
_ControlItem.EndGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Solaris.BoardGames;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ConfirmResetGameScoreGump : BoardGameGump
|
||||
{
|
||||
public override int Height{ get{ return 200; } }
|
||||
public override int Width{ get{ return 400; } }
|
||||
|
||||
protected int _Y = 30;
|
||||
protected int _X = 20;
|
||||
|
||||
public ConfirmResetGameScoreGump( Mobile owner, BoardGameControlItem controlitem ) : base( owner, controlitem )
|
||||
{
|
||||
AddLabel( 40, 20, 1152, "Game:" );
|
||||
|
||||
AddLabel( 140, 20, 1172, _ControlItem.GameName );
|
||||
|
||||
AddHtml( 40, 50, Width - 80, 80, "You are about to reset all the score data for " + _ControlItem.GameName + ". Once you do this, it cannot be undone. Are you sure you wish to do this?", true, false );
|
||||
|
||||
AddButton( 30, 160, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddButton( 160, 160, 0xF1, 0xF2, 0, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if( info.ButtonID == 1 )
|
||||
{
|
||||
BoardGameData.ResetScores( _ControlItem.GameName );
|
||||
|
||||
_Owner.SendMessage( "You have now reset all the scores." );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Solaris.BoardGames;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
//offers a new game to a player
|
||||
public class OfferNewGameGump : BoardGameGump
|
||||
{
|
||||
protected bool _ControlNumberOfPlayers;
|
||||
|
||||
public override int Height{ get{ return 500; } }
|
||||
public override int Width{ get{ return 400; } }
|
||||
|
||||
public OfferNewGameGump( Mobile owner, BoardGameControlItem controlitem, bool controlnumberofplayers ) : base( owner, controlitem )
|
||||
{
|
||||
_ControlNumberOfPlayers = controlnumberofplayers;
|
||||
|
||||
AddLabel( 40, 20, 1152, "Game:" );
|
||||
|
||||
AddLabel( 140, 20, 1172, _ControlItem.GameName );
|
||||
|
||||
AddLabel( 40, 50, 1152, "Description:" );
|
||||
|
||||
AddHtml( 40, 70, 300, 100, _ControlItem.GameDescription, true, true );
|
||||
|
||||
AddLabel( 40, 180, 1152, "Rules:" );
|
||||
|
||||
AddHtml( 40, 200, 300, 150, _ControlItem.GameRules, true, true );
|
||||
|
||||
if( _ControlItem.CostToPlay > 0 )
|
||||
{
|
||||
AddLabel( 40, 370, 1152, "Cost to play:" );
|
||||
AddLabel( 240, 370, 1172, _ControlItem.CostToPlay.ToString() + " gold" );
|
||||
}
|
||||
|
||||
if( _ControlItem.MaxPlayers != _ControlItem.MinPlayers )
|
||||
{
|
||||
AddLabel( 40, 430, 1152, "# of players (" + _ControlItem.MinPlayers.ToString() + "-" + _ControlItem.MaxPlayers.ToString() + "):" );
|
||||
|
||||
if( _ControlNumberOfPlayers )
|
||||
{
|
||||
AddLabel( 60, 410, 1172, "Pick the number of players" );
|
||||
AddTextField( 240, 430, 30, 20, 0, _ControlItem.CurrentMaxPlayers.ToString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
AddLabel( 240, 430, 1152, _ControlItem.CurrentMaxPlayers.ToString() );
|
||||
}
|
||||
}
|
||||
|
||||
AddLabel( 40, 470, 1152, "Play this game?" );
|
||||
|
||||
AddButton( 200, 460, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0 );
|
||||
AddButton( 300, 460, 0xF1, 0xF2, 0, GumpButtonType.Reply, 0 );
|
||||
|
||||
}
|
||||
|
||||
protected override void DeterminePageLayout()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
int buttonid = info.ButtonID;
|
||||
|
||||
//cancel or right click
|
||||
if( buttonid == 0 )
|
||||
{
|
||||
_ControlItem.RemovePlayer( _Owner );
|
||||
|
||||
_Owner.SendMessage( "You decide not to play this game" );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if( _ControlItem.MaxPlayers != _ControlItem.MinPlayers && _ControlNumberOfPlayers )
|
||||
{
|
||||
try
|
||||
{
|
||||
_ControlItem.CurrentMaxPlayers = Int32.Parse( GetTextField( info, 0 ) );
|
||||
|
||||
if( _ControlItem.CurrentMaxPlayers > _ControlItem.MaxPlayers || _ControlItem.CurrentMaxPlayers < _ControlItem.MinPlayers )
|
||||
{
|
||||
throw( new Exception() );
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
_Owner.SendMessage( "Invalid number of players selected. Please try again." );
|
||||
_Owner.SendGump( new OfferNewGameGump( _Owner, _ControlItem, _ControlNumberOfPlayers ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
_Owner.SendMessage( "You have signed up for this game." );
|
||||
|
||||
_ControlItem.AddPlayer( _Owner );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Solaris.BoardGames;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class SelectStyleGump : Gump
|
||||
{
|
||||
public virtual int Height{ get{ return 150; } }
|
||||
public virtual int Width{ get{ return 200; } }
|
||||
|
||||
protected int _Y = 30;
|
||||
protected int _X = 20;
|
||||
|
||||
protected BoardGameControlItem _ControlItem;
|
||||
|
||||
public SelectStyleGump( Mobile owner, BoardGameControlItem controlitem ) : base( 450, 80 )
|
||||
{
|
||||
Closable = false;
|
||||
|
||||
owner.CloseGump( typeof( SelectStyleGump ) );
|
||||
|
||||
_ControlItem = controlitem;
|
||||
|
||||
if( _ControlItem.Players.IndexOf( owner ) == -1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 0, 0, Width, Height, 0x1400 );
|
||||
|
||||
AddLabel( 20, 60, 1152, "# of players (" + _ControlItem.MinPlayers.ToString() + "-" + _ControlItem.MaxPlayers.ToString() + "):" );
|
||||
|
||||
int minplayers = Math.Max( _ControlItem.MinPlayers, _ControlItem.Players.Count );
|
||||
|
||||
if( _ControlItem.MaxPlayers != _ControlItem.MinPlayers && !_ControlItem.SettingsReady )
|
||||
{
|
||||
AddLabel( 20, 40, 1172, "Pick the number of players" );
|
||||
AddTextField( 150, 60, 30, 20, 0, _ControlItem.CurrentMaxPlayers.ToString() );
|
||||
AddButton( 182, 62, 0x4B9, 0x4BA, 500, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
AddLabel( 150, 60, 1152, _ControlItem.CurrentMaxPlayers.ToString() );
|
||||
}
|
||||
|
||||
|
||||
//AddButton( Width - 15, 0, 3, 4, 0, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
public void AddTextField( int x, int y, int width, int height, int index, string text )
|
||||
{
|
||||
AddImageTiled( x - 2, y - 2, width + 4, height + 4, 0xA2C );
|
||||
AddAlphaRegion( x -2, y - 2, width + 4, height + 4 );
|
||||
AddTextEntry( x + 2, y + 2, width - 4, height - 4, 1153, index, text );
|
||||
}
|
||||
|
||||
public string GetTextField( RelayInfo info, int index )
|
||||
{
|
||||
TextRelay relay = info.GetTextEntry( index );
|
||||
return ( relay == null ? null : relay.Text.Trim() );
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
if( _ControlItem.Players.IndexOf( from ) != 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if( !_ControlItem.SettingsReady )
|
||||
{
|
||||
_ControlItem.CurrentMaxPlayers = Math.Max( Int32.Parse( GetTextField( info, 0 ) ), _ControlItem.Players.Count );
|
||||
|
||||
if( _ControlItem.CurrentMaxPlayers > _ControlItem.MaxPlayers || _ControlItem.CurrentMaxPlayers < _ControlItem.MinPlayers )
|
||||
{
|
||||
throw( new Exception() );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
from.SendMessage( "Invalid number of players selected. Please try again." );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user