RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.game.action.impl.DebugAction Class Reference

This is a debug action. More...

Inheritance diagram for com.runehive.game.action.impl.DebugAction:
Collaboration diagram for com.runehive.game.action.impl.DebugAction:

Public Member Functions

 DebugAction (Player player)
void execute ()
 A function representing the unit of work that will be carried out.
Public Member Functions inherited from com.runehive.game.task.Task
Task attach (Object newKey)
 Attaches a new key.
synchronized final void cancel ()
 Cancels all subsequent executions.
synchronized final void cancel (boolean logout)
 Cancels all subsequent executions.
boolean canRun ()
 Determines if the task can be ran.
Optional< Object > getAttachment ()
String getCreationStackTraceStr ()
int getDelay ()
Long getElapsedTimeFromRunStartTime ()
Optional< Long > getRunStartTime ()
long getTaskCreationTime ()
String getTaskId ()
boolean isInstant ()
boolean isRunning ()
void setDelay (int delay)
 Sets the cyclic delay.
void setExecutionTime ()
 Task (boolean instant, int delay)
 Creates a new Task.
 Task (int delay)
 Creates a new Task that doesn't execute instantly.

Private Member Functions

void input (Player player)
final void save ()

Private Attributes

Map< Integer, String > DATA = new HashMap<>()
int identification
boolean inputTaken
boolean pause
final Player player
int tick

Additional Inherited Members

Protected Member Functions inherited from com.runehive.game.task.Task
void baseExecute ()
boolean canSchedule ()
 A function executed on registration.
void onCancel (boolean logout)
 A function executed on cancellation.
void onSchedule ()
 A function executed on registration.
Package Functions inherited from com.runehive.game.task.Task
void onException (Exception e)
 A function executed on thrown exceptions.
void onLoop ()
 A function executed when iterated over.
final synchronized void process ()
synchronized void setRunning (boolean running)

Detailed Description

This is a debug action.

Feel free to modify this how you want to test whatever.

Author
Daniel

Definition at line 21 of file DebugAction.java.

Constructor & Destructor Documentation

◆ DebugAction()

com.runehive.game.action.impl.DebugAction.DebugAction ( Player player)

Definition at line 35 of file DebugAction.java.

35 {
36 super(true, 1);
37 this.player = player;
38 this.tick = 0;
39 this.identification = 0;
40 this.inputTaken = false;
41 this.pause = false;
42 this.DATA = new HashMap<>();
43 }

References player.

Member Function Documentation

◆ execute()

void com.runehive.game.action.impl.DebugAction.execute ( )

A function representing the unit of work that will be carried out.

Reimplemented from com.runehive.game.task.Task.

Definition at line 64 of file DebugAction.java.

64 {
65 if (inputTaken) {
66 if (tick++ == 1) {
67 input(player);
68 }
69 return;
70 }
71
72 if (pause) {
73 player.dialogueFactory.sendOption(
74 "Empty",
75 () -> pause = false,
76
77 "Enter", () -> {
78 player.dialogueFactory.clear();
79 tick = 0;
80 inputTaken = true;
81 },
82 "Save & End",
83 () -> {
84 save();
85 cancel();
86 player.send(new SendMessage("A total of " + DATA.size() + " interfaces were saved."));
87 }).execute();
88 return;
89 }
90
91 identification++;
92 player.interfaceManager.open(identification);
93 player.send(new SendMessage("Opening itemcontainer: " + identification, MessageColor.DARK_RED));
94 pause = true;
95 }

References com.runehive.game.task.Task.cancel(), com.runehive.util.MessageColor.DARK_RED, DATA, execute(), identification, input(), inputTaken, pause, player, save(), and tick.

Referenced by execute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ input()

void com.runehive.game.action.impl.DebugAction.input ( Player player)
private

Definition at line 54 of file DebugAction.java.

54 {
55 player.send(new SendInputMessage("Enter the itemcontainer description", 100, input -> {
56 DATA.put(identification, input);
57 inputTaken = false;
58 pause = false;
59 }));
60 }

References DATA, identification, input(), inputTaken, pause, and player.

Referenced by execute(), and input().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save()

final void com.runehive.game.action.impl.DebugAction.save ( )
private

Definition at line 45 of file DebugAction.java.

45 {
46 Gson gson = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
47 try (FileWriter fw = new FileWriter("./data/INTERFACES.json")) {
48 fw.write(gson.toJson(DATA));
49 } catch (final Exception e) {
50 e.printStackTrace();
51 }
52 }
val object_examines.json val gson

References DATA.

Referenced by execute().

Here is the caller graph for this function:

Member Data Documentation

◆ DATA

Map<Integer, String> com.runehive.game.action.impl.DebugAction.DATA = new HashMap<>()
private

Definition at line 23 of file DebugAction.java.

Referenced by execute(), input(), and save().

◆ identification

int com.runehive.game.action.impl.DebugAction.identification
private

Definition at line 27 of file DebugAction.java.

Referenced by execute(), and input().

◆ inputTaken

boolean com.runehive.game.action.impl.DebugAction.inputTaken
private

Definition at line 33 of file DebugAction.java.

Referenced by execute(), and input().

◆ pause

boolean com.runehive.game.action.impl.DebugAction.pause
private

Definition at line 31 of file DebugAction.java.

Referenced by execute(), and input().

◆ player

final Player com.runehive.game.action.impl.DebugAction.player
private

Definition at line 25 of file DebugAction.java.

Referenced by DebugAction(), execute(), and input().

◆ tick

int com.runehive.game.action.impl.DebugAction.tick
private

Definition at line 29 of file DebugAction.java.

Referenced by execute().


The documentation for this class was generated from the following file: