Example #1
0
        public virtual void StartClientEvent(ICombatActor actor, Hashtable additionalInfo)
        {
            Hashtable data = new Hashtable {
                { SkillProp.SKILL_ID, this.ID },
                { SkillProp.COOLDOWN, _cooldown },
                { SkillProp.ACTIVE_TIME, active_time },
                { SkillProp.SOURCE_ACTOR_ID, actor.Avatar.Id },
                { SkillProp.TARGET_ACTOR_ID, actor.GetTarget.TargetId },
                { SkillProp.ACTOR_TYPE, actor.Avatar.Type },
                { SkillProp.TARGET_TYPE, actor.GetTarget.Type },
                { SkillProp.ADDITIONAL_INFO, (additionalInfo != null) ? additionalInfo : new Hashtable() },
                { SkillProp.RETURN_CODE, (byte)ReturnCode.Ok }
            };

            SendParameters sendParameters = new SendParameters
            {
                Unreliable = true,
                ChannelId  = Settings.ItemEventChannel
            };

            UseSkillEventData evtInstance = new UseSkillEventData
            {
                Properties = data
            };

            EventData eventData = new EventData((byte)EventCode.UseSkill, evtInstance);
            var       message   = new ItemEventMessage(actor.Avatar, eventData, sendParameters);

            ((MmoItem)actor.Avatar).ReceiveEvent(eventData, sendParameters);
            actor.Avatar.EventChannel.Publish(message);
        }
Example #2
0
        public void SendClientErrorEvent(ICombatActor actor, ReturnCode code, string reason)
        {
            Hashtable data = new Hashtable {
                { SkillProp.RETURN_CODE, (byte)code },
                { SkillProp.REASON_MESSAGE, reason }
            };
            SendParameters sendParameters = new SendParameters
            {
                Unreliable = true,
                ChannelId  = Settings.ItemEventChannel
            };

            UseSkillEventData evtInstance = new UseSkillEventData
            {
                Properties = data
            };

            EventData eventData = new EventData((byte)EventCode.UseSkill, evtInstance);
            var       message   = new ItemEventMessage(actor.Avatar, eventData, sendParameters);

            ((MmoItem)actor.Avatar).ReceiveEvent(eventData, sendParameters);
            actor.Avatar.EventChannel.Publish(message);
        }