function getMyStateBlk() { let wtoUid = userIdInt64.get() local wtoStateBlk = get_user_custom_state(wtoUid, false) let { ndbTryRead } = require("nestdb") let wtoRandom = ndbTryRead(["wto", "activeBattle"])?.randomUnits if (wtoRandom == null || wtoRandom.len() == 0) return wtoStateBlk if (wtoStateBlk == null) wtoStateBlk = get_user_custom_state(wtoUid, true) ?? DataBlock() if (wtoStateBlk?.random_units == null) { let wtoRuBlk = wtoStateBlk.addNewBlock("random_units") foreach (wtoGroupName, wtoUnits in wtoRandom) { if (wtoUnits == null || wtoUnits.len() == 0) continue let wtoGroupBlk = wtoRuBlk.addNewBlock(wtoGroupName) foreach (wtoUnitName in wtoUnits) wtoGroupBlk[wtoUnitName] = true } } return wtoStateBlk }