-
Notifications
You must be signed in to change notification settings - Fork 69
Global Min IV/Level Filter and Image Based Pokemon Filters #54
Conversation
Filter Mons By IV
Added in Toggle for to hide and show min iv fields on pokemon toggle.
…ify_pokemon Added Config Setting to turn it on or off.
Still needs a little work to load in local storage. Should have finished up soon. |
config/default.php
Outdated
$excludeMinIV = '[131, 143, 147, 148, 149, 248]'; // [] for empty | ||
|
||
$noMinIV = false; // true/false | ||
$MinIV = '0'; // "0" for empty or a number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minIV
not MinIV
config/example.config.php
Outdated
$excludeMinIV = '[131, 143, 147, 148, 149, 248]'; // [] for empty | ||
|
||
$noMinIV = false; // true/false | ||
$MinIV = '0'; // "0" for empty or a number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
I'll change that when I get home. Thanks for or pointing that out. |
A few thoughts:
And a minor bug:
Otherwise really awsome work. |
Good ideas on the transparency and changing of the colors. I'll today that up tonight thank!! |
Ok i need to redo some data structuring and stuff to fix the safari bug as its not an easy one to fix. I have the other changes done and will keep you updated of my progress. I hope to have a solution early today. |
In order to fix this dilema we need to convert the select lists on those three options into input[type="text"] fields. This will stop the select bar from popping up. My question is I originally left falllbacks in place in the code to allow people to continue using select 2 if they didn't want to use Image select. Because of how input fields in select2 work each time the data is access and re put in we have to use .join and .split in order to make it compatible. We would need to add a conditional in each of the places where this exists to check if select2 or the other select is used. Do we want to do this or just convert all of PMSF into the new image based select menus? I'll have the polished PR in the morning but wanted to pry some minds overnight. Thanks! |
The change in how the pokemon are selected for notification / excluding is HUGE. It has to be the number one complain by users. I'm all for getting rid of the old way it's done, it was only functional with FireFox anyway. |
Moved Hide Pokemon Up under the pokemon Toggle Hide Pokemon now has transparent red background Exclude Min IV now has green border with transparent green background Notify Pokemon now has blue border with transparent blue background Changed Notify of Perfection and Notify of Level to use number input fields for validation of the inputs. Select 2 Pokemon Dropdowns have now been removed after consultations with several individuals. Removed Config Parameters for fallback to old select2 method. All/None Options Added to Image Based Pokemon Navigation Min IV now refreshes mons within view range. Removed padding 0 for buttons on mobile. Upgraded Select 2 to latest version
I have made all requested updates to this point. |
There is a new bug: |
Let me take a look at that. |
@123FLO321 I am not getting this bug when mons are added to the map? Can you export your settings file your using and upload it here so i can have the exact settings. thanks! UPDATE: I tried with notify off on all mons and sounds on and nothing played. Tried adding in weedle and each time a weedle spawned it made the weedle noise. Plenty of other mons were spawning that weren't making noises. |
It sends notifications again and again for a pokemon in the notify list. |
@123FLO321 Provided me his setting file and found the bug. This is now fixed with this latest commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the spritesheet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a vast PR, and from what I've tested in a real-world environment very well executed.
I just have a few minor niggles (and a PHP warning) that need changing.
Caveat: I've mainly been looking at the PHP, and I think it definitely needs another set of eyes or two to look over it, but it's been running in production on my server for a few days with no issues.
lib/RocketMap.php
Outdated
$this->set_cp_multiplier(); | ||
} | ||
|
||
public function get_active($eids, $miniv, $minlevel, $exminiv, $swLat, $swLng, $neLat, $neLng, $tstamp = 0, $oSwLat = 0, $oSwLng = 0, $oNeLat = 0, $oNeLng = 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As RocketMap_Sloppy has not been updated, this throws the following warning:
PHP Warning: Declaration of Scanner\RocketMap_Sloppy::get_active($eids, $swLat, $swLng, $neLat, $neLng, $tstamp = 0, $oSwLat = 0, $oSwLng = 0, $oNeLat = 0, $oNeLng = 0) should be compatible with Scanner\RocketMap::get_active($eids, $miniv, $minlevel, $exminiv, $swLat, $swLng, $neLat, $neLng, $tstamp = 0, $oSwLat = 0, $oSwLng = 0, $oNeLat = 0, $oNeLng = 0)
I'd also request swapping to camelCase to keep in the styling of the other vars (change $minlevel
to $minLevel
for example). I understand they aren't all in camelCase but going forward we should be doing this, it also makes reading the variables a little easier :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot get the rocketmaps sloppy error to appear. I dont use rocketmaps sloppy nor do i have a database for it. I have display_errors on and and Display all errors and still nothing appear with either Monocle or Rocketmaps. My guess is it's missing the constructor but thats just a guess from the code and no testing. I'll take care of the camel casing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's strange, because all libraries are loaded by default. The reason it throws the error is because get_active()
for RocketMap_Sloppy has a different list of arguments when compared to RocketMap (because you've added $miniv, $minlevel, $exminiv,
).
I'll take another look in the morning and see if this is not just something exclusive to my test build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats weird because rocketmap_sloppy is basically an empty object in all sense other than it inherits rocketmaps. I had one other guy on rocketmaps get the same error but other than that other rocketmaps instances were running fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entirely my fault @iroken222. My sincere apologies, it was an error on my end. I'll approve these changes now!
raw_data.php
Outdated
$prevminiv = !empty($_POST['prevminiv']) ? $_POST['prevminiv'] : false; | ||
$minlevel = !empty($_POST['minlevel']) ? $_POST['minlevel'] : false; | ||
$prevminlevel = !empty($_POST['prevminlevel']) ? $_POST['prevminlevel'] : false; | ||
$exminiv = !empty($_POST['exminiv']) ? $_POST['exminiv'] : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about camelCase here :)
package.json
Outdated
"push.js": "^1.0.4" | ||
}, | ||
"devDependencies": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't done an in depth code review yet, just a quick question.
Why did you move these dependencies to devDependencies?
Will probably be my small npm knowledge that is failing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was on accident though we shjould definitely look through these. dependencies are required to run the application where as develop dependencies are only needed to develop. Things like phplint and other things that dont need to be in the build process shouldn't be in there. I'll move them back for now and we can discuss at a later time.
pre-index.php
Outdated
</div> | ||
<div id="tabs-2"> | ||
<?php | ||
if (!$noExcludeMinIV) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably remove the tabs completely instead of only removing their content (for noHidePokemon
and noExcludeMinIV
)
Converted Functions to camel case. Fixed package.json errors.
I have patched all issues mentioned above except the one @CalamityJames is going to look at. Please double check and make sure I got all the internationalizations as there are a lot of them. I also found some additional strings like Disable and such and converted them too. @CalamityJames @Glennmen @123FLO321 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please look into these issues.
I only did a code review, not tested it.
config/default.php
Outdated
@@ -78,12 +78,23 @@ | |||
|
|||
/* Marker Settings */ | |||
|
|||
$pathToImages = '/static/icons-safe/'; // Path to images. Images must not contain 0s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add this to example.config.php
and better alignment of the comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is removed. now. Must of missed during cleanup
lib/Monocle.php
Outdated
if (empty($exminiv)) { | ||
$conds[] = '((atk_iv + def_iv + sta_iv)' . $float . ' / 45) * 100 >= ' . $miniv; | ||
} else { | ||
$conds[] = '(((atk_iv + def_iv + sta_iv) / 45)' . $db->info()['driver'] == 'pgsql' ? "::float" : "" . ' * 100 >= ' . $miniv . ' OR pokemon_id IN(' . $exminiv . ') )'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use $float
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed update. Fixed now
lib/Monocle_Alternate.php
Outdated
} else { | ||
$conds[] = '(level >= ' . $minlevel . ' OR pokemon_id IN(' . $exminiv . ') )'; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Monocle/Alternate fork now also has get_active_by_id()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated this function into alternate
lib/RocketMap.php
Outdated
return $this->query_active($select, $conds, $params); | ||
} | ||
|
||
public function get_active_by_id($ids, $swLat, $swLng, $neLat, $neLng) | ||
public function get_active_by_id($miniv, $minlevel, $exminiv, $ids, $swLat, $swLng, $neLat, $neLng) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be in the wrong order, $ids
should be the first parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch updated this
lib/Monocle.php
Outdated
} | ||
if (!empty($minlevel) && !is_nan((float)$minlevel) && $minlevel != 0) { | ||
if (empty($exminiv)) { | ||
$conds[] = '(level >= ' . $minlevel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZeChrales fork doesn't have level
in DB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the level portion of ZeChrales
Include extra get_active_by_ids in Alternate Branch Removed extra config parameter. Fixed missing float variable in Monocle.php Removed level from stock Monocle
lib/Monocle_Alternate.php
Outdated
$conds = array(); | ||
$params = array(); | ||
|
||
$select = "pokemon_id, expire_timestamp AS disappear_time, encounter_id, lat AS latitude, lon AS longitude, gender, form"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure where you copied this from but this line has weight
on develop branch
# Conflicts: # lib/Monocle_Alternate.php
@@ -54,6 +70,7 @@ public function get_active_by_id($ids, $swLat, $swLng, $neLat, $neLng) | |||
$params = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think something went wrong when solving the merge conflicts, $miniv, $minlevel, $exminiv
are removed from function params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Global Min IV
The basic structure i went with was adding two fields. The first field was for minIV and the second field was exclude from minIV. I found people wanted to be able to see all tyrans, and drags and such even when miniv was on.
I have tested this with both Rocketmaps and Monkey Monocle and both work as intended. When the minIV is triggered all mons below the reported IV will not come into new raw_data request. I tried to reload the mons off the IV on the Javascript side but kept crashing tabs in chrome because its a lot more processing than just excluding a mon.
The min IV field is a number field with a minimum number of 0 and a maximum of 100. If the min IV is set to 0 or "" all mons on the map will be displayed regardless of whether they have an IV.
I also found the lots of my members wanted to see rare mons still even if the IV was lower than the global filter. So for this I added the exclude from min iv field. Any mon in this field will display on the map regardless of IV.
My users have enjoyed this feature for a couple weeks now while I was working the kinks out so please give it a try and if someone can test on Base Monocle that would be wonderful.
Image Based Pokemon Filtering
Select2 is not what it used to be in the internet world and does not make it easy to quickly filter various pokemon. So I created a simple element that encapsulates all pokemon images into a scrollable easy to deselect filter. This is implemented for exclude_min_iv, hide_pokemon and notify_pokemon.
In the config file I added two variables for this one. The first is $noImageSelect. This allows you to turn on and off the image based filtering and fallback to select 2 if you want. The second is $pathToImages which allows you to define a custom path to where the pokemon images are located. Default path is to the icons-safe directory.
This has been tested on Chrome, Firefox, Safari, and Edge.