Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 01-31-2013, 12:39 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

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
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
 


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 04:51 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