Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -2,6 +2,7 @@ package core.cache.def.impl;
|
||||
|
||||
import core.cache.Cache;
|
||||
import core.game.node.entity.player.Player;
|
||||
import rs09.game.system.SystemLogger;
|
||||
import rs09.game.world.GameWorld;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -122,7 +123,7 @@ public final class VarbitDefinition {
|
||||
int size = BITS[bitSize - bitShift];
|
||||
int bitValue = player.varpManager.get(getConfigId()).getBitRangeValue(getBitShift(), getBitShift() + (bitSize - bitShift));
|
||||
if(bitValue != 0){
|
||||
return bitValue >>> bitShift;
|
||||
return size & (bitValue >>> bitShift);
|
||||
}
|
||||
return size & (player.getConfigManager().get(configId) >>> bitShift);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import core.game.node.item.GroundItemManager;
|
||||
import core.game.node.item.Item;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.rs09.consts.Items;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
@@ -538,7 +539,7 @@ public class Container {
|
||||
int id = Integer.parseInt(i.get("id").toString());
|
||||
int amount = Integer.parseInt(i.get("amount").toString());
|
||||
int charge = Integer.parseInt(i.get("charge").toString());
|
||||
if (id >= ItemDefinition.getDefinitions().size() || id < 0 || slot >= items.length) {
|
||||
if (id >= ItemDefinition.getDefinitions().size() || id < 0 || slot >= items.length || id == Items.MAGIC_CARPET_5614) {
|
||||
} else {
|
||||
Item it = items[slot] = new Item(id,amount,charge);
|
||||
it.setIndex(slot);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package core.game.content.dialogue;
|
||||
|
||||
import api.Container;
|
||||
import api.ContentAPI;
|
||||
import core.cache.def.impl.NPCDefinition;
|
||||
import core.game.container.impl.EquipmentContainer;
|
||||
import core.plugin.Initializable;
|
||||
@@ -285,10 +287,12 @@ public final class RugMerchantDialogue extends DialoguePlugin {
|
||||
player.getInterfaceManager().hideTabs(0,1,2,3,4,5,6,7,8,9,10,11,12,13);
|
||||
player.getEquipment().replace(new Item(Items.MAGIC_CARPET_5614),EquipmentContainer.SLOT_WEAPON);
|
||||
player.getPacketDispatch().sendInterfaceConfig(548,69,true);
|
||||
player.logoutListeners.put("magic-carpet", (pl) -> {
|
||||
pl.getEquipment().replace(null,EquipmentContainer.SLOT_WEAPON);
|
||||
|
||||
ContentAPI.registerLogoutListener(player, "magic-carpet", (pl) -> {
|
||||
ContentAPI.removeItem(pl, Items.MAGIC_CARPET_5614, Container.EQUIPMENT);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
GameWorld.getPulser().submit(new Pulse(1, player) {
|
||||
int count;
|
||||
int index;
|
||||
@@ -328,7 +332,9 @@ public final class RugMerchantDialogue extends DialoguePlugin {
|
||||
player.unlock();
|
||||
player.animate(new Animation(-1));
|
||||
player.getConfigManager().set(499, 0);
|
||||
player.logoutListeners.remove("magic-carpet");
|
||||
|
||||
ContentAPI.clearLogoutListener(player, "magic-carpet");
|
||||
|
||||
break;
|
||||
case 902:
|
||||
player.moveStep();
|
||||
|
||||
+1
-1
@@ -94,7 +94,6 @@ public class HalgriveDialogue extends DialoguePlugin {
|
||||
}
|
||||
break;
|
||||
case 100:
|
||||
player.getQuestRepository().getQuest("Sheep Herder").start(player);
|
||||
npc("Y-you will??? That is excellent news! Head to the","enclosure we have set up on Farmer Brumty's land to","the north of the city; the four infected sheep should still","be somewhere in that vicinity. Before you will be allowed");
|
||||
stage++;
|
||||
break;
|
||||
@@ -115,6 +114,7 @@ public class HalgriveDialogue extends DialoguePlugin {
|
||||
stage++;
|
||||
break;
|
||||
case 105:
|
||||
player.getQuestRepository().getQuest("Sheep Herder").start(player);
|
||||
player.getDialogueInterpreter().sendDialogue("The councillor gives you some poisoned sheep feed.");
|
||||
player.getInventory().add(SheepHerder.POISON);
|
||||
stage++;
|
||||
|
||||
@@ -1369,12 +1369,4 @@ 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);
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,8 @@ public class Fletching {
|
||||
MAPLE(1517, FletchingItems.MAPLE_SHORTOW, FletchingItems.MAPLE_LONGBOW, FletchingItems.MAPLE_STOCK),
|
||||
YEW(1515, FletchingItems.YEW_SHORTBOW, FletchingItems.YEW_LONGBOW, FletchingItems.YEW_STOCK),
|
||||
MAGIC(1513, FletchingItems.MAGIC_SHORTBOW, FletchingItems.MAGIC_LONGBOW),
|
||||
TEAK(6333, FletchingItems.TEAK_STOCK);
|
||||
TEAK(6333, FletchingItems.TEAK_STOCK),
|
||||
MAHOGANY(6332, FletchingItems.MAHOGANY_STOCK);
|
||||
|
||||
|
||||
FletchingItems[] items;
|
||||
@@ -314,7 +315,7 @@ public class Fletching {
|
||||
MAPLE_STOCK(9448, 32, 54, 1),
|
||||
|
||||
//Yew logs
|
||||
YEW_SHORTBOW(68, 55, 65, 1),
|
||||
YEW_SHORTBOW(68, 67.5, 65, 1),
|
||||
YEW_LONGBOW(66, 75, 70, 1),
|
||||
YEW_STOCK(9452, 50, 69, 1),
|
||||
|
||||
@@ -323,7 +324,10 @@ public class Fletching {
|
||||
MAGIC_LONGBOW(70, 91.5, 85, 1),
|
||||
|
||||
//Teak
|
||||
TEAK_STOCK(9446, 27, 46,1);
|
||||
TEAK_STOCK(9446, 27, 46,1),
|
||||
|
||||
//Mahogany
|
||||
MAHOGANY_STOCK(9450, 41.0, 61, 1);
|
||||
|
||||
|
||||
int id,level,amount,logId;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package core.game.node.entity.skill.fletching;
|
||||
|
||||
import org.rs09.consts.Items;
|
||||
import rs09.game.content.dialogue.SkillDialogueHandler;
|
||||
import rs09.game.content.dialogue.SkillDialogueHandler.SkillDialogue;
|
||||
import core.game.node.entity.skill.fletching.items.bolts.BoltPulse;
|
||||
@@ -22,7 +23,7 @@ import core.plugin.Plugin;
|
||||
public class FletchingPlugin extends UseWithHandler {
|
||||
|
||||
public FletchingPlugin() {
|
||||
super(819,820,821,822,823,824,11232,9375,9376,9377,9382,9378,9379,9380,9381,13279,1511,1521,1519,1517,1515,1513,6332,6333);
|
||||
super(819,820,821,822,823,824,11232,9375,9376,9377,9382,9378,9379,9380,9381,13279,1511,1521,1519,1517,1515,1513,6332,6333, Items.MAHOGANY_LOGS_6332);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -898,4 +898,24 @@ object ContentAPI {
|
||||
fun sendAnimationOnInterface(player: Player, anim: Int, iface: Int, child: Int){
|
||||
player.packetDispatch.sendAnimationInterface(anim,iface,child)
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a logout listener to a player. Logout listeners are methods that run when a player logs out.
|
||||
* @param player the player to register the listener for
|
||||
* @param handler the method to run when the listener is invoked (when the player logs out)
|
||||
*/
|
||||
@JvmStatic
|
||||
fun registerLogoutListener(player: Player, key: String, handler: (p: Player) -> Unit){
|
||||
player.logoutListeners[key] = handler
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a logout listener based on the key from a player
|
||||
* @param player the player to remove the logout listner from
|
||||
* @param key the key of the logout listener to remove.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun clearLogoutListener(player: Player, key: String){
|
||||
player.logoutListeners.remove(key)
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package rs09.game.content.ame.events.drilldemon
|
||||
|
||||
import api.ContentAPI
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.GroundItemManager
|
||||
@@ -24,9 +25,11 @@ object DrillDemonUtils {
|
||||
fun teleport(player: Player){
|
||||
player.setAttribute(DD_KEY_RETURN_LOC,player.location)
|
||||
player.properties.teleportLocation = Location.create(3163, 4819, 0)
|
||||
player.addLogoutListener("drilldemon") { p ->
|
||||
p.location = player.getAttribute(DD_KEY_RETURN_LOC,p.location)
|
||||
|
||||
ContentAPI.registerLogoutListener(player, "drilldemon"){p ->
|
||||
ContentAPI.teleport(p, player.getAttribute(DD_KEY_RETURN_LOC, p.location))
|
||||
}
|
||||
|
||||
changeSignsAndAssignTask(player)
|
||||
}
|
||||
|
||||
@@ -72,7 +75,7 @@ object DrillDemonUtils {
|
||||
}
|
||||
|
||||
fun cleanup(player: Player){
|
||||
player.removeLogoutListener("drilldemon")
|
||||
ContentAPI.clearLogoutListener(player, "drilldemon")
|
||||
player.properties.teleportLocation = player.getAttribute(DD_KEY_RETURN_LOC)
|
||||
player.removeAttribute(DD_KEY_NPC)
|
||||
player.removeAttribute(DD_KEY_RETURN_LOC)
|
||||
|
||||
+6
-3
@@ -1,5 +1,6 @@
|
||||
package rs09.game.content.ame.events.supriseexam
|
||||
|
||||
import api.ContentAPI
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.GroundItemManager
|
||||
import core.game.node.item.Item
|
||||
@@ -28,15 +29,17 @@ object SurpriseExamUtils {
|
||||
|
||||
fun teleport(player: Player){
|
||||
player.setAttribute(SE_KEY_LOC,player.location)
|
||||
player.addLogoutListener(SE_LOGOUT_KEY){p ->
|
||||
p.location = p.getAttribute(SE_KEY_LOC,null)
|
||||
|
||||
ContentAPI.registerLogoutListener(player, SE_LOGOUT_KEY){p ->
|
||||
ContentAPI.teleport(p, p.getAttribute(SE_KEY_LOC, p.location))
|
||||
}
|
||||
|
||||
player.properties.teleportLocation = Location.create(1886, 5025, 0)
|
||||
}
|
||||
|
||||
fun cleanup(player: Player){
|
||||
player.properties.teleportLocation = player.getAttribute(SE_KEY_LOC,null)
|
||||
player.removeLogoutListener(SE_LOGOUT_KEY)
|
||||
ContentAPI.clearLogoutListener(player, SE_LOGOUT_KEY)
|
||||
player.removeAttribute(SE_KEY_LOC)
|
||||
player.removeAttribute(SE_KEY_INDEX)
|
||||
player.removeAttribute(SE_KEY_CORRECT)
|
||||
|
||||
@@ -30,7 +30,6 @@ private const val LAUNCH_ANIMATION = 4547
|
||||
* Handles the grand tree pod options
|
||||
* @author Ceikry
|
||||
*/
|
||||
@Initializable
|
||||
class GrandSeedPodHandler : InteractionListener() {
|
||||
|
||||
override fun defineListeners() {
|
||||
|
||||
+7
-2
@@ -1,5 +1,6 @@
|
||||
package rs09.game.interaction.region.dungeons.brimhaven
|
||||
|
||||
import api.ContentAPI
|
||||
import core.game.content.global.action.ClimbActionHandler
|
||||
import core.game.node.`object`.Scenery
|
||||
import core.game.node.`object`.SceneryBuilder
|
||||
@@ -47,7 +48,11 @@ object BrimhavenUtils {
|
||||
player.lock(12)
|
||||
val dir = AgilityHandler.forceWalk(player, -1, player.location, node.location, Animation.create(769), 10, 0.0, null).direction
|
||||
val loc = player.location
|
||||
player.logoutListeners["steppingstone"] = { p -> p.properties.teleportLocation = loc }
|
||||
|
||||
ContentAPI.registerLogoutListener(player, "steppingstone"){p ->
|
||||
ContentAPI.teleport(p, loc)
|
||||
}
|
||||
|
||||
GameWorld.Pulser.submit(object : Pulse(3, player) {
|
||||
var stage = if (dir == Direction.NORTH) -1 else 0
|
||||
var direction = dir
|
||||
@@ -62,7 +67,7 @@ object BrimhavenUtils {
|
||||
}
|
||||
if (stage == 6) {
|
||||
player.achievementDiaryManager.finishTask(player, DiaryType.KARAMJA, 1, 15)
|
||||
player.logoutListeners.remove("steppingstone")
|
||||
ContentAPI.clearLogoutListener(player, "steppingstone")
|
||||
}
|
||||
AgilityHandler.forceWalk(player, -1, l, l.transform(direction), Animation.create(769), 10, 0.0, null)
|
||||
return stage == 6
|
||||
|
||||
Reference in New Issue
Block a user