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 04-23-2009, 10:56 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I got the quest::varlink() command added to the SVN and also updated the wiki (here and the one I am working on to convert to MediaWiki) with the new quest command. Many thanks, realityincarnate! It works great, and that fix did correct the issue from before.

Not to figure out how to do those conversions into the aug fields and back into a string for the quest::saylink() command
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 04-25-2009, 04:39 PM
realityincarnate
Developer
 
Join Date: Dec 2007
Posts: 122
Default

I finally got another chance to look at forcing another string into the link, and it's a lot more messed up than I thought.

For some reason, the client likes to receive a text representation of the hex values for augments, etc. I probably should have realized it from looking at how the item id is handled in the original sprintf statement used to generate the links, but it just didn't sink in. So just trying to put a string in there directly causes crashes because it doesn't know what to do with, for example, a hex number represented by "ST".

I was able to trick it into holding some information, but it's much less efficient than I had hoped. I used the string "test", which has a hex representation of 74 65 73 74. The link string allocates five characters for each augment, so we can put two letters in each.
Code:
sprintf(out_text, "%c%06X""%4X%1X%4X%1X""%s%s%c",0x12,999999,'te',0,'st',0,"00000000000000000000000000000","test link",0x12);
will produce an item link that will have "te" in aug0 and "st" in aug1.

Putting them back together is more fun. Each aug slot has two letters, now represented by hex bytes, and in the wrong order. I got them back out using a struct.
Code:
struct AugIn {
	char let2;
	char let1;
};
and running this to build the string.
Code:
AugIn* test;
	char response2[250];
	sprintf(response,"%c",0x00);
	for (int i = 0 ; i < 5; i++) {
		test = (AugIn*) &augments[i];
		sprintf(response,"%s%c%c", response, test->let1, test->let2);
	}
A similar struct method could be used to make it easier to get the string into the augments in the first place. It works, but leaves us with a limit of 10 characters for the response string. This could be increased by using the other variables (evolving item info, etc), but those variables aren't even being decoded by the emulator at the moment.

In other words, I'm beginning to doubt how much advantage this has over your the original suggestion of just using the database. I'll probably continue playing with it, out of stubbornness more than anything else, but I don't think the results will be anything spectacular.
Reply With Quote
  #3  
Old 04-25-2009, 05:32 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Interesting stuff. I am not sure I understand why it is that only 2 letters can be used per aug slot. If it has 5 bytes per aug, couldn't we set 5 chars per aug? Then break the string into sections of 5 and maybe run some conversions on it like do atohex, then hextoi. I don't think all of the needed functions exist yet, but hextoi does in MiscFunctions.h. Then, after that, we would just do the reverse when the link was clicked. I dunno what it would take to do all of that though, but it sounds at least possible. Unless there is another reason for them only allowing 2 letters. If that is the case, then the database is probably the best way to go and should be pretty simple to do.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #4  
Old 04-25-2009, 06:52 PM
realityincarnate
Developer
 
Join Date: Dec 2007
Posts: 122
Default

The limitation is that the client wants the link sent as text. So, to send the letter "t", which is 74 in hex, you need to send the client the characters "7" and "4". So each character we want actually needs two bytes sent to the client. Since they're in groups of five, it ends up wasting the last byte. We could probably come up with a way to combine and use those too, but it seemed like a lot of work at the time.
Reply With Quote
  #5  
Old 04-26-2009, 03:08 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Shouldn't whatever we send be exactly what we get back when the client clicks the link? If so, we should be able to fill those characters with anything. Maybe we could simply place the string directly in there without doing anything at all to it other than making sure it doesn't exceed the 40 chars we have for it.

I think the client is going to want to look at them as ints or something, otherwise, how can you fit an aug with an itemID higher than 9999 in the string? Still not sure I am following what you are saying.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #6  
Old 04-26-2009, 01:00 PM
realityincarnate
Developer
 
Join Date: Dec 2007
Posts: 122
Default

That's understandable, I'm not sure I know exactly what it's doing myself. But it does look like the client gets the information as text and sends it back to the server as integers.

For example, I made a link to a silver jasper ring (item 14628, 0x3924 hex). The link gets the item id as a string "03924", five bytes long: 30 33 39 32 34. When I click on the link, it sends the item id back to the server as a 4 byte integer: 24 39 00 00. The same thing happens with the augment ids. That means that the highest id # it can deal with is 1048575 (0xFFFFF).

So if you try to just fill it with whatever characters you want, it runs into trouble with anything other than 0-9 and A-F. I'm not sure exactly what it does, but when I forced the alphabet into the link string, I got back bytes: AB CD EF 00 and the zone crashed. The same thing happened whenever I used letters after "f". If I filled the evolving and hash areas with letters higher than "f", the link still appeared purple, but clicking it didn't send anything to the server at all.

If we can figure out exactly what it's doing to the other bytes, we might be able to work around it and use them, but right now I don't even know what it's sending; the zone crashes in the middle of the packet dump.
Reply With Quote
  #7  
Old 04-26-2009, 07:12 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Well yeah it should be sending the info back as ints because that is how we have the structure set to interpret them. It should just be a matter of converting that int back into hex and then into a part of a string and combining them.

If what you are saying about the IDs and strings are true, that is really weird! If so, then yeah, it is pretty useless to even try doing the item name in the string.

Sounds like that database way might be the easiest way to handle it. Should be simple enough to handle that part. Just need to play with it some I guess.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
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 06:33 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