mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Added the initial references for two new dictionaries - EmuConstants and EQLimits..more to come.
This commit is contained in:
+84
-81
@@ -194,10 +194,10 @@ bool Client::CheckLoreConflict(const Item_Struct* item) {
|
||||
return false;
|
||||
|
||||
if (item->LoreGroup == -1) // Standard lore items; look everywhere except the shared bank, return the result
|
||||
return (m_inv.HasItem(item->ID, 0, ~invWhereSharedBank) != SLOT_INVALID);
|
||||
return (m_inv.HasItem(item->ID, 0, ~invWhereSharedBank) != INVALID_INDEX);
|
||||
|
||||
//If the item has a lore group, we check for other items with the same group and return the result
|
||||
return (m_inv.HasItemByLoreGroup(item->LoreGroup, ~invWhereSharedBank) != SLOT_INVALID);
|
||||
return (m_inv.HasItemByLoreGroup(item->LoreGroup, ~invWhereSharedBank) != INVALID_INDEX);
|
||||
}
|
||||
|
||||
bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, uint16 to_slot) {
|
||||
@@ -244,7 +244,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
}
|
||||
*/
|
||||
|
||||
uint32 augments[MAX_AUGMENT_SLOTS] = { aug1, aug2, aug3, aug4, aug5 };
|
||||
uint32 augments[EmuConstants::ITEM_COMMON_SIZE] = { aug1, aug2, aug3, aug4, aug5 };
|
||||
|
||||
uint32 classes = item->Classes;
|
||||
uint32 races = item->Races;
|
||||
@@ -254,7 +254,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
bool enforcerestr = RuleB(Inventory, EnforceAugmentRestriction);
|
||||
bool enforceusable = RuleB(Inventory, EnforceAugmentUsability);
|
||||
|
||||
for(int iter = 0; iter < MAX_AUGMENT_SLOTS; ++iter) {
|
||||
for (int iter = 0; iter < EmuConstants::ITEM_COMMON_SIZE; ++iter) {
|
||||
const Item_Struct* augtest = database.GetItem(augments[iter]);
|
||||
|
||||
if(augtest == nullptr) {
|
||||
@@ -548,7 +548,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
}
|
||||
|
||||
// add any validated augments
|
||||
for(int iter = 0; iter < MAX_AUGMENT_SLOTS; ++iter) {
|
||||
for (int iter = 0; iter < EmuConstants::ITEM_COMMON_SIZE; ++iter) {
|
||||
if(augments[iter])
|
||||
inst->PutAugment(&database, iter, augments[iter]);
|
||||
}
|
||||
@@ -558,22 +558,22 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
inst->SetInstNoDrop(true);
|
||||
|
||||
// check to see if item is usable in requested slot
|
||||
if(enforceusable && (((to_slot >= 0) && (to_slot <= 21)) || (to_slot == 9999))) {
|
||||
uint32 slottest = (to_slot == 9999) ? 22 : to_slot;
|
||||
if(enforceusable && (((to_slot >= MainCharm) && (to_slot <= MainAmmo)) || (to_slot == MainPowerSource))) {
|
||||
uint32 slottest = (to_slot == MainPowerSource) ? 22 : to_slot; // can't change '22' just yet...
|
||||
|
||||
if(!(slots & ((uint32)1 << slottest))) {
|
||||
Message(0, "This item is not equipable at slot %u - moving to cursor.", to_slot);
|
||||
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
|
||||
GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5);
|
||||
|
||||
to_slot = SLOT_CURSOR;
|
||||
to_slot = MainCursor;
|
||||
}
|
||||
}
|
||||
|
||||
// put item into inventory
|
||||
if(to_slot == SLOT_CURSOR) {
|
||||
if (to_slot == MainCursor) {
|
||||
PushItemOnCursor(*inst);
|
||||
SendItemPacket(SLOT_CURSOR, inst, ItemPacketSummonItem);
|
||||
SendItemPacket(MainCursor, inst, ItemPacketSummonItem);
|
||||
}
|
||||
else {
|
||||
PutItemInInventory(to_slot, *inst, true);
|
||||
@@ -586,7 +586,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
if(!IsDiscovered(item_id))
|
||||
DiscoverItem(item_id);
|
||||
|
||||
for(int iter = 0; iter < MAX_AUGMENT_SLOTS; ++iter) {
|
||||
for (int iter = 0; iter < EmuConstants::ITEM_COMMON_SIZE; ++iter) {
|
||||
if(augments[iter] && !IsDiscovered(augments[iter]))
|
||||
DiscoverItem(augments[iter]);
|
||||
}
|
||||
@@ -619,7 +619,7 @@ void Client::DropItem(int16 slot_id)
|
||||
}
|
||||
|
||||
// Save client inventory change to database
|
||||
if(slot_id == SLOT_CURSOR) {
|
||||
if (slot_id == MainCursor) {
|
||||
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
database.SaveCursor(CharacterID(), s, e);
|
||||
} else {
|
||||
@@ -755,7 +755,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd
|
||||
bool isDeleted = m_inv.DeleteItem(slot_id, quantity);
|
||||
|
||||
const ItemInst* inst=nullptr;
|
||||
if (slot_id==SLOT_CURSOR) {
|
||||
if (slot_id == MainCursor) {
|
||||
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
if(update_db)
|
||||
database.SaveCursor(character_id, s, e);
|
||||
@@ -807,7 +807,7 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update)
|
||||
m_inv.PushCursor(inst);
|
||||
|
||||
if (client_update) {
|
||||
SendItemPacket(SLOT_CURSOR, &inst, ItemPacketSummonItem);
|
||||
SendItemPacket(MainCursor, &inst, ItemPacketSummonItem);
|
||||
}
|
||||
|
||||
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
@@ -817,7 +817,7 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update)
|
||||
bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update)
|
||||
{
|
||||
mlog(INVENTORY__SLOTS, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
|
||||
if (slot_id==SLOT_CURSOR)
|
||||
if (slot_id == MainCursor)
|
||||
{
|
||||
return PushItemOnCursor(inst,client_update);
|
||||
}
|
||||
@@ -825,10 +825,10 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client
|
||||
m_inv.PutItem(slot_id, inst);
|
||||
|
||||
if (client_update) {
|
||||
SendItemPacket(slot_id, &inst, (slot_id==SLOT_CURSOR)?ItemPacketSummonItem:ItemPacketTrade);
|
||||
SendItemPacket(slot_id, &inst, (slot_id == MainCursor) ? ItemPacketSummonItem : ItemPacketTrade);
|
||||
}
|
||||
|
||||
if (slot_id==SLOT_CURSOR) {
|
||||
if (slot_id == MainCursor) {
|
||||
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
return database.SaveCursor(this->CharacterID(), s, e);
|
||||
} else
|
||||
@@ -844,7 +844,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI
|
||||
|
||||
SendLootItemInPacket(&inst, slot_id);
|
||||
|
||||
if (slot_id==SLOT_CURSOR) {
|
||||
if (slot_id == MainCursor) {
|
||||
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
database.SaveCursor(this->CharacterID(), s, e);
|
||||
} else
|
||||
@@ -919,25 +919,25 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs
|
||||
|
||||
if (!m_inv[i])
|
||||
{
|
||||
if( i == SLOT_PRIMARY && inst.IsWeapon() ) // If item is primary slot weapon
|
||||
if( i == MainPrimary && inst.IsWeapon() ) // If item is primary slot weapon
|
||||
{
|
||||
if( (inst.GetItem()->ItemType == ItemType2HSlash) || (inst.GetItem()->ItemType == ItemType2HBlunt) || (inst.GetItem()->ItemType == ItemType2HPiercing) ) // and uses 2hs \ 2hb \ 2hp
|
||||
{
|
||||
if( m_inv[SLOT_SECONDARY] ) // and if secondary slot is not empty
|
||||
if( m_inv[MainSecondary] ) // and if secondary slot is not empty
|
||||
{
|
||||
continue; // Can't auto-equip
|
||||
}
|
||||
}
|
||||
}
|
||||
if( i== SLOT_SECONDARY && m_inv[SLOT_PRIMARY]) // check to see if primary slot is a two hander
|
||||
if( i== MainSecondary && m_inv[MainPrimary]) // check to see if primary slot is a two hander
|
||||
{
|
||||
uint8 use = m_inv[SLOT_PRIMARY]->GetItem()->ItemType;
|
||||
uint8 use = m_inv[MainPrimary]->GetItem()->ItemType;
|
||||
if(use == ItemType2HSlash || use == ItemType2HBlunt || use == ItemType2HPiercing)
|
||||
continue;
|
||||
}
|
||||
if
|
||||
(
|
||||
i == SLOT_SECONDARY &&
|
||||
i == MainSecondary &&
|
||||
inst.IsWeapon() &&
|
||||
!CanThisClassDualWield()
|
||||
)
|
||||
@@ -972,7 +972,7 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs
|
||||
// #3: put it in inventory
|
||||
bool is_arrow = (inst.GetItem()->ItemType == ItemTypeArrow) ? true : false;
|
||||
int16 slot_id = m_inv.FindFreeSlot(inst.IsType(ItemClassContainer), try_cursor, inst.GetItem()->Size, is_arrow);
|
||||
if (slot_id != SLOT_INVALID)
|
||||
if (slot_id != INVALID_INDEX)
|
||||
{
|
||||
PutLootInInventory(slot_id, inst, bag_item_data);
|
||||
return true;
|
||||
@@ -1000,7 +1000,7 @@ void Client::MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type)
|
||||
tmp_inst->SetCharges(tmp_inst->GetCharges() + charges_to_move);
|
||||
from.SetCharges(from.GetCharges() - charges_to_move);
|
||||
SendLootItemInPacket(tmp_inst, to_slot);
|
||||
if (to_slot==SLOT_CURSOR){
|
||||
if (to_slot == MainCursor){
|
||||
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
database.SaveCursor(this->CharacterID(), s, e);
|
||||
} else
|
||||
@@ -1224,25 +1224,21 @@ void Client::SendLootItemInPacket(const ItemInst* inst, int16 slot_id)
|
||||
SendItemPacket(slot_id,inst, ItemPacketTrade);
|
||||
}
|
||||
|
||||
bool Client::IsValidSlot(uint32 slot)
|
||||
{
|
||||
if((slot == (uint32)SLOT_INVALID) || // Destroying/Dropping item
|
||||
(slot >= 0 && slot <= 30) || // 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 == 9999)) // Power Source
|
||||
{
|
||||
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
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Client::IsBankSlot(uint32 slot)
|
||||
@@ -1289,12 +1285,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (move_in->to_slot == (uint32)SLOT_INVALID) {
|
||||
if(move_in->from_slot == (uint32)SLOT_CURSOR) {
|
||||
if (move_in->to_slot == (uint32)INVALID_INDEX) {
|
||||
if (move_in->from_slot == (uint32)MainCursor) {
|
||||
mlog(INVENTORY__SLOTS, "Client destroyed item from cursor slot %d", move_in->from_slot);
|
||||
if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit
|
||||
|
||||
ItemInst *inst = m_inv.GetItem(SLOT_CURSOR);
|
||||
ItemInst *inst = m_inv.GetItem(MainCursor);
|
||||
if(inst) {
|
||||
parse->EventItem(EVENT_DESTROY_ITEM, this, inst, nullptr, "", 0);
|
||||
}
|
||||
@@ -1309,9 +1305,9 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
return true; // Item deletetion
|
||||
}
|
||||
}
|
||||
if(auto_attack && (move_in->from_slot == SLOT_PRIMARY || move_in->from_slot == SLOT_SECONDARY || move_in->from_slot == SLOT_RANGE))
|
||||
if(auto_attack && (move_in->from_slot == MainPrimary || move_in->from_slot == MainSecondary || move_in->from_slot == MainRange))
|
||||
SetAttackTimer();
|
||||
else if(auto_attack && (move_in->to_slot == SLOT_PRIMARY || move_in->to_slot == SLOT_SECONDARY || move_in->to_slot == SLOT_RANGE))
|
||||
else if(auto_attack && (move_in->to_slot == MainPrimary || move_in->to_slot == MainSecondary || move_in->to_slot == MainRange))
|
||||
SetAttackTimer();
|
||||
// Step 1: Variables
|
||||
int16 src_slot_id = (int16)move_in->from_slot;
|
||||
@@ -1501,7 +1497,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
}
|
||||
|
||||
safe_delete(world_inst);
|
||||
if (src_slot_id==SLOT_CURSOR) {
|
||||
if (src_slot_id == MainCursor) {
|
||||
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
database.SaveCursor(character_id, s, e);
|
||||
} else
|
||||
@@ -1515,14 +1511,14 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
|
||||
// Step 4: Check for entity trade
|
||||
if (dst_slot_id>=3000 && dst_slot_id<=3007) {
|
||||
if (src_slot_id != SLOT_CURSOR) {
|
||||
if (src_slot_id != MainCursor) {
|
||||
Kick();
|
||||
return false;
|
||||
}
|
||||
if (with) {
|
||||
mlog(INVENTORY__SLOTS, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName());
|
||||
// Fill Trade list with items from cursor
|
||||
if (!m_inv[SLOT_CURSOR]) {
|
||||
if (!m_inv[MainCursor]) {
|
||||
Message(13, "Error: Cursor item not located on server!");
|
||||
return false;
|
||||
}
|
||||
@@ -1538,7 +1534,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit
|
||||
|
||||
SummonItem(src_inst->GetID(), src_inst->GetCharges());
|
||||
DeleteItemInInventory(SLOT_CURSOR);
|
||||
DeleteItemInInventory(MainCursor);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1601,12 +1597,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
}
|
||||
else {
|
||||
// Not dealing with charges - just do direct swap
|
||||
if(src_inst && (dst_slot_id < 22 || dst_slot_id == 9999) && dst_slot_id >= 0) {
|
||||
if(src_inst && (dst_slot_id <= MainAmmo || dst_slot_id == MainPowerSource) && dst_slot_id >= MainCharm) {
|
||||
if (src_inst->GetItem()->Attuneable) {
|
||||
src_inst->SetInstNoDrop(true);
|
||||
}
|
||||
if (src_inst->IsAugmented()) {
|
||||
for(int i = 0; i < MAX_AUGMENT_SLOTS; i++) {
|
||||
for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
|
||||
if (src_inst->GetAugment(i)) {
|
||||
if (src_inst->GetAugment(i)->GetItem()->Attuneable) {
|
||||
src_inst->GetAugment(i)->SetInstNoDrop(true);
|
||||
@@ -1619,7 +1615,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; }
|
||||
mlog(INVENTORY__SLOTS, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id);
|
||||
|
||||
if(src_slot_id < 22 || src_slot_id == 9999) {
|
||||
if(src_slot_id <= MainAmmo || src_slot_id == MainPowerSource) {
|
||||
if(src_inst) {
|
||||
parse->EventItem(EVENT_UNEQUIP_ITEM, this, src_inst, nullptr, "", src_slot_id);
|
||||
}
|
||||
@@ -1629,7 +1625,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
}
|
||||
}
|
||||
|
||||
if(dst_slot_id < 22 || dst_slot_id == 9999) {
|
||||
if(dst_slot_id <= MainAmmo || dst_slot_id == MainPowerSource) {
|
||||
if(dst_inst) {
|
||||
parse->EventItem(EVENT_UNEQUIP_ITEM, this, dst_inst, nullptr, "", dst_slot_id);
|
||||
}
|
||||
@@ -1646,12 +1642,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
}
|
||||
|
||||
// Step 7: Save change to the database
|
||||
if (src_slot_id==SLOT_CURSOR){
|
||||
if (src_slot_id == MainCursor){
|
||||
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
database.SaveCursor(character_id, s, e);
|
||||
} else
|
||||
database.SaveInventory(character_id, m_inv.GetItem(src_slot_id), src_slot_id);
|
||||
if (dst_slot_id==SLOT_CURSOR) {
|
||||
if (dst_slot_id == MainCursor) {
|
||||
std::list<ItemInst*>::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end();
|
||||
database.SaveCursor(character_id, s, e);
|
||||
} else
|
||||
@@ -1665,14 +1661,17 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
}
|
||||
|
||||
void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
// wow..this thing created a helluva memory leak...
|
||||
// with any luck..this won't be needed in the future
|
||||
|
||||
// resync the 'from' and 'to' slots on an as-needed basis
|
||||
// Not as effective as the full process, but less intrusive to gameplay -U
|
||||
mlog(INVENTORY__ERROR, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot);
|
||||
Message(15, "Inventory Desyncronization detected: Resending slot data...");
|
||||
|
||||
if((move_slots->from_slot >= 0 && move_slots->from_slot <= 340) || move_slots->from_slot == 9999) {
|
||||
int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == SLOT_INVALID) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot);
|
||||
if(IsValidSlot(resync_slot) && resync_slot != SLOT_INVALID) {
|
||||
if((move_slots->from_slot >= MainCharm && move_slots->from_slot <= 340) || move_slots->from_slot == MainPowerSource) {
|
||||
int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot);
|
||||
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
|
||||
// This prevents the client from crashing when closing any 'phantom' bags -U
|
||||
const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin'
|
||||
ItemInst* token_inst = database.CreateItem(token_struct, 1);
|
||||
@@ -1690,13 +1689,14 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
safe_delete(token_inst);
|
||||
Message(14, "Source slot %i resyncronized.", move_slots->from_slot);
|
||||
}
|
||||
else { Message(13, "Could not resyncronize source slot %i.", move_slots->from_slot); }
|
||||
}
|
||||
else {
|
||||
int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == SLOT_INVALID) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot);
|
||||
if(IsValidSlot(resync_slot) && resync_slot != SLOT_INVALID) {
|
||||
int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot);
|
||||
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
|
||||
if(m_inv[resync_slot]) {
|
||||
const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin'
|
||||
ItemInst* token_inst = database.CreateItem(token_struct, 1);
|
||||
@@ -1704,6 +1704,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
SendItemPacket(resync_slot, token_inst, ItemPacketTrade);
|
||||
SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade);
|
||||
|
||||
safe_delete(token_inst);
|
||||
Message(14, "Source slot %i resyncronized.", move_slots->from_slot);
|
||||
}
|
||||
else { Message(13, "Could not resyncronize source slot %i.", move_slots->from_slot); }
|
||||
@@ -1711,9 +1712,9 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
else { Message(13, "Could not resyncronize source slot %i.", move_slots->from_slot); }
|
||||
}
|
||||
|
||||
if((move_slots->to_slot >= 0 && move_slots->to_slot <= 340) || move_slots->to_slot == 9999) {
|
||||
int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == SLOT_INVALID) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot);
|
||||
if(IsValidSlot(resync_slot) && resync_slot != SLOT_INVALID) {
|
||||
if((move_slots->to_slot >= MainCharm && move_slots->to_slot <= 340) || move_slots->to_slot == MainPowerSource) {
|
||||
int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot);
|
||||
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
|
||||
const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin'
|
||||
ItemInst* token_inst = database.CreateItem(token_struct, 1);
|
||||
|
||||
@@ -1730,13 +1731,14 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
safe_delete(token_inst);
|
||||
Message(14, "Destination slot %i resyncronized.", move_slots->to_slot);
|
||||
}
|
||||
else { Message(13, "Could not resyncronize destination slot %i.", move_slots->to_slot); }
|
||||
}
|
||||
else {
|
||||
int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == SLOT_INVALID) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot);
|
||||
if(IsValidSlot(resync_slot) && resync_slot != SLOT_INVALID) {
|
||||
int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot);
|
||||
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
|
||||
if(m_inv[resync_slot]) {
|
||||
const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin'
|
||||
ItemInst* token_inst = database.CreateItem(token_struct, 1);
|
||||
@@ -1744,6 +1746,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
SendItemPacket(resync_slot, token_inst, ItemPacketTrade);
|
||||
SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade);
|
||||
|
||||
safe_delete(token_inst);
|
||||
Message(14, "Destination slot %i resyncronized.", move_slots->to_slot);
|
||||
}
|
||||
else { Message(13, "Could not resyncronize destination slot %i.", move_slots->to_slot); }
|
||||
@@ -1857,7 +1860,7 @@ void Client::DyeArmor(DyeStruct* dye){
|
||||
m_pp.item_tint[i].rgb.red!=dye->dye[i].rgb.red ||
|
||||
m_pp.item_tint[i].rgb.green != dye->dye[i].rgb.green){
|
||||
slot = m_inv.HasItem(32557, 1, invWherePersonal);
|
||||
if(slot != SLOT_INVALID){
|
||||
if (slot != INVALID_INDEX){
|
||||
DeleteItemInInventory(slot,1,true);
|
||||
uint8 slot2=SlotConvert(i);
|
||||
ItemInst* inst = this->m_inv.GetItem(slot2);
|
||||
@@ -2003,7 +2006,7 @@ void Client::RemoveNoRent(bool client_update) {
|
||||
const ItemInst* inst = m_inv[9999];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(9999, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent
|
||||
DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent
|
||||
}
|
||||
|
||||
// containers
|
||||
@@ -2283,13 +2286,13 @@ static int16 BandolierSlotToWeaponSlot(int BandolierSlot) {
|
||||
|
||||
switch(BandolierSlot) {
|
||||
case bandolierMainHand:
|
||||
return SLOT_PRIMARY;
|
||||
return MainPrimary;
|
||||
case bandolierOffHand:
|
||||
return SLOT_SECONDARY;
|
||||
return MainSecondary;
|
||||
case bandolierRange:
|
||||
return SLOT_RANGE;
|
||||
return MainRange;
|
||||
default:
|
||||
return SLOT_AMMO;
|
||||
return MainAmmo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2365,12 +2368,12 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
|
||||
invWhereWorn|invWherePersonal);
|
||||
|
||||
// removed 'invWhereCursor' argument from above and implemented slots 30, 331-340 checks here
|
||||
if (slot == SLOT_INVALID) {
|
||||
if (m_inv.GetItem(SLOT_CURSOR)) {
|
||||
if (m_inv.GetItem(SLOT_CURSOR)->GetItem()->ID == m_pp.bandoliers[bss->number].items[BandolierSlot].item_id &&
|
||||
m_inv.GetItem(SLOT_CURSOR)->GetCharges() >= 1) // '> 0' the same, but this matches Inventory::_HasItem conditional check
|
||||
slot = SLOT_CURSOR;
|
||||
else if (m_inv.GetItem(SLOT_CURSOR)->GetItem()->ItemClass == 1) {
|
||||
if (slot == INVALID_INDEX) {
|
||||
if (m_inv.GetItem(MainCursor)) {
|
||||
if (m_inv.GetItem(MainCursor)->GetItem()->ID == m_pp.bandoliers[bss->number].items[BandolierSlot].item_id &&
|
||||
m_inv.GetItem(MainCursor)->GetCharges() >= 1) // '> 0' the same, but this matches Inventory::_HasItem conditional check
|
||||
slot = MainCursor;
|
||||
else if (m_inv.GetItem(MainCursor)->GetItem()->ItemClass == 1) {
|
||||
for(int16 CursorBagSlot = 331; CursorBagSlot <= 340; CursorBagSlot++) {
|
||||
if (m_inv.GetItem(CursorBagSlot)) {
|
||||
if (m_inv.GetItem(CursorBagSlot)->GetItem()->ID == m_pp.bandoliers[bss->number].items[BandolierSlot].item_id &&
|
||||
@@ -2385,7 +2388,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
|
||||
}
|
||||
|
||||
// if the player has this item in their inventory,
|
||||
if(slot != SLOT_INVALID) {
|
||||
if (slot != INVALID_INDEX) {
|
||||
// Pull the item out of the inventory
|
||||
BandolierItems[BandolierSlot] = m_inv.PopItem(slot);
|
||||
// If ammo with charges, only take one charge out to put in the range slot, that is what
|
||||
@@ -2410,7 +2413,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
|
||||
}
|
||||
else { // The player doesn't have the required weapon with them.
|
||||
BandolierItems[BandolierSlot] = 0;
|
||||
if(slot == SLOT_INVALID) {
|
||||
if (slot == INVALID_INDEX) {
|
||||
_log(INVENTORY__BANDOLIER, "Character does not have required bandolier item for slot %i", WeaponSlot);
|
||||
ItemInst *InvItem = m_inv.PopItem(WeaponSlot);
|
||||
if(InvItem) {
|
||||
|
||||
Reference in New Issue
Block a user