here are my voids...
LogOff
Code:
public void LogOff()
{
try
{
Game.Buff B = MyChar.BuffOf(NewestCOServer.Features.SkillsClass.ExtraEffect.Transform);
MyChar.RemoveBuff(B);
if (MyChar.MyCompanion != null)
MyChar.MyCompanion.Dissappear();
if (MyChar.MyTeam != null)
{
if (MyChar.TeamLeader)
MyChar.MyTeam.Dismiss(MyChar);
else
MyChar.MyTeam.Leaves(MyChar);
}
if (MyChar.Loc.Map == 1039 || MyChar.Loc.Map == 1036 || MyChar.Loc.Map == 2021 || MyChar.Loc.Map == 2022 || MyChar.Loc.Map == 2023 || MyChar.Loc.Map == 2024 || MyChar.Loc.Map == 1051)
{
Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[MyChar.Loc.PreviousMap];
MyChar.Teleport(MyChar.Loc.PreviousMap, V.X, V.Y);
}
if (MyChar.MyShop != null)
MyChar.MyShop.Close();
foreach (Game.Friend F in MyChar.Friends.Values)
{
AddSend(Packets.FriendEnemyPacket(F.UID, F.Name, 15, Convert.ToByte(F.Online)));
if (F.Online)
{
F.Info.MyClient.AddSend(Packets.FriendEnemyPacket(MyChar.EntityID, MyChar.Name, 14, 1));
F.Info.MyClient.AddSend(Packets.FriendEnemyPacket(MyChar.EntityID, MyChar.Name, 15, 0));
F.Info.MyClient.LocalMessage(2005, "Your friend " + MyChar.Name + " has logged off.");
}
}
if (!MyChar.Alive)
{
if (MyChar.Loc.Map == 1038 && Features.GuildWars.War)
{
MyChar.Loc.PreviousMap = MyChar.Loc.Map;
MyChar.Loc.Map = 6001;
MyChar.Loc.X = 32;
MyChar.Loc.Y = 72;
}
else
{
foreach (ushort[] Point in Database.RevPoints)
if (Point[0] == MyChar.Loc.Map)
{
MyChar.Loc.PreviousMap = MyChar.Loc.Map;
MyChar.Loc.Map = Point[1];
MyChar.Loc.X = Point[2];
MyChar.Loc.Y = Point[3];
break;
}
}
MyChar.CurHP = 1;
}
}
catch { }
if (Game.World.H_Chars.Contains(MyChar.EntityID) || Game.World.H_Clients.Contains(MyChar.EntityID))
{
Program.WriteLine("User " + MyChar.Name + " disconnected.");
//here starts the part to tell me some infos about the character
string Profs = "";
string Skills = "";
foreach (Game.Skill S in MyChar.Skills.Values)
Skills += S.ID + "~" + S.Lvl + "~" + S.Exp + " ";
if (Skills != "")
Program.WriteLine(MyChar.Name + " had Skills: " + Skills);
foreach (Game.Prof P in MyChar.Profs.Values)
Profs += P.ID + "~" + P.Lvl + "~" + P.Exp + " ";
if (Profs != "")
Program.WriteLine(MyChar.Name + " had Profs: " + Profs);
if (MyChar.DoubleExpLeft > 0)
Program.WriteLine(MyChar.Name + " had DoubleExp: " + MyChar.DoubleExpLeft);
if (MyChar.VipLevel != 0)
Program.WriteLine(MyChar.Name + " had VIPLevel: " + MyChar.VipLevel + " days: " + MyChar.VIPDays);
if (MyChar.VP > 0)
Program.WriteLine(MyChar.Name + " had " + MyChar.VP + " VPS.");
if (MyChar.Reborns > 0)
{
Program.WriteLine(MyChar.Name + " was class " + MyChar.PreviousJob1 + " before reborning.");
if (MyChar.PreviousJob2 != 0)
Program.WriteLine(MyChar.Name + " was class " + MyChar.PreviousJob2 + " before reborning second time.");
}
string Items = "";
foreach (Game.Item I in MyChar.Inventory)
Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + " ";
Program.WriteLine(MyChar.Name + " had items in Inventory: " + Items);
Items = "MA WH: ";
foreach (Game.Item I in MyChar.Warehouses.MAWarehouse)
Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + " ";
Program.WriteLine(MyChar.Name + " had " + Items);
Items = "TC WH: ";
foreach (Game.Item I in MyChar.Warehouses.TCWarehouse)
Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + " ";
Program.WriteLine(MyChar.Name + " had " + Items);
Items = "PC WH: ";
foreach (Game.Item I in MyChar.Warehouses.PCWarehouse)
Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + " ";
Program.WriteLine(MyChar.Name + " had " + Items);
Items = "AC WH: ";
foreach (Game.Item I in MyChar.Warehouses.ACWarehouse)
Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + " ";
Program.WriteLine(MyChar.Name + " had " + Items);
Items = "DC WH: ";
foreach (Game.Item I in MyChar.Warehouses.DCWarehouse)
Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + " ";
Program.WriteLine(MyChar.Name + " had " + Items);
Items = "BI WH: ";
foreach (Game.Item I in MyChar.Warehouses.BIWarehouse)
Items += I.ID + "~" + I.Plus + "~" + I.Bless + "~" + I.Enchant + "~" + I.Soc1 + "~" + I.Soc2 + "~" + I.Progress + " ";
Program.WriteLine(MyChar.Name + " was level: " + MyChar.Level + " PC: " + (MyChar.Experience * 100) / Database.LevelExp[MyChar.Level]);
Program.WriteLine(MyChar.Name + " had job: " + MyChar.Job);
Program.WriteLine(MyChar.Name + " had silvers: " + MyChar.Silvers);
Program.WriteLine(MyChar.Name + " had WH silvers: " + MyChar.WHSilvers);
Program.WriteLine(MyChar.Name + " had WH: " + Items);
Program.WriteLine(MyChar.Name + " had top gear: " + MyChar.Equips.HeadGear.ID + "~" + MyChar.Equips.HeadGear.Plus + "~" + MyChar.Equips.HeadGear.Bless + "~" + MyChar.Equips.HeadGear.Enchant + "~" + MyChar.Equips.HeadGear.Soc1 + "~" + MyChar.Equips.HeadGear.Soc2 + "~" + MyChar.Equips.HeadGear.Progress);
Program.WriteLine(MyChar.Name + " had necklace: " + MyChar.Equips.Necklace.ID + "~" + MyChar.Equips.Necklace.Plus + "~" + MyChar.Equips.Necklace.Bless + "~" + MyChar.Equips.Necklace.Enchant + "~" + MyChar.Equips.Necklace.Soc1 + "~" + MyChar.Equips.Necklace.Soc2 + "~" + MyChar.Equips.Necklace.Progress);
Program.WriteLine(MyChar.Name + " had ring: " + MyChar.Equips.Ring.ID + "~" + MyChar.Equips.Ring.Plus + "~" + MyChar.Equips.Ring.Bless + "~" + MyChar.Equips.Ring.Enchant + "~" + MyChar.Equips.Ring.Soc1 + "~" + MyChar.Equips.Ring.Soc2 + "~" + MyChar.Equips.Ring.Progress);
Program.WriteLine(MyChar.Name + " had right hand: " + MyChar.Equips.RightHand.ID + "~" + MyChar.Equips.RightHand.Plus + "~" + MyChar.Equips.RightHand.Bless + "~" + MyChar.Equips.RightHand.Enchant + "~" + MyChar.Equips.RightHand.Soc1 + "~" + MyChar.Equips.RightHand.Soc2 + "~" + MyChar.Equips.RightHand.Progress);
Program.WriteLine(MyChar.Name + " had left hand: " + MyChar.Equips.LeftHand.ID + "~" + MyChar.Equips.LeftHand.Plus + "~" + MyChar.Equips.LeftHand.Bless + "~" + MyChar.Equips.LeftHand.Enchant + "~" + MyChar.Equips.LeftHand.Soc1 + "~" + MyChar.Equips.LeftHand.Soc2 + "~" + MyChar.Equips.LeftHand.Progress);
Program.WriteLine(MyChar.Name + " had armor: " + MyChar.Equips.Armor.ID + "~" + MyChar.Equips.Armor.Plus + "~" + MyChar.Equips.Armor.Bless + "~" + MyChar.Equips.Armor.Enchant + "~" + MyChar.Equips.Armor.Soc1 + "~" + MyChar.Equips.Armor.Soc2 + "~" + MyChar.Equips.Armor.Progress);
Program.WriteLine(MyChar.Name + " had boots: " + MyChar.Equips.Boots.ID + "~" + MyChar.Equips.Boots.Plus + "~" + MyChar.Equips.Boots.Bless + "~" + MyChar.Equips.Boots.Enchant + "~" + MyChar.Equips.Boots.Soc1 + "~" + MyChar.Equips.Boots.Soc2 + "~" + MyChar.Equips.Boots.Progress);
//and here ends the info part
if (MyChar.MyGuild != null)
MyChar.MyGuild.GuildMsg("SYSTEM", MyChar.MyGuild.Members.Values.ToString(), MyChar.Name + " has logged off.", 0);
Database.SaveCharacter(MyChar, AuthInfo.Account);
Game.World.H_Chars.Remove(MyChar.EntityID);
Game.World.H_Clients.Remove(MyChar.EntityID);
if (Game.World.H_CharsDrawing.Contains(MyChar.EntityID))
Game.World.H_CharsDrawing.Remove(MyChar.EntityID);
Game.World.Action(MyChar, Packets.GeneralData(MyChar.EntityID, 0, 0, 0, 135).Get);
MyChar.MyClient = null;
}
}
Code:
public void Disconnect()
{
try
{
if (Soc.Connected)
{
Soc.Shutdown(SocketShutdown.Both);
LogOff();
Soc.Close();
}
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
the repeated check....(maybe it has to be removed idk....it was the same without this)
Code:
try
{
foreach (Main.GameClient C in World.H_Clients.Values)
if ((!C.Soc.Connected || C.Soc == null || C == null) && !World.Exit)
{
C.LogOff();
}
}
catch { }






