أضافة البرفكشن كامل 100% - ابداع كونكر - Conquer

أضافة البرفكشن كامل 100%


و أفضل الصلاة علي سيدنا الحبيب محمد (صلي الله عليه و سلم)

النهاردة جايب ليكوا البرفكشن بنسبة 100 %
انا ساحب السيستم نفسه من سورسات ( لوردس & المايسترو ) لحد ما بقي زي منتوا هتشوفوا بعنيكوا
اللي عايز يعمل رنك Best In The Wolrd كامل من الموضوع ده
طبعا الموضوع ده هيفرق عن أي موضوع تاني علشان ده يعتبر اللي فيهم كامل بأذن الله تعالي
اللي هقوله ده الجزء بتاع البرفكشن بس
نخش في المفيد
أول شئ هتعمل فولدر في Network\GamePackets و هتسميه Perfection
و بعدين هتعمل فيه الكلاسين دول
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 Desco_Pj;
using Desco_Pj.Database;
using System.Threading.Tasks;
namespace Desco_Pj.Network.GamePackets
{
public sealed class MsgUserAbilityScore
{
public MsgUserAbilityScore() { }
public MsgUserAbilityScoreProto Info;
[ProtoContract]
public class MsgUserAbilityScoreProto
{
[ProtoMember(1, IsRequired = true)]
public uint ActionId;
[ProtoMember(2, IsRequired = true)]
public uint UID;
[ProtoMember(3, IsRequired = true)]
public uint Level;
[ProtoMember(4, IsRequired = true)]
public Scores[] Scores;
}
[ProtoContract]
public class Scores
{
[ProtoMember(1, IsRequired = true)]
public uint Type;
[ProtoMember(2, IsRequired = true)]
public uint Score;
}
public static List RankingList;
public void GetRankingList()
{
RankingList = new List();
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.Player, false);
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");
RankingList.Add(Kernel.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(packet, 4, mypkt, 0, mypkt.Length);
using (var memoryStream = new MemoryStream(packet))
{
Info = Serializer.DeserializeWithLengthPrefix(memoryStream, PrefixStyle.Fixed32);
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return false;
}
return true;
}
public void SendScore(Client.GameState client, Client.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 = 0; i < packet.Scores.Length; i++)
{
byte Type = (byte)(i + 1);
packet.Scores[i] = new Scores();
packet.Scores[i].Type = Type;
packet.Scores[i].Score = GetScoreValue(client, Type);
}
var proto = Kernel.FinalizeProtoBuf(packet, 3253);
Observer.Send(proto);
}
public uint GetScoreValue(Client.GameState client, uint Type)
{
uint Score = 0;
if (Type == 1) Score = (uint)MsgUserAbilityScore.CalculatePerfectionJiangPoints(client);
if (Type == 2) Score = (uint)MsgUserAbilityScore.CalculatePerfectionChiPoints(client);
if (Type == 3) Score = (uint)(client.Entity.InnerPower != null ? client.Entity.InnerPower.TotalScore * 2 : 0);
if (Type == 4) Score = client.Equipment.GetFullEquipmentEnchantPoints;
if (Type == 5) Score = (uint)(client.Entity.Level * 25);
if (Type == 6) Score = client.Equipment.GetFullEquipmentPerfecetionLevelPoints;
if (Type == 7) Score = (uint)((client.Entity.Vitality + client.Entity.Atributes + client.Entity.Spirit + client.Entity.Strength + client.Entity.Agility) * 5);
if (Type == 8) Score = (uint)(client.Entity.Reborn * 1000);
if (Type == 9) Score = client.Equipment.GetFullEquipmentEnumPoints;
if (Type == 10) Score = client.Equipment.GetFullEquipmentSocketPoints;
if (Type == 11) Score = client.Equipment.GetFullEquipmentGemPoints;
if (Type == 12) Score = client.Equipment.GetFullEquipmentPlusPoints;
if (Type == 13) Score = client.Equipment.GetFullEquipmentBlessPoints;
if (Type == 14) Score = client.Equipment.GetFullEquipmentRefinePoints;
if (Type == 15) Score = client.Equipment.GetFullEquipmentSoulPoints;
if (Type == 16) Score = CalculateSubClassPoints(client);
if (Type == 17) Score = StorageItem.PerfectionPoints(client, true);
if (Type == 18) Score = StorageItem.PerfectionPoints(client, false);
if (Type == 19) Score = (uint)((uint)client.Entity.NobilityRank * 1000);
if (Type == 20) Score = 0;//Unknown
return Score;
}
public void Handle(Client.GameState client)
{
switch (Info.ActionId)
{
case 1://Observ
{
if (Kernel.GamePool.ContainsKey(Info.UID))
{
SendScore(client, client);
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.ChiData == null)
return 0;
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)
{
for (int i = 0; i < 9; i++) { if (client.Entity.MyJiang.Stagers[i] == null || !client.Entity.MyJiang.Stagers[i].Activate) break; foreach (var star in client.Entity.MyJiang.Stagers[i].Stars) { if (star.Activate) Points += star.Level * 100; } } } 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 * 100); } } return Points; } public static uint CalculatePerfectionItemPoints(ConquerItem item) { uint Points = 50; if (item == null) return 50; #region Plus if (!Network.PacketHandler.IsTwoHand(item.ID)) { if (item.Plus == 1) Points += 200; if (item.Plus == 2) Points += 600; if (item.Plus == 3) Points += 1200; if (item.Plus == 4) Points += 1800; if (item.Plus == 5) Points += 2600; if (item.Plus == 6) Points += 3500; if (item.Plus == 7) Points += 4800; if (item.Plus == 8) Points += 5800; if (item.Plus == 9) Points += 6800; if (item.Plus == 10) Points += 7800; if (item.Plus == 11) Points += 8800; if (item.Plus == 12) Points += 10000; } else { if (item.Plus == 1) Points += 400; if (item.Plus == 2) Points += 1200; if (item.Plus == 3) Points += 2400; if (item.Plus == 4) Points += 3600; if (item.Plus == 5) Points += 5200; if (item.Plus == 6) Points += 7000; if (item.Plus == 7) Points += 9600; if (item.Plus == 8) Points += 11600; if (item.Plus == 9) Points += 13600; if (item.Plus == 10) Points += 15600; if (item.Plus == 11) Points += 17600; if (item.Plus == 12) Points += 20000; } #endregion #region Quality if (!Network.PacketHandler.IsTwoHand(item.ID)) { if (item.ID % 10 == 9) Points += 500; if (item.ID % 10 == 8) Points += 300; if (item.ID % 10 == 7) Points += 200; if (item.ID % 10 == 6) Points += 100; if (item.ID % 10 > 0 && item.ID % 10 < 6) Points += 50; } else { if (item.ID % 10 == 9) Points += 1000; if (item.ID % 10 == 8) Points += 600; if (item.ID % 10 == 7) Points += 400; if (item.ID % 10 == 6) Points += 200; if (item.ID % 10 > 0 && item.ID % 10 < 6) Points += 100;
}
#endregion
#region Soul
if (!Network.PacketHandler.IsTwoHand(item.ID))
{
if (item.Purification.PurificationLevel == 1) Points += 100;
if (item.Purification.PurificationLevel == 2) Points += 300;
if (item.Purification.PurificationLevel == 3) Points += 500;
if (item.Purification.PurificationLevel == 4) Points += 800;
if (item.Purification.PurificationLevel == 5) Points += 1200;
if (item.Purification.PurificationLevel == 6) Points += 1600;
if (item.Purification.PurificationLevel == 7) Points += 2000;
}
else
{
if (item.Purification.PurificationLevel == 1) Points += 200;
if (item.Purification.PurificationLevel == 2) Points += 600;
if (item.Purification.PurificationLevel == 3) Points += 1000;
if (item.Purification.PurificationLevel == 4) Points += 1600;
if (item.Purification.PurificationLevel == 5) Points += 2400;
if (item.Purification.PurificationLevel == 6) Points += 3200;
if (item.Purification.PurificationLevel == 7) Points += 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 == 1) Points += 100;
if (item.ExtraEffect.EffectLevel == 2) Points += 400;
if (item.ExtraEffect.EffectLevel == 3) Points += 800;
if (item.ExtraEffect.EffectLevel == 4) Points += 1200;
if (item.ExtraEffect.EffectLevel == 5) Points += 1600;
if (item.ExtraEffect.EffectLevel == 6) Points += 2000;
}
else
{
if (item.ExtraEffect.EffectLevel == 1) Points += 200;
if (item.ExtraEffect.EffectLevel == 2) Points += 800;
if (item.ExtraEffect.EffectLevel == 3) Points += 1600;
if (item.ExtraEffect.EffectLevel == 4) Points += 2400;
if (item.ExtraEffect.EffectLevel == 5) Points += 3200;
if (item.ExtraEffect.EffectLevel == 6) Points += 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 == 1) Points += 200; if (item.SocketOne2 % 10 == 2) Points += 500; if (item.SocketOne2 % 10 == 3) Points += 800; } if (item.SocketTwo != (Game.Enums.Gem)0) { if (item.SocketTwo2 % 10 == 1) Points += 200; if (item.SocketTwo2 % 10 == 2) Points += 500; if (item.SocketTwo2 % 10 == 3) Points += 800; } } else { if (item.SocketOne != (Game.Enums.Gem)0) { if (item.SocketOne2 % 10 == 1) Points += 400; if (item.SocketOne2 % 10 == 2) Points += 1000; if (item.SocketOne2 % 10 == 3) Points += 1600; } if (item.SocketTwo != (Game.Enums.Gem)0) { if (item.SocketTwo2 % 10 == 1) Points += 400; if (item.SocketTwo2 % 10 == 2) Points += 1000; if (item.SocketTwo2 % 10 == 3) Points += 1600; } } #endregion #region PerfectionLevel if (item.Stars >= 1) Points += 180;
if (item.Stars >= 2) Points += 180;
if (item.Stars >= 3) Points += 180;
if (item.Stars >= 4) Points += 180;
if (item.Stars >= 5) Points += 180;
if (item.Stars >= 6) Points += 180;
if (item.Stars >= 7) Points += 180;
if (item.Stars >= 8) Points += 180;
if (item.Stars >= 9) Points += 180;
if (item.Stars >= 10) Points += 2380;
if (item.Stars >= 11) Points += 400;
if (item.Stars >= 12) Points += 400;
if (item.Stars >= 13) Points += 400;
if (item.Stars >= 14) Points += 400;
if (item.Stars >= 15) Points += 400;
if (item.Stars >= 16) Points += 400;
if (item.Stars >= 17) Points += 400;
if (item.Stars >= 18) Points += 400;
if (item.Stars >= 19) Points += 5150;
if (item.Stars >= 20) Points += 650;
if (item.Stars >= 21) Points += 650;
if (item.Stars >= 22) Points += 650;
if (item.Stars >= 23) Points += 650;
if (item.Stars >= 24) Points += 650;
if (item.Stars >= 25) Points += 650;
if (item.Stars >= 26) Points += 650;
if (item.Stars >= 27) Points += 650;
if (item.Stars >= 28) Points += 100;
if (item.Stars >= 29) Points += 100;
if (item.Stars >= 30) Points += 100;
if (item.Stars >= 31) Points += 100;
if (item.Stars >= 32) Points += 100;
if (item.Stars >= 33) Points += 100;
if (item.Stars >= 34) Points += 100;
if (item.Stars >= 35) Points += 100;
if (item.Stars >= 36) Points += 100;
if (item.Stars >= 37) Points += 100;
if (item.Stars >= 38) Points += 100;
if (item.Stars >= 39) Points += 100;
if (item.Stars >= 40) Points += 100;
if (item.Stars >= 41) Points += 100;
if (item.Stars >= 42) Points += 100;
if (item.Stars >= 43) Points += 100;
if (item.Stars >= 44) Points += 100;
if (item.Stars >= 45) Points += 100;
if (item.Stars >= 46) Points += 100;
if (item.Stars >= 47) Points += 100;
if (item.Stars >= 48) Points += 100;
if (item.Stars >= 49) Points += 100;
if (item.Stars >= 50) Points += 100;
if (item.Stars >= 51) Points += 100;
if (item.Stars >= 52) Points += 100;
if (item.Stars >= 53) Points += 100;
if (item.Stars >= 54) Points += 100;
if (Network.PacketHandler.IsTwoHand(item.ID))
{
if (item.Stars >= 1) Points += 180;
if (item.Stars >= 2) Points += 180;
if (item.Stars >= 3) Points += 180;
if (item.Stars >= 4) Points += 180;
if (item.Stars >= 5) Points += 180;
if (item.Stars >= 6) Points += 180;
if (item.Stars >= 7) Points += 180;
if (item.Stars >= 8) Points += 180;
if (item.Stars >= 9) Points += 180;
if (item.Stars >= 10) Points += 2380;
if (item.Stars >= 11) Points += 400;
if (item.Stars >= 12) Points += 400;
if (item.Stars >= 13) Points += 400;
if (item.Stars >= 14) Points += 400;
if (item.Stars >= 15) Points += 400;
if (item.Stars >= 16) Points += 400;
if (item.Stars >= 17) Points += 400;
if (item.Stars >= 18) Points += 400;
if (item.Stars >= 19) Points += 5150;
if (item.Stars >= 20) Points += 650;
if (item.Stars >= 21) Points += 650;
if (item.Stars >= 22) Points += 650;
if (item.Stars >= 23) Points += 650;
if (item.Stars >= 24) Points += 650;
if (item.Stars >= 25) Points += 650;
if (item.Stars >= 26) Points += 650;
if (item.Stars >= 27) Points += 650;
if (item.Stars >= 28) Points += 100;
if (item.Stars >= 29) Points += 100;
if (item.Stars >= 30) Points += 100;
if (item.Stars >= 31) Points += 100;
if (item.Stars >= 32) Points += 100;
if (item.Stars >= 33) Points += 100;
if (item.Stars >= 34) Points += 100;
if (item.Stars >= 35) Points += 100;
if (item.Stars >= 36) Points += 100;
if (item.Stars >= 37) Points += 100;
if (item.Stars >= 38) Points += 100;
if (item.Stars >= 39) Points += 100;
if (item.Stars >= 40) Points += 100;
if (item.Stars >= 41) Points += 100;
if (item.Stars >= 42) Points += 100;
if (item.Stars >= 43) Points += 100;
if (item.Stars >= 44) Points += 100;
if (item.Stars >= 45) Points += 100;
if (item.Stars >= 46) Points += 100;
if (item.Stars >= 47) Points += 100;
if (item.Stars >= 48) Points += 100;
if (item.Stars >= 49) Points += 100;
if (item.Stars >= 50) Points += 100;
if (item.Stars >= 51) Points += 100;
if (item.Stars >= 52) Points += 100;
if (item.Stars >= 53) Points += 100;
if (item.Stars >= 54) Points += 100;
}
#endregion
#region Socket
if (!Network.PacketHandler.IsTwoHand(item.ID))
{
if (item.SocketOne != (Game.Enums.Gem)0) Points += 1000;
if (item.SocketTwo != (Game.Enums.Gem)0) Points += 2500;
}
else
{
if (item.SocketOne != (Game.Enums.Gem)0) Points += 2000;
if (item.SocketTwo != (Game.Enums.Gem)0) Points += 5000;
}
#endregion
#region Enchant
if (!Network.PacketHandler.IsTwoHand(item.ID))
{
var enc = (uint)(item.Enchant);
if (enc != 0)
{
if (enc <= 200) Points += enc * 1;
if (enc <= 240) Points += (uint)(enc * 1.3);
if (enc <= 254) Points += (uint)(enc * 1.6);
if (enc <= 255) Points += enc * 2;
}
}
else
{
var enc = (uint)(item.Enchant);
if (enc != 0)
{
if (enc <= 200) Points += enc * 2;
if (enc <= 240) Points += (uint)(enc * 2.6);
if (enc <= 254) Points += (uint)(enc * 3.2);
if (enc <= 255) Points += enc * 4;
}
}
#endregion
return Points;
}
}
public sealed class MsgItemRefineOpt
{
public MsgItemRefineOpt() { }
public MsgItemRefineOptProto Info;
public MsgItemRefineOptProto2 Info2;
[ProtoContract]
public class MsgItemRefineOptProto
{
[ProtoMember(1, IsRequired = true)]
public uint ActionId;
[ProtoMember(2, IsRequired = true)]
public uint ItemUID;
[ProtoMember(3, IsRequired = true)]
public string Signature;
[ProtoMember(4, IsRequired = true)]
public uint ItemPlusUID;
}
[ProtoContract]
public class MsgItemRefineOptProto2
{
[ProtoMember(1, IsRequired = true)]
public uint ItemUID;
[ProtoMember(2, IsRequired = true)]
public uint EntityUID;
[ProtoMember(3, IsRequired = true)]
public uint Stars;
[ProtoMember(4, IsRequired = true)]
public uint Progress;
[ProtoMember(5, IsRequired = true)]
public uint OwnerUID;
[ProtoMember(6, IsRequired = 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) return 10;
if (value == 730002) return 40;
if (value == 730003) return 120;
if (value == 730004) return 360;
if (value == 730005) return 1080;
if (value == 730006) return 3240;
if (value == 730007) return 9720;
if (value == 730008) return 29160;
return 0;
}
public void Handle(Client.GameState client, byte[] myPacket)
{
try
{
switch (Info.ActionId)
{
case 0://Temper
{
#region Minors
var packet2 = new byte[myPacket.Length - 4];
Array.Copy(myPacket, 4, packet2, 0, packet2.Length);
var variable = Kernel.Read7BitEncodedInt(packet2).SelectMany(System.BitConverter.GetBytes).ToArray();
var variable2 = new byte[variable.Length - 8];
Array.Copy(variable, 8, variable2, 0, variable.Length - 8);
var MinorsCount = (variable2.Length / 4);
uint[] Minors = new uint[MinorsCount];
byte x = 0;
for (int i = 0; i < MinorsCount; i++) { Minors[i] = BitConverter.ToUInt32(variable2, x); x += 4; } #endregion if (Minors != null) { ConquerItem Item; if (client.Equipment.TryGetItem(Info.ItemUID, out Item)) { foreach (var minor in Minors) { ConquerItem ItemPlus; if (client.Inventory.TryGetItem(minor, out ItemPlus)) { Item.PerfectionProgress += GetPlusStonePoints(ItemPlus.ID)/*Database.PerfectionTable.CostList[ItemPlus.ID].Progress*/; client.Inventory.Remove(minor, Game.Enums.ItemUse.Remove, true); } } 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.ItemUID, out Item))
{
if (client.Entity.ConquerPoints >= 1500)
{
client.Entity.ConquerPoints -= 1500;
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.ItemUID, out 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);
}
}
}
break;
}
case 3://CPBoost
{
ConquerItem Item;
if (client.Equipment.TryGetItem(Info.ItemUID, out Item) && Item != null)
{
uint value;
value = Math.Min(414112, client.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.ItemUID, out Item2) || client.Inventory.TryGetItem(Info.ItemUID, out Item2))
{
if (client.Inventory.TryGetItem(Info.ItemPlusUID, out Item) || client.Equipment.TryGetItem(Info.ItemPlusUID, out Item))
{
if (client.Entity.ConquerPoints >= 1000)
{
client.Entity.ConquerPoints -= 1000;
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.ItemUID, out Item))
{
if (Item.PerfectionProgress == 0 || Item.Stars >= 54) break;
double percent = (double)Item.PerfectionProgress / (double)GetPerfectionProgress(Item) * 100;
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 >= 0 && Stars <= 8) return 9; if (Stars >= 9 && 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 = 0; i < packetString.Length; i += 3)
{
string cha = packetString.Substring(i, 2);
bytes[t] = byte.Parse(cha, System.Globalization.NumberStyles.HexNumber);
t++;
}
return bytes;
}
return null;
}
public bool Read(byte[] packet)
{
try
{
var mypkt = new byte[packet.Length - 4];
Array.Copy(packet, 4, mypkt, 0, mypkt.Length);
using (var memoryStream = new MemoryStream(packet))
{
Info = Serializer.DeserializeWithLengthPrefix(memoryStream, PrefixStyle.Fixed32);
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return false;
}
return true;
}
}
public sealed class MsgItemRefineRecord
{
public MsgItemRefineRecord() { }
public MsgItemRefineRecordProto Info;
[ProtoContract]
public class MsgItemRefineRecordProto
{
[ProtoMember(1, IsRequired = true)]
public uint ActionId;
[ProtoMember(2, IsRequired = true)]
public uint MaxPerfectionLevel;
}
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,
MaxPerfectionLevel = 54
}, 3255));
}
public bool Read(byte[] packet)
{
var mypkt = new byte[packet.Length - 4];
Array.Copy(packet, 4, mypkt, 0, mypkt.Length);
using (var memoryStream = new MemoryStream(packet))
{
Info = Serializer.DeserializeWithLengthPrefix(memoryStream, PrefixStyle.Fixed32);
}
return true;
}
}
public sealed 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(1, IsRequired = true)]
public ActionID Action;
[ProtoMember(2)]
public uint RegisteredCount;
[ProtoMember(3)]
public uint Page;
[ProtoMember(4, IsRequired = true)]
public uint Index;
[ProtoMember(5, IsRequired = true)]
public EquipProto[] items;
}
[ProtoContract]
public class EquipProto
{
[ProtoMember(1, IsRequired = true)]
public uint Rank;
[ProtoMember(2, IsRequired = true)]
public uint UnKnow2;
[ProtoMember(3, IsRequired = true)]
public uint Position;
[ProtoMember(4, IsRequired = true)]
public uint RankScore;
[ProtoMember(5, IsRequired = true)]
public uint UID;
[ProtoMember(6, IsRequired = true)]
public uint ItemID;
[ProtoMember(7, IsRequired = true)]
public uint PurificationID;
[ProtoMember(8, IsRequired = true)]
public uint Plus;
[ProtoMember(9, IsRequired = true)]
public uint PerfectionLevel;
[ProtoMember(10, IsRequired = true)]
public string Name = "";
}
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<byte, ConquerItem> MainRank;
public void UpdateRanking()
{
AllItemsRanking = new List();
MainRank = new Dictionary<byte, ConquerItem>();
for (byte i = 0; i < 11; i++)
{
byte z = GetRealyPosition((byte)(i + 1));
List items = new List();
MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
command.Select("items").Where("Position", z).And("Stars", 0, true);
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(x => MsgUserAbilityScore.CalculatePerfectionItemPoints(x)).FirstOrDefault();
}
}
public static List AllItemsRanking;
public void Handle(Client.GameState client)
{
switch (Info.Action)
{
case ActionID.UserItemRanking:
{
var item = AllItemsRanking.Where(p => p.Position == GetRealyPosition((byte)Info.Index)).OrderByDescending(i => MsgUserAbilityScore.CalculatePerfectionItemPoints(i)).ToArray();
var min = Math.Min(item.Length, 50);
for (int i = 0; i < min; i++)
{
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)(i + 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].PerfectionLevel = 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(800, 3000);
client.Send(Kernel.FinalizeProtoBuf(packet, 3256));
break;
}
}
break;
}
case ActionID.MyRanks:
{
var packet = new MsgEquipRefineRankProto();
packet.Action = ActionID.MyRanks;
packet.items = new EquipProto[11];
for (byte i = 0; i < packet.items.Length; i++) { byte z = GetRealyPosition((byte)(i + 1)); var itemmm = AllItemsRanking.Where(p => p.Position == z).OrderByDescending(m => MsgUserAbilityScore.CalculatePerfectionItemPoints(m)).ToArray();
for (int h = 0; h < itemmm.Length; h++) { 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].PerfectionLevel = itemmm[h].Stars; packet.items[i].Plus = itemmm[h].Plus; packet.items[i].Position = (uint)(i + 1); if (itemmm[h].Purification.Available) packet.items[i].PurificationID = itemmm[h].Purification.PurificationItemID; packet.items[i].Rank = (uint)(h + 1); packet.items[i].RankScore = MsgUserAbilityScore.CalculatePerfectionItemPoints(itemmm[h]); packet.items[i].UID = itemmm[h].UID; packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(800, 3000); break; } } } var proto = Kernel.FinalizeProtoBuf(packet, 3256); 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.PerfectionView; item.Send(client); } else { client.Send(Kernel.FinalizeProtoBuf(Info, 3256)); } break; } case ActionID.RankItems://AllRanking { var cnt = AllItemsRanking.Where(p => p.Position == GetRealyPosition((byte)Info.Index)).Count();
var packet = new MsgEquipRefineRankProto();
packet.Action = ActionID.RankItems;
packet.RegisteredCount = (uint)Math.Min(cnt, 50);
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 = rank; i < rank + sss; i++) { var iteeeem = AllItemsRanking.Where(p => p.Position == GetRealyPosition((byte)Info.Index)).OrderByDescending(x => 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)(i + 1);
packet.items[i].RankScore = MsgUserAbilityScore.CalculatePerfectionItemPoints(iteeeem);
packet.items[i].UID = iteeeem.UID;
packet.items[i].UnKnow2 = (uint)Kernel.Random.Next(800, 3000);
}
var proto = Kernel.FinalizeProtoBuf(packet, 3256);
client.Send(proto);
break;
}
case ActionID.MainRank:
{
var packet = new MsgEquipRefineRankProto();
packet.Action = ActionID.MainRank;
packet.items = new EquipProto[11];
for (byte i = 0; i < packet.items.Length; i++)
{
byte z = GetRealyPosition((byte)(i + 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].PerfectionLevel = itemmm.Stars;
packet.items[i].Plus = itemmm.Plus;
packet.items[i].Position = (uint)(i + 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(800, 3000);
}
var proto = Kernel.FinalizeProtoBuf(packet, 3256);
client.Send(proto);
break;
}
}
}
public bool Read(byte[] packet)
{
using (var memoryStream = new MemoryStream(packet))
{
Info = Serializer.DeserializeWithLengthPrefix(memoryStream, PrefixStyle.Fixed32);
}
return true;
}
}
public class MsgRankMemberShow
{
public MsgRankMemberShow() { }
public MsgRankMemberShowProto Info;
[ProtoContract]
public class MsgRankMemberShowProto
{
[ProtoMember(1, IsRequired = true)]
public uint ActionId;
[ProtoMember(2, IsRequired = true)]
public MsgRankMemberShowProtoSer proto;
}
[ProtoContract]
public class MsgRankMemberShowProtoSer
{
[ProtoMember(1, IsRequired = true)]
public uint dwParam;
[ProtoMember(2, IsRequired = true)]
public uint Count;
[ProtoMember(3, IsRequired = true)]
public uint UID;
[ProtoMember(4, IsRequired = true)]
public string Name = "";
[ProtoMember(5, IsRequired = true)]
public string Guild = "";
[ProtoMember(6, IsRequired = true)]
public uint Mesh;
[ProtoMember(7, IsRequired = true)]
public uint HairStyle;
[ProtoMember(8, IsRequired = true)]
public uint Hat;
[ProtoMember(9, IsRequired = true)]
public uint Garment;
[ProtoMember(10, IsRequired = true)]
public uint LeftWep;
[ProtoMember(11, IsRequired = true)]
public uint LeftWepAcc;
[ProtoMember(12, IsRequired = true)]
public uint RightWep;
[ProtoMember(13, IsRequired = true)]
public uint RightWepAcc;
[ProtoMember(14, IsRequired = true)]
public uint MountArmor;
[ProtoMember(15, IsRequired = true)]
public uint Armor;
[ProtoMember(16, IsRequired = true)]
public uint Wing;
[ProtoMember(17, IsRequired = true)]
public uint WingLevel;
[ProtoMember(18, IsRequired = true)]
public uint Title;
[ProtoMember(19, IsRequired = true)]
public uint Flag;
}
public void UpdateBestEntity()
{
Stuff = new Dictionary<string, uint>();
BestEntity = MsgUserAbilityScore.RankingList.OrderByDescending(i => i.TotalPerfectionScore).ThenByDescending(i => i.Level).ThenBy(i => i.UID).FirstOrDefault();
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("items").Where("EntityID", BestEntity.UID).And("Position", 0, true))
using (var reader = new MySqlReader(cmd))
{
while (reader.Read())
{
if (reader.ReadByte("Position") == 1) Stuff.Add(GetPositionName(1), reader.ReadUInt32("ID"));
if (reader.ReadByte("Position") == 3) Stuff.Add(GetPositionName(3), reader.ReadUInt32("ID"));
if (reader.ReadByte("Position") == 5) Stuff.Add(GetPositionName(5), reader.ReadUInt32("ID"));
if (reader.ReadByte("Position") == 9) Stuff.Add(GetPositionName(9), reader.ReadUInt32("ID"));
if (reader.ReadByte("Position") == 16) Stuff.Add(GetPositionName(16), reader.ReadUInt32("ID"));
if (reader.ReadByte("Position") == 17) Stuff.Add(GetPositionName(17), reader.ReadUInt32("ID"));
if (reader.ReadByte("Position") == 4) Stuff.Add(GetPositionName(4), reader.ReadUInt32("ID"));
if (reader.ReadByte("Position") == 15) Stuff.Add(GetPositionName(15), reader.ReadUInt32("ID"));
if (reader.ReadByte("Position") == 19)
{
Stuff.Add(GetPositionName(19), reader.ReadUInt32("ID"));
Stuff.Add(GetPositionName(255), reader.ReadByte("Plus"));
}
}
if (!Stuff.Keys.Contains("MountArmor"))
{
using (var cmd2 = new MySqlCommand(MySqlCommandType.SELECT).Select("items").Where("EntityID", BestEntity.UID).And("Position", 0, true))
using (var reader2 = new MySqlReader(cmd2))
{
while (reader2.Read())
{
if (reader2.ReadByte("Position") == 12) Stuff.Add(GetPositionName(17), reader2.ReadUInt32("ID"));
}
}
}
}
}
public static string GetPositionName(byte Position)
{
if (Position == 1) return "Hat";
if (Position == 3) return "Armor";
if (Position == 5) return "LeftWep";
if (Position == 9) return "Garment";
if (Position == 16) return "LeftWepAcc";
if (Position == 17) return "MountArmor";
if (Position == 4) return "RightWep";
if (Position == 15) return "RightWepAcc";
if (Position == 19) return "Wing";
if (Position == 255) return "WingLevel";
return "Unknwon";
}
public static Dictionary<string, uint> Stuff = new Dictionary<string, uint>();
public static Game.Entity BestEntity;
public void Handle(Client.GameState client)
{
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;
proto2.proto.HairStyle = BestEntity.HairStyle;
proto2.proto.Mesh = BestEntity.Mesh;
proto2.proto.Name = BestEntity.Name;
proto2.proto.Guild = Kernel.Guilds.ContainsKey(BestEntity.GuildID) ? Kernel.Guilds[BestEntity.GuildID].Name : "";
proto2.proto.Hat = Stuff.Where(i => i.Key == "Hat").FirstOrDefault().Value;
proto2.proto.LeftWep = Stuff.Where(i => i.Key == "LeftWep").FirstOrDefault().Value;
proto2.proto.LeftWepAcc = Stuff.Where(i => i.Key == "LeftWepAcc").FirstOrDefault().Value;
proto2.proto.MountArmor = Stuff.Where(i => i.Key == "MountArmor").FirstOrDefault().Value;
proto2.proto.Garment = Stuff.Where(i => i.Key == "Garment").FirstOrDefault().Value;
proto2.proto.Armor = Stuff.Where(i => i.Key == "Armor").FirstOrDefault().Value;
proto2.proto.RightWep = Stuff.Where(i => i.Key == "RightWep").FirstOrDefault().Value;
proto2.proto.RightWepAcc = Stuff.Where(i => i.Key == "RightWepAcc").FirstOrDefault().Value;
proto2.proto.Wing = BestEntity.EquippedWing == 0 ? Stuff.Where(i => i.Key == "Wing").FirstOrDefault().Value : (uint)BestEntity.EquippedWing;
proto2.proto.WingLevel = Stuff.Where(i => i.Key == "WingLevel").FirstOrDefault().Value;
proto2.proto.Title = (uint)BestEntity.EquippedTitle;
client.Send(Kernel.FinalizeProtoBuf(proto2, 3257));
break;
}
case 1:
{
client.Send(Kernel.FinalizeProtoBuf(Info, 3257));
}
break;
}
}
public bool Read(byte[] packet)
{
var mypkt = new byte[packet.Length - 4];
Array.Copy(packet, 4, mypkt, 0, mypkt.Length);
try
{
using (var memoryStream = new MemoryStream(packet))
{
Info = Serializer.DeserializeWithLengthPrefix(memoryStream, PrefixStyle.Fixed32);
}
}
catch (Exception e)
{
Console.WriteLine(e);
return false;
}
return true;
}
}
public sealed class MsgUserTotalRefineLev
{
public MsgUserTotalRefineLev() { }
public MsgUserTotalRefineLevProto Info;
[ProtoContract]
public class MsgUserTotalRefineLevProto
{
[ProtoMember(1, IsRequired = true)]
public uint ActionId;
[ProtoMember(2, IsRequired = true)]
public uint EntityUID;
[ProtoMember(3, IsRequired = true)]
public uint TotalPrefectionLevel;
}
public void SendPerfectionEffects(Client.GameState client)
{
if (client.Equipment.TotalPerfectionLevel >= 10) { client.Entity.MaxAttack += 100; client.Entity.MinAttack += 100; client.Entity.MagicAttack += 100; }
if (client.Equipment.TotalPerfectionLevel >= 70) { client.Entity.Defence += 100; client.Entity.MagicDefence += 100; }
if (client.Equipment.TotalPerfectionLevel >= 75) { client.Entity.MaxAttack += 200; client.Entity.MinAttack += 200; client.Entity.MagicAttack += 300; }
if (client.Equipment.TotalPerfectionLevel >= 100) { client.Entity.Defence += 200; client.Entity.MagicDefence += 50; }
if (client.Equipment.TotalPerfectionLevel >= 140) { client.Entity.MaxAttack += 200; client.Entity.MinAttack += 200; client.Entity.MagicAttack += 400; }
if (client.Equipment.TotalPerfectionLevel >= 150) { client.Entity.MaxAttack += 300; client.Entity.MinAttack += 300; client.Entity.MagicAttack += 500; }
if (client.Equipment.TotalPerfectionLevel >= 160) { client.Entity.Defence += 300; client.Entity.MagicDefence += 125; }
if (client.Equipment.TotalPerfectionLevel >= 180) { client.Entity.Defence += 400; client.Entity.MagicDefence += 125; }
if (client.Equipment.TotalPerfectionLevel >= 235) { client.Entity.MaxAttack += 400; client.Entity.MinAttack += 400; client.Entity.MagicAttack += 500; }
if (client.Equipment.TotalPerfectionLevel >= 270) { client.Entity.Defence += 400; client.Entity.MagicDefence += 125; }
if (client.Equipment.TotalPerfectionLevel >= 273) { client.Entity.MaxAttack += 400; client.Entity.MinAttack += 400; client.Entity.MagicAttack += 500; }
if (client.Equipment.TotalPerfectionLevel >= 306) { client.Entity.MaxAttack += 400; client.Entity.MinAttack += 400; client.Entity.MagicAttack += 500; }
if (client.Equipment.TotalPerfectionLevel >= 310) { client.Entity.Defence += 400; client.Entity.MagicDefence += 125; }
if (client.Equipment.TotalPerfectionLevel >= 316) { client.Entity.Defence += 500; client.Entity.MagicDefence += 125; }
if (client.Equipment.TotalPerfectionLevel >= 318) { client.Entity.MaxAttack += 500; client.Entity.MinAttack += 500; client.Entity.MagicAttack += 500; }
if (client.Equipment.TotalPerfectionLevel >= 323) { client.Entity.Defence += 500; client.Entity.MagicDefence += 125; }
if (client.Equipment.TotalPerfectionLevel >= 324) { client.Entity.MaxAttack += 500; client.Entity.MinAttack += 500; client.Entity.MagicAttack += 500; }
}
public void Send(Client.GameState client)
{
client.Send(Kernel.FinalizeProtoBuf(new MsgUserTotalRefineLevProto()
{
ActionId = 0,
EntityUID = client.Entity.UID,
TotalPrefectionLevel = client.Equipment.TotalPerfectionLevel
}, 3252));
}
}
public sealed class MsgRefineEffect
{
public MsgRefineEffect() { }
public MsgRefineEffectProto Info;
[ProtoContract]
public class MsgRefineEffectProto
{
[ProtoMember(1, IsRequired = true)]
public uint AttackerUID;
[ProtoMember(2, IsRequired = true)]
public uint AttackedUID;
[ProtoMember(3, IsRequired = true)]
public uint Effect;
}
public byte GetChance(Client.GameState client, Game.Enums.PerfectionEffect effect)
{
if (client.Equipment.TotalPerfectionLevel == 0) return 0;
byte Chance = 255;
if (effect == Game.Enums.PerfectionEffect.CalmWind)
{
if (client.Equipment.TotalPerfectionLevel >= 3) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 90) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 170) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 250) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 285) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.BloodSpawn)
{
if (client.Equipment.TotalPerfectionLevel >= 40) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 240) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 288) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.DivineGuard)
{
if (client.Equipment.TotalPerfectionLevel >= 1) Chance += 5;
}
if (effect == Game.Enums.PerfectionEffect.CoreStrike)
{
if (client.Equipment.TotalPerfectionLevel >= 50) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 80) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 135) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 205) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 245) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.DrainingTouch)
{
if (client.Equipment.TotalPerfectionLevel >= 35) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 220) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 276) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.FreeSoul)
{
if (client.Equipment.TotalPerfectionLevel >= 25) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 95) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 130) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 195) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 279) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.InvisibleArrow)
{
if (client.Equipment.TotalPerfectionLevel >= 65) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 225) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 282) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.KillingFlash)
{
if (client.Equipment.TotalPerfectionLevel >= 55) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 165) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 294) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.LightofStamina)
{
if (client.Equipment.TotalPerfectionLevel >= 1) Chance += 5;
}
if (effect == Game.Enums.PerfectionEffect.LuckyStrike)
{
if (client.Equipment.TotalPerfectionLevel >= 15) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 115) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 215) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 314) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 320) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.MirrorofSin)
{
if (client.Equipment.TotalPerfectionLevel >= 60) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 190) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 291) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.ShieldBreak)
{
if (client.Equipment.TotalPerfectionLevel >= 155) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 255) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 297) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 312) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 322) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.StraightLife)
{
if (client.Equipment.TotalPerfectionLevel >= 30) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 125) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 210) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 265) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 303) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.Stricklock)
{
if (client.Equipment.TotalPerfectionLevel >= 308) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 321) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 175) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 105) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 20) Chance += 1;
}
return Chance;
}
public void SendEffect(Game.Entity attacker, Game.Entity attacked, Game.Enums.PerfectionEffect effect)
{
if (attacker == null || attacked == null) return;
var proto = new MsgRefineEffectProto();
proto.AttackerUID = attacker.UID;
if (attacked.EntityFlag == Game.EntityFlag.Player)
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(proto, 3254);
attacker.Owner.SendScreen(proto2, true);
if (effect == Game.Enums.PerfectionEffect.DrainingTouch)
{
attacker.Hitpoints = attacker.MaxHitpoints;
attacker.Mana = attacker.MaxMana;
}
if (effect == Game.Enums.PerfectionEffect.KillingFlash)
{
attacker.AddFlag((ulong)Update.Flags.XPList);
}
if (effect == Game.Enums.PerfectionEffect.DivineGuard)
{
attacker.AddFlag3((ulong)Update.Flags3.DivineGuard);
attacker.Defence = (ushort)(((attacker.Defence) * 300) / 100);
attacker.DivineGuardStamp = Time32.Now;
}
if (effect == Game.Enums.PerfectionEffect.ShieldBreak)
{
attacker.AddFlag3((ulong)Update.Flags3.ShieldBreak);
attacker.ShieldBreakStamp = Time32.Now;
attacker.Block += (ushort)(((attacker.Block) * 20) / 10);
}
}
public void GenerateEffectandChance(Client.GameState client, ref Game.Enums.PerfectionEffect effect, ref byte chance)
{
effect = (Game.Enums.PerfectionEffect)Kernel.Random.Next(3, 14);
chance = GetChance(client, effect);
while (chance == 255)
{
effect = (Game.Enums.PerfectionEffect)Kernel.Random.Next(3, 14);
chance = GetChance(client, effect);
}
}
public void HandleStrickeLock(Game.Entity client, ref byte chance)
{
chance = GetChance(client.Owner, Game.Enums.PerfectionEffect.Stricklock);
}
public void HandleFreeSoul(Game.Entity client, ref byte chance)
{
chance = GetChance(client.Owner, Game.Enums.PerfectionEffect.FreeSoul);
}
public void HandleStraightLife(Game.Entity client, ref byte chance)
{
chance = GetChance(client.Owner, Game.Enums.PerfectionEffect.StraightLife);
}
public void HandleBloodSpawn(Game.Entity client, ref byte chance)
{
chance = GetChance(client.Owner, Game.Enums.PerfectionEffect.BloodSpawn);
}
public void HandleMirror(Game.Entity client, ref byte chance)
{
chance = GetChance(client.Owner, Game.Enums.PerfectionEffect.MirrorofSin);
}
}
}

كلاس PerfectionTable.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Desco_Pj;
using Desco_Pj.Game;
using Desco_Pj.Network.GamePackets;
namespace Desco_Pj.Database
{
public class PerfectionTable
{
#region ItemRefineCost
public static Dictionary<uint, ItemRefineCost> CostList = new Dictionary<uint, ItemRefineCost>();
public class ItemRefineCost
{
public uint ItemID;
public ushort Progress;
}
public static void LoadItemRefineCost()
{
if (File.Exists(Constants.DataHolderPath + "item_refine_cost.txt"))
{
string[] Lines = File.ReadAllLines(Constants.DataHolderPath + "item_refine_cost.txt");
foreach (var line in Lines)
{
var spilitline = line.Split(new string[] { "@@", " " }, StringSplitOptions.RemoveEmptyEntries);
ItemRefineCost irc = new ItemRefineCost();
irc.ItemID = Convert.ToUInt32(spilitline[0]);
irc.Progress = Convert.ToUInt16(spilitline[1]);
CostList.Add(irc.ItemID, irc);
}
}
}
#endregion
#region ItemRefineUpgrade
public static List UpgradeList = new List();
public class ItemRefineUpgrade
{
public byte Position;
public ushort Stars;
public ushort Progress;
}
public static void LoadItemRefineUpgrade()
{
if (File.Exists(Constants.DataHolderPath + "item_refine_upgrade.txt"))
{
string[] Lines = File.ReadAllLines(Constants.DataHolderPath + "item_refine_upgrade.txt");
foreach (var line in Lines)
{
var spilitline = line.Split(new string[] { "@@", " " }, StringSplitOptions.RemoveEmptyEntries);
ItemRefineUpgrade iru = new ItemRefineUpgrade();
iru.Position = Convert.ToByte(spilitline[0]);
iru.Stars = Convert.ToUInt16(spilitline[1]);
iru.Progress = Convert.ToUInt16(spilitline[2]);
UpgradeList.Add(iru);
}
}
}
#endregion
#region ItemRefineAttribute
public static Dictionary<ushort, ItemRefineAttribute> AttributeList = new Dictionary<ushort, ItemRefineAttribute>();
public class ItemRefineAttribute
{
public ushort ID;
public Game.Enums.PerfectionEffect Type;
public byte Level;
public uint DoWhat;
public uint DoWhat2;
public ushort Chance;
}
public static void LoadItemRefineAttribute()
{
if (File.Exists(Constants.DataHolderPath + "item_refine_attr.txt"))
{
string[] Lines = File.ReadAllLines(Constants.DataHolderPath + "item_refine_attr.txt");
foreach (var line in Lines)
{
var spilitline = line.Split(new string[] { "@@", " " }, StringSplitOptions.RemoveEmptyEntries);
ItemRefineAttribute iru = new ItemRefineAttribute();
iru.ID = Convert.ToUInt16(spilitline[0]);
iru.Type = (Game.Enums.PerfectionEffect)Convert.ToByte(spilitline[1]);
iru.Level = Convert.ToByte(spilitline[2]);
iru.DoWhat = Convert.ToUInt16(spilitline[3]);
iru.DoWhat2 = Convert.ToUInt16(spilitline[4]);
iru.Chance = Convert.ToUInt16(spilitline[5]);
AttributeList.Add(iru.ID, iru);
}
}
}
#endregion
#region AbilityScore
public static Dictionary<ushort, ItemAbilityScore> AbilityScore = new Dictionary<ushort, ItemAbilityScore>();
public const byte Jiang = 1,
Chi = 2,
Enchant = 4,
Level = 5,
Stars = 6,
Socket = 10,
Gems = 11,
Plus = 12,
Soul = 13,
Bless = 15;
public class ItemAbilityScore
{
public ushort ID = 0;
public byte Type = 0;
public uint Min = 0;
public uint Max = 0;
public uint Points = 0;
}
public static void LoadItemAbilityScore()
{
if (File.Exists(Constants.DataHolderPath + "ability_score.txt"))
{
string[] Lines = File.ReadAllLines(Constants.DataHolderPath + "ability_score.txt");
foreach (var line in Lines)
{
var spilitline = line.Split(new string[] { "@@", " " }, StringSplitOptions.RemoveEmptyEntries);
ItemAbilityScore iru = new ItemAbilityScore();
iru.ID = Convert.ToUInt16(spilitline[0]);
iru.Type = Convert.ToByte(spilitline[1]);
iru.Min = Convert.ToUInt32(spilitline[2]);
iru.Max = Convert.ToUInt32(spilitline[3]);
iru.Points = Convert.ToUInt32(spilitline[4]);
AbilityScore.Add(iru.ID, iru);
}
}
}
#endregion
public static void Load()
{
LoadItemRefineCost();
LoadItemRefineUpgrade();
LoadItemAbilityScore();
LoadItemRefineAttribute();
}
}
}

هتعمل كلاس تاني فيه فولدر Database بأسم StorageItem.cs
لو عامل موضوع الورداروب متعملوش

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Desco_Pj.Database
{
public class StorageItem
{
public uint ID;
public uint Points;
public uint Stars;
public byte Type;
public static Dictionary<uint, StorageItem> Garments = new Dictionary<uint, StorageItem>();
public static Dictionary<uint, StorageItem> Mounts = new Dictionary<uint, StorageItem>();
public static void Load()
{
string[] baseText = System.IO.File.ReadAllLines("database\\coat_storage_type.txt");
foreach (var bas_line in baseText)
{
var line = bas_line.Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries);
StorageItem item = new StorageItem();
item.ID = uint.Parse(line[0]);
item.Points = uint.Parse(line[1]);
item.Stars = uint.Parse(line[7]);
item.Type = byte.Parse(line[2]);
if (item.Type == 1)
Garments.Add(item.ID, item);
else
Mounts.Add(item.ID, item);
}
}
public static uint AmountStarGarments(Desco_Pj.Client.GameState client, byte Star)
{
uint Count = 0;
foreach (var Garment in client.Entity.StorageItems.Values)
{
StorageItem item;
if (Garments.TryGetValue(Garment.ID, out item))
{
if (item.Type != 1)
continue;
if (item.Stars >= Star)
Count++;
}
}
return Count;
}
public static uint PerfectionPoints(Desco_Pj.Client.GameState client, bool Garment)
{
uint Count = 0;
foreach (var item2 in client.Entity.StorageItems.Values)
{
StorageItem item;
if (Garment)
{
if (Garments.TryGetValue(item2.ID, out item))
{
if (item.Type != 1)
continue;
if (item.Points == 1)
Count += 50;
else if (item.Points >= 2 && item.Points <= 10) Count += 100; else if (item.Points >= 11 && item.Points <= 50) Count += 200; else if (item.Points >= 51 && item.Points <= 100) Count += 300; else if (item.Points >= 100 && item.Points <= 200) Count += 500; } } else { if (Mounts.TryGetValue(item2.ID, out item)) { if (item.Type != 2) continue; if (item.Points == 1) Count += 50; else if (item.Points >= 2 && item.Points <= 10) Count += 100; else if (item.Points >= 11 && item.Points <= 50) Count += 200; else if (item.Points >= 51 && item.Points <= 100) Count += 300; else if (item.Points >= 100 && item.Points <= 200) Count += 500; } } } return Count; } public static uint AmountStarMounts(Desco_Pj.Client.GameState client, byte Star) { uint Count = 0; foreach (var Mount in client.Entity.StorageItems.Values) { StorageItem item; if (Mounts.TryGetValue(Mount.ID, out item)) { if (item.Type != 2) continue; if (item.Stars >= Star)
Count++;
}
}
return Count;
}
}
}

طبعا هتجيلك ايرورات كتير مش مشكلة سيبك منها و كمل
هتفتح Kernel.cs
تحت الكوس بتاع الكلاس حط دول

public static byte[] FinalizeProtoBuf(object proto, ushort packetid)
{
byte[] protobuff;
using (var ms = new System.IO.MemoryStream())
{
ProtoBuf.Serializer.Serialize(ms, proto);
protobuff = ms.ToArray();
byte[] buffer;
buffer = new byte[12 + protobuff.Length];
System.Buffer.BlockCopy(protobuff, 0, buffer, 4, protobuff.Length);
Network.Writer.Write(buffer.Length - 8, 0, buffer);
Network.Writer.Write(packetid, 2, buffer);
/* if (packetid == 3257)
{
var packet2 = new byte[buffer.Length - 4];
Array.Copy(buffer, 4, packet2, 0, packet2.Length);
var variable = Kernel.Read7BitEncodedInt(packet2).SelectMany(BitConverter.GetBytes).ToArray();
Network.PacketHandler.PrintPacket(variable);
}*/
return buffer;
}
}
public static uint[] Read7BitEncodedInt(byte[] buffer)
{
List ptr2 = new List();
for (int i = 0; i < buffer.Length; )
{
if (i + 2 <= buffer.Length) { int tmp = buffer[i++]; if (tmp % 8 == 0) while (true) { if (i + 1 > buffer.Length) break;
tmp = buffer[i++];
if (tmp < 128)
{
ptr2.Add((uint)tmp);
break;
}
else
{
int result = tmp & 0x7f;
if ((tmp = buffer[i++]) < 128)
{
result |= tmp << 7;
ptr2.Add((uint)result);
break;
}
else
{
result |= (tmp & 0x7f) << 7;
if ((tmp = buffer[i++]) < 128)
{
result |= tmp << 14;
ptr2.Add((uint)result);
break;
}
else
{
result |= (tmp & 0x7f) << 14;
if ((tmp = buffer[i++]) < 128)
{
result |= tmp << 21;
ptr2.Add((uint)result);
break;
}
else
{
result |= (tmp & 0x7f) << 21;
result |= (tmp = buffer[i++]) << 28;
ptr2.Add((uint)result);
break;
}
}
}
}
}
}
else break;
}
return ptr2.ToArray();
}

هتفتح GameState.cs. أو GameClient علي حسب سورسك
هتبحث علي الكود ده

public void doAuraBonuses(ulong type, uint power, int i)

فوقيه هتلاقي الكود ده

PacketHandler.WindowStats(this);

حط فوقيه علي طول الكود ده

new MsgUserTotalRefineLev().SendPerfectionEffects(this);

نخش علي ConquerItemTable.cs

ملحوظة صغيرة شوية علشان نبقي علي نور
فيه كودين في الملف ده اللي هما ( reader.Read – reader.Get )
الاكواد دية تبع reader.Read
ابحث علي الكود ده

item.RefineItem = reader.ReadUInt32("RefineryItem");

و حط تحتيه دول

item.Signature = reader.ReadString("Signature");
item.Stars = reader.ReadByte("Stars");
item.PerfectionProgress = reader.ReadUInt32("PerfectionProgress");
item.Owner = reader.ReadString("Owner");
item.OwnerUID = reader.ReadUInt32("OwnerUID");

الاكواد دية تبع reader.Get
لو عندك ضيفهم لو مش عندك سيبهم دلوقتي
هتبحث علي الكود ده

item.UID = reader.GetUInt32("Uid");

تحتيه دول

item.Stars = (byte)reader.GetUInt32("Stars");
item.Owner = reader.GetString("Owner");
item.OwnerUID = reader.GetUInt32("OwnerUID");
item.PerfectionProgress = reader.GetUInt32("PerfectionProgress");
item.Signature = reader.GetString("Signature");

و هتنزل شوية هتلاقي فيه كذا حاجة أولها كلمة ابديت
أقفل واحدة فيهم من السالب
و حط دول تحتها

public static void UpdatePerfection(ConquerItem Item)
{
UpdateData(Item, "PerfectionProgress", Item.PerfectionProgress);
UpdateData(Item, "Stars", Item.Stars);
UpdateData(Item, "Owner", Item.Owner);
UpdateData(Item, "OwnerUID", Item.OwnerUID);
UpdateData(Item, "Signature", Item.Signature);
} 
public static void UpdateMinutes(ConquerItem Item)
{
UpdateData(Item, "MinutesLeft", Item.Minutes);
}
public static void UpdateTimeStamp(ConquerItem Item)
{
UpdateData(Item, "TimeStamp", Item.TimeStamp);
}

افتح ملف EntityTable.cs

أبحث علي الكود ده

.Set("Money", e.Money)

تحتيه ضيف ده

.Set("TotalPerfectionScore", e.TotalPerfectionScore)

أفتح Handle.cs
ملحوظة صغيرة في سورسات تختلف فيها النظام بتاعها في الوقت ده ( Time64 – Time32 ) فأبحث علي اللي يخصك بس منهم
أبحث علي ده

if (Time32.Now > attacker.SpellStamp.AddSeconds(2))

تحت الكوس بتاعه حط دول

#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.FreeSoul;
byte chance = 0;
new MsgRefineEffect().HandleFreeSoul(attacker, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacked, attacker, effect);
break;
}
#endregion

ابحث علي الكود ده

public static void ReceiveAttack

تحت الكوس بتاعه حط دول

#region Perfection
if (attacker.EntityFlag == EntityFlag.Player)
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.CalmWind;
byte chance = 0;
new MsgRefineEffect().GenerateEffectandChance(attacker.Owner, ref effect, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacker, attacked, effect);
}
#endregion
}
if (attacker.EntityFlag == EntityFlag.Player)
{
#region Perfection
byte chance = 0;
new MsgRefineEffect().HandleLuckyStrike(attacker, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacker, attacked, Game.Enums.PerfectionEffect.LuckyStrike);
damage *= 2;
}
#endregion
}
if (attacked.EntityFlag == EntityFlag.Player)
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.Stricklock;
byte chance = 0;
new MsgRefineEffect().HandleStrickeLock(attacker, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacked, attacker, effect);
return;
}
#endregion
}
if (attacked.EntityFlag == EntityFlag.Player)
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.Stricklock;
byte chance = 0;
new MsgRefineEffect().HandleBloodSpawn(attacked, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacked, attacker, effect);
attacked.Hitpoints = attacked.MaxHitpoints;
attacked.Mana = attacked.MaxMana;
}
#endregion
}
if (attacked.EntityFlag == EntityFlag.Player)
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.MirrorofSin;
byte chance = 0;
new MsgRefineEffect().HandleMirror(attacked, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacked, attacker, effect);
attacked.AddFlag(Network.GamePackets.Update.Flags.XPList);
}
#endregion
}
#endregion

أفتح الملف Equipment.cs
حط ده تحت الكوس بتاع الكلاس

#region Perfection
public bool IsWearingItemUID(uint ItemUID)
{
foreach (var obj in Objects)
{
if (obj == null) continue;
if (obj.UID == ItemUID) return true;
}
return false;
}
public uint GetFullEquipmentPlusPoints
{
get
{
uint val = 0;
foreach (Network.GamePackets.ConquerItem item in Objects)
{
if (item == null) continue;
if (item.Position > 19 || item.Position == 7 || item.Position == 9 || item.Position == 15 || item.Position == 16 || item.Position == 17) continue;
if (!Network.PacketHandler.IsTwoHand(item.ID))
{
if (item.Plus == 1) val += 200;
if (item.Plus == 2) val += 600;
if (item.Plus == 3) val += 1200;
if (item.Plus == 4) val += 1800;
if (item.Plus == 5) val += 2600;
if (item.Plus == 6) val += 3500;
if (item.Plus == 7) val += 4800;
if (item.Plus == 8) val += 5800;
if (item.Plus == 9) val += 6800;
if (item.Plus == 10) val += 7800;
if (item.Plus == 11) val += 8800;
if (item.Plus == 12) val += 10000;
}
else
{
if (item.Plus == 1) val += 400;
if (item.Plus == 2) val += 1200;
if (item.Plus == 3) val += 2400;
if (item.Plus == 4) val += 3600;
if (item.Plus == 5) val += 5200;
if (item.Plus == 6) val += 7000;
if (item.Plus == 7) val += 9600;
if (item.Plus == 8) val += 11600;
if (item.Plus == 9) val += 13600;
if (item.Plus == 10) val += 15600;
if (item.Plus == 11) val += 17600;
if (item.Plus == 12) val += 20000;
}
}
return val;
}
}
public uint GetFullEquipmentEnumPoints
{
get
{
uint Points = 0;
foreach (Network.GamePackets.ConquerItem item in Objects)
{
if (item == null) continue;
if (item.Position > 19 || item.Position == 7 || item.Position == 9 || item.Position == 15 || item.Position == 16 || item.Position == 17) continue;
if (!Network.PacketHandler.IsTwoHand(item.ID))
{
if (item.ID % 10 == 9) Points += 500;
if (item.ID % 10 == 8) Points += 300;
if (item.ID % 10 == 7) Points += 200;
if (item.ID % 10 == 6) Points += 100;
if (item.ID % 10 > 0 && item.ID % 10 < 6) Points += 50; } else { if (item.ID % 10 == 9) Points += 1000; if (item.ID % 10 == 8) Points += 600; if (item.ID % 10 == 7) Points += 400; if (item.ID % 10 == 6) Points += 200; if (item.ID % 10 > 0 && item.ID % 10 < 6) Points += 100; } } return Points; } } public uint GetFullEquipmentSoulPoints { get { uint Points = 0; foreach (Network.GamePackets.ConquerItem item in Objects) { if (item == null || !item.Purification.Available) continue; if (item.Position > 19 || item.Position == 7 || item.Position == 9 || item.Position == 15 || item.Position == 16 || item.Position == 17) continue;
if (!Network.PacketHandler.IsTwoHand(item.ID))
{
if (item.Purification.PurificationLevel == 1) Points += 100;
if (item.Purification.PurificationLevel == 2) Points += 300;
if (item.Purification.PurificationLevel == 3) Points += 500;
if (item.Purification.PurificationLevel == 4) Points += 800;
if (item.Purification.PurificationLevel == 5) Points += 1200;
if (item.Purification.PurificationLevel == 6) Points += 1600;
if (item.Purification.PurificationLevel == 7) Points += 2000;
}
else
{
if (item.Purification.PurificationLevel == 1) Points += 200;
if (item.Purification.PurificationLevel == 2) Points += 600;
if (item.Purification.PurificationLevel == 3) Points += 1000;
if (item.Purification.PurificationLevel == 4) Points += 1600;
if (item.Purification.PurificationLevel == 5) Points += 2400;
if (item.Purification.PurificationLevel == 6) Points += 3200;
if (item.Purification.PurificationLevel == 7) Points += 4000;
}
}
return Points;
}
}
public uint GetFullEquipmentEnchantPoints
{
get
{
uint val = 0;
foreach (Network.GamePackets.ConquerItem item in Objects)
{
if (item == null) continue;
if (item.Position > 19 || item.Position == 7 || item.Position == 9 || item.Position == 15 || item.Position == 16 || item.Position == 17) continue;
if (!Network.PacketHandler.IsTwoHand(item.ID))
{
var enc = (uint)(item.Enchant);
if (enc != 0)
{
if (enc <= 200) val += enc * 1;
if (enc <= 240) val += (uint)(enc * 1.3);
if (enc <= 254) val += (uint)(enc * 1.6);
if (enc <= 255) val += enc * 2;
}
}
else
{
var enc = (uint)(item.Enchant);
if (enc != 0)
{
if (enc <= 200) val += enc * 2;
if (enc <= 240) val += (uint)(enc * 2.6);
if (enc <= 254) val += (uint)(enc * 3.2);
if (enc <= 255) val += enc * 4; } } } return val; } } public uint GetFullEquipmentLevelPoints { get { uint val = 0; foreach (Network.GamePackets.ConquerItem item in Objects) { if (item == null) continue; if (item.Position > 19 || item.Position == 7 || item.Position == 9 || item.Position == 15 || item.Position == 16 || item.Position == 17) continue;
if (!Network.PacketHandler.IsTwoHand(item.ID))
{
var lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
if (lvl <= 120)
val += lvl * 3;
else if (lvl <= 130)
val += lvl * 5;
else if (lvl <= 140)
val += lvl * 6;
}
else
{
var lvl = (uint)Database.ConquerItemInformation.BaseInformations[item.ID].Level;
if (lvl <= 120)
val += lvl * 6;
else if (lvl <= 130)
val += lvl * 10;
else if (lvl <= 140) val += lvl * 12; } } return val; } } public uint GetFullEquipmentGemPoints { get { uint val = 0; foreach (Network.GamePackets.ConquerItem item in Objects) { if (item == null) continue; if (item.Position > 19 || item.Position == 7 || item.Position == 9 || item.Position == 15 || item.Position == 16 || item.Position == 17) continue;
if (!Network.PacketHandler.IsTwoHand(item.ID))
{
if (item.SocketOne != (Game.Enums.Gem)0)
{
if (item.SocketOne2 % 10 == 1) val += 200;
if (item.SocketOne2 % 10 == 2) val += 500;
if (item.SocketOne2 % 10 == 3) val += 800;
}
if (item.SocketTwo != (Game.Enums.Gem)0)
{
if (item.SocketTwo2 % 10 == 1) val += 200;
if (item.SocketTwo2 % 10 == 2) val += 500;
if (item.SocketTwo2 % 10 == 3) val += 800;
}
}
else
{
if (item.SocketOne != (Game.Enums.Gem)0)
{
if (item.SocketOne2 % 10 == 1) val += 400;
if (item.SocketOne2 % 10 == 2) val += 1000;
if (item.SocketOne2 % 10 == 3) val += 1600;
}
if (item.SocketTwo != (Game.Enums.Gem)0)
{
if (item.SocketTwo2 % 10 == 1) val += 400;
if (item.SocketTwo2 % 10 == 2) val += 1000;
if (item.SocketTwo2 % 10 == 3) val += 1600;
}
}
}
return val;
}
}
public uint GetFullEquipmentPerfecetionLevelPoints
{
get
{
uint Points = 0;
foreach (Network.GamePackets.ConquerItem item in Objects)
{
if (item == null) continue;
if (item.Position > 19 || item.Position == 7 || item.Position == 9 || item.Position == 15 || item.Position == 16 || item.Position == 17) continue;
if (item.Stars >= 1) Points += 180;
if (item.Stars >= 2) Points += 180;
if (item.Stars >= 3) Points += 180;
if (item.Stars >= 4) Points += 180;
if (item.Stars >= 5) Points += 180;
if (item.Stars >= 6) Points += 180;
if (item.Stars >= 7) Points += 180;
if (item.Stars >= 8) Points += 180;
if (item.Stars >= 9) Points += 180;
if (item.Stars >= 10) Points += 2380;
if (item.Stars >= 11) Points += 400;
if (item.Stars >= 12) Points += 400;
if (item.Stars >= 13) Points += 400;
if (item.Stars >= 14) Points += 400;
if (item.Stars >= 15) Points += 400;
if (item.Stars >= 16) Points += 400;
if (item.Stars >= 17) Points += 400;
if (item.Stars >= 18) Points += 400;
if (item.Stars >= 19) Points += 5150;
if (item.Stars >= 20) Points += 650;
if (item.Stars >= 21) Points += 650;
if (item.Stars >= 22) Points += 650;
if (item.Stars >= 23) Points += 650;
if (item.Stars >= 24) Points += 650;
if (item.Stars >= 25) Points += 650;
if (item.Stars >= 26) Points += 650;
if (item.Stars >= 27) Points += 650;
if (item.Stars >= 28) Points += 100;
if (item.Stars >= 29) Points += 100;
if (item.Stars >= 30) Points += 100;
if (item.Stars >= 31) Points += 100;
if (item.Stars >= 32) Points += 100;
if (item.Stars >= 33) Points += 100;
if (item.Stars >= 34) Points += 100;
if (item.Stars >= 35) Points += 100;
if (item.Stars >= 36) Points += 100;
if (item.Stars >= 37) Points += 100;
if (item.Stars >= 38) Points += 100;
if (item.Stars >= 39) Points += 100;
if (item.Stars >= 40) Points += 100;
if (item.Stars >= 41) Points += 100;
if (item.Stars >= 42) Points += 100;
if (item.Stars >= 43) Points += 100;
if (item.Stars >= 44) Points += 100;
if (item.Stars >= 45) Points += 100;
if (item.Stars >= 46) Points += 100;
if (item.Stars >= 47) Points += 100;
if (item.Stars >= 48) Points += 100;
if (item.Stars >= 49) Points += 100;
if (item.Stars >= 50) Points += 100;
if (item.Stars >= 51) Points += 100;
if (item.Stars >= 52) Points += 100;
if (item.Stars >= 53) Points += 100;
if (item.Stars >= 54) Points += 100;
if (Network.PacketHandler.IsTwoHand(item.ID))
{
if (item.Stars >= 1) Points += 180;
if (item.Stars >= 2) Points += 180;
if (item.Stars >= 3) Points += 180;
if (item.Stars >= 4) Points += 180;
if (item.Stars >= 5) Points += 180;
if (item.Stars >= 6) Points += 180;
if (item.Stars >= 7) Points += 180;
if (item.Stars >= 8) Points += 180;
if (item.Stars >= 9) Points += 180;
if (item.Stars >= 10) Points += 2380;
if (item.Stars >= 11) Points += 400;
if (item.Stars >= 12) Points += 400;
if (item.Stars >= 13) Points += 400;
if (item.Stars >= 14) Points += 400;
if (item.Stars >= 15) Points += 400;
if (item.Stars >= 16) Points += 400;
if (item.Stars >= 17) Points += 400;
if (item.Stars >= 18) Points += 400;
if (item.Stars >= 19) Points += 5150;
if (item.Stars >= 20) Points += 650;
if (item.Stars >= 21) Points += 650;
if (item.Stars >= 22) Points += 650;
if (item.Stars >= 23) Points += 650;
if (item.Stars >= 24) Points += 650;
if (item.Stars >= 25) Points += 650;
if (item.Stars >= 26) Points += 650;
if (item.Stars >= 27) Points += 650;
if (item.Stars >= 28) Points += 100;
if (item.Stars >= 29) Points += 100;
if (item.Stars >= 30) Points += 100;
if (item.Stars >= 31) Points += 100;
if (item.Stars >= 32) Points += 100;
if (item.Stars >= 33) Points += 100;
if (item.Stars >= 34) Points += 100;
if (item.Stars >= 35) Points += 100;
if (item.Stars >= 36) Points += 100;
if (item.Stars >= 37) Points += 100;
if (item.Stars >= 38) Points += 100;
if (item.Stars >= 39) Points += 100;
if (item.Stars >= 40) Points += 100;
if (item.Stars >= 41) Points += 100;
if (item.Stars >= 42) Points += 100;
if (item.Stars >= 43) Points += 100;
if (item.Stars >= 44) Points += 100;
if (item.Stars >= 45) Points += 100;
if (item.Stars >= 46) Points += 100;
if (item.Stars >= 47) Points += 100;
if (item.Stars >= 48) Points += 100;
if (item.Stars >= 49) Points += 100;
if (item.Stars >= 50) Points += 100;
if (item.Stars >= 51) Points += 100;
if (item.Stars >= 52) Points += 100;
if (item.Stars >= 53) Points += 100;
if (item.Stars >= 54) Points += 100;
}
}
return Points;
}
}
public uint GetFullEquipmentSocketPoints
{
get
{
uint val = 0;
foreach (Network.GamePackets.ConquerItem item in Objects)
{
if (item == null) continue;
if (item.Position > 19 || item.Position == 7 || item.Position == 9 || item.Position == 15 || item.Position == 16 || item.Position == 17) continue;
if (!Network.PacketHandler.IsTwoHand(item.ID))
{
if (item.SocketOne != (Game.Enums.Gem)0) val += 1000;
if (item.SocketTwo != (Game.Enums.Gem)0) val += 2500;
}
else
{
if (item.SocketOne != (Game.Enums.Gem)0) val += 2000;
if (item.SocketTwo != (Game.Enums.Gem)0) val += 5000;
}
}
return val;
}
}
public uint GetFullEquipmentBlessPoints
{
get
{
uint val = 0;
foreach (Network.GamePackets.ConquerItem item in Objects)
{
if (item == null) continue;
if (item.Position > 19 || item.Position == 7 || item.Position == 9 || item.Position == 15 || item.Position == 16 || item.Position == 17) continue;
if (!Network.PacketHandler.IsTwoHand(item.ID))
{
val += (uint)(item.Bless * 100);
}
else
{
val += (uint)(item.Bless * 200);
}
}
return val;
}
}
public uint GetFullEquipmentRefinePoints
{
get
{
uint val = 0;
foreach (Network.GamePackets.ConquerItem item in Objects)
{
if (item == null || !item.ExtraEffect.Available) continue;
if (item.Position > 19 || item.Position == 7 || item.Position == 9 || item.Position == 15 || item.Position == 16 || item.Position == 17) continue;
if (!Network.PacketHandler.IsTwoHand(item.ID))
{
if (item.ExtraEffect.EffectLevel == 1) val += 100;
if (item.ExtraEffect.EffectLevel == 2) val += 400;
if (item.ExtraEffect.EffectLevel == 3) val += 800;
if (item.ExtraEffect.EffectLevel == 4) val += 1200;
if (item.ExtraEffect.EffectLevel == 5) val += 1600;
if (item.ExtraEffect.EffectLevel == 6) val += 2000;
}
else
{
if (item.ExtraEffect.EffectLevel == 1) val += 200;
if (item.ExtraEffect.EffectLevel == 2) val += 800;
if (item.ExtraEffect.EffectLevel == 3) val += 1600;
if (item.ExtraEffect.EffectLevel == 4) val += 2400;
if (item.ExtraEffect.EffectLevel == 5) val += 3200;
if (item.ExtraEffect.EffectLevel == 6) val += 4000;
}
}
return val;
}
}
public ushort TotalPerfectionLevel
{
get
{
ushort Count = 0;
foreach (Network.GamePackets.ConquerItem item in Objects)
{
if (item == null) continue;
if (item.Position > 19 || item.Position == 7 || item.Position == 9 || item.Position == 15 || item.Position == 16 || item.Position == 17) continue;
Count += (ushort)(Network.PacketHandler.IsTwoHand(item.ID) ? item.Stars * 2 : item.Stars);
}
return Count;
}
}
#endregion

أفتح Guild.cs
و أبحث فيه علي الكود ده

public void SendMembers

أنزل فيه شوية لحد الكود ده

wtr.Write((uint)0); // unknown

تحتيه علي طول حط الكود ده

if (member.IsOnline) wtr.Write((uint)Client.GameState.GetClientFromID(member.ID).Entity.TotalPerfectionScore);
else
{
if (MsgUserAbilityScore.RankingList.Where(i => i.UID == member.ID).Count() != 0)
{
wtr.Write((uint)MsgUserAbilityScore.RankingList.Where(i => i.UID == member.ID).FirstOrDefault().TotalPerfectionScore);
}
else
{
wtr.Write((uint)0);
}
}

افتح MysqlCommand.cs
و ابحث علي الكود ده

#region And

تحتيه ده

public MySqlCommand And(string column, long value, bool greater) 
{ 
if (greater) 
_command = _command.Append(" AND `" + column + "` > " + value); 
else 
_command = _command.Append(" AND `" + column + "` < " + value); 
return this; 
}

أفتح Entity.cs
حط فيه دول في أي حتة عندك

#region Perfection
public Time32 DivineGuardStamp, ShieldBreakStamp;
public uint totalperfectionscore_ = 0;
public uint TotalPerfectionScore
{
get
{
if (Owner == null) return totalperfectionscore_;
uint points = 0;
points += Owner.Equipment.GetFullEquipmentEnumPoints;
points += Owner.Equipment.GetFullEquipmentSocketPoints;
points += Owner.Equipment.GetFullEquipmentGemPoints;
points += Owner.Equipment.GetFullEquipmentPlusPoints;
points += Owner.Equipment.GetFullEquipmentBlessPoints;
points += Owner.Equipment.GetFullEquipmentRefinePoints;
points += Owner.Equipment.GetFullEquipmentSoulPoints;
points += Owner.Equipment.GetFullEquipmentEnchantPoints;
points += Owner.Equipment.GetFullEquipmentPerfecetionLevelPoints;
points += Owner.Equipment.GetFullEquipmentLevelPoints;
points += (uint)MsgUserAbilityScore.CalculatePerfectionChiPoints(Owner);
points += (uint)MsgUserAbilityScore.CalculatePerfectionJiangPoints(Owner);
points += (uint)((Vitality + Spirit + Strength + Agility + Atributes) * 5);
points += (uint)(Level < 145 ? Level * 20 : Level * 25);
if (InnerPower != null) points += InnerPower.TotalScore * 2;
points += (uint)((uint)NobilityRank * 1000);
points += (uint)(Reborn * 1000);
points += (StorageItem.PerfectionPoints(Owner, true));
points += (StorageItem.PerfectionPoints(Owner, true));
points += (uint)(MsgUserAbilityScore.CalculateSubClassPoints(Owner));
return points;
}
set
{
totalperfectionscore_ = value;
}
}
#endregion

أفتح Enums.cs
أبحث علي الكود ده

public static class Enums

تحت الكوس ضيف ده

public enum PerfectionEffect : byte
{
ToxinEarser = 1,
Stricklock,
LuckyStrike,
CalmWind,
DrainingTouch,
BloodSpawn,
LightofStamina,
ShieldBreak,
KillingFlash,
MirrorofSin,
DivineGuard,
CoreStrike,
InvisibleArrow,
FreeSoul,
StraightLife,
AbsoluteLuck
}

و أبحث علي الكود ده

public enum ItemMode : byte

ضيف فيه ده

PerfectionView = 13,

أفتح BoothItem2.cs
ملحوظة صغيرة الملف ده فيه كلاسين اللي هما ( BoothItem – BoothItem2 )
الاكود اللي جاية دية في كلاس BoothItem2
أبحث علي الكود ده

TimeLeftInMinutes = i.TimeLeftInMinutes;

تحتيه ضيف دول

Signature = i.Signature;
Stars = i.Stars;
PerfectionProgress = i.PerfectionProgress;
OwnerUID = i.OwnerUID;
Owner = i.Owner;

أبحث علي الكود ده

public string TradeName

ضيف فوقيه علي طول دول

public byte Stars
{
get { return mData[82]; }
set { mData[82] = value; }
}
public uint OwnerUID
{
get { return BitConverter.ToUInt32(mData, 90); }
set { Writer.Write(value, 90, mData); }
}
public string Owner
{
get { return System.Text.Encoding.Default.GetString(mData, 94, 16); }
set { Writer.Write(value, 94, mData); }
}
public string Signature
{
get { return System.Text.Encoding.Default.GetString(mData, 110, 36); }
set { Writer.Write(value, 110, mData); }
}
public uint PerfectionProgress
{
get { return BitConverter.ToUInt32(mData, 86); }
set { Writer.Write(value, 86, mData); }
}

الاكواد اللي جاية دية في كلاس BoothItem
أبحث علي الكود ده

public string TradeName

فوقيه حط دول

 public byte Stars
{
get { return Buffer[82]; }
set { Buffer[82] = value; }
}
public uint OwnerUID
{
get { return BitConverter.ToUInt32(Buffer, 90); }
set { Writer.Write(value, 90, Buffer); }
}
public string Owner
{
get { return System.Text.Encoding.Default.GetString(Buffer, 94, 16); }
set { Writer.Write(value, 94, Buffer); }
}
public string Signature
{
get { return System.Text.Encoding.Default.GetString(Buffer, 110, 36); }
set { Writer.Write(value, 110, Buffer); }
}
public uint PerfectionProgress
{
get { return BitConverter.ToUInt32(Buffer, 86); }
set { Writer.Write(value, 86, Buffer); }
}

و بعدين ابحث علي الكود ده

TimeLeftInMinutes = item.Item.TimeLeftInMinutes;

حط تحتيه دول

Signature = item.Item.Signature;
Stars = item.Item.Stars;
PerfectionProgress = item.Item.PerfectionProgress;
OwnerUID = item.Item.OwnerUID;
Owner = item.Item.Owner;

و بعدين أبحث تاني علي الكود ده هتلاقيه في الاخر

TimeLeftInMinutes = item.TimeLeftInMinutes;

ضيف دول تحتيه برده

Signature = item.Signature;
Stars = item.Stars;
PerfectionProgress = item.PerfectionProgress;
OwnerUID = item.OwnerUID;
Owner = item.Owner;

أفتح كلاس ConquerItem.cs
حط فيه دول

ulong minutes = 0;
public ulong Minutes
{
get
{
return minutes;
}
set
{
minutes = value;
Database.ConquerItemTable.UpdateMinutes(this);
}
}
DateTime timestamp;
public DateTime TimeStamp
{
get
{
return timestamp;
}
set
{
timestamp = value;
Database.ConquerItemTable.UpdateTimeStamp(this);
}
}
public ConquerItem DeepCopy()
{
return new ConquerItem(true)
{
Stars = Stars,
PerfectionProgress = PerfectionProgress,
Owner = Owner,
OwnerUID = OwnerUID,
Signature = Signature
};
}
public byte Stars
{
get { return Buffer[72]; }
set { Buffer[72] = value; }
}
public uint OwnerUID
{
get { return BitConverter.ToUInt32(Buffer, 80); }
set { Writer.Write(value, 80, Buffer); }
}
public uint PerfectionProgress
{
get { return BitConverter.ToUInt32(Buffer, 76); }
set { Write(value, 76, Buffer); }
}
public string Owner
{
get { return System.Text.Encoding.Default.GetString(Buffer, 84, 16); }
set { Writer.Write(value, 84, Buffer); }
}
public string Signature
{
get { return System.Text.Encoding.Default.GetString(Buffer, 100, 32); }
set { Writer.Write(value, 100, Buffer); }
} 
public byte SocketOne2
{
get { return Buffer[24]; }
}
public byte SocketTwo2
{
get { return Buffer[25]; }
}

أفتح PacketHandler.cs
ابحث علي الكود ده

public static void HandlePacket

انزل فيه شوية لحد الكود ده

switch (ID)

تحت الكوس ضيف ده

#region Perfection
case 3256:
{
var pkt = new MsgEquipRefineRank();
var myPacket = new byte[packet.Length - 8];
for (int i = 0; i < myPacket.Length; i++)
{
myPacket[i] = packet[i];
}
if (pkt.Read(myPacket))
pkt.Handle(client);
break;
}
case 3253:
{
var pkt = new MsgUserAbilityScore();
var myPacket = new byte[packet.Length - 8];
for (int i = 0; i < myPacket.Length; i++)
{
myPacket[i] = packet[i];
}
if (pkt.Read(myPacket))
pkt.Handle(client);
break;
}
case 3255:
{
var pkt = new MsgItemRefineRecord();
var myPacket = new byte[packet.Length - 8];
for (int i = 0; i < myPacket.Length; i++)
{
myPacket[i] = packet[i];
}
if (pkt.Read(myPacket))
pkt.Handle(client);
/* var packet2 = new byte[myPacket.Length - 4];
Array.Copy(myPacket, 4, packet2, 0, packet2.Length);
var variable = Kernel.Read7BitEncodedInt(packet2).SelectMany(BitConverter.GetBytes).ToArray();
Console.WriteLine(PacketHandler.DumpPacket(variable));*/
break;
}
case 3251:
{
var pkt = new MsgItemRefineOpt();
var myPacket = new byte[packet.Length - 8];
for (int i = 0; i < myPacket.Length; i++)
{
myPacket[i] = packet[i];
}
if (pkt.Read(myPacket))
pkt.Handle(client, myPacket);
break;
}
#endregion

و حط الكود ده تحت اي فويد ولو عندك بدله

public static byte[] WindowStats(Client.GameState client)
{
Byte[] Data = new Byte[148];
Writer.WriteUInt16((UInt16)(Data.Length - 8), 0, Data);
Writer.WriteUInt16((UInt16)1040, 2, Data);
Writer.WriteUInt32(client.Entity.UID, 8, Data);
Writer.WriteUInt32(client.Entity.MaxHitpoints, 12, Data);
Writer.WriteUInt32((UInt32)client.Entity.MaxMana, 16, Data);
Writer.WriteUInt32((UInt32)client.Entity.MinAttack, 24, Data);
Writer.WriteUInt32((UInt32)client.Entity.MaxAttack, 20, Data);
Writer.WriteUInt32((UInt32)client.Entity.Defence, 28, Data);
Writer.WriteUInt32((UInt32)client.Entity.MagicAttack, 32, Data);
Writer.WriteUInt32((UInt32)client.Entity.MagicDefence, 36, Data);
Writer.WriteUInt32((UInt32)client.Entity.Dodge, 40, Data);
Writer.WriteUInt32((UInt32)client.AgilityItem, 44, Data);
Writer.WriteUInt32((UInt32)client.Accuracy, 48, Data);
Writer.WriteUInt32((UInt32)client.Entity.Gems[1], 52, Data);
Writer.WriteUInt32((UInt32)client.Entity.Gems[0], 56, Data);
Writer.WriteUInt32((UInt32)client.MagicDefence, 60, Data);
Writer.WriteUInt32((UInt32)client.Entity.Gems[7], 64, Data);
Writer.WriteUInt32((UInt32)((1 - client.Entity.ItemBless) * 100), 68, Data);
Writer.WriteUInt32((UInt32)client.Entity.CriticalStrike, 72, Data);
Writer.WriteUInt32((UInt32)client.Entity.SkillCStrike, 76, Data);
Writer.WriteUInt32((UInt32)client.Entity.Immunity, 80, Data);
Writer.WriteUInt32((UInt32)client.Entity.Penetration, 84, Data);
Writer.WriteUInt32((UInt32)client.Entity.Block, 88, Data);
Writer.WriteUInt32((UInt32)client.Entity.Breaktrough, 92, Data);
Writer.WriteUInt32((UInt32)client.Entity.Counteraction, 96, Data);
Writer.WriteUInt32((UInt32)client.Entity.Detoxication, 100, Data);
Writer.WriteUInt32((UInt32)client.Entity.PhysicalDamageIncrease, 104, Data);
Writer.WriteUInt32((UInt32)client.Entity.MagicDamageIncrease, 108, Data);
Writer.WriteUInt32((UInt32)client.Entity.PhysicalDamageDecrease, 112, Data);
Writer.WriteUInt32((UInt32)client.Entity.MagicDamageDecrease, 116, Data);
Writer.WriteUInt32((UInt32)client.Entity.MetalResistance, 120, Data);
Writer.WriteUInt32((UInt32)client.Entity.WoodResistance, 124, Data);
Writer.WriteUInt32((UInt32)client.Entity.WaterResistance, 128, Data);
Writer.WriteUInt32((UInt32)client.Entity.FireResistance, 132, Data);
Writer.WriteUInt32((UInt32)client.Entity.EarthResistance, 136, Data);
Writer.WriteUInt32((UInt32)client.Equipment.TotalPerfectionLevel, 140, Data);
return Data;
}

و بعدين ابحث علي الكود ده

void EquipItem

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

new MsgUserTotalRefineLev().Send(client);

و ابحث علي الكود ده

void UnequipItem

حط ده برده نفس الحكاية قبل أخر كوسين

new MsgUserTotalRefineLev().Send(client);

في نفس الملف ابحث علي ده

void LoginMessages

تحت الكوس حط ده

#region Perfection
new MsgUserAbilityScore().SendScore(client, client);
new MsgItemRefineRecord().Send(client);
#endregion

هتفتح Program.cs
و أبحث فيه علي ده

InnerPowerTable.Load();

حط تحتيه دول

Database.PerfectionTable.Load();
new MsgUserAbilityScore().GetRankingList();
new MsgEquipRefineRank().UpdateRanking();

افتح World.cs
أبحث علي الكود ده

#region ToxicFog

و انزل لحد الكود ده

if (client.Entity.Hitpoints > 1)

و بدله بدول لحد اخر كلمة

if (client.Entity.Hitpoints > 1)
{
uint damage = Game.Attacking.Calculate.Percent(client.Entity, Percent);
uint value = 100;
if (client.Equipment.TotalPerfectionLevel >= 1) value -= 30;
if (client.Equipment.TotalPerfectionLevel >= 45) value -= 5;
if (client.Equipment.TotalPerfectionLevel >= 85) value -= 5;
if (client.Equipment.TotalPerfectionLevel >= 110) value -= 5;
if (client.Equipment.TotalPerfectionLevel >= 145) value -= 5;
if (client.Equipment.TotalPerfectionLevel >= 185) value -= 10;
if (client.Equipment.TotalPerfectionLevel >= 200) value -= 10;
if (client.Equipment.TotalPerfectionLevel >= 230) value -= 10;
if (client.Equipment.TotalPerfectionLevel >= 260) value -= 10;
if (client.Equipment.TotalPerfectionLevel >= 300) value -= 10;
damage = (damage / 100) * value;
client.Entity.Hitpoints -= damage;

أبحث علي الكود ده

private void ServerFunctions(int time)

حط فوقيه الكود ده

DateTime LastPerfectionSort = DateTime.Now;

و بعدين حط تحت الكوس بتاع الكود اللي فوق دول

if (DateTime.Now >= LastPerfectionSort.AddMinutes(1))
{
LastPerfectionSort = DateTime.Now;
new MsgUserAbilityScore().GetRankingList();
new MsgEquipRefineRank().UpdateRanking();
}

هتفتح النافي كات جدول ( entities –> Design Table )
حط فيه العمود ده

TotalPerfectionScore    bigint    255    0    0    0    0    0    0    0    0

زي الصورة دية

و بعدين خش علي جدول ( items –> Design Table )
حط فيه العواميد دية بالترتيب و خد حظرك علشان الغلطة بفورة

PerfectionProgress    bigint    255    0    0    0    0    0    0        0                    0    0 
Stars    bigint    255    0    0    0    0    0    0        0                    0    0 
Owner    varchar    16    0    0    0    0    0    0        0        utf8    utf8_general_ci        0    0 
OwnerUID    bigint    255    0    0    0    0    0    0        0                    0    0 
Signature    varchar    16    0    0    0    0    0    0        0        utf8    utf8_general_ci        0    0 
TimeStamp    bigint    255    0    -1    0    0    0    0        0                    0    0 
MinutesLeft    bigint    255    0    -1    0    0    0    0        0                    0    0

زي الصورة دية

ملحوظة صغيرة العمودين اللي قدامهم رقم ( 16 ) هتعمله زي ما موجود في الصورة بالظبط
هتدخل علي المسار ده bin\Debug\database
و تحط فيه الملفات دية من الرابط ده

كده خلصنا من البرفكشن
النتيجة

بالتوفيق للجميع
(((( ~~~~~ XD ~~~~~ ))))

5 thoughts on “أضافة البرفكشن كامل 100%”

أضف تعليق

قوانين المدونة & عن تيم تهيس