Jump to content
World of Warcraft
  • Announcements

    • TheRock

      User support   07/09/17

      If you do not wish to register on the forum, you can always write on support@wowlegions.ru
    • TheRock

      Minimum server requirements   07/27/17

      System Requirements Apache 2.4.12 or higher PHP Version 7.0.21 or higher MySQL 5.6 or higher Modules for PHP   curl PDO drivers ionCube PHP Loader Should be included - RewriteEngine
      View phpinfo on a demo website  
Sign in to follow this  
Bully

C ++ for the Pandaren faction selection. for Legion 7.2.5

Recommended Posts

Here is my C ++ for the Pandaren faction selection.
It is installed in 

/src/server/scripts/World/npcs_special.cpp

 

 


#define GOSSIP_TEXT_EXP           14736
#define GOSSIP_CHOOSE_FACTION     "I would like to join the horde"
#define GOSSIP_CHOOSE_FACTION2     "I would like to join the alliance"

class npc_Spirit_of_Master_Shang_Xi : public CreatureScript
{
public:
   npc_Spirit_of_Master_Shang_Xi() : CreatureScript("npc_Spirit_of_Master_Shang_Xi") { }

   bool OnGossipHello(Player* player, Creature* creature)
   {
      if (creature->IsQuestGiver())
         player->PrepareQuestMenu(creature->GetGUID());

      if (player->getRace() == RACE_PANDAREN_NEUTRAL)
         
         {
         if (player->GetQuestStatus(31450) == QUEST_STATUS_INCOMPLETE)
         { 
            AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_CHOOSE_FACTION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
           AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_CHOOSE_FACTION2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
         }
      }
                
      player->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXT_EXP, creature->GetGUID());
      return true;
   }

   bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action)
   {
      if (action == GOSSIP_ACTION_INFO_DEF + 1)
      {
         player->SetByteValue(UNIT_FIELD_BYTES_0, 0, RACE_PANDAREN_HORDE);
         player->setFactionForRace(RACE_PANDAREN_HORDE);
         player->SaveToDB();
         WorldLocation location(1, 1357.62f, -4373.55f, 26.13f, 0.13f);
         player->TeleportTo(location);
         player->SetHomebind(location, 363);
         player->LearnSpell(668, false); // Language Common
         player->LearnSpell(108127, false); // Language Pandaren
         player->KilledMonsterCredit(64594);
      }

      if (action == GOSSIP_ACTION_INFO_DEF + 2)
      {
         player->SetByteValue(UNIT_FIELD_BYTES_0, 0, RACE_PANDAREN_ALLIANCE);
         player->setFactionForRace(RACE_PANDAREN_ALLIANCE);
         player->SaveToDB();
         WorldLocation location(0, -8960.02f, 516.10f, 96.36f, 0.67f);
         player->TeleportTo(location);
         player->SetHomebind(location, 9);
         player->LearnSpell(668, false); // Language Common
         player->LearnSpell(108127, false); // Language Pandaren
         player->KilledMonsterCredit(64594);
      }

      player->PlayerTalkClass->SendCloseGossip();
      return true;
   }
};

void AddSC_npcs_special()
{
    new npc_Spirit_of_Master_Shang_Xi();
}

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.