Difference between revisions of "Extensions:Giftwrap"

From Lorekeeper Wiki
Jump to navigation Jump to search
(Added Images)
Tag: 2017 source edit
Tag: 2017 source edit
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Extensioninfobox|title=Giftwrap|desc=Adds the ability to wrap items or MYO in "giftwrap" such that they can be unwrapped after.|auth=moif|github={{Github|repo=lorekeeper-extensions|user=AW0005|branch=extension/giftwrap-tag}}|LKVer=2.0.0|migration=no|package=no}}
+
{{Extensioninfobox|title=Giftwrap|desc=Adds the ability to wrap items or MYO in "giftwrap" such that they can be unwrapped after.|auth=moif|status=stable|github={{Github|repo=lorekeeper-extensions|user=AW0005|branch=extension/giftwrap-tag}}|LKVer=2.0.0|migration=no|package=no}}
 
+
== About the Extension ==
This extension adds two new item tags "Giftwrap" and "Giftwrapped". The "Giftwrap" tag needs to be associated via the edit panel for it, to a "Giftwrapped" tagged item. Then when a "Giftwrap" item is used to wrap an item or myo from a user's inventory it generates the "Giftwrapped" item that was specified.
+
This extension adds two new item tags "Giftwrap" and "Giftwrapped". The "Giftwrap" tag needs to be associated via the edit panel for it, to a "Giftwrapped" tagged item. Then when a "Giftwrap" item is used to wrap an item, myo, or currency from a user's inventory it generates the "Giftwrapped" item that was specified.
  
 
== Installation ==
 
== Installation ==
Line 9: Line 9:
 
== Configuration ==
 
== Configuration ==
 
# Set up an item tagged "Giftwrapped" - this will be the "filled" or "wrapped" version of an item
 
# Set up an item tagged "Giftwrapped" - this will be the "filled" or "wrapped" version of an item
# Set up an item tagged "Giftwrap" and associate the "Giftwrapped" item to it
+
# Set up an item tagged "Giftwrap" and associate the "Giftwrapped" item to it"
 +
# Sell or grant the "Giftwrap" item to your users as you see fit!
  
Sell or grant the "Giftwrap" item to your users as you see fit!
+
It also optionally includes some commented out code in "app/Services/Item/GiftwrapService.php" and "resources/views/inventory/_giftwrap.blade.php" that can be un-commented to allow the wrapping of characters as well.
  
 
== Images ==
 
== Images ==
Line 21: Line 22:
 
</gallery>
 
</gallery>
  
 +
== Use with Other Extensions ==
 +
=== Donation Shop ===
 +
The donation shop by default overwrites the data for items, which would overwrite the item wrapped information. To make sure that information isn't lost you'll want to go to <code>app/Services/ShopManager.php</code> and look for <code>public function collectDonation</code>.
 +
 +
Replace this line:
 +
<pre><code>
 +
// Give the user the item           
 +
if(!(new InventoryManager)->creditItem(null, $user, 'Collected from Donation Shop', [
 +
                'data' => 'Collected from Donation Shop by '.$user->displayName,
 +
                'notes' => null,
 +
], $stock->item, 1)) throw new \Exception("Failed to collect item.");
 +
</code></pre>
 +
 +
With this:
 +
<pre><code>
 +
// Give the user the item           
 +
if(!(new InventoryManager)->creditItem(null, $user, 'Collected from Donation Shop',$stock->stack->data + [
 +
                'data' => 'Collected from Donation Shop by '.$user->displayName,
 +
                'notes' => isset($stock->stack->data['notes']) ? $stock->stack->data['notes'] : null,
 +
], $stock->item, 1)) throw new \Exception("Failed to collect item.");
 +
</code></pre>
  
 +
When you do this copy, make sure that the phrasing 'Collected From Donation Shop' matches what you already have in your code!! It plays into other Donation Shop logic, so you want to make sure you keep that the same.
  
 
== See Also ==
 
== See Also ==

Latest revision as of 15:01, 4 December 2022

Giftwrap
Description Adds the ability to wrap items or MYO in "giftwrap" such that they can be unwrapped after.
Author(s) moif
Status stable
Github AW0005/lorekeeper-extensions/extension/giftwrap-tag
LK Version 2.0.0




About the Extension

This extension adds two new item tags "Giftwrap" and "Giftwrapped". The "Giftwrap" tag needs to be associated via the edit panel for it, to a "Giftwrapped" tagged item. Then when a "Giftwrap" item is used to wrap an item, myo, or currency from a user's inventory it generates the "Giftwrapped" item that was specified.

Installation

  1. Pull and deal with conflicts
  2. `php artisan optimize`

Configuration

  1. Set up an item tagged "Giftwrapped" - this will be the "filled" or "wrapped" version of an item
  2. Set up an item tagged "Giftwrap" and associate the "Giftwrapped" item to it"
  3. Sell or grant the "Giftwrap" item to your users as you see fit!

It also optionally includes some commented out code in "app/Services/Item/GiftwrapService.php" and "resources/views/inventory/_giftwrap.blade.php" that can be un-commented to allow the wrapping of characters as well.

Images

Use with Other Extensions

Donation Shop

The donation shop by default overwrites the data for items, which would overwrite the item wrapped information. To make sure that information isn't lost you'll want to go to app/Services/ShopManager.php and look for public function collectDonation.

Replace this line:

<code>
// Give the user the item            
if(!(new InventoryManager)->creditItem(null, $user, 'Collected from Donation Shop', [
                'data' => 'Collected from Donation Shop by '.$user->displayName,
                'notes' => null,
], $stock->item, 1)) throw new \Exception("Failed to collect item.");
</code>

With this:

<code>
// Give the user the item            
if(!(new InventoryManager)->creditItem(null, $user, 'Collected from Donation Shop',$stock->stack->data + [
                'data' => 'Collected from Donation Shop by '.$user->displayName,
                'notes' => isset($stock->stack->data['notes']) ? $stock->stack->data['notes'] : null,
], $stock->item, 1)) throw new \Exception("Failed to collect item.");
</code>

When you do this copy, make sure that the phrasing 'Collected From Donation Shop' matches what you already have in your code!! It plays into other Donation Shop logic, so you want to make sure you keep that the same.

See Also

Feel free to ping moif in the LK discord if you have questions!

https://ko-fi.com/moifdoesart