Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (C) 2008-2011 TrinityCore <http: //www.trinitycore.org/>
- * Copyright information <http: //en.wikipedia.org/wiki/Copyright>
- *
- * This code was written solely for Arena Gods and is not meant for any kind of
- * pubic or other opensource projects. If you think you can use this code without
- * permission of either Discovered or AJ, we will take some serious action to
- * pay you back. We have the law in our right.
- *
- * All credits on this code/script are going to Jasper "Discovered" Rietrae.
- */
- #include "ScriptPCH.h"
- /* Gossip Colors */
- #define TEXT_CUSTOM_LEGENDARY "|cffff8000"
- class npc_donations : public CreatureScript
- {
- public:
- npc_donations() : CreatureScript("npc_donations") { }
- uint32 GetDonationPoints(Player* player) // this is a custom function
- {
- QueryResult result = LoginDatabase.PQuery("SELECT recruiter FROM account WHERE id = %u", player->GetSession()->GetAccountId());
- if(!result)
- return 0; // query failed. No account exists or SQL invalid. %u
- return result->Fetch()[0].GetUInt32(); // [0] means the first column in the select statement. Since donationpoints is the first column, we are getting an uint32 value from donationpoints column.
- }
- bool OnGossipHello(Player *player, Creature *creature)
- {
- player->ADD_GOSSIP_ITEM(9, TEXT_CUSTOM_LEGENDARY "GIEF SHADOWMOURNEZ!", GOSSIP_SENDER_MAIN, 9006);
- player->ADD_GOSSIP_ITEM(9, TEXT_CUSTOM_LEGENDARY "the hammer thing", GOSSIP_SENDER_MAIN, 9007);
- player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
- return true;
- }
- bool OnGossipSelect(Player *player, Creature *creature, uint32 sender, uint32 uiAction)
- {
- player->PlayerTalkClass->ClearMenus();
- uint32 points = GetDonationPoints(player);
- switch(uiAction)
- {
- case 9006: // Send that shit
- if (points == 1337) // use == instead of =
- {
- player->AddItem(49623,1);
- }
- break;
- case 9007: // other thing
- player->AddItem(46017,1);
- break;
- default:
- break;
- }
- // player->CLOSE_GOSSIP_MENU(); // Close on action select
- OnGossipHello(player, creature); // return to main menu
- return true;
- }
- };
- void AddSC_npc_donations()
- {
- new npc_donations();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement