aboutsummaryrefslogtreecommitdiff
path: root/webAO/dom/areaClick.ts
blob: e217c2c6fca6432e83c85c1ec30730bd4b4197d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { client } from '../client'
import { updatePlayerAreas } from './updatePlayerAreas'
/**
 * Triggered when an item on the area list is clicked.
 * @param {HTMLElement} el
 */
export function area_click(el: HTMLElement) {
    const area = client.areas[el.id.substring(4)].name;
    client.sender.sendMusicChange(area);

    const areaHr = document.createElement("div");
    areaHr.className = "hrtext";
    areaHr.textContent = `switched to ${el.textContent}`;
    document.getElementById("client_log")!.appendChild(areaHr);
    client.area = Number(el.id.substring(4));
    updatePlayerAreas(client.area);
}
window.area_click = area_click;