Skip to content

Commit

Permalink
Commented out debugging messages
Browse files Browse the repository at this point in the history
These are very helpful where they are placed, so I would strongly recommend we just leave them in the codebase with them commented out.
  • Loading branch information
ipkpjersi committed Sep 21, 2024
1 parent ba84718 commit ceec9cb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ public void attackNpc(int i) {
player.followId2 = i;
player.followId = 0;
if (!player.usingRangeWeapon && !RangeData.usingHally(player) && !player.usingBow && !player.usingMagic && player.goodDistance(player.getX(), player.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), NPCDefinition.forId(NpcHandler.npcs[i].npcType).getSize())) {
System.out.println("distance good! stop movement 2");
//System.out.println("distance good! stop movement 2");
player.stopMovement();
}
if (player.attackTimer <= 0) {
Expand Down Expand Up @@ -568,15 +568,15 @@ public void attackNpc(int i) {
System.err.println("projectile path is not clear! exiting early");
return;
}
System.out.println("npc id is " + NpcHandler.npcs[i].npcType + " with size " + NPCDefinition.forId(NpcHandler.npcs[i].npcType).getSize());
//System.out.println("npc id is " + NpcHandler.npcs[i].npcType + " with size " + NPCDefinition.forId(NpcHandler.npcs[i].npcType).getSize());
/**
* Distances for attacking npcs
*/
if ((!player.goodDistance(player.getX(), player.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 2) && RangeData.usingHally(player) && !player.usingRangeWeapon && !player.usingBow && !player.usingMagic)
|| (!player.goodDistance(player.getX(), player.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 4) && player.usingRangeWeapon && !player.usingBow && !player.usingMagic)
|| (!player.goodDistance(player.getX(), player.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), NPCDefinition.forId(NpcHandler.npcs[i].npcType).getSize()) && !player.usingRangeWeapon && !RangeData.usingHally(player) && !player.usingBow && !player.usingMagic)
|| (!player.goodDistance(player.getX(), player.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 8) && (player.usingBow || player.usingMagic))) {
System.err.println("npc distance check early return! probably not good");
//System.err.println("npc distance check early return! probably not good");
return;
} else {
if (player.usingMagic || player.usingBow || player.usingRangeWeapon) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ public static void attackPlayer(Player c, int i) {
if (!NpcData.goodDistanceNpc(NpcHandler.npcs[i].npcId, c.getX(), c.getY(), NpcData.distanceRequired(NpcHandler.npcs[i].npcId)) || NpcData.inNpc(NpcHandler.npcs[i].npcId, c.getX(), c.getY())) {
return;
}
System.out.println("distance seems good!");
//System.out.println("distance seems good!");
NpcHandler.npcs[i].facePlayer(c);
boolean special = false;//specialCase(c,i);
if (NpcData.checkClip(NpcHandler.npcs[i]) || special) {
System.out.println("clip seems good!");
//System.out.println("clip seems good!");
if (c.respawnTimer <= 0) {
NpcHandler.npcs[i].facePlayer(c);
NpcHandler.npcs[i].attackTimer = NpcData.getNpcDelay(i);
Expand Down
18 changes: 9 additions & 9 deletions 2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,10 @@ public static boolean goodDistanceNpc(int i, int x2, int y2, int distance) {
Set<Integer> nearbyDirections = new HashSet<>(Arrays.asList(6, 8, 9, 10, 12, 13));
boolean nearBy = nearbyDirections.contains(dir);
if (Misc.goodDistance(x, y, x2, y2, nearBy && NPCDefinition.forId(NpcHandler.npcs[i].npcType).getSize() > 1 ? distance - 1 : distance)) {
System.out.println("distance is good! x " + x + " y " + y + " " + " x2 " + x2 + " y2 " + y2 + " vs distance " + (nearBy ? distance - 1 : distance) + " with direction " + dir);
//System.out.println("distance is good! x " + x + " y " + y + " " + " x2 " + x2 + " y2 " + y2 + " vs distance " + (nearBy ? distance - 1 : distance) + " with direction " + dir);
return true;
} else {
System.out.println("distance is not good! x " + x + " y " + y + " " + " x2 " + x2 + " y2 " + y2 + " vs distance " + distance + " with direction " + dir);
//System.out.println("distance is not good! x " + x + " y " + y + " " + " x2 " + x2 + " y2 " + y2 + " vs distance " + distance + " with direction " + dir);
}
}
}
Expand Down Expand Up @@ -390,7 +390,7 @@ public static boolean checkClip(Npc n) {
int dis2 = 0;
final boolean melee = distanceRequired(n.npcId) == NPCDefinition.forId(n.npcType).getSize();
if (NPCDefinition.forId(n.npcType).getSize() < 1 && x != x2 && y != y2) {
System.err.println("checkClip exit early! return false");
//System.err.println("checkClip exit early! return false");
return false;
}
// Algorithm starts here
Expand Down Expand Up @@ -428,7 +428,7 @@ public static boolean checkClip(Npc n) {
boolean firstCheck = false;
for (int i = 0; i <= longest; i++) {
if (dis2 > dis) {
System.err.println("checkClip early exit, dis2 > dis " + dis2 + " > " + dis );
//System.err.println("checkClip early exit, dis2 > dis " + dis2 + " > " + dis );
return false;
}
dis2++;
Expand All @@ -446,7 +446,7 @@ public static boolean checkClip(Npc n) {
if (!firstCheck) {
if (melee) {
if (!Region.getClipping(x, y, n.heightLevel, x3 - x, y3 - y) && !Region.getClipping(x, y, n.heightLevel, x - x3, y - y3)) {
System.err.println("checkClip Region.getClipping exit early 1");
//System.err.println("checkClip Region.getClipping exit early 1");
return false;
}
}
Expand All @@ -457,7 +457,7 @@ public static boolean checkClip(Npc n) {
}
if (melee) {
if (!Region.getClipping(x, y, n.heightLevel, x3 - x, y3 - y) && !Region.getClipping(x, y, n.heightLevel, x - x3, y - y3)) {
System.err.println("checkClip Region.getClipping exit early 2");
//System.err.println("checkClip Region.getClipping exit early 2");
return false;
}
}
Expand All @@ -471,20 +471,20 @@ public static boolean checkClip(Npc n) {
public static boolean inNpc(int i, int x2, int y2) {
if (NpcHandler.npcs[i].size < 1) {
if (x2 == NpcHandler.npcs[i].getX() && y2 == NpcHandler.npcs[i].getY()) {
System.out.println("in npc 1");
//System.out.println("in npc 1");
return true;
}
} else {
for (int x = NpcHandler.npcs[i].getX(); x <= NpcHandler.npcs[i].getX() + NpcHandler.npcs[i].size; x++) {
for (int y = NpcHandler.npcs[i].getY(); y <= NpcHandler.npcs[i].getY() + NpcHandler.npcs[i].size; y++) {
if (x2 == x && y2 == y) {
System.out.println("in npc 2");
//System.out.println("in npc 2");
return true;
}
}
}
}
System.out.println("not in npc");
//System.out.println("not in npc");
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void processPacket(final Player player, Packet packet) {
return;
}
if (!player.usingRangeWeapon && !RangeData.usingHally(player) && !player.usingBow && !player.usingMagic && player.goodDistance(player.getX(), player.getY(), NpcHandler.npcs[player.npcIndex].getX(), NpcHandler.npcs[player.npcIndex].getY(), NPCDefinition.forId(NpcHandler.npcs[player.npcIndex].npcType).getSize())) {
System.out.println("distance good! stop movement 1");
//System.out.println("distance good! stop movement 1");
player.stopMovement();
}
if (player.followId > 0) {
Expand Down

0 comments on commit ceec9cb

Please sign in to comment.