fixing tradeskills

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

fixing tradeskills

Post by Ememjr » Sun Mar 03, 2019 7:31 am

ok here is an issue in the code i cam e accross and not sure how to rewrite it
f

Code: Select all

or (itr = spells.begin(); itr != spells.end(); itr++) {
            size++;

            if (size > 6) {
                // only 6 slots for skills on the ui
                break;
            }
            char str[20];
            char temp[20];
            strcpy(str, "skill");
            itoa(size, temp, 10);
            strcat(str, temp);
            strcat(str, "_id");
            packet->setDataByName(str, *itr);
    }
the str at the packet line is skill1_id, skill2_id,skill3_id etc
but it is supposed to be writing the *itr value to skill_id at the particular index
here is the struct line it is suppose to write to <Data ElementName="skill_id" Type="int32" Size="6"/>

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: fixing tradeskills

Post by Jabantiz » Sun Mar 03, 2019 4:53 pm

Code: Select all

char str[20];
char temp[20];
strcpy(str, "skill");
itoa(size, temp, 10);
strcat(str, temp);
strcat(str, "_id");
This code generates the "skill1_id", "skill2_id" and so on and then uses it in the packet->setDataByName()

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

Re: fixing tradeskills

Post by Ememjr » Sun Mar 03, 2019 6:44 pm

thats the problem

it should not be skill1_id, skill2_id

it should be skill_id, with the proper index of 1 -6 or 0-5?

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: fixing tradeskills

Post by Jabantiz » Sun Mar 03, 2019 7:39 pm

Ah then the stuct was probably changed at some point and not the code. In that case it is easy.

Code: Select all

packet->setDataByName("skill_id", *itr, index);
So that loops would be something like this

Code: Select all

size = 0;
for (itr = spells.begin(); itr != spells.end(); itr++) {
            size++;

            if (size >= 6) {
                // only 6 slots for skills on the ui
                break;
            }
            
            packet->setDataByName("skill_id", *itr, index);
    }
    
In the old loop size started at 1, it needs to start at 0 now as it is being used as an index, should probably change the name to be more clear about that as well.

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

Re: fixing tradeskills

Post by Ememjr » Thu Mar 07, 2019 11:45 am

wow i finally tracked the issue down on why the abilities were not showing up on the tradeskill bar

in this section of code

Code: Select all

packet->setDataByName("product_progress_needed", 1000);

	rp = recipe->products[4];
	item = master_item_list.GetItem(rp->product_id);

	packet->setDataByName("product_item_name",  item->name.c_str());
	packet->setDataByName("product_item_icon", item->details.icon);

	if(client->GetVersion() < 860)
		packet->setItemByName("product_item", item, client->GetPlayer(), 0, -1);
	else if (client->GetVersion() < 1193)
		packet->setItemByName("product_item", item, client->GetPlayer());
	else
		packet->setItemByName("product_item", item, client->GetPlayer(), 0, 2);

	//packet->setItemByName("product_item", item, client->GetPlayer());

	if (rp->byproduct_id > 0) {
		item = 0;
		item = master_item_list.GetItem(rp->byproduct_id);
		if (item) {
			packet->setDataByName("product_byproduct_name", item->name.c_str());
			packet->setDataByName("product_byproduct_icon", item->details.icon);
		}
	}
the comment line was not commented which basically nullified what was happening in the if else above it

so now the abilites will show up still working on the order right now

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests