hello, i made a topic some days ago to get help to make a list of items for a custom gossip, to complete a custom quest but now i see i need to Set NonRefundable to the items from the list, for example players need 10 items from a list of items to complete a custom quest, but now after players complete the quest. these players can sell (refund) these items again because players has 30 min to refund the items, i want to when players complete the quest then set Non Refundable these items, yes i know i can disable the 30 min refund from items but there is a season items and for me is a better idea to set the NonRefundable
i find something like this in transmogrifier
itemTransmogrifier->SetNotRefundable(player);
maybe i need something like this. if anyone know how i can do it I would be very grateful this is also my script
i find something like this in transmogrifier
itemTransmogrifier->SetNotRefundable(player);
maybe i need something like this. if anyone know how i can do it I would be very grateful this is also my script
Code:
// has to have one item from the list on each row
std::vector<std::vector<uint32>> itemLists =
{
{ 68530, 68531, 68532, 68533, 68534, 68535 }, // head
{ 68540, 68541, 68542, 68543, 68544, 68545 }, // shoulder
{ 68550, 68551, 68552, 68553, 68554, 68555 }, // Chest
{ 68560, 68561, 68562, 68563, 68564, 68565 }, // Gauntlets
{ 68570, 68571, 68572, 68573, 68574, 68575 }, // Leg
};
// returns true if the player has at least one item from the list
bool hasItemFrom(Player* player, std::vector<uint32>& list)
{
for (uint32 entry : list)
if (player->HasItemCount(entry, 1))
return true;
return false;
}
// returns true if the player has at least one item from each list
bool hasItems(Player* player, std::vector<std::vector<uint32>>& list)
{
for (std::vector<uint32>& list : itemLists)
if (!hasItemFrom(player, list))
return false;
return true;
}
class npc_quest_s10 : public CreatureScript
{
public:
npc_quest_s10() : CreatureScript("npc_quest_s10") { }
bool OnGossipHello(Player* player, Creature* creature)
{
AddGossipItemFor(player, 0, "Check if I have enough season 9 items to complete the quest.", GOSSIP_SENDER_MAIN, 1);
player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
return true;
}
bool OnGossipSelect(Player *player, Creature *creature, uint32 sender, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
switch (action)
{
// the case on gossip select, checks the player has the quest and items and then completes quest
case 1:
if (!player->IsActiveQuest(108000))
{
CloseGossipMenuFor(player);
ChatHandler(player->GetSession()).PSendSysMessage("You need Arena Season 9 Quest..", player->GetGUID());
break;
}
if (hasItems(player, itemLists))
{
player->CompleteQuest(108000);
CloseGossipMenuFor(player);
ChatHandler(player->GetSession()).PSendSysMessage("Congratulations, Arena Season Completed!", player->GetGUID());
}
else
{
CloseGossipMenuFor(player);
ChatHandler(player->GetSession()).PSendSysMessage("You don't have the required 5 pieces of season 8.", player->GetGUID());
}
}