mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
Leaderboard Update & Support for Universe Registration
This commit is contained in:
@@ -26839,4 +26839,20 @@ public class base_class
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an Object to the Universe by adding it to the
|
||||
* tracking list of the Universe Process so that the object
|
||||
* will always be proxied on every Game Server and thereby
|
||||
* accessible in any context.
|
||||
*
|
||||
* Primary implementation is intended for special Master Objects.
|
||||
* This should not be used on players or regular tangibles.
|
||||
*
|
||||
* @param object the object to register
|
||||
*/
|
||||
public static void registerObjectToUniverse(obj_id object) {
|
||||
_registerObjectToUniverse(getLongWithNull(object));
|
||||
}
|
||||
private static native void _registerObjectToUniverse(long target);
|
||||
|
||||
} // class base_class
|
||||
|
||||
@@ -314,7 +314,7 @@ public class leaderboard extends script.base_script {
|
||||
}
|
||||
}
|
||||
setObjVar(player, OBJVAR_PLAYER_TRACKING_CITY_ALREADY, true);
|
||||
debugMsg("Adding new city to GCW Leaderboard Participant Group: " + cityGetName(guildId) + " (" + cityId + ")");
|
||||
debugMsg("Adding new city to GCW Leaderboard Participant Group: " + cityGetName(cityId) + " (" + cityId + ")");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -21,6 +21,7 @@ public class gcw_master_object extends script.base_script {
|
||||
}
|
||||
|
||||
public int OnInitialize(obj_id self) throws InterruptedException {
|
||||
registerObjectToUniverse(self);
|
||||
messageTo(self, "handleLeaderboardInitialization", null, 60f, true);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -30,6 +31,11 @@ public class gcw_master_object extends script.base_script {
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
|
||||
public int OnDestroy(obj_id self) throws InterruptedException {
|
||||
removeObjVar(getPlanetByName("tatooine"), "leaderboard.master_object");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
public int OnHearSpeech(obj_id self, obj_id objSpeaker, String strText) throws InterruptedException {
|
||||
if(!isGod(objSpeaker)) {
|
||||
return SCRIPT_CONTINUE;
|
||||
@@ -52,7 +58,7 @@ public class gcw_master_object extends script.base_script {
|
||||
|
||||
// First Time Setup
|
||||
if(!hasObjVar(tatooine, "leaderboard.master_object")) {
|
||||
setObjVar(getPlanetByName("tatooine"), "leaderboard.master_object", self);
|
||||
setObjVar(tatooine, "leaderboard.master_object", self);
|
||||
messageTo(self, "handleLeaderboardFirstTimeSetup", null, 0f, true);
|
||||
leaderboard.debugMsg("Handling board initialization as first time setup...");
|
||||
} else {
|
||||
@@ -115,11 +121,7 @@ public class gcw_master_object extends script.base_script {
|
||||
leaderboard.debugMsg("Skipping period heartbeat because we're already in the middle of running one or in a reset...");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
// don't run if there's no players online
|
||||
if(getNumPlayers() < 1) {
|
||||
leaderboard.debugMsg("Skipping period heartbeat because no players are online...");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
// don't run in a buffer, grab all participants
|
||||
if(leaderboard.isWithinPeriodBuffer() || leaderboard.isWithinStartupBuffer()) {
|
||||
leaderboard.debugMsg("Skipping period heartbeat because we're within a period or startup buffer...");
|
||||
|
||||
Reference in New Issue
Block a user