This is how I would do it if I wanted to do what you're tying...
Code:
public int getNumberOfCapes()
{
int numberOfCapes = 0;
for (int i = 0; < NUMBEROFSKILLSINSERVER; i++)
{
if(c.playerXP[i] >= c.getPA().getXPForLevel(99))
{
numberOfCapes += 1;
}
}
return numberOfCapes;
}
After that just add the check in your current code like so:
Code:
case 847: //Cook
for (int i = 0; i < 1; i++) {
if(c.playerXP[7] <= c.getPA().getXPForLevel(99)) {
c.getDH().sendDialogues(1408,npcType); //A dialogue saying they need more levels
return;
}
}
for (int i = 0; i < 1; i++) {
if(c.playerXP[7] >= c.getPA().getXPForLevel(99)) {
c.getDH().sendDialogues(1409,npcType);
if(c.getNumberOfCapes() <= 1)
{
c.getItems().addItem(9801, 1); //cape untrimmed?
c.getItems().addItem(9803, 1); //hood?
} else {
//CREATE A METHOD & PLACE IT HERE
//THAT WILL DELETE ANY POSSIBLE
//OLD NON-TRIMMED CAPES FROM
//INVENTORY, BANK, OR EQUIPMENT SLOTS...
c.getItems().addItem(trimmedcape, 1);
c.getItems().addItem(hood, 1);
}
}
}
break;
That's all the tips I can give you and it should work. Good luck.