• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[MyAAC][Plugin] List Of Items

Totten

Well-Known Member
Joined
Feb 26, 2019
Messages
43
Solutions
2
Reaction score
91
Location
Brazil
Hello people, today I came to make available to you a Plugin for MyAAC that I developed where the function is to list all items on your server by category.
A little about him:
Well, the Plugin was developed so that both lay people and people more familiar with PHP can use it. The Plugin is easy to use, just upload it to your administrative panel and it will already be working, all the configuration part on his website / bd is automatic.
In this tutorial I will teach you how to install and use the plugin.
NOTE: (It is worth noting that the Plugin works for> MyAAC <, however it can be adapted to other platforms without major problems.)
Well come on, to install:

Installation:
Go to Admin Panel, select 'Plugins', and then select list_of_items_1.1.zip and click upload. Thats all!

Configuration:

Now that we have installed it on our website, we will access the items.xml file from our server which is at:

Lua:
data/items/items.xml

This is the only part you will need to configure, at the end of each item's tag you will add the tag:

Code:
level="50"


Example:

Our item is as follows:

XML:
<item id="15066" article="a" name="Masamune Boots">
    <attribute key="description" value="+3% protection all." />
    <attribute key="weight" value="1000" />
    <attribute key="armor" value="125" />
    <attribute key="absorbPercentAll" value="3" />
    <attribute key="slotType" value="feet" />
[CENTER]</item>

With the tag it will look like this:

[/CENTER]
XML:
<item id="15066" article="a" name="Masamune Boots" level="50">
    <attribute key="description" value="+3% protection all." />
    <attribute key="weight" value="1000" />
    <attribute key="armor" value="125" />
    <attribute key="absorbPercentAll" value="3" />
    <attribute key="slotType" value="feet" />
</item>


Explaining the tags:
The Tag -> level <- is the item's level
Do this for the items you want to report on the website.


Now go to our website, type: seuite.com/?items
It will go to a +/- area like this:

1.png.fbc90ce1fddffdb6a919d2d6bd880de4.png

If you login with the administrator account, you will see that the option to Reload items will appear.

2.png.208e26c4ffaf32a06e43cfdbc4afd652.png


What does she do? Basically, it will reload all items, updating in its database.
Well, now just access the tabs it will display the items
NOTE: The System displays in order of level, that is, from the weak + item to the strong + item based on its level.

3.png.0f51ad279d333959529685a5c674ff17.png

Done!!
 

Attachments

  • list_of_items_1.1.zip
    6.9 KB · Views: 187 · VirusTotal
Last edited:
Very nice! Thanks for this! :)

A little update on weapon.php, cause it shows only club weapons for now

Change:
PHP:
$resultado = $db->query("SELECT * FROM `list_of_items` WHERE `slottype` = 'distance' or `slottype` = 'club' ORDER BY `level`");

To:
PHP:
$resultado = $db->query("SELECT * FROM `list_of_items` WHERE `slottype` = 'distance' or `slottype` = 'club' or `slottype` = 'sword' or `slottype` = 'axe' ORDER BY `level`");
 
Very nice! Thanks for this! :)

A little update on weapon.php, cause it shows only club weapons for now

Change:
PHP:
$resultado = $db->query("SELECT * FROM `list_of_items` WHERE `slottype` = 'distance' or `slottype` = 'club' ORDER BY `level`");

To:
PHP:
$resultado = $db->query("SELECT * FROM `list_of_items` WHERE `slottype` = 'distance' or `slottype` = 'club' or `slottype` = 'sword' or `slottype` = 'axe' ORDER BY `level`");
Thank you for your feedback. I didn't really realize that, I did it based on 1 Derived from NTO and normally these servers don't have weapons of other genres besides club / distance.
 
I have an unfinished commit for the develop git with something like this as myaac used to write to database till it was updated to use a cache array (I also made it print them back into the database for an items page.) as i couldn't find a quick way to filter array by attributes slottype.

Its nice to see the community making plugins for myaac.

you could use the IN for the last update you did.
PHP:
$resultado = $db->query("SELECT * FROM `list_of_items` WHERE `slottype` IN ('distance', 'club', 'sword', 'axe') ORDER BY `level`;");
 
I have an unfinished commit for the develop git with something like this as myaac used to write to database till it was updated to use a cache array (I also made it print them back into the database for an items page.) as i couldn't find a quick way to filter array by attributes slottype.

Its nice to see the community making plugins for myaac.

you could use the IN for the last update you did.
PHP:
$resultado = $db->query("SELECT * FROM `list_of_items` WHERE `slottype` IN ('distance', 'club', 'sword', 'axe') ORDER BY `level`;");
Thank you very much for the feedback. I hadn't really thought about using IN instead of several ORs. I will definitely accept your tip and apply it in the plugin, thanks !!
 
Hello @Totten,

I did some solid rewrite of your system.

Now, no need to edit items.xml anymore.

It adds automatically all items.

Check the files and tell me what you think ;)

IMPORTANT: Please remove "list_of_items" table in MySQL (phpmyadmin) before installing this plugin because the table structure has been updated!!

Full Changelog:
Code:
[2.0 - 08.06.2021]
   * no need to edit items.xml anymore!! it detects automatically
   * move html code to twig
   * change table colors
   * fix "fromid" -> "toid" items.xml detection
   * fix MySQL errors with too long name and description
   * fix some warnings about undefined variables
   * add notice about items reloaded
   * shortened code

Screenshots:
1623166248237.png

1623166278799.png
1623166302093.png
 

Attachments

  • myaac-list-of-items-v2.0.zip
    7 KB · Views: 113 · VirusTotal
Hello @Totten,

I did some solid rewrite of your system.

Now, no need to edit items.xml anymore.

It adds automatically all items.

Check the files and tell me what you think ;)

IMPORTANT: Please remove "list_of_items" table in MySQL (phpmyadmin) before installing this plugin because the table structure has been updated!!

Full Changelog:
Code:
[2.0 - 08.06.2021]
   * no need to edit items.xml anymore!! it detects automatically
   * move html code to twig
   * change table colors
   * fix "fromid" -> "toid" items.xml detection
   * fix MySQL errors with too long name and description
   * fix some warnings about undefined variables
   * add notice about items reloaded
   * shortened code

Screenshots:
View attachment 59449

View attachment 59450
View attachment 59451
nice update and useful!
 
Hello @Totten,

I did some solid rewrite of your system.

Now, no need to edit items.xml anymore.

It adds automatically all items.

Check the files and tell me what you think ;)

IMPORTANT: Please remove "list_of_items" table in MySQL (phpmyadmin) before installing this plugin because the table structure has been updated!!

Full Changelog:
Code:
[2.0 - 08.06.2021]
   * no need to edit items.xml anymore!! it detects automatically
   * move html code to twig
   * change table colors
   * fix "fromid" -> "toid" items.xml detection
   * fix MySQL errors with too long name and description
   * fix some warnings about undefined variables
   * add notice about items reloaded
   * shortened code

Screenshots:
View attachment 59449

View attachment 59450
View attachment 59451
Is it possible to be on hover shows all the item attributes ? Would be interesting
 
Is it possible to be on hover shows all the item attributes ? Would be interesting

Yeah, that is planned feature for MyAAC, but its not so simple.

However, some initial work has been done in the system/libs/items.php Items Class.

There is getDescription function, but it needs to be extended.
 
Yeah, that is planned feature for MyAAC, but its not so simple.

However, some initial work has been done in the system/libs/items.php Items Class.

There is getDescription function, but it needs to be extended.
Does it gets custom description that is editted from onLook function? Or just get it from items.xml?
 
Does it gets custom description that is editted from onLook function? Or just get it from items.xml?

It mimics the C++ counter function Items::getDescription, using spells.xml, items.xml, weapons.xml (not done yet) and vocations.
 
Hello @Totten,

I did some solid rewrite of your system.

Now, no need to edit items.xml anymore.

It adds automatically all items.

Check the files and tell me what you think ;)

IMPORTANT: Please remove "list_of_items" table in MySQL (phpmyadmin) before installing this plugin because the table structure has been updated!!

Full Changelog:
Code:
[2.0 - 08.06.2021]
   * no need to edit items.xml anymore!! it detects automatically
   * move html code to twig
   * change table colors
   * fix "fromid" -> "toid" items.xml detection
   * fix MySQL errors with too long name and description
   * fix some warnings about undefined variables
   * add notice about items reloaded
   * shortened code

Screenshots:
View attachment 59449

View attachment 59450
View attachment 59451
Very good!! Thanks for the corrections, I'll update in the thread. Congratulations on your attitude!
 
This plugin isn't functional with the latest myaac, unless I am doing something wrong
View attachment 64976View attachment 64975

1° you need to create 1 file to store the directories you want to allow access, I like to create 1 array, but as this array can get very large, I prefer to create it in 1 separate file.
So let's say you are going to create this file in the system/ folder, then in your index.php file that is at the root of the site, you will put the following code:

require_once SISTEMA . 'verificado.php';

And then ctrl+f on:
if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page )

Change to this:
if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page) && !in_array($page, $list_pages_verified) )
This will make the site allow access to the directories that are inside this variable $list_pages_verified.
Now create a file called verified.php in system/ and inside it put the following code:
<?php $list_pages_verified = array( 'belmont_paste/arquivo' ); ?>
If you want to put + 1 directory just put 1 comma and put the name of the next one, looking like this:
<?php $list_pages_verified = array( 'name_of_paste/file', 'name_of_paste/other_file', 'name_of_paste/other_file' ) ?>
 
Last edited by a moderator:
1° you need to create 1 file to store the directories you want to allow access, I like to create 1 array, but as this array can get very large, I prefer to create it in 1 separate file.
So let's say you are going to create this file in the system/ folder, then in your index.php file that is at the root of the site, you will put the following code:

require_once SISTEMA . 'verificado.php';

And then ctrl+f on:
if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page )

Change to this:
if(!@file_exists($file) || preg_match('/[^A-z0-9_\-]/', $page) && !in_array($page, $list_pages_verified) )
This will make the site allow access to the directories that are inside this variable $list_pages_verified.
Now create a file called verified.php in system/ and inside it put the following code:
<?php $list_pages_verified = array( 'belmont_paste/arquivo' ); ?>
If you want to put + 1 directory just put 1 comma and put the name of the next one, looking like this:
<?php $list_pages_verified = array( 'name_of_paste/file', 'name_of_paste/other_file', 'name_of_paste/other_file' ) ?>
You combined portugese with english :D

require_once SISTEMA . 'verificado.php';
to
require_once SYSTEM . 'verified.php';

$list_pages_verified = array( 'belmont_paste/arquivo' );
PHP:
$list_pages_verified = array( 'items/head' );


Im very dumb so I couldnt understand what to actually do at the beginning lol.
so In case someone didnt realize or idk.


Very nice plugin btw, thanks a lot.
 
Last edited:
You combined portugese with english :D

require_once SISTEMA . 'verificado.php';
to
require_once SYSTEM . 'verified.php';

$list_pages_verified = array( 'belmont_paste/arquivo' );
PHP:
$list_pages_verified = array( 'items/head' );


Im very dumb so I couldnt understand what to actually do at the beginning lol.
so In case someone didnt realize or idk.


Very nice plugin btw, thanks a lot.
@Tofame @Totten @slaw
hello, I have the same problem and i was unsuccessful to be able to solve, could you explain me step by step how to do this please? i'm using the latest version of myacc
 
@Tofame @Totten @slaw
hello, I have the same problem and i was unsuccessful to be able to solve, could you explain me step by step how to do this please? i'm using the latest version of myacc
Sure, im at school rn so I will be available in 3 hours. We can either talk on dc (Tofame#6412) or I will explain here.
 
Back
Top