Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
1797
Projects/Scripts/Engines/ConPVP/Games/BombingRun.cs
Normal file
1797
Projects/Scripts/Engines/ConPVP/Games/BombingRun.cs
Normal file
File diff suppressed because it is too large
Load diff
1205
Projects/Scripts/Engines/ConPVP/Games/CTF.cs
Normal file
1205
Projects/Scripts/Engines/ConPVP/Games/CTF.cs
Normal file
File diff suppressed because it is too large
Load diff
1109
Projects/Scripts/Engines/ConPVP/Games/DoubleDom.cs
Normal file
1109
Projects/Scripts/Engines/ConPVP/Games/DoubleDom.cs
Normal file
File diff suppressed because it is too large
Load diff
77
Projects/Scripts/Engines/ConPVP/Games/EventGame.cs
Normal file
77
Projects/Scripts/Engines/ConPVP/Games/EventGame.cs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public abstract class EventController : Item
|
||||
{
|
||||
public EventController()
|
||||
: base(0x1B7A)
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public EventController(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract string Title{ get; }
|
||||
public abstract EventGame Construct(DuelContext dc);
|
||||
|
||||
public abstract string GetTeamName(int teamID);
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(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 PropertiesGump(from, this));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class EventGame
|
||||
{
|
||||
protected DuelContext m_Context;
|
||||
|
||||
public EventGame(DuelContext context)
|
||||
{
|
||||
m_Context = context;
|
||||
}
|
||||
|
||||
public DuelContext Context => m_Context;
|
||||
|
||||
public virtual bool FreeConsume => true;
|
||||
|
||||
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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
1184
Projects/Scripts/Engines/ConPVP/Games/KingOfTheHill.cs
Normal file
1184
Projects/Scripts/Engines/ConPVP/Games/KingOfTheHill.cs
Normal file
File diff suppressed because it is too large
Load diff
123
Projects/Scripts/Engines/ConPVP/Games/TourneyMatch.cs
Normal file
123
Projects/Scripts/Engines/ConPVP/Games/TourneyMatch.cs
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class TourneyMatch
|
||||
{
|
||||
public TourneyMatch(List<TourneyParticipant> participants)
|
||||
{
|
||||
Participants = participants;
|
||||
|
||||
for (int i = 0; i < participants.Count; ++i)
|
||||
{
|
||||
TourneyParticipant part = participants[i];
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.Append("Matched in a duel against ");
|
||||
|
||||
if (participants.Count > 2)
|
||||
sb.AppendFormat("{0} other {1}: ", participants.Count - 1,
|
||||
part.Players.Count == 1 ? "players" : "teams");
|
||||
|
||||
bool hasAppended = false;
|
||||
|
||||
for (int j = 0; j < participants.Count; ++j)
|
||||
{
|
||||
if (i == j)
|
||||
continue;
|
||||
|
||||
if (hasAppended)
|
||||
sb.Append(", ");
|
||||
|
||||
sb.Append(participants[j].NameList);
|
||||
hasAppended = true;
|
||||
}
|
||||
|
||||
sb.Append(".");
|
||||
|
||||
part.AddLog(sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public List<TourneyParticipant> Participants{ get; set; }
|
||||
|
||||
public TourneyParticipant Winner{ get; set; }
|
||||
|
||||
public DuelContext Context{ get; set; }
|
||||
|
||||
public bool InProgress => Context?.Registered == true;
|
||||
|
||||
public void Start(Arena arena, Tournament tourney)
|
||||
{
|
||||
TourneyParticipant first = Participants[0];
|
||||
|
||||
DuelContext dc = new DuelContext(first.Players[0], tourney.Ruleset.Layout, false);
|
||||
dc.Ruleset.Options.SetAll(false);
|
||||
dc.Ruleset.Options.Or(tourney.Ruleset.Options);
|
||||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
TourneyParticipant tourneyPart = Participants[i];
|
||||
Participant duelPart = new Participant(dc, tourneyPart.Players.Count)
|
||||
{
|
||||
TourneyPart = tourneyPart
|
||||
};
|
||||
|
||||
|
||||
for (int j = 0; j < tourneyPart.Players.Count; ++j)
|
||||
duelPart.Add(tourneyPart.Players[j]);
|
||||
|
||||
for (int j = 0; j < duelPart.Players.Length; ++j)
|
||||
if (duelPart.Players[j] != null)
|
||||
duelPart.Players[j].Ready = true;
|
||||
|
||||
dc.Participants.Add(duelPart);
|
||||
}
|
||||
|
||||
if (tourney.EventController != null)
|
||||
dc.m_EventGame = tourney.EventController.Construct(dc);
|
||||
|
||||
dc.m_Tournament = tourney;
|
||||
dc.m_Match = this;
|
||||
|
||||
dc.m_OverrideArena = arena;
|
||||
|
||||
if (tourney.SuddenDeath > TimeSpan.Zero &&
|
||||
(tourney.SuddenDeathRounds == 0 || tourney.Pyramid.Levels.Count <= tourney.SuddenDeathRounds))
|
||||
dc.StartSuddenDeath(tourney.SuddenDeath);
|
||||
|
||||
dc.SendReadyGump(0);
|
||||
|
||||
if (dc.StartedBeginCountdown)
|
||||
{
|
||||
Context = dc;
|
||||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
TourneyParticipant p = Participants[i];
|
||||
|
||||
for (int j = 0; j < p.Players.Count; ++j)
|
||||
{
|
||||
Mobile mob = p.Players[j];
|
||||
|
||||
foreach (Mobile view in mob.GetMobilesInRange(18))
|
||||
if (!mob.CanSee(view))
|
||||
mob.Send(view.RemovePacket);
|
||||
|
||||
mob.LocalOverheadMessage(MessageType.Emote, 0x3B2, false,
|
||||
"* Your mind focuses intently on the fight and all other distractions fade away *");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.Unregister();
|
||||
dc.StopCountdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue