 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.scripts;
34 import java.io.IOException;
35 import java.util.Collection;
36 import java.util.HashSet;
38 import java.util.concurrent.CopyOnWriteArraySet;
39 import java.util.stream.Collectors;
40 import org.jetbrains.annotations.NotNull;
100 private final Collection<ScriptProcess>
scriptProcesses =
new CopyOnWriteArraySet<>();
137 }
catch (
final IOException ex) {
145 if (result ==
null) {
152 new Thread(scriptProcess,
"JXClient:ScriptProcess:"+scriptProcess).start();
163 public Set<ScriptProcess>
getScripts(@NotNull
final String partialScriptName) {
166 }
catch (
final NumberFormatException ignored) {
178 final Set<ScriptProcess> result =
new HashSet<>();
180 if (scriptProcess.getScriptId() == scriptId) {
181 result.add(scriptProcess);
195 private Set<ScriptProcess>
getScriptsByName(@NotNull
final CharSequence partialScriptName) {
196 return scriptProcesses.stream().filter(scriptProcess -> scriptProcess.getFilename().contains(partialScriptName)).collect(Collectors.toSet());
An external command executed as a client-sided script.
Set< ScriptProcess > getScripts(@NotNull final String partialScriptName)
Returns all running scripts matching a given (partial) name or a script ID.
Set< ScriptProcess > getScriptByScriptId(final int scriptId)
Returns all running scripts matching a given script ID.
final Collection< ScriptProcess > scriptProcesses
All running ScriptProcesses.
Interface for listeners interested in drawinfo messages received from the Crossfire server.
final Stats stats
The Stats instance to watch.
Model class maintaining the CfItems known to the player.
Implements the map model which is shown in the map and magic map views.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
boolean hasScripts()
Returns whether at least one script is running.
final SkillSet skillSet
The SkillSet for looking up skill names.
final MapUpdaterState mapUpdaterState
The MapUpdaterState instance to use.
Manages all known spells.
int NDI_RED
A message color.
ScriptManager(@NotNull final CommandQueue commandQueue, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final Stats stats, @NotNull final FloorView floorView, @NotNull final ItemSet itemSet, @NotNull final SpellsManager spellsManager, @NotNull final MapUpdaterState mapUpdaterState, @NotNull final SkillSet skillSet)
Creates a new instance.
Maintains currently running script processes.
void newScript(@NotNull final String command)
Creates a new script instance.
Set< ScriptProcess > getScriptsByName(@NotNull final CharSequence partialScriptName)
Returns all running scripts matching a given (partial) name.
This is the representation of all the statistics of a player, like its speed or its experience.
A script process that executes an external command.
int NDI_BLACK
A message color.
int nextScriptId
The script ID for the next created script.
void drawInfo(@NotNull String message, int color)
Pretends that a drawinfo message has been received.
final CommandQueue commandQueue
The CommandQueue for sending commands.
final FloorView floorView
The FloorView to use.
Provides a view to all items comprising the current floor view.
Maintain the set of skills as sent by the server.
Update a CfMap model from protocol commands.
void addScriptProcessListener(@NotNull final ScriptProcessListener scriptProcessListener)
Adds a ScriptProcessListener to be notified.
final SpellsManager spellsManager
The spells manager instance to use.
Maintains the pending (ncom) commands sent to the server.
final ItemSet itemSet
The ItemSet instance to use.
final CrossfireServerConnection crossfireServerConnection
The CrossfireServerConnection instance.