Thread: [718] Why does it spam the message?

Results 1 to 3 of 3
  1. #1 [718] Why does it spam the message? 
    Registered Member
    Join Date
    Apr 2014
    Posts
    89
    Thanks given
    26
    Thanks received
    6
    Rep Power
    11
    Title says it all, here's my code and a picture below;


    Code:
    public static final boolean checkRunes(Player player, boolean delete, int... runes) {
    	int weaponId = player.getEquipment().getWeaponId();
    	int shieldId = player.getEquipment().getShieldId();
    	int runesCount = 0;
    	while (runesCount < runes.length) {
    	    int runeId = runes[runesCount++];
    	    int amount = runes[runesCount++];
    	    if (hasInfiniteRunes(runeId, weaponId, shieldId))
    		continue;
    	    else if (hasSpecialRunes(player, runeId, amount))
    		continue;
    	    else if (hasStaffOfLight(weaponId) && Utils.getRandom(8) == 0 && runeId != 21773)
    		continue;
    	    if (!player.getInventory().containsItem(runeId, amount)) {
    			player.getPackets().sendGameMessage("You do not have enough " + ItemDefinitions.getItemDefinitions(runeId).getName().replace("rune", "Rune")+ "s to cast this spell.");
    			return false;
    		}
    	}
    	if (delete) {
    	    runesCount = 0;
    	    while (runesCount < runes.length) {
    		int runeId = runes[runesCount++];
    		int amount = runes[runesCount++];
    		if (hasInfiniteRunes(runeId, weaponId, shieldId))
    		    continue;
    		if (hasSpecialRunes(player, runeId, amount))
    		    runeId = getRuneForId(runeId);
    		player.getInventory().deleteItem(runeId, amount);
    	    }
    	}
    	return true;
        }

    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    May 2014
    Age
    26
    Posts
    256
    Thanks given
    89
    Thanks received
    61
    Rep Power
    12
    You've got it inside a loop
    Quote Originally Posted by _Original View Post
    Code:
    while (runesCount < runes.length) {
    Reply With Quote  
     

  3. #3  
    Donator


    Join Date
    Jul 2013
    Posts
    1,233
    Thanks given
    1
    Thanks received
    493
    Rep Power
    0
    Quote Originally Posted by AlexRSPS View Post
    You've got it inside a loop
    return false breaks that loop, something calling the method is repeating itself
    Reply With Quote  
     

  4. Thankful user:



Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 12
    Last Post: 02-20-2014, 01:28 PM
  2. Replies: 2
    Last Post: 08-24-2013, 01:22 AM
  3. Replies: 2
    Last Post: 02-20-2013, 08:07 AM
  4. Replies: 6
    Last Post: 08-01-2010, 01:03 AM
  5. Why does it keep doing this..
    By Mario in forum Help
    Replies: 0
    Last Post: 07-26-2009, 11:55 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •