كود:
#region TwilightDance
case (ushort)Role.Flags.SpellID.TwilightDance:
{
var spellclient = ID.Value;
Queue<Role.FloorSpell> RemoveSpells = new Queue<Role.FloorSpell>();
using (var rec = new ServerSockets.RecycledPacket())
{
var stream = rec.GetStream();
var spells = spellclient.Spells.GetValues();
foreach (var spell in spells)
{
if (spellclient.CheckInvocke(Now, spell))
{
uint Experience = 0;
client.Player.TwilightDance++;
RemoveSpells.Enqueue(spell);
Game.MsgServer.AttackHandler.Algoritms.InLineAlgorithm Line = new Game.MsgServer.AttackHandler.Algoritms.InLineAlgorithm(spell.FloorPacket.m_X, spell.FloorPacket.OwnerX, spell.FloorPacket.m_Y, spell.FloorPacket.OwnerY, client.Map, 15, 0);
spellclient.CreateMsgSpell(client.Player.UID);
foreach (var obj in client.Player.View.Roles(Role.MapObjectType.Monster))
{
var monster = obj as Game.MsgMonster.MonsterRole;
if (Line.InLine(obj.X, obj.Y, 2))
{
if (Role.Core.GetDistance(obj.X, obj.Y, spell.FloorPacket.m_X, spell.FloorPacket.m_Y) <= spell.DBSkill.MaxTargets)
{
if (CanAttackMonster.Verified(client, monster, spell.DBSkill))
{
MsgSpellAnimation.SpellObj AnimationObj;
Physical.OnMonster(client.Player, monster, spell.DBSkill, out AnimationObj);
Experience += Game.MsgServer.AttackHandler.ReceiveAttack.Monster.Execute(stream, AnimationObj, client, monster);
spellclient.SpellPacket.Targets.Enqueue(AnimationObj);
}
}
}
}
foreach (var obj in client.Player.View.Roles(Role.MapObjectType.Player))
{
var target = obj as Role.Player;
if (Line.InLine(obj.X, obj.Y, 2))
{
if (Role.Core.GetDistance(obj.X, obj.Y, spell.FloorPacket.m_X, spell.FloorPacket.m_Y) <= spell.DBSkill.MaxTargets)
{
if (CanAttackPlayer.Verified(client, target, spell.DBSkill))
{
MsgSpellAnimation.SpellObj AnimationObj;
Physical.OnPlayer(client.Player, target, spell.DBSkill, out AnimationObj, true, client.Player.TwilightDance);
Game.MsgServer.AttackHandler.ReceiveAttack.Player.Execute(AnimationObj, client, target);
spellclient.SpellPacket.Targets.Enqueue(AnimationObj);
}
}
}
}
foreach (var obj in client.Player.View.Roles(Role.MapObjectType.SobNpc))
{
var target = obj as Role.SobNpc;
if (Line.InLine(obj.X, obj.Y, 2))
{
if (Role.Core.GetDistance(obj.X, obj.Y, spell.FloorPacket.m_X, spell.FloorPacket.m_Y) <= spell.DBSkill.MaxTargets)
{
if (CanAttackNpc.Verified(client, target, spell.DBSkill))
{
MsgSpellAnimation.SpellObj AnimationObj;
Physical.OnNpcs(client.Player, target, spell.DBSkill, out AnimationObj);
Experience += Game.MsgServer.AttackHandler.ReceiveAttack.Npc.Execute(stream, AnimationObj, client, target);
AnimationObj.Hit = 1;
spellclient.SpellPacket.Targets.Enqueue(AnimationObj);
}
}
}
}
spellclient.SendView(stream, client);
ActionQuery action = new ActionQuery()
{
ObjId = spell.FloorPacket.m_UID,
dwParam_Hi = spell.FloorPacket.m_Y,
dwParam_Lo = spell.FloorPacket.m_X,
wParam1 = spell.FloorPacket.OwnerX,
wParam2 = spell.FloorPacket.OwnerY,
Type = ActionType.RemoveTrap
};
spell.FloorPacket.DropType = MsgDropID.RemoveEffect;
foreach (var user in spellclient.GMap.View.Roles(Role.MapObjectType.Player, spellclient.X, spellclient.Y,
p => Role.Core.GetDistance(p.X, p.Y, spell.FloorPacket.m_X, spell.FloorPacket.m_Y) <= 18))
{
if (user.DynamicID == client.Player.DynamicID)
{
user.Send(stream.ActionCreate(&action));
user.Send(stream.ItemPacketCreate(spell.FloorPacket));
}
}
Game.MsgServer.AttackHandler.Updates.IncreaseExperience.Up(stream, client, Experience);
}
}
}
while (RemoveSpells.Count > 0)
spellclient.RemoveItem(RemoveSpells.Dequeue());
if (spellclient.Spells.Count == 0)
{
Role.FloorSpell.ClientFloorSpells FloorSpell;
client.Player.FloorSpells.TryRemove(spellclient.DBSkill.ID, out FloorSpell);
}
break;
}
#endregion
كود:
case (ushort)Role.Flags.SpellID.TwilightDance:
{
Attack.UID = user.Player.UID;
Attack.OpponentUID = user.Player.UID;
Attack.Damage = 0;
Attack.AtkType = 0;
user.Player.TwilightDance = 0;
user.Send(stream.InteractionCreate(&Attack));
MsgSpellAnimation MsgSpell = new MsgSpellAnimation(user.Player.UID
, user.Player.UID, Attack.X, Attack.Y, ClientSpell.ID
, ClientSpell.Level, ClientSpell.UseSpellSoul);
Algoritms.LayTrapThree Line = new Algoritms.LayTrapThree(user.Player.X, Attack.X, user.Player.Y, Attack.Y, 160);
int Stamp = 0;
byte Color = 0;
List<MsgFloorItem.MsgItem> Items = new List<MsgFloorItem.MsgItem>();
foreach (var coords in Line.LCoords)
{
if (!user.Player.FloorSpells.ContainsKey(ClientSpell.ID))
user.Player.FloorSpells.TryAdd(ClientSpell.ID, new Role.FloorSpell.ClientFloorSpells(user.Player.UID, Attack.X, Attack.Y, ClientSpell.SoulLevel, DBSpell, user.Map));
var FloorItem = new Role.FloorSpell(Game.MsgFloorItem.MsgItemPacket.TwilightDance, (ushort)coords.X, (ushort)coords.Y, Color, DBSpell, Stamp);
FloorItem.FloorPacket.UnKnow += 1;
FloorItem.FloorPacket.OwnerX = user.Player.X;
FloorItem.FloorPacket.OwnerY = user.Player.Y;
FloorItem.FloorPacket.Name = "trap";
FloorItem.FloorPacket.ItemOwnerUID = user.Player.UID;
user.Player.FloorSpells[ClientSpell.ID].AddItem(FloorItem);
user.Player.View.SendView(stream.ItemPacketCreate(FloorItem.FloorPacket), true);
Stamp += 300;
}
Updates.UpdateSpell.CheckUpdate(stream, user, Attack, 5000, DBSpells);
MsgSpell.SetStream(stream);
MsgSpell.Send(user);
break;
}
كود:
public void CreateMsgSpell(uint Target)
{
if (DBSkill.ID == (ushort)Role.Flags.SpellID.TwilightDance)
{
SpellPacket = new Game.MsgServer.MsgSpellAnimation(1000000, Target, X, Y, DBSkill.ID, DBSkill.Level, LevelHu);
}
else
{
SpellPacket = new Game.MsgServer.MsgSpellAnimation(UID, Target, X, Y, DBSkill.ID, DBSkill.Level, LevelHu);
}
}