v3.1.0: fixed free pickaxe from smith quest using quest score not favor
This commit is contained in:
@@ -214,6 +214,7 @@ public class Blacksmith extends NPC {
|
||||
//reward tracking. Stores remaining favor, the pickaxe, and how many of each reward has been chosen
|
||||
public static int favor;
|
||||
public static Item pickaxe;
|
||||
public static boolean freePickaxe;
|
||||
public static int reforges;
|
||||
public static int hardens;
|
||||
public static int upgrades;
|
||||
@@ -235,6 +236,7 @@ public class Blacksmith extends NPC {
|
||||
|
||||
favor = 0;
|
||||
pickaxe = new Pickaxe().identify();
|
||||
freePickaxe = false;
|
||||
reforges = 0;
|
||||
hardens = 0;
|
||||
upgrades = 0;
|
||||
@@ -258,6 +260,7 @@ public class Blacksmith extends NPC {
|
||||
|
||||
private static final String FAVOR = "favor";
|
||||
private static final String PICKAXE = "pickaxe";
|
||||
private static final String FREE_PICKAXE= "free_pickaxe";
|
||||
private static final String REFORGES = "reforges";
|
||||
private static final String HARDENS = "hardens";
|
||||
private static final String UPGRADES = "upgrades";
|
||||
@@ -282,6 +285,7 @@ public class Blacksmith extends NPC {
|
||||
|
||||
node.put( FAVOR, favor );
|
||||
if (pickaxe != null) node.put( PICKAXE, pickaxe );
|
||||
node.put( FREE_PICKAXE, freePickaxe );
|
||||
node.put( REFORGES, reforges );
|
||||
node.put( HARDENS, hardens );
|
||||
node.put( UPGRADES, upgrades );
|
||||
@@ -317,6 +321,16 @@ public class Blacksmith extends NPC {
|
||||
} else {
|
||||
pickaxe = null;
|
||||
}
|
||||
if (node.contains(FREE_PICKAXE)){
|
||||
freePickaxe = node.getBoolean(FREE_PICKAXE);
|
||||
} else {
|
||||
//some for pre-3.1 saves, some from incorrect values from v3.1-BETA-1.0
|
||||
if (favor >= 2500){
|
||||
freePickaxe = true;
|
||||
} else {
|
||||
freePickaxe = false;
|
||||
}
|
||||
}
|
||||
reforges = node.getInt( REFORGES );
|
||||
hardens = node.getInt( HARDENS );
|
||||
upgrades = node.getInt( UPGRADES );
|
||||
@@ -453,12 +467,16 @@ public class Blacksmith extends NPC {
|
||||
if (bossBeaten) favor += 1000;
|
||||
|
||||
Statistics.questScores[2] += favor;
|
||||
|
||||
if (favor >= 2500){
|
||||
freePickaxe = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean rewardsAvailable(){
|
||||
return favor > 0
|
||||
|| (Quest.smithRewards != null && Quest.smiths > 0)
|
||||
|| (pickaxe != null && Statistics.questScores[2] >= 2500);
|
||||
|| (pickaxe != null && freePickaxe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith;
|
||||
@@ -76,7 +75,7 @@ public class WndBlacksmith extends Window {
|
||||
|
||||
ArrayList<RedButton> buttons = new ArrayList<>();
|
||||
|
||||
int pickaxeCost = Statistics.questScores[2] >= 2500 ? 0 : 250;
|
||||
int pickaxeCost = Blacksmith.Quest.freePickaxe ? 0 : 250;
|
||||
RedButton pickaxe = new RedButton(Messages.get(this, "pickaxe", pickaxeCost), 6){
|
||||
@Override
|
||||
protected void onClick() {
|
||||
|
||||
Reference in New Issue
Block a user