Class WeaponSpeeds
java.lang.Object
privbot.mechanics.WeaponSpeeds
How many ticks a weapon takes between attacks.
This is what turns "enough ticks have passed" into a real attack cycle. A dark bow and a whip are not the same weapon, and pacing both at a fixed three ticks throws away hits with one and wastes clicks with the other.
Precedence, first match wins:
- the plugin's
overrides(a private server can give any weapon any speed it likes, so a configured speed is the authority); - the keyword table, lifted from ElorinPvP
services/WeaponSpeedswith the Elorin captures it was corrected from (Dharok's greataxe 6, Ursine chainmace 4, Eclipse atlatl 3). It is matched by keyword, most specific first, because a substring match on "bow" finds a crossbow; - the OSRS table, AutoPvP's
osrs_weapon_ticks.jsoncopied into this package's resources: an exact (case- and space-blind) item name, then the name with(or),(empty)and similar suffixes normalised away. Its values are clamped to 2-8 ticks. It is read once, lazily, on the first lookup that reaches it; if it cannot be read every lookup falls through to the default; - the style's default:
MELEE_DEFAULT(also used when the style is null),RANGED_DEFAULT,MAGIC_DEFAULT.
Pure apart from the one resource read; no client reads, any thread.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intUsed when nothing recognises the weapon (and for a null style).static final int -
Method Summary
Modifier and TypeMethodDescriptionknown()The keywords the built-in table knows, for a studio hint.Parses"Dark bow=9, Abyssal whip=4"into lower-cased keys.static intThe attack cycle of this weapon in ticks:overrides(keys lower-cased, matched by containment, asparse(java.lang.String, java.util.List<java.lang.String>)produces them), then the keyword table, then the OSRS table, then the style's default.
-
Field Details
-
MELEE_DEFAULT
public static final int MELEE_DEFAULTUsed when nothing recognises the weapon (and for a null style).- See Also:
-
RANGED_DEFAULT
public static final int RANGED_DEFAULT- See Also:
-
MAGIC_DEFAULT
public static final int MAGIC_DEFAULT- See Also:
-
-
Method Details
-
ticks
The attack cycle of this weapon in ticks:overrides(keys lower-cased, matched by containment, asparse(java.lang.String, java.util.List<java.lang.String>)produces them), then the keyword table, then the OSRS table, then the style's default. -
parse
-
known
-