po-devs/po-server-goodies

Mixed json and MemoryHash, with scripts.js and plugin access

Closed this issue · 2 comments

So far I've managed to access Hangman and Mafia admins with memory hash inside scripts.js but I'm unable to reach inside a plugin module for Trivia and Tours which use json. I don't wanna copy full 2 full functions which should be accessible inside modules in scripts.js unless I need to.

  • What I've got so far:
    if (script.hangmanAdmins.hash.hasOwnProperty(srcName)) return; if (script.hangmanSuperAdmins.hash.hasOwnProperty(srcName)) return; if (script.mafiaAdmins.hash.hasOwnProperty(srcName)) return; if (script.mafiaSuperAdmins.hash.hasOwnProperty(srcName)) return;
  • What I need:
    tours.js (line 4397)
    function isMegaUser(src) {
    trivia.js (line 1376)
    TriviaAdmin.prototype.isTAdmin = function (name) {

This script is a request from Fuzzy for allowing those that are side game staff auth be able to access VR without needing cauth. I've got half done so far. Also I feel it be better to only use one of these methods for handling saved module script data instead of 2.

You could try something like
if (JSON.parse(sys.getFileContent("tadmins.txt")).indexOf(srcName) !== -1) return;
for Trivia Admins and
if (JSON.parse(sys.getFileContent("scriptdata/tourconfig/touradmins.json")).hasOwnProperty(srcName)) return;
However, idk what effect it will have on the server if you make it read the files whenever someone joins VR. I don't think there's a good way to do this unless you redo the isTAdmin and isMegaUser functions.

Midwaymarshall coded a very minimalistic fix for it.