Page 1 of 1

looking for ideas on this Struct

Posted: Thu Jul 27, 2017 7:24 pm
by Ememjr
for AA here is the struct

Code: Select all

<Struct Name="substruct_node_info" ClientVersion="1096">
<Data ElementName="num_node_items" Type="int32" Size="1" />
<Data ElementName="node_item_array" Type="Array" ArraySizeVariable="num_node_items">
  <Data ElementName="parent_id" Type="int32" Size="1" />
  <Data ElementName="parent_req_tier" Type="int8" Size="1" />
  <Data ElementName="spell_id" Type="int32" Size="1" />
  <Data ElementName="active" Type="int8" Size="1" />
  <Data ElementName="spell_name" Type="EQ2_16Bit_String" />
  <Data ElementName="spell_description" Type="EQ2_16Bit_String" />
  <Data ElementName="icon" Type="int16" Size="1" />
  <Data ElementName="icon2" Type="int16" Size="1" />
  <Data ElementName="current_rank" Type="int8" Size="1" />
  <Data ElementName="max_rank" Type="int8" Size="1" />
  <Data ElementName="rank_cost" Type="int8" Size="1" />
  <Data ElementName="min_level" Type="int8" Size="1" />
  <Data ElementName="unknown5_num_items" Type="int8" Size="1" />
  <Data ElementName="unknown5_array" Type="Array" ArraySizeVariable="unknown5_num_items">
    <Data ElementName="unknown5" Type="int32" Size="1" />
  </Data>
  <Data ElementName="unknown6" Type="int32" Size="1" />
  <Data ElementName="unknown7" Type="int8" Size="1" />
  <Data ElementName="classification1" Type="EQ2_16Bit_String" />
  <Data ElementName="points_req" Type="int8" Size="1" />
  <Data ElementName="nknown8" Type="int8" Size="1" />
  <Data ElementName="classification2" Type="EQ2_16Bit_String" />
  <Data ElementName="col" Type="int8" Size="1" />
  <Data ElementName="row" Type="int8" Size="1" />
  <Data ElementName="line_title" Type="EQ2_16Bit_String" />
  <Data ElementName="unknown9" Type="int16" Size="1" />
  <Data ElementName="points_to_unlock" Type="int16" Size="1" />
  <Data ElementName="unknown9b" Type="int16" Size="1" />
</Data>
</Struct>

Code: Select all

Struct Name="WS_AdventureList" ClientVersion="1096" OpcodeName="OP_AdventureList">
<Data ElementName="unknown_aa" Type="int8" Size="1" />
<Data ElementName="num_aa_trees" Type="int32" Size="1" />
<Data ElementName="aa_array" Type="Array" ArraySizeVariable="num_aa_trees">
   <Data ElementName="tab_title" Type="EQ2_16Bit_String" />
   <Data ElementName="tree_node_id" Type="int16" Size="1" />
   <Data ElementName="max_aa" Type="int16" Size="1" />
   <Data ElementName="unknown4" Type="int16" Size="1" />
   <Data ElementName="id" Type="int32" Size="1" />
<Data ElementName="kos_req" Type="int8" Size="1" />
<Data ElementName="node_info" Substruct="substruct_node_info" Size="1" />
<Data ElementName="unknown10" Type="int32" Size="1" />
<Data ElementName="points_spent" Type="int32" Size="1" />

<Data ElementName="unknown11" Type="int16" Size="2" />
<Data ElementName="unknown11a" Type="int8" Size="1" />
</Data>
</Struct>
i am trying to populate the array node_item_array, i found a similar one in items that works useing a substruct here

Code: Select all

packet->setSubstructArrayLengthByName("header_info", "stat_count", item_stats.size() - dropstat);
		dropstat = 0;
		for(int32 i=0;i<item_stats.size();i++){
			ItemStat* stat = item_stats[i];
			if(stat->stat_name.length() > 0)
				packet->setArrayDataByName("stat_name", stat->stat_name.c_str(), i);
			
			if (stat->stat_type == 6){		//Convert stats to proper client
				if (client->GetVersion() >= 63137){  //TEST
					tmp_subtype = stat->stat_subtype;
				}
				else if (client->GetVersion() >= 63119){  //KA
					tmp_subtype = world.GetItemStatKAValue(stat->stat_subtype);
				}
				else if (client->GetVersion() >= 57107){ //TOV
					tmp_subtype = world.GetItemStatTOVValue(stat->stat_subtype);
				}
				else if (client->GetVersion() >= 1193){ //COE
					tmp_subtype = world.GetItemStatCOEValue(stat->stat_subtype);
					//tmp_subtype = stat->stat_subtype;
				}
				else if (client->GetVersion() >= 1096){ //DOV
					tmp_subtype = world.GetItemStatDOVValue(stat->stat_subtype); //comment out for testing
					//tmp_subtype = stat->stat_subtype;  //comment for normal use
				}
			}
			else
				tmp_subtype = stat->stat_subtype;
			if (tmp_subtype == 255){
				
				dropstat += 1;
				//packet->setSubstructArrayLengthByName("header_info", "stat_count", item_stats.size()-dropstat);
			}
			else {
				packet->setArrayDataByName("stat_type", stat->stat_type, i-dropstat);
				packet->setArrayDataByName("stat_subtype", tmp_subtype, i-dropstat);
			}
			/* SF client */
			if (client->GetVersion() >= 63119) {

				if (stat->stat_type == 6){
					packet->setArrayDataByName("value", stat->value + 2, i);//63119 or when diety started (this is actually the modified stat
					packet->setArrayDataByName("value2", stat->value, i);//63119 temp will be replace by modified value (this is the unmodified stat
				}
				else {
					packet->setArrayDataByName("value", (sint16)stat->value + 2, i, 0U, true);
					packet->setArrayDataByName("value2", stat->value, i);//63119 temp will be replace by modified value

				}
but when i attempt the same thing with the AA tree it does not populate the array, it show the number of array items correctly but not the array data here is my code

Code: Select all

packet->setSubstructArrayLengthByName("node_info", "num_node_items", num_items,i);
			for (itr2 = AATab[i].begin(); itr2 != AATab[i].end(); itr2++) {
				for (itr3 = itr2->second.begin(); itr3 != itr2->second.end(); itr3++, index++) {
					//spell = master_spell_list.GetSpell((*itr3)->spellID, (*itr3)->tier);
					//current_rank = client->GetPlayer()->GetSpellTier((*itr3)->spellID);
					if (index == 0)
						class_node_id = (*itr3)->spellID;
					//if (spell) {
					
					packet->setArrayDataByName("parent_id", (*itr3)->rankPrereqID, index);
					packet->setArrayDataByName("parent_req_tier", (*itr3)->rankPrereq, index);
					packet->setArrayDataByName("spell_id", (*itr3)->spellID, index);
					packet->setArrayDataByName("active", 3, index); // ?? 3 greyed out  0 shows up
this continues with remainder of array data

Re: looking for ideas on this Struct

Posted: Fri Jul 28, 2017 6:20 am
by Ememjr
well i could be wrong but appears to be that my array in substruct_node_info is not getting into the structure in world. if i do a print packet it shows the num_node_items as 27, and i would expect 27 iterations of the array shown in the printpacket but i dont see any