Skip to content

Commit

Permalink
Added international for bots
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon committed Aug 21, 2024
1 parent c0c3cb0 commit 7f1144b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions GuildWarsPartySearch.NodeJSServer/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ function on_bot_disconnected(request) {
function on_client_unlocked_maps(request,data) {
assert(request.is_bot_client, "Not bot client");
assert(Array.isArray(data.unlocked_maps),"No unlocked_maps array");
if(JSON.stringify(request.unlocked_maps || []) === JSON.stringify(data.unlocked_maps))
return; // Unlocked maps hasn't changed, so no need to act on it
request.unlocked_maps = data.unlocked_maps;
reassign_bot_clients(request);
}
Expand Down Expand Up @@ -241,7 +243,8 @@ function reassign_bot_clients(request) {
zv = ${find_key(map_ids,zaishen_vanquish.map_id)}`);
let check_district_regions = [
district_regions.America,
district_regions.Europe
district_regions.Europe,
district_regions.International
];

let check_map_ids = [
Expand Down Expand Up @@ -349,8 +352,9 @@ function on_recv_parties(ws, data) {
let maps_affected = {};
maps_affected[map_id] = 1;
// Remove any current parties for this client
all_parties.filter((party) => { return party.client_id === client_id; })
.forEach((party) => {
all_parties.filter((party) => {
return party.client_id === client_id;
}).forEach((party) => {
maps_affected[party.map_id] = 1;
remove_party(party);
})
Expand Down Expand Up @@ -534,7 +538,6 @@ wss.on('connection', function connection(ws, request) {
if(get_client_id(ws)) {
try {
add_bot_client(ws);
reassign_bot_clients();
} catch(e) {
console.error(`[websocket]`,ws.ip,e.message);
ws.ignore = 1;
Expand Down

0 comments on commit 7f1144b

Please sign in to comment.