mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 07:18:37 +00:00
More 'dictionary' updates..added 'constants' files to client translators..started replacement of hard-coded inventory values.
This commit is contained in:
+50
-51
@@ -44,7 +44,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
|
||||
int i;
|
||||
if(where_to_check & invWhereWorn) {
|
||||
for (i=0; i<=21; i++) { // Equipped
|
||||
for (i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; i++) {
|
||||
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
|
||||
cur = m_inv.GetItem(i);
|
||||
if(cur && cur->GetItem()->Stackable) {
|
||||
@@ -57,9 +57,8 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
}
|
||||
}
|
||||
|
||||
// Power Source Slot
|
||||
if (GetItemIDAt(9999) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(9999) != INVALID_ID)) {
|
||||
cur = m_inv.GetItem(9999);
|
||||
if (GetItemIDAt(MainPowerSource) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(MainPowerSource) != INVALID_ID)) {
|
||||
cur = m_inv.GetItem(MainPowerSource);
|
||||
if(cur && cur->GetItem()->Stackable) {
|
||||
x += cur->GetCharges();
|
||||
} else {
|
||||
@@ -67,25 +66,25 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
}
|
||||
|
||||
if (GetClientVersion() >= EQClientSoF)
|
||||
DeleteItemInInventory(9999, 0, true);
|
||||
DeleteItemInInventory(MainPowerSource, 0, true);
|
||||
else
|
||||
DeleteItemInInventory(9999, 0, false); // Prevents Titanium crash
|
||||
DeleteItemInInventory(MainPowerSource, 0, false); // Prevents Titanium crash
|
||||
}
|
||||
}
|
||||
|
||||
if(where_to_check & invWhereCursor) {
|
||||
if (GetItemIDAt(30) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(30) != INVALID_ID)) {
|
||||
cur = m_inv.GetItem(30);
|
||||
if (GetItemIDAt(MainCursor) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(MainCursor) != INVALID_ID)) {
|
||||
cur = m_inv.GetItem(MainCursor);
|
||||
if(cur && cur->GetItem()->Stackable) {
|
||||
x += cur->GetCharges();
|
||||
} else {
|
||||
x++;
|
||||
}
|
||||
|
||||
DeleteItemInInventory(30, 0, true);
|
||||
DeleteItemInInventory(MainCursor, 0, true);
|
||||
}
|
||||
|
||||
for (i=331; i<=340; i++) { // cursor's containers
|
||||
for (i = EmuConstants::CURSOR_BAG_BEGIN; i <= EmuConstants::CURSOR_BAG_END; i++) {
|
||||
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
|
||||
cur = m_inv.GetItem(i);
|
||||
if(cur && cur->GetItem()->Stackable) {
|
||||
@@ -100,7 +99,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
}
|
||||
|
||||
if(where_to_check & invWherePersonal) {
|
||||
for (i=22; i<=29; i++) { // Equipped
|
||||
for (i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) {
|
||||
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
|
||||
cur = m_inv.GetItem(i);
|
||||
if(cur && cur->GetItem()->Stackable) {
|
||||
@@ -113,7 +112,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
}
|
||||
}
|
||||
|
||||
for (i=251; i<=330; i++) { // Main inventory's containers
|
||||
for (i = EmuConstants::GENERAL_BAGS_BEGIN; i <= EmuConstants::GENERAL_BAGS_END; i++) {
|
||||
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
|
||||
cur = m_inv.GetItem(i);
|
||||
if(cur && cur->GetItem()->Stackable) {
|
||||
@@ -128,7 +127,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
}
|
||||
|
||||
if(where_to_check & invWhereBank) {
|
||||
for (i=2000; i<=2023; i++) { // Bank slots
|
||||
for (i = EmuConstants::BANK_BEGIN; i <= EmuConstants::BANK_END; i++) {
|
||||
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
|
||||
cur = m_inv.GetItem(i);
|
||||
if(cur && cur->GetItem()->Stackable) {
|
||||
@@ -141,7 +140,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
}
|
||||
}
|
||||
|
||||
for (i=2031; i<=2270; i++) { // Bank's containers
|
||||
for (i = EmuConstants::BANK_BAGS_BEGIN; i <= EmuConstants::BANK_BAGS_END; i++) {
|
||||
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
|
||||
cur = m_inv.GetItem(i);
|
||||
if(cur && cur->GetItem()->Stackable) {
|
||||
@@ -156,7 +155,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
}
|
||||
|
||||
if(where_to_check & invWhereSharedBank) {
|
||||
for (i=2500; i<=2501; i++) { // Shared bank
|
||||
for (i = EmuConstants::SHARED_BANK_BEGIN; i <= EmuConstants::SHARED_BANK_END; i++) {
|
||||
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
|
||||
cur = m_inv.GetItem(i);
|
||||
if(cur && cur->GetItem()->Stackable) {
|
||||
@@ -169,7 +168,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
}
|
||||
}
|
||||
|
||||
for (i=2531; i<=2550; i++) { // Shared bank's containers
|
||||
for (i = EmuConstants::SHARED_BANK_BAGS_BEGIN; i <= EmuConstants::SHARED_BANK_BAGS_END; i++) {
|
||||
if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) {
|
||||
cur = m_inv.GetItem(i);
|
||||
if(cur && cur->GetItem()->Stackable) {
|
||||
@@ -1225,17 +1224,17 @@ void Client::SendLootItemInPacket(const ItemInst* inst, int16 slot_id)
|
||||
}
|
||||
|
||||
bool Client::IsValidSlot(uint32 slot) {
|
||||
if ((slot == (uint32)INVALID_INDEX) || // Destroying/Dropping item
|
||||
(slot >= MainCharm && slot <= MainCursor) || // Worn inventory, normal inventory, and cursor
|
||||
(slot >= 251 && slot <= 340) || // Normal inventory bags and cursor bag
|
||||
(slot >= 400 && slot <= 404) || // Tribute
|
||||
(slot >= 2000 && slot <= 2023) || // Bank
|
||||
(slot >= 2031 && slot <= 2270) || // Bank bags
|
||||
(slot >= 2500 && slot <= 2501) || // Shared bank
|
||||
(slot >= 2531 && slot <= 2550) || // Shared bank bags
|
||||
(slot >= 3000 && slot <= 3007) || // Trade window
|
||||
(slot >= 4000 && slot <= 4009) || // Tradeskill container
|
||||
(slot == MainPowerSource)) // Power Source
|
||||
if ((slot == (uint32)INVALID_INDEX) ||
|
||||
(slot >= EmuConstants::POSSESSIONS_BEGIN && slot <= EmuConstants::POSSESSIONS_END) ||
|
||||
(slot >= EmuConstants::GENERAL_BAGS_BEGIN && slot <= EmuConstants::CURSOR_BAG_END) ||
|
||||
(slot >= EmuConstants::TRIBUTE_BEGIN && slot <= EmuConstants::TRIBUTE_END) ||
|
||||
(slot >= EmuConstants::BANK_BEGIN && slot <= EmuConstants::BANK_END) ||
|
||||
(slot >= EmuConstants::BANK_BAGS_BEGIN && slot <= EmuConstants::BANK_BAGS_END) ||
|
||||
(slot >= EmuConstants::SHARED_BANK_BEGIN && slot <= EmuConstants::SHARED_BANK_END) ||
|
||||
(slot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot <= EmuConstants::SHARED_BANK_BAGS_END) ||
|
||||
(slot >= EmuConstants::TRADE_BEGIN && slot <= EmuConstants::TRADE_END) ||
|
||||
(slot >= EmuConstants::WORLD_BEGIN && slot <= EmuConstants::WORLD_END) ||
|
||||
(slot == EmuConstants::POWER_SOURCE))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@@ -1945,10 +1944,10 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
|
||||
ItemInst* ins;
|
||||
int x;
|
||||
int num = 0;
|
||||
for(x=0; x < 331; x++)
|
||||
for(x = EmuConstants::POSSESSIONS_BEGIN; x <= EmuConstants::GENERAL_BAGS_END; x++)
|
||||
{
|
||||
if (x == 31)
|
||||
x = 251;
|
||||
if (x == EmuConstants::CURSOR + 1)
|
||||
x = EmuConstants::GENERAL_BAGS_BEGIN;
|
||||
TempItem = 0;
|
||||
ins = GetInv().GetItem(x);
|
||||
if (ins)
|
||||
@@ -1962,10 +1961,10 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
|
||||
}
|
||||
if (num < amt)
|
||||
return false;
|
||||
for(x=0; x < 331; x++)
|
||||
for(x = EmuConstants::POSSESSIONS_BEGIN; x <= EmuConstants::GENERAL_BAGS_END; x++) // should this be CURSOR_BAG_END
|
||||
{
|
||||
if (x == 31)
|
||||
x = 251;
|
||||
if (x == EmuConstants::CURSOR + 1)
|
||||
x = EmuConstants::GENERAL_BAGS_BEGIN;
|
||||
TempItem = 0;
|
||||
ins = GetInv().GetItem(x);
|
||||
if (ins)
|
||||
@@ -1994,7 +1993,7 @@ void Client::RemoveNoRent(bool client_update) {
|
||||
int16 slot_id;
|
||||
|
||||
// personal
|
||||
for(slot_id = 0; slot_id <= 30; slot_id++) {
|
||||
for(slot_id = EmuConstants::POSSESSIONS_BEGIN; slot_id <= EmuConstants::POSSESSIONS_END; slot_id++) {
|
||||
const ItemInst* inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
@@ -2003,14 +2002,14 @@ void Client::RemoveNoRent(bool client_update) {
|
||||
}
|
||||
|
||||
// power source
|
||||
const ItemInst* inst = m_inv[9999];
|
||||
const ItemInst* inst = m_inv[EmuConstants::POWER_SOURCE];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent
|
||||
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, EmuConstants::POWER_SOURCE);
|
||||
DeleteItemInInventory(EmuConstants::POWER_SOURCE, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent
|
||||
}
|
||||
|
||||
// containers
|
||||
for(slot_id = 251; slot_id <= 340; slot_id++) {
|
||||
for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) {
|
||||
const ItemInst* inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
@@ -2019,7 +2018,7 @@ void Client::RemoveNoRent(bool client_update) {
|
||||
}
|
||||
|
||||
// bank
|
||||
for(slot_id = 2000; slot_id <= 2023; slot_id++) {
|
||||
for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) {
|
||||
const ItemInst* inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
@@ -2028,7 +2027,7 @@ void Client::RemoveNoRent(bool client_update) {
|
||||
}
|
||||
|
||||
// bank containers
|
||||
for(slot_id = 2031; slot_id <= 2270; slot_id++) {
|
||||
for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) {
|
||||
const ItemInst* inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
@@ -2037,7 +2036,7 @@ void Client::RemoveNoRent(bool client_update) {
|
||||
}
|
||||
|
||||
// shared bank
|
||||
for(slot_id = 2500; slot_id <= 2501; slot_id++) {
|
||||
for(slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; slot_id++) {
|
||||
const ItemInst* inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
@@ -2046,7 +2045,7 @@ void Client::RemoveNoRent(bool client_update) {
|
||||
}
|
||||
|
||||
// shared bank containers
|
||||
for(slot_id = 2531; slot_id <= 2550; slot_id++) {
|
||||
for(slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN; slot_id <= EmuConstants::SHARED_BANK_BAGS_END; slot_id++) {
|
||||
const ItemInst* inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
@@ -2061,7 +2060,7 @@ void Client::RemoveDuplicateLore(bool client_update) {
|
||||
int16 slot_id;
|
||||
|
||||
// personal
|
||||
for(slot_id = 0; slot_id <= 30; slot_id++) {
|
||||
for(slot_id = EmuConstants::POSSESSIONS_BEGIN; slot_id <= EmuConstants::POSSESSIONS_END; slot_id++) {
|
||||
ItemInst* inst = m_inv.PopItem(slot_id);
|
||||
if(inst) {
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
@@ -2076,20 +2075,20 @@ void Client::RemoveDuplicateLore(bool client_update) {
|
||||
}
|
||||
|
||||
// power source
|
||||
ItemInst* inst = m_inv.PopItem(9999);
|
||||
ItemInst* inst = m_inv.PopItem(EmuConstants::POWER_SOURCE);
|
||||
if(inst) {
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
database.SaveInventory(character_id, nullptr, 9999);
|
||||
database.SaveInventory(character_id, nullptr, EmuConstants::POWER_SOURCE);
|
||||
}
|
||||
else {
|
||||
m_inv.PutItem(9999, *inst);
|
||||
m_inv.PutItem(EmuConstants::POWER_SOURCE, *inst);
|
||||
}
|
||||
safe_delete(inst);
|
||||
}
|
||||
|
||||
// containers
|
||||
for(slot_id = 251; slot_id <= 340; slot_id++) {
|
||||
for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) {
|
||||
ItemInst* inst = m_inv.PopItem(slot_id);
|
||||
if(inst) {
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
@@ -2104,7 +2103,7 @@ void Client::RemoveDuplicateLore(bool client_update) {
|
||||
}
|
||||
|
||||
// bank
|
||||
for(slot_id = 2000; slot_id <= 2023; slot_id++) {
|
||||
for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) {
|
||||
ItemInst* inst = m_inv.PopItem(slot_id);
|
||||
if(inst) {
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
@@ -2119,7 +2118,7 @@ void Client::RemoveDuplicateLore(bool client_update) {
|
||||
}
|
||||
|
||||
// bank containers
|
||||
for(slot_id = 2031; slot_id <= 2270; slot_id++) {
|
||||
for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) {
|
||||
ItemInst* inst = m_inv.PopItem(slot_id);
|
||||
if(inst) {
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
@@ -2141,7 +2140,7 @@ void Client::MoveSlotNotAllowed(bool client_update) {
|
||||
int16 slot_id;
|
||||
|
||||
// equipment
|
||||
for(slot_id = 0; slot_id <= 21; slot_id++) {
|
||||
for(slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; slot_id++) {
|
||||
if(m_inv[slot_id] && !m_inv[slot_id]->IsSlotAllowed(slot_id)) {
|
||||
ItemInst* inst = m_inv.PopItem(slot_id);
|
||||
bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false;
|
||||
@@ -2154,7 +2153,7 @@ void Client::MoveSlotNotAllowed(bool client_update) {
|
||||
}
|
||||
|
||||
// power source
|
||||
slot_id = 9999;
|
||||
slot_id = EmuConstants::POWER_SOURCE;
|
||||
if(m_inv[slot_id] && !m_inv[slot_id]->IsSlotAllowed(slot_id)) {
|
||||
ItemInst* inst = m_inv.PopItem(slot_id);
|
||||
bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false;
|
||||
|
||||
Reference in New Issue
Block a user