/*
AYE
<http://emudevs.com>
By Tommy
*/
struct HonorGossip
{
uint32 menu_id;
uint8 icon;
std::string name;
uint32 HK, titleID;
};
// {icon, "title name", honored_kills, titleID}
HonorGossip Titles [] =
{
{1, 9, "Private", 1, 1 },
{2, 9, "Corporal", 100, 2 },
{3, 9, "Sergeant", 250, 3 },
{4, 9, "Master Sergeant", 500, 4 },
{5, 9, "Sergeant Major", 750, 5 },
{6, 9, "Knight", 1000, 6 },
{7, 9, "Knight-Lieutenant", 1500, 7 },
{8, 9, "Knight-Captain", 2000, 8 },
{9, 9, "Knight-Champion", 2500, 9 },
{10, 9, "Lieutenant Commander", 3000, 10 },
{11, 9, "Commander", 3500, 11 },
{12, 9, "Marshal", 4000, 12 },
{13, 9, "Field Marshal", 4500, 13 },
{14, 9, "Grand Marshal", 5000, 14 },
{15, 9, "Scout", 1, 15 },
{16, 9, "Grunt", 100, 16 },
{17, 9, "Sergeant", 250, 17 },
{18, 9, "Senior Sergeant", 500, 18 },
{19, 9, "First Sergeant", 750, 19 },
{20, 9, "Stone Guard", 1000, 20 },
{21, 9, "Blood Guard", 1500, 21 },
{22, 9, "Legionnaire", 2000, 22 },
{23, 9, "Centurion", 2500, 23 },
{24, 9, "Champion", 3000, 24 },
{25, 9, "Lieutenant General", 3500, 25 },
{26, 9, "General", 4000, 26 },
{27, 9, "Warlord", 4500, 27 },
{28, 9, "High Warlord", 5000, 28 },
};
class npc_honor_gossip : public CreatureScript
{
public:
npc_honor_gossip() : CreatureScript("npc_honor_gossip") { }
bool OnGossipHello(Player* player, Creature* creature)
{
if (player->GetTeam() == ALLIANCE)
for (int i = 0; i < 14; i++)
player->ADD_GOSSIP_ITEM(Titles[i].icon, Titles[i].name.c_str(), GOSSIP_SENDER_MAIN, Titles[i].menu_id);
else
for (int i = 14; i < 28; i++)
player->ADD_GOSSIP_ITEM(Titles[i].icon, Titles[i].name.c_str(), GOSSIP_SENDER_MAIN, Titles[i].menu_id);
player->SEND_GOSSIP_MENU(1, creature->GetGUID());
return true;
}
bool OnGossipSelect(Player* player, Creature* creature, uint32 /* sender */, uint32 actions)
{
player->PlayerTalkClass->ClearMenus();
for (int i = 0; i < sizeof(Titles) / sizeof(uint32); i++)
if (actions == Titles[i].menu_id)
if (!player->HasTitle(Titles[i].titleID) && player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) >= Titles[i].HK)
if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(Titles[i].titleID))
player->SetTitle(titleEntry);
player->CLOSE_GOSSIP_MENU();
return true;
}
};
void AddSC_honor_gossip()
{
new npc_honor_gossip;
}