Reintroduced PvP to level 49 deep wilderness and above (beyond the gate)
Traveling into the PvP area will auto-skull the player, but only whilst they remain in the area PvP in the deep wilderness does not apply a hard skull Deep wilderness soft skull is removed immediately upon leaving the deep wilderness Gates into the deep wilderness now give a warning about the danger of entering Gates allowing exit from the deep wilderness will not allow a player to leave if they are in combat The obelisk teleporter in the deep wilderness will not allow a player to use it if they are in combat All NPCs in the deep wilderness now drop PvP gear and brawlers The drop rate of PvP gear and brawlers in the deep wilderness has been boosted Fixed an issue that allowed PvP outside of explicit PvP scenarios
This commit is contained in:
@@ -86,6 +86,8 @@ import static core.api.ContentAPIKt.*;
|
||||
import static core.game.system.command.sets.StatAttributeKeysKt.STATS_BASE;
|
||||
import static core.game.system.command.sets.StatAttributeKeysKt.STATS_DEATHS;
|
||||
import static core.tools.GlobalsKt.colorize;
|
||||
import static core.game.world.map.zone.impl.WildernessZone.WILDERNESS_PROT_ATTR;
|
||||
import static core.game.world.map.zone.impl.WildernessZone.WILDERNESS_HIGHER_NEXTFEE;
|
||||
|
||||
/**
|
||||
* Represents a player entity.
|
||||
@@ -549,6 +551,16 @@ public class Player extends Entity {
|
||||
return this.getIndex() | 0x8000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttack (Entity e) {
|
||||
if (e instanceof Player) {
|
||||
Player p = (Player) e;
|
||||
if (skullManager.isWildernessDisabled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CombatSwingHandler getSwingHandler(boolean swing) {
|
||||
CombatStyle style = getProperties().getCombatPulse().getStyle();
|
||||
@@ -716,6 +728,18 @@ public class Player extends Entity {
|
||||
if (entity instanceof NPC && !((NPC) entity).getDefinition().hasAction("attack") && !((NPC) entity).isIgnoreAttackRestrictions(this)) {
|
||||
return false;
|
||||
}
|
||||
if (entity instanceof Player) {
|
||||
Player p = (Player) entity;
|
||||
if (p.getSkullManager().isWilderness() && skullManager.isWilderness()) {
|
||||
if (!GameWorld.getSettings().getWild_pvp_enabled())
|
||||
return false;
|
||||
if (p.getSkullManager().hasWildernessProtection())
|
||||
return false;
|
||||
if (skullManager.hasWildernessProtection())
|
||||
return false;
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,14 @@ package core.game.node.entity.player.link;
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.state.EntityState;
|
||||
import core.ServerConstants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.tools.GlobalsKt.colorize;
|
||||
import static core.game.world.map.zone.impl.WildernessZone.WILDERNESS_PROT_ATTR;
|
||||
|
||||
/**
|
||||
* Represents a managing class of the active player skulls.
|
||||
* @author Vexia
|
||||
@@ -49,6 +53,8 @@ public final class SkullManager {
|
||||
*/
|
||||
private boolean skullCheckDisabled;
|
||||
|
||||
private boolean deepWilderness;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SkullManager} {@code Object}.
|
||||
* @param player the player.
|
||||
@@ -95,6 +101,7 @@ public final class SkullManager {
|
||||
skullCauses.clear();
|
||||
setSkullIcon(-1);
|
||||
setSkulled(false);
|
||||
player.getAppearance().sync();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,6 +125,10 @@ public final class SkullManager {
|
||||
* @param level the level to set.
|
||||
*/
|
||||
public void setLevel(int level) {
|
||||
if (!deepWilderness && level >= 49)
|
||||
setDeepWilderness(true);
|
||||
else if (deepWilderness && level < 48)
|
||||
setDeepWilderness(false);
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@@ -161,6 +172,10 @@ public final class SkullManager {
|
||||
return wildernessDisabled;
|
||||
}
|
||||
|
||||
public boolean hasWildernessProtection() {
|
||||
return level < 49;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the wildernessDisabled.
|
||||
* @param wildernessDisabled The wildernessDisabled to set.
|
||||
@@ -174,9 +189,19 @@ public final class SkullManager {
|
||||
* @return The skulled.
|
||||
*/
|
||||
public boolean isSkulled() {
|
||||
return skulled;
|
||||
return skulled || deepWilderness;
|
||||
}
|
||||
|
||||
public boolean isDeepWilderness() {
|
||||
return deepWilderness;
|
||||
}
|
||||
|
||||
public void setDeepWilderness (boolean deepWildy) {
|
||||
setSkullIcon(deepWildy ? 1 : skulled ? 0 : -1);
|
||||
setSkullCheckDisabled(deepWildy);
|
||||
deepWilderness = deepWildy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the skulled.
|
||||
* @param skulled The skulled to set.
|
||||
|
||||
@@ -39,6 +39,9 @@ public final class WildernessZone extends MapZone {
|
||||
*/
|
||||
private static final WildernessZone INSTANCE = new WildernessZone(new ZoneBorders(2944, 3525, 3400, 3975), new ZoneBorders(3070, 9924, 3135, 10002), ZoneBorders.forRegion(12193), ZoneBorders.forRegion(11937));
|
||||
|
||||
public static final String WILDERNESS_PROT_ATTR = "/save:wilderness-protection-active";
|
||||
public static final String WILDERNESS_HIGHER_NEXTFEE = "/save:wilderness-higher-next-fee";
|
||||
|
||||
/**
|
||||
* The zone borders.
|
||||
*/
|
||||
@@ -69,7 +72,7 @@ public final class WildernessZone extends MapZone {
|
||||
double x = combatLevel;
|
||||
double A = 44044.5491;
|
||||
double B = -7360.19548;
|
||||
return (int) (A + (B * Math.log(x))) / 2;
|
||||
return (int) (A + (B * Math.log(x)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,33 +90,40 @@ public final class WildernessZone extends MapZone {
|
||||
}
|
||||
|
||||
private void rollWildernessExclusiveLoot(Entity e, Entity killer) {
|
||||
//Roll for PVP gear and Brawling Gloves from revenants
|
||||
if (e instanceof NPC && killer instanceof Player && (e.asNpc().getName().contains("Revenant") || e.getId() == NPCs.CHAOS_ELEMENTAL_3200)) {
|
||||
if (!(killer instanceof Player)) return;
|
||||
|
||||
boolean isDeepWildy = ((Player) killer).getSkullManager().isDeepWilderness();
|
||||
boolean isValidTarget = e instanceof NPC && (isDeepWildy || e.asNpc().getName().contains("Revenant") || e.getId() == NPCs.CHAOS_ELEMENTAL_3200);
|
||||
|
||||
if (!isValidTarget) return;
|
||||
|
||||
boolean gloveDrop = e.getId() == NPCs.CHAOS_ELEMENTAL_3200 ? RandomFunction.roll(75) : RandomFunction.roll(100);
|
||||
if (gloveDrop) {
|
||||
byte glove = (byte) RandomFunction.random(1, 13);
|
||||
Item reward = new Item(BrawlingGloves.forIndicator(glove).getId());
|
||||
GroundItemManager.create(reward, e.asNpc().getDropLocation(), killer.asPlayer());
|
||||
Repository.sendNews(killer.getUsername() + " has received " + reward.getName().toLowerCase() + " from a " + e.asNpc().getName() + "!");
|
||||
}
|
||||
int cEleGloveRate = isDeepWildy ? 50 : 150;
|
||||
int normalGloveRate = isDeepWildy ? 75 : 150;
|
||||
|
||||
int combatLevel = e.asNpc().getDefinition().getCombatLevel();
|
||||
int dropRate = getNewDropRate(combatLevel);
|
||||
for (int j : PVP_GEAR) {
|
||||
boolean chance = RandomFunction.roll(dropRate);
|
||||
if (chance) {
|
||||
Item reward;
|
||||
if (j == 13879 || j == 13883) { // checks if it's a javelin or throwing axe
|
||||
reward = new Item(j, RandomFunction.random(15, 50));
|
||||
} else {
|
||||
reward = new Item(j);
|
||||
}
|
||||
Repository.sendNews(killer.asPlayer().getUsername() + " has received a " + reward.getName() + " from a " + e.asNpc().getName() + "!");
|
||||
GroundItemManager.create(reward, ((NPC) e).getDropLocation(), killer.asPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
int pvpGearRate = getNewDropRate(e.asNpc().getDefinition().getCombatLevel());
|
||||
if (isDeepWildy)
|
||||
pvpGearRate /= 2;
|
||||
|
||||
if (RandomFunction.roll(e.getId() == NPCs.CHAOS_ELEMENTAL_3200 ? cEleGloveRate : normalGloveRate)) {
|
||||
byte glove = (byte) RandomFunction.random(1, 13);
|
||||
Item reward = new Item(BrawlingGloves.forIndicator(glove).getId());
|
||||
GroundItemManager.create(reward, e.asNpc().getDropLocation(), killer.asPlayer());
|
||||
Repository.sendNews(killer.getUsername() + " has received " + reward.getName().toLowerCase() + " from a " + e.asNpc().getName() + "!");
|
||||
}
|
||||
|
||||
for (int j : PVP_GEAR) {
|
||||
boolean chance = RandomFunction.roll(pvpGearRate);
|
||||
if (chance) {
|
||||
Item reward;
|
||||
if (j == 13879 || j == 13883) { // checks if it's a javelin or throwing axe
|
||||
reward = new Item(j, RandomFunction.random(15, 50));
|
||||
} else {
|
||||
reward = new Item(j);
|
||||
}
|
||||
Repository.sendNews(killer.asPlayer().getUsername() + " has received a " + reward.getName() + " from a " + e.asNpc().getName() + "!");
|
||||
GroundItemManager.create(reward, ((NPC) e).getDropLocation(), killer.asPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user