Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to dialog #161

Merged
merged 6 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ protected void build(FlowLayout rootComponent) {
}

if (guildPlayer.getCoins() >= coins) {
Translations.BANK_NO_SPEND.send(player);
this.close();
if (MinecraftClient.getInstance().getServer() == null) {
TaleOfKingdomsClient.getAPI().getClientPacket(Packets.BANKER_INTERACT)
Expand All @@ -81,6 +82,7 @@ protected void build(FlowLayout rootComponent) {
return;
}
if (guildPlayer.getBankerCoins() >= coins) {
Translations.BANK_THERE.send(player);
this.close();
if (MinecraftClient.getInstance().getServer() == null) {
TaleOfKingdomsClient.getAPI().getClientPacket(Packets.BANKER_INTERACT)
Expand All @@ -102,7 +104,6 @@ protected void build(FlowLayout rootComponent) {
@Override
public void close() {
super.close();
Translations.BANK_NO_SPEND.send(player);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,11 @@ public void init() {
final ButtonWidget fixWidget = this.addDrawableChild(ButtonWidget.builder(Text.translatable("menu.taleofkingdoms.guild_master.fix_guild"), widget -> {
final TaleOfKingdomsAPI api = TaleOfKingdoms.getAPI();
api.executeOnMain(() -> {
if (instance.isUnderAttack() || guildPlayer.getCoins() < 3000) return;
if (stack == null) return;
if (stack == null || guildPlayer.getCoins() < 3000) {
Translations.GUILDMASTER_NOT_ENOUGH_RESOURCES.send(player);
return;
}

if (MinecraftClient.getInstance().getServer() == null) {
((TaleOfKingdomsClientAPI) api).getClientPacket(Packets.FIX_GUILD)
.sendPacket(player, new FixGuildPacket());
Expand Down Expand Up @@ -170,7 +173,7 @@ public boolean shouldPause() {

@Override
public boolean shouldCloseOnEsc() {
return false;
return true;
}

private void makeContractSignButton() {
Expand Down Expand Up @@ -225,7 +228,7 @@ private void makeHireHuntersButton() {
this.hireHuntersButton = this.addDrawableChild(ButtonWidget.builder(hunterText, widget -> {
if (guildPlayer.getCoins() >= 1500) {
final TaleOfKingdomsAPI api = TaleOfKingdoms.getAPI();
Translations.SERVE.send(player);
Translations.HUNTER_SERVE.send(player);
if (MinecraftClient.getInstance().getServer() == null) {
api.getClientPacket(Packets.HIRE_HUNTER)
.sendPacket(player, new HireHunterPacket(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ public void init() {

final GuildPlayer guildPlayer = conquestInstance.getPlayer(player.getUuid());
if (guildPlayer.getCoins() < 10) {
Translations.INNKEEPER_NOT_ENOUGH_COINS.send(player);
return;
} else {
Translations.INNKEEPER_REST_SUCCESS.send(player);
}

MinecraftServer server = MinecraftClient.getInstance().getServer();
Expand Down Expand Up @@ -82,7 +85,10 @@ public void init() {

final GuildPlayer guildPlayer = conquestInstance.getPlayer(player.getUuid());
if (guildPlayer.getCoins() < 10) {
Translations.INNKEEPER_NOT_ENOUGH_COINS.send(player);
return;
} else {
Translations.INNKEEPER_WAIT_SUCCESS.send(player);
}

if (server == null) {
Expand All @@ -97,6 +103,7 @@ public void init() {

this.addDrawableChild(ButtonWidget.builder(Text.translatable("menu.taleofkingdoms.generic.exit"), widget -> {
this.close();
Translations.INNKEEPER_LEAVE.send(player);
}).dimensions(this.width / 2 - 75, this.height / 4 + 100, 150, 20).build());
}

Expand All @@ -116,10 +123,4 @@ public boolean shouldPause() {
public boolean shouldCloseOnEsc() {
return true;
}

@Override
public void close() {
super.close();
Translations.INNKEEPER_LEAVE.send(player);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public enum Translations {
GUILDMASTER_CONTRACT_CANCEL_AWAIT("entity_type.taleofkingdoms.guildmaster.contract.cancel.await"),
GUILDMASTER_WELCOME("entity_type.taleofkingdoms.guildmaster.welcome"),
GUILDMASTER_NOHUNTER("entity_type.taleofkingdoms.guildmaster.no_hunter"),
GUILDMASTER_NOT_ENOUGH_RESOURCES("entity_type.taleofkingdoms.guildmaster.not_enough_resources"),
GUILDMASTER_GOODHUNTING("entity_type.taleofkingdoms.guildmaster.good_hunting"),
GUILDMASTER_HELP("entity_type.taleofkingdoms.guildmaster.help"),
GUILDMASTER_STAY_CLOSE("entity_type.taleofkingdoms.guildmaster.stay_close"),
Expand All @@ -30,6 +31,9 @@ public enum Translations {
CITYBUILDER_GUI_CLOSE("entity_type.taleokfingdoms.citybuilder.gui.close"),
INNKEEPER_REST("entity_type.taleofkingdoms.innkeeper.rest"),
INNKEEPER_LEAVE("entity_type.taleofkingdoms.innkeeper.leave"),
INNKEEPER_NOT_ENOUGH_COINS("menu.taleofkingdoms.innkeeper.not_enough_coins"),
INNKEEPER_REST_SUCCESS("menu.taleofkingdoms.innkeeper.rest_success"),
INNKEEPER_WAIT_SUCCESS("menu.taleofkingdoms.innkeeper.wait_success"),
NEED_CONTRACT("generic.taleofkingdoms.need_contract"),
SERVE("generic.taleofkingdoms.serve"),
LONE_HELP("entity_type.taleofkingdoms.lone.help"),
Expand All @@ -40,6 +44,7 @@ public enum Translations {
BANK_INPUT("entity_type.taleofkingdoms.bank.input"),
BANK_ZERO("entity_type.taleofkingdoms.bank.zero"),
BANK_NO_SPEND("entity_type.taleofkingdoms.bank.no_spend"),
BANK_THERE("entity_type.taleofkingdoms.bank.there"),
GUILDMEMBER_START("entity_type.taleofkingdoms.guildmember.first"),
GUILDMEMBER_FIGHTER("entity_type.taleofkingdoms.guildmember.fighter"),
GUILDMEMBER_START_FIGHT("entity_type.taleofkingdoms.guildmember.start_fight"),
Expand All @@ -48,6 +53,7 @@ public enum Translations {
HUNTER_BOW("entity_type.taleofkingdoms.hunter.bow"),
HUNTER_SWORD("entity_type.taleofkingdoms.hunter.sword"),
HUNTER_THANK("entity_type.taleofkingdoms.hunter.thank"),
HUNTER_SERVE("entity_type.taleofkingdoms.hunter.serve"),
GOLD_COINS("generic.taleofkingdoms.gold_coins"),
START_CONQUEST("generic.taleofkingdoms.start_conquest"),
BUILDING_CASTLE("generic.taleofkingdoms.building_castle"),
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/assets/taleofkingdoms/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"menu.taleofkingdoms.innkeeper.rest": "Rest in a room.",
"menu.taleofkingdoms.innkeeper.no_rooms": "House Keeper: It seems there are no rooms available at this time.",
"menu.taleofkingdoms.innkeeper.wait": "Wait for night time.",
"menu.taleofkingdoms.innkeeper.not_enough_coins": "House Keeper: You don't have enough coins to stay here!",
"menu.taleofkingdoms.innkeeper.rest_success": "House Keeper: Sleep well!",
"menu.taleofkingdoms.innkeeper.wait_success": "House Keeper: Oh, how the time flies! You're a great conversation.",
"menu.taleofkingdoms.stock_market.stock_value": "Stock Market Value",
"menu.taleofkingdoms.foreman.total_money": "Foreman Menu - Total Money: %d Gold Coins",
"menu.taleofkingdoms.foreman.resources": "Resources",
Expand Down Expand Up @@ -90,6 +93,7 @@
"entity_type.taleofkingdoms.guildmaster.welcome": "Guild Master: Welcome to the order, hero.",
"entity_type.taleofkingdoms.guildmaster.good_hunting": "Guild Master: Good hunting.",
"entity_type.taleofkingdoms.guildmaster.no_hunter": "Guild Master: You have no hunters.",
"entity_type.taleofkingdoms.guildmaster.not_enough_resources": "Guild Master: Repairing the guild is no cheap matter! Come back when you have 64 logs and 3000 coins.",
"entity_type.taleofkingdoms.guildmaster.guild_order": "The Guild Order Total Money: ",
"entity_type.taleofkingdoms.guildmaster.path": "Path to Kingship",
"entity_type.taleofkingdoms.guildmaster.help": "Guild Master: My apprentice! The guild is under attack and I have come to ask for your help. We must hurry back to the guild!",
Expand All @@ -105,11 +109,13 @@
"entity_type.taleofkingdoms.hunter.thank": "Hunter: Thank you my liege!",
"entity_type.taleofkingdoms.hunter.bow": "Hunter: I shall use my bow.",
"entity_type.taleofkingdoms.hunter.sword": "Hunter: I shall use my sword.",
"entity_type.taleofkingdoms.hunter.serve": "Hunter: I will serve you, my liege!",
"entity_type.taleofkingdoms.innkeeper.rest": "House Keeper: Would you like to have some rest, sir?",
"entity_type.taleofkingdoms.innkeeper.leave": "House Keeper: Have a nice day.",
"entity_type.taleofkingdoms.shop.close": "Shop Keeper: Thank you! Come back again!",
"entity_type.taleofkingdoms.bank.open": "Banker: I will keep your gold safe!",
"entity_type.taleofkingdoms.bank.no_spend": "Banker: I promise I won't spend this.",
"entity_type.taleofkingdoms.bank.there": "Banker: There you go sir, that should be all the money you've requested.",
"entity_type.taleofkingdoms.bank.zero": "Banker: You have no money! Go fight mobs to earn some gold.",
"entity_type.taleofkingdoms.bank.input": "Banker: Please enter a number.",
"entity_type.taleofkingdoms.citybuilder.message": "City Builder: My king you are still not worthy of creating a kingdom. The Guild Master will prepare you!",
Expand Down
Loading