[Guide] How to Create a Graphic User Interface (GUI)
Discussion on [Guide] How to Create a Graphic User Interface (GUI) within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.
It doesn't matter, if you do that or the other part. Only that it's easier.
It's really just about preference and the use of the timer. In this case, I have it separate because the print line method is useless unless the GUI is loaded. If you want to code one like that, that's your preference- this guide is just a bunch of examples that I threw together.
It's really just about preference and the use of the timer. In this case, I have it separate because the print line method is useless unless the GUI is loaded. If you want to code one like that, that's your preference- this guide is just a bunch of examples that I threw together.
It won't start, before the GUI is initialized anyways. Unless you're loading a lot things for your GUI. And yea, I just said it could be used as well. Lazyness ftw.
It won't start, before the GUI is initialized anyways. Unless you're loading a lot things for your GUI. And yea, I just said it could be used as well. Lazyness ftw.
I've experienced problems doing it your way- that's why I started doing it the way I showed in the thread. It's just safer. There are more appropriate times to do it in your way- but if you don't want to lose your heading from time to time (when your gui gets more advanced), you should try my way of doing it.
using System;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Conquer_Online_Server.Network;
using Conquer_Online_Server.Database;
using Conquer_Online_Server.Network.Sockets;
using Conquer_Online_Server.Network.AuthPackets;
using Conquer_Online_Server.Game.ConquerStructures.Socie ty;
using Conquer_Online_Server.Game;
using System.Collections.Generic;
using System.Drawing;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace Conquer_Online_Server
{
class Program
{
public static void WriteLine(object text) { Applications.Output.WriteLine(text.ToString() + "\n"); }
public static int PlayerCap = 400;
public static AsyncSocket AuthServer;
public static AsyncSocket GameServer;
public static ServerBase.Counter EntityUID;
public static string GameIP;
public static DayOfWeek Today;
public static ushort GamePort;
public static ushort AuthPort;
public static DateTime StartDate;
public static DateTime RestartDate = DateTime.Now.AddHours(24);
public static DateTime SaveDate = DateTime.Now.AddSeconds(2);
public static ServerBase.Thread StatusFlagChange = new Conquer_Online_Server.ServerBase.Thread(500);
public static ServerBase.Thread CharacterThread = new ServerBase.Thread(1000);
public static ServerBase.Thread AttackThread = new ServerBase.Thread(800);
public static ServerBase.Thread CompanionThread = new Conquer_Online_Server.ServerBase.Thread(1000);
public static ServerBase.Thread BlessThread = new ServerBase.Thread(4000);
public static ServerBase.Thread ServerStuff = new ServerBase.Thread(500);
public static ServerBase.Thread ArenaSystem = new Conquer_Online_Server.ServerBase.Thread(2000);
public static Client.GameState[] Values = null;
[MTAThread]
static void Main(string[] args)
{
Thread outputThread = new Thread(new ThreadStart(LoadOutput));
outputThread.Priority = ThreadPriority.Lowest;
outputThread.Start();
//Application.ThreadException += Application_ThreadException;
// Application.Run(new NotForPublicNotAtAll.NoCrash());
}
protected static void LoadOutput()
{
Application.Run(new Applications.Output());
}
//static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
//{
// SaveException(e.Exception);
//}
public static void SaveException(Exception e)
{
if (e.TargetSite.Name == "ThrowInvalidOperationException")
return;
Program.WriteLine(e);
var dt = DateTime.Now;
string date = dt.Month + "-" + dt.Day + "//";
if (!Directory.Exists(Application.StartupPath + ServerBase.Constants.UnhandledExceptionsPath))
Directory.CreateDirectory(Application.StartupPath + "\\" + ServerBase.Constants.UnhandledExceptionsPath);
if (!Directory.Exists(Application.StartupPath + "\\" + ServerBase.Constants.UnhandledExceptionsPath + date))
Directory.CreateDirectory(Application.StartupPath + "\\" + ServerBase.Constants.UnhandledExceptionsPath + date);
if (!Directory.Exists(Application.StartupPath + "\\" + ServerBase.Constants.UnhandledExceptionsPath + date + e.TargetSite.Name))
Directory.CreateDirectory(Application.StartupPath + "\\" + ServerBase.Constants.UnhandledExceptionsPath + date + e.TargetSite.Name);
Lines.Add("----Exception message----");
Lines.Add(e.Message);
Lines.Add("----End of exception message----\r\n");
Lines.Add("----Stack trace----");
Lines.Add(e.StackTrace);
Lines.Add("----End of stack trace----\r\n");
//Lines.Add("----Data from exception----");
//foreach (KeyValuePair<object, object> data in e.Data)
// Lines.Add(data.Key.ToString() + "->" + data.Value.ToString());
//Lines.Add("----End of data from exception----\r\n");
//public static void StartEngine()
//{
// EngineThread_Execute();
//}
public static int RandomSeed = 0;
static void EngineThread_Execute()
{
Time32 Start = Time32.Now;
RandomSeed = Convert.ToInt32(DateTime.Now.Ticks.ToString().Remo ve(DateTime.Now.Ticks.ToString().Length / 2));
ServerBase.Kernel.Random = new Random(RandomSeed);
StartDate = DateTime.Now;
//Console.Title = "Conquer Online Server Emulator. Start time: " + StartDate.ToString("dd MM yyyy hh:mm"); Console.BackgroundColor = ConsoleColor.Green;
Console.ForegroundColor = ConsoleColor.DarkRed;
Program.WriteLine("-- This source has been writen by Bagu Alexandru. --");
Program.WriteLine("-- Copyright (c) Bagu Alexandru 2008-2010. --");
Program.WriteLine("-- Source created with the help of all mighty God.--");
//Console.BackgroundColor = ConsoleColor.Black;
//Console.ForegroundColor = ConsoleColor.White;
Program.WriteLine("Load server configuration! !");
string ConfigFileName = "configuration.ini";
ServerBase.IniFile IniFile = new ServerBase.IniFile(ConfigFileName);
/* if (Environment.UserName.ToLower().Contains("impulse" ))
{
GameIP = "192.168.1.101";
GamePort = IniFile.ReadUInt16("Configuration", "GamePort");
AuthPort = IniFile.ReadUInt16("Configuration", "AuthPort");
ServerBase.Constants.ServerName = IniFile.ReadString("Configuration", "ServerName");
Database.DataHolder.CreateConnection("root", "123456", IniFile.ReadString("MySql", "Database"), "localhost");
}*/
// else
{
GameIP = IniFile.ReadString("configuration", "IP");
GamePort = IniFile.ReadUInt16("configuration", "GamePort");
AuthPort = IniFile.ReadUInt16("configuration", "AuthPort");
ServerBase.Constants.ServerName = IniFile.ReadString("configuration", "ServerName");
Database.DataHolder.CreateConnection(IniFile.ReadS tring("MySql", "Username"), IniFile.ReadString("MySql", "Password"), IniFile.ReadString("MySql", "Database"), IniFile.ReadString("MySql", "Host"));
}
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("conf iguration").Where("Server", ServerBase.Constants.ServerName);
MySqlReader r = new MySqlReader(cmd);
if (r.Read())
{
EntityUID = new ServerBase.Counter(r.ReadUInt32("EntityID"));
Game.ConquerStructures.Society.Guild.GuildCounter = new Conquer_Online_Server.ServerBase.Counter(r.ReadUIn t32("GuildID"));
Network.GamePackets.ConquerItem.ItemUID = new Conquer_Online_Server.ServerBase.Counter(r.ReadUIn t32("ItemUID"));
ServerBase.Constants.ExtraExperienceRate = r.ReadUInt32("ExperienceRate");
ServerBase.Constants.ExtraSpellRate = r.ReadUInt32("ProficiencyExperienceRate");
ServerBase.Constants.ExtraProficiencyRate = r.ReadUInt32("SpellExperienceRate");
ServerBase.Constants.MoneyDropRate = r.ReadUInt32("MoneyDropRate");
ServerBase.Constants.MoneyDropMultiple = r.ReadUInt32("MoneyDropMultiple");
ServerBase.Constants.ConquerPointsDropRate = r.ReadUInt32("ConquerPointsDropRate");
ServerBase.Constants.ConquerPointsDropMultiple = r.ReadUInt32("ConquerPointsDropMultiple");
ServerBase.Constants.ItemDropRate = r.ReadUInt32("ItemDropRate");
ServerBase.Constants.ItemDropQualityRates = r.ReadString("ItemDropQualityString").Split('~');
ServerBase.Constants.WebAccExt = r.ReadString("AccountWebExt");
ServerBase.Constants.WebVoteExt = r.ReadString("VoteWebExt");
ServerBase.Constants.WebDonateExt = r.ReadString("DonateWebExt");
ServerBase.Constants.ServerWebsite = r.ReadString("ServerWebsite");
PlayerCap = r.ReadInt32("PlayerCap");
}
r.Close();
if (EntityUID.Now == 0) // i fixed the bug, now it shows what it's supposed to, you have database problems
{
Console.Clear();
Program.WriteLine("Database error. Please check your MySQL. Server will now close.");
return;
}
Program.WriteLine("Initializing database.");
Database.ConquerItemInformation.Load();
Database.DataHolder.ReadStats();
Database.MonsterInformation.Load();
Database.SpellTable.Load();
Database.ShopFile.Load();
Database.MapsTable.Load();
Database.NobilityTable.Load();
Database.ArenaTable.Load();
Database.GuildTable.Load();
Database.ClanTable.LoadAllClans();
Database.LotteryTable.Load();
Database.DMaps.Load();
Database.QuizData.Load();
Values = new Client.GameState[0];
new Game.Map(1038, Database.DMaps.MapPaths[1038]);
Game.ConquerStructures.Society.GuildWar.Initiate() ;
Program.WriteLine("Guild war initializated.");
Network.AuthPackets.Forward.Incrementer = new ServerBase.Counter();
Network.Cryptography.AuthCryptography.PrepareAuthC ryptography();
Program.WriteLine("Initializing sockets.");
AuthServer = new AsyncSocket(AuthPort);
AuthServer.OnClientConnect += new Action<Interfaces.ISocketWrapper>(AuthServer_Annou nceNewConnection);
AuthServer.OnClientReceive += new Action<byte[], Interfaces.ISocketWrapper>(AuthServer_AnnounceRece ive);
AuthServer.OnClientDisconnect += new Action<Interfaces.ISocketWrapper>(AuthServer_Annou nceDisconnection);
GameServer = new AsyncSocket(GamePort);
GameServer.OnClientConnect += new Action<Interfaces.ISocketWrapper>(GameServer_Annou nceNewConnection);
GameServer.OnClientReceive += new Action<byte[], Interfaces.ISocketWrapper>(GameServer_AnnounceRece ive);
GameServer.OnClientDisconnect += new Action<Interfaces.ISocketWrapper>(GameServer_Annou nceDisconnection);
Program.WriteLine("Auth server online.");
Program.WriteLine("Game server online.");
//Program.WriteLine();
Program.WriteLine("Server loaded in " + (Time32.Now - Start) + " milliseconds.");
StatusFlagChange.Execute += new Action(StatusFlagChange_Execute);
StatusFlagChange.Start();
CharacterThread.Execute += new Action(CharacterThread_Execute);
CharacterThread.Start();
AttackThread.Execute += new Action(AttackThread_Execute);
AttackThread.Start();
CompanionThread.Execute += new Action(CompanionThread_Execute);
CompanionThread.Start();
BlessThread.Execute += new Action(BlessThread_Execute);
BlessThread.Start();
ServerStuff.Execute += new Action(ServerStuff_Execute);
ServerStuff.Start();
ArenaSystem.Execute += new Action(Game.ConquerStructures.Arena.ArenaSystem_Ex ecute);
ArenaSystem.Start();
new MySqlCommand(MySqlCommandType.UPDATE).Update("enti ties").Set("Online", 0).Execute();
GC.Collect();
System.Threading.Thread.Sleep(000);
// Console.Clear();
// Program.WriteLine("Server ready.");
while (true)
CommandsAI(Console.ReadLine());
}
static void AttackThread_Execute()
{
foreach (Client.GameState client in Values)
{
if (client.Socket.Connected)
{
if (client.Entity.HandleTiming)
{
#region Auto attack
if (client.Entity.AttackPacket != null || client.Entity.VortexAttackStamp != null)
{
try
{
if (client.Entity.ContainsFlag(Network.GamePackets.Up date.Flags.ShurikenVortex))
{
if (client.Entity.VortexPacket != null && client.Entity.VortexPacket.ToArray() != null)
{
if (Time32.Now > client.Entity.VortexAttackStamp.AddMilliseconds(14 00))
{
client.Entity.VortexAttackStamp = Time32.Now;
new Game.Attacking.Handle(client.Entity.VortexPacket, client.Entity, null);
}
}
}
else
{
client.Entity.VortexPacket = null;
var AttackPacket = client.Entity.AttackPacket;
if (AttackPacket != null && AttackPacket.ToArray() != null)
{
uint AttackType = AttackPacket.AttackType;
if (AttackType == Network.GamePackets.Attack.Magic || AttackType == Network.GamePackets.Attack.Melee || AttackType == Network.GamePackets.Attack.Ranged)
{
if (AttackType == Network.GamePackets.Attack.Magic)
{
if (Time32.Now > client.Entity.AttackStamp.AddSeconds(1))
{
new Game.Attacking.Handle(AttackPacket, client.Entity, null);
}
}
else
{
int decrease = -300;
if (client.Entity.OnCyclone())
decrease = 700;
if (client.Entity.OnSuperman())
decrease = 200;
if (Time32.Now > client.Entity.AttackStamp.AddMilliseconds((1000 - client.Entity.Agility - decrease) * (int)(AttackType == Network.GamePackets.Attack.Ranged ? 1 : 1)))
{
new Game.Attacking.Handle(AttackPacket, client.Entity, null);
}
}
}
}
}
}
catch (Exception e)
{
SaveException(e);
client.Entity.AttackPacket = null;
client.Entity.VortexPacket = null;
}
}
#endregion
}
}
//else
// client.Disconnect();
}
}
static DateTime LastRandomReset = DateTime.Now;
static void ServerStuff_Execute()
{
Console.Title = "Conquer Online Server Emulator. Start time: " + StartDate.ToString("dd MM yyyy hh:mm") + ". Players online: " + ServerBase.Kernel.GamePool.Count + "/" + PlayerCap;
new Database.MySqlCommand(Database.MySqlCommandType.UP DATE).Update("configuration").Set("GuildID", Game.ConquerStructures.Society.Guild.GuildCounter. Now).Set("ItemUID", Network.GamePackets.ConquerItem.ItemUID.Now).Where ("Server", ServerBase.Constants.ServerName).Execute();
static void CompanionThread_Execute()
{
Time32 Now = Time32.Now;
foreach (Client.GameState client in Values)
{
if (client.Companion != null)
{
short distance = ServerBase.Kernel.GetDistance(client.Companion.X, client.Companion.Y, client.Entity.X, client.Entity.Y);
if (distance >= 8)
{
ushort X = (ushort)(client.Entity.X + ServerBase.Kernel.Random.Next(2));
ushort Y = (ushort)(client.Entity.Y + ServerBase.Kernel.Random.Next(2));
if (!client.Map.SelectCoordonates(ref X, ref Y))
{
X = client.Entity.X;
Y = client.Entity.Y;
}
client.Companion.X = X;
client.Companion.Y = Y;
Network.GamePackets.Data data = new Conquer_Online_Server.Network.GamePackets.Data(tru e);
data.ID = Network.GamePackets.Data.Jump;
data.dwParam = (uint)((Y << 16) | X);
data.wParam1 = X;
data.wParam2 = Y;
data.UID = client.Companion.UID;
client.Companion.MonsterInfo.SendScreen(data);
}
else if (distance > 4)
{
Enums.ConquerAngle facing = ServerBase.Kernel.GetAngle(client.Companion.X, client.Companion.Y, client.Companion.Owner.Entity.X, client.Companion.Owner.Entity.Y);
if (!client.Companion.Move(facing))
{
facing = (Enums.ConquerAngle)ServerBase.Kernel.Random.Next( 7);
if (client.Companion.Move(facing))
{
client.Companion.Facing = facing;
Network.GamePackets.GroundMovement move = new Conquer_Online_Server.Network.GamePackets.GroundMo vement(true);
move.Direction = facing;
move.UID = client.Companion.UID;
move.GroundMovementType = Network.GamePackets.GroundMovement.Run;
client.Companion.MonsterInfo.SendScreen(move);
}
}
else
{
client.Companion.Facing = facing;
Network.GamePackets.GroundMovement move = new Conquer_Online_Server.Network.GamePackets.GroundMo vement(true);
move.Direction = facing;
move.UID = client.Companion.UID;
move.GroundMovementType = Network.GamePackets.GroundMovement.Run;
client.Companion.MonsterInfo.SendScreen(move);
}
}
else
{
var monster = client.Companion;
if (monster.MonsterInfo.InSight == 0)
{
if (client.Entity.AttackPacket != null)
{
if (client.Entity.AttackPacket.AttackType == Network.GamePackets.Attack.Magic)
{
if (client.Entity.AttackPacket.Decoded)
{
if (SpellTable.SpellInformations.ContainsKey((ushort) client.Entity.AttackPacket.Damage))
{
var info = Database.SpellTable.SpellInformations[(ushort)client.Entity.AttackPacket.Damage].Values.ToArray()[client.Spells[(ushort)client.Entity.AttackPacket.Damage].Level];
if (info.CanKill)
{
monster.MonsterInfo.InSight = client.Entity.AttackPacket.Attacked;
}
}
}
}
else
{
monster.MonsterInfo.InSight = client.Entity.AttackPacket.Attacked;
}
}
}
else
{
if (monster.MonsterInfo.InSight > 400000 && monster.MonsterInfo.InSight < 600000 || monster.MonsterInfo.InSight > 800000 && monster.MonsterInfo.InSight != monster.UID)
{
Entity attacked = null;
if (client.Screen.TryGetValue(monster.MonsterInfo.InS ight, out attacked))
{
if (Now > monster.AttackStamp.AddMilliseconds(monster.Monste rInfo.AttackSpeed))
{
monster.AttackStamp = Now;
if (attacked.Dead)
{
monster.MonsterInfo.InSight = 0;
}
else
new Game.Attacking.Handle(null, monster, attacked);
}
}
else
monster.MonsterInfo.InSight = 0;
}
}
}
}
}
}
static void BlessThread_Execute()
{
lock (Values)
Values = ServerBase.Kernel.GamePool.Values.ToArray();
foreach (Client.GameState client in Values)
{
if (client.Screen == null || client.Entity == null)
{
client.Disconnect();
}
if (client.Socket.Connected)
{
if (client.Entity.Reborn > 1)
continue;
if (!client.Entity.ContainsFlag(Network.GamePackets.U pdate.Flags.Praying))
{
foreach (Interfaces.IMapObject ClientObj in client.Screen.Objects)
{
if (ClientObj != null)
{
if (ClientObj is Game.Entity)
{
if (ClientObj.MapObjType == Conquer_Online_Server.Game.MapObjectType.Player)
{
var Client = ClientObj.Owner;
if (Client.Entity.ContainsFlag(Network.GamePackets.Up date.Flags.CastPray))
{
if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, ClientObj.X, ClientObj.Y) <= 3)
{
client.Entity.AddFlag(Network.GamePackets.Update.F lags.Praying);
client.PrayLead = Client;
client.Entity.Action = Client.Entity.Action;
Client.Prayers.Add(client);
}
}
}
}
}
}
}
else
{
if (client.PrayLead != null)
{
if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, client.PrayLead.Entity.X, client.PrayLead.Entity.Y) > 4)
{
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.Praying);
client.PrayLead.Prayers.Remove(client);
client.PrayLead = null;
}
}
}
}
}
}
static void StatusFlagChange_Execute()
{
Time32 Now = Time32.Now;
foreach (Client.GameState client in Values)
{
if (client.Socket.Connected && client.Entity != null)
{
#region Bless
if (client.Entity.ContainsFlag(Network.GamePackets.Up date.Flags.CastPray))
{
if (client.BlessTime <= 345000)
client.BlessTime += 1500;
else
client.BlessTime = 360000;
}
else if (client.Entity.ContainsFlag(Network.GamePackets.Up date.Flags.Praying))
{
if (client.PrayLead != null)
{
if (client.PrayLead.Socket.Connected)
{
if (client.BlessTime <= 355000)
client.BlessTime += 500;
else
client.BlessTime = 3600;
}
else
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.Praying);
}
else
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.Praying);
}
else
{
if (client.BlessTime > 0)
{
if (client.BlessTime >= 500)
{
client.BlessTime -= 500;
client.Entity.Update(Network.GamePackets.Update.Lu ckyTimeTimer, client.BlessTime, false);
}
else
{
client.BlessTime = 0;
client.Entity.Update(Network.GamePackets.Update.Lu ckyTimeTimer, client.BlessTime, false);
}
}
}
#endregion
#region Flashing name
if (client.Entity.ContainsFlag(Network.GamePackets.Up date.Flags.FlashingName))
{
if (Now > client.Entity.FlashingNameStamp.AddSeconds(client. Entity.FlashingNameTime))
{
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.FlashingName);
}
}
#endregion
#region XPList
if (!client.Entity.ContainsFlag(Network.GamePackets.U pdate.Flags.XPList))
{
if (Now > client.XPCountStamp.AddSeconds(3))
{
#region Arrows
if (client.Equipment != null)
{
if (!client.Equipment.Free(5))
{
if (Network.PacketHandler.IsArrow(client.Equipment.Tr yGetItem(5).ID))
{
Database.ConquerItemTable.UpdateDurabilityItem(cli ent.Equipment.TryGetItem(5));
}
}
}
#endregion
client.XPCountStamp = Now;
client.XPCount++;
if (client.XPCount >= 100)
{
client.Entity.AddFlag(Network.GamePackets.Update.F lags.XPList);
client.XPCount = 0;
client.XPListStamp = Now;
}
}
}
else
{
if (Now > client.XPListStamp.AddSeconds(20))
{
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.XPList);
}
}
#endregion
#region KOSpell
if (client.Entity.OnKOSpell())
{
if (client.Entity.OnCyclone())
{
int Seconds = Now.AllSeconds() - client.Entity.CycloneStamp.AddSeconds(client.Entit y.CycloneTime).AllSeconds();
if (Seconds >= 1)
{
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.Cyclone);
}
}
if (client.Entity.OnSuperman())
{
int Seconds = Now.AllSeconds() - client.Entity.SupermanStamp.AddSeconds(client.Enti ty.SupermanTime).AllSeconds();
if (Seconds >= 1)
{
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.Superman);
}
}
if (!client.Entity.OnKOSpell())
{
//Record KO
client.Entity.KOCount = 0;
}
}
#endregion
#region Buffers
if (client.Entity.ContainsFlag(Network.GamePackets.Up date.Flags.Stigma))
{
if (Now >= client.Entity.StigmaStamp.AddSeconds(client.Entity .StigmaTime))
{
client.Entity.StigmaTime = 0;
client.Entity.StigmaIncrease = 0;
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.Stigma);
}
}
if (client.Entity.ContainsFlag(Network.GamePackets.Up date.Flags.Dodge))
{
if (Now >= client.Entity.DodgeStamp.AddSeconds(client.Entity. DodgeTime))
{
client.Entity.DodgeTime = 0;
client.Entity.DodgeIncrease = 0;
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.Dodge);
}
}
if (client.Entity.ContainsFlag(Network.GamePackets.Up date.Flags.Invisibility))
{
if (Now >= client.Entity.InvisibilityStamp.AddSeconds(client. Entity.InvisibilityTime))
{
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.Invisibility);
}
}
if (client.Entity.ContainsFlag(Network.GamePackets.Up date.Flags.StarOfAccuracy))
{
if (client.Entity.StarOfAccuracyTime != 0)
{
if (Now >= client.Entity.StarOfAccuracyStamp.AddSeconds(clien t.Entity.StarOfAccuracyTime))
{
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.StarOfAccuracy);
}
}
else
{
if (Now >= client.Entity.AccuracyStamp.AddSeconds(client.Enti ty.AccuracyTime))
{
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.StarOfAccuracy);
}
}
}
if (client.Entity.ContainsFlag(Network.GamePackets.Up date.Flags.MagicShield))
{
if (client.Entity.MagicShieldTime != 0)
{
if (Now >= client.Entity.MagicShieldStamp.AddSeconds(client.E ntity.MagicShieldTime))
{
client.Entity.MagicShieldIncrease = 0;
client.Entity.MagicShieldTime = 0;
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.MagicShield);
}
}
else
{
if (Now >= client.Entity.ShieldStamp.AddSeconds(client.Entity .ShieldTime))
{
client.Entity.ShieldIncrease = 0;
client.Entity.ShieldTime = 0;
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.MagicShield);
}
}
}
#endregion
#region Fly
if (client.Entity.ContainsFlag(Network.GamePackets.Up date.Flags.Fly))
{
if (Now >= client.Entity.FlyStamp.AddSeconds(client.Entity.Fl yTime))
{
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.Fly);
client.Entity.FlyTime = 0;
}
}
#endregion
#region PoisonStar
if (client.Entity.NoDrugsTime > 0)
{
if (Now > client.Entity.NoDrugsStamp.AddSeconds(client.Entit y.NoDrugsTime))
{
client.Entity.NoDrugsTime = 0;
}
}
#endregion
#region ToxicFog
if (client.Entity.ToxicFogLeft > 0)
{
if (Now >= client.Entity.ToxicFogStamp.AddSeconds(2))
{
float Percent = client.Entity.ToxicFogPercent;
//Remove this line if you want it normal
Percent = Math.Min(0.1F, client.Entity.ToxicFogPercent);
client.Entity.ToxicFogLeft--;
client.Entity.ToxicFogStamp = Now;
if (client.Entity.Hitpoints > 1)
{
uint damage = Game.Attacking.Calculate.Percent(client.Entity, Percent);
client.Entity.Hitpoints -= damage;
Network.GamePackets.SpellUse suse = new Conquer_Online_Server.Network.GamePackets.SpellUse (true);
suse.Attacker = client.Entity.UID;
suse.SpellID = 10010;
suse.Targets.Add(client.Entity.UID, damage);
client.SendScreen(suse, true);
if (client.QualifierGroup != null)
client.QualifierGroup.UpdateDamage(ServerBase.Kern el.GamePool[client.ArenaStatistic.PlayWith], damage);
}
}
}
#endregion
#region FatalStrike
if (client.Entity.OnFatalStrike())
{
if (Now > client.Entity.FatalStrikeStamp.AddSeconds(client.E ntity.FatalStrikeTime))
{
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.FatalStrike);
}
}
#endregion
if (client.Entity.OnOblivion())
{
if (Now > client.Entity.OblivionStamp.AddSeconds(client.Enti ty.OblivionTime))
{
client.Entity.RemoveFlag2(Network.GamePackets.Upda te.Flags2.Oblivion);
}
}
#region ShurikenVortex
if (client.Entity.ContainsFlag(Network.GamePackets.Up date.Flags.ShurikenVortex))
{
if (Now > client.Entity.ShurikenVortexStamp.AddSeconds(clien t.Entity.ShurikenVortexTime))
{
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.ShurikenVortex);
}
}
#endregion
#region Transformations
if (client.Entity.Transformed)
{
if (Now > client.Entity.TransformationStamp.AddSeconds(clien t.Entity.TransformationTime))
{
client.Entity.Untransform();
}
}
#endregion
}
//else
// client.Disconnect();
}
}
public static void CommandsAI(string command)
{
if (command == null)
return;
string[] data = command.Split(' ');
switch (data[0])
{
case "@alivetime":
{
DateTime now = DateTime.Now;
TimeSpan t2 = new TimeSpan(StartDate.ToBinary());
TimeSpan t1 = new TimeSpan(now.ToBinary());
Program.WriteLine("The server has been online " + (int)(t1.TotalHours - t2.TotalHours) + " hours, " + (int)((t1.TotalMinutes - t2.TotalMinutes) % 60) + " minutes.");
break;
}
case "@online":
{
Program.WriteLine("Online players count: " + ServerBase.Kernel.GamePool.Count);
string line = "";
foreach (Client.GameState pClient in ServerBase.Kernel.GamePool.Values)
line += pClient.Entity.Name + ",";
if (line != "")
{
line = line.Remove(line.Length - 1);
Program.WriteLine("Players: " + line);
}
break;
}
case "@memoryusage":
{
var proc = System.Diagnostics.Process.GetCurrentProcess();
Program.WriteLine("Thread count: " + proc.Threads.Count);
Program.WriteLine("Memory set(MB): " + ((double)((double)proc.WorkingSet64 / 1024)) / 1024);
proc.Close();
break;
}
case "@save":
{
foreach (Client.GameState client in ServerBase.Kernel.GamePool.Values)
{
client.Account.Save();
Database.EntityTable.SaveEntity(client);
Database.SkillTable.SaveProficiencies(client);
Database.SkillTable.SaveSpells(client);
Database.ArenaTable.SaveArenaStatistics(client.Are naStatistic);
}
new Database.MySqlCommand(Database.MySqlCommandType.UP DATE).Update("configuration").Set("ItemUID", Network.GamePackets.ConquerItem.ItemUID.Now).Where ("Server", ServerBase.Constants.ServerName).Execute();
}
break;
case "@playercap":
{
try
{
PlayerCap = int.Parse(data[1]);
}
catch
{
}
break;
}
case "@exit":
{
new Database.MySqlCommand(Database.MySqlCommandType.UP DATE).Update("configuration").Set("ItemUID", Network.GamePackets.ConquerItem.ItemUID.Now).Where ("Server", ServerBase.Constants.ServerName).Execute();
GameServer.Disable();
AuthServer.Disable();
var WC = ServerBase.Kernel.GamePool.Values.ToArray();
foreach (Client.GameState client in WC)
client.Disconnect();
if (GuildWar.IsWar)
GuildWar.End();
new Database.MySqlCommand(Database.MySqlCommandType.UP DATE).Update("configuration").Set("ItemUID", Network.GamePackets.ConquerItem.ItemUID.Now).Where ("Server", ServerBase.Constants.ServerName).Execute();
Environment.Exit(0);
}
break;
case "@restart":
{
new Database.MySqlCommand(Database.MySqlCommandType.UP DATE).Update("configuration").Set("ItemUID", Network.GamePackets.ConquerItem.ItemUID.Now).Where ("Server", ServerBase.Constants.ServerName).Execute();
GameServer.Disable();
AuthServer.Disable();
var WC = ServerBase.Kernel.GamePool.Values.ToArray();
foreach (Client.GameState client in WC)
client.Disconnect();
if (GuildWar.IsWar)
GuildWar.End();
new Database.MySqlCommand(Database.MySqlCommandType.UP DATE).Update("configuration").Set("ItemUID", Network.GamePackets.ConquerItem.ItemUID.Now).Where ("Server", ServerBase.Constants.ServerName).Execute();
static void GameServer_AnnounceNewConnection(Interfaces.ISocke tWrapper obj)
{
obj.Connector = new Client.GameState(obj.Socket);
Client.GameState Client = obj.Connector as Client.GameState;
Client.Send(Client.DHKeyExchance.CreateServerKeyPa cket());
}
public static void GameServer_AnnounceReceive(byte[] arg1, Interfaces.ISocketWrapper arg2)
{
Client.GameState Client = arg2.Connector as Client.GameState;
try
{
Client.Cryptography.Decrypt(arg1);
}
catch {}
if (Client != null)
{
if (Client.Exchange)
{
try
{
Client.Exchange = false;
Client.Action = 1;
ushort position = 7;
uint PacketLen = BitConverter.ToUInt32(arg1, position); position += 4;
int JunkLen = BitConverter.ToInt32(arg1, position); position += 4; position += (ushort)JunkLen;
int Len = BitConverter.ToInt32(arg1, position); position += 4;
byte[] pubKey = new byte[Len];
for (int x = 0; x < Len; x++)
pubKey[x] = arg1[x + position];
string PubKey = System.Text.ASCIIEncoding.ASCII.GetString(pubKey);
password = System.Text.Encoding.ASCII.GetString(
(new Network.Cryptography.ConquerPasswordCryptpographer (player.Info.Username)).Decrypt(
(new Network.Cryptography.RC5(rc5Key)).Decrypt(encpw))) ;
password = password.Split('\0')[0];
//}
//catch
//{
// player.Send(new Conquer_Online_Server.Network.GamePackets.Message( "Invalid client version.", "ALLUSERS", System.Drawing.Color.Orange, Conquer_Online_Server.Network.GamePackets.Message. Dialog));
// return;
//}
string NoNumPadNumbers = "";
foreach (char c in password)
{
switch (c.ToString())
{
case "-": NoNumPadNumbers += "0"; break;
case "#": NoNumPadNumbers += "1"; break;
case "(": NoNumPadNumbers += "2"; break;
case "\"": NoNumPadNumbers += "3"; break;
case "%": NoNumPadNumbers += "4"; break;
case "\f": NoNumPadNumbers += "5"; break;
case "'": NoNumPadNumbers += "6"; break;
case "$": NoNumPadNumbers += "7"; break;
case "&": NoNumPadNumbers += "8"; break;
case "!": NoNumPadNumbers += "9"; break;
default: NoNumPadNumbers += c; break;
}
}
password = NoNumPadNumbers;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Conquer_Online_Server.Applications
{
public partial class Output : Form
{
public static bool Changed = false;
public static string AllText = "";
public Output()
{
InitializeComponent();
printTimer.Start();
}
I connect to server and can walk jump etc but no any text in console.....
That's impossible given the wall of text you posted. The main thread doesn't contain anything but my example with the commented code that starts your server.
[HELP] How do i create a custom interface? 09/04/2015 - EO PServer Hosting - 7 Replies Hey guys ,
Im just wondering if you could tell me or link me a guide of how to create a custom interface for eudemons online because i have no idea and i think that you all could help me i've saw it before on a few other servers.
Thankyou from lewis :)
[HOW TO] Create a New Interface 11/27/2010 - Metin2 PServer Guides & Strategies - 30 Replies Ich hoffe das TuT gab es nicht schonmal... Wenn doch sry, habe in der SuFu nichts gefunden :-(
So fangen wir an :
Was brauchen wir?
-Einen Client
-Die entpackten Etc.eix/epk Dateien
-Irgendeinen Server
Was müssen wir tun?
TAPLG Tester Needed (User Interface) 01/30/2007 - World of Warcraft - 3 Replies As some of you might know im creating a Leveling Guide Addon for WoW, its for alliance, all races and all classes.
Its currently still in the developing state and as for now only the race Draenei level 1-12 is finished. This guid will go up to level 70.
I need a tester to check if its working the way i entended it to.
If someone is interested please PM your icq number to me so we can talk more detailed.
Only the first 5 will be abel to test this and give me feedback, i will post here...
FtH User Interface (Complete Interface) 09/05/2006 - World of Warcraft - 10 Replies Hallo ,
ich will euch das wohl beste Interface nicht vorenthalten. For the Horde hat mit seiner ersten Version seines eigenen Interfaces schon gute arbeit geleistet. Aber das naja nich mehr ganz aktuele ist noch besser.
http://web4.h60972.serverkompetenz.net/for...p?th readid=3465 <- DL Link.
Dort gibt es aber auch den kompletten Guide zu dem Interface.
Achja FTH benutzt X-Raid , nicht jedem seine Sache. Das Interface ist aber auch mit CT_RAID kompatibel.
User Interface von wow 12/10/2004 - WoW Guides & Templates - 2 Replies auf worldofwarcraft.com wurde heute ein eigenes Tool gebastelt um User Interfaces zu basteln!
links:
Tool
Tutorial
worldofwarcraft.com
ps: mmhh xml? ähm ist das das xml, was man auch bei selhtml ne einführung drüber bekommt?