Drill demon, sandwich lady and certer random events.
This commit is contained in:
@@ -53,7 +53,6 @@ public abstract class AntiMacroDialogue extends DialoguePlugin {
|
||||
asAme().getProperties().getCombatPulse().stop();
|
||||
}
|
||||
|
||||
setEvent(player.getAntiMacroHandler().getEvent());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package core.game.content.ame;
|
||||
|
||||
import core.cache.misc.buffer.ByteBufferUtils;
|
||||
import rs09.game.system.SystemLogger;
|
||||
import core.game.world.map.zone.impl.WildernessZone;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.world.map.zone.ZoneRestriction;
|
||||
import core.game.world.map.zone.impl.WildernessZone;
|
||||
import core.tools.RandomFunction;
|
||||
import rs09.game.content.ame.RandomEventNPC;
|
||||
import rs09.game.system.SystemLogger;
|
||||
import rs09.game.world.GameWorld;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -56,7 +54,7 @@ public final class AntiMacroHandler {
|
||||
/**
|
||||
* The current event.
|
||||
*/
|
||||
private AntiMacroEvent event;
|
||||
private RandomEventNPC event;
|
||||
|
||||
public ExperienceMonitor[] monitors = new ExperienceMonitor[Skills.SKILL_NAME.length];
|
||||
|
||||
@@ -68,14 +66,6 @@ public final class AntiMacroHandler {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if saving is required.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean isSaveRequired() {
|
||||
return hasEvent() && event.isSaveRequired();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets called every game pulse.
|
||||
*/
|
||||
@@ -116,9 +106,6 @@ public final class AntiMacroHandler {
|
||||
} else {
|
||||
nextPulse = GameWorld.getTicks() + DELAY;
|
||||
}
|
||||
if (event != null) {
|
||||
event.start(player, true);
|
||||
}
|
||||
if(!player.isArtificial() && !isDisabled) {
|
||||
SystemLogger.logInfo("Anti-Macro: Initialized anti-macro handler for " + player.getUsername());
|
||||
}
|
||||
@@ -147,12 +134,12 @@ public final class AntiMacroHandler {
|
||||
return false;
|
||||
}
|
||||
AntiMacroNPC n = (AntiMacroNPC) npc;
|
||||
if (n.getEvent() != event) {
|
||||
/*if (n.getEvent() != event) {
|
||||
if (message) {
|
||||
player.getPacketDispatch().sendMessage("They don't seem interested in talking to you.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -183,7 +170,7 @@ public final class AntiMacroHandler {
|
||||
return false;
|
||||
}
|
||||
//resetTrigger();
|
||||
this.event = event;
|
||||
//this.event = event;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -194,7 +181,7 @@ public final class AntiMacroHandler {
|
||||
* @return {@code True} if the event has been fired.
|
||||
*/
|
||||
public boolean fireEvent(int skillId, Object... args) {
|
||||
nextPulse = DELAY + GameWorld.getTicks();
|
||||
/*nextPulse = DELAY + GameWorld.getTicks();
|
||||
if (hasEvent() || EVENTS.isEmpty() || player.getZoneMonitor().isRestricted(ZoneRestriction.RANDOM_EVENTS) || player.isArtificial()) {
|
||||
return false;
|
||||
}
|
||||
@@ -207,7 +194,7 @@ public final class AntiMacroHandler {
|
||||
return true;
|
||||
}
|
||||
event = null;
|
||||
}
|
||||
}*/
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -236,7 +223,7 @@ public final class AntiMacroHandler {
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean hasEvent() {
|
||||
return event != null && !event.isTerminated();
|
||||
return event != null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,7 +238,7 @@ public final class AntiMacroHandler {
|
||||
* Gets the event.
|
||||
* @return The event.
|
||||
*/
|
||||
public AntiMacroEvent getEvent() {
|
||||
public RandomEventNPC getEvent() {
|
||||
return event;
|
||||
}
|
||||
|
||||
@@ -259,7 +246,7 @@ public final class AntiMacroHandler {
|
||||
* Sets the event.
|
||||
* @param event The event to set.
|
||||
*/
|
||||
public void setEvent(AntiMacroEvent event) {
|
||||
public void setEvent(RandomEventNPC event) {
|
||||
this.event = event;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
package core.game.content.ame.events.genie;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import core.game.content.ame.AntiMacroDialogue;
|
||||
import core.game.content.ame.AntiMacroEvent;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.content.dialogue.DialoguePlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.Initializable;
|
||||
import rs09.plugin.PluginManager;
|
||||
|
||||
/**
|
||||
@@ -98,7 +96,6 @@ public final class GenieRandomEvent extends AntiMacroEvent {
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
if (super.open(args)) {
|
||||
npc("Ah, so you are there " + player.getAntiMacroHandler().getEvent().getGenderPrefix().toLowerCase() + ". I'm so glad you", "summoned me. Please take this lamp and make your", "wish!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -52,10 +52,6 @@ import core.game.world.map.*;
|
||||
import core.game.world.map.build.DynamicRegion;
|
||||
import core.game.world.map.path.Pathfinder;
|
||||
import core.game.world.map.zone.ZoneType;
|
||||
import rs09.game.world.update.MapChunkRenderer;
|
||||
import rs09.game.world.update.NPCRenderer;
|
||||
import rs09.game.world.update.PlayerRenderer;
|
||||
import rs09.game.world.update.UpdateSequence;
|
||||
import core.game.world.update.flag.PlayerFlags;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
@@ -73,6 +69,8 @@ import core.net.packet.out.UpdateSceneGraph;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.RandomFunction;
|
||||
import core.tools.StringUtils;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import rs09.ServerConstants;
|
||||
import rs09.game.VarpManager;
|
||||
import rs09.game.ge.PlayerGrandExchange;
|
||||
@@ -83,6 +81,10 @@ import rs09.game.node.entity.state.newsys.State;
|
||||
import rs09.game.node.entity.state.newsys.StateRepository;
|
||||
import rs09.game.world.GameWorld;
|
||||
import rs09.game.world.repository.Repository;
|
||||
import rs09.game.world.update.MapChunkRenderer;
|
||||
import rs09.game.world.update.NPCRenderer;
|
||||
import rs09.game.world.update.PlayerRenderer;
|
||||
import rs09.game.world.update.UpdateSequence;
|
||||
import rs09.tools.TickUtilsKt;
|
||||
|
||||
import java.util.*;
|
||||
@@ -121,6 +123,8 @@ public class Player extends Entity {
|
||||
|
||||
public HashMap<String,State> states = new HashMap<>();
|
||||
|
||||
public HashMap<String,Function1<Player, Unit>> logoutListeners = new HashMap<>();
|
||||
|
||||
/**
|
||||
* The inventory.
|
||||
*/
|
||||
@@ -404,6 +408,9 @@ public class Player extends Entity {
|
||||
}
|
||||
});
|
||||
}
|
||||
if(!logoutListeners.isEmpty()){
|
||||
logoutListeners.forEach((key,method) -> method.invoke(this));
|
||||
}
|
||||
if (familiarManager.hasFamiliar()) {
|
||||
familiarManager.getFamiliar().clear();
|
||||
}
|
||||
@@ -1363,4 +1370,12 @@ public class Player extends Entity {
|
||||
state.getPulse().stop();
|
||||
states.remove(key);
|
||||
}
|
||||
|
||||
public void addLogoutListener(String key, Function1<Player,Unit> listener){
|
||||
logoutListeners.put(key,listener);
|
||||
}
|
||||
|
||||
public void removeLogoutListener(String key){
|
||||
logoutListeners.remove(key);
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,8 @@ public final class DynamicRegion extends Region {
|
||||
*/
|
||||
private DynamicRegion parentRegion;
|
||||
|
||||
public ArrayList<NPC> NPCs = new ArrayList<>(10);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code DynamicRegion} {@code Object}.
|
||||
* @param regionId The region id of the region to copy.
|
||||
@@ -467,4 +469,11 @@ public final class DynamicRegion extends Region {
|
||||
public DynamicRegion getParent() {
|
||||
return parentRegion;
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
for(NPC n : NPCs){
|
||||
n.clear();
|
||||
}
|
||||
NPCs.clear();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user