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;
|
||||
}
|
||||
|
||||
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* plTarget = getSelectedPlayer();
|
||||
if (!plTarget)
|
||||
@ -1108,13 +1125,23 @@ bool ChatHandler::HandleAddItemCommand(char* args)
|
||||
|
||||
Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
|
||||
|
||||
// remove binding (let GM give it to another player later)
|
||||
if (pl == plTarget)
|
||||
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
|
||||
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))
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
2
src/tools/.gitignore
vendored
2
src/tools/.gitignore
vendored
@ -17,6 +17,6 @@ release
|
||||
*.ilk
|
||||
ad_debug.exe
|
||||
|
||||
MangosStrings_LanguageHGenerator/php-cli/includes/config.inc.php
|
||||
MangosStrings_LanguageHGenerator/php-cli/includes/config.inc.php
|
||||
MangosStrings_LanguageHGenerator/out/
|
||||
MangosStrings_LanguageHGenerator/.vs
|
@ -30,7 +30,7 @@ EXCLUDE_MAPS_FILE="mmap_excluded.txt"
|
||||
|
||||
## Does an exclude file exist ?
|
||||
if [ "$EXCLUDE_MAPS" == "" ]
|
||||
then
|
||||
then
|
||||
## Exclude file provided?
|
||||
if [ -f "$EXCLUDE_MAPS_FILE" ]
|
||||
then ## Yes, read the file
|
||||
|
Loading…
x
Reference in New Issue
Block a user