Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *╔═╦═╦═╦╦╦══╦═╦╗─╔╦══╗
- *║╦╣║║║║║╠╗╗║╦╣╚╦╝║══╣
- *║╩╣║║║║║╠╩╝║╩╬╗║╔╬══║
- *╚═╩╩═╩╩═╩══╩═╝╚═╝╚══╝
- * http://emudevs.com
- */
- class npc_tutorial_gossip : public CreatureScript
- {
- private:
- npc_tutorial_gossip() : CreatureScript("npc_tutorial_gossip") { }
- bool OnGossipHello(Player* player, Creature* creature)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Do Action", GOSSIP_SENDER_MAIN, 1);
- player->SEND_GOSSIP_MENU(1, creature->GetGUID());
- return true;
- }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /* sender */, uint32 actions)
- {
- player->PlayerTalkClass->ClearMenus();
- if (actions == 1)
- {
- /* LOAD POINTS PREPARED STATEMENT */
- //PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_LOAD_POINTS);
- //PreparedQueryResult result = LoginDatabase.Query(stmt);
- //if (!result)
- //{
- // TC_LOG_ERROR(LOG_FILTER_GENERAL, "Loaded 0 points");
- // return;
- //}
- //do
- //{
- // Field* fields = result->Fetch();
- // TC_LOG_ERROR(LOG_FILTER_GENERAL, "ID: %d, Points: %d", fields[0].GetUInt32(), fields[1].GetUInt32());
- //}while(result->NextRow());
- //TC_LOG_ERROR(LOG_FILTER_GENERAL, "Loading points completed!");
- /* SAVE POINTS */
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_POINTS);
- PreparedStatement* _stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_POINTS);
- stmt->setUInt32(0, player->GetSession()->GetAccountId());
- PreparedQueryResult result = LoginDatabase.Query(stmt);
- uint32 votePoints;
- if (result)
- {
- do
- {
- Field* fields = result->Fetch();
- votePoints = fields[0].GetUInt32();
- votePoints -= 35;
- }while(result->NextRow());
- }
- _stmt->setUInt32(0, votePoints);
- _stmt->setUInt32(1, player->GetSession()->GetAccountId());
- LoginDatabase.Execute(_stmt);
- }
- return true;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement