コード例 #1
0
        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();
            }
        }
コード例 #2
0
ファイル: CoopTreeId.cs プロジェクト: K07H/The-Forest
 float IPriorityCalculator.CalculateEventPriority(BoltConnection connection, Bolt.Event evnt)
 {
     return((float)((base.state.State != 2) ? 256 : 8192));
 }
コード例 #3
0
ファイル: BoltPlayerSetup.cs プロジェクト: K07H/The-Forest
 float IPriorityCalculator.CalculateEventPriority(BoltConnection connection, Bolt.Event evnt)
 {
     return(CoopUtils.CalculatePriorityFor(connection, base.entity, 1f, 1));
 }
コード例 #4
0
 float IPriorityCalculator.CalculateEventPriority(BoltConnection connection, Bolt.Event evnt)
 {
     return(CoopUtils.CalculatePriorityFor(connection, this.entity, this.MultiplayerPriority, 1));
 }