Difference between revisions of "Extensions:Activities"

From Lorekeeper Wiki
Jump to navigation Jump to search
Tag: 2017 source edit
 
(5 intermediate revisions by the same user not shown)
Line 19: Line 19:
 
== Current Available Modules ==
 
== Current Available Modules ==
 
* Recycle - allow users to turn in items for a set reward
 
* Recycle - allow users to turn in items for a set reward
[[File:Recycle.png|200px|thumb|none]] [[File:RecycleAdmin.png|200px|thumb|none]]
+
<gallery>
 +
File:Recycle.png
 +
File:RecycleAdmin.png
 +
</gallery>
 
* Collection - allows users to get a reward for completing a collection of items.
 
* Collection - allows users to get a reward for completing a collection of items.
[[File:Collection.png|200px|thumb|none]] [[File:CollectionAdmin.png|200px|thumb|none]]
+
<gallery>
 +
File:Collection.png
 +
File:CollectionAdmin.png
 +
</gallery>
 
This one requires [[Extensions: Collections]] for it to show up, as its setup to display just one collection a little more "dramatically" on the page compared to the default collection extensions page, but still relies on the extension for the setup of the collection itself.  
 
This one requires [[Extensions: Collections]] for it to show up, as its setup to display just one collection a little more "dramatically" on the page compared to the default collection extensions page, but still relies on the extension for the setup of the collection itself.  
 
You should set a collection used this way to not be visible so that way it's only displayed on the activity page and not with any other collections you may have.
 
You should set a collection used this way to not be visible so that way it's only displayed on the activity page and not with any other collections you may have.
 +
* Crafting - allows users to get a reward for turning items
 +
<gallery>
 +
File:Crafting.png
 +
File:CraftingAdmin.png
 +
</gallery>
 +
This one requires [[Extensions: Crafting System]] for it to show up, as it's setup to display 1-6 recipes a little more "dramatically" inline in the page, and without an inventory picker, compared to the default crafting system, but still relies on the extension for the setup of the recipe itself.
 +
You should set a recipe used this way to not be unlocked by default so it's only displayed on the activity page and not with any other recipes you may have.
 +
* Prompt - allows showing prompt directions and submission in a single page, and limits user input on rewards.
 +
<gallery>
 +
File:Prompt1.png
 +
File:Prompt2.png
 +
File:Prompt3.png
 +
File:Promptadmin.png
 +
</gallery>
 +
This comes with a few settings to make it more useful. You can specify a template that will be auto-filled in the primary text field for the prompt, you can toggle "show rewards" which will present the more standard reward add section from prompts, and you can alternatively toggle "User chooses reward" which will let the user choose between the default rewards specified on the associated prompt. (For example, if you wanted to let users choose between three box items with different contents as their prompt reward, you would add all three to the default prompt reward, and then turn this toggle on).
  
 
== Creating New Modules ==
 
== Creating New Modules ==

Latest revision as of 18:04, 23 June 2024

Activities
Description item tags but for small single page interactive activities
Author(s) moif
Status stable
Github AW0005/lorekeeper-extensions/extension/activities
LK Version 2.1.0
Contains a Migration






This is kind of a meta extension in the sense that it's built in a way that expects to be continued to be extended off of more.

An activity has a title and description, and an icon image to be displayed on the activity index page. Each activity also has an associated module -- modules are the really powerful part of this extension and function very similar to item tags as a way to specify what additional functionality should then be displayed on the page with the activity title and description.

For example one built module is the "Recycle" module which gives you the ability to allow users to turn in items from an inventory picker and get something back in exchange for those items.

It's easiest to think of modules as relatively simple as they should be the kind of interactive actions that only need the one page view to display to users, which means they're ideal for temporary things you'd want to host for an event rather than permanent site features.

Installation

  • php artisan migrate
  • php artisan optimize

Configuration

The extension will add "Activities" on the staff side page under data. Creating an activity will allow you to select the module, and then after creating you'll be able to specify whatever settings are relevant for the chosen module.

By default Activities have their own index page, but the activities list is also available as a blade file under widgets so you can display it elsewhere as needed (ie I moved mine onto my shops page under the shops list, since I didn't want a whole new page for them when they would be temporary for an event).

Current Available Modules

  • Recycle - allow users to turn in items for a set reward
  • Collection - allows users to get a reward for completing a collection of items.

This one requires Extensions: Collections for it to show up, as its setup to display just one collection a little more "dramatically" on the page compared to the default collection extensions page, but still relies on the extension for the setup of the collection itself. You should set a collection used this way to not be visible so that way it's only displayed on the activity page and not with any other collections you may have.

  • Crafting - allows users to get a reward for turning items

This one requires Extensions: Crafting System for it to show up, as it's setup to display 1-6 recipes a little more "dramatically" inline in the page, and without an inventory picker, compared to the default crafting system, but still relies on the extension for the setup of the recipe itself. You should set a recipe used this way to not be unlocked by default so it's only displayed on the activity page and not with any other recipes you may have.

  • Prompt - allows showing prompt directions and submission in a single page, and limits user input on rewards.

This comes with a few settings to make it more useful. You can specify a template that will be auto-filled in the primary text field for the prompt, you can toggle "show rewards" which will present the more standard reward add section from prompts, and you can alternatively toggle "User chooses reward" which will let the user choose between the default rewards specified on the associated prompt. (For example, if you wanted to let users choose between three box items with different contents as their prompt reward, you would add all three to the default prompt reward, and then turn this toggle on).

Creating New Modules

If you create a new module and want to PR it into the extension please feel free to do so!! I built this very much intending for others to be able to contribute to it.

If you've created an item tag before it's pretty much the same basic setup.

  1. Add the module to `config/lorekeeper/activity_modules.php` - the key you use will need to be used in the naming of all the other files for it.
  2. Create a service file, and there's a template provided at `app/Services/Activity/TemplateService.php`
  3. Create the admin settings blades: `resources/views/admin/activities/modules/recycle.blade.php`, and optionally: `resources/views/admin/activities/modules/recycle_post.blade.php`, and `resources/views/admin/activities/modules/recycle_js.blade.php`
  4. Create the user side blade: `resources/views/activities/modules/recycle.blade.php`

And that should be it! The template service file also includes some comments in it for what all the different methods are used for and how you should fill in the functionality but feel free to use the existing module service files as examples too.

Troubleshooting

I'm (moif) pretty much chronically in the LK server so I'll see any questions there!