Hi~
There may be errors in translation.
Modified to operate in 2.0 by referring to the 1.7 version of the library.
Produced by referring to the link below.
[MOD](Edit Rapidfire) Корректировка скорострела %D0%B8%D1%80%D0%BE%D0%B2%D0%BA%D0%B0-%D1%81%D0%BA%D0%BE%D1%80%D0%BE%D1%81% D1%82%D1%80%D0%B5%D0%BB%D0%B0/
It has been perfectly implemented so that anyone can use it, and i made it very easy to use.
A screenshot is attached.
I hope this helps a lot.
Function:
1. You can delete the current row or modify the amount of Rapid fire.
2. When saving a new rapid fire, it is displayed in order.
3. Automatically stop on further saves with the same row incorrectly.
1. Create a php file.
includes/game/ShowRapidfirePage.class.php
Display All
2. Create a tpl file.
templates/game/page.rapidfire.tpl
Display All
3. Add link.
End.....
Thanks.
There may be errors in translation.


Modified to operate in 2.0 by referring to the 1.7 version of the library.
Produced by referring to the link below.
[MOD](Edit Rapidfire) Корректировка скорострела %D0%B8%D1%80%D0%BE%D0%B2%D0%BA%D0%B0-%D1%81%D0%BA%D0%BE%D1%80%D0%BE%D1%81% D1%82%D1%80%D0%B5%D0%BB%D0%B0/
It has been perfectly implemented so that anyone can use it, and i made it very easy to use.
A screenshot is attached.
I hope this helps a lot.
Function:
1. You can delete the current row or modify the amount of Rapid fire.
2. When saving a new rapid fire, it is displayed in order.
3. Automatically stop on further saves with the same row incorrectly.
1. Create a php file.
includes/game/ShowRapidfirePage.class.php
PHP Source Code
- <?php
- # 1st by aurum79
- # 2nd by noonn
- /*
- Rapid fire editor of DB
- */
- class ShowRapidfirePage extends AbstractGamePage
- {
- public static $requireModule = 0;
- function __construct()
- {
- parent::__construct();
- }
- function show()
- {
- global $USER, $LNG;
- $db = Database::get();
- if($USER['authlevel'] != 3){
- $this->printMessage("Page not found.<br>", array(array(
- 'label' => "Move",
- 'url' => 'game.php'
- )));
- }
- $sql = "SELECT * FROM %%VARS_RAPIDFIRE%% ORDER BY elementID, rapidfireID;";
- $rapidResult = $db->select($sql, array());
- $fleet_i = array();
- foreach ($rapidResult as $row)
- {
- $fleet_i[] = array(
- 'elementID' => $row['elementID'],
- 'rapidfireID' => $row['rapidfireID'],
- 'shoots' => $row['shoots'],
- );
- }
- $this->assign(array(
- 'fleet_i' => $fleet_i,
- 'short' => $LNG['shortNames'],
- ));
- $this->display('page.rapidfire.tpl');
- }
- function del()
- {
- global $USER;
- if($USER['authlevel'] != 3){
- $this->printMessage("Page not found.<br>", array(array(
- 'label' => "Move",
- 'url' => 'game.php'
- )));
- }
- $db = Database::get();
- $elemID = HTTP::_GP('elemID', '');
- $rapID = HTTP::_GP('rapID', '');
- $sql = 'DELETE FROM %%VARS_RAPIDFIRE%% WHERE elementID = :elemID AND rapidfireID = :rapID ;';
- $db->delete($sql, array(
- ':elemID' => $elemID,
- ':rapID' => $rapID,
- ));
- $this->redirectTo('game.php?page=rapidfire');
- }
- function edits()
- {
- global $USER;
- if($USER['authlevel'] != 3){
- $this->printMessage("Page not found.<br>", array(array(
- 'label' => "Move",
- 'url' => 'game.php'
- )));
- }
- $db = Database::get();
- $elemID = HTTP::_GP('elemID', '');
- $rapID = HTTP::_GP('rapID', '');
- $shoots = HTTP::_GP('newshoots', '');
- // Check no same elemID and rapidfireID
- $sql = "SELECT COUNT(*) as count FROM %%VARS_RAPIDFIRE%% WHERE elementID = :elemID AND rapidfireID = :rapID ;";
- $checkID = $db->selectSingle($sql, array(
- ':elemID' => $elemID,
- ':rapID' => $rapID,
- ), 'count');
- if(empty($checkID) || $checkID > 1){
- $this->printMessage("<span style=font-size:1.3em;color:#EE00E6><br>Error: Item does not exist, or an identical row exists. !!<br><br></span>", array(array(
- 'label' => "Move",
- 'url' => '?page=rapidfire'
- )));
- }
- $sql = "UPDATE %%VARS_RAPIDFIRE%% SET shoots = :shoots WHERE elementID = :elemID AND rapidfireID = :rapID ;";
- $db->update($sql, array(
- ':shoots' => $shoots,
- ':elemID' => $elemID,
- ':rapID' => $rapID,
- ));
- $this->redirectTo('game.php?page=rapidfire');
- }
- function add()
- {
- global $USER;
- if($USER['authlevel'] != 3){
- $this->printMessage("Page not found.<br>", array(array(
- 'label' => "Move",
- 'url' => 'game.php'
- )));
- }
- $db = Database::get();
- $elemID = HTTP::_GP('elemID', '');
- $rapID = HTTP::_GP('rapID', '');
- $shoots = HTTP::_GP('shoots', '');
- // Check same elemID and rapidfireID
- $sql = "SELECT COUNT(*) as count FROM %%VARS_RAPIDFIRE%% WHERE elementID = :elemID AND rapidfireID = :rapID ;";
- $checkID = $db->selectSingle($sql, array(
- ':elemID' => $elemID,
- ':rapID' => $rapID,
- ), 'count');
- if($checkID == 1){
- $this->printMessage("<span style=font-size:1.3em;color:#EE00E6><br>ERROR: Same item exists. !!<br><br></span>", array(array(
- 'label' => "Move",
- 'url' => '?page=rapidfire'
- )));
- }
- // INSERT data
- $sql = 'INSERT INTO %%VARS_RAPIDFIRE%% SET elementID = :elemID, rapidfireID = :rapID, shoots = :shoots ;';
- $db->insert($sql, array(
- ':elemID' => $elemID,
- ':rapID' => $rapID,
- ':shoots' => $shoots,
- ));
- $this->redirectTo('game.php?page=rapidfire');
- }
- function ClearCache()
- {
- global $USER, $LNG;
- if($USER['authlevel'] != 3){
- $this->printMessage("Page not found.<br>", array(array(
- 'label' => "Move",
- 'url' => 'game.php'
- )));
- }
- ClearCache();
- $this->redirectTo('game.php?page=rapidfire');
- }
- }
- ?>
2. Create a tpl file.
templates/game/page.rapidfire.tpl
HTML Source Code
- {block name="title" prepend}Rapid fire editor{/block}
- {block name="content"}
- <style>
- td{
- font-size:1.2em;
- }
- .bgco{
- background-color:#003851;
- }
- </style>
- <div class="content_page">
- <div class="title" style="font-size:1.2em">
- Rapid fire editor
- </div>
- <table border='1' width="100%">
- <tr>
- <th colspan="2"><font color="red" style="font-size:1.3em;color:#9BC800;">
- <pre>
- caution!
- 1. You can delete the current row or modify the amount of Rapid fire.
- 2. When saving a new rapid fire, it is displayed in order.
- 3. Automatically stop on further saves with the same row incorrectly.
- </pre>
- </font>
- </th>
- </tr>
- <tr>
- <td><form action="?page=rapidfire&mode=ClearCache" method="post">
- After all operations are complete, please clear the cache.
- </td>
- <td><input type="submit" value="Clear Cache" style="display:block;float:right;background-color: #003F5B;width:120px;color:#fff;height:30px"></td>
- </form>
- </tr>
- </table>
- <table border='1' width="100%">
- <tr>
- <td class="bgco" height="30px">Fleet/Defense</td>
- <td class="bgco">Rapid fire item</td>
- <td class="bgco">Rapid fire</td>
- <td class="bgco">Save</td>
- </tr>
- <form action="?page=rapidfire&mode=add" method="post">
- <tr>
- <td>
- {html_options name=elemID options=$short style='font-size:1.0em;color:#58FA58'}
- </td>
- <td>
- {html_options name=rapID options=$short style='font-size:1.0em;color:#EE00E6'}
- </td>
- <td>
- <input style="width:60px; color:#FC6;font-size:1.3em" name="shoots" type="number" min="1" onchange="KeyUpBuy('');" onkeyup="KeyUpBuy('');" value="1">
- </td>
- <td>
- <input style="background-color: #48A34B;width:120px;color:#fff;font-size:1.1em;display:block; margin:0 auto; padding:3px 15px;" type="submit" value="Add Save">
- </td>
- </tr>
- </form>
- </table>
- <table border='1' width="100%">
- <tr>
- <td colspan="6" height="30px">Rapid Fire in the database</td>
- </tr>
- <tr>
- <td class="bgco">No.</td>
- <td class="bgco">Delete</td>
- <td class="bgco" height="30px">Fleet/Defense</td>
- <td class="bgco">Rapid fire item</td>
- <td class="bgco">Rapid fire</td>
- <td class="bgco">Edit Rapid fire</td>
- </tr>
- {foreach $fleet_i as $row}
- <tr>
- <td width="30px">#{$row@iteration}</td>
- <td>
- <form action="?page=rapidfire&mode=del&elemID={$row.elementID}&rapID={$row.rapidfireID}" method="post">
- <input onclick="return confirm('Delete the rows of items {$row.elementID} and {$row.rapidfireID}?');" type="submit" value="Delete" style="font-size:0.9em;color:red">
- </form>
- </td>
- <td>({$row.elementID})
- <a href="#" style="color:#58FA58;padding-left: 3px;" onclick="return Dialog.info({$row.elementID})">{$LNG.tech.{$row.elementID}}</a></td>
- <td>({$row.rapidfireID})
- <a href="#" style="color:#EE00E6;padding-left: 3px;" onclick="return Dialog.info({$row.rapidfireID})">{$LNG.tech.{$row.rapidfireID}}</a></td>
- <td><span style="color:#FC6;">{$row.shoots}</span></td>
- <td>
- <form action="?page=rapidfire&mode=edits&elemID={$row.elementID}&rapID={$row.rapidfireID}" method="post">
- <input style="font-size:1.3em;width:50px;height:20px" name="newshoots" type="number" min="1" onchange="KeyUpBuy('');" onkeyup="KeyUpBuy('');" value="{$row.shoots}">
- <input onclick="return confirm('Modify the rows of items {$row.elementID} and {$row.rapidfireID}?');" style="font-size:1.0em;background-color: #003F5B;width:120px;color:#fff;" type="submit" value="Modify">
- </form>
- </td>
- </tr>
- {/foreach}
- </table>
- <br><br><br><br><br><br><br>
- </div>
- {/block}
3. Add link.
End.....
Thanks.


--------------------------------------------------------------------------------------
The post was edited 1 time, last by noonn ().