Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define ITEM_TELEPORT 123456
- #include "ScriptPCH.h"
- class npc_gp : public CreatureScript
- {
- public:
- npc_gp() : CreatureScript("npc_gp") { }
- bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
- {
- uint32 Enchants[19] = {
- 45056,
- 43987,
- 38991,
- 38972,
- 38986,
- 38990,
- 44458,
- 38978,
- 38995,
- 38992,
- 50368,
- 50370,
- 50369,
- 50367,
- 41602,
- 44963,
- 38373,
- 44957,
- 38374
- };
- uint32 Items[9] = {
- 35623,
- 35624,
- 36860,
- 35625,
- 35627,
- 35622,
- 36912,
- 36910
- };
- switch (uiAction)
- {
- uint32 pont;
- pont = CharacterDatabase.PQuery("SELECT `pont` FROM `guild` WHERE `guildid`='%d';"), pPlayer->GetGuildId();
- case GOSSIP_ACTION_INFO_DEF+1:
- if (pont >= 1 && pPlayer->isGuildMaster()) // Only the GM can buy
- {
- pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "100 GP -> 1000 gold.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
- pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Get random level 80 material(Eternals, Bars etc. // 50GP).", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
- pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Get a teleport credit(20GP(Tradeable)).", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
- pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Get a random enchant(30GP).", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6);
- } else pCreature->MonsterWhisper("You might not a guild master or your Guild don't have got enought points", pPlayer->GetGUID(), false);
- break;
- case GOSSIP_ACTION_INFO_DEF+2:
- if (pont >= 100)
- {
- CharacterDatabase.PQuery("UPDATE `guild` SET `pont`='%d-100' WHERE `guildid`=%s", pont, pPlayer->GetGuildId());
- pCreature->MonsterWhisper("You've succesfully buyed 1000 gold!", pPlayer->GetGUID(), false);
- }
- else pCreature->MonsterWhisper("Your guild don't have enough GP", pPlayer->GetGUID(), false);
- break;
- case GOSSIP_ACTION_INFO_DEF+3:
- if (pont >= 50)
- {
- uint32 randomitem = Items[urand(0, 10)];
- uint32 randomcount = urand(1, 20);
- pPlayer->AddItem(randomitem, randomcount);
- CharacterDatabase.PQuery("UPDATE `guild` SET `pont`='%d-50' WHERE `guildid`=%s", pont, pPlayer->GetGuildId());
- } else pCreature->MonsterWhisper("Your guild don't have enough GP.", pPlayer->GetGUID(), false);
- break;
- case GOSSIP_ACTION_INFO_DEF+5:
- if (pont >= 20)
- {
- pPlayer->AddItem(ITEM_TELEPORT, 1);
- pCreature->MonsterWhisper("You got 1 x Teleport Coin.", pPlayer->GetGUID(), false);
- CharacterDatabase.PQuery("UPDATE `guild` SET `pont`='%d-20' WHERE `guildid`=%s", pont, pPlayer->GetGuildId());
- } else pCreature->MonsterWhisper("Your guild don't have enough GP.", pPlayer->GetGUID(), false);
- break;
- case GOSSIP_ACTION_INFO_DEF+6:
- if (pont >= 30)
- {
- uint32 randomenchant = Enchants[urand(0, 19)];
- pPlayer->AddItem(randomenchant, 1);
- pCreature->MonsterWhisper("You got 1 x Enchant.", pPlayer->GetGUID(), false);
- CharacterDatabase.PQuery("UPDATE `guild` SET `pont`='%d-30' WHERE `guildid`=%s", pont, pPlayer->GetGuildId());
- } else pCreature->MonsterWhisper("Your guild don't have enough GP.", pPlayer->GetGUID(), false);
- break;
- }
- return true;
- }
- bool OnGossipHello(Player* pPlayer, Creature* pCreature)
- {
- pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "What can I do with my GPs?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
- return true;
- }
- };
- void AddSC_npc_gp()
- {
- new npc_gp();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement