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

Development::Bug Reports Post detailed bug reports and what you would like to see next in the emu here.

Reply
 
Thread Tools Display Modes
  #1  
Old 12-02-2008, 02:21 PM
cybernine186
Sarnak
 
Join Date: Feb 2008
Posts: 87
Default

Well your wish is my command......Here is the code that keeps items from duping when looting a corpse.

What happens is when a player goes to loot there corpse they right click really fast on each item, if they do it fast enough the item in the 8th inventory slot in the 8th bag slot will duplicate. Once it does they quit looting the corpse and transfer that item off there character to someone else and then continue looting there corpse.

PlayerCorpse.cpp

place the code some where around line 887
Code:
	// Prevent Item Duplication When Looting Corpse
	if (((item_data->equipSlot >= 251) && (item_data->equipSlot <= 330)) && ((charid == client->CharacterID()) && (IsPlayerCorpse()))) {
		char* itemdupemsg = NULL;
		sprintf(itemdupemsg, "Loot Item Duplication {%i}", item);
		database.SetMQDetectionFlag(client->AccountName(), client->GetName(), itemdupemsg, zone->GetShortName());
		return ;
	}

Place the code above right before this code
Code:
	if (item != 0)
	{
		if(item_data)
			inst = database.CreateItem(item, item_data?item_data->charges:0, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5);
		else
			inst = database.CreateItem(item);

		if(inst->IsStackable()) {
			if(item_data) 
				//Restore charges from the original item.
				inst->SetCharges(item_data->charges);
			else
				inst->SetCharges(1);
		} else {
Reply With Quote
  #2  
Old 12-02-2008, 02:58 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

Quote:
Originally Posted by cybernine186 View Post
Code:
    char* itemdupemsg = NULL;
    sprintf(itemdupemsg, "Loot Item Duplication {%i}", item);
That'll cause a crash. You either want to declare itemdupemsg as a fixed size char array, e.g.

Code:
    char itemdupemsg[150];
Or use MakeAnyLenString:

Code:
    char *itemdupemsg = NULL;
    MakeAnyLenString(&itemdupemsg,  "Loot Item Duplication {%s}", item->Name);
    database.SetMQDetectionFlag(...
    safe_delete_array(itemdupemsg);
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:50 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