قديم 2019-10-04, 08:13 PM
المشاركة 2
ابو مروان
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: لو سمحتو حل للمشكلتين دول وياريت نزول حلهم فى قسم التطوير
ايه يا رجاله ؟؟؟؟؟؟؟؟؟!!!!!!!

قديم 2019-10-05, 11:47 AM
المشاركة 3
ابو مروان
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: لو سمحتو حل للمشكلتين دول وياريت نزول حلهم فى قسم التطوير
رايدر ممكن حل ؟

قديم 2019-10-05, 03:10 PM
المشاركة 4
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: لو سمحتو حل للمشكلتين دول وياريت نزول حلهم فى قسم التطوير
للاسف جهاز عندي بايظ ابعت ملف perfection.cs و هحاول ابصلك عليه

قديم 2019-10-05, 10:51 PM
المشاركة 5
ابو مروان
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: لو سمحتو حل للمشكلتين دول وياريت نزول حلهم فى قسم التطوير
للاسف جهاز عندي بايظ ابعت ملف perfection.cs و هحاول ابصلك عليه

كود:
using ProtoBuf;
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Collections.Concurrent;
using System.Text;
using AboMarwan;
using AboMarwan.Database;
using System.Threading.Tasks;
using AboMarwan.Game;

namespace 
AboMarwan.Network.GamePackets
{
    public class 
MsgUserAbilityScore //برفكشن
    
{
        public 
MsgUserAbilityScore() { }
        public 
MsgUserAbilityScoreProto Info;
        [
ProtoContract]
        public class 
MsgUserAbilityScoreProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint UID;
            [
ProtoMember(3IsRequired true)]
            public 
uint Level;
            [
ProtoMember(4IsRequired true)]
            public 
Scores[] Scores;
        }
        [
ProtoContract]
        public class 
Scores
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint Type;
            [
ProtoMember(2IsRequired true)]
            public 
uint Score;
        }
        public static 
ConcurrentDictionary<uintGame.EntityRankingList;
        public 
void GetRankingList()
        {
            
RankingList = new ConcurrentDictionary<uintGame.Entity>();
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("entities"))
            
using (var reader = new MySqlReader(cmd))
            {
                while (
reader.Read())
                {
                    if (
reader.ReadUInt32("TotalPerfectionScore") < 20000) continue;
                    
Game.Entity client = new Game.Entity(Game.EntityFlag.Entityfalse);
                    
client.Name reader.ReadString("Name");
                    
client.UID reader.ReadUInt32("UID");
                    
client.Level reader.ReadByte("Level");
                    
client.Class = reader.ReadByte("Class");
                    
client.Body reader.ReadUInt16("Body");
                    
client.Face reader.ReadUInt16("Face");
                    
client.TotalPerfectionScore reader.ReadUInt32("TotalPerfectionScore");
                    if (
reader.ReadString("Wardrobe") != "")
                    {
                        if (
reader.ReadString("Wardrobe").Contains("~"))
                        {
                            var 
wing reader.ReadString("Wardrobe").Split('~')[0];
                            
int type Convert.ToInt32(wing.Split('-')[0]);
                            
int id Convert.ToInt32(wing.Split('-')[1]);
                            
client.EquippedWing StorageManager.Wing<int>(typeid);
                            var 
title reader.ReadString("Wardrobe").Split('~')[1];
                            
int type2 Convert.ToInt32(title.Split('-')[0]);
                            
int id2 Convert.ToInt32(title.Split('-')[1]);
                            
client.EquippedTitle StorageManager.Title<int>(type2id2);
                        }
                    }
                    
RankingList.Add(client.UIDKernel.GamePool.ContainsKey(client.UID) ? Kernel.GamePool[client.UID].Entity client);
                }
            }
        }
        public 
bool Read(byte[] packet)
        {
            try
            {
                var 
mypkt = new byte[packet.Length 4];
                Array.
Copy(packet4mypkt0mypkt.Length);
                
using (var memoryStream = new MemoryStream(packet))
                {
                    
Info Serializer.DeserializeWithLengthPrefix<MsgUserAbilityScoreProto>(memoryStreamPrefixStyle.Fixed32);
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
                return 
false;
            }
            return 
true;
        }
        public 
void SendScore(Client.GameState clientClient.GameState Observer)
        {
            var 
packet = new MsgUserAbilityScoreProto();
            
packet.ActionId 0;
            
packet.UID client.Entity.UID;
            
packet.Level client.Entity.Level;
            
packet.Scores = new Scores[20];
            for (
int i 0packet.Scores.Lengthi++)
            {
                
byte Type = (byte)(1);
                
packet.Scores[i] = new Scores();
                
packet.Scores[i].Type Type;
                
packet.Scores[i].Score GetScoreValue(clientType);
            }


            var 
proto Kernel.FinalizeProtoBuf(packet3253);
            
Observer.Send(proto);
        }
        public 
uint GetScoreValue(Client.GameState clientuint Type)
        {
            
uint Score 0;
            if (
Type == 1Score = (uint)MsgUserAbilityScore.CalculatePerfectionJiangPoints(client);
            if (
Type == 2Score = (uint)MsgUserAbilityScore.CalculatePerfectionChiPoints(client);
            if (
Type == 3Score = (uint)(client.Entity.InnerPower != null client.Entity.InnerPower.TotalScore 0);
            if (
Type == 4Score client.Equipment.GetFullEquipmentEnchantPoints;
            if (
Type == 5Score = (uint)(client.Entity.Level 140 client.Entity.Level 20 client.Entity.Level 25);
            if (
Type == 6Score client.Equipment.GetFullEquipmentPerfecetionLevelPoints;
            if (
Type == 7Score = (uint)((client.Entity.Vitality client.Entity.Atributes client.Entity.Spirit client.Entity.Strength client.Entity.Agility) * 5);
            if (
Type == 8Score = (uint)(client.Entity.Reborn 1000);
            if (
Type == 9Score client.Equipment.GetFullEquipmentEnumPoints;
            if (
Type == 10Score client.Equipment.GetFullEquipmentSocketPoints;
            if (
Type == 11Score client.Equipment.GetFullEquipmentGemPoints;
            if (
Type == 12Score client.Equipment.GetFullEquipmentRefinePoints;
            if (
Type == 13Score client.Equipment.GetFullEquipmentPlusPoints;
            if (
Type == 14Score client.Equipment.GetFullEquipmentSoulPoints;
            if (
Type == 15Score client.Equipment.GetFullEquipmentBlessPoints;
            if (
Type == 16Score CalculateSubClassPoints(client);
            if (
Type == 17Score Database.WardrobeTable.PerfectionPoints(clienttrue);
            if (
Type == 18Score Database.WardrobeTable.PerfectionPoints(clientfalse);
            if (
Type == 19Score = (uint)((uint)client.Entity.NobilityRank 1000);
            if (
Type == 20Score client.Equipment.GetFullEquipmentLevelPoints;
            return 
Score;
        }
        public 
void Handle(Client.GameState client)
        {
            switch (
Info.ActionId)
            {
                case 
1://Observ
                    
{
                        if (
Kernel.GamePool.ContainsKey(Info.UID))
                        {
                            
SendScore(clientclient);
                            
SendScore(Kernel.GamePool[Info.UID], client);
                        }
                        else
                        {
                            
client.Send(Kernel.FinalizeProtoBuf(new MsgUserAbilityScoreProto()
                            {
                                
ActionId 1,
                                
UID 0
                            
}, 3253));
                        }
                        break;
                    }
            }
        }
        public static 
int CalculatePerfectionChiPoints(Client.GameState client)
        {
            if (
client == null || client.ChiData == null || client.ChiData.Powers == null)
                return 
0;

            
int Point 0;
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 1) break;
                
Point += ((client.ChiData.Powers[0].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[0].Attributes[i].Type)) * 100) * 60;
            }
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 2) break;
                
Point += ((client.ChiData.Powers[1].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[1].Attributes[i].Type)) * 100) * 60;
            }
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 3) break;
                
Point += ((client.ChiData.Powers[2].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[2].Attributes[i].Type)) * 100) * 60;
            }
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 4) break;
                
Point += ((client.ChiData.Powers[3].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[3].Attributes[i].Type)) * 100) * 60;
            }
            return 
Point;
        }
        public static 
int CalculatePerfectionJiangPoints(Client.GameState client)
        {
            
int Points 0;
            if (
client.Entity.MyJiang != null)
            {
                if (
client.Entity.MyJiang.Inner_Strength == 0) return Points;
                if (
client.Entity.MyJiang.Inner_Strength <= 16200Points = (int)(client.Entity.MyJiang.Inner_Strength 0.3);
                else if (
client.Entity.MyJiang.Inner_Strength <= 40500Points = (int)(client.Entity.MyJiang.Inner_Strength 0.33);
                else if (
client.Entity.MyJiang.Inner_Strength <= 60750Points = (int)(client.Entity.MyJiang.Inner_Strength 0.36);
                else if (
client.Entity.MyJiang.Inner_Strength <= 72000Points = (int)(client.Entity.MyJiang.Inner_Strength 0.40);
                else if (
client.Entity.MyJiang.Inner_Strength <= 79200Points = (int)(client.Entity.MyJiang.Inner_Strength 0.45);
                else if (
client.Entity.MyJiang.Inner_Strength <= 80800Points = (int)(client.Entity.MyJiang.Inner_Strength 0.50);
                else if (
client.Entity.MyJiang.Inner_Strength <= 81000Points = (int)(client.Entity.MyJiang.Inner_Strength 0.60);
            }
            return 
Points;
        }
        public static 
uint CalculateSubClassPoints(Client.GameState client)
        {
            
uint Points 0;
            if (
client.Entity.SubClasses.Classes != null)
            {
                foreach (var 
sub in client.Entity.SubClasses.Classes.Values)
                {
                    if (
sub == null) continue;
                    
Points += (uint)(sub.Level == 1000 sub.Level 100);
                }
            }
            return 
Points;
        }
        public static 
uint CalculatePerfectionItemPoints(ConquerItem item)
        {
            
uint Points 50;
            if (
item == null || !Database.ConquerItemInformation.BaseInformations.ContainsKey(item.ID)) return 50;
            
#region Plus
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.Plus == 1Points += 200;
                if (
item.Plus == 2Points += 600;
                if (
item.Plus == 3Points += 1200;
                if (
item.Plus == 4Points += 1800;
                if (
item.Plus == 5Points += 2600;
                if (
item.Plus == 6Points += 3500;
                if (
item.Plus == 7Points += 4800;
                if (
item.Plus == 8Points += 5800;
                if (
item.Plus == 9Points += 6800;
                if (
item.Plus == 10Points += 7800;
                if (
item.Plus == 11Points += 8800;
                if (
item.Plus == 12Points += 10000;
            }
            else
            {
                if (
item.Plus == 1Points += 400;
                if (
item.Plus == 2Points += 1200;
                if (
item.Plus == 3Points += 2400;
                if (
item.Plus == 4Points += 3600;
                if (
item.Plus == 5Points += 5200;
                if (
item.Plus == 6Points += 7000;
                if (
item.Plus == 7Points += 9600;
                if (
item.Plus == 8Points += 11600;
                if (
item.Plus == 9Points += 13600;
                if (
item.Plus == 10Points += 15600;
                if (
item.Plus == 11Points += 17600;
                if (
item.Plus == 12Points += 20000;
            }
            
#endregion
            #region Quality
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.ID 10 == 9Points += 500;
                if (
item.ID 10 == 8Points += 300;
                if (
item.ID 10 == 7Points += 200;
                if (
item.ID 10 == 6Points += 100;
                if (
item.ID 10 && item.ID 10 6Points += 50;
            }
            else
            {
                if (
item.ID 10 == 9Points += 1000;
                if (
item.ID 10 == 8Points += 600;
                if (
item.ID 10 == 7Points += 400;
                if (
item.ID 10 == 6Points += 200;
                if (
item.ID 10 && item.ID 10 6Points += 100;
            }
            
#endregion
            #region Soul
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.Purification.PurificationLevel == 1Points += 100;
                if (
item.Purification.PurificationLevel == 2Points += 300;
                if (
item.Purification.PurificationLevel == 3Points += 500;
                if (
item.Purification.PurificationLevel == 4Points += 800;
                if (
item.Purification.PurificationLevel == 5Points += 1200;
                if (
item.Purification.PurificationLevel == 6Points += 1600;
                if (
item.Purification.PurificationLevel == 7Points += 2000;
            }
            else
            {
                if (
item.Purification.PurificationLevel == 1Points += 200;
                if (
item.Purification.PurificationLevel == 2Points += 600;
                if (
item.Purification.PurificationLevel == 3Points += 1000;
                if (
item.Purification.PurificationLevel == 4Points += 1600;
                if (
item.Purification.PurificationLevel == 5Points += 2400;
                if (
item.Purification.PurificationLevel == 6Points += 3200;
                if (
item.Purification.PurificationLevel == 7Points += 4000;
            }
            
#endregion
            #region Bless
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                
Points += (uint)(item.Bless 100);
            }
            else
            {
                
Points += (uint)(item.Bless 200);
            }
            
#region Refine
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.ExtraEffect.EffectLevel == 1Points += 100;
                if (
item.ExtraEffect.EffectLevel == 2Points += 400;
                if (
item.ExtraEffect.EffectLevel == 3Points += 800;
                if (
item.ExtraEffect.EffectLevel == 4Points += 1200;
                if (
item.ExtraEffect.EffectLevel == 5Points += 1600;
                if (
item.ExtraEffect.EffectLevel == 6Points += 2000;
            }
            else
            {
                if (
item.ExtraEffect.EffectLevel == 1Points += 200;
                if (
item.ExtraEffect.EffectLevel == 2Points += 800;
                if (
item.ExtraEffect.EffectLevel == 3Points += 1600;
                if (
item.ExtraEffect.EffectLevel == 4Points += 2400;
                if (
item.ExtraEffect.EffectLevel == 5Points += 3200;
                if (
item.ExtraEffect.EffectLevel == 6Points += 4000;
            }
            
#endregion
            #endregion
            #region Level
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                var 
lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
                if (
lvl <= 120)
                    
Points += lvl 3;
                else if (
lvl <= 130)
                    
Points += lvl 5;
                else if (
lvl <= 140)
                    
Points += lvl 6;
            }
            else
            {
                var 
lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
                if (
lvl <= 120)
                    
Points += lvl 6;
                else if (
lvl <= 130)
                    
Points += lvl 10;
                else if (
lvl <= 140)
                    
Points += lvl 12;
            }
            
#endregion
            #region Gem
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.SocketOne != (Game.Enums.Gem)0)
                {
                    if (
item.SocketOne2 10 == 1Points += 200;
                    if (
item.SocketOne2 10 == 2Points += 500;
                    if (
item.SocketOne2 10 == 3Points += 800;
                }
                if (
item.SocketTwo != (Game.Enums.Gem)0)
                {
                    if (
item.SocketTwo2 10 == 1Points += 200;
                    if (
item.SocketTwo2 10 == 2Points += 500;
                    if (
item.SocketTwo2 10 == 3Points += 800;
                }
            }
            else
            {
                if (
item.SocketOne != (Game.Enums.Gem)0)
                {
                    if (
item.SocketOne2 10 == 1Points += 400;
                    if (
item.SocketOne2 10 == 2Points += 1000;
                    if (
item.SocketOne2 10 == 3Points += 1600;
                }
                if (
item.SocketTwo != (Game.Enums.Gem)0)
                {
                    if (
item.SocketTwo2 10 == 1Points += 400;
                    if (
item.SocketTwo2 10 == 2Points += 1000;
                    if (
item.SocketTwo2 10 == 3Points += 1600;
                }
            }
            
#endregion
            #region Stars
            
if (item.Stars >= 1Points += 180;
            if (
item.Stars >= 2Points += 180;
            if (
item.Stars >= 3Points += 180;
            if (
item.Stars >= 4Points += 180;
            if (
item.Stars >= 5Points += 180;
            if (
item.Stars >= 6Points += 180;
            if (
item.Stars >= 7Points += 180;
            if (
item.Stars >= 8Points += 180;
            if (
item.Stars >= 9Points += 180;
            if (
item.Stars >= 10Points += 2380;
            if (
item.Stars >= 11Points += 400;
            if (
item.Stars >= 12Points += 400;
            if (
item.Stars >= 13Points += 400;
            if (
item.Stars >= 14Points += 400;
            if (
item.Stars >= 15Points += 400;
            if (
item.Stars >= 16Points += 400;
            if (
item.Stars >= 17Points += 400;
            if (
item.Stars >= 18Points += 400;
            if (
item.Stars >= 19Points += 5150;
            if (
item.Stars >= 20Points += 650;
            if (
item.Stars >= 21Points += 650;
            if (
item.Stars >= 22Points += 650;
            if (
item.Stars >= 23Points += 650;
            if (
item.Stars >= 24Points += 650;
            if (
item.Stars >= 25Points += 650;
            if (
item.Stars >= 26Points += 650;
            if (
item.Stars >= 27Points += 650;
            if (
item.Stars >= 28Points += 100;
            if (
item.Stars >= 29Points += 100;
            if (
item.Stars >= 30Points += 100;
            if (
item.Stars >= 31Points += 100;
            if (
item.Stars >= 32Points += 100;
            if (
item.Stars >= 33Points += 100;
            if (
item.Stars >= 34Points += 100;
            if (
item.Stars >= 35Points += 100;
            if (
item.Stars >= 36Points += 100;
            if (
item.Stars >= 37Points += 100;
            if (
item.Stars >= 38Points += 100;
            if (
item.Stars >= 39Points += 100;
            if (
item.Stars >= 40Points += 100;
            if (
item.Stars >= 41Points += 100;
            if (
item.Stars >= 42Points += 100;
            if (
item.Stars >= 43Points += 100;
            if (
item.Stars >= 44Points += 100;
            if (
item.Stars >= 45Points += 100;
            if (
item.Stars >= 46Points += 100;
            if (
item.Stars >= 47Points += 100;
            if (
item.Stars >= 48Points += 100;
            if (
item.Stars >= 49Points += 100;
            if (
item.Stars >= 50Points += 100;
            if (
item.Stars >= 51Points += 100;
            if (
item.Stars >= 52Points += 100;
            if (
item.Stars >= 53Points += 100;
            if (
item.Stars >= 54Points += 100;
            if (
Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.Stars >= 1Points += 180;
                if (
item.Stars >= 2Points += 180;
                if (
item.Stars >= 3Points += 180;
                if (
item.Stars >= 4Points += 180;
                if (
item.Stars >= 5Points += 180;
                if (
item.Stars >= 6Points += 180;
                if (
item.Stars >= 7Points += 180;
                if (
item.Stars >= 8Points += 180;
                if (
item.Stars >= 9Points += 180;
                if (
item.Stars >= 10Points += 2380;
                if (
item.Stars >= 11Points += 400;
                if (
item.Stars >= 12Points += 400;
                if (
item.Stars >= 13Points += 400;
                if (
item.Stars >= 14Points += 400;
                if (
item.Stars >= 15Points += 400;
                if (
item.Stars >= 16Points += 400;
                if (
item.Stars >= 17Points += 400;
                if (
item.Stars >= 18Points += 400;
                if (
item.Stars >= 19Points += 5150;
                if (
item.Stars >= 20Points += 650;
                if (
item.Stars >= 21Points += 650;
                if (
item.Stars >= 22Points += 650;
                if (
item.Stars >= 23Points += 650;
                if (
item.Stars >= 24Points += 650;
                if (
item.Stars >= 25Points += 650;
                if (
item.Stars >= 26Points += 650;
                if (
item.Stars >= 27Points += 650;
                if (
item.Stars >= 28Points += 100;
                if (
item.Stars >= 29Points += 100;
                if (
item.Stars >= 30Points += 100;
                if (
item.Stars >= 31Points += 100;
                if (
item.Stars >= 32Points += 100;
                if (
item.Stars >= 33Points += 100;
                if (
item.Stars >= 34Points += 100;
                if (
item.Stars >= 35Points += 100;
                if (
item.Stars >= 36Points += 100;
                if (
item.Stars >= 37Points += 100;
                if (
item.Stars >= 38Points += 100;
                if (
item.Stars >= 39Points += 100;
                if (
item.Stars >= 40Points += 100;
                if (
item.Stars >= 41Points += 100;
                if (
item.Stars >= 42Points += 100;
                if (
item.Stars >= 43Points += 100;
                if (
item.Stars >= 44Points += 100;
                if (
item.Stars >= 45Points += 100;
                if (
item.Stars >= 46Points += 100;
                if (
item.Stars >= 47Points += 100;
                if (
item.Stars >= 48Points += 100;
                if (
item.Stars >= 49Points += 100;
                if (
item.Stars >= 50Points += 100;
                if (
item.Stars >= 51Points += 100;
                if (
item.Stars >= 52Points += 100;
                if (
item.Stars >= 53Points += 100;
                if (
item.Stars >= 54Points += 100;
            }
            
#endregion
            #region Socket
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.SocketOne != (Game.Enums.Gem)0Points += 1000;
                if (
item.SocketTwo != (Game.Enums.Gem)0Points += 2500;
            }
            else
            {
                if (
item.SocketOne != (Game.Enums.Gem)0Points += 2000;
                if (
item.SocketTwo != (Game.Enums.Gem)0Points += 5000;
            }
            
#endregion
            #region Enchant
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                var 
enc = (uint)(item.Enchant);
                if (
enc != 0)
                {
                    if (
enc <= 200Points += enc 1;
                    if (
enc <= 240Points += (uint)(enc 1.3);
                    if (
enc <= 254Points += (uint)(enc 1.6);
                    if (
enc <= 255Points += enc 2;
                }
            }
            else
            {
                var 
enc = (uint)(item.Enchant);
                if (
enc != 0)
                {
                    if (
enc <= 200Points += enc 2;
                    if (
enc <= 240Points += (uint)(enc 2.6);
                    if (
enc <= 254Points += (uint)(enc 3.2);
                    if (
enc <= 255Points += enc 4;
                }
            }
            
#endregion
            
return Points;
        }
    }
    public class 
MsgItemRefineOpt
    
{
        public 
MsgItemRefineOpt() { }
        public 
MsgItemRefineOptProto Info;
        public 
MsgItemRefineOptProto2 Info2;
        [
ProtoContract]
        public class 
MsgItemRefineOptProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint ItemUID;
            [
ProtoMember(3IsRequired true)]
            public 
string Signature;
            [
ProtoMember(4IsRequired true)]
            public 
uint ItemPlusUID;
        }
        [
ProtoContract]
        public class 
MsgItemRefineOptProto2
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ItemUID;
            [
ProtoMember(2IsRequired true)]
            public 
uint EntityUID;
            [
ProtoMember(3IsRequired true)]
            public 
uint Stars;
            [
ProtoMember(4IsRequired true)]
            public 
uint Progress;
            [
ProtoMember(5IsRequired true)]
            public 
uint OwnerUID;
            [
ProtoMember(6IsRequired true)]
            public 
string OwnerName;
        }
        public 
double GetPerfectionProgress(uint value)
        {
            return (
value 1.25);
        }
        public 
uint GetPerfectionProgress(ConquerItem item)
        {
            if (
item.Stars == 0) return 30;
            if (
item.Stars == 1) return 60;
            if (
item.Stars == 2) return 100;
            if (
item.Stars == 3) return 200;
            if (
item.Stars == 4) return 350;
            if (
item.Stars == 5) return 600;
            if (
item.Stars == 6) return 1000;
            if (
item.Stars == 7) return 1500;
            if (
item.Stars == 8) return 2300;
            if (
item.Stars == 9) return 3500;
            if (
item.Stars == 10) return 5000;
            if (
item.Stars == 11) return 6500;
            if (
item.Stars == 12) return 8000;
            if (
item.Stars == 13) return 9500;
            if (
item.Stars == 14) return 11000;
            return 
12000;
        }
        public 
uint GetPlusStonePoints(uint value)
        {
            if (
value == 3009000) return 10;
            if (
value == 3009001) return 100;
            if (
value == 3009002) return 1000;
            if (
value == 3009003) return 10000;
            if (
value == 730001 || value == 1) return 10;
            if (
value == 730002 || value == 2) return 40;
            if (
value == 730003 || value == 3) return 120;
            if (
value == 730004 || value == 4) return 360;
            if (
value == 730005 || value == 5) return 1080;
            if (
value == 730006 || value == 6) return 3240;
            if (
value == 730007 || value == 7) return 9720;
            if (
value == 730008 || value == 8) return 29160;
            if (
value == 9) return 87480;
            if (
value == 10) return 90180;
            if (
value == 11) return 95680;
            if (
value == 12) return 104680;
            return 
0;
        }
        public 
uint GetTransferCost(Network.GamePackets.ConquerItem item)
        {
            if (
item.Stars == 2) return 30;
            if (
item.Stars == 3) return 70;
            if (
item.Stars == 4) return 150;
            if (
item.Stars == 5) return 300;
            if (
item.Stars == 6) return 500;
            if (
item.Stars == 7) return 800;
            if (
item.Stars == 8) return 1100;
            if (
item.Stars >= 9) return 1500;
            return 
10;
        }
        public 
void Handle(Client.GameState clientbyte[] myPacket)
        {
            try
            {
                switch (
Info.ActionId)
                {
                    case 
0://Temper
                        
{
                            
#region Minors
                            
var packet2 = new byte[myPacket.Length 4];
                            Array.
Copy(myPacket4packet20packet2.Length);
                            var 
variable Kernel.Read7BitEncodedInt(packet2).SelectMany(System.BitConverter.GetBytes).ToArray();
                            var 
variable2 = new byte[variable.Length 8];
                            Array.
Copy(variable8variable20variable.Length 8);
                            var 
MinorsCount = (variable2.Length 4);
                            
uint[] Minors = new uint[MinorsCount];
                            
byte x 0;
                            for (
int i 0MinorsCounti++)
                            {
                                
Minors[i] = BitConverter.ToUInt32(variable2x);
                                
+= 4;
                            }
                            
#endregion
                            
if (Minors != null)
                            {
                                
ConquerItem Item;
                                if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                                {
                                    foreach (var 
minor in Minors)
                                    {
                                        
ConquerItem ItemPlus;
                                        if (
client.Inventory.TryGetItem(minorout ItemPlus))
                                        {
                                            
Item.PerfectionProgress += GetPlusStonePoints(ItemPlus.ID == 300000 ItemPlus.Plus ItemPlus.ID);
                                            
client.Inventory.Remove(minorGame.Enums.ItemUse.Removetrue);
                                        }
                                    }
                                    while (
Item.PerfectionProgress >= GetPerfectionProgress(Item))
                                    {
                                        
Item.PerfectionProgress -= GetPerfectionProgress(Item);
                                        
Item.Stars++;
                                    }
                                    while (
Item.Stars >= 54 && Item.PerfectionProgress 0)
                                    {
                                        
Item.Stars 54;
                                        
Item.PerfectionProgress 0;
                                    }
                                    
Item.Owner client.Entity.Name;
                                    
Item.OwnerUID client.Entity.UID;
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
client.LoadItemStats();
                                    
client.Send(proto);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                    new 
MsgUserTotalRefineLev().Send(client);

                                }
                            }

                            break;
                        }
                    case 
1://Transfer
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                            {
                                if (
client.Entity.ConquerPoints >= 1000)
                                {
                                    
client.Entity.ConquerPoints -= 1000;
                                    
Item.Owner client.Entity.Name;
                                    
Item.OwnerUID client.Entity.UID;
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
client.Send(proto);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                }
                            }
                            break;
                        }
                    case 
2://Signature
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                            {
                                if (
Item.Signature == String.Empty || Item.Signature == null)
                                {
                                    
Item.Signature Info.Signature;
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                }
                                else
                                {
                                    if (
client.Entity.ConquerPoints >= 270)
                                    {
                                        
client.Entity.ConquerPoints -= 270;
                                        
Item.Signature Info.Signature;
                                        
Item.Mode Game.Enums.ItemMode.Update;
                                        
Item.Send(client);
                                        var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                        {
                                            
ItemUID Item.UID,
                                            
EntityUID client.Entity.UID,
                                            
OwnerUID Item.OwnerUID,
                                            
OwnerName Item.Owner,
                                            
Progress Item.PerfectionProgress,
                                            
Stars Item.Stars
                                        
}), 3250);
                                        
Database.ConquerItemTable.UpdatePerfection(Item);
                                    }
                                    else if (
client.Entity.BoundCps >= 270)
                                    {
                                        
client.Entity.BoundCps -= 270;
                                        
Item.Signature Info.Signature;
                                        
Item.Mode Game.Enums.ItemMode.Update;
                                        
Item.Send(client);
                                        var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                        {
                                            
ItemUID Item.UID,
                                            
EntityUID client.Entity.UID,
                                            
OwnerUID Item.OwnerUID,
                                            
OwnerName Item.Owner,
                                            
Progress Item.PerfectionProgress,
                                            
Stars Item.Stars
                                        
}), 3250);
                                        
Database.ConquerItemTable.UpdatePerfection(Item);
                                    }
                                }

                            }
                            break;
                        }
                    case 
3://CPBoost
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item) && Item != null)
                            {
                                
uint value;
                                
value 200000000;
                                if (
client.Entity.ConquerPoints >= value)
                                {
                                    
client.Entity.ConquerPoints -= value;
                                    
Item.Owner client.Entity.Name;
                                    
Item.OwnerUID client.Entity.UID;
                                    
Item.PerfectionProgress += (uint)GetPerfectionProgress(value);
                                    while (
Item.PerfectionProgress >= GetPerfectionProgress(Item))
                                    {
                                        
Item.PerfectionProgress -= GetPerfectionProgress(Item);
                                        
Item.Stars++;
                                    }
                                    while (
Item.Stars >= 54 && Item.PerfectionProgress 0)
                                    {
                                        
Item.Stars 54;
                                        
Item.PerfectionProgress 0;
                                    }
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
client.Send(proto);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                }
                            }
                            break;
                        }
                    case 
4://Exchange
                        
{
                            
ConquerItem Item;
                            
ConquerItem Item2;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item2) || client.Inventory.TryGetItem(Info.ItemUIDout Item2))
                            {
                                if (
client.Inventory.TryGetItem(Info.ItemPlusUIDout Item) || client.Equipment.TryGetItem(Info.ItemPlusUIDout Item))
                                {
                                    if (
client.Entity.ConquerPoints >= 0)
                                    {
                                        if (
Item2.PerfectionLevel == 0)
                                            return;
                                        
client.Entity.ConquerPoints -= 0;
                                        
Item.PerfectionProgress Item2.PerfectionProgress;
                                        
Item.PerfectionLevel Item2.PerfectionLevel;
                                        
Item.Mode Game.Enums.ItemMode.Update;
                                        
Item.Send(client);
                                        
Item2.PerfectionProgress 0;
                                        
Item2.PerfectionLevel 0;
                                        
Item2.Mode Game.Enums.ItemMode.Update;
                                        
Item2.Send(client);
                                        var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                        {
                                            
ItemUID Item.UID,
                                            
EntityUID client.Entity.UID,
                                            
OwnerUID Item.OwnerUID,
                                            
OwnerName Item.Owner,
                                            
Progress Item.PerfectionProgress,
                                            
Stars Item.Stars
                                        
}), 3250);
                                        
Database.ConquerItemTable.UpdatePerfection(Item);
                                        
Database.ConquerItemTable.UpdatePerfection(Item2);
                                    }
                                }
                            }
                            break;
                        }
                    case 
5://Quick
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                            {
                                if (
Item.PerfectionProgress == || Item.Stars >= 54) break;
                                
double percent = (double)Item.PerfectionProgress / (double)GetPerfectionProgress(Item) * 0;
                                if (
Kernel.Rate(percent))
                                {
                                    
Item.Stars++;
                                }
                                
Item.PerfectionProgress 0;
                                
Item.Owner client.Entity.Name;
                                
Item.OwnerUID client.Entity.UID;
                                
Item.Mode Game.Enums.ItemMode.Update;
                                
Item.Send(client);
                                var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                {
                                    
ItemUID Item.UID,
                                    
EntityUID client.Entity.UID,
                                    
OwnerUID Item.OwnerUID,
                                    
OwnerName Item.Owner,
                                    
Progress Item.PerfectionProgress,
                                    
Stars Item.Stars
                                
}), 3250);
                                
Database.ConquerItemTable.UpdatePerfection(Item);
                                
client.LoadItemStats();
                            }
                            break;
                        }
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
            }
        }
        public 
byte GetStars(byte Stars)
        {
            if (
Stars >= && Stars <= 8) return 9;
            if (
Stars >= && Stars <= 17) return 18;
            if (
Stars >= 18 && Stars <= 26) return 27;
            if (
Stars >= 27 && Stars <= 35) return 36;
            if (
Stars >= 36 && Stars <= 44) return 45;
            if (
Stars >= 45 && Stars <= 53) return 54;
            return 
0;
        }
        public 
byte[] GetBytes(string packetString)
        {
            if (
packetString != "" && packetString != null && packetString != string.Empty && packetString != " ")
            {
                
byte[] bytes = new byte[(packetString.Length 3) + 1];
                
int t 0;
                for (
int i 0packetString.Length+= 3)
                {
                    
string cha packetString.Substring(i2);
                    
bytes[t] = byte.Parse(chaSystem.Globalization.NumberStyles.HexNumber);
                    
t++;
                }
                return 
bytes;
            }
            return 
null;
        }
        public 
bool Read(byte[] packet)
        {
            try
            {
                var 
mypkt = new byte[packet.Length 4];
                Array.
Copy(packet4mypkt0mypkt.Length);
                
using (var memoryStream = new MemoryStream(packet))
                {
                    
Info Serializer.DeserializeWithLengthPrefix<MsgItemRefineOptProto>(memoryStreamPrefixStyle.Fixed32);
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
                return 
false;
            }
            return 
true;
        }
    }
    public class 
MsgItemRefineRecord
    
{
        public 
MsgItemRefineRecord() { }
        public 
MsgItemRefineRecordProto Info;
        [
ProtoContract]
        public class 
MsgItemRefineRecordProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint MaxStars;
        }
        public 
void Handle(Client.GameState client)
        {
            switch (
Info.ActionId)
            {
                case 
0:
                    {
                        
Send(client);
                        break;
                    }
            }
        }
        public 
void Send(Client.GameState client)
        {
            
client.Send(Kernel.FinalizeProtoBuf(new MsgItemRefineRecordProto()
            {
                
ActionId 0,
                
MaxStars 54
            
}, 3255));
        }
        public 
bool Read(byte[] packet)
        {
            var 
mypkt = new byte[packet.Length 4];
            Array.
Copy(packet4mypkt0mypkt.Length);
            
using (var memoryStream = new MemoryStream(packet))
            {
                
Info Serializer.DeserializeWithLengthPrefix<MsgItemRefineRecordProto>(memoryStreamPrefixStyle.Fixed32);
            }
            return 
true;
        }
    }
    public class 
MsgRankMemberShow
    
{
        public 
MsgRankMemberShow() { }
        public 
MsgRankMemberShowProto Info;
        [
ProtoContract]
        public class 
MsgRankMemberShowProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
MsgRankMemberShowProtoSer proto;
        }
        [
ProtoContract]
        public class 
MsgRankMemberShowProtoSer
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint dwParam;
            [
ProtoMember(2IsRequired true)]
            public 
uint Count;
            [
ProtoMember(3IsRequired true)]
            public 
uint UID;
            [
ProtoMember(4IsRequired true)]
            public 
string Name "";
            [
ProtoMember(5IsRequired true)]
            public 
string Guild "";
            [
ProtoMember(6IsRequired true)]
            public 
uint Mesh;
            [
ProtoMember(7IsRequired true)]
            public 
uint HairStyle;
            [
ProtoMember(8IsRequired true)]
            public 
uint Hat;
            [
ProtoMember(9IsRequired true)]
            public 
uint Garment;
            [
ProtoMember(10IsRequired true)]
            public 
uint LeftWep;
            [
ProtoMember(11IsRequired true)]
            public 
uint LeftWepAcc;
            [
ProtoMember(12IsRequired true)]
            public 
uint RightWep;
            [
ProtoMember(13IsRequired true)]
            public 
uint RightWepAcc;
            [
ProtoMember(14IsRequired true)]
            public 
uint MountArmor;
            [
ProtoMember(15IsRequired true)]
            public 
uint Flag;
            [
ProtoMember(16IsRequired true)]
            public 
uint Wing;
            [
ProtoMember(17IsRequired true)]
            public 
uint WingLevel;
            [
ProtoMember(18IsRequired true)]
            public 
uint Title;
            [
ProtoMember(19IsRequired true)]
            public 
uint Flag2;
            [
ProtoMember(20IsRequired true)]
            public 
uint Flag3;
            [
ProtoMember(21IsRequired true)]
            public 
uint Flag4;
        }
        public 
void UpdateBestEntity()
        {
            
DateTime StartTime DateTime.Now;
            
Items = new Dictionary<byteuint>();
            
BestEntity MsgUserAbilityScore.RankingList.OrderByDescending(=> i.Value.TotalPerfectionScore).ThenByDescending(=> i.Value.Level).ThenBy(=> i.Value.UID).FirstOrDefault().Value;
            if (
BestEntity == null) return;


            
byte[] Positions = new byte[10] { 134591215161719 };
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("items").Where("EntityID"BestEntity.UID))
            
using (var reader = new MySqlReader(cmd))
            {
                while (
reader.Read())
                {
                    foreach (var 
pos in Positions)
                    {
                        if (
reader.ReadByte("Position") == pos)
                        {
                            if (
Items.ContainsKey(pos)) Items.Remove(pos);
                            
Items.Add(posreader.ReadUInt32("ID"));
                            if (
pos == 19Items.Add(255reader.ReadByte("Plus"));
                            break;
                        }
                    }
                }
            }
            foreach (var 
pos in Positions)
            {
                if (!
Items.ContainsKey(pos)) Items.Add(pos0);
            }
            if (!
Items.ContainsKey(255)) Items.Add(2550);
        }
        public static 
Dictionary<byteuintItems = new Dictionary<byteuint>();
        public static 
Game.Entity BestEntity;
        public 
void Handle(Client.GameState client)
        {
            if (
BestEntity == null) return;
            switch (
Info.ActionId)
            {
                case 
0:
                    {
                        var 
proto2 = new MsgRankMemberShowProto();
                        
proto2.ActionId 0;
                        
proto2.proto = new MsgRankMemberShowProtoSer();
                        
proto2.proto.dwParam 1;
                        
proto2.proto.Count 1;
                        
proto2.proto.UID BestEntity.UID;
                        
#region If He Is Online
                        
if (Kernel.GamePool.ContainsKey(BestEntity.UID))
                        {
                            var 
Entity Kernel.GamePool[BestEntity.UID].Entity;
                            
proto2.proto.HairStyle Entity.HairStyle;
                            
proto2.proto.Mesh Entity.Mesh;
                            
proto2.proto.Name Entity.Name;
                            if (
BestEntity.GuildID != 0)
                                
proto2.proto.Guild Kernel.Guilds[BestEntity.GuildID].Name;
                            if (
Entity.Owner.Equipment != null)
                            {
                                var 
Equipment Entity.Owner.Equipment;
                                
proto2.proto.Hat Equipment.TryGetItem((byte)ConquerItem.Head) != null Equipment.TryGetItem((byte)ConquerItem.Head).ID 0;
                                
proto2.proto.LeftWep Equipment.TryGetItem((byte)ConquerItem.LeftWeapon) != null Equipment.TryGetItem((byte)ConquerItem.LeftWeapon).ID 0;
                                
proto2.proto.LeftWepAcc Equipment.TryGetItem((byte)ConquerItem.LeftWeaponAccessory) != null Equipment.TryGetItem((byte)ConquerItem.LeftWeaponAccessory).ID 0;
                                
proto2.proto.MountArmor Equipment.TryGetItem((byte)ConquerItem.SteedArmor) != null Equipment.TryGetItem((byte)ConquerItem.SteedArmor).ID : (Equipment.TryGetItem((byte)ConquerItem.Steed) != null Equipment.TryGetItem((byte)ConquerItem.Steed).ID 0);
                                
proto2.proto.Garment Equipment.TryGetItem((byte)ConquerItem.Garment) != null Equipment.TryGetItem((byte)ConquerItem.Garment).ID : ((Equipment.TryGetItem((byte)ConquerItem.Armor) != null Equipment.TryGetItem((byte)ConquerItem.Armor).ID 0));
                                
proto2.proto.RightWep Equipment.TryGetItem((byte)ConquerItem.RightWeapon) != null Equipment.TryGetItem((byte)ConquerItem.RightWeapon).ID 0;
                                
proto2.proto.RightWepAcc Equipment.TryGetItem((byte)ConquerItem.RightWeaponAccessory) != null Equipment.TryGetItem((byte)ConquerItem.RightWeaponAccessory).ID 0;
                                
proto2.proto.Wing Entity.EquippedWing == ? (Equipment.TryGetItem((byte)ConquerItem.Wing) != null Equipment.TryGetItem((byte)ConquerItem.Wing).ID 0) : (uint)Entity.EquippedWing;
                                
proto2.proto.WingLevel = (byte)(Equipment.TryGetItem((byte)ConquerItem.Wing) != null Equipment.TryGetItem((byte)ConquerItem.Wing).Plus 0);
                            }
                            
proto2.proto.Title = (uint)Entity.EquippedTitle;
                            
proto2.proto.Flag = (uint)Entity.StatusFlag;
                            
proto2.proto.Flag2 = (uint)Entity.StatusFlag2;
                            
proto2.proto.Flag3 = (uint)Entity.StatusFlag3;
                            
//proto2.proto.Flag4 = (uint)Entity.StatusFlag4;
                            
client.Send(Kernel.FinalizeProtoBuf(proto23257));
                            break;
                        }
                        
#endregion
                        
proto2.proto.HairStyle BestEntity.HairStyle;
                        
proto2.proto.Mesh BestEntity.Mesh;
                        
proto2.proto.Name BestEntity.Name;
                        if (
BestEntity.GuildID != && Kernel.Guilds.ContainsKey(BestEntity.GuildID))
                            
proto2.proto.Guild Kernel.Guilds[BestEntity.GuildID].Name;
                        
proto2.proto.Hat Items[(byte)ConquerItem.Head];
                        
proto2.proto.LeftWep Items[(byte)ConquerItem.LeftWeapon];
                        
proto2.proto.LeftWepAcc Items[(byte)ConquerItem.LeftWeaponAccessory];
                        
proto2.proto.MountArmor Items[(byte)ConquerItem.SteedArmor] == Items[(byte)ConquerItem.Steed] : Items[(byte)ConquerItem.SteedArmor];
                        
proto2.proto.Garment Items[(byte)ConquerItem.Garment];
                        
proto2.proto.RightWep Items[(byte)ConquerItem.RightWeapon];
                        
proto2.proto.RightWepAcc Items[(byte)ConquerItem.RightWeaponAccessory];
                        
proto2.proto.Wing BestEntity.EquippedWing == Items[(byte)ConquerItem.Wing] : (uint)BestEntity.EquippedWing;
                        
proto2.proto.WingLevel Items[255];
                        
proto2.proto.Title = (uint)BestEntity.EquippedTitle;
                        
client.Send(Kernel.FinalizeProtoBuf(proto23257));
                        break;
                    }
                case 
1:
                    {
                        if (
Kernel.GamePool.ContainsKey(Info.proto == null Info.proto.dwParam))
                        {
                            
PacketHandler.ObserveEquipment(new Data(true) { ID 117UID client.Entity.UIDdwParam Info.proto == null Info.proto.dwParam }, client);
                        }
                        else
                        {
                            
client.Send(Kernel.FinalizeProtoBuf(Info3257));
                        }
                        break;
                    }
            }

        }
        public 
bool Read(byte[] packet)
        {
            var 
mypkt = new byte[packet.Length 4];
            Array.
Copy(packet4mypkt0mypkt.Length);
            try
            {
                
using (var memoryStream = new MemoryStream(packet))
                {
                    
Info Serializer.DeserializeWithLengthPrefix<MsgRankMemberShowProto>(memoryStreamPrefixStyle.Fixed32);
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e);
                return 
false;
            }
            return 
true;
        }
    }
    public class 
MsgEquipRefineRank
    
{
        public 
MsgEquipRefineRank() { }
        public 
MsgEquipRefineRankProto Info;
        [
Flags]
        public 
enum ActionID
        
{
            
MainRank 0,
            
RankItems 1,
            
UserItemRanking 2,
            
MyRanks 3,
            
View 4,

        }
        [
ProtoContract]
        public class 
MsgEquipRefineRankProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
ActionID Action;
            [
ProtoMember(2)]
            public 
uint RegisteredCount;
            [
ProtoMember(3)]
            public 
uint Page;
            [
ProtoMember(4IsRequired true)]
            public 
uint Index;
            [
ProtoMember(5IsRequired true)]
            public 
EquipProto[] items;
        }
        [
ProtoContract]
        public class 
EquipProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint Rank;
            [
ProtoMember(2IsRequired true)]
            public 
uint UnKnow2;
            [
ProtoMember(3IsRequired true)]
            public 
uint Position;
            [
ProtoMember(4IsRequired true)]
            public 
uint RankScore;
            [
ProtoMember(5IsRequired true)]
            public 
uint UID;
            [
ProtoMember(6IsRequired true)]
            public 
uint ItemID;
            [
ProtoMember(7IsRequired true)]
            public 
uint PurificationID;
            [
ProtoMember(8IsRequired true)]
            public 
uint Plus;
            [
ProtoMember(9IsRequired true)]
            public 
uint Stars;
            [
ProtoMember(10IsRequired true)]
            public 
string Name "";
            [
ProtoMember(11IsRequired true)]
            public 
uint PerfectionLevel;
        }
        public 
byte GetRealyPosition(byte FakePosition)
        {
            if (
FakePosition == 5) return 19;
            if (
FakePosition == 7) return 18;
            if (
FakePosition == 9) return 12;
            return 
FakePosition;
        }
        public static 
Dictionary<byteConquerItemMainRank;
        public 
void UpdateRanking()
        {
            
AllItemsRanking = new List<ConquerItem>();
            
MainRank = new Dictionary<byteConquerItem>();
            for (
byte i 011i++)
            {
                
byte z GetRealyPosition((byte)(1));
                List<
ConquerItemitems = new List<ConquerItem>();
                
MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
                
command.Select("items").Where("Position"z).And("Stars"0true);
                
MySqlReader reader = new MySqlReader(command);
                while (
reader.Read())
                {
                    
ConquerItem item = new ConquerItem(true);
                    
item.ID reader.ReadUInt32("ID");
                    
item.UID reader.ReadUInt32("UID");
                    
item.MaximDurability reader.ReadUInt16("MaximDurability");
                    
item.Durability reader.ReadUInt16("Durability");
                    
item.Position reader.ReadUInt16("Position");
                    
item.Signature reader.ReadString("Signature");
                    
item.SocketProgress reader.ReadUInt32("SocketProgress");
                    
item.PlusProgress reader.ReadUInt32("PlusProgress");
                    
item.Stars reader.ReadByte("Stars");
                    
item.PerfectionProgress reader.ReadUInt32("PerfectionProgress");
                    
item.Owner reader.ReadString("Owner");
                    
item.OwnerUID reader.ReadUInt32("OwnerUID");
                    
item.SocketOne = (Game.Enums.Gem)reader.ReadByte("SocketOne");
                    
item.SocketTwo = (Game.Enums.Gem)reader.ReadByte("SocketTwo");
                    
item.Effect = (Game.Enums.ItemEffect)reader.ReadByte("Effect");
                    
item.Mode Game.Enums.ItemMode.Default;
                    
item.Plus reader.ReadByte("Plus");
                    
item.Bless reader.ReadByte("Bless");
                    
item.Bound reader.ReadBoolean("Bound");
                    
// item.TimeStamp = DateTime.FromBinary(reader.ReadInt64("TimeStamp"));
                    // item.Minutes = reader.ReadUInt64("MinutesLeft");
                    
item.Enchant reader.ReadByte("Enchant");
                    
item.Lock reader.ReadByte("Locked");
                    
item.UnlockEnd DateTime.FromBinary(reader.ReadInt64("UnlockEnd"));
                    
item.Suspicious reader.ReadBoolean("Suspicious");
                    
item.SuspiciousStart DateTime.FromBinary(reader.ReadInt64("SuspiciousStart"));
                    
item.Color = (Game.Enums.Color)reader.ReadByte("Color");
                    
item.Inscribed reader.ReadByte("Inscribed") == 1;
                    
item.StackSize reader.ReadUInt16("StackSize");
                    
item.Warehouse reader.ReadByte("Warehouse");
                    
item.RefineItem reader.ReadUInt32("RefineryItem");
                    
item.InWardrobe reader.ReadBoolean("InWardrobe");
                    
Int64 rTime reader.ReadInt64("RefineryTime");
                    
ItemAddingTable.GetAddingsForItem(item);
                    
items.Add(item);
                    if (!
AllItemsRanking.Contains(item))
                        
AllItemsRanking.Add(item);

                }
                
MainRank[z] = items.OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(x)).FirstOrDefault();
            }
        }
        public static List<
ConquerItemAllItemsRanking;
        public 
void Handle(Client.GameState client)
        {
            switch (
Info.Action)
            {
                case 
ActionID.UserItemRanking:
                    {
                        var 
item AllItemsRanking.Where(=> p.Position == GetRealyPosition((byte)Info.Index)).OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(i)).ToArray();
                        var 
min Math.Min(item.Length50);
                        for (
int i 0mini++)
                        {
                            if (
client.Equipment.IsWearingItemUID(item[i].UID))
                            {
                                var 
packet = new MsgEquipRefineRankProto();
                                
packet.Page Info.Page;
                                
packet.RegisteredCount Info.RegisteredCount;
                                
packet.Action Info.Action;
                                
packet.Index Info.Index;
                                
packet.items = new EquipProto[1];
                                
packet.items[0] = new EquipProto();
                                var 
itemm item[i];
                                
packet.items[0].Rank = (uint)(1);
                                
packet.items[0].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(itemm);
                                
packet.items[0].ItemID itemm.ID;
                                
packet.items[0].Name itemm.Owner.Replace("/0""");
                                
packet.items[0].Stars itemm.Stars;
                                
packet.items[0].Position GetRealyPosition((byte)Info.Index);
                                
packet.items[0].Plus itemm.Plus;
                                
packet.items[0].UID itemm.UID;
                                
packet.items[0].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                                
client.Send(Kernel.FinalizeProtoBuf(packet3256));
                                break;
                            }
                        }
                        break;
                    }
                case 
ActionID.MyRanks:
                    {
                        var 
packet = new MsgEquipRefineRankProto();
                        
packet.Action ActionID.MyRanks;
                        
packet.items = new EquipProto[11];
                        for (
byte i 0packet.items.Lengthi++)
                        {
                            
byte z GetRealyPosition((byte)(1));
                            var 
itemmm AllItemsRanking.Where(=> p.Position == z).OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(m)).ToArray();
                            for (
int h 0itemmm.Lengthh++)
                            {
                                if (
client.Equipment.IsWearingItemUID(itemmm[h].UID))
                                {
                                    
packet.items[i] = new EquipProto();
                                    
packet.items[i].ItemID itemmm[h].ID;
                                    
packet.items[i].Name itemmm[h].Owner.Replace("/0""");
                                    
packet.items[i].Stars itemmm[h].Stars;
                                    
packet.items[i].Plus itemmm[h].Plus;
                                    
packet.items[i].Position = (uint)(1);
                                    if (
itemmm[h].Purification.Available)
                                        
packet.items[i].PurificationID itemmm[h].Purification.PurificationItemID;
                                    
packet.items[i].Rank = (uint)(1);
                                    
packet.items[i].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(itemmm[h]);
                                    
packet.items[i].UID itemmm[h].UID;
                                    
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                                    break;
                                }
                            }
                        }



                        var 
proto Kernel.FinalizeProtoBuf(packet3256);
                        
client.Send(proto);
                        break;
                    }
                case 
ActionID.View://ViewItem
                    
{
                        if (
Database.ConquerItemTable.LoadItem(Info.Index) != null)
                        {
                            var 
item Database.ConquerItemTable.LoadItem(Info.Index);
                            
item.Mode Game.Enums.ItemMode.Perfection;
                            
item.Send(client);
                        }
                        else
                        {
                            
client.Send(Kernel.FinalizeProtoBuf(Info3256));
                        }
                        break;
                    }
                case 
ActionID.RankItems://AllRanking
                    
{
                        var 
cnt AllItemsRanking.Where(=> p.Position == GetRealyPosition((byte)Info.Index)).Count();
                        var 
packet = new MsgEquipRefineRankProto();
                        
packet.Action ActionID.RankItems;
                        
packet.RegisteredCount = (uint)Math.Min(cnt50);
                        
packet.Page Info.Page;
                        
packet.Index Info.Index;
                        
uint sss = (ushort)Math.Min(cnt - (packet.Page 10), 10);

                        
int rank = (int)packet.Page 10;
                        
packet.items = new EquipProto[sss];
                        for (
int i rankrank sssi++)
                        {
                            var 
iteeeem AllItemsRanking.Where(=> p.Position == GetRealyPosition((byte)Info.Index)).OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(x)).ToArray()[i];
                            if (
iteeeem == null) continue;
                            
packet.items[i] = new EquipProto();
                            
packet.items[i].ItemID iteeeem.ID;
                            
packet.items[i].Name iteeeem.Owner.Replace("/0""");
                            
packet.items[i].PerfectionLevel iteeeem.Stars;
                            
packet.items[i].Plus iteeeem.Plus;
                            
packet.items[i].Position GetRealyPosition((byte)Info.Index);
                            if (
iteeeem.Purification.Available)
                                
packet.items[i].PurificationID iteeeem.Purification.PurificationItemID;
                            
packet.items[i].Rank = (uint)(1);
                            
packet.items[i].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(iteeeem);
                            
packet.items[i].UID iteeeem.UID;
                            
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                        }
                        var 
proto Kernel.FinalizeProtoBuf(packet3256);
                        
client.Send(proto);
                        break;
                    }
                case 
ActionID.MainRank:
                    {


                        var 
packet = new MsgEquipRefineRankProto();
                        
packet.Action ActionID.MainRank;
                        
packet.items = new EquipProto[11];
                        for (
byte i 0packet.items.Lengthi++)
                        {
                            
byte z GetRealyPosition((byte)(1));
                            
ConquerItem itemmm MainRank[z];
                            if (
itemmm == null) continue;
                            
packet.items[i] = new EquipProto();
                            
packet.items[i].ItemID itemmm.ID;
                            
packet.items[i].Name itemmm.Owner.Replace("/0""");
                            
packet.items[i].Stars itemmm.Stars;
                            
packet.items[i].Plus itemmm.Plus;
                            
packet.items[i].Position = (uint)(1);
                            if (
itemmm.Purification.Available)
                                
packet.items[i].PurificationID itemmm.Purification.PurificationItemID;
                            
packet.items[i].Rank 1;
                            
packet.items[i].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(itemmm);
                            
packet.items[i].UID itemmm.UID;
                            
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                        }



                        var 
proto Kernel.FinalizeProtoBuf(packet3256);
                        
client.Send(proto);
                        break;
                    }
            }
        }
        public 
bool Read(byte[] packet)
        {
            
using (var memoryStream = new MemoryStream(packet))
            {
                
Info Serializer.DeserializeWithLengthPrefix<MsgEquipRefineRankProto>(memoryStreamPrefixStyle.Fixed32);
            }
            return 
true;
        }
    }
    public class 
MsgUserTotalRefineLev
    
{
        public 
MsgUserTotalRefineLev() { }
        public 
MsgUserTotalRefineLevProto Info;
        [
ProtoContract]
        public class 
MsgUserTotalRefineLevProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint EntityUID;
            [
ProtoMember(3IsRequired true)]
            public 
uint TotalPrefectionLevel;
        }
        public 
void SendPerfectionEffects(Client.GameState client)
        {
            if (
client.Equipment.TotalStars >= 10) { client.Entity.MaxAttack += 100client.Entity.MinAttack += 100client.Entity.MagicAttack += 100; }
            if (
client.Equipment.TotalStars >= 70) { client.Entity.Defence += 100client.Entity.MagicDefence += 100; }
            if (
client.Equipment.TotalStars >= 75) { client.Entity.MaxAttack += 200client.Entity.MinAttack += 200client.Entity.MagicAttack += 300; }
            if (
client.Equipment.TotalStars >= 100) { client.Entity.Defence += 200client.Entity.MagicDefence += 50; }
            if (
client.Equipment.TotalStars >= 140) { client.Entity.MaxAttack += 200client.Entity.MinAttack += 200client.Entity.MagicAttack += 400; }
            if (
client.Equipment.TotalStars >= 150) { client.Entity.MaxAttack += 300client.Entity.MinAttack += 300client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 160) { client.Entity.Defence += 300client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 180) { client.Entity.Defence += 400client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 235) { client.Entity.MaxAttack += 400client.Entity.MinAttack += 400client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 270) { client.Entity.Defence += 400client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 273) { client.Entity.MaxAttack += 400client.Entity.MinAttack += 400client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 306) { client.Entity.MaxAttack += 400client.Entity.MinAttack += 400client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 310) { client.Entity.Defence += 400client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 316) { client.Entity.Defence += 500client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 318) { client.Entity.MaxAttack += 500client.Entity.MinAttack += 500client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 323) { client.Entity.Defence += 500client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 324) { client.Entity.MaxAttack += 500client.Entity.MinAttack += 500client.Entity.MagicAttack += 500; }
        }
        public 
void Send(Client.GameState client)
        {
            
client.Send(Kernel.FinalizeProtoBuf(new MsgUserTotalRefineLevProto()
            {
                
ActionId 0,
                
EntityUID client.Entity.UID,
                
TotalPrefectionLevel client.Equipment.TotalStars
            
}, 3252));
        }
    }
    public class 
MsgRefineEffect
    
{
        public 
MsgRefineEffect() { }
        public 
MsgRefineEffectProto Info;
        [
ProtoContract]
        public class 
MsgRefineEffectProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint AttackerUID;
            [
ProtoMember(2IsRequired true)]
            public 
uint AttackedUID;
            [
ProtoMember(3IsRequired true)]
            public 
uint Effect;
        }
        public 
void Attacking(Game.Entity attackerInterfaces.IMapObject attackedref uint damageref Attack attackref bool loadItemStats)
        {
            if (
attacker == null || attacked == null) return;
            if (
attacker.Owner.Equipment.TotalStars == 0) return;
            if (
attacker.EntityFlag == Game.EntityFlag.Monster) return;
            
double chance 0;
            var 
effect Game.Enums.PerfectionEffect.CalmWind;
            
byte level 0;
            var 
dics Database.PerfectionTable.Effects.Values.Where(=> i.Stars == attacker.Owner.Equipment.TotalStars).FirstOrDefault();
            if (
dics == null) return;
            var 
dic dics.Effects;
            var 
item Kernel.RandFromGivingNums(dic.ToArray());
            
effect = (Game.Enums.PerfectionEffect)(item 1000);
            
level = (byte)(item 1000);
            
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
            foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
            {
                if (
attacker.Owner.Equipment.IsWearingItemID(val.ItemID))
                {
                    if (
attacker.Owner.Equipment.TotalStars >= val.StarReq)
                    {
                        if (
val.AttributeNum <= 16)
                        {
                            if (
val.AttributeNum == (uint)effect)
                            {
                                
chance += (byte)val.Value;
                            }
                        }
                    }
                }
            }
            while (
effect == Game.Enums.PerfectionEffect.Stricklock ||
                
effect == Game.Enums.PerfectionEffect.FreeSoul ||
                
effect == Game.Enums.PerfectionEffect.StraightLife ||
                
effect == Game.Enums.PerfectionEffect.ToxinEarser ||
                
effect == Game.Enums.PerfectionEffect.BloodSpawn ||
                
effect == Game.Enums.PerfectionEffect.MirrorofSin)
            {
                
item Kernel.RandFromGivingNums(dic.ToArray());
                
effect = (Game.Enums.PerfectionEffect)(item 1000);
                
level = (byte)(item 1000);
                
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
                foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
                {

                    if (
attacker.Owner.Equipment.IsWearingItemID(val.ItemID))
                    {
                        if (
attacker.Owner.Equipment.TotalStars >= val.StarReq)
                        {
                            if (
val.AttributeNum <= 16)
                            {
                                if (
val.AttributeNum == (uint)effect)
                                {
                                    
chance += (byte)val.Value;
                                }
                            }
                        }
                    }
                }
            }
            if (
Kernel.Rate((byte)chance))
            {
                
#region DoEffects
                #region DrainingTouch
                
if (effect == Game.Enums.PerfectionEffect.DrainingTouch)
                {
                    
attacker.Hitpoints attacker.MaxHitpoints;
                    
attacker.Mana attacker.MaxMana;
                }
                
#endregion
                #region LuckyStrike
                
if (effect == Game.Enums.PerfectionEffect.LuckyStrike || effect == Game.Enums.PerfectionEffect.AbsoluteLuck) { damage *= 2attack.Effect1 Attack.AttackEffects1.LuckyStrike; }
                
#endregion
                #region KillingFlash
                
if (effect == Game.Enums.PerfectionEffect.KillingFlash)
                {
                    
attacker.Owner.XPCount 100;
                }
                
#endregion
                #region DivineGuard
                
if (effect == Game.Enums.PerfectionEffect.DivineGuard)
                {
                    
attacker.AddFlag3(Network.GamePackets.Update.Flags3.DivineGuard);
                    
attacker.Defence = (ushort)(((attacker.Defence) * 300) / 100);
                    
attacker.DivineGuardStamp Time32.Now;
                }
                
#endregion
                #region InvisibleArrow
                
if (effect == Game.Enums.PerfectionEffect.InvisibleArrow)
                {
                    
damage += ((uint)(attacker.MagicAttack 5) / 100);
                }
                
#endregion
                #region ShieldBreak
                
if (effect == Game.Enums.PerfectionEffect.ShieldBreak)
                {
                    
attacker.AddFlag3(Network.GamePackets.Update.Flags3.ShieldBreak);
                    
attacker.ShieldBreakStamp Time32.Now;
                    if (
attacked.MapObjType == Game.MapObjectType.Entity)
                    {
                        (
attacked as Game.Entity).Block -= (ushort)((((attacked as Game.Entity).Block) * 20) / 100);
                        if ((
attacked as Game.Entity).Block 0) (attacked as Game.Entity).Block 0;
                        
loadItemStats true;
                    }
                }
                
#endregion
                #region CoreStrike
                
if (effect == Game.Enums.PerfectionEffect.CoreStrike)
                {
                    
damage += ((uint)(attacker.MagicDamageIncrease 0) * 100);
                }
                
#endregion
                #region LightofStamina
                
if (effect == Game.Enums.PerfectionEffect.LightofStamina)
                {
                    
byte limit 0;
                    if (
attacker.HeavenBlessing 0)
                        
limit 50;
                    
attacker.Stamina = (byte)(100 limit);
                }
                
#endregion
                #endregion
                
var proto = new MsgRefineEffectProto();
                
proto.AttackerUID attacker.UID;
                
proto.AttackedUID attacked != null attacked.UID 0;
                
proto.Effect = (uint)effect;
                var 
proto2 Kernel.FinalizeProtoBuf(proto3254);
                
attacker.Owner.SendScreen(proto2true);
            }
        }
        public 
void beingAttacked(Interfaces.IMapObject attackerGame.Entity attackedref uint damage)
        {
            if (
attacker == null || attacked == null) return;
            if (
attacker.Owner.Equipment.TotalStars == 0) return;
            if (
attacked.EntityFlag == Game.EntityFlag.Monster) return;
            
double chance 0;
            var 
effect Game.Enums.PerfectionEffect.CalmWind;
            
byte level 0;
            var 
dic0 Database.PerfectionTable.Effects.Values.Where(=> i.Stars == attacked.Owner.Equipment.TotalStars).FirstOrDefault();
            if (
dic0 == null) return;
            var 
dic dic0.Effects;
            var 
item Kernel.RandFromGivingNums(dic.ToArray());
            
effect = (Game.Enums.PerfectionEffect)(item 1000);
            
level = (byte)(item 1000);
            
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
            foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
            {

                if (
attacked.Owner.Equipment.IsWearingItemID(val.ItemID))
                {
                    if (
attacked.Owner.Equipment.TotalStars >= val.StarReq)
                    {
                        if (
val.AttributeNum <= 16)
                        {
                            if (
val.AttributeNum == (uint)effect)
                            {
                                
chance += (byte)val.Value;
                            }
                        }
                    }
                }
            }
            
/////////////WhileAttackedNotAttackingEffects////////////
            
while (!(effect == Game.Enums.PerfectionEffect.Stricklock ||
                
effect == Game.Enums.PerfectionEffect.BloodSpawn ||
                
effect == Game.Enums.PerfectionEffect.MirrorofSin))
            {
                
item Kernel.RandFromGivingNums(dic.ToArray());
                
effect = (Game.Enums.PerfectionEffect)(item 1000);
                
level = (byte)(item 1000);
                
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
                foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
                {

                    if (
attacked.Owner.Equipment.IsWearingItemID(val.ItemID))
                    {
                        if (
attacked.Owner.Equipment.TotalStars >= val.StarReq)
                        {
                            if (
val.AttributeNum <= 16)
                            {
                                if (
val.AttributeNum == (uint)effect)
                                {
                                    
chance += (byte)val.Value;
                                }
                            }
                        }
                    }
                }
            }
            if (
Kernel.Rate((byte)chance))
            {
                
#region DoEffects
                #region StrickLock
                
if (effect == Game.Enums.PerfectionEffect.Stricklock)
                {
                    
damage 0;
                }
                
#endregion
                #region BloodSpawn
                
if (effect == Game.Enums.PerfectionEffect.BloodSpawn)
                {
                    
attacked.Hitpoints attacked.MaxHitpoints;
                    
attacked.Mana attacked.MaxMana;
                }
                
#endregion
                #region KillingFlash
                
if (effect == Game.Enums.PerfectionEffect.MirrorofSin)
                {
                    
attacked.Owner.XPCount 100;
                }
                
#endregion
                #endregion
                
var proto = new MsgRefineEffectProto();
                
proto.AttackerUID attacked.UID;
                
proto.AttackedUID attacker.UID;
                
proto.Effect = (uint)effect;
                var 
proto2 Kernel.FinalizeProtoBuf(proto3254);
                
attacked.Owner.SendScreen(proto2true);
            }
        }
        public 
void GenerateChance(Game.Entity EntityGame.Enums.PerfectionEffect effectref byte chancebool dwParam false)
        {
            if (
Entity.Owner.Equipment.TotalStars == 0) { chance 0; return; }
            
byte level = (byte)(Database.PerfectionTable.Effects.Values.Where(=> i.Stars == Entity.Owner.Equipment.TotalStars).FirstOrDefault().Effects.Where(=> >= ((uint)(effect) * 1000) && <= ((uint)(effect) * 1000 20)).FirstOrDefault() % 1000);
            if (
Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault() != null)
            {
                if (!
dwParam)
                    
chance = (byte)(Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100);
                else 
chance = (byte)(Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().dwParam 100);
                foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
                {
                    if (
Entity.Owner.Equipment.IsWearingItemID(val.ItemID))
                    {
                        if (
Entity.Owner.Equipment.TotalStars >= val.StarReq)
                        {
                            if (
val.AttributeNum <= 16)
                            {
                                if (
val.AttributeNum == (uint)effect)
                                {
                                    
chance += (byte)val.Value;
                                }
                            }
                        }
                    }
                }
            }
        }
        public 
byte GetChance(Client.GameState clientGame.Enums.PerfectionEffect effect)
        {
            if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 0) return 0;
            
byte Chance 10;
            if (
effect == Game.Enums.PerfectionEffect.CalmWind)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 3Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 90Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 170Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 250Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 285Chance += 1;
            }

            if (
effect == Game.Enums.PerfectionEffect.BloodSpawn)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 40Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 240Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 288Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.DivineGuard)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 40Chance += 5;
            }
            if (
effect == Game.Enums.PerfectionEffect.CoreStrike)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 50Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 80Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 135Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 205Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 245Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.DrainingTouch)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 35Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 220Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 276Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.FreeSoul)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 25Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 95Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 130Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 195Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 279Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.InvisibleArrow)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 65Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 225Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 282Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.KillingFlash)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 55Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 165Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 294Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.LightofStamina)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 1Chance += 5;
            }
            if (
effect == Game.Enums.PerfectionEffect.LuckyStrike)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 15Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 115Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 215Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 314Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 320Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.MirrorofSin)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 60Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 190Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 291Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.ShieldBreak)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 155 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 254Chance += 50 100;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 255 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 296Chance += 70 100;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 297 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 311Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 312 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 321Chance += 150 100;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 322 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 322Chance += 2;
            }
            if (
effect == Game.Enums.PerfectionEffect.StraightLife)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 30Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 125Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 210Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 265Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 303Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.Stricklock)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 30Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 125Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 210Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 265Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 303Chance += 1;
            }
            return 
Chance;
        }
        public static 
void DoEffects1(Entity attackerEntity attackedAttack attackref uint damageDatabase.SpellInformation spell)
        {
            if (
attacker != null && attacked != null && attack != null)
                if (
attacker.Owner != null && attacked.Owner != null && attack != null)
                {
                    if (
spell != null && (spell.ID == 6001 || spell.ID == 11230))
                        if (
Kernel.ChanceSuccess(attacked.ToxinEraserLevel))
                        {
                            
damage attack.Damage 0;
                            
attacked.ToxicFogLeft 0;
                            
_String str = new _String(true);
                            
str.UID attacked.UID;
                            
str.TextsCount 1;
                            
str.Type = (int)_String.Effect;
                            
str.Texts.Add("poisonmiss");
                            
attacked.Owner.SendScreen(strtrue);
                            
attacked.Owner.SendScreen(new CMsgRefineEffect(attacked.UIDRefineEffects.ToxinEraserLevel), true);
                            return;
                        }
                    if (
Kernel.Rate(attacked.StrikeLockLevel))
                    {
                        
damage /= 10;
                        
attacked.Owner.SendScreen(new CMsgRefineEffect(attacked.UIDRefineEffects.StrikeLockLevel), true);
                        return;
                    }
                    if (
Kernel.Rate(attacker.LuckyStrike))
                    {
                        
damage *= 2;
                        
attack.Damage damage;
                        
Network.Writer.WriteUInt16((ushort)(<< 10), 36attack.ToArray());
                        
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UIDRefineEffects.LuckyStrike), true);
                        return;
                    }
                    if (
Kernel.Rate(attacker.CalmWind))
                    {
                        
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UIDRefineEffects.CalmWind), true);
                        return;
                    }
                    if (
Kernel.Rate(attacker.DrainingTouch))
                    {
                        
attacker.Hitpoints attacker.MaxHitpoints;
                        
attacker.Mana attacker.MaxMana;
                        
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UIDRefineEffects.DrainingTouch), true);
                        return;
                    }
                    if (
Kernel.Rate(attacked.BloodSpawn))
                    {
                        
attacked.Hitpoints attacked.MaxHitpoints;
                        
attacked.Mana attacked.MaxMana;
                        
attacked.Owner.SendScreen(new CMsgRefineEffect(attacked.UIDRefineEffects.BloodSpawn), true);
                        return;
                    }
                    if (
attacker != null && attacked != null)
                        if (
attacker.TempPerfection attacked.TempPerfection)
                        {
                            
attacker.Stamina += 100;
                            
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UIDRefineEffects.LightOfStamina), true);
                            return;
                        }
                    if (
attacked == null true attacker.TempPerfection attacked.TempPerfection)
                        if (
Kernel.Rate(attacker.ShiledBreak))
                        {
                            
attacked.BlockBreak attacked.Block;
                            
attacked.Block /= 2;
                            
attacked.Owner.SendScreen(new CMsgRefineEffect(attacked.UIDRefineEffects.ShiledBreak), true);
                            
attacked.AddFlag3((ulong)Network.GamePackets.Update.Flags3.ShieldBreak);
                            
attacked.ShieldBreak Time32.Now;
                            return;
                        }
                    if (
Kernel.Rate(attacker.KillingFlash))
                    {
                        
attacker.Owner.Entity.AddFlag((ulong)Network.GamePackets.Update.Flags.XPList);
                        
attacker.Owner.XPListStamp Time32.Now;
                        
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UIDRefineEffects.KillingFlash), true);
                        return;
                    }
                    if (
Kernel.Rate(attacked.MirrorOfSin))
                    {
                        
attacked.Owner.Entity.AddFlag((ulong)Network.GamePackets.Update.Flags.XPList);
                        
attacked.Owner.XPListStamp Time32.Now;
                        
attacked.Owner.SendScreen(new CMsgRefineEffect(attacked.UIDRefineEffects.MirrorOfSin), true);
                        return;
                    }
                    if (
attacker.TempPerfection attacked.TempPerfection)
                    {
                        if (
Kernel.Rate(attacker.DivineGuard))
                        {
                            
attacker.GuardDefense attacker.Defence;
                            
attacker.Defence += (ushort)((attacker.Defence 10) / 100);
                            
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UIDRefineEffects.DivineGuard), true);
                            
attacker.AddFlag3((ulong)Network.GamePackets.Update.Flags3.DivineGuard);
                            
attacker.GuardDefenseStamp Time32.Now;
                            return;
                        }
                    }
                    if (
attacker != null && attack.AttackType == Attack.Magic)
                        if (
Kernel.Rate(attacker.CoreStrike))
                        {
                            
attack.Effect1 Attack.AttackEffects1.CriticalStrike;
                            
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UIDRefineEffects.CoreStrike), true);
                            return;
                        }
                    if (
Kernel.Rate(attacker.InvisableArrow))
                    {
                        
damage += (uint)(damage 10) / 100;
                        
attack.Effect1 Attack.AttackEffects1.Penetration;
                        
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UIDRefineEffects.InvisbleArrow), true);
                        return;
                    }
                    if (
attacked.EntityFlag == EntityFlag.Entity)
                    {
                        if (
Kernel.Rate(attacker.FreeSoul))
                        {
                            if (
attacked.ContainsFlag2((ulong)Network.GamePackets.Update.Flags2.SoulShackle))
                                
attacked.RemoveFlag2((ulong)Network.GamePackets.Update.Flags2.SoulShackle);
                            
attacked.Owner.SendScreen(new CMsgRefineEffect(attacked.UIDRefineEffects.FreeSoul), true);
                            return;
                        }

                        if (
damage >= attacked.Hitpoints && attacked != null)
                            if (
Kernel.Rate(attacked.StraightLife))
                            {
                                
attacked.BringToLife();
                                
attacked.Owner.SendScreen(new CMsgRefineEffect(attacked.UIDRefineEffects.StraightLife), true);
                                return;
                            }
                    }
                    try
                    {
                        if (
attack != null && attacker != null && attacker != null && attacker.Owner != null && attacker.Owner.Equipment != null
                            
&& (attacked == null || attacked.Owner == null || attacked.Owner.Equipment != null) ? true attacker.TempPerfection >
                            
attacked.TempPerfection)
                            if (
Kernel.Rate(attacker.AbsoluteLuck))
                            {
                                
damage *= 2;
                                
Network.Writer.WriteUInt16((ushort)(<< 10), 36attack.ToArray());
                                
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UIDRefineEffects.AbsoluteLuck), true);
                                
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UIDRefineEffects.LuckyStrike), true);
                                return;
                            }
                    }
                    catch { }
                }
        }
        public 
void SendEffect(Game.Entity attackerGame.Entity attackedGame.Enums.PerfectionEffect effect)
        {

            if (
attacker == null || attacked == null) return;
            var 
proto = new MsgRefineEffectProto();
            
proto.AttackerUID attacker.UID;
            if (
attacked.EntityFlag == Game.EntityFlag.Entity)
                
proto.AttackedUID attacked.UID;
            else if (
attacked.EntityFlag == Game.EntityFlag.Monster && attacked != null && attacked.UID != 0)
            {
                
proto.AttackedUID attacked.UID;
            }
            
proto.Effect = (uint)effect;
            var 
proto2 Kernel.FinalizeProtoBuf(proto3254);
            
attacker.Owner.SendScreen(proto2true);
            if (
effect == Game.Enums.PerfectionEffect.DrainingTouch)
            {
                
attacker.Hitpoints attacker.MaxHitpoints;
            }
            if (
effect == Game.Enums.PerfectionEffect.KillingFlash)
            {
                
attacker.AddFlag((ulong)Network.GamePackets.Update.Flags.XPList);

                
attacker.Owner.XPListStamp Time32.Now;
            }
            if (
effect == Game.Enums.PerfectionEffect.DivineGuard)
            {
                
attacker.AddFlag3((ulong)Network.GamePackets.Update.Flags3.DivineGuard);
                
attacker.Defence = (ushort)(((attacker.Defence) * 20) / 100);
                
attacker.DivineGuardStamp Time32.Now;
            }
            if (
effect == Game.Enums.PerfectionEffect.ShieldBreak)
            {
                
attacker.AddFlag3((ulong)Network.GamePackets.Update.Flags3.ShieldBreak);
                
attacker.ShieldBreakStamp Time32.Now;
                
attacker.Block += (ushort)(((attacker.Block) * 2) / 10);
            }
            if (
effect == Game.Enums.PerfectionEffect.StraightLife)
            {
                
attacker.BringToLife();
            }
            if (
effect == Game.Enums.PerfectionEffect.LightofStamina && attacked.EntityFlag == Game.EntityFlag.Entity && attacker.Owner.Equipment.GetFullEquipmentPerfecetionLevelPoints attacked.Owner.Equipment.GetFullEquipmentPerfecetionLevelPoints || effect == Game.Enums.PerfectionEffect.LightofStamina && attacked.EntityFlag == Game.EntityFlag.Monsterattacker.Stamina 100;
        }
        public 
void GenerateEffectandChance(Client.GameState clientref Game.Enums.PerfectionEffect effectref byte chance)
        {
            
effect = (Game.Enums.PerfectionEffect)Kernel.Random.Next(314);
            
chance GetChance(clienteffect);
            while (
chance == 10)
            {
                
effect = (Game.Enums.PerfectionEffect)Kernel.Random.Next(314);
                
chance GetChance(clienteffect);
            }
        }
        public 
void HandleStraightLife(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.StraightLife);
        }
        public 
void HandleStrickeLock(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.Stricklock);
        }
        public 
void HandleLuckyStrike(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.LuckyStrike);
        }
        public 
void HandleMirror(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.MirrorofSin);
        }
        public 
void HandleBloodSpawn(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.BloodSpawn);
        }
        public 
void HandleFreeSoul(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.FreeSoul);
        }
    }


اتفضل ياحب

قديم 2019-10-06, 12:09 PM
المشاركة 6
ابو مروان
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: لو سمحتو حل للمشكلتين دول وياريت نزول حلهم فى قسم التطوير
???????????????

قديم 2019-10-06, 12:14 PM
المشاركة 7
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: لو سمحتو حل للمشكلتين دول وياريت نزول حلهم فى قسم التطوير
جرب و قولي


كود:
using ProtoBuf;
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Collections.Concurrent;
using System.Text;
using MessiProject;
using MessiProject.Database;
using System.Threading.Tasks;

namespace 
MessiProject.Network.GamePackets
{
    public class 
MsgUserAbilityScore
    
{
        public 
MsgUserAbilityScore() { }
        public 
MsgUserAbilityScoreProto Info;
        [
ProtoContract]
        public class 
MsgUserAbilityScoreProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint UID;
            [
ProtoMember(3IsRequired true)]
            public 
uint Level;
            [
ProtoMember(4IsRequired true)]
            public 
Scores[] Scores;
        }
        [
ProtoContract]
        public class 
Scores
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint Type;
            [
ProtoMember(2IsRequired true)]
            public 
uint Score;
        }
        public static 
ConcurrentDictionary<uintGame.EntityRankingList;
        public 
void GetRankingList()
        {
            
RankingList = new ConcurrentDictionary<uintGame.Entity>();
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("entities"))
            
using (var reader = new MySqlReader(cmd))
            {
                while (
reader.Read())
                {
                    if (
reader.ReadUInt32("TotalPerfectionScore") < 20000) continue;
                    
Game.Entity client = new Game.Entity(Game.EntityFlag.Entityfalse);
                    
client.Name reader.ReadString("Name");
                    
client.UID reader.ReadUInt32("UID");
                    
client.Level reader.ReadByte("Level");
                    
client.Class = reader.ReadByte("Class");
                    
client.Body reader.ReadUInt16("Body");
                    
client.Face reader.ReadUInt16("Face");
                    
client.TotalPerfectionScore reader.ReadUInt32("TotalPerfectionScore");
                    if (
reader.ReadString("Wardrobe") != "")
                    {
                        if (
reader.ReadString("Wardrobe").Contains("~"))
                        {
                            var 
wing reader.ReadString("Wardrobe").Split('~')[0];
                            
int type Convert.ToInt32(wing.Split('-')[0]);
                            
int id Convert.ToInt32(wing.Split('-')[1]);
                            
client.EquippedWing StorageManager.Wing<int>(typeid);
                            var 
title reader.ReadString("Wardrobe").Split('~')[1];
                            
int type2 Convert.ToInt32(title.Split('-')[0]);
                            
int id2 Convert.ToInt32(title.Split('-')[1]);
                            
client.EquippedTitle StorageManager.Title<int>(type2id2);
                        }
                    }
                    
RankingList.Add(client.UIDKernel.GamePool.ContainsKey(client.UID) ? Kernel.GamePool[client.UID].Entity client);
                }
            }
        }
        public 
bool Read(byte[] packet)
        {
            try
            {
                var 
mypkt = new byte[packet.Length 4];
                Array.
Copy(packet4mypkt0mypkt.Length);
                
using (var memoryStream = new MemoryStream(packet))
                {
                    
Info Serializer.DeserializeWithLengthPrefix<MsgUserAbilityScoreProto>(memoryStreamPrefixStyle.Fixed32);
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
                return 
false;
            }
            return 
true;
        }
        public 
void SendScore(Client.GameState clientClient.GameState Observer)
        {
            var 
packet = new MsgUserAbilityScoreProto();
            
packet.ActionId 0;
            
packet.UID client.Entity.UID;
            
packet.Level client.Entity.Level;
            
packet.Scores = new Scores[20];
            for (
int i 0packet.Scores.Lengthi++)
            {
                
byte Type = (byte)(1);
                
packet.Scores[i] = new Scores();
                
packet.Scores[i].Type Type;
                
packet.Scores[i].Score GetScoreValue(clientType);
            }


            var 
proto Kernel.FinalizeProtoBuf(packet3253);
            
Observer.Send(proto);
        }
        public 
uint GetScoreValue(Client.GameState clientuint Type)
        {
            
uint Score 0;
            if (
Type == 1Score = (uint)MsgUserAbilityScore.CalculatePerfectionJiangPoints(client);
            if (
Type == 2Score = (uint)MsgUserAbilityScore.CalculatePerfectionChiPoints(client);
            if (
Type == 3Score = (uint)(client.Entity.InnerPower != null client.Entity.InnerPower.TotalScore 0);
            if (
Type == 4Score client.Equipment.GetFullEquipmentEnchantPoints;
            if (
Type == 5Score = (uint)(client.Entity.Level 140 client.Entity.Level 20 client.Entity.Level 25);
            if (
Type == 6Score client.Equipment.GetFullEquipmentPerfecetionLevelPoints;
            if (
Type == 7Score = (uint)((client.Entity.Vitality client.Entity.Atributes client.Entity.Spirit client.Entity.Strength client.Entity.Agility) * 5);
            if (
Type == 8Score = (uint)(client.Entity.Reborn 1000);
            if (
Type == 9Score client.Equipment.GetFullEquipmentEnumPoints;
            if (
Type == 10Score client.Equipment.GetFullEquipmentSocketPoints;
            if (
Type == 11Score client.Equipment.GetFullEquipmentGemPoints;
            if (
Type == 12Score client.Equipment.GetFullEquipmentRefinePoints;
            if (
Type == 13Score client.Equipment.GetFullEquipmentPlusPoints;
            if (
Type == 14Score client.Equipment.GetFullEquipmentSoulPoints;
            if (
Type == 15Score client.Equipment.GetFullEquipmentBlessPoints;
            if (
Type == 16Score CalculateSubClassPoints(client);
            if (
Type == 17Score Database.WardrobeTable.PerfectionPoints(clienttrue);
            if (
Type == 18Score Database.WardrobeTable.PerfectionPoints(clientfalse);
            if (
Type == 19Score = (uint)((uint)client.Entity.NobilityRank 1000);
            if (
Type == 20Score client.Equipment.GetFullEquipmentLevelPoints;
            return 
Score;
        }
        public 
void Handle(Client.GameState client)
        {
            switch (
Info.ActionId)
            {
                case 
1://Observ
                    
{
                        if (
Kernel.GamePool.ContainsKey(Info.UID))
                        {
                            
SendScore(clientclient);
                            
SendScore(Kernel.GamePool[Info.UID], client);
                        }
                        else
                        {
                            
client.Send(Kernel.FinalizeProtoBuf(new MsgUserAbilityScoreProto()
                            {
                                
ActionId 1,
                                
UID 0
                            
}, 3253));
                        }
                        break;
                    }
            }
        }
        public static 
int CalculatePerfectionChiPoints(Client.GameState client)
        {
            if (
client == null || client.ChiData == null || client.ChiData.Powers == null)
                return 
0;

            
int Point 0;
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 1) break;
                
Point += ((client.ChiData.Powers[0].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[0].Attributes[i].Type)) * 100) * 60;
            }
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 2) break;
                
Point += ((client.ChiData.Powers[1].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[1].Attributes[i].Type)) * 100) * 60;
            }
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 3) break;
                
Point += ((client.ChiData.Powers[2].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[2].Attributes[i].Type)) * 100) * 60;
            }
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 4) break;
                
Point += ((client.ChiData.Powers[3].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[3].Attributes[i].Type)) * 100) * 60;
            }
            return 
Point;
        }
        
/*public static int CalculatePerfectionChiPoints(Client.GameState client)
        {
            int Point = 0;
            for (int i = 0; i < 4; i++)
            {
                if (client.ChiData.Powers.Count < 1) break;
                Point += ((client.ChiData.Powers[0].Attributes[i].Value / Game.Enums.ChiMaxValues(client.ChiData.Powers[0].Attributes[i].Type)) * 100) * 60;
            }
            for (int i = 0; i < 4; i++)
            {
                if (client.ChiData.Powers.Count < 2) break;
                Point += ((client.ChiData.Powers[1].Attributes[i].Value / Game.Enums.ChiMaxValues(client.ChiData.Powers[1].Attributes[i].Type)) * 100) * 60;
            }
            for (int i = 0; i < 4; i++)
            {
                if (client.ChiData.Powers.Count < 3) break;
                Point += ((client.ChiData.Powers[2].Attributes[i].Value / Game.Enums.ChiMaxValues(client.ChiData.Powers[2].Attributes[i].Type)) * 100) * 60;
            }
            for (int i = 0; i < 4; i++)
            {
                if (client.ChiData.Powers.Count < 4) break;
                Point += ((client.ChiData.Powers[3].Attributes[i].Value / Game.Enums.ChiMaxValues(client.ChiData.Powers[3].Attributes[i].Type)) * 100) * 60;
            }
            return Point;
        }*/
        
public static int CalculatePerfectionJiangPoints(Client.GameState client)
        {
            
int Points 0;
            if (
client.Entity.MyJiang != null)
            {
                if (
client.Entity.MyJiang.Inner_Strength == 0) return Points;
                if (
client.Entity.MyJiang.Inner_Strength <= 16200Points = (int)(client.Entity.MyJiang.Inner_Strength 0.3);
                else if (
client.Entity.MyJiang.Inner_Strength <= 40500Points = (int)(client.Entity.MyJiang.Inner_Strength 0.33);
                else if (
client.Entity.MyJiang.Inner_Strength <= 60750Points = (int)(client.Entity.MyJiang.Inner_Strength 0.36);
                else if (
client.Entity.MyJiang.Inner_Strength <= 72000Points = (int)(client.Entity.MyJiang.Inner_Strength 0.40);
                else if (
client.Entity.MyJiang.Inner_Strength <= 79200Points = (int)(client.Entity.MyJiang.Inner_Strength 0.45);
                else if (
client.Entity.MyJiang.Inner_Strength <= 80800Points = (int)(client.Entity.MyJiang.Inner_Strength 0.50);
                else if (
client.Entity.MyJiang.Inner_Strength <= 81000Points = (int)(client.Entity.MyJiang.Inner_Strength 0.60);
            }
            return 
Points;
        }
        public static 
uint CalculateSubClassPoints(Client.GameState client)
        {
            
uint Points 0;
            if (
client.Entity.SubClasses.Classes != null)
            {
                foreach (var 
sub in client.Entity.SubClasses.Classes.Values)
                {
                    if (
sub == null) continue;
                    
Points += (uint)(sub.Level == 1000 sub.Level 100);
                }
            }
            return 
Points;
        }
        public static 
uint CalculatePerfectionItemPoints(ConquerItem item)
        {
            
uint Points 50;
            if (
item == null || !Database.ConquerItemInformation.BaseInformations.ContainsKey(item.ID)) return 50;
            
            
#region edited by Rider  Plus
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.Plus == 1Points += 200;
                if (
item.Plus == 2Points += 600;
                if (
item.Plus == 3Points += 1200;
                if (
item.Plus == 4Points += 1800;
                if (
item.Plus == 5Points += 2600;
                if (
item.Plus == 6Points += 3500;
                if (
item.Plus == 7Points += 4800;
                if (
item.Plus == 8Points += 5800;
                if (
item.Plus == 9Points += 6800;
                if (
item.Plus == 10Points += 7800;
                if (
item.Plus == 11Points += 8800;
                if (
item.Plus == 12Points += 10000;
            }
            else
                foreach (
Client.GameState Owner in Program.Values)
                {
                    var 
Owner.Equipment.TryGetItem(ConquerItem.LeftWeapon);
                
                if (
Network.PacketHandler.IsTwoHand(item.ID) &&  (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null )
            {
                   
                if (
item.Plus == 1Points += 400;
                if (
item.Plus == 2Points += 1200;
                if (
item.Plus == 3Points += 2400;
                if (
item.Plus == 4Points += 3600;
                if (
item.Plus == 5Points += 5200;
                if (
item.Plus == 6Points += 7000;
                if (
item.Plus == 7Points += 9600;
                if (
item.Plus == 8Points += 11600;
                if (
item.Plus == 9Points += 13600;
                if (
item.Plus == 10Points += 15600;
                if (
item.Plus == 11Points += 17600;
                if (
item.Plus == 12Points += 20000;
            }
else
                {

                    if (
item.Plus == 1Points += 200;
                    if (
item.Plus == 2Points += 600;
                    if (
item.Plus == 3Points += 1200;
                    if (
item.Plus == 4Points += 1800;
                    if (
item.Plus == 5Points += 2600;
                    if (
item.Plus == 6Points += 3500;
                    if (
item.Plus == 7Points += 4800;
                    if (
item.Plus == 8Points += 5800;
                    if (
item.Plus == 9Points += 6800;
                    if (
item.Plus == 10Points += 7800;
                    if (
item.Plus == 11Points += 8800;
                    if (
item.Plus == 12Points += 10000;
                }
            
#endregion
            #region edited by Rider  Quality 
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.ID 10 == 9Points += 500;
                if (
item.ID 10 == 8Points += 300;
                if (
item.ID 10 == 7Points += 200;
                if (
item.ID 10 == 6Points += 100;
                if (
item.ID 10 && item.ID 10 6Points += 50;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.ID 10 == 9Points += 1000;
                if (
item.ID 10 == 8Points += 600;
                if (
item.ID 10 == 7Points += 400;
                if (
item.ID 10 == 6Points += 200;
                if (
item.ID 10 && item.ID 10 6Points += 100;
            }
            else
            {
                if (
item.ID 10 == 9Points += 500;
                if (
item.ID 10 == 8Points += 300;
                if (
item.ID 10 == 7Points += 200;
                if (
item.ID 10 == 6Points += 100;
                if (
item.ID 10 && item.ID 10 6Points += 50;
            }
            
#endregion
            #region edited by Rider  Soul
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.Purification.PurificationLevel == 1Points += 100;
                if (
item.Purification.PurificationLevel == 2Points += 300;
                if (
item.Purification.PurificationLevel == 3Points += 500;
                if (
item.Purification.PurificationLevel == 4Points += 800;
                if (
item.Purification.PurificationLevel == 5Points += 1200;
                if (
item.Purification.PurificationLevel == 6Points += 1600;
                if (
item.Purification.PurificationLevel == 7Points += 2000;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.Purification.PurificationLevel == 1Points += 200;
                if (
item.Purification.PurificationLevel == 2Points += 600;
                if (
item.Purification.PurificationLevel == 3Points += 1000;
                if (
item.Purification.PurificationLevel == 4Points += 1600;
                if (
item.Purification.PurificationLevel == 5Points += 2400;
                if (
item.Purification.PurificationLevel == 6Points += 3200;
                if (
item.Purification.PurificationLevel == 7Points += 4000;
            }
            else
            {
                if (
item.Purification.PurificationLevel == 1Points += 100;
                if (
item.Purification.PurificationLevel == 2Points += 300;
                if (
item.Purification.PurificationLevel == 3Points += 500;
                if (
item.Purification.PurificationLevel == 4Points += 800;
                if (
item.Purification.PurificationLevel == 5Points += 1200;
                if (
item.Purification.PurificationLevel == 6Points += 1600;
                if (
item.Purification.PurificationLevel == 7Points += 2000;
            }
            
#endregion
            #region edited by Rider  Bless
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                
Points += (uint)(item.Bless 100);
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                
Points += (uint)(item.Bless 200);
            }
            else
            {
                
Points += (uint)(item.Bless 100);
            }
            
#region edited by Rider  Refine
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.ExtraEffect.EffectLevel == 1Points += 100;
                if (
item.ExtraEffect.EffectLevel == 2Points += 400;
                if (
item.ExtraEffect.EffectLevel == 3Points += 800;
                if (
item.ExtraEffect.EffectLevel == 4Points += 1200;
                if (
item.ExtraEffect.EffectLevel == 5Points += 1600;
                if (
item.ExtraEffect.EffectLevel == 6Points += 2000;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.ExtraEffect.EffectLevel == 1Points += 200;
                if (
item.ExtraEffect.EffectLevel == 2Points += 800;
                if (
item.ExtraEffect.EffectLevel == 3Points += 1600;
                if (
item.ExtraEffect.EffectLevel == 4Points += 2400;
                if (
item.ExtraEffect.EffectLevel == 5Points += 3200;
                if (
item.ExtraEffect.EffectLevel == 6Points += 4000;
            }
            else
            {
                if (
item.ExtraEffect.EffectLevel == 1Points += 100;
                if (
item.ExtraEffect.EffectLevel == 2Points += 400;
                if (
item.ExtraEffect.EffectLevel == 3Points += 800;
                if (
item.ExtraEffect.EffectLevel == 4Points += 1200;
                if (
item.ExtraEffect.EffectLevel == 5Points += 1600;
                if (
item.ExtraEffect.EffectLevel == 6Points += 2000;
            }
            
#endregion
            #endregion
            #region edited by Rider  Level
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                var 
lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
                if (
lvl <= 120)
                    
Points += lvl 3;
                else if (
lvl <= 130)
                    
Points += lvl 5;
                else if (
lvl <= 140)
                    
Points += lvl 6;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                var 
lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
                if (
lvl <= 120)
                    
Points += lvl 6;
                else if (
lvl <= 130)
                    
Points += lvl 10;
                else if (
lvl <= 140)
                    
Points += lvl 12;
            }
            else
            {
                var 
lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
                if (
lvl <= 120)
                    
Points += lvl 3;
                else if (
lvl <= 130)
                    
Points += lvl 5;
                else if (
lvl <= 140)
                    
Points += lvl 6;
            }
            
#endregion
            #region edited by Rider  Gem
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.SocketOne != (Game.Enums.Gem)0)
                {
                    if (
item.SocketOne2 10 == 1Points += 200;
                    if (
item.SocketOne2 10 == 2Points += 500;
                    if (
item.SocketOne2 10 == 3Points += 800;
                }
                if (
item.SocketTwo != (Game.Enums.Gem)0)
                {
                    if (
item.SocketTwo2 10 == 1Points += 200;
                    if (
item.SocketTwo2 10 == 2Points += 500;
                    if (
item.SocketTwo2 10 == 3Points += 800;
                }
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.SocketOne != (Game.Enums.Gem)0)
                {
                    if (
item.SocketOne2 10 == 1Points += 400;
                    if (
item.SocketOne2 10 == 2Points += 1000;
                    if (
item.SocketOne2 10 == 3Points += 1600;
                }
                if (
item.SocketTwo != (Game.Enums.Gem)0)
                {
                    if (
item.SocketTwo2 10 == 1Points += 400;
                    if (
item.SocketTwo2 10 == 2Points += 1000;
                    if (
item.SocketTwo2 10 == 3Points += 1600;
                }
            }
            else
            {
                if (
item.SocketOne != (Game.Enums.Gem)0)
                {
                    if (
item.SocketOne2 10 == 1Points += 200;
                    if (
item.SocketOne2 10 == 2Points += 500;
                    if (
item.SocketOne2 10 == 3Points += 800;
                }
                if (
item.SocketTwo != (Game.Enums.Gem)0)
                {
                    if (
item.SocketTwo2 10 == 1Points += 200;
                    if (
item.SocketTwo2 10 == 2Points += 500;
                    if (
item.SocketTwo2 10 == 3Points += 800;
                }
            }
            
#endregion
            #region edited by Rider  Stars
            
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.Stars >= 1Points += 180;
                if (
item.Stars >= 2Points += 180;
                if (
item.Stars >= 3Points += 180;
                if (
item.Stars >= 4Points += 180;
                if (
item.Stars >= 5Points += 180;
                if (
item.Stars >= 6Points += 180;
                if (
item.Stars >= 7Points += 180;
                if (
item.Stars >= 8Points += 180;
                if (
item.Stars >= 9Points += 180;
                if (
item.Stars >= 10Points += 2380;
                if (
item.Stars >= 11Points += 400;
                if (
item.Stars >= 12Points += 400;
                if (
item.Stars >= 13Points += 400;
                if (
item.Stars >= 14Points += 400;
                if (
item.Stars >= 15Points += 400;
                if (
item.Stars >= 16Points += 400;
                if (
item.Stars >= 17Points += 400;
                if (
item.Stars >= 18Points += 400;
                if (
item.Stars >= 19Points += 5150;
                if (
item.Stars >= 20Points += 650;
                if (
item.Stars >= 21Points += 650;
                if (
item.Stars >= 22Points += 650;
                if (
item.Stars >= 23Points += 650;
                if (
item.Stars >= 24Points += 650;
                if (
item.Stars >= 25Points += 650;
                if (
item.Stars >= 26Points += 650;
                if (
item.Stars >= 27Points += 650;
                if (
item.Stars >= 28Points += 100;
                if (
item.Stars >= 29Points += 100;
                if (
item.Stars >= 30Points += 100;
                if (
item.Stars >= 31Points += 100;
                if (
item.Stars >= 32Points += 100;
                if (
item.Stars >= 33Points += 100;
                if (
item.Stars >= 34Points += 100;
                if (
item.Stars >= 35Points += 100;
                if (
item.Stars >= 36Points += 100;
                if (
item.Stars >= 37Points += 100;
                if (
item.Stars >= 38Points += 100;
                if (
item.Stars >= 39Points += 100;
                if (
item.Stars >= 40Points += 100;
                if (
item.Stars >= 41Points += 100;
                if (
item.Stars >= 42Points += 100;
                if (
item.Stars >= 43Points += 100;
                if (
item.Stars >= 44Points += 100;
                if (
item.Stars >= 45Points += 100;
                if (
item.Stars >= 46Points += 100;
                if (
item.Stars >= 47Points += 100;
                if (
item.Stars >= 48Points += 100;
                if (
item.Stars >= 49Points += 100;
                if (
item.Stars >= 50Points += 100;
                if (
item.Stars >= 51Points += 100;
                if (
item.Stars >= 52Points += 100;
                if (
item.Stars >= 53Points += 100;
                if (
item.Stars >= 54Points += 100;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
            {
                if (
item.Stars >= 1Points += 180;
                if (
item.Stars >= 2Points += 180;
                if (
item.Stars >= 3Points += 180;
                if (
item.Stars >= 4Points += 180;
                if (
item.Stars >= 5Points += 180;
                if (
item.Stars >= 6Points += 180;
                if (
item.Stars >= 7Points += 180;
                if (
item.Stars >= 8Points += 180;
                if (
item.Stars >= 9Points += 180;
                if (
item.Stars >= 10Points += 2380;
                if (
item.Stars >= 11Points += 400;
                if (
item.Stars >= 12Points += 400;
                if (
item.Stars >= 13Points += 400;
                if (
item.Stars >= 14Points += 400;
                if (
item.Stars >= 15Points += 400;
                if (
item.Stars >= 16Points += 400;
                if (
item.Stars >= 17Points += 400;
                if (
item.Stars >= 18Points += 400;
                if (
item.Stars >= 19Points += 5150;
                if (
item.Stars >= 20Points += 650;
                if (
item.Stars >= 21Points += 650;
                if (
item.Stars >= 22Points += 650;
                if (
item.Stars >= 23Points += 650;
                if (
item.Stars >= 24Points += 650;
                if (
item.Stars >= 25Points += 650;
                if (
item.Stars >= 26Points += 650;
                if (
item.Stars >= 27Points += 650;
                if (
item.Stars >= 28Points += 100;
                if (
item.Stars >= 29Points += 100;
                if (
item.Stars >= 30Points += 100;
                if (
item.Stars >= 31Points += 100;
                if (
item.Stars >= 32Points += 100;
                if (
item.Stars >= 33Points += 100;
                if (
item.Stars >= 34Points += 100;
                if (
item.Stars >= 35Points += 100;
                if (
item.Stars >= 36Points += 100;
                if (
item.Stars >= 37Points += 100;
                if (
item.Stars >= 38Points += 100;
                if (
item.Stars >= 39Points += 100;
                if (
item.Stars >= 40Points += 100;
                if (
item.Stars >= 41Points += 100;
                if (
item.Stars >= 42Points += 100;
                if (
item.Stars >= 43Points += 100;
                if (
item.Stars >= 44Points += 100;
                if (
item.Stars >= 45Points += 100;
                if (
item.Stars >= 46Points += 100;
                if (
item.Stars >= 47Points += 100;
                if (
item.Stars >= 48Points += 100;
                if (
item.Stars >= 49Points += 100;
                if (
item.Stars >= 50Points += 100;
                if (
item.Stars >= 51Points += 100;
                if (
item.Stars >= 52Points += 100;
                if (
item.Stars >= 53Points += 100;
                if (
item.Stars >= 54Points += 100;

            }
            else
            {
                if (
item.Stars >= 1Points += 180;
            if (
item.Stars >= 2Points += 180;
            if (
item.Stars >= 3Points += 180;
            if (
item.Stars >= 4Points += 180;
            if (
item.Stars >= 5Points += 180;
            if (
item.Stars >= 6Points += 180;
            if (
item.Stars >= 7Points += 180;
            if (
item.Stars >= 8Points += 180;
            if (
item.Stars >= 9Points += 180;
            if (
item.Stars >= 10Points += 2380;
            if (
item.Stars >= 11Points += 400;
            if (
item.Stars >= 12Points += 400;
            if (
item.Stars >= 13Points += 400;
            if (
item.Stars >= 14Points += 400;
            if (
item.Stars >= 15Points += 400;
            if (
item.Stars >= 16Points += 400;
            if (
item.Stars >= 17Points += 400;
            if (
item.Stars >= 18Points += 400;
            if (
item.Stars >= 19Points += 5150;
            if (
item.Stars >= 20Points += 650;
            if (
item.Stars >= 21Points += 650;
            if (
item.Stars >= 22Points += 650;
            if (
item.Stars >= 23Points += 650;
            if (
item.Stars >= 24Points += 650;
            if (
item.Stars >= 25Points += 650;
            if (
item.Stars >= 26Points += 650;
            if (
item.Stars >= 27Points += 650;
            if (
item.Stars >= 28Points += 100;
            if (
item.Stars >= 29Points += 100;
            if (
item.Stars >= 30Points += 100;
            if (
item.Stars >= 31Points += 100;
            if (
item.Stars >= 32Points += 100;
            if (
item.Stars >= 33Points += 100;
            if (
item.Stars >= 34Points += 100;
            if (
item.Stars >= 35Points += 100;
            if (
item.Stars >= 36Points += 100;
            if (
item.Stars >= 37Points += 100;
            if (
item.Stars >= 38Points += 100;
            if (
item.Stars >= 39Points += 100;
            if (
item.Stars >= 40Points += 100;
            if (
item.Stars >= 41Points += 100;
            if (
item.Stars >= 42Points += 100;
            if (
item.Stars >= 43Points += 100;
            if (
item.Stars >= 44Points += 100;
            if (
item.Stars >= 45Points += 100;
            if (
item.Stars >= 46Points += 100;
            if (
item.Stars >= 47Points += 100;
            if (
item.Stars >= 48Points += 100;
            if (
item.Stars >= 49Points += 100;
            if (
item.Stars >= 50Points += 100;
            if (
item.Stars >= 51Points += 100;
            if (
item.Stars >= 52Points += 100;
            if (
item.Stars >= 53Points += 100;
            if (
item.Stars >= 54Points += 100;
                }
            
#endregion
            #region edited by Rider  Socket
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.SocketOne != (Game.Enums.Gem)0Points += 1000;
                if (
item.SocketTwo != (Game.Enums.Gem)0Points += 2500;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.SocketOne != (Game.Enums.Gem)0Points += 2000;
                if (
item.SocketTwo != (Game.Enums.Gem)0Points += 5000;
            }
            else
            {
                if (
item.SocketOne != (Game.Enums.Gem)0Points += 1000;
                if (
item.SocketTwo != (Game.Enums.Gem)0Points += 2500;
            }
            
#endregion
            #region edited by Rider  Enchant
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                var 
enc = (uint)(item.Enchant);
                if (
enc != 0)
                {
                    if (
enc <= 200Points += enc 1;
                    if (
enc <= 240Points += (uint)(enc 1.3);
                    if (
enc <= 254Points += (uint)(enc 1.6);
                    if (
enc <= 255Points += enc 2;
                }
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                var 
enc = (uint)(item.Enchant);
                if (
enc != 0)
                {
                    if (
enc <= 200Points += enc 2;
                    if (
enc <= 240Points += (uint)(enc 2.6);
                    if (
enc <= 254Points += (uint)(enc 3.2);
                    if (
enc <= 255Points += enc 4;
                }
            }
            else
            {
                var 
enc = (uint)(item.Enchant);
                if (
enc != 0)
                {
                    if (
enc <= 200Points += enc 1;
                    if (
enc <= 240Points += (uint)(enc 1.3);
                    if (
enc <= 254Points += (uint)(enc 1.6);
                    if (
enc <= 255Points += enc 2;
                }
            }
            
#endregion
                
}
            return 
Points;
        }
    }
    public class 
MsgItemRefineOpt
    
{
        public 
MsgItemRefineOpt() { }
        public 
MsgItemRefineOptProto Info;
        public 
MsgItemRefineOptProto2 Info2;
        [
ProtoContract]
        public class 
MsgItemRefineOptProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint ItemUID;
            [
ProtoMember(3IsRequired true)]
            public 
string Signature;
            [
ProtoMember(4IsRequired true)]
            public 
uint ItemPlusUID;
        }
        [
ProtoContract]
        public class 
MsgItemRefineOptProto2
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ItemUID;
            [
ProtoMember(2IsRequired true)]
            public 
uint EntityUID;
            [
ProtoMember(3IsRequired true)]
            public 
uint Stars;
            [
ProtoMember(4IsRequired true)]
            public 
uint Progress;
            [
ProtoMember(5IsRequired true)]
            public 
uint OwnerUID;
            [
ProtoMember(6IsRequired true)]
            public 
string OwnerName;
        }
        public 
double GetPerfectionProgress(uint value)
        {
            return (
value 1.25);
        }
        public 
uint GetPerfectionProgress(ConquerItem item)
        {
            if (
item.Stars == 0) return 30;
            if (
item.Stars == 1) return 60;
            if (
item.Stars == 2) return 100;
            if (
item.Stars == 3) return 200;
            if (
item.Stars == 4) return 350;
            if (
item.Stars == 5) return 600;
            if (
item.Stars == 6) return 1000;
            if (
item.Stars == 7) return 1500;
            if (
item.Stars == 8) return 2300;
            if (
item.Stars == 9) return 3500;
            if (
item.Stars == 10) return 5000;
            if (
item.Stars == 11) return 6500;
            if (
item.Stars == 12) return 8000;
            if (
item.Stars == 13) return 9500;
            if (
item.Stars == 14) return 11000;
            return 
12000;
        }
        public 
uint GetPlusStonePoints(uint value)
        {
            if (
value == 3009000) return 10;
            if (
value == 3009001) return 100;
            if (
value == 3009002) return 1000;
            if (
value == 3009003) return 10000;
            if (
value == 730001 || value == 1) return 10;
            if (
value == 730002 || value == 2) return 40;
            if (
value == 730003 || value == 3) return 120;
            if (
value == 730004 || value == 4) return 360;
            if (
value == 730005 || value == 5) return 1080;
            if (
value == 730006 || value == 6) return 3240;
            if (
value == 730007 || value == 7) return 9720;
            if (
value == 730008 || value == 8) return 29160;
            if (
value == 9) return 87480;
            if (
value == 10) return 90180;
            if (
value == 11) return 95680;
            if (
value == 12) return 104680;
            return 
0;
        }
        public 
uint GetTransferCost(Network.GamePackets.ConquerItem item)
        {
            if (
item.Stars == 2) return 30;
            if (
item.Stars == 3) return 70;
            if (
item.Stars == 4) return 150;
            if (
item.Stars == 5) return 300;
            if (
item.Stars == 6) return 500;
            if (
item.Stars == 7) return 800;
            if (
item.Stars == 8) return 1100;
            if (
item.Stars >= 9) return 1500;
            return 
10;
        }
        public 
void Handle(Client.GameState clientbyte[] myPacket)
        {
            try
            {
                switch (
Info.ActionId)
                {
                    case 
0://Temper
                        
{
                            
#region edited by Rider  Minors
                            
var packet2 = new byte[myPacket.Length 4];
                            Array.
Copy(myPacket4packet20packet2.Length);
                            var 
variable Kernel.Read7BitEncodedInt(packet2).SelectMany(System.BitConverter.GetBytes).ToArray();
                            var 
variable2 = new byte[variable.Length 8];
                            Array.
Copy(variable8variable20variable.Length 8);
                            var 
MinorsCount = (variable2.Length 4);
                            
uint[] Minors = new uint[MinorsCount];
                            
byte x 0;
                            for (
int i 0MinorsCounti++)
                            {
                                
Minors[i] = BitConverter.ToUInt32(variable2x);
                                
+= 4;
                            }
                            
#endregion
                            
if (Minors != null)
                            {
                                
ConquerItem Item;
                                if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                                {
                                    foreach (var 
minor in Minors)
                                    {
                                        
ConquerItem ItemPlus;
                                        if (
client.Inventory.TryGetItem(minorout ItemPlus))
                                        {
                                            
Item.PerfectionProgress += GetPlusStonePoints(ItemPlus.ID == 300000 ItemPlus.Plus ItemPlus.ID)/*Database.PerfectionTable.CostList[ItemPlus.ID].Progress*/;
                                            
client.Inventory.Remove(minorGame.Enums.ItemUse.Removetrue);
                                        }
                                    }
                                    while (
Item.PerfectionProgress >= GetPerfectionProgress(Item)/*Database.PerfectionTable.UpgradeList.Where(i => i.Stars == (Item.Stars + 1)).FirstOrDefault().Progress*/)
                                    {
                                        
Item.PerfectionProgress -= GetPerfectionProgress(Item)/*Database.PerfectionTable.UpgradeList.Where(i => i.Stars == (Item.Stars + 1)).FirstOrDefault().Progress*/;
                                        
Item.Stars++;
                                    }
                                    while (
Item.Stars >= 54 && Item.PerfectionProgress 0)
                                    {
                                        
Item.Stars 54;
                                        
Item.PerfectionProgress 0;
                                    }
                                    
Item.Owner client.Entity.Name;
                                    
Item.OwnerUID client.Entity.UID;
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
client.LoadItemStats();
                                    
client.Send(proto);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                    new 
MsgUserTotalRefineLev().Send(client);

                                }
                            }

                            break;
                        }
                    case 
1://Transfer
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                            {
                                if (
client.Entity.BoundCps >= 50000)
                                {
                                    
client.Entity.BoundCps -= 50000;
                                    
Item.Owner client.Entity.Name;
                                    
Item.OwnerUID client.Entity.UID;
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
client.Send(proto);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                }
                            }
                            break;
                        }
                    case 
2://Signature
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                            {
                                if (
Item.Signature == String.Empty || Item.Signature == null)
                                {
                                    
Item.Signature Info.Signature;
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                }
                                else
                                {
                                    if (
client.Entity.ConquerPoints >= 270)
                                    {
                                        
client.Entity.ConquerPoints -= 270;
                                        
Item.Signature Info.Signature;
                                        
Item.Mode Game.Enums.ItemMode.Update;
                                        
Item.Send(client);
                                        var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                        {
                                            
ItemUID Item.UID,
                                            
EntityUID client.Entity.UID,
                                            
OwnerUID Item.OwnerUID,
                                            
OwnerName Item.Owner,
                                            
Progress Item.PerfectionProgress,
                                            
Stars Item.Stars
                                        
}), 3250);
                                        
Database.ConquerItemTable.UpdatePerfection(Item);
                                    }
                                    else if (
client.Entity.BoundCps >= 270)
                                    {
                                        
client.Entity.BoundCps -= 270;
                                        
Item.Signature Info.Signature;
                                        
Item.Mode Game.Enums.ItemMode.Update;
                                        
Item.Send(client);
                                        var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                        {
                                            
ItemUID Item.UID,
                                            
EntityUID client.Entity.UID,
                                            
OwnerUID Item.OwnerUID,
                                            
OwnerName Item.Owner,
                                            
Progress Item.PerfectionProgress,
                                            
Stars Item.Stars
                                        
}), 3250);
                                        
Database.ConquerItemTable.UpdatePerfection(Item);
                                    }
                                }

                            }
                            break;
                        }
                    case 
3://CPBoost
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item) && Item != null)
                            {
                                
uint value;
                                
value Math.Min(414112client.Entity.ConquerPoints);
                                if (
client.Entity.ConquerPoints >= value)
                                {
                                    
client.Entity.ConquerPoints -= value;
                                    
Item.Owner client.Entity.Name;
                                    
Item.OwnerUID client.Entity.UID;
                                    
Item.PerfectionProgress += (uint)GetPerfectionProgress(value);
                                    while (
Item.PerfectionProgress >= GetPerfectionProgress(Item))
                                    {
                                        
Item.PerfectionProgress -= GetPerfectionProgress(Item);
                                        
Item.Stars++;
                                    }
                                    while (
Item.Stars >= 54 && Item.PerfectionProgress 0)
                                    {
                                        
Item.Stars 54;
                                        
Item.PerfectionProgress 0;
                                    }
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
client.Send(proto);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                }
                            }
                            break;
                        }
                    case 
4://Exchange
                        
{
                            
ConquerItem Item;
                            
ConquerItem Item2;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item2) || client.Inventory.TryGetItem(Info.ItemUIDout Item2))
                            {
                                if (
client.Inventory.TryGetItem(Info.ItemPlusUIDout Item) || client.Equipment.TryGetItem(Info.ItemPlusUIDout Item))
                                {
                                    if (
client.Entity.BoundCps >= 200000)
                                    {
                                        
client.Entity.BoundCps -= 200000;
                                        
Item.PerfectionProgress Item2.PerfectionProgress;
                                        
Item.Stars Item2.Stars;
                                        
Item.Mode Game.Enums.ItemMode.Update;
                                        
Item.Send(client);
                                        
Item2.PerfectionProgress 0;
                                        
Item2.Stars 0;
                                        
Item2.Mode Game.Enums.ItemMode.Update;
                                        
Item2.Send(client);
                                        var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                        {
                                            
ItemUID Item.UID,
                                            
EntityUID client.Entity.UID,
                                            
OwnerUID Item.OwnerUID,
                                            
OwnerName Item.Owner,
                                            
Progress Item.PerfectionProgress,
                                            
Stars Item.Stars
                                        
}), 3250);
                                        
Database.ConquerItemTable.UpdatePerfection(Item);
                                    }
                                }
                            }
                            break;
                        }
                    case 
5://Quick
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                            {
                                if (
Item.PerfectionProgress == || Item.Stars >= 54) break;
                                
double percent = (double)Item.PerfectionProgress / (double)GetPerfectionProgress(Item) * 0;
                                if (
Kernel.Rate(percent))
                                {
                                    
Item.Stars++;
                                }
                                
Item.PerfectionProgress 0;
                                
Item.Owner client.Entity.Name;
                                
Item.OwnerUID client.Entity.UID;
                                
Item.Mode Game.Enums.ItemMode.Update;
                                
Item.Send(client);
                                var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                {
                                    
ItemUID Item.UID,
                                    
EntityUID client.Entity.UID,
                                    
OwnerUID Item.OwnerUID,
                                    
OwnerName Item.Owner,
                                    
Progress Item.PerfectionProgress,
                                    
Stars Item.Stars
                                
}), 3250);
                                
Database.ConquerItemTable.UpdatePerfection(Item);
                                
client.LoadItemStats();
                            }
                            break;
                        }
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
            }
        }
        public 
byte GetStars(byte Stars)
        {
            if (
Stars >= && Stars <= 8) return 9;
            if (
Stars >= && Stars <= 17) return 18;
            if (
Stars >= 18 && Stars <= 26) return 27;
            if (
Stars >= 27 && Stars <= 35) return 36;
            if (
Stars >= 36 && Stars <= 44) return 45;
            if (
Stars >= 45 && Stars <= 53) return 54;
            return 
0;
        }
        public 
byte[] GetBytes(string packetString)
        {
            if (
packetString != "" && packetString != null && packetString != string.Empty && packetString != " ")
            {
                
byte[] bytes = new byte[(packetString.Length 3) + 1];
                
int t 0;
                for (
int i 0packetString.Length+= 3)
                {
                    
string cha packetString.Substring(i2);
                    
bytes[t] = byte.Parse(chaSystem.Globalization.NumberStyles.HexNumber);
                    
t++;
                }
                return 
bytes;
            }
            return 
null;
        }
        public 
bool Read(byte[] packet)
        {
            try
            {
                var 
mypkt = new byte[packet.Length 4];
                Array.
Copy(packet4mypkt0mypkt.Length);
                
using (var memoryStream = new MemoryStream(packet))
                {
                    
Info Serializer.DeserializeWithLengthPrefix<MsgItemRefineOptProto>(memoryStreamPrefixStyle.Fixed32);
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
                return 
false;
            }
            return 
true;
        }
    }
    public class 
MsgItemRefineRecord
    
{
        public 
MsgItemRefineRecord() { }
        public 
MsgItemRefineRecordProto Info;
        [
ProtoContract]
        public class 
MsgItemRefineRecordProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint MaxStars;
        }
        public 
void Handle(Client.GameState client)
        {
            switch (
Info.ActionId)
            {
                case 
0:
                    {
                        
Send(client);
                        break;
                    }
            }
        }
        public 
void Send(Client.GameState client)
        {
            
client.Send(Kernel.FinalizeProtoBuf(new MsgItemRefineRecordProto()
            {
                
ActionId 0,
                
MaxStars 54
            
}, 3255));
        }
        public 
bool Read(byte[] packet)
        {
            var 
mypkt = new byte[packet.Length 4];
            Array.
Copy(packet4mypkt0mypkt.Length);
            
using (var memoryStream = new MemoryStream(packet))
            {
                
Info Serializer.DeserializeWithLengthPrefix<MsgItemRefineRecordProto>(memoryStreamPrefixStyle.Fixed32);
            }
            return 
true;
        }
    }
    public class 
MsgRankMemberShow
    
{
        public 
MsgRankMemberShow() { }
        public 
MsgRankMemberShowProto Info;
        [
ProtoContract]
        public class 
MsgRankMemberShowProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
MsgRankMemberShowProtoSer proto;
        }
        [
ProtoContract]
        public class 
MsgRankMemberShowProtoSer
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint dwParam;
            [
ProtoMember(2IsRequired true)]
            public 
uint Count;
            [
ProtoMember(3IsRequired true)]
            public 
uint UID;
            [
ProtoMember(4IsRequired true)]
            public 
string Name "";
            [
ProtoMember(5IsRequired true)]
            public 
string Guild "";
            [
ProtoMember(6IsRequired true)]
            public 
uint Mesh;
            [
ProtoMember(7IsRequired true)]
            public 
uint HairStyle;
            [
ProtoMember(8IsRequired true)]
            public 
uint Hat;
            [
ProtoMember(9IsRequired true)]
            public 
uint Garment;
            [
ProtoMember(10IsRequired true)]
            public 
uint LeftWep;
            [
ProtoMember(11IsRequired true)]
            public 
uint LeftWepAcc;
            [
ProtoMember(12IsRequired true)]
            public 
uint RightWep;
            [
ProtoMember(13IsRequired true)]
            public 
uint RightWepAcc;
            [
ProtoMember(14IsRequired true)]
            public 
uint MountArmor;
            [
ProtoMember(15IsRequired true)]
            public 
uint Flag;
            [
ProtoMember(16IsRequired true)]
            public 
uint Wing;
            [
ProtoMember(17IsRequired true)]
            public 
uint WingLevel;
            [
ProtoMember(18IsRequired true)]
            public 
uint Title;
            [
ProtoMember(19IsRequired true)]
            public 
uint Flag2;
            [
ProtoMember(20IsRequired true)]
            public 
uint Flag3;
            [
ProtoMember(21IsRequired true)]
            public 
uint Flag4;
        }
        public 
void UpdateBestEntity()
        {
            
DateTime StartTime DateTime.Now;
            
Items = new Dictionary<byteuint>();
            
BestEntity MsgUserAbilityScore.RankingList.OrderByDescending(=> i.Value.TotalPerfectionScore).ThenByDescending(=> i.Value.Level).ThenBy(=> i.Value.UID).FirstOrDefault().Value;
            if (
BestEntity == null) return;


            
byte[] Positions = new byte[10] { 134591215161719 };
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("items").Where("EntityID"BestEntity.UID))
            
using (var reader = new MySqlReader(cmd))
            {
                while (
reader.Read())
                {
                    foreach (var 
pos in Positions)
                    {
                        if (
reader.ReadByte("Position") == pos)
                        {
                            if (
Items.ContainsKey(pos)) Items.Remove(pos);
                            
Items.Add(posreader.ReadUInt32("ID"));
                            if (
pos == 19Items.Add(255reader.ReadByte("Plus"));
                            break;
                        }
                    }
                }
            }
            foreach (var 
pos in Positions)
            {
                if (!
Items.ContainsKey(pos)) Items.Add(pos0);
            }
            if (!
Items.ContainsKey(255)) Items.Add(2550);
        }
        public static 
Dictionary<byteuintItems = new Dictionary<byteuint>();
        public static 
Game.Entity BestEntity;
        public 
void Handle(Client.GameState client)
        {
            if (
BestEntity == null) return;
            switch (
Info.ActionId)
            {
                case 
0:
                    {
                        var 
proto2 = new MsgRankMemberShowProto();
                        
proto2.ActionId 0;
                        
proto2.proto = new MsgRankMemberShowProtoSer();
                        
proto2.proto.dwParam 1;
                        
proto2.proto.Count 1;
                        
proto2.proto.UID BestEntity.UID;
                        
#region edited by Rider  If He Is Online
                        
if (Kernel.GamePool.ContainsKey(BestEntity.UID))
                        {
                            var 
Entity Kernel.GamePool[BestEntity.UID].Entity;
                            
proto2.proto.HairStyle Entity.HairStyle;
                            
proto2.proto.Mesh Entity.Mesh;
                            
proto2.proto.Name Entity.Name;
                            if (
BestEntity.GuildID != 0)
                                
proto2.proto.Guild Kernel.Guilds[BestEntity.GuildID].Name;
                            if (
Entity.Owner.Equipment != null)
                            {
                                var 
Equipment Entity.Owner.Equipment;
                                
proto2.proto.Hat Equipment.TryGetItem((byte)ConquerItem.Head) != null Equipment.TryGetItem((byte)ConquerItem.Head).ID 0;
                                
proto2.proto.LeftWep Equipment.TryGetItem((byte)ConquerItem.LeftWeapon) != null Equipment.TryGetItem((byte)ConquerItem.LeftWeapon).ID 0;
                                
proto2.proto.LeftWepAcc Equipment.TryGetItem((byte)ConquerItem.LeftWeaponAccessory) != null Equipment.TryGetItem((byte)ConquerItem.LeftWeaponAccessory).ID 0;
                                
proto2.proto.MountArmor Equipment.TryGetItem((byte)ConquerItem.SteedArmor) != null Equipment.TryGetItem((byte)ConquerItem.SteedArmor).ID : (Equipment.TryGetItem((byte)ConquerItem.Steed) != null Equipment.TryGetItem((byte)ConquerItem.Steed).ID 0);
                                
proto2.proto.Garment Equipment.TryGetItem((byte)ConquerItem.Garment) != null Equipment.TryGetItem((byte)ConquerItem.Garment).ID : ((Equipment.TryGetItem((byte)ConquerItem.Armor) != null Equipment.TryGetItem((byte)ConquerItem.Armor).ID 0));
                                
proto2.proto.RightWep Equipment.TryGetItem((byte)ConquerItem.RightWeapon) != null Equipment.TryGetItem((byte)ConquerItem.RightWeapon).ID 0;
                                
proto2.proto.RightWepAcc Equipment.TryGetItem((byte)ConquerItem.RightWeaponAccessory) != null Equipment.TryGetItem((byte)ConquerItem.RightWeaponAccessory).ID 0;
                                
proto2.proto.Wing Entity.EquippedWing == ? (Equipment.TryGetItem((byte)ConquerItem.Wing) != null Equipment.TryGetItem((byte)ConquerItem.Wing).ID 0) : (uint)Entity.EquippedWing;
                                
proto2.proto.WingLevel = (byte)(Equipment.TryGetItem((byte)ConquerItem.Wing) != null Equipment.TryGetItem((byte)ConquerItem.Wing).Plus 0);
                            }
                            
proto2.proto.Title = (uint)Entity.EquippedTitle;
                            
proto2.proto.Flag = (uint)Entity.StatusFlag;
                            
proto2.proto.Flag2 = (uint)Entity.StatusFlag2;
                            
proto2.proto.Flag3 = (uint)Entity.StatusFlag3;
                            
//proto2.proto.Flag4 = (uint)Entity.StatusFlag4;
                            
client.Send(Kernel.FinalizeProtoBuf(proto23257));
                            break;
                        }
                        
#endregion
                        
proto2.proto.HairStyle BestEntity.HairStyle;
                        
proto2.proto.Mesh BestEntity.Mesh;
                        
proto2.proto.Name BestEntity.Name;
                        if (
BestEntity.GuildID != && Kernel.Guilds.ContainsKey(BestEntity.GuildID))
                            
proto2.proto.Guild Kernel.Guilds[BestEntity.GuildID].Name;
                        
proto2.proto.Hat Items[(byte)ConquerItem.Head];
                        
proto2.proto.LeftWep Items[(byte)ConquerItem.LeftWeapon];
                        
proto2.proto.LeftWepAcc Items[(byte)ConquerItem.LeftWeaponAccessory];
                        
proto2.proto.MountArmor Items[(byte)ConquerItem.SteedArmor] == Items[(byte)ConquerItem.Steed] : Items[(byte)ConquerItem.SteedArmor];
                        
proto2.proto.Garment Items[(byte)ConquerItem.Garment];
                        
proto2.proto.RightWep Items[(byte)ConquerItem.RightWeapon];
                        
proto2.proto.RightWepAcc Items[(byte)ConquerItem.RightWeaponAccessory];
                        
proto2.proto.Wing BestEntity.EquippedWing == Items[(byte)ConquerItem.Wing] : (uint)BestEntity.EquippedWing;
                        
proto2.proto.WingLevel Items[255];
                        
proto2.proto.Title = (uint)BestEntity.EquippedTitle;
                        
client.Send(Kernel.FinalizeProtoBuf(proto23257));
                        break;
                    }
                case 
1:
                    {
                        if (
Kernel.GamePool.ContainsKey(Info.proto == null Info.proto.dwParam))
                        {
                            
PacketHandler.ObserveEquipment(new Data(true) { ID 117UID client.Entity.UIDdwParam Info.proto == null Info.proto.dwParam }, client);
                        }
                        else
                        {
                            
client.Send(Kernel.FinalizeProtoBuf(Info3257));
                        }
                        break;
                    }
            }

        }
        public 
bool Read(byte[] packet)
        {
            var 
mypkt = new byte[packet.Length 4];
            Array.
Copy(packet4mypkt0mypkt.Length);
            try
            {
                
using (var memoryStream = new MemoryStream(packet))
                {
                    
Info Serializer.DeserializeWithLengthPrefix<MsgRankMemberShowProto>(memoryStreamPrefixStyle.Fixed32);
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e);
                return 
false;
            }
            return 
true;
        }
    }
    public class 
MsgEquipRefineRank
    
{
        public 
MsgEquipRefineRank() { }
        public 
MsgEquipRefineRankProto Info;
        [
Flags]
        public 
enum ActionID
        
{
            
MainRank 0,
            
RankItems 1,
            
UserItemRanking 2,
            
MyRanks 3,
            
View 4,

        }
        [
ProtoContract]
        public class 
MsgEquipRefineRankProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
ActionID Action;
            [
ProtoMember(2)]
            public 
uint RegisteredCount;
            [
ProtoMember(3)]
            public 
uint Page;
            [
ProtoMember(4IsRequired true)]
            public 
uint Index;
            [
ProtoMember(5IsRequired true)]
            public 
EquipProto[] items;
        }
        [
ProtoContract]
        public class 
EquipProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint Rank;
            [
ProtoMember(2IsRequired true)]
            public 
uint UnKnow2;
            [
ProtoMember(3IsRequired true)]
            public 
uint Position;
            [
ProtoMember(4IsRequired true)]
            public 
uint RankScore;
            [
ProtoMember(5IsRequired true)]
            public 
uint UID;
            [
ProtoMember(6IsRequired true)]
            public 
uint ItemID;
            [
ProtoMember(7IsRequired true)]
            public 
uint PurificationID;
            [
ProtoMember(8IsRequired true)]
            public 
uint Plus;
            [
ProtoMember(9IsRequired true)]
            public 
uint Stars;
            [
ProtoMember(10IsRequired true)]
            public 
string Name "";
            [
ProtoMember(11IsRequired true)]
            public 
uint PerfectionLevel;
        }
        public 
byte GetRealyPosition(byte FakePosition)
        {
            if (
FakePosition == 5) return 19;
            if (
FakePosition == 7) return 18;
            if (
FakePosition == 9) return 12;
            return 
FakePosition;
        }
        public static 
Dictionary<byteConquerItemMainRank;
        public 
void UpdateRanking()
        {
            
AllItemsRanking = new List<ConquerItem>();
            
MainRank = new Dictionary<byteConquerItem>();
            for (
byte i 011i++)
            {
                
byte z GetRealyPosition((byte)(1));
                List<
ConquerItemitems = new List<ConquerItem>();
                
MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
                
command.Select("items").Where("Position"z).And("Stars"0true);
                
MySqlReader reader = new MySqlReader(command);
                while (
reader.Read())
                {
                    
ConquerItem item = new ConquerItem(true);
                    
item.ID reader.ReadUInt32("ID");
                    
item.UID reader.ReadUInt32("UID");
                    
item.MaximDurability reader.ReadUInt16("MaximDurability");
                    
item.Durability reader.ReadUInt16("Durability");
                    
item.Position reader.ReadUInt16("Position");
                    
item.Signature reader.ReadString("Signature");
                    
item.SocketProgress reader.ReadUInt32("SocketProgress");
                    
item.PlusProgress reader.ReadUInt32("PlusProgress");
                    
item.Stars reader.ReadByte("Stars");
                    
item.PerfectionProgress reader.ReadUInt32("PerfectionProgress");
                    
item.Owner reader.ReadString("Owner");
                    
item.OwnerUID reader.ReadUInt32("OwnerUID");
                    
item.SocketOne = (Game.Enums.Gem)reader.ReadByte("SocketOne");
                    
item.SocketTwo = (Game.Enums.Gem)reader.ReadByte("SocketTwo");
                    
item.Effect = (Game.Enums.ItemEffect)reader.ReadByte("Effect");
                    
item.Mode Game.Enums.ItemMode.Default;
                    
item.Plus reader.ReadByte("Plus");
                    
item.Bless reader.ReadByte("Bless");
                    
item.Bound reader.ReadBoolean("Bound");
                    
// item.TimeStamp = DateTime.FromBinary(reader.ReadInt64("TimeStamp"));
                    // item.Minutes = reader.ReadUInt64("MinutesLeft");
                    
item.Enchant reader.ReadByte("Enchant");
                    
item.Lock reader.ReadByte("Locked");
                    
item.UnlockEnd DateTime.FromBinary(reader.ReadInt64("UnlockEnd"));
                    
item.Suspicious reader.ReadBoolean("Suspicious");
                    
item.SuspiciousStart DateTime.FromBinary(reader.ReadInt64("SuspiciousStart"));
                    
item.Color = (Game.Enums.Color)reader.ReadByte("Color");
                    
item.Inscribed reader.ReadByte("Inscribed") == 1;
                    
item.StackSize reader.ReadUInt16("StackSize");
                    
item.Warehouse reader.ReadByte("Warehouse");
                    
item.RefineItem reader.ReadUInt32("RefineryItem");
                    
item.InWardrobe reader.ReadBoolean("InWardrobe");
                    
Int64 rTime reader.ReadInt64("RefineryTime");
                    
ItemAddingTable.GetAddingsForItem(item);
                    
items.Add(item);
                    if (!
AllItemsRanking.Contains(item))
                        
AllItemsRanking.Add(item);

                }
                
MainRank[z] = items.OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(x)).FirstOrDefault();
            }
        }
        public static List<
ConquerItemAllItemsRanking;
        public 
void Handle(Client.GameState client)
        {
            switch (
Info.Action)
            {
                case 
ActionID.UserItemRanking:
                    {
                        var 
item AllItemsRanking.Where(=> p.Position == GetRealyPosition((byte)Info.Index)).OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(i)).ToArray();
                        var 
min Math.Min(item.Length50);
                        for (
int i 0mini++)
                        {
                            if (
client.Equipment.IsWearingItemUID(item[i].UID))
                            {
                                var 
packet = new MsgEquipRefineRankProto();
                                
packet.Page Info.Page;
                                
packet.RegisteredCount Info.RegisteredCount;
                                
packet.Action Info.Action;
                                
packet.Index Info.Index;
                                
packet.items = new EquipProto[1];
                                
packet.items[0] = new EquipProto();
                                var 
itemm item[i];
                                
packet.items[0].Rank = (uint)(1);
                                
packet.items[0].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(itemm);
                                
packet.items[0].ItemID itemm.ID;
                                
packet.items[0].Name itemm.Owner.Replace("/0""");
                                
packet.items[0].Stars itemm.Stars;
                                
packet.items[0].Position GetRealyPosition((byte)Info.Index);
                                
packet.items[0].Plus itemm.Plus;
                                
packet.items[0].UID itemm.UID;
                                
packet.items[0].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                                
client.Send(Kernel.FinalizeProtoBuf(packet3256));
                                break;
                            }
                        }
                        break;
                    }
                case 
ActionID.MyRanks:
                    {
                        var 
packet = new MsgEquipRefineRankProto();
                        
packet.Action ActionID.MyRanks;
                        
packet.items = new EquipProto[11];
                        for (
byte i 0packet.items.Lengthi++)
                        {
                            
byte z GetRealyPosition((byte)(1));
                            var 
itemmm AllItemsRanking.Where(=> p.Position == z).OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(m)).ToArray();
                            for (
int h 0itemmm.Lengthh++)
                            {
                                if (
client.Equipment.IsWearingItemUID(itemmm[h].UID))
                                {
                                    
packet.items[i] = new EquipProto();
                                    
packet.items[i].ItemID itemmm[h].ID;
                                    
packet.items[i].Name itemmm[h].Owner.Replace("/0""");
                                    
packet.items[i].Stars itemmm[h].Stars;
                                    
packet.items[i].Plus itemmm[h].Plus;
                                    
packet.items[i].Position = (uint)(1);
                                    if (
itemmm[h].Purification.Available)
                                        
packet.items[i].PurificationID itemmm[h].Purification.PurificationItemID;
                                    
packet.items[i].Rank = (uint)(1);
                                    
packet.items[i].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(itemmm[h]);
                                    
packet.items[i].UID itemmm[h].UID;
                                    
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                                    break;
                                }
                            }
                        }



                        var 
proto Kernel.FinalizeProtoBuf(packet3256);
                        
client.Send(proto);
                        break;
                    }
                case 
ActionID.View://ViewItem
                    
{
                        if (
Database.ConquerItemTable.LoadItem(Info.Index) != null)
                        {
                            var 
item Database.ConquerItemTable.LoadItem(Info.Index);
                            
item.Mode Game.Enums.ItemMode.Perfection;
                            
item.Send(client);
                        }
                        else
                        {
                            
client.Send(Kernel.FinalizeProtoBuf(Info3256));
                        }
                        break;
                    }
                case 
ActionID.RankItems://AllRanking
                    
{
                        var 
cnt AllItemsRanking.Where(=> p.Position == GetRealyPosition((byte)Info.Index)).Count();
                        var 
packet = new MsgEquipRefineRankProto();
                        
packet.Action ActionID.RankItems;
                        
packet.RegisteredCount = (uint)Math.Min(cnt50);
                        
packet.Page Info.Page;
                        
packet.Index Info.Index;
                        
uint sss = (ushort)Math.Min(cnt - (packet.Page 10), 10);

                        
int rank = (int)packet.Page 10;
                        
packet.items = new EquipProto[sss];
                        for (
int i rankrank sssi++)
                        {
                            var 
iteeeem AllItemsRanking.Where(=> p.Position == GetRealyPosition((byte)Info.Index)).OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(x)).ToArray()[i];
                            if (
iteeeem == null) continue;
                            
packet.items[i] = new EquipProto();
                            
packet.items[i].ItemID iteeeem.ID;
                            
packet.items[i].Name iteeeem.Owner.Replace("/0""");
                            
packet.items[i].PerfectionLevel iteeeem.Stars;
                            
packet.items[i].Plus iteeeem.Plus;
                            
packet.items[i].Position GetRealyPosition((byte)Info.Index);
                            if (
iteeeem.Purification.Available)
                                
packet.items[i].PurificationID iteeeem.Purification.PurificationItemID;
                            
packet.items[i].Rank = (uint)(1);
                            
packet.items[i].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(iteeeem);
                            
packet.items[i].UID iteeeem.UID;
                            
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                        }
                        var 
proto Kernel.FinalizeProtoBuf(packet3256);
                        
client.Send(proto);
                        break;
                    }
                case 
ActionID.MainRank:
                    {


                        var 
packet = new MsgEquipRefineRankProto();
                        
packet.Action ActionID.MainRank;
                        
packet.items = new EquipProto[11];
                        for (
byte i 0packet.items.Lengthi++)
                        {
                            
byte z GetRealyPosition((byte)(1));
                            
ConquerItem itemmm MainRank[z];
                            if (
itemmm == null) continue;
                            
packet.items[i] = new EquipProto();
                            
packet.items[i].ItemID itemmm.ID;
                            
packet.items[i].Name itemmm.Owner.Replace("/0""");
                            
packet.items[i].Stars itemmm.Stars;
                            
packet.items[i].Plus itemmm.Plus;
                            
packet.items[i].Position = (uint)(1);
                            if (
itemmm.Purification.Available)
                                
packet.items[i].PurificationID itemmm.Purification.PurificationItemID;
                            
packet.items[i].Rank 1;
                            
packet.items[i].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(itemmm);
                            
packet.items[i].UID itemmm.UID;
                            
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                        }



                        var 
proto Kernel.FinalizeProtoBuf(packet3256);
                        
client.Send(proto);
                        break;
                    }
            }
        }
        public 
bool Read(byte[] packet)
        {
            
using (var memoryStream = new MemoryStream(packet))
            {
                
Info Serializer.DeserializeWithLengthPrefix<MsgEquipRefineRankProto>(memoryStreamPrefixStyle.Fixed32);
            }
            return 
true;
        }
    }
    public class 
MsgUserTotalRefineLev
    
{
        public 
MsgUserTotalRefineLev() { }
        public 
MsgUserTotalRefineLevProto Info;
        [
ProtoContract]
        public class 
MsgUserTotalRefineLevProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint EntityUID;
            [
ProtoMember(3IsRequired true)]
            public 
uint TotalPrefectionLevel;
        }
        public 
void SendPerfectionEffects(Client.GameState client)
        {
            if (
client.Equipment.TotalStars >= 10) { client.Entity.MaxAttack += 100client.Entity.MinAttack += 100client.Entity.MagicAttack += 100; }
            if (
client.Equipment.TotalStars >= 70) { client.Entity.Defence += 100client.Entity.MagicDefence += 100; }
            if (
client.Equipment.TotalStars >= 75) { client.Entity.MaxAttack += 200client.Entity.MinAttack += 200client.Entity.MagicAttack += 300; }
            if (
client.Equipment.TotalStars >= 100) { client.Entity.Defence += 200client.Entity.MagicDefence += 50; }
            if (
client.Equipment.TotalStars >= 140) { client.Entity.MaxAttack += 200client.Entity.MinAttack += 200client.Entity.MagicAttack += 400; }
            if (
client.Equipment.TotalStars >= 150) { client.Entity.MaxAttack += 300client.Entity.MinAttack += 300client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 160) { client.Entity.Defence += 300client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 180) { client.Entity.Defence += 400client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 235) { client.Entity.MaxAttack += 400client.Entity.MinAttack += 400client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 270) { client.Entity.Defence += 400client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 273) { client.Entity.MaxAttack += 400client.Entity.MinAttack += 400client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 306) { client.Entity.MaxAttack += 400client.Entity.MinAttack += 400client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 310) { client.Entity.Defence += 400client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 316) { client.Entity.Defence += 500client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 318) { client.Entity.MaxAttack += 500client.Entity.MinAttack += 500client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 323) { client.Entity.Defence += 500client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 324) { client.Entity.MaxAttack += 500client.Entity.MinAttack += 500client.Entity.MagicAttack += 500; }
        }
        public 
void Send(Client.GameState client)
        {
            
client.Send(Kernel.FinalizeProtoBuf(new MsgUserTotalRefineLevProto()
            {
                
ActionId 0,
                
EntityUID client.Entity.UID,
                
TotalPrefectionLevel client.Equipment.TotalStars
            
}, 3252));
        }
    }
    public class 
MsgRefineEffect
    
{
        public 
MsgRefineEffect() { }
        public 
MsgRefineEffectProto Info;
        [
ProtoContract]
        public class 
MsgRefineEffectProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint AttackerUID;
            [
ProtoMember(2IsRequired true)]
            public 
uint AttackedUID;
            [
ProtoMember(3IsRequired true)]
            public 
uint Effect;
        }
        public 
void Attacking(Game.Entity attackerInterfaces.IMapObject attackedref uint damageref Attack attackref bool loadItemStats)
        {
            if (
attacker == null || attacked == null) return;
            if (
attacker.Owner.Equipment.TotalStars == 0) return;
            if (
attacker.EntityFlag == Game.EntityFlag.Monster) return;
            
double chance 0;
            var 
effect Game.Enums.PerfectionEffect.CalmWind;
            
byte level 0;
            var 
dics Database.PerfectionTable.Effects.Values.Where(=> i.Stars == attacker.Owner.Equipment.TotalStars).FirstOrDefault();
            if (
dics == null) return;
            var 
dic dics.Effects;
            var 
item Kernel.RandFromGivingNums(dic.ToArray());
            
effect = (Game.Enums.PerfectionEffect)(item 1000);
            
level = (byte)(item 1000);
            
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
            foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
            {
                if (
attacker.Owner.Equipment.IsWearingItemID(val.ItemID))
                {
                    if (
attacker.Owner.Equipment.TotalStars >= val.StarReq)
                    {
                        if (
val.AttributeNum <= 16)
                        {
                            if (
val.AttributeNum == (uint)effect)
                            {
                                
chance += (byte)val.Value;
                            }
                        }
                    }
                }
            }
            while (
effect == Game.Enums.PerfectionEffect.Stricklock ||
                
effect == Game.Enums.PerfectionEffect.FreeSoul ||
                
effect == Game.Enums.PerfectionEffect.StraightLife ||
                
effect == Game.Enums.PerfectionEffect.ToxinEarser ||
                
effect == Game.Enums.PerfectionEffect.BloodSpawn ||
                
effect == Game.Enums.PerfectionEffect.MirrorofSin)
            {
                
item Kernel.RandFromGivingNums(dic.ToArray());
                
effect = (Game.Enums.PerfectionEffect)(item 1000);
                
level = (byte)(item 1000);
                
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
                foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
                {

                    if (
attacker.Owner.Equipment.IsWearingItemID(val.ItemID))
                    {
                        if (
attacker.Owner.Equipment.TotalStars >= val.StarReq)
                        {
                            if (
val.AttributeNum <= 16)
                            {
                                if (
val.AttributeNum == (uint)effect)
                                {
                                    
chance += (byte)val.Value;
                                }
                            }
                        }
                    }
                }
            }
            if (
Kernel.Rate((byte)chance))
            {
                
#region edited by Rider  DoEffects
                #region edited by Rider  DrainingTouch
                
if (effect == Game.Enums.PerfectionEffect.DrainingTouch)
                {
                    
attacker.Hitpoints attacker.MaxHitpoints;
                    
attacker.Mana attacker.MaxMana;
                }
                
#endregion
                #region edited by Rider  LuckyStrike
                
if (effect == Game.Enums.PerfectionEffect.LuckyStrike || effect == Game.Enums.PerfectionEffect.AbsoluteLuck) { damage *= 2attack.Effect1 Attack.AttackEffects1.LuckyStrike; }
                
#endregion
                #region edited by Rider  KillingFlash
                
if (effect == Game.Enums.PerfectionEffect.KillingFlash)
                {
                    
attacker.Owner.XPCount 100;
                }
                
#endregion
                #region edited by Rider  DivineGuard
                
if (effect == Game.Enums.PerfectionEffect.DivineGuard)
                {
                    
attacker.AddFlag3(Network.GamePackets.Update.Flags3.DivineGuard);
                    
attacker.Defence = (ushort)(((attacker.Defence) * 300) / 100);
                    
attacker.DivineGuardStamp Time32.Now;
                }
                
#endregion
                #region edited by Rider  InvisibleArrow
                
if (effect == Game.Enums.PerfectionEffect.InvisibleArrow)
                {
                    
damage += ((uint)(attacker.MagicAttack 5) / 100);
                }
                
#endregion
                #region edited by Rider  ShieldBreak
                
if (effect == Game.Enums.PerfectionEffect.ShieldBreak)
                {
                    
attacker.AddFlag3(Network.GamePackets.Update.Flags3.ShieldBreak);
                    
attacker.ShieldBreakStamp Time32.Now;
                    if (
attacked.MapObjType == Game.MapObjectType.Entity)
                    {
                        (
attacked as Game.Entity).Block -= (ushort)((((attacked as Game.Entity).Block) * 20) / 100);
                        if ((
attacked as Game.Entity).Block 0) (attacked as Game.Entity).Block 0;
                        
loadItemStats true;
                    }
                }
                
#endregion
                #region edited by Rider  CoreStrike
                
if (effect == Game.Enums.PerfectionEffect.CoreStrike)
                {
                    
damage += ((uint)(attacker.MagicDamageIncrease 0) * 100);
                }
                
#endregion
                #region edited by Rider  LightofStamina
                
if (effect == Game.Enums.PerfectionEffect.LightofStamina)
                {
                    
byte limit 0;
                    if (
attacker.HeavenBlessing 0)
                        
limit 50;
                    
attacker.Stamina = (byte)(100 limit);
                }
                
#endregion
                #endregion
                
var proto = new MsgRefineEffectProto();
                
proto.AttackerUID attacker.UID;
                
proto.AttackedUID attacked != null attacked.UID 0;
                
proto.Effect = (uint)effect;
                var 
proto2 Kernel.FinalizeProtoBuf(proto3254);
                
attacker.Owner.SendScreen(proto2true);
            }
        }
        public 
void beingAttacked(Interfaces.IMapObject attackerGame.Entity attackedref uint damage)
        {
            if (
attacker == null || attacked == null) return;
            if (
attacker.Owner.Equipment.TotalStars == 0) return;
            if (
attacked.EntityFlag == Game.EntityFlag.Monster) return;
            
double chance 0;
            var 
effect Game.Enums.PerfectionEffect.CalmWind;
            
byte level 0;
            var 
dic0 Database.PerfectionTable.Effects.Values.Where(=> i.Stars == attacked.Owner.Equipment.TotalStars).FirstOrDefault();
            if (
dic0 == null) return;
            var 
dic dic0.Effects;
            var 
item Kernel.RandFromGivingNums(dic.ToArray());
            
effect = (Game.Enums.PerfectionEffect)(item 1000);
            
level = (byte)(item 1000);
            
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
            foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
            {

                if (
attacked.Owner.Equipment.IsWearingItemID(val.ItemID))
                {
                    if (
attacked.Owner.Equipment.TotalStars >= val.StarReq)
                    {
                        if (
val.AttributeNum <= 16)
                        {
                            if (
val.AttributeNum == (uint)effect)
                            {
                                
chance += (byte)val.Value;
                            }
                        }
                    }
                }
            }
            
/////////////WhileAttackedNotAttackingEffects////////////
            
while (!(effect == Game.Enums.PerfectionEffect.Stricklock ||
                
effect == Game.Enums.PerfectionEffect.BloodSpawn ||
                
effect == Game.Enums.PerfectionEffect.MirrorofSin))
            {
                
item Kernel.RandFromGivingNums(dic.ToArray());
                
effect = (Game.Enums.PerfectionEffect)(item 1000);
                
level = (byte)(item 1000);
                
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
                foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
                {

                    if (
attacked.Owner.Equipment.IsWearingItemID(val.ItemID))
                    {
                        if (
attacked.Owner.Equipment.TotalStars >= val.StarReq)
                        {
                            if (
val.AttributeNum <= 16)
                            {
                                if (
val.AttributeNum == (uint)effect)
                                {
                                    
chance += (byte)val.Value;
                                }
                            }
                        }
                    }
                }
            }
            if (
Kernel.Rate((byte)chance))
            {
                
#region edited by Rider  DoEffects
                #region edited by Rider  StrickLock
                
if (effect == Game.Enums.PerfectionEffect.Stricklock)
                {
                    
damage 0;
                }
                
#endregion
                #region edited by Rider  BloodSpawn
                
if (effect == Game.Enums.PerfectionEffect.BloodSpawn)
                {
                    
attacked.Hitpoints attacked.MaxHitpoints;
                    
attacked.Mana attacked.MaxMana;
                }
                
#endregion
                #region edited by Rider  KillingFlash
                
if (effect == Game.Enums.PerfectionEffect.MirrorofSin)
                {
                    
attacked.Owner.XPCount 100;
                }
                
#endregion
                #endregion
                
var proto = new MsgRefineEffectProto();
                
proto.AttackerUID attacked.UID;
                
proto.AttackedUID attacker.UID;
                
proto.Effect = (uint)effect;
                var 
proto2 Kernel.FinalizeProtoBuf(proto3254);
                
attacked.Owner.SendScreen(proto2true);
            }
        }
        public 
void GenerateChance(Game.Entity EntityGame.Enums.PerfectionEffect effectref byte chancebool dwParam false)
        {
            if (
Entity.Owner.Equipment.TotalStars == 0) { chance 0; return; }
            
byte level = (byte)(Database.PerfectionTable.Effects.Values.Where(=> i.Stars == Entity.Owner.Equipment.TotalStars).FirstOrDefault().Effects.Where(=> >= ((uint)(effect) * 1000) && <= ((uint)(effect) * 1000 20)).FirstOrDefault() % 1000);
            if (
Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault() != null)
            {
                if (!
dwParam)
                    
chance = (byte)(Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100);
                else 
chance = (byte)(Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().dwParam 100);
                foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
                {
                    if (
Entity.Owner.Equipment.IsWearingItemID(val.ItemID))
                    {
                        if (
Entity.Owner.Equipment.TotalStars >= val.StarReq)
                        {
                            if (
val.AttributeNum <= 16)
                            {
                                if (
val.AttributeNum == (uint)effect)
                                {
                                    
chance += (byte)val.Value;
                                }
                            }
                        }
                    }
                }
            }
        }
        public 
byte GetChance(Client.GameState clientGame.Enums.PerfectionEffect effect)
        {
            if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 0) return 0;
            
byte Chance 10;
            if (
effect == Game.Enums.PerfectionEffect.CalmWind)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 3Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 90Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 170Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 250Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 285Chance += 1;
            }

            if (
effect == Game.Enums.PerfectionEffect.BloodSpawn)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 40Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 240Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 288Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.DivineGuard)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 40Chance += 5;
            }
            if (
effect == Game.Enums.PerfectionEffect.CoreStrike)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 50Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 80Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 135Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 205Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 245Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.DrainingTouch)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 35Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 220Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 276Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.FreeSoul)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 25Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 95Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 130Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 195Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 279Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.InvisibleArrow)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 65Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 225Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 282Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.KillingFlash)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 55Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 165Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 294Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.LightofStamina)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 1Chance += 5;
            }
            if (
effect == Game.Enums.PerfectionEffect.LuckyStrike)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 15Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 115Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 215Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 314Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 320Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.MirrorofSin)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 60Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 190Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 291Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.ShieldBreak)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 155 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 254Chance += 50 100;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 255 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 296Chance += 70 100;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 297 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 311Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 312 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 321Chance += 150 100;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 322 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 322Chance += 2;
            }
            if (
effect == Game.Enums.PerfectionEffect.StraightLife)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 30Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 125Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 210Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 265Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 303Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.Stricklock)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 30Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 125Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 210Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 265Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 303Chance += 1;
            }
            return 
Chance;
        }
        public 
void SendEffect(Game.Entity attackerGame.Entity attackedGame.Enums.PerfectionEffect effect)
        {

            if (
attacker == null || attacked == null) return;
            var 
proto = new MsgRefineEffectProto();
            
proto.AttackerUID attacker.UID;
            if (
attacked.EntityFlag == Game.EntityFlag.Entity)
                
proto.AttackedUID attacked.UID;
            else if (
attacked.EntityFlag == Game.EntityFlag.Monster && attacked != null && attacked.UID != 0)
            {
                
proto.AttackedUID attacked.UID;
            }
            
proto.Effect = (uint)effect;
            var 
proto2 Kernel.FinalizeProtoBuf(proto3254);
            
attacker.Owner.SendScreen(proto2true);
            if (
effect == Game.Enums.PerfectionEffect.DrainingTouch)
            {
                
attacker.Hitpoints attacker.MaxHitpoints;
            }
            if (
effect == Game.Enums.PerfectionEffect.KillingFlash)
            {
                
attacker.AddFlag((ulong)Network.GamePackets.Update.Flags.XPList);

                
attacker.Owner.XPListStamp Time32.Now;
            }
            if (
effect == Game.Enums.PerfectionEffect.DivineGuard)
            {
                
attacker.AddFlag3((ulong)Network.GamePackets.Update.Flags3.DivineGuard);
                
attacker.Defence = (ushort)(((attacker.Defence) * 20) / 100);
                
attacker.DivineGuardStamp Time32.Now;
            }
            if (
effect == Game.Enums.PerfectionEffect.ShieldBreak)
            {
                
attacker.AddFlag3((ulong)Network.GamePackets.Update.Flags3.ShieldBreak);
                
attacker.ShieldBreakStamp Time32.Now;
                
attacker.Block += (ushort)(((attacker.Block) * 2) / 10);
            }
            if (
effect == Game.Enums.PerfectionEffect.StraightLife)
            {
                
attacker.BringToLife();
            }
            if (
effect == Game.Enums.PerfectionEffect.LightofStamina && attacked.EntityFlag == Game.EntityFlag.Entity && attacker.Owner.Equipment.GetFullEquipmentPerfecetionLevelPoints attacked.Owner.Equipment.GetFullEquipmentPerfecetionLevelPoints || effect == Game.Enums.PerfectionEffect.LightofStamina && attacked.EntityFlag == Game.EntityFlag.Monsterattacker.Stamina 100;
        }
        public 
void GenerateEffectandChance(Client.GameState clientref Game.Enums.PerfectionEffect effectref byte chance)
        {
            
effect = (Game.Enums.PerfectionEffect)Kernel.Random.Next(314);
            
chance GetChance(clienteffect);
            while (
chance == 10)
            {
                
effect = (Game.Enums.PerfectionEffect)Kernel.Random.Next(314);
                
chance GetChance(clienteffect);
            }
        }
        public 
void HandleStraightLife(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.StraightLife);
        }
        public 
void HandleStrickeLock(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.Stricklock);
        }
        public 
void HandleLuckyStrike(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.LuckyStrike);
        }
        public 
void HandleMirror(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.MirrorofSin);
        }
        public 
void HandleFreeSoul(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.FreeSoul);
        }
    }



قديم 2019-10-06, 12:14 PM
المشاركة 8
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: لو سمحتو حل للمشكلتين دول وياريت نزول حلهم فى قسم التطوير
جرب و قولي


كود:
using ProtoBuf;
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Collections.Concurrent;
using System.Text;
using MessiProject;
using MessiProject.Database;
using System.Threading.Tasks;

namespace 
MessiProject.Network.GamePackets
{
    public class 
MsgUserAbilityScore
    
{
        public 
MsgUserAbilityScore() { }
        public 
MsgUserAbilityScoreProto Info;
        [
ProtoContract]
        public class 
MsgUserAbilityScoreProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint UID;
            [
ProtoMember(3IsRequired true)]
            public 
uint Level;
            [
ProtoMember(4IsRequired true)]
            public 
Scores[] Scores;
        }
        [
ProtoContract]
        public class 
Scores
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint Type;
            [
ProtoMember(2IsRequired true)]
            public 
uint Score;
        }
        public static 
ConcurrentDictionary<uintGame.EntityRankingList;
        public 
void GetRankingList()
        {
            
RankingList = new ConcurrentDictionary<uintGame.Entity>();
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("entities"))
            
using (var reader = new MySqlReader(cmd))
            {
                while (
reader.Read())
                {
                    if (
reader.ReadUInt32("TotalPerfectionScore") < 20000) continue;
                    
Game.Entity client = new Game.Entity(Game.EntityFlag.Entityfalse);
                    
client.Name reader.ReadString("Name");
                    
client.UID reader.ReadUInt32("UID");
                    
client.Level reader.ReadByte("Level");
                    
client.Class = reader.ReadByte("Class");
                    
client.Body reader.ReadUInt16("Body");
                    
client.Face reader.ReadUInt16("Face");
                    
client.TotalPerfectionScore reader.ReadUInt32("TotalPerfectionScore");
                    if (
reader.ReadString("Wardrobe") != "")
                    {
                        if (
reader.ReadString("Wardrobe").Contains("~"))
                        {
                            var 
wing reader.ReadString("Wardrobe").Split('~')[0];
                            
int type Convert.ToInt32(wing.Split('-')[0]);
                            
int id Convert.ToInt32(wing.Split('-')[1]);
                            
client.EquippedWing StorageManager.Wing<int>(typeid);
                            var 
title reader.ReadString("Wardrobe").Split('~')[1];
                            
int type2 Convert.ToInt32(title.Split('-')[0]);
                            
int id2 Convert.ToInt32(title.Split('-')[1]);
                            
client.EquippedTitle StorageManager.Title<int>(type2id2);
                        }
                    }
                    
RankingList.Add(client.UIDKernel.GamePool.ContainsKey(client.UID) ? Kernel.GamePool[client.UID].Entity client);
                }
            }
        }
        public 
bool Read(byte[] packet)
        {
            try
            {
                var 
mypkt = new byte[packet.Length 4];
                Array.
Copy(packet4mypkt0mypkt.Length);
                
using (var memoryStream = new MemoryStream(packet))
                {
                    
Info Serializer.DeserializeWithLengthPrefix<MsgUserAbilityScoreProto>(memoryStreamPrefixStyle.Fixed32);
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
                return 
false;
            }
            return 
true;
        }
        public 
void SendScore(Client.GameState clientClient.GameState Observer)
        {
            var 
packet = new MsgUserAbilityScoreProto();
            
packet.ActionId 0;
            
packet.UID client.Entity.UID;
            
packet.Level client.Entity.Level;
            
packet.Scores = new Scores[20];
            for (
int i 0packet.Scores.Lengthi++)
            {
                
byte Type = (byte)(1);
                
packet.Scores[i] = new Scores();
                
packet.Scores[i].Type Type;
                
packet.Scores[i].Score GetScoreValue(clientType);
            }


            var 
proto Kernel.FinalizeProtoBuf(packet3253);
            
Observer.Send(proto);
        }
        public 
uint GetScoreValue(Client.GameState clientuint Type)
        {
            
uint Score 0;
            if (
Type == 1Score = (uint)MsgUserAbilityScore.CalculatePerfectionJiangPoints(client);
            if (
Type == 2Score = (uint)MsgUserAbilityScore.CalculatePerfectionChiPoints(client);
            if (
Type == 3Score = (uint)(client.Entity.InnerPower != null client.Entity.InnerPower.TotalScore 0);
            if (
Type == 4Score client.Equipment.GetFullEquipmentEnchantPoints;
            if (
Type == 5Score = (uint)(client.Entity.Level 140 client.Entity.Level 20 client.Entity.Level 25);
            if (
Type == 6Score client.Equipment.GetFullEquipmentPerfecetionLevelPoints;
            if (
Type == 7Score = (uint)((client.Entity.Vitality client.Entity.Atributes client.Entity.Spirit client.Entity.Strength client.Entity.Agility) * 5);
            if (
Type == 8Score = (uint)(client.Entity.Reborn 1000);
            if (
Type == 9Score client.Equipment.GetFullEquipmentEnumPoints;
            if (
Type == 10Score client.Equipment.GetFullEquipmentSocketPoints;
            if (
Type == 11Score client.Equipment.GetFullEquipmentGemPoints;
            if (
Type == 12Score client.Equipment.GetFullEquipmentRefinePoints;
            if (
Type == 13Score client.Equipment.GetFullEquipmentPlusPoints;
            if (
Type == 14Score client.Equipment.GetFullEquipmentSoulPoints;
            if (
Type == 15Score client.Equipment.GetFullEquipmentBlessPoints;
            if (
Type == 16Score CalculateSubClassPoints(client);
            if (
Type == 17Score Database.WardrobeTable.PerfectionPoints(clienttrue);
            if (
Type == 18Score Database.WardrobeTable.PerfectionPoints(clientfalse);
            if (
Type == 19Score = (uint)((uint)client.Entity.NobilityRank 1000);
            if (
Type == 20Score client.Equipment.GetFullEquipmentLevelPoints;
            return 
Score;
        }
        public 
void Handle(Client.GameState client)
        {
            switch (
Info.ActionId)
            {
                case 
1://Observ
                    
{
                        if (
Kernel.GamePool.ContainsKey(Info.UID))
                        {
                            
SendScore(clientclient);
                            
SendScore(Kernel.GamePool[Info.UID], client);
                        }
                        else
                        {
                            
client.Send(Kernel.FinalizeProtoBuf(new MsgUserAbilityScoreProto()
                            {
                                
ActionId 1,
                                
UID 0
                            
}, 3253));
                        }
                        break;
                    }
            }
        }
        public static 
int CalculatePerfectionChiPoints(Client.GameState client)
        {
            if (
client == null || client.ChiData == null || client.ChiData.Powers == null)
                return 
0;

            
int Point 0;
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 1) break;
                
Point += ((client.ChiData.Powers[0].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[0].Attributes[i].Type)) * 100) * 60;
            }
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 2) break;
                
Point += ((client.ChiData.Powers[1].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[1].Attributes[i].Type)) * 100) * 60;
            }
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 3) break;
                
Point += ((client.ChiData.Powers[2].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[2].Attributes[i].Type)) * 100) * 60;
            }
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 4) break;
                
Point += ((client.ChiData.Powers[3].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[3].Attributes[i].Type)) * 100) * 60;
            }
            return 
Point;
        }
        
/*public static int CalculatePerfectionChiPoints(Client.GameState client)
        {
            int Point = 0;
            for (int i = 0; i < 4; i++)
            {
                if (client.ChiData.Powers.Count < 1) break;
                Point += ((client.ChiData.Powers[0].Attributes[i].Value / Game.Enums.ChiMaxValues(client.ChiData.Powers[0].Attributes[i].Type)) * 100) * 60;
            }
            for (int i = 0; i < 4; i++)
            {
                if (client.ChiData.Powers.Count < 2) break;
                Point += ((client.ChiData.Powers[1].Attributes[i].Value / Game.Enums.ChiMaxValues(client.ChiData.Powers[1].Attributes[i].Type)) * 100) * 60;
            }
            for (int i = 0; i < 4; i++)
            {
                if (client.ChiData.Powers.Count < 3) break;
                Point += ((client.ChiData.Powers[2].Attributes[i].Value / Game.Enums.ChiMaxValues(client.ChiData.Powers[2].Attributes[i].Type)) * 100) * 60;
            }
            for (int i = 0; i < 4; i++)
            {
                if (client.ChiData.Powers.Count < 4) break;
                Point += ((client.ChiData.Powers[3].Attributes[i].Value / Game.Enums.ChiMaxValues(client.ChiData.Powers[3].Attributes[i].Type)) * 100) * 60;
            }
            return Point;
        }*/
        
public static int CalculatePerfectionJiangPoints(Client.GameState client)
        {
            
int Points 0;
            if (
client.Entity.MyJiang != null)
            {
                if (
client.Entity.MyJiang.Inner_Strength == 0) return Points;
                if (
client.Entity.MyJiang.Inner_Strength <= 16200Points = (int)(client.Entity.MyJiang.Inner_Strength 0.3);
                else if (
client.Entity.MyJiang.Inner_Strength <= 40500Points = (int)(client.Entity.MyJiang.Inner_Strength 0.33);
                else if (
client.Entity.MyJiang.Inner_Strength <= 60750Points = (int)(client.Entity.MyJiang.Inner_Strength 0.36);
                else if (
client.Entity.MyJiang.Inner_Strength <= 72000Points = (int)(client.Entity.MyJiang.Inner_Strength 0.40);
                else if (
client.Entity.MyJiang.Inner_Strength <= 79200Points = (int)(client.Entity.MyJiang.Inner_Strength 0.45);
                else if (
client.Entity.MyJiang.Inner_Strength <= 80800Points = (int)(client.Entity.MyJiang.Inner_Strength 0.50);
                else if (
client.Entity.MyJiang.Inner_Strength <= 81000Points = (int)(client.Entity.MyJiang.Inner_Strength 0.60);
            }
            return 
Points;
        }
        public static 
uint CalculateSubClassPoints(Client.GameState client)
        {
            
uint Points 0;
            if (
client.Entity.SubClasses.Classes != null)
            {
                foreach (var 
sub in client.Entity.SubClasses.Classes.Values)
                {
                    if (
sub == null) continue;
                    
Points += (uint)(sub.Level == 1000 sub.Level 100);
                }
            }
            return 
Points;
        }
        public static 
uint CalculatePerfectionItemPoints(ConquerItem item)
        {
            
uint Points 50;
            if (
item == null || !Database.ConquerItemInformation.BaseInformations.ContainsKey(item.ID)) return 50;
            
            
#region edited by Rider  Plus
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.Plus == 1Points += 200;
                if (
item.Plus == 2Points += 600;
                if (
item.Plus == 3Points += 1200;
                if (
item.Plus == 4Points += 1800;
                if (
item.Plus == 5Points += 2600;
                if (
item.Plus == 6Points += 3500;
                if (
item.Plus == 7Points += 4800;
                if (
item.Plus == 8Points += 5800;
                if (
item.Plus == 9Points += 6800;
                if (
item.Plus == 10Points += 7800;
                if (
item.Plus == 11Points += 8800;
                if (
item.Plus == 12Points += 10000;
            }
            else
                foreach (
Client.GameState Owner in Program.Values)
                {
                    var 
Owner.Equipment.TryGetItem(ConquerItem.LeftWeapon);
                
                if (
Network.PacketHandler.IsTwoHand(item.ID) &&  (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null )
            {
                   
                if (
item.Plus == 1Points += 400;
                if (
item.Plus == 2Points += 1200;
                if (
item.Plus == 3Points += 2400;
                if (
item.Plus == 4Points += 3600;
                if (
item.Plus == 5Points += 5200;
                if (
item.Plus == 6Points += 7000;
                if (
item.Plus == 7Points += 9600;
                if (
item.Plus == 8Points += 11600;
                if (
item.Plus == 9Points += 13600;
                if (
item.Plus == 10Points += 15600;
                if (
item.Plus == 11Points += 17600;
                if (
item.Plus == 12Points += 20000;
            }
else
                {

                    if (
item.Plus == 1Points += 200;
                    if (
item.Plus == 2Points += 600;
                    if (
item.Plus == 3Points += 1200;
                    if (
item.Plus == 4Points += 1800;
                    if (
item.Plus == 5Points += 2600;
                    if (
item.Plus == 6Points += 3500;
                    if (
item.Plus == 7Points += 4800;
                    if (
item.Plus == 8Points += 5800;
                    if (
item.Plus == 9Points += 6800;
                    if (
item.Plus == 10Points += 7800;
                    if (
item.Plus == 11Points += 8800;
                    if (
item.Plus == 12Points += 10000;
                }
            
#endregion
            #region edited by Rider  Quality 
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.ID 10 == 9Points += 500;
                if (
item.ID 10 == 8Points += 300;
                if (
item.ID 10 == 7Points += 200;
                if (
item.ID 10 == 6Points += 100;
                if (
item.ID 10 && item.ID 10 6Points += 50;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.ID 10 == 9Points += 1000;
                if (
item.ID 10 == 8Points += 600;
                if (
item.ID 10 == 7Points += 400;
                if (
item.ID 10 == 6Points += 200;
                if (
item.ID 10 && item.ID 10 6Points += 100;
            }
            else
            {
                if (
item.ID 10 == 9Points += 500;
                if (
item.ID 10 == 8Points += 300;
                if (
item.ID 10 == 7Points += 200;
                if (
item.ID 10 == 6Points += 100;
                if (
item.ID 10 && item.ID 10 6Points += 50;
            }
            
#endregion
            #region edited by Rider  Soul
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.Purification.PurificationLevel == 1Points += 100;
                if (
item.Purification.PurificationLevel == 2Points += 300;
                if (
item.Purification.PurificationLevel == 3Points += 500;
                if (
item.Purification.PurificationLevel == 4Points += 800;
                if (
item.Purification.PurificationLevel == 5Points += 1200;
                if (
item.Purification.PurificationLevel == 6Points += 1600;
                if (
item.Purification.PurificationLevel == 7Points += 2000;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.Purification.PurificationLevel == 1Points += 200;
                if (
item.Purification.PurificationLevel == 2Points += 600;
                if (
item.Purification.PurificationLevel == 3Points += 1000;
                if (
item.Purification.PurificationLevel == 4Points += 1600;
                if (
item.Purification.PurificationLevel == 5Points += 2400;
                if (
item.Purification.PurificationLevel == 6Points += 3200;
                if (
item.Purification.PurificationLevel == 7Points += 4000;
            }
            else
            {
                if (
item.Purification.PurificationLevel == 1Points += 100;
                if (
item.Purification.PurificationLevel == 2Points += 300;
                if (
item.Purification.PurificationLevel == 3Points += 500;
                if (
item.Purification.PurificationLevel == 4Points += 800;
                if (
item.Purification.PurificationLevel == 5Points += 1200;
                if (
item.Purification.PurificationLevel == 6Points += 1600;
                if (
item.Purification.PurificationLevel == 7Points += 2000;
            }
            
#endregion
            #region edited by Rider  Bless
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                
Points += (uint)(item.Bless 100);
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                
Points += (uint)(item.Bless 200);
            }
            else
            {
                
Points += (uint)(item.Bless 100);
            }
            
#region edited by Rider  Refine
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.ExtraEffect.EffectLevel == 1Points += 100;
                if (
item.ExtraEffect.EffectLevel == 2Points += 400;
                if (
item.ExtraEffect.EffectLevel == 3Points += 800;
                if (
item.ExtraEffect.EffectLevel == 4Points += 1200;
                if (
item.ExtraEffect.EffectLevel == 5Points += 1600;
                if (
item.ExtraEffect.EffectLevel == 6Points += 2000;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.ExtraEffect.EffectLevel == 1Points += 200;
                if (
item.ExtraEffect.EffectLevel == 2Points += 800;
                if (
item.ExtraEffect.EffectLevel == 3Points += 1600;
                if (
item.ExtraEffect.EffectLevel == 4Points += 2400;
                if (
item.ExtraEffect.EffectLevel == 5Points += 3200;
                if (
item.ExtraEffect.EffectLevel == 6Points += 4000;
            }
            else
            {
                if (
item.ExtraEffect.EffectLevel == 1Points += 100;
                if (
item.ExtraEffect.EffectLevel == 2Points += 400;
                if (
item.ExtraEffect.EffectLevel == 3Points += 800;
                if (
item.ExtraEffect.EffectLevel == 4Points += 1200;
                if (
item.ExtraEffect.EffectLevel == 5Points += 1600;
                if (
item.ExtraEffect.EffectLevel == 6Points += 2000;
            }
            
#endregion
            #endregion
            #region edited by Rider  Level
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                var 
lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
                if (
lvl <= 120)
                    
Points += lvl 3;
                else if (
lvl <= 130)
                    
Points += lvl 5;
                else if (
lvl <= 140)
                    
Points += lvl 6;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                var 
lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
                if (
lvl <= 120)
                    
Points += lvl 6;
                else if (
lvl <= 130)
                    
Points += lvl 10;
                else if (
lvl <= 140)
                    
Points += lvl 12;
            }
            else
            {
                var 
lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
                if (
lvl <= 120)
                    
Points += lvl 3;
                else if (
lvl <= 130)
                    
Points += lvl 5;
                else if (
lvl <= 140)
                    
Points += lvl 6;
            }
            
#endregion
            #region edited by Rider  Gem
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.SocketOne != (Game.Enums.Gem)0)
                {
                    if (
item.SocketOne2 10 == 1Points += 200;
                    if (
item.SocketOne2 10 == 2Points += 500;
                    if (
item.SocketOne2 10 == 3Points += 800;
                }
                if (
item.SocketTwo != (Game.Enums.Gem)0)
                {
                    if (
item.SocketTwo2 10 == 1Points += 200;
                    if (
item.SocketTwo2 10 == 2Points += 500;
                    if (
item.SocketTwo2 10 == 3Points += 800;
                }
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.SocketOne != (Game.Enums.Gem)0)
                {
                    if (
item.SocketOne2 10 == 1Points += 400;
                    if (
item.SocketOne2 10 == 2Points += 1000;
                    if (
item.SocketOne2 10 == 3Points += 1600;
                }
                if (
item.SocketTwo != (Game.Enums.Gem)0)
                {
                    if (
item.SocketTwo2 10 == 1Points += 400;
                    if (
item.SocketTwo2 10 == 2Points += 1000;
                    if (
item.SocketTwo2 10 == 3Points += 1600;
                }
            }
            else
            {
                if (
item.SocketOne != (Game.Enums.Gem)0)
                {
                    if (
item.SocketOne2 10 == 1Points += 200;
                    if (
item.SocketOne2 10 == 2Points += 500;
                    if (
item.SocketOne2 10 == 3Points += 800;
                }
                if (
item.SocketTwo != (Game.Enums.Gem)0)
                {
                    if (
item.SocketTwo2 10 == 1Points += 200;
                    if (
item.SocketTwo2 10 == 2Points += 500;
                    if (
item.SocketTwo2 10 == 3Points += 800;
                }
            }
            
#endregion
            #region edited by Rider  Stars
            
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.Stars >= 1Points += 180;
                if (
item.Stars >= 2Points += 180;
                if (
item.Stars >= 3Points += 180;
                if (
item.Stars >= 4Points += 180;
                if (
item.Stars >= 5Points += 180;
                if (
item.Stars >= 6Points += 180;
                if (
item.Stars >= 7Points += 180;
                if (
item.Stars >= 8Points += 180;
                if (
item.Stars >= 9Points += 180;
                if (
item.Stars >= 10Points += 2380;
                if (
item.Stars >= 11Points += 400;
                if (
item.Stars >= 12Points += 400;
                if (
item.Stars >= 13Points += 400;
                if (
item.Stars >= 14Points += 400;
                if (
item.Stars >= 15Points += 400;
                if (
item.Stars >= 16Points += 400;
                if (
item.Stars >= 17Points += 400;
                if (
item.Stars >= 18Points += 400;
                if (
item.Stars >= 19Points += 5150;
                if (
item.Stars >= 20Points += 650;
                if (
item.Stars >= 21Points += 650;
                if (
item.Stars >= 22Points += 650;
                if (
item.Stars >= 23Points += 650;
                if (
item.Stars >= 24Points += 650;
                if (
item.Stars >= 25Points += 650;
                if (
item.Stars >= 26Points += 650;
                if (
item.Stars >= 27Points += 650;
                if (
item.Stars >= 28Points += 100;
                if (
item.Stars >= 29Points += 100;
                if (
item.Stars >= 30Points += 100;
                if (
item.Stars >= 31Points += 100;
                if (
item.Stars >= 32Points += 100;
                if (
item.Stars >= 33Points += 100;
                if (
item.Stars >= 34Points += 100;
                if (
item.Stars >= 35Points += 100;
                if (
item.Stars >= 36Points += 100;
                if (
item.Stars >= 37Points += 100;
                if (
item.Stars >= 38Points += 100;
                if (
item.Stars >= 39Points += 100;
                if (
item.Stars >= 40Points += 100;
                if (
item.Stars >= 41Points += 100;
                if (
item.Stars >= 42Points += 100;
                if (
item.Stars >= 43Points += 100;
                if (
item.Stars >= 44Points += 100;
                if (
item.Stars >= 45Points += 100;
                if (
item.Stars >= 46Points += 100;
                if (
item.Stars >= 47Points += 100;
                if (
item.Stars >= 48Points += 100;
                if (
item.Stars >= 49Points += 100;
                if (
item.Stars >= 50Points += 100;
                if (
item.Stars >= 51Points += 100;
                if (
item.Stars >= 52Points += 100;
                if (
item.Stars >= 53Points += 100;
                if (
item.Stars >= 54Points += 100;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
            {
                if (
item.Stars >= 1Points += 180;
                if (
item.Stars >= 2Points += 180;
                if (
item.Stars >= 3Points += 180;
                if (
item.Stars >= 4Points += 180;
                if (
item.Stars >= 5Points += 180;
                if (
item.Stars >= 6Points += 180;
                if (
item.Stars >= 7Points += 180;
                if (
item.Stars >= 8Points += 180;
                if (
item.Stars >= 9Points += 180;
                if (
item.Stars >= 10Points += 2380;
                if (
item.Stars >= 11Points += 400;
                if (
item.Stars >= 12Points += 400;
                if (
item.Stars >= 13Points += 400;
                if (
item.Stars >= 14Points += 400;
                if (
item.Stars >= 15Points += 400;
                if (
item.Stars >= 16Points += 400;
                if (
item.Stars >= 17Points += 400;
                if (
item.Stars >= 18Points += 400;
                if (
item.Stars >= 19Points += 5150;
                if (
item.Stars >= 20Points += 650;
                if (
item.Stars >= 21Points += 650;
                if (
item.Stars >= 22Points += 650;
                if (
item.Stars >= 23Points += 650;
                if (
item.Stars >= 24Points += 650;
                if (
item.Stars >= 25Points += 650;
                if (
item.Stars >= 26Points += 650;
                if (
item.Stars >= 27Points += 650;
                if (
item.Stars >= 28Points += 100;
                if (
item.Stars >= 29Points += 100;
                if (
item.Stars >= 30Points += 100;
                if (
item.Stars >= 31Points += 100;
                if (
item.Stars >= 32Points += 100;
                if (
item.Stars >= 33Points += 100;
                if (
item.Stars >= 34Points += 100;
                if (
item.Stars >= 35Points += 100;
                if (
item.Stars >= 36Points += 100;
                if (
item.Stars >= 37Points += 100;
                if (
item.Stars >= 38Points += 100;
                if (
item.Stars >= 39Points += 100;
                if (
item.Stars >= 40Points += 100;
                if (
item.Stars >= 41Points += 100;
                if (
item.Stars >= 42Points += 100;
                if (
item.Stars >= 43Points += 100;
                if (
item.Stars >= 44Points += 100;
                if (
item.Stars >= 45Points += 100;
                if (
item.Stars >= 46Points += 100;
                if (
item.Stars >= 47Points += 100;
                if (
item.Stars >= 48Points += 100;
                if (
item.Stars >= 49Points += 100;
                if (
item.Stars >= 50Points += 100;
                if (
item.Stars >= 51Points += 100;
                if (
item.Stars >= 52Points += 100;
                if (
item.Stars >= 53Points += 100;
                if (
item.Stars >= 54Points += 100;

            }
            else
            {
                if (
item.Stars >= 1Points += 180;
            if (
item.Stars >= 2Points += 180;
            if (
item.Stars >= 3Points += 180;
            if (
item.Stars >= 4Points += 180;
            if (
item.Stars >= 5Points += 180;
            if (
item.Stars >= 6Points += 180;
            if (
item.Stars >= 7Points += 180;
            if (
item.Stars >= 8Points += 180;
            if (
item.Stars >= 9Points += 180;
            if (
item.Stars >= 10Points += 2380;
            if (
item.Stars >= 11Points += 400;
            if (
item.Stars >= 12Points += 400;
            if (
item.Stars >= 13Points += 400;
            if (
item.Stars >= 14Points += 400;
            if (
item.Stars >= 15Points += 400;
            if (
item.Stars >= 16Points += 400;
            if (
item.Stars >= 17Points += 400;
            if (
item.Stars >= 18Points += 400;
            if (
item.Stars >= 19Points += 5150;
            if (
item.Stars >= 20Points += 650;
            if (
item.Stars >= 21Points += 650;
            if (
item.Stars >= 22Points += 650;
            if (
item.Stars >= 23Points += 650;
            if (
item.Stars >= 24Points += 650;
            if (
item.Stars >= 25Points += 650;
            if (
item.Stars >= 26Points += 650;
            if (
item.Stars >= 27Points += 650;
            if (
item.Stars >= 28Points += 100;
            if (
item.Stars >= 29Points += 100;
            if (
item.Stars >= 30Points += 100;
            if (
item.Stars >= 31Points += 100;
            if (
item.Stars >= 32Points += 100;
            if (
item.Stars >= 33Points += 100;
            if (
item.Stars >= 34Points += 100;
            if (
item.Stars >= 35Points += 100;
            if (
item.Stars >= 36Points += 100;
            if (
item.Stars >= 37Points += 100;
            if (
item.Stars >= 38Points += 100;
            if (
item.Stars >= 39Points += 100;
            if (
item.Stars >= 40Points += 100;
            if (
item.Stars >= 41Points += 100;
            if (
item.Stars >= 42Points += 100;
            if (
item.Stars >= 43Points += 100;
            if (
item.Stars >= 44Points += 100;
            if (
item.Stars >= 45Points += 100;
            if (
item.Stars >= 46Points += 100;
            if (
item.Stars >= 47Points += 100;
            if (
item.Stars >= 48Points += 100;
            if (
item.Stars >= 49Points += 100;
            if (
item.Stars >= 50Points += 100;
            if (
item.Stars >= 51Points += 100;
            if (
item.Stars >= 52Points += 100;
            if (
item.Stars >= 53Points += 100;
            if (
item.Stars >= 54Points += 100;
                }
            
#endregion
            #region edited by Rider  Socket
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.SocketOne != (Game.Enums.Gem)0Points += 1000;
                if (
item.SocketTwo != (Game.Enums.Gem)0Points += 2500;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.SocketOne != (Game.Enums.Gem)0Points += 2000;
                if (
item.SocketTwo != (Game.Enums.Gem)0Points += 5000;
            }
            else
            {
                if (
item.SocketOne != (Game.Enums.Gem)0Points += 1000;
                if (
item.SocketTwo != (Game.Enums.Gem)0Points += 2500;
            }
            
#endregion
            #region edited by Rider  Enchant
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                var 
enc = (uint)(item.Enchant);
                if (
enc != 0)
                {
                    if (
enc <= 200Points += enc 1;
                    if (
enc <= 240Points += (uint)(enc 1.3);
                    if (
enc <= 254Points += (uint)(enc 1.6);
                    if (
enc <= 255Points += enc 2;
                }
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                var 
enc = (uint)(item.Enchant);
                if (
enc != 0)
                {
                    if (
enc <= 200Points += enc 2;
                    if (
enc <= 240Points += (uint)(enc 2.6);
                    if (
enc <= 254Points += (uint)(enc 3.2);
                    if (
enc <= 255Points += enc 4;
                }
            }
            else
            {
                var 
enc = (uint)(item.Enchant);
                if (
enc != 0)
                {
                    if (
enc <= 200Points += enc 1;
                    if (
enc <= 240Points += (uint)(enc 1.3);
                    if (
enc <= 254Points += (uint)(enc 1.6);
                    if (
enc <= 255Points += enc 2;
                }
            }
            
#endregion
                
}
            return 
Points;
        }
    }
    public class 
MsgItemRefineOpt
    
{
        public 
MsgItemRefineOpt() { }
        public 
MsgItemRefineOptProto Info;
        public 
MsgItemRefineOptProto2 Info2;
        [
ProtoContract]
        public class 
MsgItemRefineOptProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint ItemUID;
            [
ProtoMember(3IsRequired true)]
            public 
string Signature;
            [
ProtoMember(4IsRequired true)]
            public 
uint ItemPlusUID;
        }
        [
ProtoContract]
        public class 
MsgItemRefineOptProto2
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ItemUID;
            [
ProtoMember(2IsRequired true)]
            public 
uint EntityUID;
            [
ProtoMember(3IsRequired true)]
            public 
uint Stars;
            [
ProtoMember(4IsRequired true)]
            public 
uint Progress;
            [
ProtoMember(5IsRequired true)]
            public 
uint OwnerUID;
            [
ProtoMember(6IsRequired true)]
            public 
string OwnerName;
        }
        public 
double GetPerfectionProgress(uint value)
        {
            return (
value 1.25);
        }
        public 
uint GetPerfectionProgress(ConquerItem item)
        {
            if (
item.Stars == 0) return 30;
            if (
item.Stars == 1) return 60;
            if (
item.Stars == 2) return 100;
            if (
item.Stars == 3) return 200;
            if (
item.Stars == 4) return 350;
            if (
item.Stars == 5) return 600;
            if (
item.Stars == 6) return 1000;
            if (
item.Stars == 7) return 1500;
            if (
item.Stars == 8) return 2300;
            if (
item.Stars == 9) return 3500;
            if (
item.Stars == 10) return 5000;
            if (
item.Stars == 11) return 6500;
            if (
item.Stars == 12) return 8000;
            if (
item.Stars == 13) return 9500;
            if (
item.Stars == 14) return 11000;
            return 
12000;
        }
        public 
uint GetPlusStonePoints(uint value)
        {
            if (
value == 3009000) return 10;
            if (
value == 3009001) return 100;
            if (
value == 3009002) return 1000;
            if (
value == 3009003) return 10000;
            if (
value == 730001 || value == 1) return 10;
            if (
value == 730002 || value == 2) return 40;
            if (
value == 730003 || value == 3) return 120;
            if (
value == 730004 || value == 4) return 360;
            if (
value == 730005 || value == 5) return 1080;
            if (
value == 730006 || value == 6) return 3240;
            if (
value == 730007 || value == 7) return 9720;
            if (
value == 730008 || value == 8) return 29160;
            if (
value == 9) return 87480;
            if (
value == 10) return 90180;
            if (
value == 11) return 95680;
            if (
value == 12) return 104680;
            return 
0;
        }
        public 
uint GetTransferCost(Network.GamePackets.ConquerItem item)
        {
            if (
item.Stars == 2) return 30;
            if (
item.Stars == 3) return 70;
            if (
item.Stars == 4) return 150;
            if (
item.Stars == 5) return 300;
            if (
item.Stars == 6) return 500;
            if (
item.Stars == 7) return 800;
            if (
item.Stars == 8) return 1100;
            if (
item.Stars >= 9) return 1500;
            return 
10;
        }
        public 
void Handle(Client.GameState clientbyte[] myPacket)
        {
            try
            {
                switch (
Info.ActionId)
                {
                    case 
0://Temper
                        
{
                            
#region edited by Rider  Minors
                            
var packet2 = new byte[myPacket.Length 4];
                            Array.
Copy(myPacket4packet20packet2.Length);
                            var 
variable Kernel.Read7BitEncodedInt(packet2).SelectMany(System.BitConverter.GetBytes).ToArray();
                            var 
variable2 = new byte[variable.Length 8];
                            Array.
Copy(variable8variable20variable.Length 8);
                            var 
MinorsCount = (variable2.Length 4);
                            
uint[] Minors = new uint[MinorsCount];
                            
byte x 0;
                            for (
int i 0MinorsCounti++)
                            {
                                
Minors[i] = BitConverter.ToUInt32(variable2x);
                                
+= 4;
                            }
                            
#endregion
                            
if (Minors != null)
                            {
                                
ConquerItem Item;
                                if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                                {
                                    foreach (var 
minor in Minors)
                                    {
                                        
ConquerItem ItemPlus;
                                        if (
client.Inventory.TryGetItem(minorout ItemPlus))
                                        {
                                            
Item.PerfectionProgress += GetPlusStonePoints(ItemPlus.ID == 300000 ItemPlus.Plus ItemPlus.ID)/*Database.PerfectionTable.CostList[ItemPlus.ID].Progress*/;
                                            
client.Inventory.Remove(minorGame.Enums.ItemUse.Removetrue);
                                        }
                                    }
                                    while (
Item.PerfectionProgress >= GetPerfectionProgress(Item)/*Database.PerfectionTable.UpgradeList.Where(i => i.Stars == (Item.Stars + 1)).FirstOrDefault().Progress*/)
                                    {
                                        
Item.PerfectionProgress -= GetPerfectionProgress(Item)/*Database.PerfectionTable.UpgradeList.Where(i => i.Stars == (Item.Stars + 1)).FirstOrDefault().Progress*/;
                                        
Item.Stars++;
                                    }
                                    while (
Item.Stars >= 54 && Item.PerfectionProgress 0)
                                    {
                                        
Item.Stars 54;
                                        
Item.PerfectionProgress 0;
                                    }
                                    
Item.Owner client.Entity.Name;
                                    
Item.OwnerUID client.Entity.UID;
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
client.LoadItemStats();
                                    
client.Send(proto);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                    new 
MsgUserTotalRefineLev().Send(client);

                                }
                            }

                            break;
                        }
                    case 
1://Transfer
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                            {
                                if (
client.Entity.BoundCps >= 50000)
                                {
                                    
client.Entity.BoundCps -= 50000;
                                    
Item.Owner client.Entity.Name;
                                    
Item.OwnerUID client.Entity.UID;
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
client.Send(proto);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                }
                            }
                            break;
                        }
                    case 
2://Signature
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                            {
                                if (
Item.Signature == String.Empty || Item.Signature == null)
                                {
                                    
Item.Signature Info.Signature;
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                }
                                else
                                {
                                    if (
client.Entity.ConquerPoints >= 270)
                                    {
                                        
client.Entity.ConquerPoints -= 270;
                                        
Item.Signature Info.Signature;
                                        
Item.Mode Game.Enums.ItemMode.Update;
                                        
Item.Send(client);
                                        var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                        {
                                            
ItemUID Item.UID,
                                            
EntityUID client.Entity.UID,
                                            
OwnerUID Item.OwnerUID,
                                            
OwnerName Item.Owner,
                                            
Progress Item.PerfectionProgress,
                                            
Stars Item.Stars
                                        
}), 3250);
                                        
Database.ConquerItemTable.UpdatePerfection(Item);
                                    }
                                    else if (
client.Entity.BoundCps >= 270)
                                    {
                                        
client.Entity.BoundCps -= 270;
                                        
Item.Signature Info.Signature;
                                        
Item.Mode Game.Enums.ItemMode.Update;
                                        
Item.Send(client);
                                        var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                        {
                                            
ItemUID Item.UID,
                                            
EntityUID client.Entity.UID,
                                            
OwnerUID Item.OwnerUID,
                                            
OwnerName Item.Owner,
                                            
Progress Item.PerfectionProgress,
                                            
Stars Item.Stars
                                        
}), 3250);
                                        
Database.ConquerItemTable.UpdatePerfection(Item);
                                    }
                                }

                            }
                            break;
                        }
                    case 
3://CPBoost
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item) && Item != null)
                            {
                                
uint value;
                                
value Math.Min(414112client.Entity.ConquerPoints);
                                if (
client.Entity.ConquerPoints >= value)
                                {
                                    
client.Entity.ConquerPoints -= value;
                                    
Item.Owner client.Entity.Name;
                                    
Item.OwnerUID client.Entity.UID;
                                    
Item.PerfectionProgress += (uint)GetPerfectionProgress(value);
                                    while (
Item.PerfectionProgress >= GetPerfectionProgress(Item))
                                    {
                                        
Item.PerfectionProgress -= GetPerfectionProgress(Item);
                                        
Item.Stars++;
                                    }
                                    while (
Item.Stars >= 54 && Item.PerfectionProgress 0)
                                    {
                                        
Item.Stars 54;
                                        
Item.PerfectionProgress 0;
                                    }
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
client.Send(proto);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                }
                            }
                            break;
                        }
                    case 
4://Exchange
                        
{
                            
ConquerItem Item;
                            
ConquerItem Item2;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item2) || client.Inventory.TryGetItem(Info.ItemUIDout Item2))
                            {
                                if (
client.Inventory.TryGetItem(Info.ItemPlusUIDout Item) || client.Equipment.TryGetItem(Info.ItemPlusUIDout Item))
                                {
                                    if (
client.Entity.BoundCps >= 200000)
                                    {
                                        
client.Entity.BoundCps -= 200000;
                                        
Item.PerfectionProgress Item2.PerfectionProgress;
                                        
Item.Stars Item2.Stars;
                                        
Item.Mode Game.Enums.ItemMode.Update;
                                        
Item.Send(client);
                                        
Item2.PerfectionProgress 0;
                                        
Item2.Stars 0;
                                        
Item2.Mode Game.Enums.ItemMode.Update;
                                        
Item2.Send(client);
                                        var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                        {
                                            
ItemUID Item.UID,
                                            
EntityUID client.Entity.UID,
                                            
OwnerUID Item.OwnerUID,
                                            
OwnerName Item.Owner,
                                            
Progress Item.PerfectionProgress,
                                            
Stars Item.Stars
                                        
}), 3250);
                                        
Database.ConquerItemTable.UpdatePerfection(Item);
                                    }
                                }
                            }
                            break;
                        }
                    case 
5://Quick
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                            {
                                if (
Item.PerfectionProgress == || Item.Stars >= 54) break;
                                
double percent = (double)Item.PerfectionProgress / (double)GetPerfectionProgress(Item) * 0;
                                if (
Kernel.Rate(percent))
                                {
                                    
Item.Stars++;
                                }
                                
Item.PerfectionProgress 0;
                                
Item.Owner client.Entity.Name;
                                
Item.OwnerUID client.Entity.UID;
                                
Item.Mode Game.Enums.ItemMode.Update;
                                
Item.Send(client);
                                var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                {
                                    
ItemUID Item.UID,
                                    
EntityUID client.Entity.UID,
                                    
OwnerUID Item.OwnerUID,
                                    
OwnerName Item.Owner,
                                    
Progress Item.PerfectionProgress,
                                    
Stars Item.Stars
                                
}), 3250);
                                
Database.ConquerItemTable.UpdatePerfection(Item);
                                
client.LoadItemStats();
                            }
                            break;
                        }
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
            }
        }
        public 
byte GetStars(byte Stars)
        {
            if (
Stars >= && Stars <= 8) return 9;
            if (
Stars >= && Stars <= 17) return 18;
            if (
Stars >= 18 && Stars <= 26) return 27;
            if (
Stars >= 27 && Stars <= 35) return 36;
            if (
Stars >= 36 && Stars <= 44) return 45;
            if (
Stars >= 45 && Stars <= 53) return 54;
            return 
0;
        }
        public 
byte[] GetBytes(string packetString)
        {
            if (
packetString != "" && packetString != null && packetString != string.Empty && packetString != " ")
            {
                
byte[] bytes = new byte[(packetString.Length 3) + 1];
                
int t 0;
                for (
int i 0packetString.Length+= 3)
                {
                    
string cha packetString.Substring(i2);
                    
bytes[t] = byte.Parse(chaSystem.Globalization.NumberStyles.HexNumber);
                    
t++;
                }
                return 
bytes;
            }
            return 
null;
        }
        public 
bool Read(byte[] packet)
        {
            try
            {
                var 
mypkt = new byte[packet.Length 4];
                Array.
Copy(packet4mypkt0mypkt.Length);
                
using (var memoryStream = new MemoryStream(packet))
                {
                    
Info Serializer.DeserializeWithLengthPrefix<MsgItemRefineOptProto>(memoryStreamPrefixStyle.Fixed32);
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
                return 
false;
            }
            return 
true;
        }
    }
    public class 
MsgItemRefineRecord
    
{
        public 
MsgItemRefineRecord() { }
        public 
MsgItemRefineRecordProto Info;
        [
ProtoContract]
        public class 
MsgItemRefineRecordProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint MaxStars;
        }
        public 
void Handle(Client.GameState client)
        {
            switch (
Info.ActionId)
            {
                case 
0:
                    {
                        
Send(client);
                        break;
                    }
            }
        }
        public 
void Send(Client.GameState client)
        {
            
client.Send(Kernel.FinalizeProtoBuf(new MsgItemRefineRecordProto()
            {
                
ActionId 0,
                
MaxStars 54
            
}, 3255));
        }
        public 
bool Read(byte[] packet)
        {
            var 
mypkt = new byte[packet.Length 4];
            Array.
Copy(packet4mypkt0mypkt.Length);
            
using (var memoryStream = new MemoryStream(packet))
            {
                
Info Serializer.DeserializeWithLengthPrefix<MsgItemRefineRecordProto>(memoryStreamPrefixStyle.Fixed32);
            }
            return 
true;
        }
    }
    public class 
MsgRankMemberShow
    
{
        public 
MsgRankMemberShow() { }
        public 
MsgRankMemberShowProto Info;
        [
ProtoContract]
        public class 
MsgRankMemberShowProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
MsgRankMemberShowProtoSer proto;
        }
        [
ProtoContract]
        public class 
MsgRankMemberShowProtoSer
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint dwParam;
            [
ProtoMember(2IsRequired true)]
            public 
uint Count;
            [
ProtoMember(3IsRequired true)]
            public 
uint UID;
            [
ProtoMember(4IsRequired true)]
            public 
string Name "";
            [
ProtoMember(5IsRequired true)]
            public 
string Guild "";
            [
ProtoMember(6IsRequired true)]
            public 
uint Mesh;
            [
ProtoMember(7IsRequired true)]
            public 
uint HairStyle;
            [
ProtoMember(8IsRequired true)]
            public 
uint Hat;
            [
ProtoMember(9IsRequired true)]
            public 
uint Garment;
            [
ProtoMember(10IsRequired true)]
            public 
uint LeftWep;
            [
ProtoMember(11IsRequired true)]
            public 
uint LeftWepAcc;
            [
ProtoMember(12IsRequired true)]
            public 
uint RightWep;
            [
ProtoMember(13IsRequired true)]
            public 
uint RightWepAcc;
            [
ProtoMember(14IsRequired true)]
            public 
uint MountArmor;
            [
ProtoMember(15IsRequired true)]
            public 
uint Flag;
            [
ProtoMember(16IsRequired true)]
            public 
uint Wing;
            [
ProtoMember(17IsRequired true)]
            public 
uint WingLevel;
            [
ProtoMember(18IsRequired true)]
            public 
uint Title;
            [
ProtoMember(19IsRequired true)]
            public 
uint Flag2;
            [
ProtoMember(20IsRequired true)]
            public 
uint Flag3;
            [
ProtoMember(21IsRequired true)]
            public 
uint Flag4;
        }
        public 
void UpdateBestEntity()
        {
            
DateTime StartTime DateTime.Now;
            
Items = new Dictionary<byteuint>();
            
BestEntity MsgUserAbilityScore.RankingList.OrderByDescending(=> i.Value.TotalPerfectionScore).ThenByDescending(=> i.Value.Level).ThenBy(=> i.Value.UID).FirstOrDefault().Value;
            if (
BestEntity == null) return;


            
byte[] Positions = new byte[10] { 134591215161719 };
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("items").Where("EntityID"BestEntity.UID))
            
using (var reader = new MySqlReader(cmd))
            {
                while (
reader.Read())
                {
                    foreach (var 
pos in Positions)
                    {
                        if (
reader.ReadByte("Position") == pos)
                        {
                            if (
Items.ContainsKey(pos)) Items.Remove(pos);
                            
Items.Add(posreader.ReadUInt32("ID"));
                            if (
pos == 19Items.Add(255reader.ReadByte("Plus"));
                            break;
                        }
                    }
                }
            }
            foreach (var 
pos in Positions)
            {
                if (!
Items.ContainsKey(pos)) Items.Add(pos0);
            }
            if (!
Items.ContainsKey(255)) Items.Add(2550);
        }
        public static 
Dictionary<byteuintItems = new Dictionary<byteuint>();
        public static 
Game.Entity BestEntity;
        public 
void Handle(Client.GameState client)
        {
            if (
BestEntity == null) return;
            switch (
Info.ActionId)
            {
                case 
0:
                    {
                        var 
proto2 = new MsgRankMemberShowProto();
                        
proto2.ActionId 0;
                        
proto2.proto = new MsgRankMemberShowProtoSer();
                        
proto2.proto.dwParam 1;
                        
proto2.proto.Count 1;
                        
proto2.proto.UID BestEntity.UID;
                        
#region edited by Rider  If He Is Online
                        
if (Kernel.GamePool.ContainsKey(BestEntity.UID))
                        {
                            var 
Entity Kernel.GamePool[BestEntity.UID].Entity;
                            
proto2.proto.HairStyle Entity.HairStyle;
                            
proto2.proto.Mesh Entity.Mesh;
                            
proto2.proto.Name Entity.Name;
                            if (
BestEntity.GuildID != 0)
                                
proto2.proto.Guild Kernel.Guilds[BestEntity.GuildID].Name;
                            if (
Entity.Owner.Equipment != null)
                            {
                                var 
Equipment Entity.Owner.Equipment;
                                
proto2.proto.Hat Equipment.TryGetItem((byte)ConquerItem.Head) != null Equipment.TryGetItem((byte)ConquerItem.Head).ID 0;
                                
proto2.proto.LeftWep Equipment.TryGetItem((byte)ConquerItem.LeftWeapon) != null Equipment.TryGetItem((byte)ConquerItem.LeftWeapon).ID 0;
                                
proto2.proto.LeftWepAcc Equipment.TryGetItem((byte)ConquerItem.LeftWeaponAccessory) != null Equipment.TryGetItem((byte)ConquerItem.LeftWeaponAccessory).ID 0;
                                
proto2.proto.MountArmor Equipment.TryGetItem((byte)ConquerItem.SteedArmor) != null Equipment.TryGetItem((byte)ConquerItem.SteedArmor).ID : (Equipment.TryGetItem((byte)ConquerItem.Steed) != null Equipment.TryGetItem((byte)ConquerItem.Steed).ID 0);
                                
proto2.proto.Garment Equipment.TryGetItem((byte)ConquerItem.Garment) != null Equipment.TryGetItem((byte)ConquerItem.Garment).ID : ((Equipment.TryGetItem((byte)ConquerItem.Armor) != null Equipment.TryGetItem((byte)ConquerItem.Armor).ID 0));
                                
proto2.proto.RightWep Equipment.TryGetItem((byte)ConquerItem.RightWeapon) != null Equipment.TryGetItem((byte)ConquerItem.RightWeapon).ID 0;
                                
proto2.proto.RightWepAcc Equipment.TryGetItem((byte)ConquerItem.RightWeaponAccessory) != null Equipment.TryGetItem((byte)ConquerItem.RightWeaponAccessory).ID 0;
                                
proto2.proto.Wing Entity.EquippedWing == ? (Equipment.TryGetItem((byte)ConquerItem.Wing) != null Equipment.TryGetItem((byte)ConquerItem.Wing).ID 0) : (uint)Entity.EquippedWing;
                                
proto2.proto.WingLevel = (byte)(Equipment.TryGetItem((byte)ConquerItem.Wing) != null Equipment.TryGetItem((byte)ConquerItem.Wing).Plus 0);
                            }
                            
proto2.proto.Title = (uint)Entity.EquippedTitle;
                            
proto2.proto.Flag = (uint)Entity.StatusFlag;
                            
proto2.proto.Flag2 = (uint)Entity.StatusFlag2;
                            
proto2.proto.Flag3 = (uint)Entity.StatusFlag3;
                            
//proto2.proto.Flag4 = (uint)Entity.StatusFlag4;
                            
client.Send(Kernel.FinalizeProtoBuf(proto23257));
                            break;
                        }
                        
#endregion
                        
proto2.proto.HairStyle BestEntity.HairStyle;
                        
proto2.proto.Mesh BestEntity.Mesh;
                        
proto2.proto.Name BestEntity.Name;
                        if (
BestEntity.GuildID != && Kernel.Guilds.ContainsKey(BestEntity.GuildID))
                            
proto2.proto.Guild Kernel.Guilds[BestEntity.GuildID].Name;
                        
proto2.proto.Hat Items[(byte)ConquerItem.Head];
                        
proto2.proto.LeftWep Items[(byte)ConquerItem.LeftWeapon];
                        
proto2.proto.LeftWepAcc Items[(byte)ConquerItem.LeftWeaponAccessory];
                        
proto2.proto.MountArmor Items[(byte)ConquerItem.SteedArmor] == Items[(byte)ConquerItem.Steed] : Items[(byte)ConquerItem.SteedArmor];
                        
proto2.proto.Garment Items[(byte)ConquerItem.Garment];
                        
proto2.proto.RightWep Items[(byte)ConquerItem.RightWeapon];
                        
proto2.proto.RightWepAcc Items[(byte)ConquerItem.RightWeaponAccessory];
                        
proto2.proto.Wing BestEntity.EquippedWing == Items[(byte)ConquerItem.Wing] : (uint)BestEntity.EquippedWing;
                        
proto2.proto.WingLevel Items[255];
                        
proto2.proto.Title = (uint)BestEntity.EquippedTitle;
                        
client.Send(Kernel.FinalizeProtoBuf(proto23257));
                        break;
                    }
                case 
1:
                    {
                        if (
Kernel.GamePool.ContainsKey(Info.proto == null Info.proto.dwParam))
                        {
                            
PacketHandler.ObserveEquipment(new Data(true) { ID 117UID client.Entity.UIDdwParam Info.proto == null Info.proto.dwParam }, client);
                        }
                        else
                        {
                            
client.Send(Kernel.FinalizeProtoBuf(Info3257));
                        }
                        break;
                    }
            }

        }
        public 
bool Read(byte[] packet)
        {
            var 
mypkt = new byte[packet.Length 4];
            Array.
Copy(packet4mypkt0mypkt.Length);
            try
            {
                
using (var memoryStream = new MemoryStream(packet))
                {
                    
Info Serializer.DeserializeWithLengthPrefix<MsgRankMemberShowProto>(memoryStreamPrefixStyle.Fixed32);
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e);
                return 
false;
            }
            return 
true;
        }
    }
    public class 
MsgEquipRefineRank
    
{
        public 
MsgEquipRefineRank() { }
        public 
MsgEquipRefineRankProto Info;
        [
Flags]
        public 
enum ActionID
        
{
            
MainRank 0,
            
RankItems 1,
            
UserItemRanking 2,
            
MyRanks 3,
            
View 4,

        }
        [
ProtoContract]
        public class 
MsgEquipRefineRankProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
ActionID Action;
            [
ProtoMember(2)]
            public 
uint RegisteredCount;
            [
ProtoMember(3)]
            public 
uint Page;
            [
ProtoMember(4IsRequired true)]
            public 
uint Index;
            [
ProtoMember(5IsRequired true)]
            public 
EquipProto[] items;
        }
        [
ProtoContract]
        public class 
EquipProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint Rank;
            [
ProtoMember(2IsRequired true)]
            public 
uint UnKnow2;
            [
ProtoMember(3IsRequired true)]
            public 
uint Position;
            [
ProtoMember(4IsRequired true)]
            public 
uint RankScore;
            [
ProtoMember(5IsRequired true)]
            public 
uint UID;
            [
ProtoMember(6IsRequired true)]
            public 
uint ItemID;
            [
ProtoMember(7IsRequired true)]
            public 
uint PurificationID;
            [
ProtoMember(8IsRequired true)]
            public 
uint Plus;
            [
ProtoMember(9IsRequired true)]
            public 
uint Stars;
            [
ProtoMember(10IsRequired true)]
            public 
string Name "";
            [
ProtoMember(11IsRequired true)]
            public 
uint PerfectionLevel;
        }
        public 
byte GetRealyPosition(byte FakePosition)
        {
            if (
FakePosition == 5) return 19;
            if (
FakePosition == 7) return 18;
            if (
FakePosition == 9) return 12;
            return 
FakePosition;
        }
        public static 
Dictionary<byteConquerItemMainRank;
        public 
void UpdateRanking()
        {
            
AllItemsRanking = new List<ConquerItem>();
            
MainRank = new Dictionary<byteConquerItem>();
            for (
byte i 011i++)
            {
                
byte z GetRealyPosition((byte)(1));
                List<
ConquerItemitems = new List<ConquerItem>();
                
MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
                
command.Select("items").Where("Position"z).And("Stars"0true);
                
MySqlReader reader = new MySqlReader(command);
                while (
reader.Read())
                {
                    
ConquerItem item = new ConquerItem(true);
                    
item.ID reader.ReadUInt32("ID");
                    
item.UID reader.ReadUInt32("UID");
                    
item.MaximDurability reader.ReadUInt16("MaximDurability");
                    
item.Durability reader.ReadUInt16("Durability");
                    
item.Position reader.ReadUInt16("Position");
                    
item.Signature reader.ReadString("Signature");
                    
item.SocketProgress reader.ReadUInt32("SocketProgress");
                    
item.PlusProgress reader.ReadUInt32("PlusProgress");
                    
item.Stars reader.ReadByte("Stars");
                    
item.PerfectionProgress reader.ReadUInt32("PerfectionProgress");
                    
item.Owner reader.ReadString("Owner");
                    
item.OwnerUID reader.ReadUInt32("OwnerUID");
                    
item.SocketOne = (Game.Enums.Gem)reader.ReadByte("SocketOne");
                    
item.SocketTwo = (Game.Enums.Gem)reader.ReadByte("SocketTwo");
                    
item.Effect = (Game.Enums.ItemEffect)reader.ReadByte("Effect");
                    
item.Mode Game.Enums.ItemMode.Default;
                    
item.Plus reader.ReadByte("Plus");
                    
item.Bless reader.ReadByte("Bless");
                    
item.Bound reader.ReadBoolean("Bound");
                    
// item.TimeStamp = DateTime.FromBinary(reader.ReadInt64("TimeStamp"));
                    // item.Minutes = reader.ReadUInt64("MinutesLeft");
                    
item.Enchant reader.ReadByte("Enchant");
                    
item.Lock reader.ReadByte("Locked");
                    
item.UnlockEnd DateTime.FromBinary(reader.ReadInt64("UnlockEnd"));
                    
item.Suspicious reader.ReadBoolean("Suspicious");
                    
item.SuspiciousStart DateTime.FromBinary(reader.ReadInt64("SuspiciousStart"));
                    
item.Color = (Game.Enums.Color)reader.ReadByte("Color");
                    
item.Inscribed reader.ReadByte("Inscribed") == 1;
                    
item.StackSize reader.ReadUInt16("StackSize");
                    
item.Warehouse reader.ReadByte("Warehouse");
                    
item.RefineItem reader.ReadUInt32("RefineryItem");
                    
item.InWardrobe reader.ReadBoolean("InWardrobe");
                    
Int64 rTime reader.ReadInt64("RefineryTime");
                    
ItemAddingTable.GetAddingsForItem(item);
                    
items.Add(item);
                    if (!
AllItemsRanking.Contains(item))
                        
AllItemsRanking.Add(item);

                }
                
MainRank[z] = items.OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(x)).FirstOrDefault();
            }
        }
        public static List<
ConquerItemAllItemsRanking;
        public 
void Handle(Client.GameState client)
        {
            switch (
Info.Action)
            {
                case 
ActionID.UserItemRanking:
                    {
                        var 
item AllItemsRanking.Where(=> p.Position == GetRealyPosition((byte)Info.Index)).OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(i)).ToArray();
                        var 
min Math.Min(item.Length50);
                        for (
int i 0mini++)
                        {
                            if (
client.Equipment.IsWearingItemUID(item[i].UID))
                            {
                                var 
packet = new MsgEquipRefineRankProto();
                                
packet.Page Info.Page;
                                
packet.RegisteredCount Info.RegisteredCount;
                                
packet.Action Info.Action;
                                
packet.Index Info.Index;
                                
packet.items = new EquipProto[1];
                                
packet.items[0] = new EquipProto();
                                var 
itemm item[i];
                                
packet.items[0].Rank = (uint)(1);
                                
packet.items[0].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(itemm);
                                
packet.items[0].ItemID itemm.ID;
                                
packet.items[0].Name itemm.Owner.Replace("/0""");
                                
packet.items[0].Stars itemm.Stars;
                                
packet.items[0].Position GetRealyPosition((byte)Info.Index);
                                
packet.items[0].Plus itemm.Plus;
                                
packet.items[0].UID itemm.UID;
                                
packet.items[0].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                                
client.Send(Kernel.FinalizeProtoBuf(packet3256));
                                break;
                            }
                        }
                        break;
                    }
                case 
ActionID.MyRanks:
                    {
                        var 
packet = new MsgEquipRefineRankProto();
                        
packet.Action ActionID.MyRanks;
                        
packet.items = new EquipProto[11];
                        for (
byte i 0packet.items.Lengthi++)
                        {
                            
byte z GetRealyPosition((byte)(1));
                            var 
itemmm AllItemsRanking.Where(=> p.Position == z).OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(m)).ToArray();
                            for (
int h 0itemmm.Lengthh++)
                            {
                                if (
client.Equipment.IsWearingItemUID(itemmm[h].UID))
                                {
                                    
packet.items[i] = new EquipProto();
                                    
packet.items[i].ItemID itemmm[h].ID;
                                    
packet.items[i].Name itemmm[h].Owner.Replace("/0""");
                                    
packet.items[i].Stars itemmm[h].Stars;
                                    
packet.items[i].Plus itemmm[h].Plus;
                                    
packet.items[i].Position = (uint)(1);
                                    if (
itemmm[h].Purification.Available)
                                        
packet.items[i].PurificationID itemmm[h].Purification.PurificationItemID;
                                    
packet.items[i].Rank = (uint)(1);
                                    
packet.items[i].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(itemmm[h]);
                                    
packet.items[i].UID itemmm[h].UID;
                                    
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                                    break;
                                }
                            }
                        }



                        var 
proto Kernel.FinalizeProtoBuf(packet3256);
                        
client.Send(proto);
                        break;
                    }
                case 
ActionID.View://ViewItem
                    
{
                        if (
Database.ConquerItemTable.LoadItem(Info.Index) != null)
                        {
                            var 
item Database.ConquerItemTable.LoadItem(Info.Index);
                            
item.Mode Game.Enums.ItemMode.Perfection;
                            
item.Send(client);
                        }
                        else
                        {
                            
client.Send(Kernel.FinalizeProtoBuf(Info3256));
                        }
                        break;
                    }
                case 
ActionID.RankItems://AllRanking
                    
{
                        var 
cnt AllItemsRanking.Where(=> p.Position == GetRealyPosition((byte)Info.Index)).Count();
                        var 
packet = new MsgEquipRefineRankProto();
                        
packet.Action ActionID.RankItems;
                        
packet.RegisteredCount = (uint)Math.Min(cnt50);
                        
packet.Page Info.Page;
                        
packet.Index Info.Index;
                        
uint sss = (ushort)Math.Min(cnt - (packet.Page 10), 10);

                        
int rank = (int)packet.Page 10;
                        
packet.items = new EquipProto[sss];
                        for (
int i rankrank sssi++)
                        {
                            var 
iteeeem AllItemsRanking.Where(=> p.Position == GetRealyPosition((byte)Info.Index)).OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(x)).ToArray()[i];
                            if (
iteeeem == null) continue;
                            
packet.items[i] = new EquipProto();
                            
packet.items[i].ItemID iteeeem.ID;
                            
packet.items[i].Name iteeeem.Owner.Replace("/0""");
                            
packet.items[i].PerfectionLevel iteeeem.Stars;
                            
packet.items[i].Plus iteeeem.Plus;
                            
packet.items[i].Position GetRealyPosition((byte)Info.Index);
                            if (
iteeeem.Purification.Available)
                                
packet.items[i].PurificationID iteeeem.Purification.PurificationItemID;
                            
packet.items[i].Rank = (uint)(1);
                            
packet.items[i].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(iteeeem);
                            
packet.items[i].UID iteeeem.UID;
                            
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                        }
                        var 
proto Kernel.FinalizeProtoBuf(packet3256);
                        
client.Send(proto);
                        break;
                    }
                case 
ActionID.MainRank:
                    {


                        var 
packet = new MsgEquipRefineRankProto();
                        
packet.Action ActionID.MainRank;
                        
packet.items = new EquipProto[11];
                        for (
byte i 0packet.items.Lengthi++)
                        {
                            
byte z GetRealyPosition((byte)(1));
                            
ConquerItem itemmm MainRank[z];
                            if (
itemmm == null) continue;
                            
packet.items[i] = new EquipProto();
                            
packet.items[i].ItemID itemmm.ID;
                            
packet.items[i].Name itemmm.Owner.Replace("/0""");
                            
packet.items[i].Stars itemmm.Stars;
                            
packet.items[i].Plus itemmm.Plus;
                            
packet.items[i].Position = (uint)(1);
                            if (
itemmm.Purification.Available)
                                
packet.items[i].PurificationID itemmm.Purification.PurificationItemID;
                            
packet.items[i].Rank 1;
                            
packet.items[i].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(itemmm);
                            
packet.items[i].UID itemmm.UID;
                            
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                        }



                        var 
proto Kernel.FinalizeProtoBuf(packet3256);
                        
client.Send(proto);
                        break;
                    }
            }
        }
        public 
bool Read(byte[] packet)
        {
            
using (var memoryStream = new MemoryStream(packet))
            {
                
Info Serializer.DeserializeWithLengthPrefix<MsgEquipRefineRankProto>(memoryStreamPrefixStyle.Fixed32);
            }
            return 
true;
        }
    }
    public class 
MsgUserTotalRefineLev
    
{
        public 
MsgUserTotalRefineLev() { }
        public 
MsgUserTotalRefineLevProto Info;
        [
ProtoContract]
        public class 
MsgUserTotalRefineLevProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint EntityUID;
            [
ProtoMember(3IsRequired true)]
            public 
uint TotalPrefectionLevel;
        }
        public 
void SendPerfectionEffects(Client.GameState client)
        {
            if (
client.Equipment.TotalStars >= 10) { client.Entity.MaxAttack += 100client.Entity.MinAttack += 100client.Entity.MagicAttack += 100; }
            if (
client.Equipment.TotalStars >= 70) { client.Entity.Defence += 100client.Entity.MagicDefence += 100; }
            if (
client.Equipment.TotalStars >= 75) { client.Entity.MaxAttack += 200client.Entity.MinAttack += 200client.Entity.MagicAttack += 300; }
            if (
client.Equipment.TotalStars >= 100) { client.Entity.Defence += 200client.Entity.MagicDefence += 50; }
            if (
client.Equipment.TotalStars >= 140) { client.Entity.MaxAttack += 200client.Entity.MinAttack += 200client.Entity.MagicAttack += 400; }
            if (
client.Equipment.TotalStars >= 150) { client.Entity.MaxAttack += 300client.Entity.MinAttack += 300client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 160) { client.Entity.Defence += 300client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 180) { client.Entity.Defence += 400client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 235) { client.Entity.MaxAttack += 400client.Entity.MinAttack += 400client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 270) { client.Entity.Defence += 400client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 273) { client.Entity.MaxAttack += 400client.Entity.MinAttack += 400client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 306) { client.Entity.MaxAttack += 400client.Entity.MinAttack += 400client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 310) { client.Entity.Defence += 400client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 316) { client.Entity.Defence += 500client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 318) { client.Entity.MaxAttack += 500client.Entity.MinAttack += 500client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 323) { client.Entity.Defence += 500client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 324) { client.Entity.MaxAttack += 500client.Entity.MinAttack += 500client.Entity.MagicAttack += 500; }
        }
        public 
void Send(Client.GameState client)
        {
            
client.Send(Kernel.FinalizeProtoBuf(new MsgUserTotalRefineLevProto()
            {
                
ActionId 0,
                
EntityUID client.Entity.UID,
                
TotalPrefectionLevel client.Equipment.TotalStars
            
}, 3252));
        }
    }
    public class 
MsgRefineEffect
    
{
        public 
MsgRefineEffect() { }
        public 
MsgRefineEffectProto Info;
        [
ProtoContract]
        public class 
MsgRefineEffectProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint AttackerUID;
            [
ProtoMember(2IsRequired true)]
            public 
uint AttackedUID;
            [
ProtoMember(3IsRequired true)]
            public 
uint Effect;
        }
        public 
void Attacking(Game.Entity attackerInterfaces.IMapObject attackedref uint damageref Attack attackref bool loadItemStats)
        {
            if (
attacker == null || attacked == null) return;
            if (
attacker.Owner.Equipment.TotalStars == 0) return;
            if (
attacker.EntityFlag == Game.EntityFlag.Monster) return;
            
double chance 0;
            var 
effect Game.Enums.PerfectionEffect.CalmWind;
            
byte level 0;
            var 
dics Database.PerfectionTable.Effects.Values.Where(=> i.Stars == attacker.Owner.Equipment.TotalStars).FirstOrDefault();
            if (
dics == null) return;
            var 
dic dics.Effects;
            var 
item Kernel.RandFromGivingNums(dic.ToArray());
            
effect = (Game.Enums.PerfectionEffect)(item 1000);
            
level = (byte)(item 1000);
            
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
            foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
            {
                if (
attacker.Owner.Equipment.IsWearingItemID(val.ItemID))
                {
                    if (
attacker.Owner.Equipment.TotalStars >= val.StarReq)
                    {
                        if (
val.AttributeNum <= 16)
                        {
                            if (
val.AttributeNum == (uint)effect)
                            {
                                
chance += (byte)val.Value;
                            }
                        }
                    }
                }
            }
            while (
effect == Game.Enums.PerfectionEffect.Stricklock ||
                
effect == Game.Enums.PerfectionEffect.FreeSoul ||
                
effect == Game.Enums.PerfectionEffect.StraightLife ||
                
effect == Game.Enums.PerfectionEffect.ToxinEarser ||
                
effect == Game.Enums.PerfectionEffect.BloodSpawn ||
                
effect == Game.Enums.PerfectionEffect.MirrorofSin)
            {
                
item Kernel.RandFromGivingNums(dic.ToArray());
                
effect = (Game.Enums.PerfectionEffect)(item 1000);
                
level = (byte)(item 1000);
                
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
                foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
                {

                    if (
attacker.Owner.Equipment.IsWearingItemID(val.ItemID))
                    {
                        if (
attacker.Owner.Equipment.TotalStars >= val.StarReq)
                        {
                            if (
val.AttributeNum <= 16)
                            {
                                if (
val.AttributeNum == (uint)effect)
                                {
                                    
chance += (byte)val.Value;
                                }
                            }
                        }
                    }
                }
            }
            if (
Kernel.Rate((byte)chance))
            {
                
#region edited by Rider  DoEffects
                #region edited by Rider  DrainingTouch
                
if (effect == Game.Enums.PerfectionEffect.DrainingTouch)
                {
                    
attacker.Hitpoints attacker.MaxHitpoints;
                    
attacker.Mana attacker.MaxMana;
                }
                
#endregion
                #region edited by Rider  LuckyStrike
                
if (effect == Game.Enums.PerfectionEffect.LuckyStrike || effect == Game.Enums.PerfectionEffect.AbsoluteLuck) { damage *= 2attack.Effect1 Attack.AttackEffects1.LuckyStrike; }
                
#endregion
                #region edited by Rider  KillingFlash
                
if (effect == Game.Enums.PerfectionEffect.KillingFlash)
                {
                    
attacker.Owner.XPCount 100;
                }
                
#endregion
                #region edited by Rider  DivineGuard
                
if (effect == Game.Enums.PerfectionEffect.DivineGuard)
                {
                    
attacker.AddFlag3(Network.GamePackets.Update.Flags3.DivineGuard);
                    
attacker.Defence = (ushort)(((attacker.Defence) * 300) / 100);
                    
attacker.DivineGuardStamp Time32.Now;
                }
                
#endregion
                #region edited by Rider  InvisibleArrow
                
if (effect == Game.Enums.PerfectionEffect.InvisibleArrow)
                {
                    
damage += ((uint)(attacker.MagicAttack 5) / 100);
                }
                
#endregion
                #region edited by Rider  ShieldBreak
                
if (effect == Game.Enums.PerfectionEffect.ShieldBreak)
                {
                    
attacker.AddFlag3(Network.GamePackets.Update.Flags3.ShieldBreak);
                    
attacker.ShieldBreakStamp Time32.Now;
                    if (
attacked.MapObjType == Game.MapObjectType.Entity)
                    {
                        (
attacked as Game.Entity).Block -= (ushort)((((attacked as Game.Entity).Block) * 20) / 100);
                        if ((
attacked as Game.Entity).Block 0) (attacked as Game.Entity).Block 0;
                        
loadItemStats true;
                    }
                }
                
#endregion
                #region edited by Rider  CoreStrike
                
if (effect == Game.Enums.PerfectionEffect.CoreStrike)
                {
                    
damage += ((uint)(attacker.MagicDamageIncrease 0) * 100);
                }
                
#endregion
                #region edited by Rider  LightofStamina
                
if (effect == Game.Enums.PerfectionEffect.LightofStamina)
                {
                    
byte limit 0;
                    if (
attacker.HeavenBlessing 0)
                        
limit 50;
                    
attacker.Stamina = (byte)(100 limit);
                }
                
#endregion
                #endregion
                
var proto = new MsgRefineEffectProto();
                
proto.AttackerUID attacker.UID;
                
proto.AttackedUID attacked != null attacked.UID 0;
                
proto.Effect = (uint)effect;
                var 
proto2 Kernel.FinalizeProtoBuf(proto3254);
                
attacker.Owner.SendScreen(proto2true);
            }
        }
        public 
void beingAttacked(Interfaces.IMapObject attackerGame.Entity attackedref uint damage)
        {
            if (
attacker == null || attacked == null) return;
            if (
attacker.Owner.Equipment.TotalStars == 0) return;
            if (
attacked.EntityFlag == Game.EntityFlag.Monster) return;
            
double chance 0;
            var 
effect Game.Enums.PerfectionEffect.CalmWind;
            
byte level 0;
            var 
dic0 Database.PerfectionTable.Effects.Values.Where(=> i.Stars == attacked.Owner.Equipment.TotalStars).FirstOrDefault();
            if (
dic0 == null) return;
            var 
dic dic0.Effects;
            var 
item Kernel.RandFromGivingNums(dic.ToArray());
            
effect = (Game.Enums.PerfectionEffect)(item 1000);
            
level = (byte)(item 1000);
            
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
            foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
            {

                if (
attacked.Owner.Equipment.IsWearingItemID(val.ItemID))
                {
                    if (
attacked.Owner.Equipment.TotalStars >= val.StarReq)
                    {
                        if (
val.AttributeNum <= 16)
                        {
                            if (
val.AttributeNum == (uint)effect)
                            {
                                
chance += (byte)val.Value;
                            }
                        }
                    }
                }
            }
            
/////////////WhileAttackedNotAttackingEffects////////////
            
while (!(effect == Game.Enums.PerfectionEffect.Stricklock ||
                
effect == Game.Enums.PerfectionEffect.BloodSpawn ||
                
effect == Game.Enums.PerfectionEffect.MirrorofSin))
            {
                
item Kernel.RandFromGivingNums(dic.ToArray());
                
effect = (Game.Enums.PerfectionEffect)(item 1000);
                
level = (byte)(item 1000);
                
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
                foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
                {

                    if (
attacked.Owner.Equipment.IsWearingItemID(val.ItemID))
                    {
                        if (
attacked.Owner.Equipment.TotalStars >= val.StarReq)
                        {
                            if (
val.AttributeNum <= 16)
                            {
                                if (
val.AttributeNum == (uint)effect)
                                {
                                    
chance += (byte)val.Value;
                                }
                            }
                        }
                    }
                }
            }
            if (
Kernel.Rate((byte)chance))
            {
                
#region edited by Rider  DoEffects
                #region edited by Rider  StrickLock
                
if (effect == Game.Enums.PerfectionEffect.Stricklock)
                {
                    
damage 0;
                }
                
#endregion
                #region edited by Rider  BloodSpawn
                
if (effect == Game.Enums.PerfectionEffect.BloodSpawn)
                {
                    
attacked.Hitpoints attacked.MaxHitpoints;
                    
attacked.Mana attacked.MaxMana;
                }
                
#endregion
                #region edited by Rider  KillingFlash
                
if (effect == Game.Enums.PerfectionEffect.MirrorofSin)
                {
                    
attacked.Owner.XPCount 100;
                }
                
#endregion
                #endregion
                
var proto = new MsgRefineEffectProto();
                
proto.AttackerUID attacked.UID;
                
proto.AttackedUID attacker.UID;
                
proto.Effect = (uint)effect;
                var 
proto2 Kernel.FinalizeProtoBuf(proto3254);
                
attacked.Owner.SendScreen(proto2true);
            }
        }
        public 
void GenerateChance(Game.Entity EntityGame.Enums.PerfectionEffect effectref byte chancebool dwParam false)
        {
            if (
Entity.Owner.Equipment.TotalStars == 0) { chance 0; return; }
            
byte level = (byte)(Database.PerfectionTable.Effects.Values.Where(=> i.Stars == Entity.Owner.Equipment.TotalStars).FirstOrDefault().Effects.Where(=> >= ((uint)(effect) * 1000) && <= ((uint)(effect) * 1000 20)).FirstOrDefault() % 1000);
            if (
Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault() != null)
            {
                if (!
dwParam)
                    
chance = (byte)(Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100);
                else 
chance = (byte)(Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().dwParam 100);
                foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
                {
                    if (
Entity.Owner.Equipment.IsWearingItemID(val.ItemID))
                    {
                        if (
Entity.Owner.Equipment.TotalStars >= val.StarReq)
                        {
                            if (
val.AttributeNum <= 16)
                            {
                                if (
val.AttributeNum == (uint)effect)
                                {
                                    
chance += (byte)val.Value;
                                }
                            }
                        }
                    }
                }
            }
        }
        public 
byte GetChance(Client.GameState clientGame.Enums.PerfectionEffect effect)
        {
            if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 0) return 0;
            
byte Chance 10;
            if (
effect == Game.Enums.PerfectionEffect.CalmWind)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 3Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 90Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 170Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 250Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 285Chance += 1;
            }

            if (
effect == Game.Enums.PerfectionEffect.BloodSpawn)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 40Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 240Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 288Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.DivineGuard)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 40Chance += 5;
            }
            if (
effect == Game.Enums.PerfectionEffect.CoreStrike)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 50Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 80Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 135Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 205Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 245Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.DrainingTouch)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 35Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 220Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 276Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.FreeSoul)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 25Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 95Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 130Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 195Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 279Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.InvisibleArrow)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 65Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 225Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 282Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.KillingFlash)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 55Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 165Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 294Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.LightofStamina)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 1Chance += 5;
            }
            if (
effect == Game.Enums.PerfectionEffect.LuckyStrike)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 15Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 115Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 215Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 314Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 320Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.MirrorofSin)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 60Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 190Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 291Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.ShieldBreak)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 155 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 254Chance += 50 100;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 255 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 296Chance += 70 100;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 297 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 311Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 312 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 321Chance += 150 100;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 322 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 322Chance += 2;
            }
            if (
effect == Game.Enums.PerfectionEffect.StraightLife)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 30Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 125Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 210Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 265Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 303Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.Stricklock)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 30Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 125Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 210Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 265Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 303Chance += 1;
            }
            return 
Chance;
        }
        public 
void SendEffect(Game.Entity attackerGame.Entity attackedGame.Enums.PerfectionEffect effect)
        {

            if (
attacker == null || attacked == null) return;
            var 
proto = new MsgRefineEffectProto();
            
proto.AttackerUID attacker.UID;
            if (
attacked.EntityFlag == Game.EntityFlag.Entity)
                
proto.AttackedUID attacked.UID;
            else if (
attacked.EntityFlag == Game.EntityFlag.Monster && attacked != null && attacked.UID != 0)
            {
                
proto.AttackedUID attacked.UID;
            }
            
proto.Effect = (uint)effect;
            var 
proto2 Kernel.FinalizeProtoBuf(proto3254);
            
attacker.Owner.SendScreen(proto2true);
            if (
effect == Game.Enums.PerfectionEffect.DrainingTouch)
            {
                
attacker.Hitpoints attacker.MaxHitpoints;
            }
            if (
effect == Game.Enums.PerfectionEffect.KillingFlash)
            {
                
attacker.AddFlag((ulong)Network.GamePackets.Update.Flags.XPList);

                
attacker.Owner.XPListStamp Time32.Now;
            }
            if (
effect == Game.Enums.PerfectionEffect.DivineGuard)
            {
                
attacker.AddFlag3((ulong)Network.GamePackets.Update.Flags3.DivineGuard);
                
attacker.Defence = (ushort)(((attacker.Defence) * 20) / 100);
                
attacker.DivineGuardStamp Time32.Now;
            }
            if (
effect == Game.Enums.PerfectionEffect.ShieldBreak)
            {
                
attacker.AddFlag3((ulong)Network.GamePackets.Update.Flags3.ShieldBreak);
                
attacker.ShieldBreakStamp Time32.Now;
                
attacker.Block += (ushort)(((attacker.Block) * 2) / 10);
            }
            if (
effect == Game.Enums.PerfectionEffect.StraightLife)
            {
                
attacker.BringToLife();
            }
            if (
effect == Game.Enums.PerfectionEffect.LightofStamina && attacked.EntityFlag == Game.EntityFlag.Entity && attacker.Owner.Equipment.GetFullEquipmentPerfecetionLevelPoints attacked.Owner.Equipment.GetFullEquipmentPerfecetionLevelPoints || effect == Game.Enums.PerfectionEffect.LightofStamina && attacked.EntityFlag == Game.EntityFlag.Monsterattacker.Stamina 100;
        }
        public 
void GenerateEffectandChance(Client.GameState clientref Game.Enums.PerfectionEffect effectref byte chance)
        {
            
effect = (Game.Enums.PerfectionEffect)Kernel.Random.Next(314);
            
chance GetChance(clienteffect);
            while (
chance == 10)
            {
                
effect = (Game.Enums.PerfectionEffect)Kernel.Random.Next(314);
                
chance GetChance(clienteffect);
            }
        }
        public 
void HandleStraightLife(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.StraightLife);
        }
        public 
void HandleStrickeLock(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.Stricklock);
        }
        public 
void HandleLuckyStrike(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.LuckyStrike);
        }
        public 
void HandleMirror(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.MirrorofSin);
        }
        public 
void HandleFreeSoul(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.FreeSoul);
        }
    }



قديم 2019-10-06, 01:18 PM
المشاركة 9
ابو مروان
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: لو سمحتو حل للمشكلتين دول وياريت نزول حلهم فى قسم التطوير
جرب و قولي


كود:
using ProtoBuf;
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Collections.Concurrent;
using System.Text;
using MessiProject;
using MessiProject.Database;
using System.Threading.Tasks;

namespace 
MessiProject.Network.GamePackets
{
    public class 
MsgUserAbilityScore
    
{
        public 
MsgUserAbilityScore() { }
        public 
MsgUserAbilityScoreProto Info;
        [
ProtoContract]
        public class 
MsgUserAbilityScoreProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint UID;
            [
ProtoMember(3IsRequired true)]
            public 
uint Level;
            [
ProtoMember(4IsRequired true)]
            public 
Scores[] Scores;
        }
        [
ProtoContract]
        public class 
Scores
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint Type;
            [
ProtoMember(2IsRequired true)]
            public 
uint Score;
        }
        public static 
ConcurrentDictionary<uintGame.EntityRankingList;
        public 
void GetRankingList()
        {
            
RankingList = new ConcurrentDictionary<uintGame.Entity>();
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("entities"))
            
using (var reader = new MySqlReader(cmd))
            {
                while (
reader.Read())
                {
                    if (
reader.ReadUInt32("TotalPerfectionScore") < 20000) continue;
                    
Game.Entity client = new Game.Entity(Game.EntityFlag.Entityfalse);
                    
client.Name reader.ReadString("Name");
                    
client.UID reader.ReadUInt32("UID");
                    
client.Level reader.ReadByte("Level");
                    
client.Class = reader.ReadByte("Class");
                    
client.Body reader.ReadUInt16("Body");
                    
client.Face reader.ReadUInt16("Face");
                    
client.TotalPerfectionScore reader.ReadUInt32("TotalPerfectionScore");
                    if (
reader.ReadString("Wardrobe") != "")
                    {
                        if (
reader.ReadString("Wardrobe").Contains("~"))
                        {
                            var 
wing reader.ReadString("Wardrobe").Split('~')[0];
                            
int type Convert.ToInt32(wing.Split('-')[0]);
                            
int id Convert.ToInt32(wing.Split('-')[1]);
                            
client.EquippedWing StorageManager.Wing<int>(typeid);
                            var 
title reader.ReadString("Wardrobe").Split('~')[1];
                            
int type2 Convert.ToInt32(title.Split('-')[0]);
                            
int id2 Convert.ToInt32(title.Split('-')[1]);
                            
client.EquippedTitle StorageManager.Title<int>(type2id2);
                        }
                    }
                    
RankingList.Add(client.UIDKernel.GamePool.ContainsKey(client.UID) ? Kernel.GamePool[client.UID].Entity client);
                }
            }
        }
        public 
bool Read(byte[] packet)
        {
            try
            {
                var 
mypkt = new byte[packet.Length 4];
                Array.
Copy(packet4mypkt0mypkt.Length);
                
using (var memoryStream = new MemoryStream(packet))
                {
                    
Info Serializer.DeserializeWithLengthPrefix<MsgUserAbilityScoreProto>(memoryStreamPrefixStyle.Fixed32);
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
                return 
false;
            }
            return 
true;
        }
        public 
void SendScore(Client.GameState clientClient.GameState Observer)
        {
            var 
packet = new MsgUserAbilityScoreProto();
            
packet.ActionId 0;
            
packet.UID client.Entity.UID;
            
packet.Level client.Entity.Level;
            
packet.Scores = new Scores[20];
            for (
int i 0packet.Scores.Lengthi++)
            {
                
byte Type = (byte)(1);
                
packet.Scores[i] = new Scores();
                
packet.Scores[i].Type Type;
                
packet.Scores[i].Score GetScoreValue(clientType);
            }


            var 
proto Kernel.FinalizeProtoBuf(packet3253);
            
Observer.Send(proto);
        }
        public 
uint GetScoreValue(Client.GameState clientuint Type)
        {
            
uint Score 0;
            if (
Type == 1Score = (uint)MsgUserAbilityScore.CalculatePerfectionJiangPoints(client);
            if (
Type == 2Score = (uint)MsgUserAbilityScore.CalculatePerfectionChiPoints(client);
            if (
Type == 3Score = (uint)(client.Entity.InnerPower != null client.Entity.InnerPower.TotalScore 0);
            if (
Type == 4Score client.Equipment.GetFullEquipmentEnchantPoints;
            if (
Type == 5Score = (uint)(client.Entity.Level 140 client.Entity.Level 20 client.Entity.Level 25);
            if (
Type == 6Score client.Equipment.GetFullEquipmentPerfecetionLevelPoints;
            if (
Type == 7Score = (uint)((client.Entity.Vitality client.Entity.Atributes client.Entity.Spirit client.Entity.Strength client.Entity.Agility) * 5);
            if (
Type == 8Score = (uint)(client.Entity.Reborn 1000);
            if (
Type == 9Score client.Equipment.GetFullEquipmentEnumPoints;
            if (
Type == 10Score client.Equipment.GetFullEquipmentSocketPoints;
            if (
Type == 11Score client.Equipment.GetFullEquipmentGemPoints;
            if (
Type == 12Score client.Equipment.GetFullEquipmentRefinePoints;
            if (
Type == 13Score client.Equipment.GetFullEquipmentPlusPoints;
            if (
Type == 14Score client.Equipment.GetFullEquipmentSoulPoints;
            if (
Type == 15Score client.Equipment.GetFullEquipmentBlessPoints;
            if (
Type == 16Score CalculateSubClassPoints(client);
            if (
Type == 17Score Database.WardrobeTable.PerfectionPoints(clienttrue);
            if (
Type == 18Score Database.WardrobeTable.PerfectionPoints(clientfalse);
            if (
Type == 19Score = (uint)((uint)client.Entity.NobilityRank 1000);
            if (
Type == 20Score client.Equipment.GetFullEquipmentLevelPoints;
            return 
Score;
        }
        public 
void Handle(Client.GameState client)
        {
            switch (
Info.ActionId)
            {
                case 
1://Observ
                    
{
                        if (
Kernel.GamePool.ContainsKey(Info.UID))
                        {
                            
SendScore(clientclient);
                            
SendScore(Kernel.GamePool[Info.UID], client);
                        }
                        else
                        {
                            
client.Send(Kernel.FinalizeProtoBuf(new MsgUserAbilityScoreProto()
                            {
                                
ActionId 1,
                                
UID 0
                            
}, 3253));
                        }
                        break;
                    }
            }
        }
        public static 
int CalculatePerfectionChiPoints(Client.GameState client)
        {
            if (
client == null || client.ChiData == null || client.ChiData.Powers == null)
                return 
0;

            
int Point 0;
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 1) break;
                
Point += ((client.ChiData.Powers[0].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[0].Attributes[i].Type)) * 100) * 60;
            }
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 2) break;
                
Point += ((client.ChiData.Powers[1].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[1].Attributes[i].Type)) * 100) * 60;
            }
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 3) break;
                
Point += ((client.ChiData.Powers[2].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[2].Attributes[i].Type)) * 100) * 60;
            }
            for (
int i 04i++)
            {
                if (
client.ChiData.Powers.Count 4) break;
                
Point += ((client.ChiData.Powers[3].Attributes[i].Value Game.Enums.ChiMaxValues(client.ChiData.Powers[3].Attributes[i].Type)) * 100) * 60;
            }
            return 
Point;
        }
        
/*public static int CalculatePerfectionChiPoints(Client.GameState client)
        {
            int Point = 0;
            for (int i = 0; i < 4; i++)
            {
                if (client.ChiData.Powers.Count < 1) break;
                Point += ((client.ChiData.Powers[0].Attributes[i].Value / Game.Enums.ChiMaxValues(client.ChiData.Powers[0].Attributes[i].Type)) * 100) * 60;
            }
            for (int i = 0; i < 4; i++)
            {
                if (client.ChiData.Powers.Count < 2) break;
                Point += ((client.ChiData.Powers[1].Attributes[i].Value / Game.Enums.ChiMaxValues(client.ChiData.Powers[1].Attributes[i].Type)) * 100) * 60;
            }
            for (int i = 0; i < 4; i++)
            {
                if (client.ChiData.Powers.Count < 3) break;
                Point += ((client.ChiData.Powers[2].Attributes[i].Value / Game.Enums.ChiMaxValues(client.ChiData.Powers[2].Attributes[i].Type)) * 100) * 60;
            }
            for (int i = 0; i < 4; i++)
            {
                if (client.ChiData.Powers.Count < 4) break;
                Point += ((client.ChiData.Powers[3].Attributes[i].Value / Game.Enums.ChiMaxValues(client.ChiData.Powers[3].Attributes[i].Type)) * 100) * 60;
            }
            return Point;
        }*/
        
public static int CalculatePerfectionJiangPoints(Client.GameState client)
        {
            
int Points 0;
            if (
client.Entity.MyJiang != null)
            {
                if (
client.Entity.MyJiang.Inner_Strength == 0) return Points;
                if (
client.Entity.MyJiang.Inner_Strength <= 16200Points = (int)(client.Entity.MyJiang.Inner_Strength 0.3);
                else if (
client.Entity.MyJiang.Inner_Strength <= 40500Points = (int)(client.Entity.MyJiang.Inner_Strength 0.33);
                else if (
client.Entity.MyJiang.Inner_Strength <= 60750Points = (int)(client.Entity.MyJiang.Inner_Strength 0.36);
                else if (
client.Entity.MyJiang.Inner_Strength <= 72000Points = (int)(client.Entity.MyJiang.Inner_Strength 0.40);
                else if (
client.Entity.MyJiang.Inner_Strength <= 79200Points = (int)(client.Entity.MyJiang.Inner_Strength 0.45);
                else if (
client.Entity.MyJiang.Inner_Strength <= 80800Points = (int)(client.Entity.MyJiang.Inner_Strength 0.50);
                else if (
client.Entity.MyJiang.Inner_Strength <= 81000Points = (int)(client.Entity.MyJiang.Inner_Strength 0.60);
            }
            return 
Points;
        }
        public static 
uint CalculateSubClassPoints(Client.GameState client)
        {
            
uint Points 0;
            if (
client.Entity.SubClasses.Classes != null)
            {
                foreach (var 
sub in client.Entity.SubClasses.Classes.Values)
                {
                    if (
sub == null) continue;
                    
Points += (uint)(sub.Level == 1000 sub.Level 100);
                }
            }
            return 
Points;
        }
        public static 
uint CalculatePerfectionItemPoints(ConquerItem item)
        {
            
uint Points 50;
            if (
item == null || !Database.ConquerItemInformation.BaseInformations.ContainsKey(item.ID)) return 50;
            
            
#region edited by Rider  Plus
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.Plus == 1Points += 200;
                if (
item.Plus == 2Points += 600;
                if (
item.Plus == 3Points += 1200;
                if (
item.Plus == 4Points += 1800;
                if (
item.Plus == 5Points += 2600;
                if (
item.Plus == 6Points += 3500;
                if (
item.Plus == 7Points += 4800;
                if (
item.Plus == 8Points += 5800;
                if (
item.Plus == 9Points += 6800;
                if (
item.Plus == 10Points += 7800;
                if (
item.Plus == 11Points += 8800;
                if (
item.Plus == 12Points += 10000;
            }
            else
                foreach (
Client.GameState Owner in Program.Values)
                {
                    var 
Owner.Equipment.TryGetItem(ConquerItem.LeftWeapon);
                
                if (
Network.PacketHandler.IsTwoHand(item.ID) &&  (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null )
            {
                   
                if (
item.Plus == 1Points += 400;
                if (
item.Plus == 2Points += 1200;
                if (
item.Plus == 3Points += 2400;
                if (
item.Plus == 4Points += 3600;
                if (
item.Plus == 5Points += 5200;
                if (
item.Plus == 6Points += 7000;
                if (
item.Plus == 7Points += 9600;
                if (
item.Plus == 8Points += 11600;
                if (
item.Plus == 9Points += 13600;
                if (
item.Plus == 10Points += 15600;
                if (
item.Plus == 11Points += 17600;
                if (
item.Plus == 12Points += 20000;
            }
else
                {

                    if (
item.Plus == 1Points += 200;
                    if (
item.Plus == 2Points += 600;
                    if (
item.Plus == 3Points += 1200;
                    if (
item.Plus == 4Points += 1800;
                    if (
item.Plus == 5Points += 2600;
                    if (
item.Plus == 6Points += 3500;
                    if (
item.Plus == 7Points += 4800;
                    if (
item.Plus == 8Points += 5800;
                    if (
item.Plus == 9Points += 6800;
                    if (
item.Plus == 10Points += 7800;
                    if (
item.Plus == 11Points += 8800;
                    if (
item.Plus == 12Points += 10000;
                }
            
#endregion
            #region edited by Rider  Quality 
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.ID 10 == 9Points += 500;
                if (
item.ID 10 == 8Points += 300;
                if (
item.ID 10 == 7Points += 200;
                if (
item.ID 10 == 6Points += 100;
                if (
item.ID 10 && item.ID 10 6Points += 50;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.ID 10 == 9Points += 1000;
                if (
item.ID 10 == 8Points += 600;
                if (
item.ID 10 == 7Points += 400;
                if (
item.ID 10 == 6Points += 200;
                if (
item.ID 10 && item.ID 10 6Points += 100;
            }
            else
            {
                if (
item.ID 10 == 9Points += 500;
                if (
item.ID 10 == 8Points += 300;
                if (
item.ID 10 == 7Points += 200;
                if (
item.ID 10 == 6Points += 100;
                if (
item.ID 10 && item.ID 10 6Points += 50;
            }
            
#endregion
            #region edited by Rider  Soul
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.Purification.PurificationLevel == 1Points += 100;
                if (
item.Purification.PurificationLevel == 2Points += 300;
                if (
item.Purification.PurificationLevel == 3Points += 500;
                if (
item.Purification.PurificationLevel == 4Points += 800;
                if (
item.Purification.PurificationLevel == 5Points += 1200;
                if (
item.Purification.PurificationLevel == 6Points += 1600;
                if (
item.Purification.PurificationLevel == 7Points += 2000;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.Purification.PurificationLevel == 1Points += 200;
                if (
item.Purification.PurificationLevel == 2Points += 600;
                if (
item.Purification.PurificationLevel == 3Points += 1000;
                if (
item.Purification.PurificationLevel == 4Points += 1600;
                if (
item.Purification.PurificationLevel == 5Points += 2400;
                if (
item.Purification.PurificationLevel == 6Points += 3200;
                if (
item.Purification.PurificationLevel == 7Points += 4000;
            }
            else
            {
                if (
item.Purification.PurificationLevel == 1Points += 100;
                if (
item.Purification.PurificationLevel == 2Points += 300;
                if (
item.Purification.PurificationLevel == 3Points += 500;
                if (
item.Purification.PurificationLevel == 4Points += 800;
                if (
item.Purification.PurificationLevel == 5Points += 1200;
                if (
item.Purification.PurificationLevel == 6Points += 1600;
                if (
item.Purification.PurificationLevel == 7Points += 2000;
            }
            
#endregion
            #region edited by Rider  Bless
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                
Points += (uint)(item.Bless 100);
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                
Points += (uint)(item.Bless 200);
            }
            else
            {
                
Points += (uint)(item.Bless 100);
            }
            
#region edited by Rider  Refine
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.ExtraEffect.EffectLevel == 1Points += 100;
                if (
item.ExtraEffect.EffectLevel == 2Points += 400;
                if (
item.ExtraEffect.EffectLevel == 3Points += 800;
                if (
item.ExtraEffect.EffectLevel == 4Points += 1200;
                if (
item.ExtraEffect.EffectLevel == 5Points += 1600;
                if (
item.ExtraEffect.EffectLevel == 6Points += 2000;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.ExtraEffect.EffectLevel == 1Points += 200;
                if (
item.ExtraEffect.EffectLevel == 2Points += 800;
                if (
item.ExtraEffect.EffectLevel == 3Points += 1600;
                if (
item.ExtraEffect.EffectLevel == 4Points += 2400;
                if (
item.ExtraEffect.EffectLevel == 5Points += 3200;
                if (
item.ExtraEffect.EffectLevel == 6Points += 4000;
            }
            else
            {
                if (
item.ExtraEffect.EffectLevel == 1Points += 100;
                if (
item.ExtraEffect.EffectLevel == 2Points += 400;
                if (
item.ExtraEffect.EffectLevel == 3Points += 800;
                if (
item.ExtraEffect.EffectLevel == 4Points += 1200;
                if (
item.ExtraEffect.EffectLevel == 5Points += 1600;
                if (
item.ExtraEffect.EffectLevel == 6Points += 2000;
            }
            
#endregion
            #endregion
            #region edited by Rider  Level
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                var 
lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
                if (
lvl <= 120)
                    
Points += lvl 3;
                else if (
lvl <= 130)
                    
Points += lvl 5;
                else if (
lvl <= 140)
                    
Points += lvl 6;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                var 
lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
                if (
lvl <= 120)
                    
Points += lvl 6;
                else if (
lvl <= 130)
                    
Points += lvl 10;
                else if (
lvl <= 140)
                    
Points += lvl 12;
            }
            else
            {
                var 
lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
                if (
lvl <= 120)
                    
Points += lvl 3;
                else if (
lvl <= 130)
                    
Points += lvl 5;
                else if (
lvl <= 140)
                    
Points += lvl 6;
            }
            
#endregion
            #region edited by Rider  Gem
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.SocketOne != (Game.Enums.Gem)0)
                {
                    if (
item.SocketOne2 10 == 1Points += 200;
                    if (
item.SocketOne2 10 == 2Points += 500;
                    if (
item.SocketOne2 10 == 3Points += 800;
                }
                if (
item.SocketTwo != (Game.Enums.Gem)0)
                {
                    if (
item.SocketTwo2 10 == 1Points += 200;
                    if (
item.SocketTwo2 10 == 2Points += 500;
                    if (
item.SocketTwo2 10 == 3Points += 800;
                }
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.SocketOne != (Game.Enums.Gem)0)
                {
                    if (
item.SocketOne2 10 == 1Points += 400;
                    if (
item.SocketOne2 10 == 2Points += 1000;
                    if (
item.SocketOne2 10 == 3Points += 1600;
                }
                if (
item.SocketTwo != (Game.Enums.Gem)0)
                {
                    if (
item.SocketTwo2 10 == 1Points += 400;
                    if (
item.SocketTwo2 10 == 2Points += 1000;
                    if (
item.SocketTwo2 10 == 3Points += 1600;
                }
            }
            else
            {
                if (
item.SocketOne != (Game.Enums.Gem)0)
                {
                    if (
item.SocketOne2 10 == 1Points += 200;
                    if (
item.SocketOne2 10 == 2Points += 500;
                    if (
item.SocketOne2 10 == 3Points += 800;
                }
                if (
item.SocketTwo != (Game.Enums.Gem)0)
                {
                    if (
item.SocketTwo2 10 == 1Points += 200;
                    if (
item.SocketTwo2 10 == 2Points += 500;
                    if (
item.SocketTwo2 10 == 3Points += 800;
                }
            }
            
#endregion
            #region edited by Rider  Stars
            
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.Stars >= 1Points += 180;
                if (
item.Stars >= 2Points += 180;
                if (
item.Stars >= 3Points += 180;
                if (
item.Stars >= 4Points += 180;
                if (
item.Stars >= 5Points += 180;
                if (
item.Stars >= 6Points += 180;
                if (
item.Stars >= 7Points += 180;
                if (
item.Stars >= 8Points += 180;
                if (
item.Stars >= 9Points += 180;
                if (
item.Stars >= 10Points += 2380;
                if (
item.Stars >= 11Points += 400;
                if (
item.Stars >= 12Points += 400;
                if (
item.Stars >= 13Points += 400;
                if (
item.Stars >= 14Points += 400;
                if (
item.Stars >= 15Points += 400;
                if (
item.Stars >= 16Points += 400;
                if (
item.Stars >= 17Points += 400;
                if (
item.Stars >= 18Points += 400;
                if (
item.Stars >= 19Points += 5150;
                if (
item.Stars >= 20Points += 650;
                if (
item.Stars >= 21Points += 650;
                if (
item.Stars >= 22Points += 650;
                if (
item.Stars >= 23Points += 650;
                if (
item.Stars >= 24Points += 650;
                if (
item.Stars >= 25Points += 650;
                if (
item.Stars >= 26Points += 650;
                if (
item.Stars >= 27Points += 650;
                if (
item.Stars >= 28Points += 100;
                if (
item.Stars >= 29Points += 100;
                if (
item.Stars >= 30Points += 100;
                if (
item.Stars >= 31Points += 100;
                if (
item.Stars >= 32Points += 100;
                if (
item.Stars >= 33Points += 100;
                if (
item.Stars >= 34Points += 100;
                if (
item.Stars >= 35Points += 100;
                if (
item.Stars >= 36Points += 100;
                if (
item.Stars >= 37Points += 100;
                if (
item.Stars >= 38Points += 100;
                if (
item.Stars >= 39Points += 100;
                if (
item.Stars >= 40Points += 100;
                if (
item.Stars >= 41Points += 100;
                if (
item.Stars >= 42Points += 100;
                if (
item.Stars >= 43Points += 100;
                if (
item.Stars >= 44Points += 100;
                if (
item.Stars >= 45Points += 100;
                if (
item.Stars >= 46Points += 100;
                if (
item.Stars >= 47Points += 100;
                if (
item.Stars >= 48Points += 100;
                if (
item.Stars >= 49Points += 100;
                if (
item.Stars >= 50Points += 100;
                if (
item.Stars >= 51Points += 100;
                if (
item.Stars >= 52Points += 100;
                if (
item.Stars >= 53Points += 100;
                if (
item.Stars >= 54Points += 100;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
            {
                if (
item.Stars >= 1Points += 180;
                if (
item.Stars >= 2Points += 180;
                if (
item.Stars >= 3Points += 180;
                if (
item.Stars >= 4Points += 180;
                if (
item.Stars >= 5Points += 180;
                if (
item.Stars >= 6Points += 180;
                if (
item.Stars >= 7Points += 180;
                if (
item.Stars >= 8Points += 180;
                if (
item.Stars >= 9Points += 180;
                if (
item.Stars >= 10Points += 2380;
                if (
item.Stars >= 11Points += 400;
                if (
item.Stars >= 12Points += 400;
                if (
item.Stars >= 13Points += 400;
                if (
item.Stars >= 14Points += 400;
                if (
item.Stars >= 15Points += 400;
                if (
item.Stars >= 16Points += 400;
                if (
item.Stars >= 17Points += 400;
                if (
item.Stars >= 18Points += 400;
                if (
item.Stars >= 19Points += 5150;
                if (
item.Stars >= 20Points += 650;
                if (
item.Stars >= 21Points += 650;
                if (
item.Stars >= 22Points += 650;
                if (
item.Stars >= 23Points += 650;
                if (
item.Stars >= 24Points += 650;
                if (
item.Stars >= 25Points += 650;
                if (
item.Stars >= 26Points += 650;
                if (
item.Stars >= 27Points += 650;
                if (
item.Stars >= 28Points += 100;
                if (
item.Stars >= 29Points += 100;
                if (
item.Stars >= 30Points += 100;
                if (
item.Stars >= 31Points += 100;
                if (
item.Stars >= 32Points += 100;
                if (
item.Stars >= 33Points += 100;
                if (
item.Stars >= 34Points += 100;
                if (
item.Stars >= 35Points += 100;
                if (
item.Stars >= 36Points += 100;
                if (
item.Stars >= 37Points += 100;
                if (
item.Stars >= 38Points += 100;
                if (
item.Stars >= 39Points += 100;
                if (
item.Stars >= 40Points += 100;
                if (
item.Stars >= 41Points += 100;
                if (
item.Stars >= 42Points += 100;
                if (
item.Stars >= 43Points += 100;
                if (
item.Stars >= 44Points += 100;
                if (
item.Stars >= 45Points += 100;
                if (
item.Stars >= 46Points += 100;
                if (
item.Stars >= 47Points += 100;
                if (
item.Stars >= 48Points += 100;
                if (
item.Stars >= 49Points += 100;
                if (
item.Stars >= 50Points += 100;
                if (
item.Stars >= 51Points += 100;
                if (
item.Stars >= 52Points += 100;
                if (
item.Stars >= 53Points += 100;
                if (
item.Stars >= 54Points += 100;

            }
            else
            {
                if (
item.Stars >= 1Points += 180;
            if (
item.Stars >= 2Points += 180;
            if (
item.Stars >= 3Points += 180;
            if (
item.Stars >= 4Points += 180;
            if (
item.Stars >= 5Points += 180;
            if (
item.Stars >= 6Points += 180;
            if (
item.Stars >= 7Points += 180;
            if (
item.Stars >= 8Points += 180;
            if (
item.Stars >= 9Points += 180;
            if (
item.Stars >= 10Points += 2380;
            if (
item.Stars >= 11Points += 400;
            if (
item.Stars >= 12Points += 400;
            if (
item.Stars >= 13Points += 400;
            if (
item.Stars >= 14Points += 400;
            if (
item.Stars >= 15Points += 400;
            if (
item.Stars >= 16Points += 400;
            if (
item.Stars >= 17Points += 400;
            if (
item.Stars >= 18Points += 400;
            if (
item.Stars >= 19Points += 5150;
            if (
item.Stars >= 20Points += 650;
            if (
item.Stars >= 21Points += 650;
            if (
item.Stars >= 22Points += 650;
            if (
item.Stars >= 23Points += 650;
            if (
item.Stars >= 24Points += 650;
            if (
item.Stars >= 25Points += 650;
            if (
item.Stars >= 26Points += 650;
            if (
item.Stars >= 27Points += 650;
            if (
item.Stars >= 28Points += 100;
            if (
item.Stars >= 29Points += 100;
            if (
item.Stars >= 30Points += 100;
            if (
item.Stars >= 31Points += 100;
            if (
item.Stars >= 32Points += 100;
            if (
item.Stars >= 33Points += 100;
            if (
item.Stars >= 34Points += 100;
            if (
item.Stars >= 35Points += 100;
            if (
item.Stars >= 36Points += 100;
            if (
item.Stars >= 37Points += 100;
            if (
item.Stars >= 38Points += 100;
            if (
item.Stars >= 39Points += 100;
            if (
item.Stars >= 40Points += 100;
            if (
item.Stars >= 41Points += 100;
            if (
item.Stars >= 42Points += 100;
            if (
item.Stars >= 43Points += 100;
            if (
item.Stars >= 44Points += 100;
            if (
item.Stars >= 45Points += 100;
            if (
item.Stars >= 46Points += 100;
            if (
item.Stars >= 47Points += 100;
            if (
item.Stars >= 48Points += 100;
            if (
item.Stars >= 49Points += 100;
            if (
item.Stars >= 50Points += 100;
            if (
item.Stars >= 51Points += 100;
            if (
item.Stars >= 52Points += 100;
            if (
item.Stars >= 53Points += 100;
            if (
item.Stars >= 54Points += 100;
                }
            
#endregion
            #region edited by Rider  Socket
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                if (
item.SocketOne != (Game.Enums.Gem)0Points += 1000;
                if (
item.SocketTwo != (Game.Enums.Gem)0Points += 2500;
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                if (
item.SocketOne != (Game.Enums.Gem)0Points += 2000;
                if (
item.SocketTwo != (Game.Enums.Gem)0Points += 5000;
            }
            else
            {
                if (
item.SocketOne != (Game.Enums.Gem)0Points += 1000;
                if (
item.SocketTwo != (Game.Enums.Gem)0Points += 2500;
            }
            
#endregion
            #region edited by Rider  Enchant
            
if (!Network.PacketHandler.IsTwoHand(item.ID))
            {
                var 
enc = (uint)(item.Enchant);
                if (
enc != 0)
                {
                    if (
enc <= 200Points += enc 1;
                    if (
enc <= 240Points += (uint)(enc 1.3);
                    if (
enc <= 254Points += (uint)(enc 1.6);
                    if (
enc <= 255Points += enc 2;
                }
            }
            else if (
Network.PacketHandler.IsTwoHand(item.ID) && (Network.PacketHandler.ItemPosition(item.ID) != ConquerItem.LeftWeapon) && == null)
         
            {
                var 
enc = (uint)(item.Enchant);
                if (
enc != 0)
                {
                    if (
enc <= 200Points += enc 2;
                    if (
enc <= 240Points += (uint)(enc 2.6);
                    if (
enc <= 254Points += (uint)(enc 3.2);
                    if (
enc <= 255Points += enc 4;
                }
            }
            else
            {
                var 
enc = (uint)(item.Enchant);
                if (
enc != 0)
                {
                    if (
enc <= 200Points += enc 1;
                    if (
enc <= 240Points += (uint)(enc 1.3);
                    if (
enc <= 254Points += (uint)(enc 1.6);
                    if (
enc <= 255Points += enc 2;
                }
            }
            
#endregion
                
}
            return 
Points;
        }
    }
    public class 
MsgItemRefineOpt
    
{
        public 
MsgItemRefineOpt() { }
        public 
MsgItemRefineOptProto Info;
        public 
MsgItemRefineOptProto2 Info2;
        [
ProtoContract]
        public class 
MsgItemRefineOptProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint ItemUID;
            [
ProtoMember(3IsRequired true)]
            public 
string Signature;
            [
ProtoMember(4IsRequired true)]
            public 
uint ItemPlusUID;
        }
        [
ProtoContract]
        public class 
MsgItemRefineOptProto2
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ItemUID;
            [
ProtoMember(2IsRequired true)]
            public 
uint EntityUID;
            [
ProtoMember(3IsRequired true)]
            public 
uint Stars;
            [
ProtoMember(4IsRequired true)]
            public 
uint Progress;
            [
ProtoMember(5IsRequired true)]
            public 
uint OwnerUID;
            [
ProtoMember(6IsRequired true)]
            public 
string OwnerName;
        }
        public 
double GetPerfectionProgress(uint value)
        {
            return (
value 1.25);
        }
        public 
uint GetPerfectionProgress(ConquerItem item)
        {
            if (
item.Stars == 0) return 30;
            if (
item.Stars == 1) return 60;
            if (
item.Stars == 2) return 100;
            if (
item.Stars == 3) return 200;
            if (
item.Stars == 4) return 350;
            if (
item.Stars == 5) return 600;
            if (
item.Stars == 6) return 1000;
            if (
item.Stars == 7) return 1500;
            if (
item.Stars == 8) return 2300;
            if (
item.Stars == 9) return 3500;
            if (
item.Stars == 10) return 5000;
            if (
item.Stars == 11) return 6500;
            if (
item.Stars == 12) return 8000;
            if (
item.Stars == 13) return 9500;
            if (
item.Stars == 14) return 11000;
            return 
12000;
        }
        public 
uint GetPlusStonePoints(uint value)
        {
            if (
value == 3009000) return 10;
            if (
value == 3009001) return 100;
            if (
value == 3009002) return 1000;
            if (
value == 3009003) return 10000;
            if (
value == 730001 || value == 1) return 10;
            if (
value == 730002 || value == 2) return 40;
            if (
value == 730003 || value == 3) return 120;
            if (
value == 730004 || value == 4) return 360;
            if (
value == 730005 || value == 5) return 1080;
            if (
value == 730006 || value == 6) return 3240;
            if (
value == 730007 || value == 7) return 9720;
            if (
value == 730008 || value == 8) return 29160;
            if (
value == 9) return 87480;
            if (
value == 10) return 90180;
            if (
value == 11) return 95680;
            if (
value == 12) return 104680;
            return 
0;
        }
        public 
uint GetTransferCost(Network.GamePackets.ConquerItem item)
        {
            if (
item.Stars == 2) return 30;
            if (
item.Stars == 3) return 70;
            if (
item.Stars == 4) return 150;
            if (
item.Stars == 5) return 300;
            if (
item.Stars == 6) return 500;
            if (
item.Stars == 7) return 800;
            if (
item.Stars == 8) return 1100;
            if (
item.Stars >= 9) return 1500;
            return 
10;
        }
        public 
void Handle(Client.GameState clientbyte[] myPacket)
        {
            try
            {
                switch (
Info.ActionId)
                {
                    case 
0://Temper
                        
{
                            
#region edited by Rider  Minors
                            
var packet2 = new byte[myPacket.Length 4];
                            Array.
Copy(myPacket4packet20packet2.Length);
                            var 
variable Kernel.Read7BitEncodedInt(packet2).SelectMany(System.BitConverter.GetBytes).ToArray();
                            var 
variable2 = new byte[variable.Length 8];
                            Array.
Copy(variable8variable20variable.Length 8);
                            var 
MinorsCount = (variable2.Length 4);
                            
uint[] Minors = new uint[MinorsCount];
                            
byte x 0;
                            for (
int i 0MinorsCounti++)
                            {
                                
Minors[i] = BitConverter.ToUInt32(variable2x);
                                
+= 4;
                            }
                            
#endregion
                            
if (Minors != null)
                            {
                                
ConquerItem Item;
                                if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                                {
                                    foreach (var 
minor in Minors)
                                    {
                                        
ConquerItem ItemPlus;
                                        if (
client.Inventory.TryGetItem(minorout ItemPlus))
                                        {
                                            
Item.PerfectionProgress += GetPlusStonePoints(ItemPlus.ID == 300000 ItemPlus.Plus ItemPlus.ID)/*Database.PerfectionTable.CostList[ItemPlus.ID].Progress*/;
                                            
client.Inventory.Remove(minorGame.Enums.ItemUse.Removetrue);
                                        }
                                    }
                                    while (
Item.PerfectionProgress >= GetPerfectionProgress(Item)/*Database.PerfectionTable.UpgradeList.Where(i => i.Stars == (Item.Stars + 1)).FirstOrDefault().Progress*/)
                                    {
                                        
Item.PerfectionProgress -= GetPerfectionProgress(Item)/*Database.PerfectionTable.UpgradeList.Where(i => i.Stars == (Item.Stars + 1)).FirstOrDefault().Progress*/;
                                        
Item.Stars++;
                                    }
                                    while (
Item.Stars >= 54 && Item.PerfectionProgress 0)
                                    {
                                        
Item.Stars 54;
                                        
Item.PerfectionProgress 0;
                                    }
                                    
Item.Owner client.Entity.Name;
                                    
Item.OwnerUID client.Entity.UID;
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
client.LoadItemStats();
                                    
client.Send(proto);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                    new 
MsgUserTotalRefineLev().Send(client);

                                }
                            }

                            break;
                        }
                    case 
1://Transfer
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                            {
                                if (
client.Entity.BoundCps >= 50000)
                                {
                                    
client.Entity.BoundCps -= 50000;
                                    
Item.Owner client.Entity.Name;
                                    
Item.OwnerUID client.Entity.UID;
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
client.Send(proto);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                }
                            }
                            break;
                        }
                    case 
2://Signature
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                            {
                                if (
Item.Signature == String.Empty || Item.Signature == null)
                                {
                                    
Item.Signature Info.Signature;
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                }
                                else
                                {
                                    if (
client.Entity.ConquerPoints >= 270)
                                    {
                                        
client.Entity.ConquerPoints -= 270;
                                        
Item.Signature Info.Signature;
                                        
Item.Mode Game.Enums.ItemMode.Update;
                                        
Item.Send(client);
                                        var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                        {
                                            
ItemUID Item.UID,
                                            
EntityUID client.Entity.UID,
                                            
OwnerUID Item.OwnerUID,
                                            
OwnerName Item.Owner,
                                            
Progress Item.PerfectionProgress,
                                            
Stars Item.Stars
                                        
}), 3250);
                                        
Database.ConquerItemTable.UpdatePerfection(Item);
                                    }
                                    else if (
client.Entity.BoundCps >= 270)
                                    {
                                        
client.Entity.BoundCps -= 270;
                                        
Item.Signature Info.Signature;
                                        
Item.Mode Game.Enums.ItemMode.Update;
                                        
Item.Send(client);
                                        var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                        {
                                            
ItemUID Item.UID,
                                            
EntityUID client.Entity.UID,
                                            
OwnerUID Item.OwnerUID,
                                            
OwnerName Item.Owner,
                                            
Progress Item.PerfectionProgress,
                                            
Stars Item.Stars
                                        
}), 3250);
                                        
Database.ConquerItemTable.UpdatePerfection(Item);
                                    }
                                }

                            }
                            break;
                        }
                    case 
3://CPBoost
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item) && Item != null)
                            {
                                
uint value;
                                
value Math.Min(414112client.Entity.ConquerPoints);
                                if (
client.Entity.ConquerPoints >= value)
                                {
                                    
client.Entity.ConquerPoints -= value;
                                    
Item.Owner client.Entity.Name;
                                    
Item.OwnerUID client.Entity.UID;
                                    
Item.PerfectionProgress += (uint)GetPerfectionProgress(value);
                                    while (
Item.PerfectionProgress >= GetPerfectionProgress(Item))
                                    {
                                        
Item.PerfectionProgress -= GetPerfectionProgress(Item);
                                        
Item.Stars++;
                                    }
                                    while (
Item.Stars >= 54 && Item.PerfectionProgress 0)
                                    {
                                        
Item.Stars 54;
                                        
Item.PerfectionProgress 0;
                                    }
                                    
Item.Mode Game.Enums.ItemMode.Update;
                                    
Item.Send(client);
                                    var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                    {
                                        
ItemUID Item.UID,
                                        
EntityUID client.Entity.UID,
                                        
OwnerUID Item.OwnerUID,
                                        
OwnerName Item.Owner,
                                        
Progress Item.PerfectionProgress,
                                        
Stars Item.Stars
                                    
}), 3250);
                                    
client.Send(proto);
                                    
Database.ConquerItemTable.UpdatePerfection(Item);
                                }
                            }
                            break;
                        }
                    case 
4://Exchange
                        
{
                            
ConquerItem Item;
                            
ConquerItem Item2;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item2) || client.Inventory.TryGetItem(Info.ItemUIDout Item2))
                            {
                                if (
client.Inventory.TryGetItem(Info.ItemPlusUIDout Item) || client.Equipment.TryGetItem(Info.ItemPlusUIDout Item))
                                {
                                    if (
client.Entity.BoundCps >= 200000)
                                    {
                                        
client.Entity.BoundCps -= 200000;
                                        
Item.PerfectionProgress Item2.PerfectionProgress;
                                        
Item.Stars Item2.Stars;
                                        
Item.Mode Game.Enums.ItemMode.Update;
                                        
Item.Send(client);
                                        
Item2.PerfectionProgress 0;
                                        
Item2.Stars 0;
                                        
Item2.Mode Game.Enums.ItemMode.Update;
                                        
Item2.Send(client);
                                        var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                        {
                                            
ItemUID Item.UID,
                                            
EntityUID client.Entity.UID,
                                            
OwnerUID Item.OwnerUID,
                                            
OwnerName Item.Owner,
                                            
Progress Item.PerfectionProgress,
                                            
Stars Item.Stars
                                        
}), 3250);
                                        
Database.ConquerItemTable.UpdatePerfection(Item);
                                    }
                                }
                            }
                            break;
                        }
                    case 
5://Quick
                        
{
                            
ConquerItem Item;
                            if (
client.Equipment.TryGetItem(Info.ItemUIDout Item))
                            {
                                if (
Item.PerfectionProgress == || Item.Stars >= 54) break;
                                
double percent = (double)Item.PerfectionProgress / (double)GetPerfectionProgress(Item) * 0;
                                if (
Kernel.Rate(percent))
                                {
                                    
Item.Stars++;
                                }
                                
Item.PerfectionProgress 0;
                                
Item.Owner client.Entity.Name;
                                
Item.OwnerUID client.Entity.UID;
                                
Item.Mode Game.Enums.ItemMode.Update;
                                
Item.Send(client);
                                var 
proto Kernel.FinalizeProtoBuf((new MsgItemRefineOptProto2()
                                {
                                    
ItemUID Item.UID,
                                    
EntityUID client.Entity.UID,
                                    
OwnerUID Item.OwnerUID,
                                    
OwnerName Item.Owner,
                                    
Progress Item.PerfectionProgress,
                                    
Stars Item.Stars
                                
}), 3250);
                                
Database.ConquerItemTable.UpdatePerfection(Item);
                                
client.LoadItemStats();
                            }
                            break;
                        }
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
            }
        }
        public 
byte GetStars(byte Stars)
        {
            if (
Stars >= && Stars <= 8) return 9;
            if (
Stars >= && Stars <= 17) return 18;
            if (
Stars >= 18 && Stars <= 26) return 27;
            if (
Stars >= 27 && Stars <= 35) return 36;
            if (
Stars >= 36 && Stars <= 44) return 45;
            if (
Stars >= 45 && Stars <= 53) return 54;
            return 
0;
        }
        public 
byte[] GetBytes(string packetString)
        {
            if (
packetString != "" && packetString != null && packetString != string.Empty && packetString != " ")
            {
                
byte[] bytes = new byte[(packetString.Length 3) + 1];
                
int t 0;
                for (
int i 0packetString.Length+= 3)
                {
                    
string cha packetString.Substring(i2);
                    
bytes[t] = byte.Parse(chaSystem.Globalization.NumberStyles.HexNumber);
                    
t++;
                }
                return 
bytes;
            }
            return 
null;
        }
        public 
bool Read(byte[] packet)
        {
            try
            {
                var 
mypkt = new byte[packet.Length 4];
                Array.
Copy(packet4mypkt0mypkt.Length);
                
using (var memoryStream = new MemoryStream(packet))
                {
                    
Info Serializer.DeserializeWithLengthPrefix<MsgItemRefineOptProto>(memoryStreamPrefixStyle.Fixed32);
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
                return 
false;
            }
            return 
true;
        }
    }
    public class 
MsgItemRefineRecord
    
{
        public 
MsgItemRefineRecord() { }
        public 
MsgItemRefineRecordProto Info;
        [
ProtoContract]
        public class 
MsgItemRefineRecordProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint MaxStars;
        }
        public 
void Handle(Client.GameState client)
        {
            switch (
Info.ActionId)
            {
                case 
0:
                    {
                        
Send(client);
                        break;
                    }
            }
        }
        public 
void Send(Client.GameState client)
        {
            
client.Send(Kernel.FinalizeProtoBuf(new MsgItemRefineRecordProto()
            {
                
ActionId 0,
                
MaxStars 54
            
}, 3255));
        }
        public 
bool Read(byte[] packet)
        {
            var 
mypkt = new byte[packet.Length 4];
            Array.
Copy(packet4mypkt0mypkt.Length);
            
using (var memoryStream = new MemoryStream(packet))
            {
                
Info Serializer.DeserializeWithLengthPrefix<MsgItemRefineRecordProto>(memoryStreamPrefixStyle.Fixed32);
            }
            return 
true;
        }
    }
    public class 
MsgRankMemberShow
    
{
        public 
MsgRankMemberShow() { }
        public 
MsgRankMemberShowProto Info;
        [
ProtoContract]
        public class 
MsgRankMemberShowProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
MsgRankMemberShowProtoSer proto;
        }
        [
ProtoContract]
        public class 
MsgRankMemberShowProtoSer
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint dwParam;
            [
ProtoMember(2IsRequired true)]
            public 
uint Count;
            [
ProtoMember(3IsRequired true)]
            public 
uint UID;
            [
ProtoMember(4IsRequired true)]
            public 
string Name "";
            [
ProtoMember(5IsRequired true)]
            public 
string Guild "";
            [
ProtoMember(6IsRequired true)]
            public 
uint Mesh;
            [
ProtoMember(7IsRequired true)]
            public 
uint HairStyle;
            [
ProtoMember(8IsRequired true)]
            public 
uint Hat;
            [
ProtoMember(9IsRequired true)]
            public 
uint Garment;
            [
ProtoMember(10IsRequired true)]
            public 
uint LeftWep;
            [
ProtoMember(11IsRequired true)]
            public 
uint LeftWepAcc;
            [
ProtoMember(12IsRequired true)]
            public 
uint RightWep;
            [
ProtoMember(13IsRequired true)]
            public 
uint RightWepAcc;
            [
ProtoMember(14IsRequired true)]
            public 
uint MountArmor;
            [
ProtoMember(15IsRequired true)]
            public 
uint Flag;
            [
ProtoMember(16IsRequired true)]
            public 
uint Wing;
            [
ProtoMember(17IsRequired true)]
            public 
uint WingLevel;
            [
ProtoMember(18IsRequired true)]
            public 
uint Title;
            [
ProtoMember(19IsRequired true)]
            public 
uint Flag2;
            [
ProtoMember(20IsRequired true)]
            public 
uint Flag3;
            [
ProtoMember(21IsRequired true)]
            public 
uint Flag4;
        }
        public 
void UpdateBestEntity()
        {
            
DateTime StartTime DateTime.Now;
            
Items = new Dictionary<byteuint>();
            
BestEntity MsgUserAbilityScore.RankingList.OrderByDescending(=> i.Value.TotalPerfectionScore).ThenByDescending(=> i.Value.Level).ThenBy(=> i.Value.UID).FirstOrDefault().Value;
            if (
BestEntity == null) return;


            
byte[] Positions = new byte[10] { 134591215161719 };
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("items").Where("EntityID"BestEntity.UID))
            
using (var reader = new MySqlReader(cmd))
            {
                while (
reader.Read())
                {
                    foreach (var 
pos in Positions)
                    {
                        if (
reader.ReadByte("Position") == pos)
                        {
                            if (
Items.ContainsKey(pos)) Items.Remove(pos);
                            
Items.Add(posreader.ReadUInt32("ID"));
                            if (
pos == 19Items.Add(255reader.ReadByte("Plus"));
                            break;
                        }
                    }
                }
            }
            foreach (var 
pos in Positions)
            {
                if (!
Items.ContainsKey(pos)) Items.Add(pos0);
            }
            if (!
Items.ContainsKey(255)) Items.Add(2550);
        }
        public static 
Dictionary<byteuintItems = new Dictionary<byteuint>();
        public static 
Game.Entity BestEntity;
        public 
void Handle(Client.GameState client)
        {
            if (
BestEntity == null) return;
            switch (
Info.ActionId)
            {
                case 
0:
                    {
                        var 
proto2 = new MsgRankMemberShowProto();
                        
proto2.ActionId 0;
                        
proto2.proto = new MsgRankMemberShowProtoSer();
                        
proto2.proto.dwParam 1;
                        
proto2.proto.Count 1;
                        
proto2.proto.UID BestEntity.UID;
                        
#region edited by Rider  If He Is Online
                        
if (Kernel.GamePool.ContainsKey(BestEntity.UID))
                        {
                            var 
Entity Kernel.GamePool[BestEntity.UID].Entity;
                            
proto2.proto.HairStyle Entity.HairStyle;
                            
proto2.proto.Mesh Entity.Mesh;
                            
proto2.proto.Name Entity.Name;
                            if (
BestEntity.GuildID != 0)
                                
proto2.proto.Guild Kernel.Guilds[BestEntity.GuildID].Name;
                            if (
Entity.Owner.Equipment != null)
                            {
                                var 
Equipment Entity.Owner.Equipment;
                                
proto2.proto.Hat Equipment.TryGetItem((byte)ConquerItem.Head) != null Equipment.TryGetItem((byte)ConquerItem.Head).ID 0;
                                
proto2.proto.LeftWep Equipment.TryGetItem((byte)ConquerItem.LeftWeapon) != null Equipment.TryGetItem((byte)ConquerItem.LeftWeapon).ID 0;
                                
proto2.proto.LeftWepAcc Equipment.TryGetItem((byte)ConquerItem.LeftWeaponAccessory) != null Equipment.TryGetItem((byte)ConquerItem.LeftWeaponAccessory).ID 0;
                                
proto2.proto.MountArmor Equipment.TryGetItem((byte)ConquerItem.SteedArmor) != null Equipment.TryGetItem((byte)ConquerItem.SteedArmor).ID : (Equipment.TryGetItem((byte)ConquerItem.Steed) != null Equipment.TryGetItem((byte)ConquerItem.Steed).ID 0);
                                
proto2.proto.Garment Equipment.TryGetItem((byte)ConquerItem.Garment) != null Equipment.TryGetItem((byte)ConquerItem.Garment).ID : ((Equipment.TryGetItem((byte)ConquerItem.Armor) != null Equipment.TryGetItem((byte)ConquerItem.Armor).ID 0));
                                
proto2.proto.RightWep Equipment.TryGetItem((byte)ConquerItem.RightWeapon) != null Equipment.TryGetItem((byte)ConquerItem.RightWeapon).ID 0;
                                
proto2.proto.RightWepAcc Equipment.TryGetItem((byte)ConquerItem.RightWeaponAccessory) != null Equipment.TryGetItem((byte)ConquerItem.RightWeaponAccessory).ID 0;
                                
proto2.proto.Wing Entity.EquippedWing == ? (Equipment.TryGetItem((byte)ConquerItem.Wing) != null Equipment.TryGetItem((byte)ConquerItem.Wing).ID 0) : (uint)Entity.EquippedWing;
                                
proto2.proto.WingLevel = (byte)(Equipment.TryGetItem((byte)ConquerItem.Wing) != null Equipment.TryGetItem((byte)ConquerItem.Wing).Plus 0);
                            }
                            
proto2.proto.Title = (uint)Entity.EquippedTitle;
                            
proto2.proto.Flag = (uint)Entity.StatusFlag;
                            
proto2.proto.Flag2 = (uint)Entity.StatusFlag2;
                            
proto2.proto.Flag3 = (uint)Entity.StatusFlag3;
                            
//proto2.proto.Flag4 = (uint)Entity.StatusFlag4;
                            
client.Send(Kernel.FinalizeProtoBuf(proto23257));
                            break;
                        }
                        
#endregion
                        
proto2.proto.HairStyle BestEntity.HairStyle;
                        
proto2.proto.Mesh BestEntity.Mesh;
                        
proto2.proto.Name BestEntity.Name;
                        if (
BestEntity.GuildID != && Kernel.Guilds.ContainsKey(BestEntity.GuildID))
                            
proto2.proto.Guild Kernel.Guilds[BestEntity.GuildID].Name;
                        
proto2.proto.Hat Items[(byte)ConquerItem.Head];
                        
proto2.proto.LeftWep Items[(byte)ConquerItem.LeftWeapon];
                        
proto2.proto.LeftWepAcc Items[(byte)ConquerItem.LeftWeaponAccessory];
                        
proto2.proto.MountArmor Items[(byte)ConquerItem.SteedArmor] == Items[(byte)ConquerItem.Steed] : Items[(byte)ConquerItem.SteedArmor];
                        
proto2.proto.Garment Items[(byte)ConquerItem.Garment];
                        
proto2.proto.RightWep Items[(byte)ConquerItem.RightWeapon];
                        
proto2.proto.RightWepAcc Items[(byte)ConquerItem.RightWeaponAccessory];
                        
proto2.proto.Wing BestEntity.EquippedWing == Items[(byte)ConquerItem.Wing] : (uint)BestEntity.EquippedWing;
                        
proto2.proto.WingLevel Items[255];
                        
proto2.proto.Title = (uint)BestEntity.EquippedTitle;
                        
client.Send(Kernel.FinalizeProtoBuf(proto23257));
                        break;
                    }
                case 
1:
                    {
                        if (
Kernel.GamePool.ContainsKey(Info.proto == null Info.proto.dwParam))
                        {
                            
PacketHandler.ObserveEquipment(new Data(true) { ID 117UID client.Entity.UIDdwParam Info.proto == null Info.proto.dwParam }, client);
                        }
                        else
                        {
                            
client.Send(Kernel.FinalizeProtoBuf(Info3257));
                        }
                        break;
                    }
            }

        }
        public 
bool Read(byte[] packet)
        {
            var 
mypkt = new byte[packet.Length 4];
            Array.
Copy(packet4mypkt0mypkt.Length);
            try
            {
                
using (var memoryStream = new MemoryStream(packet))
                {
                    
Info Serializer.DeserializeWithLengthPrefix<MsgRankMemberShowProto>(memoryStreamPrefixStyle.Fixed32);
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e);
                return 
false;
            }
            return 
true;
        }
    }
    public class 
MsgEquipRefineRank
    
{
        public 
MsgEquipRefineRank() { }
        public 
MsgEquipRefineRankProto Info;
        [
Flags]
        public 
enum ActionID
        
{
            
MainRank 0,
            
RankItems 1,
            
UserItemRanking 2,
            
MyRanks 3,
            
View 4,

        }
        [
ProtoContract]
        public class 
MsgEquipRefineRankProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
ActionID Action;
            [
ProtoMember(2)]
            public 
uint RegisteredCount;
            [
ProtoMember(3)]
            public 
uint Page;
            [
ProtoMember(4IsRequired true)]
            public 
uint Index;
            [
ProtoMember(5IsRequired true)]
            public 
EquipProto[] items;
        }
        [
ProtoContract]
        public class 
EquipProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint Rank;
            [
ProtoMember(2IsRequired true)]
            public 
uint UnKnow2;
            [
ProtoMember(3IsRequired true)]
            public 
uint Position;
            [
ProtoMember(4IsRequired true)]
            public 
uint RankScore;
            [
ProtoMember(5IsRequired true)]
            public 
uint UID;
            [
ProtoMember(6IsRequired true)]
            public 
uint ItemID;
            [
ProtoMember(7IsRequired true)]
            public 
uint PurificationID;
            [
ProtoMember(8IsRequired true)]
            public 
uint Plus;
            [
ProtoMember(9IsRequired true)]
            public 
uint Stars;
            [
ProtoMember(10IsRequired true)]
            public 
string Name "";
            [
ProtoMember(11IsRequired true)]
            public 
uint PerfectionLevel;
        }
        public 
byte GetRealyPosition(byte FakePosition)
        {
            if (
FakePosition == 5) return 19;
            if (
FakePosition == 7) return 18;
            if (
FakePosition == 9) return 12;
            return 
FakePosition;
        }
        public static 
Dictionary<byteConquerItemMainRank;
        public 
void UpdateRanking()
        {
            
AllItemsRanking = new List<ConquerItem>();
            
MainRank = new Dictionary<byteConquerItem>();
            for (
byte i 011i++)
            {
                
byte z GetRealyPosition((byte)(1));
                List<
ConquerItemitems = new List<ConquerItem>();
                
MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
                
command.Select("items").Where("Position"z).And("Stars"0true);
                
MySqlReader reader = new MySqlReader(command);
                while (
reader.Read())
                {
                    
ConquerItem item = new ConquerItem(true);
                    
item.ID reader.ReadUInt32("ID");
                    
item.UID reader.ReadUInt32("UID");
                    
item.MaximDurability reader.ReadUInt16("MaximDurability");
                    
item.Durability reader.ReadUInt16("Durability");
                    
item.Position reader.ReadUInt16("Position");
                    
item.Signature reader.ReadString("Signature");
                    
item.SocketProgress reader.ReadUInt32("SocketProgress");
                    
item.PlusProgress reader.ReadUInt32("PlusProgress");
                    
item.Stars reader.ReadByte("Stars");
                    
item.PerfectionProgress reader.ReadUInt32("PerfectionProgress");
                    
item.Owner reader.ReadString("Owner");
                    
item.OwnerUID reader.ReadUInt32("OwnerUID");
                    
item.SocketOne = (Game.Enums.Gem)reader.ReadByte("SocketOne");
                    
item.SocketTwo = (Game.Enums.Gem)reader.ReadByte("SocketTwo");
                    
item.Effect = (Game.Enums.ItemEffect)reader.ReadByte("Effect");
                    
item.Mode Game.Enums.ItemMode.Default;
                    
item.Plus reader.ReadByte("Plus");
                    
item.Bless reader.ReadByte("Bless");
                    
item.Bound reader.ReadBoolean("Bound");
                    
// item.TimeStamp = DateTime.FromBinary(reader.ReadInt64("TimeStamp"));
                    // item.Minutes = reader.ReadUInt64("MinutesLeft");
                    
item.Enchant reader.ReadByte("Enchant");
                    
item.Lock reader.ReadByte("Locked");
                    
item.UnlockEnd DateTime.FromBinary(reader.ReadInt64("UnlockEnd"));
                    
item.Suspicious reader.ReadBoolean("Suspicious");
                    
item.SuspiciousStart DateTime.FromBinary(reader.ReadInt64("SuspiciousStart"));
                    
item.Color = (Game.Enums.Color)reader.ReadByte("Color");
                    
item.Inscribed reader.ReadByte("Inscribed") == 1;
                    
item.StackSize reader.ReadUInt16("StackSize");
                    
item.Warehouse reader.ReadByte("Warehouse");
                    
item.RefineItem reader.ReadUInt32("RefineryItem");
                    
item.InWardrobe reader.ReadBoolean("InWardrobe");
                    
Int64 rTime reader.ReadInt64("RefineryTime");
                    
ItemAddingTable.GetAddingsForItem(item);
                    
items.Add(item);
                    if (!
AllItemsRanking.Contains(item))
                        
AllItemsRanking.Add(item);

                }
                
MainRank[z] = items.OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(x)).FirstOrDefault();
            }
        }
        public static List<
ConquerItemAllItemsRanking;
        public 
void Handle(Client.GameState client)
        {
            switch (
Info.Action)
            {
                case 
ActionID.UserItemRanking:
                    {
                        var 
item AllItemsRanking.Where(=> p.Position == GetRealyPosition((byte)Info.Index)).OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(i)).ToArray();
                        var 
min Math.Min(item.Length50);
                        for (
int i 0mini++)
                        {
                            if (
client.Equipment.IsWearingItemUID(item[i].UID))
                            {
                                var 
packet = new MsgEquipRefineRankProto();
                                
packet.Page Info.Page;
                                
packet.RegisteredCount Info.RegisteredCount;
                                
packet.Action Info.Action;
                                
packet.Index Info.Index;
                                
packet.items = new EquipProto[1];
                                
packet.items[0] = new EquipProto();
                                var 
itemm item[i];
                                
packet.items[0].Rank = (uint)(1);
                                
packet.items[0].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(itemm);
                                
packet.items[0].ItemID itemm.ID;
                                
packet.items[0].Name itemm.Owner.Replace("/0""");
                                
packet.items[0].Stars itemm.Stars;
                                
packet.items[0].Position GetRealyPosition((byte)Info.Index);
                                
packet.items[0].Plus itemm.Plus;
                                
packet.items[0].UID itemm.UID;
                                
packet.items[0].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                                
client.Send(Kernel.FinalizeProtoBuf(packet3256));
                                break;
                            }
                        }
                        break;
                    }
                case 
ActionID.MyRanks:
                    {
                        var 
packet = new MsgEquipRefineRankProto();
                        
packet.Action ActionID.MyRanks;
                        
packet.items = new EquipProto[11];
                        for (
byte i 0packet.items.Lengthi++)
                        {
                            
byte z GetRealyPosition((byte)(1));
                            var 
itemmm AllItemsRanking.Where(=> p.Position == z).OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(m)).ToArray();
                            for (
int h 0itemmm.Lengthh++)
                            {
                                if (
client.Equipment.IsWearingItemUID(itemmm[h].UID))
                                {
                                    
packet.items[i] = new EquipProto();
                                    
packet.items[i].ItemID itemmm[h].ID;
                                    
packet.items[i].Name itemmm[h].Owner.Replace("/0""");
                                    
packet.items[i].Stars itemmm[h].Stars;
                                    
packet.items[i].Plus itemmm[h].Plus;
                                    
packet.items[i].Position = (uint)(1);
                                    if (
itemmm[h].Purification.Available)
                                        
packet.items[i].PurificationID itemmm[h].Purification.PurificationItemID;
                                    
packet.items[i].Rank = (uint)(1);
                                    
packet.items[i].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(itemmm[h]);
                                    
packet.items[i].UID itemmm[h].UID;
                                    
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                                    break;
                                }
                            }
                        }



                        var 
proto Kernel.FinalizeProtoBuf(packet3256);
                        
client.Send(proto);
                        break;
                    }
                case 
ActionID.View://ViewItem
                    
{
                        if (
Database.ConquerItemTable.LoadItem(Info.Index) != null)
                        {
                            var 
item Database.ConquerItemTable.LoadItem(Info.Index);
                            
item.Mode Game.Enums.ItemMode.Perfection;
                            
item.Send(client);
                        }
                        else
                        {
                            
client.Send(Kernel.FinalizeProtoBuf(Info3256));
                        }
                        break;
                    }
                case 
ActionID.RankItems://AllRanking
                    
{
                        var 
cnt AllItemsRanking.Where(=> p.Position == GetRealyPosition((byte)Info.Index)).Count();
                        var 
packet = new MsgEquipRefineRankProto();
                        
packet.Action ActionID.RankItems;
                        
packet.RegisteredCount = (uint)Math.Min(cnt50);
                        
packet.Page Info.Page;
                        
packet.Index Info.Index;
                        
uint sss = (ushort)Math.Min(cnt - (packet.Page 10), 10);

                        
int rank = (int)packet.Page 10;
                        
packet.items = new EquipProto[sss];
                        for (
int i rankrank sssi++)
                        {
                            var 
iteeeem AllItemsRanking.Where(=> p.Position == GetRealyPosition((byte)Info.Index)).OrderByDescending(=> MsgUserAbilityScore.CalculatePerfectionItemPoints(x)).ToArray()[i];
                            if (
iteeeem == null) continue;
                            
packet.items[i] = new EquipProto();
                            
packet.items[i].ItemID iteeeem.ID;
                            
packet.items[i].Name iteeeem.Owner.Replace("/0""");
                            
packet.items[i].PerfectionLevel iteeeem.Stars;
                            
packet.items[i].Plus iteeeem.Plus;
                            
packet.items[i].Position GetRealyPosition((byte)Info.Index);
                            if (
iteeeem.Purification.Available)
                                
packet.items[i].PurificationID iteeeem.Purification.PurificationItemID;
                            
packet.items[i].Rank = (uint)(1);
                            
packet.items[i].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(iteeeem);
                            
packet.items[i].UID iteeeem.UID;
                            
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                        }
                        var 
proto Kernel.FinalizeProtoBuf(packet3256);
                        
client.Send(proto);
                        break;
                    }
                case 
ActionID.MainRank:
                    {


                        var 
packet = new MsgEquipRefineRankProto();
                        
packet.Action ActionID.MainRank;
                        
packet.items = new EquipProto[11];
                        for (
byte i 0packet.items.Lengthi++)
                        {
                            
byte z GetRealyPosition((byte)(1));
                            
ConquerItem itemmm MainRank[z];
                            if (
itemmm == null) continue;
                            
packet.items[i] = new EquipProto();
                            
packet.items[i].ItemID itemmm.ID;
                            
packet.items[i].Name itemmm.Owner.Replace("/0""");
                            
packet.items[i].Stars itemmm.Stars;
                            
packet.items[i].Plus itemmm.Plus;
                            
packet.items[i].Position = (uint)(1);
                            if (
itemmm.Purification.Available)
                                
packet.items[i].PurificationID itemmm.Purification.PurificationItemID;
                            
packet.items[i].Rank 1;
                            
packet.items[i].RankScore MsgUserAbilityScore.CalculatePerfectionItemPoints(itemmm);
                            
packet.items[i].UID itemmm.UID;
                            
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(8003000);
                        }



                        var 
proto Kernel.FinalizeProtoBuf(packet3256);
                        
client.Send(proto);
                        break;
                    }
            }
        }
        public 
bool Read(byte[] packet)
        {
            
using (var memoryStream = new MemoryStream(packet))
            {
                
Info Serializer.DeserializeWithLengthPrefix<MsgEquipRefineRankProto>(memoryStreamPrefixStyle.Fixed32);
            }
            return 
true;
        }
    }
    public class 
MsgUserTotalRefineLev
    
{
        public 
MsgUserTotalRefineLev() { }
        public 
MsgUserTotalRefineLevProto Info;
        [
ProtoContract]
        public class 
MsgUserTotalRefineLevProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint ActionId;
            [
ProtoMember(2IsRequired true)]
            public 
uint EntityUID;
            [
ProtoMember(3IsRequired true)]
            public 
uint TotalPrefectionLevel;
        }
        public 
void SendPerfectionEffects(Client.GameState client)
        {
            if (
client.Equipment.TotalStars >= 10) { client.Entity.MaxAttack += 100client.Entity.MinAttack += 100client.Entity.MagicAttack += 100; }
            if (
client.Equipment.TotalStars >= 70) { client.Entity.Defence += 100client.Entity.MagicDefence += 100; }
            if (
client.Equipment.TotalStars >= 75) { client.Entity.MaxAttack += 200client.Entity.MinAttack += 200client.Entity.MagicAttack += 300; }
            if (
client.Equipment.TotalStars >= 100) { client.Entity.Defence += 200client.Entity.MagicDefence += 50; }
            if (
client.Equipment.TotalStars >= 140) { client.Entity.MaxAttack += 200client.Entity.MinAttack += 200client.Entity.MagicAttack += 400; }
            if (
client.Equipment.TotalStars >= 150) { client.Entity.MaxAttack += 300client.Entity.MinAttack += 300client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 160) { client.Entity.Defence += 300client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 180) { client.Entity.Defence += 400client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 235) { client.Entity.MaxAttack += 400client.Entity.MinAttack += 400client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 270) { client.Entity.Defence += 400client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 273) { client.Entity.MaxAttack += 400client.Entity.MinAttack += 400client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 306) { client.Entity.MaxAttack += 400client.Entity.MinAttack += 400client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 310) { client.Entity.Defence += 400client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 316) { client.Entity.Defence += 500client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 318) { client.Entity.MaxAttack += 500client.Entity.MinAttack += 500client.Entity.MagicAttack += 500; }
            if (
client.Equipment.TotalStars >= 323) { client.Entity.Defence += 500client.Entity.MagicDefence += 125; }
            if (
client.Equipment.TotalStars >= 324) { client.Entity.MaxAttack += 500client.Entity.MinAttack += 500client.Entity.MagicAttack += 500; }
        }
        public 
void Send(Client.GameState client)
        {
            
client.Send(Kernel.FinalizeProtoBuf(new MsgUserTotalRefineLevProto()
            {
                
ActionId 0,
                
EntityUID client.Entity.UID,
                
TotalPrefectionLevel client.Equipment.TotalStars
            
}, 3252));
        }
    }
    public class 
MsgRefineEffect
    
{
        public 
MsgRefineEffect() { }
        public 
MsgRefineEffectProto Info;
        [
ProtoContract]
        public class 
MsgRefineEffectProto
        
{
            [
ProtoMember(1IsRequired true)]
            public 
uint AttackerUID;
            [
ProtoMember(2IsRequired true)]
            public 
uint AttackedUID;
            [
ProtoMember(3IsRequired true)]
            public 
uint Effect;
        }
        public 
void Attacking(Game.Entity attackerInterfaces.IMapObject attackedref uint damageref Attack attackref bool loadItemStats)
        {
            if (
attacker == null || attacked == null) return;
            if (
attacker.Owner.Equipment.TotalStars == 0) return;
            if (
attacker.EntityFlag == Game.EntityFlag.Monster) return;
            
double chance 0;
            var 
effect Game.Enums.PerfectionEffect.CalmWind;
            
byte level 0;
            var 
dics Database.PerfectionTable.Effects.Values.Where(=> i.Stars == attacker.Owner.Equipment.TotalStars).FirstOrDefault();
            if (
dics == null) return;
            var 
dic dics.Effects;
            var 
item Kernel.RandFromGivingNums(dic.ToArray());
            
effect = (Game.Enums.PerfectionEffect)(item 1000);
            
level = (byte)(item 1000);
            
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
            foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
            {
                if (
attacker.Owner.Equipment.IsWearingItemID(val.ItemID))
                {
                    if (
attacker.Owner.Equipment.TotalStars >= val.StarReq)
                    {
                        if (
val.AttributeNum <= 16)
                        {
                            if (
val.AttributeNum == (uint)effect)
                            {
                                
chance += (byte)val.Value;
                            }
                        }
                    }
                }
            }
            while (
effect == Game.Enums.PerfectionEffect.Stricklock ||
                
effect == Game.Enums.PerfectionEffect.FreeSoul ||
                
effect == Game.Enums.PerfectionEffect.StraightLife ||
                
effect == Game.Enums.PerfectionEffect.ToxinEarser ||
                
effect == Game.Enums.PerfectionEffect.BloodSpawn ||
                
effect == Game.Enums.PerfectionEffect.MirrorofSin)
            {
                
item Kernel.RandFromGivingNums(dic.ToArray());
                
effect = (Game.Enums.PerfectionEffect)(item 1000);
                
level = (byte)(item 1000);
                
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
                foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
                {

                    if (
attacker.Owner.Equipment.IsWearingItemID(val.ItemID))
                    {
                        if (
attacker.Owner.Equipment.TotalStars >= val.StarReq)
                        {
                            if (
val.AttributeNum <= 16)
                            {
                                if (
val.AttributeNum == (uint)effect)
                                {
                                    
chance += (byte)val.Value;
                                }
                            }
                        }
                    }
                }
            }
            if (
Kernel.Rate((byte)chance))
            {
                
#region edited by Rider  DoEffects
                #region edited by Rider  DrainingTouch
                
if (effect == Game.Enums.PerfectionEffect.DrainingTouch)
                {
                    
attacker.Hitpoints attacker.MaxHitpoints;
                    
attacker.Mana attacker.MaxMana;
                }
                
#endregion
                #region edited by Rider  LuckyStrike
                
if (effect == Game.Enums.PerfectionEffect.LuckyStrike || effect == Game.Enums.PerfectionEffect.AbsoluteLuck) { damage *= 2attack.Effect1 Attack.AttackEffects1.LuckyStrike; }
                
#endregion
                #region edited by Rider  KillingFlash
                
if (effect == Game.Enums.PerfectionEffect.KillingFlash)
                {
                    
attacker.Owner.XPCount 100;
                }
                
#endregion
                #region edited by Rider  DivineGuard
                
if (effect == Game.Enums.PerfectionEffect.DivineGuard)
                {
                    
attacker.AddFlag3(Network.GamePackets.Update.Flags3.DivineGuard);
                    
attacker.Defence = (ushort)(((attacker.Defence) * 300) / 100);
                    
attacker.DivineGuardStamp Time32.Now;
                }
                
#endregion
                #region edited by Rider  InvisibleArrow
                
if (effect == Game.Enums.PerfectionEffect.InvisibleArrow)
                {
                    
damage += ((uint)(attacker.MagicAttack 5) / 100);
                }
                
#endregion
                #region edited by Rider  ShieldBreak
                
if (effect == Game.Enums.PerfectionEffect.ShieldBreak)
                {
                    
attacker.AddFlag3(Network.GamePackets.Update.Flags3.ShieldBreak);
                    
attacker.ShieldBreakStamp Time32.Now;
                    if (
attacked.MapObjType == Game.MapObjectType.Entity)
                    {
                        (
attacked as Game.Entity).Block -= (ushort)((((attacked as Game.Entity).Block) * 20) / 100);
                        if ((
attacked as Game.Entity).Block 0) (attacked as Game.Entity).Block 0;
                        
loadItemStats true;
                    }
                }
                
#endregion
                #region edited by Rider  CoreStrike
                
if (effect == Game.Enums.PerfectionEffect.CoreStrike)
                {
                    
damage += ((uint)(attacker.MagicDamageIncrease 0) * 100);
                }
                
#endregion
                #region edited by Rider  LightofStamina
                
if (effect == Game.Enums.PerfectionEffect.LightofStamina)
                {
                    
byte limit 0;
                    if (
attacker.HeavenBlessing 0)
                        
limit 50;
                    
attacker.Stamina = (byte)(100 limit);
                }
                
#endregion
                #endregion
                
var proto = new MsgRefineEffectProto();
                
proto.AttackerUID attacker.UID;
                
proto.AttackedUID attacked != null attacked.UID 0;
                
proto.Effect = (uint)effect;
                var 
proto2 Kernel.FinalizeProtoBuf(proto3254);
                
attacker.Owner.SendScreen(proto2true);
            }
        }
        public 
void beingAttacked(Interfaces.IMapObject attackerGame.Entity attackedref uint damage)
        {
            if (
attacker == null || attacked == null) return;
            if (
attacker.Owner.Equipment.TotalStars == 0) return;
            if (
attacked.EntityFlag == Game.EntityFlag.Monster) return;
            
double chance 0;
            var 
effect Game.Enums.PerfectionEffect.CalmWind;
            
byte level 0;
            var 
dic0 Database.PerfectionTable.Effects.Values.Where(=> i.Stars == attacked.Owner.Equipment.TotalStars).FirstOrDefault();
            if (
dic0 == null) return;
            var 
dic dic0.Effects;
            var 
item Kernel.RandFromGivingNums(dic.ToArray());
            
effect = (Game.Enums.PerfectionEffect)(item 1000);
            
level = (byte)(item 1000);
            
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
            foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
            {

                if (
attacked.Owner.Equipment.IsWearingItemID(val.ItemID))
                {
                    if (
attacked.Owner.Equipment.TotalStars >= val.StarReq)
                    {
                        if (
val.AttributeNum <= 16)
                        {
                            if (
val.AttributeNum == (uint)effect)
                            {
                                
chance += (byte)val.Value;
                            }
                        }
                    }
                }
            }
            
/////////////WhileAttackedNotAttackingEffects////////////
            
while (!(effect == Game.Enums.PerfectionEffect.Stricklock ||
                
effect == Game.Enums.PerfectionEffect.BloodSpawn ||
                
effect == Game.Enums.PerfectionEffect.MirrorofSin))
            {
                
item Kernel.RandFromGivingNums(dic.ToArray());
                
effect = (Game.Enums.PerfectionEffect)(item 1000);
                
level = (byte)(item 1000);
                
chance Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100;
                foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
                {

                    if (
attacked.Owner.Equipment.IsWearingItemID(val.ItemID))
                    {
                        if (
attacked.Owner.Equipment.TotalStars >= val.StarReq)
                        {
                            if (
val.AttributeNum <= 16)
                            {
                                if (
val.AttributeNum == (uint)effect)
                                {
                                    
chance += (byte)val.Value;
                                }
                            }
                        }
                    }
                }
            }
            if (
Kernel.Rate((byte)chance))
            {
                
#region edited by Rider  DoEffects
                #region edited by Rider  StrickLock
                
if (effect == Game.Enums.PerfectionEffect.Stricklock)
                {
                    
damage 0;
                }
                
#endregion
                #region edited by Rider  BloodSpawn
                
if (effect == Game.Enums.PerfectionEffect.BloodSpawn)
                {
                    
attacked.Hitpoints attacked.MaxHitpoints;
                    
attacked.Mana attacked.MaxMana;
                }
                
#endregion
                #region edited by Rider  KillingFlash
                
if (effect == Game.Enums.PerfectionEffect.MirrorofSin)
                {
                    
attacked.Owner.XPCount 100;
                }
                
#endregion
                #endregion
                
var proto = new MsgRefineEffectProto();
                
proto.AttackerUID attacked.UID;
                
proto.AttackedUID attacker.UID;
                
proto.Effect = (uint)effect;
                var 
proto2 Kernel.FinalizeProtoBuf(proto3254);
                
attacked.Owner.SendScreen(proto2true);
            }
        }
        public 
void GenerateChance(Game.Entity EntityGame.Enums.PerfectionEffect effectref byte chancebool dwParam false)
        {
            if (
Entity.Owner.Equipment.TotalStars == 0) { chance 0; return; }
            
byte level = (byte)(Database.PerfectionTable.Effects.Values.Where(=> i.Stars == Entity.Owner.Equipment.TotalStars).FirstOrDefault().Effects.Where(=> >= ((uint)(effect) * 1000) && <= ((uint)(effect) * 1000 20)).FirstOrDefault() % 1000);
            if (
Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault() != null)
            {
                if (!
dwParam)
                    
chance = (byte)(Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().Chance 100);
                else 
chance = (byte)(Database.PerfectionTable.AttributeList.Values.Where(=> i.Type == effect && i.Level == level).FirstOrDefault().dwParam 100);
                foreach (var 
val in Database.PerfectionTable.EffectsEX.Values)
                {
                    if (
Entity.Owner.Equipment.IsWearingItemID(val.ItemID))
                    {
                        if (
Entity.Owner.Equipment.TotalStars >= val.StarReq)
                        {
                            if (
val.AttributeNum <= 16)
                            {
                                if (
val.AttributeNum == (uint)effect)
                                {
                                    
chance += (byte)val.Value;
                                }
                            }
                        }
                    }
                }
            }
        }
        public 
byte GetChance(Client.GameState clientGame.Enums.PerfectionEffect effect)
        {
            if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 0) return 0;
            
byte Chance 10;
            if (
effect == Game.Enums.PerfectionEffect.CalmWind)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 3Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 90Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 170Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 250Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 285Chance += 1;
            }

            if (
effect == Game.Enums.PerfectionEffect.BloodSpawn)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 40Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 240Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 288Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.DivineGuard)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 40Chance += 5;
            }
            if (
effect == Game.Enums.PerfectionEffect.CoreStrike)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 50Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 80Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 135Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 205Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 245Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.DrainingTouch)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 35Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 220Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 276Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.FreeSoul)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 25Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 95Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 130Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 195Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 279Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.InvisibleArrow)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 65Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 225Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 282Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.KillingFlash)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 55Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 165Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 294Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.LightofStamina)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 1Chance += 5;
            }
            if (
effect == Game.Enums.PerfectionEffect.LuckyStrike)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 15Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 115Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 215Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 314Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 320Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.MirrorofSin)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 60Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 190Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 291Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.ShieldBreak)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 155 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 254Chance += 50 100;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 255 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 296Chance += 70 100;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 297 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 311Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 312 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints <= 321Chance += 150 100;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints == 322 && client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 322Chance += 2;
            }
            if (
effect == Game.Enums.PerfectionEffect.StraightLife)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 30Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 125Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 210Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 265Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 303Chance += 1;
            }
            if (
effect == Game.Enums.PerfectionEffect.Stricklock)
            {
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 30Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 125Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 210Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 265Chance += 1;
                if (
client.Equipment.GetFullEquipmentPerfecetionLevelPoints >= 303Chance += 1;
            }
            return 
Chance;
        }
        public 
void SendEffect(Game.Entity attackerGame.Entity attackedGame.Enums.PerfectionEffect effect)
        {

            if (
attacker == null || attacked == null) return;
            var 
proto = new MsgRefineEffectProto();
            
proto.AttackerUID attacker.UID;
            if (
attacked.EntityFlag == Game.EntityFlag.Entity)
                
proto.AttackedUID attacked.UID;
            else if (
attacked.EntityFlag == Game.EntityFlag.Monster && attacked != null && attacked.UID != 0)
            {
                
proto.AttackedUID attacked.UID;
            }
            
proto.Effect = (uint)effect;
            var 
proto2 Kernel.FinalizeProtoBuf(proto3254);
            
attacker.Owner.SendScreen(proto2true);
            if (
effect == Game.Enums.PerfectionEffect.DrainingTouch)
            {
                
attacker.Hitpoints attacker.MaxHitpoints;
            }
            if (
effect == Game.Enums.PerfectionEffect.KillingFlash)
            {
                
attacker.AddFlag((ulong)Network.GamePackets.Update.Flags.XPList);

                
attacker.Owner.XPListStamp Time32.Now;
            }
            if (
effect == Game.Enums.PerfectionEffect.DivineGuard)
            {
                
attacker.AddFlag3((ulong)Network.GamePackets.Update.Flags3.DivineGuard);
                
attacker.Defence = (ushort)(((attacker.Defence) * 20) / 100);
                
attacker.DivineGuardStamp Time32.Now;
            }
            if (
effect == Game.Enums.PerfectionEffect.ShieldBreak)
            {
                
attacker.AddFlag3((ulong)Network.GamePackets.Update.Flags3.ShieldBreak);
                
attacker.ShieldBreakStamp Time32.Now;
                
attacker.Block += (ushort)(((attacker.Block) * 2) / 10);
            }
            if (
effect == Game.Enums.PerfectionEffect.StraightLife)
            {
                
attacker.BringToLife();
            }
            if (
effect == Game.Enums.PerfectionEffect.LightofStamina && attacked.EntityFlag == Game.EntityFlag.Entity && attacker.Owner.Equipment.GetFullEquipmentPerfecetionLevelPoints attacked.Owner.Equipment.GetFullEquipmentPerfecetionLevelPoints || effect == Game.Enums.PerfectionEffect.LightofStamina && attacked.EntityFlag == Game.EntityFlag.Monsterattacker.Stamina 100;
        }
        public 
void GenerateEffectandChance(Client.GameState clientref Game.Enums.PerfectionEffect effectref byte chance)
        {
            
effect = (Game.Enums.PerfectionEffect)Kernel.Random.Next(314);
            
chance GetChance(clienteffect);
            while (
chance == 10)
            {
                
effect = (Game.Enums.PerfectionEffect)Kernel.Random.Next(314);
                
chance GetChance(clienteffect);
            }
        }
        public 
void HandleStraightLife(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.StraightLife);
        }
        public 
void HandleStrickeLock(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.Stricklock);
        }
        public 
void HandleLuckyStrike(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.LuckyStrike);
        }
        public 
void HandleMirror(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.MirrorofSin);
        }
        public 
void HandleFreeSoul(Game.Entity clientref byte chance)
        {
            
chance GetChance(client.OwnerGame.Enums.PerfectionEffect.FreeSoul);
        }
    }



لم يتم الحل

قديم 2019-10-22, 07:20 PM
المشاركة 10
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: لو سمحتو حل للمشكلتين دول وياريت نزول حلهم فى قسم التطوير
صور كده وريني بعد الحل ده


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



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

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

المواضيع المتشابهه للموضوع: لو سمحتو حل للمشكلتين دول وياريت نزول حلهم فى قسم التطوير
الموضوع كاتب الموضوع المنتدى مشاركات آخر مشاركة
ارجو الحل للمشكلتين دول يجماعه taha مشكلات السيرفيرات كونكر الشخصيه 2 2019-12-03 06:43 AM
ممكن حد ينزلنا نظام Union في قسم التطوير uncelsam مشكلات السيرفيرات كونكر الشخصيه 3 2019-11-15 11:16 PM
احنا بنعمل خير للناس هل يا ترا في حد هيعمل خير معايا فيه مشكله وياريت الحل الصحيح zezonever مشكلات السيرفيرات كونكر الشخصيه 11 2019-11-11 05:14 AM
مهم جدا وياريت يتعملو موضوع وينزل قسم التطوير uncelsam مشكلات السيرفيرات كونكر الشخصيه 7 2019-11-11 05:01 AM
4 مشكلاات محتاج حلهم osama مشكلات السيرفيرات كونكر الشخصيه 11 2019-06-26 10:06 PM


الساعة الآن 06:36 AM

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