could any one tell me how to fix this error in Program.cs ?
so what i need to change/edit ?
and here is da pic
[Only registered and activated users can see links. Click Here To Register...]
PHP Code:
using System.Threading;
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using NewestCOServer.Game;
namespace NewestCOServer
{
class Program
{
public static void WriteLine(Exception Exc)
{
Console.WriteLine(Exc.ToString());
try
{
if (!System.IO.File.Exists("debug." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + ".txt"))
System.IO.File.Create("debug." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + ".txt").Close();
string Text = System.IO.File.ReadAllText("debug." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + ".txt");
Text += Exc.ToString() + "\r\n";
System.IO.File.WriteAllText("debug." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + ".txt", Text);
}
catch { }
}
public static void WriteLine(string Line)
{
try
{
Console.WriteLine(Line);
if (!System.IO.File.Exists("debug." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + ".txt"))
System.IO.File.Create("debug." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + ".txt").Close();
string Text = System.IO.File.ReadAllText("debug." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + ".txt");
Text += Line + "\r\n";
System.IO.File.WriteAllText("debug." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + ".txt", Text);
}
catch { }
}
public static void WriteLine()
{
try
{
Console.WriteLine();
if (!System.IO.File.Exists("debug." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + ".txt"))
System.IO.File.Create("debug." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + ".txt").Close();
string Text = System.IO.File.ReadAllText("debug." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + ".txt");
Text += "\r\n";
System.IO.File.WriteAllText("debug." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + ".txt", Text);
}
catch { }
}
public static bool EndSession = false;
public static double SaveOldRate = 0;
public static string DropEventType = "";
public static System.Timers.Timer DropEventTimer = null;
public static DateTime SystemMsgTime = new DateTime();
public static Random Rnd = new Random();
public static string ConquerPath;
public static Features.QuizShow.MainInfo MainQuizShowInfo;
static void Main(string[] args)
{
Console.Title = "Newest CO Server";
if (System.IO.Directory.Exists(@"C:\OldCODB"))
{
IniFile I = new IniFile(@"C:\OldCODB\Config.ini");
ConquerPath = I.ReadString("Database", "ConquerPath");
Database.DefaultCoords.Add((ushort)1002, new Game.Vector2() { X = 430, Y = 380 });
Database.DefaultCoords.Add((ushort)1015, new Game.Vector2() { X = 717, Y = 571 });
Database.DefaultCoords.Add((ushort)1000, new Game.Vector2() { X = 500, Y = 650 });
Database.DefaultCoords.Add((ushort)1011, new Game.Vector2() { X = 188, Y = 264 });
Database.DefaultCoords.Add((ushort)1020, new Game.Vector2() { X = 565, Y = 562 });
Database.AddSkills();
Database.LoadItems();
Database.LoadPlusInfo();
Database.LoadRevPoints();
Database.LoadProfExp();
Database.LoadPortals();
Database.LoadLevelExp();
Database.LoadNPCs();
Database.LoadShops();
DropRates.Load();
Database.ReadAllCharacterStats();
Database.LoadKOs();
Features.SkillsClass.Load();
Features.Guilds.LoadGuilds();
DMaps.Load();
Database.LoadMobs();
Database.LoadCompanions();
Features.GuildWars.Init();
MainQuizShowInfo = new Features.QuizShow.MainInfo();
#region Spawns for robot
Game.World.MapDetails = new System.Collections.Hashtable();
Game.MapInfo M = new NewestCOServer.Game.MapInfo();
M.Spawns = new NewestCOServer.Game.Vector2[5];
M.Spawns[0].X = 465;
M.Spawns[0].Y = 462;
M.Spawns[1].X = 604;
M.Spawns[1].Y = 537;
M.Spawns[2].X = 527;
M.Spawns[2].Y = 701;
M.Spawns[3].X = 373;
M.Spawns[3].Y = 634;
M.Spawns[4].X = 141;
M.Spawns[4].Y = 436;
Game.World.MapDetails.Add((ushort)1002, M);
M = new NewestCOServer.Game.MapInfo();
M.Spawns = new NewestCOServer.Game.Vector2[4];
M.Spawns[0].X = 390;
M.Spawns[0].Y = 118;
M.Spawns[1].X = 359;
M.Spawns[1].Y = 284;
M.Spawns[2].X = 590;
M.Spawns[2].Y = 337;
M.Spawns[3].X = 620;
M.Spawns[3].Y = 776;
Game.World.MapDetails.Add((ushort)1011, M);
M = new NewestCOServer.Game.MapInfo();
M.Spawns = new NewestCOServer.Game.Vector2[4];
M.Spawns[0].X = 656;
M.Spawns[0].Y = 635;
M.Spawns[1].X = 500;
M.Spawns[1].Y = 279;
M.Spawns[2].X = 289;
M.Spawns[2].Y = 209;
M.Spawns[3].X = 188;
M.Spawns[3].Y = 457;
Game.World.MapDetails.Add((ushort)1020, M);
M = new NewestCOServer.Game.MapInfo();
M.Spawns = new NewestCOServer.Game.Vector2[4];
M.Spawns[0].X = 606;
M.Spawns[0].Y = 637;
M.Spawns[1].X = 607;
M.Spawns[1].Y = 500;
M.Spawns[2].X = 451;
M.Spawns[2].Y = 358;
M.Spawns[3].X = 186;
M.Spawns[3].Y = 352;
Game.World.MapDetails.Add((ushort)1000, M);
M = new NewestCOServer.Game.MapInfo();
M.Spawns = new NewestCOServer.Game.Vector2[4];
M.Spawns[0].X = 722;
M.Spawns[0].Y = 669;
M.Spawns[1].X = 519;
M.Spawns[1].Y = 710;
M.Spawns[2].X = 514;
M.Spawns[2].Y = 539;
M.Spawns[3].X = 312;
M.Spawns[3].Y = 572;
Game.World.MapDetails.Add((ushort)1015, M);
M = new NewestCOServer.Game.MapInfo();
M.Spawns = new NewestCOServer.Game.Vector2[4];
M.Spawns[0].X = 328;
M.Spawns[0].Y = 616;
M.Spawns[1].X = 338;
M.Spawns[1].Y = 438;
M.Spawns[2].X = 102;
M.Spawns[2].Y = 297;
M.Spawns[3].X = 352;
M.Spawns[3].Y = 286;
Game.World.MapDetails.Add((ushort)1001, M);
#endregion
NewestCOServer.Main.AuthWorker.StartServer(I.ReadString("Database", "GameServerIP"));
NewestCOServer.Main.GameWorker.StartServer();
Database.LoadLottoItems();
Program.WriteLine();
Program.WriteLine("The server is ready for connections.");
Program.WriteLine("Always close the server by pressing Enter, or the important data wont't save.");
Database.LoadQuestions();
Database.CreateEquipsDrops();
Database.LoadEmpire();
MyThread CompanionThread = new MyThread();
CompanionThread.Execute += new Execute(CompanionThread_Execute);
CompanionThread.Start(100);
MyThread ServerStuff = new MyThread();
ServerStuff.Execute += new Execute(ServerStuff_Execute);
ServerStuff.Start(100);
MyThread MobThread = new MyThread();
MobThread.Execute += new Execute(MobThread_Execute);
MobThread.Start(100);
World.MobsStart = true;
while (true)
{
string Command = Console.ReadLine();
string[] Cmd = Command.Split(' ');
if (Command == "")
{
Console.ReadLine();
}
if (Cmd[0] == "/restart")
{
Game.Character[] BaseCharacters = new Character[World.H_Chars.Count];
World.H_Chars.Values.CopyTo(BaseCharacters, 0);
NewestCOServer.Main.AuthWorker.Listener.Close();
NewestCOServer.Main.GameWorker.Listener.Close();
EndSession = true;
try
{
foreach (Game.Character C in BaseCharacters)
{
try
{
C.MyClient.Disconnect();
Console.WriteLine(C.Name + " has logged off successfuly.");
}
catch { continue; }
}
}
catch { }
Database.SaveKOs();
Console.WriteLine("KOs saved.");
Database.SaveEmpire();
Console.WriteLine("Empire saved.");
Features.Guilds.SaveGuilds();
Console.WriteLine("Guilds saved.");
Features.SkillsClass.Save();
Console.WriteLine("Skills saved.");
MobThread.Close();
ServerStuff.Close();
CompanionThread.Close();
Database.Dispose();
Console.WriteLine("Database disposed.");
Console.WriteLine("Write /exit or click X to close the window.");
System.Diagnostics.Process.Start("NewestCOServer.exe");
}
if (Cmd[0] == "/exit")
{
Game.Character[] BaseCharacters = new Character[World.H_Chars.Count];
World.H_Chars.Values.CopyTo(BaseCharacters, 0);
NewestCOServer.Main.AuthWorker.Listener.Close();
NewestCOServer.Main.GameWorker.Listener.Close();
EndSession = true;
try
{
foreach (Game.Character C in BaseCharacters)
{
try
{
C.MyClient.Disconnect();
Console.WriteLine(C.Name + " has logged off successfuly.");
}
catch { continue; }
}
}
catch { }
Database.SaveKOs();
Console.WriteLine("KOs saved.");
Database.SaveEmpire();
Console.WriteLine("Empire saved.");
Features.Guilds.SaveGuilds();
Console.WriteLine("Guilds saved.");
Features.SkillsClass.Save();
Console.WriteLine("Skills saved.");
MobThread.Close();
ServerStuff.Close();
CompanionThread.Close();
Database.Dispose();
Console.WriteLine("Database disposed.");
Console.WriteLine("Click X to close the window.");
}
if (Cmd[0] == "/expballs")
Database.ExpBallReset();
if (Cmd[0] == "/expballs2")
Database.ExpBallReset();
if (Cmd[0] == "/clear")
Console.Clear();
if (Cmd[0] == "/newacc" && Cmd.Length > 2)
{
if (Cmd.Length == 3)
Database.CreateAccount(Cmd[1], Cmd[2], "");
else
Database.CreateAccount(Cmd[1], Cmd[2], Cmd[3]);
}
if (Cmd[0] == "/skilladder")
{
Extra.SkillAdder E = new NewestCOServer.Extra.SkillAdder();
System.Windows.Forms.Application.Run(E);
}
if (Cmd[0] == "/characters")
{
Form1 E = new Form1();
System.Windows.Forms.Application.Run(E);
}
if (Cmd[0] == "/accounts")
{
Form2 E = new Form2();
System.Windows.Forms.Application.Run(E);
}
}
}
else
{
Program.WriteLine("The database folder doesn't exist, cannot start the server.");
Console.ReadLine();
}
}
static void MobThread_Execute()
{
try
{
if (World.H_Chars.Count > 0)
{
try
{
foreach (Hashtable H in Game.World.H_Mobs.Values)
{
foreach (Mob M in H.Values)
{
M.Step();
if (M.PoisonedInfo != null)
{
if (DateTime.Now > M.PoisonedInfo.LastAttack.AddSeconds(3))
{
if (M.CurrentHP == 1)
{
M.PoisonedInfo = null;
foreach (Game.Character C in Game.World.H_Chars.Values)
if (M.Loc.Map == C.Loc.Map)
if (MyMath.PointDistance(M.Loc.X, M.Loc.Y, C.Loc.X, C.Loc.Y) <= 20)
C.MyClient.AddSend(Packets.Status(M.EntityID, NewestCOServer.Game.Status.Effect, 0));
continue;
}
M.PoisonedInfo.Times--;
M.PoisonedInfo.LastAttack = DateTime.Now;
uint Dmg = (uint)(M.CurrentHP * (10 + M.PoisonedInfo.SpellLevel * 10) / 100);
if (Dmg == 1)
continue;
M.TakeAttack(M, Dmg, AttackType.Melee);
if (M.PoisonedInfo.Times == 0)
{
M.PoisonedInfo = null;
foreach (Game.Character C in Game.World.H_Chars.Values)
if (M.Loc.Map == C.Loc.Map)
if (MyMath.PointDistance(M.Loc.X, M.Loc.Y, C.Loc.X, C.Loc.Y) <= 20)
C.MyClient.AddSend(Packets.Status(M.EntityID, NewestCOServer.Game.Status.Effect, 0));
}
}
}
}
}
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
static bool ExpBallClear = false;
static void ServerStuff_Execute()
{
try
{
if (DateTime.Now > SystemMsgTime.AddMinutes(1))
{
Handle_Events();
SystemMsgTime = DateTime.Now;
}
if (World.BroadCastCount > 0 && DateTime.Now > World.LastBroadCast.AddMinutes(1))
{
BroadCastMessage B = World.BroadCasts[0];
for (int i = 0; i < World.BroadCastCount; i++)
World.BroadCasts[i] = World.BroadCasts[i + 1];
World.BroadCastCount--;
World.SendMsgToAll(B.Name, B.Message, 2500, 0);
World.LastBroadCast = DateTime.Now;
World.CurrentBC = B;
}
}
catch { }
try
{
foreach (Hashtable H in World.H_Items.Values)
{
ArrayList Deleted = new ArrayList();
try
{
foreach (DroppedItem I in H.Values)
if (DateTime.Now > I.DropTime.AddSeconds(60))
Deleted.Add(I);
foreach (DroppedItem I in Deleted)
I.Dissappear();
}
catch { }
}
}
catch { }
try
{
//if (!Features.GuildWars.War && DateTime.Now.Minute == 0 && Database.GWOn.Contains(DateTime.Now.Hour))
// Features.GuildWars.StartWar();
}
catch { }
try
{
//if (Features.GuildWars.War && DateTime.Now > Features.GuildWars.LastScores.AddSeconds(5))
// Features.GuildWars.SendScores();
}
catch { }
try
{
if (DateTime.Now.Hour == 0 && !ExpBallClear)
{
Database.ExpBallReset();
ExpBallClear = true;
}
if (ExpBallClear && DateTime.Now.Hour == 1)
ExpBallClear = false;
}
catch { }
}
static void Handle_Events()
{
switch (DateTime.Now.Minute)
{
case 7:
case 8:
Game.World.SendMsgToAll("GM", "GMs have [GM] or [PM] at the end of their names. Don`t trust anyone claiming to be a GM but not having [GM]/[PM] in their names.", 2011, 0);
break;
case 19:
case 20:
Game.World.SendMsgToAll("GM", "File account problems and TQ Point Card purchase problems at SUPPORT on the official site.", 2011, 0);
break;
case 31:
case 32:
Game.World.SendMsgToAll("GM", "Help UnknownMan at Market (212,204) to level up quickly.", 2011, 0);
break;
case 43:
case 44:
Game.World.SendMsgToAll("GM", "Trading of game accounts is illegal and may result in the instant banning of the accounts involved in the trading.", 2011, 0);
break;
case 55:
case 56:
Game.World.SendMsgToAll("GM", "co.91.com is the only official website of CO, which is also the only website where you can purchase Dragonballs.", 2011, 0);
break;
default:
break;
}
}
static void CompanionThread_Execute()
{
try
{
if (World.H_Chars.Count > 0)
{
foreach (Companion C in World.H_Companions.Values)
try
{
C.Step();
}
catch { }
}
}
catch { }
}
public static void QuestDropDone(object source, System.Timers.ElapsedEventArgs e)
{
try
{
if (DropEventTimer != null)
{
if (DropEventType == "dragonball")
DropRates.DragonBall = SaveOldRate;
else if (DropEventType == "meteor")
DropRates.Meteor = SaveOldRate;
else if (DropEventType == "minicpbag")
DropRates.CPMiniBag = SaveOldRate;
else if (DropEventType == "cpbag")
DropRates.CPBag = SaveOldRate;
Game.World.SendMsgToAll("Server", "Drop " + DropEventType + "s event ended.", 2001, 0);
DropEventType = ""; SaveOldRate = 0;
DropEventTimer.Stop();
DropEventTimer.Close();
DropEventTimer = null;
try
{
if (DateTime.Now > Features.DMScore.LastScores.AddSeconds(1))
Features.DMScore.SendScores();
}
catch { }
}
}
} <<<<<<<<<<<<< im getting error here in this mark }
and here is da pic
[Only registered and activated users can see links. Click Here To Register...]