BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Age of Conan Archive => AoC 0.6.x Custom/Unofficial modules => Topic started by: Getrix on December 17, 2008, 06:41:14 pm

Title: Depot module
Post by: Getrix on December 17, 2008, 06:41:14 pm
Did some modifying on the Depot module.
This module is primary for AoC, but it should work for AO also i think..

Its released as a Beta for now, so feedback is wanted.

http://dump.sjef.biz/aoc/bebot/Depot.phps (http://dump.sjef.biz/aoc/bebot/Depot.phps)


INFO:
Download, put in costume/modules
help should be complete, so check it out for commands info.
Biggest change is Request function. This will help ppl to get request item on the Depot list, and remind itemholder that someone wants it.

Changelog:
3.2: Removed old org security check. Using only command check.
Title: Re: Depot module
Post by: xlDanek on December 17, 2008, 11:39:29 pm
Really nice one!

Unfortunately it doesn't work for me.

I can add items to the list, but if i check the list with "!depot", I only get "No items exist in the org depot.".

A look in the database shows: the new added items haven't been set to "Y" in the "itemActive" column.

I changed the SQL query as below (at row 124)

Code: [Select]
$query=("INSERT INTO #___depot (itemDatetime, itemHolder, itemName, itemLowid, itemHighid, itemQl, itemLowcrc, itemHighcrc, itemColour, itemUrl, itemActive) VALUES ('".$DatetimeNow."', '".$items[0]['holder']."', '".$items[0]['name']."', '".$items[0]['lowid']."', '".$items[0]['highid']."', '".$items[0]['ql']."', '".$items[0]['lowcrc']."', '".$items[0]['highcrc']."', '".$items[0]['colour']."', '$fitemname', 'Y')");
Now it works. Eventually the query in the "else" clause (row 128) has to be changed, too.

But i have two additional mistakes:

If I want to add an item with a german Umlaut "ä", "ü" or "ö" (untestet: "ß"), I get a positive answer, but the entry in the database isn't valid. There are some fields missing, like itemholder, itemName,... And the auto_increment function is sometimes broken after that :D Suddenly I had the ID "12259xxxx" after ID "4" :D
But it doesn't happen everytime (the ID problem, the Umlaut problem is repeatable).

The other mistake is a "permission to delete" problem. With the .php you posted above every member of my guild could delete every item in the list (I don't know why, but in my "whois" table every member has a "org_rank_id" of "0", perhaps because we have set no org). So I comment line 157 out:

Code: [Select]
//if($result1[0][0] < 2) $candel = true;
and it work's fine. Nobody could delete the items except the itemholder himself and the superadmins.

But I've got no solution for the Umlaut problem. :(

Edit:

Quote
And the auto_increment function is sometimes broken after that :D Suddenly I had the ID "12259xxxx" after ID "4" :D
But it doesn't happen everytime (the ID problem, the Umlaut problem is repeatable).

Ok, now I found th reason that is responsible for this behavior ;) If the added item is no "item link" but a normal text, the ID is set to the current time

Code: [Select]
$depotID = time();
and

Code: [Select]
$query=("INSERT INTO #___depot (id, itemName, itemURL, itemHolder) VALUES ('" . $depotID . "', '" . $fitemname . "', '', '" . $name . "')");
Afterwards, the auto_increment functions continues with this high ID.
But why is this implemented this way? I don't see why it's useful and necessary? Wouldn't it be better to disable the possibility of adding a normal text instead an item link?
Title: Re: Depot module
Post by: Getrix on December 18, 2008, 07:06:59 pm
Thanks for the feedback!

Quote
$depotID = time();
This is something from the old version, and i must say i never been in the situation where it was triggered...
And yes, its abit stupid that it adds a big number and auto_inc over it.
EDIT: This is removed from Beta 3.0-b


Quote
I changed the SQL query as below (at row 124)
This is probly because default value is not set correct, but your suggestion is a nice fix to make sure its being set correct
EDIT: Added this. Thanks for the suggestion!

Code: [Select]
//if($result1[0][0] < 2) $candel = true;Will check this out.
EDIT: Removed as i cant see the point having it... Got enough security checks.


Going to test some changes out before putting a new file up
EDIT: Working version is uploaded
Title: Re: Depot module
Post by: xlDanek on December 18, 2008, 11:20:56 pm
It looks really good so far.

Quote
Wouldn't it be better to disable the possibility of adding a normal text instead an item link?

I see you changed this in the code, too. You made it exact the same way I did it in my german version ;)

In the meantime I also solved my Umlaut problem. Just for the record because it's only necessary for german bebot users. I only insert some "str_replace" functions in the "depot_add" methode to change the Umlaute in "ä = ae, ö = oe, ü = ue and ß = ss". Afterwards I changed it back to the Umlaute:

Code: [Select]
function depot_add($itemname, $name)
    {
 
        $itemname = str_replace('Ä','Ae',$itemname);
        $itemname = str_replace('ä','ae',$itemname);
        $itemname = str_replace('Ö','Oe',$itemname);
        $itemname = str_replace('ö','oe',$itemname);
        $itemname = str_replace('Ü','Ue',$itemname);
        $itemname = str_replace('ü','ue',$itemname);
        $itemname = str_replace('ß','ss',$itemname);

        $sql = "SELECT org_rank_id FROM #___whois WHERE nickname = '$name'";
        $result = $this -> bot -> db -> select($sql);
        if ($this -> bot -> guildbot && $result[0][0] < 6)
        {
           
            if(is_numeric($dimension)) {
              $itemPattern = '(<a href="itemref:\/\/([0-9]*)\/([0-9]*)\/([0-9]*)\/([0-9a-f]*\:[0-9a-f]*\:[0-9a-f]*:[0-9a-f]*)\/([0-9a-f]*\:[0-9a-f]*\:[0-9a-f]*:[0-9a-f]*)"><font color=#([0-9a-f]*)>\[([\\-a-zA-Z0-9_\'&\s\-]*)\]<\/font><\/a>)';
              $posPattern = "/<a href=(.+)$/i";
            }         
            else {
              $itemPattern = '(<a style="text-decoration:none" href="itemref:\/\/([0-9]*)\/([0-9]*)\/([0-9]*)\/([0-9a-f]*\:[0-9a-f]*\:[0-9a-f]*:[0-9a-f]*)\/([0-9a-f]*\:[0-9a-f]*\:[0-9a-f]*:[0-9a-f]*)"><font color=#([0-9a-f]*)>\[([\\-a-zA-Z0-9_\'&\s\-]*)\]<\/font><\/a>)';
              $posPattern = "/<a (.+) href=(.+)$/i";
            }
           
            $fitemname = addslashes($itemname);
            $pos = preg_match($posPattern, $itemname,$info);
            $DatetimeNow = date('Y-m-d H:i:s');
            //Debug statement, uncomment to see the values are being posted by the user.
            //$this->bot->log("Depot", "Add_Item", "Item string [$itemname] Cutdown[" .str_replace('a','b',$itemname). "] Info [$info]");
            if ($pos)
            {
                $count = preg_match_all('/'.$itemPattern.'/i', $itemname, $matches, PREG_SET_ORDER);
                foreach($matches as $match)
                {
                    $item['holder']                                 = $name;
                    if (is_numeric($match[2])) { $item['lowid']     = $match[2]; }
                    if (is_numeric($match[3])) { $item['highid']    = $match[3]; }
                    if (is_numeric($match[4])) { $item['ql']        = $match[4]; }
                    $item['lowcrc']                                 = $match[5];
                    $item['highcrc']                                = $match[6];
                    $item['colour']                                 = $match[7];
                    $item['name']                                   = addslashes($match[8]);

  $item['name'] = str_replace('Ae','Ä',$item['name']);
  $item['name'] = str_replace('ae','ä',$item['name']);
  $item['name'] = str_replace('Oe','Ö',$item['name']);
  $item['name'] = str_replace('oe','ö',$item['name']);
  $item['name'] = str_replace('Ue','Ü',$item['name']);
  $item['name'] = str_replace('ue','ü',$item['name']);

                    $items[] = $item;
                }
                $query=("INSERT INTO #___depot_eng (itemDatetime, itemHolder, itemName, itemLowid, itemHighid, itemQl, itemLowcrc, itemHighcrc, itemColour, itemUrl, itemActive) VALUES ('".$DatetimeNow."', '".$items[0]['holder']."', '".$items[0]['name']."', '".$items[0]['lowid']."', '".$items[0]['highid']."', '".$items[0]['ql']."', '".$items[0]['lowcrc']."', '".$items[0]['highcrc']."', '".$items[0]['colour']."', '$fitemname', 'Y')");
               
                $this -> bot -> db -> query($query);
                $depotID = mysql_insert_id();
                $strmsg = "Thank you, your item has been added to the database as id #" . $depotID;
            }
            else
            {
                $strmsg= "The link/item you are trying to share is not in a valid format!";
            }
           
        }
        else
            $strmsg = "You must be at least a Unit Member of the org to insert items into the org depot.";

        return $strmsg;
    }
Title: Re: Depot module
Post by: palm521 on February 04, 2009, 07:40:50 pm
great. however it does not let me add items,

it says , You must be at least a Unit Member of the org to insert items into the org depot

how do you add/remove people from the org (im currently the owner of the bot)

thanks in advance.
Title: Re: Depot module
Post by: Getrix on February 04, 2009, 11:34:26 pm
Have you setup the bot in a guild with members or just started using it?...

Title: Re: Depot module
Post by: Wizhk on February 04, 2009, 11:39:12 pm
Bot is in guild with most functions working. I used to have the autogratz working but that is not the case after re-installing the bot on a new computer.

Bot recognizes guild chat and ads members, etc.

I had the old depot working fine. I just did not like looking through so many items for no reason and thought that more functionality was needed.

So, yes I believe that the bot is in proper working order.

Thanks
Title: Re: Depot module
Post by: palm521 on February 05, 2009, 07:29:55 am
yes bot has members in it. but everytime i type !depot add silver (for example) i get the error above.

im loosing my mind.....

as owner i should have the priviledges of using this? what do you think its wrong?

thanks
Title: Re: Depot module
Post by: Getrix on February 05, 2009, 03:03:48 pm
Ok, thanx for the replies.

Removed some security in the item_add function as "!depot" access is set in !command settings and its no point that i say its only orgmembers (something that also was wrong coded:P) should use it.

Default: Member can access !depot via tell and gc.
Title: Re: Depot module
Post by: Wizhk on February 05, 2009, 05:17:44 pm
Just changed my code and closed the bot and restarted. Added a new item and checked for it. Still not working.

Code: [Select]
Dhlbot [GROUP]  [MSG]   [Last Crusade] ChuckTaylor: !depot add <a style="text-de
coration:none" href="itemref://3746106/3746106/41/689e89fa:1e5fa7f7:a56ecf10:307
d132f/689e89fa:1e5fa7f7:a56ecf10:307d132f">[Heretic's Vambraces][/link]
MySQL error (# 0) on query: INSERT INTO dhlbot_depot (itemDatetime, itemHolder,
itemName, itemLowid, itemHighid, itemQl, itemLowcrc, itemHighcrc, itemColour, it
emUrl, itemActive) VALUES ('2009-02-05 08:09:11', 'ChuckTaylor', 'Heretic\'s Vambra
ces', '3746106', '3746106', '41', '689e89fa:1e5fa7f7:a56ecf10:307d132f', '689e89
fa:1e5fa7f7:a56ecf10:307d132f', '6d8dff', '<a style=\"text-decoration:none\" hre
f=\"itemref://3746106/3746106/41/689e89fa:1e5fa7f7:a56ecf10:307d132f/689e89fa:1e
5fa7f7:a56ecf10:307d132f\"><font color=#6d8dff>[Heretic\'s Vambraces]</font></a>
', 'Y')
Unknown column 'itemDatetime' in 'field list'
Dhlbot [GROUP]  [MSG]   [Last Crusade] Dhlbot: Thank you, your item has been
added to the database as id #0
Dhlbot [GROUP]  [MSG]   [Last Crusade] ChuckTaylor: !depot
MySQL error (# 0) on query: SELECT id, itemName, itemURL, itemHolder, itemColour
, itemLowid, itemQl, itemDatetime, itemReq FROM dhlbot_depot WHERE itemActive='Y
' ORDER BY itemDatetime DESC
Unknown column 'itemDatetime' in 'field list'
Dhlbot [GROUP]  [MSG]   [Last Crusade] Dhlbot: No items exist in the org depo
t.

Title: Re: Depot module
Post by: Getrix on February 05, 2009, 05:33:41 pm
You probly got the old Depot database.. This version got alot of new stuff storing in the table.

Delete dhlbot_depot, start your bot again.
Title: Re: Depot module
Post by: Wizhk on February 05, 2009, 10:37:37 pm
Sorry.. where do I find that? I am guessing I have to access the database for that, how do I do that? ;)

I can figure it out just need to know where to look.. ;)

Wizhk
Title: Re: Depot module
Post by: Wizhk on February 05, 2009, 10:46:05 pm
Think I found it and dropped it.. Testing now.


Title: Re: Depot module
Post by: Wizhk on February 05, 2009, 10:50:38 pm
Yep it worked.. Thanks alot.

One last request. If possible can the request option be made to send a mail instead of a tell.

Thanks.

Title: Re: Depot module
Post by: Getrix on February 06, 2009, 07:08:04 am
Well, that will "whats best for everyone" case.. Im happy with the solution today, and i dont know if any other modules that use Mail system.
Title: Re: Depot module
Post by: blkanaki on February 26, 2009, 05:08:48 am
Has anyone got this to work in conjunction with Anarchy Online?
Title: Re: Depot module
Post by: Corbzy on March 21, 2009, 01:32:53 am
Excellent MOD, works a treat and avoids all of the overhead administration of a centralised Guildbank for items!

A couple of suggestions for improvement:

1 - Would it be possible to have the option to sort / search the list by itemlevel (makes it easier to look for all items close to a player's level)
2 - Option to un-request an item (in case a player has requested an item by mistake/ doesn't need it anymore etc.)
3 - Not sure of the usefulness of showing the time an item was enetered into the Depot (it just takes up display space imo).

Thanks

Title: Re: Depot module
Post by: Solldara on May 08, 2009, 12:03:11 pm
Yep - can I second the idea to have it send a mail - or could someone just give me the code line and tell me where to add it in :)

Problem is that atm the character holding the item has to be logged in to see if anyone wants anything.  Many of us use several bank alts - 5 in my case.  This effectively makes the module useless because in real terms we get members to list items to share but then they may not log onto that character for a week to see the request - so noone actually uses the module.

If the bot sent a mail then the player would get the mailed request regardless of which character they were logging in at and then could go onto the alt and send the requested item immediately.

This module is really great and its such a pity to not use it to its full potential, as it would be an integral part of the guild. So as I said if someone could just give me the commands I'll happily edit the module myself.

Btw - listing the item using your main character is not a solution as it takes more time and then players can't remember where they sent it too.

PS - Module works great - its just this one addition would make it 100% more likely to be used.
Title: Re: Depot module
Post by: Skunkie on May 11, 2009, 04:19:35 pm
i think there was some easy Function to check the users Main char so if you have troubles with alts and stuf it m8 be a simple adjustment of the code ie always add the main character as the item owner even when he adds it with his alt. I will be working on implementing YG with bebot so i dont really have time to look into this for you.
Title: Re: Depot module
Post by: Nogoal on July 08, 2009, 11:43:00 am
Has anyone got this to work in conjunction with Anarchy Online?
Here's mine (http://aotn.binarywastes.net/Depot.phps). I took the old version, added stuff from this. Probably not as good as the AoC version but it works.
Title: Sorting by item level
Post by: Kyr on November 24, 2009, 07:55:01 am
Guildy asked for sorting by level, so I added that.  Also added a way to get items by level range.

To just sort the whole thing by level:

To only see items between level 35 and 40, it will also be sorted:
Title: Re: Depot module
Post by: Kyr on December 18, 2009, 09:52:59 pm
Can't add recipes.

Change line 99 to:

This line was copied from Items.php (New Central itemDB from Getrix 2009-10-29)
Title: Re: Depot module
Post by: Cuval on May 04, 2011, 04:02:40 pm
Hey guys,

I am probably one of the few still using this one, but what can you do. It's pretty much ideal for having multiple bank alts take care of guild items donated to be requested by guildies.

Can someone please look into the item format updates and apply them in this module. I think I would need a few days myself to hack the code. Yes I know it isn't much, but for php, i don't know much :)

Thanks.
Title: Re: Depot module
Post by: Kyr on May 14, 2011, 05:54:36 am
I haven't looked at this module in a while.

Getrix helped me fix the gitems module, you can see the changes in this post: http://bebot.link/aoc-0-6-x-customunofficial-modules/items-crafted-by-guild/msg17080/#msg17080

hopefully these will help you fix this module.

Good luck!

~Kyr
Title: Re: Depot module
Post by: Cuval on May 16, 2011, 10:45:47 am
I went through the gitems mod changes and found a way to change this mod to reflect the same changes. It had to be modified a bit as this mod saves things a bit different in a table, but not too hard once I started fiddling around with it.

Changed the item format strings and the pointers to add the correct bits into the db.

Thanks Kyr, for pointing to the bit of code from Getrix i needed to start.

Here is the attached .phps working for the new item format.
Title: Re: Depot module
Post by: Kyr on May 17, 2011, 05:28:42 am
No problem, glad you were able to get it working.

~Kyr
Title: Re: Depot module
Post by: Thedentist on July 28, 2011, 09:41:21 am
Hi,

my bot first runs great on an Vserver :)
Modules like TimerAA,reboot and YG are still runinng.

But in the Depot i dont see the name of the items i only see the ID the Date and
no Item Holder and lvl !?

i just copy the php in the /custom/modules and restart the bot

Why i dont see the items with !depot or list ??
Title: Re: Depot module
Post by: Cuval on July 30, 2011, 10:51:33 pm
Thedentist

Have you downloaded the latest version? Have you linked the item while adding, or tried some id number?
Title: Re: Depot module
Post by: Thedentist on August 04, 2011, 10:10:19 am
my fault

it was not the 3.3 Version now its perfekt :)

thx
Title: Re: Depot module
Post by: joel47 on January 02, 2012, 04:22:57 am
This Almost works for me, BUT I get a database error when I click on the STATS link?
 
I have a return of !item 3804829 then this message: Error in query to database BUT I don't see that number anywhere under my Depot db fields?

Is it suppose to be a !gitems reference??  Am I suppose to get an item reference window when I click that Stat link as if I had dragged the item into chat?

I'm using MySQL Manager(first time user) to view the database and I don't know where that's located except in the gitems database which is where the crafted items are, and not the items that I listed as in my inventory.

I'm using Cuval's 3.3 version!  After reading thru this thread several times its confusing which one to use. The OP Getrix or Cuval!

I installed Getrix(3.2) the first time but got the same result so I tried to delete the depot heading as instructed by Getrix and started over with Cuval's version with a few new database entries.

Thanks IF anyone is using this for any replies :)
SimplePortal 2.3.7 © 2008-2024, SimplePortal