getting over my head Adorments
Posted: Sun Jun 11, 2017 5:29 pm
this is for adornments
i have added an code to handle adornments and basically copied and modified how weapon_info,amor_info is in the code , added a table for item_details_adornments, etc etc everything appears to work fine
the debug lines are showing the correct entries 3 are are the same and 3 one i beleive is pulling from the item after its updated
but here in items.cpp, generic_info.item_type is always returning 0 for the item_type
i am attaching itemsdb.cpp, worlddatabase.h,items.h, and items.cpp , maybe someone can help figure what i am doing wrong
i have added an code to handle adornments and basically copied and modified how weapon_info,amor_info is in the code , added a table for item_details_adornments, etc etc everything appears to work fine
Code: Select all
int32 WorldDatabase::LoadAdornments()
{
Query query;
MYSQL_ROW row;
MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT item_id, duration, item_types,slot_type FROM item_details_adornments");
int32 total = 0;
int32 id = 0;
if (result)
{
while (result && (row = mysql_fetch_row(result)))
{
id = strtoul(row[0], NULL, 0);
Item* item = master_item_list.GetItem(id);
if (item)
{
LogWrite(ITEM__DEBUG, 0, "Items", "\tItem Adornment for item_id: %u", id);
LogWrite(ITEM__DEBUG, 0, "Items", "\ttype: %i, Duration: %i, item_types_: %i, slot_type: %i", ITEM_TYPE_ADORNMENT, atoi(row[1]), atoi(row[2]), atoi(row[3]));
item->SetItemType(ITEM_TYPE_ADORNMENT);
item->adornment_info->duration = atof(row[1]);
item->adornment_info->item_types = atoi(row[2]);
item->adornment_info->slot_type = atoi(row[3]);
LogWrite(ITEM__DEBUG, 0, "Items", "\ttype: %i, Duration: %i, item_types_: %i, slot_type: %i",item->generic_info.item_type, item->adornment_info->duration, item->adornment_info->item_types, item->adornment_info->slot_type);
total++;
}
else
LogWrite(ITEM__ERROR, 0, "Items", "Error loading `item_details_shield`, ID: %i", id);
}
}
return total;
}but here in items.cpp, generic_info.item_type is always returning 0 for the item_type
Code: Select all
if(!loot_item){
packet->setSubstructDataByName("header", "item_type", generic_info.item_type);
// LogWrite(WORLD__ERROR, 0, "World", "Robert checking item type");
switch(generic_info.item_type){
case ITEM_TYPE_WEAPON:{
if(weapon_info){