Skip to content

Commit aaaf0e1

Browse files
authored
Merge pull request #95 from bbdoc/PVP
Pvp v2 - Add Little Cup
2 parents dd9a232 + 248fc26 commit aaaf0e1

20 files changed

+243
-164
lines changed

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ REQUIRES MYSQL !
1212

1313
This tool is an add-on to [PoracleJS](https://github.com/KartulUdus/PoracleJS)
1414

15-
This is a first attempt at creating a Web Inteface to handle alarms configuration in PoracleJS.
16-
17-
Please note that I'm not a professional Web Developer, so the code might look ugly to some people, but it works. I'm of course open to suggestion on improving the code or adding functionalities.
15+
It requires a working webserver (typically Apache or nginx) + PHP.
16+
Alternatively it can be run out of Docker (Dockerfile is provided).
1817

1918
---
2019

actions/monsters.php

+12-13
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
if (!isset($_POST['max_sta']) || $_POST['max_sta'] == "") { $_POST['max_sta'] = $monster_defaults['max_sta']; }
2424

2525
// Replace Default Values if Set
26-
if ($_POST['great_league_ranking'] == "" ) { $_POST['great_league_ranking'] = 4096; }
27-
if ($_POST['ultra_league_ranking'] == "" ) { $_POST['ultra_league_ranking'] = 4096; }
26+
if ($_POST['pvp_ranking_worst'] == "" ) { $_POST['pvp_ranking_worst'] = 4096; }
27+
if ($_POST['pvp_ranking_min_cp'] == "" ) { $_POST['pvp_ranking_min_cp'] = 1; }
2828

2929
// Handle NO IV Pokemon
3030

@@ -53,7 +53,7 @@
5353
SET distance = ?, min_iv = ?, max_iv = ?, min_cp = ?, max_cp = ?,
5454
min_level = ?, max_level = ?, min_weight = ?, max_weight = ?,
5555
atk = ?, def = ?, sta = ?, max_atk = ?, max_def = ?, max_sta = ?,
56-
great_league_ranking = ?, great_league_ranking_min_cp = ?, ultra_league_ranking = ?, ultra_league_ranking_min_cp = ?,
56+
pvp_ranking_worst = ?, pvp_ranking_best = ?, pvp_ranking_min_cp = ?, pvp_ranking_league = ?,
5757
form = ?, gender = ?, clean = ?, template = ?
5858
WHERE uid = ?");
5959

@@ -79,10 +79,10 @@
7979
$_POST['max_atk'],
8080
$_POST['max_def'],
8181
$_POST['max_sta'],
82-
$_POST['great_league_ranking'],
83-
$_POST['great_league_ranking_min_cp'],
84-
$_POST['ultra_league_ranking'],
85-
$_POST['ultra_league_ranking_min_cp'],
82+
$_POST['pvp_ranking_worst'],
83+
$_POST['pvp_ranking_best'],
84+
$_POST['pvp_ranking_min_cp'],
85+
$_POST['league'],
8686
$form,
8787
$gender,
8888
$clean,
@@ -170,8 +170,7 @@
170170
atk, def, sta, template, clean,
171171
min_weight, max_weight, form,
172172
max_atk, max_def, max_sta, gender,
173-
great_league_ranking, great_league_ranking_min_cp,
174-
ultra_league_ranking, ultra_league_ranking_min_cp,
173+
pvp_ranking_worst, pvp_ranking_best, pvp_ranking_min_cp, pvp_ranking_league,
175174
profile_no
176175
)
177176
VALUES (?, '', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?, ?, ?, ?, ?, ?, ? )");
@@ -203,10 +202,10 @@
203202
$_POST['max_def'],
204203
$_POST['max_sta'],
205204
$gender,
206-
$_POST['great_league_ranking'],
207-
$_POST['great_league_ranking_min_cp'],
208-
$_POST['ultra_league_ranking'],
209-
$_POST['ultra_league_ranking_min_cp'],
205+
$_POST['pvp_ranking_worst'],
206+
$_POST['pvp_ranking_best'],
207+
$_POST['pvp_ranking_min_cp'],
208+
$_POST['league'],
210209
$_SESSION['profile']
211210
);
212211

actions/server_settings.php

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
}
5252

5353
$languages = implode (",", $languages);
54+
if ( $languages == "" ) { $languages = "en"; }
5455

5556
$stmt = $conn->prepare("INSERT INTO pweb_settings (setting, value) VALUES ('allowed_languages', ?) ON DUPLICATE KEY UPDATE value=?");
5657
if (false === $stmt) {

header.php

+1-21
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,7 @@
220220

221221
$sql = "SELECT * FROM monsters
222222
WHERE (min_iv > 0 or max_iv < 100 or atk > 0 or def > 0 or sta > 0 or max_atk < 15 or max_def < 15 or max_sta < 15)
223-
AND (
224-
great_league_ranking < 4096 OR great_league_ranking_min_cp > 0
225-
OR ultra_league_ranking < 4096 OR ultra_league_ranking_min_cp > 0
226-
)
223+
AND pvp_ranking_league <> 0
227224
AND id = '" . $_SESSION['id'] . "'";
228225

229226
$result = $conn->query($sql);
@@ -236,23 +233,6 @@
236233
$config_alarm.="</div>";
237234
}
238235

239-
// Check if Both PvP are used
240-
241-
$sql = "SELECT * FROM monsters
242-
WHERE (great_league_ranking < 4096 OR great_league_ranking_min_cp > 0 )
243-
AND ( ultra_league_ranking < 4096 OR ultra_league_ranking_min_cp > 0 )
244-
AND id = '" . $_SESSION['id'] . "'";
245-
246-
$result = $conn->query($sql);
247-
248-
if (!empty($result) && $result->num_rows > 0) {
249-
$config_alarm="<div class='alert alert-danger fade show mb-2' role='alert' style='background-color:darkred; color:white;'>";
250-
$config_alarm.="&#x26A0;<br>";
251-
$config_alarm.=i8ln("Some of your alarms contains both PvP Great and PvP Ultra Filters").".<br>";
252-
$config_alarm.=i8ln("Alarms will only be triggered if ALL Filters are met").".<br>";
253-
$config_alarm.="</div>";
254-
}
255-
256236
// Check If Distance Map should be displayed
257237

258238
// Get Map Image URL from API

include/db_mad.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ function get_raid_bosses() {
9595

9696
$bosses=array();
9797
while($row = $result->fetch_assoc()) {
98-
$pokemon_id=str_pad($row['pokemon_id'], 3, "0", STR_PAD_LEFT);;
99-
$form=str_pad($row['form'], 2, "0", STR_PAD_LEFT);
98+
$pokemon_id=$row['pokemon_id'];
99+
$form=$row['form'];
100100
$costume=$row['costume'];
101101
$evolution=$row['evolution'];
102102
if ( $evolution <> '0' ) { $boss = $pokemon_id."_".$form."_".$evolution; }

include/db_rdm.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ function get_raid_bosses() {
9898

9999
$bosses=array();
100100
while($row = $result->fetch_assoc()) {
101-
$pokemon_id=str_pad($row['raid_pokemon_id'], 3, "0", STR_PAD_LEFT);;
102-
$form=str_pad($row['raid_pokemon_form'], 2, "0", STR_PAD_LEFT);
101+
$pokemon_id=$row['raid_pokemon_id'];
102+
$form=$row['raid_pokemon_form'];
103103
$costume=$row['raid_pokemon_costume'];
104104
$evolution=$row['raid_pokemon_evolution'];
105105
if ( $evolution <> '0' ) { $boss = $pokemon_id."_".$form."_".$evolution; }

include/defaults.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

33
$monster_defaults = array(
4-
"great_league_ranking"=>4096,
5-
"ultra_league_ranking"=>4096,
6-
"great_league_ranking_min_cp"=>0,
4+
"pvp_ranking_best"=>0,
5+
"pvp_ranking_worst"=>4096,
6+
"pvp_ranking_min_cp"=>0,
77
"ultra_league_ranking_min_cp"=>0,
88
"min_iv"=>0,
99
"max_iv"=>100,

include/uicons_repo.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"Nileplumb Home" => "https://raw.githubusercontent.com/nileplumb/PkmnHomeIcons/master/UICONS",
66
"Nileplumb Outline" => "https://raw.githubusercontent.com/nileplumb/PkmnHomeIcons/master/UICONS_OS_128",
77
"Nileplumn Shuffle" => "https://raw.githubusercontent.com/nileplumb/PkmnShuffleMap/master/UICONS",
8-
"PokeDave Shuffle" => "https://raw.githubusercontent.com/jepke/pokedave_shuffle_icons_-PMSF-/master/UICONS"
8+
"PokeDave Shuffle" => "https://raw.githubusercontent.com/jepke/pokedave_shuffle_icons_-PMSF-/master/UICONS",
9+
"Jms412 Shuffle" => "https://raw.githubusercontent.com/jms412/PkmnShuffleMap/master/UICONS_Half_Shiny_128",
10+
"Jms412 Home" => "https://raw.githubusercontent.com/jms412/PkmnHomeIcons/master/UICONS_Half_Shiny_128"
911
);
1012
?>

index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
window.dataLayer = window.dataLayer || [];
2121
function gtag(){dataLayer.push(arguments);}
2222
gtag('js', new Date());
23-
gtag('config', '" . $gAnalyticsId . ");
23+
gtag('config', '" . $gAnalyticsId . "');
2424
</script>";
2525
}
2626
?>

js/functions.js

+15-13
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,24 @@ function setnoiv(type) {
3636
}
3737

3838
function setpvp(type) {
39-
var value = document.querySelector('input[id="league_' + type + '"]:checked').value;
40-
var divblock = "league_".concat(value).concat("_").concat(type);
41-
var divgreat = "league_great_".concat(type);
42-
var divultra = "league_ultra_".concat(type);
39+
var value = document.querySelector('input[id="league_' + type + '"]:checked').value;
40+
var divblock = "pvp_league_".concat(type);
4341

44-
document.getElementById("great_league_ranking_".concat(type)).value = "";
45-
document.getElementById("ultra_league_ranking_".concat(type)).value = "";
46-
document.getElementById("great_league_ranking_min_cp_".concat(type)).value = "";
47-
document.getElementById("ultra_league_ranking_min_cp_".concat(type)).value = "";
42+
switch(value) {
43+
case '500': var min = document.querySelector('input[id="pvpFilterLittleMinCP"]').value; break;
44+
case '1500': var min = document.querySelector('input[id="pvpFilterGreatMinCP"]').value; break;
45+
case '2500': var min = document.querySelector('input[id="pvpFilterUltraMinCP"]').value; break;
46+
}
47+
48+
document.getElementById("pvp_ranking_best_".concat(type)).value = "";
49+
document.getElementById("pvp_ranking_worst_".concat(type)).value = "";
50+
document.getElementById("pvp_ranking_min_cp_".concat(type)).value = "";
51+
document.getElementById("pvp_ranking_min_cp_".concat(type)).setAttribute("min", min);
52+
document.getElementById("pvp_ranking_min_cp_".concat(type)).setAttribute("max", value);
4853

49-
if(value == "none"){
50-
document.getElementById(divgreat).style.display = "none";
51-
document.getElementById(divultra).style.display = "none";
54+
if(value == "0"){
55+
document.getElementById(divblock).style.display = "none";
5256
} else {
53-
document.getElementById(divgreat).style.display = "none";
54-
document.getElementById(divultra).style.display = "none";
5557
document.getElementById(divblock).style.display = "block";
5658
}
5759
}

locales/fr.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -403,5 +403,8 @@
403403
"on display screen":"écran de visualisation",
404404
"on select screen":"écran de sélection",
405405
"Allow 'Admin Disabled' Users":"Autoriser les utilisateurs 'Admin Disabled'",
406-
"Display Channel ID in Admin Tools":"Afficher l'ID du Channel (OA)"
406+
"Display Channel ID in Admin Tools":"Afficher l'ID du Channel (OA)",
407+
"Rank between":"Rank entre",
408+
"and":"et",
409+
"Get Raid Bosses from":"Source des Boss de Raid"
407410
}

modal/areas_modal.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
};
4545
echo "<li><input type='checkbox' name='area_$area_var' id='area_$area_var' $checked/>\n";
4646
echo "<label for='area_$area_var' style='width:160px;'><font style='font-size:12px;'>$area</font>\n";
47-
if (@$disable_geomap_select <> "True") {
47+
if (@$disable_geomap_select <> "True") {
48+
$area = strtoupper(str_replace(' ', '_', $area));
4849
echo "<br><img src='.cache/geo_".$area."_".$hash.".png' style='width:100%; max-width=100%;'>";
4950
}
5051
echo "</label>\n";
@@ -72,14 +73,20 @@
7273
echo "<ul>\n";
7374
foreach ($areaList as $i => $area) {
7475
$area_var = str_replace(' ', '%20', $area);
76+
$hash = $geo_hash[$area];
7577

7678
if (in_array(strtolower($area), $existing_area)) {
7779
$checked = 'checked';
7880
} else {
7981
$checked = '';
8082
};
8183
echo "<li><input type='checkbox' name='area_$area_var' id='area_$area_var' $checked/>\n";
82-
echo "<label for='area_$area_var' style='width:160px;'><font style='font-size:12px;'>$area</font></label>\n";
84+
echo "<label for='area_$area_var' style='width:160px;'><font style='font-size:12px;'>$area</font>\n";
85+
if (@$disable_geomap_select <> "True") {
86+
$area = strtoupper(str_replace(' ', '_', $area));
87+
echo "<br><img src='.cache/geo_".$area."_".$hash.".png' style='width:100%; max-width=100%;'>";
88+
}
89+
echo "</label>\n";
8390
echo "</li>\n";
8491
}
8592
echo "</ul>\n</div>";

0 commit comments

Comments
 (0)