From 827576fbb39c7518a0649b25301629260619457b Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Thu, 9 May 2024 02:39:15 -0700 Subject: [PATCH] Trying to create generic kika punishment event --- .../maps/kikareukin/islands/Gatekeeper.java | 3 +++ src/js/stendhal/event/Events.ts | 3 +++ src/js/stendhal/event/GenericEvent.ts | 4 ++++ .../event/generic/KikaPunishmentEvent.ts | 22 +++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 src/js/stendhal/event/generic/KikaPunishmentEvent.ts diff --git a/src/games/stendhal/server/maps/kikareukin/islands/Gatekeeper.java b/src/games/stendhal/server/maps/kikareukin/islands/Gatekeeper.java index 9168be6d65..d1fb92f3be 100644 --- a/src/games/stendhal/server/maps/kikareukin/islands/Gatekeeper.java +++ b/src/games/stendhal/server/maps/kikareukin/islands/Gatekeeper.java @@ -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; @@ -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; diff --git a/src/js/stendhal/event/Events.ts b/src/js/stendhal/event/Events.ts index eacc93b187..772321de15 100644 --- a/src/js/stendhal/event/Events.ts +++ b/src/js/stendhal/event/Events.ts @@ -23,6 +23,9 @@ export class Events { // extends Enumeration { public static readonly GENERIC = "generic_event"; + // generic events + public static readonly KIKA_PUNISHMENT = "kika_punishment"; + /** * Static class. */ diff --git a/src/js/stendhal/event/GenericEvent.ts b/src/js/stendhal/event/GenericEvent.ts index b020416044..d5c89392aa 100644 --- a/src/js/stendhal/event/GenericEvent.ts +++ b/src/js/stendhal/event/GenericEvent.ts @@ -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; @@ -28,4 +30,6 @@ export class GenericEvent extends RPEvent { } event.execute(entity); } + + [Events.KIKA_PUNISHMENT] = new KikaPunishmentEvent(); } diff --git a/src/js/stendhal/event/generic/KikaPunishmentEvent.ts b/src/js/stendhal/event/generic/KikaPunishmentEvent.ts new file mode 100644 index 0000000000..142fd02961 --- /dev/null +++ b/src/js/stendhal/event/generic/KikaPunishmentEvent.ts @@ -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!"); + } +}