コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: Effect.cs プロジェクト: mctraveler/MineSharp
 protected override void Parse(EndianBinaryReader r)
 {
     EffectID  = (SoundEffects)r.ReadInt32();
     Position  = CoordInt.Read(r);
     SoundData = r.ReadInt32();
     SoundByte = r.ReadByte();
     //Debug.WriteLine(DebugPacket.Read(r));
     #if DEBUGPACKET
     if (EffectID.ToString() == ((int)EffectID).ToString())
     {
         throw new NotImplementedException(EffectID.ToString());
     }
     #endif
 }