From 5285cb73fcc93c790d28a4247de32183d8ea83b0 Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Tue, 3 Jan 2017 18:04:55 -0500 Subject: [PATCH 1/9] remove unneeded imports --- app/screens/Table/index.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/screens/Table/index.js b/app/screens/Table/index.js index b7e1145..11c7e04 100644 --- a/app/screens/Table/index.js +++ b/app/screens/Table/index.js @@ -4,11 +4,6 @@ import React, { import { ipcRenderer } from 'electron' -import { - InputGroup, - FormControl, - Button, -} from 'react-bootstrap' import $ from 'jquery' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' From 4a929ea004d9ba6ec08b89629a79423a8733c975 Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Tue, 3 Jan 2017 18:31:46 -0500 Subject: [PATCH 2/9] close #117 add dps to cinematic moves, calculate stab for dps --- app/actions/trainer.js | 34 ++++++++++++------- .../Detail/components/CinematicMove.js | 2 ++ app/screens/Detail/components/QuickMove.js | 2 +- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/app/actions/trainer.js b/app/actions/trainer.js index f37ec4b..628e744 100644 --- a/app/actions/trainer.js +++ b/app/actions/trainer.js @@ -53,18 +53,19 @@ function generateEmptySpecies(candies, pokemonSettings) { }) } +// TODO Can we find these constants in POGOBuf or item templates? const MILLISECONDS_FACTOR = 1000 const MOVE2_CHARGE_DELAY_MS = 500 +const STAB_MULTIPLIER = 1.25 // 25% damage boost -function dpsForMove(move, primary) { +function dpsForMove(hasStab, move, primary) { const moveDelay = primary ? 0 : MOVE2_CHARGE_DELAY_MS - const dps = move.power / (move.duration_ms + moveDelay) * MILLISECONDS_FACTOR + let dps = move.power / (move.duration_ms + moveDelay) * MILLISECONDS_FACTOR // TODO optional STAB - // const STAB_MULTIPLIER = 1.25 - // if (hasStab) { - // dps = dps * STAB_MULTIPLIER - // } + if (hasStab) { + dps *= STAB_MULTIPLIER + } return dps } @@ -77,12 +78,14 @@ function egpsForMove(move, primary) { } // List of all POGOProtos.Enums.PokemonMove -function getMove(moveSettings, move, primary) { +// types - array of up to two pokemon types ['fire', 'water'] +// moveSettings - object holding move meta +// move - id for move +// primary - first or second move +function getMove(types, moveSettings, move, primary) { const moveSetting = Object.assign({}, moveSettings[move]) - moveSetting.dps = dpsForMove(moveSetting, primary) moveSetting.energy_gain = moveSetting.energy_delta - moveSetting.egps = egpsForMove(moveSetting, primary) moveSetting.dodge_window_ms = moveSetting.damage_window_end_ms - moveSetting.damage_window_start_ms moveSetting.energy_cost = moveSetting.energy_delta * -1 @@ -91,6 +94,11 @@ function getMove(moveSettings, move, primary) { moveSetting.type = utils.getType(moveSetting.pokemon_type) + const hasStab = types.includes(moveSetting.type) + moveSetting.dps = dpsForMove(hasStab, moveSetting, primary) + + moveSetting.egps = egpsForMove(moveSetting, primary) + return moveSetting } @@ -151,13 +159,13 @@ function parseInventory(inventory) { .map(utils.getName) .join('/') - const quickMoves = pokemonSetting.quick_moves.map(m => getMove(moveSettings, m, true)) + const quickMoves = pokemonSetting.quick_moves.map(m => getMove(type, moveSettings, m, true)) - const cinematicMoves = pokemonSetting.cinematic_moves.map(m => getMove(moveSettings, m, false)) + const cinematicMoves = pokemonSetting.cinematic_moves.map(m => getMove(type, moveSettings, m, false)) - const move1 = getMove(moveSettings, p.move_1, true) + const move1 = getMove(type, moveSettings, p.move_1, true) - const move2 = getMove(moveSettings, p.move_2, false) + const move2 = getMove(type, moveSettings, p.move_2, false) // TODO Use CamelCase instead of under_score for all keys except responses const pokemonWithStats = { diff --git a/app/screens/Detail/components/CinematicMove.js b/app/screens/Detail/components/CinematicMove.js index 5492c39..71085a9 100644 --- a/app/screens/Detail/components/CinematicMove.js +++ b/app/screens/Detail/components/CinematicMove.js @@ -32,6 +32,8 @@ const CinematicMove = React.createClass({ const chargedMoveTip = ( {`Duration: ${move.duration_ms}ms`}
+ {`DPS: ${move.dps.toFixed(2)}`} +
{`Dodge Window: ${move.dodge_window_ms}ms`}
{`Crit Chance: ${critChance.toFixed(2)}%`} diff --git a/app/screens/Detail/components/QuickMove.js b/app/screens/Detail/components/QuickMove.js index c7d801e..aa53a9d 100644 --- a/app/screens/Detail/components/QuickMove.js +++ b/app/screens/Detail/components/QuickMove.js @@ -23,7 +23,7 @@ const QuickMove = React.createClass({
{`Damage Window: ${move.damage_window_end_ms}ms`}
- No STAB DPS: ${move.dps.toFixed(2)} + {`DPS: ${move.dps.toFixed(2)}`}
{`Energy Gain: ${move.energy_gain}`}
From 08cc5388b57385353262ee30b120fb3d5da2ddfd Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Tue, 3 Jan 2017 18:58:13 -0500 Subject: [PATCH 3/9] add templated renaming, error handling for greater than 12 characters, and special VI case --- app/screens/Detail/components/Nickname.js | 24 +++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/app/screens/Detail/components/Nickname.js b/app/screens/Detail/components/Nickname.js index 6c6d700..7a443f5 100644 --- a/app/screens/Detail/components/Nickname.js +++ b/app/screens/Detail/components/Nickname.js @@ -1,3 +1,6 @@ +import { + ipcRenderer, +} from 'electron' import React, { PropTypes } from 'react' @@ -42,7 +45,6 @@ const Nickname = React.createClass({ className="input-lg" onKeyPress={this.handleKeyPress} defaultValue={newNickname} - maxLength="12" placeholder="Enter a new nickname" ref={(c) => { this.input = c }} /> @@ -70,8 +72,26 @@ const Nickname = React.createClass({ }, handleKeyPress(e) { + const { + pokemon, + } = this.props + if (e.key === 'Enter') { - this.props.renamePokemon(this.props.pokemon, e.target.value, (updatedPokemon) => { + let newName = e.target.value + + newName = newName + .replace('[IV]', pokemon.iv.toFixed(0)) + .replace('[VI]', (100 - pokemon.iv).toFixed(0)) + .replace('[ATT]', pokemon.attack.toFixed(0)) + .replace('[DEF]', pokemon.defense.toFixed(0)) + .replace('[STA]', pokemon.stamina.toFixed(0)) + + if (newName.length > 12) { + ipcRenderer.send('error-message', 'The name must contain 12 characters or less.') + return + } + + this.props.renamePokemon(pokemon, newName, (updatedPokemon) => { this.handleRenameComplete(updatedPokemon) }) } From da106faa7477419e812b0d37a05449cb9a3f5e47 Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Tue, 3 Jan 2017 20:49:31 -0500 Subject: [PATCH 4/9] close #144 power up max cp protection, missing candy protection, typo fix --- app/reducers/trainer.js | 2 +- app/screens/Table/components/Pokemon.js | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/reducers/trainer.js b/app/reducers/trainer.js index 7cc40a7..b0a0d7c 100644 --- a/app/reducers/trainer.js +++ b/app/reducers/trainer.js @@ -284,7 +284,7 @@ export default handleActions({ POWER_UP_POKEMON_SUCCESS(state, action) { const pokemon = action.payload - const message = `Upgraded ${pokemon.nickname} succesfully!` + const message = `Upgraded ${pokemon.nickname} successfully!` const title = `Power Up ${pokemon.nickname}` ipcRenderer.send('information-dialog', message, title) diff --git a/app/screens/Table/components/Pokemon.js b/app/screens/Table/components/Pokemon.js index bf46033..25f4ba3 100644 --- a/app/screens/Table/components/Pokemon.js +++ b/app/screens/Table/components/Pokemon.js @@ -16,6 +16,10 @@ import Tooltip from '../../Tooltip' const favoriteGlyph = 'fa fa-star favorite-yellow' const emptyFavoriteGlyph = 'fa fa-star-o' +function hasMaxCP(pokemon) { + return pokemon.cp.toFixed(0) === pokemon.max_cp.toFixed(0) +} + const Pokemon = React.createClass({ displayName: 'PokemonTable', @@ -140,7 +144,7 @@ const Pokemon = React.createClass({ return species.pokemon.map((pokemon) => { const favorite = pokemon.favorite ? favoriteGlyph : emptyFavoriteGlyph const pokeiv = `${pokemon.iv}% (${pokemon.attack}/${pokemon.defense}/${pokemon.stamina})` - const powerUpTip = this.getPowerUpTip(pokemon) + const powerUpTip = this.getPowerUpTip(pokemon, species) const cpTip = `Max CP: ${pokemon.max_cp}` const ivTip = ( {`Attack: ${pokemon.attack}`} @@ -223,7 +227,7 @@ const Pokemon = React.createClass({ }, getPowerUpTip(pokemon) { - if (pokemon.cp === pokemon.max_cp) { + if (hasMaxCP(pokemon)) { return `Max CP ${pokemon.max_cp}` } @@ -240,7 +244,17 @@ const Pokemon = React.createClass({ ) }, - handleClickPowerup(pokemon) { + handleClickPowerup(pokemon, species) { + if (hasMaxCP(pokemon)) { + ipcRenderer.send('error-message', 'Sorry, you have reached the Max CP!') + return + } + + if (species.candy < 1) { + ipcRenderer.send('error-message', `Sorry, you have ${species.candy} candy left!`) + return + } + if (ipcRenderer.sendSync('confirmation-dialog', 'power up').success) { // TODO Calculate and update the pokemon immediately with estimates this.props.powerUpPokemon(pokemon) From 15a2fab0aedb2749c6843b0717c1a983a4a59521 Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Tue, 3 Jan 2017 23:00:55 -0500 Subject: [PATCH 5/9] add fast, charge, energy, and hp to template renaming, use numbers in circle to save chars --- app/screens/Detail/components/Nickname.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/app/screens/Detail/components/Nickname.js b/app/screens/Detail/components/Nickname.js index 7a443f5..6559d6d 100644 --- a/app/screens/Detail/components/Nickname.js +++ b/app/screens/Detail/components/Nickname.js @@ -9,6 +9,10 @@ import { bindActionCreators } from 'redux' import { connect } from 'react-redux' import { renamePokemon } from '../../../actions' +function getNumberInCircle(num) { + return String.fromCharCode(9311 + num) +} + const Nickname = React.createClass({ propTypes: { pokemon: PropTypes.object.isRequired, @@ -79,12 +83,23 @@ const Nickname = React.createClass({ if (e.key === 'Enter') { let newName = e.target.value + const totalEnergy = parseInt(Math.floor(100 / pokemon.move_2.energy_cost), 10) + const energy = getNumberInCircle(totalEnergy) + const vi = (100 - pokemon.iv).toFixed(0) + const attack = getNumberInCircle(pokemon.attack) + const defense = getNumberInCircle(pokemon.defense) + const stamina = getNumberInCircle(pokemon.stamina) + newName = newName .replace('[IV]', pokemon.iv.toFixed(0)) - .replace('[VI]', (100 - pokemon.iv).toFixed(0)) - .replace('[ATT]', pokemon.attack.toFixed(0)) - .replace('[DEF]', pokemon.defense.toFixed(0)) - .replace('[STA]', pokemon.stamina.toFixed(0)) + .replace('[VI]', vi) + .replace('[ATT]', attack) + .replace('[DEF]', defense) + .replace('[STA]', stamina) + .replace('[FAST]', pokemon.move_1.power.toFixed(0)) + .replace('[CHARGE]', pokemon.move_2.power.toFixed(0)) + .replace('[ENERGY]', energy) + .replace('[HP]', pokemon.stamina_max) if (newName.length > 12) { ipcRenderer.send('error-message', 'The name must contain 12 characters or less.') From 39ba73a26716513da4d1cad6e8a3eaa8ab9dfd9d Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Tue, 3 Jan 2017 23:17:01 -0500 Subject: [PATCH 6/9] improve getNumberInCircle --- app/screens/Detail/components/Nickname.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/screens/Detail/components/Nickname.js b/app/screens/Detail/components/Nickname.js index 6559d6d..89ec82e 100644 --- a/app/screens/Detail/components/Nickname.js +++ b/app/screens/Detail/components/Nickname.js @@ -10,7 +10,9 @@ import { connect } from 'react-redux' import { renamePokemon } from '../../../actions' function getNumberInCircle(num) { - return String.fromCharCode(9311 + num) + if (num === 0) return String.fromCharCode(9450) + if (num < 21) return String.fromCharCode(9311 + num) + return `${num}` } const Nickname = React.createClass({ From cc2f372037d96580c913fb50b0a40e3aa11d0bbc Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Tue, 3 Jan 2017 23:36:38 -0500 Subject: [PATCH 7/9] close #179 move attack/defense, and add iv --- app/screens/Detail/components/ModalBody.js | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/screens/Detail/components/ModalBody.js b/app/screens/Detail/components/ModalBody.js index 87e0e24..51682f7 100644 --- a/app/screens/Detail/components/ModalBody.js +++ b/app/screens/Detail/components/ModalBody.js @@ -112,16 +112,6 @@ const ModalBody = React.createClass({
Height
-
-
-
{`${attack}`}
-
Attack
-
-
-
{`${defense}`}
-
Defense
-
-
{cpPerUpgrade}
@@ -132,6 +122,20 @@ const ModalBody = React.createClass({
{`${name} Candies`}
+
+
+
{`${attack}`}
+
Attack
+
+
+
{`${defense}`}
+
Defense
+
+
+
{`${pokemon.iv}%`}
+
IV
+
+
Quick Moves
{quickMoves} From 4de24fb8a2ad20b0c3bdfd22c1dbf7132362a4c5 Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Tue, 3 Jan 2017 23:38:02 -0500 Subject: [PATCH 8/9] prepare v1.9.0 --- README.md | 10 +++++----- app/package.json | 4 ++-- package.json | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2ea95ac..316e4e6 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,12 @@ **PokéNurse** is a desktop application for Windows and Mac that allows you to manage your pokémon from Pokémon Go without the need for a mobile device. You can now favorite, transfer, and evolve from the comfort of your own home! -## Downloads for v1.8.0 +## Downloads for v1.9.0 You may view all the releases [here](https://github.com/vinnymac/PokeNurse/releases) -* [macOS](https://github.com/vinnymac/PokeNurse/releases/download/v1.8.0/PokeNurse.dmg) -* [Windows](https://github.com/vinnymac/PokeNurse/releases/download/v1.8.0/PokeNurse.exe) -* [Linux 32 bit](https://github.com/vinnymac/PokeNurse/releases/download/v1.8.0/PokeNurse-ia32.deb) -* [Linux 64 bit](https://github.com/vinnymac/PokeNurse/releases/download/v1.8.0/PokeNurse-x64.deb) +* [macOS](https://github.com/vinnymac/PokeNurse/releases/download/v1.9.0/PokeNurse.dmg) +* [Windows](https://github.com/vinnymac/PokeNurse/releases/download/v1.9.0/PokeNurse.exe) +* [Linux 32 bit](https://github.com/vinnymac/PokeNurse/releases/download/v1.9.0/PokeNurse-ia32.deb) +* [Linux 64 bit](https://github.com/vinnymac/PokeNurse/releases/download/v1.9.0/PokeNurse-x64.deb) ## Examples ![Login Window](app/loginExample.png) diff --git a/app/package.json b/app/package.json index e8ccb87..05404d2 100644 --- a/app/package.json +++ b/app/package.json @@ -1,7 +1,7 @@ { "name": "PokeNurse", "productName": "PokeNurse", - "version": "1.8.0", + "version": "1.9.0", "description": "A tool for Pokémon Go to aid in transferring and evolving Pokémon", "main": "./main.js", "author": { @@ -14,6 +14,6 @@ "async-file": "^2.0.2", "electron-localshortcut": "^1.0.0", "node-pogo-protos": "2.4.0", - "pogobuf": "1.8.0" + "pogobuf": "1.9.0" } } diff --git a/package.json b/package.json index 27dd458..996276f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "PokeNurse", - "version": "1.8.0", + "version": "1.9.0", "description": "A tool for Pokémon Go to aid in transferring and evolving Pokémon", "main": "main.js", "scripts": { @@ -139,7 +139,7 @@ "electron-localshortcut": "^1.0.0", "font-awesome": "^4.7.0", "node-pogo-protos": "2.4.0", - "pogobuf": "1.8.0", + "pogobuf": "1.9.0", "react": "^15.4.1", "react-dom": "^15.4.1", "react-redux": "5.0.1", From 4cc35e151166c9ebc86ed648cc5926232444fb6e Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Tue, 3 Jan 2017 23:42:58 -0500 Subject: [PATCH 9/9] templated renaming instructions and additional features --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 316e4e6..73e8d57 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ You may view all the releases [here](https://github.com/vinnymac/PokeNurse/relea This project uses [Electron](http://electron.atom.io/) and [Node.js](https://nodejs.org/en/). Criticism is welcome and encouraged. ## Features -* List Pokemon +* List and Sort Pokemon * Pokedex Number * Name * CP @@ -31,6 +31,20 @@ This project uses [Electron](http://electron.atom.io/) and [Node.js](https://nod * Transfer Pokemon * Evolve Pokemon * Favorite/Unfavorite Pokemon +* PowerUp Pokemon +* Details - Evolutions, DPS, Energy, Moves, and more +* Renaming & Templated Renaming + +## Templated Renaming +When renaming, it will automatically convert a name like `Bulba-[HP]` into `Bulba-140`. +`[IV]` represents the IV percent of that pokemon: 40 +`[VI]` represents 100 minus the IV: 60 +`[ATT]`, `[DEF]`, `[STA]` represent attack, defense, and stamina, they will appear like: ⑨ +`[FAST]` is the damage of the quick move: 8 +`[CHARGE]` is the damage of the cinematic move: 40 +`[ENERGY]` is the amount of cinematic moves you can use before your energy runs out: ② +`[HP]` is the max stamina: 140 +Note: Only 12 characters can be used to rename a pokemon. ## Contributing All future pull request should be made to the **develop** branch.