Page 1 of 1

new structs

Posted: Sun Jun 04, 2017 11:33 am
by Ememjr
here are new world and item structs to support live client, they will probably need more tweaking but now at least you can examine most items, spells armor etc and see the proper results
i will post code changes as well when i get them organized and get all my testing junk out of it

Re: new structs

Posted: Sun Jun 04, 2017 12:05 pm
by Ememjr
worlddatabase.cpp changes
add min_class_skill_req to the below line

Code: Select all

	if( !database_new.Select(&result, "SELECT s.`id`, `name`, `description`, `type`, `class_skill`, `mastery_skill`, `min_class_skill_req`, `tier`, `hp_req`, `power_req`, `cast_time`, `recast`, `radius`, `max_aoe_targets`, `req_concentration`, `range`, `duration1`, `duration2`, `unknown9`,`resistibility`, `hp_upkeep`, `power_upkeep`, `duration_until_cancel`, `target_type`, `recovery`, `power_req_percent`, `hp_req_percent`, `icon`, `icon_heroic_op`, `icon_backdrop`, `success_message`, `fade_message`, `cast_type`, `lua_script`, `call_frequency`, `interruptable`, `spell_visual`, `effect_message`, `min_range`, `can_effect_raid`, `affect_only_group_members`, `hit_bonus`, `display_spell_tier`, `friendly_spell`, `group_spell`, `spell_book_type`, s.is_active, savagery_req, savagery_req_percent, savagery_upkeep, dissonance_req, dissonance_req_percent, dissonance_upkeep, linked_timer_id, det_type, incurable, control_effect_type, cast_while_moving, casting_flags, persist_through_death, not_maintained, savage_bar, savage_bar_slot, soe_spell_crc "
									"FROM spells s, spell_tiers st "
									"WHERE s.id = st.spell_id AND s.is_active = 1 "
									"ORDER BY s.`id`, `tier`") )
add the third line below

Code: Select all

	/* Skill Requirements */
			data->class_skill				= result.GetInt32Str("class_skill");
			data->mastery_skill				= result.GetInt32Str("mastery_skill");
			data->min_class_skill_req		= result.GetInt16Str("min_class_skill_req");
add last line below

Code: Select all

	/* Spell Parameters */
			data->call_frequency			= result.GetInt32Str("call_frequency");
			data->cast_time					= result.GetInt16Str("cast_time");
			data->duration1					= result.GetInt32Str("duration1");
			data->duration2					= result.GetInt32Str("duration2");
			data->hit_bonus					= result.GetFloatStr("hit_bonus");
			data->unknown9					= result.GetInt8Str("unknown9");
data base change in items
as the sell_status_amount field
db item.JPG
changes to items.h

Code: Select all

add the sell_status line below
	int8					stack_count;
	int32					sell_price;
	int32					sell_status;
	int32					max_sell_value;
	bool					save_needed;
	int8					weapon_type;
	string					adornment;
changes to items.cpp

add sell_status line below

Code: Select all

Item::Item(){
	item_script = "";
	sell_price = 0;
	sell_status = 0;
	max_sell_value = 0;
	save_needed = true;
change below line from a 1 to show_name

Code: Select all

	if(show_name)
		packet->setSubstructSubstructDataByName("header", "info_header", "show_name", show_name);
	if(packet_type == 0)
add unknown21 line, not sure yet why this worked but it did, and change FFFFFFFF to 00000000 in both places

Code: Select all

	packet->setSubstructDataByName("header_info", "unknown21", 0x00000000);
	packet->setSubstructDataByName("header_info", "condition", generic_info.condition);
	packet->setSubstructDataByName("header_info", "weight", generic_info.weight);
	if(generic_info.skill_req1 == 0)
		packet->setSubstructDataByName("header_info", "skill_req1", 0x00000000);
	else
		packet->setSubstructDataByName("header_info", "skill_req1", generic_info.skill_req1);
	if(generic_info.skill_req2 == 0)
		packet->setSubstructDataByName("header_info", "skill_req2", 0x00000000);
	else
change footer _unknown2 to 0 in both places

Code: Select all

	packet->setSubstructDataByName("footer", "recommended_level", details.recommended_level);
	if(generic_info.adventure_default_level > 0){
		packet->setSubstructDataByName("footer", "required_level", generic_info.adventure_default_level);
		packet->setSubstructDataByName("footer", "footer_unknown2", 0);// remove defualt
	}
	else{
		packet->setSubstructDataByName("footer", "required_level", generic_info.tradeskill_default_level);		
		packet->setSubstructDataByName("footer", "footer_unknown2", 0);//remove default
	}

Re: new structs

Posted: Sun Jun 04, 2017 12:09 pm
by Ememjr
part 2
still in items.cpp
add the first 2 packet-> lines

Code: Select all

if(player) {
							packet->setSubstructDataByName("header_info", "footer_type", 0);
							packet->setDataByName("unknown2", 1);// teset 63119
							spell->SetPacketInformation(packet, player->GetZone()->GetClientBySpawn(player));
							if (player->HasSpell(skill_info->spell_id, skill_info->spell_tier))
								packet->setDataByName("scribed", 1);
add the status_item packet line

Code: Select all

packet->setSubstructDataByName("footer", "status_item", 0);
	
	if (IsHarvest()){
		packet->setSubstructDataByName("footer", "crafting_flag", 1);
		
	}
changes to spells.h
add the min_clss_skill_req and unknown9 lines below

Code: Select all

struct SpellData{
	int32	spell_book_type;
	int32	id;
	sint16	icon;
	int16	icon_heroic_op;
	int16	icon_backdrop;
	int16	type;
	int32	class_skill;
	int32	mastery_skill;
	int16	min_class_skill_req;
	int8	num_levels;
	int8	tier;
	int16	hp_req;
	int16	hp_upkeep;
	int16	power_req;
	int16	power_upkeep;
	int16	savagery_req;
	int16	savagery_upkeep;
	int16	dissonance_req;
	int16	dissonance_upkeep;
	int8	target_type;
	int16	cast_time;
	float	recovery;
	float	recast;
	int32	linked_timer;
	float	radius;
	int16	max_aoe_targets;
	int8    friendly_spell;
	int16	req_concentration;
	float	range;
	int32	duration1;
	int32	duration2;
	int8	unknown9;
	float	resistibility;
in spells.cpp

add the if else section below

Code: Select all

void Spell::SetPacketInformation(PacketStruct* packet, Client* client, bool display_tier){

	packet->setSubstructDataByName("spell_info", "id", spell->id);
	packet->setSubstructDataByName("spell_info", "icon",spell->icon);
	packet->setSubstructDataByName("spell_info", "icon2",spell->icon_heroic_op);	// fix struct element name eventually
	packet->setSubstructDataByName("spell_info", "icontype",spell->icon_backdrop);	// fix struct element name eventually
	if (packet->GetVersion() >= 63119) {
		packet->setSubstructDataByName("spell_info", "version", 0x04);  //63119 from 0x11 to 0x04
		packet->setSubstructDataByName("spell_info", "sub_version", 0x24); //63119 from 0x14 to 0x24
	}
	else	{
		packet->setSubstructDataByName("spell_info", "version", 0x11); 
		packet->setSubstructDataByName("spell_info", "sub_version", 0x14); 
	}
	packet->setSubstructDataByName("spell_info", "type", spell->type); 

add the 2nd and 5th lines below

Code: Select all

packet->setSubstructDataByName("spell_info", "type", spell->type); 
	packet->setSubstructDataByName("spell_info", "unknown_MJ1d", 1); //63119 test
	packet->setSubstructDataByName("spell_info", "class_skill", spell->class_skill);
	packet->setSubstructDataByName("spell_info", "mastery_skill", spell->mastery_skill);
	packet->setSubstructDataByName("spell_info", "min_class_skill_req", spell->min_class_skill_req);
	packet->setSubstructDataByName("spell_info", "duration_flag", spell->duration_until_cancel);
change display_spell_tier to a 1
add unkown9 line below
add last 3 lines

Code: Select all

if(display_tier == true)
		packet->setSubstructDataByName("spell_info", "display_spell_tier", spell->display_spell_tier);
	else
		packet->setSubstructDataByName("spell_info", "display_spell_tier", 1);
	packet->setSubstructDataByName("spell_info", "range",spell->range);
	packet->setSubstructDataByName("spell_info", "duration1",spell->duration1);
	packet->setSubstructDataByName("spell_info", "duration2",spell->duration2);
	packet->setSubstructDataByName("spell_info", "unknown9", spell->unknown9);// testing unknown9 63119
	packet->setSubstructDataByName("spell_info", "can_effect_raid",spell->can_effect_raid);
	packet->setSubstructDataByName("spell_info", "affect_only_group_members",spell->affect_only_group_members);
	packet->setSubstructDataByName("spell_info", "group_spell",spell->group_spell);
	packet->setSubstructDataByName("spell_info", "resistibility",spell->resistibility);
	packet->setSubstructDataByName("spell_info", "hit_bonus", spell->hit_bonus);

	packet->setSubstructDataByName("spell_info", "unknown12",0xff);
	packet->setSubstructDataByName("spell_info", "unknown12b", 0xef);
	packet->setSubstructDataByName("spell_info", "unknown12c",0x3f);

add sub_packet_type =0x80

Code: Select all

EQ2Packet* Spell::SerializeSpell(Client* client, bool display, bool trait_display, int8 packet_type, int8 sub_packet_type, const char* struct_name){
	int16 version = 1;
	sub_packet_type = 0x80;
	if(client)
		version = client->GetVersion();
i think thats it hopefully i didnt miss anything if i did blame it on winmerge( i havent figured out how to make a merge file yet)
some changes may not end up being neccary but this is what i got it to work

Re: new structs

Posted: Sun Jun 04, 2017 4:05 pm
by Zcoretri
Do you need me to add this to public SVN?

Re: new structs

Posted: Sun Jun 04, 2017 4:32 pm
by Jabantiz
Thanks for this, I will get the sturcts up soon, c++ there is a few issues I see though, will have to go over it more thoroughly when I have the time.
Ememjr wrote: Sun Jun 04, 2017 12:05 pm add unknown21 line, not sure yet why this worked but it did, and change FFFFFFFF to 00000000 in both places
0 is a skill id to the client, if there is no skill req it need to default to 0xFFFFFFFF (-1) indicating there is no skills req.
Ememjr wrote: Sun Jun 04, 2017 12:09 pm change display_spell_tier to a 1
add unkown9 line below
add last 3 lines

Code: Select all

if(display_tier == true)
		packet->setSubstructDataByName("spell_info", "display_spell_tier", spell->display_spell_tier);
	else
		packet->setSubstructDataByName("spell_info", "display_spell_tier", 1);
Changing display_spell_tier here would mean it is always displayed and that is not what we want/need, the portion in the else should be 0.
Ememjr wrote: Sun Jun 04, 2017 12:09 pm
add sub_packet_type =0x80

Code: Select all

EQ2Packet* Spell::SerializeSpell(Client* client, bool display, bool trait_display, int8 packet_type, int8 sub_packet_type, const char* struct_name){
	int16 version = 1;
	sub_packet_type = 0x80;
	if(client)
		version = client->GetVersion();
Overriding the sub packet is probably a bad idea, there are some cases that it isn't set, and may cause issues with other stuff.

Re: new structs

Posted: Sun Jun 04, 2017 5:08 pm
by Ememjr
i reverted those corrections you made 2 of them i had in my notes that said to revert and apparently it slipped,

removed the subpacket 0x80 and change display tier back to 0


the third one with FFFFFFFF

can you explain why you have as FFFFFFFF and not 00000000, it then packets themselves on live server with packet collector they are 00000000
i changed on my side to make it match as close as possible.

is there really a difference

as a side note, i have not been able to get items with hit_bonus to display correctly yet, those just popped up this morning
hopefully ill have a fix shortly when i find some items on live with hit_bonus that i can compare with

Re: new structs

Posted: Sun Nov 19, 2017 2:59 pm
by Gangrenous
How often is live changing these days? Once a month or so?

Re: new structs

Posted: Sun Nov 19, 2017 8:16 pm
by Ememjr
well the structs havent changed in a month, in fact the clinet didnt change for a cople weeks either, since all changes right now are pretty much going tinto beta
there willbe alot of changes for beta to work, i suggest making copies noe of your everquest2.exe at a minimum since it may take a month or more to get leve working again after exansion release

Re: new structs

Posted: Thu Nov 30, 2017 2:35 pm
by Scribble
Gangrenous wrote: Sun Nov 19, 2017 2:59 pm How often is live changing these days? Once a month or so?
Spotted!