Magic Handler APIs + Magic APIs

This commit is contained in:
Kam committed 2025-03-12 22:06:58 -04:00
1 parent afb5f1d645
commit 0841aab8f8
4 files changed
+201

No files matched your search

+2
View File
@@ -144,6 +144,8 @@ public abstract class AbstractNpcAPI {
public abstract ICustomEffectHandler getCustomEffectHandler();
public abstract IMagicHandler getMagicHandler();
public abstract IPartyHandler getPartyHandler();
public abstract ITransportHandler getLocations();
@@ -0,0 +1,47 @@
package noppes.npcs.api.handler;
import noppes.npcs.api.handler.data.IMagic;
import noppes.npcs.api.handler.data.IMagicCycle;
/**
* Provides methods to access and modify magic and magic cycles.
* Implementations of this interface are responsible for managing the lifecycle,
* storage, and associations between individual magics and cycles.
*/
public interface IMagicHandler {
/**
* Retrieves a magic instance by its unique ID.
*
* @param magicId the unique identifier of the magic
* @return the magic corresponding to the given ID, or null if not found
*/
IMagic getMagic(int magicId);
/**
* Retrieves a magic cycle (or category) by its unique ID.
*
* @param cycleID the unique identifier of the magic cycle
* @return the magic cycle corresponding to the given ID, or null if not found
*/
IMagicCycle getCycle(int cycleID);
/**
* Adds a magic to a specific cycle with ordering details.
* The provided index and priority help determine the magic's position in the cycle.
*
* @param magicId the unique identifier of the magic to add
* @param cycleId the unique identifier of the cycle to add the magic to
* @param index the index position within the cycle
* @param priority the priority value within the cycle
*/
void addMagicToCycle(int magicId, int cycleId, int index, int priority);
/**
* Removes a magic from a specified cycle.
*
* @param magicId the unique identifier of the magic to remove
* @param cycleId the unique identifier of the cycle from which the magic is removed
*/
void removeMagicFromCycle(int magicId, int cycleId);
}
@@ -1,15 +1,89 @@
package noppes.npcs.api.handler.data;
/**
* Represents a magic element that can have interactions with other magics.
* Each magic has unique properties such as an ID, name, color, and display name,
* and can hold interaction values with other magics.
*/
public interface IMagic {
/**
* Gets the unique identifier of this magic.
*
* @return the magic ID
*/
int getId();
/**
* Gets the internal name of the magic.
*
* @return the name of the magic
*/
String getName();
/**
* Sets the internal name of the magic.
*
* @param name the new name of the magic
*/
void setName(String name);
/**
* Sets the color for this magic.
*
* @param c the color represented as an integer (typically in hexadecimal)
*/
void setColor(int c);
/**
* Gets the color of this magic.
*
* @return the color as an integer
*/
int getColor();
/**
* Gets the display name of the magic.
*
* @return the display name of the magic
*/
String getDisplayName();
/**
* Sets the display name of the magic.
*
* @param displayName the new display name
*/
void setDisplayName(String displayName);
/**
* Saves the current state of the magic.
* Typically persists changes to a controller or storage system.
*/
void save();
/**
* Checks if this magic has an interaction value set for another magic.
*
* @param magicID the unique identifier of the other magic
* @return true if an interaction is present, false otherwise
*/
boolean hasInteraction(int magicID);
/**
* Sets an interaction value for a specific other magic.
*
* @param magicID the unique identifier of the other magic
* @param value the interaction value (usually a percentage or multiplier)
*/
void setInteraction(int magicID, float value);
/**
* Retrieves the interaction value for a specific other magic.
*
* @param magicID the unique identifier of the other magic
* @param value the default value to return if no interaction is found
* @return the interaction value if present; otherwise, the default value
*/
float getInteraction(int magicID, float value);
}
@@ -0,0 +1,78 @@
package noppes.npcs.api.handler.data;
/**
* Represents a cycle (or category) grouping for magics.
* A magic cycle holds ordering and display information as well as associations
* to multiple magics.
*/
public interface IMagicCycle {
/**
* Gets the unique identifier of this magic cycle.
*
* @return the cycle ID
*/
int getId();
/**
* Gets the internal name of the magic cycle.
*
* @return the name of the cycle
*/
String getName();
/**
* Sets the internal name of the magic cycle.
*
* @param name the new name of the cycle
*/
void setName(String name);
/**
* Gets the display name of the magic cycle.
*
* @return the display name for the cycle
*/
String getDisplayName();
/**
* Sets the display name of the magic cycle.
*
* @param displayName the new display name of the cycle
*/
void setDisplayName(String displayName);
/**
* Gets the layout type for the cycle.
* This is typically an integer representation of the layout enum.
*
* 0: CIRCULAR
* 1: SQUARE
* 2: TREE
* 3: GENERATED
* 4: CIRCULAR_MANUAL
* 5: SQUARE_MANUAL
* 6: TREE_MANUAL
* 7: CHART
*
* @return the layout type as an integer
*/
int getLayoutType();
/**
* Sets the layout type for the cycle.
* The provided integer should correspond to a valid layout type.
*
* 0: CIRCULAR
* 1: SQUARE
* 2: TREE
* 3: GENERATED
* 4: CIRCULAR_MANUAL
* 5: SQUARE_MANUAL
* 6: TREE_MANUAL
* 7: CHART
*
* @param layout the layout type as an integer
*/
void setLayoutType(int layout);
}