EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Tools (https://www.eqemulator.org/forums/forumdisplay.php?f=593)
-   -   PEQ Database Editor 1.0 (for servers 0.6.4 and up) (https://www.eqemulator.org/forums/showthread.php?t=20073)

wolfwalkereci 07-24-2013 09:36 PM

Quote:

Originally Posted by cavedude (Post 222708)
The newest editor has quick support added for special abilities (including editing those with params) and also lua quests. It's up on SVN now, or the daily dump can be grabbed tomorrow.

Great news! Thanks to those that actually know what they are doing with the editor. Love that tool.

wolfwalkereci 07-29-2013 07:58 AM

Cavedude or KLS
Another thing I noticed was adding lootdrops either did not let you specify mindrop, droplimit, multiplier, probability or if it did would ignore your input.

I understand that PEQ DB pulls everything off of magelo now in terms of the loot but for doing custom loot it was annoying to have to create then edit.
Not sure if this is correct but it works and here is a patch against r371.
Just noticed r372 is on svn but nothing effected by this patch was touched in r372.

Code:

Index: templates/loot/lootdrop.add.tmpl.php
===================================================================
--- templates/loot/lootdrop.add.tmpl.php    (revision 371)
+++ templates/loot/lootdrop.add.tmpl.php    (working copy)
@@ -13,13 +13,13 @@
              Suggested Name:<br>
              <input type="text" name="name" size="25" value="<?=$name?>"><br><br>
              Mindrop: <br>
-              <input type="text" name="mindrop" size="25" value="0"><br><br>
+              <input type="text" name="mindrop" size="25" value="<?=$mindrop?>"><br><br>
              Droplimit: <br>
-              <input type="text" name="droplimit" size="25" value="0"><br><br>
+              <input type="text" name="droplimit" size="25" value="<?=$droplimit?>"><br><br>
              Multiplier: <br>
-              <input type="text" name="multiplier" size="25" value="1"><br><br>
-        Probability: <br>
-              <input type="text" name="probability" size="25" value="100"><br><br>
+              <input type="text" name="multiplier" size="25" value="<?=$multiplier?>"><br><br>
+              Probability: <br>
+              <input type="text" name="probability" size="25" value="<?=$probability?>"><br><br>
              <center>
                <input type="submit" name="submit" value="Submit Changes">
              </center>
Index: templates/loot/lootdrop.changebyid.tmpl.php
===================================================================
--- templates/loot/lootdrop.changebyid.tmpl.php    (revision 371)
+++ templates/loot/lootdrop.changebyid.tmpl.php    (working copy)
@@ -1,27 +1,27 @@
-      <table class="edit_form">
-        <tr>
-          <td class="edit_form_header">
-            Change Lootdrop
-          </td>
-        </tr>
-        <tr>
-          <td class="edit_form_content">
-            <form name="addlootdrop" method="post" action="index.php?editor=loot&z=<?=$currzone?>&zoneid=<?=$currzoneid?>&npcid=<?=$npcid?>&action=24">
-              <input type="hidden" name="ltid" value="<?=$ltid?>">
-              Enter Lootdrop ID:<br>
-              <input type="text" name="ldid" size="10"><br><br>
-              Mindrop: <br>
-              <input type="text" name="mindrop" size="5" value="0"><br><br>
-              Droplimit: <br>
-              <input type="text" name="droplimit" size="5" value="0"><br><br>
-              Multiplier: <br>
-              <input type="text" name="multiplier" size="5" value="1"><br><br>
-        Probability: <br>
-              <input type="text" name="probability" size="5" value="100"><br><br>
-              <center>
-                <input type="submit">
-              </center>
-            </form>
-          </td>
-        </tr>
-      </table>
+      <table class="edit_form">
+        <tr>
+          <td class="edit_form_header">
+            Change Lootdrop
+          </td>
+        </tr>
+        <tr>
+          <td class="edit_form_content">
+            <form name="addlootdrop" method="post" action="index.php?editor=loot&z=<?=$currzone?>&zoneid=<?=$currzoneid?>&npcid=<?=$npcid?>&action=24">
+              <input type="hidden" name="ltid" value="<?=$ltid?>">
+              Enter Lootdrop ID:<br>
+              <input type="text" name="ldid"><br><br>
+              Probability:<br>
+              <input type="text" name="probability"><br><br>
+              Multiplier:<br>
+              <input type="text" name="multiplier"><br><br>
+              Droplimit:<br>
+              <input type="text" name="droplimit"><br><br>
+              Mindrop:<br>
+              <input type="text" name="mindrop"><br><br>
+              <center>
+                <input type="submit">
+              </center>
+            </form>
+          </td>
+        </tr>
+      </table>
Index: templates/loot/lootdrop.changebysearch.tmpl.php
===================================================================
--- templates/loot/lootdrop.changebysearch.tmpl.php    (revision 371)
+++ templates/loot/lootdrop.changebysearch.tmpl.php    (working copy)
@@ -11,9 +11,13 @@
                Lootdrop ID:<br>
                <input type="text" name="ldid" value="<?=$ldid?>"><br><br>
                Probability:<br>
-              <input type="text" name="prob"><br><br>
+              <input type="text" name="probability"><br><br>
                Multiplier:<br>
-              <input type="text" name="mult"><br><br>
+              <input type="text" name="multiplier"><br><br>
+              Droplimit:<br>
+              <input type="text" name="droplimit"><br><br>
+              Mindrop:<br>
+              <input type="text" name="mindrop"><br><br>
                <center>
                  <input type="submit">
                </center>
Index: templates/loot/loottable.edit.entry.tmpl.php
===================================================================
--- templates/loot/loottable.edit.entry.tmpl.php    (revision 371)
+++ templates/loot/loottable.edit.entry.tmpl.php    (working copy)
@@ -9,8 +9,10 @@
            <strong>LootTable:</strong> <?=$ltid?><br>
            <strong>LootDrop:</strong> <?=$ldid?><br><br>
            <form name="loottable" id="loottable" method="post" action="index.php?editor=loot&z=<?=$currzone?>&zoneid=<?=$currzoneid?>&action=8&npcid=<?=$npcid?>&ltid=<?=$ltid?>&ldid=<?=$ldid?>">
-              Probability: <br><input type="text" name="prob" value="<?=$probability?>"><br><br>
-              Multiplier: <br><input type="text" name="mult" value="<?=$multiplier?>"><br><br>
+              Probability: <br><input type="text" name="probability" value="<?=$probability?>"><br><br>
+              Multiplier: <br><input type="text" name="multiplier" value="<?=$multiplier?>"><br><br>
+              Droplimit: <br><input type="text" name="droplimit" value="<?=$droplimit?>"><br><br>
+              Mindrop: <br><input type="text" name="mindrop" value="<?=$mindrop?>"><br><br>
              <center>
                <input type="submit" name="submit" value="Submit Changes">
              </center>


cavedude 07-29-2013 10:24 AM

Could you tell me exactly where the problem is? It seems to be working fine for me.

wolfwalkereci 07-29-2013 11:16 AM

When you click on loot, select the zone and npc.
LootDrops associated with this LootTable: 3 http://127.0.0.1/peqedit/images/add.gif
Click on add and in this example lets say I am adding a new lootdrop and I want to set probability to 50.
It would save as 0 and I would have to then click on that 0 value which brings up the edit page and enter it there and then it would save.

Minor issue but I noticed it earlier when populating loot in a custom zone and wanted to fix it.

Personal preference is all.
I also changed my copy so when I add items to a loot drop I can set everything on that screen instead of adding a item then having to go in and change stuff like minlvl maxlvl charges and chance.

edit: I probably should be pulling from your daily dump more often but its not like anything is really broken and generating patches seems best off the svn revision.

sorvani 07-29-2013 11:59 AM

The daily dump is best for starting new. or never changing. the SVN is good when you have existing and want to see what changed. Also posting diff for changes = awesome

wolfwalkereci 07-29-2013 12:02 PM

Quote:

Originally Posted by sorvani (Post 222857)
The daily dump is best for starting new. or never changing. the SVN is good when you have existing and want to see what changed. Also posting diff for changes = awesome

Better then going "I changed XYZ and broke it can you fix it for me."
I've been guilty of that in the past :D

cavedude 07-29-2013 12:13 PM

Hmm, the only option I see broken is when adding an existing lootdrop from search. The options to create a new lootdrop or add an existing one by ID both work fine for me.

wolfwalkereci 07-29-2013 12:49 PM

Hmm looking at lootdrop.add.tmpl.php I see how it is written for default values of 0,0,1,100.
I wonder if by putting anything into those fields instead of leaving them blank was what caused it to create lootdrops with 0,0,0,0 in the fields.
Since that patch works I'm going to be lazy and not revert and check but that might be why I was seeing zero across the board.

cavedude 07-29-2013 01:14 PM

Oh, I wanted to mention that. Your changes to lootdrop.add.tmpl.php should be reverted. You replaced the default values (which exist only to save on typing for the user) to variables that aren't even defined yet. The input field itself is what creates those variables, so it's referencing a variable it hasn't even submitted yet. PHP is very forgiving of course, but another language like C++ wouldn't like that too much and crash.

This change creates NULLs for the input boxes (since the variable doesn't exist yet), so if you clicked submit without filling out all the boxes the DB would fill with default values, which are 0s. If that's not the problem, then there may be something else going on for you else where.

wolfwalkereci 07-29-2013 01:32 PM

Quote:

Originally Posted by cavedude (Post 222865)
Oh, I wanted to mention that. Your changes to lootdrop.add.tmpl.php should be reverted. You replaced the default values (which exist only to save on typing for the user) to variables that aren't even defined yet. The input field itself is what creates those variables, so it's referencing a variable it hasn't even submitted yet. PHP is very forgiving of course, but another language like C++ wouldn't like that too much and crash.

This change creates NULLs for the input boxes (since the variable doesn't exist yet), so if you clicked submit without filling out all the boxes the DB would fill with default values, which are 0s. If that's not the problem, then there may be something else going on for you else where.

Ok I am tracking with that. Myself I am in the habit of filling in all the fields with something so I'm not sure if that would be an issue. I'll revert later today and check if not inputing anything would generate a default value (0,0,1,100). -- if so I might just remove the ability to even input anything since every time I do put something in the fields it generates the lootdrop as mindrop through probability with value of 0.

I did take a look at \lib\loot.php and saw in function assign_lootdrop that droplimit, mindrop, multiplier and probability are defined which is why I made the changes to lootdrop.add.tmpl.php

cavedude 07-29-2013 01:39 PM

Yep, lootdrop.add.tmpl.php creates those variables and sends them to loot.php for use in assign_lootdrop().

wolfwalkereci 07-30-2013 01:41 PM

Well I feel stupid to an extent. When I woke up today I deleted every file with a change date that did not match up with the SVN, then reapplied my custom changes for misc stuff like website integration and everything works like it should.
So at some point in time I changed one of the pages and was not careful with copying from SVN to my web folder and that would explain when I was adding loot drops mindrop,droplimit,multiplier,probability were zero and also I just checked adding items and noticed that I was not careful in the past because the current revision from svn when I add items now I do have the option to change percent.

So thanks cavedude for suffering my posts. It was still nice to take a few min and look at how everything is setup and play with it.
I was able to make some personalized changes to aspects of the tool yesterday and get an idea for how it should look based on the current templates.

Anyways, thanks as always to you and everyone else from peq that keep this tool up to date.

wolfwalkereci 07-31-2013 09:15 PM

Reference: http://www.peqtgc.com/phpBB3/viewtopic.php?f=29&t=14068
I think this is a good idea and decided to go mucking around inside the editor... again.
This time I am going to include some pictures of the table I tested against.
http://imageshack.us/a/img802/960/zlzo.png
Then what the new option you clicked on brings up. I used one of the 13x13 icons included with the editor for this test.
http://imageshack.us/a/img5/4364/m2ue.png
And what the result ended up being after choosing the copy option.
http://imageshack.us/a/img4/2701/mrqo.png

You can either choose move (move and delete from old) or copy (move and retain original).
Here is a patch and I'm pretty sure I did not fubar up this time but its probably not the best way to handle it. Either way you cut it, it does work and can be made pretty as needed. IE I created a new template page but was that really the best method?
Code:

Index: lib/loot.php
===================================================================
--- lib/loot.php    (revision 374)
+++ lib/loot.php    (working copy)
@@ -341,6 +341,25 @@
    enable_lootdrop_item();
    header("Location: index.php?editor=loot&z=$z&zoneid=$zoneid&npcid=$npcid");
    exit;
+  case 46:  //Move Lootdrop Item page
+    check_authorization();
+    $body = new Template("templates/loot/lootdrop.move.item.tmpl.php");
+    $body->set('currzone', $z);
+    $body->set('currzoneid', $zoneid);
+    $body->set('npcid', $npcid);
+    $body->set('ldid', $_GET['ldid']);
+    $body->set('itemid', $_GET['itemid']);
+    $body->set('ldname', getLootdropName($_GET['ldid']));
+    $vars = lootdrop_info();
+    foreach ($vars as $key=>$value) {
+      $body->set($key, $value);
+    }
+    break;
+  case 47:  // Move lootdrop item
+    check_authorization();
+    move_copy_lootdrop_item();
+    header("Location: index.php?editor=loot&z=$z&zoneid=$zoneid&npcid=$npcid");
+    exit;
 }
 
 function loottable_info () {
@@ -860,4 +879,30 @@
  $mysql->query_no_result($query);
 }
 
+function move_copy_lootdrop_item() {
+  check_authorization();
+  global $mysql;
+  $ldid = $_GET['ldid'];
+  $itemid = $_GET['itemid'];
+  $equip = $_POST['equip_item'];
+  $charges = $_POST['charges'];
+  $chance = $_POST['chance'];
+  $minlevel = $_POST['minlevel'];
+  $maxlevel = $_POST['maxlevel'];
+  $multiplier = $_POST['multiplier'];
+  $new_ldid = $_POST['movetolootdrop'];
+  $move_copy_item = $_POST['move_copy_item'];
+  if ($move_copy_item == 0) {
+    $query1 = "DELETE FROM lootdrop_entries WHERE lootdrop_id='$ldid' AND item_id='$itemid'";
+    $mysql->query_no_result($query1);
+   
+    $query2 = "INSERT INTO lootdrop_entries SET lootdrop_id=$new_ldid, item_id=$itemid, equip_item=$equip, item_charges=$charges, chance=$chance, minlevel=$minlevel, maxlevel=$maxlevel, multiplier=$multiplier";
+    $mysql->query_no_result($query2);
+  }
+  if ($move_copy_item == 1) {
+    $query = "INSERT INTO lootdrop_entries SET lootdrop_id=$new_ldid, item_id=$itemid, equip_item=$equip, item_charges=$charges, chance=$chance, minlevel=$minlevel, maxlevel=$maxlevel, multiplier=$multiplier";
+    $mysql->query_no_result($query);
+  }
+}
+
 ?>
\ No newline at end of file
Index: templates/loot/lootdrop.move.item.tmpl.php
===================================================================
--- templates/loot/lootdrop.move.item.tmpl.php    (revision 0)
+++ templates/loot/lootdrop.move.item.tmpl.php    (working copy)
@@ -0,0 +1,35 @@
+      <table class="edit_form">
+        <tr>
+          <td class="edit_form_header">
+            <?=$ldname?>
+          </td>
+        </tr>
+        <tr>
+          <td class="edit_form_content">
+          <form name="item" method="post" action="index.php?editor=loot&z=<?=$currzone?>&zoneid=<?=$currzoneid?>&action=47&npcid=<?=$npcid?>&ldid=<?=$ldid?>&itemid=<?=$itemid?>">
+            <strong>Lootdrop:</strong> <?=$ldid?><br>
+            <strong>Item:</strong> <?=$itemid?><br><br>
+            <strong>Move to Lootdrop:</strong></br>
+            <input type="radio" name="move_copy_item" value="0"<?echo ($move_copy_item == 0) ? " checked" : ""?>>Move Item<br>
+            <input type="radio" name="move_copy_item" value="1"<?echo ($move_copy_item == 1) ? " checked" : ""?>>Copy Item<br>
+            <input class="indented" type="text" size="5" name="movetolootdrop" value="<?=$new_ldid?>"><br><br>
+            <strong>Equipped:</strong><br>
+            <input type="radio" name="equip_item" value="0"<?echo ($equip_item == 0) ? " checked" : ""?>>no<br>
+            <input type="radio" name="equip_item" value="1"<?echo ($equip_item == 1) ? " checked" : ""?>>yes<br><br>
+            <strong>Item Charges:</strong> <br>
+            <input class="indented" type="text" size="5" name="charges" value="<?=$item_charges?>"><br><br>
+            <strong>Min Level:</strong> <br>
+            <input class="indented" type="text" size="5" name="minlevel" value="<?=$minlevel?>"><br><br>
+            <strong>Max Level:</strong> <br>
+            <input class="indented" type="text" size="5" name="maxlevel" value="<?=$maxlevel?>"><br><br>
+            <strong>Multiplier:</strong> <br>
+            <input class="indented" type="text" size="5" name="multiplier" value="<?=$multiplier?>"><br><br>
+            <strong>Chance:</strong> <br>
+            <input class="indented" type="text" size="5" name="chance" value="<?=$chance?>">%<br><br>
+            <center>
+              <input type="submit" name="submit" value="Submit Changes">
+            </center>
+          </form>
+          </td>
+        </tr>
+      </table>
Index: templates/loot/loottable.tmpl.php
===================================================================
--- templates/loot/loottable.tmpl.php    (revision 374)
+++ templates/loot/loottable.tmpl.php    (working copy)
@@ -104,11 +104,11 @@
 <?php if(isset($lootdrop['items']) && $lootdrop['items']): $x=0;?>
        <tr>
          <th align="center" width="8%">Item ID</th>
-          <th align="center" width="35%">Item Name</th>
-          <th align="center" width="8%">Equipped?</th>
-          <th align="center" width="8%">Charges</th>
-      <th align="center" width="8%">MinLevel</th>
-      <th align="center" width="8%">MaxLevel</th>
+          <th align="center" width="36%">Item Name</th>
+          <th align="center" width="7%">Equipped?</th>
+          <th align="center" width="7%">Charges</th>
+      <th align="center" width="7%">MinLevel</th>
+      <th align="center" width="7%">MaxLevel</th>
        <th align="center" width="8%">Multiplier</th>
          <th align="center" width="8%">Chance</th>
          <th width="13%"></th>
@@ -145,6 +145,7 @@
          <?=$chance?>%
        </td>
          <td align="right">
+          <a href="index.php?editor=loot&z=<?=$currzone?>&zoneid=<?=$currzoneid?>&npcid=<?=$npcid?>&ldid=<?=$lootdrop['id']?>&itemid=<?=$item_id?>&action=46"><img src="images/minus.gif" border="0" title="Move Lootdrop Item"></a>
            <a href="index.php?editor=loot&z=<?=$currzone?>&zoneid=<?=$currzoneid?>&npcid=<?=$npcid?>&ldid=<?=$lootdrop['id']?>&itemid=<?=$item_id?>&action=5"><img src="images/edit2.gif" border="0" title="Edit Lootdrop Item"></a>
        <?php if($disabled_chance == 0 && $chance > 0):?> 
          <a <?=$lootdrop['id']?>?');" href="index.php?editor=loot&z=<?=$currzone?>&zoneid=<?=$currzoneid?>&npcid=<?=$npcid?>&ldid=<?=$lootdrop['id']?>&itemid=<?=$item_id?>&chance=<?=$chance?>&action=44"><img src="images/downgrade.gif" border="0" title="Disable Item"></a>


cavedude 08-01-2013 01:45 PM

Thanks for that! I'll be merging it into the next commit, it's very well done. The only thing I changed was I made copy the default option.

cavedude 08-01-2013 02:05 PM

Also, I wanted to say keep mucking! Once you get a solid grasp of the editor, I'll have no problem giving you SVN access, so you can commit your changes directly.


All times are GMT -4. The time now is 09:56 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.