Extensions:MYO Item Tag

From Lorekeeper Wiki
Revision as of 10:43, 15 November 2020 by Mercury (talk | contribs)
Jump to navigation Jump to search
MYO Item Tag
Description A tag which redeems items into MYO Slots on the masterlist.
Author(s) Junijwi
Status stable
Github MYO-item-tag
LK Version Unspecified
Is part of LK v2 (modified-main)



This extension adds an item tag using lorekeeper's item tag system. This tag, called Slot, gives items the ability to be turned into MYO slots.

If you are using Extension:Stacked Inventories then install MYO-item-tag-stacks .

GIF: Using an Item

Each item gets its own settings for MYO slots, and will create MYO slots with those settings (for example, adding Slot to a Chicken Egg and setting the species to Chicken allows Chicken Eggs to hatch Chickens).

Installation

Pull the branch and push. No migration is necessary.

You need to apply the item tag to your item, and fill out all of the settings in that item tag. Be sure to set the tag to active! Otherwise you will be able to see it in the inventory's menu but not use it.

Configuration

You can change the tag setting in config\lorekeeper\item_tags.php by changing the font color for slot.

Images are not set in the item tag settings, and items will use lorekeeper's DEFAULT masterlist image that you've already set.

If you want different images, for example based on species, I can recommend that you customize this in your Character Manager: app\Services\CharacterManager.php, line 237

237 // Use default images for MYO slots without an image provided
238 if(!isset($data['image']))
239 {
240     $data['image'] = asset('images/myo.png');
241     $data['thumbnail'] = asset('images/myo-th.png');
242     $data['extension'] = 'png';
243     $data['default_image'] = true;
244     unset($data['use_cropper']);
245 }

Is the default code in this section. You can set a switch to check for a certain variable (ex: species_id) and select an image based off of that variable. For example, World of Orrison uses: app\Services\CharacterManager.php, line 237

237 // Use default images for MYO slots without an image provided
238 if(!isset($data['image']))
239 {
240     switch($data['species_id']){
241         
242         case null:
243             $data['image'] = asset('files/MYO/all.jpg');
244             $data['thumbnail'] = asset('files/MYO/all-th.jpg');
245         break;
246         case 1:
247             $data['image'] = asset('files/MYO/rrex.jpg');
248             $data['thumbnail'] = asset('files/MYO/rrex-th.jpg');
249         break;
250         case 2:
251             $data['image'] = asset('files/MYO/immanu.jpg');
252             $data['thumbnail'] = asset('files/MYO/immanu-th.jpg');
253         break;
254         case 3:
255             $data['image'] = asset('files/MYO/leyr.jpg');
256             $data['thumbnail'] = asset('files/MYO/leyr-th.jpg');
257         break;
258         case 4:
259             $data['image'] = asset('files/MYO/luto.jpg');
260             $data['thumbnail'] = asset('files/MYO/luto-th.jpg');
261         break;
262         case 5:
263             $data['image'] = asset('files/MYO/chimia.jpg');
264             $data['thumbnail'] = asset('files/MYO/chimia-th.jpg');
265         break;
266         case 6:
267             $data['image'] = asset('files/MYO/ptheran.jpg');
268             $data['thumbnail'] = asset('files/MYO/ptheran-th.jpg');
269         break;
270         case 7:
271             $data['image'] = asset('files/MYO/tolka.jpg');
272             $data['thumbnail'] = asset('files/MYO/tolka-th.jpg');
273         break;
274         case 8:
275             $data['image'] = asset('files/MYO/daemon.jpg');
276             $data['thumbnail'] = asset('files/MYO/daemon-th.jpg');
277         break;
278         case 9:
279             $data['image'] = asset('files/MYO/human.jpg');
280             $data['thumbnail'] = asset('files/MYO/human-th.jpg');
281         break;
282         default:
283             $data['image'] = asset('files/MYO/misc.jpg');
284             $data['thumbnail'] = asset('files/MYO/misc-th.jpg');
285         break;
286     }
287     $data['extension'] = 'jpg';
288     $data['default_image'] = true;
289     unset($data['use_cropper']);
290 }

The reason this is in CharacterManager rather than handled in the tag is so that it applies elsewhere, for example when creating MYO slots manually.

Usage

Be sure to set the tag to active! Otherwise you will be able to see it in the inventory's menu but not use it.

Troubleshooting

Feel free to @ me in the discord (Juni#0448) for any issues.

See Also