Changed SummonItem to no longer recharge 0 charge items

This commit is contained in:
Sorvani 2013-09-30 20:57:12 -05:00
parent d119ed058b
commit 478f7b8e49
5 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,8 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 09/30/2013 ==
Sorvani: Changed SummonItem to only summon an item with max charges when said default value is present and not on zero charges
== 09/13/2013 ==
demonstar55: Add support for /pet hold on and /pet hold off (UF and RoF)

View File

@ -785,7 +785,7 @@ public:
void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false);
void PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0);
bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0);
void SummonItem(uint32 item_id, int16 charges = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0, bool attuned=false, uint16 to_slot=SLOT_CURSOR);
void SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0, bool attuned=false, uint16 to_slot=SLOT_CURSOR);
void SetStats(uint8 type,int16 set_val);
void IncStats(uint8 type,int16 increase_val);
void DropItem(int16 slot_id);

View File

@ -208,11 +208,13 @@ void Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
return;
} else {
// if 0 and max charges 0 and stackable, set the created item charge to 1
if (charges == 0 && item->MaxCharges == 0 && item->Stackable)
if (charges == 0 && item->MaxCharges == 0 && item->Stackable) {
charges = 1;
// if 0 or no charge value was passed, set the created item charge to max charges
else if(charges == 0)
// if the charges is -1, then no charge value was passed in set to max charges
} else if(charges == -1) {
charges = item->MaxCharges;
// in any other situatino just use charges as passed
}
}
// Checking to see if the Item is lore or not.
bool foundlore = CheckLoreConflict(item);

View File

@ -3049,7 +3049,7 @@ XS(XS_Client_SummonItem)
{
Client * THIS;
uint32 item_id = (uint32)SvUV(ST(1));
int16 charges = 0;
int16 charges = -1;
bool attune = false;
uint32 aug1 = 0;
uint32 aug2 = 0;

View File

@ -52,7 +52,7 @@ public:
void say(const char *str);
void say(const char *str, uint8 language);
void me(const char *str);
void summonitem(uint32 itemid, int16 charges = 0);
void summonitem(uint32 itemid, int16 charges = -1);
void write(const char *file, const char *str);
Mob* spawn2(int npc_type, int grid, int unused, float x, float y, float z, float heading);
Mob* unique_spawn(int npc_type, int grid, int unused, float x, float y, float z, float heading = 0);