Changes required for examine items

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Changes required for examine items

Post by Ememjr » Mon Jun 19, 2017 3:05 pm

itemsDB.cpp

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"));
in items.h add the 4 lines noted below

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 line
in items.cpp change/add the 4 items marked below

Code: 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;

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: Changes required for examine items part2 (flags2)

Post by Ememjr » Mon Jun 19, 2017 4:30 pm

this section adds code etc for flags2 when examining items

Items table
add columns you are missing and remove flags2_64,
reforged,etheral, refined.
alteritems.JPG
items.h
Add these defines after #define FLAGS_32768

Code: Select all

#define ORNATE			1
#define HEIRLOOM		2
#define APPEARANCE_ONLY	4
#define UNLOCKED		8
#define REFORGED		16
#define NO_REPAIR		32
#define ETHERAL			64
#define REFINED			128
#define FLAGS2_256		256 //not used at this time
#define FLAGS2_512		512//not used at this time
#define FLAGS2_1024		1024//not used at this time
#define FLAGS2_2048		2048//not used at this time
#define FLAGS2_4096		4096//not used at this time
#define FLAGS2_8192		8192//not used at this time
#define FLAGS2_16384	16384//not used at this time
#define FLAGS2_32768	32768//not used at this time
add

Code: Select all

int16					item_flags2;
after

Code: Select all

struct Generic_Info{
		int8					show_name;
		int8					creator_flag;
		int16					item_flags;
Items.cpp
add the last line

Code: Select all

        packet->setSubstructDataByName("header_info", "icon", details.icon);
	packet->setSubstructDataByName("header_info", "tier", details.tier);
 	packet->setSubstructDataByName("header_info", "flags", generic_info.item_flags);
	packet->setSubstructDataByName("header_info", "flags2", generic_info.item_flags2);
add this entire piece of code after

Code: Select all

bool Item::CheckFlag2(int32 flag){
	int32 value = 0;
	int32 flag_val = generic_info.item_flags2;
	while (flag_val > 0){
		if (flag_val >= FLAGS2_32768) 
			value = FLAGS2_32768;
		else if (flag_val >= FLAGS2_16384)
			value = FLAGS2_16384;
		else if (flag_val >= FLAGS2_8192)
			value = FLAGS2_8192;
		else if (flag_val >= FLAGS2_4096)
			value = FLAGS2_4096;
		else if (flag_val >= FLAGS2_2048)
			value = FLAGS2_2048;
		else if (flag_val >= FLAGS2_1024)
			value = FLAGS2_1024;
		else if (flag_val >= FLAGS2_512)
			value = FLAGS2_512;
		else if (flag_val >= FLAGS2_256)
			value = FLAGS2_256;
		else if (flag_val >= REFINED)
			value = REFINED;
		else if (flag_val >= ETHERAL)
			value = ETHERAL;
		else if (flag_val >= NO_REPAIR)
			value = NO_REPAIR;
		else if (flag_val >= REFORGED)
			value = REFORGED;
		else if (flag_val >= UNLOCKED)
			value = UNLOCKED;
		else if (flag_val >= APPEARANCE_ONLY)
			value = APPEARANCE_ONLY;
		else if (flag_val >= HEIRLOOM)
			value = HEIRLOOM;
		else if (flag_val >= ORNATE)
			value = ORNATE;
		if (value == flag)
			return true;
		else
			flag_val -= value;
	}
}
after

Code: Select all

bool Item::CheckFlag(int32 flag){
	int32 value = 0;
	...
	return false;
}
itemsdb.cpp
add this entire code

Code: Select all

if (result->GetInt8Str("ornate") == 1)
		item->generic_info.item_flags2 += ORNATE;

	if (result->GetInt8Str("heirloom") == 1)
		item->generic_info.item_flags2 += HEIRLOOM;

	if (result->GetInt8Str("appearance_only") == 1)
		item->generic_info.item_flags2 += APPEARANCE_ONLY;

	if (result->GetInt8Str("unlocked") == 1)
		item->generic_info.item_flags2 += UNLOCKED;

	if (result->GetInt8Str("reforged") == 1)
		item->generic_info.item_flags2 += REFORGED;

	if (result->GetInt8Str("norepair") == 1)
		item->generic_info.item_flags2 += NO_REPAIR;

	if (result->GetInt8Str("etheral") == 1)
		item->generic_info.item_flags2 += ETHERAL;

	if (result->GetInt8Str("refined") == 1)
		item->generic_info.item_flags2 += REFINED;

	if (result->GetInt8Str("flags2_256") == 1)
		item->generic_info.item_flags2 += FLAGS2_256;
after

Code: Select all

if (result->GetInt8Str("flags_16384") == 1)
		item->generic_info.item_flags += FLAGS_16384;

	if (result->GetInt8Str("flags_32768") == 1)
		item->generic_info.item_flags += FLAGS_32768;
You do not have the required permissions to view the files attached to this post.

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: Changes required for examine items

Post by Ememjr » Fri Aug 14, 2020 2:03 am

these are changes to change the item flags from FLAGS_16384,FLAGS_32768 to NO_TRANSMUTE, NO_SALVAGE in both DB and code
posing here in case anyone want to implement on there private server prior to being adding to the dev code

Code: Select all

ALTER TABLE `eq2devworld7`.`items`
  CHANGE `flags_16384` `no_transmute` TINYINT UNSIGNED DEFAULT 0 NOT NULL,
  CHANGE `flags_32768` `no_salvage` TINYINT UNSIGNED DEFAULT 0 NOT NULL;
items.h
FROM

Code: Select all

#define FLAGS_16384		16384
#define FLAGS_32768		32768
TO

Code: Select all

#define NO_TRANSMUTE	16384
#define NO_SALVAGE		32768
ITEMS.CPP FUNCTION CheckFlag
from

Code: Select all

if (flag_val >= FLAGS_32768) //change this
			value = FLAGS_32768;
		else if (flag_val >= FLAGS_16384) //change this
			value = FLAGS_16384;
to

Code: Select all

if (flag_val >= NO_SALVAGE) //change this
			value = NO_SALVAGE;
		else if (flag_val >= NO_TRANSMUTE) //change this
			value = NO_TRANSMUTE;

ItemsDB.cpp void WorldDatabase::LoadDataFromRow(DatabaseResult* result, Item* item)
from

Code: Select all

if (result->GetInt8Str("flags_16384") == 1)
		item->generic_info.item_flags += FLAGS_16384;

	if (result->GetInt8Str("flags_32768") == 1)
		item->generic_info.item_flags += FLAGS_32768;
to

Code: Select all

if (result->GetInt8Str("no_transmute") == 1)
		item->generic_info.item_flags += FLAGS_16384;

	if (result->GetInt8Str("no salvage") == 1)
		item->generic_info.item_flags += FLAGS_32768;	


Transmute.cpp bool Transmute::ItemIsTransmutable(Item* item)
from

Code: Select all

const int32 disqualifyFlags = NO_ZONE | NO_VALUE | TEMPORARY | NO_DESTROY | FLAGS_16384;
to

Code: Select all

const int32 disqualifyFlags = NO_ZONE | NO_VALUE | TEMPORARY | NO_DESTROY | NO_TRANSMUTE;

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests