2018-09-13 12:03:28 -04:00
|
|
|
package noppes.npcs.scripted.roles;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2023-01-12 21:33:06 -05:00
|
|
|
import noppes.npcs.api.entity.IPlayer;
|
|
|
|
|
import noppes.npcs.api.roles.IRoleFollower;
|
2018-09-13 12:03:28 -04:00
|
|
|
import noppes.npcs.entity.EntityNPCInterface;
|
|
|
|
|
import noppes.npcs.roles.RoleFollower;
|
2022-05-11 22:08:31 -05:00
|
|
|
import noppes.npcs.scripted.NpcAPI;
|
2018-09-13 12:03:28 -04:00
|
|
|
import noppes.npcs.scripted.constants.RoleType;
|
|
|
|
|
|
2022-06-12 01:26:23 -05:00
|
|
|
public class ScriptRoleFollower extends ScriptRoleInterface implements IRoleFollower {
|
2018-09-13 12:03:28 -04:00
|
|
|
private RoleFollower role;
|
|
|
|
|
public ScriptRoleFollower(EntityNPCInterface npc) {
|
|
|
|
|
super(npc);
|
|
|
|
|
role = (RoleFollower) npc.roleInterface;
|
|
|
|
|
}
|
2022-06-12 01:26:23 -05:00
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public void setOwner(IPlayer player){
|
2021-10-12 02:57:32 -05:00
|
|
|
if(player == null || player.getMCEntity() == null){
|
2018-09-13 12:03:28 -04:00
|
|
|
role.setOwner(null);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-10-12 02:57:32 -05:00
|
|
|
EntityPlayer mcplayer = (EntityPlayer) player.getMCEntity();
|
2018-09-13 12:03:28 -04:00
|
|
|
role.setOwner(mcplayer);
|
|
|
|
|
}
|
2022-06-12 01:26:23 -05:00
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public IPlayer getOwner(){
|
2018-09-13 12:03:28 -04:00
|
|
|
if(role.owner == null)
|
|
|
|
|
return null;
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
return (IPlayer) NpcAPI.Instance().getIEntity(role.owner);
|
2018-09-13 12:03:28 -04:00
|
|
|
}
|
2022-06-12 01:26:23 -05:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
public boolean hasOwner(){
|
|
|
|
|
return role.owner != null;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-24 03:06:16 -05:00
|
|
|
public boolean isFollowing() {
|
|
|
|
|
return role.isFollowing();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setIsFollowing(boolean following) {
|
|
|
|
|
if (role.owner != null && role.getDaysLeft() > 0) role.isFollowing = following;
|
|
|
|
|
}
|
2022-06-12 01:26:23 -05:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
public int getDaysLeft(){
|
|
|
|
|
return role.getDaysLeft();
|
|
|
|
|
}
|
2022-06-12 01:26:23 -05:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
public void addDaysLeft(int days){
|
|
|
|
|
role.addDays(days);
|
|
|
|
|
}
|
2022-06-12 01:26:23 -05:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
public boolean getInfiniteDays(){
|
|
|
|
|
return role.infiniteDays;
|
|
|
|
|
}
|
2022-06-12 01:26:23 -05:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
public void setInfiniteDays(boolean infinite){
|
|
|
|
|
role.infiniteDays = infinite;
|
|
|
|
|
}
|
2022-06-12 01:26:23 -05:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
public boolean getGuiDisabled(){
|
|
|
|
|
return role.disableGui;
|
|
|
|
|
}
|
2022-06-12 01:26:23 -05:00
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
public void setGuiDisabled(boolean disabled){
|
|
|
|
|
role.disableGui = disabled;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-10 18:50:52 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param index Index of Rate [0 - 2]
|
|
|
|
|
* @param amount Amount hired for
|
|
|
|
|
*/
|
|
|
|
|
public void setRate(int index, int amount){
|
|
|
|
|
role.setRate(index, amount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param index Index of Rate [0 - 2]
|
|
|
|
|
* @return amount fired for
|
|
|
|
|
*/
|
|
|
|
|
public int getRate(int index){
|
|
|
|
|
return role.getRate(index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param dialogHire New dialog hire string
|
|
|
|
|
*/
|
|
|
|
|
public void setDialogHire(String dialogHire){
|
|
|
|
|
role.setDialogHire(dialogHire);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return dialog hire string
|
|
|
|
|
*/
|
|
|
|
|
public String getDialogHire(){
|
|
|
|
|
return role.getDialogHire();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param dialogFarewell New dialog farewell string
|
|
|
|
|
*/
|
|
|
|
|
public void setDialogFarewell(String dialogFarewell){
|
|
|
|
|
role.setDialogFarewell(dialogFarewell);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return dialog farewell string
|
|
|
|
|
*/
|
|
|
|
|
public String getDialogFarewell(){
|
|
|
|
|
return role.getDialogFarewell();
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-13 12:03:28 -04:00
|
|
|
@Override
|
|
|
|
|
public int getType(){
|
|
|
|
|
return RoleType.FOLLOWER;
|
|
|
|
|
}
|
|
|
|
|
}
|