Bank packet

This commit is contained in:
somehussar committed 2025-02-02 22:57:46 +01:00
1 parent 30e58dc049
commit 864e1cb8c7
5 files changed
+146 -36

No files matched your search

@@ -158,27 +158,27 @@ public class PacketHandlerPlayer{
return;
NoppesUtilPlayer.transport(player, npc, ByteBufUtils.readString(buffer));
}
else if(type == EnumPlayerPacket.BankUpgrade){
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
if(npc == null || npc.advanced.role != EnumRoleType.Bank)
return;
NoppesUtilPlayer.bankUpgrade(player, npc);
}
else if(type == EnumPlayerPacket.BankUnlock){
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
if(npc == null || npc.advanced.role != EnumRoleType.Bank)
return;
NoppesUtilPlayer.bankUnlock(player, npc);
}
else if(type == EnumPlayerPacket.BankSlotOpen){
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
if(npc == null || npc.advanced.role != EnumRoleType.Bank)
return;
int slot = buffer.readInt();
int bankId = buffer.readInt();
BankData data = PlayerDataController.Instance.getBankData(player,bankId).getBankOrDefault(bankId);
data.openBankGui(player, npc, bankId, slot);
}
// else if(type == EnumPlayerPacket.BankUpgrade){
// EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
// if(npc == null || npc.advanced.role != EnumRoleType.Bank)
// return;
// NoppesUtilPlayer.bankUpgrade(player, npc);
// }
// else if(type == EnumPlayerPacket.BankUnlock){
// EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
// if(npc == null || npc.advanced.role != EnumRoleType.Bank)
// return;
// NoppesUtilPlayer.bankUnlock(player, npc);
// }
// else if(type == EnumPlayerPacket.BankSlotOpen){
// EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
// if(npc == null || npc.advanced.role != EnumRoleType.Bank)
// return;
// int slot = buffer.readInt();
// int bankId = buffer.readInt();
// BankData data = PlayerDataController.Instance.getBankData(player,bankId).getBankOrDefault(bankId);
// data.openBankGui(player, npc, bankId, slot);
// }
else if(type == EnumPlayerPacket.Dialog){
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
if(npc == null)
@@ -1,5 +1,7 @@
package noppes.npcs.client.gui.player;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.player.BankPacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
@@ -26,7 +28,7 @@ public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiDat
private int maxSlots = 1;
private int unlockedSlots = 1;
private ItemStack currency;
public GuiNPCBankChest(EntityNPCInterface npc,ContainerNPCBankInterface container)
{
super(npc,container);
@@ -35,7 +37,7 @@ public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiDat
allowUserInput = false; //allowUserInput
ySize = 235;
closeOnEsc = true;
}
@Override
public void initGui(){
@@ -70,18 +72,18 @@ public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiDat
int id = guibutton.id;
if(id < 6){
close();
NoppesUtilPlayer.sendData(EnumPlayerPacket.BankSlotOpen, id, container.bankid);
PacketClient.sendClient(BankPacket.Open(container.bankid, id));
}
if(id == 8){
NoppesUtilPlayer.sendData(EnumPlayerPacket.BankUnlock);
PacketClient.sendClient(BankPacket.Unlock());
}
if(id == 9){
NoppesUtilPlayer.sendData(EnumPlayerPacket.BankUpgrade);
PacketClient.sendClient(BankPacket.Upgrade());
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
@@ -91,8 +93,8 @@ public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiDat
int i1 = (height - ySize) / 2;
drawTexturedModalRect(l, i1, 0, 0, xSize, 6);
if(!container.isAvailable()){
drawTexturedModalRect(l, i1 + 6, 0, 6, xSize, 64);
drawTexturedModalRect(l, i1 + 70, 0, 124, xSize, 222-124);
drawTexturedModalRect(l, i1 + 6, 0, 6, xSize, 64);
drawTexturedModalRect(l, i1 + 70, 0, 124, xSize, 222-124);
int x = guiLeft + 30;
int y = guiTop + 8;
fontRendererObj.drawString(StatCollector.translateToLocal("bank.unlockCosts")+":", x , y + 4 , CustomNpcResourceListener.DefaultTextColor);
@@ -100,7 +102,7 @@ public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiDat
}
else if(container.isUpgraded()){
drawTexturedModalRect(l, i1 + 60, 0, 60, xSize, 162);
drawTexturedModalRect(l, i1 + 6, 0, 60, xSize, 64);
drawTexturedModalRect(l, i1 + 6, 0, 60, xSize, 64);
}
else if(container.canBeUpgraded()){
drawTexturedModalRect(l, i1 + 6, 0, 6, xSize, 216);
@@ -136,7 +138,7 @@ public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiDat
{
this.renderToolTip(item, mouseX, mouseY);
}
RenderHelper.disableStandardItemLighting();
RenderHelper.disableStandardItemLighting();
GL11.glColor4f(1, 1, 1, 1);
}
@Override
@@ -5,13 +5,13 @@ public enum EnumPlayerPacket {
// FollowerExtend,
// FollowerState,
Transport,
BankUnlock,
BankUpgrade,
// BankUnlock,
// BankUpgrade,
Dialog,
QuestLog,
TrackedQuest,
CheckQuestCompletion,
BankSlotOpen,
// BankSlotOpen,
FactionsGet,
MailGet,
MailDelete,