Skip to content

Instantly share code, notes, and snippets.

@JadaDev
Created October 14, 2014 00:28
Show Gist options
  • Save JadaDev/e074941558109b14aa15 to your computer and use it in GitHub Desktop.
Save JadaDev/e074941558109b14aa15 to your computer and use it in GitHub Desktop.
Honorable Kills Shop updated by JadaDev
class honorable_kills_shop : public CreatureScript
{
public:
honorable_kills_shop() : CreatureScript("hk_kills_shop") { }
bool OnGossipHello(Player* player, Creature* creature)
{
player->ADD_GOSSIP_ITEM(4, "[5,000 Lifetime Kills are required in order to view my goods. Make sure you have it, or you won't be able to view nor purchase anything.]", GOSSIP_SENDER_MAIN, 1001); //first menu option - a note for what this creature is
player->ADD_GOSSIP_ITEM(4, "[5k kills] Show me what you got!", GOSSIP_SENDER_MAIN, 1002); //second option, click to send to the vendor (if he has 5k kills)
player->SEND_GOSSIP_MENU(1, creature->GetGUID()); // This sends the menu to the player
return true;
}
bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*uiSender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
switch (action)
{
///////////START ACTIONS//////////////////
case 1001:
player->CLOSE_GOSSIP_MENU();
break;
case 1002:
if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) >= 5000)
{
player->GetSession()->SendListInventory(pCreature->GetGUID()), //send to the vendor himself. add items via .npc add item command
pCreature->Whisper("You have 5,000 kills or more, therefore you can view my goods.", LANG_UNIVERSAL, player); //if the player has 5k kills, send this message when
}
else
{
pCreature->Whisper("You do not have 5,000 kills or more, therefore I cannot allow you to check my store. Sorry.", LANG_UNIVERSAL, player), player->CLOSE_GOSSIP_MENU(); //send this "error" message and close everything
}
break;
}
return true;
}
};
void AddSC_Honorable_Kills_Shop()
{
new honorable_kills_shop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment