Possible issue using GetItem() in SharedDatabase::SetStartingItems()
Heyas,
I add some items to players inventories during character creation and everything works fine except for an item that has a click effect on it. In the SharedDatabase::SetStartingItems() method I add a charm for each class like this. Code:
// Charms This makes me think that something is not getting initialised correctly when calling GetItem() at this point. Any ideas? I looked at the code but I can't find anything which would cause this. EDIT: I am using HoT client and rev 2214 of the source. |
this doesn't address the issue you're having, but why not just edit the starting_items table in the database?
|
Because it is /much/ easier (for me) to change 10 lines of code in the source. The starting_items table offers flexibility I frankly don't need.
|
Quote:
in SetStartingItems(), it looks as though CreateBaseItem() is called on the result of GetItem(), and then that item instance is passed to inv->PutItem(). |
I changed my code to use CreateBaseItem() however the result is still the same. I thought you had it solved c0ncrete! Thank you :):)
EDIT: New code FYI: Code:
// Class Charms. |
that looks like exactly what SetStartingItems() is doing now. i'm at a loss.
|
What is MaxCharges set to on the item?
Did you try putting the item in the starting_items table? Did it work? Honestly, I can't imagine a situation where having to recompile the code to change the items is easier than just adding them to the database, but do what you like. |
Hi lerxst2112,
maxcharges is -1 in the db. I cant put items into the starting_items table because it is *gone*, deleted. As I stated, I do not need the flexibility offered by the starting_items table, I do not change what items players start with now that they are set. The concept of putting starting_items into a table is just a design choice, probably to make customisation easier for people not comfortable changing the source. The devs just chose to put starting items in a table and decided to hardcode starting stats yet both can be customised. |
Quote:
As an aside, using the starting_items table is good design. You may not need the flexibility, but what about the convenience? Once you have your build environment it's pretty easy to recompile but using the table in the database is going to be faster to do in any case, fewer keystrokes, and less opportunity for errors that spawn support threads. In terms of time alone you're at a significant net loss. |
Quote:
Code:
ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, sint16 charges) { |
You're right, I didn't dig into it deep enough, but in every other case in SetStartingItems charges is set, so it might be worth a try to specify your charges.
You could also revert and just do this: Code:
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
FYI I downloaded the rev2214 binaries again and the rev2214 DB, made a new DB and set it all up cleanly. I add JBoots to starting_items, create a new toon, right click the boots and get 'Item is out of charges'.
|
Quote:
|
Quote:
|
Quote:
|
All times are GMT -4. The time now is 04:35 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.