Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/games/stendhal/server/actions/CStatusAction.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
* (C) Copyright 2003-2011 - Stendhal *
* (C) Copyright 2003-2025 - Stendhal *
***************************************************************************
***************************************************************************
* *
Expand Down Expand Up @@ -34,6 +34,9 @@ public class CStatusAction implements ActionListener {
/** Key is name, value is ID */
public static final Map<String, String> nameList = new HashMap<String, String>();

/** Key is name, value is client dist */
public static final Map<String, String> clientList = new HashMap<String, String>();

/** registers the action */
public static void register() {
CommandCenter.register(CID, new CStatusAction());
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
14 changes: 12 additions & 2 deletions src/games/stendhal/server/maps/quests/MeetIo.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* $Id$ */
/***************************************************************************
* (C) Copyright 2003-2023 - Stendhal *
* (C) Copyright 2003-2025 - Stendhal *
***************************************************************************
***************************************************************************
* *
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Loading