mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-16 21:51:29 +00:00
broke up dumpInventory into methods, changed it to dumpEntireInventory (dumpInventory now only dumps a small peice)
This commit is contained in:
parent
e9577db9c2
commit
d7546e09ee
142
common/Item.cpp
142
common/Item.cpp
@ -15,20 +15,12 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
// VS6 doesn't like the length of STL generated names: disabling
|
|
||||||
#pragma warning(disable:4786)
|
|
||||||
// Quagmire: Dont know why the one in debug.h doesnt work, but it doesnt.
|
|
||||||
#endif
|
|
||||||
#include "../common/debug.h"
|
#include "../common/debug.h"
|
||||||
/*#ifdef _CRTDBG_MAP_ALLOC
|
#include "../common/StringUtil.h"
|
||||||
#undef new
|
|
||||||
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
@ -36,6 +28,7 @@
|
|||||||
#include "races.h"
|
#include "races.h"
|
||||||
#include "shareddb.h"
|
#include "shareddb.h"
|
||||||
#include "classes.h"
|
#include "classes.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int32 NextItemInstSerialNumber = 1;
|
int32 NextItemInstSerialNumber = 1;
|
||||||
@ -1060,103 +1053,76 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo
|
|||||||
return SLOT_INVALID;
|
return SLOT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inventory::dumpInventory() {
|
void Inventory::dumpBagContents(ItemInst *inst) {
|
||||||
|
iter_inst it;
|
||||||
|
iter_contents itb;
|
||||||
|
|
||||||
|
if (!inst || !inst->IsType(ItemClassContainer))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Go through bag, if bag
|
||||||
|
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||||
|
ItemInst* baginst = itb->second;
|
||||||
|
if(!baginst || !baginst->GetItem())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::string subSlot;
|
||||||
|
StringFormat(subSlot," Slot %d: %s (%d)", Inventory::CalcSlotId(it->first, itb->first),
|
||||||
|
baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges());
|
||||||
|
std::cout << subSlot << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Inventory::dumpItemCollection(const map<int16, ItemInst*> &collection) {
|
||||||
iter_inst it;
|
iter_inst it;
|
||||||
iter_contents itb;
|
iter_contents itb;
|
||||||
ItemInst* inst = nullptr;
|
ItemInst* inst = nullptr;
|
||||||
|
|
||||||
// Check item: After failed checks, check bag contents (if bag)
|
for (it=collection.begin(); it!=collection.end(); it++) {
|
||||||
printf("Worn items:\n");
|
|
||||||
for (it=m_worn.begin(); it!=m_worn.end(); it++) {
|
|
||||||
inst = it->second;
|
inst = it->second;
|
||||||
it->first;
|
it->first;
|
||||||
if(!inst || !inst->GetItem())
|
if(!inst || !inst->GetItem())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges());
|
std:string slot;
|
||||||
|
StringFormat(slot, "Slot %d: %s (%d)",it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges());
|
||||||
|
std::cout << slot << std::endl;
|
||||||
|
|
||||||
// Go through bag, if bag
|
dumpBagContents(inst);
|
||||||
if (inst && inst->IsType(ItemClassContainer)) {
|
|
||||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
|
||||||
ItemInst* baginst = itb->second;
|
|
||||||
if(!baginst || !baginst->GetItem())
|
|
||||||
continue;
|
|
||||||
printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first),
|
|
||||||
baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printf("Inventory items:\n");
|
void Inventory::dumpWornItems() {
|
||||||
for (it=m_inv.begin(); it!=m_inv.end(); it++) {
|
std::cout << "Worn items:" << std::endl;
|
||||||
inst = it->second;
|
dumpItemCollection(m_worn);
|
||||||
it->first;
|
}
|
||||||
if(!inst || !inst->GetItem())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges());
|
void Inventory::dumpInventory() {
|
||||||
|
std::cout << "Inventory items:" << std::endl;
|
||||||
|
dumpItemCollection(m_inv);
|
||||||
|
}
|
||||||
|
|
||||||
// Go through bag, if bag
|
void Inventory::dumpBankItems() {
|
||||||
if (inst && inst->IsType(ItemClassContainer)) {
|
|
||||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
|
||||||
ItemInst* baginst = itb->second;
|
|
||||||
if(!baginst || !baginst->GetItem())
|
|
||||||
continue;
|
|
||||||
printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first),
|
|
||||||
baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges());
|
|
||||||
|
|
||||||
}
|
std::cout << "Bank items:" << std::endl;
|
||||||
}
|
dumpItemCollection(m_bank);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Bank items:\n");
|
void Inventory::dumpSharedBankItems() {
|
||||||
for (it=m_bank.begin(); it!=m_bank.end(); it++) {
|
|
||||||
inst = it->second;
|
|
||||||
it->first;
|
|
||||||
if(!inst || !inst->GetItem())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges());
|
std::cout << "Shared Bank items:" << std::endl;
|
||||||
|
dumpItemCollection(m_shbank);
|
||||||
|
}
|
||||||
|
|
||||||
// Go through bag, if bag
|
void Inventory::dumpEntireInventory() {
|
||||||
if (inst && inst->IsType(ItemClassContainer)) {
|
|
||||||
|
|
||||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
dumpWornItems();
|
||||||
ItemInst* baginst = itb->second;
|
dumpInventory();
|
||||||
if(!baginst || !baginst->GetItem())
|
dumpBankItems();
|
||||||
continue;
|
dumpSharedBankItems();
|
||||||
printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first),
|
|
||||||
baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges());
|
|
||||||
|
|
||||||
}
|
std::cout << std::endl;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Shared Bank items:\n");
|
|
||||||
for (it=m_shbank.begin(); it!=m_shbank.end(); it++) {
|
|
||||||
inst = it->second;
|
|
||||||
it->first;
|
|
||||||
if(!inst || !inst->GetItem())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
printf("Slot %d: %s (%d)\n", it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges());
|
|
||||||
|
|
||||||
// Go through bag, if bag
|
|
||||||
if (inst && inst->IsType(ItemClassContainer)) {
|
|
||||||
|
|
||||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
|
||||||
ItemInst* baginst = itb->second;
|
|
||||||
if(!baginst || !baginst->GetItem())
|
|
||||||
continue;
|
|
||||||
printf(" Slot %d: %s (%d)\n", Inventory::CalcSlotId(it->first, itb->first),
|
|
||||||
baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal Method: Retrieves item within an inventory bucket
|
// Internal Method: Retrieves item within an inventory bucket
|
||||||
|
|||||||
@ -196,7 +196,13 @@ public:
|
|||||||
// Test whether a given slot can support a container item
|
// Test whether a given slot can support a container item
|
||||||
static bool SupportsContainers(int16 slot_id);
|
static bool SupportsContainers(int16 slot_id);
|
||||||
|
|
||||||
|
void dumpItemCollection(const map<int16, ItemInst*> &collection);
|
||||||
|
void dumpBagContents(ItemInst *inst);
|
||||||
|
void dumpEntireInventory();
|
||||||
|
void dumpWornItems();
|
||||||
void dumpInventory();
|
void dumpInventory();
|
||||||
|
void dumpBankItems();
|
||||||
|
void dumpSharedBankItems();
|
||||||
|
|
||||||
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value);
|
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value);
|
||||||
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value);
|
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value);
|
||||||
|
|||||||
@ -597,7 +597,7 @@ bool Client::Save(uint8 iCommitNow) {
|
|||||||
p_timers.Store(&database);
|
p_timers.Store(&database);
|
||||||
|
|
||||||
// printf("Dumping inventory on save:\n");
|
// printf("Dumping inventory on save:\n");
|
||||||
// m_inv.dumpInventory();
|
// m_inv.dumpEntireInventory();
|
||||||
|
|
||||||
SaveTaskState();
|
SaveTaskState();
|
||||||
if (iCommitNow <= 1) {
|
if (iCommitNow <= 1) {
|
||||||
|
|||||||
@ -9195,7 +9195,7 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) {
|
|||||||
|
|
||||||
#ifdef _EQDEBUG
|
#ifdef _EQDEBUG
|
||||||
printf("Dumping inventory on load:\n");
|
printf("Dumping inventory on load:\n");
|
||||||
m_inv.dumpInventory();
|
m_inv.dumpEntireInventory();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//lost in current PP
|
//lost in current PP
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user