Plank unnote wip but it's just too much trash

This commit is contained in:
Player Name 2026-04-27 14:13:05 +02:00
parent ad99ce2cc6
commit 24beca35c4

View file

@ -29,10 +29,15 @@ import org.rs09.consts.Items;
*/
public class HouseServantDialogue extends DialoguePlugin {
/**
* If using the sawmill or unnoting planks.
* If going outside to run logs by the sawmill or unnote planks at the bank.
*/
private boolean fetchRun;
/**
* If making planks.
*/
private boolean sawmill;
/**
* The logs or noted planks.
*/
@ -68,6 +73,7 @@ public class HouseServantDialogue extends DialoguePlugin {
if (args.length > 1) { //Parse options from our "use-with" handler
fetchRun = (boolean) args[1];
fetchItem = (Item) args[2];
sawmill = fetchRun && !fetchItem.getDefinition().isUnnoted();
}
if (player.getIronmanManager().checkRestriction(IronmanMode.ULTIMATE)) {
player.sendMessage("Ultimate Ironmen cannot hire butlers.");
@ -95,11 +101,16 @@ public class HouseServantDialogue extends DialoguePlugin {
}
if (inHouse) {
follow(player, servant);
if (fetchRun) {
if (sawmill) {
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Very well, I will take these logs to the mill and", "have them converted into planks.");
stage = 110;
return true;
}
}
if (fetchRun) {
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "Shall I redeem that certificate for " + (player.isMale() ? "sir" : "madam"));
stage = 200;
return true;
}
if (servant.getItem().getAmount() > 0) {
if(player.getInventory().freeSlots() < 1){
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I have returned with what you asked me to", "retrieve. As I see your inventory is full, I shall wait", "with these " + servant.getItem().getAmount()+" items until you are ready.");
@ -404,11 +415,26 @@ public class HouseServantDialogue extends DialoguePlugin {
if (flag) {
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I still have " + servant.getItem().getAmount() + " left for you to take from me.");
stage = 100;
} else{
} else {
end();
}
break;
case 200:
options("Yes", "No, just take it to the bank", "No, never mind");
stage++;
break;
case 201:
switch (buttonId) {
case 1:
// Enter amount
case 2:
case 3:
break;
}
break;
}
case 202:
// I regret that I am only able to carry 20 items, sir
return true;
}
@ -457,49 +483,65 @@ public class HouseServantDialogue extends DialoguePlugin {
HouseManager manager = player.getHouseManager();
final Servant servant = manager.getServant();
final ServantType type = manager.getServant().getType();
final boolean sawmill = item.isNoted();
if (servant == null || item == null || !prereqs(player, item, true)) {
if (!prereqs(player, item, true)) {
return;
}
if (sawmill && (type == ServantType.MAID || type == ServantType.RICK)) {
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I am unable to take logs to the sawmill.");
return;
}
int amt = player.getInventory().getAmount(item);
if (amt < 1) {
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You don't have any more of that type of log.");
return;
}
for (Plank plank : Plank.values()) {
if (plank.getLog().getId() == item.getId()) {
if (amt > type.getCapacity()) {
amt = type.getCapacity();
if (sawmill) {
if (type == ServantType.MAID || type == ServantType.RICK) {
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "I am unable to take logs to the sawmill.");
return;
}
int amt = Math.min(player.getInventory().getAmount(item), type.getCapacity());
if (amt < 1) {
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You don't have any more of that type of log.");
return;
}
for (Plank plank : Plank.values()) {
if (plank.getLog().getId() == item.getId()) {
if (!player.getInventory().contains(995, plank.getPrice() * amt)) {
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You don't have enough coins for me to do that.", "I can hold " + type.getCapacity() + " logs and each of this type of log", "costs " + plank.getPrice() + " coins each to convert into plank form.");
return;
}
end();
if (player.getInventory().remove(new Item(item.getId(), amt)) && player.getInventory().remove(new Item(Items.COINS_995, amt * plank.getPrice()))) {
servant.setInvisible(true);
servant.getLocks().lockMovement(100);
GameWorld.getPulser().submit(new Pulse((int) (type.getTimer() / 0.6)){
@Override
public boolean pulse() {
servant.setInvisible(false);
servant.getLocks().unlockMovement();
manager.getServant().setItem(new Item(plank.getPlank().getId(), amt));
interpreter.open(servant.getId(), servant);
servant.setAttribute("con:lastfetch", new Item(item.getId(), 1));
servant.setAttribute("con:lastfetchtype", "sawmill");
manager.getServant().setUses(manager.getServant().getUses() + 1);
follow(player, servant);
return true;
}
});
}
break;
}
if (!player.getInventory().contains(995, plank.getPrice() * amt)) {
interpreter.sendDialogues(servant, servant.getId() == 4243 ? FacialExpression.HALF_GUILTY : null, "You don't have enough coins for me to do that.", "I can hold " + type.getCapacity() + " logs and each of this type of log", "costs " + plank.getPrice() + " coins each to convert into plank form.");
return;
}
end();
if (player.getInventory().remove(new Item(item.getId(), amt)) && player.getInventory().remove(new Item(Items.COINS_995, amt * plank.getPrice()))) {
servant.setInvisible(true);
servant.getLocks().lockMovement(100);
int finalAmt = amt;
GameWorld.getPulser().submit(new Pulse((int) (type.getTimer() / 0.6)){
@Override
public boolean pulse() {
servant.setInvisible(false);
servant.getLocks().unlockMovement();
manager.getServant().setItem(new Item(plank.getPlank().getId(), finalAmt));
interpreter.open(servant.getId(), servant);
servant.setAttribute("con:lastfetch", new Item(item.getId(), 1));
servant.setAttribute("con:lastfetchtype", "sawmill");
manager.getServant().setUses(manager.getServant().getUses() + 1);
follow(player, servant);
return true;
}
});
}
break;
}
} else { //just unnote
int amt = Math.min(item.getAmount(), type.getCapacity());
if (player.getInventory().remove(new Item(item.getId(), amt))) {
servant.setInvisible(true);
servant.getLocks().lockMovement(100);
GameWorld.getPulser().submit(new Pulse((int) (type.getTimer() / 0.6)){
@Override
public boolean pulse() {
servant.setInvisible(false);
servant.getLocks().unlockMovement();
manager.getServant().setItem(new Item(item.getId()-1, amt));
interpreter.open(servant.getId(), servant);
// Purposefully not setting last fetch
manager.getServant().setUses(manager.getServant().getUses() + 1);
follow(player, servant);
return true;
}
});
}
}
}