public static void InvokeEffect(EffectID effectID, LocatedEntity creature, object source, InvokeMode invokeMode, EffectAction action, EffectExt ext) { if (effectID == EffectID.eid_None) { return; } try { if (creature != null) { GameEvent @event = new GameEvent(GameSpace.Instance, null); @event.CLSID = (int)effectID; @event.SetPos(creature.PosX, creature.PosY); GlobalVars.nwrWin.DoEvent(EventID.event_EffectSound, null, null, @event); @event.Dispose(); } ItemState state; if (source != null && source is Item) { state = ((Item)source).State; } else { state = ItemState.is_Normal; } bool valid = (ext == null || ext.Valid); if (valid) { IEffectProc proc = EffectsData.dbEffectProcs[(int)effectID].Proc; if (proc != null) { proc.Invoke(effectID, (NWCreature)creature, source, state, invokeMode, ext); } } } catch (Exception ex) { //EffectsData.dbEffects[(int)effectID] string msg = "Effect.invokeEffect(): " + effectID.ToString(); if (creature != null) { msg = msg + "/" + ((NWCreature)creature).Entry.Sign; } if (source != null && source is Item) { msg = msg + "/" + ((Item)source).Entry.Sign; } msg = msg + ", " + ex.Message; Logger.Write(msg); } }
public static bool InitParams(EffectID effectID, LocatedEntity creature, object source, InvokeMode invokeMode, ref EffectExt refExt) { if (refExt == null) { refExt = new EffectExt(); } refExt.ReqParams = EffectsData.dbEffects[(int)effectID].ReqParams; ICheckProc proc = EffectsData.dbEffectProcs[(int)effectID].Check; if (proc != null) { proc.Invoke(effectID, (NWCreature)creature, source, invokeMode, refExt); } return(refExt.Valid); }