Hi friends...
There may be errors in translation.
This MOD is a function to modify, delete, or add tech tree conditions.
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.
Reference!
1. You can delete the row you want or modify the condition.
2. When a new tech tree is saved, it will be sorted and displayed.
3. Displayed by group.
4. Automatically block on further saves with the same row incorrectly.
1. Create a php file.
includes/game/ShowRequriementsPage.class.php
Display All
2. Create a tpl file.
templates/game/page.requriements.tpl
Display All
3. Add link.
End.....
Thanks.
There may be errors in translation.
This MOD is a function to modify, delete, or add tech tree conditions.
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.
Reference!
1. You can delete the row you want or modify the condition.
2. When a new tech tree is saved, it will be sorted and displayed.
3. Displayed by group.
4. Automatically block on further saves with the same row incorrectly.
1. Create a php file.
includes/game/ShowRequriementsPage.class.php
PHP Source Code
- <?php
- #by noonn
- /*
- Tech Tree Editor
- */
- class ShowRequriementsPage 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 requireLevel, requireID, elementID FROM %%VARS_REQUIRE%% WHERE elementID IN
- (SELECT elementID FROM %%VARS_REQUIRE%% GROUP BY elementID HAVING COUNT(*) >= 1) ORDER BY elementID, requireID ASC;" ;
- $Startowne = Database::get()->select($sql, array(
- ));
- $fleet_i = array();
- foreach ($Startowne as $Data) {
- if(!isset($fleet_i[$Data['elementID']]))
- $fleet_i[$Data['elementID']] = array();
- $Data['elementID'] = $Data['elementID'];
- $Data['requireID'] = $Data['requireID'];
- $Data['requireLevel'] = $Data['requireLevel'];
- $fleet_i[$Data['elementID']][$Data['requireID']] = $Data;
- }
- $this->assign(array(
- 'fleet_i' => $fleet_i,
- 'requireLv' => $LNG['tech'],
- ));
- $this->display('page.requriements.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', '');
- $requireID = HTTP::_GP('requireID', '');
- $sql = 'DELETE FROM %%VARS_REQUIRE%% WHERE elementID = :elemID AND requireID = :requireID ;';
- $db->delete($sql, array(
- ':elemID' => $elemID,
- ':requireID' => $requireID,
- ));
- $this->redirectTo('game.php?page=requriements');
- }
- 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', '');
- $requireID = HTTP::_GP('requireID', '');
- $newlevel = HTTP::_GP('newlevel', '');
- // Check no same elemID and requireID
- $sql = "SELECT COUNT(*) as count FROM %%VARS_REQUIRE%% WHERE elementID = :elemID AND requireID = :requireID ;";
- $checkID = $db->selectSingle($sql, array(
- ':elemID' => $elemID,
- ':requireID' => $requireID,
- ), '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=requriements'
- )));
- }
- $sql = "UPDATE %%VARS_REQUIRE%% SET requireLevel = :requireLevel WHERE elementID = :elemID AND requireID = :requireID ;";
- $db->update($sql, array(
- ':requireLevel' => $newlevel,
- ':elemID' => $elemID,
- ':requireID' => $requireID,
- ));
- $this->redirectTo('game.php?page=requriements');
- }
- 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', '');
- $requireID = HTTP::_GP('requireID', '');
- $newlevel = HTTP::_GP('newlevel', '');
- // Check same elemID and requireID
- $sql = "SELECT COUNT(*) as count FROM %%VARS_REQUIRE%% WHERE elementID = :elemID AND requireID = :requireID ;";
- $checkID = $db->selectSingle($sql, array(
- ':elemID' => $elemID,
- ':requireID' => $requireID,
- ), '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=requriements'
- )));
- }
- // INSERT data
- $sql = 'INSERT INTO %%VARS_REQUIRE%% SET elementID = :elemID, requireID = :requireID, requireLevel = :newlevel ;';
- $db->insert($sql, array(
- ':elemID' => $elemID,
- ':requireID' => $requireID,
- ':newlevel' => $newlevel,
- ));
- $this->redirectTo('game.php?page=requriements');
- }
- 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=requriements');
- }
- }
- ?>
2. Create a tpl file.
templates/game/page.requriements.tpl
HTML Source Code
- {block name="title" prepend}Tech Tree Settings{/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">
- Tech Tree Settings
- </div>
- <table border='1' width="100%">
- <tr>
- <th colspan="2"><font color="red" style="font-size:1.3em;color:#9BC800;">
- <pre>
- Reference!
- 1. You can delete the row you want or modify the condition.
- 2. When a new tech tree is saved, it will be sorted and displayed.
- 3. Displayed by group.
- 4. Automatically block on further saves with the same row incorrectly.
- </pre>
- </font>
- </th>
- </tr>
- <tr>
- <td><form action="?page=requriements&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: #00568B;color: white;width:100px;padding: 10px 6px;"></td>
- </form>
- </tr>
- </table>
- <table border='1' width="100%">
- <tr>
- <td class="bgco" height="30px">ITEM</td>
- <td class="bgco">Tech requir</td>
- <td class="bgco">Level</td>
- <td class="bgco">save</td>
- </tr>
- <form action="?page=requriements&mode=add" method="post">
- <tr>
- <td>
- {html_options name=elemID options=$requireLv style='font-size:1.0em;color:#58FA58'}
- </td>
- <td>
- {html_options name=requireID options=$requireLv style='font-size:1.0em;color:#EE00E6'}
- </td>
- <td>
- <input style="width:60px; color:#FC6;font-size:1.3em" name="newlevel" type="number" min="1" onchange="KeyUpBuy('');" onkeyup="KeyUpBuy('');" value="1">
- </td>
- <td>
- <input style="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="5" height="30px">Tech tree in Database</td>
- </tr>
- <tr>
- <td class="bgco" height="30px">ITEM</td>
- <td class="bgco">Tech requir</td>
- <td class="bgco">Level</td>
- <td class="bgco">Edit TechTree</td>
- <td class="bgco">DELETE</td>
- </tr>
- {foreach $fleet_i as $elemID => $ids}
- <tr>
- <td rowspan="{count($ids)}">({$elemID})
- <a href="#" style="color:#58FA58;padding-left: 3px;" onclick="return Dialog.info({$elemID})">{$LNG.tech.{$elemID}}</a>
- </td>
- {foreach $ids as $ID => $id}
- <td>({$id.requireID})
- <a href="#" style="color:#EE00E6;padding-left: 3px;" onclick="return Dialog.info({$id.requireID})">{$LNG.tech.{$id.requireID}}</a></td>
- <td><span style="color:#FC6;">{$id.requireLevel}</span></td>
- <td>
- <form action="?page=requriements&mode=edits&elemID={$elemID}&requireID={$id.requireID}" method="post">
- <input style="font-size:1.3em;width:50px;height:20px" name="newlevel" type="number" min="1" onchange="KeyUpBuy('');" onkeyup="KeyUpBuy('');" value="{$id.requireLevel}">
- <input onclick="return confirm('Modify the rows of item {$elemID}, {$id.requireID} ?');" style="font-size:1.0em;background-color: #003A68;color: white;width:50px;padding: 2px 2px;" type="submit" value="Modify">
- </form>
- </td>
- <td>
- <form action="?page=requriements&mode=del&elemID={$elemID}&requireID={$id.requireID}" method="post">
- <input onclick="return confirm('Delete the rows of item {$elemID}, {$id.requireID} ?');" type="submit" value="DELETE" style="color:red">
- </form>
- </td>
- </tr>{if !$id@last}<tr>{/if}
- {/foreach}
- {/foreach}
- </table>
- <br><br><br><br><br><br><br>
- </div>
- {/block}
3. Add link.
End.....
Thanks.
--------------------------------------------------------------------------------------
The post was edited 3 times, last by noonn ().