Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- <--------------------------------------------------------------------------->
- - Developer(s): Foxthecrash (Dwark)
- - Complete: 90% (I want to add more things in future and optimize the code)
- - ScriptName: 'Change Faction to Horde'
- - Comment: Tested
- <--------------------------------------------------------------------------->
- */
- #include "ScriptPCH.h"
- // Define la zona donde el jugador sera teletransportado si -> el Item expira o esta en una zona restringida
- // Define your zone to player will be teleported if -> Item expire or is in restricted zone
- // value: MapId, X, Y, Z, Orientation
- #define zone 1, -8531.564f, 2010.638f, 100.7205f, 0.380013f
- class Item_Alliance : public ItemScript
- {
- public:
- Item_Alliance() : ItemScript("Item_Alliance") {}
- bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
- { // 61849 aura de 1 hora - 24705 aura de 2 horas - 37128 aura de 15 minutos -
- // 26898 aura de 1 hora (dura muerto) -
- uint32 Ali = player->getRace() == RACE_DRAENEI || RACE_DWARF || RACE_GNOME || RACE_HUMAN || RACE_NIGHTELF;
- if (player->IsInCombat() || player->IsMounted() || player->isMoving() || player->IsFlying()) // Combate, Montura, Moviendose, Volando
- {
- /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion en combate, Montura, Moviendote, Volando!");*/
- player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction when you'r moving, on mount or flying!");
- return false;
- }
- else if (player->GetGroupInvite() || player->InArena() || player->InBattleground() || player->InBattlegroundQueue() || player->inRandomLfgDungeon() || player->isUsingLfg()) //Arena, BG y colas
- {
- /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion en Arenas, BG o estando en cola para Aleatorias (BG e Instancias)!");*/
- player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction in Arenas, BG or LFG!");
- return false;
- }
- // Restriction for Horde in Stormwind, Elwyn Forest
- // Restriccion para la horda en Ventormenta, Bosque de Elwyn
- else if (player->GetAreaId() == 14 && player->GetZoneId() == 14 || player->GetAreaId() == 12 && player->GetZoneId() == 12 && player->HasAura(14268))
- {
- // If you want to teleport player when use the item in restricted zone just uncomment
- // Si quieres que teletransporte al jugador cuando usa el item en las zonas restringidas solo descomenta
- /*player->TeleportTo(zone);*/
- /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion en esta zona!");*/
- player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction in this area!");
- return false;
- }
- // Restriction for Alliance in Orgrimmar, Durotar
- // Restriccion para la Alianza en Orgrimmar, Durotar
- else if (player->GetAreaId() == 1519 && player->GetZoneId() == 1519 || player->GetAreaId() == 1637 && player->GetZoneId() == 1637 && player->HasAura(14267))
- {
- // If you want to teleport player when use the item in restricted zone just uncomment
- // Si quieres que teletransporte al jugador cuando usa el item en las zonas restringidas solo descomenta
- /*player->TeleportTo(zone);*/
- /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion en esta zona!");*/
- player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction in this area!");
- }
- else if (player->HasAura(5384) || player->HasAura(1784) || player->HasAura(1856) || player->HasAura(26889) || player->HasAura(2645) || player->HasAura(66) || player->HasAura(45438) || player->HasAura(5215) || player->HasAura(3448) || player->HasAura(11464) || player->HasAura(11392) || player->HasStealthAura()) // spells
- {
- // Restricted spells to prevent abuse
- // Hechizos restringidos para evitar abuso
- /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion con hechizos como Sigilo, Bloque de Hielo, Inivisibilidad, etc.!");*/
- player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction if you'r using stealth, ice block, invisibility, etc.!");
- return false;
- }
- /*else if (player->duel)
- {
- player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion estando en un duelo!");
- return true;
- }*/
- else
- {
- if (player->HasAura(14268)) // Prevent the player has double aura (Alianza and Horde) just to be safe
- {
- player->RemoveAura(14268);
- player->setFactionForRace(RACE_HUMAN || RACE_DRAENEI);
- }
- else if (player->HasAura(14267)) // If player uses the item again, remove the aura and restore faction to the alliance
- {
- player->RemoveAura(14267);
- player->setFactionForRace(RACE_HUMAN || RACE_DRAENEI);
- }
- else
- {
- player->AddAura(14267, player); // Add Aura and if player has the aura aply the new faction
- if (player->HasAura(14267))
- {
- player->setFactionForRace(2); //horda 1 hora
- player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF Now you'r Horde!");
- /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF Ahora eres Horda!");*/
- ChatHandler(player->GetSession()).PSendSysMessage("|cFFFFFC00[System]|cFF00FFFF If you logout your factión will restore, then use the item again to get the Horde faction!");
- /*ChatHandler(player->GetSession()).PSendSysMessage("|cFFFFFC00[Sistema]|cFF00FFFF Si desconectas tu volveras a tu facción original, usa denuevo el item para ser Horda!");*/
- }
- }
- return true;
- }
- return true;
- }
- bool OnExpire(Player* player, ItemTemplate const* proto)
- {
- uint8 Ali = player->getRace() == RACE_DRAENEI || RACE_DWARF || RACE_GNOME || RACE_HUMAN || RACE_NIGHTELF;
- player->RemoveAura(14267);
- if (player->getRace() == Ali)
- {
- player->setFactionForRace(RACE_HUMAN || RACE_DRAENEI);
- }
- player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF Your faction back to the original!");
- /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF Has vuelto a tu facción original!");*/
- player->TeleportTo(zone);
- return true;
- }
- };
- void AddSC_Item_Alliance()
- {
- new Item_Alliance();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement