mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
[Cleanup] Convert DeleteItemInInventory quantity to int16. (#1767)
* [Cleanup] Convert DeleteItemInInventory quantity to int16. * Type conversion.
This commit is contained in:
parent
bf8a0328b3
commit
3efd9c7f60
@ -399,7 +399,7 @@ bool EQ::InventoryProfile::SwapItem(
|
||||
}
|
||||
|
||||
// Remove item from inventory (with memory delete)
|
||||
bool EQ::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) {
|
||||
bool EQ::InventoryProfile::DeleteItem(int16 slot_id, int16 quantity) {
|
||||
// Pop item out of inventory map (or queue)
|
||||
ItemInstance *item_to_delete = PopItem(slot_id);
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ namespace EQ
|
||||
bool SwapItem(int16 source_slot, int16 destination_slot, SwapItemFailState& fail_state, uint16 race_id = 0, uint8 class_id = 0, uint16 deity_id = 0, uint8 level = 0);
|
||||
|
||||
// Remove item from inventory
|
||||
bool DeleteItem(int16 slot_id, uint8 quantity = 0);
|
||||
bool DeleteItem(int16 slot_id, int16 quantity = 0);
|
||||
|
||||
// Checks All items in a bag for No Drop
|
||||
bool CheckNoDrop(int16 slot_id, bool recurse = true);
|
||||
|
||||
@ -8501,7 +8501,7 @@ void Client::Consume(const EQ::ItemData *item, uint8 type, int16 slot, bool auto
|
||||
|
||||
LogFood("Consuming food, points added to hunger_level: [{}] - current_hunger: [{}]", increase, m_pp.hunger_level);
|
||||
|
||||
DeleteItemInInventory(slot, 1, false);
|
||||
DeleteItemInInventory(slot, 1);
|
||||
|
||||
if (!auto_consume) // no message if the client consumed for us
|
||||
entity_list.MessageCloseString(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name);
|
||||
@ -8516,7 +8516,7 @@ void Client::Consume(const EQ::ItemData *item, uint8 type, int16 slot, bool auto
|
||||
|
||||
m_pp.thirst_level += increase;
|
||||
|
||||
DeleteItemInInventory(slot, 1, false);
|
||||
DeleteItemInInventory(slot, 1);
|
||||
|
||||
LogFood("Consuming drink, points added to thirst_level: [{}] current_thirst: [{}]", increase, m_pp.thirst_level);
|
||||
|
||||
@ -10285,7 +10285,7 @@ void Client::RemoveItem(uint32 item_id, uint32 quantity)
|
||||
{ EQ::invslot::SHARED_BANK_BEGIN, EQ::invslot::SHARED_BANK_END },
|
||||
{ EQ::invbag::SHARED_BANK_BAGS_BEGIN, EQ::invbag::SHARED_BANK_BAGS_END },
|
||||
};
|
||||
int removed_count = 0;
|
||||
int16 removed_count = 0;
|
||||
const size_t size = sizeof(slots) / sizeof(slots[0]);
|
||||
for (int slot_index = 0; slot_index < size; ++slot_index) {
|
||||
for (int slot_id = slots[slot_index][0]; slot_id <= slots[slot_index][1]; ++slot_id) {
|
||||
@ -10295,13 +10295,13 @@ void Client::RemoveItem(uint32 item_id, uint32 quantity)
|
||||
|
||||
item = GetInv().GetItem(slot_id);
|
||||
if (item && item->GetID() == item_id) {
|
||||
int charges = item->IsStackable() ? item->GetCharges() : 0;
|
||||
int stack_size = std::max(charges, 1);
|
||||
int16 charges = item->IsStackable() ? item->GetCharges() : 0;
|
||||
int16 stack_size = std::max(charges, static_cast<int16>(1));
|
||||
if ((removed_count + stack_size) <= quantity) {
|
||||
removed_count += stack_size;
|
||||
DeleteItemInInventory(slot_id, charges, true);
|
||||
} else {
|
||||
int amount_left = (quantity - removed_count);
|
||||
int16 amount_left = (quantity - removed_count);
|
||||
if (amount_left > 0 && stack_size >= amount_left) {
|
||||
removed_count += amount_left;
|
||||
DeleteItemInInventory(slot_id, amount_left, true);
|
||||
|
||||
@ -301,8 +301,8 @@ public:
|
||||
uint16 FindTraderItem(int32 SerialNumber,uint16 Quantity);
|
||||
uint32 FindTraderItemSerialNumber(int32 ItemID);
|
||||
EQ::ItemInstance* FindTraderItemBySerialNumber(int32 SerialNumber);
|
||||
void FindAndNukeTraderItem(int32 item_id,uint16 quantity,Client* customer,uint16 traderslot);
|
||||
void NukeTraderItem(uint16 slot, int16 charges, uint16 quantity, Client* customer, uint16 traderslot, int32 uniqueid, int32 itemid = 0);
|
||||
void FindAndNukeTraderItem(int32 item_id,int16 quantity,Client* customer,uint16 traderslot);
|
||||
void NukeTraderItem(uint16 slot, int16 charges, int16 quantity, Client* customer, uint16 traderslot, int32 uniqueid, int32 itemid = 0);
|
||||
void ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges, uint32 itemid = 0);
|
||||
void TradeRequestFailed(const EQApplicationPacket* app);
|
||||
void BuyTraderItem(TraderBuy_Struct* tbs,Client* trader,const EQApplicationPacket* app);
|
||||
@ -919,7 +919,7 @@ public:
|
||||
bool PutItemInInventory(int16 slot_id, const EQ::ItemInstance& inst, bool client_update = false);
|
||||
bool PushItemOnCursor(const EQ::ItemInstance& inst, bool client_update = false);
|
||||
void SendCursorBuffer();
|
||||
void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true);
|
||||
void DeleteItemInInventory(int16 slot_id, int16 quantity = 0, bool client_update = false, bool update_db = true);
|
||||
int CountItem(uint32 item_id);
|
||||
void RemoveItem(uint32 item_id, uint32 quantity = 1);
|
||||
bool SwapItem(MoveItem_Struct* move_in);
|
||||
@ -973,7 +973,7 @@ public:
|
||||
|
||||
//remove charges/multiple objects from inventory:
|
||||
//bool DecreaseByType(uint32 type, uint8 amt);
|
||||
bool DecreaseByID(uint32 type, uint8 amt);
|
||||
bool DecreaseByID(uint32 type, int16 quantity);
|
||||
uint8 SlotConvert2(uint8 slot); //Maybe not needed.
|
||||
void Escape(); //AA Escape
|
||||
void DisenchantSummonedBags(bool client_update = true);
|
||||
|
||||
@ -2278,7 +2278,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app)
|
||||
|
||||
if (!inst->IsStackable())
|
||||
{
|
||||
DeleteItemInInventory(ams_in->slot, 0, false);
|
||||
DeleteItemInInventory(ams_in->slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2293,7 +2293,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
DeleteItemInInventory(ams_in->slot, ams_in->charges, false);
|
||||
DeleteItemInInventory(ams_in->slot, ams_in->charges);
|
||||
price *= ams_in->charges;
|
||||
}
|
||||
|
||||
@ -2764,7 +2764,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app)
|
||||
|
||||
if (!inst->IsStackable())
|
||||
{
|
||||
DeleteItemInInventory(sell->slot_id, 0, false);
|
||||
DeleteItemInInventory(sell->slot_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2779,7 +2779,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
DeleteItemInInventory(sell->slot_id, sell->charges, false);
|
||||
DeleteItemInInventory(sell->slot_id, sell->charges);
|
||||
cost *= sell->charges;
|
||||
}
|
||||
|
||||
@ -9057,48 +9057,6 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
|
||||
{
|
||||
LogDebug("Error: unknown item->Click.Type ([{}])", item->Click.Type);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
//This is food/drink - consume it
|
||||
if (item->ItemType == EQ::item::ItemTypeFood && m_pp.hunger_level < 5000)
|
||||
{
|
||||
Consume(item, item->ItemType, slot_id, false);
|
||||
}
|
||||
else if (item->ItemType == EQ::item::ItemTypeDrink && m_pp.thirst_level < 5000)
|
||||
{
|
||||
Consume(item, item->ItemType, slot_id, false);
|
||||
}
|
||||
else if (item->ItemType == EQ::item::ItemTypeAlcohol)
|
||||
{
|
||||
#if EQDEBUG >= 1
|
||||
LogDebug("Drinking Alcohol from slot:[{}]", slot_id);
|
||||
#endif
|
||||
// This Seems to be handled in OP_DeleteItem handling
|
||||
//DeleteItemInInventory(slot_id, 1, false);
|
||||
//entity_list.MessageCloseString(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name);
|
||||
//Should add intoxication level to the PP at some point
|
||||
//CheckIncreaseSkill(ALCOHOL_TOLERANCE, nullptr, 25);
|
||||
}
|
||||
|
||||
EQApplicationPacket *outapp2 = nullptr;
|
||||
outapp2 = new EQApplicationPacket(OP_Stamina, sizeof(Stamina_Struct));
|
||||
Stamina_Struct* sta = (Stamina_Struct*)outapp2->pBuffer;
|
||||
|
||||
if (m_pp.hunger_level > 6000)
|
||||
sta->food = 6000;
|
||||
if (m_pp.thirst_level > 6000)
|
||||
sta->water = 6000;
|
||||
|
||||
sta->food = m_pp.hunger_level;
|
||||
sta->water = m_pp.thirst_level;
|
||||
|
||||
QueuePacket(outapp2);
|
||||
safe_delete(outapp2);
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -13413,26 +13371,14 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
|
||||
// end QS code
|
||||
|
||||
// Now remove the item from the player, this happens regardless of outcome
|
||||
if (!inst->IsStackable())
|
||||
this->DeleteItemInInventory(mp->itemslot, 0, false);
|
||||
else {
|
||||
// HACK: DeleteItemInInventory uses int8 for quantity type. There is no consistent use of types in code in this path so for now iteratively delete from inventory.
|
||||
if (mp->quantity > 255) {
|
||||
uint32 temp = mp->quantity;
|
||||
while (temp > 255 && temp != 0) {
|
||||
// Delete chunks of 255
|
||||
this->DeleteItemInInventory(mp->itemslot, 255, false);
|
||||
temp -= 255;
|
||||
}
|
||||
if (temp != 0) {
|
||||
// Delete remaining
|
||||
this->DeleteItemInInventory(mp->itemslot, temp, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->DeleteItemInInventory(mp->itemslot, mp->quantity, false);
|
||||
}
|
||||
}
|
||||
DeleteItemInInventory(
|
||||
mp->itemslot,
|
||||
(
|
||||
!inst->IsStackable() ?
|
||||
0 :
|
||||
mp->quantity
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
//This forces the price to show up correctly for charged items.
|
||||
|
||||
@ -1093,7 +1093,7 @@ void Client::SendCursorBuffer()
|
||||
}
|
||||
|
||||
// Remove item from inventory
|
||||
void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_update, bool update_db) {
|
||||
void Client::DeleteItemInInventory(int16 slot_id, int16 quantity, bool client_update, bool update_db) {
|
||||
#if (EQDEBUG >= 5)
|
||||
LogDebug("DeleteItemInInventory([{}], [{}], [{}])", slot_id, quantity, (client_update) ? "true":"false");
|
||||
#endif
|
||||
@ -2503,67 +2503,14 @@ void Client::DyeArmorBySlot(uint8 slot, uint8 red, uint8 green, uint8 blue, uint
|
||||
SendWearChange(slot);
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool Client::DecreaseByItemType(uint32 type, uint8 amt) {
|
||||
const ItemData* TempItem = 0;
|
||||
EQ::ItemInstance* ins;
|
||||
int x;
|
||||
for(x=EQ::legacy::POSSESSIONS_BEGIN; x <= EQ::legacy::POSSESSIONS_END; x++)
|
||||
{
|
||||
TempItem = 0;
|
||||
ins = GetInv().GetItem(x);
|
||||
if (ins)
|
||||
TempItem = ins->GetItem();
|
||||
if (TempItem && TempItem->ItemType == type)
|
||||
{
|
||||
if (ins->GetCharges() < amt)
|
||||
{
|
||||
amt -= ins->GetCharges();
|
||||
DeleteItemInInventory(x,amt,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DeleteItemInInventory(x,amt,true);
|
||||
amt = 0;
|
||||
}
|
||||
if (amt < 1)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for(x=EQ::legacy::GENERAL_BAGS_BEGIN; x <= EQ::legacy::GENERAL_BAGS_END; x++)
|
||||
{
|
||||
TempItem = 0;
|
||||
ins = GetInv().GetItem(x);
|
||||
if (ins)
|
||||
TempItem = ins->GetItem();
|
||||
if (TempItem && TempItem->ItemType == type)
|
||||
{
|
||||
if (ins->GetCharges() < amt)
|
||||
{
|
||||
amt -= ins->GetCharges();
|
||||
DeleteItemInInventory(x,amt,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DeleteItemInInventory(x,amt,true);
|
||||
amt = 0;
|
||||
}
|
||||
if (amt < 1)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Client::DecreaseByID(uint32 type, uint8 amt) {
|
||||
bool Client::DecreaseByID(uint32 type, int16 quantity) {
|
||||
const EQ::ItemData* TempItem = nullptr;
|
||||
EQ::ItemInstance* ins = nullptr;
|
||||
int x;
|
||||
int num = 0;
|
||||
|
||||
for (x = EQ::invslot::POSSESSIONS_BEGIN; x <= EQ::invslot::POSSESSIONS_END; ++x) {
|
||||
if (num >= amt)
|
||||
if (num >= quantity)
|
||||
break;
|
||||
if (((uint64)1 << x) & GetInv().GetLookup()->PossessionsBitmask == 0)
|
||||
continue;
|
||||
@ -2577,7 +2524,7 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
|
||||
}
|
||||
|
||||
for (x = EQ::invbag::GENERAL_BAGS_BEGIN; x <= EQ::invbag::GENERAL_BAGS_END; ++x) {
|
||||
if (num >= amt)
|
||||
if (num >= quantity)
|
||||
break;
|
||||
if ((((uint64)1 << (EQ::invslot::GENERAL_BEGIN + ((x - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT))) & GetInv().GetLookup()->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
@ -2591,7 +2538,7 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
|
||||
}
|
||||
|
||||
for (x = EQ::invbag::CURSOR_BAG_BEGIN; x <= EQ::invbag::CURSOR_BAG_END; ++x) {
|
||||
if (num >= amt)
|
||||
if (num >= quantity)
|
||||
break;
|
||||
|
||||
TempItem = nullptr;
|
||||
@ -2602,12 +2549,12 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
|
||||
num += ins->GetCharges();
|
||||
}
|
||||
|
||||
if (num < amt)
|
||||
if (num < quantity)
|
||||
return false;
|
||||
|
||||
|
||||
for (x = EQ::invslot::POSSESSIONS_BEGIN; x <= EQ::invslot::POSSESSIONS_END; ++x) {
|
||||
if (amt < 1)
|
||||
if (quantity < 1)
|
||||
break;
|
||||
if (((uint64)1 << x) & GetInv().GetLookup()->PossessionsBitmask == 0)
|
||||
continue;
|
||||
@ -2619,18 +2566,18 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
|
||||
if (TempItem && TempItem->ID != type)
|
||||
continue;
|
||||
|
||||
if (ins->GetCharges() < amt) {
|
||||
amt -= ins->GetCharges();
|
||||
DeleteItemInInventory(x, amt, true);
|
||||
if (ins->GetCharges() < quantity) {
|
||||
quantity -= ins->GetCharges();
|
||||
DeleteItemInInventory(x, quantity, true);
|
||||
}
|
||||
else {
|
||||
DeleteItemInInventory(x, amt, true);
|
||||
amt = 0;
|
||||
DeleteItemInInventory(x, quantity, true);
|
||||
quantity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (x = EQ::invbag::GENERAL_BAGS_BEGIN; x <= EQ::invbag::GENERAL_BAGS_END; ++x) {
|
||||
if (amt < 1)
|
||||
if (quantity < 1)
|
||||
break;
|
||||
if ((((uint64)1 << (EQ::invslot::GENERAL_BEGIN + ((x - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT))) & GetInv().GetLookup()->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
@ -2642,18 +2589,18 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
|
||||
if (TempItem && TempItem->ID != type)
|
||||
continue;
|
||||
|
||||
if (ins->GetCharges() < amt) {
|
||||
amt -= ins->GetCharges();
|
||||
DeleteItemInInventory(x, amt, true);
|
||||
if (ins->GetCharges() < quantity) {
|
||||
quantity -= ins->GetCharges();
|
||||
DeleteItemInInventory(x, quantity, true);
|
||||
}
|
||||
else {
|
||||
DeleteItemInInventory(x, amt, true);
|
||||
amt = 0;
|
||||
DeleteItemInInventory(x, quantity, true);
|
||||
quantity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (x = EQ::invbag::CURSOR_BAG_BEGIN; x <= EQ::invbag::CURSOR_BAG_END; ++x) {
|
||||
if (amt < 1)
|
||||
if (quantity < 1)
|
||||
break;
|
||||
|
||||
TempItem = nullptr;
|
||||
@ -2663,13 +2610,13 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
|
||||
if (TempItem && TempItem->ID != type)
|
||||
continue;
|
||||
|
||||
if (ins->GetCharges() < amt) {
|
||||
amt -= ins->GetCharges();
|
||||
DeleteItemInInventory(x, amt, true);
|
||||
if (ins->GetCharges() < quantity) {
|
||||
quantity -= ins->GetCharges();
|
||||
DeleteItemInInventory(x, quantity, true);
|
||||
}
|
||||
else {
|
||||
DeleteItemInInventory(x, amt, true);
|
||||
amt = 0;
|
||||
DeleteItemInInventory(x, quantity, true);
|
||||
quantity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2906,7 +2853,7 @@ void Client::RemoveNoRent(bool client_update)
|
||||
auto inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank slots
|
||||
DeleteItemInInventory(slot_id); // Can't delete from client Bank slots
|
||||
}
|
||||
}
|
||||
|
||||
@ -2918,7 +2865,7 @@ void Client::RemoveNoRent(bool client_update)
|
||||
auto inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank Container slots
|
||||
DeleteItemInInventory(slot_id); // Can't delete from client Bank Container slots
|
||||
}
|
||||
}
|
||||
|
||||
@ -2926,7 +2873,7 @@ void Client::RemoveNoRent(bool client_update)
|
||||
auto inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank slots
|
||||
DeleteItemInInventory(slot_id); // Can't delete from client Shared Bank slots
|
||||
}
|
||||
}
|
||||
|
||||
@ -2934,7 +2881,7 @@ void Client::RemoveNoRent(bool client_update)
|
||||
auto inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank Container slots
|
||||
DeleteItemInInventory(slot_id); // Can't delete from client Shared Bank Container slots
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2379,17 +2379,17 @@ XS(XS_Client_DeleteItemInInventory); /* prototype to pass -Wmissing-prototypes *
|
||||
XS(XS_Client_DeleteItemInInventory) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 4)
|
||||
Perl_croak(aTHX_ "Usage: Client::DeleteItemInInventory(THIS, int16 slot_id, [int8 quantity = 0], [bool client_update = false])"); // @categories Inventory and Items
|
||||
Perl_croak(aTHX_ "Usage: Client::DeleteItemInInventory(THIS, int16 slot_id, [int16 quantity = 0], [bool client_update = false])"); // @categories Inventory and Items
|
||||
{
|
||||
Client *THIS;
|
||||
int16 slot_id = (int16) SvIV(ST(1));
|
||||
int8 quantity;
|
||||
int16 quantity;
|
||||
bool client_update;
|
||||
VALIDATE_THIS_IS_CLIENT;
|
||||
if (items < 3)
|
||||
quantity = 0;
|
||||
else {
|
||||
quantity = (int8) SvIV(ST(2));
|
||||
quantity = (int16) SvIV(ST(2));
|
||||
}
|
||||
|
||||
if (items < 4)
|
||||
@ -2638,14 +2638,14 @@ XS(XS_Client_DecreaseByID); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_DecreaseByID) {
|
||||
dXSARGS;
|
||||
if (items != 3)
|
||||
Perl_croak(aTHX_ "Usage: Client::DecreaseByID(THIS, uint32 type, unit8 amount)"); // @categories Script Utility
|
||||
Perl_croak(aTHX_ "Usage: Client::DecreaseByID(THIS, uint32 type, int16 quantity)"); // @categories Script Utility
|
||||
{
|
||||
Client *THIS;
|
||||
bool RETVAL;
|
||||
uint32 type = (uint32) SvUV(ST(1));
|
||||
uint8 amt = (uint8) SvUV(ST(2));
|
||||
int16 quantity = (int16) SvIV(ST(2));
|
||||
VALIDATE_THIS_IS_CLIENT;
|
||||
RETVAL = THIS->DecreaseByID(type, amt);
|
||||
RETVAL = THIS->DecreaseByID(type, quantity);
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
}
|
||||
|
||||
@ -622,22 +622,21 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
if(IsClient()){
|
||||
EQ::ItemInstance* transI = CastToClient()->GetInv().GetItem(EQ::invslot::slotCursor);
|
||||
if (transI && transI->IsClassCommon() && transI->IsStackable()){
|
||||
uint32 fcharges = transI->GetCharges();
|
||||
//Does it sound like meat... maybe should check if it looks like meat too...
|
||||
if(strstr(transI->GetItem()->Name, "meat") ||
|
||||
strstr(transI->GetItem()->Name, "Meat") ||
|
||||
strstr(transI->GetItem()->Name, "flesh") ||
|
||||
strstr(transI->GetItem()->Name, "Flesh") ||
|
||||
strstr(transI->GetItem()->Name, "parts") ||
|
||||
strstr(transI->GetItem()->Name, "Parts")){
|
||||
CastToClient()->DeleteItemInInventory(EQ::invslot::slotCursor, fcharges, true);
|
||||
CastToClient()->SummonItem(13073, fcharges);
|
||||
}
|
||||
else{
|
||||
Message(Chat::Red, "You can only transmute flesh to bone.");
|
||||
}
|
||||
int16 fcharges = transI->GetCharges();
|
||||
//Does it sound like meat... maybe should check if it looks like meat too...
|
||||
if(strstr(transI->GetItem()->Name, "meat") ||
|
||||
strstr(transI->GetItem()->Name, "Meat") ||
|
||||
strstr(transI->GetItem()->Name, "flesh") ||
|
||||
strstr(transI->GetItem()->Name, "Flesh") ||
|
||||
strstr(transI->GetItem()->Name, "parts") ||
|
||||
strstr(transI->GetItem()->Name, "Parts")){
|
||||
CastToClient()->DeleteItemInInventory(EQ::invslot::slotCursor, fcharges, true);
|
||||
CastToClient()->SummonItem(13073, fcharges);
|
||||
}
|
||||
else{
|
||||
else{
|
||||
Message(Chat::Red, "You can only transmute flesh to bone.");
|
||||
}
|
||||
} else{
|
||||
Message(Chat::Red, "You can only transmute flesh to bone.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1373,7 +1373,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Customer,uint16 TraderSlot, int32 SerialNumber, int32 itemid) {
|
||||
void Client::NukeTraderItem(uint16 Slot,int16 Charges,int16 Quantity,Client* Customer,uint16 TraderSlot, int32 SerialNumber, int32 itemid) {
|
||||
|
||||
if(!Customer)
|
||||
return;
|
||||
@ -1451,7 +1451,7 @@ void Client::TraderUpdate(uint16 SlotID,uint32 TraderID){
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* Customer, uint16 TraderSlot){
|
||||
void Client::FindAndNukeTraderItem(int32 SerialNumber, int16 Quantity, Client* Customer, uint16 TraderSlot){
|
||||
|
||||
const EQ::ItemInstance* item= nullptr;
|
||||
bool Stackable = false;
|
||||
|
||||
@ -138,20 +138,20 @@ void Client::DoTributeUpdate() {
|
||||
uint32 tid = m_pp.tributes[r].tribute;
|
||||
if(tid == TRIBUTE_NONE) {
|
||||
if (m_inv[EQ::invslot::TRIBUTE_BEGIN + r])
|
||||
DeleteItemInInventory(EQ::invslot::TRIBUTE_BEGIN + r, 0, false);
|
||||
DeleteItemInInventory(EQ::invslot::TRIBUTE_BEGIN + r);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(tribute_list.count(tid) != 1) {
|
||||
if (m_inv[EQ::invslot::TRIBUTE_BEGIN + r])
|
||||
DeleteItemInInventory(EQ::invslot::TRIBUTE_BEGIN + r, 0, false);
|
||||
DeleteItemInInventory(EQ::invslot::TRIBUTE_BEGIN + r);
|
||||
continue;
|
||||
}
|
||||
|
||||
//sanity check
|
||||
if(m_pp.tributes[r].tier >= MAX_TRIBUTE_TIERS) {
|
||||
if (m_inv[EQ::invslot::TRIBUTE_BEGIN + r])
|
||||
DeleteItemInInventory(EQ::invslot::TRIBUTE_BEGIN + r, 0, false);
|
||||
DeleteItemInInventory(EQ::invslot::TRIBUTE_BEGIN + r);
|
||||
m_pp.tributes[r].tier = 0;
|
||||
continue;
|
||||
}
|
||||
@ -165,7 +165,7 @@ void Client::DoTributeUpdate() {
|
||||
if(inst == nullptr)
|
||||
continue;
|
||||
|
||||
PutItemInInventory(EQ::invslot::TRIBUTE_BEGIN + r, *inst, false);
|
||||
PutItemInInventory(EQ::invslot::TRIBUTE_BEGIN + r, *inst);
|
||||
SendItemPacket(EQ::invslot::TRIBUTE_BEGIN + r, inst, ItemPacketTributeItem);
|
||||
safe_delete(inst);
|
||||
}
|
||||
@ -173,7 +173,7 @@ void Client::DoTributeUpdate() {
|
||||
//unequip tribute items...
|
||||
for (r = 0; r < EQ::invtype::TRIBUTE_SIZE; r++) {
|
||||
if (m_inv[EQ::invslot::TRIBUTE_BEGIN + r])
|
||||
DeleteItemInInventory(EQ::invslot::TRIBUTE_BEGIN + r, 0, false);
|
||||
DeleteItemInInventory(EQ::invslot::TRIBUTE_BEGIN + r);
|
||||
}
|
||||
}
|
||||
CalcBonuses();
|
||||
@ -261,10 +261,10 @@ int32 Client::TributeItem(uint32 slot, uint32 quantity) {
|
||||
if(inst->IsStackable()) {
|
||||
if(inst->GetCharges() < (int32)quantity) //dont have enough....
|
||||
return(0);
|
||||
DeleteItemInInventory(slot, quantity, false);
|
||||
DeleteItemInInventory(slot, quantity);
|
||||
} else {
|
||||
quantity = 1;
|
||||
DeleteItemInInventory(slot, 0, false);
|
||||
DeleteItemInInventory(slot);
|
||||
}
|
||||
|
||||
pts *= quantity;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user