From 39861acb94feaed7c7833597b14ab99e5acea42f Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 30 Aug 2022 17:12:52 -0400 Subject: Three more packets moved --- webAO/packets/handlers/handleCI.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 webAO/packets/handlers/handleCI.ts (limited to 'webAO/packets/handlers/handleCI.ts') diff --git a/webAO/packets/handlers/handleCI.ts b/webAO/packets/handlers/handleCI.ts new file mode 100644 index 0000000..74d3039 --- /dev/null +++ b/webAO/packets/handlers/handleCI.ts @@ -0,0 +1,26 @@ +import { client } from '../../client' +/** + * Handles incoming character information, bundling multiple characters + * per packet. + * CI#0#Phoenix&description&&&&#Miles ... + * @param {Array} args packet arguments + */ +export const handleCI = (args: string[]) => { + // Loop through the 10 characters that were sent + + for (let i = 2; i <= args.length - 2; i++) { + if (i % 2 === 0) { + document.getElementById( + "client_loadingtext" + )!.innerHTML = `Loading Character ${args[1]}/${client.char_list_length}`; + const chargs = args[i].split("&"); + const charid = Number(args[i - 1]); + (( + document.getElementById("client_loadingbar") + )).value = charid; + setTimeout(() => client.handleCharacterInfo(chargs, charid), 500); + } + } + // Request the next pack + client.sendServer(`AN#${Number(args[1]) / 10 + 1}#%`); +} \ No newline at end of file -- cgit From 9b8f8c3f5310b6af15edf8ff933e2d63e05707a7 Mon Sep 17 00:00:00 2001 From: Caleb Date: Thu, 8 Sep 2022 12:13:14 -0400 Subject: Add Sender support --- webAO/packets/handlers/handleCI.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webAO/packets/handlers/handleCI.ts') diff --git a/webAO/packets/handlers/handleCI.ts b/webAO/packets/handlers/handleCI.ts index 74d3039..53e42f7 100644 --- a/webAO/packets/handlers/handleCI.ts +++ b/webAO/packets/handlers/handleCI.ts @@ -22,5 +22,5 @@ export const handleCI = (args: string[]) => { } } // Request the next pack - client.sendServer(`AN#${Number(args[1]) / 10 + 1}#%`); + client.sender.sendServer(`AN#${Number(args[1]) / 10 + 1}#%`); } \ No newline at end of file -- cgit From 93979636fb5d1c60f0da3290e80eb3ca9ead992f Mon Sep 17 00:00:00 2001 From: Caleb Date: Fri, 9 Sep 2022 18:46:42 -0400 Subject: Migrated functions --- webAO/packets/handlers/handleCI.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'webAO/packets/handlers/handleCI.ts') diff --git a/webAO/packets/handlers/handleCI.ts b/webAO/packets/handlers/handleCI.ts index 53e42f7..cb693bc 100644 --- a/webAO/packets/handlers/handleCI.ts +++ b/webAO/packets/handlers/handleCI.ts @@ -1,4 +1,5 @@ import { client } from '../../client' +import { handleCharacterInfo } from '../../client/handleCharacterInfo' /** * Handles incoming character information, bundling multiple characters * per packet. @@ -18,7 +19,7 @@ export const handleCI = (args: string[]) => { (( document.getElementById("client_loadingbar") )).value = charid; - setTimeout(() => client.handleCharacterInfo(chargs, charid), 500); + setTimeout(() => handleCharacterInfo(chargs, charid), 500); } } // Request the next pack -- cgit