[MyAAC][Plugin] List Of Items

Totten

Member
Joined
Feb 26, 2019
Messages
26
Solutions
2
Reaction score
13
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: 52 · VirusTotal
Last edited:

Unknown Soldier

Mapping a map
Joined
Oct 30, 2010
Messages
160
Solutions
9
Reaction score
274
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`");
 
OP
Totten

Totten

Member
Joined
Feb 26, 2019
Messages
26
Solutions
2
Reaction score
13
Location
Brazil
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.
 

Leesne

Advanced OT User
Joined
Dec 4, 2017
Messages
319
Solutions
33
Reaction score
165
Location
UK
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`;");
 
OP
Totten

Totten

Member
Joined
Feb 26, 2019
Messages
26
Solutions
2
Reaction score
13
Location
Brazil
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 !!
 

slaw

Developer
Joined
Aug 27, 2007
Messages
3,255
Solutions
95
Reaction score
737
Location
Germany
GitHub
slawkens
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: 16 · VirusTotal

mRefaat

💉 Pharmacist 💊
Premium User
Joined
Jan 18, 2014
Messages
792
Solutions
3
Reaction score
113
Location
Egypt
GitHub
MohamedRefaat
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!
 

Shadow_

Veteran OT User
Joined
Jun 2, 2018
Messages
901
Solutions
29
Reaction score
331
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
 

slaw

Developer
Joined
Aug 27, 2007
Messages
3,255
Solutions
95
Reaction score
737
Location
Germany
GitHub
slawkens
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.
 

Shadow_

Veteran OT User
Joined
Jun 2, 2018
Messages
901
Solutions
29
Reaction score
331
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?
 

slaw

Developer
Joined
Aug 27, 2007
Messages
3,255
Solutions
95
Reaction score
737
Location
Germany
GitHub
slawkens
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.
 
OP
Totten

Totten

Member
Joined
Feb 26, 2019
Messages
26
Solutions
2
Reaction score
13
Location
Brazil
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!
 
Top