コード例 #1
0
        protected void OnSpellCastInterrupted(InterruptCastEventArgs ice)
        {
            EventHandler<InterruptCastEventArgs> handler = SpellCastInterrupted;

            if (handler != null)
                handler(this, ice);
        }
コード例 #2
0
        void Mob_SpellCastInterrupted(object sender, InterruptCastEventArgs ice)
        {
            ZonePlayer zp = sender as ZonePlayer;   // a player trigger this event?
            if (zp != null) {
                // Send the client a packet
                InterruptCast ic = new InterruptCast() { SpawnId = (uint)zp.ID, MessageId =  (uint)ice.Message};
                EQRawApplicationPacket icPacket = new EQRawApplicationPacket(AppOpCode.InterruptCast, zp.Client.IPEndPoint, ic.Serialize());
                _zoneSvr.QueuePacketToClient(zp.Client, icPacket, true, ZoneConnectionState.All);

                zp.SendSpellBarEnable(ice.SpellId);
            }

            // Now notify people in the area

            // First determine the message they should be sent
            MessageStrings othersMsg = MessageStrings.INTERRUPT_SPELL_OTHER;
            switch (ice.Message) {
                case MessageStrings.SPELL_FIZZLE:
                    othersMsg = MessageStrings.SPELL_FIZZLE_OTHER;
                    break;
                case MessageStrings.MISS_NOTE:
                    othersMsg = MessageStrings.MISSED_NOTE_OTHER;
                    break;
                case MessageStrings.SONG_ENDS_ABRUPTLY:
                    othersMsg = MessageStrings.SONG_ENDS_ABRUPTLY_OTHER;
                    break;
                case MessageStrings.SONG_ENDS:
                    othersMsg = MessageStrings.SONG_ENDS_OTHER;
                    break;
            }

            Mob m = sender as Mob;
            InterruptCast icb = new InterruptCast() { MessageId = (uint)othersMsg, SpawnId = (uint)m.ID, Message = m.DisplayName };
            EQRawApplicationPacket icbPacket = new EQRawApplicationPacket(AppOpCode.InterruptCast, null, icb.Serialize());
            _zoneSvr.QueuePacketToNearbyClients(m, icbPacket, 200.0f, true, true);  // TODO: pass in PC or NPC spell for the queue call to filter on when filters are in
        }