[Release]GuildWar LOTF

04/02/2010 05:28 Fish*#1
I will give you the release of a fixed GW (Some how) for LOTF 5017.

First open World.cs then search for:
PHP Code:
        public static Hashtable GWScores = new Hashtable(); 
under that paste:
PHP Code:
        public static bool GW = false; 
Now open general.cs
Search for:
PHP Code:
Thetimer = new System.Timers.Timer(); 
And under the code paste:
PHP Code:
                System.Timers.Timer cTimer = new System.Timers.Timer(1000.0);
                
cTimer.Start();
                
cTimer.Elapsed += delegate { GuildWar(); };
                
System.Timers.Timer BTimer = new System.Timers.Timer(1000.0);
                
BTimer.Start();
                
BTimer.Elapsed += delegate { GuildWarEnd(); }; 
Now search for (Still in general.cs):
PHP Code:
public static void DoStuff() 
And above that paste:
PHP Code:
        public static void GuildWar()
        {
            if (
DateTime.Now.Minute == 00)
            {
                
World.GW = true;
                
World.SendMsgToAll("There is GuildWar, hurry up to enter.", "SYSTEM", 2011);
            }
        }

        public static 
void GuildWarEnd()
        {
            foreach (
DictionaryEntry DE in World.AllChars)
            {
                
Character Char = (Character)DE.Value;

                if (
DateTime.Now.Minute == 25 && World.Gw == true)
                {
                    
World.GW = false;
                    
World.SendMsgToAll("GuildWar has auto ended.", "SYSTEM", 2011);
                }
            }
        } 
Now the NPC (Thanks to PeTe Ninja for the random thing)
Search for:
PHP Code:
if (CurrentNPC == 600) 
Replace the whole code with:
PHP Code:
                            if (CurrentNPC == 600) //Guild Controller
                            
{
                                if (
World.GW == true)
                                {
                                    
SendPacket(General.MyPackets.NPCSay("Would you like to enter GuildWars?"));
                                    
SendPacket(General.MyPackets.NPCLink("Oh Yes Please!", 1));
                                    
SendPacket(General.MyPackets.NPCLink("We have won and im GL, so i want the prize!", 2));
                                    
SendPacket(General.MyPackets.NPCLink("No No No, It's Too Scary!", 255));
                                    
SendPacket(General.MyPackets.NPCSetFace(30));
                                    
SendPacket(General.MyPackets.NPCFinish());
                                }
                                else
                                {
                                    
SendPacket(General.MyPackets.NPCSay("GuildWar has not started, sorry or either is too late to join."));
                                    
SendPacket(General.MyPackets.NPCLink("We have won and im GL, so i want the prize!", 2));
                                    
SendPacket(General.MyPackets.NPCLink("Okay sorry.", 255));
                                    
SendPacket(General.MyPackets.NPCSetFace(30));
                                    
SendPacket(General.MyPackets.NPCFinish());
                                }
                            } 
Now the control
Search for:
PHP Code:
if (MyChar.MyGuild != null && MyChar.MyGuild == World.PoleHolder 
Replace the whole NPC code with:
PHP Code:
                            if (CurrentNPC == 600)
                            {
                                if (
Control == 1)
                                {
                                    
Random R = new Random();
                                    
int Nr = R.Next(1, 10);
                                    if (
Nr == 1) //Random Spot 1
                                    
{
                                        
MyChar.Teleport(1038, 351, 341);
                                    }
                                    if (
Nr == 2) //Random Spot 2
                                    
{
                                        
MyChar.Teleport(1038, 335, 345);
                                    }
                                    if (
Nr == 3) //Random Spot 3
                                    
{
                                        
MyChar.Teleport(1038, 309, 369);
                                    }
                                    if (
Nr == 4) //Random Spot 4
                                    
{
                                        
MyChar.Teleport(1038, 283, 340);
                                    }
                                    if (
Nr == 5) //Random Spot 5
                                    
{
                                        
MyChar.Teleport(1038, 310, 327);
                                    }
                                    if (
Nr == 6) //Random Spot 6
                                    
{
                                        
MyChar.Teleport(1038, 318, 297);
                                    }
                                    if (
Nr == 7) //Random Spot 7
                                    
{
                                        
MyChar.Teleport(1038, 347, 309);
                                    }
                                    if (
Nr == 8) //Random Spot 8
                                    
{
                                        
MyChar.Teleport(1038, 337, 320);
                                    }
                                    if (
Nr == 9) //Random Spot 9
                                    
{
                                        
MyChar.Teleport(1038, 309, 293);
                                    }
                                    if (
Nr == 10) //Random Spot 10
                                    
{
                                        
MyChar.Teleport(1038, 371, 300);
                                    }
                                }
                                if (
Control == 2)
                                {
                                    if (
MyChar.MyGuild != null && MyChar.MyGuild == World.PoleHolder && MyChar.GuildPosition == 100 && !MyChar.MyGuild.ClaimedPrize && MyChar.ItemsInInventory < 40)
                                    {
                                        
MyChar.AddItem("1088000-0-0-0-0-0", 0, (uint)General.Rand.Next(346623472)); //LOL a dragonball
                                        
MyChar.MyGuild.ClaimedPrize = true;
                                    }
                                    else
                                    {
                                        
SendPacket(General.MyPackets.NPCSay("Either the prize has been taken already, your guild has not been victorious the last time or you are not a deputy leader nor guild leader."));
                                        
SendPacket(General.MyPackets.NPCLink("Ok.", 255));
                                        
SendPacket(General.MyPackets.NPCSetFace(30));
                                        
SendPacket(General.MyPackets.NPCFinish());
                                    }
                                }
                            } 
Now open Entities.cs
and search for:
PHP Code:
                    foreach (DictionaryEntry DE in Guilds.AllGuilds)
                    {
                        
Guild AGuild = (Guild)DE.Value;
                        
AGuild.HoldingPole = false;
                        
AGuild.ClaimedPrize = false;
                        if (
AGuild.PoleDamaged > Highest) 
Replace from
PHP Code:
                    foreach (DictionaryEntry DE in Guilds.AllGuilds) 
to
PHP Code:
                    Attacker.Attacking = false;
                } 
With this:
PHP Code:
                    foreach (DictionaryEntry DE in Guilds.AllGuilds)
                    {
                        
Guild AGuild = (Guild)DE.Value;
                        
AGuild.HoldingPole = false;
                        
AGuild.ClaimedPrize = false;
                        if (
AGuild.PoleDamaged > Highest)
                        {
                            
Highest = AGuild.PoleDamaged;
                            
Winner = AGuild;
                        }
                        
AGuild.PoleDamaged = 0;
                    }
                    if (
Winner != null && World.GW == true)
                    {
                        
Winner.HoldingPole = true;
                        
World.GW = false;
                        
World.PoleHolder = Winner;
                        
World.SendMsgToAll(Winner.GuildName + " has won the guildwar! The GuildLeader can now go take his/hers Dragonball.", "SYSTEM", 2011);
                        
World.SendMsgToAll("GuildWar has ended. The pole can't be taken, either if you hit it down. No entry allowed to GW.", "SYSTEM", 2005);
                    }
                    
World.GWScores.Clear();
                    
Attacker.TGTarget = null;
                    
Attacker.Attacking = false;
                } 
Thats it ;)

Note:
Code:
The GuildWar Starts XX:00 Every Hour and AutoEnds XX:25
Also the GW Ends, if you hit down the pole :)
Press thansk if i helped :)

@Dont ask if i release my other tournaments ^^
04/02/2010 13:42 PeTe Ninja#2
grillmad do u have as erver?
04/02/2010 14:04 Fish*#3
Quote:
Originally Posted by PeTe Ninja View Post
grillmad do u have as erver?
Yupsi XD is my friends, but i help him with coding lol ^^ will buy host next week, right now is hamachi shit:mofo:
04/03/2010 02:10 PeTe Ninja#4
Quote:
Originally Posted by grillmad View Post
Yupsi XD is my friends, but i help him with coding lol ^^ will buy host next week, right now is hamachi shit:mofo:
wish it was a level server.
07/12/2010 18:28 irritantgassie#5
nice release,
For CoMy users:

World.GW = true;

Must be

World.GWOn = true;

and

World.GW = false;

with:
World.GWOn = false;
07/13/2010 05:36 Fish*#6
nope, cuz the bools are used in my code other places ;)
if u use comy, remove the gw code for comy :D
07/13/2010 12:02 irritantgassie#7
Quote:
Originally Posted by grillmad View Post
nope, cuz the bools are used in my code other places ;)
if u use comy, remove the gw code for comy :D
That didnt work, I tried everything, it starts but it doesnt end when I hit down the pole!
07/13/2010 14:04 Fish*#8
This should be the fixed. Problem was at last part.
Please make sure somethings as Locmap etc. will make error.
I dont remember the exactly code.
Code:
                    foreach (DictionaryEntry DE in Guilds.AllGuilds)
                    {
                        Guild AGuild = (Guild)DE.Value;
                        AGuild.HoldingPole = false;
                        AGuild.ClaimedPrize = false;
                        if (AGuild.PoleDamaged > Highest)
                        {
                            Highest = AGuild.PoleDamaged;
                            Winner = AGuild;
                        }
                        AGuild.PoleDamaged = 0;
                    }
                    if (Winner != null && World.GW == true)
                    {
            foreach (DictionaryEntry DE in World.AllChars)
            {
                Character Char = (Character)DE.Value;
if (Char.LocMap == 1038)
{
Char.Teleport(1002, 400, 400);
}
                        Winner.HoldingPole = true;
                        World.GW = false;
                        World.PoleHolder = Winner;
                        World.SendMsgToAll(Winner.GuildName + " has won the guildwar! The GuildLeader can now go take his/hers Dragonball.", "SYSTEM", 2011);
                        World.SendMsgToAll("GuildWar has ended. The pole can't be taken, either if you hit it down. No entry allowed to GW.", "SYSTEM", 2005);
                    }
                 }
                    World.GWScores.Clear();
                    Attacker.TGTarget = null;
                    Attacker.Attacking = false;
                }