Merge remote-tracking branch 'upstream/master'

This commit is contained in:
skelsoft
2021-07-09 06:19:29 +10:00
13 changed files with 553 additions and 940 deletions
File diff suppressed because it is too large Load Diff
+12
View File
@@ -2254,5 +2254,17 @@
"name": "Too Many Cooks...",
"indexId": "398",
"borders": "{2944,9856,3007,9919}"
},
{
"id": "222",
"name": "Major Miner",
"indexId": "437",
"borders": "{2403,10186,2409,10192}"
},
{
"id": "223",
"name": "Norse Code",
"indexId": "439",
"borders": "{2404,3797,2421,3820}"
}
]
+17 -2
View File
@@ -10646,6 +10646,21 @@
{
"npc_id": "2352",
"loc_data": "{2334,3183,0,1,0}"
},
{
"npc_id": "5497",
"loc_data": "{2376,10198,0,1,0}-{2384,10202,0,1,0}-{2390,10207,0,1,0}-{2385,10193,0,1,0}-{2419,10192,0,1,0}-{2412,10200,0,1,0}"
},
{
"npc_id": "5474",
"loc_data": "{2390,10216,0,1,0}-{2417,10228,0,1,0}-{2385,10227,0,1,0}"
},
{
"npc_id": "5475",
"loc_data": "{2396,10232,0,1,0}-{2402,10225,0,1,0}-{2420,10221,0,1,0}"
},
{
"npc_id": "5473",
"loc_data": "{2377,10212,0,1,0}-{2392,10226,0,1,0}-{2407,10228,0,1,0}-{2406,10214,0,1,0}-{2420,10214,0,1,0}"
}
]
]
@@ -19,6 +19,8 @@ public enum SpecialLadders implements LadderAchievementCheck {
FOG_ENTER(Location.create(3240,3575,0),Location.create(1675,5599,0)),
FOG_LEAVE(Location.create(1673,5598,0),Location.create(3242, 3574, 0)),
INTRO_LEAVE(Location.create(2522, 4999, 0),Location.create(3230, 3240, 0)),
JATIZSO_MINE_UP(Location.create(2406,10188,0),Location.create(2397, 3811, 0)),
JATIZSO_MINE_DOWN(Location.create(2397, 3812, 0), Location.create(2405, 10188, 0)),
DRAYNOR_SEWER_SOUTHEAST_DOWN(new Location(3118, 3244, 0), new Location(3118, 9643, 0)),
DRAYNOR_SEWER_SOUTHEAST_UP(new Location(3118, 9643, 0), new Location(3118, 3243, 0)),
@@ -62,6 +64,10 @@ public enum SpecialLadders implements LadderAchievementCheck {
this.destLoc = destLoc;
}
public static void add(Location from, Location to){
destinationMap.put(from,to);
}
public static Location getDestination(Location loc){
return destinationMap.get(loc);
}
@@ -92,7 +92,7 @@ public final class EmoteCluePlugin extends EmoteClueScroll {
register(new EmoteCluePlugin("lumb-shack-dance", 2698, ClueLevel.EASY, emote, new int[][] { { 1205 }, { 1153 }, { 1635 } }, "Dance in<br>the shack in Lumbridge Swamp.<br>Equip a bronze<br>dagger, iron full helmet<br>and a gold ring.", new ZoneBorders(3202, 3167, 3205, 3170)));
register(new EmoteCluePlugin("lumb-cave-dance", 2699, ClueLevel.MEDIUM, emote, Emotes.BLOW_KISS, new int[][] { { 1381 }, { 1155 }, { 1731 } }, "Dance in the dark<br>cave beneath<br>Lumbridge Swamp.<br>Blow a kiss before<br>you talk to me.<br>Equip an air staff,<br>bronze full helm and<br>an amulet of power.", new ZoneBorders(3139, 9534, 3260, 9587)));
register(new EmoteCluePlugin("shantay-guild-jig", 2700, ClueLevel.MEDIUM, Emotes.JIG, Emotes.BOW, new int[][] { { 3343 }, { 1381 }, { 1173 } }, "Dance a jig under<br>Shantay's Awning.<br>Bow before you talk to<br>me.<br>Equip a pointed blue<br>snail helmet, an air<br>staff and a bronze<br>square shield.", new ZoneBorders(3302, 3122, 3305, 3125)));
register(new EmoteCluePlugin("cat-entrance-dance", 2701, ClueLevel.HARD, emote, new int[][] { { 2570 }, { 1704 }, { 1317 } }, "Dance at the<br>cat doored pyramid in<br>Sophanem. Beware of double agents!<br>Equip a ring of life,<br>an uncharged amulet<br>of glory and an adamant two handed<br>sword.", new ZoneBorders(3293, 2781, 3296, 2782)));
register(new EmoteCluePlugin("cat-entrance-dance", 2701, ClueLevel.HARD, emote, new int[][] { { 2570 }, { 1704 }, { 1317 } }, "Dance at the<br>cat doored pyramid in<br>Sophanem. Beware of double agents!<br>Equip a ring of life<br>an uncharged amulet of glory<br>and an adamant two handed sword.", new ZoneBorders(3293, 2781, 3296, 2782)));
emote = Emotes.HEADBANG;
register(new EmoteCluePlugin("al-kharid-headbang", 2702, ClueLevel.EASY, emote, new int[][] { { 1833 }, { 1059 }, { 1061 } }, "Headbang in the mine north of Al<br>Kharid.<br>Equip a desert shirt, leather gloves and<br>leather boots.", new ZoneBorders(3297, 3286, 3301, 3316)));
//Removed Vexia code that bricked emotes for certain clues.
@@ -267,10 +267,16 @@ public final class HouseManager {
int diffX = player.getLocation().getX() - r.getBaseLocation().getX();
int diffY = player.getLocation().getY() - r.getBaseLocation().getY();
int diffZ = player.getLocation().getZ() - r.getBaseLocation().getZ();
DynamicRegion dr = region;
DynamicRegion dd = dungeon;
RegionManager.getRegionCache().remove(dr);
RegionManager.getRegionCache().remove(dd);
region = null;
dungeon = null;
enter(player, buildingMode, false);
player.getProperties().setTeleportLocation((player.getViewport().getRegion() == dungeon ? dungeon : region).getBaseLocation().transform(diffX, diffY, diffZ));
dr.flagInactive();
dd.flagInactive();
}
/**
@@ -299,22 +299,31 @@ public class Region {
}
}
/**
* Unloads a region - compatibility method for older uses
*/
private static void unload(Region r){
unload(r, false);
}
/**
* Unloads a region.
* @param r The region.
*/
private static void unload(Region r) {
if (r.isViewed()) {
SystemLogger.logErr("Players viewing region!");
r.flagActive();
return;
}
for (RegionPlane p : r.planes) {
if (!p.getPlayers().isEmpty()) {
SystemLogger.logErr("Players still in region!");
private static void unload(Region r, boolean force) {
if(!force){
if (r.isViewed()) {
SystemLogger.logErr("Players viewing region!");
r.flagActive();
return;
}
for (RegionPlane p : r.planes) {
if (!p.getPlayers().isEmpty()) {
SystemLogger.logErr("Players still in region!");
r.flagActive();
return;
}
}
}
for (RegionPlane p : r.planes) {
p.clear();
@@ -5,12 +5,12 @@ package core.net.packet;
* @author Emperor
* @param <T> The context type.
*/
public interface OutgoingPacket<T extends Context> {
public interface OutgoingPacket<Context> {
/**
* Sends the packet.
* @param context The context.
*/
public void send(T context);
public void send(Context context);
}
@@ -4,6 +4,7 @@ import core.net.packet.in.*;
import core.net.packet.out.GrandExchangePacket;
import core.net.packet.out.*;
import rs09.game.system.SystemLogger;
import rs09.net.packet.PacketWriteQueue;
import rs09.net.packet.in.ItemOnGroundItemPacket;
import rs09.net.packet.in.QuickChatPacketHandler;
@@ -19,7 +20,7 @@ public final class PacketRepository {
/**
* The outgoing packets mapping.
*/
private final static Map<Class<?>, OutgoingPacket<? extends Context>> OUTGOING_PACKETS = new HashMap<>();
public final static Map<Class<?>, OutgoingPacket<? extends Context>> OUTGOING_PACKETS = new HashMap<>();
/**
* The incoming packets mapping.
@@ -189,8 +190,9 @@ public final class PacketRepository {
SystemLogger.logErr("Invalid outgoing packet [handler=" + clazz + ", context=" + context + "].");
return;
}
if(!context.getPlayer().isArtificial())
p.send(context);
if(!context.getPlayer().isArtificial()) {
PacketWriteQueue.handle(p, context);
}
}
/**
@@ -25,12 +25,7 @@ class EquipHandler : InteractionListener() {
override fun defineListeners() {
on(ITEM,"equip","wield","wear"){player,node ->
GameWorld.Pulser.submit(object : Pulse(){
override fun pulse(): Boolean {
handleEquip(player,node)
return true
}
})
handleEquip(player,node)
return@on true
}
@@ -222,7 +222,7 @@ class NedDialogue(player: Player? = null) : DialoguePlugin(player) {
if (diary == null) {
diary = player.achievementDiaryManager.getDiary(DiaryType.LUMBRIDGE)
}
if (diary!!.isComplete(level, true) && !diary!!.isLevelRewarded(level)) {
if (diary!!.isComplete(level, false) && !diary!!.isLevelRewarded(level)) {
player("I've done all the hard tasks in my Lumbridge", "Achievement Diary.")
stage = 950
}
@@ -0,0 +1,46 @@
package rs09.net.packet
import core.net.packet.OutgoingPacket
import core.net.packet.out.*
import rs09.game.system.SystemLogger
import java.util.*
object PacketWriteQueue {
private val PacketsToWrite: Queue<QueuedPacket<*>> = LinkedList<QueuedPacket<*>>()
@JvmStatic
fun <T> handle(packet: OutgoingPacket<T>, context: T){
when(packet){
is UpdateSceneGraph,
is BuildDynamicScene,
is InstancedLocationUpdate -> packet.send(context)
else -> queue(packet,context)
}
}
@JvmStatic
fun <T> queue(packet: OutgoingPacket<T>, context: T){
PacketsToWrite.add(QueuedPacket(packet,context))
}
@JvmStatic
fun flush(){
while(!PacketsToWrite.isEmpty()){
val p = PacketsToWrite.poll()
write(p.out,p.context)
}
}
@Suppress("UNCHECKED_CAST")
fun <T> write(out: OutgoingPacket<*>, context: T){
val pack = out as? OutgoingPacket<T>
val ctx = context as? T
if(pack == null || ctx == null){
SystemLogger.logWarn("Failed packet casting")
return
}
pack.send(ctx)
}
}
class QueuedPacket<T>(val out: OutgoingPacket<T>, val context: T)
@@ -13,6 +13,7 @@ import rs09.ServerConstants
import rs09.game.world.GameWorld
import rs09.game.world.repository.Repository
import rs09.game.world.update.UpdateSequence
import rs09.net.packet.PacketWriteQueue
import rs09.tools.stringtools.colorize
import java.text.SimpleDateFormat
import java.util.*
@@ -48,6 +49,7 @@ class MajorUpdateWorker {
sequence.start()
sequence.run()
sequence.end()
PacketWriteQueue.flush()
//increment global ticks variable
GameWorld.pulse()
//disconnect all players waiting to be disconnected