compiled and tested. won't crash the zone if there is no client initiator, but the results won't print out correctly in all cases, because it doesn't know what client version is being used (falls through to version < SoF).
Code:
Index: client.h
===================================================================
--- client.h (revision 2472)
+++ client.h (working copy)
@@ -773,7 +773,6 @@
void SetStats(uint8 type,int16 set_val);
void IncStats(uint8 type,int16 increase_val);
void DropItem(int16 slot_id);
- bool MakeItemLink(char* &ret_link, const ItemInst* inst);
int GetItemLinkHash(const ItemInst* inst);
void SendItemLink(const ItemInst* inst, bool sendtoall=false);
void SendLootItemInPacket(const ItemInst* inst, int16 slot_id);
Index: inventory.cpp
===================================================================
--- inventory.cpp (revision 2472)
+++ inventory.cpp (working copy)
@@ -719,7 +719,7 @@
}
}
-bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) {
+bool Mob::MakeItemLink(char* &ret_link, const ItemInst *inst) {
//we're sending back the entire "link", minus the null characters & item name
//that way, we can use it for regular links & Task links
//note: initiator needs to pass us ret_link
@@ -747,7 +747,8 @@
uint8 evolvedlevel = 0;
int hash = 0;
//int hash = GetItemLinkHash(inst); //eventually this will work (currently crashes zone), but for now we'll skip the extra overhead
- if (GetClientVersion() >= EQClientRoF)
+
+ if (IsClient() && CastToClient()->GetClientVersion() >= EQClientRoF)
{
MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X",
0,
@@ -765,7 +766,7 @@
hash
);
}
- else if (GetClientVersion() >= EQClientSoF)
+ else if (IsClient() && CastToClient()->GetClientVersion() >= EQClientSoF)
{
MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X",
0,
Index: mob.h
===================================================================
--- mob.h (revision 2472)
+++ mob.h (working copy)
@@ -869,6 +869,7 @@
void Emote(const char *format, ...);
void QuestJournalledSay(Client *QuestInitiator, const char *str);
uint32 GetItemStat(uint32 itemid, const char *identifier);
+ bool MakeItemLink(char* &ret_link, const ItemInst* inst);
//Casting related
void SendSpellBarDisable();
Index: questmgr.cpp
===================================================================
--- questmgr.cpp (revision 2472)
+++ questmgr.cpp (working copy)
@@ -1099,7 +1099,7 @@
void QuestManager::itemlink(int item_id) {
const ItemInst* inst = database.CreateItem(item_id);
char* link = 0;
- if (initiator->MakeItemLink(link, inst))
+ if (owner->MakeItemLink(link, inst))
initiator->Message(0, "%s tells you, %c%s%s%c", owner->GetCleanName(), 0x12, link, inst->GetItem()->Name, 0x12);
safe_delete_array(link);
safe_delete(inst);
@@ -2295,7 +2295,7 @@
return "INVALID ITEM ID IN VARLINK";
char* link = 0;
char* tempstr = 0;
- if (initiator->MakeItemLink(link, inst)) { // make a link to the item
+ if (owner->MakeItemLink(link, inst)) { // make a link to the item
MakeAnyLenString(&tempstr, "%c%s%s%c", 0x12, link, inst->GetItem()->Name, 0x12);
strn0cpy(perltext, tempstr,250); // the perl string is only 250 chars, so make sure the link isn't too large
safe_delete_array(tempstr); // MakeAnyLenString() uses new, so clean up after it