@@ -744,7 +744,13 @@ public boolean canCastSpell(final int spell) {
744744 }
745745 return true ;
746746 }
747-
747+ /**
748+ * Checks for amount of provided runeId, also checks elemental staffs and returns the corresponding runes
749+ *
750+ * @param id the ID of the rune to check
751+ * @param amount the desired number of runes (does not matter if you have a staff)
752+ * @return true if the specified number of runes is available (or staff exists), false otherwise
753+ */
748754 private boolean ensureRunes (final int id , final int amount ) {
749755 switch (id ) {
750756 case 31 :
@@ -770,7 +776,12 @@ private boolean ensureRunes(final int id, final int amount) {
770776 }
771777 return getInventoryCount (id ) >= amount ;
772778 }
773-
779+ /**
780+ * Determines if the given ID is present in the inventory and if the corresponding item is equipped.
781+ *
782+ * @param id the ID to check
783+ * @return true if the item is equipped, false otherwise
784+ */
774785 private boolean isEquippedId (final int id ) {
775786 for (int i = 0 ; i < getInventoryCount (); i ++) {
776787 if (client .getInventoryId (i ) == id ) {
@@ -1174,7 +1185,13 @@ public int[] getObjectById(final int... ids) {
11741185 public void useItemOnObject (final int item_id , final int object_x , final int object_y ) {
11751186 useSlotOnObject (getInventoryIndex (item_id ), object_x , object_y );
11761187 }
1177-
1188+ /**
1189+ * Uses the given item slot index on the object at the specified coordinates.
1190+ *
1191+ * @param slot the item slot index to use
1192+ * @param object_x the x-coordinate of the object
1193+ * @param object_y the y-coordinate of the object
1194+ */
11781195 public void useSlotOnObject (final int slot , final int object_x , final int object_y ) {
11791196 if (slot == -1 )
11801197 return ;
@@ -1190,7 +1207,13 @@ public void useSlotOnObject(final int slot, final int object_x, final int object
11901207 client .finishPacket ();
11911208 }
11921209 }
1193-
1210+ /**
1211+ * Finds the index of the object at the specified coordinates relative to the client's area.
1212+ *
1213+ * @param x the x-coordinate of the object
1214+ * @param y the y-coordinate of the object
1215+ * @return the index of the object, or -1 if no object is found at the specified coordinates
1216+ */
11941217 private int getObjectIndex (final int x , final int y ) {
11951218 final int lx = x - client .getAreaX ();
11961219 final int ly = y - client .getAreaY ();
@@ -1900,7 +1923,13 @@ public void atWallObject(final int x, final int y) {
19001923 client .finishPacket ();
19011924 }
19021925 }
1903-
1926+ /**
1927+ * Returns the index of the bound at the specified coordinates.
1928+ *
1929+ * @param x the x-coordinate of the bound
1930+ * @param y the y-coordinate of the bound
1931+ * @return the index of the bound, or -1 if not found
1932+ */
19041933 private int getBoundIndex (final int x , final int y ) {
19051934 final int lx = x - client .getAreaX ();
19061935 final int ly = y - client .getAreaY ();
@@ -2372,14 +2401,25 @@ public int getLocalTradeItemCount() {
23722401 public int getOurTradedItemCount () {
23732402 return client .getLocalTradeItemCount ();
23742403 }
2375-
2404+ /**
2405+ * Retrieves the local(your) trade itemID at the specified trade window index
2406+ *
2407+ * @param i the index of the local trade item
2408+ * @return the local trade item ID at the specified index, or -1 if the index is out of bounds
2409+ */
23762410 public int getLocalTradeItemId (final int i ) {
23772411 if (i >= client .getLocalTradeItemCount ()) {
23782412 return -1 ;
23792413 }
23802414 return client .getLocalTradeItemId (i );
23812415 }
2382-
2416+ /**
2417+ * Retrieves the local(your) trade item stack at the specified trade window index
2418+ *
2419+ * @param i the index of the item stack to retrieve
2420+ * @return the item stack at the specified index, or -1 if the index is
2421+ * out of range
2422+ */
23832423 public int getLocalTradeItemStack (final int i ) {
23842424 if (i >= client .getLocalTradeItemCount ()) {
23852425 return -1 ;
@@ -2401,21 +2441,36 @@ public int getRemoteTradeItemCount() {
24012441 public int getTheirTradedItemCount () {
24022442 return client .getRemoteTradeItemCount ();
24032443 }
2404-
2444+ /**
2445+ * Retrieves the remote (the other person) trade itemID at the specified trade window index
2446+ *
2447+ * @param i the index of the remote trade item
2448+ * @return the remote trade item ID at the specified index, or -1 if the index is out of bounds
2449+ */
24052450 public int getRemoteTradeItemId (final int i ) {
24062451 if (i >= client .getRemoteTradeItemCount ()) {
24072452 return -1 ;
24082453 }
24092454 return client .getRemoteTradeItemId (i );
24102455 }
2411-
2456+ /**
2457+ * Retrieves the remote (the other person) trade item stack at the specified trade window index
2458+ *
2459+ * @param i the index of the remote item stack to retrieve
2460+ * @return the item stack at the specified index, or -1 if the index is
2461+ * out of range
2462+ */
24122463 public int getRemoteTradeItemStack (final int i ) {
24132464 if (i >= client .getRemoteTradeItemCount ()) {
24142465 return -1 ;
24152466 }
24162467 return client .getRemoteTradeItemStack (i );
24172468 }
2418-
2469+ /**
2470+ * Determines if the local(self) client has accepted the trade
2471+ *
2472+ * @return true if the client has a local accepted trade, false otherwise
2473+ */
24192474 public boolean hasLocalAcceptedTrade () {
24202475 if (isInTradeConfirm ()) {
24212476 return client .hasLocalConfirmedTrade ();
@@ -2432,7 +2487,11 @@ public boolean hasLocalAcceptedTrade() {
24322487 public boolean isInTradeConfirm () {
24332488 return client .isInTradeConfirm ();
24342489 }
2435-
2490+ /**
2491+ * Determines if the remote (the other person) trade has been accepted.
2492+ *
2493+ * @return true if the remote trade has been accepted, false otherwise.
2494+ */
24362495 public boolean hasRemoteAcceptedTrade () {
24372496 return client .hasRemoteAcceptedTrade ();
24382497 }
@@ -2649,7 +2708,16 @@ public void drawImage(final Image image, final int start_x, final int start_y) {
26492708 drawBuf (buf , start_x , start_y , client .getPixels (),
26502709 client .getGameWidth (), client .getGameHeight ());
26512710 }
2652-
2711+ /**
2712+ * Draws a portion of an image onto an array of pixels.
2713+ *
2714+ * @param image the source image to draw from
2715+ * @param start_x the starting x-coordinate of the portion to draw
2716+ * @param start_y the starting y-coordinate of the portion to draw
2717+ * @param pixels the array of pixels to draw onto
2718+ * @param rw the maximum width of the portion to draw
2719+ * @param rh the maximum height of the portion to draw
2720+ */
26532721 private static void drawBuf (final BufferedImage image ,
26542722 final int start_x , final int start_y ,
26552723 final int [] pixels , final int rw , final int rh ) {
@@ -2913,7 +2981,12 @@ public void sendPrivateMessage(final String msg, final String name) {
29132981 client .sendPrivateMessage (msg , name );
29142982 }
29152983 }
2916-
2984+ /**
2985+ * Determines whether a given name is a friend.
2986+ *
2987+ * @param name the name to check
2988+ * @return true if the name is a friend, false otherwise
2989+ */
29172990 public boolean isFriend (final String name ) {
29182991 final int count = StaticAccess .getInstance ().getFriendCount ();
29192992 for (int i = 0 ; i < count ; ++i ) {
@@ -2923,33 +2996,54 @@ public boolean isFriend(final String name) {
29232996 }
29242997 return false ;
29252998 }
2926-
2999+ /**
3000+ * Adds a friend with the given name.
3001+ *
3002+ * @param name the name of the friend to be added
3003+ */
29273004 public void addFriend (final String name ) {
29283005 final String lname = client .getPlayerName (client .getPlayer ());
29293006 if (name .length () > 0 && !name .equalsIgnoreCase (lname )) {
29303007 client .addFriend (name );
29313008 }
29323009 }
2933-
3010+ /**
3011+ * Removes a friend with the given name.
3012+ *
3013+ * @param name the name of the friend to be removed
3014+ */
29343015 public void removeFriend (final String name ) {
29353016 if (isFriend (name )) {
29363017 client .removeFriend (name );
29373018 }
29383019 }
2939-
3020+ /**
3021+ * Adds a player to the ignore list.
3022+ *
3023+ * @param name the name of the player to ignore
3024+ */
29403025 public void addIgnore (final String name ) {
29413026 final String lname = client .getPlayerName (client .getPlayer ());
29423027 if (name .length () > 0 && !name .equalsIgnoreCase (lname )) {
29433028 client .addIgnore (name );
29443029 }
29453030 }
2946-
3031+ /**
3032+ * Removes the specified name from the ignore list.
3033+ *
3034+ * @param name the name to be removed from the ignore list
3035+ */
29473036 public void removeIgnore (final String name ) {
29483037 if (isIgnored (name )) {
29493038 client .removeIgnore (name );
29503039 }
29513040 }
2952-
3041+ /**
3042+ * Determines if the given name is ignored.
3043+ *
3044+ * @param name the name to check
3045+ * @return true if the name is ignored, false otherwise
3046+ */
29533047 public boolean isIgnored (final String name ) {
29543048 final int count = StaticAccess .getInstance ().getIgnoredCount ();
29553049 for (int i = 0 ; i < count ; ++i ) {
0 commit comments