aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--webAO/client/sender/index.ts5
-rw-r--r--webAO/client/sender/sendMA.ts11
-rw-r--r--webAO/dom/banPlayer.ts14
-rw-r--r--webAO/dom/window.ts3
-rw-r--r--webAO/packets/handlers/handlePR.ts11
-rw-r--r--webAO/packets/handlers/handlePV.ts2
6 files changed, 41 insertions, 5 deletions
diff --git a/webAO/client/sender/index.ts b/webAO/client/sender/index.ts
index 41a6bd5..4781ec1 100644
--- a/webAO/client/sender/index.ts
+++ b/webAO/client/sender/index.ts
@@ -11,6 +11,7 @@ import {sendZZ} from './sendZZ'
import {sendEE} from './sendEE'
import {sendDE} from './sendDE'
import {sendPE} from './sendPE'
+import {sendMA} from './sendMA'
export interface ISender {
sendIC: (deskmod: number,
preanim: string,
@@ -50,6 +51,7 @@ export interface ISender {
sendEE: (id: number, name: string, desc: string, img: string) => void
sendDE: (id: number) => void
sendPE: (name: string, desc: string, img: string) => void
+ sendMA: (id: number, length: number, reason: string) => void
}
export const sender = {
sendIC,
@@ -64,5 +66,6 @@ export const sender = {
sendZZ,
sendEE,
sendDE,
- sendPE
+ sendPE,
+ sendMA
} \ No newline at end of file
diff --git a/webAO/client/sender/sendMA.ts b/webAO/client/sender/sendMA.ts
new file mode 100644
index 0000000..5ba4e4b
--- /dev/null
+++ b/webAO/client/sender/sendMA.ts
@@ -0,0 +1,11 @@
+import { client } from "../../client";
+
+/**
+ * Sends mod command.
+ * @param {number} id player id
+ * @param {number} length in hours
+ * @param {string} reason player message
+ */
+export const sendMA = (id: number, length: number, reason: string) => {
+ client.sender.sendServer(`MA#${id}#${length}#${reason}#%`);
+} \ No newline at end of file
diff --git a/webAO/dom/banPlayer.ts b/webAO/dom/banPlayer.ts
new file mode 100644
index 0000000..a8f6d5a
--- /dev/null
+++ b/webAO/dom/banPlayer.ts
@@ -0,0 +1,14 @@
+import { client } from '../client'
+/**
+ * Tries to ban a player from the playerlist
+ * @param {Number} id the players id
+ */
+export function banPlayer(id: number) {
+ let reason;
+ let length;
+ reason = prompt("Please enter the ban reason", "");
+ length = Number(prompt("Please enter the ban length in hours", ""));
+
+ client.sender.sendMA(id, length, reason);
+}
+window.banPlayer = banPlayer; \ No newline at end of file
diff --git a/webAO/dom/window.ts b/webAO/dom/window.ts
index 3215b89..f2cd86c 100644
--- a/webAO/dom/window.ts
+++ b/webAO/dom/window.ts
@@ -26,7 +26,7 @@ declare global {
editEvidence: () => void;
addEvidence: () => void;
pickEvidence: (evidence: any) => void;
- pickEmotion: (emo: any) => void;
+ pickEmotion: (emo: number) => void;
pickChar: (ccharacter: any) => void;
chartable_filter: (_event: any) => void;
ReconnectButton: (_event: any) => void;
@@ -52,6 +52,7 @@ declare global {
onEnter: (event: any) => void;
onReplayGo: (_event: any) => void;
onOOCEnter: (_event: any) => void;
+ banPlayer: (id: number) => void;
hcallback: (_event: any) => void;
}
}
diff --git a/webAO/packets/handlers/handlePR.ts b/webAO/packets/handlers/handlePR.ts
index d3f4364..a52ad1f 100644
--- a/webAO/packets/handlers/handlePR.ts
+++ b/webAO/packets/handlers/handlePR.ts
@@ -1,6 +1,7 @@
import { client } from "../../client";
+import { banPlayer } from '../../dom/banPlayer'
-function addPlayer(playerID: Number) {
+function addPlayer(playerID: number) {
const list = <HTMLTableElement>document.getElementById("client_playerlist");
const playerRow = list.insertRow();
playerRow.id = `client_playerlist_entry${playerID}`;
@@ -17,9 +18,15 @@ function addPlayer(playerID: Number) {
showNameCell.appendChild(name);
const oocNameCell = playerRow.insertCell(3);
oocNameCell.appendChild(name);
+
+ const banCell = playerRow.insertCell(4);
+ const ban = <HTMLButtonElement>document.createElement("button");
+ ban.innerText = "Ban";
+ ban.onclick = () => { window.banPlayer(playerID) }
+ banCell.appendChild(ban);
}
-function removePlayer(playerID: Number) {
+function removePlayer(playerID: number) {
const playerRow = <HTMLTableElement>document.getElementById(`client_playerlist_entry${playerID}`);
playerRow.remove();
}
diff --git a/webAO/packets/handlers/handlePV.ts b/webAO/packets/handlers/handlePV.ts
index 38657be..5a04b89 100644
--- a/webAO/packets/handlers/handlePV.ts
+++ b/webAO/packets/handlers/handlePV.ts
@@ -4,7 +4,7 @@ import { updateActionCommands } from '../../dom/updateActionCommands'
import { pickEmotion } from '../../dom/pickEmotion'
import { AO_HOST } from "../../client/aoHost";
-function addEmoteButton(i: Number, imgurl: string, desc: string) {
+function addEmoteButton(i: number, imgurl: string, desc: string) {
const emotesList = document.getElementById("client_emo");
const emote_item = new Image();
emote_item.id = "emo_" + i;