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

08-25-2008, 10:33 PM
|
Discordant
|
|
Join Date: Sep 2006
Location: Subsection 185.D354 C.12
Posts: 346
|
|
#ItemLink <Item ID Number>
It would be cool to somehow get the server to translate a non-item-link into an item link.
Right now, to send an item link it requires two special symbols and a bunch of numbers that don't make any sense to me.
Code:
012FD70000000000000000000000000000000467D6434Distillate of Celestial Healing V
Code:
Input - I want a L:[1001]
You say, 'I want a Cloth Cap'
It's along the lines of the % commands only it has a number in it.
__________________
If at first you don't succeed destroy all evidence that you ever tried.
God doesn't give second chances... Hell, he sets you up the first time.
|

08-26-2008, 12:04 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
I think it would be nice if the quest command for item linking worked too. It looks like it might have worked at one point, but it definitely doesn't now. It would be kinda cool if you should setup NPCs to link the quest rewards for completing the quest. I also wouldn't mind being able to setup an NPC that could link all of the epics on my server so people wouldn't be asking for the links in OOC all of the time 
|
 |
|
 |

08-30-2008, 12:25 PM
|
Discordant
|
|
Join Date: May 2004
Posts: 290
|
|
Ya, the itemlink function for quests is broken. In fact it will crash the zone if a high itemID is used.
In the new method of linking, the first 6 bytes of that long number are the hex value of the itemID. I assume the last 8ish bytes are a hash or bitmask of something.
Here's a simple fix to link normal, unaugmented items.
Around line 887 in zone/questmgr.cpp change this ..
Code:
// MYRA - added itemlink(ID) command
const Item_Struct* item = 0;
int16 itemid = item_id;
item = database.GetItem(itemid);
initiator->Message(0, "%s tells you, '%c00%i %s%c",owner->GetName(),0x12, item->ID, item->Name, 0x12);
}
.. to this ..
Code:
// MYRA - added itemlink(ID) command
const Item_Struct* item = 0;
uint32 itemid = item_id;
item = database.GetItem(itemid);
initiator->Message(0, "%s tells you, %c%06X000000000000000000000000000000000000000%s%c",owner->GetCleanName(),0x12, item->ID, item->Name, 0x12);
}
Then you can use
Code:
quest::itemlink(1001); // link Cloth Cap
|
 |
|
 |

08-30-2008, 02:17 PM
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
I assume that, if you use the sequence from above, the client is able to convert it? I ask because, imo, I would rather have a link to an item in the middle of a conversation, rather than just the mob sending a separate message with the link.
|

08-30-2008, 08:10 PM
|
Discordant
|
|
Join Date: May 2004
Posts: 290
|
|
You can do it from a quest like this. Just plug in the item name and ID.
Code:
$item_link = sprintf("%c%06X%s%s%c",0x12,1001,"000000000000000000000000000000000000000","Cloth Cap",0x12);
quest::say("This is a $item_link.");
|
 |
|
 |

08-31-2008, 05:52 AM
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
I think this would be better, because it would just return the link to the item from the function, rather than outputting it as a generic tell (great for seeing what you're working for in a quest):
Note: I haven't tested this, it's just a specific idea. All changes are in red.
In zone/questmgr.h, change
Code:
char* itemlink(int item_id);
In zone/questmgr.cpp, change
Code:
char* QuestManager::itemlink(int item_id) {
//I dont think this is right anymore, need the hash
/*
uint32_t calc_hash (const char *string)
{
register hash = 0;
while (*string != '\0')
{
register c = toupper(*string);
asm volatile("
imul $31, %1, %1;
movzx %%ax, %%edx;
addl %%edx, %1;
movl %1, %0;
"
:"=r"(hash)
:"D"(hash), "a"(c)
:"%edx"
);
//This is what the inline asm is doing:
//hash *= 0x1f;
//hash += (int)c;
string++;
}
return hash;
}
Now the not so simple part, generating the string to feed into the hash function.
The string for normal (unaugmented) items looks like this:
Code:
sprintf(hashstr, "%d%s%s%d %d %d %d %d %d %d %d", id, name, "-1-1-1-1-1", hp, mana, ac, light, icon, price, size, weight);
The string for bags looks like this:
Code:
sprintf(hashstr, "%d%s%d%d%d%d", id, name, bagslots, bagwr, price, weight);
The string for books looks like this:
Code:
sprintf(hashstr, "%d%s%d%d", id, name, weight, booktype);
*/
// MYRA - added itemlink(ID) command
const Item_Struct* item = 0;
int16 itemid = item_id;
item = database.GetItem(itemid);
return (sprintf("%c%06X%s%s%c",0x12,itemid,"000000000000000000000000000000000000000",item,0x12));
}
And in zone/perlparser.cpp ( really not sure about this part), change
Code:
XS(XS__itemlink);
XS(XS__itemlink)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: itemlink(item_id)");
char* RETVAL;
int item_id = (int)SvIV(ST(0));
RETVAL = quest_manager.itemlink(item_id);
ST(0) = RETVAL;
sv_2mortal(ST(0));
XSRETURN(1);
}
Any thoughts?
|
 |
|
 |
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 05:26 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |