|
|
المشاركات 104 |
+التقييم 0.05 |
تاريخ التسجيل Jul 2019 |
الاقامة |
نظام التشغيل |
رقم العضوية 443 |
LoginMessages(
new MsgUserAbilityScore().SendScore(client, client);
new MsgItemRefineRecord().Send(client);
#region MsgUserAbilityScore
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;
}
#endregion
#region MsgPrestigeRanking
case 3257:
{
var pkt = new MsgRankMemberShow();
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;
}
#endregion
public static void EquipItem(
new MsgUserAbilityScore().GetRankingList();
new MsgEquipRefineRank().UpdateRanking();
public static void UnequipItem(
new MsgUserAbilityScore().GetRankingList();
new MsgEquipRefineRank().UpdateRanking();
private void ServerFunctions(
if (DateTime.Now >= LastPerfectionSort.AddHours(1))
{
new MsgUserAbilityScore().GetRankingList();
new MsgEquipRefineRank().UpdateRanking();
new MsgRankMemberShow().UpdateBestEntity();
}
Database.EShopFile.Load();
new MsgUserAbilityScore().GetRankingList();
new MsgEquipRefineRank().UpdateRanking();
new MsgRankMemberShow().UpdateBestEntity();
namespace Asm el source.Network.GamePackets
{
public 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 ConcurrentDictionary<uint, Game.Entity> RankingList;
public void GetRankingList()
{
RankingList = new ConcurrentDictionary<uint, Game.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.Entity, 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.GuildID = reader.ReadUInt16("GuildID");
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>(type, id);
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>(type2, id2);
}
}
RankingList.Add(client.UID, 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<MsgUserAbilityScoreProto>(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 < 140 ? client.Entity.Level * 20 : 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.GetFullEquipmentRefinePoints;
if (Type == 13) Score = client.Equipment.GetFullEquipmentPlusPoints;
if (Type == 14) Score = client.Equipment.GetFullEquipmentSoulPoints;
if (Type == 15) Score = client.Equipment.GetFullEquipmentBlessPoints;
if (Type == 16) Score = CalculateSubClassPoints(client);
if (Type == 17) Score = Database.WardrobeTable.PerfectionPoints(client, true);
if (Type == 18) Score = Database.WardrobeTable.PerfectionPoints(client, false);
if (Type == 19) Score = (uint)((uint)client.Entity.NobilityRank * 1000);
if (Type == 20) Score = client.Equipment.GetFullEquipmentLevelPoints;
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 == null || client.ChiData == null || client.ChiData.Powers == 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 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 <= 16200) Points = (int)(client.Entity.MyJiang.Inner_Strength * 0.3);
else if (client.Entity.MyJiang.Inner_Strength <= 40500) Points = (int)(client.Entity.MyJiang.Inner_Strength * 0.33);
else if (client.Entity.MyJiang.Inner_Strength <= 60750) Points = (int)(client.Entity.MyJiang.Inner_Strength * 0.36);
else if (client.Entity.MyJiang.Inner_Strength <= 72000) Points = (int)(client.Entity.MyJiang.Inner_Strength * 0.40);
else if (client.Entity.MyJiang.Inner_Strength <= 79200) Points = (int)(client.Entity.MyJiang.Inner_Strength * 0.45);
else if (client.Entity.MyJiang.Inner_Strength <= 80800) Points = (int)(client.Entity.MyJiang.Inner_Strength * 0.50);
else if (client.Entity.MyJiang.Inner_Strength <= 81000) Points = (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 == 9 ? 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 == 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 Stars
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 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 Flag;
[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 Flag2;
[ProtoMember(20, IsRequired = true)]
public uint Flag3;
[ProtoMember(21, IsRequired = true)]
public uint Flag4;
}
public void UpdateBestEntity()
{
DateTime StartTime = DateTime.Now;
Items = new Dictionary<byte, uint>();
BestEntity = MsgUserAbilityScore.RankingList.OrderByDescending(i => i.Value.TotalPerfectionScore).ThenByDescending(i => i.Value.Level).ThenBy(i => i.Value.UID).FirstOrDefault().Value;
if (BestEntity == null) return;
byte[] Positions = new byte[10] { 1, 3, 4, 5, 9, 12, 15, 16, 17, 19 };
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(pos, reader.ReadUInt32("ID"));
if (pos == 19) Items.Add(255, reader.ReadByte("Plus"));
break;
}
}
}
}
foreach (var pos in Positions)
{
if (!Items.ContainsKey(pos)) Items.Add(pos, 0);
}
if (!Items.ContainsKey(255)) Items.Add(255, 0);
}
public static Dictionary<byte, uint> Items = new Dictionary<byte, uint>();
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;
}
else
{
proto2.proto.Guild = "KhaledMohamed";
}
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 == 0 ? (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(proto2, 3257));
break;
}
#endregion
proto2.proto.HairStyle = BestEntity.HairStyle;
proto2.proto.Mesh = BestEntity.Mesh;
proto2.proto.Name = BestEntity.Name;
if (BestEntity.GuildID != 0 && 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] == 0 ? 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 == 0 ? Items[(byte)ConquerItem.Wing] : (uint)BestEntity.EquippedWing;
proto2.proto.WingLevel = Items[255];
proto2.proto.Title = (uint)BestEntity.EquippedTitle;
client.Send(Kernel.FinalizeProtoBuf(proto2, 3257));
break;
}
case 1:
{
if (Kernel.GamePool.ContainsKey(Info.proto == null ? 0 : Info.proto.dwParam))
{
PacketHandler.ObserveEquipment(new Data(true) { ID = 117, UID = client.Entity.UID, dwParam = Info.proto == null ? 0 : Info.proto.dwParam }, client);
}
else
{
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<MsgRankMemberShowProto>(memoryStream, PrefixStyle.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(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 Stars;
[ProtoMember(10, IsRequired = true)]
public string Name = "";
[ProtoMember(11, IsRequired = 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 SafeDictionary<byte, ConquerItem> MainRank;
public void UpdateRanking()
{
AllItemsRanking = new List<ConquerItem>();
MainRank = new SafeDictionary<byte, ConquerItem>();
for (byte i = 0; i < 11; i++)
{
byte z = GetRealyPosition((byte)(i + 1));
List<ConquerItem> items = new List<ConquerItem>();
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<ConquerItem> 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].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(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].Stars = 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.Perfection;
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 = 0; i < sss; i++)
{
var iteeeem = AllItemsRanking.Where(p => p.Position == GetRealyPosition((byte)Info.Index)).OrderByDescending(x => MsgUserAbilityScore.CalculatePerfectionItemPoints(x)).ToArray()[i + rank];
packet.items[i] = new EquipProto();
packet.items[i].ItemID = iteeeem.ID;
packet.items[i].Name = iteeeem.Owner.Replace("/0", "");
packet.items[i].Stars = 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 + rank);
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].Stars = 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<MsgEquipRefineRankProto>(memoryStream, PrefixStyle.Fixed32);
}
return true;
}
}
|
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
برنامج فك تشفير ملفات كونكر اخر اصدار .dat | Tefa | البرامج والودرات | 211 | يوم أمس 11:01 PM |
برنامج فك تشفير وتشفير ملفات dat | محمد ياسر | البرامج والودرات | 255 | 2024-11-19 12:12 PM |
التعديل علي ملفات c3 | محمد ياسر | تطوير سيرفرات كونكر | 88 | 2024-11-15 03:45 PM |
شكل جديد لل gui + ملفات مفتوحة للتعديل psd | AbuMaryam | تطوير سيرفرات كونكر | 79 | 2024-08-28 04:29 PM |
الفرق بين ملفات html و php و mysql و mysqli | محمد ياسر | صفحات التسجيل كونكر اونلاين | 3 | 2023-08-13 01:33 PM |