Reintegration of inventory-based EQDictionary references

This commit is contained in:
Uleat
2018-07-05 21:05:26 -04:00
parent d2683022e1
commit c435a77813
91 changed files with 4474 additions and 4546 deletions
+29 -29
View File
@@ -2537,15 +2537,15 @@ void command_peekinv(Client *c, const Seperator *sep)
static char* scope_prefix[] = { "Equip", "Gen", "Cursor", "Limbo", "Trib", "Bank", "ShBank", "Trade", "World" };
static int16 scope_range[][2] = {
{ EQEmu::legacy::EQUIPMENT_BEGIN, EQEmu::legacy::EQUIPMENT_END },
{ EQEmu::legacy::GENERAL_BEGIN, EQEmu::legacy::GENERAL_END },
{ EQEmu::legacy::SLOT_CURSOR, EQEmu::legacy::SLOT_CURSOR },
{ EQEmu::legacy::SLOT_INVALID, EQEmu::legacy::SLOT_INVALID },
{ EQEmu::legacy::TRIBUTE_BEGIN, EQEmu::legacy::TRIBUTE_END },
{ EQEmu::legacy::BANK_BEGIN, EQEmu::legacy::BANK_END },
{ EQEmu::legacy::SHARED_BANK_BEGIN, EQEmu::legacy::SHARED_BANK_END },
{ EQEmu::legacy::TRADE_BEGIN, EQEmu::legacy::TRADE_END },
{ EQEmu::inventory::slotBegin, (EQEmu::legacy::WORLD_SIZE - 1) }
{ EQEmu::invslot::EQUIPMENT_BEGIN, EQEmu::invslot::EQUIPMENT_END },
{ EQEmu::invslot::GENERAL_BEGIN, EQEmu::invslot::GENERAL_END },
{ EQEmu::invslot::slotCursor, EQEmu::invslot::slotCursor },
{ EQEmu::invslot::SLOT_INVALID, EQEmu::invslot::SLOT_INVALID },
{ EQEmu::invslot::TRIBUTE_BEGIN, EQEmu::invslot::TRIBUTE_END },
{ EQEmu::invslot::BANK_BEGIN, EQEmu::invslot::BANK_END },
{ EQEmu::invslot::SHARED_BANK_BEGIN, EQEmu::invslot::SHARED_BANK_END },
{ EQEmu::invslot::TRADE_BEGIN, EQEmu::invslot::TRADE_END },
{ EQEmu::invslot::SLOT_BEGIN, (EQEmu::invtype::WORLD_SIZE - 1) }
};
static bool scope_bag[] = { false, true, true, true, false, true, true, true, true };
@@ -2614,7 +2614,7 @@ void command_peekinv(Client *c, const Seperator *sep)
}
for (int16 indexMain = scope_range[scopeIndex][0]; indexMain <= scope_range[scopeIndex][1]; ++indexMain) {
if (indexMain == EQEmu::legacy::SLOT_INVALID)
if (indexMain == EQEmu::invslot::SLOT_INVALID)
continue;
inst_main = ((scopeBit & peekWorld) ? objectTradeskill->GetItem(indexMain) : targetClient->GetInv().GetItem(indexMain));
@@ -2632,14 +2632,14 @@ void command_peekinv(Client *c, const Seperator *sep)
(item_data == nullptr),
"%sSlot: %i, Item: %i (%s), Charges: %i",
scope_prefix[scopeIndex],
((scopeBit & peekWorld) ? (EQEmu::legacy::WORLD_BEGIN + indexMain) : indexMain),
((scopeBit & peekWorld) ? (EQEmu::invslot::WORLD_BEGIN + indexMain) : indexMain),
((item_data == nullptr) ? 0 : item_data->ID),
linker.GenerateLink().c_str(),
((inst_main == nullptr) ? 0 : inst_main->GetCharges())
);
if (inst_main && inst_main->IsClassCommon()) {
for (uint8 indexAug = EQEmu::inventory::socketBegin; indexAug < EQEmu::inventory::SocketCount; ++indexAug) {
for (uint8 indexAug = EQEmu::invaug::SOCKET_BEGIN; indexAug <= EQEmu::invaug::SOCKET_END; ++indexAug) {
inst_aug = inst_main->GetItem(indexAug);
if (!inst_aug) // extant only
continue;
@@ -2652,7 +2652,7 @@ void command_peekinv(Client *c, const Seperator *sep)
".%sAugSlot: %i (Slot #%i, Aug idx #%i), Item: %i (%s), Charges: %i",
scope_prefix[scopeIndex],
INVALID_INDEX,
((scopeBit & peekWorld) ? (EQEmu::legacy::WORLD_BEGIN + indexMain) : indexMain),
((scopeBit & peekWorld) ? (EQEmu::invslot::WORLD_BEGIN + indexMain) : indexMain),
indexAug,
((item_data == nullptr) ? 0 : item_data->ID),
linker.GenerateLink().c_str(),
@@ -2664,7 +2664,7 @@ void command_peekinv(Client *c, const Seperator *sep)
if (!scope_bag[scopeIndex] || !(inst_main && inst_main->IsClassBag()))
continue;
for (uint8 indexSub = EQEmu::inventory::containerBegin; indexSub < EQEmu::inventory::ContainerCount; ++indexSub) {
for (uint8 indexSub = EQEmu::invbag::SLOT_BEGIN; indexSub <= EQEmu::invbag::SLOT_END; ++indexSub) {
inst_sub = inst_main->GetItem(indexSub);
if (!inst_sub) // extant only
continue;
@@ -2677,7 +2677,7 @@ void command_peekinv(Client *c, const Seperator *sep)
"..%sBagSlot: %i (Slot #%i, Bag idx #%i), Item: %i (%s), Charges: %i",
scope_prefix[scopeIndex],
((scopeBit & peekWorld) ? INVALID_INDEX : EQEmu::InventoryProfile::CalcSlotId(indexMain, indexSub)),
((scopeBit & peekWorld) ? (EQEmu::legacy::WORLD_BEGIN + indexMain) : indexMain),
((scopeBit & peekWorld) ? (EQEmu::invslot::WORLD_BEGIN + indexMain) : indexMain),
indexSub,
((item_data == nullptr) ? 0 : item_data->ID),
linker.GenerateLink().c_str(),
@@ -2685,7 +2685,7 @@ void command_peekinv(Client *c, const Seperator *sep)
);
if (inst_sub->IsClassCommon()) {
for (uint8 indexAug = EQEmu::inventory::socketBegin; indexAug < EQEmu::inventory::SocketCount; ++indexAug) {
for (uint8 indexAug = EQEmu::invaug::SOCKET_BEGIN; indexAug <= EQEmu::invaug::SOCKET_END; ++indexAug) {
inst_aug = inst_sub->GetItem(indexAug);
if (!inst_aug) // extant only
continue;
@@ -2711,7 +2711,7 @@ void command_peekinv(Client *c, const Seperator *sep)
}
if ((scopeBit & peekEquip) && (targetClient->ClientVersion() >= EQEmu::versions::ClientVersion::SoF)) {
inst_main = targetClient->GetInv().GetItem(EQEmu::inventory::slotPowerSource);
inst_main = targetClient->GetInv().GetItem(EQEmu::invslot::SLOT_POWER_SOURCE);
if (inst_main) {
itemsFound = true;
item_data = inst_main->GetItem();
@@ -2726,14 +2726,14 @@ void command_peekinv(Client *c, const Seperator *sep)
(item_data == nullptr),
"%sSlot: %i, Item: %i (%s), Charges: %i",
scope_prefix[scopeIndex],
EQEmu::inventory::slotPowerSource,
EQEmu::invslot::SLOT_POWER_SOURCE,
((item_data == nullptr) ? 0 : item_data->ID),
linker.GenerateLink().c_str(),
((inst_main == nullptr) ? 0 : inst_main->GetCharges())
);
if (inst_main && inst_main->IsClassCommon()) {
for (uint8 indexAug = EQEmu::inventory::socketBegin; indexAug < EQEmu::inventory::SocketCount; ++indexAug) {
for (uint8 indexAug = EQEmu::invaug::SOCKET_BEGIN; indexAug <= EQEmu::invaug::SOCKET_END; ++indexAug) {
inst_aug = inst_main->GetItem(indexAug);
if (!inst_aug) // extant only
continue;
@@ -2746,7 +2746,7 @@ void command_peekinv(Client *c, const Seperator *sep)
".%sAugSlot: %i (Slot #%i, Aug idx #%i), Item: %i (%s), Charges: %i",
scope_prefix[scopeIndex],
INVALID_INDEX,
EQEmu::inventory::slotPowerSource,
EQEmu::invslot::SLOT_POWER_SOURCE,
indexAug,
((item_data == nullptr) ? 0 : item_data->ID),
linker.GenerateLink().c_str(),
@@ -2784,7 +2784,7 @@ void command_peekinv(Client *c, const Seperator *sep)
);
if (inst_main && inst_main->IsClassCommon()) {
for (uint8 indexAug = EQEmu::inventory::socketBegin; indexAug < EQEmu::inventory::SocketCount; ++indexAug) {
for (uint8 indexAug = EQEmu::invaug::SOCKET_BEGIN; indexAug <= EQEmu::invaug::SOCKET_END; ++indexAug) {
inst_aug = inst_main->GetItem(indexAug);
if (!inst_aug) // extant only
continue;
@@ -2809,7 +2809,7 @@ void command_peekinv(Client *c, const Seperator *sep)
if (!scope_bag[scopeIndex] || !(inst_main && inst_main->IsClassBag()))
continue;
for (uint8 indexSub = EQEmu::inventory::containerBegin; indexSub < EQEmu::inventory::ContainerCount; ++indexSub) {
for (uint8 indexSub = EQEmu::invbag::SLOT_BEGIN; indexSub <= EQEmu::invbag::SLOT_END; ++indexSub) {
inst_sub = inst_main->GetItem(indexSub);
if (!inst_sub)
continue;
@@ -2831,7 +2831,7 @@ void command_peekinv(Client *c, const Seperator *sep)
);
if (inst_sub->IsClassCommon()) {
for (uint8 indexAug = EQEmu::inventory::socketBegin; indexAug < EQEmu::inventory::SocketCount; ++indexAug) {
for (uint8 indexAug = EQEmu::invaug::SOCKET_BEGIN; indexAug <= EQEmu::invaug::SOCKET_END; ++indexAug) {
inst_aug = inst_sub->GetItem(indexAug);
if (!inst_aug) // extant only
continue;
@@ -3266,8 +3266,8 @@ void command_listpetition(Client *c, const Seperator *sep)
void command_equipitem(Client *c, const Seperator *sep)
{
uint32 slot_id = atoi(sep->arg[1]);
if (sep->IsNumber(1) && ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN) && (slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::inventory::slotPowerSource))) {
const EQEmu::ItemInstance* from_inst = c->GetInv().GetItem(EQEmu::inventory::slotCursor);
if (sep->IsNumber(1) && ((slot_id >= EQEmu::invslot::EQUIPMENT_BEGIN) && (slot_id <= EQEmu::invslot::EQUIPMENT_END) || (slot_id == EQEmu::invslot::SLOT_POWER_SOURCE))) {
const EQEmu::ItemInstance* from_inst = c->GetInv().GetItem(EQEmu::invslot::slotCursor);
const EQEmu::ItemInstance* to_inst = c->GetInv().GetItem(slot_id); // added (desync issue when forcing stack to stack)
bool partialmove = false;
int16 movecount;
@@ -3275,7 +3275,7 @@ void command_equipitem(Client *c, const Seperator *sep)
if (from_inst && from_inst->IsClassCommon()) {
auto outapp = new EQApplicationPacket(OP_MoveItem, sizeof(MoveItem_Struct));
MoveItem_Struct* mi = (MoveItem_Struct*)outapp->pBuffer;
mi->from_slot = EQEmu::inventory::slotCursor;
mi->from_slot = EQEmu::invslot::slotCursor;
mi->to_slot = slot_id;
// mi->number_in_stack = from_inst->GetCharges(); // replaced with con check for stacking
@@ -4521,7 +4521,7 @@ void command_goto(Client *c, const Seperator *sep)
void command_iteminfo(Client *c, const Seperator *sep)
{
auto inst = c->GetInv()[EQEmu::inventory::slotCursor];
auto inst = c->GetInv()[EQEmu::invslot::slotCursor];
if (!inst) {
c->Message(13, "Error: You need an item on your cursor for this command");
return;
@@ -5681,9 +5681,9 @@ void command_summonitem(Client *c, const Seperator *sep)
std::string cmd_msg = sep->msg;
size_t link_open = cmd_msg.find('\x12');
size_t link_close = cmd_msg.find_last_of('\x12');
if (link_open != link_close && (cmd_msg.length() - link_open) > EQEmu::constants::SayLinkBodySize) {
if (link_open != link_close && (cmd_msg.length() - link_open) > EQEmu::constants::SAY_LINK_BODY_SIZE) {
EQEmu::SayLinkBody_Struct link_body;
EQEmu::saylink::DegenerateLinkBody(link_body, cmd_msg.substr(link_open + 1, EQEmu::constants::SayLinkBodySize));
EQEmu::saylink::DegenerateLinkBody(link_body, cmd_msg.substr(link_open + 1, EQEmu::constants::SAY_LINK_BODY_SIZE));
itemid = link_body.item_id;
}
else if (!sep->IsNumber(1)) {