Ejemplo n.º 1
0
        public static LogicCommand CreateCommand(LogicCommandType type)
        {
            LogicCommand command = null;

            if ((int)type < 500)
            {
                switch (type)
                {
                case LogicCommandType.JOIN_ALLIANCE:
                    command = new LogicJoinAllianceCommand();
                    break;

                case LogicCommandType.LEAVE_ALLIANCE:
                    command = new LogicLeaveAllianceCommand();
                    break;

                case LogicCommandType.CHANGE_AVATAR_NAME:
                    command = new LogicChangeAvatarNameCommand();
                    break;

                case LogicCommandType.DONATE_ALLIANCE_UNIT:
                    command = new LogicDonateAllianceUnitCommand();
                    break;

                case LogicCommandType.ALLIANCE_UNIT_RECEIVED:
                    command = new LogicAllianceUnitReceivedCommand();
                    break;

                case LogicCommandType.ALLIANCE_SETTINGS_CHANGED:
                    command = new LogicAllianceSettingsChangedCommand();
                    break;

                case LogicCommandType.DIAMONDS_ADDED:
                    command = new LogicDiamondsAddedCommand();
                    break;

                case LogicCommandType.CHANGE_ALLIANCE_ROLE:
                    command = new LogicChangeAllianceRoleCommand();
                    break;

                case LogicCommandType.TREASURY_WAR_REWARD:
                    command = new LogicTreasuryWarRewardCommand();
                    break;

                case LogicCommandType.DONATE_WAR_UNIT:
                    command = new LogicDonateWarUnitCommand();
                    break;

                case LogicCommandType.CHANGE_LEAGUE:
                    command = new LogicChangeLeagueCommand();
                    break;

                case LogicCommandType.SHUFFLE_LEAGUE:
                    command = new LogicShuffleLeagueCommand();
                    break;

                case LogicCommandType.UPDATE_WAR_PREFERENCE:
                    command = new LogicUpdateWarPreferenceCommand();
                    break;

                case LogicCommandType.ALLIANCE_EXP_EARNED:
                    command = new LogicAllianceExpEarnedCommand();
                    break;

                case LogicCommandType.CHANGE_NAME_CHANGE_STATE:
                    command = new LogicChangeNameChangeStateCommand();
                    break;

                case LogicCommandType.LEGEND_SEASON_SCORE:
                    command = new LogicLegendSeasonScoreCommand();
                    break;

                case LogicCommandType.TRANSACTIONS_REVOKED:
                    command = new LogicTransactionsRevokedCommand();
                    break;

                case LogicCommandType.CHANGE_CHALLENGE_STATE:
                    command = new LogicChangeChallengeStateCommand();
                    break;

                case LogicCommandType.SAVE_USED_ARMY:
                    command = new LogicSaveUsedArmyCommand();
                    break;

                case LogicCommandType.CONTINUE_OFFER:
                    command = new LogicContinueOfferCommand();
                    break;

                case LogicCommandType.UPDATE_OFFER_STATE:
                    command = new LogicUpdateOfferStateCommand();
                    break;

                case LogicCommandType.DELIVERING_OFFER:
                    command = new LogicDeliveringOfferCommand();
                    break;

                case LogicCommandType.DUEL_RESULT:
                    command = new LogicDuelResultCommand();
                    break;

                case LogicCommandType.DUEL_RESOURCE_REWARD:
                    command = new LogicDuelResourceRewardCommand();
                    break;

                case LogicCommandType.STARTING_HOME_VILLAGE2:
                    command = new LogicStartingHomeVillage2Command();
                    break;

                default:
                {
                    Debugger.Warning("LogicCommandManager::createCommand() - Unknown command type: " + type);
                    break;
                }
                }
            }
            else
            {
                switch (type)
                {
                case LogicCommandType.BUY_BUILDING:
                    command = new LogicBuyBuildingCommand();
                    break;

                case LogicCommandType.MOVE_BUILDING:
                    command = new LogicMoveBuildingCommand();
                    break;

                case LogicCommandType.UPGRADE_BUILDING:
                    command = new LogicUpgradeBuildingCommand();
                    break;

                case LogicCommandType.SELL_BUILDING:
                    command = new LogicSellBuildingCommand();
                    break;

                case LogicCommandType.SPEED_UP_CONSTRUCTION:
                    command = new LogicSpeedUpConstructionCommand();
                    break;

                case LogicCommandType.CANCEL_CONSTRUCTION:
                    command = new LogicCancelConstructionCommand();
                    break;

                case LogicCommandType.COLLECT_RESOURCES:
                    command = new LogicCollectResourcesCommand();
                    break;

                case LogicCommandType.CLEAR_OBSTACLE:
                    command = new LogicClearObstacleCommand();
                    break;

                case LogicCommandType.TRAIN_UNIT:
                    command = new LogicTrainUnitCommand();
                    break;

                case LogicCommandType.CANCEL_UNIT_PRODUCTION:
                    command = new LogicCancelUnitProductionCommand();
                    break;

                case LogicCommandType.BUY_TRAP:
                    command = new LogicBuyTrapCommand();
                    break;

                case LogicCommandType.REQUEST_ALLIANCE_UNITS:
                    command = new LogicRequestAllianceUnitsCommand();
                    break;

                case LogicCommandType.BUY_DECO:
                    command = new LogicBuyDecoCommand();
                    break;

                case LogicCommandType.SPEED_UP_TRAINING:
                    command = new LogicSpeedUpTrainingCommand();
                    break;

                case LogicCommandType.SPEED_UP_CLEARING:
                    command = new LogicSpeedUpClearingCommand();
                    break;

                case LogicCommandType.CANCEL_UPGRADE_UNIT:
                    command = new LogicCancelUpgradeUnitCommand();
                    break;

                case LogicCommandType.UPGRADE_UNIT:
                    command = new LogicUpgradeUnitCommand();
                    break;

                case LogicCommandType.SPEED_UP_UPGRADE_UNIT:
                    command = new LogicSpeedUpUpgradeUnitCommand();
                    break;

                case LogicCommandType.BUY_RESOURCES:
                    command = new LogicBuyResourcesCommand();
                    break;

                case LogicCommandType.MISSION_PROGRESS:
                    command = new LogicMissionProgressCommand();
                    break;

                case LogicCommandType.UNLOCK_BUILDING:
                    command = new LogicUnlockBuildingCommand();
                    break;

                case LogicCommandType.FREE_WORKER:
                    command = new LogicFreeWorkerCommand();
                    break;

                case LogicCommandType.BUY_SHIELD:
                    command = new LogicBuyShieldCommand();
                    break;

                case LogicCommandType.CLAIM_ACHIEVEMENT_REWARD:
                    command = new LogicClaimAchievementRewardCommand();
                    break;

                case LogicCommandType.TOGGLE_ATTACK_MODE:
                    command = new LogicToggleAttackModeCommand();
                    break;

                case LogicCommandType.LOAD_TURRET:
                    command = new LogicLoadTurretCommand();
                    break;

                case LogicCommandType.BOOST_BUILDING:
                    command = new LogicBoostBuildingCommand();
                    break;

                case LogicCommandType.UPGRADE_HERO:
                    command = new LogicUpgradeHeroCommand();
                    break;

                case LogicCommandType.SPEED_UP_HERO_UPGRADE:
                    command = new LogicSpeedUpHeroUpgradeCommand();
                    break;

                case LogicCommandType.TOGGLE_HERO_SLEEP:
                    command = new LogicToggleHeroSleepCommand();
                    break;

                case LogicCommandType.SPEED_UP_HERO_HEALTH:
                    command = new LogicSpeedUpHeroHealthCommand();
                    break;

                case LogicCommandType.CANCEL_HERO_UPGRADE:
                    command = new LogicCancelHeroUpgradeCommand();
                    break;

                case LogicCommandType.NEW_SHOP_ITEMS_SEEN:
                    command = new LogicNewShopItemsSeenCommand();
                    break;

                case LogicCommandType.MOVE_MULTIPLE_BUILDING:
                    command = new LogicMoveMultipleBuildingsCommand();
                    break;

                case LogicCommandType.BREAK_SHIELD:
                    command = new LogicBreakShieldCommand();
                    break;

                case LogicCommandType.SEND_ALLIANCE_MAIL:
                    command = new LogicSendAllianceMailCommand();
                    break;

                case LogicCommandType.LEAGUE_NOTIFICATION_SEEN:
                    command = new LogicLeagueNotificationSeenCommand();
                    break;

                case LogicCommandType.NEWS_SEEN:
                    command = new LogicNewsSeenCommand();
                    break;

                case LogicCommandType.TROOP_REQUEST_MESSAGE:
                    command = new LogicTroopRequestMessageCommand();
                    break;

                case LogicCommandType.SPEED_UP_TROOP_REQUEST:
                    command = new LogicSpeedUpTroopRequestCommand();
                    break;

                case LogicCommandType.SHARE_REPLAY:
                    command = new LogicShareReplayCommand();
                    break;

                case LogicCommandType.ELDER_KICK:
                    command = new LogicElderKickCommand();
                    break;

                case LogicCommandType.EDIT_MODE_SHOWN:
                    command = new LogicEditModeShownCommand();
                    break;

                case LogicCommandType.REPAIR_TRAPS:
                    command = new LogicRepairTrapsCommand();
                    break;

                case LogicCommandType.MOVE_BUILDING_EDIT_MODE:
                    command = new LogicMoveBuildingEditModeCommand();
                    break;

                case LogicCommandType.SAVE_BASE_LAYOUT:
                    command = new LogicSaveBaseLayoutCommand();
                    break;

                case LogicCommandType.UPGRADE_MULTIPLE_BUILDINGS:
                    command = new LogicUpgradeMultipleBuildingsCommand();
                    break;

                case LogicCommandType.REMOVE_UNITS:
                    command = new LogicRemoveUnitsCommand();
                    break;

                case LogicCommandType.RESUME_BOOST_TRAINING:
                    command = new LogicResumeBoostTrainingCommand();
                    break;

                case LogicCommandType.SET_LAYOUT_STATE:
                    command = new LogicSetLayoutStateCommand();
                    break;

                case LogicCommandType.SET_LAST_ALLIANCE_LEVEL:
                    command = new LogicSetLastAllianceLevelCommand();
                    break;

                case LogicCommandType.ROTATE_BUILDING:
                    command = new LogicRotateBuildingCommand();
                    break;

                case LogicCommandType.MOVE_ALL_BUILDINGS_EDIT_MODE:
                    command = new LogicMoveAllBuildingsEditModeCommand();
                    break;

                case LogicCommandType.SAVE_UNIT_PRESET:
                    command = new LogicSaveUnitPresetCommand();
                    break;

                case LogicCommandType.LOAD_UNIT_PRESET:
                    command = new LogicLoadUnitPresetCommand();
                    break;

                case LogicCommandType.START_ALLIANCE_WAR:
                    command = new LogicStartAllianceWarCommand();
                    break;

                case LogicCommandType.CANCEL_ALLIANCE_WAR:
                    command = new LogicCancelAllianceWarCommand();
                    break;

                case LogicCommandType.TRANSFER_WAR_RESOURCES:
                    command = new LogicTransferWarResourcesCommand();
                    break;

                case LogicCommandType.WAR_TROOP_REQUEST_MESSAGE:
                    command = new LogicWarTroopRequestMessageCommand();
                    break;

                case LogicCommandType.HELP_OPENED:
                    command = new LogicHelpOpenedCommand();
                    break;

                case LogicCommandType.CHANGE_LAYOUT:
                    command = new LogicSwitchLayoutCommand();
                    break;

                case LogicCommandType.COPY_LAYOUT:
                    command = new LogicCopyLayoutCommand();
                    break;

                case LogicCommandType.SET_PERSISTENT_BOOL:
                    command = new LogicSetPersistentBoolCommand();
                    break;

                case LogicCommandType.CHANGE_WAR_PREFERENCE:
                    command = new LogicChangeWarPreferenceCommand();
                    break;

                case LogicCommandType.CHANGE_ALLIANCE_CHAT_FILTER:
                    command = new LogicChangeAllianceChatFilterCommand();
                    break;

                case LogicCommandType.CHANGE_HERO_MODE:
                    command = new LogicChangeHeroModeCommand();
                    break;

                case LogicCommandType.POPUP_SEEN:
                    command = new LogicPopupSeenCommand();
                    break;

                case LogicCommandType.FRIENDLY_BATTLE_REQUEST:
                    command = new LogicFriendlyBattleRequestCommand();
                    break;

                case LogicCommandType.DRAG_UNIT_PRODUCTION:
                    command = new LogicDragUnitProductionCommand();
                    break;

                case LogicCommandType.SWAP_BUILDING:
                    command = new LogicSwapBuildingCommand();
                    break;

                case LogicCommandType.FRIEND_LIST_OPENED:
                    command = new LogicFriendListOpenedCommand();
                    break;

                case LogicCommandType.SEND_ARRANGED_WAR_REQUEST:
                    command = new LogicSendArrangedWarRequestCommand();
                    break;

                case LogicCommandType.BOOST_TRAINING:
                    command = new LogicBoostTrainingCommand();
                    break;

                case LogicCommandType.LOCK_UNIT_PRODUCTION:
                    command = new LogicLockUnitProductionCommand();
                    break;

                case LogicCommandType.CHANGE_ARMY_NAME:
                    command = new LogicChangeArmyNameCommand();
                    break;

                case LogicCommandType.PLACE_UNPLACED_OBJECT:
                    command = new LogicPlaceUnplacedObjectCommand();
                    break;

                case LogicCommandType.BUY_WALL_BLOCK:
                    command = new LogicBuyWallBlockCommand();
                    break;

                case LogicCommandType.SET_CURRENT_VILLAGE:
                    command = new LogicSetCurrentVillageCommand();
                    break;

                case LogicCommandType.TRAIN_UNIT_VILLAGE2:
                    command = new LogicTrainUnitVillage2Command();
                    break;

                case LogicCommandType.SPEED_UP_TRAINING_VILLAGE2:
                    command = new LogicSpeedUpTrainingVillage2Command();
                    break;

                case LogicCommandType.SPEED_UP_BOOST_COOLDOWN:
                    command = new LogicSpeedUpBoostCooldownCommand();
                    break;

                case LogicCommandType.CANCEL_UNIT_PRODUCTION_VILLAGE_2:
                    command = new LogicCancelUnitProductionVillage2Command();
                    break;

                case LogicCommandType.EVENT_SEEN:
                    command = new LogicEventSeenCommand();
                    break;

                case LogicCommandType.MOVE_MULTIPLE_BUILDINGS_EDIT_MODE:
                    command = new LogicMoveMultipleBuildingsEditModeCommand();
                    break;

                case LogicCommandType.SWAP_BUILDING_EDIT_MODE:
                    command = new LogicSwapBuildingEditModeCommand();
                    break;

                case LogicCommandType.GEAR_UP_BUILDING:
                    command = new LogicGearUpBuildingCommand();
                    break;

                case LogicCommandType.MATCHMAKE_VILLAGE2:
                    command = new LogicMatchmakeVillage2Command();
                    break;

                case LogicCommandType.SPEED_UP_LOOT_LIMIT:
                    command = new LogicSpeedUpLootLimitCommand();
                    break;

                case LogicCommandType.ACCOUNT_BOUND:
                    command = new LogicAccountBoundCommand();
                    break;

                case LogicCommandType.SEEN_BUILDER_MENU:
                    command = new LogicSeenBuilderMenuCommand();
                    break;

                case LogicCommandType.CHALLENGE_FRIEND_CANCEL:
                    command = new LogicChallengeFriendCancelCommand();
                    break;

                case LogicCommandType.PLACE_ATTACKER:
                    command = new LogicPlaceAttackerCommand();
                    break;

                case LogicCommandType.PLACE_ALLIANCE_PORTAL:
                    command = new LogicPlaceAlliancePortalCommand();
                    break;

                case LogicCommandType.END_ATTACK_PREPARATION:
                    command = new LogicEndAttackPreparationCommand();
                    break;

                case LogicCommandType.END_COMBAT:
                    command = new LogicEndCombatCommand();
                    break;

                case LogicCommandType.CAST_SPELL:
                    command = new LogicCastSpellCommand();
                    break;

                case LogicCommandType.PLACE_HERO:
                    command = new LogicPlaceHeroCommand();
                    break;

                case LogicCommandType.TRIGGER_HERO_ABILITY:
                    command = new LogicTriggerHeroAbilityCommand();
                    break;

                case LogicCommandType.TRIGGER_COMPONENT_TRIGGERED:
                    command = new LogicTriggerComponentTriggeredCommand();
                    break;

                case LogicCommandType.TRIGGER_TESLA:
                    command = new LogicTriggerTeslaCommand();
                    break;

                case LogicCommandType.CHANGE_UNIT_VILLAGE_2:
                    command = new LogicChangeUnitVillage2Command();
                    break;

                case LogicCommandType.MATCHMAKING:
                    command = new LogicMatchmakingCommand();
                    break;

                case LogicCommandType.DEBUG:
                    command = new LogicDebugCommand();
                    break;

                default:
                    Debugger.Warning("LogicCommandManager::createCommand() - Unknown command type: " + type);
                    break;
                }
            }

            return(command);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Creates a command instance by type.
        /// </summary>
        public static LogicCommand CreateCommand(int type)
        {
            LogicCommand command = null;

            if (type >= 1000)
            {
                if (type == 1000)
                {
                    Debugger.Error("LogicCommandManager::createCommand() - Debug command is not allowed when debug is off.");
                    return(null);
                }

                Debugger.Error("LogicCommandManager::createCommand() - Unknown command type: " + type);
            }

            if (type < 500)
            {
                switch (type)
                {
                case 1:
                    command = new LogicJoinAllianceCommand();
                    break;

                case 2:
                    command = new LogicLeaveAllianceCommand();
                    break;

                case 3:
                    command = new LogicChangeAvatarNameCommand();
                    break;

                case 7:
                    command = new LogicDiamondsAddedCommand();
                    break;

                default:
                {
                    Debugger.Error("LogicCommandManager::createCommand() - Unknown command type: " + type);
                    break;
                }
                }
            }
            else
            {
                switch (type)
                {
                case 500:
                {
                    command = new LogicBuyBuildingCommand();
                    break;
                }

                case 501:
                {
                    command = new LogicMoveBuildingCommand();
                    break;
                }

                case 502:
                {
                    command = new LogicUpgradeBuildingCommand();
                    break;
                }

                case 504:
                {
                    command = new LogicSpeedUpConstructionCommand();
                    break;
                }

                case 505:
                {
                    command = new LogicCancelConstructionCommand();
                    break;
                }

                case 506:
                {
                    command = new LogicCollectResourcesCommand();
                    break;
                }

                case 507:
                {
                    command = new LogicClearObstacleCommand();
                    break;
                }

                case 508:
                {
                    command = new LogicTrainUnitCommand();
                    break;
                }

                case 509:
                {
                    command = new LogicCancelUnitProductionCommand();
                    break;
                }

                case 510:
                {
                    command = new LogicBuyTrapCommand();
                    break;
                }

                case 513:
                {
                    command = new LogicSpeedUpTrainingCommand();
                    break;
                }

                case 518:
                {
                    command = new LogicBuyResourcesCommand();
                    break;
                }

                case 519:
                {
                    command = new LogicMissionProgressCommand();
                    break;
                }

                case 520:
                {
                    command = new LogicUnlockBuildingCommand();
                    break;
                }

                case 521:
                {
                    command = new LogicFreeWorkerCommand();
                    break;
                }

                case 522:
                {
                    command = new LogicBuyShieldCommand();
                    break;
                }

                case 523:
                {
                    command = new LogicClaimAchievementRewardCommand();
                    break;
                }

                case 526:
                {
                    command = new LogicBoostBuildingCommand();
                    break;
                }

                case 532:
                {
                    command = new LogicNewShopItemsSeenCommand();
                    break;
                }

                case 533:
                {
                    command = new LogicMoveMultipleBuildingCommand();
                    break;
                }

                case 539:
                {
                    command = new LogicNewsSeenCommand();
                    break;
                }

                case 544:
                {
                    command = new LogicEditModeShownCommand();
                    break;
                }

                case 549:
                {
                    command = new LogicUpgradeMultipleBuildingCommand();
                    break;
                }

                case 550:
                {
                    command = new LogicRemoveUnitsCommand();
                    break;
                }

                case 551:
                {
                    command = new LogicResumeBoostTrainingCommand();
                    break;
                }

                case 576:
                {
                    command = new LogicDragUnitProductionCommand();
                    break;
                }

                case 577:
                {
                    command = new LogicSwapBuildingCommand();
                    break;
                }

                case 584:
                {
                    command = new LogicBoostTrainingCommand();
                    break;
                }

                case 585:
                {
                    command = new LogicLockUnitProductionCommand();
                    break;
                }

                case 604:
                {
                    command = new LogicSeenBuilderMenuCommand();
                    break;
                }

                case 700:
                {
                    command = new LogicPlaceAttackerCommand();
                    break;
                }

                case 704:
                {
                    command = new LogicCastSpellCommand();
                    break;
                }

                default:
                {
                    Debugger.Error("LogicCommandManager::createCommand() - Unknown command type: " + type);
                    break;
                }
                }
            }

            return(command);
        }