Ejemplo n.º 1
0
		void OnCreatureCreate(Creature *pCreature, bool /*bAdd*/) {
			Map::PlayerList const &players = instance->GetPlayers();
			uint32 TeamInInstance = 0;

			if (!players.isEmpty()) {
				if (Player* pPlayer = players.begin()->getSource())
					TeamInInstance = pPlayer->GetTeam();
			}
			switch (pCreature->GetEntry()) {
			case 26763:
				Anomalus = pCreature->GetGUID();
				break;
			case 26723:
				Keristrasza = pCreature->GetGUID();
				break;
				// Alliance npcs are spawned by default, if you are alliance, you will fight against horde npcs.
			case 26800: {
				if (ServerAllowsTwoSideGroups())
					pCreature->setFaction(FACTION_HOSTILE_FOR_ALL);
				if (TeamInInstance == ALLIANCE)
					pCreature->UpdateEntry(26799, HORDE);
				break;
			}
			case 26802: {
				if (ServerAllowsTwoSideGroups())
					pCreature->setFaction(FACTION_HOSTILE_FOR_ALL);
				if (TeamInInstance == ALLIANCE)
					pCreature->UpdateEntry(26801, HORDE);
				break;
			}
			case 26805: {
				if (ServerAllowsTwoSideGroups())
					pCreature->setFaction(FACTION_HOSTILE_FOR_ALL);
				if (TeamInInstance == ALLIANCE)
					pCreature->UpdateEntry(26803, HORDE);
				break;
			}
			case 27949: {
				if (ServerAllowsTwoSideGroups())
					pCreature->setFaction(FACTION_HOSTILE_FOR_ALL);
				if (TeamInInstance == ALLIANCE)
					pCreature->UpdateEntry(27947, HORDE);
				break;
			}
			case 26796: {
				if (ServerAllowsTwoSideGroups())
					pCreature->setFaction(FACTION_HOSTILE_FOR_ALL);
				if (TeamInInstance == ALLIANCE)
					pCreature->UpdateEntry(26798, HORDE);
				break;
			}
			}
		}
Ejemplo n.º 2
0
 void OnCreatureCreate(Creature* creature) override
 {
     switch (creature->GetEntry())
     {
         case NPC_ANOMALUS:
             AnomalusGUID = creature->GetGUID();
             break;
         case NPC_KERISTRASZA:
             KeristraszaGUID = creature->GetGUID();
             break;
         // Alliance npcs are spawned by default, if you are alliance, you will fight against horde npcs.
         case NPC_ALLIANCE_BERSERKER:
             if (ServerAllowsTwoSideGroups())
                 creature->setFaction(FACTION_HOSTILE_FOR_ALL);
             if (_teamInInstance == ALLIANCE)
                 creature->UpdateEntry(NPC_HORDE_BERSERKER);
             break;
         case NPC_ALLIANCE_RANGER:
             if (ServerAllowsTwoSideGroups())
                 creature->setFaction(FACTION_HOSTILE_FOR_ALL);
             if (_teamInInstance == ALLIANCE)
                 creature->UpdateEntry(NPC_HORDE_RANGER);
             break;
         case NPC_ALLIANCE_CLERIC:
             if (ServerAllowsTwoSideGroups())
                 creature->setFaction(FACTION_HOSTILE_FOR_ALL);
             if (_teamInInstance == ALLIANCE)
                 creature->UpdateEntry(NPC_HORDE_CLERIC);
             break;
         case NPC_ALLIANCE_COMMANDER:
             if (ServerAllowsTwoSideGroups())
                 creature->setFaction(FACTION_HOSTILE_FOR_ALL);
             if (_teamInInstance == ALLIANCE)
                 creature->UpdateEntry(NPC_HORDE_COMMANDER);
             break;
         case NPC_COMMANDER_STOUTBEARD:
             if (ServerAllowsTwoSideGroups())
                 creature->setFaction(FACTION_HOSTILE_FOR_ALL);
             if (_teamInInstance == ALLIANCE)
                 creature->UpdateEntry(NPC_COMMANDER_KOLURG);
             break;
         default:
             break;
     }
 }
uint32 InstanceScript::GetMajorityTeam()
{
    uint32 hordePlayers = 0, alliancePlayers = 0;
    if (instance)
    {
        const Map::PlayerList& players = instance->GetPlayers();
        if (!players.isEmpty())
        {
            Player* arbitraryPlayer = players.getFirst()->GetSource();  // Just get the first one - it doesn't matter, we may take anyone. 
            if (!arbitraryPlayer)
                return 0;   // Cannot make a decision if there's no player

            Group* group = arbitraryPlayer->GetGroup();                 // Decisions are based on the players group, despite they are in the instance or not.
            if (!group)
                return arbitraryPlayer->GetTeam();   // Only one player -> get his team

            for (GroupReference* it = group->GetFirstMember(); it != 0; it = it->next())
            {
                if (Player* member = it->GetSource())
                {
                    if (!member->IsGameMaster())
                    {
                        // If it's not an alliance member, it's a horde member... should be logical :)
                        if (member->GetTeam() == ALLIANCE)
                            alliancePlayers++;
                        else
                            hordePlayers++;
                        if (!ServerAllowsTwoSideGroups())
                            break;
                    }
                }
            }
        }
    }

    // Note: We have to return 0 if we cannot make a decision, i.e. when there's no player in the instance (yet).
    if (hordePlayers == 0 && alliancePlayers == 0)
    {
        return 0;
    }
    else
    {
        /*
            Decision rules:
            #Horde > #Alliance: HORDE
            #Horde == #Alliance: Random(HORDE, ALLIANCE)
            else: ALLIANCE
        */
        if (hordePlayers > alliancePlayers) 
            return HORDE;
        else if (hordePlayers < alliancePlayers)
            return ALLIANCE;
        else
            return (urand(0,1) ? ALLIANCE : HORDE);
    }
}
 void OnCreatureCreate(Creature* creature) override
 {
     switch (creature->GetEntry())
     {
         case NPC_ANOMALUS:
             AnomalusGUID = creature->GetGUID();
             break;
         case NPC_KERISTRASZA:
             KeristraszaGUID = creature->GetGUID();
             break;
         case NPC_ALLIANCE_BERSERKER:
         case NPC_ALLIANCE_RANGER:
         case NPC_ALLIANCE_CLERIC:
         case NPC_ALLIANCE_COMMANDER:
         case NPC_COMMANDER_STOUTBEARD:
             if (ServerAllowsTwoSideGroups())
                 creature->SetFaction(FACTION_MONSTER_2);
             break;
         default:
             break;
     }
 }
Ejemplo n.º 5
0
        void OnCreatureCreate(Creature* creature)
        {
            Map::PlayerList const &players = instance->GetPlayers();

            if (!players.isEmpty())
            {
                if (Player* player = players.begin()->getSource())
                    teamInInstance = player->GetTeam();
            }

            switch (creature->GetEntry())
            {
                // Grand Champions
                case NPC_MOKRA:
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (teamInInstance == HORDE)
                        creature->UpdateEntry(NPC_JACOB, ALLIANCE);
                    break;
                case NPC_ERESSEA:
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (teamInInstance == HORDE)
                        creature->UpdateEntry(NPC_AMBROSE, ALLIANCE);
                    break;
                case NPC_RUNOK:
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (teamInInstance == HORDE)
                        creature->UpdateEntry(NPC_COLOSOS, ALLIANCE);
                    break;
                case NPC_ZULTORE:
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (teamInInstance == HORDE)
                        creature->UpdateEntry(NPC_JAELYNE, ALLIANCE);
                    break;
                case NPC_VISCERI:
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (teamInInstance == HORDE)
                        creature->UpdateEntry(NPC_LANA, ALLIANCE);
                    break;
                // Faction Champios
                case NPC_ORGRIMMAR_CHAMPION:
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (teamInInstance == HORDE)
                        creature->UpdateEntry(NPC_STORMWIND_CHAMPION, ALLIANCE);
                    break;
                case NPC_SILVERMOON_CHAMPION:
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (teamInInstance == HORDE)
                        creature->UpdateEntry(NPC_GNOMEREGAN_CHAMPION, ALLIANCE);
                    break;
                case NPC_THUNDER_CHAMPION:
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (teamInInstance == HORDE)
                        creature->UpdateEntry(NPC_EXODAR_CHAMPION, ALLIANCE);
                    break;
                case NPC_TROLL_CHAMPION:
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (teamInInstance == HORDE)
                        creature->UpdateEntry(NPC_DARNASSUS_CHAMPION, ALLIANCE);
                    break;
                case NPC_UNDERCITY_CHAMPION:
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (teamInInstance == HORDE)
                        creature->UpdateEntry(NPC_IRONFORGE_CHAMPION, ALLIANCE);
                    break;
                // Coliseum Announcer, Just NPC_JAEREN must be spawned.
                case NPC_JAEREN:
                    announcerGUID = creature->GetGUID();
                    if (teamInInstance == ALLIANCE)
                        creature->UpdateEntry(NPC_ARELAS, ALLIANCE);
                    break;
                case NPC_JAEREN_AN:
                    if (teamInInstance == ALLIANCE)
                        creature->UpdateEntry(NPC_ARELAS_AN, ALLIANCE);
                    break;
                case VEHICLE_ARGENT_WARHORSE:
                case VEHICLE_ARGENT_BATTLEWORG:
                    vehicleList.push_back(creature->GetGUID());
                    break;
                case NPC_EADRIC:
                case NPC_PALETRESS:
                    argentChampionGUID = creature->GetGUID();
                    break;
            }
        }
Ejemplo n.º 6
0
            void OnCreatureCreate(Creature *creature, bool /*bAdd*/)
            {
            Map::PlayerList const &players = instance->GetPlayers();
            uint32 TeamInInstance = 0;

            if (!players.isEmpty())
            {
                if (Player* player = players.begin()->getSource())
                    TeamInInstance = player->GetTeam();
            }
            switch (creature->GetEntry())
            {
                // Alliance, you will be supported by Alliance npcs. Horde = Invisible.
                case 46889: // Kagtha
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == ALLIANCE)
                        creature->UpdateEntry(42308, ALLIANCE); // Lieutenant Horatio Laine
                    break;
                }
                case 46902: // Miss Mayhem
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == ALLIANCE)
                        creature->UpdateEntry(491, ALLIANCE); // Quartermaster Lewis <Quartermaster>
                    break;
                }
                case 46890: // Shattered Hand Assassin
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == ALLIANCE)
                        creature->UpdateEntry(1, ALLIANCE); // GM WAYPOINT
                    break;
                }
                case 46903: // Mayhem Reaper Prototype
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == ALLIANCE)
                        creature->UpdateEntry(1, ALLIANCE); // GM WAYPOINT
                    break;
                }
                case 24935: // Vend-O-Tron D-Luxe
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == ALLIANCE)
                        creature->UpdateEntry(1, ALLIANCE); // GM WAYPOINT
                    break;
                }
                case 46906: // Slinky Sharpshiv
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == ALLIANCE)
                        creature->UpdateEntry(1, ALLIANCE); // GM WAYPOINT
                    break;
                }
                // Horde, you will be supported by Horde npcs. Alliance = Invisible.
                case 46613: // Crime Scene Alarm-O-Bot
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == HORDE)
                        creature->UpdateEntry(1, HORDE); // GM WAYPOINT
                    break;
                }
                case 50595: // Stormwind Defender
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == HORDE)
                        creature->UpdateEntry(1, HORDE); // GM WAYPOINT
                   break;
               }
               case 46614: // Stormwind Investigator
               {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == HORDE)
                        creature->UpdateEntry(1, HORDE); // GM WAYPOINT
                   break;
               }
            }
            }
Ejemplo n.º 7
0
        void OnCreatureCreate(Creature* creature)
        {
            Map::PlayerList const &players = instance->GetPlayers();
            uint32 TeamInInstance = 0;

            if (!players.isEmpty())
            {
                if (Player* player = players.begin()->getSource())
                    TeamInInstance = player->GetTeam();
            }
            switch (creature->GetEntry())
            {
                case 26763:
                    Anomalus = creature->GetGUID();
                    break;
                case 26723:
                    Keristrasza = creature->GetGUID();
                    break;
                // Crystalline Frayer
                case 26793:
                    if (GetData(DATA_ORMOROK_EVENT) == DONE)
                    {
                        creature->UpdateEntry(29911);
                        creature->setFaction(35); 
                    }
                    else
                    {
                        if (creature->isAlive())
                            FrayerGUIDlist.insert(creature->GetGUID());
                    }
                    break;
                // Alliance npcs are spawned by default, if you are alliance, you will fight against horde npcs.
                case 26800: //Alliance Berserker ---> Horde Berserker
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == ALLIANCE)
                        creature->UpdateEntry(26799, HORDE);
                    break;
                }
                case 26802: //Alliance Ranger ---> Horde Ranger
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == ALLIANCE)
                        creature->UpdateEntry(26801, HORDE);
                    break;
                }
                case 26805: //Alliance Cleric ---> Horde Cleric
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == ALLIANCE)
                        creature->UpdateEntry(26803, HORDE);
                    break;
                }
                case 27949: //Alliance Commander ---> Horde Commander
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == ALLIANCE)
                        creature->UpdateEntry(27947, HORDE);
                    break;
                }
                case 26796: //Boss Stoutbeard ---> Boss Kolurg
                {
                    if (ServerAllowsTwoSideGroups())
                        creature->setFaction(FACTION_HOSTILE_FOR_ALL);
                    if (TeamInInstance == ALLIANCE)
                        creature->UpdateEntry(26798, HORDE);
                    Commander = creature->GetGUID();
                    break;
                }
            }
        }