PHP Code:
public static void WaitForWinner()
and here is my class which have the 2 error's
PHP Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Conquer_Online_Server.Game;
using Conquer_Online_Server.Network.GamePackets;
using Conquer_Online_Server.Network.Features.ClassPKWar;
namespace Conquer_Online_Server
{
public enum BroadCastLoc
{
World,
Map
}
public enum ElgahedStage
{
None,
Inviting,
Countdown,
Fighting,
Over
}
public static class Elgahed
{
public static ushort Map;
public static ushort X, Y;
public static ElgahedStage Stage = ElgahedStage.None;
public static Dictionary<uint, Client.GameState> PKTHash2;
public static Dictionary<uint, Client.GameState> PKTHash;
public static int CountDown;
private static Thread PkThread;
public Client.GameState pOne, pTwo;
public static Map dynamicMap;
public void RandomSelect()
{
List<Client.GameState> players = new List<Client.GameState>();
foreach (Client.GameState p in ServerBase.Kernel.GamePool.Values)
players.Add(p);
Random rand = new Random();
int selectedIndex = rand.Next(players.Count);
pOne = players[selectedIndex];
players.RemoveAt(selectedIndex);
selectedIndex = rand.Next(players.Count);
pTwo = players[selectedIndex];
players.RemoveAt(selectedIndex);
if (pOne.Map.ID == 1631 && pOne.Map.ID == pTwo.Map.ID)
if (!ServerBase.Kernel.Maps.ContainsKey(700))
new Map(700, Database.DMaps.MapPaths[700]);
Map origMap = ServerBase.Kernel.Maps[700];
dynamicMap = origMap.MakeDynamicMap();
pOne.Entity.Teleport(origMap.ID, dynamicMap.ID, (ushort)ServerBase.Kernel.Random.Next(35, 70), (ushort)ServerBase.Kernel.Random.Next(35, 70));
pTwo.Entity.Teleport(origMap.ID, dynamicMap.ID, (ushort)ServerBase.Kernel.Random.Next(35, 70), (ushort)ServerBase.Kernel.Random.Next(35, 70));
if (pOne.Map.ID == pTwo.Map.ID)
{
pOne.Entity.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
pTwo.Entity.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
pTwo.Entity.PKMode = pOne.Entity.PKMode;
pOne.Entity.PKMode = Conquer_Online_Server.Game.Enums.PKMode.PK;
pOne.Send(new Data(true) { UID = pOne.Entity.UID, ID = Data.ChangePKMode, dwParam = (uint)pOne.Entity.PKMode });
pOne.Entity.PKMode = pTwo.Entity.PKMode;
pTwo.Entity.PKMode = Conquer_Online_Server.Game.Enums.PKMode.PK;
pTwo.Send(new Data(true) { UID = pTwo.Entity.UID, ID = Data.ChangePKMode, dwParam = (uint)pTwo.Entity.PKMode });
Conquer_Online_Server.Network.PacketHandler.WorldMessage("" + pOne.Entity.Name + " Is Meeting " + pTwo.Entity.Name + " in the Elite Pk Tournament");
Client.GameState[] Clients = Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
while (CountDown > 0)
{
if (CountDown == 0)
Broadcast("60 seconds until start", BroadCastLoc.World);
else if (CountDown == 0)
{
Stage = ElgahedStage.Countdown;
//if (PKTHash.Count < 2)
//{
// Broadcast("The tournament requires atleast 2 people to start, Tournament Cancelled.", BroadCastLoc.World);
// Stage = ElgahedStage.None;
// PKTHash = null;
// return;
//}
Broadcast("10 seconds until start", BroadCastLoc.World);
}
else if (CountDown < 0)
Broadcast(CountDown + " seconds until start", BroadCastLoc.World);
CountDown--;
Thread.Sleep(1000);
}
Stage = ElgahedStage.Fighting;
Broadcast("Fight!", BroadCastLoc.World);
WaitForWinner();
}
}
public static void StartTournament(Client.GameState Started)
{
PKTHash = new Dictionary<uint, Client.GameState>();
CountDown = 0;
Stage = ElgahedStage.Inviting;
Map = 1507;
X = 100;
Y = 100;
PkThread = new Thread(new ThreadStart(BeginTournament));
PkThread.IsBackground = true;
PkThread.Start();
}
public static void StartTournament()
{
PKTHash = new Dictionary<uint, Client.GameState>();
CountDown = 0;
Stage = ElgahedStage.Inviting;
Map = 1507;
X = 100;
Y = 100;
PkThread = new Thread(new ThreadStart(BeginTournament));
PkThread.IsBackground = true;
PkThread.Start();
}
private static void Broadcast(string msg, BroadCastLoc loc)
{
//Console.WriteLine(msg);
if (loc == BroadCastLoc.World)
{
foreach (Client.GameState Char in ServerBase.Kernel.GamePool.Values)
{
Char.Send(new Message(msg, System.Drawing.Color.White, 2011));
// Char.MyClient.EndSend();
}
}
else if (loc == BroadCastLoc.Map)
{
foreach (Client.GameState Char in PKTHash.Values)
{
Char.Send(new Message(msg, System.Drawing.Color.White, 2011));
// Char.EndSend();
}
}
}
private static void AwardWinner(Client.GameState Winner)
{
Broadcast(Winner.Entity.Name + " has won the tournament !He WIn 10.000Cps and WeeklyPKChampion Top", BroadCastLoc.World);
Winner.Entity.WeeklyPKChampion += 1;
Winner.Entity.ConquerPoints += 10000;
Elgahed.Stage = ElgahedStage.None;
PkThread.Abort();
return;
}
public static void WaitForWinner()
{
Elgahed.Stage = ElgahedStage.Fighting;
uint Tick = (uint)Environment.TickCount;
int InMapAlive = PKTHash.Count;
while (true)
{
int alive = 0;
foreach (Conquer_Online_Server.Client.GameState players in Conquer_Online_Server.ServerBase.Kernel.GamePool.Values)
if (pOne.Entity.Map.ID == pOne.Entity.Map.ID && (!players.Entity.Dead))
alive++;
foreach (Client.GameState _GC in PKTHash.Values)
{
if (_GC.InPKT)
if (_GC.Entity.Dead == true)
{
}
else if (!ServerBase.Kernel.GamePool.ContainsKey(_GC.Entity.UID))
{
InMapAlive--;
_GC.Entity.Teleport(1002, 438, 382);
_GC.InPKT = false;
}
}
System.Threading.Thread.Sleep(2000);
foreach (Client.GameState _GC in PKTHash.Values)
{
if (_GC.InPKT)
if (alive == 1)
{
_GC.Entity.Teleport(1002, 438, 382);
AwardWinner(_GC);
Stage = ElgahedStage.Over;
return;
}
}
if (InMapAlive != 1)
{
Broadcast("There are " + InMapAlive + " Alive ", BroadCastLoc.Map);
}
Thread.Sleep(1000);
}
}
public static void BeginTournament()
{
Client.GameState[] client = Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
foreach (Client.GameState clientss in client)
{
Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "The WeeklyPK Champion Tournament has Started! You Wana Join?");
npc.OptionID = 248;
clientss.Send(npc.ToArray());
}
Stage = ElgahedStage.Inviting;
while (CountDown > 0)
{
if (CountDown == 0)
Broadcast("60 seconds until start", BroadCastLoc.World);
else if (CountDown == 0)
{
Stage = ElgahedStage.Countdown;
//if (PKTHash.Count < 2)
//{
// Broadcast("The tournament requires atleast 2 people to start, Tournament Cancelled.", BroadCastLoc.World);
// Stage = ElgahedStage.None;
// PKTHash = null;
// return;
//}
Broadcast("10 seconds until start", BroadCastLoc.World);
}
else if (CountDown < 0)
Broadcast(CountDown + " seconds until start", BroadCastLoc.World);
CountDown--;
Thread.Sleep(1000);
}
Stage = ElgahedStage.Fighting;
Broadcast("Fight!", BroadCastLoc.World);
WaitForWinner();
}
}
}
and i don't get this error in :
PHP Code:
public void RandomSelect()
PHP Code:
public static void WaitForWinner()






