add bombing run, double domination, king of the hill, and capture the flag events
add faction tournament mode update vs project
This commit is contained in:
parent
ba8e6c7a19
commit
ab4246058b
6 changed files with 6140 additions and 9 deletions
1959
Scripts/Engines/ConPVP/Games/BombingRun.cs
Normal file
1959
Scripts/Engines/ConPVP/Games/BombingRun.cs
Normal file
File diff suppressed because it is too large
Load diff
1332
Scripts/Engines/ConPVP/Games/CTF.cs
Normal file
1332
Scripts/Engines/ConPVP/Games/CTF.cs
Normal file
File diff suppressed because it is too large
Load diff
1250
Scripts/Engines/ConPVP/Games/DoubleDom.cs
Normal file
1250
Scripts/Engines/ConPVP/Games/DoubleDom.cs
Normal file
File diff suppressed because it is too large
Load diff
1312
Scripts/Engines/ConPVP/Games/KingOfTheHill.cs
Normal file
1312
Scripts/Engines/ConPVP/Games/KingOfTheHill.cs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -9,6 +9,10 @@ using Server.ContextMenus;
|
|||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
using System.Collections.Generic;
|
||||
using Server.Factions;
|
||||
using Server.Ethics;
|
||||
using Server.Ethics.Evil;
|
||||
using Server.Ethics.Hero;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
|
|
@ -80,6 +84,11 @@ namespace Server.Engines.ConPVP
|
|||
return;
|
||||
}
|
||||
|
||||
if ( tourny.IsFactionRestricted && Faction.Find( m ) == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( tourny.HasParticipant( m ) )
|
||||
return;
|
||||
|
||||
|
|
@ -211,6 +220,17 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if ( tourny.IsFactionRestricted && Faction.Find( from ) == null )
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
{
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x35, false, "Only those who have declared their faction allegiance may participate.", from.NetState );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ( from.HasGump( typeof( AcceptTeamGump ) ) )
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
|
|
@ -398,7 +418,13 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else if ( tourny.TournyType == TournyType.RandomTeam )
|
||||
{
|
||||
sb.Append( "Team" );
|
||||
sb.Append( tourny.ParticipantsPerMatch );
|
||||
sb.Append( "-Team" );
|
||||
}
|
||||
else if ( tourny.TournyType == TournyType.Faction )
|
||||
{
|
||||
sb.Append( tourny.ParticipantsPerMatch );
|
||||
sb.Append( "-Team Faction" );
|
||||
}
|
||||
else if ( tourny.TournyType == TournyType.RedVsBlue )
|
||||
{
|
||||
|
|
@ -637,6 +663,17 @@ namespace Server.Engines.ConPVP
|
|||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
return;
|
||||
}
|
||||
else if ( tourny.IsFactionRestricted && Faction.Find( mob ) == null )
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
{
|
||||
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
|
||||
0x35, false, "Only those who have declared their faction allegiance may participate.", from.NetState );
|
||||
}
|
||||
|
||||
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
|
||||
return;
|
||||
}
|
||||
else if ( tourny.HasParticipant( mob ) )
|
||||
{
|
||||
if ( m_Registrar != null )
|
||||
|
|
@ -933,6 +970,11 @@ namespace Server.Engines.ConPVP
|
|||
sb.Append( tourny.ParticipantsPerMatch );
|
||||
sb.Append( "-Team" );
|
||||
}
|
||||
else if ( tourny.TournyType == TournyType.Faction )
|
||||
{
|
||||
sb.Append( tourny.ParticipantsPerMatch );
|
||||
sb.Append( "-Team Faction" );
|
||||
}
|
||||
else if ( tourny.TournyType == TournyType.RedVsBlue )
|
||||
{
|
||||
sb.Append( "Red v Blue" );
|
||||
|
|
@ -1326,7 +1368,8 @@ namespace Server.Engines.ConPVP
|
|||
Standard,
|
||||
FreeForAll,
|
||||
RandomTeam,
|
||||
RedVsBlue
|
||||
RedVsBlue,
|
||||
Faction
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
|
|
@ -1335,6 +1378,9 @@ namespace Server.Engines.ConPVP
|
|||
private int m_ParticipantsPerMatch;
|
||||
private int m_PlayersPerParticipant;
|
||||
private int m_LevelRequirement;
|
||||
|
||||
private bool m_FactionRestricted;
|
||||
|
||||
private TournyPyramid m_Pyramid;
|
||||
private Ruleset m_Ruleset;
|
||||
|
||||
|
|
@ -1428,6 +1474,13 @@ namespace Server.Engines.ConPVP
|
|||
set{ m_LevelRequirement = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool FactionRestricted
|
||||
{
|
||||
get{ return m_FactionRestricted; }
|
||||
set{ m_FactionRestricted = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan SignupPeriod
|
||||
{
|
||||
|
|
@ -1478,6 +1531,12 @@ namespace Server.Engines.ConPVP
|
|||
set{ m_Undefeated = value; }
|
||||
}
|
||||
|
||||
public bool IsFactionRestricted {
|
||||
get {
|
||||
return ( m_FactionRestricted || m_TournyType == TournyType.Faction );
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasParticipant( Mobile mob )
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
|
|
@ -1493,7 +1552,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 4 ); // version
|
||||
writer.WriteEncodedInt( (int) 5 ); // version
|
||||
|
||||
writer.Write( (bool) m_FactionRestricted );
|
||||
|
||||
writer.Write( (Item) m_EventController );
|
||||
|
||||
|
|
@ -1516,6 +1577,11 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
switch ( version )
|
||||
{
|
||||
case 5: {
|
||||
m_FactionRestricted = reader.ReadBool();
|
||||
|
||||
goto case 4;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
m_EventController = reader.ReadItem() as EventController;
|
||||
|
|
@ -1884,7 +1950,12 @@ namespace Server.Engines.ConPVP
|
|||
else if ( m_TournyType == TournyType.RandomTeam )
|
||||
{
|
||||
sb.Append( m_ParticipantsPerMatch );
|
||||
sb.Append( "-team" );
|
||||
sb.Append( "-Team" );
|
||||
}
|
||||
else if ( m_TournyType == TournyType.Faction )
|
||||
{
|
||||
sb.Append( m_ParticipantsPerMatch );
|
||||
sb.Append( "-Team Faction" );
|
||||
}
|
||||
else if ( m_TournyType == TournyType.RedVsBlue )
|
||||
{
|
||||
|
|
@ -1994,8 +2065,11 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
Alert( "Is this all?", "Pitiful. Signup extended." );
|
||||
m_SignupStart = DateTime.UtcNow;
|
||||
/*Alert( "Is this all?", "Pitiful. Signup extended." );
|
||||
m_SignupStart = DateTime.UtcNow;*/
|
||||
|
||||
Alert("Is this all?", "Pitiful. Tournament cancelled.");
|
||||
m_Stage = TournamentStage.Inactive;
|
||||
}
|
||||
}
|
||||
else if ( Math.Abs( until.TotalSeconds - TimeSpan.FromMinutes( 1.0 ).TotalSeconds ) < (SliceInterval.TotalSeconds/2) )
|
||||
|
|
@ -2019,6 +2093,42 @@ namespace Server.Engines.ConPVP
|
|||
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", m_EventController.GetTeamName( ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) ) ) );
|
||||
else if ( m_TournyType == TournyType.RandomTeam )
|
||||
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) + 1 ) );
|
||||
else if ( m_TournyType == TournyType.Faction ) {
|
||||
if ( m_ParticipantsPerMatch == 4 )
|
||||
{
|
||||
string name = "(null)";
|
||||
|
||||
switch ( ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) )
|
||||
{
|
||||
case 0: {
|
||||
name = "Minax";
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
name = "Council of Mages";
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
name = "True Britannians";
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
name = "Shadowlords";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Alert( "The tournament has completed!", String.Format( "The {0} team has won!", name ) );
|
||||
}
|
||||
else if ( m_ParticipantsPerMatch == 2 )
|
||||
{
|
||||
Alert( "The tournament has completed!", String.Format( "The {0} team has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) == 0 ? "Evil" : "Hero" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) + 1 ) );
|
||||
}
|
||||
}
|
||||
else if ( m_TournyType == TournyType.RedVsBlue )
|
||||
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) == 0 ? "Red" : "Blue" ) );
|
||||
else
|
||||
|
|
@ -2097,6 +2207,42 @@ namespace Server.Engines.ConPVP
|
|||
Alert( "The tournament has completed!", String.Format( "Team {0} has won", m_EventController.GetTeamName( ( (TournyMatch) ( (PyramidLevel) m_Pyramid.Levels[0] ).Matches[0] ).Participants.IndexOf( winner ) ) ) );
|
||||
else if ( m_TournyType == TournyType.RandomTeam )
|
||||
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) + 1 ) );
|
||||
else if ( m_TournyType == TournyType.Faction ) {
|
||||
if ( m_ParticipantsPerMatch == 4 )
|
||||
{
|
||||
string name = "(null)";
|
||||
|
||||
switch ( ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) )
|
||||
{
|
||||
case 0: {
|
||||
name = "Minax";
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
name = "Council of Mages";
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
name = "True Britannians";
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
name = "Shadowlords";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Alert( "The tournament has completed!", String.Format( "The {0} team has won!", name ) );
|
||||
}
|
||||
else if ( m_ParticipantsPerMatch == 2 )
|
||||
{
|
||||
Alert( "The tournament has completed!", String.Format( "The {0} team has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) == 0 ? "Evil" : "Hero" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) + 1 ) );
|
||||
}
|
||||
}
|
||||
else if ( m_TournyType == TournyType.RedVsBlue )
|
||||
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) == 0 ? "Red" : "Blue" ) );
|
||||
else
|
||||
|
|
@ -2197,6 +2343,56 @@ namespace Server.Engines.ConPVP
|
|||
level.Matches.Add( new TournyMatch( new ArrayList( parts ) ) );
|
||||
break;
|
||||
}
|
||||
case TournyType.Faction:
|
||||
{
|
||||
TournyParticipant[] parts = new TournyParticipant[partsPerMatch];
|
||||
|
||||
for ( int i = 0; i < parts.Length; ++i )
|
||||
parts[i] = new TournyParticipant( new ArrayList() );
|
||||
|
||||
for ( int i = 0; i < copy.Count; ++i )
|
||||
{
|
||||
ArrayList players = ((TournyParticipant)copy[i]).Players;
|
||||
|
||||
for ( int j = 0; j < players.Count; ++j )
|
||||
{
|
||||
Mobile mob = (Mobile) players[j];
|
||||
|
||||
int index = -1;
|
||||
|
||||
if ( partsPerMatch == 4 )
|
||||
{
|
||||
Faction fac = Faction.Find( mob );
|
||||
|
||||
if ( fac != null )
|
||||
{
|
||||
index = fac.Definition.Sort;
|
||||
}
|
||||
}
|
||||
else if ( partsPerMatch == 2 )
|
||||
{
|
||||
if ( Ethic.Evil.IsEligible( mob ) )
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
else if ( Ethic.Hero.IsEligible( mob ) )
|
||||
{
|
||||
index = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( index < 0 || index >= partsPerMatch )
|
||||
{
|
||||
index = i % partsPerMatch;
|
||||
}
|
||||
|
||||
parts[index].Players.Add( mob );
|
||||
}
|
||||
}
|
||||
|
||||
level.Matches.Add( new TournyMatch( new ArrayList( parts ) ) );
|
||||
break;
|
||||
}
|
||||
case TournyType.RandomTeam:
|
||||
{
|
||||
TournyParticipant[] parts = new TournyParticipant[partsPerMatch];
|
||||
|
|
@ -2693,12 +2889,18 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else if ( tourny.TournyType == TournyType.RandomTeam )
|
||||
{
|
||||
sb.Append( "Team" );
|
||||
sb.Append( tourny.ParticipantsPerMatch );
|
||||
sb.Append( "-Team" );
|
||||
}
|
||||
else if ( tourny.TournyType == TournyType.RedVsBlue )
|
||||
{
|
||||
sb.Append( "Red v Blue" );
|
||||
}
|
||||
else if ( tourny.TournyType == TournyType.Faction )
|
||||
{
|
||||
sb.Append( tourny.ParticipantsPerMatch );
|
||||
sb.Append( "-Team Faction" );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < tourny.ParticipantsPerMatch; ++i )
|
||||
|
|
@ -3063,7 +3265,7 @@ namespace Server.Engines.ConPVP
|
|||
sb.Append( txt );
|
||||
}
|
||||
}
|
||||
else if ( m_Tournament.EventController != null || m_Tournament.TournyType == TournyType.RandomTeam || m_Tournament.TournyType == TournyType.RedVsBlue )
|
||||
else if ( m_Tournament.EventController != null || m_Tournament.TournyType == TournyType.RandomTeam || m_Tournament.TournyType == TournyType.RedVsBlue || m_Tournament.TournyType == TournyType.Faction )
|
||||
{
|
||||
for ( int j = 0; j < match.Participants.Count; ++j )
|
||||
{
|
||||
|
|
@ -3077,6 +3279,42 @@ namespace Server.Engines.ConPVP
|
|||
txt = String.Format( "Team {0} ({1})", m_Tournament.EventController.GetTeamName( j ), part.Players.Count );
|
||||
else if ( m_Tournament.TournyType == TournyType.RandomTeam )
|
||||
txt = String.Format( "Team {0} ({1})", j + 1, part.Players.Count );
|
||||
else if ( m_Tournament.TournyType == TournyType.Faction ) {
|
||||
if ( m_Tournament.ParticipantsPerMatch == 4 )
|
||||
{
|
||||
string name = "(null)";
|
||||
|
||||
switch ( j )
|
||||
{
|
||||
case 0: {
|
||||
name = "Minax";
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
name = "Council of Mages";
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
name = "True Britannians";
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
name = "Shadowlords";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
txt = String.Format( "{0} ({1})", name, part.Players.Count );
|
||||
}
|
||||
else if ( m_Tournament.ParticipantsPerMatch == 2 )
|
||||
{
|
||||
txt = String.Format( "{0} Team ({1})", j==0?"Evil":"Hero", part.Players.Count );
|
||||
}
|
||||
else
|
||||
{
|
||||
txt = String.Format( "Team {0} ({1})", j + 1, part.Players.Count );
|
||||
}
|
||||
}
|
||||
else
|
||||
txt = String.Format( "Team {0} ({1})", j == 0 ? "Red" : "Blue", part.Players.Count );
|
||||
|
||||
|
|
@ -3131,7 +3369,7 @@ namespace Server.Engines.ConPVP
|
|||
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), part.NameList );
|
||||
}
|
||||
}
|
||||
else if ( m_Tournament.EventController != null || m_Tournament.TournyType == TournyType.RandomTeam || m_Tournament.TournyType == TournyType.RedVsBlue )
|
||||
else if ( m_Tournament.EventController != null || m_Tournament.TournyType == TournyType.RandomTeam || m_Tournament.TournyType == TournyType.RedVsBlue || m_Tournament.TournyType == TournyType.Faction )
|
||||
{
|
||||
for ( int i = 0; i < match.Participants.Count; ++i )
|
||||
{
|
||||
|
|
@ -3141,6 +3379,42 @@ namespace Server.Engines.ConPVP
|
|||
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), String.Format( "Team {0} ({1})", m_Tournament.EventController.GetTeamName( i ), part.Players.Count ) );
|
||||
else if ( m_Tournament.TournyType == TournyType.RandomTeam )
|
||||
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), String.Format( "Team {0} ({1})", i+1, part.Players.Count ) );
|
||||
else if ( m_Tournament.TournyType == TournyType.Faction ) {
|
||||
if ( m_Tournament.ParticipantsPerMatch == 4 )
|
||||
{
|
||||
string name = "(null)";
|
||||
|
||||
switch ( i )
|
||||
{
|
||||
case 0: {
|
||||
name = "Minax";
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
name = "Council of Mages";
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
name = "True Britannians";
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
name = "Shadowlords";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), String.Format( "{0} ({1})", name, part.Players.Count ) );
|
||||
}
|
||||
else if ( m_Tournament.ParticipantsPerMatch == 2 )
|
||||
{
|
||||
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), String.Format( "{0} Team ({1})", i==0?"Evil":"Hero", part.Players.Count ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), String.Format( "Team {0} ({1})", i+1, part.Players.Count ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), String.Format( "Team {0} ({1})", i==0?"Red":"Blue", part.Players.Count ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,11 @@
|
|||
<Compile Include="Engines\ConPVP\DuelContext.cs" />
|
||||
<Compile Include="Engines\ConPVP\DuelContextGump.cs" />
|
||||
<Compile Include="Engines\ConPVP\DuelTeleporterAddon.cs" />
|
||||
<Compile Include="Engines\ConPVP\Games\BombingRun.cs" />
|
||||
<Compile Include="Engines\ConPVP\Games\CTF.cs" />
|
||||
<Compile Include="Engines\ConPVP\Games\DoubleDom.cs" />
|
||||
<Compile Include="Engines\ConPVP\Games\EventGame.cs" />
|
||||
<Compile Include="Engines\ConPVP\Games\KingOfTheHill.cs" />
|
||||
<Compile Include="Engines\ConPVP\Ladder.cs" />
|
||||
<Compile Include="Engines\ConPVP\LadderGump.cs" />
|
||||
<Compile Include="Engines\ConPVP\Participant.cs" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue