Skip to content

Commit c44054c

Browse files
committed
Merge changes
2 parents 61ae094 + 98257f7 commit c44054c

6 files changed

Lines changed: 91 additions & 17 deletions

File tree

src/main/java/io/github/mmagicala/gnomeRestaurant/GnomeRestaurantPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public class GnomeRestaurantPlugin extends Plugin {
118118

119119
// Overlay
120120

121-
private OverlayHeader overlayHeader = new OverlayHeader("null", -1, -1);
121+
private OverlayHeader overlayHeader = new OverlayHeader("null", -1, -1, customer, order);
122122
private final List<OverlayTableEntry> stepIngredientsOverlayTable = new ArrayList<>();
123123
private final List<OverlayTableEntry> nextRawIngredientsOverlayTable = new ArrayList<>();
124124

@@ -432,7 +432,7 @@ public void onItemContainerChanged(ItemContainerChanged event) {
432432

433433
private void updateOverlayHeader() {
434434
var instruction = order.getSteps().get(stepIdx).getInstruction().getOverlayDirections();
435-
overlayHeader = new OverlayHeader(instruction, stepIdx + 1, order.getSteps().size());
435+
overlayHeader = new OverlayHeader(instruction, stepIdx + 1, order.getSteps().size(), customer, order);
436436
}
437437

438438
private void rebuildOverlayTables() {

src/main/java/io/github/mmagicala/gnomeRestaurant/order/Customer.java

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import net.runelite.api.gameval.NpcID;
66

77
import java.security.InvalidParameterException;
8+
import java.util.Arrays;
9+
import java.util.List;
810

911
public enum Customer {
1012

@@ -32,16 +34,16 @@ public enum Customer {
3234
// Hard NPCs
3335
HAZELMERE(101, "Hazelmere", CustomerLocation.fixed(NpcID.GRANDTREE_HAZELMERE_MULTI, 2678, 3086)),
3436
GNORMADIUM_AVLAFRIM(102, "Gnormadium Avlafrim", CustomerLocation.fixed(NpcID.GNORMADIUM_AVLAFRIM_GLIDER, 2544, 2973)),
35-
CAPTAIN_NINTO(103, "Captain Ninto", CustomerLocation.fixed(NpcID.ALUFT_PILOT_NINTO, 2869, 9877)),
36-
CAPTAIN_DAERKIN(104, "Captain Daerkin", CustomerLocation.fixed(NpcID.ALUFT_PILOT_DAERKIN, 3355, 3210)),
37-
BRAMBICKLE(105, "Brambickle", CustomerLocation.fixed(NpcID.ALUFT_GNOME_EXPLORER_MOUNTAIN, 2786, 3862)),
38-
WINGSTONE(106, "Wingstone", CustomerLocation.fixed(NpcID.ALUFT_GNOME_EXPLORER_SAFARI, 3380, 2893)),
39-
PENWIE(107, "Penwie", CustomerLocation.fixed(NpcID.ALUFT_GNOME_EXPLORER_JUNGLE, 2932, 2972)),
37+
CAPTAIN_NINTO(103, "Captain Ninto", CustomerLocation.fixed(NpcID.ALUFT_PILOT_NINTO, 2869, 9877), Arrays.asList(Reward.GOGGLES, Reward.SCARF)),
38+
CAPTAIN_DAERKIN(104, "Captain Daerkin", CustomerLocation.fixed(NpcID.ALUFT_PILOT_DAERKIN, 3355, 3210), Arrays.asList(Reward.GOGGLES, Reward.SCARF)),
39+
BRAMBICKLE(105, "Brambickle", CustomerLocation.fixed(NpcID.ALUFT_GNOME_EXPLORER_MOUNTAIN, 2786, 3862), Arrays.asList(Reward.SEED_PODS, Reward.MINT_CAKE)),
40+
WINGSTONE(106, "Wingstone", CustomerLocation.fixed(NpcID.ALUFT_GNOME_EXPLORER_SAFARI, 3380, 2893), Arrays.asList(Reward.SEED_PODS, Reward.MINT_CAKE)),
41+
PENWIE(107, "Penwie", CustomerLocation.fixed(NpcID.ALUFT_GNOME_EXPLORER_JUNGLE, 2932, 2972), Arrays.asList(Reward.SEED_PODS, Reward.MINT_CAKE)),
4042
AMBASSADOR_GIMBLEWAP(108, "Ambassador Gimblewap", CustomerLocation.fixed(NpcID.ALUFT_GNOME_DIPLOMAT_ARDOUGNE, 2572, 3299)),
4143
AMBASSADOR_SPANFIPPLE(109, "Ambassador Spanfipple", CustomerLocation.fixed(NpcID.ALUFT_GNOME_DIPLOMAT_FALADOR, 2984, 3342, 1)),
4244
AMBASSADOR_FERRNOOK(110, "Ambassador Ferrnook", CustomerLocation.fixed(NpcID.ALUFT_GNOME_DIPLOMAT_VARROCK, 3209, 3474)),
4345
PROFESSOR_IMBLEWYN(111, "Professor Imblewyn", CustomerLocation.fixed(NpcID.ALUFT_GNOME_MAGE_2, 2590, 3092)),
44-
PROFESSOR_MANGLETHORP(112, "Professor Manglethorp", CustomerLocation.fixed(NpcID.ALUFT_GNOME_INVENTOR, 2868, 10198)),
46+
PROFESSOR_MANGLETHORP(112, "Professor Manglethorp", CustomerLocation.fixed(NpcID.ALUFT_GNOME_INVENTOR, 2868, 10198), Arrays.asList(Reward.SEED_PODS)),
4547
PROFESSOR_ONGLEWIP(113, "Professor Onglewip", CustomerLocation.fixed(NpcID.ALUFT_GNOME_MAGE, 3115, 3160)),
4648
GARKOR(114, "Garkor", new GarkorLocation()),
4749
KING_BOLREN(115, "King Bolren", CustomerLocation.fixed(NpcID.KING_BOLREN, 2542, 3169)),
@@ -54,6 +56,7 @@ public enum Customer {
5456
private final int id;
5557
private final String name;
5658
private final CustomerLocation location;
59+
private final List<Reward> uniqueRewards;
5760

5861
public static Customer forId(int id) {
5962
for (var recipient : values()) {
@@ -64,10 +67,17 @@ public static Customer forId(int id) {
6467
throw new InvalidParameterException("No customer found with the id " + id);
6568
}
6669

70+
Customer(int id, String name, CustomerLocation location, List<Reward> uniqueRewards) {
71+
this.id = id;
72+
this.name = name;
73+
this.location = location;
74+
this.uniqueRewards = uniqueRewards;
75+
}
6776
Customer(int id, String name, CustomerLocation location) {
6877
this.id = id;
6978
this.name = name;
7079
this.location = location;
80+
this.uniqueRewards = Arrays.asList();
7181
}
7282

7383
public String getName() {
@@ -85,4 +95,8 @@ public int getNpcTypeId(Client client) {
8595
public WorldPoint getLocation(Client client) {
8696
return this.location.resolve(client);
8797
}
98+
99+
public List<Reward> getUniqueRewards() {
100+
return this.uniqueRewards;
101+
}
88102
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
/*
3+
* Copyright (c) 2020, MMagicala <https://github.com/MMagicala>
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* Redistributions of source code must retain the above copyright notice, this
10+
* list of conditions and the following disclaimer.
11+
*
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
28+
package io.github.mmagicala.gnomeRestaurant.order;
29+
30+
import net.runelite.api.gameval.ItemID;
31+
32+
public enum Reward {
33+
GOGGLES(ItemID.ALUFT_GNOME_GOGGLES),
34+
SCARF(ItemID.ALUFT_GNOME_SCARF),
35+
SEED_PODS(ItemID.ALUFT_SEED_POD),
36+
MINT_CAKE(ItemID.ALUFT_GNOME_MINT_CAKE);
37+
38+
private final int itemId;
39+
40+
Reward(int itemId) {
41+
this.itemId = itemId;
42+
}
43+
44+
public int getItemId() {
45+
return this.itemId;
46+
}
47+
}

src/main/java/io/github/mmagicala/gnomeRestaurant/overlay/GnomeRestaurantOverlay.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,29 @@ public GnomeRestaurantOverlay(
6969

7070
@Override
7171
public Dimension render(Graphics2D graphics) {
72-
// Header
7372
var header = plugin.overlayHeader();
74-
String headerText = "Step " + header.stepNum + "/" + header.totalSteps + ": " + header.instruction;
73+
renderOrderOverlay(header);
74+
return super.render(graphics);
75+
}
7576

76-
LineComponent headerComponent = LineComponent.builder().left(headerText).build();
77-
panelComponent.getChildren().add(headerComponent);
77+
private void renderOrderOverlay(OverlayHeader header) {
78+
String headerCustomerText = header.order.getName() + " to " + header.customer.getName();
79+
LineComponent headerCustomerComponent = LineComponent.builder().left(headerCustomerText).build();
80+
if (!header.customer.getUniqueRewards().isEmpty()) {
81+
headerCustomerComponent.setLeftColor(Color.CYAN);
82+
}
83+
panelComponent.getChildren().add(headerCustomerComponent);
7884

79-
// Overlay tables
85+
String headerStepText = "Step " + header.stepNum + "/" + header.totalSteps + ": " + header.instruction;
86+
LineComponent headerStepComponent = LineComponent.builder().left(headerStepText).build();
87+
panelComponent.getChildren().add(headerStepComponent);
8088

8189
renderOverlayTable(stepIngredientsOverlayTable, "Current Step");
8290

8391
if (!futureRawIngredientsOverlayTable.isEmpty()) {
8492
// Only render future ingredients if there are any left
8593
renderOverlayTable(futureRawIngredientsOverlayTable, "Needed Later");
8694
}
87-
88-
return super.render(graphics);
8995
}
9096

9197
private void renderOverlayTable(List<OverlayTableEntry> overlayTable, String title) {
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
package io.github.mmagicala.gnomeRestaurant.overlay;
22

3+
import io.github.mmagicala.gnomeRestaurant.order.Customer;
4+
import io.github.mmagicala.gnomeRestaurant.recipe.Order;
5+
36
public class OverlayHeader {
47

58
public final String instruction;
69
public final int stepNum;
710
public final int totalSteps;
11+
public final Customer customer;
12+
public final Order order;
813

9-
public OverlayHeader(String instruction, int stepNum, int totalSteps) {
14+
public OverlayHeader(String instruction, int stepNum, int totalSteps, Customer customer, Order order) {
1015
this.instruction = instruction;
1116
this.stepNum = stepNum;
1217
this.totalSteps = totalSteps;
18+
this.customer = customer;
19+
this.order = order;
1320
}
1421
}

src/main/java/io/github/mmagicala/gnomeRestaurant/recipe/RecipeInstruction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public enum RecipeInstruction {
3737
POUR("Pour mix into the cocktail glass"),
3838
HEAT_COCKTAIL("Heat the cocktail"),
3939

40-
DELIVER("Deliver the item to recipient");
40+
DELIVER("Deliver the item");
4141

4242
private final String overlayDirections;
4343

0 commit comments

Comments
 (0)