- extensive framework for dueling, tournaments, and events
- IP address command implementor - miscellaneous minor fixes
This commit is contained in:
parent
c52504151b
commit
599b2af6d5
82 changed files with 11920 additions and 63 deletions
|
|
@ -17,14 +17,15 @@ namespace Server.Commands.Generic
|
|||
Self = 0x0020,
|
||||
Region = 0x0040,
|
||||
Contained = 0x0080,
|
||||
IPAddress = 0x0100,
|
||||
|
||||
All = Single | Global | Online | Multi | Area | Self | Region | Contained,
|
||||
All = Single | Global | Online | Multi | Area | Self | Region | Contained | IPAddress,
|
||||
AllMobiles = All & ~Contained,
|
||||
AllNPCs = All & ~(Online | Self | Contained),
|
||||
AllItems = All & ~(Online | Self | Region),
|
||||
AllNPCs = All & ~(IPAddress | Online | Self | Contained),
|
||||
AllItems = All & ~(IPAddress | Online | Self | Region),
|
||||
|
||||
Simple = Single | Multi,
|
||||
Complex = Global | Online | Area | Region | Contained
|
||||
Complex = Global | Online | Area | Region | Contained | IPAddress
|
||||
}
|
||||
|
||||
public abstract class BaseCommandImplementor
|
||||
|
|
@ -40,6 +41,8 @@ namespace Server.Commands.Generic
|
|||
Register( new AreaCommandImplementor() );
|
||||
Register( new SelfCommandImplementor() );
|
||||
Register( new ContainedCommandImplementor() );
|
||||
Register( new IPAddressCommandImplementor() );
|
||||
|
||||
Register( new RangeCommandImplementor() );
|
||||
Register( new ScreenCommandImplementor() );
|
||||
Register( new FacetCommandImplementor() );
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Commands.Generic
|
||||
{
|
||||
public class IPAddressCommandImplementor : BaseCommandImplementor
|
||||
{
|
||||
public IPAddressCommandImplementor()
|
||||
{
|
||||
Accessors = new string[]{ "IPAddress" };
|
||||
SupportRequirement = CommandSupport.IPAddress;
|
||||
SupportsConditionals = true;
|
||||
AccessLevel = AccessLevel.Administrator;
|
||||
Usage = "IPAddress <command> [condition]";
|
||||
Description = "Invokes the command on one mobile from each IP address that is logged in. Optional condition arguments can further restrict the set of objects.";
|
||||
}
|
||||
|
||||
public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
|
||||
{
|
||||
try
|
||||
{
|
||||
Extensions ext = Extensions.Parse( from, ref args );
|
||||
|
||||
bool items, mobiles;
|
||||
|
||||
if ( !CheckObjectTypes( command, ext, out items, out mobiles ) )
|
||||
return;
|
||||
|
||||
if ( !mobiles ) // sanity check
|
||||
{
|
||||
command.LogFailure( "This command does not support mobiles." );
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList list = new ArrayList();
|
||||
ArrayList addresses = new ArrayList();
|
||||
|
||||
System.Collections.Generic.List<NetState> states = NetState.Instances;
|
||||
|
||||
for ( int i = 0; i < states.Count; ++i )
|
||||
{
|
||||
NetState ns = (NetState)states[i];
|
||||
Mobile mob = ns.Mobile;
|
||||
|
||||
if ( mob != null && !addresses.Contains( ns.Address ) && ext.IsValid( mob ) )
|
||||
{
|
||||
list.Add( mob );
|
||||
addresses.Add( ns.Address );
|
||||
}
|
||||
}
|
||||
|
||||
ext.Filter( list );
|
||||
|
||||
obj = list;
|
||||
}
|
||||
catch ( Exception ex )
|
||||
{
|
||||
from.SendMessage( ex.Message );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
297
Scripts/Engines/ConPVP/AcceptDuelGump.cs
Normal file
297
Scripts/Engines/ConPVP/AcceptDuelGump.cs
Normal file
|
|
@ -0,0 +1,297 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class AcceptDuelGump : Gump
|
||||
{
|
||||
private Mobile m_Challenger, m_Challenged;
|
||||
private DuelContext m_Context;
|
||||
private Participant m_Participant;
|
||||
private int m_Slot;
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
return String.Format( "<CENTER>{0}</CENTER>", text );
|
||||
}
|
||||
|
||||
public string Color( string text, int color )
|
||||
{
|
||||
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
|
||||
}
|
||||
|
||||
private const int LabelColor32 = 0xFFFFFF;
|
||||
private const int BlackColor32 = 0x000008;
|
||||
|
||||
private bool m_Active = true;
|
||||
|
||||
public AcceptDuelGump( Mobile challenger, Mobile challenged, DuelContext context, Participant p, int slot ) : base( 50, 50 )
|
||||
{
|
||||
m_Challenger = challenger;
|
||||
m_Challenged = challenged;
|
||||
m_Context = context;
|
||||
m_Participant = p;
|
||||
m_Slot = slot;
|
||||
|
||||
challenged.CloseGump( typeof( AcceptDuelGump ) );
|
||||
|
||||
Closable = false;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
//AddBackground( 0, 0, 400, 220, 9150 );
|
||||
AddBackground( 1, 1, 398, 218, 3600 );
|
||||
//AddBackground( 16, 15, 369, 189, 9100 );
|
||||
|
||||
AddImageTiled( 16, 15, 369, 189, 3604 );
|
||||
AddAlphaRegion( 16, 15, 369, 189 );
|
||||
|
||||
AddImage( 215, -43, 0xEE40 );
|
||||
//AddImage( 330, 141, 0x8BA );
|
||||
|
||||
AddHtml( 22-1, 22, 294, 20, Color( Center( "Duel Challenge" ), BlackColor32 ), false, false );
|
||||
AddHtml( 22+1, 22, 294, 20, Color( Center( "Duel Challenge" ), BlackColor32 ), false, false );
|
||||
AddHtml( 22, 22-1, 294, 20, Color( Center( "Duel Challenge" ), BlackColor32 ), false, false );
|
||||
AddHtml( 22, 22+1, 294, 20, Color( Center( "Duel Challenge" ), BlackColor32 ), false, false );
|
||||
AddHtml( 22, 22, 294, 20, Color( Center( "Duel Challenge" ), LabelColor32 ), false, false );
|
||||
|
||||
string fmt;
|
||||
|
||||
if ( p.Contains( challenger ) )
|
||||
fmt = "You have been asked to join sides with {0} in a duel. Do you accept?";
|
||||
else
|
||||
fmt = "You have been challenged to a duel from {0}. Do you accept?";
|
||||
|
||||
AddHtml( 22-1, 50, 294, 40, Color( String.Format( fmt, challenger.Name ), BlackColor32 ), false, false );
|
||||
AddHtml( 22+1, 50, 294, 40, Color( String.Format( fmt, challenger.Name ), BlackColor32 ), false, false );
|
||||
AddHtml( 22, 50-1, 294, 40, Color( String.Format( fmt, challenger.Name ), BlackColor32 ), false, false );
|
||||
AddHtml( 22, 50+1, 294, 40, Color( String.Format( fmt, challenger.Name ), BlackColor32 ), false, false );
|
||||
AddHtml( 22, 50, 294, 40, Color( String.Format( fmt, challenger.Name ), 0xB0C868 ), false, false );
|
||||
|
||||
AddImageTiled( 32, 88, 264, 1, 9107 );
|
||||
AddImageTiled( 42, 90, 264, 1, 9157 );
|
||||
|
||||
AddRadio( 24, 100, 9727, 9730, true, 1 );
|
||||
AddHtml( 60-1, 105, 250, 20, Color( "Yes, I will fight this duel.", BlackColor32 ), false, false );
|
||||
AddHtml( 60+1, 105, 250, 20, Color( "Yes, I will fight this duel.", BlackColor32 ), false, false );
|
||||
AddHtml( 60, 105-1, 250, 20, Color( "Yes, I will fight this duel.", BlackColor32 ), false, false );
|
||||
AddHtml( 60, 105+1, 250, 20, Color( "Yes, I will fight this duel.", BlackColor32 ), false, false );
|
||||
AddHtml( 60, 105, 250, 20, Color( "Yes, I will fight this duel.", LabelColor32 ), false, false );
|
||||
|
||||
AddRadio( 24, 135, 9727, 9730, false, 2 );
|
||||
AddHtml( 60-1, 140, 250, 20, Color( "No, I do not wish to fight.", BlackColor32 ), false, false );
|
||||
AddHtml( 60+1, 140, 250, 20, Color( "No, I do not wish to fight.", BlackColor32 ), false, false );
|
||||
AddHtml( 60, 140-1, 250, 20, Color( "No, I do not wish to fight.", BlackColor32 ), false, false );
|
||||
AddHtml( 60, 140+1, 250, 20, Color( "No, I do not wish to fight.", BlackColor32 ), false, false );
|
||||
AddHtml( 60, 140, 250, 20, Color( "No, I do not wish to fight.", LabelColor32 ), false, false );
|
||||
|
||||
AddRadio( 24, 170, 9727, 9730, false, 3 );
|
||||
AddHtml( 60-1, 175, 250, 20, Color( "No, knave. Do not ask again.", BlackColor32 ), false, false );
|
||||
AddHtml( 60+1, 175, 250, 20, Color( "No, knave. Do not ask again.", BlackColor32 ), false, false );
|
||||
AddHtml( 60, 175-1, 250, 20, Color( "No, knave. Do not ask again.", BlackColor32 ), false, false );
|
||||
AddHtml( 60, 175+1, 250, 20, Color( "No, knave. Do not ask again.", BlackColor32 ), false, false );
|
||||
AddHtml( 60, 175, 250, 20, Color( "No, knave. Do not ask again.", LabelColor32 ), false, false );
|
||||
|
||||
AddButton( 314, 173, 247, 248, 1, GumpButtonType.Reply, 0 );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 15.0 ), new TimerCallback( AutoReject ) );
|
||||
}
|
||||
|
||||
public void AutoReject()
|
||||
{
|
||||
if ( !m_Active )
|
||||
return;
|
||||
|
||||
m_Active = false;
|
||||
|
||||
m_Challenged.CloseGump( typeof( AcceptDuelGump ) );
|
||||
|
||||
m_Challenger.SendMessage( "{0} seems unresponsive.", m_Challenged.Name );
|
||||
m_Challenged.SendMessage( "You decline the challenge." );
|
||||
}
|
||||
|
||||
private static Hashtable m_IgnoreLists = new Hashtable();
|
||||
|
||||
private class IgnoreEntry
|
||||
{
|
||||
public Mobile m_Ignored;
|
||||
public DateTime m_Expire;
|
||||
|
||||
public Mobile Ignored{ get{ return m_Ignored; } }
|
||||
public bool Expired{ get{ return ( DateTime.Now >= m_Expire ); } }
|
||||
|
||||
private static TimeSpan ExpireDelay = TimeSpan.FromMinutes( 15.0 );
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
m_Expire = DateTime.Now + ExpireDelay;
|
||||
}
|
||||
|
||||
public IgnoreEntry( Mobile ignored )
|
||||
{
|
||||
m_Ignored = ignored;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public static void BeginIgnore( Mobile source, Mobile toIgnore )
|
||||
{
|
||||
ArrayList list = (ArrayList)m_IgnoreLists[source];
|
||||
|
||||
if ( list == null )
|
||||
m_IgnoreLists[source] = list = new ArrayList();
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
IgnoreEntry ie = (IgnoreEntry)list[i];
|
||||
|
||||
if ( ie.Ignored == toIgnore )
|
||||
{
|
||||
ie.Refresh();
|
||||
return;
|
||||
}
|
||||
else if ( ie.Expired )
|
||||
{
|
||||
list.RemoveAt( i-- );
|
||||
}
|
||||
}
|
||||
|
||||
list.Add( new IgnoreEntry( toIgnore ) );
|
||||
}
|
||||
|
||||
public static bool IsIgnored( Mobile source, Mobile check )
|
||||
{
|
||||
ArrayList list = (ArrayList)m_IgnoreLists[source];
|
||||
|
||||
if ( list == null )
|
||||
return false;
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
IgnoreEntry ie = (IgnoreEntry)list[i];
|
||||
|
||||
if ( ie.Expired )
|
||||
list.RemoveAt( i-- );
|
||||
else if ( ie.Ignored == check )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID != 1 || !m_Active || !m_Context.Registered )
|
||||
return;
|
||||
|
||||
m_Active = false;
|
||||
|
||||
if ( !m_Context.Participants.Contains( m_Participant ) )
|
||||
return;
|
||||
|
||||
if ( info.IsSwitched( 1 ) )
|
||||
{
|
||||
PlayerMobile pm = m_Challenged as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
return;
|
||||
|
||||
if ( pm.DuelContext != null )
|
||||
{
|
||||
if ( pm.DuelContext.Initiator == pm )
|
||||
pm.SendMessage( 0x22, "You have already started a duel." );
|
||||
else
|
||||
pm.SendMessage( 0x22, "You have already been challenged in a duel." );
|
||||
|
||||
m_Challenger.SendMessage( "{0} cannot fight because they are already assigned to another duel.", pm.Name );
|
||||
}
|
||||
else if ( DuelContext.CheckCombat( pm ) )
|
||||
{
|
||||
pm.SendMessage( 0x22, "You have recently been in combat with another player and must wait before starting a duel." );
|
||||
m_Challenger.SendMessage( "{0} cannot fight because they have recently been in combat with another player.", pm.Name );
|
||||
}
|
||||
else if ( TournamentController.IsActive )
|
||||
{
|
||||
pm.SendMessage( 0x22, "A tournament is currently active and you may not duel." );
|
||||
m_Challenger.SendMessage( 0x22, "A tournament is currently active and you may not duel." );
|
||||
}
|
||||
else
|
||||
{
|
||||
bool added = false;
|
||||
|
||||
if ( m_Slot >= 0 && m_Slot < m_Participant.Players.Length && m_Participant.Players[m_Slot] == null )
|
||||
{
|
||||
added = true;
|
||||
m_Participant.Players[m_Slot] = new DuelPlayer( m_Challenged, m_Participant );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < m_Participant.Players.Length; ++i )
|
||||
{
|
||||
if ( m_Participant.Players[i] == null )
|
||||
{
|
||||
added = true;
|
||||
m_Participant.Players[i] = new DuelPlayer( m_Challenged, m_Participant );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( added )
|
||||
{
|
||||
m_Challenger.SendMessage( "{0} has accepted the request.", m_Challenged.Name );
|
||||
m_Challenged.SendMessage( "You have accepted the request from {0}.", m_Challenger.Name );
|
||||
|
||||
NetState ns = m_Challenger.NetState;
|
||||
|
||||
if ( ns != null )
|
||||
{
|
||||
foreach ( Gump g in ns.Gumps )
|
||||
{
|
||||
if ( g is ParticipantGump )
|
||||
{
|
||||
ParticipantGump pg = (ParticipantGump)g;
|
||||
|
||||
if ( pg.Participant == m_Participant )
|
||||
{
|
||||
m_Challenger.SendGump( new ParticipantGump( m_Challenger, m_Context, m_Participant ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( g is DuelContextGump )
|
||||
{
|
||||
DuelContextGump dcg = (DuelContextGump)g;
|
||||
|
||||
if ( dcg.Context == m_Context )
|
||||
{
|
||||
m_Challenger.SendGump( new DuelContextGump( m_Challenger, m_Context ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Challenger.SendMessage( "The participant list was full and so {0} could not join.", m_Challenged.Name );
|
||||
m_Challenged.SendMessage( "The participant list was full and so you could not join the fight {1} {0}.", m_Challenger.Name, m_Participant.Contains( m_Challenger ) ? "with" : "against" );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( info.IsSwitched( 3 ) )
|
||||
BeginIgnore( m_Challenged, m_Challenger );
|
||||
|
||||
m_Challenger.SendMessage( "{0} does not wish to fight.", m_Challenged.Name );
|
||||
m_Challenged.SendMessage( "You chose not to fight {1} {0}.", m_Challenger.Name, m_Participant.Contains( m_Challenger ) ? "with" : "against" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
839
Scripts/Engines/ConPVP/Arena.cs
Normal file
839
Scripts/Engines/ConPVP/Arena.cs
Normal file
|
|
@ -0,0 +1,839 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class ArenaController : Item
|
||||
{
|
||||
private Arena m_Arena;
|
||||
private bool m_IsPrivate;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Arena Arena{ get{ return m_Arena; } set{} }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsPrivate{ get{ return m_IsPrivate; } set{ m_IsPrivate = value; } }
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "arena controller"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public ArenaController() : base( 0x1B7A )
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_Arena = new Arena();
|
||||
|
||||
m_Instances.Add( this );
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
|
||||
m_Instances.Remove( this );
|
||||
m_Arena.Delete();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
from.SendGump( new Gumps.PropertiesGump( from, m_Arena ) );
|
||||
}
|
||||
|
||||
public ArenaController( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 );
|
||||
|
||||
writer.Write( (bool) m_IsPrivate );
|
||||
|
||||
m_Arena.Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_IsPrivate = reader.ReadBool();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Arena = new Arena( reader );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_Instances.Add( this );
|
||||
}
|
||||
|
||||
private static List<ArenaController> m_Instances = new List<ArenaController>();
|
||||
|
||||
public static List<ArenaController> Instances{ get{ return m_Instances; } set{ m_Instances = value; } }
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public class ArenaStartPoints
|
||||
{
|
||||
private Point3D[] m_Points;
|
||||
|
||||
public Point3D[] Points{ get{ return m_Points; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D EdgeWest{ get{ return m_Points[0]; } set{ m_Points[0] = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D EdgeEast{ get{ return m_Points[1]; } set{ m_Points[1] = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D EdgeNorth{ get{ return m_Points[2]; } set{ m_Points[2] = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D EdgeSouth{ get{ return m_Points[3]; } set{ m_Points[3] = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D CornerNW{ get{ return m_Points[4]; } set{ m_Points[4] = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D CornerSE{ get{ return m_Points[5]; } set{ m_Points[5] = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D CornerSW{ get{ return m_Points[6]; } set{ m_Points[6] = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D CornerNE{ get{ return m_Points[7]; } set{ m_Points[7] = value; } }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "...";
|
||||
}
|
||||
|
||||
public ArenaStartPoints() : this( new Point3D[8] )
|
||||
{
|
||||
}
|
||||
|
||||
public ArenaStartPoints( Point3D[] points )
|
||||
{
|
||||
m_Points = points;
|
||||
}
|
||||
|
||||
public ArenaStartPoints( GenericReader reader )
|
||||
{
|
||||
m_Points = new Point3D[reader.ReadEncodedInt()];
|
||||
|
||||
for ( int i = 0; i < m_Points.Length; ++i )
|
||||
m_Points[i] = reader.ReadPoint3D();
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) m_Points.Length );
|
||||
|
||||
for ( int i = 0; i < m_Points.Length; ++i )
|
||||
writer.Write( (Point3D) m_Points[i] );
|
||||
}
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public class Arena : IComparable
|
||||
{
|
||||
private Map m_Facet;
|
||||
private Rectangle2D m_Bounds;
|
||||
private Rectangle2D m_Zone;
|
||||
private Point3D m_Outside;
|
||||
private Point3D m_Wall;
|
||||
private Point3D m_GateIn;
|
||||
private Point3D m_GateOut;
|
||||
private ArenaStartPoints m_Points;
|
||||
private bool m_Active;
|
||||
private string m_Name;
|
||||
|
||||
private bool m_IsGuarded;
|
||||
|
||||
private Item m_Teleporter;
|
||||
|
||||
private List<Mobile> m_Players;
|
||||
|
||||
private TournamentController m_Tournament;
|
||||
private Mobile m_Announcer;
|
||||
|
||||
private LadderController m_Ladder;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public LadderController Ladder
|
||||
{
|
||||
get{ return m_Ladder; }
|
||||
set{ m_Ladder = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsGuarded
|
||||
{
|
||||
get{ return m_IsGuarded; }
|
||||
set
|
||||
{
|
||||
m_IsGuarded = value;
|
||||
|
||||
if ( m_Region != null )
|
||||
m_Region.Disabled = !m_IsGuarded;
|
||||
}
|
||||
}
|
||||
|
||||
public Ladder AcquireLadder()
|
||||
{
|
||||
if ( m_Ladder != null )
|
||||
return m_Ladder.Ladder;
|
||||
|
||||
return Server.Engines.ConPVP.Ladder.Instance;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TournamentController Tournament
|
||||
{
|
||||
get{ return m_Tournament; }
|
||||
set
|
||||
{
|
||||
if ( m_Tournament != null )
|
||||
m_Tournament.Tournament.Arenas.Remove( this );
|
||||
|
||||
m_Tournament = value;
|
||||
|
||||
if ( m_Tournament != null )
|
||||
m_Tournament.Tournament.Arenas.Add( this );
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Announcer
|
||||
{
|
||||
get{ return m_Announcer; }
|
||||
set{ m_Announcer = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Name
|
||||
{
|
||||
get{ return m_Name; }
|
||||
set{ m_Name = value; if ( m_Active ) m_Arenas.Sort(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Map Facet
|
||||
{
|
||||
get{ return m_Facet; }
|
||||
set
|
||||
{
|
||||
m_Facet = value;
|
||||
|
||||
if ( m_Teleporter != null )
|
||||
m_Teleporter.Map = value;
|
||||
|
||||
if ( m_Region != null )
|
||||
{
|
||||
if ( m_Facet == null )
|
||||
{
|
||||
m_Region.Unregister();
|
||||
m_Region = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_Zone.Start != Point2D.Zero && m_Zone.End != Point2D.Zero && m_Facet != null )
|
||||
m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Rectangle2D Bounds{ get{ return m_Bounds; } set{ m_Bounds = value; } }
|
||||
|
||||
private SafeZone m_Region;
|
||||
|
||||
public int Spectators
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Region == null )
|
||||
return 0;
|
||||
|
||||
int specs = m_Region.GetPlayerCount() - m_Players.Count;
|
||||
|
||||
if ( specs < 0 )
|
||||
specs = 0;
|
||||
|
||||
return specs;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Rectangle2D Zone
|
||||
{
|
||||
get{ return m_Zone; }
|
||||
set
|
||||
{
|
||||
m_Zone = value;
|
||||
|
||||
if ( m_Zone.Start != Point2D.Zero && m_Zone.End != Point2D.Zero && m_Facet != null )
|
||||
{
|
||||
if ( m_Region != null )
|
||||
m_Region.Unregister();
|
||||
|
||||
m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_Region != null )
|
||||
m_Region.Unregister();
|
||||
|
||||
m_Region = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Outside{ get{ return m_Outside; } set{ m_Outside = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D GateIn{ get{ return m_GateIn; } set{ m_GateIn = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D GateOut{ get{ return m_GateOut; } set{ m_GateOut = value; if ( m_Teleporter != null ) m_Teleporter.Location = m_GateOut; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Wall{ get{ return m_Wall; } set{ m_Wall = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsOccupied{ get{ return ( m_Players.Count > 0 ); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ArenaStartPoints Points{ get{ return m_Points; } set{} }
|
||||
|
||||
public Item Teleporter{ get{ return m_Teleporter; } set{ m_Teleporter = value; } }
|
||||
|
||||
public List<Mobile> Players{ get{ return m_Players; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Active
|
||||
{
|
||||
get{ return m_Active; }
|
||||
set
|
||||
{
|
||||
if ( m_Active == value )
|
||||
return;
|
||||
|
||||
m_Active = value;
|
||||
|
||||
if ( m_Active )
|
||||
{
|
||||
m_Arenas.Add( this );
|
||||
m_Arenas.Sort();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Arenas.Remove( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
Active = false;
|
||||
|
||||
if ( m_Region != null )
|
||||
m_Region.Unregister();
|
||||
|
||||
m_Region = null;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "...";
|
||||
}
|
||||
|
||||
public Point3D GetBaseStartPoint( int index )
|
||||
{
|
||||
if ( index < 0 )
|
||||
index = 0;
|
||||
|
||||
return m_Points.Points[index % m_Points.Points.Length];
|
||||
}
|
||||
|
||||
#region Offsets & Rotation
|
||||
private static Point2D[] m_EdgeOffsets = new Point2D[]
|
||||
{
|
||||
/*
|
||||
* /\
|
||||
* /\/\
|
||||
* /\/\/\
|
||||
* \/\/\/
|
||||
* \/\/\
|
||||
* \/\/
|
||||
*/
|
||||
new Point2D( 0, 0 ),
|
||||
new Point2D( 0, -1 ),
|
||||
new Point2D( 0, +1 ),
|
||||
new Point2D( 1, 0 ),
|
||||
new Point2D( 1, -1 ),
|
||||
new Point2D( 1, +1 ),
|
||||
new Point2D( 2, 0 ),
|
||||
new Point2D( 2, -1 ),
|
||||
new Point2D( 2, +1 ),
|
||||
new Point2D( 3, 0 )
|
||||
};
|
||||
|
||||
// nw corner
|
||||
private static Point2D[] m_CornerOffsets = new Point2D[]
|
||||
{
|
||||
/*
|
||||
* /\
|
||||
* /\/\
|
||||
* /\/\/\
|
||||
* /\/\/\/\
|
||||
* \/\/\/\/
|
||||
*/
|
||||
new Point2D( 0, 0 ),
|
||||
new Point2D( 0, 1 ),
|
||||
new Point2D( 1, 0 ),
|
||||
new Point2D( 1, 1 ),
|
||||
new Point2D( 0, 2 ),
|
||||
new Point2D( 2, 0 ),
|
||||
new Point2D( 2, 1 ),
|
||||
new Point2D( 1, 2 ),
|
||||
new Point2D( 0, 3 ),
|
||||
new Point2D( 3, 0 )
|
||||
};
|
||||
|
||||
private static int[][,] m_Rotate = new int[][,]
|
||||
{
|
||||
new int[,]{ { +1, 0 }, { 0, +1 } }, // west
|
||||
new int[,]{ { -1, 0 }, { 0, -1 } }, // east
|
||||
new int[,]{ { 0, +1 }, { +1, 0 } }, // north
|
||||
new int[,]{ { 0, -1 }, { -1, 0 } }, // south
|
||||
new int[,]{ { +1, 0 }, { 0, +1 } }, // nw
|
||||
new int[,]{ { -1, 0 }, { 0, -1 } }, // se
|
||||
new int[,]{ { 0, +1 }, { +1, 0 } }, // sw
|
||||
new int[,]{ { 0, -1 }, { -1, 0 } }, // ne
|
||||
};
|
||||
#endregion
|
||||
|
||||
public void MoveInside( DuelPlayer[] players, int index )
|
||||
{
|
||||
if ( index < 0 )
|
||||
index = 0;
|
||||
else
|
||||
index %= m_Points.Points.Length;
|
||||
|
||||
Point3D start = GetBaseStartPoint( index );
|
||||
|
||||
int offset = 0;
|
||||
|
||||
Point2D[] offsets = ( index < 4 ) ? m_EdgeOffsets : m_CornerOffsets;
|
||||
int[,] matrix = m_Rotate[index];
|
||||
|
||||
for ( int i = 0; i < players.Length; ++i )
|
||||
{
|
||||
DuelPlayer pl = players[i];
|
||||
|
||||
if ( pl == null )
|
||||
continue;
|
||||
|
||||
Mobile mob = pl.Mobile;
|
||||
|
||||
Point2D p;
|
||||
|
||||
if ( offset < offsets.Length )
|
||||
p = offsets[offset++];
|
||||
else
|
||||
p = offsets[offsets.Length - 1];
|
||||
|
||||
p.X = (p.X * matrix[0, 0]) + (p.Y * matrix[0, 1]);
|
||||
p.Y = (p.X * matrix[1, 0]) + (p.Y * matrix[1, 1]);
|
||||
|
||||
mob.MoveToWorld( new Point3D( start.X + p.X, start.Y + p.Y, start.Z ), m_Facet );
|
||||
mob.Direction = mob.GetDirectionTo( m_Wall );
|
||||
|
||||
m_Players.Add( mob );
|
||||
}
|
||||
}
|
||||
|
||||
public Arena()
|
||||
{
|
||||
m_Points = new ArenaStartPoints();
|
||||
m_Players = new List<Mobile>();
|
||||
}
|
||||
|
||||
public Arena( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 7:
|
||||
{
|
||||
m_IsGuarded = reader.ReadBool();
|
||||
|
||||
goto case 6;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
m_Ladder = reader.ReadItem() as LadderController;
|
||||
|
||||
goto case 5;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
m_Tournament = reader.ReadItem() as TournamentController;
|
||||
m_Announcer = reader.ReadMobile();
|
||||
|
||||
goto case 4;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
m_Name = reader.ReadString();
|
||||
|
||||
goto case 3;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
m_Zone = reader.ReadRect2D();
|
||||
|
||||
goto case 2;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
m_GateIn = reader.ReadPoint3D();
|
||||
m_GateOut = reader.ReadPoint3D();
|
||||
m_Teleporter = reader.ReadItem();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Players = reader.ReadStrongMobileList();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Facet = reader.ReadMap();
|
||||
m_Bounds = reader.ReadRect2D();
|
||||
m_Outside = reader.ReadPoint3D();
|
||||
m_Wall = reader.ReadPoint3D();
|
||||
|
||||
if ( version == 0 )
|
||||
{
|
||||
reader.ReadBool();
|
||||
m_Players = new List<Mobile>();
|
||||
}
|
||||
|
||||
m_Active = reader.ReadBool();
|
||||
m_Points = new ArenaStartPoints( reader );
|
||||
|
||||
if ( m_Active )
|
||||
{
|
||||
m_Arenas.Add( this );
|
||||
m_Arenas.Sort();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_Zone.Start != Point2D.Zero && m_Zone.End != Point2D.Zero && m_Facet != null )
|
||||
m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded );
|
||||
|
||||
if ( IsOccupied )
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), new TimerCallback( Evict ) );
|
||||
|
||||
if ( m_Tournament != null )
|
||||
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( AttachToTournament_Sandbox ) );
|
||||
}
|
||||
|
||||
private void AttachToTournament_Sandbox()
|
||||
{
|
||||
if ( m_Tournament != null )
|
||||
m_Tournament.Tournament.Arenas.Add( this );
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.Administrator, AccessLevel.Administrator )]
|
||||
public bool ForceEvict{ get{ return false; } set{ if ( value ) Evict(); } }
|
||||
|
||||
public void Evict()
|
||||
{
|
||||
Point3D loc;
|
||||
Map facet;
|
||||
|
||||
if ( m_Facet == null )
|
||||
{
|
||||
loc = new Point3D( 2715, 2165, 0 );
|
||||
facet = Map.Felucca;
|
||||
}
|
||||
else
|
||||
{
|
||||
loc = m_Outside;
|
||||
facet = m_Facet;
|
||||
}
|
||||
|
||||
bool hasBounds = ( m_Bounds.Start != Point2D.Zero && m_Bounds.End != Point2D.Zero );
|
||||
|
||||
for ( int i = 0; i < m_Players.Count; ++i )
|
||||
{
|
||||
Mobile mob = m_Players[i];
|
||||
|
||||
if ( mob == null )
|
||||
continue;
|
||||
|
||||
if ( mob.Map == Map.Internal )
|
||||
{
|
||||
if ( (m_Facet == null || mob.LogoutMap == m_Facet) && (!hasBounds || m_Bounds.Contains( mob.LogoutLocation )) )
|
||||
mob.LogoutLocation = loc;
|
||||
}
|
||||
else if ( (m_Facet == null || mob.Map == m_Facet) && (!hasBounds || m_Bounds.Contains( mob.Location )) )
|
||||
{
|
||||
mob.MoveToWorld( loc, facet );
|
||||
}
|
||||
|
||||
mob.Combatant = null;
|
||||
mob.Frozen = false;
|
||||
DuelContext.Debuff( mob );
|
||||
DuelContext.CancelSpell( mob );
|
||||
}
|
||||
|
||||
if ( hasBounds ) {
|
||||
List<Mobile> pets = new List<Mobile>();
|
||||
|
||||
foreach ( Mobile mob in facet.GetMobilesInBounds( m_Bounds ) ) {
|
||||
BaseCreature pet = mob as BaseCreature;
|
||||
|
||||
if ( pet != null && pet.Controlled && pet.ControlMaster != null ) {
|
||||
if ( m_Players.Contains( pet.ControlMaster ) ) {
|
||||
pets.Add( pet );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( Mobile pet in pets ) {
|
||||
pet.Combatant = null;
|
||||
pet.Frozen = false;
|
||||
|
||||
pet.MoveToWorld( loc, facet );
|
||||
}
|
||||
}
|
||||
|
||||
m_Players.Clear();
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 7 );
|
||||
|
||||
writer.Write( (bool) m_IsGuarded );
|
||||
|
||||
writer.Write( (Item) m_Ladder );
|
||||
|
||||
writer.Write( (Item) m_Tournament );
|
||||
writer.Write( (Mobile) m_Announcer );
|
||||
|
||||
writer.Write( (string) m_Name );
|
||||
|
||||
writer.Write( (Rectangle2D) m_Zone );
|
||||
|
||||
writer.Write( (Point3D) m_GateIn );
|
||||
writer.Write( (Point3D) m_GateOut );
|
||||
writer.Write( (Item) m_Teleporter );
|
||||
|
||||
writer.Write( m_Players );
|
||||
|
||||
writer.Write( (Map) m_Facet );
|
||||
writer.Write( (Rectangle2D) m_Bounds );
|
||||
writer.Write( (Point3D) m_Outside );
|
||||
writer.Write( (Point3D) m_Wall );
|
||||
writer.Write( (bool) m_Active );
|
||||
|
||||
m_Points.Serialize( writer );
|
||||
}
|
||||
|
||||
private static List<Arena> m_Arenas = new List<Arena>();
|
||||
|
||||
public static List<Arena> Arenas{ get{ return m_Arenas; } }
|
||||
|
||||
public static Arena FindArena( List<Mobile> players )
|
||||
{
|
||||
Preferences prefs = Preferences.Instance;
|
||||
|
||||
if ( prefs == null )
|
||||
return FindArena();
|
||||
|
||||
if ( m_Arenas.Count == 0 )
|
||||
return null;
|
||||
|
||||
if ( players.Count > 0 )
|
||||
{
|
||||
Mobile first = players[0];
|
||||
|
||||
List<ArenaController> allControllers = ArenaController.Instances;
|
||||
|
||||
for ( int i = 0; i < allControllers.Count; ++i )
|
||||
{
|
||||
ArenaController controller = allControllers[i];
|
||||
|
||||
if ( controller != null && !controller.Deleted && controller.Arena != null && controller.IsPrivate && controller.Map == first.Map && first.InRange( controller, 24 ) )
|
||||
{
|
||||
Multis.BaseHouse house = Multis.BaseHouse.FindHouseAt( controller );
|
||||
bool allNear = true;
|
||||
|
||||
for ( int j = 0; j < players.Count; ++j )
|
||||
{
|
||||
Mobile check = players[j];
|
||||
bool isNear;
|
||||
|
||||
if ( house == null )
|
||||
isNear = ( controller.Map == check.Map && check.InRange( controller, 24 ) );
|
||||
else
|
||||
isNear = ( Multis.BaseHouse.FindHouseAt( check ) == house );
|
||||
|
||||
if ( !isNear )
|
||||
{
|
||||
allNear = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( allNear )
|
||||
return controller.Arena;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<ArenaEntry> arenas = new List<ArenaEntry>();
|
||||
|
||||
for ( int i = 0; i < m_Arenas.Count; ++i )
|
||||
{
|
||||
Arena arena = m_Arenas[i];
|
||||
|
||||
if ( !arena.IsOccupied )
|
||||
arenas.Add( new ArenaEntry( arena ) );
|
||||
}
|
||||
|
||||
if ( arenas.Count == 0 )
|
||||
return m_Arenas[0];
|
||||
|
||||
int tc = 0;
|
||||
|
||||
for ( int i = 0; i < arenas.Count; ++i )
|
||||
{
|
||||
ArenaEntry ae = arenas[i];
|
||||
|
||||
for ( int j = 0; j < players.Count; ++j )
|
||||
{
|
||||
PreferencesEntry pe = prefs.Find( players[j] );
|
||||
|
||||
if ( pe.Disliked.Contains( ae.m_Arena.Name ) )
|
||||
++ae.m_VotesAgainst;
|
||||
else
|
||||
++ae.m_VotesFor;
|
||||
}
|
||||
|
||||
tc += ae.Value;
|
||||
}
|
||||
|
||||
int rn = Utility.Random( tc );
|
||||
|
||||
for ( int i = 0; i < arenas.Count; ++i )
|
||||
{
|
||||
ArenaEntry ae = arenas[i];
|
||||
|
||||
if ( rn < ae.Value )
|
||||
return ae.m_Arena;
|
||||
|
||||
rn -= ae.Value;
|
||||
}
|
||||
|
||||
return arenas[Utility.Random( arenas.Count )].m_Arena;
|
||||
}
|
||||
|
||||
private class ArenaEntry
|
||||
{
|
||||
public Arena m_Arena;
|
||||
public int m_VotesFor;
|
||||
public int m_VotesAgainst;
|
||||
|
||||
public int Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_VotesFor;
|
||||
|
||||
/*if ( m_VotesFor > m_VotesAgainst )
|
||||
return m_VotesFor - m_VotesAgainst;
|
||||
else if ( m_VotesFor > 0 )
|
||||
return 1;
|
||||
else
|
||||
return 0;*/
|
||||
}
|
||||
}
|
||||
|
||||
public ArenaEntry( Arena arena )
|
||||
{
|
||||
m_Arena = arena;
|
||||
}
|
||||
}
|
||||
|
||||
public static Arena FindArena()
|
||||
{
|
||||
if ( m_Arenas.Count == 0 )
|
||||
return null;
|
||||
|
||||
int offset = Utility.Random( m_Arenas.Count );
|
||||
|
||||
for ( int i = 0; i < m_Arenas.Count; ++i )
|
||||
{
|
||||
Arena arena = m_Arenas[(i + offset) % m_Arenas.Count];
|
||||
|
||||
if ( !arena.IsOccupied )
|
||||
return arena;
|
||||
}
|
||||
|
||||
return m_Arenas[offset];
|
||||
}
|
||||
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
Arena c = (Arena)obj;
|
||||
|
||||
string a = m_Name;
|
||||
string b = c.m_Name;
|
||||
|
||||
if ( a == null && b == null )
|
||||
return 0;
|
||||
else if ( a == null )
|
||||
return -1;
|
||||
else if ( b == null )
|
||||
return +1;
|
||||
|
||||
return a.CompareTo( b );
|
||||
}
|
||||
}
|
||||
}
|
||||
296
Scripts/Engines/ConPVP/ArenaGump.cs
Normal file
296
Scripts/Engines/ConPVP/ArenaGump.cs
Normal file
|
|
@ -0,0 +1,296 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class ArenasMoongate : Item
|
||||
{
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "arena moongate"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public ArenasMoongate() : base( 0x1FD4 )
|
||||
{
|
||||
Movable = false;
|
||||
Light = LightType.Circle300;
|
||||
}
|
||||
|
||||
public ArenasMoongate( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
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();
|
||||
Light = LightType.Circle300;
|
||||
}
|
||||
|
||||
public bool UseGate( Mobile from )
|
||||
{
|
||||
if ( DuelContext.CheckCombat( from ) )
|
||||
{
|
||||
from.SendMessage( 0x22, "You have recently been in combat with another player and cannot use this moongate." );
|
||||
return false;
|
||||
}
|
||||
else if ( from.Spell != null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.CloseGump( typeof( ArenaGump ) );
|
||||
from.SendGump( new ArenaGump( from, this ) );
|
||||
|
||||
if ( !from.Hidden || from.AccessLevel == AccessLevel.Player )
|
||||
Effects.PlaySound( from.Location, from.Map, 0x20E );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.InRange( GetWorldLocation(), 1 ) )
|
||||
UseGate( from );
|
||||
else
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
|
||||
}
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
return ( !m.Player || UseGate( m ) );
|
||||
}
|
||||
}
|
||||
|
||||
public class ArenaGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private ArenasMoongate m_Gate;
|
||||
private List<Arena> m_Arenas;
|
||||
|
||||
private void Append( StringBuilder sb, LadderEntry le )
|
||||
{
|
||||
if ( le == null )
|
||||
return;
|
||||
|
||||
if ( sb.Length > 0 )
|
||||
sb.Append( ", " );
|
||||
|
||||
sb.Append( le.Mobile.Name );
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID != 1 )
|
||||
return;
|
||||
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( switches.Length == 0 )
|
||||
return;
|
||||
|
||||
int opt = switches[0];
|
||||
|
||||
if ( opt < 0 || opt >= m_Arenas.Count )
|
||||
return;
|
||||
|
||||
Arena arena = m_Arenas[opt];
|
||||
|
||||
if ( !m_From.InRange( m_Gate.GetWorldLocation(), 1 ) || m_From.Map != m_Gate.Map )
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1019002 ); // You are too far away to use the gate.
|
||||
}
|
||||
else if ( DuelContext.CheckCombat( m_From ) )
|
||||
{
|
||||
m_From.SendMessage( 0x22, "You have recently been in combat with another player and cannot use this moongate." );
|
||||
}
|
||||
else if ( m_From.Spell != null )
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
|
||||
}
|
||||
else if ( m_From.Map == arena.Facet && arena.Zone.Contains( m_From ) )
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1019003 ); // You are already there.
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseCreature.TeleportPets( m_From, arena.GateIn, arena.Facet );
|
||||
|
||||
m_From.Combatant = null;
|
||||
m_From.Warmode = false;
|
||||
m_From.Hidden = true;
|
||||
|
||||
m_From.MoveToWorld( arena.GateIn, arena.Facet );
|
||||
|
||||
Effects.PlaySound( arena.GateIn, arena.Facet, 0x1FE );
|
||||
}
|
||||
}
|
||||
|
||||
public ArenaGump( Mobile from, ArenasMoongate gate ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Gate = gate;
|
||||
m_Arenas = Arena.Arenas;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
int height = 12 + 20 + (m_Arenas.Count * 31) + 24 + 12;
|
||||
|
||||
AddBackground( 0, 0, 499+40, height, 0x2436 );
|
||||
|
||||
List<Arena> list = m_Arenas;
|
||||
|
||||
for ( int i = 1; i < list.Count; i += 2 )
|
||||
AddImageTiled( 12, 32 + (i * 31), 475+40, 30, 0x2430 );
|
||||
|
||||
AddAlphaRegion( 10, 10, 479+40, height - 20 );
|
||||
|
||||
AddColumnHeader( 35, null );
|
||||
AddColumnHeader( 115, "Arena" );
|
||||
AddColumnHeader( 325, "Participants" );
|
||||
AddColumnHeader( 40, "Obs" );
|
||||
|
||||
AddButton( 499+40 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0 );
|
||||
AddButton( 499+40 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0 );
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
Arena ar = list[i];
|
||||
|
||||
string name = ar.Name;
|
||||
|
||||
if ( name == null )
|
||||
name = "(no name)";
|
||||
|
||||
int x = 12;
|
||||
int y = 32 + (i * 31);
|
||||
|
||||
int color = ( ar.Players.Count > 0 ? 0xCCFFCC : 0xCCCCCC );
|
||||
|
||||
AddRadio( x + 3, y + 1, 9727, 9730, false, i );
|
||||
x += 35;
|
||||
|
||||
AddBorderedText( x + 5, y + 5, 115 - 5, name, color, 0 );
|
||||
x += 115;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if ( ar.Players.Count > 0 )
|
||||
{
|
||||
Ladder ladder = Ladder.Instance;
|
||||
|
||||
if ( ladder == null )
|
||||
continue;
|
||||
|
||||
LadderEntry p1 = null, p2 = null, p3 = null, p4 = null;
|
||||
|
||||
for ( int j = 0; j < ar.Players.Count; ++j )
|
||||
{
|
||||
Mobile mob = (Mobile)ar.Players[j];
|
||||
LadderEntry c = ladder.Find( mob );
|
||||
|
||||
if ( p1 == null || c.Index < p1.Index )
|
||||
{
|
||||
p4 = p3;
|
||||
p3 = p2;
|
||||
p2 = p1;
|
||||
p1 = c;
|
||||
}
|
||||
else if ( p2 == null || c.Index < p2.Index )
|
||||
{
|
||||
p4 = p3;
|
||||
p3 = p2;
|
||||
p2 = c;
|
||||
}
|
||||
else if ( p3 == null || c.Index < p3.Index )
|
||||
{
|
||||
p4 = p3;
|
||||
p3 = c;
|
||||
}
|
||||
else if ( p4 == null || c.Index < p4.Index )
|
||||
{
|
||||
p4 = c;
|
||||
}
|
||||
}
|
||||
|
||||
Append( sb, p1 );
|
||||
Append( sb, p2 );
|
||||
Append( sb, p3 );
|
||||
Append( sb, p4 );
|
||||
|
||||
if ( ar.Players.Count > 4 )
|
||||
sb.Append( ", ..." );
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append( "Empty" );
|
||||
}
|
||||
|
||||
AddBorderedText( x + 5, y + 5, 325 - 5, sb.ToString(), color, 0 );
|
||||
x += 325;
|
||||
|
||||
AddBorderedText( x, y + 5, 40, Center( ar.Spectators.ToString() ), color, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
return String.Format( "<CENTER>{0}</CENTER>", text );
|
||||
}
|
||||
|
||||
public string Color( string text, int color )
|
||||
{
|
||||
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
|
||||
}
|
||||
|
||||
private void AddBorderedText( int x, int y, int width, string text, int color, int borderColor )
|
||||
{
|
||||
/*AddColoredText( x - 1, y, width, text, borderColor );
|
||||
AddColoredText( x + 1, y, width, text, borderColor );
|
||||
AddColoredText( x, y - 1, width, text, borderColor );
|
||||
AddColoredText( x, y + 1, width, text, borderColor );*/
|
||||
/*AddColoredText( x - 1, y - 1, width, text, borderColor );
|
||||
AddColoredText( x + 1, y + 1, width, text, borderColor );*/
|
||||
AddColoredText( x, y, width, text, color );
|
||||
}
|
||||
|
||||
private void AddColoredText( int x, int y, int width, string text, int color )
|
||||
{
|
||||
if ( color == 0 )
|
||||
AddHtml( x, y, width, 20, text, false, false );
|
||||
else
|
||||
AddHtml( x, y, width, 20, Color( text, color ), false, false );
|
||||
}
|
||||
|
||||
private int m_ColumnX = 12;
|
||||
|
||||
private void AddColumnHeader( int width, string name )
|
||||
{
|
||||
AddBackground( m_ColumnX, 12, width, 20, 0x242C );
|
||||
AddImageTiled( m_ColumnX + 2, 14, width - 4, 16, 0x2430 );
|
||||
|
||||
if ( name != null )
|
||||
AddBorderedText( m_ColumnX, 13, width, Center( name ), 0xFFFFFF, 0 );
|
||||
|
||||
m_ColumnX += width;
|
||||
}
|
||||
}
|
||||
}
|
||||
60
Scripts/Engines/ConPVP/BeginGump.cs
Normal file
60
Scripts/Engines/ConPVP/BeginGump.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class BeginGump : Gump
|
||||
{
|
||||
public string Center( string text )
|
||||
{
|
||||
return String.Format( "<CENTER>{0}</CENTER>", text );
|
||||
}
|
||||
|
||||
public string Color( string text, int color )
|
||||
{
|
||||
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
|
||||
}
|
||||
|
||||
private const int LabelColor32 = 0xFFFFFF;
|
||||
private const int BlackColor32 = 0x000008;
|
||||
|
||||
public BeginGump( int count ) : base( 50, 50 )
|
||||
{
|
||||
AddPage( 0 );
|
||||
|
||||
const int offset = 50;
|
||||
|
||||
AddBackground( 1, 1, 398, 202-offset, 3600 );
|
||||
|
||||
AddImageTiled( 16, 15, 369, 173-offset, 3604 );
|
||||
AddAlphaRegion( 16, 15, 369, 173-offset );
|
||||
|
||||
AddImage( 215, -43, 0xEE40 );
|
||||
|
||||
AddHtml( 22-1, 22, 294, 20, Color( Center( "Duel Countdown" ), BlackColor32 ), false, false );
|
||||
AddHtml( 22+1, 22, 294, 20, Color( Center( "Duel Countdown" ), BlackColor32 ), false, false );
|
||||
AddHtml( 22, 22-1, 294, 20, Color( Center( "Duel Countdown" ), BlackColor32 ), false, false );
|
||||
AddHtml( 22, 22+1, 294, 20, Color( Center( "Duel Countdown" ), BlackColor32 ), false, false );
|
||||
AddHtml( 22, 22, 294, 20, Color( Center( "Duel Countdown" ), LabelColor32 ), false, false );
|
||||
|
||||
AddHtml( 22-1, 50, 294, 80, Color( "The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.", BlackColor32 ), false, false );
|
||||
AddHtml( 22+1, 50, 294, 80, Color( "The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.", BlackColor32 ), false, false );
|
||||
AddHtml( 22, 50-1, 294, 80, Color( "The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.", BlackColor32 ), false, false );
|
||||
AddHtml( 22, 50+1, 294, 80, Color( "The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.", BlackColor32 ), false, false );
|
||||
AddHtml( 22, 50, 294, 80, Color( "The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.", 0xFFCC66 ), false, false );
|
||||
|
||||
/*AddImageTiled( 32, 128, 264, 1, 9107 );
|
||||
AddImageTiled( 42, 130, 264, 1, 9157 );
|
||||
|
||||
AddHtml( 60-1, 140, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#{2:X6}>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false );
|
||||
AddHtml( 60+1, 140, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#{2:X6}>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false );
|
||||
AddHtml( 60, 140-1, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#{2:X6}>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false );
|
||||
AddHtml( 60, 140+1, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#{2:X6}>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false );
|
||||
AddHtml( 60, 140, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#FF6666>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", 0x66AACC ), 0x66AACC ), false, false );*/
|
||||
|
||||
AddButton( 314-50, 157-offset, 247, 248, 1, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
2623
Scripts/Engines/ConPVP/DuelContext.cs
Normal file
2623
Scripts/Engines/ConPVP/DuelContext.cs
Normal file
File diff suppressed because it is too large
Load diff
137
Scripts/Engines/ConPVP/DuelContextGump.cs
Normal file
137
Scripts/Engines/ConPVP/DuelContextGump.cs
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class DuelContextGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private DuelContext m_Context;
|
||||
|
||||
public Mobile From{ get{ return m_From; } }
|
||||
public DuelContext Context{ get{ return m_Context; } }
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
return String.Format( "<CENTER>{0}</CENTER>", text );
|
||||
}
|
||||
|
||||
public void AddGoldenButton( int x, int y, int bid )
|
||||
{
|
||||
AddButton( x , y , 0xD2, 0xD2, bid, GumpButtonType.Reply, 0 );
|
||||
AddButton( x+3, y+3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
public void AddGoldenButtonLabeled( int x, int y, int bid, string text )
|
||||
{
|
||||
AddGoldenButton( x, y, bid );
|
||||
AddHtml( x + 25, y, 200, 20, text, false, false );
|
||||
}
|
||||
|
||||
public DuelContextGump( Mobile from, DuelContext context ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Context = context;
|
||||
|
||||
from.CloseGump( typeof( RulesetGump ) );
|
||||
from.CloseGump( typeof( DuelContextGump ) );
|
||||
from.CloseGump( typeof( ParticipantGump ) );
|
||||
|
||||
int count = context.Participants.Count;
|
||||
|
||||
if ( count < 3 )
|
||||
count = 3;
|
||||
|
||||
int height = 35 + 10 + 22 + 30 + 22 + 22 + 2 + (count * 22) + 2 + 30;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 300, height, 9250 );
|
||||
AddBackground( 10, 10, 280, height - 20, 0xDAC );
|
||||
|
||||
AddHtml( 35, 25, 230, 20, Center( "Duel Setup" ), false, false );
|
||||
|
||||
int x = 35;
|
||||
int y = 47;
|
||||
|
||||
AddGoldenButtonLabeled( x, y, 1, "Rules" ); y += 22;
|
||||
AddGoldenButtonLabeled( x, y, 2, "Start" ); y += 22;
|
||||
AddGoldenButtonLabeled( x, y, 3, "Add Participant" ); y += 30;
|
||||
|
||||
AddHtml( 35, y, 230, 20, Center( "Participants" ), false, false ); y += 22;
|
||||
|
||||
for ( int i = 0; i < context.Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)context.Participants[i];
|
||||
|
||||
AddGoldenButtonLabeled( x, y, 4 + i, String.Format( p.Count == 1 ? "Player {0}: {3}" : "Team {0}: {1}/{2}: {3}", 1 + i, p.FilledSlots, p.Count, p.NameList ) ); y += 22;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( !m_Context.Registered )
|
||||
return;
|
||||
|
||||
int index = info.ButtonID;
|
||||
|
||||
switch ( index )
|
||||
{
|
||||
case -1: // CloseGump
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 0: // closed
|
||||
{
|
||||
m_Context.Unregister();
|
||||
break;
|
||||
}
|
||||
case 1: // Rules
|
||||
{
|
||||
//m_From.SendGump( new RulesetGump( m_From, m_Context.Ruleset, m_Context.Ruleset.Layout, m_Context ) );
|
||||
m_From.SendGump( new PickRulesetGump( m_From, m_Context, m_Context.Ruleset ) );
|
||||
break;
|
||||
}
|
||||
case 2: // Start
|
||||
{
|
||||
if ( m_Context.CheckFull() )
|
||||
{
|
||||
m_Context.CloseAllGumps();
|
||||
m_Context.SendReadyUpGump();
|
||||
//m_Context.SendReadyGump();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendMessage( "You cannot start the duel before all participating players have been assigned." );
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // New Participant
|
||||
{
|
||||
if ( m_Context.Participants.Count < 10 )
|
||||
m_Context.Participants.Add( new Participant( m_Context, 1 ) );
|
||||
else
|
||||
m_From.SendMessage( "The number of participating parties may not be increased further." );
|
||||
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
|
||||
break;
|
||||
}
|
||||
default: // Participant
|
||||
{
|
||||
index -= 4;
|
||||
|
||||
if ( index >= 0 && index < m_Context.Participants.Count )
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, (Participant)m_Context.Participants[index] ) );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
96
Scripts/Engines/ConPVP/DuelTeleporterAddon.cs
Normal file
96
Scripts/Engines/ConPVP/DuelTeleporterAddon.cs
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public enum DuelTeleporterType
|
||||
{
|
||||
Squares = 6095,
|
||||
Buds = 6104,
|
||||
Flowers = 6113,
|
||||
Spikes = 6122,
|
||||
Arrows = 6140,
|
||||
Links = 6149
|
||||
}
|
||||
|
||||
public class DuelTeleporterAddon : BaseAddon
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DuelTeleporterType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( Components.Count > 0 )
|
||||
return (DuelTeleporterType)(((Item)Components[0]).ItemID);
|
||||
|
||||
return DuelTeleporterType.Squares;
|
||||
}
|
||||
set
|
||||
{
|
||||
for ( int i = 0; i < Components.Count && i < 9; ++i )
|
||||
((Item)Components[i]).ItemID = i + (int)value;
|
||||
}
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public DuelTeleporterAddon() : this( DuelTeleporterType.Squares )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public DuelTeleporterAddon( DuelTeleporterType type )
|
||||
{
|
||||
int itemID = (int)type;
|
||||
|
||||
AddComponent( new AddonComponent( itemID + 0 ), -1, -1, 5 );
|
||||
AddComponent( new AddonComponent( itemID + 1 ), -1, 0, 5 );
|
||||
AddComponent( new AddonComponent( itemID + 2 ), 0, -1, 5 );
|
||||
AddComponent( new AddonComponent( itemID + 3 ), -1, +1, 5 );
|
||||
AddComponent( new AddonComponent( itemID + 4 ), 0, 0, 5 );
|
||||
AddComponent( new AddonComponent( itemID + 5 ), +1, -1, 5 );
|
||||
AddComponent( new AddonComponent( itemID + 6 ), 0, +1, 5 );
|
||||
AddComponent( new AddonComponent( itemID + 7 ), +1, 0, 5 );
|
||||
AddComponent( new AddonComponent( itemID + 8 ), +1, +1, 5 );
|
||||
|
||||
AddComponent( new AddonComponent( 0x759 ), -2, -2, 0 );
|
||||
AddComponent( new AddonComponent( 0x75A ), +2, +2, 0 );
|
||||
AddComponent( new AddonComponent( 0x75B ), -2, +2, 0 );
|
||||
AddComponent( new AddonComponent( 0x75C ), +2, -2, 0 );
|
||||
|
||||
AddComponent( new AddonComponent( 0x751 ), -1, +2, 0 );
|
||||
AddComponent( new AddonComponent( 0x751 ), 0, +2, 0 );
|
||||
AddComponent( new AddonComponent( 0x751 ), +1, +2, 0 );
|
||||
|
||||
AddComponent( new AddonComponent( 0x752 ), +2, -1, 0 );
|
||||
AddComponent( new AddonComponent( 0x752 ), +2, 0, 0 );
|
||||
AddComponent( new AddonComponent( 0x752 ), +2, +1, 0 );
|
||||
|
||||
AddComponent( new AddonComponent( 0x753 ), -1, -2, 0 );
|
||||
AddComponent( new AddonComponent( 0x753 ), 0, -2, 0 );
|
||||
AddComponent( new AddonComponent( 0x753 ), +1, -2, 0 );
|
||||
|
||||
AddComponent( new AddonComponent( 0x754 ), -2, -1, 0 );
|
||||
AddComponent( new AddonComponent( 0x754 ), -2, 0, 0 );
|
||||
AddComponent( new AddonComponent( 0x754 ), -2, +1, 0 );
|
||||
}
|
||||
|
||||
public DuelTeleporterAddon( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
81
Scripts/Engines/ConPVP/Games/EventGame.cs
Normal file
81
Scripts/Engines/ConPVP/Games/EventGame.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public abstract class EventController : Item
|
||||
{
|
||||
public abstract EventGame Construct( DuelContext dc );
|
||||
|
||||
public abstract string Title { get; }
|
||||
|
||||
public abstract string GetTeamName( int teamID );
|
||||
|
||||
public EventController()
|
||||
: base( 0x1B7A )
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public EventController( Serial serial )
|
||||
: base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
from.SendGump( new Gumps.PropertiesGump( from, this ) );
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class EventGame
|
||||
{
|
||||
protected DuelContext m_Context;
|
||||
|
||||
public DuelContext Context { get { return m_Context; } }
|
||||
|
||||
public virtual bool FreeConsume { get { return true; } }
|
||||
|
||||
public EventGame( DuelContext context )
|
||||
{
|
||||
m_Context = context;
|
||||
}
|
||||
|
||||
public virtual bool OnDeath( Mobile mob, Container corpse )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool CantDoAnything( Mobile mob )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void OnStart()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnStop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
378
Scripts/Engines/ConPVP/Ladder.cs
Normal file
378
Scripts/Engines/ConPVP/Ladder.cs
Normal file
|
|
@ -0,0 +1,378 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class LadderController : Item
|
||||
{
|
||||
private Ladder m_Ladder;
|
||||
|
||||
//[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Ladder Ladder{ get{ return m_Ladder; } set{} }
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "ladder controller"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public LadderController() : base( 0x1B7A )
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_Ladder = new Ladder();
|
||||
|
||||
if ( Ladder.Instance == null )
|
||||
Ladder.Instance = m_Ladder;
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
if ( Ladder.Instance != m_Ladder )
|
||||
base.Delete();
|
||||
}
|
||||
|
||||
public LadderController( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 );
|
||||
|
||||
m_Ladder.Serialize( writer );
|
||||
|
||||
writer.Write( (bool) ( Server.Engines.ConPVP.Ladder.Instance == m_Ladder ) );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_Ladder = new Ladder( reader );
|
||||
|
||||
if ( version < 1 || reader.ReadBool() )
|
||||
Server.Engines.ConPVP.Ladder.Instance = m_Ladder;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Ladder
|
||||
{
|
||||
private static int[] m_ShortLevels = new int[]
|
||||
{
|
||||
1,
|
||||
2,
|
||||
3, 3,
|
||||
4, 4,
|
||||
5, 5, 5,
|
||||
6, 6, 6,
|
||||
7, 7, 7, 7,
|
||||
8, 8, 8, 8,
|
||||
9, 9, 9, 9, 9
|
||||
};
|
||||
|
||||
public static int GetLevel( int xp )
|
||||
{
|
||||
if ( xp >= 22500 )
|
||||
return 50;
|
||||
else if ( xp >= 2500 )
|
||||
return (10 + ((xp - 2500) / 500));
|
||||
else if ( xp < 0 )
|
||||
xp = 0;
|
||||
|
||||
return m_ShortLevels[xp / 100];
|
||||
}
|
||||
|
||||
private static int[] m_BaseXP = new int[]
|
||||
{
|
||||
0, 100, 200, 400, 600, 900, 1200, 1600, 2000, 2500
|
||||
};
|
||||
|
||||
public static void GetLevelInfo( int level, out int xpBase, out int xpAdvance )
|
||||
{
|
||||
if ( level >= 10 )
|
||||
{
|
||||
xpBase = 2500 + ((level-10)*500);
|
||||
xpAdvance = 500;
|
||||
}
|
||||
else
|
||||
{
|
||||
xpBase = m_BaseXP[level-1];
|
||||
xpAdvance = m_BaseXP[level] - xpBase;
|
||||
}
|
||||
}
|
||||
|
||||
private static int[] m_LossFactors = new int[]
|
||||
{
|
||||
10,
|
||||
11, 11,
|
||||
25, 25,
|
||||
43, 43,
|
||||
67, 67
|
||||
};
|
||||
|
||||
public static int GetLossFactor( int level )
|
||||
{
|
||||
if ( level >= 10 )
|
||||
return 100;
|
||||
|
||||
return m_LossFactors[level - 1];
|
||||
}
|
||||
|
||||
private static int[,] m_OffsetScalar = new int[,]
|
||||
{
|
||||
/* { win, los } */
|
||||
/* -6 */ { 175, 25 },
|
||||
/* -5 */ { 165, 35 },
|
||||
/* -4 */ { 155, 45 },
|
||||
/* -3 */ { 145, 55 },
|
||||
/* -2 */ { 130, 70 },
|
||||
/* -1 */ { 115, 85 },
|
||||
/* 0 */ { 100, 100 },
|
||||
/* +1 */ { 90, 110 },
|
||||
/* +2 */ { 80, 120 },
|
||||
/* +3 */ { 70, 130 },
|
||||
/* +4 */ { 60, 140 },
|
||||
/* +5 */ { 50, 150 },
|
||||
/* +6 */ { 40, 160 }
|
||||
};
|
||||
|
||||
public static int GetOffsetScalar( int ourLevel, int theirLevel, bool win )
|
||||
{
|
||||
int x = ourLevel - theirLevel;
|
||||
|
||||
if ( x < -6 || x > +6 )
|
||||
return 0;
|
||||
|
||||
int y = win ? 0 : 1;
|
||||
|
||||
return m_OffsetScalar[x+6, y];
|
||||
}
|
||||
|
||||
public static int GetExperienceGain( LadderEntry us, LadderEntry them, bool weWon )
|
||||
{
|
||||
if ( us == null || them == null )
|
||||
return 0;
|
||||
|
||||
int ourLevel = GetLevel( us.Experience );
|
||||
int theirLevel = GetLevel( them.Experience );
|
||||
|
||||
int scalar = GetOffsetScalar( ourLevel, theirLevel, weWon );
|
||||
|
||||
if ( scalar == 0 )
|
||||
return 0;
|
||||
|
||||
int xp = 25 * scalar;
|
||||
|
||||
if ( !weWon )
|
||||
xp = (xp * GetLossFactor( ourLevel )) / 100;
|
||||
|
||||
xp /= 100;
|
||||
|
||||
if ( xp <= 0 )
|
||||
xp = 1;
|
||||
|
||||
return xp * (weWon ? 1 : -1);
|
||||
}
|
||||
|
||||
private Hashtable m_Table;
|
||||
private ArrayList m_Entries;
|
||||
|
||||
public ArrayList ToArrayList()
|
||||
{
|
||||
return m_Entries;
|
||||
}
|
||||
|
||||
private int Swap( int idx, int newIdx )
|
||||
{
|
||||
object hold = m_Entries[idx];
|
||||
|
||||
m_Entries[idx] = m_Entries[newIdx];
|
||||
m_Entries[newIdx] = hold;
|
||||
|
||||
((LadderEntry)m_Entries[idx]).Index = idx;
|
||||
((LadderEntry)m_Entries[newIdx]).Index = newIdx;
|
||||
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
public void UpdateEntry( LadderEntry entry )
|
||||
{
|
||||
int index = entry.Index;
|
||||
|
||||
if ( index >= 0 && index < m_Entries.Count )
|
||||
{
|
||||
// sanity
|
||||
|
||||
int c;
|
||||
|
||||
while ( (index - 1) >= 0 && (c = entry.CompareTo( m_Entries[index - 1] )) < 0 )
|
||||
index = Swap( index, index - 1 );
|
||||
|
||||
while ( (index + 1) < m_Entries.Count && (c = entry.CompareTo( m_Entries[index + 1] )) > 0 )
|
||||
index = Swap( index, index + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
public LadderEntry Find( Mobile mob )
|
||||
{
|
||||
LadderEntry entry = (LadderEntry) m_Table[mob];
|
||||
|
||||
if ( entry == null )
|
||||
{
|
||||
m_Table[mob] = entry = new LadderEntry( mob, this );
|
||||
entry.Index = m_Entries.Count;
|
||||
m_Entries.Add( entry );
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
public LadderEntry FindNoCreate( Mobile mob )
|
||||
{
|
||||
return m_Table[mob] as LadderEntry;
|
||||
}
|
||||
|
||||
private static Ladder m_Instance;
|
||||
|
||||
public static Ladder Instance{ get{ return m_Instance; } set{ m_Instance = value; } }
|
||||
|
||||
public Ladder()
|
||||
{
|
||||
m_Table = new Hashtable();
|
||||
m_Entries = new ArrayList();
|
||||
}
|
||||
|
||||
public Ladder( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Table = new Hashtable( count );
|
||||
m_Entries = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
LadderEntry entry = new LadderEntry( reader, this, version );
|
||||
|
||||
if ( entry.Mobile != null )
|
||||
{
|
||||
m_Table[entry.Mobile] = entry;
|
||||
entry.Index = m_Entries.Count;
|
||||
m_Entries.Add( entry );
|
||||
}
|
||||
}
|
||||
|
||||
if ( version == 0 )
|
||||
{
|
||||
m_Entries.Sort();
|
||||
|
||||
for ( int i = 0; i < m_Entries.Count; ++i )
|
||||
{
|
||||
LadderEntry entry = (LadderEntry)m_Entries[i];
|
||||
|
||||
entry.Index = i;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 1 ); // version;
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Entries.Count );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Count; ++i )
|
||||
((LadderEntry)m_Entries[i]).Serialize( writer );
|
||||
}
|
||||
}
|
||||
|
||||
public class LadderEntry : IComparable
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private int m_Experience;
|
||||
private int m_Wins;
|
||||
private int m_Losses;
|
||||
private int m_Index;
|
||||
private Ladder m_Ladder;
|
||||
|
||||
public Mobile Mobile{ get{ return m_Mobile; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int Experience{ get{ return m_Experience; } set{ m_Experience = value; m_Ladder.UpdateEntry(this); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int Wins{ get{ return m_Wins; } set{ m_Wins = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int Losses{ get{ return m_Losses; } set{ m_Losses = value; } }
|
||||
|
||||
public int Index{ get{ return m_Index; } set{ m_Index = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Rank{ get{ return m_Index; } }
|
||||
|
||||
public LadderEntry( Mobile mob, Ladder ladder )
|
||||
{
|
||||
m_Ladder = ladder;
|
||||
m_Mobile = mob;
|
||||
}
|
||||
|
||||
public LadderEntry( GenericReader reader, Ladder ladder, int version )
|
||||
{
|
||||
m_Ladder = ladder;
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
m_Experience = reader.ReadEncodedInt();
|
||||
m_Wins = reader.ReadEncodedInt();
|
||||
m_Losses = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( (Mobile) m_Mobile );
|
||||
writer.WriteEncodedInt( (int) m_Experience );
|
||||
writer.WriteEncodedInt( (int) m_Wins );
|
||||
writer.WriteEncodedInt( (int) m_Losses );
|
||||
}
|
||||
|
||||
public int CompareTo( object obj )
|
||||
{
|
||||
return ((LadderEntry)obj).m_Experience - m_Experience;
|
||||
}
|
||||
}
|
||||
}
|
||||
264
Scripts/Engines/ConPVP/LadderGump.cs
Normal file
264
Scripts/Engines/ConPVP/LadderGump.cs
Normal file
|
|
@ -0,0 +1,264 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class LadderItem : Item
|
||||
{
|
||||
private LadderController m_Ladder;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public LadderController Ladder
|
||||
{
|
||||
get{ return m_Ladder; }
|
||||
set{ m_Ladder = value; }
|
||||
}
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "1v1 leaderboard"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public LadderItem() : base( 0x117F )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public LadderItem( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 );
|
||||
|
||||
writer.Write( (Item) m_Ladder );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Ladder = reader.ReadItem() as LadderController;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.InRange( GetWorldLocation(), 2 ) )
|
||||
{
|
||||
Ladder ladder = Server.Engines.ConPVP.Ladder.Instance;
|
||||
|
||||
if ( m_Ladder != null )
|
||||
ladder = m_Ladder.Ladder;
|
||||
|
||||
if ( ladder != null )
|
||||
{
|
||||
from.CloseGump( typeof( LadderGump ) );
|
||||
from.SendGump( new LadderGump( ladder, 0 ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
|
||||
}
|
||||
}
|
||||
|
||||
public class LadderGump : Gump
|
||||
{
|
||||
private Ladder m_Ladder;
|
||||
private int m_Page;
|
||||
|
||||
public LadderGump( Ladder ladder ) : this( ladder, 0 )
|
||||
{
|
||||
}
|
||||
|
||||
public static string Rank( int num )
|
||||
{
|
||||
string numStr = num.ToString( "N0" );
|
||||
|
||||
if ( (num%100) > 10 && (num%100) < 20 )
|
||||
return numStr + "th";
|
||||
|
||||
switch ( num % 10 )
|
||||
{
|
||||
case 1: return numStr + "st";
|
||||
case 2: return numStr + "nd";
|
||||
case 3: return numStr + "rd";
|
||||
default: return numStr + "th";
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
if ( info.ButtonID == 1 && m_Page > 0 )
|
||||
from.SendGump( new LadderGump( m_Ladder, m_Page - 1 ) );
|
||||
else if ( info.ButtonID == 2 && ((m_Page+1)*15)<Math.Min(m_List.Count,150) )
|
||||
from.SendGump( new LadderGump( m_Ladder, m_Page + 1 ) );
|
||||
}
|
||||
|
||||
private ArrayList m_List;
|
||||
|
||||
public LadderGump( Ladder ladder, int page ) : base( 50, 50 )
|
||||
{
|
||||
m_Ladder = ladder;
|
||||
m_Page = page;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
ArrayList list = ladder.ToArrayList();
|
||||
m_List = list;
|
||||
|
||||
int lc = Math.Min( list.Count, 150 );
|
||||
|
||||
int start = page * 15;
|
||||
int end = start+15;
|
||||
|
||||
if ( end > lc )
|
||||
end = lc;
|
||||
|
||||
int ct = end-start;
|
||||
|
||||
int height = 12 + 20 + (ct*20) + 23 + 12;
|
||||
|
||||
AddBackground( 0, 0, 499, height, 0x2436 );
|
||||
|
||||
for ( int i = start + 1; i < end; i += 2 )
|
||||
AddImageTiled( 12, 32 + ((i - start) * 20), 475, 20, 0x2430 );
|
||||
|
||||
AddAlphaRegion( 10, 10, 479, height - 20 );
|
||||
|
||||
if ( page > 0 )
|
||||
AddButton( 446, height-12-2-16, 0x15E3, 0x15E7, 1, GumpButtonType.Reply, 0 );
|
||||
else
|
||||
AddImage( 446, height-12-2-16, 0x2626 );
|
||||
|
||||
if ( ((page+1)*15)<lc )
|
||||
AddButton( 466, height-12-2-16, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0 );
|
||||
else
|
||||
AddImage( 466, height-12-2-16, 0x2622 );
|
||||
|
||||
AddHtml( 16, height-12-2-18, 400, 20, Color( String.Format( "Top {3} of {0:N0} duelists, page {1} of {2}", list.Count, page+1, (lc+14)/15, lc ), 0xFFC000 ), false, false );
|
||||
|
||||
AddColumnHeader( 75, "Rank" );
|
||||
AddColumnHeader( 115, "Level" );
|
||||
AddColumnHeader( 50, "Guild" );
|
||||
AddColumnHeader( 115, "Name" );
|
||||
AddColumnHeader( 60, "Wins" );
|
||||
AddColumnHeader( 60, "Losses" );
|
||||
|
||||
for ( int i = start; i < end && i < lc; ++i )
|
||||
{
|
||||
LadderEntry entry = (LadderEntry)list[i];
|
||||
|
||||
int y = 32 + ((i - start) * 20);
|
||||
int x = 12;
|
||||
|
||||
AddBorderedText( x, y, 75, Center( Rank( i+1 ) ), 0xFFFFFF, 0 );
|
||||
x += 75;
|
||||
|
||||
/*AddImage( 20, y + 5, 0x2616, 0x96C );
|
||||
AddImage( 22, y + 5, 0x2616, 0x96C );
|
||||
AddImage( 20, y + 7, 0x2616, 0x96C );
|
||||
AddImage( 22, y + 7, 0x2616, 0x96C );
|
||||
|
||||
AddImage( 21, y + 6, 0x2616, 0x454 );*/
|
||||
|
||||
AddImage( x + 3, y + 4, 0x805 );
|
||||
|
||||
int xp = entry.Experience;
|
||||
int level = Ladder.GetLevel( xp );
|
||||
|
||||
int xpBase, xpAdvance;
|
||||
Ladder.GetLevelInfo( level, out xpBase, out xpAdvance );
|
||||
|
||||
int width;
|
||||
|
||||
int xpOffset = xp - xpBase;
|
||||
|
||||
if ( xpOffset >= xpAdvance )
|
||||
width = 109; // level 50
|
||||
else
|
||||
width = ((109 * xpOffset) + (xpAdvance / 2)) / (xpAdvance - 1);
|
||||
|
||||
//AddImageTiled( 21, y + 6, width, 8, 0x2617 );
|
||||
AddImageTiled( x + 3, y + 4, width, 11, 0x806 );
|
||||
AddBorderedText( x, y, 115, Center( level.ToString() ), 0xFFFFFF, 0 );
|
||||
x += 115;
|
||||
|
||||
Mobile mob = entry.Mobile;
|
||||
|
||||
if ( mob.Guild != null )
|
||||
AddBorderedText( x, y, 50, Center( mob.Guild.Abbreviation ), 0xFFFFFF, 0 );
|
||||
|
||||
x += 50;
|
||||
|
||||
AddBorderedText( x + 5, y, 115 - 5, ( mob.Name ), 0xFFFFFF, 0 );
|
||||
x += 115;
|
||||
|
||||
AddBorderedText( x, y, 60, Center( entry.Wins.ToString() ), 0xFFFFFF, 0 );
|
||||
x += 60;
|
||||
|
||||
AddBorderedText( x, y, 60, Center( entry.Losses.ToString() ), 0xFFFFFF, 0 );
|
||||
x += 60;
|
||||
|
||||
//AddBorderedText( 292 + 15, y, 115 - 30, String.Format( "{0} <DIV ALIGN=CENTER>/</DIV> <DIV ALIGN=RIGHT>{1}</DIV>", entry.Wins, entry.Losses ), 0xFFC000, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
return String.Format( "<CENTER>{0}</CENTER>", text );
|
||||
}
|
||||
|
||||
public string Color( string text, int color )
|
||||
{
|
||||
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
|
||||
}
|
||||
|
||||
private void AddBorderedText( int x, int y, int width, string text, int color, int borderColor )
|
||||
{
|
||||
/*AddColoredText( x - 1, y, width, text, borderColor );
|
||||
AddColoredText( x + 1, y, width, text, borderColor );
|
||||
AddColoredText( x, y - 1, width, text, borderColor );
|
||||
AddColoredText( x, y + 1, width, text, borderColor );*/
|
||||
/*AddColoredText( x - 1, y - 1, width, text, borderColor );
|
||||
AddColoredText( x + 1, y + 1, width, text, borderColor );*/
|
||||
AddColoredText( x, y, width, text, color );
|
||||
}
|
||||
|
||||
private void AddColoredText( int x, int y, int width, string text, int color )
|
||||
{
|
||||
if ( color == 0 )
|
||||
AddHtml( x, y, width, 20, text, false, false );
|
||||
else
|
||||
AddHtml( x, y, width, 20, Color( text, color ), false, false );
|
||||
}
|
||||
|
||||
private int m_ColumnX = 12;
|
||||
|
||||
private void AddColumnHeader( int width, string name )
|
||||
{
|
||||
AddBackground( m_ColumnX, 12, width, 20, 0x242C );
|
||||
AddImageTiled( m_ColumnX + 2, 14, width - 4, 16, 0x2430 );
|
||||
AddBorderedText( m_ColumnX, 13, width, Center( name ), 0xFFFFFF, 0 );
|
||||
|
||||
m_ColumnX += width;
|
||||
}
|
||||
}
|
||||
}
|
||||
236
Scripts/Engines/ConPVP/Participant.cs
Normal file
236
Scripts/Engines/ConPVP/Participant.cs
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class Participant
|
||||
{
|
||||
private DuelContext m_Context;
|
||||
private DuelPlayer[] m_Players;
|
||||
private TournyParticipant m_TournyPart;
|
||||
|
||||
public int Count{ get{ return m_Players.Length; } }
|
||||
public DuelPlayer[] Players{ get{ return m_Players; } }
|
||||
public DuelContext Context{ get{ return m_Context; } }
|
||||
public TournyParticipant TournyPart{ get{ return m_TournyPart; } set{ m_TournyPart = value; } }
|
||||
|
||||
public DuelPlayer Find( Mobile mob )
|
||||
{
|
||||
if ( mob is PlayerMobile )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)mob;
|
||||
|
||||
if ( pm.DuelContext == m_Context && pm.DuelPlayer.Participant == this )
|
||||
return pm.DuelPlayer;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] != null && m_Players[i].Mobile == mob )
|
||||
return m_Players[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool Contains( Mobile mob )
|
||||
{
|
||||
return ( Find( mob ) != null );
|
||||
}
|
||||
|
||||
public void Broadcast( int hue, string message, string nonLocalOverhead, string localOverhead )
|
||||
{
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] != null )
|
||||
{
|
||||
if ( message != null )
|
||||
m_Players[i].Mobile.SendMessage( hue, message );
|
||||
|
||||
if ( nonLocalOverhead != null )
|
||||
m_Players[i].Mobile.NonlocalOverheadMessage( Network.MessageType.Regular, hue, false, String.Format( nonLocalOverhead, m_Players[i].Mobile.Name, m_Players[i].Mobile.Female ? "her" : "his" ) );
|
||||
|
||||
if ( localOverhead != null )
|
||||
m_Players[i].Mobile.LocalOverheadMessage( Network.MessageType.Regular, hue, false, localOverhead );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int FilledSlots
|
||||
{
|
||||
get
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] != null )
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasOpenSlot
|
||||
{
|
||||
get
|
||||
{
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] == null )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Eliminated
|
||||
{
|
||||
get
|
||||
{
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] != null && !m_Players[i].Eliminated )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public string NameList
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] == null )
|
||||
continue;
|
||||
|
||||
Mobile mob = m_Players[i].Mobile;
|
||||
|
||||
if ( sb.Length > 0 )
|
||||
sb.Append( ", " );
|
||||
|
||||
sb.Append( mob.Name );
|
||||
}
|
||||
|
||||
if ( sb.Length == 0 )
|
||||
return "Empty";
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public void Nullify( DuelPlayer player )
|
||||
{
|
||||
if ( player == null )
|
||||
return;
|
||||
|
||||
int index = Array.IndexOf( m_Players, player );
|
||||
|
||||
if ( index == -1 )
|
||||
return;
|
||||
|
||||
m_Players[index] = null;
|
||||
}
|
||||
|
||||
public void Remove( DuelPlayer player )
|
||||
{
|
||||
if ( player == null )
|
||||
return;
|
||||
|
||||
int index = Array.IndexOf( m_Players, player );
|
||||
|
||||
if ( index == -1 )
|
||||
return;
|
||||
|
||||
DuelPlayer[] old = m_Players;
|
||||
m_Players = new DuelPlayer[old.Length - 1];
|
||||
|
||||
for ( int i = 0; i < index; ++i )
|
||||
m_Players[i] = old[i];
|
||||
|
||||
for ( int i = index + 1; i < old.Length; ++i )
|
||||
m_Players[i - 1] = old[i];
|
||||
}
|
||||
|
||||
public void Remove( Mobile player )
|
||||
{
|
||||
Remove( Find( player ) );
|
||||
}
|
||||
|
||||
public void Add( Mobile player )
|
||||
{
|
||||
if ( Contains( player ) )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] == null )
|
||||
{
|
||||
m_Players[i] = new DuelPlayer( player, this );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Resize( m_Players.Length + 1 );
|
||||
m_Players[m_Players.Length - 1] = new DuelPlayer( player, this );
|
||||
}
|
||||
|
||||
public void Resize( int count )
|
||||
{
|
||||
DuelPlayer[] old = m_Players;
|
||||
m_Players = new DuelPlayer[count];
|
||||
|
||||
if ( old != null )
|
||||
{
|
||||
int ct = 0;
|
||||
|
||||
for ( int i = 0; i < old.Length; ++i )
|
||||
{
|
||||
if ( old[i] != null && ct < count )
|
||||
m_Players[ct++] = old[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Participant( DuelContext context, int count )
|
||||
{
|
||||
m_Context = context;
|
||||
//m_Stakes = new StakesContainer( context, this );
|
||||
Resize( count );
|
||||
}
|
||||
}
|
||||
|
||||
public class DuelPlayer
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private bool m_Eliminated;
|
||||
private bool m_Ready;
|
||||
private Participant m_Participant;
|
||||
|
||||
public Mobile Mobile{ get{ return m_Mobile; } }
|
||||
public bool Ready{ get{ return m_Ready; } set{ m_Ready = value; } }
|
||||
public bool Eliminated{ get{ return m_Eliminated; } set{ m_Eliminated = value; if ( m_Participant.Context.m_Tournament != null && m_Eliminated ){ m_Participant.Context.m_Tournament.OnEliminated( this ); m_Mobile.SendEverything(); } } }
|
||||
public Participant Participant{ get{ return m_Participant; } set{ m_Participant = value; } }
|
||||
|
||||
public DuelPlayer( Mobile mob, Participant p )
|
||||
{
|
||||
m_Mobile = mob;
|
||||
m_Participant = p;
|
||||
|
||||
if ( mob is PlayerMobile )
|
||||
((PlayerMobile)mob).DuelPlayer = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
250
Scripts/Engines/ConPVP/ParticipantGump.cs
Normal file
250
Scripts/Engines/ConPVP/ParticipantGump.cs
Normal file
|
|
@ -0,0 +1,250 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class ParticipantGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private DuelContext m_Context;
|
||||
private Participant m_Participant;
|
||||
|
||||
public Mobile From{ get{ return m_From; } }
|
||||
public DuelContext Context{ get{ return m_Context; } }
|
||||
public Participant Participant{ get{ return m_Participant; } }
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
return String.Format( "<CENTER>{0}</CENTER>", text );
|
||||
}
|
||||
|
||||
public void AddGoldenButton( int x, int y, int bid )
|
||||
{
|
||||
AddButton( x , y , 0xD2, 0xD2, bid, GumpButtonType.Reply, 0 );
|
||||
AddButton( x+3, y+3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
public void AddGoldenButtonLabeled( int x, int y, int bid, string text )
|
||||
{
|
||||
AddGoldenButton( x, y, bid );
|
||||
AddHtml( x + 25, y, 200, 20, text, false, false );
|
||||
}
|
||||
|
||||
public ParticipantGump( Mobile from, DuelContext context, Participant p ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Context = context;
|
||||
m_Participant = p;
|
||||
|
||||
from.CloseGump( typeof( RulesetGump ) );
|
||||
from.CloseGump( typeof( DuelContextGump ) );
|
||||
from.CloseGump( typeof( ParticipantGump ) );
|
||||
|
||||
int count = p.Players.Length;
|
||||
|
||||
if ( count < 4 )
|
||||
count = 4;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
int height = 35 + 10 + 22 + 22 + 30 + 22 + 2 + (count * 22) + 2 + 30;
|
||||
|
||||
AddBackground( 0, 0, 300, height, 9250 );
|
||||
AddBackground( 10, 10, 280, height - 20, 0xDAC );
|
||||
|
||||
AddButton( 240, 25, 0xFB1, 0xFB3, 3, GumpButtonType.Reply, 0 );
|
||||
|
||||
//AddButton( 223, 54, 0x265A, 0x265A, 4, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddHtml( 35, 25, 230, 20, Center( "Participant Setup" ), false, false );
|
||||
|
||||
int x = 35;
|
||||
int y = 47;
|
||||
|
||||
AddHtml( x, y, 200, 20, String.Format( "Team Size: {0}", p.Players.Length ), false, false ); y += 22;
|
||||
|
||||
AddGoldenButtonLabeled( x + 20, y, 1, "Increase" ); y += 22;
|
||||
AddGoldenButtonLabeled( x + 20, y, 2, "Decrease" ); y += 30;
|
||||
|
||||
AddHtml( 35, y, 230, 20, Center( "Players" ), false, false ); y += 22;
|
||||
|
||||
for ( int i = 0; i < p.Players.Length; ++i )
|
||||
{
|
||||
DuelPlayer pl = p.Players[i];
|
||||
|
||||
AddGoldenButtonLabeled( x, y, 5 + i, String.Format( "{0}: {1}", 1 + i, pl == null ? "Empty" : pl.Mobile.Name ) ); y += 22;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( !m_Context.Registered )
|
||||
return;
|
||||
|
||||
int bid = info.ButtonID;
|
||||
|
||||
if ( bid == 0 )
|
||||
{
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
}
|
||||
else if ( bid == 1 )
|
||||
{
|
||||
if ( m_Participant.Count < 8 )
|
||||
m_Participant.Resize( m_Participant.Count + 1 );
|
||||
else
|
||||
m_From.SendMessage( "You may not raise the team size any further." );
|
||||
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
}
|
||||
else if ( bid == 2 )
|
||||
{
|
||||
if ( m_Participant.Count > 1 && m_Participant.Count > m_Participant.FilledSlots )
|
||||
m_Participant.Resize( m_Participant.Count - 1 );
|
||||
else
|
||||
m_From.SendMessage( "You may not lower the team size any further." );
|
||||
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
}
|
||||
else if ( bid == 3 )
|
||||
{
|
||||
if ( m_Participant.FilledSlots > 0 )
|
||||
{
|
||||
m_From.SendMessage( "There is at least one currently active player. You must remove them first." );
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
}
|
||||
else if ( m_Context.Participants.Count > 2 )
|
||||
{
|
||||
/*Container cont = m_Participant.Stakes;
|
||||
|
||||
if ( cont != null )
|
||||
cont.Delete();*/
|
||||
|
||||
m_Context.Participants.Remove( m_Participant );
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendMessage( "Duels must have at least two participating parties." );
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
}
|
||||
}
|
||||
/*else if ( bid == 4 )
|
||||
{
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
|
||||
Container cont = m_Participant.Stakes;
|
||||
|
||||
if ( cont != null && !cont.Deleted )
|
||||
{
|
||||
cont.DisplayTo( m_From );
|
||||
|
||||
Item[] checks = cont.FindItemsByType( typeof( BankCheck ) );
|
||||
|
||||
int gold = cont.TotalGold;
|
||||
|
||||
for ( int i = 0; i < checks.Length; ++i )
|
||||
gold += ((BankCheck)checks[i]).Worth;
|
||||
|
||||
m_From.SendMessage( "This container has {0} item{1} and {2} stone{3}. In gold or check form there is a total of {4:D}gp.", cont.TotalItems, cont.TotalItems==1?"":"s", cont.TotalWeight, cont.TotalWeight==1?"":"s", gold );
|
||||
}
|
||||
}*/
|
||||
else
|
||||
{
|
||||
bid -= 5;
|
||||
|
||||
if ( bid >= 0 && bid < m_Participant.Players.Length )
|
||||
{
|
||||
if ( m_Participant.Players[bid] == null )
|
||||
{
|
||||
m_From.Target = new ParticipantTarget( m_Context, m_Participant, bid );
|
||||
m_From.SendMessage( "Target a player." );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Participant.Players[bid].Mobile.SendMessage( "You have been removed from the duel." );
|
||||
|
||||
if ( m_Participant.Players[bid].Mobile is PlayerMobile )
|
||||
((PlayerMobile)(m_Participant.Players[bid].Mobile)).DuelPlayer = null;
|
||||
|
||||
m_Participant.Players[bid] = null;
|
||||
m_From.SendMessage( "They have been removed from the duel." );
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ParticipantTarget : Target
|
||||
{
|
||||
private DuelContext m_Context;
|
||||
private Participant m_Participant;
|
||||
private int m_Index;
|
||||
|
||||
public ParticipantTarget( DuelContext context, Participant p, int index ) : base( 12, false, TargetFlags.None )
|
||||
{
|
||||
m_Context = context;
|
||||
m_Participant = p;
|
||||
m_Index = index;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( !m_Context.Registered )
|
||||
return;
|
||||
|
||||
int index = m_Index;
|
||||
|
||||
if ( index < 0 || index >= m_Participant.Players.Length )
|
||||
return;
|
||||
|
||||
Mobile mob = targeted as Mobile;
|
||||
|
||||
if ( mob == null )
|
||||
{
|
||||
from.SendMessage( "That is not a player." );
|
||||
}
|
||||
else if ( !mob.Player )
|
||||
{
|
||||
if ( mob.Body.IsHuman )
|
||||
mob.SayTo( from, 1005443 ); // Nay, I would rather stay here and watch a nail rust.
|
||||
else
|
||||
mob.SayTo( from, 1005444 ); // The creature ignores your offer.
|
||||
}
|
||||
else if ( AcceptDuelGump.IsIgnored( mob, from ) || mob.Blessed )
|
||||
{
|
||||
from.SendMessage( "They ignore your offer." );
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerMobile pm = mob as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
return;
|
||||
|
||||
if ( pm.DuelContext != null )
|
||||
from.SendMessage( "{0} cannot fight because they are already assigned to another duel.", pm.Name );
|
||||
else if ( DuelContext.CheckCombat( pm ) )
|
||||
from.SendMessage( "{0} cannot fight because they have recently been in combat with another player.", pm.Name );
|
||||
else if ( mob.HasGump( typeof( AcceptDuelGump ) ) )
|
||||
from.SendMessage( "{0} has already been offered a duel." );
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You send {0} to {1}.", m_Participant.Find( from ) == null ? "a challenge" : "an invitation", mob.Name );
|
||||
mob.SendGump( new AcceptDuelGump( from, mob, m_Context, m_Participant, m_Index ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
from.SendGump( new ParticipantGump( from, m_Context, m_Participant ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
128
Scripts/Engines/ConPVP/PickRulesetGump.cs
Normal file
128
Scripts/Engines/ConPVP/PickRulesetGump.cs
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class PickRulesetGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private DuelContext m_Context;
|
||||
private Ruleset m_Ruleset;
|
||||
private Ruleset[] m_Defaults;
|
||||
private Ruleset[] m_Flavors;
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
return String.Format( "<CENTER>{0}</CENTER>", text );
|
||||
}
|
||||
|
||||
public PickRulesetGump( Mobile from, DuelContext context, Ruleset ruleset ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Context = context;
|
||||
m_Ruleset = ruleset;
|
||||
m_Defaults = ruleset.Layout.Defaults;
|
||||
m_Flavors = ruleset.Layout.Flavors;
|
||||
|
||||
int height = 25 + 20 + ((m_Defaults.Length + 1) * 22) + 6 + 20 + (m_Flavors.Length * 22) + 25;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 260, height, 9250 );
|
||||
AddBackground( 10, 10, 240, height - 20, 0xDAC );
|
||||
|
||||
AddHtml( 35, 25, 190, 20, Center( "Rules" ), false, false );
|
||||
|
||||
int y = 25 + 20;
|
||||
|
||||
for ( int i = 0; i < m_Defaults.Length; ++i )
|
||||
{
|
||||
Ruleset cur = m_Defaults[i];
|
||||
|
||||
AddHtml( 35 + 14, y, 176, 20, cur.Title, false, false );
|
||||
|
||||
if ( ruleset.Base == cur && !ruleset.Changed )
|
||||
AddImage( 35, y + 4, 0x939 );
|
||||
else if ( ruleset.Base == cur )
|
||||
AddButton( 35, y + 4, 0x93A, 0x939, 2 + i, GumpButtonType.Reply, 0 );
|
||||
else
|
||||
AddButton( 35, y + 4, 0x938, 0x939, 2 + i, GumpButtonType.Reply, 0 );
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
||||
AddHtml( 35 + 14, y, 176, 20, "Custom", false, false );
|
||||
AddButton( 35, y + 4, ruleset.Changed ? 0x939 : 0x938, 0x939, 1, GumpButtonType.Reply, 0 );
|
||||
|
||||
y += 22;
|
||||
y += 6;
|
||||
|
||||
AddHtml( 35, y, 190, 20, Center( "Flavors" ), false, false );
|
||||
y += 20;
|
||||
|
||||
for ( int i = 0; i < m_Flavors.Length; ++i )
|
||||
{
|
||||
Ruleset cur = m_Flavors[i];
|
||||
|
||||
AddHtml( 35 + 14, y, 176, 20, cur.Title, false, false );
|
||||
|
||||
if ( ruleset.Flavors.Contains( cur ) )
|
||||
AddButton( 35, y + 4, 0x939, 0x938, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0 );
|
||||
else
|
||||
AddButton( 35, y + 4, 0x938, 0x939, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0 );
|
||||
|
||||
y += 22;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( m_Context != null && !m_Context.Registered )
|
||||
return;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 0: // closed
|
||||
{
|
||||
if ( m_Context != null )
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // customize
|
||||
{
|
||||
m_From.SendGump( new RulesetGump( m_From, m_Ruleset, m_Ruleset.Layout, m_Context ) );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int idx = info.ButtonID - 2;
|
||||
|
||||
if ( idx >= 0 && idx < m_Defaults.Length )
|
||||
{
|
||||
m_Ruleset.ApplyDefault( m_Defaults[idx] );
|
||||
m_From.SendGump( new PickRulesetGump( m_From, m_Context, m_Ruleset ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
idx -= m_Defaults.Length;
|
||||
|
||||
if ( idx >= 0 && idx < m_Flavors.Length )
|
||||
{
|
||||
if ( m_Ruleset.Flavors.Contains( m_Flavors[idx] ) )
|
||||
m_Ruleset.RemoveFlavor( m_Flavors[idx] );
|
||||
else
|
||||
m_Ruleset.AddFlavor( m_Flavors[idx] );
|
||||
|
||||
m_From.SendGump( new PickRulesetGump( m_From, m_Context, m_Ruleset ) );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
309
Scripts/Engines/ConPVP/Preferences.cs
Normal file
309
Scripts/Engines/ConPVP/Preferences.cs
Normal file
|
|
@ -0,0 +1,309 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class PreferencesController : Item
|
||||
{
|
||||
private Preferences m_Preferences;
|
||||
|
||||
//[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Preferences Preferences{ get{ return m_Preferences; } set{} }
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "preferences controller"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public PreferencesController() : base( 0x1B7A )
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_Preferences = new Preferences();
|
||||
|
||||
if ( Preferences.Instance == null )
|
||||
Preferences.Instance = m_Preferences;
|
||||
else
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
if ( Preferences.Instance != m_Preferences )
|
||||
base.Delete();
|
||||
}
|
||||
|
||||
public PreferencesController( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
|
||||
m_Preferences.Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Preferences = new Preferences( reader );
|
||||
Preferences.Instance = m_Preferences;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Preferences
|
||||
{
|
||||
private ArrayList m_Entries;
|
||||
private Hashtable m_Table;
|
||||
|
||||
public ArrayList Entries{ get{ return m_Entries; } }
|
||||
|
||||
public PreferencesEntry Find( Mobile mob )
|
||||
{
|
||||
PreferencesEntry entry = (PreferencesEntry) m_Table[mob];
|
||||
|
||||
if ( entry == null )
|
||||
{
|
||||
m_Table[mob] = entry = new PreferencesEntry( mob, this );
|
||||
m_Entries.Add( entry );
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
private static Preferences m_Instance;
|
||||
|
||||
public static Preferences Instance{ get{ return m_Instance; } set{ m_Instance = value; } }
|
||||
|
||||
public Preferences()
|
||||
{
|
||||
m_Table = new Hashtable();
|
||||
m_Entries = new ArrayList();
|
||||
}
|
||||
|
||||
public Preferences( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Table = new Hashtable( count );
|
||||
m_Entries = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
PreferencesEntry entry = new PreferencesEntry( reader, this, version );
|
||||
|
||||
if ( entry.Mobile != null )
|
||||
{
|
||||
m_Table[entry.Mobile] = entry;
|
||||
m_Entries.Add( entry );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 0 ); // version;
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Entries.Count );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Count; ++i )
|
||||
((PreferencesEntry)m_Entries[i]).Serialize( writer );
|
||||
}
|
||||
}
|
||||
|
||||
public class PreferencesEntry
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private ArrayList m_Disliked;
|
||||
private Preferences m_Preferences;
|
||||
|
||||
public Mobile Mobile{ get{ return m_Mobile; } }
|
||||
public ArrayList Disliked{ get{ return m_Disliked; } }
|
||||
|
||||
public PreferencesEntry( Mobile mob, Preferences prefs )
|
||||
{
|
||||
m_Preferences = prefs;
|
||||
m_Mobile = mob;
|
||||
m_Disliked = new ArrayList();
|
||||
}
|
||||
|
||||
public PreferencesEntry( GenericReader reader, Preferences prefs, int version )
|
||||
{
|
||||
m_Preferences = prefs;
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Disliked = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
m_Disliked.Add( reader.ReadString() );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( (Mobile) m_Mobile );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Disliked.Count );
|
||||
|
||||
for ( int i = 0; i < m_Disliked.Count; ++i )
|
||||
writer.Write( (string) m_Disliked[i] );
|
||||
}
|
||||
}
|
||||
|
||||
public class PreferencesGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private PreferencesEntry m_Entry;
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( m_Entry == null )
|
||||
return;
|
||||
|
||||
if ( info.ButtonID != 1 )
|
||||
return;
|
||||
|
||||
m_Entry.Disliked.Clear();
|
||||
|
||||
List<Arena> arenas = Arena.Arenas;
|
||||
|
||||
for ( int i = 0; i < info.Switches.Length; ++i )
|
||||
{
|
||||
int idx = info.Switches[i];
|
||||
|
||||
if ( idx >= 0 && idx < arenas.Count )
|
||||
m_Entry.Disliked.Add( arenas[idx].Name );
|
||||
}
|
||||
}
|
||||
|
||||
public PreferencesGump( Mobile from, Preferences prefs ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Entry = prefs.Find( from );
|
||||
|
||||
if ( m_Entry == null )
|
||||
return;
|
||||
|
||||
List<Arena> arenas = Arena.Arenas;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
int height = 12 + 20 + (arenas.Count * 31) + 24 + 12;
|
||||
|
||||
AddBackground( 0, 0, 499+40-365, height, 0x2436 );
|
||||
|
||||
for ( int i = 1; i < arenas.Count; i += 2 )
|
||||
AddImageTiled( 12, 32 + (i * 31), 475+40-365, 30, 0x2430 );
|
||||
|
||||
AddAlphaRegion( 10, 10, 479+40-365, height - 20 );
|
||||
|
||||
AddColumnHeader( 35, null );
|
||||
AddColumnHeader( 115, "Arena" );
|
||||
|
||||
AddButton( 499+40-365 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0 );
|
||||
AddButton( 499+40-365 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0 );
|
||||
|
||||
for ( int i = 0; i < arenas.Count; ++i )
|
||||
{
|
||||
Arena ar = arenas[i];
|
||||
|
||||
string name = ar.Name;
|
||||
|
||||
if ( name == null )
|
||||
name = "(no name)";
|
||||
|
||||
int x = 12;
|
||||
int y = 32 + (i * 31);
|
||||
|
||||
int color = 0xCCFFCC;
|
||||
|
||||
AddCheck( x + 3, y + 1, 9730, 9727, m_Entry.Disliked.Contains(name), i );
|
||||
x += 35;
|
||||
|
||||
AddBorderedText( x + 5, y + 5, 115 - 5, name, color, 0 );
|
||||
x += 115;
|
||||
}
|
||||
}
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
return String.Format( "<CENTER>{0}</CENTER>", text );
|
||||
}
|
||||
|
||||
public string Color( string text, int color )
|
||||
{
|
||||
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
|
||||
}
|
||||
|
||||
private void AddBorderedText( int x, int y, int width, string text, int color, int borderColor )
|
||||
{
|
||||
/*AddColoredText( x - 1, y, width, text, borderColor );
|
||||
AddColoredText( x + 1, y, width, text, borderColor );
|
||||
AddColoredText( x, y - 1, width, text, borderColor );
|
||||
AddColoredText( x, y + 1, width, text, borderColor );*/
|
||||
/*AddColoredText( x - 1, y - 1, width, text, borderColor );
|
||||
AddColoredText( x + 1, y + 1, width, text, borderColor );*/
|
||||
AddColoredText( x, y, width, text, color );
|
||||
}
|
||||
|
||||
private void AddColoredText( int x, int y, int width, string text, int color )
|
||||
{
|
||||
if ( color == 0 )
|
||||
AddHtml( x, y, width, 20, text, false, false );
|
||||
else
|
||||
AddHtml( x, y, width, 20, Color( text, color ), false, false );
|
||||
}
|
||||
|
||||
private int m_ColumnX = 12;
|
||||
|
||||
private void AddColumnHeader( int width, string name )
|
||||
{
|
||||
AddBackground( m_ColumnX, 12, width, 20, 0x242C );
|
||||
AddImageTiled( m_ColumnX + 2, 14, width - 4, 16, 0x2430 );
|
||||
|
||||
if ( name != null )
|
||||
AddBorderedText( m_ColumnX, 13, width, Center( name ), 0xFFFFFF, 0 );
|
||||
|
||||
m_ColumnX += width;
|
||||
}
|
||||
}
|
||||
}
|
||||
110
Scripts/Engines/ConPVP/ReadyGump.cs
Normal file
110
Scripts/Engines/ConPVP/ReadyGump.cs
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class ReadyGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private DuelContext m_Context;
|
||||
private int m_Count;
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
return String.Format( "<CENTER>{0}</CENTER>", text );
|
||||
}
|
||||
|
||||
public ReadyGump( Mobile from, DuelContext context, int count ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Context = context;
|
||||
m_Count = count;
|
||||
|
||||
ArrayList parts = context.Participants;
|
||||
|
||||
int height = 25 + 20;
|
||||
|
||||
for ( int i = 0; i < parts.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)parts[i];
|
||||
|
||||
height += 4;
|
||||
|
||||
if ( p.Players.Length > 1 )
|
||||
height += 22;
|
||||
|
||||
height += (p.Players.Length * 22);
|
||||
}
|
||||
|
||||
height += 25;
|
||||
|
||||
Closable = false;
|
||||
Dragable = false;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 260, height, 9250 );
|
||||
AddBackground( 10, 10, 240, height - 20, 0xDAC );
|
||||
|
||||
if ( count == -1 )
|
||||
{
|
||||
AddHtml( 35, 25, 190, 20, Center( "Ready" ), false, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtml( 35, 25, 190, 20, Center( "Starting" ), false, false );
|
||||
AddHtml( 35, 25, 190, 20, "<DIV ALIGN=RIGHT>" + count.ToString(), false, false );
|
||||
}
|
||||
|
||||
int y = 25 + 20;
|
||||
|
||||
for ( int i = 0; i < parts.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)parts[i];
|
||||
|
||||
y += 4;
|
||||
|
||||
bool isAllReady = true;
|
||||
int yStore = y;
|
||||
int offset = 0;
|
||||
|
||||
if ( p.Players.Length > 1 )
|
||||
{
|
||||
AddHtml( 35 + 14, y, 176, 20, String.Format( "Participant #{0}", i + 1 ), false, false );
|
||||
y += 22;
|
||||
offset = 10;
|
||||
}
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
DuelPlayer pl = p.Players[j];
|
||||
|
||||
if ( pl != null && pl.Ready )
|
||||
{
|
||||
AddImage( 35 + offset, y + 4, 0x939 );
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage( 35 + offset, y + 4, 0x938 );
|
||||
isAllReady = false;
|
||||
}
|
||||
|
||||
string name = ( pl == null ? "(Empty)" : pl.Mobile.Name );
|
||||
|
||||
AddHtml( 35 + offset + 14, y, 166, 20, name, false, false );
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
||||
if ( p.Players.Length > 1 )
|
||||
AddImage( 35, yStore + 4, isAllReady ? 0x939 : 0x938 );
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
235
Scripts/Engines/ConPVP/ReadyUpGump.cs
Normal file
235
Scripts/Engines/ConPVP/ReadyUpGump.cs
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class ReadyUpGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private DuelContext m_Context;
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
return String.Format( "<CENTER>{0}</CENTER>", text );
|
||||
}
|
||||
|
||||
public void AddGoldenButton( int x, int y, int bid )
|
||||
{
|
||||
AddButton( x , y , 0xD2, 0xD2, bid, GumpButtonType.Reply, 0 );
|
||||
AddButton( x+3, y+3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
public ReadyUpGump( Mobile from, DuelContext context ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Context = context;
|
||||
|
||||
Closable = false;
|
||||
AddPage( 0 );
|
||||
|
||||
if ( context.Rematch )
|
||||
{
|
||||
int height = 25 + 20 + 10 + 22 + 25;
|
||||
|
||||
AddBackground( 0, 0, 210, height, 9250 );
|
||||
AddBackground( 10, 10, 190, height - 20, 0xDAC );
|
||||
|
||||
AddHtml( 35, 25, 140, 20, Center( "Rematch?" ), false, false );
|
||||
|
||||
AddButton( 35, 55, 247, 248, 1, GumpButtonType.Reply, 0 );
|
||||
AddButton( 115, 55, 242, 241, 2, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
#region Participants
|
||||
AddPage( 1 );
|
||||
|
||||
ArrayList parts = context.Participants;
|
||||
|
||||
int height = 25 + 20;
|
||||
|
||||
for ( int i = 0; i < parts.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)parts[i];
|
||||
|
||||
height += 4;
|
||||
|
||||
if ( p.Players.Length > 1 )
|
||||
height += 22;
|
||||
|
||||
height += (p.Players.Length * 22);
|
||||
}
|
||||
|
||||
height += 10 + 22 + 25;
|
||||
|
||||
AddBackground( 0, 0, 260, height, 9250 );
|
||||
AddBackground( 10, 10, 240, height - 20, 0xDAC );
|
||||
|
||||
AddHtml( 35, 25, 190, 20, Center( "Participants" ), false, false );
|
||||
|
||||
int y = 20 + 25;
|
||||
|
||||
for ( int i = 0; i < parts.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)parts[i];
|
||||
|
||||
y += 4;
|
||||
|
||||
int offset = 0;
|
||||
|
||||
if ( p.Players.Length > 1 )
|
||||
{
|
||||
AddHtml( 35, y, 176, 20, String.Format( "Team #{0}", i + 1 ), false, false );
|
||||
y += 22;
|
||||
offset = 10;
|
||||
}
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
DuelPlayer pl = p.Players[j];
|
||||
|
||||
string name = ( pl == null ? "(Empty)" : pl.Mobile.Name );
|
||||
|
||||
AddHtml( 35 + offset, y, 166, 20, name, false, false );
|
||||
|
||||
y += 22;
|
||||
}
|
||||
}
|
||||
|
||||
y += 8;
|
||||
|
||||
AddHtml( 35, y, 176, 20, "Continue?", false, false );
|
||||
|
||||
y -= 2;
|
||||
|
||||
AddButton( 102, y, 247, 248, 0, GumpButtonType.Page, 2 );
|
||||
AddButton( 169, y, 242, 241, 2, GumpButtonType.Reply, 0 );
|
||||
#endregion
|
||||
|
||||
#region Rules
|
||||
AddPage( 2 );
|
||||
|
||||
Ruleset ruleset = context.Ruleset;
|
||||
Ruleset basedef = ruleset.Base;
|
||||
|
||||
height = 25 + 20 + 5 + 20 + 20 + 4;
|
||||
|
||||
int changes = 0;
|
||||
|
||||
BitArray defs;
|
||||
|
||||
if ( ruleset.Flavors.Count > 0 )
|
||||
{
|
||||
defs = new BitArray( basedef.Options );
|
||||
|
||||
for ( int i = 0; i < ruleset.Flavors.Count; ++i )
|
||||
defs.Or( ((Ruleset)ruleset.Flavors[i]).Options );
|
||||
|
||||
height += ruleset.Flavors.Count * 18;
|
||||
}
|
||||
else
|
||||
{
|
||||
defs = basedef.Options;
|
||||
}
|
||||
|
||||
BitArray opts = ruleset.Options;
|
||||
|
||||
for ( int i = 0; i < opts.Length; ++i )
|
||||
{
|
||||
if ( defs[i] != opts[i] )
|
||||
++changes;
|
||||
}
|
||||
|
||||
height += (changes * 22);
|
||||
|
||||
height += 10 + 22 + 25;
|
||||
|
||||
AddBackground( 0, 0, 260, height, 9250 );
|
||||
AddBackground( 10, 10, 240, height - 20, 0xDAC );
|
||||
|
||||
AddHtml( 35, 25, 190, 20, Center( "Rules" ), false, false );
|
||||
|
||||
AddHtml( 35, 50, 190, 20, String.Format( "Set: {0}", basedef.Title ), false, false );
|
||||
|
||||
y = 70;
|
||||
|
||||
for ( int i = 0; i < ruleset.Flavors.Count; ++i, y += 18 )
|
||||
AddHtml( 35, y, 190, 20, String.Format( " + {0}", ((Ruleset)ruleset.Flavors[i]).Title ), false, false );
|
||||
|
||||
y += 4;
|
||||
|
||||
if ( changes > 0 )
|
||||
{
|
||||
AddHtml( 35, y, 190, 20, "Modifications:", false, false );
|
||||
y += 20;
|
||||
|
||||
for ( int i = 0; i < opts.Length; ++i )
|
||||
{
|
||||
if ( defs[i] != opts[i] )
|
||||
{
|
||||
string name = ruleset.Layout.FindByIndex( i );
|
||||
|
||||
if ( name != null ) // sanity
|
||||
{
|
||||
AddImage( 35, y, opts[i] ? 0xD3 : 0xD2 );
|
||||
AddHtml( 60, y, 165, 22, name, false, false );
|
||||
}
|
||||
|
||||
y += 22;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtml( 35, y, 190, 20, "Modifications: None", false, false );
|
||||
y += 20;
|
||||
}
|
||||
|
||||
y += 8;
|
||||
|
||||
AddHtml( 35, y, 176, 20, "Continue?", false, false );
|
||||
|
||||
y -= 2;
|
||||
|
||||
AddButton( 102, y, 247, 248, 1, GumpButtonType.Reply, 0 );
|
||||
AddButton( 169, y, 242, 241, 3, GumpButtonType.Reply, 0 );
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( !m_Context.Registered || !m_Context.ReadyWait )
|
||||
return;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 1: // okay
|
||||
{
|
||||
PlayerMobile pm = m_From as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
break;
|
||||
|
||||
pm.DuelPlayer.Ready = true;
|
||||
m_Context.SendReadyGump();
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // reject participants
|
||||
{
|
||||
m_Context.RejectReady( m_From, "participants" );
|
||||
break;
|
||||
}
|
||||
case 3: // reject rules
|
||||
{
|
||||
m_Context.RejectReady( m_From, "rules" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
106
Scripts/Engines/ConPVP/Ruleset.cs
Normal file
106
Scripts/Engines/ConPVP/Ruleset.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class Ruleset
|
||||
{
|
||||
private RulesetLayout m_Layout;
|
||||
private BitArray m_Options;
|
||||
private string m_Title;
|
||||
|
||||
private Ruleset m_Base;
|
||||
private ArrayList m_Flavors = new ArrayList();
|
||||
private bool m_Changed;
|
||||
|
||||
public RulesetLayout Layout{ get{ return m_Layout; } }
|
||||
public BitArray Options{ get{ return m_Options; } }
|
||||
public string Title{ get{ return m_Title; } set{ m_Title = value; } }
|
||||
|
||||
public Ruleset Base{ get{ return m_Base; } }
|
||||
public ArrayList Flavors{ get{ return m_Flavors; } }
|
||||
public bool Changed{ get{ return m_Changed; } set{ m_Changed = value; } }
|
||||
|
||||
public void ApplyDefault( Ruleset newDefault )
|
||||
{
|
||||
m_Base = newDefault;
|
||||
m_Changed = false;
|
||||
|
||||
m_Options = new BitArray( newDefault.m_Options );
|
||||
|
||||
ApplyFlavorsTo( this );
|
||||
}
|
||||
|
||||
public void ApplyFlavorsTo( Ruleset ruleset )
|
||||
{
|
||||
for ( int i = 0; i < m_Flavors.Count; ++i )
|
||||
{
|
||||
Ruleset flavor = (Ruleset)m_Flavors[i];
|
||||
|
||||
m_Options.Or( flavor.m_Options );
|
||||
}
|
||||
}
|
||||
|
||||
public void AddFlavor( Ruleset flavor )
|
||||
{
|
||||
if ( m_Flavors.Contains( flavor ) )
|
||||
return;
|
||||
|
||||
m_Flavors.Add( flavor );
|
||||
m_Options.Or( flavor.m_Options );
|
||||
}
|
||||
|
||||
public void RemoveFlavor( Ruleset flavor )
|
||||
{
|
||||
if ( !m_Flavors.Contains( flavor ) )
|
||||
return;
|
||||
|
||||
m_Flavors.Remove( flavor );
|
||||
m_Options.And( flavor.m_Options.Not() );
|
||||
flavor.m_Options.Not();
|
||||
}
|
||||
|
||||
public void SetOptionRange( string title, bool value )
|
||||
{
|
||||
RulesetLayout layout = m_Layout.FindByTitle( title );
|
||||
|
||||
if ( layout == null )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < layout.TotalLength; ++i )
|
||||
m_Options[i + layout.Offset] = value;
|
||||
|
||||
m_Changed = true;
|
||||
}
|
||||
|
||||
public bool GetOption( string title, string option )
|
||||
{
|
||||
int index = 0;
|
||||
RulesetLayout layout = m_Layout.FindByOption( title, option, ref index );
|
||||
|
||||
if ( layout == null )
|
||||
return true;
|
||||
|
||||
return m_Options[layout.Offset + index];
|
||||
}
|
||||
|
||||
public void SetOption( string title, string option, bool value )
|
||||
{
|
||||
int index = 0;
|
||||
RulesetLayout layout = m_Layout.FindByOption( title, option, ref index );
|
||||
|
||||
if ( layout == null )
|
||||
return;
|
||||
|
||||
m_Options[layout.Offset + index] = value;
|
||||
|
||||
m_Changed = true;
|
||||
}
|
||||
|
||||
public Ruleset( RulesetLayout layout )
|
||||
{
|
||||
m_Layout = layout;
|
||||
m_Options = new BitArray( layout.TotalLength );
|
||||
}
|
||||
}
|
||||
}
|
||||
137
Scripts/Engines/ConPVP/RulesetGump.cs
Normal file
137
Scripts/Engines/ConPVP/RulesetGump.cs
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class RulesetGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private Ruleset m_Ruleset;
|
||||
private RulesetLayout m_Page;
|
||||
private DuelContext m_DuelContext;
|
||||
private bool m_ReadOnly;
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
return String.Format( "<CENTER>{0}</CENTER>", text );
|
||||
}
|
||||
|
||||
public void AddGoldenButton( int x, int y, int bid )
|
||||
{
|
||||
AddButton( x , y , 0xD2, 0xD2, bid, GumpButtonType.Reply, 0 );
|
||||
AddButton( x+3, y+3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
public RulesetGump( Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext ) : this( from, ruleset, page, duelContext, false )
|
||||
{
|
||||
}
|
||||
|
||||
public RulesetGump( Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext, bool readOnly ) : base( readOnly ? 310 : 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Ruleset = ruleset;
|
||||
m_Page = page;
|
||||
m_DuelContext = duelContext;
|
||||
m_ReadOnly = readOnly;
|
||||
|
||||
Dragable = !readOnly;
|
||||
|
||||
from.CloseGump( typeof( RulesetGump ) );
|
||||
from.CloseGump( typeof( DuelContextGump ) );
|
||||
from.CloseGump( typeof( ParticipantGump ) );
|
||||
|
||||
RulesetLayout depthCounter = page;
|
||||
int depth = 0;
|
||||
|
||||
while ( depthCounter != null )
|
||||
{
|
||||
++depth;
|
||||
depthCounter = depthCounter.Parent;
|
||||
}
|
||||
|
||||
int count = page.Children.Length + page.Options.Length;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
int height = 35 + 10 + 2 + (count * 22) + 2 + 30;
|
||||
|
||||
AddBackground( 0, 0, 260, height, 9250 );
|
||||
AddBackground( 10, 10, 240, height - 20, 0xDAC );
|
||||
|
||||
AddHtml( 35, 25, 190, 20, Center( page.Title ), false, false );
|
||||
|
||||
int x = 35;
|
||||
int y = 47;
|
||||
|
||||
for ( int i = 0; i < page.Children.Length; ++i )
|
||||
{
|
||||
AddGoldenButton( x, y, 1 + i );
|
||||
AddHtml( x + 25, y, 250, 22, page.Children[i].Title, false, false );
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < page.Options.Length; ++i )
|
||||
{
|
||||
bool enabled = ruleset.Options[page.Offset + i];
|
||||
|
||||
if ( readOnly )
|
||||
AddImage( x, y, enabled ? 0xD3 : 0xD2 );
|
||||
else
|
||||
AddCheck( x, y, 0xD2, 0xD3, enabled, i );
|
||||
|
||||
AddHtml( x + 25, y, 250, 22, page.Options[i], false, false );
|
||||
|
||||
y += 22;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( m_DuelContext != null && !m_DuelContext.Registered )
|
||||
return;
|
||||
|
||||
if ( !m_ReadOnly )
|
||||
{
|
||||
BitArray opts = new BitArray( m_Page.Options.Length );
|
||||
|
||||
for ( int i = 0; i < info.Switches.Length; ++i )
|
||||
{
|
||||
int sid = info.Switches[i];
|
||||
|
||||
if ( sid >= 0 && sid < m_Page.Options.Length )
|
||||
opts[sid] = true;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < opts.Length; ++i )
|
||||
{
|
||||
if ( m_Ruleset.Options[m_Page.Offset + i] != opts[i] )
|
||||
{
|
||||
m_Ruleset.Options[m_Page.Offset + i] = opts[i];
|
||||
m_Ruleset.Changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int bid = info.ButtonID;
|
||||
|
||||
if ( bid == 0 )
|
||||
{
|
||||
if ( m_Page.Parent != null )
|
||||
m_From.SendGump( new RulesetGump( m_From, m_Ruleset, m_Page.Parent, m_DuelContext, m_ReadOnly ) );
|
||||
else if ( !m_ReadOnly )
|
||||
m_From.SendGump( new PickRulesetGump( m_From, m_DuelContext, m_Ruleset ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
bid -= 1;
|
||||
|
||||
if ( bid >= 0 && bid < m_Page.Children.Length )
|
||||
m_From.SendGump( new RulesetGump( m_From, m_Ruleset, m_Page.Children[bid], m_DuelContext, m_ReadOnly ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
784
Scripts/Engines/ConPVP/RulesetLayout.cs
Normal file
784
Scripts/Engines/ConPVP/RulesetLayout.cs
Normal file
|
|
@ -0,0 +1,784 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class RulesetLayout
|
||||
{
|
||||
private static RulesetLayout m_Root;
|
||||
|
||||
public static RulesetLayout Root
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Root == null )
|
||||
{
|
||||
ArrayList entries = new ArrayList();
|
||||
|
||||
entries.Add( new RulesetLayout( "Spells", new RulesetLayout[]
|
||||
{
|
||||
new RulesetLayout( "1st Circle", "Spells", new string[]
|
||||
{
|
||||
"Reactive Armor", "Clumsy",
|
||||
"Create Food", "Feeblemind",
|
||||
"Heal", "Magic Arrow",
|
||||
"Night Sight", "Weaken"
|
||||
} ),
|
||||
new RulesetLayout( "2nd Circle", "Spells", new string[]
|
||||
{
|
||||
"Agility", "Cunning",
|
||||
"Cure", "Harm",
|
||||
"Magic Trap", "Untrap",
|
||||
"Protection", "Strength"
|
||||
} ),
|
||||
new RulesetLayout( "3rd Circle", "Spells", new string[]
|
||||
{
|
||||
"Bless", "Fireball",
|
||||
"Magic Lock", "Poison",
|
||||
"Telekinesis", "Teleport",
|
||||
"Unlock Spell", "Wall of Stone"
|
||||
} ),
|
||||
new RulesetLayout( "4th Circle", "Spells", new string[]
|
||||
{
|
||||
"Arch Cure", "Arch Protection",
|
||||
"Curse", "Fire Field",
|
||||
"Greater Heal", "Lightning",
|
||||
"Mana Drain", "Recall"
|
||||
} ),
|
||||
new RulesetLayout( "5th Circle", "Spells", new string[]
|
||||
{
|
||||
"Blade Spirits", "Dispel Field",
|
||||
"Incognito", "Magic Reflection",
|
||||
"Mind Blast", "Paralyze",
|
||||
"Poison Field", "Summon Creature"
|
||||
} ),
|
||||
new RulesetLayout( "6th Circle", "Spells", new string[]
|
||||
{
|
||||
"Dispel", "Energy Bolt",
|
||||
"Explosion", "Invisibility",
|
||||
"Mark", "Mass Curse",
|
||||
"Paralyze Field", "Reveal"
|
||||
} ),
|
||||
new RulesetLayout( "7th Circle", "Spells", new string[]
|
||||
{
|
||||
"Chain Lightning", "Energy Field",
|
||||
"Flame Strike", "Gate Travel",
|
||||
"Mana Vampire", "Mass Dispel",
|
||||
"Meteor Swarm", "Polymorph"
|
||||
} ),
|
||||
new RulesetLayout( "8th Circle", "Spells", new string[]
|
||||
{
|
||||
"Earthquake", "Energy Vortex",
|
||||
"Resurrection", "Air Elemental",
|
||||
"Summon Daemon", "Earth Elemental",
|
||||
"Fire Elemental", "Water Elemental"
|
||||
} )
|
||||
} ) );
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
entries.Add( new RulesetLayout( "Chivalry", new string[]
|
||||
{
|
||||
"Cleanse by Fire",
|
||||
"Close Wounds",
|
||||
"Consecrate Weapon",
|
||||
"Dispel Evil",
|
||||
"Divine Fury",
|
||||
"Enemy of One",
|
||||
"Holy Light",
|
||||
"Noble Sacrifice",
|
||||
"Remove Curse",
|
||||
"Sacred Journey"
|
||||
} ) );
|
||||
|
||||
entries.Add( new RulesetLayout( "Necromancy", new string[]
|
||||
{
|
||||
"Animate Dead",
|
||||
"Blood Oath",
|
||||
"Corpse Skin",
|
||||
"Curse Weapon",
|
||||
"Evil Omen",
|
||||
"Horrific Beast",
|
||||
"Lich Form",
|
||||
"Mind Rot",
|
||||
"Pain Spike",
|
||||
"Poison Strike",
|
||||
"Strangle",
|
||||
"Summon Familiar",
|
||||
"Vampiric Embrace",
|
||||
"Vengeful Spirit",
|
||||
"Wither",
|
||||
"Wraith Form"
|
||||
} ) );
|
||||
|
||||
if ( Core.SE )
|
||||
{
|
||||
entries.Add( new RulesetLayout( "Bushido", new string[]
|
||||
{
|
||||
"Confidence",
|
||||
"Counter Attack",
|
||||
"Evasion",
|
||||
"Honorable Execution",
|
||||
"Lightning Strike",
|
||||
"Momentum Strike"
|
||||
} ) );
|
||||
|
||||
entries.Add( new RulesetLayout( "Ninjitsu", new string[]
|
||||
{
|
||||
"Animal Form",
|
||||
"Backstab",
|
||||
"Death Strike",
|
||||
"Focus Attack",
|
||||
"Ki Attack",
|
||||
"Mirror Image",
|
||||
"Shadow Jump",
|
||||
"Suprise Attack"
|
||||
} ) );
|
||||
|
||||
if( Core.ML )
|
||||
{
|
||||
entries.Add( new RulesetLayout( "Spellweaving", new string[]
|
||||
{
|
||||
"Arcane Circle",
|
||||
"Arcane Empowerment",
|
||||
"Attune Weapon",
|
||||
"Dryad Allure",
|
||||
"Essence of Wind",
|
||||
"Ethereal Voyage",
|
||||
"Gift of Life",
|
||||
"Gift of Renewal",
|
||||
"Immolating Weapon",
|
||||
"Nature's Fury",
|
||||
"Reaper Form",
|
||||
"Summon Fey",
|
||||
"Summon Fiend",
|
||||
"Thunderstorm",
|
||||
"Wildfire",
|
||||
"Word of Death"
|
||||
} ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
if ( Core.SE )
|
||||
{
|
||||
entries.Add( new RulesetLayout( "Combat Abilities", new string[]
|
||||
{
|
||||
"Stun",
|
||||
"Disarm",
|
||||
"Armor Ignore",
|
||||
"Bleed Attack",
|
||||
"Concussion Blow",
|
||||
"Crushing Blow",
|
||||
"Disarm",
|
||||
"Dismount",
|
||||
"Double Strike",
|
||||
"Infectious Strike",
|
||||
"Mortal Strike",
|
||||
"Moving Shot",
|
||||
"Paralyzing Blow",
|
||||
"Shadow Strike",
|
||||
"Whirlwind Attack",
|
||||
"Riding Swipe",
|
||||
"Frenzied Whirlwind",
|
||||
"Block",
|
||||
"Defense Mastery",
|
||||
"Nerve Strike",
|
||||
"Talon Strike",
|
||||
"Feint",
|
||||
"Dual Wield",
|
||||
"Double Shot",
|
||||
"Armor Pierce"
|
||||
} ) );
|
||||
|
||||
//TODO: ADD ML ABILITIES
|
||||
}
|
||||
else
|
||||
{
|
||||
entries.Add( new RulesetLayout( "Combat Abilities", new string[]
|
||||
{
|
||||
"Stun",
|
||||
"Disarm",
|
||||
"Armor Ignore",
|
||||
"Bleed Attack",
|
||||
"Concussion Blow",
|
||||
"Crushing Blow",
|
||||
"Disarm",
|
||||
"Dismount",
|
||||
"Double Strike",
|
||||
"Infectious Strike",
|
||||
"Mortal Strike",
|
||||
"Moving Shot",
|
||||
"Paralyzing Blow",
|
||||
"Shadow Strike",
|
||||
"Whirlwind Attack"
|
||||
} ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entries.Add( new RulesetLayout( "Combat Abilities", new string[]
|
||||
{
|
||||
"Stun",
|
||||
"Disarm",
|
||||
"Concussion Blow",
|
||||
"Crushing Blow",
|
||||
"Paralyzing Blow"
|
||||
} ) );
|
||||
}
|
||||
|
||||
entries.Add( new RulesetLayout( "Skills", new string[]
|
||||
{
|
||||
"Anatomy",
|
||||
"Detect Hidden",
|
||||
"Evaluating Intelligence",
|
||||
"Hiding",
|
||||
"Poisoning",
|
||||
"Snooping",
|
||||
"Stealing",
|
||||
"Spirit Speak",
|
||||
"Stealth"
|
||||
} ) );
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
entries.Add( new RulesetLayout( "Weapons", new string[]
|
||||
{
|
||||
"Magical",
|
||||
"Melee",
|
||||
"Ranged",
|
||||
"Poisoned",
|
||||
"Wrestling"
|
||||
} ) );
|
||||
|
||||
entries.Add( new RulesetLayout( "Armor", new string[]
|
||||
{
|
||||
"Magical",
|
||||
"Shields"
|
||||
} ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
entries.Add( new RulesetLayout( "Weapons", new string[]
|
||||
{
|
||||
"Magical",
|
||||
"Melee",
|
||||
"Ranged",
|
||||
"Poisoned",
|
||||
"Wrestling",
|
||||
"Runics"
|
||||
} ) );
|
||||
|
||||
entries.Add( new RulesetLayout( "Armor", new string[]
|
||||
{
|
||||
"Magical",
|
||||
"Shields",
|
||||
"Colored"
|
||||
} ) );
|
||||
}
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
entries.Add( new RulesetLayout( "Items", new RulesetLayout[]
|
||||
{
|
||||
new RulesetLayout( "Potions", new string[]
|
||||
{
|
||||
"Agility",
|
||||
"Cure",
|
||||
"Explosion",
|
||||
"Heal",
|
||||
"Nightsight",
|
||||
"Poison",
|
||||
"Refresh",
|
||||
"Strength"
|
||||
} )
|
||||
},
|
||||
new string[]
|
||||
{
|
||||
"Bandages",
|
||||
"Trapped Containers",
|
||||
"Bolas",
|
||||
"Orange Petals",
|
||||
"Shurikens",
|
||||
"Fukiya Darts",
|
||||
"Fire Horns"
|
||||
} ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
entries.Add( new RulesetLayout( "Items", new RulesetLayout[]
|
||||
{
|
||||
new RulesetLayout( "Potions", new string[]
|
||||
{
|
||||
"Agility",
|
||||
"Cure",
|
||||
"Explosion",
|
||||
"Heal",
|
||||
"Nightsight",
|
||||
"Poison",
|
||||
"Refresh",
|
||||
"Strength"
|
||||
} )
|
||||
},
|
||||
new string[]
|
||||
{
|
||||
"Bandages",
|
||||
"Trapped Containers",
|
||||
"Bolas",
|
||||
"Orange Petals"
|
||||
} ) );
|
||||
}
|
||||
|
||||
m_Root = new RulesetLayout( "Rules", (RulesetLayout[])entries.ToArray( typeof( RulesetLayout ) ) );
|
||||
m_Root.ComputeOffsets();
|
||||
|
||||
// Set up default rulesets
|
||||
|
||||
if( !Core.AOS )
|
||||
{
|
||||
|
||||
#region Mage 5x
|
||||
Ruleset m5x = new Ruleset( m_Root );
|
||||
|
||||
m5x.Title = "Mage 5x";
|
||||
|
||||
m5x.SetOptionRange( "Spells", true );
|
||||
|
||||
m5x.SetOption( "Spells", "Wall of Stone", false );
|
||||
m5x.SetOption( "Spells", "Fire Field", false );
|
||||
m5x.SetOption( "Spells", "Poison Field", false );
|
||||
m5x.SetOption( "Spells", "Energy Field", false );
|
||||
m5x.SetOption( "Spells", "Reactive Armor", false );
|
||||
m5x.SetOption( "Spells", "Protection", false );
|
||||
m5x.SetOption( "Spells", "Teleport", false );
|
||||
m5x.SetOption( "Spells", "Wall of Stone", false );
|
||||
m5x.SetOption( "Spells", "Arch Protection", false );
|
||||
m5x.SetOption( "Spells", "Recall", false );
|
||||
m5x.SetOption( "Spells", "Blade Spirits", false );
|
||||
m5x.SetOption( "Spells", "Incognito", false );
|
||||
m5x.SetOption( "Spells", "Magic Reflection", false );
|
||||
m5x.SetOption( "Spells", "Paralyze", false );
|
||||
m5x.SetOption( "Spells", "Summon Creature", false );
|
||||
m5x.SetOption( "Spells", "Invisibility", false );
|
||||
m5x.SetOption( "Spells", "Mark", false );
|
||||
m5x.SetOption( "Spells", "Paralyze Field", false );
|
||||
m5x.SetOption( "Spells", "Energy Field", false );
|
||||
m5x.SetOption( "Spells", "Gate Travel", false );
|
||||
m5x.SetOption( "Spells", "Polymorph", false );
|
||||
m5x.SetOption( "Spells", "Energy Vortex", false );
|
||||
m5x.SetOption( "Spells", "Air Elemental", false );
|
||||
m5x.SetOption( "Spells", "Summon Daemon", false );
|
||||
m5x.SetOption( "Spells", "Earth Elemental", false );
|
||||
m5x.SetOption( "Spells", "Fire Elemental", false );
|
||||
m5x.SetOption( "Spells", "Water Elemental", false );
|
||||
m5x.SetOption( "Spells", "Earthquake", false );
|
||||
m5x.SetOption( "Spells", "Meteor Swarm", false );
|
||||
m5x.SetOption( "Spells", "Chain Lightning", false );
|
||||
m5x.SetOption( "Spells", "Resurrection", false );
|
||||
|
||||
m5x.SetOption( "Weapons", "Wrestling", true );
|
||||
|
||||
m5x.SetOption( "Skills", "Anatomy", true );
|
||||
m5x.SetOption( "Skills", "Detect Hidden", true );
|
||||
m5x.SetOption( "Skills", "Evaluating Intelligence", true );
|
||||
|
||||
m5x.SetOption( "Items", "Trapped Containers", true );
|
||||
#endregion
|
||||
|
||||
#region Mage 7x
|
||||
Ruleset m7x = new Ruleset( m_Root );
|
||||
|
||||
m7x.Title = "Mage 7x";
|
||||
|
||||
m7x.SetOptionRange( "Spells", true );
|
||||
|
||||
m7x.SetOption( "Spells", "Wall of Stone", false );
|
||||
m7x.SetOption( "Spells", "Fire Field", false );
|
||||
m7x.SetOption( "Spells", "Poison Field", false );
|
||||
m7x.SetOption( "Spells", "Energy Field", false );
|
||||
m7x.SetOption( "Spells", "Reactive Armor", false );
|
||||
m7x.SetOption( "Spells", "Protection", false );
|
||||
m7x.SetOption( "Spells", "Teleport", false );
|
||||
m7x.SetOption( "Spells", "Wall of Stone", false );
|
||||
m7x.SetOption( "Spells", "Arch Protection", false );
|
||||
m7x.SetOption( "Spells", "Recall", false );
|
||||
m7x.SetOption( "Spells", "Blade Spirits", false );
|
||||
m7x.SetOption( "Spells", "Incognito", false );
|
||||
m7x.SetOption( "Spells", "Magic Reflection", false );
|
||||
m7x.SetOption( "Spells", "Paralyze", false );
|
||||
m7x.SetOption( "Spells", "Summon Creature", false );
|
||||
m7x.SetOption( "Spells", "Invisibility", false );
|
||||
m7x.SetOption( "Spells", "Mark", false );
|
||||
m7x.SetOption( "Spells", "Paralyze Field", false );
|
||||
m7x.SetOption( "Spells", "Energy Field", false );
|
||||
m7x.SetOption( "Spells", "Gate Travel", false );
|
||||
m7x.SetOption( "Spells", "Polymorph", false );
|
||||
m7x.SetOption( "Spells", "Energy Vortex", false );
|
||||
m7x.SetOption( "Spells", "Air Elemental", false );
|
||||
m7x.SetOption( "Spells", "Summon Daemon", false );
|
||||
m7x.SetOption( "Spells", "Earth Elemental", false );
|
||||
m7x.SetOption( "Spells", "Fire Elemental", false );
|
||||
m7x.SetOption( "Spells", "Water Elemental", false );
|
||||
m7x.SetOption( "Spells", "Earthquake", false );
|
||||
m7x.SetOption( "Spells", "Meteor Swarm", false );
|
||||
m7x.SetOption( "Spells", "Chain Lightning", false );
|
||||
m7x.SetOption( "Spells", "Resurrection", false );
|
||||
|
||||
m7x.SetOption( "Combat Abilities", "Stun", true );
|
||||
|
||||
m7x.SetOption( "Skills", "Anatomy", true );
|
||||
m7x.SetOption( "Skills", "Detect Hidden", true );
|
||||
m7x.SetOption( "Skills", "Poisoning", true );
|
||||
m7x.SetOption( "Skills", "Evaluating Intelligence", true );
|
||||
|
||||
m7x.SetOption( "Weapons", "Wrestling", true );
|
||||
|
||||
m7x.SetOption( "Potions", "Refresh", true );
|
||||
m7x.SetOption( "Items", "Trapped Containers", true );
|
||||
m7x.SetOption( "Items", "Bandages", true );
|
||||
#endregion
|
||||
|
||||
#region Standard 7x
|
||||
Ruleset s7x = new Ruleset( m_Root );
|
||||
|
||||
s7x.Title = "Standard 7x";
|
||||
|
||||
s7x.SetOptionRange( "Spells", true );
|
||||
|
||||
s7x.SetOption( "Spells", "Wall of Stone", false );
|
||||
s7x.SetOption( "Spells", "Fire Field", false );
|
||||
s7x.SetOption( "Spells", "Poison Field", false );
|
||||
s7x.SetOption( "Spells", "Energy Field", false );
|
||||
s7x.SetOption( "Spells", "Teleport", false );
|
||||
s7x.SetOption( "Spells", "Wall of Stone", false );
|
||||
s7x.SetOption( "Spells", "Arch Protection", false );
|
||||
s7x.SetOption( "Spells", "Recall", false );
|
||||
s7x.SetOption( "Spells", "Blade Spirits", false );
|
||||
s7x.SetOption( "Spells", "Incognito", false );
|
||||
s7x.SetOption( "Spells", "Magic Reflection", false );
|
||||
s7x.SetOption( "Spells", "Paralyze", false );
|
||||
s7x.SetOption( "Spells", "Summon Creature", false );
|
||||
s7x.SetOption( "Spells", "Invisibility", false );
|
||||
s7x.SetOption( "Spells", "Mark", false );
|
||||
s7x.SetOption( "Spells", "Paralyze Field", false );
|
||||
s7x.SetOption( "Spells", "Energy Field", false );
|
||||
s7x.SetOption( "Spells", "Gate Travel", false );
|
||||
s7x.SetOption( "Spells", "Polymorph", false );
|
||||
s7x.SetOption( "Spells", "Energy Vortex", false );
|
||||
s7x.SetOption( "Spells", "Air Elemental", false );
|
||||
s7x.SetOption( "Spells", "Summon Daemon", false );
|
||||
s7x.SetOption( "Spells", "Earth Elemental", false );
|
||||
s7x.SetOption( "Spells", "Fire Elemental", false );
|
||||
s7x.SetOption( "Spells", "Water Elemental", false );
|
||||
s7x.SetOption( "Spells", "Earthquake", false );
|
||||
s7x.SetOption( "Spells", "Meteor Swarm", false );
|
||||
s7x.SetOption( "Spells", "Chain Lightning", false );
|
||||
s7x.SetOption( "Spells", "Resurrection", false );
|
||||
|
||||
s7x.SetOptionRange( "Combat Abilities", true );
|
||||
|
||||
s7x.SetOption( "Skills", "Anatomy", true );
|
||||
s7x.SetOption( "Skills", "Detect Hidden", true );
|
||||
s7x.SetOption( "Skills", "Poisoning", true );
|
||||
s7x.SetOption( "Skills", "Evaluating Intelligence", true );
|
||||
|
||||
s7x.SetOptionRange( "Weapons", true );
|
||||
s7x.SetOption( "Weapons", "Runics", false );
|
||||
s7x.SetOptionRange( "Armor", true );
|
||||
|
||||
s7x.SetOption( "Potions", "Refresh", true );
|
||||
s7x.SetOption( "Items", "Bandages", true );
|
||||
s7x.SetOption( "Items", "Trapped Containers", true );
|
||||
#endregion
|
||||
|
||||
m_Root.Defaults = new Ruleset[] { m5x, m7x, s7x };
|
||||
}
|
||||
else
|
||||
{
|
||||
#region Standard All Skills
|
||||
|
||||
Ruleset all = new Ruleset( m_Root );
|
||||
|
||||
all.Title = "Standard All Skills";
|
||||
|
||||
|
||||
all.SetOptionRange( "Spells", true );
|
||||
|
||||
all.SetOption( "Spells", "Wall of Stone", false );
|
||||
all.SetOption( "Spells", "Fire Field", false );
|
||||
all.SetOption( "Spells", "Poison Field", false );
|
||||
all.SetOption( "Spells", "Energy Field", false );
|
||||
all.SetOption( "Spells", "Teleport", false );
|
||||
all.SetOption( "Spells", "Wall of Stone", false );
|
||||
all.SetOption( "Spells", "Arch Protection", false );
|
||||
all.SetOption( "Spells", "Recall", false );
|
||||
all.SetOption( "Spells", "Blade Spirits", false );
|
||||
all.SetOption( "Spells", "Incognito", false );
|
||||
all.SetOption( "Spells", "Magic Reflection", false );
|
||||
all.SetOption( "Spells", "Paralyze", false );
|
||||
all.SetOption( "Spells", "Summon Creature", false );
|
||||
all.SetOption( "Spells", "Invisibility", false );
|
||||
all.SetOption( "Spells", "Mark", false );
|
||||
all.SetOption( "Spells", "Paralyze Field", false );
|
||||
all.SetOption( "Spells", "Energy Field", false );
|
||||
all.SetOption( "Spells", "Gate Travel", false );
|
||||
all.SetOption( "Spells", "Polymorph", false );
|
||||
all.SetOption( "Spells", "Energy Vortex", false );
|
||||
all.SetOption( "Spells", "Air Elemental", false );
|
||||
all.SetOption( "Spells", "Summon Daemon", false );
|
||||
all.SetOption( "Spells", "Earth Elemental", false );
|
||||
all.SetOption( "Spells", "Fire Elemental", false );
|
||||
all.SetOption( "Spells", "Water Elemental", false );
|
||||
all.SetOption( "Spells", "Earthquake", false );
|
||||
all.SetOption( "Spells", "Meteor Swarm", false );
|
||||
all.SetOption( "Spells", "Chain Lightning", false );
|
||||
all.SetOption( "Spells", "Resurrection", false );
|
||||
|
||||
all.SetOptionRange( "Necromancy", true );
|
||||
all.SetOption( "Necromancy", "Summon Familiar", false );
|
||||
all.SetOption( "Necromancy", "Vengeful Spirit", false );
|
||||
all.SetOption( "Necromancy", "Animate Dead", false );
|
||||
all.SetOption( "Necromancy", "Wither", false );
|
||||
all.SetOption( "Necromancy", "Poison Strike", false );
|
||||
|
||||
all.SetOptionRange( "Chivalry", true );
|
||||
all.SetOption( "Chivalry", "Sacred Journey", false );
|
||||
all.SetOption( "Chivalry", "Enemy of One", false );
|
||||
all.SetOption( "Chivalry", "Noble Sacrifice", false );
|
||||
|
||||
all.SetOptionRange( "Combat Abilities", true );
|
||||
all.SetOption( "Combat Abilities", "Paralyzing Blow", false );
|
||||
all.SetOption( "Combat Abilities", "Shadow Strike", false );
|
||||
|
||||
all.SetOption( "Skills", "Anatomy", true );
|
||||
all.SetOption( "Skills", "Detect Hidden", true );
|
||||
all.SetOption( "Skills", "Poisoning", true );
|
||||
all.SetOption( "Skills", "Spirit Speak", true );
|
||||
all.SetOption( "Skills", "Evaluating Intelligence", true );
|
||||
|
||||
all.SetOptionRange( "Weapons", true );
|
||||
all.SetOption( "Weapons", "Poisoned", false );
|
||||
|
||||
all.SetOptionRange( "Armor", true );
|
||||
|
||||
all.SetOptionRange( "Ninjitsu", true );
|
||||
all.SetOption( "Ninjitsu", "Animal Form", false );
|
||||
all.SetOption( "Ninjitsu", "Mirror Image", false );
|
||||
all.SetOption( "Ninjitsu", "Backstab", false );
|
||||
all.SetOption( "Ninjitsu", "Suprise Attack", false );
|
||||
all.SetOption( "Ninjitsu", "Shadow Jump", false );
|
||||
|
||||
all.SetOptionRange( "Bushido", true );
|
||||
|
||||
all.SetOptionRange( "Spellweaving", true );
|
||||
all.SetOption( "Spellweaving", "Gift of Life", false );
|
||||
all.SetOption( "Spellweaving", "Summon Fey", false );
|
||||
all.SetOption( "Spellweaving", "Summon Fiend", false );
|
||||
all.SetOption( "Spellweaving", "Nature's Fury", false );
|
||||
|
||||
all.SetOption( "Potions", "Refresh", true );
|
||||
all.SetOption( "Items", "Bandages", true );
|
||||
all.SetOption( "Items", "Trapped Containers", true );
|
||||
|
||||
m_Root.Defaults = new Ruleset[] { all };
|
||||
#endregion
|
||||
}
|
||||
|
||||
// Set up flavors
|
||||
|
||||
Ruleset pots = new Ruleset( m_Root );
|
||||
|
||||
pots.Title = "Potions";
|
||||
|
||||
pots.SetOptionRange( "Potions", true );
|
||||
pots.SetOption( "Potions", "Explosion", false );
|
||||
|
||||
Ruleset para = new Ruleset( m_Root );
|
||||
|
||||
para.Title = "Paralyze";
|
||||
para.SetOption( "Spells", "Paralyze", true );
|
||||
para.SetOption( "Spells", "Paralyze Field", true );
|
||||
para.SetOption( "Combat Abilities", "Paralyzing Blow", true );
|
||||
|
||||
Ruleset fields = new Ruleset( m_Root );
|
||||
|
||||
fields.Title = "Fields";
|
||||
fields.SetOption( "Spells", "Wall of Stone", true );
|
||||
fields.SetOption( "Spells", "Fire Field", true );
|
||||
fields.SetOption( "Spells", "Poison Field", true );
|
||||
fields.SetOption( "Spells", "Energy Field", true );
|
||||
fields.SetOption( "Spells", "Wildfire", true );
|
||||
|
||||
Ruleset area = new Ruleset( m_Root );
|
||||
|
||||
area.Title = "Area Effect";
|
||||
area.SetOption( "Spells", "Earthquake", true );
|
||||
area.SetOption( "Spells", "Meteor Swarm", true );
|
||||
area.SetOption( "Spells", "Chain Lightning", true );
|
||||
area.SetOption( "Necromancy", "Wither", true );
|
||||
area.SetOption( "Necromancy", "Poison Strike", true );
|
||||
|
||||
Ruleset summons = new Ruleset( m_Root );
|
||||
|
||||
summons.Title = "Summons";
|
||||
summons.SetOption( "Spells", "Blade Spirits", true );
|
||||
summons.SetOption( "Spells", "Energy Vortex", true );
|
||||
summons.SetOption( "Spells", "Air Elemental", true );
|
||||
summons.SetOption( "Spells", "Summon Daemon", true );
|
||||
summons.SetOption( "Spells", "Earth Elemental", true );
|
||||
summons.SetOption( "Spells", "Fire Elemental", true );
|
||||
summons.SetOption( "Spells", "Water Elemental", true );
|
||||
summons.SetOption( "Necromancy", "Summon Familiar", true );
|
||||
summons.SetOption( "Necromancy", "Vengeful Spirit", true );
|
||||
summons.SetOption( "Necromancy", "Animate Dead", true );
|
||||
summons.SetOption( "Ninjitsu", "Mirror Image", true );
|
||||
summons.SetOption( "Spellweaving", "Summon Fey", true );
|
||||
summons.SetOption( "Spellweaving", "Summon Fiend", true );
|
||||
summons.SetOption( "Spellweaving", "Nature's Fury", true );
|
||||
|
||||
m_Root.Flavors = new Ruleset[]{ pots, para, fields, area, summons };
|
||||
}
|
||||
|
||||
return m_Root;
|
||||
}
|
||||
}
|
||||
|
||||
private string m_Title, m_Description;
|
||||
private string[] m_Options;
|
||||
|
||||
private int m_Offset, m_TotalLength;
|
||||
|
||||
private Ruleset[] m_Defaults;
|
||||
private Ruleset[] m_Flavors;
|
||||
|
||||
private RulesetLayout m_Parent;
|
||||
private RulesetLayout[] m_Children;
|
||||
|
||||
public string Title{ get{ return m_Title; } }
|
||||
public string Description{ get{ return m_Description; } }
|
||||
public string[] Options{ get{ return m_Options; } }
|
||||
|
||||
public int Offset{ get{ return m_Offset; } }
|
||||
public int TotalLength{ get{ return m_TotalLength; } }
|
||||
|
||||
public RulesetLayout Parent{ get{ return m_Parent; } }
|
||||
public RulesetLayout[] Children{ get{ return m_Children; } }
|
||||
|
||||
public Ruleset[] Defaults{ get{ return m_Defaults; } set{ m_Defaults = value; } }
|
||||
public Ruleset[] Flavors{ get{ return m_Flavors; } set{ m_Flavors = value; } }
|
||||
|
||||
public RulesetLayout FindByTitle( string title )
|
||||
{
|
||||
if ( m_Title == title )
|
||||
return this;
|
||||
|
||||
for ( int i = 0; i < m_Children.Length; ++i )
|
||||
{
|
||||
RulesetLayout layout = m_Children[i].FindByTitle( title );
|
||||
|
||||
if ( layout != null )
|
||||
return layout;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public string FindByIndex( int index )
|
||||
{
|
||||
if ( index >= m_Offset && index < (m_Offset + m_Options.Length) )
|
||||
return m_Description + ": " + m_Options[index - m_Offset];
|
||||
|
||||
for ( int i = 0; i < m_Children.Length; ++i )
|
||||
{
|
||||
string opt = m_Children[i].FindByIndex( index );
|
||||
|
||||
if ( opt != null )
|
||||
return opt;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public RulesetLayout FindByOption( string title, string option, ref int index )
|
||||
{
|
||||
if ( title == null || m_Title == title )
|
||||
{
|
||||
index = GetOptionIndex( option );
|
||||
|
||||
if ( index >= 0 )
|
||||
return this;
|
||||
|
||||
title = null;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Children.Length; ++i )
|
||||
{
|
||||
RulesetLayout layout = m_Children[i].FindByOption( title, option, ref index );
|
||||
|
||||
if ( layout != null )
|
||||
return layout;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public int GetOptionIndex( string option )
|
||||
{
|
||||
return Array.IndexOf( m_Options, option );
|
||||
}
|
||||
|
||||
public void ComputeOffsets()
|
||||
{
|
||||
int offset = 0;
|
||||
|
||||
RecurseComputeOffsets( ref offset );
|
||||
}
|
||||
|
||||
private int RecurseComputeOffsets( ref int offset )
|
||||
{
|
||||
m_Offset = offset;
|
||||
|
||||
offset += m_Options.Length;
|
||||
m_TotalLength += m_Options.Length;
|
||||
|
||||
for ( int i = 0; i < m_Children.Length; ++i )
|
||||
m_TotalLength += m_Children[i].RecurseComputeOffsets( ref offset );
|
||||
|
||||
return m_TotalLength;
|
||||
}
|
||||
|
||||
public RulesetLayout( string title, string[] options ) : this( title, title, new RulesetLayout[0], options )
|
||||
{
|
||||
}
|
||||
|
||||
public RulesetLayout( string title, string description, string[] options ) : this( title, description, new RulesetLayout[0], options )
|
||||
{
|
||||
}
|
||||
|
||||
public RulesetLayout( string title, RulesetLayout[] children ) : this( title, title, children, new string[0] )
|
||||
{
|
||||
}
|
||||
|
||||
public RulesetLayout( string title, string description, RulesetLayout[] children ) : this( title, description, children, new string[0] )
|
||||
{
|
||||
}
|
||||
|
||||
public RulesetLayout( string title, RulesetLayout[] children, string[] options ) : this( title, title, children, options )
|
||||
{
|
||||
}
|
||||
|
||||
public RulesetLayout( string title, string description, RulesetLayout[] children, string[] options )
|
||||
{
|
||||
m_Title = title;
|
||||
m_Description = description;
|
||||
m_Children = children;
|
||||
m_Options = options;
|
||||
|
||||
for ( int i = 0; i < children.Length; ++i )
|
||||
children[i].m_Parent = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
77
Scripts/Engines/ConPVP/SafeZone.cs
Normal file
77
Scripts/Engines/ConPVP/SafeZone.cs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class SafeZone : GuardedRegion
|
||||
{
|
||||
public static readonly int SafeZonePriority = HouseRegion.HousePriority + 1;
|
||||
|
||||
/*public override bool AllowReds{ get{ return true; } }*/
|
||||
|
||||
public SafeZone( Rectangle2D area, Point3D goloc, Map map, bool isGuarded ) : base( null, map, SafeZonePriority, area )
|
||||
{
|
||||
GoLocation = goloc;
|
||||
|
||||
this.Disabled = !isGuarded;
|
||||
|
||||
Register();
|
||||
}
|
||||
|
||||
public override bool AllowHousing( Mobile from, Point3D p )
|
||||
{
|
||||
if ( from.AccessLevel < AccessLevel.GameMaster )
|
||||
return false;
|
||||
|
||||
return base.AllowHousing( from, p );
|
||||
}
|
||||
|
||||
public override bool OnMoveInto( Mobile m, Direction d, Point3D newLocation, Point3D oldLocation )
|
||||
{
|
||||
if ( m.Player && Factions.Sigil.ExistsOn( m ) )
|
||||
{
|
||||
m.SendMessage( 0x22, "You are holding a sigil and cannot enter this zone." );
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
|
||||
if ( pm == null && m is BaseCreature )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
|
||||
if ( bc.Summoned )
|
||||
pm = bc.SummonMaster as PlayerMobile;
|
||||
}
|
||||
|
||||
if ( pm != null && pm.DuelContext != null && pm.DuelContext.StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
if ( DuelContext.CheckCombat( m ) )
|
||||
{
|
||||
m.SendMessage( 0x22, "You have recently been in combat and cannot enter this zone." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OnMoveInto( m, d, newLocation, oldLocation );
|
||||
}
|
||||
|
||||
public override void OnEnter( Mobile m )
|
||||
{
|
||||
m.SendMessage( "You have entered a dueling safezone. No combat other than duels are allowed in this zone." );
|
||||
}
|
||||
|
||||
public override void OnExit( Mobile m )
|
||||
{
|
||||
m.SendMessage( "You have left a dueling safezone. Combat is now unrestricted." );
|
||||
}
|
||||
|
||||
public override bool CanUseStuckMenu( Mobile m )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
127
Scripts/Engines/ConPVP/StakesContainer.cs
Normal file
127
Scripts/Engines/ConPVP/StakesContainer.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
#if false
|
||||
[Flipable( 0x9A8, 0xE80 )]
|
||||
public class StakesContainer : LockableContainer
|
||||
{
|
||||
private Mobile m_Initiator;
|
||||
private Participant m_Participant;
|
||||
private Hashtable m_Owners;
|
||||
|
||||
public override bool CheckItemUse( Mobile from, Item item )
|
||||
{
|
||||
Mobile owner = (Mobile)m_Owners[item];
|
||||
|
||||
if ( owner != null && owner != from )
|
||||
return false;
|
||||
|
||||
return base.CheckItemUse( from, item );
|
||||
}
|
||||
|
||||
public override bool CheckTarget( Mobile from, Server.Targeting.Target targ, object targeted )
|
||||
{
|
||||
Mobile owner = (Mobile)m_Owners[targeted];
|
||||
|
||||
if ( owner != null && owner != from )
|
||||
return false;
|
||||
|
||||
return base.CheckTarget( from, targ, targeted );
|
||||
}
|
||||
|
||||
public override bool CheckLift(Mobile from, Item item)
|
||||
{
|
||||
Mobile owner = (Mobile)m_Owners[item];
|
||||
|
||||
if ( owner != null && owner != from )
|
||||
return false;
|
||||
|
||||
return base.CheckLift( from, item );
|
||||
}
|
||||
|
||||
public void ReturnItems()
|
||||
{
|
||||
ArrayList items = new ArrayList( this.Items );
|
||||
|
||||
for ( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
Item item = (Item)items[i];
|
||||
Mobile owner = (Mobile)m_Owners[item];
|
||||
|
||||
if ( owner == null || owner.Deleted )
|
||||
owner = m_Initiator;
|
||||
|
||||
if ( owner == null || owner.Deleted )
|
||||
return;
|
||||
|
||||
if ( item.LootType != LootType.Blessed || !owner.PlaceInBackpack( item ) )
|
||||
owner.BankBox.DropItem( item );
|
||||
}
|
||||
}
|
||||
|
||||
public override bool TryDropItem( Mobile from, Item dropped, bool sendFullMessage )
|
||||
{
|
||||
if ( m_Participant == null || !m_Participant.Contains( from ) )
|
||||
{
|
||||
if ( sendFullMessage )
|
||||
from.SendMessage( "You are not allowed to place items here." );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( dropped is Container || dropped.Stackable )
|
||||
{
|
||||
if ( sendFullMessage )
|
||||
from.SendMessage( "That item cannot be used as stakes." );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !base.TryDropItem( from, dropped, sendFullMessage ) )
|
||||
return false;
|
||||
|
||||
if ( from != null )
|
||||
m_Owners[dropped] = from;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void RemoveItem( Item item )
|
||||
{
|
||||
base.RemoveItem( item );
|
||||
m_Owners.Remove( item );
|
||||
}
|
||||
|
||||
public StakesContainer( DuelContext context, Participant participant ) : base( 0x9A8 )
|
||||
{
|
||||
Movable = false;
|
||||
m_Initiator = context.Initiator;
|
||||
m_Participant = participant;
|
||||
m_Owners = new Hashtable();
|
||||
}
|
||||
|
||||
public StakesContainer( 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();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
3377
Scripts/Engines/ConPVP/Tournament.cs
Normal file
3377
Scripts/Engines/ConPVP/Tournament.cs
Normal file
File diff suppressed because it is too large
Load diff
111
Scripts/Engines/ConPVP/Trophy.cs
Normal file
111
Scripts/Engines/ConPVP/Trophy.cs
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum TrophyRank
|
||||
{
|
||||
Bronze,
|
||||
Silver,
|
||||
Gold
|
||||
}
|
||||
|
||||
[Flipable( 5020, 4647 )]
|
||||
public class Trophy : Item
|
||||
{
|
||||
private string m_Title;
|
||||
private TrophyRank m_Rank;
|
||||
private Mobile m_Owner;
|
||||
private DateTime m_Date;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Title{ get{ return m_Title; } set{ m_Title = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TrophyRank Rank{ get{ return m_Rank; } set{ m_Rank = value; UpdateStyle(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Owner{ get{ return m_Owner; } set{ m_Owner = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime Date{ get{ return m_Date; } }
|
||||
|
||||
[Constructable]
|
||||
public Trophy( string title, TrophyRank rank ) : base( 5020 )
|
||||
{
|
||||
m_Title = title;
|
||||
m_Rank = rank;
|
||||
m_Date = DateTime.Now;
|
||||
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
UpdateStyle();
|
||||
}
|
||||
|
||||
public Trophy( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( (string) m_Title );
|
||||
writer.Write( (int) m_Rank );
|
||||
writer.Write( (Mobile) m_Owner );
|
||||
writer.Write( (DateTime) m_Date );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Title = reader.ReadString();
|
||||
m_Rank = (TrophyRank) reader.ReadInt();
|
||||
m_Owner = reader.ReadMobile();
|
||||
m_Date = reader.ReadDateTime();
|
||||
|
||||
if ( version == 0 )
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public override void OnAdded( object parent )
|
||||
{
|
||||
base.OnAdded( parent );
|
||||
|
||||
if ( m_Owner == null )
|
||||
m_Owner = this.RootParent as Mobile;
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
|
||||
if ( m_Owner != null )
|
||||
LabelTo( from, "{0} -- {1}", m_Title, m_Owner.RawName );
|
||||
else if ( m_Title != null )
|
||||
LabelTo( from, m_Title );
|
||||
|
||||
if ( m_Date != DateTime.MinValue )
|
||||
LabelTo( from, m_Date.ToString( "d" ) );
|
||||
}
|
||||
|
||||
public void UpdateStyle()
|
||||
{
|
||||
Name = String.Format( "{0} trophy", m_Rank.ToString().ToLower() );
|
||||
|
||||
switch ( m_Rank )
|
||||
{
|
||||
case TrophyRank.Gold: Hue = 2213; break;
|
||||
case TrophyRank.Silver: Hue = 0; break;
|
||||
case TrophyRank.Bronze: Hue = 2206; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -134,6 +134,9 @@ namespace Server.Ethics
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( e.Mobile is PlayerMobile && ( e.Mobile as PlayerMobile ).DuelContext != null )
|
||||
return;
|
||||
|
||||
Ethic ethic = pl.Ethic;
|
||||
|
||||
for ( int i = 0; i < ethic.Definition.Powers.Length; ++i )
|
||||
|
|
|
|||
|
|
@ -1103,6 +1103,11 @@ namespace Server.Factions
|
|||
if ( victimState == null )
|
||||
return;
|
||||
|
||||
#region Dueling
|
||||
if ( victim.Region.IsPartOf( typeof( Engines.ConPVP.SafeZone ) ) )
|
||||
return;
|
||||
#endregion
|
||||
|
||||
if ( killer == victim || killerState.Faction != victimState.Faction )
|
||||
ApplySkillLoss( victim );
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Factions
|
||||
|
|
@ -29,6 +30,15 @@ namespace Server.Factions
|
|||
|
||||
if ( m.AccessLevel >= AccessLevel.Counselor || Contains( oldLocation ) )
|
||||
return true;
|
||||
|
||||
if ( m is PlayerMobile ) {
|
||||
PlayerMobile pm = (PlayerMobile)m;
|
||||
|
||||
if ( pm.DuelContext != null ) {
|
||||
m.SendMessage( "You may not enter this area while participating in a duel or a tournament." );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return ( Faction.Find( m, true, true ) != null );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ namespace Server.Engines.Harvest
|
|||
{
|
||||
SOS sos = messages[i];
|
||||
|
||||
if ( ( from.Map == Map.Felucca || from.Map == Map.Trammel ) && from.InRange( sos.TargetLocation, 60 ) )
|
||||
if ( from.Map == sos.TargetMap && from.InRange( sos.TargetLocation, 60 ) )
|
||||
{
|
||||
Item preLoot = null;
|
||||
|
||||
|
|
@ -345,7 +345,7 @@ namespace Server.Engines.Harvest
|
|||
if ( sos.IsAncient )
|
||||
chest.Hue = 0x481;
|
||||
|
||||
TreasureMapChest.Fill( chest, Math.Max( 1, Math.Max( 4, sos.Level ) ) );
|
||||
TreasureMapChest.Fill( chest, Math.Max( 1, Math.Min( 4, sos.Level ) ) );
|
||||
|
||||
if ( sos.IsAncient )
|
||||
chest.DropItem( new FabledFishingNet() );
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Server.Engines.Help
|
|||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "SpeechLog", AccessLevel.GameMaster, new CommandEventHandler( SpeechLog_OnCommand ) );
|
||||
CommandSystem.Register( "SpeechLog", AccessLevel.Counselor, new CommandEventHandler( SpeechLog_OnCommand ) );
|
||||
}
|
||||
|
||||
[Usage( "SpeechLog" )]
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using Server.Mobiles;
|
|||
using Server.Network;
|
||||
using Server.Factions;
|
||||
using Server.Accounting;
|
||||
using Server.Engines.ConPVP;
|
||||
|
||||
namespace Server.Engines.Reports
|
||||
{
|
||||
|
|
@ -83,6 +84,9 @@ namespace Server.Engines.Reports
|
|||
public static void FillSnapshot( Snapshot ss )
|
||||
{
|
||||
ss.Children.Add( CompileGeneralStats() );
|
||||
ss.Children.Add( CompilePCByDL() );
|
||||
ss.Children.Add( CompileTop15() );
|
||||
ss.Children.Add( CompileDislikedArenas() );
|
||||
ss.Children.Add( CompileStatChart() );
|
||||
|
||||
PersistableObject[] obs = CompileSkillReports();
|
||||
|
|
@ -122,6 +126,129 @@ namespace Server.Engines.Reports
|
|||
return report;
|
||||
}
|
||||
|
||||
private static Chart CompilePCByDL()
|
||||
{
|
||||
BarGraph chart = new BarGraph( "Player Count By Dueling Level", "graphs_pc_by_dl", 5, "Dueling Level", "Players", BarGraphRenderMode.Bars );
|
||||
|
||||
int lastLevel = -1;
|
||||
ChartItem lastItem = null;
|
||||
|
||||
Ladder ladder = Ladder.Instance;
|
||||
|
||||
if ( ladder != null )
|
||||
{
|
||||
ArrayList entries = ladder.ToArrayList();
|
||||
|
||||
for ( int i = entries.Count - 1; i >= 0; --i )
|
||||
{
|
||||
LadderEntry entry = (LadderEntry)entries[i];
|
||||
int level = Ladder.GetLevel( entry.Experience );
|
||||
|
||||
if ( lastItem == null || level != lastLevel )
|
||||
{
|
||||
chart.Items.Add( lastItem = new ChartItem( level.ToString(), 1 ) );
|
||||
lastLevel = level;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastItem.Value++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return chart;
|
||||
}
|
||||
|
||||
private static Report CompileTop15()
|
||||
{
|
||||
Report report = new Report( "Top 15 Duelists", "80%" );
|
||||
|
||||
report.Columns.Add( "6%", "center", "Rank" );
|
||||
report.Columns.Add( "6%", "center", "Level" );
|
||||
report.Columns.Add( "6%", "center", "Guild" );
|
||||
report.Columns.Add( "70%", "left", "Name" );
|
||||
report.Columns.Add( "6%", "center", "Wins" );
|
||||
report.Columns.Add( "6%", "center", "Losses" );
|
||||
|
||||
Ladder ladder = Ladder.Instance;
|
||||
|
||||
if ( ladder != null )
|
||||
{
|
||||
ArrayList entries = ladder.ToArrayList();
|
||||
|
||||
for ( int i = 0; i < entries.Count && i < 15; ++i )
|
||||
{
|
||||
LadderEntry entry = (LadderEntry)entries[i];
|
||||
int level = Ladder.GetLevel( entry.Experience );
|
||||
string guild = "";
|
||||
|
||||
if ( entry.Mobile.Guild != null )
|
||||
guild = entry.Mobile.Guild.Abbreviation;
|
||||
|
||||
ReportItem item = new ReportItem();
|
||||
|
||||
item.Values.Add( LadderGump.Rank( entry.Index + 1 ) );
|
||||
item.Values.Add( level.ToString(), "N0" );
|
||||
item.Values.Add( guild );
|
||||
item.Values.Add( entry.Mobile.Name );
|
||||
item.Values.Add( entry.Wins.ToString(), "N0" );
|
||||
item.Values.Add( entry.Losses.ToString(), "N0" );
|
||||
|
||||
report.Items.Add( item );
|
||||
}
|
||||
}
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
private static Chart CompileDislikedArenas()
|
||||
{
|
||||
PieChart chart = new PieChart( "Most Disliked Arenas", "graphs_arenas_disliked", false );
|
||||
|
||||
Preferences prefs = Preferences.Instance;
|
||||
|
||||
if ( prefs != null )
|
||||
{
|
||||
List<Arena> arenas = Arena.Arenas;
|
||||
|
||||
for ( int i = 0; i < arenas.Count; ++i )
|
||||
{
|
||||
Arena arena = arenas[i];
|
||||
|
||||
string name = arena.Name;
|
||||
|
||||
if ( name != null )
|
||||
chart.Items.Add( name, 0 );
|
||||
}
|
||||
|
||||
ArrayList entries = prefs.Entries;
|
||||
|
||||
for ( int i = 0; i < entries.Count; ++i )
|
||||
{
|
||||
PreferencesEntry entry = (PreferencesEntry)entries[i];
|
||||
ArrayList list = entry.Disliked;
|
||||
|
||||
for ( int j = 0; j < list.Count; ++j )
|
||||
{
|
||||
string disliked = (string)list[j];
|
||||
|
||||
for ( int k = 0; k < chart.Items.Count; ++k )
|
||||
{
|
||||
ChartItem item = chart.Items[k];
|
||||
|
||||
if ( item.Name == disliked )
|
||||
{
|
||||
++item.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return chart;
|
||||
}
|
||||
|
||||
public static Chart CompileStatChart()
|
||||
{
|
||||
PieChart chart = new PieChart( "Stat Distribution", "graphs_strdexint_distrib", true );
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ namespace Server.Gumps
|
|||
660, 666, 672, 898, 970,
|
||||
974, 982
|
||||
};
|
||||
|
||||
|
||||
private static List<int> _HouseSigns = new List<int>();
|
||||
|
||||
public HouseGumpAOS( HouseGumpPageAOS page, Mobile from, BaseHouse house ) : base( 50, 40 )
|
||||
|
|
@ -497,7 +497,7 @@ namespace Server.Gumps
|
|||
{
|
||||
_HouseSigns.Add( 2980 + ( i * 2 ) );
|
||||
}
|
||||
|
||||
|
||||
// Add library and beekeeper signs ( ML )
|
||||
_HouseSigns.Add( 2966 );
|
||||
_HouseSigns.Add( 3140 );
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ namespace Server.Items
|
|||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int)0 ); // version
|
||||
writer.Write( (int) 1 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace Server.Items
|
|||
|
||||
int ICommodity.DescriptionNumber { get { return CraftResources.IsStandard( m_Resource ) ? LabelNumber : 1075062 + ( (int)m_Resource - (int)CraftResource.RegularWood ); } }
|
||||
bool ICommodity.IsDeedable { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public Log() : this( 1 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -222,7 +222,6 @@ namespace Server.Items
|
|||
BasePotion pot = (BasePotion)item;
|
||||
int toHold = Math.Min( 100 - m_Held, pot.Amount );
|
||||
|
||||
|
||||
if ( toHold <= 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 502233 ); // The keg will not hold any more!
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ namespace Server.Items
|
|||
{
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.Consume();
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
this.Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,10 @@ namespace Server.Items
|
|||
|
||||
m.PlaySound( 0x2D6 );
|
||||
|
||||
m.AddToBackpack( new Bottle() );
|
||||
#region Dueling
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( m ) )
|
||||
m.AddToBackpack( new Bottle() );
|
||||
#endregion
|
||||
|
||||
if ( m.Body.IsHuman && !m.Mounted )
|
||||
m.Animate( 34, 5, 1, true, false, 0 );
|
||||
|
|
|
|||
|
|
@ -97,7 +97,8 @@ namespace Server.Items
|
|||
from.FixedParticles( 0x373A, 10, 15, 5012, EffectLayer.Waist );
|
||||
from.PlaySound( 0x1E0 );
|
||||
|
||||
this.Consume();
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
this.Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ namespace Server.Items
|
|||
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.Consume();
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
this.Consume();
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( Delay ), new TimerStateCallback( ReleaseHealLock ), from );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ namespace Server.Items
|
|||
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.Consume();
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
this.Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ namespace Server.Items
|
|||
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.Consume();
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
this.Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +37,8 @@ namespace Server.Items
|
|||
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.Consume();
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
this.Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ namespace Server.Items
|
|||
{
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.Consume();
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
this.Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@ namespace Server.Items
|
|||
{
|
||||
if ( BandageContext.BeginHeal( from, (Mobile)targeted ) != null )
|
||||
{
|
||||
m_Bandage.Consume();
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
m_Bandage.Consume();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -509,7 +510,6 @@ namespace Server.Items
|
|||
if ( !onSelf )
|
||||
patient.SendLocalizedMessage( 1008078, false, healer.Name ); // : Attempting to heal you.
|
||||
|
||||
|
||||
healer.SendLocalizedMessage( 500956 ); // You begin applying the bandages.
|
||||
return context;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ namespace Server.Items
|
|||
{
|
||||
MessageHelper.SendLocalizedMessageTo( this, from, 1054127, 0x22 ); // The Crystal Ball fills with a red mist. You appear to have let your bond to your pet deteriorate.
|
||||
}
|
||||
else if ( from.Map == Map.Ilshenar || from.Region.IsPartOf( typeof( DungeonRegion ) ) || from.Region.IsPartOf( typeof( Jail ) ) )
|
||||
else if ( from.Map == Map.Ilshenar || from.Region.IsPartOf( typeof( DungeonRegion ) ) || from.Region.IsPartOf( typeof( Jail ) ) || from.Region.IsPartOf( typeof( Server.Engines.ConPVP.SafeZone ) ) )
|
||||
{
|
||||
from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, 0x22, 3, "", "You cannot summon your pet to this location." ) );
|
||||
}
|
||||
|
|
@ -464,4 +464,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -471,4 +471,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -189,6 +189,61 @@ namespace Server.Items
|
|||
return false;
|
||||
}
|
||||
|
||||
#region Dueling
|
||||
string option = null;
|
||||
|
||||
if ( this is ArmorIgnore )
|
||||
option = "Armor Ignore";
|
||||
else if ( this is BleedAttack )
|
||||
option = "Bleed Attack";
|
||||
else if ( this is ConcussionBlow )
|
||||
option = "Concussion Blow";
|
||||
else if ( this is CrushingBlow )
|
||||
option = "Crushing Blow";
|
||||
else if ( this is Disarm )
|
||||
option = "Disarm";
|
||||
else if ( this is Dismount )
|
||||
option = "Dismount";
|
||||
else if ( this is DoubleStrike )
|
||||
option = "Double Strike";
|
||||
else if ( this is InfectiousStrike )
|
||||
option = "Infectious Strike";
|
||||
else if ( this is MortalStrike )
|
||||
option = "Mortal Strike";
|
||||
else if ( this is MovingShot )
|
||||
option = "Moving Shot";
|
||||
else if ( this is ParalyzingBlow )
|
||||
option = "Paralyzing Blow";
|
||||
else if ( this is ShadowStrike )
|
||||
option = "Shadow Strike";
|
||||
else if ( this is WhirlwindAttack )
|
||||
option = "Whirlwind Attack";
|
||||
else if ( this is RidingSwipe )
|
||||
option = "Riding Swipe";
|
||||
else if ( this is FrenziedWhirlwind )
|
||||
option = "Frenzied Whirlwind";
|
||||
else if ( this is Block )
|
||||
option = "Block";
|
||||
else if ( this is DefenseMastery )
|
||||
option = "Defense Mastery";
|
||||
else if ( this is NerveStrike )
|
||||
option = "Nerve Strike";
|
||||
else if ( this is TalonStrike )
|
||||
option = "Talon Strike";
|
||||
else if ( this is Feint )
|
||||
option = "Feint";
|
||||
else if ( this is DualWield )
|
||||
option = "Dual Wield";
|
||||
else if ( this is DoubleShot )
|
||||
option = "Double Shot";
|
||||
else if ( this is ArmorPierce )
|
||||
option = "Armor Pierce";
|
||||
|
||||
|
||||
if ( option != null && !Engines.ConPVP.DuelContext.AllowSpecialAbility( from, option, true ) )
|
||||
return false;
|
||||
#endregion
|
||||
|
||||
return CheckSkills( from ) && CheckMana( from, false );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ namespace Server.Items
|
|||
{
|
||||
base.OnHit( attacker, defender, damageBonus );
|
||||
|
||||
if ( !Core.AOS && (attacker.Player || attacker.Body.IsHuman) && Layer == Layer.TwoHanded && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble() )
|
||||
if ( !Core.AOS && (attacker.Player || attacker.Body.IsHuman) && Layer == Layer.TwoHanded && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble() && Engines.ConPVP.DuelContext.AllowSpecialAbility( attacker, "Concussion Blow", false ) )
|
||||
{
|
||||
StatMod mod = defender.GetStatMod( "Concussion" );
|
||||
|
||||
|
|
|
|||
|
|
@ -1019,8 +1019,18 @@ namespace Server.Items
|
|||
PlayerMobile p = attacker as PlayerMobile;
|
||||
|
||||
canSwing = ( p == null || p.PeacedUntil <= DateTime.Now );
|
||||
}
|
||||
}
|
||||
|
||||
#region Dueling
|
||||
if ( attacker is PlayerMobile )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)attacker;
|
||||
|
||||
if ( pm.DuelContext != null && !pm.DuelContext.CheckItemEquip( attacker, this ) )
|
||||
canSwing = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
if ( canSwing && attacker.HarmfulCheck( defender ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -217,6 +217,11 @@ namespace Server.Items
|
|||
{
|
||||
Mobile m = e.Mobile;
|
||||
|
||||
#region Dueling
|
||||
if ( !Engines.ConPVP.DuelContext.AllowSpecialAbility( m, "Disarm", true ) )
|
||||
return;
|
||||
#endregion
|
||||
|
||||
double armsValue = m.Skills[SkillName.ArmsLore].Value;
|
||||
double wresValue = m.Skills[SkillName.Wrestling].Value;
|
||||
|
||||
|
|
@ -242,6 +247,11 @@ namespace Server.Items
|
|||
{
|
||||
Mobile m = e.Mobile;
|
||||
|
||||
#region Dueling
|
||||
if ( !Engines.ConPVP.DuelContext.AllowSpecialAbility( m, "Stun", true ) )
|
||||
return;
|
||||
#endregion
|
||||
|
||||
double anatValue = m.Skills[SkillName.Anatomy].Value;
|
||||
double wresValue = m.Skills[SkillName.Wrestling].Value;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace Server.Items
|
|||
{
|
||||
double damage = base.GetBaseDamage( attacker );
|
||||
|
||||
if ( !Core.AOS && (attacker.Player || attacker.Body.IsHuman) && Layer == Layer.TwoHanded && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble() )
|
||||
if ( !Core.AOS && (attacker.Player || attacker.Body.IsHuman) && Layer == Layer.TwoHanded && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble() && Engines.ConPVP.DuelContext.AllowSpecialAbility( attacker, "Crushing Blow", false ) )
|
||||
{
|
||||
damage *= 1.5;
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace Server.Items
|
|||
{
|
||||
base.OnHit( attacker, defender, damageBonus );
|
||||
|
||||
if ( !Core.AOS && (attacker.Player || attacker.Body.IsHuman) && Layer == Layer.TwoHanded && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble() )
|
||||
if ( !Core.AOS && (attacker.Player || attacker.Body.IsHuman) && Layer == Layer.TwoHanded && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble() && Engines.ConPVP.DuelContext.AllowSpecialAbility( attacker, "Concussion Blow", false ) )
|
||||
{
|
||||
StatMod mod = defender.GetStatMod( "Concussion" );
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,16 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
#region Dueling
|
||||
if ( attacker is PlayerMobile )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)attacker;
|
||||
|
||||
if ( pm.DuelContext != null && !pm.DuelContext.CheckItemEquip( attacker, this ) )
|
||||
canSwing = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
if ( canSwing && attacker.HarmfulCheck( defender ) )
|
||||
{
|
||||
attacker.DisruptiveAction();
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Server.Items
|
|||
{
|
||||
base.OnHit( attacker, defender, damageBonus );
|
||||
|
||||
if ( !Core.AOS && Layer == Layer.TwoHanded && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble() )
|
||||
if ( !Core.AOS && Layer == Layer.TwoHanded && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble() && Engines.ConPVP.DuelContext.AllowSpecialAbility( attacker, "Paralyzing Blow", false ) )
|
||||
{
|
||||
defender.SendMessage( "You receive a paralyzing blow!" ); // Is this not localized?
|
||||
defender.Freeze( TimeSpan.FromSeconds( 2.0 ) );
|
||||
|
|
|
|||
|
|
@ -112,7 +112,11 @@ namespace Server.Items
|
|||
Mobile targ = (Mobile) target;
|
||||
Container pack = targ.Backpack;
|
||||
|
||||
if ( pack != null && pack.FindItemByType( new Type[]{ typeof( SnowPile ), typeof( PileOfGlacialSnow ) } ) != null )
|
||||
if ( from.Region.IsPartOf( typeof( Engines.ConPVP.SafeZone ) ) || targ.Region.IsPartOf( typeof( Engines.ConPVP.SafeZone ) ) )
|
||||
{
|
||||
from.SendMessage( "You may not throw snow here." );
|
||||
}
|
||||
else if ( pack != null && pack.FindItemByType( new Type[]{ typeof( SnowPile ), typeof( PileOfGlacialSnow ) } ) != null )
|
||||
{
|
||||
if ( from.BeginAction( typeof( SnowPile ) ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,7 +98,11 @@ namespace Server.Items
|
|||
Mobile targ = (Mobile) target;
|
||||
Container pack = targ.Backpack;
|
||||
|
||||
if ( pack != null && pack.FindItemByType( new Type[]{ typeof( SnowPile ), typeof( PileOfGlacialSnow ) } ) != null )
|
||||
if ( from.Region.IsPartOf( typeof( Engines.ConPVP.SafeZone ) ) || targ.Region.IsPartOf( typeof( Engines.ConPVP.SafeZone ) ) )
|
||||
{
|
||||
from.SendMessage( "You may not throw snow here." );
|
||||
}
|
||||
else if ( pack != null && pack.FindItemByType( new Type[]{ typeof( SnowPile ), typeof( PileOfGlacialSnow ) } ) != null )
|
||||
{
|
||||
if ( from.BeginAction( typeof( SnowPile ) ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1779,8 +1779,6 @@ namespace Server.Guilds
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime LastFealty
|
||||
{
|
||||
|
|
@ -1803,7 +1801,6 @@ namespace Server.Guilds
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public List<Guild> Allies
|
||||
{
|
||||
get
|
||||
|
|
@ -1877,6 +1874,5 @@ namespace Server.Guilds
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,58 @@ namespace Server.Misc
|
|||
if( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player )
|
||||
return true;
|
||||
|
||||
#region Dueling
|
||||
PlayerMobile pmFrom = from as PlayerMobile;
|
||||
PlayerMobile pmTarg = target as PlayerMobile;
|
||||
|
||||
if( pmFrom == null && from is BaseCreature )
|
||||
{
|
||||
BaseCreature bcFrom = (BaseCreature)from;
|
||||
|
||||
if( bcFrom.Summoned )
|
||||
pmFrom = bcFrom.SummonMaster as PlayerMobile;
|
||||
}
|
||||
|
||||
if( pmTarg == null && target is BaseCreature )
|
||||
{
|
||||
BaseCreature bcTarg = (BaseCreature)target;
|
||||
|
||||
if( bcTarg.Summoned )
|
||||
pmTarg = bcTarg.SummonMaster as PlayerMobile;
|
||||
}
|
||||
|
||||
if( pmFrom!= null && pmTarg != null )
|
||||
{
|
||||
if( pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) )
|
||||
return false;
|
||||
|
||||
if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated) )
|
||||
return false;
|
||||
|
||||
if( pmFrom.DuelPlayer != null && !pmFrom.DuelPlayer.Eliminated && pmFrom.DuelContext != null && pmFrom.DuelContext.IsSuddenDeath )
|
||||
return false;
|
||||
|
||||
if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant != pmTarg.DuelPlayer.Participant )
|
||||
return false;
|
||||
|
||||
if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started )
|
||||
return true;
|
||||
}
|
||||
|
||||
if( (pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started) )
|
||||
return false;
|
||||
|
||||
Engines.ConPVP.SafeZone sz = from.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone;
|
||||
|
||||
if( sz != null /*&& sz.IsDisabled()*/ )
|
||||
return false;
|
||||
|
||||
sz = target.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone;
|
||||
|
||||
if( sz != null /*&& sz.IsDisabled()*/ )
|
||||
return false;
|
||||
#endregion
|
||||
|
||||
Map map = from.Map;
|
||||
|
||||
#region Factions
|
||||
|
|
@ -104,6 +156,55 @@ namespace Server.Misc
|
|||
if( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player )
|
||||
return true;
|
||||
|
||||
#region Dueling
|
||||
PlayerMobile pmFrom = from as PlayerMobile;
|
||||
PlayerMobile pmTarg = target as PlayerMobile;
|
||||
|
||||
if( pmFrom == null && from is BaseCreature )
|
||||
{
|
||||
BaseCreature bcFrom = (BaseCreature)from;
|
||||
|
||||
if( bcFrom.Summoned )
|
||||
pmFrom = bcFrom.SummonMaster as PlayerMobile;
|
||||
}
|
||||
|
||||
if( pmTarg == null && target is BaseCreature )
|
||||
{
|
||||
BaseCreature bcTarg = (BaseCreature)target;
|
||||
|
||||
if( bcTarg.Summoned )
|
||||
pmTarg = bcTarg.SummonMaster as PlayerMobile;
|
||||
}
|
||||
|
||||
if( pmFrom!= null && pmTarg != null )
|
||||
{
|
||||
if( pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) )
|
||||
return false;
|
||||
|
||||
if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated) )
|
||||
return false;
|
||||
|
||||
if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant )
|
||||
return false;
|
||||
|
||||
if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started )
|
||||
return true;
|
||||
}
|
||||
|
||||
if( (pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started) )
|
||||
return false;
|
||||
|
||||
Engines.ConPVP.SafeZone sz = from.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone;
|
||||
|
||||
if( sz != null /*&& sz.IsDisabled()*/ )
|
||||
return false;
|
||||
|
||||
sz = target.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone;
|
||||
|
||||
if( sz != null /*&& sz.IsDisabled()*/ )
|
||||
return false;
|
||||
#endregion
|
||||
|
||||
Map map = from.Map;
|
||||
|
||||
if( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 )
|
||||
|
|
@ -269,6 +370,17 @@ namespace Server.Misc
|
|||
if( Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier) )
|
||||
return Notoriety.Invulnerable;
|
||||
|
||||
#region Dueling
|
||||
if( source is PlayerMobile && target is PlayerMobile )
|
||||
{
|
||||
PlayerMobile pmFrom = (PlayerMobile)source;
|
||||
PlayerMobile pmTarg = (PlayerMobile)target;
|
||||
|
||||
if( pmFrom.DuelContext != null && pmFrom.DuelContext.StartedBeginCountdown && !pmFrom.DuelContext.Finished && pmFrom.DuelContext == pmTarg.DuelContext )
|
||||
return pmFrom.DuelContext.IsAlly( pmFrom, pmTarg ) ? Notoriety.Ally : Notoriety.Enemy;
|
||||
}
|
||||
#endregion
|
||||
|
||||
if( target.AccessLevel > AccessLevel.Player )
|
||||
return Notoriety.CanBeAttacked;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ namespace Server.Mobiles
|
|||
CantWalk = true;
|
||||
|
||||
if ( Utility.RandomBool() )
|
||||
PackItem( new SulfurousAsh( 4 ) );
|
||||
PackItem( new SulfurousAsh( 4 ) );
|
||||
else
|
||||
PackItem( new BlackPearl( 4 ) );
|
||||
PackItem( new BlackPearl( 4 ) );
|
||||
|
||||
//PackItem( new SpecialFishingNet() );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ namespace Server.Mobiles
|
|||
Rope rope = new Rope();
|
||||
rope.ItemID = 0x14F8;
|
||||
PackItem( rope );
|
||||
|
||||
|
||||
if( Utility.RandomDouble() < .05 )
|
||||
PackItem( new MessageInABottle() );
|
||||
|
||||
|
||||
PackItem( new SpecialFishingNet() ); //Confirm?
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using Server.Items;
|
|||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Engines.Help;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.ContextMenus;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
|
|
@ -1415,6 +1416,11 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool AllowItemUse( Item item )
|
||||
{
|
||||
#region Dueling
|
||||
if ( m_DuelContext != null && !m_DuelContext.AllowItemUse( this, item ) )
|
||||
return false;
|
||||
#endregion
|
||||
|
||||
return DesignContext.Check( this );
|
||||
}
|
||||
|
||||
|
|
@ -1442,6 +1448,11 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
#region Dueling
|
||||
if ( m_DuelContext != null && !m_DuelContext.AllowSkillUse( this, skill ) )
|
||||
return false;
|
||||
#endregion
|
||||
|
||||
return DesignContext.Check( this );
|
||||
}
|
||||
|
||||
|
|
@ -1516,7 +1527,7 @@ namespace Server.Mobiles
|
|||
if ( Alive && house.InternalizedVendors.Count > 0 && house.IsOwner( this ) )
|
||||
list.Add( new CallbackEntry( 6204, new ContextCallback( GetVendor ) ) );
|
||||
|
||||
if ( house.IsAosRules )
|
||||
if ( house.IsAosRules && !Region.IsPartOf( typeof( Engines.ConPVP.SafeZone ) ) ) // Dueling
|
||||
list.Add( new CallbackEntry( 6207, new ContextCallback( LeaveHouse ) ) );
|
||||
}
|
||||
|
||||
|
|
@ -1801,6 +1812,11 @@ namespace Server.Mobiles
|
|||
if ( !base.CheckEquip( item ) )
|
||||
return false;
|
||||
|
||||
#region Dueling
|
||||
if ( m_DuelContext != null && !m_DuelContext.AllowItemEquip( this, item ) )
|
||||
return false;
|
||||
#endregion
|
||||
|
||||
#region Factions
|
||||
FactionItem factionItem = FactionItem.Find( item );
|
||||
|
||||
|
|
@ -1960,6 +1976,11 @@ namespace Server.Mobiles
|
|||
{
|
||||
CheckLightLevels( false );
|
||||
|
||||
#region Dueling
|
||||
if ( m_DuelContext != null )
|
||||
m_DuelContext.OnLocationChanged( this );
|
||||
#endregion
|
||||
|
||||
DesignContext context = m_DesignContext;
|
||||
|
||||
if ( context == null || m_NoRecursion )
|
||||
|
|
@ -1997,6 +2018,16 @@ namespace Server.Mobiles
|
|||
if ( m is BaseCreature && !((BaseCreature)m).Controlled )
|
||||
return ( !Alive || !m.Alive || IsDeadBondedPet || m.IsDeadBondedPet ) || ( Hidden && AccessLevel > AccessLevel.Player );
|
||||
|
||||
#region Dueling
|
||||
if ( Region.IsPartOf( typeof( Engines.ConPVP.SafeZone ) ) && m is PlayerMobile )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile) m;
|
||||
|
||||
if ( pm.DuelContext == null || pm.DuelPlayer == null || !pm.DuelContext.Started || pm.DuelContext.Finished || pm.DuelPlayer.Eliminated )
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
return base.OnMoveOver( m );
|
||||
}
|
||||
|
||||
|
|
@ -2013,6 +2044,11 @@ namespace Server.Mobiles
|
|||
if ( (Map != Faction.Facet && oldMap == Faction.Facet) || (Map == Faction.Facet && oldMap != Faction.Facet) )
|
||||
InvalidateProperties();
|
||||
|
||||
#region Dueling
|
||||
if ( m_DuelContext != null )
|
||||
m_DuelContext.OnMapChanged( this );
|
||||
#endregion
|
||||
|
||||
DesignContext context = m_DesignContext;
|
||||
|
||||
if ( context == null || m_NoRecursion )
|
||||
|
|
@ -2179,6 +2215,11 @@ namespace Server.Mobiles
|
|||
{
|
||||
if ( InsuranceEnabled && item.Insured )
|
||||
{
|
||||
#region Dueling
|
||||
if ( m_DuelPlayer != null && m_DuelContext != null && m_DuelContext.Registered && m_DuelContext.Started && !m_DuelPlayer.Eliminated )
|
||||
return true;
|
||||
#endregion
|
||||
|
||||
if ( AutoRenewInsurance )
|
||||
{
|
||||
int cost = ( m_InsuranceAward == null ? 600 : 300 );
|
||||
|
|
@ -2334,16 +2375,22 @@ namespace Server.Mobiles
|
|||
killer = master;
|
||||
}
|
||||
|
||||
if ( this.Young )
|
||||
if ( this.Young && m_DuelContext == null )
|
||||
{
|
||||
if ( YoungDeathTeleport() )
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( SendYoungDeathNotice ) );
|
||||
}
|
||||
|
||||
Faction.HandleDeath( this, killer );
|
||||
if ( m_DuelContext == null || !m_DuelContext.Registered || !m_DuelContext.Started || m_DuelPlayer == null || m_DuelPlayer.Eliminated )
|
||||
Faction.HandleDeath( this, killer );
|
||||
|
||||
Server.Guilds.Guild.HandleDeath( this, killer );
|
||||
|
||||
#region Dueling
|
||||
if ( m_DuelContext != null )
|
||||
m_DuelContext.OnDeath( this, c );
|
||||
#endregion
|
||||
|
||||
if( m_BuffTable != null )
|
||||
{
|
||||
List<BuffInfo> list = new List<BuffInfo>();
|
||||
|
|
@ -2627,7 +2674,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool CheckPoisonImmunity( Mobile from, Poison poison )
|
||||
{
|
||||
if ( this.Young )
|
||||
if ( this.Young && (DuelContext == null || !DuelContext.Started || DuelContext.Finished) )
|
||||
return true;
|
||||
|
||||
return base.CheckPoisonImmunity( from, poison );
|
||||
|
|
@ -2635,7 +2682,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnPoisonImmunity( Mobile from, Poison poison )
|
||||
{
|
||||
if ( this.Young )
|
||||
if ( this.Young && (DuelContext == null || !DuelContext.Started || DuelContext.Finished) )
|
||||
SendLocalizedMessage( 502808 ); // You would have been poisoned, were you not new to the land of Britannia. Be careful in the future.
|
||||
else
|
||||
base.OnPoisonImmunity( from, poison );
|
||||
|
|
@ -2976,7 +3023,7 @@ namespace Server.Mobiles
|
|||
m_BOBFilter = new Engines.BulkOrders.BOBFilter();
|
||||
|
||||
if( m_GuildRank == null )
|
||||
m_GuildRank = Guilds.RankDefinition.Member; //Default to member if going from older verstion to new version (only time it should be null)
|
||||
m_GuildRank = Guilds.RankDefinition.Member; //Default to member if going from older version to new version (only time it should be null)
|
||||
|
||||
if( m_LastOnline == DateTime.MinValue && Account != null )
|
||||
m_LastOnline = ((Account)Account).LastLogin;
|
||||
|
|
@ -3190,6 +3237,24 @@ namespace Server.Mobiles
|
|||
if ( m is PlayerMobile && ((PlayerMobile)m).m_VisList.Contains( this ) )
|
||||
return true;
|
||||
|
||||
if ( m_DuelContext != null && m_DuelPlayer != null && !m_DuelContext.Finished && m_DuelContext.m_Tournament != null && !m_DuelPlayer.Eliminated )
|
||||
{
|
||||
Mobile owner = m;
|
||||
|
||||
if ( owner is BaseCreature )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)owner;
|
||||
|
||||
Mobile master = bc.GetMaster();
|
||||
|
||||
if( master != null )
|
||||
owner = master;
|
||||
}
|
||||
|
||||
if ( m.AccessLevel == AccessLevel.Player && owner is PlayerMobile && ((PlayerMobile)owner).DuelContext != m_DuelContext )
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CanSee( m );
|
||||
}
|
||||
|
||||
|
|
@ -3375,6 +3440,37 @@ namespace Server.Mobiles
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region Dueling
|
||||
private Engines.ConPVP.DuelContext m_DuelContext;
|
||||
private Engines.ConPVP.DuelPlayer m_DuelPlayer;
|
||||
|
||||
public Engines.ConPVP.DuelContext DuelContext
|
||||
{
|
||||
get{ return m_DuelContext; }
|
||||
}
|
||||
|
||||
public Engines.ConPVP.DuelPlayer DuelPlayer
|
||||
{
|
||||
get{ return m_DuelPlayer; }
|
||||
set
|
||||
{
|
||||
bool wasInTourny = ( m_DuelContext != null && !m_DuelContext.Finished && m_DuelContext.m_Tournament != null );
|
||||
|
||||
m_DuelPlayer = value;
|
||||
|
||||
if ( m_DuelPlayer == null )
|
||||
m_DuelContext = null;
|
||||
else
|
||||
m_DuelContext = m_DuelPlayer.Participant.Context;
|
||||
|
||||
bool isInTourny = ( m_DuelContext != null && !m_DuelContext.Finished && m_DuelContext.m_Tournament != null );
|
||||
|
||||
if ( wasInTourny != isInTourny )
|
||||
SendEverything();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Quests
|
||||
private QuestSystem m_Quest;
|
||||
private List<QuestRestartInfo> m_DoneQuests;
|
||||
|
|
@ -3509,6 +3605,20 @@ namespace Server.Mobiles
|
|||
if ( checkTurning && (dir & Direction.Mask) != (this.Direction & Direction.Mask) )
|
||||
return Mobile.RunMount; // We are NOT actually moving (just a direction change)
|
||||
|
||||
#region Dueling / CTF
|
||||
|
||||
if ( m_DuelContext != null && m_DuelContext.m_EventGame is CTFGame )
|
||||
{
|
||||
CTFGame game = (CTFGame)m_DuelContext.m_EventGame;
|
||||
CTFTeamInfo team = game.GetTeamInfo( this );
|
||||
|
||||
//We don't want to just search through all the contents of our pack everytime we take a step.
|
||||
if ( game.Controller != null && game.Controller.SlowFlagBearer && team != null && team.Flag != null && team.Flag.RootParent == this )
|
||||
return Mobile.WalkFoot;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
TransformContext context = TransformationSpellHelper.GetContext( this );
|
||||
|
||||
if ( context != null && context.Type == typeof( ReaperFormSpell ) )
|
||||
|
|
|
|||
|
|
@ -54,6 +54,14 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
from.SendLocalizedMessage( 1049528 ); // You cannot calm that!
|
||||
}
|
||||
else if ( from.Region.IsPartOf( typeof( Engines.ConPVP.SafeZone ) ) )
|
||||
{
|
||||
from.SendMessage( "You may not peacemake here." );
|
||||
}
|
||||
else if ( ((Mobile)targeted).Region.IsPartOf( typeof( Engines.ConPVP.SafeZone ) ) )
|
||||
{
|
||||
from.SendMessage( "You may not peacemake there." );
|
||||
}
|
||||
else if ( !m_Instrument.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack!
|
||||
|
|
|
|||
|
|
@ -81,8 +81,11 @@ namespace Server.SkillHandlers
|
|||
|
||||
from.PlaySound( 0x4F );
|
||||
|
||||
m_Potion.Consume();
|
||||
from.AddToBackpack( new Bottle() );
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
{
|
||||
m_Potion.Consume();
|
||||
from.AddToBackpack( new Bottle() );
|
||||
}
|
||||
}
|
||||
else // Target can't be poisoned
|
||||
{
|
||||
|
|
|
|||
|
|
@ -157,6 +157,30 @@ namespace Server.Spells
|
|||
return false;
|
||||
}
|
||||
|
||||
#region Dueling
|
||||
string option = null;
|
||||
|
||||
if ( this is Backstab )
|
||||
option = "Backstab";
|
||||
else if ( this is DeathStrike )
|
||||
option = "Death Strike";
|
||||
else if ( this is FocusAttack )
|
||||
option = "Focus Attack";
|
||||
else if ( this is KiAttack )
|
||||
option = "Ki Attack";
|
||||
else if ( this is SurpriseAttack )
|
||||
option = "Surprise Attack";
|
||||
else if ( this is HonorableExecution )
|
||||
option = "Honorable Execution";
|
||||
else if ( this is LightningStrike )
|
||||
option = "Lightning Strike";
|
||||
else if ( this is MomentumStrike )
|
||||
option = "Momentum Strike";
|
||||
|
||||
if ( option != null && !Engines.ConPVP.DuelContext.AllowSpecialMove( from, option, this ) )
|
||||
return false;
|
||||
#endregion
|
||||
|
||||
return CheckSkills( from ) && CheckMana( from, false );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -237,6 +237,9 @@ namespace Server.Spells
|
|||
if ( AosAttributes.GetValue( m_Caster, AosAttribute.LowerRegCost ) > Utility.Random( 100 ) )
|
||||
return true;
|
||||
|
||||
if ( Engines.ConPVP.DuelContext.IsFreeConsume( m_Caster ) )
|
||||
return true;
|
||||
|
||||
Container pack = m_Caster.Backpack;
|
||||
|
||||
if ( pack == null )
|
||||
|
|
@ -508,6 +511,11 @@ namespace Server.Spells
|
|||
{
|
||||
m_Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed.
|
||||
}
|
||||
#region Dueling
|
||||
else if ( m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, this ) )
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
else if ( m_Caster.Mana >= ScaleMana( GetMana() ) )
|
||||
{
|
||||
if ( m_Caster.Spell == null && m_Caster.CheckSpellCast( this ) && CheckCast() && m_Caster.Region.OnBeginSpellCast( m_Caster, this ) )
|
||||
|
|
|
|||
|
|
@ -363,6 +363,33 @@ namespace Server.Spells
|
|||
if( to.Hidden && to.AccessLevel > from.AccessLevel )
|
||||
return false;
|
||||
|
||||
#region Dueling
|
||||
PlayerMobile pmFrom = from as PlayerMobile;
|
||||
PlayerMobile pmTarg = to as PlayerMobile;
|
||||
|
||||
if ( pmFrom == null && from is BaseCreature )
|
||||
{
|
||||
BaseCreature bcFrom = (BaseCreature) from;
|
||||
|
||||
if ( bcFrom.Summoned )
|
||||
pmFrom = bcFrom.SummonMaster as PlayerMobile;
|
||||
}
|
||||
|
||||
if ( pmTarg == null && to is BaseCreature )
|
||||
{
|
||||
BaseCreature bcTarg = (BaseCreature) to;
|
||||
|
||||
if ( bcTarg.Summoned )
|
||||
pmTarg = bcTarg.SummonMaster as PlayerMobile;
|
||||
}
|
||||
|
||||
if ( pmFrom != null && pmTarg != null )
|
||||
{
|
||||
if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null )
|
||||
return ( pmFrom.DuelPlayer.Participant != pmTarg.DuelPlayer.Participant );
|
||||
}
|
||||
#endregion
|
||||
|
||||
Guild fromGuild = GetGuildFor( from );
|
||||
Guild toGuild = GetGuildFor( to );
|
||||
|
||||
|
|
@ -550,6 +577,7 @@ namespace Server.Spells
|
|||
new TravelValidator( IsCrystalCave ),
|
||||
new TravelValidator( IsDoomGauntlet ),
|
||||
new TravelValidator( IsDoomFerry ),
|
||||
new TravelValidator( IsSafeZone ),
|
||||
new TravelValidator( IsFactionStronghold ),
|
||||
new TravelValidator( IsChampionSpawn ),
|
||||
new TravelValidator( IsTokunoDungeon ),
|
||||
|
|
@ -561,14 +589,14 @@ namespace Server.Spells
|
|||
|
||||
private static bool[,] m_Rules = new bool[,]
|
||||
{
|
||||
/*T2A(Fel) Ilshenar Wind(Tram), Wind(Fel), Dungeons(Fel), Solen(Tram), Solen(Fel), CrystalCave(Malas), Gauntlet(Malas), Gauntlet(Ferry), Stronghold, ChampionSpawn, Dungeons(Tokuno[Malas]), LampRoom(Doom), GuardianRoom(Doom), Heartwood, MLDungeons */
|
||||
/* Recall From */ { false, true, true, false, false, true, false, false, false, false, true, false, true, false, false, false, false },
|
||||
/* Recall To */ { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false },
|
||||
/* Gate From */ { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false },
|
||||
/* Gate To */ { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false },
|
||||
/* Mark In */ { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false },
|
||||
/* Tele From */ { true, true, true, true, true, true, true, false, true, true, false, true, true, true, true, false, true },
|
||||
/* Tele To */ { true, true, true, true, true, true, true, false, true, false, false, true, true, true, true, false, false },
|
||||
/*T2A(Fel) Ilshenar Wind(Tram), Wind(Fel), Dungeons(Fel), Solen(Tram), Solen(Fel), CrystalCave(Malas), Gauntlet(Malas), Gauntlet(Ferry), SafeZone, Stronghold, ChampionSpawn, Dungeons(Tokuno[Malas]), LampRoom(Doom), GuardianRoom(Doom), Heartwood, MLDungeons */
|
||||
/* Recall From */ { false, true, true, false, false, true, false, false, false, false, true, true, false, true, false, false, false, false },
|
||||
/* Recall To */ { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false },
|
||||
/* Gate From */ { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false },
|
||||
/* Gate To */ { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false },
|
||||
/* Mark In */ { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false },
|
||||
/* Tele From */ { true, true, true, true, true, true, true, false, true, true, true, false, true, true, true, true, false, true },
|
||||
/* Tele To */ { true, true, true, true, true, true, true, false, true, false, false, false, true, true, true, true, false, false },
|
||||
};
|
||||
|
||||
public static void SendInvalidMessage( Mobile caster, TravelCheckType type )
|
||||
|
|
@ -706,6 +734,26 @@ namespace Server.Spells
|
|||
|| ( x >= 1188 && y >= 509 && x < 1201 && y < 513 );
|
||||
}
|
||||
|
||||
public static bool IsSafeZone( Map map, Point3D loc )
|
||||
{
|
||||
#region Duels
|
||||
if ( Region.Find( loc, map ).IsPartOf( typeof( Engines.ConPVP.SafeZone ) ) )
|
||||
{
|
||||
if ( m_TravelType == TravelCheckType.TeleportTo || m_TravelType == TravelCheckType.TeleportFrom )
|
||||
{
|
||||
PlayerMobile pm = m_TravelCaster as PlayerMobile;
|
||||
|
||||
if ( pm != null && pm.DuelPlayer != null && !pm.DuelPlayer.Eliminated )
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsFactionStronghold( Map map, Point3D loc )
|
||||
{
|
||||
/*// Teleporting is allowed, but only for faction members
|
||||
|
|
@ -821,7 +869,19 @@ namespace Server.Spells
|
|||
if( map == null )
|
||||
return false;
|
||||
|
||||
GuardedRegion reg = (GuardedRegion)Region.Find( loc, map ).GetRegion( typeof( GuardedRegion ) );
|
||||
#region Dueling
|
||||
Engines.ConPVP.SafeZone sz = (Engines.ConPVP.SafeZone) Region.Find( loc, map ).GetRegion( typeof( Engines.ConPVP.SafeZone ) );
|
||||
|
||||
if ( sz != null )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile) caster;
|
||||
|
||||
if ( pm == null || pm.DuelContext == null || !pm.DuelContext.Started || pm.DuelPlayer == null || pm.DuelPlayer.Eliminated )
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
GuardedRegion reg = (GuardedRegion) Region.Find( loc, map ).GetRegion( typeof( GuardedRegion ) );
|
||||
|
||||
return (reg != null && !reg.IsDisabled());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,17 @@ namespace Server.Spells.Chivalry
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Engines.ConPVP.DuelContext.CheckSuddenDeath( Caster ) )
|
||||
{
|
||||
Caster.SendMessage( 0x22, "You cannot cast this spell when in sudden death." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
|
|
|
|||
|
|
@ -26,6 +26,17 @@ namespace Server.Spells.Chivalry
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Engines.ConPVP.DuelContext.CheckSuddenDeath( Caster ) )
|
||||
{
|
||||
Caster.SendMessage( 0x22, "You cannot cast this spell when in sudden death." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
|
|
|
|||
|
|
@ -27,6 +27,17 @@ namespace Server.Spells.Chivalry
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Engines.ConPVP.DuelContext.CheckSuddenDeath( Caster ) )
|
||||
{
|
||||
Caster.SendMessage( 0x22, "You cannot cast this spell when in sudden death." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
|
|
|
|||
|
|
@ -22,6 +22,17 @@ namespace Server.Spells.Eighth
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Engines.ConPVP.DuelContext.CheckSuddenDeath( Caster ) )
|
||||
{
|
||||
Caster.SendMessage( 0x22, "You cannot cast this spell when in sudden death." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
|
|
|
|||
|
|
@ -23,6 +23,17 @@ namespace Server.Spells.First
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Engines.ConPVP.DuelContext.CheckSuddenDeath( Caster ) )
|
||||
{
|
||||
Caster.SendMessage( 0x22, "You cannot cast this spell when in sudden death." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
|
|
|
|||
|
|
@ -24,6 +24,17 @@ namespace Server.Spells.Fourth
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Engines.ConPVP.DuelContext.CheckSuddenDeath( Caster ) )
|
||||
{
|
||||
Caster.SendMessage( 0x22, "You cannot cast this spell when in sudden death." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
|
|
|
|||
|
|
@ -156,8 +156,13 @@ namespace Server.Spells.Necromancy
|
|||
double spirit = m_From.Skills[SkillName.SpiritSpeak].Value;
|
||||
|
||||
BaseCreature check = (BaseCreature)SummonFamiliarSpell.Table[m_From];
|
||||
|
||||
if ( check != null && !check.Deleted )
|
||||
|
||||
#region Dueling
|
||||
if ( m_From is PlayerMobile && ( (PlayerMobile)m_From ).DuelContext != null && !( (PlayerMobile)m_From ).DuelContext.AllowSpellCast( m_From, m_Spell ) )
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
else if ( check != null && !check.Deleted )
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1061605 ); // You already have a familiar.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -474,11 +474,16 @@ namespace Server.Spells.Ninjitsu
|
|||
}
|
||||
else if (BaseFormTalisman.EntryEnabled(sender.Mobile, entry.Type))
|
||||
{
|
||||
if (AnimalForm.Morph(m_Caster, entryID) == MorphResult.Fail)
|
||||
#region Dueling
|
||||
if ( m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, m_Spell ) )
|
||||
{
|
||||
m_Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502632); // The spell fizzles.
|
||||
m_Caster.FixedParticles(0x3735, 1, 30, 9503, EffectLayer.Waist);
|
||||
m_Caster.PlaySound(0x5C);
|
||||
}
|
||||
#endregion
|
||||
else if (AnimalForm.Morph(m_Caster, entryID) == MorphResult.Fail)
|
||||
{
|
||||
m_Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502632 ); // The spell fizzles.
|
||||
m_Caster.FixedParticles( 0x3735, 1, 30, 9503, EffectLayer.Waist );
|
||||
m_Caster.PlaySound( 0x5C );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,6 +20,17 @@ namespace Server.Spells.Second
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Engines.ConPVP.DuelContext.CheckSuddenDeath( Caster ) )
|
||||
{
|
||||
Caster.SendMessage( 0x22, "You cannot cast this spell when in sudden death." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
|
|
|
|||
|
|
@ -20,6 +20,17 @@ namespace Server.Spells.Second
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Engines.ConPVP.DuelContext.CheckSuddenDeath( Caster ) )
|
||||
{
|
||||
Caster.SendMessage( 0x22, "You cannot cast this spell when in sudden death." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
|
|
|
|||
|
|
@ -20,6 +20,17 @@ namespace Server.Spells.Second
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Engines.ConPVP.DuelContext.CheckSuddenDeath( Caster ) )
|
||||
{
|
||||
Caster.SendMessage( 0x22, "You cannot cast this spell when in sudden death." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
|
|
|
|||
|
|
@ -20,6 +20,17 @@ namespace Server.Spells.Second
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Engines.ConPVP.DuelContext.CheckSuddenDeath( Caster ) )
|
||||
{
|
||||
Caster.SendMessage( 0x22, "You cannot cast this spell when in sudden death." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
|
|
|
|||
|
|
@ -22,6 +22,17 @@ namespace Server.Spells.Sixth
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Engines.ConPVP.DuelContext.CheckSuddenDeath( Caster ) )
|
||||
{
|
||||
Caster.SendMessage( 0x22, "You cannot cast this spell when in sudden death." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
|
|
|
|||
|
|
@ -20,6 +20,17 @@ namespace Server.Spells.Third
|
|||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Engines.ConPVP.DuelContext.CheckSuddenDeath( Caster ) )
|
||||
{
|
||||
Caster.SendMessage( 0x22, "You cannot cast this spell when in sudden death." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
|
|
|
|||
|
|
@ -71,7 +71,28 @@ namespace Server.Spells.Third
|
|||
}
|
||||
else
|
||||
{
|
||||
double total = Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Poisoning].Value;
|
||||
//double total = Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Poisoning].Value;
|
||||
|
||||
#region Dueling
|
||||
double total = Caster.Skills[SkillName.Magery].Value;
|
||||
|
||||
if ( Caster is Mobiles.PlayerMobile )
|
||||
{
|
||||
Mobiles.PlayerMobile pm = (Mobiles.PlayerMobile)Caster;
|
||||
|
||||
if ( pm.DuelContext != null && pm.DuelContext.Started && !pm.DuelContext.Finished && !pm.DuelContext.Ruleset.GetOption( "Skills", "Poisoning" ) )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
total += Caster.Skills[SkillName.Poisoning].Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
total += Caster.Skills[SkillName.Poisoning].Value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
double dist = Caster.GetDistanceToSqrt( m );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue