Commit 8a05b1b4 authored by Marwolf's avatar Marwolf 💬

Merge branch '2.0.0' into '2.0.0'

Fix several particular Shield Arrav behaviors

Closes #2204, #2202, #2200, #2199, #2198, #2196, #2193, and #2192

See merge request !2228
parents 626f134e 97bc3493
......@@ -3,6 +3,7 @@ package com.openrsc.server.plugins.npcs;
import com.openrsc.server.model.entity.GroundItem;
import com.openrsc.server.model.entity.npc.Npc;
import com.openrsc.server.model.entity.player.Player;
import com.openrsc.server.model.world.World;
import com.openrsc.server.plugins.listeners.action.PickupListener;
import com.openrsc.server.plugins.listeners.action.PlayerAttackNpcListener;
import com.openrsc.server.plugins.listeners.action.TalkToNpcListener;
......@@ -10,10 +11,11 @@ import com.openrsc.server.plugins.listeners.executive.PickupExecutiveListener;
import com.openrsc.server.plugins.listeners.executive.PlayerAttackNpcExecutiveListener;
import com.openrsc.server.plugins.listeners.executive.TalkToNpcExecutiveListener;
import static com.openrsc.server.plugins.quests.free.ShieldOfArrav.*;
import static com.openrsc.server.plugins.Functions.*;
import static com.openrsc.server.plugins.quests.free.ShieldOfArrav.isBlackArmGang;
import static com.openrsc.server.plugins.quests.free.ShieldOfArrav.isPhoenixGang;
import com.openrsc.server.Constants.Quests;
import com.openrsc.server.external.ItemId;
import com.openrsc.server.external.NpcId;
......@@ -42,17 +44,27 @@ public class WeaponMaster implements TalkToNpcListener, TalkToNpcExecutiveListen
@Override
public boolean blockPickup(Player p, GroundItem i) {
return (i.getX() == 107 || i.getX() == 105) && i.getY() == 1476 && getNearestNpc(p, NpcId.WEAPONSMASTER.id(), 20) != null;
return (i.getX() == 107 || i.getX() == 105) && i.getY() == 1476
&& i.getID() == ItemId.PHOENIX_CROSSBOW.id();
}
@Override
public void onPickup(Player p, GroundItem i) {
if ((i.getX() == 107 || i.getX() == 105) && i.getY() == 1476) {
if ((i.getX() == 107 || i.getX() == 105) && i.getY() == 1476 && i.getID() == ItemId.PHOENIX_CROSSBOW.id()) {
Npc weaponMaster = getNearestNpc(p, NpcId.WEAPONSMASTER.id(), 20);
if (weaponMaster != null && (!p.getCache().hasKey("arrav_gang") || isBlackArmGang(p))) {
npcTalk(p, weaponMaster, "Hey Thief!");
if (weaponMaster == null) {
World.getWorld().unregisterItem(i);
addItem(p, ItemId.PHOENIX_CROSSBOW.id(), 1);
if (p.getCache().hasKey("arrav_mission") && (p.getCache().getInt("arrav_mission") & 1) == BLACKARM_MISSION) {
p.getCache().set("arrav_gang", BLACK_ARM);
p.updateQuestStage(Quests.SHIELD_OF_ARRAV, 4);
p.getCache().remove("arrav_mission");
p.getCache().remove("spoken_tramp");
}
} else if (!p.getCache().hasKey("arrav_gang") || isBlackArmGang(p)) {
npcTalk(p, weaponMaster, "Hey thief!");
weaponMaster.setChasing(p);
} else if (weaponMaster != null && isPhoenixGang(p)) {
} else if (isPhoenixGang(p)) {
npcTalk(p, weaponMaster, "Hey, that's Straven's",
"He won't like you messing with that");
}
......
......@@ -68,13 +68,15 @@ public class ManPhoenix implements TalkToNpcExecutiveListener,
"Have this spare");
addItem(p, ItemId.PHOENIX_GANG_WEAPON_KEY.id(), 1);
message(p, "Straven hands you a key");
} else if (p.getQuestStage(Quests.SHIELD_OF_ARRAV) == 4 && isPhoenixGang(p)) {
} else if ((p.getQuestStage(Quests.SHIELD_OF_ARRAV) == 4 && isPhoenixGang(p))
|| (p.getCache().hasKey("arrav_mission") && (p.getCache().getInt("arrav_mission") & 2) == PHOENIX_MISSION)) {
npcTalk(p, n, "Hows your little mission going?");
if (p.getInventory().hasItemId(ItemId.SCROLL.id())) {
playerTalk(p, n, "I have the intelligence report");
npcTalk(p, n, "Lets see it then");
message(p, "You hand over the report");
removeItem(p, ItemId.SCROLL.id(), 1);
message(p, "The man reads the report");
npcTalk(p, n, "Yes this is very good",
"Ok you can join the phoenix gang",
"I am Straven, one of the gang leaders");
......@@ -85,6 +87,12 @@ public class ManPhoenix implements TalkToNpcExecutiveListener,
npcTalk(p, n, "It will let you enter our weapon supply area",
"Round the front of this building");
p.updateQuestStage(Quests.SHIELD_OF_ARRAV, 5);
if (p.getCache().hasKey("arrav_mission")) {
p.getCache().remove("arrav_mission");
}
if (p.getCache().hasKey("spoken_tramp")) {
p.getCache().remove("spoken_tramp");
}
} else {
playerTalk(p, n, "I haven't managed to find the report yet");
npcTalk(p, n,
......@@ -160,19 +168,6 @@ public class ManPhoenix implements TalkToNpcExecutiveListener,
n,
"Heh you can't go in there",
"Only authorised personnel of the VTAM corporation are allowed beyond this point");
defaultMenu.addOption(new Option(
"How do I get a job with the VTAM corporation?") {
public void action() {
npcTalk(p, n, "Get a copy of the Varrock Herald",
"If we have any positions right now",
"They'll be advertised in there");
}
});
defaultMenu.addOption(new Option("Why not?") {
public void action() {
npcTalk(p, n, "Sorry that is classified information");
}
});
if (p.getQuestStage(Constants.Quests.SHIELD_OF_ARRAV) == 3) {
defaultMenu.addOption(new Option("I know who you are") {
public void action() {
......@@ -204,9 +199,11 @@ public class ManPhoenix implements TalkToNpcExecutiveListener,
"By the south entrance to this city",
"The name of the contact is Jonny the beard",
"Kill him and bring back his intelligence report");
p.getCache().set("arrav_gang", PHOENIX_GANG);
p.updateQuestStage(Quests.SHIELD_OF_ARRAV, 4);
p.getCache().remove("spoken_tramp");
if (p.getCache().hasKey("arrav_mission")) {
p.getCache().set("arrav_mission", ANY_MISSION);
} else {
p.getCache().set("arrav_mission", PHOENIX_MISSION);
}
playerTalk(p, n, "Ok, I'll get on it");
}
},
......@@ -222,6 +219,19 @@ public class ManPhoenix implements TalkToNpcExecutiveListener,
}
});
}
defaultMenu.addOption(new Option(
"How do I get a job with the VTAM corporation?") {
public void action() {
npcTalk(p, n, "Get a copy of the Varrock Herald",
"If we have any positions right now",
"They'll be advertised in there");
}
});
defaultMenu.addOption(new Option("Why not?") {
public void action() {
npcTalk(p, n, "Sorry that is classified information");
}
});
defaultMenu.showMenu(p);
}
......
......@@ -27,7 +27,7 @@ public final class Reldo implements TalkToNpcListener,
public void onTalkToNpc(final Player p, final Npc n) {
Menu defaultMenu = new Menu();
if (p.getCache().hasKey("read_arrav")
&& p.getQuestStage(Quests.SHIELD_OF_ARRAV) == 1) {
&& p.getQuestStage(Quests.SHIELD_OF_ARRAV) == 1 || p.getQuestStage(Quests.SHIELD_OF_ARRAV) == 2) {
playerTalk(p, n, "OK I've read the book",
"Do you know where I can find the Phoenix Gang");
npcTalk(p, n, "No I don't",
......@@ -35,7 +35,9 @@ public final class Reldo implements TalkToNpcListener,
"Talk to Baraek, the fur trader in the market place",
"I've heard he has connections with the Phoenix Gang");
playerTalk(p, n, "Thanks, I'll try that");
p.updateQuestStage(Quests.SHIELD_OF_ARRAV, 2);
if (p.getQuestStage(Quests.SHIELD_OF_ARRAV) == 1) {
p.updateQuestStage(Quests.SHIELD_OF_ARRAV, 2);
}
return;
}
playerTalk(p, n, "Hello");
......
......@@ -48,7 +48,7 @@ public final class Constants {
NpcId.KING_SCORPION.id(), NpcId.DONNY_THE_LAD.id(), NpcId.SPEEDY_KEITH.id(), NpcId.BLACK_HEATHER.id(), NpcId.ZOMBIE_INVOKED.id(),
NpcId.ZOMBIE_ENTRANA.id(), NpcId.ZOMBIE_LVL32.id(), NpcId.ZOMBIE_WMAZEKEY.id(), NpcId.GIANT_BAT.id(), NpcId.DEATH_WING.id(),
NpcId.RAT_LVL13.id(), NpcId.RAT_WMAZEKEY.id(), NpcId.HOBGOBLIN_LVL32.id(), NpcId.OTHERWORLDLY_BEING.id(),
NpcId.WYSON_THE_GARDENER.id(), NpcId.STRAVEN.id()
NpcId.WYSON_THE_GARDENER.id(), NpcId.STRAVEN.id(), NpcId.JONNY_THE_BEARD.id()
};
/**
* Strikes, Bolts & Blast Spells.
......
......@@ -396,9 +396,9 @@ public class Inventory {
boolean ableToWield = true;
boolean bypass = !Constants.GameServer.STRICT_CHECK_ALL &&
(itemLower.startsWith("poisoned") &&
(itemLower.endsWith("throwing dart") && !Constants.GameServer.STRICT_PDART_CHECK) ||
((itemLower.endsWith("throwing dart") && !Constants.GameServer.STRICT_PDART_CHECK) ||
(itemLower.endsWith("throwing knife") && !Constants.GameServer.STRICT_PKNIFE_CHECK) ||
(itemLower.endsWith("spear") && !Constants.GameServer.STRICT_PSPEAR_CHECK)
(itemLower.endsWith("spear") && !Constants.GameServer.STRICT_PSPEAR_CHECK))
);
if (itemLower.endsWith("spear") || itemLower.endsWith("throwing knife")) {
......@@ -406,7 +406,7 @@ public class Inventory {
optionalSkillIndex = Optional.of(Skills.ATTACK);
}
//staff of iban (usable)
if (item.getID() == 1000) {
if (item.getID() == ItemId.STAFF_OF_IBAN.id()) {
optionalLevel = Optional.of(requiredLevel);
optionalSkillIndex = Optional.of(Skills.ATTACK);
}
......@@ -435,20 +435,20 @@ public class Inventory {
player.message("Perhaps I should get someone to adjust it for me");
ableToWield = false;
}
if ((item.getID() == 401 || item.getID() == 407)
if ((item.getID() == ItemId.RUNE_PLATE_MAIL_BODY.id() || item.getID() == ItemId.RUNE_PLATE_MAIL_TOP.id())
&& (player.getQuestStage(Constants.Quests.DRAGON_SLAYER) != -1)) {
player.message("you have not earned the right to wear this yet");
player.message("you need to complete the dragon slayer quest");
return;
} else if (item.getID() == 593 && player.getQuestStage(Constants.Quests.LOST_CITY) != -1) {
} else if (item.getID() == ItemId.DRAGON_SWORD.id() && player.getQuestStage(Constants.Quests.LOST_CITY) != -1) {
player.message("you have not earned the right to wear this yet");
player.message("you need to complete the Lost city of zanaris quest");
return;
} else if (item.getID() == 594 && player.getQuestStage(Constants.Quests.HEROS_QUEST) != -1) {
} else if (item.getID() == ItemId.DRAGON_AXE.id() && player.getQuestStage(Constants.Quests.HEROS_QUEST) != -1) {
player.message("you have not earned the right to wear this yet");
player.message("you need to complete the Hero's guild entry quest");
return;
} else if (item.getID() == 1278 && player.getQuestStage(Constants.Quests.LEGENDS_QUEST) != -1) {
} else if (item.getID() == ItemId.DRAGON_SQUARE_SHIELD.id() && player.getQuestStage(Constants.Quests.LEGENDS_QUEST) != -1) {
player.message("you have not earned the right to wear this yet");
player.message("you need to complete the legend's guild quest");
return;
......@@ -456,22 +456,22 @@ public class Inventory {
/*
* Hacky but works for god staffs and god capes.
*/
else if (item.getID() == 1217 && (wielding(1213) || wielding(1214))) { // try to wear guthix staff
else if (item.getID() == ItemId.STAFF_OF_GUTHIX.id() && (wielding(ItemId.ZAMORAK_CAPE.id()) || wielding(ItemId.SARADOMIN_CAPE.id()))) { // try to wear guthix staff
player.message("you may not wield this staff while wearing a cape of another god");
return;
} else if (item.getID() == 1218 && (wielding(1213) || wielding(1215))) { // try to wear sara staff
} else if (item.getID() == ItemId.STAFF_OF_SARADOMIN.id() && (wielding(ItemId.ZAMORAK_CAPE.id()) || wielding(ItemId.GUTHIX_CAPE.id()))) { // try to wear sara staff
player.message("you may not wield this staff while wearing a cape of another god");
return;
} else if (item.getID() == 1216 && (wielding(1214) || wielding(1215))) { // try to wear zamorak staff
} else if (item.getID() == ItemId.STAFF_OF_ZAMORAK.id() && (wielding(ItemId.SARADOMIN_CAPE.id()) || wielding(ItemId.GUTHIX_CAPE.id()))) { // try to wear zamorak staff
player.message("you may not wield this staff while wearing a cape of another god");
return;
} else if (item.getID() == 1215 && (wielding(1216) || wielding(1218))) { // try to wear guthix cape
} else if (item.getID() == ItemId.GUTHIX_CAPE.id() && (wielding(ItemId.STAFF_OF_ZAMORAK.id()) || wielding(ItemId.STAFF_OF_SARADOMIN.id()))) { // try to wear guthix cape
player.message("you may not wear this cape while wielding staffs of the other gods");
return;
} else if (item.getID() == 1214 && (wielding(1216) || wielding(1217))) { // try to wear sara cape
} else if (item.getID() == ItemId.SARADOMIN_CAPE.id() && (wielding(ItemId.STAFF_OF_ZAMORAK.id()) || wielding(ItemId.STAFF_OF_GUTHIX.id()))) { // try to wear sara cape
player.message("you may not wear this cape while wielding staffs of the other gods");
return;
} else if (item.getID() == 1213 && (wielding(1217) || wielding(1218))) { // try to wear zamorak cape
} else if (item.getID() == ItemId.ZAMORAK_CAPE.id() && (wielding(ItemId.STAFF_OF_GUTHIX.id()) || wielding(ItemId.STAFF_OF_SARADOMIN.id()))) { // try to wear zamorak cape
player.message("you may not wear this cape while wielding staffs of the other gods");
return;
}
......
......@@ -730,16 +730,16 @@ public final class Player extends Mob {
boolean unWield = false;
boolean bypass = !Constants.GameServer.STRICT_CHECK_ALL &&
(itemLower.startsWith("poisoned") &&
(itemLower.endsWith("throwing dart") && !Constants.GameServer.STRICT_PDART_CHECK) ||
((itemLower.endsWith("throwing dart") && !Constants.GameServer.STRICT_PDART_CHECK) ||
(itemLower.endsWith("throwing knife") && !Constants.GameServer.STRICT_PKNIFE_CHECK) ||
(itemLower.endsWith("spear") && !Constants.GameServer.STRICT_PSPEAR_CHECK)
(itemLower.endsWith("spear") && !Constants.GameServer.STRICT_PSPEAR_CHECK))
);
if (itemLower.endsWith("spear") || itemLower.endsWith("throwing knife")) {
optionalLevel = Optional.of(requiredLevel <= 10 ? requiredLevel : requiredLevel + 5);
optionalSkillIndex = Optional.of(Skills.ATTACK);
}
//staff of iban (usable)
if (item.getID() == 1000) {
if (item.getID() == ItemId.STAFF_OF_IBAN.id()) {
optionalLevel = Optional.of(requiredLevel);
optionalSkillIndex = Optional.of(Skills.ATTACK);
}
......@@ -2716,13 +2716,6 @@ public final class Player extends Mob {
return false;
}
if (item.getID() == 59 && item.getX() == 106 && item.getY() == 1476) {
Npc n = world.getNpc(37, 103, 107, 1476, 1479);
if (n != null && !n.inCombat()) {
n.getUpdateFlags().setChatMessage(new ChatMessage(n, "Hey thief!", this));
n.setChasing(this);
}
}
world.unregisterItem(item);
this.playSound("takeobject");
this.getInventory().add(itemFinal);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment