Changes required for examine items
Posted: Mon Jun 19, 2017 3:05 pm
itemsDB.cpp
Add the 4 if statements where noted below
in items.h add the 4 lines noted below
in items.cpp change/add the 4 items marked below
Add the 4 if statements where noted below
Code: Select all
void WorldDatabase::LoadDataFromRow(DatabaseResult* result, Item* item)
{
LogWrite(ITEM__DEBUG, 5, "Items", "\tSetting details for item ID: %i", result->GetInt32Str("id"));
item->details.item_id = result->GetInt32Str("id");
int8 size = strlen(result->GetStringStr("name"));
if(size > 63)
size = 63;
item->name = string(result->GetStringStr("name"));
item->lowername = ToLower(item->name);
item->details.icon = result->GetInt16Str("icon");
item->details.count = result->GetInt16Str("count");
item->details.tier = result->GetInt8Str("tier");
item->generic_info.weight = result->GetInt32Str("weight");
if( strlen(result->GetStringStr("description")) > 0 )
item->description = string(result->GetStringStr("description"));
item->generic_info.show_name = result->GetInt8Str("show_name");
if( result->GetInt8Str("nodestroy") == 1 )
item->generic_info.item_flags += ATTUNEABLE;
if( result->GetInt8Str("nodestroy") == 1 )
item->generic_info.item_flags += ARTIFACT;
if( result->GetInt8Str("lore") == 1 )
item->generic_info.item_flags += LORE;
if( result->GetInt8Str("temporary") == 1 )
item->generic_info.item_flags += TEMPORARY;
if( result->GetInt8Str("notrade") == 1 )
item->generic_info.item_flags += NO_TRADE;
if( result->GetInt8Str("novalue") == 1 )
item->generic_info.item_flags += NO_VALUE;
if( result->GetInt8Str("nozone") == 1 )
item->generic_info.item_flags += NO_ZONE;
if( result->GetInt8Str("nodestroy") == 1 )
item->generic_info.item_flags += NO_DESTROY;
if (result->GetInt8Str("crafted") == 1)
item->generic_info.item_flags += CRAFTED;
if( result->GetInt8Str("good_only") == 1 )
item->generic_info.item_flags += GOOD_ONLY;
if( result->GetInt8Str("evil_only") == 1 )
item->generic_info.item_flags += EVIL_ONLY;
if (result->GetInt8Str("stacklore") == 1)
item->generic_info.item_flags += STACK_LORE;//add this line
if (result->GetInt8Str("lore_equip") == 1)
item->generic_info.item_flags += LORE_EQUIP;//add this line
if (result->GetInt8Str("flags_16384") == 1)
item->generic_info.item_flags += FLAGS_16384;//add this line
if (result->GetInt8Str("flags_32768") == 1)
item->generic_info.item_flags += FLAGS_32768;//add this line
// add more Flags/Flags2 here
if( result->GetInt32Str("skill_id_req") == 0 )
item->generic_info.skill_req1 = 0xFFFFFFFF;
else
item->generic_info.skill_req1 = result->GetInt32Str("skill_id_req");
if( result->GetInt32Str("skill_id_req2") == 0 )
item->generic_info.skill_req2 = 0xFFFFFFFF;
else
item->generic_info.skill_req2 = result->GetInt32Str("skill_id_req2");
item->generic_info.skill_min = result->GetInt16Str("skill_min");
if( result->GetInt32Str("slots") > 0)
item->SetSlots(result->GetInt32Str("slots"));Code: Select all
#define ATTUNED 1
#define ATTUNEABLE 2
#define ARTIFACT 4
#define LORE 8
#define TEMPORARY 16
#define NO_TRADE 32
#define NO_VALUE 64
#define NO_ZONE 128
#define NO_DESTROY 256
#define CRAFTED 512
#define GOOD_ONLY 1024
#define EVIL_ONLY 2048
#define STACK_LORE 4096 //add this line
#define LORE_EQUIP 8192 //add this line
#define FLAGS_16384 16384 //add this line
#define FLAGS_32768 32768 //add this lineCode: Select all
bool Item::CheckFlag(int32 flag){
int32 value = 0;
int32 flag_val = generic_info.item_flags;
while(flag_val>0){
if (flag_val >= FLAGS_32768) //change this
value = FLAGS_32768;
else if (flag_val >= FLAGS_16384) //change this
value = FLAGS_16384;
else if (flag_val >= LORE_EQUIP) //change this
value = LORE_EQUIP;
else if (flag_val >= STACK_LORE) //change this
value = STACK_LORE;
else if(flag_val >= EVIL_ONLY)
value = EVIL_ONLY;
else if(flag_val >= GOOD_ONLY)
value = GOOD_ONLY;
else if(flag_val >= CRAFTED)
value = CRAFTED;
else if(flag_val >= NO_DESTROY)
value = NO_DESTROY;
else if(flag_val >= NO_ZONE)
value = NO_ZONE;
else if(flag_val >= NO_VALUE)
value = NO_VALUE;
else if(flag_val >= NO_TRADE)
value = NO_TRADE;
else if(flag_val >= TEMPORARY)
value = TEMPORARY;
else if(flag_val >= LORE)
value = LORE;
else if(flag_val >= ARTIFACT)
value = ARTIFACT;