mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Merge branch 'fix-crystal-recharge' into 'master'
Fixes to crystal equipment: See merge request 2009scape/2009scape!283
This commit is contained in:
commit
d76a3080c7
3 changed files with 56 additions and 87 deletions
|
|
@ -5,6 +5,7 @@ import core.game.content.dialogue.FacialExpression;
|
|||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.quest.Quest;
|
||||
import core.game.node.item.Item;
|
||||
import org.rs09.consts.Items;
|
||||
|
||||
/**
|
||||
* Handles Eluned's Dialogue for Roving Elves.
|
||||
|
|
@ -54,8 +55,8 @@ public class ElunedDialogue extends DialoguePlugin {
|
|||
}
|
||||
break;
|
||||
case 1001:
|
||||
if (quest.getStage(player) >= 100) {
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I am looking to buy teleportation crystals.");
|
||||
if (quest.getStage(player) >= 100 && player.getInventory().contains(Items.TINY_ELF_CRYSTAL_6103, 1)) {
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I am looking to recharge teleportation crystals.");
|
||||
stage = 1200;
|
||||
} else {
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'm just looking around.");
|
||||
|
|
@ -76,23 +77,28 @@ public class ElunedDialogue extends DialoguePlugin {
|
|||
stage = 500;
|
||||
break;
|
||||
case 1200:
|
||||
interpreter.sendDialogues(1679, FacialExpression.HALF_GUILTY, "Very well. I'll sell you a brand new teleportation", "crystal for 750 gold. What do you say?");
|
||||
int timesRecharged = player.getAttribute("rovingelves:crystal-teleport-recharges", 0);
|
||||
int price = crystalTeleportPrice(timesRecharged);
|
||||
interpreter.sendDialogues(1679, FacialExpression.HALF_GUILTY, "Very well. I'll recharge your teleportation", String.format("crystal for %d gold. What do you say?", price));
|
||||
stage = 1202;
|
||||
break;
|
||||
case 1202:
|
||||
interpreter.sendOptions("Select an Option", "Buy a crystal", "Nevermind");
|
||||
interpreter.sendOptions("Select an Option", "Recharge a crystal", "Nevermind");
|
||||
stage = 1203;
|
||||
break;
|
||||
case 1203:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
stage = 1204;
|
||||
if (!player.getInventory().contains(995, 750)) {
|
||||
timesRecharged = player.getAttribute("rovingelves:crystal-teleport-recharges", 0);
|
||||
price = crystalTeleportPrice(timesRecharged);
|
||||
if (!player.getInventory().contains(995, price)) {
|
||||
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Actually, I don't have enough coins.");
|
||||
} else {
|
||||
interpreter.sendDialogue("You purchase an elven teleportation crystal for 750 gold.");
|
||||
if (player.getInventory().remove(new Item(995, 750))) {
|
||||
player.getInventory().add(new Item(6099, 1));
|
||||
interpreter.sendDialogue(String.format("Eluned recharges your elven teleportation crystal for %d gold.", price));
|
||||
if (player.getInventory().remove(new Item(Items.TINY_ELF_CRYSTAL_6103)) && player.getInventory().remove(new Item(995, price))) {
|
||||
player.getInventory().add(new Item(Items.TELEPORT_CRYSTAL_4_6099, 1));
|
||||
player.incrementAttribute("/save:rovingelves:crystal-teleport-recharges", 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -184,4 +190,9 @@ public class ElunedDialogue extends DialoguePlugin {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 750 for the 0th recharge, decreasing by 150 per recharge down to 150
|
||||
public int crystalTeleportPrice(int timesRecharged) {
|
||||
return Math.max(750 - 150 * timesRecharged, 150);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ public class IslwynDialogue extends DialoguePlugin {
|
|||
case 33:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
interpreter.sendDialogues(1680, FacialExpression.HALF_GUILTY, "Ah, very well.", "I will sell you a new bow or shield for 750,000 coins.");
|
||||
interpreter.sendDialogues(1680, FacialExpression.HALF_GUILTY, "Ah, very well.", "I will sell you a new bow or shield for 900,000 coins.");
|
||||
stage = 37;
|
||||
break;
|
||||
case 2:
|
||||
|
|
@ -269,13 +269,16 @@ public class IslwynDialogue extends DialoguePlugin {
|
|||
interpreter.sendDialogue("You don't have any seeds to recharge.");
|
||||
stage = 500;
|
||||
}
|
||||
if (!player.getInventory().contains(995, 500000)) {
|
||||
interpreter.sendDialogue("You don't have enough coins.");
|
||||
int timesRecharged = player.getAttribute("rovingelves:crystal-equip-recharges", 0);
|
||||
int price = crystalWeaponPrice(timesRecharged);
|
||||
if (!player.getInventory().contains(995, price)) {
|
||||
interpreter.sendDialogue(String.format("You don't have enough coins, you need %d.", price));
|
||||
stage = 500;
|
||||
}
|
||||
if (player.getInventory().contains(995, 500000) && player.getInventory().contains(RovingElves.CRYSTAL_SEED.getId(), 1)) {
|
||||
if (player.getInventory().remove(RovingElves.CRYSTAL_SEED) && player.getInventory().remove(new Item(995, 500000))) {
|
||||
if (player.getInventory().contains(995, price) && player.getInventory().contains(RovingElves.CRYSTAL_SEED.getId(), 1)) {
|
||||
if (player.getInventory().remove(RovingElves.CRYSTAL_SEED) && player.getInventory().remove(new Item(995, price))) {
|
||||
player.getInventory().add(new Item(4214, 1));
|
||||
player.incrementAttribute("/save:rovingelves:crystal-equip-recharges", 1);
|
||||
end();
|
||||
}
|
||||
}
|
||||
|
|
@ -285,13 +288,16 @@ public class IslwynDialogue extends DialoguePlugin {
|
|||
interpreter.sendDialogue("You don't have any seeds to recharge.");
|
||||
stage = 500;
|
||||
}
|
||||
if (!player.getInventory().contains(995, 500000)) {
|
||||
timesRecharged = player.getAttribute("rovingelves:crystal-equip-recharges", 0);
|
||||
price = crystalWeaponPrice(timesRecharged);
|
||||
if (!player.getInventory().contains(995, price)) {
|
||||
interpreter.sendDialogue("You don't have enough coins.");
|
||||
stage = 500;
|
||||
}
|
||||
if (player.getInventory().contains(995, 500000) && player.getInventory().contains(RovingElves.CRYSTAL_SEED.getId(), 1)) {
|
||||
if (player.getInventory().remove(RovingElves.CRYSTAL_SEED) && player.getInventory().remove(new Item(995, 500000))) {
|
||||
if (player.getInventory().contains(995, price) && player.getInventory().contains(RovingElves.CRYSTAL_SEED.getId(), 1)) {
|
||||
if (player.getInventory().remove(RovingElves.CRYSTAL_SEED) && player.getInventory().remove(new Item(995, price))) {
|
||||
player.getInventory().add(new Item(4225, 1));
|
||||
player.incrementAttribute("/save:rovingelves:crystal-equip-recharges", 1);
|
||||
end();
|
||||
}
|
||||
}
|
||||
|
|
@ -313,12 +319,13 @@ public class IslwynDialogue extends DialoguePlugin {
|
|||
}
|
||||
break;
|
||||
case 39:
|
||||
if (!player.getInventory().contains(995, 750000)) {
|
||||
price = crystalWeaponPrice(0);
|
||||
if (!player.getInventory().contains(995, price)) {
|
||||
interpreter.sendDialogue("You don't have enough coins.");
|
||||
stage = 500;
|
||||
}
|
||||
if (player.getInventory().contains(995, 750000)) {
|
||||
if (player.getInventory().remove(new Item(995, 750000))) {
|
||||
if (player.getInventory().contains(995, price)) {
|
||||
if (player.getInventory().remove(new Item(995, price))) {
|
||||
if (!player.getInventory().add(new Item(4214, 1))) {
|
||||
GroundItemManager.create(new Item(4214, 1), player);
|
||||
}
|
||||
|
|
@ -327,12 +334,13 @@ public class IslwynDialogue extends DialoguePlugin {
|
|||
}
|
||||
break;
|
||||
case 40:
|
||||
if (!player.getInventory().contains(995, 750000)) {
|
||||
price = crystalWeaponPrice(0);
|
||||
if (!player.getInventory().contains(995, price)) {
|
||||
interpreter.sendDialogue("You don't have enough coins.");
|
||||
stage = 500;
|
||||
}
|
||||
if (player.getInventory().contains(995, 750000)) {
|
||||
if (player.getInventory().remove(new Item(995, 750000))) {
|
||||
if (player.getInventory().contains(995, price)) {
|
||||
if (player.getInventory().remove(new Item(995, price))) {
|
||||
if (!player.getInventory().add(new Item(4225, 1))) {
|
||||
GroundItemManager.create(new Item(4225, 1), player);
|
||||
}
|
||||
|
|
@ -371,4 +379,9 @@ public class IslwynDialogue extends DialoguePlugin {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 900k for the 0th recharge (or for new bows), decreasing by 180k per recharge down to 180k
|
||||
public int crystalWeaponPrice(int timesRecharged) {
|
||||
return Math.max(900000 - 180000 * timesRecharged, 180000);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public final class TeleportCrystalPlugin extends OptionHandler {
|
|||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
if (true) {
|
||||
if (!WildernessZone.checkTeleport(player, 20)) {
|
||||
player.getPacketDispatch().sendMessage("The crystal is unresponsive.");
|
||||
return true;
|
||||
}
|
||||
|
|
@ -89,12 +89,10 @@ public final class TeleportCrystalPlugin extends OptionHandler {
|
|||
itemId = (Integer) args[1];
|
||||
switch ((Integer) args[0]) {
|
||||
case 1:
|
||||
interpreter.sendOptions("Select an Option", "Save your location", "Teleport to your location", "Contact Bill Teach", "Teleport to Lletya");
|
||||
interpreter.sendOptions("Select an Option", "Teleport to Lletya", "Cancel");
|
||||
stage = 100;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -106,68 +104,14 @@ public final class TeleportCrystalPlugin extends OptionHandler {
|
|||
case 100:
|
||||
switch(buttonId) {
|
||||
case 1:
|
||||
interpreter.sendDialogues(npc, null, "That'll cost you 100,000 coins, is that okay?");
|
||||
stage = 1000;
|
||||
break;
|
||||
case 2:
|
||||
player.getTeleporter().send(new Location(player.getGlobalData().getSavedX(), player.getGlobalData().getSavedY(), player.getGlobalData().getSavedH()), TeleportType.NORMAL);
|
||||
end();
|
||||
degrade(player, new Item(itemId));
|
||||
break;
|
||||
case 3:
|
||||
interpreter.sendDialogues(npc, null, "This will use up a charge of your crystal,", "are you sure you wish to continue?");
|
||||
stage = 3000;
|
||||
break;
|
||||
case 4:
|
||||
player.getTeleporter().send(new Location(2329, 3172), TeleportType.NORMAL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1000:
|
||||
interpreter.sendOptions("Select an Option", "Yes", "No");
|
||||
stage = 2000;
|
||||
break;
|
||||
case 2000:
|
||||
switch(buttonId) {
|
||||
case 1:
|
||||
if(player.getInventory().getAmount(995) >= 100000) {
|
||||
end();
|
||||
player.sendMessage("Your location has been saved succesfully!");
|
||||
player.getInventory().remove(new Item(995, 100000));
|
||||
player.getGlobalData().setSavedLocation(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());
|
||||
} else {
|
||||
interpreter.sendDialogues(npc, null, "I'm sorry, but you don't have enough coins", "to cover this.");
|
||||
stage = 7;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
interpreter.sendOptions("Select an Option", "Save your location", "Teleport to your location", "Contact Bill Teach", "Teleport to Lletya");
|
||||
stage = 100;
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
case 3000:
|
||||
interpreter.sendOptions("Select an Option", "Yes", "No");
|
||||
stage = 4000;
|
||||
break;
|
||||
|
||||
case 4000:
|
||||
switch(buttonId) {
|
||||
case 1:
|
||||
player.getDialogueInterpreter().open(billTeach.getId());
|
||||
degrade(player, new Item(itemId));
|
||||
break;
|
||||
case 2:
|
||||
interpreter.sendOptions("Select an Option", "Save your location", "Teleport to your location", "Contact Bill Teach", "Teleport to Lletya");
|
||||
stage = 100;
|
||||
break;
|
||||
break;
|
||||
case 2:
|
||||
end();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 7:
|
||||
end();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -187,7 +131,8 @@ public final class TeleportCrystalPlugin extends OptionHandler {
|
|||
p.getPacketDispatch().sendMessage("Your teleportation crystal has degraded from use.");
|
||||
} else {
|
||||
p.getInventory().remove(new Item(id, 1));
|
||||
p.getPacketDispatch().sendMessages("Your teleportation crystal has turned into dust,", "you can purchase a new one from Mama.");
|
||||
p.getInventory().add(new Item(newItem, 1));
|
||||
p.getPacketDispatch().sendMessages("Your teleportation crystal has degraded to a tiny elf crystal,", "Eluned can re-enchant it.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue