Skip to content

Commit

Permalink
debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
nhnb committed Sep 19, 2023
1 parent 486292f commit af830b9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions srcjs/stendhal/EventRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ declare var stendhal: any;
import { RPEntity } from "./entity/RPEntity";
import { RPObject } from "./entity/RPObject";

import { ChatOptionsEvent } from "./event/ChatOptionsEvent";
import { ExamineEvent } from "./event/ExamineEvent";
import { GroupChangeEvent } from "./event/GroupChangeEvent";
import { GroupInviteEvent } from "./event/GroupInviteEvent";
Expand Down Expand Up @@ -65,6 +66,7 @@ export class EventRegistry {
}
this.initialized = true;

this.register("chat_options", new ChatOptionsEvent());
this.register("examine", new ExamineEvent());
this.register("group_change_event", new GroupChangeEvent());
this.register("group_invite_event", new GroupInviteEvent());
Expand Down
39 changes: 39 additions & 0 deletions srcjs/stendhal/event/ChatOptionsEvent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/***************************************************************************
* (C) Copyright 2023-2023 - Stendhal *
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation; either version 3 of the *
* License, or (at your option) any later version. *
* *
***************************************************************************/

import { RPEvent } from "./RPEvent";

declare var marauroa: any

/**
* shows an image for a detail view
*/
export class ChatOptionsEvent extends RPEvent {

public npc!: string;
public options!: string;

public execute(entity: any): void {
if (entity !== marauroa.me) {
return;
}

let optionsList = this['options'].split("|~|");
let message = [];
for (let optionListEntry of optionsList) {
let option = optionListEntry.split("|*|");
message.push(option[1]);
}

console.log("Chat options for " + this['npc'] + ": " + message.join(", "));
}

};

0 comments on commit af830b9

Please sign in to comment.