Skip to content

Commit

Permalink
Merge pull request #564 from WatWowMap/develop
Browse files Browse the repository at this point in the history
Sync Develop with Main
  • Loading branch information
TurtIeSocks authored Sep 5, 2022
2 parents 0fb44fc + 576f331 commit 58e27cc
Show file tree
Hide file tree
Showing 18 changed files with 241 additions and 107 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reactmap",
"version": "1.3.3",
"version": "1.3.4",
"description": "React based frontend map.",
"main": "ReactMap.mjs",
"author": "TurtIeSocks <[email protected]>",
Expand Down
8 changes: 0 additions & 8 deletions server/src/configs/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -917,14 +917,6 @@
"gymBadgeTableName": "DATABASE_SETTINGS_GYM_BADGE_TABLE_NAME",
"sessionTableName": "DATABASE_SETTINGS_SESSION_TABLE_NAME",
"migrationTableName": "DATABASE_SETTINGS_MIGRATION_TABLE_NAME",
"joinGymBadgeTable": {
"__name": "DATABASE_SETTINGS_JOIN_GYM_BADGE_TABLE",
"__format": "boolean"
},
"hideOldQuests": {
"__name": "DATABASE_SETTINGS_HIDE_OLD_QUESTS",
"__format": "boolean"
},
"maxConnections": {
"__name": "DATABASE_SETTINGS_MAX_CONNECTIONS",
"__format": "number"
Expand Down
2 changes: 0 additions & 2 deletions server/src/configs/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,6 @@
"gymBadgeTableName": "gymBadges",
"sessionTableName": "session",
"migrationTableName": "knex_migrations",
"joinGymBadgeTable": false,
"hideOldQuests": false,
"maxConnections": 10
},
"schemas": []
Expand Down
9 changes: 6 additions & 3 deletions server/src/models/Pokestop.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const {
stopValidDataLimit,
hideOldPokestops,
},
database: { settings },
map,
} = require('../services/config')

Expand Down Expand Up @@ -59,6 +58,7 @@ module.exports = class Pokestop extends Model {
hasMultiInvasions,
multiInvasionMs,
hasRewardAmount,
hasLayerColumn,
},
) {
const {
Expand All @@ -74,7 +74,7 @@ module.exports = class Pokestop extends Model {
ts,
midnight: clientMidnight,
} = args
const midnight = settings.hideOldQuests ? clientMidnight || 0 : 0
const midnight = clientMidnight || 0
const safeTs = ts || Math.floor(new Date().getTime() / 1000)

const {
Expand Down Expand Up @@ -110,6 +110,9 @@ module.exports = class Pokestop extends Model {
'incident_expire_timestamp',
),
])
if (hasLayerColumn) {
query.select('layer AS with_ar')
}
if (hideOldPokestops) {
query.whereRaw(
`UNIX_TIMESTAMP(last_updated) > ${
Expand Down Expand Up @@ -1109,7 +1112,7 @@ module.exports = class Pokestop extends Model {

static async searchQuests(perms, args, { isMad, hasAltQuests }, distance) {
const { search, onlyAreas = [], locale, midnight: clientMidnight } = args
const midnight = settings.hideOldQuests ? clientMidnight : 0
const midnight = clientMidnight || 0

const pokemonIds = Object.keys(Event.masterfile.pokemon).filter((pkmn) =>
i18next
Expand Down
6 changes: 6 additions & 0 deletions server/src/services/DbCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ module.exports = class DbCheck {
'quest_reward_amount' in columns || isMad,
'alternative_quest_type' in columns,
])
const [hasLayerColumn] = isMad
? await schema('trs_quest')
.columnInfo()
.then((columns) => ['layer' in columns])
: [false]
const [hasMultiInvasions, multiInvasionMs] = await schema('incident')
.columnInfo()
.then((columns) => [
Expand All @@ -108,6 +113,7 @@ module.exports = class DbCheck {
this.models[category][j].hasMultiInvasions = hasMultiInvasions
this.models[category][j].multiInvasionMs = multiInvasionMs
this.models[category][j].availableSlotsCol = availableSlotsCol
this.models[category][j].hasLayerColumn = hasLayerColumn
}
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/WebhookQuery.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function WebhookQuery({
return data ? (
<Container
location={
data[`${lowercase}Single`]
data[`${lowercase}Single`]?.lat && data[`${lowercase}Single`]?.lon
? [data[`${lowercase}Single`].lat, data[`${lowercase}Single`].lon]
: location
}
Expand Down
69 changes: 51 additions & 18 deletions src/components/layout/dialogs/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import {
import { useTranslation } from 'react-i18next'
import { useQuery } from '@apollo/client'

import Utility from '@services/Utility'
import NameTT from '@components/popups/common/NameTT'
import { useStore, useStatic } from '@hooks/useStore'
import Utility from '@services/Utility'
import Query from '@services/Query'

import Header from '../general/Header'
import QuestTitle from '../general/QuestTitle'

Expand Down Expand Up @@ -77,20 +79,28 @@ export default function Search({ safeSearch, toggleDialog, isMobile, Icons }) {
} = option
let main
let amount = 0
let tt = ''
switch (quest_reward_type) {
case 2:
main = Icons.getRewards(quest_reward_type, quest_item_id, item_amount)
amount = main.includes('_a') || item_amount <= 1 ? 0 : item_amount
tt = `item_${quest_item_id}`
break
case 3:
tt = `stardust`
main = Icons.getRewards(quest_reward_type, stardust_amount)
amount = main.includes('_a') ? 0 : stardust_amount
break
case 4:
tt = `poke_${candy_pokemon_id}`
main = Icons.getRewards(quest_reward_type, candy_pokemon_id)
amount = main.includes('_a') ? 0 : candy_amount
break
case 7:
tt = [
quest_form_id ? `form_${quest_form_id}` : '',
`poke_${quest_pokemon_id}`,
]
main = Icons.getPokemon(
quest_pokemon_id,
quest_form_id,
Expand All @@ -101,10 +111,12 @@ export default function Search({ safeSearch, toggleDialog, isMobile, Icons }) {
)
break
case 9:
tt = `poke_${xl_candy_pokemon_id}`
main = Icons.getRewards(quest_reward_type, xl_candy_pokemon_id)
amount = main.includes('_a') ? 0 : xl_candy_amount
break
case 12:
tt = `poke_${mega_pokemon_id}`
main = Icons.getRewards(
quest_reward_type,
mega_pokemon_id,
Expand All @@ -124,7 +136,13 @@ export default function Search({ safeSearch, toggleDialog, isMobile, Icons }) {
position: 'relative',
}}
>
<img src={main} style={{ maxWidth: 45, maxHeight: 45 }} alt={main} />
<NameTT id={tt}>
<img
src={main}
style={{ maxWidth: 45, maxHeight: 45 }}
alt={main}
/>
</NameTT>
{Boolean(
main.includes('stardust')
? !main.endsWith('0.png')
Expand All @@ -141,25 +159,40 @@ export default function Search({ safeSearch, toggleDialog, isMobile, Icons }) {
raid_pokemon_evolution,
} = option
return (
<img
src={Icons.getPokemon(
raid_pokemon_id,
raid_pokemon_form,
raid_pokemon_evolution,
raid_pokemon_gender,
raid_pokemon_costume,
)}
alt={raid_pokemon_id}
style={{ maxWidth: 45, maxHeight: 45 }}
/>
<NameTT
id={[
raid_pokemon_form ? `form_${raid_pokemon_form}` : '',
raid_pokemon_evolution ? `evo_${raid_pokemon_evolution}` : '',
`poke_${raid_pokemon_id}`,
]}
>
<img
src={Icons.getPokemon(
raid_pokemon_id,
raid_pokemon_form,
raid_pokemon_evolution,
raid_pokemon_gender,
raid_pokemon_costume,
)}
alt={raid_pokemon_id}
style={{ maxWidth: 45, maxHeight: 45 }}
/>
</NameTT>
)
}
return (
<img
src={Icons.getPokemon(nest_pokemon_id, nest_pokemon_form)}
alt={nest_pokemon_form}
style={{ maxWidth: 45, maxHeight: 45 }}
/>
<NameTT
id={[
nest_pokemon_form ? `form_${nest_pokemon_form}` : '',
`poke_${nest_pokemon_id}`,
]}
>
<img
src={Icons.getPokemon(nest_pokemon_id, nest_pokemon_form)}
alt={nest_pokemon_form}
style={{ maxWidth: 45, maxHeight: 45 }}
/>
</NameTT>
)
}

Expand Down
12 changes: 12 additions & 0 deletions src/components/markers/pokemon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ export const fancyMarker = (
width: size,
}}
/>
{pkmn.seen_type === 'nearby_cell' && (
<img
src={Icons.getMisc('grass')}
alt="nearby_cell"
style={{
width: size / 1.5,
height: 'auto',
bottom: (-size / 5) * pokemonMod.offsetY,
left: `10%`,
}}
/>
)}
{badge && (
<img
src={Icons.getMisc(badge)}
Expand Down
13 changes: 0 additions & 13 deletions src/components/markers/s2cell.js

This file was deleted.

12 changes: 12 additions & 0 deletions src/components/markers/scanCell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function scanCellMarker(ago) {
const value = ago <= 1050 ? 0 : Math.min((ago - 1050) / 750, 1)
const hue = ((1 - value) * 120).toString(10)

return {
fillColor: ['hsl(', hue, ',100%, 50%)'].join(''),
color: 'black',
opacity: 0.75,
fillOpacity: 0.5,
weight: 0.5,
}
}
30 changes: 19 additions & 11 deletions src/components/popups/Pokemon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import useStyles from '@hooks/useStyles'
import Utility from '@services/Utility'

import GenericTimer from './common/Timer'
import NameTT from './common/NameTT'

const rowClass = { width: 30, fontWeight: 'bold' }

Expand Down Expand Up @@ -572,17 +573,24 @@ const PvpInfo = ({ pokemon, league, data, t, Icons }) => {
? {
id: `${league}-${each.pokemon}-${each.form}-${each.evolution}-${each.gender}-${each.rank}-${each.cp}-${each.lvl}-${each.cap}`,
img: (
<img
src={Icons.getPokemon(
each.pokemon,
each.form,
each.evolution,
each.gender,
pokemon.costume,
)}
height={20}
alt={each.pokemon}
/>
<NameTT
id={[
each.form ? `form_${each.form}` : '',
`poke_${each.pokemon}`,
]}
>
<img
src={Icons.getPokemon(
each.pokemon,
each.form,
each.evolution,
each.gender,
pokemon.costume,
)}
height={20}
alt={t(`poke_${each.pokemon}`)}
/>
</NameTT>
),
rank: each.rank || 0,
cp: each.cp || 0,
Expand Down
Loading

0 comments on commit 58e27cc

Please sign in to comment.