mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 03:47:27 +00:00
26 files changed
+215
-97
No files matched your search
@@ -78,6 +78,9 @@ public class CustomNpcs {
|
||||
@ConfigProp(info = "Set to true if you want the dialog command option to be able to use op commands like tp etc")
|
||||
public static boolean NpcUseOpCommands = false;
|
||||
|
||||
@ConfigProp(info = "The amount of time that passes before a player's quests are checked for completion in seconds.")
|
||||
public static int PlayerQuestCheck = 300;
|
||||
|
||||
@ConfigProp
|
||||
public static boolean InventoryGuiEnabled = true;
|
||||
|
||||
@@ -177,6 +180,9 @@ public class CustomNpcs {
|
||||
if(NpcSizeLimit < 1)
|
||||
NpcSizeLimit = 1;
|
||||
|
||||
if(PlayerQuestCheck < 1)
|
||||
PlayerQuestCheck = 1;
|
||||
|
||||
EnchantInterface.load();
|
||||
CustomItems.load();
|
||||
|
||||
|
||||
@@ -262,9 +262,9 @@ public class EventHooks {
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerKeyPressed(EntityPlayerMP player, int button, boolean isCtrlPressed, boolean isShiftPressed, boolean isAltPressed, boolean isMetaPressed, boolean buttonDown) {
|
||||
public static void onPlayerKeyPressed(EntityPlayerMP player, int button, boolean isCtrlPressed, boolean isShiftPressed, boolean isAltPressed, boolean isMetaPressed, boolean buttonDown, int[] heldKeys) {
|
||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||
KeyPressedEvent event = new KeyPressedEvent((ScriptPlayer)ScriptController.Instance.getScriptForEntity(player), button, isCtrlPressed, isAltPressed, isShiftPressed, isMetaPressed, buttonDown);
|
||||
KeyPressedEvent event = new KeyPressedEvent((ScriptPlayer)ScriptController.Instance.getScriptForEntity(player), button, isCtrlPressed, isAltPressed, isShiftPressed, isMetaPressed, buttonDown, heldKeys);
|
||||
handler.callScript(EnumScriptType.KEY_PRESSED, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
@@ -26,21 +26,7 @@ import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.containers.ContainerNPCBankInterface;
|
||||
import noppes.npcs.containers.ContainerNPCFollower;
|
||||
import noppes.npcs.containers.ContainerNPCFollowerHire;
|
||||
import noppes.npcs.controllers.Bank;
|
||||
import noppes.npcs.controllers.BankController;
|
||||
import noppes.npcs.controllers.BankData;
|
||||
import noppes.npcs.controllers.Dialog;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.DialogOption;
|
||||
import noppes.npcs.controllers.Line;
|
||||
import noppes.npcs.controllers.PlayerBankData;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.PlayerQuestController;
|
||||
import noppes.npcs.controllers.PlayerQuestData;
|
||||
import noppes.npcs.controllers.PlayerTransportData;
|
||||
import noppes.npcs.controllers.QuestData;
|
||||
import noppes.npcs.controllers.TransportController;
|
||||
import noppes.npcs.controllers.TransportLocation;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.RoleFollower;
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
@@ -303,13 +289,14 @@ public class NoppesUtilPlayer {
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, data.writeNBT());
|
||||
}
|
||||
public static void questCompletion(EntityPlayerMP player, int questId) {
|
||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
QuestData data = playerdata.activeQuests.get(questId);
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
QuestData data = questData.activeQuests.get(questId);
|
||||
|
||||
if(data == null)
|
||||
return;
|
||||
|
||||
if(!data.quest.questInterface.isCompleted(player))
|
||||
if(!data.quest.questInterface.isCompleted(playerData))
|
||||
return;
|
||||
|
||||
QuestEvent.QuestTurnedInEvent event = new QuestEvent.QuestTurnedInEvent(new ScriptPlayer(player), data.quest);
|
||||
|
||||
@@ -3,6 +3,8 @@ package noppes.npcs;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -16,11 +18,7 @@ import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import noppes.npcs.blocks.tiles.TileBigSign;
|
||||
import noppes.npcs.blocks.tiles.TileBook;
|
||||
import noppes.npcs.constants.EnumCompanionTalent;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.constants.*;
|
||||
import noppes.npcs.containers.ContainerMail;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -66,7 +64,31 @@ public class PacketHandlerPlayer{
|
||||
return;
|
||||
}
|
||||
|
||||
EventHooks.onPlayerKeyPressed(player, buffer.readInt(), buffer.readBoolean(), buffer.readBoolean(), buffer.readBoolean(), buffer.readBoolean(), buffer.readBoolean());
|
||||
int button = buffer.readInt();
|
||||
boolean isCtrlPressed = buffer.readBoolean();
|
||||
boolean isShiftPressed = buffer.readBoolean();
|
||||
boolean isAltPressed = buffer.readBoolean();
|
||||
boolean isMetaPressed = buffer.readBoolean();
|
||||
boolean buttonDown = buffer.readBoolean();
|
||||
|
||||
String ints = Server.readString(buffer);
|
||||
String[] split = ints.split(",");
|
||||
int[] keysDown;
|
||||
|
||||
if(ints.length() > 0) {
|
||||
keysDown = new int[split.length];
|
||||
try {
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
keysDown[i] = Integer.parseInt(split[i]);
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException ignored){
|
||||
}
|
||||
} else {
|
||||
keysDown = new int[0];
|
||||
}
|
||||
|
||||
EventHooks.onPlayerKeyPressed(player, button, isCtrlPressed, isShiftPressed, isAltPressed, isMetaPressed, buttonDown, keysDown);
|
||||
}
|
||||
else if(type == EnumPlayerPacket.MouseClicked) {
|
||||
if(ScriptController.Instance.languages.isEmpty()) {
|
||||
@@ -135,8 +157,9 @@ public class PacketHandlerPlayer{
|
||||
NoppesUtilPlayer.dialogSelected(buffer.readInt(), buffer.readInt(), player, npc);
|
||||
}
|
||||
else if(type == EnumPlayerPacket.CheckQuestCompletion){
|
||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
playerdata.checkQuestCompletion(player, null);
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerQuestData questData = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
questData.checkQuestCompletion(playerData, null);
|
||||
}
|
||||
else if(type == EnumPlayerPacket.QuestLog){
|
||||
NoppesUtilPlayer.sendQuestLogData(player);
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.Vector;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.constants.EnumQuestCompletion;
|
||||
import noppes.npcs.controllers.PlayerData;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.PlayerQuestController;
|
||||
import noppes.npcs.controllers.Quest;
|
||||
|
||||
@@ -34,7 +36,7 @@ public class QuestLogData {
|
||||
|
||||
}
|
||||
public void setData(EntityPlayer player){
|
||||
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
for(Quest quest : PlayerQuestController.getActiveQuests(player))
|
||||
{
|
||||
String category = quest.category.title;
|
||||
@@ -46,7 +48,7 @@ public class QuestLogData {
|
||||
questText.put(category + ":" + quest.title, quest.logText);
|
||||
|
||||
questStatus.put(category + ":" + quest.title, quest.questInterface.getQuestLogStatus(player));
|
||||
if(quest.completion == EnumQuestCompletion.Npc && quest.questInterface.isCompleted(player))
|
||||
if(quest.completion == EnumQuestCompletion.Npc && quest.questInterface.isCompleted(playerData))
|
||||
finish.put(category + ":" + quest.title, quest.completerNpc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,15 +46,13 @@ import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.player.*;
|
||||
import net.minecraftforge.event.world.*;
|
||||
import net.minecraftforge.event.world.WorldEvent.PotentialSpawns;
|
||||
import noppes.npcs.controllers.PlayerData;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.constants.EnumQuestType;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||
import noppes.npcs.scripted.event.ForgeEvent;
|
||||
import noppes.npcs.controllers.PixelmonHelper;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
public class ScriptPlayerEventHandler {
|
||||
@@ -74,9 +72,16 @@ public class ScriptPlayerEventHandler {
|
||||
EventHooks.onPlayerTick(handler, scriptPlayer);
|
||||
}
|
||||
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
if(PlayerDataController.instance != null) {
|
||||
if(PlayerDataController.instance.getPlayerData(player).timers.size() > 0)
|
||||
PlayerDataController.instance.getPlayerData(player).timers.update();
|
||||
if(playerData.timers.size() > 0)
|
||||
playerData.timers.update();
|
||||
}
|
||||
|
||||
if(player.ticksExisted%(20*CustomNpcs.PlayerQuestCheck) == 0){
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
for(EnumQuestType e : EnumQuestType.values())
|
||||
questData.checkQuestCompletion(playerData, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,11 +291,12 @@ public class ServerEventsHandler {
|
||||
}
|
||||
|
||||
private void doQuest(EntityPlayer player, EntityLivingBase entity, boolean all) {
|
||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
boolean change = false;
|
||||
String entityName = EntityList.getEntityString(entity);
|
||||
|
||||
for(QuestData data : playerdata.activeQuests.values()){
|
||||
for(QuestData data : questData.activeQuests.values()){
|
||||
if(data.quest.type != EnumQuestType.Kill && data.quest.type != EnumQuestType.AreaKill)
|
||||
continue;
|
||||
if(data.quest.type == EnumQuestType.AreaKill && all){
|
||||
@@ -326,15 +327,16 @@ public class ServerEventsHandler {
|
||||
if(!change)
|
||||
return;
|
||||
|
||||
playerdata.checkQuestCompletion(player,EnumQuestType.Kill);
|
||||
questData.checkQuestCompletion(playerData,EnumQuestType.Kill);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void pickUp(EntityItemPickupEvent event){
|
||||
if(event.entityPlayer.worldObj.isRemote)
|
||||
return;
|
||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(event.entityPlayer).questData;
|
||||
playerdata.checkQuestCompletion(event.entityPlayer, EnumQuestType.Item);
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(event.entityPlayer);
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
questData.checkQuestCompletion(playerData, EnumQuestType.Item);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.constants.EnumQuestType;
|
||||
import noppes.npcs.controllers.PlayerData;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.PlayerQuestData;
|
||||
import noppes.npcs.controllers.QuestData;
|
||||
@@ -43,15 +44,16 @@ public class TileWaypoint extends TileEntity {
|
||||
if(toCheck.isEmpty())
|
||||
return;
|
||||
for(EntityPlayer player : toCheck){
|
||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
for(QuestData data : playerdata.activeQuests.values()){
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
for(QuestData data : questData.activeQuests.values()){
|
||||
if(data.quest.type != EnumQuestType.Location)
|
||||
continue;
|
||||
QuestLocation quest = (QuestLocation) data.quest.questInterface;
|
||||
if(quest.setFound(data, name)){
|
||||
player.addChatMessage(new ChatComponentTranslation(name + " " + StatCollector.translateToLocal("quest.found")));
|
||||
|
||||
playerdata.checkQuestCompletion(player, EnumQuestType.Location);
|
||||
questData.checkQuestCompletion(playerData, EnumQuestType.Location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,18 @@ public class ClientTickHandler{
|
||||
boolean isAltPressed = Keyboard.isKeyDown(184) || Keyboard.isKeyDown(56);
|
||||
boolean isMetaPressed = Keyboard.isKeyDown(220) || Keyboard.isKeyDown(219);
|
||||
boolean keyDown = Keyboard.isKeyDown(key);
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.KeyPressed, new Object[]{Integer.valueOf(key), Boolean.valueOf(isCtrlPressed), Boolean.valueOf(isShiftPressed), Boolean.valueOf(isAltPressed), Boolean.valueOf(isMetaPressed), Boolean.valueOf(keyDown)});
|
||||
|
||||
StringBuilder keysDownString = new StringBuilder();
|
||||
for(int i = 0; i < Keyboard.getKeyCount(); i++){//Creates a comma separated string of the integer IDs of held keys
|
||||
if(Keyboard.isKeyDown(i)){
|
||||
keysDownString.append(Integer.valueOf(i)).append(",");
|
||||
}
|
||||
}
|
||||
if(keysDownString.length() > 0){//Removes last comma for later parsing
|
||||
keysDownString.deleteCharAt(keysDownString.length()-1);
|
||||
}
|
||||
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.KeyPressed, new Object[]{Integer.valueOf(key), Boolean.valueOf(isCtrlPressed), Boolean.valueOf(isShiftPressed), Boolean.valueOf(isAltPressed), Boolean.valueOf(isMetaPressed), Boolean.valueOf(keyDown), keysDownString.toString()});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
|
||||
int color;
|
||||
float alpha;
|
||||
float rotation;
|
||||
|
||||
protected int field_146167_a;
|
||||
protected int field_146161_f;
|
||||
@@ -144,6 +145,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
lbl.labelShadowEnabled = component.hasShadow();
|
||||
lbl.color = component.getColor();
|
||||
lbl.alpha = component.getAlpha();
|
||||
lbl.rotation = component.getRotation();
|
||||
|
||||
return lbl;
|
||||
}
|
||||
@@ -154,6 +156,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
component.enableShadow(this.labelShadowEnabled);
|
||||
component.setColor(this.color);
|
||||
component.setAlpha(this.alpha);
|
||||
component.setRotation(this.rotation);
|
||||
return component;
|
||||
}
|
||||
|
||||
@@ -165,6 +168,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
blue = (color & 255) / 255f;
|
||||
|
||||
GL11.glTranslatef(this.x,this.y,0.0F);
|
||||
GL11.glRotated(rotation,0.0D,0.0D,1.0D);
|
||||
GL11.glScalef(this.scale, this.scale, this.scale);
|
||||
this.drawString(fullLabel, 0, 0, this.color, this.labelShadowEnabled);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@@ -21,14 +21,15 @@ public class CustomGuiLine extends Gui implements IGuiComponent {
|
||||
int y2;
|
||||
int color;
|
||||
float alpha;
|
||||
float rotation;
|
||||
int thickness;
|
||||
|
||||
public CustomGuiLine(int id, int x1, int y1, int x2, int y2, int color, int thickness){
|
||||
this.id = id;
|
||||
this.x1 = GuiCustom.guiLeft + x1;
|
||||
this.y1 = GuiCustom.guiTop + y1;
|
||||
this.x2 = GuiCustom.guiLeft + x2;
|
||||
this.y2 = GuiCustom.guiTop + y2;
|
||||
this.x1 = x1;
|
||||
this.y1 = y1;
|
||||
this.x2 = x2;
|
||||
this.y2 = y2;
|
||||
this.color = color;
|
||||
this.thickness = thickness;
|
||||
}
|
||||
@@ -52,8 +53,9 @@ public class CustomGuiLine extends Gui implements IGuiComponent {
|
||||
float blue = (color & 255) / 255f;
|
||||
GL11.glColor4f(red,green,blue,this.alpha);
|
||||
|
||||
GL11.glTranslatef(this.x1,this.y1,0.0F);
|
||||
GL11.glTranslatef(GuiCustom.guiLeft+this.x1,GuiCustom.guiTop+this.y1,0.0F);
|
||||
GL11.glRotated(-Math.toDegrees(Math.atan2(x2-x1,y2-y1)),0.0F,0.0F,1.0F);
|
||||
GL11.glRotated(rotation,0.0D,0.0D,1.0D);
|
||||
GL11.glScaled(thickness, distance,0.0D);
|
||||
this.drawTexturedModalRect(0,0,0,0, 1, 1);
|
||||
GL11.glPopMatrix();
|
||||
@@ -63,6 +65,7 @@ public class CustomGuiLine extends Gui implements IGuiComponent {
|
||||
ScriptGuiLine line = new ScriptGuiLine(this.id, this.x1,this.y1,this.x2,this.y2,this.color,this.thickness);
|
||||
line.setColor(this.color);
|
||||
line.setAlpha(this.alpha);
|
||||
line.setRotation(this.rotation);
|
||||
return line;
|
||||
}
|
||||
|
||||
@@ -70,6 +73,7 @@ public class CustomGuiLine extends Gui implements IGuiComponent {
|
||||
CustomGuiLine line = new CustomGuiLine(component.getID(), component.getX1(), component.getY1(), component.getX2(), component.getY2(), component.getColor(), component.getThickness());
|
||||
line.color = component.getColor();
|
||||
line.alpha = component.getAlpha();
|
||||
line.rotation = component.getRotation();
|
||||
return line;
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,7 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
|
||||
|
||||
int color;
|
||||
float alpha;
|
||||
float rotation;
|
||||
|
||||
public CustomGuiTexturedRect(int id, String texture, int x, int y, int width, int height) {
|
||||
this(id, texture, x, y, width, height, 0, 0);
|
||||
@@ -47,8 +48,8 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
|
||||
this.scale = 1.0F;
|
||||
this.id = id;
|
||||
this.texture = new ResourceLocation(texture);
|
||||
this.x = GuiCustom.guiLeft + x;
|
||||
this.y = GuiCustom.guiTop + y;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.textureX = textureX;
|
||||
@@ -80,7 +81,28 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
|
||||
GL11.glColor4f(red,green,blue,this.alpha);
|
||||
|
||||
GL11.glScalef(this.scale, this.scale, this.scale);
|
||||
this.drawTexturedModalRect((int) (this.x/this.scale), (int) (this.y/this.scale), this.textureX, this.textureY, (int)(this.width), (int)(this.height));
|
||||
|
||||
GL11.glTranslatef(GuiCustom.guiLeft,GuiCustom.guiTop,0.0F);
|
||||
GL11.glRotatef(this.rotation,0.0F,0.0F,1.0F);
|
||||
|
||||
int p_73729_1_ = (int) (this.x/this.scale);
|
||||
int p_73729_2_ = (int) (this.y/this.scale);
|
||||
int p_73729_3_ = this.textureX;
|
||||
int p_73729_4_ = this.textureY;
|
||||
int p_73729_5_ = (int)(this.width);
|
||||
int p_73729_6_ = (int)(this.height);
|
||||
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.setColorRGBA_F(red, green, blue, alpha);
|
||||
tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1));
|
||||
tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1));
|
||||
tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + 0) * f1));
|
||||
tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + 0) * f1));
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if (hovered && this.hoverText != null && this.hoverText.length > 0) {
|
||||
@@ -94,6 +116,7 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
|
||||
component.setScale(this.scale);
|
||||
component.setColor(color);
|
||||
component.setAlpha(alpha);
|
||||
component.setRotation(rotation);
|
||||
return component;
|
||||
}
|
||||
|
||||
@@ -112,6 +135,7 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
|
||||
|
||||
rect.color = component.getColor();
|
||||
rect.alpha = component.getAlpha();
|
||||
rect.rotation = component.getRotation();
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
@@ -4,12 +4,9 @@ import com.ibm.icu.text.ArabicShaping;
|
||||
import com.ibm.icu.text.ArabicShapingException;
|
||||
import com.ibm.icu.text.Bidi;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.gui.custom.GuiCustom;
|
||||
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||
import noppes.npcs.client.gui.customoverlay.interfaces.IOverlayComponent;
|
||||
import noppes.npcs.scripted.interfaces.ICustomOverlayComponent;
|
||||
@@ -20,10 +17,6 @@ import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
|
||||
|
||||
public class CustomOverlayLabel extends Gui implements IOverlayComponent {
|
||||
OverlayCustom parent;
|
||||
|
||||
@@ -141,7 +141,7 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
||||
}
|
||||
else if (button.id == 17) {
|
||||
ai.tacticalVariant = EnumNavType.values()[button.getValue()];
|
||||
ai.directLOS = EnumNavType.values()[button.getValue()] == EnumNavType.Stalk ? false : this.ai.directLOS;
|
||||
ai.directLOS = EnumNavType.values()[button.getValue()] != EnumNavType.Stalk && this.ai.directLOS;
|
||||
initGui();
|
||||
}
|
||||
else if (button.id == 22) {
|
||||
|
||||
@@ -79,24 +79,26 @@ public class PlayerQuestData {
|
||||
}
|
||||
|
||||
public QuestData getQuestCompletion(EntityPlayer player,EntityNPCInterface npc) {
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
for(QuestData data : activeQuests.values()){
|
||||
Quest quest = data.quest;
|
||||
if(quest != null && quest.completion == EnumQuestCompletion.Npc && quest.completerNpc.equals(npc.getCommandSenderName()) && quest.questInterface.isCompleted(player)){
|
||||
if(quest != null && quest.completion == EnumQuestCompletion.Npc && quest.completerNpc.equals(npc.getCommandSenderName()) && quest.questInterface.isCompleted(playerData)){
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean checkQuestCompletion(EntityPlayer player,EnumQuestType type) {
|
||||
public boolean checkQuestCompletion(PlayerData playerData,EnumQuestType type) {
|
||||
boolean bo = false;
|
||||
EntityPlayer player = playerData.player;
|
||||
for(QuestData data : this.activeQuests.values()){
|
||||
if(data.quest.type != type && type != null)
|
||||
continue;
|
||||
|
||||
QuestInterface inter = data.quest.questInterface;
|
||||
|
||||
if(inter.isCompleted(player)){
|
||||
|
||||
if(inter.isCompleted(playerData)){
|
||||
if(!data.isCompleted){
|
||||
if(!data.quest.complete(player,data)){
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.MESSAGE, "quest.completed", data.quest.title);
|
||||
|
||||
@@ -434,7 +434,11 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
|
||||
protected void updateAITasks()
|
||||
{
|
||||
super.updateAITasks();
|
||||
try {
|
||||
super.updateAITasks();
|
||||
} catch (ConcurrentModificationException ignored){
|
||||
}
|
||||
|
||||
this.getNavigator().onUpdateNavigation();
|
||||
this.getMoveHelper().onUpdateMoveHelper();
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompleted(EntityPlayer player) {
|
||||
public boolean isCompleted(PlayerData playerData) {
|
||||
for(int dialogId : dialogs.values())
|
||||
if(!PlayerDataController.instance.getPlayerData(player).dialogData.dialogsRead.contains(dialogId))
|
||||
if(!playerData.dialogData.dialogsRead.contains(dialogId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -94,17 +94,17 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
|
||||
public void setProgress(int progress) {
|
||||
if (progress >= 0 && progress <= 1) {
|
||||
PlayerData data = PlayerData.get(this.player);
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||
boolean completed = data.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
if (progress == 0 && completed) {
|
||||
data.dialogData.dialogsRead.remove(this.dialog.id);
|
||||
data.questData.checkQuestCompletion(this.player, EnumQuestType.values()[1]);
|
||||
data.questData.checkQuestCompletion(data, EnumQuestType.values()[1]);
|
||||
data.saveNBTData(data.getNBT());
|
||||
}
|
||||
|
||||
if (progress == 1 && !completed) {
|
||||
data.dialogData.dialogsRead.add(this.dialog.id);
|
||||
data.questData.checkQuestCompletion(this.player, EnumQuestType.values()[1]);
|
||||
data.questData.checkQuestCompletion(data, EnumQuestType.values()[1]);
|
||||
data.saveNBTData(data.getNBT());
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
}
|
||||
|
||||
public boolean isCompleted() {
|
||||
PlayerData data = PlayerData.get(this.player);
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||
return data.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Vector;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.controllers.PlayerData;
|
||||
import noppes.npcs.scripted.handler.data.IQuestInterface;
|
||||
import noppes.npcs.scripted.handler.data.IQuestObjective;
|
||||
|
||||
@@ -11,7 +12,7 @@ public abstract class QuestInterface implements IQuestInterface {
|
||||
public int questId;
|
||||
public abstract void writeEntityToNBT(NBTTagCompound compound);
|
||||
public abstract void readEntityFromNBT(NBTTagCompound compound);
|
||||
public abstract boolean isCompleted(EntityPlayer player);
|
||||
public abstract boolean isCompleted(PlayerData player);
|
||||
public abstract void handleComplete(EntityPlayer player);
|
||||
public abstract Vector<String> getQuestLogStatus(EntityPlayer player);
|
||||
public abstract IQuestObjective[] getObjectives(EntityPlayer var1);
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.NpcMiscInventory;
|
||||
import noppes.npcs.controllers.PlayerData;
|
||||
import noppes.npcs.scripted.CustomNPCsException;
|
||||
import noppes.npcs.scripted.handler.data.IQuestItem;
|
||||
import noppes.npcs.scripted.handler.data.IQuestObjective;
|
||||
@@ -36,8 +37,8 @@ public class QuestItem extends QuestInterface implements IQuestItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompleted(EntityPlayer player) {
|
||||
HashMap<Integer,ItemStack> map = getProcessSet(player);
|
||||
public boolean isCompleted(PlayerData playerData) {
|
||||
HashMap<Integer,ItemStack> map = getProcessSet(playerData.player);
|
||||
for(ItemStack reqItem : items.items.values()){
|
||||
boolean done = false;
|
||||
for(ItemStack item : map.values()){
|
||||
|
||||
@@ -43,8 +43,8 @@ public class QuestKill extends QuestInterface implements IQuestKill {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompleted(EntityPlayer player) {
|
||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
public boolean isCompleted(PlayerData playerData) {
|
||||
PlayerQuestData playerdata = playerData.questData;
|
||||
QuestData data = playerdata.activeQuests.get(questId);
|
||||
if(data == null)
|
||||
return false;
|
||||
@@ -129,7 +129,7 @@ public class QuestKill extends QuestInterface implements IQuestKill {
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
PlayerData data = PlayerData.get(this.player);
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerQuestData playerdata = data.questData;
|
||||
QuestData questdata = (QuestData)playerdata.activeQuests.get(this.parent.questId);
|
||||
HashMap<String, Integer> killed = this.parent.getKilled(questdata);
|
||||
@@ -138,15 +138,15 @@ public class QuestKill extends QuestInterface implements IQuestKill {
|
||||
|
||||
public void setProgress(int progress) {
|
||||
if (progress >= 0 && progress <= this.amount) {
|
||||
PlayerData data = PlayerData.get(this.player);
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerQuestData playerdata = data.questData;
|
||||
QuestData questdata = (QuestData)playerdata.activeQuests.get(this.parent.questId);
|
||||
HashMap<String, Integer> killed = this.parent.getKilled(questdata);
|
||||
if (!killed.containsKey(this.entity) || (Integer)killed.get(this.entity) != progress) {
|
||||
killed.put(this.entity, progress);
|
||||
this.parent.setKilled(questdata, killed);
|
||||
data.questData.checkQuestCompletion(this.player, EnumQuestType.values()[2]);
|
||||
data.questData.checkQuestCompletion(this.player, EnumQuestType.values()[4]);
|
||||
data.questData.checkQuestCompletion(data, EnumQuestType.values()[2]);
|
||||
data.questData.checkQuestCompletion(data, EnumQuestType.values()[4]);
|
||||
data.saveNBTData(data.getNBT());
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -37,8 +37,8 @@ public class QuestLocation extends QuestInterface implements IQuestLocation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompleted(EntityPlayer player) {
|
||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
public boolean isCompleted(PlayerData playerData) {
|
||||
PlayerQuestData playerdata = playerData.questData;
|
||||
QuestData data = playerdata.activeQuests.get(questId);
|
||||
if(data == null)
|
||||
return false;
|
||||
@@ -159,12 +159,12 @@ public class QuestLocation extends QuestInterface implements IQuestLocation {
|
||||
|
||||
public void setProgress(int progress) {
|
||||
if (progress >= 0 && progress <= 1) {
|
||||
PlayerData data = PlayerData.get(this.player);
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||
QuestData questData = (QuestData)data.questData.activeQuests.get(this.parent.questId);
|
||||
boolean completed = questData.extraData.getBoolean (this.nbtName);
|
||||
if ((!completed || progress != 1) && (completed || progress != 0)) {
|
||||
questData.extraData.setBoolean(this.nbtName, progress == 1);
|
||||
data.questData.checkQuestCompletion(this.player, EnumQuestType.values()[3]);
|
||||
data.questData.checkQuestCompletion(data, EnumQuestType.values()[3]);
|
||||
data.saveNBTData(data.getNBT());
|
||||
}
|
||||
} else {
|
||||
@@ -177,7 +177,7 @@ public class QuestLocation extends QuestInterface implements IQuestLocation {
|
||||
}
|
||||
|
||||
public boolean isCompleted() {
|
||||
PlayerData data = PlayerData.get(this.player);
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||
QuestData questData = (QuestData)data.questData.activeQuests.get(this.parent.questId);
|
||||
return questData.extraData.getBoolean(this.nbtName);
|
||||
}
|
||||
|
||||
@@ -179,6 +179,16 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
entity.velocityChanged = true;
|
||||
}
|
||||
|
||||
public void setMotion(double x, double y, double z){
|
||||
this.setMotionX(x);
|
||||
this.setMotionY(y);
|
||||
this.setMotionZ(z);
|
||||
}
|
||||
|
||||
public boolean isAirborne(){
|
||||
return entity.isAirBorne;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The block x position
|
||||
*/
|
||||
@@ -499,12 +509,16 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Current rotation of the npc
|
||||
* @return Current rotation of the entity
|
||||
*/
|
||||
public float getRotation(){
|
||||
return entity.rotationYaw;
|
||||
}
|
||||
|
||||
public void setPitch(float pitch){entity.rotationPitch = pitch;}
|
||||
|
||||
public float getPitch(){return entity.rotationPitch;}
|
||||
|
||||
/**
|
||||
* @param power How strong the knockback is
|
||||
* @param direction The direction in which he flies back (0-360). Usually based on getRotation()
|
||||
|
||||
@@ -613,10 +613,11 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
}
|
||||
|
||||
public void setTacticalVariant(int variant){
|
||||
if(variant > EnumNavType.values().length-1)
|
||||
if(variant > EnumNavType.values().length-1 || variant < 0)
|
||||
return;
|
||||
|
||||
npc.ai.tacticalVariant = EnumNavType.values()[variant];
|
||||
npc.ai.directLOS = EnumNavType.values()[variant] != EnumNavType.Stalk && npc.ai.directLOS;
|
||||
}
|
||||
|
||||
public int getTacticalVariant(){
|
||||
|
||||
@@ -69,6 +69,22 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
NoppesUtilPlayer.teleportPlayer(player, x, y, z, dimensionId);
|
||||
}
|
||||
|
||||
public int getHunger(){
|
||||
return player.getFoodStats().getFoodLevel();
|
||||
}
|
||||
|
||||
public void setHunger(int hunger){
|
||||
player.getFoodStats().setFoodLevel(hunger);
|
||||
}
|
||||
|
||||
public float getSaturation(){
|
||||
return player.getFoodStats().getSaturationLevel();
|
||||
}
|
||||
|
||||
public void setSaturation(float saturation){
|
||||
player.getFoodStats().setFoodSaturationLevel(saturation);
|
||||
}
|
||||
|
||||
public int getDimension(){
|
||||
return player.dimension;
|
||||
}
|
||||
@@ -329,6 +345,10 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
}
|
||||
}
|
||||
|
||||
public void setRotation(float rotationYaw){
|
||||
NoppesUtilPlayer.teleportPlayer(player, player.posX, player.posY, player.posZ, rotationYaw, player.rotationPitch, player.dimension);
|
||||
}
|
||||
|
||||
public void setRotation(float rotationYaw, float rotationPitch){
|
||||
NoppesUtilPlayer.teleportPlayer(player, player.posX, player.posY, player.posZ, rotationYaw, rotationPitch, player.dimension);
|
||||
}
|
||||
@@ -386,8 +406,9 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
|
||||
public void updatePlayerInventory() {
|
||||
((EntityPlayerMP)this.entity).inventoryContainer.detectAndSendChanges();
|
||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
playerdata.checkQuestCompletion((EntityPlayer)this.entity, EnumQuestType.Item);
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
questData.checkQuestCompletion(playerData, EnumQuestType.Item);
|
||||
}
|
||||
|
||||
public boolean checkGUIOpen() {
|
||||
@@ -396,12 +417,6 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
return data.getGUIOpen();
|
||||
}
|
||||
|
||||
public void checkQuestCompleted() {
|
||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
for(EnumQuestType e : EnumQuestType.values())
|
||||
playerdata.checkQuestCompletion((EntityPlayer)this.entity, e);
|
||||
}
|
||||
|
||||
public ScriptDBCPlayer<T> getDBCPlayer() {
|
||||
Set keySet = player.getEntityData().getCompoundTag("PlayerPersisted").func_150296_c();
|
||||
Iterator iterator = keySet.iterator();
|
||||
|
||||
@@ -42,8 +42,9 @@ public class PlayerEvent extends CustomNPCsEvent {
|
||||
public final boolean isShiftPressed;
|
||||
public final boolean isMetaPressed;
|
||||
public final boolean keyDown;
|
||||
public final int[] keysDown;
|
||||
|
||||
public KeyPressedEvent(IPlayer player, int key, boolean isCtrlPressed, boolean isAltPressed, boolean isShiftPressed, boolean isMetaPressed, boolean keyDown) {
|
||||
public KeyPressedEvent(IPlayer player, int key, boolean isCtrlPressed, boolean isAltPressed, boolean isShiftPressed, boolean isMetaPressed, boolean keyDown, int[] heldKeys) {
|
||||
super(player);
|
||||
this.key = key;
|
||||
this.isCtrlPressed = isCtrlPressed;
|
||||
@@ -51,6 +52,11 @@ public class PlayerEvent extends CustomNPCsEvent {
|
||||
this.isShiftPressed = isShiftPressed;
|
||||
this.isMetaPressed = isMetaPressed;
|
||||
this.keyDown = keyDown;
|
||||
this.keysDown = heldKeys;
|
||||
|
||||
for(int i : keysDown){
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ public abstract class ScriptGuiComponent implements ICustomGuiComponent {
|
||||
|
||||
int color = 0xFFFFFF;
|
||||
float alpha = 1.0F;
|
||||
float rotation = 0;
|
||||
|
||||
public ScriptGuiComponent() {
|
||||
}
|
||||
@@ -76,6 +77,14 @@ public abstract class ScriptGuiComponent implements ICustomGuiComponent {
|
||||
this.alpha = alpha;
|
||||
}
|
||||
|
||||
public float getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public void setRotation(float rotation) {
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
public abstract int getType();
|
||||
|
||||
public NBTTagCompound toNBT(NBTTagCompound nbt) {
|
||||
@@ -83,6 +92,7 @@ public abstract class ScriptGuiComponent implements ICustomGuiComponent {
|
||||
nbt.setIntArray("pos", new int[]{this.posX, this.posY});
|
||||
nbt.setInteger("color", this.color);
|
||||
nbt.setFloat("alpha",this.alpha);
|
||||
nbt.setFloat("rotation",this.rotation);
|
||||
if (this.hoverText != null) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
String[] var3 = this.hoverText;
|
||||
@@ -109,6 +119,7 @@ public abstract class ScriptGuiComponent implements ICustomGuiComponent {
|
||||
this.setPos(nbt.getIntArray("pos")[0], nbt.getIntArray("pos")[1]);
|
||||
this.setColor(nbt.getInteger("color"));
|
||||
this.setAlpha(nbt.getFloat("alpha"));
|
||||
this.setRotation(nbt.getFloat("rotation"));
|
||||
if (nbt.hasKey("hover")) {
|
||||
NBTTagList list = nbt.getTagList("hover", 8);
|
||||
String[] hoverText = new String[list.tagCount()];
|
||||
|
||||
Reference in new issue
Block a user