using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NewestCOServer.Game;
namespace NewestCOServer.Features
{
public class GuildWars
{
public class GWScore
{
public Guild TheGuild;
public uint Score;
}
public struct Pole
{
public Location Loc;
public uint MaxHP;
public uint CurHP;
public uint Mesh;
public uint EntityID;
public bool Opened
{
set
{
if (EntityID == 6701)//Left Gate
{
if (value) Mesh = 250;
else Mesh = 240;
}
else if (EntityID == 6702)//Right Gate
{
if (value) Mesh = 280;
else Mesh = 270;
}
}
get
{
if (EntityID == 6701)//Left Gate
{
if (Mesh == 250) return true;
else return false;
}
else if (EntityID == 6702)//Right Gate
{
if (Mesh == 280) return true;
else return false;
}
return false;
}
}
public void Spawn(Character C, bool Check)
{
if (C.Loc.Map == Loc.Map && MyMath.InBox(C.Loc.X, C.Loc.Y, Loc.X, Loc.Y, 16) && (!MyMath.InBox(C.Loc.PreviousX, C.Loc.PreviousY, Loc.X, Loc.Y, 16) || !Check))
C.MyClient.AddSend(Packets.SpawnNPCWithHP(EntityID , (ushort)Mesh, 26, Loc, true, "Gate", CurHP, MaxHP));
}
public void ReSpawn()
{
foreach (Character C in World.H_Chars.Values)
if (C.Loc.Map == Loc.Map && MyMath.InBox(C.Loc.X, C.Loc.Y, Loc.X, Loc.Y, 16))
C.MyClient.AddSend(Packets.SpawnNPCWithHP(EntityID , (ushort)Mesh, 26, Loc, true, "Gate", CurHP, MaxHP));
}
public void TakeAttack(Character C, uint Damage, byte AtkType)
{
if (AtkType != 21)
World.Action(C, Packets.AttackPacket(C.EntityID, EntityID, Loc.X, Loc.Y, Damage, AtkType).Get);
if (Damage >= CurHP)
{
C.AtkMem.Attacking = false;
C.AtkMem.Target = 0;
World.Action(C, Packets.AttackPacket(C.EntityID, EntityID, Loc.X, Loc.Y, 0, 14).Get);
Opened = true;
ReSpawn();
}
else
CurHP -= Damage;
}
}
public static Pole ThePole;
public static Gate TheLeftGate;
public static Gate TheRightGate;
public static bool War;
public static Hashtable Scores;
public static DateTime LastScores;
public static Guild LastWinner;
public static bool DuelAreaFree; // 1v1
public static bool Ocupado; // 1v1
public static void Init()
{
War = false;
Scores = new Hashtable();
LastScores = DateTime.Now;
TheRightGate = new Gate();
TheRightGate.EntityID = 6702;
TheRightGate.Opened = false;
TheRightGate.MaxHP = 10000000;
TheRightGate.CurHP = 10000000;
TheRightGate.Loc = new Location();
TheRightGate.Loc.Map = 1038;
TheRightGate.Loc.X = 222;
TheRightGate.Loc.Y = 177;
TheRightGate.ReSpawn();
}
public static void AddScore(Guild G, uint Points)
{
if (!Scores.Contains(G.GuildID))
{
GWScore S = new GWScore();
S.Score = Points;
S.TheGuild = G;
Scores.Add(G.GuildID, S);
}
else
{
GWScore S = (GWScore)Scores[G.GuildID];
S.Score += Points;
}
}
public static string[] ShuffleGuildScores()
{
try
{
string[] ret = new string[5];
DictionaryEntry[] Vals = new DictionaryEntry[5];
for (sbyte i = 0; i < 5; i++)
{
Vals[i] = new DictionaryEntry();
Vals[i].Key = (ushort)0;
Vals[i].Value = (uint)0;
}
foreach (DictionaryEntry Score in Scores)
{
sbyte Pos = -1;
for (sbyte i = 0; i < 5; i++)
{
//if (((GWScore)Score.Value).Score > (uint)Vals[i].Value)
if ((uint)Score.Value > (uint)Vals[i].Value) This is my line 219
{
Pos = i;
break;
}
}
if (Pos == -1)
continue;
for (sbyte i = 4; i > Pos; i--)
Vals[i] = Vals[i - 1];
Vals[Pos] = Score;
}
for (sbyte i = 0; i < 5; i++)
{
if ((ushort)Vals[i].Key == 0)
{
ret[i] = "";
continue;
}
Features.Guild eGuild = (Features.Guild)Features.Guilds.AllTheGuilds[(ushort)Vals[i].Key];
ret[i] = "No " + (i + 1).ToString() + ": " + eGuild.GuildName + "(" + ((GWScore)Vals[i].Value).Score + ")";
}
5165 mob error. 07/20/2011 - CO2 Private Server - 2 Replies I've screwed up with the /spawn command. I've made a spawn in tc that extends outside of the maps areas. Now, it won't let me run the server, it just keeps saying loading mobs. Any ideas on how to fix it?
[Release] GuildWar {5165} 10/25/2010 - CO2 PServer Guides & Releases - 3 Replies Hello everybody! I Decided to Give you some informations about the GW.. GW Pole and a little release about the gw ending , I was searching for posts around and the "/endgw" command isnt very right since the void is not for the cmd.
1st Changing Pole HP
*Search for public static void Init() in Features>GuildWars.cs
- There you gonna find
ThePole.CurHP = 20000000; and ThePole.MaxHP = 20000000; Change both to whatever you think is right....
2nd How to make GW Re-Start after the pole has...
5165 Error! 03/04/2010 - CO2 Private Server - 4 Replies I followed Korvacs guide to run a 5165 server on Windows 7. Afterwards I tried to run the server, it got to the point where it says "Dmaps loaded successfully in 208 milliseconds"
At that point it will go back to Visual C# and highlight
In DMap.cs line 124
I need help.
5165 Error X_X 02/20/2010 - CO2 Private Server - 1 Replies Aite since i like aint a decent coder, I got a error on ma source
The name 'Skill' does not exist in this current context
It was for the Reflect Fix Release,
for (int n = 0; n < 5; n++)
{
BW.Write((byte)0);//WH Count
how i fix this error in c# 5165 01/16/2010 - CO2 Private Server - 15 Replies how i fix this error
http://img85.imageshack.us/img85/1940/48502865.jp g