[Release]ClassPKTourny

02/28/2010 21:08 Arcо#1
Well this is for those using Korvacs PKTournament and using my original SaveHaloes method.
Very simple, just a few class checks.
Go to PKTournament.cs and search for
Code:
public static void BeginTournament()
and above it put this
Code:
        public static void BeginNinja()
        {
            foreach (Character Char in World.H_Chars.Values)
            {
                if (Char.Job == 55)
                {
                    Char.MyClient.DialogNPC = 666111;
                    PacketHandling.NPCDialog.Handle(Char.MyClient, null, 666111, 0);
                    Char.MyClient.EndSend();
                }
            }
            Stage = PKTournamentStage.Inviting;
            while (CountDown > 0)
            {
                if (CountDown == 20)
                    Broadcast("20 seconds until start", BroadCastLoc.World);
                else if (CountDown == 10)
                {
                    Stage = PKTournamentStage.Countdown;
                    if (PKTHash.Count < 2)
                    {
                        Broadcast("The tournament requires atleast 2 people to start, Tournament Cancelled.", BroadCastLoc.World);
                        Stage = PKTournamentStage.None;
                        PKTHash = null;
                        return;
                    }
                    Broadcast("10 seconds until start", BroadCastLoc.World);
                }
                else if (CountDown < 4)
                    Broadcast(CountDown + " seconds until start", BroadCastLoc.World);

                CountDown--;
                Thread.Sleep(1000);
            }
            Stage = PKTournamentStage.Fighting;
            Broadcast("Fight!", BroadCastLoc.World);
            WaitForWinner();
        }
        public static void BeginTrojan()
        {
            foreach (Character Char in World.H_Chars.Values)
            {
                if (Char.Job == 15)
                {
                    Char.MyClient.DialogNPC = 666111;
                    PacketHandling.NPCDialog.Handle(Char.MyClient, null, 666111, 0);
                    Char.MyClient.EndSend();
                }
            }
            Stage = PKTournamentStage.Inviting;
            while (CountDown > 0)
            {
                if (CountDown == 20)
                    Broadcast("20 seconds until start", BroadCastLoc.World);
                else if (CountDown == 10)
                {
                    Stage = PKTournamentStage.Countdown;
                    if (PKTHash.Count < 2)
                    {
                        Broadcast("The tournament requires atleast 2 people to start, Tournament Cancelled.", BroadCastLoc.World);
                        Stage = PKTournamentStage.None;
                        PKTHash = null;
                        return;
                    }
                    Broadcast("10 seconds until start", BroadCastLoc.World);
                }
                else if (CountDown < 4)
                    Broadcast(CountDown + " seconds until start", BroadCastLoc.World);

                CountDown--;
                Thread.Sleep(1000);
            }
            Stage = PKTournamentStage.Fighting;
            Broadcast("Fight!", BroadCastLoc.World);
            WaitForWinner();
        }
        public static void BeginWarrior()
        {
            foreach (Character Char in World.H_Chars.Values)
            {
                if (Char.Job == 25)
                {
                    Char.MyClient.DialogNPC = 666111;
                    PacketHandling.NPCDialog.Handle(Char.MyClient, null, 666111, 0);
                    Char.MyClient.EndSend();
                }
            }
            Stage = PKTournamentStage.Inviting;
            while (CountDown > 0)
            {
                if (CountDown == 20)
                    Broadcast("20 seconds until start", BroadCastLoc.World);
                else if (CountDown == 10)
                {
                    Stage = PKTournamentStage.Countdown;
                    if (PKTHash.Count < 2)
                    {
                        Broadcast("The tournament requires atleast 2 people to start, Tournament Cancelled.", BroadCastLoc.World);
                        Stage = PKTournamentStage.None;
                        PKTHash = null;
                        return;
                    }
                    Broadcast("10 seconds until start", BroadCastLoc.World);
                }
                else if (CountDown < 4)
                    Broadcast(CountDown + " seconds until start", BroadCastLoc.World);

                CountDown--;
                Thread.Sleep(1000);
            }
            Stage = PKTournamentStage.Fighting;
            Broadcast("Fight!", BroadCastLoc.World);
            WaitForWinner();
        }
        public static void BeginArcher()
        {
            foreach (Character Char in World.H_Chars.Values)
            {
                if (Char.Job == 45)
                {
                    Char.MyClient.DialogNPC = 666111;
                    PacketHandling.NPCDialog.Handle(Char.MyClient, null, 666111, 0);
                    Char.MyClient.EndSend();
                }
            }
            Stage = PKTournamentStage.Inviting;
            while (CountDown > 0)
            {
                if (CountDown == 20)
                    Broadcast("20 seconds until start", BroadCastLoc.World);
                else if (CountDown == 10)
                {
                    Stage = PKTournamentStage.Countdown;
                    if (PKTHash.Count < 2)
                    {
                        Broadcast("The tournament requires atleast 2 people to start, Tournament Cancelled.", BroadCastLoc.World);
                        Stage = PKTournamentStage.None;
                        PKTHash = null;
                        return;
                    }
                    Broadcast("10 seconds until start", BroadCastLoc.World);
                }
                else if (CountDown < 4)
                    Broadcast(CountDown + " seconds until start", BroadCastLoc.World);

                CountDown--;
                Thread.Sleep(1000);
            }
            Stage = PKTournamentStage.Fighting;
            Broadcast("Fight!", BroadCastLoc.World);
            WaitForWinner();
        }
        public static void BeginFire()
        {
            foreach (Character Char in World.H_Chars.Values)
            {
                if (Char.Job == 145)
                {
                    Char.MyClient.DialogNPC = 666111;
                    PacketHandling.NPCDialog.Handle(Char.MyClient, null, 666111, 0);
                    Char.MyClient.EndSend();
                }
            }
            Stage = PKTournamentStage.Inviting;
            while (CountDown > 0)
            {
                if (CountDown == 20)
                    Broadcast("20 seconds until start", BroadCastLoc.World);
                else if (CountDown == 10)
                {
                    Stage = PKTournamentStage.Countdown;
                    if (PKTHash.Count < 2)
                    {
                        Broadcast("The tournament requires atleast 2 people to start, Tournament Cancelled.", BroadCastLoc.World);
                        Stage = PKTournamentStage.None;
                        PKTHash = null;
                        return;
                    }
                    Broadcast("10 seconds until start", BroadCastLoc.World);
                }
                else if (CountDown < 4)
                    Broadcast(CountDown + " seconds until start", BroadCastLoc.World);

                CountDown--;
                Thread.Sleep(1000);
            }
            Stage = PKTournamentStage.Fighting;
            Broadcast("Fight!", BroadCastLoc.World);
            WaitForWinner();
        }
        public static void BeginWater()
        {
            foreach (Character Char in World.H_Chars.Values)
            {
                if (Char.Job == 135)
                {
                    Char.MyClient.DialogNPC = 666111;
                    PacketHandling.NPCDialog.Handle(Char.MyClient, null, 666111, 0);
                    Char.MyClient.EndSend();
                }
            }
            Stage = PKTournamentStage.Inviting;
            while (CountDown > 0)
            {
                if (CountDown == 20)
                    Broadcast("20 seconds until start", BroadCastLoc.World);
                else if (CountDown == 10)
                {
                    Stage = PKTournamentStage.Countdown;
                    if (PKTHash.Count < 2)
                    {
                        Broadcast("The tournament requires atleast 2 people to start, Tournament Cancelled.", BroadCastLoc.World);
                        Stage = PKTournamentStage.None;
                        PKTHash = null;
                        return;
                    }
                    Broadcast("10 seconds until start", BroadCastLoc.World);
                }
                else if (CountDown < 4)
                    Broadcast(CountDown + " seconds until start", BroadCastLoc.World);

                CountDown--;
                Thread.Sleep(1000);
            }
            Stage = PKTournamentStage.Fighting;
            Broadcast("Fight!", BroadCastLoc.World);
            WaitForWinner();
        }
Then go to
Code:
private static void AwardWinner(Character Winner)
and above that put
Code:
        private static void AwardClass(Character Winner)
        {
            Broadcast(Winner.Name + " has won the tournament!", BroadCastLoc.World);
            #region Ninja
            if (Winner.Job == 55)
            {
                Winner.StatEff.Add(StatusEffectEn.TopNinja);
                try
                {
                    StreamWriter sw = new StreamWriter("C:\\OldCODB/TopNinja.txt");
                    sw.WriteLine("" + Winner.EntityID + "#8796093022208");
                    sw.Close();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            #endregion
            #region Warrior
            if (Winner.Job == 25)
            {
                Winner.StatEff.Add(StatusEffectEn.TopWarrior);
                try
                {
                    StreamWriter sw = new StreamWriter("C:\\OldCODB/TopWarrior.txt");
                    sw.WriteLine("" + Winner.EntityID + "#274877906944");
                    sw.Close();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            #endregion
            #region Archer
            if (Winner.Job == 45)
            {
                Winner.StatEff.Add(StatusEffectEn.TopArcher);
                try
                {
                    StreamWriter sw = new StreamWriter("C:\\OldCODB/TopWarrior.txt");
                    sw.WriteLine("" + Winner.EntityID + "#1099511627776");
                    sw.Close();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            #endregion
            #region Archer
            if (Winner.Job == 15)
            {
                Winner.StatEff.Add(StatusEffectEn.TopTrojan);
                try
                {
                    StreamWriter sw = new StreamWriter("C:\\OldCODB/TopTrojan.txt");
                    sw.WriteLine("" + Winner.EntityID + "#549755813888");
                    sw.Close();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            #endregion
            #region Water
            if (Winner.Job == 145)
            {
                Winner.StatEff.Add(StatusEffectEn.TopWaterTaoist);
                try
                {
                    StreamWriter sw = new StreamWriter("C:\\OldCODB/TopWater.txt");
                    sw.WriteLine("" + Winner.EntityID + "#2199023255552");
                    sw.Close();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            #endregion
            #region Fire
            if (Winner.Job == 135)
            {
                Winner.StatEff.Add(StatusEffectEn.TopFireTaoist);
                try
                {
                    StreamWriter sw = new StreamWriter("C:\\OldCODB/TopFire.txt");
                    sw.WriteLine("" + Winner.EntityID + "#4398046511104");
                    sw.Close();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            #endregion

            Winner.CPs += 1500;

            PKTournament.Stage = PKTournamentStage.None;
            PkThread.Abort();
            return;
        }
Then go to
Code:
public static void WaitForWinner()
and above it put
Code:
         public static void WaitForClass()
        {
            PKTournament.Stage = PKTournamentStage.Fighting;
            uint Tick = (uint)Environment.TickCount;
            int InMapAlive = PKTHash.Count;
            while (true)
            {
                foreach (Main.GameClient _GC in PKTHash.Values)
                {
                    if (_GC.MyChar.InPKT)
                        if (!_GC.MyChar.Alive)
                        {
                            InMapAlive--;
                            _GC.MyChar.InPKT = false;
                        }
                        else if (!World.H_Chars.ContainsKey(_GC.MyChar.EntityID))
                        {
                            InMapAlive--;
                            _GC.MyChar.InPKT = false;
                        }
                }

                foreach (Main.GameClient _GC in PKTHash.Values)
                {
                    if (_GC.MyChar.InPKT)
                        if (_GC.MyChar.Alive && InMapAlive == 1)
                        {
                            _GC.MyChar.Teleport(1002, 438, 382);
                            AwardClass(_GC.MyChar);
                            Stage = PKTournamentStage.Over;
                            return;
                        }
                }

                if (InMapAlive != 1)
                {
                    Broadcast("There are" + InMapAlive + "people left", BroadCastLoc.Map);

                }
                Thread.Sleep(1000);
            }
        }
02/28/2010 21:13 NukingFuts#2
woot nice work bro
02/28/2010 21:17 |xabi|#3
give me 6 errors???
02/28/2010 21:18 Arcо#4
Quote:
Originally Posted by |xabi| View Post
give me 6 errors???
What errors?
Lemme guess, your not using my save haloes?
02/28/2010 21:19 |xabi|#5
Quote:
Originally Posted by .Arco View Post
What errors?
Lemme guess, your not using my save haloes?
can you give me Links??
02/28/2010 21:20 Arcо#6
[Only registered and activated users can see links. Click Here To Register...]
02/28/2010 21:22 |xabi|#7
i will try

thx

man i do it but give me errors can u call me on

[Only registered and activated users can see links. Click Here To Register...]

to do it for me by team vewier

and i do save halos

this is the big problem

[Only registered and activated users can see links. Click Here To Register...]
02/28/2010 21:45 killersub#8
Quote:
Originally Posted by |xabi| View Post
i will try

thx

man i do it but give me errors can u call me on

[Only registered and activated users can see links. Click Here To Register...]

to do it for me by team vewier

and i do save halos

this is the big problem

[Only registered and activated users can see links. Click Here To Register...]
roflmao! U are definetly fucking up ur server bro...Did u hear wat .Arco said? U MUST USE KORVAC'S PKTournament RELEASE and .Arco's SaveHalos release...To me it seems u are using neither becuz that shouldn't happen and I just got done implementing it in my source "NO ERRORS"...

@.Arco
when I do /pkt or /starttourny it doesn't start and I have everything set up right o_0...
02/28/2010 22:32 Arcо#9
Quote:
Originally Posted by killersub View Post
roflmao! U are definetly fucking up ur server bro...Did u hear wat .Arco said? U MUST USE KORVAC'S PKTournament RELEASE and .Arco's SaveHalos release...To me it seems u are using neither becuz that shouldn't happen and I just got done implementing it in my source "NO ERRORS"...

@.Arco
when I do /pkt or /starttourny it doesn't start and I have everything set up right o_0...
Post the pkt command here.
I'll fix it for each one.
02/28/2010 22:33 killersub#10
Quote:
Originally Posted by .Arco View Post
Post the pkt command here.
I'll fix it for each one.
Code:
else if (Cmd[0] == "/pkt")
                        {
                            if (GC.GM)
                            {
                                if (NewestCOServer.Features.PKTournament.Stage == NewestCOServer.Features.PKTournamentStage.None)
                                {
                                    NewestCOServer.Features.PKTournament.StartTournament();
                                    Console.WriteLine("PK Tournament started!");
                                }
                                else
                                {
                                    Console.WriteLine("PK Tournament is already in progress!");
                                }
                            }
                        }
                        if (Cmd[0] == "/starttourny")
                        {
                            if (NewestCOServer.Features.PKTournament.Stage == NewestCOServer.Features.PKTournamentStage.None)
                            {
                                NewestCOServer.Features.PKTournament.StartTournament();
                                Console.WriteLine("PK Tournament started!");
                            }
                            else
                            {
                                Console.WriteLine("PK Tournament is already in progress!");
                            }
                        }
there it is XD...I didn't edit these...
02/28/2010 22:40 Arcо#11
if (Cmd[0] == "/starttourny")
{
if (NewestCOServer.Features.PKTournament.Stage == NewestCOServer.Features.PKTournamentStage.None)
{
NewestCOServer.Features.PKTournament.BeginNinja();
Console.WriteLine("PK Tournament started!");
}
else
{
Console.WriteLine("PK Tournament is already in progress!");
}
}
Get it?
02/28/2010 22:53 killersub#12
Quote:
Originally Posted by .Arco View Post
if (Cmd[0] == "/starttourny")
{
if (NewestCOServer.Features.PKTournament.Stage == NewestCOServer.Features.PKTournamentStage.None)
{
NewestCOServer.Features.PKTournament.BeginNinja();
Console.WriteLine("PK Tournament started!");
}
else
{
Console.WriteLine("PK Tournament is already in progress!");
}
}
Get it?
I got it, Thanks! XD
03/01/2010 02:42 salem rey#13
So, how about the npc we use? still in same npc the first you release?
03/01/2010 02:47 Arcо#14
Quote:
Originally Posted by salem rey View Post
So, how about the npc we use? still in same npc the first you release?
Yeah still the same npc.
03/01/2010 02:58 salem rey#15
ahh ok thanks :D ill try it :D