DragonPrime - LoGD Resource Community

Modules, Themes and other customizations for your game => Completed Modules for version 1.x.x => Topic started by: XChrisX on May 19, 2005, 01:58:16 PM



Title: Item system
Post by: XChrisX on May 19, 2005, 01:58:16 PM
Item System, Version 1.0  http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=1033 (http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=1033)

This thing is containing several files which allow easy integration of an item/inventory system into new or existing modules. It contains a first basic shop, a looting module and the inventory system, which generates the necessary tables and provides the interface for activating the items.

Please note: No premade items are included by now. Before using findloot.php you have to create at least one item with "Loot" (case sensitive!) as category.

The files are:
  • lib/itemhandler.php
  • contains basic functions like "add_item()", "remove_item()", "get_random_item()" or "get_inventory()"
  • functions recognize, if you pass over the item name or the item's ID as reference
  • add_item($item, $qty, $user) -> Adds item to user's inventory. If $user is left empty, item will be added to current user's inventory. If $qty is left empty only one item will be added
  • remove_item($item, $qty, $user) -> Same as above, but removes items
  • check_qty($item, $user) -> Return the quantity of items $user possesses. If user is left empty, current user will be used...
  • get_item($item) -> Returns the item information (array).
  • get_random_item($class) -> Returns a random item (array). Current user must fulfill level and dragonkills requirements for this item. If no item is found, it returns "false".
  • get_inventory($user) -> returns the mysql-result of the users inventory. Rows still need to be fetched from this function's return value
  • shopnav($return, $class, $sell=false, $user=0) -> see basicitemshop for an example on usage... if $user is not left empty it shows the navs depending on $user's inventory... (Useful for trading between players...)
  • modules/inventory.php
  • generates links for users to see other peoples inventory
  • activates items with buffs attached to them
  • generates navs, which can activate items in battle
  • generates links, which can start other modules for scripted effects
  • modules/basicitemshop.php
  • makes use of the "shopnav()" function, which generates navs for a specific item category. E.g. this shop only buys/sells items of the "Loot"-category.
  • modules/findloot.php
  • Simple module, which will pick a valid, random item when the user is victorious on a forest or travel fight and (on a customizable chance) add this item to the victor's inventory.
  • lootitems.sql
  • Contains some basic loot items. No special effects attached though. Just grab them and sell them.
[/list]

Have fun using this... And please tell me, what can be improved, what other ideas should be built in, whatever you like!

Things to do:
  • Make an option, whether players can carry only a specific number of items, only a specific weight or a limitless amount (and display such information via charstats)
  • make items droppable
  • Create a system where players can trade items (only items!)


Title: Re: Item system
Post by: Dannic on May 19, 2005, 09:16:17 PM
can you define the max number of items a person can carry?  Or max weight?  Can you define weight of the items or cumbersomeness?  How about dropping items?  Sticking items in a back pack through the backpack hook?

This is a great idea.  Looking forward to its continued support and development.


Title: Re: Item system
Post by: XChrisX on May 19, 2005, 09:33:48 PM
Updated to do list for this mod.

which backpack-hook do you think of, Dannic?


Title: Re: Item system
Post by: Dannic on May 19, 2005, 09:43:36 PM
The only one I know of is modulehook("backpack").  

Of course I haven't looked at webpixies backpack to see if it has any others that mine doesn't have but that's the same in both of our backpack modules.  Least I think it is.

btw... did you fix the location setting?


Title: Re: Item system
Post by: XChrisX on May 19, 2005, 09:55:42 PM
Now, that you mention it... Yes, also fixed some typos concerning translation issues...

Writing modules not translation ready and then cenverting them to translation readiness AND another language is... a source for possible mistakes...  :P


Title: Re: Item system
Post by: XChrisX on May 19, 2005, 10:03:54 PM
Of course I haven't looked at webpixies backpack to see if it has any others that mine doesn't have but that's the same in both of our backpack modules.
As far as I have seen, WebPixies module uses the existing prefs of other modules to display the amount of items you carry...

This here is totally dynamic and does use its own table for inventory... I'm not sure, if this is compatible...


Title: Re: Item system
Post by: Dannic on May 20, 2005, 07:51:14 AM
would you mind if I wrote a little something and sent it to you to add?


Title: Re: Item system
Post by: XChrisX on May 20, 2005, 08:06:53 AM
No, I definately don't mind...

Any suggestions for loot items are also welcome... :)


Title: Re: Item system
Post by: XChrisX on May 21, 2005, 09:47:34 AM
Updated findloot.php and inventory.php to support weight limits and count limits...

Admins can now configure the maximum amount of items players can carry and the maximum weight they can bear. Both can be turned off by setting these values to 0.

As well as that, users can now drop their items (instead of selling them...) via their inventory. Fur this the itemhandler.php had to be updated, too.
Items can be set up to be "undroppable" to prevent users from throwing away quest items or other important things they might need...

I'm still working on the charstat display. This will come in soon ;D

Any further suggestions (and help) is always welcome!


Title: Re: Item system
Post by: sixf00t4 on June 07, 2005, 02:54:18 AM
how about a sql dump of some items to get our creative engines started.  :)


Title: Re: Item system
Post by: XChrisX on June 07, 2005, 02:58:33 AM
I will post some loot items alongwith an update soon...

SQL dumping of items might be a problem as soon as theres a buff attached to the item... I haven't found a way around this yet... :(

Give me a little time to translate our items to english! :)


Title: Re: Item system
Post by: enderwiggin on June 07, 2005, 09:26:09 PM
How about a trading system?

You might get furs from one kill, meat from another, etc.

One city might be buying furs at one price, and another city might be buying them cheaper.

Hopping from one city to another you might make money from trading.


Title: Re: Item system
Post by: sixf00t4 on June 08, 2005, 02:19:58 AM
How about a trading system?

You might get furs from one kill, meat from another, etc.

One city might be buying furs at one price, and another city might be buying them cheaper.

Hopping from one city to another you might make money from trading.

sounds more like another module.  also, sounds like the alternate currencies/trading modules from Lonny.


Title: Re: Item system
Post by: XChrisX on June 08, 2005, 02:40:14 AM
I'm planning a module where players can trade items with each other, but that'll have to wait a little for now...
But Shops, that sell and buy items at different prices? Like sixfoot said, sounds a bit like Lonnyl's module...


Title: Re: Item system
Post by: XChrisX on June 09, 2005, 08:45:39 AM
Okay... Finally I made it... ;)

Updated the file! Please redownload it as some bugfixes had to be made!

Items did not really get lost on a dragonkill and if they did, only one was lost (and never more than one!)

The new file also contains some basic loot items now. Most of them get lost on a dragonkill but three might have a chance to stay.

http://dragonprime.net/users/XChrisX/itemsystem.zip


Title: Re: Item system
Post by: Psychotic_Carp on June 10, 2005, 06:38:21 PM
i started installing and setting it up, found this (yes i know is small)

How many items canbe carried by user?

just though you might want to correct it

there are also some translation problems still. What are the catagories?
I added a "clothing" cat. but it does not show in the shop.


Title: Re: Item system
Post by: Psychotic_Carp on June 10, 2005, 08:14:27 PM
I have made some edits (English) like "The Loiterer" has been replaced with "The Shop" or "Shop owner" as well as most of the navigation but i have no idea where "Kaufe Loot" is coming from (go to the shop and chose to buy something it will be above the list) I still have no idea on how to get other cat.'s to show :(

I also changes the module edit list name to "Xtem Edit" so my "settings" "I" quick key would not be lost

http://www.foreverbroken.org/files/editeditem.zip


*edit* found it in the itemhandeler.php


Title: Re: Item system
Post by: XChrisX on June 11, 2005, 01:16:56 AM
You don't have to change the files (Xtem Editor...)!
Simply use the translator and translate "Item Editor" to "X?Item Editor" and the x will be the hotkey ;)

(I'll consider doing this in the code...) As for the new "clothing" category: The loiterer only sells and buys items from the "Loot" - Class.

Simply take the basicitemshop.php and change the "shopnav()" functions to "Clothing" and rename the file to "tailor.php" ;D


Title: Re: Item system
Post by: Psychotic_Carp on June 11, 2005, 06:59:04 AM
Thankyou sir. Is there a way to trade items right now?


Title: Re: Item system
Post by: XChrisX on June 11, 2005, 07:23:42 AM
between players? Unforntunately not yet...

My version is stuck due to other responsibilities... If anyone would like to take in this...

BTW: Updated the file "itemhandler.php" to now be completely emglish... (I hope) and the item editor now uses "X" as hotkey...


Title: Re: Item system
Post by: Eliwood on June 12, 2005, 02:35:50 AM
When i made a Item with de Category "Loot" and i uses this in a Fight, then I come back to the forest...


Title: Re: Item system
Post by: XChrisX on June 12, 2005, 03:47:12 AM
can you give me the sql-export for the buff and the item?


Title: Re: Item system
Post by: Eliwood on June 12, 2005, 04:11:43 AM
The Item:
Code:
INSERT INTO `item` VALUES (1, 'Loot', '`4Fackel der Unterwelt', 'Eine Fackel aus der Unterwelt, von Ramius gesegnet.', 0, 0, 0, 1, 0, 0, 1, '', 0, '', '16', 20, 20, 60);
The Buff:
Code:
INSERT INTO `itembuffs` VALUES (1, '`4Glut der Verdammnis', '`4Glut der Verdammnis', 100, 0, 2, 0.9, 1.4, 1, 0.6, 0.6, 0, 0, 0, 2, 3, 0, 3, 0, '', '', '', '', 0, 0, 0);

And i dont can made Infinitive Buffs, when i tipe in the rounds -1, the Buff has the value 0...


Title: Re: Item system
Post by: XChrisX on June 12, 2005, 04:36:52 AM
Okay... found the bug!

I had to rewrite the fightnav-specialty part, as it checked if forest.php was part of the return-link and thus ended the fight by redirecting the player to forest.php.

This behaviour was needed to make it work when fighting normally, but got corrupted during forest fights!

I uploaded the (hopefully) correct working file...

As for infinite buffs, go to phpmyadmin and change the field   properties for "rounds" in 'itembuffs' from "UNSIGNED" to "SIGNED"...

I'll change the table description in the meantime.


Title: Re: Item system
Post by: Eliwood on June 12, 2005, 04:53:56 AM
In the Item-Editor, the Buttons don't have the Attribut class='button', it isn't a Bug, i know, but without this, the Editor looks a little bit strange...


Title: Re: Item system
Post by: XChrisX on June 12, 2005, 07:03:20 AM
Okay... with the next update I'll add this to the code... :)


Title: Re: Item system
Post by: Psychotic_Carp on June 14, 2005, 11:59:32 PM
I cant seem to get the "buffs" part of this to work. I can addd them but there is no way to "activate" them


Title: Re: Item system
Post by: XChrisX on June 15, 2005, 12:17:39 AM
When you created a buff, you have to attach this buff to an item.

Go to the item which you want to "carry" this buff.

There should be a dropdown list with the names of all buffs listed...

Now, to activate the buff you need to make the item available somewhere.

There are 6 hooks, where this can happen:
"newday" -> items with this hook automatically activate their buff on newday and are removed then.
"forest" -> makes the items availabe in the forest (just where you choose between fighting or healing)
"fightnav" -> like specialties...
"shades" -> item can be activated while dead (good for resurrection thingies...)
"village" -> activate them on the village square...
"dragonkill" -> This one is not yet active (but already reserved...) because I couldn't think of anything usefull to activate here (and how to carry it over the dragonkill...)


Title: Re: Item system
Post by: Psychotic_Carp on June 15, 2005, 07:24:12 AM
Ok I thin its there now. It may have been activating before i wanted it too :(

there are still some translations that need to be done

Gegenstnde and Loiterer


Title: Re: Item system
Post by: Psychotic_Carp on June 15, 2005, 07:57:23 AM
Tried to make a healing potion this is what i get when i try to use it

Code:
Fatal error: Maximum execution time of 30 seconds exceeded in /home/rem/public_html/lotgd/lib/bell_rand.php on line 24

Item
Code:
INSERT INTO `lotgd_item` VALUES (17, 'Loot', 'Potion: Healing - Medium', 'This Potion Will Regenerate 50 Hit Points.', 200, 1, 10, 1, 1, 0, 4, '', 0, '', '16', 25, 90, 100);

Buff
Code:
INSERT INTO `lotgd_itembuffs` VALUES (4, 'Healing', 'Healing', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 'You Regenerate', 'You do not regenerate.', 'Nothing Regenerates.', 'You Regenerate', 0, 0, 1);


Title: Re: Item system
Post by: Psychotic_Carp on June 16, 2005, 12:18:40 PM
Apparently setting all the modifiers to 0 will cause the above

Inventar needs to be changed


Title: Re: Item system
Post by: XChrisX on June 16, 2005, 12:34:29 PM
Well this is not really a fault of the system, but a fault of the person which creates the buff...

Buffs are quite complex things and not all combinations will lead to a fully functioning code.

Setting modifiers to zero is done only once in the whole core (for the 4th dark arts specialty use) and should therefore only be applied to very mighty items.

I cannot think of a system, which would check, if a buff ist working...

If you do this in the mount editor, your system will break as well...


Title: Re: Item system
Post by: SpRouCyT on July 11, 2005, 03:36:47 PM
Code:
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unclosed quote @ 1692
STR: `
SQL: --
-- Data for table `item`
--

INSERT INTO `item` (`class`, `name`, `description`, `gold`, `gems`, `weight`, `droppable`, `level`, `dragonkills`, `buffid`, `link`, `hide`, `customvalue`, `activationhook`, `findchance`, `loosechance`, `dkloosechance`) VALUES
('Loot', 'Rusty Knife', 'A small, rusty knife which appears to still carry some stains of dried blood.', 10, 0, 0, 1, 0, 0, 0, '', 0, '', '', 100, 25, 99),
('Loot', 'Gauntlet', 'A light, damaged gauntlet.`n\r\nIt seems it belonged to a larger piece of armor before.', 230, 0, 0, 1, 3, 2, 0, '', 0, '', '', 80, 80, 100),
('Loot', 'Small Leatherbag', 'A small bag made from black leather.`n\r\nSome coins still ring in it.', 50, 0, 0, 1, 1, 0, 0, '', 0, '', '', 75, 50, 99),
('Loot', 'Necklace', 'A seemingly worthless necklace with strange symbols engraved on its front.', 20, 0, 0, 1, 1, 0, 0, '', 0, '', '', 100, 80, 99),
('Loot', 'Quiver', 'An old quiver with a good dozen of mostly broken arrows.`n\r\nSuch a fine piece of work so shattered...', 380, 0, 0, 1, 1, 0, 0, '', 0, '', '', 100, 100, 100),
('Loot', 'Stone', 'Small, round, grey, heavy...`n\r\nNot really interesting.', 3, 0, 0, 1, 1, 0, 0, '', 0, '', '0', 100, 100, 100),
('Loot', 'Potshard', 'A small potshard. YOu recognize some mysterious runes painted on it.', 80, 0, 0, 1, 1, 0, 0, '', 0, '', '', 100, 100, 100),
('Loot', 'Gammon', 'Approximately one pound of gammon, wrapped in fatty paper. Perhaps not the best, but it'll keep you from starving.', 140, 0, 0, 1, 1, 0, 0, '', 0, '', '', 100, 100, 100),
('Loot', 'Runestone', 'A very heavy and almost totally black stone with some notches at one side. Perfectly oval and exactly the size to carry it in one hand.`n\r\nThe perfect circle gracing its front seems to shine in light purple.', 800, 3, 250, 0, 10, 10, 0, '', 0, '', '0', 35, 90, 100);
       

SQL query:

-- -- Data for table `item` -- INSERT INTO `item` (`class`, `name`, `description`, `gold`, `gems`, `weight`, `droppable`, `level`, `dragonkills`, `buffid`, `link`, `hide`, `customvalue`, `activationhook`, `findchance`, `loosechance`, `dkloosechance`) VALUES ('Loot', 'Rusty Knife', 'A small, rusty knife which appears to still carry some stains of dried blood.', 10, 0, 0, 1, 0, 0, 0, '', 0, '', '', 100, 25, 99), ('Loot', 'Gauntlet', 'A light, damaged gauntlet.`n\r\nIt seems it belonged to a larger piece of armor before.', 230, 0, 0, 1, 3, 2, 0, '', 0, '', '', 80, 80, 100), ('Loot', 'Small Leatherbag', 'A small bag made from black leather.`n\r\nSome coins still ring in it.', 50, 0, 0, 1, 1, 0, 0, '', 0, '', '', 75, 50, 99), ('Loot', 'Necklace', 'A seemingly worthless necklace with strange symbols engraved on its front.', 20, 0, 0, 1, 1, 0, 0, '', 0, '', '', 100, 80, 99), ('Loot', 'Quiver', 'An old quiver with a good dozen of mostly broken arrows.`n\r\nSuch a fine piece of work so shattered...', 380, 0, 0, 1, 1, 0, 0, '', 0, '', '', 100, 100, 100), ('Loot', 'Stone', 'Small, round, grey, heavy...`n\r\nNot really interesting.', 3, 0, 0, 1, 1, 0, 0, '', 0, '', '0', 100, 100, 100), ('Loot', 'Potshard', 'A small potshard. YOu recognize some mysterious runes painted on it.', 80, 0, 0, 1, 1, 0, 0, '', 0, '', '', 100, 100, 100), ('Loot', 'Gammon', 'Approximately one pound of gammon, wrapped in fatty paper. Perhaps not the best, but it'll keep you from starving.', 140, 0, 0, 1, 1, 0, 0, '', 0, '', '', 100, 100, 100), ('Loot', 'Runestone', 'A very heavy and almost totally black stone with some notches at one side. Perfectly oval and exactly the size to carry it in one hand.`n\r\nThe perfect circle gracing its front seems to shine in light purple.', 800, 3, 250, 0, 10, 10, 0, '', 0, '', '0', 35, 90, 100);

MySQL said: Documentation
#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'll keep you from starving.', 140, 0, 0, 1, 1, 0, 0, '', 0, '',
[ Back ]

i install, but when i try to run sql, ERROR

here i have a table intem and items

help  me


Title: Re: Item system
Post by: Sichae on July 11, 2005, 03:41:51 PM
Chris, you need your addslashes in there. :P Otherwise, the inserting of the field ends prematurely. :)


Title: Re: Item system
Post by: SpRouCyT on July 11, 2005, 04:49:36 PM
Chris, you need your addslashes in there. :P Otherwise, the inserting of the field ends prematurely. :)

sory but i didnt undertood


Title: Re: Item system
Post by: XChrisX on July 11, 2005, 09:31:15 PM
Chris, you need your addslashes in there. :P Otherwise, the inserting of the field ends prematurely. :)

;D Yes, well... ***** englisch with it's apostrophees... *waaah* There! Again! *g*

I'll check the SQL file...


Title: Re: Item system
Post by: SpRouCyT on July 12, 2005, 09:37:54 AM
;D Yes, well... ***** englisch with it's apostrophees... *waaah* There! Again! *g*

I'll check the SQL file...

to install the nodule, i need to rum SQL?  i.m wanting, tanks a lot, its a good mod


Title: Re: Item system
Post by: SpRouCyT on July 13, 2005, 09:41:45 AM
...

i need this moduel, help please


Title: Re: Item system
Post by: XChrisX on July 14, 2005, 08:03:43 AM
Updated the System... same Link.

Fixed some bugs and (THANKS to DaveS) some spelling mistakes!

One known bug: If you create an invalid buff, the fights will hang up in an endless loop.

Accidently removed the items.sql for some basic items...  :o

If anybody has this (broken) file, please send it to me!
Thanks!


Title: Re: Item system
Post by: SpRouCyT on July 15, 2005, 04:39:11 PM
do you want the OLD file??? i have

how can i send to you?

ad my msn and i send to you :)

sproucyt@hotmail.com

tanks for fixed


Title: Re: Item system
Post by: SpRouCyT on July 16, 2005, 12:16:04 PM
is it?


Title: Re: Item system
Post by: Brother Dave Thompson on August 17, 2005, 02:05:17 AM
One known bug: If you create an invalid buff, the fights will hang up in an endless loop.

Can you give us an example of a valid buff? All I want is a simple healing item, and I can't get one to work.


Title: Re: Item system
Post by: Eliwood on August 17, 2005, 08:59:25 AM
INSERT INTO `itembuffs` VALUES (1, 'Healing Level 1', 'Healing', 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 25, 1, 0, 0, 0, 0, '`#You regenerate!', '', '', '', 0, 0, 0);

(Its healing 25 points)


Title: Re: Item system
Post by: XChrisX on November 20, 2005, 05:31:06 AM
So, it's been a long while since the last update...

And since then a lot has changed.
It's not the appearance of the module... But the module has been streamlined to work faster and use the data caching feature.
So it should work faster - especially on larger servers.
Also some minor bugs have been fixed.

Re-Download at http://dragonprime.net/users/XChrisX/itemsystem.zip


Title: Re: Item system
Post by: Dannic on November 20, 2005, 12:07:23 PM
I've probably installed this incorrectly somehow.  But I am getting this.

Code:
SELECT item.itemid AS itemid, item.name AS name, COUNT(inventory.itemid) AS quantity, inventory.sellvaluegold AS sellvaluegold, inventory.sellvaluegems AS sellvaluegems
               FROM inventory
               INNER JOIN item ON item.itemid = inventory.itemid
               WHERE inventory.userid = 1
                  AND item.class = 'Loot'
                  AND item.sellable <> 0
               GROUP BY item.itemid
               ORDER BY
                  item.class ASC,
                  item.name ASC

Unknown column 'inventory.sellvaluegold' in 'field list'
Call Stack:
1: db_query("SELECT item.itemid AS ite...") called from /logd/lib/itemhandler.php on line 430
2: shopnav("runmodule.php?module=basi...", "Loot", true, "1", true) called from /logd/modules/basicitemshop.php on line 112
3: basicitemshop_run() called from /logd/runmodule.php on line 32


Title: Re: Item system
Post by: XChrisX on November 20, 2005, 12:10:06 PM
Ahhh... Yes... This requires a newer mysql version...

I would try to create a check so it doesn't make use of subqueries...


Title: Re: Item system
Post by: Dannic on November 20, 2005, 12:16:27 PM
well actually, the column doesn't exist.  the install doesn't appear to take into account older versions of this and update the tables to include the new fields.  I also have a problem with this.

Code:
INSERT INTO inventory (`userid`, `itemid`, `sellvaluegold`, `sellvaluegems`, `specialvalue`, `charges`) VALUES (1, 2, 20, 0, '', '1')

Unknown column 'charges' in 'field list'
Call Stack:
1: db_query("INSERT INTO inventory (`u...") called from /logd/lib/itemhandler.php on line 170
2: add_item_by_id(2, 1, 0, "", false, false) called from /logd/lib/itemhandler.php on line 182
3: add_item(2) called from /logd/modules/inventory/run/case_editor.php on line 213
4: require_once("/home/orpgsco/public_html...") called from /logd/modules/inventory.php on line 53
5: inventory_run() called from /home/orpgsco/public_html/logd/runmodule.php on line 32

I didn't bother looking at the code until after I got it twice.  The module doesn't delete the tables on an uninstall so when I thought I had uninstalled it the tables hadn't actually disappeared.  So they were never created new or updated.


Title: Re: Item system
Post by: Derek on November 20, 2005, 02:25:29 PM
I have some neat ideas for addons to this module, but I am too lazy to make them...Maybe over thanksgiving break...


Title: Re: Item system
Post by: XChrisX on December 21, 2005, 12:58:12 PM
Okay... This one was a major update...
  • The installer now uses the tabledescriptor code -> No problems with missing fields any more. :)
  • The itemhandler has been reworked! inject_item() is now a fine piece of artificial intelligence! :) It will automatically update an existing item and so prevent duplicate entries. It will also only update fields which have  really changed. In fact it works quite similar to the table descriptor code. (I also added some kind of documentation to this function...)
  • It's now also easier to get buff information. And the new function get_buff() will automatically turn non-working buffs into working buffs. Some buff configuration might have caused messages to appear where they should not, some caused infinite loops. This has been solved.
  • buffs now fully work like in the mount editor. No restrictions on the usage of <level>, <maxhitpoints> or <module|pref>.
  • The function to display the navs for activating items now works a lot faster and better.
  • Several other, smaller bugs have been solved.

As usual, download your copy for free at The Item System! (http://dragonprime.net/users/XChrisX/inventory.zip)


Title: Re: Item system
Post by: XChrisX on December 21, 2005, 01:06:48 PM
Edited the above post... ;)


Title: Re: Item system
Post by: XChrisX on January 26, 2006, 01:53:32 PM
Item System, Version 2.0  http://www.dragonprime.net/users/XChrisX/itemsystem.zip (http://www.dragonprime.net/users/XChrisX/itemsystem.zip)

Finally it is done! v2 of my itemsystem is ready for release. This is now featuring several new features as there are:
  • Fully working (but still ugly) backpack, which can be opened in a seperate window. (Turned OFF by default!)
  • Here you will also see, that items can now be equipped. Yes, you read right! They can be equipped. This on its own, wouldn't have any benefit...
  • But items can now hold objprefs! This allows some great stuff: inv_statvalues.php shows an example for this. Just make an item equippable, add some attack values to it and equip and unequip them to see your attack values go up and down :)
  • Items can be activated from the inventory. This becomes very nice with the following new feature:
  • Items can now alter almost EVERY value of your account!
For this, just use the new field: 'execvalue'
Just an example: You want a healing potion? okay! Enter '$hitpoints = 15;' in this field and upon activation the user will regenerate 15 hitpoints!
You want to increase their attack? '$attack=1;' will do this for you!
Multiple effects? '$gems=1;$gold=100;$experience=1000;$defense=-2;' will do all this!
You want to exhaust your players? They should lose all their turns? '$turns = -$session[user][turns];' is your friend...
Ever dreamt of a sure way to escape a forest fight? 'redirect("forest.php");' is what you need to enter...
Do everything with this great addition! Add or strip buffs... Alter buffs... Increment specialties... Add uses to various specialties... Strip *all* uses with a single command. All this is now possible.
  • Never has an item system before so customizable!!! :)
  • You will also recognize that the item editor now is far more comforable by using the showform feature.

Should you find any bugs or have any ideas, please let me know!


Title: Re: Item system
Post by: seretogis on January 26, 2006, 02:28:44 PM
On line 79 of inventory/install.php there is a mention of an "itembuffs" table when it should be"$itembuffs" with a $.


Title: Re: Item system
Post by: Eth on January 26, 2006, 02:30:15 PM
*blinks*

Wow.

Stupendous job, Chris. I'll be taking this puppy for a spin later on.


Title: Re: Item system
Post by: seretogis on January 26, 2006, 03:10:28 PM
*blinks*

Wow.

Stupendous job, Chris. I'll be taking this puppy for a spin later on.

Yeah, I hope to use it for a variety of short-duration consumables.  Having some issues getting things to work immediately but hopefully will figure it out soon. :)


Title: Re: Item system
Post by: XChrisX on January 26, 2006, 09:32:55 PM
It's very handy to quickly throw out potions, spells, food and such stuff...

Potions could either hold a buff (via the old buffid field), they could hold *TWO* buffs (one via buffid, one via the execvalue flag $buff) or if you enter 'real' lotgd code into the execvalue, you can even use them as the only way to enter a 'Realm of Drems' (for example...)

You *can* use page_header(), output(), addnav() and page_footer() within the execvalue an thus create a page within your game, that's only accessable via an item... (It's a bit of work... ;) )

EDIT: PLEASE RE-DOWNLOAD THIS FILE... Old one contained some files which did belong to the v1 of the itemsystem.

Sorry for the inconvenience.


Title: Re: Item system
Post by: seretogis on January 27, 2006, 08:04:14 PM
I'm trying to make a basic +20 hitpoint heal potion and am having a few issues:

First, I'm not finding any "execvalue" field in the item editor -- I see a "custom value" textbox but putting $hitpoints += 20; or $hitpoints = 20; in there doesn't seem to do anything when I activate.

So, I figured I would try just to add a buff instead that has 10 in the regen field and lasts for 2 rounds but when I attempt to use it I get a 90 sec timeout and have to go to the admin and grant myself a new-day. :(

Is there a new version that isn't in your shared folder, or am I missing something obvious?  (I just downloaded and reinstalled the version you put up today, before I posted this.)


Title: Re: Item system
Post by: XChrisX on January 28, 2006, 12:16:01 AM
EDIT: PLEASE RE-DOWNLOAD THIS FILE... Old one contained some files which did belong to the v1 of the itemsystem.

Sorry for the inconvenience.

Redownload an reinstall the inventory.php... That should remove those errors.


Title: Re: Item system
Post by: seretogis on January 28, 2006, 07:34:29 AM
Redownload an reinstall the inventory.php... That should remove those errors.

Yeah, I reinstalled it -- version 1.7 according to the listing in the module manager -- but still have the abovementioned issues.


Title: Re: Item system
Post by: XChrisX on January 28, 2006, 09:42:12 AM
Yes, and the current version is 2.0 ... That's why you need to re-download the module :)


Title: Re: Item system
Post by: seretogis on January 28, 2006, 02:45:19 PM
Yes, and the current version is 2.0 ... That's why you need to re-download the module :)

I've re-downloaded it several times, but I'm unable to find 2.0 anywhere.

The file is still located at http://www.dragonprime.net/users/XChrisX/itemsystem.zip correct?

I just downloaded from the above URL again and upon opening up inventory.php I see:
Quote
function inventory_getmoduleinfo(){
   $info = array(
      "name"=>"Inventory Basic System",
      "version"=>"1.07",

Also, every version I've downloaded from the above url has had the "$sql = "ALTER TABLE `itembuffs`" bug which I mentioned a few posts up.

EDIT: Whoa -- very odd.  Just for the hell of it I went to your shared directory and snagged it from that file listing and got 2.0.  The URL for that file is: http://dragonprime.net/users/XChrisX/itemsystem.zip

Using the "www.dragonprime.net" link above instead gives me the old version.  Very unusual.  I'm not sure if that is a dragonprime server issue or if Firefox is somehow at fault.


Title: Re: Item system
Post by: XChrisX on January 28, 2006, 11:50:57 PM
I think it might be, that your browser stored the information about link/file combination and "downloaded" the old file from its cache.

Now you should see the execvalue field in the editor. Just enter "$hitpoints = 20;" there and you have an item which restores 20 hitpoints.
It will only restore up to your maxhitpoints hitpoints. If you want to have more than your maxhitpoints, just add the following to your execvalue: "$override_maxhitpoints = true;" This will simply add 20 hitpoints instead of calculating how much really may be restored.


Title: Re: Item system
Post by: seretogis on February 02, 2006, 05:16:33 PM
I'm getting reports from users that a non-unique "potion of forest affinity" (+1 turns and a small 5 round atk/def buff) will fail to disappear if you have multiple ones "stored up" before using them.

Here's a snippet from the debug log of the user that reported this to me.

Quote
(0.00) 12:59:04 (7h16m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:59:01 (7h16m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:58:56 (7h17m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:58:40 (7h17m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:58:05 (7h17m) - Gladiator Parabola removed item 6 from inventory \-- Recipient = Gladiator Parabola
(0.00) 12:57:59 (7h18m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:57:53 (7h18m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:57:41 (7h18m) - Gladiator Parabola has gained 1 items (ID: 5).
(0.00) 12:57:05 (7h18m) - Gladiator Parabola relinquished 2 gems to pay off Lonestrider's thieves
(0.00) 12:56:58 (7h19m) - Gladiator Parabola found a gem when slaying a monster, for being a Felyne.
(0.00) 12:56:41 (7h19m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:56:37 (7h19m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:56:33 (7h19m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:56:29 (7h19m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:56:24 (7h19m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:56:20 (7h19m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:56:16 (7h19m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:56:09 (7h19m) - Gladiator Parabola 's turns were altered by 1 by item 5.
(0.00) 12:55:04 (7h20m) - Gladiator Parabola 's turns were altered by 1 by item 5.


Title: Re: Item system
Post by: XChrisX on February 02, 2006, 11:48:14 PM
Can you export the SQL values for the buff and the item so I can test them on my server?


Title: Re: Item system
Post by: Nai on February 05, 2006, 02:34:08 PM
help me :(

SELECT gm_item.*,
                  SUM(if (gm_inventory.charges > 1, gm_inventory.charges, 1)) AS quantity
               FROM gm_item
               INNER JOIN gm_inventory ON gm_item.itemid = gm_inventory.itemid
               WHERE (gm_item.activationhook & 4)
                  AND inventory.userid = 1
               GROUP BY gm_item.itemid
Unknown table 'inventory' in where clause .stacktrace { background-color: #FFFFFF; color: #000000; } .stacktrace .function { color: #0000FF; } .stacktrace .number { color: #FF0000; } .stacktrace .string { color: #009900; } .stacktrace .bool { color: #000099; font-weight: bold; } .stacktrace .null { color: #999999; font-weight: bold; } .stacktrace .object { color: #009999; font-weight: bold; } .stacktrace .array { color: #990099; } .stacktrace .unknown { color: #669900; font-weight: bold; } .stacktrace blockquote { padding-top: 0px; padding-bottom: 0px; margin-top: 0px; margin-bottom: 0px; }
Call Stack:
1: db_query("SELECT gm_item.*, ...") called from /home/mika/public_html/lib/itemhandler.php on line 93
2: display_item_nav("village") called from /home/mika/public_html/modules/inventory/dohook/hook_village.php on line 8
3: require("/home/mika/public_html/mo...") called from /home/mika/public_html/modules/inventory.php on line 42
4: inventory_dohook("village", Array(
"text"=>Array(
0=>"`Q`b`c%s, the Capital Cit...", 1=>"Degolburg", 2=>"Degolburg"
), "clock"=>"`n`QThe clock on the inn ...", "title"=>Array(
0=>"%s, the Capital City", 1=>"Degolburg"
), "talk"=>"`n`%`@Nearby some village...", "sayline"=>"says", "newest"=>"`n`2Wandering near the in...", "newestplayer"=>"", "newestid"=>"14", "gatenav"=>"City Gates", "fightnav"=>"Combat Avenue", "marketnav"=>"Store Street", "tavernnav"=>"Ale Alley", "infonav"=>"Info", "othernav"=>"Other", "section"=>"village", "innname"=>"The Boar's Head Inn", "stablename"=>"Merick's Stables", "schemas"=>Array(
"text"=>"module-cities", "clock"=>"module-cities", "title"=>"module-cities", "talk"=>"village", "sayline"=>"village", "newest"=>"village", "newestplayer"=>"module-cities", "newestid"=>"village", "gatenav"=>"village", "fightnav"=>"module-cities", "marketnav"=>"module-cities", "tavernnav"=>"module-cities", "infonav"=>"village", "othernav"=>"village", "section"=>"village", "innname"=>"village", "stablename"=>"village", "calendar"=>"module-cities"
), "calendar"=>"`n`QYou hear a townsperso...", "doaudrey"=>false
)) called from /home/mika/public_html/lib/modules.php on line 508
5: modulehook("village", Array(
"text"=>Array(
0=>"`Q`b`c%s, the Capital Cit...", 1=>"Degolburg", 2=>"Degolburg"
), "clock"=>"`n`QThe clock on the inn ...", "title"=>Array(
0=>"%s, the Capital City", 1=>"Degolburg"
), "talk"=>"`n`%`@Nearby some village...", "sayline"=>"says", "newest"=>"`n`2Wandering near the in...", "newestplayer"=>"", "newestid"=>"14", "gatenav"=>"City Gates", "fightnav"=>"Combat Avenue", "marketnav"=>"Store Street", "tavernnav"=>"Ale Alley", "infonav"=>"Info", "othernav"=>"Other", "section"=>"village", "innname"=>"The Boar's Head Inn", "stablename"=>"Merick's Stables", "schemas"=>Array(
"text"=>"module-cities", "clock"=>"module-cities", "title"=>"module-cities", "talk"=>"village", "sayline"=>"village", "newest"=>"village", "newestplayer"=>"module-cities", "newestid"=>"village", "gatenav"=>"village", "fightnav"=>"module-cities", "marketnav"=>"module-cities", "tavernnav"=>"module-cities", "infonav"=>"village", "othernav"=>"village", "section"=>"village", "innname"=>"village", "stablename"=>"village", "calendar"=>"module-cities"
), "calendar"=>"`n`QYou hear a townsperso..."
)) called from /home/mika/public_html/village.php on line 266


Title: Re: Item system
Post by: kickme on February 05, 2006, 03:55:07 PM
In lib/itemhandler.php, add a $ in front of inventory.userid on line 91


Title: Re: Item system
Post by: Nai on February 05, 2006, 04:40:16 PM
yay like omg, how did i miss that lol, thnx a lot


Title: Re: Item system
Post by: XChrisX on February 05, 2006, 10:00:09 PM
yay like omg, how did i miss that lol, thnx a lot
No, you didn't miss it... I did... :(


Title: Re: Item system
Post by: Nai on February 06, 2006, 11:24:33 AM
yay that makes me feel better :) there might be something else missing too... something about syntax

INSERT INTO gm_inventory (`userid`, `itemid`, `sellvaluegold`, `sellvaluegems`, `specialvalue`, `charges`) VALUES
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Call Stack:
1: db_query("INSERT INTO gm_inventory ...") called from /home/mika/public_html/lib/itemhandler.php on line 232
2: add_item_by_id(3, false, 0, "", false, false) called from /home/mika/public_html/lib/itemhandler.php on line 243
3: add_item(3, false) called from /home/mika/public_html/modules/basicitemshop.php on line 98
4: basicitemshop_run() called from /home/mika/public_html/runmodule.php on line 32

thats when u try to buy something


Title: Re: Item system
Post by: XChrisX on February 06, 2006, 11:40:38 AM
In line 184 of the itemhandler.php add
Code:
if ($qty < 1) return false;

This only happens, if you try to buy 0 or less items.


Title: Re: Item system
Post by: Nai on February 08, 2006, 04:23:36 PM
still get an error, i think i missed up how it goes in, this is line 184
   $sql = "SELECT COUNT($inventory.itemid) AS totalcount, $item.weight AS totalweight
            FROM $inventory if ($qty < 1) return false;
            INNER JOIN $item ON $item.itemid = $inventory.itemid
            WHERE $inventory.userid = $user
            GROUP BY $inventory.itemid";


Title: Re: Item system
Post by: XChrisX on February 08, 2006, 09:07:25 PM
Just download the archive again (Here... (http://dragonprime.net/users/XChrisX/itemsystem.zip)).

The only files which have changed are those from the lib folder. They should correct your errors.


Title: Re: Item system
Post by: kickme on March 19, 2006, 12:02:49 AM
::tells XChris off for having an empty settings array

Quote
The inv_statvalues module does not appear to define any module settings.


Title: Re: Item system
Post by: chicu on April 03, 2006, 12:24:04 PM
  • Fully working (but still ugly) backpack, which can be opened in a
Activated the Backpack per modulsetting, but there ins't anywhere a nav to the backback
(Not even in the Charstats, lke its written in the module)

Sry if i did something wrong or if i didn't write english well


Title: Re: Item system
Post by: Nightborn on April 03, 2006, 12:34:41 PM
I heard there will be an update soon for this system =)

it also interferred with my forestmod.


Title: Re: Item system
Post by: chicu on April 13, 2006, 06:14:41 AM
  • Fully working (but still ugly) backpack, which can be opened in a
Activated the Backpack per modulsetting, but there ins't anywhere a nav to the backback
(Not even in the Charstats, lke its written in the module)

Sry if i did something wrong or if i didn't write english well
#
This can't work without an addhook for charstats ;) 


Title: Re: Item system
Post by: Nightborn on April 13, 2006, 06:28:35 AM
^^ wait for his release ,there are more changes in there.

yet... he is not here right now on DP, so we just have to wait for him to make a move =)


Title: Re: Item system
Post by: ShadowRaven on May 21, 2006, 12:34:12 PM
I've been playing around with this on my test server and found a couple of things. I had made a ring(equipable), created it just fine, made it only available in the store to buy(not found in forest) I bought it, but there is no way to equipt it, it doesn't show in the inventory to equipt(I got the charstats popup to work). (I had made a crown ealier and it showed under 'Armor' and was able to equipt that just fine). Also When I sold the crown, I still had it equiped and the att, def and HP did not get removed when I sold it. So, one could get an item, get the stats from it, then sell and keep the stats, get another, and so on....

I know he's supposed to be making another release of this at some point, but I didn't know if these were known or not so thought I should mention them.
I love this mod, great work :D


Title: Re: Item system
Post by: Nightborn on May 21, 2006, 12:37:45 PM
^^ there are also loot problems.

he discharges an item AND deletes it afterwards.

also the current version gets in conflict with my forest mod.. if you autofight, then activate an item in the forest (not fightnav), you will fight again till the end automatically as he redirects to the last *LINK* in the header. -_-

some minor issues I fixed as I only use the loot function till now. Also there are problems in the shop.


Title: Re: Item system
Post by: ShadowRaven on May 21, 2006, 12:48:35 PM
hmm, I haven't seen any problems in the shop yet...but the forestmod problem yes, but I didn't know it was a problem til you said it was, since I didn't have any reference to how it should work, same with the discharging and deletion lo.l but then I don't plan on using the activation feature for items anyway......
Also what would be really great is some sort of intruction on or examples of what to put in some of the settings for the item creation, like execvalue, and link etc.... for the execvalue I looked where it said to look for possible values, but I still didn't see what I could put in there. ???


Title: Re: Item system
Post by: SexyCook on June 13, 2006, 10:16:07 AM
Caught a couple of bugs in itemeffects.php:


Lines 52 and following:
Quote
            } else {
                  $experience = -$killable/100;
                $out[] = "`\$You die.`n";
            }

This does absolutely nothing when I give an item "$hitpoints=-100;$killable=true;"

I've since changed it to:

Quote
            } else {
                  $session['user']['hitpoints']=0;
                  $session['user']['experience'] += -1000;
                $out[] = "`\$You die.`n";
            }
which does the job, but badly (because it's activated in the forest and people can still use the healer to escape death). Is there a "kill" command?

-----------


further, I had an item which took fights but gave charm, or at least should have. On lines 113+114

Quote
      if (isset($charm) && $charm <> 0) {
         $session['user']['charm'] += $turns;

the $turns have to be changed to $charm.

-----------

There is another bug, which I can reproduce any number of times, but haven't managed to find out in the code WHY it happens.

If while creating an item you enter under "Amount of charges the item has" a value of 1 AND have 2 items AND are in the forest when activating it, the items won't be deleted. If they're in the fightnav the items will be deleted as usual, if you only have one of the item it will also vanish.

This may be happening because of the forestmod, haven't tried disabling that mod yet.

Hope this can be corrected and I can't help for the newest version of this great module.


Title: Re: Item system
Post by: SexyCook on July 02, 2006, 08:12:21 AM
If you're in the forest and just came out of the toilett, using an item will give you a "go back" nav, which will take you back... to coming out of the john. With luck, you'll get gems and cash using this bug.

Any chances of version 2.0 coming out this month? *bambi eyes*


Title: Re: Item system
Post by: Gucky2000 on July 02, 2006, 04:09:10 PM
Is there a chance to activate the charstats link to the inventory?
I changes the setting, but it seems to have no effect to me. Anybody some hints?

greets Gucky2000


Title: Re: Item system
Post by: XChrisX on July 02, 2006, 09:03:32 PM
The charstat "thing" has been moved to a new, seperate module. It allowed a lot of bad things... :(


Title: Re: Item system
Post by: Elessa on July 02, 2006, 09:04:51 PM
The charstat "thing" has been moved to a new, seperate module. It allowed a lot of bad things... :(

where might one find this new, separate module?


Title: Re: Item system
Post by: XChrisX on July 02, 2006, 09:11:09 PM
In about 2 hours I can upload it... (I have the new files zipped up at work... ;D )


Title: Re: Item system
Post by: Gucky2000 on July 02, 2006, 10:35:56 PM
That would be Great XChrisX. I realy love this module. It makes the lotgd more realistic and fills it with more life.

There are so much possibility.

greets Gucky2000


Title: Re: Item system
Post by: XChrisX on July 02, 2006, 10:47:03 PM
Uploaded the new file (I hope it is the correct one ;D) here (http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=1033). (Category: Game Add-ons (did not find anything else really fitting...))


Title: Re: Item system
Post by: Elessa on July 02, 2006, 10:51:14 PM
Uploaded the new file (I hope it is the correct one ;D) here (http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=1033). (Category: Game Add-ons (did not find anything else really fitting...))

i wonder if talisman would hath preferred it go to the already overladen misc category with a label of "general".  if he wants it moved, i am sure he will do so.



Title: Re: Item system
Post by: XChrisX on July 02, 2006, 11:26:41 PM
OT: The misc area is overcrowded. I'm not sure if you can find a module easily there... (Also a search feature for downloads would be nice.. Or a preview of the description...)


Title: Re: Item system
Post by: Nightborn on July 03, 2006, 02:05:39 AM
=) yes, we need to sort it out.

also chris, a new category "Items" would be good. there are quite a few modules, and I plan also some modules in the future (working stack hellooo)

I also put the marriage to a seperate category.


Title: Re: Item system
Post by: XChrisX on July 03, 2006, 02:07:42 AM
If some other people would release some modules around an itemsystem, yes, it would be worth a seperate category. But when there's no other module around... ;)


Title: Re: Item system
Post by: Nightborn on July 03, 2006, 02:33:44 AM
 ::) give me 48h days....


Title: Re: Item system
Post by: Elessa on July 03, 2006, 02:36:59 AM
::) give me 48h days....

/me mutters some words in faerie and waves a hand to scatter some sparkly dust on Nightborn

there! now ye hath two days in one to accomplish everything ye wish to!  ;)


Title: Re: Item system
Post by: Gucky2000 on July 03, 2006, 04:03:47 AM
Yeah you did a great job.

I will test it on my server and perhaps I've got some ideas. The categorie loot is not my favorite one. So I try to add a Setting that could be set and make ist "foundable" at forest fights. I think i had to change the find loot module too.

greets Gucky2000


Title: Re: Item system
Post by: XChrisX on July 03, 2006, 04:06:24 AM
You may not change the files... You can simply translate "Loot" to whatever you like... Or write your own module :)
You could also make a module which has a setting which Category a found item has to have...

But there's already a setting which makes items findable...


Title: Re: Item system
Post by: Gucky2000 on July 03, 2006, 04:10:50 AM
Yes but I want to find different categories, like "Nippes und Tand" "Werkzeug" "Wertgegenstnde" and not only loot "Beute" *g*

So I hopefully could add a "hidden" category loot, which the find loot module could catch after all (and after the modifications :-) )

It makes it more comfortable in the Inventory, when the loot ist categorizied.

greetings Gucky2000


Title: Re: Item system
Post by: XChrisX on July 03, 2006, 04:54:36 AM
You can simply make a module which will choose from many diiferent types of "Loot".

Code:
$loot = get_random_item("Loot");
// get_random_item() Will return false, when no matching item is found
// and returns a proper item-array, when one is found.

could be:
Code:
$categories = array("Loot", "Strange things", "Worthless things", "Junk");
$cat = array_rand($categories);
$loot = get_random_item($cat);
// get_random_item() Will return false, when no matching item is found
// and returns a proper item-array, when one is found.

Simple two lines... ;) I will make them a setting where you can enter alls item classes in a single string, comma (semicolon) seperated...


Title: Re: Item system
Post by: Gucky2000 on July 03, 2006, 05:00:18 AM
That would be a great thing. So I don't need to modify the files and leave them as they are.
This module has a nearly endless potential and there are more ideas to them, but first I will test the module a while to get all the things that are already built in.

greetings Gucky2000


Title: Re: Item system
Post by: Gucky2000 on July 03, 2006, 06:48:29 AM
I've got a Problem, when an item is set: Is this item equippable? Yes

It is not shown in the Inventory. Is it found somewhere else?

probably everything i found that could be weared on the left hand is not shown.
So for that I wear 2 lefthanded gloves. I hopefully think thats not the way to say that I've got two left hands.  ;D

greets Gucky2000


Title: Re: Item system
Post by: XChrisX on July 03, 2006, 10:22:48 AM
Eh... The equippable part... well... ehm... you have to state where it should be worn and then the inventory_popup should give you the option to actually "wear" it...


Title: Re: Item system
Post by: Gucky2000 on July 03, 2006, 10:54:46 AM
Yes and i decided to wear the left glove at the left hand and the right glove at the right glove (for joke) but they both just dissapear in the inventory and not wearing it.

greets Gucky2000


Title: Re: Item system
Post by: Gucky2000 on July 03, 2006, 01:41:06 PM
And I found three forgotten translation in the basicitemshop.php

line 70
Code:
$gold=$item['gold'];$gems=$item['gems']?(", ".($item['gems'])." Edelsteine"):'';
line 73
Code:
$v=ceil($max/$c);$gold=$item['gold']*$v;$gems=$item['gems']?(", ".($item['gems']*$v)." Edelsteine"):'';
line 78
Code:
$gold=$item['gold']*$c;$gems=$item['gems']?(", ".($item['gems']*$c)." Edelsteine"):'';

The "Edelsteine" should be "gems". No Problem for me, because my Server runs german, but perhaps for other using this modul.

greets Gucky2000


Title: Re: Item system
Post by: SexyCook on July 03, 2006, 01:57:05 PM
Chris, you forgot:
Quote
global $session;
inside case_activate.php

My players were ignoring the
Quote
if ($session['user']['hitpoints'] > 0) {
sentence and were being sent directly to the "else"


Title: Re: Item system
Post by: Gucky2000 on July 05, 2006, 07:20:33 AM
I found in the basic item shop another german word "Stck" (It's arround the "Edelsteine" you used, i told you here some postings earlier).
I decied to made a more realistic shop then the basic one. But the module will be in german, because the grammatical settings are more difficult in this language. (Changing the sex of the shopkeeper for example)
Perhaps it might be interresting to you.

greets Gucky2000

PS: The Inventory still works not to me, its not possible to wear and unwear items, they just disapear in the inventory, still i made them not equipable, so they apear.


Title: Re: Item system
Post by: Dragon89 on July 28, 2006, 11:10:39 AM
Thanks to XChrisX for such a great module.  This is a great piece of work indeed and it just keeps getting better!  One little suggestion if I may:

In inventory.php
add under the inventory setup settings:
Code:
"allowbioview"=>"Allow other players to see inventory items in player bio?,bool|0",

In hook_bioinfo.php
Change to:
Code:
if (get_module_setting("allowbioview")==TRUE) {
global $REQUEST_URI;
addnav("Inventory");
addnav("View Inventory", "runmodule.php?module=inventory&user=".$args['acctid']."&login=".$args['login']."&return=".URLEncode($_SERVER['REQUEST_URI']));
}

I would prefer not to allow players to see each others inventory through the player bio.  Just a matter of preference I guess.



Title: Re: Item system
Post by: lincthra on August 09, 2006, 08:54:38 PM
Do the modules here need to be installed in a certain order or somewhere other than the module and module/lib directories? I'm getting the White Screen of Doom on my main village page when installing the basic system. All the others installed okay though...this happened when installing the basic system both first and last.


Title: Re: Item system
Post by: XChrisX on August 09, 2006, 09:20:41 PM
The basic system has to be installed first, then all other modules should be installed.

The white page of doom comes because of a slightly uncompatible setup of your php.ini .

Turn error reporting on there and instead of the white page you will see an error message that can help me help you.


Title: Re: Item system
Post by: lincthra on August 10, 2006, 12:11:12 AM
Ah ha. I got it figured out. I knew the module worked with Data Caching, because I read it, but I didn't realize that it -required- it.


Title: Re: Item system
Post by: XChrisX on August 10, 2006, 12:35:09 AM
Normally it should not require it... the dbwrapper will (should) simply choose the appropriate function.


Title: Re: Item system
Post by: lincthra on August 10, 2006, 02:52:05 AM
That's odd. I tried it, and it didn't work, I turned on Data Caching so I could turn on error reporting, figuring that would offer some insight as well. Figured I may as well try it again on my way through and it worked after that. Ah well, don't look a gift horse in the mouth, I guess...


Title: Re: Item system
Post by: SaucyWench on August 10, 2006, 04:04:47 AM
There is a file missing from the zip - IDIOTGUIDE.txt

People like me need it.

Actually, I wanted this to use on my non-dragon server I'm creating, but so far it doesn't seem to be any use to me. I am sure the module is probably capable of doing what I need, but I don't have the code expertise to make it so. My server has neither forest nor shops. There are rooms off the main village and players are collecting items from the rooms, to be used in the correct places to advance in experience. (As an example, you might need to find the right key for the meter box before the power can be switched on.)

Without a forest or shop there is no link anywhere for me to use or find items... I installed the basic shop to have a look and see whether I could glean much from it. Despite the fact I created an item, it is not for sale in the shop even when selected to Yes for whether it can be both bought and sold. I clicked on Take as well, and it told me I now have one, but in the shop the Loiterer tells me he doesn't see anything he might want.

"Please see the file 'lib/itemeffects.php' for possible values"

That's like telling me to open a Swahili dictionary in order to conduct a conversation. Nothing in the entire itemeffects.php file tells me what to put in the value areas.

Is there a simpler item system anywhere that you're hiding from me? All I want is one that lets me shove items in an array, without any gold value/buffs/attachments, then pull them out and automatically make pretty addnavs when I try to interact with another object, such as "View", "Use", "Eat", and magically remove it from the array when the item is used to unlock a door, and and and...

 :'(

I need a team of slaves. Hrm.


Title: Re: Item system
Post by: SexyCook on August 10, 2006, 04:08:14 AM
The Items have all to be "Loot", like the stuff that get's injected into the database. To be able to buy/sell items that are not "Loot", like the "Rooms" from aditionalrooms for the dwellings, you have to change the code from the shop, as far as I have understood the code.


Title: Re: Item system
Post by: lincthra on August 10, 2006, 10:02:20 AM
When Looking for something to kill in the forrest, I get this error.. what am I doing wrong?

PHP Warning: "inventory_dohook did not return an array in the module inventory for hook fightnav-specialties."
in C:\Program Files\xampp\htdocs\lotgd-1.1.0\lib\modules.php at 528.
Call Stack:
2: trigger_error("<b>inventory_dohook</b> d...", 512) called from C:\Program Files\xampp\htdocs\lotgd-1.1.0\lib\modules.php on line 528
3: modulehook("fightnav-specialties", Array(

    "script"=>"forest.php?"

)) called from C:\Program Files\xampp\htdocs\lotgd-1.1.0\lib\fightnav.php on line 42
4: fightnav() called from C:\Program Files\xampp\htdocs\lotgd-1.1.0\forest.php on line 200
PHP Warning: "Missing argument 2 for display_item_fightnav()"
in C:\Program Files\xampp\htdocs\lotgd-1.1.0\lib\itemhandler.php at 59.
Call Stack:
2: display_item_fightnav() called from C:\Program Files\xampp\htdocs\lotgd-1.1.0\lib\itemhandler.php on line 59
3: display_item_fightnav(Array(

    "script"=>"forest.php?"

)) called from C:\Program Files\xampp\htdocs\lotgd-1.1.0\modules\inventory\dohook\hook_fightnav-specialties.php on line 8
4: require("C:\Program Files\xampp\ht...") called from C:\Program Files\xampp\htdocs\lotgd-1.1.0\modules\inventory.php on line 42
5: inventory_dohook("fightnav-specialties", Array(

    "script"=>"forest.php?"

)) called from C:\Program Files\xampp\htdocs\lotgd-1.1.0\lib\modules.php on line 512
6: modulehook("fightnav-specialties", Array(

    "script"=>"forest.php?"

)) called from C:\Program Files\xampp\htdocs\lotgd-1.1.0\lib\fightnav.php on line 42
7: fightnav() called from C:\Program Files\xampp\htdocs\lotgd-1.1.0\forest.php on line 200


Title: Re: Item system
Post by: SexyCook on August 10, 2006, 11:52:07 AM
Have you put the itemhandler lib in logd/modules/lib or in logd/lib? The second one is right, the first one wrong.


Title: Re: Item system
Post by: lincthra on August 10, 2006, 03:41:35 PM
Yep, itemhandler is in the logd-1.1.0/lib folder, not modules.


Title: Re: Item system
Post by: Foolish Frost on August 20, 2006, 11:04:59 AM
Hullo All.  Just downloaded and installed all of the modules I was wanting to tinker with.  This was one of them.

As to some of the things I saw posted about, it seems the following:

- The wearable features are commented out of the code due to some bugs in the overall design.  For example, if you wear a ring, and then drop it, any bonuses (like for HP) stayed.

- This means that for me at the moment, the system can't make anything but charged-use items (potions or wands) or financial items (gold statues worth money).  This is STILL very useful!

I would like to know if their are any plans to rebuild this to correct the problems with equipping special items?  I have to say, the overall deisign seems good, if a bit complicated.

Perhaps a system that automatically totals the worn items effects each time the popup refreshes? 


Title: Re: Item system
Post by: XChrisX on August 20, 2006, 11:15:49 AM
Yes, I'm planning to revise that part of the system as soon as 1.1.1 is in stores... eh.. available for download.

It would be better, if worn items could not be thrown away, sold or lost... that would be a nice workaround for the wrong stats... :)


Title: Re: Item system
Post by: Foolish Frost on August 20, 2006, 12:52:15 PM
What is the normal upgrade path from 1.1.0 to 1.1.1?  Will I have to reinstall all of my modules again?

Just kind of curious.


Title: Re: Item system
Post by: Talisman on August 20, 2006, 01:01:47 PM
There is no 'normal' upgrade path until the version is released  ;)

Theoretically, you'll be able to perform your upgrade in the normal manner of previous versions, however we can't guarantee that all third party modules you have installed will continue to work properly.

While we attempt to not break anything, sometimes things will get broken.  That's why you should have a test server with which you try everything before applying it to your real server.


Title: Re: Item system
Post by: Foolish Frost on August 20, 2006, 01:11:16 PM
<nods>  I expected as much.

I was just curious if it was as simple as:

Copy the new files, rerun the install functions for each mod, and GO!

Or more like:

Compare code from old to new, rebuild links, sit and whimper in a corner for a 15 minute break, repeat...

<grins>  Anyway, it's loads of fun.  In some ways I'm amazed I have not found a dynamic regional editor for it yet, though the problems with doing so are already becomming apparent to me.

Anyway, I'm still tinkering about.  I refrain from offering advice until I have a firm understanding of the backbone system.


Title: Re: Item system
Post by: Talisman on August 20, 2006, 01:14:59 PM
All going well, the upgrade will consist of uploading files then running installer.php to upgrade.  Your modules and their settings will remain active.

The only potential area for problems is where functions or files within the core work differently, which _may_ cause minor glitches with modules.


Title: Re: Item system
Post by: Zhossnal on September 25, 2006, 10:40:15 PM
Fatal error: main(): Failed opening required 'lib/itemhandler.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/joshua/public_html/modules/inventory/dohook/hook_village.php on line 2

what wrong with this


Title: Re: Item system
Post by: XChrisX on September 25, 2006, 10:42:52 PM
The archive contains a file "itemhandler.php" which belongs to the root-lib folder. Not to the modules folder...


Title: Re: Item system
Post by: Nightborn on September 26, 2006, 01:17:17 AM
(btw: any change possible to that? the modules/inventory would be a better folder as it is no core library file)


Title: Re: Item system
Post by: Ernesto on November 08, 2006, 06:54:52 AM
If I add a random test item and make it buyable/Sellable - It shows up in the store, but no link to actually buy the thing for the players.

Oh, and if I "Take" an item from the admin panel, it does not show up in my "inventory" (I dont even have an inventory section in my charstats)

I can take a "Room" from the predefined items and it will show up in my popupmenu thingy if i have it Activated, but it doesnt show up anywhere unless i have inventorypopup enabled


Title: Re: Item system
Post by: XChrisX on November 08, 2006, 07:18:43 AM
The last (with the popup) are correct. They are not supposed to show anywhere else.

The first: Do you have enough gold / gems / dragonkills? if not, the item will not show a nav (as you are not able / allowed to buy it...)


Title: Re: Item system
Post by: Ernesto on November 08, 2006, 07:22:24 AM
Oh you are so right and I am so dumb, didn't have enough gold.

Now, second problem - What "Category" do I need to give the item for it to show up in the popup window thingy? I thought someone above suggested "Loot" - But that doesnt seem to work.

Obviously the "Rooms" shows up, but what other categories etc etc? - A tiny little FAQ would be swell and sweet =)


Title: Re: Item system
Post by: XChrisX on November 08, 2006, 07:26:58 AM
Every class / category will show up :) It doesn't matter here.

Loot is the category you need, if the item should be "findable" during normal fights (findloot.php) or if the basic item shop should be able to buy/sell them.


Title: Re: Item system
Post by: Ernesto on November 08, 2006, 07:35:27 AM
No sir, only your premade "Rooms" shows up in the popup - Even if I assign my item the Category "Rooms" it does not show up in the popup inventory.
(http://www.ginnunga.org/images/for_xchrisx.jpg)


Title: Re: Item system
Post by: Ernesto on November 08, 2006, 07:37:18 AM
IF i made the item "nonequipable" it does indeed show up in my popup inventory


Title: Re: Item system
Post by: Ernesto on November 08, 2006, 07:38:18 AM
... and if i try to "Drop" it from Inventory I get (I had 5 items of the same kind):
DELETE FROM inventory WHERE userid =  AND itemid = 5 LIMIT 1

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND itemid = 5 LIMIT 1' at line 1
Call Stack:
1: db_query("DELETE FROM inventory WHE...") called from /home/ginnunga/public_html/lotgd/lib/itemhandler.php on line 448
2: remove_item_by_id(5, 1, false) called from /home/ginnunga/public_html/lotgd/lib/itemhandler.php on line 463
3: remove_item(5, 1, false, "5") called from /home/ginnunga/public_html/lotgd/modules/inventorypopup.php on line 80
4: inventorypopup_run() called from /home/ginnunga/public_html/lotgd/runmodule.php on line 35
I can drop "All" with no problem, but when I just try to "Drop" (when having several) I get the above error


Title: Re: Item system
Post by: XChrisX on November 08, 2006, 07:38:48 AM
Aaah... Yes... The basic support for equippables is built in... But not really developed... (This will have to wait for lotgd 1.5 or soemthing like that... (When equippable items will become great fun... ;) )


Title: Re: Item system
Post by: Ernesto on November 08, 2006, 07:41:36 AM
Aha, so I cant really use this module to "bypass" the regular weapon and armors and instead use a "full equipment system" - This system is (currently) only to create potions and other clickables? Or just fancy stuff that tells you a tale or something?


Title: Re: Item system
Post by: XChrisX on November 08, 2006, 08:12:25 AM
At this moment you cannot replace weapons and armor (you can, but it's not fully working... And not even tested... So I decided to comment-out those lines)


Title: Re: Item system
Post by: Ernesto on November 09, 2006, 05:26:16 AM
(Tell me if this should be in another forum, sorry if this is not the correct thread for it=

Ok, so I am playing around a little with the inventorypopup.php because I wanted the runes and the tradegoods (from trading.php) in the inventory as well, so I could dump the backpack.php module.

I don't have things fully working yet, but this is what I came up with so far. I know the code is a little ugly, but this is the best I can do (At the moment, I am learning!!)


After line 127
125 // "Unequippables,title",
126 "Unequippables",
127 );
I added:
/* ADDING RUNE AND TRADEGOODS TABS - BY ERNESTO */
if (is_module_installed("runes")) {
array_push($layout,"Runes,title");
}
if (is_module_installed("trading")) {
array_push($layout,"Trade Goods,title");
   }
Ok, so now I created the tabs for the things (They don't seem to make a difference though, since everything is tossed under Misc anyways, will have a look at that!)

Then, I have to grab the runes from the runes module and add them in the table (the tabform). To do this, I went down to

After line 157
155 else
156 $inventory[$row['equipwhere']][] = $row;
157   }
and above
inventory_showform($layout, $inventory);
I added:
/* Grabbing the runes if Runes module is installed */
 if (is_module_installed("runes")) {
 
 /* BEGIN VERY UGLY ERNIE CODE */
 
 /* Rune #1 */
 $rune1amount = get_module_pref('amnt1','runes');
  if ($rune1amount != '0') {
    $rune1name = get_module_setting('first','runes');
    $runearray = Array("class" => 'Runes',
                           "name" => $rune1name . ' rune',
                           "description" => 'A magical rune with the symbol of `%'.$rune1name.'`0 carved into it',
                           "quantity" => $rune1amount);
     array_push($inventory['Unequippables'],$runearray);
  }
 
   /* Rune #2 */
 $rune2amount = get_module_pref('amnt2','runes');
  if ($rune2amount != '0') { 
    $rune2name = get_module_setting('second','runes');
    $runearray = Array("class" => 'Runes',
                           "name" => $rune2name . ' rune',
                           "description" => 'A magical rune with the symbol of `%'.$rune2name.'`0 carved into it',
                           "quantity" => $rune2amount);
     array_push($inventory['Unequippables'],$runearray);
  } 
 
 
   /* Rune #3 */
 $rune3amount = get_module_pref('amnt3','runes');
  if ($rune3amount != '0') {
    $rune3name = get_module_setting('third','runes');
    $runearray = Array("class" => 'Runes',
                           "name" => $rune3name . ' rune',
                           "description" => 'A magical rune with the symbol of `%'.$rune3name.'`0 carved into it',
                           "quantity" => $rune3amount);
     array_push($inventory['Unequippables'],$runearray);
  } 
 
 
   /* Rune #4 */
 $rune4amount = get_module_pref('amnt4','runes');
  if ($rune4amount != '0') {
    $rune4name = get_module_setting('fourth','runes');
    $runearray = Array("class" => 'Runes',
                           "name" => $rune4name . ' rune',
                           "description" => 'A magical rune with the symbol of `%'.$rune4name.'`0 carved into it',
                           "quantity" => $rune4amount);
     array_push($inventory['Unequippables'],$runearray);
  } 
}



Now, I am sure there is a nicer way to do this with some fancy stuff, if anyone could point me in the direction, that would be sweet!

Now I just have to figure out why it is shown as misc and not as Runes and hide gold/gem value if gem/gold value is 0


Title: Re: Item system
Post by: XChrisX on November 09, 2006, 05:34:11 AM
It would be easier, if the rune-module was converted to using the item system. Then you'd not need to bother about changing the popup as it will display those items immediately. No need to hook into it or change any files.

That was (and is) the main target behind the item system: Hand out a set of functions you can use to create your modules... ;)


Title: Re: Item system
Post by: Ernesto on November 09, 2006, 05:36:21 AM
Displaying a few items, instead of "rewriting" a real module, is over my head Sir!

.. or maybe it isn't. I will take a look :p

But I think now before starting, that it will be too hard for me.


Title: Re: Item system
Post by: dilbert166 on January 02, 2007, 11:26:59 AM
hi folks,

i just stumbled over the module, and immediately fell in love with it.
it is a real charm and imho has all the potential to be a killer mod.

still, i have a few points, that are not quite clear to me:
- i understand, the equippables part is still not fully working? it would explain, why i dont get along with it (and sounds nicer than "im too dumb")
- id like to bump up saucywenchs idea of the idiots guide to thismodule. is there any form of documentation? if there is, where can i get it? if there is, but its still ugly, can i help to make it nice? if there isnt, well, that cant be helped. but i think it would expand the possibilities of the module from "the obvious" potions etc. to "wow, i didnt think of that" items.

what do you think?


Title: Re: Item system
Post by: XChrisX on January 02, 2007, 11:33:18 AM
No, there is no documentation at the moment...

This also is not really a module but more a set of functions to help you create other modules which use items where they could be used. (e.g. stone or wood to build dwellings or something like that... )


Title: Re: Item system
Post by: dilbert166 on January 02, 2007, 11:57:21 AM
This also is not really a module but more a set of functions to help you create other modules

sure, but if it is, it suffers even more from the lack of documentation, wouldnt you agree? ;)


Title: Re: Item system
Post by: XChrisX on January 02, 2007, 12:05:54 PM
This also is not really a module but more a set of functions to help you create other modules

sure, but if it is, it suffers even more from the lack of documentation, wouldnt you agree? ;)

Unfortunately... Yes ;) I'll see, if I can setup some kind of documentation in dragonpedia... :)


Title: Re: Item system
Post by: dilbert166 on January 02, 2007, 12:13:01 PM
i bet, that is appreciated much by the "not so nerds" (like i am) ;-)
thanks a lot


Title: Re: Item system
Post by: Pilzekind on February 25, 2007, 09:36:36 AM
i think i got a bug.
users arent anymore able to buy something, but they can sell.
looks like somehow the links "got lost".


Title: Re: Item system
Post by: XChrisX on February 25, 2007, 11:22:07 AM
And you have enough gold and gems with you? (That important info is missing in the picture...)


Title: Re: Item system
Post by: Pilzekind on February 26, 2007, 12:54:25 AM
yess. you know, like the admin account has  ;D
but ALL users have this problem. i reuploaded the whole .phps and it didnt work through.
i first disabled it :(


Title: Re: Item system
Post by: XChrisX on February 26, 2007, 01:20:34 AM
The items are marked as "buyable" and "sellable" ?


Title: Re: Item system
Post by: Pilzekind on February 26, 2007, 06:19:34 AM
sure. (oops, didnt have enough gems now i can buy them, but it still looks very very strange.)
i also deletet the translations, but it didnt help.


Title: Re: Item system
Post by: DaveS on April 25, 2007, 03:14:32 PM
Quote
It was designed to do exactly what bwatford is doing now (it would save / have saved you a lot of trouble with your quarry/lumbveryard/metal mine modules...  )

I agree with this to some extent... However, I'm going to caveat this...


If I was going to re-write the materials modules I STILL wouldn't use the item system UNTIL it became integrated into the core.

With that note, I ran the itemsystem and without a doubt I think it should become part of core... ideally, not as a module but as an integrated system. I'm looking at this as something that could seriously take up the customizability of the game several notches.  I think there can only be so many Green Dragons running around, but this module in itself has the potential to create whole new levels of play in creative hands. Having played Nightborn's server, I felt like added a significant uniqueness.

Why integrated? Well, because then new modules could be written and not have to worry about "require" for something that ideally could be used by EVERY Server.

That's just my thought... I want this to come out as the "highest compliment" rather than just a "Ooo ooo that should be in core" post. 


Title: Re: Item system
Post by: Dragon89 on April 25, 2007, 07:58:58 PM
I totally agree with you DaveS.  I have wanted to use the item/inventory system for a very long time.  It would be a great addition to the game indeed! 


Title: Re: Item system
Post by: sixf00t4 on April 25, 2007, 09:35:17 PM
add another.  "items" are certainly in the future for lotgd.  May as well make it a centralized official thing to make everything consistent and easy from the start instead of 2 years down the road saying "i think X item system is better than all the other systems out there" or "we should really clean up all the modules out there that use different item systems to use one"  Kendaer himself had said that he had ideas for an item system in the core.  INTEGRATE THE ITEM SYSTEM.


Title: Re: Item system
Post by: Nightborn on April 25, 2007, 10:57:11 PM
 ;D integrate the translation wizard!

you know, I can now consider it stable, but exactly why my modules shouldn't go core: they are modules and not vital. there is a VAST core module pack, and most are stripped out...

a version change in the module will make an old one distributed as "core" without a valid download link for itself...

in any case...

http://shinobilegends.com/itemsystem.tar.gz

grab it if you like.


Title: Re: Item system
Post by: ThricebornPhoenix on April 25, 2007, 11:04:30 PM
I haven't played much with this module (made one item, skimmed some code), but here are my thoughts:

-Maybe an integrated item system should be a bit simpler (but capable of expansion via modules)?
-This could manage the 'objectification' of weapon and armor... right? If so, I'm all for it....
-Clans got added to core. Clans. Why not this? ::)


Title: Re: Item system
Post by: XChrisX on April 25, 2007, 11:51:11 PM
@Nightborn: Baah.. You catched one thing I had not fixed in my version...

Just a moment, I'll attach my version here, too. It fixes some irregularities that were able with high player traffix and charges, speeds up things (when adding several different items on the same pageload...)

Also updated the download link: http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=1033


Title: Re: Item system
Post by: Iori on April 27, 2007, 12:37:01 AM
I noticed that the no effect message for items shows up regardless of whether the item has an effect or not, for example, when using a healing potion, I get...

Quote
You have been restored to full health.

Nothing happens.


Title: Re: Item system
Post by: XChrisX on April 27, 2007, 01:07:48 AM
Updated.

Should now show itemeffects better...


Title: Re: Item system
Post by: Iori on April 27, 2007, 02:03:52 AM
It's still the same. The only new thing I noticed was the debug output.

Quote
You use a Rock!
array(0) {
}
Nothing happens.

It correctly added 1000 to my hitpoints, so the item did have an effect.


Title: Re: Item system
Post by: XChrisX on April 27, 2007, 02:22:00 AM
Yes, I think I forgot to remove the debugs... ;)


Title: Re: Item system
Post by: Iori on April 27, 2007, 02:24:54 AM
I don't mind the debugs.  ;) It's just...the problem does not seem to have been fixed. The no effect message still shows up no matter what.

Edit: Also...items that are used during fightnav are not used up (charges set to 1).


Title: Re: Item system
Post by: Nightborn on April 27, 2007, 02:56:48 AM
 ;) that is fixed in the item package I put in here. The charges were handled incorrectly.

The "nothing happens" should also be fixed.


Title: Re: Item system
Post by: XChrisX on April 27, 2007, 02:58:02 AM
I think your "rock" actually does "nothing", right?


Title: Re: Item system
Post by: Iori on April 27, 2007, 03:04:50 AM
It correctly added 1000 to my hitpoints, so the item did have an effect.

Code:
$session['user']['hitpoints']+=1000;
in the exec field.

If it does nothing, it should only show the "Nothing happens" message. If it does something, it should not. Right now, it shows the effect message AND the nothing happens message if the item does something.


Title: Re: Item system
Post by: XChrisX on April 27, 2007, 03:20:05 AM
the correct value would be:

Code:
$hitpoints = 1000;


Title: Re: Item system
Post by: Iori on April 27, 2007, 03:24:43 AM
Under which field?

Because my way also works when inputted into exec value (and is not limited to only the values from lib\itemeffects.php)


Title: Re: Item system
Post by: XChrisX on April 27, 2007, 03:36:01 AM
Yes... But your "value" won't be recognized as a valid item effect.
And as no valid effect is recognized, it will say "Nothing happens".

enter $hitpoints = 1000; into the exec field and it will do the same.


Title: Re: Item system
Post by: Iori on April 27, 2007, 03:49:16 AM
Yes... But your "value" won't be recognized as a valid item effect.

Yes, that's indeed what happens, so it's not a bug. Although...I think doing it the "correct" way is not very efficient, not to mention limiting (considering that, instead of doing it "correctly", you can execute almost any php code in the exec value field).

The charges not decreasing at fightnav IS a bug, though.


Title: Re: Item system
Post by: XChrisX on April 27, 2007, 04:03:11 AM
Doing it that way keeps you from thinking about how to output the text.

Also:

Code:
$hitpoints = 1000
Will not heal you above your max hitpoints. It will also show the "Nothing happens" message, then (because actually nothing really happened).

It will tell the player he has been fully healed, when he got to his maximum hitpoints (which is true, but not exactly the effect you have created...)

Or look at this:

Code:
$turns = -1;

If you have only 1 turn left it'll tell you "You lost ALL your turns." Which is true in this case... But not necessarily always... ;)

A certain grade of "blurriness" is included... ;)

Well... And if you insist on doing it this way, or want to do something not covered in the effect handler, then simply put this line below your effect:

Code:
$noeffecttext = "I wanted this to happen!";

;D



Title: Re: Item system
Post by: Iori on April 27, 2007, 04:08:36 AM
Code:
$noeffecttext = "I wanted this to happen!";

Perfect! Just what I needed, thanks!  ;D


Title: Re: Item system
Post by: XChrisX on April 27, 2007, 04:23:32 AM
You could also write a module, that fetches other effect not covered... Or one, that changes the output for the noeffect depending on the item. :)


Title: Re: Item system
Post by: Iori on April 27, 2007, 04:33:41 AM
You could also write a module, that fetches other effect not covered...

The beautiful thing about exec value is that I don't need to write a separate module to achieve most effects. I'm still in the process of exploring what it's capable of doing.

Or one, that changes the output for the noeffect depending on the item. :)

or I could just put this into the exec field (example)...

Code:
if (e_rand(0,1)==1) {
set_module_pref("alignment",get_module_pref("alignment","alignment")+3,"alignment");
$noeffecttext = "Effective!";
} else {
$noeffecttext = "No Effect!";
}

Edit: oops, increment_module_pref() would have been better here...


Title: Re: Item system
Post by: XChrisX on April 27, 2007, 04:56:20 AM
Yes, would have been better... And yes, you could do this. You can even make a "newday-potion" by simply entering:

Code:
redirect('newday.php');

Or something more strange:

Code:
if (e_rand(0,500)==0) {
  redirect('newday.php');
} else {
  $hitpoints = 10;
}

;D


Title: Re: Item system
Post by: XChrisX on April 27, 2007, 05:05:37 AM
BTW: Charges and weight are some things which we don't use on our server (yet.. ) So my testing for this is quite limited.

I'd be glad for any help I could get here. :)


Title: Re: Item system
Post by: Iori on April 27, 2007, 06:05:09 AM
*Iori wonders how to get something like this to work without an external module

Code:
if ($session['user']['level'] < 15) {
if (e_rand(0,4) > 0) {
global $badguy;
$badguy['creaturehealth'] = 0;
output("`nWith a quick jab into the heart of voodoo doll, $badguy['creaturename'] dies.");
} else {
$session['user']['hitpoints'] = 0;
$session['user']['alive'] = 0;
output("`nOh no! You accidently envisioned yourself as the voodoo doll!");
}
}

Apparently, global $badguy is causing problems.


Title: Re: Item system
Post by: XChrisX on April 27, 2007, 06:22:06 AM
There's nothing like "global $badguy" anymore with v1.1.1

But you could apply a buff that does this.


Title: Re: Item system
Post by: Iori on April 27, 2007, 06:28:38 AM
But you could apply a buff that does this.

How would you go about making a buff that does this within the item system?


Title: Re: Item system
Post by: XChrisX on April 27, 2007, 06:31:53 AM
You want an effect, that instantly kills an enemy. No enemy can have more than INT_MAX hitpoints, so you just mak a buff with
Code:
minbadguydamage = 4294967295
maxbadguydamage = 4294967295

This can be done in the buff editor (which is part of the item system...)
Then you save that buff (don't forget: rounds 1, minioncount 1).

Create a new item (or edit an existing one) and under "buffs and activation" simply choose the buff you just created.


Title: Re: Item system
Post by: Iori on April 27, 2007, 06:34:46 AM
You want an effect, that instantly kills an enemy. No enemy can have more than INT_MAX hitpoints, so you just mak a buff with
Code:
minbadguydamage = 4294967295
maxbadguydamage = 4294967295

This can be done in the buff editor (which is part of the item system...)
Then you save that buff (don't forget: rounds 1, minioncount 1).

Create a new item (or edit an existing one) and under "buffs and activation" simply choose the buff you just created.

That's cheating! ;D

Anyway...
The e_rand() which gives a chance that the item will backfire won't work if the buff is created using the buff editor. I'll have to check if apply_buff() works within the exec value field...

Update: Found out it does. Why do we even need the buff editor? ;D

Code:
if ($session['user']['level'] < 15) {
if (e_rand(0,4) > 0) {
apply_buff('voodoodeath',array(
"name"=>"Voodoo Doll",
"rounds"=>1,
"minioncount"=>1,
"minbadguydamage"=>4294967295,
"maxbadguydamage"=>4294967295,
"effectmsg"=>"`4With a quick jab into the heart of voodoo doll, {badguy} dies.`0",
"schema"=>"items-voodoo",
));
} else {
$session['user']['hitpoints'] = 0;
$session['user']['alive'] = 0;
output("`n`4Oh no! You accidently envisioned yourself as the voodoo doll!`0");
}
}


Title: Re: Item system
Post by: XChrisX on April 27, 2007, 07:26:24 AM
Well... I created the buff editor first...

And if you had an item activating a buff on newday. (I'm not sure, if this is still implented...)


Title: Re: Item system
Post by: Iori on April 27, 2007, 07:51:47 AM
Well... I created the buff editor first...

And if you had an item activating a buff on newday. (I'm not sure, if this is still implented...)

Strange....I'm not getting buffs to activate for newday items, buff editor or otherwise.


Title: Re: Item system
Post by: Iori on April 28, 2007, 01:52:15 AM
Found another bug

In modules/inventory/run/case_editor.php, you used dmgshield (which is not a valid buff field) instead of damageshield (the correct version). This results in all damageshield buffs doing nothing.

Another thing...

In lib/itemeffects.php...

Code:
} else {
$experience = -$killable/100;
$out[] = sprintf_translate("`\$You die.`n");
}

Shouldn't this actually KILL the player in addition to losing experience (instead of just showing the player the message that they died, when in fact they did not)?



Title: Re: Item system
Post by: XChrisX on April 29, 2007, 12:30:18 AM
Updates these (http://dragonprime.net/index.php?topic=6742.msg60527) problems. Also fixes Iori's last error with the KILL-thing.


Title: Re: Item system
Post by: Maeher on April 29, 2007, 04:32:25 AM
The Editor is lacking a stripslashes sonewhere. After you saved, the slashes are visible in the editor, and if you save again, the slashes are again escaped with slashes, meaning after saving two times, I got:

Quote
Engraved deep into the hilt you can read the words: \\\"Invincible Is He Who Use Me In Good Cause\\\"


Title: Re: Item system
Post by: Iori on April 29, 2007, 04:56:56 AM
After you saved, the slashes are visible in the editor

This only happens about 5% of the time for me. Usually, if it does, I save, navigate somewhere else, come back, and it behaves normally again.


Title: Re: Item system
Post by: XChrisX on April 29, 2007, 05:03:15 AM
If you switch from double quotes to single quotes? What happens?


Title: Re: Item system
Post by: Maeher on April 29, 2007, 05:11:09 AM
It has the same effect with single quotes.

But interesting enough, Iori is right, it only happens if I go to "new Item" and save it several times (I would time out if I did not :p). However, if I use "Edit Item" it does not happen.

edit: Another thing, according to the wiki, the item-system should include a file named inventoryviewer.php, but in the zip uploaded here, the file is not present.


Title: Re: Item system
Post by: XChrisX on April 29, 2007, 05:19:41 AM
Fixed. File is now included again.


Title: Re: Item system
Post by: Maeher on April 29, 2007, 05:47:05 AM
itemhandler.php

line 17 and following:

Code:
// Here we'll sanitize the buff a little, so there are no values in it
// which will actually cause output but which don't have an effect
$newbuff = array();
if ($buff['atkmod'] != "0" && $buff['atkmod'] != "1" && $buff['atkmod'] != "") $new_buff['atkmod'] = $buff['atkmod'];

I would say $buff['atkmod'] == 0 actually had an extreme effect indeed, wouldn't it? oO


Title: Re: Item system
Post by: XChrisX on April 29, 2007, 05:50:07 AM
therefore it's not handed over to the new buff.

An ATKMOD (or DEFMOD) of "0" caused division by zero errors on our server (or infinite loops... Choose your favourite error... ::) ) So I decided to not let them through.


Title: Re: Item system
Post by: Iori on April 29, 2007, 05:54:09 AM
I'm curious as to why it would cause a division by zero error? The mount editor and other buff editors do not have this problem.


Title: Re: Item system
Post by: Nightborn on April 29, 2007, 05:54:18 AM
atkmod defmod = 0 are allowed in the buffs in general, why not fix in the basic software that goes wrong?


Title: Re: Item system
Post by: XChrisX on April 29, 2007, 05:56:51 AM
I didn't test it since then... *shrug* 0.000000000001 as value worked with the same effect. :P


Title: Re: Item system
Post by: Nightborn on April 29, 2007, 06:03:54 AM
We don't argue about semantics here, do we?  :burn:


Wy not set a minimal and maximum range for these things? like 0.01?

I had to program a pumping station controller and a 0 as input would cause a fatality ... so I included a minimum value of 0.01 ...which is fair enough to cover errors or bad scripts.


Title: Re: Item system
Post by: Iori on April 29, 2007, 06:57:15 AM
In inv_statvalues.php

Code:
module_addhook("dk-preserver");

should be

Code:
module_addhook("dk-preserve");


Title: Re: Item system
Post by: Iori on April 29, 2007, 07:58:49 AM
This is wierd....

Ever since I updated to your newest version, I'm getting a division by 0 error each time I try to purchase/take an item. I took a look at the code, and it seems fine, then I noticed the debug output, and something strange...


Quote
Totalcount / MaxCount is: 24 / 99
MaxWeight is: 81 / 501
Item weight: i
Quantity to add was: 0
Zero items added.

Why the heck is item weight "i"? (and I double checked, the item weight inputted into the item prefs is 2) xD


Title: Re: Item system
Post by: XChrisX on May 02, 2007, 09:56:38 PM
I added some more debug outputs to let you check, what happens when adding an item.
The "i" should also be gone and also the division by zero thing.

Seekey reported a bug, that you always got linked back to the news page after using an item. Thanks for that hint. This has been removed, too.


Title: Re: Item system
Post by: XChrisX on May 03, 2007, 10:46:35 AM
Yet another update.

If you had no limit on item weights set (maxweight = 0) it would not treat this as unlimited but actually as "0"...


Title: Re: Item system
Post by: XChrisX on May 14, 2007, 04:35:10 AM
@Kalisiin: (http://dragonprime.net/index.php?topic=6801.msg61699#msg61699)
Overweight is what happens, if you eat too much... Wait... Wrong topic :biggrin: (just making fun...)

If you have you setting so it only allows to carry 500 units of weight and you already carry 495 units AND you try to add an item that weighs 10 units, it will not be added. Simply because the total weight would be higher than the allowed weight.


Title: Re: Item system
Post by: Iori on May 17, 2007, 11:10:01 PM
There's a typo in itemhandler.php, under the function recharge_item.

Code:
$sql = "UPDATE $inventory SET charges = charges 1 1 WHERE itemid = $itemid AND userid = $user $invsql LIMIT 1";


Title: Re: Item system
Post by: Zelgadiss on June 30, 2007, 03:39:15 AM
I have this system instaled in my test server, but system not show items that can equip.

I want do armos and jewels for my users, but system not show when i put "item equipable"

not soy in inventory pop up.

I want that users can equip and unequip the item.

P.D: In village nav show. but them cant unequip


Title: Re: Item system
Post by: XChrisX on June 30, 2007, 04:45:37 AM
equipping/Unequipping is not implemented.


Title: Re: Item system
Post by: Pilzekind on June 30, 2007, 07:14:32 AM
XChrisX, you rock!  :)


Title: Re: Item system
Post by: Zelgadiss on June 30, 2007, 11:25:47 AM
equipping/Unequipping is not implemented.


Ohhh thx ^^


Title: Re: Item system
Post by: Nightborn on June 30, 2007, 11:27:41 AM
I can only encourage you, if you find a module where things are missing or not correctly implemented: fix it yourself =)

that's the spirit.


Title: Re: Item system
Post by: Pilzekind on July 01, 2007, 03:02:59 AM
You forgot the real spirit:
Share it with us!
 8) YAY


Title: Re: Item system
Post by: Maeher on July 12, 2007, 09:29:58 AM
in run/case_activate.php somewhere before line 31
Code:
if ($session['user']['hitpoints'] <= 0 || $session['user']['alive'] == false)
you should declare
Code:
global $session;

otherwise, the code thinks you are always dead  :P

lib/itemhandler.php

delete line 743
Code:
$test = get_item($injection['name']);

it's useless


Title: Re: Item system
Post by: B1ackStr1k3r on August 06, 2007, 09:28:03 AM
Nice addon, but it doesnt work in my server. When I create item, Im activate Is this item sellable? and Is this item buyable? but in shop clear. What's problem?


Title: Re: Item system
Post by: Nightborn on August 06, 2007, 10:52:47 AM
the shop.

it's buggy.


Title: Re: Item system
Post by: B1ackStr1k3r on August 07, 2007, 01:23:11 AM
the shop.

it's buggy.

I know -). How to correct this buggy? May be answer is earlier. I'm sorry for my bad English -(


Title: Re: Item system
Post by: Nightborn on August 07, 2007, 01:38:31 AM
I don't know  ;) I wrote a forest shop to suit my needs.


Title: Re: Item system
Post by: B1ackStr1k3r on August 07, 2007, 02:51:54 AM
I don't know  ;) I wrote a forest shop to suit my needs.
Can you give me link to your mod? plz -)


Title: Re: Item system
Post by: Oridin on December 30, 2007, 02:44:45 PM
Where is the Shop that these settings refer too?

Is this item sellable in the shoppe?
Is this item buyable in the shoppe?


Title: Re: Item system
Post by: Nightborn on December 30, 2007, 03:16:08 PM
Nowhere, program it.

The one enclosed, if not changed from the last version I know, is unusable due to heavy bugs.


Title: Re: Item system
Post by: seekey on December 30, 2007, 05:04:05 PM
hm, can I ask from where you got this settings?
The actual Version of the Item System has a shop, but I can't find the settings you have written here.

The actual Shop works fine, but there are some other little bugs in the Item System. The Items will not be deleted, if you set them to 100% for being destroyed after a lost fight.

But the shop should work fine, if you are using the actual download.


Title: Re: Item system
Post by: Oridin on December 30, 2007, 05:19:06 PM
Yeah yeah, I see the shop now. I see a few big problems with the module already, though, and the code is well to far out of my league to even do anything with.

When you buy an item module does not check how many items the user is able to carry, instead it will check how much gold and gems the user has and offer as much of the item as the amount of gold and gems they are carrying.
       - Because of that the user can buy way more than how much you set him to carry in his backpack.

I'll attach the module so someone could hopefully look into this. This could really open a new door for LoGD if this code was cleaned up a bit!

Edit: I just got your post Seekey, I got this setting from Grotto > Item Editor > Shop Options. I had not actually installed and activated the shop included in the zip folder so I had no clue what they were referring to. :D


Title: Re: Item system
Post by: seekey on December 30, 2007, 05:36:18 PM
The weight problem is a big problem and doesn't work correctly. It is a lot of work to make this running like it should run. And you will get other problems, if you are restrict the max weight for carrying.

Especially if you want to use the additional rooms module from chris. It doesn't work, because every room is an item too ;)

Hm, in my Version I have "Is this item sellable?" instead of "Is this item sellable in the shoppe?" when I go to the shop options. Are you sure you have the newest version running, which is in the download section?



Title: Re: Item system
Post by: Oridin on December 30, 2007, 05:48:46 PM
Hm, in my Version I have "Is this item sellable?" instead of "Is this item sellable in the shoppe?" when I go to the shop options. Are you sure you have the newest version running, which is in the download section?

Sorry, it does say "Is this item Sellable." Me and my mistakes...


Title: Re: Item system
Post by: seekey on December 30, 2007, 06:23:54 PM
 ;D I know this very good *g*

But I have looked into the code and you are absolutely right. there is a else which should work, if the weight of the item is too high or the backpack is full, but there is no line for getting the maximum weight a user can carry. Or I am blind and didn't know till today :)

First you have to get the total weight of all items a user is carrying. And then you have to let the module look, if the new item he wants to buy is in the allowed weight. But for this, you must get the weight of the item. This is a nice little work, but I think it is possible.

The following is a try, don't really know if it works until someone will test it  ;D

Code:
//first get the total weight of players inventory
$inventory = db_prefix("inventory");
$result=db_query("SELECT COUNT (weight) AS c FROM $inventory WHERE userid = {$session['user']['acctid']} GROUP BY weight HAVING COUNT(*) > 0");

for ($i=0;$i<db_num_rows($result);$i++){
$row=db_fetch_assoc($result);
$totalweight=floor($row['c']);
}

Now we should have the total weight of all items in the players backpack

Code:
//get the maximum weight a player can carry
$maxweight=get_module_setting("weight","inventory");

So we now have the maximum weight a player can carry

Code:
//now we get the weight of the item a user want to buy
$itemweight=$item['weight'];

So, now we have all relevant values and we can make the if

Code:
//don't allow to buy the item if it is too heavy
$allowedweight=$maxweight-$totalweight;
if ($itemweight>$allowedweight){
output("`2The loiterer takes a look at you.");
output("`@\"Hey Kiddie, you cannot carry any more of these items.\"`2");
output("Having said this, he turns away to serve another well-valued customer.");
}

I am don't really sure where the best place into the shop code is for this code. But you can make a additional else to the last on line 119. Or you can set this on top.

I tell again that this is free coded and not tested yet. If I should test it by myself you have to wait until tomorrow ;)


Title: Re: Item system
Post by: robert on December 30, 2007, 06:42:26 PM
Nice work.
Yes, the Item system would be a nice addition to most realms if it ever is completed and everything worked properly.

RE: weight of items
I would suggest making the weight calculations a separate function all of its own. One that is called for when purchasing an item.  Another thing to remember is to get rid of the weight when the player trades, sells or loses an item.

P.S.  You may want to consider looking at a similar system produced by Bwatford


Title: Re: Item system
Post by: Oridin on December 31, 2007, 07:38:04 AM
This is the absolute best I can come up with  :D... I added a new }else{ statement, starting at line 119, and added the lines of code that you have given in your posts. It didn't work to hot for me though.   :-\ The best I can do now is submit it... sorry.


Title: Re: Item system
Post by: seekey on December 31, 2007, 08:00:42 AM
I agree by adding a complete new weight function. Sounds like a very good idea for me. I am out of time in the next few days, so I not really can do anything.

@oridin
It doesn`t works or you have not testet it?
I will have a look at this the next days or maybe next weekend. I will try to make the weight function and add the changed file here.

But for me, the first stone is rolling, let's move the whole mountain *g*
I think there will be a lots of work on the item system to make it work complete correctly.


Title: Re: Item system
Post by: Oridin on December 31, 2007, 08:05:44 AM
There's no bugging with the code that I submitted. It just doesn't check for the weight of the item in the place I put it you could say.


Title: Re: Item system
Post by: seekey on January 12, 2008, 12:18:06 PM
Nothing new from me here with the weight function. Tomorrow I will have a look at this, because of Oridins request.

But I'll attach my changed file from modules/inventory/dohook/hook_battle-defeat.php. There was a problem with loosing the items when loose a fight. The Items doesn't drop when you set it to 100% or any else chance.

Caution! If you are using the train hook, your players will loose their items too, if they loose against the master. You have to comment out this hook, I think. But I like it  ;D


Title: Re: Item system
Post by: Oridin on January 12, 2008, 06:28:42 PM
Thanks for that Seekey, can't wait for the update!


Title: Re: Item system
Post by: seekey on January 13, 2008, 07:21:17 AM
No problem :)

Okaey, I know had a look on the Itemsystem testing the weight function. And what should I say? I have tested the limit of Items a user can carry ... all was fine. I have set it to 6 and my testaccount can not buy more than 6 items.

Then I have tested the maxweight. Set it to a limit of 51 a user can carry and set the limit of items to 0 (no limit) but the weight of any item to 2 and all works fine.

So I have to say, the downloadable version of the item system which you can download here:
Code:
http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=1033
does exactly what you want oridin.

I have tested the findloot, when bought enough items too and this works fine too.  Here ist the debug line:

Trying to add 1 items. Item's weight is 2
In theory only 5 should be added (totalcount)
In theory only 0 should be added (totalweight)
Reducing real quantity to 0. (count/weight-restriction)
Totalcount / MaxCount is: 25 / 30
MaxWeight is: 50 / 51
Item weight: 2
Quantity to add was: 0
Zero items added.

I must sayy at this point, I ove the raw sql function. It makes testing so easy. Setting all item weights to 2 in only 1 second *g*

I'll attach the current version of the item system I am running to this post, but it is the same as the one here to download. Only the battel-victory hook I'll attached in my last post is changed and some translation lines at the lib/itemeffects.php.


Title: Re: Item system
Post by: Oridin on January 22, 2008, 07:20:22 AM
Thanks Seekey for the work. I'm just gonna report that items cannot be collected if you set the setting of an item to let the user "equip" the item.


Title: Re: Item system
Post by: seekey on January 25, 2008, 07:06:50 PM
Yeah!

This function is not ready and XChrisX was not very hopefully about this.

I can have a look on this, but I am not sure if I can do something or I have the time for it. But if I have some hours left, I'll try to get this running.



Title: Re: Item system
Post by: Nightborn on January 26, 2008, 01:53:57 AM
It is highly encouraged that in this cases somebody takes over.
Volunteers?


Title: Re: Item system
Post by: seekey on January 26, 2008, 04:40:38 AM
Hmmm, I have some own projects to program, so I don't know how much time I am able to invest. But I'll try the best I can.

Any other help is welcome. :)


Title: Re: Item system
Post by: Maeher on January 26, 2008, 07:03:07 AM
When I have some time, I will check the item system again. There are several bugs and other thing that would need changing. I started collecting those, but after I did not even get an answer to my first post (http://dragonprime.net/index.php?topic=2368.msg67383#msg67383) about that, my motivation ceased to exist. :P


Title: Re: Item system
Post by: Rohen on January 28, 2008, 04:14:19 AM
XChris told me that he did some fixes on the item system we currently run on our server, so i've attached the updated files.
I hope this helps you.

Rohen


Title: Re: Item system
Post by: seekey on January 28, 2008, 04:56:47 AM
@Maeher:

I understand this and so, we can be happy if you want to give your knowledge for making this running. :)

@Rohen:

Very good! If some bugs are out of the system it could be a great help. thank yo for attaching this, I will have a look at it.

@all:

I think the best way is to collect the bugs, like Maeher has done. Then we are able to work on this together.



Title: Re: Item system
Post by: Oridin on January 28, 2008, 02:41:57 PM
XChris told me that he did some fixes on the item system we currently run on our server, so i've attached the updated files.
I hope this helps you.

Rohen

I tested it and will report it is a little better. Since feedback never hurts and usually helps people out I'll add a couple of statements.  :)

1) There is no way to equip the item still. With the version that ronan attached you are allowed to collect the items, unlike the version that was used in downloads, but once you have the items there should be something like "equip item to right arm" or whatever. Maybe there can be an option to display the items that are equipped to you in the bio?

2) The shop included in this zip folder should be cleaned up a bit. When you enter the shop there is nothing, and if you have no gold than nothing comes up on the "buy" section. When you do have money, however, you can purchase as many items as your gold can allow. So if you have 1000 gold and the item you wish to purchase costs 2 gold, you can have 500 of the item. A possible fix would be to add a cap to how many of that item or items total you can buy a gameday.

There again, I can do some stuff but I started out with no knowledge of PHP. I am learning what I know from everyone's examples here on DP. Thank you for the help and responses that have been received to all of my posts.


Title: Re: Item system
Post by: Nightborn on January 28, 2008, 02:47:06 PM
 :)

it would need an experience coder to take over this project and finalize it.

Chris said the equip does not work and will not, it is simply not done. It is prepared, but not done and not tested.


Title: Re: Item system
Post by: seekey on January 28, 2008, 05:49:06 PM
:)

it would need an experience coder to take over this project and finalize it.

Hmmmmm let e think about it. Someone who has made a lot of very good modules. Someone who has the knowledge and the experience, that he is coding an own logd version.

 ;D ;D ;D

But I agree completely with Nightborn. The Equipment function will take a lot of time and work. Taking out the bugs should not be the real problem, because here are enough people to have a look and spending the knowledge.


Title: Re: Item system
Post by: Nightborn on January 29, 2008, 01:45:17 AM
So you described yourself? =) excellent, congrats.
Never knew you made a +se version.


Not all people report. Believe me.
Look at the only sporadic reports on the item system. =)
Chris had a "charges" bug in there for a long time, but never tested it even as he did not use charges.
Nobody else said a thing for a year. My players did complain about not working stuff...

Players are your best choice.


Title: Re: Item system
Post by: Caesar on February 10, 2008, 06:36:34 AM
I wander if this module will ever get finished ^^


Title: Re: Item system
Post by: els forever magic on May 24, 2008, 10:02:09 PM
the item editor comes up with a page that says there could be a programming error preventing the page from loading... has anyone else had this problem?


Title: Re: Item system
Post by: Edward on May 24, 2008, 10:33:22 PM
Nowhere, program it.

The one enclosed, if not changed from the last version I know, is unusable due to heavy bugs.


So I don't quite think any of them are bug free.


Title: Re: Item system
Post by: Elessa on May 24, 2008, 10:36:04 PM
which file did ye download? is it the updated one in rohen's prior post or the one in the downloads area?

this module is horrifically buggy and never really worked.  rohen attached an updated version being used on logd.de which still doesn't completely work.

it looks like those who were trying to clean it up have given up for now.


Title: Re: Item system
Post by: Edward on May 24, 2008, 10:54:24 PM
which file did ye download? is it the updated one in rohen's prior post or the one in the downloads area?

this module is horrifically buggy and never really worked.  rohen attached an updated version being used on logd.de which still doesn't completely work.

it looks like those who were trying to clean it up have given up for now.

QUESTION: If its so buggy and unusable, (why) is it even supported here?


Title: Re: Item system
Post by: Elessa on May 24, 2008, 10:58:12 PM

QUESTION: If its so buggy and unusable, (why) is it even supported here?


why not? this is an open source project. code is buggy, others can work to fix it if they so desire.


Title: Re: Item system
Post by: Edward on May 24, 2008, 10:59:56 PM

QUESTION: If its so buggy and unusable, (why) is it even supported here?


why not? this is an open source project. code is buggy, others can work to fix it if they so desire.

Good point, but, wouldn't it be more simple to make a new system?


Title: Re: Item system
Post by: Iori on May 24, 2008, 11:07:29 PM
Please. The item system is NOT buggy. I have been using it for over a year without problems.

The buggy module refered here is to a particular module included within the pack - namely, the basic item shop. That module is entirely optional, and will not affect anything if it is not installed.


Title: Re: Item system
Post by: Elessa on May 24, 2008, 11:32:54 PM

The buggy module refered here is to a particular module included within the pack - namely, the basic item shop. That module is entirely optional, and will not affect anything if it is not installed.
/me updates description in the file sharing area to reflect the above statement for others to be informed when downloading


Title: Re: Item system
Post by: Asm on July 21, 2008, 07:30:08 AM
sorry for noob question, but tell me what's wrong: i installed the latest version on this pack created some items, but they aren't shown neither in invetory nor in the shop:(
i checked properties of shoing in intentory and selling/buying in shop..


Title: Re: Item system
Post by: Iori on July 21, 2008, 09:49:43 AM
sorry for noob question, but tell me what's wrong: i installed the latest version on this pack created some items, but they aren't shown neither in invetory nor in the shop:(
i checked properties of shoing in intentory and selling/buying in shop..

The shop in question is buggy, and should not be used (for security reasons as well).

Ideally, you should have a basic knowledge of php in order to use the item system and its many features.


Title: Re: Item system
Post by: Rohen on July 21, 2008, 11:03:50 PM
The Item system works fine when you use it as it was planed. As a system to provide items to the player.

The item shop (Loiterer) display every item that has the class as described. Several other classes can be used by other modules. Thats what we do on lotgd.de. The equip-option was planned by xchris, but never completed. maybe we should remove this code part to make the system more clear to other admins.


Title: Re: Item system
Post by: Iori on July 22, 2008, 12:35:51 AM
The equip-option was planned by xchris, but never completed. maybe we should remove this code part to make the system more clear to other admins.

Or someone could go ahead and complete it  ;)


Title: Re: Item system
Post by: RaynDarren on December 18, 2008, 10:03:42 PM
Well, I fele kinda stupid asking this, but I've read through the entire 17 pages of thsi thread and can't find an anwer, so here goes.

I'm trying to make items using the item system, everything goes smashingly until i reach the tab "buffs and activation" I have no problem with the first 2 fields, its the third one that throws me for a loop. I simply dont understand what to put in the field "link that's called upon activation".  I've looked through the samples that come with the module and none of them have this field filled in.

Please help,
~Rayn


Title: Re: Item system
Post by: Boris735 on December 19, 2008, 07:26:51 AM
It's probable that you don't need to put anything in that field; if using the item triggers a buff then you don't need to set it at all.  That field is for more specialised uses, when you need the activation of an item to call a specific module of yours.

For instance, you could make an item which would cause aliens to come and abduct you from the village square.  Create a module to handle the abduction scenario, and an item which has a link field set to call the appropriate part of this module.  When the item is used, your module is called.

The link field appears to have the format   name|link, where the name defaults to the item name if left blank.  e.g.,

Code:
"Alien Beacon|runmodule.php?module=alienabduction&op=phone"

But for most uses, you can do what you want with a buff and can just leave this field blank.


Title: Re: Item system
Post by: RaynDarren on December 19, 2008, 05:25:50 PM
Boris,

Thank you very much for the info! Another question if I may, I cant seem to get the buffs working correctly, they show up in the users stats, as a bonus to att/def, however, when the player clicks on them nothing happens.

Any suggestions?

Thanks,
~Rayn


Title: Re: Item system
Post by: Boris735 on December 19, 2008, 05:51:23 PM
I cant seem to get the buffs working correctly, they show up in the users stats, as a bonus to att/def, however, when the player clicks on them nothing happens.

Assuming that I am understanding you correctly, you seem confused about what buffs do.  Nothing happens when you click on a buff; their presence in the player info is informational, saying what buffs are currently active on the player.  As you've noted, their affect on player stats such as att/def will also be visible as long as the buff is active.

What were you expecting to happen / hoping to do?


Title: Re: Item system
Post by: RaynDarren on December 19, 2008, 09:35:54 PM
I've played on other servers taht when you clicked on an item, things happened, i.e. you got more turns or you got a free pass to the mine for that day.


Title: Re: Item system
Post by: Boris735 on December 20, 2008, 01:31:15 AM
Okay, clicking on an item is clearly a different thing to clicking on a buff.  If you want something to happen when the player clicks on an item, and this something is not the generation of a buff, then you will need to use the link field to call into a module of yours that does whatever it is you are trying to do.


Title: Re: Item system
Post by: RaynDarren on December 20, 2008, 11:21:57 AM
thank you :)


Title: Re: Item system
Post by: maZice on January 27, 2009, 01:09:32 AM
Hi!,
is there any way to make an usable item to generate other items?
For example, a "package item" that can cointain (in a random) a potion, some gold, or an extra turn.
Specifically, I'm looking for some already made variable (like $gold, $turn) to make other items ($item_id = xx, maybe?)


Title: Re: Item system
Post by: CavemanJoe on January 30, 2009, 07:09:49 PM
From what I gather of the Item System - and bear in mind I've only started using it tonight - you'd be wanting to write a little module and then put this in the eval field of your item:
Code:
redirect("runmodule.php?module=yournewmodule");


Title: Re: Item system
Post by: Boris735 on January 31, 2009, 06:24:58 AM
I think this sort of thing is what the link field is for, although I have not checked since the earlier post I made in this thread:
Quote
The link field appears to have the format name|link where the name defaults to the item name if left blank.  e.g.,

Code:
"Alien Beacon|runmodule.php?module=alienabduction&op=phone"


Title: Re: Item system
Post by: CavemanJoe on January 31, 2009, 09:18:30 AM
Does that still successfully decrement the uses of the item, though?  Or is it just a link to launch a module?


Title: Re: Item system
Post by: Boris735 on January 31, 2009, 03:51:33 PM
Ah, no, that replaces the management entirely.  Suitable for items with infinite charges, or where you are managing the effects separately in the new module.  If you want to use the existing charge machinery then the execvalue should be modified, but not with a redirect -- that will gratuitously shunt the player around.

What you should have in that exec field is something like this:

Code:
require_once('modules/spiffymodule/item.php'); spiffymodule_handle_item('spiffyitem');

for suitably created files associated with spiffymodule.  That is, include the file containing the function you want to call, then call it.


Title: Re: Item system
Post by: Rasyr on March 29, 2009, 09:16:29 AM
I am trying to figure out how to use this module, but the buff creation stuff just confuses me.

Can somebody supply an example or two.

Perhaps  of a healing potion (that does an instant heal of xx points). I have no idea where I have to put the number of point that I want it to heal.

Also, is is possible to create items (similar to those that can be purchased in the weapon shop) that could be used by the players (i.e. Sword of Fire -- does 8 +3 points of fire damage) or something along those lines.



Title: Re: Item system
Post by: Rohen on March 31, 2009, 11:59:45 PM
Thats an example of an apple hat gives 10 hp.

Field custom value:
Code:
$life=10;$maxlife = true;

Field exec value:
Code:
$hitpoints=10;

Thats should be enough.


Title: Re: Item system
Post by: Uchiha Dave on June 08, 2009, 12:05:22 AM
I have a problem my site is mithra.garfield.in

and i cant seem to make the loot system work


Title: Re: Item system
Post by: Rohen on June 08, 2009, 02:40:14 AM
nice, thats nearly the same error report like i got from many customers.

WHAT problem do you have?
WHAT message / output do you get?
WHAT problem special with the loot system do you discover?


Title: Re: Item system
Post by: Uchiha Dave on June 08, 2009, 02:44:01 AM
If you have msn id like to talk to you directly


Title: Re: Item system
Post by: Rohen on June 08, 2009, 03:36:17 AM
please describe your problems here, so that other possible helper has the chance to help.


Title: Re: Item system
Post by: Uchiha Dave on June 08, 2009, 08:08:08 AM
basically the problem is i plugged in the module and i tried testing it out by using the item editor and making an item... but it doesnt show up in the loiterer store no matter how much items i make... no monsters in forest drops anything either even after i put the percentage to 100% and when i try to force the item into my inventory it just says i have 0 items in my inventory...


Title: Re: Item system
Post by: Rohen on June 08, 2009, 12:00:58 PM
What item class did you give the items? only the class "Loot" is shown in the basic item shop.


Title: Re: Item system
Post by: Uchiha Dave on June 08, 2009, 01:24:22 PM
I mean what about the forest the monsters wont drop


Title: Re: Item system
Post by: Uchiha Dave on June 08, 2009, 01:25:47 PM
It also wont show up in the open inventory


Title: Re: Item system
Post by: Rohen on June 09, 2009, 02:02:17 AM
Do you have the "findloot.php" installed and activated?
Do you have items of the Class "Loot"?
itemhandler.php and itemeffects.php are in the lib folder?


Title: Re: Item system
Post by: Uchiha Dave on June 09, 2009, 12:20:25 PM
As i said i already did all those. nothings working i can see the item in the store but if i buy it it wont show up in my inventory monster also wont drop anything etc...
its not working which is why i needed someone to talk to directly so i can show the problem then i wont have to describe whats wrong


Title: Re: Item system
Post by: Rohen on June 09, 2009, 12:41:04 PM
so maybe someone else can help you if you won't talk here.

All i can advice is:
take the findloot.php and the basicitemshop, locate the sql statement that get a item from the database, put an debug output to the sql statement and the returned item-array and check this statement against your database.

Thats could be a wrong name or value that returns nothing from the db or causes the inject_item to do a faulty statement. If you wish you could post here or wait for help over an IM.

Rohen


Title: Re: Item system
Post by: Uchiha Dave on June 09, 2009, 02:01:48 PM
*sighs* Ive already told what the problem was but fine ill debug it


Title: Re: Item system
Post by: Rohen on June 11, 2009, 10:38:29 PM
Please don't forget to post the solution so that other admins can help themself next time.


Title: Re: Item system
Post by: N3M on September 28, 2009, 02:29:29 PM
somebody fix it?  :)
I try use it but it still doesn't work :/


Title: Re: Item system
Post by: Rohen on September 28, 2009, 10:17:40 PM
What doesn't work?
The item system works fine on more than one server and i'm sure we make some really stupid things with it, so please explain what problem you have and what you've done to solve it.


Title: Re: Item system
Post by: Brendan on September 30, 2009, 10:05:35 AM
Okay so ive got the item system module on my site along with bazaar..

What i am wanting to do is let players have there own shop where can sell things..

But obviously without the item system there is pratically only gems that you can sell.

I want to know how to connect the item system with the bazaar so player can sell items from the item system.

Any help would be appreciated..


Title: Re: Item system
Post by: arieswind on September 30, 2009, 10:26:49 AM
Shameless plug: this module might work better for your needs: link (http://dragonprime.net/index.php?topic=10524.0)


Title: Re: Item system
Post by: Brendan on September 30, 2009, 10:31:39 AM
I have that but its cumming up a error (requiring itemhandler) in the lib file, but it is in there  :-\


Title: Re: Item system
Post by: arieswind on September 30, 2009, 10:38:45 AM
you didnt install it right then, or your permissions are set up badly


Title: Re: Item system
Post by: Brendan on September 30, 2009, 10:51:27 AM
Rest of my modules are fine tho  ;)


Title: Re: Item system
Post by: Iori on September 30, 2009, 04:20:27 PM
Rest of my modules are fine tho  ;)

Somehow I doubt that. Unless none of the rest of your modules even bother using the item system's in built functions anyway.

If it says you don't have the file itemhandler.php in the lib/ folder, then you really don't. And that means you didn't follow instructions properly when you installed the item system.


Title: Re: Item system
Post by: Brendan on October 01, 2009, 01:52:44 AM
No instructions came with it tho.

I put the Basicitemshop, Findloot, Inventory modules in the modules directory, and the itemhandler module in the lib directory.

EDIT.

I got the item system working but i want to know how to connect that with the player owned shops so they can sell the items from the item system in there shop..


Title: Re: Item system
Post by: Brendan on October 01, 2009, 04:24:38 AM
When i create an item throgh the Xtem Editor where does it go ?

I cheked in the shop but it isnt there also just to test it out if it can be found in the forest

I put it at 100% chance of finding it

but still cant see it


Title: Re: Item system
Post by: Rohen on October 01, 2009, 06:26:54 AM
Your item apply to the category "loot"?


Title: Re: Item system
Post by: Brendan on October 01, 2009, 11:28:48 AM
Well i create the item via Xtem editor in the grotto ?

So if thats loot then yes


Title: Re: Item system
Post by: Rohen on October 01, 2009, 10:22:49 PM
You have to name a class during the creation progress of your item. This has to be "loot", otherwise the shop and the findloot.php cannot work. But thats written in the file instructions and i think even here in this thread.


Title: Re: Item system
Post by: Brendan on October 01, 2009, 10:26:49 PM
So i have to edit the code to add the loot


Title: Re: Item system
Post by: Rohen on October 01, 2009, 10:37:22 PM
Why edit the code?

Item Editor -> Item Class -> enter "Loot" ready.


Title: Re: Item system
Post by: Brendan on October 01, 2009, 10:52:46 PM
My one is

Grotto = Xtem Editor = Create Item, Show All Items, Create Buff, Show All Buffs

Thats it!


Title: Re: Item system
Post by: Rohen on October 01, 2009, 10:58:46 PM
Create Item -> Tab Page "Basic Information" -> 2. Field "Item Category", thats where you entered "Balls"


Title: Re: Item system
Post by: Brendan on October 01, 2009, 11:00:48 PM
so the category will be *loot*


Title: Re: Item system
Post by: windsummoner on September 08, 2010, 08:51:05 PM
Uhh... i'm using this module too. I love it! But i wonder if i can make the item droppable from a creature. I mean when i kill a bunny, it will drop carrot, not any other items. ^^ And the custom value in tab Value, what is it for and how to use it? I think i really need more intructions. Thanks.


Title: Re: Item system
Post by: Iori on September 09, 2010, 12:16:30 AM
Uhh... i'm using this module too. I love it! But i wonder if i can make the item droppable from a creature. I mean when i kill a bunny, it will drop carrot, not any other items. ^^ And the custom value in tab Value, what is it for and how to use it? I think i really need more intructions. Thanks.

Specific droppable items...something like this (http://dragonprime.net/index.php?topic=6802.0)?

The custom value is not used for anything by default, but if you make a module that introduces some other form of currency, you may use the custom value field to store the item costs for that currency.


Title: Re: Item system
Post by: windsummoner on September 09, 2010, 12:55:11 AM
Wow, thank you so much! *hug* I was searching everywhere (not everywhere now) for it. Thank you again! Btw, i encounter some errors but i don't understand it at all. Here.

Code:
The loiterer takes a look at your belongings to check what he might be interested in and then says:

"Ahhh! A lot of precious item you have there. Come Closer!" PHP Warning: "htmlentities() [function.htmlentities]: Invalid multibyte sequence in argument"
in /home/vol3/oni.cc/onic_5875271/htdocs/lib/output.php at 188.
Call Stack:
2: htmlentities("", 2, "UTF-8") called from /home/vol3/oni.cc/onic_5875271/htdocs/lib/output.php on line 188
3: appoencode("`HJ`Hunk`n`^8`0 Gold, `%0...", false) called from /home/vol3/oni.cc/onic_5875271/htdocs/lib/output.php on line 840
4: private_addnav(Array(

    0=>"%s`n`^%s`0 Gold, `%%%s`0 ...", 1=>"Junk", 2=>"8", 3=>"0", 4=>"2"

), "runmodule.php?module=basi...", false) called from on line
5: call_user_func_array("private_addnav", Array(

    0=>Array(

        0=>"%s`n`^%s`0 Gold, `%%%s`0 ...", 1=>"Junk", 2=>"8", 3=>"0", 4=>"2"

    ), 1=>"runmodule.php?module=basi...", "translate"=>false

)) called from /home/vol3/oni.cc/onic_5875271/htdocs/lib/output.php on line 646
6: buildnavs() called from /home/vol3/oni.cc/onic_5875271/htdocs/lib/pageparts.php on line 117
7: page_footer() called from /home/vol3/oni.cc/onic_5875271/htdocs/modules/basicitemshop.php on line 238
8: basicitemshop_run() called from /home/vol3/oni.cc/onic_5875271/htdocs/runmodule.php on line 33

How to fix this? Can my players see this too?


Title: Re: Item system
Post by: Afkamm on September 09, 2010, 03:46:02 AM
The basicitemshop.php module is said to be buggy. Which version are you using?

I've run searches on "Hunk/Junk/unk" and come up with no possible matches to the (3:) message in the error.

And yes your player's will see that error.


Title: Re: Item system
Post by: windsummoner on September 09, 2010, 08:20:58 PM
I'm using this version. The attachment file. ^^ I download it from somewhere on Dragonprime wikipedia or Downloads tab. I deleted the Junk item and added another name. It's still the same. What is this bug?

Code:
The shopkeeper takes a look at your belongings to check what he might be interested in and then says:

"Look interesting, buddie. Come closer!" PHP Warning: "htmlentities() [function.htmlentities]: Invalid multibyte sequence in argument"
in /home/vol3/oni.cc/onic_5875271/htdocs/lib/output.php at 188.
Call Stack:
2: htmlentities("", 2, "UTF-8") called from /home/vol3/oni.cc/onic_5875271/htdocs/lib/output.php on line 188
3: appoencode("`HG`Hreen Herb`n`^8`0 Gol...", false) called from /home/vol3/oni.cc/onic_5875271/htdocs/lib/output.php on line 840
4: private_addnav(Array(

    0=>"%s`n`^%s`0 Gold, `%%%s`0 ...", 1=>"Green Herb", 2=>"8", 3=>"0", 4=>"1"

), "runmodule.php?module=basi...", false) called from on line
5: call_user_func_array("private_addnav", Array(

    0=>Array(

        0=>"%s`n`^%s`0 Gold, `%%%s`0 ...", 1=>"Green Herb", 2=>"8", 3=>"0", 4=>"1"

    ), 1=>"runmodule.php?module=basi...", "translate"=>false

)) called from /home/vol3/oni.cc/onic_5875271/htdocs/lib/output.php on line 646
6: buildnavs() called from /home/vol3/oni.cc/onic_5875271/htdocs/lib/pageparts.php on line 117
7: page_footer() called from /home/vol3/oni.cc/onic_5875271/htdocs/modules/basicitemshop.php on line 249
8: basicitemshop_run() called from /home/vol3/oni.cc/onic_5875271/htdocs/runmodule.php on line 33

If you have some free times, could you visit my site? I will grant you permissions to see debug and something like that. I'm such a bad admin. hahah... thank you!

Edit: Uh... i asked my friend. He told me that's not a DEADLY bug so just hide them away. Is it right? He don't know about LotGD. I only show him the error message. T__T If i can just hide them away from my player, please show me how. I don't want troubles.

Edit2: Sorry for edit post again. ^^ I experienced another bug. When i set the price of item is 0 gold and X gem, the optioni to buy how many item is not working.


Title: Re: Item system
Post by: Afkamm on September 10, 2010, 02:45:42 AM
Oh yeah, I see where the problem is coming from. It's the navigational links that are created based on the items you have... Ran out of time, will have to look at this later.

Why would you want to hide them? They're there so you can see and then fix them. :-)

I don't use the item module so can't really comment on the gold/gems thing.


Title: Re: Item system
Post by: windsummoner on September 10, 2010, 06:18:40 PM
No, i don't really want to hide them. My friend told me that is not a deadly error, just a buggy. So i don't have to solve it (or he doesn't want to solve it) T__T The navigational links? I thought so and look into the output.php and... well, i'm not PHP coder. heheh... i don't understand those codes at all.

Oh oh, i just remember. My LotGD server list page got the same problem. In the list, there're many warning like this one. I thought it's because of LotGD main server list. The problem occured since i setup the game. I didn't change anything yet. *sigh*

Thank you, Afkamm.


Title: Re: Item system
Post by: Afkamm on September 11, 2010, 04:07:20 AM
Ok, your problem is the UTF-8 charset you've entered into the game setting's "translation setup" tab for htmlentities.

By default it's ISO-8859-1 (http://uk.php.net/manual/en/function.htmlentities.php). I entered UTF-8 into my test server which is all english and has no translations at all and I got the errors you're getting.

Is there no other charset that you can use?


Title: Re: Item system
Post by: windsummoner on September 12, 2010, 08:38:07 AM
I don't know if i can use another charset. I need to translate my game into Vietnamese. So if i change it back to iso, the game will work well again?


Title: Re: Item system
Post by: Afkamm on September 12, 2010, 08:43:12 AM
No idea, you'll just have to try and see which works best without giving you errors. :-)


Title: Re: Item system
Post by: windsummoner on September 12, 2010, 08:57:14 PM
Thank you so much! Do you have any suggestions on charset i can/ should use? I can't use ISO-8859-1 because it doesn't support my language characters. *sigh*

Edit: Old question... can i hide the error warnings? The module functions well. Nothing went wrong. ^^


Title: Re: Item system
Post by: Boris735 on September 13, 2010, 12:34:08 AM
You could perhaps try ISO8859-15 -- that should have more of the missing characters, I think.

I'm afraid that those error messages will be hard to get rid of -- according to this page (http://insomanic.me.uk/post/191397106/php-htmlspecialchars-htmlentities-invalid) they appear when you have told the system not to show them. *rolls eyes*

It seems likely that you will have difficulties with this and htmlentities(); as that link mentions, using substr() as the game code does is not valid with UTF-8.


Title: Re: Item system
Post by: windsummoner on September 13, 2010, 06:34:35 PM
Nice, Boris. ^^ I understand now. I looked at my settings to set show error = false but the error ... i will try to turn it on and hope people won't see errors. Thanks! ^^

Oh, i did use ISO-8859-15 but it doesn't work with me.


Title: Re: Item system
Post by: Boris735 on September 13, 2010, 10:41:56 PM
Let me know if that doesn't work out, or has other undesirable consequences.  There's an ugly workaround possible of disabling the error reporting for this specific error only, but it's fiddly and has the usual disadvantages of core edits.


Title: Re: Item system
Post by: windsummoner on September 14, 2010, 01:23:49 AM
Boris, i have a bad news. That doesn't work! :( The error still there. I guess i can't use item system on my server because of conflict with UTF-8. *sigh* What a pity! I love this module so much...


Title: Re: Item system
Post by: Afkamm on September 14, 2010, 05:12:34 AM
Sadly it wont be just the item module that you'll get this problem with.

I was going to suggest removing the colour tags, but it's not them. Then I thought it might be the access keys code (that's where the `H comes from, for keyboard shortcuts), but it's not that.

Son of a ... that stupid little character... :)

Yay found the problem. :D

I was puzzled as to why there was no error on the buy page, but there was on the sell page. There was only one difference in the links.
Code:
`n(`2%s Stck`0)

See that 'u' character with the 2 dots above it? That's what's causing the problem. "Stck" is a German word meaning piece, as in 2 pieces.

There are 2 ways to fix this.
1) Edit the files in question and remove/replace any "non-English" characters. There are 4 "Stck" in the "basicitemshop.php" module file.

2) Change your charset to "ISO-8859-1" and translate the offending word. Once you have done this you can change the charset back to "UTF-8".

Problem solved. :)


Title: Re: Item system
Post by: windsummoner on September 14, 2010, 10:16:07 AM
OMG, you awesome!!!!!!! You saved me! It works! Really works! It runs smoothly now. Thank you! *big hug Afk*

Edit: Oh, the "Stck" is not only in basicitemshop.php, it appears in lib/itemhandler.php too. This is for someone has the same problem to me. Say thank to Afk! *jump jump*

Edit again: ... now i want to ask about something else. Somehow, when i create an item and set it "equippable" then it won't appear in the "inventory". Set it "unequippable" and it appears again. T__T Is that useless to make equipment with this?


Title: Re: Item system
Post by: RaynDarren on December 31, 2013, 02:22:47 PM
Has anyone run into the problem of buffs failing to save when they're set with an item? I've only recently noticed this problem. I've made around 150 buffs and at about buff 127 they stop saving when you add them to items. Everything is set to buff 127. Any ideas?


Title: Re: Item system
Post by: Rohen on January 08, 2014, 05:26:34 AM
Simply, check the database field. If i remember correctly, its set to Tinyint. Change it to int or something similar.


Title: Re: Item system
Post by: RaynDarren on January 09, 2014, 03:34:46 PM
Thanks!


Title: Re: Item system
Post by: Nightborn on May 13, 2017, 03:21:04 AM
Small bug report, don't know if any of you encountered it.

if you have an item with charges >0, and multiple of it in the inventory... you can activate the buff from the item without removing an item or a charge.

Change backpack.php Line 83
83                         if ($acitem['charges'] > 1) uncharge_item((int)$id,1);
To
83                         if ($acitem['charges'] > 1) uncharge_item((int)$id);

The ,1 was meant to be a number of charges. Sadly, the function expects the account number. So, if you test this as admin with acctid=1, it works... for anybody else it doesnt. :D

© 2017 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines