/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
bool SkipItem(const ItemTemplate* item_template, Player* player, int slot)
{
/* Calculate relative slot position */
if(m_vendors[0].GetItemCount() > 0)
{
if( (slot + 1) > (m_vendors[0].GetItemCount()))
{
int totalItemsChecked = 0;
/* For each vendor */
for(int i = 0; i < m_vendors.size(); i++)
{
if((totalItemsChecked + m_vendors.GetItemCount()) < (slot + 1))
{
totalItemsChecked += m_vendors.GetItemCount();
continue;
}
slot -= totalItemsChecked;
break;
}
}
}
/* Account for duplicate items across vendors */
if(VendorItem* vendor_item = m_vendorItemData.GetItem(slot))
{
if(vendor_item->item != item_template->ItemId)
return true;
}
else
return true; // the item doesn't even exist why would we send it
/* GM's are exceptions */
if(player->isGameMaster())
return false;
/* If the item is class specific and Bind on Pickup */
if (!(item_template->AllowableClass & player->getClassMask()) && item_template->Bonding == BIND_WHEN_PICKED_UP)
return true;
/* If the item is faction specific and player is wrong faction */
if ((item_template->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY && player->GetTeam() == ALLIANCE) ||
(item_template->Flags2 == ITEM_FLAGS_EXTRA_ALLIANCE_ONLY && player->GetTeam() == HORDE))
return true;
/* ONLY EDIT THINGS BELOW THIS COMMENT BLOCK
* DO NOT EDIT ANYTHING ELSE
*
* Example vendor:
Vendor vendor_1(700000, GOSSIP_ICON_VENDOR, "Look at all the weapons I have");
ItemList items_1(&vendor_1);
items_1.AddItem(18582); // Azzinoth
items_1.AddItem(13262); // Ashbringer
itemlists.push_back(items_1);
* The first line creates a "Vendor" object named vendor_1 with:
* GUID 700000 (this must be different to all your other vendors)
* Displays the moneybag icon in the gossip list
* Displays the text "Look at all the weapons I have" in the gossip list
*
* The second line creates an instance of the ItemList object named items1.
* We pass it a reference to the vendor we created before. The class does the rest.
*
* The third and fourth lines are examples of adding items to our item list (named items_1).
* You can give an item an extended_cost by passing a second parameter to the function.
* This script does not support time-limited or respawning items
*
* The final line is the most important. This line adds your vendor to the internal list of vendors that will be processed by the script.
*
*
* END OF EXPLANATION
* I REPEAT ONCE MORE PLEASE DO NOT TOUCH ANYTHING ELSE IN THE FILE IT IS EXTREMELY DELICATE AND EXTREMELY COMPLEX
*/
Vendor vendor_1(700000, GOSSIP_ICON_VENDOR, "Look at all the weapons I have");
ItemList items_1(&vendor_1);
items_1.AddItem(18582); // Azzinoth
items_1.AddItem(13262); // Ashbringer
itemlists.push_back(items_1);
Vendor vendor_2(700001, GOSSIP_ICON_VENDOR, "Look at all the armour I have");
ItemList items_2(&vendor_2);
items_2.AddItem(42949); // Polished Spaulders of Valor
items_2.AddItem(48685); // Polished Breastplate of Valor
itemlists.push_back(items_2);
/* DO NOT EDIT ANYTHING BELOW HERE EITHER
* THIS IS THE END OF THE EDITABLE SECTION
* ONLY EDIT THINGS ABOVE THIS COMMENT BLOCK UNLESS YOU _REALLY_ KNOW WHAT YOU'RE DOING
*
* Peace out
* Evilfairy~ */
/* DO NOT EDIT ANYTHING BELOW THIS LINE */
for(int i = 0; i < vendors.size(); i++) // icon message sender guid
player->ADD_GOSSIP_ITEM(vendors.GetVendor().getIcon(), vendors.GetVendor().getMessage(), GOSSIP_SENDER_MAIN, vendors.GetVendor().getGuid());