RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
WeaponDefinition.java
1package com.osroyale.util.parser.old.defs;
2
3import com.osroyale.Config;
4import com.osroyale.game.world.entity.combat.ranged.RangedWeaponDefinition;
5
6import java.util.Optional;
7
43
44public class WeaponDefinition {
45 public static final WeaponDefinition[] DEFINITIONS = new WeaponDefinition[Config.ITEM_DEFINITION_LIMIT];
46 private final int item;
47 private final String name;
48 private final boolean twoHanded;
49 private final String weaponType;
50 private final RangedWeaponDefinition rangedDefinition;
51 private final int stand;
52 private final int walk;
53 private final int run;
54
55 public WeaponDefinition(int item, String name, boolean twoHanded, String weaponType, RangedWeaponDefinition rangedDefinition, int stand, int walk, int run) {
56 this.item = item;
57 this.name = name;
58 this.twoHanded = twoHanded;
59 this.weaponType = weaponType;
60 this.rangedDefinition = rangedDefinition;
61 this.stand = stand;
62 this.walk = walk;
63 this.run = run;
64 }
65
66 public int getItem() {
67 return item;
68 }
69
70 public String getName() {
71 return name;
72 }
73
74 public String getWeaponType() {
75 return weaponType;
76 }
77
78 public Optional<RangedWeaponDefinition> getRangedDefinition() {
79 return Optional.ofNullable(rangedDefinition);
80 }
81
82 public boolean isTwoHanded() {
83 return twoHanded;
84 }
85
86 public int getStand() {
87 return stand;
88 }
89
90 public int getWalk() {
91 return walk;
92 }
93
94 public int getRun() {
95 return run;
96 }
97
98 public static boolean isPoisonous(String name) {
99 return name.endsWith("p)") || name.endsWith("p+)") || name.endsWith("p++)");
100 }
101
102 public static int poisonStrength(String name) {
103 return name.endsWith("p)") ? 2 : name.endsWith("p+)") ? 4 : name.endsWith("p++)") ? 6 : 2;
104 }
105
113 public static WeaponDefinition get(int id) {
114 if (id < 0 || id >= DEFINITIONS.length) {
115 return null;
116 }
117
118 return DEFINITIONS[id];
119 }
120
121}
static final int ITEM_DEFINITION_LIMIT
Definition Config.java:219