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

Dynamic shops v2 Electric Boogaloo #425

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4d2c1ec
adding pagination to shop to allow for more items
TheDanDLion Aug 13, 2023
646f160
applying relic discounts, only setting isPurchased when it's not a st…
TheDanDLion Aug 14, 2023
79a3bab
setting y position for store relic/potion so they can be in either ro…
TheDanDLion Aug 14, 2023
098ae04
Merge branch 'daviscook477:master' into dynamic-shops
TheDanDLion Jan 18, 2024
bc4a03b
cleaning up shop pagination
TheDanDLion Jan 19, 2024
a466a17
maybe fixed it, also added custom pages
TheDanDLion Jan 19, 2024
244005a
bruh
TheDanDLion Jan 19, 2024
11eeacb
finally fixed spacing, now gotta do alignment
TheDanDLion Jan 19, 2024
667afdf
fleshed out commands, fixed alignment
TheDanDLion Jan 20, 2024
d8ff4de
added commands and some other stuff
TheDanDLion Jan 20, 2024
a0e724c
add debug box, add special case to use normal Y position when row = 2
TheDanDLion Jan 20, 2024
1e0fd4a
fix some things, mainly the page stuff
TheDanDLion Jan 20, 2024
385f67f
fix default spacing issue
TheDanDLion Jan 20, 2024
13a86bd
whelp
TheDanDLion Jan 20, 2024
1face0d
fixing bugs in commands and patches
TheDanDLion Jan 21, 2024
a6d0bb3
making more resilient
TheDanDLion Jan 21, 2024
99c3497
modify text and gold rendering so it looks better
TheDanDLion Jan 21, 2024
4b42625
add price tag when grid is dense, fixed pricing
TheDanDLion Jan 22, 2024
c0dd53b
fix up commands, disable patches for incompatible potions/relics
TheDanDLion Jan 22, 2024
bb47f35
fix compatiblity issue, fix page removal issue
TheDanDLion Jan 22, 2024
8b894da
fix weird edge case
TheDanDLion Jan 22, 2024
4ab7954
polishing up custom shop item, nav button
TheDanDLion Feb 3, 2024
ee6b678
dont set potion & storePotion to null
TheDanDLion Feb 9, 2024
12e6246
tweaks to make it compatible with SpicyShops
TheDanDLion Feb 9, 2024
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
Prev Previous commit
Next Next commit
bruh
  • Loading branch information
TheDanDLion committed Jan 19, 2024
commit 244005a8064dc550a069df19daeb9d3f7864465c
4 changes: 2 additions & 2 deletions mod/src/main/java/basemod/abstracts/CustomShopItem.java
Original file line number Diff line number Diff line change
@@ -60,16 +60,16 @@ public CustomShopItem(AbstractPotion potion) {
this(new StorePotion(potion, 0, AbstractDungeon.shopScreen));
}

@SuppressWarnings("unchecked")
public CustomShopItem(StoreRelic storeRelic) {
this.storeRelic = storeRelic;
@SuppressWarnings("unchecked")
ArrayList<StoreRelic> relics = (ArrayList<StoreRelic>)ReflectionHacks.getPrivate(AbstractDungeon.shopScreen, ShopScreen.class, "relics");
relics.add(this.storeRelic);
}

@SuppressWarnings("unchecked")
public CustomShopItem(StorePotion storePotion) {
this.storePotion = storePotion;
@SuppressWarnings("unchecked")
ArrayList<StorePotion> potions = (ArrayList<StorePotion>)ReflectionHacks.getPrivate(AbstractDungeon.shopScreen, ShopScreen.class, "potions");
potions.add(this.storePotion);
}
Original file line number Diff line number Diff line change
@@ -51,27 +51,42 @@ public static void HideGridOnOpen() {
@SpirePatch2(clz = ShopScreen.class, method = "initRelics")
public static class InitRelics {

@SpirePostfixPatch
public static void AddGridRelics(ArrayList<StoreRelic> ___relics) {
for (StoreRelic relic : ___relics) {
CustomShopItem item = new CustomShopItem();
item.storeRelic = relic;
ShopGrid.tryAddItem(item);
@SpireInsertPatch(locator = ArrayAddLocator.class, localvars = { "relic" })
public static void AddGridRelics(StoreRelic relic) {
CustomShopItem item = new CustomShopItem();
item.storeRelic = relic;
ShopGrid.tryAddItem(item);
}

private static class ArrayAddLocator extends SpireInsertLocator {

@Override
public int[] Locate(CtBehavior ct) throws Exception {
return LineFinder.findInOrder(ct, new Matcher.MethodCallMatcher(ArrayList.class, "add"));
}
}
}

@SpirePatch2(clz = ShopScreen.class, method = "initPotions")
public static class PostInitPotions {

@SpirePostfixPatch
public static void AddGridPotionsAndSetCoords(ArrayList<StorePotion> ___potions) {
for (StorePotion potion : ___potions) {
CustomShopItem item = new CustomShopItem();
item.storePotion = potion;
ShopGrid.tryAddItem(item);
@SpireInsertPatch(locator = ArrayAddLocator.class, localvars = { "potion" })
public static void AddGridPotions(StorePotion potion) {
CustomShopItem item = new CustomShopItem();
item.storePotion = potion;
ShopGrid.tryAddItem(item);
}

private static class ArrayAddLocator extends SpireInsertLocator {

@Override
public int[] Locate(CtBehavior ct) throws Exception {
return LineFinder.findInOrder(ct, new Matcher.MethodCallMatcher(ArrayList.class, "add"));
}
}

@SpirePostfixPatch
public static void SetItemCoords() {
for (ShopGrid.Row row : ShopGrid.currentPage.rows) {
for (CustomShopItem item : row.items) {
if (item.storePotion != null) {