View Single Post
  #163  
Old 07-31-2013, 09:15 PM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

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.

Then what the new option you clicked on brings up. I used one of the 13x13 icons included with the editor for this test.

And what the result ended up being after choosing the copy option.


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>
__________________

Reply With Quote