Fixed stacking issue in world tradeskill containers. (Added #peekinv world)

This commit is contained in:
Uleat 2014-10-22 22:57:20 -04:00
parent a062c27e1a
commit c95b18da85
5 changed files with 49 additions and 1 deletions

View File

@ -1,5 +1,8 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 10/22/2014 ==
Uleat: Fix for stacking items in a world object..added a new command option: #peekinv world - will show world container contents, if one is in use by target.
== 10/20/2014 ==
demonstar55: Inspect Buffs rank 1 will now show NPC buffs in target window (SoD+)

View File

@ -258,7 +258,7 @@ int command_init(void) {
command_add("heal","- Completely heal your target",10,command_heal) ||
command_add("appearance","[type] [value] - Send an appearance packet for you or your target",150,command_appearance) ||
command_add("nukeitem","[itemid] - Remove itemid from your player target's inventory",150,command_nukeitem) ||
command_add("peekinv","[worn/cursor/inv/bank/trade/trib/all] - Print out contents of your player target's inventory",100,command_peekinv) ||
command_add("peekinv","[worn/inv/cursor/trib/bank/trade/world/all] - Print out contents of your player target's inventory",100,command_peekinv) ||
command_add("findnpctype","[search criteria] - Search database NPC types",100,command_findnpctype) ||
command_add("findzone","[search criteria] - Search database zones",100,command_findzone) ||
command_add("fz",nullptr,100, command_findzone) ||
@ -2965,6 +2965,41 @@ void command_peekinv(Client *c, const Seperator *sep)
}
}
if (bAll || (strcasecmp(sep->arg[1], "world") == 0)) {
// Items in world container (if present)
bFound = true;
Object* tsobject = c->GetTradeskillObject();
if (tsobject == nullptr) {
c->Message(1, "No world tradeskill object selected...");
}
else {
c->Message(0, "[WorldObject DBID: %i (entityid: %i)]", tsobject->GetDBID(), tsobject->GetID());
for (int16 i = MAIN_BEGIN; i < EmuConstants::MAP_WORLD_SIZE; ++i) {
const ItemInst* inst = tsobject->GetItem(i);
item = (inst) ? inst->GetItem() : nullptr;
linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12);
c->Message((item == 0), "WorldSlot: %i, Item: %i (%s), Charges: %i",
(EmuConstants::WORLD_BEGIN + i), ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges()));
// this should never happen ('WorldBagSlot' as -1 indicates an error state in this implementation)
if (inst && inst->IsType(ItemClassContainer)) {
for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; ++j) {
const ItemInst* instbag = inst->GetItem(j);
item = (instbag) ? instbag->GetItem() : nullptr;
linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12);
c->Message((item == 0), " WorldBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i",
-1, i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges()));
}
}
}
}
}
if (!bFound)
{
c->Message(0, "Usage: #peekinv [worn|cursor|inv|bank|trade|trib|all]");

View File

@ -1480,6 +1480,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
world_inst->SetCharges(world_charges);
m_tradeskill_object->PutItem(world_idx, world_inst);
m_tradeskill_object->Save();
if (src_charges == 0) {

View File

@ -318,6 +318,14 @@ void Object::Delete(bool reset_state)
}
}
const ItemInst* Object::GetItem(uint8 index) {
if (index < EmuConstants::MAP_WORLD_SIZE) {
return m_inst->GetItem(index);
}
return nullptr;
}
// Add item to object (only logical for world tradeskill containers
void Object::PutItem(uint8 index, const ItemInst* inst)
{

View File

@ -121,6 +121,7 @@ public:
void StartDecay() {decay_timer.Start();}
// Container functions
const ItemInst* GetItem(uint8 index);
void PutItem(uint8 index, const ItemInst* inst);
void DeleteItem(uint8 index); // Item inside container
ItemInst* PopItem(uint8 index); // Pop item out of container