Advertisement
Guest User

Script Item Alliance2

a guest
Apr 11th, 2014
91
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 Horde'
  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_Alliance : public ItemScript
  18. {
  19.  
  20. public:
  21.     Item_Alliance() : ItemScript("Item_Alliance") {}
  22.  
  23.     bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
  24.     { // 61849 aura de 1 hora - 24705 aura de 2 horas - 37128 aura de 15 minutos -
  25.         // 26898 aura de 1 hora (dura muerto) -
  26.  
  27.         uint32 Ali = player->getRace() == RACE_DRAENEI || RACE_DWARF || RACE_GNOME || RACE_HUMAN || RACE_NIGHTELF;
  28.         if (player->IsInCombat() || player->IsMounted() || player->isMoving() || player->IsFlying()) // Combate, Montura, Moviendose, Volando
  29.         {
  30.             /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion en combate, Montura, Moviendote, Volando!");*/
  31.             player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction when you'r moving, on mount or flying!");
  32.             return false;
  33.         }
  34.         else if (player->GetGroupInvite() || player->InArena() || player->InBattleground() || player->InBattlegroundQueue() || player->inRandomLfgDungeon() || player->isUsingLfg()) //Arena, BG y colas
  35.         {
  36.             /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion en Arenas, BG o estando en cola para Aleatorias (BG e Instancias)!");*/
  37.             player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction in Arenas, BG or LFG!");
  38.             return false;
  39.         }
  40.         // Restriction for Horde in Stormwind, Elwyn Forest
  41.         // Restriccion para la horda en Ventormenta, Bosque de Elwyn
  42.         else if (player->GetAreaId() == 14 && player->GetZoneId() == 14 || player->GetAreaId() == 12 && player->GetZoneId() == 12 && player->HasAura(14268))
  43.         {
  44.             // If you want to teleport player when use the item in restricted zone just uncomment
  45.             // Si quieres que teletransporte al jugador cuando usa el item en las zonas restringidas solo descomenta
  46.             /*player->TeleportTo(zone);*/
  47.             /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion en esta zona!");*/
  48.             player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction in this area!");
  49.             return false;
  50.         }
  51.         // Restriction for Alliance in Orgrimmar, Durotar
  52.         // Restriccion para la Alianza en Orgrimmar, Durotar
  53.         else if (player->GetAreaId() == 1519 && player->GetZoneId() == 1519 || player->GetAreaId() == 1637 && player->GetZoneId() == 1637 && player->HasAura(14267))
  54.         {
  55.             // If you want to teleport player when use the item in restricted zone just uncomment
  56.             // Si quieres que teletransporte al jugador cuando usa el item en las zonas restringidas solo descomenta
  57.             /*player->TeleportTo(zone);*/
  58.             /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion en esta zona!");*/
  59.             player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction in this area!");
  60.         }
  61.         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
  62.         {
  63.             // Restricted spells to prevent abuse
  64.             // Hechizos restringidos para evitar abuso
  65.             /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion con hechizos como Sigilo, Bloque de Hielo, Inivisibilidad, etc.!");*/
  66.             player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF You can't change faction if you'r using stealth, ice block, invisibility, etc.!");
  67.             return false;
  68.         }
  69.         /*else if (player->duel)
  70.         {
  71.         player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF No puedes Cambiar de faccion estando en un duelo!");
  72.         return true;
  73.         }*/
  74.         else
  75.         {
  76.             if (player->HasAura(14268)) // Prevent the player has double aura (Alianza and Horde) just to be safe
  77.             {
  78.                 player->RemoveAura(14268);
  79.                 player->setFactionForRace(RACE_HUMAN || RACE_DRAENEI);
  80.             }
  81.             else if (player->HasAura(14267)) // If player uses the item again, remove the aura and restore faction to the alliance
  82.             {
  83.                 player->RemoveAura(14267);
  84.                 player->setFactionForRace(RACE_HUMAN || RACE_DRAENEI);
  85.             }
  86.             else
  87.             {
  88.                 player->AddAura(14267, player); // Add Aura and if player has the aura aply the new faction
  89.                 if (player->HasAura(14267))
  90.                 {
  91.                     player->setFactionForRace(2); //horda 1 hora
  92.                     player->GetSession()->SendNotification("|cFFFFFC00[System]|cFF00FFFF Now you'r Horde!");
  93.                     /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF Ahora eres Horda!");*/
  94.                     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!");
  95.                     /*ChatHandler(player->GetSession()).PSendSysMessage("|cFFFFFC00[Sistema]|cFF00FFFF Si desconectas tu volveras a tu facción original, usa denuevo el item para ser Horda!");*/
  96.                 }
  97.             }
  98.             return true;
  99.         }
  100.  
  101.         return true;
  102.     }
  103.  
  104.     bool OnExpire(Player* player, ItemTemplate const* proto)
  105.     {
  106.         uint8 Ali = player->getRace() == RACE_DRAENEI || RACE_DWARF || RACE_GNOME || RACE_HUMAN || RACE_NIGHTELF;
  107.             player->RemoveAura(14267);
  108.             if (player->getRace() == Ali)
  109.             {
  110.                 player->setFactionForRace(RACE_HUMAN || RACE_DRAENEI);
  111.             }
  112.             player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF Your faction back to the original!");
  113.             /*player->GetSession()->SendNotification("|cFFFFFC00[Sistema]|cFF00FFFF Has vuelto a tu facción original!");*/
  114.             player->TeleportTo(zone);
  115.  
  116.         return true;
  117.     }
  118. };
  119.  
  120. void AddSC_Item_Alliance()
  121. {
  122.     new Item_Alliance();
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement