Exemplo n.º 1
0
        private PCCustomEffect RunPCCustomEffectProcess(NWPlayer oPC, PCCustomEffect effect)
        {
            NWCreature caster = oPC;

            if (!string.IsNullOrWhiteSpace(effect.CasterNWNObjectID))
            {
                var obj = _nwnxObject.StringToObject(effect.CasterNWNObjectID);
                if (obj.IsValid)
                {
                    caster = obj.Object;
                }
            }

            if (effect.Ticks > 0)
            {
                effect.Ticks = effect.Ticks - 1;
            }

            if (effect.Ticks == 0)
            {
                return(null);
            }
            var customEffect = _data.Get <Data.Entity.CustomEffect>(effect.CustomEffectID);

            if (!string.IsNullOrWhiteSpace(customEffect.ContinueMessage) &&
                effect.Ticks % 6 == 0) // Only show the message once every six seconds
            {
                oPC.SendMessage(customEffect.ContinueMessage);
            }

            App.ResolveByInterface <ICustomEffect>("CustomEffect." + customEffect.ScriptHandler, (handler) =>
            {
                handler?.Tick(caster, oPC, effect.Ticks, effect.EffectiveLevel, effect.Data);
            });

            return(effect);
        }
Exemplo n.º 2
0
        private NWObject GetEventDataObject(string tag)
        {
            string data = GetEventDataString(tag);

            return(_nwnxObject.StringToObject(data));
        }