public SpawnPoint(SpawnEntry entry, Region region) { m_spawns = new List<Unit>(); m_timer = new TimerEntry { Action = Spawn }; m_timer.Stop(); Region = region; SpawnEntry = entry; }
protected internal override void InitRegion() { base.InitRegion(); m_lastReset = DateTime.Now; m_timeoutTimer = new TimerEntry(OnTimeout); RegisterUpdatableLater(this); }
public Battleground() { if (HasQueue) { _queueTimer = new TimerEntry(dt => ProcessPendingPlayers()); RegisterUpdatable(_queueTimer); } _status = BattlegroundStatus.None; AddPlayersToBiggerTeam = AddPlayersToBiggerTeamDefault; _teams = new BattlegroundTeam[2]; _shutdownTimer = new TimerEntry(dt => Delete()); RegisterUpdatable(_shutdownTimer); }
protected internal override void InitMap() { base.InitMap(); var secs = difficulty.ResetTime; if (secs > 0) { // TODO: Set expiry time correctly //m_expiryTime = InstanceMgr. } m_lastReset = DateTime.Now; m_timeoutTimer = new TimerEntry(OnTimeout); RegisterUpdatableLater(this); // create InstanceSettings object settings = CreateSettings(); }
protected ArathiBase(ArathiBasin instance, GOEntry flagstand) { Instance = instance; // init timers CaptureTimer = new TimerEntry(dt => { Capture(); }); StartScoreTimer = new TimerEntry(dt => { GivesScore = true; }); Instance.RegisterUpdatableLater(StartScoreTimer); Instance.RegisterUpdatableLater(CaptureTimer); // TODO: flagstand? SpawnNeutral(); }
protected ArathiBase(ArathiBasin instance) { Instance = instance; // init timers CaptureTimer = new TimerEntry(dt => { Capture(); }); StartScoreTimer = new TimerEntry(dt => { GivesScore = true; }); Instance.RegisterUpdatableLater(StartScoreTimer); Instance.RegisterUpdatableLater(CaptureTimer); Names = new string[(int)ClientLocale.End]; AddSpawns(); SpawnNeutral(); }
/// <summary> /// Creates a new SpellCast for the given caster /// </summary> /// <param name="caster">The GameObject (in case of traps etc) or Unit casting</param> internal SpellCast(WorldObject caster) { SetCaster(caster); m_castTimer = new TimerEntry(Perform); }
public bool Equals(TimerEntry obj) { return(obj.IntervalMillis == this.IntervalMillis && object.Equals((object)obj.Action, (object)this.Action)); }
protected Unit() { Type |= ObjectTypes.Unit; // combat m_isInCombat = false; m_attackTimer = new TimerEntry(0.0f, 0.0f, CombatTick); CastSpeedFactor = 1f; ResetMechanicDefaults(); m_flying = m_waterWalk = m_hovering = m_featherFalling = 0; m_canMove = m_canInteract = m_canHarm = m_canCastSpells = true; }
public bool Equals(TimerEntry obj) { // needs to be improved return obj.Interval == Interval && Equals(obj.Action, Action); }
public bool Equals(TimerEntry obj) { // needs to be improved return(obj.IntervalMillis == IntervalMillis && Equals(obj.Action, Action)); }
/// <summary> /// Initializes this AreaAura with the given controller. /// If no controller is given, the AreaAura controls timing and disposal itself. /// </summary> /// <param name="controller">A controller controls timing and disposal of this AreaAura</param> /// <param name="noTimeout">whether the Aura should not expire (ignore the Spell's duration).</param> public void Start(ITickTimer controller, bool noTimeout) { if (m_radius == 0) { m_radius = 5; } if (m_timer == null) { m_controller = controller; if (m_controller == null) { if (m_params != null) { m_timer = new TimerEntry(m_params.StartDelay, m_params.Amplitude != 0 ? m_params.Amplitude : DefaultAmplitude, RevalidateTargetsAndApply); } else { m_timer = new TimerEntry(DefaultAmplitude, DefaultAmplitude, RevalidateTargetsAndApply); } m_timer.Start(); } if (noTimeout) { m_duration = int.MaxValue; } else { m_duration = m_spell.GetDuration(m_casterInfo) / 1000f; if (m_duration < 1) { m_duration = int.MaxValue; } } } }
protected NetworkStatistics() { m_consumerTimer = new TimerEntry(0f, 0f, ConsumerCallback); m_queuedStats = new SynchronizedQueue<PacketInfo>(); }
private void SetPvPResetTimer(bool overridden = false) { if (PvPEndTime == null) PvPEndTime = new TimerEntry(dt => OnPvPTimerEnded()); if (!PvPEndTime.IsRunning || overridden) PvPEndTime.Start(300000); IsPvPTimerActive = true; }
/// <summary> /// Called when the battle starts (perparation ends now) /// </summary> protected override void OnStart() { base.OnStart(); Characters.SendSystemMessage(DefaultAddonLocalizer.Instance.GetTranslations(AddonMsgKey.ABOnStart)); _allianceDoor.State = GameObjectState.Disabled; _hordeDoor.State = GameObjectState.Disabled; timerUpdate = CallPeriodically(BattleUpdateDelayMillis, Update); }
/// <summary> /// Creates a new character and loads all required character data from the database /// </summary> /// <param name="acc">The account the character is associated with</param> /// <param name="record">The name of the character to load</param> /// <param name="client">The client to associate with this character</param> internal protected void Create(RealmAccount acc, CharacterRecord record, IRealmClient client) { client.ActiveCharacter = this; acc.ActiveCharacter = this; Type |= ObjectTypes.Player; ChatChannels = new List<ChatChannel>(); m_logoutTimer = new TimerEntry(0.0f, DefaultLogoutDelay, totalTime => FinishLogout()); Account = acc; m_client = client; m_record = record; EntityId = EntityId.GetPlayerId(m_record.EntityLowId); m_name = m_record.Name; Archetype = ArchetypeMgr.GetArchetype(record.Race, record.Class); MainWeapon = GenericWeapon.Fists; PowerType = m_archetype.Class.PowerType; StandState = StandState.Sit; Money = (uint)m_record.Money; Outfit = m_record.Outfit; //ScaleX = m_archetype.Race.Scale; ScaleX = 1; Gender = m_record.Gender; Skin = m_record.Skin; Facial = m_record.Face; HairStyle = m_record.HairStyle; HairColor = m_record.HairColor; FacialHair = m_record.FacialHair; UnitFlags = UnitFlags.PlayerControlled; XP = m_record.Xp; RestXp = m_record.RestXp; Level = m_record.Level; NextLevelXP = XpGenerator.GetXpForlevel(m_record.Level + 1); MaxLevel = RealmServerConfiguration.MaxCharacterLevel; RestState = RestState.Normal; Orientation = m_record.Orientation; m_bindLocation = new ZoneWorldLocation( m_record.BindRegion, new Vector3(m_record.BindX, m_record.BindY, m_record.BindZ), m_record.BindZone); PvPRank = 1; YieldsXpOrHonor = true; foreach (var school in WCellDef.AllDamageSchools) { SetInt32(PlayerFields.MOD_DAMAGE_DONE_PCT + (int)school, 1); } SetFloat(PlayerFields.DODGE_PERCENTAGE, 1.0f); // Auras m_auras = new PlayerAuraCollection(this); // spells PlayerSpellCollection spells; if (!record.JustCreated && SpellHandler.PlayerSpellCollections.TryGetValue(EntityId.Low, out spells)) { SpellHandler.PlayerSpellCollections.Remove(EntityId.Low); m_spells = spells; ((PlayerSpellCollection)m_spells).OnReconnectOwner(this); } else { m_spells = new PlayerSpellCollection(this); } // factions WatchedFaction = m_record.WatchedFaction; Faction = FactionMgr.ByRace[(uint)record.Race]; m_reputations = new ReputationCollection(this); // skills m_skills = new SkillCollection(this); // talents m_talents = new TalentCollection(this); // Items m_inventory = new PlayerInventory(this); m_mailAccount = new MailAccount(this); m_questLog = new QuestLog(this); // Talents m_record.SpecProfile = SpecProfile.NewSpecProfile(this); FreeTalentPoints = m_record.FreeTalentPoints; // tutorial flags TutorialFlags = new TutorialFlags(m_record.TutorialFlags); // Make sure client and internal state is updated with combat base values UnitUpdates.UpdateSpellCritChance(this); // Mask of activated TaxiNodes m_taxiNodeMask = new TaxiNodeMask(); PowerCostMultiplier = 1f; m_lastPlayTimeUpdate = DateTime.Now; MoveControl.Mover = this; MoveControl.CanControl = true; BaseHealth = m_record.BaseHealth; SetBasePowerDontUpdate(m_record.BasePower); SetBaseStat(StatType.Strength, m_record.BaseStrength); SetBaseStat(StatType.Stamina, m_record.BaseStamina); SetBaseStat(StatType.Spirit, m_record.BaseSpirit); SetBaseStat(StatType.Intellect, m_record.BaseIntellect); SetBaseStat(StatType.Agility, m_record.BaseAgility); CanMelee = true; // basic setup if (record.JustCreated) { Power = PowerType == PowerType.Rage ? 0 : MaxPower; SetInt32(UnitFields.HEALTH, MaxHealth); } else { Power = m_record.Power; SetInt32(UnitFields.HEALTH, m_record.Health); } }
/// <summary> /// Creates a recyclable SpellCast. /// </summary> private SpellCast() { m_castTimer = new TimerEntry(Perform); Targets = new HashSet<WorldObject>(); }
/// <summary> /// Starts to clean things up once the BG is over. /// Might be called right before the BG is disposed. /// </summary> protected void FinalizeBattleground(bool disposing) { EnsureContext(); if (_shutdownTimer != null) { _shutdownTimer = null; OnFinish(disposing); if (_instanceQueue != null) { _instanceQueue.Dispose(); _instanceQueue = null; } if (_parentQueue != null) { _parentQueue.OnRemove(this); } } }
private void StopDecayTimer() { if (m_decayTimer != null) { m_decayTimer.Stop(); m_decayTimer = null; } }
private void LoadDeathState() { if (m_record.CorpseX != null) { // we were dead and released the corpse var map = World.GetMap(m_record.CorpseMap); if (map != null) { m_corpse = SpawnCorpse(false, false, map, new Vector3(m_record.CorpseX.Value, m_record.CorpseY, m_record.CorpseZ), m_record.CorpseO); BecomeGhost(); } else { // can't spawn corpse -> revive if (log.IsWarnEnabled) { log.Warn("Player {0}'s Corpse was spawned in invalid map: {1}", this, m_record.CorpseMap); } } } else if (m_record.Health == 0) { // we were dead and did not release yet var diff = DateTime.Now.Subtract(m_record.LastDeathTime).ToMilliSecondsInt() + Corpse.AutoReleaseDelay; m_corpseReleaseTimer = new TimerEntry(dt => ReleaseCorpse()); if (diff > 0) { // mark dead and start release timer MarkDead(); m_corpseReleaseTimer.Start(diff, 0); } else { // auto release ReleaseCorpse(); } } else { // we are alive and kicking } }
internal void StartTimer() { m_timer = new TimerEntry(AuthenticationStoreSeconds, 0f, dl => Remove()); m_timer.Start(); AuthenticationServer.Instance.RegisterUpdatable(m_timer); }
protected override void OnDeath() { m_record.LastDeathTime = DateTime.Now; MarkDead(); Achievements.CheckPossibleAchievementUpdates(AchievementCriteriaType.DeathAtMap, (uint)MapId, 1); Achievements.CheckPossibleAchievementUpdates(AchievementCriteriaType.DeathInDungeon, (uint)MapId, 1); // start release timer m_corpseReleaseTimer = new TimerEntry(dt => ReleaseCorpse()); m_corpseReleaseTimer.Start(Corpse.AutoReleaseDelay, 0); }
/// <summary> /// Creates a new character and loads all required character data from the database /// </summary> /// <param name="acc">The account the character is associated with</param> /// <param name="record">The name of the character to load</param> /// <param name="client">The client to associate with this character</param> internal protected void Create(RealmAccount acc, CharacterRecord record, IRealmClient client) { client.ActiveCharacter = this; acc.ActiveCharacter = this; Type |= ObjectTypes.Player; ChatChannels = new List<ChatChannel>(5); m_logoutTimer = new TimerEntry(0, DefaultLogoutDelayMillis, totalTime => FinishLogout()); Account = acc; m_client = client; m_record = record; EntityId = EntityId.GetPlayerId(m_record.EntityLowId); m_name = m_record.Name; Archetype = ArchetypeMgr.GetArchetype(record.Race, record.Class); MainWeapon = GenericWeapon.Fists; PowerType = m_archetype.Class.DefaultPowerType; StandState = StandState.Sit; Money = (uint) m_record.Money; Outfit = m_record.Outfit; //ScaleX = m_archetype.Race.Scale; ScaleX = 1; Gender = m_record.Gender; Skin = m_record.Skin; Facial = m_record.Face; HairStyle = m_record.HairStyle; HairColor = m_record.HairColor; FacialHair = m_record.FacialHair; UnitFlags = UnitFlags.PlayerControlled; Experience = m_record.Xp; RestXp = m_record.RestXp; SetInt32(UnitFields.LEVEL, m_record.Level); // cannot use Level property, since it will trigger certain events that we don't want triggered NextLevelXP = XpGenerator.GetXpForlevel(m_record.Level + 1); MaxLevel = RealmServerConfiguration.MaxCharacterLevel; RestState = RestState.Normal; Orientation = m_record.Orientation; m_bindLocation = new WorldZoneLocation( m_record.BindMap, new Vector3(m_record.BindX, m_record.BindY, m_record.BindZ), m_record.BindZone); PvPRank = 1; YieldsXpOrHonor = true; foreach (var school in WCellDef.AllDamageSchools) { SetFloat(PlayerFields.MOD_DAMAGE_DONE_PCT + (int) school, 1); } SetFloat(PlayerFields.DODGE_PERCENTAGE, 1.0f); // Auras m_auras = new PlayerAuraCollection(this); // spells m_spells = PlayerSpellCollection.Obtain(this); // factions WatchedFaction = m_record.WatchedFaction; Faction = FactionMgr.ByRace[(uint) record.Race]; m_reputations = new ReputationCollection(this); // skills m_skills = new SkillCollection(this); // talents m_talents = new PlayerTalentCollection(this); // achievements m_achievements = new AchievementCollection(this); // Items m_inventory = new PlayerInventory(this); m_mailAccount = new MailAccount(this); m_questLog = new QuestLog(this); // tutorial flags TutorialFlags = new TutorialFlags(m_record.TutorialFlags); // Make sure client and internal state is updated with combat base values UnitUpdates.UpdateSpellCritChance(this); // Mask of activated TaxiNodes m_taxiNodeMask = new TaxiNodeMask(); PowerCostMultiplier = 1f; m_lastPlayTimeUpdate = DateTime.Now; MoveControl.Mover = this; MoveControl.CanControl = true; CanMelee = true; SpeedFactor = DefaultSpeedFactor; // basic setup if (record.JustCreated) { ModStatsForLevel(m_record.Level); BasePower = RegenerationFormulas.GetPowerForLevel(this); } else { BaseHealth = m_record.BaseHealth; SetBasePowerDontUpdate(m_record.BasePower); SetBaseStat(StatType.Strength, m_record.BaseStrength); SetBaseStat(StatType.Stamina, m_record.BaseStamina); SetBaseStat(StatType.Spirit, m_record.BaseSpirit); SetBaseStat(StatType.Intellect, m_record.BaseIntellect); SetBaseStat(StatType.Agility, m_record.BaseAgility); Power = m_record.Power; SetInt32(UnitFields.HEALTH, m_record.Health); } }
protected internal override void DeleteNow() { if (m_linkedTrap != null) { m_linkedTrap.DeleteNow(); } if (Respawns) { // TODO: Finish respawning OnDeleted(); m_respawnTimer = new TimerEntry(); } else { base.DeleteNow(); } }
internal void StartTimer() { m_timer = new TimerEntry(AuthenticationStoreMillis, 0, dl => Remove()); m_timer.Start(); AuthenticationServer.IOQueue.RegisterUpdatable(m_timer); }
/// <summary> /// Initializes this AreaAura with the given controller. /// If no controller is given, the AreaAura controls timing and disposal itself. /// </summary> /// <param name="controller">A controller controls timing and disposal of this AreaAura</param> /// <param name="noTimeout">whether the Aura should not expire (ignore the Spell's duration).</param> public void Start(ITickTimer controller, bool noTimeout) { if (m_IsActivated) { return; } if (m_radius == 0) { m_radius = 5; } m_controller = controller; if (m_controller == null || m_controller.MaxTicks == 1) { if (m_params != null) { m_timer = new TimerEntry(m_params.StartDelay, m_params.Amplitude != 0 ? m_params.Amplitude : DefaultAmplitude, RevalidateTargetsAndApply); } else { m_timer = new TimerEntry(DefaultAmplitude, DefaultAmplitude, RevalidateTargetsAndApply); } } if (noTimeout) { m_duration = int.MaxValue; } else { m_duration = m_spell.GetDuration(m_CasterReference); if (m_duration < 1) { m_duration = int.MaxValue; } } IsActivated = true; }
protected bool Start() { try { IsCached = AuthServerConfiguration.CacheAccounts; //I would have liked this to be a readonly field but it must be //initialised here otherwise in the ctor AccountReloadIntervalMs //wont have been init'd which would mean we cant customise the timer easily _accountsReloadTimer = new TimerEntry(0, AccountReloadIntervalMs, delay => { if (Instance.IsCached) Instance.Resync(); }); _accountsReloadTimer.Start(); AuthenticationServer.IOQueue.RegisterUpdatable(_accountsReloadTimer); if (Count == 0) { log.Info("Detected empty Account-database."); //if (!DoesAccountExist("Administrator")) //{ // CreateAccount("Administrator", DefaultAdminPW, null, RoleGroupInfo.HighestRole.Name, ClientId.Wotlk); // log.Warn("Created new Account \"Administrator\" with same password."); //} } } catch (Exception e) { AuthDBMgr.OnDBError(e); } return true; }
/// <summary> /// Can only work with unit casters /// </summary> private SpellChannel() { m_timer = new TimerEntry(Tick); }
protected override void OnDeath() { m_record.LastDeathTime = DateTime.Now; MarkDead(); // start release timer m_corpseReleaseTimer = new TimerEntry(dt => ReleaseCorpse()); m_corpseReleaseTimer.Start(Corpse.AutoReleaseDelay, 0); }
internal void OnTaxiStart() { UnitFlags |= UnitFlags.Influenced; IsOnTaxi = true; //taxi interpolation timer taxiTime = 0; m_TaxiMovementTimer = new TimerEntry(0, TaxiMgr.InterpolationDelay, TaxiTimerCallback); m_TaxiMovementTimer.Start(); IsEvading = true; }
/// <summary> /// Creates a recyclable SpellCast. /// </summary> /// <param name="caster">The GameObject (in case of traps etc) or Unit casting</param> private SpellCast() { m_castTimer = new TimerEntry(Perform); }
/// <summary> /// Initializes the regeneration-timers. /// Gets called automatically for default NPCs. /// </summary> public void InitializeRegeneration() { this.UpdatePowerRegen(); m_RegenerationDelay = RegenTickDelay; m_regenTimer = new TimerEntry(0.0f, m_RegenerationDelay, Regen); m_regenTimer.Start(); m_regenerates = true; }
public bool Equals(TimerEntry obj) { return(obj.IntervalMillis == IntervalMillis && Equals(obj.Action, Action)); }