mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-21 09:02:07 -07:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
dcfc02e60d
8 changed files with 110 additions and 12 deletions
|
|
@ -2122,5 +2122,14 @@
|
||||||
"id": "239",
|
"id": "239",
|
||||||
"title": "Contraband yak produce.",
|
"title": "Contraband yak produce.",
|
||||||
"stock": "{10818,25}-{10816,50}-{10814,50}-{10820,10}"
|
"stock": "{10818,25}-{10816,50}-{10814,50}-{10820,10}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"npcs": "1163,1164",
|
||||||
|
"high_alch": "0",
|
||||||
|
"currency": "995",
|
||||||
|
"general_store": "false",
|
||||||
|
"id": "240",
|
||||||
|
"title": "Tiadeche's Karambwan Stall",
|
||||||
|
"stock": "{3142,10}-{3157,10}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package core.game.interaction.city.lumbridge;
|
package core.game.interaction.city.lumbridge;
|
||||||
|
|
||||||
|
import api.ContentAPI;
|
||||||
import core.cache.def.impl.SceneryDefinition;
|
import core.cache.def.impl.SceneryDefinition;
|
||||||
import core.game.content.dialogue.DialoguePlugin;
|
import core.game.content.dialogue.DialoguePlugin;
|
||||||
import core.game.interaction.OptionHandler;
|
import core.game.interaction.OptionHandler;
|
||||||
|
|
@ -7,6 +8,7 @@ import core.game.node.Node;
|
||||||
import core.game.node.entity.player.Player;
|
import core.game.node.entity.player.Player;
|
||||||
import core.plugin.Initializable;
|
import core.plugin.Initializable;
|
||||||
import core.plugin.Plugin;
|
import core.plugin.Plugin;
|
||||||
|
import rs09.GlobalStats;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cow field sign manager
|
* Cow field sign manager
|
||||||
|
|
@ -40,7 +42,12 @@ public class CowFieldSign extends OptionHandler {
|
||||||
public DialoguePlugin newInstance(Player player){return new SignDialogue(player);}
|
public DialoguePlugin newInstance(Player player){return new SignDialogue(player);}
|
||||||
@Override
|
@Override
|
||||||
public boolean open(Object... args){
|
public boolean open(Object... args){
|
||||||
interpreter.sendPlainMessage(false,"Wandering adventurers have killed " + CowPenZone.CowDeaths + " cows in this field.", "Local farmers call it an epidemic.");
|
int dailyCowDeaths = GlobalStats.getDailyCowDeaths();
|
||||||
|
if(dailyCowDeaths > 0) {
|
||||||
|
ContentAPI.sendDialogue(player, "Local cowherders have reported that " + dailyCowDeaths + " cows have been slain in this field today by passing adventurers. Farmers throughout the land fear this may be an epidemic.");
|
||||||
|
} else {
|
||||||
|
ContentAPI.sendDialogue(player, "The Lumbridge cow population has been thriving today, without a single cow death to worry about!" );
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import core.game.world.map.zone.ZoneBorders;
|
||||||
import core.game.world.map.zone.ZoneBuilder;
|
import core.game.world.map.zone.ZoneBuilder;
|
||||||
import core.plugin.Initializable;
|
import core.plugin.Initializable;
|
||||||
import core.plugin.Plugin;
|
import core.plugin.Plugin;
|
||||||
|
import rs09.GlobalStats;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zone for the lumbridge cow pen
|
* Zone for the lumbridge cow pen
|
||||||
|
|
@ -40,7 +41,7 @@ public class CowPenZone extends MapZone implements Plugin<Object> {
|
||||||
@Override
|
@Override
|
||||||
public boolean death(Entity e, Entity killer) {
|
public boolean death(Entity e, Entity killer) {
|
||||||
if (killer instanceof Player && e instanceof NPC) {
|
if (killer instanceof Player && e instanceof NPC) {
|
||||||
CowDeaths++;
|
GlobalStats.incrementDailyCowDeaths();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ import core.tools.StringUtils;
|
||||||
import kotlin.Unit;
|
import kotlin.Unit;
|
||||||
import kotlin.jvm.functions.Function1;
|
import kotlin.jvm.functions.Function1;
|
||||||
import org.rs09.consts.Items;
|
import org.rs09.consts.Items;
|
||||||
|
import rs09.GlobalStats;
|
||||||
import rs09.ServerConstants;
|
import rs09.ServerConstants;
|
||||||
import rs09.game.VarpManager;
|
import rs09.game.VarpManager;
|
||||||
import rs09.game.content.ame.RandomEventManager;
|
import rs09.game.content.ame.RandomEventManager;
|
||||||
|
|
@ -582,6 +583,7 @@ public class Player extends Entity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finalizeDeath(Entity killer) {
|
public void finalizeDeath(Entity killer) {
|
||||||
|
GlobalStats.incrementDeathCount();
|
||||||
settings.setSpecialEnergy(100);
|
settings.setSpecialEnergy(100);
|
||||||
settings.updateRunEnergy(settings.getRunEnergy() - 100);
|
settings.updateRunEnergy(settings.getRunEnergy() - 100);
|
||||||
Player k = killer instanceof Player ? (Player) killer : this;
|
Player k = killer instanceof Player ? (Player) killer : this;
|
||||||
|
|
|
||||||
45
Server/src/main/kotlin/rs09/GlobalStats.kt
Normal file
45
Server/src/main/kotlin/rs09/GlobalStats.kt
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
package rs09
|
||||||
|
|
||||||
|
import org.json.simple.JSONObject
|
||||||
|
import rs09.ServerStore.getInt
|
||||||
|
|
||||||
|
object GlobalStats {
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun incrementDeathCount(){
|
||||||
|
getDailyDeathArchive()["players"] = getDailyDeathArchive().getInt("players") + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun incrementDailyCowDeaths(){
|
||||||
|
getDailyDeathArchive()["lumbridge-cows"] = getDailyDeathArchive().getInt("lumbridge-cows") + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun incrementGuardPickpockets(){
|
||||||
|
getGuardPickpocketArchive()["count"] = getGuardPickpocketArchive().getInt("count") + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getDailyGuardPickpockets(): Int {
|
||||||
|
return getGuardPickpocketArchive().getInt("count")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getDailyDeaths(): Int {
|
||||||
|
return getDailyDeathArchive().getInt("players")
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getDailyCowDeaths(): Int {
|
||||||
|
return getDailyDeathArchive().getInt("lumbridge-cows")
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getDailyDeathArchive(): JSONObject {
|
||||||
|
return ServerStore.getArchive("daily-deaths-global")
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getGuardPickpocketArchive(): JSONObject {
|
||||||
|
return ServerStore.getArchive("daily-guard-pickpockets")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -6,15 +6,16 @@ import core.game.node.Node
|
||||||
import core.game.node.entity.Entity
|
import core.game.node.entity.Entity
|
||||||
import core.game.world.map.zone.MapZone
|
import core.game.world.map.zone.MapZone
|
||||||
import core.game.world.map.zone.ZoneBorders
|
import core.game.world.map.zone.ZoneBorders
|
||||||
|
import rs09.GlobalStats
|
||||||
import rs09.game.interaction.InteractionListener
|
import rs09.game.interaction.InteractionListener
|
||||||
|
import rs09.game.system.SystemLogger
|
||||||
|
|
||||||
class VarrockGuardSignpost : InteractionListener() {
|
class VarrockGuardSignpost : InteractionListener() {
|
||||||
override fun defineListeners() {
|
override fun defineListeners() {
|
||||||
val zone = object : MapZone("Varrock Guards", true){
|
val zone = object : MapZone("Varrock Guards", true){
|
||||||
var pickpocketCounter = 0
|
|
||||||
override fun interact(e: Entity?, target: Node?, option: Option?): Boolean {
|
override fun interact(e: Entity?, target: Node?, option: Option?): Boolean {
|
||||||
if(option != null && option.name.toLowerCase().contains("pickpocket") && target != null && target.name.toLowerCase().contains("guard")){
|
if(option != null && option.name.toLowerCase().contains("pickpocket") && target != null && target.name.toLowerCase().contains("guard")){
|
||||||
pickpocketCounter++
|
GlobalStats.incrementGuardPickpockets()
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
@ -25,8 +26,14 @@ class VarrockGuardSignpost : InteractionListener() {
|
||||||
ContentAPI.registerMapZone(zone, ZoneBorders(3180,3420,3165,3435))
|
ContentAPI.registerMapZone(zone, ZoneBorders(3180,3420,3165,3435))
|
||||||
ContentAPI.registerMapZone(zone, ZoneBorders(3280,3422,3266,3435))
|
ContentAPI.registerMapZone(zone, ZoneBorders(3280,3422,3266,3435))
|
||||||
|
|
||||||
on(31298, SCENERY, "read"){player, node ->
|
on(31298, SCENERY, "read"){player, _ ->
|
||||||
ContentAPI.sendDialogue(player, "Guards in the Varrock Palace are on full alert due to increasing levels of pickpocketing. So far today, ${zone.pickpocketCounter} guards have had their money pickpocketed in the palace or at the city gates.")
|
val pickpocketCount = GlobalStats.getDailyGuardPickpockets()
|
||||||
|
SystemLogger.logInfo("Is equal? ${pickpocketCount == 0}")
|
||||||
|
when(pickpocketCount){
|
||||||
|
0 -> ContentAPI.sendDialogue(player, "The Varrock Palace guards are pleased to announce that crime is at an all-time low, without a single guard in the palace or at the city gates being pickpocketed today.")
|
||||||
|
1 -> ContentAPI.sendDialogue(player, "One of the Varrock Palace guards was pickpocketed today. He was close to tears at having lost his last few gold pieces." )
|
||||||
|
else -> ContentAPI.sendDialogue(player, "Guards in the Varrock Palace are on full alert due to increasing levels of pickpocketing. So far today, $pickpocketCount guards have had their money pickpocketed in the palace or at the city gates.")
|
||||||
|
}
|
||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package rs09.game.interaction.region
|
||||||
|
|
||||||
|
import api.ContentAPI
|
||||||
|
import rs09.GlobalStats
|
||||||
|
import rs09.game.interaction.InteractionListener
|
||||||
|
|
||||||
|
class LumbridgeListeners : InteractionListener() {
|
||||||
|
|
||||||
|
val CHURCH_SIGN = 31299
|
||||||
|
|
||||||
|
override fun defineListeners() {
|
||||||
|
on(CHURCH_SIGN, SCENERY, "read"){player, _ ->
|
||||||
|
val deaths = GlobalStats.getDailyDeaths()
|
||||||
|
if(deaths > 0){
|
||||||
|
ContentAPI.sendDialogue(player, "So far today $deaths unlucky adventurers have died on RuneScape and been sent to their respawn location. Be careful out there.")
|
||||||
|
} else {
|
||||||
|
ContentAPI.sendDialogue(player, "So far today not a single adventurer on RuneScape has met their end grisly or otherwise. Either the streets are getting safer or adventurers are getting warier.")
|
||||||
|
}
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -39,6 +39,7 @@ class MajorUpdateWorker {
|
||||||
val start = System.currentTimeMillis()
|
val start = System.currentTimeMillis()
|
||||||
val rmlist = ArrayList<Pulse>()
|
val rmlist = ArrayList<Pulse>()
|
||||||
val list = ArrayList(GameWorld.Pulser.TASKS)
|
val list = ArrayList(GameWorld.Pulser.TASKS)
|
||||||
|
Server.heartbeat()
|
||||||
|
|
||||||
//run our pulses
|
//run our pulses
|
||||||
for(pulse in list) {
|
for(pulse in list) {
|
||||||
|
|
@ -52,22 +53,25 @@ class MajorUpdateWorker {
|
||||||
|
|
||||||
rmlist.clear()
|
rmlist.clear()
|
||||||
//perform our update sequence where we write masks, etc
|
//perform our update sequence where we write masks, etc
|
||||||
sequence.start()
|
try {
|
||||||
sequence.run()
|
sequence.start()
|
||||||
sequence.end()
|
sequence.run()
|
||||||
PacketWriteQueue.flush()
|
sequence.end()
|
||||||
|
PacketWriteQueue.flush()
|
||||||
|
} catch (e: Exception){
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
//increment global ticks variable
|
//increment global ticks variable
|
||||||
GameWorld.pulse()
|
GameWorld.pulse()
|
||||||
//disconnect all players waiting to be disconnected
|
//disconnect all players waiting to be disconnected
|
||||||
Repository.disconnectionQueue.update()
|
Repository.disconnectionQueue.update()
|
||||||
//tick all manager plugins
|
//tick all manager plugins
|
||||||
Managers.tick()
|
Managers.tick()
|
||||||
Server.heartbeat()
|
|
||||||
|
|
||||||
//Handle daily restart if enabled
|
//Handle daily restart if enabled
|
||||||
if(sdf.format(Date()).toInt() == 0){
|
if(sdf.format(Date()).toInt() == 0){
|
||||||
|
|
||||||
if(GameWorld.checkDay() == 7) {//sunday
|
if(GameWorld.checkDay() == 1) {//monday
|
||||||
ServerStore.clearWeeklyEntries()
|
ServerStore.clearWeeklyEntries()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue