API Changes:

-Implemented interfaces for all jobs & roles.

ScriptPlayer:
-Added getData() function, which returns player data objects.

IPlayerData: New class that holds all player data for modification.
-Holds dialog, bank, quest, transport, faction, item giver, and mail data.
-Also holds companion data, with functions has/set/getCompanion, and a getCompanionID function to differentiate companions.
This commit is contained in:
Luis C.M committed 2022-06-12 01:26:23 -05:00
1 parent 587f63396f
commit 63a1525ee2
66 files changed
+1418 -207

No files matched your search

@@ -11,10 +11,20 @@ import noppes.npcs.controllers.FactionController;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.event.FactionEvent;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.handler.IPlayerFactionData;
public class PlayerFactionData {
public class PlayerFactionData implements IPlayerFactionData {
private final PlayerData parent;
public HashMap<Integer,Integer> factionData = new HashMap<Integer,Integer>();
public PlayerFactionData() {
parent = null;
}
public PlayerFactionData(PlayerData parent) {
this.parent = parent;
}
public void loadNBTData(NBTTagCompound compound) {
HashMap<Integer,Integer> factionData = new HashMap<Integer,Integer>();
if(compound == null)
@@ -79,4 +89,19 @@ public class PlayerFactionData {
return compound;
}
public int getPoints(int id) {
return this.getFactionPoints(id);
}
public void addPoints(int id, int points) {
if (parent != null) {
this.increasePoints(id, points, parent.player);
}
}
public void setPoints(int id, int points) {
if (parent != null) {
increasePoints(id, points-getFactionPoints(id), parent.player);
}
}
}