Exemplo n.º 1
0
 private static void RAFTests()
 {
     using (RAF raf = new RAF(@"D:\Chewy\Desktop\Archive_2.raf"))
     {
     }
     RAF raf2 = new RAF(@"D:\Chewy\Desktop\Archive_3.raf");
 }
Exemplo n.º 2
0
    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "armafisica")
        {
            RAF arma = GetComponent <RAF> ();
            this.armaactualfisica = arma.estadoactual;
        }

        if (collision.gameObject.tag == "armadistancia")
        {
            RAD arma = GetComponent <RAD> ();
            this.armaactualdistancia = arma.estadoactual;
        }
    }
Exemplo n.º 3
0
        // These buffs are OK to cast when you are IN COMBAT
        private void InCombatBuffs()
        {
            if (!Me.Combat)
            {
                return;
            }
            if (Me.IsFlying)
            {
                return;
            }
            if (Me.Mounted)
            {
                return;
            }

            if (Me.IsInParty && CLC.ResultOK(Settings.ShadowProtection) && Spell.CanCast("Shadow Protection"))
            {
                const string buffName = "Shadow Protection";
                WoWUnit      target   = RAF.PartyMemberWithoutBuff(buffName);
                if (target != null)
                {
                    Spell.Cast(buffName, target);
                }
            }
            if (!Me.IsInParty && !Self.IsBuffOnMe("Shadow Protection") && CLC.ResultOK(Settings.ShadowProtection) && Spell.CanCast("Shadow Protection"))
            {
                Spell.Cast("Shadow Protection", Me);
            }


            // Fear Ward
            if (!Self.IsBuffOnMe("Fear Ward") && CLC.ResultOK(Settings.FearWard) && Spell.CanCast("Fear Ward"))
            {
                Spell.Cast("Fear Ward", Me);
            }


            // Class specific buffs
            //if (!Self.IsBuffOnMe(ClassHelpers.Druid.IDs.MarkOfTheWild, Self.AuraCheck.AllAuras) && Spell.CanCast("Mark of the Wild")) Spell.Cast("Mark of the Wild", Me);
            //if (!Self.IsBuffOnMe(IDs.MoltenCore, Self.AuraCheck.ActiveAuras) && Spell.CanCast("Power Word: Fortitude")) Spell.Cast("Power Word: Fortitude");
        }
Exemplo n.º 4
0
        // All buffs check here. Only cast when you are OUT OF COMBAT
        private void OutOfCombatBuffs()
        {
            if (Me.Combat)
            {
                return;
            }
            if (Me.IsFlying)
            {
                return;
            }
            if (Me.Mounted)
            {
                return;
            }
            if (Self.IsBuffOnMe("Drink"))
            {
                return;
            }
            if (Self.IsBuffOnMe("Food"))
            {
                return;
            }
            if (Me.IsCasting)
            {
                return;
            }

            // Resurrection
            if (Settings.ResurrectPlayers.Contains("always") && Spell.CanCast("Resurrection"))
            {
                foreach (WoWPlayer p in Me.PartyMembers.Where(p => p.Dead && !p.IsGhost && p.InLineOfSight))
                {
                    if (Timers.Exists(p.Guid.ToString()) && !Timers.Expired(p.Guid.ToString(), 15000))
                    {
                        continue;
                    }

                    Spell.Cast("Resurrection", p);
                    Utils.LagSleep();
                    Timers.Add(p.Guid.ToString());  // Prevent spamming resurrection on th same target
                    System.Threading.Thread.Sleep(1500);
                    if (!Me.IsCasting)
                    {
                        Spell.StopCasting();
                    }
                    while (Me.IsCasting)
                    {
                        if (!p.Dead)
                        {
                            Utils.Log("-Emmm.... it appears our dead party member is now alive. So why are we still trying to rez them?");
                            Spell.StopCasting();
                        }
                    }
                    break;
                }
            }


            // Inner Fire or Inner Will
            if (!Self.IsBuffOnMe("Inner Fire") && Settings.InnerFireWill.Contains("Inner Fire") && Spell.CanCast("Inner Fire"))
            {
                Spell.Cast("Inner Fire", Me);
            }
            if (!Self.IsBuffOnMe("Inner Will") && Settings.InnerFireWill.Contains("Inner Will") && Spell.CanCast("Inner Will"))
            {
                Spell.Cast("Inner Will", Me);
            }

            // Power Word Fortitude
            if (Me.IsInParty && CLC.ResultOK(Settings.PowerWordFortitude) && Spell.CanCast("Power Word: Fortitude"))
            {
                const string buffName = "Power Word: Fortitude";
                WoWUnit      target   = RAF.PartyMemberWithoutBuff(buffName);
                if (target != null && !target.Auras.ContainsKey("Blood Pact"))
                {
                    Spell.Cast(buffName, target);
                }
            }

            // Vampiric Embrace
            if (!Self.IsBuffOnMe("Vampiric Embrace") && Spell.CanCast("Vampiric Embrace"))
            {
                Spell.Cast("Vampiric Embrace");
            }


            // Class specific buffs
            //if (!Self.IsBuffOnMe(ClassHelpers.Druid.IDs.MarkOfTheWild, Self.AuraCheck.AllAuras) && Spell.CanCast("Mark of the Wild")) Spell.Cast("Mark of the Wild", Me);
        }
Exemplo n.º 5
0
        public override void Pulse()
        {
            // HB runs this as frequenty as possible. I don't know the exact frequency but its supposed to be 5-10 times per second
            // Anything you want checked on a regular basis you may want to add here.
            // For example buffing / healing random players

            base.Pulse();

            int lootableMobs = LootTargeting.Instance.LootingList.Count;

            // If Settings.DirtyData = true it will reload the settings from the XML file
            // This reads the XML file and re-populates the Settings class with any changed values
            if (!_isCCLoaded)
            {
                _isCCLoaded = true; Settings.DirtyData = true;
            }
            if (Settings.DirtyData)
            {
                LoadSettings(true);
            }

            // So we don't overload HB the below code is only run once per second
            if (!Timers.Expired("Pulse", 1000))
            {
                return;
            }
            Timers.Recycle("Pulse", 1000);

            // Environmental Settings
            if (Timers.Expired("EnvironmentSettings", 5000))
            {
                if (Settings.MultipleEnvironment.Contains("never"))
                {
                    ConfigSettings.CurrentEnvironment = "PVE";
                }
                else
                {
                    Timers.Reset("EnvironmentSettings");
                    string environment = Utils.IsBattleground ? "PVP" : "PVE";
                    environment = ObjectManager.Me.IsInInstance ? "Instance" : environment;
                    if (!ConfigSettings.UIActive && environment != ConfigSettings.CurrentEnvironment)
                    {
                        ConfigSettings.CurrentEnvironment = environment;
                        Utils.Log(string.Format("*** Environment has changed. Loading {0} settings.", environment), Utils.Colour("Red"));
                        LoadSettings(false);
                    }
                }
            }



            // Make sure we have a target - Instance only
            // Sometimes IB was not selecting a target when we were in combat. This f****d up things immensely!
            if (Me.IsInInstance && !Me.GotTarget)
            {
                WoWUnit tank = RAF.PartyTankRole;
                if (tank != null && tank.GotTarget && tank.Combat)
                {
                    RAF.PartyTankRole.CurrentTarget.Target();
                }
            }

            // Decurse / Remove Corruption
            if (CLC.ResultOK(Settings.RemoveCorruptionBalance) && Spell.CanCast("Remove Corruption"))
            {
                WoWUnit p = ClassHelpers.Druid.NeedToDecursePlayer;
                if (p != null && Spell.CanCast("Remove Corruption"))
                {
                    Spell.Cast("Remove Corruption", p);
                }
            }

            // Buff players with MotW);
            if (Settings.MarkOfTheWild.Contains("always") && Me.IsInParty && Me.ManaPercent > 40)
            {
                WoWUnit p = RAF.PartyMemberWithoutBuff("Mark of the Wild");
                if (p != null)
                {
                    if (Spell.CanCast("Mark of the Wild"))
                    {
                        Spell.Cast("Mark of the Wild", p);
                    }
                }
            }


            // Predator's Swiftness
            if (CLC.ResultOK(Settings.PredatorsSwiftnessFeralCat) && !Self.IsHealthPercentAbove(Settings.PredatorsSwiftnessFeralCatHealth))
            {
                if (Self.IsBuffOnMeLUA("Predator's Swiftness") && Spell.CanCast(Settings.PredatorsSwiftnessFeralCatSpell))
                {
                    Utils.Log("** Predator's Swiftness **");
                    Spell.Cast(Settings.PredatorsSwiftnessFeralCatSpell, Me);
                }
            }


            // Resurrection
            if (!Me.Combat && Spell.CanCast("Revive") && !Me.IsCasting)
            {
                foreach (WoWPlayer p in Me.PartyMembers.Where(p => p.Dead && !p.IsGhost && p.InLineOfSight))
                {
                    if (Timers.Exists(p.Guid.ToString()) && !Timers.Expired(p.Guid.ToString(), 15000))
                    {
                        continue;
                    }

                    Spell.Cast("Revive", p);
                    Utils.LagSleep();
                    Timers.Add(p.Guid.ToString());  // Prevent spamming resurrection on th same target
                    System.Threading.Thread.Sleep(1500);
                    if (!Me.IsCasting)
                    {
                        Spell.StopCasting();
                    }
                    while (Me.IsCasting)
                    {
                        if (!p.Dead)
                        {
                            Utils.Log("-Emmm.... it appears our dead party member is now alive. So why are we still trying to rez them?");
                            Spell.StopCasting();
                        }
                    }
                    break;
                }
            }

            // Clean up timers
            foreach (WoWPlayer p in Me.PartyMembers.Where(p => p.IsAlive && Timers.Exists(p.Guid.ToString())))
            {
                Timers.Remove(p.Guid.ToString());
            }

            // Make sure we have a target - Instance only
            // Sometimes IB was not selecting a target when we were in combat. This f****d up things immensely!
            if (Me.IsInInstance && !Me.GotTarget)
            {
                WoWUnit tank = RAF.PartyTankRole;
                if (tank != null && tank.GotTarget && tank.Combat)
                {
                    tank.CurrentTarget.Target();
                }
            }

            // Try and grab a target all the time, if we're sitting around doing nothing check if anyone in our party has a target and take it.
            if (!Me.Combat)
            {
                foreach (WoWPlayer player in Me.PartyMembers)
                {
                    if (!player.Combat)
                    {
                        continue;
                    }
                    if (player.Distance > 80)
                    {
                        continue;
                    }
                    if (!player.GotTarget)
                    {
                        continue;
                    }

                    player.CurrentTarget.Target();
                }
            }

            // Out of combat healing. Make sure everyone is topped up.
            if (!Me.Mounted && !Me.IsFlying && !Me.Combat && (Me.IsInParty || Me.IsInRaid) && Spell.CanCast("Regrowth"))
            {
                List <WoWPlayer> myPartyOrRaidGroup = Me.PartyMembers;
                List <WoWPlayer> healTarget         = (from o in myPartyOrRaidGroup let p = o.ToPlayer() where p.Distance < 40 && !p.Auras.ContainsKey("Regrowth") && !p.Dead && !p.IsGhost && p.InLineOfSight && p.HealthPercent < 80 select p).ToList();
                //List<WoWPlayer> healTarget = (from o in myPartyOrRaidGroup let p = o.ToPlayer() where p.Distance < 40 && !p.Auras.ContainsKey("Regrowth") && !p.Dead && !p.IsGhost && p.InLineOfSight && p.HealthPercent < 80 select p).ToList();

                if (healTarget.Count > 0)
                {
                    Spell.Cast("Regrowth", healTarget.FirstOrDefault());
                }
                else if (Me.HealthPercent < 80)
                {
                    Spell.Cast("Regrowth", Me);
                }
            }


            // Buffs and such
            if (!Me.IsFlying && !Me.Mounted)
            {
                if (!Self.IsBuffOnMe(Druid_ID.MarkOfTheWild) && Spell.CanCast("Mark of the Wild") && Settings.MarkOfTheWild.Contains("always"))
                {
                    Spell.Cast("Mark of the Wild", Me);
                }

                if (!Me.Combat)
                {
                    if (!Me.IsMoving)
                    {
                        Timers.Reset("TravelForm");
                    }
                    if (Timers.Expired("TravelForm", 4000) && ClassHelpers.Druid.Shapeshift.CanUseTravelForm)
                    {
                        ClassHelpers.Druid.Shapeshift.TravelForm();
                    }
                }

                /*
                 * if (Me.Combat)
                 * {
                 *
                 *  if (Me.GotTarget && Me.CurrentTarget.IsCasting)
                 *  {
                 *      Utils.Log("==============[TARGET IS CASTING A SPELL]==============");
                 *      Utils.Log("=== Spell name: " + CT.CastingSpell.Name);
                 *      Utils.Log("=== Spell ID: " + CT.CastingSpell.Id);
                 *      Utils.Log("=== Spell description: " + CT.CastingSpell.Description);
                 *      Utils.Log("=== Spell school: " + CT.CastingSpell.School);
                 *      Utils.Log("=== Spell mechanic: " + CT.CastingSpell.Mechanic.ToString());
                 *      Utils.Log("=== Spell cast time (ms): " + CT.CastingSpell.CastTime);
                 *      Utils.Log("=======================================================");
                 *  }
                 *
                 * }
                 */

                /*
                 * if (Me.Combat)
                 * {
                 *  if (Me.IsInInstance)
                 *  {
                 *      foreach (WoWUnit unit in ObjectManager.GetObjectsOfType<WoWUnit>())
                 *      {
                 *          //Utils.Log("=====================[Threat Info]============================");
                 *          if (!unit.Combat) continue;
                 *          if (unit.Distance > 80) continue;
                 *          Utils.Log(string.Format("-- {0}, TargetGuid {1}, ThreatStatus {2}, ThreatPercent {3}, RawPercent {4}", unit.Name, unit.ThreatInfo.TargetGuid,unit.ThreatInfo.ThreatStatus,unit.ThreatInfo.RawPercent,unit.ThreatInfo.RawPercent));
                 *          Utils.Log("-- Threat for ME " + unit.GetThreatInfoFor(Me));
                 *
                 *      }
                 *  }
                 * }
                 */
            }

            // If you are drinking/eating and the tank is in combat and low on health then get your ass up and heal
            if (Self.IsBuffOnMe("Food") || Self.IsBuffOnMe("Drink"))
            {
                WoWUnit tank = RAF.PartyTankRole;

                if (tank != null && Me.IsInInstance && tank.Combat)
                {
                    if (tank.HealthPercent < 70)
                    {
                        Utils.Log("-Oh shit! The tank has pulled while we were drinking");
                        Lua.DoString("CancelUnitBuff('player', 'Food')");
                        Lua.DoString("CancelUnitBuff('player', 'Drink')");
                    }
                }
            }
        }
Exemplo n.º 6
0
        public override void Pulse()
        {
            // HB runs this as frequenty as possible. I don't know the exact frequency but its supposed to be 5-10 times per second
            // Anything you want checked on a regular basis you may want to add here.
            // For example buffing / healing random players

            base.Pulse();

            int lootableMobs = LootTargeting.Instance.LootingList.Count;

            // If Settings.DirtyData = true it will reload the settings from the XML file
            // This reads the XML file and re-populates the Settings class with any changed values
            if (!_isCCLoaded)
            {
                _isCCLoaded = true; Settings.DirtyData = true;
            }
            if (Settings.DirtyData)
            {
                LoadSettings(true);
            }

            // So we don't overload HB the below code is only run once per second
            if (!Timers.Expired("Pulse", 1000))
            {
                return;
            }
            Timers.Recycle("Pulse", 1000);

            // Environmental Settings
            if (Timers.Expired("EnvironmentSettings", 5000))
            {
                if (Settings.MultipleEnvironment.Contains("never"))
                {
                    ConfigSettings.CurrentEnvironment = "PVE";
                }
                else
                {
                    Timers.Reset("EnvironmentSettings");
                    string environment = Utils.IsBattleground ? "PVP" : "PVE";
                    environment = ObjectManager.Me.IsInInstance ? "Instance" : environment;
                    if (!ConfigSettings.UIActive && environment != ConfigSettings.CurrentEnvironment)
                    {
                        ConfigSettings.CurrentEnvironment = environment;
                        Utils.Log(string.Format("*** Environment has changed. Loading {0} settings.", environment), Utils.Colour("Red"));
                        LoadSettings(false);
                    }
                }
            }

            // Evangelism / Archangel
            if (!Me.Combat)
            {
                Timers.Reset("ArcSmiteCombat");
            }

            // Make sure we have a target - Instance only
            // Sometimes IB was not selecting a target when we were in combat. This f****d up things immensely!
            if (Me.IsInInstance && !Me.GotTarget)
            {
                WoWUnit tank = RAF.PartyTankRole;
                if (tank != null && tank.GotTarget && tank.Combat)
                {
                    RAF.PartyTankRole.CurrentTarget.Target();
                }
            }


            // Dispel Magic - You and all party members);
            if ((!Settings.Cleanse.Contains("never") || !Settings.PartyCleanse.Contains("never")) && Spell.CanCast("Dispel Magic"))
            {
                List <int> urgentRemoval = new List <int> {
                    17173
                };
                bool urgentCleanse = (from aura in Me.ActiveAuras from procID in urgentRemoval where procID == aura.Value.SpellId select aura).Any();

                if (urgentCleanse || CLC.ResultOK(Settings.Cleanse) || CLC.ResultOK(Settings.PartyCleanse))
                {
                    List <WoWDispelType> cureableList = new List <WoWDispelType> {
                        WoWDispelType.Magic
                    };
                    //if (Settings.SacredCleansing.Contains("... talented") && !cureableList.Contains(WoWDispelType.Magic)) { cureableList.Add(WoWDispelType.Magic); }

                    var p = ClassHelpers.Common.DecursePlayer(cureableList, CLC.ResultOK(Settings.PartyCleanse));
                    if (p != null)
                    {
                        if (Spell.CanCast("Dispel Magic"))
                        {
                            Spell.Cast("Dispel Magic", p);
                        }
                    }
                }
            }

            // Cure Disease - You and all party members);
            if ((!Settings.Cleanse.Contains("never") || !Settings.PartyCleanse.Contains("never")) && Spell.CanCast("Cure Disease"))
            {
                List <int> urgentRemoval = new List <int> {
                    3427
                };
                bool urgentCleanse = (from aura in Me.ActiveAuras from procID in urgentRemoval where procID == aura.Value.SpellId select aura).Any();

                if (urgentCleanse || CLC.ResultOK(Settings.Cleanse))
                {
                    List <WoWDispelType> cureableList = new List <WoWDispelType> {
                        WoWDispelType.Disease
                    };
                    var p = ClassHelpers.Common.DecursePlayer(cureableList, CLC.ResultOK(Settings.PartyCleanse));
                    if (p != null)
                    {
                        if (Spell.CanCast("Cure Disease"))
                        {
                            Spell.Cast("Cure Disease", p);
                        }
                    }
                }
            }

            // Buffs and such
            if (!Me.IsFlying && !Me.Mounted && !Me.Auras.ContainsKey("Altered Form"))
            {
                // Inner Fire/Will
                if (!Self.IsBuffOnMe("Inner Fire") && Settings.InnerFireWill.Contains("Inner Fire") && Spell.CanCast("Inner Fire"))
                {
                    Spell.Cast("Inner Fire", Me);
                }
                if (!Self.IsBuffOnMe("Inner Will") && Settings.InnerFireWill.Contains("Inner Will") && Spell.CanCast("Inner Will"))
                {
                    Spell.Cast("Inner Will", Me);
                }

                // Power Word Fortitude
                if (Me.IsInParty && !Me.Combat && CLC.ResultOK(Settings.PowerWordFortitude) && Spell.CanCast("Power Word: Fortitude"))
                {
                    const string buffName = "Power Word: Fortitude";
                    WoWUnit      target   = RAF.PartyMemberWithoutBuff(buffName);
                    if (target != null && !target.Auras.ContainsKey("Blood Pact"))
                    {
                        Spell.Cast(buffName, target);
                    }
                }
                if (!Me.IsInParty && !Me.Combat && !Self.IsBuffOnMe("Power Word: Fortitude") && CLC.ResultOK(Settings.PowerWordFortitude) && Spell.CanCast("Power Word: Fortitude"))
                {
                    Spell.Cast("Power Word: Fortitude", Me);
                }

                // Shadow Protection
                if (Me.IsInParty && !Me.Combat && CLC.ResultOK(Settings.ShadowProtection) && Spell.CanCast("Shadow Protection"))
                {
                    const string buffName = "Shadow Protection";
                    WoWUnit      target   = RAF.PartyMemberWithoutBuff(buffName);
                    if (target != null)
                    {
                        Spell.Cast(buffName, target);
                    }
                }
                if (!Me.IsInParty && !Me.Combat && !Self.IsBuffOnMe("Shadow Protection") && CLC.ResultOK(Settings.ShadowProtection) && Spell.CanCast("Shadow Protection"))
                {
                    Spell.Cast("Shadow Protection", Me);
                }

                // Vampiric Embrace
                if (!Self.IsBuffOnMe("Vampiric Embrace") && Spell.CanCast("Vampiric Embrace"))
                {
                    Spell.Cast("Vampiric Embrace");
                }

                // Fear Ward
                if (!Self.IsBuffOnMe("Fear Ward") && CLC.ResultOK(Settings.FearWard) && Spell.CanCast("Fear Ward"))
                {
                    Spell.Cast("Fear Ward", Me);
                }
            }

            // Shadowform - can be applied while flying and mounted
            //if (CLC.ResultOK(Settings.Shadowform) && !Self.IsBuffOnMe("Shadowform") && Self.IsHealthPercentAbove(Settings.RenewHealth) && Spell.CanCast("Shadowform")) Spell.Cast("Shadowform");
            if (CLC.ResultOK(Settings.Shadowform) && !Self.IsBuffOnMe(15473, Self.AuraCheck.AllAuras) && !Me.Mounted && Self.IsHealthPercentAbove(Settings.RenewHealth) && Spell.CanCast("Shadowform"))
            {
                Spell.Cast("Shadowform");
            }


            // Prayer of Healing
            if (!Me.Mounted && !Me.IsFlying && !Me.Combat && (Me.IsInParty || Me.IsInRaid))
            {
                int PoHCount = Convert.ToInt16(Settings.PrayerOfHealingCount);
                List <WoWPlayer> myPartyOrRaidGroup = Me.PartyMembers;
                List <WoWPlayer> PoH = (from o in myPartyOrRaidGroup let p = o.ToPlayer() where p.Distance < 30 && !p.Dead && !p.IsGhost && p.InLineOfSight && p.HealthPercent < Settings.PrayerOfHealingHealth select p).ToList();
                if (PoH.Count >= PoHCount && Spell.CanCast("Prayer of Healing"))
                {
                    Spell.Cast("Prayer of Healing");
                    Utils.LagSleep();
                    Utils.WaitWhileCasting();
                }

                // Everyone else in the party gets healed
                WoWUnit healTarget = RAF.HealPlayer(95, 40);
                if (healTarget != null && !healTarget.Dead)
                {
                    ClassHelpers.Priest.PartyHealer(healTarget);
                }
            }


            // Archangel - Use it or loose it
            if (!Me.Mounted && !Me.IsFlying && (!Me.Auras.ContainsKey("Drink") || !Me.Auras.ContainsKey("Food")) && Me.ActiveAuras.ContainsKey("Evangelism") && !Me.Combat)
            {
                const string spell            = "Evangelism";
                const string archangel        = "Archangel";
                double       getTime          = Convert.ToDouble(Self.GetTimeLUA());
                double       buffTime         = Convert.ToDouble(Self.BuffTimeLeftLUA(spell));
                double       secondsRemaining = buffTime - getTime;

                if (secondsRemaining < 4.5 && Spell.CanCastLUA(archangel))
                {
                    Utils.Log("-Evangelism buff about to expire. Casting Archangel buff to consume it", Utils.Colour("Red"));
                    Spell.Cast(archangel);
                }
            }


            // Resurrection
            if (Settings.ResurrectPlayers.Contains("always") && !Me.Combat && Spell.CanCast("Resurrection") && !Me.IsCasting)
            {
                foreach (WoWPlayer p in Me.PartyMembers.Where(p => p.Dead && !p.IsGhost && p.InLineOfSight))
                {
                    if (Timers.Exists(p.Guid.ToString()) && !Timers.Expired(p.Guid.ToString(), 15000))
                    {
                        continue;
                    }

                    Spell.Cast("Resurrection", p);
                    Utils.LagSleep();
                    Timers.Add(p.Guid.ToString());  // Prevent spamming resurrection on th same target
                    System.Threading.Thread.Sleep(1500);
                    if (!Me.IsCasting)
                    {
                        Spell.StopCasting();
                    }
                    while (Me.IsCasting)
                    {
                        if (!p.Dead)
                        {
                            Utils.Log("-Emmm.... it appears our dead party member is now alive. So why are we still trying to rez them?");
                            Spell.StopCasting();
                        }
                    }
                    break;
                }
            }

            // Clean up timers
            foreach (WoWPlayer p in Me.PartyMembers.Where(p => p.IsAlive && Timers.Exists(p.Guid.ToString())))
            {
                Timers.Remove(p.Guid.ToString());
            }
        }
Exemplo n.º 7
0
        public void InstallProject(string directory, string projectName, string projectVersion, uint?deployMode, string solutionName = null, string solutionVersion = null)
        {
            var projectsURL = String.Format("{0}/releases/{1}/projects/{2}", LeagueCDN, Platform, projectName);

            var projectFolder      = String.Format("{0}/RADS/projects/{1}", directory, projectName);
            var releaseFolder      = String.Format("{0}/releases/{1}", projectFolder, projectVersion);
            var deployFolder       = releaseFolder + "/deploy";
            var managedFilesFolder = projectFolder + "/managedfiles";
            var archivesFolder     = projectFolder + "/filearchives";

            Directory.CreateDirectory(deployFolder);
            Directory.CreateDirectory(managedFilesFolder);
            Directory.CreateDirectory(archivesFolder);

            string solutionDeployFolder = null;

            if (solutionName != null)
            {
                solutionDeployFolder = String.Format("{0}/RADS/solutions/{1}/releases/{2}/deploy", directory, solutionName, solutionVersion);
            }

            // Getting release manifest
            Console.WriteLine("Downloading manifest for project {0}, release {1}...", projectName, projectVersion);
            var currentProjectURL = String.Format("{0}/releases/{1}", projectsURL, projectVersion);

            webClient.DownloadFile(currentProjectURL + "/releasemanifest", releaseFolder + "/releasemanifest");
            var releaseManifest = new ReleaseManifestFile(releaseFolder + "/releasemanifest");

            // Downloading files
            var files = new List <ReleaseManifestFileEntry>();

            EnumerateManifestFolderFiles(releaseManifest.Project, files);
            files.Sort((x, y) => (x.Version.CompareTo(y.Version)));

            string currentArchiveVersion = null;
            RAF    currentRAF            = null;

            foreach (ReleaseManifestFileEntry file in files)
            {
                string fileFullPath = file.GetFullPath();
                string fileVersion  = GetReleaseString(file.Version);
                Console.Write("■ Downloading {0}/{1}", fileVersion, fileFullPath);
                bool compressed = false;
                var  fileURL    = Uri.EscapeUriString(String.Format("{0}/releases/{1}/files/{2}", projectsURL, fileVersion, fileFullPath));
                if (file.SizeCompressed > 0)
                {
                    fileURL   += ".compressed";
                    compressed = true;
                }

                byte[] fileData;
                try
                {
                    fileData = webClient.DownloadData(fileURL);
                    // Change deploy mode if specified
                    if (deployMode != null)
                    {
                        file.DeployMode = (ReleaseManifestFile.DeployMode)deployMode;
                    }

                    if (file.DeployMode == RAFCompressed || file.DeployMode == RAFRaw)
                    {
                        // File has to be put in a RAF
                        if (currentRAF == null || currentArchiveVersion != fileVersion)
                        {
                            currentRAF?.Save();
                            currentRAF?.Dispose();
                            currentArchiveVersion = fileVersion;
                            currentRAF            = new RAF(String.Format("{0}/{1}/Archive_1.raf", archivesFolder, fileVersion));
                        }
                        if (compressed)
                        {
                            currentRAF.AddFile(fileFullPath, file.DeployMode == RAFCompressed ? fileData : DecompressZlib(fileData), false);
                        }
                        else
                        {
                            currentRAF.AddFile(fileFullPath, fileData, file.DeployMode == RAFCompressed);
                        }
                    }
                    else if (file.DeployMode == Managed)
                    {
                        // File will be in managedfiles folder
                        var filePath = String.Format("{0}/{1}/{2}", managedFilesFolder, fileVersion, fileFullPath);
                        Directory.CreateDirectory(Path.GetDirectoryName(filePath));
                        File.WriteAllBytes(filePath, compressed ? DecompressZlib(fileData) : fileData);
                    }
                    else if (file.DeployMode == Deployed0 || file.DeployMode == Deployed4)
                    {
                        // File will be in deploy folder
                        var deployPath = String.Format("{0}/{1}", deployFolder, fileFullPath);
                        Directory.CreateDirectory(Path.GetDirectoryName(deployPath));
                        byte[] decompressedData = compressed ? DecompressZlib(fileData) : fileData;
                        File.WriteAllBytes(deployPath, decompressedData);
                        if (solutionDeployFolder != null && file.DeployMode == Deployed4)
                        {
                            // File will also be in solution folder
                            var solutionPath = String.Format("{0}/{1}", solutionDeployFolder, fileFullPath);
                            Directory.CreateDirectory(Path.GetDirectoryName(solutionPath));
                            File.WriteAllBytes(solutionPath, decompressedData);
                        }
                    }
                    Console.SetCursorPosition(0, Console.CursorTop);
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("■");
                }
                catch (Exception)
                {
                    Console.SetCursorPosition(0, Console.CursorTop);
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("■");
                }
                Console.ResetColor();
            }
            currentRAF?.Dispose();
            releaseManifest.Save();
            File.Create(releaseFolder + "/S_OK").Close();
        }