Skip to content

Commit

Permalink
Single item crafting fix: show ConfirmDialog when player only has eno…
Browse files Browse the repository at this point in the history
…ugh resources for 1 item instead of instantly crafting it

* New logging output function: dbg(), works only if debugMode is set. Regular out() now works even when not in debug mode, but can be silenced with "silent" launch arg
  • Loading branch information
Hitonoriol committed May 13, 2021
1 parent 83dd4e0 commit dd79a00
Show file tree
Hide file tree
Showing 26 changed files with 259 additions and 258 deletions.
6 changes: 0 additions & 6 deletions build-jar

This file was deleted.

42 changes: 21 additions & 21 deletions core/assets/skills.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"Crafting" : {
"requiredExp" : 5,
"lvUpMultiplier" : 1.0
},
"Fishing" : {
"requiredExp" : 15,
"lvUpMultiplier" : 0.35
},
"Woodcutting" : {
"requiredExp" : 15,
"lvUpMultiplier" : 0.1
},
"Evasion" : {
"requiredExp" : 50,
"lvUpMultiplier" : 0.55
},
"Level" : {
"requiredExp" : 85,
"lvUpMultiplier" : 0.85
}
{
"Crafting" : {
"requiredExp" : 10,
"lvUpMultiplier" : 1.0
},
"Fishing" : {
"requiredExp" : 15,
"lvUpMultiplier" : 0.35
},
"Woodcutting" : {
"requiredExp" : 30,
"lvUpMultiplier" : 0.25
},
"Evasion" : {
"requiredExp" : 50,
"lvUpMultiplier" : 0.55
},
"Level" : {
"requiredExp" : 85,
"lvUpMultiplier" : 0.85
}
}
2 changes: 1 addition & 1 deletion core/src/hitonoriol/madsand/GameSaver.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public static boolean loadLocation(int wx, int wy) {
try {
Path fileLocation = Paths.get(getSectorFile(wx, wy).toURI());
byte[] data = Files.readAllBytes(fileLocation);
Utils.out("Loading location " + wx + ", " + wy);
Utils.out("Loading location [%d, %d]", wx, wy);

MadSand.world.worldMapSaver.loadLocationInfo(wx, wy);
MadSand.world.worldMapSaver.bytesToLocation(data, wx, wy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private TextButton generateDialog(String dialogBody, GameDialog dialog) { // ret
buttonString = buttonMatcher.group(1);

if (buttonString.contains(DIALOG_BTN_SCRIPT_DELIMITER)) {
Utils.out("Contains Script Character! buttonString: [" + buttonString + "]");
Utils.dbg("Contains Script Character! buttonString: [" + buttonString + "]");
buttonTokens = buttonString.split(DIALOG_BTN_SCRIPT_DELIMITER); // [Button Text @ lua code]
scriptButton = new TextButton(buttonTokens[0], Gui.skin);
final String buttonScriptString = buttonTokens[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void init() {
}

public static void add(String var, String subText) {
Utils.out("Substitutor: Setting " + DELIM_L + var + DELIM_R + " to \"" + subText + "\"");
Utils.dbg("Substitutor: Setting " + DELIM_L + var + DELIM_R + " to \"" + subText + "\"");
instance.globalConstants.put(var, subText);
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/hitonoriol/madsand/entities/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ public TextureRegion getSprite() {
}

public void setActDelay(float actDelay) {
Utils.out(getName() + ": adding actDelay: +" + actDelay);
Utils.dbg(getName() + ": adding actDelay: +" + actDelay);
this.actDelay += actDelay;
}

public float getActDelay() {
float delay = actDelay;

if (delay > 0)
Utils.out(getName() + ": actDelay=" + delay);
Utils.dbg(getName() + ": actDelay=" + delay);

actDelay = 0;
return delay;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public ArrayList<Item> roll(TradeCategory category, int tier) {
list = getTradeItemList(category, tier);

for (int i = tier; i >= 0; i--) {
Utils.out("Rolling tradeList " + category + " tier: " + tier);
Utils.dbg("Rolling tradeList " + category + " tier: " + tier);

if (!all)
getTradeItemList(category, tier).roll(items);
Expand Down
6 changes: 3 additions & 3 deletions core/src/hitonoriol/madsand/entities/inventory/Inventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ public void refreshWeight() {
}

public void dump() {
Utils.out("Inventory dump: ");
Utils.out("Weight: " + curWeight + " / " + maxWeight);
items.forEach(item -> Utils.out(item.toString()));
Utils.dbg("Inventory dump: ");
Utils.dbg("Weight: " + curWeight + " / " + maxWeight);
items.forEach(item -> Utils.dbg(item.toString()));
}

public int getIndex(Item item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void launchProjectile(Pair from, Pair to, Consumer<MapEntity> impactActio

to.toWorld();
Map map = MadSand.world.getCurLoc();
Utils.out("Projectile " + name + " will land on " + to.toString());
Utils.dbg("Projectile " + name + " will land on " + to.toString());

projectileImg.addAction(
Actions.sequence(
Expand Down
4 changes: 2 additions & 2 deletions core/src/hitonoriol/madsand/entities/quest/QuestWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public boolean isQuestCompleted(int id) {
}

private void startQuest(Quest quest, long npcUID) {
Utils.out("Trying to start quest " + quest.id);
Utils.dbg("Trying to start quest " + quest.id);

if (isQuestCompleted(quest.id))
return;
Expand Down Expand Up @@ -201,7 +201,7 @@ private void completeQuest(Quest quest) {
}

public void processQuest(int id, long npcUID) {
Utils.out("Processing quest " + id);
Utils.dbg("Processing quest " + id);

Quest quest = questById(id);

Expand Down
Loading

0 comments on commit dd79a00

Please sign in to comment.