Register for your free account! | Forgot your password?

You last visited: Today at 17:11

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release]ClassPKTourny

Discussion on [Release]ClassPKTourny within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
[Release]ClassPKTourny

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);
            }
        }
Arcо is offline  
Thanks
6 Users
Old 02/28/2010, 21:13   #2
 
NukingFuts's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 480
Received Thanks: 112
woot nice work bro
NukingFuts is offline  
Old 02/28/2010, 21:17   #3
 
elite*gold: 0
Join Date: Nov 2009
Posts: 342
Received Thanks: 17
give me 6 errors???
|xabi| is offline  
Old 02/28/2010, 21:18   #4
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Quote:
Originally Posted by |xabi| View Post
give me 6 errors???
What errors?
Lemme guess, your not using my save haloes?
Arcо is offline  
Thanks
1 User
Old 02/28/2010, 21:19   #5
 
elite*gold: 0
Join Date: Nov 2009
Posts: 342
Received Thanks: 17
Quote:
Originally Posted by .Arco View Post
What errors?
Lemme guess, your not using my save haloes?
can you give me Links??
|xabi| is offline  
Old 02/28/2010, 21:20   #6
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Arcо is offline  
Thanks
2 Users
Old 02/28/2010, 21:22   #7
 
elite*gold: 0
Join Date: Nov 2009
Posts: 342
Received Thanks: 17
i will try

thx

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



to do it for me by team vewier

and i do save halos

this is the big problem

|xabi| is offline  
Old 02/28/2010, 21:45   #8
 
killersub's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
Quote:
Originally Posted by |xabi| View Post
i will try

thx

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



to do it for me by team vewier

and i do save halos

this is the big problem

roflmao! U are definetly ******* 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...
killersub is offline  
Old 02/28/2010, 22:32   #9
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Quote:
Originally Posted by killersub View Post
roflmao! U are definetly ******* 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.
Arcо is offline  
Thanks
1 User
Old 02/28/2010, 22:33   #10
 
killersub's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
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...
killersub is offline  
Thanks
1 User
Old 02/28/2010, 22:40   #11
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
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?
Arcо is offline  
Thanks
1 User
Old 02/28/2010, 22:53   #12
 
killersub's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
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
killersub is offline  
Old 03/01/2010, 02:42   #13
 
salem rey's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 275
Received Thanks: 43
So, how about the npc we use? still in same npc the first you release?
salem rey is offline  
Old 03/01/2010, 02:47   #14
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
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.
Arcо is offline  
Thanks
1 User
Old 03/01/2010, 02:58   #15
 
salem rey's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 275
Received Thanks: 43
ahh ok thanks ill try it
salem rey is offline  
Reply




All times are GMT +1. The time now is 17:12.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.