private void HandleSpellCast(Event request, int spellId, MovementFlags movementFlags, Vector3?destination = null) { Player caster = World.FindPlayer(request.RaisedBy); SpellCastRequestAnswerEvent spellCastAnswer = request.FromSelf ? SpellCastRequestAnswerEvent.Create(GlobalTargets.OnlyServer) : SpellCastRequestAnswerEvent.Create(request.RaisedBy); spellCastAnswer.SpellId = spellId; if (caster == null) { spellCastAnswer.Result = (int)SpellCastResult.CasterNotExists; spellCastAnswer.Send(); return; } if (!balance.SpellInfosById.TryGetValue(spellId, out SpellInfo spellInfo)) { spellCastAnswer.Result = (int)SpellCastResult.SpellUnavailable; spellCastAnswer.Send(); return; } SpellCastingOptions options = destination.HasValue ? new SpellCastingOptions(new SpellExplicitTargets { Destination = destination.Value }) : new SpellCastingOptions(movementFlags: movementFlags); SpellCastResult castResult = caster.Spells.CastSpell(spellInfo, options); if (castResult != SpellCastResult.Success) { spellCastAnswer.Result = (int)castResult; spellCastAnswer.Send(); } }
float IPriorityCalculator.CalculateEventPriority(BoltConnection connection, Bolt.Event evnt) { return((float)((base.state.State != 2) ? 256 : 8192)); }
float IPriorityCalculator.CalculateEventPriority(BoltConnection connection, Bolt.Event evnt) { return(CoopUtils.CalculatePriorityFor(connection, base.entity, 1f, 1)); }
float IPriorityCalculator.CalculateEventPriority(BoltConnection connection, Bolt.Event evnt) { return(CoopUtils.CalculatePriorityFor(connection, this.entity, this.MultiplayerPriority, 1)); }