|
المشاركات 2,515 |
+التقييم 1.28 |
تاريخ التسجيل Jul 2019 |
الاقامة |
نظام التشغيل |
رقم العضوية 358 |
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 VirusX;
using VirusX.Database;
using System.Threading.Tasks;
namespace VirusX.Network.GamePackets
{
public class MsgBossHarmRanking
{
public MsgBossHarmRanking() { }
public MsgBossHarmRankingProto Info;
[ProtoContract]
public class MsgBossHarmRankingProto
{
[ProtoMember(1, IsRequired = true)]
public uint Type;
[ProtoMember(2, IsRequired = true)]
public uint BossUID;
[ProtoMember(3, IsRequired = true)]
public Hunter[] Hunters;
}
[ProtoContract]
public class Hunter
{
[ProtoMember(1, IsRequired = true)]
public uint Rank;
[ProtoMember(2, IsRequired = true)]
public uint ServerID;
[ProtoMember(3, IsRequired = true)]
public uint UID;
[ProtoMember(4, IsRequired = true)]
public string Name;
[ProtoMember(5, IsRequired = true)]
public uint Damage;
}
public bool Read(byte[] packet)
{
using (var memoryStream = new MemoryStream(packet))
{
Info = Serializer.DeserializeWithLengthPrefix<MsgBossHarmRankingProto>(memoryStream, PrefixStyle.Fixed32);
}
return true;
}
public void Ready(VirusX.Client.GameState client)
{
var proto = new MsgBossHarmRankingProto();
proto.BossUID = Info.BossUID;
proto.Type = 1;
/* var scores = client.Map.Entities.Where(i => i.Key == proto.BossUID).FirstOrDefault().Value.MonsterInfo.Score.OrderByDescending(i => i.Value).ToArray();
if (scores.Length != 0)
{
proto.Hunters = new Hunter[scores.Length];
for (int i = 0; i < proto.Hunters.Length; i++)
{
proto.Hunters[i] = new Hunter();
proto.Hunters[i].UID = scores[i].Key.UID;
proto.Hunters[i].Name = scores[i].Key.Name;
proto.Hunters[i].Damage = scores[i].Value;
proto.Hunters[i].ServerID = scores[i].Key.ServerID;
proto.Hunters[i].Rank = (uint)(i + 1);
}
} */
client.Send(Kernel.FinalizeProtoBuf(proto, 1044));
//client.Send(Kernel.FinalizeProtoBuf(Info, 3282));
}
public void Handle(VirusX.Client.GameState client)
{
switch (Info.Type)
{
case 0:
{
var proto = new MsgBossHarmRankingProto();
proto.BossUID = Info.BossUID;
proto.Type = 1;
var scores = client.Map.Entities.Where(i => i.Key == proto.BossUID).FirstOrDefault().Value.MonsterInfo.Score.OrderByDescending(i => i.Value).ToArray();
if (scores.Length != 0)
{
proto.Hunters = new Hunter[scores.Length];
for (int i = 0; i < proto.Hunters.Length; i++)
{
proto.Hunters[i] = new Hunter();
proto.Hunters[i].UID = scores[i].Key.UID;
proto.Hunters[i].Name = scores[i].Key.Name;
proto.Hunters[i].Damage = scores[i].Value;
proto.Hunters[i].ServerID = scores[i].Key.ServerID;
proto.Hunters[i].Rank = (uint)(i + 1);
}
}
client.Send(Kernel.FinalizeProtoBuf(proto, 1044));
break;
}
}
}
}
}
#region MsgBossHarmRanking
case 1044:
{
var pkt = new VirusX.Network.GamePackets.MsgBossHarmRanking();
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 Dictionary<Game.Entity, uint> Score = new Dictionary<Game.Entity, uint>();
#region Monster Score
if (monster.EntityFlag == EntityFlag.Monster)
{
//if (attacked.Boss > 0)
{
if (monster.MonsterInfo != null)
{
if (monster.MonsterInfo.Score.ContainsKey(client.Entity))
monster.MonsterInfo.Score[client.Entity] += obj.Damage;
else monster.MonsterInfo.Score.Add(client.Entity, obj.Damage);
//new VirusX.Network.GamePackets.MsgBossHarmRanking().Ready(attacker.Owner);
}
}
}
if (monster.EntityFlag == EntityFlag.Monster)
{
//if (attacked.Boss > 0)
{
if (monster.MonsterInfo != null)
{
if (monster.MonsterInfo.Score.ContainsKey(client.Entity))
monster.MonsterInfo.Score[client.Entity] += obj.Damage;
else monster.MonsterInfo.Score.Add(client.Entity, obj.Damage);
//new VirusX.Network.GamePackets.MsgBossHarmRanking().Ready(attacker.Owner);
}
}
}
if (monster.EntityFlag == EntityFlag.Monster)
{
//if (attacked.Boss > 0)
{
if (monster.MonsterInfo != null)
{
if (monster.MonsterInfo.Score.ContainsKey(client.Entity))
monster.MonsterInfo.Score[client.Entity] += obj.Damage;
else monster.MonsterInfo.Score.Add(client.Entity, obj.Damage);
//new VirusX.Network.GamePackets.MsgBossHarmRanking().Ready(attacker.Owner);
}
}
}
// * Created by CptSky
// * Copyright © 2011
// * COPS v6 Emulator - Project
using System;
using CO2_CORE_DLL.IO;
using AbdoRedaGxV4.Game;
using AbdoRedaGxV4.Database;
using AbdoRedaGxV4.Network.GamePackets;
using AbdoRedaGxV4;
using AbdoRedaGxV4.Game.Attacking;
using System.Collections.Generic;
namespace AbdoRedaGxV4
{
public partial class MyMath
{
public static Int32 GetDamageEntity2Monster(Entity Attacker, Entity Monster, uint AtkType, ref Attack Packet)
{
Double Damage = 0;
switch (AtkType)
{
case Attack.Melee:
{
if (!Attacker.Transformed)
Damage = MyMath.Generate(Attacker.MinAttack, Attacker.MaxAttack);
else
Damage = MyMath.Generate(Attacker.TransformationMinAttack, Attacker.TransformationMaxAttack);
AbdoRedaGxV4.Game.Attacking.Calculate.Refinary(Attacker, Monster, ref Damage, ref Packet, false);
// Damage += Attacker.getFan(false);
Damage = Attacker.AdjustAttack((int)Damage);
var bonus = Attacker.Gems[GemTypes.Dragon];
if (bonus > 0)
Damage += MathHelper.MulDiv((int)Damage, bonus, 100);
Damage = AdjustDamageEntity2Monster(Damage, Attacker, Monster);
Damage -= Monster.Defence;
break;
}
case Attack.Magic:
{
Damage = Attacker.MagicAttack;
Damage = AdjustDamageEntity2Monster(Damage, Attacker, Monster);
AbdoRedaGxV4.Game.Attacking.Calculate.Refinary(Attacker, Monster, ref Damage, ref Packet, true);
Damage *= ((Double)(100 - Monster.MagicDefence) / 100);
Damage -= Monster.Block;
Damage *= 0.75;
Damage += Attacker.MagicDamageIncrease;
Damage -= Monster.MagicDamageDecrease;
var effect = Attacker.Gems[GemTypes.Phoenix];
Damage += Damage * effect / 100;
if (effect >= 180)
Damage += Damage / 20;
break;
}
case Attack.Ranged:
{
Damage = MyMath.Generate((int)Attacker.MinAttack, (int)Attacker.MaxAttack) / 25;
AbdoRedaGxV4.Game.Attacking.Calculate.Refinary(Attacker, Monster, ref Damage, ref Packet, false);
Damage = AdjustDamageEntity2Monster(Damage, Attacker, Monster);
var bonus = Attacker.Gems[GemTypes.Dragon];
if (bonus > 0)
Damage += MathHelper.MulDiv((int)Damage, bonus, 100);
break;
}
}
if (AtkType != Attack.Magic)
{
if (Attacker.Gems[GemTypes.Dragon] >= 210)
Damage += Damage * 50 / 100;
}
if (Attacker.OnSuperCyclone())
Damage += (int)((double)Damage * 0.2);
if (Attacker.OnOblivion())
Damage += (int)((double)Damage * 0.2);
if (Attacker.OnFatalStrike())
Damage += (int)((double)Damage * 0.2);
if (Attacker.BattlePower < Monster.Level)
Damage *= 0.01;
Damage += Attacker.getFan(AtkType == Attack.Magic);
if (Damage < 1)
Damage = 1;
Damage = AdjustMinDamageEntity2Monster(Damage, Attacker, Monster);
if (Attacker.EntityFlag == EntityFlag.Entity)
{
if (Attacker.Owner.BlessTime > 0 && MyMath.Success(1))
{
Damage *= 1;
_String str = new _String(true);
str.UID = Attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("LuckyGuy");
Attacker.Owner.SendScreen(str, true);
}
}
return (Int32)Math.Round(Damage, 0);
}
public static Int32 GetDamageEntity2Monster(Entity Attacker, Entity Monster, ushort MagicType, Byte MagicLevel, ref Attack Packet)
{
var Info = SpellTable.GetSpell(MagicType, MagicLevel);
Double Damage = 0;
List<ushort> spells = new List<ushort>()
{
11190,
10315
};
if (Info.ID == 1115 || spells.Contains(Info.ID) || (Info.WeaponSubtype.Count > 0 && !Info.WeaponSubtype.Contains(500) && !Info.WeaponSubtype.Contains(613) && !Attacker.IsChaser1()))
{
Damage = MyMath.Generate((int)Attacker.MinAttack, (int)Attacker.MaxAttack);
AbdoRedaGxV4.Game.Attacking.Calculate.Refinary(Attacker, Monster, ref Damage, ref Packet, false);
if (Info.Power > 30000)
Damage *= (Double)(Info.Power - 30000) / 100;
else
Damage += Info.Power;
// Damage += Attacker.getFan(false);
var bonus = Attacker.Gems[GemTypes.Dragon];
if (bonus > 0)
Damage += MathHelper.MulDiv((int)Damage, bonus, 100);
Damage = AdjustDamageEntity2Monster(Damage, Attacker, Monster);
Damage -= Monster.Defence;
Damage = Attacker.AdjustAttack((int)Damage);
if (Attacker.Gems[GemTypes.Dragon] >= 210)
Damage += Damage * 50 / 100;
}
else if (Info.WeaponSubtype.Contains(500) || Info.WeaponSubtype.Contains(613) || Attacker.IsChaser1())
{
Damage = MyMath.Generate((int)Attacker.MinAttack, (int)Attacker.MaxAttack);
AbdoRedaGxV4.Game.Attacking.Calculate.Refinary(Attacker, Monster, ref Damage, ref Packet, false);
// Damage += Attacker.getFan(false);
if (Info.Power > 30000)
Damage *= (Double)(Info.Power - 30000) / 100;
else
Damage += Info.Power;
Damage = AdjustDamageEntity2Monster(Damage, Attacker, Monster);
Damage = Attacker.AdjustAttack((int)Damage);
var bonus = Attacker.Gems[GemTypes.Dragon];
if (bonus > 0)
Damage += MathHelper.MulDiv((int)Damage, bonus, 100);
if (Attacker.Gems[GemTypes.Dragon] >= 210)
Damage += Damage * 50 / 100;
}
else
{
Damage = Attacker.MagicAttack;
AbdoRedaGxV4.Game.Attacking.Calculate.Refinary(Attacker, Monster, ref Damage, ref Packet, true);
if (Info.Power > 30000)
Damage *= (Double)(Info.Power - 30000) / 100;
else
Damage += Info.Power;
// Damage += Attacker.getFan(true);
var effect = Attacker.Gems[GemTypes.Phoenix];
Damage += Damage * effect / 100;
Damage = AdjustDamageEntity2Monster(Damage, Attacker, Monster);
Damage *= ((Double)(100 - Monster.MagicDefence) / 100);
Damage -= Monster.Block;
// Damage *= 0.75;
if (effect >= 180)
Damage += Damage / 20;
}
if (Attacker.BattlePower < Monster.Level)
Damage *= 0.01;
Damage += Attacker.getFan(Packet.AttackType == Attack.Magic);
if (Attacker.OnSuperman())
Damage += (int)((double)Damage * 2.5); //PvP Reduction!
if (Damage < 1)
Damage = 1;
Damage = AdjustMinDamageEntity2Monster(Damage, Attacker, Monster);
if (Attacker.EntityFlag == EntityFlag.Entity)
{
if (Attacker.Owner.BlessTime > 0 && MyMath.Success(1))
{
Damage *= 1;
_String str = new _String(true);
str.UID = Attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("LuckyGuy");
Attacker.Owner.SendScreen(str, true);
}
}
return (Int32)Math.Round(Damage, 0);
}
private static Int32 AdjustMinDamageEntity2Monster(Double Damage, Entity Attacker, Entity Monster)
{
Int32 MinDmg = 1;
MinDmg += (Int32)(Attacker.Level / 10);
var Item = Attacker.Owner.Equipment.TryGetItem(4);
if (Item != null)
MinDmg += (int)Item.ID % 10;
return Math.Max(MinDmg, (Int32)Damage);
}
private static Int32 AdjustDamageEntity2Monster(Double Damage, Entity Attacker, Entity Monster)
{
if (!Monster.IsGreen(Attacker))
return Math.Max(0, (Int32)Damage);
Int32 DeltaLvl = Attacker.Level - Monster.Level;
if (DeltaLvl >= 3 && DeltaLvl <= 5)
Damage *= 1.5;
else if (DeltaLvl > 5 && DeltaLvl <= 10)
Damage *= 2;
else if (DeltaLvl > 10 && DeltaLvl <= 20)
Damage *= 2.5;
else if (DeltaLvl > 20)
Damage *= 3;
else
Damage *= 1;
return Math.Max(0, (Int32)Damage);
}
}
}
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
أدوات الموضوع | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
اضافة رانك الوحوش [Proto] | Tefa | تطوير سيرفرات كونكر | 13 | اليوم 03:55 AM |
الديتي لاند | taha | مشكلات السيرفيرات كونكر الشخصيه | 3 | 2020-02-18 01:46 PM |
حل مشكلة الجواز[RayzoV3] | Tefa | تطوير سيرفرات كونكر | 7 | 2019-11-24 10:20 AM |
حل مشكلة ضربة فيزيكال للنينجا و بروسلي[RayzoV3] | Tefa | تطوير سيرفرات كونكر | 1 | 2019-11-22 07:08 PM |
حل مشكلة ايرور قنصل الي بيجيلك لما الاكونت بينزل ريبورن[Rayzov3] | Tefa | تطوير سيرفرات كونكر | 2 | 2019-11-22 05:45 PM |