aboutsummaryrefslogtreecommitdiff
path: root/webAO/dom/iniEdit.ts
blob: b26c1795179a60670e377a283940be4c1077dac4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { client } from "../client";
import { handleCharacterInfo } from "../client/handleCharacterInfo";
import { packetHandler } from "../packets/packetHandler";

/**
 * Triggered by the ini button.
 */
export async function iniedit() {
    const iniselect = (<HTMLSelectElement>document.getElementById("client_iniselect"))
    const ininame = (<HTMLInputElement>document.getElementById("client_ininame"));
    const inicharID = client.charID;

    const newname = iniselect.selectedIndex === 0 ? ininame.value : iniselect.value;

    await handleCharacterInfo(newname.split("&"), inicharID);
    packetHandler.get("PV")!(`PV#0#CID#${inicharID}`.split("#"));
}
window.iniedit = iniedit;