Esempio n. 1
0
        /// <inheritdoc />
        public void Execute(IEntity entity, SystemEventArgs e)
        {
            if (!(entity is IPlayerEntity player) ||
                !e.CheckArguments())
            {
                Logger.Error("NpcShopSystem: Invalid event arguments.");
                return;
            }

            switch (e)
            {
            case NpcShopOpenEventArgs npcShopEventArgs:
                this.OpenShop(player, npcShopEventArgs);
                break;

            case NpcShopCloseEventArgs npcShopEventArgs:
                this.CloseShop(player);
                break;

            case NpcShopBuyEventArgs npcShopEventArgs:
                this.BuyItem(player, npcShopEventArgs);
                break;

            case NpcShopSellEventArgs npcShopEventArgs:
                this.SellItem(player, npcShopEventArgs);
                break;

            default:
                Logger.Warn("Unknown NpcShop action type: {0} for player {1}", e.GetType(), entity.Object.Name);
                break;
            }
        }
Esempio n. 2
0
        /// <inheritdoc />
        public void Execute(IEntity entity, SystemEventArgs args)
        {
            if (args == null)
            {
                Logger.LogError($"Cannot execute {nameof(DropSystem)}. Arguments are null.");
                return;
            }

            if (!args.CheckArguments())
            {
                Logger.LogError($"Cannot execute {nameof(DropSystem)} action: {args.GetType()} due to invalid arguments.");
                return;
            }

            switch (args)
            {
            case DropItemEventArgs dropItemEventArgs:
                this.DropItem(entity, dropItemEventArgs);
                break;

            case DropGoldEventArgs dropGoldEventArgs:
                this.DropGold(entity, dropGoldEventArgs);
                break;
            }
        }
Esempio n. 3
0
        /// <inheritdoc />
        public void Execute(IEntity entity, SystemEventArgs e)
        {
            if (!(entity is IMovableEntity movableEntity) || !e.CheckArguments())
            {
                Logger.Error("FollowSystem: Invalid arguments");
                return;
            }

            switch (e)
            {
            case FollowEventArgs followEvent:
                this.OnFollow(movableEntity, followEvent);
                break;
            }
        }
Esempio n. 4
0
        /// <inheritdoc />
        public void Execute(IEntity entity, SystemEventArgs e)
        {
            if (!e.CheckArguments() || !(entity is IPlayerEntity playerEntity))
            {
                return;
            }

            switch (e)
            {
            case TradeRequestEventArgs tradeRequestEventArgs:
                TradeRequest(playerEntity, tradeRequestEventArgs);
                break;

            case TradeRequestCancelEventArgs tradeRequestCancelEventArgs:
                TradeRequestCancel(playerEntity, tradeRequestCancelEventArgs);
                break;

            case TradeBeginEventArgs tradeBeginEventArgs:
                Trade(playerEntity, tradeBeginEventArgs);
                break;

            case TradePutEventArgs tradePutEventArgs:
                PutItem(playerEntity, tradePutEventArgs);
                break;

            case TradePutGoldEventArgs tradePutGoldEventArgs:
                PutGold(playerEntity, tradePutGoldEventArgs);
                break;

            case TradeCancelEventArgs tradeCancelEventArgs:
                TradeCancel(playerEntity, tradeCancelEventArgs);
                break;

            case TradeConfirmEventArgs tradeConfirmEventArgs:
                TradeConfirm(playerEntity, tradeConfirmEventArgs);
                break;

            case TradeOkEventArgs tradeOkEventArgs:
                TradeOk(playerEntity, tradeOkEventArgs);
                break;

            default:
                Logger.Warn("Unknown trade action type: {0} for player {1}", e.GetType(), entity.Object.Name);
                break;
            }
        }
Esempio n. 5
0
        /// <inheritdoc />
        public void Execute(IEntity entity, SystemEventArgs args)
        {
            if (!args.CheckArguments())
            {
                Logger.LogError("Cannot execute battle action: {0} due to invalid arguments.", args.GetType());
                return;
            }

            if (!(entity is ILivingEntity livingEntity))
            {
                Logger.LogError($"The non living entity {entity.Object.Name} tried to execute a battle action.");
                return;
            }

            switch (args)
            {
            case MeleeAttackEventArgs meleeAttackEventArgs:
                this.ProcessMeleeAttack(livingEntity, meleeAttackEventArgs);
                break;
            }
        }
Esempio n. 6
0
        /// <inheritdoc />
        public void Execute(IEntity entity, SystemEventArgs e)
        {
            if (!(entity is IPlayerEntity playerEntity))
            {
                return;
            }

            if (!e.CheckArguments())
            {
                Logger.LogError($"Cannot execute mailbox action: {e.GetType()} due to invalid arguments.");
                return;
            }

            switch (e)
            {
            case QueryMailboxEventArgs queryMailboxEvent:
                GetMails(playerEntity, queryMailboxEvent);
                break;

            case QueryPostMailEventArgs queryPostMailEvent:
                SendMail(playerEntity, queryPostMailEvent);
                break;

            case QueryRemoveMailEventArgs queryRemoveMailEvent:
                RemoveMail(playerEntity, queryRemoveMailEvent);
                break;

            case QueryGetMailItemEventArgs queryGetMailItemEvent:
                GetMailItem(playerEntity, queryGetMailItemEvent);
                break;

            case QueryGetMailGoldEventArgs queryGetMailGoldEvent:
                GetMailGold(playerEntity, queryGetMailGoldEvent);
                break;

            case ReadMailEventArgs readMailEvent:
                ReadMail(playerEntity, readMailEvent);
                break;
            }
        }
Esempio n. 7
0
        public void Execute(IEntity entity, SystemEventArgs args)
        {
            if (!(entity is IPlayerEntity playerEntity) || !args.CheckArguments())
            {
                Logger.LogError("CustomizationSystem: Invalid arguments.");
                return;
            }

            switch (args)
            {
            case ChangeFaceEventArgs e:
                OnChangeFace(playerEntity, e);
                break;

            case SetHairEventArgs e:
                OnSetHair(playerEntity, e);
                break;

            default:
                Logger.LogWarning("Unknown Customization action type: {0} for player {1}", args.GetType(), entity.Object.Name);
                break;
            }
        }
Esempio n. 8
0
        /// <inheritdoc />
        public void Execute(IEntity entity, SystemEventArgs e)
        {
            if (!(entity is IPlayerEntity playerEntity) ||
                !e.CheckArguments())
            {
                Logger.Error("StatisticsSystem: Invalid event action arguments.");
                return;
            }

            Logger.Debug("Execute statistics action: {0}", e.GetType());

            switch (e)
            {
            case StatisticsModifyEventArgs statisticsModifyEvent:
                this.ModifyStatus(playerEntity, statisticsModifyEvent);
                break;

            default:
                Logger.Warn("Unknown statistics action type: {0} for player {1}", e.GetType(), entity.Object.Name);
                break;
            }

            WorldPacketFactory.SendUpdateState(playerEntity);
        }
Esempio n. 9
0
        public void Execute(IEntity entity, SystemEventArgs args)
        {
            if (!(entity is IPlayerEntity player))
            {
                return;
            }

            if (!args.CheckArguments())
            {
                Logger.LogWarning("Invalid arguments received.");
                return;
            }

            switch (args)
            {
            case AddTaskbarAppletEventArgs e:
                HandleAddAppletTaskbarShortcut(player, e);
                break;

            case RemoveTaskbarAppletEventArgs e:
                HandleRemoveAppletTaskbarShortcut(player, e);
                break;

            case AddTaskbarItemEventArgs e:
                HandleAddItemTaskbarShortcut(player, e);
                break;

            case RemoveTaskbarItemEventArgs e:
                HandleRemoveItemTaskbarShortcut(player, e);
                break;

            case TaskbarSkillEventArgs e:
                HandleActionSlot(player, e);
                break;
            }
        }
Esempio n. 10
0
        public void Execute(IEntity entity, SystemEventArgs e)
        {
            if (!(entity is IPlayerEntity playerEntity))
            {
                return;
            }

            if (!e.CheckArguments())
            {
                Logger.LogError($"Cannot execute player data action {e.GetType()} due to invalid arguments.");
                return;
            }

            switch (e)
            {
            case QueryPlayerDataEventArgs queryPlayerDataEvent:
                GetPlayerData(playerEntity, queryPlayerDataEvent);
                break;

            case QueryPlayerData2EventArgs queryPlayerData2Event:
                GetPlayerData(playerEntity, queryPlayerData2Event);
                break;
            }
        }
Esempio n. 11
0
        /// <inheritdoc />
        public void Execute(IEntity entity, SystemEventArgs e)
        {
            if (!(entity is IPlayerEntity playerEntity))
            {
                return;
            }

            if (!e.CheckArguments())
            {
                Logger.Error("Cannot execute inventory action: {0} due to invalid arguments.", e.GetType());
                return;
            }

            switch (e)
            {
            case InventoryInitializeEventArgs inventoryInitializeEvent:
                this.InitializeInventory(playerEntity, inventoryInitializeEvent);
                break;

            case InventoryMoveEventArgs inventoryMoveEvent:
                this.MoveItem(playerEntity, inventoryMoveEvent);
                break;

            case InventoryEquipEventArgs inventoryEquipEvent:
                this.EquipItem(playerEntity, inventoryEquipEvent);
                break;

            case InventoryCreateItemEventArgs inventoryCreateItemEventArgs:
                this.CreateItem(playerEntity, inventoryCreateItemEventArgs);
                break;

            default:
                Logger.Warn("Unknown inventory action type: {0} for player {1}", e.GetType(), entity.Object.Name);
                break;
            }
        }
Esempio n. 12
0
        public void Execute(IEntity entity, SystemEventArgs args)
        {
            if (!(entity is IPlayerEntity player))
            {
                return;
            }

            if (!args.CheckArguments())
            {
                Logger.LogError("PartySystem: Invalid event action arguments.");
                return;
            }

            switch (args)
            {
            case PartyMemberRequestEventArgs e:
                OnPartyMemberRequest(player, e);
                break;

            case PartyMemberRequestCancelEventArgs e:
                OnPartyMemberRequestCancel(player, e);
                break;

            case PartyAddMemberEventArgs e:
                OnAddPartyMember(player, e);
                break;

            case PartyRemoveMemberEventArgs e:
                OnRemovePartyMember(player, e);
                break;

            default:
                Logger.LogWarning("Unknown statistics action type: {0} for player {1}", args.GetType(), entity.Object.Name);
                break;
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Executes the <see cref="InteractionSystem"/> logic.
        /// </summary>
        /// <param name="entity">Current entity</param>
        public void Execute(IEntity entity, SystemEventArgs e)
        {
            if (!(entity is IPlayerEntity playerEntity))
            {
                return;
            }

            if (!e.CheckArguments())
            {
                Logger.LogError("Cannot execute interaction action: {0} due to invalid arguments.", e.GetType());
                return;
            }

            switch (e)
            {
            case SetTargetEventArgs setTargetEventArgs:
                this.SetTarget(playerEntity, setTargetEventArgs);
                break;

            default:
                Logger.LogWarning("Unknown interaction action type: {0} for player {1}", e.GetType(), entity.Object.Name);
                break;
            }
        }