|
المشاركات 127 |
+التقييم 0.06 |
تاريخ التسجيل Jul 2019 |
الاقامة https://www.facebook.com/Hossam.eldein123/ |
نظام التشغيل |
رقم العضوية 407 |
void ThunderCloudTimer
public static void ThunderCloudTimer(Entity ThunderCloud, int time)
{
if (ThunderCloud == null) return;
if (!Kernel.Maps.ContainsKey(ThunderCloud.MapID))
{
Kernel.Maps[ThunderCloud.MapID].RemoveEntity(ThunderCloud);
Data data = new Data(true);
data.UID = ThunderCloud.UID;
data.ID = Data.RemoveEntity;
ThunderCloud.MonsterInfo.SendScreen(data);
ThunderCloud.MonsterInfo.SendScreen(data);
foreach (var client in Kernel.GamePool.Values)
{
if (Kernel.GetDistance(ThunderCloud.X, ThunderCloud.Y, client.Player.X, client.Player.Y) > 16) continue;
client.RemoveScreenSpawn(ThunderCloud, true);
}
return;
}
if (Time32.Now >= ThunderCloud.ThunderCloudStamp.AddSeconds(1))
{
ThunderCloud.ThunderCloudStamp = Time32.Now;
if (ThunderCloud.Hitpoints > 400)
ThunderCloud.Hitpoints -= 400;
else
{
Kernel.Maps[ThunderCloud.MapID].RemoveEntity(ThunderCloud);
Data data = new Data(true);
data.UID = ThunderCloud.UID;
data.ID = Data.RemoveEntity;
ThunderCloud.MonsterInfo.SendScreen(data);
ThunderCloud.MonsterInfo.SendScreen(data);
foreach (var client in Kernel.GamePool.Values)
{
if (Kernel.GetDistance(ThunderCloud.X, ThunderCloud.Y, client.Player.X, client.Player.Y) > 16) continue;
client.RemoveScreenSpawn(ThunderCloud, true);
}
return;
}
}
if ((ThunderCloud.SpawnPacket[50] == 0 && Time32.Now >= ThunderCloud.MonsterInfo.LastMove.AddMilliseconds(750)) || ThunderCloud.SpawnPacket[50] == 128)
{
ThunderCloud.MonsterInfo.LastMove = Time32.Now;
if (ThunderCloud.MonsterInfo.InSight == 0)
{
foreach (var one in Kernel.Maps[ThunderCloud.MapID].Entities.Values.Where(i => Kernel.GetDistance(ThunderCloud.X, ThunderCloud.Y, i.X, i.Y) <= ThunderCloud.MonsterInfo.AttackRange))
{
if (one == null || one.Dead || one.MonsterInfo.Guard || one.Companion) continue;
ThunderCloud.MonsterInfo.InSight = one.UID;
Entity insight = null;
if (Kernel.Maps[ThunderCloud.MapID].Entities.ContainsKey(ThunderCloud.MonsterInfo.InSight))
insight = Kernel.Maps[ThunderCloud.MapID].Entities[ThunderCloud.MonsterInfo.InSight];
else if (Kernel.GamePool.ContainsKey(ThunderCloud.MonsterInfo.InSight))
insight = Kernel.GamePool[ThunderCloud.MonsterInfo.InSight].Player;
if (insight == null || insight.Dead || (insight.MonsterInfo != null && insight.MonsterInfo.Guard))
{
ThunderCloud.MonsterInfo.InSight = 0;
break;
}
new Game.Attacking.Handle(null, ThunderCloud, insight);
break;
}
}
else
{
Entity insight = null;
if (Kernel.Maps[ThunderCloud.MapID].Entities.ContainsKey(ThunderCloud.MonsterInfo.InSight))
insight = Kernel.Maps[ThunderCloud.MapID].Entities[ThunderCloud.MonsterInfo.InSight];
else if (Kernel.GamePool.ContainsKey(ThunderCloud.MonsterInfo.InSight))
insight = Kernel.GamePool[ThunderCloud.MonsterInfo.InSight].Player;
if (insight == null || insight.Dead || (insight.MonsterInfo != null && insight.MonsterInfo.Guard))
{
ThunderCloud.MonsterInfo.InSight = 0;
return;
}
new Game.Attacking.Handle(null, ThunderCloud, insight);
}
}
}
public bool Register(Entity ThunderCloudd)
{
if (ThunderCloudd.Owner.TimerSubscriptions == null)
{
ThunderCloudd.Owner.TimerSyncRoot = new object();
ThunderCloudd.Owner.TimerSubscriptions = new IDisposable[]
{
ThunderCloud.Add(ThunderCloudd)
};
return true;
}
return false;
}
public void Unregister(Entity Thundercloud)
{
if (Thundercloud.Owner == null || Thundercloud.Owner.TimerSubscriptions == null) return;
lock (Thundercloud.Owner.TimerSyncRoot)
{
if (Thundercloud.Owner.TimerSubscriptions != null)
{
foreach (var timer in Thundercloud.Owner.TimerSubscriptions)
timer.Dispose();
Thundercloud.Owner.TimerSubscriptions = null;
}
}
}
case 12840:
#region ThunderCloud
case 12840:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.X = X;
suse.Y = Y;
suse.SpellID = spell.ID;
attacker.Owner.SendScreen(suse, true);
//////////////////////////////////////////////////
///////////////////////////////////////////////////
uint UID = Kernel.Maps[attacker.MapID].EntityUIDCounter.Next;
uint Mesh = 980;
//////////////////////////////////////////////////////
byte[] Buffer = new byte[68 + 8];
Writer.Write(Buffer.Length - 8, 0, Buffer);
Writer.Write(2035, 2, Buffer);//Packet ID
Writer.Write(UID, 4, Buffer);//FlowerUID
Writer.Write(4264, 8, Buffer);
Buffer[12] = 3;
Writer.Write(Mesh, 16, Buffer);//FloorItemID
Buffer[24] = 14;//AttackRange
Writer.Write(X, 26, Buffer);
Writer.Write(Y, 28, Buffer);
Writer.Write("Thundercloud", 30, Buffer);
//////////////////////////////////////////////////
///////////////////////////////////////////////////
//////////////////////////////////////////////////////
Entity ThunderCloud = new Entity(Game.EntityFlag.Monster, true);
ThunderCloud.Name = "Thundercloud";
ThunderCloud.Mesh = Mesh;
ThunderCloud.UID = UID;
ThunderCloud.GuildID = attacker.GuildID;
ThunderCloud.MaxHitpoints = attacker.MaxHitpoints;
ThunderCloud.Level = 140;
ThunderCloud.X = X;
ThunderCloud.Y = Y;
ThunderCloud.Facing = attacker.Facing;
ThunderCloud.Boss = 1;
ThunderCloud.MapID = attacker.MapID;
Writer.Write(3, 308, ThunderCloud.SpawnPacket);
Writer.Write(15, 272, ThunderCloud.SpawnPacket);
Writer.Write(3, 271, ThunderCloud.SpawnPacket);//AttackUser
ThunderCloud.CUID = attacker.UID;
ThunderCloud.Owner = new Client.GameState(null);
ThunderCloud.Owner.Player = ThunderCloud;
ThunderCloud.MonsterInfo = new MonsterInformation();
ThunderCloud.MonsterInfo.AttackType = 24;
ThunderCloud.MonsterInfo.AttackSpeed = 1000;
ThunderCloud.MonsterInfo.AttackRange = 14;
ThunderCloud.MonsterInfo.Boss = true;
ThunderCloud.MonsterInfo.BoundX = X;
ThunderCloud.Companion = true;
ThunderCloud.MonsterInfo.Guard = false;
ThunderCloud.MonsterInfo.BoundY = Y;
ThunderCloud.MonsterInfo.Defence = attacker.Defence;
ThunderCloud.MonsterInfo.Hitpoints = 10000;
ThunderCloud.MonsterInfo.Mesh = 980;
ThunderCloud.MonsterInfo.MoveSpeed = int.MaxValue;
ThunderCloud.MonsterInfo.Name = "Thundercloud";
ThunderCloud.MonsterInfo.Owner = attacker;
ThunderCloud.MonsterInfo.ViewRange = 14;
ThunderCloud.MonsterInfo.RespawnTime = 0;
ThunderCloud.MonsterInfo.RunSpeed = int.MaxValue;
ThunderCloud.MonsterInfo.SpellID = 13190;
ThunderCloud.Hitpoints = 10000;
Kernel.Maps[ThunderCloud.MapID].AddEntity(ThunderCloud);
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
/////////////////////////////////////////////
Network.GamePackets.Data d = new Data(true);
d.UID = UID;
d.ID = Data.AddEntity;
d.Facing = attacker.Facing;
d.X2 = ThunderCloud.X;
d.Y2 = ThunderCloud.Y;
///////////////////////////////////////////////
////////////////////////////////////////////
/////////////////////////////////////////
attacker.Owner.SendScreen(Buffer, true);
attacker.Owner.SendScreen(ThunderCloud.SpawnPacket, true);
attacker.Owner.SendScreenSpawn(ThunderCloud, true);
attacker.Owner.SendScreen(d, true);
ThunderCloud.ThunderCloudStamp = Time32.Now;
Program.World.Register(ThunderCloud);
attacker.AttackPacket = null;
}
break;
}
#endregion
if (attacker.MonsterInfo.SpellID == 0)
uint damage = Calculate.MonsterDamage(attacker, attacked, attacker.MonsterInfo.SpellID);
#region ThunderCloud
if (attacker.Name == "Thundercloud")
{
if (Kernel.GamePool.ContainsKey(attacker.CUID))
{
var owner = Kernel.GamePool[attacker.CUID];
var spell = Database.SpellTable.GetSpell(12840, owner);
var spell2 = Database.SpellTable.GetSpell(12970, owner);
uint damage2 = (uint)(Calculate.Melee(owner.Player, attacked, ref attack, 0) * (spell.Level < 8 ? spell.FirstDamage : 50) / 100);
if (attacker.SpawnPacket[50] == 128)
damage2 = (uint)(damage2 * spell2.FirstDamage);
SpellUse suse2 = new SpellUse(true);
suse2.Attacker = attacker.UID;
suse2.Attacker1 = attacked.UID;
suse2.SpellID = 13190;
suse2.X = attacked.X;
suse2.Y = attacked.Y;
suse2.AddTarget(attacked, damage2, attack);
attacker.MonsterInfo.SendScreen(suse2);
if (attacked.Hitpoints <= damage2)
{
attacked.Die(attacker);
attack = new Attack(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.AttackType = Network.GamePackets.Attack.Kill;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Damage = 1;
attack.ResponseDamage = damage2;
attacker.MonsterInfo.SendScreen(attack);
}
else
{
attacked.Hitpoints -= damage2;
}
return;
}
else
return;
}
#endregion
public ushort Thundercloud
public ushort X2
{
get
{
return BitConverter.ToUInt16(Buffer, 28);
}
set
{
Writer.Write(value, 28, Buffer);
}
}
public ushort Y2
{
get
{
return BitConverter.ToUInt16(Buffer, 30);
}
set
{
Writer.Write(value, 30, Buffer);
}
}
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
سورس fighter بعد التعديل :] | محمودمحمدسالم | سورسات كونكر | 94 | 2024-10-26 11:26 PM |
مشكلة في اسكلة ThunedCloud | Mostafa Shalby | مشكلات السيرفيرات كونكر الشخصيه | 2 | 2019-11-01 12:42 AM |
حل مشكلة اسكلة TwilightDance | AbuMaryam | تطوير سيرفرات كونكر | 3 | 2019-10-05 12:32 AM |
مشكلة فى ســوورس Fighter | MeGoo | مشكلات السيرفيرات كونكر الشخصيه | 6 | 2019-08-22 10:29 AM |
مشكلة فى اسكلة ShadowClone | osama | مشكلات السيرفيرات كونكر الشخصيه | 2 | 2019-08-05 09:10 AM |