mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-14 00:44:23 -05:00
D2S Editing WIP
This commit is contained in:
@@ -1,66 +1,12 @@
|
||||
<?php
|
||||
$form = new Formr\Formr();
|
||||
|
||||
/*
|
||||
|
||||
Copyright (C) 2021 Hash Borgir
|
||||
|
||||
This file is part of D2Modder
|
||||
|
||||
Redistribution and use in source and binary forms, with
|
||||
or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* This software must not be used for commercial purposes
|
||||
* without my consent. Any sales or commercial use are prohibited
|
||||
* without my express knowledge and consent.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY!
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
//dump($charData);
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<div style="text-align: center; margin-top: 20px;">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs" id="CTabs" role="tablist">
|
||||
|
||||
|
||||
<?php
|
||||
foreach ($charData as $c) {
|
||||
|
||||
$tabs = '';
|
||||
// ddump($c);
|
||||
|
||||
$tabs .= <<<EOT
|
||||
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link btn btn-outline-danger" style="background: #ddd; border: 1px solid #888;" id="{$c->cData['CharacterName']}-tab" data-toggle="tab" href="#{$c->cData['CharacterName']}" role="tab" aria-controls="{$c->cData['CharacterName']}" aria-selected="true"><img height="64" width="" src="img/chars/{$c->cData['CharacterClass']}.gif">{$c->cData['CharacterName']}</a>
|
||||
</li>
|
||||
@@ -68,174 +14,116 @@ EOT;
|
||||
echo $tabs;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="tab-content" id="CTabContent">
|
||||
<?php
|
||||
foreach ($charData as $c) {
|
||||
|
||||
$quests = null;
|
||||
foreach ($c->cData['Quests'] as $quest) {
|
||||
foreach ($quest as $difficulty => $q) {
|
||||
$quests = '';
|
||||
foreach ($c->cData['Quests'] as $quest) {
|
||||
foreach ($quest as $difficulty => $q) {
|
||||
$quests .= "<h2>$difficulty</h2>";
|
||||
|
||||
foreach ($q as $k => $v) {
|
||||
$kD = str_replace("_", " ", $k);
|
||||
$kD = str_replace(" NM", "", $kD);
|
||||
$kD = str_replace(" Hell", "", $kD);
|
||||
|
||||
if ($v == 1) {
|
||||
$quests .= "<input type='checkbox' value='1' name='quest[$k]' id='$k' checked><label for='$k'>$kD</label><br>";
|
||||
} else {
|
||||
$quests .= "<input type='checkbox' value='1' name='quest[$k]' id='$k'><label for='$k'>$kD</label><br>";
|
||||
}
|
||||
$kD = str_replace([" NM", " Hell"], "", $kD);
|
||||
$checked = ($v == 1) ? 'checked' : '';
|
||||
|
||||
$quests .= "<input type='checkbox' value='1' name='quest[$k]' id='$k' $checked>";
|
||||
$quests .= "<label for='$k'>$kD</label><br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$wps = null;
|
||||
$wps .= "<input type='radio' value='1' name='wp_all' id='wp_all'><label style='font-size: 1.3em;color:green;' for='wp_all'>Enable All Waypoints</label><br><input type='radio' value='0' name='wp_all' id='wp_all_off'><label style='font-size: 1.3em; color: red;' for='wp_all_off'>Disable All Waypoints</label><hr>";
|
||||
foreach ($c->cData['Waypoints'] as $diff => $waypoints) {
|
||||
$wps .= "<h2>$diff</h2>";
|
||||
$wps = '';
|
||||
$wps .= "<input type='radio' value='1' name='wp_all' id='wp_all'>";
|
||||
$wps .= "<label style='font-size: 1.3em;color:green;' for='wp_all'>Enable All Waypoints</label><br>";
|
||||
$wps .= "<input type='radio' value='0' name='wp_all' id='wp_all_off'>";
|
||||
$wps .= "<label style='font-size: 1.3em; color: red;' for='wp_all_off'>Disable All Waypoints</label><hr>";
|
||||
|
||||
|
||||
|
||||
foreach ($c->cData['Waypoints'] as $diff => $waypoints) { // diff is difficulty
|
||||
$wps .= "<h2>$diff</h2>";
|
||||
array_pop($waypoints);
|
||||
foreach ($waypoints as $k => $v) {
|
||||
$kD = str_replace("_", " ", $k);
|
||||
$kD = str_replace(" NM", "", $kD);
|
||||
$kD = str_replace(" Hell", "", $kD);
|
||||
if ($v == 1 && $k != ''){
|
||||
$wps .= "<input type='checkbox' value='1' name='wp[$k]' id='$k' checked disabled><label for='$k'>$kD</label><br>";
|
||||
} else {
|
||||
$wps .= "<input type='checkbox' value='1' name='wp[$k]' id='$k' disabled><label for='$k'>$kD</label><br>";
|
||||
}
|
||||
$wp_count = 0;
|
||||
foreach ($waypoints as $k => $v) {
|
||||
|
||||
$kD = str_replace("_", " ", $k);
|
||||
$kD = str_replace([" NM", " Hell"], "", $kD);
|
||||
$checked = ($v == 1 && $k != '') ? 'checked ' : '';
|
||||
|
||||
$wps .= "<input diff='$diff' class='wpcheck' type='checkbox' value='1' name='$wp_count' id='$k' $checked>";
|
||||
$wps .= "<label for='$k'>$kD</label><br>";
|
||||
$wp_count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
$classOptions = [
|
||||
'Amazon', 'Assassin', 'Barbarian', 'Druid', 'Paladin', 'Necromancer', 'Sorceress'
|
||||
];
|
||||
$option = '';
|
||||
if ($c->cData['CharacterClass'] == 'Amazon'){
|
||||
$option .= "<option value='Amazon' selected>Amazon</option>";
|
||||
} else {
|
||||
$option .= "<option value='Amazon'>Amazon</option>";
|
||||
|
||||
foreach ($classOptions as $class) {
|
||||
$selected = ($c->cData['CharacterClass'] == $class) ? 'selected' : '';
|
||||
$option .= "<option value='$class' $selected>$class</option>";
|
||||
}
|
||||
|
||||
if ($c->cData['CharacterClass'] == 'Assassin'){
|
||||
$option .= "<option value='Assassin' selected>Assassin</option>";
|
||||
} else {
|
||||
$option .= "<option value='Assassin'>Assassin</option>";
|
||||
}
|
||||
|
||||
if ($c->cData['CharacterClass'] == 'Barbarian'){
|
||||
$option .= "<option value='Barbarian' selected>Barbarian</option>";
|
||||
} else {
|
||||
$option .= "<option value='Barbarian'>Barbarian</option>";
|
||||
}
|
||||
$difficulties = [
|
||||
'Normal' => 'DifficultyNormal',
|
||||
'NM' => 'DifficultyNM',
|
||||
'Hell' => 'DifficultyHell'
|
||||
];
|
||||
|
||||
if ($c->cData['CharacterClass'] == 'Druid'){
|
||||
$option .= "<option value='Druid' selected>Druid</option>";
|
||||
} else {
|
||||
$option .= "<option value='Druid'>Druid</option>";
|
||||
}
|
||||
|
||||
if ($c->cData['CharacterClass'] == 'Paladin'){
|
||||
$option .= "<option value='Paladin' selected>Paladin</option>";
|
||||
} else {
|
||||
$option .= "<option value='Paladin'>Paladin</option>";
|
||||
}
|
||||
|
||||
if ($c->cData['CharacterClass'] == 'Necromancer'){
|
||||
$option .= "<option value='Necromancer' selected>Necromancer</option>";
|
||||
} else {
|
||||
$option .= "<option value='Necromancer'>Necromancer</option>";
|
||||
}
|
||||
|
||||
if ($c->cData['CharacterClass'] == 'Sorceress'){
|
||||
$option .= "<option value='Sorceress' selected>Sorceress</option>";
|
||||
} else {
|
||||
$option .= "<option value='Sorceress'>Sorceress</option>";
|
||||
}
|
||||
|
||||
$radio = '';
|
||||
if ($c->cData['Difficulty']['Norm'] == 1){
|
||||
$radio .= '<input checked type="radio" id="DifficultyNormal" name="Difficulty" value="Normal">Normal<br>';
|
||||
} else {
|
||||
$radio .= '<input type="radio" id="DifficultyNormal" name="Difficulty" value="Normal">Normal<br>';
|
||||
|
||||
foreach ($difficulties as $difficulty => $id) {
|
||||
$checked = ($c->cData['Difficulty'][$difficulty] == 1) ? 'checked' : '';
|
||||
$radio .= "<input $checked type='radio' id='$id' name='Difficulty' value='$difficulty'>$difficulty<br>";
|
||||
}
|
||||
|
||||
|
||||
if ($c->cData['Difficulty']['NM'] == 1){
|
||||
$radio .= '<input checked type="radio" id="DifficultyNM" name="Difficulty" value="NM">NM<br>';
|
||||
} else {
|
||||
$radio .= '<input type="radio" id="DifficultyNM" name="Difficulty" value="NM">NM<br>';
|
||||
}
|
||||
|
||||
|
||||
if ($c->cData['Difficulty']['Hell'] == 1){
|
||||
$radio .= '<input checked type="radio" id="DifficultyHell" name="Difficulty" value="Hell">Hell<br>';
|
||||
} else {
|
||||
$radio .= '<input type="radio" id="DifficultyHell" name="Difficulty" value="Hell">Hell<br>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($c->cData['Quests'][0]['Norm']["DenOfEvil"]) $a1q1 = "checked";
|
||||
if ($c->cData['Quests'][0]['Norm']["SistersBurialGrounds"]) $a1q2 = "checked";
|
||||
if ($c->cData['Quests'][0]['Norm']["TheSearchForCain"]) $a1q3 = "checked";
|
||||
if ($c->cData['Quests'][0]['Norm']["TheForgottenTower"]) $a1q4 = "checked";
|
||||
if ($c->cData['Quests'][0]['Norm']["ToolsOfTheTrade"]) $a1q5 = "checked";
|
||||
if ($c->cData['Quests'][0]['Norm']["SistersToTheSlaughter"]) $a1q6 = "checked";
|
||||
|
||||
$skills = '';
|
||||
foreach($c->cData['skills']['skills'] as $k => $skill){
|
||||
$skills .= "<input style='width: 64px;' class='skill-$k skill' name='$k' type='number' min='1' max='99' value='{$skill['points']}'>: {$skill['skill']}<hr>";
|
||||
}
|
||||
foreach ($c->cData['skills']['skills'] as $k => $skill) {
|
||||
$skills .= "<input style='width: 64px;' class='skill-$k skill' name='skills[$k]' type='number' min='0' max='99' value='{$skill['points']}'>: {$skill['skill']}<hr>";
|
||||
}
|
||||
|
||||
|
||||
// dump($c['Waypoints']);
|
||||
$tabContent .= <<<EOT
|
||||
<div style="background: white;" class="tab-pane fade" id="{$c->cData['CharacterName']}" role="tabpanel" aria-labelledby="{$c->cData['CharacterName']}-tab">
|
||||
<form method="POST" action="/saveCharacter.php">
|
||||
<input type="hidden" name="filePath" id="filePath" value="{$c->cData['filePath']}">
|
||||
<div class="container" style="font-size: 14px;">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div style="background: white;" class="tab-pane fade" id="{$c->cData['CharacterName']}" role="tabpanel" aria-labelledby="{$c->cData['CharacterName']}-tab">
|
||||
<form class="charform" method="POST" action="/saveCharacter.php">
|
||||
<input type="hidden" name="filePath" id="filePath" value="{$c->cData['filePath']}">
|
||||
<div class="container" style="font-size: 14px;">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 style="margin: 15px;">{$c->cData['CharacterName']}</h1>
|
||||
<input class="btn btn-danger" style="" type="submit" value="Save Character">
|
||||
<img src="/img/chars/{$c->cData['CharacterClass']}.gif"><br>
|
||||
<input type="text" id="ChracterName" name="ChracterName" maxlength="16" value="{$c->cData['CharacterName']}">
|
||||
<select id='CharacterClass'>
|
||||
$option
|
||||
</select>
|
||||
Level: <input style="border: 1px solid black;width: 54px;" type="number" id="CharacterLevel" value="{$c->cData['CharacterLevel']}"><br>
|
||||
$radio
|
||||
$skills
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col"><h2>Quests</h2>
|
||||
$quests
|
||||
</div>
|
||||
<div class="col"><h2>Waypoints</h2>
|
||||
$wps
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<input type="text" id="ChracterName" name="ChracterName" maxlength="16" value="{$c->cData['CharacterName']}">
|
||||
<select id='CharacterClass'>
|
||||
$option
|
||||
</select>
|
||||
Level: <input style="border: 1px solid black;width: 54px;" type="number" id="CharacterLevel" value="{$c->cData['CharacterLevel']}"><br>
|
||||
$radio
|
||||
$skills
|
||||
</div>
|
||||
<div class="col">
|
||||
<h2>Quests</h2>
|
||||
$quests
|
||||
</div>
|
||||
<div class="col">
|
||||
<h2>Waypoints</h2>
|
||||
$wps
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input class="btn btn-danger" style="" type="submit" value="Save Character">
|
||||
</form>
|
||||
</div>
|
||||
<input class="btn btn-danger" style="" type="submit" value="Save Character">
|
||||
</form>
|
||||
</div>
|
||||
EOT;
|
||||
|
||||
echo $tabContent;
|
||||
|
Reference in New Issue
Block a user