public bool StartCastAtPos(Unit instigator, ushort abilityID, Point3D worldPos, ushort zoneId, byte castSequence) { if (PreventCasting) { if (_Owner is Player) { Player owner = _Owner as Player; owner?.SendClientMessage("A developer has disabled all abilities.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR); } return(false); } // Allow only interruption of channeled skills of a different ID to the skill being used if (IsCasting() && (!_abilityProcessor.IsChannelling || _abilityProcessor.AbInfo.Entry == abilityID)) { return(false); } AbilityInfo abInfo = AbilityMgr.GetAbilityInfo(abilityID); if (abInfo == null || (abInfo.ConstantInfo.Origin != AbilityOrigin.AO_ITEM && !IsValidAbility(abInfo))) { return(false); } try { if (AbilityMgr.HasCommandsFor(abilityID) || abInfo.ConstantInfo.ChannelID != 0) { if (_abilityProcessor == null) { _abilityProcessor = new AbilityProcessor(_unitOwner, this); } abInfo.Instigator = instigator; if (!_abilityProcessor.HasInfo()) { _abilityProcessor.StartAbilityAtPos(abInfo, castSequence, worldPos, zoneId); } return(true); } if (_Owner is Player) { var owner = _Owner as Player; owner?.SendClientMessage(abilityID + " " + AbilityMgr.GetAbilityNameFor(abilityID) + " has no implementation.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR); } return(false); } catch (Exception e) { if (_Owner is Player) { var owner = _Owner as Player; owner?.SendClientMessage(abilityID + " " + AbilityMgr.GetAbilityNameFor(abilityID) + " threw an unhandled " + e.GetType().Name + " from " + e.TargetSite + "."); } return(false); } }
public bool StartCast(Unit instigator, ushort abilityId, byte castSequence, byte cooldownGroup = 0, byte overrideAbilityLevel = 0, bool enemyVisible = true, bool friendlyVisible = true, bool moving = false) { if (PreventCasting) { if (_Owner is Player) { (_Owner as Player)?.SendClientMessage("A developer has disabled all abilities.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR); } return(false); } // Allow only interruption of channeled skills of a different ID to the skill being used if (IsCasting() && (!_abilityProcessor.IsChannelling || _abilityProcessor.AbInfo.Entry == abilityId)) { return(false); } AbilityInfo abInfo = AbilityMgr.GetAbilityInfo(abilityId); if (abInfo == null || (abInfo.ConstantInfo.Origin != AbilityOrigin.AO_ITEM && !IsValidAbility(abInfo))) { return(false); } //Fix so that WE/WH cant use all their 3 openers at the same time, this is in conjunction with whats in AbilityProcessor if (_Owner is Player) { if ((_Owner as Player).StealthLevel == 0 && (abilityId == 9406 || abilityId == 9401 || abilityId == 9411 || abilityId == 8091 || abilityId == 8096 || abilityId == 8098)) { return(false); } } try { if (AbilityMgr.HasCommandsFor(abilityId) || abInfo.ConstantInfo.ChannelID != 0) { if (_abilityProcessor == null) { _abilityProcessor = new AbilityProcessor(_unitOwner, this); } abInfo.Instigator = instigator; abInfo.Level = overrideAbilityLevel; return(_abilityProcessor.StartAbility(abInfo, castSequence, cooldownGroup, enemyVisible, friendlyVisible, moving)); } if (_Owner is Player) { Player owner = _Owner as Player; owner?.SendClientMessage(abilityId + " " + AbilityMgr.GetAbilityNameFor(abilityId) + " has no implementation.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR); } return(false); } catch (Exception e) { if (_Owner is Player) { (_Owner as Player)?.SendClientMessage(abilityId + " " + AbilityMgr.GetAbilityNameFor(abilityId) + " threw an unhandled " + e.GetType().Name + " from " + e.TargetSite + "."); } Log.Error("Ability System", e.ToString()); return(false); } }