Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 08-31-2008, 05:54 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I moved this to server code submissions. I confirmed that the fix for item linking that Theeper posted here does in fact work. But, it would be nice if the idea that AndMetal was working on worked as well. I haven't tested AndMetal's code yet, but it would be nice if you could use it like:

quest::say ("Here is the link for a quest::itemlink(1001)."); #link for a Cloth Cap

It looks like it could be done the way that Theeper mentioned by defining a variable for it, but it would be best to simplify it if possible. I am really glad that the tell command works now, but it would just be better this way IMO. Either way, this could be added to the code as it fixes a currently broken command.

I will leave this unstickied for now so KLS can decide if she wants to add it as-is or if she wants to wait for the change to be made so it works in the newer (better IMO) way.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 09-01-2008 at 01:57 AM..
Reply With Quote
  #2  
Old 09-07-2008, 07:14 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I tried making the changes that AndMetal posted, but that gives compile errors. I was getting errors about char*, and I am guessing it is because all other quests use void and none use char* like that. I will have to mess with it a little more, but I think that this looks like it could be a simple change to Theeper's code to make it do what AndMetal (and probably most people) want. I will have to mess with it more, but I think that changing the following line:

Code:
initiator->Message(0, "%s tells you, %c%06X000000000000000000000000000000000000000%s%c",owner->GetCleanName(),0x12, item->ID, item->Name, 0x12);
From a message to a print might do it. Maybe I am thinking too simple though. It is no secret that my understanding of how code works is still horrible lol.

Maybe something like this would work:

Code:
printf("%c%06X000000000000000000000000000000000000000%s%c",owner->GetCleanName(),0x12, item->ID, item->Name, 0x12);
I will have to test this out and see if it does anything.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 09-08-2008, 01:18 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Quote:
Originally Posted by trevius View Post
I tried making the changes that AndMetal posted, but that gives compile errors. I was getting errors about char*, and I am guessing it is because all other quests use void and none use char* like that. I will have to mess with it a little more, but I think that this looks like it could be a simple change to Theeper's code to make it do what AndMetal (and probably most people) want. I will have to mess with it more, but I think that changing the following line:

Code:
initiator->Message(0, "%s tells you, %c%06X000000000000000000000000000000000000000%s%c",owner->GetCleanName(),0x12, item->ID, item->Name, 0x12);
From a message to a print might do it. Maybe I am thinking too simple though. It is no secret that my understanding of how code works is still horrible lol.

Maybe something like this would work:

Code:
printf("%c%06X000000000000000000000000000000000000000%s%c",owner->GetCleanName(),0x12, item->ID, item->Name, 0x12);
I will have to test this out and see if it does anything.
The reason it should be char is because we want it to return a value that contains characters. If it is void, it won't return anything, it just executes whatever is in the function. We want it to return just the string that needs to be added to the text, rather than output it for us (which is what it currently does).

However, my understanding of all the different *, &, and whatnot is somewhat limited. I thought char* meant a variable length (obviously, I need to pick up a C++ book and read like the first 10 pages), but I guess that might be incorrect if it's not compiling properly. Then again, if it failed to compile in zone/perlparser.cpp, that wouldn't surprise me since I honestly have no idea how that XS crap works

However, in the same token, we could go a different way of accomplishing the same thing: a quest plugin. The downside is that it would require knowing both the exact name of the item from the database and the item ID. The bad thing about this is, if the item name changes in the DB, you have to change it in your script. It's not really the end of the world, but could be annoying.

In any case, this should do the trick (which is just what Theeper came up with in a more user friendly form):
new file, itemlink.pl, in the plugins directory
Code:
# plugin::itemlink(itemid, itemname);
# returns the string needed in conversation to link to an item
sub itemlink {
	my $itemid = shift;
	my $itemname = shift;
	my $unknown = "000000000000000000000000000000000000000"	# if we ever figure out what we can do with this...
	my $string = sprintf("%c%06X%s%s%c",0x12,$itemid,$unknown,$itemname,0x12);
	return $string;
}
1;	# not really sure if this is needed, but it's in most of the other plugin files...
If I can, I may give this a shot on my server tonight to make sure it actually works. And at the least, this can be an easier workaround unless we can find out how to have it done in the source.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #4  
Old 09-08-2008, 07:04 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I was messing around with this some more tonight, but I still couldn't get it to work. Haven't tried the plugin yet, but still trying to go for making a command in the source instead. Though, I did find a quest object for it, but it doesn't seem to work right either:

Code:
void Client::SendItemLink(const ItemInst* inst, bool send_to_all)
{
/*

this stuff is old, live dosent do this anymore. they send a much smaller
packet with the item number in it, but I cant seem to find it right now

*/
	if (!inst)
		return;
	
	const Item_Struct* item = inst->GetItem();
	const char* name2 = &item->Name[0];
	EQApplicationPacket* outapp = new EQApplicationPacket(OP_ItemLinkText,strlen(name2)+68);
	char buffer2[135] = {0};
	char itemlink[135] = {0};
	sprintf(itemlink,"%c0%06u0%05u-%05u-%05u-%05u-%05u00000000%c",
		0x12,
		item->ID,
		inst->GetAugmentItemID(0),
		inst->GetAugmentItemID(1),
		inst->GetAugmentItemID(2),
		inst->GetAugmentItemID(3),
		inst->GetAugmentItemID(4),
		0x12);
	sprintf(buffer2,"%c%c%c%c%c%c%c%c%c%c%c%c%s",0x00,0x00,0x00,0x00,0xD3,0x01,0x00,0x00,0x1E,0x01,0x00,0x00,itemlink);
	memcpy(outapp->pBuffer,buffer2,outapp->size);
	QueuePacket(outapp);
	safe_delete(outapp);
	if (send_to_all==false)
		return;
	const char* charname = this->GetName();
	outapp = new EQApplicationPacket(OP_ItemLinkText,strlen(itemlink)+14+strlen(charname));
	char buffer3[150] = {0};
	sprintf(buffer3,"%c%c%c%c%c%c%c%c%c%c%c%c%6s%c%s",0x00,0x00,0x00,0x00,0xD2,0x01,0x00,0x00,0x00,0x00,0x00,0x00,charname,0x00,itemlink);
	memcpy(outapp->pBuffer,buffer3,outapp->size);
	entity_list.QueueCloseClients(this->CastToMob(),outapp,true,200,0,false);
	safe_delete(outapp);
}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #5  
Old 09-24-2008, 02:04 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Unstuck this one because I am not sure what the solution (if any) is.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:02 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3