Post: [PI] Bounty Hunter Emblem Total Cost
03-10-2015, 01:54 AM #1
Stunz
Former Staff
(adsbygoogle = window.adsbygoogle || []).push({});
    	int value1 = 0;
int value2 = 0;
int value3 = 0;
int value4 = 0;
int value5 = 0;
int value6 = 0;
int value7 = 0;
int value8 = 0;
int value9 = 0;
int value10 = 0;
for (int i = 0; i < id.length; i++) {
if(c.getItems().playerHasItem(bounties[0][0], 1)
|| c.getItems().playerHasItem(bounties[1][0], 1)
|| c.getItems().playerHasItem(bounties[2][0], 1)
|| c.getItems().playerHasItem(bounties[3][0], 1)
|| c.getItems().playerHasItem(bounties[4][0], 1)
|| c.getItems().playerHasItem(bounties[5][0], 1)
|| c.getItems().playerHasItem(bounties[6][0], 1)
|| c.getItems().playerHasItem(bounties[7][0], 1)
|| c.getItems().playerHasItem(bounties[8][0], 1)
|| c.getItems().playerHasItem(bounties[9][0], 1)) {
value1 = c.getItems().getItemAmount(bounties[0][0]) * bounties[0][1];
value2 = c.getItems().getItemAmount(bounties[1][0]) * bounties[1][1];
value3 = c.getItems().getItemAmount(bounties[2][0]) * bounties[2][1];
value4 = c.getItems().getItemAmount(bounties[3][0]) * bounties[3][1];
value5 = c.getItems().getItemAmount(bounties[4][0]) * bounties[4][1];
value6 = c.getItems().getItemAmount(bounties[5][0]) * bounties[5][1];
value7 = c.getItems().getItemAmount(bounties[6][0]) * bounties[6][1];
value8 = c.getItems().getItemAmount(bounties[7][0]) * bounties[7][1];
value9 = c.getItems().getItemAmount(bounties[8][0]) * bounties[8][1];
value10 = c.getItems().getItemAmount(bounties[9][0]) * bounties[9][1];
}
bountyTotal = value1 + value2 + value3 + value4 + value5 + value6 + value7 + value8 + value9 + value10;
}
}
}



So heres a proper way to get the total price. (it will return to the total price of the bounties in player's inventory)

      public static final int getTotalPrice(Client player) {
int totalPrice = 0;
for (Bounties bounty : Bounties.values()) {
totalPrice += player.getItems().getItemAmount(bounty.getItemIndex()) * bounty.getBounties();
player.getItems().deleteItem(bounty.getItemIndex(),
player.getItems().getTotalCount(bounty.getItemIndex()));
}

return totalPrice;
}


Enum

    public enum Bounties {

TIER_1(12746, 50_000),
TIER_2(12748, 100_000),
TIER_3(12749, 200_000),
TIER_4(12750, 400_000),
TIER_5(12751, 750_000),
TIER_6(12752, 1_250_000),
TIER_7(12753, 1_750_000),
TIER_8(12754, 2_500_000),
TIER_9(12755, 3_500_000),
TIER_10(12756, 5_000_000);

private final int itemId;
private final int bounties;

private Bounties(int itemId, int bounties) {
this.itemId = itemId;
this.bounties = bounties;
}

public int getItemIndex() {
return itemId;
}

public int getBounties() {
return bounties;
}
}


Now if you want to add the points to player's inventory (emblems will be auto deleted) it would be like this:
     pointInteger += MyFile.getTotalPrice(client class);
(adsbygoogle = window.adsbygoogle || []).push({});

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo