Exemple #1
0
        public static void RegisterEvents()
        {
            var standEntry = GOMgr.GetEntry(SilverwingFlagStandId) as GOFlagStandEntry;

            standEntry.Side = BattlegroundSide.Alliance;
            var droppedEntry = GOMgr.GetEntry(SilverwingFlagId) as GOFlagDropEntry;

            droppedEntry.Side = BattlegroundSide.Alliance;

            standEntry        = GOMgr.GetEntry(WarsongClanFlagStandId) as GOFlagStandEntry;
            standEntry.Side   = BattlegroundSide.Horde;
            droppedEntry      = GOMgr.GetEntry(WarsongFlagId) as GOFlagDropEntry;
            droppedEntry.Side = BattlegroundSide.Horde;

            // register AreaTrigger capture events
            AreaTrigger hordeFlagAT    = AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchHordeFlagSpawn);
            AreaTrigger allianceFlagAT = AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchAllianceFlagSpawn);

            hordeFlagAT.Triggered    += HordeCaptureTriggered;
            allianceFlagAT.Triggered += AllianceCaptureTriggered;

            GOMgr.GetEntry(WarsongClanFlagStandId).Used += HandleFlagStandUsed;
            GOMgr.GetEntry(SilverwingFlagStandId).Used  += HandleFlagStandUsed;

            GOMgr.GetEntry(WarsongFlagId).Used    += HandleDroppedFlagUsed;
            GOMgr.GetEntry(SilverwingFlagId).Used += HandleDroppedFlagUsed;
        }
        public static void InitNPCs()
        {
            // both big bosses are invul at first
            arthasMirrorEntry           = NPCMgr.GetEntry(29280u);
            arthasMirrorEntry.MinLevel  = arthasMirrorEntry.MaxLevel = 83;
            arthasMirrorEntry.UnitFlags = UnitFlags.SelectableNotAttackable;

            svalaEntry            = NPCMgr.GetEntry(29281u);
            svalaEntry.UnitFlags  = UnitFlags.SelectableNotAttackable;
            svalaEntry.Activated += svala =>
            {
                var instance = svala.Map as UtgardePinnacle;
                if (instance != null)
                {
                    instance.PrepareEncounter(svala);
                }
            };

            // TODO: Set the emotestate of the sitting audience correctly and make them idle until the convo is over
            var observanceTrigger = AreaTriggerMgr.GetTrigger(AreaTriggerId.UtgardePinnacleObservanceHall);

            if (observanceTrigger != null)
            {
                observanceTrigger.Triggered += OnObservanceHallTriggered;
            }
        }
Exemple #3
0
 private void RegisterEvents()
 {
     AreaTrigger blacksmithAT = AreaTriggerMgr.GetTrigger(AreaTriggerId.ArathiBasinBlackSmith);
     AreaTrigger stablesAT    = AreaTriggerMgr.GetTrigger(AreaTriggerId.ArathiBasinStables);
     AreaTrigger farmAT       = AreaTriggerMgr.GetTrigger(AreaTriggerId.ArathiBasinFarm);
     AreaTrigger lumberMillAT = AreaTriggerMgr.GetTrigger(AreaTriggerId.ArathiBasinLumberMill);
     AreaTrigger goldMineAT   = AreaTriggerMgr.GetTrigger(AreaTriggerId.ArathiBasinGoldMine);
 }
        public static void HandleAreaTrigger(IRealmClient client, RealmPacketIn packet)
        {
            var id  = packet.ReadUInt32();
            var chr = client.ActiveCharacter;

            if (chr.IsAlive)
            {
                var trigger = AreaTriggerMgr.GetTrigger(id);
                if (trigger != null)
                {
                    trigger.Trigger(chr);
                }
            }
        }
Exemple #5
0
        public static void HandleAreaTrigger(IRealmClient client, RealmPacketIn packet)
        {
            uint      id = packet.ReadUInt32();
            Character activeCharacter = client.ActiveCharacter;

            if (!activeCharacter.IsAlive)
            {
                return;
            }
            AreaTrigger trigger = AreaTriggerMgr.GetTrigger(id);

            if (trigger == null)
            {
                return;
            }
            trigger.Trigger(activeCharacter);
        }
Exemple #6
0
        /// <summary>
        /// Register's the powerup AT triggers to cast the spell and remove the GO.
        /// </summary>
        private void RegisterPowerupEvents()
        {
            AreaTrigger allianceBerserker =
                AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchAllianceElexirOfBerserkSpawn);
            AreaTrigger allianceFood =
                AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchAllianceElexirOfRegenerationSpawn);
            AreaTrigger allianceSpeed = AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchAllianceElexirOfSpeedSpawn);

            AreaTrigger hordeBerserker = AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchHordeElexirOfBerserkSpawn);
            AreaTrigger hordeFood      = AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchHordeElexirOfRegenerationSpawn);
            AreaTrigger hordeSpeed     = AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchHordeElexirOfSpeedSpawn);

            allianceBerserker.Triggered += (at, unit) => HandlePowerUp(unit, SpellId.None, _allianceBerserkerBuff, SpawnAllianceBerserkerBuff);
            allianceFood.Triggered      += (at, unit) => HandlePowerUp(unit, SpellId.None, _allianceFoodBuff, SpawnAllianceFoodBuff);
            allianceSpeed.Triggered     += (at, unit) => HandlePowerUp(unit, SpellId.Speed_5, _allianceSpeedBuff, SpawnAllianceSpeedBuff);

            hordeBerserker.Triggered += (at, unit) => HandlePowerUp(unit, SpellId.None, _hordeBerserkerBuff, SpawnHordeBerserkerBuff);
            hordeFood.Triggered      += (at, unit) => HandlePowerUp(unit, SpellId.None, _hordeFoodBuff, SpawnHordeFoodBuff);
            hordeSpeed.Triggered     += (at, unit) => HandlePowerUp(unit, SpellId.Speed_5, _hordeSpeedBuff, SpawnHordeSpeedBuff);
        }
Exemple #7
0
        /// <summary>
        /// Loads this Character from DB when logging in.
        /// </summary>
        /// <remarks>Requires IO-Context.</remarks>
        internal protected void Load()
        {
            var nativeModel = m_archetype.Race.GetModel(m_record.Gender);

            NativeDisplayId = nativeModel.DisplayId;
            var model = nativeModel;

            if (m_record.DisplayId != model.DisplayId)
            {
                model = UnitMgr.GetModelInfo(m_record.DisplayId) ?? nativeModel;
            }
            Model = model;

            // set FreeTalentPoints silently
            UpdateFreeTalentPointsSilently(0);
            if (m_record.JustCreated)
            {
                // newly created Character
                SpecProfiles = new[] { SpecProfile.NewSpecProfile(this, 0) };

                if (m_zone != null)
                {
                    SetZoneExplored(m_zone.Template, true);
                }

                //m_record.FreeTalentPoints = 0;

                // Honor and Arena
                m_record.KillsTotal             = 0u;
                m_record.HonorToday             = 0u;
                m_record.HonorYesterday         = 0u;
                m_record.LifetimeHonorableKills = 0u;
                m_record.HonorPoints            = 0u;
                m_record.ArenaPoints            = 0u;
            }
            else
            {
                // existing Character
                try
                {
                    //Set Playerfields for glyphs on load
                    InitGlyphsForLevel();
                    // load & validate SpecProfiles
                    SpecProfiles = SpecProfile.LoadAllOfCharacter(this);
                    if (SpecProfiles.Length == 0)
                    {
                        log.Warn("Character had no SpecProfiles: {0}", this);
                        SpecProfiles = new[] { SpecProfile.NewSpecProfile(this, 0) };
                    }
                    if (m_record.CurrentSpecIndex >= SpecProfiles.Length)
                    {
                        log.Warn("Character had invalid CurrentSpecIndex: {0} ({1})", this, m_record.CurrentSpecIndex);
                        m_record.CurrentSpecIndex = 0;
                    }

                    // load all the rest
                    m_achievements.Load();
                    ((PlayerSpellCollection)m_spells).LoadSpellsAndTalents();
                    ((PlayerSpellCollection)m_spells).LoadCooldowns();
                    m_skills.Load();
                    m_mailAccount.Load();
                    m_reputations.Load();
                    var auras = AuraRecord.LoadAuraRecords(EntityId.Low);
                    AddPostUpdateMessage(() => m_auras.InitializeAuras(auras));

                    if (QuestMgr.Loaded)
                    {
                        LoadQuests();
                    }

                    if (m_record.FinishedQuests != null)
                    {
                        m_questLog.FinishedQuests.AddRange(m_record.FinishedQuests);
                    }
                }
                catch (Exception e)
                {
                    RealmDBMgr.OnDBError(e);
                    throw new Exception(string.Format("Failed to load Character \"{0}\" for Client: {1}", this, Client), e);
                }

                SetExploredZones();

                //Add existing talents to the character
                ((PlayerSpellCollection)m_spells).PlayerInitialize();

                // calculate amount of spent talent points per tree
                m_talents.CalcSpentTalentPoints();

                // update RestState
                if (m_record.RestTriggerId != 0 &&
                    (m_restTrigger = AreaTriggerMgr.GetTrigger((uint)m_record.RestTriggerId)) != null)
                {
                    RestState = RestState.Resting;
                }

                if (m_record.LastLogout != null)
                {
                    var now = DateTime.Now;
                    RestXp += RestGenerator.GetRestXp(now - m_record.LastLogout.Value, this);

                    m_lastRestUpdate = now;
                }
                else
                {
                    m_lastRestUpdate = DateTime.Now;
                }

                m_taxiNodeMask.Mask = m_record.TaxiMask;

                // Honor and Arena
                KillsTotal             = m_record.KillsTotal;
                HonorToday             = m_record.HonorToday;
                HonorYesterday         = m_record.HonorYesterday;
                LifetimeHonorableKills = m_record.LifetimeHonorableKills;
                HonorPoints            = m_record.HonorPoints;
                ArenaPoints            = m_record.ArenaPoints;
            }

            // Set FreeTalentPoints, after SpecProfile was loaded
            var freePointsForLevel = m_talents.GetFreeTalentPointsForLevel(m_record.Level);

            m_talents.UpdateFreeTalentPointsSilently(freePointsForLevel);

            // Load pets (if any)
            LoadPets();

            //foreach (var skill in m_skills)
            //{
            //    if (skill.SkillLine.Category == SkillCategory.ArmorProficiency) {
            //        CharacterHandler.SendProfiency(m_client, ItemClass.Armor, (uint)skill.SkillLine.Id);
            //    }
            //}

            // this prevents a the Char from re-sending a value update when being pushed to world AFTER creation
            ResetUpdateInfo();
        }