I'm no expert at C++, but if anyone has any helpful hints on how to do the following it's much appreciated.
Basically when you have a /custom/ bag that has /custom/ loot in it that can be opened, it will properly open. But when the bag is stackable to per say 20... right clicking the entire stack of 20 will consume the loot of only 1 actual bag loot.
Per say if we had a script for the bag that would only open 1 of the 20 bags therefore allowing you to spam right click the entire stack and get the loot for all 20 bags.
I know a few functions in c++ and I have tried editing templates of releases relevant to the itemscript but have come up with no luck
Once again, any help is appreciated.
This script is nearly half sufficent, yes I made this but I threw it together sloppy and not knowing which function to replace HasItemCount with to supply the OnUse of the item.
i'm starting to think I don't even need the if else statements, simply
I have no idea how to register the script to open this 'bag' containing loot
This is for a 3.3.5 TrinityCore
Basically when you have a /custom/ bag that has /custom/ loot in it that can be opened, it will properly open. But when the bag is stackable to per say 20... right clicking the entire stack of 20 will consume the loot of only 1 actual bag loot.
Per say if we had a script for the bag that would only open 1 of the 20 bags therefore allowing you to spam right click the entire stack and get the loot for all 20 bags.
I know a few functions in c++ and I have tried editing templates of releases relevant to the itemscript but have come up with no luck
Once again, any help is appreciated.
This script is nearly half sufficent, yes I made this but I threw it together sloppy and not knowing which function to replace HasItemCount with to supply the OnUse of the item.
Code:
#include "ScriptPCH.h"
#define bag_id 6000
#define loot1_id 100000
#define loot2_id 100001
#define loot3_id 100002
class bag_script : public ItemScript
{
public:
bag_script() : ItemScript("bag_script") { }
bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
{
if (player->HasItemCount(bag_id, 1, false));
{
player->AddItem(loot1_id, 10);
player->AddItem(loot2_id, 10);
player->AddItem(loot2_id, 10);
return true;
}
else
{
player->GetSession->SendNotification("You should not see this");
return false;
}
}
};
void AddSC_bag_script()
{
new bag_script();
}
i'm starting to think I don't even need the if else statements, simply
Code:
bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
player->AddItem(loot1_id, 10);
player->AddItem(loot2_id, 10);
player->AddItem(loot2_id, 10);
return true;
I have no idea how to register the script to open this 'bag' containing loot
This is for a 3.3.5 TrinityCore