-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New feature: enable/disable scheduled raid bosses
Added the ability to enable and disable scheduled raid bosses. Makes managing regional raid bosses easier if using automatic updating of upcoming bosses.
- Loading branch information
1 parent
217220e
commit 7b54eb5
Showing
13 changed files
with
188 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5 | ||
6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
// Write to log. | ||
debug_log('edit_scheduled_entry()'); | ||
|
||
// Check access. | ||
$botUser->accessCheck('pokedex'); | ||
$id = $data['i']; | ||
|
||
$query = my_query('SELECT pokedex_id, pokemon_form_id, date_start, date_end, raid_level, disabled FROM raid_bosses WHERE id = ? LIMIT 1', [$id]); | ||
$pokemon = $query->fetch(); | ||
if(isset($data['s']) && $data['s'] == 1) { | ||
my_query('UPDATE raid_bosses SET disabled = NOT disabled WHERE id = ?', [$id]); | ||
$pokemon['disabled'] = ($pokemon['disabled'] == 1) ? 0 : 1; | ||
} | ||
if(isset($data['s']) && $data['s'] == 2) { | ||
$msg = getTranslation('delete_scheduled_confirmation') . CR . CR; | ||
$msg .= $pokemon['date_start'] . ' - ' . $pokemon['date_end'] . ':' . CR; | ||
$msg .= getTranslation($pokemon['raid_level'] . 'stars') . ': '; | ||
$msg .= get_local_pokemon_name($pokemon['pokedex_id'], $pokemon['pokemon_form_id']) . CR; | ||
$msg .= '<b>' . ($pokemon['disabled'] ? getTranslation('disabled') : getTranslation('enabled')) .'</b>'; | ||
$keys[0][0] = button(getTranslation('yes'), ['edit_scheduled_entry', 'i' => $id, 's' => 3]); | ||
$keys[0][1] = button(getTranslation('no'), ['edit_scheduled_entry', 'i' => $id]); | ||
// Build callback message string. | ||
$callback_response = 'OK'; | ||
|
||
// Telegram JSON array. | ||
$tg_json = array(); | ||
|
||
// Answer callback. | ||
$tg_json[] = answerCallbackQuery($update['callback_query']['id'], $callback_response, true); | ||
|
||
// Edit message. | ||
$tg_json[] = edit_message($update, $msg, $keys, false, true); | ||
|
||
// Telegram multicurl request. | ||
curl_json_multi_request($tg_json); | ||
exit(); | ||
} | ||
if(isset($data['s']) && $data['s'] == 3) { | ||
my_query('DELETE FROM raid_bosses WHERE id = ?', [$id]); | ||
include(ROOT_PATH . '/mods/pokedex_list_raids.php'); | ||
exit(); | ||
} | ||
$msg = getTranslation('edit_scheduled_entry') . ':' . CR . CR; | ||
$msg .= EMOJI_CLOCK . SP . $pokemon['date_start'] . ' - ' . $pokemon['date_end'] . CR; | ||
$msg .= getTranslation($pokemon['raid_level'] . 'stars') . ': '; | ||
$msg .= get_local_pokemon_name($pokemon['pokedex_id'], $pokemon['pokemon_form_id']) . CR; | ||
$msg .= '<b>' . ($pokemon['disabled'] ? getTranslation('disabled') : getTranslation('enabled')) .'</b>'; | ||
|
||
$keys[0][] = button( | ||
($pokemon['disabled'] ? getTranslation('enable') : getTranslation('disable')), | ||
['edit_scheduled_entry', 'i' => $id, 's' => 1] | ||
); | ||
$keys[1][] = button(getTranslation('delete'), ['edit_scheduled_entry', 'i' => $id, 's' => 2]); | ||
$keys[2][] = button(getTranslation('back'), 'pokedex_list_raids'); | ||
|
||
// Build callback message string. | ||
$callback_response = 'OK'; | ||
|
||
// Telegram JSON array. | ||
$tg_json = array(); | ||
|
||
// Answer callback. | ||
$tg_json[] = answerCallbackQuery($update['callback_query']['id'], $callback_response, true); | ||
|
||
// Edit message. | ||
$tg_json[] = edit_message($update, $msg, $keys, false, true); | ||
|
||
// Telegram multicurl request. | ||
curl_json_multi_request($tg_json); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE `raid_bosses` ADD COLUMN IF NOT EXISTS `disabled` TINYINT(1) UNSIGNED DEFAULT 0 AFTER `scheduled`; |