mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Revs fixed
This commit is contained in:
parent
304af7c947
commit
155a309c00
2 changed files with 72 additions and 8 deletions
|
|
@ -11,17 +11,24 @@ import org.crandor.game.node.entity.npc.agg.AggressiveBehavior;
|
||||||
import org.crandor.game.node.entity.npc.agg.AggressiveHandler;
|
import org.crandor.game.node.entity.npc.agg.AggressiveHandler;
|
||||||
import org.crandor.game.node.entity.player.Player;
|
import org.crandor.game.node.entity.player.Player;
|
||||||
import org.crandor.game.node.entity.player.info.Rights;
|
import org.crandor.game.node.entity.player.info.Rights;
|
||||||
|
import org.crandor.game.node.item.GroundItemManager;
|
||||||
import org.crandor.game.node.item.Item;
|
import org.crandor.game.node.item.Item;
|
||||||
import org.crandor.game.world.map.Location;
|
import org.crandor.game.world.map.Location;
|
||||||
import org.crandor.game.world.map.zone.MapZone;
|
import org.crandor.game.world.map.zone.MapZone;
|
||||||
import org.crandor.game.world.map.zone.RegionZone;
|
import org.crandor.game.world.map.zone.RegionZone;
|
||||||
import org.crandor.game.world.map.zone.ZoneBorders;
|
import org.crandor.game.world.map.zone.ZoneBorders;
|
||||||
|
import org.crandor.game.world.repository.Repository;
|
||||||
|
import org.crandor.tools.RandomFunction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the wilderness zone.
|
* Handles the wilderness zone.
|
||||||
* @author Emperor
|
* @author Emperor
|
||||||
*/
|
*/
|
||||||
public final class WildernessZone extends MapZone {
|
public final class WildernessZone extends MapZone {
|
||||||
|
/**
|
||||||
|
* The PvP gear items
|
||||||
|
*/
|
||||||
|
private static int[] PVP_GEAR = { 13887, 13893, 13899, 13905, 13870, 13873, 13876, 13879, 13883, 13884, 13890, 13896, 13902, 13858, 13861, 13864, 13867};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The wilderness zone.
|
* The wilderness zone.
|
||||||
|
|
@ -48,6 +55,70 @@ public final class WildernessZone extends MapZone {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* calculate drop rate for rev items based on combat level
|
||||||
|
* @author ceik
|
||||||
|
* @param combatLevel
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getNewDropRate(int combatLevel){
|
||||||
|
double x = combatLevel;
|
||||||
|
double A = 44044.5491;
|
||||||
|
double B = -7360.19548;
|
||||||
|
return (int) (A + (B * Math.log(x)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles rev drops
|
||||||
|
* @author ceik
|
||||||
|
* @param e The entity dying.
|
||||||
|
* @param killer The killer.
|
||||||
|
* @return true
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean death(Entity e, Entity killer) {
|
||||||
|
if(e instanceof NPC && killer instanceof Player && (e.asNpc().getName().contains("Revenant") || e.asNpc().getName().equals("Chaos elemental"))){
|
||||||
|
int combatLevel = e.asNpc().getDefinition().getCombatLevel();
|
||||||
|
int dropRate = getNewDropRate(combatLevel);
|
||||||
|
for(int i = 0; i < PVP_GEAR.length; i++){
|
||||||
|
boolean chance = RandomFunction.random(dropRate) == dropRate / 2;
|
||||||
|
if(chance){
|
||||||
|
Item reward;
|
||||||
|
if(PVP_GEAR[i] == 13879 || PVP_GEAR[i] == 13883){ // checks if it's a javelin or throwing axe
|
||||||
|
reward = new Item(PVP_GEAR[i],RandomFunction.random(15,50));
|
||||||
|
} else {
|
||||||
|
reward = new Item(PVP_GEAR[i]);
|
||||||
|
}
|
||||||
|
Repository.sendNews(killer.asPlayer().getUsername() + " has received a " + reward.getName() + " from a " + e.asNpc().getName() + "!");
|
||||||
|
GroundItemManager.create(reward,((NPC) e).getDropLocation(),killer.asPlayer());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e.asNpc().getDefinition().getDropTables().drop(e.asNpc(),killer);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fixes attack options for the revs
|
||||||
|
* @param e The entity.
|
||||||
|
* @param target The target to interact with.
|
||||||
|
* @param option The option.
|
||||||
|
* @return true
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean interact(Entity e, Node target, Option option) {
|
||||||
|
if(target instanceof NPC){
|
||||||
|
if(target.asNpc().getName().contains("Revenant")){
|
||||||
|
e.asPlayer().getProperties().getCombatPulse().attack(target);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.interact(e, target, option);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean enter(Entity e) {
|
public boolean enter(Entity e) {
|
||||||
if (e instanceof Player) {
|
if (e instanceof Player) {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class RevenantNPC extends AbstractNPC {
|
||||||
* The possible PVP item drops.
|
* The possible PVP item drops.
|
||||||
*/
|
*/
|
||||||
private static final int[] PVP_DROPS = new int[] { 13896, 13884, 13890, 13902, 13887, 13899, 13893, 13905, 13864, 13858, 13861, 13867, 13876, 13879, 13870, 13873, 13883, 13908, 13911, 13914, 13917, 13920, 13923, 13926, 13929, 13932, 13935, 13938, 13941, 13944, 13947, 13950, 13953, 13958, 13961, 13964, 13967, 13970, 13973, 13976, 13979, 13982, 13985, 13988 };
|
private static final int[] PVP_DROPS = new int[] { 13896, 13884, 13890, 13902, 13887, 13899, 13893, 13905, 13864, 13858, 13861, 13867, 13876, 13879, 13870, 13873, 13883, 13908, 13911, 13914, 13917, 13920, 13923, 13926, 13929, 13932, 13935, 13938, 13941, 13944, 13947, 13950, 13953, 13958, 13961, 13964, 13967, 13970, 13973, 13976, 13979, 13982, 13985, 13988 };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The swing handler.
|
* The swing handler.
|
||||||
*/
|
*/
|
||||||
|
|
@ -112,13 +112,6 @@ public class RevenantNPC extends AbstractNPC {
|
||||||
if (killer instanceof Player) {
|
if (killer instanceof Player) {
|
||||||
killer.asPlayer().getAudioManager().send(4063, true);
|
killer.asPlayer().getAudioManager().send(4063, true);
|
||||||
}
|
}
|
||||||
int chance = RandomFunction.getRandom(120);
|
|
||||||
if (chance == 1) {
|
|
||||||
int item = RandomFunction.getRandom(PVP_DROPS.length - 1);
|
|
||||||
Item i = new Item(PVP_DROPS[item]);
|
|
||||||
GroundItemManager.create(i, itemLoc, killer.asPlayer());
|
|
||||||
Repository.sendNews(killer.getUsername() + " has just received a " + i.getName() + " from a " + getName() + ".");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue