BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Age of Conan Archive => BeBot Hyborian modules => Topic started by: durroch on July 25, 2008, 04:24:32 am

Title: Guild Items
Post by: durroch on July 25, 2008, 04:24:32 am
Greetings,

I've put together a module that helps your guild keep track of what items the guild currently owns.  It will show a list of every item in stock so your members can see what the guild currently has.  If an item is currently out of stock it will not be shown on the list.  If an item is out of stock but is loaned to someone, it will show it on the list but tell the person looking that it's currently loaned out. I will be adding screen shots as soon as my guild gets all our items propagated into the database.

This is my very first module so if some of you guru's out there want to give me some pointers, drop me a PM or reply to this post :).  Also if anyone would like a feature tweaked or added, let me know.

When I mention <itemlink> it means to drag an item to the chat and drop it in.

Working On
-[ Done ] Sprucing up the code
-[ Done ] Adding colors to each item listed (i.e. grey, green, blue, purple)
-[ Done ] Add a function to show all items that have been 'Given' and 'Loaned' because you are not always going to have the item in your inventory to do !gitems history item <itemlink> and you're not always going to remember who has what using the !gitems history member <Name> command.

Screen Shots
List of Items (Page 1 of 4) - Note: The [ Delete ] button will not be there when someone lower than Admin uses the !gitems command.
(http://www.invictrum.com/images/gitems_1.jpg)

List of Items (Page 2 of 4) - Note: The [ Delete ] button will not be there when someone lower than Admin uses the !gitems command.
(http://www.invictrum.com/images/gitems_2.jpg)

History of a Member (Durroch)
(http://www.invictrum.com/images/gitems_3.jpg)

History of an Item (Clan Gaud Chestguard)
(http://www.invictrum.com/images/gitems_4.jpg)

Below is quoted from the bots help command:
Quote
::::: HELP ON GITEMS :::::

Keeps track of what items the Guild currently owns and also what the guild has loaned out or given to its members

 !gitems - Shows a list of all the items the Guild owns.
 !gitems add <qty> <category1> <category2> <itemlink> - Adds an item to the list.
 !gitems give <member> <qty> <itemlink> - Permanently gives an item to a Guild Member and records it in the transaction history of said Member.
 !gitems loan <member> <qty> <itemlink> - Loans an item to a Guild Member and records it in the transaction history of said Member.
 !gitems update add <qty> <itemlink> - Adds <qty> to the current stock of the specified item.
 !gitems update rem <qty> <itemlink> - Subtracts <qty> from the current stock of the specified item.
 !gitems history member <member> - Gives you a transaction history of all items given or loaned to <member>, as well as items checked back in.
 !gitems history item <itemlink> - Gives you a transaction history of loans and who's been given the specified item.
 !gitems history all - Gives you a transaction history every item every loaned or given.

NOTES:
Created by Durroch - Invictrum Guild Leader - US-Derketo
When using the Add sub-command to add an item (i.e. !gitems add 1 Armor Heavy <itemlink>) to the Guild Items list please use the following categories:
Armor Cloth
Armor Silk
Armor Light
Armor Medium
Armor Heavy
Armor Plate
Armor Shields
Armor Back
Weapons 1HE
Weapons 2HE
Weapons 1HB
Weapons 2HB
Weapons Daggers
Weapons Polearms
Weapons Staves
Weapons Bows
Weapons Arrows
Weapons Crossbows
Weapons Bolts
Weapons Thrown
Misc Necklaces
Misc Rings
Misc Talismans
Potions Mana
Potions Stamina
Potions Health
Gems Rhombic
Gems Trillion
Gems Oval
Gems Teardrop
Gems Oblique
Gems Cabochon
Title: Re: Guild Items
Post by: Roath on July 25, 2008, 01:30:05 pm
what about tradeskill resources? would be nice to be able to add, for example resources for the guildcity, alchemy or similar
Title: Re: Guild Items
Post by: Organizer on July 25, 2008, 02:04:13 pm
Quote
what about tradeskill resources? would be nice to be able to add, for example resources for the guildcity, alchemy or similar

He left that out on purpose as we have mods like the !city guild management module to take care of such a resource list...
Title: Re: Guild Items
Post by: Loden on July 25, 2008, 09:13:24 pm
Good work Durroch

Very well done.  Are you doing ok with quality recognition?  Looks like items has something in there for that.  I'm working on adding an item request link, allowing members to add/delete their names from the record as an interested party and allowing folks with proper premissions to raffle it for the interested parties.

Sounds like a bit much but you've got a great template here to work from.  Much further along than I was.

I'll give you my results if you haven't already coded something similar when I'm done.

Title: Re: Guild Items
Post by: durroch on July 25, 2008, 11:48:03 pm
Thank you, I appreciate that :).
I believe there's already a raffle function in the bot so I'm not too keen to reinvent the wheel. 
Yes, I used the code from Items.php that already figured out how to extract the QL, Name, ItemID, and Color :).  This weekend, my guild will be propagating this module so I will take screen shots after it's done :).
Title: Re: Guild Items
Post by: Loden on July 25, 2008, 11:55:37 pm
Yeah, I was simply going to add a link that made use of the current raffle functionality.

I was looking through it and I see you're already capturing additional information like colors and such but just haven't wired it up yet.  No problem at all 8)

Once I get the request feature taken care of, I'll give the additions to look over incase you want to include them in your workk.  Again very nice job and I'm happy you beat me to the punch.  I get more time to spend Farming... wait... >.>
Title: Re: Guild Items
Post by: durroch on July 26, 2008, 02:47:32 am
Ya, I'm not sure how to use the chatcmd() tool and make the items different colors.

Code: [Select]
$itemlink = $this -> bot -> core("tools") -> chatcmd("item $items[item_id]", "##gitems_color##$items[item_name]##end##");&
Code: [Select]
$itemlink = $this -> bot -> core("tools") -> chatcmd("item $items[item_id]", "<font color='COLOR'>$items[item_name]</font>");
Both do not work.  It still produces an orange link.  I'm guessing I'll have to forgo using the chatcmd() tool and build the links myself.  Anyone got any hints or a standard way of doing it besides chatcmd()?

And ya, I'd like to take a look at your code once you've done your thing :).  Not sure how using the raffle command will work.  That seems to me that it will make this module more of a "real-time" application when it's not.  Meaning your guild is on a raid and an item comes up that you need to raffle off.  It would be redundent to put into the Guild Items system just so people can click on a link that raffles off the item.  Just skip using this module and raffle it off regularly.  This module is just more for keeping track of what the guild owns and who's got what loaned out to them as well as all the items been given out.
Title: Re: Guild Items
Post by: durroch on July 26, 2008, 08:52:43 am
Fixed a couple bugs and add two new categories to the list, "Armor Back" and "Armor Silk".  Please update to newest code if you are using this.

Also to get the two new categories you'll either have to delete the "guild_items" table and restart the bot or go in and add the two new categories to "item_cat" field.
Title: Re: Guild Items
Post by: durroch on July 27, 2008, 06:10:39 am
Updated the code to v1.2.  This fixed some bugs and also added the colors to the items.  I also cut out a lot of unnecessary code as well.  I've updated the first post with screenshots too.  Let me know if there's anything else you'd like to see in this module.
Title: Re: Guild Items
Post by: krowe on July 30, 2008, 04:17:53 pm
Having a bit of trouble with this one for some reason, extracted mod to custom mods and ran it.  Can add items without a problem and get a message back thanking me for doing so, hoever when i ask the bot !gitems i get a reply of 'There are currently no guild items'

Any ideas?
Title: Re: Guild Items
Post by: durroch on July 30, 2008, 04:46:42 pm
hmm....is there a way you could show me what's happening in the console window of the bot when you add an item?  I'm guessing there's an error somewhere and it's not being added but saying it is anyways.
Title: Re: Guild Items
Post by: krowe on July 30, 2008, 05:02:48 pm
Hmm never thought of checking the log but i only have limited knowledge of this but it looks like a mysql error?

Aocbot [TELL]   [INC]   Krowe: !gitems add 1 Weapons 2HB <a style="text-decorati
on:none" href="itemref://3806481/3806481/77/b22339fb:b271aa20:4091a21d:fede9951/
b22339fb:b271aa20:4091a21d:fede9951">[Maul of the Stars][/link]
MySQL error (# 0) on query: INSERT INTO guild_items (item_id, item_name, item_co
lor, item_ql, item_stock, item_cat) VALUES ('3806481', 'Maul of the Stars', 'be0
0be', '77', '1', 'Weapons 2HB')
Field 'item_loaned' doesn't have a default value
Aocbot [TELL]   [OUT]   -> Krowe: Thank you Krowe, <a style="text-decoration:non
e" href="itemref://3806481/3806481/77/b22339fb:b271aa20:4091a21d:fede9951/b22339
fb:b271aa20:4091a21d:fede9951">[Maul of the Stars][/link] was added to Guild Ite
ms list.
Aocbot [TELL]   [INC]   Krowe: !gitems
Aocbot [TELL]   [OUT]   -> Krowe: There are currently no Guild Items.
Title: Re: Guild Items
Post by: durroch on July 30, 2008, 05:21:36 pm
hmm, weird.  Do you know how to alter a table in phpmyadmin or whatever program you are using to manage your MySQL database?  If so, go into the guild_items table and change the item_loaned field to have a default value of 0 and I think that should fix your problem.  I'm not sure why you are having problems as I never did and I'm pretty sure the other people who have used this aren't as well since no one has said anything.  It might be the way your mysql is installed *shrugs*. 
Title: Re: Guild Items
Post by: chamoul on July 30, 2008, 06:38:32 pm
the bank is so small, that we can't stock everything inside. So actually we use some player to stock items. My question is : is-there anyway to add in this module an option to show the character names of who have the items in the stock


thank you
Title: Re: Guild Items
Post by: durroch on July 31, 2008, 09:19:10 am
Ya, we do the same thing, only one of my resource officers is in-charge of collecting all the items and she has them all on one character.  Although that is a good feature to have.  It will just have to be one more thing you'll have to type in when adding an item.  like
!gitems add 1 Armor Heavy Name <itemlink>

I'll try to have this implemented after the weekend. I'm busy busy busy with freelance work heh.
Title: Re: Guild Items
Post by: durroch on July 31, 2008, 11:33:28 am
I'm retarded, scratch what I said about adding the name to the command.  I can just grab that from the character submitting the command since obviously the item is located on that character when adding it to the database.  So ya, that will be easy to implement.  I'll just make it visible to admin and higher since it's really not relative to the end user.
Title: Re: Guild Items
Post by: Sigi_cz on August 04, 2008, 07:33:02 am
This mod lost part of his functionality thanks to Funcom "Bind on equip". Damn them  :-X
Title: Re: Guild Items
Post by: jimango on January 24, 2009, 09:00:11 am
hei, is it a way to make this module work as a guild crafting overview?

I think this is a very nice module, i like the sections of each kind of armor..

Is it possible to remake this module to list what members that have each item?
So we can have a good overview of who can make what in guild..
We use !supplies atm, but then we have to click trough all items to know what they are..
If the !gitems could change "quanity" with "player" this would be a great module to list what items that can be created in the guild =D

jimango
Title: Re: Guild Items
Post by: durroch on January 24, 2009, 10:50:38 am
Sorry Mate, I haven't played this game since around Sept of last year nor do I have an account anymore.  Someone else is going to have to make these changes for you :-/.

Best of luck though!
Title: Re: Guild Items
Post by: jimango on February 23, 2009, 01:19:52 am
Ok, me and a guild member have made the changes we want now..

The only thing we cant fix atm, is to give members of the bot access..
I can myself add items, but we are not sure what to do.. im the owner

can someone help us?

Code is removed and moved to an other post http://bebot.link/module-requests/culture-item-recipe-book-or-guild-crafters-module/msg12292/?topicseen#new to make it easyer to mantain
Title: Re: Guild Items
Post by: Wizhk on February 23, 2009, 07:32:36 am
Did you go into settings and promote ppl on the bot that you want to have access?

Or maybe you will find an option to change the actual module to allow a lower access.

!settings

Wizhk
Title: Re: Guild Items
Post by: jimango on February 23, 2009, 10:45:33 am
in settings the option is only to allow ppl to delete items..
I gues it has to be fixed in the code for me to be able to give access to MEMBERS
Title: Re: Guild Items
Post by: jimango on February 24, 2009, 05:00:11 pm
Problem solved, maintained in thread posted where the code used to be above
Title: Re: Guild Items
Post by: Drizzurdeen on April 01, 2009, 05:26:43 pm
perfekt module ... we love ist ... but ;)

is there a possibility to add the storrage-palce lice bankchar1 bankchar2 and so on ...

we don't have all the items just in the bankslot for the guild ... we use several bankchars ... it would be nice whenn the function would look lick this

!gitems add 1 armor heavy [itemlink] Bankchar1

and whenn you give the command
!gitems
the bot will show you the Items like this

Armor
  Heavy
  item / ql / stock / [char where the item is] / delete

and so on ...

we tryed several things but nothing will work :( ...

greets Drizz
Title: Re: Guild Items
Post by: Drizzurdeen on April 03, 2009, 11:34:34 am
really no ideas how i can change the php-file that it works ???

we tryed these things

Quote
function __construct (&$bot)
   {
      parent::__construct(&$bot, get_class($this));
      
      $this -> bot -> db -> query("
         CREATE TABLE IF NOT EXISTS " . $this->bot->db->define_tablename("guild_items", "false") .
         " (id int(11) NOT NULL auto_increment,
         item_name varchar(50) NOT NULL,
         item_id varchar(20) NOT NULL,
         item_ql varchar(3) NOT NULL,
         item_color varchar(300) NOT NULL,
         item_stock int(11) NOT NULL,
         item_cat enum('Ruestung Sozial', 'Ruestung Stoff', 'Ruestung Leicht','Ruestung Mittel','Ruestung Schwer','Ruestung Platte','Ruestung Schild','Ruestung Back','Waffe 1HE','Waffe 2HE','Waffe 1HB','Waffe 2HB','Waffe Daggers','Waffe Stange','Waffe Stab','Waffe Bogen','Waffe Pfeil','Waffe Armbrust','Waffe Bolzen','Waffe Wurf','Schmuck Halskette','Schmuck Ring','Schmuck Talisman','Buff Mana','Buff Ausdauer','Buff Gesundheit','Gems Rhombic','Gems Trillion','Gems Oval','Gems Teardrop','Gems Oblique','Gems Cabochon') NOT NULL,
         item_loaned int(11) NOT NULL,
         item_besitzer varchar (20) NOT NULL,
         PRIMARY KEY  (id))");

after deleting the tabel in the database and restartign the bot ... he create the item_besitzer

Quote
function command_handler($name, $msg, $origin)
   {
      $this -> error -> reset(); //Reset the error message so we don't trigger the handler by old error messages.

      $com = $this -> parse_com($msg, array('com', 'sub', 'arg1', 'arg2', 'arg3', 'arg4', 'arg5'));

      switch($com['sub'])
      {
         case 'add':
            return $this -> add_gitems($name, $com['arg1'], $com['arg2'] . ' ' . $com['arg3'], $com['arg4'], $itemb['arg5']);
            break;

here we say him ... now you have a 5'th argument itemb

Quote
function show_gitems($name)
   {
      if (empty($this -> items_list)) return "There are currently no Guild Items.";
      
      $blob = "<font color='SILVER' face='hyborianlarge'>:: Available Guild Items ::</font>\n";
      if (!empty($this -> items_list))
      {      
         $item_cat = "";
         $item_cat2 = "";
         foreach ($this -> items_list AS $items)
         {
            $item_category = preg_split('/ /', $items['item_cat']);
            if (!empty($items['item_loaned']))
            {
               $item_loaned = "##gitems_highlight1##|##end## ##gitems_highlight2##Loaned out:##end## " . $items['item_loaned'];
            } else {
               $item_loaned = "";
            }
            if ($this -> bot -> core("security") -> check_access($name, $this -> bot -> core("settings") -> get('Guild_Items', 'Item_Del')))
            {
               $delete = "##gitems_highlight1##|##end## [ " . $this -> bot -> core("tools") -> chatcmd("gitems del $items[id]", "Delete") . " ]";
            }
            $itemlink = $this -> itemlink("item $items[item_id]", "$items[item_color]", "$items[item_name]");
            if($item_cat<>$item_category[0])
            {
               $blob .= "\n##gitems_heading1##$item_category[0]##end##\n";
               if ($items['item_stock'] > "0" || !empty($item_loaned))
               {
                  if($item_cat2<>$item_category[1])
                  {
                     $blob .= "&nbsp;&nbsp;##gitems_heading2##$item_category[1]##end##\n";                  
                     $blob .= "&nbsp;&nbsp;&nbsp;&nbsp;$itemlink ##gitems_highlight1##|##end## ##gitems_highlight2##QL:##end## $items[item_ql] ##gitems_highlight1##|##end## ##gitems_highlight2##Stock:##end## $items[item_stock] $item_besitzer $delete\n";
                  } else {
                     $blob .= "&nbsp;&nbsp;&nbsp;&nbsp;$itemlink ##gitems_highlight1##|##end## ##gitems_highlight2##QL:##end## $items[item_ql] ##gitems_highlight1##|##end## ##gitems_highlight2##Stock:##end## $items[item_stock] $item_besitzer $delete\n";
                  }
                  $item_cat2 = $item_category[1];
               }
            } else {
               if ($items['item_stock'] > "0" || !empty($item_loaned))
               {
                  if($item_cat2<>$item_category[1])
                  {
                     $blob .= "&nbsp;&nbsp;##gitems_heading2##$item_category[1]##end##\n";                  
                     $blob .= "&nbsp;&nbsp;&nbsp;&nbsp;$itemlink ##gitems_highlight1##|##end## ##gitems_highlight2##QL:##end## $items[item_ql] ##gitems_highlight1##|##end## ##gitems_highlight2##Stock:##end## $items[item_stock] $item_besitzer $delete\n";
                  } else {
                     $blob .= "&nbsp;&nbsp;&nbsp;&nbsp;$itemlink ##gitems_highlight1##|##end## ##gitems_highlight2##QL:##end## $items[item_ql] ##gitems_highlight1##|##end## ##gitems_highlight2##Stock:##end## $items[item_stock] $item_besitzer $delete\n";
                  }
                  $item_cat2 = $item_category[1];
               }
            }
            $item_cat = $item_category[0];
         }
      }
      return $this -> bot -> core("tools") -> make_blob("Guild Items", $blob);

here we try to show the 5'th argumen ... item_besitzer

Quote
//Add items to Guild Item list
   function add_gitems($name, $item_stock, $item_cat, $arg, $itemb)
   {
      $item = $this -> parseitem($arg);
      $item_name = str_replace("'", "\'", $item[name]);
      $itemb = $item_besitzer;
      

      $result = $this -> bot -> db -> select("SELECT * FROM #___guild_items WHERE item_id = '$item[id]'");
      if (!empty($result))
      {
         $this -> error -> set($arg . " habe ich bereits in meiner geilen Datenbank.");
         return $this -> error;
      }
      $this -> bot -> db -> query("INSERT INTO #___guild_items (item_id, item_name, item_color, item_ql, item_stock, item_cat, item_besitzer) VALUES ('$item[id]', '$item_name', '$item[color]', '$item[ql]', '$item_stock', '$item_cat', '$item_besitzer')");
      $this -> load_gitems();
      return "Vielen Dank " . $name . ", " . $arg . " wurde der Datenbank hinzugefügt.";

here we try to add an item including the item-owner into the db .... but ... when we make !gitems add 1 armor heavy [itmelink] owner ... he is adding the item into the database ... but without the owner ...  why ???
where is the mistake ???

please please help

thx drizz
SimplePortal 2.3.7 © 2008-2024, SimplePortal