From 8fac56c948917d79ac49d19df0b12056660882ba Mon Sep 17 00:00:00 2001 From: AconiteGodOfSWG Date: Tue, 16 Mar 2021 12:07:53 -0400 Subject: [PATCH] Dirty Cell Perms Update (Fix for DWB/GEO) --- .../compiled/game/script/base_class.java | 21 ++++++++++--- .../compiled/game/script/gm/cmd.java | 31 ++++++++++++++++++- .../game/script/theme_park/corellia/read.me | 2 -- .../theme_park/dungeon/corvette/locked.java | 4 +++ .../dungeon/death_watch_bunker/door_lock.java | 8 +++++ .../locked_crafting_room.java | 4 +++ .../theme_park/dungeon/diant_zuy/keypad.java | 1 + .../geonosian_madbio_bunker/door_lock.java | 4 +++ 8 files changed, 68 insertions(+), 7 deletions(-) delete mode 100755 sku.0/sys.server/compiled/game/script/theme_park/corellia/read.me diff --git a/sku.0/sys.server/compiled/game/script/base_class.java b/sku.0/sys.server/compiled/game/script/base_class.java index 002be9e3a..a885029e3 100755 --- a/sku.0/sys.server/compiled/game/script/base_class.java +++ b/sku.0/sys.server/compiled/game/script/base_class.java @@ -8,10 +8,7 @@ package script; import script.library.utils; import java.io.File; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.List; -import java.util.Vector; +import java.util.*; public class base_class @@ -19854,6 +19851,22 @@ public class base_class _expelFromBuilding(getLongWithNull(target)); } + /** + * Sends a dirty cell permissions update message directly to a player's client to forcibly + * update the client's cell permissions cache with regards to the cell in question as a means of + * more quickly granting/revoking access to a cell (e.g. in Death Watch Bunker). + * + * @param cell the obj_id of the cell you are updating permissions for + * @param player the obj_id of the player (and thus their client) to send the notification to + * @param isAllowed true if they are being added to enter a cell, false if they are being removed/banned + */ + public static void sendDirtyCellPermissionsUpdate(obj_id cell, obj_id player, boolean isAllowed) { + _sendDirtyCellPermissionsUpdateToClient(getLongWithNull(cell), getLongWithNull(player), isAllowed); + } + private static native void _sendDirtyCellPermissionsUpdateToClient(long cell, long player, boolean isAllowed); + + + /*@}*/ /** diff --git a/sku.0/sys.server/compiled/game/script/gm/cmd.java b/sku.0/sys.server/compiled/game/script/gm/cmd.java index 885b8ff5f..f1d46caf0 100755 --- a/sku.0/sys.server/compiled/game/script/gm/cmd.java +++ b/sku.0/sys.server/compiled/game/script/gm/cmd.java @@ -3,6 +3,7 @@ package script.gm; import script.*; import script.library.*; +import java.util.Arrays; import java.util.StringTokenizer; import java.util.Vector; @@ -3999,6 +4000,7 @@ public class cmd extends script.base_script instance.removePlayerFlagForInstance(target, flag); } } + removeObjVar(target, "mand.acknowledge"); sendSystemMessageTestingOnly(target, "You are no longer flagged for or overriding instance authorization."); if(target != self) { sendSystemMessageTestingOnly(self, "setInstanceAuthorized: You have removed flags and instance authorization for "+getPlayerName(target)+" ("+target+"). Use this command again to re-grant instance overrides."); @@ -4012,6 +4014,7 @@ public class cmd extends script.base_script instance.flagPlayerForInstance(target, flag); } } + setObjVar(target, "mand.acknowledge", 1); sendSystemMessageTestingOnly(target, "You are now flagged for all instances and overriding instance authorization."); if(target != self) { sendSystemMessageTestingOnly(self, "setInstanceAuthorized: You have flagged "+getPlayerName(target)+" ("+target+") to access all instances and overrode their instance authorization. Use this command again to revert this override."); @@ -4334,7 +4337,31 @@ public class cmd extends script.base_script return SCRIPT_CONTINUE; } - if(command.equalsIgnoreCase("getRotation")) { + if(command.equalsIgnoreCase("dumpPermsForCell")) { + + obj_id oid; + if(!st.hasMoreTokens()) { + sendSystemMessageTestingOnly(self, "Syntax: /admin dumpPermsForCell "); + return SCRIPT_CONTINUE; + } else { + oid = obj_id.getObjId(Long.parseLong(st.nextToken())); + } + if (!isValidId(oid)) { + sendSystemMessageTestingOnly(self, "The object specified for dumpPermsForCell was not valid."); + return SCRIPT_CONTINUE; + } + + String message = "Access Permissions for Cell "+oid+":\n\n" + + "Cell is Public? "+permissionsIsPublic(oid) + "\n\n" + + "Allowed List: \n" + Arrays.toString(permissionsGetAllowed(oid)) + "\n\n" + + "Banned List: \n" + Arrays.toString(permissionsGetBanned(oid)) + "\n\n"; + + sui.msgbox(self, self, message, sui.OK_ONLY, "Cell Permissions", "noHandler"); + + return SCRIPT_CONTINUE; + } + + else if(command.equalsIgnoreCase("getRotation")) { obj_id oid; if(!st.hasMoreTokens()) { @@ -4422,6 +4449,8 @@ public class cmd extends script.base_script private static void showAdminCmdSyntax(obj_id self) throws InterruptedException { sendSystemMessageTestingOnly(self, "Outputting nested commands and syntax of /admin to console"); sendConsoleMessage(self, "\\#ffff00 ============ Syntax: /admin commands ============ \\#."); + sendConsoleMessage(self, "\\#00ffff dumpPermsForCell \\#bfff00 \\#."); + sendConsoleMessage(self, "returns the public status and permissions list for the provided cell"); sendConsoleMessage(self, "\\#00ffff getRotation \\#bfff00 \\#."); sendConsoleMessage(self, "returns the quaternions and rotation of an object"); sendConsoleMessage(self, "\\#00ffff getUsername \\#bfff00 \\#."); diff --git a/sku.0/sys.server/compiled/game/script/theme_park/corellia/read.me b/sku.0/sys.server/compiled/game/script/theme_park/corellia/read.me deleted file mode 100755 index ccc11d8ce..000000000 --- a/sku.0/sys.server/compiled/game/script/theme_park/corellia/read.me +++ /dev/null @@ -1,2 +0,0 @@ -This is a read.me file -You are in a directory. There is a mailbox here. diff --git a/sku.0/sys.server/compiled/game/script/theme_park/dungeon/corvette/locked.java b/sku.0/sys.server/compiled/game/script/theme_park/dungeon/corvette/locked.java index 4405bc1b0..65a688849 100755 --- a/sku.0/sys.server/compiled/game/script/theme_park/dungeon/corvette/locked.java +++ b/sku.0/sys.server/compiled/game/script/theme_park/dungeon/corvette/locked.java @@ -25,6 +25,7 @@ public class locked extends script.base_script if (isIdValid(thisPlayer)) { String fname = getFirstName(thisPlayer); permissionsAddAllowed(self, fname); + sendDirtyCellPermissionsUpdate(self, thisPlayer, true); } } return SCRIPT_CONTINUE; @@ -43,6 +44,7 @@ public class locked extends script.base_script if (isIdValid(thisPlayer)) { String fname = getFirstName(thisPlayer); permissionsAddAllowed(self, fname); + sendDirtyCellPermissionsUpdate(self, thisPlayer, true); } } return SCRIPT_CONTINUE; @@ -84,6 +86,7 @@ public class locked extends script.base_script permList = utils.addElement(permList, player); utils.setResizeableBatchObjVar(room, "access", permList); } + sendDirtyCellPermissionsUpdate(room, player, true); return SCRIPT_CONTINUE; } public int removeFromList(obj_id self, dictionary params) throws InterruptedException @@ -107,6 +110,7 @@ public class locked extends script.base_script } permList = utils.removeElement(permList, player); utils.setResizeableBatchObjVar(room, "access", permList); + sendDirtyCellPermissionsUpdate(room, player, false); return SCRIPT_CONTINUE; } public int unlock(obj_id self, dictionary params) throws InterruptedException diff --git a/sku.0/sys.server/compiled/game/script/theme_park/dungeon/death_watch_bunker/door_lock.java b/sku.0/sys.server/compiled/game/script/theme_park/dungeon/death_watch_bunker/door_lock.java index e0df9e71d..f804140d6 100755 --- a/sku.0/sys.server/compiled/game/script/theme_park/dungeon/death_watch_bunker/door_lock.java +++ b/sku.0/sys.server/compiled/game/script/theme_park/dungeon/death_watch_bunker/door_lock.java @@ -31,6 +31,8 @@ public class door_lock extends script.base_script String fname = getFirstName(thisPlayer); permissionsAddAllowed(self, fname); permissionsAddAllowed(getSmallRoom(), fname); + sendDirtyCellPermissionsUpdate(self, thisPlayer, true); + sendDirtyCellPermissionsUpdate(getSmallRoom(), thisPlayer, true); } } return SCRIPT_CONTINUE; @@ -51,6 +53,8 @@ public class door_lock extends script.base_script String fname = getFirstName(thisPlayer); permissionsAddAllowed(self, fname); permissionsAddAllowed(getSmallRoom(), fname); + sendDirtyCellPermissionsUpdate(self, thisPlayer, true); + sendDirtyCellPermissionsUpdate(getSmallRoom(), thisPlayer, true); } } return SCRIPT_CONTINUE; @@ -124,6 +128,8 @@ public class door_lock extends script.base_script permList = utils.addElement(permList, player); utils.setResizeableBatchObjVar(room, VAR_ACCESS_LIST, permList); } + sendDirtyCellPermissionsUpdate(room, player, true); + sendDirtyCellPermissionsUpdate(getSmallRoom(), player, true); return SCRIPT_CONTINUE; } public int removeFromList(obj_id self, dictionary params) throws InterruptedException @@ -148,6 +154,8 @@ public class door_lock extends script.base_script } permList = utils.removeElement(permList, player); utils.setResizeableBatchObjVar(room, VAR_ACCESS_LIST, permList); + sendDirtyCellPermissionsUpdate(room, player, false); + sendDirtyCellPermissionsUpdate(getSmallRoom(), player, false); return SCRIPT_CONTINUE; } public boolean convertAccessList(obj_id room) throws InterruptedException diff --git a/sku.0/sys.server/compiled/game/script/theme_park/dungeon/death_watch_bunker/locked_crafting_room.java b/sku.0/sys.server/compiled/game/script/theme_park/dungeon/death_watch_bunker/locked_crafting_room.java index 9e1e17823..c4406cbff 100755 --- a/sku.0/sys.server/compiled/game/script/theme_park/dungeon/death_watch_bunker/locked_crafting_room.java +++ b/sku.0/sys.server/compiled/game/script/theme_park/dungeon/death_watch_bunker/locked_crafting_room.java @@ -41,6 +41,7 @@ public class locked_crafting_room extends script.base_script obj_id self = getSelf(); String fname = getFirstName(player); permissionsAddAllowed(self, fname); + sendDirtyCellPermissionsUpdate(self, player, true); if (group.isGrouped(player)) { obj_id groupObj = getGroupObject(player); @@ -51,6 +52,7 @@ public class locked_crafting_room extends script.base_script if (groupie != player) { String firstName = getFirstName(groupie); permissionsAddAllowed(self, firstName); + sendDirtyCellPermissionsUpdate(self, groupie, true); } } } @@ -58,6 +60,7 @@ public class locked_crafting_room extends script.base_script else { permissionsAddAllowed(self, fname); + sendDirtyCellPermissionsUpdate(self, player, true); } return; } @@ -69,6 +72,7 @@ public class locked_crafting_room extends script.base_script { for (String thisMember : currentList) { permissionsRemoveAllowed(self, thisMember); + sendDirtyCellPermissionsUpdate(self, getPlayerIdFromFirstName(thisMember), false); } } return; diff --git a/sku.0/sys.server/compiled/game/script/theme_park/dungeon/diant_zuy/keypad.java b/sku.0/sys.server/compiled/game/script/theme_park/dungeon/diant_zuy/keypad.java index 3f4794b53..a95c8926b 100755 --- a/sku.0/sys.server/compiled/game/script/theme_park/dungeon/diant_zuy/keypad.java +++ b/sku.0/sys.server/compiled/game/script/theme_park/dungeon/diant_zuy/keypad.java @@ -75,6 +75,7 @@ public class keypad extends script.base_script String playerName = getFirstName(player); obj_id pantry = getCellId(top, "pantry"); permissionsAddAllowed(pantry, playerName); + sendDirtyCellPermissionsUpdate(pantry, player, true); } else { diff --git a/sku.0/sys.server/compiled/game/script/theme_park/dungeon/geonosian_madbio_bunker/door_lock.java b/sku.0/sys.server/compiled/game/script/theme_park/dungeon/geonosian_madbio_bunker/door_lock.java index 23dd4faf8..6ca4971ab 100755 --- a/sku.0/sys.server/compiled/game/script/theme_park/dungeon/geonosian_madbio_bunker/door_lock.java +++ b/sku.0/sys.server/compiled/game/script/theme_park/dungeon/geonosian_madbio_bunker/door_lock.java @@ -28,6 +28,7 @@ public class door_lock extends script.base_script if (isIdValid(thisPlayer)) { String fname = getFirstName(thisPlayer); permissionsAddAllowed(self, fname); + sendDirtyCellPermissionsUpdate(self, thisPlayer, true); } } return SCRIPT_CONTINUE; @@ -46,6 +47,7 @@ public class door_lock extends script.base_script if (isIdValid(thisPlayer)) { String fname = getFirstName(thisPlayer); permissionsAddAllowed(self, fname); + sendDirtyCellPermissionsUpdate(self, thisPlayer, true); } } return SCRIPT_CONTINUE; @@ -79,6 +81,7 @@ public class door_lock extends script.base_script { CustomerServiceLog("DUNGEON_GeonosianBunker", "*Geonosian Finish: " + player + ": " + fname + " has entered the Last Room of the Bunker."); } + sendDirtyCellPermissionsUpdate(room, player, true); return SCRIPT_CONTINUE; } public int removeFromList(obj_id self, dictionary params) throws InterruptedException @@ -102,6 +105,7 @@ public class door_lock extends script.base_script } permList = utils.removeElement(permList, player); utils.setResizeableBatchObjVar(room, VAR_ACCESS_LIST, permList); + sendDirtyCellPermissionsUpdate(room, player, false); return SCRIPT_CONTINUE; } public boolean convertAccessList(obj_id room) throws InterruptedException