|
|
new msguserabilityscore().getrankinglist();
new msgequiprefinerank().updateranking();
new msgrankmembershow().updatebestplayer();
public unsafe class MsgRankMemberShow : Writer
{
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 UpdateBestPlayer()
{
Stuff = new Dictionary<string, uint>();
BestPlayer = Network.GamePackets.MsgUserAbilityScore.RankingList.OrderByDescending(i => i.Prestige).ThenByDescending(i => i.Level).ThenBy(i => i.UID).FirstOrDefault();
if (BestPlayer == null) return;
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("items").Where("EntityID", BestPlayer.UID).And("Position", 0, true))
using (var reader = new MySqlReader(cmd))
{
while (reader.Read())
{
if (reader.ReadByte("Position") == 5) Stuff.Add(GetPositionName(5), reader.ReadUInt32("ID"));
if (reader.ReadByte("Position") == 9) if (!Stuff.ContainsKey(GetPositionName(9))) Stuff.Add(GetPositionName(9), reader.ReadUInt32("ID"));
if (reader.ReadByte("Position") == 4) Stuff.Add(GetPositionName(4), 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", BestPlayer.UID).And("Position", 0, true))
using (var reader2 = new MySqlReader(cmd2))
{
while (reader2.Read())
{
}
}
}
}
}
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.Player BestPlayer;
public void Handle(Client.GameState client)
{
if (BestPlayer == 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 = BestPlayer.UID;
//proto2.proto.HairStyle = BestPlayer.HairStyle;
proto2.proto.Mesh = BestPlayer.Mesh;
proto2.proto.Name = BestPlayer.Name;
if (BestPlayer.GuildID != 0)
proto2.proto.Guild = Kernel.Guilds[BestPlayer.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.RightWep = Stuff.Where(i => i.Key == "RightWep").FirstOrDefault().Value;
proto2.proto.RightWepAcc = Stuff.Where(i => i.Key == "RightWepAcc").FirstOrDefault().Value;
proto2.proto.WingLevel = Stuff.Where(i => i.Key == "WingLevel").FirstOrDefault().Value;
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("entities").Where("UID", BestPlayer.UID))
using (var reader = new MySqlReader(cmd))
{
while (reader.Read())
{
proto2.proto.HairStyle = reader.ReadUInt32("HairStyle");
//Console.WriteLine(proto2.proto.HairStyle + " and " + BestPlayer.HairStyle);
proto2.proto.Wing = reader.ReadUInt32("WingID");
proto2.proto.Title = reader.ReadUInt32("TitleID");
}
}
//if (Kernel.GamePool.ContainsKey(BestPlayer.UID))
//{
// proto2.proto.Flag = (uint)Kernel.GamePool[BestPlayer.UID].Entity.StatusFlag;
// proto2.proto.Flag2 = (uint)Kernel.GamePool[BestPlayer.UID].Entity.StatusFlag2;
// proto2.proto.Flag3 = (uint)Kernel.GamePool[BestPlayer.UID].Entity.StatusFlag3;
// proto2.proto.Flag4 = (uint)Kernel.GamePool[BestPlayer.UID].Entity.StatusFlag4;
//}
client.Send(Kernel.FinalizeProtoBuf(proto2, 3257));
break;
}
case 1:
{
if (Kernel.GamePool.ContainsKey(Info.proto == null ? 0 : Info.proto.dwParam))
{
PacketHandler.ObserveEquipment(new MsgActionProto() { 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 uint Prestige
{
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 < 140 ? Level * 20 : Level * 25);
if (InnerPower != null) points += InnerPower.TotalScore * 2;
points += (uint)((uint)NobilityRank * 1000);
points += (uint)(Reborn * 1000);
points += (Database.StorageItem.PerfectionPoints(Owner, true));
points += (Database.StorageItem.PerfectionPoints(Owner, false));
points += (uint)(MsgUserAbilityScore.CalculateSubClassPoints(Owner));
return points;
}
set
{
totalperfectionscore_ = value;
}
}
DateTime LastPerfectionSort = DateTime.Now;
new MsgUserAbilityScore().GetRankingList();
new MsgEquipRefineRank().UpdateRanking();
new MsgRankMemberShow().UpdateBestPlayer();
PrestigeRank.LoadRanking();
MsgRankMemberShow().UpdateBestPlayer();
|
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
سورس Immortals صعب مقدم من احمد فتحي | ahmedfathy | سورسات كونكر | 176 | 2024-11-07 03:41 PM |
سورس Immortals | Adel Abd El Hay | الطلبات المدفوعه | 21 | 2024-07-08 09:17 PM |
مشكله ف البوكر سورس ريزو مشكله رخمه اوى | bosha1 | مشكلات السيرفيرات كونكر الشخصيه | 3 | 2020-02-18 07:25 PM |
مشكله فى سورس | taha | مشكلات السيرفيرات كونكر الشخصيه | 4 | 2019-12-08 09:11 PM |
مشكله سورس | taha | مشكلات السيرفيرات كونكر الشخصيه | 3 | 2019-12-07 05:33 PM |