Skip to content

Commit

Permalink
Merge branch 'pokeclicker:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
EatPant2nd authored Jul 27, 2023
2 parents 4348bf9 + 889ef93 commit c40474e
Show file tree
Hide file tree
Showing 12 changed files with 220 additions and 88 deletions.
185 changes: 134 additions & 51 deletions src/components/questModal.html
Original file line number Diff line number Diff line change
@@ -1,61 +1,144 @@
<div class="modal noselect fade" id="QuestModal" tabindex="-1" role="dialog" aria-labelledby="QuestModalLabel">
<div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-header p-0">
<ul class="nav nav-tabs nav-fill w-100">
<li class="nav-item" onclick="$('#refreshQuests').show()"><a class="nav-link active" href="#questsModalQuestsPane" data-toggle="tab">Quests</a></li>
<li class="nav-item" onclick="$('#refreshQuests').hide()"><a class="nav-link" href="#questsModalQuestLinesPane" data-toggle="tab">Quest Lines</a></li>
</ul>
</div>
<div class="modal-body p-0">
<div class="tab-content">

<div class="col-3">
<h5>
<span class='' data-bind='text: "Quests (" + App.game.quests.currentQuests().length + "/" + App.game.quests.questSlots() + ")"'>
</span>
</h5>
</div>
<div class='col-6' data-bind="tooltip : App.game.quests.questProgressTooltip()">
<div>Lvl. <knockout data-bind='text: App.game.quests.level'></knockout></div>
<div class="progress" style='height: 5px'>
<div class="progress-bar bg-info" role="progressbar"
data-bind="attr:{ style: 'width:' + App.game.quests.percentToNextQuestLevel() + '%' }"
aria-valuemin="0" aria-valuemax="100">
<!-- Quests -->
<div class="tab-pane active" id="questsModalQuestsPane">
<div class="container">
<div class="form-row my-3">
<div class="col-3 align-self-center">
<h5>
<span class='' data-bind='text: "Quests (" + App.game.quests.currentQuests().length + "/" + App.game.quests.questSlots() + ")"'></span>
</h5>
</div>
<div class='col-6' data-bind="tooltip : App.game.quests.questProgressTooltip()">
<div>Lvl. <knockout data-bind='text: App.game.quests.level'></knockout></div>
<div class="progress" style='height: 5px'>
<div class="progress-bar bg-info" role="progressbar"
data-bind="attr:{ style: 'width:' + App.game.quests.percentToNextQuestLevel() + '%' }"
aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</div>
<div class="col-3 align-self-center">
<span data-bind="template: { name: 'currencyTemplate', data: {'amount': App.game.wallet.currencies[GameConstants.Currency.questPoint](), 'currency': GameConstants.Currency.questPoint}}"></span>
</div>
</div>
</div>

<table class='table table-hover m-0'>
<thead>
<tr>
<td class="align-middle"><h5 class="mb-0">Description</h5></td>
<td class="align-middle"><h5 class="mb-0">Reward</h5></td>
<td class="align-middle"><h5 class="mb-0">Status</h5></td>
</tr>
</thead>
<tbody data-bind="foreach: App.game.quests.sortedQuestList" >
<tr>
<td class="align-middle" style="text-align:left" data-bind='text: description'></td>
<td class="align-middle text-center py-0" style="text-align:left">
<span data-bind="template: { name: 'currencyTemplate', data: {'amount': pointsReward, 'currency': GameConstants.Currency.questPoint}}"></span>
</td>
<td class="align-middle text-center py-0">
<button class='btn btn-primary btn-sm btn-block'
data-bind='visible: App.game.quests.canStartNewQuest() && !$data.inProgress() && !$data.isCompleted() && !$data.claimed(),
click: function(){
App.game.quests.beginQuest($data.index);
}'>
Start
</button>
<button class='btn btn-success btn-sm btn-block' data-bind='visible: !$data.claimed() && $data.isCompleted(),
click: () => { App.game.quests.claimQuest($data.index) }'>
Claim
</button>
<span data-bind='visible: $data.inProgress() && !$data.isCompleted(), text: Math.floor(progress()*100) + "%"'></span>
<button class='btn btn-success btn-sm btn-block' disabled data-bind='visible: $data.claimed()'>Completed</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-3">
<span data-bind="template: { name: 'currencyTemplate', data: {'amount': App.game.wallet.currencies[GameConstants.Currency.questPoint](), 'currency': GameConstants.Currency.questPoint}}"></span>
</div>

</div>
<div class="modal-body p-0">
<table class='table table-hover m-0'>
<thead>
<tr>
<td><h5>Description</h5></td>
<td><h5>Reward</h5></td>
<td><h5>Status</h5></td>
</tr>
</thead>
<tbody data-bind="foreach: App.game.quests.sortedQuestList" >
<tr>
<td class="align-middle" style="text-align:left" data-bind='text: description'></td>
<td class="align-middle py-0" style="text-align:left">
<span data-bind="template: { name: 'currencyTemplate', data: {'amount': pointsReward, 'currency': GameConstants.Currency.questPoint}}"></span>
</td>
<td class="align-middle py-0">
<button class='btn btn-primary btn-sm btn-block'
data-bind='visible: App.game.quests.canStartNewQuest() && !$data.inProgress() && !$data.isCompleted() && !$data.claimed(),
click: function(){
App.game.quests.beginQuest($data.index);
}'>
Start
</button>
<button class='btn btn-success btn-sm btn-block' data-bind='visible: !$data.claimed() && $data.isCompleted(),
click: () => { App.game.quests.claimQuest($data.index) }'>
Claim
</button>
<span data-bind='visible: $data.inProgress() && !$data.isCompleted(), text: Math.floor(progress()*100) + "%"'></span>
<button class='btn btn-success btn-sm btn-block' disabled data-bind='visible: $data.claimed()'>Completed</button>
</td>
</tr>
</tbody>
</table>
<!-- Quest Lines -->
<div class="tab-pane" id="questsModalQuestLinesPane">
<div class="px-2 pt-3 text-left" data-bind="with: {
active: App.game.quests.questLines().filter(q => q.state() === QuestLineState.started),
available: App.game.quests.questLines().filter(q => q.state() === QuestLineState.inactive && q.bulletinBoard !== GameConstants.BulletinBoards.None && q.requirement?.isCompleted()),
complete: App.game.quests.questLines().filter(q => q.state() === QuestLineState.ended)
}">
<!-- ko if: $data.active.length -->
<div class="bg-primary p-2">
<h6 class="m-0 text-light font-weight-bold">Active Quest Lines</h6>
</div>
<table class="table table-striped table-bordered table-hover table-sm">
<thead>
<tr>
<th>Name</th>
<th class="text-center">Progress</th>
</tr>
</thead>
<tbody data-bind="foreach: $data.active">
<tr>
<td>
<knockout class="font-weight-bold d-block" data-bind="text: $data.name"></knockout>
<knockout class="small" data-bind="text: $data.description"></knockout>
</td>
<td class="text-nowrap align-middle text-center" data-bind="text: `${$data.curQuest() + 1} / ${$data.totalQuests}`"></td>
</tr>
</tbody>
</table>
<!-- /ko -->

<!-- ko if: $data.available.length -->
<div class="bg-primary p-2">
<h6 class="m-0 text-light font-weight-bold">Available Quest Lines</h6>
</div>
<table class="table table-striped table-bordered table-hover table-sm">
<thead>
<tr>
<th class="align-middle">Name</th>
<th class="text-nowrap text-center">Bulletin Board</th>
</tr>
</thead>
<tbody data-bind="foreach: $data.available">
<tr>
<td>
<knockout class="font-weight-bold d-block" data-bind="text: $data.name"></knockout>
<knockout class="small" data-bind="text: $data.description"></knockout>
</td>
<td class="text-nowrap text-center align-middle" data-bind="text: BulletinBoard.getLocation($data.bulletinBoard)"></td>
</tr>
</tbody>
</table>
<!-- /ko -->

<!-- ko if: $data.complete.length -->
<div class="bg-primary p-2">
<h6 class="m-0 text-light font-weight-bold">Complete Quest Lines</h6>
</div>
<table class="table table-striped table-bordered table-hover table-sm">
<tbody data-bind="foreach: $data.complete">
<tr>
<td>
<knockout class="font-weight-bold d-block" data-bind="text: $data.name"></knockout>
<knockout class="small" data-bind="text: $data.description"></knockout>
</td>
</tr>
</tbody>
</table>
<!-- /ko -->
</div>
</div>
</div>
</div>

<div class="modal-footer">
Expand Down
2 changes: 1 addition & 1 deletion src/modules/GameConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ export const Environments: Record<string, EnvironmentData> = {
[Region.sinnoh]: new Set([218, 219, 220, 223, 230, 'Pastoria City', 'Lake Verity', 'Lake Valor', 'Sendoff Spring']),
[Region.unova]: new Set([17, 18, 21, 24, 'Undella Town', 'Humilau City']),
[Region.kalos]: new Set([8, 23, 'Couriway Town', 'Sea Spirit\'s Den']),
[Region.alola]: new Set([15, 19, 20, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 'Hoppy Town', 'Friend League', 'Quick League', 'Heavy League', 'Great League', 'Fast League', 'Luxury League', 'Heal League', 'Ultra League', 'Elite Four League', 'Master League', 'Magikarp\'s Eye', 'Seafolk Village', 'Brooklet Hill', 'Mina\'s Houseboat', 'Lake of the Sunne and Moone']),
[Region.alola]: new Set([15, 19, 20, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 'Hoppy Town', 'Friend League', 'Quick League', 'Heavy League', 'Great League', 'Fast League', 'Luxury League', 'Heal League', 'Ultra League', 'Elite Four League', 'Master League', 'Magikarp\'s Eye', 'Seafolk Village', 'Brooklet Hill', 'Mina\'s Houseboat', 'Lake of the Sunne and Moone']),
[Region.galar]: new Set(['Hulbury', 'Roaring-Sea Caves', 5, 6, 8, 9, 16, 21, 27, 29, 36, 37, 41, 42, 43, 44, 51, 53]),
},

Expand Down
4 changes: 2 additions & 2 deletions src/modules/settings/PokedexFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ const PokedexFilters: Record<string, FilterOption> = {
statusPokerus: new FilterOption<number>(
'Pokerus',
ko.observable(-1).extend({ numeric: 0 }),
'pokdexPokerusFilter',
'pokedexPokerusFilter',
[
new SettingOption('All', '-1'),
new SettingOption('All', -1),
...Settings.enumToNumberSettingOptionArray(Pokerus, (t) => t !== 'Infected'),
],
),
Expand Down
3 changes: 3 additions & 0 deletions src/scripts/Update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2366,6 +2366,9 @@ class Update implements Saveable {
playerData._itemList[crystalName] = 1;
}
});

// Fixing Silvally item amounts
Object.keys(playerData._itemList).filter(itemName => itemName.includes('Memory_Silvally')).forEach(itemName => playerData._itemList[itemName] = Math.min(1, playerData._itemList[itemName]));
},
};

Expand Down
1 change: 1 addition & 0 deletions src/scripts/achievements/AchievementHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ class AchievementHandler {
multiplier.addBonus('exp', () => 1 + this.achievementBonus(), multiplierSource);
multiplier.addBonus('money', () => 1 + this.achievementBonus(), multiplierSource);
multiplier.addBonus('dungeonToken', () => 1 + this.achievementBonus(), multiplierSource);
multiplier.addBonus('clickAttack', () => 1 + this.achievementBonus(), multiplierSource);
}

static load() {
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/party/Party.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class Party implements Feature {
const caught = caughtPokemon.length;
const shiny = caughtPokemon.filter(p => p.shiny).length;
const resistant = caughtPokemon.filter(p => p.pokerus >= GameConstants.Pokerus.Resistant).length;
const clickAttack = Math.pow(caught + shiny + resistant + 1, 1.4) * (1 + AchievementHandler.achievementBonus());
const clickAttack = Math.pow(caught + shiny + resistant + 1, 1.4);

const bonus = this.multiplier.getBonus('clickAttack', useItem);

Expand Down
2 changes: 1 addition & 1 deletion src/scripts/pokeballs/Pokeballs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Pokeballs implements Feature {
return 15;
}
return 0;
}, 1250, 'Increased catch rate on water routes', new RouteKillRequirement(10, GameConstants.Region.hoenn, 101)),
}, 1250, 'Increased catch rate in water environments', new RouteKillRequirement(10, GameConstants.Region.hoenn, 101)),

new Pokeball(GameConstants.Pokeball.Lureball, () => {
if (App.game.gameState == GameConstants.GameState.fighting && player.route()) {
Expand Down
41 changes: 39 additions & 2 deletions src/scripts/pokemons/PokemonHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ enum PokemonLocationType {
QuestLineReward,
TempBattleReward,
GymReward,
DungeonReward
DungeonReward,
Trade
}

class PokemonHelper extends TmpPokemonHelper {
Expand Down Expand Up @@ -327,6 +328,35 @@ class PokemonHelper extends TmpPokemonHelper {
return questLines;
}

public static getPokemonTrades(pokemonName: PokemonNameType, maxRegion: GameConstants.Region = GameConstants.Region.none): Array<string> {
const trades = [];
Object.entries(TownList).forEach(([townName, town]) => {
// If we only want to check up to a maximum region
if (maxRegion != GameConstants.Region.none && town.region > maxRegion) {
return false;
}

const townShops = town.content.filter(c => c instanceof Shop);
if (townShops.length) {
let hasPokemon = false;
for (let i = 0; i < townShops.length && !hasPokemon; i++) {
const shop = townShops[i];
if (shop instanceof GemMasterShop) {
hasPokemon = GemDeal.list[shop.shop]?.().some(deal => deal.item.itemType.type == pokemonName);
} else if (shop instanceof ShardTraderShop) {
hasPokemon = ShardDeal.list[shop.location]?.().some(deal => deal.item.itemType.type == pokemonName);
} else if (shop instanceof BerryMasterShop) {
hasPokemon = BerryDeal.list[shop.location]?.().some(deal => deal.item.itemType.type == pokemonName);
}
}
if (hasPokemon) {
trades.push(townName);
}
}
});
return trades;
}

public static getPokemonLocations = (pokemonName: PokemonNameType, maxRegion: GameConstants.Region = GameConstants.MAX_AVAILABLE_REGION) => {
const encounterTypes = {};
// Routes
Expand Down Expand Up @@ -427,6 +457,12 @@ class PokemonHelper extends TmpPokemonHelper {
encounterTypes[PokemonLocationType.QuestLineReward] = questLineReward;
}

// Trades
const trades = PokemonHelper.getPokemonTrades(pokemonName);
if (trades.length) {
encounterTypes[PokemonLocationType.Trade] = trades;
}

// Return the list of items
return encounterTypes;
}
Expand All @@ -441,7 +477,8 @@ class PokemonHelper extends TmpPokemonHelper {
locations[PokemonLocationType.Route] ||
locations[PokemonLocationType.Safari] ||
locations[PokemonLocationType.Shop] ||
locations[PokemonLocationType.Wandering];
locations[PokemonLocationType.Wandering] ||
locations[PokemonLocationType.Trade];
return !isEvable && Object.keys(locations).length;
};
}
Loading

0 comments on commit c40474e

Please sign in to comment.