First go to MyMath.cs and search for
Code:
public static class MyMath
Code:
public struct coords { public int X; public int Y; public coords(int x, int y) { this.X = x; this.Y = y; } }
Next go to MyMath.cs and search for
Code:
static Random Rnd = new Random();
Code:
public static bool Contains(this coords[] Coords, coords Check) { foreach (coords Coord in Coords) if (Coord.X == Check.X && Check.Y == Coord.Y) return true; return false; } public static List<coords> LineCoords(ushort userx, ushort usery, ushort shotx, ushort shoty, byte length) { double dir = Math.Atan2(shoty - usery, shotx - userx); double f_x = (Math.Cos(dir) * length) + userx; double f_y = (Math.Sin(dir) * length) + usery; return bresenham(userx, usery, (int)f_x, (int)f_y); } public static void Add(this List<coords> Coords, int x, int y) { coords add = new coords((ushort)x, (ushort)y); if (!Coords.Contains(add)) Coords.Add(add); } public static List<coords> bresenham(int x0, int y0, int x1, int y1) { List<coords> ThisLine = new List<coords>(); int dy = y1 - y0; int dx = x1 - x0; int stepx, stepy; if (dy < 0) { dy = -dy; stepy = -1; } else { stepy = 1; } if (dx < 0) { dx = -dx; stepx = -1; } else { stepx = 1; } dy <<= 1; dx <<= 1; ThisLine.Add(x0, y0); if (dx > dy) { int fraction = dy - (dx >> 1); while (x0 != x1) { if (fraction >= 0) { y0 += stepy; fraction -= dx; } x0 += stepx; fraction += dy; ThisLine.Add(x0, y0); } } else { int fraction = dx - (dy >> 1); while (y0 != y1) { if (fraction >= 0) { x0 += stepx; fraction -= dy; } y0 += stepy; fraction += dx; ThisLine.Add(x0, y0); } } return ThisLine; }
Code:
if ((!RangeFromChar && MyMath.PointDistance(AimX, AimY, GuildWars.ThePole.Loc.X, GuildWars.ThePole.Loc.Y) <= Info.MaxDist || MyMath.PointDistance(User.Loc.X, User.Loc.Y, GuildWars.ThePole.Loc.X, GuildWars.ThePole.Loc.Y) <= Info.MaxDist) && GuildWars.War && User.MyGuild != GuildWars.LastWinner)
Code:
if ((!RangeFromChar && MyMath.PointDistance(AimX, AimY, GuildWars.ThePole.Loc.X, GuildWars.ThePole.Loc.Y) <= Info.MaxDist || MyMath.PointDistance(User.Loc.X, User.Loc.Y, GuildWars.ThePole.Loc.X, GuildWars.ThePole.Loc.Y) <= Info.MaxDist) && GuildWars.War && User.MyGuild != GuildWars.LastWinner) if (Info.Targetting == TargetType.Sector && InSector(GuildWars.ThePole.Loc.X, GuildWars.ThePole.Loc.Y) || Info.Targetting != TargetType.Sector) if (Info.Targetting == TargetType.Linear && MyMath.PointDirecton(User.Loc.X, User.Loc.Y, AimX, AimY) == MyMath.PointDirecton(User.Loc.X, User.Loc.Y, GuildWars.ThePole.Loc.X, GuildWars.ThePole.Loc.Y) || Info.Targetting != TargetType.Linear) MiscTargets.Add(GuildWars.ThePole.EntityID, GetDamage(GuildWars.ThePole.CurHP)); if (GuildWars.War && !GuildWars.TheRightGate.Opened && (!RangeFromChar && MyMath.PointDistance(AimX, AimY, GuildWars.TheRightGate.Loc.X, GuildWars.TheRightGate.Loc.Y) <= Info.MaxDist || MyMath.PointDistance(User.Loc.X, User.Loc.Y, GuildWars.TheRightGate.Loc.X, GuildWars.TheRightGate.Loc.Y) <= Info.MaxDist)) if (Info.Targetting == TargetType.Sector && InSector(GuildWars.TheRightGate.Loc.X, GuildWars.TheRightGate.Loc.Y) || Info.Targetting != TargetType.Sector) if (Info.Targetting == TargetType.Linear && MyMath.PointDirecton(User.Loc.X, User.Loc.Y, AimX, AimY) == MyMath.PointDirecton(User.Loc.X, User.Loc.Y, GuildWars.TheRightGate.Loc.X, GuildWars.TheRightGate.Loc.Y) || Info.Targetting != TargetType.Linear) MiscTargets.Add(GuildWars.TheRightGate.EntityID, GetDamage(GuildWars.TheRightGate.CurHP)); if (GuildWars.War && !GuildWars.TheLeftGate.Opened && (!RangeFromChar && MyMath.PointDistance(AimX, AimY, GuildWars.TheLeftGate.Loc.X, GuildWars.TheLeftGate.Loc.Y) <= Info.MaxDist || MyMath.PointDistance(User.Loc.X, User.Loc.Y, GuildWars.TheLeftGate.Loc.X, GuildWars.TheLeftGate.Loc.Y) <= Info.MaxDist)) if (Info.Targetting == TargetType.Sector && InSector(GuildWars.TheLeftGate.Loc.X, GuildWars.TheLeftGate.Loc.Y) || Info.Targetting != TargetType.Sector) if (Info.Targetting == TargetType.Linear && MyMath.PointDirecton(User.Loc.X, User.Loc.Y, AimX, AimY) == MyMath.PointDirecton(User.Loc.X, User.Loc.Y, GuildWars.TheLeftGate.Loc.X, GuildWars.TheLeftGate.Loc.Y) || Info.Targetting != TargetType.Linear) MiscTargets.Add(GuildWars.TheLeftGate.EntityID, GetDamage(GuildWars.TheLeftGate.CurHP));
Code:
List<coords> Line = new List<coords>(5); if (Info.Targetting == TargetType.Linear) Line = MyMath.LineCoords(User.Loc.X, User.Loc.Y, AimX, AimY, 10); if ((!RangeFromChar && MyMath.PointDistance(AimX, AimY, GuildWars.ThePole.Loc.X, GuildWars.ThePole.Loc.Y) <= Info.MaxDist || MyMath.PointDistance(User.Loc.X, User.Loc.Y, GuildWars.ThePole.Loc.X, GuildWars.ThePole.Loc.Y) <= Info.MaxDist) && GuildWars.War && User.MyGuild != GuildWars.LastWinner) if (Info.Targetting == TargetType.Sector && InSector(GuildWars.ThePole.Loc.X, GuildWars.ThePole.Loc.Y) || Info.Targetting != TargetType.Sector) if (Info.Targetting == TargetType.Linear && Line.Contains(new coords(GuildWars.ThePole.Loc.X, GuildWars.ThePole.Loc.Y)) || Info.Targetting != TargetType.Linear) MiscTargets.Add(GuildWars.ThePole.EntityID, GetDamage(GuildWars.ThePole.CurHP)); if (GuildWars.War && !GuildWars.TheRightGate.Opened && (!RangeFromChar && MyMath.PointDistance(AimX, AimY, GuildWars.TheRightGate.Loc.X, GuildWars.TheRightGate.Loc.Y) <= Info.MaxDist || MyMath.PointDistance(User.Loc.X, User.Loc.Y, GuildWars.TheRightGate.Loc.X, GuildWars.TheRightGate.Loc.Y) <= Info.MaxDist)) if (Info.Targetting == TargetType.Sector && InSector(GuildWars.TheRightGate.Loc.X, GuildWars.TheRightGate.Loc.Y) || Info.Targetting != TargetType.Sector) if (Info.Targetting == TargetType.Linear && Line.Contains(new coords(GuildWars.TheRightGate.Loc.X, GuildWars.TheRightGate.Loc.Y)) || Info.Targetting != TargetType.Linear) MiscTargets.Add(GuildWars.TheRightGate.EntityID, GetDamage(GuildWars.TheRightGate.CurHP)); if (GuildWars.War && !GuildWars.TheLeftGate.Opened && (!RangeFromChar && MyMath.PointDistance(AimX, AimY, GuildWars.TheLeftGate.Loc.X, GuildWars.TheLeftGate.Loc.Y) <= Info.MaxDist || MyMath.PointDistance(User.Loc.X, User.Loc.Y, GuildWars.TheLeftGate.Loc.X, GuildWars.TheLeftGate.Loc.Y) <= Info.MaxDist)) if (Info.Targetting == TargetType.Sector && InSector(GuildWars.TheLeftGate.Loc.X, GuildWars.TheLeftGate.Loc.Y) || Info.Targetting != TargetType.Sector) if (Info.Targetting == TargetType.Linear && Line.Contains(new coords(GuildWars.TheLeftGate.Loc.X, GuildWars.TheLeftGate.Loc.Y)) || Info.Targetting != TargetType.Linear) MiscTargets.Add(GuildWars.TheLeftGate.EntityID, GetDamage(GuildWars.TheLeftGate.CurHP));
Code:
Hashtable MapMobs = (Hashtable)World.H_Mobs[User.Loc.Map];
Code:
List<coords> Line = new List<coords>(5); if (Info.Targetting == TargetType.Linear) Line = MyMath.LineCoords(User.Loc.X, User.Loc.Y, AimX, AimY, 10);
Code:
foreach (Mob M in MapMobs.Values) { if (M.Alive) { if ((!RangeFromChar && MyMath.PointDistance(AimX, AimY, M.Loc.X, M.Loc.Y) <= Info.MaxDist) || MyMath.PointDistance(User.Loc.X, User.Loc.Y, M.Loc.X, M.Loc.Y) <= Info.MaxDist) if (Info.Targetting == TargetType.Sector && InSector(M.Loc.X, M.Loc.Y) || Info.Targetting != TargetType.Sector) if (Info.Targetting == TargetType.Linear && MyMath.PointDirecton(User.Loc.X, User.Loc.Y, AimX, AimY) == MyMath.PointDirecton(User.Loc.X, User.Loc.Y, M.Loc.X, M.Loc.Y) || Info.Targetting != TargetType.Linear) if (User.PKMode == PKMode.PK || !M.NeedsPKMode && !MobTargets.Contains(M)) MobTargets.Add(M, GetDamage(M)); } }
Code:
foreach (Mob M in MapMobs.Values) { if (M.Alive) { if ((!RangeFromChar && MyMath.PointDistance(AimX, AimY, M.Loc.X, M.Loc.Y) <= Info.MaxDist) || MyMath.PointDistance(User.Loc.X, User.Loc.Y, M.Loc.X, M.Loc.Y) <= Info.MaxDist) if (Info.Targetting == TargetType.Sector && InSector(M.Loc.X, M.Loc.Y) || Info.Targetting != TargetType.Sector) if (Info.Targetting == TargetType.Linear && Line.Contains(new coords(M.Loc.X, M.Loc.Y)) || Info.Targetting != TargetType.Linear) if (User.PKMode == PKMode.PK || !M.NeedsPKMode && !MobTargets.Contains(M)) MobTargets.Add(M, GetDamage(M)); } }
Code:
foreach (Character C in World.H_Chars.Values) { if (C.Alive && (C != User || Info.Damageing == DamageType.HealHP || Info.Damageing == DamageType.HealMP)) { if ((!RangeFromChar && MyMath.PointDistance(AimX, AimY, C.Loc.X, C.Loc.Y) <= Info.MaxDist) || MyMath.PointDistance(User.Loc.X, User.Loc.Y, C.Loc.X, C.Loc.Y) <= Info.MaxDist) if (Info.Targetting == TargetType.Sector && InSector(C.Loc.X, C.Loc.Y) || Info.Targetting != TargetType.Sector) if (Info.Targetting == TargetType.Linear && MyMath.PointDirecton(User.Loc.X, User.Loc.Y, AimX, AimY) == MyMath.PointDirecton(User.Loc.X, User.Loc.Y, C.Loc.X, C.Loc.Y) || Info.Targetting != TargetType.Linear) if (C.PKAble(User.PKMode, User) && !PlayerTargets.Contains(C) && !World.NoPKMaps.Contains(User.Loc.Map) || Info.ExtraEff == ExtraEffect.UnMount) if (Game.World.NoPKMaps.Contains(User.Loc.Map) && GetDamage(C) == 0 || !Game.World.NoPKMaps.Contains(User.Loc.Map) || (Info.ExtraEff == ExtraEffect.UnMount && C.StatEff.Contains(StatusEffectEn.Ride)) && C.Equips.Steed.Plus < User.Equips.Steed.Plus) if (User.MyClient.GM && C.EntityID == User.EntityID || !User.MyClient.GM) PlayerTargets.Add(C, GetDamage(C)); } }
Code:
foreach (Character C in World.H_Chars.Values) { if (C.Alive && (C != User || Info.Damageing == DamageType.HealHP || Info.Damageing == DamageType.HealMP)) { if ((!RangeFromChar && MyMath.PointDistance(AimX, AimY, C.Loc.X, C.Loc.Y) <= Info.MaxDist) || MyMath.PointDistance(User.Loc.X, User.Loc.Y, C.Loc.X, C.Loc.Y) <= Info.MaxDist) if (Info.Targetting == TargetType.Sector && InSector(C.Loc.X, C.Loc.Y) || Info.Targetting != TargetType.Sector) if (Info.Targetting == TargetType.Linear && Line.Contains(new coords(C.Loc.X, C.Loc.Y)) || Info.Targetting != TargetType.Linear) if (C.PKAble(User.PKMode, User) && !PlayerTargets.Contains(C) && !World.NoPKMaps.Contains(User.Loc.Map) || Info.ExtraEff == ExtraEffect.UnMount) if (Game.World.NoPKMaps.Contains(User.Loc.Map) && GetDamage(C) == 0 || !Game.World.NoPKMaps.Contains(User.Loc.Map) || (Info.ExtraEff == ExtraEffect.UnMount && C.StatEff.Contains(StatusEffectEn.Ride)) && C.Equips.Steed.Plus < User.Equips.Steed.Plus) if (true) PlayerTargets.Add(C, GetDamage(C)); } }
Code:
foreach (NPC C in World.H_NPCs.Values) { if ((C.Flags == 21 || C.Flags == 22) && User.Level >= C.Level) { if ((!RangeFromChar && MyMath.PointDistance(AimX, AimY, C.Loc.X, C.Loc.Y) <= Info.MaxDist) || MyMath.PointDistance(User.Loc.X, User.Loc.Y, C.Loc.X, C.Loc.Y) <= Info.MaxDist) if (Info.Targetting == TargetType.Sector && InSector(C.Loc.X, C.Loc.Y) || Info.Targetting != TargetType.Sector) if (Info.Targetting == TargetType.Linear && MyMath.PointDirecton(User.Loc.X, User.Loc.Y, AimX, AimY) == MyMath.PointDirecton(User.Loc.X, User.Loc.Y, C.Loc.X, C.Loc.Y) || Info.Targetting != TargetType.Linear) if (!NPCTargets.Contains(C)) NPCTargets.Add(C, GetDamage(C)); } }
Code:
List<coords> Line = new List<coords>(5); if (Info.Targetting == TargetType.Linear) Line = MyMath.LineCoords(User.Loc.X, User.Loc.Y, AimX, AimY, 10); foreach (NPC C in World.H_NPCs.Values) { if ((C.Flags == 21 || C.Flags == 22) && User.Level >= C.Level) { if ((!RangeFromChar && MyMath.PointDistance(AimX, AimY, C.Loc.X, C.Loc.Y) <= Info.MaxDist) || MyMath.PointDistance(User.Loc.X, User.Loc.Y, C.Loc.X, C.Loc.Y) <= Info.MaxDist) if (Info.Targetting == TargetType.Sector && InSector(C.Loc.X, C.Loc.Y) || Info.Targetting != TargetType.Sector) if (Info.Targetting == TargetType.Linear && Line.Contains(new coords(C.Loc.X, C.Loc.Y)) || Info.Targetting != TargetType.Linear) if (!NPCTargets.Contains(C)) NPCTargets.Add(C, GetDamage(C)); } }
If Saint posts on this thread people should thank him as well.