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 11-27-2012, 03:51 PM
sorvani
Dragon
 
Join Date: May 2010
Posts: 965
Default

seen that in VerifyInventory also. there is definitely something going on here.
Reply With Quote
  #2  
Old 11-27-2012, 05:00 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

You could create a new character and then look at the inventory entry in the database before clicking enter world. At least you could verify what the initial
save value is.



EDIT: Another thing to look at is how SummonItem modifies its charges:

Code:
	ItemInst* inst = database.CreateItem(item, charges);
		if (inst) {
			// Custom logic for SummonItem
			if ((inst->GetCharges()==0))
				inst->SetCharges(1);
			if ((inst->GetCharges()>0))
				inst->SetCharges(inst->GetCharges());
		<...>
		}
It creates the item first, and then goes back and modifies the inst charges.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #3  
Old 11-27-2012, 05:13 PM
Tabasco's Avatar
Tabasco
Discordant
 
Join Date: Sep 2009
Posts: 269
Default

There are already provisions for it in most places, but the loss occurs in Database::StoreCharacter(), which is called right after starting items are populated.

The charges field in the inventory table is unsigned and the item charges are written without any testing.

Code:
            MakeAnyLenString
            (
                &invquery,
                "INSERT INTO inventory SET "
                "charid=%0u, slotid=%0d, itemid=%0u, charges=%0d, color=%0u",
                charid, i, newinv->GetItem()->ID,
                newinv->GetCharges(), newinv->GetColor()
            );
Reply With Quote
  #4  
Old 02-18-2013, 07:52 AM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

Necro!

I came across this issue again and the following code now works as a work-around.

Code:
i->PutItem( i->FindFreeSlot(0,0), *pDB->CreateBaseItem( pDB->GetItem( YOUR_ITEM_ID ), 0 ) );
CreateBaseItem must be called, only calling GetItem will result in the item being out of charges.
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?

Last edited by Drajor; 02-18-2013 at 07:53 AM.. Reason: Spelling.. I just walked 20km!
Reply With Quote
  #5  
Old 02-18-2013, 08:59 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

I'm looking at the current code in SharedDatabase::SetStartingItems, and it does call CreateBaseItem.

The code you posted has a memory leak since the ItemInst* returned from CreateBaseItem is never deleted.
Reply With Quote
  #6  
Old 02-18-2013, 11:17 AM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

Good catch, thank you!
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
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 07:56 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