Been a very long time since I was in the whole RSPS scene and I'm slowly easing myself back in & figured I might as well release my first real completed thing, edit to your server.
Nothing special, just a nice little addition to any server
Actionhandler
Code:
case 3709:
c.getDH().sendDialogues(500, npcType);
break;
Dialoguehandler
Code:
case 500:
sendOption3("Wilderness hats", "Skull me", "Kill count");
c.dialogueAction = 500;
break;
case 501:
sendNpcChat1("You've lost your hat, it seems.", c.talkingNpc, "Mr Ex");
c.nextChat = 502;
break;
case 502:
sendPlayerChat1("Yes, somewhere out there.");
c.nextChat = 503;
break;
case 503:
sendNpcChat1("Well, I don't mind getting it back for you...", c.talkingNpc, "Mr Ex");
c.nextChat = 504;
break;
case 504:
sendNpcChat1("It's not in the Wilderness, is it?", c.talkingNpc, "Mr Ex");
c.nextChat = 505;
break;
case 505:
sendNpcChat1("Ah, here we go, it's come home to me. Look after it.", c.talkingNpc, "Mr Ex");
c.nextChat = 506;
c.getItems().addItem(20801);
break;
case 506:
sendPlayerChat1("Thanks!");
c.nextChat = 507;
break;
case 507:
sendOption2("Tell me more about this hat, then.", "Farewell.");
c.dialogueAction = 507;
break;
case 508:
sendPlayerChat1("Farewell.");
c.nextChat = 0;
break;
case 509:
sendPlayerChat1("Tell me more about this hat, then.");
c.nextChat = 510;
break;
case 510:
sendNpcChat3("While you own this hat, your kills and deaths", "in the Wilderness will be recorded, as will your", "current kill streak.", c.talkingNpc, "Mr Ex");
c.nextChat = 511;
break;
case 511:
sendNpcChat3("You can use your hat to display your achievements", "by shouting out your record. If you wish to,", "you can instruct it not to show certain elements.", c.talkingNpc, "Mr Ex");
c.nextChat = 512;
break;
case 512:
sendPlayerChat1("Handy, thanks!");
c.nextChat = 0;
break;
case 513:
sendNpcChat2("You've still got that helmet I gave you? Good stuff.", "Better you than me out there, I say.", c.talkingNpc, "Mr Ex");
c.nextChat = 507;
break;
case 514:
sendOption2("Renew my PK skull.", "Actually, no, it's not a good idea.");
c.dialogueAction = 514;
break;
Clickingbuttons (Figure button Ids out)
Code:
case 514:
p.isSkulled = true;
p.skullTimer = Constants.SKULL_TIMER;
p.headIconPk = 0;
p.getPA().requestUpdates();
p.getPA().removeAllWindows();
break;
Code:
case 507:
p.getDH().sendDialogues(509, 3507);
break;
Code:
case 507:
p.getDH().sendDialogues(508, 8863);
break;
case 514:
p.getPA().removeAllWindows();
break;
Code:
case 500:
p.getDH().sendDialogues(514, -1);
break;
Code:
case 500:
p.getDH().sendStatement("You have "+p.getVariables().KC+" player kills.");
break;
ItemAssistant
Code:
public void addItemToBank(int itemId, int amount) {
for (int i = 0; i < Constants.BANK_SIZE; i++) {
if (c.getVariables().bankItems[i] <= 0 || c.getVariables().bankItems[i] == itemId + 1 && c.getVariables().bankItemsN[i] + amount < Integer.MAX_VALUE) {
c.getVariables().bankItems[i] = itemId + 1;
c.getVariables().bankItemsN[i] += amount;
resetBank();
return;
}
}
}
public void addItem(int itemId) {
if(c.getItems().freeSlots() <= 2) {
addItemToBank(itemId, 1);
} else {
addItem(itemId, 1);
}
}
public void replaceItem(int itemId, int newId) {
deleteItem(itemId, 1);
addItem(newId, 1);
}
public boolean hasItem(int i) {
if (playerHasItem(i) || hasBankItem(i)) {
return true;
}
return false;
}
public boolean playerHasItem(int itemID) {
itemID++;
for (int i = 0; i < c.getVariables().playerItems.length; i++) {
if (c.getVariables().playerItems[i] == itemID) {
return true;
}
}
return false;
}
public boolean hasBankItem(int itemID) {
for (int i1 = 0; i1 < c.getVariables().bankItems.length; i1++) {
if(c.getVariables().bankItems[i1]-1 == itemID && c.getVariables().bankItemsN[i1] >= 1) {
return true;
}
}
return false;
}
ItemClick2
Code:
case 20801:
case 20802:
case 20803:
case 20804:
case 20805:
case 20806:
c.sendMessage("Current Kills - @red@"+c.getVariables().KC+"@bla@.");
c.sendMessage("Current Deaths - @red@"+c.getVariables().DC+"@bla@.");
c.sendMessage("Current Kill streak - @red@"+c.killStreak+"@bla@.");
c.forcedChat("I have "+c.getVariables().KC+" kills and a "+c.killStreak+" kill streak!");
c.startAnimation(2417);//Loyalty Muscleman emote, change if you don't have 667+ Anims
break;
ItemClick3
Code:
case 20801:
case 20802:
case 20803:
case 20804:
case 20805:
case 20806:
c.getWSH().switchHelmet(itemId);
break;
WildstalkerHelmet.java
Code:
package com.exile.game.players.content;
import com.exile.game.players.Player;
public class WildstalkerHelmet {
private Player c;
public WildstalkerHelmet(Player client) {
this.c = client;
}
public enum Helmets {
TIER_1(20801, 10, 20802),
TIER_2(20802, 50, 20803),
TIER_3(20803, 100, 20804),
TIER_4(20804, 250, 20805),
TIER_5(20805, 500, 20806),
TIER_6(20806, 500, 20801);
int iD;
int kR;
int nI;
Helmets(int iD, int kR, int nI) {
this.iD = iD;
this.kR = kR;
this.nI = nI;
}
public int getId() {
return iD;
}
public int getKillReq() {
return kR;
}
public int nextId() {
return nI;
}
}
public void switchHelmet(int Id) {
for (final Helmets h : Helmets.values())
if(Id == h.getId()) {
if(c.getVariables().KC >= h.getKillReq()) {
c.getItems().replaceItem(h.getId(), h.nextId());
} else {
c.getItems().replaceItem(h.getId(), 20801);
c.sendMessage("You need "+h.getKillReq()+" kills to advance to the next tier. Current kill count - "+c.getVariables().KC);
}
}
}
}
And I believe that's it, only things you have to do is figure out what button is which, I have a completely different dialogue button handling system that's why I didn't include and to handle all of your bonus' stuff.
ALSO, forgot to make it check to see if the hood is equipped when checking if you have the item. Might want to add that.