Skip to content

Instantly share code, notes, and snippets.

@SymbolixDEV
Created February 4, 2014 17:06
Show Gist options
  • Save SymbolixDEV/8807953 to your computer and use it in GitHub Desktop.
Save SymbolixDEV/8807953 to your computer and use it in GitHub Desktop.
Test NPC
//test NPC by SymbolixDEV
#include "ScriptPCH.h"
uint32 buffIdstools[] = { 43223, 5862, 33377, 33779, 31305, 70692, 42995 };
class npc_test : public CreatureScript
{
public:
npc_test() : CreatureScript("npc_test") { }
bool OnGossipHello(Player * player, Creature * creature)
{
if (player->IsInCombat())
{
ChatHandler(player)SendSynMessage("You are in Combat");
player->GetSession()->SendAreaTriggerMessage("You are in Combat")
return false;
}
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Buff me", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Reset my Talents", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Remove my Sickness", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Reset my CD's", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Repair Items", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Clear Combat", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+8);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Reset Instances", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Close", GOSSIP_SENDER_MAIN, GOSSI_ACTION_INFO_DEF+10);
player->PlayerTalkClass->SenderGossipMenu(1, creature->GetGuid());
return true;
}
bool OnGossipSelect(Player* player, Creature * creature, uint32 sender, uint32 actions)
{
player->PlayerTalkClass->ClearMenus();
if (sender != GOSSIP_SENDER_MAIN)
return false:
switch (actions)
{
case GOSSIP_ACTION_INFO_DEF+1:
player->TeleportTo(0, 0, 0, 0, 0);
player->GetSession()->SendAreaTriggerMessage("You Selected this action!");
player->GetSession()->SendCloseGossip();
break;
case GOSSIP_ACTION_INFO_DEF+2:
player->TeleportTo(0, 0, 0, 0, 0);
player->GetSession()->SendAreaTriggerMessage("You Selected this action!");
player->GetSession()->SendCloseGossip();
break;
case GOSSIP_ACTION_INFO_DEF+3:
for (int i = 0; i < sizeof(buffIdstools) / sizeof(*buffIdstools); i++)
player->CastSpell(player, buffIdstools[i]);
player->CLOSE_GOSSIP_MENU();
break;
case GOSSIP_ACTION_INFO_DEF+4: // Reset Talents
player->resetTalents(true);
player->SendTalentsInfoData(false);
creature->MonsterWhisper("Your talents has been reset.", player->GetGUID(), true);
break;
case GOSSIP_ACTION_INFO_DEF+5: //Remove my siccness
if (player->HasAura(15007))
player->RemoveAura(15007);
break;
case GOSSIP_ACTION_INFO_DEF+6; // reset my CD'S
player->SetHealth(player->GetMaxHealth());
player->SetMana(player->GetMaxMana());
player->RemoveAllSpellCooldown();
break;
case GOSSIP_ACTION_INFO_DEF+7; // repair my items
player->DurabilityRepairAll(false, 0, false);
break;
case GOSSIP_ACTION_INFO_DEF+8; // Clear Combat
player->CombatStop();
break;
case GOSSIP_ACTION_INFO_DEF+9 // Reset all Instances For PvE
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
{
player->UnbindInstance(itr, Difficulty(i));
}
}
break;
case GOSSIP_ACTION_INFO_DEF+10: // Close
player->GetSession()->SendCloseGossip();
break;
}
}
};
void AddSC_npc_test()
{
new npc_test;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment