From 72eaca544cd37787e8df0f0c6d44b880e4c70752 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Wed, 24 Sep 2025 15:22:35 -0700 Subject: [PATCH 1/3] Store player's client distribution --- src/games/stendhal/server/actions/CStatusAction.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/games/stendhal/server/actions/CStatusAction.java b/src/games/stendhal/server/actions/CStatusAction.java index f711d5650bd..bf39ba376dd 100644 --- a/src/games/stendhal/server/actions/CStatusAction.java +++ b/src/games/stendhal/server/actions/CStatusAction.java @@ -1,5 +1,5 @@ /*************************************************************************** - * (C) Copyright 2003-2011 - Stendhal * + * (C) Copyright 2003-2025 - Stendhal * *************************************************************************** *************************************************************************** * * @@ -34,6 +34,9 @@ public class CStatusAction implements ActionListener { /** Key is name, value is ID */ public static final Map nameList = new HashMap(); + /** Key is name, value is client dist */ + public static final Map clientList = new HashMap(); + /** registers the action */ public static void register() { CommandCenter.register(CID, new CStatusAction()); @@ -83,5 +86,10 @@ public void onAction(final Player player, final RPAction action) { } } + String clientDist = ""; + if (action.has("dist")) { + clientDist = action.get("dist"); + } + clientList.put(pName, clientDist); } } From d63b88cc0b9e1e98e4e26ba88220ad7d098cd71b Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Wed, 24 Sep 2025 15:24:10 -0700 Subject: [PATCH 2/3] Condition to check if player is using web client --- .../condition/UsingWebClientCondition.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/games/stendhal/server/entity/npc/condition/UsingWebClientCondition.java diff --git a/src/games/stendhal/server/entity/npc/condition/UsingWebClientCondition.java b/src/games/stendhal/server/entity/npc/condition/UsingWebClientCondition.java new file mode 100644 index 00000000000..adb8d999ce5 --- /dev/null +++ b/src/games/stendhal/server/entity/npc/condition/UsingWebClientCondition.java @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright © 2025 - Faiumoni e. V. * + *************************************************************************** + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +package games.stendhal.server.entity.npc.condition; + +import games.stendhal.common.parser.Sentence; +import games.stendhal.server.actions.CStatusAction; +import games.stendhal.server.entity.Entity; +import games.stendhal.server.entity.npc.ChatCondition; +import games.stendhal.server.entity.player.Player; + + +public class UsingWebClientCondition implements ChatCondition { + + @Override + public boolean fire(Player player, Sentence sentence, Entity npc) { + final String playerName = player.getName(); + return CStatusAction.clientList.containsKey(playerName) + && "webclient".equals(CStatusAction.clientList.get(playerName)); + } + + @Override + public String toString() { + return getClass().getSimpleName(); + } + + @Override + public int hashCode() { + return 31 * getClass().getSimpleName().hashCode(); + } + + @Override + public boolean equals(final Object obj) { + return (obj instanceof UsingWebClientCondition); + } +} From ecfe61989d742139f9a3473d064b3e4de4f94b8b Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Wed, 24 Sep 2025 15:25:01 -0700 Subject: [PATCH 3/3] Change Io Flotto's dialogue for web client https://github.com/arianne/stendhal/issues/566 --- src/games/stendhal/server/maps/quests/MeetIo.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/games/stendhal/server/maps/quests/MeetIo.java b/src/games/stendhal/server/maps/quests/MeetIo.java index 6b3b3739581..dae93489641 100644 --- a/src/games/stendhal/server/maps/quests/MeetIo.java +++ b/src/games/stendhal/server/maps/quests/MeetIo.java @@ -1,6 +1,6 @@ /* $Id$ */ /*************************************************************************** - * (C) Copyright 2003-2023 - Stendhal * + * (C) Copyright 2003-2025 - Stendhal * *************************************************************************** *************************************************************************** * * @@ -24,8 +24,10 @@ import games.stendhal.server.entity.npc.action.IncreaseXPAction; import games.stendhal.server.entity.npc.action.MultipleActions; import games.stendhal.server.entity.npc.action.SetQuestAction; +import games.stendhal.server.entity.npc.condition.NotCondition; import games.stendhal.server.entity.npc.condition.QuestCompletedCondition; import games.stendhal.server.entity.npc.condition.QuestNotCompletedCondition; +import games.stendhal.server.entity.npc.condition.UsingWebClientCondition; import games.stendhal.server.entity.player.Player; import games.stendhal.server.maps.Region; import games.stendhal.server.maps.semos.temple.TelepathNPC; @@ -133,11 +135,19 @@ private void prepareIO() { npc.add( ConversationStates.INFORMATION_5, ConversationPhrases.YES_MESSAGES, - null, + new NotCondition(new UsingWebClientCondition()), ConversationStates.INFORMATION_6, "You can travel to the astral plane at any time, thereby saving and closing your game. Just type #/quit, or press the #Esc key, or even simply close the window. Okay! Hmm, I think you want to learn how to float in the air like I do.", null); + npc.add( + ConversationStates.INFORMATION_5, + ConversationPhrases.YES_MESSAGES, + new UsingWebClientCondition(), + ConversationStates.INFORMATION_6, + "You can travel to the astral plane at any time, thereby saving and closing your game. Just open the main menu and select the \"Select character\" button, or even simply close the window. Okay! Hmm, I think you want to learn how to float in the air like I do.", + null); + /** Give the reward to the patient newcomer user */ final String answer = "*yawns* Maybe I'll show you later... I don't want to overload you with too much information at once. You can get a summary of all those lessons at any time, incidentally, just by typing #/help.\n"; npc.add(ConversationStates.INFORMATION_6,