mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 18:49:39 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
9fadb997ce
69 files changed
+2080
-1609
No files matched your search
@@ -179,6 +179,7 @@ public class EventHooks {
|
||||
return false;
|
||||
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.ATTACK_MELEE, event);
|
||||
npc.script.callScript(EnumScriptType.ATTACK_MELEE, event, "target", event.target);
|
||||
npc.script.callScript(EnumScriptType.ATTACK, event, "target", event.target);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -197,6 +198,7 @@ public class EventHooks {
|
||||
return false;
|
||||
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.RANGED_LAUNCHED, event);
|
||||
npc.script.callScript(EnumScriptType.RANGED_LAUNCHED, event, "target", event.target);
|
||||
npc.script.callScript(EnumScriptType.ATTACK, event, "target", event.target);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
@@ -320,14 +320,38 @@ public class NoppesUtilPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearTrackQuest(EntityPlayerMP player) throws IOException {
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
playerData.questData.untrackQuest();
|
||||
}
|
||||
|
||||
|
||||
public static void updatePartyQuestLogData(ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
String trackedQuestString = Server.readString(buffer);
|
||||
Quest trackedQuest = getQuestFromStringKey(trackedQuestString);
|
||||
if (trackedQuest != null) {
|
||||
playerData.questData.trackParty(playerData.getPlayerParty());
|
||||
} else {
|
||||
playerData.questData.untrackQuest();
|
||||
}
|
||||
}
|
||||
|
||||
private static Quest getQuestFromStringKey(String string) {
|
||||
if (string != null && string.contains(":")) {
|
||||
String[] splitString = string.split(":");
|
||||
if(splitString.length < 2){
|
||||
return null;
|
||||
}
|
||||
String categoryName = splitString[0];
|
||||
String questName = splitString[1];
|
||||
|
||||
String categoryName;
|
||||
String questName;
|
||||
if (splitString.length == 3 && splitString[0].equals("P")) {
|
||||
categoryName = splitString[1];
|
||||
questName = splitString[2];
|
||||
} else if (splitString.length < 2) {
|
||||
return null;
|
||||
} else {
|
||||
categoryName = splitString[0];
|
||||
questName = splitString[1];
|
||||
}
|
||||
|
||||
for (QuestCategory category : QuestController.Instance.categories.values()) {
|
||||
if (category.title.equals(categoryName)) {
|
||||
@@ -364,6 +388,30 @@ public class NoppesUtilPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendPartyTrackedQuestData(EntityPlayerMP player, Party party) {
|
||||
Quest trackedQuest = (Quest) PlayerDataController.Instance.getPlayerData(player).questData.getTrackedQuest();
|
||||
if(trackedQuest != null){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("Quest",trackedQuest.writeToNBT(new NBTTagCompound()));
|
||||
compound.setString("CategoryName", trackedQuest.getCategory().getName());
|
||||
if(trackedQuest.completion == EnumQuestCompletion.Instant){
|
||||
compound.setBoolean("Instant", true);
|
||||
}
|
||||
else {
|
||||
compound.setString("TurnInNPC", trackedQuest.getNpcName());
|
||||
}
|
||||
NBTTagList nbtTagList = new NBTTagList();
|
||||
for (IQuestObjective objective : trackedQuest.questInterface.getPartyObjectives(party)) {
|
||||
nbtTagList.appendTag(new NBTTagString(objective.getText()));
|
||||
if(objective.getAdditionalText() != null)
|
||||
nbtTagList.appendTag(new NBTTagString(objective.getAdditionalText()));
|
||||
}
|
||||
compound.setTag("ObjectiveList",nbtTagList);
|
||||
|
||||
Server.sendData(player, EnumPacketClient.OVERLAY_QUEST_TRACKING, compound);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendQuestLogData(EntityPlayerMP player) {
|
||||
if(!PlayerQuestController.hasActiveQuests(player)){
|
||||
return;
|
||||
@@ -372,6 +420,13 @@ public class NoppesUtilPlayer {
|
||||
data.setData(player);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, data.writeNBT());
|
||||
}
|
||||
|
||||
public static void sendTrackedQuest(EntityPlayerMP player) {
|
||||
QuestLogData data = new QuestLogData();
|
||||
data.setTrackedQuestKey(player);
|
||||
Server.sendData(player, EnumPacketClient.PARTY_DATA, data.writeTrackedQuest());
|
||||
}
|
||||
|
||||
public static boolean questCompletion(EntityPlayerMP player, int questId) {
|
||||
if(player == null)
|
||||
return false;
|
||||
@@ -477,6 +532,7 @@ public class NoppesUtilPlayer {
|
||||
if (partyEv.isCancelled())
|
||||
return false;
|
||||
|
||||
boolean hasNextQuest = data.quest.hasNewQuest();
|
||||
PartyOptions partyOptions = quest.partyOptions;
|
||||
EnumPartyExchange complete = partyOptions.completeFor;
|
||||
EnumPartyExchange reward = partyOptions.rewardControl;
|
||||
@@ -540,11 +596,7 @@ public class NoppesUtilPlayer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(meetsComplete){
|
||||
data.quest.questInterface.handleComplete(player);
|
||||
}
|
||||
|
||||
data.quest.questInterface.handlePartyComplete(player, party, isLeader, partyOptions.objectiveRequirement);
|
||||
if(meetsReward){
|
||||
if(data.quest.rewardExp > 0){
|
||||
player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 0.5F * ((player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.7F + 1.8F));
|
||||
@@ -565,12 +617,12 @@ public class NoppesUtilPlayer {
|
||||
|
||||
if(meetsComplete){
|
||||
PlayerQuestController.setQuestPartyFinished(data.quest, player, data);
|
||||
if (data.quest.hasNewQuest()) {
|
||||
QuestData nextQuest = new QuestData(data.quest.getNextQuest());
|
||||
nextQuest.sendAlerts = data.quest.id != data.quest.getNextQuest().id || data.sendAlerts;
|
||||
PlayerQuestController.addActiveQuest(nextQuest, player);
|
||||
// questData.trackQuest(nextQuest.quest);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasNextQuest && meetsComplete) {
|
||||
QuestData nextQuest = new QuestData(data.quest.getNextQuest());
|
||||
nextQuest.sendAlerts = data.quest.id != data.quest.getNextQuest().id || data.sendAlerts;
|
||||
PlayerQuestController.addActiveQuest(nextQuest, player);
|
||||
}
|
||||
|
||||
playerData.save();
|
||||
@@ -579,8 +631,30 @@ public class NoppesUtilPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
if(data.quest.completion == EnumQuestCompletion.Npc){
|
||||
|
||||
if (hasNextQuest) {
|
||||
if(party.validateQuest(data.quest.getNextQuest().getId(), true)){
|
||||
party.setQuest(data.quest.getNextQuest());
|
||||
for(String name : party.getPlayerNames()) {
|
||||
EntityPlayer player = NoppesUtilServer.getPlayerByName(name);
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
if (playerData == null)
|
||||
continue;
|
||||
|
||||
playerData.questData.trackParty(party);
|
||||
}
|
||||
}
|
||||
else {
|
||||
party.setQuest(null);
|
||||
}
|
||||
} else {
|
||||
party.setQuest(null);
|
||||
}
|
||||
|
||||
if(data.quest.completion == EnumQuestCompletion.Npc){
|
||||
PartyController.Instance().sendQuestChat(party, "party.completeChat");
|
||||
PartyController.Instance().pingPartyUpdate(party);
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ public class NoppesUtilServer {
|
||||
// Trim the command to remove leading/trailing spaces
|
||||
command = command.trim();
|
||||
|
||||
String[] commands = command.split(";"); // Split the command by semicolon
|
||||
String[] commands = command.split("@x"); // Split the command by @x
|
||||
|
||||
// Create TileEntityCommandBlock instance outside the loop
|
||||
TileEntityCommandBlock tile = new TileEntityCommandBlock();
|
||||
@@ -245,7 +245,7 @@ public class NoppesUtilServer {
|
||||
|
||||
// Trim the command to remove leading/trailing spaces
|
||||
command = command.trim();
|
||||
String[] commands = command.split(";"); // Split the command by semicolon
|
||||
String[] commands = command.split("@x"); // Split the command by @x
|
||||
CommandBlockLogic logic = tile.func_145993_a();
|
||||
for (String cmd : commands) {
|
||||
logic.func_145752_a(cmd.trim()); // Trim the command to remove any leading/trailing spaces
|
||||
|
||||
@@ -209,6 +209,9 @@ public class PacketHandlerPlayer{
|
||||
else if(type == EnumPlayerPacket.QuestLog){
|
||||
NoppesUtilPlayer.sendQuestLogData(player);
|
||||
}
|
||||
else if(type == EnumPlayerPacket.TrackedQuest){
|
||||
NoppesUtilPlayer.sendTrackedQuest(player);
|
||||
}
|
||||
else if(type == EnumPlayerPacket.FactionsGet){
|
||||
PlayerFactionData data = PlayerDataController.Instance.getPlayerData(player).factionData;
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, data.getPlayerGuiData());
|
||||
|
||||
@@ -91,7 +91,13 @@ public class PacketHandlerServer{
|
||||
} else if (type == EnumPacketServer.QuestLogToServer) {
|
||||
NoppesUtilPlayer.updateQuestLogData(buffer, player);
|
||||
return;
|
||||
} else if(type == EnumPacketServer.DimensionsGet){
|
||||
} else if (type == EnumPacketServer.PartyLogToServer) {
|
||||
NoppesUtilPlayer.updatePartyQuestLogData(buffer, player);
|
||||
return;
|
||||
} else if (type == EnumPacketServer.UntrackQuest) {
|
||||
NoppesUtilPlayer.clearTrackQuest(player);
|
||||
return;
|
||||
} else if(type == EnumPacketServer.DimensionsGet){
|
||||
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
||||
for(int id : DimensionManager.getStaticDimensionIDs()){
|
||||
WorldProvider provider = DimensionManager.createProviderFor(id);
|
||||
@@ -317,6 +323,7 @@ public class PacketHandlerServer{
|
||||
NBTTagCompound compound = party.writeToNBT();
|
||||
if (party.getQuest() != null) {
|
||||
Quest quest = (Quest) party.getQuest();
|
||||
compound.setString("QuestName", quest.getCategory().getName() + ":" + quest.getName());
|
||||
Vector<String> vector = quest.questInterface.getPartyQuestLogStatus(party);
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (String s : vector) {
|
||||
|
||||
@@ -2,9 +2,11 @@ package noppes.npcs;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.handler.data.IQuest;
|
||||
import noppes.npcs.constants.EnumQuestCompletion;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.PlayerQuestController;
|
||||
import noppes.npcs.controllers.data.Party;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
|
||||
@@ -47,6 +49,17 @@ public class QuestLogData {
|
||||
partyQuests = NBTTags.getStringIntegerMap(compound.getTagList("PartyQuests", 10));
|
||||
partyOptions = NBTTags.getVectorMap(compound.getTagList("PartyOptions", 10));
|
||||
}
|
||||
|
||||
public NBTTagCompound writeTrackedQuest(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setString("TrackedQuestID", trackedQuestKey);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readTrackedQuest(NBTTagCompound compound){
|
||||
trackedQuestKey = compound.getString("TrackedQuestID");
|
||||
}
|
||||
|
||||
public void setData(EntityPlayer player){
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
|
||||
@@ -76,8 +89,36 @@ public class QuestLogData {
|
||||
partyOptions.put(key, quest.partyOptions.getPartyOptionsList());
|
||||
}
|
||||
}
|
||||
|
||||
Party party = playerData.getPlayerParty();
|
||||
if(party != null && party.getQuest() != null){
|
||||
if (playerData.questData.getTrackedQuest() != null) {
|
||||
if (party.getQuest().getId() == playerData.questData.getTrackedQuest().getId()) {
|
||||
trackedQuestKey = "P" + ":" + party.getQuest().getCategory().getName() + ":" + party.getQuest().getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setTrackedQuestKey(EntityPlayer player){
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
|
||||
Party party = playerData.getPlayerParty();
|
||||
if(party != null && party.getQuest() != null){
|
||||
if (playerData.questData.getTrackedQuest() != null) {
|
||||
if (party.getQuest().getId() == playerData.questData.getTrackedQuest().getId()) {
|
||||
trackedQuestKey = "P" + ":" + party.getQuest().getCategory().getName() + ":" + party.getQuest().getName();
|
||||
}
|
||||
}
|
||||
} else if(playerData.questData != null && playerData.questData.getTrackedQuest() != null){
|
||||
IQuest quest = playerData.questData.getTrackedQuest();
|
||||
trackedQuestKey = quest.getCategory().getName() + ":" + quest.getName();
|
||||
}
|
||||
else {
|
||||
trackedQuestKey = "";
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasSelectedQuest() {
|
||||
return !selectedQuest.isEmpty();
|
||||
}
|
||||
|
||||
@@ -30,10 +30,7 @@ import noppes.npcs.constants.EnumQuestType;
|
||||
import noppes.npcs.constants.SyncType;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.controllers.data.PlayerQuestData;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
@@ -78,7 +75,10 @@ public class ScriptPlayerEventHandler {
|
||||
playerData.timers.update();
|
||||
}
|
||||
|
||||
if (playerData.questData.getTrackedQuest() != null && !playerData.questData.activeQuests.containsKey(playerData.questData.getTrackedQuest().getId())) {
|
||||
|
||||
Party party = playerData.getPlayerParty();
|
||||
boolean trackingPartyQuest = playerData.questData.getTrackedQuest() != null && party != null && party.getQuest() != null && party.getQuest().getId() == playerData.questData.getTrackedQuest().getId();
|
||||
if (playerData.questData.getTrackedQuest() != null && !playerData.questData.activeQuests.containsKey(playerData.questData.getTrackedQuest().getId()) && !trackingPartyQuest) {
|
||||
PlayerDataController.Instance.getPlayerData(player).questData.untrackQuest();
|
||||
}
|
||||
|
||||
@@ -90,7 +90,12 @@ public class ScriptPlayerEventHandler {
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
if(questData != null){
|
||||
if (questData.getTrackedQuest() != null && ((Quest) questData.getTrackedQuest()).type == EnumQuestType.Item) {
|
||||
NoppesUtilPlayer.sendTrackedQuestData((EntityPlayerMP) event.player);
|
||||
if(trackingPartyQuest){
|
||||
NoppesUtilPlayer.sendPartyTrackedQuestData((EntityPlayerMP) event.player, party);
|
||||
}
|
||||
else {
|
||||
NoppesUtilPlayer.sendTrackedQuestData((EntityPlayerMP) event.player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -483,9 +488,16 @@ public class ScriptPlayerEventHandler {
|
||||
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(event.player);
|
||||
EventHooks.onPlayerLogin(handler, scriptPlayer);
|
||||
|
||||
Quest quest = (Quest) PlayerDataController.Instance.getPlayerData(event.player).questData.getTrackedQuest();
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(event.player);
|
||||
Quest quest = (Quest) playerData.questData.getTrackedQuest();
|
||||
if (quest != null) {
|
||||
NoppesUtilPlayer.sendTrackedQuestData((EntityPlayerMP) event.player);
|
||||
Party party = playerData.getPlayerParty();
|
||||
if(party != null && party.getQuest() != null && party.getQuest().getId() == quest.getId()){
|
||||
NoppesUtilPlayer.sendPartyTrackedQuestData((EntityPlayerMP) event.player, party);
|
||||
}
|
||||
else {
|
||||
NoppesUtilPlayer.sendTrackedQuestData((EntityPlayerMP) event.player);
|
||||
}
|
||||
}
|
||||
|
||||
PlayerDataController.Instance.getPlayerData(event.player).skinOverlays.updateClient();
|
||||
|
||||
@@ -136,15 +136,15 @@ public class CombatHandler {
|
||||
public boolean shouldChangeTarget(double chance) {
|
||||
// Assuming randomNum is a random number between 0 and 100
|
||||
double randomNum = Math.random() * 100; // Generates a random number between 0 and 100
|
||||
return randomNum <= chance;
|
||||
return randomNum < chance;
|
||||
}
|
||||
|
||||
public boolean shouldSwitchTactically(EntityLivingBase originalTarget, EntityLivingBase newTarget) {
|
||||
// Implement your Tactical Switcher conditions here
|
||||
// Example: Switch if the new target has a higher threat level
|
||||
public boolean shouldSwitchTactically(EntityLivingBase originalTarget, EntityLivingBase newTarget, boolean reverse) {
|
||||
float currentThreat = calculateThreatLevel(originalTarget);
|
||||
float newThreat = calculateThreatLevel(newTarget);
|
||||
|
||||
if(reverse){
|
||||
return newThreat < currentThreat;
|
||||
}
|
||||
return newThreat > currentThreat;
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,10 @@ public class BlockCarpentryBench extends BlockContainer
|
||||
public BlockCarpentryBench()
|
||||
{
|
||||
super(Material.wood);
|
||||
setStepSound(soundTypeWood);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{//onBlockActivated
|
||||
if(!par1World.isRemote){
|
||||
@@ -36,12 +37,13 @@ public class BlockCarpentryBench extends BlockContainer
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean isOpaqueCube()//isOpaqueCube
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()//getRenderType
|
||||
{
|
||||
return renderId;
|
||||
@@ -49,7 +51,7 @@ public class BlockCarpentryBench extends BlockContainer
|
||||
/**
|
||||
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()//renderAsNormalBlock
|
||||
{
|
||||
return false;
|
||||
@@ -59,21 +61,21 @@ public class BlockCarpentryBench extends BlockContainer
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
@Override
|
||||
public int damageDropped(int par1)
|
||||
{
|
||||
return par1/4;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack item)
|
||||
{
|
||||
int var6 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw / 90.0F) + 0.5D) & 3;
|
||||
|
||||
@@ -54,6 +54,11 @@ public class ClientCacheHandler {
|
||||
ClientCacheHandler.skinOverlays.clear();
|
||||
ClientCacheHandler.playerAnimations.clear();
|
||||
ClientCacheHandler.playerData.animationData.clearCache();
|
||||
party = null;
|
||||
}
|
||||
|
||||
public static void clearSkinCache() {
|
||||
ClientCacheHandler.imageDataCache.clear();
|
||||
ClientCacheHandler.customOverlays.clear();
|
||||
ClientCacheHandler.skinOverlays.clear();
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,8 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBlockAnvil.class, new BlockCarpentryBenchRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileMailbox.class, new BlockMailboxRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockBorderRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileScripted.class, new BlockScriptedRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockBorderRenderer());
|
||||
|
||||
if(!ConfigMain.DisableExtraBlock){
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBanner.class, new BlockBannerRenderer());
|
||||
@@ -126,7 +127,6 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBeam.class, new BlockBeamRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBook.class, new BlockBookRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TilePedestal.class, new BlockPedestalRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileScripted.class, new BlockScriptedRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockBloodRenderer());
|
||||
}
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
@@ -150,8 +150,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
if(ConfigClient.InventoryGuiEnabled){
|
||||
MinecraftForge.EVENT_BUS.register(new TabRegistry());
|
||||
|
||||
if (TabRegistry.getTabList().size() < 2){
|
||||
if (TabRegistry.getTabList().isEmpty()){
|
||||
TabRegistry.registerTab(new InventoryTabVanilla());
|
||||
}
|
||||
TabRegistry.registerTab(new InventoryTabCustomNpc());
|
||||
|
||||
@@ -12,10 +12,7 @@ import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.client.controllers.MusicController;
|
||||
import noppes.npcs.client.controllers.ScriptSoundController;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiCNPCInventory;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiFaction;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiParty;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiQuestLog;
|
||||
import noppes.npcs.client.gui.player.inventory.*;
|
||||
import noppes.npcs.client.renderer.RenderNPCInterface;
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
@@ -97,14 +94,17 @@ public class ClientTickHandler{
|
||||
if(mc.currentScreen == null){
|
||||
switch (GuiCNPCInventory.activeTab){
|
||||
case 0:
|
||||
NoppesUtil.openGUI(mc.thePlayer, new GuiQuestLog(mc.thePlayer));
|
||||
NoppesUtil.openGUI(mc.thePlayer, new GuiQuestLog());
|
||||
break;
|
||||
case 1:
|
||||
NoppesUtil.openGUI(mc.thePlayer, new GuiParty(mc.thePlayer));
|
||||
NoppesUtil.openGUI(mc.thePlayer, new GuiParty());
|
||||
break;
|
||||
case 2:
|
||||
NoppesUtil.openGUI(mc.thePlayer, new GuiFaction());
|
||||
break;
|
||||
case 3:
|
||||
NoppesUtil.openGUI(mc.thePlayer, new GuiSettings());
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(mc.currentScreen instanceof GuiQuestLog)
|
||||
|
||||
@@ -76,6 +76,9 @@ public class PacketHandlerClient extends PacketHandlerServer{
|
||||
player.addChatMessage(new ChatComponentTranslation(npc.getCommandSenderName() + ": " + text));
|
||||
}
|
||||
else if(type == EnumPacketClient.CHAT){
|
||||
if(!ConfigClient.ChatAlerts)
|
||||
return;
|
||||
|
||||
String message = "";
|
||||
String str;
|
||||
while((str = Server.readString(buffer)) != null && !str.isEmpty())
|
||||
@@ -84,6 +87,9 @@ public class PacketHandlerClient extends PacketHandlerServer{
|
||||
player.addChatMessage(new ChatComponentTranslation(message));
|
||||
}
|
||||
else if(type == EnumPacketClient.MESSAGE || type == EnumPacketClient.PARTY_MESSAGE){
|
||||
if(!ConfigClient.BannerAlerts)
|
||||
return;
|
||||
|
||||
String description = StatCollector.translateToLocal(Server.readString(buffer));
|
||||
String message = Server.readString(buffer);
|
||||
Achievement ach = type == EnumPacketClient.MESSAGE ? new MessageAchievement(message, description) : new MessageAchievement(CustomItems.bag == null ? Items.paper : CustomItems.bag, message, description);
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNPCDialogSelection extends GuiNPCInterface implements IScrollData
|
||||
{
|
||||
private GuiNPCStringSlot slot;
|
||||
private GuiScreen parent;
|
||||
private HashMap<String,Integer> data = new HashMap<String,Integer>();
|
||||
private int dialog;
|
||||
private boolean selectCategory = true;
|
||||
public GuiSelectionListener listener;
|
||||
public GuiNPCDialogSelection(EntityNPCInterface npc,GuiScreen parent,int dialog)
|
||||
{
|
||||
super(npc);
|
||||
drawDefaultBackground = false;
|
||||
title = "Select Dialog Category";
|
||||
this.parent = parent;
|
||||
this.dialog = dialog;
|
||||
|
||||
|
||||
if(dialog >= 0){
|
||||
Client.sendData(EnumPacketServer.DialogsGetFromDialog, dialog);
|
||||
selectCategory = false;
|
||||
title = "Select Dialog";
|
||||
}else
|
||||
Client.sendData(EnumPacketServer.DialogCategoriesGet, dialog);
|
||||
|
||||
if(parent instanceof GuiSelectionListener){
|
||||
listener = (GuiSelectionListener) parent;
|
||||
}
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
Vector<String> list = new Vector<String>();
|
||||
|
||||
slot = new GuiNPCStringSlot(list,this,false,18);
|
||||
slot.registerScrollButtons(4, 5);
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 -100, height - 41,98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 41,98, 20, "gui.select"));
|
||||
}
|
||||
|
||||
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
slot.drawScreen(i, j, f);
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 2)
|
||||
{
|
||||
if(selectCategory){
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}else{
|
||||
title = "Select Dialog Category";
|
||||
selectCategory = true;
|
||||
Client.sendData(EnumPacketServer.DialogCategoriesGet, dialog);
|
||||
}
|
||||
}
|
||||
if(id == 4)
|
||||
{
|
||||
doubleClicked();
|
||||
}
|
||||
}
|
||||
public void doubleClicked() {
|
||||
if(slot.selected == null || slot.selected.isEmpty())
|
||||
return;
|
||||
if(selectCategory){
|
||||
selectCategory = false;
|
||||
title = "Select Dialog";
|
||||
Client.sendData(EnumPacketServer.DialogsGet, data.get(slot.selected));
|
||||
}
|
||||
else{
|
||||
dialog = data.get(slot.selected);
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
|
||||
}
|
||||
public void save() {
|
||||
if(dialog >= 0){
|
||||
if(listener != null)
|
||||
listener.selected(dialog, slot.selected);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data) {
|
||||
this.data = data;
|
||||
this.slot.setList(list);
|
||||
if(dialog >= 0)
|
||||
for(String name : data.keySet())
|
||||
if(data.get(name) == dialog)
|
||||
slot.selected = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiNPCTextures extends GuiNpcSelectionInterface
|
||||
{
|
||||
public GuiNPCTextures(EntityNPCInterface npc,GuiScreen parent)
|
||||
{
|
||||
super(npc, parent, npc.display.texture);
|
||||
title = "Select Texture";
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
int index = npc.display.texture.lastIndexOf("/");
|
||||
if(index > 0){
|
||||
String asset = npc.display.texture.substring(index + 1);
|
||||
if(npc.display.texture.equals(assets.getAsset(asset)))
|
||||
slot.selected = asset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
npc.isDrawn = true;
|
||||
int l = (width/2)-180;
|
||||
int i1 = (height/2) - 90;
|
||||
GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
GL11.glEnable(2903 /*GL_COLOR_MATERIAL*/);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(l + 33, i1 + 131, 50F);
|
||||
float f1 = (50F * 5) / npc.display.modelSize;
|
||||
GL11.glScalef(-f1, f1, f1);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
float f2 = npc.renderYawOffset;
|
||||
float f3 = npc.rotationYaw;
|
||||
float f4 = npc.rotationPitch;
|
||||
float f7 = npc.rotationYawHead;
|
||||
float f5 = (float)(l + 33) - i;
|
||||
float f6 = (float)((i1 + 131) - 50) - j;
|
||||
GL11.glRotatef(135F, 0.0F, 1.0F, 0.0F);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GL11.glRotatef(-135F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-(float)Math.atan(f6 / 40F) * 20F, 1.0F, 0.0F, 0.0F);
|
||||
npc.renderYawOffset = (float)Math.atan(f5 / 40F) * 20F;
|
||||
npc.rotationYaw = (float)Math.atan(f5 / 40F) * 40F;
|
||||
npc.rotationPitch = -(float)Math.atan(f6 / 40F) * 20F;
|
||||
npc.rotationYawHead = npc.rotationYaw;
|
||||
npc.cloakUpdate();
|
||||
GL11.glTranslatef(0.0F, npc.yOffset, 0.0F);
|
||||
RenderManager.instance.playerViewY = 180F;
|
||||
RenderManager.instance.renderEntityWithPosYaw(npc, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
|
||||
npc.renderYawOffset = f2;
|
||||
npc.rotationYaw = f3;
|
||||
npc.rotationPitch = f4;
|
||||
npc.rotationYawHead = f7;
|
||||
npc.isDrawn = false;
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
if(dataTextures.contains(slot.selected) && slot.selected != null){
|
||||
npc.display.texture = assets.getAsset(slot.selected);
|
||||
npc.textureLocation = null;
|
||||
}
|
||||
}
|
||||
public void save() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getExtension() {
|
||||
return new String[]{"png"};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -122,6 +122,9 @@ public class OverlayQuestTracking extends Gui {
|
||||
boolean completed = false;
|
||||
|
||||
try {
|
||||
if(split.length < 2)
|
||||
throw new NumberFormatException("catch");
|
||||
|
||||
int killed = Integer.parseInt(split[0].trim());
|
||||
int total = Integer.parseInt(split[1].trim());
|
||||
|
||||
@@ -129,7 +132,7 @@ public class OverlayQuestTracking extends Gui {
|
||||
completed = true;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
if (objective.endsWith("(read)") || (objective.endsWith("Found") && !objective.endsWith("Not Found"))) {
|
||||
if (objective.endsWith("(Done)") || objective.endsWith("(read)") || (objective.endsWith("Found") && !objective.endsWith("Not Found"))) {
|
||||
completed = true;
|
||||
}
|
||||
}
|
||||
@@ -177,61 +180,87 @@ public class OverlayQuestTracking extends Gui {
|
||||
|
||||
public void renderGameOverlay(float partialTicks){
|
||||
res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
scaledWidth = res.getScaledWidth();
|
||||
scaledHeight = res.getScaledHeight();
|
||||
|
||||
float overallScale = (float) ConfigClient.TrackingScale / 100;
|
||||
|
||||
scaledWidth = (int) (res.getScaledWidth());
|
||||
scaledHeight = (int) (res.getScaledHeight());
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(ConfigClient.TrackingInfoAlignment%3*((float)(scaledWidth)/2), (float) (Math.floor((float)(ConfigClient.TrackingInfoAlignment/3))*((float)(scaledHeight)/2)),0.0F);
|
||||
GL11.glTranslatef(ConfigClient.TrackingInfoAlignment%3*((float)(scaledWidth)/2), (float) (Math.floor((float)(ConfigClient.TrackingInfoAlignment/3))*((float)(scaledHeight)/2)),0.0F);
|
||||
|
||||
float offsetX = ConfigClient.TrackingInfoAlignment%3 == 0 ? 5 : -5;
|
||||
GL11.glTranslatef(ConfigClient.TrackingInfoX + offsetX, ConfigClient.TrackingInfoY, 0.0F);
|
||||
float offsetX = ConfigClient.TrackingInfoAlignment%3 == 0 ? 5 : -5;
|
||||
|
||||
red = (color >> 16 & 255) / 255f;
|
||||
green = (color >> 8 & 255) / 255f;
|
||||
blue = (color & 255) / 255f;
|
||||
float offsetY = ConfigClient.TrackingInfoAlignment < 3 ? 5 : 0;
|
||||
offsetY = ConfigClient.TrackingInfoAlignment > 5 ? -5 : offsetY;
|
||||
|
||||
float centerX = -60;
|
||||
centerX *= ConfigClient.TrackingInfoAlignment%3 == 0 ? -1 : 1;
|
||||
GL11.glTranslatef(ConfigClient.TrackingInfoX + offsetX, ConfigClient.TrackingInfoY + offsetY, 0.0F);
|
||||
|
||||
float questTitleTop;
|
||||
this.renderOffsetY = -40;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(centerX, 0.0F, 0.0F);
|
||||
this.renderStringLines(trackedQuestLines,1.2F, false, true, 0);
|
||||
GL11.glPopMatrix();
|
||||
questTitleTop = this.renderOffsetY;
|
||||
this.renderOffsetY -= 10;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(centerX, 0.0F, 0.0F);
|
||||
this.renderStringLines(categoryNameLines,0.85F, false, false, 0);
|
||||
GL11.glPopMatrix();
|
||||
red = (color >> 16 & 255) / 255f;
|
||||
green = (color >> 8 & 255) / 255f;
|
||||
blue = (color & 255) / 255f;
|
||||
|
||||
this.renderOffsetY = -10;
|
||||
GL11.glPushMatrix();
|
||||
this.renderStringLines(objectiveLines,1F, true, false, ConfigClient.TrackingInfoAlignment%3 == 0 ? 1 : 2);
|
||||
GL11.glPopMatrix();
|
||||
float centerX = (float) -overlayWidth /2 * overallScale;
|
||||
if (ConfigClient.TrackingInfoAlignment % 3 == 1) { // For Center alignment
|
||||
centerX = 0;
|
||||
} else {
|
||||
centerX *= ConfigClient.TrackingInfoAlignment % 3 == 0 ? -1 : 1;
|
||||
}
|
||||
|
||||
this.renderOffsetY += 10;
|
||||
GL11.glPushMatrix();
|
||||
this.renderStringLines(turnInText,1F, false, false, ConfigClient.TrackingInfoAlignment%3 == 0 ? 1 : 2);
|
||||
GL11.glPopMatrix();
|
||||
float questTitleTop;
|
||||
this.renderOffsetY = -40 * overallScale;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(centerX, 0.0F, 0.0F);
|
||||
this.renderStringLines(trackedQuestLines,1.2F * overallScale, false, true, 0);
|
||||
GL11.glPopMatrix();
|
||||
questTitleTop = this.renderOffsetY;
|
||||
this.renderOffsetY -= 10 * overallScale;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(centerX, 0.0F, 0.0F);
|
||||
this.renderStringLines(categoryNameLines,0.85F * overallScale, false, false, 0);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
this.renderOffsetY = -20;
|
||||
GL11.glPushMatrix();
|
||||
this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY+2), 0xFF777777);
|
||||
this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY+1), 0xFFA8A8A8);
|
||||
this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY), 0xFFFFFFFF);
|
||||
GL11.glPopMatrix();
|
||||
this.renderOffsetY = questTitleTop + 2;
|
||||
GL11.glPushMatrix();
|
||||
this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY), 0xFFFFFFFF);
|
||||
this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY-1), 0xFFA8A8A8);
|
||||
this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY-2), 0xFF777777);
|
||||
GL11.glPopMatrix();
|
||||
this.renderOffsetY = -10 * overallScale;
|
||||
GL11.glPushMatrix();
|
||||
this.renderStringLines(objectiveLines, 1F * overallScale, true, false, ConfigClient.TrackingInfoAlignment % 3 == 0 ? 1 : (ConfigClient.TrackingInfoAlignment % 3 == 2 ? 2 : 0));
|
||||
GL11.glPopMatrix();
|
||||
|
||||
this.renderOffsetY += 10 * overallScale;
|
||||
GL11.glPushMatrix();
|
||||
this.renderStringLines(turnInText, 1F * overallScale, true, false, ConfigClient.TrackingInfoAlignment % 3 == 0 ? 1 : (ConfigClient.TrackingInfoAlignment % 3 == 2 ? 2 : 0));
|
||||
GL11.glPopMatrix();
|
||||
|
||||
this.renderOffsetY = -20 * overallScale;
|
||||
GL11.glPushMatrix();
|
||||
if(overallScale < 0.6){
|
||||
this.drawHorizontalLine((int) (centerX - (overlayWidth / 2 * overallScale)), (int) (centerX + (overlayWidth / 2 * overallScale)), (int) ((this.renderOffsetY)), 0xFFFFFFFF);
|
||||
} else if (overallScale < 0.8){
|
||||
this.drawHorizontalLine((int) (centerX - (overlayWidth / 2 * overallScale)), (int) (centerX + (overlayWidth / 2 * overallScale)), (int) ((this.renderOffsetY)), 0xFFA8A8A8);
|
||||
this.drawHorizontalLine((int) (centerX - (overlayWidth / 2 * overallScale)), (int) (centerX + (overlayWidth / 2 * overallScale)), (int) ((this.renderOffsetY + 1)), 0xFFFFFFFF);
|
||||
} else {
|
||||
this.drawHorizontalLine((int) (centerX - (overlayWidth / 2 * overallScale)), (int) (centerX + (overlayWidth / 2 * overallScale)), (int) (this.renderOffsetY), 0xFF777777);
|
||||
this.drawHorizontalLine((int) (centerX - (overlayWidth / 2 * overallScale)), (int) (centerX + (overlayWidth / 2 * overallScale)), (int) ((this.renderOffsetY + 1)), 0xFFA8A8A8);
|
||||
this.drawHorizontalLine((int) (centerX - (overlayWidth / 2 * overallScale)), (int) (centerX + (overlayWidth / 2 * overallScale)), (int) ((this.renderOffsetY + 2)), 0xFFFFFFFF);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
this.renderOffsetY = questTitleTop + 2;
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if(overallScale < 0.6){
|
||||
this.drawHorizontalLine((int) (centerX - (overlayWidth / 2 * overallScale)), (int) (centerX + (overlayWidth / 2 * overallScale)), (int) (this.renderOffsetY - 2), 0xFFFFFFFF);
|
||||
} else if (overallScale < 0.8){
|
||||
this.drawHorizontalLine((int) (centerX - (overlayWidth / 2 * overallScale)), (int) (centerX + (overlayWidth / 2 * overallScale)), (int) ((this.renderOffsetY)), 0xFFA8A8A8);
|
||||
this.drawHorizontalLine((int) (centerX - (overlayWidth / 2 * overallScale)), (int) (centerX + (overlayWidth / 2 * overallScale)), (int) (this.renderOffsetY - 1), 0xFFFFFFFF);
|
||||
} else {
|
||||
this.drawHorizontalLine((int) (centerX - (overlayWidth / 2 * overallScale)), (int) (centerX + (overlayWidth / 2 * overallScale)), (int) ((this.renderOffsetY)), 0xFF777777);
|
||||
this.drawHorizontalLine((int) (centerX - (overlayWidth / 2 * overallScale)), (int) (centerX + (overlayWidth / 2 * overallScale)), (int) ((this.renderOffsetY -1)), 0xFFA8A8A8);
|
||||
this.drawHorizontalLine((int) (centerX - (overlayWidth / 2 * overallScale)), (int) (centerX + (overlayWidth / 2 * overallScale)), (int) (this.renderOffsetY - 2), 0xFFFFFFFF);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -251,6 +280,8 @@ public class OverlayQuestTracking extends Gui {
|
||||
stringWidth = this.fontRenderer.getStringWidth(s.replace("&a&o&m",""));
|
||||
}
|
||||
|
||||
float overallScale = (float) ConfigClient.TrackingScale / 100;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
switch (facing) {
|
||||
case 0://center
|
||||
@@ -270,7 +301,7 @@ public class OverlayQuestTracking extends Gui {
|
||||
GL11.glTranslatef(0.2F, 0.2F, 0.0F);
|
||||
this.drawString(s, 0, 0, this.color, false);
|
||||
}
|
||||
this.renderOffsetY += downwards ? 10 : -10;
|
||||
this.renderOffsetY += (downwards ? 10 : -10) * overallScale;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,19 +4,17 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.global.GuiNPCQuestSelection;
|
||||
import noppes.npcs.client.gui.player.GuiMailmanWrite;
|
||||
import noppes.npcs.client.gui.select.GuiQuestSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.containers.ContainerMail;
|
||||
import noppes.npcs.controllers.data.PlayerMail;
|
||||
|
||||
public class SubGuiMailmanSendSetup extends SubGuiInterface implements ITextfieldListener, GuiSelectionListener{
|
||||
|
||||
|
||||
private PlayerMail mail;
|
||||
private GuiNPCQuestSelection questSelection;
|
||||
|
||||
|
||||
public SubGuiMailmanSendSetup(PlayerMail mail, GuiScreen parent){
|
||||
this.parent = parent;
|
||||
xSize = 256;
|
||||
@@ -40,10 +38,10 @@ public class SubGuiMailmanSendSetup extends SubGuiInterface implements ITextfiel
|
||||
title = "gui.select";
|
||||
addButton(new GuiNpcButton(3, guiLeft + 70, guiTop + 130, 100, 20, title));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 171, guiTop + 130, 20, 20, "X"));
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(0, guiLeft + 26, guiTop + 190, 100, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 130, guiTop + 190, 100, 20, "gui.cancel"));
|
||||
|
||||
|
||||
if(player.openContainer instanceof ContainerMail){
|
||||
ContainerMail container = (ContainerMail) player.openContainer;
|
||||
mail.items = container.mail.items;
|
||||
@@ -68,9 +66,7 @@ public class SubGuiMailmanSendSetup extends SubGuiInterface implements ITextfiel
|
||||
Client.sendData(EnumPacketServer.MailOpenSetup, mail.writeNBT());
|
||||
}
|
||||
if(id == 3){
|
||||
questSelection = new GuiNPCQuestSelection(npc, getParent(), mail.questId);
|
||||
questSelection.listener = this;
|
||||
NoppesUtil.openGUI(player, questSelection);
|
||||
setSubGui(new GuiQuestSelection(mail.questId));
|
||||
}
|
||||
if(id == 4){
|
||||
mail.questId = -1;
|
||||
@@ -81,13 +77,13 @@ public class SubGuiMailmanSendSetup extends SubGuiInterface implements ITextfiel
|
||||
|
||||
@Override
|
||||
public void selected(int ob, String name) {
|
||||
mail.questId = ob;
|
||||
mail.questTitle = questSelection.getSelected();
|
||||
mail.questId = ob;
|
||||
mail.questTitle = name;
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,7 @@ package noppes.npcs.client.gui;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.select.GuiDialogSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumAvailabilityDialog;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
@@ -13,7 +13,7 @@ import noppes.npcs.controllers.data.Dialog;
|
||||
public class SubGuiNpcAvailabilityDialog extends SubGuiInterface implements GuiSelectionListener, IGuiData{
|
||||
private Availability availabitily;
|
||||
private int slot = 0;
|
||||
|
||||
|
||||
public SubGuiNpcAvailabilityDialog(Availability availabitily){
|
||||
this.availabitily = availabitily;
|
||||
setBackground("menubg.png");
|
||||
@@ -51,10 +51,10 @@ public class SubGuiNpcAvailabilityDialog extends SubGuiInterface implements GuiS
|
||||
this.addButton(new GuiNpcButton(13, guiLeft + 56, y, 172, 20, "availability.selectdialog"));
|
||||
getButton(13).setEnabled(availabitily.dialog4Available != EnumAvailabilityDialog.Always);
|
||||
this.addButton(new GuiNpcButton(23, guiLeft + 230, y,20, 20, "X"));
|
||||
|
||||
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192,98, 20, "gui.done"));
|
||||
|
||||
|
||||
updateGuiButtons();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class SubGuiNpcAvailabilityDialog extends SubGuiInterface implements GuiS
|
||||
getButton(11).setDisplayText("availability.selectdialog");
|
||||
getButton(12).setDisplayText("availability.selectdialog");
|
||||
getButton(13).setDisplayText("availability.selectdialog");
|
||||
|
||||
|
||||
if(availabitily.dialogId >= 0){
|
||||
Client.sendData(EnumPacketServer.DialogGet, availabitily.dialogId);
|
||||
}
|
||||
@@ -109,27 +109,19 @@ public class SubGuiNpcAvailabilityDialog extends SubGuiInterface implements GuiS
|
||||
}
|
||||
if(button.id == 10){
|
||||
slot = 1;
|
||||
GuiNPCDialogSelection gui = new GuiNPCDialogSelection(npc, getParent(), availabitily.dialogId);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
setSubGui(new GuiDialogSelection(availabitily.questId));
|
||||
}
|
||||
if(button.id == 11){
|
||||
slot = 2;
|
||||
GuiNPCDialogSelection gui = new GuiNPCDialogSelection(npc, getParent(), availabitily.dialog2Id);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
setSubGui(new GuiDialogSelection(availabitily.quest2Id));
|
||||
}
|
||||
if(button.id == 12){
|
||||
slot = 3;
|
||||
GuiNPCDialogSelection gui = new GuiNPCDialogSelection(npc, getParent(), availabitily.dialog3Id);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
setSubGui(new GuiDialogSelection(availabitily.quest3Id));
|
||||
}
|
||||
if(button.id == 13){
|
||||
slot = 4;
|
||||
GuiNPCDialogSelection gui = new GuiNPCDialogSelection(npc, getParent(), availabitily.dialog4Id);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
setSubGui(new GuiDialogSelection(availabitily.quest4Id));
|
||||
}
|
||||
if(button.id == 20){
|
||||
availabitily.dialogId = -1;
|
||||
@@ -147,7 +139,6 @@ public class SubGuiNpcAvailabilityDialog extends SubGuiInterface implements GuiS
|
||||
availabitily.dialog4Id = -1;
|
||||
getButton(13).setDisplayText("availability.selectdialog");
|
||||
}
|
||||
|
||||
if(button.id == 66){
|
||||
close();
|
||||
}
|
||||
@@ -163,7 +154,8 @@ public class SubGuiNpcAvailabilityDialog extends SubGuiInterface implements GuiS
|
||||
availabitily.dialog3Id = id;
|
||||
if(slot == 4)
|
||||
availabitily.dialog4Id = id;
|
||||
}
|
||||
updateGuiButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
@@ -178,5 +170,4 @@ public class SubGuiNpcAvailabilityDialog extends SubGuiInterface implements GuiS
|
||||
if(availabitily.dialog4Id == dialog.id)
|
||||
getButton(13).setDisplayText(dialog.title);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,8 +3,8 @@ package noppes.npcs.client.gui;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.global.GuiNPCQuestSelection;
|
||||
|
||||
import noppes.npcs.client.gui.select.GuiQuestSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumAvailabilityQuest;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
@@ -14,7 +14,7 @@ import noppes.npcs.controllers.data.Quest;
|
||||
public class SubGuiNpcAvailabilityQuest extends SubGuiInterface implements GuiSelectionListener, IGuiData {
|
||||
private Availability availabitily;
|
||||
private int slot = 0;
|
||||
|
||||
|
||||
public SubGuiNpcAvailabilityQuest(Availability availabitily){
|
||||
this.availabitily = availabitily;
|
||||
setBackground("menubg.png");
|
||||
@@ -29,7 +29,7 @@ public class SubGuiNpcAvailabilityQuest extends SubGuiInterface implements GuiSe
|
||||
addLabel(new GuiNpcLabel(1,"availability.available", guiLeft, guiTop + 4));
|
||||
getLabel(1).center(xSize);
|
||||
|
||||
int y = guiTop + 12;
|
||||
int y = guiTop + 12;
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive"},availabitily.questAvailable.ordinal()));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 96, y, 192, 20, "availability.selectquest"));
|
||||
getButton(10).setEnabled(availabitily.questAvailable != EnumAvailabilityQuest.Always);
|
||||
@@ -52,10 +52,10 @@ public class SubGuiNpcAvailabilityQuest extends SubGuiInterface implements GuiSe
|
||||
this.addButton(new GuiNpcButton(13, guiLeft + 96, y, 192, 20, "availability.selectquest"));
|
||||
getButton(13).setEnabled(availabitily.quest4Available != EnumAvailabilityQuest.Always);
|
||||
this.addButton(new GuiNpcButton(23, guiLeft + 290, y, 20, 20, "X"));
|
||||
|
||||
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192,98, 20, "gui.done"));
|
||||
|
||||
|
||||
updateGuiButtons();
|
||||
}
|
||||
|
||||
@@ -110,27 +110,19 @@ public class SubGuiNpcAvailabilityQuest extends SubGuiInterface implements GuiSe
|
||||
}
|
||||
if(button.id == 10){
|
||||
slot = 1;
|
||||
GuiNPCQuestSelection gui = new GuiNPCQuestSelection(npc, getParent(), availabitily.questId);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
setSubGui(new GuiQuestSelection(availabitily.questId));
|
||||
}
|
||||
if(button.id == 11){
|
||||
slot = 2;
|
||||
GuiNPCQuestSelection gui = new GuiNPCQuestSelection(npc, getParent(), availabitily.quest2Id);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
setSubGui(new GuiQuestSelection(availabitily.quest2Id));
|
||||
}
|
||||
if(button.id == 12){
|
||||
slot = 3;
|
||||
GuiNPCQuestSelection gui = new GuiNPCQuestSelection(npc, getParent(), availabitily.quest3Id);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
setSubGui(new GuiQuestSelection(availabitily.quest3Id));
|
||||
}
|
||||
if(button.id == 13){
|
||||
slot = 4;
|
||||
GuiNPCQuestSelection gui = new GuiNPCQuestSelection(npc, getParent(), availabitily.quest4Id);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
setSubGui(new GuiQuestSelection(availabitily.quest4Id));
|
||||
}
|
||||
|
||||
if(button.id == 20){
|
||||
@@ -165,6 +157,7 @@ public class SubGuiNpcAvailabilityQuest extends SubGuiInterface implements GuiSe
|
||||
availabitily.quest3Id = id;
|
||||
if(slot == 4)
|
||||
availabitily.quest4Id = id;
|
||||
updateGuiButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -179,7 +172,7 @@ public class SubGuiNpcAvailabilityQuest extends SubGuiInterface implements GuiSe
|
||||
getButton(12).setDisplayText(quest.title);
|
||||
if(availabitily.quest4Id == quest.id)
|
||||
getButton(13).setDisplayText(quest.title);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import noppes.npcs.client.gui.util.*;
|
||||
public class SubGuiNpcCommand extends SubGuiInterface implements ITextfieldListener
|
||||
{
|
||||
public String command;
|
||||
|
||||
|
||||
public SubGuiNpcCommand(String command)
|
||||
{
|
||||
this.command = command;
|
||||
@@ -19,17 +19,18 @@ public class SubGuiNpcCommand extends SubGuiInterface implements ITextfieldListe
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
this.addTextField(new GuiNpcTextField(4, this, this.fontRendererObj, guiLeft + 4, guiTop + 84, 248, 20, command));
|
||||
this.addLabel(new GuiNpcLabel(4, "advMode.command", guiLeft + 4, guiTop + 74));
|
||||
this.addTextField(new GuiNpcTextField(4, this, this.fontRendererObj, guiLeft + 4, guiTop + 84, 248, 20, command));
|
||||
this.getTextField(4).setMaxStringLength(32767);
|
||||
|
||||
this.addLabel(new GuiNpcLabel(4, "advMode.command", guiLeft + 4, guiTop + 110));
|
||||
this.addLabel(new GuiNpcLabel(5, "advMode.nearestPlayer", guiLeft + 4, guiTop + 125));
|
||||
this.addLabel(new GuiNpcLabel(6, "advMode.randomPlayer", guiLeft + 4, guiTop + 140));
|
||||
this.addLabel(new GuiNpcLabel(7, "advMode.allPlayers", guiLeft + 4, guiTop + 155));
|
||||
this.addLabel(new GuiNpcLabel(8, "dialog.commandoptionplayer", guiLeft + 4, guiTop + 170));
|
||||
this.addLabel(new GuiNpcLabel(5, "advMode.nearestPlayer", guiLeft + 4, guiTop + 110));
|
||||
this.addLabel(new GuiNpcLabel(6, "advMode.randomPlayer", guiLeft + 4, guiTop + 125));
|
||||
this.addLabel(new GuiNpcLabel(7, "advMode.allPlayers", guiLeft + 4, guiTop + 140));
|
||||
this.addLabel(new GuiNpcLabel(8, "dialog.commandoptionplayer", guiLeft + 4, guiTop + 155));
|
||||
this.addLabel(new GuiNpcLabel(9, "dialog.commandmultiple", guiLeft + 4, guiTop + 170));
|
||||
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190,98, 20, "gui.done"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
|
||||
@@ -1,24 +1,30 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageDialogs;
|
||||
import noppes.npcs.client.gui.global.GuiNPCQuestSelection;
|
||||
import noppes.npcs.client.gui.player.GuiDialogInteract;
|
||||
import noppes.npcs.client.gui.select.GuiQuestSelection;
|
||||
import noppes.npcs.client.gui.select.GuiSoundSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
import noppes.npcs.controllers.data.PlayerMail;
|
||||
import noppes.npcs.entity.EntityDialogNpc;
|
||||
|
||||
public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener, GuiSelectionListener,ITextfieldListener
|
||||
{
|
||||
|
||||
public int dialogCategoryID;
|
||||
public Dialog dialog;
|
||||
private final GuiNPCManageDialogs parent;
|
||||
private GuiNPCQuestSelection questSelection;
|
||||
|
||||
public SubGuiNpcDialog(GuiNPCManageDialogs parent, Dialog dialog, int catId)
|
||||
{
|
||||
@@ -72,6 +78,7 @@ public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener,
|
||||
addLabel(new GuiNpcLabel(15, "dialog.disableEsc", guiLeft + 180, guiTop + 154 + 5));
|
||||
|
||||
addButton(new GuiNpcButton(16, guiLeft + 303, guiTop + 192, 50, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(17, guiLeft + 303 - 55, guiTop + 192, 50, 20, "gui.test"));
|
||||
|
||||
if(!parent.dialogQuestName.equals(""))
|
||||
getButton(7).setDisplayText(parent.dialogQuestName);
|
||||
@@ -96,9 +103,7 @@ public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener,
|
||||
setSubGui(new SubGuiNpcDialogOptions(dialog));
|
||||
}
|
||||
if(id == 7 && dialog.id >= 0){
|
||||
questSelection = new GuiNPCQuestSelection(npc, getParent(), dialog.quest);
|
||||
questSelection.listener = this;
|
||||
NoppesUtil.openGUI(player, questSelection);
|
||||
setSubGui(new GuiQuestSelection(dialog.quest));
|
||||
}
|
||||
if(id == 8 && dialog.id >= 0){
|
||||
dialog.quest = -1;
|
||||
@@ -129,6 +134,13 @@ public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener,
|
||||
if(id == 16){
|
||||
close();
|
||||
}
|
||||
if(id == 17){
|
||||
EntityDialogNpc npc = new EntityDialogNpc(player.worldObj);
|
||||
npc.display.name = "TEST";
|
||||
EntityUtil.Copy(player, npc);
|
||||
GuiDialogInteract gui = new GuiDialogInteract(getParent(), npc, dialog);
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,6 +176,13 @@ public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener,
|
||||
else if(subgui instanceof SubGuiNpcCommand){
|
||||
dialog.command = ((SubGuiNpcCommand) subgui).command;
|
||||
}
|
||||
else if(subgui instanceof GuiQuestSelection){
|
||||
GuiQuestSelection gqs = (GuiQuestSelection) subgui;
|
||||
if(gqs.selectedQuest != null) {
|
||||
dialog.quest = gqs.selectedQuest.id;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
else if(subgui instanceof SubGuiMailmanSendSetup){
|
||||
initGui();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.select.GuiDialogSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumOptionType;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
@@ -13,7 +14,7 @@ import noppes.npcs.controllers.data.DialogOption;
|
||||
public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData, ITextfieldListener, GuiSelectionListener, ISubGuiListener{
|
||||
private DialogOption option;
|
||||
public static int LastColor = 0xe0e0e0;
|
||||
|
||||
|
||||
public SubGuiNpcDialogOption(DialogOption option){
|
||||
this.option = option;
|
||||
setBackground("menubg.png");
|
||||
@@ -27,17 +28,17 @@ public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData,
|
||||
super.initGui();
|
||||
this.addLabel(new GuiNpcLabel(66, "dialog.editoption", guiLeft, guiTop + 4));
|
||||
this.getLabel(66).center(xSize);
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(0, "gui.title", guiLeft + 4, guiTop + 20));
|
||||
this.addTextField(new GuiNpcTextField(0, this, this.fontRendererObj, guiLeft + 40, guiTop + 15, 196, 20, option.title));
|
||||
|
||||
|
||||
String color = Integer.toHexString(option.optionColor);
|
||||
while(color.length() < 6)
|
||||
color = 0 + color;
|
||||
addLabel(new GuiNpcLabel(2, "gui.color", guiLeft + 4, guiTop + 45));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 62, guiTop + 40, 92, 20, color));
|
||||
this.getButton(2).setTextColor(option.optionColor);
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(1, "dialog.optiontype", guiLeft + 4, guiTop + 67));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 62, guiTop + 62, 92, 20, new String[]{"gui.close","dialog.dialog","gui.disabled","menu.role","tile.commandBlock.name"},option.optionType.ordinal()));
|
||||
|
||||
@@ -50,15 +51,15 @@ public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData,
|
||||
this.addTextField(new GuiNpcTextField(4, this, this.fontRendererObj, guiLeft + 4, guiTop + 84, 248, 20, option.command));
|
||||
this.getTextField(4).setMaxStringLength(32767);
|
||||
|
||||
this.addLabel(new GuiNpcLabel(4, "advMode.command", guiLeft + 4, guiTop + 110));
|
||||
this.addLabel(new GuiNpcLabel(5, "advMode.nearestPlayer", guiLeft + 4, guiTop + 125));
|
||||
this.addLabel(new GuiNpcLabel(6, "advMode.randomPlayer", guiLeft + 4, guiTop + 140));
|
||||
this.addLabel(new GuiNpcLabel(7, "advMode.allPlayers", guiLeft + 4, guiTop + 155));
|
||||
this.addLabel(new GuiNpcLabel(8, "dialog.commandoptionplayer", guiLeft + 4, guiTop + 170));
|
||||
this.addLabel(new GuiNpcLabel(5, "advMode.nearestPlayer", guiLeft + 4, guiTop + 110));
|
||||
this.addLabel(new GuiNpcLabel(6, "advMode.randomPlayer", guiLeft + 4, guiTop + 125));
|
||||
this.addLabel(new GuiNpcLabel(7, "advMode.allPlayers", guiLeft + 4, guiTop + 140));
|
||||
this.addLabel(new GuiNpcLabel(8, "dialog.commandoptionplayer", guiLeft + 4, guiTop + 155));
|
||||
this.addLabel(new GuiNpcLabel(9, "dialog.commandmultiple", guiLeft + 4, guiTop + 170));
|
||||
}
|
||||
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190,98, 20, "gui.done"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,9 +74,7 @@ public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData,
|
||||
this.setSubGui(new SubGuiColorSelector(option.optionColor));
|
||||
}
|
||||
if(button.id == 3){
|
||||
GuiNPCDialogSelection gui = new GuiNPCDialogSelection(npc, getParent(), option.dialogId);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
setSubGui(new GuiDialogSelection(option.dialogId));
|
||||
}
|
||||
if(button.id == 66)
|
||||
{
|
||||
@@ -115,8 +114,16 @@ public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData,
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
LastColor = option.optionColor = ((SubGuiColorSelector)subgui).color;
|
||||
initGui();
|
||||
if(subgui instanceof SubGuiColorSelector) {
|
||||
LastColor = option.optionColor = ((SubGuiColorSelector)subgui).color;
|
||||
}
|
||||
if(subgui instanceof GuiDialogSelection) {
|
||||
Dialog dialog = ((GuiDialogSelection)subgui).selectedDialog;
|
||||
if(dialog != null) {
|
||||
option.dialogId = dialog.id;
|
||||
}
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,12 +3,11 @@ package noppes.npcs.client.gui;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageQuest;
|
||||
import noppes.npcs.client.gui.global.GuiNPCQuestSelection;
|
||||
import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeDialog;
|
||||
import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeKill;
|
||||
import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeLocation;
|
||||
import noppes.npcs.client.gui.select.GuiQuestSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.*;
|
||||
import noppes.npcs.controllers.data.PlayerMail;
|
||||
@@ -21,7 +20,6 @@ public class SubGuiNpcQuest extends SubGuiInterface implements ISubGuiListener,
|
||||
public Quest quest;
|
||||
private final GuiNPCManageQuest parent;
|
||||
private boolean questlogTA = false;
|
||||
private GuiNPCQuestSelection questSelection;
|
||||
|
||||
public SubGuiNpcQuest(GuiNPCManageQuest parent, Quest quest, int catId)
|
||||
{
|
||||
@@ -52,8 +50,6 @@ public class SubGuiNpcQuest extends SubGuiInterface implements ISubGuiListener,
|
||||
addLabel(new GuiNpcLabel(5, "quest.reward", guiLeft + 7, guiTop + 81));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 120, guiTop + 76, 50, 20, "selectServer.edit"));
|
||||
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(10, "faction.options", guiLeft + 180, guiTop + 33));
|
||||
addButton(new GuiNpcButton(10, guiLeft + 303, guiTop + 28, 50, 20, "selectServer.edit"));
|
||||
|
||||
@@ -155,9 +151,10 @@ public class SubGuiNpcQuest extends SubGuiInterface implements ISubGuiListener,
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 15 && quest.id >= 0){
|
||||
questSelection = new GuiNPCQuestSelection(npc, getParent(), quest.nextQuestid);
|
||||
questSelection.listener = this;
|
||||
NoppesUtil.openGUI(player, questSelection);
|
||||
setSubGui(new GuiQuestSelection(quest.nextQuestid));
|
||||
// questSelection = new GuiNPCQuestSelection(npc, getParent(), quest.nextQuestid);
|
||||
// questSelection.listener = this;
|
||||
// NoppesUtil.openGUI(player, questSelection);
|
||||
}
|
||||
if(button.id == 18)
|
||||
{
|
||||
@@ -206,7 +203,7 @@ public class SubGuiNpcQuest extends SubGuiInterface implements ISubGuiListener,
|
||||
SubGuiNpcCommand sub = (SubGuiNpcCommand) subgui;
|
||||
quest.command = sub.command;
|
||||
}
|
||||
else if(subgui instanceof SubGuiMailmanSendSetup){
|
||||
else {
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,16 +5,18 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.GuiNPCDialogSelection;
|
||||
import noppes.npcs.client.gui.SubGuiColorSelector;
|
||||
import noppes.npcs.client.gui.select.GuiDialogSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelectionListener,IGuiData{
|
||||
public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelectionListener, IGuiData{
|
||||
private GuiScreen parent;
|
||||
private HashMap<Integer, DialogOption> data = new HashMap<Integer,DialogOption>();
|
||||
|
||||
@@ -31,7 +33,7 @@ public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelec
|
||||
int offset = i >=6 ?200:0;
|
||||
this.addButton(new GuiNpcButton(i + 20, guiLeft + 20 + offset, guiTop + 13 + i % 6 * 22, 20, 20, "X"));
|
||||
this.addLabel(new GuiNpcLabel(i, "" + i, guiLeft + 6 + offset, guiTop + 18 + i % 6 * 22));
|
||||
|
||||
|
||||
String title = "dialog.selectoption";
|
||||
if(data.containsKey(i))
|
||||
title = data.get(i).title;
|
||||
@@ -46,17 +48,12 @@ public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelec
|
||||
private int selectedSlot;
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
|
||||
if (id == 1) {
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
if (id >= 0 && id < 20) {
|
||||
close();
|
||||
selectedSlot = id;
|
||||
int dialogID = -1;
|
||||
if(data.containsKey(id))
|
||||
dialogID = data.get(id).dialogId;
|
||||
NoppesUtil.openGUI(player, new GuiNPCDialogSelection(npc, this, dialogID));
|
||||
setSubGui(new GuiDialogSelection(dialogID));
|
||||
}
|
||||
if (id >= 20 && id < 40) {
|
||||
int slot = id - 20;
|
||||
@@ -79,12 +76,11 @@ public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelec
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
int pos = compound.getInteger("Position");
|
||||
|
||||
|
||||
DialogOption dialog = new DialogOption();
|
||||
dialog.readNBT(compound);
|
||||
|
||||
|
||||
data.put(pos, dialog);
|
||||
initGui();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,11 @@ package noppes.npcs.client.gui.custom.components;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.gui.IItemSlot;
|
||||
import noppes.npcs.containers.ContainerCustomGui;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
|
||||
public class CustomGuiSlot extends Slot {
|
||||
public boolean clientSide;
|
||||
@@ -23,4 +27,26 @@ public class CustomGuiSlot extends Slot {
|
||||
this.slot = slot;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotChanged() {
|
||||
if(!player.worldObj.isRemote){
|
||||
boolean changed;
|
||||
if (getStack() != null && slot.getStack() != null) {
|
||||
changed = !getStack().equals(slot.getStack().getMCItemStack());
|
||||
} else {
|
||||
// Handle the case when either getStack() or slot.getStack() is null (indicating an empty slot)
|
||||
changed = getStack() != null || slot.getStack() != null;
|
||||
}
|
||||
if(changed) {
|
||||
slot.setStack(NpcAPI.Instance().getIItemStack(getStack()));
|
||||
if (player.openContainer instanceof ContainerCustomGui) {
|
||||
EventHooks.onCustomGuiSlot((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui)player.openContainer).customGui,
|
||||
getSlotIndex(), getStack(), slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onSlotChanged();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -89,10 +89,10 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.setColorRGBA_F(red, green, blue, alpha);
|
||||
tessellator.addVertexWithUV(u2 * totalWidth, v2 * totalHeight, 0, u2, v2);
|
||||
tessellator.addVertexWithUV(u2 * totalWidth, v1 * totalHeight, 0, u2, v1);
|
||||
tessellator.addVertexWithUV(u1 * totalWidth, v1 * totalHeight, 0, u1, v1);
|
||||
tessellator.addVertexWithUV(u1 * totalWidth, v2 * totalHeight, 0, u1, v2);
|
||||
tessellator.addVertexWithUV(0, height, 0, u1, v2);
|
||||
tessellator.addVertexWithUV(width, height, 0, u2, v2);
|
||||
tessellator.addVertexWithUV(width, 0, 0, u2, v1);
|
||||
tessellator.addVertexWithUV(0, 0, 0, u1, v1);
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -187,7 +187,6 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
if(category != null && category.id >= 0){
|
||||
// Add Dialog
|
||||
if(id == 1){
|
||||
saveType(true);
|
||||
String name = "New";
|
||||
while(dialogData.containsKey(name))
|
||||
name += "_";
|
||||
@@ -201,7 +200,6 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
}
|
||||
// Remove Dialog
|
||||
if(id == 2) {
|
||||
saveType(true);
|
||||
if (dialogData.containsKey(dialogScroll.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.DialogRemove, dialog.id, true);
|
||||
dialog = new Dialog();
|
||||
@@ -210,14 +208,12 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
}
|
||||
// Edit Dialog
|
||||
if(id == 0) {
|
||||
saveType(true);
|
||||
if (dialogData.containsKey(dialogScroll.getSelected()) && dialog != null && dialog.id >= 0) {
|
||||
setSubGui(new SubGuiNpcDialog(this, dialog, category.id));
|
||||
}
|
||||
}
|
||||
// Clone Dialog
|
||||
if(id == 3) {
|
||||
saveType(true);
|
||||
if (dialogData.containsKey(dialogScroll.getSelected()) && dialog != null && dialog.id >= 0) {
|
||||
String name = dialog.title;
|
||||
while(dialogData.containsKey(name))
|
||||
|
||||
@@ -191,7 +191,6 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
if(category != null && category.id >= 0){
|
||||
// Add Quest
|
||||
if(id == 1){
|
||||
saveType(true);
|
||||
String name = "New";
|
||||
while(questData.containsKey(name))
|
||||
name += "_";
|
||||
@@ -205,7 +204,6 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
}
|
||||
// Remove Quest
|
||||
if(id == 2) {
|
||||
saveType(true);
|
||||
if (questData.containsKey(questScroll.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.QuestRemove, quest.id, true);
|
||||
quest = new Quest();
|
||||
@@ -214,14 +212,12 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
|
||||
}
|
||||
// Edit Quest
|
||||
if(id == 0) {
|
||||
saveType(true);
|
||||
if (questData.containsKey(questScroll.getSelected()) && quest != null && quest.id >= 0) {
|
||||
setSubGui(new SubGuiNpcQuest(this, quest, category.id));
|
||||
}
|
||||
}
|
||||
// Clone Quest
|
||||
if(id == 3) {
|
||||
saveType(true);
|
||||
if (questData.containsKey(questScroll.getSelected()) && quest != null && quest.id >= 0) {
|
||||
String name = quest.title;
|
||||
while(questData.containsKey(name))
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNPCQuestSelection extends GuiNPCInterface implements IScrollData
|
||||
{
|
||||
private GuiNPCStringSlot slot;
|
||||
private GuiScreen parent;
|
||||
private HashMap<String,Integer> data = new HashMap<String,Integer>();
|
||||
private int quest;
|
||||
private boolean selectCategory = true;
|
||||
public GuiSelectionListener listener;
|
||||
|
||||
|
||||
public GuiNPCQuestSelection(EntityNPCInterface npc, GuiScreen parent, int quest)
|
||||
{
|
||||
super(npc);
|
||||
drawDefaultBackground = false;
|
||||
title = "Select Quest Category";
|
||||
this.parent = parent;
|
||||
this.quest = quest;
|
||||
|
||||
if(quest >= 0){
|
||||
Client.sendData(EnumPacketServer.QuestsGetFromQuest, quest);
|
||||
selectCategory = false;
|
||||
title = "Select Quest";
|
||||
}else
|
||||
Client.sendData(EnumPacketServer.QuestCategoriesGet, quest);
|
||||
|
||||
if(parent instanceof GuiSelectionListener)
|
||||
listener = (GuiSelectionListener) parent;
|
||||
}
|
||||
|
||||
public String getSelected(){
|
||||
return slot.selected;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
Vector<String> list = new Vector<String>();
|
||||
|
||||
slot = new GuiNPCStringSlot(list,this,false,18);
|
||||
slot.registerScrollButtons(4, 5);
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 -100, height - 41,98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 41,98, 20, "gui.select"));
|
||||
}
|
||||
|
||||
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
slot.drawScreen(i, j, f);
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 2)
|
||||
{
|
||||
if(selectCategory){
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}else{
|
||||
title = "Select Quest Category";
|
||||
selectCategory = true;
|
||||
Client.sendData(EnumPacketServer.QuestCategoriesGet, quest);
|
||||
}
|
||||
}
|
||||
if(id == 4)
|
||||
{
|
||||
doubleClicked();
|
||||
}
|
||||
}
|
||||
|
||||
public void doubleClicked() {
|
||||
if(slot.selected == null || slot.selected.isEmpty())
|
||||
return;
|
||||
if(selectCategory){
|
||||
selectCategory = false;
|
||||
title = "Select Quest";
|
||||
Client.sendData(EnumPacketServer.QuestsGet, data.get(slot.selected));
|
||||
}
|
||||
else{
|
||||
quest = data.get(slot.selected);
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
if(quest >= 0){
|
||||
if(listener != null){
|
||||
listener.selected(quest, slot.selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data) {
|
||||
this.data = data;
|
||||
this.slot.setList(list);
|
||||
if(quest >= 0)
|
||||
for(String name : data.keySet())
|
||||
if(data.get(name) == quest)
|
||||
slot.selected = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -80,6 +80,10 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
||||
getTextField(4).integersOnly = true;
|
||||
getTextField(4).setMinMaxDefault(1, 100, 5);
|
||||
}
|
||||
else if (ai.combatPolicy == EnumCombatPolicy.Tactical)
|
||||
{
|
||||
addButton(new GuiNpcButton(40, guiLeft + 295, guiTop + 160, 60, 20, new String[]{"stats.normal","stats.reverse"}, npc.ai.tacticalChance > 50 ? 1:0));
|
||||
}
|
||||
|
||||
getButton(17).setEnabled(this.ai.onAttack == 0);
|
||||
getButton(15).setEnabled(this.ai.onAttack == 0);
|
||||
@@ -156,6 +160,15 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
||||
ai.combatPolicy = EnumCombatPolicy.values()[button.getValue()];
|
||||
initGui();
|
||||
}
|
||||
else if (button.id == 40) {
|
||||
int val = button.getValue();
|
||||
if(val == 0){
|
||||
ai.tacticalChance = 0;
|
||||
} else {
|
||||
ai.tacticalChance = 100;
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@ import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.*;
|
||||
import noppes.npcs.client.gui.model.GuiCreationScreen;
|
||||
import noppes.npcs.client.gui.select.GuiTextureSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
@@ -153,7 +154,7 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
initGui();
|
||||
}
|
||||
else if(button.id == 3){
|
||||
NoppesUtil.openGUI(player, new GuiNPCTextures(npc, this));
|
||||
setSubGui(new GuiTextureSelection(npc, npc.display.getSkinTexture()));
|
||||
}
|
||||
else if(button.id == 5){
|
||||
display.disableLivingAnimation = button.getValue() == 1;
|
||||
@@ -197,6 +198,12 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
GeckoAddonClient.Instance.geckoNpcDisplayActionPerformed(this, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeSubGui(SubGuiInterface subgui) {
|
||||
super.closeSubGui(subgui);
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
if(display.skinType == 1)
|
||||
|
||||
@@ -3,6 +3,7 @@ package noppes.npcs.client.gui.player;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
@@ -18,7 +19,10 @@ import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.TextBlockClient;
|
||||
import noppes.npcs.client.controllers.MusicController;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiSelectionListener;
|
||||
import noppes.npcs.client.gui.util.IGuiClose;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumOptionType;
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
@@ -36,6 +40,7 @@ import java.util.List;
|
||||
|
||||
public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
{
|
||||
private GuiScreen parent;
|
||||
private Dialog dialog;
|
||||
private int selected = 0;
|
||||
private List<TextBlockClient> lineBlocks = new ArrayList<TextBlockClient>();
|
||||
@@ -54,9 +59,6 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
private int instantLinePos = 0;
|
||||
private int prevPausePos = -1;
|
||||
|
||||
private static int textSpeed = 10;
|
||||
private static boolean textSoundEnabled = true;
|
||||
|
||||
private int scrollY;
|
||||
private ResourceLocation wheel;
|
||||
private ResourceLocation[] wheelparts;
|
||||
@@ -81,6 +83,11 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
getResource("wheel4.png"),getResource("wheel5.png"),getResource("wheel6.png")};
|
||||
}
|
||||
|
||||
public GuiDialogInteract(GuiScreen parent, EntityNPCInterface npc, Dialog dialog){
|
||||
this(npc, dialog);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
isGrabbed = false;
|
||||
@@ -169,11 +176,6 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, 0.5f, 100.065F);
|
||||
if (dialog.renderGradual) {
|
||||
drawString(fontRendererObj, "Text Speed: " + textSpeed, 10, 10, 0xFFFFFF);
|
||||
drawString(fontRendererObj, "Text Sound: " + (textSoundEnabled ? "On" : "Off"), 10, 20, 0xFFFFFF);
|
||||
}
|
||||
|
||||
for (IDialogImage dialogImage : dialog.dialogImages.values()) {
|
||||
if (dialogImage.getImageType() != 0)
|
||||
continue;
|
||||
@@ -189,7 +191,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
GL11.glTranslatef(image.x,image.y,0.0f);
|
||||
GL11.glTranslatef(image.alignment%3*((float)(scaledResolution.getScaledWidth())/2), (float) (Math.floor((float)(image.alignment/3))*((float)(scaledResolution.getScaledHeight())/2)),0.0F);
|
||||
image.onRender(mc);
|
||||
|
||||
@@ -214,7 +216,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
GL11.glTranslatef(image.x,image.y,0.0f);
|
||||
GL11.glTranslatef(guiLeft + dialog.textOffsetX, optionStart + dialog.textOffsetY - image.height * image.scale, 0.0F);
|
||||
image.onRender(mc);
|
||||
|
||||
@@ -309,8 +311,8 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
try {
|
||||
if (textPauseTime > 0) {
|
||||
textPauseTime--;
|
||||
} else if (textSpeed > 10 || gradualTextTime%(11 - textSpeed) == 0) {
|
||||
int addChar = textSpeed > 10 ? textSpeed - 9 : 1;
|
||||
} else if (ConfigClient.DialogSpeed > 10 || gradualTextTime%(11 - ConfigClient.DialogSpeed) == 0) {
|
||||
int addChar = ConfigClient.DialogSpeed > 10 ? ConfigClient.DialogSpeed - 9 : 1;
|
||||
String addText = line.getFormattedText().substring(gradualText.length(), gradualText.length() + addChar);
|
||||
|
||||
if (addText.matches("^(\\{(\\d+)})(.*)")) {
|
||||
@@ -345,10 +347,12 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
}
|
||||
|
||||
gradualText += addText;
|
||||
if (textSoundTime % 5 == 0) {
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation(dialog.textSound), dialog.textPitch));
|
||||
}
|
||||
textSoundTime++;
|
||||
if(ConfigClient.DialogSound){
|
||||
if (textSoundTime % 5 == 0) {
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation(dialog.textSound), dialog.textPitch));
|
||||
}
|
||||
textSoundTime++;
|
||||
}
|
||||
}
|
||||
} catch (IndexOutOfBoundsException exception) {
|
||||
gradualText = line.getFormattedText();
|
||||
@@ -486,6 +490,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
|
||||
GL11.glTranslatef(guiLeft - 30 + dialog.optionSpaceX * k, y, 0.0F);
|
||||
image.color = selected == k ? image.selectedColor : image.color;
|
||||
GL11.glTranslatef(image.x,image.y,0.0f);
|
||||
image.onRender(mc);
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -572,20 +577,6 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
}
|
||||
}
|
||||
|
||||
if(i == mc.gameSettings.keyBindForward.getKeyCode() || i == Keyboard.KEY_LEFT){
|
||||
textSpeed--;
|
||||
if (textSpeed < 1) {
|
||||
textSpeed = 1;
|
||||
}
|
||||
}
|
||||
if(i == mc.gameSettings.keyBindBack.getKeyCode() || i == Keyboard.KEY_RIGHT){
|
||||
textSpeed++;
|
||||
}
|
||||
|
||||
if(i == mc.gameSettings.keyBindJump.getKeyCode() || i == Keyboard.KEY_SPACE){
|
||||
textSoundEnabled = !textSoundEnabled;
|
||||
}
|
||||
|
||||
if (dialog.alignment == 1 && totalRows * ClientProxy.Font.height() > dialog.textHeight) {
|
||||
if ((i == mc.gameSettings.keyBindBack.getKeyCode() || i == 201) && scrollY < totalRows * ClientProxy.Font.height()) {//Page up
|
||||
scrollY += ClientProxy.Font.height() * 2;
|
||||
@@ -703,6 +694,13 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(){
|
||||
super.close();
|
||||
if(parent != null)
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClose(int i, NBTTagCompound data) {
|
||||
grabMouse(false);
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package noppes.npcs.client.gui.player.inventory;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.client.gui.util.GuiButtonNextPage;
|
||||
import noppes.npcs.client.gui.util.GuiMenuSideButton;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
@@ -11,9 +14,10 @@ import tconstruct.client.tabs.InventoryTabCustomNpc;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
|
||||
public class GuiCNPCInventory extends GuiNPCInterface {
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
|
||||
public static final ResourceLocation specialIcons = new ResourceLocation("customnpcs","textures/gui/icons.png");
|
||||
|
||||
public static int activeTab = 0;
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
protected Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
public GuiCNPCInventory() {
|
||||
super();
|
||||
@@ -26,25 +30,64 @@ public class GuiCNPCInventory extends GuiNPCInterface {
|
||||
super.initGui();
|
||||
guiTop +=10;
|
||||
|
||||
GuiMenuSideButton questsButton = new GuiMenuSideButton(100, guiLeft + xSize + 37, this.guiTop + 3, 22, 22, "");
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
|
||||
|
||||
int y = 3;
|
||||
GuiMenuSideButton questsButton = new GuiMenuSideButton(100, guiLeft + xSize + 37, this.guiTop + y, 22, 22, "");
|
||||
questsButton.rightSided = true;
|
||||
questsButton.active = activeTab == 0;
|
||||
questsButton.renderStack = new ItemStack(CustomItems.letter);
|
||||
questsButton.renderIconPosX = 32;
|
||||
questsButton.renderResource = specialIcons;
|
||||
addButton(questsButton);
|
||||
|
||||
GuiMenuSideButton partyButton = new GuiMenuSideButton(101, guiLeft + xSize + 37, this.guiTop + 3 + 21, 22, 22, "");
|
||||
y += 21;
|
||||
GuiMenuSideButton partyButton = new GuiMenuSideButton(101, guiLeft + xSize + 37, this.guiTop + y, 22, 22, "");
|
||||
partyButton.rightSided = true;
|
||||
partyButton.active = activeTab == 1;
|
||||
partyButton.renderStack = new ItemStack(CustomItems.bag);
|
||||
partyButton.renderResource = specialIcons;
|
||||
addButton(partyButton);
|
||||
|
||||
if(ConfigClient.enableFactionTab){
|
||||
GuiMenuSideButton factionButton = new GuiMenuSideButton(102, guiLeft + xSize + 37, this.guiTop + 3 + 21*2, 22, 22, "");
|
||||
y += 21;
|
||||
GuiMenuSideButton factionButton = new GuiMenuSideButton(102, guiLeft + xSize + 37, this.guiTop + y, 22, 22, "");
|
||||
factionButton.rightSided = true;
|
||||
factionButton.active = activeTab == 2;
|
||||
factionButton.renderStack = new ItemStack(CustomItems.wallBanner);
|
||||
factionButton.renderIconPosX = 48;
|
||||
factionButton.renderResource = specialIcons;
|
||||
addButton(factionButton);
|
||||
}
|
||||
|
||||
y += 21;
|
||||
GuiMenuSideButton clientButton = new GuiMenuSideButton(103, guiLeft + xSize + 37, this.guiTop + y, 22, 22, "");
|
||||
clientButton.rightSided = true;
|
||||
clientButton.active = activeTab == 3;
|
||||
clientButton.renderIconPosX = 16;
|
||||
clientButton.renderResource = specialIcons;
|
||||
addButton(clientButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
if (guibutton.id >= 100) {
|
||||
if (guibutton.id == 100 && activeTab != 0) {
|
||||
activeTab = 0;
|
||||
mc.displayGuiScreen(new GuiQuestLog());
|
||||
}
|
||||
if (guibutton.id == 101 && activeTab != 1) {
|
||||
activeTab = 1;
|
||||
mc.displayGuiScreen(new GuiParty());
|
||||
}
|
||||
if (guibutton.id == 102 && activeTab != 2) {
|
||||
activeTab = 2;
|
||||
mc.displayGuiScreen(new GuiFaction());
|
||||
}
|
||||
if (guibutton.id == 103 && activeTab != 3) {
|
||||
activeTab = 3;
|
||||
mc.displayGuiScreen(new GuiSettings());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,22 +9,21 @@ import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.gui.util.GuiButtonNextPage;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.IGuiData;
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
import noppes.npcs.controllers.data.PlayerFactionData;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.client.tabs.InventoryTabCustomNpc;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
import tconstruct.client.tabs.AbstractTab;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
public class GuiFaction extends GuiCNPCInventory implements IGuiData {
|
||||
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
|
||||
|
||||
private ArrayList<Faction> playerFactions = new ArrayList<Faction>();
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private int page = 0;
|
||||
private int pages = 1;
|
||||
@@ -45,8 +44,6 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
|
||||
this.buttonList.add(buttonNextPage = new GuiButtonNextPage(1, (guiLeft + (xSize + 35) / 2) + 25, guiTop + 170, true));
|
||||
this.buttonList.add(buttonPreviousPage = new GuiButtonNextPage(2, (guiLeft + (xSize + 35) / 2) - 40, guiTop + 170, false));
|
||||
@@ -133,21 +130,13 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
if (guibutton.id >= 100) {
|
||||
if (guibutton.id == 100 && activeTab != 0) {
|
||||
activeTab = 0;
|
||||
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
|
||||
}
|
||||
if (guibutton.id == 101 && activeTab != 1) {
|
||||
activeTab = 1;
|
||||
mc.displayGuiScreen(new GuiParty(mc.thePlayer));
|
||||
}
|
||||
if (guibutton.id == 102 && activeTab != 2) {
|
||||
activeTab = 2;
|
||||
mc.displayGuiScreen(new GuiFaction());
|
||||
}
|
||||
}
|
||||
if(guibutton instanceof AbstractTab)
|
||||
return;
|
||||
|
||||
if (guibutton.id >= 100 && guibutton.id <= 105) {
|
||||
super.actionPerformed(guibutton);
|
||||
return;
|
||||
}
|
||||
if(!(guibutton instanceof GuiButtonNextPage))
|
||||
return;
|
||||
int id = guibutton.id;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package noppes.npcs.client.gui.player.inventory;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
@@ -9,24 +8,24 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.QuestLogData;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.TextBlockClient;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.controllers.data.Party;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.client.tabs.InventoryTabCustomNpc;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
import tconstruct.client.tabs.AbstractTab;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, ITopButtonListener,ICustomScrollListener, IPartyData, GuiYesNoCallback {
|
||||
public class GuiParty extends GuiCNPCInventory implements ITextfieldListener,ICustomScrollListener, IPartyData, GuiYesNoCallback {
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
|
||||
private final EntityPlayer player;
|
||||
private final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private boolean receivedData;
|
||||
private long renderTicks;
|
||||
@@ -42,20 +41,22 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
private boolean showQuestText;
|
||||
private final Vector<String> questLogStatus = new Vector<>();
|
||||
private String questCompleteWith;
|
||||
private String trackedQuestKey;
|
||||
private String originalTracked = "";
|
||||
private QuestLogData data = new QuestLogData();
|
||||
|
||||
public GuiParty(EntityPlayer player) {
|
||||
public GuiParty() {
|
||||
super();
|
||||
this.player = player;
|
||||
this.player = mc.thePlayer;
|
||||
xSize = 280;
|
||||
ySize = 180;
|
||||
drawDefaultBackground = false;
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.TrackedQuest);
|
||||
Client.sendData(EnumPacketServer.GetPartyData);
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
|
||||
this.selectedInvite = this.selectedPlayer = null;
|
||||
Party party = ClientCacheHandler.party;
|
||||
@@ -173,10 +174,12 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
}
|
||||
|
||||
if (party.getIsLocked()){
|
||||
GuiNpcButton trackButton = new GuiNpcButton(340, guiLeft + 5, guiTop + ySize - 8 - 23, "party.track");
|
||||
GuiNpcButton trackButton = new GuiNpcButton(415, guiLeft + 5, guiTop + ySize - 8 - 23, new String[]{"party.track", "quest.tracking"}, data.trackedQuestKey.equals("P" + ":" + trackedQuestKey) ? 1 : 0);
|
||||
trackButton.width = 135;
|
||||
this.addButton(trackButton);
|
||||
getButton(340).enabled = false;
|
||||
if (trackButton.enabled && trackButton.getValue() == 1) {
|
||||
trackButton.packedFGColour = 0x32CD32;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,7 +218,14 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
if(guibutton instanceof AbstractTab)
|
||||
return;
|
||||
|
||||
Party party = ClientCacheHandler.party;
|
||||
if (guibutton.id >= 100 && guibutton.id <= 105) {
|
||||
super.actionPerformed(guibutton);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (guibutton.id) {
|
||||
case 200:
|
||||
@@ -278,24 +288,19 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
break;
|
||||
case 410:
|
||||
if (this.isLeader) {
|
||||
GuiYesNo yesnoDisband = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("party.disbandConfirm"), 4);
|
||||
GuiYesNo yesnoDisband = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("party.dropQuestConfirm"), 4);
|
||||
displayGuiScreen(yesnoDisband);
|
||||
}
|
||||
break;
|
||||
case 415:
|
||||
if (!data.trackedQuestKey.equals("P" + ":" + trackedQuestKey)) {
|
||||
data.trackedQuestKey = "P" + ":" + trackedQuestKey;
|
||||
} else {
|
||||
data.trackedQuestKey = "";
|
||||
}
|
||||
break;
|
||||
}
|
||||
initGui();
|
||||
if (guibutton.id == 100 && activeTab != 0) {
|
||||
activeTab = 0;
|
||||
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
|
||||
}
|
||||
if (guibutton.id == 101 && activeTab != 1) {
|
||||
activeTab = 1;
|
||||
mc.displayGuiScreen(new GuiParty(mc.thePlayer));
|
||||
}
|
||||
if (guibutton.id == 102 && activeTab != 2) {
|
||||
activeTab = 2;
|
||||
mc.displayGuiScreen(new GuiFaction());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -374,18 +379,18 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPartyData(NBTTagCompound compound) {
|
||||
this.receivedData = true;
|
||||
if (compound.hasKey("TrackedQuestID")) {
|
||||
this.originalTracked = compound.getString("TrackedQuestID");
|
||||
data.trackedQuestKey = this.originalTracked;
|
||||
}
|
||||
|
||||
if (compound.hasKey("QuestPing")) {
|
||||
this.questLogStatus.clear();
|
||||
this.questCompleteWith = "";
|
||||
this.trackedQuestKey = "";
|
||||
if (compound.hasKey("QuestProgress")) {
|
||||
NBTTagList tagList = compound.getTagList("QuestProgress", 8);
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
@@ -395,10 +400,14 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
if (compound.hasKey("QuestCompleteWith")) {
|
||||
this.questCompleteWith = compound.getString("QuestCompleteWith");
|
||||
}
|
||||
if (compound.hasKey("QuestName")) {
|
||||
this.trackedQuestKey = compound.getString("QuestName");
|
||||
}
|
||||
} else {
|
||||
ClientCacheHandler.party = null;
|
||||
}
|
||||
|
||||
|
||||
if (compound.hasKey("PartyUUID")) {
|
||||
UUID uuid = UUID.fromString(compound.getString("PartyUUID"));
|
||||
ClientCacheHandler.party = new Party(uuid);
|
||||
@@ -406,6 +415,7 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
party.readFromNBT(compound);
|
||||
this.questLogStatus.clear();
|
||||
this.questCompleteWith = "";
|
||||
this.trackedQuestKey = "";
|
||||
if (compound.hasKey("QuestProgress")) {
|
||||
NBTTagList tagList = compound.getTagList("QuestProgress", 8);
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
@@ -415,7 +425,11 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
if (compound.hasKey("QuestCompleteWith")) {
|
||||
this.questCompleteWith = compound.getString("QuestCompleteWith");
|
||||
}
|
||||
if (compound.hasKey("QuestName")) {
|
||||
this.trackedQuestKey = compound.getString("QuestName");
|
||||
}
|
||||
this.isLeader = ClientCacheHandler.party.getPartyLeaderName().equals(this.player.getCommandSenderName());
|
||||
System.out.println("KEY:" + trackedQuestKey);
|
||||
} else if (compound.hasKey("Disband")) {
|
||||
this.isLeader = false;
|
||||
} else if (compound.hasKey("PartyInvites")) {
|
||||
@@ -444,6 +458,9 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
if(ClientCacheHandler.party != null)
|
||||
Client.sendData(EnumPacketServer.SavePartyData, ClientCacheHandler.party.writeClientNBT());
|
||||
}
|
||||
if (!Objects.equals(this.originalTracked, data.trackedQuestKey)) {
|
||||
Client.sendData(EnumPacketServer.PartyLogToServer, this.data.trackedQuestKey);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,46 +18,43 @@ import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.controllers.data.Party;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.client.tabs.AbstractTab;
|
||||
import tconstruct.client.tabs.InventoryTabCustomNpc;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,ICustomScrollListener, IGuiData, IPartyData, GuiYesNoCallback {
|
||||
public class GuiQuestLog extends GuiCNPCInventory implements ICustomScrollListener, IGuiData, IPartyData, GuiYesNoCallback {
|
||||
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
|
||||
|
||||
private EntityPlayer player;
|
||||
private GuiCustomScroll scroll;
|
||||
private HashMap<Integer,GuiMenuSideButton> sideButtons = new HashMap<Integer,GuiMenuSideButton>();
|
||||
private HashMap<Integer,GuiNpcButton> otherButtons = new HashMap<Integer,GuiNpcButton>();
|
||||
private QuestLogData data = new QuestLogData();
|
||||
private boolean noQuests = false;
|
||||
private byte questPages = 1;
|
||||
private static long lastClicked = System.currentTimeMillis();
|
||||
private boolean isPartySet = false;
|
||||
|
||||
private HashMap<String,String> questAlertsOnOpen;
|
||||
private String trackedQuestKeyOnOpen;
|
||||
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private float sideButtonScroll = 0;
|
||||
private float destSideButtonScroll = 0;
|
||||
|
||||
public GuiQuestLog(EntityPlayer player) {
|
||||
public GuiQuestLog() {
|
||||
super();
|
||||
this.player = player;
|
||||
this.player = mc.thePlayer;
|
||||
xSize = 280;
|
||||
ySize = 180;
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.QuestLog);
|
||||
drawDefaultBackground = false;
|
||||
}
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.QuestLog);
|
||||
}
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
sideButtons.clear();
|
||||
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
sideButtons.clear();
|
||||
|
||||
noQuests = false;
|
||||
|
||||
@@ -101,10 +98,11 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
showTrackAlerts = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
String partyQuestName = ClientCacheHandler.party != null ? ClientCacheHandler.party.getCurrentQuestName() : null;
|
||||
isPartySet = Objects.equals(partyQuestName, data.selectedQuest);
|
||||
if (showParty) {
|
||||
// Objectives Forward--
|
||||
addButton(new GuiButtonNextPage(11, guiLeft + 286, guiTop + 176, true));
|
||||
@@ -112,13 +110,12 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
// Party Back--
|
||||
addButton(new GuiButtonNextPage(10, guiLeft + 144, guiTop + 176, false));
|
||||
|
||||
String questName = ClientCacheHandler.party != null ? ClientCacheHandler.party.getCurrentQuestName() : null;
|
||||
GuiNpcButton partyButton = new GuiNpcButton(3, guiLeft + 150, guiTop + 151, 50, 20, new String[]{"party.party", "party.partying"}, Objects.equals(questName, data.selectedQuest) ? 1 : 0);
|
||||
GuiNpcButton partyButton = new GuiNpcButton(3, guiLeft + 150, guiTop + 151, 50, 20, new String[]{"party.party", "party.partying"}, isPartySet ? 1 : 0);
|
||||
addButton(partyButton);
|
||||
|
||||
partyButton.enabled = ClientCacheHandler.party != null && data.hasSelectedQuest()
|
||||
&& ClientCacheHandler.party.getPartyLeaderName().equals(this.player.getCommandSenderName());
|
||||
if (partyButton.enabled && Objects.equals(questName, data.selectedQuest)) {
|
||||
if (partyButton.enabled && isPartySet) {
|
||||
partyButton.packedFGColour = 0x32CD32;
|
||||
}
|
||||
|
||||
@@ -127,24 +124,28 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
}
|
||||
|
||||
GuiNpcButton trackingButton = new GuiNpcButton(4, guiLeft + 260, guiTop + 151, 50, 20, new String[]{"quest.track", "quest.tracking"}, data.trackedQuestKey.equals(data.selectedCategory + ":" + data.selectedQuest) ? 1 : 0);
|
||||
if (trackingButton.displayString.equals("quest.tracking")) {
|
||||
trackingButton.packedFGColour = 0x32CD32;
|
||||
}
|
||||
addButton(trackingButton);
|
||||
|
||||
GuiNpcButton alertButton = new GuiNpcButton(5, guiLeft + 205, guiTop + 151, 50, 20, new String[]{"quest.alerts", "quest.noAlerts"}, data.getQuestAlerts() ? 0 : 1);
|
||||
addButton(alertButton);
|
||||
|
||||
getButton(1).visible = questPages == 1 && data.hasSelectedQuest();
|
||||
getButton(2).visible = questPages == 2 && data.hasSelectedQuest();
|
||||
getButton(4).visible = !data.selectedQuest.isEmpty() && getButton(1).visible;
|
||||
getButton(5).visible = getButton(4).visible;
|
||||
if (getButton(3) != null) {
|
||||
getButton(3).visible = getButton(4).visible;
|
||||
if(getButton(1) != null)
|
||||
getButton(1).visible = questPages == 1 && data.hasSelectedQuest();
|
||||
if(getButton(2) != null)
|
||||
getButton(2).visible = questPages == 2 && data.hasSelectedQuest();
|
||||
if (getButton(3) != null)
|
||||
getButton(3).visible = !data.selectedQuest.isEmpty() && getButton(1).visible;
|
||||
if(getButton(4) != null){
|
||||
getButton(4).visible = !data.selectedQuest.isEmpty() && getButton(1).visible;
|
||||
getButton(4).enabled = showTrackAlerts && !isPartySet;
|
||||
}
|
||||
if(getButton(5) != null){
|
||||
getButton(5).visible = getButton(4).visible;
|
||||
getButton(5).enabled = showTrackAlerts && !isPartySet;
|
||||
}
|
||||
|
||||
getButton(4).enabled = showTrackAlerts;
|
||||
getButton(5).enabled = showTrackAlerts;
|
||||
if (trackingButton.enabled && trackingButton.getValue() == 1) {
|
||||
trackingButton.packedFGColour = 0x32CD32;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,10 +165,17 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
if(lastClicked > System.currentTimeMillis() - 10){
|
||||
if(guibutton instanceof AbstractTab)
|
||||
return;
|
||||
|
||||
if (guibutton.id >= 100 && guibutton.id <= 105) {
|
||||
super.actionPerformed(guibutton);
|
||||
return;
|
||||
}
|
||||
|
||||
if(lastClicked > System.currentTimeMillis() - 5){
|
||||
return;
|
||||
}
|
||||
if(guibutton.id == 11){
|
||||
questPages = 1;
|
||||
lastClicked = System.currentTimeMillis();
|
||||
@@ -175,13 +183,13 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
else if(guibutton.id == 10){
|
||||
questPages = 0;
|
||||
}
|
||||
else if(guibutton.id == 1){
|
||||
questPages = 2;
|
||||
}
|
||||
else if(guibutton.id == 2){
|
||||
questPages = 1;
|
||||
else if(guibutton.id == 1){
|
||||
questPages = 2;
|
||||
}
|
||||
else if(guibutton.id == 2){
|
||||
questPages = 1;
|
||||
lastClicked = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
if (guibutton.id == 3)
|
||||
{
|
||||
@@ -203,18 +211,6 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
data.toggleQuestAlerts();
|
||||
}
|
||||
initGui();
|
||||
if (guibutton.id == 100 && activeTab != 0) {
|
||||
activeTab = 0;
|
||||
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
|
||||
}
|
||||
if (guibutton.id == 101 && activeTab != 1) {
|
||||
activeTab = 1;
|
||||
mc.displayGuiScreen(new GuiParty(mc.thePlayer));
|
||||
}
|
||||
if (guibutton.id == 102 && activeTab != 2) {
|
||||
activeTab = 2;
|
||||
mc.displayGuiScreen(new GuiFaction());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f){
|
||||
@@ -378,11 +374,6 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
QuestLogData data = new QuestLogData();
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
package noppes.npcs.client.gui.player.inventory;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.client.tabs.AbstractTab;
|
||||
|
||||
public class GuiSettings extends GuiCNPCInventory implements ITextfieldListener, GuiYesNoCallback {
|
||||
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
|
||||
|
||||
public GuiSettings() {
|
||||
super();
|
||||
xSize = 280;
|
||||
ySize = 180;
|
||||
this.drawDefaultBackground = false;
|
||||
title = "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int y = 0;
|
||||
this.addLabel(new GuiNpcLabel(1, "settings.chatBubbles", guiLeft + 8, guiTop + 14 + y));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 105, guiTop + 9 + y, 50, 20, new String[]{"gui.no", "gui.yes"}, ConfigClient.EnableChatBubbles?1:0));
|
||||
|
||||
this.addLabel(new GuiNpcLabel(3, "settings.trackAlignment", guiLeft + 8 + 155, guiTop + 14 + y));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 105 + 160, guiTop + 9 + y, 50, 20, new String[]{"TLeft", "TCenter", "TRight", "Left", "Center", "Right", "BLeft", "BCenter", "BRight"}, ConfigClient.TrackingInfoAlignment));
|
||||
|
||||
y += 22;
|
||||
this.addLabel(new GuiNpcLabel(2, "settings.dialogSound", guiLeft + 8, guiTop + 14 + y));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 105, guiTop + 9 + y, 50, 20, new String[]{"gui.no", "gui.yes"}, ConfigClient.DialogSound?1:0));
|
||||
|
||||
this.addLabel(new GuiNpcLabel(12,"settings.alignmentX", guiLeft + 8 + 155, guiTop + 14 + y));
|
||||
this.addTextField(new GuiNpcTextField(12, this, this.fontRendererObj, guiLeft + 107 + 160, guiTop + 9 + y, 45, 20, ConfigClient.TrackingInfoX + ""));
|
||||
getTextField(12).integersOnly = true;
|
||||
getTextField(12).setMinMaxDefault(-2000, 2000, 0);
|
||||
|
||||
y += 22;
|
||||
this.addLabel(new GuiNpcLabel(10,"settings.dialogSpeed", guiLeft + 8, guiTop + 14 + y));
|
||||
this.addTextField(new GuiNpcTextField(10, this, this.fontRendererObj, guiLeft + 107, guiTop + 9 + y, 45, 20, ConfigClient.DialogSpeed + ""));
|
||||
getTextField(10).integersOnly = true;
|
||||
getTextField(10).setMinMaxDefault(1, 20, 10);
|
||||
|
||||
this.addLabel(new GuiNpcLabel(13,"settings.alignmentY", guiLeft + 8 + 155, guiTop + 14 + y));
|
||||
this.addTextField(new GuiNpcTextField(13, this, this.fontRendererObj, guiLeft + 107 + 160, guiTop + 9 + y, 45, 20, ConfigClient.TrackingInfoY + ""));
|
||||
getTextField(13).integersOnly = true;
|
||||
getTextField(13).setMinMaxDefault(-2000, 2000, 0);
|
||||
|
||||
y += 22;
|
||||
|
||||
this.addLabel(new GuiNpcLabel(6, "settings.chatAlerts", guiLeft + 8, guiTop + 14 + y));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 105, guiTop + 9 + y, 50, 20, new String[]{"gui.no", "gui.yes"}, ConfigClient.ChatAlerts?1:0));
|
||||
|
||||
this.addLabel(new GuiNpcLabel(14,"settings.trackScale", guiLeft + 8 + 155, guiTop + 14 + y));
|
||||
this.addTextField(new GuiNpcTextField(14, this, this.fontRendererObj, guiLeft + 107 + 160, guiTop + 9 + y, 45, 20, ConfigClient.TrackingScale + ""));
|
||||
getTextField(14).integersOnly = true;
|
||||
getTextField(14).setMinMaxDefault(0, 300, 100);
|
||||
|
||||
y += 22;
|
||||
|
||||
this.addLabel(new GuiNpcLabel(7, "settings.bannerAlerts", guiLeft + 8, guiTop + 14 + y));
|
||||
this.addButton(new GuiNpcButton(7, guiLeft + 105, guiTop + 9 + y, 50, 20, new String[]{"gui.no", "gui.yes"}, ConfigClient.BannerAlerts?1:0));
|
||||
|
||||
y += 22;
|
||||
|
||||
y += 22;
|
||||
|
||||
y += 22;
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 8, guiTop + 9 + y, 150, 20, "settings.clearSkin"));
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 8 + 155, guiTop + 9 + y, 150, 20, "settings.clearTrack"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
drawDefaultBackground();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 252, 195);
|
||||
drawTexturedModalRect(guiLeft + 252, guiTop, 188, 0, 67, 195);
|
||||
super.drawScreen(i, j, f);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean flag, int i) {
|
||||
if (flag) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
// Untrack Quest
|
||||
Client.sendData(EnumPacketServer.UntrackQuest);
|
||||
break;
|
||||
case 1:
|
||||
// Clear Skin Cache
|
||||
ClientCacheHandler.clearSkinCache();
|
||||
break;
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
displayGuiScreen(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn){
|
||||
if(btn instanceof AbstractTab)
|
||||
return;
|
||||
|
||||
if (btn.id >= 100 && btn.id <= 105) {
|
||||
super.actionPerformed(btn);
|
||||
return;
|
||||
}
|
||||
if(!(btn instanceof GuiNpcButton))
|
||||
return;
|
||||
GuiNpcButton button = (GuiNpcButton) btn;
|
||||
if(button.id == 1){
|
||||
ConfigClient.EnableChatBubbles = button.getValue() == 1;
|
||||
ConfigClient.EnableChatBubblesProperty.set(ConfigClient.EnableChatBubbles);
|
||||
}
|
||||
if(button.id == 2){
|
||||
ConfigClient.DialogSound = button.getValue() == 1;
|
||||
ConfigClient.DialogSoundProperty.set(ConfigClient.DialogSound);
|
||||
}
|
||||
if(button.id == 3){
|
||||
ConfigClient.TrackingInfoAlignment = button.getValue();
|
||||
ConfigClient.TrackingInfoAlignmentProperty.set(ConfigClient.TrackingInfoAlignment);
|
||||
}
|
||||
if(button.id == 4){
|
||||
GuiYesNo yesNoTrack = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("settings.confirmClearTrack"), 0);
|
||||
displayGuiScreen(yesNoTrack);
|
||||
}
|
||||
if(button.id == 5){
|
||||
GuiYesNo yesNoSkin = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("settings.confirmClearSkin"), 1);
|
||||
displayGuiScreen(yesNoSkin);
|
||||
}
|
||||
if(button.id == 6){
|
||||
ConfigClient.ChatAlerts = button.getValue() == 1;
|
||||
ConfigClient.ChatAlertsProperty.set(ConfigClient.ChatAlerts);
|
||||
}
|
||||
if(button.id == 7){
|
||||
ConfigClient.BannerAlerts = button.getValue() == 1;
|
||||
ConfigClient.BannerAlertsProperty.set(ConfigClient.BannerAlerts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
if (i == 1 || isInventoryKey(i))
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {}
|
||||
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 10){
|
||||
ConfigClient.DialogSpeed = textfield.getInteger();
|
||||
ConfigClient.DialogSpeedProperty.set(ConfigClient.DialogSound);
|
||||
}
|
||||
|
||||
// Quest Tracking
|
||||
if(textfield.id == 12){
|
||||
ConfigClient.TrackingInfoX = textfield.getInteger();
|
||||
ConfigClient.TrackingInfoXProperty.set(ConfigClient.TrackingInfoX);
|
||||
}
|
||||
if(textfield.id == 13){
|
||||
ConfigClient.TrackingInfoY = textfield.getInteger();
|
||||
ConfigClient.TrackingInfoYProperty.set(ConfigClient.TrackingInfoY);
|
||||
}
|
||||
if(textfield.id == 14){
|
||||
ConfigClient.TrackingScale = textfield.getInteger();
|
||||
ConfigClient.TrackingScaleProperty.set(ConfigClient.TrackingScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.GuiNPCDialogSelection;
|
||||
import noppes.npcs.client.gui.select.GuiDialogSelection;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiSelectionListener;
|
||||
import noppes.npcs.client.gui.util.IGuiData;
|
||||
@@ -66,10 +65,7 @@ public class GuiNpcQuestTypeDialog extends SubGuiInterface implements GuiSelecti
|
||||
int id = -1;
|
||||
if(quest.dialogs.containsKey(selectedSlot))
|
||||
id = quest.dialogs.get(selectedSlot);
|
||||
|
||||
GuiNPCDialogSelection gui = new GuiNPCDialogSelection(npc, getParent(), id);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
setSubGui(new GuiDialogSelection(id));
|
||||
}
|
||||
if (button.id >= 9 && button.id < 15) {
|
||||
int slot = button.id - 9;
|
||||
|
||||
@@ -3,9 +3,8 @@ package noppes.npcs.client.gui.roles;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.SubGuiNpcAvailability;
|
||||
import noppes.npcs.client.gui.global.GuiNPCQuestSelection;
|
||||
import noppes.npcs.client.gui.select.GuiQuestSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -13,14 +12,13 @@ import noppes.npcs.roles.JobConversation;
|
||||
import noppes.npcs.roles.JobConversation.ConversationLine;
|
||||
|
||||
public class GuiNpcConversation extends GuiNPCInterface2 implements ITextfieldListener, GuiSelectionListener
|
||||
{
|
||||
{
|
||||
private JobConversation job;
|
||||
|
||||
|
||||
private int slot = -1;
|
||||
private GuiNPCQuestSelection questSelection;
|
||||
|
||||
|
||||
public GuiNpcConversation(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
super(npc);
|
||||
job = (JobConversation) npc.jobInterface;
|
||||
}
|
||||
|
||||
@@ -29,7 +27,7 @@ public class GuiNpcConversation extends GuiNPCInterface2 implements ITextfieldLi
|
||||
|
||||
addLabel(new GuiNpcLabel(40, "gui.name", guiLeft + 40, guiTop + 4));
|
||||
addLabel(new GuiNpcLabel(41, "gui.name", guiLeft + 240, guiTop + 4));
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(42, "conversation.delay", guiLeft + 164, guiTop + 4));
|
||||
addLabel(new GuiNpcLabel(43, "conversation.delay", guiLeft + 364, guiTop + 4));
|
||||
|
||||
@@ -39,7 +37,7 @@ public class GuiNpcConversation extends GuiNPCInterface2 implements ITextfieldLi
|
||||
this.addLabel(new GuiNpcLabel(i, "" + (i + 1), guiLeft + 5 + offset - (i > 8?6:0), guiTop + 18 + i % 7 * 22));
|
||||
this.addTextField(new GuiNpcTextField(i, this, this.fontRendererObj, guiLeft + 13 + offset, guiTop + 13 + i % 7 * 22, 100, 20, line.npc));
|
||||
this.addButton(new GuiNpcButton(i, guiLeft + 115 + offset, guiTop + 13 + i % 7 * 22, 46, 20, "conversation.line"));
|
||||
|
||||
|
||||
if(i > 0){
|
||||
this.addTextField(new GuiNpcTextField(i + 14, this, this.fontRendererObj, guiLeft + 164 + offset, guiTop + 13 + i % 7 * 22, 30, 20, line.delay + ""));
|
||||
this.getTextField(i + 14).integersOnly = true;
|
||||
@@ -55,7 +53,7 @@ public class GuiNpcConversation extends GuiNPCInterface2 implements ITextfieldLi
|
||||
addTextField(new GuiNpcTextField(54, this, fontRendererObj, guiLeft + 260, guiTop + 191, 40, 20, job.range + ""));
|
||||
getTextField(54).integersOnly = true;
|
||||
getTextField(54).setMinMaxDefault(4, Integer.MAX_VALUE, 20);
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(51, "quest.quest", guiLeft + 13, guiTop + 175));
|
||||
String title = job.questTitle;
|
||||
if(title.isEmpty())
|
||||
@@ -76,9 +74,9 @@ public class GuiNpcConversation extends GuiNPCInterface2 implements ITextfieldLi
|
||||
ConversationLine line = job.getLine(slot);
|
||||
setSubGui(new SubGuiNpcConversationLine(line.text, line.sound));
|
||||
}
|
||||
if(button.id == 51){
|
||||
NoppesUtil.openGUI(player, new GuiNPCQuestSelection(npc, this, job.quest));
|
||||
}
|
||||
if(button.id == 51){
|
||||
setSubGui(new GuiQuestSelection(job.quest));
|
||||
}
|
||||
if(button.id == 52){
|
||||
job.quest = -1;
|
||||
job.questTitle = "";
|
||||
@@ -93,9 +91,9 @@ public class GuiNpcConversation extends GuiNPCInterface2 implements ITextfieldLi
|
||||
}
|
||||
@Override
|
||||
public void selected(int ob, String name) {
|
||||
job.quest = ob;
|
||||
job.questTitle = questSelection.getSelected();
|
||||
initGui();
|
||||
job.quest = ob;
|
||||
job.questTitle = name;
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,7 +106,7 @@ public class GuiNpcConversation extends GuiNPCInterface2 implements ITextfieldLi
|
||||
line.sound = sub.sound;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.JobSave, job.writeToNBT(new NBTTagCompound()));
|
||||
|
||||
@@ -1,124 +1,186 @@
|
||||
//package noppes.npcs.client.gui.select;
|
||||
//
|
||||
//import com.google.common.collect.Lists;
|
||||
//import net.minecraft.client.gui.GuiButton;
|
||||
//import noppes.npcs.client.gui.util.*;
|
||||
//import noppes.npcs.controllers.DialogController;
|
||||
//import noppes.npcs.controllers.data.Dialog;
|
||||
//import noppes.npcs.controllers.data.DialogCategory;
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//
|
||||
//public class GuiDialogSelection extends SubGuiInterface implements ICustomScrollListener{
|
||||
// private HashMap<String,DialogCategory> categoryData = new HashMap<String,DialogCategory>();
|
||||
// private HashMap<String,Dialog> dialogData = new HashMap<String,Dialog>();
|
||||
//
|
||||
// private GuiCustomScroll scrollCategories;
|
||||
// private GuiCustomScroll scrollDialogs;
|
||||
//
|
||||
// private DialogCategory selectedCategory;
|
||||
// public Dialog selectedDialog;
|
||||
//
|
||||
// private GuiSelectionListener listener;
|
||||
//
|
||||
// public GuiDialogSelection(int dialog){
|
||||
// drawDefaultBackground = false;
|
||||
// title = "";
|
||||
// setBackground("menubg.png");
|
||||
// xSize = 366;
|
||||
// ySize = 226;
|
||||
// this.selectedDialog = DialogController.instance.dialogs.get(dialog);
|
||||
// if(selectedDialog != null) {
|
||||
// selectedCategory = selectedDialog.category;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void initGui(){
|
||||
// super.initGui();
|
||||
//
|
||||
// if(parent instanceof GuiSelectionListener){
|
||||
// listener = (GuiSelectionListener) parent;
|
||||
// }
|
||||
// this.addLabel(new GuiNpcLabel(0, "gui.categories", guiLeft + 8, guiTop + 4));
|
||||
// this.addLabel(new GuiNpcLabel(1, "dialog.dialogs", guiLeft + 175, guiTop + 4));
|
||||
//
|
||||
// this.addButton(new GuiNpcButton(2, guiLeft + xSize - 26, guiTop + 4, 20, 20, "X"));
|
||||
//
|
||||
// HashMap<String,DialogCategory> categoryData = new HashMap<String,DialogCategory>();
|
||||
// HashMap<String,Dialog> dialogData = new HashMap<String,Dialog>();
|
||||
//
|
||||
// for(DialogCategory category : DialogController.instance.categories.values()) {
|
||||
// categoryData.put(category.title, category);
|
||||
// }
|
||||
// this.categoryData = categoryData;
|
||||
//
|
||||
// if(selectedCategory != null) {
|
||||
// for(Dialog dialog : selectedCategory.dialogs.values()) {
|
||||
// dialogData.put(dialog.title, dialog);
|
||||
// }
|
||||
// }
|
||||
// this.dialogData = dialogData;
|
||||
//
|
||||
// if(scrollCategories == null){
|
||||
// scrollCategories = new GuiCustomScroll(this,0);
|
||||
// scrollCategories.setSize(170, 200);
|
||||
// }
|
||||
// scrollCategories.setList(Lists.newArrayList(categoryData.keySet()));
|
||||
// if(selectedCategory != null) {
|
||||
// scrollCategories.setSelected(selectedCategory.title);
|
||||
// }
|
||||
//
|
||||
// scrollCategories.guiLeft = guiLeft + 4;
|
||||
// scrollCategories.guiTop = guiTop + 14;
|
||||
// this.addScroll(scrollCategories);
|
||||
//
|
||||
// if(scrollDialogs == null){
|
||||
// scrollDialogs = new GuiCustomScroll(this,1);
|
||||
// scrollDialogs.setSize(170, 200);
|
||||
// }
|
||||
// scrollDialogs.setList(Lists.newArrayList(dialogData.keySet()));
|
||||
// if(selectedDialog != null) {
|
||||
// scrollDialogs.setSelected(selectedDialog.title);
|
||||
// }
|
||||
// scrollDialogs.guiLeft = guiLeft + 175;
|
||||
// scrollDialogs.guiTop = guiTop + 14;
|
||||
// this.addScroll(scrollDialogs);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void scrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
// if(guiCustomScroll.id == 0){
|
||||
// selectedCategory = categoryData.get(scrollCategories.getSelected());
|
||||
// selectedDialog = null;
|
||||
// scrollDialogs.selected = -1;
|
||||
// }
|
||||
// if(guiCustomScroll.id == 1){
|
||||
// selectedDialog = dialogData.get(scrollDialogs.getSelected());
|
||||
// }
|
||||
// initGui();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void scrollDoubleClicked(String selection, GuiCustomScroll scroll) {
|
||||
// if(selectedDialog == null)
|
||||
// return;
|
||||
// if(listener != null) {
|
||||
// listener.selected(selectedDialog.id, selectedDialog.title);
|
||||
// }
|
||||
// close();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void actionPerformed(GuiButton guibutton){
|
||||
// int id = guibutton.id;
|
||||
// if(id == 2){
|
||||
// if(selectedDialog != null) {
|
||||
// scrollDoubleClicked(null, null);
|
||||
// }
|
||||
// else {
|
||||
// close();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
package noppes.npcs.client.gui.select;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogCategory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiDialogSelection extends SubGuiInterface implements ICustomScrollListener {
|
||||
private HashMap<String,DialogCategory> categoryData = new HashMap<String,DialogCategory>();
|
||||
private HashMap<String,Dialog> dialogData = new HashMap<String,Dialog>();
|
||||
|
||||
private GuiCustomScroll scrollCategories;
|
||||
private GuiCustomScroll scrollDialogs;
|
||||
|
||||
private DialogCategory selectedCategory;
|
||||
public Dialog selectedDialog;
|
||||
|
||||
private GuiSelectionListener listener;
|
||||
private String catSearch = "";
|
||||
private String dialogSearch = "";
|
||||
|
||||
public GuiDialogSelection(int dialog){
|
||||
drawDefaultBackground = false;
|
||||
title = "";
|
||||
setBackground("menubg.png");
|
||||
xSize = 366;
|
||||
ySize = 226;
|
||||
this.selectedDialog = DialogController.Instance.dialogs.get(dialog);
|
||||
if(selectedDialog != null) {
|
||||
selectedCategory = selectedDialog.category;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
||||
if(parent instanceof GuiSelectionListener){
|
||||
listener = (GuiSelectionListener) parent;
|
||||
}
|
||||
this.addLabel(new GuiNpcLabel(0, "gui.categories", guiLeft + 8, guiTop + 4));
|
||||
this.addLabel(new GuiNpcLabel(1, "dialog.dialogs", guiLeft + 184, guiTop + 4));
|
||||
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + xSize - 56, guiTop + ySize - 35, 50, 20, "gui.done"));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + xSize - 108, guiTop + ySize - 35, 50, 20, "gui.cancel"));
|
||||
|
||||
HashMap<String,DialogCategory> categoryData = new HashMap<String,DialogCategory>();
|
||||
HashMap<String,Dialog> dialogData = new HashMap<String,Dialog>();
|
||||
|
||||
for(DialogCategory category : DialogController.Instance.categories.values()) {
|
||||
categoryData.put(category.title, category);
|
||||
}
|
||||
this.categoryData = categoryData;
|
||||
|
||||
if(selectedCategory != null) {
|
||||
for(Dialog dialog : selectedCategory.dialogs.values()) {
|
||||
dialogData.put(dialog.title, dialog);
|
||||
}
|
||||
}
|
||||
this.dialogData = dialogData;
|
||||
|
||||
if(scrollCategories == null){
|
||||
scrollCategories = new GuiCustomScroll(this,0, 0);
|
||||
scrollCategories.setSize(177, 153);
|
||||
}
|
||||
scrollCategories.setList(getCatSearch());
|
||||
if(selectedCategory != null) {
|
||||
scrollCategories.setSelected(selectedCategory.title);
|
||||
}
|
||||
scrollCategories.guiLeft = guiLeft + 4;
|
||||
scrollCategories.guiTop = guiTop + 14;
|
||||
this.addScroll(scrollCategories);
|
||||
addTextField(new GuiNpcTextField(33, this, fontRendererObj, guiLeft + 4, guiTop + 169, 177, 20, catSearch));
|
||||
|
||||
if(scrollDialogs == null){
|
||||
scrollDialogs = new GuiCustomScroll(this,1,0);
|
||||
scrollDialogs.setSize(177, 153);
|
||||
}
|
||||
scrollDialogs.setList(getDialogSearch());
|
||||
if(selectedDialog != null) {
|
||||
scrollDialogs.setSelected(selectedDialog.title);
|
||||
}
|
||||
scrollDialogs.guiLeft = guiLeft + 182;
|
||||
scrollDialogs.guiTop = guiTop + 14;
|
||||
this.addScroll(scrollDialogs);
|
||||
addTextField(new GuiNpcTextField(44, this, fontRendererObj, guiLeft + 182, guiTop + 169, 177, 20, dialogSearch));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
if(getTextField(33) != null){
|
||||
if(getTextField(33).isFocused()){
|
||||
if(catSearch.equals(getTextField(33).getText()))
|
||||
return;
|
||||
catSearch = getTextField(33).getText().toLowerCase();
|
||||
scrollCategories.setList(getCatSearch());
|
||||
}
|
||||
}
|
||||
if(getTextField(44) != null){
|
||||
if(getTextField(44).isFocused()){
|
||||
if(dialogSearch.equals(getTextField(44).getText()))
|
||||
return;
|
||||
dialogSearch = getTextField(44).getText().toLowerCase();
|
||||
scrollDialogs.setList(getDialogSearch());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getCatSearch(){
|
||||
if(catSearch.isEmpty()){
|
||||
return Lists.newArrayList(categoryData.keySet());
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : Lists.newArrayList(categoryData.keySet())){
|
||||
if(name.toLowerCase().contains(catSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<String> getDialogSearch(){
|
||||
if(selectedCategory == null){
|
||||
return Lists.newArrayList(dialogData.keySet());
|
||||
}
|
||||
|
||||
if(dialogSearch.isEmpty()){
|
||||
return new ArrayList<String>(Lists.newArrayList(dialogData.keySet()));
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : Lists.newArrayList(dialogData.keySet())){
|
||||
if(name.toLowerCase().contains(dialogSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0){
|
||||
selectedCategory = categoryData.get(scrollCategories.getSelected());
|
||||
selectedDialog = null;
|
||||
scrollDialogs.selected = -1;
|
||||
scrollDialogs.resetScroll();
|
||||
getTextField(44).setText("");
|
||||
dialogSearch = "";
|
||||
}
|
||||
if(guiCustomScroll.id == 1){
|
||||
selectedDialog = dialogData.get(scrollDialogs.getSelected());
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollDoubleClicked(String selection, GuiCustomScroll scroll) {
|
||||
if(selectedDialog == null)
|
||||
return;
|
||||
if(listener != null) {
|
||||
listener.selected(selectedDialog.id, selectedDialog.title);
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
int id = guibutton.id;
|
||||
if(id == 2){
|
||||
if(selectedDialog != null) {
|
||||
customScrollDoubleClicked(null, null);
|
||||
}
|
||||
else {
|
||||
close();
|
||||
}
|
||||
}
|
||||
if(id == 3){
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,124 +1,186 @@
|
||||
//package noppes.npcs.client.gui.select;
|
||||
//
|
||||
//import com.google.common.collect.Lists;
|
||||
//import net.minecraft.client.gui.GuiButton;
|
||||
//import noppes.npcs.client.gui.util.*;
|
||||
//import noppes.npcs.controllers.QuestController;
|
||||
//import noppes.npcs.controllers.data.Quest;
|
||||
//import noppes.npcs.controllers.data.QuestCategory;
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//
|
||||
//public class GuiQuestSelection extends SubGuiInterface implements ICustomScrollListener{
|
||||
// private HashMap<String,QuestCategory> categoryData = new HashMap<String,QuestCategory>();
|
||||
// private HashMap<String,Quest> questData = new HashMap<String,Quest>();
|
||||
//
|
||||
// private GuiCustomScroll scrollCategories;
|
||||
// private GuiCustomScroll scrollQuests;
|
||||
//
|
||||
// private QuestCategory selectedCategory;
|
||||
// public Quest selectedQuest;
|
||||
//
|
||||
// private GuiSelectionListener listener;
|
||||
//
|
||||
// public GuiQuestSelection(int quest){
|
||||
// drawDefaultBackground = false;
|
||||
// title = "";
|
||||
// setBackground("menubg.png");
|
||||
// xSize = 366;
|
||||
// ySize = 226;
|
||||
// this.selectedQuest = QuestController.instance.quests.get(quest);
|
||||
// if(selectedQuest != null) {
|
||||
// selectedCategory = selectedQuest.category;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void initGui(){
|
||||
// super.initGui();
|
||||
//
|
||||
// if(parent instanceof GuiSelectionListener){
|
||||
// listener = (GuiSelectionListener) parent;
|
||||
// }
|
||||
// this.addLabel(new GuiNpcLabel(0, "gui.categories", guiLeft + 8, guiTop + 4));
|
||||
// this.addLabel(new GuiNpcLabel(1, "quest.quests", guiLeft + 175, guiTop + 4));
|
||||
//
|
||||
// this.addButton(new GuiNpcButton(2, guiLeft + xSize - 26, guiTop + 4, 20, 20, "X"));
|
||||
//
|
||||
// HashMap<String,QuestCategory> categoryData = new HashMap<String,QuestCategory>();
|
||||
// HashMap<String,Quest> questData = new HashMap<String,Quest>();
|
||||
//
|
||||
// for(QuestCategory category : QuestController.instance.categories.values()) {
|
||||
// categoryData.put(category.title, category);
|
||||
// }
|
||||
// this.categoryData = categoryData;
|
||||
//
|
||||
// if(selectedCategory != null) {
|
||||
// for(Quest quest : selectedCategory.quests.values()) {
|
||||
// questData.put(quest.title, quest);
|
||||
// }
|
||||
// }
|
||||
// this.questData = questData;
|
||||
//
|
||||
// if(scrollCategories == null){
|
||||
// scrollCategories = new GuiCustomScroll(this,0);
|
||||
// scrollCategories.setSize(170, 200);
|
||||
// }
|
||||
// scrollCategories.setList(Lists.newArrayList(categoryData.keySet()));
|
||||
// if(selectedCategory != null) {
|
||||
// scrollCategories.setSelected(selectedCategory.title);
|
||||
// }
|
||||
//
|
||||
// scrollCategories.guiLeft = guiLeft + 4;
|
||||
// scrollCategories.guiTop = guiTop + 14;
|
||||
// this.addScroll(scrollCategories);
|
||||
//
|
||||
// if(scrollQuests == null){
|
||||
// scrollQuests = new GuiCustomScroll(this,1);
|
||||
// scrollQuests.setSize(170, 200);
|
||||
// }
|
||||
// scrollQuests.setList(Lists.newArrayList(questData.keySet()));
|
||||
// if(selectedQuest != null) {
|
||||
// scrollQuests.setSelected(selectedQuest.title);
|
||||
// }
|
||||
// scrollQuests.guiLeft = guiLeft + 175;
|
||||
// scrollQuests.guiTop = guiTop + 14;
|
||||
// this.addScroll(scrollQuests);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void scrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
// if(guiCustomScroll.id == 0){
|
||||
// selectedCategory = categoryData.get(scrollCategories.getSelected());
|
||||
// selectedQuest = null;
|
||||
// scrollQuests.selected = -1;
|
||||
// }
|
||||
// if(guiCustomScroll.id == 1){
|
||||
// selectedQuest = questData.get(scrollQuests.getSelected());
|
||||
// }
|
||||
// initGui();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void scrollDoubleClicked(String selection, GuiCustomScroll scroll) {
|
||||
// if(selectedQuest == null)
|
||||
// return;
|
||||
// if(listener != null) {
|
||||
// listener.selected(selectedQuest.id, selectedQuest.title);
|
||||
// }
|
||||
// close();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void actionPerformed(GuiButton guibutton){
|
||||
// int id = guibutton.id;
|
||||
// if(id == 2){
|
||||
// if(selectedQuest != null) {
|
||||
// scrollDoubleClicked(null, null);
|
||||
// }
|
||||
// else {
|
||||
// close();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
package noppes.npcs.client.gui.select;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.QuestCategory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiQuestSelection extends SubGuiInterface implements ICustomScrollListener {
|
||||
private HashMap<String,QuestCategory> categoryData = new HashMap<String,QuestCategory>();
|
||||
private HashMap<String,Quest> questData = new HashMap<String,Quest>();
|
||||
|
||||
private GuiCustomScroll scrollCategories;
|
||||
private GuiCustomScroll scrollQuests;
|
||||
|
||||
private QuestCategory selectedCategory;
|
||||
public Quest selectedQuest;
|
||||
|
||||
private GuiSelectionListener listener;
|
||||
private String catSearch = "";
|
||||
private String questSearch = "";
|
||||
|
||||
public GuiQuestSelection(int quest){
|
||||
drawDefaultBackground = false;
|
||||
title = "";
|
||||
setBackground("menubg.png");
|
||||
xSize = 366;
|
||||
ySize = 226;
|
||||
this.selectedQuest = QuestController.Instance.quests.get(quest);
|
||||
if(selectedQuest != null) {
|
||||
selectedCategory = selectedQuest.category;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
||||
if(parent instanceof GuiSelectionListener){
|
||||
listener = (GuiSelectionListener) parent;
|
||||
}
|
||||
this.addLabel(new GuiNpcLabel(0, "gui.categories", guiLeft + 8, guiTop + 4));
|
||||
this.addLabel(new GuiNpcLabel(1, "quest.quests", guiLeft + 184, guiTop + 4));
|
||||
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + xSize - 56, guiTop + ySize - 35, 50, 20, "gui.done"));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + xSize - 108, guiTop + ySize - 35, 50, 20, "gui.cancel"));
|
||||
|
||||
HashMap<String,QuestCategory> categoryData = new HashMap<String,QuestCategory>();
|
||||
HashMap<String,Quest> questData = new HashMap<String,Quest>();
|
||||
|
||||
for(QuestCategory category : QuestController.Instance.categories.values()) {
|
||||
categoryData.put(category.title, category);
|
||||
}
|
||||
this.categoryData = categoryData;
|
||||
|
||||
if(selectedCategory != null) {
|
||||
for(Quest quest : selectedCategory.quests.values()) {
|
||||
questData.put(quest.title, quest);
|
||||
}
|
||||
}
|
||||
this.questData = questData;
|
||||
|
||||
if(scrollCategories == null){
|
||||
scrollCategories = new GuiCustomScroll(this,0, 0);
|
||||
scrollCategories.setSize(177, 153);
|
||||
}
|
||||
scrollCategories.setList(getCatSearch());
|
||||
if(selectedCategory != null) {
|
||||
scrollCategories.setSelected(selectedCategory.title);
|
||||
}
|
||||
scrollCategories.guiLeft = guiLeft + 4;
|
||||
scrollCategories.guiTop = guiTop + 14;
|
||||
this.addScroll(scrollCategories);
|
||||
addTextField(new GuiNpcTextField(33, this, fontRendererObj, guiLeft + 4, guiTop + 169, 177, 20, catSearch));
|
||||
|
||||
if(scrollQuests == null){
|
||||
scrollQuests = new GuiCustomScroll(this,1, 0);
|
||||
scrollQuests.setSize(177, 153);
|
||||
}
|
||||
scrollQuests.setList(getQuestSearch());
|
||||
if(selectedQuest != null) {
|
||||
scrollQuests.setSelected(selectedQuest.title);
|
||||
}
|
||||
scrollQuests.guiLeft = guiLeft + 182;
|
||||
scrollQuests.guiTop = guiTop + 14;
|
||||
this.addScroll(scrollQuests);
|
||||
addTextField(new GuiNpcTextField(44, this, fontRendererObj, guiLeft + 182, guiTop + 169, 177, 20, questSearch));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
if(getTextField(33) != null){
|
||||
if(getTextField(33).isFocused()){
|
||||
if(catSearch.equals(getTextField(33).getText()))
|
||||
return;
|
||||
catSearch = getTextField(33).getText().toLowerCase();
|
||||
scrollCategories.setList(getCatSearch());
|
||||
}
|
||||
}
|
||||
if(getTextField(44) != null){
|
||||
if(getTextField(44).isFocused()){
|
||||
if(questSearch.equals(getTextField(44).getText()))
|
||||
return;
|
||||
questSearch = getTextField(44).getText().toLowerCase();
|
||||
scrollQuests.setList(getQuestSearch());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getCatSearch(){
|
||||
if(catSearch.isEmpty()){
|
||||
return Lists.newArrayList(categoryData.keySet());
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : Lists.newArrayList(categoryData.keySet())){
|
||||
if(name.toLowerCase().contains(catSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<String> getQuestSearch(){
|
||||
if(selectedCategory == null){
|
||||
return Lists.newArrayList(questData.keySet());
|
||||
}
|
||||
|
||||
if(questSearch.isEmpty()){
|
||||
return new ArrayList<String>(Lists.newArrayList(questData.keySet()));
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : Lists.newArrayList(questData.keySet())){
|
||||
if(name.toLowerCase().contains(questSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0){
|
||||
selectedCategory = categoryData.get(scrollCategories.getSelected());
|
||||
selectedQuest = null;
|
||||
scrollQuests.selected = -1;
|
||||
scrollQuests.resetScroll();
|
||||
getTextField(44).setText("");
|
||||
questSearch = "";
|
||||
}
|
||||
if(guiCustomScroll.id == 1){
|
||||
selectedQuest = questData.get(scrollQuests.getSelected());
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollDoubleClicked(String selection, GuiCustomScroll scroll) {
|
||||
if(selectedQuest == null)
|
||||
return;
|
||||
if(listener != null) {
|
||||
listener.selected(selectedQuest.id, selectedQuest.title);
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
int id = guibutton.id;
|
||||
if(id == 2){
|
||||
if(selectedQuest != null) {
|
||||
customScrollDoubleClicked(null, null);
|
||||
}
|
||||
else {
|
||||
close();
|
||||
}
|
||||
}
|
||||
if(id == 3){
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,376 +1,374 @@
|
||||
//package noppes.npcs.client.gui.select;
|
||||
//
|
||||
//import com.google.common.collect.Lists;
|
||||
//import net.minecraft.client.Minecraft;
|
||||
//import net.minecraft.client.gui.GuiButton;
|
||||
//import net.minecraft.client.resources.*;
|
||||
//import net.minecraft.item.crafting.CraftingManager;
|
||||
//import net.minecraft.util.ResourceLocation;
|
||||
//import noppes.npcs.CustomNpcs;
|
||||
//import noppes.npcs.LogWriter;
|
||||
//import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||
//import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
//import noppes.npcs.client.gui.util.ICustomScrollListener;
|
||||
//import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
//import noppes.npcs.entity.EntityNPCInterface;
|
||||
//
|
||||
//import java.io.File;
|
||||
//import java.io.UnsupportedEncodingException;
|
||||
//import java.net.URL;
|
||||
//import java.net.URLDecoder;
|
||||
//import java.nio.charset.StandardCharsets;
|
||||
//import java.util.*;
|
||||
//import java.util.zip.ZipEntry;
|
||||
//import java.util.zip.ZipFile;
|
||||
//
|
||||
//public class GuiTextureSelection extends SubGuiInterface implements ICustomScrollListener{
|
||||
//
|
||||
// private String up = "..<" + I18n.translateToLocal("gui.up") + ">..";
|
||||
// private GuiCustomScroll scrollCategories;
|
||||
// private GuiCustomScroll scrollQuests;
|
||||
//
|
||||
// private String location = "";
|
||||
// private String selectedDomain;
|
||||
// public ResourceLocation selectedResource;
|
||||
//
|
||||
// private HashMap<String,List<TextureData>> domains = new HashMap<String,List<TextureData>>();
|
||||
// private HashMap<String, TextureData> textures = new HashMap<String, TextureData>();
|
||||
//
|
||||
// public GuiTextureSelection(EntityNPCInterface npc, String texture){
|
||||
// this.npc = npc;
|
||||
// drawDefaultBackground = false;
|
||||
// title = "";
|
||||
// setBackground("menubg.png");
|
||||
// xSize = 366;
|
||||
// ySize = 226;
|
||||
//
|
||||
// SimpleReloadableResourceManager simplemanager = (SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
||||
//
|
||||
// Map<String, FallbackResourceManager> map = ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, simplemanager, 2);
|
||||
// HashSet<String> set = new HashSet<String>();
|
||||
// for(String name: map.keySet()){
|
||||
// FallbackResourceManager manager = map.get(name);
|
||||
// List<IResourcePack> list = ObfuscationReflectionHelper.getPrivateValue(FallbackResourceManager.class, manager, 1);
|
||||
// for(IResourcePack pack : list){
|
||||
// if(pack instanceof LegacyV2Adapter) {
|
||||
// pack = ObfuscationReflectionHelper.getPrivateValue(LegacyV2Adapter.class, (LegacyV2Adapter)pack, 0);;
|
||||
// }
|
||||
// if(pack instanceof AbstractResourcePack){
|
||||
// AbstractResourcePack p = (AbstractResourcePack) pack;
|
||||
// File file = p.resourcePackFile;
|
||||
// if(file != null)
|
||||
// set.add(file.getAbsolutePath());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// for(String file : set){
|
||||
// File f = new File(file);
|
||||
// if(f.isDirectory()) {
|
||||
// checkFolder(new File(f, "assets"), f.getAbsolutePath().length());
|
||||
// }
|
||||
// else {
|
||||
// progressFile(f);
|
||||
// }
|
||||
// }
|
||||
// for (ModContainer mod : Loader.instance().getModList()) {
|
||||
// if(mod.getSource().exists())
|
||||
// progressFile(mod.getSource());
|
||||
// }
|
||||
//
|
||||
// ResourcePackRepository repos = Minecraft.getMinecraft().getResourcePackRepository();
|
||||
// repos.updateRepositoryEntriesAll();
|
||||
// List<ResourcePackRepository.Entry> list = repos.getRepositoryEntries();
|
||||
// if(repos.getServerResourcePack() != null) {
|
||||
// AbstractResourcePack p = (AbstractResourcePack) repos.getServerResourcePack();
|
||||
// File file = p.resourcePackFile;
|
||||
// if(file != null)
|
||||
// progressFile(file);
|
||||
// }
|
||||
// for(ResourcePackRepository.Entry entry : list) {
|
||||
// File file = new File(repos.getDirResourcepacks(),entry.getResourcePackName());
|
||||
// if(file.exists()){
|
||||
// progressFile(file);
|
||||
// }
|
||||
// }
|
||||
// checkFolder(new File(CustomNpcs.Dir,"assets"),CustomNpcs.Dir.getAbsolutePath().length());
|
||||
//
|
||||
// URL url = DefaultResourcePack.class.getResource("/");
|
||||
// if(url != null) {
|
||||
// File f = decodeFile(url.getFile());
|
||||
// if(f.isDirectory()) {
|
||||
// checkFolder(new File(f,"assets"), url.getFile().length());
|
||||
// }
|
||||
// else {
|
||||
// progressFile(f);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// url = CraftingManager.class.getResource("/assets/.mcassetsroot");
|
||||
// if(url != null) {
|
||||
// File f = decodeFile(url.getFile());
|
||||
// if(f.isDirectory()) {
|
||||
// checkFolder(new File(f,"assets"), url.getFile().length());
|
||||
// }
|
||||
// else {
|
||||
// progressFile(f);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(texture != null && !texture.isEmpty()){
|
||||
// selectedResource = new ResourceLocation(texture);
|
||||
// selectedDomain = selectedResource.getResourceDomain();
|
||||
// if(!domains.containsKey(selectedDomain)) {
|
||||
// selectedDomain = null;
|
||||
// }
|
||||
// int i = selectedResource.getResourcePath().lastIndexOf('/');
|
||||
// location = selectedResource.getResourcePath().substring(0, i + 1);
|
||||
// if(location.startsWith("textures/")){
|
||||
// location = location.substring(9);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// private File decodeFile(String url) {
|
||||
// if(url.startsWith("file:")) {
|
||||
// url = url.substring(5);
|
||||
// }
|
||||
// url = url.replace('/', File.separatorChar);
|
||||
// int i = url.indexOf('!');
|
||||
// if(i > 0) {
|
||||
// url = url.substring(0, i);
|
||||
// }
|
||||
// try {
|
||||
// url = URLDecoder.decode(url, StandardCharsets.UTF_8.name());
|
||||
// } catch (UnsupportedEncodingException e) {
|
||||
// }
|
||||
// return new File(url);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void initGui(){
|
||||
// super.initGui();
|
||||
//
|
||||
// if(selectedDomain != null) {
|
||||
// title = selectedDomain + ":" + location;
|
||||
// }
|
||||
// else {
|
||||
// title = "";
|
||||
// }
|
||||
//
|
||||
// this.addButton(new GuiNpcButton(2, guiLeft + 264, guiTop + 170, 90, 20, "gui.done"));
|
||||
// this.addButton(new GuiNpcButton(1, guiLeft + 264, guiTop + 190, 90, 20, "gui.cancel"));
|
||||
//
|
||||
// if(scrollCategories == null){
|
||||
// scrollCategories = new GuiCustomScroll(this,0);
|
||||
// scrollCategories.setSize(120, 200);
|
||||
// }
|
||||
//
|
||||
// if(selectedDomain == null) {
|
||||
// scrollCategories.setList(Lists.newArrayList(domains.keySet()));
|
||||
// if(selectedDomain != null) {
|
||||
// scrollCategories.setSelected(selectedDomain);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// List<String> list = new ArrayList<String>();
|
||||
// list.add(up);
|
||||
// List<TextureData> data = domains.get(selectedDomain);
|
||||
// for(TextureData td : data) {
|
||||
// if(location.isEmpty() || td.path.startsWith(location) && !td.path.equals(location)) {
|
||||
// String path = td.path.substring(location.length());
|
||||
// int i = path.indexOf('/');
|
||||
// if(i < 0)
|
||||
// continue;
|
||||
// path = path.substring(0, i);
|
||||
// if(!path.isEmpty() && !list.contains(path)) {
|
||||
// list.add(path);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// scrollCategories.setList(list);
|
||||
// }
|
||||
// scrollCategories.guiLeft = guiLeft + 4;
|
||||
// scrollCategories.guiTop = guiTop + 14;
|
||||
// this.addScroll(scrollCategories);
|
||||
//
|
||||
// if(scrollQuests == null){
|
||||
// scrollQuests = new GuiCustomScroll(this,1);
|
||||
// scrollQuests.setSize(130, 200);
|
||||
// }
|
||||
// if(selectedDomain != null) {
|
||||
// textures.clear();
|
||||
// List<TextureData> data = domains.get(selectedDomain);
|
||||
// List<String> list = new ArrayList<String>();
|
||||
// String loc = location;
|
||||
// if(scrollCategories.hasSelected() && !scrollCategories.getSelected().equals(up)) {
|
||||
// loc += scrollCategories.getSelected() + '/';
|
||||
// }
|
||||
// for(TextureData td : data) {
|
||||
// if(td.path.equals(loc) && !list.contains(td.name)) {
|
||||
// list.add(td.name);
|
||||
// textures.put(td.name, td);
|
||||
// }
|
||||
// }
|
||||
// scrollQuests.setList(list);
|
||||
// }
|
||||
// if(selectedResource != null) {
|
||||
// scrollQuests.setSelected(selectedResource.getResourcePath());
|
||||
// }
|
||||
// scrollQuests.guiLeft = guiLeft + 125;
|
||||
// scrollQuests.guiTop = guiTop + 14;
|
||||
// this.addScroll(scrollQuests);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void actionPerformed(GuiButton guibutton){
|
||||
// super.actionPerformed(guibutton);
|
||||
// if(guibutton.id == 2){
|
||||
// npc.display.setSkinTexture(selectedResource.toString());
|
||||
// }
|
||||
// npc.textureLocation = null;
|
||||
// close();
|
||||
// parent.initGui();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void drawScreen(int i, int j, float f){
|
||||
// super.drawScreen(i, j, f);
|
||||
//
|
||||
// npc.textureLocation = selectedResource;
|
||||
// drawNpc(npc, guiLeft + 276, guiTop + 140, 2, 0);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public void scrollClicked(int i, int j, int k, GuiCustomScroll scroll) {
|
||||
// if(scroll == scrollQuests) {
|
||||
// if(scroll.id == 1){
|
||||
// TextureData data = textures.get(scroll.getSelected());
|
||||
// selectedResource = new ResourceLocation(selectedDomain, data.absoluteName);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// initGui();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void scrollDoubleClicked(String selection, GuiCustomScroll scroll) {
|
||||
// if(scroll == scrollCategories) {
|
||||
// if(selectedDomain == null) {
|
||||
// selectedDomain = selection;
|
||||
// }
|
||||
// else if(selection.equals(up)) {
|
||||
// int i = location.lastIndexOf('/', location.length() - 2);
|
||||
// if(i < 0) {
|
||||
// if(location.isEmpty()) {
|
||||
// selectedDomain = null;
|
||||
// }
|
||||
// location = "";
|
||||
// }
|
||||
// else {
|
||||
// location = location.substring(0, i + 1);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// location = location + selection + '/';
|
||||
// }
|
||||
// scrollCategories.selected = -1;
|
||||
// scrollQuests.selected = -1;
|
||||
// initGui();
|
||||
// }
|
||||
// else {
|
||||
// npc.display.setSkinTexture(selectedResource.toString());
|
||||
// close();
|
||||
// parent.initGui();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void progressFile(File file){
|
||||
// try {
|
||||
// if (!file.isDirectory() && (file.getName().endsWith(".jar") || file.getName().endsWith(".zip")))
|
||||
// {
|
||||
// ZipFile zip = new ZipFile(file);
|
||||
// Enumeration<? extends ZipEntry> entries = zip.entries();
|
||||
// while(entries.hasMoreElements()){
|
||||
// ZipEntry zipentry = entries.nextElement();
|
||||
// String entryName = zipentry.getName();
|
||||
// addFile(entryName);
|
||||
//
|
||||
// }
|
||||
// zip.close();
|
||||
// }
|
||||
// else if(file.isDirectory()){
|
||||
// int length = file.getAbsolutePath().length();
|
||||
// checkFolder(file,length);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void checkFolder(File file, int length){
|
||||
// File[] files = file.listFiles();
|
||||
// if(files == null){
|
||||
// return;
|
||||
// }
|
||||
// for(File f : files){
|
||||
// String name = null;
|
||||
// try {
|
||||
// name = f.getAbsolutePath().substring(length);
|
||||
// name = name.replace("\\", "/");
|
||||
// if(!name.startsWith("/"))
|
||||
// name = "/" + name;
|
||||
// if(f.isDirectory()){
|
||||
// addFile(name + "/");
|
||||
// checkFolder(f, length);
|
||||
// }
|
||||
// else
|
||||
// addFile(name);
|
||||
// }
|
||||
// catch(Throwable e) {
|
||||
// LogWriter.error("error with: " + name, e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// private void addFile(String name) {
|
||||
// name = name.toLowerCase();
|
||||
// if(name.startsWith("/")) {
|
||||
// name = name.substring(1);
|
||||
// }
|
||||
// if(!name.startsWith("assets/") || !name.toLowerCase().endsWith(".png")) {
|
||||
// return;
|
||||
// }
|
||||
// name = name.substring(7);
|
||||
// int i = name.indexOf('/');
|
||||
// String domain = name.substring(0, i);
|
||||
// name = name.substring(i + 10);
|
||||
//
|
||||
// List<TextureData> list = domains.get(domain);
|
||||
// if(list == null) {
|
||||
// domains.put(domain, list = new ArrayList<TextureData>());
|
||||
// }
|
||||
// boolean contains = false;
|
||||
// for(TextureData data : list) {
|
||||
// if(data.absoluteName.equals(name)) {
|
||||
// contains = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if(!contains)
|
||||
// list.add(new TextureData(domain, name));
|
||||
// }
|
||||
// class TextureData{
|
||||
// String domain;
|
||||
// String absoluteName;
|
||||
// String name;
|
||||
// String path;
|
||||
// public TextureData(String domain, String absoluteName) {
|
||||
// this.domain = domain;
|
||||
// int i = absoluteName.lastIndexOf('/');
|
||||
// name = absoluteName.substring(i + 1);
|
||||
// path = absoluteName.substring(0, i + 1);
|
||||
// this.absoluteName = "textures/" + absoluteName;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
package noppes.npcs.client.gui.select;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.resources.*;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.ICustomScrollListener;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
public class GuiTextureSelection extends SubGuiInterface implements ICustomScrollListener {
|
||||
|
||||
private final String up = "..<" + StatCollector.translateToLocal("gui.up") + ">..";
|
||||
private GuiCustomScroll scrollCategories;
|
||||
private GuiCustomScroll scrollTextures;
|
||||
|
||||
private String location = "";
|
||||
private String selectedDomain;
|
||||
public ResourceLocation selectedResource;
|
||||
|
||||
private final HashMap<String,List<TextureData>> domains = new HashMap<String,List<TextureData>>();
|
||||
private final HashMap<String, TextureData> textures = new HashMap<String, TextureData>();
|
||||
|
||||
public GuiTextureSelection(EntityNPCInterface npc, String texture){
|
||||
this.npc = npc;
|
||||
drawDefaultBackground = false;
|
||||
title = "";
|
||||
setBackground("menubg.png");
|
||||
xSize = 366;
|
||||
ySize = 226;
|
||||
|
||||
SimpleReloadableResourceManager simplemanager = (SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
||||
|
||||
Map<String, FallbackResourceManager> map = ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, simplemanager, 2);
|
||||
HashSet<String> set = new HashSet<String>();
|
||||
for(String name: map.keySet()){
|
||||
if(!(map.get(name) instanceof FallbackResourceManager))
|
||||
continue;
|
||||
FallbackResourceManager manager = (FallbackResourceManager) map.get(name);
|
||||
List<IResourcePack> list = ObfuscationReflectionHelper.getPrivateValue(FallbackResourceManager.class, manager, 0);
|
||||
for(IResourcePack pack : list){
|
||||
if(pack instanceof AbstractResourcePack){
|
||||
AbstractResourcePack p = (AbstractResourcePack) pack;
|
||||
File file = NPCResourceHelper.getPackFile(p);
|
||||
if(file != null)
|
||||
set.add(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
for(String file : set){
|
||||
File f = new File(file);
|
||||
if(f.isDirectory()) {
|
||||
checkFolder(new File(f, "assets"), f.getAbsolutePath().length());
|
||||
}
|
||||
else {
|
||||
progressFile(f);
|
||||
}
|
||||
}
|
||||
for (ModContainer mod : Loader.instance().getModList()) {
|
||||
if(mod.getSource().exists())
|
||||
progressFile(mod.getSource());
|
||||
}
|
||||
|
||||
ResourcePackRepository repos = Minecraft.getMinecraft().getResourcePackRepository();
|
||||
repos.updateRepositoryEntriesAll();
|
||||
List<ResourcePackRepository.Entry> list = repos.getRepositoryEntries();
|
||||
for(ResourcePackRepository.Entry entry : list) {
|
||||
File file = new File(repos.getDirResourcepacks(),entry.getResourcePackName());
|
||||
if(file.exists()){
|
||||
progressFile(file);
|
||||
}
|
||||
}
|
||||
checkFolder(new File(CustomNpcs.Dir,"assets"),CustomNpcs.Dir.getAbsolutePath().length());
|
||||
|
||||
URL url = DefaultResourcePack.class.getResource("/");
|
||||
if(url != null) {
|
||||
File f = decodeFile(url.getFile());
|
||||
if(f.isDirectory()) {
|
||||
checkFolder(new File(f,"assets"), url.getFile().length());
|
||||
}
|
||||
else {
|
||||
progressFile(f);
|
||||
}
|
||||
}
|
||||
|
||||
url = CraftingManager.class.getResource("/assets/.mcassetsroot");
|
||||
if(url != null) {
|
||||
File f = decodeFile(url.getFile());
|
||||
if(f.isDirectory()) {
|
||||
checkFolder(new File(f,"assets"), url.getFile().length());
|
||||
}
|
||||
else {
|
||||
progressFile(f);
|
||||
}
|
||||
}
|
||||
|
||||
if(texture != null && !texture.isEmpty()){
|
||||
selectedResource = new ResourceLocation(texture);
|
||||
selectedDomain = selectedResource.getResourceDomain();
|
||||
if(!domains.containsKey(selectedDomain)) {
|
||||
selectedDomain = null;
|
||||
}
|
||||
int i = selectedResource.getResourcePath().lastIndexOf('/');
|
||||
location = selectedResource.getResourcePath().substring(0, i + 1);
|
||||
if(location.startsWith("textures/")){
|
||||
location = location.substring(9);
|
||||
}
|
||||
}
|
||||
}
|
||||
private File decodeFile(String url) {
|
||||
if(url.startsWith("file:")) {
|
||||
url = url.substring(5);
|
||||
}
|
||||
url = url.replace('/', File.separatorChar);
|
||||
int i = url.indexOf('!');
|
||||
if(i > 0) {
|
||||
url = url.substring(0, i);
|
||||
}
|
||||
try {
|
||||
url = URLDecoder.decode(url, StandardCharsets.UTF_8.name());
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
}
|
||||
return new File(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
||||
if(selectedDomain != null) {
|
||||
title = selectedDomain + ":" + location;
|
||||
}
|
||||
else {
|
||||
title = "";
|
||||
}
|
||||
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 264, guiTop + 170, 90, 20, "gui.done"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 264, guiTop + 190, 90, 20, "gui.cancel"));
|
||||
|
||||
if(scrollCategories == null){
|
||||
scrollCategories = new GuiCustomScroll(this,0);
|
||||
scrollCategories.setSize(120, 200);
|
||||
}
|
||||
|
||||
if(selectedDomain == null) {
|
||||
scrollCategories.setList(Lists.newArrayList(domains.keySet()));
|
||||
if(selectedDomain != null) {
|
||||
scrollCategories.setSelected(selectedDomain);
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add(up);
|
||||
List<TextureData> data = domains.get(selectedDomain);
|
||||
for(TextureData td : data) {
|
||||
if(location.isEmpty() || td.path.startsWith(location) && !td.path.equals(location)) {
|
||||
String path = td.path.substring(location.length());
|
||||
int i = path.indexOf('/');
|
||||
if(i < 0)
|
||||
continue;
|
||||
path = path.substring(0, i);
|
||||
if(!path.isEmpty() && !list.contains(path)) {
|
||||
list.add(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
scrollCategories.setList(list);
|
||||
}
|
||||
scrollCategories.guiLeft = guiLeft + 4;
|
||||
scrollCategories.guiTop = guiTop + 14;
|
||||
this.addScroll(scrollCategories);
|
||||
|
||||
if(scrollTextures == null){
|
||||
scrollTextures = new GuiCustomScroll(this,1);
|
||||
scrollTextures.setSize(130, 200);
|
||||
}
|
||||
if(selectedDomain != null) {
|
||||
textures.clear();
|
||||
List<TextureData> data = domains.get(selectedDomain);
|
||||
List<String> list = new ArrayList<String>();
|
||||
String loc = location;
|
||||
if(scrollCategories.hasSelected() && !scrollCategories.getSelected().equals(up)) {
|
||||
loc += scrollCategories.getSelected() + '/';
|
||||
}
|
||||
for(TextureData td : data) {
|
||||
if(td.path.equals(loc) && !list.contains(td.name)) {
|
||||
list.add(td.name);
|
||||
textures.put(td.name, td);
|
||||
}
|
||||
}
|
||||
scrollTextures.setList(list);
|
||||
}
|
||||
if(selectedResource != null) {
|
||||
scrollTextures.setSelected(selectedResource.getResourcePath());
|
||||
}
|
||||
scrollTextures.guiLeft = guiLeft + 125;
|
||||
scrollTextures.guiTop = guiTop + 14;
|
||||
this.addScroll(scrollTextures);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
super.actionPerformed(guibutton);
|
||||
if(guibutton.id == 2){
|
||||
npc.display.setSkinTexture(selectedResource.toString());
|
||||
}
|
||||
npc.textureLocation = null;
|
||||
close();
|
||||
parent.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f){
|
||||
super.drawScreen(i, j, f);
|
||||
|
||||
npc.textureLocation = selectedResource;
|
||||
drawNpc(npc, 307, 150, 1.5F, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) {
|
||||
if(scroll == scrollTextures) {
|
||||
if(scroll.id == 1){
|
||||
TextureData data = textures.get(scroll.getSelected());
|
||||
selectedResource = new ResourceLocation(selectedDomain, data.absoluteName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
initGui();
|
||||
scrollTextures.resetScroll();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollDoubleClicked(String selection, GuiCustomScroll scroll) {
|
||||
if(scroll == scrollCategories) {
|
||||
if(selectedDomain == null) {
|
||||
selectedDomain = selection;
|
||||
}
|
||||
else if(selection.equals(up)) {
|
||||
int i = location.lastIndexOf('/', location.length() - 2);
|
||||
if(i < 0) {
|
||||
if(location.isEmpty()) {
|
||||
selectedDomain = null;
|
||||
}
|
||||
location = "";
|
||||
}
|
||||
else {
|
||||
location = location.substring(0, i + 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
location = location + selection + '/';
|
||||
}
|
||||
scrollCategories.selected = -1;
|
||||
scrollTextures.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
else {
|
||||
npc.display.setSkinTexture(selectedResource.toString());
|
||||
close();
|
||||
parent.initGui();
|
||||
}
|
||||
}
|
||||
|
||||
private void progressFile(File file){
|
||||
try {
|
||||
if (!file.isDirectory() && (file.getName().endsWith(".jar") || file.getName().endsWith(".zip")))
|
||||
{
|
||||
ZipFile zip = new ZipFile(file);
|
||||
Enumeration<? extends ZipEntry> entries = zip.entries();
|
||||
while(entries.hasMoreElements()){
|
||||
ZipEntry zipentry = entries.nextElement();
|
||||
String entryName = zipentry.getName();
|
||||
addFile(entryName);
|
||||
|
||||
}
|
||||
zip.close();
|
||||
}
|
||||
else if(file.isDirectory()){
|
||||
int length = file.getAbsolutePath().length();
|
||||
checkFolder(file,length);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkFolder(File file, int length){
|
||||
File[] files = file.listFiles();
|
||||
if(files == null){
|
||||
return;
|
||||
}
|
||||
for(File f : files){
|
||||
String name = null;
|
||||
try {
|
||||
name = f.getAbsolutePath().substring(length);
|
||||
name = name.replace("\\", "/");
|
||||
if(!name.startsWith("/"))
|
||||
name = "/" + name;
|
||||
if(f.isDirectory()){
|
||||
addFile(name + "/");
|
||||
checkFolder(f, length);
|
||||
}
|
||||
else
|
||||
addFile(name);
|
||||
}
|
||||
catch(Throwable e) {
|
||||
LogWriter.error("error with: " + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void addFile(String name) {
|
||||
if(name.startsWith("/")) {
|
||||
name = name.substring(1);
|
||||
}
|
||||
if(!name.startsWith("assets/") || !name.endsWith(".png")) {
|
||||
return;
|
||||
}
|
||||
name = name.substring(7);
|
||||
int i = name.indexOf('/');
|
||||
String domain = name.substring(0, i);
|
||||
name = name.substring(i + 10);
|
||||
|
||||
List<TextureData> list = domains.get(domain);
|
||||
if(list == null) {
|
||||
domains.put(domain, list = new ArrayList<TextureData>());
|
||||
}
|
||||
boolean contains = false;
|
||||
for(TextureData data : list) {
|
||||
if(data.absoluteName.equals(name)) {
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!contains)
|
||||
list.add(new TextureData(domain, name));
|
||||
}
|
||||
|
||||
static class TextureData {
|
||||
String domain;
|
||||
String absoluteName;
|
||||
String name;
|
||||
String path;
|
||||
public TextureData(String domain, String absoluteName) {
|
||||
this.domain = domain;
|
||||
int i = absoluteName.lastIndexOf('/');
|
||||
name = absoluteName.substring(i + 1);
|
||||
path = absoluteName.substring(0, i + 1);
|
||||
this.absoluteName = "textures/" + absoluteName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ public class GuiCustomScroll extends GuiScreen
|
||||
private boolean isSorted = true;
|
||||
public boolean visible = true;
|
||||
private boolean selectable = true;
|
||||
private boolean hasSubGUI = false;
|
||||
|
||||
private int lastClickedItem;
|
||||
private long lastClickedTime = 0;
|
||||
@@ -116,7 +117,7 @@ public class GuiCustomScroll extends GuiScreen
|
||||
hoverCount++;
|
||||
}
|
||||
|
||||
if(hover != -1 && hoverableText && hoverCount > 100){
|
||||
if(!hasSubGUI && hover != -1 && hoverableText && hoverCount > 100){
|
||||
String displayString = StatCollector.translateToLocal(list.get(hover));
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
List<String> lines = TextSplitter.splitText(displayString, 30);
|
||||
@@ -176,7 +177,7 @@ public class GuiCustomScroll extends GuiScreen
|
||||
hoverCount++;
|
||||
}
|
||||
|
||||
if(hover != -1 && hoverableText && hoverCount > 100){
|
||||
if(!hasSubGUI && hover != -1 && hoverableText && hoverCount > 100){
|
||||
String displayString = StatCollector.translateToLocal(list.get(hover));
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
List<String> lines = TextSplitter.splitText(displayString, 30);
|
||||
@@ -374,4 +375,9 @@ public class GuiCustomScroll extends GuiScreen
|
||||
public void resetScroll(){
|
||||
scrollY = 0;
|
||||
}
|
||||
|
||||
public void updateSubGUI(boolean hasSubGUI)
|
||||
{
|
||||
this.hasSubGUI = hasSubGUI;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiCNPCInventory;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
@@ -16,6 +17,9 @@ public class GuiMenuSideButton extends GuiNpcButton{
|
||||
public boolean active;
|
||||
public boolean rightSided;
|
||||
public ItemStack renderStack;
|
||||
public ResourceLocation renderResource;
|
||||
public int renderIconPosX = 0;
|
||||
public int renderIconPosY = 0;
|
||||
|
||||
public GuiMenuSideButton(int id, int x, int y, String s){
|
||||
this(id, x, y, 200, 20, s);
|
||||
@@ -54,6 +58,15 @@ public class GuiMenuSideButton extends GuiNpcButton{
|
||||
}
|
||||
mouseDragged(minecraft, i, j);
|
||||
|
||||
// Render Custom Icon
|
||||
if (this.renderResource != null) {
|
||||
this.zLevel = 100.0F;
|
||||
minecraft.renderEngine.bindTexture(renderResource);
|
||||
drawTexturedModalRect(xPosition + 2, yPosition + height/2 - 8, renderIconPosX, renderIconPosY, 16, 16);
|
||||
this.zLevel = 0.0F;
|
||||
}
|
||||
|
||||
|
||||
if (this.renderStack != null) {
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
this.zLevel = 100.0F;
|
||||
@@ -71,7 +84,7 @@ public class GuiMenuSideButton extends GuiNpcButton{
|
||||
this.zLevel = 0.0F;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
|
||||
String text = "";
|
||||
float maxWidth = width * 0.75f;
|
||||
if(fontrenderer.getStringWidth(displayString) > maxWidth){
|
||||
@@ -102,7 +115,7 @@ public class GuiMenuSideButton extends GuiNpcButton{
|
||||
|
||||
@Override
|
||||
public void mouseReleased(int i, int j){
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,9 +8,11 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.TextBlockClient;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
@@ -237,26 +239,31 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
drawBackground();
|
||||
}
|
||||
|
||||
boolean subGui = hasSubGui();
|
||||
drawCenteredString(fontRendererObj, title, width / 2, guiTop + 4, 0xffffff);
|
||||
for(GuiNpcLabel label : labels.values())
|
||||
label.drawLabel(this,fontRendererObj);
|
||||
for(GuiNpcTextField tf : textfields.values()){
|
||||
tf.drawTextBox(i, j);
|
||||
}
|
||||
for(GuiCustomScroll scroll : scrolls.values())
|
||||
scroll.drawScreen(i, j, f, hasSubGui()?0:this.mouseWheel);
|
||||
|
||||
for(GuiCustomScroll scroll : scrolls.values()){
|
||||
scroll.updateSubGUI(subGui);
|
||||
scroll.drawScreen(i, j, f, subGui?0:this.mouseWheel);
|
||||
}
|
||||
for(GuiScreen gui : extra.values())
|
||||
gui.drawScreen(i, j, f);
|
||||
super.drawScreen(i, j, f);
|
||||
for(GuiCustomScroll scroll : scrolls.values())
|
||||
if(scroll.hoverableText){
|
||||
scroll.drawHover(i, j, f, hasSubGui()?0:this.mouseWheel);
|
||||
scroll.drawHover(i, j, f, subGui?0:this.mouseWheel);
|
||||
}
|
||||
for(GuiNpcButton button : buttons.values())
|
||||
for(GuiNpcButton button : buttons.values()){
|
||||
button.updateSubGUI(subGui);
|
||||
if(!button.hoverableText.isEmpty()){
|
||||
button.drawHover(i, j, hasSubGui());
|
||||
button.drawHover(i, j, subGui);
|
||||
}
|
||||
}
|
||||
|
||||
if(subgui != null)
|
||||
subgui.drawScreen(i,j,f);
|
||||
}
|
||||
@@ -330,44 +337,63 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
return subgui;
|
||||
}
|
||||
|
||||
public void drawNpc(int x, int y){
|
||||
public void drawNpc(int x, int y){
|
||||
drawNpc(npc, x, y, 1, 0);
|
||||
}
|
||||
|
||||
public void drawNpc(EntityLivingBase entity, int x, int y, float zoomed, int rotation){
|
||||
EntityNPCInterface npc = null;
|
||||
if(entity instanceof EntityNPCInterface)
|
||||
npc = (EntityNPCInterface) entity;
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
npc.isDrawn = true;
|
||||
if(npc != null)
|
||||
npc.isDrawn = true;
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(guiLeft + x, guiTop + y, 50F);
|
||||
float scale = 1;
|
||||
if(npc.height > 2.4)
|
||||
if(entity.height > 2.4)
|
||||
scale = 2 / npc.height;
|
||||
|
||||
GL11.glScalef(-30 * scale, 30 * scale, 30 * scale);
|
||||
GL11.glScalef(-30 * scale * zoomed, 30 * scale * zoomed, 30 * scale * zoomed);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
float f2 = npc.renderYawOffset;
|
||||
float f3 = npc.rotationYaw;
|
||||
float f4 = npc.rotationPitch;
|
||||
float f7 = npc.rotationYawHead;
|
||||
float f2 = entity.renderYawOffset;
|
||||
float f3 = entity.rotationYaw;
|
||||
float f4 = entity.rotationPitch;
|
||||
float f7 = entity.rotationYawHead;
|
||||
float f5 = (float) (guiLeft + x) - mouseX;
|
||||
float f6 = (float) ((guiTop + y) - 50) - mouseY;
|
||||
float f6 = (float) ((guiTop + y) - 50 * scale * zoomed) - mouseY;
|
||||
int orientation = 0;
|
||||
if(npc != null){
|
||||
orientation = npc.ai.orientation;
|
||||
npc.ai.orientation = rotation;
|
||||
}
|
||||
|
||||
GL11.glRotatef(135F, 0.0F, 1.0F, 0.0F);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GL11.glRotatef(-135F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-(float) Math.atan(f6 / 40F) * 20F, 1.0F, 0.0F, 0.0F);
|
||||
npc.renderYawOffset = (float) Math.atan(f5 / 40F) * 20F;
|
||||
npc.rotationYaw = (float) Math.atan(f5 / 40F) * 40F;
|
||||
npc.rotationPitch = -(float) Math.atan(f6 / 40F) * 20F;
|
||||
npc.rotationYawHead = npc.rotationYaw;
|
||||
GL11.glTranslatef(0.0F, npc.yOffset, 0.0F);
|
||||
entity.renderYawOffset = rotation;
|
||||
entity.rotationYaw = (float)Math.atan(f5 / 80F) * 40F + rotation;
|
||||
entity.rotationPitch = -(float) Math.atan(f6 / 40F) * 20F;
|
||||
entity.rotationYawHead = entity.rotationYaw;
|
||||
GL11.glTranslatef(0.0F, entity.yOffset, 0.0F);
|
||||
RenderManager.instance.playerViewY = 180F;
|
||||
RenderManager.instance.renderEntityWithPosYaw(npc, 0, 0, 0, 0, 1);
|
||||
npc.renderYawOffset = f2;
|
||||
npc.rotationYaw = f3;
|
||||
npc.rotationPitch = f4;
|
||||
npc.rotationYawHead = f7;
|
||||
RenderManager.instance.renderEntityWithPosYaw(entity, 0, 0, 0, 0, 1);
|
||||
entity.prevRenderYawOffset = entity.renderYawOffset = f2;
|
||||
entity.prevRotationYaw = entity.rotationYaw = f3;
|
||||
entity.prevRotationPitch = entity.rotationPitch = f4;
|
||||
entity.prevRotationYawHead = entity.rotationYawHead = f7;
|
||||
if(npc != null){
|
||||
npc.ai.orientation = orientation;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
npc.isDrawn = false;
|
||||
if(npc != null)
|
||||
npc.isDrawn = false;
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
|
||||
@@ -2,8 +2,10 @@ package noppes.npcs.client.gui.util;
|
||||
|
||||
import kamkeel.util.TextSplitter;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -21,6 +23,7 @@ public class GuiNpcButton extends GuiButton{
|
||||
public String hoverableText = "";
|
||||
public int oldHover;
|
||||
public int hoverCount = 0;
|
||||
boolean hasSubGUI = false;
|
||||
|
||||
public GuiNpcButton(int i, int j, int k, String s) {
|
||||
super(i, j, k, StatCollector.translateToLocal(s));
|
||||
@@ -200,4 +203,29 @@ public class GuiNpcButton extends GuiButton{
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHoverState(boolean mouseOver)
|
||||
{
|
||||
byte b0 = 1;
|
||||
if (!this.enabled)
|
||||
{
|
||||
b0 = 0;
|
||||
}
|
||||
else if (mouseOver && !this.hasSubGUI)
|
||||
{
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
return b0;
|
||||
}
|
||||
|
||||
public void updateSubGUI(boolean hasSubGUI)
|
||||
{
|
||||
this.hasSubGUI = hasSubGUI;
|
||||
}
|
||||
|
||||
public boolean getHasSubGUI()
|
||||
{
|
||||
return this.hasSubGUI;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import net.minecraftforge.common.config.Property;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.config.legacy.LegacyConfig;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import tv.twitch.chat.Chat;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -24,9 +25,6 @@ public class ConfigClient
|
||||
public static Property CacheLifeProperty;
|
||||
public static int CacheLife = 10;
|
||||
|
||||
public static Property enableFactionTabProperty;
|
||||
public static boolean enableFactionTab = true;
|
||||
|
||||
/**
|
||||
* Visual Properties
|
||||
**/
|
||||
@@ -36,6 +34,9 @@ public class ConfigClient
|
||||
public static Property InventoryGuiEnabledProperty;
|
||||
public static boolean InventoryGuiEnabled = true;
|
||||
|
||||
public static Property enableFactionTabProperty;
|
||||
public static boolean enableFactionTab = true;
|
||||
|
||||
public static Property FontTypeProperty;
|
||||
public static String FontType = "Default";
|
||||
|
||||
@@ -54,6 +55,21 @@ public class ConfigClient
|
||||
public static Property TrackingInfoYProperty;
|
||||
public static int TrackingInfoY = 0;
|
||||
|
||||
public static Property TrackingScaleProperty;
|
||||
public static int TrackingScale = 100;
|
||||
|
||||
public static Property DialogSpeedProperty;
|
||||
public static int DialogSpeed = 10;
|
||||
|
||||
public static Property DialogSoundProperty;
|
||||
public static boolean DialogSound = true;
|
||||
|
||||
public static Property ChatAlertsProperty;
|
||||
public static boolean ChatAlerts = true;
|
||||
|
||||
public static Property BannerAlertsProperty;
|
||||
public static boolean BannerAlerts = true;
|
||||
|
||||
public static void init(File configFile)
|
||||
{
|
||||
config = new Configuration(configFile);
|
||||
@@ -66,9 +82,6 @@ public class ConfigClient
|
||||
CacheLifeProperty = config.get(GENERAL, "Cache Life", 10, "How long should downloaded imagery data be saved client side? (In minutes)");
|
||||
CacheLife = CacheLifeProperty.getInt(10);
|
||||
|
||||
enableFactionTabProperty = config.get(GENERAL, "Enable Faction Tab", true, "Enable the Faction Tab");
|
||||
enableFactionTab = enableFactionTabProperty.getBoolean(true);
|
||||
|
||||
// Visual
|
||||
EnableChatBubblesProperty = config.get(VISUAL, "Enable Chat Bubbles", true, "Enable/Disable Chat Bubbles");
|
||||
EnableChatBubbles = EnableChatBubblesProperty.getBoolean(true);
|
||||
@@ -76,6 +89,9 @@ public class ConfigClient
|
||||
InventoryGuiEnabledProperty = config.get(VISUAL, "Enable Inventory Tabs", true, "Enable/Disable Inventory Tabs");
|
||||
InventoryGuiEnabled = InventoryGuiEnabledProperty.getBoolean(true);
|
||||
|
||||
enableFactionTabProperty = config.get(VISUAL, "Enable Faction Tab", true, "Enable the Faction Tab");
|
||||
enableFactionTab = enableFactionTabProperty.getBoolean(true);
|
||||
|
||||
FontTypeProperty = config.get(VISUAL, "Font Type", "Default", "When set to Minecraft it will use minecrafts font, when Default it will use OpenSans. Can only use fonts installed on your PC");
|
||||
FontType = FontTypeProperty.getString();
|
||||
|
||||
@@ -92,6 +108,21 @@ public class ConfigClient
|
||||
TrackingInfoYProperty = config.get(QUESTING, "Tracking Info Y", 0, "Client sided! Offsets the tracking info GUI by this amount in the Y direction.");
|
||||
TrackingInfoY = TrackingInfoYProperty.getInt(0);
|
||||
|
||||
TrackingScaleProperty = config.get(QUESTING, "Tracking Scale", 100, "Client sided! Adjusts the scaling of the Quest Tracking");
|
||||
TrackingScale = TrackingScaleProperty.getInt(100);
|
||||
|
||||
DialogSpeedProperty = config.get(VISUAL, "Dialog Speed", true, "Only set for gradual dialogs");
|
||||
DialogSpeed = DialogSpeedProperty.getInt(10);
|
||||
|
||||
DialogSoundProperty = config.get(VISUAL, "Dialog Sound", true, "Only for dialogs with sounds");
|
||||
DialogSound = DialogSoundProperty.getBoolean(true);
|
||||
|
||||
ChatAlertsProperty = config.get(VISUAL, "All Chat Alerts", true, "Universal enable/disable for Banner Alerts");
|
||||
ChatAlerts = ChatAlertsProperty.getBoolean(true);
|
||||
|
||||
BannerAlertsProperty = config.get(VISUAL, "All Banner Alerts", true, "Universal enable/disable for Banner Alerts");
|
||||
BannerAlerts = BannerAlertsProperty.getBoolean(true);
|
||||
|
||||
// Convert to Legacy
|
||||
if(CustomNpcs.legacyExist){
|
||||
EnableChatBubbles = LegacyConfig.EnableChatBubbles;
|
||||
@@ -132,4 +163,4 @@ public class ConfigClient
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,19 +111,6 @@ public class ConfigMain
|
||||
public static Property TrackedQuestUpdateFrequencyProperty;
|
||||
public static int TrackedQuestUpdateFrequency = 5;
|
||||
|
||||
/**
|
||||
* Sync Properties
|
||||
**/
|
||||
|
||||
public static Property SyncQuestAutoProperty;
|
||||
public static boolean SyncQuestAuto = true;
|
||||
|
||||
public static Property SyncDialogAutoProperty;
|
||||
public static boolean SyncDialogAuto = true;
|
||||
|
||||
public static Property SyncFactionAutoProperty;
|
||||
public static boolean SyncFactionAuto = true;
|
||||
|
||||
public static void init(File configFile)
|
||||
{
|
||||
config = new Configuration(configFile);
|
||||
@@ -216,16 +203,6 @@ public class ConfigMain
|
||||
TrackedQuestUpdateFrequencyProperty = config.get(UPDATE, "Tracked Quest Update Frequency", 5, "How often in seconds to update a players tracked quest. [Only applies to Item Quest currently]");
|
||||
TrackedQuestUpdateFrequency = TrackedQuestUpdateFrequencyProperty.getInt(5);
|
||||
|
||||
// Sync
|
||||
SyncQuestAutoProperty = config.get(SYNC, "Auto Sync Quest Data", true, "If enabled client will all Quest Data upon joining the world");
|
||||
SyncQuestAuto = SyncQuestAutoProperty.getBoolean(true);
|
||||
|
||||
SyncDialogAutoProperty = config.get(SYNC, "Auto Sync Dialog Data", true, "If enabled client will all Dialog Data upon joining the world");
|
||||
SyncDialogAuto = SyncDialogAutoProperty.getBoolean(true);
|
||||
|
||||
SyncFactionAutoProperty = config.get(SYNC, "Auto Sync Faction Data", true, "If enabled client will all Faction Data upon joining the world");
|
||||
SyncFactionAuto = SyncFactionAutoProperty.getBoolean(true);
|
||||
|
||||
// Convert to Legacy
|
||||
if(CustomNpcs.legacyExist){
|
||||
EnableUpdateChecker = LegacyConfig.EnableUpdateChecker;
|
||||
|
||||
@@ -98,7 +98,7 @@ public enum EnumPacketServer {
|
||||
AnimationsGet, AnimationGet,
|
||||
AnimationRemove(CustomNpcsPermissions.GLOBAL_ANIMATION), AnimationSave(CustomNpcsPermissions.GLOBAL_ANIMATION),
|
||||
|
||||
RecipesGet, RecipeGet, QuestOpenGui, PlayerDataGet, QuestLogToServer,
|
||||
RecipesGet, RecipeGet, QuestOpenGui, PlayerDataGet, QuestLogToServer, PartyLogToServer, UntrackQuest,
|
||||
|
||||
RemoteNpcsGet(CustomNpcsPermissions.NPC_GUI),
|
||||
RemoteTpToNpc(CustomNpcsPermissions.NPC_TELEPORT),
|
||||
|
||||
@@ -2,7 +2,7 @@ package noppes.npcs.constants;
|
||||
|
||||
public enum EnumPlayerPacket {
|
||||
FollowerHire,FollowerExtend,Trader, FollowerState, Transport, BankUnlock, BankUpgrade,
|
||||
Dialog, QuestLog, CheckQuestCompletion, BankSlotOpen, FactionsGet,
|
||||
Dialog, QuestLog, TrackedQuest, CheckQuestCompletion, BankSlotOpen, FactionsGet,
|
||||
MailGet, MailDelete, MailSend, MailRead, MailboxOpenMail,
|
||||
SignSave, SaveBook, CompanionOpenInv, RoleGet, KeyPressed,
|
||||
MouseClicked, CompanionTalentExp, ScreenSize, MarkData
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ContainerCarpentryBench extends Container
|
||||
|
||||
this.onCraftMatrixChanged(this.craftMatrix);
|
||||
}
|
||||
|
||||
|
||||
public int getMetadata(){
|
||||
return worldObj.getBlockMetadata(posX, posY, posZ);
|
||||
}
|
||||
@@ -68,12 +68,12 @@ public class ContainerCarpentryBench extends Container
|
||||
{
|
||||
if(!this.worldObj.isRemote){
|
||||
RecipeCarpentry recipe = RecipeController.Instance.findMatchingRecipe(this.craftMatrix);
|
||||
|
||||
|
||||
ItemStack item = null;
|
||||
if(recipe != null && recipe.availability.isAvailable(player)){
|
||||
item = recipe.getCraftingResult(this.craftMatrix);
|
||||
}
|
||||
|
||||
|
||||
this.craftResult.setInventorySlotContents(0, item);
|
||||
EntityPlayerMP plmp = (EntityPlayerMP) player;
|
||||
plmp.playerNetServerHandler.sendPacket(new S2FPacketSetSlot(this.windowId, 0, item));
|
||||
@@ -166,6 +166,16 @@ public class ContainerCarpentryBench extends Container
|
||||
var3.onPickupFromSlot(par1EntityPlayer, var4);
|
||||
}
|
||||
|
||||
// Update client-side inventory
|
||||
if (!this.worldObj.isRemote && player instanceof EntityPlayerMP) {
|
||||
((EntityPlayerMP) player).sendContainerToPlayer(this);
|
||||
}
|
||||
|
||||
return var2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_94530_a(ItemStack stack, Slot slotIn) {
|
||||
return slotIn.inventory != this.craftResult && super.func_94530_a(stack, slotIn);
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class ContainerCustomGui extends Container {
|
||||
}
|
||||
|
||||
slotCount=0;
|
||||
inventorySlots.clear();
|
||||
// inventorySlots.clear();
|
||||
for (IItemSlot slot : this.customGui.getSlots()) {
|
||||
if (slot.hasStack()) {
|
||||
this.addSlot(player, slot.getPosX(), slot.getPosY(), slot, slot.getStack().getMCItemStack(), player.worldObj.isRemote);
|
||||
@@ -106,40 +106,59 @@ public class ContainerCustomGui extends Container {
|
||||
if(slotId < 0)
|
||||
return super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||
|
||||
if (slotId >= this.inventorySlots.size()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Slot mcSlot = (Slot)this.inventorySlots.get(slotId);
|
||||
if(!player.worldObj.isRemote && mcSlot != null) {
|
||||
if(!player.worldObj.isRemote) {
|
||||
IItemSlot slot = null;
|
||||
if (this.getSlot(slotId) instanceof CustomGuiSlot) {
|
||||
slot = ((CustomGuiSlot)this.getSlot(slotId)).slot;
|
||||
}
|
||||
if(!EventHooks.onCustomGuiSlotClicked((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui)player.openContainer).customGui, slotId, slot, dragType, clickTypeIn)) {
|
||||
ItemStack prevStack = mcSlot.getStack();
|
||||
if (slot != null) {
|
||||
prevStack = slot.getStack() == null ? null : slot.getStack().getMCItemStack();
|
||||
}
|
||||
ItemStack item = super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||
|
||||
if (!ItemStack.areItemStacksEqual(prevStack,item)) {
|
||||
if (slot != null) {
|
||||
slot.setStack(NpcAPI.Instance().getIItemStack(mcSlot.getStack()));
|
||||
}
|
||||
if (player.openContainer instanceof ContainerCustomGui) {
|
||||
EventHooks.onCustomGuiSlot((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui)player.openContainer).customGui,
|
||||
mcSlot.slotNumber, prevStack, slot);
|
||||
}
|
||||
}
|
||||
|
||||
EntityPlayerMP p = (EntityPlayerMP) player;
|
||||
p.sendContainerToPlayer(this);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
// if(slotId < 0)
|
||||
// return super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||
//
|
||||
// if (slotId >= this.inventorySlots.size()) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// Slot mcSlot = (Slot)this.inventorySlots.get(slotId);
|
||||
// if(!player.worldObj.isRemote && mcSlot != null) {
|
||||
// IItemSlot slot = null;
|
||||
// if (this.getSlot(slotId) instanceof CustomGuiSlot) {
|
||||
// slot = ((CustomGuiSlot)this.getSlot(slotId)).slot;
|
||||
// }
|
||||
// if(!EventHooks.onCustomGuiSlotClicked((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui)player.openContainer).customGui, slotId, slot, dragType, clickTypeIn)) {
|
||||
// ItemStack prevStack = mcSlot.getStack();
|
||||
// if (slot != null) {
|
||||
// prevStack = slot.getStack() == null ? null : slot.getStack().getMCItemStack();
|
||||
// }
|
||||
// ItemStack item = super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||
//
|
||||
// if (!ItemStack.areItemStacksEqual(prevStack,item)) {
|
||||
// if (slot != null) {
|
||||
// slot.setStack(NpcAPI.Instance().getIItemStack(mcSlot.getStack()));
|
||||
// }
|
||||
// if (player.openContainer instanceof ContainerCustomGui) {
|
||||
// EventHooks.onCustomGuiSlot((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui)player.openContainer).customGui,
|
||||
// mcSlot.slotNumber, prevStack, slot);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// EntityPlayerMP p = (EntityPlayerMP) player;
|
||||
// p.sendContainerToPlayer(this);
|
||||
// return item;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return null;
|
||||
}
|
||||
|
||||
public boolean canDragIntoSlot(Slot p_94531_1_) { return true; }
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
@@ -119,6 +120,7 @@ public class PartyController {
|
||||
if (party.getQuest() != null) {
|
||||
Quest quest = (Quest) party.getQuest();
|
||||
Vector<String> vector = quest.questInterface.getPartyQuestLogStatus(party);
|
||||
compound.setString("QuestName", quest.getCategory().getName() + ":" + quest.getName());
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (String s : vector) {
|
||||
list.appendTag(new NBTTagString(s));
|
||||
@@ -150,6 +152,7 @@ public class PartyController {
|
||||
Quest quest = (Quest) party.getQuest();
|
||||
Vector<String> vector = quest.questInterface.getPartyQuestLogStatus(party);
|
||||
NBTTagList list = new NBTTagList();
|
||||
compound.setString("QuestName", quest.getCategory().getName() + ":" + quest.getName());
|
||||
for (String s : vector) {
|
||||
list.appendTag(new NBTTagString(s));
|
||||
}
|
||||
@@ -201,7 +204,6 @@ public class PartyController {
|
||||
EventHooks.onPartyFinished(party, questData.quest);
|
||||
PartyController.Instance().sendQuestChat(party, "party.turnedInChat");
|
||||
} else {
|
||||
party.setQuest(null);
|
||||
PartyController.Instance().sendQuestChat(party, "party.completeChat");
|
||||
}
|
||||
PartyController.Instance().pingPartyUpdate(party);
|
||||
@@ -210,9 +212,17 @@ public class PartyController {
|
||||
questData.isCompleted = false;
|
||||
}
|
||||
|
||||
// if (this.trackedQuest != null && questData.quest.getId() == this.trackedQuest.getId()) {
|
||||
// NoppesUtilPlayer.sendTrackedQuestData((EntityPlayerMP) player);
|
||||
// }
|
||||
for (String name : party.getPlayerNames()) {
|
||||
EntityPlayer playerMP = NoppesUtilServer.getPlayerByName(name);
|
||||
if (playerMP != null) {
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(playerMP);
|
||||
if(playerData != null){
|
||||
if (playerData.questData.getTrackedQuest() != null && questData.quest.getId() == playerData.questData.getTrackedQuest().getId()) {
|
||||
NoppesUtilPlayer.sendPartyTrackedQuestData((EntityPlayerMP) playerMP, party);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,74 +20,68 @@ public class SyncController {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Faction Sync
|
||||
if(ConfigMain.SyncFactionAuto){
|
||||
for(Faction faction : FactionController.getInstance().factions.values()){
|
||||
NBTTagCompound factioNBT = new NBTTagCompound();
|
||||
faction.writeNBT(factioNBT);
|
||||
list.appendTag(factioNBT);
|
||||
if(list.tagCount() > 20){
|
||||
compound = new NBTTagCompound();
|
||||
compound.setTag("Data", list);
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.FACTION, compound);
|
||||
list = new NBTTagList();
|
||||
}
|
||||
for(Faction faction : FactionController.getInstance().factions.values()){
|
||||
NBTTagCompound factioNBT = new NBTTagCompound();
|
||||
faction.writeNBT(factioNBT);
|
||||
list.appendTag(factioNBT);
|
||||
if(list.tagCount() > 20){
|
||||
compound = new NBTTagCompound();
|
||||
compound.setTag("Data", list);
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.FACTION, compound);
|
||||
list = new NBTTagList();
|
||||
}
|
||||
compound = new NBTTagCompound();
|
||||
compound.setTag("Data", list);
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.FACTION, compound);
|
||||
}
|
||||
compound = new NBTTagCompound();
|
||||
compound.setTag("Data", list);
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.FACTION, compound);
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Quest Sync
|
||||
if(ConfigMain.SyncQuestAuto){
|
||||
for(QuestCategory category : QuestController.Instance.categories.values()){
|
||||
NBTTagCompound questCompound;
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for(int questID : category.quests.keySet()){
|
||||
Quest quest = category.quests.get(questID);
|
||||
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
|
||||
if(questList.tagCount() > 50){
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
questList = new NBTTagList();
|
||||
}
|
||||
for(QuestCategory category : QuestController.Instance.categories.values()){
|
||||
NBTTagCompound questCompound;
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for(int questID : category.quests.keySet()){
|
||||
Quest quest = category.quests.get(questID);
|
||||
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
|
||||
if(questList.tagCount() > 50){
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
questList = new NBTTagList();
|
||||
}
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
}
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.QUEST_CATEGORY, new NBTTagCompound());
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
}
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.QUEST_CATEGORY, new NBTTagCompound());
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Dialog Sync
|
||||
if(ConfigMain.SyncDialogAuto){
|
||||
for(DialogCategory category : DialogController.Instance.categories.values()){
|
||||
NBTTagCompound dialogCompound;
|
||||
NBTTagList dialogList = new NBTTagList();
|
||||
for(int dialogID : category.dialogs.keySet()){
|
||||
Dialog dialog = category.dialogs.get(dialogID);
|
||||
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
|
||||
if(dialogList.tagCount() > 50){
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogList = new NBTTagList();
|
||||
}
|
||||
for(DialogCategory category : DialogController.Instance.categories.values()){
|
||||
NBTTagCompound dialogCompound;
|
||||
NBTTagList dialogList = new NBTTagList();
|
||||
for(int dialogID : category.dialogs.keySet()){
|
||||
Dialog dialog = category.dialogs.get(dialogID);
|
||||
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
|
||||
if(dialogList.tagCount() > 50){
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogList = new NBTTagList();
|
||||
}
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
}
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.DIALOG_CATEGORY, new NBTTagCompound());
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
}
|
||||
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.DIALOG_CATEGORY, new NBTTagCompound());
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PlayerData data = PlayerData.get(player);
|
||||
@@ -96,97 +90,89 @@ public class SyncController {
|
||||
}
|
||||
|
||||
public static void syncAllDialogs() {
|
||||
if(ConfigMain.SyncDialogAuto){
|
||||
for(DialogCategory category : DialogController.Instance.categories.values()){
|
||||
NBTTagCompound dialogCompound;
|
||||
NBTTagList dialogList = new NBTTagList();
|
||||
for(int dialogID : category.dialogs.keySet()){
|
||||
Dialog dialog = category.dialogs.get(dialogID);
|
||||
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
|
||||
if(dialogList.tagCount() > 50){
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
}
|
||||
Server.sendToAll(EnumPacketClient.SYNC_END, SyncType.DIALOG_CATEGORY, new NBTTagCompound());
|
||||
}
|
||||
}
|
||||
|
||||
public static void syncAllQuests() {
|
||||
if(ConfigMain.SyncQuestAuto){
|
||||
for(QuestCategory category : QuestController.Instance.categories.values()){
|
||||
NBTTagCompound questCompound;
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for(int questID : category.quests.keySet()){
|
||||
Quest quest = category.quests.get(questID);
|
||||
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
|
||||
if(questList.tagCount() > 50){
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
questList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
}
|
||||
Server.sendToAll(EnumPacketClient.SYNC_END, SyncType.QUEST_CATEGORY, new NBTTagCompound());
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateQuestCat(QuestCategory questCategory) {
|
||||
if(ConfigMain.SyncQuestAuto){
|
||||
NBTTagCompound questCompound;
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for(int questID : questCategory.quests.keySet()){
|
||||
Quest quest = questCategory.quests.get(questID);
|
||||
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
|
||||
if(questList.tagCount() > 50){
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", questCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.QUEST_CATEGORY, questCompound);
|
||||
questList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", questCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.QUEST_CATEGORY, questCompound);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateDialogCat(DialogCategory dialogCategory) {
|
||||
if(ConfigMain.SyncDialogAuto){
|
||||
for(DialogCategory category : DialogController.Instance.categories.values()){
|
||||
NBTTagCompound dialogCompound;
|
||||
NBTTagList dialogList = new NBTTagList();
|
||||
for(int questID : dialogCategory.dialogs.keySet()){
|
||||
Dialog dialog = dialogCategory.dialogs.get(questID);
|
||||
for(int dialogID : category.dialogs.keySet()){
|
||||
Dialog dialog = category.dialogs.get(dialogID);
|
||||
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
|
||||
if(dialogList.tagCount() > 50){
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", dialogCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", dialogCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
}
|
||||
Server.sendToAll(EnumPacketClient.SYNC_END, SyncType.DIALOG_CATEGORY, new NBTTagCompound());
|
||||
}
|
||||
|
||||
public static void syncAllQuests() {
|
||||
for(QuestCategory category : QuestController.Instance.categories.values()){
|
||||
NBTTagCompound questCompound;
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for(int questID : category.quests.keySet()){
|
||||
Quest quest = category.quests.get(questID);
|
||||
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
|
||||
if(questList.tagCount() > 50){
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
questList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_ADD, SyncType.QUEST_CATEGORY, questCompound);
|
||||
}
|
||||
Server.sendToAll(EnumPacketClient.SYNC_END, SyncType.QUEST_CATEGORY, new NBTTagCompound());
|
||||
}
|
||||
|
||||
public static void updateQuestCat(QuestCategory questCategory) {
|
||||
NBTTagCompound questCompound;
|
||||
NBTTagList questList = new NBTTagList();
|
||||
for(int questID : questCategory.quests.keySet()){
|
||||
Quest quest = questCategory.quests.get(questID);
|
||||
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
|
||||
if(questList.tagCount() > 50){
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", questCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.QUEST_CATEGORY, questCompound);
|
||||
questList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
questCompound = new NBTTagCompound();
|
||||
questCompound.setTag("Data", questList);
|
||||
questCompound.setTag("CatNBT", questCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.QUEST_CATEGORY, questCompound);
|
||||
}
|
||||
|
||||
public static void updateDialogCat(DialogCategory dialogCategory) {
|
||||
NBTTagCompound dialogCompound;
|
||||
NBTTagList dialogList = new NBTTagList();
|
||||
for(int questID : dialogCategory.dialogs.keySet()){
|
||||
Dialog dialog = dialogCategory.dialogs.get(questID);
|
||||
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
|
||||
if(dialogList.tagCount() > 50){
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", dialogCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
dialogList = new NBTTagList();
|
||||
}
|
||||
}
|
||||
dialogCompound = new NBTTagCompound();
|
||||
dialogCompound.setTag("Data", dialogList);
|
||||
dialogCompound.setTag("CatNBT", dialogCategory.writeSmallNBT(new NBTTagCompound()));
|
||||
Server.sendToAll(EnumPacketClient.SYNC_UPDATE, SyncType.DIALOG_CATEGORY, dialogCompound);
|
||||
}
|
||||
|
||||
public static void clientSync(int synctype, NBTTagCompound compound, boolean syncEnd) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.api.handler.IPlayerQuestData;
|
||||
import noppes.npcs.api.handler.data.IParty;
|
||||
import noppes.npcs.api.handler.data.IQuest;
|
||||
import noppes.npcs.constants.*;
|
||||
import noppes.npcs.controllers.PartyController;
|
||||
@@ -183,6 +184,17 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
}
|
||||
}
|
||||
|
||||
public void trackParty(IParty party) {
|
||||
if(party == null)
|
||||
return;
|
||||
|
||||
IQuest quest = party.getQuest();
|
||||
if (this.trackedQuest == null || quest.getId() != this.trackedQuest.getId()) {
|
||||
this.trackedQuest = quest;
|
||||
NoppesUtilPlayer.sendPartyTrackedQuestData((EntityPlayerMP) this.parent.player, (Party) party);
|
||||
}
|
||||
}
|
||||
|
||||
public void untrackQuest() {
|
||||
if (this.trackedQuest != null) {
|
||||
this.trackedQuest = null;
|
||||
|
||||
@@ -567,12 +567,12 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
}
|
||||
break;
|
||||
case Stubborn:
|
||||
if (closerTargetFound && combatHandler.shouldChangeTarget((double) ai.tacticalChance / 100)) {
|
||||
if (closerTargetFound && combatHandler.shouldChangeTarget(ai.tacticalChance)) {
|
||||
setAttackTarget(attackingEntity);
|
||||
}
|
||||
break;
|
||||
case Tactical:
|
||||
if (attackingEntity != getAttackTarget() && combatHandler.shouldSwitchTactically(getAttackTarget(), attackingEntity)) {
|
||||
if (attackingEntity != getAttackTarget() && combatHandler.shouldSwitchTactically(getAttackTarget(), attackingEntity, ai.tacticalChance > 50)) {
|
||||
setAttackTarget(attackingEntity);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ItemNpcCloner extends Item{
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10){
|
||||
if(par3World.isRemote || !CustomNpcsPermissions.Instance.hasPermission(par2EntityPlayer, CustomNpcsPermissions.TOOL_CLONER))
|
||||
return true;
|
||||
return false;
|
||||
|
||||
NoppesUtilServer.setClonerGui((EntityPlayerMP) par2EntityPlayer, par4, par5, par6);
|
||||
return true;
|
||||
|
||||
@@ -38,41 +38,41 @@ public class ItemNpcMovingPath extends Item{
|
||||
NoppesUtilServer.sendOpenGui(par3EntityPlayer, EnumGuiType.MovingPath, npc);
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer player, World par3World, int x, int y, int z, int par7, float par8, float par9, float par10){
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer player, World par3World, int x, int y, int z, int par7, float par8, float par9, float par10){
|
||||
if(par3World.isRemote || !CustomNpcsPermissions.Instance.hasPermission(player, CustomNpcsPermissions.TOOL_MOUNTER))
|
||||
return false;
|
||||
EntityNPCInterface npc = getNpc(par1ItemStack, par3World);
|
||||
if(npc == null)
|
||||
return true;
|
||||
return false;
|
||||
List<int[]> list = npc.ai.getMovingPath();
|
||||
int[] pos = list.get(list.size() - 1);
|
||||
list.add(new int[]{x,y,z});
|
||||
|
||||
|
||||
double d3 = x - pos[0];
|
||||
double d4 = y - pos[1];
|
||||
double d5 = z - pos[2];
|
||||
double distance = (double)MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
|
||||
|
||||
player.addChatMessage(new ChatComponentText("Added point x:" + x + " y:"+ y + " z:" + z + " to npc " + npc.getCommandSenderName()));
|
||||
if(distance > ConfigMain.NpcNavRange)
|
||||
player.addChatMessage(new ChatComponentText("Warning: point is too far away from previous point. Max block walk distance = " + ConfigMain.NpcNavRange));
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private EntityNPCInterface getNpc(ItemStack item, World world){
|
||||
if(world.isRemote || item.stackTagCompound == null)
|
||||
return null;
|
||||
|
||||
|
||||
Entity entity = world.getEntityByID(item.stackTagCompound.getInteger("NPCID"));
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
return null;
|
||||
|
||||
|
||||
return (EntityNPCInterface) entity;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack par1ItemStack, int par2){
|
||||
return 0x8B4513;
|
||||
@@ -82,7 +82,7 @@ public class ItemNpcMovingPath extends Item{
|
||||
public boolean requiresMultipleRenderPasses(){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister par1IconRegister){
|
||||
|
||||
@@ -42,9 +42,10 @@ public class ItemNpcWand extends Item{
|
||||
public boolean onItemUse(ItemStack par1ItemStack, final EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
if(par3World.isRemote)
|
||||
return true;
|
||||
return false;
|
||||
if(ConfigMain.OpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile())){
|
||||
player.addChatMessage(new ChatComponentTranslation("availability.permission"));
|
||||
return false;
|
||||
}
|
||||
else if(CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.NPC_CREATE)){
|
||||
EntityCustomNpc npc = new EntityCustomNpc(par3World);
|
||||
@@ -56,10 +57,11 @@ public class ItemNpcWand extends Item{
|
||||
npc.setHealth(npc.getMaxHealth());
|
||||
|
||||
NoppesUtilServer.sendOpenGuiNoDelay(player, EnumGuiType.MainMenuDisplay,npc);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
player.addChatMessage(new ChatComponentTranslation("availability.permission"));
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -454,6 +454,28 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
|
||||
@Override
|
||||
public String getAdditionalText() {
|
||||
if(party != null && party.getObjectiveRequirement() == EnumPartyObjectives.All){
|
||||
List<String> incomplete = new ArrayList<>();
|
||||
for (UUID uuid: party.getPlayerUUIDs()) {
|
||||
EntityPlayer individual = NoppesUtilServer.getPlayer(uuid);
|
||||
PlayerData individualData;
|
||||
if(individual != null){
|
||||
individualData = PlayerDataController.Instance.getPlayerData(individual);
|
||||
}
|
||||
else {
|
||||
individualData = PlayerDataController.Instance.getPlayerDataCache(uuid.toString());
|
||||
}
|
||||
if(individualData != null){
|
||||
boolean read = individualData.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
if(!read) {
|
||||
incomplete.add(individualData.playername);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!incomplete.isEmpty())
|
||||
return "[" + String.join(", ", incomplete) + "]";
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.handler.data.IQuestInterface;
|
||||
import noppes.npcs.api.handler.data.IQuestObjective;
|
||||
import noppes.npcs.constants.EnumPartyObjectives;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.data.Party;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
@@ -24,7 +25,12 @@ public abstract class QuestInterface implements IQuestInterface {
|
||||
}
|
||||
}
|
||||
}
|
||||
public abstract Vector<String> getQuestLogStatus(EntityPlayer player);
|
||||
|
||||
public void handlePartyComplete(EntityPlayer player, Party party, boolean isLeader, EnumPartyObjectives objectives){
|
||||
handleComplete(player);
|
||||
}
|
||||
|
||||
public abstract Vector<String> getQuestLogStatus(EntityPlayer player);
|
||||
public abstract IQuestObjective[] getObjectives(EntityPlayer var1);
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import noppes.npcs.NpcMiscInventory;
|
||||
import noppes.npcs.api.handler.data.IQuestItem;
|
||||
import noppes.npcs.api.handler.data.IQuestObjective;
|
||||
import noppes.npcs.constants.EnumPartyObjectives;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.data.Party;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.scripted.CustomNPCsException;
|
||||
@@ -93,29 +92,47 @@ public class QuestItem extends QuestInterface implements IQuestItem {
|
||||
super.handleComplete(player);
|
||||
if(leaveItems)
|
||||
return;
|
||||
for(ItemStack questitem : items.items.values()){
|
||||
int stacksize = questitem.stackSize;
|
||||
for(int i = 0; i < player.inventory.mainInventory.length; i++){
|
||||
ItemStack item = player.inventory.mainInventory[i];
|
||||
if(item == null)
|
||||
continue;
|
||||
if(NoppesUtilPlayer.compareItems(item, questitem, ignoreDamage, ignoreNBT)){
|
||||
int size = item.stackSize;
|
||||
if(stacksize - size >= 0){
|
||||
player.inventory.setInventorySlotContents(i, null);
|
||||
item.splitStack(size);
|
||||
}
|
||||
else{
|
||||
item.splitStack(stacksize);
|
||||
}
|
||||
stacksize -= size;
|
||||
if(stacksize <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
removeItems(player);
|
||||
}
|
||||
|
||||
public void handlePartyComplete(EntityPlayer player, Party party, boolean isLeader, EnumPartyObjectives objectives){
|
||||
super.handlePartyComplete(player, party, isLeader, objectives);
|
||||
if(leaveItems)
|
||||
return;
|
||||
|
||||
if(isLeader && objectives == EnumPartyObjectives.Leader){
|
||||
removeItems(player);
|
||||
} else if (objectives == EnumPartyObjectives.All){
|
||||
removeItems(player);
|
||||
} else if (objectives == EnumPartyObjectives.Shared){
|
||||
// Shared Case
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItems(EntityPlayer player){
|
||||
for(ItemStack questitem : items.items.values()){
|
||||
int stacksize = questitem.stackSize;
|
||||
for(int i = 0; i < player.inventory.mainInventory.length; i++){
|
||||
ItemStack item = player.inventory.mainInventory[i];
|
||||
if(item == null)
|
||||
continue;
|
||||
if(NoppesUtilPlayer.compareItems(item, questitem, ignoreDamage, ignoreNBT)){
|
||||
int size = item.stackSize;
|
||||
if(stacksize - size >= 0){
|
||||
player.inventory.setInventorySlotContents(i, null);
|
||||
item.splitStack(size);
|
||||
}
|
||||
else{
|
||||
item.splitStack(stacksize);
|
||||
}
|
||||
stacksize -= size;
|
||||
if(stacksize <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector<String> getQuestLogStatus(EntityPlayer player) {
|
||||
Vector<String> vec = new Vector<String>();
|
||||
@@ -528,6 +545,29 @@ public class QuestItem extends QuestInterface implements IQuestItem {
|
||||
|
||||
@Override
|
||||
public String getAdditionalText() {
|
||||
if(party != null && party.getObjectiveRequirement() == EnumPartyObjectives.All) {
|
||||
List<String> incompletePlayers = new ArrayList<>();
|
||||
EnumPartyObjectives objectives = party.getObjectiveRequirement();
|
||||
for (String name : party.getPlayerNames()) {
|
||||
EntityPlayer playerMP = NoppesUtilServer.getPlayerByName(name);
|
||||
if (playerMP == null){
|
||||
incompletePlayers.add(name + ": " + "N/A");
|
||||
continue;
|
||||
}
|
||||
|
||||
int amount = 0;
|
||||
for (ItemStack is : playerMP.inventory.mainInventory) {
|
||||
if (NoppesUtilPlayer.compareItems(this.questItem, is, ignoreDamage, ignoreNBT))
|
||||
amount += is.stackSize;
|
||||
}
|
||||
|
||||
int completedSize = ValueUtil.clamp(amount, 0, this.questItem.stackSize);
|
||||
if(completedSize < this.questItem.stackSize)
|
||||
incompletePlayers.add(name + ": " + completedSize);
|
||||
}
|
||||
if(!incompletePlayers.isEmpty())
|
||||
return "[" + String.join(", ", incompletePlayers) + "]";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,11 +348,35 @@ public class QuestKill extends QuestInterface implements IQuestKill {
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
if(party != null) {
|
||||
if(party.getObjectiveRequirement() == EnumPartyObjectives.All ){
|
||||
return this.entity + ": " + this.getMaxProgress() + (isCompleted() ? " (Done)" : "");
|
||||
}
|
||||
}
|
||||
return this.entity + ": " + this.getProgress() + "/" + this.getMaxProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalText() {
|
||||
if(party != null) {
|
||||
List<String> incompletePlayers = new ArrayList<>();
|
||||
QuestData questdata = party.getQuestData();
|
||||
if (questdata != null) {
|
||||
if (questdata.quest.partyOptions.objectiveRequirement == EnumPartyObjectives.All) {
|
||||
for (String player : party.getPlayerNames()) {
|
||||
HashMap<String, Integer> killed = this.parent.getPlayerKilled(questdata, player);
|
||||
int currentProgress = !killed.containsKey(this.entity) ? 0 : (Integer) killed.get(this.entity);
|
||||
if(currentProgress < this.amount){
|
||||
String state = player + ": " + currentProgress;
|
||||
incompletePlayers.add(state);
|
||||
}
|
||||
}
|
||||
if(!incompletePlayers.isEmpty())
|
||||
return "[" + String.join(", ", incompletePlayers) + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,6 +260,17 @@ public class QuestLocation extends QuestInterface implements IQuestLocation {
|
||||
return vec;
|
||||
}
|
||||
|
||||
public boolean isMultiQuest(Party party){
|
||||
QuestData data = party.getQuestData();
|
||||
if(data == null)
|
||||
return false;
|
||||
|
||||
if(data.quest == null)
|
||||
return false;
|
||||
|
||||
return data.quest.partyOptions.objectiveRequirement == EnumPartyObjectives.All;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPartyCompleted(Party party) {
|
||||
if(party == null)
|
||||
@@ -383,7 +394,9 @@ public class QuestLocation extends QuestInterface implements IQuestLocation {
|
||||
}
|
||||
|
||||
public String getAdditionalText() {
|
||||
return "Completed: " + String.join(", ", completedPlayers);
|
||||
if(party != null && parent.isMultiQuest(party) && completedPlayers.size() != party.getPlayerNames().size())
|
||||
return "Completed: " + String.join(", ", completedPlayers);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,7 +256,7 @@ public class ScriptGui implements ICustomGui {
|
||||
for(int i = 0; i < list.tagCount(); i++){
|
||||
NBTBase b = list.getCompoundTagAt(i);
|
||||
ScriptGuiComponent component = ScriptGuiComponent.createFromNBT((NBTTagCompound)b);
|
||||
if (component != null) {
|
||||
if (component != null && !(component instanceof ScriptGuiItemSlot)) {
|
||||
components.put(component.getID(), component);
|
||||
}
|
||||
}
|
||||
@@ -267,6 +267,7 @@ public class ScriptGui implements ICustomGui {
|
||||
for(int i = 0; i < list.tagCount(); i++){
|
||||
NBTBase b = list.getCompoundTagAt(i);
|
||||
ScriptGuiItemSlot component = (ScriptGuiItemSlot)ScriptGuiComponent.createFromNBT((NBTTagCompound)b);
|
||||
components.put(component.getID(), component);
|
||||
slots.add(component);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiCNPCInventory;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiFaction;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiParty;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiQuestLog;
|
||||
import noppes.npcs.client.gui.player.inventory.*;
|
||||
|
||||
public class InventoryTabCustomNpc extends AbstractTab {
|
||||
public InventoryTabCustomNpc() {
|
||||
@@ -30,19 +27,19 @@ public class InventoryTabCustomNpc extends AbstractTab {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(mc.currentScreen instanceof GuiCNPCInventory)
|
||||
return;
|
||||
|
||||
switch (GuiCNPCInventory.activeTab){
|
||||
case 0:
|
||||
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
|
||||
mc.displayGuiScreen(new GuiQuestLog());
|
||||
break;
|
||||
case 1:
|
||||
mc.displayGuiScreen(new GuiParty(mc.thePlayer));
|
||||
mc.displayGuiScreen(new GuiParty());
|
||||
break;
|
||||
case 2:
|
||||
mc.displayGuiScreen(new GuiFaction());
|
||||
break;
|
||||
case 3:
|
||||
mc.displayGuiScreen(new GuiSettings());
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user