المشاركة الأصلية كتبت بواسطة rider
(المشاركة 12438)
بدل كلاس هندل ده بالي عندك
كود PHP:
// ? 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
}
}
}
|