Grandelf
Esteemed Member
Some general information
So I finally got to rewrite this for Eluna, a promise I made to Foe over a year ago when it wasn't possible
to convert the script to Eluna yet because of the lack of a loot hook. Well that loot hook has been around
for quite some time now so about time that I convert this to Eluna =P.
So what this script does is basically logging every single item a player loots. This is useful when you have
whining players that apparently lost loot on a server crash (rollback) but can't provide any proof. This script
will provide the proof for them.
Differences from the arcemu version.
I have completely rewritten the script.
This version uses a database rather than a .txt file. This because of two reasons:
(same goes for name changes, only then it will update the name).
Usage
To check someones loot history you can either find the player in the database table, or you
can use the command provided below under the following conditions:
You target a player and type:
You use the player's name in the command.
Item entry is optional and if specified it will only search for that specific item.
Setting up the script
All you have to do is put the script in your scripts folder and run the SQL query provided below.
At the top of the script you will find two variables that you can change:
the command syntax and the maximum results shown on usage. Simply edit these to your liking.
Script: http://pastebin.com/thTXXAsx
Future updates
I am planning on updating this a bit when I have the time.
Grandelf.
EDIT:
SQL query:
If you want to delete the script, be sure to run this query to delete the database content:
So I finally got to rewrite this for Eluna, a promise I made to Foe over a year ago when it wasn't possible
to convert the script to Eluna yet because of the lack of a loot hook. Well that loot hook has been around
for quite some time now so about time that I convert this to Eluna =P.
So what this script does is basically logging every single item a player loots. This is useful when you have
whining players that apparently lost loot on a server crash (rollback) but can't provide any proof. This script
will provide the proof for them.
Differences from the arcemu version.
I have completely rewritten the script.
This version uses a database rather than a .txt file. This because of two reasons:
- A database table is easier to read;
- SQL provides options to auto clean up your table.
(same goes for name changes, only then it will update the name).
Usage
To check someones loot history you can either find the player in the database table, or you
can use the command provided below under the following conditions:
You target a player and type:
Code:
.char loot [, item_entry]
Code:
.char loot plrname [, item_entry]
Setting up the script
All you have to do is put the script in your scripts folder and run the SQL query provided below.
At the top of the script you will find two variables that you can change:
the command syntax and the maximum results shown on usage. Simply edit these to your liking.
Script: http://pastebin.com/thTXXAsx
Future updates
I am planning on updating this a bit when I have the time.
- Upgrade the command so you can also use a character name to search for loot;
[*]Implement some table clean-up (this table may become huge);
[*]Change the command so it shows the item name / link instead of the entry id.
Grandelf.
EDIT:
SQL query:
Code:
/* We only want to run this if the table does not exist. */
DROP TABLE IF EXISTS player_loots;
CREATE TABLE player_loots (
/* Loot table. */
id int unsigned NOT NULL AUTO_INCREMENT,
player varchar(12) COLLATE utf8_bin NOT NULL,
date_time int unsigned NOT NULL,
item_id int unsigned NOT NULL,
item_count tinyint unsigned NOT NULL,
deleted tinyint(1) unsigned NOT NULL DEFAULT '0',
/* Table rules ... */
/* Constraints for player_loots. */
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/* Creating the trigger that will mark the records as deleted */
DELIMITER // /* Changing the delimiter, so we can use ';'. */
DROP TRIGGER IF EXISTS character_on_delete//
CREATE TRIGGER character_on_delete AFTER DELETE ON characters
FOR EACH ROW
BEGIN
UPDATE player_loots SET deleted = 1 where player = OLD.name;
END//
/* Creating the trigger that will update the name in 'player_loots'
after an update on characters. */
DROP TRIGGER IF EXISTS character_on_update//
CREATE TRIGGER character_on_update AFTER UPDATE ON characters
FOR EACH ROW
BEGIN
UPDATE player_loots SET player = NEW.name where player = OLD.name;
END//
/* Weekly clean up event. */
SET GLOBAL event_scheduler = ON// -- Just in case ... it was off in my database so.
DROP EVENT IF EXISTS loot_cleanup//
CREATE EVENT loot_cleanup ON SCHEDULE EVERY 1 WEEK STARTS '2014-12-14 00:00:00'
DO BEGIN
DELETE FROM player_loots WHERE deleted = 1;
END//
DELIMITER ; /* obviously we have to set it back to ';' again ... */
If you want to delete the script, be sure to run this query to delete the database content:
Code:
DROP TABLE IF EXISTS player_loots;
DROP TRIGGER IF EXISTS character_on_delete;
DROP TRIGGER IF EXISTS character_on_update;
DROP EVENT IF EXISTS loot_cleanup;
SET GLOBAL event_scheduler = OFF;
Last edited: