mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-16 10:44:47 +00:00
Fix DBC Toggle Abilities and Wheel System
This commit is contained in:
1 parent
ca2980909e
commit
2c2f0c0d8f
4 files changed
+124
No files matched your search
@@ -257,4 +257,29 @@ public interface IAbility extends IAbilityAction {
|
||||
boolean isBurstOverlap();
|
||||
|
||||
void setBurstOverlap(boolean overlap);
|
||||
|
||||
// Toggle system
|
||||
|
||||
/**
|
||||
* Check if this ability is toggleable (has at least 1 toggle state).
|
||||
*/
|
||||
boolean isToggleable();
|
||||
|
||||
/**
|
||||
* Get the number of toggle states.
|
||||
* 0 = not toggleable, 1 = binary on/off, 2+ = multi-state cycling.
|
||||
*/
|
||||
int getToggleStates();
|
||||
|
||||
/**
|
||||
* Set the number of toggle states.
|
||||
* 0 = not toggleable, 1 = binary on/off, 2+ = multi-state cycling.
|
||||
*/
|
||||
void setToggleStates(int states);
|
||||
|
||||
/**
|
||||
* Get the display label for a specific toggle state (1-indexed).
|
||||
* @return the label, or null if none set
|
||||
*/
|
||||
String getToggleStateLabel(int state);
|
||||
}
|
||||
@@ -109,4 +109,29 @@ public interface IPlayerAbilityData {
|
||||
* Activate a specific ability by key.
|
||||
*/
|
||||
boolean activateAbility(String key);
|
||||
|
||||
// Toggle system
|
||||
|
||||
/**
|
||||
* Cycle a toggle ability to its next state.
|
||||
* Off -> State 1 -> State 2 -> ... -> State N -> Off
|
||||
* @return The new state (0 = off, 1+ = active state number)
|
||||
*/
|
||||
int toggleAbility(String key);
|
||||
|
||||
/**
|
||||
* Get the current toggle state for an ability.
|
||||
* @return 0 if not active, 1+ for active state
|
||||
*/
|
||||
int getToggleState(String key);
|
||||
|
||||
/**
|
||||
* Set a toggle to a specific state. 0 = deactivate, 1+ = specific state.
|
||||
*/
|
||||
void setToggleState(String key, int state);
|
||||
|
||||
/**
|
||||
* Check if a toggle ability is currently active (any state > 0).
|
||||
*/
|
||||
boolean isAbilityToggled(String key);
|
||||
}
|
||||
@@ -58,6 +58,28 @@ public interface IAbilityEvent extends INpcEvent {
|
||||
interface CompleteEvent extends IAbilityEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a toggle ability is switched ON or OFF.
|
||||
* Canceling prevents the toggle from changing state.
|
||||
*/
|
||||
@Cancelable
|
||||
interface ToggleEvent extends IAbilityEvent {
|
||||
boolean isTogglingOn();
|
||||
int getOldState();
|
||||
int getNewState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired every 10 ticks for each active toggle ability.
|
||||
* Scripts can call setEnabled(false) to force-deactivate.
|
||||
*/
|
||||
interface ToggleUpdateEvent extends IAbilityEvent {
|
||||
int getTick();
|
||||
int getState();
|
||||
boolean isEnabled();
|
||||
void setEnabled(boolean enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when an ability hits an entity with damage.
|
||||
* Canceling this event prevents the damage from being applied.
|
||||
|
||||
@@ -85,6 +85,58 @@ public interface IPlayerAbilityEvent extends IPlayerEvent {
|
||||
int getTick();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a toggle ability is switched ON or OFF.
|
||||
* Canceling prevents the toggle from changing state.
|
||||
*
|
||||
* @hookName abilityToggle
|
||||
*/
|
||||
@Cancelable
|
||||
interface ToggleEvent extends IPlayerAbilityEvent {
|
||||
/**
|
||||
* @return true if the toggle is being turned ON (any state), false if being turned OFF
|
||||
*/
|
||||
boolean isTogglingOn();
|
||||
|
||||
/**
|
||||
* @return the previous state (0 = was off, 1+ = previous active state)
|
||||
*/
|
||||
int getOldState();
|
||||
|
||||
/**
|
||||
* @return the new state (0 = turning off, 1+ = new active state)
|
||||
*/
|
||||
int getNewState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired every 10 ticks for each active toggle ability.
|
||||
* Scripts can call {@link #setEnabled(boolean)} with false to force-deactivate the toggle.
|
||||
*
|
||||
* @hookName abilityToggleUpdate
|
||||
*/
|
||||
interface ToggleUpdateEvent extends IPlayerAbilityEvent {
|
||||
/**
|
||||
* @return the tick count since the toggle was activated
|
||||
*/
|
||||
int getTick();
|
||||
|
||||
/**
|
||||
* @return the current toggle state (1+)
|
||||
*/
|
||||
int getState();
|
||||
|
||||
/**
|
||||
* @return whether the toggle should remain active
|
||||
*/
|
||||
boolean isEnabled();
|
||||
|
||||
/**
|
||||
* Set to false to force-deactivate the toggle after this event completes.
|
||||
*/
|
||||
void setEnabled(boolean enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player's ability hits an entity with damage.
|
||||
* Canceling this event prevents the damage from being applied.
|
||||
|
||||
Reference in new issue
Block a user