RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.skill.impl.agility.Agility Class Reference

Created by Daniel on 2017-11-02. More...

Static Public Member Functions

static boolean clickButton (Player player, int button)
static void declare ()
static void main (String[] args)

Static Public Attributes

static final int ARDOUGNE_FLAGS = 0b0111_1111
static final int BARBARIAN_FLAGS = 0b0111_1111
static final int GNOME_FLAGS = 0b0111_1111
static final HashMap< Position, Obstacleobstacles = new HashMap<>()
static final int SEERS_FLAGS = 0b0011_1111
static final int WILDERNESS_FLAGS = 0b0001_1111

Static Private Attributes

static final double TICKET_EXPERIENCE = 50 * Config.AGILITY_MODIFICATION

Detailed Description

Created by Daniel on 2017-11-02.

Definition at line 21 of file Agility.java.

Member Function Documentation

◆ clickButton()

boolean com.runehive.content.skill.impl.agility.Agility.clickButton ( Player player,
int button )
static

Definition at line 48 of file Agility.java.

48 {
49 int amount = -1;
50 Consumer<Player> onClick = null;
51
52 switch (button) {
53 case 8387:
54 amount = 1;
55 onClick = p -> p.skills.addExperience(Skill.AGILITY, TICKET_EXPERIENCE * 1);
56 break;
57 case 8389:
58 amount = 10;
59 onClick = p -> p.skills.addExperience(Skill.AGILITY, TICKET_EXPERIENCE * 10);
60 break;
61 case 8390:
62 amount = 25;
63 onClick = p -> p.skills.addExperience(Skill.AGILITY, TICKET_EXPERIENCE * 25);
64 break;
65 case 8391:
66 amount = 100;
67 onClick = p -> p.skills.addExperience(Skill.AGILITY, TICKET_EXPERIENCE * 100);
68 break;
69 case 8392:
70 amount = 1_000;
71 onClick = p -> p.skills.addExperience(Skill.AGILITY, TICKET_EXPERIENCE * 1000);
72 break;
73 case 8382:
74 amount = 3;
75 onClick = p -> p.inventory.addOrDrop(new Item(3049, 1));
76 break;
77 case 8383:
78 amount = 10;
79 onClick = p -> p.inventory.addOrDrop(new Item(3051, 1));
80 break;
81 case 8381:
82 amount = 800;
83 onClick = p -> p.inventory.addOrDrop(new Item(2997, 1));
84 break;
85 }
86 if (amount > -1) {
87 if (player.inventory.contains(2996, amount)) {
88 player.inventory.remove(2996, amount);
89 onClick.accept(player);
90 player.interfaceManager.close();
91 return true;
92 } else {
93 player.message("You do not have enough agility tickets to purchase that.");
94 return true;
95 }
96 }
97 return false;
98 }

References com.runehive.game.world.entity.skill.Skill.AGILITY, com.runehive.game.world.entity.mob.player.InterfaceManager.close(), com.runehive.game.world.items.containers.ItemContainer.contains(), com.runehive.game.world.entity.mob.player.Player.interfaceManager, com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.world.entity.mob.player.Player.message(), com.runehive.game.world.items.containers.ItemContainer.remove(), and TICKET_EXPERIENCE.

Here is the call graph for this function:

◆ declare()

void com.runehive.content.skill.impl.agility.Agility.declare ( )
static

Definition at line 29 of file Agility.java.

29 {
30 try {
31 Obstacle[] loaded = new Gson().fromJson(new BufferedReader(new FileReader("./data/content/skills/agility.json")), Obstacle[].class);
32 for (Obstacle obstacle : loaded) {
33 if (obstacle.getObjectPosition() == null) {
34 obstacle.setObjectPosition(obstacle.getStart());
35 }
36 if (obstacle.getType() == null) {
37 System.out.println(obstacle + " No object type found. FIX MUST FIX");
38 }
39 obstacles.put(obstacle.getObjectPosition(), obstacle);
40 }
41 } catch (JsonSyntaxException | JsonIOException | FileNotFoundException e) {
42 e.printStackTrace();
43 }
44 }

References obstacles.

Referenced by com.runehive.content.skill.SkillRepository.load().

Here is the caller graph for this function:

◆ main()

void com.runehive.content.skill.impl.agility.Agility.main ( String[] args)
static

Definition at line 100 of file Agility.java.

100 {
101 // Write the obstacles so we don't have to deal with a messy wall
102 // of code.
103// obstacles.put(new Location(2551, 3554), new Obstacle.ObstacleBuilder(ObstacleType.ROPE_SWING, new ObeliskData(2551, 3554), new ObeliskData(2551, 3549))
104// .setExperience(22f)
105// .setLevel(35)
106// .setOrdinal(0)
107// .setNext(new Obstacle.ObstacleBuilder(ObstacleType.ROPE_SWING, new Location(2551, 3554), new ObeliskData(2551, 3549)).build())
108// .build());
109
110 try (FileWriter writer = new FileWriter(new File("./data/def/skills/agility1.json"))) {
111 Gson builder = new GsonBuilder().setPrettyPrinting().create();
112
113 writer.write(builder.toJson(obstacles.values()).replaceAll("\\{\n \"x\"", "\\{ \"x\"").replaceAll(",\n \"y\"", ", \"y\"").replaceAll(",\n \"z\"", ", \"z\"").replaceAll("\n \\},", " \\},"));
114 } catch (Exception e) {
115 }
116 }

References obstacles.

Member Data Documentation

◆ ARDOUGNE_FLAGS

final int com.runehive.content.skill.impl.agility.Agility.ARDOUGNE_FLAGS = 0b0111_1111
static

◆ BARBARIAN_FLAGS

final int com.runehive.content.skill.impl.agility.Agility.BARBARIAN_FLAGS = 0b0111_1111
static

◆ GNOME_FLAGS

final int com.runehive.content.skill.impl.agility.Agility.GNOME_FLAGS = 0b0111_1111
static

◆ obstacles

final HashMap<Position, Obstacle> com.runehive.content.skill.impl.agility.Agility.obstacles = new HashMap<>()
static

Definition at line 27 of file Agility.java.

Referenced by declare(), and main().

◆ SEERS_FLAGS

final int com.runehive.content.skill.impl.agility.Agility.SEERS_FLAGS = 0b0011_1111
static

◆ TICKET_EXPERIENCE

final double com.runehive.content.skill.impl.agility.Agility.TICKET_EXPERIENCE = 50 * Config.AGILITY_MODIFICATION
staticprivate

Definition at line 46 of file Agility.java.

Referenced by clickButton().

◆ WILDERNESS_FLAGS

final int com.runehive.content.skill.impl.agility.Agility.WILDERNESS_FLAGS = 0b0001_1111
static

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