/// <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; } }
/// <inheritdoc /> public void Execute(IEntity entity, SystemEventArgs args) { if (!(entity is IPlayerEntity player)) { this._logger.LogError($"Cannot execute Level System. {entity.Object.Name} is not a player."); return; } if (!args.GetCheckArguments()) { this._logger.LogError($"Cannot execute Level System action: {args.GetType()} due to invalid arguments."); return; } switch (args) { case ExperienceEventArgs e: this.GiveExperience(player, e); break; default: this._logger.LogWarning("Unknown level system action type: {0} for player {1}", args.GetType(), entity.Object.Name); break; } }
/// <inheritdoc /> public void Execute(IEntity entity, SystemEventArgs args) { if (!(entity is IPlayerEntity player)) { this._logger.LogError($"Cannot execute {nameof(RecoverySystem)}. {entity.Object.Name} is not a player."); return; } if (!args.GetCheckArguments()) { this._logger.LogError($"Cannot execute {nameof(RecoverySystem)} action: {args.GetType()} due to invalid arguments."); return; } switch (args) { case IdleRecoveryEventArgs e: this.IdleHeal(player, e); break; default: this._logger.LogWarning($"Unknown recovery system action type: {args.GetType()} for player {entity.Object.Name}"); break; } }
/// <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; } }
/// <inheritdoc /> public void Execute(IEntity entity, SystemEventArgs e) { if (!(entity is IPlayerEntity player)) { return; } if (!e.GetCheckArguments()) { Logger.LogError("Cannot execute inventory action: {0} due to invalid arguments.", e.GetType()); return; } if (player.Health.IsDead) { this.Logger.LogWarning($"Cannot execute inventory action {e.GetType()}. Player '{player.Object.Name}' is dead."); return; } switch (e) { case InventoryInitializeEventArgs inventoryInitializeEvent: this.InitializeInventory(player, inventoryInitializeEvent); break; case InventoryMoveEventArgs inventoryMoveEvent: this.ProcessMoveItem(player, inventoryMoveEvent); break; case InventoryEquipEventArgs inventoryEquipEvent: this.ProcessEquipItem(player, inventoryEquipEvent); break; case InventoryCreateItemEventArgs inventoryCreateItemEvent: this.ProcessCreateItem(player, inventoryCreateItemEvent); break; case InventoryDropItemEventArgs inventoryDropItemEvent: this.ProcessDropItem(player, inventoryDropItemEvent); break; case InventoryUseItemEventArgs inventoryUseItemEvent: this.ProcessUseItem(player, inventoryUseItemEvent); break; default: Logger.LogWarning("Unknown inventory action type: {0} for player {1}", e.GetType(), entity.Object.Name); break; } }
/// <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); }
/// <inheritdoc /> public void Execute(IEntity entity, SystemEventArgs e) { if (!e.GetCheckArguments() || !(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; } }
/// <inheritdoc /> public void Execute(IEntity entity, SystemEventArgs e) { if (!(entity is IPlayerEntity playerEntity)) { return; } if (!e.GetCheckArguments()) { 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; } }
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; } }
/// <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; } }
/// <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; } }
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; } }
/// <inheritdoc /> public void Execute(IEntity entity, SystemEventArgs args) { if (!(entity is IPlayerEntity player)) { this._logger.LogError($"Cannot execute {nameof(TeleportSystem)}. {entity.Object.Name} is not a player."); return; } if (!args.GetCheckArguments()) { this._logger.LogError($"Cannot execute {nameof(TeleportSystem)} action: {args.GetType()} due to invalid arguments."); return; } switch (args) { case TeleportEventArgs e: this.Teleport(player, e); break; } }
public void Execute(IEntity entity, SystemEventArgs args) { if (!(entity is IPlayerEntity player)) { return; } if (!args.GetCheckArguments()) { 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; } }
/// <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; } }
/// <inheritdoc /> public void Execute(IEntity entity, SystemEventArgs args) { if (entity == null) { this._logger.LogError($"Cannot execute {nameof(SpecialEffectSystem)}. Entity is null."); return; } if (!args.GetCheckArguments()) { this._logger.LogError($"Cannot execute {nameof(SpecialEffectSystem)} action: {args.GetType()} due to invalid arguments."); return; } switch (args) { case SpecialEffectEventArgs e: this.StartSpecialEffect(entity, e); break; case SpecialEffectBaseMotionEventArgs e: this.SetStateModeBaseMotion(entity, e); break; } }