Skip to content

Commit

Permalink
Trying to create generic kika punishment event
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed May 10, 2024
1 parent 5744a0f commit 827576f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import games.stendhal.server.core.events.TurnNotifier;
import games.stendhal.server.entity.npc.action.IncrementQuestAction;
import games.stendhal.server.entity.player.Player;
import games.stendhal.server.events.GenericEvent;
import games.stendhal.server.util.TimeUtil;


Expand Down Expand Up @@ -184,6 +185,8 @@ public static RequestState requestEntrance(final Player player) {
@Override
public void onTurnReached(int currentTurn) {
if (!notified) {
player.addEvent(new GenericEvent("kika_punishment"));
//player.notifyWorldAboutChanges();
player.sendPrivateText(NotificationType.PRIVMSG, Gatekeeper.ENTITY_NAME,
"You have worn out your welcome and shall be punished for your greed!");
notified = true;
Expand Down
3 changes: 3 additions & 0 deletions src/js/stendhal/event/Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export class Events { // extends Enumeration<string> {

public static readonly GENERIC = "generic_event";

// generic events
public static readonly KIKA_PUNISHMENT = "kika_punishment";

/**
* Static class.
*/
Expand Down
4 changes: 4 additions & 0 deletions src/js/stendhal/event/GenericEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import { Events } from "./Events";
import { RPEvent } from "./RPEvent";

import { KikaPunishmentEvent } from "./generic/KikaPunishmentEvent";


export class GenericEvent extends RPEvent {
[index: string]: any;
Expand All @@ -28,4 +30,6 @@ export class GenericEvent extends RPEvent {
}
event.execute(entity);
}

[Events.KIKA_PUNISHMENT] = new KikaPunishmentEvent();
}
22 changes: 22 additions & 0 deletions src/js/stendhal/event/generic/KikaPunishmentEvent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/***************************************************************************
* Copyright © 2024 - Faiumoni e. V. *
***************************************************************************
***************************************************************************
* *
* 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";


export class KikaPunishmentEvent extends RPEvent {

override execute(entity: any) {
// TODO:
console.log("Kika punishment!");
}
}

0 comments on commit 827576f

Please sign in to comment.