Advertisement
Guest User

Script Item Horde3

a guest
Apr 11th, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. <--------------------------------------------------------------------------->
  3.  - Developer(s): Foxthecrash (Dwark)
  4.  - Complete: 90% (I want to add more things in future and optimize the code)
  5.  - ScriptName: 'Change Faction to Alliance'
  6.  - Comment: Tested
  7. <--------------------------------------------------------------------------->
  8. */
  9.  
  10. #include "ScriptPCH.h"
  11.  
  12. // Define la zona donde el jugador sera teletransportado si -> el Item expira o esta en una zona restringida
  13. // Define your zone to player will be teleported if -> Item expire or is in restricted zone
  14. // value: MapId, X, Y, Z, Orientation
  15. #define zone 1, -8531.564f, 2010.638f, 100.7205f, 0.380013f
  16.  
  17. class Item_Horde : public ItemScript
  18. {
  19.  
  20. public:
  21.     Item_Horde() : ItemScript("Item_Horde") {}
  22.  
  23.     bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
  24.     {
  25.         uint32 Hor = player->getRace() == RACE_BLOODELF || RACE_ORC || RACE_TAUREN || RACE_TROLL || RACE_UNDEAD_PLAYER;
  26.         if (player->IsInCombat() || player->IsMounted() || player->isMoving() || player->IsFlying()) // Combate, Montura, Moviendose, Volando
  27.         {
  28.             /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion en combate, Montura, Moviendote, Volando!");*/
  29.             player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction when you'r moving, on mount or flying!");
  30.             return false;
  31.         }
  32.         else if (player->GetGroupInvite() || player->InArena() || player->InBattleground() || player->InBattlegroundQueue() || player->inRandomLfgDungeon() || player->isUsingLfg()) //Arena, BG y colas
  33.         {
  34.             /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion en Arenas, BG o estando en cola para Aleatorias (BG e Instancias)!");*/
  35.             player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction in Arenas, BG or LFG!");
  36.             return false;
  37.         }
  38.         // Restriction for Horde in Stormwind, Elwyn Forest
  39.         // Restriccion para la horda en Ventormenta, Bosque de Elwyn
  40.         else if (player->GetAreaId() == 14 && player->GetZoneId() == 14 || player->GetAreaId() == 12 && player->GetZoneId() == 12 && player->HasAura(14268)) // zona
  41.         {
  42.             // If you want to teleport player when use the item in restricted zone just uncomment
  43.             // Si quieres que teletransporte al jugador cuando usa el item en las zonas restringidas solo descomenta
  44.             /*player->TeleportTo(zone);*/
  45.             /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion en esta zona!");*/
  46.             player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction in this area!");
  47.             return false;
  48.         }
  49.         // Restriction for Alliance in Orgrimmar, Durotar
  50.         // Restriccion para la Alianza en Orgrimmar, Durotar
  51.         else if (player->GetAreaId() == 1519 && player->GetZoneId() == 1519 || player->GetAreaId() == 1637 && player->GetZoneId() == 1637 && player->HasAura(14267))
  52.         {
  53.             // If you want to teleport player when use the item in restricted zone just uncomment
  54.             // Si quieres que teletransporte al jugador cuando usa el item en las zonas restringidas solo descomenta
  55.             /*player->TeleportTo(zone);*/
  56.             /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion en esta zona!");*/
  57.             player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction in this area!");
  58.         }
  59.         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
  60.         {
  61.             // Restricted spells to prevent abuse
  62.             // Hechizos restringidos para evitar abuso
  63.             /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion con hechizos como Sigilo, Bloque de Hielo, Inivisibilidad, etc.!");*/
  64.             player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction if you'r using stealth, ice block, invisibility, etc.!");
  65.             return false;
  66.         }
  67.         else
  68.         {
  69.             if (player->HasAura(14267)) // Prevent the player has double aura (Alianza and Horde) just to be safe
  70.             {
  71.                 player->RemoveAura(14267);
  72.                 player->setFactionForRace(2);
  73.             }
  74.             else if (player->HasAura(14268)) // If player uses the item again, remove the aura and restore faction to the horde
  75.             {
  76.                 player->RemoveAura(14268);
  77.                 player->setFactionForRace(2);
  78.             }
  79.             else
  80.             {
  81.                 player->AddAura(14268, player); // Add Aura and if player has the aura aply the new faction
  82.                 if (player->HasAura(14268))
  83.                 {
  84.                     player->setFactionForRace(1); // alianza
  85.                     player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF Now you'r Alliance!");
  86.                     /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF Ahora eres Alianza!");*/
  87.                     ChatHandler(player->GetSession()).PSendSysMessage("|cFFFFFC00[System]|cFF00FFFF If you logout your factión will restore, then use the item again to get the alliance faction!");
  88.                     /*ChatHandler(player->GetSession()).PSendSysMessage("|cFFFFFC00[Sistema]|cFF00FFFF Si desconectas tu volveras a tu facción original, usa denuevo el item para ser alianza!");*/
  89.                 }
  90.             }
  91.             return true;
  92.         }
  93.  
  94.         return true;
  95.     }
  96.  
  97.     bool OnExpire(Player* player, ItemTemplate const* proto)
  98.     {
  99.         uint8 Hor = player->getRace() == RACE_BLOODELF || RACE_ORC || RACE_TAUREN || RACE_TROLL || RACE_UNDEAD_PLAYER;
  100.         player->RemoveAura(14268);
  101.         if (player->getRace() == Hor)
  102.         {
  103.             player->setFactionForRace(RACE_BLOODELF || RACE_ORC);
  104.         }
  105.         player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF Your faction back to the original!");
  106.         /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF Has vuelto a tu facción original!");*/
  107.         player->TeleportTo(zone);
  108.  
  109.         return true;
  110.     }
  111. };
  112.  
  113. void AddSC_Item_Horde()
  114. {
  115.     new Item_Horde();
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement