[Release] Amazing 1v1 tournament (fb/ss)

02/22/2010 12:34 .Kob#1
Well, I see that this forum is really helping with the development of the source 5165. That is why I decided to put this wonderful code.

Here we go,

First of all, add the desired map to fight.

Go search for:
Code:
public static ArrayList FreePKMaps = new ArrayList()
There we will see the list of PK maps.

For in that list we add this:
Code:
, (ushort)1707
Now let's add a portal.

Go Portals.txt in OldCoDB and add the follow code:

Code:
1707 52 74 1707 52 70

Now go to GuildWars (Features folder) and search for:

Code:
public static bool War;

Then add the next code below:

Code:
public static bool Ocupado; // 1v1
Well, preparations are already.

Now let the good code:

In Character.cs search for:

Code:
public string TempPass = "";
And above add:

Code:
public string Enemigo = ""; // 1v1
public byte PkPuntos = 0; // 1v1
public bool Luchando = false; // 1v1
public byte Apuesta = 0; // 1v1
[Note] Is spanish methods


Now go to Skills.cs and search for:


Code:
if (User.MyClient.GM)
                        {
                            if (C.EntityID != User.EntityID)
                            {
                                continue;
                            }
                        }
[Note] If you do not find this roughly in line 721


Just below the code add:

Code:
if (User.Loc.Map == 1707 && Info.ID == 1045 || User.Loc.Map == 1707 && Info.ID == 1046)
                        {
                            if (User.Luchando == true)
                            {
                                Game.Character J = Game.World.CharacterFromName(User.Enemigo);
                                User.PkPuntos++;
                                User.MyClient.LocalMessage(2011, User.Name + ": " + User.PkPuntos + " points. " + J.Name + ": " + J.PkPuntos + " points");
                                J.MyClient.LocalMessage(2011, User.Name + ": " + User.PkPuntos + " points. " + J.Name + ": " + J.PkPuntos + " points");
                                {
                                    if (User.PkPuntos == 10)
                                    {
                                        Game.World.SendMsgToAll(User.Name, User.Name + " (" + User.PkPuntos + ")" + " has won " + User.Enemigo + " (" + J.PkPuntos + ")" + " in a battle of 1 v 1! The winner has won: " + User.Apuesta + " CPs", 2011, 0);
                                        J.Teleport(1002, 406, 400);
                                        User.Teleport(1002, 399, 400);
                                        User.Protection = false;
                                        J.Protection = false;
                                        User.Luchando = false;
                                        J.Luchando = false;
                                        User.PkPuntos = 0;
                                        J.PkPuntos = 0;
                                        User.Enemigo = "";
                                        J.Enemigo = "";
                                        User.CPs += User.Apuesta;
                                        J.CPs -= User.Apuesta;
                                        Features.GuildWars.Ocupado = false;
                                    }
                                }
                            }
                        }
Now go with the NPC:

In NPCDialog.cs add the next code:


Code:
#region Tourny 1v1
                            case 600565:
                                {
                                    GC.MyChar.PkPuntos = 0;
                                    GC.MyChar.Luchando = false;
                                    {
                                        if (Control == 0)
                                        {
                                            GC.AddSend(Packets.NPCSay("Hello, you want to participate in the 1v1 tournament against the opponent that you want?"));
                                            GC.AddSend(Packets.NPCLink("Yes, i want!", 20));
                                            GC.AddSend(Packets.NPCLink("More information", 10));
                                            GC.AddSend(Packets.NPCLink("No thanks...", 255));
                                            GC.AddSend(Packets.NPCSetFace(50));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        else if (Control == 10)
                                        {
                                            GC.AddSend(Packets.NPCSay("The battle is simple, choose the player you want, and then you will be transported to a map. There you will have to fight to fb and / or ss. Life does not matter, not hos sacareis nothing. A 10 touches."));
                                            GC.AddSend(Packets.NPCLink("I accept", 20));
                                            GC.AddSend(Packets.NPCLink("Ok, bye..", 255));
                                            GC.AddSend(Packets.NPCSetFace(50));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        else if (Control == 20)
                                        {
                                            if (Features.GuildWars.Ocupado == false)
                                            {
                                                if ((GC.MyChar.Equips.RightHand.ID >= 410003 && GC.MyChar.Equips.RightHand.ID <= 421339) || (GC.MyChar.Equips.LeftHand.ID >= 410003 && GC.MyChar.Equips.LeftHand.ID <= 421339))
                                                {
                                                    GC.AddSend(Packets.NPCSay("Enter the bet you want to do with your enemy. For example, if you bet and win 50 fps, 50 fps you rob the opponent. If you lose, the opponent to stay with your CPs."));
                                                    GC.AddSend(Packets.NPCLink("10 CPs", 21));
                                                    GC.AddSend(Packets.NPCLink("20 CPs", 22));
                                                    GC.AddSend(Packets.NPCLink("30 CPs", 23));
                                                    GC.AddSend(Packets.NPCLink("50 CPs", 24));
                                                    GC.AddSend(Packets.NPCLink("100 CPs", 25));
                                                    GC.AddSend(Packets.NPCLink("200 CPs", 26));
                                                    GC.AddSend(Packets.NPCLink("250 CPs", 27));
                                                    GC.AddSend(Packets.NPCLink("Good bye..", 255));
                                                    GC.AddSend(Packets.NPCSetFace(50));
                                                    GC.AddSend(Packets.NPCFinish());
                                                }
                                                else
                                                {
                                                    GC.AddSend(Packets.NPCSay("Sorry, you need Blade, sword or backsword for figt."));
                                                    GC.AddSend(Packets.NPCLink("Oh.. i see..", 255));
                                                    GC.AddSend(Packets.NPCSetFace(50));
                                                    GC.AddSend(Packets.NPCFinish());
                                                }
                                            }
                                            else
                                            {
                                                GC.AddSend(Packets.NPCSay("Sorry, the map is occupied again later!"));
                                                GC.AddSend(Packets.NPCLink("Ok, i wait", 255));
                                                GC.AddSend(Packets.NPCSetFace(50));
                                                GC.AddSend(Packets.NPCFinish());
                                            }
                                        }
                                        else if (Control == 21)
                                        {
                                            GC.MyChar.Apuesta = 10;
                                            GC.AddSend(Packets.NPCSay("Okay, well written enter the opponent's name in the text box. Struggling with he for " + GC.MyChar.Apuesta + " CPs"));
                                            GC.AddSend(Packets.NPCLink2("Name", 2));
                                            GC.AddSend(Packets.NPCLink("Bye guy...", 255));
                                            GC.AddSend(Packets.NPCSetFace(50));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        else if (Control == 22)
                                        {
                                            GC.MyChar.Apuesta = 20;
                                            GC.AddSend(Packets.NPCSay("Okay, well written enter the opponent's name in the text box. Struggling with he for " + GC.MyChar.Apuesta + " CPs"));
                                            GC.AddSend(Packets.NPCLink2("Name", 2));
                                            GC.AddSend(Packets.NPCLink("Bye guy...", 255));
                                            GC.AddSend(Packets.NPCSetFace(50));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        else if (Control == 23)
                                        {
                                            GC.MyChar.Apuesta = 30;
                                            GC.AddSend(Packets.NPCSay("Okay, well written enter the opponent's name in the text box. Struggling with he for " + GC.MyChar.Apuesta + " CPs"));
                                            GC.AddSend(Packets.NPCLink2("Name", 2));
                                            GC.AddSend(Packets.NPCLink("Bye guy...", 255));
                                            GC.AddSend(Packets.NPCSetFace(50));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        else if (Control == 24)
                                        {
                                            GC.MyChar.Apuesta = 50;
                                            GC.AddSend(Packets.NPCSay("Okay, well written enter the opponent's name in the text box. Struggling with he for " + GC.MyChar.Apuesta + " CPs"));
                                            GC.AddSend(Packets.NPCLink2("Name", 2));
                                            GC.AddSend(Packets.NPCLink("Bye guy...", 255));
                                            GC.AddSend(Packets.NPCSetFace(50));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        else if (Control == 25)
                                        {
                                            GC.MyChar.Apuesta = 100;
                                            GC.AddSend(Packets.NPCSay("Okay, well written enter the opponent's name in the text box. Struggling with he for " + GC.MyChar.Apuesta + " CPs"));
                                            GC.AddSend(Packets.NPCLink2("Name", 2));
                                            GC.AddSend(Packets.NPCLink("Bye guy...", 255));
                                            GC.AddSend(Packets.NPCSetFace(50));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        else if (Control == 26)
                                        {
                                            GC.MyChar.Apuesta = 200;
                                            GC.AddSend(Packets.NPCSay("Okay, well written enter the opponent's name in the text box. Struggling with he for " + GC.MyChar.Apuesta + " CPs"));
                                            GC.AddSend(Packets.NPCLink2("Name", 2));
                                            GC.AddSend(Packets.NPCLink("Bye guy...", 255));
                                            GC.AddSend(Packets.NPCSetFace(50));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        else if (Control == 27)
                                        {
                                            GC.MyChar.Apuesta = 250;
                                            GC.AddSend(Packets.NPCSay("Okay, well written enter the opponent's name in the text box. Struggling with he for " + GC.MyChar.Apuesta + " CPs"));
                                            GC.AddSend(Packets.NPCLink2("Name", 2));
                                            GC.AddSend(Packets.NPCLink("Bye guy...", 255));
                                            GC.AddSend(Packets.NPCSetFace(50));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        else if (Control == 1)
                                        {
                                            GC.AddSend(Packets.NPCSay("Okay, well written enter the opponent's name in the text box. Struggling with he for " + GC.MyChar.Apuesta + " CPs"));
                                            GC.AddSend(Packets.NPCLink2("Name", 2));
                                            GC.AddSend(Packets.NPCLink("Bye guy...", 255));
                                            GC.AddSend(Packets.NPCSetFace(50));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        else if (Control == 2)
                                        {

                                            GC.MyChar.Enemigo = ReadString(Data);
                                            {
                                                Game.Character C = Game.World.CharacterFromName(GC.MyChar.Enemigo);
                                                if (C != null && C != GC.MyChar)
                                                {
                                                    if (C.CPs >= GC.MyChar.Apuesta)
                                                    {
                                                        if (C.Loc.Map == 1002)
                                                        {
                                                            GC.AddSend(Packets.NPCSay("Really you want to invite " + GC.MyChar.Enemigo + " ?"));
                                                            GC.AddSend(Packets.NPCLink("Yes!", 3));
                                                            GC.AddSend(Packets.NPCLink("No thanks..", 255));
                                                            GC.AddSend(Packets.NPCSetFace(50));
                                                            GC.AddSend(Packets.NPCFinish());
                                                        }
                                                        else
                                                        {
                                                            GC.AddSend(Packets.NPCSay("The character has to be in Twin City."));
                                                            GC.AddSend(Packets.NPCLink("Uhh ... Let me provide another", 10));
                                                            GC.AddSend(Packets.NPCLink("Ok, then, bye.", 255));
                                                            GC.AddSend(Packets.NPCSetFace(50));
                                                            GC.AddSend(Packets.NPCFinish());
                                                        }
                                                    }
                                                    else
                                                    {
                                                        GC.AddSend(Packets.NPCSay("Elected opponent does not have enough CPs. Choose a better one ..."));
                                                        GC.AddSend(Packets.NPCLink("Uhh ... Let me provide another", 20));
                                                        GC.AddSend(Packets.NPCLink("Ok, bye.", 255));
                                                        GC.AddSend(Packets.NPCSetFace(50));
                                                        GC.AddSend(Packets.NPCFinish());
                                                    }
                                                }
                                                else
                                                {
                                                    GC.AddSend(Packets.NPCSay("I feel the character is not connected or does not exist. Or did you choose yourself as a contender .."));
                                                    GC.AddSend(Packets.NPCLink("Uhh ... Let me provide another", 1));
                                                    GC.AddSend(Packets.NPCLink("Oh, sorry.", 255));
                                                    GC.AddSend(Packets.NPCSetFace(50));
                                                    GC.AddSend(Packets.NPCFinish());
                                                }
                                            }
                                        }
                                        else if (Control == 3)
                                        {
                                            Game.Character C = Game.World.CharacterFromName(GC.MyChar.Enemigo);
                                            {
                                                if ((C.Equips.RightHand.ID >= 410003 && C.Equips.RightHand.ID <= 421339) || (C.Equips.LeftHand.ID >= 410003 && C.Equips.LeftHand.ID <= 421339))
                                                {
                                                    if (C != null && C != GC.MyChar)
                                                    {
                                                        C.Apuesta = GC.MyChar.Apuesta;
                                                        C.Enemigo = GC.MyChar.Name;
                                                        C.MyClient.DialogNPC = 600566;
                                                        PacketHandling.NPCDialog.Handle(C.MyClient, null, 600566, 0);
                                                        C.MyClient.EndSend();
                                                    }
                                                }
                                                else
                                                {
                                                    GC.AddSend(Packets.NPCSay("The opponent who has asked not to have sword or blade, you can not fight with he!"));
                                                    GC.AddSend(Packets.NPCLink("Uhh, let me choise another", 1));
                                                    GC.AddSend(Packets.NPCLink("Oh, bye", 255));
                                                    GC.AddSend(Packets.NPCSetFace(50));
                                                    GC.AddSend(Packets.NPCFinish());
                                                }
                                            }
                                        }
                                    }
                                }
                                break;
                            #endregion
                            #region Tourny 1v1 Checkout
                            case 600566:
                                {
                                    if (Control == 0)
                                    {
                                        Game.Character C = Game.World.CharacterFromName(GC.MyChar.Enemigo);
                                        {
                                            GC.AddSend(Packets.NPCSay(GC.MyChar.Enemigo + " has invited you to play for " + GC.MyChar.Apuesta + " CPs in a 1v1 battle, accept?"));
                                            GC.AddSend(Packets.NPCLink("Yes, i want figth.", 1));
                                            GC.AddSend(Packets.NPCLink("More information of my enemy.", 3));
                                            GC.AddSend(Packets.NPCLink("No thanks", 2));
                                            GC.AddSend(Packets.NPCSetFace(50));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                    }
                                    else if (Control == 1)
                                    {
                                        Game.Character C = Game.World.CharacterFromName(GC.MyChar.Enemigo);
                                        {
                                            GC.MyChar.PkPuntos = 0;
                                            GC.MyChar.Teleport(1707, 52, 43);
                                            Features.GuildWars.Ocupado = true;
                                            Game.World.SendMsgToAll(GC.MyChar.Name, GC.MyChar.Name + " and " + GC.MyChar.Enemigo + " going to fight a battle for " + GC.MyChar.Apuesta + " CPs!", 2011, 0);
                                            C.Teleport(1707, 52, 57);
                                            GC.MyChar.Luchando = true;
                                            C.Luchando = true;
                                            GC.MyChar.Protection = true;
                                            C.Protection = true;
                                        }
                                    }
                                    else if (Control == 2)
                                    {
                                        Game.Character C = Game.World.CharacterFromName(GC.MyChar.Enemigo);
                                        {
                                            GC.MyChar.Enemigo = "";
                                            C.MyClient.DialogNPC = 600567;
                                            PacketHandling.NPCDialog.Handle(C.MyClient, null, 600567, 0);
                                            C.MyClient.EndSend();
                                        }
                                    }
                                    else if (Control == 3)
                                    {
                                        Game.Character C = Game.World.CharacterFromName(GC.MyChar.Enemigo);
                                        {
                                            GC.AddSend(Packets.NPCSay("Información of: " + C.Name + " | Level: " + C.Level + " | Potency: " + C.Potency + " | "));
                                            GC.AddSend(Packets.NPCSay("Max HP: " + C.MaxHP + " | MahMP: " + C.MaxMP + " | Job: " + C.Job + "."));
                                            GC.AddSend(Packets.NPCLink("Ok, i want figth!", 1));
                                            GC.AddSend(Packets.NPCLink("No guy.. bye", 2));
                                            GC.AddSend(Packets.NPCSetFace(50));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                    }
                                }
                                break;

                            #endregion
                            #region Tourny 1v1 rejected
                            case 600567:
                                {
                                    if (Control == 0)
                                    {
                                        GC.MyChar.Enemigo = "";
                                        GC.AddSend(Packets.NPCSay("Your enemy has rejected you"));
                                        GC.AddSend(Packets.NPCLink("Uhh... Ok thanks...", 255));
                                        GC.AddSend(Packets.NPCSetFace(50));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                }
                                break;

                            #endregion

And add this to NPCs.txt in your OldCoDB:

Code:
600565 6520 2 63 1002 429 388
600566 6520 2 63 5000 90 90
600567 6520 2 63 5000 90 90
Good luck to all! =)
02/22/2010 12:37 Decker_#2
Is there a command to start this tourney or is it on a time limit by NPC?
02/22/2010 12:45 .Kob#3
You no need commands... is 24/7 this challenge >.<
02/22/2010 12:49 Arcо#4
Quote:
Originally Posted by Decker_ View Post
Is there a command to start this tourney or is it on a time limit by NPC?
It's not a tourny, its just a 1v1 system.
02/22/2010 14:25 koko425#5
i want acommand to start it
02/22/2010 14:57 [GM]#6
it only teleports the target and don't teleport me and says error in line 12152
which is

C.Teleport(1707, 52, 57);

so what is wrong?

#edit now it works dude u should say its only for normal chars not [PM] / [GM]

and how can i increase the amount of CPs just like 100k not 500 etc.
02/22/2010 15:25 pro4never#7
Interesting, similar idea to the dueling system on my server.

Assuming this one works for 5165 and you made this yourself then good work!

Couple questions though...

#1: Why have a linkback for each betting amount? Why not use an input box to enter a custom amount? Then check both clients to see if they have enough cp and then send a challenge request to the second player with the info entered (Eg: Number of hits to win and amount bet on match)

#2: Why let them challange everyone on the server? It can make for some annoying spam if you get people spamming requests to people who don't want to fight. Personally I used a team system so only the team leader can send a challenge request and only to members of his/her own team.
02/22/2010 15:30 .Kob#8
Quote:
Originally Posted by pro4never View Post
Interesting, similar idea to the dueling system on my server.

Assuming this one works for 5165 and you made this yourself then good work!

Couple questions though...

#1: Why have a linkback for each betting amount? Why not use an input box to enter a custom amount? Then check both clients to see if they have enough cp and then send a challenge request to the second player with the info entered (Eg: Number of hits to win and amount bet on match)

#2: Why let them challange everyone on the server? It can make for some annoying spam if you get people spamming requests to people who don't want to fight. Personally I used a team system so only the team leader can send a challenge request and only to members of his/her own team.

#1: Faster maker >.<'

#2: This can be added :P
02/22/2010 16:26 koko425#9
its not work see

[Only registered and activated users can see links. Click Here To Register...]
02/22/2010 16:35 [GM]#10
Quote:
Originally Posted by koko425 View Post
its not work see

[Only registered and activated users can see links. Click Here To Register...]
it works korolos
don't forget to add[PM]/[GM] or whatever in the player's name
02/22/2010 16:37 .Kob#11
=o Not tested but maybe not work with player's status :S. I think yes :S
02/22/2010 17:14 copz1337#12
isn't working how a 1v1 system is suppose to.. p4n's is the best.
02/22/2010 17:14 Decker_#13
Well when I invite the player he gets teleported and I don't.
How can I fix this?
02/22/2010 17:17 [GM]#14
Quote:
Originally Posted by Decker_ View Post
Well when I invite the player he gets teleported and I don't.
How can I fix this?
look in my post in the first page
02/22/2010 17:20 Decker_#15
What did you do to fix it?