Skill ThunderCloud
2 participantes
Página 1 de 1
Skill ThunderCloud
Hello.
I have this skill problem. I'm still trying to fix it but I can not
I have this code:
The problem is that it does not react, it does not attack.
The question is what am I wrong?
I have this skill problem. I'm still trying to fix it but I can not
I have this code:
- Código:
#region ThunderCloud(Passive)
case 12840:
- Código:
{
if (Time64.Now >= attacker.ThunderCloudSU.AddSeconds(59))
{
attacker.ThunderCloudSU = Time64.Now;
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = attacker.Owner.Entity.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = attacker.Owner.Entity.X;
spellUse.Y = attacker.Owner.Entity.Y;
attacker.Owner.SendScreen(spellUse, true);
//////////////////////////////////////////////////
///////////////////////////////////////////////////
uint UID = Kernel.Maps[attacker.MapID].EntityUIDCounter.Next;
uint Mesh = 980;
//////////////////////////////////////////////////////
byte[] Buffer = new byte[68 + 8];
Writer.WriteInt32(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
Writer.Write(attacker.Owner.UnionID, 278, ThunderCloud.SpawnPacket);//UnionID
ThunderCloud.CUID = attacker.UID;
ThunderCloud.Owner = new Client.GameClient(null);
ThunderCloud.Owner.Entity = 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.WindowCommands.SpawnEffect;
d.Facing = attacker.Facing;
d.Data24_Uint = ThunderCloud.X;
d.wParam2 = ThunderCloud.Y;
- Código:
///////////////////////////////////////////////
////////////////////////////////////////////
/////////////////////////////////////////
attacker.Owner.SendScreen(Buffer, true);
attacker.Owner.SendScreen(ThunderCloud.SpawnPacket, true);
attacker.Owner.SendScreenSpawn(ThunderCloud, true);
attacker.Owner.SendScreen(d, true);
ThunderCloud.ThunderCloudStamp = Time64.Now;
Program.World.Register(ThunderCloud);
attacker.AttackPacket = null;
}
}
break;
- Código:
}
#endregion
The problem is that it does not react, it does not attack.
The question is what am I wrong?
ionita constantin- Membro
- Mensagens : 8
Data de inscrição : 26/11/2016
Re: Skill ThunderCloud
(Handle)
Search for #region Monster -> Player \ Monster
---
IN New Class
----
(Class Entity)
--
(class String)
--
(class map)
--
(Class Attack)
--
--
(Class Screen)
private static void monsterBuffersCallback
- Código:
#region ThunderCloud[Chaser]
case 12840:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
var cl = new WindWalker.ThunderCloud(attacker.Owner, attack.X, attack.Y);
suse.AddTarget(cl.UID, 0, null);
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
Search for #region Monster -> Player \ Monster
- Código:
if (Constants.PKForbiddenMaps.Contains(attacker.MapID)) return;
}
- Código:
#region ThunderCloud
if (attacker.Name == "Thundercloud")
{
if (Kernel.GamePool.ContainsKey(attacker.UID))
{
var owner = Kernel.GamePool[attacker.UID];
var spell = Database.SpellTable.GetSpell(12840, owner);
var spell2 = Database.SpellTable.GetSpell(12970, owner);
byte percent = 0;
if (spell2 != null)
{
if (spell2.Level == 0) percent = 130;
if (spell2.Level == 1) percent = 140;
if (spell2.Level == 2) percent = 150;
if (spell2.Level == 3) percent = 160;
if (spell2.Level == 4) percent = 170;
if (spell2.Level == 5) percent = 180;
if (spell2.Level == 6) percent = 200;
}
attack = new Attack(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.InteractType = Network.GamePackets.Attack.Kill;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Damage = 1;
uint damage2 = (uint)(Calculate.Melee(owner.Entity, attacked, ref attack) * spell.Power / 100);
if (attacker.SpawnPacket[50] == 128)//ThunderBolt
damage2 = (uint)(damage2 * percent / 100);
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.UID, damage2, attack);
attacker.MonsterInfo.SendScreen(suse2);
if (attacked.Hitpoints <= damage2)
{
attacked.Die(attacker);
attack.ResponseDamage = damage2;
attacker.MonsterInfo.SendScreen(attack);
}
else
{
attacked.Hitpoints -= damage2;
}
return;
}
else
return;
}
#endregion
#region ThunderCloudSight
foreach (var th in Kernel.Maps[attacker.MapID].Entities.Values.Where(i => i.Name == "Thundercloud"))
{
if (th.UID == attacked.UID)
{
if (attacker == null || Kernel.GetDistance(attacker.X, attacker.Y, th.X, th.Y) > th.MonsterInfo.AttackRange || attacker.Dead) break;
th.MonsterInfo.InSight = attacker.UID;
break;
}
}
#endregion
---
IN New Class
- Código:
using DesCo;
using DesCo.Client;
using DesCo.Game;
using DesCo.Network;
using DesCo.Network.GamePackets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DesCo
{
public class WindWalker
{
public class ThunderCloud
{
public static Counter ThunderCloudCounter = new Counter(700000);
byte[] Buffer;
public ushort X = 0, Y = 0;
public uint UID = 0;
public uint OwnerID;
public GameClient Owner;
public DateTime EndTime;
public bool Dead = false;
bool _bol;
public bool ThunderBolt
{
get { return _bol; }
set
{
if (value == true)
Writer.WriteUInt32(128, 50, Buffer);
else
Writer.WriteUInt32(0, 50, Buffer);
_bol = value;
}
}
public Time32 LastCloudAttack;
public ThunderCloud(GameClient client, ushort X, ushort Y)
{
Owner = client;
Owner.Entity.Cloud = this;
EndTime = DateTime.Now.AddSeconds(24);
this.X = X;
this.Y = Y;
OwnerID = client.Entity.UID;
UID = ThunderCloudCounter.Next;
string _Name = "Thundercloud";
byte[] Packet_2035 = new byte[68 + 8];
Writer.WriteUInt16((ushort)(Packet_2035.Length - 8), 0, Packet_2035);
Writer.WriteUInt16(2035, 2, Packet_2035);
Writer.WriteUInt32(UID, 4, Packet_2035);
Writer.WriteUInt32(4264, 8, Packet_2035);
Packet_2035[12] = 3;
Writer.WriteUInt32(980, 16, Packet_2035);//mesh
Packet_2035[24] = 14;
Writer.WriteUInt32(22348141, 26, Packet_2035);
Writer.WriteString(_Name, 30, Packet_2035);
Buffer = new byte[8 + Entity._Names + _Name.Length + 36];
Writer.WriteUInt16((ushort)(Buffer.Length - 8), 0, Buffer);
Writer.WriteUInt16(10014, 2, Buffer);
Writer.WriteUInt32((uint)Time32.timeGetTime().GetHashCode(), 4, Buffer);
Writer.WriteUInt32(980, 8, Buffer);//Mesh
Writer.WriteUInt32(UID, 12, Buffer);//Uid
var seconds = System.Math.Abs((EndTime - DateTime.Now).TotalSeconds);
Writer.WriteUInt32((uint)((seconds * 10000) / 24), 111, Buffer);//Time
Writer.WriteUInt32(140, 117, Buffer);//Level
Writer.WriteUInt32(X, 119, Buffer);
Writer.WriteUInt32(Y, 121, Buffer);
Writer.WriteUInt32(5, 125, Buffer);
Writer.WriteUInt32(client.Entity.UID, 274, Buffer);//OwnerUID
Buffer[278] = 1;
Buffer[220] = 1;
Writer.WriteUInt16(768, 270, Buffer);
Writer.WriteStringList(new List<string>() { _Name, "", "", "", "", "", "" }, Entity._Names, Buffer);
Network.GamePackets.Data d = new Data(true);
d.UID = UID;
d.Facing = (Enums.ConquerAngle)5;
client.Send(Packet_2035);
client.Send(Buffer);
client.Send(d);
client.Map.AddCloud(this);
}
public void DisposeCloud(GameClient c)
{
if (c != null)
if (c.Map.Clouds.ContainsKey(UID))
{
c.Map.Clouds.Remove(UID);
Data d = new Data(true);
d.UID = UID;
d.ID = Data.RemoveEntity;
c.SendScreen(d, true);
ThunderBolt = false;
if (Owner != null)
Owner.Entity.ThunderBolt = false;
Dead = true;
}
}
public void SendSpawn(GameClient Owner, bool p)
{
var seconds = System.Math.Abs((EndTime - DateTime.Now).TotalSeconds);
if (seconds > 24) seconds = 0;
Writer.WriteUInt32((uint)((seconds * 10000) / 24), 111, Buffer);//Time
Owner.Send(Buffer);
}
public byte[] Refresh()
{
var seconds = System.Math.Abs((EndTime - DateTime.Now).TotalSeconds);
if (seconds > 24) seconds = 0;
Writer.WriteUInt32((uint)((seconds * 10000) / 24), 111, Buffer);//Time
return Buffer;
}
public void SendSpawn2(GameClient Owner, bool p)
{
byte[] Packet_2035 = new byte[68 + 8];
var seconds = System.Math.Abs((EndTime - DateTime.Now).TotalSeconds);
if (seconds > 24) seconds = 0;
Writer.WriteUInt32((uint)((seconds * 10000) / 24), 111, Buffer);//Time
Writer.Write(128, 50, Buffer);//Flag4(128)
Writer.Write(128, 50, Packet_2035);//Flag4(128)
Owner.Send(Buffer);
}
}
public enum CharacterType : byte
{
Chaser = 7,
Stomper = 15
}
public static void SendGreenEffect(GameClient client)
{
_String str = new _String(true);
str.UID = client.Entity.UID;
str.TextsCount = 1;
str.Action = _String.Effect;
str.Texts.Add("TSM_SXJ_HPhf");
client.SendScreen(str.ToArray(), true);
}
public static void JusticeChainEquipment(GameClient client)
{
if (client.Equipment.Objects[3] != null && client.Equipment.Objects[4] != null)
{
if ((uint)(client.Equipment.Objects[3].ID / 1000) == 626 && (uint)(client.Equipment.Objects[4].ID / 1000) == 626)
{
if (!client.Entity.ContainsFlag4((ulong)Update.Flags4.JusticeChant))
client.Entity.AddFlag4((ulong)Update.Flags4.JusticeChant);
}
else if (client.Entity.ContainsFlag4((ulong)Update.Flags4.JusticeChant))
client.Entity.RemoveFlag4((ulong)Update.Flags4.JusticeChant);
}
else if (client.Entity.ContainsFlag4((ulong)Update.Flags4.JusticeChant))
client.Entity.RemoveFlag4((ulong)Update.Flags4.JusticeChant);
}
internal static void SendRevengeTail(Entity attacker, Entity attacked, ref int damage)
{
uint dmg = (uint)damage;
var spell = Database.SpellTable.GetSpell(13030, attacker.Owner);
if (damage < spell.Power)
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacked.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
var attack = new Attack(true);
attack.Attacked = attacker.UID;
attack.Attacker = attacked.UID;
attack.InteractType = Network.GamePackets.Attack.Melee;
attack.Damage = 0;
attack.MonsterSpellID = 1;
attack.ResponseDamage = (uint)damage;
attack.X = attacked.X;
attack.Y = attacked.Y;
suse.AddTarget(attacked.UID, dmg, attack);
attacker.SendScreen(attack);
attacker.SendScreen(suse);
if (attacker.Hitpoints <= damage)
attacker.Die(attacked);
else attacker.Hitpoints -= dmg;
attacked.RemoveFlag4((ulong)Update.Flags4.RevengeTaill);
}
}
}
}
----
(Class Entity)
- Código:
public class Entity : Writer, Interfaces.IBaseEntity, Interfaces.IMapObject
{
public DesCo.WindWalker.ThunderCloud Cloud;
bool _thbolt;
public bool ThunderBolt
{
get
{
return _thbolt;
}
set
{
if (Cloud != null)
Cloud.ThunderBolt = value;
_thbolt = value;
}
}
--
(class String)
- Código:
public byte Action
{
get { return Buffer[12]; }
set { Buffer[12] = value; }
}
--
(class map)
- Código:
public Dictionary<uint, DesCo.WindWalker.ThunderCloud> Clouds = new Dictionary<uint, DesCo.WindWalker.ThunderCloud>();
public void AddCloud(WindWalker.ThunderCloud entity)
{
if (!this.Clouds.ContainsKey(entity.UID))
this.Clouds.Add(entity.UID, entity);
}
--
(Class Attack)
--
- Código:
public uint MonsterSpellID
{
get { return BitConverter.ToUInt32(Buffer, 28); }
set { fixed (byte* Pack = Buffer) *((uint*)(Pack + 28)) = value; }
}
public uint InteractType
{
get { return BitConverter.ToUInt32(Buffer, 24); }
set { fixed (byte* Pack = Buffer) *((uint*)(Pack + 24)) = value; }
}
--
(Class Screen)
private static void monsterBuffersCallback
- Código:
if (client.Entity.Body == 297)
return;
- Código:
#region ThunderCloud
foreach (var Cloud in client.Map.Clouds.Values)
{
if (Cloud == null) continue;
if (Kernel.GetDistance(Cloud.X, Cloud.Y, client.Entity.X, client.Entity.Y) > 16) continue;
if (DateTime.Now > Cloud.EndTime || Cloud.Owner == null)
{
Cloud.DisposeCloud(client);
return;
}
#region ThunderCloud
if (!Cloud.Dead && Time32.Now > Cloud.LastCloudAttack.AddSeconds(Cloud.ThunderBolt == true ? 1 : 2))
{
if (client.Entity.Cloud != null)
{
var spell = Database.SpellTable.GetSpell(12970, client);
SpellUse suse = new SpellUse(true);
suse.Attacker = client.Entity.Cloud.UID;
suse.SpellID = 13190;
suse.SpellLevel = 0;
suse.X = client.Entity.Cloud.X;
suse.Y = client.Entity.Cloud.Y;
Entity attacked = null;
foreach (Interfaces.IMapObject _obj in client.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
Cloud.LastCloudAttack = Time32.Now;
attacked = _obj as Entity;
if (Kernel.GetDistance(Cloud.X, Cloud.Y, attacked.X, attacked.Y) <= 15)
{
Attack attack = new Attack(true);
if (Game.Attacking.Handle.CanAttack(Cloud.Owner.Entity, attacked, spell, attack.InteractType == Attack.Melee))
{
attack.Effect = Attack.AttackEffects.None;
uint damage = Game.Attacking.Calculate.Melee(Cloud.Owner.Entity, attacked, ref attack);
if (Cloud.ThunderBolt)
damage += Game.Attacking.Calculate.Melee(Cloud.Owner.Entity, attacked, ref attack) * 2;
suse.Effect = attack.Effect;
Game.Attacking.Handle.ReceiveAttack(Cloud.Owner.Entity, attacked, attack, damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
break;
}
}
}
}
client.SendScreen(suse, true);
}
}
#endregion
#endregion
Re: Skill ThunderCloud
- Código:
_________________
#endregion
#endregion
}
}
client.SendScreen(suse, true);
}
}
}
}
break;
suse.AddTarget(attacked.UID, damage, attack);
Game.Attacking.Handle.ReceiveAttack(Cloud.Owner.Entity, attacked, attack, damage, spell);
suse.Effect = attack.Effect;
damage += Game.Attacking.Calculate.Melee(Cloud.Owner.Entity, attacked, ref attack) * 2;
if (Cloud.ThunderBolt)
uint damage = Game.Attacking.Calculate.Melee(Cloud.Owner.Entity, attacked, ref attack);
attack.Effect = Attack.AttackEffects.None;
{
if (Game.Attacking.Handle.CanAttack(Cloud.Owner.Entity, attacked, spell, attack.InteractType == Attack.Melee))
Attack attack = new Attack(true);
{
if (Kernel.GetDistance(Cloud.X, Cloud.Y, attacked.X, attacked.Y) <= 15)
attacked = _obj as Entity;
Cloud.LastCloudAttack = Time32.Now;
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
if (_obj == null) continue;
{
foreach (Interfaces.IMapObject _obj in client.Screen.Objects)
Entity attacked = null;
suse.Y = client.Entity.Cloud.Y;
suse.X = client.Entity.Cloud.X;
suse.SpellLevel = 0;
suse.SpellID = 13190;
suse.Attacker = client.Entity.Cloud.UID;
SpellUse suse = new SpellUse(true);
var spell = Database.SpellTable.GetSpell(12970, client);
{
if (client.Entity.Cloud != null)
{
if (!Cloud.Dead && Time32.Now > Cloud.LastCloudAttack.AddSeconds(Cloud.ThunderBolt == true ? 1 : 2))
#region ThunderCloud
}
return;
Cloud.DisposeCloud(client);
{
if (DateTime.Now > Cloud.EndTime || Cloud.Owner == null)
if (Kernel.GetDistance(Cloud.X, Cloud.Y, client.Entity.X, client.Entity.Y) > 16) continue;
if (Cloud == null) continue;
{
foreach (var Cloud in client.Map.Clouds.Values)
#region ThunderCloud [b][/b][i][/i][u][/u][sub][/sub][sup][/sup][strike][/strike]
[ltr]Where should I add this code? Until that code I did everything and still do not attack.[/ltr]
ionita constantin- Membro
- Mensagens : 8
Data de inscrição : 26/11/2016
Re: Skill ThunderCloud
[ltr]I've done it, Thanks[/ltr]
ionita constantin- Membro
- Mensagens : 8
Data de inscrição : 26/11/2016
Tópicos semelhantes
» ajuda em skill de Ninja FlinFlin
» me ajudar sobre skill
» Bug do skill Charging Vortex
» Epic de warrio + skill [70%]
» Bug da TwilightDance[O skill não some no chão(tela)]
» me ajudar sobre skill
» Bug do skill Charging Vortex
» Epic de warrio + skill [70%]
» Bug da TwilightDance[O skill não some no chão(tela)]
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|