قديم 2019-08-04, 12:25 PM
المشاركة 2
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: مشكلة فى تشغيل السورس
اتاك زودته جدا قلله و زود اتاك من GameState.cs

سيرش علي

كود:
private void loadItemStats

تحتها حط الكود ده و عدل ع اتاك برحتك رقم الي هتحطه هيزود ع الاتاك الاساسي

كود:
 #region [Cup]
if (item.ID == 2100075 )
            {
                
Entity.BaseMinAttack += 4000;
                
Entity.BaseMaxAttack += 5000;
                
Entity.BaseMagicAttack += 2500;
                
Entity.Breaktrough += 150;
                
Entity.Counteraction += 150;
                
Entity.CriticalStrike += 200;
                
Entity.SkillCStrike += 150;
                
Entity.Immunity += 150;
                
Entity.Defence += 2000;
                
Entity.ItemHP += 2000;
                
Entity.ItemMP += 1500;
                
Entity.BaseDefence += 2000;
                
Entity.BaseMagicDefence += 2500;
            }
            
#endregion 


قديم 2019-08-05, 09:32 AM
المشاركة 3
MeGoo
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: مشكلة فى تشغيل السورس
اتاك زودته جدا قلله و زود اتاك من GameState.cs

سيرش علي

كود:
private void loadItemStats

تحتها حط الكود ده و عدل ع اتاك برحتك رقم الي هتحطه هيزود ع الاتاك الاساسي

كود:
 #region [Cup]
if (item.ID == 2100075 )
            {
                
Entity.BaseMinAttack += 4000;
                
Entity.BaseMaxAttack += 5000;
                
Entity.BaseMagicAttack += 2500;
                
Entity.Breaktrough += 150;
                
Entity.Counteraction += 150;
                
Entity.CriticalStrike += 200;
                
Entity.SkillCStrike += 150;
                
Entity.Immunity += 150;
                
Entity.Defence += 2000;
                
Entity.ItemHP += 2000;
                
Entity.ItemMP += 1500;
                
Entity.BaseDefence += 2000;
                
Entity.BaseMagicDefence += 2500;
            }
            
#endregion 




معلس انا نسيت اقولك ان انا زوت اتاك الكاس الجديد مش الكاس بتاع الوار العادى كاس العالم الجديد




كود:
2100005@@WorldCup@@0@@0@@0@@0@@0@@0@@0@@0@@9@@0@@1@@0@@0@@0@@5000@@0@@0@@8500@@8500@@10000@@10000@@0@@0@@0@@0@@0@@0@@0@@0@@0@@0@@0@@0@@3@@1@@0@@0@@129600@@0@@0@@0@@0@@0@@0@@0@@0@@0@@0@@0@@0@@0@@Talisman@@It`s~a~marvelous~trophy~for~the~rea~football~fans!@@9@@0@@0@@0@@7030@@500@@0@@0@@0@@0@@0@@ 

الي هو دا

قديم 2019-08-05, 10:54 AM
المشاركة 4
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: مشكلة فى تشغيل السورس
تحت دي زوده الكود الي مديهولك
private void loadItemStats(

انته حاطه في مكان تاني

قديم 2019-08-05, 11:02 AM
المشاركة 5
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: مشكلة فى تشغيل السورس
او تعاله اني ديسك

قديم 2019-08-06, 03:02 PM
المشاركة 6
MeGoo
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: مشكلة فى تشغيل السورس
تحت دي زوده الكود الي مديهولك
private void loadItemStats(

انته حاطه في مكان تاني
بص اي نجم فى 2 من الكلمة دى



كود:
using System;
using System.Linq;
using System.Threading;
using System.Net.Sockets;
using System.Collections.Generic;
using Mohamed_Hossam_Barakat.Network.Cryptography;
using Mohamed_Hossam_Barakat.Network.GamePackets;
using Mohamed_Hossam_Barakat.Network.Sockets;
using Mohamed_Hossam_Barakat.Network;
using Mohamed_Hossam_Barakat.Interfaces;
using Mohamed_Hossam_Barakat.Game.ConquerStructures;
using System.Drawing;
using Mohamed_Hossam_Barakat.Game;
using Mohamed_Hossam_Barakat.Database;
using System.Diagnostics;
using Microsoft.Win32;
using Mohamed_Hossam_Barakat.Copra;
using Mohamed_Hossam_Barakat.Rangers.Inner;
using System.Collections.Concurrent;
using Mohamed_Hossam_Barakat.Game.Features.Tournaments;
using System.Drawing.Drawing2D;
using Mohamed_Hossam_Barakat.MaTrix;


namespace 
Mohamed_Hossam_Barakat.Client
{
    public class 
GameState
    
{
        public 
bool InWareHouse()
        {
            foreach (var 
wh in Warehouses.Values)
            {
                if (
wh.Count 0)
                    return 
true;
            }
            return 
false;
        }
        public static 
void CheckItems(Client.GameState client)
        {
            
#region Items Protections

            #region Positions
            
List<intPro7Dam = new List<int>() { 123456821222324252628 };
            List<
intPro1Dam = new List<int>() { 791011151617182729 };
            List<
intProSocket = new List<int>() { 79151617182729 };
            
#endregion
            #region Equipments
            
foreach (ConquerItem i in client.Equipment.Objects)
            {
                if (
== null) continue;
                
#region Damage 7
                
if (Pro7Dam.Contains(i.Position))
                {
                    if (
i.Bless 7)
                    {
                        
i.Bless 7;
                        
i.Mode Game.Enums.ItemMode.Update;
                        
Database.ConquerItemTable.UpdateBless(i);
                    }
                }
                
#endregion
                #region Damage 1 - Enchant
                
if (Pro1Dam.Contains(i.Position))
                {
                    if (
i.Bless 1)
                    {
                        
i.Bless 1;
                        
i.Mode Game.Enums.ItemMode.Update;
                        
Database.ConquerItemTable.UpdateBless(i);
                    }
                    if (
i.Enchant 0)
                    {
                        
i.Enchant 0;
                        
i.Mode Game.Enums.ItemMode.Update;
                        
Database.ConquerItemTable.UpdateEnchant(i);
                    }
                }
                
#endregion
                #region Damage - Enchant - Crop & Wing
                
if (i.Position == 19 && i.Position == 12)
                {
                    if (
i.Bless 0i.Bless 0;
                    if (
i.Enchant 0i.Enchant 0;
                    
i.Mode Game.Enums.ItemMode.Update;
                    
Database.ConquerItemTable.UpdateEnchant(i);
                    
Database.ConquerItemTable.UpdateBless(i);
                }
                
#endregion
                #region Sockets
                
if (ProSocket.Contains(i.Position))
                {
                    if (
i.SocketOne > (Game.Enums.Gem)0)
                    {
                        
i.SocketOne Game.Enums.Gem.NoSocket;
                        
i.SocketTwo Game.Enums.Gem.NoSocket;
                        
i.Mode Game.Enums.ItemMode.Update;
                        
Database.ConquerItemTable.UpdateSockets(i);
                    }
                }
                
#endregion
                
i.Send(client);
            }
            
#endregion
            #region Inventory
            
foreach (ConquerItem i in client.Inventory.Objects)
            {
                if (
== null) continue;
                
#region Damage 7
                
if (Pro7Dam.Contains(PacketHandler.ItemPosition(i.ID)))
                {
                    if (
i.Bless 7)
                    {
                        
i.Bless 7;
                        
i.Mode Game.Enums.ItemMode.Update;
                        
Database.ConquerItemTable.UpdateBless(i);
                    }
                }
                
#endregion
                #region Damage 1 - Enchant
                
if (Pro1Dam.Contains(PacketHandler.ItemPosition(i.ID)))
                {
                    if (
i.Bless 1)
                    {
                        
i.Bless 1;
                        
i.Mode Game.Enums.ItemMode.Update;
                        
Database.ConquerItemTable.UpdateBless(i);
                    }
                    if (
i.Enchant 0)
                    {
                        
i.Enchant 0;
                        
i.Mode Game.Enums.ItemMode.Update;
                        
Database.ConquerItemTable.UpdateEnchant(i);
                    }
                }
                
#endregion
                #region Damage - Enchant - Crop & Wing
                
if (PacketHandler.ItemPosition(i.ID) == 19 || PacketHandler.ItemPosition(i.ID) == 12)
                {
                    if (
i.Bless 0i.Bless 0;
                    if (
i.Enchant 0i.Enchant 0;
                    
i.Mode Game.Enums.ItemMode.Update;
                    
Database.ConquerItemTable.UpdateEnchant(i);
                    
Database.ConquerItemTable.UpdateBless(i);
                }
                
#endregion
                #region Sockets
                
if (ProSocket.Contains(PacketHandler.ItemPosition(i.ID)))
                {
                    if (
i.SocketOne > (Game.Enums.Gem)0)
                    {
                        
i.SocketOne Game.Enums.Gem.NoSocket;
                        
i.SocketTwo Game.Enums.Gem.NoSocket;
                        
i.Mode Game.Enums.ItemMode.Update;
                        
Database.ConquerItemTable.UpdateSockets(i);
                    }
                }
                
#endregion
                
i.Send(client);
            }
            
#endregion
            #endregion

        
}
        public 
void BlessTouch(GameState client)
        {

            if (!
client.Spells.ContainsKey(12390))
                return;

            if (
client.Weapons != null)
                if (
client.Weapons.Item2 != null)
                    if (
client.Weapons.Item2.ID 1000 != 619)
                        return;

            var 
spell2 SpellTable.GetSpell(client.Spells[12390].IDclient.Spells[12390].Level);
            if (
Kernel.Rate((double)spell2.Percent))
            {

                var 
spell Database.SpellTable.GetSpell(10954);
                
Entity.AddFlag(Update.Flags.Stigma);
                
Entity.StigmaStamp Time32.Now;
                
Entity.StigmaIncrease spell.PowerPercent;
                
Entity.StigmaTime = (byte)spell.Duration;
                if (
Entity.EntityFlag == EntityFlag.Entity)
                    
Send(Constants.Stigma(spell.PowerPercentspell.Duration));

                
spell Database.SpellTable.GetSpell(10904);
                
Entity.ShieldTime 0;
                
Entity.ShieldStamp Time32.Now;
                
Entity.MagicShieldStamp Time32.Now;
                
Entity.MagicShieldTime 0;

                
Entity.AddFlag(Update.Flags.MagicShield);
                
Entity.MagicShieldStamp Time32.Now;
                
Entity.MagicShieldIncrease 1.1f;//spell.PowerPercent;
                
Entity.MagicShieldTime = (byte)spell.Duration;
                if (
Entity.EntityFlag == EntityFlag.Entity)
                    
Send(Constants.Shield(spell.PowerPercentspell.Duration));

                
spell Database.SpellTable.GetSpell(10854);
                
Entity.AccuracyStamp Time32.Now;
                
Entity.StarOfAccuracyStamp Time32.Now;
                
Entity.StarOfAccuracyTime 0;
                
Entity.AccuracyTime 0;

                
Entity.AddFlag(Update.Flags.StarOfAccuracy);
                
Entity.StarOfAccuracyStamp Time32.Now;
                
Entity.StarOfAccuracyTime = (byte)spell.Duration;
                if (
Entity.EntityFlag == EntityFlag.Entity)
                    
Send(Constants.Accuracy(spell.Duration));

                
client.IncreaseSpellExperience(10012390);
            }
        }

        public 
void BreakTouch(GameState client)
        {
            if (!
client.Spells.ContainsKey(12400))
                return;
            if (
client.Weapons != null)
                if (
client.Weapons.Item2 != null)
                    if (
client.Weapons.Item2.ID 1000 != 619)
                        return;
            var 
spell SpellTable.GetSpell(client.Spells[12400].IDclient.Spells[12400].Level);
            if (
MyMath.Success((double)30))
            {
                if (
Entity.ContainsFlag3(Update.Flags3.lianhuaran04))
                {
                    
SpellUse suse = new SpellUse(true);
                    
suse.Attacker Entity.UID;
                    
suse.SpellID spell.ID;
                    
suse.SpellLevel spell.Level;

                    var array = 
Game.Attacking.Handle.EntityinRange(EntityEntity).ToArray();
                    foreach (var 
target in array)
                    {
                        var 
attacked target.Entity;
                        if (
attacked.UID == client.Entity.UID)
                            continue;
                        if (
Game.Attacking.Handle.CanAttack(client.Entityattackedspelltrue))
                        {
                            var 
attack = new Attack(true);
                            
attack.Attacker client.Entity.UID;
                            
attack.Attacked attacked.UID;

                            
uint damage Game.Attacking.Calculate.Magic(client.Entityattackedref attack);

                            
attack.Damage damage;
                            
suse.Effect1 attack.Effect1;
                            
suse.Effect1 attack.Effect1;

                            
Game.Attacking.Handle.ReceiveAttack(client.Entityattackedattackref damagespell);
                            
suse.AddTarget(attackeddamageattack);
                        }
                    }
                    
client.SendScreen(susetrue);

                    
Entity.RemoveFlag3(Update.Flags3.lianhuaran01);
                    
Entity.RemoveFlag3(Update.Flags3.lianhuaran02);
                    
Entity.RemoveFlag3(Update.Flags3.lianhuaran03);
                    
Entity.RemoveFlag3(Update.Flags3.lianhuaran04);
                }
                else if (
Entity.ContainsFlag3(Update.Flags3.lianhuaran03))
                {
                    
Entity.AddFlag3(Update.Flags3.lianhuaran04);
                    
Entity.RemoveFlag3(Update.Flags3.lianhuaran03);
                    
Entity.lianhuaranPercent 0.5f;
                }
                else if (
Entity.ContainsFlag3(Update.Flags3.lianhuaran02))
                {
                    
Entity.AddFlag3(Update.Flags3.lianhuaran03);
                    
Entity.RemoveFlag3(Update.Flags3.lianhuaran02);
                    
Entity.lianhuaranPercent 0.4f;
                }
                else if (
Entity.ContainsFlag3(Update.Flags3.lianhuaran01))
                {
                    
Entity.AddFlag3(Update.Flags3.lianhuaran02);
                    
Entity.RemoveFlag3(Update.Flags3.lianhuaran01);
                    
Entity.lianhuaranPercent 0.3f;
                }
                else if (!
Entity.ContainsFlag3(Update.Flags3.lianhuaran01))
                {
                    
Entity.AddFlag3(Update.Flags3.lianhuaran01);
                    
Entity.lianhuaranPercent 0.1f;
                }
                
Entity.lianhuaranStamp Time32.Now;
                
Entity.lianhuaranLeft 20;

                
client.IncreaseSpellExperience(10012400);
            }
        }
        public 
DateTime MatrixItem
        
{
            
get { return this["matrixitem"]; }
            
set
            
{
                
this["matrixitem"] = value;
            }
        }
        public 
DateTime matrixtime
        
{
            
get { return this["matrixtime"]; }
            
set
            
{
                
this["matrixtime"] = value;
            }
        }
        public 
ulong Donationx
        
{
            
get { return this["Donationx"]; }
            
set
            
{
                
this["Donationx"] = value;
            }
        }
        public 
bool OnDonation
        
{
            
get { return this["ondonation"]; }
            
set
            
{
                
this["ondonation"] = value;
            }
        }  
        public 
uint SashSlots
        
{
            
get { return Entity.ExtraInventory; }
            
set
            
{
                
Entity.ExtraInventory value;
                if (
Entity.EntityFlag == EntityFlag.Entity)
                {
                    
Entity.Update(Update.Sashvaluefalse);
                    
Entity.Update(Update.AvailableSlots200false);
                }
            }
        }
        
//public SafeDictionary<uint, OZUS.Inbox.PrizeInfo> Prizes = new SafeDictionary<uint, OZUS.Inbox.PrizeInfo>(1000);
        
public SafeDictionary<Mohamed_Hossam_Barakat.Network.GamePackets.Update.AuraTypeCopra.AurasAuras = new SafeDictionary<Update.AuraTypeCopra.Auras>(8);
        public 
GameState[] MonksInTeam()
        {
            return 
Team.Teammates.Where(=> x.Entity.Aura_isActive).ToArray();
        }
        public 
void CheckTeamAura()
        {
            if (
Team != null)
            {
                var 
monks MonksInTeam();
                if (
monks != null)
                {
                    foreach (var 
monk in monks)
                    {
                        
Update.AuraType aura Update.AuraType.TyrantAura;
                        switch (
monk.Entity.Aura_actType)
                        {
                            case 
Update.Flags2.EarthAuraaura Update.AuraType.EarthAura; break;
                            case 
Update.Flags2.FireAuraaura Update.AuraType.FireAura; break;
                            case 
Update.Flags2.WaterAuraaura Update.AuraType.WaterAura; break;
                            case 
Update.Flags2.WoodAuraaura Update.AuraType.WoodAura; break;
                            case 
Update.Flags2.MetalAuraaura Update.AuraType.MetalAura; break;
                            case 
Update.Flags2.FendAuraaura Update.AuraType.FendAura; break;
                            case 
Update.Flags2.TyrantAuraaura Update.AuraType.TyrantAura; break;
                        }
                        if (!
Auras.ContainsKey(aura))
                        {
                            if (
this.Entity.UID != monk.Entity.UID && Kernel.GetDistance(this.Entity.Xthis.Entity.Ymonk.Entity.Xmonk.Entity.Y) <= Constants.pScreenDistance)
                            {
                                
Copra.Auras Aura = new Copra.Auras();
                                
Aura.TeamAuraOwner monk;
                                
Aura.TeamAuraStatusFlag monk.Entity.Aura_actType;
                                
Aura.TeamAuraPower monk.Entity.Aura_actPower;
                                
Aura.TeamAuraLevel monk.Entity.Aura_actLevel;
                                
Aura.aura aura;
                                if (!
Auras.ContainsKey(Aura.aura))
                                {
                                    
Auras.Add(Aura.auraAura);
                                    
this.Entity.AddFlag2(Aura.TeamAuraStatusFlag);
                                    new 
Update(true).Aura(this.EntityUpdate.AuraDataTypes.AddauraAura.TeamAuraLevelAura.TeamAuraPower);
                                    
this.doAuraBonuses(Aura.TeamAuraStatusFlagAura.TeamAuraPower1);
                                }

                            }
                        }
                    }
                }
            }
            foreach (var 
Aura in Auras.Values.ToArray())
            {
                var 
pthis Aura.TeamAuraOwner;
                if (
pthis == null)
                {
                    new 
Update(true).Aura(this.EntityUpdate.AuraDataTypes.RemoveAura.auraAura.TeamAuraLevelAura.TeamAuraPower);
                    
//this.removeAuraBonuses(this.TeamAuraStatusFlag, this.TeamAuraPower, 1);
                    
this.removeAuraBonuses(Aura.TeamAuraStatusFlagAura.TeamAuraPower1);
                    
this.Entity.RemoveFlag2(Aura.TeamAuraStatusFlag);
                    
Auras.Remove(Aura.aura);
                }
                else
                {
                    if (!
pthis.Entity.Aura_isActive || !pthis.Socket.Alive || pthis.Entity.Dead || pthis.Entity.MapID != this.Entity.MapID || pthis.Entity.Aura_actType != Aura.TeamAuraStatusFlag)
                    {
                        new 
Update(true).Aura(this.EntityUpdate.AuraDataTypes.RemoveAura.auraAura.TeamAuraLevelAura.TeamAuraPower);
                        
//this.removeAuraBonuses(this.TeamAuraStatusFlag, this.TeamAuraPower, 1);
                        
this.removeAuraBonuses(Aura.TeamAuraStatusFlagAura.TeamAuraPower1);
                        
this.Entity.RemoveFlag2(Aura.TeamAuraStatusFlag);
                        
Auras.Remove(Aura.aura);
                    }
                    else
                    {
                        if (
this.Team == null || (pthis.Team == null || (pthis.Team != null && !pthis.Team.IsTeammate(this.Entity.UID))) || this.Entity.Dead || Kernel.GetDistance(this.Entity.Xthis.Entity.Ypthis.Entity.Xpthis.Entity.Y) > Constants.pScreenDistance)
                        {
                            new 
Update(true).Aura(this.EntityUpdate.AuraDataTypes.RemoveAura.auraAura.TeamAuraLevelAura.TeamAuraPower);
                            
this.removeAuraBonuses(Aura.TeamAuraStatusFlagAura.TeamAuraPower1);
                            
this.Entity.RemoveFlag2(Aura.TeamAuraStatusFlag);
                            
Auras.Remove(Aura.aura);
                        }
                    }
                }
            }


        }
        public 
Copra.ProgressBar ProgressBar;
        public 
bool TransferedEntity;
        public 
void ChangeName(GameState client)
        {
            
client.OnDisconnect =>
            {
                
#region ChangeName progress
                
string name200 p.Entity.Name;
                
string newname p.NewName;
                
uint uid p.Entity.UID;
                if (
newname != "")
                {
                    
Mohamed_Hossam_Barakat.Console.WriteLine("Change Name In Progress");
                    if (
newname != "")
                    {
                        
Database.MySqlCommand cmdupdate null;
                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("apprentice").Set("MentorName"newname).Where("MentorID"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("apprentice").Set("ApprenticeName"newname).Where("ApprenticeID"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("arena").Set("EntityName"newname).Where("EntityID"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("claimitems").Set("OwnerName"newname).Where("OwnerUID"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("claimitems").Set("GainerName"newname).Where("GainerUID"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("detaineditems").Set("OwnerName"newname).Where("OwnerUID"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("detaineditems").Set("GainerName"newname).Where("GainerUID"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("enemy").Set("EnemyName"newname).Where("EnemyID"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("friends").Set("FriendName"newname).Where("FriendID"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("guilds").Set("LeaderName"newname).Where("LeaderName"name200).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("clans").Set("LeaderName"newname).Where("LeaderName"name200).Execute();

                        if (
p.Entity.MyJiang != null)
                        {
                            
p.Entity.MyJiang.OwnName newname;
                            
Game.JiangHu.JiangHuClients[p.Entity.UID] = p.Entity.MyJiang;
                        }
                       

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("nobility").Set("EntityName"newname).Where("EntityUID"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("partners").Set("PartnerName"newname).Where("PartnerID"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("chi").Set("name"newname).Where("uid"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("teamarena").Set("EntityName"newname).Where("EntityID"uid).Execute();

                        
cmdupdate = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
                        
cmdupdate.Update("entities").Set("name"newname).Set("namechange""").Where("UID"uid).Execute();
                        
Console.WriteLine(" -[" name200 "] : -[" newname "]");


                        if (
Game.ConquerStructures.Nobility.Board.ContainsKey(p.Entity.UID))
                        {
                            
Game.ConquerStructures.Nobility.Board[p.Entity.UID].Name p.NewName;
                        }
                        if (
Arena.ArenaStatistics.ContainsKey(p.Entity.UID))
                        {
                            
Arena.ArenaStatistics[p.Entity.UID].Name p.NewName;
                        }
                        if (
p.Entity.GetClan != null)
                        {
                            if (
p.Entity.GetClan.LeaderName == name200)
                            {
                                
Kernel.Clans[p.Entity.ClanId].LeaderName p.NewName;
                            }

                            
Kernel.Clans[p.Entity.ClanId].Members[p.Entity.UID].Name p.NewName;
                        }
                        if (
p.Guild != null)
                        {
                            if (
p.Guild.LeaderName == name200)
                            {
                                
Kernel.Guilds[p.Guild.ID].LeaderName p.NewName;
                            }

                            
Kernel.Guilds[p.Guild.ID].Members[p.Entity.UID].Name p.NewName;
                        }

                    }
                }
                
#endregion ChangeName progressa
            
};
            
client.Disconnect();
        }
        public 
string Country getset; }
        public 
short GetDistance(IMapObject obj)
        {
            return 
Kernel.GetDistance(Entity.XEntity.Yobj.Xobj.Y);
        }
        public 
DateTime timerattack = new DateTime();
        public 
GameState LobbyPlayWith;
        public 
bool LobbySignup
        
{
            
get { return this["LobbySignup"]; }
            
set
            
{
                
this["LobbySignup"] = value;
            }
        }
        public 
ushort SuperPotion
        
{
            
get { return this["SuperPotion"]; }
            
set
            
{
                
this["SuperPotion"] = value;
                if (
Entity.FullyLoaded)
                    if (
Entity.EntityFlag == EntityFlag.Entity)
                    {
                        if (
this != null)
                        {
                            
Entity.Update(Network.GamePackets.Update.DoubleExpTimerEntity.DoubleExperienceTime500false);
                        }
                    }
            }
        }
        public 
Lobby.QualifierGroup LobbyGroup;
        public 
void GetLanguages(string language)
        {
            switch (
language)
            {
                case 
"En":
                    
Language Languages.English;
                    break;
                case 
"Ar":
                    
Language Languages.Arabic;
                    break;
            }

        }
        public 
Languages Language Languages.English;
        public 
Copra.Pet Pet;
        public 
Copra.Quests Quests;
        public 
MaTrix.AI AI;
        public 
SafeDictionary<uintMailbox.PrizeInfoPrizes = new SafeDictionary<uintMailbox.PrizeInfo>(1000);
       
// public SafeDictionary<Copra.Reward.Event, Copra.Reward.RewardInfo> Rewards = new SafeDictionary<Copra.Reward.Event, Copra.Reward.RewardInfo>(1000);
        
public SafeDictionary<uintCopra.Way2Heroes.StageInfoWay2Heroes = new SafeDictionary<uintCopra.Way2Heroes.StageInfo>();
        public 
string NewName "";
        public 
byte Claimeds
        
{
            
get { return this["Claimeds"]; }
            
set
            
{
                
this["Claimeds"] = value;
            }
        }
        public 
bool JiangActive false;
        public 
bool StudyToday
        
{
            
get { return this["StudyToday"]; }
            
set
            
{
                
this["StudyToday"] = value;
            }
        }
        public 
uint UsedCourses
        
{
            
get { return this["UsedCourses"]; }
            
set
            
{
                
this["UsedCourses"] = value;
            }
        }
        public 
DateTime ResetUsedCourses
        
{
            
get { return this["ResetUsedCourses"]; }
            
set
            
{
                
this["ResetUsedCourses"] = value;
            }
        }
        public 
bool JoinedDBMap
        
{
            
get { return this["JoinedDBMap"]; }
            
set
            
{
                
this["JoinedDBMap"] = value;
            }
        }
        public 
DateTime inDBmap
        
{
            
get { return this["inDBmap"]; }
            
set
            
{
                
this["inDBmap"] = value;
            }
        }
        public 
uint Appearance
        
{
            
get { return this["Appearance"]; }
            
set
            
{
                
this["Appearance"] = value;
            }
        }
        public 
uint ClaimedElitePk
        
{
            
get { return this["ClaimedElitePk"]; }
            
set this["ClaimedElitePk"] = value; }
        }
        public 
uint ClaimedTeampk
        
{
            
get { return this["ClaimedTeampk"]; }
            
set this["ClaimedTeampk"] = value; }
        }
        public 
uint ClaimedSkillTeam
        
{
            
get { return this["ClaimedSkillTeam"]; }
            
set this["ClaimedSkillTeam"] = value; }
        }
        public 
bool _voted;
        public 
bool Voted
        
{
            
get
            
{
                return 
_voted;
            }
            
set
            
{
                
_voted value;
                new 
Database.MySqlCommand(Mohamed_Hossam_Barakat.Database.MySqlCommandType.UPDATE)
                    .
Update("entities").Set("VotePoint"value).Where("UID"Entity.UID).Execute();

            }
        }
        public 
DateTime VoteStamp
        
{
            
get { return this["VoteStamp"]; }
            
set
            
{
                
this["VoteStamp"] = value;
            }
        }
        public 
uint namechanges
        
{
            
get { return this["namechanges"]; }
            
set
            
{
                
this["namechanges"] = value;
            }
        }
        public 
string Command "";
        public 
bool endarena false;
        public 
bool endteam false;
        public 
IDisposable[] TimerSubscriptions;
        public 
object TimerSyncRootItemSyncRoot;
        public 
Time32 LastVIPTeleportLastVIPTeamTeleport;
        public 
bool AlternateEquipment;
        private 
ClientWrapper _socket;
        public 
Database.AccountTable Account;
        public 
GameCryptography Cryptography;
        public 
DHKeyExchange.ServerKeyExchange DHKeyExchange;
        public 
bool Exchange true;
        public 
ConcurrentPacketQueue Queue;
        public 
PacketFilter PacketFilter;
        public 
Time32 CantAttack Time32.Now;
        public 
bool Filtering false;
        public 
Network.GamePackets.Interaction Interaction;
        public 
int quarantineKill 0;
        public 
int quarantineDeath 0;
        public 
int TopDlClaim 0;
        public 
int TopGlClaim 0;
        public 
uint uniquepoints 0;
        public 
Action<GameStateOnDisconnect;
        public 
int apprtnum 0;
        public 
Game.Enums.Color staticArmorColor;
        public 
bool JustCreated false;
        public 
Timer Timer;
        
#region Network

        
public GameState(ClientWrapper socket)
        {
            
Fake socket == null;
            if (
Fakesocket = new ClientWrapper() { Alive true };
            
Queue = new ConcurrentPacketQueue();
            
PacketFilter = new PacketFilter() { { 1001010 }, { 10005}, { 2064}, { 2032}, { 1027} };
            
Attackable false;
            
Action 0;
            
_socket socket;

            
Cryptography = new GameCryptography(Program.Encoding.GetBytes(Constants.GameCryptographyKey));
            if (
Program.TestingMode)
                
Cryptography = new GameCryptography(Program.Encoding.GetBytes(Constants.GameCryptographyKey));
            
DHKeyExchange = new Network.GamePackets.DHKeyExchange.ServerKeyExchange();
            
//SpiritBeadQ = new Game.Features.SpiritBeadQuest(this);
            
ChiPowers = new List<ChiPowerStructure>();
            
Retretead_ChiPowers = new ChiPowerStructure[4];
            
//JiangPowers = new List<JiangPowerStructure>();
        
}
        public 
bool Ninja()
        {
            if (
Entity.EntityFlag == Game.EntityFlag.Entity)
            {
                if (
Entity.Class >= 50 && Entity.Class <= 55)
                    return 
true;
                else
                    return 
false;
            }
            return 
false;
        }
        public 
void ReadyToPlay()
        {
            try
            {
                
Weapons = new Tuple<ConquerItemConquerItem>(nullnull);
                
ItemSyncRoot = new object();
                
Screen = new Game.Screen(this);
                
//  if (!Program.ServerTransfer)
                
{
                    
Pet = new Copra.Pet(this);
                    
AI = new AI(this);
                }
                
Inventory = new Game.ConquerStructures.Inventory(this);
                
Equipment = new Game.ConquerStructures.Equipment(this);
                
WarehouseOpen false;
                
WarehouseOpenTries 0;
                
TempPassword "";
                
ArsenalDonations = new uint[10];
                if (
Account != null)
                {
                    
Warehouses = new SafeDictionary<Game.ConquerStructures.Warehouse.WarehouseIDGame.ConquerStructures.Warehouse>(20);
                    
Warehouses.Add((Mohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID)this.Account.EntityID, new Game.ConquerStructures.Warehouse(this, (Mohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID)this.Account.EntityID200));
                    
Warehouses.Add(Mohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.TwinCity, new Game.ConquerStructures.Warehouse(thisMohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.TwinCity));
                    
Warehouses.Add(Mohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.PhoenixCity, new Game.ConquerStructures.Warehouse(thisMohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.PhoenixCity));
                    
Warehouses.Add(Mohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.ApeCity, new Game.ConquerStructures.Warehouse(thisMohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.ApeCity));
                    
Warehouses.Add(Mohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.DesertCity, new Game.ConquerStructures.Warehouse(thisMohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.DesertCity));
                    
Warehouses.Add(Mohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.BirdCity, new Game.ConquerStructures.Warehouse(thisMohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.BirdCity));
                    
Warehouses.Add(Mohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity, new Game.ConquerStructures.Warehouse(thisMohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity));
                    
Warehouses.Add(Mohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.Market, new Game.ConquerStructures.Warehouse(thisMohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID.Market));
                    if (
Account != null)
                    {
                        if (!
Warehouses.ContainsKey((Mohamed_Hossam_Barakat.Game.ConquerStructures.Warehouse.WarehouseID)Account.EntityID))
                            
Warehouses.Add((Game.ConquerStructures.Warehouse.WarehouseID)Account.EntityID, new Game.ConquerStructures.Warehouse(this, (Game.ConquerStructures.Warehouse.WarehouseID)Account.EntityID));
                    }
                }
                
Trade = new Game.ConquerStructures.Trade();
                
ArenaStatistic = new ArenaStatistic(true);
                
// CP = new ChampionPoints();
                
Prayers = new List<GameState>();
                
map null;
                
Quests = new Copra.Quests(this);
                
//JiangHuStatus = new JiangHuStatus();
            
}
            catch (
Exception e)
            {
                
Program.SaveException(e);
            }
        }
        public 
void Send(byte[] buffer)
        {
            if (
Fake) return;
            if (!
_socket.Alive) return;
            
ushort length BitConverter.ToUInt16(buffer0);
            if (
length >= 1024 && buffer.Length length)
            {
                
//Console.WriteLine(Environment.StackTrace);
                
return;
            }
            
byte[] _buffer = new byte[buffer.Length];
            if (
length == 0)
                
Writer.WriteUInt16((ushort)(buffer.Length 8), 0buffer);
            
Buffer.BlockCopy(buffer0_buffer0buffer.Length);
            
Network.Writer.WriteString(Constants.ServerKey_buffer.Length 8_buffer);
            try
            {
                
lock (_socket)
                {
                    if (!
_socket.Alive) return;
                    
lock (Cryptography)
                    {
                        
Cryptography.Encrypt(_buffer_buffer.Length);
                        
_socket.Send(_buffer);
                    }
                }
            }
            catch (
Exception)
            {
                
_socket.Alive false;
                
Disconnect();
            }
        }
        private 
void EndSend(IAsyncResult res)
        {
            try
            {
                
_socket.Socket.EndSend(res);
            }
            catch
            {
                
_socket.Alive false;
                
Disconnect();
            }
        }
        public 
void Send(Interfaces.IPacket buffer)
        {
            
Send(buffer.ToArray());
        }
        public 
void SendScreenSpawn(Interfaces.IMapObject objbool self)
        {
            try
            {
                foreach (
Interfaces.IMapObject _obj in Screen.Objects)
                {
                    if (
_obj == null)
                        continue;
                    if (
_obj.UID != Entity.UID)
                    {
                        if (
_obj.MapObjType == Game.MapObjectType.Entity)
                        {
                            
GameState client _obj.Owner as GameState;
                            
obj.SendSpawn(clientfalse);
                        }
                    }
                }
                if (
self)
                    
obj.SendSpawn(this);
            }
            catch (
Exception e)
            {
                
Program.SaveException(e);
            }
        }
        public 
void RemoveScreenSpawn(Interfaces.IMapObject objbool self)
        {
            try
            {
                if (
Screen == null) return;
                if (
Screen.Objects == null) return;
                foreach (
Interfaces.IMapObject _obj in Screen.Objects)
                {
                    if (
_obj == null) continue;
                    if (
obj == null) continue;
                    if (
_obj.UID != Entity.UID)
                    {
                        if (
_obj.MapObjType == Game.MapObjectType.Entity)
                        {
                            
GameState client _obj.Owner as GameState;
                            
client.Screen.Remove(obj);
                        }
                    }
                }
                if (
self)
                    
Screen.Remove(obj);
            }
            catch (
Exception e)
            {
                
Program.SaveException(e);
            }
        }
        public 
void SendScreen(byte[] bufferbool self true)
        {
            try
            {
                foreach (
Interfaces.IMapObject obj in Screen.Objects)
                {
                    if (
obj == null) continue;
                    if (
obj.UID != Entity.UID)
                    {
                        if (
obj.MapObjType == Game.MapObjectType.Entity)
                        {
                            
GameState client obj.Owner as GameState;
                            if (
WatchingGroup != null && client.WatchingGroup == null)
                                continue;
                            
client.Send(buffer);
                        }
                    }
                }
                if (
self)
                    
Send(buffer);
            }
            catch (
Exception e)
            {
                
Program.SaveException(e);
            }
        }
        public 
void SendScreen(Interfaces.IPacket bufferbool self true)
        {
            foreach (
Interfaces.IMapObject obj in Screen.Objects)
            {
                if (
obj == null) continue;
                if (
obj.MapObjType == Game.MapObjectType.Entity)
                {
                    
GameState client obj.Owner as GameState;
                    if (
client.Entity.UID != Entity.UID)
                        
client.Send(buffer);
                }
            }
            if (
self)
                
Send(buffer);
        }
        public 
void Disconnect(bool save true)
        {
            if (
Fake) return;
            if (
Screen != nullScreen.DisposeTimers();
            
PacketHandler.RemoveTPA(this);
            
Program.World.Unregister(this);
            if (
OnDisconnect != nullOnDisconnect(this);
            if (
_socket.Connector != null)
            {
                if (
Entity != null)
                {
                    
CheckPokerDisconnect();
                }
                
_socket.Disconnect();
                
ShutDown();
            }
            
/*    if (_socket.Connector != null)
                {
                    if (Entity != null)
                    {
                        if (Entity.MyPokerTable != null)
                        {
                            if (Entity.MyPokerTable.Entitys.ContainsKey(Entity.UID) && Entity.MyPokerTable.Pot > 1)
                            {
                                byte[] P = new byte[10];
                                P[6] = 4; P[9] = 200;
                                Entity.MyPokerTable.NewEntityMove(P, Entity.UID);
                            }
                            else
                                Entity.MyPokerTable.RemoveEntity(Entity.UID);
                        }
                    }
                    _socket.Disconnect();
                    ShutDown();
                }*/
        
}

        private 
void ShutDown()
        {

            if (
Socket.Connector == null) return;
            
Socket.Connector null;
            if (
this.Entity != null)
            {
                try
                {
                    if (
this.Entity.JustCreated) return;
                    
Time32 now Time32.Now;
                    
Kernel.DisconnectPool.Add(this.Entity.UIDthis);
                    
RemoveScreenSpawn(this.Entityfalse);

                    
Database.EntityTable.UpdateOnlineStatus(thisfalse);
                    
Database.EntityTable.SaveEntity(this);
                    if (!
TransferedEntity)
                        
Database.EntityVariableTable.Save(this);
                    
Database.SkillTable.SaveProficiencies(this);
                    if (!
TransferedEntity)
                    {
                        
Database.ArenaTable.SaveArenaStatistics(this.ArenaStatistic);
                        
Database.TeamArenaTable.SaveArenaStatistics(this.TeamArenaStatistic);
                    }
                    
Kernel.GamePool.Remove(this.Entity.UID);

                    if (
Booth != null)
                        
Booth.Remove();

                    if (
Entity.MyClones.Count 0)
                    {
                        foreach (var 
item in Entity.MyClones.Values)
                        {
                            
Data data = new Data(true);
                            
data.UID item.UID;
                            
data.ID Network.GamePackets.Data.RemoveEntity;
                            
item.MonsterInfo.SendScreen(data);
                        }
                        
Entity.MyClones.Clear();
                    }
                    if (
Quests != null)
                        
Quests.Save();

                    if (
Pet != null)
                        
Pet.ClearAll();
                    if (
QualifierGroup != null)
                        
QualifierGroup.End(this);
                    if (
TeamQualifierGroup != null)
                        
TeamQualifierGroup.CheckEnd(thistrue);
                    if (
Entity.CLanArenaBattleFight != null)
                        
Entity.CLanArenaBattleFight.CheakToEnd(thistrue);
                    if (
Entity.GuildArenaBattleFight != null)
                        
Entity.GuildArenaBattleFight.CheakToEnd(thistrue);
                    if (
Challenge != null)
                        
Challenge.End(this);



                    
Game.Arena.Clear(this);
                    
Game.TeamArena.Clear(this);

                    
RemoveScreenSpawn(this.Entityfalse);

                    
#region Friend/TradePartner/Apprentice
                    
Message msg = new Message("Your friend, " Entity.Name ", has logged off."System.Drawing.Color.RedMessage.TopLeft);
                    if (
Friends == null)
                        
Friends = new SafeDictionary<uintGame.ConquerStructures.Society.Friend>(100);
                    foreach (
Game.ConquerStructures.Society.Friend friend in Friends.Values)
                    {
                        if (
friend.IsOnline)
                        {
                            var 
packet = new Network.GamePackets.KnownPersons(true)
                            {
                                
UID Entity.UID,
                                
Type Network.GamePackets.KnownPersons.RemovePerson,
                                
Name Entity.Name,
                                
Online false
                            
};
                            
friend.Client.Send(packet);
                            
packet.Type Network.GamePackets.KnownPersons.AddFriend;
                            if (
friend != null)
                            {
                                if (
friend.Client != null)
                                {
                                    
friend.Client.Send(packet);
                                    
friend.Client.Send(msg);
                                }
                            }
                        }
                    }
                    
Message msg2 = new Message("Your partner, " Entity.Name ", has logged off."System.Drawing.Color.RedMessage.TopLeft);

                    if (
Partners != null)
                    {
                        foreach (
Game.ConquerStructures.Society.TradePartner partner in Partners.Values)
                        {
                            if (
partner.IsOnline)
                            {
                                var 
packet = new TradePartner(true)
                                {
                                    
UID Entity.UID,
                                    
Type TradePartner.BreakPartnership,
                                    
Name Entity.Name,
                                    
HoursLeft = (int)(new TimeSpan(partner.ProbationStartedOn.AddDays(3).Ticks).TotalHours - new TimeSpan(DateTime.Now.Ticks).TotalHours),
                                    
Online false
                                
};
                                
partner.Client.Send(packet);
                                
packet.Type TradePartner.AddPartner;
                                if (
partner != null)
                                {
                                    if (
partner.Client != null)
                                    {
                                        
partner.Client.Send(packet);
                                        
partner.Client.Send(msg2);
                                    }
                                }
                            }
                        }
                    }
                    
MentorInformation Information = new MentorInformation(true);
                    
Information.Mentor_Type 1;
                    
Information.Mentor_ID Entity.UID;
                    
Information.Mentor_Level Entity.Level;
                    
Information.Mentor_Class Entity.Class;
                    
Information.Mentor_PkPoints Entity.PKPoints;
                    
Information.Mentor_Mesh Entity.Mesh;
                    
Information.Mentor_Online false;
                    
Information.String_Count 3;
                    
Information.Mentor_Name Entity.Name;
                    
Information.Mentor_Spouse_Name Entity.Spouse;
                    if (
Apprentices == nullApprentices = new SafeDictionary<uintGame.ConquerStructures.Society.Apprentice>();
                    foreach (var 
appr in Apprentices.Values)
                    {
                        if (
appr.IsOnline)
                        {
                            
Information.Apprentice_ID appr.ID;
                            
Information.Enrole_Date appr.EnroleDate;
                            
Information.Apprentice_Name appr.Name;
                            
appr.Client.Send(Information);
                            
appr.Client.ReviewMentor();
                        }
                    }
                    if (
Mentor != null)
                    {
                        if (
Mentor.IsOnline)
                        {
                            
ApprenticeInformation AppInfo = new ApprenticeInformation();
                            
AppInfo.Apprentice_ID Entity.UID;
                            
AppInfo.Apprentice_Level Entity.Level;
                            
AppInfo.Apprentice_Name Entity.Name;
                            
AppInfo.Apprentice_Online false;
                            
AppInfo.Apprentice_Spouse_Name Entity.Spouse;
                            
AppInfo.Enrole_date Mentor.EnroleDate;
                            
AppInfo.Mentor_ID Mentor.Client.Entity.UID;
                            
AppInfo.Mentor_Mesh Mentor.Client.Entity.Mesh;
                            
AppInfo.Mentor_Name Mentor.Client.Entity.Name;
                            
AppInfo.Type 2;
                            
Mentor.Client.Send(AppInfo);
                        }
                    }

                    
#endregion
                    #region Team
                    /* if (Team != null) 
                    { 
                        if (Team.TeamLeader) 
                        { 
                            Network.GamePackets.Team team = new Network.GamePackets.Team(); 
                            team.UID = Account.EntityID; 
                            team.Type = Network.GamePackets.Team.Dismiss; 
                            foreach (Client.GameState Teammate in Team.Teammates) 
                            { 
                                if (Teammate != null) 
                                { 
                                    if (Teammate.Entity.UID != Account.EntityID) 
                                    { 
                                        Teammate.Send(team); 
                                        Teammate.Team = null; 
                                    } 
                                } 
                            } 
                        } 
                        else 
                        { 
                            Network.GamePackets.Team team = new Network.GamePackets.Team(); 
                            team.UID = Account.EntityID; 
                            team.Type = Network.GamePackets.Team.ExitTeam; 
                            foreach (Client.GameState Teammate in Team.Teammates) 
                            { 
                                if (Teammate != null) 
                                { 
                                    if (Teammate.Entity.UID != Account.EntityID) 
                                    { 
                                        Teammate.Send(team); 
                                        Teammate.Team.Remove(this); 
                                    } 
                                } 
                            } 
                        } 
                    }*/
                    #endregion
                    
if (Team != null)
                    {
                        
Team.Remove(thistrue);
                    }
                }
                catch (
Exception e)
                {
                    
Program.SaveException(e);
                }
                finally
                {
                    
Kernel.DisconnectPool.Remove(this.Entity.UID);
                    
Console.WriteLine("Name==>" this.Entity.Name "*Has Login [Off]*"ConsoleColor.Blue);
                }
            }
        }
        

        public 
ClientWrapper Socket get { return _socket; } }
        public 
string IP
        
{
            
get
            
{
                return 
_socket.IP;
            }
        }
        
#endregion

        #region Game
        #region UnionStructure
        
public byte UnionType
        
{
            
set
            
{
                
Entity.SpawnPacket[Entity._UnionType    ] = value;
                
SendScreen(Entity.SpawnPacketfalse);
            }
        }
        public 
Mohamed_Hossam_Barakat.Network.GamePackets.Union.UnionClass Union;
        public 
uint UnionTitle
        
{
            
get
            
{

                if (
Union != null)
                {
                    if (
Union.IsKingdom())
                    {
                        return (
uint)(Offical Harem Guards);
                    }
                }
                return 
0;
            }
        }
        
uint _UnionID;
        public 
uint UnionID
        
{
            
get
            
{
                return 
_UnionID;
            }
            
set
            
{

                
_UnionID value;
                
Entity.SpawnPacket[Entity._UnionID] = (byte)_UnionID;
                
Entity.UpdateDatabase2("UnionID"_UnionID);
                
SendScreen(Entity.SpawnPacketfalse);
            }
        }
        
byte _UnionRank;
        public 
byte UnionRank
        
{
            
get
            
{
                return 
_UnionRank;
            }
            
set
            
{
                
_UnionRank value;
                
Entity.SpawnPacket[Entity._UnionRank] = value;
                
SendScreen(Entity.SpawnPacketfalse);
            }
        }
        
uint _UnionExploits 0;
        public 
uint UnionExploits
        
{
            
get
            
{
                return 
_UnionExploits;
            }
            
set
            
{

                
_UnionExploits value;
                
Entity.UpdateDatabase2("UnionExploits"_UnionExploits);
                
byte i 0;
                if (
_UnionExploits >= 200)
                    
+= 1;
                if (
_UnionExploits >= 500)
                    
+= 1;
                if (
_UnionExploits >= 1000)
                    
+= 1;
                if (
_UnionExploits >= 1500)
                    
+= 1;
                if (
_UnionExploits >= 2100)
                    
+= 1;
                if (
_UnionExploits >= 2800)
                    
+= 1;
                if (
_UnionExploits >= 3700)
                    
+= 1;
                if (
_UnionExploits >= 4700)
                    
+= 1;
                if (
_UnionExploits >= 6000)
                    
+= 1;
                if (
_UnionExploits >= 7500)
                    
+= 1;
                if (
_UnionExploits >= 10000)
                    
+= 1;
                if (
_UnionExploits >= 15000)
                    
+= 1;
                if (
_UnionExploits >= 23000)
                    
+= 1;
                
Entity.SpawnPacket[Entity._UnionExploits] = i;
                if (
Entity.EntityFlag == EntityFlag.Entity)
                {
                    
Entity.Update((byte)Update.DataType.MilitaryRankitrue);
                    
Entity.Update((byte)Update.DataType.MilitaryExploits_UnionExploitstrue);
                }
            }
        }
        public static 
GameState GetClientFromID(uint id)
        {
            foreach (var 
client in Kernel.GamePool.Values)
            {
                if (
client.Entity.UID == id)
                {
                    return 
client;
                }
            }
            return 
null;
        }
        public static 
GameState GetClientFromName(string name)
        {
            foreach (var 
clientq in Kernel.GamePool.Values)
            {
                if (
clientq.Entity.Name == name)
                {
                    return 
clientq;
                }
            }
            return 
null;
        }
        
ushort _Offical;
        public 
ushort Offical
        
{
            
get
            
{
                return 
_Offical;
            }
            
set
            
{

                
_Offical value;
                
Entity.Ushort((ushort)(Offical Harem Guards), 278 4Entity.SpawnPacket);
                if (
Entity.EntityFlag == EntityFlag.Entity)
                {
                    
Entity.Update((byte)Update.DataType.UnionRank, (ushort)(Offical Harem Guards), true);
                }
                
SendScreen(Entity.SpawnPacketfalse);
                
Entity.UpdateDatabase2("Offical"value);
            }
        }
        
ushort _Harem;
        public 
ushort Harem
        
{
            
get
            
{

                return 
_Harem;
            }
            
set
            
{

                
_Harem value;
                
Entity.Ushort((ushort)(Offical Harem Guards), 278 4Entity.SpawnPacket);
                if (
Entity.EntityFlag == EntityFlag.Entity)
                {
                    
Entity.Update((byte)Update.DataType.UnionRank, (ushort)(Offical Harem Guards), true);
                }
                
SendScreen(Entity.SpawnPacketfalse);
                
Entity.UpdateDatabase2("Harem"value);
            }
        }
        
ushort _Guards;
        public 
ushort Guards
        
{
            
get
            
{

                return 
_Guards;
            }
            
set
            
{

                
_Guards value;
                
Entity.Ushort((ushort)(Offical Harem Guards), 278 4Entity.SpawnPacket);
                if (
Entity.EntityFlag == EntityFlag.Entity)
                {
                    
Entity.Update((byte)Update.DataType.UnionRank, (ushort)(Offical Harem Guards), true);
                }
                
SendScreen(Entity.SpawnPacketfalse);
                
Entity.UpdateDatabase2("Guards"value);
            }
        }
        
#endregion
        
public Database.ChiTable.ChiData ChiData;
        public List<
ChiPowerStructureChiPowers;
        public 
ChiPowerStructure[] Retretead_ChiPowers;
        public 
uint ChiPoints 0;

        
//public List<JiangPowerStructure> JiangPowers;
        //public JiangHuStatus JiangHuStatus;
        //public JiangHu JiangHu;
        
public SafeDictionary<uintDetainedItemClaimableItem = new SafeDictionary<uintDetainedItem>(1000),
                                                  
DeatinedItem = new SafeDictionary<uintDetainedItem>(1000);

        public 
bool DoSetOffline true;

        public 
ushort OnlineTrainingPoints 0;
        public 
Time32 LastTrainingPointsUpLastTreasurePoints Time32.Now.AddMinutes(1);

        public List<
stringGuildNamesSpawned = new List<string>();

        public 
byte KylinUpgradeCount 0;

        public 
ulong OblivionExperience 0;
        public 
byte OblivionKills 0;

        public 
int PremShopType 0;
        public 
DateTime VIPDate;
        public 
DateTime LastVote;
        public 
uint VIPDays;
        public 
uint DonationPoints;
        
//  public uint VotePoints;
        #region Colo
        
public static uint ScreenColor 0;
        
#region Night Color

        
public void Night()
        {
            
ScreenColor 5855577;

            
Network.GamePackets.ScreenColor Packet = new Network.GamePackets.ScreenColor(true);
            
Packet.UID this.Entity.UID;
            
Packet.ID 104;
            
Packet.dwParam ScreenColor;
            foreach (
GameState pclient in Kernel.GamePool.Values)
            {
                
pclient.Send(Packet);
            }
        }
        public 
void Night1()
        {
            
ScreenColor 3358767;

            
Network.GamePackets.ScreenColor Packet = new Network.GamePackets.ScreenColor(true);
            
Packet.UID this.Entity.UID;
            
Packet.ID 104;
            
Packet.dwParam ScreenColor;
            foreach (
GameState pclient in Kernel.GamePool.Values)
            {
                
pclient.Send(Packet);
            }
        }
        public 
void Night2()
        {
            
ScreenColor 97358;

            
Network.GamePackets.ScreenColor Packet = new Network.GamePackets.ScreenColor(true);
            
Packet.UID this.Entity.UID;
            
Packet.ID 104;
            
Packet.dwParam ScreenColor;
            foreach (
GameState pclient in Kernel.GamePool.Values)
            {
                
pclient.Send(Packet);
            }
        }

        
#endregion
        #region Blue Color

        
public void Blue()
        {
            
ScreenColor 69852;

            
Network.GamePackets.ScreenColor Packet = new Network.GamePackets.ScreenColor(true);
            
Packet.UID this.Entity.UID;
            
Packet.ID 104;
            
Packet.dwParam ScreenColor;
            foreach (
GameState pclient in Kernel.GamePool.Values)
            {
                
pclient.Send(Packet);
            }
        }
        public 
void Blue1()
        {
            
ScreenColor 4532453;

            
Network.GamePackets.ScreenColor Packet = new Network.GamePackets.ScreenColor(true);
            
Packet.UID this.Entity.UID;
            
Packet.ID 104;
            
Packet.dwParam ScreenColor;
            foreach (
GameState pclient in Kernel.GamePool.Values)
            {
                
pclient.Send(Packet);
            }
        }
        public 
void Blue2()
        {
            
ScreenColor 684533;

            
Network.GamePackets.ScreenColor Packet = new Network.GamePackets.ScreenColor(true);
            
Packet.UID this.Entity.UID;
            
Packet.ID 104;
            
Packet.dwParam ScreenColor;
            foreach (
GameState pclient in Kernel.GamePool.Values)
            {
                
pclient.Send(Packet);
            }
        }

        
#endregion
        #region Green Color

        
public void Green()
        {
            
ScreenColor 838915;

            
Network.GamePackets.ScreenColor Packet = new Network.GamePackets.ScreenColor(true);
            
Packet.UID this.Entity.UID;
            
Packet.ID 104;
            
Packet.dwParam ScreenColor;
            foreach (
GameState pclient in Kernel.GamePool.Values)
            {
                
pclient.Send(Packet);
            }
        }
        public 
void Green1()
        {
            
ScreenColor 824383;

            
Network.GamePackets.ScreenColor Packet = new Network.GamePackets.ScreenColor(true);
            
Packet.UID this.Entity.UID;
            
Packet.ID 104;
            
Packet.dwParam ScreenColor;
            foreach (
GameState pclient in Kernel.GamePool.Values)
            {
                
pclient.Send(Packet);
            }
        }
        public 
void Green2()
        {
            
ScreenColor 456828;

            
Network.GamePackets.ScreenColor Packet = new Network.GamePackets.ScreenColor(true);
            
Packet.UID this.Entity.UID;
            
Packet.ID 104;
            
Packet.dwParam ScreenColor;
            foreach (
GameState pclient in Kernel.GamePool.Values)
            {
                
pclient.Send(Packet);
            }
        }
        public 
void Green3()
        {
            
ScreenColor 5547633;

            
Network.GamePackets.ScreenColor Packet = new Network.GamePackets.ScreenColor(true);
            
Packet.UID this.Entity.UID;
            
Packet.ID 104;
            
Packet.dwParam ScreenColor;
            foreach (
GameState pclient in Kernel.GamePool.Values)
            {
                
pclient.Send(Packet);
            }
        }
        public 
void Green4()
        {
            
ScreenColor 453450;

            
Network.GamePackets.ScreenColor Packet = new Network.GamePackets.ScreenColor(true);
            
Packet.UID this.Entity.UID;
            
Packet.ID 104;
            
Packet.dwParam ScreenColor;
            foreach (
GameState pclient in Kernel.GamePool.Values)
            {
                
pclient.Send(Packet);
            }
        }

        
#endregion
        #region Day Color

        
public void Day()
        {
            
ScreenColor 0;

            
Network.GamePackets.ScreenColor Packet = new Network.GamePackets.ScreenColor(true);
            
Packet.UID this.Entity.UID;
            
Packet.ID 104;
            
Packet.dwParam ScreenColor;
            foreach (
GameState pclient in Kernel.GamePool.Values)
            {
                
pclient.Send(Packet);
            }
        }

        
#endregion
        #endregion
        
public Time32 ScreenReloadTime;
        public 
int MillisecondsScreenReload;
        public 
bool Reloaded false;
        public 
Interfaces.IPacket ReloadWith;
        public 
ushort VendingDisguise;
        private 
uint _BlessTime;
        public 
uint BlessTime
        
{
            
get { return _BlessTime; }
            
set
            
{
                
_BlessTime value;
                if (
Entity != null)
                { 
this["BlessTime"] = value; }
            }
        }
        public 
DateTime BlessStamp
        
{
            
get { return this["BlessStamp"]; }
            
set this["BlessStamp"] = value; }
        }
        public 
DateTime DoubleExperienceStamp
        
{
            
get { return this["DoubleExperienceStamp"]; }
            
set this["DoubleExperienceStamp"] = value; }
        }
        public 
int speedHackSuspiction 0;
        public 
Time32 LastPingT;
        public 
uint LastPingStamp 0;
        
// public Game.Entity Companion;

        
public List<GameStatePrayers;
        public 
GameState PrayLead;

        public 
DateTime ChatBanTime;
        public 
Game.Entity Companion;
        public 
uint ChatBanLasts;
        public 
bool ChatBanned;

        public 
uint BackupArmorLook
        
{
            
get { return this["bkparmorlook"]; }
            
set this["bkparmorlook"] = value; }
        }
        public 
uint ArmorLook
        
{
            
get { return this["armorlook"]; }
            
set this["armorlook"] = value; }
        }
        public 
uint WeaponLook
        
{
            
get { return this["weaponlook"]; }
            
set this["weaponlook"] = value; }
        }
        public 
uint WeaponLook2
        
{
            
get { return this["weaponlook2"]; }
            
set this["weaponlook2"] = value; }
        }
        public 
uint HeadgearLook
        
{
            
get { return this["headgearlook"]; }
            
set this["headgearlook"] = value; }
        }

        public 
bool ValidArmorLook(uint id)
        {
            if (
id == 0) return false;

            var 
soulInfo Database.AddingInformationTable.SoulGearItems[id];
            if (
id >= 800000 && id 900000)
            {
                if (
soulInfo.ItemIdentifier 100)
                    if (
soulInfo.ItemIdentifier != ConquerItem.Armor)
                        return 
false;
                    else { }
                else
                    if (
Network.PacketHandler.ItemPosition((uint)(soulInfo.ItemIdentifier 1000)) != ConquerItem.Armor)
                        return 
false;
            }
            else
                if (
Network.PacketHandler.ItemPosition(id) != ConquerItem.Armor)
                    return 
false;
            return 
true;
        }
        public 
bool ValidHeadgearLook(uint id)
        {
            if (
id == 0) return false;

            var 
soulInfo Database.AddingInformationTable.SoulGearItems[id];
            if (
id >= 800000 && id 900000)
            {
                if (
soulInfo.ItemIdentifier 100)
                    if (
soulInfo.ItemIdentifier != ConquerItem.Head)
                        return 
false;
                    else { }
                else
                    if (
Network.PacketHandler.ItemPosition((uint)(soulInfo.ItemIdentifier 1000)) != ConquerItem.Head)
                        return 
false;
            }
            else
                if (
Network.PacketHandler.ItemPosition(id) != ConquerItem.Head)
                    return 
false;
            return 
true;
        }
        public 
bool ValidWeaponLook(uint id)
        {
            if (
id == 0) return false;
            if (
Network.PacketHandler.ItemPosition(id) != ConquerItem.RightWeapon)
                return 
false;
            return 
true;
        }
        public 
bool ValidWeaponLook2(uint id)
        {
            if (
id == 0) return false;
            if (
Network.PacketHandler.ItemPosition(id) != ConquerItem.RightWeapon)
            {
                if (
Network.PacketHandler.ItemPosition(id) != ConquerItem.LeftWeapon)
                    return 
false;
            }
            else
            {
                if (
Network.PacketHandler.IsTwoHand(id))
                    return 
false;
            }
            return 
true;
        }

        public 
ConquerItemBaseInformation CheckLook(string nameushort posout int minDist)
        {
            
minDist int.MaxValue;
            
Database.ConquerItemBaseInformation CIBI null;
            
Game.Enums.ItemQuality Quality Game.Enums.ItemQuality.Fixed;
            var 
itemx Equipment.TryGetItem((byte)pos);
            if (
itemx != null)
                
Quality = (Enums.ItemQuality)(itemx.ID 10);

            foreach (var 
item in Database.ConquerItemInformation.BaseInformations.Values)
            {
                if (
pos == ConquerItem.Armor)
                {
                    if (
ValidArmorLook(item.ID))
                    {
                        
int dist name.LevenshteinDistance(item.LowerName);
                        if (
minDist dist && Quality == (Game.Enums.ItemQuality)(item.ID 10))
                        {
                            
CIBI item;
                            
minDist dist;
                        }
                    }
                }
                else if (
pos == ConquerItem.Head)
                {
                    if (
ValidHeadgearLook(item.ID))
                    {
                        
int dist name.LevenshteinDistance(item.LowerName);
                        if (
minDist dist && Quality == (Game.Enums.ItemQuality)(item.ID 10))
                        {
                            
CIBI item;
                            
minDist dist;
                        }
                    }
                }
                else if (
pos == ConquerItem.LeftWeapon)
                {
                    if (
ValidWeaponLook2(item.ID))
                    {
                        
int dist name.LevenshteinDistance(item.LowerName);
                        if (
minDist dist && !PacketHandler.IsTwoHand(item.ID) && Quality == (Game.Enums.ItemQuality)(item.ID 10))
                        {
                            
CIBI item;
                            
minDist dist;
                        }
                    }
                }
                else if (
pos == ConquerItem.RightWeapon)
                {
                    if (
ValidWeaponLook(item.ID))
                    {
                        
//if (PacketHandler.IsTwoHand(itemx.ID))
                        //{
                        //    int dist = name.LevenshteinDistance(item.LowerName);
                        //    if (minDist > dist && PacketHandler.IsTwoHand(item.ID) && Quality == (Game.Enums.ItemQuality)(item.ID % 10))
                        //    {
                        //        CIBI = item;
                        //        minDist = dist;
                        //    }
                        //}
                        //else
                        
{
                            
int dist name.LevenshteinDistance(item.LowerName);
                            if (
minDist dist && !PacketHandler.IsTwoHand(item.ID) && Quality == (Game.Enums.ItemQuality)(item.ID 10))
                            {
                                
CIBI item;
                                
minDist dist;
                            }
                        }

                    }
                }
            }
            return 
CIBI;
        }

        public 
void SetNewArmorLook(uint idbool change true)
        {
            if (
change)
                
ArmorLook id;
            if (!
ValidArmorLook(id)) return;
            
int min 0;
            
id CheckLook(Database.ConquerItemInformation.BaseInformations[id].LowerNameConquerItem.Armorout min).ID;

            var 
item Equipment.TryGetItem(ConquerItem.Armor);
            var 
iu = new Network.GamePackets.ItemUsage(true);
            
iu.UID uint.MaxValue 1;
            
iu.dwParam 13;
            
iu.ID Network.GamePackets.ItemUsage.UnequipItem;
            
Send(iu);
            
iu = new Network.GamePackets.ItemUsage(true);
            
iu.UID uint.MaxValue 1;
            
iu.ID Network.GamePackets.ItemUsage.RemoveInventory;
            
Send(iu);

            
ConquerItem fakeItem = new Network.GamePackets.ConquerItem(true);
            
fakeItem.ID id;
            if (
item != null)
            {
                
fakeItem.Bless item.Bless;
                
fakeItem.Bound item.Bound;
                
fakeItem.Color item.Color;
                
fakeItem.Effect item.Effect;
                
fakeItem.Enchant item.Enchant;
                
fakeItem.Plus item.Plus;
                
fakeItem.SocketOne item.SocketOne;
                
fakeItem.SocketTwo item.SocketTwo;
            }

            
fakeItem.Durability 1;
            
fakeItem.MaximDurability 1;
            
fakeItem.Color Game.Enums.Color.Black;
            
fakeItem.UID uint.MaxValue 1;
            
fakeItem.Position 13;
            
Send(fakeItem);
            
fakeItem.Mode Enums.ItemMode.Update;
            
Send(fakeItem);
            
ClientEquip eqs = new ClientEquip();
            
eqs.DoEquips(this);
            
Send(eqs);
            
Equipment.UpdateEntityPacket();
        }
        public 
void SetNewHeadgearLook(uint idbool change true)
        {
            if (
change)
                
HeadgearLook id;
            if (!
ValidHeadgearLook(id)) return;
            
int min 0;
            
id CheckLook(Database.ConquerItemInformation.BaseInformations[id].LowerNameConquerItem.Headout min).ID;

            var 
item Equipment.TryGetItem(ConquerItem.Head);
            var 
iu = new Network.GamePackets.ItemUsage(true);
            
iu.UID uint.MaxValue 2;
            
iu.dwParam 14;
            
iu.ID Network.GamePackets.ItemUsage.UnequipItem;
            
Send(iu);
            
iu = new Network.GamePackets.ItemUsage(true);
            
iu.UID uint.MaxValue 2;
            
iu.ID Network.GamePackets.ItemUsage.RemoveInventory;
            
Send(iu);

            
ConquerItem fakeItem = new Network.GamePackets.ConquerItem(true);
            
fakeItem.ID id;
            if (
item != null)
            {
                
fakeItem.Bless item.Bless;
                
fakeItem.Bound item.Bound;
                
fakeItem.Color item.Color;
                
fakeItem.Effect item.Effect;
                
fakeItem.Enchant item.Enchant;
                
fakeItem.Plus item.Plus;
                
fakeItem.SocketOne item.SocketOne;
                
fakeItem.SocketTwo item.SocketTwo;
            }

            
fakeItem.Durability 1;
            
fakeItem.MaximDurability 1;
            
fakeItem.Color Game.Enums.Color.Black;
            
fakeItem.UID uint.MaxValue 2;
            
fakeItem.Position 14;
            
Send(fakeItem);
            
fakeItem.Mode Enums.ItemMode.Update;
            
Send(fakeItem);
            
ClientEquip eqs = new ClientEquip();
            
eqs.DoEquips(this);
            
Send(eqs);
            
Equipment.UpdateEntityPacket();
        }
        public 
void SetNewWeaponLook(uint idbool change true)
        {
            if (
change)
                
WeaponLook id;
            if (!
ValidWeaponLook(id)) return;
            
int min 0;

            var 
item Equipment.TryGetItem(ConquerItem.RightWeapon);
            var 
iu = new Network.GamePackets.ItemUsage(true);
            
iu.UID uint.MaxValue 3;
            
iu.dwParam ConquerItem.RightWeaponAccessory;
            
iu.ID Network.GamePackets.ItemUsage.UnequipItem;
            
Send(iu);
            
iu = new Network.GamePackets.ItemUsage(true);
            
iu.UID uint.MaxValue 3;
            
iu.ID Network.GamePackets.ItemUsage.RemoveInventory;
            
Send(iu);

            
id CheckLook(Database.ConquerItemInformation.BaseInformations[id].LowerNameConquerItem.RightWeaponout min).ID;

            
ConquerItem fakeItem = new Network.GamePackets.ConquerItem(true);
            
fakeItem.ID id;
            if (
item != null)
            {
                
fakeItem.Bless item.Bless;
                
fakeItem.Bound item.Bound;
                
fakeItem.Color item.Color;
                
fakeItem.Effect item.Effect;
                
fakeItem.Enchant item.Enchant;
                
fakeItem.Plus item.Plus;
                
fakeItem.SocketOne item.SocketOne;
                
fakeItem.SocketTwo item.SocketTwo;
                
fakeItem.Lock 1;
            }
            
fakeItem.Durability 1;
            
fakeItem.MaximDurability 1;
            
fakeItem.UID uint.MaxValue 3;
            
fakeItem.Position ConquerItem.RightWeaponAccessory;
            
Send(fakeItem);
            
fakeItem.Mode Enums.ItemMode.Update;
            
Send(fakeItem);
            
ClientEquip eqs = new ClientEquip();
            
eqs.DoEquips(this);
            
Send(eqs);
            
Equipment.UpdateEntityPacket();

        }
        public 
void SetNewWeaponLook2(uint idbool change true)
        {
            if (
change)
                
WeaponLook2 id;
            if (!
ValidWeaponLook2(id)) return;
            
int min 0;

            var 
item Equipment.TryGetItem(ConquerItem.LeftWeapon);
            var 
iu = new Network.GamePackets.ItemUsage(true);
            
iu.UID uint.MaxValue 4;
            
iu.dwParam ConquerItem.LeftWeaponAccessory;
            
iu.ID Network.GamePackets.ItemUsage.UnequipItem;
            
Send(iu);
            
iu = new Network.GamePackets.ItemUsage(true);
            
iu.UID uint.MaxValue 4;
            
iu.ID Network.GamePackets.ItemUsage.RemoveInventory;
            
Send(iu);

            
id CheckLook(Database.ConquerItemInformation.BaseInformations[id].LowerNameConquerItem.LeftWeaponout min).ID;

            
ConquerItem fakeItem = new Network.GamePackets.ConquerItem(true);
            
fakeItem.ID id;
            if (
item != null)
            {
                
fakeItem.Bless item.Bless;
                
fakeItem.Bound item.Bound;
                
fakeItem.Color item.Color;
                
fakeItem.Effect item.Effect;
                
fakeItem.Enchant item.Enchant;
                
fakeItem.Plus item.Plus;
                
fakeItem.SocketOne item.SocketOne;
                
fakeItem.SocketTwo item.SocketTwo;
                
fakeItem.Lock 1;
            }

            
fakeItem.Durability 1;
            
fakeItem.MaximDurability 1;
            
fakeItem.UID uint.MaxValue 4;
            
fakeItem.Position ConquerItem.LeftWeaponAccessory;
            
Send(fakeItem);
            
fakeItem.Mode Enums.ItemMode.Update;
            
Send(fakeItem);
            
ClientEquip eqs = new ClientEquip();
            
eqs.DoEquips(this);
            
Send(eqs);
            
Equipment.UpdateEntityPacket();

        }

        public 
byte JewelarLauKindJewelarLauGems;
        public 
uint VirtuePoints;
        public 
uint TQPoint;
        public 
DateTime LastLotteryEntry;
        public 
byte LotteryEntries;
        public 
bool InLottery;
        public 
DateTime OfflineTGEnterTime;
        public 
bool Mining false;
        public 
Time32 MiningStamp;
        public 
ushort Vigor
        
{
            
get
            
{
                if (
Equipment != null)
                    if (!
Equipment.Free(12))
                        return 
Equipment.TryGetItem((byte)12).Vigor;
                return 
65535;
            }
            
set
            
{
                if (!
Equipment.Free(12))
                    
Equipment.TryGetItem((byte)12).Vigor value;
            }
        }
        
ushort _Maxvigor;
        public 
ushort MaxVigor
        
{
            
get
            
{
                return 
_Maxvigor;
            }
            
set
            
{
                
_Maxvigor value;
            }

        }

        public 
bool HeadgearClaimNecklaceClaimArmorClaimWeaponClaimRingClaimBootsClaimTowerClaimFanClaim;
        public 
string PromoteItemNameNeed
        
{
            
get
            
{
                if (
Entity.Class % 10 == 0)
                    return 
" nothing but";
                if (
Entity.Class % 10 == 1)
                    
//   if (Entity.Class / 10 == 4)
                    //      return " five Euxenite Ores and";
                    //    else
                    
return " nothing but";
                if (
Entity.Class % 10 == 2)
                    return 
" one Emerald and";
                if (
Entity.Class % 10 == 3)
                    return 
" one Meteor and";
                if (
Entity.Class % 10 == 4)
                    return 
" one MoonBox and";
                return 
" nothing but";
            }
        }
        public 
byte PromoteItemCountNeed
        
{
            
get
            
{
                if (
Entity.Class % 10 == 0)
                    return 
0;
                if (
Entity.Class % 10 == 1)
                    
//  if (Entity.Class / 10 == 4)
                    //       return 5;
                    //   else
                    
return 0;
                if (
Entity.Class % 10 == 2)
                    return 
1;
                if (
Entity.Class % 10 == 3)
                    return 
1;
                if (
Entity.Class % 10 == 4)
                    return 
1;
                return 
0;
            }
        }
        public 
uint PromoteItemNeed
        
{
            
get
            
{
                if (
Entity.Class % 10 == 0)
                    return 
0;
                if (
Entity.Class % 10 == 1)
                    
//   if (Entity.Class / 10 == 4)
                    //       return 1072031;
                    //   else
                    
return 0;
                if (
Entity.Class % 10 == 2)
                    return 
1080001;
                if (
Entity.Class % 10 == 3)
                    return 
1088001;
                if (
Entity.Class % 10 == 4)
                    return 
721020;
                return 
0;
            }
        }
        public 
uint PromoteItemGain
        
{
            
get
            
{
                if (
Entity.Class % 10 == 0)
                    return 
0;
                if (
Entity.Class % 10 == 1)
                    
//   if (Entity.Class / 10 == 4)
                    //       return 500067;
                    //    else
                    
return 0;
                if (
Entity.Class % 10 == 2)
                    return 
0;
                if (
Entity.Class % 10 == 3)
                    return 
700031;
                if (
Entity.Class % 10 == 4)
                    return 
1088000;
                return 
0;
            }
        }
        public 
uint PromoteLevelNeed
        
{
            
get
            
{
                if (
Entity.Class % 10 == 0)
                    return 
15;
                if (
Entity.Class % 10 == 1)
                    return 
40;
                if (
Entity.Class % 10 == 2)
                    return 
70;
                if (
Entity.Class % 10 == 3)
                    return 
100;
                if (
Entity.Class % 10 == 4)
                    return 
110;
                return 
0;
            }
        }
        public 
byte SelectedItemUpdateType;
        public 
ushort UplevelProficiency;
        public 
UInt32 GuildJoinTarget 0;
        public 
uint OnHoldGuildJoin 0;
        public 
uint elitepoints 0;
        public 
bool Effect false;
        public 
bool Effect1 false;
        public 
bool Effect10 false;
        public 
bool Effect8 false;
        public 
bool Effect9 false;
        public 
bool Effect11 false;
        public 
bool Effect4 false;
        public 
bool Effect3 false;
        public 
uint eliterank 0;
        public 
bool SentRequest false;
        public 
Game.ConquerStructures.Society.Guild Guild;
        public 
Game.ConquerStructures.Society.Guild.Member AsMember;
        public 
uint Arsenal_Donation 0;
        public 
Game.ConquerStructures.Booth Booth;

        
#region Eilte Pk 8
        
public ushort EliteBody()
        {
            
ushort num2 0;
            
uint num = (uint)Kernel.Random.Next(14);
            switch (
num)
            {
                case 
1:
                    {
                        
num2 1003;
                        break;
                    }
                case 
2:
                    {
                        
num2 1004;
                        break;
                    }
                case 
3:
                    {
                        
num2 2001;
                        break;
                    }
                case 
4:
                    {
                        
num2 2002;
                        break;
                    }
            }
            return 
num2;
        }
        public 
void SpawnElitePKBot(uint UID)
        {
            if (!
Kernel.GamePool.ContainsKey(UID))
            {
                
ReadyToPlay();
                
this.Account = new Database.AccountTable(null);
                
this.Account.EntityID UID;
                {
                    
#region Load Entity
                    
this.Entity = new Game.Entity(EntityFlag.Entityfalse);
                    
this.Entity.Name "ElitePK`Bot";
                    
this.Entity.Owner this;
                    
this.Entity.UID UID;
                    
this.Entity.Body EliteBody();
                    
this.Entity.Face = (ushort)Kernel.Random.Next(150);
                    
byte Color = (byte)Kernel.Random.Next(48);
                    
this.Entity.HairStyle = (ushort)(Color 100 10 + (byte)Kernel.Random.Next(49));
                    
this.Entity.Level 140;
                    
this.Entity.Class = 55;
                    
this.Entity.Reborn 2;
                    
this.Entity.Titles = new System.Collections.Concurrent.ConcurrentDictionary<TitlePacket.TitlesDateTime>();
                    
this.Entity.MyTitle = (TitlePacket.Titles)16;
                    
this.Entity.MapID ElitePKTournament.WaitingAreaID;
                    if (
this.VendingDisguise == 0)
                        
this.VendingDisguise 0xdf;
                    
this.Entity.50;
                    
this.Entity.50;
                    
uint WeaponR 601439;
                    
uint WeaponL 601439;
                    
uint Armor 135309;
                    
uint Head 123309;
                    
uint Garment 192685;
                    
this.ElitePKStats = new ElitePK.FighterStats(this.Entity.UIDthis.Entity.Namethis.Entity.Mesh);
                    if (!
Game.ConquerStructures.Nobility.Board.TryGetValue(this.Entity.UIDout this.NobilityInformation))
                    {
                        
this.NobilityInformation = new NobilityInformation();
                        
this.NobilityInformation.EntityUID this.Entity.UID;
                        
this.NobilityInformation.Name this.Entity.Name;
                        
this.NobilityInformation.Donation 0L;
                        
this.NobilityInformation.Rank NobilityRank.Serf;
                        
this.NobilityInformation.Position = -1;
                        
this.NobilityInformation.Gender 1;
                        
this.NobilityInformation.Mesh this.Entity.Mesh;
                        if ((
this.Entity.Body 10) >= 3)
                        {
                            
this.NobilityInformation.Gender 0;
                        }
                    }
                    else
                    {
                        
this.Entity.NobilityRank this.NobilityInformation.Rank;
                    }
                    
Arena.ArenaStatistics.TryGetValue(this.Entity.UIDout this.ArenaStatistic);
                    if ((
this.ArenaStatistic == null) || (this.ArenaStatistic.EntityID == 0))
                    {
                        
this.ArenaStatistic = new ArenaStatistic(true);
                        
this.ArenaStatistic.EntityID this.Entity.UID;
                        
this.ArenaStatistic.Name this.Entity.Name;
                        
this.ArenaStatistic.Level this.Entity.Level;
                        
this.ArenaStatistic.Class = this.Entity.Class;
                        
this.ArenaStatistic.Model this.Entity.Mesh;
                        
this.ArenaStatistic.ArenaPoints Database.ArenaTable.ArenaPointFill(this.Entity.Level);
                        
this.ArenaStatistic.LastArenaPointFill DateTime.Now;
                        
Database.ArenaTable.InsertArenaStatistic(this);
                        
this.ArenaStatistic.Status 0;
                        
Arena.ArenaStatistics.Add(this.Entity.UIDthis.ArenaStatistic);
                    }
                    else
                    {
                        
this.ArenaStatistic.Level this.Entity.Level;
                        
this.ArenaStatistic.Class = this.Entity.Class;
                        
this.ArenaStatistic.Model this.Entity.Mesh;
                        if (
DateTime.Now.DayOfYear != this.ArenaStatistic.LastArenaPointFill.DayOfYear)
                        {
                            
this.ArenaStatistic.LastSeasonArenaPoints this.ArenaStatistic.ArenaPoints;
                            
this.ArenaStatistic.LastSeasonWin this.ArenaStatistic.TodayWin;
                            
this.ArenaStatistic.LastSeasonLose this.ArenaStatistic.TodayBattles this.ArenaStatistic.TodayWin;
                            
this.ArenaStatistic.ArenaPoints Database.ArenaTable.ArenaPointFill(this.Entity.Level);
                            
this.ArenaStatistic.LastArenaPointFill DateTime.Now;
                            
this.ArenaStatistic.TodayWin 0;
                            
this.ArenaStatistic.TodayBattles 0;
                            
Arena.Sort();
                            
Arena.YesterdaySort();
                        }
                    }
                    
TeamArena.ArenaStatistics.TryGetValue(this.Entity.UIDout this.TeamArenaStatistic);
                    if (
this.TeamArenaStatistic == null)
                    {
                        
this.TeamArenaStatistic = new TeamArenaStatistic(true);
                        
this.TeamArenaStatistic.EntityID this.Entity.UID;
                        
this.TeamArenaStatistic.Name this.Entity.Name;
                        
this.TeamArenaStatistic.Level this.Entity.Level;
                        
this.TeamArenaStatistic.Class = this.Entity.Class;
                        
this.TeamArenaStatistic.Model this.Entity.Mesh;
                        
Database.TeamArenaTable.InsertArenaStatistic(this);
                        
this.TeamArenaStatistic.Status 0;
                        if (
TeamArena.ArenaStatistics.ContainsKey(this.Entity.UID))
                        {
                            
TeamArena.ArenaStatistics.Remove(this.Entity.UID);
                        }
                        
TeamArena.ArenaStatistics.Add(this.Entity.UIDthis.TeamArenaStatistic);
                    }
                    else if (
this.TeamArenaStatistic.EntityID == 0)
                    {
                        
this.TeamArenaStatistic = new TeamArenaStatistic(true);
                        
this.TeamArenaStatistic.EntityID this.Entity.UID;
                        
this.TeamArenaStatistic.Name this.Entity.Name;
                        
this.TeamArenaStatistic.Level this.Entity.Level;
                        
this.TeamArenaStatistic.Class = this.Entity.Class;
                        
this.TeamArenaStatistic.Model this.Entity.Mesh;
                        
Database.TeamArenaTable.InsertArenaStatistic(this);
                        
this.TeamArenaStatistic.Status 0;
                        if (
TeamArena.ArenaStatistics.ContainsKey(this.Entity.UID))
                        {
                            
TeamArena.ArenaStatistics.Remove(this.Entity.UID);
                        }
                        
TeamArena.ArenaStatistics.Add(this.Entity.UIDthis.TeamArenaStatistic);
                    }
                    else
                    {
                        
this.TeamArenaStatistic.Level this.Entity.Level;
                        
this.TeamArenaStatistic.Class = this.Entity.Class;
                        
this.TeamArenaStatistic.Model this.Entity.Mesh;
                        
this.TeamArenaStatistic.Name this.Entity.Name;
                    }
                    
Database.DetainedItemTable.LoadDetainedItems(this);
                    
Database.ClaimItemTable.LoadClaimableItems(this);
                    
this.Entity.LoadTopStatus();
                    
this.Entity.FullyLoaded true;

                    
#endregion
                    
if (this.Entity.FullyLoaded)
                    {
                        
VariableVault variables;
                        
Database.EntityVariableTable.Load(this.Account.EntityIDout variables);
                        
this.Variables variables;

                        if (
this.BackupArmorLook != 0)
                            
this.SetNewArmorLook(this.BackupArmorLook);
                        else
                            
this.SetNewArmorLook(this.ArmorLook);
                        
this.SetNewHeadgearLook(this.HeadgearLook);
                        
this.BackupArmorLook 0;

                        
this.LoadData(true);

                        if (
this.Entity.GuildID != 0)
                            
this.Entity.GuildBattlePower this.Guild.GetSharedBattlepower(this.Entity.GuildRank);
                        
this.ReviewMentor();
                        
Network.PacketHandler.LoginMessages(this);

                        
#region Equip

                        
ConquerItem item7 null;
                        
ClientEquip equip null;
                        if (
WeaponR 0)
                        {
                            
Database.ConquerItemBaseInformation CIBI Database.ConquerItemInformation.BaseInformations[WeaponR];
                            if (
CIBI == null) return;
                            
item7 = new ConquerItem(true);
                            
item7.ID WeaponR;
                            
item7.UID AuthClient.nextID;
                            
AuthClient.nextID++;
                            
item7.Position 4;
                            
item7.Durability CIBI.Durability;
                            
item7.MaximDurability CIBI.Durability;
                            
this.Equipment.Remove(4);
                            if (
this.Equipment.Objects[3] != null)
                            {
                                
this.Equipment.Objects[3] = null;
                            }
                            
this.Equipment.Add(item7);
                            
item7.Mode Enums.ItemMode.Update;
                            
item7.Send(this);
                            
equip = new ClientEquip();
                            
equip.DoEquips(this);
                            
this.Send(equip);
                            
this.Equipment.UpdateEntityPacket();

                        }
                        if (
WeaponL 0)
                        {
                            
Database.ConquerItemBaseInformation CIBI Database.ConquerItemInformation.BaseInformations[WeaponL];
                            if (
CIBI == null) return;
                            
item7 = new ConquerItem(true);
                            
item7.ID WeaponL;
                            
item7.UID AuthClient.nextID;
                            
AuthClient.nextID++;
                            
item7.Position 5;
                            
item7.Durability CIBI.Durability;
                            
item7.MaximDurability CIBI.Durability;
                            
this.Equipment.Remove(5);
                            if (
this.Equipment.Objects[4] != null)
                            {
                                
this.Equipment.Objects[4] = null;
                            }
                            
this.Equipment.Add(item7);
                            
item7.Mode Enums.ItemMode.Update;
                            
item7.Send(this);
                            
equip = new ClientEquip();
                            
equip.DoEquips(this);
                            
this.Send(equip);
                            
this.Equipment.UpdateEntityPacket();
                        }

                        if (
Armor 0)
                        {
                            
Database.ConquerItemBaseInformation CIBI Database.ConquerItemInformation.BaseInformations[Armor];
                            if (
CIBI == null) return;
                            
item7 = new ConquerItem(true);
                            
item7.ID Armor;
                            
item7.UID AuthClient.nextID;
                            
AuthClient.nextID++;
                            
item7.Position 3;
                            
item7.Durability CIBI.Durability;
                            
item7.MaximDurability CIBI.Durability;
                            
this.Equipment.Remove(3);
                            if (
this.Equipment.Objects[2] != null)
                            {
                                
this.Equipment.Objects[2] = null;
                            }
                            
this.Equipment.Add(item7);
                            
item7.Mode Enums.ItemMode.Update;
                            
item7.Send(this);
                            
equip = new ClientEquip();
                            
equip.DoEquips(this);
                            
this.Send(equip);
                            
this.Equipment.UpdateEntityPacket();

                        }

                        if (
Head 0)
                        {
                            
Database.ConquerItemBaseInformation CIBI Database.ConquerItemInformation.BaseInformations[Head];
                            if (
CIBI == null) return;
                            
item7 = new ConquerItem(true);
                            
item7.ID Head;
                            
item7.UID AuthClient.nextID;
                            
AuthClient.nextID++;
                            
item7.Position 1;
                            
item7.Durability CIBI.Durability;
                            
item7.MaximDurability CIBI.Durability;
                            
this.Equipment.Remove(1);
                            if (
this.Equipment.Objects[0] != null)
                            {
                                
this.Equipment.Objects[0] = null;
                            }
                            
this.Equipment.Add(item7);
                            
item7.Mode Enums.ItemMode.Update;
                            
item7.Send(this);
                            
equip = new ClientEquip();
                            
equip.DoEquips(this);
                            
this.Send(equip);
                            
this.Equipment.UpdateEntityPacket();

                        }

                        if (
Garment 0)
                        {
                            
Database.ConquerItemBaseInformation CIBI Database.ConquerItemInformation.BaseInformations[Garment];
                            if (
CIBI == null) return;
                            
item7 = new ConquerItem(true);
                            
item7.ID Garment;
                            
item7.UID AuthClient.nextID;
                            
AuthClient.nextID++;
                            
item7.Position 9;
                            
item7.Durability CIBI.Durability;
                            
item7.MaximDurability CIBI.Durability;
                            
this.Equipment.Remove(9);
                            if (
this.Equipment.Objects[8] != null)
                            {
                                
this.Equipment.Objects[8] = null;
                            }
                            
this.Equipment.Add(item7);
                            
item7.Mode Enums.ItemMode.Update;
                            
item7.Send(this);
                            
equip = new ClientEquip();
                            
equip.DoEquips(this);
                            
this.Send(equip);
                            
this.Equipment.UpdateEntityPacket();
                        }

                        
#endregion Equip


                        
Program.World.Register(this);
                        
Kernel.GamePool.Add(Entity.UIDthis);
                        
FakeLoaded true;
                        
LoggedIn true;
                        
Entity.NobilityRank NobilityInformation.Rank;
                        
this.Attackable true;


                    }

                }
            }
        }
        
#endregion
        
public bool RaceExcitementRaceDeceleratedRaceGuardRaceDizzyRaceFrightened;
        public 
Time32 RaceExcitementStampGuardStampDizzyStampFrightenStampChaosStampExtraVigorStampDecelerateStamp;
        public 
uint RaceExcitementAmountRaceExtraVigor;
        public 
GameCharacterUpdates SpeedChange;
        public 
void ApplyRacePotion(Enums.RaceItemType typeuint target)
        {
            switch (
type)
            {
                case 
Enums.RaceItemType.FrozenTrap:
                    {
                        if (
target != uint.MaxValue)
                        {
                            if (
Map.Floor[Entity.XEntity.YMapObjectType.StaticEntity])
                            {
                                
StaticEntity item = new StaticEntity((uint)(Entity.1000 Entity.Y), Entity.XEntity.Y, (ushort)Map.ID);
                                
item.DoFrozenTrap(Entity.UID);
                                
Map.AddStaticEntity(item);
                                
Kernel.SendSpawn(item);
                            }
                        }
                        else
                        {
                            
Entity.FrozenStamp Time32.Now;
                            
Entity.FrozenTime 5;
                            
GameCharacterUpdates update = new GameCharacterUpdates(true);
                            
update.UID Entity.UID;
                            
update.Add(GameCharacterUpdates.Freeze04);
                            
SendScreen(updatetrue);
                            
Entity.AddFlag(Update.Flags.Freeze);
                        }
                        break;
                    }
                case 
Enums.RaceItemType.RestorePotion:
                    {
                        
Vigor += 2000;
                        if (
Vigor MaxVigor)
                            
Vigor MaxVigor;
                        
Send(new Vigor(true) { Amount Vigor });
                        break;
                    }
                case 
Enums.RaceItemType.ExcitementPotion:
                    {
                        if (
RaceExcitement && RaceExcitementAmount 50)
                            return;

                        if (
RaceDecelerated)
                        {
                            
RaceDecelerated false;

                            var 
upd = new GameCharacterUpdates(true);
                            
upd.UID Entity.UID;
                            
upd.Remove(GameCharacterUpdates.Decelerated);
                            
SendScreen(updtrue);
                        }
                        
RaceExcitementStamp Time32.Now;
                        
RaceExcitement true;
                        {
                            var 
upd = new GameCharacterUpdates(true);
                            
upd.UID Entity.UID;
                            
upd.Add(GameCharacterUpdates.Accelerated501525);
                            
SendScreen(updtrue);
                            
SpeedChange upd;
                        }
                        
RaceExcitementAmount 50;
                        
Entity.AddFlag(Update.Flags.OrangeSparkles);
                        break;
                    }
                case 
Enums.RaceItemType.SuperExcitementPotion:
                    {
                        if (
RaceDecelerated)
                        {
                            
RaceDecelerated false;

                            var 
upd = new GameCharacterUpdates(true);
                            
upd.UID Entity.UID;
                            
upd.Remove(GameCharacterUpdates.Decelerated);
                            
SendScreen(updtrue);
                        }
                        
RaceExcitementAmount 200;
                        
RaceExcitementStamp Time32.Now;
                        
RaceExcitement true;
                        
this.Entity.AddFlag(Update.Flags.SpeedIncreased);
                        {
                            var 
upd = new GameCharacterUpdates(true);
                            
upd.UID Entity.UID;
                            
upd.Add(GameCharacterUpdates.Accelerated20015100);
                            
SendScreen(updtrue);
                            
SpeedChange upd;
                        }
                        
Entity.AddFlag(Update.Flags.OrangeSparkles);
                        break;
                    }
                case 
Enums.RaceItemType.GuardPotion:
                    {
                        
RaceGuard true;
                        
GuardStamp Time32.Now;
                        
Entity.AddFlag(Update.Flags.DivineShield);
                        
DizzyStamp DizzyStamp.AddSeconds(-100);
                        
FrightenStamp FrightenStamp.AddSeconds(-100);
                        var 
upd = new GameCharacterUpdates(true);
                        
upd.UID Entity.UID;
                        
upd.Add(GameCharacterUpdates.DivineShield010);
                        
SendScreen(updtrue);
                        break;
                    }
                case 
Enums.RaceItemType.DizzyHammer:
                    {
                        
Entity Target;
                        if (
Screen.TryGetValue(targetout Target))
                        {
                            var 
Owner Target.Owner;
                            if (
Owner != null)
                            {
                                if (!
Owner.RaceGuard && !Owner.RaceFrightened)
                                {
                                    
Owner.DizzyStamp Time32.Now;
                                    
Owner.RaceDizzy true;
                                    
Owner.Entity.AddFlag(Update.Flags.Dizzy);
                                    {
                                        var 
upd = new GameCharacterUpdates(true);
                                        
upd.UID Entity.UID;
                                        
upd.Add(GameCharacterUpdates.Dizzy05);
                                        
Owner.SendScreen(updtrue);
                                    }
                                }
                            }
                        }
                        break;
                    }
                case 
Enums.RaceItemType.ScreamBomb:
                    {
                        
SendScreen(new SpellUse(true)
                        {
                            
Attacker Entity.UID,
                            
SpellID 9989,
                            
SpellLevel 0,
                            
Entity.X,
                            
Entity.Y
                        
}.AddTarget(Entity0null), true);
                        foreach (var 
obj in Screen.SelectWhere<Entity>(MapObjectType.Entity,
                            (
o) => Kernel.GetDistance(o.Xo.YEntity.XEntity.Y) <= 10))
                        {
                            var 
Owner obj.Owner;
                            if (!
Owner.RaceGuard && !Owner.RaceDizzy)
                            {
                                
Owner.RaceFrightened true;
                                
Owner.FrightenStamp Time32.Now;
                                
Owner.Entity.AddFlag(Update.Flags.Frightened);
                                {
                                    var 
upd = new GameCharacterUpdates(true);
                                    
upd.UID Owner.Entity.UID;
                                    
upd.Add(GameCharacterUpdates.Flustered020);
                                    
Owner.SendScreen(updtrue);
                                }
                            }
                        }
                        break;
                    }
                case 
Enums.RaceItemType.SpiritPotion:
                    {
                        
ExtraVigorStamp Time32.Now;
                        
RaceExtraVigor 2000;
                        break;
                    }
                case 
Enums.RaceItemType.ChaosBomb:
                    {
                        
SendScreen(new SpellUse(true)
                        {
                            
Attacker Entity.UID,
                            
SpellID 9989,
                            
SpellLevel 0,
                            
Entity.X,
                            
Entity.Y
                        
}.AddTarget(Entity0null), true);
                        foreach (var 
obj in this.Screen.SelectWhere<Entity>(MapObjectType.Entity,
                               (
o) => Kernel.GetDistance(o.Xo.YEntity.XEntity.Y) <= 10))
                        {
                            var 
Owner obj.Owner;
                            if (!
Owner.RaceGuard)
                            {
                                
Owner.FrightenStamp Time32.Now;
                                
Owner.DizzyStamp Owner.DizzyStamp.AddSeconds(-1000);

                                
Owner.Entity.AddFlag(Update.Flags.Confused);
                                {
                                    var 
upd = new GameCharacterUpdates(true);
                                    
upd.UID Owner.Entity.UID;
                                    
upd.Add(GameCharacterUpdates.Flustered015);
                                    
Owner.SendScreen(updtrue);
                                }
                            }
                        }
                        break;
                    }
                case 
Enums.RaceItemType.SluggishPotion:
                    {
                        
SendScreen(new SpellUse(true)
                        {
                            
Attacker Entity.UID,
                            
SpellID 9989,
                            
SpellLevel 0,
                            
Entity.X,
                            
Entity.Y
                        
}.AddTarget(Entity0null), true);
                        foreach (var 
obj in this.Screen.SelectWhere<Entity>(MapObjectType.Entity,
                              
=> Kernel.GetDistance(o.Xo.YEntity.XEntity.Y) <= 10))
                        {
                            var 
Owner obj.Owner;
                            if (!
Owner.RaceGuard)
                            {
                                
Owner.RaceDecelerated true;
                                
Owner.DecelerateStamp Time32.Now;
                                if (
Owner.RaceExcitement)
                                {
                                    
Owner.RaceExcitement false;

                                    var 
upd = new GameCharacterUpdates(true);
                                    
upd.UID Owner.Entity.UID;
                                    
upd.Remove(GameCharacterUpdates.Accelerated);
                                    
Owner.SendScreen(updtrue);
                                }
                                
Owner.Entity.AddFlag(Update.Flags.PurpleSparkles);
                                {
                                    var 
upd = new GameCharacterUpdates(true);
                                    
upd.UID Owner.Entity.UID;
                                    
unchecked upd.Add(GameCharacterUpdates.Decelerated5010, (uint)(25)); }
                                    
Owner.SendScreen(updtrue);
                                    
Owner.SpeedChange upd;
                                }
                            }
                        }
                        break;
                    }
                case 
Enums.RaceItemType.TransformItem:
                    {
                        for (
int i 05i++)
                        {
                            if (
Potions[i] != null)
                            {
                                if (
Potions[i].Type != Enums.RaceItemType.TransformItem)
                                {
                                    
Send(new RacePotion(true)
                                    {
                                        
Amount 0,
                                        
Location 1,
                                        
PotionType Potions[i].Type
                                    
});
                                    
Potions[i] = null;
                                }
                            }
                        }
                        
//for (int i = 0; i < 5; i++)
                        
{
                            
int i 0;
                            if (
Potions[i] == null)
                            {
                                
int val = (int)Enums.RaceItemType.TransformItem;
                                while (
val == (int)Enums.RaceItemType.TransformItem)
                                    
val Kernel.Random.Next((int)Enums.RaceItemType.ChaosBomb, (int)Enums.RaceItemType.SuperExcitementPotion);
                                
Potions[i] = new UsableRacePotion();
                                
Potions[i].Count 1;
                                
Potions[i].Type = (Enums.RaceItemType)val;
                                
Send(new RacePotion(true)
                                {
                                    
Amount 1,
                                    
Location 1,
                                    
PotionType Potions[i].Type
                                
});
                            }
                        }
                        break;
                    }
            }
        }


        public 
void ReviewMentor()
        {
            
#region NotMentor
            
uint nowBP 0;
            if (
Mentor != null)
            {
                if (
Mentor.IsOnline)
                {
                    
nowBP Entity.BattlePowerFrom(Mentor.Client.Entity);
                }
            }
            if (
nowBP 200nowBP 0;
            if (
nowBP 0nowBP 0;
            if (
Entity.MentorBattlePower != nowBP)
            {
                
Entity.MentorBattlePower nowBP;
                if (
Mentor != null)
                {
                    if (
Mentor.IsOnline)
                    {
                        
MentorInformation Information = new MentorInformation(true);
                        
Information.Mentor_Type 1;
                        
Information.Mentor_ID Mentor.Client.Entity.UID;
                        
Information.Apprentice_ID Entity.UID;
                        
Information.Enrole_Date Mentor.EnroleDate;
                        
Information.Mentor_Level Mentor.Client.Entity.Level;
                        
Information.Mentor_Class Mentor.Client.Entity.Class;
                        
Information.Mentor_PkPoints Mentor.Client.Entity.PKPoints;
                        
Information.Mentor_Mesh Mentor.Client.Entity.Mesh;
                        
Information.Mentor_Online true;
                        
Information.Shared_Battle_Power nowBP;
                        
Information.String_Count 3;
                        
Information.Mentor_Name Mentor.Client.Entity.Name;
                        
Information.Apprentice_Name Entity.Name;
                        
Information.Mentor_Spouse_Name Mentor.Client.Entity.Spouse;
                        
Send(Information);
                    }
                }
            }
            
#endregion
            #region Mentor
            
if (Apprentices == nullApprentices = new SafeDictionary<uintGame.ConquerStructures.Society.Apprentice>();
            foreach (var 
appr in Apprentices.Values)
            {
                if (
appr.IsOnline)
                {
                    
uint nowBPs 0;
                    
nowBPs appr.Client.Entity.BattlePowerFrom(Entity);
                    if (
appr.Client.Entity.MentorBattlePower != nowBPs)
                    {
                        
appr.Client.Entity.MentorBattlePower nowBPs;
                        
MentorInformation Information = new MentorInformation(true);
                        
Information.Mentor_Type 1;
                        
Information.Mentor_ID Entity.UID;
                        
Information.Apprentice_ID appr.Client.Entity.UID;
                        
Information.Enrole_Date appr.EnroleDate;
                        
Information.Mentor_Level Entity.Level;
                        
Information.Mentor_Class Entity.Class;
                        
Information.Mentor_PkPoints Entity.PKPoints;
                        
Information.Mentor_Mesh Entity.Mesh;
                        
Information.Mentor_Online true;
                        
Information.Shared_Battle_Power nowBPs;
                        
Information.String_Count 3;
                        
Information.Mentor_Name Entity.Name;
                        
Information.Apprentice_Name appr.Client.Entity.Name;
                        
Information.Mentor_Spouse_Name Entity.Spouse;
                        
appr.Client.Send(Information);
                    }
                }
            }
            
#endregion
        
}
        public 
void AddQuarantineKill()
        {
            
quarantineKill++;
            
UpdateQuarantineScore();
        }
        public 
void AddGl()
        {
            
TopGlClaim++;
            return;
        }
        public 
void AddDl()
        {
            
TopDlClaim++;
            return;
        }
        public 
void AddQuarantineDeath()
        {
            
quarantineDeath++;
            
UpdateQuarantineScore();
        }
        public 
void UpdateQuarantineScore()
        {
            
string[] scores = new string[3];
            
scores[0] = "Black team: " Mohamed_Hossam_Barakat.Game.Quarantine.BlackScore.ToString() + " wins";
            
scores[1] = "White team: " Mohamed_Hossam_Barakat.Game.Quarantine.WhiteScore.ToString() + " wins";
            
scores[2] = "Your score: " quarantineKill " kills, " quarantineDeath " death";
            for (
int i 0scores.Lengthi++)
            {
                
Message msg = new Message(scores[i], System.Drawing.Color.Red== Message.FirstRightCorner Message.ContinueRightCorner);
                
Send(msg);
            }
        }
        public 
void KillTerrorist()
        {
            foreach (
Client.GameState Terrorist in Program.Values)
            {
                if (
Terrorist.Entity.KillTheTerrorist_IsTerrorist == true && Terrorist.Entity.MapID == 1801)
                    
Mohamed_Hossam_Barakat.Kernel.SendWorldMessage(new Mohamed_Hossam_Barakat.Network.GamePackets.Message("Terrorist: " Terrorist.Entity.Name " "System.Drawing.Color.BlackMohamed_Hossam_Barakat.Network.GamePackets.Message.FirstRightCorner), Program.Values);
            }
        }
        public 
void AddBless(uint value)
        {
            
Entity.HeavenBlessing += value;
            
Entity.Update(Network.GamePackets._String.Effect"bless"true);
            if (
Mentor != null)
            {
                if (
Mentor.IsOnline)
                {
                    
Mentor.Client.PrizeHeavenBlessing += (ushort)(value 10 60 60);
                    
AsApprentice Mentor.Client.Apprentices[Entity.UID];
                }
                if (
AsApprentice != null)
                {
                    
AsApprentice.Actual_HeavenBlessing += (ushort)(value 10 60 60);
                    
AsApprentice.Total_HeavenBlessing += (ushort)(value 10 60 60);
                    if (
Time32.Now LastMentorSave.AddSeconds(5))
                    {
                        
Database.KnownPersons.SaveApprenticeInfo(AsApprentice);
                        
LastMentorSave Time32.Now;
                    }
                }
            }
        }
        public 
ulong PrizeExperience;
        public 
ushort PrizeHeavenBlessing;
        public 
ushort PrizePlusStone;

        public 
uint MentorApprenticeRequest;
        public 
uint TradePartnerRequest;

        public 
object[] OnMessageBoxEventParams;
        public 
Action<GameStateMessageOK;
        public 
Action<GameStateMessageCancel;

        public 
bool JustLoggedOn true;
        public 
Time32 ReviveStamp Time32.Now;
        public 
bool Attackable;
        public 
int PingCount getset; }
        public 
Game.ConquerStructures.NobilityInformation NobilityInformation;
        public 
Game.Entity Entity;
        public 
ConcurrentDictionary<TitlePacket.TitlesDateTimeTitles = new ConcurrentDictionary<TitlePacket.TitlesDateTime>();
        public 
Game.Screen Screen;
        public 
Time32 LastPing Time32.Now;
        
//public int PingCount = 0;
        
public Time32 LastClientJump;
        public static 
ushort NpcTestType 0;
        public 
byte TinterItemSelect 0;
        public 
DateTime LastDragonBallUseLastResetTime;
        public 
byte Action 0;
        public 
bool CheerSent false;
        public 
Game.Arena.QualifierList.QualifierGroup WatchingGroup;
        public 
Game.Arena.QualifierList.QualifierGroup QualifierGroup;
        public 
Network.GamePackets.ArenaStatistic ArenaStatistic;

        public 
Game.TeamArena.QualifierList.QualifierGroup TeamWatchingGroup;
        public 
Game.TeamArena.QualifierList.QualifierGroup TeamQualifierGroup;
        public 
Network.GamePackets.TeamArenaStatistic TeamArenaStatistic;
        public 
uint ArenaPoints
        
{
            
get
            
{
                return 
ArenaStatistic.ArenaPoints;
            }
            
set
            
{
                
ArenaStatistic.ArenaPoints =
                    
TeamArenaStatistic.ArenaPoints =
                    
value;
            }
        }
        private 
byte xpCount;
        public 
byte XPCount
        
{
            
get { return xpCount; }
            
set
            
{
                
xpCount value;
                if (
xpCount >= 100xpCount 100;

                
Update update = new Update(true);
                
update.UID Entity.UID;
                
update.Append(Update.XPCirclexpCount);
                
update.Send(this);
            }
        }
        public 
Time32 XPCountStamp Time32.Now;
        public 
Time32 XPListStamp Time32.Now;

        
#region poker
        
public Network.GamePackets.poker2090 poker2090;
        public 
Network.GamePackets.poker2091 poker2091;
        public 
Network.GamePackets.poker2092 poker2092;
        public 
Network.GamePackets.poker2093 poker2093;
        public 
Network.GamePackets.poker2094 poker2094;
        public 
Network.GamePackets.poker2095 poker2095;
        
#endregion
        
public Game.ConquerStructures.Trade Trade;
        public 
TradePartner TradePartners;
        public 
byte ExpBalls 0;
        public 
uint MoneySave 0ActiveNpc 0;
        public 
string WarehousePW1TempPassword;
        public 
uint WarehousePW;
        public 
bool WarehouseOpen;
        public 
Time32 CoolStamp;
        public 
sbyte WarehouseOpenTries;
        public 
ushort InputLength;
        public 
Mohamed_Hossam_Barakat.Game.ConquerStructures.Society.Mentor Mentor;
        public 
Mohamed_Hossam_Barakat.Game.ConquerStructures.Society.Apprentice AsApprentice;
        public 
SafeDictionary<ushortInterfaces.ISkillRemoveSpells = new SafeDictionary<ushortInterfaces.ISkill>();
        public 
SafeDictionary<ushortInterfaces.IProfProficiencies;
        public 
SafeDictionary<ushortInterfaces.ISkillSpells;
        public 
SafeDictionary<uintMohamed_Hossam_Barakat.Game.ConquerStructures.Society.FriendFriends;
        public 
SafeDictionary<uintMohamed_Hossam_Barakat.Game.ConquerStructures.Society.EnemyEnemy;
        public 
SafeDictionary<uintMohamed_Hossam_Barakat.Game.ConquerStructures.Society.TradePartnerPartners;
        public 
SafeDictionary<uintMohamed_Hossam_Barakat.Game.ConquerStructures.Society.ApprenticeApprentices;
        public 
Game.ConquerStructures.Inventory Inventory;
        public 
Game.ConquerStructures.Equipment Equipment;
        public 
SafeDictionary<Game.ConquerStructures.Warehouse.WarehouseIDGame.ConquerStructures.WarehouseWarehouses;
        public 
Game.ConquerStructures.Team Team;
        public 
Time32 lastClientJumpTime Time32.Now;
        public 
Time32 lastJumpTime Time32.Now;
        public 
int LastJumpTime 0;
        public 
short lastJumpDistance 0;
        public 
bool DoubleExpToday false;

        private 
Game.Map map;
        public 
Game.Map Map
        
{
            
get
            
{
                if (
map == null)
                {
                    if (
Entity == null) return null;
                    
Kernel.Maps.TryGetValue(Entity.MapIDout map);
                    
//   if (Entity.MapID >= 11000 && map == null)
                    //      Entity.MapID = 1005;
                    
if (map == null)
                        return (
map = new Game.Map(Entity.MapIDDatabase.MapsTable.MapInformations[Entity.MapID].BaseIDDatabase.DMaps.MapPaths[Database.MapsTable.MapInformations[Entity.MapID].BaseID]));
                }
                else
                {
                    if (
map.ID != Entity.MapID)
                    {
                        
Kernel.Maps.TryGetValue(Entity.MapIDout map);
                        
//     if (Entity.MapID >= 11000 && map == null)
                        //         Entity.MapID = 1005;
                        
if (map == null)
                            return (
map = new Game.Map(Entity.MapIDDatabase.MapsTable.MapInformations[Entity.MapID].BaseIDDatabase.DMaps.MapPaths[Database.MapsTable.MapInformations[Entity.MapID].BaseID]));
                    }
                }
                return 
map;
            }
        }

        public 
uint ExpBall
        
{
            
get
            
{
                
ulong exp Database.DataHolder.LevelExperience(Entity.Level);
                return (
uint)(exp 13000 / (ulong)((Entity.Level Entity.Level Entity.Level 12) + 1));
            }
        }
        public 
bool AddProficiency(IProf proficiency)
        {
            if (
Proficiencies.ContainsKey(proficiency.ID))
            {
                
Proficiencies[proficiency.ID].Level proficiency.Level;
                
Proficiencies[proficiency.ID].Experience proficiency.Experience;
                
proficiency.Send(this);
                return 
false;
            }
            
Proficiencies.Add(proficiency.IDproficiency);
            
proficiency.Send(this);
            return 
true;
        }

        public 
bool AddSpell(Interfaces.ISkill spell)
        {
            if (
Spells.ContainsKey(spell.ID))
            {
                if (
Spells[spell.ID].Level spell.Level)
                {
                    
Spells[spell.ID].Level spell.Level;
                    
Spells[spell.ID].Experience spell.Experience;
                    if (
spell.ID != 3060)
                    {
                        
spell.Send(this);
                    }
                }
                return 
false;
            }
            else
            {
                if (
spell.ID == 1045 || spell.ID == 1046)
                {
                    
//if (Proficiencies.ContainsKey(Database.SpellTable.SpellInformations[spell.ID][spell.Level].WeaponSubtype))
                    //{
                    //    if (Proficiencies[Database.SpellTable.SpellInformations[spell.ID][spell.Level].WeaponSubtype].Level < 5)
                    //        return false;
                    //}
                    //else
                    //    return false;
                
}
                
Spells.Add(spell.IDspell);
                if (
spell.ID != 3060)
                {
                    
spell.Send(this);
                    
//      Database.SkillTable.SaveSpells(this, spell.ID);//Samak
                
}
                
Database.SkillTable.SaveSpells(this);//Samak
                
CheckSpells();
                return 
true;
            }
        }

        public 
bool RemoveSpell(Interfaces.ISkill spell)
        {
            if (
Spells.ContainsKey(spell.ID))
            {
                
Spells.Remove(spell.ID);
                
Network.GamePackets.Data data = new Data(true);
                
data.UID Entity.UID;
                
data.dwParam spell.ID;
                
data.ID 109;
                
Send(data);
                
Database.SkillTable.DeleteSpell(thisspell.ID);
                
CheckSpells();
                return 
true;
            }
            return 
false;
        }
        public 
bool WentToComplete false;
        public 
byte SelectedGem 0;
        public 
Time32 LastMentorSave Time32.Now;
        public 
void IncreaseExperience(ulong experiencebool addMultiple)
        {
            if (
Entity.ContainsFlag(Update.Flags.Cursed))
                return;
            if (
Entity.Dead) return;
            
byte level Entity.Level;
            
ulong _experience Entity.Experience;
            
ulong prExperienece experience;
            if (
addMultiple)
            {
                if (
Entity.VIPLevel 0)
                    
experience *= Entity.VIPLevel;
                
experience *= Constants.ExtraExperienceRate;
                if (
Entity.HeavenBlessing 0)
                    
experience += (uint)(experience 20 100);
                if (
Entity.Reborn >= 2)
                    
experience /= 3;

                if (
Guild != null)
                {
                    if (
Guild.Level 0)
                    {
                        
experience += (ushort)(experience Guild.Level 100);
                    }
                }
                
prExperienece experience + (ulong)(experience * ((float)Entity.BattlePower 100));

                
_experience += prExperienece;
            }
            else
                
_experience += experience;

            if (
this.Entity.Auto == true)
            {
                
this.Entity.autohuntxp += experience;
            }
            if (
Entity.Level 140)
            {
                while (
_experience >= Database.DataHolder.LevelExperience(level) && level 140)
                {
                    
_experience -= Database.DataHolder.LevelExperience(level);
                    
level++;
                    if (
Entity.Reborn == 1)
                    {
                        if (
level >= 130 && Entity.FirstRebornLevel 130 && level Entity.FirstRebornLevel)
                            
level Entity.FirstRebornLevel;
                    }
                    else if (
Entity.Reborn == 2)
                    {
                        if (
level >= 130 && Entity.SecondRebornLevel 130 && level Entity.SecondRebornLevel)
                            
level Entity.SecondRebornLevel;
                    }
                    
Database.MagicTypeOP.AnalayzeSkills(this0);
                    if (
Mentor != null)
                    {
                        if (
Mentor.IsOnline)
                        {
                            
uint exExp = (uint)(level 2);
                            
Mentor.Client.PrizeExperience += exExp;
                            
AsApprentice Mentor.Client.Apprentices[Entity.UID];
                            if (
AsApprentice != null)
                            {
                                
AsApprentice.Actual_Experience += exExp;
                                
AsApprentice.Total_Experience += exExp;
                            }
                            if (
Mentor.Client.PrizeExperience 50 606)
                                
Mentor.Client.PrizeExperience 50 606;
                        }
                    }
                    if (
level == 70)
                    {
                        if (
ArenaStatistic == null || ArenaStatistic.EntityID == 0)
                        {
                            
ArenaStatistic = new Mohamed_Hossam_Barakat.Network.GamePackets.ArenaStatistic(true);
                            
ArenaStatistic.EntityID Entity.UID;
                            
ArenaStatistic.Name Entity.Name;
                            
ArenaStatistic.Level Entity.Level;
                            
ArenaStatistic.Class = Entity.Class;
                            
ArenaStatistic.Model Entity.Mesh;
                            
ArenaPoints Database.ArenaTable.ArenaPointFill(Entity.Level);
                            
ArenaStatistic.LastArenaPointFill DateTime.Now;
                            
Database.ArenaTable.InsertArenaStatistic(this);
                            
ArenaStatistic.Status Network.GamePackets.ArenaStatistic.NotSignedUp;
                            
Game.Arena.ArenaStatistics.Add(Entity.UIDArenaStatistic);
                        }
                    }
                    if (
Entity.Reborn == 0)
                    {
                        if (
level <= 120)
                        {
                            
Database.DataHolder.GetStats(Entity.Class, levelthis);
                            
CalculateStatBonus();
                            
CalculateHPBonus();
                            
GemAlgorithm();
                        }
                        else
                            
Entity.Atributes += 3;
                    }
                    else
                    {
                        
Entity.Atributes += 3;
                    }
                }
                if (
Entity.Level != level)
                {
                    
Database.MagicTypeOP.AnalayzeSkills(thislevel);
                    if (
Team != null)
                    {
                        if (
Team.LowestLevelsUID == Entity.UID)
                        {
                            
Team.LowestLevel 0;
                            
Team.LowestLevelsUID 0;
                            
Team.SearchForLowest();
                        }
                    }
                    
Entity.Level level;
                    
Entity.Hitpoints Entity.MaxHitpoints;
                    
Entity.Mana Entity.MaxMana;
                    if (
Entity.Level 130)
                        
Database.EntityTable.UpdateLevel(Entity.Owner);
                    if (
Entity.Reborn == 2)
                        
Network.PacketHandler.ReincarnationHash(Entity.Owner);
                }
                if (
Entity.Experience != _experience)
                    
Entity.Experience _experience;
            }
            
#region ProdectSkills
            //DragonFury = 12300 x3
            //DragonSwing = 12200 x2
            
if (this.Spells.ContainsKey(12300) && !this.Entity.PureLeeLong())
            {
                
this.RemoveSpell(new Spell(true) { ID 12300 });
            }
            if (
this.Spells.ContainsKey(12200) && !this.Entity.x2LeeLong())
            {
                
this.RemoveSpell(new Spell(true) { ID 12200 });
            }
            
#endregion
        
}
        public 
void IncreaseSpellExperience(uint experienceushort id)
        {
            if (
this.Spells.ContainsKey(id))
            {
                switch (
id)
                {
                    case 
0x50a:
                    case 
0x13a6:
                    case 
0x1b76:
                        
experience 100;
                        break;
                }
                
experience *= Constants.ExtraSpellRate;
                
experience += (uint)(experience this.Entity.Gems[6]) / 100;
                if (
this.Map.BaseID == 1039)
                {
                    
experience /= 40;
                }
                
ISkill skill this.Spells[id];
                if (
skill != null)
                {
                    if (
this.Entity.VIPLevel 0)
                    {
                        
experience *= 5;
                    }
                    
Database.SpellInformation information Database.SpellTable.SpellInformations[skill.ID][skill.Level];
                    if ((
information != null) && ((information.NeedExperience != 0) && (this.Entity.Level >= information.NeedLevel)))
                    {
                        
skill.Experience += experience;
                        
SkillTable.UpdateSpell(thisskill);
                        
bool flag false;
                        if (
skill.Experience >= information.NeedExperience)
                        {
                            
skill.Experience 0;
                            
skill.Level = (byte)(skill.Level 1);
                            
flag true;
                            
this.Send(Constants.SpellLeveled);
                            
SkillTable.UpdateSpell(thisskill);
                        }
                        if (
flag)
                        {
                            
skill.Send(this);
                            
SkillTable.UpdateSpell(thisskill);
                        }
                        else
                        {
                            
SkillExperience experience2 = new SkillExperience(true);
                            
experience2.AppendSpell(skill.IDskill.Experience);
                            
experience2.Send(this);
                            
SkillTable.UpdateSpell(thisskill);
                        }
                    }
                }
            }
        }
        public 
void IncreaseProficiencyExperience(uint experienceushort id)
        {
            if (
Proficiencies.ContainsKey(id))
            {
                
Interfaces.IProf proficiency Proficiencies[id];
                
experience *= Constants.ExtraProficiencyRate;
                
experience += (uint)(experience Entity.Gems[5] / 100);
                if (
Entity.VIPLevel 0)
                {
                    
experience *= 5;
                }
                
proficiency.Experience += experience;
                if (
proficiency.Level 20)
                {
                    
bool leveled false;
                    while (
proficiency.Experience >= Database.DataHolder.ProficiencyLevelExperience(proficiency.Level))
                    {
                        
proficiency.Experience -= Database.DataHolder.ProficiencyLevelExperience(proficiency.Level);
                        
proficiency.Level++;
                        if (
proficiency.Level == 20)
                        {
                            
proficiency.Experience 0;
                            
proficiency.Send(this);
                            
Send(Constants.ProficiencyLeveled);
                            return;
                        }
                        
proficiency.NeededExperience Database.DataHolder.ProficiencyLevelExperience(proficiency.Level);
                        
leveled true;
                        
Send(Constants.ProficiencyLeveled);
                    }
                    if (
leveled)
                    {
                        
proficiency.Send(this);
                    }
                    else
                    {
                        
Network.GamePackets.SkillExperience update = new SkillExperience(true);
                        
update.AppendProficiency(proficiency.IDproficiency.ExperienceDatabase.DataHolder.ProficiencyLevelExperience(proficiency.Level));
                        
update.Send(this);
                    }
                }

            }
            else
            {
                
AddProficiency(new Network.GamePackets.Proficiency(true) { ID id });
            }
        }

        public 
byte ExtraAtributePoints(byte levelbyte mClass)
        {
            if (
mClass == 135)
            {
                if (
level <= 110)
                    return 
0;
                switch (
level)
                {
                    case 
112: return 1;
                    case 
114: return 3;
                    case 
116: return 6;
                    case 
118: return 10;
                    case 
120: return 15;
                    case 
121: return 15;
                    case 
122: return 21;
                    case 
123: return 21;
                    case 
124: return 28;
                    case 
125: return 28;
                    case 
126: return 36;
                    case 
127: return 36;
                    case 
128: return 45;
                    case 
129: return 45;
                    default:
                        return 
55;
                }
            }
            else
            {
                if (
level <= 120)
                    return 
0;
                switch (
level)
                {
                    case 
121: return 1;
                    case 
122: return 3;
                    case 
123: return 6;
                    case 
124: return 10;
                    case 
125: return 15;
                    case 
126: return 21;
                    case 
127: return 28;
                    case 
128: return 36;
                    case 
129: return 45;
                    default:
                        return 
55;
                }
            }
        }
        public static 
ISkill LearnableSpell(ushort spellid)
        {
            
ISkill spell = new Spell(true);
            
spell.ID spellid;
            return 
spell;
        }
        public 
bool Reborn(byte toClass)
        {
            
#region Items
            
if (Inventory.Count 37) return false;
            switch (
toClass)
            {
                case 
11:
                case 
21:
                case 
51:
                case 
61:
                case 
71:
                    {
                        
Inventory.Add(410077Game.Enums.ItemEffect.Poison);
                        break;
                    }
                case 
41:
                    {
                        
Inventory.Add(500057Game.Enums.ItemEffect.Shield);
                        break;
                    }
                case 
132:
                case 
142:
                    {
                        if (
toClass == 132)
                            
Inventory.Add(421077Game.Enums.ItemEffect.MP);
                        else
                            
Inventory.Add(421077Game.Enums.ItemEffect.HP);
                        break;
                    }
            }
            
#region Low level items
            
for (byte i 19i++)
            {
                if (
!= 7)
                {
                    
ConquerItem item Equipment.TryGetItem(i);
                    if (
item != null && item.ID != 0)
                    {
                        try
                        {
                            
//UnloadItemStats(item, false);
                            
Database.ConquerItemInformation cii = new Mohamed_Hossam_Barakat.Database.ConquerItemInformation(item.IDitem.Plus);
                            
item.ID cii.LowestID(Network.PacketHandler.ItemMinLevel(Network.PacketHandler.ItemPosition(item.ID)));
                            
item.Mode Mohamed_Hossam_Barakat.Game.Enums.ItemMode.Update;
                            
item.Send(this);
                            
LoadItemStats();
                            
Database.ConquerItemTable.UpdateItemID(itemthis);
                        }
                        catch
                        {
                            
Console.WriteLine("Reborn item problem: " item.ID);
                        }
                    }
                }
            }
            
ConquerItem hand Equipment.TryGetItem(5);
            if (
hand != null)
            {
                
Equipment.Remove(5);
                
CalculateStatBonus();
                
CalculateHPBonus();
            }
            
hand Equipment.TryGetItem(25);
            if (
hand != null)
            {
                
Equipment.Remove(25);
                
CalculateStatBonus();
                
CalculateHPBonus();
            }
            
LoadItemStats();
            
SendScreen(Entity.SpawnPacketfalse);
            
#endregion
            #endregion
            
            
Database.MagicTypeOP.Reborn(thistoClass);
            
            if (
Entity.Reborn == 0)
            {
                
Entity.FirstRebornClass Entity.Class;
                
Entity.FirstRebornLevel Entity.Level;
                
Entity.Atributes =
                    (
ushort)(ExtraAtributePoints(Entity.FirstRebornClassEntity.FirstRebornLevel) + 52);
            }
            else
            {
                
Entity.SecondRebornClass Entity.Class;
                
Entity.SecondRebornLevel Entity.Level;
                
Entity.Atributes =
                    (
ushort)(ExtraAtributePoints(Entity.FirstRebornClassEntity.FirstRebornLevel) +
                    
ExtraAtributePoints(Entity.SecondRebornClassEntity.SecondRebornLevel) + 62);
            }
            
byte PreviousClass Entity.Class;
            
Entity.Reborn++;
            
Entity.Class = toClass;
            
Entity.Level 15;
            
Entity.Experience 0;
            
#region Proficiencies
            
foreach (Interfaces.IProf proficiency in Proficiencies.Values)
            {
                
proficiency.PreviousLevel proficiency.Level;
                
proficiency.Level 0;
                
proficiency.Experience 0;
                
proficiency.Send(this);
            }
            
#endregion
            
Database.DataHolder.GetStats(Entity.Class, Entity.Levelthis);
            
LoadItemStats();
            
#region The View Of Wepeon
            
ClientEquip eqs = new ClientEquip();
            
eqs.DoEquips(this);
            
Send(eqs);
            
Equipment.UpdateEntityPacket();
            
#endregion
            #region Adding earned skills
            
if (Entity.Reborn == 2)
                
AddSpell(new Spell(true) { ID 9876 });
            if (
Entity.FirstRebornClass == 55 && Entity.SecondRebornClass == 55 && Entity.Class == 51 && Entity.Reborn == 2)
                
AddSpell(new Spell(true) { ID 6002 });
            if (
Entity.FirstRebornClass == 15 && Entity.SecondRebornClass == 15 && Entity.Class == 11 && Entity.Reborn == 2)
                
AddSpell(new Spell(true) { ID 10315 });
            if (
Entity.FirstRebornClass == 25 && Entity.SecondRebornClass == 25 && Entity.Class == 21 && Entity.Reborn == 2)
                
AddSpell(new Spell(true) { ID 10311 });
            if (
Entity.FirstRebornClass == 45 && Entity.SecondRebornClass == 45 && Entity.Class == 41 && Entity.Reborn == 2)
                
AddSpell(new Spell(true) { ID 10313 });
            if (
Entity.FirstRebornClass == 55 && Entity.SecondRebornClass == 55 && Entity.Class == 51 && Entity.Reborn == 2)
                
AddSpell(new Spell(true) { ID 6003 });
            if (
Entity.FirstRebornClass == 65 && Entity.SecondRebornClass == 65 && Entity.Class == 61 && Entity.Reborn == 2)
                
AddSpell(new Spell(true) { ID 10405 });
            if (
Entity.FirstRebornClass == 85 && Entity.SecondRebornClass == 85 && Entity.Class == 81 && Entity.Reborn == 2)
                
AddSpell(new Spell(true) { ID 12300 });
            if (
Entity.FirstRebornClass == 135 && Entity.SecondRebornClass == 135 && Entity.Class == 132 && Entity.Reborn == 2)
                
AddSpell(new Spell(true) { ID 30000 });
            if (
Entity.FirstRebornClass == 145 && Entity.SecondRebornClass == 145 && Entity.Class == 142 && Entity.Reborn == 2)
                
AddSpell(new Spell(true) { ID 10310 });
            if (
Entity.Reborn == 1)
            {
                if (
Entity.FirstRebornClass == 75 && Entity.Class == 71)
                {
                    
AddSpell(new Spell(true) { ID 3050 });
                }
                if (
toClass == 81 && PreviousClass == 85 && Entity.Reborn == 1)
                    
AddSpell(new Spell(true) { ID 12280 });
                if (
Entity.FirstRebornClass == 15 && Entity.Class == 11)
                {
                    
AddSpell(new Spell(true) { ID 3050 });
                }
                else if (
Entity.FirstRebornClass == 25 && Entity.Class == 21)
                {
                    
AddSpell(new Spell(true) { ID 3060 });
                }
                else if (
Entity.FirstRebornClass == 145 && Entity.Class == 142)
                {
                    
AddSpell(new Spell(true) { ID 3080 });
                }
                else if (
Entity.FirstRebornClass == 135 && Entity.Class == 132)
                {
                    
AddSpell(new Spell(true) { ID 3090 });
                }
            }
            if (
Entity.Reborn == 2)
            {
                if (
Entity.SecondRebornClass == 75 && Entity.Class == 71)
                {
                    
AddSpell(new Spell(true) { ID 3050 });
                }
                if (
Entity.SecondRebornClass == 15 && Entity.Class == 11)
                {
                    
AddSpell(new Spell(true) { ID 3050 });
                }
                else if (
Entity.SecondRebornClass == 25)
                {
                    
AddSpell(new Spell(true) { ID 3060 });
                }
                else if (
Entity.SecondRebornClass == 145 && Entity.Class == 142)
                {
                    
AddSpell(new Spell(true) { ID 3080 });
                }
                else if (
Entity.SecondRebornClass == 135 && Entity.Class == 132)
                {
                    
AddSpell(new Spell(true) { ID 3090 });
                }
            }
            
#endregion
            
RemoveSpell(new Spell(true) { ID 3060 });
            if (
Entity.FirstRebornClass == 25 || Entity.SecondRebornClass == 25)
            {
                
AddSpell(new Spell(true) { ID 3060 });
            }
            
Database.EntityTable.SaveEntity(this);
            
Database.SkillTable.SaveSpells(this);
            
Database.SkillTable.SaveProficiencies(this);
            
Kernel.SendWorldMessage(new Message("" Entity.Name " has got " Entity.Reborn " reborns. Congratulations!"System.Drawing.Color.WhiteMessage.Center), Program.Values);
            
#region ProdectSkills
            //DragonFury = 12300 x3
            //DragonSwing = 12200 x2
            
if (Spells.ContainsKey(12300) && !Entity.PureLeeLong())
            {
                
RemoveSpell(new Spell(true) { ID 12300 });
            }
            if (
Spells.ContainsKey(12200) && !Entity.x2LeeLong())
            {
                
RemoveSpell(new Spell(true) { ID 12200 });
            }
            
#endregion
            
return true;
        }
        
#region Items

        //private int StatHP;
        //public uint[] ArsenalDonations;
        //public uint GetArsenalDonation()
        //{
        //    uint val = 0;
        //    foreach (var Uint in ArsenalDonations)
        //        val += Uint;
        //    using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
        //        cmd.Update("entities").Set("GuildArsenalDonation", (uint)val).Where("UID", this.Entity.UID)
        //            .Execute();
        //    return val;
        //}
        //public void CalculateHPBonus()
        //{
        //    //  if ((int)Account.State >= 3) return;
        //    switch (Entity.Class)
        //    {
        //        case 11: Entity.MaxHitpoints = (uint)(StatHP * 1.05F); break;
        //        case 12: Entity.MaxHitpoints = (uint)(StatHP * 1.08F); break;
        //        case 13: Entity.MaxHitpoints = (uint)(StatHP * 1.10F); break;
        //        case 14: Entity.MaxHitpoints = (uint)(StatHP * 1.12F); break;
        //        case 15: Entity.MaxHitpoints = (uint)(StatHP * 1.15F); break;
        //        default: Entity.MaxHitpoints = (uint)StatHP; break;
        //    }
        //    Entity.MaxHitpoints += Entity.ItemHP;
        //    var plus = Entity.SubClasses.Classes.SingleOrDefault(x => x.Value.ID == 9);
        //    if (plus.Value != null && Entity.SubClass == 9)
        //        Entity.MaxHitpoints += (uint)(plus.Value.Level * 100);
        //    Entity.Hitpoints = Math.Min(Entity.Hitpoints, Entity.MaxHitpoints);
        //}
        //public void CalculateStatBonus()
        //{
        //    byte ManaBoost = 5;
        //    const byte HitpointBoost = 24;
        //    sbyte Class = (sbyte)(Entity.Class / 10);
        //    if (Class == 13 || Class == 14)
        //        ManaBoost += (byte)(5 * (Entity.Class - (Class * 10)));
        //    StatHP = (ushort)((Entity.Strength * 3) +
        //                             (Entity.Agility * 3) +
        //                             (Entity.Spirit * 3) +
        //                             (Entity.Vitality * HitpointBoost));
        //    Entity.MaxMana = (ushort)((Entity.Spirit * ManaBoost) + Entity.ItemMP);
        //    Entity.Mana = Math.Min(Entity.Mana, Entity.MaxMana);
        //}
        //public void SendStatMessage()
        //{
        //    this.ReviewMentor();
        //    Network.GamePackets.Message Msg = new Mohamed_Hossam_Barakat.Network.GamePackets.Message(" Your status has been changed", System.Drawing.Color.DarkGoldenrod
        //        , Network.GamePackets.Message.TopLeft);
        //    Msg.__Message = string.Format(Msg.__Message,
        //        new object[] { Entity.MinAttack, Entity.MaxAttack, Entity.MagicAttack, Entity.Defence, (Entity.MagicDefence + Entity.MagicDefence), Entity.Dodge, Entity.PhysicalDamageDecrease, Entity.MagicDamageDecrease, Entity.PhysicalDamageIncrease, Entity.MagicDamageIncrease, Entity.Hitpoints, Entity.MaxHitpoints, Entity.Mana, Entity.MaxMana, Entity.BattlePower });
        //    this.Send(Msg);
        //}

        //private bool AreStatsLoadable(ConquerItem item)
        //{
        //    if (!AlternateEquipment)
        //        if (item.Position > 20)
        //            return false;
        //    if (AlternateEquipment)
        //        if (item.Position < 20)
        //            if (!Equipment.Free((byte)(20 + item.Position)))
        //                return false;

        //    int Position = item.Position;
        //    if (item.Position > 20) Position -= 20;

        //    if (Position == ConquerItem.LeftWeapon || Position == ConquerItem.RightWeapon)
        //        return false;

        //    return true;
        //}

        //private Tuple<ConquerItem, ConquerItem> ComputeWeapons()
        //{
        //    if (!AlternateEquipment)
        //    {
        //        return new Tuple<ConquerItem, ConquerItem>(
        //            Equipment.TryGetItem(ConquerItem.RightWeapon),
        //            Equipment.TryGetItem(ConquerItem.LeftWeapon));
        //    }
        //    else
        //    {
        //        if (Equipment.Free(ConquerItem.AlternateRightWeapon))
        //        {
        //            return new Tuple<ConquerItem, ConquerItem>(
        //                Equipment.TryGetItem(ConquerItem.RightWeapon),
        //                Equipment.TryGetItem(ConquerItem.LeftWeapon));
        //        }
        //        else
        //        {
        //            if (Equipment.Free(ConquerItem.RightWeapon))
        //            {
        //                return new Tuple<ConquerItem, ConquerItem>(
        //                    Equipment.TryGetItem(ConquerItem.AlternateRightWeapon),
        //                    Equipment.TryGetItem(ConquerItem.AlternateLeftWeapon));
        //            }
        //            else
        //            {
        //                if (!Equipment.Free(ConquerItem.AlternateLeftWeapon))
        //                {
        //                    return new Tuple<ConquerItem, ConquerItem>(
        //                        Equipment.TryGetItem(ConquerItem.AlternateRightWeapon),
        //                        Equipment.TryGetItem(ConquerItem.AlternateLeftWeapon));
        //                }
        //                else
        //                {
        //                    if (Equipment.Free(ConquerItem.LeftWeapon))
        //                    {
        //                        return new Tuple<ConquerItem, ConquerItem>(
        //                            Equipment.TryGetItem(ConquerItem.AlternateRightWeapon),
        //                            null);
        //                    }
        //                    else
        //                    {
        //                        ConquerItem aRight = Equipment.TryGetItem(ConquerItem.AlternateRightWeapon),
        //                                     nLeft = Equipment.TryGetItem(ConquerItem.LeftWeapon);
        //                        if (PacketHandler.IsTwoHand(aRight.ID))
        //                        {
        //                            if (PacketHandler.IsArrow(nLeft.ID))
        //                            {
        //                                if (PacketHandler.IsBow(aRight.ID))
        //                                {
        //                                    return new Tuple<ConquerItem,
        //                                        ConquerItem>(aRight, nLeft);
        //                                }
        //                                else
        //                                {
        //                                    return new Tuple<ConquerItem,
        //                                        ConquerItem>(aRight, null);
        //                                }
        //                            }
        //                            else
        //                            {
        //                                if (PacketHandler.IsShield(nLeft.ID))
        //                                {
        //                                    if (!Spells.ContainsKey(10311))//Perseverance
        //                                    {
        //                                        Send(new Message("You need to know Perseverance (Pure Warrior skill) to be able to wear 2-handed weapon and shield.", System.Drawing.Color.Red, Message.Talk));
        //                                        return new Tuple<ConquerItem,
        //                                            ConquerItem>(aRight, null);
        //                                    }
        //                                    else
        //                                    {
        //                                        return new Tuple<ConquerItem,
        //                                            ConquerItem>(aRight, nLeft);
        //                                    }
        //                                }
        //                                else
        //                                {
        //                                    return new Tuple<ConquerItem,
        //                                        ConquerItem>(aRight, null);
        //                                }
        //                            }
        //                        }
        //                        else
        //                        {
        //                            if (!PacketHandler.IsTwoHand(nLeft.ID))
        //                            {
        //                                return new Tuple<ConquerItem,
        //                                    ConquerItem>(aRight, nLeft);
        //                            }
        //                            else
        //                            {
        //                                return new Tuple<ConquerItem,
        //                                    ConquerItem>(aRight, null);
        //                            }
        //                        }
        //                    }
        //                }
        //            }
        //        }
        //    }
        //}

        //public int[][] ChampionAllowedStats = new int[][]
        //{
        //    new int[] {1, 0, 0, 0, 0, 0, 0, 30, 0, 0 },
        //    new int[] {2, 0, 0, 0, 0, 0, 0, 40, 1, 1 },
        //    new int[] {3, 1, 0, 0, 0, 0, 50, 50, 2, 3 },
        //    new int[] {4, 3, 1, 1, 0, 0, 100, 60, 5, 4 },
        //    new int[] {5, 5, 1, 1, 1, 0, 150, 70, 7, 5 },
        //    new int[] {6, 5, 1, 1, 1, 0, 200, 80, 9, 7 },
        //    new int[] {12, 7, 2, 2, 1, 1, 255, 100, 12, 9 }
        //};
        //public bool DoChampStats { get { return ChampionGroup != null; } }
        //private int _accuracy;
        //public int Accuracy
        //{
        //    get { return _accuracy; }
        //}
        //public void LoadItemStats()
        //{
        //    uint bStats = Entity.Hitpoints;
        //    for (int i = 0; i < 30; i++)
        //        if (Equipment.Objects[i] != null)
        //            Equipment.Objects[i].IsWorn = false;

        //    #region Set Every Variable to Zero
        //    Entity.Defence = 0;
        //    Entity.MagicDefence = 0;
        //    Entity.MagicDefencePercent = 0;
        //    Entity.BaseMagicAttack = 0;
        //    Entity.BaseMagicDefence =
        //    Entity.BaseMaxAttack =
        //    Entity.BaseMinAttack =
        //    Entity.PhysicalDamageDecrease =
        //    Entity.PhysicalDamageIncrease =
        //    Entity.MagicDamageDecrease =
        //    Entity.MagicDamageIncrease = 0;
        //    Entity.ItemHP = 0;
        //    Entity.ItemHP =
        //    Entity.ItemMP =
        //    Entity.AttackRange = (byte)0;
        //    Entity.Dodge = 0;
        //    Entity.MinAttack = 0;
        //    Entity.MaxAttack = 0;
        //    Entity.Defence = 0;
        //    Entity.SuperItemBless = 0;
        //    Entity.MagicDefence = 0;
        //    Entity.Dodge = 0;
        //    Entity.BaseMagicAttack = 0;
        //    Entity.WoodResistance = 0;
        //    Entity.FireResistance = 0;
        //    Entity.WaterResistance = 0;
        //    Entity.EarthResistance = 0;
        //    Entity.Breaktrough = 0;
        //    Entity.WearsGoldPrize = false;
        //    Entity.CriticalStrike = 0;
        //    Entity.Immunity = 0;
        //    Entity.Penetration = 0;
        //    Entity.Counteraction = 0;
        //    Entity.Block = 0;
        //    _accuracy = 0;
        //    Entity.Detoxication = 0;
        //    Entity.Intensification = 0;
        //    Entity.Penetration = 0;
        //    Entity.SkillCStrike = 0;
        //    Entity.MaxAttack = 0;
        //    Entity.MinAttack = 0;
        //    Entity.PhysicalDamageDecrease = 0;
        //    Entity.MagicDamageDecrease = 0;
        //    Entity.MagicDamageIncrease = 0;
        //    Entity.PhysicalDamageIncrease = 0;
        //    Entity.MagicDefencePercent = 0;
        //    Entity.ItemHP = 0;
        //    Entity.ItemMP = 0;
        //    Entity.ItemBless = 0;
        //    Entity.AttackRange = 1;
        //    Entity.BaseMinAttack = 0;
        //    Entity.BaseMaxAttack = 0;
        //    Entity.BaseMagicDefence = 0;
        //    Entity.BaseDefence = 0;
        //    Entity.MagicDamageIncrease = 0;
        //    Entity.Gems = new double[10];
        //    #endregion

        //    foreach (ConquerItem i in Equipment.Objects)
        //    {
        //        if (i == null) continue;
        //        if (i.Durability == 0) continue;
        //        if (!AreStatsLoadable(i)) continue;
        //        loadItemStats(i);
        //    }

        //    Weapons = ComputeWeapons();
        //    if (Weapons == null) Weapons = new Tuple<ConquerItem, ConquerItem>(null, null);
        //    if (Weapons.Item1 != null)
        //    {
        //        loadItemStats(Weapons.Item1);
        //        if (Weapons.Item2 != null)
        //        {
        //            if (!Weapons.Item1.IsTwoHander())
        //                loadItemStats(Weapons.Item2);
        //            else
        //                if (PacketHandler.IsArrow(Weapons.Item2.ID) || (Entity.Class >= 20 && Entity.Class <= 25))
        //                    loadItemStats(Weapons.Item2);
        //        }
        //    }

        //    #region Subclasses
        //    foreach (var c in Entity.SubClasses.Classes)
        //    {
        //        int lvl = c.Value.Level;
        //        if (DoChampStats) lvl = Math.Min(lvl, ChampionAllowedStats[ChampionStats.Grade][9]);
        //        switch ((Mohamed_Hossam_Barakat.Game.ClassID)c.Value.ID)
        //        {
        //            case Game.ClassID.MartialArtist:
        //                {
        //                    Entity.CriticalStrike += (ushort)(Entity.CriticalStrike - (Entity.CriticalStrike * (lvl / 15)));
        //                    break;
        //                }
        //            case Game.ClassID.Warlock:
        //                {
        //                    Entity.SkillCStrike += (ushort)(Entity.SkillCStrike - (Entity.SkillCStrike * (lvl / 15)));
        //                    break;
        //                }
        //            case Game.ClassID.ChiMaster:
        //                {
        //                    Entity.Immunity += (ushort)(Entity.Immunity - (Entity.Immunity * (lvl / 15)));
        //                    break;
        //                }
        //            case Game.ClassID.Sage:
        //                {
        //                    Entity.Penetration += (ushort)(Entity.Penetration - (Entity.Penetration * (lvl / 15)));
        //                    break;
        //                }
        //            case Game.ClassID.Apothecary:
        //                {
        //                    //double per = lvl * 8 / 10;
        //                    Entity.Detoxication += (ushort)(Entity.Detoxication - (Entity.Detoxication * (lvl / 15)));//per));
        //                    break;
        //                }
        //            case Game.ClassID.Performer:
        //                {
        //                    int per = lvl * 100;
        //                    Entity.BaseMaxAttack += (uint)per / 2;
        //                    Entity.BaseMinAttack += (uint)per / 2;
        //                    Entity.BaseMagicAttack += (uint)per;
        //                    break;
        //                }
        //        }
        //    }
        //    #endregion
        //    #region Chi
        //    uint percentage = 100;
        //    if (DoChampStats)
        //        percentage = (uint)ChampionAllowedStats[ChampionStats.Grade][7];
        //    foreach (var chiPower in ChiPowers)
        //    {
        //        foreach (var attribute in chiPower.Attributes)
        //        {
        //            switch (attribute.Type)
        //            {
        //                case Game.Enums.ChiAttribute.CriticalStrike:
        //                    Entity.CriticalStrike += (int)((ushort)(attribute.Value * 10) * percentage / 100);
        //                    break;
        //                case Game.Enums.ChiAttribute.Counteraction:
        //                    Entity.Counteraction += (ushort)(attribute.Value * percentage / 100);
        //                    break;
        //                case Game.Enums.ChiAttribute.AddAttack:
        //                    Entity.BaseMinAttack += attribute.Value * percentage / 100;
        //                    Entity.BaseMaxAttack += attribute.Value * percentage / 100;
        //                    break;
        //                case Game.Enums.ChiAttribute.AddMagicAttack:
        //                    Entity.BaseMagicAttack += attribute.Value * percentage / 100;
        //                    break;
        //                case Game.Enums.ChiAttribute.AddMagicDefense:
        //                    Entity.BaseMagicDefence += attribute.Value * percentage / 100;
        //                    break;
        //                case Game.Enums.ChiAttribute.Breakthrough:
        //                    Entity.Breaktrough += (ushort)(attribute.Value * percentage / 100);
        //                    break;
        //                case Game.Enums.ChiAttribute.HPAdd:
        //                    Entity.ItemHP += attribute.Value * percentage / 100;
        //                    break;
        //                case Game.Enums.ChiAttribute.Immunity:
        //                    Entity.Immunity += (int)((ushort)(attribute.Value * 10) * percentage / 100);
        //                    break;
        //                case Game.Enums.ChiAttribute.MagicDamageDecrease:
        //                    Entity.MagicDamageDecrease += (ushort)(attribute.Value * percentage / 100);
        //                    break;
        //                case Game.Enums.ChiAttribute.MagicDamageIncrease:
        //                    Entity.MagicDamageIncrease += (ushort)(attribute.Value * percentage / 100);
        //                    break;
        //                case Game.Enums.ChiAttribute.PhysicalDamageDecrease:
        //                    Entity.PhysicalDamageDecrease += (ushort)(attribute.Value * percentage / 100);
        //                    break;
        //                case Game.Enums.ChiAttribute.PhysicalDamageIncrease:
        //                    Entity.PhysicalDamageIncrease += (ushort)(attribute.Value * percentage / 100);
        //                    break;
        //                case Game.Enums.ChiAttribute.SkillCriticalStrike:
        //                    Entity.SkillCStrike += (int)((ushort)(attribute.Value * 10) * percentage / 100);
        //                    break;
        //            }
        //        }
        //    }
        //    #region Dragon Ranking
        //    if (ChiData.DragonRank <= 50 && ChiPowers.Count > 0)
        //    {
        //        if (ChiData.DragonRank <= 3)
        //        {
        //            Entity.ItemHP += 5000;
        //            Entity.BaseMagicDefence += 300;
        //            Entity.PhysicalDamageDecrease += 1000;
        //            Entity.MagicDamageDecrease += 300;
        //        }
        //        else if (ChiData.DragonRank <= 15)
        //        {
        //            Entity.ItemHP += (uint)(3000 - (ChiData.DragonRank - 4) * 90);
        //            Entity.BaseMagicDefence += (uint)(250 - (ChiData.DragonRank - 4) * 9);
        //            Entity.PhysicalDamageDecrease += (ushort)(600 - (ChiData.DragonRank - 4) * 18);
        //            Entity.MagicDamageDecrease += (ushort)(200 - (ChiData.DragonRank - 4) * 4);
        //        }
        //        else if (ChiData.DragonRank <= 50)
        //        {
        //            Entity.ItemHP += 1500;
        //            Entity.BaseMagicDefence += 100;
        //            Entity.PhysicalDamageDecrease += 300;
        //            Entity.MagicDamageDecrease += 100;
        //        }
        //    }
        //    #endregion
        //    #region Phoenix Ranking
        //    if (ChiData.PhoenixRank <= 50 && ChiPowers.Count > 1)
        //    {
        //        if (ChiData.PhoenixRank <= 3)
        //        {
        //            Entity.BaseMinAttack += 3000;
        //            Entity.BaseMaxAttack += 3000;
        //            Entity.BaseMagicAttack += 3000;
        //            Entity.PhysicalDamageIncrease += 1000;
        //            Entity.MagicDamageIncrease += 300;
        //        }
        //        else if (ChiData.PhoenixRank <= 15)
        //        {
        //            Entity.BaseMinAttack += (uint)(2000 - (ChiData.PhoenixRank - 4) * 45);
        //            Entity.BaseMaxAttack += (uint)(2000 - (ChiData.PhoenixRank - 4) * 45);
        //            Entity.BaseMagicAttack += (uint)(2000 - (ChiData.PhoenixRank - 4) * 45);
        //            Entity.PhysicalDamageIncrease += (ushort)(600 - (ChiData.PhoenixRank - 4) * 18);
        //            Entity.MagicDamageIncrease += (ushort)(200 - (ChiData.PhoenixRank - 4) * 4);
        //        }
        //        else if (ChiData.PhoenixRank <= 50)
        //        {
        //            Entity.BaseMinAttack += 1000;
        //            Entity.BaseMaxAttack += 1000;
        //            Entity.BaseMagicAttack += 1000;
        //            Entity.PhysicalDamageIncrease += 300;
        //            Entity.MagicDamageIncrease += 100;
        //        }
        //    }
        //    #endregion
        //    #region Tiger Ranking
        //    if (ChiData.TigerRank <= 50 && ChiPowers.Count > 2)
        //    {
        //        if (ChiData.TigerRank <= 3)
        //        {
        //            Entity.CriticalStrike += 1500;
        //            Entity.SkillCStrike += 1500;
        //            Entity.Immunity += 800;
        //        }
        //        else if (ChiData.TigerRank <= 15)
        //        {
        //            Entity.CriticalStrike += (ushort)(1100 - (ChiData.TigerRank - 4) * 10);
        //            Entity.SkillCStrike += (ushort)(1100 - (ChiData.TigerRank - 4) * 10);
        //            Entity.Immunity += 500;
        //        }
        //        else if (ChiData.TigerRank <= 50)
        //        {
        //            Entity.CriticalStrike += 500;
        //            Entity.SkillCStrike += 500;
        //            Entity.Immunity += 200;
        //        }
        //    }
        //    #endregion
        //    #region Turtle Ranking
        //    if (ChiData.TurtleRank <= 50 && ChiPowers.Count > 3)
        //    {
        //        if (ChiData.TurtleRank <= 3)
        //        {
        //            Entity.Breaktrough += 150;
        //            Entity.Counteraction += 150;
        //            Entity.Immunity += 800;
        //        }
        //        else if (ChiData.TurtleRank <= 15)
        //        {
        //            Entity.Breaktrough += (ushort)(110 - (ChiData.TurtleRank - 4) * 1);
        //            Entity.Counteraction += (ushort)(110 - (ChiData.TurtleRank - 4) * 1);
        //            Entity.Immunity += 500;
        //        }
        //        else if (ChiData.TurtleRank <= 50)
        //        {
        //            Entity.Breaktrough += 50;
        //            Entity.Counteraction += 50;
        //            Entity.Immunity += 200;
        //        }
        //    }
        //    #endregion
        //    #endregion

        //    if (Entity.MyJiang != null)
        //    {
        //        Entity.MyJiang.CreateStatusAtributes(Entity);
        //    }

        //    if (Entity.Aura_isActive)
        //        doAuraBonuses(Entity.Aura_actType, Entity.Aura_actPower, 1);
        //    else
        //        removeAuraBonuses(Entity.Aura_actType, Entity.Aura_actPower, 1);
        //    if (TeamAura)
        //        doAuraBonuses(TeamAuraStatusFlag, TeamAuraPower, 1);
        //    else
        //        removeAuraBonuses(TeamAuraStatusFlag, TeamAuraPower, 1);
        //    if (Entity.Class >= 60 && Entity.Class <= 65)
        //        Entity.AttackRange += 2;

        //    /*if (Entity.CriticalStrike > 9000)
        //        Entity.CriticalStrike = 9000;*/

        //    Entity.Hitpoints = bStats;
        //    CalculateStatBonus();
        //    CalculateHPBonus();
        //    ReviewMentor();
        //    GemAlgorithm();
        //    Entity.TrojanBP = (uint)Entity.BattlePower;
        //}

        //public void doAuraBonuses(ulong type, uint power, int i)
        //{
        //    switch (type)
        //    {
        //        case Update.Flags2.EarthAura:
        //            {
        //                Entity.EarthResistance += (int)power * i;
        //                break;
        //            }
        //        case Update.Flags2.FireAura:
        //            {
        //                Entity.FireResistance += (int)power * i;
        //                break;
        //            }
        //        case Update.Flags2.MetalAura:
        //            {
        //                Entity.MetalResistance += (int)power * i;
        //                break;
        //            }
        //        case Update.Flags2.WoodAura:
        //            {
        //                Entity.WoodResistance += (int)power * i;
        //                break;
        //            }
        //        case Update.Flags2.WaterAura:
        //            {
        //                Entity.WaterResistance += (int)power * i;
        //                break;
        //            }
        //        case Update.Flags2.TyrantAura:
        //            {
        //                Entity.CriticalStrike += (int)power * i * 100;
        //                Entity.SkillCStrike += (int)power * i * 100;
        //                if (Entity.CriticalStrike > 120000) Entity.CriticalStrike = 120000;
        //                if (Entity.SkillCStrike > 120000) Entity.SkillCStrike = 120000;
        //                if (Entity.CriticalStrike < 0) Entity.CriticalStrike = 0;
        //                if (Entity.SkillCStrike < 0) Entity.SkillCStrike = 0;
        //                break;
        //            }
        //        case Update.Flags2.FendAura:
        //            {
        //                Entity.Immunity += (int)power * i * 100;
        //                break;
        //            }
        //    }
        //}

        //public void removeAuraBonuses(ulong type, uint power, int i)
        //{
        //    switch (type)
        //    {
        //        case Update.Flags2.EarthAura:
        //            {
        //                Entity.EarthResistance -= (int)power * i;
        //                break;
        //            }
        //        case Update.Flags2.FireAura:
        //            {
        //                Entity.FireResistance -= (int)power * i;
        //                break;
        //            }
        //        case Update.Flags2.MetalAura:
        //            {
        //                Entity.MetalResistance -= (int)power * i;
        //                break;
        //            }
        //        case Update.Flags2.WoodAura:
        //            {
        //                Entity.WoodResistance -= (int)power * i;
        //                break;
        //            }
        //        case Update.Flags2.WaterAura:
        //            {
        //                Entity.WaterResistance -= (int)power * i;
        //                break;
        //            }
        //        case Update.Flags2.TyrantAura:
        //            {
        //                Entity.CriticalStrike -= (int)power * i * 100;
        //                Entity.SkillCStrike -= (int)power * i * 100;
        //                if (Entity.CriticalStrike > 120000) Entity.CriticalStrike = 120000;
        //                if (Entity.SkillCStrike > 120000) Entity.SkillCStrike = 120000;
        //                if (Entity.CriticalStrike < 0) Entity.CriticalStrike = 0;
        //                if (Entity.SkillCStrike < 0) Entity.SkillCStrike = 0;
        //                break;
        //            }
        //        case Update.Flags2.FendAura:
        //            {
        //                Entity.Immunity -= (int)power * i * 100;
        //                break;
        //            }
        //    }
        //}

        //private void loadItemStats(ConquerItem item)
        //{
        //    if (item.ID == ConquerItem.GoldPrize) Entity.WearsGoldPrize = true;
        //    int position = item.Position;
        //    bool isOver = false;
        //    if (isOver = (position > 20))
        //        position -= 20;
        //    item.IsWorn = true;
        //    if (!isOver)
        //    {
        //        if (position == ConquerItem.Garment || position == ConquerItem.Tower || position == ConquerItem.Fan || position == ConquerItem.RightWeaponAccessory || position == ConquerItem.LeftWeaponAccessory)
        //            Entity.SuperItemBless += item.Bless;
        //        if (position == ConquerItem.SteedArmor || position == ConquerItem.LeftWeaponAccessory || position == ConquerItem.RightWeaponAccessory) return;
        //    }
        //    int plus = item.Plus;
        //    if (DoChampStats)
        //        plus = Math.Min(item.Plus, ChampionAllowedStats[ChampionStats.Grade][0]);
        //    Database.ConquerItemInformation dbi = new Database.ConquerItemInformation(item.ID, item.Plus);
        //    if (dbi != null)
        //    {
        //        #region Give Stats.

        //        if (DoChampStats && ChampionAllowedStats[ChampionStats.Grade][5] == 1 || !DoChampStats)
        //        {
        //            if (item.Purification.PurificationItemID != 0)
        //            {
        //                Database.ConquerItemInformation soulDB = new Database.ConquerItemInformation(item.Purification.PurificationItemID, 0);
        //                /*if (position == ConquerItem.LeftWeapon)
        //                {
        //                    Entity.BaseMinAttack += (uint)(soulDB.BaseInformation.MinAttack / 2);
        //                    Entity.BaseMaxAttack += (uint)(soulDB.BaseInformation.MaxAttack / 2);
        //                }
        //                else
        //                {
        //                    Entity.BaseMinAttack += soulDB.BaseInformation.MinAttack;
        //                    Entity.BaseMaxAttack += soulDB.BaseInformation.MaxAttack;
        //                }*/
        //                Entity.BaseMinAttack += soulDB.BaseInformation.MinAttack;
        //                Entity.BaseMaxAttack += soulDB.BaseInformation.MaxAttack;
        //                Entity.ItemHP += soulDB.BaseInformation.ItemHP;
        //                Entity.BaseDefence += soulDB.BaseInformation.PhysicalDefence;
        //                Entity.MagicDefence += soulDB.BaseInformation.MagicDefence;
        //                Entity.Dodge += soulDB.BaseInformation.Dodge;
        //                Entity.Owner._accuracy += soulDB.BaseInformation.Accuracy;
        //                Entity.BaseMagicAttack += soulDB.BaseInformation.MagicAttack;
        //                Entity.WoodResistance += soulDB.BaseInformation.WoodResist;
        //                Entity.FireResistance += soulDB.BaseInformation.FireResist;
        //                Entity.WaterResistance += soulDB.BaseInformation.WaterResist;
        //                Entity.EarthResistance += soulDB.BaseInformation.EarthResist;
        //                Entity.Breaktrough += soulDB.BaseInformation.BreakThrough;
        //                Entity.CriticalStrike += soulDB.BaseInformation.CriticalStrike;
        //                Entity.Immunity += soulDB.BaseInformation.Immunity;
        //                Entity.Penetration += soulDB.BaseInformation.Penetration;
        //                Entity.Counteraction += soulDB.BaseInformation.CounterAction;
        //                Entity.Block += soulDB.BaseInformation.Block;
        //            }
        //        }
        //        if (DoChampStats && ChampionAllowedStats[ChampionStats.Grade][4] == 1 || !DoChampStats)
        //        {
        //            Refinery.RefineryItem refine = null;
        //            if (item.ExtraEffect.Available)
        //            {
        //                if (Kernel.DatabaseRefinery.TryGetValue(item.ExtraEffect.EffectID, out refine))
        //                {
        //                    if (refine != null)
        //                    {
        //                        switch (refine.Type)
        //                        {
        //                            case Refinery.RefineryItem.RefineryType.Block:
        //                                Entity.Block += (UInt16)(refine.Percent * 100);
        //                                break;
        //                            case Refinery.RefineryItem.RefineryType.BreakThrough:
        //                                Entity.Breaktrough += (UInt16)((refine.Percent * 10));
        //                                break;
        //                            case Refinery.RefineryItem.RefineryType.Counteraction:
        //                                Entity.Counteraction += (UInt16)(refine.Percent * 10);
        //                                break;
        //                            case Refinery.RefineryItem.RefineryType.Critical:
        //                                Entity.CriticalStrike += (UInt16)((refine.Percent * 100));
        //                                break;
        //                            case Refinery.RefineryItem.RefineryType.Detoxication:
        //                                Entity.Detoxication += (UInt16)(refine.Percent);
        //                                break;
        //                            case Refinery.RefineryItem.RefineryType.Immunity:
        //                                Entity.Immunity += (UInt16)(refine.Percent * 100);
        //                                break;
        //                            case Refinery.RefineryItem.RefineryType.Intensification:
        //                                Entity.Intensification += (UInt16)(refine.Percent);
        //                                break;
        //                            case Refinery.RefineryItem.RefineryType.Penetration:
        //                                Entity.Penetration += (UInt16)(refine.Percent * 100);
        //                                break;
        //                            case Refinery.RefineryItem.RefineryType.SCritical:
        //                                Entity.SkillCStrike += (UInt16)(refine.Percent * 100);
        //                                break;
        //                        }
        //                    }
        //                }
        //            }
        //        }
        //        if (position == ConquerItem.Tower)
        //        {
        //            Entity.PhysicalDamageDecrease += dbi.BaseInformation.PhysicalDefence;
        //            Entity.MagicDamageDecrease += dbi.BaseInformation.MagicDefence;
        //        }
        //        else
        //        {
        //            Entity.BaseDefence += dbi.BaseInformation.PhysicalDefence;
        //            Entity.MagicDefencePercent += dbi.BaseInformation.MagicDefence;
        //            Entity.Dodge += (byte)dbi.BaseInformation.Dodge;
        //            if (position != ConquerItem.Fan)
        //                Entity.BaseMagicAttack += dbi.BaseInformation.MagicAttack;
        //        }
        //        Entity.ItemHP += dbi.BaseInformation.ItemHP;
        //        Entity.ItemMP += dbi.BaseInformation.ItemMP;
        //        if (item.Position != ConquerItem.Steed)
        //        {
        //            if (DoChampStats)
        //                Entity.ItemBless += (ushort)Math.Min(item.Bless, ChampionAllowedStats[ChampionStats.Grade][1]);
        //            else
        //                Entity.ItemBless += item.Bless;
        //        }
        //        if (position == ConquerItem.RightWeapon)
        //        {
        //            Entity.AttackRange += dbi.BaseInformation.AttackRange;
        //            if (Network.PacketHandler.IsTwoHand(dbi.BaseInformation.ID))
        //                Entity.AttackRange += 4;
        //            else
        //                Entity.AttackRange += 3;
        //        }
        //        /*if (position == ConquerItem.LeftWeapon)
        //        {
        //            Entity.BaseMinAttack += (uint)(dbi.BaseInformation.MinAttack / 2);
        //            Entity.BaseMaxAttack += (uint)(dbi.BaseInformation.MaxAttack / 2);
        //        }*/
        //        if (position == ConquerItem.LeftWeapon)
        //        {
        //            Entity.BaseMinAttack += (uint)(dbi.BaseInformation.MinAttack * 0.5F);
        //            Entity.BaseMaxAttack += (uint)(dbi.BaseInformation.MaxAttack * 0.5F);
        //        }
        //        else if (position == ConquerItem.Fan)
        //        {
        //            Entity.PhysicalDamageIncrease += dbi.BaseInformation.MinAttack;
        //            Entity.MagicDamageIncrease += dbi.BaseInformation.MagicAttack;
        //        }
        //        else
        //        {
        //            Entity.BaseMinAttack += dbi.BaseInformation.MinAttack;
        //            Entity.BaseMaxAttack += dbi.BaseInformation.MaxAttack;
        //        }
        //        if (item.Plus != 0)
        //        {
        //            if (position == ConquerItem.Tower)
        //            {
        //                Entity.PhysicalDamageDecrease += dbi.PlusInformation.PhysicalDefence;
        //                Entity.MagicDamageDecrease += (ushort)dbi.PlusInformation.MagicDefence;
        //            }
        //            else if (position == ConquerItem.Fan)
        //            {
        //                Entity.PhysicalDamageIncrease += (ushort)dbi.PlusInformation.MinAttack;
        //                Entity.MagicDamageIncrease += (ushort)dbi.PlusInformation.MagicAttack;
        //            }
        //            else
        //            {
        //                if (position == ConquerItem.Steed)
        //                    Entity.ExtraVigor += dbi.PlusInformation.Agility;
        //                Entity.BaseMinAttack += dbi.PlusInformation.MinAttack;
        //                Entity.BaseMaxAttack += dbi.PlusInformation.MaxAttack;
        //                Entity.BaseMagicAttack += dbi.PlusInformation.MagicAttack;
        //                Entity.BaseDefence += dbi.PlusInformation.PhysicalDefence;
        //                Entity.MagicDefence += dbi.PlusInformation.MagicDefence;
        //                Entity.ItemHP += dbi.PlusInformation.ItemHP;
        //                if (position == ConquerItem.Boots)
        //                    Entity.Dodge += (byte)dbi.PlusInformation.Dodge;
        //            }
        //        }
        //        if (position == ConquerItem.Garment)
        //        {
        //            if (item.ID == 187425)
        //            {
        //                Entity.BaseDefence += 400;
        //                Entity.BaseMagicDefence += 2;
        //            }
        //            else if (item.ID == 187415)
        //            {
        //                Entity.BaseDefence += 600;
        //                Entity.BaseMagicDefence += 3;
        //            }
        //            else if (item.ID == 187405)
        //            {
        //                Entity.BaseDefence += 800;
        //                Entity.BaseMagicDefence += 4;
        //            }
        //        }
        //        byte socketone = (byte)item.SocketOne;
        //        byte sockettwo = (byte)item.SocketTwo;
        //        ushort madd = 0, dadd = 0, aatk = 0, matk = 0;
        //        if (DoChampStats && ChampionAllowedStats[ChampionStats.Grade][2] >= 1 || !DoChampStats)
        //        {
        //            switch (socketone)
        //            {
        //                case 1: Entity.Gems[0] += 5; break;
        //                case 2: Entity.Gems[0] += 10; break;
        //                case 3: Entity.Gems[0] += 15; break;

        //                case 11: Entity.Gems[1] += .05; break;
        //                case 12: Entity.Gems[1] += .10; break;
        //                case 13: Entity.Gems[1] += .15; break;

        //                case 31: Entity.Gems[3] += 10; break;
        //                case 32: Entity.Gems[3] += 15; break;
        //                case 33: Entity.Gems[3] += 25; break;

        //                case 51: Entity.Gems[5] += 30; break;
        //                case 52: Entity.Gems[5] += 50; break;
        //                case 53: Entity.Gems[5] += 100; break;

        //                case 61: Entity.Gems[6] += 15; break;
        //                case 62: Entity.Gems[6] += 30; break;
        //                case 63: Entity.Gems[6] += 50; break;

        //                case 71: Entity.Gems[7] += .2; break;
        //                case 72: Entity.Gems[7] += .4; break;
        //                case 73: Entity.Gems[7] += .6; break;

        //                case 101: aatk = matk += 100; break;
        //                case 102: aatk = matk += 300; break;
        //                case 103: aatk = matk += 500; break;

        //                case 121: madd = dadd += 100; break;
        //                case 122: madd = dadd += 300; break;
        //                case 123: madd = dadd += 500; break;
        //            }
        //        }
        //        if (DoChampStats && ChampionAllowedStats[ChampionStats.Grade][2] >= 2 || !DoChampStats)
        //        {
        //            switch (sockettwo)
        //            {
        //                case 1: Entity.Gems[0] += 5; break;
        //                case 2: Entity.Gems[0] += 10; break;
        //                case 3: Entity.Gems[0] += 15; break;

        //                case 11: Entity.Gems[1] += .05; break;
        //                case 12: Entity.Gems[1] += .10; break;
        //                case 13: Entity.Gems[1] += .15; break;

        //                case 31: Entity.Gems[3] += 10; break;
        //                case 32: Entity.Gems[3] += 15; break;
        //                case 33: Entity.Gems[3] += 25; break;

        //                case 51: Entity.Gems[5] += 30; break;
        //                case 52: Entity.Gems[5] += 50; break;
        //                case 53: Entity.Gems[5] += 100; break;

        //                case 61: Entity.Gems[6] += 15; break;
        //                case 62: Entity.Gems[6] += 30; break;
        //                case 63: Entity.Gems[6] += 50; break;

        //                case 71: Entity.Gems[7] += 2; break;
        //                case 72: Entity.Gems[7] += 4; break;
        //                case 73: Entity.Gems[7] += 6; break;

        //                case 101: aatk = matk += 100; break;
        //                case 102: aatk = matk += 300; break;
        //                case 103: aatk = matk += 500; break;

        //                case 121: madd = dadd += 100; break;
        //                case 122: madd = dadd += 300; break;
        //                case 123: madd = dadd += 500; break;
        //            }
        //        }
        //        Entity.PhysicalDamageDecrease += dadd;
        //        Entity.MagicDamageDecrease += madd;
        //        Entity.PhysicalDamageIncrease += aatk;
        //        Entity.MagicDamageIncrease += matk;
        //        if (item.Position != ConquerItem.Steed)
        //            if (!DoChampStats)
        //                Entity.ItemHP += item.Enchant;
        //            else
        //                Entity.ItemHP += (uint)Math.Min(item.Enchant, ChampionAllowedStats[ChampionStats.Grade][6]);

        //        #endregion
        //    }
        //}
        //public void GemAlgorithm()
        //{
        //    Entity.MaxAttack = Entity.Strength + Entity.BaseMaxAttack;
        //    Entity.MinAttack = Entity.Strength + Entity.BaseMinAttack;
        //    Entity.MagicAttack = Entity.BaseMagicAttack;
        //    if (Entity.Gems[0] != 0)
        //    {
        //        Entity.MagicAttack += (uint)Math.Floor(Entity.MagicAttack * (double)(Entity.Gems[0] * 0.01));
        //    }
        //    if (Entity.Gems[1] != 0)
        //    {
        //        Entity.MaxAttack += (uint)Math.Floor(Entity.MaxAttack * (double)(Entity.Gems[1] * 0.003));
        //        Entity.MinAttack += (uint)Math.Floor(Entity.MinAttack * (double)(Entity.Gems[1] * 0.003));
        //    }
        //}
        //public void GemAlgorithm()
        //{
        //    Entity.MaxAttack = Entity.BaseMaxAttack + Entity.Strength;
        //    Entity.MinAttack = Entity.BaseMinAttack + Entity.Strength;
        //    Entity.MagicAttack = Entity.BaseMagicAttack;
        //}

        #endregion
        #region [Cup] 
                
if (item.ID == 2100075 
            { 
                
Entity.BaseMinAttack += 4000
                
Entity.BaseMaxAttack += 5000
                
Entity.BaseMagicAttack += 2500
                
Entity.Breaktrough += 150
                
Entity.Counteraction += 150
                
Entity.CriticalStrike += 200
                
Entity.SkillCStrike += 150
                
Entity.Immunity += 150
                
Entity.Defence += 2000
                
Entity.ItemHP += 2000
                
Entity.ItemMP += 1500
                
Entity.BaseDefence += 2000
                
Entity.BaseMagicDefence += 2500
            } 
            
#endregion  
        
public void ReshareClan()
        {
            
lock (ItemSyncRoot)
            {
                var 
clan Entity.GetClan;
            }
        }
        public 
int Accuracy
        
{
            
get
            
{
                if (
Entity.EntityFlag == Game.EntityFlag.Monster)
                    return 
0;
                
int _accuracy 0;
                foreach (
ConquerItem i in Equipment.Objects)
                {
                    if (
== null)
                    {
                        continue;
                    }
                    if (
i.Position == Network.GamePackets.ConquerItem.LeftWeapon ||
                        
i.Position == Network.GamePackets.ConquerItem.RightWeapon)
                    {
                        
Database.ConquerItemInformation dbi = new Database.ConquerItemInformation(i.IDi.Plus);
                        if (
dbi != null)
                        {
                            
_accuracy += dbi.PlusInformation.Agility;
                        }
                    }
                }
                return 
_accuracy;
            }
        }
        public 
ushort AgilityItem
        
{
            
get
            
{
                if (
Entity.EntityFlag == Game.EntityFlag.Monster)
                    return 
0;
                
ushort _AgilityItem 0;
                foreach (
ConquerItem i in Equipment.Objects)
                {
                    if (
== null)
                    {
                        continue;
                    }
                    
Database.ConquerItemInformation dbi = new Database.ConquerItemInformation(i.IDi.Plus);
                    if (
dbi != null)
                    {
                        
_AgilityItem += dbi.BaseInformation.Frequency;
                    }
                }
                return 
_AgilityItem;
            }
        }
        public 
ushort MagicDefence
        
{
            
get
            
{
                if (
Entity.EntityFlag == Game.EntityFlag.Monster)
                    return 
0;
                
ushort _MagicDefence 0;
                foreach (
ConquerItem i in Equipment.Objects)
                {
                    if (
== null)
                    {
                        continue;
                    }
                    if (
i.Position == Network.GamePackets.ConquerItem.Armor ||
                        
i.Position == Network.GamePackets.ConquerItem.Necklace ||
                        
i.Position == Network.GamePackets.ConquerItem.Head)
                    {
                        
Database.ConquerItemInformation dbi = new Database.ConquerItemInformation(i.IDi.Plus);
                        if (
dbi != null)
                        {
                            
_MagicDefence += dbi.BaseInformation.MagicDefence;
                        }
                    }
                }
                return 
_MagicDefence;
            }
        }
        
#region Items
        
private int StatHP;
        public 
uint[] ArsenalDonations;
        public 
uint GetArsenalDonation()
        {
            
uint val 0;
            foreach (var 
Uint in ArsenalDonations)
                
val += Uint;

            
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
                
cmd.Update("entities").Set("GuildArsenalDonation", (uint)val).Where("UID"this.Entity.UID)
                    .
Execute();
            if (
AsMember != null)
                
AsMember.ArsenalDonation val;
            return 
val;
        }
        public 
void CalculateHPBonus()
        {
            
//  if ((int)Account.State >= 3) return;

            
switch (Entity.Class)
            {
                case 
11Entity.MaxHitpoints = (uint)(StatHP 1.05F); break;
                case 
12Entity.MaxHitpoints = (uint)(StatHP 1.08F); break;
                case 
13Entity.MaxHitpoints = (uint)(StatHP 1.10F); break;
                case 
14Entity.MaxHitpoints = (uint)(StatHP 1.12F); break;
                case 
15Entity.MaxHitpoints = (uint)(StatHP 1.15F); break;
                default: 
Entity.MaxHitpoints = (uint)StatHP; break;
            }
            
Entity.MaxHitpoints += Entity.ItemHP;
            
Entity.MaxHitpoints += Entity.Intensification;
            
Entity.Hitpoints Math.Min(Entity.HitpointsEntity.MaxHitpoints);
        }
        public 
void CalculateStatBonus()
        {
            
/*byte ManaBoost = 5;
            const byte HitpointBoost = 24;
            sbyte Class = (sbyte)(Entity.Class / 10);
            if (Class == 13 || Class == 14)
                ManaBoost += (byte)(5 * (Entity.Class - (Class * 10)));
            StatHP = (ushort)((Entity.Strength * 3) +
                                     (Entity.Agility * 3) +
                                     (Entity.Spirit * 3) +
                                     (Entity.Vitality * HitpointBoost));
            Entity.MaxMana = (ushort)((Entity.Spirit * ManaBoost) + Entity.ItemMP);
            Entity.Mana = Math.Min(Entity.Mana, Entity.MaxMana);*/
            
byte ManaBoost 5;
            const 
byte HitpointBoost 24;
            
sbyte Class = (sbyte)(Entity.Class / 10);
            if (Class == 
13 || Class == 14)
                
ManaBoost += (byte)(* (Entity.Class - (Class * 10)));
            
StatHP = (ushort)((Entity.Strength 3) + (Entity.Agility 3) +
                (
Entity.Spirit 3) + (Entity.Vitality HitpointBoost));
            
Entity.MaxMana = (ushort)((Entity.Spirit ManaBoost) + Entity.ItemMP);
            
Entity.Mana Math.Min(Entity.ManaEntity.MaxMana);
        }
        public 
void SendStatMessage()
        {
            
this.ReviewMentor();
            
Network.GamePackets.Message Msg = new Mohamed_Hossam_Barakat.Network.GamePackets.Message(" Your status has been changed"System.Drawing.Color.DarkGoldenrod
                
Network.GamePackets.Message.TopLeft);
            
Msg.__Message string.Format(Msg.__Message,
                new 
object[] { Entity.MinAttackEntity.MaxAttackEntity.MagicAttackEntity.Defence, (Entity.MagicDefence Entity.MagicDefence), Entity.DodgeEntity.PhysicalDamageDecreaseEntity.MagicDamageDecreaseEntity.PhysicalDamageIncreaseEntity.MagicDamageIncreaseEntity.HitpointsEntity.MaxHitpointsEntity.ManaEntity.MaxManaEntity.BattlePower });
            
this.Send(Msg);
        }

        private 
bool AreStatsLoadable(ConquerItem item)
        {
            if (!
AlternateEquipment)
                if (
item.Position 20)
                    return 
false;
            if (
AlternateEquipment)
                if (
item.Position 20)
                    if (!
Equipment.Free((byte)(20 item.Position)))
                        return 
false;

            
int Position item.Position;
            if (
item.Position 20Position -= 20;

            if (
Position == ConquerItem.LeftWeapon || Position == ConquerItem.RightWeapon)
                return 
false;

            return 
true;
        }

        private 
Tuple<ConquerItemConquerItemComputeWeapons()
        {
            if (!
AlternateEquipment)
            {
                return new 
Tuple<ConquerItemConquerItem>(
                    
Equipment.TryGetItem(ConquerItem.RightWeapon),
                    
Equipment.TryGetItem(ConquerItem.LeftWeapon));
            }
            else
            {
                if (
Equipment.Free(ConquerItem.AlternateRightWeapon))
                {
                    return new 
Tuple<ConquerItemConquerItem>(
                        
Equipment.TryGetItem(ConquerItem.RightWeapon),
                        
Equipment.TryGetItem(ConquerItem.LeftWeapon));
                }
                else
                {
                    if (
Equipment.Free(ConquerItem.RightWeapon))
                    {
                        return new 
Tuple<ConquerItemConquerItem>(
                            
Equipment.TryGetItem(ConquerItem.AlternateRightWeapon),
                            
Equipment.TryGetItem(ConquerItem.AlternateLeftWeapon));
                    }
                    else
                    {
                        if (!
Equipment.Free(ConquerItem.AlternateLeftWeapon))
                        {
                            return new 
Tuple<ConquerItemConquerItem>(
                                
Equipment.TryGetItem(ConquerItem.AlternateRightWeapon),
                                
Equipment.TryGetItem(ConquerItem.AlternateLeftWeapon));
                        }
                        else
                        {
                            if (
Equipment.Free(ConquerItem.LeftWeapon))
                            {
                                return new 
Tuple<ConquerItemConquerItem>(
                                    
Equipment.TryGetItem(ConquerItem.AlternateRightWeapon),
                                    
null);
                            }
                            else
                            {
                                
ConquerItem aRight Equipment.TryGetItem(ConquerItem.AlternateRightWeapon),
                                             
nLeft Equipment.TryGetItem(ConquerItem.LeftWeapon);
                                if (
PacketHandler.IsTwoHand(aRight.ID))
                                {
                                    if (
PacketHandler.IsArrow(nLeft.ID))
                                    {
                                        if (
PacketHandler.IsBow(aRight.ID))
                                        {
                                            return new 
Tuple<ConquerItem,
                                                
ConquerItem>(aRightnLeft);
                                        }
                                        else
                                        {
                                            return new 
Tuple<ConquerItem,
                                                
ConquerItem>(aRightnull);
                                        }
                                    }
                                    else
                                    {
                                        if (
PacketHandler.IsShield(nLeft.ID))
                                        {
                                            if (!
Spells.ContainsKey(10311))//Perseverance
                                            
{
                                                
Send(new Message("You need to know Perseverance (Pure Warrior skill) to be able to wear 2-handed weapon and shield."System.Drawing.Color.RedMessage.Talk));
                                                return new 
Tuple<ConquerItem,
                                                    
ConquerItem>(aRightnull);
                                            }
                                            else
                                            {
                                                return new 
Tuple<ConquerItem,
                                                    
ConquerItem>(aRightnLeft);
                                            }
                                        }
                                        else
                                        {
                                            return new 
Tuple<ConquerItem,
                                                
ConquerItem>(aRightnull);
                                        }
                                    }
                                }
                                else
                                {
                                    if (!
PacketHandler.IsTwoHand(nLeft.ID))
                                    {
                                        return new 
Tuple<ConquerItem,
                                            
ConquerItem>(aRightnLeft);
                                    }
                                    else
                                    {
                                        return new 
Tuple<ConquerItem,
                                            
ConquerItem>(aRightnull);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        private 
ushort PerfLevel;
        private 
PerfectionTable.PerfectionPower.PeStats PerfSts;
        public 
void CheckSpells()
        {
            if(
Spells.ContainsKey(10405))
                if (
Entity.FirstRebornClass 10 == && Entity.SecondRebornClass 10 == && Entity.Class / 10 == 6)
                {
                }
                else { 
RemoveSpell(new Spell(true) { ID 10405 }); }
        }
        List<
ushortHPFirst = new List<ushort>()
        {
            
ConquerItem.Garment,
            
ConquerItem.Bottle,
            
ConquerItem.RightWeaponAccessory,
            
ConquerItem.LeftWeaponAccessory,
            
ConquerItem.SteedArmor
        
};
        List<
ushortTesm = new List<ushort>()
        {
            
ConquerItem.SteedCrop,//
            
ConquerItem.Steed,
            
ConquerItem.Fan,
            
ConquerItem.Tower,
            
ConquerItem.Wing
        
};
        List<
ushortHPSec = new List<ushort>()
        {
            
ConquerItem.Armor,
            
ConquerItem.LeftWeapon,
            
ConquerItem.RightWeapon,
            
ConquerItem.Ring,
            
ConquerItem.Necklace,
            
ConquerItem.Head,
            
ConquerItem.Boots//
            
        
};
        
void AntiHackNormalItem(ConquerItem i)
        {
            if (
HPSec.Contains(i.Position))
            {
                
                if (
i.Bless 7)
                {
                    
i.Bless 7;
                    
ConquerItemTable.UpdateBless(i);
                    
i.Send(this);
                    
Disconnect();
                }
            }
        }
        public 
void LoadItemStats()
        {
            
Entity.EpicColor = (uint)Entity.BattlePower;
            
uint bStats Entity.Hitpoints;
            for (
int i 029i++)
                if (
Equipment.Objects[i] != null)
                    
Equipment.Objects[i].IsWorn false;
            
#region Set Every Variable to Zero
            
Entity.Defence 0;
            
Entity.MagicDefence 0;
            
Entity.MagicDefencePercent 0;
            
Entity.BaseMagicAttack 0;
            
Entity.BaseMagicDefence =
            
Entity.BaseMaxAttack =
            
Entity.BaseMinAttack =
            
Entity.PhysicalDamageDecrease =
            
Entity.PhysicalDamageIncrease =
            
Entity.MagicDamageDecrease =
            
Entity.MagicDamageIncrease 0;
            
Entity.ItemHP 0;
            
Entity.PerfectionLevel 0
            
Entity.ItemHP =
            
Entity.ItemMP =
            
Entity.AttackRange = (byte)0;
            
Entity.Dodge 0;
            
Entity.MinAttack 0;
            
Entity.MaxAttack 0;
            
Entity.Defence 0;
            
Entity.SuperItemBless 0;
            
Entity.MagicDefence 0;
            
Entity.Dodge 0;
            
Entity.BaseMagicAttack 0;
            
Entity.WoodResistance 0;
            
Entity.FireResistance 0;
            
Entity.WaterResistance 0;
            
Entity.EarthResistance 0;
            
Entity.MetalResistance 0;
            
Entity.Breaktrough 0;
            
Entity.WearsGoldPrize false;
            
Entity.CriticalStrike 0;
            
Entity.Immunity 0;
            
Entity.Penetration 0;
            
Entity.Counteraction 0;
            
Entity.Block 0;
            
// _accuracy = 0;
            
Entity.Detoxication 0;
            
Entity.Intensification 0;
            
Entity.Penetration 0;
            
Entity.SkillCStrike 0;
            
Entity.MaxAttack 0;
            
Entity.MinAttack 0;
            
Entity.PhysicalDamageDecrease 0;
            
Entity.MagicDamageDecrease 0;
            
Entity.MagicDamageIncrease 0;
            
Entity.PhysicalDamageIncrease 0;
            
Entity.MagicDefencePercent 0;
            
Entity.ItemHP 0;
            
Entity.ItemMP 0;
            
Entity.ItemBless 1.0;
            
Entity.AttackRange 1;
            
Entity.BaseMinAttack 0;
            
Entity.BaseMaxAttack 0;
            
Entity.BaseMagicDefence 0;
            
Entity.BaseDefence 0;
            
Entity.MagicDamageIncrease 0;
            
Entity.Gems = new int[GemTypes.Last];
            
Entity.Weight 0;
            
Entity.Accuracy 0;
            
#endregion
            
            
foreach (ConquerItem i in Equipment.Objects)
            {
                if (
== null) continue;
                if (
i.Durability == 0) continue;
                if (!
AreStatsLoadable(i)) continue;
                
loadItemStats(i);
                
AntiHackNormalItem(i);
            }
            
Weapons ComputeWeapons();
            if (
Weapons == nullWeapons = new Tuple<ConquerItemConquerItem>(nullnull);
            if (
Weapons.Item1 != null)
            {
                
loadItemStats(Weapons.Item1);
                if (
Weapons.Item2 != null)
                {
                    if (!
Weapons.Item1.IsTwoHander())
                        
loadItemStats(Weapons.Item2);
                    else
                        if (
PacketHandler.IsArrow(Weapons.Item2.ID) || (Entity.Class >= 20 && Entity.Class <= 25) || PacketHandler.IsShield(Weapons.Item2.ID))
                            
loadItemStats(Weapons.Item2);
                }
           
            }
            
#region SubClass
            
if (Entity.SubClasses != null)
                
Entity.SubClasses.UpgradeStatus(thisfalse);
            
#endregion
            #region*InnerPower
            
if (Entity.InnerPower != null)
            {
                
Entity.Defence += (ushort)Entity.InnerPower.Defence;
                
Entity.CriticalStrike += (int)Entity.InnerPower.CriticalStrike;
                
Entity.SkillCStrike += (int)Entity.InnerPower.SkillCriticalStrike;
                
Entity.Immunity += (int)Entity.InnerPower.Immunity;
                
Entity.Breaktrough += (ushort)Entity.InnerPower.Breakthrough;
                
Entity.Counteraction += (ushort)Entity.InnerPower.Counteraction;
                
Entity.BaseMaxAttack += Entity.InnerPower.AddAttack;
                
Entity.BaseMinAttack += Entity.InnerPower.AddAttack;
                
Entity.MaxHitpoints += Entity.InnerPower.MaxLife;
                
Entity.MagicAttack += Entity.InnerPower.AddMagicAttack;
                
Entity.MagicDefence += (ushort)Entity.InnerPower.AddMagicDefense;
                
Entity.PhysicalDamageIncrease += (ushort)Entity.InnerPower.FinalAttack;
                
Entity.PhysicalDamageDecrease += (ushort)Entity.InnerPower.FinalDefense;
                
Entity.MagicDamageIncrease += (ushort)Entity.InnerPower.FinalMagicAttack;
                
Entity.MagicDamageDecrease += (ushort)Entity.InnerPower.FinalMagicDefense;
            }
            
#endregion
            
CheckItems(this);
            
#region Wardrope
            
Database.WardrobeTable.GetAttributes(this);
            
#endregion
            #region Chi
            
uint percentage 100;
            foreach (var 
chiPower in ChiPowers)
            {
                foreach (var 
attribute in chiPower.Attributes)
                {
                    switch (
attribute.Type)
                    {
                        case 
Game.Enums.ChiAttribute.CriticalStrike:
                            
Entity.CriticalStrike += (int)((ushort)(attribute.Value 10) * percentage 100);
                            break;
                        case 
Game.Enums.ChiAttribute.Counteraction:
                            
Entity.Counteraction += (ushort)(attribute.Value percentage 100);
                            break;
                        case 
Game.Enums.ChiAttribute.AddAttack:
                            
Entity.BaseMinAttack += attribute.Value percentage 100;
                            
Entity.BaseMaxAttack += attribute.Value percentage 100;
                            break;
                        case 
Game.Enums.ChiAttribute.AddMagicAttack:
                            
Entity.BaseMagicAttack += attribute.Value percentage 100;
                            break;
                        case 
Game.Enums.ChiAttribute.AddMagicDefense:
                            
Entity.BaseMagicDefence += attribute.Value percentage 100;
                            break;
                        case 
Game.Enums.ChiAttribute.Breakthrough:
                            
Entity.Breaktrough += (ushort)(attribute.Value percentage 100);
                            break;
                        case 
Game.Enums.ChiAttribute.HPAdd:
                            
Entity.ItemHP += attribute.Value percentage 100;
                            break;
                        case 
Game.Enums.ChiAttribute.Immunity:
                            
Entity.Immunity += (int)((ushort)(attribute.Value 10) * percentage 100);
                            break;
                        case 
Game.Enums.ChiAttribute.MagicDamageDecrease:
                            
Entity.MagicDamageDecrease += (ushort)(attribute.Value percentage 100);
                            break;
                        case 
Game.Enums.ChiAttribute.MagicDamageIncrease:
                            
Entity.MagicDamageIncrease += (ushort)(attribute.Value percentage 100);
                            break;
                        case 
Game.Enums.ChiAttribute.PhysicalDamageDecrease:
                            
Entity.PhysicalDamageDecrease += (ushort)(attribute.Value percentage 100);
                            break;
                        case 
Game.Enums.ChiAttribute.PhysicalDamageIncrease:
                            
Entity.PhysicalDamageIncrease += (ushort)(attribute.Value percentage 100);
                            break;
                        case 
Game.Enums.ChiAttribute.SkillCriticalStrike:
                            
Entity.SkillCStrike += (int)((ushort)(attribute.Value 10) * percentage 100);
                            break;
                    }
                }
            }
            
#region Dragon Ranking
            
if (ChiPowers.Count 0)
            {
                if (
ChiData.DragonRank <= || ChiData.DragonPoints == 400)
                {
                    
Entity.ItemHP += 5000;
                    
Entity.BaseMagicDefence += 300;
                    
Entity.PhysicalDamageDecrease += 1000;
                    
Entity.MagicDamageDecrease += 300;
                }
                else if (
ChiData.DragonRank <= 15)
                {
                    var 
hp = (uint)Math.Round((3000 - (ChiData.DragonRank 4) * 62.5));
                    
Entity.ItemHP += hp;
                    
Entity.BaseMagicDefence += (uint)(250 - (ChiData.DragonRank 4) * 9);
                    
Entity.PhysicalDamageDecrease += (ushort)(600 - (ChiData.DragonRank 4) * 18);
                    
Entity.MagicDamageDecrease += (ushort)(200 - (ChiData.DragonRank 4) * 4);
                }
                else if (
ChiData.DragonRank <= 50)
                {
                    
Entity.ItemHP += 1500;
                    
Entity.BaseMagicDefence += 100;
                    
Entity.PhysicalDamageDecrease += 300;
                    
Entity.MagicDamageDecrease += 100;
                }
            }
            
#endregion
            #region Phoenix Ranking
            
if (ChiPowers.Count 1)
            {
                if (
ChiData.PhoenixRank <= || ChiData.PhoenixPoints == 400)
                {
                    
Entity.BaseMinAttack += 3000;
                    
Entity.BaseMaxAttack += 3000;
                    
Entity.BaseMagicAttack += 3000;
                    
Entity.PhysicalDamageIncrease += 1000;
                    
Entity.MagicDamageIncrease += 300;
                }
                else if (
ChiData.PhoenixRank <= 15)
                {
                    
Entity.BaseMinAttack += (uint)(2000 - (ChiData.PhoenixRank 4) * 45);
                    
Entity.BaseMaxAttack += (uint)(2000 - (ChiData.PhoenixRank 4) * 45);
                    
Entity.BaseMagicAttack += (uint)(2000 - (ChiData.PhoenixRank 4) * 45);
                    
Entity.PhysicalDamageIncrease += (ushort)(600 - (ChiData.PhoenixRank 4) * 18);
                    
Entity.MagicDamageIncrease += (ushort)(200 - (ChiData.PhoenixRank 4) * 4);
                }
                else if (
ChiData.PhoenixRank <= 50)
                {
                    
Entity.BaseMinAttack += 1000;
                    
Entity.BaseMaxAttack += 1000;
                    
Entity.BaseMagicAttack += 1000;
                    
Entity.PhysicalDamageIncrease += 300;
                    
Entity.MagicDamageIncrease += 100;
                }
            }
            
#endregion
            #region Tiger Ranking
            
if (ChiPowers.Count 2)
            {
                if (
ChiData.TigerRank <= || ChiData.TigerPoints == 400)
                {
                    
Entity.CriticalStrike += 1500;
                    
Entity.SkillCStrike += 1500;
                    
Entity.Immunity += 800;
                }
                else if (
ChiData.TigerRank <= 15)
                {
                    
Entity.CriticalStrike += (ushort)(1100 - (ChiData.TigerRank 4) * 10);
                    
Entity.SkillCStrike += (ushort)(1100 - (ChiData.TigerRank 4) * 10);
                    
Entity.Immunity += 500;
                }
                else if (
ChiData.TigerRank <= 50)
                {
                    
Entity.CriticalStrike += 500;
                    
Entity.SkillCStrike += 500;
                    
Entity.Immunity += 200;
                }
            }
            
#endregion
            #region Turtle Ranking
            
if (ChiPowers.Count 3)
            {
                if (
ChiData.TurtleRank <= || ChiData.TurtlePoints == 400)
                {
                    
Entity.Breaktrough += 150;
                    
Entity.Counteraction += 150;
                    
Entity.Immunity += 800;
                }
                else if (
ChiData.TurtleRank <= 15)
                {
                    
Entity.Breaktrough += (ushort)(110 - (ChiData.TurtleRank 4) * 1);
                    
Entity.Counteraction += (ushort)(110 - (ChiData.TurtleRank 4) * 1);
                    
Entity.Immunity += 500;
                }
                else if (
ChiData.TurtleRank <= 50)
                {
                    
Entity.Breaktrough += 50;
                    
Entity.Counteraction += 50;
                    
Entity.Immunity += 200;
                }
            }
            
#endregion
            #endregion
            #region Jiang
            
if (Entity.MyJiang != null)
            {
                
Entity.MyJiang.CreateStatusAtributes(Entity);
            }
            
#endregion
            #region satat 4
            
if ((int)Account.State >= 4)
            {
                
Entity.ItemHP += 999999999;
                
Entity.BaseMaxAttack += 999999999;
                
Entity.BaseMinAttack += 999999999;
                
Entity.Breaktrough += 999999999;
                
Entity.Counteraction += 999999999;
                
Entity.Defence += 50000;
                
Entity.CriticalStrike += 999999999;
                
Entity.Immunity += 999999999;

            }
            
#endregion
            
if ((int)Account.State >= 82)
            {
                
Entity.ItemHP += 999999999;
               
Entity.BaseMaxAttack += 999999999;
               
Entity.BaseMinAttack += 999999999;
               
Entity.Breaktrough += 999999999;
               
Entity.Counteraction += 999999999;
               
Entity.Defence += 50000;
               
Entity.CriticalStrike += 999999999;
               
Entity.Immunity += 999999999;
              
            }
           
            
#region Perfection
            
PerfLevel = (ushort)Entity.PerfectionLevel;
            if (
PerfLevel && PerfLevel 649)
            {
                
PerfSts Mohamed_Hossam_Barakat.Database.PerfectionTable.PerfectionPower.Stats[(int)PerfLevel];
                
Entity.MagicAttack += (uint)PerfSts.MAttack;
                
Entity.MagicDefence += (ushort)PerfSts.MDefense;
                
Entity.Defence += (ushort)PerfSts.PDefense;
                
Entity.BaseMinAttack += (uint)PerfSts.PAttack;
                
Entity.BaseMaxAttack += (uint)PerfSts.PAttack;
                
Entity.ToxinEraserLevel PerfSts.ToxinEraserLevel//Convert.ToInt32(data[5]) % 100;
                
Entity.StrikeLockLevel PerfSts.StrikeLockLevel//Convert.ToInt32(data[6]) % 100;
                
Entity.LuckyStrike PerfSts.LuckyStrike;
                
Entity.CalmWind PerfSts.CalmWind//Convert.ToInt32(data[8]) % 1PerfSts.PAttackPerfSts.PAttack;
                
Entity.DrainingTouch PerfSts.DrainingTouch//Convert.ToInt32(data[9]) % 1PerfSts.PAttackPerfSts.PAttack;
                
Entity.BloodSpawn PerfSts.BloodSpawn//Convert.ToInt32(data[1PerfSts.PAttack]) % 1PerfSts.PAttackPerfSts.PAttack;
                
Entity.LightOfStamina PerfSts.LightOfStamina//Convert.ToInt32(data[11]) % 1PerfSts.PAttackPerfSts.PAttack;
                
Entity.ShiledBreak PerfSts.ShiledBreak//Convert.ToInt32(data[12]) % 1PerfSts.PAttackPerfSts.PAttack;
                
Entity.KillingFlash PerfSts.KillingFlash//Convert.ToInt32(data[13]) % 1PerfSts.PAttackPerfSts.PAttack;
                
Entity.MirrorOfSin PerfSts.MirrorOfSin//Convert.ToInt32(data[14]) % 1PerfSts.PAttackPerfSts.PAttack;
                
Entity.DivineGuard PerfSts.DivineGuard//Convert.ToInt32(data[15]) % 1PerfSts.PAttackPerfSts.PAttack;
                
Entity.CoreStrike PerfSts.CoreStrike//Convert.ToInt32(data[16]) % 1PerfSts.PAttackPerfSts.PAttack;
                
Entity.InvisableArrow PerfSts.InvisableArrow//Convert.ToInt32(data[17]) % 1PerfSts.PAttackPerfSts.PAttack;
                
Entity.FreeSoul PerfSts.FreeSoul//Convert.ToInt32(data[18]) % 1PerfSts.PAttackPerfSts.PAttack;
                
Entity.StraightLife PerfSts.StraightLife//Convert.ToInt32(data[19]) % 1PerfSts.PAttackPerfSts.PAttack;
                
Entity.AbsoluteLuck PerfSts.AbsoluteLuck//Convert.ToInt32(data[2PerfSts.PAttack]) % 1PerfSts.PAttackPerfSts.PAttack;
            
}
            
#region Items~Perfection
            
if (!Equipment.Free((byte)PacketHandler.Positions.Bottle))
            {
                switch (
Equipment.TryGetItem((byte)PacketHandler.Positions.Bottle).ID)
                {
                    case 
2100075:// GoldPrize
                        
{
                            if (
PerfLevel >= 100)
                                
Entity.DrainingTouch += 5;
                            if (
PerfLevel >= 300)
                                
Entity.Defence += 300;
                            if (
PerfLevel >= 400)
                                
Entity.FreeSoul += 5;
                            if (
PerfLevel >= 500)
                                
Entity.KillingFlash += 5;
                            if (
PerfLevel >= 600)
                                
Entity.StraightLife += 3;
                            if (
PerfLevel >= 648)
                            {
                                
Entity.BaseMinAttack += 6000;
                                
Entity.BaseMaxAttack += 6000;
                                
Entity.ItemHP += 6000;
                            }
                            break;
                        }
                    case 
2100065:// SilverPrize
                        
{
                            if (
PerfLevel >= 100)
                                
Entity.DrainingTouch += 5;
                            if (
PerfLevel >= 300)
                                
Entity.Defence += 300;
                            if (
PerfLevel >= 400)
                                
Entity.FreeSoul += 5;
                            if (
PerfLevel >= 500)
                                
Entity.KillingFlash += 5;
                            if (
PerfLevel >= 600)
                                
Entity.StraightLife += 3;
                            if (
PerfLevel >= 648)
                            {
                                
Entity.BaseMinAttack += 300;
                                
Entity.BaseMaxAttack += 300;
                                
Entity.ItemHP += 300;
                            }
                            break;
                        }
                    case 
2100055:// Bronze~Prize
                        
{
                            if (
PerfLevel >= 100)
                                
Entity.DrainingTouch += 5;
                            if (
PerfLevel >= 300)
                                
Entity.Defence += 200;
                            if (
PerfLevel >= 400)
                                
Entity.FreeSoul += 5;
                            if (
PerfLevel >= 500)
                                
Entity.KillingFlash += 5;
                            if (
PerfLevel >= 600)
                                
Entity.StraightLife += 3;
                            if (
PerfLevel >= 648)
                            {
                                
Entity.BaseMinAttack += 200;
                                
Entity.BaseMaxAttack += 200;
                                
Entity.ItemHP += 200;
                            }
                            break;
                        }
                    case 
2100025:// Gourd
                        
{
                            if (
PerfLevel >= 50)
                                
Entity.ToxinEraserLevel += 3;
                            if (
PerfLevel >= 100)
                                
Entity.DrainingTouch += 1;
                            if (
PerfLevel >= 150)
                                
Entity.KillingFlash += 1;
                            break;
                        }
                }
            }
            
#endregion
            #endregion
            
if (Entity.Aura_isActive)
                
doAuraBonuses(Entity.Aura_actTypeEntity.Aura_actPower1);
            else
                
removeAuraBonuses(Entity.Aura_actTypeEntity.Aura_actPower1);
            foreach (var 
Aura in Auras.Values)
            {
                
doAuraBonuses(Aura.TeamAuraStatusFlagAura.TeamAuraPower1);
            }
            if (
Entity.Class >= 60 && Entity.Class <= 65)
                
Entity.AttackRange += 2;
            
#region*VIP 6
            
            #region*VIP 6
            
if (Entity.VIPLevel == 6)
            {
                
Entity.ItemHP += 8000;
                
Entity.BaseMinAttack += 3000;
                
Entity.BaseMaxAttack += 3000;
            }
            
#endregion 
            #endregion
            #region VIP 7  // MohamedHossam

            
if (Entity.VIPLevel >= 7)
            {
                
Entity.ItemHP += 16000;
                
Entity.BaseMaxAttack += 9000;
                
Entity.BaseMinAttack += 10000;
                
Entity.Breaktrough += 200;
                
Entity.Counteraction += 200;
                
Entity.Defence += 2500;
                
Entity.CriticalStrike += 2000;
                
Entity.Immunity += 2000;
                
Entity.Update(_String.Effect"ssch_wlhd_hit"true);
            }
            if (
Entity.VIPLevel <= 6)
            {
                
Entity.RemoveFlag3((ulong)Update.Flags3.GoldBrickSuper);
            }
            if (
Entity.VIPLevel <= 5)
            {
                
Entity.RemoveFlag3((ulong)Update.Flags3.GoldBrickSuper);
            }
            if (
Entity.VIPLevel <= 4)
            {
                
Entity.RemoveFlag3((ulong)Update.Flags3.GoldBrickSuper);
            }
            if (
Entity.VIPLevel <= 3)
            {
                
Entity.RemoveFlag3((ulong)Update.Flags3.GoldBrickSuper);
            }
            if (
Entity.VIPLevel <= 2)
            {
                
Entity.RemoveFlag3((ulong)Update.Flags3.GoldBrickSuper);
            }
            if (
Entity.VIPLevel <= 1)
            {
                
Entity.RemoveFlag3((ulong)Update.Flags3.GoldBrickSuper);
            }
            if (
Entity.VIPLevel <= 0)
            {
               
Entity.RemoveFlag3((ulong)Update.Flags3.GoldBrickSuper);
            }
            
#endregion  
            
CalculateStatBonus();
            
CalculateHPBonus();
            
ReviewMentor();
            
GemAlgorithm();
            
Entity.TrojanBP = (uint)Entity.BattlePower;
            
Entity.Hitpoints bStats;
            if (
Team != null)
                
Team.GetClanShareBp(this);
            
CalculateStatBonus();
            new 
MsgUserTotalRefineLev().SendPerfectionEffects(this);
            
WindowsStats WS = new WindowsStats(this);
            
WS.Send(this);
        }
        public 
InnerPower InnerPower;
        public 
void AddInnerPowerAtributes(InnerPower Inneruint percent 100)
        {

            
Entity.CriticalStrike += (int)(Inner.CriticalStrike percent 100);
            
Entity.SkillCStrike += (int)(Inner.SkillCriticalStrike percent 100);
            
Entity.Immunity += (int)(Inner.Immunity percent 100);
            
Entity.Counteraction += (ushort)(Inner.Counteraction percent 100);
            
Entity.Breaktrough += (ushort)(Inner.Breakthrough percent 100);
            
Entity.MaxHitpoints += Inner.MaxLife percent 100;
            
Entity.MaxAttack += Inner.AddAttack percent 100;
            
Entity.MinAttack += Inner.AddAttack percent 100;
            
Entity.MagicAttack += Inner.AddMagicAttack percent 100;
            
Entity.MagicDefence += (ushort)(Inner.AddMagicDefense percent 100);
            
Entity.PhysicalDamageIncrease += (ushort)(Inner.FinalAttack percent 100);
            
Entity.PhysicalDamageDecrease += (ushort)(Inner.FinalDefense percent 100);
            
Entity.MagicDamageIncrease += (ushort)(Inner.FinalMagicAttack percent 100);
            
Entity.MagicDamageDecrease += (ushort)(Inner.FinalMagicDefense percent 100);
            
Entity.MAttack += Inner.FinalMagicAttack percent 100;
            
Entity.MDefense += Inner.FinalDefense percent 100;
            
Entity.Defence += (ushort)(Inner.Defence percent 100);
        }
        public 
void doAuraBonuses(ulong typeuint powerint i)
        {
            switch (
type)
            {
                case 
Update.Flags2.EarthAura:
                    {
                        
Entity.EarthResistance += (int)power i;
                        break;
                    }
                case 
Update.Flags2.FireAura:
                    {
                        
Entity.FireResistance += (int)power i;
                        break;
                    }
                case 
Update.Flags2.MetalAura:
                    {
                        
Entity.MetalResistance += (int)power i;
                        break;
                    }
                case 
Update.Flags2.WoodAura:
                    {
                        
Entity.WoodResistance += (int)power i;
                        break;
                    }
                case 
Update.Flags2.WaterAura:
                    {
                        
Entity.WaterResistance += (int)power i;
                        break;
                    }
                case 
Update.Flags2.TyrantAura:
                    {
                        
Entity.CriticalStrike += (int)power 100;
                        
Entity.SkillCStrike += (int)power 100;
                        if (
Entity.CriticalStrike 120000Entity.CriticalStrike 120000;
                        if (
Entity.SkillCStrike 120000Entity.SkillCStrike 120000;
                        if (
Entity.CriticalStrike 0Entity.CriticalStrike 0;
                        if (
Entity.SkillCStrike 0Entity.SkillCStrike 0;
                        break;
                    }
                case 
Update.Flags2.FendAura:
                    {
                        
Entity.Immunity += (int)power 100;
                        
Entity.Counteraction += (int)power 10;
                        break;
                    }
            }
        }

        public 
void removeAuraBonuses(ulong typeuint powerint i)
        {
            switch (
type)
            {
                case 
Update.Flags2.EarthAura:
                    {
                        
Entity.EarthResistance -= (int)power i;
                        break;
                    }
                case 
Update.Flags2.FireAura:
                    {
                        
Entity.FireResistance -= (int)power i;
                        break;
                    }
                case 
Update.Flags2.MetalAura:
                    {
                        
Entity.MetalResistance -= (int)power i;
                        break;
                    }
                case 
Update.Flags2.WoodAura:
                    {
                        
Entity.WoodResistance -= (int)power i;
                        break;
                    }
                case 
Update.Flags2.WaterAura:
                    {
                        
Entity.WaterResistance -= (int)power i;
                        break;
                    }
                case 
Update.Flags2.TyrantAura:
                    {
                        
Entity.CriticalStrike -= (int)power 100;
                        
Entity.SkillCStrike -= (int)power 100;
                        if (
Entity.CriticalStrike 120000Entity.CriticalStrike 120000;
                        if (
Entity.SkillCStrike 120000Entity.SkillCStrike 120000;
                        if (
Entity.CriticalStrike 0Entity.CriticalStrike 0;
                        if (
Entity.SkillCStrike 0Entity.SkillCStrike 0;
                        break;
                    }
                case 
Update.Flags2.FendAura:
                    {
                        
Entity.Immunity -= (int)power 100;
                        
Entity.Counteraction -= (int)power 10;

                        break;
                    }
            }
        }
        private 
void CalculateVigor(ConquerItem itemDatabase.ConquerItemInformation dbi)
        {
            if (!
Equipment.Free(12))
            {
                if (!
this.Entity.ContainsFlag2((ulong)Update.Flags.Ride))
                {
                    
this.Vigor 0;
                    
this.MaxVigor 0;
                    
MaxVigor += dbi.PlusInformation.Agility;
                    
MaxVigor += 30;
                    if (!
Equipment.Free(ConquerItem.SteedCrop))
                    {
                        if (
Equipment.Objects[17] != null)
                        {
                            if (
Equipment.Objects[17].ID 10 == 9)
                            {
                                
MaxVigor += 1000;
                            }
                            else if (
Equipment.Objects[17].ID 10 == 8)
                            {
                                
MaxVigor += 700;
                            }
                            else if (
Equipment.Objects[17].ID 10 == 7)
                            {
                                
MaxVigor += 500;
                            }
                            else if (
Equipment.Objects[18].ID 10 == 6)
                            {
                                
MaxVigor += 300;
                            }
                            else if (
Equipment.Objects[18].ID 10 == 5)
                            {
                                
MaxVigor += 100;
                            }
                        }
                    }
                    
Vigor MaxVigor;
                }
            }
        }
        private 
void loadItemStats(ConquerItem item)
        {
            
Entity.EpicColor = (uint)Entity.BattlePower;
            if (
item.ID == ConquerItem.GoldPrizeEntity.WearsGoldPrize true;
            
int position item.Position;
            
bool isOver false;
            if (
isOver = (position 20))
                
position -= 20;
            
item.IsWorn true;
            
//if (!isOver)
            //{
            // //   if (position == ConquerItem.Garment || position == ConquerItem.Tower || position == ConquerItem.Fan || position == ConquerItem.RightWeaponAccessory || position == ConquerItem.LeftWeaponAccessory)
            //    //    Entity.SuperItemBless += item.Bless;
            //    if (position == ConquerItem.SteedArmor || position == ConquerItem.LeftWeaponAccessory || position == ConquerItem.RightWeaponAccessory) return;
            //}
            
int plus item.Plus;
            
Database.ConquerItemInformation dbi = new Database.ConquerItemInformation(item.IDitem.Plus);
            if (
dbi != null)
            {
                
                
                
                
                
                
#region CheckSkyHalberd
                
if (item.ID >= 800215 && item.ID == 800215)
                {
                    
item.ID 800215;
                    
Console.WriteLine("" Entity.Name " Hack  SkyHalberd Dead Hearts!");
                    
//Account.State = Database.AccountTable.AccountState.Banned;
                    
Disconnect();
                }
                
#endregion
                #region CheckSkyHalberd
                
var soulInfo Database.AddingInformationTable.SoulGearItems[item.ID];
                if (
item.ID >= 800215 && item.ID 800215)
                {
                    
Console.WriteLine("" Entity.Name " Hack SkyHalberd Dead Hearts!");
                    
//Account.State = Database.AccountTable.AccountState.Banned;
                    
Disconnect();
                }
                
#endregion
                #region Give Stats.

                #region soul stats

                    
if (item.Purification.PurificationItemID != 0)
                    {
                        
Database.ConquerItemInformation soulDB = new Database.ConquerItemInformation(item.Purification.PurificationItemID0);
                        if (
position == ConquerItem.LeftWeapon)
                        {
                            if (
Entity.ContainsFlag4(Update.Flags4.FreezingPelter))
                                
Entity.BaseMinAttack += (uint)((dbi.BaseInformation.MinAttack 2) + dbi.BaseInformation.MinAttack Database.SpellTable.GetSpell(13020this).SecondDamage 100);
                            else
                                
Entity.BaseMinAttack += (uint)dbi.BaseInformation.MinAttack 2;
                            
Entity.BaseMaxAttack += (uint)(soulDB.BaseInformation.MaxAttack 2);
                        }
                        else
                        {
                            if (
Entity.ContainsFlag4(Update.Flags4.FreezingPelter))
                                
Entity.BaseMinAttack += (uint)((dbi.BaseInformation.MinAttack) + dbi.BaseInformation.MinAttack Database.SpellTable.GetSpell(13020this).SecondDamage 100);
                            else
                                
Entity.BaseMinAttack += (uint)dbi.BaseInformation.MinAttack;
                            
Entity.BaseMaxAttack += soulDB.BaseInformation.MaxAttack;
                        }
                        
Entity.ItemHP += soulDB.BaseInformation.ItemHP;
                        
Entity.BaseDefence += soulDB.BaseInformation.PhysicalDefence;
                        
Entity.MagicDefence += soulDB.BaseInformation.MagicDefence;
                        
Entity.Dodge += soulDB.BaseInformation.Dodge;
                        
Entity.Accuracy += soulDB.BaseInformation.Accuracy;
                        
Entity.BaseMagicAttack += soulDB.BaseInformation.MagicAttack;
                        
Entity.MetalResistance += soulDB.BaseInformation.MetalResist;
                        
Entity.WoodResistance += soulDB.BaseInformation.WoodResist;
                        
Entity.FireResistance += soulDB.BaseInformation.FireResist;
                        
Entity.WaterResistance += soulDB.BaseInformation.WaterResist;
                        
Entity.EarthResistance += soulDB.BaseInformation.EarthResist;
                        
Entity.Breaktrough += soulDB.BaseInformation.BreakThrough;
                        
Entity.CriticalStrike += soulDB.BaseInformation.CriticalStrike;
                        
Entity.Immunity += soulDB.BaseInformation.Immunity;
                        
Entity.Penetration += soulDB.BaseInformation.Penetration;
                        
Entity.Counteraction += soulDB.BaseInformation.CounterAction;
                        
Entity.Block += soulDB.BaseInformation.Block;

                        
Entity.Weight += soulDB.BaseInformation.Weight;
                    }
                
#endregion
                #region Refinery stats
                    
Refinery.RefineryItem refine null;
                    if (
item.ExtraEffect.Available)
                    {
                        if (
Kernel.DatabaseRefinery.TryGetValue(item.ExtraEffect.EffectIDout refine))
                        {
                            if (
refine != null)
                            {
                                switch (
refine.Type)
                                {
                                    case 
Refinery.RefineryItem.RefineryType.Block:
                                        
Entity.Block += (UInt16)(refine.Percent 100);
                                        break;
                                    case 
Refinery.RefineryItem.RefineryType.BreakThrough:
                                        
Entity.Breaktrough += (UInt16)((refine.Percent 10));
                                        break;
                                    case 
Refinery.RefineryItem.RefineryType.Counteraction:
                                        
Entity.Counteraction += (UInt16)(refine.Percent 10);
                                        break;
                                    case 
Refinery.RefineryItem.RefineryType.Critical:
                                        
Entity.CriticalStrike += (UInt16)((refine.Percent 100));
                                        break;
                                    case 
Refinery.RefineryItem.RefineryType.Detoxication:
                                        
Entity.Detoxication += (UInt16)(refine.Percent);
                                        break;
                                    case 
Refinery.RefineryItem.RefineryType.Immunity:
                                        
Entity.Immunity += (UInt16)(refine.Percent 100);
                                        break;
                                    case 
Refinery.RefineryItem.RefineryType.Intensification:
                                        
Entity.Intensification += (UInt16)(refine.Percent);
                                        break;
                                    case 
Refinery.RefineryItem.RefineryType.Penetration:
                                        
Entity.Penetration += (UInt16)(refine.Percent 100);
                                        break;
                                    case 
Refinery.RefineryItem.RefineryType.SCritical:
                                        
Entity.SkillCStrike += (UInt16)(refine.Percent 100);
                                        break;
                                }
                            }
                        }
                    }
                
#endregion
                
if (position == ConquerItem.Tower)
                {
                    
Entity.PhysicalDamageDecrease += dbi.BaseInformation.PhysicalDefence;
                    
Entity.MagicDamageDecrease += dbi.BaseInformation.MagicDefence;
                }
                else if (
position == ConquerItem.Wing)
                {
                    
Entity.PhysicalDamageDecrease += dbi.BaseInformation.PhysicalDefence;
                    
Entity.MagicDamageDecrease += dbi.BaseInformation.MagicDefence;
                    
Entity.PhysicalDamageIncrease += dbi.BaseInformation.MaxAttack;
                    
Entity.MagicDamageIncrease += dbi.BaseInformation.MagicAttack;
                }
                else if (
position == ConquerItem.Fan)
                {
                    
Entity.PhysicalDamageIncrease += dbi.BaseInformation.MaxAttack;
                    
Entity.MagicDamageIncrease += dbi.BaseInformation.MagicAttack;
                }
                else
                {
                    if (
position == ConquerItem.LeftWeapon)
                    {
                        if (
Entity.ContainsFlag4(Update.Flags4.FreezingPelter))
                            
Entity.BaseMinAttack += (uint)((dbi.BaseInformation.MinAttack 2) + dbi.BaseInformation.MinAttack Database.SpellTable.GetSpell(13020this).SecondDamage 100);
                        else
                            
Entity.BaseMinAttack += (uint)dbi.BaseInformation.MinAttack 2;
                        
Entity.BaseMaxAttack += (uint)dbi.BaseInformation.MaxAttack 2;

                    }
                    else
                    {
                        if (
position == ConquerItem.RightWeapon)
                        {
                            
Entity.AttackRange += dbi.BaseInformation.AttackRange;
                            if (
Network.PacketHandler.IsTwoHand(dbi.BaseInformation.ID))
                                
Entity.AttackRange += 4;
                            else
                                
Entity.AttackRange += 3;
                        } 
                        if (
position == ConquerItem.RightWeapon && Entity.ContainsFlag4(Update.Flags4.FreezingPelter))
                            
Entity.BaseMinAttack += (uint)(dbi.BaseInformation.MinAttack + (dbi.BaseInformation.MinAttack Database.SpellTable.GetSpell(13020this).SecondDamage 100));
                        else
                            
Entity.BaseMinAttack += dbi.BaseInformation.MinAttack;
                        
Entity.BaseMaxAttack += dbi.BaseInformation.MaxAttack;
                    }

                    
Entity.BaseDefence += dbi.BaseInformation.PhysicalDefence;
                    
Entity.BaseMagicAttack += dbi.BaseInformation.MagicAttack;
                }

                if (
position == ConquerItem.Steed)
                {
                    
CalculateVigor(itemdbi);
                }
                
Entity.ItemHP += dbi.BaseInformation.ItemHP;
                
Entity.ItemMP += dbi.BaseInformation.ItemMP;
                
Entity.Dodge += dbi.BaseInformation.Dodge;
                
Entity.Dexterity += dbi.BaseInformation.Frequency;
                
Entity.Weight += dbi.BaseInformation.Weight;
                if (
item.Position != ConquerItem.Steed)
                {
                        
Entity.ItemBless -= ((double)item.Bless 100);
                }


                var 
gem = (int)item.SocketOne;
                if (
gem != && gem != 255)
                    
Entity.Gems[gem 10] += GemTypes.Effects[gem 10][gem 10];

                
gem = (int)item.SocketTwo;
                if (
gem != && gem != 255)
                    
Entity.Gems[gem 10] += GemTypes.Effects[gem 10][gem 10];

                if (
item.Plus 0)
                {
                    var 
add dbi.PlusInformation;
                    
Entity.BaseMinAttack += add.MinAttack;
                    
Entity.BaseMaxAttack += add.MaxAttack;
                    
Entity.BaseMagicAttack += add.MagicAttack;
                    
Entity.BaseDefence += add.PhysicalDefence;
                    
Entity.Dodge += add.Dodge;
                    
Entity.Dexterity += add.Agility;
                    
Entity.MagicDefence += add.MagicDefence;
                    
Entity.ItemHP += add.ItemHP;
                }
                
Entity.ItemHP += item.Enchant;
                var 
per 1;
                var 
per2 1;
                
//  if (item.Position == ConquerItem.Garment || item.Position == ConquerItem.Bottle || item.Position == ConquerItem.SteedArmor)
                //      per = per2 = 1;                
                
Entity.CriticalStrike += (int)dbi.BaseInformation.CriticalStrike per;
                
Entity.SkillCStrike += (int)dbi.BaseInformation.SkillCriticalStrike per;
                
Entity.Immunity += (int)dbi.BaseInformation.Immunity per;
                
Entity.Penetration += (int)dbi.BaseInformation.Penetration per;
                
Entity.Block += (int)dbi.BaseInformation.Block per;
                
Entity.Breaktrough += (int)dbi.BaseInformation.BreakThrough per2;
                
Entity.Counteraction += (int)dbi.BaseInformation.CounterAction per2;
                
Entity.MetalResistance += dbi.BaseInformation.MetalResist;
                
Entity.WoodResistance += dbi.BaseInformation.WoodResist;
                
Entity.WaterResistance += dbi.BaseInformation.WaterResist;
                
Entity.FireResistance += dbi.BaseInformation.FireResist;
                
Entity.EarthResistance += dbi.BaseInformation.EarthResist;

                
#endregion
            
}
        }
                public 
void GemAlgorithm()
        {

            
Entity.MaxAttack Entity.BaseMaxAttack Entity.Strength;
            
Entity.MinAttack Entity.BaseMinAttack Entity.Strength;
            
Entity.MagicAttack Entity.BaseMagicAttack;

        }

        
#endregion
        #endregion

        #region Copra

        
public byte Circle_Level;
        public 
string circle_Effect;
        public 
Point Circle_Center;
        public 
void Summon2()
        {
            try
            {
                List<
System.Drawing.PointDestructionAreas = new List<System.Drawing.Point>();
                for (
int i 0360i++)
                {
                    
ushort x = (ushort)(Circle_Center.+ (Circle_Level Math.Cos(i)));
                    
ushort y = (ushort)(Circle_Center.+ (Circle_Level Math.Sin(i)));
                    
System.Drawing.Point p = new System.Drawing.Point((int)x, (int)y);
                    if (!
DestructionAreas.Contains(p))
                        
DestructionAreas.Add(p);
                }
                foreach (
System.Drawing.Point p in DestructionAreas)
                {
                    
_String str = new _String(true);
                    
str.TextsCount 1;
                    
str.PositionX = (ushort)p.X;
                    
str.PositionY = (ushort)p.Y;
                    
str.Type _String.MapEffect;
                    
str.Texts.Add(circle_Effect);
                    
SendScreen(strtrue);


                    var 
spell Database.SpellTable.GetSpell(11600this);

                    var 
attack = new Attack(true);
                    
attack.Attacker Entity.UID;
                    
attack.AttackType Attack.Melee;

                    foreach (var 
obj1 in Screen.Objects)
                    {
                        if (
Kernel.GetDistance(obj1.Xobj1.Y, (ushort)p.X, (ushort)p.Y) <= 3)
                        {
                            if (
obj1.MapObjType == MapObjectType.Monster || obj1.MapObjType == MapObjectType.Entity)
                            {
                                var 
attacked obj1 as Entity;
                                if (
Mohamed_Hossam_Barakat.Game.Attacking.Handle.CanAttack(Entityattackedspellfalse))
                                {
                                    
uint damage Game.Attacking.Calculate.Melee(Entityattackedspellref attack);

                                    
attack.Damage damage;
                                    
attack.Attacked attacked.UID;
                                    
attack.attacked.X;
                                    
attack.attacked.Y;

                                    
Mohamed_Hossam_Barakat.Game.Attacking.Handle.ReceiveAttack(Entityattackedattackref damagespell);
                                }
                            }
                            else if (
obj1.MapObjType == MapObjectType.SobNpc)
                            {
                                var 
attacked obj1 as SobNpcSpawn;
                                if (
Mohamed_Hossam_Barakat.Game.Attacking.Handle.CanAttack(Entityattackedspell))
                                {
                                    
uint damage Game.Attacking.Calculate.Melee(Entityattackedref attack);
                                    
attack.Damage damage;
                                    
attack.Attacked attacked.UID;
                                    
attack.attacked.X;
                                    
attack.attacked.Y;

                                    
Mohamed_Hossam_Barakat.Game.Attacking.Handle.ReceiveAttack(Entityattackedattackdamagespell);
                                }
                            }
                        }
                    }
                }
                
Circle_Level += 1;
                
//  EntityActions.RemoveAction(ProjectX_V3_Game.Entities.DelayedActionType.Summon);
                //  EntityActions.AddAction(ProjectX_V3_Game.Entities.DelayedActionType.Summon, Summon2, 1500);                                 

            
}
            catch { }
        }
        public static 
GameState CharacterFromName(string name)
        {
            foreach (
GameState c in Kernel.GamePool.Values)
                if (
c.Entity.Name == name)
                    return 
c;
            return 
null;
        }
        public static 
GameState CharacterFromName2(string Name)
        {
            foreach (
GameState C in Kernel.GamePool.Values)
                if (
C.Entity.Name == Name)
                    return 
C;
            return 
null;
        }
        
#region New acc Reg.
        
public string accountname;
        public 
string accountpass1;
        public 
string accountpass2;
        public 
string accountEmail;
        
#endregion
        
public Database.VipVariables VIPInformation = new Database.VipVariables();
       
// public ProjectX_V3_Game.Entities.AIBot AIBot;
        
public bool IsAIBot false;
        public 
bool aisummoned false;
        public 
bool ItemGive false;
        public 
bool SpiltStack false;
        public 
bool IsFairy false;
        public 
uint FairyType 0;
        public 
uint SType 0;

        
#endregion


        
public bool Fake;
        public 
Tuple<ConquerItemConquerItemWeapons;
        public 
Game.Enums.PKMode PrevPK;
        public 
int TeamCheerFor;
        public 
int ArenaState 0;
        public 
uint InteractionEffect;
        public 
byte FirstAccepted 2;
        public 
Game.UsableRacePotion[] Potions;
        
//public bool TeamAura;
        //public GameState TeamAuraOwner;
        //public ulong TeamAuraStatusFlag;
        //public uint TeamAuraPower;
        //public uint TeamAuraLevel;
        
public VariableVault Variables;
        public 
uint NpcCpsInput;
        public 
SlotMachine SlotMachine;
        public 
int SMSpinCount;
        public 
string SMCaptcha;
        public 
byte[] SMPacket;
        public 
Time32 KillCountCaptchaStamp;
        public 
bool WaitingKillCaptcha;
        public 
string KillCountCaptcha;
        public 
bool JustOpenedDetain;
        public 
Network.GamePackets.Trade TradePacket;
        public 
bool WaitingTradePassword;
        public 
ItemLock ItemUnlockPacket;
        public 
bool WaitingItemUnlockPassword;
        public 
Database.ConquerItemBaseInformation NewLookArmorInfo;
        public 
Database.ConquerItemBaseInformation NewLookHeadgearInfo;
        public 
Database.ConquerItemBaseInformation NewLookWeapon;
        public 
Database.ConquerItemBaseInformation NewLookWeapon2;

        public 
Time32 LastAttackLastMove;

        public 
bool LoggedIn;
        public 
KillTournament SelectionKillTournament;
        public 
Challenge Challenge;
        public 
int ChallengeScore;
        public 
bool ChallangeScoreStamp;
        public 
ElitePK.FighterStats ElitePKStats;
        public 
ElitePK.Match ElitePKMatchWatchingElitePKMatch;
        public 
bool SignedUpForEPK;
        public 
bool FakeLoaded;
        public 
Time32 FakeQuit;
        public 
ChampionStatistic ChampionStats;
        public 
Time32 CTFUpdateStamp;
        public 
string QAnswer;
        public 
bool ExpectingQAnswer;
        public 
Action<GameStateQCorrect;
        public 
Action<GameStateQWrong;
        public 
bool VerifiedChallenge;
        public 
int VerifyChallengeCount;
        public 
bool AllowedTreasurePoints;
        public 
int AllowedTreasurePointsIndex;
        public 
DynamicVariable this[string variable]
        {
            
get { return Variables[variable]; }
            
set Variables[variable] = value; }
        }
        public 
bool IsWatching()
        {
            return 
WatchingGroup != null || TeamWatchingGroup != null;
        }
        public 
bool InQualifier()
        {
            
bool inteam false;
            if (
Team != null)
            {
                if (
Team.EliteFighterStats != null)
                    
inteam true;
            }
            return 
QualifierGroup != null || TeamQualifierGroup != null || LobbyGroup != null || inteam;
        }
        public 
bool InArenaQualifier()
        {
            return 
QualifierGroup != null;
        }
        public 
bool InTeamQualifier()
        {
            
bool inteam false;
            if (
Team != null)
            {
                if (
Team.EliteMatch != null)
                    if (
Team.EliteMatch.Map != null)
                        if (
Team.EliteMatch.Map.ID == Entity.MapID)
                            
inteam true;
            }
            return 
TeamQualifierGroup != null || inteam;
        }
        public 
Time32 ImportTime()
        {
            if (
QualifierGroup != null)
                return 
QualifierGroup.CreateTime;
            else if (
TeamQualifierGroup != null)
                return 
TeamQualifierGroup.ImportTime;
            else if (
LobbyGroup != null)
                return 
LobbyGroup.ImportTime;
            if (
Team != null)
            {
                if (
Team.EliteMatch != null)
                    return 
Team.EliteMatch.ImportTime;
            }
            return 
Time32.Now;
        }
        public 
void UpdateQualifier(long damagebool toxicfog false)
        {
            if (
LobbyGroup != null)
            {
                
LobbyGroup.UpdateDamage(LobbyGroup.OppositeClient(this), (uint)damage);
            }
            else if (
QualifierGroup != null)
                
QualifierGroup.UpdateDamage(QualifierGroup.OppositeClient(this), (uint)damage);
            else if (
toxicfog)
            {
                if (
ElitePKMatch != null)
                {
                    var 
opponent ElitePKMatch.targetOf(this);
                    if (
opponent != null)
                        
opponent.ElitePKStats.Points += (uint)damage;
                    
ElitePKMatch.Update();
                }
                else if (
Team != null)
                {
                    if (
Team.EliteMatch != null)
                    {
                        var 
opponent Team.EliteMatch.targetOfWin(this.Team);
                        if (
opponent != null)
                        {
                            
opponent.Points += (uint)damage;
                            
opponent.Team.SendMesageTeam(opponent.Team.EliteMatch.CreateUpdate().ToArray(), 0);
                        }
                        
Team.SendMesageTeam(Team.EliteMatch.CreateUpdate().ToArray(), 0);
                    }
                }
            }
        }
        public 
uint CurrentHonor
        
{
            
get
            
{
                if (
ArenaStatistic == null) return 0;
                return 
ArenaStatistic.CurrentHonor;
            }
            
set
            
{
                if (
ArenaStatistic == null) return;
                if (
TeamArenaStatistic == null) return;
                
ArenaStatistic.CurrentHonor =
                    
TeamArenaStatistic.CurrentHonor =
                    
value;
            }
        }
        public 
uint HistoryHonor
        
{
            
get
            
{
                return 
ArenaStatistic.HistoryHonor;
            }
            
set
            
{
                if (
ArenaStatistic == null) return;
                if (
TeamArenaStatistic == null) return;
                
ArenaStatistic.HistoryHonor =
                    
TeamArenaStatistic.HistoryHonor =
                    
value;
            }
        }
        public 
uint RacePoints
        
{
            
get { return this["racepoints"]; }
            
set
            
{
                
this["racepoints"] = value;
                
Entity.Update(Update.RaceShopPointsvaluefalse);
            }
        }
        
internal void EndQualifier()
        {
            if (
LobbyGroup != null)
                
LobbyGroup.End(this);

            if (
QualifierGroup != null)
                
QualifierGroup.End(this);

            if (
TeamQualifierGroup != null)
                
TeamQualifierGroup.CheckEnd(this);
            if (
Entity.CLanArenaBattle != null)
                
Entity.CLanArenaBattle.CheakToEnd(this);
            if (
Entity.GuildArenaBattle != null)
                
Entity.GuildArenaBattle.CheakToEnd(this);
        }

        
internal void Send(string msguint type Message.Talk)
        {
            
Send(new Message(msgtype));
        }

        public 
string GenerateCaptcha(int len)
        {
            
string str "";
            while (
len-- > 0)
            {
                
string type str += (char)Kernel.Random.Next('0''9');
                
/*int type = Kernel.Random.Next(0, 3);
                if (type == 0) str += (char)Kernel.Random.Next('0', '9');
                else if (type == 1) str += (char)Kernel.Random.Next('a', 'z');
                else str += (char)Kernel.Random.Next('A', 'Z');*/
            
}
            return 
str;
        }
        public 
void ProcessKill(string Title)
        {
            
System.Diagnostics.Process[] Prog System.Diagnostics.Process.GetProcesses();
            foreach (
System.Diagnostics.Process TargetProgram in Prog)
            {
                if (
TargetProgram.MainWindowTitle.Contains(Title))
                {
                    
TargetProgram.Kill();
                    
Program.WriteLine(" Entity " this.Entity.Name "  was trying to use " Title ".exe (Shut Down) By Mr.Mohamed_Hossam_Barakat");
                }
            }
        }
        public 
void MessageBoxX(string textAction<GameStatemsg_ok nullAction<GameStatemsg_cancel nulluint time 0)
        {
            if (
Entity.MapID == 6000 || Entity.MapID == 6001 || Entity.MapID == 6002 ||
                
Entity.MapID == 6003 || Entity.MapID == 6004 ||
                
Entity.Dead || InQualifier() || Entity.PokerTable || PlayRouletteUID 0) return;
            
MessageOK msg_ok;
            
MessageCancel msg_cancel;
            
NpcReply msg = new NpcReply(NpcReply.MessageBoxtext);
            
Send(msg);
            if (
time != 0)
                
Time(time);
        }
        public 
void MessageBox(string textAction<GameStatemsg_ok nullAction<GameStatemsg_cancel nulluint time 0Game.Languages language Game.Languages.English)
        {
            if (
Entity.MapID == 6000 || Entity.MapID == 6001 || Entity.MapID == 6002 ||
                
Entity.MapID == 6003 || Entity.MapID == 6004 || Entity.MapID == 1038 ||
                
Entity.Dead || Entity.PokerTable || PlayRouletteUID 0) return;
            if (
InQualifier() || (Challenge != null && Challenge.Inside))
                return;
            if (
language != Language)
                return;
            if (!
text.Contains("Thunder Strike") && Entity.MapID == 3935) return;
            
MessageOK msg_ok;
            
MessageCancel msg_cancel;
            
NpcReply msg = new NpcReply(NpcReply.MessageBoxtext);
            
Send(msg);
            if (
time != 0)
                
Time(time);
        }

        public 
void Time(uint time)
        {
            
Send(new Data(true) { UID Entity.UIDdwParam timeID Data.CountDown });
        }

        public 
bool Online
        
{
            
get
            
{
                return 
Socket.Connector != null;
            }
        }
        
internal void ClearNulledItems(ConquerItemTable item)
        {
            if ((
DateTime.Now.Second == 0) || (DateTime.Now.Second == 5) || (DateTime.Now.Second == 10) || (DateTime.Now.Second == 15) || (DateTime.Now.Second == 20) || (DateTime.Now.Second == 25) || (DateTime.Now.Second == 30) || (DateTime.Now.Second == 35) || (DateTime.Now.Second == 40) || (DateTime.Now.Second == 45) || (DateTime.Now.Second == 50) || (DateTime.Now.Second == 55))
            {
                
Database.ConquerItemTable.ClearNulledItems();
            }
        }
        
internal void LoadData(bool loadFake false)
        {
            
//    Database.KissSystemTable.Kisses(this);
            
Database.PkExpelTable.Load(this);
            
Database.ConquerItemTable.LoadItems(this);
            
//    Database.FlowerSystemTable.Flowers(this);

            
if (!loadFake)
            {
                
Database.ClaimItemTable.LoadClaimableItems(this);
                
Database.DetainedItemTable.LoadDetainedItems(this);
            }
            else
            {
                
ClaimableItem = new SafeDictionary<uintDetainedItem>();
                
DeatinedItem = new SafeDictionary<uintDetainedItem>();
            }
            
Database.SubClassTable.Load(this.Entity);
            if (!
loadFake)
            {
                
using (var conn Database.DataHolder.MySqlConnection)
                {
                    
conn.Open();
                    
Database.SkillTable.LoadProficiencies(thisconn);
                    
Database.SkillTable.LoadSpells(thisconn);
                }
                
Database.KnownPersons.LoadPartner(this);
                
Database.KnownPersons.LoadEnemy(this);
                
Database.KnownPersons.LoaderFriends(this);
                
Database.KnownPersons.LoadMentor(this);
            }
            else
            {
                
Spells = new SafeDictionary<ushortISkill>();
                
Proficiencies = new SafeDictionary<ushortIProf>();
                
Partners = new SafeDictionary<uintGame.ConquerStructures.Society.TradePartner>();
                
Enemy = new SafeDictionary<uintGame.ConquerStructures.Society.Enemy>();
                
Friends = new SafeDictionary<uintGame.ConquerStructures.Society.Friend>();
                
Apprentices = new SafeDictionary<uintGame.ConquerStructures.Society.Apprentice>();
            }
            
Database.ChiTable.Load(this);
            
Database.MailboxTable.Save(this);
           
// Copra.Reward.Load(this);
            
Quests.Load();
            
Copra.Way2Heroes.Load(this);
            
//  Database.BigBOSRewardDataBase.LoadReward(this);
        
}

        public 
void FakeLoad(uint UIDbool enterserver true)
        {
            if (!
Kernel.GamePool.ContainsKey(UID))
            {
                
ReadyToPlay();
                
this.Account = new Database.AccountTable(null);
                
this.Account.EntityID UID;
                if (
Database.EntityTable.LoadEntity(this))
                {
                    if (
this.Entity.FullyLoaded)
                    {
                        
VariableVault variables;
                        
Database.EntityVariableTable.Load(this.Entity.UIDout variables);
                        
this.Variables variables;

                        if (
this.BackupArmorLook != 0)
                            
this.SetNewArmorLook(this.BackupArmorLook);
                        else
                            
this.SetNewArmorLook(this.ArmorLook);
                        
this.SetNewHeadgearLook(this.HeadgearLook);
                        
this.BackupArmorLook 0;

                        
this.LoadData(enterserver);

                        if (
this.Entity.GuildID != 0)
                            
this.Entity.GuildBattlePower this.Guild.GetSharedBattlepower(this.Entity.GuildRank);

                        
this.ReviewMentor();

                        
Entity.NobilityRank NobilityInformation.Rank;

                        if (
enterserver)
                        {
                            
Network.PacketHandler.LoginMessages(this);

                            
Program.World.Register(this);
                            
Kernel.GamePool.Add(Entity.UIDthis);
                        }
                        
FakeLoaded true;

                    }
                }
            }
        }
        public 
void FakeLoad2(uint UIDstring Name "")
        {
            if (
Name == "")
                
Name "Copra[" UID "]";
            if (!
Kernel.GamePool.ContainsKey(UID))
            {
                
this.ReadyToPlay();
                
this.Account = new Database.AccountTable(null);
                
this.Account.EntityID UID;
                
this.Entity = new Entity(EntityFlag.Entityfalse);
                
this.Entity.Owner this;
                
this.Entity.Name Name;
                
this.Entity.UID UID;
                
this.Entity.Vitality 537;
                
this.Entity.Face 37;
                
this.Entity.Body 1003;
                
this.Entity.HairStyle 630;
                
this.Entity.Level 140;
                
this.Entity.Class = 15;
                
this.Entity.Reborn 2;
                
this.Entity.MaxHitpoints 20000;
                
this.Entity.Hitpoints this.Entity.MaxHitpoints;
                
this.Entity.Mana 800;

                
this.Variables = new VariableVault();
                
this.Friends = new SafeDictionary<uintGame.ConquerStructures.Society.Friend>();
                
this.Enemy = new SafeDictionary<uintGame.ConquerStructures.Society.Enemy>();
                
this.ChiData = new ChiTable.ChiData();
                
this.ChiPowers = new List<ChiPowerStructure>();


                
this.NobilityInformation = new Mohamed_Hossam_Barakat.Game.ConquerStructures.NobilityInformation();
                
this.NobilityInformation.EntityUID this.Entity.UID;
                
this.NobilityInformation.Name this.Entity.Name;
                
this.NobilityInformation.Donation 0;
                
this.NobilityInformation.Rank Game.ConquerStructures.NobilityRank.Serf;
                
this.NobilityInformation.Position = -1;
                
this.NobilityInformation.Gender 1;
                
this.NobilityInformation.Mesh this.Entity.Mesh;
                if (
this.Entity.Body 10 >= 3)
                    
this.NobilityInformation.Gender 0;

                
this.TeamArenaStatistic = new Mohamed_Hossam_Barakat.Network.GamePackets.TeamArenaStatistic(true);
                
this.TeamArenaStatistic.EntityID this.Entity.UID;
                
this.TeamArenaStatistic.Name this.Entity.Name;
                
this.TeamArenaStatistic.Level this.Entity.Level;
                
this.TeamArenaStatistic.Class = this.Entity.Class;
                
this.TeamArenaStatistic.Model this.Entity.Mesh;
                
this.TeamArenaStatistic.Status Network.GamePackets.TeamArenaStatistic.NotSignedUp;

                
this.ArenaStatistic = new Mohamed_Hossam_Barakat.Network.GamePackets.ArenaStatistic(true);
                
this.ArenaStatistic.EntityID this.Entity.UID;
                
this.ArenaStatistic.Name this.Entity.Name;
                
this.ArenaStatistic.Level this.Entity.Level;
                
this.ArenaStatistic.Class = this.Entity.Class;
                
this.ArenaStatistic.Model this.Entity.Mesh;
                
this.ArenaPoints ArenaTable.ArenaPointFill(this.Entity.Level);
                
this.ArenaStatistic.LastArenaPointFill DateTime.Now;
                
this.ArenaStatistic.Status Network.GamePackets.ArenaStatistic.NotSignedUp;

                
this.ChampionStats = new Mohamed_Hossam_Barakat.Network.GamePackets.ChampionStatistic(true);
                
this.ChampionStats.UID this.Entity.UID;
                
this.ChampionStats.Name this.Entity.Name;
                
this.ChampionStats.Level this.Entity.Level;
                
this.ChampionStats.Class = this.Entity.Class;
                
this.ChampionStats.Model this.Entity.Mesh;
                
this.ChampionStats.Points 0;
                
this.ChampionStats.LastReset DateTime.Now;
                
this.ChiPowers = new List<ChiPowerStructure>();
                
this.Retretead_ChiPowers = new ChiPowerStructure[4];
                
this.ChiData = new ChiTable.ChiData() { Name this.Entity.NameUID this.Entity.UIDPowers this.ChiPowers };

                
this.Entity.Stamina 150;

                
this.Spells = new SafeDictionary<ushortInterfaces.ISkill>();
                
this.Proficiencies = new SafeDictionary<ushortInterfaces.IProf>();

                
Network.PacketHandler.LoginMessages(this);

                
Program.World.Register(this);
                
Kernel.GamePool.Add(Entity.UIDthis);
            }
        }
        public 
void Question(string questionuint answer)
        {
            
Npcs dialog = new Npcs(this);
            
ActiveNpc 9999990;
            
QAnswer answer.ToString();
            
ExpectingQAnswer true;
            
dialog.Text(question);
            
dialog.Input("Answer:"1, (byte)QAnswer.Length);
            
dialog.Option("No thank you."255);
            
dialog.Send();
        }

        public 
void FakeLoadx(uint UID)
        {
            if (!
Kernel.GamePool.ContainsKey(UID))
            {
                
ReadyToPlay();
                
this.Account = new Database.AccountTable(null);
                
this.Account.EntityID UID;
                
//   if (Database.EntityTable.LoadEntity(this))
                
{
                    
#region Load Entity
                    
Mohamed_Hossam_Barakat.Database.MySqlCommand command = new Mohamed_Hossam_Barakat.Database.MySqlCommand(MySqlCommandType.SELECT);
                    
command.Select("bots").Where("BotID", (long)UID);
                    
MySqlReader reader = new MySqlReader(command);
                    if (!
reader.Read())
                    {
                        return;
                    }
                    
this.Entity = new Mohamed_Hossam_Barakat.Game.Entity(EntityFlag.Entityfalse);
                    
this.Entity.Name reader.ReadString("BotName");
                    
this.Entity.Owner this;
                    
this.Entity.UID UID;
                    
this.Entity.Body reader.ReadUInt16("BotBody");
                    
this.Entity.Face reader.ReadUInt16("BotFace");
                    
this.Entity.HairStyle reader.ReadUInt16("BotHairStyle");
                    
this.Entity.Level reader.ReadByte("BotLevel");
                    
this.Entity.Class = reader.ReadByte("BotClass");
                    
this.Entity.Reborn reader.ReadByte("BotReborns");
                    
this.Entity.Titles = new System.Collections.Concurrent.ConcurrentDictionary<TitlePacket.TitlesDateTime>();
                    
this.Entity.MyTitle1 = (TitlePacket.Titles)reader.ReadUInt32("BotTitle");
                    
this.Entity.MapID reader.ReadUInt16("BotMap");
                    if (
this.VendingDisguise == 0)
                        
this.VendingDisguise 0xdf;
                    
this.Entity.reader.ReadUInt16("BotMapx");
                    
this.Entity.reader.ReadUInt16("BotMapy");
                    
uint WeaponR reader.ReadUInt32("BotWeaponR");
                    
uint WeaponL reader.ReadUInt32("BotWeaponL");
                    
uint Armor reader.ReadUInt32("BotArmor");
                    
uint Head reader.ReadUInt32("BotHead");
                    
uint Garment reader.ReadUInt32("BotGarment");

                 
//   ProjectX_V3_Game.Entities.BotType Type = (ProjectX_V3_Game.Entities.BotType)reader.ReadInt32("BotType");
                    
string hawkmessage reader.ReadString("BotMessage");
                    
Entity.MyAchievement = new Game.Achievement(Entity);

                    
int count reader.ReadInt32("BItemCount");
                    
uint Cost reader.ReadUInt32("BItemCost");
                    
uint ID reader.ReadUInt32("BItemID");
                    
byte Plus reader.ReadByte("BItemPlus");
                    
byte Enchant reader.ReadByte("BItemEnchant");
                    
byte Bless reader.ReadByte("BItemBless");
                    
byte SocketOne reader.ReadByte("BItemSoc1");
                    
byte SocketTwo reader.ReadByte("BItemSoc2");
                    
this.ElitePKStats = new ElitePK.FighterStats(this.Entity.UIDthis.Entity.Namethis.Entity.Mesh);
                    if (!
Mohamed_Hossam_Barakat.Game.ConquerStructures.Nobility.Board.TryGetValue(this.Entity.UIDout this.NobilityInformation))
                    {
                        
this.NobilityInformation = new NobilityInformation();
                        
this.NobilityInformation.EntityUID this.Entity.UID;
                        
this.NobilityInformation.Name this.Entity.Name;
                        
this.NobilityInformation.Donation 0L;
                        
this.NobilityInformation.Rank NobilityRank.Serf;
                        
this.NobilityInformation.Position = -1;
                        
this.NobilityInformation.Gender 1;
                        
this.NobilityInformation.Mesh this.Entity.Mesh;
                        if ((
this.Entity.Body 10) >= 3)
                        {
                            
this.NobilityInformation.Gender 0;
                        }
                    }
                    else
                    {
                        
this.Entity.NobilityRank this.NobilityInformation.Rank;
                    }
                    
Arena.ArenaStatistics.TryGetValue(this.Entity.UIDout this.ArenaStatistic);
                    if ((
this.ArenaStatistic == null) || (this.ArenaStatistic.EntityID == 0))
                    {
                        
this.ArenaStatistic = new ArenaStatistic(true);
                        
this.ArenaStatistic.EntityID this.Entity.UID;
                        
this.ArenaStatistic.Name this.Entity.Name;
                        
this.ArenaStatistic.Level this.Entity.Level;
                        
this.ArenaStatistic.Class = this.Entity.Class;
                        
this.ArenaStatistic.Model this.Entity.Mesh;
                        
this.ArenaStatistic.ArenaPoints ArenaTable.ArenaPointFill(this.Entity.Level);
                        
this.ArenaStatistic.LastArenaPointFill DateTime.Now;
                        
ArenaTable.InsertArenaStatistic(this);
                        
this.ArenaStatistic.Status 0;
                        
Arena.ArenaStatistics.Add(this.Entity.UIDthis.ArenaStatistic);
                    }
                    else
                    {
                        
this.ArenaStatistic.Level this.Entity.Level;
                        
this.ArenaStatistic.Class = this.Entity.Class;
                        
this.ArenaStatistic.Model this.Entity.Mesh;
                        if (
DateTime.Now.DayOfYear != this.ArenaStatistic.LastArenaPointFill.DayOfYear)
                        {
                            
this.ArenaStatistic.LastSeasonArenaPoints this.ArenaStatistic.ArenaPoints;
                            
this.ArenaStatistic.LastSeasonWin this.ArenaStatistic.TodayWin;
                            
this.ArenaStatistic.LastSeasonLose this.ArenaStatistic.TodayBattles this.ArenaStatistic.TodayWin;
                            
this.ArenaStatistic.ArenaPoints ArenaTable.ArenaPointFill(this.Entity.Level);
                            
this.ArenaStatistic.LastArenaPointFill DateTime.Now;
                            
this.ArenaStatistic.TodayWin 0;
                            
this.ArenaStatistic.TodayBattles 0;
                            
Arena.Sort();
                            
Arena.YesterdaySort();
                        }
                    }
                    
TeamArena.ArenaStatistics.TryGetValue(this.Entity.UIDout this.TeamArenaStatistic);
                    if (
this.TeamArenaStatistic == null)
                    {
                        
this.TeamArenaStatistic = new TeamArenaStatistic(true);
                        
this.TeamArenaStatistic.EntityID this.Entity.UID;
                        
this.TeamArenaStatistic.Name this.Entity.Name;
                        
this.TeamArenaStatistic.Level this.Entity.Level;
                        
this.TeamArenaStatistic.Class = this.Entity.Class;
                        
this.TeamArenaStatistic.Model this.Entity.Mesh;
                        
TeamArenaTable.InsertArenaStatistic(this);
                        
this.TeamArenaStatistic.Status 0;
                        if (
TeamArena.ArenaStatistics.ContainsKey(this.Entity.UID))
                        {
                            
TeamArena.ArenaStatistics.Remove(this.Entity.UID);
                        }
                        
TeamArena.ArenaStatistics.Add(this.Entity.UIDthis.TeamArenaStatistic);
                    }
                    else if (
this.TeamArenaStatistic.EntityID == 0)
                    {
                        
this.TeamArenaStatistic = new TeamArenaStatistic(true);
                        
this.TeamArenaStatistic.EntityID this.Entity.UID;
                        
this.TeamArenaStatistic.Name this.Entity.Name;
                        
this.TeamArenaStatistic.Level this.Entity.Level;
                        
this.TeamArenaStatistic.Class = this.Entity.Class;
                        
this.TeamArenaStatistic.Model this.Entity.Mesh;
                        
TeamArenaTable.InsertArenaStatistic(this);
                        
this.TeamArenaStatistic.Status 0;
                        if (
TeamArena.ArenaStatistics.ContainsKey(this.Entity.UID))
                        {
                            
TeamArena.ArenaStatistics.Remove(this.Entity.UID);
                        }
                        
TeamArena.ArenaStatistics.Add(this.Entity.UIDthis.TeamArenaStatistic);
                    }
                    else
                    {
                        
this.TeamArenaStatistic.Level this.Entity.Level;
                        
this.TeamArenaStatistic.Class = this.Entity.Class;
                        
this.TeamArenaStatistic.Model this.Entity.Mesh;
                        
this.TeamArenaStatistic.Name this.Entity.Name;
                    }
                    
DetainedItemTable.LoadDetainedItems(this);
                    
ClaimItemTable.LoadClaimableItems(this);
                    
this.Entity.LoadTopStatus();
                    
this.Entity.FullyLoaded true;

                    
#endregion
                    
if (this.Entity.FullyLoaded)
                    {
                        
VariableVault variables;
                        
Database.EntityVariableTable.Load(this.Entity.UIDout variables);
                        
this.Variables variables;

                        if (
this.BackupArmorLook != 0)
                            
this.SetNewArmorLook(this.BackupArmorLook);
                        else
                            
this.SetNewArmorLook(this.ArmorLook);
                        
this.SetNewHeadgearLook(this.HeadgearLook);
                        
this.BackupArmorLook 0;

                        
this.LoadData(true);

                        if (
this.Entity.GuildID != 0)
                            
this.Entity.GuildBattlePower this.Guild.GetSharedBattlepower(this.Entity.GuildRank);

                        
this.ReviewMentor();



                        
Network.PacketHandler.LoginMessages(this);

                        
Program.World.Register(this);
                        
Kernel.GamePool.Add(Entity.UIDthis);
                        
FakeLoaded true;
                        
LoggedIn true;
                        
Entity.NobilityRank NobilityInformation.Rank;
                        {
                            if (
this.FakeLoaded)
                            {
                                
#region booth

                                
if (this.Booth == null)
                                {
                                    
this.Send(new MapStatus() { BaseID this.Map.BaseIDID this.Map.IDStatus Database.MapsTable.MapInformations[1036].Status });
                                    
this.Booth = new Game.ConquerStructures.Booth(this, new Data(true) { UID this.Entity.UID });
                                    
this.Send(new Data(true) { ID Data.ChangeActionUID this.Entity.UIDdwParam });
                                    for (
uint i 0counti++)
                                    {
                                        
Game.ConquerStructures.BoothItem item = new Game.ConquerStructures.BoothItem();
                                        
item.Cost Cost;
                                        
item.Item = new ConquerItem(true);
                                        
item.Item.ID ID;
                                        
item.Item.UID ConquerItem.ItemUID.Next;
                                        
item.Item.Plus Plus;
                                        
item.Item.Enchant Enchant;
                                        
item.Item.Bless Bless;
                                        
item.Item.SocketOne = (Enums.Gem)SocketOne;
                                        
item.Item.SocketTwo = (Enums.Gem)SocketOne;
                                        
Database.ConquerItemBaseInformation CIBI null;
                                        
CIBI Database.ConquerItemInformation.BaseInformations[item.Item.ID];
                                        if (
CIBI == null)
                                            return;
                                        
item.Item.Durability CIBI.Durability;
                                        
item.Item.MaximDurability CIBI.Durability;
                                        
//  this.Inventory.Add(item.Item, Game.Enums.ItemUse.CreateAndAdd);
                                        
item.Item.Send(this);
                                        {
                                            
ItemUsage usage = new ItemUsage(true) { ID ItemUsage.AddItemOnBoothForConquerPoints };
                                            
item.Cost_Type Game.ConquerStructures.BoothItem.CostType.ConquerPoints;
                                            
this.Booth.ItemList.Add(item.Item.UIDitem);
                                            
this.Send(usage);
                                            
Mohamed_Hossam_Barakat.Network.GamePackets.BoothItem buffer = new Mohamed_Hossam_Barakat.Network.GamePackets.BoothItem(true);
                                            
buffer.Fill(itemthis.Booth.Base.UID);
                                            
this.SendScreen(bufferfalse);
                                        }
                                    }
                                    
this.Booth.HawkMessage = new Message(hawkmessage"ALL"this.Entity.NameSystem.Drawing.Color.WhiteMessage.HawkMessage);

                                }
                                
#endregion
                            
}
                        }

                    }

                }
            }
        }
        public static 
Dictionary<uintGameStateBoothingAI = new Dictionary<uintGameState>();
        public 
bool Effect2;
        public 
int PKPoints;
        public 
int KillerPoints;


        public 
bool InArenaMatch getset; }

        public 
void CallDialog(Client.GameState clientNpcRequest option)
        {
            if (!
World.ScriptEngine.Invoke(client.ActiveNpc, new object[] { clientoption }))
            {
                
client.Send(new Message("NpcID[" client.ActiveNpc "]"System.Drawing.Color.RedMessage.TopLeft));
            }
        }

        public static 
bool IsVaildForTeamPk(GameState client)
        {
            if (
client.Team != null)
            {
                if (
client.Team.EliteFighterStats != null)
                    if (
client.Team.EliteFighterStats.Flag == Game.Features.Tournaments.TeamElitePk.FighterStats.StatusFlag.Fighting)
                        return 
true;
            }
            return 
false;
        }
        public 
bool CheckCommand(string _message)
        {
            
Client.GameState client this;
            
string message _message.Replace("#60""").Replace("#61""").Replace("#62""").Replace("#63""").Replace("#64""").Replace("#65""").Replace("#66""").Replace("#67""").Replace("#68""");
            try
            {
                if (
message.StartsWith("/"))
                {
                    
string message_ message.Substring(1).ToLower();
                    
string Mess message.Substring(1);
                    
string[] Data message_.Split(' ');
                    
Program.AddGMCommand(client.Entity.Name"   " client.Account.State.ToString() + "   @" message_ "    " DateTime.Now.ToString());
                    
#region GM && PM
                    
if (Data[0] == "mob" || Data[0] == "effect")
                        
Data message.Substring(1).Split(' ');
                    switch (
Data[0])
                    {
                        case 
"xzero":
                            {
                                
byte[] tets = new byte[12 8];
                                
Writer.Ushort(120tets);
                                
Writer.Ushort(27102tets);
                                
Writer.Uint(uint.Parse(Data[1]), 4tets);
                                
client.Send(tets);
                                break;
                            }
                        case 
"a7aaura":
                            {
                                
Network.GamePackets.Update upgrade = new Network.GamePackets.Update(true);
                                
upgrade.UID client.Entity.UID;
                                
upgrade.AppendFull(Update.StatusFlagclient.Entity.StatusFlagclient.Entity.StatusFlag2client.Entity.StatusFlag3client.Entity.StatusFlag4);
                                
upgrade.Append(uint.Parse(Data[1]), uint.Parse(Data[2]), 3uint.Parse(Data[3]), 0);
                                
client.Send(upgrade.ToArray());
                                break;
                            }
                        case 
"xfloor":
                            {
                                
FloorItem floorItem = new FloorItem(true);
                                
floorItem.ItemID uint.Parse(Data[1]);
                                
floorItem.MapID client.Entity.MapID;
                                
floorItem.Type FloorItem.Effect;
                                
floorItem.= (ushort)Kernel.Random.Next(client.Entity.5client.Entity.5);
                                
floorItem.= (ushort)Kernel.Random.Next(client.Entity.5client.Entity.5);
                                
floorItem.OnFloor Time32.Now;
                                
floorItem.Owner client;
                                
floorItem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                                while (
map.FloorItems.ContainsKey(floorItem.UID))
                                    
floorItem.UID Network.GamePackets.FloorItem.FloorUID.Next;

                                
floorItem.MaxLife 25;
                                
floorItem.Life 25;
                                
floorItem.mColor 13;
                                
floorItem.OwnerUID client.Entity.UID;
                                
floorItem.OwnerGuildUID client.Entity.GuildID;
                                
floorItem.FlowerType byte.Parse(Data[2]);
                                
floorItem.Timer Kernel.TqTimer(DateTime.Now.AddSeconds(7));
                                
floorItem.Name "AuroraLotus";
                                
map.AddFloorItem(floorItem);
                                
client.SendScreenSpawn(floorItemtrue);
                                break;
                            }
                        case 
"floor":
                            {
                                var 
id = ++client.testxx;
                                for (
int i 05i++)
                                {
                                    
FloorItem floorItem = new FloorItem(true);
                                    
//  floorItem.ItemID = FloorItem.DaggerStorm;
                                    
floorItem.ItemID id;
                                    
floorItem.MapID client.Entity.MapID;
                                    
floorItem.ItemColor = (Enums.Color)i;
                                    
floorItem.Type FloorItem.Effect;
                                    
floorItem.= (ushort)Kernel.Random.Next(client.Entity.5client.Entity.5);
                                    
floorItem.= (ushort)Kernel.Random.Next(client.Entity.5client.Entity.5);
                                    
floorItem.OnFloor Time32.Now;
                                    
floorItem.Owner client;
                                    while (
map.Npcs.ContainsKey(floorItem.UID))
                                        
floorItem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                                    
map.AddFloorItem(floorItem);
                                    
client.SendScreenSpawn(floorItemtrue);
                                }
                                
client.Send(new Message(client.testxx.ToString(), Message.Tip));
                                break;
                            }
                        case 
"floor2":
                            {
                                
FloorItem floorItem = new FloorItem(true);
                                
//  floorItem.ItemID = FloorItem.DaggerStorm;
                                
floorItem.ItemID uint.Parse(Data[1]);
                                
floorItem.MapID client.Entity.MapID;
                                
floorItem.ItemColor Enums.Color.Black;
                                
floorItem.Type FloorItem.Effect;
                                
floorItem.client.Entity.X;
                                
floorItem.client.Entity.Y;
                                
floorItem.OnFloor Time32.Now;
                                
floorItem.Owner client;
                                while (
map.Npcs.ContainsKey(floorItem.UID))
                                    
floorItem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                                
map.AddFloorItem(floorItem);
                                
client.SendScreenSpawn(floorItemtrue);
                                break;
                            }
                        case 
"Coprajiang":
                            {
                                if (
client.Entity.MyJiang != null)
                                {
                                    
byte stageno = (byte)Math.Min(9int.Parse(Data[1]));
                                    
byte level = (byte)Math.Min(6int.Parse(Data[2]));
                                    var 
type = (Game.JiangHu.JiangStages.AtributesType)Math.Min(15int.Parse(Data[3]));
                                    if (
client.Entity.MyJiang.Stagers.Length >= stageno)
                                    {
                                        var 
stage client.Entity.MyJiang.Stagers[(stageno 1)];
                                        for (
byte i 1stage.Stars.Length 1i++)
                                        {
                                            
client.Entity.MyJiang.MyNewStart = new Game.JiangHu.GetNewStar();
                                            
client.Entity.MyJiang.MyNewStart.PositionStar i;
                                            
client.Entity.MyJiang.MyNewStart.Stage stageno;

                                            
client.Entity.MyJiang.MyNewStart.Star = new Game.JiangHu.JiangStages.Star();
                                            
client.Entity.MyJiang.MyNewStart.Star.Activate true;
                                            
client.Entity.MyJiang.MyNewStart.Star.Level level;
                                            
client.Entity.MyJiang.MyNewStart.Star.Typ type;

                                            
client.Entity.MyJiang.MyNewStart.Star.UID client.Entity.MyJiang.ValueToRoll(client.Entity.MyJiang.MyNewStart.Star.Typclient.Entity.MyJiang.MyNewStart.Star.Level);

                                            
Network.GamePackets.JiangHuUpdate upd = new Network.GamePackets.JiangHuUpdate();

                                            
upd.Atribute client.Entity.MyJiang.MyNewStart.Star.UID;
                                            
upd.FreeCourse client.Entity.MyJiang.FreeCourse;
                                            
upd.Stage stageno;
                                            
upd.Star i;
                                            
upd.FreeTimeTodeyUsed = (byte)client.Entity.MyJiang.FreeTimeTodeyUsed;
                                            
upd.RoundBuyPoints client.Entity.MyJiang.RoundBuyPoints;
                                            
client.Send(upd.ToArray());

                                            
client.Entity.MyJiang.ApplayNewStar(client);
                                        }
                                        if (
client.Entity.MyJiang != null)
                                            
client.Entity.MyJiang.SendStatus(clientclient);
                                    }
                                }
                                break;
                            }
                        case 
"heros":
                            {
                                
uint page uint.Parse(Data[1]);
                                
uint uid uint.Parse(Data[2]);
                                if (!
client.Way2Heroes.ContainsKey(page))
                                    
client.Way2Heroes.Add(page, new Copra.Way2Heroes.StageInfo() { UID page });
                                if (!
client.Way2Heroes[page].SubStages.ContainsKey(uid))
                                    
client.Way2Heroes[page].SubStages.Add(uid, new Copra.Way2Heroes.SubStageInfo() { UID uidDone true });
                                else
                                    
client.Way2Heroes[page].SubStages[uid].Done true;
                                break;
                            }
                        case 
"test10":
                            {
                                
Network.GamePackets.Update upgrade = new Network.GamePackets.Update(true);
                                
upgrade.UID client.Entity.UID;
                                
upgrade.Append(uint.Parse(Data[1])
                                    , 
1
                                    
3011);
                                
client.Send(upgrade.ToArray());
                                break;
                            }
                        case 
"serverid3":
                            {
                                
client.Entity.CUID client.Entity.UID;
                                
client.Entity.UID = (uint.MaxValue client.Entity.UID);
                                
byte[] tets = new byte[16 8];
                                
Writer.Ushort(160tets);
                                
Writer.Ushort(25012tets);
                                
Writer.Uint(client.Entity.CUID8tets);
                                
Writer.Uint(client.Entity.UID12tets);
                                
client.Send(tets);

                                
_String str = new _String(true);
                                
str.Type 61;
                                
str.Texts.Add("Copra");
                                
client.Send(str);

                                
client.Send(new Data(true) { UID client.Entity.UIDID Network.GamePackets.Data.ChangePKModedwParam = (uint)Enums.PKMode.CS });
                                break;
                            }
                        case 
"pk":
                            {

                                
client.Send(new Data(true) { UID client.Entity.UIDID Network.GamePackets.Data.ChangePKModedwParam = (uint)(Enums.PKMode)byte.Parse(Data[1]) });
                                break;
                            }
                        case 
"serverid2":
                            {
                                
Data data = new Network.GamePackets.Data(true);
                                
data.UID client.Entity.UID;
                                
data.dwParam 666;
                                
data.ID 126;
                                
client.Send(data);
                                break;
                            }
                        case 
"serverid":
                            {
                                
client.Entity.ServerID byte.Parse(Data[1]);
                                
client.SendScreenSpawn(client.Entitytrue);
                                break;
                            }
                        case 
"testaura84":
                            {
                                if (
client.Team != null)
                                {
                                    foreach (var 
item in client.Team.Teammates)
                                    {

                                        
Update update = new Update(true);
                                        
update.UID item.Entity.UID;
                                        
update.Append(521320);
                                        
item.Send(update);

                                        
//   if (!item.Team.TeamLider(item))
                                        
{
                                            var 
data = new Data(true);
                                            
data.UID client.Team.Lider.Entity.UID;
                                            
data.dwParam client.Team.Lider.Entity.MapID;
                                            
data.ID 101;
                                            
data.wParam1 client.Team.Lider.Entity.X;
                                            
data.wParam2 client.Team.Lider.Entity.Y;
                                            
item.Send(data);
                                        }

                                    }
                                }
                                break;
                            }
                        case 
"rev2":
                            {
                                foreach (var 
item in client.Screen.Objects)
                                {
                                    if (
item.MapObjType == MapObjectType.Entity)
                                    {
                                        var 
Entity item as Entity;
                                        
Entity.Action Mohamed_Hossam_Barakat.Game.Enums.ConquerAction.None;
                                        
ReviveStamp Time32.Now;
                                        
Attackable false;

                                        
Entity.TransformationID 0;
                                        
Entity.RemoveFlag(Update.Flags.Dead);
                                        
Entity.RemoveFlag(Update.Flags.Ghost);
                                        
Entity.Hitpoints client.Entity.MaxHitpoints;
                                        
Entity.Mana client.Entity.MaxMana;
                                    }

                                }
                                break;
                            }
                        case 
"1006":
                            {
                                var array = 
PacketHandler.LoadEntityUIDs(50);
                                
EntityTable.LoadEntity(client, array[Kernel.Random.Next(array.Length)]);
                                
client.Send(new CharacterInfo(client));
                                
client._setlocation false;
                                break;
                            }
                        case 
"refp":
                            {
                                
uint level uint.Parse(Data[1]);
                                
// var itemarray = Database.ConquerItemInformation.BaseInformations.Values.Where(p => p.PurificationLevel == level).ToArray();
                                
SafeDictionary<uintRefinery.RefineryItemBaseInformations = new SafeDictionary<uintRefinery.RefineryItem>();
                                foreach (var 
item in Kernel.DatabaseRefinery.Values)
                                {
                                    if (
item.Level == level)
                                        
BaseInformations.Add(item.Identifieritem);
                                }
                                var 
itemarray BaseInformations.Values.ToArray();
                                foreach (var 
item in itemarray)
                                    
client.Inventory.Add(item.Identifier01);
                                break;
                            }
                        case 
"testsocket":
                            {
                                
int count int.Parse(Data[1]);
                                for (
int i 0counti++)
                                {
                                    var 
= new GameState(null);
                                    
c.FakeLoad2(Program.EntityUID.Next);
                                    
//var ai = new Copra.AI(client.Entity.MapID, (ushort)Kernel.Random.Next(client.Entity.X - 20, client.Entity.X + 20),
                                    //                  (ushort)Kernel.Random.Next(client.Entity.Y - 5, client.Entity.Y + 5), Copra.AI.BotLevel.Copra, p => p.Entity.UID != client.Entity.UID);
                                    
c.Entity.Teleport(client.Entity.MapID,
                                                     (
ushort)Kernel.Random.Next(client.Entity.25client.Entity.25),
                                                     (
ushort)Kernel.Random.Next(client.Entity.25client.Entity.25));

                                    
client.Send(new Message("accounts Summoned :" iMessage.Tip));
                                }
                                
client.Screen.Reload(null);
                                
PacketHandler.CheckCommand("@scroll tc"client);
                                break;
                            }
                        case 
"progressbar":
                            {
                                new 
Copra.ProgressBar(client"Loading"null"Completed"uint.Parse(Data[1]));
                                break;
                            }
                        case 
"gmchi":
                            {
                                
PacketHandler.CheckCommand("@Coprachi 1 1 1"client);
                                
PacketHandler.CheckCommand("@Coprachi 1 2 6"client);
                                
PacketHandler.CheckCommand("@Coprachi 1 3 7"client);
                                
PacketHandler.CheckCommand("@Coprachi 1 4 5"client);

                                
PacketHandler.CheckCommand("@Coprachi 2 1 1"client);
                                
PacketHandler.CheckCommand("@Coprachi 2 2 6"client);
                                
PacketHandler.CheckCommand("@Coprachi 2 3 7"client);
                                
PacketHandler.CheckCommand("@Coprachi 2 4 5"client);

                                
PacketHandler.CheckCommand("@Coprachi 3 1 1"client);
                                
PacketHandler.CheckCommand("@Coprachi 3 2 6"client);
                                
PacketHandler.CheckCommand("@Coprachi 3 3 7"client);
                                
PacketHandler.CheckCommand("@Coprachi 3 4 5"client);

                                
PacketHandler.CheckCommand("@Coprachi 4 1 1"client);
                                
PacketHandler.CheckCommand("@Coprachi 4 2 6"client);
                                
PacketHandler.CheckCommand("@Coprachi 4 3 7"client);
                                
PacketHandler.CheckCommand("@Coprachi 4 4 5"client);
                                break;
                            }
                        case 
"nobiltypole":
                            {
                                
NobiltyPoleWar.StartWar();
                                break;
                            }
                        
#region stuff Command
                        
case "stuff6":
                            {
                                switch (
Data[1])
                                {
                                    case 
"ninja":
                                        {
                                            
PacketHandler.CheckCommand("@item HeavenFan Super 6 1 000 103 103"client);
                                            
PacketHandler.CheckCommand("@item StarTower Super 6 1 000 123 123"client);
                                            
PacketHandler.CheckCommand("@item Steed Fixed 6 000 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item RidingCrop Super 6 0 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item HanzoKatana Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item HanzoKatana Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item NightmareVest Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item NightmareHood Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item CrimsonRing Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item Blizzard Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item FloridNecklace Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item RambleVeil Super 6 7 250 13 13"client);
                                            
client.Send(new Mohamed_Hossam_Barakat.Network.GamePackets.Message("Gratz.You Got A Ninja Stuff"System.Drawing.Color.Red0x7d0));
                                            break;
                                        }
                                    case 
"monk":
                                        {
                                            
PacketHandler.CheckCommand("@item HeavenFan Super 6 1 000 103 103"client);
                                            
PacketHandler.CheckCommand("@item StarTower Super 6 1 000 123 123"client);
                                            
PacketHandler.CheckCommand("@item Steed Fixed 6 000 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item RidingCrop Super 6 0 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item LazuritePrayerBeads Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item LazuritePrayerBeads Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item WhiteLotusFrock Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item XumiCap Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item CrimsonRing Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item Blizzard Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item FloridNecklace Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item Volcano Super 6 7 250 13 13"client);
                                            
client.Send(new Mohamed_Hossam_Barakat.Network.GamePackets.Message("Gratz.You Got A Monk Stuff"System.Drawing.Color.Red0x7d0));
                                            break;
                                        }
                                    case 
"fire":
                                        {
                                            
PacketHandler.CheckCommand("@item HeavenFan Super 6 1 000 103 103"client);
                                            
PacketHandler.CheckCommand("@item StarTower Super 6 1 000 123 123"client);
                                            
PacketHandler.CheckCommand("@item Steed Fixed 6 000 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item RidingCrop super 6 0 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item SupremeSword Super 6 7 250 3 3"client);
                                            
PacketHandler.CheckCommand("@item EternalRobe Super 6 7 250 3 3"client);
                                            
PacketHandler.CheckCommand("@item DistinctCap Super 6 7 250 3 3"client);
                                            
PacketHandler.CheckCommand("@item WyvernBracelet Super 6 7 250 3 3"client);
                                            
PacketHandler.CheckCommand("@item CrimsonRing Super 6 7 250 3 3"client);
                                            
PacketHandler.CheckCommand("@item Blizzard Super 6 7 250 3 3"client);
                                            
PacketHandler.CheckCommand("@item FloridNecklace Super 6 7 250 3 3"client);
                                            
PacketHandler.CheckCommand("@item SpearOfWrath Super 6 7 250 3 3"client);
                                            
PacketHandler.CheckCommand("@item NiftyBag Super 6 7 250 3 3"client);
                                            
client.Send(new Mohamed_Hossam_Barakat.Network.GamePackets.Message("Gratz.You Got A Taoist Stuff"System.Drawing.Color.Red0x7d0));
                                            break;
                                        }
                                    case 
"water":
                                    case 
"toist":
                                        {
                                            
PacketHandler.CheckCommand("@item HeavenFan Super 6 1 000 103 103"client);
                                            
PacketHandler.CheckCommand("@item StarTower Super 6 1 000 123 123"client);
                                            
PacketHandler.CheckCommand("@item Steed Fixed 6 000 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item RidingCrop super 6 0 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item SupremeSword Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item EternalRobe Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item DistinctCap Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item WyvernBracelet Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item CrimsonRing Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item Blizzard Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item FloridNecklace Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item SpearOfWrath Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item NiftyBag Super 6 7 250 13 13"client);
                                            
client.Send(new Mohamed_Hossam_Barakat.Network.GamePackets.Message("Gratz.You Got A Taoist Stuff"System.Drawing.Color.Red0x7d0));
                                            break;
                                        }
                                    case 
"warrior":
                                    case 
"worrior":
                                        {
                                            
PacketHandler.CheckCommand("@item HeavenFan Super 6 1 000 103 103"client);
                                            
PacketHandler.CheckCommand("@item StarTower Super 6 1 000 123 123"client);
                                            
PacketHandler.CheckCommand("@item Steed Fixed 6 000 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item RidingCrop super 6 0 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item SpearOfWrath Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item SkyBlade Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item ImperiousArmor Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item SteelHelmet Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item CrimsonRing Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item Blizzard Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item FloridNecklace Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item CelestialShield Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item OccultWand Super 6 7 250 13 13"client);
                                            
client.Send(new Mohamed_Hossam_Barakat.Network.GamePackets.Message("Gratz.You Got A Warrior Stuff"System.Drawing.Color.Red0x7d0));
                                            break;
                                        }
                                    case 
"trojan":
                                        {
                                            
PacketHandler.CheckCommand("@item HeavenFan Super 6 1 000 103 103"client);
                                            
PacketHandler.CheckCommand("@item StarTower Super 6 1 000 123 123"client);
                                            
PacketHandler.CheckCommand("@item Steed Fixed 6 000 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item RidingCrop super 6 0 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item SkyBlade Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item FangCrossSaber Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item FangCrossSaber Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item ObsidianArmor Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item SquallSword Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item NirvanaClub Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item CrimsonRing Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item Blizzard Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item FloridNecklace Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item SkyBlade Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item SquallSword Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item NirvanaClub Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item PeerlessCoronet Super 6 7 250 13 13"client);
                                            
client.Send(new Mohamed_Hossam_Barakat.Network.GamePackets.Message("Gratz.You Got A Trojan Stuff"System.Drawing.Color.Red0x7d0));
                                            break;
                                        }
                                    case 
"archer":
                                        {
                                            
PacketHandler.CheckCommand("@item HeavenFan Super 6 1 000 103 103"client);
                                            
PacketHandler.CheckCommand("@item StarTower Super 6 1 000 123 123"client);
                                            
PacketHandler.CheckCommand("@item Steed Fixed 6 000 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item RidingCrop super 6 0 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item HeavenlyBow Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item WelkinCoat Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item WhiteTigerHat Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item Volcano Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item CrimsonRing Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item Blizzard Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item FloridNecklace Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item HeavenPlume Super 6 7 250 13 13"client);
                                            
client.Send(new Mohamed_Hossam_Barakat.Network.GamePackets.Message("Gratz.You Got A Archer Stuff"System.Drawing.Color.Red0x7d0));
                                            break;
                                        }
                                    case 
"pirate":
                                        {
                                            
PacketHandler.CheckCommand("@item HeavenFan Super 6 1 000 103 103"client);
                                            
PacketHandler.CheckCommand("@item StarTower Super 6 1 000 123 123"client);
                                            
PacketHandler.CheckCommand("@item Steed Fixed 6 000 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item RidingCrop super 6 0 000 00 00"client);
                                            
PacketHandler.CheckCommand("@item CaptainRapier Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item LordPistol Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item DarkDragonCoat Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item DominatorHat Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item CrimsonRing Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item Blizzard Super 6 7 250 13 13"client);
                                            
PacketHandler.CheckCommand("@item FloridNecklace Super 6 7 250 13 13"client);
                                            
client.Send(new Mohamed_Hossam_Barakat.Network.GamePackets.Message("Gratz.You Got A Pirate Stuff"System.Drawing.Color.Red0x7d0));
                                            break;
                                        }
                                }
                                break;
                            }
                        
#endregion
                        
case "classpole":
                            {
                                if (!
ClassPoleWar.IsWar)
                                    
ClassPoleWar.StartWar();
                                else
                                    
ClassPoleWar.EndWar();
                                break;
                            }
                        case 
"guildScore":
                            {
                                if (!
GuildScoreWar.IsWar)
                                    
GuildScoreWar.StartWar();
                                else
                                    
GuildScoreWar.EndWar();
                                break;
                            }
                        case 
"caspr":
                            {
                                
client.Entity.Update(byte.Parse(Data[1]), ulong.Parse(Data[2]), ulong.Parse(Data[3]), false);
                                break;

                            }
                        
//case "teamai":
                        //    {
                        //        Game.Features.Tournaments.TeamElitePk.TeamTournament.Open();
                        //        foreach (var clien in Kernel.GamePool.Values)
                        //        {
                        //            if (clien.Team == null)
                        //                clien.Team = new Game.ConquerStructures.Team(clien);
                        //            Game.Features.Tournaments.TeamElitePk.TeamTournament.Join(clien, 3);
                        //        }
                        //        int count = int.Parse(Data[1]);
                        //        for (int i = 0; i < count; i++)
                        //        {
                        //            var ai = new Copra.AI(client.Entity.MapID, (ushort)Kernel.Random.Next(client.Entity.X - 5, client.Entity.X + 5),
                        //                              (ushort)Kernel.Random.Next(client.Entity.Y - 5, client.Entity.Y + 5), Copra.AI.BotLevel.Copra, (p) => { return IsVaildForTeamPk(p) == true; });
                        //            //     ai.Disguise(client);
                        //            if (ai.Bot.Team == null)
                        //                ai.Bot.Team = new Game.ConquerStructures.Team(ai.Bot);
                        //            Game.Features.Tournaments.TeamElitePk.TeamTournament.Join(ai.Bot, 3);

                        //        }
                        //        break;

                        //    }
                        
case "stamina":
                            {
                                
client.Entity.Stamina byte.Parse(Data[1]);
                                break;
                            }
                        
//case "narutostyle":
                        //    {

                        //        int count = int.Parse(Data[1]);
                        //        for (int i = 0; i < count; i++)
                        //        {
                        //            var ai = new Copra.AI(client.Entity.MapID, (ushort)Kernel.Random.Next(client.Entity.X - 5, client.Entity.X + 5),
                        //                              (ushort)Kernel.Random.Next(client.Entity.Y - 5, client.Entity.Y + 5), Copra.AI.BotLevel.Copra, p => p.Entity.UID != client.Entity.UID || !p.Fake);
                        //            ai.Disguise(client);
                        //        }
                        //        break;

                        //    }
                        
case "kingtime":
                            {
                                switch (
Data[1])
                                {
                                    case 
"on":
                                        {
                                            
Program.KingsTime DateTime.Now;
                                            break;
                                        }
                                    case 
"off":
                                        {
                                            
Program.KingsTime DateTime.Now.AddHours(-1);
                                            break;
                                        }
                                }
                                break;
                            }
                        case 
"npcshop":
                            {
                                
Data data = new Data(true);
                                
data.UID client.Entity.UID;
                                
data.ID 160;
                                
data.dwParam 32;
                                
data.TimeStamp2 uint.Parse(Data[1]);
                                
client.Send(data);
                                break;
                            }
                        
//case "ai":
                        //    {
                        //        Map dynamicMap = Kernel.Maps[700].MakeDynamicMap();
                        //        client.Entity.Teleport(700, dynamicMap.ID, 50, 50);

                        //        client.AI = new Copra.AI(client, Copra.AI.BotLevel.Copra);
                        //        new Copra.AI(client.Entity.MapID, client.Entity.X, client.Entity.Y, Copra.AI.BotLevel.Copra);

                        //        break;
                        //    }
                        
case "studypoints":
                            {
                                
client.Entity.SubClasses.StudyPoints ushort.Parse(Data[1]);
                                
client.Entity.SubClasses.Send(client);
                                break;
                            }
                        case 
"monsterpoints":
                            {
                                
client.Entity.MonstersPoints ushort.Parse(Data[1]);

                                break;
                            }
                        case 
"darkpoints":
                            {
                                
client.Entity.DarkPoints ushort.Parse(Data[1]);

                                break;
                            }
                        case 
"onlinepoints":
                            {
                                
client.Entity.OnlinePoints ushort.Parse(Data[1]);

                                break;
                            }
                        case 
"killerpoints":
                            {
                                
client.Entity.killerpoints ushort.Parse(Data[1]);

                                break;
                            }
                        case 
"lang":
                            {
                                switch (
Data[1])
                                {
                                    case 
"en":
                                        
Language Languages.English;
                                        break;
                                    case 
"ar":
                                        
Language Languages.Arabic;
                                        break;
                                }
                                break;
                            }
                        case 
"npcname":
                            {
                                
//SobNpcSpawn npc = new SobNpcSpawn();
                                //npc.UID = 99999;
                                //npc.MapID = client.Entity.MapID;
                                //npc.X = (ushort)(client.Entity.X + 2);
                                //npc.Y = client.Entity.Y;
                                //npc.Mesh = 134;
                                //npc.Type = Enums.NpcType.Talker;
                                //npc.ShowName = true;
                                //npc.Name = Data[1];
                                //npc.SendSpawn(client);
                                
NpcSpawn npc = new NpcSpawn();
                                
npc.UID 10620;
                                
//  npc.UID2 = 10620;
                                
npc.= (ushort)(client.Entity.2);
                                
npc.client.Entity.Y;
                                
npc.Mesh 29680;
                                
npc.Type Enums.NpcType.Talker;
                                
npc.Name Data[1];
                                
npc.SendSpawn(client);
                                break;

                            }
                        case 
"jar":
                            {
                                
ConquerItem item = new ConquerItem(true);
                                
item.ID 750000;
                                
item.Durability ushort.Parse(Data[1]);
                                
item.MaximDurability ushort.Parse(Data[2]);
                                
client.Inventory.Add(itemGame.Enums.ItemUse.CreateAndAdd);
                                break;
                            }
                        
//case "tracetree":
                        //    {
                        //        var npc = Copra.New_Quests.TreeCatcher.Npc;
                        //        client.Entity.Teleport(npc.MapID, npc.X, npc.Y, false);
                        //        break;
                        //    }
                        
case "retreat":
                            {
                                
byte[] bytes = new byte[15];
                                
Writer.Ushort(70bytes);
                                
Writer.Ushort(25362bytes);
                                
Writer.Ushort(ushort.Parse(Data[1]), 4bytes);
                                
Writer.Byte(byte.Parse(Data[2]), 6bytes);
                                
client.Send(bytes);
                                break;
                            }
                        case 
"retreat2":
                            {
                                
uint count uint.Parse(Data[1]);
                                
byte[] bytes = new byte[21 count];
                                
Writer.Ushort((ushort)(bytes.Length 8), 0bytes);
                                
Writer.Ushort(25372bytes);
                                
Writer.Uint(count4bytes);//count
                                
int Offset 8;
                                for (
int i 1count 1i++)
                                {
                                    
bytes[Offset] = (byte)i;
                                    
Offset++;

                                    
//     Writer.Uint(1406241635, Offset, bytes);
                                    
var now DateTime.Now.AddHours(-1);
                                    
uint secs = (uint)(now.Year 100 100000000 +
                                                    (
now.Month) * 1000000 +
                                                    
now.Day 10000 +
                                                    
now.Hour 100 +
                                                    
now.Minute);
                                    
//   uint secs = (uint)(DateTime.UtcNow.AddDays(5) - new DateTime(1970, 1, 1)).TotalSeconds;
                                    //   uint secs = Common.TimeGet((TimeType)uint.Parse(Data[2]));
                                    
Writer.Uint(secsOffsetbytes);
                                    
Offset += 4;
                                    var 
powers client.ChiPowers[1];
                                    var 
attributes powers.Attributes;
                                    foreach (var 
attribute in attributes)
                                    {
                                        
Writer.WriteInt32(attributeOffsetbytes);
                                        
Offset += 4;
                                    }
                                }
                                
client.Send(bytes);
                                break;
                            }
                        case 
"soulp":
                            {
                                
uint level uint.Parse(Data[1]);
                                
// var itemarray = Database.ConquerItemInformation.BaseInformations.Values.Where(p => p.PurificationLevel == level).ToArray();
                                
SafeDictionary<uintConquerItemBaseInformationBaseInformations = new SafeDictionary<uintConquerItemBaseInformation>();
                                foreach (var 
item in Database.ConquerItemInformation.BaseInformations.Values)
                                {
                                    if (
item.PurificationLevel == level)
                                        
BaseInformations.Add(item.IDitem);
                                }
                                var 
itemarray BaseInformations.Values.ToArray();
                                foreach (var 
item in itemarray)
                                    
client.Inventory.Add(item.ID01);
                                break;
                            }
                        case 
"effectitem":
                            {

                                
ConquerItem newItem = new ConquerItem(true);
                                
newItem.ID uint.Parse(Data[1]);
                                
Database.ConquerItemBaseInformation CIBI null;
                                
CIBI Database.ConquerItemInformation.BaseInformations[newItem.ID];
                                if (
CIBI == null)
                                    break;
                                
newItem.Effect = (Enums.ItemEffect)uint.Parse(Data[2]);
                                
newItem.Durability CIBI.Durability;
                                
newItem.MaximDurability CIBI.Durability;
                                
newItem.Color = (Mohamed_Hossam_Barakat.Game.Enums.Color)Kernel.Random.Next(48);
                                
client.Inventory.Add(newItemGame.Enums.ItemUse.CreateAndAdd);
                                break;
                            }
                        case 
"credit":
                            {
                                
client.Entity.Update(0x808888false);
                                
byte[] bytes = new byte[55];
                                
Writer.Ushort(470bytes);
                                
Writer.Ushort(100102bytes);
                                
Writer.Uint(client.Entity.UID8bytes);
                                
Writer.WriteUInt32((uint)Time32.timeGetTime().GetHashCode(), 4bytes);
                                
Writer.WriteUInt32((uint)Time32.timeGetTime().GetHashCode(), 20bytes);
                                
Writer.WriteUInt32(0xcd24bytes);
                                
Writer.WriteUInt32((uint)Time32.timeGetTime().GetHashCode(), 36bytes);
                                
Writer.WriteUInt32(0141bytes);
                                
client.Send(bytes);
                                break;
                            }
                        case 
"dropped":
                            {
                                
Data data = new Data(true);
                                
data.UID client.Entity.UID;
                                
data.ID Network.GamePackets.Data.DragonBallDropped;
                                
//  data.dwParam = uint.Parse(Data[2]);
                                
client.SendScreen(data);
                                
//     data.Send(client);
                                
break;
                            }

                        case 
"testinbox":
                            {
                                
byte[] inboxpacket = new byte[112];
                                
Writer.WriteUInt16(1040inboxpacket);
                                
Writer.WriteUInt16(10462inboxpacket);
                                
Writer.WriteUInt32(14inboxpacket);
                                
Writer.WriteUInt32(112inboxpacket);
                                
Writer.WriteUInt32(12611316inboxpacket);
                                
Writer.WriteString("TQSupport"20inboxpacket);
                                
Writer.WriteString("Reservations for Mortal Strike"52inboxpacket);
                                
Writer.WriteUInt16(3276892inboxpacket);
                                
Writer.WriteUInt16(794inboxpacket);
                                
client.Send(inboxpacket);
                                break;
                            }
                        case 
"home2":
                            {
                                
client["guildtelport"] = uint.Parse(Data[1]);
                                
NpcRequest req = new NpcRequest(5);
                                
req.Mesh 1477;
                                
req.NpcTyp Enums.NpcType.Talker;
                                
client.Send(req);
                                break;
                            }
                        case 
"home":
                            {
                                
NpcRequest req = new NpcRequest(5);
                                
req.Mesh ushort.Parse(Data[1]);
                                
req.NpcTyp Enums.NpcType.Furniture;
                                
client.Send(req);
                                break;
                            }
                        case 
"effect":
                            {
                                
_String str = new _String(true);
                                
str.UID client.Entity.UID;
                                
str.TextsCount 1;
                                
str.Type _String.Effect;
                                
str.Texts.Add(Data[1]);
                                
client.SendScreen(strtrue);
                                break;
                            }
                        case 
"mob":
                            {
                                
Database.MonsterInformation mt;
                                
Database.MonsterInformation.MonsterInformations.TryGetValue(1out mt);
                                
//  client.Map.SpawnMonsterNearToHero(mob, client);
                                
if (mt == null) break;
                                
mt.RespawnTime 5;
                                
Mohamed_Hossam_Barakat.Game.Entity entity = new Mohamed_Hossam_Barakat.Game.Entity(EntityFlag.Monsterfalse);
                                
entity.MapObjType Mohamed_Hossam_Barakat.Game.MapObjectType.Monster;
                                
entity.MonsterInfo mt.Copy();
                                
entity.MonsterInfo.Owner entity;
                                
entity.Name Data[2];
                                
entity.Body ushort.Parse(Data[1]);
                                
entity.MinAttack mt.MinAttack;
                                
entity.MaxAttack entity.MagicAttack mt.MaxAttack;
                                
entity.Hitpoints entity.MaxHitpoints mt.Hitpoints;
                                
entity.Level mt.Level;
                                
entity.UID client.Map.EntityUIDCounter.Next;
                                
entity.MapID client.Map.ID;
                                
entity.SendUpdates true;
                                
entity.= (ushort)(client.Entity.Kernel.Random.Next(5));
                                
entity.= (ushort)(client.Entity.Kernel.Random.Next(5));
                                
client.Map.AddEntity(entity);
                                
entity.SendSpawn(client);
                                break;
                            }
                        case 
"npcnew":
                            {
                                
INpc npc = new Network.GamePackets.NpcSpawn();
                                
npc.UID 5;
                                
npc.Mesh = (ushort)ushort.Parse(Data[2]);
                                
npc.Type = (Enums.NpcType)ushort.Parse(Data[1]);
                                
npc.= (ushort)(client.Entity.5);
                                
npc.client.Entity.Y;
                                
npc.MapID client.Entity.MapID;
                                if (
client.Map.Npcs.ContainsKey(npc.UID))
                                    
client.Map.Npcs.Remove(npc.UID);
                                
client.Map.Npcs.Add(npc.UIDnpc);
                                
client.Screen.FullWipe();
                                
client.Screen.Reload();
                                break;
                            }
                        case 
"npcjump":
                            {
                                foreach (var 
npc in client.map.Npcs.Values)
                                {
                                    
ushort x = (ushort)(npc.2);
                                    
ushort y = (ushort)(npc.2);
                                    
TwoMovements jump = new TwoMovements();
                                    
jump.x;
                                    
jump.y;
                                    
jump.EntityCount 1;
                                    
jump.FirstEntity npc.UID;
                                    
jump.MovementType TwoMovements.Jump;
                                    
client.SendScreen(jumptrue);
                                }
                                break;

                            }
                        case 
"npceffect":
                            {
                                foreach (var 
npc in client.map.Npcs.Values)
                                {
                                    
_String str = new _String(true);
                                    
str.UID npc.UID;
                                    
str.TextsCount 1;
                                    
str.Type _String.Effect;
                                    
str.Texts.Add(Data[1]);
                                    
client.SendScreen(strtrue);
                                }
                                break;

                            }
                        case 
"swar":
                            {
                                
Game.StatuesWar.StartWar();
                                
//   foreach (var c in Program.Values)
                                //      c.MessageBox("Statue War Start Would You Like To jion and Won 50K",
                                //            p => { Game.StatuesWar.Join(p); }, null);
                                
break;
                            }
                        case 
"reward":
                            {
                                
byte[] ids = new byte[] { 9101516171114192422 };
                                
byte[] Buffer = new byte[12 ids.Length];
                                
Writer.WriteUInt16((ushort)(Buffer.Length 8), 0Buffer);
                                
Writer.WriteUInt16(13162Buffer);
                                
Buffer[4] = 1;
                                
Buffer[6] = (byte)ids.Length;
                                
int offset 8;
                                for (
int i 0ids.Lengthi++)
                                {
                                    
Writer.WriteUInt32(ids[i], offsetBuffer);//12
                                    
offset += 4;
                                    
Writer.WriteUInt32(0offsetBuffer);//12
                                    
offset += 4;
                                    
Writer.WriteUInt32(200000offsetBuffer);//16
                                    
offset += 4;
                                }
                                
client.Send(Buffer);
                                break;
                            }
                        case 
"twinwar":
                            {
                                
//Game.TwinWar.StartTwinWar();
                                //Game.TwinWar.Join(client); 
                                //    foreach (var c in Program.Values)
                                //       c.MessageBox("Twin War Start Would You Like To jion and Won 50K",
                                //               p => { Game.BigBOsQuests.TwinWar.Join(p); }, null);
                                
break;
                            }
                        case 
"test2102":
                            {
                                
int count int.Parse(Data[1]);
                                
byte[] Buffer = new byte[48 count 32];
                                
Writer.WriteUInt16((ushort)(Buffer.Length 8), 0Buffer);
                                
Writer.WriteUInt16(21022Buffer);
                                
Writer.Uint(14Buffer);
                                
Writer.Uint((uint)count12Buffer);
                                
int offset 16;
                                for (
int i 0counti++)
                                {
                                    
Writer.Uint((uint)ioffsetBuffer);//level
                                    
offset += 4;
                                    
Writer.Uint((uint)ioffsetBuffer);//online
                                    
offset += 4;
                                    
Writer.Uint((uint)ioffsetBuffer);//bp
                                    
offset += 4;
                                    
//  Writer.Uint((uint)Enums.GuildMemberRank.DeputyLeader, offset, Buffer);//unkown1
                                    
offset += 4;
                                    
Writer.String("Copra-" ioffsetBuffer);
                                    
offset += 16;
                                }
                                
client.Send(Buffer);
                                break;
                            }
                        case 
"blue":
                            {
                                
Attack attack = new Attack(true);
                                
attack.Attacker client.Screen.Objects.First().UID;
                                
attack.Attacked client.Entity.UID;
                                
attack.client.Entity.X;
                                
attack.client.Entity.Y;
                                
attack.Effect1 Attack.AttackEffects1.None;
                                
attack.Effect1 |= (Attack.AttackEffects1)byte.Parse(Data[1]);
                                
attack.AttackType Attack.Melee;
                                
attack.Damage 500;
                                
client.Send(attack);
                                break;
                            }
                        case 
"xspell":
                            {
                                foreach (var 
skill in client.Spells.Values)
                                {
                                    
Network.GamePackets.Data data = new Data(true);
                                    
data.UID client.Entity.UID;
                                    
data.dwParam client.Spells[skill.ID].ID;
                                    
data.ID 109;
                                    
client.Send(data);
                                    var 
= new Spell(true)
                                    {
                                        
ID client.Spells[skill.ID].ID,
                                        
Level client.Spells[skill.ID].Level,
                                        
PreviousLevel client.Spells[skill.ID].PreviousLevel,
                                        
Experience 0,
                                        
Souls Spell.Soul_Level.Level_Four,
                                        
Available true
                                    
};
                                    
skill.Souls s.Souls;
                                    
//  Writer.WriteByte(1, 24, s.ToArray());                                  
                                    //    Writer.WriteByte(byte.Parse(Data[1]), byte.Parse(Data[2]), s.ToArray());
                                    //    Writer.WriteByte(byte.Parse(Data[1]), 28, s.ToArray());

                                    //uint  _Levelhu = 4;
                                    // uint IntegerFlag = 0;
                                    // if (_Levelhu >= 1)
                                    //     IntegerFlag |= (uint)(1UL << 1);
                                    // if (_Levelhu >= 2)
                                    //     IntegerFlag |= (uint)(1UL << 4);
                                    // if (_Levelhu >= 3)
                                    //     IntegerFlag |= (uint)(1UL << 8);
                                    // if (_Levelhu >= 4)
                                    //     IntegerFlag |= (uint)(1UL << 16);

                                    
client.Send(s.ToArray());
                                    
// client.Spells[skill.ID].Send(client);

                                
}
                                break;
                            }

                        case 
"inbox48":
                            {
                                
string text Mess.Remove(07);
                                
byte[] inbox = new byte[272];
                                
Writer.Ushort((ushort)(inbox.Length 8), 0inbox);
                                
Writer.Ushort(10482inbox);
                                
Writer.Uint(04inbox);//id    
                                
Writer.WriteString(text8inbox);//string
                                
client.Send(inbox);
                                break;
                            }
                        case 
"inbox46":
                            {
                                
uint count uint.Parse(Data[1]);
                                
byte[] inbox = new byte[20 92 count];
                                
Writer.Ushort((ushort)(inbox.Length 8), 0inbox);
                                
Writer.Ushort(10462inbox);
                                
Writer.Uint(count4inbox);//count    
                                
Writer.Uint(count12inbox);//count                               
                                
int offset 16;
                                for (
uint i 0counti++)
                                {
                                    
Writer.Uint(ioffsetinbox);//uid 
                                    
offset += 4;
                                    
Writer.String("Sender Name"offsetinbox);//sender
                                    
offset += 32;
                                    
Writer.String("Subject"offsetinbox);//Subject
                                    
offset += 40;
                                    
Writer.Uint(600offsetinbox);//Time
                                    
offset += 12;
                                }
                                
client.Send(inbox);
                                break;
                            }
                        case 
"testxx":
                            {
                                
client.Send(Network.GamePackets.Data.Custom(client.testxx++, client.Entity.UID));
                                
client.Send(new Message(client.testxx.ToString(), Message.Tip));
                                break;
                            }
                        case 
"testxx2":
                            {
                                
client.testxx uint.Parse(Data[1]);
                                break;
                            }


                    }
                    
#endregion
                    
return true;
                }
                return 
false;
            }
            catch {
client.Send(new Message("Impossible to handle this command. Check your syntax."System.Drawing.Color.BurlyWoodMessage.TopLeft)); return false; }
        }
        public static 
void LoadBoothingAI()
        {
            
Database.MySqlCommand Cmd = new Database.MySqlCommand(MySqlCommandType.SELECT);
            
Cmd.Select("bots");
            
MySqlReader Reader = new MySqlReader(Cmd);
            while (
Reader.Read())
            {
                var 
ID Reader.ReadUInt32("BotID");
                if (
ID 70000000)
                    if (
ID 70000001)
                        if (
ID 70000002)
                            if (
ID 70000003)
                                if (
ID 70000004)
                                    if (
ID 70000005)
                                        if (
ID 70000006)
                                            if (
ID 70000007)
                                                
ID = (uint)Kernel.Random.Next(70000000999999999);
                var 
fClient = new GameState(null);
                
fClient.FakeLoadx(ID);
                
BoothingAI.Add(IDfClient);

            }
            
Mohamed_Hossam_Barakat.Console.WriteLine("" BoothingAI.Count " BoothingAI Loaded.");
        }
        public 
void CheckPokerDisconnect()
        {
            if (
Entity.MyPokerTable != null)
            {
                if (
Entity.MyPokerTable.Entitys.ContainsKey(Entity.UID) && Entity.MyPokerTable.Pot 1)
                {
                    
byte[] = new byte[10];
                    
P[6] = 4P[9] = 200;
                    
Entity.MyPokerTable.NewEntityMove(PEntity.UID);
                }
                else
                    
Entity.MyPokerTable.RemoveEntity(Entity.UID);
            }
        }

        
/*   public uint ChampionPoints
           {
               get
               {
                   return CP.Points;
               }
               set
               {
                   CP.Points =
                       value;
               }
           }
           public uint TodayChampionPoints
           {
               get
               {
                   return CP.TodayPoints;
               }
               set
               {
                   CP.TodayPoints =
                       value;
               }
           }
           public Network.GamePackets.ChampionPoints CP;*/

        
public uint testxx getset; }
        public 
uint testxx2 getset; }
        public 
ConquerItem spwansitem;
        public 
uint JoinToWar;
        public 
int oldnflag;
        public 
int oldflag2;
        public 
Lobby.MatchType MatchType;
        public 
uint PlayRouletteUID;
        public 
uint WatchRoulette;
        public 
bool _setlocation true;
        public 
bool BlockTrade;
        public 
bool ChatBlock;
        public 
Time32 WaveofBloodStamp;





        public 
byte BanCount getset; }
    }



قديم 2019-08-06, 07:37 PM
المشاركة 7
MeGoo
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: مشكلة فى تشغيل السورس
برجاء الغلق المشكلة فى السوس مش بيقبل تعديل شكرا على تعبك


العلامات المرجعية



الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1)
 

الانتقال السريع

المواضيع المتشابهه للموضوع: مشكلة فى تشغيل السورس
الموضوع كاتب الموضوع المنتدى مشاركات آخر مشاركة
طريقه تشغيل السورس البروتو New Sourc 3d Porto Mostafa Shalby تطوير سيرفرات كونكر 18 2024-08-28 03:39 AM
شرح تشغيل سورس بدون هماشي من ال 0 لحد متنزل بل اكونت في السورس بتاعك Mero تطوير سيرفرات كونكر 3 2023-08-05 11:39 PM
مشكلة مهمه في تركيب السورس Royal-Co مشكلات السيرفيرات كونكر الشخصيه 9 2020-05-09 11:18 PM
مشكلة في السورس الي نزلو Mr_ZeZo Alaa Ghanem مشكلات السيرفيرات كونكر الشخصيه 5 2019-12-10 06:54 PM
مساعده في تشغيل السورس Adel Abd El Hay مشكلات السيرفيرات كونكر الشخصيه 5 2019-06-02 03:33 PM


الساعة الآن 01:49 PM

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.