Add enchant_id option to additem command (#145)
* Add enchant_id option to additem command * Fix blank spaces pt1 * Fix blank spaces pt2 * Fix blank spaces pt3
This commit is contained in:
parent
5bcda35d50
commit
67a49e0ffc
@ -1063,6 +1063,23 @@ bool ChatHandler::HandleAddItemCommand(char* args)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 enchant_id = 0;
|
||||||
|
if (!ExtractOptUInt32(&args, enchant_id, 0))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check enchant id
|
||||||
|
if (enchant_id > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||||
|
if (!pEnchant)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Player* pl = m_session->GetPlayer();
|
Player* pl = m_session->GetPlayer();
|
||||||
Player* plTarget = getSelectedPlayer();
|
Player* plTarget = getSelectedPlayer();
|
||||||
if (!plTarget)
|
if (!plTarget)
|
||||||
@ -1108,13 +1125,23 @@ bool ChatHandler::HandleAddItemCommand(char* args)
|
|||||||
|
|
||||||
Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
|
Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
|
||||||
|
|
||||||
// remove binding (let GM give it to another player later)
|
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
|
||||||
if (pl == plTarget)
|
{
|
||||||
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
|
if (pl == plTarget)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Remove binding (let GM give it to another player later)
|
||||||
if (Item* item1 = pl->GetItemByPos(itr->pos))
|
if (Item* item1 = pl->GetItemByPos(itr->pos))
|
||||||
{
|
{
|
||||||
item1->SetBinding(false);
|
item1->SetBinding(false);
|
||||||
|
// Perhaps we can enchant the item
|
||||||
|
if (enchant_id)
|
||||||
|
{
|
||||||
|
item1->SetEnchantment(PERM_ENCHANTMENT_SLOT, enchant_id, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (count > 0 && item)
|
if (count > 0 && item)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user