decord/alpha/source/stores/GamePartyStore.tsx

295 lines
8.1 KiB
TypeScript
Raw Normal View History

// Module ID: 13541
// Function ID: 13542
// Name: GamePartyStore
// Dependencies: [502, 4406, 5498, 1074, 12, 504, 573, 2]
2026-07-20 16:05:17 +00:00
// Module 13541 (GamePartyStore)
import _modDef12 from "module_12" /* 12 */;
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import RelationshipStore from "RelationshipStore" /* 4406 */;
import SelfPresenceStore from "SelfPresenceStore" /* 5498 */;
2026-07-23 10:11:24 +00:00
function updateParty(id, id2, activities, status) {
2026-07-29 08:29:29 +00:00
const found = activities.find((party) => {
let BooleanResult = null != party.party;
if (BooleanResult) {
const _Boolean = Boolean;
BooleanResult = Boolean(party.party.id);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return BooleanResult;
});
2026-07-20 16:05:17 +00:00
id = null;
if (null != found) {
id = null;
if (null != found.party) {
id = found.party.id;
}
}
let obj = dependencyMap[id2];
2026-07-29 08:29:29 +00:00
if (obj == null) {
obj = {};
}
2026-07-20 16:05:17 +00:00
if (null != id) {
2026-07-23 10:11:24 +00:00
if (status !== constants.OFFLINE) {
2026-07-29 08:29:29 +00:00
if (null != tmp8) {
if (tmp8 === id) {
2026-07-20 16:05:17 +00:00
return false;
} else {
let obj2 = dependencyMap[id2];
if (obj2 == null) {
obj2 = {};
2026-07-29 08:29:29 +00:00
}
if (null != obj2[id]) {
2026-07-29 08:29:29 +00:00
delete tmp5[tmp];
if (obj3.isEmpty(dependencyMap[id2])) {
2026-07-29 08:29:29 +00:00
delete tmp2[tmp3];
}
value = map.get(tmp9);
2026-07-29 08:29:29 +00:00
if (null != value) {
value.delete(id2);
2026-07-29 08:29:29 +00:00
if (0 === value.size) {
map.delete(tmp9);
}
}
obj3 = _modDef12;
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}
}
let tmp19 = dependencyMap[id2];
2026-07-29 08:29:29 +00:00
if (null == tmp19) {
const obj4 = {};
dependencyMap[id2] = obj4;
tmp19 = obj4;
2026-07-20 16:05:17 +00:00
}
tmp19[id] = id;
if (!RelationshipStore.isBlocked(id2)) {
if (!RelationshipStore.isIgnored(id2)) {
let value3 = map.get(id);
if (value3 == null) {
2026-07-20 16:05:17 +00:00
const _Set = Set;
value3 = new Set();
2026-07-20 16:05:17 +00:00
}
const result = map.set(id, value3);
value3.add(id2);
2026-07-20 16:05:17 +00:00
}
}
return true;
}
}
2026-07-29 08:29:29 +00:00
let flag3 = null != tmp8;
2026-07-20 16:05:17 +00:00
if (flag3) {
let obj5 = dependencyMap[id2];
if (obj5 == null) {
obj5 = {};
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
flag3 = true;
if (null != obj5[id]) {
2026-07-29 08:29:29 +00:00
delete tmp4[tmp];
if (obj9.isEmpty(dependencyMap[id2])) {
2026-07-29 08:29:29 +00:00
delete tmp[tmp3];
}
const value4 = map.get(tmp29);
2026-07-29 08:29:29 +00:00
flag3 = true;
if (null != value4) {
value4.delete(id2);
2026-07-29 08:29:29 +00:00
flag3 = true;
if (0 === value4.size) {
2026-07-29 08:29:29 +00:00
map.delete(tmp29);
flag3 = true;
}
}
obj9 = _modDef12;
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}
return flag3;
}
function handleGuildCreate(guild) {
guild = guild.guild;
let flag = false;
2026-07-29 08:29:29 +00:00
for (const item10009 of tmp) {
if (false !== updateParty(guild.id, item10009.user.id, item10009.activities, item10009.status)) {
flag = true;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
continue;
}
return flag;
2026-07-20 16:05:17 +00:00
}
function handleLocalPresenceUpdate() {
const id = AuthenticationStore.getId();
return updateParty(timestampProducer, id, SelfPresenceStore.getActivities());
2026-07-20 16:05:17 +00:00
}
function handleRelationshipAddOrUpdate(relationship) {
relationship = relationship.relationship;
if (!RelationshipStore.isBlocked(relationship.id)) {
2026-07-29 08:29:29 +00:00
if (!obj.isIgnored(relationship.id)) {
2026-07-20 16:05:17 +00:00
return false;
}
}
2026-07-23 10:11:24 +00:00
if (null == dependencyMap[relationship.id]) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const values = _modDef12.values(tmp);
2026-07-29 08:29:29 +00:00
for (const item10025 of values) {
value = map.get(item10025);
2026-07-29 08:29:29 +00:00
let obj3 = value;
if (null != value) {
let deleteResult = obj3.delete(relationship.id);
}
continue;
2026-07-20 16:05:17 +00:00
}
}
obj = RelationshipStore;
2026-07-20 16:05:17 +00:00
}
const Constants = fn(1074);
({ StatusTypes: hasOwnProperty, ME: metroRequire } = Constants);
const dependencyMap = {};
2026-07-23 10:11:24 +00:00
let map = new Map();
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class GamePartyStore extends Store {
}
const prototype = GamePartyStore.prototype;
prototype["initialize"] = function initialize() {
const items = [SelfPresenceStore];
2026-07-29 08:29:29 +00:00
this.syncWith(items, handleLocalPresenceUpdate);
this.waitFor(AuthenticationStore, RelationshipStore, SelfPresenceStore);
2026-07-29 08:29:29 +00:00
};
prototype["getParty"] = function getParty(id) {
value = null;
2026-07-29 08:29:29 +00:00
if (null != id) {
value = null;
if (map.has(id)) {
value = map.get(id);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return value;
};
prototype["getUserParties"] = function getUserParties() {
return closure_7;
};
prototype["getParties"] = function getParties() {
return map;
};
GamePartyStore.displayName = "GamePartyStore";
const gamePartyStore = new GamePartyStore(DispatcherDefault, {
2026-07-29 08:29:29 +00:00
CONNECTION_OPEN_SUPPLEMENTAL: function handleConnectionOpenSupplemental(arg0) {
({ guilds, presences } = arg0);
2026-07-20 16:05:17 +00:00
let flag = false;
2026-07-29 08:29:29 +00:00
const iter = presences[Symbol.iterator]();
while (iter !== undefined) {
({ user, status, activities } = nextResult);
let tmp3 = null != user;
if (tmp3) {
tmp3 = false !== updateParty(timestampProducer, tmp2.id, activities, status);
2026-07-29 08:29:29 +00:00
}
if (tmp3) {
flag = true;
}
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
for (const item10032 of guilds) {
let obj = { guild: item10032 };
2026-07-29 08:29:29 +00:00
if (false !== handleGuildCreate(obj)) {
flag = true;
}
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return flag;
2026-07-20 16:05:17 +00:00
},
OVERLAY_INITIALIZE: function handleOverlayInitialize(parties) {
parties = parties.parties;
2026-08-24 06:08:38 +00:00
map = new Map();
2026-07-23 10:11:24 +00:00
const obj = {};
2026-07-20 16:05:17 +00:00
const merged = Object.assign(parties.userParties);
const keys = Object.keys(parties);
const item = keys.forEach((item) => map.set(item, new Set(parties[item])));
2026-07-20 16:05:17 +00:00
},
GUILD_CREATE: handleGuildCreate,
2026-07-29 08:29:29 +00:00
PRESENCES_REPLACE: function handlePresenceReplace(arg0) {
2026-07-20 16:05:17 +00:00
let flag = false;
2026-07-29 08:29:29 +00:00
const iter = arg0.presences[Symbol.iterator]();
while (iter !== undefined) {
({ user, activities } = nextResult);
let tmp3 = null != user;
if (tmp3) {
tmp3 = false !== updateParty(timestampProducer, tmp2.id, activities);
2026-07-29 08:29:29 +00:00
}
if (tmp3) {
flag = true;
}
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return flag;
2026-07-20 16:05:17 +00:00
},
PRESENCE_UPDATES: function handlePresenceUpdates(updates) {
updates = updates.updates;
const mapped = updates.map((user) => {
({ guildId, status, activities } = user);
2026-07-29 08:29:29 +00:00
if (guildId == null) {
guildId = closure_1_6;
2026-07-20 16:05:17 +00:00
}
return updateParty(guildId, user.user.id, activities, status);
2026-07-20 16:05:17 +00:00
});
return mapped.some((item) => item);
2026-07-20 16:05:17 +00:00
},
THREAD_MEMBER_LIST_UPDATE: function handleThreadMemberListUpdate(members) {
members = members.members;
2026-07-29 08:29:29 +00:00
const mapped = members.map((presence) => presence.presence);
const guildId = members.guildId;
2026-08-24 06:08:38 +00:00
c1 = false;
2026-07-29 08:29:29 +00:00
const item = mapped.forEach((user) => {
let tmp = null != user;
if (tmp) {
tmp = updateParty(closure_0, user.user.id, user.activities, user.status);
2026-07-29 08:29:29 +00:00
}
if (tmp) {
2026-08-24 06:08:38 +00:00
c1 = true;
2026-07-29 08:29:29 +00:00
}
});
return c1;
2026-07-20 16:05:17 +00:00
},
THREAD_MEMBERS_UPDATE: function handleThreadMembersUpdate(addedMembers) {
addedMembers = addedMembers.addedMembers;
let tmp2 = null != addedMembers;
if (tmp2) {
2026-07-29 08:29:29 +00:00
const mapped = addedMembers.map((presence) => presence.presence);
2026-08-24 06:08:38 +00:00
importDefault = tmp;
c1 = false;
2026-07-29 08:29:29 +00:00
const item = mapped.forEach((user) => {
let tmp = null != user;
if (tmp) {
tmp = updateParty(closure_0, user.user.id, user.activities, user.status);
2026-07-29 08:29:29 +00:00
}
if (tmp) {
2026-08-24 06:08:38 +00:00
c1 = true;
2026-07-29 08:29:29 +00:00
}
});
tmp2 = c1;
2026-07-20 16:05:17 +00:00
}
return tmp2;
},
RELATIONSHIP_ADD: handleRelationshipAddOrUpdate,
RELATIONSHIP_UPDATE: handleRelationshipAddOrUpdate,
RELATIONSHIP_REMOVE: function handleRelationshipRemove(relationship) {
relationship = relationship.relationship;
2026-07-23 10:11:24 +00:00
if (null == dependencyMap[relationship.id]) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const values = _modDef12.values(tmp);
2026-07-29 08:29:29 +00:00
for (const item10017 of values) {
value = map.get(item10017);
2026-07-29 08:29:29 +00:00
let obj2 = value;
if (null != value) {
let addResult = obj2.add(relationship.id);
}
continue;
2026-07-20 16:05:17 +00:00
}
}
}
});
const size = fn(2);
let result = size.fileFinishedImporting("stores/GamePartyStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default gamePartyStore;