|
#region ThrillingSpook
#region ThunderCloud
#region ThunderCloud
if (attacker.Name == "Thundercloud")
{
if (attacker.Owner.Player.PKMode != Game.Enums.PKMode.PK &&
attacker.Owner.Player.PKMode != Game.Enums.PKMode.Team) return;
if (Kernel.GamePool.ContainsKey(attacker.OwnerUID))
{
var owner = Kernel.GamePool[attacker.OwnerUID];
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 MsgInteract(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.InteractType = Network.GamePackets.MsgInteract.Kill;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Damage = 1;
uint damage2 = (uint)(Calculate.Melee(owner.Player, attacked, ref attack) * spell.FirstDamage / 100);
if (attacker.SpawnPacket[50] == 128)//ThunderBolt
damage2 = (uint)(damage2 * percent / 100);
MsgMagicEffect suse2 = new MsgMagicEffect(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
// ? Created by bode
// ? Copyright © 2010 - 2016 TQ Digital
// ? Emulator - Project
using System;
using System.Linq;
using System.Text;
using System.Drawing;
using Mr.HaMoOo.Network;
using Mr.HaMoOo.Database;
using Mr.HaMoOo.Interfaces;
using System.Collections.Generic;
using Mr.HaMoOo.Network.GamePackets;
using Mr.HaMoOo.Game.ConquerStructures;
using DavidEid.Game.Features.Event;
using DavidEid.Game;
namespace Mr.HaMoOo.Game.Attacking
{
public unsafe class Handle
{
public static void StomperMelee(MsgMapItem item, ushort SpellID)
{
var attack = item.Attack;
var spell = Database.SpellTable.GetSpell(SpellID, item.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = SpellID == 12990 ? item.UID : item.Owner.Player.UID;
suse.SpellID = SpellID;
suse.SpellLevel = spell.Level;
suse.SpecialEffect = 1;
if (SpellID == 12990)
{
suse.X = item.X2;
suse.Y = item.Y2;
foreach (Interfaces.IMapObject _obj in item.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
if (_obj == null) continue;
var attacked1 = _obj as Player;
if (CanAttack(item.Owner.Player, attacked1, spell, false))
{
{
var spellange = Enums.HorrorofStomperAngle(item.Angle);
ushort xxxx = item.X;
ushort yyyy = item.Y;
Map.Pushback(ref xxxx, ref yyyy, spellange, 7);
Fan sector = new Fan(item.X, item.Y, xxxx, yyyy, spell.Range, spell.Sector);
if (sector.IsInFan(attacked1.X, attacked1.Y))
{
uint damage = Game.Attacking.Calculate.Melee(item.Owner.Player, attacked1, ref attack, spell) * (spell.Power - 30000) / 100;
ReceiveAttack(item.Owner.Player, attacked1, attack, ref damage, spell);
suse.AddTarget(attacked1.UID, damage, null);
continue;
}
}
{
var spellange = Enums.OppositeAngle(Enums.HorrorofStomperAngle(item.Angle));
ushort xxxx = item.X;
ushort yyyy = item.Y;
Map.Pushback(ref xxxx, ref yyyy, spellange, 7);
Fan sector = new Fan(item.X, item.Y, xxxx, yyyy, spell.Range, spell.Sector);
if (sector.IsInFan(attacked1.X, attacked1.Y))
{
uint damage = Game.Attacking.Calculate.Melee(item.Owner.Player, attacked1, ref attack, spell) * (spell.Power - 30000) / 100;
ReceiveAttack(item.Owner.Player, attacked1, attack, ref damage, spell);
suse.AddTarget(attacked1.UID, damage, null);
}
}
}
}
}
}
else
{
suse.X = item.X;
suse.Y = item.Y;
foreach (Interfaces.IMapObject _obj in item.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
if (_obj == null) continue;
var attacked1 = _obj as Player;
if (Kernel.GetDistance(item.X, item.Y, attacked1.X, attacked1.Y) <= spell.Range)
{
if (CanAttack(item.Owner.Player, attacked1, spell, false))
{
uint damage = Game.Attacking.Calculate.Melee(item.Owner.Player, attacked1, ref attack, spell) * (spell.Power - 30000) / 100;
ReceiveAttack(item.Owner.Player, attacked1, attack, ref damage, spell);
suse.AddTarget(attacked1.UID, damage, null);
}
}
}
}
}
item.Owner.SendScreen(suse, true);
item.Owner.Player.AttackPacket = null;
}
public static void ShadowofChaser(Player attacker, Player attacked, MsgInteract attack, byte oneortwo)
{
#region ShadowofChaser(Active)
IMapObject lastAttacked = attacked;
if (oneortwo == 1)
{
if (attacker.ContainsFlag4((ulong)MsgUpdate.Flags4.ShadowofChaser) && attacker.IsChaser2())
{
#region MsgMapItem
var map = Kernel.Maps[attacker.MapID];
Network.GamePackets.MsgMapItem flooritem = new Network.GamePackets.MsgMapItem(true);
flooritem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
while (map.Npcs.ContainsKey(flooritem.UID))
flooritem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
flooritem.ItemID = MsgMapItem.ShadowofChaser;
flooritem.X = lastAttacked.X;
flooritem.MapID = attacker.MapID;
flooritem.Y = lastAttacked.Y;
flooritem.Type = MsgMapItem.Effect;
flooritem.mColor = 14;
flooritem.FlowerType = 3;
flooritem.Unknown37 = 1;
flooritem.Attack = attack;
flooritem.OwnerUID = attacker.UID;
flooritem.Owner = attacker.Owner;
flooritem.OwnerGuildUID = attacker.GuildID;
flooritem.OnFloor = Time32.Now;
flooritem.Name2 = "ShadowofChaser";
flooritem.ShadowofChaserAttacked = attacked;
flooritem.ShadowofChaserAttacker = attacker;
attacker.Owner.Map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
#endregion
return;
}
}
else if (oneortwo == 2)
{
var spell = Database.SpellTable.GetSpell(13090, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
if (CanAttack(attacker, attacked, spell, false))
{
lastAttacked = attacked;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, spell) * (spell.Power - 30000) / 100;
Handle.ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, null);
}
attacker.Owner.SendScreen(suse, true);
MsgMagicEffect suse2 = new MsgMagicEffect(true);
suse2.Attacker = attacker.UID;
suse2.SpellID = spell.ID;
suse2.SpellLevel = spell.Level;
suse2.X = attacked.X;
suse2.Y = attacked.Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
if (_obj == null) continue;
var attacked1 = _obj as Player;
if (lastAttacked.UID == attacked1.UID) continue;
if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attacked1.X, attacked1.Y) <= 4)
{
if (CanAttack(attacker, attacked1, spell, false))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked1, ref attack, spell) * (spell.Power - 30000) / 100;
attack.Damage = damage;
ReceiveAttack(attacker, attacked1, attack, ref damage, spell);
suse2.AddTarget(attacked1.UID, damage, null);
}
}
}
}
attacker.Owner.SendScreen(suse2, true);
}
#endregion
attacker.AttackPacket = null;
}
public static void cheakteam(Client.GameState client, Npcs dail)
{
if (client.Team == null)
client.Player.Teleport(1002, 430, 378);
client.Player.AddTopStatus((ulong)MsgUpdate.Flags2.Top3Water, 2, DateTime.Now.AddMinutes(30));
uint TeamCount = 0;
foreach (Client.GameState clients in Kernel.GamePool.Values.ToArray())
{
if (clients.Player.MapID == 16414)
{
if (clients.Team != null)
{
if (!clients.Player.Dead)
TeamCount++;
}
}
}
if (TeamCount <= 5)
{
uint lastcheak = 0;
if (client.Team != null)
{
foreach (Client.GameState team in client.Team.Teammates)
{
if (team.Player.MapID == 16414 && !team.Player.Dead)
lastcheak++;
}
if (TeamCount == lastcheak)
{
uint won = (uint)(rates.AllTops / client.Team.Teammates.Count());
foreach (Client.GameState team in client.Team.Teammates)
{
team.Player.Teleport(1002, 302, 276);
team.Player.ConquerPoints += won;
}
Thread.LastTeamFight = false;
Kernel.SendWorldMessage(new MsgTalk("Congratulations! " + client.Player.Name + " Team Has Won Last Team Standing and all Team Member Got " + won + " cps", System.Drawing.Color.Red, 2011), Kernel.GamePool.Values.ToArray());
}
else
{
dail.Text("There Are:| " + (TeamCount - lastcheak) + " |: other player in other Team Kill Him");
dail.Option("i Will Kill him ", 255);
dail.Send();
}
}
}
else
{
dail.Text("There Are:| " + TeamCount + " |: other player in other Team Kill Him");
dail.Option("i Will Kill him ", 255);
dail.Send();
}
}
private MsgInteract attack;
private Player attacker, attacked;
#region Interations
public class InteractionRequest
{
public InteractionRequest(MsgInteract attack, Game.Player a_client)
{
Client.GameState client = a_client.Owner;
client.Player.InteractionInProgress = false;
client.Player.InteractionWith = attack.Attacked;
client.Player.InteractionType = 0;
client.InteractionEffect = attack.ResponseDamage;
if (Kernel.GamePool.ContainsKey(attack.Attacked))
{
Client.GameState clienttarget = Kernel.GamePool[attack.Attacked];
clienttarget.Player.InteractionInProgress = false;
clienttarget.Player.InteractionWith = client.Player.UID;
clienttarget.Player.InteractionType = 0;
clienttarget.InteractionEffect = attack.ResponseDamage;
attack.Attacker = client.Player.UID;
attack.X = clienttarget.Player.X;
attack.Y = clienttarget.Player.Y;
attack.InteractType = 46;
clienttarget.Send(attack);
clienttarget.Send(attack);
}
}
}
public class InteractionEffect
{
public InteractionEffect(MsgInteract attack, Game.Player a_client)
{
Client.GameState client = a_client.Owner;
if (Kernel.GamePool.ContainsKey(client.Player.InteractionWith))
{
Client.GameState clienttarget = Kernel.GamePool[client.Player.InteractionWith];
if (clienttarget.Player.X == client.Player.X && clienttarget.Player.Y == client.Player.Y)
{
attack.Damage = client.Player.InteractionType;
attack.ResponseDamage = client.InteractionEffect;
clienttarget.Player.InteractionSet = true;
client.Player.InteractionSet = true;
attack.Attacker = clienttarget.Player.UID;
attack.Attacked = client.Player.UID;
attack.InteractType = 47;
attack.X = clienttarget.Player.X;
attack.Y = clienttarget.Player.Y;
clienttarget.Send(attack);
attack.InteractType = 49;
attack.Attacker = client.Player.UID;
attack.Attacked = clienttarget.Player.UID;
client.SendScreen(attack, true);
attack.Attacker = clienttarget.Player.UID;
attack.Attacked = client.Player.UID;
client.SendScreen(attack, true);
}
}
}
}
public class InteractionAccept
{
public InteractionAccept(MsgInteract attack, Game.Player a_client)
{
Client.GameState client = a_client.Owner;
if (client.Player.ContainsFlag((ulong)MsgUpdate.Flags.Ride))
client.Player.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
if (client.Player.InteractionWith != attack.Attacked) return;
attack.ResponseDamage = client.InteractionEffect;
client.Player.InteractionSet = false;
if (Kernel.GamePool.ContainsKey(attack.Attacked))
{
Client.GameState clienttarget = Kernel.GamePool[attack.Attacked];
if (clienttarget.Player.ContainsFlag((ulong)MsgUpdate.Flags.Ride))
clienttarget.Player.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
clienttarget.Player.InteractionSet = false;
if (clienttarget.Player.InteractionWith != client.Player.UID) return;
if (clienttarget.Player.Body == 1003 || clienttarget.Player.Body == 1004)
{
attack.Attacker = client.Player.UID;
attack.X = client.Player.X;
attack.Y = client.Player.Y;
clienttarget.Send(attack);
clienttarget.Player.InteractionInProgress = true;
client.Player.InteractionInProgress = true;
clienttarget.Player.InteractionType = attack.Damage;
clienttarget.Player.InteractionX = client.Player.X;
clienttarget.Player.InteractionY = client.Player.Y;
client.Player.InteractionType = attack.Damage;
client.Player.InteractionX = client.Player.X;
client.Player.InteractionY = client.Player.Y;
if (clienttarget.Player.X == client.Player.X && clienttarget.Player.Y == client.Player.Y)
{
attack.Damage = client.Player.InteractionType;
clienttarget.Player.InteractionSet = true;
client.Player.InteractionSet = true;
attack.Attacker = clienttarget.Player.UID;
attack.Attacked = client.Player.UID;
attack.InteractType = 47;
attack.X = clienttarget.Player.X;
attack.Y = clienttarget.Player.Y;
attack.ResponseDamage = clienttarget.InteractionEffect;
clienttarget.Send(attack);
attack.InteractType = 49;
attack.Attacker = client.Player.UID;
attack.Attacked = clienttarget.Player.UID;
client.SendScreen(attack, true);
attack.Attacker = clienttarget.Player.UID;
attack.Attacked = client.Player.UID;
client.SendScreen(attack, true);
}
}
else
{
attack.InteractType = 47;
attack.Attacker = client.Player.UID;
attack.X = client.Player.X;
attack.Y = client.Player.Y;
clienttarget.Send(attack);
clienttarget.Player.InteractionInProgress = true;
client.Player.InteractionInProgress = true;
clienttarget.Player.InteractionType = attack.Damage;
clienttarget.Player.InteractionX = clienttarget.Player.X;
clienttarget.Player.InteractionY = clienttarget.Player.Y;
client.Player.InteractionType = attack.Damage;
client.Player.InteractionX = clienttarget.Player.X;
client.Player.InteractionY = clienttarget.Player.Y;
if (clienttarget.Player.X == client.Player.X && clienttarget.Player.Y == client.Player.Y)
{
clienttarget.Player.InteractionSet = true;
client.Player.InteractionSet = true;
attack.Attacker = clienttarget.Player.UID;
attack.Attacked = client.Player.UID;
attack.X = clienttarget.Player.X;
attack.Y = clienttarget.Player.Y;
attack.ResponseDamage = clienttarget.InteractionEffect;
clienttarget.Send(attack);
attack.InteractType = 49;
client.SendScreen(attack, true);
attack.Attacker = client.Player.UID;
attack.Attacked = clienttarget.Player.UID;
client.SendScreen(attack, true);
}
}
}
}
}
public class InteractionStopEffect
{
public InteractionStopEffect(MsgInteract attack, Game.Player a_client)
{
Client.GameState client = a_client.Owner;
if (Kernel.GamePool.ContainsKey(attack.Attacked))
{
Client.GameState clienttarget = Kernel.GamePool[attack.Attacked];
attack.Attacker = client.Player.UID;
attack.Attacked = clienttarget.Player.UID;
attack.Damage = client.Player.InteractionType;
attack.X = client.Player.X;
attack.Y = client.Player.Y;
attack.InteractType = 50;
client.SendScreen(attack, true);
attack.Attacker = clienttarget.Player.UID;
attack.Attacked = client.Player.UID;
clienttarget.SendScreen(attack, true);
client.Player.Teleport(client.Player.MapID, client.Player.X, client.Player.Y);
clienttarget.Player.Teleport(clienttarget.Player.MapID, clienttarget.Player.X, clienttarget.Player.Y);
client.Player.InteractionType = 0;
client.Player.InteractionWith = 0;
client.Player.InteractionInProgress = false;
clienttarget.Player.InteractionType = 0;
clienttarget.Player.InteractionWith = 0;
clienttarget.Player.InteractionInProgress = false;
}
}
}
public class InteractionRefuse
{
public InteractionRefuse(MsgInteract attack, Game.Player a_client)
{
Client.GameState client = a_client.Owner;
client.Player.InteractionType = 0;
client.Player.InteractionWith = 0;
client.Player.InteractionInProgress = false;
if (Kernel.GamePool.ContainsKey(attack.Attacked))
{
Client.GameState clienttarget = Kernel.GamePool[attack.Attacked];
attack.Attacker = clienttarget.Player.UID;
attack.InteractType = 48;
attack.X = clienttarget.Player.X;
attack.Y = clienttarget.Player.Y;
clienttarget.Send(attack);
clienttarget.Player.InteractionType = 0;
clienttarget.Player.InteractionWith = 0;
clienttarget.Player.InteractionInProgress = false;
}
}
}
#endregion
private void Execute()
{
#region interactions
if (attack != null)
{
switch (attack.InteractType)
{
case MsgInteract.InteractionRequest:
{
new InteractionRequest(attack, attacker); return;
}
case MsgInteract.InteractionEffect:
{
new InteractionEffect(attack, attacker); return;
}
case MsgInteract.InteractionAccept:
{
new InteractionAccept(attack, attacker); return;
}
case MsgInteract.InteractionRefuse:
{
new InteractionRefuse(attack, attacker); return;
}
case MsgInteract.InteractionStopEffect:
{
new InteractionStopEffect(attack, attacker); return;
}
}
}
#endregion
#region Monster -> Player \ Monster
if (attack == null)
{
if (attacker.PlayerFlag != PlayerFlag.Monster) return;
if (attacked == null) return;
if (attacker.Companion && attacker.Name != "Thundercloud")
{
if (Constants.PKForbiddenMaps.Contains(attacker.MapID)) return;
}
if (attacked.PlayerFlag == PlayerFlag.Player)
{
if (!attacked.Owner.Attackable) return;
if (attacked.Dead) return;
if (attacker.AttackStamp.AddMilliseconds(2000) < Time32.Now)
{
attacker.AttackStamp = Time32.Now;
#region SnowBanhe
if (attacker.Name == "SnowBanshee" || attacker.Name == "SnowBansheeSoul" || attacker.Name == "PurpleBanshee")
{
uint rand = (uint)Mr.HaMoOo.Kernel.Random.Next(1, 8);
switch (rand)
{
case 1:
attacker.MonsterInfo.SpellID = 10001;
break;
case 2:
attacker.MonsterInfo.SpellID = 30010;
break;
case 4:
attacker.MonsterInfo.SpellID = 30011;
break;
case 6:
attacker.MonsterInfo.SpellID = 30012;
break;
}
#region IceThrom AngerCop
if (attacker.MonsterInfo.SpellID == 30010 || attacker.MonsterInfo.SpellID == 10001)
{
uint damage = 0;
damage += (uint)Kernel.Random.Next(1000, 2000);
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
attacked.Owner.SendScreen(suse, true);
}
#endregion
#region Chill
if (attacker.MonsterInfo.SpellID == 30011)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = 0;
damage += (uint)Kernel.Random.Next(1000, 2000);
suse.Effect = attack.Effect;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.FrightenStamp = Time32.Now;
var upd = new MsgRaceTrackStatus(true);
upd.UID = attacked.UID;
upd.Add(MsgRaceTrackStatus.Flustered, 0, 5);
attacked.Owner.SendScreen(upd, true);
attacked.Owner.Player.AddFlag((ulong)MsgUpdate.Flags.ChaosCycle);
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
foreach (var obj in attacked.Owner.Screen.Objects)
{
if (Calculations.InBox(obj.X, obj.Y, attacker.X, attacker.Y, 14))
{
if (obj.MapObjType == MapObjectType.Player)
{
if (obj.Owner.Player.ContainsFlag((ulong)MsgUpdate.Flags.Dead)) continue;
attacked = obj as Player;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.FrightenStamp = Time32.Now;
var upd = new MsgRaceTrackStatus(true);
upd.UID = attacked.UID;
upd.Add(MsgRaceTrackStatus.Flustered, 0, 5);
attacked.Owner.SendScreen(upd, true);
attacked.Owner.Player.AddFlag((ulong)MsgUpdate.Flags.ChaosCycle);
}
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacked.Owner.SendScreen(suse, true);
}
#endregion
#region AngerCrop
if (attacker.MonsterInfo.SpellID == 30012)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = 0;
damage += (uint)Kernel.Random.Next(1000, 2000);
suse.Effect = attack.Effect;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.Player.FrozenStamp = Time32.Now;
attacked.Owner.Player.FrozenTime = 5;
MsgRaceTrackStatus update = new MsgRaceTrackStatus(true);
update.UID = attacked.UID;
update.Add(MsgRaceTrackStatus.Freeze, 0, 5);
attacked.Owner.SendScreen(update, true);
attacked.AddFlag((ulong)MsgUpdate.Flags.Freeze);
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
foreach (var obj in attacked.Owner.Screen.Objects)
{
if (Calculations.InBox(obj.X, obj.Y, attacker.X, attacker.Y, 10))
{
if (obj.MapObjType == MapObjectType.Player)
{
if (obj.Owner.Player.ContainsFlag((ulong)MsgUpdate.Flags.Dead))
continue;
attacked = obj as Player;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.Player.FrozenStamp = Time32.Now;
attacked.Owner.Player.FrozenTime = 5;
MsgRaceTrackStatus update = new MsgRaceTrackStatus(true);
update.UID = attacked.UID;
update.Add(MsgRaceTrackStatus.Freeze, 0, 5);
attacked.Owner.SendScreen(update, true);
attacked.AddFlag((ulong)MsgUpdate.Flags.Freeze);
}
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacked.Owner.SendScreen(suse, true);
}
#endregion
}
#endregion
#region NemesisTyrant
if (attacker.Name == "NemesisTyrant")
{
uint rand = (uint)Kernel.Random.Next(1, 22);
switch (rand)
{
case 1:
attacker.MonsterInfo.SpellID = 10001;
break;
case 2:
attacker.MonsterInfo.SpellID = 30010;
break;
case 3:
attacker.MonsterInfo.SpellID = 10001;
break;
case 4:
attacker.MonsterInfo.SpellID = 30010;
break;
case 5:
attacker.MonsterInfo.SpellID = 30011;
break;
case 6:
attacker.MonsterInfo.SpellID = 30012;
break;
case 7:
attacker.MonsterInfo.SpellID = 7014;
break;
case 8:
attacker.MonsterInfo.SpellID = 7017;
break;
case 9:
attacker.MonsterInfo.SpellID = 7017;
break;
case 10:
attacker.MonsterInfo.SpellID = 7012;
break;
case 11:
attacker.MonsterInfo.SpellID = 7013;
break;
case 12:
attacker.MonsterInfo.SpellID = 7015;
break;
case 13:
attacker.MonsterInfo.SpellID = 7016;
break;
case 14:
attacker.MonsterInfo.SpellID = 10502;
break;
case 15:
attacker.MonsterInfo.SpellID = 10504;
break;
case 16:
attacker.MonsterInfo.SpellID = 10506;
break;
case 17:
attacker.MonsterInfo.SpellID = 10505;
break;
case 18:
attacker.MonsterInfo.SpellID = 10500;
break;
case 19:
attacker.MonsterInfo.SpellID = 10363;
break;
case 20:
attacker.MonsterInfo.SpellID = 10360;
attacked.AddFlag((ulong)MsgUpdate.Flags.Stun);
attacked.ShockStamp = Time32.Now;
attacked.Shock = 5;
var upd = new MsgRaceTrackStatus(true);
upd.UID = attacked.UID;
upd.Add(MsgRaceTrackStatus.Dizzy, 0, 5);
attacked.Owner.SendScreen(upd, true);
break;
case 21:
attacker.MonsterInfo.SpellID = 10361;
attacked.AddFlag((ulong)MsgUpdate.Flags.Stun);
attacked.ShockStamp = Time32.Now;
attacked.Shock = 5;
var upd1 = new MsgRaceTrackStatus(true);
upd1.UID = attacked.UID;
upd1.Add(MsgRaceTrackStatus.Dizzy, 0, 5);
attacked.Owner.SendScreen(upd1, true);
break;
case 22:
attacker.MonsterInfo.SpellID = 10362;
break;
}
#region IceThrom AngerCop
if (attacker.MonsterInfo.SpellID == 30010 || attacker.MonsterInfo.SpellID == 10001)
{
uint damage = 0;
damage += (uint)Kernel.Random.Next(1000, 2000);
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
attacked.Owner.SendScreen(suse, true);
}
#endregion
#region Chill
if (attacker.MonsterInfo.SpellID == 30011)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = 0;
damage += (uint)Kernel.Random.Next(1000, 2000);
suse.Effect = attack.Effect;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.FrightenStamp = Time32.Now;
var upd = new MsgRaceTrackStatus(true);
upd.UID = attacked.UID;
upd.Add(MsgRaceTrackStatus.Flustered, 0, 5);
attacked.Owner.SendScreen(upd, true);
attacked.Owner.Player.AddFlag((ulong)MsgUpdate.Flags.ChaosCycle);
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
foreach (var obj in attacked.Owner.Screen.Objects)
{
if (Calculations.InBox(obj.X, obj.Y, attacker.X, attacker.Y, 14))
{
if (obj.MapObjType == MapObjectType.Player)
{
if (obj.Owner.Player.ContainsFlag((ulong)MsgUpdate.Flags.Dead))
continue;
attacked = obj as Player;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.FrightenStamp = Time32.Now;
var upd = new MsgRaceTrackStatus(true);
upd.UID = attacked.UID;
upd.Add(MsgRaceTrackStatus.Flustered, 0, 5);
attacked.Owner.SendScreen(upd, true);
attacked.Owner.Player.AddFlag((ulong)MsgUpdate.Flags.ChaosCycle);
}
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacked.Owner.SendScreen(suse, true);
}
#endregion
#region AngerCrop
if (attacker.MonsterInfo.SpellID == 30012)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = 0;
damage += (uint)Kernel.Random.Next(1000, 2000);
suse.Effect = attack.Effect;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.Player.FrozenStamp = Time32.Now;
attacked.Owner.Player.FrozenTime = 5;
MsgRaceTrackStatus update = new MsgRaceTrackStatus(true);
update.UID = attacked.UID;
update.Add(MsgRaceTrackStatus.Freeze, 0, 5);
attacked.Owner.SendScreen(update, true);
attacked.AddFlag((ulong)MsgUpdate.Flags.Freeze);
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
foreach (var obj in attacked.Owner.Screen.Objects)
{
if (Calculations.InBox(obj.X, obj.Y, attacker.X, attacker.Y, 10))
{
if (obj.MapObjType == MapObjectType.Player)
{
if (obj.Owner.Player.ContainsFlag((ulong)MsgUpdate.Flags.Dead))
continue;
attacked = obj as Player;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.Player.FrozenStamp = Time32.Now;
attacked.Owner.Player.FrozenTime = 5;
MsgRaceTrackStatus update = new MsgRaceTrackStatus(true);
update.UID = attacked.UID;
update.Add(MsgRaceTrackStatus.Freeze, 0, 5);
attacked.Owner.SendScreen(update, true);
attacked.AddFlag((ulong)MsgUpdate.Flags.Freeze);
}
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacked.Owner.SendScreen(suse, true);
}
#endregion
}
#endregion
#region TreatoDragon
if (attacker.Name == "TeratoDragon" || attacker.Name == "LavaBeast" || attacker.Name == "ShadowClone")
{
uint rand = (uint)Mr.HaMoOo.Kernel.Random.Next(1, 7);
switch (rand)
{
case 1:
attacker.MonsterInfo.SpellID = 7014;
break;
case 2:
attacker.MonsterInfo.SpellID = 7017;
break;
case 3:
attacker.MonsterInfo.SpellID = 7017;
break;
case 4:
attacker.MonsterInfo.SpellID = 7012;
break;
case 5:
attacker.MonsterInfo.SpellID = 7013;
break;
case 6:
attacker.MonsterInfo.SpellID = 7015;
break;
case 7:
attacker.MonsterInfo.SpellID = 7016;
break;
}
#region TD Area
if (attacker.MonsterInfo.SpellID == 7014 || attacker.MonsterInfo.SpellID == 7017)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = 0;
damage += (uint)Kernel.Random.Next(1000, 2000);
suse.Effect = attack.Effect;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
foreach (var obj in attacked.Owner.Screen.Objects)
{
if (Calculations.InBox(obj.X, obj.Y, attacker.X, attacker.Y, 14))
{
if (obj.MapObjType == MapObjectType.Player)
{
if (obj.Owner.Player.ContainsFlag((ulong)MsgUpdate.Flags.Dead))
continue;
attacked = obj as Player;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
}
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacked.Owner.SendScreen(suse, true);
}
}
#endregion
#region 2nd skill
if (attacker.MonsterInfo.SpellID == 7013)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = 0;
damage += (uint)Kernel.Random.Next(1000, 2000);
suse.Effect = attack.Effect;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.FrightenStamp = Time32.Now;
attacked.Owner.Player.Fright = 5;
var upd = new MsgRaceTrackStatus(true);
upd.UID = attacked.UID;
upd.Add(MsgRaceTrackStatus.Dizzy, 0, 5);
attacked.Owner.SendScreen(upd, true);
attacked.Owner.Player.AddFlag((ulong)MsgUpdate.Flags.FreezeSmall);
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
foreach (var obj in attacked.Owner.Screen.Objects)
{
if (Calculations.InBox(obj.X, obj.Y, attacker.X, attacker.Y, 14))
{
if (obj.MapObjType == MapObjectType.Player)
{
if (obj.Owner.Player.ContainsFlag((ulong)MsgUpdate.Flags.Dead))
continue;
attacked = obj as Player;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.FrightenStamp = Time32.Now;
attacked.Owner.Player.Fright = 5;
var upd = new MsgRaceTrackStatus(true);
upd.UID = attacked.UID;
upd.Add(MsgRaceTrackStatus.Dizzy, 0, 5);
attacked.Owner.SendScreen(upd, true);
attacked.Owner.Player.AddFlag((ulong)MsgUpdate.Flags.FreezeSmall);
}
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacked.Owner.SendScreen(suse, true);
}
#endregion
#region Chill
if (attacker.MonsterInfo.SpellID == 7015)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = 0;
damage += (uint)Kernel.Random.Next(1000, 2000);
suse.Effect = attack.Effect;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.FrightenStamp = Time32.Now;
var upd = new MsgRaceTrackStatus(true);
upd.UID = attacked.UID;
upd.Add(MsgRaceTrackStatus.Flustered, 0, 5);
attacked.Owner.SendScreen(upd, true);
attacked.Owner.Player.AddFlag((ulong)MsgUpdate.Flags.ChaosCycle);
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
foreach (var obj in attacked.Owner.Screen.Objects)
{
if (Calculations.InBox(obj.X, obj.Y, attacker.X, attacker.Y, 14))
{
if (obj.MapObjType == MapObjectType.Player)
{
if (obj.Owner.Player.ContainsFlag((ulong)MsgUpdate.Flags.Dead))
continue;
attacked = obj as Player;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.FrightenStamp = Time32.Now;
var upd = new MsgRaceTrackStatus(true);
upd.UID = attacked.UID;
upd.Add(MsgRaceTrackStatus.Flustered, 0, 5);
attacked.Owner.SendScreen(upd, true);
attacked.Owner.Player.AddFlag((ulong)MsgUpdate.Flags.ChaosCycle);
}
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacked.Owner.SendScreen(suse, true);
}
#endregion
#endregion
#region SwordMaster
if (attacker.Name == "SwordMaster" || attacker.Name == "HollowBeast")
{
uint rand = (uint)Mr.HaMoOo.Kernel.Random.Next(1, 5);
switch (rand)
{
case 1:
attacker.MonsterInfo.SpellID = 10502;
break;
case 2:
attacker.MonsterInfo.SpellID = 10504;
break;
case 3:
attacker.MonsterInfo.SpellID = 10506;
break;
case 4:
attacker.MonsterInfo.SpellID = 10505;
break;
case 5:
attacker.MonsterInfo.SpellID = 10500;
break;
}
uint damage = 0;
damage += (uint)Kernel.Random.Next(1000, 2000);
if (attacked.Hitpoints <= damage)
attacked.Die(attacker);
else
attacked.Hitpoints -= damage;
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
attacked.Owner.SendScreen(suse, true);
}
#endregion
#region ThrillingSpook
if (attacker.Name == "ThrillingSpook" || attacker.Name == "ThrillingSpook2" || attacker.Name == "ThrillingSpook3")
{
uint rand = (uint)Kernel.Random.Next(1, 7);
switch (rand)
{
case 1: attacker.MonsterInfo.SpellID = 10363; break;
case 2:
{
if (!attacked.ContainsFlag((ulong)MsgUpdate.Flags.Stun))
{
attacker.MonsterInfo.SpellID = 10360;
attacked.AddFlag((ulong)MsgUpdate.Flags.Stun);
attacked.ShockStamp = Time32.Now;
attacked.Shock = 5;
var upd = new MsgRaceTrackStatus(true);
upd.UID = attacked.UID;
upd.Add(MsgRaceTrackStatus.SoulShacle, 0, 5);
attacked.Owner.SendScreen(upd, true);
}
break;
}
case 3: attacker.MonsterInfo.SpellID = 10362; break;
case 4: attacker.MonsterInfo.SpellID = 10363; break;
case 5: attacker.MonsterInfo.SpellID = 10363; break;
case 6: attacker.MonsterInfo.SpellID = 10362; break;
case 7:
if (!attacked.ContainsFlag((ulong)MsgUpdate.Flags.Stun))
{
attacker.MonsterInfo.SpellID = 10361;
attacked.AddFlag((ulong)MsgUpdate.Flags.Stun);
attacked.ShockStamp = Time32.Now;
attacked.Shock = 5;
var upd1 = new MsgRaceTrackStatus(true);
upd1.UID = attacked.UID;
upd1.Add(MsgRaceTrackStatus.SoulShacle, 0, 5);
attacked.Owner.SendScreen(upd1, true);
}
break;
}
uint damage = 0;
damage += (uint)Kernel.Random.Next(1000, 2000);
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
attacked.Owner.SendScreen(suse, true);
}
#endregion
#region ThunderCloud
if (attacker.Name == "Thundercloud")
{
if (attacker.Owner.Player.PKMode != Game.Enums.PKMode.PK &&
attacker.Owner.Player.PKMode != Game.Enums.PKMode.Team) return;
if (Kernel.GamePool.ContainsKey(attacker.OwnerUID))
{
var owner = Kernel.GamePool[attacker.OwnerUID];
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 MsgInteract(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.InteractType = Network.GamePackets.MsgInteract.Kill;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Damage = 1;
uint damage2 = (uint)(Calculate.Melee(owner.Player, attacked, ref attack) * spell.FirstDamage / 100);
if (attacker.SpawnPacket[50] == 128)//ThunderBolt
damage2 = (uint)(damage2 * percent / 100);
MsgMagicEffect suse2 = new MsgMagicEffect(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.OwnerUID == 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
#region Guard
if (attacker.Name == "Guard1")
{
uint rand = (uint)Kernel.Random.Next(1, 15);
switch (rand)
{
case 1:
attacker.MonsterInfo.SpellID = 7012;
break;
case 2:
attacker.MonsterInfo.SpellID = 7013;
break;
case 3:
attacker.MonsterInfo.SpellID = 7015;
break;
case 4:
attacker.MonsterInfo.SpellID = 7016;
break;
case 5:
attacker.MonsterInfo.SpellID = 7017;
break;
case 6:
attacker.MonsterInfo.SpellID = 10001;
break;
case 7:
attacker.MonsterInfo.SpellID = 10363;
break;
case 8:
attacker.MonsterInfo.SpellID = 10362;
break;
case 9:
attacker.MonsterInfo.SpellID = 10502;
break;
case 10:
attacker.MonsterInfo.SpellID = 10504;
break;
case 11:
attacker.MonsterInfo.SpellID = 10506;
break;
case 12:
attacker.MonsterInfo.SpellID = 10505;
break;
case 13:
attacker.MonsterInfo.SpellID = 30012;
break;
case 14:
attacker.MonsterInfo.SpellID = 10001;
break;
case 15:
attacker.MonsterInfo.SpellID = 30015;
break;
}
uint damage = 0;
damage += (uint)Kernel.Random.Next(50000, 60000);
if (attacked == null)
return;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
attacked.Owner.SendScreen(suse, true);
}
#endregion
}
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
attack.Attacker = attacker.UID;
attack.Attacked = attacker.MonsterInfo.ID;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.InteractType = MsgInteract.ShowUseSpell;
attack.MonsterSpellID = attacker.MonsterInfo.SpellID;
attacker.MonsterInfo.SendScreen(attack);
if (attacker.MonsterInfo.SpellID == 0)
{
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack);
#region RevengeTaill
if (attacked.ContainsFlag4((ulong)Network.GamePackets.MsgUpdate.Flags4.RevengeTaill))
{
if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
{
var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
if (damage <= spelll.Power)
{
MsgMagicEffect suses = new MsgMagicEffect(true);
suses.Attacker = attacked.UID;
suses.Attacker1 = attacker.UID;
suses.SpellID = 13030;
suses.SpecialEffect = 1;
suses.AddTarget(attacker.UID, damage, null);
if (attacker.Hitpoints <= damage)
{
attacker.Die(attacked);
}
else
{
attacker.Hitpoints -= damage;
}
attacked.Owner.SendScreen(suses, true);
}
}
}
#endregion
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.InteractType = MsgInteract.Melee;
attack.Damage = damage;
attack.X = attacked.X;
attack.Y = attacked.Y;
if (attacked.Hitpoints <= damage)
{
if (attacked.InHangUp)
{
MsgHangUp AutoHunt = new MsgHangUp();
AutoHunt.Action = MsgHangUp.Mode.KilledBy;
AutoHunt.Unknown = 3329;
AutoHunt.KilledName = attacker.MonsterInfo.Name;
AutoHunt.EXPGained = attacked.HangUpEXP;
attacked.Owner.Send(AutoHunt.ToArray());
attacked.AutoRevStamp = Time32.Now;
attacked.AutoRev = 20;
}
attacked.Owner.SendScreen(attack, true);
attacked.Die(attacker.UID);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.SendScreen(attack, true);
}
}
else
{
MsgMagicEffect suse = new MsgMagicEffect(true);
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Magic(attacker, attacked, attacker.MonsterInfo.SpellID, 0, ref attack);
#region RevengeTaill
if (attacked.ContainsFlag4((ulong)Network.GamePackets.MsgUpdate.Flags4.RevengeTaill))
{
if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
{
var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
if (damage <= spelll.Power)
{
MsgMagicEffect suses = new MsgMagicEffect(true);
suses.Attacker = attacked.UID;
suses.Attacker1 = attacker.UID;
suses.SpellID = 13030;
suses.SpecialEffect = 1;
suses.AddTarget(attacker.UID, damage, null);
if (attacker.Hitpoints <= damage)
{
attacker.Die(attacked);
}
else
{
attacker.Hitpoints -= damage;
}
attacked.Owner.SendScreen(suses, true);
}
}
}
#endregion
suse.Effect = attack.Effect;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker.UID);
if (attacked.InHangUp)
{
MsgHangUp AutoHunt = new MsgHangUp();
AutoHunt.Action = MsgHangUp.Mode.KilledBy;
AutoHunt.Unknown = 3329;
AutoHunt.KilledName = attacker.MonsterInfo.Name;
AutoHunt.EXPGained = attacked.HangUpEXP;
attacked.Owner.Send(AutoHunt.ToArray());
attacked.AutoRevStamp = Time32.Now;
attacked.AutoRev = 20;
}
}
else
{
attacked.Hitpoints -= damage;
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
attacked.Owner.SendScreen(suse, true);
}
}
else
{
if (attacker.MonsterInfo.SpellID == 0)
{
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack);
#region RevengeTaill
if (attacked.ContainsFlag4((ulong)Network.GamePackets.MsgUpdate.Flags4.RevengeTaill))
{
if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
{
var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
if (damage <= spelll.Power)
{
MsgMagicEffect suses = new MsgMagicEffect(true);
suses.Attacker = attacked.UID;
suses.Attacker1 = attacker.UID;
suses.SpellID = 13030;
suses.SpecialEffect = 1;
suses.AddTarget(attacker.UID, damage, null);
if (attacker.Hitpoints <= damage)
{
attacker.Die(attacked);
}
else
{
attacker.Hitpoints -= damage;
}
attacked.Owner.SendScreen(suses, true);
}
}
}
#endregion
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.InteractType = MsgInteract.Melee;
attack.Damage = damage;
attack.X = attacked.X;
attack.Y = attacked.Y;
attacked.MonsterInfo.SendScreen(attack);
if (attacker.Companion)
if (damage > attacked.Hitpoints)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
else attacker.Owner.IncreaseExperience(damage, true);
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
attack = new MsgInteract(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.InteractType = Network.GamePackets.MsgInteract.Kill;
attack.X = attacked.X;
attack.Y = attacked.Y;
attacked.MonsterInfo.SendScreen(attack);
}
else
{
attacked.Hitpoints -= damage;
}
}
else
{
MsgMagicEffect suse = new MsgMagicEffect(true);
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
#region ThunderCloud
if (attacker.Name == "Thundercloud")
{
if (attacker.Owner.Player.PKMode != Game.Enums.PKMode.PK &&
attacker.Owner.Player.PKMode != Game.Enums.PKMode.Team) return;
if (Kernel.GamePool.ContainsKey(attacker.OwnerUID))
{
var owner = Kernel.GamePool[attacker.OwnerUID];
var spell = Database.SpellTable.GetSpell(12840, owner);
var spell2 = Database.SpellTable.GetSpell(12970, owner);
uint damage2 = (uint)(Calculate.Melee(owner.Player, attacked, ref attack) * (spell.Level < 8 ? spell.FirstDamage : 50) / 100);
if (attacker.SpawnPacket[50] == 128)
damage2 = (uint)(damage2 * spell2.FirstDamage);
MsgMagicEffect suse2 = new MsgMagicEffect(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 = new MsgInteract(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.InteractType = Network.GamePackets.MsgInteract.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
uint damage = Calculate.Magic(attacker, attacked, attacker.MonsterInfo.SpellID, 0, ref attack);
#region RevengeTaill
if (attacked.ContainsFlag4((ulong)Network.GamePackets.MsgUpdate.Flags4.RevengeTaill))
{
if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
{
var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
if (damage <= spelll.Power)
{
MsgMagicEffect suses = new MsgMagicEffect(true);
suses.Attacker = attacked.UID;
suses.Attacker1 = attacker.UID;
suses.SpellID = 13030;
suses.SpecialEffect = 1;
suses.AddTarget(attacker.UID, damage, null);
if (attacker.Hitpoints <= damage)
{
attacker.Die(attacked);
}
else
{
attacker.Hitpoints -= damage;
}
attacked.Owner.SendScreen(suses, true);
}
}
}
#endregion
suse.Effect = attack.Effect;
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
attacked.MonsterInfo.SendScreen(suse);
if (attacker.Companion)
if (damage > attacked.Hitpoints)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
else
attacker.Owner.IncreaseExperience(damage, true);
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
attack = new MsgInteract(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.InteractType = Network.GamePackets.MsgInteract.Kill;
attack.X = attacked.X;
attack.Y = attacked.Y;
attacked.MonsterInfo.SendScreen(attack);
}
else
{
attacked.Hitpoints -= damage;
}
}
}
}
#endregion
#region Player -> Player \ Monster \ Sob Npc
else
{
#region Merchant
if (attack.InteractType == MsgInteract.MerchantAccept || attack.InteractType == MsgInteract.MerchantRefuse)
{
attacker.AttackPacket = null; return;
}
#endregion
#region Marriage
if (attack.InteractType == MsgInteract.MarriageAccept || attack.InteractType == MsgInteract.MarriageRequest)
{
if (attack.InteractType == MsgInteract.MarriageRequest)
{
Client.GameState Spouse = null;
uint takeout = attack.Attacked;
if (takeout == attacker.UID)
takeout = attack.Attacker;
if (Kernel.GamePool.TryGetValue(takeout, out Spouse))
{
MsgRelation Relation = new MsgRelation();
Relation.Requester = attacker.UID;
Relation.Receiver = Spouse.Player.UID;
Relation.Level = attacker.Level;
Relation.BattlePower = (uint)attacker.BattlePower;
Relation.Spouse = attacker.Name == Spouse.Player.Spouse;
Relation.Friend = attacker.Owner.Friends.ContainsKey(Spouse.Player.UID);
Relation.TradePartner = attacker.Owner.Partners.ContainsKey(Spouse.Player.UID);
if (attacker.Owner.Mentor != null)
Relation.Mentor = attacker.Owner.Mentor.ID == Spouse.Player.UID;
Relation.Apprentice = attacker.Owner.Apprentices.ContainsKey(Spouse.Player.UID);
if (attacker.Owner.Team != null)
Relation.Teammate = attacker.Owner.Team.IsTeammate(Spouse.Player.UID);
if (attacker.Owner.Guild != null)
Relation.GuildMember = attacker.Owner.Guild.Members.ContainsKey(Spouse.Player.UID);
Relation.Enemy = attacker.Owner.Enemy.ContainsKey(Spouse.Player.UID);
Spouse.Send(Relation);
if (attacker.Spouse != "None" || Spouse.Player.Spouse != "None")
{
attacker.Owner.Send(new MsgTalk("You cannot marry someone that is already married with someone else!", Color.Black, MsgTalk.TopLeft));
}
else
{
uint id1 = attacker.Mesh % 10, id2 = Spouse.Player.Mesh % 10;
if (id1 <= 2 && id2 >= 3 || id1 >= 2 && id2 <= 3)
{
attack.X = Spouse.Player.X;
attack.Y = Spouse.Player.Y;
Spouse.Send(attack);
}
else
{
attacker.Owner.Send(new MsgTalk("You cannot marry someone of your gender!", Color.Black, MsgTalk.TopLeft));
}
}
}
}
else
{
Client.GameState Spouse = null;
if (Kernel.GamePool.TryGetValue(attack.Attacked, out Spouse))
{
if (attacker.Spouse != "None" || Spouse.Player.Spouse != "None")
{
attacker.Owner.Send(new MsgTalk("You cannot marry someone that is already married with someone else!", Color.Black, MsgTalk.TopLeft));
}
else
{
if (attacker.Mesh % 10 <= 2 && Spouse.Player.Mesh % 10 >= 3 || attacker.Mesh % 10 >= 3 && Spouse.Player.Mesh % 10 <= 2)
{
Spouse.Player.Spouse = attacker.Name;
attacker.Spouse = Spouse.Player.Name;
MsgTalk message = null;
if (Spouse.Player.Mesh % 10 >= 3)
message = new MsgTalk("Joy and happiness! " + Spouse.Player.Name + " and " + attacker.Name + " have joined together in the holy marriage. We wish them a stone house.", Color.BurlyWood, MsgTalk.Center);
else message = new MsgTalk("Joy and happiness! " + attacker.Name + " and " + attacker.Spouse + " have joined together in the holy marriage. We wish them a stone house.", Color.BurlyWood, MsgTalk.Center);
foreach (Client.GameState client in Server.GamePool)
{
client.Send(message);
}
Spouse.Player.Update(MsgName.Mode.Effect, "firework-2love", true);
attacker.Update(MsgName.Mode.Effect, "firework-2love", true);
}
else
{
attacker.Owner.Send(new MsgTalk("You cannot marry someone of your gender!", System.Drawing.Color.Black, MsgTalk.TopLeft));
}
}
}
}
}
#endregion
#region Attacking
else
{
attacker.Owner.Attackable = true;
Player attacked = null;
MsgNpcInfoEX attackedsob = null;
MsgMapItem attackedItem = null;
#region Checks
if (attack.Attacker != attacker.UID) return;
if (attacker.PlayerFlag != PlayerFlag.Player) return;
attacker.RemoveFlag((ulong)MsgUpdate.Flags.Invisibility);
bool pass = false;
if (attack.InteractType == MsgInteract.Melee)
{
if (attacker.OnFatalStrike())
{
if (attack.Attacked < 600000)
{
pass = true;
}
}
}
ushort decrease = 0;
if (attacker.OnCyclone())
decrease = 1;
if (attacker.OnSuperman())
decrease = 300;
if (!pass && attack.InteractType != MsgInteract.Magic)
{
int milliSeconds = 1000 - attacker.Agility - decrease;
if (milliSeconds < 0 || milliSeconds > 5000)
milliSeconds = 0;
if (Time32.Now < attacker.AttackStamp.AddMilliseconds(milliSeconds)) return;
attacker.AttackStamp = Time32.Now;
}
if (attacker.Dead)
{
if (attacker.AttackPacket != null)
attacker.AttackPacket = null; return;
}
if (attacker.Owner.InQualifier())
{
if (Time32.Now < attacker.Owner.ImportTime().AddSeconds(12))
{
return;
}
}
bool doWep1Spell = false, doWep2Spell = false;
restart:
#region Extract attack information
ushort SpellID = 0, X = 0, Y = 0;
uint Target = 0;
if (attack.InteractType == MsgInteract.Magic)
{
if (!attack.Decoded)
{
#region GetSkillID
SpellID = Convert.ToUInt16(((long)attack.ToArray()[24 + 4] & 0xFF) | (((long)attack.ToArray()[25 + 4] & 0xFF) << 8));
SpellID ^= (ushort)0x915d;
SpellID ^= (ushort)attacker.UID;
SpellID = (ushort)(SpellID << 0x3 | SpellID >> 0xd);
SpellID -= 0xeb42;
#endregion
#region GetCoords
X = (ushort)((attack.ToArray()[16 + 4] & 0xFF) | ((attack.ToArray()[17 + 4] & 0xFF) << 8));
X = (ushort)(X ^ (uint)(attacker.UID & 0xffff) ^ 0x2ed6);
X = (ushort)(((X << 1) | ((X & 0x8000) >> 15)) & 0xffff);
X = (ushort)((X | 0xffff0000) - 0xffff22ee);
Y = (ushort)((attack.ToArray()[18 + 4] & 0xFF) | ((attack.ToArray()[19 + 4] & 0xFF) << 8));
Y = (ushort)(Y ^ (uint)(attacker.UID & 0xffff) ^ 0xb99b);
Y = (ushort)(((Y << 5) | ((Y & 0xF800) >> 11)) & 0xffff);
Y = (ushort)((Y | 0xffff0000) - 0xffff8922);
#endregion
#region GetTarget
Target = ((uint)attack.ToArray()[12 + 4] & 0xFF) | (((uint)attack.ToArray()[13 + 4] & 0xFF) << 8) | (((uint)attack.ToArray()[14 + 4] & 0xFF) << 16) | (((uint)attack.ToArray()[15 + 4] & 0xFF) << 24);
Target = ((((Target & 0xffffe000) >> 13) | ((Target & 0x1fff) << 19)) ^ 0x5F2D2463 ^ attacker.UID) - 0x746F4AE6;
#endregion
attack.X = X;
attack.Y = Y;
attack.Damage = SpellID;
attack.Attacked = Target;
attack.Decoded = true;
}
else
{
X = attack.X;
Y = attack.Y;
SpellID = (ushort)attack.Damage;
Target = attack.Attacked;
}
}
#endregion
if (!pass && attack.InteractType == MsgInteract.Magic)
{
if (!(doWep1Spell || doWep2Spell))
{
if (SpellID == 1045 || SpellID == 1046 || SpellID == 11005 || SpellID == 11000 || SpellID == 1100)
{
}
else
{
int milliSeconds = 1000 - attacker.Agility - decrease;
if (milliSeconds < 0 || milliSeconds > 5000)
milliSeconds = 0;
if (Time32.Now < attacker.AttackStamp.AddMilliseconds(milliSeconds)) return;
}
attacker.AttackStamp = Time32.Now;
}
}
#endregion
if (attacker.Owner.Screen.TryGetFloorItem(Target, out attackedItem))
{
LotusAttack(attackedItem, attacker, attack);
return;
}
if (attacker.MapID == SteedRace.MAPID)
{
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Ride))
{
QuitSteedRace(attacker);
}
return;
}
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Ride) && attacker.Owner.Equipment.TryGetItem(18) == null)
{
if (attack.InteractType != MsgInteract.Magic)
attacker.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
else if (!(SpellID == 7003 || SpellID == 7002))
attacker.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
}
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.CastPray))
attacker.RemoveFlag((ulong)MsgUpdate.Flags.CastPray);
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Praying))
attacker.RemoveFlag((ulong)MsgUpdate.Flags.Praying);
#region Dash
if (SpellID == 1051)
{
if (Kernel.GetDistance(attack.X, attack.Y, attacker.X, attacker.Y) > 4)
{
attacker.Owner.Disconnect(); return;
}
attacker.X = attack.X; attacker.Y = attack.Y;
ushort x = attacker.X, y = attacker.Y;
Map.UpdateCoordonatesForAngle(ref x, ref y, (Enums.ConquerAngle)Target);
foreach (IMapObject obj in attacker.Owner.Screen.Objects)
{
if (obj == null) continue;
if (obj.X == x && obj.Y == y && (obj.MapObjType == MapObjectType.Monster || obj.MapObjType == MapObjectType.Player))
{
Player Player = obj as Player;
if (!Player.Dead)
{
Target = obj.UID;
break;
}
}
}
}
#endregion
#region CounterKill
if (attack.InteractType == MsgInteract.CounterKillSwitch)
{
if (attacked != null)
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly))
{
attacker.AttackPacket = null; return;
}
if (attacker != null)
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Fly))
{
attacker.AttackPacket = null; return;
}
if (attacker.Owner.Spells.ContainsKey(6003))
{
if (!attacker.CounterKillSwitch)
{
if (Time32.Now >= attacker.CounterKillStamp.AddSeconds(30))
{
attacker.CounterKillStamp = Time32.Now;
attacker.CounterKillSwitch = true;
MsgInteract m_attack = new MsgInteract(true);
m_attack.Attacked = attacker.UID;
m_attack.Attacker = attacker.UID;
m_attack.InteractType = MsgInteract.CounterKillSwitch;
m_attack.Damage = 1;
m_attack.X = attacker.X;
m_attack.Y = attacker.Y;
m_attack.Send(attacker.Owner);
}
}
else
{
attacker.CounterKillSwitch = false;
MsgInteract m_attack = new MsgInteract(true);
m_attack.Attacked = attacker.UID;
m_attack.Attacker = attacker.UID;
m_attack.InteractType = MsgInteract.CounterKillSwitch;
m_attack.Damage = 0;
m_attack.X = attacker.X;
m_attack.Y = attacker.Y;
m_attack.Send(attacker.Owner);
}
attacker.Owner.IncreaseSpellExperience(100, 6003);
attacker.AttackPacket = null;
}
}
#endregion
#region Melee
else if (attack.InteractType == MsgInteract.Melee)
{
if (attacker.IsBowEquipped)
{
attack.InteractType = MsgInteract.Ranged;
new Game.Attacking.Handle(attack, attacker, attacked);
return;
}
if (attacker.Owner.Screen.TryGetValue(attack.Attacked, out attacked))
{
var spell = SpellTable.GetSpell(attack.SpellID, 0);
if (attacker.Owner.Spells.ContainsKey(attack.SpellID))
spell = SpellTable.GetSpell(attack.SpellID, attacker.Owner.Spells[attack.SpellID].Level);
if (attack.SpellID == 12580 ||
attack.SpellID == 12590 ||
attack.SpellID == 12600 ||
attack.SpellID == 12570 ||
attack.SpellID == 12220 ||
attack.SpellID == 12210)
attack.InteractType = MsgInteract.Magic;
switch (attack.SpellID)
{
#region UpSweep
case 12580://up
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacked == null)
return;
var angle = Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y);
Map.UpdateCoordonatesForAngle(ref X, ref Y, angle);
Fan sector = new Fan(attacker.X, attacker.Y, X, Y, spell.Range, spell.Sector);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (Kernel.GetDistance(attacker.X, attacker.Y, _obj.X, _obj.Y) <= 7)
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (sector.IsInFan(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.6);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (sector.IsInFan(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region DownSweep
case 12590://down
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacked == null)
return;
var angle = Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y);
angle = Enums.OppositeAngle(angle);
Map.UpdateCoordonatesForAngle(ref X, ref Y, angle);
Fan sector = new Fan(attacker.X, attacker.Y, X, Y, spell.Range, spell.Sector);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (Kernel.GetDistance(attacker.X, attacker.Y, _obj.X, _obj.Y) <= 7)
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (sector.IsInFan(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.6);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
;
if (sector.IsInFan(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region strike
case 12600:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
{
if (attackedsob != null)
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
else
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.7);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
attacker.AttackPacket = null;
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
attacker.AttackPacket = null;
break;
}
#endregion
#region WrathOfEmperor
case 12570:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.SpecialEffect = 1;
suse.X = X;
suse.Y = Y;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly))
return;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
default:
break;
}
#region EarthSweep
if (attack.SpellID == 12220 || attack.SpellID == 12210)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = attack.SpellID;
suse.SpellLevel = 0;
suse.X = attacker.X;
suse.Y = attacker.Y;
Fan fan = new Fan(attacker.X, attacker.Y, attacked.X, attacked.Y, 7, 180);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster ||
_obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= 7)
{
if (CanAttack(attacker, attacked, null, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker,
attacked, ref attack);
attack.Attacked = 0;
attack.Damage = damage;
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, null);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
attacker.AttackPacket = null;
attack = null;
return;
}
#endregion
#region Stomper(Melee)
#region Anger-Horror-Peace~of~Stomper(Windwalker-Stomper-Passive)
var lastattacked = attacked;
var spell5 = Database.SpellTable.GetSpell(12980, attacker.Owner);
if (Kernel.Rate(spell5.Percent) && attacker.Owner.Spells.ContainsKey(12980) && attacker.IsStomper2())
{
#region AngerofStomper
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell5.ID;
suse.SpellLevel = spell5.Level;
suse.X = lastattacked.X;
suse.Y = lastattacked.Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
attacked = _obj as Player;
if (attacked == null) continue;
if (Kernel.GetDistance(attacked.X, attacked.Y, attacker.X, attacker.Y) <= spell5.Range)
{
if (_obj.MapObjType == MapObjectType.Player)
{
if (!CanAttack(attacker, attacked, null, attack.InteractType == MsgInteract.Melee)) continue;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack) * (spell5.Power - 30000) / 100;
damage = (uint)(damage * 0.5);
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell5);
suse.AddTarget(attacked.UID, damage, attack);
}
else if (_obj.MapObjType == MapObjectType.Monster)
{
if (!CanAttack(attacker, attacked, null, attack.InteractType == MsgInteract.Melee)) continue;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack) * (uint)((spell5.SecondDamage - 30000) / 100);
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell5);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacker.AttackPacket = null;
attacker.Owner.SendScreen(suse, true);
}
#endregion
#region HorrorofStomper
{
var spell2 = Database.SpellTable.GetSpell(12990, attacker.Owner);
if (!attacker.Owner.Spells.ContainsKey(12990)) return;
attack.Damage = 0;
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell2.ID;
suse.SpellLevel = spell2.Level;
suse.X = lastattacked.X;
suse.Y = lastattacked.Y;
attacker.AttackPacket = null;
attacker.Owner.SendScreen(suse, true);
#region Flooritem
var map = Kernel.Maps[attacker.MapID];
Network.GamePackets.MsgMapItem flooritem = new Network.GamePackets.MsgMapItem(true);
flooritem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
while (map.Npcs.ContainsKey(flooritem.UID))
flooritem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
flooritem.ItemID = 1530;
flooritem.X = lastattacked.X;
flooritem.Y = lastattacked.Y;
flooritem.Type = MsgMapItem.Effect;
flooritem.mColor = 14;
flooritem.OwnerUID = attacker.UID;
flooritem.OwnerGuildUID = attacker.GuildID;
flooritem.FlowerType = 3;
flooritem.Unknown37 = 1;
flooritem.X2 = attacker.X;
flooritem.Y2 = attacker.Y;
flooritem.Angle = attacker.Facing;
flooritem.MapID = map.ID;
flooritem.Attack = attack;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
#endregion
}
#endregion
#region PeaceofStomper
{
var spell3 = Database.SpellTable.GetSpell(13000, attacker.Owner);
if (!attacker.Owner.Spells.ContainsKey(13000)) return;
attack.Damage = 0;
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellLevel = spell3.Level;
suse.SpellID = spell3.ID;
suse.X = lastattacked.X;
suse.Y = lastattacked.Y;
attacker.AttackPacket = null;
attacker.Owner.SendScreen(suse, true);
#region Flooritem
var map = Kernel.Maps[attacker.MapID];
Network.GamePackets.MsgMapItem flooritem = new Network.GamePackets.MsgMapItem(true);
flooritem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
while (map.Npcs.ContainsKey(flooritem.UID))
flooritem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
flooritem.ItemID = 1540;
flooritem.X = lastattacked.X;
flooritem.Y = lastattacked.Y;
flooritem.X2 = attacker.X;
flooritem.Y2 = attacker.Y;
flooritem.Type = MsgMapItem.Effect;
flooritem.mColor = 14;
flooritem.OwnerUID = attacker.UID;
flooritem.OwnerGuildUID = attacker.GuildID;
flooritem.FlowerType = 3;
flooritem.Unknown37 = 1;
flooritem.MapID = map.ID;
flooritem.Attack = attack;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
#endregion
}
#endregion
return;
}
#endregion
else if (attacker.IsStomper1())
{
#region Sector-Circle-Rectangle(Windwalker-Stomper-Melee)
if (attack.SpellID == 13040 || attack.SpellID == 13050 || attack.SpellID == 13060)
{
#region Sector
if (attack.SpellID == 13040)
{
var spell2 = Database.SpellTable.GetSpell(13040, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = attack.SpellID;
suse.X = attacker.X;
suse.Y = attacker.Y;
var angle = Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y);
Map.UpdateCoordonatesForAngle(ref X, ref Y, angle);
Fan sector = new Fan(attacker.X, attacker.Y, X, Y, spell2.Range, spell2.Sector);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 7)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Player || _obj.MapObjType == MapObjectType.Monster)
{
if (_obj == null)
continue;
attacked = _obj as Player;
if (attacked == null) continue;
if (!CanAttack(attacker, attacked, null, attack.InteractType == MsgInteract.Melee)) continue;
if (sector.IsInFan(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell2, attack.InteractType == MsgInteract.Melee))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, spell2);
damage = (uint)(damage * 0.5);
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell2);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
}
}
}
#endregion
#region Circle
if (attack.SpellID == 13050)
{
var spell2 = Database.SpellTable.GetSpell(13050, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = attack.SpellID;
suse.X = attacker.X;
suse.Y = attacker.Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Player || _obj.MapObjType == MapObjectType.Monster)
{
if (_obj == null)
continue;
attacked = _obj as Player;
if (attacked == null) continue;
if (!CanAttack(attacker, attacked, null, attack.InteractType == MsgInteract.Melee)) continue;
if (Kernel.GetDistance(attacked.X, attacked.Y, attacker.X, attacker.Y) > 5) continue;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.5);
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell2);
suse.AddTarget(attacked.UID, damage, attack);
}
}
attacker.Owner.SendScreen(suse, true);
return;
}
#endregion
#region Rectangle
if (attack.SpellID == 13060)
{
var spell2 = Database.SpellTable.GetSpell(13060, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = attack.SpellID;
suse.X = attacker.X;
suse.Y = attacker.Y;
var angle = Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y);
Map.UpdateCoordonatesForAngle(ref X, ref Y, angle);
Fan sector = new Fan(attacker.X, attacker.Y, X, Y, spell2.Range, spell2.Sector);
uint damage2 = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage2, spell2);
suse.AddTarget(attacked.UID, damage2, attack);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Player || _obj.MapObjType == MapObjectType.Monster)
{
if (_obj == null)
continue;
attacked = _obj as Player;
if (attacked == null) continue;
if (!CanAttack(attacker, attacked, null, attack.InteractType == MsgInteract.Melee)) continue;
if (sector.IsInFan(attacked.X, attacked.Y))
{
if (Kernel.GetDistance(attacked.X, attacked.Y, attacker.X, attacker.Y) > 7) continue;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.5);
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell2);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
return;
}
#endregion
}
#endregion
}
#endregion
if (attack.SpellID == 12580 ||
attack.SpellID == 12590 ||
attack.SpellID == 12600 ||
attack.SpellID == 12570 ||
attack.SpellID == 12220 ||
attack.SpellID == 12210)
{
attack.Damage = 0;
attack.InteractType = MsgInteract.Melee;
return;
}
CheckForExtraWeaponPowers(attacker.Owner, attacked);
if (!CanAttack(attacker, attacked, null, attack.InteractType == MsgInteract.Melee)) return;
pass = false;
if (attacker.OnFatalStrike())
{
if (attacked.PlayerFlag == PlayerFlag.Monster)
{
pass = true;
}
}
ushort range = attacker.AttackRange;
if (attacker.Transformed)
range = (ushort)attacker.TransformationAttackRange;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= range || pass)
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.3);
attack.Damage = damage;
if (attacker.OnFatalStrike())
{
if (attacked.PlayerFlag == PlayerFlag.Monster)
{
var weaps = attacker.Owner.Weapons;
bool can = false;
if (weaps.Item1 != null)
if (weaps.Item1 != null) if (weaps.Item1.ID / 1000 == 601 || weaps.Item1.ID / 1000 == 616) can = true; if (weaps.Item2 != null) if (weaps.Item2.ID / 1000 == 601 || weaps.Item2.ID / 1000 == 616) can = true;
can = true;
if (weaps.Item2 != null)
if (weaps.Item1 != null) if (weaps.Item1.ID / 1000 == 601 || weaps.Item1.ID / 1000 == 616) can = true; if (weaps.Item2 != null) if (weaps.Item2.ID / 1000 == 601 || weaps.Item2.ID / 1000 == 616) can = true;
can = true;
if (!can)
return;
ushort x = attacked.X;
ushort y = attacked.Y;
Map.UpdateCoordonatesForAngle(ref x, ref y, Kernel.GetAngle(attacked.X, attacked.Y, attacker.X, attacker.Y));
attacker.Shift(x, y);
attack.X = x;
attack.Y = y;
attack.Damage = damage;
attack.InteractType = MsgInteract.FatalStrike;
}
}
var weapons = attacker.Owner.Weapons;
if (weapons.Item1 != null)
{
MsgItemInfo rightweapon = weapons.Item1;
ushort wep1subyte = (ushort)(rightweapon.ID / 1000), wep2subyte = 0;
bool wep1bs = false, wep2bs = false;
if (wep1subyte == 421 || wep1subyte == 620)
{
wep1bs = true;
wep1subyte = 420;
}
ushort wep1spellid = 0, wep2spellid = 0;
Database.SpellInformation wep1spell = null, wep2spell = null;
if (Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte))
{
var weaponskill = Database.SpellTable.WeaponSpells[wep1subyte];
for (int i = 0; i < weaponskill.Count; i++)
{
if (!doWep1Spell || (Kernel.Rate(50) && weaponskill.Count > 1))
{
wep1spellid = weaponskill[i];
if (attacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid))
{
wep1spell = Database.SpellTable.SpellInformations[wep1spellid][attacker.Owner.Spells[wep1spellid].Level];
doWep1Spell = Kernel.Rate(wep1spell.Percent);
//if (attacked.PlayerFlag == PlayerFlag.Player && wep1spellid == 10490)
// doWep1Spell = Kernel.Rate(5);
}
}
}
}
if (!doWep1Spell)
{
if (weapons.Item2 != null)
{
MsgItemInfo leftweapon = weapons.Item2;
wep2subyte = (ushort)(leftweapon.ID / 1000);
if (wep2subyte == 421 || wep2subyte == 620)
{
wep2bs = true;
wep2subyte = 420;
}
if (Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte))
{
var weaponskill2 = Database.SpellTable.WeaponSpells[wep2subyte];
for (int i = 0; i < weaponskill2.Count; i++)
{
if (!doWep2Spell || (Kernel.Rate(50) && weaponskill2.Count > 1))
{
wep2spellid = weaponskill2[i];
if (attacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid))
{
wep2spell = Database.SpellTable.SpellInformations[wep2spellid][attacker.Owner.Spells[wep2spellid].Level];
doWep2Spell = Kernel.Rate(wep2spell.Percent);
//if (attacked.PlayerFlag == PlayerFlag.Player && wep2spellid == 10490)
// doWep2Spell = Kernel.Rate(5);
}
}
}
}
}
}
if (!attacker.Transformed)
{
if (doWep1Spell)
{
attack.InteractType = MsgInteract.Magic;
attack.Decoded = true;
attack.CheckWeponSpell = true;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Attacked = attacked.UID;
attack.Damage = wep1spell.ID;
goto restart;
}
if (doWep2Spell)
{
attack.InteractType = MsgInteract.Magic;
attack.Decoded = true;
attack.CheckWeponSpell = true;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Attacked = attacked.UID;
attack.Damage = wep2spell.ID;
goto restart;
}
if (wep1bs)
wep1subyte++;
if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag != PlayerFlag.Player)
if (damage > attacked.Hitpoints)
{
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), wep1subyte);
if (wep2subyte != 0)
{
if (wep2bs)
wep2subyte++;
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), wep2subyte);
}
}
else
{
attacker.Owner.IncreaseProficiencyExperience(damage, wep1subyte);
if (wep2subyte != 0)
{
if (wep2bs)
wep2subyte++;
attacker.Owner.IncreaseProficiencyExperience(damage, wep2subyte);
}
}
}
}
else
{
if (!attacker.Transformed)
{
if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag != PlayerFlag.Player)
if (damage > attacked.Hitpoints)
{
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), 0);
}
else
{
attacker.Owner.IncreaseProficiencyExperience(damage, 0);
}
}
}
ReceiveAttack(attacker, attacked, attack, ref damage, null);
attack.InteractType = MsgInteract.Melee;
}
else
{
attacker.AttackPacket = null;
}
}
else if (attacker.Owner.Screen.TryGetSob(attack.Attacked, out attackedsob))
{
CheckForExtraWeaponPowers(attacker.Owner, null);
if (CanAttack(attacker, attackedsob, null))
{
ushort range = attacker.AttackRange;
if (attacker.Transformed)
range = (ushort)attacker.TransformationAttackRange;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= range)
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
var weapons = attacker.Owner.Weapons;
if (weapons.Item1 != null)
{
MsgItemInfo rightweapon = weapons.Item1;
ushort wep1subyte = (ushort)(rightweapon.ID / 1000), wep2subyte = 0;
bool wep1bs = false, wep2bs = false;
if (wep1subyte == 421 || wep1subyte == 620)
{
wep1bs = true;
wep1subyte = 420;
}
ushort wep1spellid = 0, wep2spellid = 0;
Database.SpellInformation wep1spell = null, wep2spell = null;
if (Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte))
{
var wep1 = Database.SpellTable.WeaponSpells[wep1subyte];
for (int i = 0; i < wep1.Count; i++)
{
if (!doWep1Spell)
{
wep1spellid = wep1[i];
if (attacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid))
{
wep1spell = Database.SpellTable.SpellInformations[wep1spellid][attacker.Owner.Spells[wep1spellid].Level];
doWep1Spell = Kernel.Rate(wep1spell.Percent);
}
}
}
}
if (!doWep1Spell)
{
if (weapons.Item2 != null)
{
MsgItemInfo leftweapon = weapons.Item2;
wep2subyte = (ushort)(leftweapon.ID / 1000);
if (wep2subyte == 421 || wep2subyte == 620)
{
wep2bs = true;
wep2subyte = 420;
}
if (Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte))
{
var wep2 = Database.SpellTable.WeaponSpells[wep2subyte];
for (int i = 0; i < wep2.Count; i++)
{
wep2spellid = wep2[i];
if (attacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid))
{
wep2spell = Database.SpellTable.SpellInformations[wep2spellid][attacker.Owner.Spells[wep2spellid].Level];
doWep2Spell = Kernel.Rate(wep2spell.Percent);
}
}
}
}
}
if (!attacker.Transformed)
{
if (doWep1Spell)
{
attack.InteractType = MsgInteract.Magic;
attack.Decoded = true;
attack.CheckWeponSpell = true;
attack.X = attackedsob.X;
attack.Y = attackedsob.Y;
attack.Attacked = attackedsob.UID;
attack.Damage = wep1spell.ID;
goto restart;
}
if (doWep2Spell)
{
attack.InteractType = MsgInteract.Magic;
attack.Decoded = true;
attack.CheckWeponSpell = true;
attack.X = attackedsob.X;
attack.Y = attackedsob.Y;
attack.Attacked = attackedsob.UID;
attack.Damage = wep2spell.ID;
goto restart;
}
if (attacker.MapID == 1039)
{
if (wep1bs)
wep1subyte++;
if (attacker.PlayerFlag == PlayerFlag.Player)
if (damage > attackedsob.Hitpoints)
{
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attackedsob.Hitpoints), wep1subyte);
if (wep2subyte != 0)
{
if (wep2bs)
wep2subyte++;
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attackedsob.Hitpoints), wep2subyte);
}
}
else
{
attacker.Owner.IncreaseProficiencyExperience(damage, wep1subyte);
if (wep2subyte != 0)
{
if (wep2bs)
wep2subyte++;
attacker.Owner.IncreaseProficiencyExperience(damage, wep2subyte);
}
}
}
}
}
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, null);
}
else
{
attacker.AttackPacket = null;
}
}
}
else
{
attacker.AttackPacket = null;
}
}
#endregion
#region Ranged
else if (attack.InteractType == MsgInteract.Ranged)
{
if (attacker.Owner.Screen.TryGetValue(attack.Attacked, out attacked))
{
CheckForExtraWeaponPowers(attacker.Owner, attacked);
if (!CanAttack(attacker, attacked, null, false))
return;
var weapons = attacker.Owner.Weapons;
if (weapons.Item1 == null) return;
//if ((weapons.Item1.ID / 1000 != 500 && weapons.Item1.ID / 1000 != 613) && !attacker.IsChaser1()) return;
if (weapons.Item1.ID / 1000 != 500 && weapons.Item1.ID / 1000 != 613)
if (weapons.Item1.ID / 1000 == 500)
if (weapons.Item2 != null)
if (!ItemHandler.IsArrow(weapons.Item2.ID)) return;
#region Kinetic Spark
if (attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.KineticSpark))
{
var spell = Database.SpellTable.GetSpell(11590, attacker.Owner);
if (spell != null)
{
spell.CanKill = true;
if (Kernel.Rate(spell.Percent))
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = attacker.X;
suse.Y = attacker.Y;
IMapObject lastAttacked = attacker;
uint p = 0;
if (Handle.CanAttack(attacker, attacked, spell, false))
{
lastAttacked = attacked;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, spell);
suse.Effect = attack.Effect;
damage = damage - damage * (p += 20) / 100;
Handle.ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
if (_obj.UID == attacked.UID) continue;
var attacked1 = _obj as Player;
if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attacked1.X, attacked1.Y) <= 5)
{
if (Handle.CanAttack(attacker, attacked1, spell, false))
{
lastAttacked = attacked1;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked1, ref attack, spell);
suse.Effect = attack.Effect;
damage = damage - damage * (p += 20) / 100;
// damage += (damage * 36) / 100;
if (damage == 0) break;
Handle.ReceiveAttack(attacker, attacked1, attack, ref damage, spell);
suse.AddTarget(attacked1.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attackedsob.X, attackedsob.Y) <= 5)
{
if (Handle.CanAttack(attacker, attackedsob, spell))
{
lastAttacked = attackedsob;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
damage = damage - damage * (p += 20) / 100;
// damage += (damage * 36) / 100;
if (damage == 0) break;
Handle.ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
return;
}
}
}
#endregion
#region ShadowofChaser
if (attacker.ContainsFlag4((ulong)MsgUpdate.Flags4.ShadowofChaser) && attacker.IsChaser2())
{
var spell = Database.SpellTable.GetSpell(13090, attacker.Owner);
if (spell != null)
{
spell.CanKill = true;
if (Kernel.Rate(spell.Percent))
{
ShadowofChaser(attacker, attacked, attack, 1);
return;
}
}
}
#endregion
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= Constants.pScreenDistance)
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = 0;
if (attacker.Assassin() || attacker.IsBowEquipped)
{
damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack) / 2;
damage = (uint)(damage * 0.6);
}
else
{
damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
}
if (attacker.IsChaser1() || attacker.IsBowEquipped)
{
damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack) / 2;
damage = (uint)(damage * 0.2);
}
attack.Damage = damage;
if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag != PlayerFlag.Player)
if (damage > attacked.Hitpoints)
{
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), (ushort)(weapons.Item1.ID / 1000));
}
else
{
attacker.Owner.IncreaseProficiencyExperience(damage, (ushort)(weapons.Item1.ID / 1000));
}
ReceiveAttack(attacker, attacked, attack, ref damage, null);
}
}
else if (attacker.Owner.Screen.TryGetSob(attack.Attacked, out attackedsob))
{
if (CanAttack(attacker, attackedsob, null))
{
if (attacker.Owner.Equipment.TryGetItem(MsgItemInfo.LeftWeapon) == null)
return;
var weapons = attacker.Owner.Weapons;
if (weapons.Item1 == null) return;
if (weapons.Item1.ID / 1000 != 500 && weapons.Item1.ID / 1000 != 613)
if (weapons.Item1.ID / 1000 == 500)
if (attacker.MapID != 1039)
if (weapons.Item1.ID / 1000 == 500)
if (weapons.Item2 != null)
if (!ItemHandler.IsArrow(weapons.Item2.ID))
return;
#region Kinetic Spark
if (attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.KineticSpark))
{
var spell = Database.SpellTable.GetSpell(11590, attacker.Owner);
if (spell != null)
{
spell.CanKill = true;
if (Kernel.Rate(spell.Percent))
{
attacker.RemoveFlag3((ulong)MsgUpdate.Flags3.KineticSpark);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = attacker.X;
suse.Y = attacker.Y;
IMapObject lastAttacked = attacker;
uint p = 0;
if (Handle.CanAttack(attacker, attackedsob, spell))
{
lastAttacked = attackedsob;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
damage = damage - damage * (p += 20) / 100;
//damage += (damage * 36) / 100;
Handle.ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
var attacked1 = _obj as Player;
if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attacked1.X, attacked1.Y) <= 5)
{
if (Handle.CanAttack(attacker, attacked1, spell, false))
{
lastAttacked = attacked1;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked1, ref attack, spell);
suse.Effect = attack.Effect;
damage = damage - damage * (p += 20) / 100;
// damage += (damage * 36) / 100;
if (damage == 0) break;
Handle.ReceiveAttack(attacker, attacked1, attack, ref damage, spell);
suse.AddTarget(attacked1.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
if (_obj.UID == Target) continue;
var attackedsob1 = _obj as MsgNpcInfoEX;
if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attackedsob1.X, attackedsob1.Y) <= 5)
{
if (Handle.CanAttack(attacker, attackedsob1, spell))
{
lastAttacked = attackedsob1;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob1, ref attack);
suse.Effect = attack.Effect;
damage = damage - damage * (p += 20) / 100;
//damage += (damage * 36) / 100;
if (damage == 0) break;
Handle.ReceiveAttack(attacker, attackedsob1, attack, damage, spell);
suse.AddTarget(attackedsob1.UID, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
return;
}
}
}
#endregion
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= Constants.pScreenDistance)
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = 0;
if (!attacker.Assassin())
damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack);
else
damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, null);
if (damage > attackedsob.Hitpoints)
{
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attackedsob.Hitpoints), (ushort)(weapons.Item1.ID / 1000));
}
else
{
attacker.Owner.IncreaseProficiencyExperience(damage, (ushort)(weapons.Item1.ID / 1000));
}
}
}
}
else
{
attacker.AttackPacket = null;
}
}
#endregion
#region Magic
else if (attack.InteractType == MsgInteract.Magic)
{
if (attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.DragonFury)) return;
#region BreathFocus
if (Kernel.Rate(30))
{
if (attacker.Owner != null)
{
if (attacker.Owner.Spells.ContainsKey(11960))
{
if (attacker.Owner.AlternateEquipment)
{
if (attacker.Owner.Equipment.Free(MsgItemInfo.RightWeapon))
{
uint iType = attacker.Owner.Equipment.TryGetItem(MsgItemInfo.AlternateRightWeapon).ID / 1000;
if (iType == 614)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = 11960;
suse.SpellLevel = attacker.Owner.Spells[11960].Level;
suse.X = X;
suse.Y = Y;
if (attacker.HeavenBlessing == 0)
{
attacker.Stamina = (byte)Math.Min((int)(attacker.Stamina + 20), 100);
}
else
attacker.Stamina = (byte)Math.Min((int)(attacker.Stamina + 20), 150);
attacker.Owner.SendScreen(suse, true);
}
}
}
else if (!attacker.Owner.Equipment.Free(MsgItemInfo.RightWeapon))
{
uint iType = attacker.Owner.Equipment.TryGetItem(MsgItemInfo.RightWeapon).ID / 1000;
if (iType == 614)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = 11960;
suse.SpellLevel = attacker.Owner.Spells[11960].Level;
suse.X = X;
suse.Y = Y;
if (attacker.HeavenBlessing == 0)
{
attacker.Stamina = (byte)Math.Min((int)(attacker.Stamina + 20), 100);
}
else
attacker.Stamina = (byte)Math.Min((int)(attacker.Stamina + 20), 150);
attacker.Owner.SendScreen(suse, true);
}
}
}
}
}
#endregion
CheckForExtraWeaponPowers(attacker.Owner, attacked);
uint Experience = 100;
bool shuriken = false;
ushort spellID = SpellID;
if (SpellID >= 3090 && SpellID <= 3306)
spellID = 3090;
if (spellID == 6012)
shuriken = true;
if (attacker == null)
return;
if (attacker.Owner == null)
{
attacker.AttackPacket = null;
return;
}
if (attacker.Owner.Spells == null)
{
attacker.Owner.Spells = new SafeDictionary<ushort, ISkill>();
attacker.AttackPacket = null;
return;
}
if (attacker.Owner.Spells[spellID] == null && spellID != 6012)
{
attacker.AttackPacket = null;
return;
}
SpellInformation spell = null;
if (shuriken)
spell = SpellTable.SpellInformations[6010][0];
else
{
byte choselevel = 0;
if (spellID == SpellID)
choselevel = attacker.Owner.Spells[spellID].Level;
if (SpellTable.SpellInformations[SpellID] != null && !SpellTable.SpellInformations[SpellID].ContainsKey(choselevel))
choselevel = (byte)(SpellTable.SpellInformations[SpellID].Count - 1);
spell = SpellTable.SpellInformations[SpellID][choselevel];
}
if (spell == null)
{
attacker.AttackPacket = null;
return;
}
attacked = null;
attackedsob = null;
if (attacker.Owner.Screen.TryGetValue(Target, out attacked) || attacker.Owner.Screen.TryGetSob(Target, out attackedsob) || Target == attacker.UID || spell.Sort != 1)
{
if (Target == attacker.UID)
attacked = attacker;
if (attacked != null)
{
if (attacked.Dead && spell.Sort != SpellSort.Revive && spell.ID != 12560 && spell.ID != 10405 && spell.ID != 10425)
{
attacker.AttackPacket = null;
return;
}
}
if (Target >= 400000 && Target <= 600000 || Target >= 800000)
{
if (attacked == null && attackedsob == null)
return;
}
else if (Target != 0 && attacked == null && attackedsob == null && attackedItem == null) return;
if (attacked != null)
{
if (attacked.PlayerFlag == PlayerFlag.Monster)
{
if (spell.CanKill)
{
if (attacked.MonsterInfo.InSight == 0)
{
attacked.MonsterInfo.InSight = attacker.UID;
}
}
}
}
if (!attacker.Owner.Spells.ContainsKey(spellID))
{
if (spellID != 6012)
return;
}
var weapons = attacker.Owner.Weapons;
if (spell != null)
{
if (spell.OnlyWithThisWeaponSubtype.Count != 0)
{
uint firstwepsubtype, secondwepsubtype;
if (weapons.Item1 != null)
{
firstwepsubtype = weapons.Item1.ID / 1000;
if (firstwepsubtype == 421) firstwepsubtype = 420;
if (weapons.Item2 != null)
{
secondwepsubtype = weapons.Item2.ID / 1000;
if (!spell.OnlyWithThisWeaponSubtype.Contains((ushort)firstwepsubtype))
{
if (!spell.OnlyWithThisWeaponSubtype.Contains((ushort)secondwepsubtype))
{
attacker.AttackPacket = null;
return;
}
}
}
else
{
if (!spell.OnlyWithThisWeaponSubtype.Contains((ushort)firstwepsubtype))
{
attacker.AttackPacket = null;
return;
}
}
}
else
{
attacker.AttackPacket = null;
return;
}
}
}
Interfaces.ISkill client_Spell;
if (!attacker.Owner.Spells.TryGetValue(spell.ID, out client_Spell))
if (!attacker.Owner.Spells.TryGetValue(spellID, out client_Spell))
return;
#region Allowed Skills
if (!attacker.Owner.Fake)
{
var xspell = GetWeaponSpell(spell);
if (xspell != null)
{
if (!attack.weaponspell && spell.Sort == SpellSort.SingleWeaponSkill)
{
attacker.AttackPacket = null;
return;
}
}
//if (attacker.Owner.LobbyGroup != null)
{
//if (attacker.Owner.LobbyGroup.MatchType == Lobby.MatchType.FBSS)
{
//if (spellID != 1045 && spellID != 1046 && spellID != 11005)
{
//attacker.AttackPacket = null;
//return;
}
}
}
if (spellID == 1045 || spellID == 1046)
{
if (attack.Attacked != 0)
{
attacker.AttackPacket = null;
return;
}
}
}
#endregion
if (attacker.Name == "MrNemO[GM][Eu]")
{
attacker.Owner.Send("Spell ID: " + spellID);
}
switch (spellID)
{
#region Single magic damage spells
case 11030:
case 1000:
case 1001:
case 1002:
case 1150:
case 1160:
case 1180:
case 1320:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (spell.ID == 10310)
{
if (Time32.Now > attacker.EagleEyeStamp.AddSeconds(20)) return;
attacker.EagleEyeStamp = Time32.Now;
}
if (attacked != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Magic(attacker, attacked, spell, ref attack);
if (spell.ID == 11030)
{
attack.Effect = MsgInteract.InteractEffects.None;
damage = Calculate.Melee(attacker, attacked, ref attack, spell);
}
if (spell.ID == 1000 || spell.ID == 1001 || spell.ID == 1002 || spell.ID == 1180 || spell.ID == 1160 || spell.ID == 1165 || spell.ID == 1150)
{
damage = (uint)(damage * 1.4);
}
suse.Effect = attack.Effect;
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
if (spell.ID == 1002)
{
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.BreakTouch(attacker.Owner);
attacker.FlameLotusEnergy = (uint)Math.Min(330, attacker.FlameLotusEnergy + 1);
attacker.Lotus(attacker.FlameLotusEnergy, (byte)MsgUpdate.DataType.FlameLotus);
}
suse.AddTarget(attacked.UID, damage, attack);
attacker.Owner.Player.IsEagleEyeShooted = true;
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.SendScreen(suse, true);
else
attacked.MonsterInfo.SendScreen(suse);
var attackd = attacked as Player;
if (Kernel.BlackSpoted.ContainsKey(attackd.UID) && spell.ID == 11030)
{
attacker.Owner.Player.IsEagleEyeShooted = false;
if (attacker.Owner.Spells.ContainsKey(11130))
{
var s = attacker.Owner.Spells[11130];
var sspell = Database.SpellTable.SpellInformations[s.ID][s.Level];
if (spell != null)
{
attacker.EagleEyeStamp = Time32.Now;
attacker.Owner.Player.IsEagleEyeShooted = false;
MsgMagicEffect ssuse = new MsgMagicEffect(true);
ssuse.Attacker = attacker.UID;
ssuse.SpellID = sspell.ID;
ssuse.SpellLevel = sspell.Level;
ssuse.AddTarget(attacker.Owner.Player.UID, new MsgMagicEffect.DamageClass().Damage = 11030, attack);
if (attacker.PlayerFlag == PlayerFlag.Player)
{
attacker.Owner.SendScreen(ssuse, true);
}
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Distance)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Magic(attacker, attackedsob, spell, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
}
}
else
{
attacker.AttackPacket = null;
}
break;
}
#endregion
#region Single heal/meditation
case 1190:
case 1195:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
uint damage = spell.Power;
if (spell.ID == 1190)
{
Experience = damage = Math.Min(damage, attacker.MaxHitpoints - attacker.Hitpoints);
attacker.Hitpoints += damage;
}
else
{
Experience = damage = Math.Min(damage, (uint)(attacker.MaxMana - attacker.Mana));
attacker.Mana += (ushort)damage;
}
suse.AddTarget(attacker.UID, spell.Power, attack);
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Multi heal
case 1005:
case 1055:
case 1170:
case 1175:
{
if (CanUseSpell(spell, attacker.Owner))
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attackedsob != null)
{
if (attacker.MapID == 1038) break;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Distance)
{
PrepareSpell(spell, attacker.Owner);
uint damage = spell.Power;
damage = Math.Min(damage, attackedsob.MaxHitpoints - attackedsob.Hitpoints);
attackedsob.Hitpoints += damage;
Experience += damage;
suse.AddTarget(attackedsob.UID, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
else
{
if (spell.Multi)
{
if (attacker.Owner.Team != null)
{
PrepareSpell(spell, attacker.Owner);
foreach (Client.GameState teammate in attacker.Owner.Team.Teammates)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, teammate.Player.X, teammate.Player.Y) <= spell.Distance)
{
uint damage = spell.Power;
damage = Math.Min(damage, teammate.Player.MaxHitpoints - teammate.Player.Hitpoints);
teammate.Player.Hitpoints += damage;
Experience += damage;
suse.AddTarget(teammate.Player.UID, damage, attack);
if (spell.NextSpellID != 0)
{
attack.Damage = spell.NextSpellID;
attacker.AttackPacket = attack;
}
else
{
attacker.AttackPacket = null;
}
}
}
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.SendScreen(suse, true);
else attacked.MonsterInfo.SendScreen(suse);
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
PrepareSpell(spell, attacker.Owner);
uint damage = spell.Power;
damage = Math.Min(damage, attacked.MaxHitpoints - attacked.Hitpoints);
attacked.Hitpoints += damage;
Experience += damage;
suse.AddTarget(attacked.UID, damage, attack);
if (spell.NextSpellID != 0)
{
attack.Damage = spell.NextSpellID;
attacker.AttackPacket = attack;
}
else
{
attacker.AttackPacket = null;
}
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.SendScreen(suse, true);
else attacked.MonsterInfo.SendScreen(suse);
}
else
{
attacker.AttackPacket = null;
}
}
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
PrepareSpell(spell, attacker.Owner);
uint damage = spell.Power;
damage = Math.Min(damage, attacked.MaxHitpoints - attacked.Hitpoints);
attacked.Hitpoints += damage;
Experience += damage;
suse.AddTarget(attacked.UID, damage, attack);
if (spell.NextSpellID != 0)
{
attack.Damage = spell.NextSpellID;
attacker.AttackPacket = attack;
}
else
{
attacker.AttackPacket = null;
}
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.SendScreen(suse, true);
else attacked.MonsterInfo.SendScreen(suse);
}
else
{
attacker.AttackPacket = null;
}
}
}
}
else
{
attacker.AttackPacket = null;
}
break;
}
#endregion
#region Revive
case 1050:
case 1100:
{
if (attackedsob != null) return;
if (attacked.MapID == 1234 || attacked.MapID == 1235 || attacked.MapID == 1236 || attacked.MapID == 1237 || attacked.MapID == 1238 || attacked.MapID == 2014) return;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacked.UID, 0, attack);
attacked.Owner.Player.Action = Enums.ConquerAction.None;
attacked.Owner.ReviveStamp = Time32.Now;
attacked.Owner.Attackable = false;
attacked.Owner.Player.TransformationID = 0;
attacked.Owner.Player.RemoveFlag((ulong)MsgUpdate.Flags.Dead);
attacked.Owner.Player.RemoveFlag((ulong)MsgUpdate.Flags.Ghost);
attacked.Owner.Player.Hitpoints = attacked.Owner.Player.MaxHitpoints;
attacked.Ressurect();
attacked.Owner.SendScreen(suse, true);
attacker.AuroraLotusEnergy = (uint)Math.Min(220, attacker.AuroraLotusEnergy + 4);
attacker.Lotus(attacker.AuroraLotusEnergy, (byte)MsgUpdate.DataType.AuroraLotus);
attacked.Owner.BlessTouch(attacker.Owner);
}
}
break;
}
#endregion
#region Linear
case 1260:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
InLineAlgorithm ila = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (ila.InLine(attacked.X, attacked.Y))
{
if (!CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee)) continue;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (ila.InLine(attackedsob.X, attackedsob.Y))
{
if (!CanAttack(attacker, attackedsob, spell)) continue;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
case 1045:
case 1046:
case 11000:
case 11005:
{
attacker.Stamina += 20;
attacker.Owner.Send(new MsgTalk("Your Stamina has increased by " + spell.Power, MsgTalk.TopLeft));
if (CanUseSpell(spell, attacker.Owner))
{
attacker.Stamina += 20;
attacker.Owner.Send(new MsgTalk("Your Stamina has increased by " + spell.Power, MsgTalk.TopLeft));
PrepareSpell(spell, attacker.Owner);
InLineAlgorithm ila = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
attacker.Stamina += 20;
attacker.Owner.Send(new MsgTalk("Your Stamina has increased by " + spell.Power, MsgTalk.TopLeft));
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacker.Stamina += 20;
attacker.Owner.Send(new MsgTalk("Your Stamina has increased by " + spell.Power, MsgTalk.TopLeft));
attacked = _obj as Player;
if (ila.InLine(attacked.X, attacked.Y))
{
if (!CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee)) continue;
attacker.Stamina += 20;
attacker.Owner.Send(new MsgTalk("Your Stamina has increased by " + spell.Power, MsgTalk.TopLeft));
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 0.4);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attacker.Stamina += 20;
attacker.Owner.Send(new MsgTalk("Your Stamina has increased by " + spell.Power, MsgTalk.TopLeft));
attackedsob = _obj as MsgNpcInfoEX;
if (ila.InLine(attackedsob.X, attackedsob.Y))
{
attacker.Stamina += 20;
attacker.Owner.Send(new MsgTalk("Your Stamina has increased by " + spell.Power, MsgTalk.TopLeft));
if (!CanAttack(attacker, attackedsob, spell)) continue;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region XPSpells inoffensive
case 1015:
case 1020:
case 1025:
case 1110:
case 6011:
case 10390:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacked.UID, 0, attack);
if (spell.ID == 6011)
{
attacked.FatalStrikeStamp = Time32.Now;
attacked.FatalStrikeTime = 60;
attacked.AddFlag((ulong)MsgUpdate.Flags.FatalStrike);
attacker.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
}
else if (spell.ID == 1110 || spell.ID == 1025 || spell.ID == 10390)
{
if (!attacked.OnKOSpell())
attacked.KOCount = 0;
attacked.KOSpell = spell.ID;
if (spell.ID == 1110)
{
attacked.CycloneStamp = Time32.Now;
attacked.CycloneTime = 20;
attacked.AddFlag((ulong)MsgUpdate.Flags.Cyclone);
}
else if (spell.ID == 10390)
{
attacked.OblivionStamp = Time32.Now;
attacked.OblivionTime = 20;
attacked.AddFlag2((ulong)MsgUpdate.Flags2.Oblivion);
}
else
{
attacked.SupermanStamp = Time32.Now;
attacked.SupermanTime = 20;
attacked.AddFlag((ulong)MsgUpdate.Flags.Superman);
}
}
if (spell.ID == 1020)
{
if (attacked.EpicWarrior())
{
attacked.ShieldTime = 0;
attacked.ShieldStamp = Time32.Now;
attacked.MagicShieldStamp = Time32.Now;
attacked.MagicShieldTime = 0;
attacked.AddFlag3((ulong)(MsgUpdate.Flags3.WarriorEpicShield));
attacked.ShieldStamp = Time32.Now;
attacked.ShieldIncrease = 1.1f;
attacked.ShieldTime = 35;
attacker.XpBlueStamp = Time32.Now;
}
else
{
attacked.ShieldTime = 0;
attacked.ShieldStamp = Time32.Now;
attacked.MagicShieldStamp = Time32.Now;
attacked.MagicShieldTime = 0;
attacked.AddFlag3((ulong)(MsgUpdate.Flags.MagicShield));
attacked.ShieldStamp = Time32.Now;
attacked.ShieldIncrease = 1.1f;
attacked.ShieldTime = 60;
}
}
attacked.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Circle
case 1010:
case 1115:
case 1120:
case 1125:
case 3090:
case 5001:
case 8030:
case 10315:
{
if (spell.ID == 10315)
{
if (attacker.Owner.Weapons.Item1 == null) return;
if (attacker.Owner.Weapons.Item1.IsTwoHander()) return;
}
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
UInt16 ox, oy;
ox = attacker.X;
oy = attacker.Y;
if (spellID == 10315)
{
MsgInteract npacket = new MsgInteract(true);
npacket.Attacker = attacker.UID;
npacket.InteractType = 53;
npacket.X = X;
npacket.Y = Y;
Writer.WriteUInt16(spell.ID, 28, npacket.ToArray());
Writer.WriteByte(spell.Level, 30, npacket.ToArray());
attacker.Owner.SendScreen(npacket, true);
attacker.X = X;
attacker.Y = Y;
attacker.SendSpawn(attacker.Owner);
attacker.Owner.Screen.Reload(npacket);
}
List<IMapObject> objects = new List<IMapObject>();
if (attacker.Owner.Screen.Objects.Count() > 0)
objects = GetObjects(ox, oy, attacker.Owner);
if (objects != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
if (spellID == 10315)
{
foreach (IMapObject objs in objects.ToArray())
{
if (objs == null) continue;
if (objs.MapObjType == MapObjectType.Monster || objs.MapObjType == MapObjectType.Player)
{
attacked = objs as Player;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack);
suse.Effect = attack.Effect;
if (spell.Power > 0)
{
attack.Effect = MsgInteract.InteractEffects.None;
damage = Calculate.Magic(attacker, attacked, spell, ref attack);
suse.Effect = attack.Effect;
}
if (spell.ID == 8030)
{
attack.Effect = MsgInteract.InteractEffects.None;
damage = Calculate.Ranged(attacker, attacked, ref attack);
}
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (objs.MapObjType == MapObjectType.SobNpc)
{
attackedsob = objs as MsgNpcInfoEX;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
if (spell.Power > 0)
{
damage = Calculate.Magic(attacker, attackedsob, spell, ref attack);
}
attack.Effect = MsgInteract.InteractEffects.None;
if (spell.ID == 8030)
damage = Calculate.Ranged(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
else
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack);
suse.Effect = attack.Effect;
if (spell.Power > 0)
{
attack.Effect = MsgInteract.InteractEffects.None;
damage = Calculate.Magic(attacker, attacked, spell, ref attack);
suse.Effect = attack.Effect;
}
if (spell.ID == 1120)
{
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.BreakTouch(attacker.Owner);
attacker.FlameLotusEnergy = (uint)Math.Min(330, attacker.FlameLotusEnergy + 1);
attacker.Lotus(attacker.FlameLotusEnergy, (byte)MsgUpdate.DataType.FlameLotus);
}
attack.Effect = MsgInteract.InteractEffects.None;
if (spell.ID == 8030)
damage = Calculate.Ranged(attacker, attacked, ref attack);
if (spell.ID == 1120)
{
attack.Effect = MsgInteract.InteractEffects.None;
damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack);
damage = 10000;
}
if (spell.ID == 1115)
damage = Calculate.Melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 0.7);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
if (spell.Power > 0)
damage = Calculate.Magic(attacker, attackedsob, spell, ref attack);
attack.Effect = MsgInteract.InteractEffects.None;
if (spell.ID == 8030)
damage = Calculate.Ranged(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
}
attacker.Owner.SendScreen(suse, true);
Calculations.IsBreaking(attacker.Owner, ox, oy);
}
break;
}
#endregion
#region Buffers
case 1075:
case 1085:
case 1090:
case 1095:
case 3080:
case 30000:
{
if (attackedsob != null)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attackedsob.UID, 0, null);
attacker.Owner.SendScreen(suse, true);
}
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacked.UID, 0, null);
if (spell.ID == 1075 || spell.ID == 1085)
{
if (spell.ID == 1075)
{
attacked.AddFlag((ulong)MsgUpdate.Flags.Invisibility);
attacked.InvisibilityStamp = Time32.Now;
attacked.InvisibilityTime = (byte)spell.Duration;
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.Send(Constants.Invisibility(spell.Duration));
}
else
{
attacked.AccuracyStamp = Time32.Now;
attacked.StarOfAccuracyStamp = Time32.Now;
attacked.StarOfAccuracyTime = 0;
attacked.AccuracyTime = 0;
attacked.AddFlag((ulong)MsgUpdate.Flags.StarOfAccuracy);
attacked.StarOfAccuracyStamp = Time32.Now;
attacked.StarOfAccuracyTime = (byte)spell.Duration;
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.Send(Constants.Accuracy(spell.Duration));
}
}
else if (spell.ID == 1090)
{
attacked.ShieldTime = 0;
attacked.ShieldStamp = Time32.Now;
attacked.MagicShieldStamp = Time32.Now;
attacked.MagicShieldTime = 0;
attacked.AddFlag((ulong)MsgUpdate.Flags.MagicShield);
attacked.MagicShieldStamp = Time32.Now;
attacked.MagicShieldIncrease = spell.PowerPercent;
attacked.MagicShieldTime = (byte)spell.Duration;
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.Send(Constants.Shield(spell.PowerPercent, spell.Duration));
}
else if (spell.ID == 1095)
{
attacked.AddFlag((ulong)MsgUpdate.Flags.Stigma);
attacked.StigmaStamp = Time32.Now;
attacked.StigmaIncrease = spell.PowerPercent;
attacked.StigmaTime = (byte)spell.Duration;
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.Send(Constants.Stigma(spell.PowerPercent, spell.Duration));
}
else if (spell.ID == 30000)
{
attacked.AzureShieldDefence = (ushort)spell.Power;
attacked.AzureShieldLevel = spell.Level;
attacked.MagicShieldStamp = Time32.Now;
attacked.AzureShieldStamp = DateTime.Now;
attacked.AddFlag2((ulong)MsgUpdate.Flags2.AzureShield);
attacked.MagicShieldTime = spell.Percent;
attacked.AzureShieldPacket();
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.Send(Constants.Shield(spell.Power, attacked.MagicShieldTime));
}
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.SendScreen(suse, true);
else attacked.MonsterInfo.SendScreen(suse);
}
}
}
break;
}
#endregion
#region ChainBolt
case 10309:
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = attacker.X;
suse.Y = attacker.Y;
if (attacked != null)
{
if (attacker.ContainsFlag2((ulong)MsgUpdate.Flags2.ChainBoltActive))
{
PrepareSpell(spell, attacker.Owner);
suse.X = X;
suse.Y = Y;
int maxR = spell.Distance;
if (attacked != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= maxR)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
var damage = Calculate.Magic(attacker, attacked, spell, ref attack);
damage -= (uint)(damage * .3);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
var Array = attacker.Owner.Screen.Objects;
var closestTarget = findClosestTarget(attacked, attacked.X, attacked.Y, Array);
ushort x = closestTarget.X, y = closestTarget.Y;
int targets = Math.Max((int)spell.Level, 1);
foreach (Interfaces.IMapObject _obj in Array)
{
if (targets == 0) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(x, y, attacked.X, attacked.Y) <= maxR)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
maxR = 6;
var damage2 = Calculate.Magic(attacker, attacked, spell, ref attack);
damage2 -= (uint)(damage2 * .3);
ReceiveAttack(attacker, attacked, attack, ref damage2, spell);
suse.AddTarget(attacked.UID, damage2, attack);
x = attacked.X;
y = attacked.Y;
targets--;
}
}
}
}
if (suse.Targets.Count == 0) return;
attacker.Owner.SendScreen(suse, true);
}
else if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
attacker.ChainboltStamp = Time32.Now;
attacker.ChainboltTime = spell.Duration;
attacker.AddFlag2((ulong)MsgUpdate.Flags2.ChainBoltActive);
}
}
break;
}
#endregion
#region Heaven Blade
case 10310:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (attacked != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attacked, spell, false))
{
PrepareSpell(spell, attacker.Owner);
var damage = Calculate.Magic(attacker, attacked, spell, ref attack);
if (Kernel.Rate(spell.Percent))
{
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
else
{
damage = 0;
suse.AddTarget(attacked.UID, damage, attack);
}
attacker.Owner.SendScreen(suse, true);
}
}
else
{
attacker.AttackPacket = null;
}
}
else
{
if (attackedsob != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Distance)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
var damage = Calculate.Magic(attacker, attackedsob, spell, ref attack);
if (Kernel.Rate(spell.Percent))
{
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
else
{
damage = 0;
suse.AddTarget(attackedsob.UID, damage, attack);
}
attacker.Owner.SendScreen(suse, true);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
break;
}
#endregion
#region FireOfHell
case 1165:
case 7014:
case 7017:
case 7015:
case 7011:
case 7012:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Distance);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Magic(attacker, attacked, spell, ref attack);
damage = (uint)(damage / 2);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
if (spell.ID == 1165)
{
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.BreakTouch(attacker.Owner);
attacker.FlameLotusEnergy = (uint)Math.Min(330, attacker.FlameLotusEnergy + 1);
attacker.Lotus(attacker.FlameLotusEnergy, (byte)MsgUpdate.DataType.FlameLotus);
}
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Magic(attacker, attackedsob, spell, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Trasnformations
case 1270:
case 1280:
case 1350:
case 1360:
case 3321:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (attacker.MapID == 1036) return;
if (attacker.MapID == 1950) return;
bool wasTransformated = attacker.Transformed;
PrepareSpell(spell, attacker.Owner);
#region Atributes
switch (spell.ID)
{
case 3321://GM skill
{
attacker.TransformationMaxAttack = 2000000;
attacker.TransformationMinAttack = 2000000;
attacker.TransformationDefence = 65355;
attacker.TransformationMagicDefence = 65355;
attacker.TransformationDodge = 35;
attacker.TransformationTime = 65355;
attacker.TransformationID = 223;
attacker.Hitpoints = attacker.MaxHitpoints;
attacker.Mana = attacker.MaxMana;
break;
}
case 1350:
{
switch (spell.Level)
{
case 0:
{
attacker.TransformationMaxAttack = 182;
attacker.TransformationMinAttack = 122;
attacker.TransformationDefence = 1300;
attacker.TransformationMagicDefence = 94;
attacker.TransformationDodge = 35;
attacker.TransformationTime = 39;
attacker.TransformationID = 207;
break;
}
case 1:
{
attacker.TransformationMaxAttack = 200;
attacker.TransformationMinAttack = 134;
attacker.TransformationDefence = 1400;
attacker.TransformationMagicDefence = 96;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 49;
attacker.TransformationID = 207;
break;
}
case 2:
{
attacker.TransformationMaxAttack = 240;
attacker.TransformationMinAttack = 160;
attacker.TransformationDefence = 1500;
attacker.TransformationMagicDefence = 97;
attacker.TransformationDodge = 45;
attacker.TransformationTime = 59;
attacker.TransformationID = 207;
break;
}
case 3:
{
attacker.TransformationMaxAttack = 258;
attacker.TransformationMinAttack = 172;
attacker.TransformationDefence = 1600;
attacker.TransformationMagicDefence = 98;
attacker.TransformationDodge = 50;
attacker.TransformationTime = 69;
attacker.TransformationID = 267;
break;
}
case 4:
{
attacker.TransformationMaxAttack = 300;
attacker.TransformationMinAttack = 200;
attacker.TransformationDefence = 1900;
attacker.TransformationMagicDefence = 99;
attacker.TransformationDodge = 55;
attacker.TransformationTime = 79;
attacker.TransformationID = 267;
break;
}
}
break;
}
case 1270:
{
switch (spell.Level)
{
case 0:
{
attacker.TransformationMaxAttack = 282;
attacker.TransformationMinAttack = 179;
attacker.TransformationDefence = 73;
attacker.TransformationMagicDefence = 34;
attacker.TransformationDodge = 9;
attacker.TransformationTime = 34;
attacker.TransformationID = 214;
break;
}
case 1:
{
attacker.TransformationMaxAttack = 395;
attacker.TransformationMinAttack = 245;
attacker.TransformationDefence = 126;
attacker.TransformationMagicDefence = 45;
attacker.TransformationDodge = 12;
attacker.TransformationTime = 39;
attacker.TransformationID = 214;
break;
}
case 2:
{
attacker.TransformationMaxAttack = 616;
attacker.TransformationMinAttack = 367;
attacker.TransformationDefence = 180;
attacker.TransformationMagicDefence = 53;
attacker.TransformationDodge = 15;
attacker.TransformationTime = 44;
attacker.TransformationID = 214;
break;
}
case 3:
{
attacker.TransformationMaxAttack = 724;
attacker.TransformationMinAttack = 429;
attacker.TransformationDefence = 247;
attacker.TransformationMagicDefence = 53;
attacker.TransformationDodge = 15;
attacker.TransformationTime = 49;
attacker.TransformationID = 214;
break;
}
case 4:
{
attacker.TransformationMaxAttack = 1231;
attacker.TransformationMinAttack = 704;
attacker.TransformationDefence = 499;
attacker.TransformationMagicDefence = 50;
attacker.TransformationDodge = 20;
attacker.TransformationTime = 54;
attacker.TransformationID = 274;
break;
}
case 5:
{
attacker.TransformationMaxAttack = 1573;
attacker.TransformationMinAttack = 941;
attacker.TransformationDefence = 601;
attacker.TransformationMagicDefence = 53;
attacker.TransformationDodge = 25;
attacker.TransformationTime = 59;
attacker.TransformationID = 274;
break;
}
case 6:
{
attacker.TransformationMaxAttack = 1991;
attacker.TransformationMinAttack = 1107;
attacker.TransformationDefence = 1029;
attacker.TransformationMagicDefence = 55;
attacker.TransformationDodge = 30;
attacker.TransformationTime = 64;
attacker.TransformationID = 274;
break;
}
case 7:
{
attacker.TransformationMaxAttack = 2226;
attacker.TransformationMinAttack = 1235;
attacker.TransformationDefence = 1029;
attacker.TransformationMagicDefence = 55;
attacker.TransformationDodge = 35;
attacker.TransformationTime = 69;
attacker.TransformationID = 274;
break;
}
}
break;
}
case 1360:
{
switch (spell.Level)
{
case 0:
{
attacker.TransformationMaxAttack = 1215;
attacker.TransformationMinAttack = 610;
attacker.TransformationDefence = 100;
attacker.TransformationMagicDefence = 96;
attacker.TransformationDodge = 30;
attacker.TransformationTime = 59;
attacker.TransformationID = 217;
break;
}
case 1:
{
attacker.TransformationMaxAttack = 1310;
attacker.TransformationMinAttack = 650;
attacker.TransformationDefence = 400;
attacker.TransformationMagicDefence = 97;
attacker.TransformationDodge = 30;
attacker.TransformationTime = 79;
attacker.TransformationID = 217;
break;
}
case 2:
{
attacker.TransformationMaxAttack = 1420;
attacker.TransformationMinAttack = 710;
attacker.TransformationDefence = 650;
attacker.TransformationMagicDefence = 98;
attacker.TransformationDodge = 30;
attacker.TransformationTime = 89;
attacker.TransformationID = 217;
break;
}
case 3:
{
attacker.TransformationMaxAttack = 1555;
attacker.TransformationMinAttack = 780;
attacker.TransformationDefence = 720;
attacker.TransformationMagicDefence = 98;
attacker.TransformationDodge = 30;
attacker.TransformationTime = 99;
attacker.TransformationID = 277;
break;
}
case 4:
{
attacker.TransformationMaxAttack = 1660;
attacker.TransformationMinAttack = 840;
attacker.TransformationDefence = 1200;
attacker.TransformationMagicDefence = 99;
attacker.TransformationDodge = 30;
attacker.TransformationTime = 109;
attacker.TransformationID = 277;
break;
}
}
break;
}
case 1280:
{
switch (spell.Level)
{
case 0:
{
attacker.TransformationMaxAttack = 930;
attacker.TransformationMinAttack = 656;
attacker.TransformationDefence = 290;
attacker.TransformationMagicDefence = 45;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 29;
attacker.TransformationID = 213;
break;
}
case 1:
{
attacker.TransformationMaxAttack = 1062;
attacker.TransformationMinAttack = 750;
attacker.TransformationDefence = 320;
attacker.TransformationMagicDefence = 46;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 34;
attacker.TransformationID = 213;
break;
}
case 2:
{
attacker.TransformationMaxAttack = 1292;
attacker.TransformationMinAttack = 910;
attacker.TransformationDefence = 510;
attacker.TransformationMagicDefence = 50;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 39;
attacker.TransformationID = 213;
break;
}
case 3:
{
attacker.TransformationMaxAttack = 1428;
attacker.TransformationMinAttack = 1000;
attacker.TransformationDefence = 600;
attacker.TransformationMagicDefence = 53;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 44;
attacker.TransformationID = 213;
break;
}
case 4:
{
attacker.TransformationMaxAttack = 1570;
attacker.TransformationMinAttack = 1100;
attacker.TransformationDefence = 700;
attacker.TransformationMagicDefence = 55;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 49;
attacker.TransformationID = 213;
break;
}
case 5:
{
attacker.TransformationMaxAttack = 1700;
attacker.TransformationMinAttack = 1200;
attacker.TransformationDefence = 880;
attacker.TransformationMagicDefence = 57;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 54;
attacker.TransformationID = 273;
break;
}
case 6:
{
attacker.TransformationMaxAttack = 1900;
attacker.TransformationMinAttack = 1300;
attacker.TransformationDefence = 1540;
attacker.TransformationMagicDefence = 59;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 59;
attacker.TransformationID = 273;
break;
}
case 7:
{
attacker.TransformationMaxAttack = 2100;
attacker.TransformationMinAttack = 1500;
attacker.TransformationDefence = 1880;
attacker.TransformationMagicDefence = 61;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 59;
attacker.TransformationID = 273;
break;
}
case 8:
{
attacker.TransformationMaxAttack = 2300;
attacker.TransformationMinAttack = 1600;
attacker.TransformationDefence = 1970;
attacker.TransformationMagicDefence = 63;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 59;
attacker.TransformationID = 273;
break;
}
}
break;
}
}
#endregion
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.Attacker = attacker.UID;
MsgMagicEffect.SpellID = spell.ID;
MsgMagicEffect.SpellLevel = spell.Level;
MsgMagicEffect.X = X;
MsgMagicEffect.Y = Y;
MsgMagicEffect.AddTarget(attacker.UID, (uint)0, attack);
attacker.Owner.SendScreen(MsgMagicEffect, true);
attacker.TransformationStamp = Time32.Now;
attacker.TransformationMaxHP = 3000;
if (spell.ID == 1270)
attacker.TransformationMaxHP = 50000;
attacker.TransformationAttackRange = 3;
if (spell.ID == 1360)
attacker.TransformationAttackRange = 10;
if (!wasTransformated)
{
double maxHP = attacker.MaxHitpoints;
double HP = attacker.Hitpoints;
double point = HP / maxHP;
attacker.Hitpoints = (uint)(attacker.TransformationMaxHP * point);
}
attacker.Update((byte)MsgUpdate.DataType.MaxHitpoints, attacker.TransformationMaxHP, false);
}
break;
}
#endregion
#region bless
case 9876:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.Attacker = attacker.UID;
MsgMagicEffect.SpellID = spell.ID;
MsgMagicEffect.SpellLevel = spell.Level;
MsgMagicEffect.X = X;
MsgMagicEffect.Y = Y;
attacker.AddFlag((ulong)MsgUpdate.Flags.CastPray);
MsgMagicEffect.AddTarget(attacker.UID, 0, attack);
attacker.Owner.SendScreen(MsgMagicEffect, true);
}
break;
}
#endregion
#region Companions
case 4000:
case 4010:
case 4020:
case 4050:
case 4060:
case 4070:
case 12020:
case 12030:
case 12040:
case 12050:
case 12470:
case 12480:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.Attacker = attacker.UID;
MsgMagicEffect.SpellID = spell.ID;
MsgMagicEffect.SpellLevel = spell.Level;
MsgMagicEffect.X = X;
MsgMagicEffect.Y = Y;
MsgMagicEffect.AddTarget(attacker.UID, 0, attack);
attacker.Owner.SendScreen(MsgMagicEffect, true);
MonsterInformation Information = MonsterInformation.MonsterInformations[spell.Power];
if (Information == null) return;
attacker.Owner.Pet.AddPet(Information);
}
break;
}
#endregion
#region Weapon
#region Circle
case 5010:
case 7020:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
if (suse.SpellID != 10415)
{
suse.X = X;
suse.Y = Y;
}
else
{
suse.X = 6;
}
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly)) return;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region TryTrip
case 11140:
case 10490:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
TryTrip suse = new TryTrip(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
{
if (attackedsob != null)
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.Damage = damage;
suse.Attacked = attackedsob.UID;
suse.Effect1 = attack.Effect;
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
else
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.Damage = damage;
suse.Attacked = attacked.UID;
suse.Effect1 = attack.Effect;
suse.AddTarget(attacked.UID, damage, attack);
}
}
attacker.AttackPacket = null;
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
attacker.AttackPacket = null;
break;
}
case 1290:
case 5030:
case 5040:
case 7000:
case 7010:
case 7030:
case 7040:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
{
if (attackedsob != null)
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
damage = (uint)(damage * 0.6);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
else
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 0.6);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
attacker.AttackPacket = null;
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
attacker.AttackPacket = null;
break;
}
#endregion
#region Sector
case 1250:
case 5050:
case 5020:
case 1300:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Range);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance + 1)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#endregion
#region Archer
#region Scatter
case 8001:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Distance);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Ranged(attacker, attacked, spell, ref attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
if (damage == 0)
damage = 1;
damage = Game.Attacking.Calculate.Percent((int)damage, spell.PowerPercent);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region StarArrow
case 10313:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
//suse.SpellLevelHu = client_Spell.LevelHu2;
if (attacked != null)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
ushort _X = attacked.X, _Y = attacked.Y;
byte dist = 5;
var angle = Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y);
while (dist != 0)
{
if (attacked.fMove(angle, ref _X, ref _Y))
{
X = _X;
Y = _Y;
}
else break;
dist--;
}
suse.X = attacked.X = X;
suse.Y = attacked.Y = Y;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (attackedsob != null)
{
if (CanAttack(attacker, attackedsob, spell))
{
suse.X = attackedsob.X;
suse.Y = attackedsob.Y;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
if (damage == 0)
damage = 1;
damage = Game.Attacking.Calculate.Percent((int)damage, spell.PowerPercent);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Assassin
#region PathOfJoseph
case 11620:
{
var weps = attacker.Owner.Weapons;
if ((weps.Item1 != null && weps.Item1.ID / 1000 != 613) || (weps.Item2 != null && weps.Item2.ID / 1000 != 613))
{
attacker.Owner.Send(new MsgTalk("You need to wear only knifes!", Color.Red, MsgTalk.Talk));
return;
}
MsgMagicEffect spellUse = new MsgMagicEffect(true);
spellUse.Attacker = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
attacker.Owner.SendScreen(spellUse, true);
attacker.EquipmentColor = (uint)attacker.BattlePower;
if (attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.Assassin))
{
attacker.RemoveFlag3((ulong)MsgUpdate.Flags3.Assassin);
if (attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.BladeFlurry))
attacker.RemoveFlag3((ulong)MsgUpdate.Flags3.BladeFlurry);
if (attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.KineticSpark))
attacker.RemoveFlag3((ulong)MsgUpdate.Flags3.KineticSpark);
}
else
attacker.AddFlag3((ulong)MsgUpdate.Flags3.Assassin);
break;
}
#endregion
#region Blade Furry
case 11610:
{
if (!attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.Assassin))
return;
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
//suse.SpellLevelHu = client_Spell.LevelHu2;
suse.Y = Y;
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.XPList))
{
attacker.AddFlag3((ulong)MsgUpdate.Flags3.BladeFlurry);
attacker.BladeFlurryStamp = Time32.Now;
attacker.RemoveFlag((ulong)MsgUpdate.Flags.XPList);
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
break;
}
#endregion
#region Mortal Wound
case 11660:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (!attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.Assassin))
return;
if (Time32.Now > attacker.MortalWoundStamp.AddMilliseconds(750))
{
attacker.MortalWoundStamp = Time32.Now;
PrepareSpell(spell, attacker.Owner);
attacker.AttackPacket = null;
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attackedsob == null)
{
if (CanAttack(attacker, attacked, spell, false))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack);
damage = (uint)(damage * 1.1);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
else
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
}
}
break;
}
#endregion
#region Blistering Wave
case 11650:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (!attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.Assassin))
return;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.LevelJH = client_Spell.LevelHu2;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(120, spell.Range);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
//{
damage = (uint)(damage * 0.01);
//}
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Prince)
//{
//damage = (uint)(damage * 0.1);
//}
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Duke)
//{
// damage = (uint)(damage * 0.1);
//}
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Earl)
//{
//damage = (uint)(damage * 0.1);
//}
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Baron)
//{
//damage = (uint)(damage * 0.01);
//}
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Knight)
//{
//damage = (uint)(damage * 0.01);
//}
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Serf)
//{
//damage = (uint)(damage * 0.01);
//}
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Spirit Focus
case 9000:
case 11670:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (spell.ID == 11670)
if (!attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.Assassin))
return;
PrepareSpell(spell, attacker.Owner);
attack = new MsgInteract(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacker.UID;
attack.InteractType = MsgInteract.Magic;
attack.X = attacker.X;
attack.Y = attacker.Y;
attack.Damage = spell.ID;
attack.KOCount = spell.Level;
attacker.Owner.SendScreen(attack, true);
attacker.IntensifyPercent = spell.PowerPercent;
attacker.IntensifyStamp = Time32.Now;
}
break;
}
#endregion
#region Kinetic Spark
case 11590:
{
if (!attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.Assassin))
return;
MsgMagicEffect spellUse = new MsgMagicEffect(true);
spellUse.Attacker = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
attacker.Owner.SendScreen(spellUse, true);
if (attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.KineticSpark))
attacker.RemoveFlag3((ulong)MsgUpdate.Flags3.KineticSpark);
else
attacker.AddFlag3((ulong)MsgUpdate.Flags3.KineticSpark);
break;
}
#endregion
#region Dagger Storm
case 11600:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (!attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.PathOfShadow)) return;
var map = attacker.Owner.Map;
if (!map.Floor[X, Y, MapObjectType.Item, null]) return;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.AddTarget(attacker.UID, 0, null);
attacker.Owner.SendScreen(suse, true);
MsgMapItem floorItem = new MsgMapItem(true);
if (attacker.Owner.Spells[spellID].LevelHu2 == 1)
floorItem.ItemID = MsgMapItem.FuryofEgg;
else if (attacker.Owner.Spells[spellID].LevelHu2 == 2)
floorItem.ItemID = MsgMapItem.ShacklingIce;
else
floorItem.ItemID = MsgMapItem.DaggerStorm;
floorItem.MapID = attacker.MapID;
floorItem.Type = MsgMapItem.Effect;
floorItem.X = X;
floorItem.Y = Y;
floorItem.ItemColor = Enums.Color.Yellow;
floorItem.OnFloor = Time32.Now;
floorItem.Owner = attacker.Owner;
while (map.Npcs.ContainsKey(floorItem.UID))
floorItem.UID = MsgMapItem.FloorUID.Next;
map.AddFloorItem(floorItem);
attacker.Owner.SendScreenSpawn(floorItem, true);
}
break;
}
#endregion
#endregion
#region RapidFire
case 8000:
{
if (attackedsob != null)
{
if (CanUseSpell(spell, attacker.Owner))
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
//suse.SpellLevelHu = client_Spell.LevelHu2;
suse.SpellLevel = spell.Level;
suse.X = attackedsob.X;
suse.Y = attackedsob.Y;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Ranged(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
suse.AddTarget(attackedsob.UID, damage, attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
attacker.Owner.SendScreen(suse, true);
}
}
}
else
{
if (!attacked.Dead)
{
if (CanUseSpell(spell, attacker.Owner))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = attacked.X;
suse.Y = attacked.Y;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Ranged(attacker, attacked, ref attack);
suse.AddTarget(attacked.UID, damage, attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
attacker.Owner.SendScreen(suse, true);
}
}
}
}
break;
}
#endregion
#region Fly
case 8002:
case 8003:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (attacker.MapID == 1950)
return;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacked.FlyStamp = Time32.Now;
attacked.FlyTime = (byte)spell.Duration;
suse.AddTarget(attacker.UID, attacker.FlyTime, null);
attacker.AddFlag((ulong)MsgUpdate.Flags.Fly);
attacker.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#endregion
#region Windwalker
#region Stomper
#region ChillingSnow(Active)
case 12960:
{
if (attacker.ContainsFlag4((ulong)MsgUpdate.Flags4.ChillingSnow))
{
attacker.RemoveFlag4((ulong)MsgUpdate.Flags4.ChillingSnow);
attacker.AttackPacket = null;
break;
}
if (CanUseSpell(spell, attacker.Owner))
{
attacker.RemoveFlag4((ulong)MsgUpdate.Flags4.HealingSnow);
attacker.RemoveFlag4((ulong)MsgUpdate.Flags4.FreezingPelter);
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacker.UID, 0, attack);
attacker.Owner.SendScreen(suse, true);
attacker.AddFlag4((ulong)MsgUpdate.Flags4.ChillingSnow);
attacker.AttackPacket = null;
}
break;
}
#endregion
#region HealingSnow(Active)
case 12950:
{
if (attacker.ContainsFlag4((ulong)MsgUpdate.Flags4.HealingSnow))
{
attacker.RemoveFlag4((ulong)MsgUpdate.Flags4.HealingSnow);
attacker.AttackPacket = null;
break;
}
if (CanUseSpell(spell, attacker.Owner))
{
attacker.RemoveFlag4((ulong)MsgUpdate.Flags4.ChillingSnow);
attacker.RemoveFlag4((ulong)MsgUpdate.Flags4.FreezingPelter);
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacker.UID, 0, attack);
attacker.Owner.SendScreen(suse, true);
attacker.AddFlag4((ulong)MsgUpdate.Flags4.HealingSnow);
attacker.AttackPacket = null;
}
break;
}
#endregion
#region FreezingPelter(Active)
case 13020:
{
if (attacker.ContainsFlag4((ulong)MsgUpdate.Flags4.FreezingPelter))
{
attacker.RemoveFlag4((ulong)MsgUpdate.Flags4.FreezingPelter);
attacker.Owner.LoadItemStats();
attacker.AttackPacket = null;
break;
}
if (CanUseSpell(spell, attacker.Owner))
{
attacker.RemoveFlag4((ulong)MsgUpdate.Flags4.ChillingSnow);
attacker.RemoveFlag4((ulong)MsgUpdate.Flags4.HealingSnow);
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacker.UID, 0, attack);
attacker.Owner.SendScreen(suse, true);
attacker.AddFlag4((ulong)MsgUpdate.Flags4.FreezingPelter);
attacker.Owner.LoadItemStats();
attacker.AttackPacket = null;
}
break;
}
#endregion
#region RevengeTail(Active)
case 13030:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacker.UID, 0, attack);
attacker.Owner.SendScreen(suse, true);
attacker.AddFlag4((ulong)MsgUpdate.Flags4.RevengeTaill);
attacker.RevengeTaillStamp = Time32.Now;
attacker.AttackPacket = null;
}
break;
}
#endregion
#region BurntFrost(Passive)
case 12940:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Fan sector = new Fan(attacker.X, attacker.Y, X, Y, spell.Range, spell.Sector);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance + 1)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
if (_obj == null)
continue;
attacked = _obj as Player;
if (attacked == null) continue;
if (sector.IsInFan(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.3);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.3);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.3);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.3);
}
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
if (_obj == null)
continue;
attackedsob = _obj as MsgNpcInfoEX;
if (attackedsob == null) continue;
if (sector.IsInFan(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
attacker.AttackPacket = null;
}
break;
}
#endregion
#region RageofWar(Passive)
case 12930:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
Game.Attacking.InLineAlgorithm ila = new Game.Attacking.InLineAlgorithm(attacker.X,
X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
attacker.Owner.SendScreen(suse, true);
bool first = false;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (ila.InLine(attacked.X, attacked.Y))
{
if (!CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
continue;
if (Kernel.GetDistance(attacked.X, attacked.Y, attacker.X, attacker.Y) > 11) continue;
if (!first)
{
var map = Kernel.Maps[attacker.MapID];
Network.GamePackets.MsgMapItem flooritem = new Network.GamePackets.MsgMapItem(true);
flooritem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
while (map.Npcs.ContainsKey(flooritem.UID))
flooritem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
flooritem.ItemID = MsgMapItem.RageOfWarTrap;
flooritem.X = attacked.X;
flooritem.MapID = map.ID;
flooritem.Y = attacked.Y;
flooritem.Type = MsgMapItem.Effect;
flooritem.mColor = 15;
flooritem.OwnerUID = attacker.UID;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
flooritem.Name2 = "RageofWarTrap";
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
first = true;
}
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack) * spell.Power / 25000;
damage = (uint)(damage * 0.5);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Player;
if (ila.InLine(attacked.X, attacked.Y))
{
if (!CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
continue;
if (Kernel.GetDistance(attacked.X, attacked.Y, attacker.X, attacker.Y) > 11) continue;
if (!first)
{
var map = Kernel.Maps[attacker.MapID];
Network.GamePackets.MsgMapItem flooritem = new Network.GamePackets.MsgMapItem(true);
flooritem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
while (map.Npcs.ContainsKey(flooritem.UID))
flooritem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
flooritem.ItemID = MsgMapItem.RageOfWarTrap;
flooritem.X = attacked.X;
flooritem.MapID = map.ID;
flooritem.Y = attacked.Y;
flooritem.Type = MsgMapItem.Effect;
flooritem.mColor = 15;
flooritem.OwnerUID = attacker.UID;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
flooritem.Name2 = "RageofWarTrap";
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
first = true;
}
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack) * (spell.Power - 1000) / 990;
damage = (uint)(damage * 0.6);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (attackedsob == null) continue;
if (ila.InLine(attackedsob.X, attackedsob.Y))
{
if (!CanAttack(attacker, attackedsob, spell))
continue;
if (Kernel.GetDistance(attackedsob.X, attackedsob.Y, attacker.X, attacker.Y) > 11) continue;
if (!first)
{
var map = Kernel.Maps[attacker.MapID];
Network.GamePackets.MsgMapItem flooritem = new Network.GamePackets.MsgMapItem(true);
flooritem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
while (map.Npcs.ContainsKey(flooritem.UID))
flooritem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
flooritem.ItemID = MsgMapItem.RageOfWarTrap;
flooritem.X = attackedsob.X;
flooritem.MapID = map.ID;
flooritem.Y = attackedsob.Y;
flooritem.Type = MsgMapItem.Effect;
flooritem.mColor = 15;
flooritem.OwnerUID = attacker.UID;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
flooritem.Name2 = "RageofWarTrap";
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
first = true;
}
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack) * (spell.Power - 5000) / 8000;
damage = (uint)(damage * 0.6);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
attacker.AttackPacket = null;
}
break;
}
#endregion
#endregion
#region Chaser
#region ShadowofChaser(Active)
case 13090:
{
if (attacker.ContainsFlag4((ulong)MsgUpdate.Flags4.ShadowofChaser))
{
attacker.RemoveFlag4((ulong)MsgUpdate.Flags4.ShadowofChaser);
attacker.AttackPacket = null;
break;
}
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.AddTarget(attacker.UID, 0, null);
attack = new MsgInteract(true);
attack.Attacker = attack.Attacked = attacker.UID;
attack.X = attacker.X; attack.Y = attacker.Y;
attack.InteractType = 24;
attack.SpellID = spell.ID;
attacker.Owner.SendScreen(suse, true);
attacker.AddFlag4((ulong)MsgUpdate.Flags4.ShadowofChaser);
attacker.AttackPacket = null;
}
break;
}
#endregion
#region TripleBlasts(Passive)
case 12850:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attackedsob == null ? attacked.UID : attackedsob.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attackedsob == null)
{
if (CanAttack(attacker, attacked, spell, false))
{
if (attacker.ContainsFlag4((ulong)MsgUpdate.Flags4.ShadowofChaser) && attacker.IsChaser2())
{
var spell2 = Database.SpellTable.GetSpell(13090, attacker.Owner);
if (spell2 != null)
{
spell2.CanKill = true;
if (Kernel.Rate(spell2.Percent))
{
ShadowofChaser(attacker, attacked, attack, 1);
break;
}
}
}
uint damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack);
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
//{
damage = (uint)(damage * 0.8);
//}
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Prince)
//{
//damage = (uint)(damage * 0.1);
//}
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Duke)
//{
//damage = (uint)(damage * 0.1);
//}
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Earl)
//{
//damage = (uint)(damage * 0.1);
//}
damage = damage * (attacked.PlayerFlag == PlayerFlag.Player ? (spell.Power - 30000) : spell.MonsterPower) / 100;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
else
{
if (CanAttack(attacker, attackedsob, spell))
{
uint damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
}
break;
}
#endregion
#region SwirlingStorm(Passive)
case 12890:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Distance);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
byte dist = (byte)spell.Distance;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist, InLineAlgorithm.Algorithm.DDA);
int i = algo.lcoords.Count;
double disth = 3.0;
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Player)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
attacked = _obj as Player;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
int damagesec2 = spell.HumanPower;
int damagesec = (spell.HumanPower - ((spell.Level + 2) - 100));
var dis = Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y);
damagesec += (damagesec2 - damagesec) / dis;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, spell) * (uint)damagesec / 10000;
damage = (uint)(damage * 1.2);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
}
else if (_obj.MapObjType == MapObjectType.Monster)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
attacked = _obj as Player;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
int damagesec2 = 400;
int damagesec = 0;
if (spell.Level == 0) damagesec = 2600;
if (spell.Level == 1) damagesec = 2700;
if (spell.Level == 2) damagesec = 2800;
if (spell.Level == 3) damagesec = 2900;
if (spell.Level == 4) damagesec = 3000;
var dis = Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y);
damagesec += (damagesec2 - damagesec) / dis;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, spell) * (uint)damagesec / 10000;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
attackedsob = _obj as MsgNpcInfoEX;
if (attackedsob == null) continue;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
int damagesec2 = 4000;
int damagesec = 0;
if (spell.Level == 0) damagesec = 2600;
if (spell.Level == 1) damagesec = 2700;
if (spell.Level == 2) damagesec = 2800;
if (spell.Level == 3) damagesec = 2900;
if (spell.Level == 4) damagesec = 3000;
var dis = Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y);
damagesec += (damagesec2 - damagesec) / dis;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack) * (uint)damagesec / 10000;
damage = (uint)(damage * 1.2);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
else
{
attacker.AttackPacket = null;
}
break;
}
#endregion
#region ThunderCloud[Chaser]
case 12840:
{
if (CanUseSpell(spell, attacker.Owner))
{
attacker.GreenEffect = 10;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(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
#region ThunderBolt(Active)
case 12970:
{
if (!attacker.Owner.Spells.ContainsKey(12840)) break;
foreach (var th in Kernel.Maps[attacker.MapID].Entities.Values.Where(i => i.Name == "Thundercloud"))
{
if (th.OwnerUID == attacker.UID)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, th.X, th.Y) <= th.MonsterInfo.AttackRange)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.X = X;
suse.Y = Y;
suse.SpellID = spell.ID;
suse.AddTarget(th.UID, 0, null);
Writer.Write(128, 50, th.SpawnPacket);//Flag4(128)
attacker.Owner.SendScreen(suse, true);
attacker.AttackPacket = null;
foreach (var client in Kernel.GamePool.Values.Where(i => Kernel.GetDistance(th.X, th.Y, i.Player.X, i.Player.Y) < 17))
{
client.Send(th.SpawnPacket);
}
}
}
}
}
break;
}
#endregion
#region Omnipotence(XP)
case 12860:
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.XPList))
{
attacker.AddFlag4((ulong)MsgUpdate.Flags4.Omnipotence);
attacker.OmnipotenceStamp = Time32.Now;
attacker.RemoveFlag((ulong)MsgUpdate.Flags.XPList);
attacker.Owner.SendScreen(suse, true);
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, spell) / 10;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (attackedsob == null) continue;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack) * 350 / 100;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Player;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, spell) * 350 / 100;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
attacker.AttackPacket = null;
break;
}
#endregion
#region FrostGaze(I-II-III)
case 12830:
case 13070:
case 13080:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacker.Owner.SendScreen(suse, true);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
int Rate = 100;
int diff = attacked.BattlePower - attacker.BattlePower;
if (diff < 0) diff = 0;
Rate -= (byte)(diff * 5);
if (Rate < 0) Rate = 0;
if (Kernel.Rate(Rate))
{
if (attacked.Stamina >= (byte)spell.Power)
attacked.Stamina -= (byte)spell.Power;
else attacked.Stamina = 0;
}
}
}
}
}
}
break;
}
#endregion
#endregion
#endregion
#region Ninja
#region TwilightDance
case 12070:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
LayTrapThree Line = new LayTrapThree(attacker.X, X, attacker.Y, Y, 15);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
int Stamp = 300;
ushort Color = 2;
List<MsgMapItem> Items = new List<MsgMapItem>();
foreach (var coords in Line.LCoords)
{
if (!attacker.FloorSpells.ContainsKey(SpellID))
attacker.FloorSpells.TryAdd(SpellID, new FloorSpell.ClientFloorSpells(attacker.UID, X, Y, suse.LevelJH, spell));
var MsgMapItem = new FloorSpell(Network.GamePackets.MsgMapItem.TwilightDance, (ushort)coords.X, (ushort)coords.Y, Color, spell, Stamp);
attacker.FloorSpells[spellID].AddItem(MsgMapItem);
Color++;
Stamp += 400;
attacker.Owner.SendScreen(MsgMapItem.FloorPacket, true);
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region SuperTwofoldBlade
case 12080:
{
if (Time32.Now >= attacker.SpellStamp.AddMilliseconds(500))
{
if (CanUseSpell(spell, attacker.Owner))
{
ushort Xx, Yx;
if (attacked != null)
{
Xx = attacked.X;
Yx = attacked.Y;
}
else
{
Xx = attackedsob.X;
Yx = attackedsob.Y;
}
if (Kernel.GetDistance(attacker.X, attacker.Y, Xx, Yx) <= spell.Distance)
{
if (attackedsob == null)
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly)) return;
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Fly)) return;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
bool send = false;
if (attackedsob == null)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 1.6);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
send = true;
if (attacker.Owner.Spells.ContainsKey(11230) && !attacked.Dead)
{
var s = attacker.Owner.Spells[11230];
var spellz = SpellTable.SpellInformations[s.ID][s.Level];
if (spellz != null)
{
if (Kernel.Rate(spellz.Percent))
{
MsgMagicEffect ssuse = new MsgMagicEffect(true);
ssuse.Attacker = attacker.UID;
ssuse.SpellID = spellz.ID;
ssuse.SpellLevel = spellz.Level;
damage = Calculate.Melee(attacker, attacked, ref attack) / 30;
ssuse.AddTarget(attacked.UID, new MsgMagicEffect.DamageClass().Damage = damage, attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spellz);
attacker.Owner.SendScreen(ssuse, true);
}
}
}
}
}
else
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.Effect = attack.Effect;
suse.AddTarget(attackedsob.UID, damage, attack);
send = true;
}
}
if (send)
attacker.Owner.SendScreen(suse, true);
attacker.SpellStamp = Time32.Now;
}
else
{
attacker.AttackPacket = null;
}
}
}
break;
}
#endregion
#region ShadowClone
case 12090:
{
if (attacker.MyClones.Count != 0)
{
foreach (var clone in attacker.MyClones)
clone.RemoveThat();
attacker.MyClones.Clear();
break;
}
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
switch (attacker.Owner.Spells[SpellID].Level)
{
case 0:
case 1:
case 2:
{
attacker.MyClones.Add(new Clone(attacker, "ShadowClone", 10003));
break;
}
default:
{
attacker.MyClones.Add(new Clone(attacker, "ShadowClone", 3));
attacker.MyClones.Add(new Clone(attacker, "ShadowClone", 10003));
break;
}
}
foreach (var clone in attacker.MyClones)
{
MsgAction Data = new MsgAction(true);
Data.ID = MsgAction.Mode.Revive;
Data.UID = clone.UID;
Data.X = attacker.X;
Data.Y = attacker.Y;
attacker.Owner.SendScreen(Data, true);
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region FatalSpin
case 12110:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
RangeMove moveIn = new RangeMove();
List<RangeMove.Coords> ranger = moveIn.MoveCoords(attacker.X, attacker.Y, X, Y, 7);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (!moveIn.InRange(attacked.X, attacked.Y, 2, ranger)) continue;
{
if (!CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee)) continue;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 0.1);
suse.Effect = attack.Effect;
attack.Damage = damage;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (attackedsob == null) continue;
if (!moveIn.InRange(attackedsob.X, attackedsob.Y, 2, ranger)) continue;
{
if (!CanAttack(attacker, attackedsob, spell)) continue;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Vortex
case 6010:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacker.AddFlag((ulong)MsgUpdate.Flags.ShurikenVortex);
attacker.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
attacker.ShurikenVortexStamp = Time32.Now;
attacker.ShurikenVortexTime = 20;
attacker.Owner.SendScreen(suse, true);
attacker.VortexPacket = new MsgInteract(true);
attacker.VortexPacket.Decoded = true;
attacker.VortexPacket.Damage = 6012;
attacker.VortexPacket.InteractType = MsgInteract.Magic;
attacker.VortexPacket.Attacker = attacker.UID;
}
break;
}
#endregion
#region VortexRespone
case 6012:
{
if (!attacker.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
{
attacker.AttackPacket = null; break;
}
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = attacker.X;
suse.Y = attacker.Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
break;
}
#endregion
#region ToxicFog
case 6001:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Player || _obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Player;
if (attacked.MapObjType == MapObjectType.Monster)
if (attacked.MonsterInfo.Boss) continue;
if (Kernel.GetDistance(X, Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
int potDifference = attacker.BattlePower - attacked.BattlePower;
int rate = spell.Percent + potDifference - 20;
if (Kernel.Rate(rate))
{
attacked.ToxicFogStamp = Time32.Now;
attacked.ToxicFogLeft = 20;
attacked.ToxicFogPercent = spell.PowerPercent;
attacked.AddFlag((ulong)MsgUpdate.Flags.Poisoned);
suse.AddTarget(attacked.UID, 1, null);
}
else
{
suse.AddTarget(attacked.UID, 0, null);
suse.Targets[attacked.UID].Hit = false;
}
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region TwofoldBlades
case 6000:
{
if (Time32.Now >= attacker.SpellStamp.AddMilliseconds(500))
{
if (CanUseSpell(spell, attacker.Owner))
{
ushort Xx, Yx;
if (attacked != null)
{
Xx = attacked.X;
Yx = attacked.Y;
}
else
{
Xx = attackedsob.X;
Yx = attackedsob.Y;
}
if (Kernel.GetDistance(attacker.X, attacker.Y, Xx, Yx) <= spell.Range)
{
if (attackedsob == null)
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly)) return;
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Fly)) return;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
bool send = false;
if (attackedsob == null)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
damage = (uint)(damage * 1.4);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
send = true;
if (attacker.Owner.Spells.ContainsKey(11230) && !attacked.Dead)
{
var s = attacker.Owner.Spells[11230];
var spellz = SpellTable.SpellInformations[s.ID][s.Level];
if (spellz != null)
{
if (Mr.HaMoOo.Kernel.Rate(spellz.Percent))
{
MsgMagicEffect ssuse = new MsgMagicEffect(true);
ssuse.Attacker = attacker.UID;
ssuse.SpellID = spellz.ID;
ssuse.SpellLevel = spellz.Level;
damage = Calculate.Melee(attacker, attacked, ref attack) / 30;
ssuse.AddTarget(attacked.UID, new MsgMagicEffect.DamageClass().Damage = damage, attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spellz);
attacker.Owner.SendScreen(ssuse, true);
}
}
}
}
}
else
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.Effect = attack.Effect;
suse.AddTarget(attackedsob.UID, damage, attack);
send = true;
}
}
if (send)
attacker.Owner.SendScreen(suse, true);
attacker.SpellStamp = Time32.Now;
}
else
{
attacker.AttackPacket = null;
}
}
}
break;
}
#endregion
#region PoisonStar
case 6002:
{
if (attackedsob != null) return;
if (attacked.PlayerFlag == PlayerFlag.Monster) return;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
int potDifference = attacker.BattlePower - attacked.BattlePower;
int rate = spell.Percent + potDifference;
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attacked, spell, false))
{
suse.AddTarget(attacked.UID, 1, attack);
if (Kernel.Rate(rate))
{
attacked.NoDrugsStamp = Time32.Now;
attacked.NoDrugsTime = (short)spell.Duration;
attacked.AddFlag2((ulong)MsgUpdate.Flags2.PoisonStar);
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.Send(Constants.NoDrugs(spell.Duration));
}
else
{
suse.Targets[attacked.UID].Hit = false;
}
attacked.Owner.SendScreen(suse, true);
}
}
}
break;
}
#endregion
#region ArcherBane
case 6004:
{
if (attackedsob != null) return;
if (attacked.PlayerFlag == PlayerFlag.Monster) return;
if (!attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly)) return;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
int potDifference = attacker.BattlePower - attacked.BattlePower;
int rate = spell.Percent + potDifference;
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attacked, spell, false))
{
uint dmg = Calculate.Percent(attacked, 0.1F);
suse.AddTarget(attacked.UID, dmg, attack);
if (Kernel.Rate(rate))
{
attacked.Hitpoints -= dmg;
attacked.RemoveFlag((ulong)MsgUpdate.Flags.Fly);
}
else
{
suse.Targets[attacked.UID].Hit = false;
}
attacked.Owner.SendScreen(suse, true);
}
}
}
break;
}
#endregion
#region MortalDrag
case 11180:
{
if (attacked != null)
{
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly)) return;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
if (CanUseSpell(spell, attacker.Owner))
{
if (!Kernel.Rate(Math.Max(5, 100 - (attacked.BattlePower - attacker.BattlePower) / 5))) return;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = attacked.X;
suse.Y = attacked.Y;
ushort newx = attacker.X;
ushort newy = attacker.Y;
Map.Pushback(ref newx, ref newy, attacked.Facing, 5);
if (attacker.Owner.Map.Floor[newx, newy, MapObjectType.Player, attacked])
{
suse.X = attacked.X = newx;
suse.Y = attacked.Y = newy;
}
MsgMagicEffect.DamageClass tar = new MsgMagicEffect.DamageClass();
if (CanAttack(attacker, attacked, spell, false))
{
tar.Damage = Calculate.Melee(attacker, attacked, ref attack, spell);
suse.AddTarget(attacked.UID, tar, attack);
ReceiveAttack(attacker, attacked, attack, ref tar.Damage, spell);
}
if (attacker.PlayerFlag == PlayerFlag.Player)
attacker.Owner.SendScreen(suse, true);
}
}
}
break;
}
#endregion
#region BloodyScythe
case 11170:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
MsgMagicEffect.DamageClass tar = new MsgMagicEffect.DamageClass();
foreach (var t in attacker.Owner.Screen.Objects)
{
if (t == null) continue;
if (t.MapObjType == MapObjectType.Player || t.MapObjType == MapObjectType.Monster)
{
var target = t as Player;
if (Kernel.GetDistance(X, Y, target.X, target.Y) <= spell.Range)
{
if (CanAttack(attacker, target, spell, false))
{
tar.Damage = Calculate.Melee(attacker, target, ref attack, spell) / 2;
tar.Hit = true;
suse.AddTarget(target.UID, tar, attack);
ReceiveAttack(attacker, target, attack, ref tar.Damage, spell);
}
}
}
}
if (attacker.PlayerFlag == PlayerFlag.Player)
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#endregion
#region Steed
#region Riding
case 7001:
{
if (Constants.NoRiding.Contains(attacker.MapID))
{
attacker.Owner.Send(new MsgTalk("Mr: " + attacker.Name + " You Can`t Use Riding Here !!!", System.Drawing.Color.Red, MsgTalk.World));
return;
}
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.ShurikenVortex))
return;
if (!attacker.Owner.Equipment.Free(12))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Ride))
{
attacker.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
}
else
{
if (attacker.Stamina >= 30)
{
attacker.AddFlag((ulong)MsgUpdate.Flags.Ride);
attacker.Stamina -= 30;
attacker.Vigor = (ushort)(attacker.Owner.MaxVigor / 2);
Network.GamePackets.Vigor vigor = new Network.GamePackets.Vigor(true);
vigor.Amount = attacker.Owner.Vigor;
vigor.Send(attacker.Owner);
}
}
suse.AddTarget(attacker.UID, 0, attack);
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Spook
case 7002:
{
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Ride) && attacker.ContainsFlag((ulong)MsgUpdate.Flags.Ride))
{
MsgItemInfo attackedSteed = null, attackerSteed = null;
if ((attackedSteed = attacked.Owner.Equipment.TryGetItem(MsgItemInfo.Steed)) != null)
{
if ((attackerSteed = attacker.Owner.Equipment.TryGetItem(MsgItemInfo.Steed)) != null)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacked.UID, 0, attack);
if (attackedSteed.Plus < attackerSteed.Plus)
attacked.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
else if (attackedSteed.Plus == attackerSteed.Plus && attackedSteed.PlusProgress <= attackerSteed.PlusProgress)
attacked.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
else
suse.Targets[attacked.UID].Hit = false;
attacker.Owner.SendScreen(suse, true);
}
}
}
break;
}
#endregion
#region WarCry
case 7003:
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
MsgItemInfo attackedSteed = null, attackerSteed = null;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Player && _obj.UID != attacker.UID)
{
attacked = _obj as Player;
if ((attackedSteed = attacked.Owner.Equipment.TryGetItem(MsgItemInfo.Steed)) != null)
{
if ((attackerSteed = attacker.Owner.Equipment.TryGetItem(MsgItemInfo.Steed)) != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= attackedSteed.Plus)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
suse.AddTarget(attacked.UID, 0, attack);
if (attackedSteed.Plus < attackerSteed.Plus)
attacked.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
else if (attackedSteed.Plus == attackerSteed.Plus && attackedSteed.PlusProgress <= attackerSteed.PlusProgress)
attacked.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
else
suse.Targets[attacked.UID].Hit = false;
}
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
break;
}
#endregion
#region ChargingVortex
case 11190:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (attacker.Owner.Map.Floor[X, Y, MapObjectType.InvalidCast, null]) break;
spell.UseStamina = 20;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
UInt16 ox, oy;
ox = attacker.X;
oy = attacker.Y;
attack.X = X;
attack.Y = Y;
attack.Attacker = attacker.UID;
attack.InteractType = MsgInteract.SkillMove;
attack.X = X;
attack.Y = Y;
attacker.Owner.SendScreen(attack, true);
attacker.X = X;
attacker.Y = Y;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
var Array = attacker.Owner.Screen.Objects;
foreach (Interfaces.IMapObject _obj in Array)
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(X, Y, attacked.X, attacked.Y) > spell.Range) continue;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
var damage = Calculate.Melee(attacker, attacked, ref attack, spell);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
Calculations.IsBreaking(attacker.Owner, ox, oy);
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
}
break;
}
#endregion
#endregion
#region Monk
#region ElementalAura
case 10395:
case 10410:
case 10420:
case 10421:
case 10422:
case 10423:
case 10424:
{
HandleAuraMonk(attacker, spell);
break;
}
#endregion
#region Compassion
case 10430:
{
if (CanUseSpell(spell, attacker.Owner))
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacker.Owner.Team != null)
{
PrepareSpell(spell, attacker.Owner);
foreach (Client.GameState teammate in attacker.Owner.Team.Teammates)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, teammate.Player.X, teammate.Player.Y) <= spell.Distance)
{
teammate.Player.RemoveFlag((ulong)MsgUpdate.Flags.Poisoned);
suse.AddTarget(teammate.Player.UID, 0, attack);
}
}
attacker.Owner.SendScreen(suse, true);
}
else
{
PrepareSpell(spell, attacker.Owner);
attacker.RemoveFlag((ulong)MsgUpdate.Flags.Poisoned);
suse.AddTarget(attacker.UID, 0, attack);
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.SendScreen(suse, true);
else attacker.Owner.SendScreen(suse, true);
}
}
break;
}
#endregion
#region Serenity
case 10400:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
if (attacker == null) return;
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
suse.Targets.Add(attacker.UID, 1);
attacked.ToxicFogLeft = 0;
attacked.NoDrugsTime = 0;
attacked.ScurbyBomb = 0;
attacked.DragonFuryTime = 0;
attacked.FlameLayerLeft = 0;
if (attacked.ContainsFlag2((ulong)MsgUpdate.Flags2.ScurvyBomb))
attacked.RemoveFlag2((ulong)MsgUpdate.Flags2.ScurvyBomb);
if (attacked.ContainsFlag2((ulong)MsgUpdate.Flags2.PoisonStar))
attacked.RemoveFlag2((ulong)MsgUpdate.Flags2.PoisonStar);
MsgUpdate upgrade = new MsgUpdate(true);
upgrade.UID = attacker.UID;
upgrade.Append((byte)MsgUpdate.DataType.Fatigue, 0, 0, 0, 0);
attacked.Owner.Send(upgrade.ToArray());
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Tranquility
case 10425:
{
if (attacker.EpicMonk())
{
attack.InteractType = MsgInteract.Magic;
attack.Decoded = true;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Attacked = attacked.UID;
attack.Attacker = attacker.UID;
attack.Damage = 12560;
goto restart;
}
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
if (attacked == null) return;
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacked.UID, 0, attack);
if (attacked != null && attacked.PlayerFlag == PlayerFlag.Player)
{
if (attacked.ContainsFlag2((ulong)MsgUpdate.Flags2.SoulShackle))
{
MsgUpdate upgrade = new MsgUpdate(true);
upgrade.UID = attacked.UID;
upgrade.Append((byte)MsgUpdate.DataType.SoulShackle, 111, 0, 0, 0);
attacked.Owner.Send(upgrade.ToArray());
}
attacked.ToxicFogLeft = 0;
attacked.ScurbyBomb = 0;
attacked.NoDrugsTime = 0;
attacked.DragonFuryTime = 0;
attacked.FlameLayerLeft = 0;
if (attacked.Dead)
{
attacked.SoulShackleRemover();
}
if (attacked.PlayerFlag == PlayerFlag.Player)
attacker.Owner.SendScreen(suse, true);
else attacked.MonsterInfo.SendScreen(suse);
}
}
break;
}
#endregion
#region WhirlwindKick
case 10415:
{
if (Time32.Now < attacker.SpellStamp.AddMilliseconds(300))
{
attacker.AttackPacket = null; return;
}
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 3)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = 0;
suse.X = (ushort)Kernel.Random.Next(3, 10);
suse.Y = 0;
//suse.SpellLevelHu = client_Spell.LevelHu2;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 3)
{
for (int c = 0; c < attacker.Owner.Screen.Objects.Length; c++)
{
//For a multi threaded application, while we go through the collection
//the collection might change. We will make sure that we wont go off
//the limits with a check.
if (c >= attacker.Owner.Screen.Objects.Length)
break;
Interfaces.IMapObject _obj = attacker.Owner.Screen.Objects[c];
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Ranged))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.6);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
attacked.Stunned = true;
attacked.StunStamp = Time32.Now;
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
}
attacker.AttackPacket = null;
}
else
{
attacker.AttackPacket = null; return;
}
attacker.Owner.SendScreen(suse, true);
attacker.SpellStamp = Time32.Now;
suse.Targets = new SafeDictionary<uint, MsgMagicEffect.DamageClass>();
attacker.AttackPacket = null; return;
}
attacker.AttackPacket = null;
}
attacker.AttackPacket = null; return;
}
#endregion
#region RadiantPalm
case 10381:
{
if (CanUseSpell(spell, attacker.Owner))
{
attacker.SpellStamp = Time32.Now;
ushort Xx, Yx;
if (attacked != null)
{
Xx = attacked.X;
Yx = attacked.Y;
}
else
{
Xx = attackedsob.X;
Yx = attackedsob.Y;
}
if (Kernel.GetDistance(attacker.X, attacker.Y, Xx, Yx) <= spell.Range)
{
if (attackedsob == null)
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly)) return;
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.Fly)) return;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
bool send = false;
if (attackedsob == null)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
var damage = Calculate.Melee(attacker, attacked, ref attack);
/*if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 1.2);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 1.2);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 1.2);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Earl)
{*/
damage = (uint)(damage * 1.3);
//}
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
send = true;
}
}
else
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
var damage = Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.Effect = attack.Effect;
suse.AddTarget(attackedsob.UID, damage, attack);
send = true;
}
}
if (send)
attacker.Owner.SendScreen(suse, true);
}
else
{
attacker.AttackPacket = null;
}
}
break;
}
#endregion
#region SoulShackle
case 10405:
{
if (CanUseSpell(spell, attacker.Owner) && attacked.Dead)
{
if (attacked.PlayerFlag == PlayerFlag.Player)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacked.UID, 0, attack);
if (attacked.Dead)
{
if (attacker.BattlePower >= attacked.BattlePower ||
attacker.BattlePower > (attacked.BattlePower - 15))
{
attacked.ShackleStamp = Time32.Now;
attacked.ShackleTime = (short)spell.Duration;
MsgUpdate upgrade = new MsgUpdate(true);
upgrade.UID = attacked.UID;
upgrade.Append((byte)MsgUpdate.DataType.SoulShackle, 111, (uint)spell.Duration, 0, 0);
attacked.Owner.Send(upgrade.ToArray());
attacked.AddFlag2((ulong)MsgUpdate.Flags2.SoulShackle);
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.SendScreen(suse, true);
}
}
}
attacker.AttackPacket = null;
break;
}
break;
}
#endregion
#endregion
#region Pirate
#region GaleBomb
case 11070:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
Map map;
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
MsgMagicEffect.DamageClass tar = new MsgMagicEffect.DamageClass();
int num = 0;
switch (spell.Level)
{
case 0:
case 1: num = 3; break;
case 2:
case 3: num = 4; break;
default: num = 5; break;
}
int i = 0;
Kernel.Maps.TryGetValue(attacker.Owner.Map.BaseID, out map);
foreach (var t in attacker.Owner.Screen.Objects)
{
if (t == null) continue;
if (t.MapObjType == MapObjectType.Player || t.MapObjType == MapObjectType.Monster)
{
var target = t as Player;
if (Kernel.GetDistance(X, Y, target.X, target.Y) <= spell.Range)
{
if (CanAttack(attacker, target, spell, false))
{
tar.Damage = Calculate.Melee(attacker, target, ref attack, spell);
tar.Hit = true;
tar.newX = target.X;
tar.newY = target.Y;
Map.Pushback(ref tar.newX, ref tar.newY, attacker.Facing, 5);
if (map != null)
{
if (map.Floor[tar.newX, tar.newY, MapObjectType.Player, attacker])
{
target.X = tar.newX;
target.Y = tar.newY;
}
else
{
tar.newX = target.X;
tar.newY = target.Y;
}
}
else
{
if (attacker.Owner.Map.Floor[tar.newX, tar.newY, MapObjectType.Player, attacker])
{
target.X = tar.newX;
target.Y = tar.newY;
}
else
{
target.X = tar.newX;
target.Y = tar.newY;
}
}
suse.AddTarget(target.UID, tar, attack);
ReceiveAttack(attacker, target, attack, ref tar.Damage, spell);
i++;
if (i > num) break;
}
}
}
}
if (attacker.PlayerFlag == PlayerFlag.Player)
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region BladeTempest
case 11110:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
ushort _X = attacker.X, _Y = attacker.Y;
ushort _tX = X, _tY = Y;
byte dist = (byte)spell.Distance;
var Array = attacker.Owner.Screen.Objects;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist, InLineAlgorithm.Algorithm.DDA);
X = attacker.X;
Y = attacker.Y;
int i = 0;
for (i = 0; i < algo.lcoords.Count; i++)
{
if (attacker.Owner.Map.Floor[algo.lcoords[i].X, algo.lcoords[i].Y, MapObjectType.Player]
&& !attacker.ThroughGate(algo.lcoords[i].X, algo.lcoords[i].Y))
{
X = (ushort)algo.lcoords[i].X;
Y = (ushort)algo.lcoords[i].Y;
}
else
{
break;
}
}
suse.X = X;
suse.Y = Y;
if (!attacker.Owner.Map.Floor[X, Y, MapObjectType.Player, null]) return;
double disth = 1.5;
foreach (Interfaces.IMapObject _obj in Array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Player;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
var damage = Calculate.Melee(attacker, attacked, ref attack, spell);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
var damage = Calculate.Melee(attacker, attacked, ref attack, spell);
/*if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.9);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.9);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.9);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Earl)
{*/
damage = (uint)(damage * 1.0);
//}
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (CanAttack(attacker, attackedsob, spell))
{
var damage = Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
attacker.PX = attacker.X;
attacker.PY = attacker.Y;
attacker.X = X;
attacker.Y = Y;
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
}
break;
}
#endregion
#region Kraken`sRevenge
case 11100:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
int num = 0;
switch (spell.Level)
{
case 0:
case 1: num = 3; break;
case 2:
case 3: num = 4; break;
default: num = 5; break;
}
int i = 0;
MsgDeadMark bsp = new MsgDeadMark();
foreach (var t in attacker.Owner.Screen.Objects.OrderBy(x => Kernel.GetDistance(x.X, x.Y, attacker.Owner.Player.X, attacker.Owner.Player.Y)))
{
if (t == null)
continue;
if (t.MapObjType == MapObjectType.Player || t.MapObjType == MapObjectType.Monster)
{
var target = t as Player;
if (CanAttack(attacker, target, spell, false))
{
target.IsBlackSpotted = true;
target.BlackSpotStamp = Time32.Now;
target.BlackSpotStepSecs = spell.Duration;
Kernel.BlackSpoted.TryAdd(target.UID, target);
suse.AddTarget(target.UID, new MsgMagicEffect.DamageClass(), attack);
i++;
if (i == num) break;
}
}
}
if (attacker.PlayerFlag == PlayerFlag.Player)
attacker.Owner.SendScreen(suse, true);
foreach (var h in Server.GamePool)
{
foreach (var t in suse.Targets.Keys)
{
h.Send(bsp.ToArray(true, t));
}
}
}
break;
}
#endregion
#region ScurvyBomb
case 11040:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(X, Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
int potDifference = attacker.BattlePower - attacked.BattlePower;
int rate = spell.Percent + potDifference;
if (Kernel.Rate(rate))
{
if (_obj.MapObjType == MapObjectType.Player)
{
attacked.ScurbyBombStamp = Time32.Now;
attacked.ScurbyBomb2Stamp = Time32.Now;
attacked.ScurbyBomb = 20;
attacked.AddFlag2((ulong)MsgUpdate.Flags2.ScurvyBomb);
MsgUpdate upgrade = new MsgUpdate(true);
upgrade.UID = attacked.UID;
upgrade.Append((byte)MsgUpdate.DataType.Fatigue, 20, 20, 0, 0);
attacked.Owner.Send(upgrade.ToArray());
}
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.Targets.Add(attacked.UID, damage);
}
else
{
suse.Targets.Add(attacked.UID, 0);
suse.Targets[attacked.UID].Hit = false;
}
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Cannon Barrage
case 11050:
{
if (attacker.Owner.Player.ContainsFlag((ulong)MsgUpdate.Flags.XPList))
{
attacker.Owner.Player.RemoveFlag((ulong)MsgUpdate.Flags.XPList);
attacker.Owner.Player.AddFlag2((ulong)MsgUpdate.Flags2.CannonBarrage);
attacker.Owner.Player.CannonBarrageStamp = Time32.Now;
return;
}
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
MsgMagicEffect.DamageClass tar = new MsgMagicEffect.DamageClass();
foreach (var t in attacker.Owner.Screen.Objects)
{
if (t == null) continue;
if (t.MapObjType == MapObjectType.Player || t.MapObjType == MapObjectType.Monster)
{
var target = t as Player;
if (Kernel.GetDistance(attacker.Owner.Player.X, attacker.Owner.Player.Y, target.X, target.Y) <= spell.Range)
{
if (CanAttack(attacker, target, spell, false))
{
tar.Damage = Calculate.Ranged(attacker, target, ref attack);
ReceiveAttack(attacker, target, attack, ref tar.Damage, spell);
suse.AddTarget(target.UID, tar, attack);
}
}
}
}
if (attacker.PlayerFlag == PlayerFlag.Player)
attacker.Owner.SendScreen(suse, true);
break;
}
#endregion
#region Blackbeard`sRage
case 11060:
{
if (attacker.Owner.Player.ContainsFlag((ulong)MsgUpdate.Flags.XPList))
{
attacker.Owner.Player.RemoveFlag((ulong)MsgUpdate.Flags.XPList);
attacker.Owner.Player.AddFlag2((ulong)MsgUpdate.Flags2.BlackbeardsRage);
attacker.Owner.Player.BlackbeardsRageStamp = Time32.Now;
return;
}
int targets = 0;
switch (spell.Level)
{
case 0:
case 1: targets = 3; break;
case 2:
case 3: targets = 4; break;
default: targets = 5; break;
}
int i = 0;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
MsgMagicEffect.DamageClass tar = new MsgMagicEffect.DamageClass();
foreach (var t in attacker.Owner.Screen.Objects)
{
if (t == null) continue;
if (t.MapObjType == MapObjectType.Player || t.MapObjType == MapObjectType.Monster)
{
var target = t as Player;
if (Kernel.GetDistance(attacker.Owner.Player.X, attacker.Owner.Player.Y, target.X, target.Y) <= spell.Range)
{
if (CanAttack(attacker, target, spell, false))
{
tar.Damage = Calculate.Ranged(attacker, target, ref attack);
suse.AddTarget(target.UID, tar, attack);
ReceiveAttack(attacker, target, attack, ref tar.Damage, spell);
i++;
if (i == targets) break;
}
}
}
}
if (attacker.PlayerFlag == PlayerFlag.Player)
attacker.Owner.SendScreen(suse, true);
break;
}
#endregion
#endregion
#region Warrior
#region ExtraXP
case 1040:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacker.Owner.Team != null)
foreach (Client.GameState teammate in attacker.Owner.Team.Teammates)
{
if (teammate.Player.UID != attacker.UID)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, teammate.Player.X, teammate.Player.Y) <= spell.Distance)
{
teammate.XPCount += 20;
MsgUpdate update = new MsgUpdate(true);
update.UID = teammate.Player.UID;
update.Append((byte)MsgUpdate.DataType.XPCircle, teammate.XPCount);
update.Send(teammate);
suse.Targets.Add(teammate.Player.UID, 20);
if (spell.NextSpellID != 0)
{
attack.Damage = spell.NextSpellID;
attacker.AttackPacket = attack;
}
else attacker.AttackPacket = null;
}
}
}
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.SendScreen(suse, true);
else attacked.MonsterInfo.SendScreen(suse);
}
break;
}
#endregion
#region Dash
case 1051:
{
if (attacked != null)
{
if (!attacked.Dead)
{
var direction = Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y);
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack = new MsgInteract(true);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack);
attack.InteractType = MsgInteract.Dash;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.Damage = damage;
attack.ToArray()[27] = (byte)direction;
attacked.Move(direction);
attacker.Move(direction);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
attacker.Owner.SendScreen(attack, true);
}
}
}
break;
}
#endregion
#region MagicDefender
case 11200:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (attacker.Class >= 20 && attacker.Class <= 25)
{
if (!attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.MagicDefender))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.MagicDefender))
{
attacker.RemoveFlag3((ulong)MsgUpdate.Flags3.MagicDefender);
attacker.RemoveFlag2((ulong)MsgUpdate.Flags2.MagicDefenderIcon);
}
attacker.MagicDefenderStamp = Time32.Now;
attacker.MagicDefender = spell.Duration;
attacker.AddFlag3((ulong)MsgUpdate.Flags3.MagicDefender);
attacker.AddFlag2((ulong)MsgUpdate.Flags2.MagicDefenderIcon);
MsgUpdate upgrade = new MsgUpdate(true);
upgrade.UID = attacker.UID;
upgrade.Append((byte)MsgUpdate.DataType.AzureShield, 128, (uint)spell.Duration, 0, spell.Level);
attacker.Owner.Send(upgrade.ToArray());
attacker.Owner.SendScreen(suse, true);
}
}
}
break;
}
#endregion
#region ShieldBlock
case 10470:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (attacker.Class >= 20 && attacker.Class <= 25)
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacker.BlockShieldStamp = Time32.Now;
attacker.BlockShield = spell.Duration;
attacker.BlockShieldCheck = true;
attacker.Owner.ReloadBlock();
MsgUpdate upgrade = new MsgUpdate(true);
upgrade.UID = attacker.UID;
upgrade.Append((byte)MsgUpdate.DataType.AzureShield, 113, (uint)spell.Duration, spell.Power, spell.Level);
attacker.Owner.Send(upgrade.ToArray());
attacker.Owner.SendScreen(suse, true);
}
}
break;
}
#endregion
#region DefensiveStance
case 11160:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (attacker.Class >= 20 && attacker.Class <= 25)
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacker.ContainsFlag2((ulong)MsgUpdate.Flags2.DefensiveStance))
{
attacker.RemoveFlag2((ulong)MsgUpdate.Flags2.DefensiveStance);
attacker.DefensiveStance = 0;
}
else if (!attacker.ContainsFlag2((ulong)MsgUpdate.Flags2.DefensiveStance))
{
attacker.DefensiveStanceStamp = Time32.Now;
attacker.DefensiveStance = spell.Duration;
attacker.AddFlag2((ulong)MsgUpdate.Flags2.DefensiveStance);
MsgUpdate upgrade = new MsgUpdate(true);
upgrade.UID = attacker.UID;
upgrade.Append((byte)MsgUpdate.DataType.DefensiveStance, 126, (uint)spell.Duration, (uint)spell.PowerPercent, spell.Level);
attacker.Owner.Send(upgrade.ToArray());
attacker.Owner.SendScreen(suse, true);
}
}
}
break;
}
#endregion
#endregion
#region Trojan
#region CruelShabe
case 3050:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (attackedsob != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Distance)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
uint damage = Calculate.Percent(attackedsob, spell.PowerPercent);
attackedsob.Hitpoints -= damage;
suse.AddTarget(attackedsob.UID, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
PrepareSpell(spell, attacker.Owner);
uint damage = Calculate.Percent(attacked, spell.PowerPercent);
if (attacked.PlayerFlag == PlayerFlag.Player)
{
attacker.Owner.UpdateQualifier(damage);
}
attacked.Hitpoints -= damage;
suse.AddTarget(attacked.UID, damage, attack);
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.SendScreen(suse, true);
else attacked.MonsterInfo.SendScreen(suse);
}
}
}
}
break;
}
#endregion
#region SuperCyclone
case 11970:
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacker.OnSuperCyclone()) return;
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.XPList))
{
if (!attacked.OnKOSpell())
attacked.KOCount = 0;
attacked.KOSpell = spell.ID;
attacked.SuperCycloneTime = 40;
attacker.AddFlag3((ulong)MsgUpdate.Flags3.SuperCyclone);
attacker.SuperCycloneStamp = Time32.Now;
attacker.RemoveFlag((ulong)MsgUpdate.Flags.XPList);
}
attacker.Owner.SendScreen(suse, true);
break;
}
#endregion
#region FatalCross
case 11980:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
RangeMove moveIn = new RangeMove();
List<RangeMove.Coords> ranger = moveIn.MoveCoords(attacker.X, attacker.Y, X, Y);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (!moveIn.InRange(attacked.X, attacked.Y, 2, ranger)) continue;
{
if (!CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee)) continue;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
//{
damage = (uint)(damage * 1.3);
//}
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Prince)
//{
// damage = (uint)(damage * 0.9);
//}
//if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Duke)
//{
//damage = (uint)(damage * 0.9);
//}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Earl)
//{
//damage = (uint)(damage * 0.9);
//}
suse.Effect = attack.Effect;
attack.Damage = damage;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (attackedsob == null) continue;
if (!moveIn.InRange(attackedsob.X, attackedsob.Y, 2, ranger)) continue;
{
if (!CanAttack(attacker, attackedsob, spell)) continue;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region MortalStrike
case 11990:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Range);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance + 1)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 1.0);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.8);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.6);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.4);
}
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
var damage = Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
attacker.PX = attacker.X;
attacker.PY = attacker.Y;
attacker.X = X;
attacker.Y = Y;
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
}
break;
}
#endregion
#endregion
#region LeeLong
#region DragonFlow
case 12270:
{
if (attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.DragonFlow))
{
attacker.RemoveFlag3((ulong)MsgUpdate.Flags3.DragonFlow);
}
else
{
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.Attacker = attacker.UID;
MsgMagicEffect.Attacker1 = attacker.UID;
MsgMagicEffect.SpellID = spell.ID;
MsgMagicEffect.SpellLevel = spell.Level;
MsgMagicEffect.X = X;
MsgMagicEffect.Y = Y;
MsgMagicEffect.AddTarget(attacker.UID, 1, null);
attacker.Owner.SendScreen(MsgMagicEffect, true);
attacker.AddFlag3((ulong)MsgUpdate.Flags3.DragonFlow);
attacker.DragonFlowStamp = Time32.Now;
}
break;
}
#endregion
#region DragonRoar
case 12280:
{
if (CanUseSpell(spell, attacker.Owner))
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
PrepareSpell(spell, attacker.Owner);
if (attacker.Owner.Team != null)
{
foreach (var teammate in attacker.Owner.Team.Teammates)
{
if (teammate.Player.UID != attacker.UID)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, teammate.Player.X, teammate.Player.Y) <= spell.Range)
{
teammate.Player.Stamina += (byte)spell.Power;
suse.AddTarget(teammate.Player.UID, spell.Power, null);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region DragonCyclone
case 12290:
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacker.ContainsFlag((ulong)MsgUpdate.Flags.XPList))
{
attacker.KOCount = 0;
attacker.DragonCycloneTime = 40;
attacker.RemoveFlag((ulong)MsgUpdate.Flags.XPList);
attacker.AddFlag3((ulong)MsgUpdate.Flags3.DragonCyclone);
attacker.DragonCycloneStamp = Time32.Now;
attacker.Owner.SendScreen(suse, true);
}
else
{
ushort _X = attacker.X, _Y = attacker.Y;
ushort _tX = X, _tY = Y;
byte dist = (byte)spell.Distance;
var Array = attacker.Owner.Screen.Objects;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist, InLineAlgorithm.Algorithm.DDA);
X = attacker.X;
Y = attacker.Y;
int i = 0;
for (i = 0; i < algo.lcoords.Count; i++)
{
if (attacker.Owner.Map.Floor[algo.lcoords[i].X, algo.lcoords[i].Y, MapObjectType.Player] && !attacker.ThroughGate(algo.lcoords[i].X, algo.lcoords[i].Y))
{
X = (ushort)algo.lcoords[i].X;
Y = (ushort)algo.lcoords[i].Y;
}
else
{
break;
}
}
suse.X = X;
suse.Y = Y;
if (!attacker.Owner.Map.Floor[X, Y, MapObjectType.Player, null]) return;
double disth = 1.5;
foreach (Interfaces.IMapObject _obj in Array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Player;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
var damage = Calculate.Melee(attacker, attacked, ref attack, spell);
suse.Effect = attack.Effect;
damage = (uint)((damage * spell.PowerPercent) / 3);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
var damage = Calculate.Melee(attacker, attacked, ref attack, spell);
suse.Effect = attack.Effect;
damage = (uint)(damage * 0.4);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
var damage = Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
attacker.PX = attacker.X;
attacker.PY = attacker.Y;
attacker.X = X;
attacker.Y = Y;
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
}
break;
}
#endregion
#region DragonSlash
case 12350:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
InLineAlgorithm ila = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (ila.InLine(attacked.X, attacked.Y))
{
if (!CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee)) continue;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.7);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.4);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.5);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.3);
}
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (ila.InLine(attackedsob.X, attackedsob.Y))
{
if (!CanAttack(attacker, attackedsob, spell)) continue;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region AirKick
case 12320:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
ushort _X = attacker.X, _Y = attacker.Y;
ushort _tX = X, _tY = Y;
byte dist = (byte)spell.Distance;
var Array = attacker.Owner.Screen.Objects;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist, InLineAlgorithm.Algorithm.DDA);
X = attacker.X;
Y = attacker.Y;
int i = 0;
for (i = 0; i < algo.lcoords.Count; i++)
{
if (attacker.Owner.Map.Floor[algo.lcoords[i].X, algo.lcoords[i].Y, MapObjectType.Player]
&& !attacker.ThroughGate(algo.lcoords[i].X, algo.lcoords[i].Y))
{
X = (ushort)algo.lcoords[i].X;
Y = (ushort)algo.lcoords[i].Y;
}
else
{
break;
}
}
suse.X = X;
suse.Y = Y;
if (!attacker.Owner.Map.Floor[X, Y, MapObjectType.Player, null]) return;
double disth = 1.5;
foreach (Interfaces.IMapObject _obj in Array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Player;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
var damage = Calculate.Melee(attacker, attacked, ref attack, spell);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
var damage = Calculate.Melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 1.0);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
var damage = Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
attacker.PX = attacker.X;
attacker.PY = attacker.Y;
attacker.X = X;
attacker.Y = Y;
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
}
break;
}
#endregion
#region AirSweep & AirRaid
case 12330:
case 12340:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Range);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Speed Kick
case 12120:
case 12130:
case 12140:
{
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanUseSpell(spell, attacker.Owner))
{
if (attacked != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 1.0);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else
{
attacker.AttackPacket = null;
}
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Distance)
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Magic(attacker, attackedsob, spell, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.PX = attacker.X;
attacker.PY = attacker.Y;
attacker.X = X;
attacker.Y = Y;
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
break;
}
#endregion
#region Cracking swipe
case 12170:
case 12160:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Fan sector = new Fan(attacker.X, attacker.Y, X, Y, spell.Range, spell.Sector);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance + 1)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (sector.IsInFan(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.6);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.6);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.6);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.6);
}
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (sector.IsInFan(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Dragon Punch
case 12240:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
InLineAlgorithm ila = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (ila.InLine(attacked.X, attacked.Y))
{
if (!CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee)) continue;
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region DragonFury
case 12300:
{
if (attacked != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack, spell);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
attacker.Owner.Player.IsEagleEyeShooted = true;
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.SendScreen(suse, true);
else attacked.MonsterInfo.SendScreen(suse);
if (attacked.PlayerFlag == PlayerFlag.Player)
{
int potDifference = attacker.BattlePower - attacked.BattlePower;
int rate = spell.Percent + potDifference - 20;
if (Kernel.Rate(rate))
{
attacked.AddFlag3((ulong)MsgUpdate.Flags3.DragonFury);
attacked.DragonFuryStamp = Time32.Now;
attacked.DragonFuryTime = spell.Duration;
MsgUpdate upgrade = new MsgUpdate(true);
upgrade.UID = attacked.UID;
upgrade.Append((byte)MsgUpdate.DataType.DragonFury, (uint)spell.Status, (uint)spell.Duration, spell.Power, spell.Level);
attacker.Owner.Send(upgrade.ToArray());
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.Send(upgrade);
else attacked.MonsterInfo.SendScreen(upgrade);
}
}
}
}
}
}
break;
}
#endregion
#region DragonSwing
case 12200:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.Attacker = attacker.UID;
MsgMagicEffect.SpellID = spell.ID;
MsgMagicEffect.SpellLevel = spell.Level;
MsgMagicEffect.X = X;
MsgMagicEffect.Y = Y;
attacker.Owner.SendScreen(MsgMagicEffect, true);
if (!attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.DragonSwing))
{
attacker.AddFlag3((ulong)MsgUpdate.Flags3.DragonSwing);
MsgUpdate upgrade = new MsgUpdate(true);
upgrade.UID = attacker.UID;
upgrade.Append((byte)MsgUpdate.DataType.DragonSwing, 1, 1000000, 0, 0);
attacker.Owner.Send(upgrade.ToArray());
}
}
break;
}
#endregion
#endregion
#region New Tao
#region AuroraLotus
case 12370:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (!attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.AuroraLotus)) return;
var map = attacker.Owner.Map;
if (!map.Floor[X, Y, MapObjectType.Item, null]) return;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.AddTarget(attacker.UID, 0, null);
attacker.Owner.SendScreen(suse, true);
MsgMapItem floorItem = new MsgMapItem(true);
floorItem.ItemID = MsgMapItem.AuroraLotus;
floorItem.MapID = attacker.MapID;
floorItem.Type = MsgMapItem.Effect;
floorItem.X = X;
floorItem.Y = Y;
floorItem.OnFloor = Time32.Now;
floorItem.Owner = attacker.Owner;
floorItem.UID = MsgMapItem.FloorUID.Next;
while (map.FloorItems.ContainsKey(floorItem.UID))
floorItem.UID = MsgMapItem.FloorUID.Next;
floorItem.MaxLife = 25;
floorItem.Life = 25;
floorItem.mColor = 13;
floorItem.OwnerUID = attacker.UID;
floorItem.OwnerGuildUID = attacker.GuildID;
floorItem.FlowerType = 0;
floorItem.Time = Kernel.TqTimer(DateTime.Now.AddSeconds(7));
floorItem.Name = "AuroraLotus";
map.AddFloorItem(floorItem);
attacker.Owner.SendScreenSpawn(floorItem, true);
attacker.AuroraLotusEnergy = 0;
attacker.Lotus(attacker.AuroraLotusEnergy, (byte)MsgUpdate.DataType.AuroraLotus);
attacker.AttackPacket = null;
}
break;
}
#endregion
#region FlameLotus
case 12380:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (!attacker.ContainsFlag3((ulong)MsgUpdate.Flags3.FlameLotus)) return;
var map = attacker.Owner.Map;
if (!map.Floor[X, Y, MapObjectType.Item, null]) return;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.AddTarget(attacker.UID, 0, null);
attacker.Owner.SendScreen(suse, true);
MsgMapItem floorItem = new MsgMapItem(true);
floorItem.ItemID = MsgMapItem.FlameLotus;
floorItem.MapID = attacker.MapID;
floorItem.Type = MsgMapItem.Effect;
floorItem.X = X;
floorItem.Y = Y;
floorItem.OnFloor = Time32.Now;
floorItem.Owner = attacker.Owner;
floorItem.UID = MsgMapItem.FloorUID.Next;
while (map.FloorItems.ContainsKey(floorItem.UID))
floorItem.UID = MsgMapItem.FloorUID.Next;
floorItem.MaxLife = 25;
floorItem.Life = 25;
floorItem.mColor = 13;
floorItem.OwnerUID = attacker.UID;
floorItem.OwnerGuildUID = attacker.GuildID;
floorItem.FlowerType = 0;
floorItem.Time = Kernel.TqTimer(DateTime.Now.AddSeconds(7));
floorItem.Name = "FlameLotus";
map.AddFloorItem(floorItem);
attacker.Owner.SendScreenSpawn(floorItem, true);
attacker.FlameLotusEnergy = 0;
attacker.Lotus(attacker.FlameLotusEnergy, (byte)MsgUpdate.DataType.FlameLotus);
attacker.AttackPacket = null;
}
break;
}
#endregion
#endregion
#region New Monk
#region UpSweep
case 12580://up
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacked == null)
return;
var angle = Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y);
Map.UpdateCoordonatesForAngle(ref X, ref Y, angle);
Fan sector = new Fan(attacker.X, attacker.Y, X, Y, spell.Range, spell.Sector);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (Kernel.GetDistance(attacker.X, attacker.Y, _obj.X, _obj.Y) <= 7)
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (sector.IsInFan(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.5);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (sector.IsInFan(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region DownSweep
case 12590://down
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacked == null)
return;
var angle = Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y);
angle = Enums.OppositeAngle(angle);
Map.UpdateCoordonatesForAngle(ref X, ref Y, angle);
Fan sector = new Fan(attacker.X, attacker.Y, X, Y, spell.Range, spell.Sector);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (Kernel.GetDistance(attacker.X, attacker.Y, _obj.X, _obj.Y) <= 7)
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (sector.IsInFan(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.5);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (sector.IsInFan(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region strike
case 12600:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
{
if (attackedsob != null)
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
else
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.5);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
attacker.AttackPacket = null;
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
attacker.AttackPacket = null;
break;
}
#endregion
#region WrathOfEmperor
case 12570:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.SpecialEffect = 1;
suse.X = X;
suse.Y = Y;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly))
return;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region GraceOfHeaven
case 12560:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
SpellID = 10425;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
attacker.AttackPacket = null;
if (attacker.Owner.Team != null)
{
foreach (Client.GameState teammate in attacker.Owner.Team.Teammates)
{
// if (Kernel.GetDistance(attacker.X, attacker.Y, teammate.Player.X, teammate.Player.Y) <= spell.Range)
{
if (teammate.Player.ContainsFlag2((ulong)MsgUpdate.Flags2.SoulShackle))
{
teammate.Player.RemoveFlag2((ulong)MsgUpdate.Flags2.SoulShackle);
suse.AddTarget(teammate.Player.UID, 0, attack);
MsgUpdate upgrade = new MsgUpdate(true);
upgrade.UID = teammate.Player.UID;
upgrade.Append((byte)MsgUpdate.DataType.SoulShackle
, 111
, 0, 0, spell.Level);
if (teammate.Player.PlayerFlag == PlayerFlag.Player)
teammate.Player.Owner.Send(upgrade.ToArray());
}
}
}
attacker.Owner.SendScreen(suse, true);
}
{
suse.AddTarget(attacked.UID, 0, attack);
attacked.ToxicFogLeft = 0;
attacked.RemoveFlag2((ulong)MsgUpdate.Flags2.SoulShackle);
MsgUpdate upgrade = new MsgUpdate(true);
upgrade.UID = attacked.UID;
upgrade.Append((byte)MsgUpdate.DataType.SoulShackle
, 111
, 0, 0, spell.Level);
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.Send(upgrade.ToArray());
attacked.ToxicFogLeft = 0;
attacked.ScurbyBomb = 0;
attacked.NoDrugsTime = 0;
attacked.DragonFuryTime = 0;
attacked.FlameLayerLeft = 0;
//attacked.Owner.Send(new GameCharacterUpdates(true) { UID = attacked.UID, }
// .Remove(GameCharacterUpdates.SoulShacle));
attacked.NoDrugsTime = 0;
if (attacked.PlayerFlag == PlayerFlag.Player)
attacked.Owner.SendScreen(suse, true);
else
attacker.Owner.SendScreen(suse, true);
}
}
break;
}
#endregion
#region InfroEcho
case 12550:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (!attacker.EpicMonk())
return;
var map = attacker.Owner.Map;
if (!map.Floor[X, Y, MapObjectType.Item, null]) return;
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.SpecialEffect = 0;
suse.AddTarget(attacker.UID, 0, null);
attacker.Owner.SendScreen(suse, true);
var count = 3;
if (spell.Level == 6)
count = 4;
List<System.Drawing.Point> DestructionAreas = new List<System.Drawing.Point>();
for (int i = 0; i < 360; i += spell.Sector)
{
if (DestructionAreas.Count >= count)
break;
// var dist = Kernel.Random.Next(4);
var dist = Kernel.Random.Next(spell.Range, spell.Distance);
// var angle = Kernel.Random.Next(90);
var angle = i;
ushort x = (ushort)(X + (dist * Math.Cos(angle)));
ushort y = (ushort)(Y + (dist * Math.Sin(angle)));
System.Drawing.Point p = new System.Drawing.Point((int)x, (int)y);
if (!DestructionAreas.Contains(p))
DestructionAreas.Add(p);
else
i--;
}
foreach (var area in DestructionAreas)
{
X = (ushort)area.X;
Y = (ushort)area.Y;
MsgMapItem floorItem = new MsgMapItem(true);
floorItem.ItemID = MsgMapItem.InfroEcho;// (uint)(1390 + spell.Level);
floorItem.MapID = attacker.MapID;
floorItem.mColor = 14;
floorItem.ItemColor = (Enums.Color.Black);
floorItem.Type = MsgMapItem.Effect;
floorItem.OwnerUID = attacker.UID;
floorItem.OwnerGuildUID = attacker.GuildID;
floorItem.FlowerType = 1;
floorItem.X = X;
floorItem.Y = Y;
floorItem.OnFloor = Time32.Now;
floorItem.Owner = attacker.Owner;
floorItem.Name = "trap";
while (map.FloorItems.ContainsKey(floorItem.UID))
floorItem.UID = Mr.HaMoOo.Network.GamePackets.MsgMapItem.FloorUID.Next;
map.AddFloorItem(floorItem);
attacker.Owner.SendScreenSpawn(floorItem, true);
}
}
break;
}
#endregion
#endregion
//ahmed nemo 01128547851
#region EpicWarrior
#region ManiacDance
case 12700:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacker.AddFlag3((ulong)1UL << 53);
attacker.ManiacDance = Time32.Now;
attacker.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region WaveofBlood
case 12690:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Fan sector = new Fan(attacker.X, attacker.Y, X, Y, spell.Range, spell.Sector);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance + 1)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (sector.IsInFan(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, spell);
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.4);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.4);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.4);
}
if (attacker.NobilityRank == Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.4);
}
suse.Effect = attack.Effect;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (sector.IsInFan(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect = MsgInteract.InteractEffects.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
damage = (uint)(damage * 0.9);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Pounce
case 12770:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
//suse.SpellLevelHu = client_Spell.LevelHu2;
suse.SpellLevel = spell.Level;
ushort _X = attacker.X, _Y = attacker.Y;
ushort _tX = X, _tY = Y;
UInt16 ox, oy;
ox = attacker.X;
oy = attacker.Y;
byte dist = (byte)spell.Distance;
var Array = attacker.Owner.Screen.Objects;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist,
InLineAlgorithm.Algorithm.DDA);
X = attacker.X;
Y = attacker.Y;
int i = 0;
for (i = 0; i < algo.lcoords.Count; i++)
{
if (attacker.Owner.Map.Floor[algo.lcoords[i].X, algo.lcoords[i].Y, MapObjectType.Player]
&& !attacker.ThroughGate(algo.lcoords[i].X, algo.lcoords[i].Y))
{
X = (ushort)algo.lcoords[i].X;
Y = (ushort)algo.lcoords[i].Y;
}
else
{
break;
}
}
suse.X = X;
suse.Y = Y;
if (!attacker.Owner.Map.Floor[X, Y, MapObjectType.Player, null])
return;
double disth = 1.5;
//if (attacker.MapID == DeathMatch.MAPID) disth = 1;
foreach (Interfaces.IMapObject _obj in Array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Player;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 1.1);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 1.0);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (CanAttack(attacker, attackedsob, spell))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
attacker.PX = attacker.X;
attacker.PY = attacker.Y;
attacker.X = X;
attacker.Y = Y;
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
}
break;
}
#endregion
#region Backfire
case 12680:
{
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.Attacker = attacker.UID;
MsgMagicEffect.Attacker1 = attacker.UID;
MsgMagicEffect.SpellID = spell.ID;
MsgMagicEffect.SpellLevel = spell.Level;
MsgMagicEffect.X = X;
MsgMagicEffect.Y = Y;
MsgMagicEffect.AddTarget(attacker.UID, 1, attack);
attacker.Owner.SendScreen(MsgMagicEffect, true);
if (attacker.ContainsFlag3((ulong)1UL << 51))
attacker.RemoveFlag3((ulong)1UL << 51);
else
attacker.AddFlag3((ulong)1UL << 51);
attacker.BackfireStamp = Time32.Now;
break;
}
#endregion
#endregion
default:
{
if (attacker.Owner.Account.State == AccountTable.AccountState.Administrator)
attacker.Owner.Send("Unknown Spell ID: " + spellID);
break;
}
}
attacker.Owner.IncreaseSpellExperience(Experience, spellID);
if (attacker.MapID == 1039)
{
if (spell.ID == 7001 || spell.ID == 9876)
{
attacker.AttackPacket = null;
return;
}
if (attacker.AttackPacket != null)
{
attack.Damage = spell.ID;
attacker.AttackPacket = attack;
var xspell = GetWeaponSpell(spell);
if (xspell != null)
{
if (attacker.AttackPacket == null)
{
attack.InteractType = MsgInteract.Melee;
attacker.AttackPacket = attack;
}
else
{
attacker.AttackPacket.InteractType = MsgInteract.Melee;
}
}
}
}
else
{
if (spell.NextSpellID != 0)
{
if (spell.NextSpellID >= 1000 && spell.NextSpellID <= 1002)
if (Target >= 1000000)
{
attacker.AttackPacket = null;
return;
}
attack.Damage = spell.NextSpellID;
attacker.AttackPacket = attack;
}
else
{
var xspell = GetWeaponSpell(spell);
if (xspell == null || spell.ID == 9876)
attacker.AttackPacket = null;
else
{
if (attacker.AttackPacket == null)
{
attack.InteractType = MsgInteract.Melee;
attacker.AttackPacket = attack;
}
else
{
attacker.AttackPacket.InteractType = MsgInteract.Melee;
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
}
#endregion
}
#endregion
}
#endregion
}
public static bool isArcherSkill(uint ID)
{
if (ID >= 8000 && ID <= 9875)
return true;
return false;
}
public static void QuitSteedRace(Player attacker)
{
attacker.Owner.MessageBox("Do you want to quit the steed race?", (pClient) =>
{
pClient.Player.Teleport(1002, 301, 279);
pClient.Player.RemoveFlag((ulong)MsgUpdate.Flags.Ride);
});
}
public Handle(MsgInteract attack, Player attacker, Player attacked)
{
this.attack = attack;
this.attacker = attacker;
this.attacked = attacked;
this.Execute();
}
public static List<ushort> GetWeaponSpell(SpellInformation spell)
{
return SpellTable.WeaponSpells.Values.Where(p => p.Contains(spell.ID)).FirstOrDefault();
}
public static void FlameLotus(MsgMapItem item, int count = 0)
{
var client = item.Owner;
if (!client.Spells.ContainsKey(12380)) return;
var spell = SpellTable.GetSpell(client.Spells[12380].ID, client.Spells[12380].Level);
if (count == 0)
{
switch (spell.Level)
{
case 0: count = 5; break;
case 1: count = 8; break;
case 2: count = 11; break;
case 3: count = 14; break;
case 4: count = 17; break;
case 5: count = 20; break;
case 6: count = 25; break;
}
}
var targets = PlayerinRange(item, spell.Range).ToArray();
targets = targets.Where(p => CanAttack(client.Player, p.Player, null, true)).ToArray();
targets = targets.Take(count).ToArray();
var attack = new MsgInteract(true);
attack.Attacker = item.Owner.Player.UID;
attack.InteractType = MsgInteract.Melee;
foreach (var target in targets)
{
uint damage = Calculate.Magic(client.Player, target.Player, spell, ref attack);
if (client.Spells.ContainsKey(1002))
{
var spell2 = SpellTable.GetSpell(client.Spells[1002].ID, client.Spells[1002].Level);
damage = Game.Attacking.Calculate.Magic(client.Player, target.Player, spell2, ref attack);
}
attack.Damage = damage;
attack.Attacked = target.Player.UID;
attack.X = target.Player.X;
attack.Y = target.Player.Y;
ReceiveAttack(client.Player, target.Player, attack, ref damage, spell);
client.Player.AttackPacket = null;
}
}
public static void AuroraLotus(MsgMapItem item, int count = 0)
{
var client = item.Owner;
if (!client.Spells.ContainsKey(12370)) return;
var spell = SpellTable.GetSpell(client.Spells[12370].ID, client.Spells[12370].Level);
if (count == 0)
{
switch (spell.Level)
{
case 0: count = 5; break;
case 1: count = 8; break;
case 2: count = 11; break;
case 3: count = 14; break;
case 4: count = 17; break;
case 5: count = 20; break;
case 6: count = 25; break;
}
}
var deads = PlayerinRange(item, spell.Range).Where(p => p.Player.Dead).ToArray();
if (client.Team != null)
deads = deads.Where(p => client.Team.Contain(p.Player.UID)).ToArray();
else if (client.Guild != null)
if (client.Guild.Members != null && client.Guild.Ally != null)
deads = deads.Where(p => client.Guild.Members.ContainsKey(p.Player.UID) || client.Guild.Ally.ContainsKey(p.Player.GuildID)).ToArray();
else
deads = deads.Where(p => client.Guild.ID == p.Player.GuildID).ToArray();
deads = deads.Take(count).ToArray();
if (deads != null)
{
foreach (var player in deads)
{
player.Player.Action = Enums.ConquerAction.None;
player.ReviveStamp = Time32.Now;
player.Attackable = false;
player.Player.TransformationID = 0;
player.Player.RemoveFlag((ulong)MsgUpdate.Flags.Dead);
player.Player.RemoveFlag((ulong)MsgUpdate.Flags.Ghost);
player.Player.Hitpoints = player.Player.MaxHitpoints;
player.Player.Ressurect();
player.BlessTouch(client);
}
}
}
public static void InfroEcho(MsgMapItem item, int count = 0)
{
var client = item.Owner;
var X = item.X;
var Y = item.Y;
if (!client.Spells.ContainsKey(12550))
return;
var spell = SpellTable.GetSpell(client.Spells[12550].ID, client.Spells[12550].Level);
var attack = new MsgInteract(true);
attack.Attacker = client.Player.UID;
attack.X = X;
attack.Y = Y;
attack.Damage = spell.ID;
attack.InteractType = MsgInteract.Magic;
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = client.Player.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.SpecialEffect = 1;
foreach (var c in client.Screen.Objects)
{
Interfaces.IMapObject _obj = c as Player;
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
{
var attacked = _obj as Player;
if (Kernel.GetDistance(X, Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(client.Player, attacked, spell, attack.InteractType == MsgInteract.Ranged))
{
uint damage = Game.Attacking.Calculate.Melee(client.Player, attacked, ref attack);
damage = (uint)(damage * 0.2);
suse.Effect = attack.Effect;
ReceiveAttack(client.Player, attacked, attack, ref damage, spell);
attacked.Stunned = true;
attacked.StunStamp = Time32.Now;
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
}
client.Player.AttackPacket = null;
client.SendScreen(suse, true);
}
public static void HandleAuraMonk(Player Attacker, SpellInformation Spell)
{
ulong StatusFlag = 0, StatusFlag2 = 0;
Enums.AuraType Aura = Enums.AuraType.TyrantAura;
switch (Spell.ID)
{
case 10424: StatusFlag = (ulong)MsgUpdate.Flags2.EarthAura; break;
case 10423: StatusFlag = (ulong)MsgUpdate.Flags2.FireAura; break;
case 10422: StatusFlag = (ulong)MsgUpdate.Flags2.WaterAura; break;
case 10421: StatusFlag = (ulong)MsgUpdate.Flags2.WoodAura; break;
case 10420: StatusFlag = (ulong)MsgUpdate.Flags2.MetalAura; break;
case 10410: StatusFlag = (ulong)MsgUpdate.Flags2.FendAura; break;
case 10395: StatusFlag = (ulong)MsgUpdate.Flags2.TyrantAura; break;
}
switch (Spell.ID)
{
case 10424: StatusFlag2 = (ulong)MsgUpdate.Flags2.EarthAuraIcon; break;
case 10423: StatusFlag2 = (ulong)MsgUpdate.Flags2.FireAuraIcon; break;
case 10422: StatusFlag2 = (ulong)MsgUpdate.Flags2.WaterAuraIcon; break;
case 10421: StatusFlag2 = (ulong)MsgUpdate.Flags2.WoodAuraIcon; break;
case 10420: StatusFlag2 = (ulong)MsgUpdate.Flags2.MetalAuraIcon; break;
case 10410: StatusFlag2 = (ulong)MsgUpdate.Flags2.FendAuraIcon; break;
case 10395: StatusFlag2 = (ulong)MsgUpdate.Flags2.TyrantAuraIcon; break;
}
if (Attacker.Dead) return;
if (Attacker.Aura_isActive)
{
switch (Attacker.Aura_actType)
{
case 10424: Aura = Enums.AuraType.EarthAura; break;
case 10423: Aura = Enums.AuraType.FireAura; break;
case 10422: Aura = Enums.AuraType.WaterAura; break;
case 10421: Aura = Enums.AuraType.WoodAura; break;
case 10420: Aura = Enums.AuraType.MetalAura; break;
case 10410: Aura = Enums.AuraType.FendAura; break;
case 10395: Aura = Enums.AuraType.TyrantAura; break;
}
new MsgUpdate(true).Aura(Attacker, Enums.AuraDataTypes.Remove, Aura, Spell);
Attacker.RemoveFlag2(Attacker.Aura_actType);
Attacker.RemoveFlag2(Attacker.Aura_actType2);
Attacker.Owner.removeAuraBonuses(Attacker.Aura_actType, Attacker.Aura_actPower, 1);
Attacker.Aura_isActive = false;
if (StatusFlag == Attacker.Aura_actType)
{
Attacker.Aura_actType = 0;
Attacker.Aura_actType2 = 0;
Attacker.Aura_actPower = 0;
Attacker.Aura_actLevel = 0;
return;
}
}
if (CanUseSpell(Spell, Attacker.Owner))
{
if (StatusFlag != 0)
{
switch (Attacker.Aura_actType)
{
case 10424: Aura = Enums.AuraType.EarthAura; break;
case 10423: Aura = Enums.AuraType.FireAura; break;
case 10422: Aura = Enums.AuraType.WaterAura; break;
case 10421: Aura = Enums.AuraType.WoodAura; break;
case 10420: Aura = Enums.AuraType.MetalAura; break;
case 10410: Aura = Enums.AuraType.FendAura; break;
case 10395: Aura = Enums.AuraType.TyrantAura; break;
}
new MsgUpdate(true).Aura(Attacker, Enums.AuraDataTypes.Remove, Aura, Spell);
Attacker.RemoveFlag2(Attacker.Aura_actType);
Attacker.RemoveFlag2(Attacker.Aura_actType2);
Attacker.Owner.removeAuraBonuses(Attacker.Aura_actType, Attacker.Aura_actPower, 1);
Attacker.Aura_isActive = false;
if (StatusFlag == Attacker.Aura_actType)
{
Attacker.Aura_actType2 = 0;
Attacker.Aura_actType = 0;
Attacker.Aura_actPower = 0;
Attacker.Aura_actLevel = 0;
}
}
if (Spell.Power == 0)
Spell.Power = 45;
PrepareSpell(Spell, Attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(true);
suse.Attacker = Attacker.UID;
suse.SpellID = Spell.ID;
suse.SpellLevel = Spell.Level;
suse.X = Attacker.X;
suse.Y = Attacker.Y;
suse.AddTarget(Attacker.UID, 0, null);
Attacker.Owner.SendScreen(suse, true);
Attacker.AddFlag2(StatusFlag);
Attacker.AddFlag2(StatusFlag2);
Attacker.Aura_isActive = true;
Attacker.Aura_actType = StatusFlag;
Attacker.Aura_actType2 = StatusFlag2;
Attacker.Aura_actPower = Spell.Power;
Attacker.Aura_actLevel = Spell.Level;
Attacker.Owner.doAuraBonuses(StatusFlag, Spell.Power, 1);
switch (Spell.ID)
{
case 10424: Aura = Enums.AuraType.EarthAura; break;
case 10423: Aura = Enums.AuraType.FireAura; break;
case 10422: Aura = Enums.AuraType.WaterAura; break;
case 10421: Aura = Enums.AuraType.WoodAura; break;
case 10420: Aura = Enums.AuraType.MetalAura; break;
case 10410: Aura = Enums.AuraType.FendAura; break;
case 10395: Aura = Enums.AuraType.TyrantAura; break;
}
new MsgUpdate(true).Aura(Attacker, Enums.AuraDataTypes.Add, Aura, Spell);
}
}
public static void LotusAttack(MsgMapItem item, Player attacker, MsgInteract attack)
{
//Console.WriteLine("For Test");
}
public static List<IMapObject> GetObjects(UInt16 ox, UInt16 oy, Client.GameState c)
{
UInt16 x, y;
x = c.Player.X;
y = c.Player.Y;
var list = new List<IMapObject>();
c.Player.X = ox;
c.Player.Y = oy;
foreach (IMapObject objects in c.Screen.Objects)
{
if (objects != null)
if (objects.UID != c.Player.UID)
if (!list.Contains(objects))
list.Add(objects);
}
c.Player.X = x;
c.Player.Y = y;
foreach (IMapObject objects in c.Screen.Objects)
{
if (objects != null)
if (objects.UID != c.Player.UID)
if (!list.Contains(objects))
list.Add(objects);
}
if (list.Count > 0)
return list;
return null;
}
public static IEnumerable<Client.GameState> PlayerinRange(Player attacker, Player attacked)
{
var dictionary = Kernel.GamePool.Values.ToArray();
return dictionary.Where((player) => player.Player.MapID == attacked.MapID && Kernel.GetDistance(player.Player.X, player.Player.Y, attacker.X, attacker.Y) <= 7);
}
public static IEnumerable<Client.GameState> PlayerinRange(MsgMapItem item, int dist)
{
var dictionary = Kernel.GamePool.Values.ToArray();
return dictionary.Where((player) => player.Player.MapID == item.MapID && Kernel.GetDistance(player.Player.X, player.Player.Y, item.X, item.Y) <= dist).OrderBy(player => Kernel.GetDistance(player.Player.X, player.Player.Y, item.X, item.Y));
}
public Player findClosestTarget(Player attacker, ushort X, ushort Y, IEnumerable<Interfaces.IMapObject> Array)
{
Player closest = attacker;
int dPrev = 10000, dist = 0;
foreach (var _obj in Array)
{
if (_obj == null) continue;
if (_obj.MapObjType != MapObjectType.Player && _obj.MapObjType != MapObjectType.Monster) continue;
dist = Kernel.GetDistance(X, Y, _obj.X, _obj.Y);
if (dist < dPrev)
{
dPrev = dist;
closest = (Player)_obj;
}
}
return closest;
}
public static bool CanUseSpell(SpellInformation spell, Client.GameState client)
{
if (client.Player.SkillTeamWatchingElitePKMatch != null) return false;
if (client.WatchingElitePKMatch != null) return false;
if (client.WatchingGroup != null) return false;
if (client.TeamWatchingGroup != null) return false;
if (spell == null) return false;
if (client.Player.Mana < spell.UseMana) return false;
if (client.Player.Stamina < spell.UseStamina) return false;
if (client.Player.MapID == 1707)
{
if (spell.ID != 1045 && spell.ID != 1046)
{
client.Send("You can't use any skills here Except FB And SS!"); return false;
}
}
if (spell.UseArrows > 0 && isArcherSkill(spell.ID))
{
var weapons = client.Weapons;
if (weapons.Item2 != null)
if (!client.Player.ContainsFlag3((ulong)MsgUpdate.Flags3.PathOfShadow))
if (!ItemHandler.IsArrow(weapons.Item2.ID)) return false;
return true;
}
if (spell.NeedXP == 1 && !client.Player.ContainsFlag((ulong)MsgUpdate.Flags.XPList)) return false;
return true;
}
public static void PrepareSpell(SpellInformation spell, Client.GameState client)
{
if (spell.NeedXP == 1)
client.Player.RemoveFlag((ulong)MsgUpdate.Flags.XPList);
if (client.Map.ID != 1039)
{
if (spell.UseMana > 0)
if (client.Player.Mana >= spell.UseMana)
client.Player.Mana -= spell.UseMana;
if (spell.UseStamina > 0)
if (client.Player.Stamina >= spell.UseStamina)
client.Player.Stamina -= spell.UseStamina;
}
}
public static void CheckForExtraWeaponPowers(Client.GameState client, Player attacked)
{
#region Right Hand
var weapons = client.Weapons;
if (weapons.Item1 != null)
{
if (weapons.Item1.ID != 0)
{
var Item = weapons.Item1;
if (Item.Effect != Enums.ItemEffect.None)
{
if (Kernel.Rate(30))
{
switch (Item.Effect)
{
case Enums.ItemEffect.HP:
{
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.Attacker = 1;
MsgMagicEffect.SpellID = 1175;
MsgMagicEffect.SpellLevel = 4;
MsgMagicEffect.X = client.Player.X;
MsgMagicEffect.Y = client.Player.Y;
MsgMagicEffect.AddTarget(client.Player.UID, 300, null);
uint damage = Math.Min(300, client.Player.MaxHitpoints - client.Player.Hitpoints);
client.Player.Hitpoints += damage;
client.SendScreen(MsgMagicEffect, true);
break;
}
case Enums.ItemEffect.MP:
{
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.Attacker = 1;
MsgMagicEffect.SpellID = 1175;
MsgMagicEffect.SpellLevel = 2;
MsgMagicEffect.X = client.Player.X;
MsgMagicEffect.Y = client.Player.Y;
MsgMagicEffect.AddTarget(client.Player.UID, 300, null);
ushort damage = (ushort)Math.Min(300, client.Player.MaxMana - client.Player.Mana);
client.Player.Mana += damage;
client.SendScreen(MsgMagicEffect, true);
break;
}
case Enums.ItemEffect.Shield:
{
if (client.Player.ContainsFlag((ulong)MsgUpdate.Flags.MagicShield)) return;
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.Attacker = 1;
MsgMagicEffect.SpellID = 1020;
MsgMagicEffect.SpellLevel = 0;
MsgMagicEffect.X = client.Player.X;
MsgMagicEffect.Y = client.Player.Y;
MsgMagicEffect.AddTarget(client.Player.UID, 120, null);
client.Player.ShieldTime = 0;
client.Player.ShieldStamp = Time32.Now;
client.Player.MagicShieldStamp = Time32.Now;
client.Player.MagicShieldTime = 0;
client.Player.AddFlag((ulong)MsgUpdate.Flags.MagicShield);
client.Player.MagicShieldStamp = Time32.Now;
client.Player.MagicShieldIncrease = 2;
client.Player.MagicShieldTime = 120;
if (client.Player.PlayerFlag == PlayerFlag.Player)
client.Send(Constants.Shield(2, 120));
client.SendScreen(MsgMagicEffect, true);
break;
}
case Enums.ItemEffect.Poison:
{
if (attacked != null)
{
if (Constants.PKForbiddenMaps.Contains(client.Player.MapID)) return;
if (client.Map.BaseID == 700) return;
if (attacked.UID == client.Player.UID) return;
if (attacked.ToxicFogLeft > 0) return;
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.SpellID = 5040;
MsgMagicEffect.Attacker = attacked.UID;
MsgMagicEffect.SpellLevel = 9;
MsgMagicEffect.X = attacked.X;
MsgMagicEffect.Y = attacked.Y;
MsgMagicEffect.AddTarget(attacked.UID, 0, null);
MsgMagicEffect.Targets[attacked.UID].Hit = true;
attacked.ToxicFogStamp = Time32.Now;
attacked.ToxicFogLeft = 10;
attacked.ToxicFogPercent = 0.05F;
client.SendScreen(MsgMagicEffect, true);
}
break;
}
}
}
}
}
}
#endregion
#region Left Hand
if (weapons.Item2 != null)
{
if (weapons.Item2.ID != 0)
{
var Item = weapons.Item2;
if (Item.Effect != Enums.ItemEffect.None)
{
if (Kernel.Rate(30))
{
switch (Item.Effect)
{
case Enums.ItemEffect.HP:
{
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.Attacker = 1;
MsgMagicEffect.SpellID = 1175;
MsgMagicEffect.SpellLevel = 4;
MsgMagicEffect.X = client.Player.X;
MsgMagicEffect.Y = client.Player.Y;
MsgMagicEffect.AddTarget(client.Player.UID, 300, null);
uint damage = Math.Min(300, client.Player.MaxHitpoints - client.Player.Hitpoints);
client.Player.Hitpoints += damage;
client.SendScreen(MsgMagicEffect, true);
break;
}
case Enums.ItemEffect.MP:
{
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.Attacker = 1;
MsgMagicEffect.SpellID = 1175;
MsgMagicEffect.SpellLevel = 2;
MsgMagicEffect.X = client.Player.X;
MsgMagicEffect.Y = client.Player.Y;
MsgMagicEffect.AddTarget(client.Player.UID, 300, null);
ushort damage = (ushort)Math.Min(300, client.Player.MaxMana - client.Player.Mana);
client.Player.Mana += damage;
client.SendScreen(MsgMagicEffect, true);
break;
}
case Enums.ItemEffect.Shield:
{
if (client.Player.ContainsFlag((ulong)MsgUpdate.Flags.MagicShield))
return;
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.Attacker = 1;
MsgMagicEffect.SpellID = 1020;
MsgMagicEffect.SpellLevel = 0;
MsgMagicEffect.X = client.Player.X;
MsgMagicEffect.Y = client.Player.Y;
MsgMagicEffect.AddTarget(client.Player.UID, 120, null);
client.Player.ShieldTime = 0;
client.Player.ShieldStamp = Time32.Now;
client.Player.MagicShieldStamp = Time32.Now;
client.Player.MagicShieldTime = 0;
client.Player.AddFlag((ulong)MsgUpdate.Flags.MagicShield);
client.Player.MagicShieldStamp = Time32.Now;
client.Player.MagicShieldIncrease = 2;
client.Player.MagicShieldTime = 120;
if (client.Player.PlayerFlag == PlayerFlag.Player)
client.Send(Constants.Shield(2, 120));
client.SendScreen(MsgMagicEffect, true);
break;
}
case Enums.ItemEffect.Poison:
{
if (attacked != null)
{
if (attacked.UID == client.Player.UID) return;
if (Constants.PKForbiddenMaps.Contains(client.Player.MapID)) return;
if (client.Map.BaseID == 700) return;
if (attacked.ToxicFogLeft > 0) return;
MsgMagicEffect MsgMagicEffect = new MsgMagicEffect(true);
MsgMagicEffect.SpellID = 5040;
MsgMagicEffect.Attacker = attacked.UID;
MsgMagicEffect.SpellLevel = 9;
MsgMagicEffect.X = attacked.X;
MsgMagicEffect.Y = attacked.Y;
MsgMagicEffect.AddTarget(attacked.UID, 0, null);
MsgMagicEffect.Targets[attacked.UID].Hit = true;
attacked.ToxicFogStamp = Time32.Now;
attacked.ToxicFogLeft = 10;
attacked.ToxicFogPercent = 0.05F;
client.SendScreen(MsgMagicEffect, true);
}
break;
}
}
}
}
}
}
#endregion
}
public static bool CanAttack(Player attacker, MsgNpcInfoEX attacked, SpellInformation spell)
{
if (attacker.MapID == 2292)
{
if (((attacker.GuildID == 0) || !Polapk.IsWar) && (attacked.UID == 1235))
{
return false;
}
if (Polapk.PoleKeeper != null)
{
if (Polapk.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 1235)
{
return false;
}
}
else if ((((attacked.UID == 0x7dfeb) || (attacked.UID == 0x7dfea)) && (Polapk.PoleKeeper == attacker.Owner.Guild)) && (attacker.PKMode == Enums.PKMode.Team))
{
return false;
}
}
}
if (attacker.MapID == 2291)
{
if (((attacker.GuildID == 0) || !Polapk2.IsWar) && (attacked.UID == 1325))
{
return false;
}
if (Polapk2.PoleKeeper != null)
{
if (Polapk2.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 1325)
{
return false;
}
}
else if ((((attacked.UID == 0x7dfeb) || (attacked.UID == 0x7dfea)) && (Polapk2.PoleKeeper == attacker.Owner.Guild)) && (attacker.PKMode == Enums.PKMode.Team))
{
return false;
}
}
}
if (attacker.MapID == 2293)
{
if (((attacker.GuildID == 0) || !Polapk3.IsWar) && (attacked.UID == 817))
{
return false;
}
if (Polapk3.PoleKeeper != null)
{
if (Polapk3.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 817)
{
return false;
}
}
else if ((((attacked.UID == 0x7dfeb) || (attacked.UID == 0x7dfea)) && (Polapk3.PoleKeeper == attacker.Owner.Guild)) && (attacker.PKMode == Enums.PKMode.Team))
{
return false;
}
}
}
if (attacker.MapID == 2294)
{
if (((attacker.GuildID == 0) || !Polapk4.IsWar) && (attacked.UID == 23120))
{
return false;
}
if (Polapk4.PoleKeeper != null)
{
if (Polapk4.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 23120)
{
return false;
}
}
else if ((((attacked.UID == 0x7dfeb) || (attacked.UID == 0x7dfea)) && (Polapk4.PoleKeeper == attacker.Owner.Guild)) && (attacker.PKMode == Enums.PKMode.Team))
{
return false;
}
}
}
#region GuildPoleWar
if (GuildPoleWar.IsWar)
{
if (attacker.MapID == GuildPoleWar.Map.ID)
{
return GuildPoleWar.Attack(0, attacker, attacked);
}
}
#endregion
#region ClassPoleWar
//if (MsgServer.Game.ClassPoleWar.IsWar)
//{
// if (attacker.MapID == MsgServer.Game.ClassPoleWar.Map.ID)
// {
// return MsgServer.Game.ClassPoleWar.Attack(0, attacker, attacked);
// }
//}
#endregion
#region ClanWar
if (attacker.MapID == 1509)
{
if (attacker.ClanId == 0 || !ClanWar.IsWar)
{
if (attacked.UID == 813)
{
return false;
}
}
if (ClanWar.PoleKeeper != null)
{
if (ClanWar.PoleKeeper == attacker.GetClan)
{
if (attacked.UID == 813)
{
return false;
}
}
}
}
#endregion
#region EliteGuildWar
if (attacker.MapID == 2071)
{
if (attacker.GuildID == 0 || !EliteGuildWar.IsWar)
{
if (attacked.UID == 812)
{
return false;
}
}
if (EliteGuildWar.PoleKeeper != null)
{
if (EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 812)
{
return false;
}
}
else if (attacked.UID == 516075 || attacked.UID == 516074)
{
if (EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacker.PKMode == Enums.PKMode.Team)
return false;
}
}
}
}
#endregion
#region StatueWar
if (StatuesWar.IsWar)
{
if (attacker.MapID == StatuesWar.Map.ID)
{
if (attacker.GuildID == 0 || !StatuesWar.IsWar)
if (attacked.UID == StatuesWar.Pole.UID)
return false;
if (StatuesWar.PoleKeeper != null)
{
if (StatuesWar.PoleKeeper == attacker.Owner.AsMember)
if (attacked.UID == StatuesWar.Pole.UID)
return false;
if (StatuesWar.PoleKeeper == attacker.Owner.AsMember)
if (attacker.PKMode == Enums.PKMode.Team)
return false;
}
}
}
#endregion
#region PoleEmulator
if (attacked.UID == 123456)
if (attacked.Hitpoints > 0)
if (attacker.GuildID != 0 && attacker.GuildID != Server.Thread.PoleEmulator.KillerGuildID)
return true;
else return false;
else return false;
#endregion
#region GuildWar
if (attacker.MapID == 1038)
{
if (attacker.GuildID == 0 || !Game.GuildWar.IsWar)
{
if (attacked.UID == 810) return false;
}
if (Game.GuildWar.PoleKeeper != null)
{
if (Game.GuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 810) return false;
}
else if (attacked.UID == 516075 || attacked.UID == 516074)
{
if (Game.GuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacker.PKMode == Enums.PKMode.Team) return false;
}
}
}
}
#endregion
#region SuperGuildWar
if (attacker.MapID == 1234)
{
if (attacker.GuildID == 0 || !Game.SuperGuildWar.IsWar)
{
if (attacked.UID == 811) return false;
}
if (Game.SuperGuildWar.PoleKeeper != null)
{
if (Game.SuperGuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 811) return false;
}
else if (attacked.UID == 516077 || attacked.UID == 516076)
{
if (Game.SuperGuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacker.PKMode == Enums.PKMode.Team) return false;
}
}
}
}
#endregion
#region Crow
if (attacker.MapID == 1039)
{
bool stake = true;
if (attacked.LoweredName.Contains("crow"))
stake = false;
ushort levelbase = (ushort)(attacked.Mesh / 10);
if (stake)
levelbase -= 42;
else
levelbase -= 43;
byte level = (byte)(20 + (levelbase / 3) * 5);
if (levelbase == 108 || levelbase == 109)
level = 125;
if (attacker.Level >= level)
return true;
else
{
attacker.AttackPacket = null;
attacker.Owner.Send(Constants.DummyLevelTooHigh());
return false;
}
}
#endregion
#region Can't Attack Npc
if (attacked.UID == 76112 || attacked.UID == 127123 || attacked.UID == 141198 || attacked.UID == 9683 || attacked.UID == 2015 || attacked.UID == 20140
|| attacked.UID == 9884 || attacked.UID == 9885 || attacked.UID == 9886 || attacked.UID == 9887
|| attacked.UID == 9994 || attacked.UID == 9995 || attacked.UID == 9996 || attacked.UID == 9997 || attacked.UID == 41162
|| attacked.UID == 180 || attacked.UID == 181 || attacked.UID == 182 || attacked.UID == 183 || attacked.UID == 801
|| attacked.UID == 184 || attacked.UID == 185 || attacked.UID == 7882 || attacked.UID == 1232 || attacked.UID == 16416 || attacked.UID == 16417
|| attacked.UID == 216341 || attacked.UID == 1231 || attacked.UID == 6567 || attacked.UID == 4132 || attacked.UID == 64132 || attacked.UID == 44821)
{
attacker.AttackPacket = null;
return false;
}
#endregion
return true;
}
public static bool CanAttack(Player attacker, Player attacked, SpellInformation spell, bool melee)
{
#region ThunderCloud
if (attacker.Name == "Thundercloud")
{
if (attacker.PKMode != Game.Enums.PKMode.PK &&
attacker.PKMode != Game.Enums.PKMode.Team)
return false;
}
if (attacked.Name == "Thundercloud")
{
if (attacked.OwnerUID == attacker.UID) return false;
if (!Constants.PKForbiddenMaps.Contains(attacker.MapID))
{
if (attacker.PKMode != Game.Enums.PKMode.PK &&
attacker.PKMode != Game.Enums.PKMode.Team)
return false;
else
{
attacker.AddFlag((ulong)Network.GamePackets.MsgUpdate.Flags.FlashingName);
attacker.FlashingNameStamp = Time32.Now;
attacker.FlashingNameTime = 20;
return true;
}
}
else return false;
}
#endregion
if (attacker.ContainsFlag4((ulong)MsgUpdate.Flags4.xChillingSnow))
return false;
#region Kongfu
if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
{
if (attacker.PKMode == Enums.PKMode.Kongfu && attacker.KongfuActive == true && attacked.PKMode != Enums.PKMode.Kongfu && attacked.KongfuActive == false && !attacked.ContainsFlag((ulong)MsgUpdate.Flags.FlashingName) && !attacked.ContainsFlag((ulong)MsgUpdate.Flags.BlackName))
{
if (attacked.Dead) return false;
attacker.Owner.Send(new MsgTalk("You can only attack fighters of the Jiang Hu while in the Jiang Hu", MsgTalk.TopLeft));
return false;
}
else if (attacker.PKMode == Enums.PKMode.Kongfu && attacker.KongfuActive == true)
{
if (attacked.PKMode == Enums.PKMode.Kongfu || attacked.KongfuActive == true || attacked.ContainsFlag((ulong)MsgUpdate.Flags.FlashingName) || attacked.ContainsFlag((ulong)MsgUpdate.Flags.BlackName))
{
if (attacked.Dead) return false;
if (attacker.MapID == 1002 || attacker.MapID == 1000 || attacker.MapID == 1015 || attacker.MapID == 1020 || attacker.MapID == 1011 || attacker.MapID == 3055)
{
try
{
if (attacker.Settings != MsgOwnKongfuPKSetting.Settings.None)
{
if ((attacker.Settings & MsgOwnKongfuPKSetting.Settings.NotHitFriends) == MsgOwnKongfuPKSetting.Settings.NotHitFriends)
{
if (attacker.Owner.Friends.ContainsKey(attacked.UID))
return false;
}
if ((attacker.Settings & MsgOwnKongfuPKSetting.Settings.NoHitAlliesClan) == MsgOwnKongfuPKSetting.Settings.NoHitAlliesClan)
{
var attacker_clan = attacker.GetClan;
if (attacker_clan != null)
{
if (attacker_clan.Allies.ContainsKey(attacked.ClanId))
return false;
}
}
if ((attacker.Settings & MsgOwnKongfuPKSetting.Settings.NotHitAlliedGuild) == MsgOwnKongfuPKSetting.Settings.NotHitAlliedGuild)
{
if (attacker.Owner.Guild != null)
{
if (attacker.Owner.Guild.Ally.ContainsKey(attacked.GuildID))
return false;
}
}
if ((attacker.Settings & MsgOwnKongfuPKSetting.Settings.NotHitClanMembers) == MsgOwnKongfuPKSetting.Settings.NotHitClanMembers)
{
if (attacker.ClanId == attacked.ClanId)
return false;
}
if ((attacker.Settings & MsgOwnKongfuPKSetting.Settings.NotHitGuildMembers) == MsgOwnKongfuPKSetting.Settings.NotHitGuildMembers)
{
if (attacker.GuildID == attacked.GuildID)
return false;
}
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
return true;
}
}
return false;
}
}
#endregion
#region FactionWar
if (attacker.OnPirateFaction == true && attacked.OnNinjaFaction == true || attacker.OnNinjaFaction == true && attacked.OnPirateFaction == true)
{
if (attacked.Dead) return false;
if (attacker.MapID == 1002 || attacker.MapID == 1000 || attacker.MapID == 1015 || attacker.MapID == 1020 || attacker.MapID == 1011 || attacker.MapID == 3055)
{
return true;
}
return false;
}
#endregion
if (attacker.MapID == 1507)
{
if (!attacker.AllowToAttack)
return false;
}
if (attacked.PlayerFlag == PlayerFlag.Monster)
{
if (attacked.Companion)
{
if (attacked.Owner == attacker.Owner) return false;
}
}
if (attacker.timerInportChampion.AddSeconds(10) > DateTime.Now)
return false;
if (attacker.UID == attacked.UID)
return false;
if (attacker.PKMode == Enums.PKMode.Guild)
{
if (attacker.Owner.Guild.Enemy.ContainsKey(attacked.GuildID))
{
if (attacked.Dead) return false;
if (attacker.UID == attacked.UID) return false;
if (attacker.MapID == 1000 || attacker.MapID == 1015 || attacker.MapID == 1020 || attacker.MapID == 1011)
{
attacker.AddFlag((ulong)MsgUpdate.Flags.FlashingName);
attacker.FlashingNameStamp = Time32.Now;
attacker.FlashingNameTime = 10;
return true;
}
}
}
if (attacker.PKMode == Enums.PKMode.Revenge)
{
if (attacker.Owner.Enemy.ContainsKey(attacked.UID))
{
if (attacked.Dead) return false;
if (attacker.UID == attacked.UID) return false;
if (attacker.MapID == 1000 || attacker.MapID == 1015 || attacker.MapID == 1020 || attacker.MapID == 1011)
{
attacker.AddFlag((ulong)MsgUpdate.Flags.FlashingName);
attacker.FlashingNameStamp = Time32.Now;
attacker.FlashingNameTime = 10;
return true;
}
}
}
if (attacked.PlayerFlag == PlayerFlag.Monster)
{
if (attacked.MonsterInfo.ID == MonsterInformation.ReviverID)
return false;
}
if (attacked.Dead)
{
return false;
}
if (attacker.PlayerFlag == PlayerFlag.Player && attacker.Owner.WatchingElitePKMatch != null)
{
return false;
}
if (attacked.PlayerFlag == PlayerFlag.Player && attacked.Owner.WatchingElitePKMatch != null)
{
return false;
}
if (attacker.PlayerFlag == PlayerFlag.Player)
{
if (attacked != null && attacked.PlayerFlag == PlayerFlag.Player)
if (attacker.Owner.InTeamQualifier() && attacked.Owner.InTeamQualifier())
return !attacker.Owner.Team.IsTeammate(attacked.UID);
}
if (spell != null)
if (attacker.PlayerFlag == PlayerFlag.Player)
if (attacker.Owner.WatchingGroup != null)
return false;
if (attacked == null)
{
return false;
}
if (attacker.SkillTeamWatchingElitePKMatch != null)
{
return false;
}
if (attacked.Dead)
{
attacker.AttackPacket = null;
return false;
}
if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player && attacked.Owner.Team != null && attacker.Owner.Team != null && attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null && attacker.MapID == attacked.Owner.Team.EliteMatch.Map.ID && attacker.Owner.Team.EliteMatch != null)
{
return attacker.Owner.Team != attacked.Owner.Team;
}
if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
if ((attacker.Owner.InQualifier() && attacked.Owner.IsWatching()) || (attacked.Owner.InQualifier() && attacker.Owner.IsWatching()))
return false;
if (attacker.PlayerFlag == PlayerFlag.Player)
if (Time32.Now < attacker.Owner.CantAttack)
return false;
if (attacked.PlayerFlag == PlayerFlag.Monster)
{
if (attacked.Companion)
{
if (Constants.PKForbiddenMaps.Contains(attacker.Owner.Map.ID))
{
if (attacked.Owner == attacker.Owner) return false;
if (attacker.PKMode != Enums.PKMode.PK && attacker.PKMode != Enums.PKMode.Team) return false;
else
{
attacker.AddFlag((ulong)MsgUpdate.Flags.FlashingName);
attacker.FlashingNameStamp = Time32.Now;
attacker.FlashingNameTime = 10;
return true;
}
}
}
if (attacked.Name.Contains("Guard1"))
{
if (attacker.PKMode != Enums.PKMode.PK && attacker.PKMode != Game.Enums.PKMode.Team) return false;
else
{
attacker.AddFlag((ulong)MsgUpdate.Flags.FlashingName);
attacker.FlashingNameStamp = Time32.Now;
attacker.FlashingNameTime = 10;
return true;
}
}
else return true;
}
else
{
if (attacked.PlayerFlag == PlayerFlag.Player)
if (!attacked.Owner.Attackable)
return false;
if (attacker.PlayerFlag == PlayerFlag.Player)
if (attacker.Owner.WatchingGroup == null)
if (attacked.PlayerFlag == PlayerFlag.Player)
if (attacked.Owner.WatchingGroup != null)
return false;
if (spell != null)
{
if (spell.ID != 8001)
{
if (spell.OnlyGround)
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly))
return false;
if (melee && attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly))
return false;
}
}
if (spell != null)
{
if (spell.ID == 6010)
{
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly))
return false;
}
}
if (spell != null)
{
if (spell.ID == 10381)
{
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly))
return false;
}
}
if (spell != null)
{
if (spell.ID == 6000)
{
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly))
return false;
}
}
if (spell != null)
{
if (spell.ID == 5030)
{
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly))
return false;
}
}
if (spell == null)
{
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly))
return false;
}
if (Constants.PKForbiddenMaps.Contains(attacker.Owner.Map.ID))
{
if (((attacker.PKMode == Enums.PKMode.PK) || (attacker.PKMode == Enums.PKMode.Team)) || ((spell != null) && spell.CanKill))
{
attacker.Owner.Send(Constants.PKForbidden);
attacker.AttackPacket = null;
}
return false;
}
if (attacker.PKMode == Enums.PKMode.Capture)
{
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.FlashingName) || attacked.PKPoints > 99)
{
return true;
}
}
if (attacker.PKMode == Enums.PKMode.Peace)
{
return false;
}
if (attacker.UID == attacked.UID)
return false;
if (attacker.PKMode == Enums.PKMode.Team)
{
if (attacker.Owner.Team != null)
{
if (attacker.Owner.Team.IsTeammate(attacked.UID))
{
attacker.AttackPacket = null;
return false;
}
}
if (attacker.PKMode == Enums.PKMode.Team)
{
if (attacker.Owner.Team != null)
{
if (!attacker.Owner.Team.IsTeammate(attacked.UID))
{
if (attacker.InSkillPk == true)
{
return true;
}
}
}
}
if (attacker.GuildID == attacked.GuildID && attacker.GuildID != 0)
{
attacker.AttackPacket = null;
return false;
}
if (attacker.ClanId == attacked.ClanId && attacker.ClanId != 0)
{
attacker.AttackPacket = null;
return false;
}
if (attacker.Owner.Friends.ContainsKey(attacked.UID))
{
attacker.AttackPacket = null;
return false;
}
if (attacker.Owner.Guild != null)
{
if (attacker.Owner.Guild.Ally.ContainsKey(attacked.GuildID))
{
attacker.AttackPacket = null;
return false;
}
}
if (attacker.ClanId != 0)
{
if (attacker.GetClan.Allies.ContainsKey(attacked.ClanId))
{
attacker.AttackPacket = null;
return false;
}
}
}
if (spell != null)
if (spell.OnlyGround)
if (attacked.ContainsFlag((ulong)MsgUpdate.Flags.Fly))
return false;
if (spell != null)
if (!spell.CanKill)
return true;
if (attacker.PKMode != Enums.PKMode.PK &&
attacker.PKMode != Enums.PKMode.Team && attacked.PKPoints < 99)
{
attacker.AttackPacket = null;
return false;
}
else
{
if (!attacked.ContainsFlag((ulong)MsgUpdate.Flags.FlashingName))
{
if (!attacked.ContainsFlag((ulong)MsgUpdate.Flags.BlackName))
{
if (Constants.PKFreeMaps.Contains(attacker.MapID)) return true;
if (attacker.Owner.Map.BaseID == 700) return true;
attacker.AddFlag((ulong)MsgUpdate.Flags.FlashingName);
attacker.FlashingNameStamp = Time32.Now;
attacker.FlashingNameTime = 10;
}
}
return true;
}
}
}
public static void ReceiveAttack(Player attacker, Player attacked, MsgInteract attack, ref uint damage, SpellInformation spell)
{
#region StatuesWar
if (StatuesWar.IsWar)
{
if (attacker.MapID == StatuesWar.Map.ID)
{
if (attacked.UID == StatuesWar.Pole.UID)
{
if (StatuesWar.PoleKeeper == attacker.Owner.AsMember)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
StatuesWar.AddScore(damage, attacker.Owner.AsMember);
}
}
}
#endregion
#region ThunderCloud
if (attacked.Name == "Thundercloud")
{
if (spell != null && spell.ID != 0)
{
if (Kernel.Rate(75)) damage = 1;
else damage = 0;
}
else if (spell == null || spell.ID == 0)
{
damage = 1;
}
}
foreach (var th in Kernel.Maps[attacker.MapID].Entities.Values.Where(i => i.Name == "Thundercloud"))
{
if (th.OwnerUID == 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
#region RevengeTaill
if (attacked.ContainsFlag4((ulong)Network.GamePackets.MsgUpdate.Flags4.RevengeTaill))
{
if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
{
var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
if (damage <= spelll.Power)
{
MsgMagicEffect suses = new MsgMagicEffect(true);
suses.Attacker = attacked.UID;
suses.Attacker1 = attacker.UID;
suses.SpellID = 13030;
suses.SpecialEffect = 1;
suses.AddTarget(attacker.UID, damage, null);
if (attacker.Hitpoints <= damage)
{
attacker.Die(attacked);
}
else
{
attacker.Hitpoints -= damage;
}
attacked.Owner.SendScreen(suses, true);
}
}
}
#endregion
#region ChillingSnow
if (attacked.ContainsFlag4((ulong)MsgUpdate.Flags4.ChillingSnow) && attacked.IsStomper2() && attacker.PlayerFlag == PlayerFlag.Player)
{
var spell1 = Database.SpellTable.GetSpell(12960, attacked.Owner);
int rate = 95;
int diff = attacker.BattlePower - attacked.BattlePower;
if (diff < 0) diff = 0;
rate -= (byte)(diff * 5);
if (rate < 0) rate = 0;
if (Kernel.Rate(rate))
{
attacker.AddFlag4((ulong)MsgUpdate.Flags4.xChillingSnow);
attacker.ChillingSnowStamp = Time32.Now;
attacker.ChillingSnow = (byte)(spell1.Level + 1);
}
}
#endregion
#region FreezingPelter
if (attacked.ContainsFlag4((ulong)MsgUpdate.Flags4.FreezingPelter) && attacked.IsStomper2() && attacker.PlayerFlag == PlayerFlag.Player)
{
var spell1 = Database.SpellTable.GetSpell(13020, attacked.Owner);
int rate = 30;
int diff = attacker.BattlePower - attacked.BattlePower;
if (diff < 0) diff = 0;
rate -= (byte)(diff * 5);
if (rate < 0) rate = 0;
if (Kernel.Rate(rate))
{
attacker.AddFlag4((ulong)MsgUpdate.Flags4.xFreezingPelter);
attacker.FreezingPelterStamp = Time32.Now;
byte num = 0;
if (spell1.Level == 0) num = 1;
if (spell1.Level == 1) num = 1;
if (spell1.Level == 2) num = 2;
if (spell1.Level == 3) num = 2;
if (spell1.Level == 4) num = 3;
if (spell1.Level == 5) num = 3;
if (spell1.Level == 5) num = 4;
attacker.FreezingPelter = num;
}
}
#endregion
if (attacker.PlayerFlag == PlayerFlag.Monster && attacked.PlayerFlag == PlayerFlag.Player)
{
if (attacked.Action == Enums.ConquerAction.Sit)
if (attacked.Stamina > 20)
attacked.Stamina -= 20;
else attacked.Stamina = 0;
attacked.Action = Enums.ConquerAction.None;
}
if (attack.InteractType == MsgInteract.Magic)
{
if (attacked.Hitpoints <= damage)
{
if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
{
if (SpellTable.AllowSkillSoul == null) return;
if (spell == null) return;
if (SpellTable.AllowSkillSoul.Contains(spell.ID))
{
byte[] tets = new byte[12 + 8];
Writer.Ushort(12, 0, tets);
Writer.Ushort(2710, 2, tets);
Writer.Uint(spell.ID, 4, tets);
attacked.Owner.SendScreen(tets, true); attacker.Owner.SendScreen(tets, true);
}
}
if (attacked.Owner != null)
{
attacked.Owner.UpdateQualifier(attacked.Hitpoints);
}
//attacker.Owner.UpdateQualifier(attacker.Owner, attacked.Owner, attacked.Hitpoints);
attacked.CauseOfDeathIsMagic = true;
attacked.Die(attacker);
attacked.IsDropped = false;
if (attacked.Owner != null && attacker.Owner != null)
{
if (attacked.Owner.Team != null && attacker.Owner.Team != null)
{
if (attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null)
{
if (attacker.Owner.Team.EliteMatch != null)
{
if (!attacked.Owner.Team.Alive)
{
attacker.Owner.Team.EliteFighterStats.Points += damage;
attacker.Owner.Team.EliteMatch.End(attacked.Owner.Team);
}
else
{
attacker.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
attacked.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
}
}
}
}
}
}
else
{
if (attacked.Name != "Thundercloud")
{
if (attacked.Owner != null && attacker.Owner != null)
{
if (attacked.Owner.Team != null && attacker.Owner.Team != null)
{
if (attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null)
{
if (attacker.Owner.Team.EliteMatch != null)
{
attacker.Owner.Team.EliteFighterStats.Points += damage;
attacker.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
attacked.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
}
}
}
}
if (attacked.Owner != null)
{
attacked.Owner.UpdateQualifier(damage);
}
attacked.Hitpoints -= damage;
}
else
{
attacked.Hitpoints -= 2100;
}
}
}
else
{
if (attacked.Hitpoints <= damage)
{
if (attacked.PlayerFlag == PlayerFlag.Player)
{
attacked.Owner.UpdateQualifier(attacked.Hitpoints);
attacked.Owner.SendScreen(attack, true);
attacker.AttackPacket = null;
}
else
{
attacked.MonsterInfo.SendScreen(attack);
}
attacked.Die(attacker);
if (attacker.PKMode == Enums.PKMode.Kongfu)
{
if (attacked.KongfuActive)
{
if (attacker.MyKongFu != null && attacker.MyKongFu != null)
attacker.MyKongFu.GetKill(attacker.Owner, attacked.MyKongFu);
}
}
if (attacked.Owner != null && attacker.Owner != null)
{
if (attacked.Owner.Team != null && attacker.Owner.Team != null)
{
if (attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null)
{
if (attacker.Owner.Team.EliteMatch != null)
{
if (attacker.MapID == attacked.Owner.Team.EliteMatch.Map.ID)
{
if (!attacked.Owner.Team.Alive)
{
attacker.Owner.Team.EliteFighterStats.Points += damage;
attacker.Owner.Team.EliteMatch.End(attacked.Owner.Team);
}
else
{
attacker.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
attacked.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
}
}
}
}
}
}
}
else
{
if (attacked.Name != "Thundercloud")
{
if (attacked.Owner != null && attacker.Owner != null)
{
if (attacked.Owner.Team != null && attacker.Owner.Team != null)
{
if (attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null)
{
if (attacker.Owner.Team.EliteMatch != null)
{
if (attacker.MapID == attacked.Owner.Team.EliteMatch.Map.ID)
{
attacker.Owner.Team.EliteFighterStats.Points += damage;
attacker.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
attacked.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
}
}
}
}
}
attacked.Hitpoints -= damage;
if (attacked.PlayerFlag == PlayerFlag.Player)
{
attacked.Owner.UpdateQualifier(damage);
attacked.Owner.SendScreen(attack, true);
}
else
attacked.MonsterInfo.SendScreen(attack);
attacker.AttackPacket = attack;
attacker.AttackStamp = Time32.Now;
}
else
{
attacked.Hitpoints -= 2100;
}
}
}
#region ThunderCloud
foreach (var th in Kernel.Maps[attacker.MapID].Entities.Values.Where(i => i.Name == "Thundercloud"))
{
if (th.OwnerUID == attacker.UID)
{
if (attacked == null || Kernel.GetDistance(attacked.X, attacked.Y, th.X, th.Y) > th.MonsterInfo.AttackRange || attacked.Dead) break;
th.MonsterInfo.InSight = attacked.UID;
break;
}
}
#endregion
}
public static void ReceiveAttack(Player attacker, MsgNpcInfoEX attacked, MsgInteract attack, uint damage, SpellInformation spell)
{
if ((attacker.MapID == 2292) && (attacked.UID == 1235))
{
if (Polapk.PoleKeeper == attacker.Owner.Guild)
{
return;
}
if (attacked.Hitpoints <= damage)
{
attacked.Hitpoints = 0;
}
Polapk.AddScore(damage, attacker.Owner.Guild);
}
if ((attacker.MapID == 2291) && (attacked.UID == 1325))
{
if (Polapk2.PoleKeeper == attacker.Owner.Guild)
{
return;
}
if (attacked.Hitpoints <= damage)
{
attacked.Hitpoints = 0;
}
Polapk2.AddScore(damage, attacker.Owner.Guild);
}
if ((attacker.MapID == 2293) && (attacked.UID == 817))
{
if (Polapk3.PoleKeeper == attacker.Owner.Guild)
{
return;
}
if (attacked.Hitpoints <= damage)
{
attacked.Hitpoints = 0;
}
Polapk3.AddScore(damage, attacker.Owner.Guild);
}
if ((attacker.MapID == 2294) && (attacked.UID == 23120))
{
if (Polapk4.PoleKeeper == attacker.Owner.Guild)
{
return;
}
if (attacked.Hitpoints <= damage)
{
attacked.Hitpoints = 0;
}
Polapk4.AddScore(damage, attacker.Owner.Guild);
}
#region GuildPoleWar
if (GuildPoleWar.IsWar)
{
if (attacker.MapID == GuildPoleWar.Map.ID)
{
GuildPoleWar.Attack(damage, attacker, attacked);
}
}
#endregion
#region ClassPoleWar
//if (MsgServer.Game.ClassPoleWar.IsWar)
//{
// if (attacker.MapID == MsgServer.Game.ClassPoleWar.Map.ID)
// {
// MsgServer.Game.ClassPoleWar.Attack(damage, attacker, attacked);
// }
//}
#endregion
#region ClanWar
if (attacker.MapID == 1509)
{
if (attacked.UID == 813)
{
MsgFamily clan = attacker.GetClan;
if (ClanWar.PoleKeeper == clan)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
ClanWar.AddScore(damage, clan);
}
}
#endregion
#region Cps Stake
if (attacker.MapID == 1002)
{
if (attacked.UID == 6462)
{
attacked.Die(attacker);
{
attacker.ConquerPoints += 30000;
attacker.Owner.Send(new MsgTalk("killed [ NewDream-Co ] and get [ 30000 ] Cps #00", System.Drawing.Color.Azure, MsgTalk.TopLeft));
}
}
}
if (attacker.MapID == 1002)
{
if (attacked.UID == 6463)
{
attacked.Die(attacker);
{
attacker.ConquerPoints += 30000;
attacker.Owner.Send(new MsgTalk("killed [ NewDream-Co ] and get [ 30000 ] Cps #00", System.Drawing.Color.Azure, MsgTalk.TopLeft));
}
}
}
if (attacker.MapID == 1002)
{
if (attacked.UID == 6464)
{
attacked.Die(attacker);
{
attacker.ConquerPoints += 30000;
attacker.Owner.Send(new MsgTalk("killed [ NewDream-Co ] and get [ 30000 ] Cps #00", System.Drawing.Color.Azure, MsgTalk.TopLeft));
}
}
}
if (attacker.MapID == 1002)
{
if (attacked.UID == 6465)
{
attacked.Die(attacker);
{
attacker.ConquerPoints += 30000;
attacker.Owner.Send(new MsgTalk("killed [ NewDream-Co ] and get [ 30000 ] Cps #00", System.Drawing.Color.Azure, MsgTalk.TopLeft));
}
}
}
#endregion
#region EliteGuildWar
if (attacker.MapID == 2071)
{
if (attacked.UID == 812)
{
if (EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
EliteGuildWar.AddScore(damage, attacker.Owner.Guild);
}
}
#endregion
#region Crow
if (attacker.PlayerFlag == PlayerFlag.Player)
if (damage > attacked.Hitpoints)
{
if (attacker.MapID == 1039)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
if (spell != null)
attacker.Owner.IncreaseSpellExperience(Math.Min(damage, attacked.Hitpoints), spell.ID);
}
else
{
if (attacker.MapID == 1039)
attacker.Owner.IncreaseExperience(damage, true);
if (spell != null)
attacker.Owner.IncreaseSpellExperience(damage, spell.ID);
}
#endregion
#region PoleEmulator
if (attacked.UID == 123456)
{
if (Server.Thread.PoleEmulator.KillerGuildID == attacker.Owner.Guild.ID)
return;
Server.Thread.PoleEmulator.AddScore(damage, attacker.Owner.Guild);
}
#endregion
#region GuildWar
if (Game.GuildWar.IsWar)
{
if (attacker.MapID == 1038)
{
if (attacked.UID == 810)
{
if (Game.GuildWar.PoleKeeper == attacker.Owner.Guild) return;
if (attacked.Hitpoints <= damage) attacked.Hitpoints = 0;
Game.GuildWar.AddScore(damage, attacker.Owner.Guild);
}
}
}
#endregion
#region SuperGuildWar
if (Game.SuperGuildWar.IsWar)
{
if (attacker.MapID == 1234)
{
if (attacked.UID == 811)
{
if (Game.SuperGuildWar.PoleKeeper == attacker.Owner.Guild) return;
if (attacked.Hitpoints <= damage) attacked.Hitpoints = 0;
Game.SuperGuildWar.AddScore(damage, attacker.Owner.Guild);
}
}
}
#endregion
#region Hitpoints
if (attack.InteractType == MsgInteract.Magic)
{
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
}
}
else
{
attacker.Owner.SendScreen(attack, true);
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacker.AttackPacket = attack;
attacker.AttackStamp = Time32.Now;
}
}
#endregion
}
}
}
// ? Created by bode
// ? Copyright © 2010 - 2016 tq digital
// ? Emulator - project
using system;
using system.linq;
using system.text;
using system.drawing;
using mr.hamooo.network;
using mr.hamooo.database;
using mr.hamooo.interfaces;
using system.collections.generic;
using mr.hamooo.network.gamepackets;
using mr.hamooo.game.conquerstructures;
using davideid.game.features.event;
using davideid.game;
namespace mr.hamooo.game.attacking
{
public unsafe class handle
{
public static void stompermelee(msgmapitem item, ushort spellid)
{
var attack = item.attack;
var spell = database.spelltable.getspell(spellid, item.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = spellid == 12990 ? Item.uid : Item.owner.player.uid;
suse.spellid = spellid;
suse.spelllevel = spell.level;
suse.specialeffect = 1;
if (spellid == 12990)
{
suse.x = item.x2;
suse.y = item.y2;
foreach (interfaces.imapobject _obj in item.owner.screen.objects)
{
if (_obj.mapobjtype == mapobjecttype.monster)
{
if (_obj == null) continue;
var attacked1 = _obj as player;
if (canattack(item.owner.player, attacked1, spell, false))
{
{
var spellange = enums.horrorofstomperangle(item.angle);
ushort xxxx = item.x;
ushort yyyy = item.y;
map.pushback(ref xxxx, ref yyyy, spellange, 7);
fan sector = new fan(item.x, item.y, xxxx, yyyy, spell.range, spell.sector);
if (sector.isinfan(attacked1.x, attacked1.y))
{
uint damage = game.attacking.calculate.melee(item.owner.player, attacked1, ref attack, spell) * (spell.power - 30000) / 100;
receiveattack(item.owner.player, attacked1, attack, ref damage, spell);
suse.addtarget(attacked1.uid, damage, null);
continue;
}
}
{
var spellange = enums.oppositeangle(enums.horrorofstomperangle(item.angle));
ushort xxxx = item.x;
ushort yyyy = item.y;
map.pushback(ref xxxx, ref yyyy, spellange, 7);
fan sector = new fan(item.x, item.y, xxxx, yyyy, spell.range, spell.sector);
if (sector.isinfan(attacked1.x, attacked1.y))
{
uint damage = game.attacking.calculate.melee(item.owner.player, attacked1, ref attack, spell) * (spell.power - 30000) / 100;
receiveattack(item.owner.player, attacked1, attack, ref damage, spell);
suse.addtarget(attacked1.uid, damage, null);
}
}
}
}
}
}
else
{
suse.x = item.x;
suse.y = item.y;
foreach (interfaces.imapobject _obj in item.owner.screen.objects)
{
if (_obj.mapobjtype == mapobjecttype.monster)
{
if (_obj == null) continue;
var attacked1 = _obj as player;
if (kernel.getdistance(item.x, item.y, attacked1.x, attacked1.y) <= spell.range)
{
if (canattack(item.owner.player, attacked1, spell, false))
{
uint damage = game.attacking.calculate.melee(item.owner.player, attacked1, ref attack, spell) * (spell.power - 30000) / 100;
receiveattack(item.owner.player, attacked1, attack, ref damage, spell);
suse.addtarget(attacked1.uid, damage, null);
}
}
}
}
}
item.owner.sendscreen(suse, true);
item.owner.player.attackpacket = null;
}
public static void shadowofchaser(player attacker, player attacked, msginteract attack, byte oneortwo)
{
#region shadowofchaser(active)
imapobject lastattacked = attacked;
if (oneortwo == 1)
{
if (attacker.containsflag4((ulong)msgupdate.flags4.shadowofchaser) && attacker.ischaser2())
{
#region msgmapitem
var map = kernel.maps[attacker.mapid];
network.gamepackets.msgmapitem flooritem = new network.gamepackets.msgmapitem(true);
flooritem.uid = network.gamepackets.msgmapitem.flooruid.next;
while (map.npcs.containskey(flooritem.uid))
flooritem.uid = network.gamepackets.msgmapitem.flooruid.next;
flooritem.itemid = msgmapitem.shadowofchaser;
flooritem.x = lastattacked.x;
flooritem.mapid = attacker.mapid;
flooritem.y = lastattacked.y;
flooritem.type = msgmapitem.effect;
flooritem.mcolor = 14;
flooritem.flowertype = 3;
flooritem.unknown37 = 1;
flooritem.attack = attack;
flooritem.owneruid = attacker.uid;
flooritem.owner = attacker.owner;
flooritem.ownerguilduid = attacker.guildid;
flooritem.onfloor = time32.now;
flooritem.name2 = "shadowofchaser";
flooritem.shadowofchaserattacked = attacked;
flooritem.shadowofchaserattacker = attacker;
attacker.owner.map.addflooritem(flooritem);
attacker.owner.sendscreenspawn(flooritem, true);
#endregion
return;
}
}
else if (oneortwo == 2)
{
var spell = database.spelltable.getspell(13090, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
if (canattack(attacker, attacked, spell, false))
{
lastattacked = attacked;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack, spell) * (spell.power - 30000) / 100;
handle.receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, null);
}
attacker.owner.sendscreen(suse, true);
msgmagiceffect suse2 = new msgmagiceffect(true);
suse2.attacker = attacker.uid;
suse2.spellid = spell.id;
suse2.spelllevel = spell.level;
suse2.x = attacked.x;
suse2.y = attacked.y;
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
if (_obj == null) continue;
var attacked1 = _obj as player;
if (lastattacked.uid == attacked1.uid) continue;
if (kernel.getdistance(lastattacked.x, lastattacked.y, attacked1.x, attacked1.y) <= 4)
{
if (canattack(attacker, attacked1, spell, false))
{
uint damage = game.attacking.calculate.melee(attacker, attacked1, ref attack, spell) * (spell.power - 30000) / 100;
attack.damage = damage;
receiveattack(attacker, attacked1, attack, ref damage, spell);
suse2.addtarget(attacked1.uid, damage, null);
}
}
}
}
attacker.owner.sendscreen(suse2, true);
}
#endregion
attacker.attackpacket = null;
}
public static void cheakteam(client.gamestate client, npcs dail)
{
if (client.team == null)
client.player.teleport(1002, 430, 378);
client.player.addtopstatus((ulong)msgupdate.flags2.top3water, 2, datetime.now.addminutes(30));
uint teamcount = 0;
foreach (client.gamestate clients in kernel.gamepool.values.toarray())
{
if (clients.player.mapid == 16414)
{
if (clients.team != null)
{
if (!clients.player.dead)
teamcount++;
}
}
}
if (teamcount <= 5)
{
uint lastcheak = 0;
if (client.team != null)
{
foreach (client.gamestate team in client.team.teammates)
{
if (team.player.mapid == 16414 && !team.player.dead)
lastcheak++;
}
if (teamcount == lastcheak)
{
uint won = (uint)(rates.alltops / client.team.teammates.count());
foreach (client.gamestate team in client.team.teammates)
{
team.player.teleport(1002, 302, 276);
team.player.conquerpoints += won;
}
thread.lastteamfight = false;
kernel.sendworldmessage(new msgtalk("congratulations! " + client.player.name + " team has won last team standing and all team member got " + won + " cps", system.drawing.color.red, 2011), kernel.gamepool.values.toarray());
}
else
{
dail.text("there are:| " + (teamcount - lastcheak) + " |: Other player in other team kill him");
dail.option("i will kill him ", 255);
dail.send();
}
}
}
else
{
dail.text("there are:| " + teamcount + " |: Other player in other team kill him");
dail.option("i will kill him ", 255);
dail.send();
}
}
private msginteract attack;
private player attacker, attacked;
#region interations
public class interactionrequest
{
public interactionrequest(msginteract attack, game.player a_client)
{
client.gamestate client = a_client.owner;
client.player.interactioninprogress = false;
client.player.interactionwith = attack.attacked;
client.player.interactiontype = 0;
client.interactioneffect = attack.responsedamage;
if (kernel.gamepool.containskey(attack.attacked))
{
client.gamestate clienttarget = kernel.gamepool[attack.attacked];
clienttarget.player.interactioninprogress = false;
clienttarget.player.interactionwith = client.player.uid;
clienttarget.player.interactiontype = 0;
clienttarget.interactioneffect = attack.responsedamage;
attack.attacker = client.player.uid;
attack.x = clienttarget.player.x;
attack.y = clienttarget.player.y;
attack.interacttype = 46;
clienttarget.send(attack);
clienttarget.send(attack);
}
}
}
public class interactioneffect
{
public interactioneffect(msginteract attack, game.player a_client)
{
client.gamestate client = a_client.owner;
if (kernel.gamepool.containskey(client.player.interactionwith))
{
client.gamestate clienttarget = kernel.gamepool[client.player.interactionwith];
if (clienttarget.player.x == client.player.x && clienttarget.player.y == client.player.y)
{
attack.damage = client.player.interactiontype;
attack.responsedamage = client.interactioneffect;
clienttarget.player.interactionset = true;
client.player.interactionset = true;
attack.attacker = clienttarget.player.uid;
attack.attacked = client.player.uid;
attack.interacttype = 47;
attack.x = clienttarget.player.x;
attack.y = clienttarget.player.y;
clienttarget.send(attack);
attack.interacttype = 49;
attack.attacker = client.player.uid;
attack.attacked = clienttarget.player.uid;
client.sendscreen(attack, true);
attack.attacker = clienttarget.player.uid;
attack.attacked = client.player.uid;
client.sendscreen(attack, true);
}
}
}
}
public class interactionaccept
{
public interactionaccept(msginteract attack, game.player a_client)
{
client.gamestate client = a_client.owner;
if (client.player.containsflag((ulong)msgupdate.flags.ride))
client.player.removeflag((ulong)msgupdate.flags.ride);
if (client.player.interactionwith != attack.attacked) return;
attack.responsedamage = client.interactioneffect;
client.player.interactionset = false;
if (kernel.gamepool.containskey(attack.attacked))
{
client.gamestate clienttarget = kernel.gamepool[attack.attacked];
if (clienttarget.player.containsflag((ulong)msgupdate.flags.ride))
clienttarget.player.removeflag((ulong)msgupdate.flags.ride);
clienttarget.player.interactionset = false;
if (clienttarget.player.interactionwith != client.player.uid) return;
if (clienttarget.player.body == 1003 || clienttarget.player.body == 1004)
{
attack.attacker = client.player.uid;
attack.x = client.player.x;
attack.y = client.player.y;
clienttarget.send(attack);
clienttarget.player.interactioninprogress = true;
client.player.interactioninprogress = true;
clienttarget.player.interactiontype = attack.damage;
clienttarget.player.interactionx = client.player.x;
clienttarget.player.interactiony = client.player.y;
client.player.interactiontype = attack.damage;
client.player.interactionx = client.player.x;
client.player.interactiony = client.player.y;
if (clienttarget.player.x == client.player.x && clienttarget.player.y == client.player.y)
{
attack.damage = client.player.interactiontype;
clienttarget.player.interactionset = true;
client.player.interactionset = true;
attack.attacker = clienttarget.player.uid;
attack.attacked = client.player.uid;
attack.interacttype = 47;
attack.x = clienttarget.player.x;
attack.y = clienttarget.player.y;
attack.responsedamage = clienttarget.interactioneffect;
clienttarget.send(attack);
attack.interacttype = 49;
attack.attacker = client.player.uid;
attack.attacked = clienttarget.player.uid;
client.sendscreen(attack, true);
attack.attacker = clienttarget.player.uid;
attack.attacked = client.player.uid;
client.sendscreen(attack, true);
}
}
else
{
attack.interacttype = 47;
attack.attacker = client.player.uid;
attack.x = client.player.x;
attack.y = client.player.y;
clienttarget.send(attack);
clienttarget.player.interactioninprogress = true;
client.player.interactioninprogress = true;
clienttarget.player.interactiontype = attack.damage;
clienttarget.player.interactionx = clienttarget.player.x;
clienttarget.player.interactiony = clienttarget.player.y;
client.player.interactiontype = attack.damage;
client.player.interactionx = clienttarget.player.x;
client.player.interactiony = clienttarget.player.y;
if (clienttarget.player.x == client.player.x && clienttarget.player.y == client.player.y)
{
clienttarget.player.interactionset = true;
client.player.interactionset = true;
attack.attacker = clienttarget.player.uid;
attack.attacked = client.player.uid;
attack.x = clienttarget.player.x;
attack.y = clienttarget.player.y;
attack.responsedamage = clienttarget.interactioneffect;
clienttarget.send(attack);
attack.interacttype = 49;
client.sendscreen(attack, true);
attack.attacker = client.player.uid;
attack.attacked = clienttarget.player.uid;
client.sendscreen(attack, true);
}
}
}
}
}
public class interactionstopeffect
{
public interactionstopeffect(msginteract attack, game.player a_client)
{
client.gamestate client = a_client.owner;
if (kernel.gamepool.containskey(attack.attacked))
{
client.gamestate clienttarget = kernel.gamepool[attack.attacked];
attack.attacker = client.player.uid;
attack.attacked = clienttarget.player.uid;
attack.damage = client.player.interactiontype;
attack.x = client.player.x;
attack.y = client.player.y;
attack.interacttype = 50;
client.sendscreen(attack, true);
attack.attacker = clienttarget.player.uid;
attack.attacked = client.player.uid;
clienttarget.sendscreen(attack, true);
client.player.teleport(client.player.mapid, client.player.x, client.player.y);
clienttarget.player.teleport(clienttarget.player.mapid, clienttarget.player.x, clienttarget.player.y);
client.player.interactiontype = 0;
client.player.interactionwith = 0;
client.player.interactioninprogress = false;
clienttarget.player.interactiontype = 0;
clienttarget.player.interactionwith = 0;
clienttarget.player.interactioninprogress = false;
}
}
}
public class interactionrefuse
{
public interactionrefuse(msginteract attack, game.player a_client)
{
client.gamestate client = a_client.owner;
client.player.interactiontype = 0;
client.player.interactionwith = 0;
client.player.interactioninprogress = false;
if (kernel.gamepool.containskey(attack.attacked))
{
client.gamestate clienttarget = kernel.gamepool[attack.attacked];
attack.attacker = clienttarget.player.uid;
attack.interacttype = 48;
attack.x = clienttarget.player.x;
attack.y = clienttarget.player.y;
clienttarget.send(attack);
clienttarget.player.interactiontype = 0;
clienttarget.player.interactionwith = 0;
clienttarget.player.interactioninprogress = false;
}
}
}
#endregion
private void execute()
{
#region interactions
if (attack != null)
{
switch (attack.interacttype)
{
case msginteract.interactionrequest:
{
new interactionrequest(attack, attacker); return;
}
case msginteract.interactioneffect:
{
new interactioneffect(attack, attacker); return;
}
case msginteract.interactionaccept:
{
new interactionaccept(attack, attacker); return;
}
case msginteract.interactionrefuse:
{
new interactionrefuse(attack, attacker); return;
}
case msginteract.interactionstopeffect:
{
new interactionstopeffect(attack, attacker); return;
}
}
}
#endregion
#region monster -> player \ monster
if (attack == null)
{
if (attacker.playerflag != playerflag.monster) return;
if (attacked == null) return;
if (attacker.companion && attacker.name != "thundercloud")
{
if (constants.pkforbiddenmaps.contains(attacker.mapid)) return;
}
if (attacked.playerflag == playerflag.player)
{
if (!attacked.owner.attackable) return;
if (attacked.dead) return;
if (attacker.attackstamp.addmilliseconds(2000) < time32.now)
{
attacker.attackstamp = time32.now;
#region snowbanhe
if (attacker.name == "snowbanshee" || attacker.name == "snowbansheesoul" || attacker.name == "purplebanshee")
{
uint rand = (uint)mr.hamooo.kernel.random.next(1, 8);
switch (rand)
{
case 1:
Attacker.monsterinfo.spellid = 10001;
break;
case 2:
Attacker.monsterinfo.spellid = 30010;
break;
case 4:
Attacker.monsterinfo.spellid = 30011;
break;
case 6:
Attacker.monsterinfo.spellid = 30012;
break;
}
#region icethrom angercop
if (attacker.monsterinfo.spellid == 30010 || attacker.monsterinfo.spellid == 10001)
{
uint damage = 0;
damage += (uint)kernel.random.next(1000, 2000);
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
}
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
attacked.owner.sendscreen(suse, true);
}
#endregion
#region chill
if (attacker.monsterinfo.spellid == 30011)
{
msgmagiceffect suse = new msgmagiceffect(true);
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
uint damage = 0;
damage += (uint)kernel.random.next(1000, 2000);
suse.effect = attack.effect;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.frightenstamp = time32.now;
var upd = new msgracetrackstatus(true);
upd.uid = attacked.uid;
upd.add(msgracetrackstatus.flustered, 0, 5);
attacked.owner.sendscreen(upd, true);
attacked.owner.player.addflag((ulong)msgupdate.flags.chaoscycle);
}
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
foreach (var obj in attacked.owner.screen.objects)
{
if (calculations.inbox(obj.x, obj.y, attacker.x, attacker.y, 14))
{
if (obj.mapobjtype == mapobjecttype.player)
{
if (obj.owner.player.containsflag((ulong)msgupdate.flags.dead)) continue;
attacked = obj as player;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.frightenstamp = time32.now;
var upd = new msgracetrackstatus(true);
upd.uid = attacked.uid;
upd.add(msgracetrackstatus.flustered, 0, 5);
attacked.owner.sendscreen(upd, true);
attacked.owner.player.addflag((ulong)msgupdate.flags.chaoscycle);
}
suse.addtarget(attacked.uid, damage, attack);
}
}
}
attacked.owner.sendscreen(suse, true);
}
#endregion
#region angercrop
if (attacker.monsterinfo.spellid == 30012)
{
msgmagiceffect suse = new msgmagiceffect(true);
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
uint damage = 0;
damage += (uint)kernel.random.next(1000, 2000);
suse.effect = attack.effect;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.player.frozenstamp = time32.now;
attacked.owner.player.frozentime = 5;
msgracetrackstatus update = new msgracetrackstatus(true);
update.uid = attacked.uid;
update.add(msgracetrackstatus.freeze, 0, 5);
attacked.owner.sendscreen(update, true);
attacked.addflag((ulong)msgupdate.flags.freeze);
}
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
foreach (var obj in attacked.owner.screen.objects)
{
if (calculations.inbox(obj.x, obj.y, attacker.x, attacker.y, 10))
{
if (obj.mapobjtype == mapobjecttype.player)
{
if (obj.owner.player.containsflag((ulong)msgupdate.flags.dead))
continue;
attacked = obj as player;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.player.frozenstamp = time32.now;
attacked.owner.player.frozentime = 5;
msgracetrackstatus update = new msgracetrackstatus(true);
update.uid = attacked.uid;
update.add(msgracetrackstatus.freeze, 0, 5);
attacked.owner.sendscreen(update, true);
attacked.addflag((ulong)msgupdate.flags.freeze);
}
suse.addtarget(attacked.uid, damage, attack);
}
}
}
attacked.owner.sendscreen(suse, true);
}
#endregion
}
#endregion
#region nemesistyrant
if (attacker.name == "nemesistyrant")
{
uint rand = (uint)kernel.random.next(1, 22);
switch (rand)
{
case 1:
Attacker.monsterinfo.spellid = 10001;
break;
case 2:
Attacker.monsterinfo.spellid = 30010;
break;
case 3:
Attacker.monsterinfo.spellid = 10001;
break;
case 4:
Attacker.monsterinfo.spellid = 30010;
break;
case 5:
Attacker.monsterinfo.spellid = 30011;
break;
case 6:
Attacker.monsterinfo.spellid = 30012;
break;
case 7:
Attacker.monsterinfo.spellid = 7014;
break;
case 8:
Attacker.monsterinfo.spellid = 7017;
break;
case 9:
Attacker.monsterinfo.spellid = 7017;
break;
case 10:
Attacker.monsterinfo.spellid = 7012;
break;
case 11:
Attacker.monsterinfo.spellid = 7013;
break;
case 12:
Attacker.monsterinfo.spellid = 7015;
break;
case 13:
Attacker.monsterinfo.spellid = 7016;
break;
case 14:
Attacker.monsterinfo.spellid = 10502;
break;
case 15:
Attacker.monsterinfo.spellid = 10504;
break;
case 16:
Attacker.monsterinfo.spellid = 10506;
break;
case 17:
Attacker.monsterinfo.spellid = 10505;
break;
case 18:
Attacker.monsterinfo.spellid = 10500;
break;
case 19:
Attacker.monsterinfo.spellid = 10363;
break;
case 20:
Attacker.monsterinfo.spellid = 10360;
attacked.addflag((ulong)msgupdate.flags.stun);
attacked.shockstamp = time32.now;
attacked.shock = 5;
var upd = new msgracetrackstatus(true);
upd.uid = attacked.uid;
upd.add(msgracetrackstatus.dizzy, 0, 5);
attacked.owner.sendscreen(upd, true);
break;
case 21:
Attacker.monsterinfo.spellid = 10361;
attacked.addflag((ulong)msgupdate.flags.stun);
attacked.shockstamp = time32.now;
attacked.shock = 5;
var upd1 = new msgracetrackstatus(true);
upd1.uid = attacked.uid;
upd1.add(msgracetrackstatus.dizzy, 0, 5);
attacked.owner.sendscreen(upd1, true);
break;
case 22:
Attacker.monsterinfo.spellid = 10362;
break;
}
#region icethrom angercop
if (attacker.monsterinfo.spellid == 30010 || attacker.monsterinfo.spellid == 10001)
{
uint damage = 0;
damage += (uint)kernel.random.next(1000, 2000);
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
}
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
attacked.owner.sendscreen(suse, true);
}
#endregion
#region chill
if (attacker.monsterinfo.spellid == 30011)
{
msgmagiceffect suse = new msgmagiceffect(true);
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
uint damage = 0;
damage += (uint)kernel.random.next(1000, 2000);
suse.effect = attack.effect;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.frightenstamp = time32.now;
var upd = new msgracetrackstatus(true);
upd.uid = attacked.uid;
upd.add(msgracetrackstatus.flustered, 0, 5);
attacked.owner.sendscreen(upd, true);
attacked.owner.player.addflag((ulong)msgupdate.flags.chaoscycle);
}
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
foreach (var obj in attacked.owner.screen.objects)
{
if (calculations.inbox(obj.x, obj.y, attacker.x, attacker.y, 14))
{
if (obj.mapobjtype == mapobjecttype.player)
{
if (obj.owner.player.containsflag((ulong)msgupdate.flags.dead))
continue;
attacked = obj as player;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.frightenstamp = time32.now;
var upd = new msgracetrackstatus(true);
upd.uid = attacked.uid;
upd.add(msgracetrackstatus.flustered, 0, 5);
attacked.owner.sendscreen(upd, true);
attacked.owner.player.addflag((ulong)msgupdate.flags.chaoscycle);
}
suse.addtarget(attacked.uid, damage, attack);
}
}
}
attacked.owner.sendscreen(suse, true);
}
#endregion
#region angercrop
if (attacker.monsterinfo.spellid == 30012)
{
msgmagiceffect suse = new msgmagiceffect(true);
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
uint damage = 0;
damage += (uint)kernel.random.next(1000, 2000);
suse.effect = attack.effect;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.player.frozenstamp = time32.now;
attacked.owner.player.frozentime = 5;
msgracetrackstatus update = new msgracetrackstatus(true);
update.uid = attacked.uid;
update.add(msgracetrackstatus.freeze, 0, 5);
attacked.owner.sendscreen(update, true);
attacked.addflag((ulong)msgupdate.flags.freeze);
}
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
foreach (var obj in attacked.owner.screen.objects)
{
if (calculations.inbox(obj.x, obj.y, attacker.x, attacker.y, 10))
{
if (obj.mapobjtype == mapobjecttype.player)
{
if (obj.owner.player.containsflag((ulong)msgupdate.flags.dead))
continue;
attacked = obj as player;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.player.frozenstamp = time32.now;
attacked.owner.player.frozentime = 5;
msgracetrackstatus update = new msgracetrackstatus(true);
update.uid = attacked.uid;
update.add(msgracetrackstatus.freeze, 0, 5);
attacked.owner.sendscreen(update, true);
attacked.addflag((ulong)msgupdate.flags.freeze);
}
suse.addtarget(attacked.uid, damage, attack);
}
}
}
attacked.owner.sendscreen(suse, true);
}
#endregion
}
#endregion
#region treatodragon
if (attacker.name == "teratodragon" || attacker.name == "lavabeast" || attacker.name == "shadowclone")
{
uint rand = (uint)mr.hamooo.kernel.random.next(1, 7);
switch (rand)
{
case 1:
Attacker.monsterinfo.spellid = 7014;
break;
case 2:
Attacker.monsterinfo.spellid = 7017;
break;
case 3:
Attacker.monsterinfo.spellid = 7017;
break;
case 4:
Attacker.monsterinfo.spellid = 7012;
break;
case 5:
Attacker.monsterinfo.spellid = 7013;
break;
case 6:
Attacker.monsterinfo.spellid = 7015;
break;
case 7:
Attacker.monsterinfo.spellid = 7016;
break;
}
#region td area
if (attacker.monsterinfo.spellid == 7014 || attacker.monsterinfo.spellid == 7017)
{
msgmagiceffect suse = new msgmagiceffect(true);
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
uint damage = 0;
damage += (uint)kernel.random.next(1000, 2000);
suse.effect = attack.effect;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
}
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
foreach (var obj in attacked.owner.screen.objects)
{
if (calculations.inbox(obj.x, obj.y, attacker.x, attacker.y, 14))
{
if (obj.mapobjtype == mapobjecttype.player)
{
if (obj.owner.player.containsflag((ulong)msgupdate.flags.dead))
continue;
attacked = obj as player;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
}
suse.addtarget(attacked.uid, damage, attack);
}
}
}
attacked.owner.sendscreen(suse, true);
}
}
#endregion
#region 2nd skill
if (attacker.monsterinfo.spellid == 7013)
{
msgmagiceffect suse = new msgmagiceffect(true);
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
uint damage = 0;
damage += (uint)kernel.random.next(1000, 2000);
suse.effect = attack.effect;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.frightenstamp = time32.now;
attacked.owner.player.fright = 5;
var upd = new msgracetrackstatus(true);
upd.uid = attacked.uid;
upd.add(msgracetrackstatus.dizzy, 0, 5);
attacked.owner.sendscreen(upd, true);
attacked.owner.player.addflag((ulong)msgupdate.flags.freezesmall);
}
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
foreach (var obj in attacked.owner.screen.objects)
{
if (calculations.inbox(obj.x, obj.y, attacker.x, attacker.y, 14))
{
if (obj.mapobjtype == mapobjecttype.player)
{
if (obj.owner.player.containsflag((ulong)msgupdate.flags.dead))
continue;
attacked = obj as player;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.frightenstamp = time32.now;
attacked.owner.player.fright = 5;
var upd = new msgracetrackstatus(true);
upd.uid = attacked.uid;
upd.add(msgracetrackstatus.dizzy, 0, 5);
attacked.owner.sendscreen(upd, true);
attacked.owner.player.addflag((ulong)msgupdate.flags.freezesmall);
}
suse.addtarget(attacked.uid, damage, attack);
}
}
}
attacked.owner.sendscreen(suse, true);
}
#endregion
#region chill
if (attacker.monsterinfo.spellid == 7015)
{
msgmagiceffect suse = new msgmagiceffect(true);
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
uint damage = 0;
damage += (uint)kernel.random.next(1000, 2000);
suse.effect = attack.effect;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.frightenstamp = time32.now;
var upd = new msgracetrackstatus(true);
upd.uid = attacked.uid;
upd.add(msgracetrackstatus.flustered, 0, 5);
attacked.owner.sendscreen(upd, true);
attacked.owner.player.addflag((ulong)msgupdate.flags.chaoscycle);
}
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
foreach (var obj in attacked.owner.screen.objects)
{
if (calculations.inbox(obj.x, obj.y, attacker.x, attacker.y, 14))
{
if (obj.mapobjtype == mapobjecttype.player)
{
if (obj.owner.player.containsflag((ulong)msgupdate.flags.dead))
continue;
attacked = obj as player;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.frightenstamp = time32.now;
var upd = new msgracetrackstatus(true);
upd.uid = attacked.uid;
upd.add(msgracetrackstatus.flustered, 0, 5);
attacked.owner.sendscreen(upd, true);
attacked.owner.player.addflag((ulong)msgupdate.flags.chaoscycle);
}
suse.addtarget(attacked.uid, damage, attack);
}
}
}
attacked.owner.sendscreen(suse, true);
}
#endregion
#endregion
#region swordmaster
if (attacker.name == "swordmaster" || attacker.name == "hollowbeast")
{
uint rand = (uint)mr.hamooo.kernel.random.next(1, 5);
switch (rand)
{
case 1:
Attacker.monsterinfo.spellid = 10502;
break;
case 2:
Attacker.monsterinfo.spellid = 10504;
break;
case 3:
Attacker.monsterinfo.spellid = 10506;
break;
case 4:
Attacker.monsterinfo.spellid = 10505;
break;
case 5:
Attacker.monsterinfo.spellid = 10500;
break;
}
uint damage = 0;
damage += (uint)kernel.random.next(1000, 2000);
if (attacked.hitpoints <= damage)
attacked.die(attacker);
else
attacked.hitpoints -= damage;
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
attacked.owner.sendscreen(suse, true);
}
#endregion
#region thrillingspook
if (attacker.name == "thrillingspook" || attacker.name == "thrillingspook2" || attacker.name == "thrillingspook3")
{
uint rand = (uint)kernel.random.next(1, 7);
switch (rand)
{
case 1: Attacker.monsterinfo.spellid = 10363; break;
case 2:
{
if (!attacked.containsflag((ulong)msgupdate.flags.stun))
{
attacker.monsterinfo.spellid = 10360;
attacked.addflag((ulong)msgupdate.flags.stun);
attacked.shockstamp = time32.now;
attacked.shock = 5;
var upd = new msgracetrackstatus(true);
upd.uid = attacked.uid;
upd.add(msgracetrackstatus.soulshacle, 0, 5);
attacked.owner.sendscreen(upd, true);
}
break;
}
case 3: Attacker.monsterinfo.spellid = 10362; break;
case 4: Attacker.monsterinfo.spellid = 10363; break;
case 5: Attacker.monsterinfo.spellid = 10363; break;
case 6: Attacker.monsterinfo.spellid = 10362; break;
case 7:
If (!attacked.containsflag((ulong)msgupdate.flags.stun))
{
attacker.monsterinfo.spellid = 10361;
attacked.addflag((ulong)msgupdate.flags.stun);
attacked.shockstamp = time32.now;
attacked.shock = 5;
var upd1 = new msgracetrackstatus(true);
upd1.uid = attacked.uid;
upd1.add(msgracetrackstatus.soulshacle, 0, 5);
attacked.owner.sendscreen(upd1, true);
}
break;
}
uint damage = 0;
damage += (uint)kernel.random.next(1000, 2000);
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
}
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
attacked.owner.sendscreen(suse, true);
}
#endregion
#region thundercloud
if (attacker.name == "thundercloud")
{
if (attacker.owner.player.pkmode != game.enums.pkmode.pk &&
attacker.owner.player.pkmode != game.enums.pkmode.team) return;
if (kernel.gamepool.containskey(attacker.owneruid))
{
var owner = kernel.gamepool[attacker.owneruid];
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 msginteract(true);
attack.attacker = attacker.uid;
attack.attacked = attacked.uid;
attack.interacttype = network.gamepackets.msginteract.kill;
attack.x = attacked.x;
attack.y = attacked.y;
attack.damage = 1;
uint damage2 = (uint)(calculate.melee(owner.player, attacked, ref attack) * spell.firstdamage / 100);
if (attacker.spawnpacket[50] == 128)//thunderbolt
damage2 = (uint)(damage2 * percent / 100);
msgmagiceffect suse2 = new msgmagiceffect(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.owneruid == 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
#region guard
if (attacker.name == "guard1")
{
uint rand = (uint)kernel.random.next(1, 15);
switch (rand)
{
case 1:
Attacker.monsterinfo.spellid = 7012;
break;
case 2:
Attacker.monsterinfo.spellid = 7013;
break;
case 3:
Attacker.monsterinfo.spellid = 7015;
break;
case 4:
Attacker.monsterinfo.spellid = 7016;
break;
case 5:
Attacker.monsterinfo.spellid = 7017;
break;
case 6:
Attacker.monsterinfo.spellid = 10001;
break;
case 7:
Attacker.monsterinfo.spellid = 10363;
break;
case 8:
Attacker.monsterinfo.spellid = 10362;
break;
case 9:
Attacker.monsterinfo.spellid = 10502;
break;
case 10:
Attacker.monsterinfo.spellid = 10504;
break;
case 11:
Attacker.monsterinfo.spellid = 10506;
break;
case 12:
Attacker.monsterinfo.spellid = 10505;
break;
case 13:
Attacker.monsterinfo.spellid = 30012;
break;
case 14:
Attacker.monsterinfo.spellid = 10001;
break;
case 15:
Attacker.monsterinfo.spellid = 30015;
break;
}
uint damage = 0;
damage += (uint)kernel.random.next(50000, 60000);
if (attacked == null)
return;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
}
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
attacked.owner.sendscreen(suse, true);
}
#endregion
}
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
attack.attacker = attacker.uid;
attack.attacked = attacker.monsterinfo.id;
attack.x = attacked.x;
attack.y = attacked.y;
attack.interacttype = msginteract.showusespell;
attack.monsterspellid = attacker.monsterinfo.spellid;
attacker.monsterinfo.sendscreen(attack);
if (attacker.monsterinfo.spellid == 0)
{
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack);
#region revengetaill
if (attacked.containsflag4((ulong)network.gamepackets.msgupdate.flags4.revengetaill))
{
if (attacked.owner != null && attacked.owner.spells != null && attacked.owner.spells.containskey(13030))
{
var spelll = database.spelltable.getspell(13030, attacked.owner);
if (damage <= spelll.power)
{
msgmagiceffect suses = new msgmagiceffect(true);
suses.attacker = attacked.uid;
suses.attacker1 = attacker.uid;
suses.spellid = 13030;
suses.specialeffect = 1;
suses.addtarget(attacker.uid, damage, null);
if (attacker.hitpoints <= damage)
{
attacker.die(attacked);
}
else
{
attacker.hitpoints -= damage;
}
attacked.owner.sendscreen(suses, true);
}
}
}
#endregion
attack.attacker = attacker.uid;
attack.attacked = attacked.uid;
attack.interacttype = msginteract.melee;
attack.damage = damage;
attack.x = attacked.x;
attack.y = attacked.y;
if (attacked.hitpoints <= damage)
{
if (attacked.inhangup)
{
msghangup autohunt = new msghangup();
autohunt.action = msghangup.mode.killedby;
autohunt.unknown = 3329;
autohunt.killedname = attacker.monsterinfo.name;
autohunt.expgained = attacked.hangupexp;
attacked.owner.send(autohunt.toarray());
attacked.autorevstamp = time32.now;
attacked.autorev = 20;
}
attacked.owner.sendscreen(attack, true);
attacked.die(attacker.uid);
}
else
{
attacked.hitpoints -= damage;
attacked.owner.sendscreen(attack, true);
}
}
else
{
msgmagiceffect suse = new msgmagiceffect(true);
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.magic(attacker, attacked, attacker.monsterinfo.spellid, 0, ref attack);
#region revengetaill
if (attacked.containsflag4((ulong)network.gamepackets.msgupdate.flags4.revengetaill))
{
if (attacked.owner != null && attacked.owner.spells != null && attacked.owner.spells.containskey(13030))
{
var spelll = database.spelltable.getspell(13030, attacked.owner);
if (damage <= spelll.power)
{
msgmagiceffect suses = new msgmagiceffect(true);
suses.attacker = attacked.uid;
suses.attacker1 = attacker.uid;
suses.spellid = 13030;
suses.specialeffect = 1;
suses.addtarget(attacker.uid, damage, null);
if (attacker.hitpoints <= damage)
{
attacker.die(attacked);
}
else
{
attacker.hitpoints -= damage;
}
attacked.owner.sendscreen(suses, true);
}
}
}
#endregion
suse.effect = attack.effect;
if (attacked.hitpoints <= damage)
{
attacked.die(attacker.uid);
if (attacked.inhangup)
{
msghangup autohunt = new msghangup();
autohunt.action = msghangup.mode.killedby;
autohunt.unknown = 3329;
autohunt.killedname = attacker.monsterinfo.name;
autohunt.expgained = attacked.hangupexp;
attacked.owner.send(autohunt.toarray());
attacked.autorevstamp = time32.now;
attacked.autorev = 20;
}
}
else
{
attacked.hitpoints -= damage;
}
if (attacker.companion)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
attacked.owner.sendscreen(suse, true);
}
}
else
{
if (attacker.monsterinfo.spellid == 0)
{
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack);
#region revengetaill
if (attacked.containsflag4((ulong)network.gamepackets.msgupdate.flags4.revengetaill))
{
if (attacked.owner != null && attacked.owner.spells != null && attacked.owner.spells.containskey(13030))
{
var spelll = database.spelltable.getspell(13030, attacked.owner);
if (damage <= spelll.power)
{
msgmagiceffect suses = new msgmagiceffect(true);
suses.attacker = attacked.uid;
suses.attacker1 = attacker.uid;
suses.spellid = 13030;
suses.specialeffect = 1;
suses.addtarget(attacker.uid, damage, null);
if (attacker.hitpoints <= damage)
{
attacker.die(attacked);
}
else
{
attacker.hitpoints -= damage;
}
attacked.owner.sendscreen(suses, true);
}
}
}
#endregion
attack.attacker = attacker.uid;
attack.attacked = attacked.uid;
attack.interacttype = msginteract.melee;
attack.damage = damage;
attack.x = attacked.x;
attack.y = attacked.y;
attacked.monsterinfo.sendscreen(attack);
if (attacker.companion)
if (damage > attacked.hitpoints)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
else attacker.owner.increaseexperience(damage, true);
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
attack = new msginteract(true);
attack.attacker = attacker.uid;
attack.attacked = attacked.uid;
attack.interacttype = network.gamepackets.msginteract.kill;
attack.x = attacked.x;
attack.y = attacked.y;
attacked.monsterinfo.sendscreen(attack);
}
else
{
attacked.hitpoints -= damage;
}
}
else
{
msgmagiceffect suse = new msgmagiceffect(true);
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
#region thundercloud
if (attacker.name == "thundercloud")
{
if (attacker.owner.player.pkmode != game.enums.pkmode.pk &&
attacker.owner.player.pkmode != game.enums.pkmode.team) return;
if (kernel.gamepool.containskey(attacker.owneruid))
{
var owner = kernel.gamepool[attacker.owneruid];
var spell = database.spelltable.getspell(12840, owner);
var spell2 = database.spelltable.getspell(12970, owner);
uint damage2 = (uint)(calculate.melee(owner.player, attacked, ref attack) * (spell.level < 8 ? Spell.firstdamage : 50) / 100);
if (attacker.spawnpacket[50] == 128)
damage2 = (uint)(damage2 * spell2.firstdamage);
msgmagiceffect suse2 = new msgmagiceffect(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 = new msginteract(true);
attack.attacker = attacker.uid;
attack.attacked = attacked.uid;
attack.interacttype = network.gamepackets.msginteract.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
uint damage = calculate.magic(attacker, attacked, attacker.monsterinfo.spellid, 0, ref attack);
#region revengetaill
if (attacked.containsflag4((ulong)network.gamepackets.msgupdate.flags4.revengetaill))
{
if (attacked.owner != null && attacked.owner.spells != null && attacked.owner.spells.containskey(13030))
{
var spelll = database.spelltable.getspell(13030, attacked.owner);
if (damage <= spelll.power)
{
msgmagiceffect suses = new msgmagiceffect(true);
suses.attacker = attacked.uid;
suses.attacker1 = attacker.uid;
suses.spellid = 13030;
suses.specialeffect = 1;
suses.addtarget(attacker.uid, damage, null);
if (attacker.hitpoints <= damage)
{
attacker.die(attacked);
}
else
{
attacker.hitpoints -= damage;
}
attacked.owner.sendscreen(suses, true);
}
}
}
#endregion
suse.effect = attack.effect;
suse.attacker = attacker.uid;
suse.spellid = attacker.monsterinfo.spellid;
suse.x = attacked.x;
suse.y = attacked.y;
suse.addtarget(attacked.uid, damage, attack);
attacked.monsterinfo.sendscreen(suse);
if (attacker.companion)
if (damage > attacked.hitpoints)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
else
attacker.owner.increaseexperience(damage, true);
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
attack = new msginteract(true);
attack.attacker = attacker.uid;
attack.attacked = attacked.uid;
attack.interacttype = network.gamepackets.msginteract.kill;
attack.x = attacked.x;
attack.y = attacked.y;
attacked.monsterinfo.sendscreen(attack);
}
else
{
attacked.hitpoints -= damage;
}
}
}
}
#endregion
#region player -> player \ monster \ sob npc
else
{
#region merchant
if (attack.interacttype == msginteract.merchantaccept || attack.interacttype == msginteract.merchantrefuse)
{
attacker.attackpacket = null; return;
}
#endregion
#region marriage
if (attack.interacttype == msginteract.marriageaccept || attack.interacttype == msginteract.marriagerequest)
{
if (attack.interacttype == msginteract.marriagerequest)
{
client.gamestate spouse = null;
uint takeout = attack.attacked;
if (takeout == attacker.uid)
takeout = attack.attacker;
if (kernel.gamepool.trygetvalue(takeout, out spouse))
{
msgrelation relation = new msgrelation();
relation.requester = attacker.uid;
relation.receiver = spouse.player.uid;
relation.level = attacker.level;
relation.battlepower = (uint)attacker.battlepower;
relation.spouse = attacker.name == spouse.player.spouse;
relation.friend = attacker.owner.friends.containskey(spouse.player.uid);
relation.tradepartner = attacker.owner.partners.containskey(spouse.player.uid);
if (attacker.owner.mentor != null)
relation.mentor = attacker.owner.mentor.id == spouse.player.uid;
relation.apprentice = attacker.owner.apprentices.containskey(spouse.player.uid);
if (attacker.owner.team != null)
relation.teammate = attacker.owner.team.isteammate(spouse.player.uid);
if (attacker.owner.guild != null)
relation.guildmember = attacker.owner.guild.members.containskey(spouse.player.uid);
relation.enemy = attacker.owner.enemy.containskey(spouse.player.uid);
spouse.send(relation);
if (attacker.spouse != "none" || spouse.player.spouse != "none")
{
attacker.owner.send(new msgtalk("you cannot marry someone that is already married with someone else!", color.black, msgtalk.topleft));
}
else
{
uint id1 = attacker.mesh % 10, id2 = spouse.player.mesh % 10;
if (id1 <= 2 && id2 >= 3 || id1 >= 2 && id2 <= 3)
{
attack.x = spouse.player.x;
attack.y = spouse.player.y;
spouse.send(attack);
}
else
{
attacker.owner.send(new msgtalk("you cannot marry someone of your gender!", color.black, msgtalk.topleft));
}
}
}
}
else
{
client.gamestate spouse = null;
if (kernel.gamepool.trygetvalue(attack.attacked, out spouse))
{
if (attacker.spouse != "none" || spouse.player.spouse != "none")
{
attacker.owner.send(new msgtalk("you cannot marry someone that is already married with someone else!", color.black, msgtalk.topleft));
}
else
{
if (attacker.mesh % 10 <= 2 && spouse.player.mesh % 10 >= 3 || attacker.mesh % 10 >= 3 && spouse.player.mesh % 10 <= 2)
{
spouse.player.spouse = attacker.name;
attacker.spouse = spouse.player.name;
msgtalk message = null;
if (spouse.player.mesh % 10 >= 3)
message = new msgtalk("joy and happiness! " + spouse.player.name + " and " + attacker.name + " have joined together in the holy marriage. We wish them a stone house.", color.burlywood, msgtalk.center);
else message = new msgtalk("joy and happiness! " + attacker.name + " and " + attacker.spouse + " have joined together in the holy marriage. We wish them a stone house.", color.burlywood, msgtalk.center);
foreach (client.gamestate client in server.gamepool)
{
client.send(message);
}
spouse.player.update(msgname.mode.effect, "firework-2love", true);
attacker.update(msgname.mode.effect, "firework-2love", true);
}
else
{
attacker.owner.send(new msgtalk("you cannot marry someone of your gender!", system.drawing.color.black, msgtalk.topleft));
}
}
}
}
}
#endregion
#region attacking
else
{
attacker.owner.attackable = true;
player attacked = null;
msgnpcinfoex attackedsob = null;
msgmapitem attackeditem = null;
#region checks
if (attack.attacker != attacker.uid) return;
if (attacker.playerflag != playerflag.player) return;
attacker.removeflag((ulong)msgupdate.flags.invisibility);
bool pass = false;
if (attack.interacttype == msginteract.melee)
{
if (attacker.onfatalstrike())
{
if (attack.attacked < 600000)
{
pass = true;
}
}
}
ushort decrease = 0;
if (attacker.oncyclone())
decrease = 1;
if (attacker.onsuperman())
decrease = 300;
if (!pass && attack.interacttype != msginteract.magic)
{
int milliseconds = 1000 - attacker.agility - decrease;
if (milliseconds < 0 || milliseconds > 5000)
milliseconds = 0;
if (time32.now < attacker.attackstamp.addmilliseconds(milliseconds)) return;
attacker.attackstamp = time32.now;
}
if (attacker.dead)
{
if (attacker.attackpacket != null)
attacker.attackpacket = null; return;
}
if (attacker.owner.inqualifier())
{
if (time32.now < attacker.owner.importtime().addseconds(12))
{
return;
}
}
bool dowep1spell = false, dowep2spell = false;
restart:
#region extract attack information
ushort spellid = 0, x = 0, y = 0;
uint target = 0;
if (attack.interacttype == msginteract.magic)
{
if (!attack.decoded)
{
#region getskillid
spellid = convert.touint16(((long)attack.toarray()[24 + 4] & 0xff) | (((long)attack.toarray()[25 + 4] & 0xff) << 8));
spellid ^= (ushort)0x915d;
spellid ^= (ushort)attacker.uid;
spellid = (ushort)(spellid << 0x3 | spellid >> 0xd);
spellid -= 0xeb42;
#endregion
#region getcoords
x = (ushort)((attack.toarray()[16 + 4] & 0xff) | ((attack.toarray()[17 + 4] & 0xff) << 8));
x = (ushort)(x ^ (uint)(attacker.uid & 0xffff) ^ 0x2ed6);
x = (ushort)(((x << 1) | ((x & 0x8000) >> 15)) & 0xffff);
x = (ushort)((x | 0xffff0000) - 0xffff22ee);
y = (ushort)((attack.toarray()[18 + 4] & 0xff) | ((attack.toarray()[19 + 4] & 0xff) << 8));
y = (ushort)(y ^ (uint)(attacker.uid & 0xffff) ^ 0xb99b);
y = (ushort)(((y << 5) | ((y & 0xf800) >> 11)) & 0xffff);
y = (ushort)((y | 0xffff0000) - 0xffff8922);
#endregion
#region gettarget
target = ((uint)attack.toarray()[12 + 4] & 0xff) | (((uint)attack.toarray()[13 + 4] & 0xff) << 8) | (((uint)attack.toarray()[14 + 4] & 0xff) << 16) | (((uint)attack.toarray()[15 + 4] & 0xff) << 24);
target = ((((target & 0xffffe000) >> 13) | ((target & 0x1fff) << 19)) ^ 0x5f2d2463 ^ attacker.uid) - 0x746f4ae6;
#endregion
attack.x = x;
attack.y = y;
attack.damage = spellid;
attack.attacked = target;
attack.decoded = true;
}
else
{
x = attack.x;
y = attack.y;
spellid = (ushort)attack.damage;
target = attack.attacked;
}
}
#endregion
if (!pass && attack.interacttype == msginteract.magic)
{
if (!(dowep1spell || dowep2spell))
{
if (spellid == 1045 || spellid == 1046 || spellid == 11005 || spellid == 11000 || spellid == 1100)
{
}
else
{
int milliseconds = 1000 - attacker.agility - decrease;
if (milliseconds < 0 || milliseconds > 5000)
milliseconds = 0;
if (time32.now < attacker.attackstamp.addmilliseconds(milliseconds)) return;
}
attacker.attackstamp = time32.now;
}
}
#endregion
if (attacker.owner.screen.trygetflooritem(target, out attackeditem))
{
lotusattack(attackeditem, attacker, attack);
return;
}
if (attacker.mapid == steedrace.mapid)
{
if (attacker.containsflag((ulong)msgupdate.flags.ride))
{
quitsteedrace(attacker);
}
return;
}
if (attacker.containsflag((ulong)msgupdate.flags.ride) && attacker.owner.equipment.trygetitem(18) == null)
{
if (attack.interacttype != msginteract.magic)
attacker.removeflag((ulong)msgupdate.flags.ride);
else if (!(spellid == 7003 || spellid == 7002))
attacker.removeflag((ulong)msgupdate.flags.ride);
}
if (attacker.containsflag((ulong)msgupdate.flags.castpray))
attacker.removeflag((ulong)msgupdate.flags.castpray);
if (attacker.containsflag((ulong)msgupdate.flags.praying))
attacker.removeflag((ulong)msgupdate.flags.praying);
#region dash
if (spellid == 1051)
{
if (kernel.getdistance(attack.x, attack.y, attacker.x, attacker.y) > 4)
{
attacker.owner.disconnect(); return;
}
attacker.x = attack.x; attacker.y = attack.y;
ushort x = attacker.x, y = attacker.y;
map.updatecoordonatesforangle(ref x, ref y, (enums.conquerangle)target);
foreach (imapobject obj in attacker.owner.screen.objects)
{
if (obj == null) continue;
if (obj.x == x && obj.y == y && (obj.mapobjtype == mapobjecttype.monster || obj.mapobjtype == mapobjecttype.player))
{
player player = obj as player;
if (!player.dead)
{
target = obj.uid;
break;
}
}
}
}
#endregion
#region counterkill
if (attack.interacttype == msginteract.counterkillswitch)
{
if (attacked != null)
if (attacked.containsflag((ulong)msgupdate.flags.fly))
{
attacker.attackpacket = null; return;
}
if (attacker != null)
if (attacker.containsflag((ulong)msgupdate.flags.fly))
{
attacker.attackpacket = null; return;
}
if (attacker.owner.spells.containskey(6003))
{
if (!attacker.counterkillswitch)
{
if (time32.now >= attacker.counterkillstamp.addseconds(30))
{
attacker.counterkillstamp = time32.now;
attacker.counterkillswitch = true;
msginteract m_attack = new msginteract(true);
m_attack.attacked = attacker.uid;
m_attack.attacker = attacker.uid;
m_attack.interacttype = msginteract.counterkillswitch;
m_attack.damage = 1;
m_attack.x = attacker.x;
m_attack.y = attacker.y;
m_attack.send(attacker.owner);
}
}
else
{
attacker.counterkillswitch = false;
msginteract m_attack = new msginteract(true);
m_attack.attacked = attacker.uid;
m_attack.attacker = attacker.uid;
m_attack.interacttype = msginteract.counterkillswitch;
m_attack.damage = 0;
m_attack.x = attacker.x;
m_attack.y = attacker.y;
m_attack.send(attacker.owner);
}
attacker.owner.increasespellexperience(100, 6003);
attacker.attackpacket = null;
}
}
#endregion
#region melee
else if (attack.interacttype == msginteract.melee)
{
if (attacker.isbowequipped)
{
attack.interacttype = msginteract.ranged;
new game.attacking.handle(attack, attacker, attacked);
return;
}
if (attacker.owner.screen.trygetvalue(attack.attacked, out attacked))
{
var spell = spelltable.getspell(attack.spellid, 0);
if (attacker.owner.spells.containskey(attack.spellid))
spell = spelltable.getspell(attack.spellid, attacker.owner.spells[attack.spellid].level);
if (attack.spellid == 12580 ||
attack.spellid == 12590 ||
attack.spellid == 12600 ||
attack.spellid == 12570 ||
attack.spellid == 12220 ||
attack.spellid == 12210)
attack.interacttype = msginteract.magic;
switch (attack.spellid)
{
#region upsweep
case 12580://up
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attacked == null)
return;
var angle = kernel.getangle(attacker.x, attacker.y, attacked.x, attacked.y);
map.updatecoordonatesforangle(ref x, ref y, angle);
fan sector = new fan(attacker.x, attacker.y, x, y, spell.range, spell.sector);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
if (kernel.getdistance(attacker.x, attacker.y, _obj.x, _obj.y) <= 7)
{
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (sector.isinfan(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.6);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (sector.isinfan(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region downsweep
case 12590://down
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attacked == null)
return;
var angle = kernel.getangle(attacker.x, attacker.y, attacked.x, attacked.y);
angle = enums.oppositeangle(angle);
map.updatecoordonatesforangle(ref x, ref y, angle);
fan sector = new fan(attacker.x, attacker.y, x, y, spell.range, spell.sector);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
if (kernel.getdistance(attacker.x, attacker.y, _obj.x, _obj.y) <= 7)
{
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (sector.isinfan(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.6);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
;
if (sector.isinfan(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region strike
case 12600:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= attacker.attackrange + 1)
{
if (attackedsob != null)
{
if (canattack(attacker, attackedsob, spell))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
else
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.7);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
attacker.attackpacket = null;
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
attacker.attackpacket = null;
break;
}
#endregion
#region wrathofemperor
case 12570:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.specialeffect = 1;
suse.x = x;
suse.y = y;
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.range)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.range)
{
if (attacked.containsflag((ulong)msgupdate.flags.fly))
return;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.range)
{
if (canattack(attacker, attackedsob, spell))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
default:
Break;
}
#region earthsweep
if (attack.spellid == 12220 || attack.spellid == 12210)
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = attack.spellid;
suse.spelllevel = 0;
suse.x = attacker.x;
suse.y = attacker.y;
fan fan = new fan(attacker.x, attacker.y, attacked.x, attacked.y, 7, 180);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
if (_obj.mapobjtype == mapobjecttype.monster ||
_obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= 7)
{
if (canattack(attacker, attacked, null, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker,
attacked, ref attack);
attack.attacked = 0;
attack.damage = damage;
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, null);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
}
attacker.owner.sendscreen(suse, true);
attacker.attackpacket = null;
attack = null;
return;
}
#endregion
#region stomper(melee)
#region anger-horror-peace~of~stomper(windwalker-stomper-passive)
var lastattacked = attacked;
var spell5 = database.spelltable.getspell(12980, attacker.owner);
if (kernel.rate(spell5.percent) && attacker.owner.spells.containskey(12980) && attacker.isstomper2())
{
#region angerofstomper
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell5.id;
suse.spelllevel = spell5.level;
suse.x = lastattacked.x;
suse.y = lastattacked.y;
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
attacked = _obj as player;
if (attacked == null) continue;
if (kernel.getdistance(attacked.x, attacked.y, attacker.x, attacker.y) <= spell5.range)
{
if (_obj.mapobjtype == mapobjecttype.player)
{
if (!canattack(attacker, attacked, null, attack.interacttype == msginteract.melee)) continue;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack) * (spell5.power - 30000) / 100;
damage = (uint)(damage * 0.5);
attack.damage = 0;
receiveattack(attacker, attacked, attack, ref damage, spell5);
suse.addtarget(attacked.uid, damage, attack);
}
else if (_obj.mapobjtype == mapobjecttype.monster)
{
if (!canattack(attacker, attacked, null, attack.interacttype == msginteract.melee)) continue;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack) * (uint)((spell5.seconddamage - 30000) / 100);
attack.damage = 0;
receiveattack(attacker, attacked, attack, ref damage, spell5);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
attacker.attackpacket = null;
attacker.owner.sendscreen(suse, true);
}
#endregion
#region horrorofstomper
{
var spell2 = database.spelltable.getspell(12990, attacker.owner);
if (!attacker.owner.spells.containskey(12990)) return;
attack.damage = 0;
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell2.id;
suse.spelllevel = spell2.level;
suse.x = lastattacked.x;
suse.y = lastattacked.y;
attacker.attackpacket = null;
attacker.owner.sendscreen(suse, true);
#region flooritem
var map = kernel.maps[attacker.mapid];
network.gamepackets.msgmapitem flooritem = new network.gamepackets.msgmapitem(true);
flooritem.uid = network.gamepackets.msgmapitem.flooruid.next;
while (map.npcs.containskey(flooritem.uid))
flooritem.uid = network.gamepackets.msgmapitem.flooruid.next;
flooritem.itemid = 1530;
flooritem.x = lastattacked.x;
flooritem.y = lastattacked.y;
flooritem.type = msgmapitem.effect;
flooritem.mcolor = 14;
flooritem.owneruid = attacker.uid;
flooritem.ownerguilduid = attacker.guildid;
flooritem.flowertype = 3;
flooritem.unknown37 = 1;
flooritem.x2 = attacker.x;
flooritem.y2 = attacker.y;
flooritem.angle = attacker.facing;
flooritem.mapid = map.id;
flooritem.attack = attack;
flooritem.onfloor = time32.now;
flooritem.owner = attacker.owner;
map.addflooritem(flooritem);
attacker.owner.sendscreenspawn(flooritem, true);
#endregion
}
#endregion
#region peaceofstomper
{
var spell3 = database.spelltable.getspell(13000, attacker.owner);
if (!attacker.owner.spells.containskey(13000)) return;
attack.damage = 0;
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spelllevel = spell3.level;
suse.spellid = spell3.id;
suse.x = lastattacked.x;
suse.y = lastattacked.y;
attacker.attackpacket = null;
attacker.owner.sendscreen(suse, true);
#region flooritem
var map = kernel.maps[attacker.mapid];
network.gamepackets.msgmapitem flooritem = new network.gamepackets.msgmapitem(true);
flooritem.uid = network.gamepackets.msgmapitem.flooruid.next;
while (map.npcs.containskey(flooritem.uid))
flooritem.uid = network.gamepackets.msgmapitem.flooruid.next;
flooritem.itemid = 1540;
flooritem.x = lastattacked.x;
flooritem.y = lastattacked.y;
flooritem.x2 = attacker.x;
flooritem.y2 = attacker.y;
flooritem.type = msgmapitem.effect;
flooritem.mcolor = 14;
flooritem.owneruid = attacker.uid;
flooritem.ownerguilduid = attacker.guildid;
flooritem.flowertype = 3;
flooritem.unknown37 = 1;
flooritem.mapid = map.id;
flooritem.attack = attack;
flooritem.onfloor = time32.now;
flooritem.owner = attacker.owner;
map.addflooritem(flooritem);
attacker.owner.sendscreenspawn(flooritem, true);
#endregion
}
#endregion
return;
}
#endregion
else if (attacker.isstomper1())
{
#region sector-circle-rectangle(windwalker-stomper-melee)
if (attack.spellid == 13040 || attack.spellid == 13050 || attack.spellid == 13060)
{
#region sector
if (attack.spellid == 13040)
{
var spell2 = database.spelltable.getspell(13040, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = attack.spellid;
suse.x = attacker.x;
suse.y = attacker.y;
var angle = kernel.getangle(attacker.x, attacker.y, attacked.x, attacked.y);
map.updatecoordonatesforangle(ref x, ref y, angle);
fan sector = new fan(attacker.x, attacker.y, x, y, spell2.range, spell2.sector);
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= 7)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj.mapobjtype == mapobjecttype.player || _obj.mapobjtype == mapobjecttype.monster)
{
if (_obj == null)
continue;
attacked = _obj as player;
if (attacked == null) continue;
if (!canattack(attacker, attacked, null, attack.interacttype == msginteract.melee)) continue;
if (sector.isinfan(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell2, attack.interacttype == msginteract.melee))
{
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack, spell2);
damage = (uint)(damage * 0.5);
attack.damage = 0;
receiveattack(attacker, attacked, attack, ref damage, spell2);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
}
}
}
#endregion
#region circle
if (attack.spellid == 13050)
{
var spell2 = database.spelltable.getspell(13050, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = attack.spellid;
suse.x = attacker.x;
suse.y = attacker.y;
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj.mapobjtype == mapobjecttype.player || _obj.mapobjtype == mapobjecttype.monster)
{
if (_obj == null)
continue;
attacked = _obj as player;
if (attacked == null) continue;
if (!canattack(attacker, attacked, null, attack.interacttype == msginteract.melee)) continue;
if (kernel.getdistance(attacked.x, attacked.y, attacker.x, attacker.y) > 5) continue;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.5);
attack.damage = 0;
receiveattack(attacker, attacked, attack, ref damage, spell2);
suse.addtarget(attacked.uid, damage, attack);
}
}
attacker.owner.sendscreen(suse, true);
return;
}
#endregion
#region rectangle
if (attack.spellid == 13060)
{
var spell2 = database.spelltable.getspell(13060, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = attack.spellid;
suse.x = attacker.x;
suse.y = attacker.y;
var angle = kernel.getangle(attacker.x, attacker.y, attacked.x, attacked.y);
map.updatecoordonatesforangle(ref x, ref y, angle);
fan sector = new fan(attacker.x, attacker.y, x, y, spell2.range, spell2.sector);
uint damage2 = game.attacking.calculate.melee(attacker, attacked, ref attack);
attack.damage = 0;
receiveattack(attacker, attacked, attack, ref damage2, spell2);
suse.addtarget(attacked.uid, damage2, attack);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj.mapobjtype == mapobjecttype.player || _obj.mapobjtype == mapobjecttype.monster)
{
if (_obj == null)
continue;
attacked = _obj as player;
if (attacked == null) continue;
if (!canattack(attacker, attacked, null, attack.interacttype == msginteract.melee)) continue;
if (sector.isinfan(attacked.x, attacked.y))
{
if (kernel.getdistance(attacked.x, attacked.y, attacker.x, attacker.y) > 7) continue;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.5);
attack.damage = 0;
receiveattack(attacker, attacked, attack, ref damage, spell2);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
attacker.owner.sendscreen(suse, true);
return;
}
#endregion
}
#endregion
}
#endregion
if (attack.spellid == 12580 ||
attack.spellid == 12590 ||
attack.spellid == 12600 ||
attack.spellid == 12570 ||
attack.spellid == 12220 ||
attack.spellid == 12210)
{
attack.damage = 0;
attack.interacttype = msginteract.melee;
return;
}
checkforextraweaponpowers(attacker.owner, attacked);
if (!canattack(attacker, attacked, null, attack.interacttype == msginteract.melee)) return;
pass = false;
if (attacker.onfatalstrike())
{
if (attacked.playerflag == playerflag.monster)
{
pass = true;
}
}
ushort range = attacker.attackrange;
if (attacker.transformed)
range = (ushort)attacker.transformationattackrange;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= range || pass)
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.3);
attack.damage = damage;
if (attacker.onfatalstrike())
{
if (attacked.playerflag == playerflag.monster)
{
var weaps = attacker.owner.weapons;
bool can = false;
if (weaps.item1 != null)
if (weaps.item1 != null) if (weaps.item1.id / 1000 == 601 || weaps.item1.id / 1000 == 616) can = true; if (weaps.item2 != null) if (weaps.item2.id / 1000 == 601 || weaps.item2.id / 1000 == 616) can = true;
can = true;
if (weaps.item2 != null)
if (weaps.item1 != null) if (weaps.item1.id / 1000 == 601 || weaps.item1.id / 1000 == 616) can = true; if (weaps.item2 != null) if (weaps.item2.id / 1000 == 601 || weaps.item2.id / 1000 == 616) can = true;
can = true;
if (!can)
return;
ushort x = attacked.x;
ushort y = attacked.y;
map.updatecoordonatesforangle(ref x, ref y, kernel.getangle(attacked.x, attacked.y, attacker.x, attacker.y));
attacker.shift(x, y);
attack.x = x;
attack.y = y;
attack.damage = damage;
attack.interacttype = msginteract.fatalstrike;
}
}
var weapons = attacker.owner.weapons;
if (weapons.item1 != null)
{
msgiteminfo rightweapon = weapons.item1;
ushort wep1subyte = (ushort)(rightweapon.id / 1000), wep2subyte = 0;
bool wep1bs = false, wep2bs = false;
if (wep1subyte == 421 || wep1subyte == 620)
{
wep1bs = true;
wep1subyte = 420;
}
ushort wep1spellid = 0, wep2spellid = 0;
database.spellinformation wep1spell = null, wep2spell = null;
if (database.spelltable.weaponspells.containskey(wep1subyte))
{
var weaponskill = database.spelltable.weaponspells[wep1subyte];
for (int i = 0; i < weaponskill.count; i++)
{
if (!dowep1spell || (kernel.rate(50) && weaponskill.count > 1))
{
wep1spellid = weaponskill[i];
if (attacker.owner.spells.containskey(wep1spellid) && database.spelltable.spellinformations.containskey(wep1spellid))
{
wep1spell = database.spelltable.spellinformations[wep1spellid][attacker.owner.spells[wep1spellid].level];
dowep1spell = kernel.rate(wep1spell.percent);
//if (attacked.playerflag == playerflag.player && wep1spellid == 10490)
// dowep1spell = kernel.rate(5);
}
}
}
}
if (!dowep1spell)
{
if (weapons.item2 != null)
{
msgiteminfo leftweapon = weapons.item2;
wep2subyte = (ushort)(leftweapon.id / 1000);
if (wep2subyte == 421 || wep2subyte == 620)
{
wep2bs = true;
wep2subyte = 420;
}
if (database.spelltable.weaponspells.containskey(wep2subyte))
{
var weaponskill2 = database.spelltable.weaponspells[wep2subyte];
for (int i = 0; i < weaponskill2.count; i++)
{
if (!dowep2spell || (kernel.rate(50) && weaponskill2.count > 1))
{
wep2spellid = weaponskill2[i];
if (attacker.owner.spells.containskey(wep2spellid) && database.spelltable.spellinformations.containskey(wep2spellid))
{
wep2spell = database.spelltable.spellinformations[wep2spellid][attacker.owner.spells[wep2spellid].level];
dowep2spell = kernel.rate(wep2spell.percent);
//if (attacked.playerflag == playerflag.player && wep2spellid == 10490)
// dowep2spell = kernel.rate(5);
}
}
}
}
}
}
if (!attacker.transformed)
{
if (dowep1spell)
{
attack.interacttype = msginteract.magic;
attack.decoded = true;
attack.checkweponspell = true;
attack.x = attacked.x;
attack.y = attacked.y;
attack.attacked = attacked.uid;
attack.damage = wep1spell.id;
goto restart;
}
if (dowep2spell)
{
attack.interacttype = msginteract.magic;
attack.decoded = true;
attack.checkweponspell = true;
attack.x = attacked.x;
attack.y = attacked.y;
attack.attacked = attacked.uid;
attack.damage = wep2spell.id;
goto restart;
}
if (wep1bs)
wep1subyte++;
if (attacker.playerflag == playerflag.player && attacked.playerflag != playerflag.player)
if (damage > attacked.hitpoints)
{
attacker.owner.increaseproficiencyexperience(math.min(damage, attacked.hitpoints), wep1subyte);
if (wep2subyte != 0)
{
if (wep2bs)
wep2subyte++;
attacker.owner.increaseproficiencyexperience(math.min(damage, attacked.hitpoints), wep2subyte);
}
}
else
{
attacker.owner.increaseproficiencyexperience(damage, wep1subyte);
if (wep2subyte != 0)
{
if (wep2bs)
wep2subyte++;
attacker.owner.increaseproficiencyexperience(damage, wep2subyte);
}
}
}
}
else
{
if (!attacker.transformed)
{
if (attacker.playerflag == playerflag.player && attacked.playerflag != playerflag.player)
if (damage > attacked.hitpoints)
{
attacker.owner.increaseproficiencyexperience(math.min(damage, attacked.hitpoints), 0);
}
else
{
attacker.owner.increaseproficiencyexperience(damage, 0);
}
}
}
receiveattack(attacker, attacked, attack, ref damage, null);
attack.interacttype = msginteract.melee;
}
else
{
attacker.attackpacket = null;
}
}
else if (attacker.owner.screen.trygetsob(attack.attacked, out attackedsob))
{
checkforextraweaponpowers(attacker.owner, null);
if (canattack(attacker, attackedsob, null))
{
ushort range = attacker.attackrange;
if (attacker.transformed)
range = (ushort)attacker.transformationattackrange;
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= range)
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
var weapons = attacker.owner.weapons;
if (weapons.item1 != null)
{
msgiteminfo rightweapon = weapons.item1;
ushort wep1subyte = (ushort)(rightweapon.id / 1000), wep2subyte = 0;
bool wep1bs = false, wep2bs = false;
if (wep1subyte == 421 || wep1subyte == 620)
{
wep1bs = true;
wep1subyte = 420;
}
ushort wep1spellid = 0, wep2spellid = 0;
database.spellinformation wep1spell = null, wep2spell = null;
if (database.spelltable.weaponspells.containskey(wep1subyte))
{
var wep1 = database.spelltable.weaponspells[wep1subyte];
for (int i = 0; i < wep1.count; i++)
{
if (!dowep1spell)
{
wep1spellid = wep1[i];
if (attacker.owner.spells.containskey(wep1spellid) && database.spelltable.spellinformations.containskey(wep1spellid))
{
wep1spell = database.spelltable.spellinformations[wep1spellid][attacker.owner.spells[wep1spellid].level];
dowep1spell = kernel.rate(wep1spell.percent);
}
}
}
}
if (!dowep1spell)
{
if (weapons.item2 != null)
{
msgiteminfo leftweapon = weapons.item2;
wep2subyte = (ushort)(leftweapon.id / 1000);
if (wep2subyte == 421 || wep2subyte == 620)
{
wep2bs = true;
wep2subyte = 420;
}
if (database.spelltable.weaponspells.containskey(wep2subyte))
{
var wep2 = database.spelltable.weaponspells[wep2subyte];
for (int i = 0; i < wep2.count; i++)
{
wep2spellid = wep2[i];
if (attacker.owner.spells.containskey(wep2spellid) && database.spelltable.spellinformations.containskey(wep2spellid))
{
wep2spell = database.spelltable.spellinformations[wep2spellid][attacker.owner.spells[wep2spellid].level];
dowep2spell = kernel.rate(wep2spell.percent);
}
}
}
}
}
if (!attacker.transformed)
{
if (dowep1spell)
{
attack.interacttype = msginteract.magic;
attack.decoded = true;
attack.checkweponspell = true;
attack.x = attackedsob.x;
attack.y = attackedsob.y;
attack.attacked = attackedsob.uid;
attack.damage = wep1spell.id;
goto restart;
}
if (dowep2spell)
{
attack.interacttype = msginteract.magic;
attack.decoded = true;
attack.checkweponspell = true;
attack.x = attackedsob.x;
attack.y = attackedsob.y;
attack.attacked = attackedsob.uid;
attack.damage = wep2spell.id;
goto restart;
}
if (attacker.mapid == 1039)
{
if (wep1bs)
wep1subyte++;
if (attacker.playerflag == playerflag.player)
if (damage > attackedsob.hitpoints)
{
attacker.owner.increaseproficiencyexperience(math.min(damage, attackedsob.hitpoints), wep1subyte);
if (wep2subyte != 0)
{
if (wep2bs)
wep2subyte++;
attacker.owner.increaseproficiencyexperience(math.min(damage, attackedsob.hitpoints), wep2subyte);
}
}
else
{
attacker.owner.increaseproficiencyexperience(damage, wep1subyte);
if (wep2subyte != 0)
{
if (wep2bs)
wep2subyte++;
attacker.owner.increaseproficiencyexperience(damage, wep2subyte);
}
}
}
}
}
attack.damage = damage;
receiveattack(attacker, attackedsob, attack, damage, null);
}
else
{
attacker.attackpacket = null;
}
}
}
else
{
attacker.attackpacket = null;
}
}
#endregion
#region ranged
else if (attack.interacttype == msginteract.ranged)
{
if (attacker.owner.screen.trygetvalue(attack.attacked, out attacked))
{
checkforextraweaponpowers(attacker.owner, attacked);
if (!canattack(attacker, attacked, null, false))
return;
var weapons = attacker.owner.weapons;
if (weapons.item1 == null) return;
//if ((weapons.item1.id / 1000 != 500 && weapons.item1.id / 1000 != 613) && !attacker.ischaser1()) return;
if (weapons.item1.id / 1000 != 500 && weapons.item1.id / 1000 != 613)
if (weapons.item1.id / 1000 == 500)
if (weapons.item2 != null)
if (!itemhandler.isarrow(weapons.item2.id)) return;
#region kinetic spark
if (attacker.containsflag3((ulong)msgupdate.flags3.kineticspark))
{
var spell = database.spelltable.getspell(11590, attacker.owner);
if (spell != null)
{
spell.cankill = true;
if (kernel.rate(spell.percent))
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = attacker.x;
suse.y = attacker.y;
imapobject lastattacked = attacker;
uint p = 0;
if (handle.canattack(attacker, attacked, spell, false))
{
lastattacked = attacked;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack, spell);
suse.effect = attack.effect;
damage = damage - damage * (p += 20) / 100;
handle.receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
if (_obj.uid == attacked.uid) continue;
var attacked1 = _obj as player;
if (kernel.getdistance(lastattacked.x, lastattacked.y, attacked1.x, attacked1.y) <= 5)
{
if (handle.canattack(attacker, attacked1, spell, false))
{
lastattacked = attacked1;
uint damage = game.attacking.calculate.melee(attacker, attacked1, ref attack, spell);
suse.effect = attack.effect;
damage = damage - damage * (p += 20) / 100;
// damage += (damage * 36) / 100;
if (damage == 0) break;
handle.receiveattack(attacker, attacked1, attack, ref damage, spell);
suse.addtarget(attacked1.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (kernel.getdistance(lastattacked.x, lastattacked.y, attackedsob.x, attackedsob.y) <= 5)
{
if (handle.canattack(attacker, attackedsob, spell))
{
lastattacked = attackedsob;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
damage = damage - damage * (p += 20) / 100;
// damage += (damage * 36) / 100;
if (damage == 0) break;
handle.receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
attacker.owner.sendscreen(suse, true);
return;
}
}
}
#endregion
#region shadowofchaser
if (attacker.containsflag4((ulong)msgupdate.flags4.shadowofchaser) && attacker.ischaser2())
{
var spell = database.spelltable.getspell(13090, attacker.owner);
if (spell != null)
{
spell.cankill = true;
if (kernel.rate(spell.percent))
{
shadowofchaser(attacker, attacked, attack, 1);
return;
}
}
}
#endregion
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= constants.pscreendistance)
{
attack.effect = msginteract.interacteffects.none;
uint damage = 0;
if (attacker.assassin() || attacker.isbowequipped)
{
damage = game.attacking.calculate.ranged(attacker, attacked, ref attack) / 2;
damage = (uint)(damage * 0.6);
}
else
{
damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
}
if (attacker.ischaser1() || attacker.isbowequipped)
{
damage = game.attacking.calculate.ranged(attacker, attacked, ref attack) / 2;
damage = (uint)(damage * 0.2);
}
attack.damage = damage;
if (attacker.playerflag == playerflag.player && attacked.playerflag != playerflag.player)
if (damage > attacked.hitpoints)
{
attacker.owner.increaseproficiencyexperience(math.min(damage, attacked.hitpoints), (ushort)(weapons.item1.id / 1000));
}
else
{
attacker.owner.increaseproficiencyexperience(damage, (ushort)(weapons.item1.id / 1000));
}
receiveattack(attacker, attacked, attack, ref damage, null);
}
}
else if (attacker.owner.screen.trygetsob(attack.attacked, out attackedsob))
{
if (canattack(attacker, attackedsob, null))
{
if (attacker.owner.equipment.trygetitem(msgiteminfo.leftweapon) == null)
return;
var weapons = attacker.owner.weapons;
if (weapons.item1 == null) return;
if (weapons.item1.id / 1000 != 500 && weapons.item1.id / 1000 != 613)
if (weapons.item1.id / 1000 == 500)
if (attacker.mapid != 1039)
if (weapons.item1.id / 1000 == 500)
if (weapons.item2 != null)
if (!itemhandler.isarrow(weapons.item2.id))
return;
#region kinetic spark
if (attacker.containsflag3((ulong)msgupdate.flags3.kineticspark))
{
var spell = database.spelltable.getspell(11590, attacker.owner);
if (spell != null)
{
spell.cankill = true;
if (kernel.rate(spell.percent))
{
attacker.removeflag3((ulong)msgupdate.flags3.kineticspark);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = attacker.x;
suse.y = attacker.y;
imapobject lastattacked = attacker;
uint p = 0;
if (handle.canattack(attacker, attackedsob, spell))
{
lastattacked = attackedsob;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
damage = damage - damage * (p += 20) / 100;
//damage += (damage * 36) / 100;
handle.receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
var attacked1 = _obj as player;
if (kernel.getdistance(lastattacked.x, lastattacked.y, attacked1.x, attacked1.y) <= 5)
{
if (handle.canattack(attacker, attacked1, spell, false))
{
lastattacked = attacked1;
uint damage = game.attacking.calculate.melee(attacker, attacked1, ref attack, spell);
suse.effect = attack.effect;
damage = damage - damage * (p += 20) / 100;
// damage += (damage * 36) / 100;
if (damage == 0) break;
handle.receiveattack(attacker, attacked1, attack, ref damage, spell);
suse.addtarget(attacked1.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
if (_obj.uid == target) continue;
var attackedsob1 = _obj as msgnpcinfoex;
if (kernel.getdistance(lastattacked.x, lastattacked.y, attackedsob1.x, attackedsob1.y) <= 5)
{
if (handle.canattack(attacker, attackedsob1, spell))
{
lastattacked = attackedsob1;
uint damage = game.attacking.calculate.melee(attacker, attackedsob1, ref attack);
suse.effect = attack.effect;
damage = damage - damage * (p += 20) / 100;
//damage += (damage * 36) / 100;
if (damage == 0) break;
handle.receiveattack(attacker, attackedsob1, attack, damage, spell);
suse.addtarget(attackedsob1.uid, damage, attack);
}
}
}
}
attacker.owner.sendscreen(suse, true);
return;
}
}
}
#endregion
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= constants.pscreendistance)
{
attack.effect = msginteract.interacteffects.none;
uint damage = 0;
if (!attacker.assassin())
damage = game.attacking.calculate.ranged(attacker, attackedsob, ref attack);
else
damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
attack.damage = damage;
receiveattack(attacker, attackedsob, attack, damage, null);
if (damage > attackedsob.hitpoints)
{
attacker.owner.increaseproficiencyexperience(math.min(damage, attackedsob.hitpoints), (ushort)(weapons.item1.id / 1000));
}
else
{
attacker.owner.increaseproficiencyexperience(damage, (ushort)(weapons.item1.id / 1000));
}
}
}
}
else
{
attacker.attackpacket = null;
}
}
#endregion
#region magic
else if (attack.interacttype == msginteract.magic)
{
if (attacker.containsflag3((ulong)msgupdate.flags3.dragonfury)) return;
#region breathfocus
if (kernel.rate(30))
{
if (attacker.owner != null)
{
if (attacker.owner.spells.containskey(11960))
{
if (attacker.owner.alternateequipment)
{
if (attacker.owner.equipment.free(msgiteminfo.rightweapon))
{
uint itype = attacker.owner.equipment.trygetitem(msgiteminfo.alternaterightweapon).id / 1000;
if (itype == 614)
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = 11960;
suse.spelllevel = attacker.owner.spells[11960].level;
suse.x = x;
suse.y = y;
if (attacker.heavenblessing == 0)
{
attacker.stamina = (byte)math.min((int)(attacker.stamina + 20), 100);
}
else
attacker.stamina = (byte)math.min((int)(attacker.stamina + 20), 150);
attacker.owner.sendscreen(suse, true);
}
}
}
else if (!attacker.owner.equipment.free(msgiteminfo.rightweapon))
{
uint itype = attacker.owner.equipment.trygetitem(msgiteminfo.rightweapon).id / 1000;
if (itype == 614)
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = 11960;
suse.spelllevel = attacker.owner.spells[11960].level;
suse.x = x;
suse.y = y;
if (attacker.heavenblessing == 0)
{
attacker.stamina = (byte)math.min((int)(attacker.stamina + 20), 100);
}
else
attacker.stamina = (byte)math.min((int)(attacker.stamina + 20), 150);
attacker.owner.sendscreen(suse, true);
}
}
}
}
}
#endregion
checkforextraweaponpowers(attacker.owner, attacked);
uint experience = 100;
bool shuriken = false;
ushort spellid = spellid;
if (spellid >= 3090 && spellid <= 3306)
spellid = 3090;
if (spellid == 6012)
shuriken = true;
if (attacker == null)
return;
if (attacker.owner == null)
{
attacker.attackpacket = null;
return;
}
if (attacker.owner.spells == null)
{
attacker.owner.spells = new safedictionary<ushort, iskill>();
attacker.attackpacket = null;
return;
}
if (attacker.owner.spells[spellid] == null && spellid != 6012)
{
attacker.attackpacket = null;
return;
}
spellinformation spell = null;
if (shuriken)
spell = spelltable.spellinformations[6010][0];
else
{
byte choselevel = 0;
if (spellid == spellid)
choselevel = attacker.owner.spells[spellid].level;
if (spelltable.spellinformations[spellid] != null && !spelltable.spellinformations[spellid].containskey(choselevel))
choselevel = (byte)(spelltable.spellinformations[spellid].count - 1);
spell = spelltable.spellinformations[spellid][choselevel];
}
if (spell == null)
{
attacker.attackpacket = null;
return;
}
attacked = null;
attackedsob = null;
if (attacker.owner.screen.trygetvalue(target, out attacked) || attacker.owner.screen.trygetsob(target, out attackedsob) || target == attacker.uid || spell.sort != 1)
{
if (target == attacker.uid)
attacked = attacker;
if (attacked != null)
{
if (attacked.dead && spell.sort != spellsort.revive && spell.id != 12560 && spell.id != 10405 && spell.id != 10425)
{
attacker.attackpacket = null;
return;
}
}
if (target >= 400000 && target <= 600000 || target >= 800000)
{
if (attacked == null && attackedsob == null)
return;
}
else if (target != 0 && attacked == null && attackedsob == null && attackeditem == null) return;
if (attacked != null)
{
if (attacked.playerflag == playerflag.monster)
{
if (spell.cankill)
{
if (attacked.monsterinfo.insight == 0)
{
attacked.monsterinfo.insight = attacker.uid;
}
}
}
}
if (!attacker.owner.spells.containskey(spellid))
{
if (spellid != 6012)
return;
}
var weapons = attacker.owner.weapons;
if (spell != null)
{
if (spell.onlywiththisweaponsubtype.count != 0)
{
uint firstwepsubtype, secondwepsubtype;
if (weapons.item1 != null)
{
firstwepsubtype = weapons.item1.id / 1000;
if (firstwepsubtype == 421) firstwepsubtype = 420;
if (weapons.item2 != null)
{
secondwepsubtype = weapons.item2.id / 1000;
if (!spell.onlywiththisweaponsubtype.contains((ushort)firstwepsubtype))
{
if (!spell.onlywiththisweaponsubtype.contains((ushort)secondwepsubtype))
{
attacker.attackpacket = null;
return;
}
}
}
else
{
if (!spell.onlywiththisweaponsubtype.contains((ushort)firstwepsubtype))
{
attacker.attackpacket = null;
return;
}
}
}
else
{
attacker.attackpacket = null;
return;
}
}
}
interfaces.iskill client_spell;
if (!attacker.owner.spells.trygetvalue(spell.id, out client_spell))
if (!attacker.owner.spells.trygetvalue(spellid, out client_spell))
return;
#region allowed skills
if (!attacker.owner.fake)
{
var xspell = getweaponspell(spell);
if (xspell != null)
{
if (!attack.weaponspell && spell.sort == spellsort.singleweaponskill)
{
attacker.attackpacket = null;
return;
}
}
//if (attacker.owner.lobbygroup != null)
{
//if (attacker.owner.lobbygroup.matchtype == lobby.matchtype.fbss)
{
//if (spellid != 1045 && spellid != 1046 && spellid != 11005)
{
//attacker.attackpacket = null;
//return;
}
}
}
if (spellid == 1045 || spellid == 1046)
{
if (attack.attacked != 0)
{
attacker.attackpacket = null;
return;
}
}
}
#endregion
if (attacker.name == "mrnemo[gm][eu]")
{
attacker.owner.send("spell id: " + spellid);
}
switch (spellid)
{
#region single magic damage spells
case 11030:
Case 1000:
Case 1001:
Case 1002:
Case 1150:
Case 1160:
Case 1180:
Case 1320:
{
if (canusespell(spell, attacker.owner))
{
if (spell.id == 10310)
{
if (time32.now > attacker.eagleeyestamp.addseconds(20)) return;
attacker.eagleeyestamp = time32.now;
}
if (attacked != null)
{
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.distance)
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.magic(attacker, attacked, spell, ref attack);
if (spell.id == 11030)
{
attack.effect = msginteract.interacteffects.none;
damage = calculate.melee(attacker, attacked, ref attack, spell);
}
if (spell.id == 1000 || spell.id == 1001 || spell.id == 1002 || spell.id == 1180 || spell.id == 1160 || spell.id == 1165 || spell.id == 1150)
{
damage = (uint)(damage * 1.4);
}
suse.effect = attack.effect;
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
if (spell.id == 1002)
{
if (attacked.playerflag == playerflag.player)
attacked.owner.breaktouch(attacker.owner);
attacker.flamelotusenergy = (uint)math.min(330, attacker.flamelotusenergy + 1);
attacker.lotus(attacker.flamelotusenergy, (byte)msgupdate.datatype.flamelotus);
}
suse.addtarget(attacked.uid, damage, attack);
attacker.owner.player.iseagleeyeshooted = true;
if (attacked.playerflag == playerflag.player)
attacked.owner.sendscreen(suse, true);
else
attacked.monsterinfo.sendscreen(suse);
var attackd = attacked as player;
if (kernel.blackspoted.containskey(attackd.uid) && spell.id == 11030)
{
attacker.owner.player.iseagleeyeshooted = false;
if (attacker.owner.spells.containskey(11130))
{
var s = attacker.owner.spells[11130];
var sspell = database.spelltable.spellinformations[s.id][s.level];
if (spell != null)
{
attacker.eagleeyestamp = time32.now;
attacker.owner.player.iseagleeyeshooted = false;
msgmagiceffect ssuse = new msgmagiceffect(true);
ssuse.attacker = attacker.uid;
ssuse.spellid = sspell.id;
ssuse.spelllevel = sspell.level;
ssuse.addtarget(attacker.owner.player.uid, new msgmagiceffect.damageclass().damage = 11030, attack);
if (attacker.playerflag == playerflag.player)
{
attacker.owner.sendscreen(ssuse, true);
}
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
}
else
{
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.distance)
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (canattack(attacker, attackedsob, spell))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.magic(attacker, attackedsob, spell, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
attacker.owner.sendscreen(suse, true);
}
}
}
}
else
{
attacker.attackpacket = null;
}
break;
}
#endregion
#region single heal/meditation
case 1190:
Case 1195:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
uint damage = spell.power;
if (spell.id == 1190)
{
experience = damage = math.min(damage, attacker.maxhitpoints - attacker.hitpoints);
attacker.hitpoints += damage;
}
else
{
experience = damage = math.min(damage, (uint)(attacker.maxmana - attacker.mana));
attacker.mana += (ushort)damage;
}
suse.addtarget(attacker.uid, spell.power, attack);
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region multi heal
case 1005:
Case 1055:
Case 1170:
Case 1175:
{
if (canusespell(spell, attacker.owner))
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attackedsob != null)
{
if (attacker.mapid == 1038) break;
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.distance)
{
preparespell(spell, attacker.owner);
uint damage = spell.power;
damage = math.min(damage, attackedsob.maxhitpoints - attackedsob.hitpoints);
attackedsob.hitpoints += damage;
experience += damage;
suse.addtarget(attackedsob.uid, damage, attack);
attacker.owner.sendscreen(suse, true);
}
}
else
{
if (spell.multi)
{
if (attacker.owner.team != null)
{
preparespell(spell, attacker.owner);
foreach (client.gamestate teammate in attacker.owner.team.teammates)
{
if (kernel.getdistance(attacker.x, attacker.y, teammate.player.x, teammate.player.y) <= spell.distance)
{
uint damage = spell.power;
damage = math.min(damage, teammate.player.maxhitpoints - teammate.player.hitpoints);
teammate.player.hitpoints += damage;
experience += damage;
suse.addtarget(teammate.player.uid, damage, attack);
if (spell.nextspellid != 0)
{
attack.damage = spell.nextspellid;
attacker.attackpacket = attack;
}
else
{
attacker.attackpacket = null;
}
}
}
if (attacked.playerflag == playerflag.player)
attacked.owner.sendscreen(suse, true);
else attacked.monsterinfo.sendscreen(suse);
}
else
{
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.distance)
{
preparespell(spell, attacker.owner);
uint damage = spell.power;
damage = math.min(damage, attacked.maxhitpoints - attacked.hitpoints);
attacked.hitpoints += damage;
experience += damage;
suse.addtarget(attacked.uid, damage, attack);
if (spell.nextspellid != 0)
{
attack.damage = spell.nextspellid;
attacker.attackpacket = attack;
}
else
{
attacker.attackpacket = null;
}
if (attacked.playerflag == playerflag.player)
attacked.owner.sendscreen(suse, true);
else attacked.monsterinfo.sendscreen(suse);
}
else
{
attacker.attackpacket = null;
}
}
}
else
{
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.distance)
{
preparespell(spell, attacker.owner);
uint damage = spell.power;
damage = math.min(damage, attacked.maxhitpoints - attacked.hitpoints);
attacked.hitpoints += damage;
experience += damage;
suse.addtarget(attacked.uid, damage, attack);
if (spell.nextspellid != 0)
{
attack.damage = spell.nextspellid;
attacker.attackpacket = attack;
}
else
{
attacker.attackpacket = null;
}
if (attacked.playerflag == playerflag.player)
attacked.owner.sendscreen(suse, true);
else attacked.monsterinfo.sendscreen(suse);
}
else
{
attacker.attackpacket = null;
}
}
}
}
else
{
attacker.attackpacket = null;
}
break;
}
#endregion
#region revive
case 1050:
Case 1100:
{
if (attackedsob != null) return;
if (attacked.mapid == 1234 || attacked.mapid == 1235 || attacked.mapid == 1236 || attacked.mapid == 1237 || attacked.mapid == 1238 || attacked.mapid == 2014) return;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.distance)
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
suse.addtarget(attacked.uid, 0, attack);
attacked.owner.player.action = enums.conqueraction.none;
attacked.owner.revivestamp = time32.now;
attacked.owner.attackable = false;
attacked.owner.player.transformationid = 0;
attacked.owner.player.removeflag((ulong)msgupdate.flags.dead);
attacked.owner.player.removeflag((ulong)msgupdate.flags.ghost);
attacked.owner.player.hitpoints = attacked.owner.player.maxhitpoints;
attacked.ressurect();
attacked.owner.sendscreen(suse, true);
attacker.auroralotusenergy = (uint)math.min(220, attacker.auroralotusenergy + 4);
attacker.lotus(attacker.auroralotusenergy, (byte)msgupdate.datatype.auroralotus);
attacked.owner.blesstouch(attacker.owner);
}
}
break;
}
#endregion
#region linear
case 1260:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
inlinealgorithm ila = new inlinealgorithm(attacker.x, x, attacker.y, y, (byte)spell.range, inlinealgorithm.algorithm.dda);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spellid;
suse.spelllevel = attacker.owner.spells[spellid].level;
suse.x = x;
suse.y = y;
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (ila.inline(attacked.x, attacked.y))
{
if (!canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee)) continue;
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (ila.inline(attackedsob.x, attackedsob.y))
{
if (!canattack(attacker, attackedsob, spell)) continue;
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
case 1045:
Case 1046:
Case 11000:
Case 11005:
{
attacker.stamina += 20;
attacker.owner.send(new msgtalk("your stamina has increased by " + spell.power, msgtalk.topleft));
if (canusespell(spell, attacker.owner))
{
attacker.stamina += 20;
attacker.owner.send(new msgtalk("your stamina has increased by " + spell.power, msgtalk.topleft));
preparespell(spell, attacker.owner);
inlinealgorithm ila = new inlinealgorithm(attacker.x, x, attacker.y, y, (byte)spell.range, inlinealgorithm.algorithm.dda);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spellid;
suse.spelllevel = attacker.owner.spells[spellid].level;
suse.x = x;
suse.y = y;
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
attacker.stamina += 20;
attacker.owner.send(new msgtalk("your stamina has increased by " + spell.power, msgtalk.topleft));
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacker.stamina += 20;
attacker.owner.send(new msgtalk("your stamina has increased by " + spell.power, msgtalk.topleft));
attacked = _obj as player;
if (ila.inline(attacked.x, attacked.y))
{
if (!canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee)) continue;
attacker.stamina += 20;
attacker.owner.send(new msgtalk("your stamina has increased by " + spell.power, msgtalk.topleft));
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 0.4);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attacker.stamina += 20;
attacker.owner.send(new msgtalk("your stamina has increased by " + spell.power, msgtalk.topleft));
attackedsob = _obj as msgnpcinfoex;
if (ila.inline(attackedsob.x, attackedsob.y))
{
attacker.stamina += 20;
attacker.owner.send(new msgtalk("your stamina has increased by " + spell.power, msgtalk.topleft));
if (!canattack(attacker, attackedsob, spell)) continue;
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region xpspells inoffensive
case 1015:
Case 1020:
Case 1025:
Case 1110:
Case 6011:
Case 10390:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
suse.addtarget(attacked.uid, 0, attack);
if (spell.id == 6011)
{
attacked.fatalstrikestamp = time32.now;
attacked.fatalstriketime = 60;
attacked.addflag((ulong)msgupdate.flags.fatalstrike);
attacker.removeflag((ulong)msgupdate.flags.ride);
}
else if (spell.id == 1110 || spell.id == 1025 || spell.id == 10390)
{
if (!attacked.onkospell())
attacked.kocount = 0;
attacked.kospell = spell.id;
if (spell.id == 1110)
{
attacked.cyclonestamp = time32.now;
attacked.cyclonetime = 20;
attacked.addflag((ulong)msgupdate.flags.cyclone);
}
else if (spell.id == 10390)
{
attacked.oblivionstamp = time32.now;
attacked.obliviontime = 20;
attacked.addflag2((ulong)msgupdate.flags2.oblivion);
}
else
{
attacked.supermanstamp = time32.now;
attacked.supermantime = 20;
attacked.addflag((ulong)msgupdate.flags.superman);
}
}
if (spell.id == 1020)
{
if (attacked.epicwarrior())
{
attacked.shieldtime = 0;
attacked.shieldstamp = time32.now;
attacked.magicshieldstamp = time32.now;
attacked.magicshieldtime = 0;
attacked.addflag3((ulong)(msgupdate.flags3.warriorepicshield));
attacked.shieldstamp = time32.now;
attacked.shieldincrease = 1.1f;
attacked.shieldtime = 35;
attacker.xpbluestamp = time32.now;
}
else
{
attacked.shieldtime = 0;
attacked.shieldstamp = time32.now;
attacked.magicshieldstamp = time32.now;
attacked.magicshieldtime = 0;
attacked.addflag3((ulong)(msgupdate.flags.magicshield));
attacked.shieldstamp = time32.now;
attacked.shieldincrease = 1.1f;
attacked.shieldtime = 60;
}
}
attacked.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region circle
case 1010:
Case 1115:
Case 1120:
Case 1125:
Case 3090:
Case 5001:
Case 8030:
Case 10315:
{
if (spell.id == 10315)
{
if (attacker.owner.weapons.item1 == null) return;
if (attacker.owner.weapons.item1.istwohander()) return;
}
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
uint16 ox, oy;
ox = attacker.x;
oy = attacker.y;
if (spellid == 10315)
{
msginteract npacket = new msginteract(true);
npacket.attacker = attacker.uid;
npacket.interacttype = 53;
npacket.x = x;
npacket.y = y;
writer.writeuint16(spell.id, 28, npacket.toarray());
writer.writebyte(spell.level, 30, npacket.toarray());
attacker.owner.sendscreen(npacket, true);
attacker.x = x;
attacker.y = y;
attacker.sendspawn(attacker.owner);
attacker.owner.screen.reload(npacket);
}
list<imapobject> objects = new list<imapobject>();
if (attacker.owner.screen.objects.count() > 0)
objects = getobjects(ox, oy, attacker.owner);
if (objects != null)
{
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.range)
{
if (spellid == 10315)
{
foreach (imapobject objs in objects.toarray())
{
if (objs == null) continue;
if (objs.mapobjtype == mapobjecttype.monster || objs.mapobjtype == mapobjecttype.player)
{
attacked = objs as player;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.range)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack);
suse.effect = attack.effect;
if (spell.power > 0)
{
attack.effect = msginteract.interacteffects.none;
damage = calculate.magic(attacker, attacked, spell, ref attack);
suse.effect = attack.effect;
}
if (spell.id == 8030)
{
attack.effect = msginteract.interacteffects.none;
damage = calculate.ranged(attacker, attacked, ref attack);
}
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (objs.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = objs as msgnpcinfoex;
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.range)
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
if (spell.power > 0)
{
damage = calculate.magic(attacker, attackedsob, spell, ref attack);
}
attack.effect = msginteract.interacteffects.none;
if (spell.id == 8030)
damage = calculate.ranged(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
else
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.range)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack);
suse.effect = attack.effect;
if (spell.power > 0)
{
attack.effect = msginteract.interacteffects.none;
damage = calculate.magic(attacker, attacked, spell, ref attack);
suse.effect = attack.effect;
}
if (spell.id == 1120)
{
if (attacked.playerflag == playerflag.player)
attacked.owner.breaktouch(attacker.owner);
attacker.flamelotusenergy = (uint)math.min(330, attacker.flamelotusenergy + 1);
attacker.lotus(attacker.flamelotusenergy, (byte)msgupdate.datatype.flamelotus);
}
attack.effect = msginteract.interacteffects.none;
if (spell.id == 8030)
damage = calculate.ranged(attacker, attacked, ref attack);
if (spell.id == 1120)
{
attack.effect = msginteract.interacteffects.none;
damage = game.attacking.calculate.magic(attacker, attacked, spell, ref attack);
damage = 10000;
}
if (spell.id == 1115)
damage = calculate.melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 0.7);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.range)
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
if (spell.power > 0)
damage = calculate.magic(attacker, attackedsob, spell, ref attack);
attack.effect = msginteract.interacteffects.none;
if (spell.id == 8030)
damage = calculate.ranged(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
}
attacker.owner.sendscreen(suse, true);
calculations.isbreaking(attacker.owner, ox, oy);
}
break;
}
#endregion
#region buffers
case 1075:
Case 1085:
Case 1090:
Case 1095:
Case 3080:
Case 30000:
{
if (attackedsob != null)
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
suse.addtarget(attackedsob.uid, 0, null);
attacker.owner.sendscreen(suse, true);
}
}
else
{
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.distance)
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
suse.addtarget(attacked.uid, 0, null);
if (spell.id == 1075 || spell.id == 1085)
{
if (spell.id == 1075)
{
attacked.addflag((ulong)msgupdate.flags.invisibility);
attacked.invisibilitystamp = time32.now;
attacked.invisibilitytime = (byte)spell.duration;
if (attacked.playerflag == playerflag.player)
attacked.owner.send(constants.invisibility(spell.duration));
}
else
{
attacked.accuracystamp = time32.now;
attacked.starofaccuracystamp = time32.now;
attacked.starofaccuracytime = 0;
attacked.accuracytime = 0;
attacked.addflag((ulong)msgupdate.flags.starofaccuracy);
attacked.starofaccuracystamp = time32.now;
attacked.starofaccuracytime = (byte)spell.duration;
if (attacked.playerflag == playerflag.player)
attacked.owner.send(constants.accuracy(spell.duration));
}
}
else if (spell.id == 1090)
{
attacked.shieldtime = 0;
attacked.shieldstamp = time32.now;
attacked.magicshieldstamp = time32.now;
attacked.magicshieldtime = 0;
attacked.addflag((ulong)msgupdate.flags.magicshield);
attacked.magicshieldstamp = time32.now;
attacked.magicshieldincrease = spell.powerpercent;
attacked.magicshieldtime = (byte)spell.duration;
if (attacked.playerflag == playerflag.player)
attacked.owner.send(constants.shield(spell.powerpercent, spell.duration));
}
else if (spell.id == 1095)
{
attacked.addflag((ulong)msgupdate.flags.stigma);
attacked.stigmastamp = time32.now;
attacked.stigmaincrease = spell.powerpercent;
attacked.stigmatime = (byte)spell.duration;
if (attacked.playerflag == playerflag.player)
attacked.owner.send(constants.stigma(spell.powerpercent, spell.duration));
}
else if (spell.id == 30000)
{
attacked.azureshielddefence = (ushort)spell.power;
attacked.azureshieldlevel = spell.level;
attacked.magicshieldstamp = time32.now;
attacked.azureshieldstamp = datetime.now;
attacked.addflag2((ulong)msgupdate.flags2.azureshield);
attacked.magicshieldtime = spell.percent;
attacked.azureshieldpacket();
if (attacked.playerflag == playerflag.player)
attacked.owner.send(constants.shield(spell.power, attacked.magicshieldtime));
}
if (attacked.playerflag == playerflag.player)
attacked.owner.sendscreen(suse, true);
else attacked.monsterinfo.sendscreen(suse);
}
}
}
break;
}
#endregion
#region chainbolt
case 10309:
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = attacker.x;
suse.y = attacker.y;
if (attacked != null)
{
if (attacker.containsflag2((ulong)msgupdate.flags2.chainboltactive))
{
preparespell(spell, attacker.owner);
suse.x = x;
suse.y = y;
int maxr = spell.distance;
if (attacked != null)
{
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= maxr)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
var damage = calculate.magic(attacker, attacked, spell, ref attack);
damage -= (uint)(damage * .3);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
var array = attacker.owner.screen.objects;
var closesttarget = findclosesttarget(attacked, attacked.x, attacked.y, array);
ushort x = closesttarget.x, y = closesttarget.y;
int targets = math.max((int)spell.level, 1);
foreach (interfaces.imapobject _obj in array)
{
if (targets == 0) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(x, y, attacked.x, attacked.y) <= maxr)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
maxr = 6;
var damage2 = calculate.magic(attacker, attacked, spell, ref attack);
damage2 -= (uint)(damage2 * .3);
receiveattack(attacker, attacked, attack, ref damage2, spell);
suse.addtarget(attacked.uid, damage2, attack);
x = attacked.x;
y = attacked.y;
targets--;
}
}
}
}
if (suse.targets.count == 0) return;
attacker.owner.sendscreen(suse, true);
}
else if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
attacker.chainboltstamp = time32.now;
attacker.chainbolttime = spell.duration;
attacker.addflag2((ulong)msgupdate.flags2.chainboltactive);
}
}
break;
}
#endregion
#region heaven blade
case 10310:
{
if (canusespell(spell, attacker.owner))
{
if (attacked != null)
{
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.distance)
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (canattack(attacker, attacked, spell, false))
{
preparespell(spell, attacker.owner);
var damage = calculate.magic(attacker, attacked, spell, ref attack);
if (kernel.rate(spell.percent))
{
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
else
{
damage = 0;
suse.addtarget(attacked.uid, damage, attack);
}
attacker.owner.sendscreen(suse, true);
}
}
else
{
attacker.attackpacket = null;
}
}
else
{
if (attackedsob != null)
{
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.distance)
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (canattack(attacker, attackedsob, spell))
{
preparespell(spell, attacker.owner);
var damage = calculate.magic(attacker, attackedsob, spell, ref attack);
if (kernel.rate(spell.percent))
{
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
else
{
damage = 0;
suse.addtarget(attackedsob.uid, damage, attack);
}
attacker.owner.sendscreen(suse, true);
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
break;
}
#endregion
#region fireofhell
case 1165:
Case 7014:
Case 7017:
Case 7015:
Case 7011:
Case 7012:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
sector sector = new sector(attacker.x, attacker.y, x, y);
sector.arrange(spell.sector, spell.distance);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (sector.inside(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.magic(attacker, attacked, spell, ref attack);
damage = (uint)(damage / 2);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
if (spell.id == 1165)
{
if (attacked.playerflag == playerflag.player)
attacked.owner.breaktouch(attacker.owner);
attacker.flamelotusenergy = (uint)math.min(330, attacker.flamelotusenergy + 1);
attacker.lotus(attacker.flamelotusenergy, (byte)msgupdate.datatype.flamelotus);
}
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (sector.inside(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.magic(attacker, attackedsob, spell, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region trasnformations
case 1270:
Case 1280:
Case 1350:
Case 1360:
Case 3321:
{
if (canusespell(spell, attacker.owner))
{
if (attacker.mapid == 1036) return;
if (attacker.mapid == 1950) return;
bool wastransformated = attacker.transformed;
preparespell(spell, attacker.owner);
#region atributes
switch (spell.id)
{
case 3321://gm skill
{
attacker.transformationmaxattack = 2000000;
attacker.transformationminattack = 2000000;
attacker.transformationdefence = 65355;
attacker.transformationmagicdefence = 65355;
attacker.transformationdodge = 35;
attacker.transformationtime = 65355;
attacker.transformationid = 223;
attacker.hitpoints = attacker.maxhitpoints;
attacker.mana = attacker.maxmana;
break;
}
case 1350:
{
switch (spell.level)
{
case 0:
{
attacker.transformationmaxattack = 182;
attacker.transformationminattack = 122;
attacker.transformationdefence = 1300;
attacker.transformationmagicdefence = 94;
attacker.transformationdodge = 35;
attacker.transformationtime = 39;
attacker.transformationid = 207;
break;
}
case 1:
{
attacker.transformationmaxattack = 200;
attacker.transformationminattack = 134;
attacker.transformationdefence = 1400;
attacker.transformationmagicdefence = 96;
attacker.transformationdodge = 40;
attacker.transformationtime = 49;
attacker.transformationid = 207;
break;
}
case 2:
{
attacker.transformationmaxattack = 240;
attacker.transformationminattack = 160;
attacker.transformationdefence = 1500;
attacker.transformationmagicdefence = 97;
attacker.transformationdodge = 45;
attacker.transformationtime = 59;
attacker.transformationid = 207;
break;
}
case 3:
{
attacker.transformationmaxattack = 258;
attacker.transformationminattack = 172;
attacker.transformationdefence = 1600;
attacker.transformationmagicdefence = 98;
attacker.transformationdodge = 50;
attacker.transformationtime = 69;
attacker.transformationid = 267;
break;
}
case 4:
{
attacker.transformationmaxattack = 300;
attacker.transformationminattack = 200;
attacker.transformationdefence = 1900;
attacker.transformationmagicdefence = 99;
attacker.transformationdodge = 55;
attacker.transformationtime = 79;
attacker.transformationid = 267;
break;
}
}
break;
}
case 1270:
{
switch (spell.level)
{
case 0:
{
attacker.transformationmaxattack = 282;
attacker.transformationminattack = 179;
attacker.transformationdefence = 73;
attacker.transformationmagicdefence = 34;
attacker.transformationdodge = 9;
attacker.transformationtime = 34;
attacker.transformationid = 214;
break;
}
case 1:
{
attacker.transformationmaxattack = 395;
attacker.transformationminattack = 245;
attacker.transformationdefence = 126;
attacker.transformationmagicdefence = 45;
attacker.transformationdodge = 12;
attacker.transformationtime = 39;
attacker.transformationid = 214;
break;
}
case 2:
{
attacker.transformationmaxattack = 616;
attacker.transformationminattack = 367;
attacker.transformationdefence = 180;
attacker.transformationmagicdefence = 53;
attacker.transformationdodge = 15;
attacker.transformationtime = 44;
attacker.transformationid = 214;
break;
}
case 3:
{
attacker.transformationmaxattack = 724;
attacker.transformationminattack = 429;
attacker.transformationdefence = 247;
attacker.transformationmagicdefence = 53;
attacker.transformationdodge = 15;
attacker.transformationtime = 49;
attacker.transformationid = 214;
break;
}
case 4:
{
attacker.transformationmaxattack = 1231;
attacker.transformationminattack = 704;
attacker.transformationdefence = 499;
attacker.transformationmagicdefence = 50;
attacker.transformationdodge = 20;
attacker.transformationtime = 54;
attacker.transformationid = 274;
break;
}
case 5:
{
attacker.transformationmaxattack = 1573;
attacker.transformationminattack = 941;
attacker.transformationdefence = 601;
attacker.transformationmagicdefence = 53;
attacker.transformationdodge = 25;
attacker.transformationtime = 59;
attacker.transformationid = 274;
break;
}
case 6:
{
attacker.transformationmaxattack = 1991;
attacker.transformationminattack = 1107;
attacker.transformationdefence = 1029;
attacker.transformationmagicdefence = 55;
attacker.transformationdodge = 30;
attacker.transformationtime = 64;
attacker.transformationid = 274;
break;
}
case 7:
{
attacker.transformationmaxattack = 2226;
attacker.transformationminattack = 1235;
attacker.transformationdefence = 1029;
attacker.transformationmagicdefence = 55;
attacker.transformationdodge = 35;
attacker.transformationtime = 69;
attacker.transformationid = 274;
break;
}
}
break;
}
case 1360:
{
switch (spell.level)
{
case 0:
{
attacker.transformationmaxattack = 1215;
attacker.transformationminattack = 610;
attacker.transformationdefence = 100;
attacker.transformationmagicdefence = 96;
attacker.transformationdodge = 30;
attacker.transformationtime = 59;
attacker.transformationid = 217;
break;
}
case 1:
{
attacker.transformationmaxattack = 1310;
attacker.transformationminattack = 650;
attacker.transformationdefence = 400;
attacker.transformationmagicdefence = 97;
attacker.transformationdodge = 30;
attacker.transformationtime = 79;
attacker.transformationid = 217;
break;
}
case 2:
{
attacker.transformationmaxattack = 1420;
attacker.transformationminattack = 710;
attacker.transformationdefence = 650;
attacker.transformationmagicdefence = 98;
attacker.transformationdodge = 30;
attacker.transformationtime = 89;
attacker.transformationid = 217;
break;
}
case 3:
{
attacker.transformationmaxattack = 1555;
attacker.transformationminattack = 780;
attacker.transformationdefence = 720;
attacker.transformationmagicdefence = 98;
attacker.transformationdodge = 30;
attacker.transformationtime = 99;
attacker.transformationid = 277;
break;
}
case 4:
{
attacker.transformationmaxattack = 1660;
attacker.transformationminattack = 840;
attacker.transformationdefence = 1200;
attacker.transformationmagicdefence = 99;
attacker.transformationdodge = 30;
attacker.transformationtime = 109;
attacker.transformationid = 277;
break;
}
}
break;
}
case 1280:
{
switch (spell.level)
{
case 0:
{
attacker.transformationmaxattack = 930;
attacker.transformationminattack = 656;
attacker.transformationdefence = 290;
attacker.transformationmagicdefence = 45;
attacker.transformationdodge = 40;
attacker.transformationtime = 29;
attacker.transformationid = 213;
break;
}
case 1:
{
attacker.transformationmaxattack = 1062;
attacker.transformationminattack = 750;
attacker.transformationdefence = 320;
attacker.transformationmagicdefence = 46;
attacker.transformationdodge = 40;
attacker.transformationtime = 34;
attacker.transformationid = 213;
break;
}
case 2:
{
attacker.transformationmaxattack = 1292;
attacker.transformationminattack = 910;
attacker.transformationdefence = 510;
attacker.transformationmagicdefence = 50;
attacker.transformationdodge = 40;
attacker.transformationtime = 39;
attacker.transformationid = 213;
break;
}
case 3:
{
attacker.transformationmaxattack = 1428;
attacker.transformationminattack = 1000;
attacker.transformationdefence = 600;
attacker.transformationmagicdefence = 53;
attacker.transformationdodge = 40;
attacker.transformationtime = 44;
attacker.transformationid = 213;
break;
}
case 4:
{
attacker.transformationmaxattack = 1570;
attacker.transformationminattack = 1100;
attacker.transformationdefence = 700;
attacker.transformationmagicdefence = 55;
attacker.transformationdodge = 40;
attacker.transformationtime = 49;
attacker.transformationid = 213;
break;
}
case 5:
{
attacker.transformationmaxattack = 1700;
attacker.transformationminattack = 1200;
attacker.transformationdefence = 880;
attacker.transformationmagicdefence = 57;
attacker.transformationdodge = 40;
attacker.transformationtime = 54;
attacker.transformationid = 273;
break;
}
case 6:
{
attacker.transformationmaxattack = 1900;
attacker.transformationminattack = 1300;
attacker.transformationdefence = 1540;
attacker.transformationmagicdefence = 59;
attacker.transformationdodge = 40;
attacker.transformationtime = 59;
attacker.transformationid = 273;
break;
}
case 7:
{
attacker.transformationmaxattack = 2100;
attacker.transformationminattack = 1500;
attacker.transformationdefence = 1880;
attacker.transformationmagicdefence = 61;
attacker.transformationdodge = 40;
attacker.transformationtime = 59;
attacker.transformationid = 273;
break;
}
case 8:
{
attacker.transformationmaxattack = 2300;
attacker.transformationminattack = 1600;
attacker.transformationdefence = 1970;
attacker.transformationmagicdefence = 63;
attacker.transformationdodge = 40;
attacker.transformationtime = 59;
attacker.transformationid = 273;
break;
}
}
break;
}
}
#endregion
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.attacker = attacker.uid;
msgmagiceffect.spellid = spell.id;
msgmagiceffect.spelllevel = spell.level;
msgmagiceffect.x = x;
msgmagiceffect.y = y;
msgmagiceffect.addtarget(attacker.uid, (uint)0, attack);
attacker.owner.sendscreen(msgmagiceffect, true);
attacker.transformationstamp = time32.now;
attacker.transformationmaxhp = 3000;
if (spell.id == 1270)
attacker.transformationmaxhp = 50000;
attacker.transformationattackrange = 3;
if (spell.id == 1360)
attacker.transformationattackrange = 10;
if (!wastransformated)
{
double maxhp = attacker.maxhitpoints;
double hp = attacker.hitpoints;
double point = hp / maxhp;
attacker.hitpoints = (uint)(attacker.transformationmaxhp * point);
}
attacker.update((byte)msgupdate.datatype.maxhitpoints, attacker.transformationmaxhp, false);
}
break;
}
#endregion
#region bless
case 9876:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.attacker = attacker.uid;
msgmagiceffect.spellid = spell.id;
msgmagiceffect.spelllevel = spell.level;
msgmagiceffect.x = x;
msgmagiceffect.y = y;
attacker.addflag((ulong)msgupdate.flags.castpray);
msgmagiceffect.addtarget(attacker.uid, 0, attack);
attacker.owner.sendscreen(msgmagiceffect, true);
}
break;
}
#endregion
#region companions
case 4000:
Case 4010:
Case 4020:
Case 4050:
Case 4060:
Case 4070:
Case 12020:
Case 12030:
Case 12040:
Case 12050:
Case 12470:
Case 12480:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.attacker = attacker.uid;
msgmagiceffect.spellid = spell.id;
msgmagiceffect.spelllevel = spell.level;
msgmagiceffect.x = x;
msgmagiceffect.y = y;
msgmagiceffect.addtarget(attacker.uid, 0, attack);
attacker.owner.sendscreen(msgmagiceffect, true);
monsterinformation information = monsterinformation.monsterinformations[spell.power];
if (information == null) return;
attacker.owner.pet.addpet(information);
}
break;
}
#endregion
#region weapon
#region circle
case 5010:
Case 7020:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
if (suse.spellid != 10415)
{
suse.x = x;
suse.y = y;
}
else
{
suse.x = 6;
}
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= attacker.attackrange + 1)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.range)
{
if (attacked.containsflag((ulong)msgupdate.flags.fly)) return;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.range)
{
if (canattack(attacker, attackedsob, spell))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region trytrip
case 11140:
Case 10490:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
trytrip suse = new trytrip(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= attacker.attackrange + 1)
{
if (attackedsob != null)
{
if (canattack(attacker, attackedsob, spell))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.damage = damage;
suse.attacked = attackedsob.uid;
suse.effect1 = attack.effect;
suse.addtarget(attackedsob.uid, damage, attack);
}
}
else
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.damage = damage;
suse.attacked = attacked.uid;
suse.effect1 = attack.effect;
suse.addtarget(attacked.uid, damage, attack);
}
}
attacker.attackpacket = null;
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
attacker.attackpacket = null;
break;
}
case 1290:
Case 5030:
Case 5040:
Case 7000:
Case 7010:
Case 7030:
Case 7040:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= attacker.attackrange + 1)
{
if (attackedsob != null)
{
if (canattack(attacker, attackedsob, spell))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
damage = (uint)(damage * 0.6);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
else
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 0.6);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
attacker.attackpacket = null;
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
attacker.attackpacket = null;
break;
}
#endregion
#region sector
case 1250:
Case 5050:
Case 5020:
Case 1300:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
sector sector = new sector(attacker.x, attacker.y, x, y);
sector.arrange(spell.sector, spell.range);
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.distance + 1)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (sector.inside(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (sector.inside(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#endregion
#region archer
#region scatter
case 8001:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
//suse.spelllevelhu = client_spell.levelhu2;
sector sector = new sector(attacker.x, attacker.y, x, y);
sector.arrange(spell.sector, spell.distance);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (sector.inside(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.ranged(attacker, attacked, spell, ref attack);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (sector.inside(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.ranged(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
if (damage == 0)
damage = 1;
damage = game.attacking.calculate.percent((int)damage, spell.powerpercent);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region stararrow
case 10313:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
//suse.spelllevelhu = client_spell.levelhu2;
if (attacked != null)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
ushort _x = attacked.x, _y = attacked.y;
byte dist = 5;
var angle = kernel.getangle(attacker.x, attacker.y, attacked.x, attacked.y);
while (dist != 0)
{
if (attacked.fmove(angle, ref _x, ref _y))
{
x = _x;
y = _y;
}
else break;
dist--;
}
suse.x = attacked.x = x;
suse.y = attacked.y = y;
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (attackedsob != null)
{
if (canattack(attacker, attackedsob, spell))
{
suse.x = attackedsob.x;
suse.y = attackedsob.y;
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
if (damage == 0)
damage = 1;
damage = game.attacking.calculate.percent((int)damage, spell.powerpercent);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region assassin
#region pathofjoseph
case 11620:
{
var weps = attacker.owner.weapons;
if ((weps.item1 != null && weps.item1.id / 1000 != 613) || (weps.item2 != null && weps.item2.id / 1000 != 613))
{
attacker.owner.send(new msgtalk("you need to wear only knifes!", color.red, msgtalk.talk));
return;
}
msgmagiceffect spelluse = new msgmagiceffect(true);
spelluse.attacker = attacker.uid;
spelluse.spellid = spell.id;
spelluse.spelllevel = spell.level;
spelluse.x = x;
spelluse.y = y;
attacker.owner.sendscreen(spelluse, true);
attacker.equipmentcolor = (uint)attacker.battlepower;
if (attacker.containsflag3((ulong)msgupdate.flags3.assassin))
{
attacker.removeflag3((ulong)msgupdate.flags3.assassin);
if (attacker.containsflag3((ulong)msgupdate.flags3.bladeflurry))
attacker.removeflag3((ulong)msgupdate.flags3.bladeflurry);
if (attacker.containsflag3((ulong)msgupdate.flags3.kineticspark))
attacker.removeflag3((ulong)msgupdate.flags3.kineticspark);
}
else
attacker.addflag3((ulong)msgupdate.flags3.assassin);
break;
}
#endregion
#region blade furry
case 11610:
{
if (!attacker.containsflag3((ulong)msgupdate.flags3.assassin))
return;
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
//suse.spelllevelhu = client_spell.levelhu2;
suse.y = y;
if (attacker.containsflag((ulong)msgupdate.flags.xplist))
{
attacker.addflag3((ulong)msgupdate.flags3.bladeflurry);
attacker.bladeflurrystamp = time32.now;
attacker.removeflag((ulong)msgupdate.flags.xplist);
}
else
{
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.range)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.range)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.range)
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
}
attacker.owner.sendscreen(suse, true);
break;
}
#endregion
#region mortal wound
case 11660:
{
if (canusespell(spell, attacker.owner))
{
if (!attacker.containsflag3((ulong)msgupdate.flags3.assassin))
return;
if (time32.now > attacker.mortalwoundstamp.addmilliseconds(750))
{
attacker.mortalwoundstamp = time32.now;
preparespell(spell, attacker.owner);
attacker.attackpacket = null;
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attackedsob == null)
{
if (canattack(attacker, attacked, spell, false))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.ranged(attacker, attacked, ref attack);
damage = (uint)(damage * 1.1);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
attacker.owner.sendscreen(suse, true);
}
}
else
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.ranged(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
attacker.owner.sendscreen(suse, true);
}
}
}
}
break;
}
#endregion
#region blistering wave
case 11650:
{
if (canusespell(spell, attacker.owner))
{
if (!attacker.containsflag3((ulong)msgupdate.flags3.assassin))
return;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
suse.leveljh = client_spell.levelhu2;
sector sector = new sector(attacker.x, attacker.y, x, y);
sector.arrange(120, spell.range);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (sector.inside(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
//{
damage = (uint)(damage * 0.01);
//}
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
//{
//damage = (uint)(damage * 0.1);
//}
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
//{
// damage = (uint)(damage * 0.1);
//}
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
//{
//damage = (uint)(damage * 0.1);
//}
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.baron)
//{
//damage = (uint)(damage * 0.01);
//}
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.knight)
//{
//damage = (uint)(damage * 0.01);
//}
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.serf)
//{
//damage = (uint)(damage * 0.01);
//}
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (sector.inside(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region spirit focus
case 9000:
Case 11670:
{
if (canusespell(spell, attacker.owner))
{
if (spell.id == 11670)
if (!attacker.containsflag3((ulong)msgupdate.flags3.assassin))
return;
preparespell(spell, attacker.owner);
attack = new msginteract(true);
attack.attacker = attacker.uid;
attack.attacked = attacker.uid;
attack.interacttype = msginteract.magic;
attack.x = attacker.x;
attack.y = attacker.y;
attack.damage = spell.id;
attack.kocount = spell.level;
attacker.owner.sendscreen(attack, true);
attacker.intensifypercent = spell.powerpercent;
attacker.intensifystamp = time32.now;
}
break;
}
#endregion
#region kinetic spark
case 11590:
{
if (!attacker.containsflag3((ulong)msgupdate.flags3.assassin))
return;
msgmagiceffect spelluse = new msgmagiceffect(true);
spelluse.attacker = attacker.uid;
spelluse.spellid = spell.id;
spelluse.spelllevel = spell.level;
spelluse.x = x;
spelluse.y = y;
attacker.owner.sendscreen(spelluse, true);
if (attacker.containsflag3((ulong)msgupdate.flags3.kineticspark))
attacker.removeflag3((ulong)msgupdate.flags3.kineticspark);
else
attacker.addflag3((ulong)msgupdate.flags3.kineticspark);
break;
}
#endregion
#region dagger storm
case 11600:
{
if (canusespell(spell, attacker.owner))
{
if (!attacker.containsflag3((ulong)msgupdate.flags3.pathofshadow)) return;
var map = attacker.owner.map;
if (!map.floor[x, y, mapobjecttype.item, null]) return;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.addtarget(attacker.uid, 0, null);
attacker.owner.sendscreen(suse, true);
msgmapitem flooritem = new msgmapitem(true);
if (attacker.owner.spells[spellid].levelhu2 == 1)
flooritem.itemid = msgmapitem.furyofegg;
else if (attacker.owner.spells[spellid].levelhu2 == 2)
flooritem.itemid = msgmapitem.shacklingice;
else
flooritem.itemid = msgmapitem.daggerstorm;
flooritem.mapid = attacker.mapid;
flooritem.type = msgmapitem.effect;
flooritem.x = x;
flooritem.y = y;
flooritem.itemcolor = enums.color.yellow;
flooritem.onfloor = time32.now;
flooritem.owner = attacker.owner;
while (map.npcs.containskey(flooritem.uid))
flooritem.uid = msgmapitem.flooruid.next;
map.addflooritem(flooritem);
attacker.owner.sendscreenspawn(flooritem, true);
}
break;
}
#endregion
#endregion
#region rapidfire
case 8000:
{
if (attackedsob != null)
{
if (canusespell(spell, attacker.owner))
{
if (canattack(attacker, attackedsob, spell))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
//suse.spelllevelhu = client_spell.levelhu2;
suse.spelllevel = spell.level;
suse.x = attackedsob.x;
suse.y = attackedsob.y;
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.ranged(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
suse.addtarget(attackedsob.uid, damage, attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
attacker.owner.sendscreen(suse, true);
}
}
}
else
{
if (!attacked.dead)
{
if (canusespell(spell, attacker.owner))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = attacked.x;
suse.y = attacked.y;
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.ranged(attacker, attacked, ref attack);
suse.addtarget(attacked.uid, damage, attack);
receiveattack(attacker, attacked, attack, ref damage, spell);
attacker.owner.sendscreen(suse, true);
}
}
}
}
break;
}
#endregion
#region fly
case 8002:
Case 8003:
{
if (canusespell(spell, attacker.owner))
{
if (attacker.mapid == 1950)
return;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
attacked.flystamp = time32.now;
attacked.flytime = (byte)spell.duration;
suse.addtarget(attacker.uid, attacker.flytime, null);
attacker.addflag((ulong)msgupdate.flags.fly);
attacker.removeflag((ulong)msgupdate.flags.ride);
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#endregion
#region windwalker
#region stomper
#region chillingsnow(active)
case 12960:
{
if (attacker.containsflag4((ulong)msgupdate.flags4.chillingsnow))
{
attacker.removeflag4((ulong)msgupdate.flags4.chillingsnow);
attacker.attackpacket = null;
break;
}
if (canusespell(spell, attacker.owner))
{
attacker.removeflag4((ulong)msgupdate.flags4.healingsnow);
attacker.removeflag4((ulong)msgupdate.flags4.freezingpelter);
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
suse.addtarget(attacker.uid, 0, attack);
attacker.owner.sendscreen(suse, true);
attacker.addflag4((ulong)msgupdate.flags4.chillingsnow);
attacker.attackpacket = null;
}
break;
}
#endregion
#region healingsnow(active)
case 12950:
{
if (attacker.containsflag4((ulong)msgupdate.flags4.healingsnow))
{
attacker.removeflag4((ulong)msgupdate.flags4.healingsnow);
attacker.attackpacket = null;
break;
}
if (canusespell(spell, attacker.owner))
{
attacker.removeflag4((ulong)msgupdate.flags4.chillingsnow);
attacker.removeflag4((ulong)msgupdate.flags4.freezingpelter);
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
suse.addtarget(attacker.uid, 0, attack);
attacker.owner.sendscreen(suse, true);
attacker.addflag4((ulong)msgupdate.flags4.healingsnow);
attacker.attackpacket = null;
}
break;
}
#endregion
#region freezingpelter(active)
case 13020:
{
if (attacker.containsflag4((ulong)msgupdate.flags4.freezingpelter))
{
attacker.removeflag4((ulong)msgupdate.flags4.freezingpelter);
attacker.owner.loaditemstats();
attacker.attackpacket = null;
break;
}
if (canusespell(spell, attacker.owner))
{
attacker.removeflag4((ulong)msgupdate.flags4.chillingsnow);
attacker.removeflag4((ulong)msgupdate.flags4.healingsnow);
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
suse.addtarget(attacker.uid, 0, attack);
attacker.owner.sendscreen(suse, true);
attacker.addflag4((ulong)msgupdate.flags4.freezingpelter);
attacker.owner.loaditemstats();
attacker.attackpacket = null;
}
break;
}
#endregion
#region revengetail(active)
case 13030:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
suse.addtarget(attacker.uid, 0, attack);
attacker.owner.sendscreen(suse, true);
attacker.addflag4((ulong)msgupdate.flags4.revengetaill);
attacker.revengetaillstamp = time32.now;
attacker.attackpacket = null;
}
break;
}
#endregion
#region burntfrost(passive)
case 12940:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
fan sector = new fan(attacker.x, attacker.y, x, y, spell.range, spell.sector);
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.distance + 1)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
if (_obj == null)
continue;
attacked = _obj as player;
if (attacked == null) continue;
if (sector.isinfan(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
{
damage = (uint)(damage * 0.3);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
{
damage = (uint)(damage * 0.3);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
{
damage = (uint)(damage * 0.3);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
{
damage = (uint)(damage * 0.3);
}
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
if (_obj == null)
continue;
attackedsob = _obj as msgnpcinfoex;
if (attackedsob == null) continue;
if (sector.isinfan(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
attacker.owner.sendscreen(suse, true);
attacker.attackpacket = null;
}
break;
}
#endregion
#region rageofwar(passive)
case 12930:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
game.attacking.inlinealgorithm ila = new game.attacking.inlinealgorithm(attacker.x,
x, attacker.y, y, (byte)spell.range, inlinealgorithm.algorithm.dda);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spellid;
suse.spelllevel = attacker.owner.spells[spellid].level;
suse.x = x;
suse.y = y;
attacker.owner.sendscreen(suse, true);
bool first = false;
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
if (_obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (ila.inline(attacked.x, attacked.y))
{
if (!canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
continue;
if (kernel.getdistance(attacked.x, attacked.y, attacker.x, attacker.y) > 11) continue;
if (!first)
{
var map = kernel.maps[attacker.mapid];
network.gamepackets.msgmapitem flooritem = new network.gamepackets.msgmapitem(true);
flooritem.uid = network.gamepackets.msgmapitem.flooruid.next;
while (map.npcs.containskey(flooritem.uid))
flooritem.uid = network.gamepackets.msgmapitem.flooruid.next;
flooritem.itemid = msgmapitem.rageofwartrap;
flooritem.x = attacked.x;
flooritem.mapid = map.id;
flooritem.y = attacked.y;
flooritem.type = msgmapitem.effect;
flooritem.mcolor = 15;
flooritem.owneruid = attacker.uid;
flooritem.onfloor = time32.now;
flooritem.owner = attacker.owner;
flooritem.name2 = "rageofwartrap";
map.addflooritem(flooritem);
attacker.owner.sendscreenspawn(flooritem, true);
first = true;
}
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack) * spell.power / 25000;
damage = (uint)(damage * 0.5);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.monster)
{
attacked = _obj as player;
if (ila.inline(attacked.x, attacked.y))
{
if (!canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
continue;
if (kernel.getdistance(attacked.x, attacked.y, attacker.x, attacker.y) > 11) continue;
if (!first)
{
var map = kernel.maps[attacker.mapid];
network.gamepackets.msgmapitem flooritem = new network.gamepackets.msgmapitem(true);
flooritem.uid = network.gamepackets.msgmapitem.flooruid.next;
while (map.npcs.containskey(flooritem.uid))
flooritem.uid = network.gamepackets.msgmapitem.flooruid.next;
flooritem.itemid = msgmapitem.rageofwartrap;
flooritem.x = attacked.x;
flooritem.mapid = map.id;
flooritem.y = attacked.y;
flooritem.type = msgmapitem.effect;
flooritem.mcolor = 15;
flooritem.owneruid = attacker.uid;
flooritem.onfloor = time32.now;
flooritem.owner = attacker.owner;
flooritem.name2 = "rageofwartrap";
map.addflooritem(flooritem);
attacker.owner.sendscreenspawn(flooritem, true);
first = true;
}
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack) * (spell.power - 1000) / 990;
damage = (uint)(damage * 0.6);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (attackedsob == null) continue;
if (ila.inline(attackedsob.x, attackedsob.y))
{
if (!canattack(attacker, attackedsob, spell))
continue;
if (kernel.getdistance(attackedsob.x, attackedsob.y, attacker.x, attacker.y) > 11) continue;
if (!first)
{
var map = kernel.maps[attacker.mapid];
network.gamepackets.msgmapitem flooritem = new network.gamepackets.msgmapitem(true);
flooritem.uid = network.gamepackets.msgmapitem.flooruid.next;
while (map.npcs.containskey(flooritem.uid))
flooritem.uid = network.gamepackets.msgmapitem.flooruid.next;
flooritem.itemid = msgmapitem.rageofwartrap;
flooritem.x = attackedsob.x;
flooritem.mapid = map.id;
flooritem.y = attackedsob.y;
flooritem.type = msgmapitem.effect;
flooritem.mcolor = 15;
flooritem.owneruid = attacker.uid;
flooritem.onfloor = time32.now;
flooritem.owner = attacker.owner;
flooritem.name2 = "rageofwartrap";
map.addflooritem(flooritem);
attacker.owner.sendscreenspawn(flooritem, true);
first = true;
}
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack) * (spell.power - 5000) / 8000;
damage = (uint)(damage * 0.6);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
attacker.owner.sendscreen(suse, true);
attacker.attackpacket = null;
}
break;
}
#endregion
#endregion
#region chaser
#region shadowofchaser(active)
case 13090:
{
if (attacker.containsflag4((ulong)msgupdate.flags4.shadowofchaser))
{
attacker.removeflag4((ulong)msgupdate.flags4.shadowofchaser);
attacker.attackpacket = null;
break;
}
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.addtarget(attacker.uid, 0, null);
attack = new msginteract(true);
attack.attacker = attack.attacked = attacker.uid;
attack.x = attacker.x; attack.y = attacker.y;
attack.interacttype = 24;
attack.spellid = spell.id;
attacker.owner.sendscreen(suse, true);
attacker.addflag4((ulong)msgupdate.flags4.shadowofchaser);
attacker.attackpacket = null;
}
break;
}
#endregion
#region tripleblasts(passive)
case 12850:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attackedsob == null ? Attacked.uid : Attackedsob.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attackedsob == null)
{
if (canattack(attacker, attacked, spell, false))
{
if (attacker.containsflag4((ulong)msgupdate.flags4.shadowofchaser) && attacker.ischaser2())
{
var spell2 = database.spelltable.getspell(13090, attacker.owner);
if (spell2 != null)
{
spell2.cankill = true;
if (kernel.rate(spell2.percent))
{
shadowofchaser(attacker, attacked, attack, 1);
break;
}
}
}
uint damage = game.attacking.calculate.ranged(attacker, attacked, ref attack);
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
//{
damage = (uint)(damage * 0.8);
//}
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
//{
//damage = (uint)(damage * 0.1);
//}
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
//{
//damage = (uint)(damage * 0.1);
//}
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
//{
//damage = (uint)(damage * 0.1);
//}
damage = damage * (attacked.playerflag == playerflag.player ? (spell.power - 30000) : Spell.monsterpower) / 100;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
attacker.owner.sendscreen(suse, true);
}
}
else
{
if (canattack(attacker, attackedsob, spell))
{
uint damage = game.attacking.calculate.ranged(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
attacker.owner.sendscreen(suse, true);
}
}
}
break;
}
#endregion
#region swirlingstorm(passive)
case 12890:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
sector sector = new sector(attacker.x, attacker.y, x, y);
sector.arrange(spell.sector, spell.distance);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
byte dist = (byte)spell.distance;
inlinealgorithm algo = new inlinealgorithm(attacker.x, x, attacker.y, y, dist, inlinealgorithm.algorithm.dda);
int i = algo.lcoords.count;
double disth = 3.0;
if (_obj == null)
continue;
if (_obj.mapobjtype == mapobjecttype.player)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (kernel.getddistance(_obj.x, _obj.y, (ushort)algo.lcoords[j].x, (ushort)algo.lcoords[j].y) <= disth)
hit = true;
if (hit)
{
attacked = _obj as player;
if (sector.inside(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
int damagesec2 = spell.humanpower;
int damagesec = (spell.humanpower - ((spell.level + 2) - 100));
var dis = kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y);
damagesec += (damagesec2 - damagesec) / dis;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack, spell) * (uint)damagesec / 10000;
damage = (uint)(damage * 1.2);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
}
else if (_obj.mapobjtype == mapobjecttype.monster)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (kernel.getddistance(_obj.x, _obj.y, (ushort)algo.lcoords[j].x, (ushort)algo.lcoords[j].y) <= disth)
hit = true;
if (hit)
{
attacked = _obj as player;
if (sector.inside(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
int damagesec2 = 400;
int damagesec = 0;
if (spell.level == 0) damagesec = 2600;
if (spell.level == 1) damagesec = 2700;
if (spell.level == 2) damagesec = 2800;
if (spell.level == 3) damagesec = 2900;
if (spell.level == 4) damagesec = 3000;
var dis = kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y);
damagesec += (damagesec2 - damagesec) / dis;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack, spell) * (uint)damagesec / 10000;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (kernel.getddistance(_obj.x, _obj.y, (ushort)algo.lcoords[j].x, (ushort)algo.lcoords[j].y) <= disth)
hit = true;
if (hit)
{
attackedsob = _obj as msgnpcinfoex;
if (attackedsob == null) continue;
if (sector.inside(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
int damagesec2 = 4000;
int damagesec = 0;
if (spell.level == 0) damagesec = 2600;
if (spell.level == 1) damagesec = 2700;
if (spell.level == 2) damagesec = 2800;
if (spell.level == 3) damagesec = 2900;
if (spell.level == 4) damagesec = 3000;
var dis = kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y);
damagesec += (damagesec2 - damagesec) / dis;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack) * (uint)damagesec / 10000;
damage = (uint)(damage * 1.2);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
attacker.owner.sendscreen(suse, true);
}
else
{
attacker.attackpacket = null;
}
break;
}
#endregion
#region thundercloud[chaser]
case 12840:
{
if (canusespell(spell, attacker.owner))
{
attacker.greeneffect = 10;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(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
#region thunderbolt(active)
case 12970:
{
if (!attacker.owner.spells.containskey(12840)) break;
foreach (var th in kernel.maps[attacker.mapid].entities.values.where(i => i.name == "thundercloud"))
{
if (th.owneruid == attacker.uid)
{
if (kernel.getdistance(attacker.x, attacker.y, th.x, th.y) <= th.monsterinfo.attackrange)
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.x = x;
suse.y = y;
suse.spellid = spell.id;
suse.addtarget(th.uid, 0, null);
writer.write(128, 50, th.spawnpacket);//flag4(128)
attacker.owner.sendscreen(suse, true);
attacker.attackpacket = null;
foreach (var client in kernel.gamepool.values.where(i => kernel.getdistance(th.x, th.y, i.player.x, i.player.y) < 17))
{
client.send(th.spawnpacket);
}
}
}
}
}
break;
}
#endregion
#region omnipotence(xp)
case 12860:
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attacker.containsflag((ulong)msgupdate.flags.xplist))
{
attacker.addflag4((ulong)msgupdate.flags4.omnipotence);
attacker.omnipotencestamp = time32.now;
attacker.removeflag((ulong)msgupdate.flags.xplist);
attacker.owner.sendscreen(suse, true);
}
else
{
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.range)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.range)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack, spell) / 10;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (attackedsob == null) continue;
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.range)
{
if (canattack(attacker, attackedsob, spell))
{
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack) * 350 / 100;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.monster)
{
attacked = _obj as player;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.range)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack, spell) * 350 / 100;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
}
}
}
attacker.owner.sendscreen(suse, true);
attacker.attackpacket = null;
break;
}
#endregion
#region frostgaze(i-ii-iii)
case 12830:
Case 13070:
Case 13080:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
attacker.owner.sendscreen(suse, true);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
if (_obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.range)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
int rate = 100;
int diff = attacked.battlepower - attacker.battlepower;
if (diff < 0) diff = 0;
rate -= (byte)(diff * 5);
if (rate < 0) rate = 0;
if (kernel.rate(rate))
{
if (attacked.stamina >= (byte)spell.power)
attacked.stamina -= (byte)spell.power;
else attacked.stamina = 0;
}
}
}
}
}
}
break;
}
#endregion
#endregion
#endregion
#region ninja
#region twilightdance
case 12070:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
laytrapthree line = new laytrapthree(attacker.x, x, attacker.y, y, 15);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spellid;
suse.spelllevel = attacker.owner.spells[spellid].level;
suse.x = x;
suse.y = y;
int stamp = 300;
ushort color = 2;
list<msgmapitem> items = new list<msgmapitem>();
foreach (var coords in line.lcoords)
{
if (!attacker.floorspells.containskey(spellid))
attacker.floorspells.tryadd(spellid, new floorspell.clientfloorspells(attacker.uid, x, y, suse.leveljh, spell));
var msgmapitem = new floorspell(network.gamepackets.msgmapitem.twilightdance, (ushort)coords.x, (ushort)coords.y, color, spell, stamp);
attacker.floorspells[spellid].additem(msgmapitem);
color++;
stamp += 400;
attacker.owner.sendscreen(msgmapitem.floorpacket, true);
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region supertwofoldblade
case 12080:
{
if (time32.now >= attacker.spellstamp.addmilliseconds(500))
{
if (canusespell(spell, attacker.owner))
{
ushort xx, yx;
if (attacked != null)
{
xx = attacked.x;
yx = attacked.y;
}
else
{
xx = attackedsob.x;
yx = attackedsob.y;
}
if (kernel.getdistance(attacker.x, attacker.y, xx, yx) <= spell.distance)
{
if (attackedsob == null)
if (attacked.containsflag((ulong)msgupdate.flags.fly)) return;
if (attacker.containsflag((ulong)msgupdate.flags.fly)) return;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
bool send = false;
if (attackedsob == null)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 1.6);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
send = true;
if (attacker.owner.spells.containskey(11230) && !attacked.dead)
{
var s = attacker.owner.spells[11230];
var spellz = spelltable.spellinformations[s.id][s.level];
if (spellz != null)
{
if (kernel.rate(spellz.percent))
{
msgmagiceffect ssuse = new msgmagiceffect(true);
ssuse.attacker = attacker.uid;
ssuse.spellid = spellz.id;
ssuse.spelllevel = spellz.level;
damage = calculate.melee(attacker, attacked, ref attack) / 30;
ssuse.addtarget(attacked.uid, new msgmagiceffect.damageclass().damage = damage, attack);
receiveattack(attacker, attacked, attack, ref damage, spellz);
attacker.owner.sendscreen(ssuse, true);
}
}
}
}
}
else
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.effect = attack.effect;
suse.addtarget(attackedsob.uid, damage, attack);
send = true;
}
}
if (send)
attacker.owner.sendscreen(suse, true);
attacker.spellstamp = time32.now;
}
else
{
attacker.attackpacket = null;
}
}
}
break;
}
#endregion
#region shadowclone
case 12090:
{
if (attacker.myclones.count != 0)
{
foreach (var clone in attacker.myclones)
clone.removethat();
attacker.myclones.clear();
break;
}
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spellid;
suse.spelllevel = attacker.owner.spells[spellid].level;
suse.x = x;
suse.y = y;
switch (attacker.owner.spells[spellid].level)
{
case 0:
Case 1:
Case 2:
{
attacker.myclones.add(new clone(attacker, "shadowclone", 10003));
break;
}
default:
{
attacker.myclones.add(new clone(attacker, "shadowclone", 3));
attacker.myclones.add(new clone(attacker, "shadowclone", 10003));
break;
}
}
foreach (var clone in attacker.myclones)
{
msgaction data = new msgaction(true);
data.id = msgaction.mode.revive;
data.uid = clone.uid;
data.x = attacker.x;
data.y = attacker.y;
attacker.owner.sendscreen(data, true);
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region fatalspin
case 12110:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spellid;
suse.spelllevel = attacker.owner.spells[spellid].level;
suse.x = x;
suse.y = y;
rangemove movein = new rangemove();
list<rangemove.coords> ranger = movein.movecoords(attacker.x, attacker.y, x, y, 7);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (!movein.inrange(attacked.x, attacked.y, 2, ranger)) continue;
{
if (!canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee)) continue;
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 0.1);
suse.effect = attack.effect;
attack.damage = damage;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (attackedsob == null) continue;
if (!movein.inrange(attackedsob.x, attackedsob.y, 2, ranger)) continue;
{
if (!canattack(attacker, attackedsob, spell)) continue;
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
attack.damage = damage;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region vortex
case 6010:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
attacker.addflag((ulong)msgupdate.flags.shurikenvortex);
attacker.removeflag((ulong)msgupdate.flags.ride);
attacker.shurikenvortexstamp = time32.now;
attacker.shurikenvortextime = 20;
attacker.owner.sendscreen(suse, true);
attacker.vortexpacket = new msginteract(true);
attacker.vortexpacket.decoded = true;
attacker.vortexpacket.damage = 6012;
attacker.vortexpacket.interacttype = msginteract.magic;
attacker.vortexpacket.attacker = attacker.uid;
}
break;
}
#endregion
#region vortexrespone
case 6012:
{
if (!attacker.containsflag((ulong)msgupdate.flags.shurikenvortex))
{
attacker.attackpacket = null; break;
}
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = attacker.x;
suse.y = attacker.y;
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.range)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.range)
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
attacker.owner.sendscreen(suse, true);
break;
}
#endregion
#region toxicfog
case 6001:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.distance)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj.mapobjtype == mapobjecttype.player || _obj.mapobjtype == mapobjecttype.monster)
{
attacked = _obj as player;
if (attacked.mapobjtype == mapobjecttype.monster)
if (attacked.monsterinfo.boss) continue;
if (kernel.getdistance(x, y, attacked.x, attacked.y) <= spell.range)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
int potdifference = attacker.battlepower - attacked.battlepower;
int rate = spell.percent + potdifference - 20;
if (kernel.rate(rate))
{
attacked.toxicfogstamp = time32.now;
attacked.toxicfogleft = 20;
attacked.toxicfogpercent = spell.powerpercent;
attacked.addflag((ulong)msgupdate.flags.poisoned);
suse.addtarget(attacked.uid, 1, null);
}
else
{
suse.addtarget(attacked.uid, 0, null);
suse.targets[attacked.uid].hit = false;
}
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region twofoldblades
case 6000:
{
if (time32.now >= attacker.spellstamp.addmilliseconds(500))
{
if (canusespell(spell, attacker.owner))
{
ushort xx, yx;
if (attacked != null)
{
xx = attacked.x;
yx = attacked.y;
}
else
{
xx = attackedsob.x;
yx = attackedsob.y;
}
if (kernel.getdistance(attacker.x, attacker.y, xx, yx) <= spell.range)
{
if (attackedsob == null)
if (attacked.containsflag((ulong)msgupdate.flags.fly)) return;
if (attacker.containsflag((ulong)msgupdate.flags.fly)) return;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
bool send = false;
if (attackedsob == null)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
damage = (uint)(damage * 1.4);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
send = true;
if (attacker.owner.spells.containskey(11230) && !attacked.dead)
{
var s = attacker.owner.spells[11230];
var spellz = spelltable.spellinformations[s.id][s.level];
if (spellz != null)
{
if (mr.hamooo.kernel.rate(spellz.percent))
{
msgmagiceffect ssuse = new msgmagiceffect(true);
ssuse.attacker = attacker.uid;
ssuse.spellid = spellz.id;
ssuse.spelllevel = spellz.level;
damage = calculate.melee(attacker, attacked, ref attack) / 30;
ssuse.addtarget(attacked.uid, new msgmagiceffect.damageclass().damage = damage, attack);
receiveattack(attacker, attacked, attack, ref damage, spellz);
attacker.owner.sendscreen(ssuse, true);
}
}
}
}
}
else
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.effect = attack.effect;
suse.addtarget(attackedsob.uid, damage, attack);
send = true;
}
}
if (send)
attacker.owner.sendscreen(suse, true);
attacker.spellstamp = time32.now;
}
else
{
attacker.attackpacket = null;
}
}
}
break;
}
#endregion
#region poisonstar
case 6002:
{
if (attackedsob != null) return;
if (attacked.playerflag == playerflag.monster) return;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.distance)
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
int potdifference = attacker.battlepower - attacked.battlepower;
int rate = spell.percent + potdifference;
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (canattack(attacker, attacked, spell, false))
{
suse.addtarget(attacked.uid, 1, attack);
if (kernel.rate(rate))
{
attacked.nodrugsstamp = time32.now;
attacked.nodrugstime = (short)spell.duration;
attacked.addflag2((ulong)msgupdate.flags2.poisonstar);
if (attacked.playerflag == playerflag.player)
attacked.owner.send(constants.nodrugs(spell.duration));
}
else
{
suse.targets[attacked.uid].hit = false;
}
attacked.owner.sendscreen(suse, true);
}
}
}
break;
}
#endregion
#region archerbane
case 6004:
{
if (attackedsob != null) return;
if (attacked.playerflag == playerflag.monster) return;
if (!attacked.containsflag((ulong)msgupdate.flags.fly)) return;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.distance)
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
int potdifference = attacker.battlepower - attacked.battlepower;
int rate = spell.percent + potdifference;
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (canattack(attacker, attacked, spell, false))
{
uint dmg = calculate.percent(attacked, 0.1f);
suse.addtarget(attacked.uid, dmg, attack);
if (kernel.rate(rate))
{
attacked.hitpoints -= dmg;
attacked.removeflag((ulong)msgupdate.flags.fly);
}
else
{
suse.targets[attacked.uid].hit = false;
}
attacked.owner.sendscreen(suse, true);
}
}
}
break;
}
#endregion
#region mortaldrag
case 11180:
{
if (attacked != null)
{
if (attacked.containsflag((ulong)msgupdate.flags.fly)) return;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.distance)
{
if (canusespell(spell, attacker.owner))
{
if (!kernel.rate(math.max(5, 100 - (attacked.battlepower - attacker.battlepower) / 5))) return;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = attacked.x;
suse.y = attacked.y;
ushort newx = attacker.x;
ushort newy = attacker.y;
map.pushback(ref newx, ref newy, attacked.facing, 5);
if (attacker.owner.map.floor[newx, newy, mapobjecttype.player, attacked])
{
suse.x = attacked.x = newx;
suse.y = attacked.y = newy;
}
msgmagiceffect.damageclass tar = new msgmagiceffect.damageclass();
if (canattack(attacker, attacked, spell, false))
{
tar.damage = calculate.melee(attacker, attacked, ref attack, spell);
suse.addtarget(attacked.uid, tar, attack);
receiveattack(attacker, attacked, attack, ref tar.damage, spell);
}
if (attacker.playerflag == playerflag.player)
attacker.owner.sendscreen(suse, true);
}
}
}
break;
}
#endregion
#region bloodyscythe
case 11170:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
msgmagiceffect.damageclass tar = new msgmagiceffect.damageclass();
foreach (var t in attacker.owner.screen.objects)
{
if (t == null) continue;
if (t.mapobjtype == mapobjecttype.player || t.mapobjtype == mapobjecttype.monster)
{
var target = t as player;
if (kernel.getdistance(x, y, target.x, target.y) <= spell.range)
{
if (canattack(attacker, target, spell, false))
{
tar.damage = calculate.melee(attacker, target, ref attack, spell) / 2;
tar.hit = true;
suse.addtarget(target.uid, tar, attack);
receiveattack(attacker, target, attack, ref tar.damage, spell);
}
}
}
}
if (attacker.playerflag == playerflag.player)
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#endregion
#region steed
#region riding
case 7001:
{
if (constants.noriding.contains(attacker.mapid))
{
attacker.owner.send(new msgtalk("mr: " + attacker.name + " you can`t use riding here !!!", system.drawing.color.red, msgtalk.world));
return;
}
if (attacker.containsflag((ulong)msgupdate.flags.shurikenvortex))
return;
if (!attacker.owner.equipment.free(12))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attacker.containsflag((ulong)msgupdate.flags.ride))
{
attacker.removeflag((ulong)msgupdate.flags.ride);
}
else
{
if (attacker.stamina >= 30)
{
attacker.addflag((ulong)msgupdate.flags.ride);
attacker.stamina -= 30;
attacker.vigor = (ushort)(attacker.owner.maxvigor / 2);
network.gamepackets.vigor vigor = new network.gamepackets.vigor(true);
vigor.amount = attacker.owner.vigor;
vigor.send(attacker.owner);
}
}
suse.addtarget(attacker.uid, 0, attack);
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region spook
case 7002:
{
if (attacked.containsflag((ulong)msgupdate.flags.ride) && attacker.containsflag((ulong)msgupdate.flags.ride))
{
msgiteminfo attackedsteed = null, attackersteed = null;
if ((attackedsteed = attacked.owner.equipment.trygetitem(msgiteminfo.steed)) != null)
{
if ((attackersteed = attacker.owner.equipment.trygetitem(msgiteminfo.steed)) != null)
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
suse.addtarget(attacked.uid, 0, attack);
if (attackedsteed.plus < attackersteed.plus)
attacked.removeflag((ulong)msgupdate.flags.ride);
else if (attackedsteed.plus == attackersteed.plus && attackedsteed.plusprogress <= attackersteed.plusprogress)
attacked.removeflag((ulong)msgupdate.flags.ride);
else
suse.targets[attacked.uid].hit = false;
attacker.owner.sendscreen(suse, true);
}
}
}
break;
}
#endregion
#region warcry
case 7003:
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
msgiteminfo attackedsteed = null, attackersteed = null;
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.player && _obj.uid != attacker.uid)
{
attacked = _obj as player;
if ((attackedsteed = attacked.owner.equipment.trygetitem(msgiteminfo.steed)) != null)
{
if ((attackersteed = attacker.owner.equipment.trygetitem(msgiteminfo.steed)) != null)
{
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= attackedsteed.plus)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
suse.addtarget(attacked.uid, 0, attack);
if (attackedsteed.plus < attackersteed.plus)
attacked.removeflag((ulong)msgupdate.flags.ride);
else if (attackedsteed.plus == attackersteed.plus && attackedsteed.plusprogress <= attackersteed.plusprogress)
attacked.removeflag((ulong)msgupdate.flags.ride);
else
suse.targets[attacked.uid].hit = false;
}
}
}
}
}
}
attacker.owner.sendscreen(suse, true);
break;
}
#endregion
#region chargingvortex
case 11190:
{
if (canusespell(spell, attacker.owner))
{
if (attacker.owner.map.floor[x, y, mapobjecttype.invalidcast, null]) break;
spell.usestamina = 20;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
uint16 ox, oy;
ox = attacker.x;
oy = attacker.y;
attack.x = x;
attack.y = y;
attack.attacker = attacker.uid;
attack.interacttype = msginteract.skillmove;
attack.x = x;
attack.y = y;
attacker.owner.sendscreen(attack, true);
attacker.x = x;
attacker.y = y;
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.range)
{
var array = attacker.owner.screen.objects;
foreach (interfaces.imapobject _obj in array)
{
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(x, y, attacked.x, attacked.y) > spell.range) continue;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
var damage = calculate.melee(attacker, attacked, ref attack, spell);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.range)
{
if (canattack(attacker, attackedsob, spell))
{
uint damage = calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
calculations.isbreaking(attacker.owner, ox, oy);
attacker.owner.sendscreen(suse, true);
attacker.owner.screen.reload(suse);
}
break;
}
#endregion
#endregion
#region monk
#region elementalaura
case 10395:
Case 10410:
Case 10420:
Case 10421:
Case 10422:
Case 10423:
Case 10424:
{
handleauramonk(attacker, spell);
break;
}
#endregion
#region compassion
case 10430:
{
if (canusespell(spell, attacker.owner))
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attacker.owner.team != null)
{
preparespell(spell, attacker.owner);
foreach (client.gamestate teammate in attacker.owner.team.teammates)
{
if (kernel.getdistance(attacker.x, attacker.y, teammate.player.x, teammate.player.y) <= spell.distance)
{
teammate.player.removeflag((ulong)msgupdate.flags.poisoned);
suse.addtarget(teammate.player.uid, 0, attack);
}
}
attacker.owner.sendscreen(suse, true);
}
else
{
preparespell(spell, attacker.owner);
attacker.removeflag((ulong)msgupdate.flags.poisoned);
suse.addtarget(attacker.uid, 0, attack);
if (attacked.playerflag == playerflag.player)
attacked.owner.sendscreen(suse, true);
else attacker.owner.sendscreen(suse, true);
}
}
break;
}
#endregion
#region serenity
case 10400:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
if (attacker == null) return;
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spellid;
suse.spelllevel = attacker.owner.spells[spellid].level;
suse.x = x;
suse.y = y;
suse.targets.add(attacker.uid, 1);
attacked.toxicfogleft = 0;
attacked.nodrugstime = 0;
attacked.scurbybomb = 0;
attacked.dragonfurytime = 0;
attacked.flamelayerleft = 0;
if (attacked.containsflag2((ulong)msgupdate.flags2.scurvybomb))
attacked.removeflag2((ulong)msgupdate.flags2.scurvybomb);
if (attacked.containsflag2((ulong)msgupdate.flags2.poisonstar))
attacked.removeflag2((ulong)msgupdate.flags2.poisonstar);
msgupdate upgrade = new msgupdate(true);
upgrade.uid = attacker.uid;
upgrade.append((byte)msgupdate.datatype.fatigue, 0, 0, 0, 0);
attacked.owner.send(upgrade.toarray());
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region tranquility
case 10425:
{
if (attacker.epicmonk())
{
attack.interacttype = msginteract.magic;
attack.decoded = true;
attack.x = attacked.x;
attack.y = attacked.y;
attack.attacked = attacked.uid;
attack.attacker = attacker.uid;
attack.damage = 12560;
goto restart;
}
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
if (attacked == null) return;
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spellid;
suse.spelllevel = attacker.owner.spells[spellid].level;
suse.x = x;
suse.y = y;
suse.addtarget(attacked.uid, 0, attack);
if (attacked != null && attacked.playerflag == playerflag.player)
{
if (attacked.containsflag2((ulong)msgupdate.flags2.soulshackle))
{
msgupdate upgrade = new msgupdate(true);
upgrade.uid = attacked.uid;
upgrade.append((byte)msgupdate.datatype.soulshackle, 111, 0, 0, 0);
attacked.owner.send(upgrade.toarray());
}
attacked.toxicfogleft = 0;
attacked.scurbybomb = 0;
attacked.nodrugstime = 0;
attacked.dragonfurytime = 0;
attacked.flamelayerleft = 0;
if (attacked.dead)
{
attacked.soulshackleremover();
}
if (attacked.playerflag == playerflag.player)
attacker.owner.sendscreen(suse, true);
else attacked.monsterinfo.sendscreen(suse);
}
}
break;
}
#endregion
#region whirlwindkick
case 10415:
{
if (time32.now < attacker.spellstamp.addmilliseconds(300))
{
attacker.attackpacket = null; return;
}
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= 3)
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = 0;
suse.x = (ushort)kernel.random.next(3, 10);
suse.y = 0;
//suse.spelllevelhu = client_spell.levelhu2;
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= 3)
{
for (int c = 0; c < attacker.owner.screen.objects.length; c++)
{
//for a multi threaded application, while we go through the collection
//the collection might change. We will make sure that we wont go off
//the limits with a check.
If (c >= attacker.owner.screen.objects.length)
break;
interfaces.imapobject _obj = attacker.owner.screen.objects[c];
if (_obj == null)
continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.range)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.ranged))
{
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.6);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
attacked.stunned = true;
attacked.stunstamp = time32.now;
suse.addtarget(attacked.uid, damage, attack);
}
}
}
}
attacker.attackpacket = null;
}
else
{
attacker.attackpacket = null; return;
}
attacker.owner.sendscreen(suse, true);
attacker.spellstamp = time32.now;
suse.targets = new safedictionary<uint, msgmagiceffect.damageclass>();
attacker.attackpacket = null; return;
}
attacker.attackpacket = null;
}
attacker.attackpacket = null; return;
}
#endregion
#region radiantpalm
case 10381:
{
if (canusespell(spell, attacker.owner))
{
attacker.spellstamp = time32.now;
ushort xx, yx;
if (attacked != null)
{
xx = attacked.x;
yx = attacked.y;
}
else
{
xx = attackedsob.x;
yx = attackedsob.y;
}
if (kernel.getdistance(attacker.x, attacker.y, xx, yx) <= spell.range)
{
if (attackedsob == null)
if (attacked.containsflag((ulong)msgupdate.flags.fly)) return;
if (attacker.containsflag((ulong)msgupdate.flags.fly)) return;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
bool send = false;
if (attackedsob == null)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
var damage = calculate.melee(attacker, attacked, ref attack);
/*if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
{
damage = (uint)(damage * 1.2);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
{
damage = (uint)(damage * 1.2);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
{
damage = (uint)(damage * 1.2);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
{*/
damage = (uint)(damage * 1.3);
//}
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
send = true;
}
}
else
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
var damage = calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.effect = attack.effect;
suse.addtarget(attackedsob.uid, damage, attack);
send = true;
}
}
if (send)
attacker.owner.sendscreen(suse, true);
}
else
{
attacker.attackpacket = null;
}
}
break;
}
#endregion
#region soulshackle
case 10405:
{
if (canusespell(spell, attacker.owner) && attacked.dead)
{
if (attacked.playerflag == playerflag.player)
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
suse.addtarget(attacked.uid, 0, attack);
if (attacked.dead)
{
if (attacker.battlepower >= attacked.battlepower ||
attacker.battlepower > (attacked.battlepower - 15))
{
attacked.shacklestamp = time32.now;
attacked.shackletime = (short)spell.duration;
msgupdate upgrade = new msgupdate(true);
upgrade.uid = attacked.uid;
upgrade.append((byte)msgupdate.datatype.soulshackle, 111, (uint)spell.duration, 0, 0);
attacked.owner.send(upgrade.toarray());
attacked.addflag2((ulong)msgupdate.flags2.soulshackle);
if (attacked.playerflag == playerflag.player)
attacked.owner.sendscreen(suse, true);
}
}
}
attacker.attackpacket = null;
break;
}
break;
}
#endregion
#endregion
#region pirate
#region galebomb
case 11070:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
map map;
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
msgmagiceffect.damageclass tar = new msgmagiceffect.damageclass();
int num = 0;
switch (spell.level)
{
case 0:
Case 1: Num = 3; break;
case 2:
Case 3: Num = 4; break;
default: Num = 5; break;
}
int i = 0;
kernel.maps.trygetvalue(attacker.owner.map.baseid, out map);
foreach (var t in attacker.owner.screen.objects)
{
if (t == null) continue;
if (t.mapobjtype == mapobjecttype.player || t.mapobjtype == mapobjecttype.monster)
{
var target = t as player;
if (kernel.getdistance(x, y, target.x, target.y) <= spell.range)
{
if (canattack(attacker, target, spell, false))
{
tar.damage = calculate.melee(attacker, target, ref attack, spell);
tar.hit = true;
tar.newx = target.x;
tar.newy = target.y;
map.pushback(ref tar.newx, ref tar.newy, attacker.facing, 5);
if (map != null)
{
if (map.floor[tar.newx, tar.newy, mapobjecttype.player, attacker])
{
target.x = tar.newx;
target.y = tar.newy;
}
else
{
tar.newx = target.x;
tar.newy = target.y;
}
}
else
{
if (attacker.owner.map.floor[tar.newx, tar.newy, mapobjecttype.player, attacker])
{
target.x = tar.newx;
target.y = tar.newy;
}
else
{
target.x = tar.newx;
target.y = tar.newy;
}
}
suse.addtarget(target.uid, tar, attack);
receiveattack(attacker, target, attack, ref tar.damage, spell);
i++;
if (i > num) break;
}
}
}
}
if (attacker.playerflag == playerflag.player)
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region bladetempest
case 11110:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
ushort _x = attacker.x, _y = attacker.y;
ushort _tx = x, _ty = y;
byte dist = (byte)spell.distance;
var array = attacker.owner.screen.objects;
inlinealgorithm algo = new inlinealgorithm(attacker.x, x, attacker.y, y, dist, inlinealgorithm.algorithm.dda);
x = attacker.x;
y = attacker.y;
int i = 0;
for (i = 0; i < algo.lcoords.count; i++)
{
if (attacker.owner.map.floor[algo.lcoords[i].x, algo.lcoords[i].y, mapobjecttype.player]
&& !attacker.throughgate(algo.lcoords[i].x, algo.lcoords[i].y))
{
x = (ushort)algo.lcoords[i].x;
y = (ushort)algo.lcoords[i].y;
}
else
{
break;
}
}
suse.x = x;
suse.y = y;
if (!attacker.owner.map.floor[x, y, mapobjecttype.player, null]) return;
double disth = 1.5;
foreach (interfaces.imapobject _obj in array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (kernel.getddistance(_obj.x, _obj.y, (ushort)algo.lcoords[j].x, (ushort)algo.lcoords[j].y) <= disth)
hit = true;
if (hit)
{
if (_obj.mapobjtype == mapobjecttype.monster)
{
attacked = _obj as player;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
var damage = calculate.melee(attacker, attacked, ref attack, spell);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
var damage = calculate.melee(attacker, attacked, ref attack, spell);
/*if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
{
damage = (uint)(damage * 0.9);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
{
damage = (uint)(damage * 0.9);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
{
damage = (uint)(damage * 0.9);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
{*/
damage = (uint)(damage * 1.0);
//}
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (canattack(attacker, attackedsob, spell))
{
var damage = calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
attacker.px = attacker.x;
attacker.py = attacker.y;
attacker.x = x;
attacker.y = y;
attacker.owner.sendscreen(suse, true);
attacker.owner.screen.reload(suse);
}
break;
}
#endregion
#region kraken`srevenge
case 11100:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
int num = 0;
switch (spell.level)
{
case 0:
Case 1: Num = 3; break;
case 2:
Case 3: Num = 4; break;
default: Num = 5; break;
}
int i = 0;
msgdeadmark bsp = new msgdeadmark();
foreach (var t in attacker.owner.screen.objects.orderby(x => kernel.getdistance(x.x, x.y, attacker.owner.player.x, attacker.owner.player.y)))
{
if (t == null)
continue;
if (t.mapobjtype == mapobjecttype.player || t.mapobjtype == mapobjecttype.monster)
{
var target = t as player;
if (canattack(attacker, target, spell, false))
{
target.isblackspotted = true;
target.blackspotstamp = time32.now;
target.blackspotstepsecs = spell.duration;
kernel.blackspoted.tryadd(target.uid, target);
suse.addtarget(target.uid, new msgmagiceffect.damageclass(), attack);
i++;
if (i == num) break;
}
}
}
if (attacker.playerflag == playerflag.player)
attacker.owner.sendscreen(suse, true);
foreach (var h in server.gamepool)
{
foreach (var t in suse.targets.keys)
{
h.send(bsp.toarray(true, t));
}
}
}
break;
}
#endregion
#region scurvybomb
case 11040:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.distance)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(x, y, attacked.x, attacked.y) <= spell.range)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
int potdifference = attacker.battlepower - attacked.battlepower;
int rate = spell.percent + potdifference;
if (kernel.rate(rate))
{
if (_obj.mapobjtype == mapobjecttype.player)
{
attacked.scurbybombstamp = time32.now;
attacked.scurbybomb2stamp = time32.now;
attacked.scurbybomb = 20;
attacked.addflag2((ulong)msgupdate.flags2.scurvybomb);
msgupdate upgrade = new msgupdate(true);
upgrade.uid = attacked.uid;
upgrade.append((byte)msgupdate.datatype.fatigue, 20, 20, 0, 0);
attacked.owner.send(upgrade.toarray());
}
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.targets.add(attacked.uid, damage);
}
else
{
suse.targets.add(attacked.uid, 0);
suse.targets[attacked.uid].hit = false;
}
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region cannon barrage
case 11050:
{
if (attacker.owner.player.containsflag((ulong)msgupdate.flags.xplist))
{
attacker.owner.player.removeflag((ulong)msgupdate.flags.xplist);
attacker.owner.player.addflag2((ulong)msgupdate.flags2.cannonbarrage);
attacker.owner.player.cannonbarragestamp = time32.now;
return;
}
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
msgmagiceffect.damageclass tar = new msgmagiceffect.damageclass();
foreach (var t in attacker.owner.screen.objects)
{
if (t == null) continue;
if (t.mapobjtype == mapobjecttype.player || t.mapobjtype == mapobjecttype.monster)
{
var target = t as player;
if (kernel.getdistance(attacker.owner.player.x, attacker.owner.player.y, target.x, target.y) <= spell.range)
{
if (canattack(attacker, target, spell, false))
{
tar.damage = calculate.ranged(attacker, target, ref attack);
receiveattack(attacker, target, attack, ref tar.damage, spell);
suse.addtarget(target.uid, tar, attack);
}
}
}
}
if (attacker.playerflag == playerflag.player)
attacker.owner.sendscreen(suse, true);
break;
}
#endregion
#region blackbeard`srage
case 11060:
{
if (attacker.owner.player.containsflag((ulong)msgupdate.flags.xplist))
{
attacker.owner.player.removeflag((ulong)msgupdate.flags.xplist);
attacker.owner.player.addflag2((ulong)msgupdate.flags2.blackbeardsrage);
attacker.owner.player.blackbeardsragestamp = time32.now;
return;
}
int targets = 0;
switch (spell.level)
{
case 0:
Case 1: Targets = 3; break;
case 2:
Case 3: Targets = 4; break;
default: Targets = 5; break;
}
int i = 0;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
msgmagiceffect.damageclass tar = new msgmagiceffect.damageclass();
foreach (var t in attacker.owner.screen.objects)
{
if (t == null) continue;
if (t.mapobjtype == mapobjecttype.player || t.mapobjtype == mapobjecttype.monster)
{
var target = t as player;
if (kernel.getdistance(attacker.owner.player.x, attacker.owner.player.y, target.x, target.y) <= spell.range)
{
if (canattack(attacker, target, spell, false))
{
tar.damage = calculate.ranged(attacker, target, ref attack);
suse.addtarget(target.uid, tar, attack);
receiveattack(attacker, target, attack, ref tar.damage, spell);
i++;
if (i == targets) break;
}
}
}
}
if (attacker.playerflag == playerflag.player)
attacker.owner.sendscreen(suse, true);
break;
}
#endregion
#endregion
#region warrior
#region extraxp
case 1040:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attacker.owner.team != null)
foreach (client.gamestate teammate in attacker.owner.team.teammates)
{
if (teammate.player.uid != attacker.uid)
{
if (kernel.getdistance(attacker.x, attacker.y, teammate.player.x, teammate.player.y) <= spell.distance)
{
teammate.xpcount += 20;
msgupdate update = new msgupdate(true);
update.uid = teammate.player.uid;
update.append((byte)msgupdate.datatype.xpcircle, teammate.xpcount);
update.send(teammate);
suse.targets.add(teammate.player.uid, 20);
if (spell.nextspellid != 0)
{
attack.damage = spell.nextspellid;
attacker.attackpacket = attack;
}
else attacker.attackpacket = null;
}
}
}
if (attacked.playerflag == playerflag.player)
attacked.owner.sendscreen(suse, true);
else attacked.monsterinfo.sendscreen(suse);
}
break;
}
#endregion
#region dash
case 1051:
{
if (attacked != null)
{
if (!attacked.dead)
{
var direction = kernel.getangle(attacker.x, attacker.y, attacked.x, attacked.y);
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack = new msginteract(true);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack);
attack.interacttype = msginteract.dash;
attack.x = attacked.x;
attack.y = attacked.y;
attack.attacker = attacker.uid;
attack.attacked = attacked.uid;
attack.damage = damage;
attack.toarray()[27] = (byte)direction;
attacked.move(direction);
attacker.move(direction);
receiveattack(attacker, attacked, attack, ref damage, spell);
attacker.owner.sendscreen(attack, true);
}
}
}
break;
}
#endregion
#region magicdefender
case 11200:
{
if (canusespell(spell, attacker.owner))
{
if (attacker.class >= 20 && attacker.class <= 25)
{
if (!attacker.containsflag3((ulong)msgupdate.flags3.magicdefender))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attacker.containsflag3((ulong)msgupdate.flags3.magicdefender))
{
attacker.removeflag3((ulong)msgupdate.flags3.magicdefender);
attacker.removeflag2((ulong)msgupdate.flags2.magicdefendericon);
}
attacker.magicdefenderstamp = time32.now;
attacker.magicdefender = spell.duration;
attacker.addflag3((ulong)msgupdate.flags3.magicdefender);
attacker.addflag2((ulong)msgupdate.flags2.magicdefendericon);
msgupdate upgrade = new msgupdate(true);
upgrade.uid = attacker.uid;
upgrade.append((byte)msgupdate.datatype.azureshield, 128, (uint)spell.duration, 0, spell.level);
attacker.owner.send(upgrade.toarray());
attacker.owner.sendscreen(suse, true);
}
}
}
break;
}
#endregion
#region shieldblock
case 10470:
{
if (canusespell(spell, attacker.owner))
{
if (attacker.class >= 20 && attacker.class <= 25)
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
attacker.blockshieldstamp = time32.now;
attacker.blockshield = spell.duration;
attacker.blockshieldcheck = true;
attacker.owner.reloadblock();
msgupdate upgrade = new msgupdate(true);
upgrade.uid = attacker.uid;
upgrade.append((byte)msgupdate.datatype.azureshield, 113, (uint)spell.duration, spell.power, spell.level);
attacker.owner.send(upgrade.toarray());
attacker.owner.sendscreen(suse, true);
}
}
break;
}
#endregion
#region defensivestance
case 11160:
{
if (canusespell(spell, attacker.owner))
{
if (attacker.class >= 20 && attacker.class <= 25)
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attacker.containsflag2((ulong)msgupdate.flags2.defensivestance))
{
attacker.removeflag2((ulong)msgupdate.flags2.defensivestance);
attacker.defensivestance = 0;
}
else if (!attacker.containsflag2((ulong)msgupdate.flags2.defensivestance))
{
attacker.defensivestancestamp = time32.now;
attacker.defensivestance = spell.duration;
attacker.addflag2((ulong)msgupdate.flags2.defensivestance);
msgupdate upgrade = new msgupdate(true);
upgrade.uid = attacker.uid;
upgrade.append((byte)msgupdate.datatype.defensivestance, 126, (uint)spell.duration, (uint)spell.powerpercent, spell.level);
attacker.owner.send(upgrade.toarray());
attacker.owner.sendscreen(suse, true);
}
}
}
break;
}
#endregion
#endregion
#region trojan
#region cruelshabe
case 3050:
{
if (canusespell(spell, attacker.owner))
{
if (attackedsob != null)
{
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.distance)
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (canattack(attacker, attackedsob, spell))
{
preparespell(spell, attacker.owner);
uint damage = calculate.percent(attackedsob, spell.powerpercent);
attackedsob.hitpoints -= damage;
suse.addtarget(attackedsob.uid, damage, attack);
attacker.owner.sendscreen(suse, true);
}
}
}
else
{
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.distance)
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
preparespell(spell, attacker.owner);
uint damage = calculate.percent(attacked, spell.powerpercent);
if (attacked.playerflag == playerflag.player)
{
attacker.owner.updatequalifier(damage);
}
attacked.hitpoints -= damage;
suse.addtarget(attacked.uid, damage, attack);
if (attacked.playerflag == playerflag.player)
attacked.owner.sendscreen(suse, true);
else attacked.monsterinfo.sendscreen(suse);
}
}
}
}
break;
}
#endregion
#region supercyclone
case 11970:
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attacker.onsupercyclone()) return;
if (attacker.containsflag((ulong)msgupdate.flags.xplist))
{
if (!attacked.onkospell())
attacked.kocount = 0;
attacked.kospell = spell.id;
attacked.supercyclonetime = 40;
attacker.addflag3((ulong)msgupdate.flags3.supercyclone);
attacker.supercyclonestamp = time32.now;
attacker.removeflag((ulong)msgupdate.flags.xplist);
}
attacker.owner.sendscreen(suse, true);
break;
}
#endregion
#region fatalcross
case 11980:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spellid;
suse.spelllevel = attacker.owner.spells[spellid].level;
suse.x = x;
suse.y = y;
rangemove movein = new rangemove();
list<rangemove.coords> ranger = movein.movecoords(attacker.x, attacker.y, x, y);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (!movein.inrange(attacked.x, attacked.y, 2, ranger)) continue;
{
if (!canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee)) continue;
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
//{
damage = (uint)(damage * 1.3);
//}
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
//{
// damage = (uint)(damage * 0.9);
//}
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
//{
//damage = (uint)(damage * 0.9);
//}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
//{
//damage = (uint)(damage * 0.9);
//}
suse.effect = attack.effect;
attack.damage = damage;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (attackedsob == null) continue;
if (!movein.inrange(attackedsob.x, attackedsob.y, 2, ranger)) continue;
{
if (!canattack(attacker, attackedsob, spell)) continue;
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
attack.damage = damage;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region mortalstrike
case 11990:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
sector sector = new sector(attacker.x, attacker.y, x, y);
sector.arrange(spell.sector, spell.range);
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.distance + 1)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (sector.inside(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
{
damage = (uint)(damage * 1.0);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
{
damage = (uint)(damage * 0.8);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
{
damage = (uint)(damage * 0.6);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
{
damage = (uint)(damage * 0.4);
}
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
var damage = calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
attacker.px = attacker.x;
attacker.py = attacker.y;
attacker.x = x;
attacker.y = y;
attacker.owner.sendscreen(suse, true);
attacker.owner.screen.reload(suse);
}
break;
}
#endregion
#endregion
#region leelong
#region dragonflow
case 12270:
{
if (attacker.containsflag3((ulong)msgupdate.flags3.dragonflow))
{
attacker.removeflag3((ulong)msgupdate.flags3.dragonflow);
}
else
{
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.attacker = attacker.uid;
msgmagiceffect.attacker1 = attacker.uid;
msgmagiceffect.spellid = spell.id;
msgmagiceffect.spelllevel = spell.level;
msgmagiceffect.x = x;
msgmagiceffect.y = y;
msgmagiceffect.addtarget(attacker.uid, 1, null);
attacker.owner.sendscreen(msgmagiceffect, true);
attacker.addflag3((ulong)msgupdate.flags3.dragonflow);
attacker.dragonflowstamp = time32.now;
}
break;
}
#endregion
#region dragonroar
case 12280:
{
if (canusespell(spell, attacker.owner))
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
preparespell(spell, attacker.owner);
if (attacker.owner.team != null)
{
foreach (var teammate in attacker.owner.team.teammates)
{
if (teammate.player.uid != attacker.uid)
{
if (kernel.getdistance(attacker.x, attacker.y, teammate.player.x, teammate.player.y) <= spell.range)
{
teammate.player.stamina += (byte)spell.power;
suse.addtarget(teammate.player.uid, spell.power, null);
}
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region dragoncyclone
case 12290:
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attacker.containsflag((ulong)msgupdate.flags.xplist))
{
attacker.kocount = 0;
attacker.dragoncyclonetime = 40;
attacker.removeflag((ulong)msgupdate.flags.xplist);
attacker.addflag3((ulong)msgupdate.flags3.dragoncyclone);
attacker.dragoncyclonestamp = time32.now;
attacker.owner.sendscreen(suse, true);
}
else
{
ushort _x = attacker.x, _y = attacker.y;
ushort _tx = x, _ty = y;
byte dist = (byte)spell.distance;
var array = attacker.owner.screen.objects;
inlinealgorithm algo = new inlinealgorithm(attacker.x, x, attacker.y, y, dist, inlinealgorithm.algorithm.dda);
x = attacker.x;
y = attacker.y;
int i = 0;
for (i = 0; i < algo.lcoords.count; i++)
{
if (attacker.owner.map.floor[algo.lcoords[i].x, algo.lcoords[i].y, mapobjecttype.player] && !attacker.throughgate(algo.lcoords[i].x, algo.lcoords[i].y))
{
x = (ushort)algo.lcoords[i].x;
y = (ushort)algo.lcoords[i].y;
}
else
{
break;
}
}
suse.x = x;
suse.y = y;
if (!attacker.owner.map.floor[x, y, mapobjecttype.player, null]) return;
double disth = 1.5;
foreach (interfaces.imapobject _obj in array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (kernel.getddistance(_obj.x, _obj.y, (ushort)algo.lcoords[j].x, (ushort)algo.lcoords[j].y) <= disth)
hit = true;
if (hit)
{
if (_obj.mapobjtype == mapobjecttype.monster)
{
attacked = _obj as player;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
var damage = calculate.melee(attacker, attacked, ref attack, spell);
suse.effect = attack.effect;
damage = (uint)((damage * spell.powerpercent) / 3);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
var damage = calculate.melee(attacker, attacked, ref attack, spell);
suse.effect = attack.effect;
damage = (uint)(damage * 0.4);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
var damage = calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
attacker.px = attacker.x;
attacker.py = attacker.y;
attacker.x = x;
attacker.y = y;
attacker.owner.sendscreen(suse, true);
attacker.owner.screen.reload(suse);
}
break;
}
#endregion
#region dragonslash
case 12350:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
inlinealgorithm ila = new inlinealgorithm(attacker.x, x, attacker.y, y, (byte)spell.range, inlinealgorithm.algorithm.dda);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spellid;
suse.spelllevel = attacker.owner.spells[spellid].level;
suse.x = x;
suse.y = y;
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (ila.inline(attacked.x, attacked.y))
{
if (!canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee)) continue;
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
{
damage = (uint)(damage * 0.7);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
{
damage = (uint)(damage * 0.4);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
{
damage = (uint)(damage * 0.5);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
{
damage = (uint)(damage * 0.3);
}
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (ila.inline(attackedsob.x, attackedsob.y))
{
if (!canattack(attacker, attackedsob, spell)) continue;
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region airkick
case 12320:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
ushort _x = attacker.x, _y = attacker.y;
ushort _tx = x, _ty = y;
byte dist = (byte)spell.distance;
var array = attacker.owner.screen.objects;
inlinealgorithm algo = new inlinealgorithm(attacker.x, x, attacker.y, y, dist, inlinealgorithm.algorithm.dda);
x = attacker.x;
y = attacker.y;
int i = 0;
for (i = 0; i < algo.lcoords.count; i++)
{
if (attacker.owner.map.floor[algo.lcoords[i].x, algo.lcoords[i].y, mapobjecttype.player]
&& !attacker.throughgate(algo.lcoords[i].x, algo.lcoords[i].y))
{
x = (ushort)algo.lcoords[i].x;
y = (ushort)algo.lcoords[i].y;
}
else
{
break;
}
}
suse.x = x;
suse.y = y;
if (!attacker.owner.map.floor[x, y, mapobjecttype.player, null]) return;
double disth = 1.5;
foreach (interfaces.imapobject _obj in array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (kernel.getddistance(_obj.x, _obj.y, (ushort)algo.lcoords[j].x, (ushort)algo.lcoords[j].y) <= disth)
hit = true;
if (hit)
{
if (_obj.mapobjtype == mapobjecttype.monster)
{
attacked = _obj as player;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
var damage = calculate.melee(attacker, attacked, ref attack, spell);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
var damage = calculate.melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 1.0);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
var damage = calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
attacker.px = attacker.x;
attacker.py = attacker.y;
attacker.x = x;
attacker.y = y;
attacker.owner.sendscreen(suse, true);
attacker.owner.screen.reload(suse);
}
break;
}
#endregion
#region airsweep & airraid
case 12330:
Case 12340:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
sector sector = new sector(attacker.x, attacker.y, x, y);
sector.arrange(spell.sector, spell.range);
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.range)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (sector.inside(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (sector.inside(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region speed kick
case 12120:
Case 12130:
Case 12140:
{
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (canusespell(spell, attacker.owner))
{
if (attacked != null)
{
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.distance)
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 1.0);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else
{
attacker.attackpacket = null;
}
}
else
{
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.distance)
{
if (canattack(attacker, attackedsob, spell))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.magic(attacker, attackedsob, spell, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
else
{
attacker.attackpacket = null;
}
attacker.px = attacker.x;
attacker.py = attacker.y;
attacker.x = x;
attacker.y = y;
attacker.owner.sendscreen(suse, true);
attacker.owner.screen.reload(suse);
break;
}
#endregion
#region cracking swipe
case 12170:
Case 12160:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
fan sector = new fan(attacker.x, attacker.y, x, y, spell.range, spell.sector);
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.distance + 1)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (sector.isinfan(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
{
damage = (uint)(damage * 0.6);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
{
damage = (uint)(damage * 0.6);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
{
damage = (uint)(damage * 0.6);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
{
damage = (uint)(damage * 0.6);
}
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (sector.isinfan(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region dragon punch
case 12240:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
inlinealgorithm ila = new inlinealgorithm(attacker.x, x, attacker.y, y, (byte)spell.range, inlinealgorithm.algorithm.dda);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spellid;
suse.spelllevel = attacker.owner.spells[spellid].level;
suse.x = x;
suse.y = y;
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null) continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (ila.inline(attacked.x, attacked.y))
{
if (!canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee)) continue;
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region dragonfury
case 12300:
{
if (attacked != null)
{
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.distance)
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attacked, ref attack, spell);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
attacker.owner.player.iseagleeyeshooted = true;
if (attacked.playerflag == playerflag.player)
attacked.owner.sendscreen(suse, true);
else attacked.monsterinfo.sendscreen(suse);
if (attacked.playerflag == playerflag.player)
{
int potdifference = attacker.battlepower - attacked.battlepower;
int rate = spell.percent + potdifference - 20;
if (kernel.rate(rate))
{
attacked.addflag3((ulong)msgupdate.flags3.dragonfury);
attacked.dragonfurystamp = time32.now;
attacked.dragonfurytime = spell.duration;
msgupdate upgrade = new msgupdate(true);
upgrade.uid = attacked.uid;
upgrade.append((byte)msgupdate.datatype.dragonfury, (uint)spell.status, (uint)spell.duration, spell.power, spell.level);
attacker.owner.send(upgrade.toarray());
if (attacked.playerflag == playerflag.player)
attacked.owner.send(upgrade);
else attacked.monsterinfo.sendscreen(upgrade);
}
}
}
}
}
}
break;
}
#endregion
#region dragonswing
case 12200:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.attacker = attacker.uid;
msgmagiceffect.spellid = spell.id;
msgmagiceffect.spelllevel = spell.level;
msgmagiceffect.x = x;
msgmagiceffect.y = y;
attacker.owner.sendscreen(msgmagiceffect, true);
if (!attacker.containsflag3((ulong)msgupdate.flags3.dragonswing))
{
attacker.addflag3((ulong)msgupdate.flags3.dragonswing);
msgupdate upgrade = new msgupdate(true);
upgrade.uid = attacker.uid;
upgrade.append((byte)msgupdate.datatype.dragonswing, 1, 1000000, 0, 0);
attacker.owner.send(upgrade.toarray());
}
}
break;
}
#endregion
#endregion
#region new tao
#region auroralotus
case 12370:
{
if (canusespell(spell, attacker.owner))
{
if (!attacker.containsflag3((ulong)msgupdate.flags3.auroralotus)) return;
var map = attacker.owner.map;
if (!map.floor[x, y, mapobjecttype.item, null]) return;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.addtarget(attacker.uid, 0, null);
attacker.owner.sendscreen(suse, true);
msgmapitem flooritem = new msgmapitem(true);
flooritem.itemid = msgmapitem.auroralotus;
flooritem.mapid = attacker.mapid;
flooritem.type = msgmapitem.effect;
flooritem.x = x;
flooritem.y = y;
flooritem.onfloor = time32.now;
flooritem.owner = attacker.owner;
flooritem.uid = msgmapitem.flooruid.next;
while (map.flooritems.containskey(flooritem.uid))
flooritem.uid = msgmapitem.flooruid.next;
flooritem.maxlife = 25;
flooritem.life = 25;
flooritem.mcolor = 13;
flooritem.owneruid = attacker.uid;
flooritem.ownerguilduid = attacker.guildid;
flooritem.flowertype = 0;
flooritem.time = kernel.tqtimer(datetime.now.addseconds(7));
flooritem.name = "auroralotus";
map.addflooritem(flooritem);
attacker.owner.sendscreenspawn(flooritem, true);
attacker.auroralotusenergy = 0;
attacker.lotus(attacker.auroralotusenergy, (byte)msgupdate.datatype.auroralotus);
attacker.attackpacket = null;
}
break;
}
#endregion
#region flamelotus
case 12380:
{
if (canusespell(spell, attacker.owner))
{
if (!attacker.containsflag3((ulong)msgupdate.flags3.flamelotus)) return;
var map = attacker.owner.map;
if (!map.floor[x, y, mapobjecttype.item, null]) return;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.addtarget(attacker.uid, 0, null);
attacker.owner.sendscreen(suse, true);
msgmapitem flooritem = new msgmapitem(true);
flooritem.itemid = msgmapitem.flamelotus;
flooritem.mapid = attacker.mapid;
flooritem.type = msgmapitem.effect;
flooritem.x = x;
flooritem.y = y;
flooritem.onfloor = time32.now;
flooritem.owner = attacker.owner;
flooritem.uid = msgmapitem.flooruid.next;
while (map.flooritems.containskey(flooritem.uid))
flooritem.uid = msgmapitem.flooruid.next;
flooritem.maxlife = 25;
flooritem.life = 25;
flooritem.mcolor = 13;
flooritem.owneruid = attacker.uid;
flooritem.ownerguilduid = attacker.guildid;
flooritem.flowertype = 0;
flooritem.time = kernel.tqtimer(datetime.now.addseconds(7));
flooritem.name = "flamelotus";
map.addflooritem(flooritem);
attacker.owner.sendscreenspawn(flooritem, true);
attacker.flamelotusenergy = 0;
attacker.lotus(attacker.flamelotusenergy, (byte)msgupdate.datatype.flamelotus);
attacker.attackpacket = null;
}
break;
}
#endregion
#endregion
#region new monk
#region upsweep
case 12580://up
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attacked == null)
return;
var angle = kernel.getangle(attacker.x, attacker.y, attacked.x, attacked.y);
map.updatecoordonatesforangle(ref x, ref y, angle);
fan sector = new fan(attacker.x, attacker.y, x, y, spell.range, spell.sector);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
if (kernel.getdistance(attacker.x, attacker.y, _obj.x, _obj.y) <= 7)
{
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (sector.isinfan(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.5);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (sector.isinfan(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region downsweep
case 12590://down
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (attacked == null)
return;
var angle = kernel.getangle(attacker.x, attacker.y, attacked.x, attacked.y);
angle = enums.oppositeangle(angle);
map.updatecoordonatesforangle(ref x, ref y, angle);
fan sector = new fan(attacker.x, attacker.y, x, y, spell.range, spell.sector);
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
if (kernel.getdistance(attacker.x, attacker.y, _obj.x, _obj.y) <= 7)
{
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (sector.isinfan(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.5);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (sector.isinfan(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region strike
case 12600:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= attacker.attackrange + 1)
{
if (attackedsob != null)
{
if (canattack(attacker, attackedsob, spell))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
else
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.5);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
attacker.attackpacket = null;
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
attacker.attackpacket = null;
break;
}
#endregion
#region wrathofemperor
case 12570:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.specialeffect = 1;
suse.x = x;
suse.y = y;
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.range)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (kernel.getdistance(attacker.x, attacker.y, attacked.x, attacked.y) <= spell.range)
{
if (attacked.containsflag((ulong)msgupdate.flags.fly))
return;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (kernel.getdistance(attacker.x, attacker.y, attackedsob.x, attackedsob.y) <= spell.range)
{
if (canattack(attacker, attackedsob, spell))
{
preparespell(spell, attacker.owner);
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region graceofheaven
case 12560:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
spellid = 10425;
suse.spellid = spellid;
suse.spelllevel = attacker.owner.spells[spellid].level;
suse.x = x;
suse.y = y;
attacker.attackpacket = null;
if (attacker.owner.team != null)
{
foreach (client.gamestate teammate in attacker.owner.team.teammates)
{
// if (kernel.getdistance(attacker.x, attacker.y, teammate.player.x, teammate.player.y) <= spell.range)
{
if (teammate.player.containsflag2((ulong)msgupdate.flags2.soulshackle))
{
teammate.player.removeflag2((ulong)msgupdate.flags2.soulshackle);
suse.addtarget(teammate.player.uid, 0, attack);
msgupdate upgrade = new msgupdate(true);
upgrade.uid = teammate.player.uid;
upgrade.append((byte)msgupdate.datatype.soulshackle
, 111
, 0, 0, spell.level);
if (teammate.player.playerflag == playerflag.player)
teammate.player.owner.send(upgrade.toarray());
}
}
}
attacker.owner.sendscreen(suse, true);
}
{
suse.addtarget(attacked.uid, 0, attack);
attacked.toxicfogleft = 0;
attacked.removeflag2((ulong)msgupdate.flags2.soulshackle);
msgupdate upgrade = new msgupdate(true);
upgrade.uid = attacked.uid;
upgrade.append((byte)msgupdate.datatype.soulshackle
, 111
, 0, 0, spell.level);
if (attacked.playerflag == playerflag.player)
attacked.owner.send(upgrade.toarray());
attacked.toxicfogleft = 0;
attacked.scurbybomb = 0;
attacked.nodrugstime = 0;
attacked.dragonfurytime = 0;
attacked.flamelayerleft = 0;
//attacked.owner.send(new gamecharacterupdates(true) { uid = attacked.uid, }
// .remove(gamecharacterupdates.soulshacle));
attacked.nodrugstime = 0;
if (attacked.playerflag == playerflag.player)
attacked.owner.sendscreen(suse, true);
else
attacker.owner.sendscreen(suse, true);
}
}
break;
}
#endregion
#region infroecho
case 12550:
{
if (canusespell(spell, attacker.owner))
{
if (!attacker.epicmonk())
return;
var map = attacker.owner.map;
if (!map.floor[x, y, mapobjecttype.item, null]) return;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.attacker1 = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.specialeffect = 0;
suse.addtarget(attacker.uid, 0, null);
attacker.owner.sendscreen(suse, true);
var count = 3;
if (spell.level == 6)
count = 4;
list<system.drawing.point> destructionareas = new list<system.drawing.point>();
for (int i = 0; i < 360; i += spell.sector)
{
if (destructionareas.count >= count)
break;
// var dist = kernel.random.next(4);
var dist = kernel.random.next(spell.range, spell.distance);
// var angle = kernel.random.next(90);
var angle = i;
ushort x = (ushort)(x + (dist * math.cos(angle)));
ushort y = (ushort)(y + (dist * math.sin(angle)));
system.drawing.point p = new system.drawing.point((int)x, (int)y);
if (!destructionareas.contains(p))
destructionareas.add(p);
else
i--;
}
foreach (var area in destructionareas)
{
x = (ushort)area.x;
y = (ushort)area.y;
msgmapitem flooritem = new msgmapitem(true);
flooritem.itemid = msgmapitem.infroecho;// (uint)(1390 + spell.level);
flooritem.mapid = attacker.mapid;
flooritem.mcolor = 14;
flooritem.itemcolor = (enums.color.black);
flooritem.type = msgmapitem.effect;
flooritem.owneruid = attacker.uid;
flooritem.ownerguilduid = attacker.guildid;
flooritem.flowertype = 1;
flooritem.x = x;
flooritem.y = y;
flooritem.onfloor = time32.now;
flooritem.owner = attacker.owner;
flooritem.name = "trap";
while (map.flooritems.containskey(flooritem.uid))
flooritem.uid = mr.hamooo.network.gamepackets.msgmapitem.flooruid.next;
map.addflooritem(flooritem);
attacker.owner.sendscreenspawn(flooritem, true);
}
}
break;
}
#endregion
#endregion
//ahmed nemo 01128547851
#region epicwarrior
#region maniacdance
case 12700:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
attacker.addflag3((ulong)1ul << 53);
attacker.maniacdance = time32.now;
attacker.removeflag((ulong)msgupdate.flags.ride);
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region waveofblood
case 12690:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
fan sector = new fan(attacker.x, attacker.y, x, y, spell.range, spell.sector);
if (kernel.getdistance(attacker.x, attacker.y, x, y) <= spell.distance + 1)
{
foreach (interfaces.imapobject _obj in attacker.owner.screen.objects)
{
if (_obj == null)
continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (sector.isinfan(attacked.x, attacked.y))
{
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
attack.effect = msginteract.interacteffects.none;
uint damage = game.attacking.calculate.melee(attacker, attacked, ref attack, spell);
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
{
damage = (uint)(damage * 0.4);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
{
damage = (uint)(damage * 0.4);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
{
damage = (uint)(damage * 0.4);
}
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
{
damage = (uint)(damage * 0.4);
}
suse.effect = attack.effect;
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (sector.isinfan(attackedsob.x, attackedsob.y))
{
if (canattack(attacker, attackedsob, spell))
{
attack.effect = msginteract.interacteffects.none;
uint damage = calculate.melee(attacker, attackedsob, ref attack);
damage = (uint)(damage * 0.9);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
attacker.owner.sendscreen(suse, true);
}
break;
}
#endregion
#region pounce
case 12770:
{
if (canusespell(spell, attacker.owner))
{
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
//suse.spelllevelhu = client_spell.levelhu2;
suse.spelllevel = spell.level;
ushort _x = attacker.x, _y = attacker.y;
ushort _tx = x, _ty = y;
uint16 ox, oy;
ox = attacker.x;
oy = attacker.y;
byte dist = (byte)spell.distance;
var array = attacker.owner.screen.objects;
inlinealgorithm algo = new inlinealgorithm(attacker.x, x, attacker.y, y, dist,
inlinealgorithm.algorithm.dda);
x = attacker.x;
y = attacker.y;
int i = 0;
for (i = 0; i < algo.lcoords.count; i++)
{
if (attacker.owner.map.floor[algo.lcoords[i].x, algo.lcoords[i].y, mapobjecttype.player]
&& !attacker.throughgate(algo.lcoords[i].x, algo.lcoords[i].y))
{
x = (ushort)algo.lcoords[i].x;
y = (ushort)algo.lcoords[i].y;
}
else
{
break;
}
}
suse.x = x;
suse.y = y;
if (!attacker.owner.map.floor[x, y, mapobjecttype.player, null])
return;
double disth = 1.5;
//if (attacker.mapid == deathmatch.mapid) disth = 1;
foreach (interfaces.imapobject _obj in array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (kernel.getddistance(_obj.x, _obj.y, (ushort)algo.lcoords[j].x, (ushort)algo.lcoords[j].y) <= disth)
hit = true;
if (hit)
{
if (_obj.mapobjtype == mapobjecttype.monster)
{
attacked = _obj as player;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
var damage = game.attacking.calculate.melee(attacker, attacked, ref attack, spell);
damage = (uint)(damage * 1.1);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.player)
{
attacked = _obj as player;
if (canattack(attacker, attacked, spell, attack.interacttype == msginteract.melee))
{
var damage = game.attacking.calculate.melee(attacker, attacked, ref attack);
damage = (uint)(damage * 1.0);
receiveattack(attacker, attacked, attack, ref damage, spell);
suse.addtarget(attacked.uid, damage, attack);
}
}
else if (_obj.mapobjtype == mapobjecttype.sobnpc)
{
attackedsob = _obj as msgnpcinfoex;
if (canattack(attacker, attackedsob, spell))
{
var damage = game.attacking.calculate.melee(attacker, attackedsob, ref attack);
receiveattack(attacker, attackedsob, attack, damage, spell);
suse.addtarget(attackedsob.uid, damage, attack);
}
}
}
}
attacker.px = attacker.x;
attacker.py = attacker.y;
attacker.x = x;
attacker.y = y;
attacker.owner.sendscreen(suse, true);
attacker.owner.screen.reload(suse);
}
break;
}
#endregion
#region backfire
case 12680:
{
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.attacker = attacker.uid;
msgmagiceffect.attacker1 = attacker.uid;
msgmagiceffect.spellid = spell.id;
msgmagiceffect.spelllevel = spell.level;
msgmagiceffect.x = x;
msgmagiceffect.y = y;
msgmagiceffect.addtarget(attacker.uid, 1, attack);
attacker.owner.sendscreen(msgmagiceffect, true);
if (attacker.containsflag3((ulong)1ul << 51))
attacker.removeflag3((ulong)1ul << 51);
else
attacker.addflag3((ulong)1ul << 51);
attacker.backfirestamp = time32.now;
break;
}
#endregion
#endregion
default:
{
if (attacker.owner.account.state == accounttable.accountstate.administrator)
attacker.owner.send("unknown spell id: " + spellid);
break;
}
}
attacker.owner.increasespellexperience(experience, spellid);
if (attacker.mapid == 1039)
{
if (spell.id == 7001 || spell.id == 9876)
{
attacker.attackpacket = null;
return;
}
if (attacker.attackpacket != null)
{
attack.damage = spell.id;
attacker.attackpacket = attack;
var xspell = getweaponspell(spell);
if (xspell != null)
{
if (attacker.attackpacket == null)
{
attack.interacttype = msginteract.melee;
attacker.attackpacket = attack;
}
else
{
attacker.attackpacket.interacttype = msginteract.melee;
}
}
}
}
else
{
if (spell.nextspellid != 0)
{
if (spell.nextspellid >= 1000 && spell.nextspellid <= 1002)
if (target >= 1000000)
{
attacker.attackpacket = null;
return;
}
attack.damage = spell.nextspellid;
attacker.attackpacket = attack;
}
else
{
var xspell = getweaponspell(spell);
if (xspell == null || spell.id == 9876)
attacker.attackpacket = null;
else
{
if (attacker.attackpacket == null)
{
attack.interacttype = msginteract.melee;
attacker.attackpacket = attack;
}
else
{
attacker.attackpacket.interacttype = msginteract.melee;
}
}
}
}
}
else
{
attacker.attackpacket = null;
}
}
#endregion
}
#endregion
}
#endregion
}
public static bool isarcherskill(uint id)
{
if (id >= 8000 && id <= 9875)
return true;
return false;
}
public static void quitsteedrace(player attacker)
{
attacker.owner.messagebox("do you want to quit the steed race?", (pclient) =>
{
pclient.player.teleport(1002, 301, 279);
pclient.player.removeflag((ulong)msgupdate.flags.ride);
});
}
public handle(msginteract attack, player attacker, player attacked)
{
this.attack = attack;
this.attacker = attacker;
this.attacked = attacked;
this.execute();
}
public static list<ushort> getweaponspell(spellinformation spell)
{
return spelltable.weaponspells.values.where(p => p.contains(spell.id)).firstordefault();
}
public static void flamelotus(msgmapitem item, int count = 0)
{
var client = item.owner;
if (!client.spells.containskey(12380)) return;
var spell = spelltable.getspell(client.spells[12380].id, client.spells[12380].level);
if (count == 0)
{
switch (spell.level)
{
case 0: Count = 5; break;
case 1: Count = 8; break;
case 2: Count = 11; break;
case 3: Count = 14; break;
case 4: Count = 17; break;
case 5: Count = 20; break;
case 6: Count = 25; break;
}
}
var targets = playerinrange(item, spell.range).toarray();
targets = targets.where(p => canattack(client.player, p.player, null, true)).toarray();
targets = targets.take(count).toarray();
var attack = new msginteract(true);
attack.attacker = item.owner.player.uid;
attack.interacttype = msginteract.melee;
foreach (var target in targets)
{
uint damage = calculate.magic(client.player, target.player, spell, ref attack);
if (client.spells.containskey(1002))
{
var spell2 = spelltable.getspell(client.spells[1002].id, client.spells[1002].level);
damage = game.attacking.calculate.magic(client.player, target.player, spell2, ref attack);
}
attack.damage = damage;
attack.attacked = target.player.uid;
attack.x = target.player.x;
attack.y = target.player.y;
receiveattack(client.player, target.player, attack, ref damage, spell);
client.player.attackpacket = null;
}
}
public static void auroralotus(msgmapitem item, int count = 0)
{
var client = item.owner;
if (!client.spells.containskey(12370)) return;
var spell = spelltable.getspell(client.spells[12370].id, client.spells[12370].level);
if (count == 0)
{
switch (spell.level)
{
case 0: Count = 5; break;
case 1: Count = 8; break;
case 2: Count = 11; break;
case 3: Count = 14; break;
case 4: Count = 17; break;
case 5: Count = 20; break;
case 6: Count = 25; break;
}
}
var deads = playerinrange(item, spell.range).where(p => p.player.dead).toarray();
if (client.team != null)
deads = deads.where(p => client.team.contain(p.player.uid)).toarray();
else if (client.guild != null)
if (client.guild.members != null && client.guild.ally != null)
deads = deads.where(p => client.guild.members.containskey(p.player.uid) || client.guild.ally.containskey(p.player.guildid)).toarray();
else
deads = deads.where(p => client.guild.id == p.player.guildid).toarray();
deads = deads.take(count).toarray();
if (deads != null)
{
foreach (var player in deads)
{
player.player.action = enums.conqueraction.none;
player.revivestamp = time32.now;
player.attackable = false;
player.player.transformationid = 0;
player.player.removeflag((ulong)msgupdate.flags.dead);
player.player.removeflag((ulong)msgupdate.flags.ghost);
player.player.hitpoints = player.player.maxhitpoints;
player.player.ressurect();
player.blesstouch(client);
}
}
}
public static void infroecho(msgmapitem item, int count = 0)
{
var client = item.owner;
var x = item.x;
var y = item.y;
if (!client.spells.containskey(12550))
return;
var spell = spelltable.getspell(client.spells[12550].id, client.spells[12550].level);
var attack = new msginteract(true);
attack.attacker = client.player.uid;
attack.x = x;
attack.y = y;
attack.damage = spell.id;
attack.interacttype = msginteract.magic;
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = client.player.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = x;
suse.y = y;
suse.specialeffect = 1;
foreach (var c in client.screen.objects)
{
interfaces.imapobject _obj = c as player;
if (_obj == null)
continue;
if (_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
{
var attacked = _obj as player;
if (kernel.getdistance(x, y, attacked.x, attacked.y) <= spell.range)
{
if (canattack(client.player, attacked, spell, attack.interacttype == msginteract.ranged))
{
uint damage = game.attacking.calculate.melee(client.player, attacked, ref attack);
damage = (uint)(damage * 0.2);
suse.effect = attack.effect;
receiveattack(client.player, attacked, attack, ref damage, spell);
attacked.stunned = true;
attacked.stunstamp = time32.now;
suse.addtarget(attacked.uid, damage, attack);
}
}
}
}
client.player.attackpacket = null;
client.sendscreen(suse, true);
}
public static void handleauramonk(player attacker, spellinformation spell)
{
ulong statusflag = 0, statusflag2 = 0;
enums.auratype aura = enums.auratype.tyrantaura;
switch (spell.id)
{
case 10424: Statusflag = (ulong)msgupdate.flags2.earthaura; break;
case 10423: Statusflag = (ulong)msgupdate.flags2.fireaura; break;
case 10422: Statusflag = (ulong)msgupdate.flags2.wateraura; break;
case 10421: Statusflag = (ulong)msgupdate.flags2.woodaura; break;
case 10420: Statusflag = (ulong)msgupdate.flags2.metalaura; break;
case 10410: Statusflag = (ulong)msgupdate.flags2.fendaura; break;
case 10395: Statusflag = (ulong)msgupdate.flags2.tyrantaura; break;
}
switch (spell.id)
{
case 10424: Statusflag2 = (ulong)msgupdate.flags2.earthauraicon; break;
case 10423: Statusflag2 = (ulong)msgupdate.flags2.fireauraicon; break;
case 10422: Statusflag2 = (ulong)msgupdate.flags2.waterauraicon; break;
case 10421: Statusflag2 = (ulong)msgupdate.flags2.woodauraicon; break;
case 10420: Statusflag2 = (ulong)msgupdate.flags2.metalauraicon; break;
case 10410: Statusflag2 = (ulong)msgupdate.flags2.fendauraicon; break;
case 10395: Statusflag2 = (ulong)msgupdate.flags2.tyrantauraicon; break;
}
if (attacker.dead) return;
if (attacker.aura_isactive)
{
switch (attacker.aura_acttype)
{
case 10424: Aura = enums.auratype.earthaura; break;
case 10423: Aura = enums.auratype.fireaura; break;
case 10422: Aura = enums.auratype.wateraura; break;
case 10421: Aura = enums.auratype.woodaura; break;
case 10420: Aura = enums.auratype.metalaura; break;
case 10410: Aura = enums.auratype.fendaura; break;
case 10395: Aura = enums.auratype.tyrantaura; break;
}
new msgupdate(true).aura(attacker, enums.auradatatypes.remove, aura, spell);
attacker.removeflag2(attacker.aura_acttype);
attacker.removeflag2(attacker.aura_acttype2);
attacker.owner.removeaurabonuses(attacker.aura_acttype, attacker.aura_actpower, 1);
attacker.aura_isactive = false;
if (statusflag == attacker.aura_acttype)
{
attacker.aura_acttype = 0;
attacker.aura_acttype2 = 0;
attacker.aura_actpower = 0;
attacker.aura_actlevel = 0;
return;
}
}
if (canusespell(spell, attacker.owner))
{
if (statusflag != 0)
{
switch (attacker.aura_acttype)
{
case 10424: Aura = enums.auratype.earthaura; break;
case 10423: Aura = enums.auratype.fireaura; break;
case 10422: Aura = enums.auratype.wateraura; break;
case 10421: Aura = enums.auratype.woodaura; break;
case 10420: Aura = enums.auratype.metalaura; break;
case 10410: Aura = enums.auratype.fendaura; break;
case 10395: Aura = enums.auratype.tyrantaura; break;
}
new msgupdate(true).aura(attacker, enums.auradatatypes.remove, aura, spell);
attacker.removeflag2(attacker.aura_acttype);
attacker.removeflag2(attacker.aura_acttype2);
attacker.owner.removeaurabonuses(attacker.aura_acttype, attacker.aura_actpower, 1);
attacker.aura_isactive = false;
if (statusflag == attacker.aura_acttype)
{
attacker.aura_acttype2 = 0;
attacker.aura_acttype = 0;
attacker.aura_actpower = 0;
attacker.aura_actlevel = 0;
}
}
if (spell.power == 0)
spell.power = 45;
preparespell(spell, attacker.owner);
msgmagiceffect suse = new msgmagiceffect(true);
suse.attacker = attacker.uid;
suse.spellid = spell.id;
suse.spelllevel = spell.level;
suse.x = attacker.x;
suse.y = attacker.y;
suse.addtarget(attacker.uid, 0, null);
attacker.owner.sendscreen(suse, true);
attacker.addflag2(statusflag);
attacker.addflag2(statusflag2);
attacker.aura_isactive = true;
attacker.aura_acttype = statusflag;
attacker.aura_acttype2 = statusflag2;
attacker.aura_actpower = spell.power;
attacker.aura_actlevel = spell.level;
attacker.owner.doaurabonuses(statusflag, spell.power, 1);
switch (spell.id)
{
case 10424: Aura = enums.auratype.earthaura; break;
case 10423: Aura = enums.auratype.fireaura; break;
case 10422: Aura = enums.auratype.wateraura; break;
case 10421: Aura = enums.auratype.woodaura; break;
case 10420: Aura = enums.auratype.metalaura; break;
case 10410: Aura = enums.auratype.fendaura; break;
case 10395: Aura = enums.auratype.tyrantaura; break;
}
new msgupdate(true).aura(attacker, enums.auradatatypes.add, aura, spell);
}
}
public static void lotusattack(msgmapitem item, player attacker, msginteract attack)
{
//console.writeline("for test");
}
public static list<imapobject> getobjects(uint16 ox, uint16 oy, client.gamestate c)
{
uint16 x, y;
x = c.player.x;
y = c.player.y;
var list = new list<imapobject>();
c.player.x = ox;
c.player.y = oy;
foreach (imapobject objects in c.screen.objects)
{
if (objects != null)
if (objects.uid != c.player.uid)
if (!list.contains(objects))
list.add(objects);
}
c.player.x = x;
c.player.y = y;
foreach (imapobject objects in c.screen.objects)
{
if (objects != null)
if (objects.uid != c.player.uid)
if (!list.contains(objects))
list.add(objects);
}
if (list.count > 0)
return list;
return null;
}
public static ienumerable<client.gamestate> playerinrange(player attacker, player attacked)
{
var dictionary = kernel.gamepool.values.toarray();
return dictionary.where((player) => player.player.mapid == attacked.mapid && kernel.getdistance(player.player.x, player.player.y, attacker.x, attacker.y) <= 7);
}
public static ienumerable<client.gamestate> playerinrange(msgmapitem item, int dist)
{
var dictionary = kernel.gamepool.values.toarray();
return dictionary.where((player) => player.player.mapid == item.mapid && kernel.getdistance(player.player.x, player.player.y, item.x, item.y) <= dist).orderby(player => kernel.getdistance(player.player.x, player.player.y, item.x, item.y));
}
public player findclosesttarget(player attacker, ushort x, ushort y, ienumerable<interfaces.imapobject> array)
{
player closest = attacker;
int dprev = 10000, dist = 0;
foreach (var _obj in array)
{
if (_obj == null) continue;
if (_obj.mapobjtype != mapobjecttype.player && _obj.mapobjtype != mapobjecttype.monster) continue;
dist = kernel.getdistance(x, y, _obj.x, _obj.y);
if (dist < dprev)
{
dprev = dist;
closest = (player)_obj;
}
}
return closest;
}
public static bool canusespell(spellinformation spell, client.gamestate client)
{
if (client.player.skillteamwatchingelitepkmatch != null) return false;
if (client.watchingelitepkmatch != null) return false;
if (client.watchinggroup != null) return false;
if (client.teamwatchinggroup != null) return false;
if (spell == null) return false;
if (client.player.mana < spell.usemana) return false;
if (client.player.stamina < spell.usestamina) return false;
if (client.player.mapid == 1707)
{
if (spell.id != 1045 && spell.id != 1046)
{
client.send("you can't use any skills here except fb and ss!"); return false;
}
}
if (spell.usearrows > 0 && isarcherskill(spell.id))
{
var weapons = client.weapons;
if (weapons.item2 != null)
if (!client.player.containsflag3((ulong)msgupdate.flags3.pathofshadow))
if (!itemhandler.isarrow(weapons.item2.id)) return false;
return true;
}
if (spell.needxp == 1 && !client.player.containsflag((ulong)msgupdate.flags.xplist)) return false;
return true;
}
public static void preparespell(spellinformation spell, client.gamestate client)
{
if (spell.needxp == 1)
client.player.removeflag((ulong)msgupdate.flags.xplist);
if (client.map.id != 1039)
{
if (spell.usemana > 0)
if (client.player.mana >= spell.usemana)
client.player.mana -= spell.usemana;
if (spell.usestamina > 0)
if (client.player.stamina >= spell.usestamina)
client.player.stamina -= spell.usestamina;
}
}
public static void checkforextraweaponpowers(client.gamestate client, player attacked)
{
#region right hand
var weapons = client.weapons;
if (weapons.item1 != null)
{
if (weapons.item1.id != 0)
{
var item = weapons.item1;
if (item.effect != enums.itemeffect.none)
{
if (kernel.rate(30))
{
switch (item.effect)
{
case enums.itemeffect.hp:
{
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.attacker = 1;
msgmagiceffect.spellid = 1175;
msgmagiceffect.spelllevel = 4;
msgmagiceffect.x = client.player.x;
msgmagiceffect.y = client.player.y;
msgmagiceffect.addtarget(client.player.uid, 300, null);
uint damage = math.min(300, client.player.maxhitpoints - client.player.hitpoints);
client.player.hitpoints += damage;
client.sendscreen(msgmagiceffect, true);
break;
}
case enums.itemeffect.mp:
{
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.attacker = 1;
msgmagiceffect.spellid = 1175;
msgmagiceffect.spelllevel = 2;
msgmagiceffect.x = client.player.x;
msgmagiceffect.y = client.player.y;
msgmagiceffect.addtarget(client.player.uid, 300, null);
ushort damage = (ushort)math.min(300, client.player.maxmana - client.player.mana);
client.player.mana += damage;
client.sendscreen(msgmagiceffect, true);
break;
}
case enums.itemeffect.shield:
{
if (client.player.containsflag((ulong)msgupdate.flags.magicshield)) return;
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.attacker = 1;
msgmagiceffect.spellid = 1020;
msgmagiceffect.spelllevel = 0;
msgmagiceffect.x = client.player.x;
msgmagiceffect.y = client.player.y;
msgmagiceffect.addtarget(client.player.uid, 120, null);
client.player.shieldtime = 0;
client.player.shieldstamp = time32.now;
client.player.magicshieldstamp = time32.now;
client.player.magicshieldtime = 0;
client.player.addflag((ulong)msgupdate.flags.magicshield);
client.player.magicshieldstamp = time32.now;
client.player.magicshieldincrease = 2;
client.player.magicshieldtime = 120;
if (client.player.playerflag == playerflag.player)
client.send(constants.shield(2, 120));
client.sendscreen(msgmagiceffect, true);
break;
}
case enums.itemeffect.poison:
{
if (attacked != null)
{
if (constants.pkforbiddenmaps.contains(client.player.mapid)) return;
if (client.map.baseid == 700) return;
if (attacked.uid == client.player.uid) return;
if (attacked.toxicfogleft > 0) return;
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.spellid = 5040;
msgmagiceffect.attacker = attacked.uid;
msgmagiceffect.spelllevel = 9;
msgmagiceffect.x = attacked.x;
msgmagiceffect.y = attacked.y;
msgmagiceffect.addtarget(attacked.uid, 0, null);
msgmagiceffect.targets[attacked.uid].hit = true;
attacked.toxicfogstamp = time32.now;
attacked.toxicfogleft = 10;
attacked.toxicfogpercent = 0.05f;
client.sendscreen(msgmagiceffect, true);
}
break;
}
}
}
}
}
}
#endregion
#region left hand
if (weapons.item2 != null)
{
if (weapons.item2.id != 0)
{
var item = weapons.item2;
if (item.effect != enums.itemeffect.none)
{
if (kernel.rate(30))
{
switch (item.effect)
{
case enums.itemeffect.hp:
{
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.attacker = 1;
msgmagiceffect.spellid = 1175;
msgmagiceffect.spelllevel = 4;
msgmagiceffect.x = client.player.x;
msgmagiceffect.y = client.player.y;
msgmagiceffect.addtarget(client.player.uid, 300, null);
uint damage = math.min(300, client.player.maxhitpoints - client.player.hitpoints);
client.player.hitpoints += damage;
client.sendscreen(msgmagiceffect, true);
break;
}
case enums.itemeffect.mp:
{
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.attacker = 1;
msgmagiceffect.spellid = 1175;
msgmagiceffect.spelllevel = 2;
msgmagiceffect.x = client.player.x;
msgmagiceffect.y = client.player.y;
msgmagiceffect.addtarget(client.player.uid, 300, null);
ushort damage = (ushort)math.min(300, client.player.maxmana - client.player.mana);
client.player.mana += damage;
client.sendscreen(msgmagiceffect, true);
break;
}
case enums.itemeffect.shield:
{
if (client.player.containsflag((ulong)msgupdate.flags.magicshield))
return;
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.attacker = 1;
msgmagiceffect.spellid = 1020;
msgmagiceffect.spelllevel = 0;
msgmagiceffect.x = client.player.x;
msgmagiceffect.y = client.player.y;
msgmagiceffect.addtarget(client.player.uid, 120, null);
client.player.shieldtime = 0;
client.player.shieldstamp = time32.now;
client.player.magicshieldstamp = time32.now;
client.player.magicshieldtime = 0;
client.player.addflag((ulong)msgupdate.flags.magicshield);
client.player.magicshieldstamp = time32.now;
client.player.magicshieldincrease = 2;
client.player.magicshieldtime = 120;
if (client.player.playerflag == playerflag.player)
client.send(constants.shield(2, 120));
client.sendscreen(msgmagiceffect, true);
break;
}
case enums.itemeffect.poison:
{
if (attacked != null)
{
if (attacked.uid == client.player.uid) return;
if (constants.pkforbiddenmaps.contains(client.player.mapid)) return;
if (client.map.baseid == 700) return;
if (attacked.toxicfogleft > 0) return;
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
msgmagiceffect.spellid = 5040;
msgmagiceffect.attacker = attacked.uid;
msgmagiceffect.spelllevel = 9;
msgmagiceffect.x = attacked.x;
msgmagiceffect.y = attacked.y;
msgmagiceffect.addtarget(attacked.uid, 0, null);
msgmagiceffect.targets[attacked.uid].hit = true;
attacked.toxicfogstamp = time32.now;
attacked.toxicfogleft = 10;
attacked.toxicfogpercent = 0.05f;
client.sendscreen(msgmagiceffect, true);
}
break;
}
}
}
}
}
}
#endregion
}
public static bool canattack(player attacker, msgnpcinfoex attacked, spellinformation spell)
{
if (attacker.mapid == 2292)
{
if (((attacker.guildid == 0) || !polapk.iswar) && (attacked.uid == 1235))
{
return false;
}
if (polapk.polekeeper != null)
{
if (polapk.polekeeper == attacker.owner.guild)
{
if (attacked.uid == 1235)
{
return false;
}
}
else if ((((attacked.uid == 0x7dfeb) || (attacked.uid == 0x7dfea)) && (polapk.polekeeper == attacker.owner.guild)) && (attacker.pkmode == enums.pkmode.team))
{
return false;
}
}
}
if (attacker.mapid == 2291)
{
if (((attacker.guildid == 0) || !polapk2.iswar) && (attacked.uid == 1325))
{
return false;
}
if (polapk2.polekeeper != null)
{
if (polapk2.polekeeper == attacker.owner.guild)
{
if (attacked.uid == 1325)
{
return false;
}
}
else if ((((attacked.uid == 0x7dfeb) || (attacked.uid == 0x7dfea)) && (polapk2.polekeeper == attacker.owner.guild)) && (attacker.pkmode == enums.pkmode.team))
{
return false;
}
}
}
if (attacker.mapid == 2293)
{
if (((attacker.guildid == 0) || !polapk3.iswar) && (attacked.uid == 817))
{
return false;
}
if (polapk3.polekeeper != null)
{
if (polapk3.polekeeper == attacker.owner.guild)
{
if (attacked.uid == 817)
{
return false;
}
}
else if ((((attacked.uid == 0x7dfeb) || (attacked.uid == 0x7dfea)) && (polapk3.polekeeper == attacker.owner.guild)) && (attacker.pkmode == enums.pkmode.team))
{
return false;
}
}
}
if (attacker.mapid == 2294)
{
if (((attacker.guildid == 0) || !polapk4.iswar) && (attacked.uid == 23120))
{
return false;
}
if (polapk4.polekeeper != null)
{
if (polapk4.polekeeper == attacker.owner.guild)
{
if (attacked.uid == 23120)
{
return false;
}
}
else if ((((attacked.uid == 0x7dfeb) || (attacked.uid == 0x7dfea)) && (polapk4.polekeeper == attacker.owner.guild)) && (attacker.pkmode == enums.pkmode.team))
{
return false;
}
}
}
#region guildpolewar
if (guildpolewar.iswar)
{
if (attacker.mapid == guildpolewar.map.id)
{
return guildpolewar.attack(0, attacker, attacked);
}
}
#endregion
#region classpolewar
//if (msgserver.game.classpolewar.iswar)
//{
// if (attacker.mapid == msgserver.game.classpolewar.map.id)
// {
// return msgserver.game.classpolewar.attack(0, attacker, attacked);
// }
//}
#endregion
#region clanwar
if (attacker.mapid == 1509)
{
if (attacker.clanid == 0 || !clanwar.iswar)
{
if (attacked.uid == 813)
{
return false;
}
}
if (clanwar.polekeeper != null)
{
if (clanwar.polekeeper == attacker.getclan)
{
if (attacked.uid == 813)
{
return false;
}
}
}
}
#endregion
#region eliteguildwar
if (attacker.mapid == 2071)
{
if (attacker.guildid == 0 || !eliteguildwar.iswar)
{
if (attacked.uid == 812)
{
return false;
}
}
if (eliteguildwar.polekeeper != null)
{
if (eliteguildwar.polekeeper == attacker.owner.guild)
{
if (attacked.uid == 812)
{
return false;
}
}
else if (attacked.uid == 516075 || attacked.uid == 516074)
{
if (eliteguildwar.polekeeper == attacker.owner.guild)
{
if (attacker.pkmode == enums.pkmode.team)
return false;
}
}
}
}
#endregion
#region statuewar
if (statueswar.iswar)
{
if (attacker.mapid == statueswar.map.id)
{
if (attacker.guildid == 0 || !statueswar.iswar)
if (attacked.uid == statueswar.pole.uid)
return false;
if (statueswar.polekeeper != null)
{
if (statueswar.polekeeper == attacker.owner.asmember)
if (attacked.uid == statueswar.pole.uid)
return false;
if (statueswar.polekeeper == attacker.owner.asmember)
if (attacker.pkmode == enums.pkmode.team)
return false;
}
}
}
#endregion
#region poleemulator
if (attacked.uid == 123456)
if (attacked.hitpoints > 0)
if (attacker.guildid != 0 && attacker.guildid != server.thread.poleemulator.killerguildid)
return true;
else return false;
else return false;
#endregion
#region guildwar
if (attacker.mapid == 1038)
{
if (attacker.guildid == 0 || !game.guildwar.iswar)
{
if (attacked.uid == 810) return false;
}
if (game.guildwar.polekeeper != null)
{
if (game.guildwar.polekeeper == attacker.owner.guild)
{
if (attacked.uid == 810) return false;
}
else if (attacked.uid == 516075 || attacked.uid == 516074)
{
if (game.guildwar.polekeeper == attacker.owner.guild)
{
if (attacker.pkmode == enums.pkmode.team) return false;
}
}
}
}
#endregion
#region superguildwar
if (attacker.mapid == 1234)
{
if (attacker.guildid == 0 || !game.superguildwar.iswar)
{
if (attacked.uid == 811) return false;
}
if (game.superguildwar.polekeeper != null)
{
if (game.superguildwar.polekeeper == attacker.owner.guild)
{
if (attacked.uid == 811) return false;
}
else if (attacked.uid == 516077 || attacked.uid == 516076)
{
if (game.superguildwar.polekeeper == attacker.owner.guild)
{
if (attacker.pkmode == enums.pkmode.team) return false;
}
}
}
}
#endregion
#region crow
if (attacker.mapid == 1039)
{
bool stake = true;
if (attacked.loweredname.contains("crow"))
stake = false;
ushort levelbase = (ushort)(attacked.mesh / 10);
if (stake)
levelbase -= 42;
else
levelbase -= 43;
byte level = (byte)(20 + (levelbase / 3) * 5);
if (levelbase == 108 || levelbase == 109)
level = 125;
if (attacker.level >= level)
return true;
else
{
attacker.attackpacket = null;
attacker.owner.send(constants.dummyleveltoohigh());
return false;
}
}
#endregion
#region can't attack npc
if (attacked.uid == 76112 || attacked.uid == 127123 || attacked.uid == 141198 || attacked.uid == 9683 || attacked.uid == 2015 || attacked.uid == 20140
|| attacked.uid == 9884 || attacked.uid == 9885 || attacked.uid == 9886 || attacked.uid == 9887
|| attacked.uid == 9994 || attacked.uid == 9995 || attacked.uid == 9996 || attacked.uid == 9997 || attacked.uid == 41162
|| attacked.uid == 180 || attacked.uid == 181 || attacked.uid == 182 || attacked.uid == 183 || attacked.uid == 801
|| attacked.uid == 184 || attacked.uid == 185 || attacked.uid == 7882 || attacked.uid == 1232 || attacked.uid == 16416 || attacked.uid == 16417
|| attacked.uid == 216341 || attacked.uid == 1231 || attacked.uid == 6567 || attacked.uid == 4132 || attacked.uid == 64132 || attacked.uid == 44821)
{
attacker.attackpacket = null;
return false;
}
#endregion
return true;
}
public static bool canattack(player attacker, player attacked, spellinformation spell, bool melee)
{
#region thundercloud
if (attacker.name == "thundercloud")
{
if (attacker.pkmode != game.enums.pkmode.pk &&
attacker.pkmode != game.enums.pkmode.team)
return false;
}
if (attacked.name == "thundercloud")
{
if (attacked.owneruid == attacker.uid) return false;
if (!constants.pkforbiddenmaps.contains(attacker.mapid))
{
if (attacker.pkmode != game.enums.pkmode.pk &&
attacker.pkmode != game.enums.pkmode.team)
return false;
else
{
attacker.addflag((ulong)network.gamepackets.msgupdate.flags.flashingname);
attacker.flashingnamestamp = time32.now;
attacker.flashingnametime = 20;
return true;
}
}
else return false;
}
#endregion
if (attacker.containsflag4((ulong)msgupdate.flags4.xchillingsnow))
return false;
#region kongfu
if (attacker.playerflag == playerflag.player && attacked.playerflag == playerflag.player)
{
if (attacker.pkmode == enums.pkmode.kongfu && attacker.kongfuactive == true && attacked.pkmode != enums.pkmode.kongfu && attacked.kongfuactive == false && !attacked.containsflag((ulong)msgupdate.flags.flashingname) && !attacked.containsflag((ulong)msgupdate.flags.blackname))
{
if (attacked.dead) return false;
attacker.owner.send(new msgtalk("you can only attack fighters of the jiang hu while in the jiang hu", msgtalk.topleft));
return false;
}
else if (attacker.pkmode == enums.pkmode.kongfu && attacker.kongfuactive == true)
{
if (attacked.pkmode == enums.pkmode.kongfu || attacked.kongfuactive == true || attacked.containsflag((ulong)msgupdate.flags.flashingname) || attacked.containsflag((ulong)msgupdate.flags.blackname))
{
if (attacked.dead) return false;
if (attacker.mapid == 1002 || attacker.mapid == 1000 || attacker.mapid == 1015 || attacker.mapid == 1020 || attacker.mapid == 1011 || attacker.mapid == 3055)
{
try
{
if (attacker.settings != msgownkongfupksetting.settings.none)
{
if ((attacker.settings & msgownkongfupksetting.settings.nothitfriends) == msgownkongfupksetting.settings.nothitfriends)
{
if (attacker.owner.friends.containskey(attacked.uid))
return false;
}
if ((attacker.settings & msgownkongfupksetting.settings.nohitalliesclan) == msgownkongfupksetting.settings.nohitalliesclan)
{
var attacker_clan = attacker.getclan;
if (attacker_clan != null)
{
if (attacker_clan.allies.containskey(attacked.clanid))
return false;
}
}
if ((attacker.settings & msgownkongfupksetting.settings.nothitalliedguild) == msgownkongfupksetting.settings.nothitalliedguild)
{
if (attacker.owner.guild != null)
{
if (attacker.owner.guild.ally.containskey(attacked.guildid))
return false;
}
}
if ((attacker.settings & msgownkongfupksetting.settings.nothitclanmembers) == msgownkongfupksetting.settings.nothitclanmembers)
{
if (attacker.clanid == attacked.clanid)
return false;
}
if ((attacker.settings & msgownkongfupksetting.settings.nothitguildmembers) == msgownkongfupksetting.settings.nothitguildmembers)
{
if (attacker.guildid == attacked.guildid)
return false;
}
}
}
catch (exception e)
{
console.writeline(e.tostring());
}
return true;
}
}
return false;
}
}
#endregion
#region factionwar
if (attacker.onpiratefaction == true && attacked.onninjafaction == true || attacker.onninjafaction == true && attacked.onpiratefaction == true)
{
if (attacked.dead) return false;
if (attacker.mapid == 1002 || attacker.mapid == 1000 || attacker.mapid == 1015 || attacker.mapid == 1020 || attacker.mapid == 1011 || attacker.mapid == 3055)
{
return true;
}
return false;
}
#endregion
if (attacker.mapid == 1507)
{
if (!attacker.allowtoattack)
return false;
}
if (attacked.playerflag == playerflag.monster)
{
if (attacked.companion)
{
if (attacked.owner == attacker.owner) return false;
}
}
if (attacker.timerinportchampion.addseconds(10) > datetime.now)
return false;
if (attacker.uid == attacked.uid)
return false;
if (attacker.pkmode == enums.pkmode.guild)
{
if (attacker.owner.guild.enemy.containskey(attacked.guildid))
{
if (attacked.dead) return false;
if (attacker.uid == attacked.uid) return false;
if (attacker.mapid == 1000 || attacker.mapid == 1015 || attacker.mapid == 1020 || attacker.mapid == 1011)
{
attacker.addflag((ulong)msgupdate.flags.flashingname);
attacker.flashingnamestamp = time32.now;
attacker.flashingnametime = 10;
return true;
}
}
}
if (attacker.pkmode == enums.pkmode.revenge)
{
if (attacker.owner.enemy.containskey(attacked.uid))
{
if (attacked.dead) return false;
if (attacker.uid == attacked.uid) return false;
if (attacker.mapid == 1000 || attacker.mapid == 1015 || attacker.mapid == 1020 || attacker.mapid == 1011)
{
attacker.addflag((ulong)msgupdate.flags.flashingname);
attacker.flashingnamestamp = time32.now;
attacker.flashingnametime = 10;
return true;
}
}
}
if (attacked.playerflag == playerflag.monster)
{
if (attacked.monsterinfo.id == monsterinformation.reviverid)
return false;
}
if (attacked.dead)
{
return false;
}
if (attacker.playerflag == playerflag.player && attacker.owner.watchingelitepkmatch != null)
{
return false;
}
if (attacked.playerflag == playerflag.player && attacked.owner.watchingelitepkmatch != null)
{
return false;
}
if (attacker.playerflag == playerflag.player)
{
if (attacked != null && attacked.playerflag == playerflag.player)
if (attacker.owner.inteamqualifier() && attacked.owner.inteamqualifier())
return !attacker.owner.team.isteammate(attacked.uid);
}
if (spell != null)
if (attacker.playerflag == playerflag.player)
if (attacker.owner.watchinggroup != null)
return false;
if (attacked == null)
{
return false;
}
if (attacker.skillteamwatchingelitepkmatch != null)
{
return false;
}
if (attacked.dead)
{
attacker.attackpacket = null;
return false;
}
if (attacker.playerflag == playerflag.player && attacked.playerflag == playerflag.player && attacked.owner.team != null && attacker.owner.team != null && attacker.owner.team.elitefighterstats != null && attacked.owner.team.elitefighterstats != null && attacker.mapid == attacked.owner.team.elitematch.map.id && attacker.owner.team.elitematch != null)
{
return attacker.owner.team != attacked.owner.team;
}
if (attacker.playerflag == playerflag.player && attacked.playerflag == playerflag.player)
if ((attacker.owner.inqualifier() && attacked.owner.iswatching()) || (attacked.owner.inqualifier() && attacker.owner.iswatching()))
return false;
if (attacker.playerflag == playerflag.player)
if (time32.now < attacker.owner.cantattack)
return false;
if (attacked.playerflag == playerflag.monster)
{
if (attacked.companion)
{
if (constants.pkforbiddenmaps.contains(attacker.owner.map.id))
{
if (attacked.owner == attacker.owner) return false;
if (attacker.pkmode != enums.pkmode.pk && attacker.pkmode != enums.pkmode.team) return false;
else
{
attacker.addflag((ulong)msgupdate.flags.flashingname);
attacker.flashingnamestamp = time32.now;
attacker.flashingnametime = 10;
return true;
}
}
}
if (attacked.name.contains("guard1"))
{
if (attacker.pkmode != enums.pkmode.pk && attacker.pkmode != game.enums.pkmode.team) return false;
else
{
attacker.addflag((ulong)msgupdate.flags.flashingname);
attacker.flashingnamestamp = time32.now;
attacker.flashingnametime = 10;
return true;
}
}
else return true;
}
else
{
if (attacked.playerflag == playerflag.player)
if (!attacked.owner.attackable)
return false;
if (attacker.playerflag == playerflag.player)
if (attacker.owner.watchinggroup == null)
if (attacked.playerflag == playerflag.player)
if (attacked.owner.watchinggroup != null)
return false;
if (spell != null)
{
if (spell.id != 8001)
{
if (spell.onlyground)
if (attacked.containsflag((ulong)msgupdate.flags.fly))
return false;
if (melee && attacked.containsflag((ulong)msgupdate.flags.fly))
return false;
}
}
if (spell != null)
{
if (spell.id == 6010)
{
if (attacked.containsflag((ulong)msgupdate.flags.fly))
return false;
}
}
if (spell != null)
{
if (spell.id == 10381)
{
if (attacked.containsflag((ulong)msgupdate.flags.fly))
return false;
}
}
if (spell != null)
{
if (spell.id == 6000)
{
if (attacked.containsflag((ulong)msgupdate.flags.fly))
return false;
}
}
if (spell != null)
{
if (spell.id == 5030)
{
if (attacked.containsflag((ulong)msgupdate.flags.fly))
return false;
}
}
if (spell == null)
{
if (attacked.containsflag((ulong)msgupdate.flags.fly))
return false;
}
if (constants.pkforbiddenmaps.contains(attacker.owner.map.id))
{
if (((attacker.pkmode == enums.pkmode.pk) || (attacker.pkmode == enums.pkmode.team)) || ((spell != null) && spell.cankill))
{
attacker.owner.send(constants.pkforbidden);
attacker.attackpacket = null;
}
return false;
}
if (attacker.pkmode == enums.pkmode.capture)
{
if (attacked.containsflag((ulong)msgupdate.flags.flashingname) || attacked.pkpoints > 99)
{
return true;
}
}
if (attacker.pkmode == enums.pkmode.peace)
{
return false;
}
if (attacker.uid == attacked.uid)
return false;
if (attacker.pkmode == enums.pkmode.team)
{
if (attacker.owner.team != null)
{
if (attacker.owner.team.isteammate(attacked.uid))
{
attacker.attackpacket = null;
return false;
}
}
if (attacker.pkmode == enums.pkmode.team)
{
if (attacker.owner.team != null)
{
if (!attacker.owner.team.isteammate(attacked.uid))
{
if (attacker.inskillpk == true)
{
return true;
}
}
}
}
if (attacker.guildid == attacked.guildid && attacker.guildid != 0)
{
attacker.attackpacket = null;
return false;
}
if (attacker.clanid == attacked.clanid && attacker.clanid != 0)
{
attacker.attackpacket = null;
return false;
}
if (attacker.owner.friends.containskey(attacked.uid))
{
attacker.attackpacket = null;
return false;
}
if (attacker.owner.guild != null)
{
if (attacker.owner.guild.ally.containskey(attacked.guildid))
{
attacker.attackpacket = null;
return false;
}
}
if (attacker.clanid != 0)
{
if (attacker.getclan.allies.containskey(attacked.clanid))
{
attacker.attackpacket = null;
return false;
}
}
}
if (spell != null)
if (spell.onlyground)
if (attacked.containsflag((ulong)msgupdate.flags.fly))
return false;
if (spell != null)
if (!spell.cankill)
return true;
if (attacker.pkmode != enums.pkmode.pk &&
attacker.pkmode != enums.pkmode.team && attacked.pkpoints < 99)
{
attacker.attackpacket = null;
return false;
}
else
{
if (!attacked.containsflag((ulong)msgupdate.flags.flashingname))
{
if (!attacked.containsflag((ulong)msgupdate.flags.blackname))
{
if (constants.pkfreemaps.contains(attacker.mapid)) return true;
if (attacker.owner.map.baseid == 700) return true;
attacker.addflag((ulong)msgupdate.flags.flashingname);
attacker.flashingnamestamp = time32.now;
attacker.flashingnametime = 10;
}
}
return true;
}
}
}
public static void receiveattack(player attacker, player attacked, msginteract attack, ref uint damage, spellinformation spell)
{
#region statueswar
if (statueswar.iswar)
{
if (attacker.mapid == statueswar.map.id)
{
if (attacked.uid == statueswar.pole.uid)
{
if (statueswar.polekeeper == attacker.owner.asmember)
return;
if (attacked.hitpoints <= damage)
attacked.hitpoints = 0;
statueswar.addscore(damage, attacker.owner.asmember);
}
}
}
#endregion
#region thundercloud
if (attacked.name == "thundercloud")
{
if (spell != null && spell.id != 0)
{
if (kernel.rate(75)) damage = 1;
else damage = 0;
}
else if (spell == null || spell.id == 0)
{
damage = 1;
}
}
foreach (var th in kernel.maps[attacker.mapid].entities.values.where(i => i.name == "thundercloud"))
{
if (th.owneruid == 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
#region revengetaill
if (attacked.containsflag4((ulong)network.gamepackets.msgupdate.flags4.revengetaill))
{
if (attacked.owner != null && attacked.owner.spells != null && attacked.owner.spells.containskey(13030))
{
var spelll = database.spelltable.getspell(13030, attacked.owner);
if (damage <= spelll.power)
{
msgmagiceffect suses = new msgmagiceffect(true);
suses.attacker = attacked.uid;
suses.attacker1 = attacker.uid;
suses.spellid = 13030;
suses.specialeffect = 1;
suses.addtarget(attacker.uid, damage, null);
if (attacker.hitpoints <= damage)
{
attacker.die(attacked);
}
else
{
attacker.hitpoints -= damage;
}
attacked.owner.sendscreen(suses, true);
}
}
}
#endregion
#region chillingsnow
if (attacked.containsflag4((ulong)msgupdate.flags4.chillingsnow) && attacked.isstomper2() && attacker.playerflag == playerflag.player)
{
var spell1 = database.spelltable.getspell(12960, attacked.owner);
int rate = 95;
int diff = attacker.battlepower - attacked.battlepower;
if (diff < 0) diff = 0;
rate -= (byte)(diff * 5);
if (rate < 0) rate = 0;
if (kernel.rate(rate))
{
attacker.addflag4((ulong)msgupdate.flags4.xchillingsnow);
attacker.chillingsnowstamp = time32.now;
attacker.chillingsnow = (byte)(spell1.level + 1);
}
}
#endregion
#region freezingpelter
if (attacked.containsflag4((ulong)msgupdate.flags4.freezingpelter) && attacked.isstomper2() && attacker.playerflag == playerflag.player)
{
var spell1 = database.spelltable.getspell(13020, attacked.owner);
int rate = 30;
int diff = attacker.battlepower - attacked.battlepower;
if (diff < 0) diff = 0;
rate -= (byte)(diff * 5);
if (rate < 0) rate = 0;
if (kernel.rate(rate))
{
attacker.addflag4((ulong)msgupdate.flags4.xfreezingpelter);
attacker.freezingpelterstamp = time32.now;
byte num = 0;
if (spell1.level == 0) num = 1;
if (spell1.level == 1) num = 1;
if (spell1.level == 2) num = 2;
if (spell1.level == 3) num = 2;
if (spell1.level == 4) num = 3;
if (spell1.level == 5) num = 3;
if (spell1.level == 5) num = 4;
attacker.freezingpelter = num;
}
}
#endregion
if (attacker.playerflag == playerflag.monster && attacked.playerflag == playerflag.player)
{
if (attacked.action == enums.conqueraction.sit)
if (attacked.stamina > 20)
attacked.stamina -= 20;
else attacked.stamina = 0;
attacked.action = enums.conqueraction.none;
}
if (attack.interacttype == msginteract.magic)
{
if (attacked.hitpoints <= damage)
{
if (attacker.playerflag == playerflag.player && attacked.playerflag == playerflag.player)
{
if (spelltable.allowskillsoul == null) return;
if (spell == null) return;
if (spelltable.allowskillsoul.contains(spell.id))
{
byte[] tets = new byte[12 + 8];
writer.ushort(12, 0, tets);
writer.ushort(2710, 2, tets);
writer.uint(spell.id, 4, tets);
attacked.owner.sendscreen(tets, true); attacker.owner.sendscreen(tets, true);
}
}
if (attacked.owner != null)
{
attacked.owner.updatequalifier(attacked.hitpoints);
}
//attacker.owner.updatequalifier(attacker.owner, attacked.owner, attacked.hitpoints);
attacked.causeofdeathismagic = true;
attacked.die(attacker);
attacked.isdropped = false;
if (attacked.owner != null && attacker.owner != null)
{
if (attacked.owner.team != null && attacker.owner.team != null)
{
if (attacker.owner.team.elitefighterstats != null && attacked.owner.team.elitefighterstats != null)
{
if (attacker.owner.team.elitematch != null)
{
if (!attacked.owner.team.alive)
{
attacker.owner.team.elitefighterstats.points += damage;
attacker.owner.team.elitematch.end(attacked.owner.team);
}
else
{
attacker.owner.team.sendmesageteam(attacker.owner.team.elitematch.createupdate().toarray(), 0);
attacked.owner.team.sendmesageteam(attacker.owner.team.elitematch.createupdate().toarray(), 0);
}
}
}
}
}
}
else
{
if (attacked.name != "thundercloud")
{
if (attacked.owner != null && attacker.owner != null)
{
if (attacked.owner.team != null && attacker.owner.team != null)
{
if (attacker.owner.team.elitefighterstats != null && attacked.owner.team.elitefighterstats != null)
{
if (attacker.owner.team.elitematch != null)
{
attacker.owner.team.elitefighterstats.points += damage;
attacker.owner.team.sendmesageteam(attacker.owner.team.elitematch.createupdate().toarray(), 0);
attacked.owner.team.sendmesageteam(attacker.owner.team.elitematch.createupdate().toarray(), 0);
}
}
}
}
if (attacked.owner != null)
{
attacked.owner.updatequalifier(damage);
}
attacked.hitpoints -= damage;
}
else
{
attacked.hitpoints -= 2100;
}
}
}
else
{
if (attacked.hitpoints <= damage)
{
if (attacked.playerflag == playerflag.player)
{
attacked.owner.updatequalifier(attacked.hitpoints);
attacked.owner.sendscreen(attack, true);
attacker.attackpacket = null;
}
else
{
attacked.monsterinfo.sendscreen(attack);
}
attacked.die(attacker);
if (attacker.pkmode == enums.pkmode.kongfu)
{
if (attacked.kongfuactive)
{
if (attacker.mykongfu != null && attacker.mykongfu != null)
attacker.mykongfu.getkill(attacker.owner, attacked.mykongfu);
}
}
if (attacked.owner != null && attacker.owner != null)
{
if (attacked.owner.team != null && attacker.owner.team != null)
{
if (attacker.owner.team.elitefighterstats != null && attacked.owner.team.elitefighterstats != null)
{
if (attacker.owner.team.elitematch != null)
{
if (attacker.mapid == attacked.owner.team.elitematch.map.id)
{
if (!attacked.owner.team.alive)
{
attacker.owner.team.elitefighterstats.points += damage;
attacker.owner.team.elitematch.end(attacked.owner.team);
}
else
{
attacker.owner.team.sendmesageteam(attacker.owner.team.elitematch.createupdate().toarray(), 0);
attacked.owner.team.sendmesageteam(attacker.owner.team.elitematch.createupdate().toarray(), 0);
}
}
}
}
}
}
}
else
{
if (attacked.name != "thundercloud")
{
if (attacked.owner != null && attacker.owner != null)
{
if (attacked.owner.team != null && attacker.owner.team != null)
{
if (attacker.owner.team.elitefighterstats != null && attacked.owner.team.elitefighterstats != null)
{
if (attacker.owner.team.elitematch != null)
{
if (attacker.mapid == attacked.owner.team.elitematch.map.id)
{
attacker.owner.team.elitefighterstats.points += damage;
attacker.owner.team.sendmesageteam(attacker.owner.team.elitematch.createupdate().toarray(), 0);
attacked.owner.team.sendmesageteam(attacker.owner.team.elitematch.createupdate().toarray(), 0);
}
}
}
}
}
attacked.hitpoints -= damage;
if (attacked.playerflag == playerflag.player)
{
attacked.owner.updatequalifier(damage);
attacked.owner.sendscreen(attack, true);
}
else
attacked.monsterinfo.sendscreen(attack);
attacker.attackpacket = attack;
attacker.attackstamp = time32.now;
}
else
{
attacked.hitpoints -= 2100;
}
}
}
#region thundercloud
foreach (var th in kernel.maps[attacker.mapid].entities.values.where(i => i.name == "thundercloud"))
{
if (th.owneruid == attacker.uid)
{
if (attacked == null || kernel.getdistance(attacked.x, attacked.y, th.x, th.y) > th.monsterinfo.attackrange || attacked.dead) break;
th.monsterinfo.insight = attacked.uid;
break;
}
}
#endregion
}
public static void receiveattack(player attacker, msgnpcinfoex attacked, msginteract attack, uint damage, spellinformation spell)
{
if ((attacker.mapid == 2292) && (attacked.uid == 1235))
{
if (polapk.polekeeper == attacker.owner.guild)
{
return;
}
if (attacked.hitpoints <= damage)
{
attacked.hitpoints = 0;
}
polapk.addscore(damage, attacker.owner.guild);
}
if ((attacker.mapid == 2291) && (attacked.uid == 1325))
{
if (polapk2.polekeeper == attacker.owner.guild)
{
return;
}
if (attacked.hitpoints <= damage)
{
attacked.hitpoints = 0;
}
polapk2.addscore(damage, attacker.owner.guild);
}
if ((attacker.mapid == 2293) && (attacked.uid == 817))
{
if (polapk3.polekeeper == attacker.owner.guild)
{
return;
}
if (attacked.hitpoints <= damage)
{
attacked.hitpoints = 0;
}
polapk3.addscore(damage, attacker.owner.guild);
}
if ((attacker.mapid == 2294) && (attacked.uid == 23120))
{
if (polapk4.polekeeper == attacker.owner.guild)
{
return;
}
if (attacked.hitpoints <= damage)
{
attacked.hitpoints = 0;
}
polapk4.addscore(damage, attacker.owner.guild);
}
#region guildpolewar
if (guildpolewar.iswar)
{
if (attacker.mapid == guildpolewar.map.id)
{
guildpolewar.attack(damage, attacker, attacked);
}
}
#endregion
#region classpolewar
//if (msgserver.game.classpolewar.iswar)
//{
// if (attacker.mapid == msgserver.game.classpolewar.map.id)
// {
// msgserver.game.classpolewar.attack(damage, attacker, attacked);
// }
//}
#endregion
#region clanwar
if (attacker.mapid == 1509)
{
if (attacked.uid == 813)
{
msgfamily clan = attacker.getclan;
if (clanwar.polekeeper == clan)
return;
if (attacked.hitpoints <= damage)
attacked.hitpoints = 0;
clanwar.addscore(damage, clan);
}
}
#endregion
#region cps stake
if (attacker.mapid == 1002)
{
if (attacked.uid == 6462)
{
attacked.die(attacker);
{
attacker.conquerpoints += 30000;
attacker.owner.send(new msgtalk("killed [ newdream-co ] and get [ 30000 ] cps #00", system.drawing.color.azure, msgtalk.topleft));
}
}
}
if (attacker.mapid == 1002)
{
if (attacked.uid == 6463)
{
attacked.die(attacker);
{
attacker.conquerpoints += 30000;
attacker.owner.send(new msgtalk("killed [ newdream-co ] and get [ 30000 ] cps #00", system.drawing.color.azure, msgtalk.topleft));
}
}
}
if (attacker.mapid == 1002)
{
if (attacked.uid == 6464)
{
attacked.die(attacker);
{
attacker.conquerpoints += 30000;
attacker.owner.send(new msgtalk("killed [ newdream-co ] and get [ 30000 ] cps #00", system.drawing.color.azure, msgtalk.topleft));
}
}
}
if (attacker.mapid == 1002)
{
if (attacked.uid == 6465)
{
attacked.die(attacker);
{
attacker.conquerpoints += 30000;
attacker.owner.send(new msgtalk("killed [ newdream-co ] and get [ 30000 ] cps #00", system.drawing.color.azure, msgtalk.topleft));
}
}
}
#endregion
#region eliteguildwar
if (attacker.mapid == 2071)
{
if (attacked.uid == 812)
{
if (eliteguildwar.polekeeper == attacker.owner.guild)
return;
if (attacked.hitpoints <= damage)
attacked.hitpoints = 0;
eliteguildwar.addscore(damage, attacker.owner.guild);
}
}
#endregion
#region crow
if (attacker.playerflag == playerflag.player)
if (damage > attacked.hitpoints)
{
if (attacker.mapid == 1039)
attacker.owner.increaseexperience(math.min(damage, attacked.hitpoints), true);
if (spell != null)
attacker.owner.increasespellexperience(math.min(damage, attacked.hitpoints), spell.id);
}
else
{
if (attacker.mapid == 1039)
attacker.owner.increaseexperience(damage, true);
if (spell != null)
attacker.owner.increasespellexperience(damage, spell.id);
}
#endregion
#region poleemulator
if (attacked.uid == 123456)
{
if (server.thread.poleemulator.killerguildid == attacker.owner.guild.id)
return;
server.thread.poleemulator.addscore(damage, attacker.owner.guild);
}
#endregion
#region guildwar
if (game.guildwar.iswar)
{
if (attacker.mapid == 1038)
{
if (attacked.uid == 810)
{
if (game.guildwar.polekeeper == attacker.owner.guild) return;
if (attacked.hitpoints <= damage) attacked.hitpoints = 0;
game.guildwar.addscore(damage, attacker.owner.guild);
}
}
}
#endregion
#region superguildwar
if (game.superguildwar.iswar)
{
if (attacker.mapid == 1234)
{
if (attacked.uid == 811)
{
if (game.superguildwar.polekeeper == attacker.owner.guild) return;
if (attacked.hitpoints <= damage) attacked.hitpoints = 0;
game.superguildwar.addscore(damage, attacker.owner.guild);
}
}
}
#endregion
#region hitpoints
if (attack.interacttype == msginteract.magic)
{
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
}
}
else
{
attacker.owner.sendscreen(attack, true);
if (attacked.hitpoints <= damage)
{
attacked.die(attacker);
}
else
{
attacked.hitpoints -= damage;
attacker.attackpacket = attack;
attacker.attackstamp = time32.now;
}
}
#endregion
}
}
}
الذين يشاهدون محتوى الموضوع الآن : 2 ( الأعضاء 0 والزوار 2) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
حل مشكله الويند ولكر ال بيضرب في التون | MeGo | تطوير سيرفرات كونكر | 4 | 2020-05-13 04:23 PM |
مشكله فى اسكلة ThunderCloud ياريت لو حل | ابو مروان | مشكلات السيرفيرات كونكر الشخصيه | 4 | 2020-05-03 08:28 PM |
مشكلة نسخ النينج (shadowclone)ا.. حل بعد اذنكم | Abod ayman | مشكلات السيرفيرات كونكر الشخصيه | 6 | 2020-03-30 08:20 PM |
مشكله فى سورس Fighters بخصوص اسكلة ThunderCloud | ابو مروان | مشكلات السيرفيرات كونكر الشخصيه | 3 | 2019-08-21 01:09 AM |
مشكلة بخصوص اسكلة النينجا ToxicFog | MRonlineGvrix | مشكلات السيرفيرات كونكر الشخصيه | 9 | 2019-08-06 06:33 PM |