Skip to content

Commit

Permalink
populate fields correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
stonedDiscord committed Aug 7, 2024
1 parent 26d5691 commit 8bbb979
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
9 changes: 7 additions & 2 deletions webAO/packets/handlers/handlePR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ function addPlayer(playerID: Number) {
const img = document.createElement('img');
imgCell.appendChild(img);

const nameCell = playerRow.insertCell(1);
const name = document.createTextNode('Unknown');
nameCell.appendChild(name);

const charNameCell = playerRow.insertCell(1);
charNameCell.appendChild(name);
const showNameCell = playerRow.insertCell(2);
showNameCell.appendChild(name);
const oocNameCell = playerRow.insertCell(3);
oocNameCell.appendChild(name);
}

function removePlayer(playerID: Number) {
Expand Down
22 changes: 21 additions & 1 deletion webAO/packets/handlers/handlePU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,25 @@ import { getCharIcon } from "../../client/handleCharacterInfo";
* @param {Array} args packet arguments
*/
export const handlePU = (args: string[]) => {
const playerID = Number(args[1]);
const playerRow = <HTMLTableElement>document.getElementById(`client_playerlist_entry${Number(args[1])}`);
const type = Number(args[2]);
const data = args[3];
switch (type) {
case 0:
const oocName = <HTMLElement>playerRow.childNodes[3];
oocName.innerText = data;
break;
case 1:
const playerImg = <HTMLImageElement>playerRow.childNodes[0].firstChild;
getCharIcon(playerImg, data);
const charName = <HTMLElement>playerRow.childNodes[1];
charName.innerText = data;
break;
case 2:
const showName = <HTMLElement>playerRow.childNodes[2];
showName.innerText = data;
break;
default:
break;
}
}

0 comments on commit 8bbb979

Please sign in to comment.