From ff53af6668039b6397c8640e67afaa110dfbf6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Tue, 23 Oct 2018 09:43:42 +0200 Subject: [PATCH] Importing SVN archives - Trunk --- .../pom.xml | 4 +- .../legacyworlds-server-beans-bt/pom.xml | 4 +- .../lw/beans/bt/EmpireSummaryBean.java | 27 +- .../lw/beans/bt/esdata/DebugInformation.java | 27 +- .../beans/bt/esdata/ResearchInformation.java | 64 ++- .../bt/esdata/TechnologyInformation.java | 48 +++ .../pom.xml | 4 +- .../.classpath | 10 + .../legacyworlds-server-beans-events/.project | 23 ++ .../.settings/org.eclipse.jdt.core.prefs | 6 + .../.settings/org.maven.ide.eclipse.prefs | 9 + .../legacyworlds-server-beans-events/pom.xml | 13 + .../legacyworlds-server-beans-i18n/pom.xml | 4 +- .../lw/beans/i18n/TranslatorBean.java | 79 ++++ .../legacyworlds-server-beans-mailer/pom.xml | 4 +- .../legacyworlds-server-beans-naming/pom.xml | 4 +- .../legacyworlds-server-beans-simple/pom.xml | 4 +- .../lw/beans/empire/EmpireDAOBean.java | 105 ++--- .../lw/beans/empire/EmpireManagementBean.java | 56 ++- .../lw/beans/updates/GameUpdateBean.java | 138 ------- .../lw/beans/updates/UpdatesDAOBean.java | 43 -- .../resources/configuration/simple-beans.xml | 2 - .../legacyworlds-server-beans-system/pom.xml | 4 +- .../deepclone/lw/beans/sys/ConstantsData.java | 20 +- .../lw/beans/sys/ConstantsManagerBean.java | 9 +- .../lw/beans/sys/ConstantsRegistrarBean.java | 43 +- .../lw/beans/sys/SystemStatusBean.java | 84 ++-- .../deepclone/lw/beans/sys/TickerBean.java | 7 +- .../.classpath | 10 + .../legacyworlds-server-beans-techs/.project | 23 ++ .../.settings/org.eclipse.jdt.core.prefs | 6 + .../.settings/org.maven.ide.eclipse.prefs | 9 + .../legacyworlds-server-beans-techs/pom.xml | 15 + .../beans/techs/EmpireTechnologyDAOBean.java | 160 ++++++++ .../techs/EmpireTechnologyManagerBean.java | 181 +++++++++ .../lw/beans/techs/EmpireUpdate.java | 293 ++++++++++++++ .../beans/techs/ResearchResponseBuilder.java | 280 +++++++++++++ .../lw/beans/techs/ResearchUpdateBean.java | 180 +++++++++ .../lw/beans/techs/ResearchUpdateDAOBean.java | 138 +++++++ .../beans/techs/TechnologyGraphDAOBean.java | 134 +++++++ .../techs/TechnologyGraphManagerBean.java | 74 ++++ .../resources/configuration/techs-beans.xml | 14 + .../techs/empire-technology-dao-bean.xml | 8 + .../techs/empire-technology-manager-bean.xml | 8 + .../techs/research-update-bean.xml | 8 + .../techs/research-update-dao-bean.xml | 8 + .../techs/technology-graph-dao-bean.xml | 8 + .../techs/technology-graph-manager-bean.xml | 8 + .../.classpath | 10 + .../.project | 23 ++ .../.settings/org.eclipse.jdt.core.prefs | 6 + .../.settings/org.maven.ide.eclipse.prefs | 9 + .../legacyworlds-server-beans-updates/pom.xml | 13 + .../lw/beans/updates/GameUpdateBean.java | 367 ++++++++++++++++++ .../beans/updates/ProceduralGameUpdate.java | 52 +++ .../lw/beans/updates/UpdatesDAOBean.java | 85 ++++ .../resources/configuration/updates-beans.xml | 9 + .../updates}/game-update-bean.xml | 0 .../updates}/updates-dao-bean.xml | 0 .../legacyworlds-server-beans-user/pom.xml | 4 +- .../ListCategoriesCommandDelegateBean.java | 59 +++ .../ImplementTechCommandDelegateBean.java | 17 +- ...ResearchPrioritiesCommandDelegateBean.java | 56 +++ .../ViewResearchCommandDelegateBean.java | 52 +++ .../user/admin-session-definer-bean.xml | 3 + .../user/player-session-definer-bean.xml | 6 +- .../legacyworlds-server-beans/pom.xml | 7 +- .../db-structure/parts/020-functions.sql | 1 + .../parts/data/070-constants-data.sql | 6 +- .../parts/data/080-techs-data.sql | 68 ++-- .../parts/data/090-buildables-data.sql | 12 +- .../parts/data/100-universe-data.sql | 12 +- .../parts/data/110-empires-data.sql | 59 ++- .../parts/data/120-construction-data.sql | 8 +- .../parts/data/130-fleets-data.sql | 6 +- .../parts/data/170-events-data.sql | 157 +++++++- .../functions/010-constants-functions.sql | 34 +- .../parts/functions/030-tech-functions.sql | 270 +++++++++---- .../parts/functions/040-empire-functions.sql | 95 +---- .../functions/045-research-functions.sql | 227 +++++++++++ .../functions/050-computation-functions.sql | 92 ++--- .../functions/060-universe-functions.sql | 28 +- .../parts/functions/140-planets-functions.sql | 67 ++-- .../parts/functions/150-battle-functions.sql | 8 +- .../parts/functions/160-battle-views.sql | 4 +- .../parts/functions/165-fleets-functions.sql | 81 ++-- .../parts/functions/167-planet-list.sql | 2 +- .../parts/functions/170-event-functions.sql | 2 +- .../parts/functions/200-bugs-functions.sql | 18 +- .../parts/updates/000-updates-ctrl.sql | 104 ++--- .../parts/updates/010-empire-money.sql | 4 +- .../parts/updates/020-empire-research.sql | 204 +++++++--- .../parts/updates/025-empire-debt.sql | 8 +- .../parts/updates/060-planet-battle.sql | 16 +- .../parts/updates/080-planet-construction.sql | 25 +- .../parts/updates/090-planet-military.sql | 10 +- .../parts/updates/100-planet-population.sql | 22 +- .../parts/updates/110-planet-money.sql | 4 +- .../legacyworlds-server-data/pom.xml | 4 +- .../lw/sqld/game/EmpireTechLine.java | 66 ---- .../lw/sqld/game/EmpireTechnology.java | 90 ----- .../lw/sqld/game/GeneralInformation.java | 24 +- .../lw/sqld/game/techs/Category.java | 169 ++++++++ .../lw/sqld/game/techs/EmpireTechnology.java | 175 +++++++++ .../lw/sqld/game/techs/ResearchStatus.java | 20 + .../sqld/game/techs/ResearchUpdateInput.java | 90 +++++ .../sqld/game/techs/ResearchUpdateOutput.java | 134 +++++++ .../lw/sqld/game/techs/TechGraph.java | 366 +++++++++++++++++ .../sqld/game/techs/TechGraphException.java | 69 ++++ .../lw/sqld/game/techs/Technology.java | 285 ++++++++++++++ .../com/deepclone/lw/sqld/sys/Constant.java | 14 - .../legacyworlds-server-interfaces/pom.xml | 4 +- .../lw/interfaces/game/EmpireDAO.java | 7 - .../lw/interfaces/game/EmpireManagement.java | 14 +- .../lw/interfaces/game/UpdatesDAO.java | 7 - .../game/techs/EmpireTechnologyDAO.java | 74 ++++ .../game/techs/EmpireTechnologyManager.java | 53 +++ .../game/techs/ResearchUpdateDAO.java | 56 +++ .../game/techs/TechnologyGraphDAO.java | 27 ++ .../game/techs/TechnologyGraphManager.java | 36 ++ .../game/updates/DuplicateUpdateHandler.java | 30 ++ .../interfaces/game/updates/GameUpdate.java | 25 ++ .../game/updates/GameUpdatePhase.java | 69 ++++ .../game/updates/GameUpdatePhaseHandler.java | 40 ++ .../game/updates/GameUpdateTarget.java | 17 + .../interfaces/game/updates/UpdatesDAO.java | 46 +++ .../interfaces/i18n/LanguageTranslator.java | 31 ++ .../lw/interfaces/i18n/Translator.java | 13 + .../lw/interfaces/sys/ConstantsManager.java | 7 +- .../lw/interfaces/sys/SystemStatus.java | 7 + .../data/buildables-test.xml | 40 -- .../data/buildables.xml | 12 +- .../data/buildables.xsd | 7 +- .../data/i18n-text.xml | 362 ++--------------- .../data/i18n-text.xsd | 1 + .../data/techs-test.xml | 23 -- .../legacyworlds-server-main/data/techs.xml | 38 +- .../legacyworlds-server-main/data/techs.xsd | 18 +- .../data/text/buildings.xml | 76 ++++ .../data/text/mail.xml | 38 ++ .../{ => text/mail}/addressChangeMail-en.txt | 2 +- .../{ => text/mail}/addressChangeMail-fr.txt | 2 +- .../data/{ => text/mail}/adminErrorMail.txt | 2 +- .../data/{ => text/mail}/adminRecapMail.txt | 2 +- .../data/{ => text/mail}/banLiftedMail-en.txt | 2 +- .../data/{ => text/mail}/banLiftedMail-fr.txt | 2 +- .../data/{ => text/mail}/bannedMail-en.txt | 2 +- .../data/{ => text/mail}/bannedMail-fr.txt | 2 +- .../{ => text/mail}/inactivityQuitMail-en.txt | 2 +- .../{ => text/mail}/inactivityQuitMail-fr.txt | 2 +- .../mail}/inactivityWarningMail-en.txt | 2 +- .../mail}/inactivityWarningMail-fr.txt | 2 +- .../data/{ => text/mail}/messageMail-en.txt | 2 +- .../data/{ => text/mail}/messageMail-fr.txt | 2 +- .../mail}/passwordRecoveryMail-en.txt | 2 +- .../mail}/passwordRecoveryMail-fr.txt | 2 +- .../data/{ => text/mail}/quitMail-en.txt | 2 +- .../data/{ => text/mail}/quitMail-fr.txt | 2 +- .../{ => text/mail}/reactivationMail-en.txt | 4 +- .../{ => text/mail}/reactivationMail-fr.txt | 4 +- .../data/{ => text/mail}/recapMail-en.txt | 2 +- .../data/{ => text/mail}/recapMail-fr.txt | 2 +- .../{ => text/mail}/registrationMail-en.txt | 4 +- .../{ => text/mail}/registrationMail-fr.txt | 4 +- .../data/text/preferences.xml | 130 +++++++ .../data/text/technologies.xml | 118 ++++++ .../legacyworlds-server-main/hibernate.xml | 25 -- .../legacyworlds-server-main/pom.xml | 19 +- .../deepclone/lw/cli/ImportBuildables.java | 20 +- .../com/deepclone/lw/cli/ImportTechs.java | 241 ++++++++++-- .../java/com/deepclone/lw/cli/ImportText.java | 150 +------ .../com/deepclone/lw/cli/i18n/FileString.java | 54 +++ .../deepclone/lw/cli/i18n/InlineString.java | 28 ++ .../deepclone/lw/cli/i18n/LanguageData.java | 36 ++ .../deepclone/lw/cli/i18n/LoadableText.java | 73 ++++ .../com/deepclone/lw/cli/i18n/Loader.java | 99 +++++ .../com/deepclone/lw/cli/i18n/StringData.java | 25 ++ .../com/deepclone/lw/cli/i18n/TextData.java | 34 ++ .../java/com/deepclone/lw/srv/Server.java | 23 +- .../src/main/resources/lw-server.xml | 2 + .../legacyworlds-server-tests/pom.xml | 4 +- .../legacyworlds-server-utils/pom.xml | 4 +- .../com/deepclone/lw/utils/EmailAddress.java | 2 +- legacyworlds-server/pom.xml | 4 +- legacyworlds-session/pom.xml | 4 +- .../lw/cmd/CreateAuthChallengeCommand.java | 3 +- .../lw/cmd/CreateAuthChallengeResponse.java | 3 +- .../deepclone/lw/cmd/MaintenanceResponse.java | 3 +- .../lw/cmd/admin/AdminOverviewCommand.java | 3 +- .../lw/cmd/admin/AdminOverviewResponse.java | 3 +- .../deepclone/lw/cmd/admin/AdminResponse.java | 3 +- .../lw/cmd/admin/NoOperationCommand.java | 3 +- .../lw/cmd/admin/SetPasswordCommand.java | 3 +- .../lw/cmd/admin/SetPasswordResponse.java | 3 +- .../lw/cmd/admin/adata/AdminOverview.java | 4 +- .../lw/cmd/admin/adata/Administrator.java | 4 +- .../cmd/admin/adata/AdministratorBasics.java | 4 +- .../lw/cmd/admin/adata/Privileges.java | 1 + .../lw/cmd/admin/bans/ArchivedBanRequest.java | 4 +- .../lw/cmd/admin/bans/BanRequest.java | 4 +- .../lw/cmd/admin/bans/BansSummaryCommand.java | 3 +- .../cmd/admin/bans/BansSummaryResponse.java | 3 +- .../lw/cmd/admin/bans/ConfirmBanCommand.java | 3 +- .../lw/cmd/admin/bans/LiftBanCommand.java | 3 +- .../lw/cmd/admin/bans/ListBansCommand.java | 3 +- .../lw/cmd/admin/bans/ListBansResponse.java | 3 +- .../lw/cmd/admin/bans/RejectBanCommand.java | 3 +- .../lw/cmd/admin/bans/RejectBanResponse.java | 3 +- .../lw/cmd/admin/bans/RequestBanCommand.java | 3 +- .../lw/cmd/admin/bans/RequestBanResponse.java | 3 +- .../lw/cmd/admin/bans/SummaryEntry.java | 4 +- .../cmd/admin/bans/ValidatedBanRequest.java | 4 +- .../lw/cmd/admin/bt/BugsSummaryCommand.java | 3 +- .../lw/cmd/admin/bt/BugsSummaryResponse.java | 3 +- .../lw/cmd/admin/bt/GetSnapshotCommand.java | 3 +- .../lw/cmd/admin/bt/GetSnapshotResponse.java | 3 +- .../lw/cmd/admin/bt/ListBugsResponse.java | 3 +- .../lw/cmd/admin/bt/MergeReportsCommand.java | 3 +- .../lw/cmd/admin/bt/MergeReportsResponse.java | 3 +- .../cmd/admin/bt/ModerateCommentCommand.java | 3 +- .../lw/cmd/admin/bt/PostCommentResponse.java | 3 +- .../lw/cmd/admin/bt/ReportBugResponse.java | 3 +- .../lw/cmd/admin/bt/ReportStatusCommand.java | 3 +- .../cmd/admin/bt/ReportVisibilityCommand.java | 3 +- .../cmd/admin/bt/ValidateReportCommand.java | 3 +- .../lw/cmd/admin/bt/ViewBugResponse.java | 3 +- .../lw/cmd/admin/constants/Category.java | 4 +- .../lw/cmd/admin/constants/Definition.java | 4 +- .../admin/constants/GetConstantsCommand.java | 3 +- .../admin/constants/GetConstantsResponse.java | 3 +- .../admin/constants/SetConstantCommand.java | 3 +- .../admin/constants/SetConstantResponse.java | 3 +- .../cmd/admin/i18n/ChangeLanguageCommand.java | 3 +- .../admin/i18n/ChangeLanguageResponse.java | 3 +- .../lw/cmd/admin/i18n/GetLanguageCommand.java | 3 +- .../cmd/admin/i18n/GetLanguageResponse.java | 3 +- .../lw/cmd/admin/i18n/I18NString.java | 4 +- .../deepclone/lw/cmd/admin/i18n/Language.java | 4 +- .../lw/cmd/admin/i18n/SetStringCommand.java | 3 +- .../lw/cmd/admin/i18n/SetStringResponse.java | 3 +- .../cmd/admin/i18n/ViewLanguagesCommand.java | 3 +- .../cmd/admin/i18n/ViewLanguagesResponse.java | 3 +- .../lw/cmd/admin/logs/ExceptionEntry.java | 4 +- .../lw/cmd/admin/logs/GetEntryCommand.java | 3 +- .../lw/cmd/admin/logs/GetEntryResponse.java | 3 +- .../deepclone/lw/cmd/admin/logs/LogEntry.java | 4 +- .../lw/cmd/admin/logs/TraceEntry.java | 4 +- .../lw/cmd/admin/logs/ViewLogCommand.java | 3 +- .../lw/cmd/admin/logs/ViewLogResponse.java | 3 +- .../admin/mntm/EnableMaintenanceCommand.java | 3 +- .../cmd/admin/mntm/EndMaintenanceCommand.java | 3 +- .../admin/mntm/ExtendMaintenanceCommand.java | 3 +- .../admin/mntm/MaintenanceChangeResponse.java | 3 +- .../admin/mntm/MaintenanceStatusCommand.java | 3 +- .../admin/mntm/MaintenanceStatusResponse.java | 3 +- .../cmd/admin/msg/ComposeMessageCommand.java | 3 +- .../cmd/admin/msg/ComposeMessageResponse.java | 3 +- .../lw/cmd/admin/msg/GetMessagesCommand.java | 3 +- .../lw/cmd/admin/msg/GetMessagesResponse.java | 3 +- .../lw/cmd/admin/msg/MessageBoxCommand.java | 3 +- .../cmd/admin/msg/PrepareMessageCommand.java | 3 +- .../lw/cmd/admin/msg/ReadMessageCommand.java | 3 +- .../lw/cmd/admin/msg/ReadMessageResponse.java | 3 +- .../lw/cmd/admin/msg/SendSpamCommand.java | 3 +- .../lw/cmd/admin/naming/GetNamesCommand.java | 3 +- .../lw/cmd/admin/naming/GetNamesResponse.java | 3 +- .../deepclone/lw/cmd/admin/naming/Name.java | 4 +- .../cmd/admin/naming/NamesActionCommand.java | 3 +- .../cmd/admin/naming/NamesSummaryCommand.java | 3 +- .../admin/naming/NamesSummaryResponse.java | 3 +- .../admin/prefs/GetPrefDefaultsCommand.java | 3 +- .../cmd/admin/prefs/PrefDefaultsResponse.java | 3 +- .../admin/prefs/SetPrefDefaultCommand.java | 3 +- .../cmd/admin/su/AddAdministratorCommand.java | 3 +- .../admin/su/AddAdministratorResponse.java | 3 +- .../admin/su/ListAdministratorsCommand.java | 3 +- .../admin/su/ListAdministratorsResponse.java | 3 +- .../admin/su/ResetAdminPasswordCommand.java | 4 +- .../lw/cmd/admin/su/SetPrivilegesCommand.java | 3 +- .../admin/su/ViewAdministratorCommand.java | 3 +- .../admin/su/ViewAdministratorResponse.java | 3 +- .../cmd/admin/techs/GetTechnologyCommand.java | 29 ++ .../admin/techs/GetTechnologyResponse.java | 62 +++ .../admin/techs/ListCategoriesCommand.java | 15 + .../admin/techs/ListCategoriesResponse.java | 40 ++ .../lw/cmd/admin/techs/TechCategory.java | 50 +++ .../lw/cmd/admin/techs/TechEntry.java | 62 +++ .../cmd/admin/tick/SetTaskStatusCommand.java | 3 +- .../cmd/admin/tick/TickerStatusCommand.java | 3 +- .../cmd/admin/tick/TickerStatusResponse.java | 3 +- .../lw/cmd/admin/tick/TickerTaskInfo.java | 4 +- .../cmd/admin/tick/ToggleTickerCommand.java | 3 +- .../lw/cmd/admin/users/AccountBanEntry.java | 4 +- .../lw/cmd/admin/users/AccountListEntry.java | 4 +- .../cmd/admin/users/AccountSessionEntry.java | 4 +- .../lw/cmd/admin/users/AccountViewEntry.java | 4 +- .../cmd/admin/users/GiveCreditsCommand.java | 3 +- .../cmd/admin/users/ListAccountsCommand.java | 3 +- .../cmd/admin/users/ListAccountsResponse.java | 3 +- .../cmd/admin/users/ListSessionsCommand.java | 3 +- .../cmd/admin/users/ListSessionsResponse.java | 3 +- .../lw/cmd/admin/users/UserSession.java | 4 +- .../cmd/admin/users/ViewAccountCommand.java | 3 +- .../cmd/admin/users/ViewAccountResponse.java | 3 +- .../deepclone/lw/cmd/bt/ListBugsCommand.java | 3 +- .../lw/cmd/bt/PostCommentCommand.java | 3 +- .../deepclone/lw/cmd/bt/ReportBugCommand.java | 3 +- .../deepclone/lw/cmd/bt/ViewBugCommand.java | 3 +- .../deepclone/lw/cmd/bt/data/BugEvent.java | 4 +- .../deepclone/lw/cmd/bt/data/BugReport.java | 4 +- .../lw/cmd/bt/data/BugSubmitter.java | 4 +- .../ext/ConfirmPasswordRecoveryCommand.java | 3 +- .../ext/ConfirmPasswordRecoveryResponse.java | 3 +- .../lw/cmd/ext/CreateAccountCommand.java | 3 +- .../lw/cmd/ext/CreateAccountResponse.java | 3 +- .../lw/cmd/ext/ListLanguagesCommand.java | 3 +- .../lw/cmd/ext/ListLanguagesResponse.java | 5 +- .../ext/RequestPasswordRecoveryCommand.java | 3 +- .../ext/RequestPasswordRecoveryResponse.java | 3 +- .../com/deepclone/lw/cmd/msgdata/Message.java | 3 +- .../lw/cmd/msgdata/MessageListEntry.java | 4 +- .../lw/cmd/player/EmpireResponse.java | 16 +- .../lw/cmd/player/GetNewPlanetCommand.java | 3 +- .../lw/cmd/player/GetNewPlanetResponse.java | 3 +- .../lw/cmd/player/ImplementTechCommand.java | 28 -- .../lw/cmd/player/ListPlanetsCommand.java | 3 +- .../lw/cmd/player/ListPlanetsResponse.java | 3 +- .../lw/cmd/player/OverviewCommand.java | 3 +- .../lw/cmd/player/ViewMapCommand.java | 3 +- .../lw/cmd/player/ViewMapResponse.java | 3 +- .../account/AccountReactivationCommand.java | 3 +- .../account/AccountReactivationResponse.java | 3 +- .../account/AccountValidationCommand.java | 3 +- .../account/AccountValidationResponse.java | 3 +- .../cmd/player/account/BanDetailsCommand.java | 3 +- .../player/account/BanDetailsResponse.java | 3 +- .../cmd/player/account/CancelQuitCommand.java | 3 +- .../cmd/player/account/GetAccountCommand.java | 3 +- .../player/account/GetAccountResponse.java | 3 +- .../player/account/GetLanguageCommand.java | 3 +- .../player/account/GetLanguageResponse.java | 3 +- .../cmd/player/account/QuitGameCommand.java | 3 +- .../cmd/player/account/SetAddressCommand.java | 3 +- .../player/account/SetAddressResponse.java | 3 +- .../player/account/SetLanguageCommand.java | 3 +- .../player/account/SetPasswordCommand.java | 3 +- .../player/account/SetPasswordResponse.java | 3 +- .../player/account/SetPreferencesCommand.java | 3 +- .../player/account/ToggleVacationCommand.java | 3 +- .../account/ValidateSetAddressCommand.java | 3 +- .../account/ValidateSetAddressResponse.java | 3 +- .../alliances/AllianceStatusCommand.java | 3 +- .../alliances/AllianceStatusResponse.java | 3 +- .../player/alliances/CancelJoinCommand.java | 3 +- .../alliances/CreateAllianceCommand.java | 3 +- .../alliances/CreateAllianceResponse.java | 3 +- .../player/alliances/JoinAllianceCommand.java | 3 +- .../alliances/JoinAllianceResponse.java | 3 +- .../player/alliances/KickMembersCommand.java | 3 +- .../alliances/LeaveAllianceCommand.java | 3 +- .../alliances/ManageRequestsCommand.java | 3 +- .../alliances/TransferLeadershipCommand.java | 3 +- .../player/alliances/ViewAllianceCommand.java | 3 +- .../alliances/ViewAllianceResponse.java | 3 +- .../cmd/player/battles/GetBattleCommand.java | 3 +- .../cmd/player/battles/GetBattleResponse.java | 3 +- .../player/battles/ListBattlesCommand.java | 3 +- .../player/battles/ListBattlesResponse.java | 3 +- .../lw/cmd/player/bt/ListBugsResponse.java | 3 +- .../lw/cmd/player/bt/PostCommentResponse.java | 3 +- .../lw/cmd/player/bt/ReportBugResponse.java | 3 +- .../lw/cmd/player/bt/ViewBugResponse.java | 3 +- .../lw/cmd/player/elist/AddEnemyCommand.java | 3 +- .../lw/cmd/player/elist/AddEnemyResponse.java | 3 +- .../lw/cmd/player/elist/EnemyListCommand.java | 3 +- .../cmd/player/elist/EnemyListResponse.java | 3 +- .../player/elist/RemoveEnemiesCommand.java | 3 +- .../player/fleets/DisbandFleetsCommand.java | 4 +- .../player/fleets/DisbandFleetsResponse.java | 3 +- .../cmd/player/fleets/MergeFleetsCommand.java | 4 +- .../player/fleets/MergeFleetsResponse.java | 3 +- .../cmd/player/fleets/MoveFleetsCommand.java | 4 +- .../cmd/player/fleets/MoveFleetsResponse.java | 3 +- .../cmd/player/fleets/MultiFleetsCommand.java | 3 +- .../player/fleets/MultiFleetsResponse.java | 3 +- .../player/fleets/RenameFleetsCommand.java | 4 +- .../player/fleets/RenameFleetsResponse.java | 3 +- .../player/fleets/SetFleetsModeCommand.java | 4 +- .../player/fleets/SetFleetsModeResponse.java | 3 +- .../cmd/player/fleets/SplitFleetCommand.java | 3 +- .../cmd/player/fleets/SplitFleetResponse.java | 3 +- .../cmd/player/fleets/ViewFleetsCommand.java | 3 +- .../cmd/player/fleets/ViewFleetsResponse.java | 3 +- .../lw/cmd/player/gdata/GamePageData.java | 4 +- .../lw/cmd/player/gdata/GameResponseBase.java | 3 +- .../lw/cmd/player/gdata/GameTime.java | 4 +- .../lw/cmd/player/gdata/NameIdPair.java | 4 +- .../lw/cmd/player/gdata/PlanetListData.java | 4 +- .../lw/cmd/player/gdata/PlanetReference.java | 4 +- .../lw/cmd/player/gdata/ShortBattleView.java | 4 +- .../lw/cmd/player/gdata/TimeCombo.java | 4 +- .../cmd/player/gdata/account/AccountData.java | 3 +- .../player/gdata/account/MailChangeData.java | 4 +- .../player/gdata/account/PrefCategory.java | 4 +- .../cmd/player/gdata/account/PrefChoice.java | 4 +- .../cmd/player/gdata/account/PrefValue.java | 4 +- .../alliance/AllianceCreationStatus.java | 3 +- .../player/gdata/alliance/AllianceData.java | 4 +- .../gdata/alliance/AllianceLeaderData.java | 3 +- .../gdata/alliance/AllianceMemberData.java | 3 +- .../gdata/alliance/AlliancePlanetData.java | 4 +- .../alliance/PublicAllianceInformation.java | 4 +- .../gdata/battles/BattleDescription.java | 3 +- .../player/gdata/battles/BattleDisplay.java | 3 +- .../cmd/player/gdata/battles/BattleEvent.java | 4 +- .../gdata/battles/BattleHistoryInterval.java | 3 +- .../gdata/battles/BattleHistoryTick.java | 3 +- .../player/gdata/battles/BattleListEntry.java | 3 +- .../gdata/battles/BattlePlanetBuildings.java | 3 +- .../gdata/battles/BattlePlayerShips.java | 3 +- .../player/gdata/battles/BattleShipType.java | 4 +- .../player/gdata/battles/BattleShipsList.java | 4 +- .../player/gdata/battles/BattleShipsView.java | 4 +- .../player/gdata/battles/BattleSideShips.java | 4 +- .../cmd/player/gdata/battles/BattleView.java | 4 +- .../cmd/player/gdata/empire/OverviewData.java | 4 +- .../cmd/player/gdata/empire/ResearchData.java | 224 +++++++++++ .../player/gdata/empire/ResearchLineData.java | 70 ---- .../gdata/empire/TechnologyCategoryData.java | 55 +++ .../player/gdata/empire/TechnologyData.java | 56 +-- .../player/gdata/fleets/FleetLocation.java | 3 +- .../cmd/player/gdata/fleets/FleetOwner.java | 3 +- .../cmd/player/gdata/fleets/FleetShips.java | 4 +- .../cmd/player/gdata/fleets/FleetsView.java | 4 +- .../cmd/player/gdata/fleets/MovingFleet.java | 3 +- .../player/gdata/fleets/ShortFleetView.java | 3 +- .../cmd/player/gdata/fleets/SplitShips.java | 4 +- .../cmd/player/gdata/fleets/StaticFleet.java | 3 +- .../cmd/player/gdata/map/MapPlanetData.java | 3 +- .../cmd/player/gdata/map/MapSystemData.java | 4 +- .../gdata/planets/BuildableBuildingData.java | 4 +- .../gdata/planets/BuildableItemData.java | 3 +- .../gdata/planets/BuildableShipData.java | 3 +- .../player/gdata/planets/BuildingData.java | 4 +- .../gdata/planets/OwnPlanetStatusData.java | 3 +- .../player/gdata/planets/PlanetBasicView.java | 4 +- .../gdata/planets/PlanetOrbitalView.java | 4 +- .../player/gdata/planets/PlanetOwnView.java | 4 +- .../cmd/player/gdata/planets/QueueData.java | 4 +- .../player/gdata/planets/QueueItemData.java | 3 +- .../player/msgs/ComposeMessageCommand.java | 3 +- .../player/msgs/ComposeMessageResponse.java | 3 +- .../cmd/player/msgs/GetMessagesCommand.java | 3 +- .../cmd/player/msgs/GetMessagesResponse.java | 3 +- .../cmd/player/msgs/ListTargetsCommand.java | 3 +- .../cmd/player/msgs/ListTargetsResponse.java | 3 +- .../lw/cmd/player/msgs/MessageBoxCommand.java | 3 +- .../player/msgs/PrepareMessageCommand.java | 3 +- .../cmd/player/msgs/ReadMessageCommand.java | 3 +- .../cmd/player/msgs/ReadMessageResponse.java | 3 +- .../player/planets/AbandonPlanetCommand.java | 4 +- .../cmd/player/planets/BuildShipsCommand.java | 4 +- .../player/planets/BuildingActionCommand.java | 4 +- .../planets/BuildingActionResponse.java | 3 +- .../cmd/player/planets/FlushQueueCommand.java | 4 +- .../player/planets/RenamePlanetCommand.java | 4 +- .../player/planets/RenamePlanetResponse.java | 3 +- .../cmd/player/planets/ViewPlanetCommand.java | 3 +- .../player/planets/ViewPlanetResponse.java | 3 +- .../player/research/ImplementTechCommand.java | 29 ++ .../research/ResearchOperationResponse.java | 87 +++++ .../SetResearchPrioritiesCommand.java | 32 ++ .../player/research/ViewResearchCommand.java | 15 + .../player/research/ViewResearchResponse.java | 45 +++ .../java/com/deepclone/lw/session/API.java | 15 + .../com/deepclone/lw/session/Command.java | 4 +- .../deepclone/lw/session/CommandResponse.java | 2 +- .../deepclone/lw/session/NullResponse.java | 2 +- .../lw/session/SessionCommandException.java | 2 +- .../lw/session/SessionException.java | 2 +- .../session/SessionIdentifierException.java | 2 +- .../lw/session/SessionInternalException.java | 2 +- .../lw/session/SessionReference.java | 2 +- .../deepclone/lw/session/SessionResponse.java | 2 +- .../lw/session/SessionStateException.java | 2 +- legacyworlds-utils/pom.xml | 4 +- .../WEB-INF/fm/types/technologies.ftl | 22 ++ .../WebContent/WEB-INF/fm/version.ftl | 4 +- .../legacyworlds-web-admin/pom.xml | 4 +- .../lw/web/admin/TechnologyPages.java | 37 ++ .../legacyworlds-web-beans/pom.xml | 4 +- .../deepclone/lw/web/csess/AdminSession.java | 11 + .../deepclone/lw/web/csess/PlayerSession.java | 27 +- .../WebContent/WEB-INF/fm/en/static/home.ftl | 2 +- .../WEB-INF/fm/en/types/overview.ftl | 51 --- .../WEB-INF/fm/en/types/technologies.ftl | 171 ++++++++ .../WEB-INF/fm/fr/types/overview.ftl | 51 --- .../WEB-INF/fm/fr/types/technologies.ftl | 171 ++++++++ .../WebContent/WEB-INF/fm/version.ftl | 4 +- .../WebContent/css/main.css | 57 +++ .../legacyworlds-web-main/pom.xml | 4 +- .../lw/web/main/game/OverviewPage.java | 19 - .../lw/web/main/game/TechnologyPages.java | 143 +++++++ legacyworlds-web/pom.xml | 4 +- pom.xml | 10 +- runsrv.sh | 2 +- runtool.sh | 2 +- 507 files changed, 8866 insertions(+), 2450 deletions(-) create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/esdata/TechnologyInformation.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.classpath create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.project create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.settings/org.eclipse.jdt.core.prefs create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.settings/org.maven.ide.eclipse.prefs create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/pom.xml delete mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/updates/GameUpdateBean.java delete mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/updates/UpdatesDAOBean.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.classpath create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.project create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.settings/org.eclipse.jdt.core.prefs create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.settings/org.maven.ide.eclipse.prefs create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/pom.xml create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/EmpireTechnologyDAOBean.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/EmpireTechnologyManagerBean.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/EmpireUpdate.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/ResearchResponseBuilder.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/ResearchUpdateBean.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/ResearchUpdateDAOBean.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/TechnologyGraphDAOBean.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/TechnologyGraphManagerBean.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs-beans.xml create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/empire-technology-dao-bean.xml create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/empire-technology-manager-bean.xml create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/research-update-bean.xml create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/research-update-dao-bean.xml create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/technology-graph-dao-bean.xml create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/technology-graph-manager-bean.xml create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.classpath create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.project create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.settings/org.eclipse.jdt.core.prefs create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.settings/org.maven.ide.eclipse.prefs create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/pom.xml create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/java/com/deepclone/lw/beans/updates/GameUpdateBean.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/java/com/deepclone/lw/beans/updates/ProceduralGameUpdate.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/java/com/deepclone/lw/beans/updates/UpdatesDAOBean.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/resources/configuration/updates-beans.xml rename legacyworlds-server/legacyworlds-server-beans/{legacyworlds-server-beans-simple/src/main/resources/configuration/simple => legacyworlds-server-beans-updates/src/main/resources/configuration/updates}/game-update-bean.xml (100%) rename legacyworlds-server/legacyworlds-server-beans/{legacyworlds-server-beans-simple/src/main/resources/configuration/simple => legacyworlds-server-beans-updates/src/main/resources/configuration/updates}/updates-dao-bean.xml (100%) create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/admin/main/techs/ListCategoriesCommandDelegateBean.java rename legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/{ => techs}/ImplementTechCommandDelegateBean.java (65%) create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/techs/SetResearchPrioritiesCommandDelegateBean.java create mode 100644 legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/techs/ViewResearchCommandDelegateBean.java create mode 100644 legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/045-research-functions.sql delete mode 100644 legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/EmpireTechLine.java delete mode 100644 legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/EmpireTechnology.java create mode 100644 legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/Category.java create mode 100644 legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/EmpireTechnology.java create mode 100644 legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/ResearchStatus.java create mode 100644 legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/ResearchUpdateInput.java create mode 100644 legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/ResearchUpdateOutput.java create mode 100644 legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/TechGraph.java create mode 100644 legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/TechGraphException.java create mode 100644 legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/Technology.java delete mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/UpdatesDAO.java create mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/EmpireTechnologyDAO.java create mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/EmpireTechnologyManager.java create mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/ResearchUpdateDAO.java create mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/TechnologyGraphDAO.java create mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/TechnologyGraphManager.java create mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/DuplicateUpdateHandler.java create mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdate.java create mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdatePhase.java create mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdatePhaseHandler.java create mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdateTarget.java create mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/UpdatesDAO.java create mode 100644 legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/i18n/LanguageTranslator.java delete mode 100644 legacyworlds-server/legacyworlds-server-main/data/buildables-test.xml delete mode 100644 legacyworlds-server/legacyworlds-server-main/data/techs-test.xml create mode 100644 legacyworlds-server/legacyworlds-server-main/data/text/buildings.xml create mode 100644 legacyworlds-server/legacyworlds-server-main/data/text/mail.xml rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/addressChangeMail-en.txt (82%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/addressChangeMail-fr.txt (83%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/adminErrorMail.txt (76%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/adminRecapMail.txt (73%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/banLiftedMail-en.txt (79%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/banLiftedMail-fr.txt (77%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/bannedMail-en.txt (88%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/bannedMail-fr.txt (90%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/inactivityQuitMail-en.txt (88%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/inactivityQuitMail-fr.txt (88%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/inactivityWarningMail-en.txt (89%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/inactivityWarningMail-fr.txt (91%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/messageMail-en.txt (82%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/messageMail-fr.txt (77%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/passwordRecoveryMail-en.txt (92%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/passwordRecoveryMail-fr.txt (91%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/quitMail-en.txt (91%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/quitMail-fr.txt (85%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/reactivationMail-en.txt (85%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/reactivationMail-fr.txt (87%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/recapMail-en.txt (77%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/recapMail-fr.txt (72%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/registrationMail-en.txt (86%) rename legacyworlds-server/legacyworlds-server-main/data/{ => text/mail}/registrationMail-fr.txt (88%) create mode 100644 legacyworlds-server/legacyworlds-server-main/data/text/preferences.xml create mode 100644 legacyworlds-server/legacyworlds-server-main/data/text/technologies.xml delete mode 100644 legacyworlds-server/legacyworlds-server-main/hibernate.xml create mode 100644 legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/FileString.java create mode 100644 legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/InlineString.java create mode 100644 legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/LanguageData.java create mode 100644 legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/LoadableText.java create mode 100644 legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/Loader.java create mode 100644 legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/StringData.java create mode 100644 legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/TextData.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/GetTechnologyCommand.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/GetTechnologyResponse.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/ListCategoriesCommand.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/ListCategoriesResponse.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/TechCategory.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/TechEntry.java delete mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ImplementTechCommand.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/ResearchData.java delete mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/ResearchLineData.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/TechnologyCategoryData.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ImplementTechCommand.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ResearchOperationResponse.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/SetResearchPrioritiesCommand.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ViewResearchCommand.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ViewResearchResponse.java create mode 100644 legacyworlds-session/src/main/java/com/deepclone/lw/session/API.java create mode 100644 legacyworlds-web/legacyworlds-web-admin/WebContent/WEB-INF/fm/types/technologies.ftl create mode 100644 legacyworlds-web/legacyworlds-web-admin/src/main/java/com/deepclone/lw/web/admin/TechnologyPages.java create mode 100644 legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/en/types/technologies.ftl create mode 100644 legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/fr/types/technologies.ftl create mode 100644 legacyworlds-web/legacyworlds-web-main/src/main/java/com/deepclone/lw/web/main/game/TechnologyPages.java diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-accounts/pom.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-accounts/pom.xml index 093cc46..67b65e7 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-accounts/pom.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-accounts/pom.xml @@ -4,12 +4,12 @@ legacyworlds-server-beans com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-beans-accounts Legacy Worlds account management - 5.99.1 + 5.99.2 This package contains the beans responsible for managing accounts, including registration, inactivity checks, bans and authentication. \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/pom.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/pom.xml index 35ab5e4..80a4b6e 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/pom.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/pom.xml @@ -4,7 +4,7 @@ legacyworlds-server-beans com.deepclone.lw - 5.99.1 + 5.99.2 @@ -20,6 +20,6 @@ com.deepclone.lw legacyworlds-server-beans-bt - 5.99.1 + 5.99.2 Legacy Worlds bug tracking system \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/EmpireSummaryBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/EmpireSummaryBean.java index 07c8949..a6823f7 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/EmpireSummaryBean.java +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/EmpireSummaryBean.java @@ -28,6 +28,7 @@ public class EmpireSummaryBean private final RowMapper< DebugInformation > mMainInfo; private final RowMapper< ResearchInformation > mResearch; + private final RowMapper< TechnologyInformation > mTechnology; private final RowMapper< PlanetInformation > mPlanet; private final RowMapper< QueueItemInformation > mQueueItem; private final RowMapper< BuildingsInformation > mBuildings; @@ -42,7 +43,8 @@ public class EmpireSummaryBean AccountInformation.class , AllianceInformation.class , BuildingsInformation.class , DebugInformation.class , EmpireInformation.class , FleetInformation.class , MovementInformation.class , PlanetInformation.class , QueueInformation.class , QueueItemInformation.class , - ResearchInformation.class , ShipsInformation.class , SystemInformation.class + ResearchInformation.class , TechnologyInformation.class , ShipsInformation.class , + SystemInformation.class } ); this.mMainInfo = new RowMapper< DebugInformation >( ) { @@ -83,13 +85,23 @@ public class EmpireSummaryBean throws SQLException { ResearchInformation ri = new ResearchInformation( ); - ri.setId( rs.getInt( "line_id" ) ); - ri.setCurrentLevel( rs.getInt( "level" ) ); - ri.setLevelName( rs.getString( "name" ) ); + ri.setName( rs.getString( "name" ) ); ri.setAccumulated( rs.getDouble( "accumulated" ) ); + ri.setPriority( rs.getInt( "priority" ) ); return ri; } }; + this.mTechnology = new RowMapper< TechnologyInformation >( ) { + @Override + public TechnologyInformation mapRow( ResultSet rs , int rowNum ) + throws SQLException + { + TechnologyInformation ti = new TechnologyInformation( ); + ti.setName( rs.getString( "name" ) ); + ti.setImplemented( rs.getBoolean( "implemented" ) ); + return ti; + } + }; this.mPlanet = new RowMapper< PlanetInformation >( ) { @Override public PlanetInformation mapRow( ResultSet rs , int rowNum ) @@ -199,9 +211,10 @@ public class EmpireSummaryBean DebugInformation di = this.dTemplate.queryForObject( sql , this.mMainInfo , empireId ); sql = "SELECT * FROM bugs.dump_research_view WHERE empire_id = ?"; - for ( ResearchInformation ri : this.dTemplate.query( sql , this.mResearch , empireId ) ) { - di.getResearch( ).add( ri ); - } + di.getResearch( ).addAll( this.dTemplate.query( sql , this.mResearch , empireId ) ); + + sql = "SELECT * FROM bugs.dump_technologies_view WHERE empire_id = ?"; + di.getTechnologies( ).addAll( this.dTemplate.query( sql , this.mTechnology , empireId ) ); sql = "SELECT * FROM bugs.dump_planets_view WHERE empire_id = ?"; Map< Integer , PlanetInformation > planets = new HashMap< Integer , PlanetInformation >( ); diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/esdata/DebugInformation.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/esdata/DebugInformation.java index 847fcb1..2a676e0 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/esdata/DebugInformation.java +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/esdata/DebugInformation.java @@ -15,26 +15,29 @@ public class DebugInformation implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 2L; @XStreamAsAttribute @XStreamAlias( "dump-version" ) - private int version = 1; + private final int version = 2; - private SystemInformation system = new SystemInformation( ); + private final SystemInformation system = new SystemInformation( ); - private AccountInformation account = new AccountInformation( ); + private final AccountInformation account = new AccountInformation( ); - private EmpireInformation empire = new EmpireInformation( ); + private final EmpireInformation empire = new EmpireInformation( ); @XStreamAlias( "research" ) - private List< ResearchInformation > research = new LinkedList< ResearchInformation >( ); + private final List< ResearchInformation > research = new LinkedList< ResearchInformation >( ); + + @XStreamAlias( "technologies" ) + private final List< TechnologyInformation > technologies = new LinkedList< TechnologyInformation >( ); @XStreamAlias( "planets" ) - private List< PlanetInformation > planets = new LinkedList< PlanetInformation >( ); + private final List< PlanetInformation > planets = new LinkedList< PlanetInformation >( ); @XStreamAlias( "fleets" ) - private List< FleetInformation > fleets = new LinkedList< FleetInformation >( ); + private final List< FleetInformation > fleets = new LinkedList< FleetInformation >( ); public int getVersion( ) @@ -67,6 +70,12 @@ public class DebugInformation } + public List< TechnologyInformation > getTechnologies( ) + { + return technologies; + } + + public List< PlanetInformation > getPlanets( ) { return planets; @@ -78,4 +87,4 @@ public class DebugInformation return fleets; } -} +} \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/esdata/ResearchInformation.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/esdata/ResearchInformation.java index 69d9f63..ec90c4a 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/esdata/ResearchInformation.java +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/esdata/ResearchInformation.java @@ -8,64 +8,34 @@ import com.thoughtworks.xstream.annotations.XStreamAsAttribute; -@XStreamAlias( "research-line" ) +@XStreamAlias( "research-topic" ) public class ResearchInformation implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 2L; @XStreamAsAttribute - @XStreamAlias( "line") - private int id; - - @XStreamAsAttribute - @XStreamAlias( "level") - private int currentLevel; + private String name; @XStreamAsAttribute - @XStreamAlias( "name") - private String levelName; - - @XStreamAsAttribute - @XStreamAlias( "accumulated-points") + @XStreamAlias( "accumulated-points" ) private double accumulated; + @XStreamAsAttribute + private int priority; - public int getId( ) + + public String getName( ) { - return id; + return name; } - public void setId( int id ) + public void setName( String name ) { - this.id = id; - } - - - public int getCurrentLevel( ) - { - return currentLevel; - } - - - public void setCurrentLevel( int currentLevel ) - { - this.currentLevel = currentLevel; - } - - - public String getLevelName( ) - { - return levelName; - } - - - public void setLevelName( String levelName ) - { - this.levelName = levelName; + this.name = name; } @@ -80,4 +50,16 @@ public class ResearchInformation this.accumulated = accumulated; } + + public int getPriority( ) + { + return priority; + } + + + public void setPriority( int priority ) + { + this.priority = priority; + } + } diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/esdata/TechnologyInformation.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/esdata/TechnologyInformation.java new file mode 100644 index 0000000..0839378 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/esdata/TechnologyInformation.java @@ -0,0 +1,48 @@ +package com.deepclone.lw.beans.bt.esdata; + + +import java.io.Serializable; + +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; + + + +@XStreamAlias( "technology" ) +public class TechnologyInformation + implements Serializable +{ + + private static final long serialVersionUID = 1L; + + @XStreamAsAttribute + private String name; + + @XStreamAsAttribute + private boolean implemented; + + + public String getName( ) + { + return name; + } + + + public void setName( String name ) + { + this.name = name; + } + + + public boolean isImplemented( ) + { + return implemented; + } + + + public void setImplemented( boolean implemented ) + { + this.implemented = implemented; + } + +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-eventlog/pom.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-eventlog/pom.xml index 0305043..939d46e 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-eventlog/pom.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-eventlog/pom.xml @@ -4,12 +4,12 @@ legacyworlds-server-beans com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-beans-eventlog - 5.99.1 + 5.99.2 Legacy Worlds event log This package is responsible for all logging in Legacy Worlds through three different beans (system event logger, admin event logger and user event logger). \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.classpath b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.classpath new file mode 100644 index 0000000..7c3d14f --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.project b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.project new file mode 100644 index 0000000..99714d6 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.project @@ -0,0 +1,23 @@ + + + legacyworlds-server-beans-events + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.settings/org.eclipse.jdt.core.prefs b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..6839360 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,6 @@ +#Sun Apr 03 09:36:59 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.settings/org.maven.ide.eclipse.prefs b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 0000000..abbef3f --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Sun Apr 03 09:36:59 CEST 2011 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/pom.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/pom.xml new file mode 100644 index 0000000..143c198 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-events/pom.xml @@ -0,0 +1,13 @@ + + 4.0.0 + + legacyworlds-server-beans + com.deepclone.lw + 5.99.2 + + com.deepclone.lw + legacyworlds-server-beans-events + 5.99.2 + Game events + This module contains components which manage game events. + \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-i18n/pom.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-i18n/pom.xml index 26ad335..a3f0ce7 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-i18n/pom.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-i18n/pom.xml @@ -4,13 +4,13 @@ legacyworlds-server-beans com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-beans-i18n Legacy Worlds internationalisation - 5.99.1 + 5.99.2 This package defines the two beans which control server-side internationalised text management. \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-i18n/src/main/java/com/deepclone/lw/beans/i18n/TranslatorBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-i18n/src/main/java/com/deepclone/lw/beans/i18n/TranslatorBean.java index 7ce8046..7ef4255 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-i18n/src/main/java/com/deepclone/lw/beans/i18n/TranslatorBean.java +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-i18n/src/main/java/com/deepclone/lw/beans/i18n/TranslatorBean.java @@ -6,6 +6,7 @@ import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; +import com.deepclone.lw.interfaces.i18n.LanguageTranslator; import com.deepclone.lw.interfaces.i18n.Translator; import com.deepclone.lw.interfaces.i18n.UnknownLanguageException; import com.deepclone.lw.interfaces.i18n.UnknownStringException; @@ -21,6 +22,67 @@ import com.deepclone.lw.interfaces.i18n.UnknownStringException; public class TranslatorBean implements Translator { + + /** + * Implementation of a language-specific translator. + */ + private static class LanguageTranslatorImpl + implements LanguageTranslator + { + /** Language used by the translator */ + private final String language; + + /** Translations store */ + private final I18NData data; + + + LanguageTranslatorImpl( String language , TranslatorBean translator ) + { + this.language = language; + this.data = translator.data; + } + + + /* Documentation in LanguageTranslator interface */ + @Override + public String getLanguage( ) + { + return this.language; + } + + + /* Documentation in LanguageTranslator interface */ + @Override + public String getLanguageName( ) + { + this.data.readLock( ).lock( ); + try { + return this.data.getLanguageName( language ); + } finally { + this.data.readLock( ).unlock( ); + } + } + + + /* Documentation in LanguageTranslator interface */ + @Override + public String translate( String string ) + throws UnknownStringException + { + this.data.readLock( ).lock( ); + try { + if ( !this.data.hasString( string ) ) { + throw new UnknownStringException( string ); + } + return this.data.getTranslation( language , string ); + } finally { + this.data.readLock( ).unlock( ); + } + } + + } + + /** Translations store */ private I18NData data; @@ -119,4 +181,21 @@ public class TranslatorBean } } + + /* Documentation in Translator interface */ + @Override + public LanguageTranslator getLanguageTranslator( String language ) + throws UnknownLanguageException + { + this.data.readLock( ).lock( ); + try { + if ( !this.data.isLanguageComplete( language ) ) { + throw new UnknownLanguageException( language ); + } + return new LanguageTranslatorImpl( language , this ); + } finally { + this.data.readLock( ).unlock( ); + } + } + } diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-mailer/pom.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-mailer/pom.xml index 9b2eba1..4bdff1a 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-mailer/pom.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-mailer/pom.xml @@ -4,12 +4,12 @@ legacyworlds-server-beans com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-beans-mailer - 5.99.1 + 5.99.2 Legacy Worlds mailer This package contains the mailer component, which uses LW's i18n system and Spring's mail sending interfaces. diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-naming/pom.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-naming/pom.xml index 00964d7..59a113f 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-naming/pom.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-naming/pom.xml @@ -4,12 +4,12 @@ legacyworlds-server-beans com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-beans-naming - 5.99.1 + 5.99.2 Legacy Worlds object naming system This module contains the beans responsible for managing the names of the various objects (players and planets). \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/pom.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/pom.xml index e1929cf..ea2e695 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/pom.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/pom.xml @@ -3,11 +3,11 @@ legacyworlds-server-beans com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-beans-simple - 5.99.1 + 5.99.2 Legacy Worlds simple game This module contains code that corresponds to a simple "placeholder" game. This code should become obsolete over time, as it is being replaced with actual LWB6 code, until the module can finally be removed. \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/empire/EmpireDAOBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/empire/EmpireDAOBean.java index daaa57b..5e30025 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/empire/EmpireDAOBean.java +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/empire/EmpireDAOBean.java @@ -4,9 +4,7 @@ package com.deepclone.lw.beans.empire; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; -import java.util.HashMap; import java.util.List; -import java.util.Map; import javax.sql.DataSource; @@ -20,8 +18,6 @@ import com.deepclone.lw.cmd.player.gdata.NameIdPair; import com.deepclone.lw.cmd.player.gdata.PlanetListData; import com.deepclone.lw.cmd.player.gdata.empire.OverviewData; import com.deepclone.lw.interfaces.game.EmpireDAO; -import com.deepclone.lw.sqld.game.EmpireTechLine; -import com.deepclone.lw.sqld.game.EmpireTechnology; import com.deepclone.lw.sqld.game.GeneralInformation; import com.deepclone.lw.utils.StoredProc; @@ -31,7 +27,6 @@ public class EmpireDAOBean implements EmpireDAO { private SimpleJdbcTemplate dTemplate; - private StoredProc fImplementTech; private StoredProc fAddEmpEnemy; private StoredProc fAddAllEnemy; private StoredProc fRemoveEmpEnemy; @@ -40,16 +35,36 @@ public class EmpireDAOBean private final PlanetListMapper mPlanetList = new PlanetListMapper( ); + private final RowMapper< GeneralInformation > mEmpireInfo; + + + public EmpireDAOBean( ) + { + this.mEmpireInfo = new RowMapper< GeneralInformation >( ) { + @Override + public GeneralInformation mapRow( ResultSet rs , int rowNum ) + throws SQLException + { + String st = rs.getString( "status" ); + Character status = ( st == null ) ? null : st.charAt( 0 ); + String name = rs.getString( "name" ); + String tag = rs.getString( "alliance" ); + String language = rs.getString( "language" ); + long cash = rs.getLong( "cash" ); + long nextTick = rs.getLong( "game_time" ); + int accountId = rs.getInt( "account_id" ); + return new GeneralInformation( status , name , tag , language , cash , nextTick , accountId ); + } + }; + + } + @Autowired( required = true ) public void setDataSource( DataSource dataSource ) { this.dTemplate = new SimpleJdbcTemplate( dataSource ); - this.fImplementTech = new StoredProc( dataSource , "emp" , "implement_tech" ); - this.fImplementTech.addParameter( "empire_id" , Types.INTEGER ); - this.fImplementTech.addParameter( "line_id" , Types.INTEGER ); - this.fAddEmpEnemy = new StoredProc( dataSource , "emp" , "add_enemy_empire" ); this.fAddEmpEnemy.addParameter( "empire_id" , Types.INTEGER ); this.fAddEmpEnemy.addParameter( "enemy_name" , Types.VARCHAR ); @@ -79,19 +94,8 @@ public class EmpireDAOBean public GeneralInformation getInformation( int empireId ) { String sql = "SELECT * FROM emp.general_information WHERE id = ?"; - RowMapper< GeneralInformation > mapper = new RowMapper< GeneralInformation >( ) { - @Override - public GeneralInformation mapRow( ResultSet rs , int rowNum ) - throws SQLException - { - String st = rs.getString( "status" ); - Character status = ( st == null ) ? null : st.charAt( 0 ); - return new GeneralInformation( status , rs.getString( "name" ) , rs.getString( "alliance" ) , rs - .getLong( "cash" ) , rs.getLong( "game_time" ) , rs.getInt( "account_id" ) ); - } - }; try { - return this.dTemplate.queryForObject( sql , mapper , empireId ); + return this.dTemplate.queryForObject( sql , this.mEmpireInfo , empireId ); } catch ( EmptyResultDataAccessException e ) { return null; } @@ -156,65 +160,6 @@ public class EmpireDAOBean } - @Override - public List< EmpireTechLine > getTechnology( int empireId ) - { - String sql = "SELECT * FROM emp.tech_lines_view WHERE empire = ?"; - RowMapper< EmpireTechLine > lineMapper = new RowMapper< EmpireTechLine >( ) { - @Override - public EmpireTechLine mapRow( ResultSet rs , int rowNum ) - throws SQLException - { - EmpireTechLine etl = new EmpireTechLine( ); - etl.setId( rs.getInt( "tech_line" ) ); - etl.setName( rs.getString( "name" ) ); - etl.setDescription( rs.getString( "description" ) ); - return etl; - } - }; - - List< EmpireTechLine > lines = this.dTemplate.query( sql , lineMapper , empireId ); - if ( lines.isEmpty( ) ) { - return lines; - } - - Map< Integer , EmpireTechLine > linesById = new HashMap< Integer , EmpireTechLine >( ); - for ( EmpireTechLine etl : lines ) { - linesById.put( etl.getId( ) , etl ); - } - - sql = "SELECT * FROM emp.technologies_view WHERE empire = ?"; - RowMapper< EmpireTechnology > techMapper = new RowMapper< EmpireTechnology >( ) { - @Override - public EmpireTechnology mapRow( ResultSet rs , int rowNum ) - throws SQLException - { - EmpireTechnology et = new EmpireTechnology( ); - et.setLine( rs.getInt( "tech_line" ) ); - et.setName( rs.getString( "name" ) ); - et.setDescription( rs.getString( "description" ) ); - et.setImplemented( rs.getBoolean( "implemented" ) ); - et.setProgress( (int) rs.getDouble( "progress" ) ); - et.setCost( rs.getInt( "cost" ) ); - return et; - } - }; - - for ( EmpireTechnology et : this.dTemplate.query( sql , techMapper , empireId ) ) { - linesById.get( et.getLine( ) ).addTechnology( et ); - } - - return lines; - } - - - @Override - public void implementTechnology( int empireId , int lineId ) - { - this.fImplementTech.execute( empireId , lineId ); - } - - @Override public List< PlanetListData > getPlanetList( int empireId ) { diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/empire/EmpireManagementBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/empire/EmpireManagementBean.java index 18a9571..0fc3d79 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/empire/EmpireManagementBean.java +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/empire/EmpireManagementBean.java @@ -18,19 +18,18 @@ import com.deepclone.lw.cmd.player.gdata.NameIdPair; import com.deepclone.lw.cmd.player.gdata.PlanetListData; import com.deepclone.lw.cmd.player.gdata.battles.BattleListEntry; import com.deepclone.lw.cmd.player.gdata.empire.OverviewData; -import com.deepclone.lw.cmd.player.gdata.empire.ResearchLineData; -import com.deepclone.lw.cmd.player.gdata.empire.TechnologyData; import com.deepclone.lw.interfaces.acm.UsersDAO; import com.deepclone.lw.interfaces.game.BattlesCache; import com.deepclone.lw.interfaces.game.BattlesDAO; import com.deepclone.lw.interfaces.game.EmpireDAO; import com.deepclone.lw.interfaces.game.EmpireManagement; +import com.deepclone.lw.interfaces.i18n.LanguageTranslator; +import com.deepclone.lw.interfaces.i18n.Translator; +import com.deepclone.lw.interfaces.i18n.UnknownLanguageException; import com.deepclone.lw.interfaces.naming.NamingDAO; import com.deepclone.lw.interfaces.prefs.AccountPreferences; import com.deepclone.lw.interfaces.prefs.PreferencesDAO; import com.deepclone.lw.sqld.accounts.Account; -import com.deepclone.lw.sqld.game.EmpireTechLine; -import com.deepclone.lw.sqld.game.EmpireTechnology; import com.deepclone.lw.sqld.game.GeneralInformation; import com.deepclone.lw.sqld.game.battle.BattleListRecord; import com.deepclone.lw.utils.EmailAddress; @@ -46,6 +45,7 @@ public class EmpireManagementBean private EmpireDAO empireDao; private PreferencesDAO prefsDao; private BattlesDAO battlesDao; + private Translator translator; @Autowired( required = true ) @@ -83,6 +83,13 @@ public class EmpireManagementBean } + @Autowired( required = true ) + public void setI18NManager( Translator translator ) + { + this.translator = translator; + } + + @Override public Integer getEmpireId( EmailAddress address ) { @@ -108,29 +115,22 @@ public class EmpireManagementBean } + @Override + public LanguageTranslator getTranslator( int empireId ) + { + GeneralInformation generalInformation = this.empireDao.getInformation( empireId ); + try { + return this.translator.getLanguageTranslator( generalInformation.getLanguage( ) ); + } catch ( UnknownLanguageException e ) { + throw new RuntimeException( "account for empire " + empireId + " is using an unsupported language" , e ); + } + } + + @Override public EmpireResponse getOverview( int empireId ) { OverviewData overview = this.empireDao.getOverview( empireId ); - List< ResearchLineData > research = new LinkedList< ResearchLineData >( ); - - for ( EmpireTechLine etl : this.empireDao.getTechnology( empireId ) ) { - List< TechnologyData > implemented = new LinkedList< TechnologyData >( ); - TechnologyData current = null; - - for ( EmpireTechnology et : etl.getTechnologies( ) ) { - if ( et.isImplemented( ) ) { - implemented.add( new TechnologyData( et.getName( ) , et.getDescription( ) ) ); - } else if ( et.getProgress( ) == 100 ) { - current = new TechnologyData( et.getName( ) , et.getDescription( ) , 100 , et.getCost( ) ); - } else { - current = new TechnologyData( et.getName( ) , et.getDescription( ) , et.getProgress( ) ); - } - } - - research.add( new ResearchLineData( etl.getId( ) , etl.getName( ) , etl.getDescription( ) , implemented , - current ) ); - } List< BattleListEntry > battles = new LinkedList< BattleListEntry >( ); for ( BattleListRecord record : this.battlesDao.getBattles( empireId ) ) { @@ -150,15 +150,7 @@ public class EmpireManagementBean battles.add( entry ); } - return new EmpireResponse( this.getGeneralInformation( empireId ) , overview , research , battles ); - } - - - @Override - public EmpireResponse implementTechnology( int empireId , int techId ) - { - this.empireDao.implementTechnology( empireId , techId ); - return this.getOverview( empireId ); + return new EmpireResponse( this.getGeneralInformation( empireId ) , overview , battles ); } diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/updates/GameUpdateBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/updates/GameUpdateBean.java deleted file mode 100644 index 3973457..0000000 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/updates/GameUpdateBean.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.deepclone.lw.beans.updates; - - -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.TransactionStatus; -import org.springframework.transaction.support.TransactionCallback; -import org.springframework.transaction.support.TransactionTemplate; - -import com.deepclone.lw.cmd.admin.logs.LogLevel; -import com.deepclone.lw.interfaces.eventlog.Logger; -import com.deepclone.lw.interfaces.eventlog.SystemLogger; -import com.deepclone.lw.interfaces.game.UpdatesDAO; -import com.deepclone.lw.interfaces.sys.MaintenanceStatusException; -import com.deepclone.lw.interfaces.sys.SystemStatus; -import com.deepclone.lw.interfaces.sys.TickStatusException; -import com.deepclone.lw.interfaces.sys.Ticker; -import com.deepclone.lw.interfaces.sys.Ticker.Frequency; - - - -public class GameUpdateBean - implements InitializingBean , Runnable -{ - private Ticker ticker; - private SystemStatus systemStatus; - private SystemLogger logger; - - private TransactionTemplate tTemplate; - private UpdatesDAO updatesDao; - - - @Autowired( required = true ) - public void setTicker( Ticker ticker ) - { - this.ticker = ticker; - } - - - @Autowired( required = true ) - public void setSystemStatus( SystemStatus systemStatus ) - { - this.systemStatus = systemStatus; - } - - - @Autowired( required = true ) - public void setLogger( Logger logger ) - { - this.logger = logger.getSystemLogger( "GameUpdate" ); - } - - - @Autowired( required = true ) - public void setTransactionManager( PlatformTransactionManager transactionManager ) - { - this.tTemplate = new TransactionTemplate( transactionManager ); - } - - - @Autowired( required = true ) - public void setUpdatesDAO( UpdatesDAO updatesDao ) - { - this.updatesDao = updatesDao; - } - - - @Override - public void afterPropertiesSet( ) - { - try { - this.endPreviousTick( ); - } catch ( MaintenanceStatusException e ) { - // Do nothing - } - this.ticker.registerTask( Frequency.MINUTE , "Game update" , this ); - } - - - @Override - public void run( ) - { - // Attempt to end the previous tick, if e.g. maintenance mode was initiated while it was - // being processed - try { - this.endPreviousTick( ); - } catch ( MaintenanceStatusException e1 ) { - return; - } - - // Initiate next tick - long tickId; - try { - tickId = this.systemStatus.startTick( ); - } catch ( TickStatusException e ) { - throw new RuntimeException( "tick initiated while previous tick still being processed" , e ); - } catch ( MaintenanceStatusException e ) { - return; - } - - // Execute tick - this.logger.log( LogLevel.DEBUG , "Tick " + tickId + " started" ).flush( ); - this.executeTick( tickId ); - } - - - private void endPreviousTick( ) - throws MaintenanceStatusException - { - Long currentTick = this.systemStatus.checkStuckTick( ); - if ( currentTick == null ) { - return; - } - - this.logger.log( LogLevel.WARNING , "Tick " + currentTick + " restarted" ).flush( ); - this.executeTick( currentTick.longValue( ) ); - } - - - private void executeTick( final long tickId ) - { - boolean hasMore; - do { - hasMore = this.tTemplate.execute( new TransactionCallback< Boolean >( ) { - - @Override - public Boolean doInTransaction( TransactionStatus status ) - { - return updatesDao.processUpdates( tickId ); - } - - } ); - } while ( hasMore ); - this.logger.log( LogLevel.TRACE , "Tick " + tickId + " completed" ).flush( ); - } - -} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/updates/UpdatesDAOBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/updates/UpdatesDAOBean.java deleted file mode 100644 index 77a1bbd..0000000 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/updates/UpdatesDAOBean.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.deepclone.lw.beans.updates; - - -import java.sql.Types; -import java.util.Map; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.SqlOutParameter; -import org.springframework.jdbc.core.SqlParameter; -import org.springframework.jdbc.core.simple.SimpleJdbcCall; - -import com.deepclone.lw.interfaces.game.UpdatesDAO; - - - -public class UpdatesDAOBean - implements UpdatesDAO -{ - - private SimpleJdbcCall process; - - - @Autowired( required = true ) - public void setDataSource( DataSource dataSource ) - { - this.process = new SimpleJdbcCall( dataSource ); - this.process.withCatalogName( "sys" ).withFunctionName( "process_updates" ); - this.process.withoutProcedureColumnMetaDataAccess( ); - this.process.addDeclaredParameter( new SqlParameter( "tick_id" , Types.BIGINT ) ); - this.process.addDeclaredParameter( new SqlOutParameter( "has_more" , Types.BOOLEAN ) ); - } - - - @Override - public boolean processUpdates( long tickId ) - { - Map< String , Object > m = this.process.execute( tickId ); - return (Boolean) m.get( "has_more" ); - } - -} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/resources/configuration/simple-beans.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/resources/configuration/simple-beans.xml index ffd1068..a6219d9 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/resources/configuration/simple-beans.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/resources/configuration/simple-beans.xml @@ -10,13 +10,11 @@ - - diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/pom.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/pom.xml index 47dfd4f..593f8fb 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/pom.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/pom.xml @@ -4,12 +4,12 @@ legacyworlds-server-beans com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-beans-system - 5.99.1 + 5.99.2 Legacy Worlds system management This module regroups system management beans such as the constants manager. \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsData.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsData.java index 4096acd..2712a22 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsData.java +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsData.java @@ -93,7 +93,7 @@ class ConstantsData this.uocConstantNoBounds.addDeclaredParameter( new SqlParameter( "cname" , Types.VARCHAR ) ); this.uocConstantNoBounds.addDeclaredParameter( new SqlParameter( "cdesc" , Types.VARCHAR ) ); this.uocConstantNoBounds.addDeclaredParameter( new SqlParameter( "catname" , Types.VARCHAR ) ); - this.uocConstantNoBounds.addDeclaredParameter( new SqlParameter( "value" , Types.REAL ) ); + this.uocConstantNoBounds.addDeclaredParameter( new SqlParameter( "value" , Types.DOUBLE ) ); this.uocConstantSingleBound = new SimpleJdbcCall( dataSource ); this.uocConstantSingleBound.withCatalogName( "sys" ).withFunctionName( "uoc_constant" ); @@ -101,8 +101,8 @@ class ConstantsData this.uocConstantSingleBound.addDeclaredParameter( new SqlParameter( "cname" , Types.VARCHAR ) ); this.uocConstantSingleBound.addDeclaredParameter( new SqlParameter( "cdesc" , Types.VARCHAR ) ); this.uocConstantSingleBound.addDeclaredParameter( new SqlParameter( "catname" , Types.VARCHAR ) ); - this.uocConstantSingleBound.addDeclaredParameter( new SqlParameter( "value" , Types.REAL ) ); - this.uocConstantSingleBound.addDeclaredParameter( new SqlParameter( "boundary" , Types.REAL ) ); + this.uocConstantSingleBound.addDeclaredParameter( new SqlParameter( "value" , Types.DOUBLE ) ); + this.uocConstantSingleBound.addDeclaredParameter( new SqlParameter( "boundary" , Types.DOUBLE ) ); this.uocConstantSingleBound.addDeclaredParameter( new SqlParameter( "is_min" , Types.BOOLEAN ) ); this.uocConstantTwoBounds = new SimpleJdbcCall( dataSource ); @@ -111,13 +111,13 @@ class ConstantsData this.uocConstantTwoBounds.addDeclaredParameter( new SqlParameter( "cname" , Types.VARCHAR ) ); this.uocConstantTwoBounds.addDeclaredParameter( new SqlParameter( "cdesc" , Types.VARCHAR ) ); this.uocConstantTwoBounds.addDeclaredParameter( new SqlParameter( "catname" , Types.VARCHAR ) ); - this.uocConstantTwoBounds.addDeclaredParameter( new SqlParameter( "value" , Types.REAL ) ); - this.uocConstantTwoBounds.addDeclaredParameter( new SqlParameter( "min" , Types.REAL ) ); - this.uocConstantTwoBounds.addDeclaredParameter( new SqlParameter( "max" , Types.REAL ) ); + this.uocConstantTwoBounds.addDeclaredParameter( new SqlParameter( "value" , Types.DOUBLE ) ); + this.uocConstantTwoBounds.addDeclaredParameter( new SqlParameter( "min" , Types.DOUBLE ) ); + this.uocConstantTwoBounds.addDeclaredParameter( new SqlParameter( "max" , Types.DOUBLE ) ); this.fSetConstant = new StoredProc( dataSource , "sys" , "set_constant" ); this.fSetConstant.addParameter( "cname" , Types.VARCHAR ); - this.fSetConstant.addParameter( "value" , Types.REAL ); + this.fSetConstant.addParameter( "value" , Types.DOUBLE ); this.fSetConstant.addParameter( "admin" , Types.INTEGER ); this.tTemplate = tTemplate; @@ -149,8 +149,8 @@ class ConstantsData c.setName( rs.getString( "name" ) ); c.setDescription( rs.getString( "description" ) ); c.setValue( rs.getDouble( "value" ) ); - c.setMinValue( (Float) rs.getObject( "min" ) ); - c.setMaxValue( (Float) rs.getObject( "max" ) ); + c.setMinValue( (Double) rs.getObject( "min" ) ); + c.setMaxValue( (Double) rs.getObject( "max" ) ); return c; } @@ -609,7 +609,7 @@ class ConstantsData @Override protected void doInTransactionWithoutResult( TransactionStatus status ) { - fSetConstant.execute( name , value.floatValue( ) , admin ); + fSetConstant.execute( name , value , admin ); } } ); diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsManagerBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsManagerBean.java index 04064d3..6a73a8c 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsManagerBean.java +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsManagerBean.java @@ -1,8 +1,9 @@ package com.deepclone.lw.beans.sys; +import java.util.Arrays; import java.util.Collection; -import java.util.Set; +import java.util.HashSet; import javax.sql.DataSource; @@ -92,9 +93,10 @@ public class ConstantsManagerBean /* Documented in ConstantsManager interface */ @Override - public void registerUser( ConstantsUser user , Set< String > constants ) + public void registerUser( ConstantsUser user , String... constants ) { - this.data.registerUser( user , constants ); + HashSet< String > cSet = new HashSet< String >( Arrays.asList( constants ) ); + this.data.registerUser( user , cSet ); } @@ -112,4 +114,5 @@ public class ConstantsManagerBean { return new ConstantsAdministrationImpl( this.data , admin ); } + } diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsRegistrarBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsRegistrarBean.java index 59743d9..cd8379e 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsRegistrarBean.java +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/ConstantsRegistrarBean.java @@ -89,7 +89,7 @@ public class ConstantsRegistrarBean // Work and income String[] wcNames = { "population" , "factory" , "strikeEffect" , "wuPerPopUnit" , "destructionRecovery" , "destructionWork" , - "rpPerPopUnit" , "cancelRecovery" + "cancelRecovery" }; for ( int i = 0 ; i < wcNames.length ; i++ ) { wcNames[ i ] = "game.work." + wcNames[ i ]; @@ -107,10 +107,8 @@ public class ConstantsRegistrarBean defs.add( new ConstantDefinition( wcNames[ 4 ] , cat , cDesc , 0.1 , 0.01 , 0.99 ) ); cDesc = "Proportion of a building's construction work units required to destroy it"; defs.add( new ConstantDefinition( wcNames[ 5 ] , cat , cDesc , 0.25 , 0.01 , 1.0 ) ); - cDesc = "Research points per population unit."; - defs.add( new ConstantDefinition( wcNames[ 6 ] , cat , cDesc , 0.50 , 0.01 , true ) ); cDesc = "Proportion of queue investments that is recovered when flushing the queue."; - defs.add( new ConstantDefinition( wcNames[ 7 ] , cat , cDesc , 0.1 , 0.01 , 1.0 ) ); + defs.add( new ConstantDefinition( wcNames[ 6 ] , cat , cDesc , 0.1 , 0.01 , 1.0 ) ); // Vacation mode cDesc = "Initial vacation credits."; @@ -155,7 +153,7 @@ public class ConstantsRegistrarBean // Ticker cDesc = "Interval between ticks with the highest frequency, in milliseconds."; defs.add( new ConstantDefinition( "ticker.interval" , "Ticker" , cDesc , 5000.0 , 1000.0 , true ) ); - + // Accounts cDesc = "Minimal interval between address change requests (seconds)"; defs.add( new ConstantDefinition( "accounts.acrDelay" , "Accounts" , cDesc , 14400.0 , 1.0 , true ) ); @@ -169,32 +167,43 @@ public class ConstantsRegistrarBean defs.add( new ConstantDefinition( "accounts.banDelay" , "Accounts" , cDesc , 178000.0 , 3600.0 , true ) ); cDesc = "Delay before a ban request expires (seconds)"; defs.add( new ConstantDefinition( "accounts.banExpiration" , "Accounts" , cDesc , oneWeek , 3600.0 , true ) ); - + // Accounts - warnings cDesc = "Amount of warnings that triggers an automatic ban request."; - defs.add( new ConstantDefinition( "accounts.warnings.autoBan" , "Accounts - Warnings" , cDesc , 3.0 , 1.0 , true ) ); + defs.add( new ConstantDefinition( "accounts.warnings.autoBan" , "Accounts - Warnings" , cDesc , 3.0 , 1.0 , + true ) ); cDesc = "Period after a warning is received during which additional warnings will be ignored (seconds)."; - defs.add( new ConstantDefinition( "accounts.warnings.grace" , "Accounts - Warnings" , cDesc , 7200.0 , 60.0 , true ) ); + defs.add( new ConstantDefinition( "accounts.warnings.grace" , "Accounts - Warnings" , cDesc , 7200.0 , 60.0 , + true ) ); cDesc = "Time after which warnings are decreased (expressed in units as defined by a.w.expiration.units)."; - defs.add( new ConstantDefinition( "accounts.warnings.expiration" , "Accounts - Warnings" , cDesc , 60.0 , 1.0 , true ) ); + defs.add( new ConstantDefinition( "accounts.warnings.expiration" , "Accounts - Warnings" , cDesc , 60.0 , 1.0 , + true ) ); cDesc = "Units used to express warning expiration time (seconds)."; - defs.add( new ConstantDefinition( "accounts.warnings.expiration.units" , "Accounts - Warnings" , cDesc , 86400.0 , 1.0 , true ) ); - + defs.add( new ConstantDefinition( "accounts.warnings.expiration.units" , "Accounts - Warnings" , cDesc , + 86400.0 , 1.0 , true ) ); + // Account inactivity cDesc = "Time units (seconds)"; - defs.add( new ConstantDefinition( "accounts.inactivity.units" , "Accounts - Inactivity" , cDesc , oneWeek , 3600.0 , true ) ); + defs.add( new ConstantDefinition( "accounts.inactivity.units" , "Accounts - Inactivity" , cDesc , oneWeek , + 3600.0 , true ) ); cDesc = "Time after which the inactivity warning e-mail is to be sent, expressed using units defined by a.i.units."; - defs.add( new ConstantDefinition( "accounts.inactivity.warningMail" , "Accounts - Inactivity" , cDesc , 3.0 , 1.0 , true ) ); + defs.add( new ConstantDefinition( "accounts.inactivity.warningMail" , "Accounts - Inactivity" , cDesc , 3.0 , + 1.0 , true ) ); cDesc = "Time between the inactivity warning e-mail and actual account deletion, expressed using units defined by a.i.units."; - defs.add( new ConstantDefinition( "accounts.inactivity.deletion" , "Accounts - Inactivity" , cDesc , 1.0 , 1.0 , true ) ); - + defs.add( new ConstantDefinition( "accounts.inactivity.deletion" , "Accounts - Inactivity" , cDesc , 1.0 , 1.0 , + true ) ); + // Bug reports cDesc = "Amount of credits granted for low priority bug reports."; defs.add( new ConstantDefinition( "bugtracker.lowCredits" , "Bug tracking system" , cDesc , 1.0 , 1.0 , true ) ); cDesc = "Amount of credits granted for normal bug reports."; - defs.add( new ConstantDefinition( "bugtracker.mediumCredits" , "Bug tracking system" , cDesc , 2.0 , 1.0 , true ) ); + defs + .add( new ConstantDefinition( "bugtracker.mediumCredits" , "Bug tracking system" , cDesc , 2.0 , 1.0 , + true ) ); cDesc = "Amount of credits granted for critical bug reports."; - defs.add( new ConstantDefinition( "bugtracker.highCredits" , "Bug tracking system" , cDesc , 3.0 , 1.0 , true ) ); + defs + .add( new ConstantDefinition( "bugtracker.highCredits" , "Bug tracking system" , cDesc , 3.0 , 1.0 , + true ) ); cm.registerConstants( defs ); } diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/SystemStatusBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/SystemStatusBean.java index 18db00f..3d0631d 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/SystemStatusBean.java +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/SystemStatusBean.java @@ -10,8 +10,6 @@ import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.RowMapper; -import org.springframework.jdbc.core.SqlOutParameter; -import org.springframework.jdbc.core.simple.SimpleJdbcCall; import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionStatus; @@ -44,13 +42,14 @@ public class SystemStatusBean /** Current maintenance mode record */ private MaintenanceData maintenance = null; - private SimpleJdbcCall doStartTick; - private SimpleJdbcCall doCheckTick; - private StoredProc fEnterMaintenanceMode; private StoredProc fExtendMaintenanceMode; private StoredProc fExitMaintenanceMode; + private StoredProc fCheckTick; + private StoredProc fStartTick; + private StoredProc fEndTick; + @Autowired( required = true ) public void setDataSource( DataSource dataSource ) @@ -72,16 +71,14 @@ public class SystemStatusBean this.fExitMaintenanceMode.addParameter( "admin_id" , Types.INTEGER ); this.fExitMaintenanceMode.addOutput( "success" , Types.BOOLEAN ); - this.doStartTick = new SimpleJdbcCall( dataSource ); - this.doStartTick.withCatalogName( "sys" ).withFunctionName( "start_tick" ); - this.doStartTick.withoutProcedureColumnMetaDataAccess( ); - this.doStartTick.addDeclaredParameter( new SqlOutParameter( "tick_id" , Types.BIGINT ) ); + this.fCheckTick = new StoredProc( dataSource , "sys" , "check_stuck_tick" ); + this.fCheckTick.addOutput( "tick_id" , Types.BIGINT ); - this.doCheckTick = new SimpleJdbcCall( dataSource ); - this.doCheckTick.withCatalogName( "sys" ).withFunctionName( "check_stuck_tick" ); - this.doCheckTick.withoutProcedureColumnMetaDataAccess( ); - this.doCheckTick.addDeclaredParameter( new SqlOutParameter( "tick_id" , Types.BIGINT ) ); + this.fStartTick = new StoredProc( dataSource , "sys" , "start_tick" ); + this.fStartTick.addOutput( "tick_id" , Types.BIGINT ); + this.fEndTick = new StoredProc( dataSource , "sys" , "end_tick" ); + this.fEndTick.addParameter( "tick_id" , Types.BIGINT ); } @@ -246,6 +243,31 @@ public class SystemStatusBean } + /* Documented in interface */ + @Override + public Long checkStuckTick( ) + throws MaintenanceStatusException + { + Long tid = this.tTemplate.execute( new TransactionCallback< Long >( ) { + + @Override + public Long doInTransaction( TransactionStatus status ) + { + Map< String , Object > m = fCheckTick.execute( ); + loadStatus( ); + return (Long) m.get( "tick_id" ); + } + + } ); + + if ( tid == null && this.maintenance != null ) { + throw new MaintenanceStatusException( this.maintenance ); + } + + return tid; + } + + /* Documented in interface */ @Override synchronized public long startTick( ) @@ -256,7 +278,7 @@ public class SystemStatusBean @Override public Long doInTransaction( TransactionStatus status ) { - Map< String , Object > m = doStartTick.execute( ); + Map< String , Object > m = fStartTick.execute( ); loadStatus( ); return (Long) m.get( "tick_id" ); } @@ -277,26 +299,28 @@ public class SystemStatusBean /* Documented in interface */ @Override - public Long checkStuckTick( ) - throws MaintenanceStatusException + public void endTick( ) + throws TickStatusException , MaintenanceStatusException { - Long tid = this.tTemplate.execute( new TransactionCallback< Long >( ) { - - @Override - public Long doInTransaction( TransactionStatus status ) - { - Map< String , Object > m = doCheckTick.execute( ); - loadStatus( ); - return (Long) m.get( "tick_id" ); - } - - } ); - - if ( tid == null && this.maintenance != null ) { + if ( this.maintenance != null ) { throw new MaintenanceStatusException( this.maintenance ); } - return tid; + final Long tid = this.status.getCurrentTick( ); + if ( tid == null ) { + throw new TickStatusException( ); + } + + this.tTemplate.execute( new TransactionCallbackWithoutResult( ) { + + @Override + protected void doInTransactionWithoutResult( TransactionStatus status ) + { + fEndTick.execute( tid ); + loadStatus( ); + } + + } ); } } diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/TickerBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/TickerBean.java index b39d795..57d810d 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/TickerBean.java +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-system/src/main/java/com/deepclone/lw/beans/sys/TickerBean.java @@ -1,9 +1,6 @@ package com.deepclone.lw.beans.sys; -import java.util.HashSet; -import java.util.Set; - import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; @@ -101,9 +98,7 @@ public class TickerBean this.mainThread = new TickerThread( this.logger , this.tickerManager ); // Register thread as a constants user - Set< String > use = new HashSet< String >( ); - use.add( "ticker.interval" ); - this.constantsManager.registerUser( this.mainThread , use ); + this.constantsManager.registerUser( this.mainThread , "ticker.interval" ); } diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.classpath b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.classpath new file mode 100644 index 0000000..7c3d14f --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.project b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.project new file mode 100644 index 0000000..cc4857f --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.project @@ -0,0 +1,23 @@ + + + legacyworlds-server-beans-techs + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.settings/org.eclipse.jdt.core.prefs b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c2127c6 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,6 @@ +#Mon Mar 28 09:14:01 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.settings/org.maven.ide.eclipse.prefs b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 0000000..cdf9a81 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Mon Mar 28 09:13:56 CEST 2011 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/pom.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/pom.xml new file mode 100644 index 0000000..12861da --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/pom.xml @@ -0,0 +1,15 @@ + + 4.0.0 + + legacyworlds-server-beans + com.deepclone.lw + 5.99.2 + + + com.deepclone.lw + legacyworlds-server-beans-techs + 5.99.2 + Legacy Worlds technology management + This package contains components which are used to manage technologies in LW games. + \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/EmpireTechnologyDAOBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/EmpireTechnologyDAOBean.java new file mode 100644 index 0000000..924142c --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/EmpireTechnologyDAOBean.java @@ -0,0 +1,160 @@ +package com.deepclone.lw.beans.techs; + + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; + +import com.deepclone.lw.interfaces.game.techs.EmpireTechnologyDAO; +import com.deepclone.lw.sqld.game.techs.EmpireTechnology; +import com.deepclone.lw.utils.StoredProc; + + + +/** + * Implementation the empire technology and research data access component. + * + * @author tseeker + */ +public class EmpireTechnologyDAOBean + implements EmpireTechnologyDAO +{ + /** SQL query that reads the list of an empire's technologies */ + private static final String qGetTechnologies = "SELECT * FROM emp.technologies_view WHERE empire = ?"; + + /** SQL query that executes the priorities update preparation function */ + private static final String qStartPrioritiesUpdate = "SELECT emp.prepare_research_priorities_update( )"; + + /** SQL query that inserts research priority changes into the temporary table */ + private static final String qUploadPriorities = "INSERT INTO research_priorities_updates ( technology , priority ) " + + "VALUES ( ? , ? )"; + + /** Data source access component */ + private SimpleJdbcTemplate dTemplate; + + /** Row mapper for empire technologies */ + private RowMapper< EmpireTechnology > mEmpireTechnology; + + /** Wrapper for the stored procedure that implements technologies */ + private StoredProc fImplementTech; + + /** Wrapper for the stored procedure to apply research priority updates */ + private StoredProc fApplyResearchPriorities; + + + /** Initialise the row mapper */ + public EmpireTechnologyDAOBean( ) + { + this.mEmpireTechnology = new RowMapper< EmpireTechnology >( ) { + + @Override + public EmpireTechnology mapRow( ResultSet rs , int rowNum ) + throws SQLException + { + int techId = rs.getInt( "technology_id" ); + String techName = rs.getString( "technology" ); + boolean detailed = rs.getBoolean( "detailed" ); + Integer completion = (Integer) rs.getObject( "completion" ); + Integer cost = (Integer) rs.getObject( "cost" ); + Integer priority = (Integer) rs.getObject( "priority" ); + + EmpireTechnology result; + if ( !detailed ) { + result = new EmpireTechnology( techId * rs.getInt( "empire" ) , techName , completion , priority ); + } else if ( completion != null ) { + result = new EmpireTechnology( techName , completion , priority ); + } else if ( cost != null ) { + result = new EmpireTechnology( techName , cost ); + } else { + result = new EmpireTechnology( techName ); + } + return result; + } + + }; + } + + + /** + * Dependency injector that initialises the database access component and stored procedure + * wrappers. + * + * @param dataSource + * the data source + */ + @Autowired( required = true ) + public void setDataSource( DataSource dataSource ) + { + this.dTemplate = new SimpleJdbcTemplate( dataSource ); + + // Stored procedure for technology implementation + this.fImplementTech = new StoredProc( dataSource , "emp" , "implement_tech" ); + this.fImplementTech.addParameter( "empire_id" , Types.INTEGER ); + this.fImplementTech.addParameter( "technology" , Types.VARCHAR ); + this.fImplementTech.addOutput( "error_code" , Types.INTEGER ); + + // Stored procedure to apply research priority updates + this.fApplyResearchPriorities = new StoredProc( dataSource , "emp" , "apply_research_priorities" ); + this.fApplyResearchPriorities.addParameter( "empire_id" , Types.INTEGER ); + this.fApplyResearchPriorities.addOutput( "error_code" , Types.INTEGER ); + } + + + /* Documentation in EmpireTechnologyDAO interface */ + @Override + public List< EmpireTechnology > getTechnologies( int empireId ) + { + return this.dTemplate.query( qGetTechnologies , this.mEmpireTechnology , empireId ); + } + + + /* Documentation in EmpireTechnologyDAO interface */ + @Override + public int implementTechnology( int empireId , String technology ) + { + return (Integer) this.fImplementTech.execute( empireId , technology ).get( "error_code" ); + } + + + /* Documentation in EmpireTechnologyDAO interface */ + @Override + public void startPrioritiesUpdate( ) + { + this.dTemplate.queryForList( qStartPrioritiesUpdate ); + } + + + /* Documentation in EmpireTechnologyDAO interface */ + @Override + public void uploadPriorities( Map< String , Integer > priorities ) + { + List< Object[] > batch = new ArrayList< Object[] >( priorities.size( ) ); + int counter = 0; + for ( Entry< String , Integer > entry : priorities.entrySet( ) ) { + Object[] values = new Object[] { + entry.getKey( ) , entry.getValue( ) + }; + batch.add( counter++ , values ); + } + this.dTemplate.batchUpdate( qUploadPriorities , batch ); + } + + + /* Documentation in EmpireTechnologyDAO interface */ + @Override + public int finishPrioritiesUpdate( int empireId ) + { + return (Integer) this.fApplyResearchPriorities.execute( empireId ).get( "error_code" ); + } + +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/EmpireTechnologyManagerBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/EmpireTechnologyManagerBean.java new file mode 100644 index 0000000..ab85d96 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/EmpireTechnologyManagerBean.java @@ -0,0 +1,181 @@ +package com.deepclone.lw.beans.techs; + + +import java.util.Arrays; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import com.deepclone.lw.cmd.player.research.ResearchOperationResponse; +import com.deepclone.lw.cmd.player.research.ViewResearchResponse; +import com.deepclone.lw.interfaces.game.EmpireManagement; +import com.deepclone.lw.interfaces.game.techs.EmpireTechnologyDAO; +import com.deepclone.lw.interfaces.game.techs.EmpireTechnologyManager; +import com.deepclone.lw.interfaces.game.techs.TechnologyGraphManager; +import com.deepclone.lw.interfaces.sys.ConstantDefinition; +import com.deepclone.lw.interfaces.sys.ConstantsManager; + + + +/** + * Implementation of the empire technology and research management component. + * + * @author tseeker + */ +@Transactional +public class EmpireTechnologyManagerBean + implements EmpireTechnologyManager +{ + /** Empire management component */ + private EmpireManagement empireManager; + + /** Data access component for empire technologies and research */ + private EmpireTechnologyDAO empireTechnologyDAO; + + /** Technology graph management component */ + private TechnologyGraphManager techGraphManager; + + + /** + * Dependency injector for the empire management component. + * + * @param empireManager + * the empire management component + */ + @Autowired( required = true ) + public void setEmpireManager( EmpireManagement empireManager ) + { + this.empireManager = empireManager; + } + + + /** + * Dependency injector for the data access component for empire technologies and research + * + * @param empireTechnologyDAO + * data access component for empire technologies and research + */ + @Autowired( required = true ) + public void setEmpireTechnologyDAO( EmpireTechnologyDAO empireTechnologyDAO ) + { + this.empireTechnologyDAO = empireTechnologyDAO; + } + + + /** + * Dependency injector for the technology graph management component. + * + * @param techGraphManager + * the technology graph management component + */ + @Autowired( required = true ) + public void setTechnologyGraphManager( TechnologyGraphManager techGraphManager ) + { + this.techGraphManager = techGraphManager; + } + + + /** + * Dependency injector which registers research-related constants into the constants manager. + * + * @param constantsManager + * the constants manager component + */ + @Autowired( required = true ) + public void setConstantsManager( ConstantsManager constantsManager ) + { + ConstantDefinition[] definitions = new ConstantDefinition[] { + new ConstantDefinition( "game.research.minPoints" , "Research" , + "Minimal research points before a technology being researched is identified" , 50000.0 , 1.0 , + true ) , + new ConstantDefinition( "game.research.minRatio" , "Research" , + "Minimal ratio before a technology being researched is identified" , 0.75 , 0.01 , 0.99 ) , + new ConstantDefinition( "game.research.perPopUnit" , "Research" , + "Research points per population unit." , 0.50 , 0.01 , true ) + }; + constantsManager.registerConstants( Arrays.asList( definitions ) ); + } + + + /* Documentation in EmpireTechnologyManager interface */ + @Override + public ViewResearchResponse getResearchData( int empireId ) + { + return new ResearchResponseBuilder( empireId , this.empireManager , this.empireTechnologyDAO , + this.techGraphManager ).getResponse( ); + } + + + /* Documentation in EmpireTechnologyManager interface */ + @Override + public ResearchOperationResponse implementTechnology( int empireId , String technology ) + { + int result = this.empireTechnologyDAO.implementTechnology( empireId , technology ); + ResearchOperationResponse response; + + if ( result == 0 ) { + response = new ResearchOperationResponse( ); + } else { + ResearchResponseBuilder builder = new ResearchResponseBuilder( empireId , this.empireManager , + this.empireTechnologyDAO , this.techGraphManager ); + switch ( result ) { + + case 1: + response = builder.getResponse( ResearchOperationResponse.Result.ERR_RESOURCES ); + break; + + case 2: + response = builder.getResponse( ResearchOperationResponse.Result.ERR_STATE_CHANGED ); + break; + + default: + throw new RuntimeException( "unsupported return value " + result ); + + } + } + + return response; + } + + + /* Documentation in EmpireTechnologyManager interface */ + @Override + public ResearchOperationResponse setResearchPriorities( int empireId , Map< String , Integer > priorities ) + { + int result; + if ( priorities.size( ) < 2 ) { + result = 2; + } else { + this.empireTechnologyDAO.startPrioritiesUpdate( ); + this.empireTechnologyDAO.uploadPriorities( priorities ); + result = this.empireTechnologyDAO.finishPrioritiesUpdate( empireId ); + } + + ResearchOperationResponse response; + if ( result == 0 ) { + response = new ResearchOperationResponse( ); + } else { + ResearchResponseBuilder builder = new ResearchResponseBuilder( empireId , this.empireManager , + this.empireTechnologyDAO , this.techGraphManager ); + + switch ( result ) { + + case 1: + response = builder.getResponse( ResearchOperationResponse.Result.ERR_STATE_CHANGED ); + break; + + case 2: + response = builder.getResponse( ResearchOperationResponse.Result.ERR_INVALID ); + break; + + default: + throw new RuntimeException( "unsupported return value " + result ); + + } + } + + return response; + } + +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/EmpireUpdate.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/EmpireUpdate.java new file mode 100644 index 0000000..c32ebba --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/EmpireUpdate.java @@ -0,0 +1,293 @@ +package com.deepclone.lw.beans.techs; + + +import java.util.Collection; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.deepclone.lw.cmd.admin.logs.LogLevel; +import com.deepclone.lw.interfaces.eventlog.SystemLogger; +import com.deepclone.lw.sqld.game.techs.ResearchStatus; +import com.deepclone.lw.sqld.game.techs.ResearchUpdateInput; +import com.deepclone.lw.sqld.game.techs.ResearchUpdateOutput; +import com.deepclone.lw.sqld.game.techs.TechGraph; +import com.deepclone.lw.sqld.game.techs.TechGraphException; +import com.deepclone.lw.sqld.game.techs.Technology; + + + +/** + * Research update implementation for a single empire. + * + * @author tseeker + */ +class EmpireUpdate +{ + /** Empire identifier */ + private final int id; + + /** Research points produced */ + private double production; + + /** All technologies (known or being researched) */ + private final Map< String , ResearchUpdateInput > byName; + + /** Technology names by status */ + private final Map< ResearchStatus , Set< String >> byStatus; + + /** Output records by name */ + private final Map< String , ResearchUpdateOutput > output; + + /** Sum of the current research priorities */ + private double totalPriority; + + /** Amount of active research topics */ + private int activeTopics; + + /** Parent component's logging interface */ + private SystemLogger logger; + + + /** + * Initialise the empire updater using the global lists of production points and research + * statuses. + * + * @param logger + * the component's logging system + * @param empireId + * the empire for whom the research update is to be computed + * @param production + * the map of production points for all empires in the batch + * @param status + * the list of statuses for all empires in the batch + */ + EmpireUpdate( SystemLogger logger , int empireId , Map< Integer , Double > production , + HashMap< Integer , List< ResearchUpdateInput >> status ) + { + this.id = empireId; + this.production = production.get( this.id ); + this.logger = logger; + + this.byName = new HashMap< String , ResearchUpdateInput >( ); + this.output = new HashMap< String , ResearchUpdateOutput >( ); + + this.byStatus = new EnumMap< ResearchStatus , Set< String > >( ResearchStatus.class ); + this.byStatus.put( ResearchStatus.IN_PROGRESS , new HashSet< String >( ) ); + this.byStatus.put( ResearchStatus.RESEARCHED , new HashSet< String >( ) ); + this.byStatus.put( ResearchStatus.IMPLEMENTED , new HashSet< String >( ) ); + + // Initialise sets and maps + List< ResearchUpdateInput > empStatus = status.get( this.id ); + if ( empStatus != null ) { + for ( ResearchUpdateInput entry : status.get( this.id ) ) { + this.byName.put( entry.getTechnology( ) , entry ); + this.byStatus.get( entry.getStatus( ) ).add( entry.getTechnology( ) ); + } + this.logger.flush( ); + } + } + + + /** + * Perform the research update, filling the {@link #output} map. + * + * @param techGraph + * the technology graph + * @throws TechGraphException + * indicates an internal error + */ + void compute( TechGraph techGraph ) + throws TechGraphException + { + if ( this.production == 0 ) { + return; + } + this.prepareOutput( ); + + List< Technology > newResearch = this.findNewTechnologies( techGraph ); + if ( !newResearch.isEmpty( ) ) { + this.addResearch( newResearch ); + } + if ( this.output.isEmpty( ) ) { + return; + } + + List< String > inProgress = new LinkedList< String >( this.output.keySet( ) ); + for ( String resName : inProgress ) { + this.researchProgress( techGraph.getTechnology( resName ) , resName ); + } + + this.updatePriorities( ); + } + + + /** + * Copy information from the list of research to the output map. + */ + private void prepareOutput( ) + { + this.totalPriority = 0; + for ( ResearchUpdateInput entry : this.byName.values( ) ) { + if ( entry.getStatus( ) != ResearchStatus.IN_PROGRESS ) { + continue; + } + this.output.put( entry.getTechnology( ) , new ResearchUpdateOutput( this.id , entry.getTechnology( ) , + false , entry.getPoints( ) , entry.getPriority( ) ) ); + this.totalPriority += entry.getPriority( ); + } + this.activeTopics = this.byStatus.get( ResearchStatus.IN_PROGRESS ).size( ); + } + + + /** + * Find new technologies to research + * + * XXX: we shouldn't be doing that at every update; it's only required if the techs were added + * or deleted, if dependencies were changed or if the empire implemented a technology. + * + * @param techGraph + * the technology graph + * @return the list of technologies on which research can start + * @throws TechGraphException + * indicates an internal error + */ + private List< Technology > findNewTechnologies( TechGraph techGraph ) + throws TechGraphException + { + LinkedList< Technology > newResearch = new LinkedList< Technology >( ); + Set< String > implemented = this.byStatus.get( ResearchStatus.IMPLEMENTED ); + if ( implemented == null ) { + throw new RuntimeException( "wtf?!" ); + } + for ( String catName : techGraph.getCategories( ) ) { + for ( String techName : techGraph.getCategory( catName ).getTechnologies( ) ) { + // Check if the empire "knows" of the tech + if ( this.byName.containsKey( techName ) ) { + continue; + } + + // Check dependencies + Technology tech = techGraph.getTechnology( techName ); + boolean mayStart = true; + for ( String depName : tech.getDependencies( ) ) { + if ( !implemented.contains( depName ) ) { + mayStart = false; + break; + } + } + + if ( mayStart ) { + newResearch.add( tech ); + } + } + } + return newResearch; + } + + + /** + * Add new entries to the list of current research topics and updates the total priority + * accordingly. + * + * @param newResearch + * the list of research topics to add + */ + private void addResearch( List< Technology > newResearch ) + { + int increment; + if ( this.totalPriority == 0 ) { + increment = 1; + } else { + increment = (int) Math.ceil( this.totalPriority / this.activeTopics ); + } + + for ( Technology tech : newResearch ) { + this.output.put( tech.getName( ) , new ResearchUpdateOutput( this.id , tech.getName( ) , true , 0 , + increment ) ); + this.totalPriority += increment; + } + this.activeTopics += newResearch.size( ); + } + + + /** + * Update the progress on a research topic. + * + * @param technology + * the technology's definition + * @param name + * the name of the research topic + */ + private void researchProgress( Technology technology , String name ) + { + ResearchUpdateOutput entry = this.output.get( name ); + if ( entry.getPriority( ) == 0 ) { + return; + } + + double points = this.production * entry.getPriority( ) / this.totalPriority; + double total = points + entry.getPoints( ); + + if ( total >= technology.getPoints( ) ) { + this.totalPriority -= entry.getPriority( ); + this.production = this.production + total - entry.getPoints( ); + this.output.put( name , new ResearchUpdateOutput( this.id , name ) ); + this.activeTopics--; + } else { + entry.addPoints( points ); + } + } + + + /** + * Update priorities of active research topics in the output map. + */ + private void updatePriorities( ) + { + if ( this.activeTopics == 0 || this.totalPriority == 100 ) { + return; + } + + List< ResearchUpdateOutput > progress = new LinkedList< ResearchUpdateOutput >( ); + int newTotal = 0; + for ( ResearchUpdateOutput update : this.output.values( ) ) { + Integer prio = update.getPriority( ); + if ( prio == null ) { + continue; + } + + int newValue = (int) Math.floor( 100.0 * prio / this.totalPriority ); + progress.add( update ); + update.setPriority( newValue ); + newTotal += newValue; + } + + // Distribute the rest of the points + while ( newTotal < 100 ) { + for ( ResearchUpdateOutput update : progress ) { + update.setPriority( update.getPriority( ) + 1 ); + newTotal++; + if ( newTotal == 100 ) { + break; + } + } + } + this.logger.flush( ); + } + + + /** @return the update output records */ + Collection< ResearchUpdateOutput > getOutput( ) + { + if ( !this.output.isEmpty( ) ) { + this.logger.log( LogLevel.TRACE , "Empire " + this.id + " - " + this.output.size( ) + " update(s)" ) + .flush( ); + } + return this.output.values( ); + } +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/ResearchResponseBuilder.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/ResearchResponseBuilder.java new file mode 100644 index 0000000..1c24a1f --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/ResearchResponseBuilder.java @@ -0,0 +1,280 @@ +package com.deepclone.lw.beans.techs; + + +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import com.deepclone.lw.cmd.player.gdata.GamePageData; +import com.deepclone.lw.cmd.player.gdata.empire.ResearchData; +import com.deepclone.lw.cmd.player.gdata.empire.TechnologyCategoryData; +import com.deepclone.lw.cmd.player.gdata.empire.TechnologyData; +import com.deepclone.lw.cmd.player.research.ResearchOperationResponse; +import com.deepclone.lw.cmd.player.research.ViewResearchResponse; +import com.deepclone.lw.cmd.player.research.ResearchOperationResponse.Result; +import com.deepclone.lw.interfaces.game.EmpireManagement; +import com.deepclone.lw.interfaces.game.techs.EmpireTechnologyDAO; +import com.deepclone.lw.interfaces.game.techs.TechnologyGraphManager; +import com.deepclone.lw.interfaces.i18n.LanguageTranslator; +import com.deepclone.lw.interfaces.i18n.UnknownStringException; +import com.deepclone.lw.sqld.game.techs.Category; +import com.deepclone.lw.sqld.game.techs.EmpireTechnology; +import com.deepclone.lw.sqld.game.techs.ResearchStatus; +import com.deepclone.lw.sqld.game.techs.TechGraph; +import com.deepclone.lw.sqld.game.techs.TechGraphException; +import com.deepclone.lw.sqld.game.techs.Technology; + + + +/** + * Class that builds {@link ViewResearchResponse} or {@link ResearchOperationResponse} instances. + * + * @author tseeker + */ +class ResearchResponseBuilder +{ + + /** Empire identifier */ + private final int empireId; + + /** Empire management component */ + private final EmpireManagement empireManager; + + /** Technology and research data access component */ + private final EmpireTechnologyDAO empireTechnologyDAO; + + /** Technology graph management component */ + private final TechnologyGraphManager techGraphManager; + + /** Game page data */ + private GamePageData pageData; + + /** List of current research topics */ + private List< ResearchData > research; + + /** Lists of implemented technologies by category */ + private Map< String , List< TechnologyData > > implementedMap; + + /** Final list of implemented technologies */ + private List< TechnologyCategoryData > implementedLists; + + /** All implemented technologies by identifier */ + private Map< String , TechnologyData > implementedById; + + + /** + * Initialise the response builder by setting the empire identifier and the various components + * that may be required to generate the response. + * + * @param empireId + * the empire identifier + * @param empireManager + * the empire management component + * @param empireTechnologyDAO + * the technology and research data access component + * @param techGraphManager + * the technology graph management component + */ + ResearchResponseBuilder( int empireId , EmpireManagement empireManager , EmpireTechnologyDAO empireTechnologyDAO , + TechnologyGraphManager techGraphManager ) + { + this.empireId = empireId; + this.empireManager = empireManager; + this.empireTechnologyDAO = empireTechnologyDAO; + this.techGraphManager = techGraphManager; + } + + + /** + * Build a basic research view response. + * + * @return the research view response. + */ + ViewResearchResponse getResponse( ) + { + try { + this.buildResponseContents( ); + } catch ( Exception e ) { + throw new RuntimeException( "internal error while processing research data" , e ); + } + return new ViewResearchResponse( this.pageData , this.research , this.implementedLists ); + } + + + /** + * Build a research operation response. + * + * @param errorCode + * the operation's error code (should not be + * {@link ResearchOperationResponse.Result#OK}). + * @return the research operation response. + */ + ResearchOperationResponse getResponse( Result errorCode ) + { + try { + this.buildResponseContents( ); + } catch ( Exception e ) { + throw new RuntimeException( "internal error while processing research data" , e ); + } + return new ResearchOperationResponse( this.pageData , this.research , this.implementedLists , errorCode ); + } + + + /** + * Build the lists and records required by research view or operation responses. This includes + * the list of current research topics as well as the list of implemented technologies. + * + * @throws UnknownStringException + * if there is an incoherence between the tech graph and the translations database. + * @throws TechGraphException + * if there is an incoherence between the empire research records and the tech + * graph. + */ + private void buildResponseContents( ) + throws UnknownStringException , TechGraphException + { + LanguageTranslator translator = this.empireManager.getTranslator( this.empireId ); + TechGraph techGraph = this.techGraphManager.getGraph( ); + + this.research = new LinkedList< ResearchData >( ); + this.implementedMap = new HashMap< String , List< TechnologyData > >( ); + this.implementedById = new HashMap< String , TechnologyData >( ); + + for ( EmpireTechnology record : this.empireTechnologyDAO.getTechnologies( this.empireId ) ) { + if ( record.getStatus( ) == ResearchStatus.IMPLEMENTED ) { + this.addImplemented( record , translator , techGraph ); + } else { + this.addResearchData( record , translator , techGraph ); + } + } + + this.pageData = this.empireManager.getGeneralInformation( this.empireId ); + Collections.sort( this.research ); + this.postProcessImplemented( translator , techGraph ); + } + + + /** + * Add an implemented technology record. + * + * @param record + * the original record as returned by the {@link EmpireTechnologyDAO}. + * @param translator + * the translator for the empire's language + * @param techGraph + * the technology graph + * + * @throws TechGraphException + * if there is an incoherence between the empire research records and the tech + * graph. + * @throws UnknownStringException + * if there is an incoherence between the tech graph and the translations database. + */ + private void addImplemented( EmpireTechnology record , LanguageTranslator translator , TechGraph techGraph ) + throws TechGraphException , UnknownStringException + { + String techId = record.getIdentifier( ); + Technology tech = techGraph.getTechnology( techId ); + Category category = tech.getCategory( ); + + List< TechnologyData > catTechs = this.implementedMap.get( category.getName( ) ); + if ( catTechs == null ) { + catTechs = new LinkedList< TechnologyData >( ); + this.implementedMap.put( category.getName( ) , catTechs ); + } + + TechnologyData tData; + String name = translator.translate( techId ); + String description = translator.translate( tech.getDescription( ) ); + tData = new TechnologyData( techId , name , description , tech.getDependencies( ) , new LinkedList< String >( ) ); + + catTechs.add( tData ); + this.implementedById.put( techId , tData ); + } + + + /** + * Add a research topic record. + * + * @param record + * the original record as returned by the {@link EmpireTechnologyDAO}. + * @param translator + * the translator for the empire's language + * @param techGraph + * the technology graph + * + * @throws TechGraphException + * if there is an incoherence between the empire research records and the tech + * graph. + * @throws UnknownStringException + * if there is an incoherence between the tech graph and the translations database. + */ + private void addResearchData( EmpireTechnology record , LanguageTranslator translator , TechGraph techGraph ) + throws TechGraphException , UnknownStringException + { + String techId = record.getIdentifier( ); + Technology tech = techGraph.getTechnology( techId ); + String category = translator.translate( tech.getCategory( ).getName( ) ); + + ResearchData rData; + + if ( !record.isDetailed( ) ) { + rData = new ResearchData( record.getNumericId( ) , category , record.getPercentage( ) , record + .getPriority( ) ); + } else { + String name = translator.translate( techId ); + String description = translator.translate( tech.getDescription( ) ); + String[] dependencies = tech.getDependencies( ).toArray( new String[] { } ); + if ( record.getStatus( ) == ResearchStatus.RESEARCHED ) { + rData = new ResearchData( techId , category , name , description , dependencies , (int) tech.getCost( ) ); + } else { + rData = new ResearchData( techId , category , name , description , dependencies , record + .getPercentage( ) , record.getPriority( ) ); + } + } + + this.research.add( rData ); + } + + + /** + * Post-process implemented technologies by adding reverse dependencies, sorting each list, and + * generating the sorted list of technology categories. + * + * @param translator + * the translator for the empire's language + * @param techGraph + * the technology graph + * + * @throws TechGraphException + * if there is an incoherence between the empire research records and the tech + * graph. + * @throws UnknownStringException + * if there is an incoherence between the tech graph and the translations database. + */ + private void postProcessImplemented( LanguageTranslator translator , TechGraph techGraph ) + throws UnknownStringException , TechGraphException + { + this.implementedLists = new LinkedList< TechnologyCategoryData >( ); + for ( String catId : this.implementedMap.keySet( ) ) { + + List< TechnologyData > techs = this.implementedMap.get( catId ); + for ( TechnologyData tData : techs ) { + for ( String dependency : tData.getDependsOn( ) ) { + TechnologyData depData = this.implementedById.get( dependency ); + if ( depData != null ) { + depData.getDependencyOf( ).add( tData.getIdentifier( ) ); + } + } + } + Collections.sort( techs ); + + String catName = translator.translate( catId ); + String catDesc = translator.translate( techGraph.getCategory( catId ).getDescription( ) ); + this.implementedLists.add( new TechnologyCategoryData( catName , catDesc , techs ) ); + } + Collections.sort( this.implementedLists ); + } +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/ResearchUpdateBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/ResearchUpdateBean.java new file mode 100644 index 0000000..f499a3a --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/ResearchUpdateBean.java @@ -0,0 +1,180 @@ +package com.deepclone.lw.beans.techs; + + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; + +import com.deepclone.lw.interfaces.eventlog.Logger; +import com.deepclone.lw.interfaces.eventlog.SystemLogger; +import com.deepclone.lw.interfaces.game.techs.ResearchUpdateDAO; +import com.deepclone.lw.interfaces.game.techs.TechnologyGraphManager; +import com.deepclone.lw.interfaces.game.updates.GameUpdate; +import com.deepclone.lw.interfaces.game.updates.GameUpdatePhase; +import com.deepclone.lw.interfaces.game.updates.GameUpdatePhaseHandler; +import com.deepclone.lw.interfaces.game.updates.UpdatesDAO; +import com.deepclone.lw.sqld.game.techs.ResearchUpdateInput; +import com.deepclone.lw.sqld.game.techs.ResearchUpdateOutput; +import com.deepclone.lw.sqld.game.techs.TechGraph; +import com.deepclone.lw.sqld.game.techs.TechGraphException; + + + +/** + * Component responsible for updating empires' research status. + * + * @author tseeker + */ +public class ResearchUpdateBean + implements GameUpdatePhaseHandler +{ + /** The component's logging interface */ + private SystemLogger logger; + + /** The technology graph management component */ + private TechnologyGraphManager techGraphManager; + + /** The current technology graph */ + private TechGraph techGraph; + + /** The main game update data access component */ + private UpdatesDAO updatesDAO; + + /** The research updates data access component */ + private ResearchUpdateDAO researchUpdateDAO; + + + /** + * Dependency injector that initialises the component's logging interface. + * + * @param logger + * the system logger + */ + @Autowired( required = true ) + public void setLogger( Logger logger ) + { + this.logger = logger.getSystemLogger( "ResearchUpdate" ); + } + + + /** + * Dependency injector for the technology graph management component. + * + * @param techGraphManager + * the technology graph management component + */ + @Autowired( required = true ) + public void setTechGraphManager( TechnologyGraphManager techGraphManager ) + { + this.techGraphManager = techGraphManager; + } + + + /** + * Dependency injector that sets the main game update data access component. + * + * @param updatesDAO + * the main game update data access component + */ + @Autowired( required = true ) + public void setUpdatesDAO( UpdatesDAO updatesDAO ) + { + this.updatesDAO = updatesDAO; + } + + + /** + * Dependency injector that sets the research updates data access component + * + * @param researchUpdateDAO + * the research updates data access component + */ + @Autowired( required = true ) + public void setResearchUpdateDAO( ResearchUpdateDAO researchUpdateDAO ) + { + this.researchUpdateDAO = researchUpdateDAO; + } + + + /** + * Dependency injector that registers the handler with the main game update manager + * + * @param updateManager + * the game update manager + */ + @Autowired( required = true ) + public void setUpdateManager( GameUpdate updateManager ) + { + updateManager.registerHandler( this ); + } + + + /* Documentation in GameUpdatePhaseHandler interface */ + @Override + public GameUpdatePhase getPhase( ) + { + return GameUpdatePhase.EMPIRE_RESEARCH; + } + + + /** + * Get a copy of the technology graph when the update phase starts. + */ + @Override + public void onPhaseStart( long updateId ) + { + this.techGraph = this.techGraphManager.getGraph( ); + } + + + /** + * If there are research updates left to process, lock the records, then obtain all relevant + * data, process each empire using {@link EmpireUpdate}, and send the updates to the database. + */ + @Override + public boolean updateGame( long updateId ) + { + // Look for records to update + if ( !this.updatesDAO.prepareUpdates( updateId , this.getPhase( ) ) ) { + return false; + } + + Map< Integer , Double > production; + HashMap< Integer , List< ResearchUpdateInput >> status; + status = new HashMap< Integer , List< ResearchUpdateInput > >( ); + + // Prepare update and load input + this.researchUpdateDAO.prepareUpdate( updateId ); + production = this.researchUpdateDAO.getResearchPoints( updateId ); + for ( ResearchUpdateInput input : this.researchUpdateDAO.getUpdateData( updateId ) ) { + List< ResearchUpdateInput > eStatus = status.get( input.getEmpireId( ) ); + if ( eStatus == null ) { + eStatus = new LinkedList< ResearchUpdateInput >( ); + status.put( input.getEmpireId( ) , eStatus ); + } + eStatus.add( input ); + } + + // Handle the update for each empire + List< ResearchUpdateOutput > output = new LinkedList< ResearchUpdateOutput >( ); + for ( int empireId : production.keySet( ) ) { + EmpireUpdate update = new EmpireUpdate( this.logger , empireId , production , status ); + try { + update.compute( this.techGraph ); + } catch ( TechGraphException e ) { + throw new RuntimeException( "incoherent technology graph" , e ); + } + output.addAll( update.getOutput( ) ); + } + + // Send and validate updates + this.researchUpdateDAO.submitUpdateData( output ); + this.updatesDAO.validateUpdatedRecords( updateId , GameUpdatePhase.EMPIRE_RESEARCH ); + + return true; + } + +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/ResearchUpdateDAOBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/ResearchUpdateDAOBean.java new file mode 100644 index 0000000..b50d807 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/ResearchUpdateDAOBean.java @@ -0,0 +1,138 @@ +package com.deepclone.lw.beans.techs; + + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.jdbc.core.namedparam.SqlParameterSource; +import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils; +import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; + +import com.deepclone.lw.interfaces.game.techs.ResearchUpdateDAO; +import com.deepclone.lw.sqld.game.techs.ResearchUpdateInput; +import com.deepclone.lw.sqld.game.techs.ResearchUpdateOutput; +import com.deepclone.lw.utils.StoredProc; + + + +public class ResearchUpdateDAOBean + implements ResearchUpdateDAO +{ + /** Query that reads research update input */ + private static final String qGetInput = "SELECT * FROM emp.research_update_input_view WHERE update_id = ?"; + + /** Query that reads empire research points production */ + private static final String qGetPoints = "SELECT * FROM emp.research_points_production WHERE update_id = ?"; + + /** Query that adds a record to the output */ + private static final String qAddOutput = "INSERT INTO research_update_output " + + "(empire_id , technology , creation , points , priority) " + + "VALUES ( :empireId , :technology , :creation , :points , :priority )"; + + /** Query that submits the update */ + private static final String qSubmitUpdate = "SELECT emp.submit_research_update( )"; + + /** Data source access */ + private SimpleJdbcTemplate dTemplate; + + /** Wrapper for the stored procedure that prepares the database for update */ + private StoredProc fPrepareUpdate; + + /** Row mapper for research update input */ + RowMapper< ResearchUpdateInput > ruiMapper; + + + /** + * Initialise the component's row mapper. + */ + public ResearchUpdateDAOBean( ) + { + this.ruiMapper = new RowMapper< ResearchUpdateInput >( ) { + @Override + public ResearchUpdateInput mapRow( ResultSet rs , int rowNum ) + throws SQLException + { + int empireId = rs.getInt( "empire_id" ); + String technology = rs.getString( "technology" ); + + Boolean implemented = (Boolean) rs.getObject( "implemented" ); + if ( implemented == null ) { + double points = rs.getDouble( "points" ); + int priority = rs.getInt( "priority" ); + return new ResearchUpdateInput( empireId , technology , points , priority ); + } + + return new ResearchUpdateInput( empireId , technology , implemented ); + } + }; + } + + + /** + * Dependency injector that initialises the component's database access and stored procedure + * wrappers. + * + * @param dataSource + * the data source + */ + @Autowired( required = true ) + public void setDataSource( DataSource dataSource ) + { + this.dTemplate = new SimpleJdbcTemplate( dataSource ); + + // Stored procedure that prepares the database for update + this.fPrepareUpdate = new StoredProc( dataSource , "emp" , "prepare_research_update" ); + this.fPrepareUpdate.addParameter( "update_id" , Types.BIGINT ); + } + + + /* Documented in ResearchUpdateDAO interface */ + @Override + public void prepareUpdate( long updateId ) + { + this.fPrepareUpdate.execute( updateId ); + } + + + /* Documented in ResearchUpdateDAO interface */ + @Override + public List< ResearchUpdateInput > getUpdateData( long updateId ) + { + return this.dTemplate.query( qGetInput , this.ruiMapper , updateId ); + } + + + /* Documented in ResearchUpdateDAO interface */ + @Override + public Map< Integer , Double > getResearchPoints( long updateId ) + { + Map< Integer , Double > result = new HashMap< Integer , Double >( ); + + for ( Map< String , Object > row : this.dTemplate.queryForList( qGetPoints , updateId ) ) { + result.put( (Integer) row.get( "empire_id" ) , (Double) row.get( "points" ) ); + } + + return result; + } + + + /* Documented in ResearchUpdateDAO interface */ + @Override + public void submitUpdateData( List< ResearchUpdateOutput > output ) + { + if ( !output.isEmpty( ) ) { + SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch( output.toArray( ) ); + this.dTemplate.batchUpdate( qAddOutput , batch ); + } + this.dTemplate.queryForList( qSubmitUpdate ); + } + +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/TechnologyGraphDAOBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/TechnologyGraphDAOBean.java new file mode 100644 index 0000000..f716b5a --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/TechnologyGraphDAOBean.java @@ -0,0 +1,134 @@ +package com.deepclone.lw.beans.techs; + + +import java.sql.ResultSet; +import java.sql.SQLException; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowCallbackHandler; + +import com.deepclone.lw.interfaces.game.techs.TechnologyGraphDAO; +import com.deepclone.lw.sqld.game.techs.TechGraph; +import com.deepclone.lw.sqld.game.techs.TechGraphException; + + + +public class TechnologyGraphDAOBean + implements TechnologyGraphDAO +{ + private static final String qGetCategories = "SELECT name , description FROM tech.categories_view"; + private static final String qGetTechnologies = "SELECT category , name , description , points , cost FROM tech.technologies_view"; + private static final String qGetDependencies = "SELECT technology , dependency FROM tech.dependencies_view"; + + private static abstract class TechGraphDBHandler + implements RowCallbackHandler + { + TechGraph graph; + TechGraphException error; + + + public TechGraphDBHandler( ) + { + // EMPTY + } + + + public final void setGraph( TechGraph graph ) + { + this.graph = graph; + } + + + @Override + public final void processRow( ResultSet rs ) + throws SQLException + { + if ( this.error != null ) { + return; + } + + try { + this.extractData( rs ); + } catch ( TechGraphException e ) { + this.error = e; + } + } + + + protected abstract void extractData( ResultSet rs ) + throws TechGraphException , SQLException; + + } + + private static class CategoryExtractor + extends TechGraphDBHandler + { + @Override + protected void extractData( ResultSet rs ) + throws TechGraphException , SQLException + { + this.graph.addCategory( rs.getString( "name" ) , rs.getString( "description" ) ); + } + + } + + private static class TechnologyExtractor + extends TechGraphDBHandler + { + @Override + protected void extractData( ResultSet rs ) + throws TechGraphException , SQLException + { + this.graph.addTechnology( rs.getString( "category" ) , rs.getString( "name" ) , rs + .getString( "description" ) , rs.getInt( "points" ) , rs.getInt( "cost" ) ); + } + } + + private static class DependencyExtractor + extends TechGraphDBHandler + { + @Override + protected void extractData( ResultSet rs ) + throws TechGraphException , SQLException + { + this.graph.addDependency( rs.getString( "technology" ) , rs.getString( "dependency" ) ); + } + + } + + private JdbcTemplate dTemplate; + + + @Autowired( required = true ) + public void setDataSource( DataSource dataSource ) + { + this.dTemplate = new JdbcTemplate( dataSource ); + } + + + @Override + public TechGraph loadGraph( ) + throws TechGraphException + { + TechGraph result = new TechGraph( ); + this.extractGraphData( result , new CategoryExtractor( ) , qGetCategories ); + this.extractGraphData( result , new TechnologyExtractor( ) , qGetTechnologies ); + this.extractGraphData( result , new DependencyExtractor( ) , qGetDependencies ); + return result; + } + + + private void extractGraphData( TechGraph graph , TechGraphDBHandler extractor , String query ) + throws TechGraphException + { + extractor.setGraph( graph ); + this.dTemplate.query( query , extractor ); + if ( extractor.error != null ) { + throw extractor.error; + } + } + +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/TechnologyGraphManagerBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/TechnologyGraphManagerBean.java new file mode 100644 index 0000000..2699fdb --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/java/com/deepclone/lw/beans/techs/TechnologyGraphManagerBean.java @@ -0,0 +1,74 @@ +package com.deepclone.lw.beans.techs; + + +import java.util.LinkedList; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import com.deepclone.lw.cmd.admin.techs.TechCategory; +import com.deepclone.lw.interfaces.game.techs.TechnologyGraphDAO; +import com.deepclone.lw.interfaces.game.techs.TechnologyGraphManager; +import com.deepclone.lw.sqld.game.techs.Category; +import com.deepclone.lw.sqld.game.techs.TechGraph; +import com.deepclone.lw.sqld.game.techs.TechGraphException; + + + +@Transactional +public class TechnologyGraphManagerBean + implements TechnologyGraphManager +{ + private TechGraph graph; + private TechnologyGraphDAO technologyGraphDAO; + + + @Autowired( required = true ) + public void setTechGraphDAO( TechnologyGraphDAO technologyGraphDAO ) + { + this.technologyGraphDAO = technologyGraphDAO; + } + + + private void loadGraph( ) + throws TechGraphException + { + if ( this.graph == null ) { + this.graph = this.technologyGraphDAO.loadGraph( ); + } + } + + + /* Documented in TechnologyGraphManager interface */ + @Override + public TechGraph getGraph( ) + { + try { + this.loadGraph( ); + } catch ( TechGraphException e ) { + throw new RuntimeException( e ); + } + return new TechGraph( this.graph ); + } + + + /* Documented in TechnologyGraphManager interface */ + @Override + public List< TechCategory > listCategories( ) + { + try { + this.loadGraph( ); + + List< TechCategory > result = new LinkedList< TechCategory >( ); + for ( String catName : this.graph.getCategories( ) ) { + Category cat = this.graph.getCategory( catName ); + result.add( new TechCategory( catName , cat.getDescription( ) , cat.getTechnologies( ) ) ); + } + + return result; + } catch ( TechGraphException e ) { + throw new RuntimeException( e ); + } + } +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs-beans.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs-beans.xml new file mode 100644 index 0000000..df082ba --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs-beans.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/empire-technology-dao-bean.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/empire-technology-dao-bean.xml new file mode 100644 index 0000000..2edfe89 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/empire-technology-dao-bean.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/empire-technology-manager-bean.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/empire-technology-manager-bean.xml new file mode 100644 index 0000000..20b8065 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/empire-technology-manager-bean.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/research-update-bean.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/research-update-bean.xml new file mode 100644 index 0000000..2bf00a9 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/research-update-bean.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/research-update-dao-bean.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/research-update-dao-bean.xml new file mode 100644 index 0000000..1e29667 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/research-update-dao-bean.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/technology-graph-dao-bean.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/technology-graph-dao-bean.xml new file mode 100644 index 0000000..5a77f1c --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/technology-graph-dao-bean.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/technology-graph-manager-bean.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/technology-graph-manager-bean.xml new file mode 100644 index 0000000..511a02b --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-techs/src/main/resources/configuration/techs/technology-graph-manager-bean.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.classpath b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.classpath new file mode 100644 index 0000000..7c3d14f --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.project b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.project new file mode 100644 index 0000000..b085973 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.project @@ -0,0 +1,23 @@ + + + legacyworlds-server-beans-updates + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.settings/org.eclipse.jdt.core.prefs b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..e13ce5e --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,6 @@ +#Tue Mar 29 13:49:47 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.settings/org.maven.ide.eclipse.prefs b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 0000000..052be69 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Tue Mar 29 13:49:47 CEST 2011 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/pom.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/pom.xml new file mode 100644 index 0000000..bc4f4e5 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/pom.xml @@ -0,0 +1,13 @@ + + 4.0.0 + + legacyworlds-server-beans + com.deepclone.lw + 5.99.2 + + com.deepclone.lw + legacyworlds-server-beans-updates + 5.99.2 + Legacy Worlds updates and pre-computation management + This Maven module contains the components which implement both the game's "standard", per-minute update system as well as the pre-computation manager. + \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/java/com/deepclone/lw/beans/updates/GameUpdateBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/java/com/deepclone/lw/beans/updates/GameUpdateBean.java new file mode 100644 index 0000000..2a1b0ae --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/java/com/deepclone/lw/beans/updates/GameUpdateBean.java @@ -0,0 +1,367 @@ +package com.deepclone.lw.beans.updates; + + +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.List; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.support.TransactionCallback; +import org.springframework.transaction.support.TransactionTemplate; + +import com.deepclone.lw.cmd.admin.logs.LogLevel; +import com.deepclone.lw.interfaces.eventlog.Logger; +import com.deepclone.lw.interfaces.eventlog.SystemLogger; +import com.deepclone.lw.interfaces.game.updates.DuplicateUpdateHandler; +import com.deepclone.lw.interfaces.game.updates.GameUpdate; +import com.deepclone.lw.interfaces.game.updates.GameUpdatePhase; +import com.deepclone.lw.interfaces.game.updates.GameUpdatePhaseHandler; +import com.deepclone.lw.interfaces.game.updates.UpdatesDAO; +import com.deepclone.lw.interfaces.sys.ConstantDefinition; +import com.deepclone.lw.interfaces.sys.ConstantsManager; +import com.deepclone.lw.interfaces.sys.MaintenanceStatusException; +import com.deepclone.lw.interfaces.sys.SystemStatus; +import com.deepclone.lw.interfaces.sys.TickStatusException; +import com.deepclone.lw.interfaces.sys.Ticker; +import com.deepclone.lw.interfaces.sys.Ticker.Frequency; + + + +/** + * Implementation of the game update management component. + * + * @author tseeker + */ +public class GameUpdateBean + implements GameUpdate , InitializingBean , Runnable , ApplicationContextAware +{ + /** The event scheduling component */ + private Ticker ticker; + + /** The system status access and update component */ + private SystemStatus systemStatus; + + /** The game update component's logger */ + private SystemLogger logger; + + /** Transaction template */ + private TransactionTemplate tTemplate; + + /** Game updates data access component */ + private UpdatesDAO updatesDao; + + /** Amount of registered, non-default handlers */ + private int nRegisteredHandlers = 0; + + /** Amount of handler components */ + private int nHandlerComponents = -1; + + /** Registered game update phase handlers */ + private final EnumMap< GameUpdatePhase , GameUpdatePhaseHandler > handlers; + + + public GameUpdateBean( ) + { + this.handlers = new EnumMap< GameUpdatePhase , GameUpdatePhaseHandler >( GameUpdatePhase.class ); + } + + + /** + * Dependency injector for the event scheduling component + * + * @param ticker + * the event scheduling component + */ + @Autowired( required = true ) + public void setTicker( Ticker ticker ) + { + this.ticker = ticker; + } + + + /** + * Dependency injector for the system status access component + * + * @param systemStatus + * the system status access component + */ + @Autowired( required = true ) + public void setSystemStatus( SystemStatus systemStatus ) + { + this.systemStatus = systemStatus; + } + + + /** + * Dependency injector that initialises the game update component's logger. + * + * @param logger + * the system logging component + */ + @Autowired( required = true ) + public void setLogger( Logger logger ) + { + this.logger = logger.getSystemLogger( "GameUpdate" ); + } + + + /** + * Dependency injector that initialises the transaction template. + * + * @param transactionManager + * the application's transaction manager + */ + @Autowired( required = true ) + public void setTransactionManager( PlatformTransactionManager transactionManager ) + { + this.tTemplate = new TransactionTemplate( transactionManager ); + } + + + /** + * Dependency injector for the game updates data access component + * + * @param updatesDao + * the game updates data access component + */ + @Autowired( required = true ) + public void setUpdatesDAO( UpdatesDAO updatesDao ) + { + this.updatesDao = updatesDao; + } + + + /** + * Dependency injector which registers the game.updatesPerDay constant. + * + * @param constantsManager + * the constants manager + */ + @Autowired( required = true ) + public void setConstantsManager( ConstantsManager constantsManager ) + { + List< ConstantDefinition > definitions; + ConstantDefinition constant; + definitions = new ArrayList< ConstantDefinition >( 1 ); + constant = new ConstantDefinition( + "game.updatesPerDay" , + "Game (misc)" , + "Game updates per day from the computations's point of view. " + + "This does not affect the actual amount of updates, but changes the computations. " + + "Can be used to speed things up or slow them down without actually changing ticker.interval." , + 1440.0 , 0.05 , 5760.0 ); + definitions.add( 0 , constant ); + constantsManager.registerConstants( definitions ); + } + + + /** + * Read the amount of update phase handlers from the application context. + * + * @param context + * the application context + */ + @Override + public void setApplicationContext( ApplicationContext context ) + throws BeansException + { + this.nHandlerComponents = context.getBeansOfType( GameUpdatePhaseHandler.class ).size( ); + if ( this.nRegisteredHandlers == this.nHandlerComponents ) { + this.initialise( ); + } + } + + + /* Documentation in GameUpdate interface */ + @Override + public void registerHandler( GameUpdatePhaseHandler handler ) + throws DuplicateUpdateHandler + { + GameUpdatePhase phase = handler.getPhase( ); + synchronized ( this.handlers ) { + if ( this.handlers.containsKey( phase ) ) { + throw new DuplicateUpdateHandler( phase ); + } + this.handlers.put( phase , handler ); + } + this.logger.log( LogLevel.DEBUG , "Registered game update handler for phase " + phase.toString( ) ).flush( ); + + this.nRegisteredHandlers++; + if ( this.nRegisteredHandlers == this.nHandlerComponents ) { + this.initialise( ); + } + } + + + /** + * Initialise the component if it is ready. + */ + @Override + public void afterPropertiesSet( ) + { + if ( this.nRegisteredHandlers == this.nHandlerComponents ) { + this.initialise( ); + } + } + + + /** + * Finish any pending computations (unless maintenance mode is active), then register the game + * update task into the {@link #ticker}. + */ + private void initialise( ) + { + // Finish previous tick if possible + try { + this.endPreviousTick( ); + } catch ( MaintenanceStatusException e ) { + // EMPTY + } + + // Register ticker task + this.ticker.registerTask( Frequency.MINUTE , "Game update" , this ); + + // Make sure initialisation only occurs once + this.nHandlerComponents = -1; + } + + + /** + * When the game update event is triggered by the system's scheduling component, attempt to run + * a game update. + * + * First, check if there is already a game update in progress, and attempt to finish running it + * if necessary. Otherwise start a new update though the system status manager, and execute it. + */ + @Override + public void run( ) + { + // Attempt to end the previous tick, if e.g. maintenance mode was initiated while it was + // being processed + try { + if ( this.endPreviousTick( ) ) { + return; + } + } catch ( MaintenanceStatusException e ) { + return; + } + + // Initiate next tick + long tickId; + try { + tickId = this.systemStatus.startTick( ); + } catch ( TickStatusException e ) { + throw new RuntimeException( "tick initiated while previous tick still being processed" , e ); + } catch ( MaintenanceStatusException e ) { + return; + } + + // Execute tick + this.logger.log( LogLevel.DEBUG , "Tick " + tickId + " started" ).flush( ); + this.executeUpdate( tickId ); + } + + + /** + * Check if a game update was in progress and finish running it if necessary. + * + * @return true if a game update was already being executed, false + * otherwise. + * + * @throws MaintenanceStatusException + * if the game is under maintenance. + */ + private boolean endPreviousTick( ) + throws MaintenanceStatusException + { + Long currentTick = this.systemStatus.checkStuckTick( ); + if ( currentTick == null ) { + return false; + } + + this.logger.log( LogLevel.WARNING , "Tick " + currentTick + " restarted" ).flush( ); + this.executeUpdate( currentTick.longValue( ) ); + + return true; + } + + + /** + * Execute all phase handlers for a game update, then mark the update as completed. + * + * @param updateId + * the identifier of the current update + */ + private void executeUpdate( long updateId ) + { + for ( GameUpdatePhase phase : GameUpdatePhase.values( ) ) { + this.executeUpdatePhase( updateId , phase ); + } + + try { + this.systemStatus.endTick( ); + } catch ( TickStatusException e ) { + throw new RuntimeException( "Game update completed but status error reported" , e ); + } catch ( MaintenanceStatusException e ) { + return; + } + + this.logger.log( LogLevel.TRACE , "Tick " + updateId + " completed" ).flush( ); + } + + + /** + * Execute a phase of the game update. + * + * @param updateId + * the identifier of the current update + * @param phase + * the phase of the update to execute + */ + private void executeUpdatePhase( final long updateId , GameUpdatePhase phase ) + { + final GameUpdatePhaseHandler handler = this.getHandlerForPhase( phase ); + handler.onPhaseStart( updateId ); + + boolean hasMore; + do { + hasMore = this.tTemplate.execute( new TransactionCallback< Boolean >( ) { + @Override + public Boolean doInTransaction( TransactionStatus status ) + { + return handler.updateGame( updateId ); + } + } ); + } while ( hasMore ); + } + + + /** + * Access the handler for an update phase. If no handler has been registered, create a default + * {@link ProceduralGameUpdate} handler. + * + * @param phase + * the update phase whose handler is to be retrieved + * @return the game update handler + */ + private GameUpdatePhaseHandler getHandlerForPhase( GameUpdatePhase phase ) + { + GameUpdatePhaseHandler handler; + synchronized ( this.handlers ) { + handler = this.handlers.get( phase ); + if ( handler == null ) { + this.logger.log( LogLevel.DEBUG , "Creating default handler for phase " + phase.toString( ) ).flush( ); + handler = new ProceduralGameUpdate( this.updatesDao , phase ); + this.handlers.put( phase , handler ); + } + } + return handler; + } + +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/java/com/deepclone/lw/beans/updates/ProceduralGameUpdate.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/java/com/deepclone/lw/beans/updates/ProceduralGameUpdate.java new file mode 100644 index 0000000..73480ed --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/java/com/deepclone/lw/beans/updates/ProceduralGameUpdate.java @@ -0,0 +1,52 @@ +package com.deepclone.lw.beans.updates; + + +import com.deepclone.lw.interfaces.game.updates.GameUpdatePhase; +import com.deepclone.lw.interfaces.game.updates.GameUpdatePhaseHandler; +import com.deepclone.lw.interfaces.game.updates.UpdatesDAO; + + + +class ProceduralGameUpdate + implements GameUpdatePhaseHandler +{ + + private final GameUpdatePhase phase; + private final UpdatesDAO updatesDao; + + + ProceduralGameUpdate( UpdatesDAO updatesDao , GameUpdatePhase phase ) + { + this.updatesDao = updatesDao; + this.phase = phase; + } + + + @Override + public GameUpdatePhase getPhase( ) + { + return this.phase; + } + + + @Override + public boolean updateGame( long updateId ) + { + if ( !this.updatesDao.prepareUpdates( updateId , this.phase ) ) { + return false; + } + + this.updatesDao.executeProceduralUpdate( updateId , this.phase ); + this.updatesDao.validateUpdatedRecords( updateId , this.phase ); + + return true; + } + + + @Override + public void onPhaseStart( long updateId ) + { + // EMPTY + } + +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/java/com/deepclone/lw/beans/updates/UpdatesDAOBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/java/com/deepclone/lw/beans/updates/UpdatesDAOBean.java new file mode 100644 index 0000000..69a3af3 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/java/com/deepclone/lw/beans/updates/UpdatesDAOBean.java @@ -0,0 +1,85 @@ +package com.deepclone.lw.beans.updates; + + +import java.sql.Types; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; + +import com.deepclone.lw.interfaces.game.updates.GameUpdatePhase; +import com.deepclone.lw.interfaces.game.updates.UpdatesDAO; +import com.deepclone.lw.utils.StoredProc; + + + +/** + * Implementation of the game update data access component. + * + * @author tseeker + */ +public class UpdatesDAOBean + implements UpdatesDAO +{ + + /** Wrapper for the stored procedure that prepares updates */ + private StoredProc fPrepareUpdates; + + /** Wrapper for the stored procedure that executes a procedural game update */ + private StoredProc fExecuteProcedural; + + /** Wrapper for the stored procedure that marks update records as processed */ + private StoredProc fUpdatesProcessed; + + + /** + * Dependency injector that initialises stored procedure call handlers. + * + * @param dataSource + * the data source + */ + @Autowired( required = true ) + public void setDataSource( DataSource dataSource ) + { + // Stored procedure that prepares updates + this.fPrepareUpdates = new StoredProc( dataSource , "sys" , "prepare_updates" ); + this.fPrepareUpdates.addParameter( "u_id" , Types.BIGINT ); + this.fPrepareUpdates.addParameter( "u_type" , "update_type" ); + this.fPrepareUpdates.addOutput( "has_more" , Types.BOOLEAN ); + + // Stored procedure that executes a procedural game update + this.fExecuteProcedural = new StoredProc( dataSource , "sys" , "exec_update_proc" ); + this.fExecuteProcedural.addParameter( "u_id" , Types.BIGINT ); + this.fExecuteProcedural.addParameter( "u_type" , "update_type" ); + + // Stored procedure that marks update records as processed + this.fUpdatesProcessed = new StoredProc( dataSource , "sys" , "updates_processed" ); + this.fUpdatesProcessed.addParameter( "u_id" , Types.BIGINT ); + this.fUpdatesProcessed.addParameter( "u_type" , "update_type" ); + } + + + /* Documentation in UpdatesDAO interface */ + @Override + public boolean prepareUpdates( long updateId , GameUpdatePhase phase ) + { + return (Boolean) this.fPrepareUpdates.execute( updateId , phase.toString( ) ).get( "has_more" ); + } + + + /* Documentation in UpdatesDAO interface */ + @Override + public void executeProceduralUpdate( long updateId , GameUpdatePhase phase ) + { + this.fExecuteProcedural.execute( updateId , phase.toString( ) ); + } + + + /* Documentation in UpdatesDAO interface */ + @Override + public void validateUpdatedRecords( long updateId , GameUpdatePhase phase ) + { + this.fUpdatesProcessed.execute( updateId , phase ); + } + +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/resources/configuration/updates-beans.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/resources/configuration/updates-beans.xml new file mode 100644 index 0000000..7387fce --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/resources/configuration/updates-beans.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/resources/configuration/simple/game-update-bean.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/resources/configuration/updates/game-update-bean.xml similarity index 100% rename from legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/resources/configuration/simple/game-update-bean.xml rename to legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/resources/configuration/updates/game-update-bean.xml diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/resources/configuration/simple/updates-dao-bean.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/resources/configuration/updates/updates-dao-bean.xml similarity index 100% rename from legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-simple/src/main/resources/configuration/simple/updates-dao-bean.xml rename to legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-updates/src/main/resources/configuration/updates/updates-dao-bean.xml diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/pom.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/pom.xml index 0de863a..f1969df 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/pom.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/pom.xml @@ -4,12 +4,12 @@ legacyworlds-server-beans com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-beans-user - 5.99.1 + 5.99.2 Legacy Worlds server - user actions This module defines beans and classes that handle user actions. \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/admin/main/techs/ListCategoriesCommandDelegateBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/admin/main/techs/ListCategoriesCommandDelegateBean.java new file mode 100644 index 0000000..be5fc43 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/admin/main/techs/ListCategoriesCommandDelegateBean.java @@ -0,0 +1,59 @@ +package com.deepclone.lw.beans.user.admin.main.techs; + + +import org.springframework.beans.factory.annotation.Autowired; + +import com.deepclone.lw.beans.user.abst.AutowiredCommandDelegate; +import com.deepclone.lw.beans.user.abst.SessionCommandHandler; +import com.deepclone.lw.beans.user.admin.common.AdminOperation; +import com.deepclone.lw.beans.user.admin.main.AdminCommandsBean; +import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.cmd.admin.adata.Privileges; +import com.deepclone.lw.cmd.admin.techs.ListCategoriesCommand; +import com.deepclone.lw.cmd.admin.techs.ListCategoriesResponse; +import com.deepclone.lw.interfaces.game.techs.TechnologyGraphManager; +import com.deepclone.lw.interfaces.session.ServerSession; +import com.deepclone.lw.session.Command; +import com.deepclone.lw.session.CommandResponse; + + + +public class ListCategoriesCommandDelegateBean + extends AdminOperation + implements AutowiredCommandDelegate +{ + private TechnologyGraphManager manager; + + + @Autowired( required = true ) + public void setManager( TechnologyGraphManager manager ) + { + this.manager = manager; + } + + + @Override + public Class< ? extends SessionCommandHandler > getCommandHandler( ) + { + return AdminCommandsBean.class; + } + + + @Override + public Class< ? extends Command > getType( ) + { + return ListCategoriesCommand.class; + } + + + @Override + public CommandResponse execute( ServerSession session , Command command ) + { + Administrator admin = this.getAdministrator( session ); + if ( !admin.hasPrivilege( Privileges.GDAT ) ) { + return new ListCategoriesResponse( admin ); + } + return new ListCategoriesResponse( admin , this.manager.listCategories( ) ); + } + +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/ImplementTechCommandDelegateBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/techs/ImplementTechCommandDelegateBean.java similarity index 65% rename from legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/ImplementTechCommandDelegateBean.java rename to legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/techs/ImplementTechCommandDelegateBean.java index d6d7165..a0bc22a 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/ImplementTechCommandDelegateBean.java +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/techs/ImplementTechCommandDelegateBean.java @@ -1,4 +1,4 @@ -package com.deepclone.lw.beans.user.player.game; +package com.deepclone.lw.beans.user.player.game.techs; import org.springframework.beans.factory.annotation.Autowired; @@ -6,8 +6,9 @@ import org.springframework.beans.factory.annotation.Autowired; import com.deepclone.lw.beans.user.abst.AutowiredCommandDelegate; import com.deepclone.lw.beans.user.abst.SessionCommandHandler; import com.deepclone.lw.beans.user.player.GameSubTypeBean; -import com.deepclone.lw.cmd.player.ImplementTechCommand; -import com.deepclone.lw.interfaces.game.EmpireManagement; +import com.deepclone.lw.cmd.player.research.ImplementTechCommand; +import com.deepclone.lw.cmd.player.research.ResearchOperationResponse; +import com.deepclone.lw.interfaces.game.techs.EmpireTechnologyManager; import com.deepclone.lw.interfaces.session.ServerSession; import com.deepclone.lw.session.Command; import com.deepclone.lw.session.CommandResponse; @@ -19,13 +20,13 @@ public class ImplementTechCommandDelegateBean { - private EmpireManagement empireManagement; + private EmpireTechnologyManager techManagement; @Autowired( required = true ) - public void setEmpireManager( EmpireManagement manager ) + public void setEmpireManager( EmpireTechnologyManager manager ) { - this.empireManagement = manager; + this.techManagement = manager; } @@ -49,8 +50,8 @@ public class ImplementTechCommandDelegateBean ImplementTechCommand command = (ImplementTechCommand) cParam; int empireId = session.get( "empireId" , Integer.class ); if ( session.get( "vacation" , Boolean.class ) ) { - return this.empireManagement.getOverview( empireId ); + return new ResearchOperationResponse( ); } - return this.empireManagement.implementTechnology( empireId , command.getTech( ) ); + return this.techManagement.implementTechnology( empireId , command.getTech( ) ); } } diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/techs/SetResearchPrioritiesCommandDelegateBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/techs/SetResearchPrioritiesCommandDelegateBean.java new file mode 100644 index 0000000..58923ad --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/techs/SetResearchPrioritiesCommandDelegateBean.java @@ -0,0 +1,56 @@ +package com.deepclone.lw.beans.user.player.game.techs; + + +import org.springframework.beans.factory.annotation.Autowired; + +import com.deepclone.lw.beans.user.abst.AutowiredCommandDelegate; +import com.deepclone.lw.beans.user.abst.SessionCommandHandler; +import com.deepclone.lw.beans.user.player.GameSubTypeBean; +import com.deepclone.lw.cmd.player.research.ResearchOperationResponse; +import com.deepclone.lw.cmd.player.research.SetResearchPrioritiesCommand; +import com.deepclone.lw.interfaces.game.techs.EmpireTechnologyManager; +import com.deepclone.lw.interfaces.session.ServerSession; +import com.deepclone.lw.session.Command; +import com.deepclone.lw.session.CommandResponse; + + + +public class SetResearchPrioritiesCommandDelegateBean + implements AutowiredCommandDelegate +{ + + private EmpireTechnologyManager techManagement; + + + @Autowired( required = true ) + public void setEmpireManager( EmpireTechnologyManager manager ) + { + this.techManagement = manager; + } + + + @Override + public Class< ? extends Command > getType( ) + { + return SetResearchPrioritiesCommand.class; + } + + + @Override + public Class< ? extends SessionCommandHandler > getCommandHandler( ) + { + return GameSubTypeBean.class; + } + + + @Override + public CommandResponse execute( ServerSession session , Command cParam ) + { + SetResearchPrioritiesCommand command = (SetResearchPrioritiesCommand) cParam; + int empireId = session.get( "empireId" , Integer.class ); + if ( session.get( "vacation" , Boolean.class ) ) { + return new ResearchOperationResponse( ); + } + return this.techManagement.setResearchPriorities( empireId , command.getPriorities( ) ); + } +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/techs/ViewResearchCommandDelegateBean.java b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/techs/ViewResearchCommandDelegateBean.java new file mode 100644 index 0000000..d54061b --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/java/com/deepclone/lw/beans/user/player/game/techs/ViewResearchCommandDelegateBean.java @@ -0,0 +1,52 @@ +package com.deepclone.lw.beans.user.player.game.techs; + + +import org.springframework.beans.factory.annotation.Autowired; + +import com.deepclone.lw.beans.user.abst.AutowiredCommandDelegate; +import com.deepclone.lw.beans.user.abst.SessionCommandHandler; +import com.deepclone.lw.beans.user.player.GameSubTypeBean; +import com.deepclone.lw.cmd.player.research.ViewResearchCommand; +import com.deepclone.lw.interfaces.game.techs.EmpireTechnologyManager; +import com.deepclone.lw.interfaces.session.ServerSession; +import com.deepclone.lw.session.Command; +import com.deepclone.lw.session.CommandResponse; + + + +public class ViewResearchCommandDelegateBean + implements AutowiredCommandDelegate +{ + + private EmpireTechnologyManager techManagement; + + + @Autowired( required = true ) + public void setEmpireManager( EmpireTechnologyManager manager ) + { + this.techManagement = manager; + } + + + @Override + public Class< ? extends Command > getType( ) + { + return ViewResearchCommand.class; + } + + + @Override + public Class< ? extends SessionCommandHandler > getCommandHandler( ) + { + return GameSubTypeBean.class; + } + + + @Override + public CommandResponse execute( ServerSession session , Command cParam ) + { + int empireId = session.get( "empireId" , Integer.class ); + return this.techManagement.getResearchData( empireId ); + } + +} diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/resources/configuration/user/admin-session-definer-bean.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/resources/configuration/user/admin-session-definer-bean.xml index deab9c8..9ee2df0 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/resources/configuration/user/admin-session-definer-bean.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/resources/configuration/user/admin-session-definer-bean.xml @@ -93,5 +93,8 @@ + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/resources/configuration/user/player-session-definer-bean.xml b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/resources/configuration/user/player-session-definer-bean.xml index 37a91ea..16a23e9 100644 --- a/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/resources/configuration/user/player-session-definer-bean.xml +++ b/legacyworlds-server/legacyworlds-server-beans/legacyworlds-server-beans-user/src/main/resources/configuration/user/player-session-definer-bean.xml @@ -44,8 +44,12 @@ - + + + + + diff --git a/legacyworlds-server/legacyworlds-server-beans/pom.xml b/legacyworlds-server/legacyworlds-server-beans/pom.xml index 9d74460..b93a25f 100644 --- a/legacyworlds-server/legacyworlds-server-beans/pom.xml +++ b/legacyworlds-server/legacyworlds-server-beans/pom.xml @@ -4,13 +4,13 @@ legacyworlds-server com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-beans Legacy Worlds server beans - 5.99.1 + 5.99.2 pom This metapackage regroups all packages which define beans for the Legacy Worlds server. @@ -32,5 +32,8 @@ legacyworlds-server-beans-bt legacyworlds-server-beans-user legacyworlds-server-beans-simple + legacyworlds-server-beans-techs + legacyworlds-server-beans-updates + legacyworlds-server-beans-events diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/020-functions.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/020-functions.sql index 5a55389..3ef2d79 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/020-functions.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/020-functions.sql @@ -14,6 +14,7 @@ \i parts/functions/030-tech-functions.sql \i parts/functions/035-users-view.sql \i parts/functions/040-empire-functions.sql +\i parts/functions/045-research-functions.sql \i parts/functions/050-computation-functions.sql \i parts/functions/060-universe-functions.sql \i parts/functions/070-users-functions.sql diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/070-constants-data.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/070-constants-data.sql index 82bca01..6441785 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/070-constants-data.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/070-constants-data.sql @@ -25,9 +25,9 @@ CREATE TABLE sys.constant_definitions( name VARCHAR(64) NOT NULL PRIMARY KEY, category_id INT NOT NULL , description TEXT NOT NULL , - min_value REAL , - max_value REAL , - c_value REAL NOT NULL , + min_value DOUBLE PRECISION , + max_value DOUBLE PRECISION , + c_value DOUBLE PRECISION NOT NULL , CHECK( ( min_value IS NULL OR ( min_value IS NOT NULL AND c_value >= min_value ) ) diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/080-techs-data.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/080-techs-data.sql index c539ac2..b46a85a 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/080-techs-data.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/080-techs-data.sql @@ -8,49 +8,65 @@ -- --- Technology lines +-- Categories -- - -CREATE TABLE tech.lines( +CREATE TABLE tech.categories( name_id INT NOT NULL PRIMARY KEY , description_id INT NOT NULL ); -CREATE INDEX idx_lines_description - ON tech.lines (description_id); +CREATE INDEX idx_categories_description + ON tech.categories (description_id); -ALTER TABLE tech.lines - ADD CONSTRAINT fk_lines_name +ALTER TABLE tech.categories + ADD CONSTRAINT fk_categories_name FOREIGN KEY (name_id) REFERENCES defs.strings , - ADD CONSTRAINT fk_lines_description + ADD CONSTRAINT fk_categories_description FOREIGN KEY (description_id) REFERENCES defs.strings; - + -- --- Technology levels +-- Technologies -- -CREATE TABLE tech.levels( - id SERIAL NOT NULL PRIMARY KEY , - line_id INT NOT NULL , - level INT NOT NULL CHECK( level > 0 ) , - name_id INT NOT NULL , +CREATE TABLE tech.technologies( + name_id INT NOT NULL PRIMARY KEY , description_id INT NOT NULL , + category_id INT NOT NULL , points INT NOT NULL CHECK( points > 0 ) , cost INT NOT NULL CHECK( cost > 0 ) ); -CREATE UNIQUE INDEX idx_levels_linelevel - ON tech.levels (line_id, level); -CREATE INDEX idx_levels_name - ON tech.levels (name_id); -CREATE INDEX idx_levels_description - ON tech.levels (description_id); +CREATE INDEX idx_technologies_description + ON tech.technologies (description_id); +CREATE INDEX idx_technologies_category + ON tech.technologies (category_id); -ALTER TABLE tech.levels - ADD CONSTRAINT fk_levels_line - FOREIGN KEY (line_id) REFERENCES tech.lines , - ADD CONSTRAINT fk_levels_name +ALTER TABLE tech.technologies + ADD CONSTRAINT fk_technologies_category + FOREIGN KEY (category_id) REFERENCES tech.categories , + ADD CONSTRAINT fk_technologies_name FOREIGN KEY (name_id) REFERENCES defs.strings , - ADD CONSTRAINT fk_levels_description + ADD CONSTRAINT fk_technologies_description FOREIGN KEY (description_id) REFERENCES defs.strings; + + + +-- +-- Dependencies +-- + +CREATE TABLE tech.dependencies( + technology_id INT NOT NULL , + depends_on INT NOT NULL , + PRIMARY KEY( technology_id , depends_on ) +); + +CREATE INDEX idx_dependencies_dependson + ON tech.dependencies (depends_on); + +ALTER TABLE tech.dependencies + ADD CONSTRAINT fk_dependencies_technology + FOREIGN KEY (technology_id) REFERENCES tech.technologies , + ADD CONSTRAINT fk_dependencies_dependson + FOREIGN KEY (depends_on) REFERENCES tech.technologies; diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/090-buildables-data.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/090-buildables-data.sql index 3a80b4d..5ab70ee 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/090-buildables-data.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/090-buildables-data.sql @@ -32,18 +32,18 @@ ALTER TABLE tech.buildables -- CREATE TABLE tech.buildable_requirements( buildable_id INT NOT NULL , - level_id INT NOT NULL , - PRIMARY KEY( buildable_id , level_id ) + technology_id INT NOT NULL , + PRIMARY KEY( buildable_id , technology_id ) ); -CREATE INDEX idx_buildablereqs_level - ON tech.buildable_requirements( level_id ); +CREATE INDEX idx_buildablereqs_technology + ON tech.buildable_requirements( technology_id ); ALTER TABLE tech.buildable_requirements ADD CONSTRAINT fk_buildablereqs_buildable FOREIGN KEY (buildable_id) REFERENCES tech.buildables , - ADD CONSTRAINT fk_buildablereqs_level - FOREIGN KEY (level_id) REFERENCES tech.levels; + ADD CONSTRAINT fk_buildablereqs_technology + FOREIGN KEY (technology_id) REFERENCES tech.technologies; -- diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/100-universe-data.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/100-universe-data.sql index fb8f379..a784220 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/100-universe-data.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/100-universe-data.sql @@ -28,7 +28,7 @@ CREATE TABLE verse.planets( orbit INT NOT NULL CHECK( orbit BETWEEN 1 AND 5 ) , picture INT NOT NULL , - population REAL NOT NULL + population DOUBLE PRECISION NOT NULL CHECK( population >= 0 ) ); @@ -47,9 +47,9 @@ ALTER TABLE verse.planets -- CREATE TABLE verse.planet_happiness( planet_id INT NOT NULL PRIMARY KEY , - target REAL NOT NULL + target DOUBLE PRECISION NOT NULL CHECK( target BETWEEN 0.0 AND 1.0 ) , - current REAL NOT NULL + current DOUBLE PRECISION NOT NULL CHECK( current > 0 ) ); @@ -63,9 +63,9 @@ ALTER TABLE verse.planet_happiness -- CREATE TABLE verse.planet_money( planet_id INT NOT NULL PRIMARY KEY , - income REAL NOT NULL + income DOUBLE PRECISION NOT NULL CHECK( income >= 0 ) , - upkeep REAL NOT NULL + upkeep DOUBLE PRECISION NOT NULL CHECK( upkeep >= 0 ) ); @@ -81,7 +81,7 @@ CREATE TABLE verse.planet_buildings( planet_id INT NOT NULL , building_id INT NOT NULL , amount INT NOT NULL CHECK( amount >= 0 ) , - damage REAL NOT NULL CHECK( damage >= 0 ) , + damage DOUBLE PRECISION NOT NULL CHECK( damage >= 0 ) , PRIMARY KEY( planet_id , building_id ) ); diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/110-empires-data.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/110-empires-data.sql index 5a3d00a..0cf46be 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/110-empires-data.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/110-empires-data.sql @@ -13,9 +13,9 @@ CREATE TABLE emp.empires( name_id INT NOT NULL PRIMARY KEY , - cash REAL NOT NULL + cash DOUBLE PRECISION NOT NULL CHECK( cash >= 0 ), - debt REAL NOT NULL DEFAULT 0 + debt DOUBLE PRECISION NOT NULL DEFAULT 0 CHECK( debt >= 0) ); @@ -25,28 +25,55 @@ ALTER TABLE emp.empires -- --- Empire technologies +-- Research in progress -- -CREATE TABLE emp.technologies( +CREATE TABLE emp.research( empire_id INT NOT NULL , - line_id INT NOT NULL , - level INT NOT NULL DEFAULT 1 - CHECK( level > 0 ) , - accumulated REAL NOT NULL DEFAULT 0 - CHECK( accumulated >= 0 ), - PRIMARY KEY( empire_id , line_id ) + technology_id INT NOT NULL , + accumulated DOUBLE PRECISION NOT NULL DEFAULT 0 + CHECK( accumulated >= 0 ) , + priority INT NOT NULL + CHECK( priority BETWEEN 0 AND 100 ) , + PRIMARY KEY( empire_id , technology_id ) ); -CREATE INDEX idx_technologies_line - ON emp.technologies (line_id); +CREATE INDEX idx_research_technology + ON emp.research (technology_id); -ALTER TABLE emp.technologies - ADD CONSTRAINT fk_technologies_empire +ALTER TABLE emp.research + ADD CONSTRAINT fk_research_empire FOREIGN KEY (empire_id) REFERENCES emp.empires ON DELETE CASCADE , - ADD CONSTRAINT fk_technologies_line - FOREIGN KEY (line_id) REFERENCES tech.lines; + ADD CONSTRAINT fk_research_technology + FOREIGN KEY (technology_id) REFERENCES tech.technologies + ON DELETE CASCADE; + + + +-- +-- Researched technologies (both implemented and pending implementation) +-- + +CREATE TABLE emp.researched_technologies( + empire_id INT NOT NULL , + technology_id INT NOT NULL , + implemented BOOLEAN NOT NULL , + PRIMARY KEY ( empire_id , technology_id ) +); + +CREATE INDEX idx_researched_technology + ON emp.researched_technologies ( technology_id ); +CREATE INDEX idx_researched_implemented + ON emp.researched_technologies ( empire_id , implemented ); + +ALTER TABLE emp.researched_technologies + ADD CONSTRAINT fk_researched_empire + FOREIGN KEY ( empire_id ) REFERENCES emp.empires + ON DELETE CASCADE , + ADD CONSTRAINT fk_researched_technology + FOREIGN KEY ( technology_id ) REFERENCES tech.technologies + ON DELETE CASCADE; -- diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/120-construction-data.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/120-construction-data.sql index 9ae9fcd..2e1a050 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/120-construction-data.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/120-construction-data.sql @@ -13,8 +13,8 @@ CREATE TABLE verse.bld_queues( planet_id INT NOT NULL PRIMARY KEY , - money REAL NOT NULL CHECK( money >= 0 ), - work REAL NOT NULL CHECK( work >= 0 ) + money DOUBLE PRECISION NOT NULL CHECK( money >= 0 ), + work DOUBLE PRECISION NOT NULL CHECK( work >= 0 ) ); ALTER TABLE verse.bld_queues @@ -51,8 +51,8 @@ ALTER TABLE verse.bld_items CREATE TABLE verse.mil_queues( planet_id INT NOT NULL PRIMARY KEY , - money REAL NOT NULL CHECK( money >= 0 ), - work REAL NOT NULL CHECK( work >= 0 ) + money DOUBLE PRECISION NOT NULL CHECK( money >= 0 ), + work DOUBLE PRECISION NOT NULL CHECK( work >= 0 ) ); ALTER TABLE verse.mil_queues diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/130-fleets-data.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/130-fleets-data.sql index 7d7bb0f..96cd979 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/130-fleets-data.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/130-fleets-data.sql @@ -46,7 +46,7 @@ CREATE TABLE fleets.ships( fleet_id BIGINT NOT NULL , ship_id INT NOT NULL , amount INT NOT NULL CHECK( amount >= 0 ) , - damage REAL NOT NULL , + damage DOUBLE PRECISION NOT NULL , PRIMARY KEY( fleet_id , ship_id ) ); @@ -89,8 +89,8 @@ ALTER TABLE fleets.movements CREATE TABLE fleets.ms_space( movement_id BIGINT NOT NULL PRIMARY KEY , - start_x REAL NOT NULL , - start_y REAL NOT NULL + start_x DOUBLE PRECISION NOT NULL , + start_y DOUBLE PRECISION NOT NULL ); ALTER TABLE fleets.ms_space diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/170-events-data.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/170-events-data.sql index 186a032..d1d72fd 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/170-events-data.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/170-events-data.sql @@ -3,10 +3,163 @@ -- -- Storage of events (internal messages) -- --- Copyright(C) 2004-2010, DeepClone Development +-- Copyright(C) 2004-2011, DeepClone Development -- -------------------------------------------------------- +-- +-- Event type definitionss +-- + +CREATE TABLE events.event_type_definitions( + etd_type VARCHAR( 48 ) NOT NULL + PRIMARY KEY , + etd_priority INT NOT NULL + CHECK( etd_priority BETWEEN 1 AND 5 ) , + etd_user_priority BOOLEAN NOT NULL +); + + +-- +-- Types of field contents +-- +-- INMB integer +-- RNMB real number +-- TEXT text +-- BOOL boolean +-- I18N internationalised string +-- EREF game entity reference +-- + +CREATE TYPE events.field_content_type + AS ENUM ( 'INMB' , 'RNMB' , 'TEXT' , 'BOOL' , 'I18N' , 'EREF' ); + + +-- +-- Subtypes of reference field contents +-- +-- EMP empire +-- MAP map object +-- FLT fleet +-- BAT battle +-- ADM administrator +-- MSG message +-- BUG bug report +-- + +CREATE TYPE events.field_reference_type + AS ENUM ( 'EMP' , 'MAP' , 'FLT' , 'BAT' , 'ADM' , 'MSG' , 'BUG' ); + + +-- +-- Event field definitions +-- + +CREATE TABLE events.event_field_definitions( + etd_type VARCHAR( 48 ) NOT NULL , + efd_field VARCHAR( 48 ) NOT NULL , + efd_required BOOLEAN NOT NULL , + efd_type events.field_content_type NOT NULL , + efd_reference_type events.field_reference_type , + efd_low_boundary DOUBLE PRECISION , + efd_high_boundary DOUBLE PRECISION , + + PRIMARY KEY ( etd_type , efd_field ) , + + CHECK( efd_type = 'EREF' AND efd_reference_type IS NOT NULL + OR efd_type <> 'EREF' AND efd_reference_type IS NULL ) , + + CHECK ( efd_type IN ( 'INMB' , 'RNMB' , 'TEXT' ) + OR efd_type NOT IN ( 'INMB' , 'RNMB' , 'TEXT' ) + AND efd_low_boundary IS NULL + AND efd_high_boundary IS NULL ) , + + CHECK ( efd_low_boundary IS NULL OR efd_high_boundary IS NULL + OR efd_low_boundary < efd_high_boundary ) +); + +ALTER TABLE events.event_field_definitions + ADD CONSTRAINT fk_efd_type + FOREIGN KEY ( etd_type ) REFERENCES events.event_type_definitions; + + + +-- +-- Event format definitions +-- + +CREATE TABLE events.event_format_definitions( + etd_type VARCHAR( 48 ) NOT NULL , + efmd_order INT NOT NULL , + efmd_template INT NOT NULL , + + PRIMARY KEY ( etd_type , efmd_order ) +); + +CREATE INDEX idx_efmd_template + ON events.event_format_definitions ( efmd_template ); + +ALTER TABLE events.event_format_definitions + ADD CONSTRAINT fk_efmd_type + FOREIGN KEY ( etd_type ) REFERENCES events.event_type_definitions , + ADD CONSTRAINT fk_efmd_template + FOREIGN KEY ( efmd_template ) REFERENCES defs.strings; + + + +-- +-- Types of format conditions +-- +-- EX has value all +-- EQ is equal to ... all except EREF +-- NE is not equal to ... all except EREF +-- GT > ... INMB , RNMB +-- length > ... TEXT +-- LT < ... INMB , RNMB +-- shorter than ... TEXT +-- GE >= ... INMB , RNMB +-- length >= ... TEXT +-- LE <= ... INMB , RNMB +-- length <= ... TEXT +-- AV available EREF +-- + +CREATE TYPE events.format_condition_type + AS ENUM ( 'EX' , 'EQ' , 'NE' , 'GT' , 'LT' , 'GE' , 'LE' , 'AV' ); + + +-- +-- Conditions on format definitions +-- + +CREATE TABLE events.efmt_conditions( + etd_type VARCHAR( 48 ) NOT NULL , + efmd_order INT NOT NULL , + efd_field VARCHAR( 48 ) NOT NULL , + efc_type events.format_condition_type NOT NULL , + efc_boolean BOOLEAN , + efc_numeric DOUBLE PRECISION , + efc_string TEXT , + + PRIMARY KEY( etd_type , efmd_order , efd_field , efc_type ) +); + +CREATE INDEX idx_efmtc_field + ON events.efmt_conditions ( etd_type , efd_field ); + +ALTER TABLE events.efmt_conditions + ADD CONSTRAINT fk_efmtc_format + FOREIGN KEY ( etd_type , efmd_order ) REFERENCES events.event_format_definitions , + ADD CONSTRAINT fk_efmtc_field + FOREIGN KEY ( etd_type , efd_field ) REFERENCES events.event_field_definitions; + + + + +-- -------------------------------------------------------- +-- OLD CODE BELOW +-- + CREATE TYPE event_type AS ENUM ( 'QUEUE' , 'EMPIRE' , 'FLEETS' , 'PLANET', 'ALLIANCE', 'ADMIN' , 'BUGS' ); @@ -101,7 +254,7 @@ ALTER TABLE events.empire_events FOREIGN KEY (event_id) REFERENCES events.events ON DELETE CASCADE, ADD CONSTRAINT fk_empevents_tech - FOREIGN KEY (technology_id) REFERENCES tech.levels; + FOREIGN KEY (technology_id) REFERENCES tech.technologies; diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/010-constants-functions.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/010-constants-functions.sql index f0c78ed..c4cd55f 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/010-constants-functions.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/010-constants-functions.sql @@ -57,8 +57,8 @@ $$ LANGUAGE plpgsql; -- the constant's actual value -- -CREATE OR REPLACE FUNCTION sys.uoc_constant( cnm TEXT , cdesc TEXT , ccnm TEXT , dval REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION sys.uoc_constant( cnm TEXT , cdesc TEXT , ccnm TEXT , dval DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT VOLATILE SECURITY DEFINER @@ -66,7 +66,7 @@ CREATE OR REPLACE FUNCTION sys.uoc_constant( cnm TEXT , cdesc TEXT , ccnm TEXT , DECLARE ccid INT; occid INT; - cval REAL; + cval DOUBLE PRECISION; BEGIN ccid := sys.cog_constant_category( ccnm ); @@ -97,7 +97,7 @@ BEGIN END; $$ LANGUAGE plpgsql; -GRANT EXECUTE ON FUNCTION sys.uoc_constant( TEXT , TEXT , TEXT , REAL ) TO :dbuser; +GRANT EXECUTE ON FUNCTION sys.uoc_constant( TEXT , TEXT , TEXT , DOUBLE PRECISION ) TO :dbuser; @@ -116,8 +116,8 @@ GRANT EXECUTE ON FUNCTION sys.uoc_constant( TEXT , TEXT , TEXT , REAL ) TO :dbus -- the constant's actual value -- -CREATE OR REPLACE FUNCTION sys.uoc_constant( cnm TEXT , cdesc TEXT , ccnm TEXT , dval REAL , bval REAL , ismin BOOLEAN ) - RETURNS REAL +CREATE OR REPLACE FUNCTION sys.uoc_constant( cnm TEXT , cdesc TEXT , ccnm TEXT , dval DOUBLE PRECISION , bval DOUBLE PRECISION , ismin BOOLEAN ) + RETURNS DOUBLE PRECISION STRICT VOLATILE SECURITY DEFINER @@ -125,9 +125,9 @@ CREATE OR REPLACE FUNCTION sys.uoc_constant( cnm TEXT , cdesc TEXT , ccnm TEXT , DECLARE ccid INT; occid INT; - cval REAL; - mival REAL; - maval REAL; + cval DOUBLE PRECISION; + mival DOUBLE PRECISION; + maval DOUBLE PRECISION; BEGIN IF ismin THEN mival := bval; @@ -175,7 +175,7 @@ BEGIN END; $$ LANGUAGE plpgsql; -GRANT EXECUTE ON FUNCTION sys.uoc_constant( TEXT , TEXT , TEXT , REAL , REAL , BOOLEAN ) TO :dbuser; +GRANT EXECUTE ON FUNCTION sys.uoc_constant( TEXT , TEXT , TEXT , DOUBLE PRECISION , DOUBLE PRECISION , BOOLEAN ) TO :dbuser; @@ -194,8 +194,8 @@ GRANT EXECUTE ON FUNCTION sys.uoc_constant( TEXT , TEXT , TEXT , REAL , REAL , B -- the constant's actual value -- -CREATE OR REPLACE FUNCTION sys.uoc_constant( cnm TEXT , cdesc TEXT , ccnm TEXT , dval REAL , mival REAL , maval REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION sys.uoc_constant( cnm TEXT , cdesc TEXT , ccnm TEXT , dval DOUBLE PRECISION , mival DOUBLE PRECISION , maval DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT VOLATILE SECURITY DEFINER @@ -203,7 +203,7 @@ CREATE OR REPLACE FUNCTION sys.uoc_constant( cnm TEXT , cdesc TEXT , ccnm TEXT , DECLARE ccid INT; occid INT; - cval REAL; + cval DOUBLE PRECISION; BEGIN ccid := sys.cog_constant_category( ccnm ); @@ -243,7 +243,7 @@ BEGIN END; $$ LANGUAGE plpgsql; -GRANT EXECUTE ON FUNCTION sys.uoc_constant( TEXT , TEXT , TEXT , REAL , REAL , REAL ) TO :dbuser; +GRANT EXECUTE ON FUNCTION sys.uoc_constant( TEXT , TEXT , TEXT , DOUBLE PRECISION , DOUBLE PRECISION , DOUBLE PRECISION ) TO :dbuser; @@ -259,7 +259,7 @@ GRANT EXECUTE ON FUNCTION sys.uoc_constant( TEXT , TEXT , TEXT , REAL , REAL , R -- TRUE on success, FALSE on failure -- -CREATE OR REPLACE FUNCTION sys.set_constant( cnm TEXT , nval REAL , aid INT ) +CREATE OR REPLACE FUNCTION sys.set_constant( cnm TEXT , nval DOUBLE PRECISION , aid INT ) RETURNS BOOLEAN STRICT VOLATILE @@ -282,7 +282,7 @@ BEGIN END; $$ LANGUAGE plpgsql; -GRANT EXECUTE ON FUNCTION sys.set_constant( TEXT , REAL , INT ) TO :dbuser; +GRANT EXECUTE ON FUNCTION sys.set_constant( TEXT , DOUBLE PRECISION , INT ) TO :dbuser; @@ -294,7 +294,7 @@ GRANT EXECUTE ON FUNCTION sys.set_constant( TEXT , REAL , INT ) TO :dbuser; -- CREATE OR REPLACE FUNCTION sys.get_constant( cnm TEXT ) - RETURNS REAL + RETURNS DOUBLE PRECISION STRICT STABLE SECURITY DEFINER AS $$ diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/030-tech-functions.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/030-tech-functions.sql index eb2c74a..df70d4e 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/030-tech-functions.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/030-tech-functions.sql @@ -40,94 +40,226 @@ CREATE VIEW tech.ships_view FROM tech.buildables b INNER JOIN tech.ships s ON b.name_id = s.buildable_id; + + +-- +-- Categories view +-- + +CREATE VIEW tech.categories_view + AS SELECT ns.name AS name , ds.name AS description + FROM tech.categories c + INNER JOIN defs.strings ns + ON ns.id = c.name_id + INNER JOIN defs.strings ds + ON ds.id = c.description_id; + +GRANT SELECT ON tech.categories_view TO :dbuser; + + +-- +-- Technologies view +-- + +CREATE VIEW tech.technologies_view + AS SELECT cs.name AS category , ns.name AS name , + ds.name AS description , t.points , t.cost + FROM tech.technologies t + INNER JOIN defs.strings cs + ON cs.id = t.category_id + INNER JOIN defs.strings ns + ON ns.id = t.name_id + INNER JOIN defs.strings ds + ON ds.id = t.description_id; + +GRANT SELECT ON tech.technologies_view TO :dbuser; + + +-- +-- Dependencies view +-- + +CREATE VIEW tech.dependencies_view + AS SELECT ts.name AS technology , ds.name AS dependency + FROM tech.dependencies d + INNER JOIN defs.strings ts + ON ts.id = d.technology_id + INNER JOIN defs.strings ds + ON ds.id = d.depends_on; + +GRANT SELECT ON tech.dependencies_view TO :dbuser; -- --- Creates or updates a technology line +-- Creates or updates a technology category -- -- Parameters: --- tln Tech line name --- tld Tech line description +-- cat_name String identifier of the category's name +-- cat_desc String identifier of the category's description +-- +-- Returns: +-- 0 No error +-- 1 Name string not found +-- 2 Description string not found -- -CREATE OR REPLACE FUNCTION tech.uoc_line( tln TEXT , tld TEXT ) - RETURNS VOID - STRICT - VOLATILE +CREATE OR REPLACE FUNCTION tech.uoc_category( cat_name TEXT , cat_desc TEXT ) + RETURNS INT + STRICT VOLATILE SECURITY DEFINER AS $$ DECLARE - nid INT; - did INT; + cn_id INT; + cd_id INT; BEGIN - -- Get string identifiers - SELECT INTO nid id FROM defs.strings WHERE name = tln; - SELECT INTO did id FROM defs.strings WHERE name = tld; - - -- Try creating / updating + -- Get name / description identifiers + SELECT INTO cn_id id FROM defs.strings WHERE name = cat_name; + IF NOT FOUND THEN + RETURN 1; + END IF; + SELECT INTO cd_id id FROM defs.strings WHERE name = cat_desc; + IF NOT FOUND THEN + RETURN 2; + END IF; + + -- Create or update the category BEGIN - INSERT INTO tech.lines ( name_id , description_id ) - VALUES ( nid , did ); + INSERT INTO tech.categories ( name_id , description_id ) + VALUES ( cn_id , cd_id ); EXCEPTION WHEN unique_violation THEN - UPDATE tech.lines SET description_id = did - WHERE name_id = nid; + UPDATE tech.categories SET description_id = cd_id + WHERE name_id = cn_id; END; + RETURN 0; END; $$ LANGUAGE plpgsql; -GRANT EXECUTE ON FUNCTION tech.uoc_line( TEXT , TEXT ) TO :dbuser; - +GRANT EXECUTE ON FUNCTION tech.uoc_category( TEXT , TEXT ) to :dbuser; -- --- Creates or updates a technology level +-- Creates or updates a technology. If there are dependencies, clear them. -- -- Parameters: --- tln Tech line name --- lv Level --- lvn Level name --- lvd Level description --- lvp Points --- lvc Cost +-- nt_name Name string identifier +-- nt_category Category string identifier +-- nt_desc Description string identifier +-- nt_points Research points for the technology +-- nt_cost Cost of the technology +-- +-- Returns: +-- 0 No error +-- 1 Name string not found +-- 2 Category not found +-- 3 Description string not found +-- 4 Invalid parameters (points or cost) -- -CREATE OR REPLACE FUNCTION tech.uoc_level( tln TEXT , lv INT , lvn TEXT , lvd TEXT , lvp INT , lvc INT ) - RETURNS VOID - STRICT - VOLATILE +CREATE OR REPLACE FUNCTION tech.uoc_technology( nt_name TEXT , nt_category TEXT , nt_desc TEXT , + nt_points INT , nt_cost INT ) + RETURNS INT + STRICT VOLATILE SECURITY DEFINER AS $$ DECLARE - lid INT; - nid INT; - did INT; + n_id INT; + c_id INT; + d_id INT; BEGIN - -- Get tech line - SELECT INTO lid t.name_id - FROM tech.lines t - INNER JOIN defs.strings s - ON s.id = t.name_id - WHERE s.name = tln; + -- Get name, category and description identifiers + SELECT INTO n_id id FROM defs.strings WHERE name = nt_name; + IF NOT FOUND THEN + RETURN 1; + END IF; + SELECT INTO c_id c.name_id FROM tech.categories c + INNER JOIN defs.strings s + ON s.id = c.name_id AND s.name = nt_category; + IF NOT FOUND THEN + RETURN 2; + END IF; + SELECT INTO d_id id FROM defs.strings WHERE name = nt_desc; + IF NOT FOUND THEN + RETURN 3; + END IF; - -- Get name / description IDs - SELECT INTO nid id FROM defs.strings WHERE name = lvn; - SELECT INTO did id FROM defs.strings WHERE name = lvd; - - -- Create or update the level + -- Create or update the technology BEGIN - INSERT INTO tech.levels ( line_id , level , name_id , description_id , points , cost ) - VALUES ( lid , lv , nid , did , lvp , lvc ); + BEGIN + INSERT INTO tech.technologies ( name_id , category_id , description_id , points , cost ) + VALUES ( n_id , c_id , d_id , nt_points , nt_cost ); + EXCEPTION + WHEN unique_violation THEN + UPDATE tech.technologies + SET category_id = c_id , description_id = cd_id , + points = nt_points , cost = nt_cost + WHERE name_id = n_id; + DELETE FROM tech.dependencies + WHERE technology_id = n_id; + END; + EXCEPTION + WHEN check_violation THEN + RETURN 4; + END; + RETURN 0; +END; +$$ LANGUAGE plpgsql; + +GRANT EXECUTE ON FUNCTION tech.uoc_technology( TEXT , TEXT , TEXT , INT , INT ) to :dbuser; + + +-- +-- Adds a technology dependency +-- +-- Parameters: +-- nd_name Name of the dependent technology +-- nd_dep Name of the dependency +-- +-- Returns: +-- 0 No error +-- 1 Technology not found +-- 2 Dependency not found +-- 3 Duplicate dependency +-- +CREATE OR REPLACE FUNCTION tech.add_dependency( nd_name TEXT , nd_dep TEXT ) + RETURNS INT + STRICT VOLATILE + SECURITY DEFINER + AS $$ +DECLARE + t_id INT; + d_id INT; +BEGIN + -- Get technology + SELECT INTO t_id t.name_id FROM tech.technologies t + INNER JOIN defs.strings s + ON s.id = t.name_id AND s.name = nd_name; + IF NOT FOUND THEN + RETURN 1; + END IF; + + -- Get dependency + SELECT INTO d_id t.name_id FROM tech.technologies t + INNER JOIN defs.strings s + ON s.id = t.name_id AND s.name = nd_dep; + IF NOT FOUND THEN + RETURN 2; + END IF; + + -- Add dependency + BEGIN + INSERT INTO tech.dependencies ( technology_id , depends_on ) + VALUES ( t_id , d_id ); EXCEPTION WHEN unique_violation THEN - UPDATE tech.levels SET name_id = nid , description_id = did , points = lvp , cost = lvc - WHERE line_id = lid AND level = lv; + RETURN 3; END; + RETURN 0; END; $$ LANGUAGE plpgsql; -GRANT EXECUTE ON FUNCTION tech.uoc_level( TEXT , INT , TEXT , TEXT , INT , INT ) to :dbuser; +GRANT EXECUTE ON FUNCTION tech.add_dependency( TEXT, TEXT ) TO :dbuser; @@ -140,14 +272,13 @@ GRANT EXECUTE ON FUNCTION tech.uoc_level( TEXT , INT , TEXT , TEXT , INT , INT ) -- bdc Cost -- bdw Work -- bdu Upkeep --- bdtn Dependency (name) --- bdtl Dependency (level) +-- bdtn Dependency -- -- Returns: -- the buildable's identifier -- -CREATE OR REPLACE FUNCTION tech.uoc_buildable( bdn TEXT , bdd TEXT , bdc INT , bdw INT , bdu INT , bdtn TEXT , bdtl INT ) +CREATE OR REPLACE FUNCTION tech.uoc_buildable( bdn TEXT , bdd TEXT , bdc INT , bdw INT , bdu INT , bdtn TEXT ) RETURNS INT STRICT VOLATILE @@ -162,10 +293,10 @@ BEGIN SELECT INTO nid id FROM defs.strings WHERE name = bdn; SELECT INTO did id FROM defs.strings WHERE name = bdd; IF bdtn <> '' THEN - SELECT INTO tdid tl.id FROM tech.levels tl + SELECT INTO tdid tl.name_id FROM tech.technologies tl INNER JOIN defs.strings s - ON s.id = tl.line_id - WHERE s.name = bdtn AND tl.level = bdtl; + ON s.id = tl.name_id + WHERE s.name = bdtn; END IF; -- Create or update the definition @@ -181,7 +312,7 @@ BEGIN -- Set dependencies DELETE FROM tech.buildable_requirements WHERE buildable_id = nid; IF bdtn <> '' THEN - INSERT INTO tech.buildable_requirements ( buildable_id , level_id ) + INSERT INTO tech.buildable_requirements ( buildable_id , technology_id ) VALUES ( nid , tdid ); END IF; @@ -215,7 +346,7 @@ CREATE OR REPLACE FUNCTION tech.uoc_building( bdn TEXT , bdd TEXT , bdc INT , bd DECLARE bdid INT; BEGIN - bdid := tech.uoc_buildable( bdn , bdd , bdc , bdw , bdu , '' , 0 ); + bdid := tech.uoc_buildable( bdn , bdd , bdc , bdw , bdu , '' ); PERFORM buildable_id FROM tech.ships WHERE buildable_id = bdid; IF FOUND THEN @@ -249,22 +380,20 @@ GRANT EXECUTE ON FUNCTION tech.uoc_building( TEXT , TEXT , INT , INT , INT , INT -- bdwk Workers -- bdot Output type -- bdo Output --- bdtn Dependency (name) --- bdtl Dependency (level) +-- bdtn Dependency -- CREATE OR REPLACE FUNCTION tech.uoc_building( bdn TEXT , bdd TEXT , bdc INT , bdw INT , bdu INT , bdwk INT , bdot building_output_type , bdo INT , - bdtn TEXT , bdtl INT ) + bdtn TEXT ) RETURNS VOID - STRICT - VOLATILE + STRICT VOLATILE SECURITY DEFINER AS $$ DECLARE bdid INT; BEGIN - bdid := tech.uoc_buildable( bdn , bdd , bdc , bdw , bdu , bdtn , bdtl ); + bdid := tech.uoc_buildable( bdn , bdd , bdc , bdw , bdu , bdtn ); PERFORM buildable_id FROM tech.ships WHERE buildable_id = bdid; IF FOUND THEN @@ -282,7 +411,7 @@ BEGIN END; $$ LANGUAGE plpgsql; -GRANT EXECUTE ON FUNCTION tech.uoc_building( TEXT , TEXT , INT , INT , INT , INT , building_output_type , INT , TEXT , INT ) TO :dbuser; +GRANT EXECUTE ON FUNCTION tech.uoc_building( TEXT , TEXT , INT , INT , INT , INT , building_output_type , INT , TEXT ) TO :dbuser; @@ -309,7 +438,7 @@ CREATE OR REPLACE FUNCTION tech.uoc_ship( sn TEXT , sd TEXT , sc INT , sw INT , DECLARE bdid INT; BEGIN - bdid := tech.uoc_buildable( sn , sd , sc , sw , su , '' , 0 ); + bdid := tech.uoc_buildable( sn , sd , sc , sw , su , '' ); PERFORM buildable_id FROM tech.buildings WHERE buildable_id = bdid; IF FOUND THEN @@ -342,12 +471,11 @@ GRANT EXECUTE ON FUNCTION tech.uoc_ship( TEXT , TEXT , INT , INT , INT , INT , I -- su Upkeep -- sp Power -- sft Orbital flight time --- stdn Tech line name --- stdl Tech level +-- stdn Tech name -- CREATE OR REPLACE FUNCTION tech.uoc_ship( sn TEXT , sd TEXT , sc INT , sw INT , - su INT , sp INT , sft INT , stdn TEXT , stdl INT ) + su INT , sp INT , sft INT , stdn TEXT ) RETURNS VOID STRICT VOLATILE @@ -356,7 +484,7 @@ CREATE OR REPLACE FUNCTION tech.uoc_ship( sn TEXT , sd TEXT , sc INT , sw INT , DECLARE bdid INT; BEGIN - bdid := tech.uoc_buildable( sn , sd , sc , sw , su , stdn , stdl ); + bdid := tech.uoc_buildable( sn , sd , sc , sw , su , stdn ); PERFORM buildable_id FROM tech.buildings WHERE buildable_id = bdid; IF FOUND THEN @@ -374,6 +502,6 @@ BEGIN END; $$ LANGUAGE plpgsql; -GRANT EXECUTE ON FUNCTION tech.uoc_ship( TEXT , TEXT , INT , INT , INT , INT , INT , TEXT , INT ) TO :dbuser; +GRANT EXECUTE ON FUNCTION tech.uoc_ship( TEXT , TEXT , INT , INT , INT , INT , INT , TEXT ) TO :dbuser; diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/040-empire-functions.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/040-empire-functions.sql index 8c18e73..73109da 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/040-empire-functions.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/040-empire-functions.sql @@ -3,7 +3,7 @@ -- -- Empire management functions and views -- --- Copyright(C) 2004-2010, DeepClone Development +-- Copyright(C) 2004-2011, DeepClone Development -- -------------------------------------------------------- @@ -15,7 +15,7 @@ -- pid Planet identifier -- icash Initial cash -- -CREATE OR REPLACE FUNCTION emp.create_empire( nid INT , pid INT , icash REAL ) +CREATE OR REPLACE FUNCTION emp.create_empire( nid INT , pid INT , icash DOUBLE PRECISION ) RETURNS VOID STRICT VOLATILE @@ -81,49 +81,6 @@ $$ LANGUAGE SQL; GRANT EXECUTE ON FUNCTION emp.get_current( INT ) TO :dbuser; - --- --- Implements a technology --- - -CREATE OR REPLACE FUNCTION emp.implement_tech( e_id INT , l_id INT ) - RETURNS VOID - STRICT VOLATILE - SECURITY DEFINER - AS $$ -DECLARE - e_cash REAL; - lev INT; - cost REAL; -BEGIN - SELECT INTO e_cash , lev , cost e.cash , et.level , tl.cost - FROM emp.empires e - INNER JOIN emp.technologies et - ON et.line_id = l_id AND et.empire_id = e.name_id - INNER JOIN tech.levels tl - ON tl.line_id = l_id AND tl.level = et.level - AND tl.points = floor( et.accumulated ) - AND tl.cost <= e.cash - WHERE e.name_id = e_id - FOR UPDATE OF e , et; - - IF NOT FOUND THEN - RETURN; - END IF; - - UPDATE emp.empires - SET cash = e_cash - cost - WHERE name_id = e_id; - UPDATE emp.technologies - SET level = lev + 1 , accumulated = 0 - WHERE empire_id = e_id AND line_id = l_id; -END; -$$ LANGUAGE plpgsql; - -GRANT EXECUTE ON FUNCTION emp.implement_tech( INT , INT ) TO :dbuser; - - - -- -- Add an enemy empire -- @@ -413,7 +370,7 @@ CREATE OR REPLACE FUNCTION emp.get_new_planet( e_id INT , p_name TEXT , OUT err_ DECLARE plid INT; accid INT; - ccash REAL; + ccash DOUBLE PRECISION; f_id BIGINT; fleets BIGINT[]; BEGIN @@ -484,7 +441,7 @@ CREATE VIEW emp.enemies -- CREATE VIEW emp.general_information - AS SELECT e.name_id AS id , en.name AS name , + AS SELECT e.name_id AS id , en.name AS name , av.language , ( CASE WHEN av.status = 'QUITTING' THEN 'q' WHEN av.status = 'VACATION' THEN 'v' @@ -600,50 +557,6 @@ CREATE VIEW emp.overview GRANT SELECT ON emp.overview TO :dbuser; --- --- Empire tech lines --- - -CREATE VIEW emp.tech_lines_view - AS SELECT e.name_id AS empire , tl.name_id AS tech_line , - t1.translated_string AS name , - t2.translated_string AS description - FROM emp.empires e - INNER JOIN emp.technologies et ON et.empire_id = e.name_id - INNER JOIN tech.lines tl ON tl.name_id = et.line_id - INNER JOIN naming.empire_names en ON en.id = e.name_id - INNER JOIN users.credentials c ON c.address_id = en.owner_id - INNER JOIN defs.translations t1 ON t1.string_id = tl.name_id AND t1.lang_id = c.language_id - INNER JOIN defs.translations t2 ON t2.string_id = tl.description_id AND t2.lang_id = c.language_id - ORDER BY t1.translated_string; - -GRANT SELECT ON emp.tech_lines_view TO :dbuser; - - --- --- Empire technologies --- - -CREATE VIEW emp.technologies_view - AS SELECT e.name_id AS empire , tl.name_id AS tech_line , - t1.translated_string AS name , - t2.translated_string AS description , - ( et.level > tlv.level ) AS implemented , - floor( 100 * et.accumulated / tlv.points ) AS progress , - tlv.cost AS cost - FROM emp.empires e - INNER JOIN emp.technologies et ON et.empire_id = e.name_id - INNER JOIN tech.lines tl ON tl.name_id = et.line_id - INNER JOIN tech.levels tlv ON tlv.line_id = tl.name_id AND tlv.level <= et.level - INNER JOIN naming.empire_names en ON en.id = e.name_id - INNER JOIN users.credentials c ON c.address_id = en.owner_id - INNER JOIN defs.translations t1 ON t1.string_id = tlv.name_id AND t1.lang_id = c.language_id - INNER JOIN defs.translations t2 ON t2.string_id = tlv.description_id AND t2.lang_id = c.language_id - ORDER BY tl.name_id , tlv.level; - -GRANT SELECT ON emp.technologies_view TO :dbuser; - - -- -- Enemy lists -- diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/045-research-functions.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/045-research-functions.sql new file mode 100644 index 0000000..4ee2133 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/045-research-functions.sql @@ -0,0 +1,227 @@ +-- LegacyWorlds Beta 6 +-- PostgreSQL database scripts +-- +-- Research mananagement functions and views +-- +-- Copyright(C) 2004-2011, DeepClone Development +-- -------------------------------------------------------- + + + + +-- +-- Implement a technology +-- +-- Parameters: +-- e_id Empire identifier +-- t_name Technology name +-- +-- Returns: +-- 0 on success +-- 1 if the empire does not posses the necessary resources +-- 2 if the technology or empire were not found +-- + +CREATE OR REPLACE FUNCTION emp.implement_tech( e_id INT , t_name TEXT ) + RETURNS INT + STRICT VOLATILE + SECURITY DEFINER + AS $$ +DECLARE + e_cash DOUBLE PRECISION; + t_id INT; + t_cost DOUBLE PRECISION; +BEGIN + SELECT INTO e_cash , t_id , t_cost e.cash , ns.id , td.cost + FROM defs.strings ns + INNER JOIN tech.technologies td + ON td.name_id = ns.id + INNER JOIN emp.researched_technologies rt + ON rt.technology_id = td.name_id + INNER JOIN emp.empires e + ON rt.empire_id = e.name_id + WHERE e.name_id = e_id AND ns.name = t_name + FOR UPDATE OF e , rt; + IF NOT FOUND THEN + RETURN 2; + END IF; + + IF e_cash < t_cost THEN + RETURN 1; + END IF; + + UPDATE emp.empires + SET cash = e_cash - t_cost + WHERE name_id = e_id; + UPDATE emp.researched_technologies + SET implemented = TRUE + WHERE empire_id = e_id AND technology_id = t_id; + + RETURN 0; +END; +$$ LANGUAGE plpgsql; + +GRANT EXECUTE ON FUNCTION emp.implement_tech( INT , TEXT ) TO :dbuser; + + + +-- +-- Prepare for research priorities updates +-- + +CREATE OR REPLACE FUNCTION emp.prepare_research_priorities_update( ) + RETURNS VOID + STRICT VOLATILE + SECURITY DEFINER + AS $$ +BEGIN + CREATE TEMPORARY TABLE research_priorities_updates( + technology TEXT , + priority INT + ); + CREATE INDEX rpu_technology ON research_priorities_updates ( technology ); + IF session_user <> current_user THEN + EXECUTE 'GRANT INSERT ON research_priorities_updates TO ' || session_user; + END IF; +END; +$$ LANGUAGE plpgsql; + +GRANT EXECUTE ON FUNCTION emp.prepare_research_priorities_update( ) TO :dbuser; + + +-- +-- Applies research priorities updates +-- +-- Parameters: +-- e_id identifier of the empire the updates should be applied to +-- +-- Returns: +-- an error code: +-- 0 success +-- 1 list of updates does not match current research topics +-- 2 invalid priorities +-- + +CREATE OR REPLACE FUNCTION emp.apply_research_priorities( IN e_id INT ) + RETURNS INT + STRICT VOLATILE + SECURITY DEFINER + AS $$ +DECLARE + rec RECORD; + t INT; + rval INT; +BEGIN + -- Lock empire and research info + PERFORM er.technology_id + FROM emp.empires e + INNER JOIN emp.research er ON er.empire_id = e.name_id + WHERE e.name_id = e_id + FOR UPDATE OF e , er; + + -- Check values + t := 0; + rval := 0; + FOR rec IN SELECT rpu.priority , r.technology_id FROM research_priorities_updates rpu + LEFT OUTER JOIN emp.research_view r + ON ( r.detailed AND r.technology = rpu.technology ) + OR ( NOT r.detailed AND ( 'unknown-' || ( r.technology_id * e_id )::TEXT ) = rpu.technology ) + WHERE r.empire = e_id OR r.empire IS NULL + UNION SELECT rpu.priority , r.technology_id FROM research_priorities_updates rpu + RIGHT OUTER JOIN emp.research_view r + ON ( r.detailed AND r.technology = rpu.technology ) + OR ( NOT r.detailed AND ( 'unknown-' || ( r.technology_id * e_id )::TEXT ) = rpu.technology ) + WHERE r.empire = e_id + LOOP + IF rec.priority IS NULL OR rec.technology_id IS NULL THEN + rval := 1; + EXIT; + ELSIF rec.priority NOT BETWEEN 0 AND 100 THEN + rval := 2; + EXIT; + END IF; + t := t + rec.priority; + END LOOP; + IF rval = 0 AND t <> 100 THEN + rval := 2; + END IF; + + -- Update research info + IF rval = 0 THEN + UPDATE emp.research er SET priority = rpu.priority + FROM research_priorities_updates rpu , emp.research_view rv + WHERE ( rpu.technology = CASE + WHEN rv.detailed THEN + rv.technology + ELSE + ( 'unknown-' || ( rv.technology_id * e_id )::TEXT ) + END ) + AND rv.empire = e_id + AND er.empire_id = e_id + AND er.technology_id = rv.technology_id; + END IF; + DROP TABLE research_priorities_updates; + RETURN rval; +END; +$$ LANGUAGE plpgsql; + +GRANT EXECUTE ON FUNCTION emp.apply_research_priorities( INT ) TO :dbuser; + + + + +-- +-- Base research view +-- + +CREATE VIEW emp.base_research_view + AS SELECT er.empire_id AS empire , er.technology_id , ns.name AS technology , + td.points AS required , ( CASE + WHEN er.accumulated > td.points THEN + td.points - 1 + ELSE + er.accumulated + END ) AS accumulated , er.priority + FROM emp.research er + INNER JOIN tech.technologies td ON td.name_id = er.technology_id + INNER JOIN defs.strings ns ON ns.id = er.technology_id; + + +-- +-- Research view +-- + +CREATE VIEW emp.research_view + AS SELECT empire , technology , technology_id , + FLOOR( 100 * accumulated / required )::INT AS completion , + ( accumulated >= sys.get_constant( 'game.research.minPoints' ) + OR accumulated / required >= sys.get_constant( 'game.research.minRatio' ) ) AS detailed , + priority + FROM emp.base_research_view; + + +-- +-- Researched and implemented technologies view + +CREATE VIEW emp.known_techs_view + AS SELECT et.empire_id AS empire , et.technology_id , ns.name AS technology , + ( CASE WHEN et.implemented THEN NULL::INT ELSE td.cost END ) AS cost + FROM emp.researched_technologies et + INNER JOIN tech.technologies td ON td.name_id = et.technology_id + INNER JOIN defs.strings ns ON ns.id = et.technology_id; + + +-- +-- Combined research and technologies view +-- + +CREATE VIEW emp.technologies_view + AS SELECT empire , technology_id , technology , + detailed , completion , priority , NULL::INT AS cost + FROM emp.research_view + UNION ALL SELECT empire , technology_id , technology , + TRUE AS detailed , NULL::INT AS completion , NULL::INT AS priority , cost + FROM emp.known_techs_view; + +GRANT SELECT ON emp.technologies_view TO :dbuser; + diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/050-computation-functions.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/050-computation-functions.sql index e5304c2..0f75a48 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/050-computation-functions.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/050-computation-functions.sql @@ -11,14 +11,14 @@ -- sigma( x ) = exp( x ) / ( 1 + exp( x ) ) -- -CREATE OR REPLACE FUNCTION verse.sigma( x REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION verse.sigma( x DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT IMMUTABLE SECURITY INVOKER AS $$ SELECT ( CASE WHEN $1 < -100 THEN 0 WHEN $1 > 100 THEN 1 - ELSE ( exp( $1 ) / ( 1 + exp( $1 ) ) )::REAL + ELSE ( exp( $1 ) / ( 1 + exp( $1 ) ) ) END ); $$ LANGUAGE SQL; @@ -28,8 +28,8 @@ $$ LANGUAGE SQL; -- poly( x , a , b , c ) = ( a * x + b ) * x + c -- -CREATE OR REPLACE FUNCTION verse.poly( x REAL , a REAL , b REAL , c REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION verse.poly( x DOUBLE PRECISION , a DOUBLE PRECISION , b DOUBLE PRECISION , c DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT IMMUTABLE SECURITY INVOKER AS $$ SELECT ( $2 * $1 + $3 ) * $1 + $4; @@ -41,11 +41,11 @@ $$ LANGUAGE SQL; -- Happiness curve, K1 constant -- -CREATE OR REPLACE FUNCTION verse.hcc_const_k1( xmax REAL , ymax REAL , xlimit REAL , ylimit REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION verse.hcc_const_k1( xmax DOUBLE PRECISION , ymax DOUBLE PRECISION , xlimit DOUBLE PRECISION , ylimit DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT IMMUTABLE SECURITY INVOKER AS $$ - SELECT ( ( $4 - $2 ) / ( ( $3 - $1 ) ^ 2 ) )::REAL; + SELECT ( ( $4 - $2 ) / ( ( $3 - $1 ) ^ 2 ) ); $$ LANGUAGE SQL; @@ -54,11 +54,11 @@ $$ LANGUAGE SQL; -- Happiness curve, K2 constant -- -CREATE OR REPLACE FUNCTION verse.hcc_const_k2( ylimit REAL , yasymptote REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION verse.hcc_const_k2( ylimit DOUBLE PRECISION , yasymptote DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT IMMUTABLE SECURITY INVOKER AS $$ - SELECT ( 2 * ( $1 - $2 ) )::REAL; + SELECT ( 2 * ( $1 - $2 ) ); $$ LANGUAGE SQL; @@ -67,11 +67,11 @@ $$ LANGUAGE SQL; -- Happiness curve, K3 constant -- -CREATE OR REPLACE FUNCTION verse.hcc_const_k3( xmax REAL , ymax REAL , xlimit REAL , ylimit REAL , yasymptote REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION verse.hcc_const_k3( xmax DOUBLE PRECISION , ymax DOUBLE PRECISION , xlimit DOUBLE PRECISION , ylimit DOUBLE PRECISION , yasymptote DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT IMMUTABLE SECURITY INVOKER AS $$ - SELECT ( verse.hcc_const_k1( $1 , $2 , $3 , $4 ) * 4 * ( $3 - $1 ) / ( $5 - $4 ) ) ::REAL; + SELECT ( verse.hcc_const_k1( $1 , $2 , $3 , $4 ) * 4 * ( $3 - $1 ) / ( $5 - $4 ) ); $$ LANGUAGE SQL; @@ -80,15 +80,15 @@ $$ LANGUAGE SQL; -- Happiness curve, first part -- -CREATE OR REPLACE FUNCTION verse.hcc_part_1( x REAL , ymin REAL , ymax REAL , xmax REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION verse.hcc_part_1( x DOUBLE PRECISION , ymin DOUBLE PRECISION , ymax DOUBLE PRECISION , xmax DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT IMMUTABLE SECURITY INVOKER AS $$ DECLARE - v REAL; + v DOUBLE PRECISION; BEGIN v := ( ymin - ymax ) / xmax; - RETURN verse.poly( x , ( v / xmax )::REAL , ( -2 * v )::REAL , ymin ); + RETURN verse.poly( x , v / xmax , -2 * v , ymin ); END; $$ LANGUAGE plpgsql; @@ -98,15 +98,15 @@ $$ LANGUAGE plpgsql; -- Happiness curve, second part -- -CREATE OR REPLACE FUNCTION verse.hcc_part_2( x REAL , xmax REAL , ymax REAL , xlimit REAL , ylimit REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION verse.hcc_part_2( x DOUBLE PRECISION , xmax DOUBLE PRECISION , ymax DOUBLE PRECISION , xlimit DOUBLE PRECISION , ylimit DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT IMMUTABLE SECURITY INVOKER AS $$ DECLARE - k1 REAL; + k1 DOUBLE PRECISION; BEGIN k1 := verse.hcc_const_k1( xmax , ymax , xlimit , ylimit ); - RETURN verse.poly( x , k1 , ( -2 * xmax * k1 )::REAL , ( ymax + k1 * xmax * xmax )::REAL ); + RETURN verse.poly( x , k1 , -2 * xmax * k1 , ymax + k1 * xmax * xmax ); END; $$ LANGUAGE plpgsql; @@ -116,17 +116,17 @@ $$ LANGUAGE plpgsql; -- Happiness curve, third part -- -CREATE OR REPLACE FUNCTION verse.hcc_part_3( x REAL , xmax REAL , ymax REAL , xlimit REAL , ylimit REAL , yasymptote REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION verse.hcc_part_3( x DOUBLE PRECISION , xmax DOUBLE PRECISION , ymax DOUBLE PRECISION , xlimit DOUBLE PRECISION , ylimit DOUBLE PRECISION , yasymptote DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT IMMUTABLE SECURITY INVOKER AS $$ DECLARE - k2 REAL; - k3 REAL; + k2 DOUBLE PRECISION; + k3 DOUBLE PRECISION; BEGIN k2 := verse.hcc_const_k2( ylimit , yasymptote ); k3 := verse.hcc_const_k3( xmax , ymax , xlimit , ylimit , yasymptote ); - RETURN yasymptote + k2 * ( 1 - verse.sigma( ( k3 * ( x - xlimit ) ) )::REAL ); + RETURN yasymptote + k2 * ( 1 - verse.sigma( ( k3 * ( x - xlimit ) ) ) ); END; $$ LANGUAGE plpgsql; @@ -136,8 +136,8 @@ $$ LANGUAGE plpgsql; -- Happiness curve -- -CREATE OR REPLACE FUNCTION verse.happiness_curve( x REAL , ymin REAL , xmax REAL , ymax REAL , xlimit REAL , ylimit REAL , yasymptote REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION verse.happiness_curve( x DOUBLE PRECISION , ymin DOUBLE PRECISION , xmax DOUBLE PRECISION , ymax DOUBLE PRECISION , xlimit DOUBLE PRECISION , ylimit DOUBLE PRECISION , yasymptote DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT IMMUTABLE SECURITY INVOKER AS $$ SELECT (CASE @@ -156,37 +156,37 @@ $$ LANGUAGE SQL; -- Happiness computation -- -CREATE OR REPLACE FUNCTION verse.compute_happiness( population REAL , workers REAL , defence REAL , empsize INT ) - RETURNS REAL +CREATE OR REPLACE FUNCTION verse.compute_happiness( population DOUBLE PRECISION , workers DOUBLE PRECISION , defence DOUBLE PRECISION , empsize INT ) + RETURNS DOUBLE PRECISION STRICT STABLE SECURITY INVOKER AS $$ DECLARE - whappiness REAL; - dhappiness REAL; - shappiness REAL; + whappiness DOUBLE PRECISION; + dhappiness DOUBLE PRECISION; + shappiness DOUBLE PRECISION; BEGIN -- Work-related happiness whappiness := verse.happiness_curve( - ( workers / population )::REAL , + workers / population , sys.get_constant( 'game.happiness.noEmployment' ) , 1.0 , 1.0 , sys.get_constant( 'game.happiness.employmentLimit' ) , 0.5 , 0 ); -- Defence-related happiness dhappiness := verse.happiness_curve( - ( sys.get_constant( 'game.happiness.popPerDefencePoint' ) * defence / population )::REAL , + sys.get_constant( 'game.happiness.popPerDefencePoint' ) * defence / population , sys.get_constant( 'game.happiness.noDefence' ) , 1.0 , 1.0 , sys.get_constant( 'game.happiness.defenceLimit' ) , 0.5 , 0 ); -- Influence of empire size shappiness := verse.happiness_curve( - ( empsize::REAL / sys.get_constant( 'game.happiness.idealEmpireSize' ) )::REAL , + empsize / sys.get_constant( 'game.happiness.idealEmpireSize' ) , sys.get_constant( 'game.happiness.smallEmpire' ) , 1.0 , 1.0 , sys.get_constant( 'game.happiness.eSizeLimit' ) , 0.5 , 0 ); - RETURN ( shappiness * ( whappiness + dhappiness ) / 2.0 )::REAL; + RETURN shappiness * ( whappiness + dhappiness ) / 2.0; END; $$ LANGUAGE plpgsql; @@ -195,14 +195,14 @@ $$ LANGUAGE plpgsql; -- -- Production adjustment -- -CREATE OR REPLACE FUNCTION verse.adjust_production( prod REAL , happiness REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION verse.adjust_production( prod DOUBLE PRECISION , happiness DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT IMMUTABLE SECURITY INVOKER AS $$ SELECT ( CASE WHEN $2 < sys.get_constant( 'game.happiness.strike' ) THEN - ( $1 * ( 1 - ( $2 / sys.get_constant( 'game.happiness.strike' ) ) ) )::REAL + $1 * ( 1 - ( $2 / sys.get_constant( 'game.happiness.strike' ) ) ) ELSE $1 END ); @@ -213,15 +213,15 @@ $$ LANGUAGE SQL; -- Income computation -- -CREATE OR REPLACE FUNCTION verse.compute_income( population REAL , happiness REAL , cashprod REAL ) - RETURNS REAL +CREATE OR REPLACE FUNCTION verse.compute_income( population DOUBLE PRECISION , happiness DOUBLE PRECISION , cashprod DOUBLE PRECISION ) + RETURNS DOUBLE PRECISION STRICT STABLE SECURITY INVOKER AS $$ DECLARE - base REAL; - badj REAL; - cprod REAL; + base DOUBLE PRECISION; + badj DOUBLE PRECISION; + cprod DOUBLE PRECISION; BEGIN badj := ( 1 - verse.adjust_production( 1.0 , happiness ) ) * sys.get_constant( 'game.work.strikeEffect' ); base := floor( population ) * sys.get_constant( 'game.work.population' ) * ( 1 - badj ); diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/060-universe-functions.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/060-universe-functions.sql index 780986a..bfccac6 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/060-universe-functions.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/060-universe-functions.sql @@ -19,14 +19,14 @@ -- CREATE OR REPLACE FUNCTION verse.get_raw_production( pid INT , pt building_output_type ) - RETURNS REAL + RETURNS DOUBLE PRECISION STRICT STABLE SECURITY DEFINER AS $$ DECLARE - rv REAL; + rv DOUBLE PRECISION; BEGIN - SELECT INTO rv SUM( b.amount * d.output )::REAL + SELECT INTO rv SUM( b.amount * d.output ) FROM verse.planet_buildings b INNER JOIN tech.buildings d ON d.buildable_id = b.building_id AND d.output_type = pt @@ -114,14 +114,14 @@ $$ LANGUAGE SQL; -- CREATE OR REPLACE FUNCTION verse.get_planet_upkeep( pid INT ) - RETURNS REAL + RETURNS DOUBLE PRECISION STRICT STABLE SECURITY INVOKER AS $$ DECLARE - rv REAL; + rv DOUBLE PRECISION; BEGIN - SELECT INTO rv SUM( b.amount * d.upkeep )::REAL + SELECT INTO rv SUM( b.amount * d.upkeep ) FROM verse.planet_buildings b INNER JOIN tech.buildables d ON d.name_id = b.building_id @@ -145,7 +145,7 @@ $$ LANGUAGE plpgsql; -- npics Amount of planet pictures -- -CREATE OR REPLACE FUNCTION verse.create_planet( sid INT , o INT , ipop REAL , npics INT ) +CREATE OR REPLACE FUNCTION verse.create_planet( sid INT , o INT , ipop DOUBLE PRECISION , npics INT ) RETURNS VOID STRICT VOLATILE SECURITY INVOKER @@ -156,7 +156,7 @@ DECLARE bpp INT; uid BIGINT; utp update_type; - happiness REAL; + happiness DOUBLE PRECISION; BEGIN -- Planet name and planet pnid := naming.create_map_name( 'P' ); @@ -217,7 +217,7 @@ $$ LANGUAGE plpgsql; -- npics Amount of planet pictures -- -CREATE OR REPLACE FUNCTION verse.create_system( sx INT , sy INT , ipop REAL , npics INT ) +CREATE OR REPLACE FUNCTION verse.create_system( sx INT , sy INT , ipop DOUBLE PRECISION , npics INT ) RETURNS VOID STRICT VOLATILE SECURITY INVOKER @@ -249,7 +249,7 @@ $$ LANGUAGE plpgsql; -- ipop Initial population -- -CREATE OR REPLACE FUNCTION verse.create_systems( x0 INT , y0 INT , x1 INT , y1 INT , ipop REAL ) +CREATE OR REPLACE FUNCTION verse.create_systems( x0 INT , y0 INT , x1 INT , y1 INT , ipop DOUBLE PRECISION ) RETURNS VOID STRICT VOLATILE SECURITY INVOKER @@ -283,7 +283,7 @@ CREATE OR REPLACE FUNCTION verse.generate_initial_universe( ) AS $$ DECLARE sz INT; - pop REAL; + pop DOUBLE PRECISION; npics INT; BEGIN sz := floor( sys.get_constant( 'game.universe.initialSize' ) ); @@ -316,7 +316,7 @@ DECLARE y0 INT; x1 INT; y1 INT; - pop REAL; + pop DOUBLE PRECISION; BEGIN -- Get current bounds SELECT INTO min_x , max_x , min_y , max_y @@ -368,7 +368,7 @@ CREATE OR REPLACE FUNCTION verse.generate( ) AS $$ DECLARE p_count INT; - f_ratio REAL; + f_ratio DOUBLE PRECISION; BEGIN -- Get total planet count SELECT INTO p_count 5 * count(*) @@ -381,7 +381,7 @@ BEGIN END IF; -- Get available planets ratio - SELECT INTO f_ratio count(*)::REAL / p_count::REAL + SELECT INTO f_ratio count(*)::DOUBLE PRECISION / p_count::DOUBLE PRECISION FROM verse.available_planets; -- Expand universe if required diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/140-planets-functions.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/140-planets-functions.sql index 06247c1..582e52a 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/140-planets-functions.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/140-planets-functions.sql @@ -175,17 +175,17 @@ CREATE OR REPLACE FUNCTION verse.get_orbital_view( e_id INT , p_id INT ) AS $$ DECLARE rv planet_orbital_data; - happ REAL; + happ DOUBLE PRECISION; e_att BOOLEAN; rec RECORD; BEGIN -- Get the planet's population and defence SELECT INTO rv.population , happ - floor( p.population )::BIGINT , ( ph.current / p.population )::REAL + floor( p.population )::BIGINT , ( ph.current / p.population )::DOUBLE PRECISION FROM verse.planets p INNER JOIN verse.planet_happiness ph ON ph.planet_id = p.name_id WHERE p.name_id = p_id; - rv.defence := round( verse.adjust_production( verse.get_raw_production( p_id , 'DEF' ) , happ ) ); + rv.defence := verse.adjust_production( verse.get_raw_production( p_id , 'DEF' ) , happ ); -- Get the empire's fleet mode SELECT INTO e_att f.attacking @@ -332,8 +332,7 @@ AS $$ ( bd.workers * b.amount )::INT AS jobs , ( bd.upkeep * b.amount )::BIGINT AS upkeep , bd.output_type AS p_type , - floor( verse.adjust_production( ( bd.output * b.amount )::REAL , - ( ph.current / p.population )::REAL ) + floor( verse.adjust_production( bd.output * b.amount , ph.current / p.population ) )::BIGINT AS p_value FROM verse.planet_buildings b INNER JOIN verse.planets p ON p.name_id = b.planet_id @@ -373,9 +372,9 @@ AS $$ ELSE floor( qi.amount * bd.cost - ( CASE WHEN qi.queue_order = 0 THEN q.money ELSE 0 END ) ) END )::BIGINT AS investment , ( CASE - WHEN ceil( verse.adjust_production( ( p.population * sys.get_constant( 'game.work.wuPerPopUnit' ) )::REAL , ( ph.current / p.population )::REAL ) ) = 0 THEN NULL + WHEN ceil( verse.adjust_production( p.population * sys.get_constant( 'game.work.wuPerPopUnit' ) , ph.current / p.population ) ) = 0 THEN NULL ELSE ceil( ( qi.amount * bd.work * ( CASE WHEN qi.destroy THEN sys.get_constant( 'game.work.destructionWork' ) ELSE 1 END ) - ( CASE WHEN qi.queue_order = 0 THEN q.work ELSE 0 END ) ) - / verse.adjust_production( ( p.population * sys.get_constant( 'game.work.wuPerPopUnit' ) )::REAL , ( ph.current / p.population )::REAL ) ) + / verse.adjust_production( p.population * sys.get_constant( 'game.work.wuPerPopUnit' ) , ph.current / p.population ) ) END )::BIGINT AS time_left FROM verse.planets p INNER JOIN verse.planet_happiness ph ON ph.planet_id = p.name_id @@ -414,9 +413,9 @@ AS $$ qi.amount AS amount , FALSE AS destroy , floor( qi.amount * bd.cost - ( CASE WHEN qi.queue_order = 0 THEN q.money ELSE 0 END ) )::BIGINT AS investment , ( CASE - WHEN ceil( verse.adjust_production( verse.get_raw_production( $1 , 'WORK' ) , ( ph.current / p.population )::REAL ) ) = 0 THEN NULL + WHEN ceil( verse.adjust_production( verse.get_raw_production( $1 , 'WORK' ) , ph.current / p.population ) ) = 0 THEN NULL ELSE ceil( ( qi.amount * bd.work - ( CASE WHEN qi.queue_order = 0 THEN q.work ELSE 0 END ) ) - / verse.adjust_production( verse.get_raw_production( $1 , 'WORK' ) , ( ph.current / p.population )::REAL ) ) + / verse.adjust_production( verse.get_raw_production( $1 , 'WORK' ) , ph.current / p.population ) ) END )::BIGINT AS time_left FROM verse.planets p INNER JOIN verse.planet_happiness ph ON ph.planet_id = p.name_id @@ -465,12 +464,12 @@ AS $$ UNION SELECT bv.* FROM tech.buildings_view bv INNER JOIN tech.buildable_requirements r ON r.buildable_id = bv.name_id - INNER JOIN tech.levels l ON l.id = r.level_id + INNER JOIN tech.technologies l ON l.name_id = r.technology_id INNER JOIN emp.planets ep ON ep.planet_id = $1 - INNER JOIN emp.technologies t - ON t.empire_id = ep.empire_id AND t.line_id = l.line_id AND t.level > l.level + INNER JOIN emp.researched_technologies t + ON t.empire_id = ep.empire_id AND t.technology_id = l.name_id ) AS bv , ( - SELECT verse.adjust_production( ( p.population * sys.get_constant( 'game.work.wuPerPopUnit' ) )::REAL , ( ph.current / p.population )::REAL ) AS p_work , + SELECT verse.adjust_production( p.population * sys.get_constant( 'game.work.wuPerPopUnit' ) , ph.current / p.population ) AS p_work , c.language_id AS language FROM verse.planets p INNER JOIN verse.planet_happiness ph ON ph.planet_id = p.name_id @@ -517,12 +516,12 @@ AS $$ UNION SELECT bv.* FROM tech.ships_view bv INNER JOIN tech.buildable_requirements r ON r.buildable_id = bv.name_id - INNER JOIN tech.levels l ON l.id = r.level_id + INNER JOIN tech.technologies l ON l.name_id = r.technology_id INNER JOIN emp.planets ep ON ep.planet_id = $1 - INNER JOIN emp.technologies t - ON t.empire_id = ep.empire_id AND t.line_id = l.line_id AND t.level > l.level + INNER JOIN emp.researched_technologies t + ON t.empire_id = ep.empire_id AND t.technology_id = l.name_id ) AS bv , ( - SELECT verse.adjust_production( verse.get_raw_production( $1 , 'WORK' ) , ( ph.current / p.population )::REAL ) AS p_work , + SELECT verse.adjust_production( verse.get_raw_production( $1 , 'WORK' ) , ph.current / p.population ) AS p_work , c.language_id AS language FROM verse.planets p INNER JOIN verse.planet_happiness ph ON ph.planet_id = p.name_id @@ -594,7 +593,7 @@ CREATE OR REPLACE FUNCTION verse.flush_build_queue( p_id INT ) AS $$ DECLARE e_id INT; - q_cash REAL; + q_cash DOUBLE PRECISION; BEGIN SELECT INTO e_id , q_cash e.name_id , q.money FROM verse.planets p @@ -633,7 +632,7 @@ CREATE OR REPLACE FUNCTION verse.flush_military_queue( p_id INT ) AS $$ DECLARE e_id INT; - q_cash REAL; + q_cash DOUBLE PRECISION; BEGIN SELECT INTO e_id , q_cash e.name_id , q.money FROM verse.planets p @@ -699,10 +698,10 @@ BEGIN FROM tech.ships s LEFT OUTER JOIN tech.buildable_requirements r ON r.buildable_id = s.buildable_id - LEFT OUTER JOIN tech.levels l - ON l.id = r.level_id - LEFT OUTER JOIN emp.technologies t - ON t.empire_id = e_id AND t.line_id = l.line_id AND t.level > l.level + LEFT OUTER JOIN tech.technologies l + ON l.name_id = r.technology_id + LEFT OUTER JOIN emp.researched_technologies t + ON t.empire_id = e_id AND t.technology_id = l.name_id WHERE s.buildable_id = s_id; IF NOT FOUND OR ( has_level IS NULL AND dep_level IS NOT NULL ) THEN RETURN; @@ -765,10 +764,10 @@ BEGIN FROM tech.buildings b LEFT OUTER JOIN tech.buildable_requirements r ON r.buildable_id = b.buildable_id - LEFT OUTER JOIN tech.levels l - ON l.id = r.level_id - LEFT OUTER JOIN emp.technologies t - ON t.empire_id = e_id AND t.line_id = l.line_id AND t.level > l.level + LEFT OUTER JOIN tech.technologies l + ON l.name_id = r.technology_id + LEFT OUTER JOIN emp.researched_technologies t + ON t.empire_id = e_id AND t.technology_id = l.name_id WHERE b.buildable_id = b_id; IF NOT FOUND OR ( has_level IS NULL AND dep_level IS NOT NULL ) THEN RETURN; @@ -979,7 +978,7 @@ $$ LANGUAGE plpgsql; -- tick Current tick -- -CREATE OR REPLACE FUNCTION verse.inflict_battle_damage( p_id INT , t_power BIGINT , dmg REAL , b_id BIGINT , tick BIGINT ) +CREATE OR REPLACE FUNCTION verse.inflict_battle_damage( p_id INT , t_power BIGINT , dmg DOUBLE PRECISION , b_id BIGINT , tick BIGINT ) RETURNS VOID STRICT VOLATILE SECURITY INVOKER @@ -987,7 +986,7 @@ CREATE OR REPLACE FUNCTION verse.inflict_battle_damage( p_id INT , t_power BIGIN DECLARE rec RECORD; bp_id BIGINT; - st_dmg REAL; + st_dmg DOUBLE PRECISION; n_dest INT; BEGIN PERFORM sys.write_log( 'BattleUpdate' , 'TRACE'::log_level , 'Inflicting ' || dmg @@ -1038,18 +1037,18 @@ $$ LANGUAGE plpgsql; -- d_ratio Debt damage ratio -- -CREATE OR REPLACE FUNCTION verse.handle_debt( e_id INT , t_upkeep REAL , debt REAL , d_ratio REAL ) +CREATE OR REPLACE FUNCTION verse.handle_debt( e_id INT , t_upkeep DOUBLE PRECISION , debt DOUBLE PRECISION , d_ratio DOUBLE PRECISION ) RETURNS VOID STRICT VOLATILE SECURITY INVOKER AS $$ DECLARE tick BIGINT; - tot_damage REAL; + tot_damage DOUBLE PRECISION; p_rec RECORD; b_rec RECORD; bp_id BIGINT; - b_damage REAL; + b_damage DOUBLE PRECISION; n_destroy INT; BEGIN tick := sys.get_tick( ) - 1; @@ -1066,7 +1065,7 @@ BEGIN bp_id := NULL; FOR b_rec IN SELECT b.building_id AS building , b.amount AS amount , - ( b.amount * bb.upkeep )::REAL AS upkeep , + b.amount * bb.upkeep AS upkeep , b.damage AS damage , ( bd.output_type = 'DEF' ) AS is_def FROM verse.planet_buildings b INNER JOIN tech.buildables bb ON bb.name_id = b.building_id @@ -1099,4 +1098,4 @@ BEGIN END LOOP; END LOOP; END; -$$ LANGUAGE plpgsql; +$$ LANGUAGE plpgsql; \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/150-battle-functions.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/150-battle-functions.sql index ef34b5e..94827f0 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/150-battle-functions.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/150-battle-functions.sql @@ -626,7 +626,7 @@ $$ LANGUAGE plpgsql; -- tick Current tick identifier -- -CREATE OR REPLACE FUNCTION battles.inflict_damage( b_id BIGINT , dmg REAL , att BOOLEAN , tick BIGINT ) +CREATE OR REPLACE FUNCTION battles.inflict_damage( b_id BIGINT , dmg DOUBLE PRECISION , att BOOLEAN , tick BIGINT ) RETURNS VOID STRICT VOLATILE SECURITY INVOKER @@ -654,9 +654,9 @@ BEGIN st_power := battles.get_defence_power( b_id , tick ); tot_power := tot_power + st_power; PERFORM sys.write_log( 'BattleUpdate' , 'TRACE'::log_level , 'About to inflict planet damage; total power: ' || tot_power - || '; planet power: ' || st_power || '; computed damage: ' || ( dmg * st_power / tot_power )::REAL ); + || '; planet power: ' || st_power || '; computed damage: ' || ( dmg * st_power / tot_power ) ); IF st_power <> 0 THEN - PERFORM verse.inflict_battle_damage( planet , st_power , ( dmg * st_power / tot_power )::REAL , b_id , tick ); + PERFORM verse.inflict_battle_damage( planet , st_power , dmg * st_power / tot_power , b_id , tick ); END IF; END IF; @@ -668,7 +668,7 @@ BEGIN LEFT OUTER JOIN fleets.movements m ON m.fleet_id = f.id WHERE b.id = b_id AND m.fleet_id IS NULL AND f.attacking = att LOOP - PERFORM fleets.inflict_battle_damage( rec.id , ( dmg * rec.power / tot_power )::REAL , b_id , tick ); + PERFORM fleets.inflict_battle_damage( rec.id , dmg * rec.power / tot_power , b_id , tick ); END LOOP; END; $$ LANGUAGE plpgsql; diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/160-battle-views.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/160-battle-views.sql index c649e10..4309c03 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/160-battle-views.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/160-battle-views.sql @@ -256,8 +256,8 @@ CREATE VIEW battles.buildings_history WHEN rbp.raw_power = 0 THEN rbh.raw_power ELSE - rbh.raw_power::REAL * rbp.actual_power::REAL / rbp.raw_power::REAL - END )::REAL AS power + rbh.raw_power * rbp.actual_power / rbp.raw_power + END ) AS power FROM battles.empire_list_view elv INNER JOIN battles.raw_buildings_history rbh USING (battle) INNER JOIN battles.raw_buildings_power rbp USING (battle,tick) diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/165-fleets-functions.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/165-fleets-functions.sql index f7d802c..4d2e02b 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/165-fleets-functions.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/165-fleets-functions.sql @@ -55,7 +55,7 @@ $$ LANGUAGE plpgsql; -- the in-system movement's duration -- -CREATE OR REPLACE FUNCTION fleets.compute_insystem_duration( f_time INT , s_orbit REAL , d_orbit REAL ) +CREATE OR REPLACE FUNCTION fleets.compute_insystem_duration( f_time INT , s_orbit DOUBLE PRECISION , d_orbit DOUBLE PRECISION ) RETURNS INT STRICT IMMUTABLE SECURITY INVOKER @@ -84,7 +84,7 @@ $$ LANGUAGE plpgsql; -- the outer space movement's duration -- -CREATE OR REPLACE FUNCTION fleets.compute_outerspace_duration( f_time INT , s_x REAL , s_y REAL , d_x REAL , d_y REAL ) +CREATE OR REPLACE FUNCTION fleets.compute_outerspace_duration( f_time INT , s_x DOUBLE PRECISION , s_y DOUBLE PRECISION , d_x DOUBLE PRECISION , d_y DOUBLE PRECISION ) RETURNS INT STRICT IMMUTABLE SECURITY INVOKER @@ -115,16 +115,16 @@ $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION fleets.compute_current_orbit( f_time INT , rp_orbit INT , outwards BOOLEAN , past_rp BOOLEAN , ft_left INT ) - RETURNS REAL + RETURNS DOUBLE PRECISION STRICT IMMUTABLE SECURITY INVOKER AS $$ DECLARE - dist REAL; - dir REAL; - rloc REAL; + dist DOUBLE PRECISION; + dir DOUBLE PRECISION; + rloc DOUBLE PRECISION; BEGIN - dist := 1.0 - ft_left::REAL / f_time::REAL; + dist := 1.0 - ft_left::DOUBLE PRECISION / f_time::DOUBLE PRECISION; dir := ( CASE WHEN outwards THEN 0.5 ELSE -0.5 END ); IF past_rp THEN rloc := rp_orbit; @@ -157,13 +157,14 @@ $$ LANGUAGE plpgsql; -- CREATE OR REPLACE FUNCTION fleets.compute_current_location( - f_time INT , s_x REAL , s_y REAL , d_x REAL , d_y REAL , r_time INT , - OUT c_x REAL , OUT c_y REAL ) + f_time INT , s_x DOUBLE PRECISION , s_y DOUBLE PRECISION , + d_x DOUBLE PRECISION , d_y DOUBLE PRECISION , r_time INT , + OUT c_x DOUBLE PRECISION , OUT c_y DOUBLE PRECISION ) STRICT IMMUTABLE SECURITY INVOKER AS $$ DECLARE - tot_time REAL; + tot_time DOUBLE PRECISION; BEGIN tot_time := fleets.compute_outerspace_duration( f_time , s_x , s_y , d_x , d_y ); c_x := s_x + ( d_x - s_x ) * ( 1 - r_time / tot_time ); @@ -251,7 +252,7 @@ $$ LANGUAGE plpgsql; -- CREATE OR REPLACE FUNCTION fleets.compute_insystem_redirect( - f_time INT , s_sys INT , s_orbit REAL , d_id INT , + f_time INT , s_sys INT , s_orbit DOUBLE PRECISION , d_id INT , OUT duration INT , OUT direction BOOLEAN , OUT s_duration INT , OUT ref_point INT , OUT past_rp BOOLEAN ) STRICT IMMUTABLE @@ -260,7 +261,7 @@ CREATE OR REPLACE FUNCTION fleets.compute_insystem_redirect( DECLARE s_rec RECORD; d_rec RECORD; - torb REAL; + torb DOUBLE PRECISION; rporb INT; BEGIN -- Get destination planet coordinates, orbit and system ID @@ -294,9 +295,9 @@ BEGIN ELSE torb := floor( torb ); END IF; - s_duration := fleets.compute_insystem_duration( f_time , s_orbit , ( torb / 2 )::REAL ); + s_duration := fleets.compute_insystem_duration( f_time , s_orbit , torb / 2 ); rporb := round( s_orbit ); - past_rp := ( CASE WHEN direction THEN ( rporb::REAL <= s_orbit ) ELSE ( rporb::REAL >= s_orbit ) END ); + past_rp := ( CASE WHEN direction THEN ( rporb <= s_orbit ) ELSE ( rporb >= s_orbit ) END ); END IF; SELECT INTO ref_point name_id FROM verse.planets p WHERE p.system_id = s_sys AND orbit = rporb; @@ -322,7 +323,7 @@ $$ LANGUAGE plpgsql; -- CREATE OR REPLACE FUNCTION fleets.compute_outerspace_redirect( - f_time INT , s_x REAL , s_y REAL , d_id INT , + f_time INT , s_x DOUBLE PRECISION , s_y DOUBLE PRECISION , d_id INT , OUT duration INT , OUT s_duration INT ) STRICT IMMUTABLE SECURITY INVOKER @@ -365,8 +366,8 @@ DECLARE dir BOOLEAN; rpid INT; prp BOOLEAN; - cx REAL; - cy REAL; + cx DOUBLE PRECISION; + cy DOUBLE PRECISION; BEGIN -- Lock fleets and planets PERFORM * FROM fleets.fleets f @@ -676,10 +677,10 @@ DECLARE old_ft INT; new_ft INT; sp_ft INT; - x REAL; - y REAL; - cx REAL; - cy REAL; + x DOUBLE PRECISION; + y DOUBLE PRECISION; + cx DOUBLE PRECISION; + cy DOUBLE PRECISION; sid INT; BEGIN SELECT INTO main * FROM fleet_split_main; @@ -705,7 +706,7 @@ BEGIN IF new_ft <> old_ft THEN IF ism_rec IS NULL THEN -- Outer space movement - SELECT INTO x , y s.x::REAL , s.y::REAL + SELECT INTO x , y s.x , s.y FROM verse.planets p INNER JOIN verse.systems s ON s.id = p.system_id WHERE p.name_id = main.location; @@ -754,7 +755,7 @@ BEGIN IF sp_ft <> old_ft THEN IF ism_rec IS NULL THEN -- Outer space movement - SELECT INTO x , y s.x::REAL , s.y::REAL + SELECT INTO x , y s.x , s.y FROM verse.planets p INNER JOIN verse.systems s ON s.id = p.system_id WHERE p.name_id = main.location; @@ -983,7 +984,7 @@ GRANT EXECUTE ON FUNCTION fleets.disband( INT , BIGINT[] ) TO :dbuser; -- tick Current tick -- -CREATE OR REPLACE FUNCTION fleets.inflict_battle_damage( f_id BIGINT , dmg REAL , b_id BIGINT , tick BIGINT ) +CREATE OR REPLACE FUNCTION fleets.inflict_battle_damage( f_id BIGINT , dmg DOUBLE PRECISION , b_id BIGINT , tick BIGINT ) RETURNS VOID STRICT VOLATILE SECURITY INVOKER @@ -995,7 +996,7 @@ DECLARE bp_id BIGINT; bf_id BIGINT; rec RECORD; - st_dmg REAL; + st_dmg DOUBLE PRECISION; n_dest INT; found INT; deleted INT; @@ -1066,19 +1067,19 @@ $$ LANGUAGE plpgsql; -- d_ratio Debt damage ratio -- -CREATE OR REPLACE FUNCTION fleets.handle_debt( e_id INT , t_upkeep REAL , debt REAL , d_ratio REAL ) +CREATE OR REPLACE FUNCTION fleets.handle_debt( e_id INT , t_upkeep DOUBLE PRECISION , debt DOUBLE PRECISION , d_ratio DOUBLE PRECISION ) RETURNS VOID STRICT VOLATILE SECURITY INVOKER AS $$ DECLARE - tot_damage REAL; + tot_damage DOUBLE PRECISION; f_rec RECORD; s_rec RECORD; n_found INT; n_killed INT; s_killed INT; - s_damage REAL; + s_damage DOUBLE PRECISION; n_ships INT; tick BIGINT; bp_id BIGINT; @@ -1086,10 +1087,10 @@ DECLARE mv_rec fleets.movements%ROWTYPE; ism_rec fleets.ms_system%ROWTYPE; osm_rec fleets.ms_space%ROWTYPE; - x REAL; - y REAL; - cx REAL; - cy REAL; + x DOUBLE PRECISION; + y DOUBLE PRECISION; + cx DOUBLE PRECISION; + cy DOUBLE PRECISION; sid INT; BEGIN tick := sys.get_tick( ) - 1; @@ -1120,7 +1121,7 @@ BEGIN n_killed := 0; s_killed := 0; FOR s_rec IN SELECT s.ship_id AS ship , s.amount AS amount , s.damage AS damage , - ( d.upkeep * s.amount )::REAL AS upkeep + d.upkeep * s.amount AS upkeep FROM fleets.ships s INNER JOIN tech.buildables d ON d.name_id = s.ship_id WHERE s.fleet_id = f_rec.fleet @@ -1174,7 +1175,7 @@ BEGIN IF ism_rec IS NULL THEN -- Outer space movement - SELECT INTO x , y s.x::REAL , s.y::REAL + SELECT INTO x , y s.x , s.y FROM verse.planets p INNER JOIN verse.systems s ON s.id = p.system_id WHERE p.name_id = f_rec.location; @@ -1386,7 +1387,7 @@ GRANT SELECT ON fleets.static_fleets TO :dbuser; CREATE VIEW fleets.outer_space_fleets AS SELECT s.movement_id AS id , m.state_time_left AS time_left , s.start_x AS x0 , s.start_y AS y0 , - ts.x::REAL AS x1 , ts.y::REAL AS y1 + ts.x::DOUBLE PRECISION AS x1 , ts.y::DOUBLE PRECISION AS y1 FROM fleets.ms_space s INNER JOIN fleets.movements m ON m.fleet_id = s.movement_id INNER JOIN fleets.fleets f ON m.fleet_id = f.id @@ -1422,14 +1423,14 @@ CREATE VIEW fleets.moving_fleets f.location_id AS to_id , dn.name AS to_name , ( CASE WHEN osf.id IS NULL THEN isf.x - ELSE ( osf.x1 - osf.time_left::REAL * ( osf.x1 - osf.x0 ) + ELSE ( osf.x1 - osf.time_left * ( osf.x1 - osf.x0 ) / fleets.compute_outerspace_duration( fs.flight_time , osf.x0 , osf.y0 , osf.x1 , osf.y1 ) ) - END )::REAL AS cx , + END )::DOUBLE PRECISION AS cx , ( CASE WHEN osf.id IS NULL THEN isf.y - ELSE ( osf.y1 - osf.time_left::REAL * ( osf.y1 - osf.y0 ) + ELSE ( osf.y1 - osf.time_left * ( osf.y1 - osf.y0 ) / fleets.compute_outerspace_duration( fs.flight_time , osf.x0 , osf.y0 , osf.x1 , osf.y1 ) ) - END )::REAL AS cy , + END )::DOUBLE PRECISION AS cy , ( CASE WHEN osf.id IS NULL THEN isf.planet ELSE NULL @@ -1487,7 +1488,7 @@ GRANT SELECT ON fleets.ships_view TO :dbuser; CREATE VIEW fleets.short_static_fleets AS SELECT sf.empire , sf.location AS location_id , fl.name AS location_name , - fl.x::REAL AS x , fl.y::REAL AS y , + fl.x::DOUBLE PRECISION AS x , fl.y::DOUBLE PRECISION AS y , sf.id , sf.name , sf.status , sf.penalty , fl.attacking , sf.power , sf.flight_time FROM fleets.static_fleets sf diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/167-planet-list.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/167-planet-list.sql index ca6ed36..0219833 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/167-planet-list.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/167-planet-list.sql @@ -15,7 +15,7 @@ CREATE VIEW emp.planets_list_basic AS SELECT e.name_id AS empire , p.name_id AS id , n.name , s.x , s.y , p.orbit , - p.population , ph.current / p.population::REAL AS happiness , + p.population , ph.current / p.population AS happiness , floor( pm.income )::BIGINT AS income , floor( pm.upkeep )::BIGINT AS upkeep FROM emp.empires e diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/170-event-functions.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/170-event-functions.sql index 24f5e41..57c4d81 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/170-event-functions.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/170-event-functions.sql @@ -860,7 +860,7 @@ CREATE VIEW events.empire_events_view AS SELECT e.event_id AS id , e.evt_type , e.evt_subtype , e.tick , e.real_time , s.name AS technology FROM events.events e LEFT OUTER JOIN events.empire_events ed USING (event_id) - LEFT OUTER JOIN tech.levels tl ON tl.id = ed.technology_id + LEFT OUTER JOIN tech.technologies tl ON tl.name_id = ed.technology_id LEFT OUTER JOIN defs.strings s ON s.id = tl.name_id WHERE e.evt_type = 'EMPIRE'; diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/200-bugs-functions.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/200-bugs-functions.sql index f8d7282..184f20b 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/200-bugs-functions.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/functions/200-bugs-functions.sql @@ -1196,18 +1196,24 @@ GRANT SELECT ON bugs.dump_main_view TO :dbuser; CREATE VIEW bugs.dump_research_view - AS SELECT et.empire_id , et.line_id AS line_id , et.level AS level , - tst.name AS name , et.accumulated AS accumulated - FROM emp.technologies et - LEFT OUTER JOIN tech.levels tlv ON tlv.line_id = et.line_id AND tlv.level = et.level - LEFT OUTER JOIN defs.strings tst ON tst.id = tlv.name_id; + AS SELECT r.empire_id , ns.name , r.accumulated , r.priority + FROM emp.research r + INNER JOIN defs.strings ns ON ns.id = r.technology_id; GRANT SELECT ON bugs.dump_research_view TO :dbuser; +CREATE VIEW bugs.dump_technologies_view + AS SELECT et.empire_id , ns.name , et.implemented + FROM emp.researched_technologies et + INNER JOIN defs.strings ns ON ns.id = et.technology_id; + +GRANT SELECT ON bugs.dump_technologies_view TO :dbuser; + + CREATE VIEW bugs.dump_planets_view AS SELECT ep.empire_id , ep.planet_id , p.population , - ( ph.current / p.population )::REAL AS current_happiness , ph.target AS target_happiness , + ph.current / p.population AS current_happiness , ph.target AS target_happiness , cq.money AS civ_money , cq.work AS civ_work , mq.money AS mil_money , mq.work AS mil_work FROM emp.planets ep diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/000-updates-ctrl.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/000-updates-ctrl.sql index 9133bf8..4622684 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/000-updates-ctrl.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/000-updates-ctrl.sql @@ -52,7 +52,7 @@ GRANT EXECUTE ON FUNCTION sys.start_tick( ) TO :dbuser; CREATE OR REPLACE FUNCTION sys.end_tick( IN tick_id BIGINT ) RETURNS VOID STRICT VOLATILE - SECURITY INVOKER + SECURITY DEFINER AS $$ BEGIN UPDATE events.events SET status = 'READY' @@ -62,6 +62,8 @@ BEGIN END; $$ LANGUAGE plpgsql; +GRANT EXECUTE ON FUNCTION sys.end_tick( BIGINT ) TO :dbuser; + -- @@ -103,70 +105,78 @@ GRANT EXECUTE ON FUNCTION sys.check_stuck_tick( ) TO :dbuser; -- --- Process game updates +-- Prepare game updates -- -- Parameters: --- c_tick Current tick +-- u_id Current update identifier +-- u_type Type of game updates to prepare -- -- Returns: --- TRUE if the function must be called again, FALSE otherwise +-- has_more TRUE if there are more updates, FALSE otherwise -- -CREATE OR REPLACE FUNCTION sys.process_updates( IN c_tick BIGINT , OUT has_more BOOLEAN ) +CREATE OR REPLACE FUNCTION sys.prepare_updates( IN u_id BIGINT , IN u_type update_type , OUT has_more BOOLEAN ) STRICT VOLATILE SECURITY DEFINER AS $$ -DECLARE - b_size INT; - p_utype update_type; - utype update_type; - uid BIGINT; BEGIN - b_size := sys.get_constant( 'game.batchSize' ); - p_utype := NULL; + UPDATE sys.updates SET status = 'PROCESSING' + WHERE id IN ( + SELECT id FROM sys.updates + WHERE gu_type = u_type + AND last_tick = u_id + AND status = 'FUTURE' + ORDER BY id + LIMIT sys.get_constant( 'game.batchSize' )::BIGINT + ); - -- Mark at most b_size entries as being updated - FOR uid , utype IN SELECT id , gu_type FROM sys.updates - WHERE last_tick = c_tick AND status = 'FUTURE' - ORDER BY gu_type LIMIT b_size - LOOP - IF p_utype IS NULL THEN - p_utype := utype; - END IF; - EXIT WHEN utype <> p_utype; - UPDATE sys.updates SET status = 'PROCESSING' WHERE id = uid; - END LOOP; - - has_more := p_utype IS NOT NULL; - IF has_more THEN - -- Execute actual updates - EXECUTE 'SELECT sys.process_' || lower( p_utype::TEXT ) || '_updates( $1 )' - USING c_tick; - UPDATE sys.updates SET status = 'PROCESSED' - WHERE status = 'PROCESSING' AND last_tick = c_tick; - ELSE - -- If nothing was found, we're done - PERFORM sys.end_tick( c_tick ); - END IF; + has_more := FOUND; END; $$ LANGUAGE plpgsql; -GRANT EXECUTE ON FUNCTION sys.process_updates( BIGINT ) TO :dbuser; - - - - - - - - - - - +GRANT EXECUTE ON FUNCTION sys.prepare_updates( BIGINT , update_type ) TO :dbuser; +-- +-- Execute procedural game updates +-- +-- Parameters: +-- c_tick Current tick identifier +-- u_type Type of updates to execute +-- + +CREATE OR REPLACE FUNCTION sys.exec_update_proc( IN c_tick BIGINT , IN u_type update_type ) + RETURNS VOID + STRICT VOLATILE + SECURITY DEFINER + AS $$ +BEGIN + EXECUTE 'SELECT sys.process_' || lower( u_type::TEXT ) || '_updates( $1 )' + USING c_tick; +END; +$$ LANGUAGE plpgsql; + +GRANT EXECUTE ON FUNCTION sys.exec_update_proc( BIGINT , update_type ) TO :dbuser; +-- +-- Mark updates as processed +-- +-- Parameters: +-- c_tick Current tick identifier +-- u_type Type of updates to execute +-- +CREATE OR REPLACE FUNCTION sys.updates_processed( IN c_tick BIGINT , IN u_type update_type ) + RETURNS VOID + STRICT VOLATILE + SECURITY DEFINER +AS $$ + UPDATE sys.updates SET status = 'PROCESSED' + WHERE status = 'PROCESSING' + AND last_tick = $1 + AND gu_type = $2 +$$ LANGUAGE SQL; +GRANT EXECUTE ON FUNCTION sys.updates_processed( BIGINT , update_type ) TO :dbuser; diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/010-empire-money.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/010-empire-money.sql index a0bb8b1..9cd715e 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/010-empire-money.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/010-empire-money.sql @@ -14,8 +14,8 @@ CREATE OR REPLACE FUNCTION sys.process_empire_money_updates( c_tick BIGINT ) AS $$ DECLARE rec RECORD; - c_cash REAL; - c_debt REAL; + c_cash DOUBLE PRECISION; + c_debt DOUBLE PRECISION; BEGIN -- Lock empires for update PERFORM e.name_id FROM sys.updates su diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/020-empire-research.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/020-empire-research.sql index d9e3cfe..f17ce33 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/020-empire-research.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/020-empire-research.sql @@ -7,15 +7,22 @@ -- -------------------------------------------------------- -CREATE OR REPLACE FUNCTION sys.process_empire_research_updates( c_tick BIGINT ) + +-- +-- Prepare the research update +-- +-- Parameters: +-- update_id The current update's identifier +-- +-- Returns: +-- a set of tech._research_update_input records +-- + +CREATE OR REPLACE FUNCTION emp.prepare_research_update( update_id BIGINT ) RETURNS VOID STRICT VOLATILE - SECURITY INVOKER + SECURITY DEFINER AS $$ -DECLARE - rec RECORD; - r_points REAL; - tu_rec RECORD; BEGIN -- Lock empires for update and planets for share PERFORM e.name_id FROM sys.updates su @@ -23,64 +30,137 @@ BEGIN INNER JOIN emp.empires e ON eu.empire_id = e.name_id INNER JOIN emp.planets ep ON ep.empire_id = e.name_id INNER JOIN verse.planets p ON p.name_id = ep.planet_id - WHERE su.last_tick = c_tick AND su.status = 'PROCESSING' + WHERE su.last_tick = update_id AND su.status = 'PROCESSING' AND su.gu_type = 'EMPIRE_RESEARCH' FOR UPDATE OF e FOR SHARE OF ep , p; - -- Process empires - FOR rec IN SELECT e.name_id AS id , ( v.status = 'PROCESSED' ) AS on_vacation , - sum( p.population ) AS population - FROM sys.updates su - INNER JOIN emp.updates eu ON eu.update_id = su.id - INNER JOIN emp.empires e ON eu.empire_id = e.name_id - INNER JOIN emp.planets ep ON ep.empire_id = e.name_id - INNER JOIN verse.planets p ON p.name_id = ep.planet_id - INNER JOIN naming.empire_names en ON en.id = e.name_id - LEFT OUTER JOIN users.vacations v ON v.account_id = en.owner_id - WHERE su.last_tick = c_tick AND su.status = 'PROCESSING' - AND su.gu_type = 'EMPIRE_RESEARCH' - GROUP BY e.name_id , v.status - LOOP - -- Insert any missing tech line - INSERT INTO emp.technologies ( empire_id , line_id ) - SELECT rec.id , l.name_id - FROM tech.lines l - LEFT OUTER JOIN emp.technologies t - ON t.line_id = l.name_id AND t.empire_id = rec.id - WHERE t.empire_id IS NULL; - - -- Compute research output - r_points := rec.population * sys.get_constant( 'game.work.rpPerPopUnit' ) / 1440.0; - IF rec.on_vacation - THEN - r_points := r_points / sys.get_constant( 'vacation.researchDivider' ); - END IF; - - -- Update technologies where: - -- 1) the level actually exists and - -- 2) accumulated points haven't reach the level's - FOR tu_rec IN SELECT t.line_id AS line_id , t.accumulated AS accumulated , - l.points AS points , ( l.points - t.accumulated ) AS diff , - l.id AS level_id - FROM emp.technologies t - INNER JOIN tech.levels l ON l.line_id = t.line_id - AND l.level = t.level AND t.accumulated < l.points - WHERE t.empire_id = rec.id - FOR UPDATE OF t - LOOP - UPDATE emp.technologies t SET accumulated = ( CASE - WHEN tu_rec.diff <= r_points THEN tu_rec.points - ELSE tu_rec.accumulated + r_points - END ) - WHERE t.line_id = tu_rec.line_id AND t.empire_id = rec.id; - - -- Send message - IF tu_rec.diff <= r_points - THEN - PERFORM events.tech_ready_event( rec.id , tu_rec.level_id ); - END IF; - END LOOP; - END LOOP; + -- Create temporary table for update output and grant INSERT privilege + -- to session user. + CREATE TEMPORARY TABLE research_update_output( + empire_id INT , + technology TEXT , + creation BOOLEAN , + points DOUBLE PRECISION , + priority INT + ); + IF session_user <> current_user THEN + EXECUTE 'GRANT INSERT ON research_update_output TO ' || session_user; + END IF; END; -$$ LANGUAGE plpgsql; \ No newline at end of file +$$ LANGUAGE plpgsql; + +GRANT EXECUTE ON FUNCTION emp.prepare_research_update( update_id BIGINT ) TO :dbuser; + + +-- +-- Research update input views +-- + +CREATE VIEW emp.rui_inprogress_view + AS SELECT su.last_tick AS update_id , er.empire_id , ns.name AS technology , + er.accumulated AS points , er.priority AS priority + FROM sys.updates su + INNER JOIN emp.updates eu ON eu.update_id = su.id + INNER JOIN emp.research er ON er.empire_id = eu.empire_id + INNER JOIN defs.strings ns ON ns.id = er.technology_id + WHERE su.status = 'PROCESSING' + AND su.gu_type = 'EMPIRE_RESEARCH'; + + +CREATE VIEW emp.rui_researched_view + AS SELECT su.last_tick AS update_id , er.empire_id , ns.name AS technology , + er.implemented AS implemented + FROM sys.updates su + INNER JOIN emp.updates eu ON eu.update_id = su.id + INNER JOIN emp.researched_technologies er + ON er.empire_id = eu.empire_id + INNER JOIN defs.strings ns ON ns.id = er.technology_id + WHERE su.status = 'PROCESSING' + AND su.gu_type = 'EMPIRE_RESEARCH'; + +CREATE VIEW emp.research_update_input_view + AS SELECT update_id , empire_id , technology , + NULL::BOOLEAN AS implemented , points , priority + FROM emp.rui_inprogress_view + UNION ALL SELECT update_id , empire_id , technology , + implemented , NULL::DOUBLE PRECISION AS points , + NULL::INT AS priority + FROM emp.rui_researched_view; + +GRANT SELECT ON emp.research_update_input_view TO :dbuser; + + +-- +-- Research points production view +-- + +CREATE VIEW emp.research_points_production + AS SELECT su.last_tick AS update_id , e.name_id AS empire_id , + ( sum( p.population ) * sys.get_constant( 'game.research.perPopUnit' ) + / ( sys.get_constant( 'game.updatesPerDay' ) * ( CASE + WHEN v.status = 'PROCESSED' THEN + sys.get_constant( 'game.research.perPopUnit' ) + ELSE + 1.0 + END ) ) ) AS points + FROM sys.updates su + INNER JOIN emp.updates eu ON eu.update_id = su.id + INNER JOIN emp.empires e ON eu.empire_id = e.name_id + INNER JOIN emp.planets ep ON ep.empire_id = e.name_id + INNER JOIN verse.planets p ON p.name_id = ep.planet_id + INNER JOIN naming.empire_names en ON en.id = e.name_id + LEFT OUTER JOIN users.vacations v ON v.account_id = en.owner_id + WHERE su.status = 'PROCESSING' AND su.gu_type = 'EMPIRE_RESEARCH' + GROUP BY su.last_tick , e.name_id , v.status; + +GRANT SELECT ON emp.research_points_production TO :dbuser; + + + +-- +-- Submit the contents of the research update table +-- + +CREATE OR REPLACE FUNCTION emp.submit_research_update( ) + RETURNS VOID + STRICT VOLATILE + SECURITY DEFINER + AS $$ +BEGIN + -- Delete finished research topics + DELETE FROM emp.research er + USING research_update_output ruo , defs.strings ns + WHERE er.empire_id = ruo.empire_id + AND er.technology_id = ns.id AND ns.name = ruo.technology + AND ruo.points IS NULL; + + -- Insert researched technologies + INSERT INTO emp.researched_technologies ( empire_id , technology_id , implemented ) + SELECT ruo.empire_id , ns.id , FALSE + FROM research_update_output ruo + INNER JOIN defs.strings ns ON ns.name = ruo.technology + WHERE ruo.points IS NULL; + + -- Insert new research topics + INSERT INTO emp.research ( empire_id , technology_id , accumulated , priority ) + SELECT ruo.empire_id , ns.id , ruo.points , ruo.priority + FROM research_update_output ruo + INNER JOIN defs.strings ns ON ns.name = ruo.technology + WHERE ruo.points IS NOT NULL AND ruo.creation; + + -- Update existing research topics + UPDATE emp.research er + SET accumulated = ruo.points , priority = ruo.priority + FROM research_update_output ruo , defs.strings ns + WHERE ruo.points IS NOT NULL AND NOT ruo.creation + AND ns.name = ruo.technology + AND er.technology_id = ns.id + AND er.empire_id = ruo.empire_id; + + -- Drop temporary table + DROP TABLE research_update_output; +END; +$$ LANGUAGE plpgsql; + +GRANT EXECUTE ON FUNCTION emp.submit_research_update( ) TO :dbuser; diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/025-empire-debt.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/025-empire-debt.sql index 7bcaa9f..89a7fae 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/025-empire-debt.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/025-empire-debt.sql @@ -15,11 +15,11 @@ CREATE OR REPLACE FUNCTION sys.process_empire_debt_updates( c_tick BIGINT ) SECURITY INVOKER AS $$ DECLARE - fleet_dr REAL; - bld_dr REAL; + fleet_dr DOUBLE PRECISION; + bld_dr DOUBLE PRECISION; empire INT; - debt REAL; - upkeep REAL; + debt DOUBLE PRECISION; + upkeep DOUBLE PRECISION; BEGIN fleet_dr := sys.get_constant( 'game.debt.fleet'); bld_dr := sys.get_constant( 'game.debt.buildings'); diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/060-planet-battle.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/060-planet-battle.sql index d944f65..c2c8338 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/060-planet-battle.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/060-planet-battle.sql @@ -42,17 +42,17 @@ CREATE OR REPLACE FUNCTION sys.process_planet_battle_main_updates( c_tick BIGINT AS $$ DECLARE ttfi INT; - initi REAL; - dbonus REAL; - dmg REAL; - rdmg REAL; + initi DOUBLE PRECISION; + dbonus DOUBLE PRECISION; + dmg DOUBLE PRECISION; + rdmg DOUBLE PRECISION; rec RECORD; a_power BIGINT; d_power BIGINT; p_power BIGINT; - bmod REAL; - a_dmg REAL; - d_dmg REAL; + bmod DOUBLE PRECISION; + a_dmg DOUBLE PRECISION; + d_dmg DOUBLE PRECISION; BEGIN ttfi := floor( sys.get_constant( 'game.battle.timeToFullIntensity' ) )::INT; initi := sys.get_constant( 'game.battle.initialIntensity' ); @@ -61,7 +61,7 @@ BEGIN rdmg := sys.get_constant( 'game.battle.randomDamage' ); FOR rec IN SELECT b.id AS battle , b.first_tick AS first_tick , - b.location_id AS location , ( ph.current / p.population )::REAL AS happiness + b.location_id AS location , ph.current / p.population AS happiness FROM sys.updates su INNER JOIN verse.updates vu ON vu.update_id = su.id INNER JOIN verse.planets p ON vu.planet_id = p.name_id diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/080-planet-construction.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/080-planet-construction.sql index 37470af..d2c7341 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/080-planet-construction.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/080-planet-construction.sql @@ -14,20 +14,20 @@ CREATE OR REPLACE FUNCTION sys.process_planet_construction_updates( c_tick BIGIN AS $$ DECLARE rec RECORD; - wu_per_pop REAL; - dest_work REAL; - dest_rec REAL; + wu_per_pop DOUBLE PRECISION; + dest_work DOUBLE PRECISION; + dest_rec DOUBLE PRECISION; cur_empire INT; - cur_cash REAL; + cur_cash DOUBLE PRECISION; cur_planet INT; p_finished BOOLEAN; - cur_wus REAL; - cur_acc_c REAL; + cur_wus DOUBLE PRECISION; + cur_acc_c DOUBLE PRECISION; n_found INT; n_removed INT; - i_work REAL; - i_cost REAL; - can_do REAL; + i_work DOUBLE PRECISION; + i_cost DOUBLE PRECISION; + can_do DOUBLE PRECISION; must_do INT; BEGIN -- Get constants @@ -39,7 +39,7 @@ BEGIN cur_empire := NULL; cur_planet := NULL; FOR rec IN SELECT p.name_id AS id , p.population AS pop , - ( ph.current / p.population )::REAL AS happiness , + ph.current / p.population AS happiness , e.name_id AS owner , e.cash AS cash , q.money AS acc_cash , q.work AS acc_work , qi.queue_order AS qorder , qi.amount AS amount , @@ -100,10 +100,7 @@ BEGIN IF cur_planet IS NULL THEN cur_planet := rec.id; cur_cash := cur_cash + rec.acc_cash; - cur_wus := rec.acc_work + verse.adjust_production( - ( rec.pop * wu_per_pop )::REAL , - rec.happiness - ); + cur_wus := rec.acc_work + verse.adjust_production( rec.pop * wu_per_pop , rec.happiness ); n_found := 1; n_removed := 0; cur_acc_c := 0; diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/090-planet-military.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/090-planet-military.sql index f3c250a..b1bc4eb 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/090-planet-military.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/090-planet-military.sql @@ -15,14 +15,14 @@ CREATE OR REPLACE FUNCTION sys.process_planet_military_updates( c_tick BIGINT ) DECLARE rec RECORD; cur_empire INT; - cur_cash REAL; + cur_cash DOUBLE PRECISION; cur_planet INT; p_finished BOOLEAN; - cur_wus REAL; - cur_acc_c REAL; + cur_wus DOUBLE PRECISION; + cur_acc_c DOUBLE PRECISION; n_found INT; n_removed INT; - can_do REAL; + can_do DOUBLE PRECISION; must_do INT; fl_id BIGINT; BEGIN @@ -38,7 +38,7 @@ BEGIN cur_empire := NULL; cur_planet := NULL; FOR rec IN SELECT p.name_id AS id , - ( ph.current / p.population )::REAL AS happiness , + ph.current / p.population AS happiness , e.name_id AS owner , e.cash AS cash , q.money AS acc_cash , q.work AS acc_work , qi.queue_order AS qorder , qi.amount AS amount , diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/100-planet-population.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/100-planet-population.sql index 2a805f8..52d2d91 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/100-planet-population.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/100-planet-population.sql @@ -14,16 +14,16 @@ CREATE OR REPLACE FUNCTION sys.process_planet_population_updates( c_tick BIGINT AS $$ DECLARE rec RECORD; - rel_ch REAL; - abs_ch REAL; - g_fact REAL; - gf_inc REAL; - n_happ REAL; - t_happ REAL; - temp REAL; - growth REAL; - workers REAL; - str_thr REAL; + rel_ch DOUBLE PRECISION; + abs_ch DOUBLE PRECISION; + g_fact DOUBLE PRECISION; + gf_inc DOUBLE PRECISION; + n_happ DOUBLE PRECISION; + t_happ DOUBLE PRECISION; + temp DOUBLE PRECISION; + growth DOUBLE PRECISION; + workers DOUBLE PRECISION; + str_thr DOUBLE PRECISION; BEGIN -- Get constants rel_ch := sys.get_constant( 'game.happiness.relativeChange' ); @@ -35,7 +35,7 @@ BEGIN -- Process planets FOR rec IN SELECT p.name_id AS id , p.population AS pop , ph.target AS target , ph.current AS happy_pop , - ( ph.current / p.population )::REAL AS current + ph.current / p.population AS current FROM sys.updates su INNER JOIN verse.updates vu ON vu.update_id = su.id INNER JOIN verse.planets p ON vu.planet_id = p.name_id diff --git a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/110-planet-money.sql b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/110-planet-money.sql index cbcc432..c22c86a 100644 --- a/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/110-planet-money.sql +++ b/legacyworlds-server/legacyworlds-server-data/db-structure/parts/updates/110-planet-money.sql @@ -14,10 +14,10 @@ CREATE OR REPLACE FUNCTION sys.process_planet_money_updates( c_tick BIGINT ) AS $$ DECLARE rec RECORD; - incme REAL; + incme DOUBLE PRECISION; BEGIN FOR rec IN SELECT p.name_id AS id , p.population AS pop , - ( ph.current / p.population )::REAL AS happiness , + ph.current / p.population AS happiness , ( ea.planet_id IS NULL ) AS produces_income FROM sys.updates su INNER JOIN verse.updates vu ON vu.update_id = su.id diff --git a/legacyworlds-server/legacyworlds-server-data/pom.xml b/legacyworlds-server/legacyworlds-server-data/pom.xml index a84f721..be98172 100644 --- a/legacyworlds-server/legacyworlds-server-data/pom.xml +++ b/legacyworlds-server/legacyworlds-server-data/pom.xml @@ -4,13 +4,13 @@ legacyworlds-server com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-data Legacy Worlds server data - 5.99.1 + 5.99.2 This package contains all data access classes for the Legacy Worlds server. diff --git a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/EmpireTechLine.java b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/EmpireTechLine.java deleted file mode 100644 index 7ab9d68..0000000 --- a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/EmpireTechLine.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.deepclone.lw.sqld.game; - - -import java.util.LinkedList; -import java.util.List; - - - -public class EmpireTechLine -{ - private int id; - - private String name; - - private String description; - - private List< EmpireTechnology > technologies = new LinkedList< EmpireTechnology >( ); - - - public int getId( ) - { - return id; - } - - - public void setId( int id ) - { - this.id = id; - } - - - public String getName( ) - { - return name; - } - - - public void setName( String name ) - { - this.name = name; - } - - - public String getDescription( ) - { - return description; - } - - - public void setDescription( String description ) - { - this.description = description; - } - - - public List< EmpireTechnology > getTechnologies( ) - { - return technologies; - } - - - public void addTechnology( EmpireTechnology eTech ) - { - this.technologies.add( eTech ); - } -} diff --git a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/EmpireTechnology.java b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/EmpireTechnology.java deleted file mode 100644 index b36d4dd..0000000 --- a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/EmpireTechnology.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.deepclone.lw.sqld.game; - - -public class EmpireTechnology -{ - private int line; - - private String name; - - private String description; - - private boolean implemented; - - private int progress; - - private int cost; - - - public int getLine( ) - { - return line; - } - - - public void setLine( int line ) - { - this.line = line; - } - - - public String getName( ) - { - return name; - } - - - public void setName( String name ) - { - this.name = name; - } - - - public String getDescription( ) - { - return description; - } - - - public void setDescription( String description ) - { - this.description = description; - } - - - public boolean isImplemented( ) - { - return implemented; - } - - - public void setImplemented( boolean implemented ) - { - this.implemented = implemented; - } - - - public int getProgress( ) - { - return progress; - } - - - public void setProgress( int progress ) - { - this.progress = progress; - } - - - public int getCost( ) - { - return cost; - } - - - public void setCost( int cost ) - { - this.cost = cost; - } - -} diff --git a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/GeneralInformation.java b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/GeneralInformation.java index 82b7270..1b727f5 100644 --- a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/GeneralInformation.java +++ b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/GeneralInformation.java @@ -4,24 +4,28 @@ package com.deepclone.lw.sqld.game; public class GeneralInformation { - private Character status; + private final Character status; - private String name; + private final String name; - private String tag; + private final String tag; - private long cash; + private final String language; - private long nextTick; + private final long cash; - private int accountId; + private final long nextTick; + + private final int accountId; - public GeneralInformation( Character status , String name , String tag , long cash , long nextTick , int accountId ) + public GeneralInformation( Character status , String name , String tag , String language , long cash , + long nextTick , int accountId ) { this.status = status; this.name = name; this.tag = tag; + this.language = language; this.cash = cash; this.nextTick = nextTick; this.accountId = accountId; @@ -46,6 +50,12 @@ public class GeneralInformation } + public String getLanguage( ) + { + return language; + } + + public long getCash( ) { return cash; diff --git a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/Category.java b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/Category.java new file mode 100644 index 0000000..61b400c --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/Category.java @@ -0,0 +1,169 @@ +package com.deepclone.lw.sqld.game.techs; + + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + + + +/** + * A technology category for the technology graph. + * + * @author tseeker + */ +public class Category +{ + + /** The string identifier of the category's name */ + private final String name; + + /** The string identifier of the category's description */ + private String description; + + /** + * Map of the technologies belonging to the category, with their name string identifier as the + * index. + */ + private Map< String , Technology > technologies; + + + /** + * Initialise a category's representation. + * + * @param name + * string identifier of the category's name + * @param description + * string identifier of the category's description + */ + Category( String name , String description ) + { + this.name = name; + this.description = description; + this.technologies = new HashMap< String , Technology >( ); + } + + + /** + * Copy a category. + * + * @param cat + * the category being copied. + */ + Category( Category cat ) + { + this.name = cat.name; + this.description = cat.description; + this.technologies = new HashMap< String , Technology >( ); + for ( Technology tech : cat.technologies.values( ) ) { + this.technologies.put( tech.getName( ) , new Technology( tech ) ); + } + } + + + /** @return the string identifier of the category's name */ + public String getName( ) + { + return name; + } + + + /** @return the string identifier of the category's description */ + public String getDescription( ) + { + return description; + } + + + /** + * Update the category's description. + * + * @param description + * the string identifier of the category's description + */ + void setDescription( String description ) + { + this.description = description; + } + + + /** + * List technologies in the category. + * + * @return an alphabetically ordered list of technology names + */ + public List< String > getTechnologies( ) + { + List< String > names = new LinkedList< String >( this.technologies.keySet( ) ); + Collections.sort( names ); + return names; + } + + + /** + * Find technology objects stored in the category. + * + * @return the list of technology objects. + */ + Collection< Technology > getTechnologyObjects( ) + { + return this.technologies.values( ); + } + + + /** + * Add a new technology to the category's record. + * + * @param name + * string identifier of the technology's name + * @param description + * string identifier of the technology's description + * @param points + * research points required to implement the technology + * @param cost + * cost of implementing the technology + * @return the newly created {@link Technology} instance + */ + Technology addTechnology( String name , String description , int points , int cost ) + { + Technology tech = new Technology( this , name , description , points , cost ); + this.technologies.put( name , tech ); + return tech; + } + + + /** + * Move a technology from another category into the current category. + * + * @param tech + * the technology to move + */ + void addExistingTechnology( Technology tech ) + { + Category previous = tech.getCategory( ); + if ( previous.name.equals( this.name ) ) { + return; + } + + previous.technologies.remove( tech.getName( ) ); + this.technologies.put( tech.getName( ) , tech ); + tech.setCategory( this ); + } + + + /** + * Remove a technology from the category. This method is meant to be called from + * {@link Technology#delete()}. + * + * @param technology + * the technology to remove. + */ + void removeTechnology( Technology technology ) + { + this.technologies.remove( technology ); + } + +} diff --git a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/EmpireTechnology.java b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/EmpireTechnology.java new file mode 100644 index 0000000..b5dee91 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/EmpireTechnology.java @@ -0,0 +1,175 @@ +package com.deepclone.lw.sqld.game.techs; + + +/** + * Empire technology and research record. + * + * @author tseeker + */ +public class EmpireTechnology +{ + + /** Numeric identifier used for unknown technologies */ + private final Integer numericId; + + /** Technology string name */ + private final String identifier; + + /** Status of the technology */ + private final ResearchStatus status; + + /** Whether additional details should be provided */ + private final boolean detailed; + + /** Research completion percentage */ + private final Integer percentage; + + /** Research priority */ + private final Integer priority; + + /** Implementation cost */ + private final Integer cost; + + + /** + * Initialise the record for an implemented technology. + * + * @param identifier + * string identifier of the technology's name. + */ + public EmpireTechnology( String identifier ) + { + this.numericId = null; + this.identifier = identifier; + this.status = ResearchStatus.IMPLEMENTED; + this.detailed = true; + this.percentage = null; + this.priority = null; + this.cost = null; + } + + + /** + * Initialise the record for an unidentified technology being researched. + * + * @param numericId + * numeric identifier of the technology + * @param identifier + * string identifier of the technology's name + * @param percentage + * research completion percentage + * @param priority + * research priority + */ + public EmpireTechnology( int numericId , String identifier , int percentage , int priority ) + { + this.numericId = numericId; + this.identifier = identifier; + this.status = ResearchStatus.IN_PROGRESS; + this.detailed = false; + this.percentage = percentage; + this.priority = priority; + this.cost = null; + } + + + /** + * Initialise the record for an identified technology being researched. + * + * @param identifier + * string identifier of the technology's name + * @param percentage + * research completion percentage + * @param priority + * research priority + */ + public EmpireTechnology( String identifier , int percentage , int priority ) + { + this.numericId = null; + this.identifier = identifier; + this.status = ResearchStatus.IN_PROGRESS; + this.detailed = true; + this.percentage = percentage; + this.priority = priority; + this.cost = null; + } + + + /** + * Initialise the record for a researched technology. + * + * @param identifier + * string identifier of the technology's name + * @param cost + * implementation cost + */ + public EmpireTechnology( String identifier , int cost ) + { + this.numericId = null; + this.identifier = identifier; + this.status = ResearchStatus.RESEARCHED; + this.detailed = true; + this.percentage = null; + this.priority = null; + this.cost = cost; + } + + + /** @return the numeric identifier used for unknown technologies */ + public Integer getNumericId( ) + { + return this.numericId; + } + + + /** @return the string identifier of the technology's name */ + public String getIdentifier( ) + { + return this.identifier; + } + + + /** @return the technology's research status */ + public ResearchStatus getStatus( ) + { + return this.status; + } + + + /** @return whether details are to be displayed */ + public boolean isDetailed( ) + { + return this.detailed; + } + + + /** + * @return the technology's research completion percentage or null if the + * technology is not under research. + */ + public Integer getPercentage( ) + { + return this.percentage; + } + + + /** + * @return the technology's research priority or null if the technology is not under + * research + */ + public Integer getPriority( ) + { + return priority; + } + + + /** + * @return the technology's implementation cost, or null if the technology is + * either implemented or being researched. + */ + public Integer getCost( ) + { + return this.cost; + } + +} diff --git a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/ResearchStatus.java b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/ResearchStatus.java new file mode 100644 index 0000000..db2b066 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/ResearchStatus.java @@ -0,0 +1,20 @@ +package com.deepclone.lw.sqld.game.techs; + + +/** + * Research status for empire technologies. + * + * @author tseeker + */ +public enum ResearchStatus { + + /** Research in progress */ + IN_PROGRESS , + + /** Technology researched but unimplemented */ + RESEARCHED , + + /** Technology researched and implemented */ + IMPLEMENTED + +} diff --git a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/ResearchUpdateInput.java b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/ResearchUpdateInput.java new file mode 100644 index 0000000..fe50a45 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/ResearchUpdateInput.java @@ -0,0 +1,90 @@ +package com.deepclone.lw.sqld.game.techs; + + +/** + * Record used as the input of the research update handler. + * + * @author tseeker + */ +public class ResearchUpdateInput +{ + + private final int empireId; + private final String technology; + private final ResearchStatus status; + private final Double points; + private final Integer priority; + + + /** + * Initialise the record for a researched technology + * + * @param empireId + * empire identifier + * @param technology + * technology name + * @param implemented + * whether the technology has been implemented or not + */ + public ResearchUpdateInput( int empireId , String technology , boolean implemented ) + { + this.empireId = empireId; + this.technology = technology; + this.status = implemented ? ResearchStatus.IMPLEMENTED : ResearchStatus.RESEARCHED; + this.points = null; + this.priority = null; + } + + + /** + * Initialise the record for an ongoing research process. + * + * @param empireId + * empire identifier + * @param technology + * technology name + * @param points + * accumulated research points + * @param priority + * current priority + */ + public ResearchUpdateInput( int empireId , String technology , double points , int priority ) + { + this.empireId = empireId; + this.technology = technology; + this.status = ResearchStatus.IN_PROGRESS; + this.points = points; + this.priority = priority; + } + + + public int getEmpireId( ) + { + return this.empireId; + } + + + public String getTechnology( ) + { + return this.technology; + } + + + public ResearchStatus getStatus( ) + { + return this.status; + } + + + public Double getPoints( ) + { + return this.points; + } + + + public Integer getPriority( ) + { + return this.priority; + } + +} diff --git a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/ResearchUpdateOutput.java b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/ResearchUpdateOutput.java new file mode 100644 index 0000000..6e338d2 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/ResearchUpdateOutput.java @@ -0,0 +1,134 @@ +package com.deepclone.lw.sqld.game.techs; + + +/** + * Record that describes the output of the research update. + * + * @author tseeker + */ +public class ResearchUpdateOutput +{ + + private final int empireId; + private final String technology; + private final Boolean creation; + private Double points; + private Integer priority; + + + /** + * Create a research update output record which indicates that a technology has been fully + * researched. + * + * @param empireId + * the empire's identifier + * @param technology + * the name of the technology + */ + public ResearchUpdateOutput( int empireId , String technology ) + { + this.empireId = empireId; + this.technology = technology; + this.creation = null; + this.points = null; + this.priority = null; + } + + + /** + * Create a research update output record which indicates that a research progress row should be + * either created or updated. + * + * @param empireId + * the empire's identifier + * @param technology + * the name of the technology + * @param creation + * whether the research process for this technology is a new one + * @param points + * amount of research points accumulated in the record + * @param priority + * priority of the research process + */ + public ResearchUpdateOutput( int empireId , String technology , boolean creation , double points , int priority ) + { + this.empireId = empireId; + this.technology = technology; + this.creation = creation; + this.points = points; + this.priority = priority; + } + + + /** @return the empire's identifier */ + public int getEmpireId( ) + { + return empireId; + } + + + /** @return the name of the technology */ + public String getTechnology( ) + { + return technology; + } + + + /** + * @return whether the research process for this technology is a new one, or null + * if the record is about a fully researched technology + */ + public Boolean getCreation( ) + { + return creation; + } + + + /** + * @return the amount of accumulated research points for the research process or + * null if the record is about a fully researched technology + */ + public Double getPoints( ) + { + return points; + } + + + /** + * Update the accumulated research points + * + * @param points + * the amount of points to add + */ + public void addPoints( Double points ) + { + this.points = this.points + points; + } + + + /** + * @return the research topic's priority or null if the record is about a fully + * researched technology + */ + public Integer getPriority( ) + { + return priority; + } + + + /** + * Set the priority of the research + * + * @param priority + * the new priority + */ + public void setPriority( int priority ) + { + if ( this.priority == null ) { + throw new IllegalArgumentException( "trying to set priority on known technology " + this.technology + + " for empire #" + this.empireId ); + } + this.priority = priority; + } + +} diff --git a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/TechGraph.java b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/TechGraph.java new file mode 100644 index 0000000..0d398a1 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/TechGraph.java @@ -0,0 +1,366 @@ +package com.deepclone.lw.sqld.game.techs; + + +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import com.deepclone.lw.sqld.game.techs.TechGraphException.Code; + + + +/** + * Representation of the whole technology graph. + */ +public class TechGraph +{ + + /** List of all technologies */ + private List< Technology > technologies; + + /** Technologies indexed by name */ + private Map< String , Technology > techsByName; + + /** Technology categories indexed by name */ + private Map< String , Category > categoriesByName; + + + /** Initialise an empty tech graph */ + public TechGraph( ) + { + this.technologies = new LinkedList< Technology >( ); + this.techsByName = new HashMap< String , Technology >( ); + this.categoriesByName = new HashMap< String , Category >( ); + } + + + /** + * Create a copy of an existing tech graph + * + * @param graph + * the original tech graph + */ + public TechGraph( TechGraph graph ) + { + this.technologies = new LinkedList< Technology >( ); + this.techsByName = new HashMap< String , Technology >( ); + this.categoriesByName = new HashMap< String , Category >( ); + + // Copy category and technology fields + for ( Category cat : graph.categoriesByName.values( ) ) { + Category copyCat = new Category( cat ); + this.categoriesByName.put( cat.getName( ) , copyCat ); + + for ( Technology tech : copyCat.getTechnologyObjects( ) ) { + this.technologies.add( tech ); + this.techsByName.put( tech.getName( ) , tech ); + } + } + + // Copy dependencies + for ( Technology tech : this.technologies ) { + for ( String depName : graph.techsByName.get( tech.getName( ) ).getDependencies( ) ) { + tech.addDependency( this.techsByName.get( depName ) ); + } + } + } + + + /** + * Register a new technology category. + * + * @param name + * the name of the new category + * @param description + * the description of the new category + * + * @throws TechGraphException + * with {@link TechGraphException.Code#DUPLICATE_CATEGORY} if the category already + * exists. + */ + public void addCategory( String name , String description ) + throws TechGraphException + { + if ( this.categoriesByName.containsKey( name ) ) { + throw new TechGraphException( Code.DUPLICATE_CATEGORY ); + } + this.categoriesByName.put( name , new Category( name , description ) ); + } + + + /** + * List all categories in alphabetic order + * + * @return the list of category names + */ + public List< String > getCategories( ) + { + List< String > result = new LinkedList< String >( this.categoriesByName.keySet( ) ); + Collections.sort( result ); + return result; + } + + + /** + * Access a registered category. + * + * @param name + * the name of the category + * + * @return the category's record + * + * @throws TechGraphException + * with {@link TechGraphException.Code#MISSING_CATEGORY} if the category does not + * exist. + */ + public Category getCategory( String name ) + throws TechGraphException + { + Category cat = this.categoriesByName.get( name ); + if ( cat == null ) { + throw new TechGraphException( Code.MISSING_CATEGORY , name ); + } + return cat; + } + + + /** + * Set a category's description. + * + * @param name + * the name of the category + * + * @param description + * the string identifier of the new description + * + * @throws TechGraphException + * with {@link TechGraphException.Code#MISSING_CATEGORY} if the category does not + * exist. + */ + public void updateCategory( String name , String description ) + throws TechGraphException + { + this.getCategory( name ).setDescription( description ); + } + + + /** + * Delete a category from the graph's information. + * + * @param name + * the name of the category + * + * @throws TechGraphException + * with {@link TechGraphException.Code#MISSING_CATEGORY} if the category does not + * exist, or with {@link TechGraphException.Code#DEPENDENCY_ERROR} if the category + * contains technologies. + */ + public void deleteCategory( String name ) + throws TechGraphException + { + Category cat = this.getCategory( name ); + if ( !cat.getTechnologies( ).isEmpty( ) ) { + throw new TechGraphException( Code.DEPENDENCY_ERROR ); + } + this.categoriesByName.remove( name ); + } + + + /** + * Register a technology into the graph. + * + * @param category + * the name of the category the new technology will be added to + * @param name + * the string identifier of name of the new technology + * @param description + * the string identifier of description of the new technology + * @param points + * the amount of research points required to research the technology + * @param cost + * the monetary cost of implementing the technology + * + * @throws TechGraphException + * with {@link TechGraphException.Code#MISSING_CATEGORY} if the category does not + * exist, or with {@link TechGraphException.Code#DUPLICATE_TECHNOLOGY} if the + * technology already exists. + */ + public void addTechnology( String category , String name , String description , int points , int cost ) + throws TechGraphException + { + if ( this.techsByName.containsKey( name ) ) { + throw new TechGraphException( Code.DUPLICATE_TECHNOLOGY , name ); + } + + Technology tech = this.getCategory( category ).addTechnology( name , description , points , cost ); + this.technologies.add( tech ); + this.techsByName.put( name , tech ); + } + + + /** + * Access a technology's record. + * + * @param technology + * the name of the technology + * + * @return the {@link Technology} instance describing the technology + * + * @throws TechGraphException + * with {@link TechGraphException.Code#MISSING_TECHNOLOGY} if the technology does + * not exist + */ + public Technology getTechnology( String technology ) + throws TechGraphException + { + Technology tech = this.techsByName.get( technology ); + if ( tech == null ) { + throw new TechGraphException( Code.MISSING_TECHNOLOGY , technology ); + } + return tech; + } + + + /** + * Update a technology's record. + * + * @param technology + * the technology's name + * @param description + * the string identifier of the new description, or null if the + * description must be kept. + * @param points + * the new amount of research points for the technology, or null if the + * research points are not to be modified. + * @param cost + * the new implementation cost of the technology, or null if the cost + * does not change. + * + * @throws TechGraphException + * with {@link TechGraphException.Code#MISSING_TECHNOLOGY} if the technology does + * not exist + */ + public void updateTechnology( String technology , String description , Integer points , Integer cost ) + throws TechGraphException + { + Technology tech = this.getTechnology( technology ); + if ( description != null ) { + tech.setDescription( description ); + } + if ( points != null ) { + tech.setPoints( points ); + } + if ( cost != null ) { + tech.setCost( cost ); + } + } + + + /** + * Modify the category of a technology. + * + * @param technology + * the name of the technology + * @param category + * the name of the category the technology should be moved into + * @throws TechGraphException + * with {@link TechGraphException.Code#MISSING_TECHNOLOGY} if the technology does + * not exist or with {@link TechGraphException.Code#MISSING_CATEGORY} if the + * category does not exist + */ + public void setCategory( String technology , String category ) + throws TechGraphException + { + this.getCategory( category ).addExistingTechnology( this.getTechnology( technology ) ); + } + + + /** + * Add a dependency to a technology. + * + * @param technology + * the name of the technology to add a dependency to + * @param dependsOn + * the name of the new dependency + * + * @throws TechGraphException + * with {@link TechGraphException.Code#MISSING_TECHNOLOGY} if the dependent + * technology does not exist, with + * {@link TechGraphException.Code#MISSING_DEPENDENCY} if the dependency does not + * exist, with {@link TechGraphException.Code#RECURSIVE_DEPENDENCY} if adding the + * dependency would cause a recursion in the graph, or with + * {@link TechGraphException.Code#DUPLICATE_DEPENDENCY} if the technology already + * depends on the specified technology (either directly or indirectly) + */ + public void addDependency( String technology , String dependsOn ) + throws TechGraphException + { + Technology tech = this.getTechnology( technology ); + Technology dep; + try { + dep = this.getTechnology( dependsOn ); + } catch ( TechGraphException e ) { + throw new TechGraphException( Code.MISSING_DEPENDENCY ); + } + + if ( technology.equals( dependsOn ) || dep.hasDependency( technology ) ) { + throw new TechGraphException( Code.RECURSIVE_DEPENDENCY ); + } + if ( tech.hasDependency( dependsOn ) ) { + throw new TechGraphException( Code.DUPLICATE_DEPENDENCY ); + } + + tech.addDependency( dep ); + } + + + /** + * Remove a dependency from a technology's definition. + * + * @param technology + * the name of the dependent technology + * @param dependency + * the name of the dependency to remove + * @throws TechGraphException + * with {@link TechGraphException.Code#MISSING_TECHNOLOGY} if the dependent + * technology does not exist or with + * {@link TechGraphException.Code#MISSING_DEPENDENCY} if the technology does not + * have the specified dependency. + */ + public void removeDependency( String technology , String dependency ) + throws TechGraphException + { + Technology tech = this.getTechnology( technology ); + if ( !tech.hasDirectDependency( dependency ) ) { + throw new TechGraphException( Code.MISSING_DEPENDENCY ); + } + tech.removeDependency( dependency ); + } + + + /** + * Delete a technology's definition. + * + * @param technology + * the name of the technology to delete. + * @throws TechGraphException + * with {@link TechGraphException.Code#MISSING_TECHNOLOGY} if the technology does + * not exist or with {@link TechGraphException.Code#DEPENDENCY_ERROR} if other + * technologies depend on the technology to delete. + */ + public void deleteTechnology( String technology ) + throws TechGraphException + { + Technology tech = this.getTechnology( technology ); + if ( tech.hasReverseDependencies( ) ) { + throw new TechGraphException( Code.DEPENDENCY_ERROR ); + } + + tech.delete( ); + this.techsByName.remove( technology ); + this.technologies.remove( tech ); + } + +} diff --git a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/TechGraphException.java b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/TechGraphException.java new file mode 100644 index 0000000..12cf534 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/TechGraphException.java @@ -0,0 +1,69 @@ +package com.deepclone.lw.sqld.game.techs; + + +/** + * Exceptions thrown by the {@link TechGraph} class when operations on the graph would result in an + * incorrect graph. + * + * @author tseeker + * + */ +@SuppressWarnings( "serial" ) +public class TechGraphException + extends Exception +{ + + /** Error codes associated with tech graph exceptions */ + public static enum Code { + /** Trying to add a duplicate category */ + DUPLICATE_CATEGORY , + + /** Trying to access a category that does not exist */ + MISSING_CATEGORY , + + /** Trying to delete a category or technology on which other technologies depend */ + DEPENDENCY_ERROR , + + /** Trying to add a duplicate technology */ + DUPLICATE_TECHNOLOGY , + + /** Trying to access a technology that does not exist */ + MISSING_TECHNOLOGY , + + /** Trying to access a dependency that does not exist */ + MISSING_DEPENDENCY , + + /** Trying to add a recursive dependency */ + RECURSIVE_DEPENDENCY , + + /** + * Trying to add a dependency that is already present (whether directly or through other + * dependencies) + */ + DUPLICATE_DEPENDENCY , + } + + /** Error code for the exception */ + private final Code code; + + + public TechGraphException( Code code ) + { + super( code.toString( ) ); + this.code = code; + } + + + public TechGraphException( Code code , String identifier ) + { + super( code.toString( ) + " : " + identifier ); + this.code = code; + } + + + public Code getCode( ) + { + return code; + } + +} diff --git a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/Technology.java b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/Technology.java new file mode 100644 index 0000000..eda341b --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/game/techs/Technology.java @@ -0,0 +1,285 @@ +package com.deepclone.lw.sqld.game.techs; + + +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + + + +/** + * Representation of a technology from the technology graph. + * + * @author tseeker + */ +public class Technology +{ + + /** The string identifier of the technology's name */ + private final String name; + + /** The category the technology belongs to */ + private Category category; + + /** The string identifier of the technology's description */ + private String description; + + /** The amount of research points required before the technology can be implemented */ + private double points; + + /** The cost of implementing the technology */ + private double cost; + + /** Map of technologies the current technology depends on */ + private final Map< String , Technology > dependencies; + + /** Map of technologies that depend on the current technology */ + private final Map< String , Technology > dependencyOf; + + /** Names of all technologies the current technology depends on, whether directly or indirectly. */ + private Set< String > fullDependencies; + + + /** + * Initialise the technology's record. This method is meant to be called from + * {@link Category#addTechnology(String, String, int, int)}. + * + * @param category + * the category the technology belongs to + * @param name + * string identifier of the technology's name + * @param description + * string identifier of the technology's description + * @param points + * amount of research points required before the technology can be implemented + * @param cost + * cost of implementing the technology + */ + Technology( Category category , String name , String description , double points , double cost ) + { + this.category = category; + this.name = name; + this.description = description; + this.points = points; + this.cost = cost; + this.dependencies = new HashMap< String , Technology >( ); + this.dependencyOf = new HashMap< String , Technology >( ); + } + + + /** + * Create a partial copy of an existing technology. Dependencies will not be copied as they need + * to be resolved after a full graph copy has been performed. + * + * @param tech + * the technology to copy + */ + Technology( Technology tech ) + { + this.category = tech.category; + this.name = tech.name; + this.description = tech.description; + this.points = tech.points; + this.cost = tech.cost; + this.dependencies = new HashMap< String , Technology >( ); + this.dependencyOf = new HashMap< String , Technology >( ); + } + + + /** + * Check if the technology depends on another, whether directly or indirectly. + * + * @param technology + * the name of the dependency to look for + * @return true if the current technology depends on the specified technology, + * false otherwise + */ + public boolean hasDependency( String technology ) + { + if ( this.fullDependencies == null ) { + this.buildDependencies( ); + } + return this.fullDependencies.contains( technology ); + } + + + /** + * Build the contents of the {@link #fullDependencies} property based on the list of direct + * dependencies. + */ + private void buildDependencies( ) + { + Set< String > deps = new HashSet< String >( ); + for ( Technology dep : this.dependencies.values( ) ) { + deps.add( dep.name ); + if ( dep.fullDependencies == null ) { + dep.buildDependencies( ); + } + deps.addAll( dep.fullDependencies ); + } + this.fullDependencies = deps; + } + + + /** + * Check if the current technology has another technology in its list of direct dependencies. + * + * @param dependency + * the dependency to look for + * @return true if the current technology depends on the specified technology + * directly, false otherwise. + */ + public boolean hasDirectDependency( String dependency ) + { + return this.dependencies.containsKey( dependency ); + } + + + /** + * Check if there are technologies which depend on the current technology. + * + * @return true if at least one technology depends on the current technology, + * false otherwise. + */ + public boolean hasReverseDependencies( ) + { + return !this.dependencyOf.isEmpty( ); + } + + + /** + * Add a new dependency to the current technology. + * + * @param dep + * the dependency to add + */ + void addDependency( Technology dep ) + { + this.dependencies.put( dep.name , dep ); + dep.dependencyOf.put( this.name , this ); + this.fullDependencies = null; + } + + + /** + * Remove an existing dependency from the current technology. + * + * @param dependency + * the name of the dependency to remove + */ + void removeDependency( String dependency ) + { + Technology dep = this.dependencies.get( dependency ); + dep.dependencyOf.remove( this.name ); + this.dependencies.remove( dependency ); + this.fullDependencies = null; + } + + + /** @return the list of technology names the current technology directly depends on */ + public List< String > getDependencies( ) + { + return new LinkedList< String >( this.dependencies.keySet( ) ); + } + + + /** + * Delete the current technology, removing it from the reverse dependency lists of its + * dependencies and from its category. + */ + void delete( ) + { + List< String > deps = new LinkedList< String >( this.dependencies.keySet( ) ); + for ( String dep : deps ) { + this.removeDependency( dep ); + } + this.category.removeTechnology( this ); + } + + + /** @return the string identifier of the technology's name */ + public String getName( ) + { + return this.name; + } + + + /** @return the category the technology belongs to. */ + public Category getCategory( ) + { + return category; + } + + + /** @return the string identifier of the technology's description */ + public String getDescription( ) + { + return description; + } + + + /** + * Update the technology's category + * + * @param category + * the new category + */ + void setCategory( Category category ) + { + this.category = category; + } + + + /** + * Update the string identifier of the technology's description + * + * @param description + * the new description string ID + */ + void setDescription( String description ) + { + this.description = description; + } + + + /** @return the amount of research points required to implement the technology */ + public double getPoints( ) + { + return points; + } + + + /** + * Update the amount of research points required to implement the technology. + * + * @param points + * the new amount of points + */ + void setPoints( int points ) + { + this.points = points; + } + + + /** @return the implementation cost */ + public double getCost( ) + { + return cost; + } + + + /** + * Update the implementation cost. + * + * @param cost + * the new implementation cost. + */ + void setCost( int cost ) + { + this.cost = cost; + } + +} diff --git a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/sys/Constant.java b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/sys/Constant.java index 971b5ef..7d184eb 100644 --- a/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/sys/Constant.java +++ b/legacyworlds-server/legacyworlds-server-data/src/main/java/com/deepclone/lw/sqld/sys/Constant.java @@ -71,13 +71,6 @@ public class Constant } - public void setMinValue( Float minValue ) - { - - this.minValue = ( minValue == null ? null : minValue.doubleValue( ) ); - } - - public Double getMaxValue( ) { return maxValue; @@ -90,13 +83,6 @@ public class Constant } - public void setMaxValue( Float maxValue ) - { - - this.maxValue = ( maxValue == null ? null : maxValue.doubleValue( ) ); - } - - public double getValue( ) { return value; diff --git a/legacyworlds-server/legacyworlds-server-interfaces/pom.xml b/legacyworlds-server/legacyworlds-server-interfaces/pom.xml index 1a0f426..d8b5772 100644 --- a/legacyworlds-server/legacyworlds-server-interfaces/pom.xml +++ b/legacyworlds-server/legacyworlds-server-interfaces/pom.xml @@ -4,12 +4,12 @@ legacyworlds-server com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-interfaces - 5.99.1 + 5.99.2 Legacy Worlds server interfaces This package contains interfaces for all beans provided by the various server components. diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/EmpireDAO.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/EmpireDAO.java index 59342d4..68f9159 100644 --- a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/EmpireDAO.java +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/EmpireDAO.java @@ -7,7 +7,6 @@ import com.deepclone.lw.cmd.ObjectNameError; import com.deepclone.lw.cmd.player.gdata.NameIdPair; import com.deepclone.lw.cmd.player.gdata.PlanetListData; import com.deepclone.lw.cmd.player.gdata.empire.OverviewData; -import com.deepclone.lw.sqld.game.EmpireTechLine; import com.deepclone.lw.sqld.game.GeneralInformation; @@ -24,12 +23,6 @@ public interface EmpireDAO public OverviewData getOverview( int empireId ); - public List< EmpireTechLine > getTechnology( int empireId ); - - - public void implementTechnology( int empireId , int lineId ); - - public List< PlanetListData > getPlanetList( int empireId ); diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/EmpireManagement.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/EmpireManagement.java index eb92be9..bf4d1b3 100644 --- a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/EmpireManagement.java +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/EmpireManagement.java @@ -6,6 +6,7 @@ import com.deepclone.lw.cmd.player.ListPlanetsResponse; import com.deepclone.lw.cmd.player.EmpireResponse; import com.deepclone.lw.cmd.player.elist.EnemyListResponse; import com.deepclone.lw.cmd.player.gdata.GamePageData; +import com.deepclone.lw.interfaces.i18n.LanguageTranslator; import com.deepclone.lw.utils.EmailAddress; @@ -19,12 +20,19 @@ public interface EmpireManagement public GamePageData getGeneralInformation( int empireId ); + /** + * Generate a translation interface in the language used by the account who controls an empire. + * + * @param empireId + * the empire's identifier + * @return the translation interface + */ + public LanguageTranslator getTranslator( int empireId ); + + public EmpireResponse getOverview( int empireId ); - public EmpireResponse implementTechnology( int empireId , int techId ); - - public ListPlanetsResponse getPlanetList( int empireId ); diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/UpdatesDAO.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/UpdatesDAO.java deleted file mode 100644 index 86736b4..0000000 --- a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/UpdatesDAO.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.deepclone.lw.interfaces.game; - - -public interface UpdatesDAO -{ - public boolean processUpdates( long tickId ); -} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/EmpireTechnologyDAO.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/EmpireTechnologyDAO.java new file mode 100644 index 0000000..0274fac --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/EmpireTechnologyDAO.java @@ -0,0 +1,74 @@ +package com.deepclone.lw.interfaces.game.techs; + + +import java.util.List; +import java.util.Map; + +import com.deepclone.lw.sqld.game.techs.EmpireTechnology; + + + +/** + * Interface for the empire technology and research data access component. + * + * @author tseeker + */ +public interface EmpireTechnologyDAO +{ + /** + * List the technologies (implemented, researched and being researched) for the empire. + * + * @param empireId + * the empire's identifier. + * @return the list of technology records for the empire. + */ + public List< EmpireTechnology > getTechnologies( int empireId ); + + + /** + * Implement a technology for an empire. + * + * @param empireId + * the empire's identifier + * @param technology + * the technology's name + * @return an error code: + *
    + *
  • 0 on success,
  • + *
  • 1 if the technology does not exist or is not in the correct status,
  • + *
  • 2 if the empire does not have sufficient resources.
  • + *
+ */ + public int implementTechnology( int empireId , String technology ); + + + /** + * Prepare the temporary table used for a research priorities update. + */ + public void startPrioritiesUpdate( ); + + + /** + * Upload new research priority values into the temporary table used for priority updates. + * + * @param priorities + * the map associating relative technology identifiers with priority values + */ + public void uploadPriorities( Map< String , Integer > priorities ); + + + /** + * Execute prepared research priority updates for an empire. + * + * @param empireId + * the empire's identifier + * @return an error code: + *
    + *
  • 0 on success,
  • + *
  • 1 if the listed technologies do not match the empire's current research,
  • + *
  • 2 if the new priorities were invalid.
  • + *
+ */ + public int finishPrioritiesUpdate( int empireId ); + +} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/EmpireTechnologyManager.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/EmpireTechnologyManager.java new file mode 100644 index 0000000..ac71688 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/EmpireTechnologyManager.java @@ -0,0 +1,53 @@ +package com.deepclone.lw.interfaces.game.techs; + + +import java.util.Map; + +import com.deepclone.lw.cmd.player.research.ResearchOperationResponse; +import com.deepclone.lw.cmd.player.research.ViewResearchResponse; + + + +/** + * Interface for the empire research and technology management component. + * + * @author tseeker + */ +public interface EmpireTechnologyManager +{ + + /** + * Generate the response to a research view request. + * + * @param empireId + * the empire for whom the research view is being displayed. + * @return the response containing the view + */ + public ViewResearchResponse getResearchData( int empireId ); + + + /** + * Implement a technology for an empire. + * + * @param empireId + * the empire trying to implement a technology. + * @param technology + * the name of the technology to implement + * + * @return the response describing the result of the operation + */ + public ResearchOperationResponse implementTechnology( int empireId , String technology ); + + + /** + * Set an empire's research priorities. + * + * @param empireId + * the empire trying to set its research priorities. + * @param priorities + * a map associating relative technology identifiers to priorities. + * + * @return the response describing the result of the operation + */ + public ResearchOperationResponse setResearchPriorities( int empireId , Map< String , Integer > priorities ); +} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/ResearchUpdateDAO.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/ResearchUpdateDAO.java new file mode 100644 index 0000000..4b8537b --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/ResearchUpdateDAO.java @@ -0,0 +1,56 @@ +package com.deepclone.lw.interfaces.game.techs; + + +import java.util.List; +import java.util.Map; + +import com.deepclone.lw.sqld.game.techs.ResearchUpdateInput; +import com.deepclone.lw.sqld.game.techs.ResearchUpdateOutput; + + + +/** + * Data access component for research updates. + * + * @author tseeker + */ +public interface ResearchUpdateDAO +{ + + /** + * Prepare the database for a research update batch. + * + * @param updateId + * the current update's identifier + */ + public void prepareUpdate( long updateId ); + + + /** + * Access the update's information. + * + * @param updateId + * the current update's identifier + * @return the current research status for the empires in the current batch. + */ + public List< ResearchUpdateInput > getUpdateData( long updateId ); + + + /** + * Load the amount of research points for each empire in the update. + * + * @param updateId + * the current update's identifier. + * @return a map which associates empire identifiers to amounts of research points. + */ + public Map< Integer , Double > getResearchPoints( long updateId ); + + + /** + * Submit the output of the research update. + * + * @param output + * a list of changes to commit to the database + */ + public void submitUpdateData( List< ResearchUpdateOutput > output ); +} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/TechnologyGraphDAO.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/TechnologyGraphDAO.java new file mode 100644 index 0000000..9ce624e --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/TechnologyGraphDAO.java @@ -0,0 +1,27 @@ +package com.deepclone.lw.interfaces.game.techs; + + +import com.deepclone.lw.sqld.game.techs.TechGraph; +import com.deepclone.lw.sqld.game.techs.TechGraphException; + + + +/** + * Data access component for the technology graph. + * + * @author tseeker + */ +public interface TechnologyGraphDAO +{ + + /** + * Load the technology graph from the database. + * + * @return the technology graph's representation + * @throws TechGraphException + * if some logic error occurs while the graph is being loaded (for example, circular + * dependencies). + */ + public TechGraph loadGraph( ) + throws TechGraphException; +} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/TechnologyGraphManager.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/TechnologyGraphManager.java new file mode 100644 index 0000000..3fcefa3 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/techs/TechnologyGraphManager.java @@ -0,0 +1,36 @@ +package com.deepclone.lw.interfaces.game.techs; + + +import java.util.List; + +import com.deepclone.lw.cmd.admin.techs.TechCategory; +import com.deepclone.lw.sqld.game.techs.TechGraph; + + + +/** + * Interface for the technology graph manager, which allows queries on the technology graph, as well + * as updates. + * + * @author tseeker + */ +public interface TechnologyGraphManager +{ + + /** + * Access a copy of the tech graph as it exists in the server's memory. This copy includes all + * local changes. + * + * @return a copy of the tech graph + */ + public TechGraph getGraph( ); + + + /** + * List all technology categories from the tech graph. + * + * @return the list of technology categories + */ + public List< TechCategory > listCategories( ); + +} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/DuplicateUpdateHandler.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/DuplicateUpdateHandler.java new file mode 100644 index 0000000..9df38a5 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/DuplicateUpdateHandler.java @@ -0,0 +1,30 @@ +package com.deepclone.lw.interfaces.game.updates; + + +/** + * Runtime exception indicating a duplicate game update phase handler registration. + * + * @author tseeker + */ +public class DuplicateUpdateHandler + extends RuntimeException +{ + + private static final long serialVersionUID = 1L; + + private final GameUpdatePhase phase; + + + public DuplicateUpdateHandler( GameUpdatePhase phase ) + { + super( "duplicate handler for phase " + phase.toString( ) ); + this.phase = phase; + } + + + public GameUpdatePhase getPhase( ) + { + return phase; + } + +} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdate.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdate.java new file mode 100644 index 0000000..db8d796 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdate.java @@ -0,0 +1,25 @@ +package com.deepclone.lw.interfaces.game.updates; + + +/** + * Interface to the main game update component. + * + * @author tseeker + */ +public interface GameUpdate +{ + + /** + * Register a handler component for a game update phase. + * + * @param handler + * the handler to register + * + * @throws DuplicateUpdateHandler + * if a handler has already been registered for the game update phase returned by + * the new handler's {@link GameUpdatePhaseHandler#getPhase()} method. + */ + public void registerHandler( GameUpdatePhaseHandler handler ) + throws DuplicateUpdateHandler; + +} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdatePhase.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdatePhase.java new file mode 100644 index 0000000..9e49fa0 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdatePhase.java @@ -0,0 +1,69 @@ +package com.deepclone.lw.interfaces.game.updates; + + +/** + * The various phases of a game update. This enumeration should reflect the update_type SQL + * type. + * + * @author tseeker + */ +public enum GameUpdatePhase { + + /** Empire income and upkeep computation */ + EMPIRE_MONEY( GameUpdateTarget.EMPIRE ) , + + /** Empire research update */ + EMPIRE_RESEARCH( GameUpdateTarget.EMPIRE ) , + + /** Debt effects computation */ + EMPIRE_DEBT( GameUpdateTarget.EMPIRE ) , + + /** Arrival of fleets on planets */ + PLANET_FLEET_ARRIVALS( GameUpdateTarget.PLANET ) , + + /** Fleet movement computation */ + PLANET_FLEET_MOVEMENTS( GameUpdateTarget.PLANET ) , + + /** Fleet status counter decrease */ + PLANET_FLEET_STATUS( GameUpdateTarget.PLANET ) , + + /** Check for new battles */ + PLANET_BATTLE_START( GameUpdateTarget.PLANET ) , + + /** Main battle computation */ + PLANET_BATTLE_MAIN( GameUpdateTarget.PLANET ) , + + /** Check for battles that have ended */ + PLANET_BATTLE_END( GameUpdateTarget.PLANET ) , + + /** Abandon planets */ + PLANET_ABANDON( GameUpdateTarget.PLANET ) , + + /** Construct/destroy buildings */ + PLANET_CONSTRUCTION( GameUpdateTarget.PLANET ) , + + /** Construct/destroy ships */ + PLANET_MILITARY( GameUpdateTarget.PLANET ) , + + /** Update planetary population */ + PLANET_POPULATION( GameUpdateTarget.PLANET ) , + + /** Compute planet income */ + PLANET_MONEY( GameUpdateTarget.PLANET ); + + private final GameUpdateTarget target; + + + private GameUpdatePhase( GameUpdateTarget target ) + { + this.target = target; + } + + + /** @return the type of target affected by the update */ + public GameUpdateTarget getTarget( ) + { + return target; + } + +} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdatePhaseHandler.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdatePhaseHandler.java new file mode 100644 index 0000000..19ccf3e --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdatePhaseHandler.java @@ -0,0 +1,40 @@ +package com.deepclone.lw.interfaces.game.updates; + + +/** + * Interface for handlers that implement a phase of the game update. + * + * @author tseeker + */ +public interface GameUpdatePhaseHandler +{ + + /** + * @return the game update phase this handler is responsible for. + */ + public GameUpdatePhase getPhase( ); + + + /** + * Prepare the handler. + * + * This method is called outside of any transaction before the update starts. + * + * @param updateId + * the update's identifier + */ + public void onPhaseStart( long updateId ); + + + /** + * Update the game. + * + * @param updateId + * the update's identifier. + * + * @return true if there are more updates of this type to process, + * false if the phase is complete + */ + public boolean updateGame( long updateId ); + +} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdateTarget.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdateTarget.java new file mode 100644 index 0000000..4baf750 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/GameUpdateTarget.java @@ -0,0 +1,17 @@ +package com.deepclone.lw.interfaces.game.updates; + + +/** + * The type of item targeted by a game update phase. + * + * @author tseeker + */ +public enum GameUpdateTarget { + + /** Empire update */ + EMPIRE , + + /** Planet update */ + PLANET + +} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/UpdatesDAO.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/UpdatesDAO.java new file mode 100644 index 0000000..8ee39da --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/updates/UpdatesDAO.java @@ -0,0 +1,46 @@ +package com.deepclone.lw.interfaces.game.updates; + + +/** + * Interface of the game update data access component. + * + * @author tseeker + */ +public interface UpdatesDAO +{ + + /** + * Prepare a batch of game updates. + * + * @param updateId + * game update identifier + * @param phase + * phase of the update + * + * @return true if there are game updates to process in the specified phase, + * false if all updates in the current phase have been handled. + */ + public boolean prepareUpdates( long updateId , GameUpdatePhase phase ); + + + /** + * Execute a game update phase that is implemented as a stored procedure. + * + * @param updateId + * game update identifier + * @param phase + * phase of the game update to execute + */ + public void executeProceduralUpdate( long updateId , GameUpdatePhase phase ); + + + /** + * Mark a set of update records as processed. + * + * @param updateId + * game update identifier + * @param phase + * current phase of the game update + */ + public void validateUpdatedRecords( long updateId , GameUpdatePhase phase ); +} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/i18n/LanguageTranslator.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/i18n/LanguageTranslator.java new file mode 100644 index 0000000..d7eb180 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/i18n/LanguageTranslator.java @@ -0,0 +1,31 @@ +package com.deepclone.lw.interfaces.i18n; + + +/** + * Translation interface specific to a language + * + * @author tseeker + */ +public interface LanguageTranslator +{ + + /** @return the code of the interface's language */ + public String getLanguage( ); + + + /** @return the name of the interface's language */ + public String getLanguageName( ); + + + /** + * Translate a string. + * + * @param string + * the string identifier + * @return the string's translation in the interface's language + * @throws UnknownStringException + * if the string does not exist + */ + public String translate( String string ) + throws UnknownStringException; +} diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/i18n/Translator.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/i18n/Translator.java index 9c5eb39..1990617 100644 --- a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/i18n/Translator.java +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/i18n/Translator.java @@ -62,4 +62,17 @@ public interface Translator */ public String translate( String language , String string ) throws UnknownStringException , UnknownLanguageException; + + + /** + * Initialise a translator for a specific language + * + * @param language + * the identifier of the language + * @return a translation interface for the language + * @throws UnknownLanguageException + * if the specified language does not exist or is not supported + */ + public LanguageTranslator getLanguageTranslator( String language ) + throws UnknownLanguageException; } diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/sys/ConstantsManager.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/sys/ConstantsManager.java index 825e886..7b003b1 100644 --- a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/sys/ConstantsManager.java +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/sys/ConstantsManager.java @@ -2,7 +2,6 @@ package com.deepclone.lw.interfaces.sys; import java.util.Collection; -import java.util.Set; @@ -32,15 +31,15 @@ public interface ConstantsManager /** - * Registers a constants user, which will need to be informed of the constants' changes. If the + * Register a constants user, which will need to be informed of the constants' changes. If the * required constants have not been registered yet, the user instance will not be notified. * * @param user * the constants user component to register * @param constants - * set of constant names the user wants to be informed about + * constant names the user wants to be informed about */ - public void registerUser( ConstantsUser user , Set< String > constants ); + public void registerUser( ConstantsUser user , String... constants ); /** diff --git a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/sys/SystemStatus.java b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/sys/SystemStatus.java index d8cc5d2..62fa5d0 100644 --- a/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/sys/SystemStatus.java +++ b/legacyworlds-server/legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/sys/SystemStatus.java @@ -50,4 +50,11 @@ public interface SystemStatus public Long checkStuckTick( ) throws MaintenanceStatusException; + + /** + * Update the status when a game update has been completed. + */ + public void endTick( ) + throws TickStatusException , MaintenanceStatusException; + } diff --git a/legacyworlds-server/legacyworlds-server-main/data/buildables-test.xml b/legacyworlds-server/legacyworlds-server-main/data/buildables-test.xml deleted file mode 100644 index 69bc47a..0000000 --- a/legacyworlds-server/legacyworlds-server-main/data/buildables-test.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/data/buildables.xml b/legacyworlds-server/legacyworlds-server-main/data/buildables.xml index 5ba9554..9b81696 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/buildables.xml +++ b/legacyworlds-server/legacyworlds-server-main/data/buildables.xml @@ -10,15 +10,15 @@ - + indFactTech - + reanimationTech - + superTurretTech @@ -26,15 +26,15 @@ - + cruisersTech - + bCruisersTech - + dreadnoughtsTech \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/data/buildables.xsd b/legacyworlds-server/legacyworlds-server-main/data/buildables.xsd index a3e80ab..7fad623 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/buildables.xsd +++ b/legacyworlds-server/legacyworlds-server-main/data/buildables.xsd @@ -25,7 +25,7 @@ - + @@ -56,9 +56,4 @@ - - - - - diff --git a/legacyworlds-server/legacyworlds-server-main/data/i18n-text.xml b/legacyworlds-server/legacyworlds-server-main/data/i18n-text.xml index c2ef4e9..955d560 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/i18n-text.xml +++ b/legacyworlds-server/legacyworlds-server-main/data/i18n-text.xml @@ -1,24 +1,14 @@ - + + + text/buildings.xml + text/mail.xml + text/preferences.xml + text/technologies.xml - - - - - - - - - - - - - - + *** @@ -48,89 +38,6 @@ ${text} Messages from administrators: - - Civilian technologies - - - They're not just your slaves, they're your scientists, poets and workers. Make the poets work first, then use these technologies to increase their productivity! Useless poets. - - - - Universal assemblers - - - You know how it is when you have a thingy-bob that you need to build but you just don't have the right tool. Well, fear no more, Universal Assemblers will solve all your problems! Build anything and everything with these clever machines, they are 1337. - - - Corpse reanimation - - - Tired of workers dying too early? Want a little less perspiration in your corporation? Zombies will work, won't complain and best of all, they can be fed on almost anything! Feed them your enemies! But mostly, use them to increase factory productivity by a rather nice amount. - - - Biological generators - - - For every turret a military commander wants, there is a bigger, stronger turret he wants more. Now you too can have such a turret! It will defend your planet with ease while you venture out into the galaxy, bending it to your will. Available in all good hardware stores. - - - - Military technologies - - - It is only one who is thoroughly acquainted with the evils of war that can thoroughly understand the profitable way of carrying it on. - Sun Tzu - - - - Orbital construction - - - Ships built on the ground must endure the stress of atmospheric flight before they are even able to dominate the vast emptiness of space. Build them in space and they will be sleeker, more powerful and now free of the need for windows. Use your brand new Cruisers to dominate the known universe. - - - Structural reinforcement - - - The power of your Cruisers can be augmented by an improved design! Take advantage of a more structurally sound space vehicle that can bring empires to their knees with its speed and technological grace. - - - Automated space docks - - - Technology has advanced. The ultimate weapon is now available. Claim the awesome power of the Dreadnought and crush your enemies. Ever wanted a tank in space? Well, now you have it. All their base are belong to you. - - - - Ship parts factory - - - A Ship parts factory is a mass production factory for the creation of components used in your space faring vessels. They are essential to any space empire; Properly managed factories produce new vehicles quickly and efficiently. - - - Defence turret - - - Exploration without vigilance is the action of a fool. Turrets are the last line of defence for the planet, super massive weapons capable of destroying orbital vehicles from the ground. They can be placed anywhere, on any building or vacant land in your domain and will defend your planets from attack. - - - Generic assembly line - - - Factories are the backbone of a thriving economy, providing goods and matériel to buy and sell on the free market. Your brand new Generic assembly lines will enhance your wealth and keep the population employed. Properly managed factories produce many economic benefits for an empire. - - - Reanimation centre - - - People are frail but cheap and robots are hard wearing but expensive. Renew the life of your workers and you can take advantage of a cheap zombie resource, giving you a third option for keeping your empire thriving. - - - Biological turret - - - The perfect union of man and machine, Biological Turrets are a blending of the technological and the biological to provide the ultimate defence for your planets. More powerful and accurate than Turrets, in ground based defence they are unmatched. Keep your people away from them, however, as they tend to hunger for human flesh. - - Fighter @@ -156,64 +63,6 @@ ${text} Bring the Dread. The Dreadnought is a large capital ship with awesome power and capabilities, expensive and slow but the ultimate in space domination. - - Display preferences - - - Real-life time - - - Selecting this option will cause all durations to be displayed using real-life minutes. - - - Map defaults - - - Map centre (X) - - - The abscissa of the default map centre. - - - Map centre (Y) - - - The ordinates of the default map centre. - - - Map size - - - The default size of the map. - - - E-mail settings - - - Private messages - - - Select the type of e-mail notifications you will get for private messages sent by other empires. - - - Alliance messages - - - Select the type of e-mail notifications you will get for alliance-wise messages. - - - Internal messages - - - Select the type of e-mail notifications you will get for internal game messages. - - - Messages from administrators - - - Select the type of e-mail notifications you will get for messages sent by the game's administrators. - - Small (3x3) @@ -276,7 +125,7 @@ ${text} Some of your planets have finished constructing ships: - + Empty military queue at ${location} @@ -291,7 +140,7 @@ ${text} {{battle:${battleId} Battle #${battleId}}} has started at ${location}. - + Battle ended at ${location} @@ -306,7 +155,7 @@ ${text} The citizens of ${location} are in a really bad mood and have started leaving their posts... We'd better do something about this. - + Situation back to normal on ${location} @@ -321,14 +170,14 @@ ${text} We have lost control of ${location}, which was taken from us by ${taker}. - + Planet ${location} abandoned Our forces have completed the evacuation of ${location}; the citizens of this world are left to fend for themselves. - + Planet ${location} conquered @@ -339,7 +188,7 @@ ${text} We have seized control of planet ${location} from the clutches of ${owner}. - + ${tech} available @@ -359,7 +208,7 @@ ${text} Good to see that our money problems are over, Sir. Good job. Well, of course it'd been better if these problems had never started... Sir? What are you doing with this handgu- - + Pending alliance request @@ -409,7 +258,7 @@ ${text} The leader has left and the alliance was disbanded. - + Fleets have arrived at ${location} @@ -468,7 +317,7 @@ ${text} : switched to defence - + You currently have ${warnings} warning(s). Please note that, upon reaching 3 warnings, the administration team will consider banning you. @@ -503,7 +352,7 @@ Your alliance, ${oldName}, had a name that was considered either vulgar, disresp It was disbanded. - + Bug report #${id} updated @@ -518,20 +367,6 @@ It was disbanded. - - - - - - - - - - - - - - *** @@ -561,89 +396,6 @@ ${text} Messages des administrateurs : - - Technologies civiles - - - Ce ne sont pas uniquement vos esclaves, ce sont vos chercheurs, poètes et ouvriers. Faites travailler d'abord les poètes, puis utilisez ces technologies pour augmenter leur productivité! Poètes inutiles... - - - - Assembleurs universels - - - Vous savez ce que c'est d'avoir un truc à construire, alors que malheureusement vous ne diposez pas du bon outil. Eh bien, plus de peur : les Assembleurs Universels vont résoudre tous vos problèmes! Construisez tout et n'importe quoi avec ces machines intelligentes, elles sont 1337. - - - Réanimation de cadavres - - - Fatigué de ces ouvriers qui passent l'arme à gauche trop tôt? Vous voulez un peu plus de transpiration dans vos ateliers ? Les zombies vont travailler, ne vont pas se plaindre, et encore mieux ils peuvent être nourris avec n'importe quoi - y compris avec vos énemis! Mais surtout, utilisez les pour augmenter de manière significative la productivité de vos usines. - - - Générateurs biologiques - - - Pour chaque tourelle qu'un commandant militaire réclame, il en est une qu'il désire encore plus. Maintenant, vous aussi pouvez avoir de telles tourelles! Elles défendront vos planètes avec aisance, pendant que vous vous aventurerez dans la galaxie, la pliant à votre volonté. Disponible chez tous les bons quincaillers. - - - - Technologies militaires - - - Ceux qui ne comprennent pas les dommages que la guerre peut causer n'en comprendront jamais les avantages. - Sun Tzu - - - - Construction orbitale - - - Les vaisseaux construits à la surface doivent subir le stress du vol atmosphérique avant même d'être lancés à assaut du grand vide interstellaire. Construisez-les dans l'espace et ils seront plus gracieux, plus puissants, et ne nécessiteront plus de fenêtres. Utilisez vos tout nouveaux croiseurs pour dominer l'univers connu. - - - Consolidation structurelle - - - La puissance de vos croiseurs peut être augmentée par une conception améliorée! Profitez d'un véhicule à la structure mieux adaptée à l'espace qui peut mettre des empires à genoux grâce à sa vitesse et sa finesse technologique. - - - Docks orbitaux automatisés - - - La technologie a évolué. L'arme ultime est maintenant disponible. Revendiquez la puissance écrasante du cuirassé et pulvérisez vos opposants. Déjà rêvé d'un tank de l'espace ? Eh bien, maintenant, vous l'avez. All their base are belong to you. - - - - Fabrique de pièces de vaisseaux - - - Une fabrique de pièces de vaisseaux est une usine de production de masse pour la création des composants utilisés dans vos vaisseaux spatiaux. Elles sont essentielles à tout empire spatial ; bien gérées, elles produisent de nouveaux vaisseaux rapidement et efficacement. - - - Tourelle défensive - - - Explorer sans être sur ses gardes est une statégie de lunatique. Les tourelles défensives sont la dernière ligne de défense d'une planète, énormes armes capables de détruire des véhicules en orbite depuis le sol. Elles peuvent être placées n'importe où, sur n'importe quel bâtiment ou espace dégagé de votre domaine, et défendront vos planètes contre les attaques. - - - Ligne de production générique - - - Les usines sont l'épine dorsale d'une économie florissante, fournissant des biens et pièces détachées qui peuvent être vendues sur le marché. Vos Lignes de production génériques flambant neuves vont augmenter votre richesse et conserver votre population dans l'emploi. Des usines bien gérées fournissent de nombreux bénéfices économiques à un empire. - - - Centre de réanimation - - - Les humains sont frêles mais peu coûteux et les robots sont endurants mais très chers. Renouvelez la vie de vos travailleurs et vous pourrez tirer partie d'une ressource de zombies bon marché, vous permettant d'explorer une troisième voie pour conserver un empire florissant. - - - Tourelle biologique - - - L'union parfaite de l'homme et de la machine, les tourelles biologiques sont un mélange du technologique et du biologique pour fournir la défense ultime à vos planètes. Plus puissantes et précises que les tourelles, au niveau défense au sol, elles ne peuvent être surclassées. Mais gardez votre population à distance, car elles ont tendance à avoir faim de chair humaine! - - Chasseur @@ -669,64 +421,6 @@ ${text} Amenez la cuirasse. Le cuirassé est un énorme vaisseau aux performances et à la puissance impressionantes, cher et lent, mais le nec plus ultra de la domination spatiale. - - Préférences d'affichage - - - Temps réel - - - Les durées seront affichées en utilisant de "vraies" mesures si cette option est sélectionnée. - - - Carte - - - Centre de la carte (X) - - - L'abscisse par défaut du centre de la carte. - - - Centre de la carte (Y) - - - L'ordonnée par défaut du centre de la carte. - - - Taille de la carte - - - La taille par défaut de la carte. - - - Envoi de courrier électronique - - - Messages privés - - - Sélectionnez le type de notifications par courier électronique que vous recevrez lorsque d'autres empires vous envoient des messages privés. - - - Messages d'alliance - - - Sélectionnez le type de notifications par courier électronique que vous recevrez lorsque vous recevez un message d'alliance. - - - Messages internes - - - Sélectionnez le type de notifications par courier électronique que vous recevrez lorsque vous recevez un message interne du jeu. - - - Messages des administrateurs - - - Sélectionnez le type de notifications par courier électronique que vous recevrez lorsque vous recevez un message des administrateurs du jeu. - - Petite (3x3) @@ -789,7 +483,7 @@ ${text} Certaines de vos planètes ont fini de construire des vaisseaux : - + Liste de construction militaire vide sur ${location} @@ -804,7 +498,7 @@ ${text} {{battle:${battleId} La bataille #${battleId}}} a commencé sur ${location}. - + Bataille terminée sur ${location} @@ -819,7 +513,7 @@ ${text} Les habitants de ${location} sont de très mauvaise humeur et ont commencé à quitter leurs postes... Nous devrions faire quelque chose à ce sujet. - + Situation revenue à la normale sur ${location} @@ -834,14 +528,14 @@ ${text} Nous avons perdu le contrôle de ${location}, qui nous a été prise par ${taker}. - + Abandon de la planète ${location} Nos forces ont terminé l'évacutation de ${location}; les habitants de ce monde sont livrés à eux-mêmes. - + Conquête de la planète${location} @@ -852,7 +546,7 @@ ${text} Nous avons pris le contrôle de la planète ${location} des griffes de ${owner}. - + ${tech} disponible @@ -872,7 +566,7 @@ ${text} C'est bon de voir que nos problèmes d'argent sont résolus, Chef. Bien joué. Bien sûr, ça aurait été mieux si ces problèmes n'avaient jamais eu lieu... Chef, qu'est ce que vous faites avec ce pistol- - + Demande d'alliance en attente @@ -922,7 +616,7 @@ ${text} Le dirigeant est parti et l'alliance a été dissoute. - + Arrivée de flottes sur ${location} @@ -981,7 +675,7 @@ ${text} : est passée en défensee - + Vous avez actuellement ${warnings} avertissement(s). Veuillez noter que, lorsque vous atteindrez 3 avertissements, l'équipe d'administration va envisager votre expulsion. @@ -1016,7 +710,7 @@ Votre alliance, ${oldName}, avait un nom qui a été considéré comme vulgaire, Elle a été dissoute. - + Rapport de bug #${id} mis à jour diff --git a/legacyworlds-server/legacyworlds-server-main/data/i18n-text.xsd b/legacyworlds-server/legacyworlds-server-main/data/i18n-text.xsd index 8f8932d..599b13d 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/i18n-text.xsd +++ b/legacyworlds-server/legacyworlds-server-main/data/i18n-text.xsd @@ -5,6 +5,7 @@ + diff --git a/legacyworlds-server/legacyworlds-server-main/data/techs-test.xml b/legacyworlds-server/legacyworlds-server-main/data/techs-test.xml deleted file mode 100644 index f2b8f44..0000000 --- a/legacyworlds-server/legacyworlds-server-main/data/techs-test.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/data/techs.xml b/legacyworlds-server/legacyworlds-server-main/data/techs.xml index aef6fc6..c15f5da 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/techs.xml +++ b/legacyworlds-server/legacyworlds-server-main/data/techs.xml @@ -1,23 +1,27 @@ + xsi:schemaLocation="http://www.deepclone.com/lw/b6/m1/techs techs-m2.xsd"> - - - - - + + - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/data/techs.xsd b/legacyworlds-server/legacyworlds-server-main/data/techs.xsd index 84698c3..cab088c 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/techs.xsd +++ b/legacyworlds-server/legacyworlds-server-main/data/techs.xsd @@ -5,24 +5,30 @@ - + + - - - - + - + + + + + + + + + \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/data/text/buildings.xml b/legacyworlds-server/legacyworlds-server-main/data/text/buildings.xml new file mode 100644 index 0000000..81cdcf2 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-main/data/text/buildings.xml @@ -0,0 +1,76 @@ + + + + + + + Ship parts factory + + + A Ship parts factory is a mass production factory for the creation of components used in your space faring vessels. They are essential to any space empire; Properly managed factories produce new vehicles quickly and efficiently. + + + Defence turret + + + Exploration without vigilance is the action of a fool. Turrets are the last line of defence for the planet, super massive weapons capable of destroying orbital vehicles from the ground. They can be placed anywhere, on any building or vacant land in your domain and will defend your planets from attack. + + + Generic assembly line + + + Factories are the backbone of a thriving economy, providing goods and matériel to buy and sell on the free market. Your brand new Generic assembly lines will enhance your wealth and keep the population employed. Properly managed factories produce many economic benefits for an empire. + + + Reanimation centre + + + People are frail but cheap and robots are hard wearing but expensive. Renew the life of your workers and you can take advantage of a cheap zombie resource, giving you a third option for keeping your empire thriving. + + + Biological turret + + + The perfect union of man and machine, Biological Turrets are a blending of the technological and the biological to provide the ultimate defence for your planets. More powerful and accurate than Turrets, in ground based defence they are unmatched. Keep your people away from them, however, as they tend to hunger for human flesh. + + + + + + + + + Fabrique de pièces de vaisseaux + + + Une fabrique de pièces de vaisseaux est une usine de production de masse pour la création des composants utilisés dans vos vaisseaux spatiaux. Elles sont essentielles à tout empire spatial ; bien gérées, elles produisent de nouveaux vaisseaux rapidement et efficacement. + + + Tourelle défensive + + + Explorer sans être sur ses gardes est une statégie de lunatique. Les tourelles défensives sont la dernière ligne de défense d'une planète, énormes armes capables de détruire des véhicules en orbite depuis le sol. Elles peuvent être placées n'importe où, sur n'importe quel bâtiment ou espace dégagé de votre domaine, et défendront vos planètes contre les attaques. + + + Ligne de production générique + + + Les usines sont l'épine dorsale d'une économie florissante, fournissant des biens et pièces détachées qui peuvent être vendues sur le marché. Vos Lignes de production génériques flambant neuves vont augmenter votre richesse et conserver votre population dans l'emploi. Des usines bien gérées fournissent de nombreux bénéfices économiques à un empire. + + + Centre de réanimation + + + Les humains sont frêles mais peu coûteux et les robots sont endurants mais très chers. Renouvelez la vie de vos travailleurs et vous pourrez tirer partie d'une ressource de zombies bon marché, vous permettant d'explorer une troisième voie pour conserver un empire florissant. + + + Tourelle biologique + + + L'union parfaite de l'homme et de la machine, les tourelles biologiques sont un mélange du technologique et du biologique pour fournir la défense ultime à vos planètes. Plus puissantes et précises que les tourelles, au niveau défense au sol, elles ne peuvent être surclassées. Mais gardez votre population à distance, car elles ont tendance à avoir faim de chair humaine! + + + + + \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/data/text/mail.xml b/legacyworlds-server/legacyworlds-server-main/data/text/mail.xml new file mode 100644 index 0000000..ecd50f4 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/data/addressChangeMail-en.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/addressChangeMail-en.txt similarity index 82% rename from legacyworlds-server/legacyworlds-server-main/data/addressChangeMail-en.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/addressChangeMail-en.txt index 9dfc314..e424137 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/addressChangeMail-en.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/addressChangeMail-en.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Address change +Legacy Worlds (B6M2) - Address change Hello, You are receiving this message because an user of Legacy Worlds (you, presumably) requested to change his or her address to ${address}. diff --git a/legacyworlds-server/legacyworlds-server-main/data/addressChangeMail-fr.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/addressChangeMail-fr.txt similarity index 83% rename from legacyworlds-server/legacyworlds-server-main/data/addressChangeMail-fr.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/addressChangeMail-fr.txt index 569a8e9..04d7c49 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/addressChangeMail-fr.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/addressChangeMail-fr.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Changement d'adresse +Legacy Worlds (B6M2) - Changement d'adresse Bonjour, Vous avez reçu ce message car un utilisateur de Legacy Worlds (vous, probablement) a demandé à ce que son adresse soit changée pour ${address}. diff --git a/legacyworlds-server/legacyworlds-server-main/data/adminErrorMail.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/adminErrorMail.txt similarity index 76% rename from legacyworlds-server/legacyworlds-server-main/data/adminErrorMail.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/adminErrorMail.txt index f577aa2..b2e0240 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/adminErrorMail.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/adminErrorMail.txt @@ -1,4 +1,4 @@ -[LWB6-ADMIN] Server errors +[LWB6M2-ADMIN] Server errors Errors have been found in the server's system log. Intervention might be required. ${contents} diff --git a/legacyworlds-server/legacyworlds-server-main/data/adminRecapMail.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/adminRecapMail.txt similarity index 73% rename from legacyworlds-server/legacyworlds-server-main/data/adminRecapMail.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/adminRecapMail.txt index 3d90b25..95a9335 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/adminRecapMail.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/adminRecapMail.txt @@ -1,4 +1,4 @@ -[LWB6-ADMIN] Recap +[LWB6M2-ADMIN] Recap Here's what happened in the past 12 hours... ${contents} diff --git a/legacyworlds-server/legacyworlds-server-main/data/banLiftedMail-en.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/banLiftedMail-en.txt similarity index 79% rename from legacyworlds-server/legacyworlds-server-main/data/banLiftedMail-en.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/banLiftedMail-en.txt index 39ceb1d..edf84f9 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/banLiftedMail-en.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/banLiftedMail-en.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Ban lifted +Legacy Worlds (B6M2) - Ban lifted Hello, The ban on your account has been lifted. diff --git a/legacyworlds-server/legacyworlds-server-main/data/banLiftedMail-fr.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/banLiftedMail-fr.txt similarity index 77% rename from legacyworlds-server/legacyworlds-server-main/data/banLiftedMail-fr.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/banLiftedMail-fr.txt index 95b003f..7f43675 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/banLiftedMail-fr.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/banLiftedMail-fr.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Bannissement levé +Legacy Worlds (B6M2) - Bannissement levé Bonjour, Le bannissement de votre compte a été levé. diff --git a/legacyworlds-server/legacyworlds-server-main/data/bannedMail-en.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/bannedMail-en.txt similarity index 88% rename from legacyworlds-server/legacyworlds-server-main/data/bannedMail-en.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/bannedMail-en.txt index c546f78..2b344b8 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/bannedMail-en.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/bannedMail-en.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) account banned +Legacy Worlds (B6M2) account banned Hello, Your Legacy Worlds account has been banned by the game's administrators for the following reason: diff --git a/legacyworlds-server/legacyworlds-server-main/data/bannedMail-fr.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/bannedMail-fr.txt similarity index 90% rename from legacyworlds-server/legacyworlds-server-main/data/bannedMail-fr.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/bannedMail-fr.txt index a2fb65e..0576f6a 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/bannedMail-fr.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/bannedMail-fr.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Compte banni +Legacy Worlds (B6M2) - Compte banni Bonjour, Votre compte Legacy Worlds a été banni par les administrateurs du jeu pour la raison suivante : diff --git a/legacyworlds-server/legacyworlds-server-main/data/inactivityQuitMail-en.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/inactivityQuitMail-en.txt similarity index 88% rename from legacyworlds-server/legacyworlds-server-main/data/inactivityQuitMail-en.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/inactivityQuitMail-en.txt index d628f44..7b382c9 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/inactivityQuitMail-en.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/inactivityQuitMail-en.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Inactive account closed +Legacy Worlds (B6M2) - Inactive account closed Hello, This email is being sent to inform you that your account on Legacy Worlds has been disabled. It had been inactive for 28 days. diff --git a/legacyworlds-server/legacyworlds-server-main/data/inactivityQuitMail-fr.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/inactivityQuitMail-fr.txt similarity index 88% rename from legacyworlds-server/legacyworlds-server-main/data/inactivityQuitMail-fr.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/inactivityQuitMail-fr.txt index 7441c8b..94c0496 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/inactivityQuitMail-fr.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/inactivityQuitMail-fr.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Fermeture de compte inactif +Legacy Worlds (B6M2) - Fermeture de compte inactif Bonjour, Ce message vous a été envoyé pour vous prévenir que votre compte sur Legacy Worlds a été désactivé. Il a été inactif pendant 28 jours. diff --git a/legacyworlds-server/legacyworlds-server-main/data/inactivityWarningMail-en.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/inactivityWarningMail-en.txt similarity index 89% rename from legacyworlds-server/legacyworlds-server-main/data/inactivityWarningMail-en.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/inactivityWarningMail-en.txt index add97f3..b0f02fc 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/inactivityWarningMail-en.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/inactivityWarningMail-en.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Inactivity +Legacy Worlds (B6M2) - Inactivity Hello, This email is being sent to warn you that your account on Legacy Worlds has been inactive for the past three weeks. Unless you connect in the coming week, it will be closed and your empire will be lost. diff --git a/legacyworlds-server/legacyworlds-server-main/data/inactivityWarningMail-fr.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/inactivityWarningMail-fr.txt similarity index 91% rename from legacyworlds-server/legacyworlds-server-main/data/inactivityWarningMail-fr.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/inactivityWarningMail-fr.txt index d2e8f27..088cb4c 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/inactivityWarningMail-fr.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/inactivityWarningMail-fr.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Inactivité +Legacy Worlds (B6M2) - Inactivité Bonjour, Ce message vous a été envoyé pour vous prévenir que votre compte sur Legacy Worlds a été inactif pendant les trois dernières semaines. À moins que vous vous connectiez durant la semaine procahine, il sera fermé et votre empire sera perdu. diff --git a/legacyworlds-server/legacyworlds-server-main/data/messageMail-en.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/messageMail-en.txt similarity index 82% rename from legacyworlds-server/legacyworlds-server-main/data/messageMail-en.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/messageMail-en.txt index 299b5c3..7550d66 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/messageMail-en.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/messageMail-en.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - New messages +Legacy Worlds (B6M2) - New messages Hello ${empire}, You have just received new messages in Legacy Worlds. diff --git a/legacyworlds-server/legacyworlds-server-main/data/messageMail-fr.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/messageMail-fr.txt similarity index 77% rename from legacyworlds-server/legacyworlds-server-main/data/messageMail-fr.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/messageMail-fr.txt index d31af22..a7e81d7 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/messageMail-fr.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/messageMail-fr.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Nouveaux messages +Legacy Worlds (B6M2) - Nouveaux messages Bonjour ${empire}, Vous venez de recevoir de nouveaux messages sur Legacy Worlds! diff --git a/legacyworlds-server/legacyworlds-server-main/data/passwordRecoveryMail-en.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/passwordRecoveryMail-en.txt similarity index 92% rename from legacyworlds-server/legacyworlds-server-main/data/passwordRecoveryMail-en.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/passwordRecoveryMail-en.txt index d7cf79b..c3508e2 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/passwordRecoveryMail-en.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/passwordRecoveryMail-en.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) password recovery +Legacy Worlds (B6M2) password recovery Hello, You are receiving this message because an user of Legacy Worlds (you, presumably) requested to recover his password. diff --git a/legacyworlds-server/legacyworlds-server-main/data/passwordRecoveryMail-fr.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/passwordRecoveryMail-fr.txt similarity index 91% rename from legacyworlds-server/legacyworlds-server-main/data/passwordRecoveryMail-fr.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/passwordRecoveryMail-fr.txt index 94bc15e..a9bc10c 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/passwordRecoveryMail-fr.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/passwordRecoveryMail-fr.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Récupération de mot de passe +Legacy Worlds (B6M2) - Récupération de mot de passe Bonjour, Vous avez reçu ce message car un utilisateur de Legacy Worlds (vous, probablement) a demandé à récupérer son mot de passe oublié. diff --git a/legacyworlds-server/legacyworlds-server-main/data/quitMail-en.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/quitMail-en.txt similarity index 91% rename from legacyworlds-server/legacyworlds-server-main/data/quitMail-en.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/quitMail-en.txt index 8f379e7..032eb95 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/quitMail-en.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/quitMail-en.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Account closed +Legacy Worlds (B6M2) - Account closed Hello, This email is being sent to confirm that your account has been closed as you requested. diff --git a/legacyworlds-server/legacyworlds-server-main/data/quitMail-fr.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/quitMail-fr.txt similarity index 85% rename from legacyworlds-server/legacyworlds-server-main/data/quitMail-fr.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/quitMail-fr.txt index 2788e38..c293f47 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/quitMail-fr.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/quitMail-fr.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Compte désactivé +Legacy Worlds (B6M2) - Compte désactivé Bonjour, Cet e-mail vous est envoyé pour confirmer que votre compte a été fermé à votre demande. diff --git a/legacyworlds-server/legacyworlds-server-main/data/reactivationMail-en.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/reactivationMail-en.txt similarity index 85% rename from legacyworlds-server/legacyworlds-server-main/data/reactivationMail-en.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/reactivationMail-en.txt index c0176e0..cc79827 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/reactivationMail-en.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/reactivationMail-en.txt @@ -1,8 +1,8 @@ -Legacy Worlds (B6M1) - Account reactivation +Legacy Worlds (B6M2) - Account reactivation Hello, Thank you for revisiting at Legacy Worlds! -Please note that you reactivated your account for "Beta 6 Milestone 1", a highly experimental, in-progress rewrite of the game. As this game does not include forums at this stage, you might want to register to Legacy Worlds Beta 5 to keep up with the game's news. +Please note that you reactivated your account for "Beta 6 Milestone 2", a highly experimental, in-progress rewrite of the game. As this game does not include forums at this stage, you might want to register to Legacy Worlds Beta 5 to keep up with the game's news. Before we reactivate your account, there's just one more step to complete your request. You have to connect to the site using your e-mail address and password, then validate your account reactivation using the confirmation code below. diff --git a/legacyworlds-server/legacyworlds-server-main/data/reactivationMail-fr.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/reactivationMail-fr.txt similarity index 87% rename from legacyworlds-server/legacyworlds-server-main/data/reactivationMail-fr.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/reactivationMail-fr.txt index 3a97e3c..62f3800 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/reactivationMail-fr.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/reactivationMail-fr.txt @@ -1,8 +1,8 @@ -Legacy Worlds (B6M1) - Réactivation de votre compte +Legacy Worlds (B6M2) - Réactivation de votre compte Bonjour, Merci de revenir sur Legacy Worlds! -Veuillez remarquer que vous venez de réactiver un compte sur le jeu "Beta 6 Milestone 1", une récriture en cours et par conséquent hautement expérimentale du jeu. Comme cette version ne dispose pas de forums à l'heure actuelle, nous vous suggérons de vous enregistrer également à Legacy Worlds Beta 5 afin de vous tenir au courant des dernières nouvelles. +Veuillez remarquer que vous venez de réactiver un compte sur le jeu "Beta 6 Milestone 2", une récriture en cours et par conséquent hautement expérimentale du jeu. Comme cette version ne dispose pas de forums à l'heure actuelle, nous vous suggérons de vous enregistrer également à Legacy Worlds Beta 5 afin de vous tenir au courant des dernières nouvelles. Avant que nous réactivions votre compte, il vous reste une dernière étape à accomplir. Vous allez devoir vous connecter au site en utilisant votre adresse électronique et votre mot de passe, puis valider la réactivation de votre compte en saisissant le code de confirmation ci-dessous. diff --git a/legacyworlds-server/legacyworlds-server-main/data/recapMail-en.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/recapMail-en.txt similarity index 77% rename from legacyworlds-server/legacyworlds-server-main/data/recapMail-en.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/recapMail-en.txt index c72810f..3b5f756 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/recapMail-en.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/recapMail-en.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Today's messages +Legacy Worlds (B6M2) - Today's messages Hello ${empire}, Here is a reminder of the messages you received today. diff --git a/legacyworlds-server/legacyworlds-server-main/data/recapMail-fr.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/recapMail-fr.txt similarity index 72% rename from legacyworlds-server/legacyworlds-server-main/data/recapMail-fr.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/recapMail-fr.txt index 641f2d7..517d5a0 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/recapMail-fr.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/recapMail-fr.txt @@ -1,4 +1,4 @@ -Legacy Worlds (B6M1) - Messages du jour +Legacy Worlds (B6M2) - Messages du jour Bonjour ${empire}, Voici un récapitulatif des messages que vous avez reçu aujourd'hui. diff --git a/legacyworlds-server/legacyworlds-server-main/data/registrationMail-en.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/registrationMail-en.txt similarity index 86% rename from legacyworlds-server/legacyworlds-server-main/data/registrationMail-en.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/registrationMail-en.txt index e91d215..4193dee 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/registrationMail-en.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/registrationMail-en.txt @@ -1,8 +1,8 @@ -Legacy Worlds (B6M1) - Your account +Legacy Worlds (B6M2) - Your account Hello, Thank you for registering at Legacy Worlds! -Please note that you registered to "Beta 6 Milestone 1", a highly experimental, in-progress rewrite of the game. As this game does not include forums at this stage, you might want to register to Legacy Worlds Beta 5 to keep up with the game's news. +Please note that you registered to "Beta 6 Milestone 2", a highly experimental, in-progress rewrite of the game. As this game does not include forums at this stage, you might want to register to Legacy Worlds Beta 5 to keep up with the game's news. Before we activate your account, there's just one more step to complete your registration. You have to connect to the site using the e-mail address and password you chose, then validate your account using the confirmation code below. diff --git a/legacyworlds-server/legacyworlds-server-main/data/registrationMail-fr.txt b/legacyworlds-server/legacyworlds-server-main/data/text/mail/registrationMail-fr.txt similarity index 88% rename from legacyworlds-server/legacyworlds-server-main/data/registrationMail-fr.txt rename to legacyworlds-server/legacyworlds-server-main/data/text/mail/registrationMail-fr.txt index a6bc7bf..4cd8f80 100644 --- a/legacyworlds-server/legacyworlds-server-main/data/registrationMail-fr.txt +++ b/legacyworlds-server/legacyworlds-server-main/data/text/mail/registrationMail-fr.txt @@ -1,8 +1,8 @@ -Legacy Worlds (B6M1) - Votre compte +Legacy Worlds (B6M2) - Votre compte Bonjour, Merci de vous être enregistré(e) sur Legacy Worlds! -Veuillez remarquer que vous venez de créer un compte sur le jeu "Beta 6 Milestone 1", une récriture en cours et par conséquent hautement expérimentale du jeu. Comme cette version ne dispose pas de forums à l'heure actuelle, nous vous suggérons de vous enregistrer également à Legacy Worlds Beta 5 afin de vous tenir au courant des dernières nouvelles. +Veuillez remarquer que vous venez de créer un compte sur le jeu "Beta 6 Milestone 2", une récriture en cours et par conséquent hautement expérimentale du jeu. Comme cette version ne dispose pas de forums à l'heure actuelle, nous vous suggérons de vous enregistrer également à Legacy Worlds Beta 5 afin de vous tenir au courant des dernières nouvelles. Avant que nous activions votre compte, il vous reste une dernière étape à accomplir. Vous allez devoir vous connecter au site en utilisant l'adresse électronique et le mot de passe que vous avez choisi, puis valider votre compte en saisissant le code de confirmation ci-dessous. diff --git a/legacyworlds-server/legacyworlds-server-main/data/text/preferences.xml b/legacyworlds-server/legacyworlds-server-main/data/text/preferences.xml new file mode 100644 index 0000000..ad6e43e --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-main/data/text/preferences.xml @@ -0,0 +1,130 @@ + + + + + + + Display preferences + + + Real-life time + + + Selecting this option will cause all durations to be displayed using real-life minutes. + + + Map defaults + + + Map centre (X) + + + The abscissa of the default map centre. + + + Map centre (Y) + + + The ordinates of the default map centre. + + + Map size + + + The default size of the map. + + + E-mail settings + + + Private messages + + + Select the type of e-mail notifications you will get for private messages sent by other empires. + + + Alliance messages + + + Select the type of e-mail notifications you will get for alliance-wise messages. + + + Internal messages + + + Select the type of e-mail notifications you will get for internal game messages. + + + Messages from administrators + + + Select the type of e-mail notifications you will get for messages sent by the game's administrators. + + + + + + + + + Préférences d'affichage + + + Temps réel + + + Les durées seront affichées en utilisant de "vraies" mesures si cette option est sélectionnée. + + + Carte + + + Centre de la carte (X) + + + L'abscisse par défaut du centre de la carte. + + + Centre de la carte (Y) + + + L'ordonnée par défaut du centre de la carte. + + + Taille de la carte + + + La taille par défaut de la carte. + + + Envoi de courrier électronique + + + Messages privés + + + Sélectionnez le type de notifications par courier électronique que vous recevrez lorsque d'autres empires vous envoient des messages privés. + + + Messages d'alliance + + + Sélectionnez le type de notifications par courier électronique que vous recevrez lorsque vous recevez un message d'alliance. + + + Messages internes + + + Sélectionnez le type de notifications par courier électronique que vous recevrez lorsque vous recevez un message interne du jeu. + + + Messages des administrateurs + + + Sélectionnez le type de notifications par courier électronique que vous recevrez lorsque vous recevez un message des administrateurs du jeu. + + + + + \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/data/text/technologies.xml b/legacyworlds-server/legacyworlds-server-main/data/text/technologies.xml new file mode 100644 index 0000000..6285c28 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-main/data/text/technologies.xml @@ -0,0 +1,118 @@ + + + + + + + Civilian technologies + + + They're not just your slaves, they're your scientists, poets and workers. Make the poets work first, then use these technologies to increase their productivity! Useless poets. + + + + Universal assemblers + + + You know how it is when you have a thingy-bob that you need to build but you just don't have the right tool. Well, fear no more, Universal Assemblers will solve all your problems! Build anything and everything with these clever machines, they are 1337. + + + Corpse reanimation + + + Tired of workers dying too early? Want a little less perspiration in your corporation? Zombies will work, won't complain and best of all, they can be fed on almost anything! Feed them your enemies! But mostly, use them to increase factory productivity by a rather nice amount. + + + Biological generators + + + For every turret a military commander wants, there is a bigger, stronger turret he wants more. Now you too can have such a turret! It will defend your planet with ease while you venture out into the galaxy, bending it to your will. Available in all good hardware stores. + + + + Military technologies + + + It is only one who is thoroughly acquainted with the evils of war that can thoroughly understand the profitable way of carrying it on. - Sun Tzu + + + + Orbital construction + + + Ships built on the ground must endure the stress of atmospheric flight before they are even able to dominate the vast emptiness of space. Build them in space and they will be sleeker, more powerful and now free of the need for windows. Use your brand new Cruisers to dominate the known universe. + + + Structural reinforcement + + + The power of your Cruisers can be augmented by an improved design! Take advantage of a more structurally sound space vehicle that can bring empires to their knees with its speed and technological grace. + + + Automated space docks + + + Technology has advanced. The ultimate weapon is now available. Claim the awesome power of the Dreadnought and crush your enemies. Ever wanted a tank in space? Well, now you have it. All their base are belong to you. + + + + + + + + + Technologies civiles + + + Ce ne sont pas uniquement vos esclaves, ce sont vos chercheurs, poètes et ouvriers. Faites travailler d'abord les poètes, puis utilisez ces technologies pour augmenter leur productivité! Poètes inutiles... + + + + Assembleurs universels + + + Vous savez ce que c'est d'avoir un truc à construire, alors que malheureusement vous ne diposez pas du bon outil. Eh bien, plus de peur : les Assembleurs Universels vont résoudre tous vos problèmes! Construisez tout et n'importe quoi avec ces machines intelligentes, elles sont 1337. + + + Réanimation de cadavres + + + Fatigué de ces ouvriers qui passent l'arme à gauche trop tôt? Vous voulez un peu plus de transpiration dans vos ateliers ? Les zombies vont travailler, ne vont pas se plaindre, et encore mieux ils peuvent être nourris avec n'importe quoi - y compris avec vos énemis! Mais surtout, utilisez les pour augmenter de manière significative la productivité de vos usines. + + + Générateurs biologiques + + + Pour chaque tourelle qu'un commandant militaire réclame, il en est une qu'il désire encore plus. Maintenant, vous aussi pouvez avoir de telles tourelles! Elles défendront vos planètes avec aisance, pendant que vous vous aventurerez dans la galaxie, la pliant à votre volonté. Disponible chez tous les bons quincaillers. + + + + Technologies militaires + + + Ceux qui ne comprennent pas les dommages que la guerre peut causer n'en comprendront jamais les avantages. - Sun Tzu + + + + Construction orbitale + + + Les vaisseaux construits à la surface doivent subir le stress du vol atmosphérique avant même d'être lancés à assaut du grand vide interstellaire. Construisez-les dans l'espace et ils seront plus gracieux, plus puissants, et ne nécessiteront plus de fenêtres. Utilisez vos tout nouveaux croiseurs pour dominer l'univers connu. + + + Consolidation structurelle + + + La puissance de vos croiseurs peut être augmentée par une conception améliorée! Profitez d'un véhicule à la structure mieux adaptée à l'espace qui peut mettre des empires à genoux grâce à sa vitesse et sa finesse technologique. + + + Docks orbitaux automatisés + + + La technologie a évolué. L'arme ultime est maintenant disponible. Revendiquez la puissance écrasante du cuirassé et pulvérisez vos opposants. Déjà rêvé d'un tank de l'espace ? Eh bien, maintenant, vous l'avez. All their base are belong to you. + + + + + \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/hibernate.xml b/legacyworlds-server/legacyworlds-server-main/hibernate.xml deleted file mode 100644 index 03001ba..0000000 --- a/legacyworlds-server/legacyworlds-server-main/hibernate.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - org.hibernate.dialect.HSQLDialect - 0 - true - true - - - - - diff --git a/legacyworlds-server/legacyworlds-server-main/pom.xml b/legacyworlds-server/legacyworlds-server-main/pom.xml index 6774468..fd89151 100644 --- a/legacyworlds-server/legacyworlds-server-main/pom.xml +++ b/legacyworlds-server/legacyworlds-server-main/pom.xml @@ -4,12 +4,12 @@ legacyworlds-server com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-main - 5.99.1 + 5.99.2 Legacy Worlds server Server main classes and JAR builder. @@ -29,6 +29,11 @@ com.deepclone.lw ${project.version} + + legacyworlds-server-beans-events + com.deepclone.lw + ${project.version} + legacyworlds-server-beans-i18n com.deepclone.lw @@ -54,6 +59,16 @@ com.deepclone.lw ${project.version} + + legacyworlds-server-beans-techs + com.deepclone.lw + ${project.version} + + + legacyworlds-server-beans-updates + com.deepclone.lw + ${project.version} + legacyworlds-server-beans-user com.deepclone.lw diff --git a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/ImportBuildables.java b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/ImportBuildables.java index ab27ed1..863cd28 100644 --- a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/ImportBuildables.java +++ b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/ImportBuildables.java @@ -52,7 +52,7 @@ public class ImportBuildables public CostData cost; - public TechData tech; + public String tech; } @SuppressWarnings( "serial" ) @@ -70,18 +70,6 @@ public class ImportBuildables public int work; } - @SuppressWarnings( "serial" ) - @XStreamAlias( "tech" ) - public static class TechData - implements Serializable - { - @XStreamAsAttribute - public String name; - - @XStreamAsAttribute - public int level; - } - @SuppressWarnings( "serial" ) @XStreamAlias( "building" ) public static class BuildingData @@ -196,7 +184,6 @@ public class ImportBuildables this.uocBuildingDep.addParameter( "output_type" , "building_output_type" ); this.uocBuildingDep.addParameter( "output" , Types.INTEGER ); this.uocBuildingDep.addParameter( "dep_name" , Types.VARCHAR ); - this.uocBuildingDep.addParameter( "dep_level" , Types.INTEGER ); this.uocShipNoDep = new StoredProc( dataSource , "tech" , "uoc_ship" ); this.uocShipNoDep.addParameter( "name" , Types.VARCHAR ); @@ -216,7 +203,6 @@ public class ImportBuildables this.uocShipDep.addParameter( "power" , Types.INTEGER ); this.uocShipDep.addParameter( "flight_time" , Types.INTEGER ); this.uocShipDep.addParameter( "dep_name" , Types.VARCHAR ); - this.uocShipDep.addParameter( "dep_level" , Types.INTEGER ); } @@ -241,7 +227,7 @@ public class ImportBuildables ship.cost.upkeep , ship.power , ship.time ); } else { this.uocShipDep.execute( ship.name , ship.description , ship.cost.build , ship.cost.work , - ship.cost.upkeep , ship.power , ship.time , ship.tech.name , ship.tech.level ); + ship.cost.upkeep , ship.power , ship.time , ship.tech ); } } @@ -256,7 +242,7 @@ public class ImportBuildables } else { this.uocBuildingDep.execute( building.name , building.description , building.cost.build , building.cost.work , building.cost.upkeep , building.workers , building.type.toString( ) , - building.output , building.tech.name , building.tech.level ); + building.output , building.tech ); } } diff --git a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/ImportTechs.java b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/ImportTechs.java index cd15b30..a6b944e 100644 --- a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/ImportTechs.java +++ b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/ImportTechs.java @@ -31,17 +31,26 @@ public class ImportTechs private final Logger logger = Logger.getLogger( ImportTechs.class ); + private static class ImportError + extends RuntimeException + { + private static final long serialVersionUID = 1L; + } + @XStreamAlias( "technologies" ) @SuppressWarnings( "serial" ) - public static class Techs + public static class Technologies implements Serializable { - @XStreamImplicit( itemFieldName = "tech-line" ) - public List< TechLine > lines; + @XStreamImplicit( itemFieldName = "category" ) + public List< Category > categories; + + @XStreamImplicit( itemFieldName = "technology" ) + public List< Technology > technologies; } @SuppressWarnings( "serial" ) - public static class TechLine + public static class Category implements Serializable { @XStreamAsAttribute @@ -49,18 +58,18 @@ public class ImportTechs @XStreamAsAttribute public String description; - - @XStreamImplicit( itemFieldName = "level" ) - public List< TechLevel > levels; } @SuppressWarnings( "serial" ) - public static class TechLevel + public static class Technology implements Serializable { @XStreamAsAttribute public String name; + @XStreamAsAttribute + public String category; + @XStreamAsAttribute public String description; @@ -69,23 +78,57 @@ public class ImportTechs @XStreamAsAttribute public int cost; + + @XStreamImplicit( itemFieldName = "depends" ) + public List< Dependency > dependencies; } + @SuppressWarnings( "serial" ) + public static class Dependency + implements Serializable + { + @XStreamAlias( "on" ) + @XStreamAsAttribute + public String dependsOn; + } + + /** The file from which technology definitions will be loaded */ private File file; + + /** The transaction template used to execute the import transaction */ private TransactionTemplate tTemplate; - private StoredProc uocLine; - private StoredProc uocLevel; + + /** Wrapper for the stored procedure which updates or creates technology categories */ + private StoredProc uocCategory; + + /** Wrapper for the stored procedure which updates or creates technology definitions */ + private StoredProc uocTechnology; + + /** Wrapper for the stored procedure which adds a dependency to a technology */ + private StoredProc addDependency; + /** + * Initialise an XStream instance using the annotations on the {@link Technologies} class and + * its various component classes. + * + * @return the initialised XStream instance + */ private XStream initXStream( ) { XStream xstream = new XStream( ); - xstream.processAnnotations( Techs.class ); + xstream.processAnnotations( Technologies.class ); return xstream; } - private Techs loadData( ) + /** + * Load technology definitions from an XML data file, deserialising it as a {@link Technologies} + * instance through XStream. + * + * @return the technology definition instance or null if an error occurs. + */ + private Technologies loadData( ) { FileInputStream fis; try { @@ -96,7 +139,7 @@ public class ImportTechs try { XStream xstream = this.initXStream( ); - return (Techs) xstream.fromXML( fis ); + return (Technologies) xstream.fromXML( fis ); } catch ( Exception e ) { e.printStackTrace( ); return null; @@ -110,9 +153,15 @@ public class ImportTechs } + /** + * Create a basic Spring context containing the components that may be used to connect to the + * database. + * + * @return the initialised Spring context + */ private ClassPathXmlApplicationContext createContext( ) { - // Load data source and Hibernate properties + // Load data source properties String[] dataConfig = { this.getDataSource( ) }; @@ -127,44 +176,159 @@ public class ImportTechs } + /** + * Create the {@link #tTemplate} transaction template from the transaction manager in the + * context. In addition, initialise stored procedure wrappers {@link #uocCategory}, + * {@link #uocTechnology}. + * + * @param ctx + * the Spring context + */ private void getBeans( ApplicationContext ctx ) { PlatformTransactionManager tManager = ctx.getBean( PlatformTransactionManager.class ); this.tTemplate = new TransactionTemplate( tManager ); DataSource dataSource = ctx.getBean( DataSource.class ); - this.uocLine = new StoredProc( dataSource , "tech" , "uoc_line" ); - this.uocLine.addParameter( "tln" , Types.VARCHAR ); - this.uocLine.addParameter( "tld" , Types.VARCHAR ); - this.uocLevel = new StoredProc( dataSource , "tech" , "uoc_level" ); - this.uocLevel.addParameter( "tech_line" , Types.VARCHAR ); - this.uocLevel.addParameter( "level" , Types.INTEGER ); - this.uocLevel.addParameter( "name" , Types.VARCHAR ); - this.uocLevel.addParameter( "desc" , Types.VARCHAR ); - this.uocLevel.addParameter( "points" , Types.INTEGER ); - this.uocLevel.addParameter( "cost" , Types.INTEGER ); + this.uocCategory = new StoredProc( dataSource , "tech" , "uoc_category" ); + this.uocCategory.addOutput( "rv" , Types.INTEGER ); + this.uocCategory.addParameter( "cat_name" , Types.VARCHAR ); + this.uocCategory.addParameter( "cat_desc" , Types.VARCHAR ); + + this.uocTechnology = new StoredProc( dataSource , "tech" , "uoc_technology" ); + this.uocTechnology.addOutput( "rv" , Types.INTEGER ); + this.uocTechnology.addParameter( "nt_name" , Types.VARCHAR ); + this.uocTechnology.addParameter( "nt_cat" , Types.VARCHAR ); + this.uocTechnology.addParameter( "nt_desc" , Types.VARCHAR ); + this.uocTechnology.addParameter( "nt_points" , Types.INTEGER ); + this.uocTechnology.addParameter( "nt_cost" , Types.INTEGER ); + + this.addDependency = new StoredProc( dataSource , "tech" , "add_dependency" ); + this.addDependency.addOutput( "rv" , Types.INTEGER ); + this.addDependency.addParameter( "nd_name" , Types.VARCHAR ); + this.addDependency.addParameter( "nd_dep" , Types.VARCHAR ); } - private void importTechnologies( Techs data ) + /** + * Import the technology data stored as a {@link Technologies} instance. + * + * @param data + * the technology categories and technology definitions to import + * + * @throws ImportError + * if the definitions are erroneous + */ + private void importTechnologies( Technologies data ) { - for ( TechLine line : data.lines ) { - this.uocLine.execute( line.name , line.description ); + this.importCategories( data.categories ); + for ( Technology tech : data.technologies ) { + this.importTechnology( tech ); + } + } - int i = 1; - for ( TechLevel level : line.levels ) { - this.uocLevel.execute( line.name , i , level.name , level.description , level.points , level.cost ); - i++; + + /** + * Import a single technology definition, along with its dependencies. + * + * @param technology + * the technology definition to import + * + * @throws ImportError + * if the definition is incorrect + */ + private void importTechnology( Technology technology ) + { + this.logger.debug( "Importing technology " + technology.name ); + + int result = (Integer) this.uocTechnology.execute( technology.name , technology.category , + technology.description , technology.points , technology.cost ).get( "rv" ); + switch ( result ) { + case 0: + break; + case 1: + this.logger.error( "Technology " + technology.name + ": name string not found" ); + throw new ImportError( ); + case 2: + this.logger.error( "Technology " + technology.name + ": category '" + technology.category + + "' not found" ); + throw new ImportError( ); + case 3: + this.logger.error( "Technology " + technology.name + ": description string '" + technology.description + + "' not found" ); + throw new ImportError( ); + case 4: + this.logger.error( "Technology " + technology.name + ": invalid points and/or cost" ); + throw new ImportError( ); + } + + if ( technology.dependencies == null ) { + return; + } + + for ( Dependency dep : technology.dependencies ) { + result = (Integer) this.addDependency.execute( technology.name , dep.dependsOn ).get( "rv" ); + switch ( result ) { + case 0: + break; + case 1: + this.logger.error( "Technology " + technology.name + ": not found while adding dependency" ); + throw new ImportError( ); + case 2: + this.logger.error( "Technology " + technology.name + ": dependency '" + dep.dependsOn + + "' not found" ); + throw new ImportError( ); + case 3: + this.logger.error( "Technology " + technology.name + ": duplicate dependency '" + dep.dependsOn + + "'" ); + throw new ImportError( ); } } } + /** + * Import the list of categories into the database using the tech.uoc_category stored + * procedure. + * + * @param categories + * the list of categories + * + * @throws ImportError + * if the stored procedure returns a failure code + */ + private void importCategories( List< Category > categories ) + { + for ( Category category : categories ) { + this.logger.debug( "Importing category " + category.name ); + + int result = (Integer) this.uocCategory.execute( category.name , category.description ).get( "rv" ); + switch ( result ) { + case 0: + break; + case 1: + this.logger.error( "Category " + category.name + ": name string not found" ); + throw new ImportError( ); + case 2: + this.logger.error( "Category " + category.name + ": description string '" + category.description + + "' not found" ); + throw new ImportError( ); + } + } + } + + + /** + * Load the technologies and related data from the file specified on the command line, then + * start a database transaction during which categories, technologies and dependencies will be + * created. If anything should go wrong during the import, rollback the transaction. + * + */ @Override public void run( ) { - final Techs data = this.loadData( ); + final Technologies data = this.loadData( ); if ( data == null ) { System.err.println( "could not read data" ); return; @@ -181,8 +345,10 @@ public class ImportTechs try { importTechnologies( data ); rv = true; + } catch ( ImportError e ) { + rv = false; } catch ( RuntimeException e ) { - logger.error( e.getMessage( ) ); + logger.error( "error during import" , e ); rv = false; } if ( !rv ) { @@ -202,6 +368,15 @@ public class ImportTechs } + /** + * Make sure that the command-line parameters of this tool consist in a single file name, that + * the file exists and is readable, setting {@link #file} accordingly. + * + * @param options + * the array of command line parameters + * + * @return true if the parameters are ok, false otherwise. + */ @Override public boolean setOptions( String... options ) { diff --git a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/ImportText.java b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/ImportText.java index c3952ed..c395263 100644 --- a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/ImportText.java +++ b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/ImportText.java @@ -2,8 +2,7 @@ package com.deepclone.lw.cli; import java.io.*; -import java.util.LinkedList; -import java.util.List; +import java.util.Map; import javax.sql.DataSource; @@ -19,10 +18,8 @@ import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.TransactionCallback; import org.springframework.transaction.support.TransactionTemplate; -import com.thoughtworks.xstream.XStream; -import com.thoughtworks.xstream.annotations.XStreamAlias; -import com.thoughtworks.xstream.annotations.XStreamAsAttribute; -import com.thoughtworks.xstream.annotations.XStreamImplicit; +import com.deepclone.lw.cli.i18n.LoadableText; +import com.deepclone.lw.cli.i18n.Loader; @@ -32,125 +29,12 @@ public class ImportText private final Logger logger = Logger.getLogger( ImportText.class ); - @SuppressWarnings( "serial" ) - public abstract static class StringData - implements Serializable - { - @XStreamAsAttribute - public String id; - - - public abstract String getString( ); - } - - @SuppressWarnings( "serial" ) - @XStreamAlias( "inline-string" ) - public static class InlineString - extends StringData - { - public String value; - - - @Override - public String getString( ) - { - return this.value; - } - } - - @SuppressWarnings( "serial" ) - @XStreamAlias( "from-file" ) - public static class FileString - extends StringData - { - @XStreamAsAttribute - public String source; - - - @Override - public String getString( ) - { - StringBuilder sBuilder = new StringBuilder( ); - try { - BufferedReader in = new BufferedReader( new FileReader( source ) ); - String str; - while ( ( str = in.readLine( ) ) != null ) { - sBuilder.append( str ); - sBuilder.append( "\n" ); - } - in.close( ); - } catch ( IOException e ) { - throw new RuntimeException( "Could not read " + source ); - } - - return sBuilder.toString( ); - } - } - - @SuppressWarnings( "serial" ) - public static class LanguageData - implements Serializable - { - @XStreamAsAttribute - public String id; - - @XStreamAsAttribute - public String name; - - @XStreamImplicit - public List< StringData > strings = new LinkedList< StringData >( ); - } - - @SuppressWarnings( "serial" ) - @XStreamAlias( "lw-text-data" ) - public static class TextData - implements Serializable - { - @XStreamImplicit( itemFieldName = "language" ) - public List< LanguageData > languages = new LinkedList< LanguageData >( ); - } - private File file; private TransactionTemplate tTemplate; private SimpleJdbcCall uocTranslation; private SimpleJdbcCall uocLanguage; - private XStream initXStream( ) - { - XStream xstream = new XStream( ); - xstream.processAnnotations( TextData.class ); - xstream.processAnnotations( InlineString.class ); - xstream.processAnnotations( FileString.class ); - return xstream; - } - - - private TextData loadData( ) - { - FileInputStream fis; - try { - fis = new FileInputStream( this.file ); - } catch ( FileNotFoundException e ) { - return null; - } - - try { - XStream xstream = this.initXStream( ); - return (TextData) xstream.fromXML( fis ); - } catch ( Exception e ) { - e.printStackTrace( ); - return null; - } finally { - try { - fis.close( ); - } catch ( IOException e ) { - // EMPTY - } - } - } - - private ClassPathXmlApplicationContext createContext( ) { // Load data source and Hibernate properties @@ -188,26 +72,23 @@ public class ImportText } - private void importText( TextData data ) + private void importText( LoadableText data ) { - for ( LanguageData ld : data.languages ) { - this.importLanguage( ld ); + for ( String lId : data.getLanguages( ) ) { + this.importLanguage( data , lId ); } } - private void importLanguage( LanguageData ld ) + private void importLanguage( LoadableText data , String lId ) { - if ( ld.strings == null ) { - return; - } - // Try creating or updating the language - this.uocLanguage.execute( ld.id , ld.name ); + this.uocLanguage.execute( lId , data.getLanguageName( lId ) ); // Import translations - for ( StringData sd : ld.strings ) { - this.uocTranslation.execute( ld.id , sd.id , sd.getString( ) ); + for ( Map.Entry< String , String > string : data.getStrings( lId ) ) { + System.out.println( "Language " + lId + " string " + string.getKey( ) ); + this.uocTranslation.execute( lId , string.getKey( ) , string.getValue( ) ); } } @@ -215,11 +96,8 @@ public class ImportText @Override public void run( ) { - final TextData data = this.loadData( ); - if ( data == null ) { - System.err.println( "could not read data" ); - return; - } + Loader textLoader = new Loader( this.file ); + final LoadableText data = textLoader.load( ); AbstractApplicationContext ctx = this.createContext( ); this.createTemplates( ctx ); @@ -245,7 +123,7 @@ public class ImportText } ); if ( rv ) { - this.logger.info( "Text import successful" ); + System.out.println( "Text import successful" ); } ToolBase.destroyContext( ctx ); diff --git a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/FileString.java b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/FileString.java new file mode 100644 index 0000000..d75eb08 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/FileString.java @@ -0,0 +1,54 @@ +/** + * + */ +package com.deepclone.lw.cli.i18n; + + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; + + + +@SuppressWarnings( "serial" ) +@XStreamAlias( "from-file" ) +public class FileString + extends StringData +{ + private File sourceFile; + + @XStreamAsAttribute + public String source; + + + @Override + public String getString( ) + { + StringBuilder sBuilder = new StringBuilder( ); + System.out.println( "Loading text from " + this.sourceFile.getAbsolutePath( ) ); + try { + BufferedReader in = new BufferedReader( new FileReader( this.sourceFile ) ); + String str; + while ( ( str = in.readLine( ) ) != null ) { + sBuilder.append( str ); + sBuilder.append( "\n" ); + } + in.close( ); + } catch ( IOException e ) { + throw new RuntimeException( "Could not read " + this.sourceFile.getAbsolutePath( ) ); + } + + return sBuilder.toString( ); + } + + + @Override + public void setLoader( Loader loader ) + { + this.sourceFile = new File( loader.getDirectory( ) , this.source ); + } +} \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/InlineString.java b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/InlineString.java new file mode 100644 index 0000000..4114589 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/InlineString.java @@ -0,0 +1,28 @@ +/** + * + */ +package com.deepclone.lw.cli.i18n; + +import com.thoughtworks.xstream.annotations.XStreamAlias; + +@SuppressWarnings( "serial" ) +@XStreamAlias( "inline-string" ) +public class InlineString + extends StringData +{ + public String value; + + + @Override + public String getString( ) + { + return this.value; + } + + + @Override + public void setLoader( Loader loader ) + { + // EMPTY + } +} \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/LanguageData.java b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/LanguageData.java new file mode 100644 index 0000000..f199bbe --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/LanguageData.java @@ -0,0 +1,36 @@ +/** + * + */ +package com.deepclone.lw.cli.i18n; + + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; + +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; +import com.thoughtworks.xstream.annotations.XStreamImplicit; + + + +@SuppressWarnings( "serial" ) +public class LanguageData + implements Serializable +{ + @XStreamAsAttribute + public String id; + + @XStreamAsAttribute + public String name; + + @XStreamImplicit + public List< StringData > strings = new LinkedList< StringData >( ); + + + public void setLoader( Loader loader ) + { + for ( StringData sd : this.strings ) { + sd.setLoader( loader ); + } + } +} \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/LoadableText.java b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/LoadableText.java new file mode 100644 index 0000000..96655d3 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/LoadableText.java @@ -0,0 +1,73 @@ +package com.deepclone.lw.cli.i18n; + + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + + + +public class LoadableText +{ + + private final Map< String , String > languageNames; + private final Map< String , Map< String , String >> text; + + + public LoadableText( TextData data ) + { + this.languageNames = new HashMap< String , String >( ); + this.text = new HashMap< String , Map< String , String > >( ); + + if ( data.languages == null ) { + return; + } + + for ( LanguageData language : data.languages ) { + this.languageNames.put( language.id , language.name ); + Map< String , String > strings = new HashMap< String , String >( ); + this.text.put( language.id , strings ); + + for ( StringData string : language.strings ) { + strings.put( string.id , string.getString( ) ); + } + } + } + + + public void merge( LoadableText text ) + { + for ( Map.Entry< String , String > entry : text.languageNames.entrySet( ) ) { + Map< String , String > lStrings = this.text.get( entry.getKey( ) ); + if ( lStrings == null ) { + this.languageNames.put( entry.getKey( ) , entry.getValue( ) ); + lStrings = new HashMap< String , String >( ); + this.text.put( entry.getKey( ) , lStrings ); + } + + for ( Map.Entry< String , String > string : text.text.get( entry.getKey( ) ).entrySet( ) ) { + if ( lStrings.put( string.getKey( ) , string.getValue( ) ) != null ) { + throw new RuntimeException( "String '" + string.getKey( ) + "' defined more than once" ); + } + } + } + } + + + public Set< String > getLanguages( ) + { + return this.languageNames.keySet( ); + } + + + public String getLanguageName( String lId ) + { + return this.languageNames.get( lId ); + } + + + public Set< Map.Entry< String , String >> getStrings( String lId ) + { + return this.text.get( lId ).entrySet( ); + } +} diff --git a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/Loader.java b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/Loader.java new file mode 100644 index 0000000..f00f41e --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/Loader.java @@ -0,0 +1,99 @@ +package com.deepclone.lw.cli.i18n; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +import com.thoughtworks.xstream.XStream; + + + +public class Loader +{ + + private final Set< String > included; + private final XStream xstream; + private final File file; + private final String directory; + + + public Loader( File file ) + { + this.included = new HashSet< String >( ); + this.xstream = new XStream( ); + this.xstream.processAnnotations( TextData.class ); + this.xstream.processAnnotations( InlineString.class ); + this.xstream.processAnnotations( FileString.class ); + this.file = file; + this.directory = this.file.getAbsoluteFile( ).getParent( ); + } + + + public Loader( Loader parent , String included ) + { + this.included = parent.included; + this.xstream = parent.xstream; + if ( included.charAt( 0 ) == '/' ) { + this.file = new File( included ); + } else { + this.file = new File( parent.directory , included ); + } + this.directory = this.file.getAbsoluteFile( ).getParent( ); + } + + + public LoadableText load( ) + { + System.out.println( "Loading data file " + this.file.getAbsolutePath( ) ); + + TextData data = this.loadFile( ); + data.setLoader( this ); + + LoadableText result = new LoadableText( data ); + if ( data.includes != null ) { + for ( String file : data.includes ) { + Loader child = new Loader( this , file ); + if ( this.included.contains( child.file.getAbsolutePath( ) ) ) { + continue; + } + this.included.add( child.file.getAbsolutePath( ) ); + result.merge( child.load( ) ); + } + } + + return result; + } + + + private TextData loadFile( ) + { + FileInputStream fis; + try { + fis = new FileInputStream( this.file ); + } catch ( FileNotFoundException e ) { + throw new RuntimeException( e ); + } + + try { + return (TextData) this.xstream.fromXML( fis ); + } catch ( Exception e ) { + throw new RuntimeException( e ); + } finally { + try { + fis.close( ); + } catch ( IOException e ) { + // EMPTY + } + } + } + + + public String getDirectory( ) + { + return this.directory; + } +} diff --git a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/StringData.java b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/StringData.java new file mode 100644 index 0000000..0dac4a5 --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/StringData.java @@ -0,0 +1,25 @@ +/** + * + */ +package com.deepclone.lw.cli.i18n; + + +import java.io.Serializable; + +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; + + + +@SuppressWarnings( "serial" ) +public abstract class StringData + implements Serializable +{ + @XStreamAsAttribute + public String id; + + + public abstract String getString( ); + + + public abstract void setLoader( Loader loader ); +} \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/TextData.java b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/TextData.java new file mode 100644 index 0000000..3a93efc --- /dev/null +++ b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/cli/i18n/TextData.java @@ -0,0 +1,34 @@ +/** + * + */ +package com.deepclone.lw.cli.i18n; + + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; + +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamImplicit; + + + +@SuppressWarnings( "serial" ) +@XStreamAlias( "lw-text-data" ) +public class TextData + implements Serializable +{ + @XStreamImplicit( itemFieldName = "include" ) + public List< String > includes = new LinkedList< String >( ); + + @XStreamImplicit( itemFieldName = "language" ) + public List< LanguageData > languages = new LinkedList< LanguageData >( ); + + + public void setLoader( Loader loader ) + { + for ( LanguageData l : this.languages ) { + l.setLoader( loader ); + } + } +} \ No newline at end of file diff --git a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/srv/Server.java b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/srv/Server.java index f6a41e0..7f91446 100644 --- a/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/srv/Server.java +++ b/legacyworlds-server/legacyworlds-server-main/src/main/java/com/deepclone/lw/srv/Server.java @@ -38,9 +38,10 @@ public class Server builder.setScope( BeanDefinition.SCOPE_SINGLETON ); builder.addPropertyValue( "serviceName" , name ); builder.addPropertyValue( "service" , bean ); - builder.addPropertyValue( "ServiceInterface" , iface.getCanonicalName( ) ); + builder.addPropertyValue( "serviceInterface" , iface.getCanonicalName( ) ); builder.addPropertyValue( "registryPort" , String.valueOf( this.getRmiPort( ) ) ); builder.addPropertyValue( "servicePort" , String.valueOf( sPort ) ); + builder.addPropertyValue( "registryHost" , "localhost" ); ctx.registerBeanDefinition( name , builder.getBeanDefinition( ) ); } @@ -48,17 +49,31 @@ public class Server private AbstractApplicationContext makeRMIContext( ApplicationContext parent ) { GenericApplicationContext context = new GenericApplicationContext( parent ); - this.addRMIService( context , "termSrv" , parent.getBean( "terminator" ) , ServerTerminator.class , this.getTerminationPort( ) ); - this.addRMIService( context , "sessionSrv" , parent.getBean( "sessionManager" ) , SessionManager.class , this.getServicePort( ) ); + this.addRMIRegistry( context ); + this.addRMIService( context , "termSrv" , parent.getBean( "terminator" ) , ServerTerminator.class , this + .getTerminationPort( ) ); + this.addRMIService( context , "sessionSrv" , parent.getBean( "sessionManager" ) , SessionManager.class , this + .getServicePort( ) ); context.refresh( ); return context; } + private void addRMIRegistry( GenericApplicationContext context ) + { + BeanDefinitionBuilder builder; + builder = BeanDefinitionBuilder.rootBeanDefinition( "org.springframework.remoting.rmi.RmiRegistryFactoryBean" ); + builder.setScope( BeanDefinition.SCOPE_SINGLETON ); + builder.addPropertyValue( "port" , String.valueOf( this.getRmiPort( ) ) ); + builder.addPropertyValue( "alwaysCreate" , "true" ); + context.registerBeanDefinition( "rmiRegistry" , builder.getBeanDefinition( ) ); + } + + private ApplicationContext makeDataConfigContext( ) { String[] dSource = { - this.getDataSource( ) , + this.getDataSource( ) , }; FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext( dSource ); ctx.refresh( ); diff --git a/legacyworlds-server/legacyworlds-server-main/src/main/resources/lw-server.xml b/legacyworlds-server/legacyworlds-server-main/src/main/resources/lw-server.xml index 40e41af..96b67dc 100644 --- a/legacyworlds-server/legacyworlds-server-main/src/main/resources/lw-server.xml +++ b/legacyworlds-server/legacyworlds-server-main/src/main/resources/lw-server.xml @@ -22,6 +22,8 @@ + + diff --git a/legacyworlds-server/legacyworlds-server-tests/pom.xml b/legacyworlds-server/legacyworlds-server-tests/pom.xml index ccf4b6b..02965d2 100644 --- a/legacyworlds-server/legacyworlds-server-tests/pom.xml +++ b/legacyworlds-server/legacyworlds-server-tests/pom.xml @@ -4,13 +4,13 @@ legacyworlds-server com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-tests Legacy Worlds server tests - 5.99.1 + 5.99.2 This package regroups all tests for server capabilities. diff --git a/legacyworlds-server/legacyworlds-server-utils/pom.xml b/legacyworlds-server/legacyworlds-server-utils/pom.xml index 492a2e1..989be1b 100644 --- a/legacyworlds-server/legacyworlds-server-utils/pom.xml +++ b/legacyworlds-server/legacyworlds-server-utils/pom.xml @@ -4,12 +4,12 @@ legacyworlds-server com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server-utils - 5.99.1 + 5.99.2 Legacy Worlds server utility classes This package contains utility classes used by various parts of the server-side code. diff --git a/legacyworlds-server/legacyworlds-server-utils/src/main/java/com/deepclone/lw/utils/EmailAddress.java b/legacyworlds-server/legacyworlds-server-utils/src/main/java/com/deepclone/lw/utils/EmailAddress.java index 5f1a169..526ea78 100644 --- a/legacyworlds-server/legacyworlds-server-utils/src/main/java/com/deepclone/lw/utils/EmailAddress.java +++ b/legacyworlds-server/legacyworlds-server-utils/src/main/java/com/deepclone/lw/utils/EmailAddress.java @@ -29,7 +29,7 @@ public class EmailAddress private static final String quotedPair = "(\\\\" + asciiText + ")"; // RFC 2822 3.2.4 Atom: - private static final String atext = "[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]"; + private static final String atext = "[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]"; private static final String dotAtomText = atext + "+" + "(" + "\\." + atext + "+)*"; private static final String dotAtom = fwsp + "(" + dotAtomText + ")" + fwsp; diff --git a/legacyworlds-server/pom.xml b/legacyworlds-server/pom.xml index db8aa26..c00caab 100644 --- a/legacyworlds-server/pom.xml +++ b/legacyworlds-server/pom.xml @@ -4,12 +4,12 @@ legacyworlds com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-server Legacy Worlds server - 5.99.1 + 5.99.2 pom This metapackage is the root of the game server's components' code. diff --git a/legacyworlds-session/pom.xml b/legacyworlds-session/pom.xml index 3ea53f7..941a81d 100644 --- a/legacyworlds-session/pom.xml +++ b/legacyworlds-session/pom.xml @@ -4,12 +4,12 @@ legacyworlds com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-session - 5.99.1 + 5.99.2 Legacy Worlds sessions This module contains the definition of sessions used in client-server communications and all related classes and exceptions. diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/CreateAuthChallengeCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/CreateAuthChallengeCommand.java index 3a6bbef..9cc5a34 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/CreateAuthChallengeCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/CreateAuthChallengeCommand.java @@ -1,11 +1,12 @@ package com.deepclone.lw.cmd; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; public class CreateAuthChallengeCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/CreateAuthChallengeResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/CreateAuthChallengeResponse.java index 1e5ad58..d1d9692 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/CreateAuthChallengeResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/CreateAuthChallengeResponse.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.CommandResponse; @@ -9,7 +10,7 @@ public class CreateAuthChallengeResponse extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String challenge; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/MaintenanceResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/MaintenanceResponse.java index efe9995..abd5a50 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/MaintenanceResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/MaintenanceResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd; import java.sql.Timestamp; import java.util.Date; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.CommandResponse; @@ -12,7 +13,7 @@ public class MaintenanceResponse extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final Timestamp start; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/AdminOverviewCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/AdminOverviewCommand.java index fa340fe..f997300 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/AdminOverviewCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/AdminOverviewCommand.java @@ -1,11 +1,12 @@ package com.deepclone.lw.cmd.admin; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; public class AdminOverviewCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/AdminOverviewResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/AdminOverviewResponse.java index b292818..c7937c9 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/AdminOverviewResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/AdminOverviewResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.admin; import com.deepclone.lw.cmd.admin.adata.AdminOverview; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class AdminOverviewResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final AdminOverview overview; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/AdminResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/AdminResponse.java index 7be1d55..ec411f8 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/AdminResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/AdminResponse.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.admin; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.CommandResponse; @@ -10,7 +11,7 @@ public class AdminResponse extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final Administrator admin; private final boolean privilegeOk; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/NoOperationCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/NoOperationCommand.java index 4765054..bc19cea 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/NoOperationCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/NoOperationCommand.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.admin; import com.deepclone.lw.cmd.admin.adata.Privileges; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -10,7 +11,7 @@ public class NoOperationCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final Privileges requirePrivilege; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/SetPasswordCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/SetPasswordCommand.java index 49eeb2f..baa5056 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/SetPasswordCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/SetPasswordCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class SetPasswordCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String sha1Auth; private final String md5Auth; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/SetPasswordResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/SetPasswordResponse.java index a4a429f..e1bcb86 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/SetPasswordResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/SetPasswordResponse.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.admin; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -9,7 +10,7 @@ public class SetPasswordResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public static enum PasswordChangeStatus { OK , diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/AdminOverview.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/AdminOverview.java index 4eb221b..dabaf57 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/AdminOverview.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/AdminOverview.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.admin.adata; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class AdminOverview implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int id; private long newMessages; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/Administrator.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/Administrator.java index 19c3dbf..91be442 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/Administrator.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/Administrator.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.admin.adata; import java.util.List; +import com.deepclone.lw.session.API; + public class Administrator extends AdministratorBasics { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private String address; private boolean passwordChange; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/AdministratorBasics.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/AdministratorBasics.java index 2f7342b..cb04d79 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/AdministratorBasics.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/AdministratorBasics.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.admin.adata; import java.io.Serializable; import java.util.List; +import com.deepclone.lw.session.API; + public class AdministratorBasics implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int id; private String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/Privileges.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/Privileges.java index 824fb65..412c49f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/Privileges.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/adata/Privileges.java @@ -20,6 +20,7 @@ public enum Privileges { BUGM( 0x00000200 , "Receiving automated error e-mail" ) , BUGT( 0x00000400 , "Managing bugs reported through the bug tracker" ) , MNTM( 0x00000800 , "Activating/disabling maintenance mode" ) , + GDAT( 0x00001000 , "Modifying game data" ) , SUPER( 0x80000000 , "Superuser (all privileges + admin management)" ); private final int bits; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ArchivedBanRequest.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ArchivedBanRequest.java index d04e0ce..32d6336 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ArchivedBanRequest.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ArchivedBanRequest.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.admin.bans; import java.sql.Timestamp; +import com.deepclone.lw.session.API; + public class ArchivedBanRequest extends BanRequest { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private Timestamp update; private boolean expired; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/BanRequest.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/BanRequest.java index dee4b52..1a7f3d6 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/BanRequest.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/BanRequest.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.admin.bans; import java.io.Serializable; import java.sql.Timestamp; +import com.deepclone.lw.session.API; + public class BanRequest implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int id; private int requestedById; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/BansSummaryCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/BansSummaryCommand.java index 6b54955..0bfdf9b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/BansSummaryCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/BansSummaryCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.bans; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class BansSummaryCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/BansSummaryResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/BansSummaryResponse.java index 9cfe672..1d21b10 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/BansSummaryResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/BansSummaryResponse.java @@ -5,6 +5,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class BansSummaryResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< SummaryEntry > entries; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ConfirmBanCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ConfirmBanCommand.java index 3ff608c..e19fca2 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ConfirmBanCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ConfirmBanCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.bans; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ConfirmBanCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/LiftBanCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/LiftBanCommand.java index 24f2067..98d6b96 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/LiftBanCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/LiftBanCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.bans; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class LiftBanCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ListBansCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ListBansCommand.java index 1ba7c91..60f8463 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ListBansCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ListBansCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.bans; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ListBansCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final BanType type; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ListBansResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ListBansResponse.java index c956cec..205398a 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ListBansResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ListBansResponse.java @@ -5,6 +5,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class ListBansResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final BanType type; private final List< BanRequest > bans; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RejectBanCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RejectBanCommand.java index 1e5e56b..0fc9092 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RejectBanCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RejectBanCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.bans; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class RejectBanCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int id; private final String reason; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RejectBanResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RejectBanResponse.java index caa0a1e..38cf2d5 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RejectBanResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RejectBanResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.admin.bans; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class RejectBanResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean error; private final int id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RequestBanCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RequestBanCommand.java index 8f6e882..cee952c 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RequestBanCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RequestBanCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.bans; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class RequestBanCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String user; private final boolean empire; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RequestBanResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RequestBanResponse.java index 8637681..31365eb 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RequestBanResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/RequestBanResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.admin.bans; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class RequestBanResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public static enum Error { NOT_FOUND , diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/SummaryEntry.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/SummaryEntry.java index 0fcfa02..ce4c74b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/SummaryEntry.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/SummaryEntry.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.admin.bans; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class SummaryEntry implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final BanType type; private final long count; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ValidatedBanRequest.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ValidatedBanRequest.java index dfa6945..12586b7 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ValidatedBanRequest.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bans/ValidatedBanRequest.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.admin.bans; import java.sql.Timestamp; +import com.deepclone.lw.session.API; + public class ValidatedBanRequest extends BanRequest { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private Timestamp update; private boolean redeemable; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/BugsSummaryCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/BugsSummaryCommand.java index d5846a0..efbecb9 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/BugsSummaryCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/BugsSummaryCommand.java @@ -1,5 +1,6 @@ package com.deepclone.lw.cmd.admin.bt; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -7,6 +8,6 @@ public class BugsSummaryCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/BugsSummaryResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/BugsSummaryResponse.java index c399f41..05315ba 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/BugsSummaryResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/BugsSummaryResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.admin.bt; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class BugsSummaryResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long pending; private final long open; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/GetSnapshotCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/GetSnapshotCommand.java index 9aa671a..df41a9a 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/GetSnapshotCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/GetSnapshotCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.bt; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class GetSnapshotCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long bugId; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/GetSnapshotResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/GetSnapshotResponse.java index 439c768..d7dae36 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/GetSnapshotResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/GetSnapshotResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.admin.bt; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class GetSnapshotResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String snapshot; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ListBugsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ListBugsResponse.java index 4975ab8..5e18e62 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ListBugsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ListBugsResponse.java @@ -7,6 +7,7 @@ import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; import com.deepclone.lw.cmd.bt.data.BugReport; import com.deepclone.lw.cmd.bt.data.BugStatus; +import com.deepclone.lw.session.API; @@ -14,7 +15,7 @@ public class ListBugsResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final BugStatus status; private final boolean ownOnly; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/MergeReportsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/MergeReportsCommand.java index f95de2f..0997f53 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/MergeReportsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/MergeReportsCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.bt; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class MergeReportsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long id1; private final long id2; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/MergeReportsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/MergeReportsResponse.java index aedcc55..accb14f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/MergeReportsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/MergeReportsResponse.java @@ -6,6 +6,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.adata.Administrator; import com.deepclone.lw.cmd.bt.data.BugEvent; import com.deepclone.lw.cmd.bt.data.BugReport; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class MergeReportsResponse extends ViewBugResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final MergeError mergeError; private final long mergeId; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ModerateCommentCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ModerateCommentCommand.java index f648c86..2c3b6b3 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ModerateCommentCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ModerateCommentCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.bt; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ModerateCommentCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long id; private final boolean validation; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/PostCommentResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/PostCommentResponse.java index 13a97f0..e1375ba 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/PostCommentResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/PostCommentResponse.java @@ -7,6 +7,7 @@ import com.deepclone.lw.cmd.ObjectNameError; import com.deepclone.lw.cmd.admin.adata.Administrator; import com.deepclone.lw.cmd.bt.data.BugEvent; import com.deepclone.lw.cmd.bt.data.BugReport; +import com.deepclone.lw.session.API; @@ -14,7 +15,7 @@ public class PostCommentResponse extends ViewBugResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean posted; private final ObjectNameError commentError; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ReportBugResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ReportBugResponse.java index 3231103..4f1fa99 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ReportBugResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ReportBugResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.admin.bt; import com.deepclone.lw.cmd.ObjectNameError; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class ReportBugResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long bugId; private final ObjectNameError titleError; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ReportStatusCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ReportStatusCommand.java index 2f7ee85..9d8f155 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ReportStatusCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ReportStatusCommand.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.admin.bt; import com.deepclone.lw.cmd.bt.data.BugStatus; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -10,7 +11,7 @@ public class ReportStatusCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long id; private final BugStatus status; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ReportVisibilityCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ReportVisibilityCommand.java index 04d82c1..ae97fe3 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ReportVisibilityCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ReportVisibilityCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.bt; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ReportVisibilityCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ValidateReportCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ValidateReportCommand.java index 704c018..60c65ea 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ValidateReportCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ValidateReportCommand.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.admin.bt; import com.deepclone.lw.cmd.bt.data.BugStatus; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -10,7 +11,7 @@ public class ValidateReportCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long id; private final BugStatus status; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ViewBugResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ViewBugResponse.java index eccb9d5..60ae71e 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ViewBugResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/bt/ViewBugResponse.java @@ -7,6 +7,7 @@ import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; import com.deepclone.lw.cmd.bt.data.BugEvent; import com.deepclone.lw.cmd.bt.data.BugReport; +import com.deepclone.lw.session.API; @@ -14,7 +15,7 @@ public class ViewBugResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final BugReport report; private final List< BugEvent > events; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/Category.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/Category.java index 774a70a..89d82c5 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/Category.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/Category.java @@ -5,13 +5,15 @@ import java.io.Serializable; import java.util.Collections; import java.util.List; +import com.deepclone.lw.session.API; + public class Category implements Serializable , Comparable< Category > { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String name; private final List< Definition > definitions; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/Definition.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/Definition.java index 7115438..f5fb206 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/Definition.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/Definition.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.admin.constants; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class Definition implements Serializable , Comparable< Definition > { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private String name; private String description; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/GetConstantsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/GetConstantsCommand.java index 93920a5..6fa7d41 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/GetConstantsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/GetConstantsCommand.java @@ -1,11 +1,12 @@ package com.deepclone.lw.cmd.admin.constants; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; public class GetConstantsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/GetConstantsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/GetConstantsResponse.java index a31d96f..ca03aca 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/GetConstantsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/GetConstantsResponse.java @@ -6,13 +6,14 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; public class GetConstantsResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private List< Category > categories; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/SetConstantCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/SetConstantCommand.java index d2efe93..e506cf3 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/SetConstantCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/SetConstantCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.constants; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class SetConstantCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String name; private final double value; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/SetConstantResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/SetConstantResponse.java index cec5d9c..d5522c8 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/SetConstantResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/constants/SetConstantResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.admin.constants; import java.util.List; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class SetConstantResponse extends GetConstantsResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean error; private final String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ChangeLanguageCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ChangeLanguageCommand.java index 9882fd5..0dea93c 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ChangeLanguageCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ChangeLanguageCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.i18n; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ChangeLanguageCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String id; private final String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ChangeLanguageResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ChangeLanguageResponse.java index fd23d8e..57545ca 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ChangeLanguageResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ChangeLanguageResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.admin.i18n; import java.util.List; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class ChangeLanguageResponse extends GetLanguageResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean nameError; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/GetLanguageCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/GetLanguageCommand.java index 9ed73bb..4a66401 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/GetLanguageCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/GetLanguageCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.i18n; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class GetLanguageCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String language; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/GetLanguageResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/GetLanguageResponse.java index 68cbe5a..6f46e63 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/GetLanguageResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/GetLanguageResponse.java @@ -6,6 +6,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class GetLanguageResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final Language language; private final List< I18NString > strings; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/I18NString.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/I18NString.java index 06ada37..72691e9 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/I18NString.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/I18NString.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.admin.i18n; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class I18NString implements Serializable , Comparable< I18NString > { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String id; private final String text; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/Language.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/Language.java index 6258920..ec8c299 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/Language.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/Language.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.admin.i18n; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class Language implements Serializable , Comparable< Language > { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private String id; private String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/SetStringCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/SetStringCommand.java index 8cff779..77e7bb4 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/SetStringCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/SetStringCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.i18n; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class SetStringCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String language; private final String id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/SetStringResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/SetStringResponse.java index 5b3af0f..6242475 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/SetStringResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/SetStringResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.admin.i18n; import java.util.List; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class SetStringResponse extends GetLanguageResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String edited; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ViewLanguagesCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ViewLanguagesCommand.java index 5a22e75..0f6f313 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ViewLanguagesCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ViewLanguagesCommand.java @@ -1,5 +1,6 @@ package com.deepclone.lw.cmd.admin.i18n; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -7,6 +8,6 @@ public class ViewLanguagesCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ViewLanguagesResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ViewLanguagesResponse.java index 96e66cf..9c5f2b1 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ViewLanguagesResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/i18n/ViewLanguagesResponse.java @@ -6,6 +6,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class ViewLanguagesResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< Language > languages; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/ExceptionEntry.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/ExceptionEntry.java index 55d4aa3..31aeddb 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/ExceptionEntry.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/ExceptionEntry.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.admin.logs; import java.io.Serializable; import java.util.List; +import com.deepclone.lw.session.API; + public class ExceptionEntry implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String className; private final String message; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/GetEntryCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/GetEntryCommand.java index c07f7c9..00361bd 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/GetEntryCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/GetEntryCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.logs; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class GetEntryCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/GetEntryResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/GetEntryResponse.java index 8d20250..7ed89d9 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/GetEntryResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/GetEntryResponse.java @@ -5,13 +5,14 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; public class GetEntryResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final LogEntry entry; private final List< ExceptionEntry > exceptions; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/LogEntry.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/LogEntry.java index f203bb6..d5c567f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/LogEntry.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/LogEntry.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.admin.logs; import java.io.Serializable; import java.sql.Timestamp; +import com.deepclone.lw.session.API; + public class LogEntry implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private Long id; private Timestamp timestamp; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/TraceEntry.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/TraceEntry.java index 885c6f4..3226647 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/TraceEntry.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/TraceEntry.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.admin.logs; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class TraceEntry implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String location; private final String fileName; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/ViewLogCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/ViewLogCommand.java index d3f3ad7..a67b15f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/ViewLogCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/ViewLogCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.logs; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ViewLogCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final LogType type; private final long firstEntry; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/ViewLogResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/ViewLogResponse.java index 3964c7e..f9a1ab0 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/ViewLogResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/logs/ViewLogResponse.java @@ -5,6 +5,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class ViewLogResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long count; private final List< LogEntry > entries; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/EnableMaintenanceCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/EnableMaintenanceCommand.java index 2848b92..6929073 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/EnableMaintenanceCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/EnableMaintenanceCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.mntm; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class EnableMaintenanceCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String reason; private final int duration; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/EndMaintenanceCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/EndMaintenanceCommand.java index 11d5a82..da99e6e 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/EndMaintenanceCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/EndMaintenanceCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.mntm; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class EndMaintenanceCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/ExtendMaintenanceCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/ExtendMaintenanceCommand.java index 4a40d58..3f30964 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/ExtendMaintenanceCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/ExtendMaintenanceCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.mntm; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ExtendMaintenanceCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int duration; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/MaintenanceChangeResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/MaintenanceChangeResponse.java index c5ea32c..6a9e4e7 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/MaintenanceChangeResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/MaintenanceChangeResponse.java @@ -5,6 +5,7 @@ import java.util.Date; import com.deepclone.lw.cmd.ObjectNameError; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class MaintenanceChangeResponse extends MaintenanceStatusResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String newReason; private final ObjectNameError reasonError; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/MaintenanceStatusCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/MaintenanceStatusCommand.java index c0fd9b0..b4d08b9 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/MaintenanceStatusCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/MaintenanceStatusCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.mntm; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class MaintenanceStatusCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/MaintenanceStatusResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/MaintenanceStatusResponse.java index 4f98983..9b441b6 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/MaintenanceStatusResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/mntm/MaintenanceStatusResponse.java @@ -5,6 +5,7 @@ import java.util.Date; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class MaintenanceStatusResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String reason; private final Date started; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ComposeMessageCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ComposeMessageCommand.java index 5eb5314..db5078c 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ComposeMessageCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ComposeMessageCommand.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.admin.msg; import com.deepclone.lw.cmd.msgdata.MessageType; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -10,7 +11,7 @@ public class ComposeMessageCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final Boolean inbox; private final Long replyTo; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ComposeMessageResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ComposeMessageResponse.java index 7b01bc4..c95a7e5 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ComposeMessageResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ComposeMessageResponse.java @@ -5,6 +5,7 @@ import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; import com.deepclone.lw.cmd.msgdata.Message; import com.deepclone.lw.cmd.msgdata.MessageType; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class ComposeMessageResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private MessageType messageType; private String target; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/GetMessagesCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/GetMessagesCommand.java index f6019f1..b1175b1 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/GetMessagesCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/GetMessagesCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.msg; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class GetMessagesCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean inbox; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/GetMessagesResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/GetMessagesResponse.java index bd0c6da..ee774d3 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/GetMessagesResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/GetMessagesResponse.java @@ -6,6 +6,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; import com.deepclone.lw.cmd.msgdata.MessageListEntry; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class GetMessagesResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< MessageListEntry > messages; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/MessageBoxCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/MessageBoxCommand.java index c7431f2..5b2dfd2 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/MessageBoxCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/MessageBoxCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.msg; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class MessageBoxCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final MessageBoxAction action; private final boolean inbox; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/PrepareMessageCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/PrepareMessageCommand.java index 0da0140..244779c 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/PrepareMessageCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/PrepareMessageCommand.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.admin.msg; import com.deepclone.lw.cmd.msgdata.MessageType; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -10,7 +11,7 @@ public class PrepareMessageCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final MessageType type; private final Long id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ReadMessageCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ReadMessageCommand.java index e4d178f..57db7bf 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ReadMessageCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ReadMessageCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.msg; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ReadMessageCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean inbox; private final long id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ReadMessageResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ReadMessageResponse.java index c310b93..096124d 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ReadMessageResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/ReadMessageResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.admin.msg; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; import com.deepclone.lw.cmd.msgdata.Message; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class ReadMessageResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean inbox; private final Message message; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/SendSpamCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/SendSpamCommand.java index b282bcc..9acc488 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/SendSpamCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/msg/SendSpamCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.msg; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class SendSpamCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String title; private final String body; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/GetNamesCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/GetNamesCommand.java index 1502f47..bcd08ea 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/GetNamesCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/GetNamesCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.naming; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class GetNamesCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final NameType type; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/GetNamesResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/GetNamesResponse.java index 735a487..54a68ba 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/GetNamesResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/GetNamesResponse.java @@ -5,6 +5,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class GetNamesResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final NameType type; private final List< Name > names; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/Name.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/Name.java index c3f67e8..3c71848 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/Name.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/Name.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.admin.naming; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class Name implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int id; private final String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/NamesActionCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/NamesActionCommand.java index 0b778e1..e808868 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/NamesActionCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/NamesActionCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.naming; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class NamesActionCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final NameType type; private final NameAction action; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/NamesSummaryCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/NamesSummaryCommand.java index 96ea84a..325c47e 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/NamesSummaryCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/NamesSummaryCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.naming; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class NamesSummaryCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/NamesSummaryResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/NamesSummaryResponse.java index adbb523..746f7d6 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/NamesSummaryResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/naming/NamesSummaryResponse.java @@ -6,6 +6,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class NamesSummaryResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; @SuppressWarnings( "serial" ) public static class Entry diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/prefs/GetPrefDefaultsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/prefs/GetPrefDefaultsCommand.java index 0946c22..25b876b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/prefs/GetPrefDefaultsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/prefs/GetPrefDefaultsCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.prefs; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class GetPrefDefaultsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/prefs/PrefDefaultsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/prefs/PrefDefaultsResponse.java index fed8047..e36f9ec 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/prefs/PrefDefaultsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/prefs/PrefDefaultsResponse.java @@ -6,6 +6,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; import com.deepclone.lw.cmd.player.gdata.account.PrefCategory; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class PrefDefaultsResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< PrefCategory > preferences; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/prefs/SetPrefDefaultCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/prefs/SetPrefDefaultCommand.java index 35f3945..64a778e 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/prefs/SetPrefDefaultCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/prefs/SetPrefDefaultCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.prefs; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class SetPrefDefaultCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String preference; private final String value; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/AddAdministratorCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/AddAdministratorCommand.java index ed1eeb8..77febe4 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/AddAdministratorCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/AddAdministratorCommand.java @@ -6,6 +6,7 @@ import java.util.HashSet; import java.util.Set; import com.deepclone.lw.cmd.admin.adata.Privileges; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -14,7 +15,7 @@ public class AddAdministratorCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String address; private final String appearAs; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/AddAdministratorResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/AddAdministratorResponse.java index a31e6d4..f1a9067 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/AddAdministratorResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/AddAdministratorResponse.java @@ -7,13 +7,14 @@ import com.deepclone.lw.cmd.ObjectNameError; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; import com.deepclone.lw.cmd.admin.adata.PrivEntry; +import com.deepclone.lw.session.API; public class AddAdministratorResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public static enum AddressError { EMPTY , diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ListAdministratorsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ListAdministratorsCommand.java index 8133b1c..e6930e1 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ListAdministratorsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ListAdministratorsCommand.java @@ -1,11 +1,12 @@ package com.deepclone.lw.cmd.admin.su; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; public class ListAdministratorsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ListAdministratorsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ListAdministratorsResponse.java index 9a49ab2..39208b4 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ListAdministratorsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ListAdministratorsResponse.java @@ -5,6 +5,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class ListAdministratorsResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< Administrator > administrators; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ResetAdminPasswordCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ResetAdminPasswordCommand.java index 78c5bb0..6023fc3 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ResetAdminPasswordCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ResetAdminPasswordCommand.java @@ -1,10 +1,12 @@ package com.deepclone.lw.cmd.admin.su; +import com.deepclone.lw.session.API; + public class ResetAdminPasswordCommand extends ViewAdministratorCommand { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public ResetAdminPasswordCommand( int identifier ) diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/SetPrivilegesCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/SetPrivilegesCommand.java index ea902e3..8fc8ad7 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/SetPrivilegesCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/SetPrivilegesCommand.java @@ -6,6 +6,7 @@ import java.util.HashSet; import java.util.Set; import com.deepclone.lw.cmd.admin.adata.Privileges; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class SetPrivilegesCommand extends ViewAdministratorCommand { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final Set< Privileges > privileges; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ViewAdministratorCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ViewAdministratorCommand.java index 8b6e119..c3aa977 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ViewAdministratorCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ViewAdministratorCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.su; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ViewAdministratorCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int identifier; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ViewAdministratorResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ViewAdministratorResponse.java index a903ccc..176d54a 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ViewAdministratorResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/su/ViewAdministratorResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.admin.su; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class ViewAdministratorResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final Administrator view; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/GetTechnologyCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/GetTechnologyCommand.java new file mode 100644 index 0000000..2695f5f --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/GetTechnologyCommand.java @@ -0,0 +1,29 @@ +package com.deepclone.lw.cmd.admin.techs; + + +import com.deepclone.lw.session.API; +import com.deepclone.lw.session.Command; + + + +public class GetTechnologyCommand + extends Command +{ + + private static final long serialVersionUID = API.Version; + + private final String technology; + + + public GetTechnologyCommand( String technology ) + { + this.technology = technology; + } + + + public String getTechnology( ) + { + return technology; + } + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/GetTechnologyResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/GetTechnologyResponse.java new file mode 100644 index 0000000..ec14a8c --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/GetTechnologyResponse.java @@ -0,0 +1,62 @@ +package com.deepclone.lw.cmd.admin.techs; + + +import java.util.LinkedList; +import java.util.List; + +import com.deepclone.lw.cmd.admin.AdminResponse; +import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; + + + +public class GetTechnologyResponse + extends AdminResponse +{ + + private static final long serialVersionUID = API.Version; + + public final TechEntry technology; + + public final List< String > categories; + + public final List< String > strings; + + + public GetTechnologyResponse( Administrator admin , boolean privError ) + { + super( admin , privError ); + this.technology = null; + this.categories = null; + this.strings = null; + } + + + public GetTechnologyResponse( Administrator admin , TechEntry technology , List< String > categories , + List< String > strings ) + { + super( admin , false ); + this.technology = technology; + this.categories = categories; + this.strings = strings; + } + + + public TechEntry getTechnology( ) + { + return this.technology; + } + + + public List< String > getCategories( ) + { + return new LinkedList< String >( this.categories ); + } + + + public List< String > getStrings( ) + { + return new LinkedList< String >( this.strings ); + } + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/ListCategoriesCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/ListCategoriesCommand.java new file mode 100644 index 0000000..736b187 --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/ListCategoriesCommand.java @@ -0,0 +1,15 @@ +package com.deepclone.lw.cmd.admin.techs; + + +import com.deepclone.lw.session.API; +import com.deepclone.lw.session.Command; + + + +public class ListCategoriesCommand + extends Command +{ + + private static final long serialVersionUID = API.Version; + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/ListCategoriesResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/ListCategoriesResponse.java new file mode 100644 index 0000000..e5446a3 --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/ListCategoriesResponse.java @@ -0,0 +1,40 @@ +package com.deepclone.lw.cmd.admin.techs; + + +import java.util.LinkedList; +import java.util.List; + +import com.deepclone.lw.cmd.admin.AdminResponse; +import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; + + + +public class ListCategoriesResponse + extends AdminResponse +{ + + private static final long serialVersionUID = API.Version; + + private final List< TechCategory > categories; + + + public ListCategoriesResponse( Administrator admin ) + { + super( admin , false ); + this.categories = null; + } + + + public ListCategoriesResponse( Administrator admin , List< TechCategory > categories ) + { + super( admin , true ); + this.categories = categories; + } + + + public List< TechCategory > getCategories( ) + { + return new LinkedList< TechCategory >( this.categories ); + } +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/TechCategory.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/TechCategory.java new file mode 100644 index 0000000..b85721c --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/TechCategory.java @@ -0,0 +1,50 @@ +package com.deepclone.lw.cmd.admin.techs; + + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; + +import com.deepclone.lw.session.API; + + + +public class TechCategory + implements Serializable +{ + + private static final long serialVersionUID = API.Version; + + private final String name; + + private final String description; + + private final List< String > techs; + + + public TechCategory( String name , String description , List< String > techs ) + { + this.name = name; + this.description = description; + this.techs = new LinkedList< String >( techs ); + } + + + public String getName( ) + { + return name; + } + + + public String getDescription( ) + { + return description; + } + + + public List< String > getTechs( ) + { + return techs; + } + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/TechEntry.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/TechEntry.java new file mode 100644 index 0000000..cc4a2d2 --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/techs/TechEntry.java @@ -0,0 +1,62 @@ +package com.deepclone.lw.cmd.admin.techs; + + +import java.io.Serializable; + +import com.deepclone.lw.session.API; + + + +public class TechEntry + implements Serializable +{ + + private static final long serialVersionUID = API.Version; + + private final String category; + private final String name; + private final String description; + private final int points; + private final int cost; + + + public TechEntry( String category , String name , String description , int points , int cost ) + { + this.category = category; + this.name = name; + this.description = description; + this.points = points; + this.cost = cost; + } + + + public String getCategory( ) + { + return category; + } + + + public String getName( ) + { + return name; + } + + + public String getDescription( ) + { + return description; + } + + + public int getPoints( ) + { + return points; + } + + + public int getCost( ) + { + return cost; + } + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/SetTaskStatusCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/SetTaskStatusCommand.java index 82645b8..dca5056 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/SetTaskStatusCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/SetTaskStatusCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.tick; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class SetTaskStatusCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int task; private final TickerTaskStatus newStatus; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/TickerStatusCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/TickerStatusCommand.java index e6dda40..42f7694 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/TickerStatusCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/TickerStatusCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.tick; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class TickerStatusCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/TickerStatusResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/TickerStatusResponse.java index 9de84db..ad401cd 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/TickerStatusResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/TickerStatusResponse.java @@ -5,6 +5,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class TickerStatusResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean paused; private final List< TickerTaskInfo > tasks; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/TickerTaskInfo.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/TickerTaskInfo.java index 5f189de..88780dd 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/TickerTaskInfo.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/TickerTaskInfo.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.admin.tick; import java.io.Serializable; import java.sql.Timestamp; +import com.deepclone.lw.session.API; + public class TickerTaskInfo implements Serializable , Comparable< TickerTaskInfo > { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int id; private String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/ToggleTickerCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/ToggleTickerCommand.java index 797781f..95b9f94 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/ToggleTickerCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/tick/ToggleTickerCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.tick; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class ToggleTickerCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountBanEntry.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountBanEntry.java index 6f124e0..5212f12 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountBanEntry.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountBanEntry.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.admin.users; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class AccountBanEntry implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private String requestedByName; private int requestedById; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountListEntry.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountListEntry.java index f102958..ec88fc0 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountListEntry.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountListEntry.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.admin.users; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class AccountListEntry implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int id; private String address; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountSessionEntry.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountSessionEntry.java index ff8594d..2a432a6 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountSessionEntry.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountSessionEntry.java @@ -3,12 +3,14 @@ package com.deepclone.lw.cmd.admin.users; import java.util.List; +import com.deepclone.lw.session.API; + public class AccountSessionEntry extends AccountListEntry { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private List< UserSession > sessions; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountViewEntry.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountViewEntry.java index 44ff78d..8d4b36e 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountViewEntry.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/AccountViewEntry.java @@ -5,13 +5,15 @@ import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; +import com.deepclone.lw.session.API; + public class AccountViewEntry extends AccountListEntry { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private Integer empireId; private int gameCredits; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/GiveCreditsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/GiveCreditsCommand.java index 5ab9330..5a72297 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/GiveCreditsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/GiveCreditsCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.users; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class GiveCreditsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int id; private final int credits; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListAccountsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListAccountsCommand.java index 5b52707..58b84ed 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListAccountsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListAccountsCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.users; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ListAccountsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final AccountStatus status; private final boolean online; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListAccountsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListAccountsResponse.java index 389bd1e..d93d8dc 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListAccountsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListAccountsResponse.java @@ -5,6 +5,7 @@ import java.util.List; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class ListAccountsResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final AccountStatus status; private final boolean online; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListSessionsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListSessionsCommand.java index 0dd8336..de06eb1 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListSessionsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListSessionsCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.users; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ListSessionsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListSessionsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListSessionsResponse.java index a9ae818..87bc72c 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListSessionsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ListSessionsResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.admin.users; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class ListSessionsResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final AccountSessionEntry account; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/UserSession.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/UserSession.java index b66cb2b..11a0265 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/UserSession.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/UserSession.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.admin.users; import java.io.Serializable; import java.sql.Timestamp; +import com.deepclone.lw.session.API; + public class UserSession implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private long id; private int credentialsId; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ViewAccountCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ViewAccountCommand.java index aa05383..584f465 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ViewAccountCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ViewAccountCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.admin.users; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ViewAccountCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ViewAccountResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ViewAccountResponse.java index add90f9..efa7255 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ViewAccountResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/admin/users/ViewAccountResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.admin.users; import com.deepclone.lw.cmd.admin.AdminResponse; import com.deepclone.lw.cmd.admin.adata.Administrator; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class ViewAccountResponse extends AdminResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final AccountViewEntry account; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/ListBugsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/ListBugsCommand.java index 18763af..ae33a05 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/ListBugsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/ListBugsCommand.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.bt; import com.deepclone.lw.cmd.bt.data.BugStatus; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -10,7 +11,7 @@ public class ListBugsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final BugStatus status; private final boolean ownOnly; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/PostCommentCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/PostCommentCommand.java index d032610..82ee37f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/PostCommentCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/PostCommentCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.bt; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class PostCommentCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long id; private final String comment; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/ReportBugCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/ReportBugCommand.java index 92425fe..bd57fd1 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/ReportBugCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/ReportBugCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.bt; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ReportBugCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String title; private final String description; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/ViewBugCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/ViewBugCommand.java index 1ef74ba..ed25758 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/ViewBugCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/ViewBugCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.bt; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ViewBugCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/data/BugEvent.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/data/BugEvent.java index 027b9d7..f53cf16 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/data/BugEvent.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/data/BugEvent.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.bt.data; import java.io.Serializable; import java.sql.Timestamp; +import com.deepclone.lw.session.API; + public class BugEvent implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private long id; private BugEventType type; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/data/BugReport.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/data/BugReport.java index 2767173..f4be6c6 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/data/BugReport.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/data/BugReport.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.bt.data; import java.io.Serializable; import java.sql.Timestamp; +import com.deepclone.lw.session.API; + public class BugReport implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private long reportId; private String title; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/data/BugSubmitter.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/data/BugSubmitter.java index 3e6e5b8..729ef38 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/data/BugSubmitter.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/bt/data/BugSubmitter.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.bt.data; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class BugSubmitter implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private boolean isAdmin; private String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ConfirmPasswordRecoveryCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ConfirmPasswordRecoveryCommand.java index fe21b7d..56b45af 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ConfirmPasswordRecoveryCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ConfirmPasswordRecoveryCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.ext; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ConfirmPasswordRecoveryCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String mailAddress; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ConfirmPasswordRecoveryResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ConfirmPasswordRecoveryResponse.java index 4342cdd..0fdb4b3 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ConfirmPasswordRecoveryResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ConfirmPasswordRecoveryResponse.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.ext; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.CommandResponse; @@ -9,7 +10,7 @@ public class ConfirmPasswordRecoveryResponse extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public static enum PasswordRecoveryStatus { OK , diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/CreateAccountCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/CreateAccountCommand.java index a4d0d32..60ff472 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/CreateAccountCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/CreateAccountCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.ext; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public final class CreateAccountCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String mail; private final String mailConfirm; private final String password; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/CreateAccountResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/CreateAccountResponse.java index d7fff8b..f997c37 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/CreateAccountResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/CreateAccountResponse.java @@ -5,6 +5,7 @@ import java.util.Map; import com.deepclone.lw.cmd.MailError; import com.deepclone.lw.cmd.PasswordError; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.CommandResponse; @@ -13,7 +14,7 @@ public final class CreateAccountResponse extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean created; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ListLanguagesCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ListLanguagesCommand.java index d04a39e..5fc3027 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ListLanguagesCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ListLanguagesCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.ext; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class ListLanguagesCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ListLanguagesResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ListLanguagesResponse.java index 5f046c3..4815584 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ListLanguagesResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/ListLanguagesResponse.java @@ -7,6 +7,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.CommandResponse; @@ -15,12 +16,12 @@ public class ListLanguagesResponse extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public static class Language implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/RequestPasswordRecoveryCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/RequestPasswordRecoveryCommand.java index dea1b75..5d78bef 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/RequestPasswordRecoveryCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/RequestPasswordRecoveryCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.ext; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class RequestPasswordRecoveryCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String mailAddress; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/RequestPasswordRecoveryResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/RequestPasswordRecoveryResponse.java index cdf6407..bbe7753 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/RequestPasswordRecoveryResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/ext/RequestPasswordRecoveryResponse.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.ext; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.CommandResponse; @@ -9,7 +10,7 @@ public class RequestPasswordRecoveryResponse extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public static enum PasswordRecoveryRequestStatus { OK , diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/msgdata/Message.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/msgdata/Message.java index d3e8547..d11c1db 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/msgdata/Message.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/msgdata/Message.java @@ -5,6 +5,7 @@ import java.io.Serializable; import java.sql.Timestamp; import com.deepclone.lw.cmd.player.gdata.GameTime; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class Message implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private long id; private Long previous; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/msgdata/MessageListEntry.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/msgdata/MessageListEntry.java index aee6cac..12809b2 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/msgdata/MessageListEntry.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/msgdata/MessageListEntry.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.msgdata; import java.io.Serializable; import java.sql.Timestamp; +import com.deepclone.lw.session.API; + public class MessageListEntry implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private long id; private MessageType type; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/EmpireResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/EmpireResponse.java index 7b6eea1..3fa9bcb 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/EmpireResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/EmpireResponse.java @@ -1,14 +1,13 @@ package com.deepclone.lw.cmd.player; -import java.util.Collections; import java.util.List; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.battles.BattleListEntry; import com.deepclone.lw.cmd.player.gdata.empire.OverviewData; -import com.deepclone.lw.cmd.player.gdata.empire.ResearchLineData; +import com.deepclone.lw.session.API; @@ -16,19 +15,16 @@ public class EmpireResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final OverviewData overview; - private final List< ResearchLineData > research; private final List< BattleListEntry > battles; - public EmpireResponse( GamePageData page , OverviewData overview , List< ResearchLineData > research , - List< BattleListEntry > battles ) + public EmpireResponse( GamePageData page , OverviewData overview , List< BattleListEntry > battles ) { super( page ); this.overview = overview; this.battles = battles; - this.research = Collections.unmodifiableList( research ); } @@ -38,12 +34,6 @@ public class EmpireResponse } - public List< ResearchLineData > getResearch( ) - { - return research; - } - - public List< BattleListEntry > getBattles( ) { return battles; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/GetNewPlanetCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/GetNewPlanetCommand.java index 0901c47..f8984af 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/GetNewPlanetCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/GetNewPlanetCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class GetNewPlanetCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/GetNewPlanetResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/GetNewPlanetResponse.java index 772d507..269e75a 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/GetNewPlanetResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/GetNewPlanetResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player; import com.deepclone.lw.cmd.ObjectNameError; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class GetNewPlanetResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String name; private final ObjectNameError error; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ImplementTechCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ImplementTechCommand.java deleted file mode 100644 index 9a26ed7..0000000 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ImplementTechCommand.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.deepclone.lw.cmd.player; - - -import com.deepclone.lw.session.Command; - - - -public class ImplementTechCommand - extends Command -{ - - private static final long serialVersionUID = 1L; - - private final int tech; - - - public ImplementTechCommand( int tech ) - { - this.tech = tech; - } - - - public int getTech( ) - { - return tech; - } - -} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ListPlanetsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ListPlanetsCommand.java index bf8b5e8..28ad77c 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ListPlanetsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ListPlanetsCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class ListPlanetsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ListPlanetsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ListPlanetsResponse.java index 0e93aac..47a01b3 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ListPlanetsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ListPlanetsResponse.java @@ -7,6 +7,7 @@ import java.util.List; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.PlanetListData; +import com.deepclone.lw.session.API; @@ -14,7 +15,7 @@ public class ListPlanetsResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< PlanetListData > planets; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/OverviewCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/OverviewCommand.java index 030a27b..c61817b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/OverviewCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/OverviewCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class OverviewCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ViewMapCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ViewMapCommand.java index 2eb03bb..4ef2af4 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ViewMapCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ViewMapCommand.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.player; import com.deepclone.lw.cmd.player.gdata.MapSize; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -10,7 +11,7 @@ public class ViewMapCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean defaults; private final Integer x; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ViewMapResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ViewMapResponse.java index 703b122..cca0e46 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ViewMapResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/ViewMapResponse.java @@ -8,6 +8,7 @@ import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.MapSize; import com.deepclone.lw.cmd.player.gdata.map.MapSystemData; +import com.deepclone.lw.session.API; @@ -15,7 +16,7 @@ public class ViewMapResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int x; private final int y; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountReactivationCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountReactivationCommand.java index 2634d43..7d9967c 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountReactivationCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountReactivationCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class AccountReactivationCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountReactivationResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountReactivationResponse.java index 9eddc44..a7cd609 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountReactivationResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountReactivationResponse.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.CommandResponse; @@ -9,7 +10,7 @@ public class AccountReactivationResponse extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String address; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountValidationCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountValidationCommand.java index 9854256..6b37962 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountValidationCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountValidationCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class AccountValidationCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean initialisation; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountValidationResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountValidationResponse.java index 8bd908f..cfa6bc3 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountValidationResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/AccountValidationResponse.java @@ -5,6 +5,7 @@ import java.util.Collections; import java.util.List; import com.deepclone.lw.cmd.ObjectNameError; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.CommandResponse; @@ -13,7 +14,7 @@ public class AccountValidationResponse extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean validated; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/BanDetailsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/BanDetailsCommand.java index dca68e4..3667bae 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/BanDetailsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/BanDetailsCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class BanDetailsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/BanDetailsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/BanDetailsResponse.java index 20e70c3..76b4d1c 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/BanDetailsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/BanDetailsResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.player.account; import java.sql.Timestamp; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.CommandResponse; @@ -11,7 +12,7 @@ public class BanDetailsResponse extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final Timestamp banTime; private final String banReason; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/CancelQuitCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/CancelQuitCommand.java index 062f377..d4ba67f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/CancelQuitCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/CancelQuitCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class CancelQuitCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetAccountCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetAccountCommand.java index e51d582..63b4c7c 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetAccountCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetAccountCommand.java @@ -1,11 +1,12 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; public class GetAccountCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetAccountResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetAccountResponse.java index 3deb26c..913f598 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetAccountResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetAccountResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.account; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.account.AccountData; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class GetAccountResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final AccountData account; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetLanguageCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetLanguageCommand.java index b60f61c..f86484f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetLanguageCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetLanguageCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class GetLanguageCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetLanguageResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetLanguageResponse.java index c18ad3d..d6d2bc4 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetLanguageResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/GetLanguageResponse.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.CommandResponse; @@ -9,7 +10,7 @@ public class GetLanguageResponse extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String language; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/QuitGameCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/QuitGameCommand.java index c0a4776..a3bfd28 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/QuitGameCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/QuitGameCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class QuitGameCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String reason; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetAddressCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetAddressCommand.java index 3362047..8ec0ddb 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetAddressCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetAddressCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class SetAddressCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String sha1Auth; private final String md5Auth; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetAddressResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetAddressResponse.java index b281611..1f780e0 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetAddressResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetAddressResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.player.account; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.account.AccountData; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class SetAddressResponse extends GetAccountResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public static enum AddressChangeStatus { OK , diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetLanguageCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetLanguageCommand.java index 75b7984..c38d16e 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetLanguageCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetLanguageCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class SetLanguageCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String language; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetPasswordCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetPasswordCommand.java index ef777be..55f2aaf 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetPasswordCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetPasswordCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class SetPasswordCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String sha1Auth; private final String md5Auth; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetPasswordResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetPasswordResponse.java index 3d6e71d..93fe53a 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetPasswordResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetPasswordResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.player.account; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.account.AccountData; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class SetPasswordResponse extends GetAccountResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public static enum PasswordChangeStatus { OK , diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetPreferencesCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetPreferencesCommand.java index d1c4057..9d9b293 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetPreferencesCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/SetPreferencesCommand.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.player.account; import java.util.Map; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -11,7 +12,7 @@ public class SetPreferencesCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final Map< String , String > values; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/ToggleVacationCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/ToggleVacationCommand.java index da6d81a..4e910ee 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/ToggleVacationCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/ToggleVacationCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class ToggleVacationCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/ValidateSetAddressCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/ValidateSetAddressCommand.java index 69ad994..feb53cd 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/ValidateSetAddressCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/ValidateSetAddressCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.account; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ValidateSetAddressCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean cancel; private final String code; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/ValidateSetAddressResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/ValidateSetAddressResponse.java index 5f1f15a..52b8cb0 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/ValidateSetAddressResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/account/ValidateSetAddressResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.player.account; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.account.AccountData; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class ValidateSetAddressResponse extends GetAccountResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean codeError; private final String code; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/AllianceStatusCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/AllianceStatusCommand.java index ceeb01c..a8d7220 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/AllianceStatusCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/AllianceStatusCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.alliances; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class AllianceStatusCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/AllianceStatusResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/AllianceStatusResponse.java index f2eea70..63fb7c2 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/AllianceStatusResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/AllianceStatusResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.alliances; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.alliance.AllianceData; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class AllianceStatusResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final AllianceData alliance; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/CancelJoinCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/CancelJoinCommand.java index 54af717..5610612 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/CancelJoinCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/CancelJoinCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.alliances; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class CancelJoinCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/CreateAllianceCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/CreateAllianceCommand.java index 5e250e7..8ca082f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/CreateAllianceCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/CreateAllianceCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.alliances; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -8,7 +9,7 @@ import com.deepclone.lw.session.Command; public class CreateAllianceCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String tag; private final String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/CreateAllianceResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/CreateAllianceResponse.java index c484453..133e48f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/CreateAllianceResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/CreateAllianceResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.alliances; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.alliance.AllianceCreationStatus; import com.deepclone.lw.cmd.player.gdata.alliance.AllianceData; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class CreateAllianceResponse extends AllianceStatusResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final AllianceCreationStatus creation; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/JoinAllianceCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/JoinAllianceCommand.java index e0fe9cd..5a6c4bf 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/JoinAllianceCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/JoinAllianceCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.alliances; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -8,7 +9,7 @@ import com.deepclone.lw.session.Command; public class JoinAllianceCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String tag; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/JoinAllianceResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/JoinAllianceResponse.java index d544543..9bf4f40 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/JoinAllianceResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/JoinAllianceResponse.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.player.alliances; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.alliance.AllianceData; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class JoinAllianceResponse extends AllianceStatusResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String joinFailure; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/KickMembersCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/KickMembersCommand.java index fddf2a3..7c430db 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/KickMembersCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/KickMembersCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.alliances; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class KickMembersCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int[] members; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/LeaveAllianceCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/LeaveAllianceCommand.java index 4cf33da..bb518ae 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/LeaveAllianceCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/LeaveAllianceCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.alliances; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class LeaveAllianceCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/ManageRequestsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/ManageRequestsCommand.java index 826e1a1..7f78179 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/ManageRequestsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/ManageRequestsCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.alliances; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ManageRequestsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int[] members; private final boolean accept; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/TransferLeadershipCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/TransferLeadershipCommand.java index 558d360..c0671df 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/TransferLeadershipCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/TransferLeadershipCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.alliances; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class TransferLeadershipCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int toMember; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/ViewAllianceCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/ViewAllianceCommand.java index aa201bf..cea77b0 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/ViewAllianceCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/ViewAllianceCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.alliances; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -8,7 +9,7 @@ import com.deepclone.lw.session.Command; public class ViewAllianceCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String tag; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/ViewAllianceResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/ViewAllianceResponse.java index 2f3e083..29da170 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/ViewAllianceResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/alliances/ViewAllianceResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.alliances; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.alliance.AllianceData; import com.deepclone.lw.cmd.player.gdata.alliance.PublicAllianceInformation; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class ViewAllianceResponse extends AllianceStatusResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String requested; private final PublicAllianceInformation info; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/GetBattleCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/GetBattleCommand.java index 555c2f4..c65ef39 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/GetBattleCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/GetBattleCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.battles; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class GetBattleCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long battle; private final Long tick; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/GetBattleResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/GetBattleResponse.java index bf46be5..ce78d6b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/GetBattleResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/GetBattleResponse.java @@ -4,13 +4,14 @@ package com.deepclone.lw.cmd.player.battles; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.battles.BattleView; +import com.deepclone.lw.session.API; public class GetBattleResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final BattleView battle; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/ListBattlesCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/ListBattlesCommand.java index 6b8041a..9ee8ee7 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/ListBattlesCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/ListBattlesCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.battles; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ListBattlesCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int page; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/ListBattlesResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/ListBattlesResponse.java index a4856c7..2681b84 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/ListBattlesResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/battles/ListBattlesResponse.java @@ -6,6 +6,7 @@ import java.util.List; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.battles.BattleListEntry; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class ListBattlesResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< BattleListEntry > list; private final int currentPage; private final int pages; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/ListBugsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/ListBugsResponse.java index 6481ab0..21e84ee 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/ListBugsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/ListBugsResponse.java @@ -7,6 +7,7 @@ import com.deepclone.lw.cmd.bt.data.BugReport; import com.deepclone.lw.cmd.bt.data.BugStatus; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; +import com.deepclone.lw.session.API; @@ -14,7 +15,7 @@ public class ListBugsResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final BugStatus status; private final boolean ownOnly; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/PostCommentResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/PostCommentResponse.java index 2c7c353..97af985 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/PostCommentResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/PostCommentResponse.java @@ -7,6 +7,7 @@ import com.deepclone.lw.cmd.ObjectNameError; import com.deepclone.lw.cmd.bt.data.BugEvent; import com.deepclone.lw.cmd.bt.data.BugReport; import com.deepclone.lw.cmd.player.gdata.GamePageData; +import com.deepclone.lw.session.API; @@ -14,7 +15,7 @@ public class PostCommentResponse extends ViewBugResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean posted; private final ObjectNameError commentError; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/ReportBugResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/ReportBugResponse.java index 6fb47c9..c5657cb 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/ReportBugResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/ReportBugResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.bt; import com.deepclone.lw.cmd.ObjectNameError; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class ReportBugResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long bugId; private final ObjectNameError titleError; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/ViewBugResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/ViewBugResponse.java index 0f487c5..a7d18f3 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/ViewBugResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/bt/ViewBugResponse.java @@ -7,6 +7,7 @@ import com.deepclone.lw.cmd.bt.data.BugEvent; import com.deepclone.lw.cmd.bt.data.BugReport; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; +import com.deepclone.lw.session.API; @@ -14,7 +15,7 @@ public class ViewBugResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final BugReport report; private final List< BugEvent > events; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/AddEnemyCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/AddEnemyCommand.java index f4342b2..5ee13fd 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/AddEnemyCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/AddEnemyCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.elist; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class AddEnemyCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean alliance; private final String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/AddEnemyResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/AddEnemyResponse.java index 0e3e7e2..99f369f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/AddEnemyResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/AddEnemyResponse.java @@ -6,6 +6,7 @@ import java.util.List; import com.deepclone.lw.cmd.ObjectNameError; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.NameIdPair; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class AddEnemyResponse extends EnemyListResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final ObjectNameError error; private final boolean alliance; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/EnemyListCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/EnemyListCommand.java index d72bf7d..c8e85a1 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/EnemyListCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/EnemyListCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.elist; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class EnemyListCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/EnemyListResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/EnemyListResponse.java index 85ebd0d..8abccc6 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/EnemyListResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/EnemyListResponse.java @@ -6,13 +6,14 @@ import java.util.List; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.NameIdPair; +import com.deepclone.lw.session.API; public class EnemyListResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< NameIdPair > empires; private final List< NameIdPair > alliances; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/RemoveEnemiesCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/RemoveEnemiesCommand.java index 9a3ffbe..617ea27 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/RemoveEnemiesCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/elist/RemoveEnemiesCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.elist; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class RemoveEnemiesCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean alliance; private final int[] identifiers; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/DisbandFleetsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/DisbandFleetsCommand.java index 4ac3589..a61e613 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/DisbandFleetsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/DisbandFleetsCommand.java @@ -1,11 +1,13 @@ package com.deepclone.lw.cmd.player.fleets; +import com.deepclone.lw.session.API; + public class DisbandFleetsCommand extends MultiFleetsCommand { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean confirm; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/DisbandFleetsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/DisbandFleetsResponse.java index 9eace3b..ec51c4b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/DisbandFleetsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/DisbandFleetsResponse.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.player.fleets; import com.deepclone.lw.cmd.player.gdata.GamePageData; +import com.deepclone.lw.session.API; @@ -9,7 +10,7 @@ public class DisbandFleetsResponse extends MultiFleetsResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public DisbandFleetsResponse( GamePageData page ) diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MergeFleetsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MergeFleetsCommand.java index f5029ce..24ba678 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MergeFleetsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MergeFleetsCommand.java @@ -1,11 +1,13 @@ package com.deepclone.lw.cmd.player.fleets; +import com.deepclone.lw.session.API; + public class MergeFleetsCommand extends MultiFleetsCommand { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public MergeFleetsCommand( long[] fleets ) diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MergeFleetsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MergeFleetsResponse.java index f0e92a5..642dde5 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MergeFleetsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MergeFleetsResponse.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.player.fleets; import com.deepclone.lw.cmd.player.gdata.GamePageData; +import com.deepclone.lw.session.API; @@ -9,7 +10,7 @@ public class MergeFleetsResponse extends MultiFleetsResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public MergeFleetsResponse( GamePageData page ) diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MoveFleetsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MoveFleetsCommand.java index 1efee46..8a8c811 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MoveFleetsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MoveFleetsCommand.java @@ -1,11 +1,13 @@ package com.deepclone.lw.cmd.player.fleets; +import com.deepclone.lw.session.API; + public class MoveFleetsCommand extends MultiFleetsCommand { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String destination; private final Boolean mode; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MoveFleetsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MoveFleetsResponse.java index e524398..77f9631 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MoveFleetsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MoveFleetsResponse.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.player.fleets; import com.deepclone.lw.cmd.player.gdata.GamePageData; +import com.deepclone.lw.session.API; @@ -9,7 +10,7 @@ public class MoveFleetsResponse extends MultiFleetsResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private boolean error; private String destination; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MultiFleetsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MultiFleetsCommand.java index 4ebc86c..ef11bda 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MultiFleetsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MultiFleetsCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.fleets; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -8,7 +9,7 @@ import com.deepclone.lw.session.Command; public abstract class MultiFleetsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long fleets[]; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MultiFleetsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MultiFleetsResponse.java index 3728e18..a7bea2b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MultiFleetsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/MultiFleetsResponse.java @@ -7,6 +7,7 @@ import java.util.List; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.fleets.ShortFleetView; +import com.deepclone.lw.session.API; @@ -14,7 +15,7 @@ public abstract class MultiFleetsResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< ShortFleetView > fleets = new LinkedList< ShortFleetView >( ); diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/RenameFleetsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/RenameFleetsCommand.java index 95393e6..1dd1331 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/RenameFleetsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/RenameFleetsCommand.java @@ -1,11 +1,13 @@ package com.deepclone.lw.cmd.player.fleets; +import com.deepclone.lw.session.API; + public class RenameFleetsCommand extends MultiFleetsCommand { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean rename; private final String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/RenameFleetsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/RenameFleetsResponse.java index e20a569..d5b792d 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/RenameFleetsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/RenameFleetsResponse.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.player.fleets; import com.deepclone.lw.cmd.player.gdata.GamePageData; +import com.deepclone.lw.session.API; @@ -9,7 +10,7 @@ public class RenameFleetsResponse extends MultiFleetsResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private boolean error; private String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SetFleetsModeCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SetFleetsModeCommand.java index 3f44ab3..4a253bd 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SetFleetsModeCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SetFleetsModeCommand.java @@ -1,11 +1,13 @@ package com.deepclone.lw.cmd.player.fleets; +import com.deepclone.lw.session.API; + public class SetFleetsModeCommand extends MultiFleetsCommand { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean attack; private final boolean confirm; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SetFleetsModeResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SetFleetsModeResponse.java index edf245c..bc515ef 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SetFleetsModeResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SetFleetsModeResponse.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.player.fleets; import com.deepclone.lw.cmd.player.gdata.GamePageData; +import com.deepclone.lw.session.API; @@ -9,7 +10,7 @@ public class SetFleetsModeResponse extends MultiFleetsResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private boolean attack; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SplitFleetCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SplitFleetCommand.java index 686a3c2..dbdbacd 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SplitFleetCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SplitFleetCommand.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.player.fleets; import java.util.Map; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -11,7 +12,7 @@ public class SplitFleetCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long fleet; private final Map< Integer , Integer > ships; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SplitFleetResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SplitFleetResponse.java index 6351066..c59f9d2 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SplitFleetResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/SplitFleetResponse.java @@ -8,6 +8,7 @@ import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.fleets.ShortFleetView; import com.deepclone.lw.cmd.player.gdata.fleets.SplitShips; +import com.deepclone.lw.session.API; @@ -15,7 +16,7 @@ public class SplitFleetResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private ShortFleetView initialFleet; private final List< SplitShips > ships = new LinkedList< SplitShips >( ); diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/ViewFleetsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/ViewFleetsCommand.java index 67f33d3..ab631d1 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/ViewFleetsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/ViewFleetsCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.fleets; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class ViewFleetsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/ViewFleetsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/ViewFleetsResponse.java index d1c6484..2b53ce4 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/ViewFleetsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/fleets/ViewFleetsResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.fleets; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.fleets.FleetsView; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class ViewFleetsResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final FleetsView fleets; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/GamePageData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/GamePageData.java index 82e1767..16fdf2c 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/GamePageData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/GamePageData.java @@ -6,13 +6,15 @@ import java.util.Collections; import java.util.Date; import java.util.List; +import com.deepclone.lw.session.API; + public class GamePageData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String empire; private final Character special; private final String alliance; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/GameResponseBase.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/GameResponseBase.java index f535b9d..45de365 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/GameResponseBase.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/GameResponseBase.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.gdata; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.CommandResponse; @@ -9,7 +10,7 @@ public abstract class GameResponseBase extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final GamePageData page; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/GameTime.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/GameTime.java index ac2c9b1..9aa4302 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/GameTime.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/GameTime.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class GameTime implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int years; private final int weeks; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/NameIdPair.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/NameIdPair.java index 4bea9e4..11010d0 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/NameIdPair.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/NameIdPair.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class NameIdPair implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long id; private final String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/PlanetListData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/PlanetListData.java index 27c4571..4a1bf05 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/PlanetListData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/PlanetListData.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class PlanetListData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int id; private String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/PlanetReference.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/PlanetReference.java index fb111b3..277ff4f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/PlanetReference.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/PlanetReference.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class PlanetReference implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long identifier; private final String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/ShortBattleView.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/ShortBattleView.java index 111f17e..92ad295 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/ShortBattleView.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/ShortBattleView.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class ShortBattleView implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private long id; private long friendly; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/TimeCombo.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/TimeCombo.java index 4f180d2..891da10 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/TimeCombo.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/TimeCombo.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class TimeCombo implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private long ticks; private GameTime gameTime; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/AccountData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/AccountData.java index 8b94e01..8027ffa 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/AccountData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/AccountData.java @@ -8,6 +8,7 @@ import java.util.List; import com.deepclone.lw.cmd.ext.ListLanguagesResponse; import com.deepclone.lw.cmd.player.gdata.GameTime; +import com.deepclone.lw.session.API; @@ -15,7 +16,7 @@ public class AccountData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private String address; private int gameCredits; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/MailChangeData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/MailChangeData.java index 65957a1..f930ae4 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/MailChangeData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/MailChangeData.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.player.gdata.account; import java.io.Serializable; import java.sql.Timestamp; +import com.deepclone.lw.session.API; + public class MailChangeData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final Timestamp until; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/PrefCategory.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/PrefCategory.java index 6641104..0c4591b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/PrefCategory.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/PrefCategory.java @@ -5,13 +5,15 @@ import java.io.Serializable; import java.util.LinkedList; import java.util.List; +import com.deepclone.lw.session.API; + public class PrefCategory implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private String name; private List< PrefValue > preferences = new LinkedList< PrefValue >( ); diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/PrefChoice.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/PrefChoice.java index fe45669..54d9b83 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/PrefChoice.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/PrefChoice.java @@ -3,12 +3,14 @@ package com.deepclone.lw.cmd.player.gdata.account; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class PrefChoice implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private String value; private String display; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/PrefValue.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/PrefValue.java index 1ed93ed..a8b598a 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/PrefValue.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/account/PrefValue.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.player.gdata.account; import java.io.Serializable; import java.util.List; +import com.deepclone.lw.session.API; + public class PrefValue implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private String id; private String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceCreationStatus.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceCreationStatus.java index 241b5a3..19b52a2 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceCreationStatus.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceCreationStatus.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.gdata.alliance; import java.io.Serializable; import com.deepclone.lw.cmd.ObjectNameError; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class AllianceCreationStatus implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String tag; private final ObjectNameError tagError; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceData.java index 08b670c..442e7ce 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceData.java @@ -3,6 +3,8 @@ package com.deepclone.lw.cmd.player.gdata.alliance; import java.io.Serializable; +import com.deepclone.lw.session.API; + @@ -10,7 +12,7 @@ public class AllianceData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final PublicAllianceInformation main; private final AllianceMemberData member; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceLeaderData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceLeaderData.java index a5293df..fda58ba 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceLeaderData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceLeaderData.java @@ -5,6 +5,7 @@ import java.io.Serializable; import java.util.List; import com.deepclone.lw.cmd.player.gdata.NameIdPair; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class AllianceLeaderData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< NameIdPair > requests; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceMemberData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceMemberData.java index 48f35a3..ac147a8 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceMemberData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AllianceMemberData.java @@ -5,6 +5,7 @@ import java.io.Serializable; import java.util.List; import com.deepclone.lw.cmd.player.gdata.NameIdPair; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class AllianceMemberData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< NameIdPair > members; private final List< AlliancePlanetData > planets; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AlliancePlanetData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AlliancePlanetData.java index a17aa8a..b0acb87 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AlliancePlanetData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/AlliancePlanetData.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata.alliance; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class AlliancePlanetData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int id; private String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/PublicAllianceInformation.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/PublicAllianceInformation.java index 76463c1..ebee786 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/PublicAllianceInformation.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/alliance/PublicAllianceInformation.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata.alliance; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class PublicAllianceInformation implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int id; private final String tag; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleDescription.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleDescription.java index 22eed1e..80b8217 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleDescription.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleDescription.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.gdata.battles; import java.io.Serializable; import com.deepclone.lw.cmd.player.gdata.NameIdPair; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class BattleDescription implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private long id; private NameIdPair location; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleDisplay.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleDisplay.java index e6d94d0..4e1ea82 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleDisplay.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleDisplay.java @@ -6,6 +6,7 @@ import java.util.LinkedList; import java.util.List; import com.deepclone.lw.cmd.player.gdata.TimeCombo; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class BattleDisplay implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private TimeCombo current; private TimeCombo previous; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleEvent.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleEvent.java index 6e99a05..340be4b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleEvent.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleEvent.java @@ -5,13 +5,15 @@ import java.io.Serializable; import java.util.LinkedList; import java.util.List; +import com.deepclone.lw.session.API; + public class BattleEvent implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private BattleEventType type; private boolean planet; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleHistoryInterval.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleHistoryInterval.java index 7c15e5e..c2f5be5 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleHistoryInterval.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleHistoryInterval.java @@ -6,6 +6,7 @@ import java.util.LinkedList; import java.util.List; import com.deepclone.lw.cmd.player.gdata.TimeCombo; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class BattleHistoryInterval implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private TimeCombo begin; private boolean battleBegins; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleHistoryTick.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleHistoryTick.java index 526de4f..12929fe 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleHistoryTick.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleHistoryTick.java @@ -6,6 +6,7 @@ import java.util.LinkedList; import java.util.List; import com.deepclone.lw.cmd.player.gdata.TimeCombo; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class BattleHistoryTick implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final TimeCombo time; private final List< BattleEvent > events = new LinkedList< BattleEvent >( ); diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleListEntry.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleListEntry.java index aca40ad..fddda87 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleListEntry.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleListEntry.java @@ -5,6 +5,7 @@ import java.io.Serializable; import com.deepclone.lw.cmd.player.gdata.NameIdPair; import com.deepclone.lw.cmd.player.gdata.TimeCombo; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class BattleListEntry implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private long id; private NameIdPair location; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattlePlanetBuildings.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattlePlanetBuildings.java index d416dd1..2fc4cbe 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattlePlanetBuildings.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattlePlanetBuildings.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.player.gdata.battles; import com.deepclone.lw.cmd.player.gdata.PlanetRelationType; +import com.deepclone.lw.session.API; @@ -9,7 +10,7 @@ public class BattlePlanetBuildings extends BattleShipsList { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private PlanetRelationType relation; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattlePlayerShips.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattlePlayerShips.java index af042d8..66b2c38 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattlePlayerShips.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattlePlayerShips.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.player.gdata.battles; import com.deepclone.lw.cmd.player.gdata.NameIdPair; +import com.deepclone.lw.session.API; @@ -9,7 +10,7 @@ public class BattlePlayerShips extends BattleShipsList { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private NameIdPair player; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleShipType.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleShipType.java index 3133440..65d5129 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleShipType.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleShipType.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata.battles; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class BattleShipType implements Serializable , Comparable< BattleShipType > { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private String name; private long cAmount; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleShipsList.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleShipsList.java index 389771b..922d4c4 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleShipsList.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleShipsList.java @@ -5,13 +5,15 @@ import java.io.Serializable; import java.util.LinkedList; import java.util.List; +import com.deepclone.lw.session.API; + public abstract class BattleShipsList implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; protected List< BattleShipType > ships = new LinkedList< BattleShipType >( ); protected long cPower = 0; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleShipsView.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleShipsView.java index d38d726..bd7f6f2 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleShipsView.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleShipsView.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata.battles; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class BattleShipsView implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final BattlePlayerShips own = new BattlePlayerShips( ); private final BattleSideShips friendly = new BattleSideShips( false ); diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleSideShips.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleSideShips.java index 6dca7ad..613069f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleSideShips.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleSideShips.java @@ -5,13 +5,15 @@ import java.util.Collections; import java.util.LinkedList; import java.util.List; +import com.deepclone.lw.session.API; + public class BattleSideShips extends BattleShipsList { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean hostile; private final List< BattlePlayerShips > players = new LinkedList< BattlePlayerShips >( ); diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleView.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleView.java index c9fc728..31acef8 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleView.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/battles/BattleView.java @@ -5,13 +5,15 @@ import java.io.Serializable; import java.util.LinkedList; import java.util.List; +import com.deepclone.lw.session.API; + public class BattleView implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private BattleDescription description; private BattleDisplay display; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/OverviewData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/OverviewData.java index d82cc66..fabcfad 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/OverviewData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/OverviewData.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata.empire; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class OverviewData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private long planets; private int newMessages; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/ResearchData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/ResearchData.java new file mode 100644 index 0000000..5af296b --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/ResearchData.java @@ -0,0 +1,224 @@ +package com.deepclone.lw.cmd.player.gdata.empire; + + +import java.io.Serializable; + +import com.deepclone.lw.session.API; + + + +public class ResearchData + implements Serializable , Comparable< ResearchData > +{ + + private static final long serialVersionUID = API.Version; + + private final String identifier; + + private int completion; + + private String category; + private String name; + private String description; + + private Integer priority; + private Integer cost; + + private String[] dependsOn; + + + /** + * Create a research data record for a technology that hasn't been identified yet. + * + * @param numericId + * numeric identifier of the technology + * @param category + * name of the category the technology belongs to + * @param completion + * completion percentage + * @param priority + * research priority + */ + public ResearchData( int numericId , String category , int completion , int priority ) + { + this.identifier = "unknown-" + numericId; + this.completion = completion; + this.priority = priority; + this.category = category; + this.name = null; + this.description = null; + this.cost = null; + this.dependsOn = null; + } + + + /** + * Create a research data record for an identified technology that is still being researched. + * + * @param identifier + * technology identifier + * @param category + * name of the category the technology belongs to + * @param name + * name of the technology + * @param description + * description of the technology + * @param dependsOn + * identifiers of the technologies this technology depends on + * @param completion + * completion percentage + * @param priority + * research priority + */ + public ResearchData( String identifier , String category , String name , String description , String[] dependsOn , + int completion , int priority ) + { + this.identifier = identifier; + this.category = category; + this.name = name; + this.description = description; + this.dependsOn = dependsOn.clone( ); + this.completion = completion; + this.priority = priority; + this.cost = null; + } + + + /** + * Create a research data record for a technology that needs to be implemented. + * + * @param identifier + * technology identifier + * @param category + * name of the category the technology belongs to + * @param name + * name of the technology + * @param description + * description of the technology + * @param dependsOn + * identifiers of the technologies this technology depends on + * @param cost + * research priority + */ + public ResearchData( String identifier , String category , String name , String description , String[] dependsOn , + int cost ) + { + this.identifier = identifier; + this.category = category; + this.name = name; + this.description = description; + this.dependsOn = dependsOn.clone( ); + this.completion = 100; + this.priority = null; + this.cost = cost; + } + + + @Override + public int compareTo( ResearchData o ) + { + if ( this.cost != null && o.cost == null ) { + return -1; + } else if ( this.cost == null && o.cost != null ) { + return 1; + } else if ( this.name != null && o.name != null ) { + return this.name.compareTo( o.name ); + } else if ( this.name != null ) { + return -1; + } else if ( o.name != null ) { + return 1; + } + return this.identifier.compareTo( o.identifier ); + } + + + public int getCompletion( ) + { + return completion; + } + + + public void setCompletion( int completion ) + { + this.completion = completion; + } + + + public String getCategory( ) + { + return category; + } + + + public void setCategory( String category ) + { + this.category = category; + } + + + public String getName( ) + { + return name; + } + + + public void setName( String name ) + { + this.name = name; + } + + + public String getDescription( ) + { + return description; + } + + + public void setDescription( String description ) + { + this.description = description; + } + + + public Integer getPriority( ) + { + return priority; + } + + + public void setPriority( Integer priority ) + { + this.priority = priority; + } + + + public Integer getCost( ) + { + return cost; + } + + + public void setCost( Integer cost ) + { + this.cost = cost; + } + + + public String[] getDependsOn( ) + { + return dependsOn; + } + + + public void setDependsOn( String[] dependsOn ) + { + this.dependsOn = dependsOn; + } + + + public String getIdentifier( ) + { + return identifier; + } + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/ResearchLineData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/ResearchLineData.java deleted file mode 100644 index a48f027..0000000 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/ResearchLineData.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.deepclone.lw.cmd.player.gdata.empire; - - -import java.io.Serializable; -import java.util.Collections; -import java.util.List; - - - -public class ResearchLineData - implements Serializable , Comparable< ResearchLineData > -{ - - private static final long serialVersionUID = 1L; - - private final long id; - private final String name; - private final String description; - private final List< TechnologyData > implemented; - private final TechnologyData current; - - - public ResearchLineData( long id , String name , String description , List< TechnologyData > implemented , - TechnologyData current ) - { - this.id = id; - this.name = name; - this.description = description; - this.implemented = Collections.unmodifiableList( implemented ); - this.current = current; - } - - - @Override - public int compareTo( ResearchLineData other ) - { - return this.name.compareTo( other.name ); - } - - - public long getId( ) - { - return id; - } - - - public String getName( ) - { - return name; - } - - - public String getDescription( ) - { - return description; - } - - - public List< TechnologyData > getImplemented( ) - { - return implemented; - } - - - public TechnologyData getCurrent( ) - { - return current; - } - -} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/TechnologyCategoryData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/TechnologyCategoryData.java new file mode 100644 index 0000000..67d3dc1 --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/TechnologyCategoryData.java @@ -0,0 +1,55 @@ +package com.deepclone.lw.cmd.player.gdata.empire; + + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; + +import com.deepclone.lw.session.API; + + + +public class TechnologyCategoryData + implements Serializable , Comparable< TechnologyCategoryData > +{ + + private static final long serialVersionUID = API.Version; + + private final String name; + private final String description; + private final List< TechnologyData > technologies; + + + public TechnologyCategoryData( String name , String description , List< TechnologyData > technologies ) + { + this.name = name; + this.description = description; + this.technologies = new LinkedList< TechnologyData >( technologies ); + } + + + public String getName( ) + { + return this.name; + } + + + public String getDescription( ) + { + return this.description; + } + + + public List< TechnologyData > getTechnologies( ) + { + return this.technologies; + } + + + @Override + public int compareTo( TechnologyCategoryData o ) + { + return this.name.compareTo( o.name ); + } + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/TechnologyData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/TechnologyData.java index 7ea35f0..a598f72 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/TechnologyData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/empire/TechnologyData.java @@ -2,69 +2,71 @@ package com.deepclone.lw.cmd.player.gdata.empire; import java.io.Serializable; +import java.util.List; + +import com.deepclone.lw.session.API; public class TechnologyData - implements Serializable + implements Serializable , Comparable< TechnologyData > { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; + private final String identifier; private final String name; private final String description; - private final Integer researched; - private final Long cost; + + private final List< String > dependsOn; + private final List< String > dependencyOf; - public TechnologyData( String name , String description ) + public TechnologyData( String identifier , String name , String description , List< String > dependsOn , + List< String > dependencyOf ) { + this.identifier = identifier; this.name = name; this.description = description; - this.researched = null; - this.cost = null; + this.dependsOn = dependsOn; + this.dependencyOf = dependencyOf; } - public TechnologyData( String name , String description , int researched ) + public String getIdentifier( ) { - this.name = name; - this.description = description; - this.researched = researched; - this.cost = null; - } - - - public TechnologyData( String name , String description , int researched , long cost ) - { - this.name = name; - this.description = description; - this.researched = researched; - this.cost = cost; + return this.identifier; } public String getName( ) { - return name; + return this.name; } public String getDescription( ) { - return description; + return this.description; } - public Integer getResearched( ) + public List< String > getDependsOn( ) { - return researched; + return this.dependsOn; } - public Long getCost( ) + public List< String > getDependencyOf( ) { - return cost; + return this.dependencyOf; + } + + + @Override + public int compareTo( TechnologyData o ) + { + return this.name.compareTo( o.name ); } } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetLocation.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetLocation.java index 464936b..b3e259b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetLocation.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetLocation.java @@ -6,6 +6,7 @@ import java.util.List; import com.deepclone.lw.cmd.player.gdata.NameIdPair; import com.deepclone.lw.cmd.player.gdata.ShortBattleView; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class FleetLocation extends NameIdPair { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private boolean own; private boolean attacking; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetOwner.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetOwner.java index 2653142..d88bfed 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetOwner.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetOwner.java @@ -6,6 +6,7 @@ import java.util.List; import com.deepclone.lw.cmd.player.gdata.NameIdPair; import com.deepclone.lw.cmd.player.gdata.PlanetRelationType; +import com.deepclone.lw.session.API; @@ -15,7 +16,7 @@ public class FleetOwner extends NameIdPair { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final PlanetRelationType relation; private final List< StaticFleet > fleets = new LinkedList< StaticFleet >( ); diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetShips.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetShips.java index a29a8a6..074a691 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetShips.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetShips.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata.fleets; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class FleetShips implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int type; private String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetsView.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetsView.java index dc16fe4..3fbeed6 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetsView.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/FleetsView.java @@ -5,13 +5,15 @@ import java.io.Serializable; import java.util.LinkedList; import java.util.List; +import com.deepclone.lw.session.API; + public class FleetsView implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< FleetLocation > locations = new LinkedList< FleetLocation >( ); private final List< MovingFleet > moving = new LinkedList< MovingFleet >( ); diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/MovingFleet.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/MovingFleet.java index e37a38f..3bc0311 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/MovingFleet.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/MovingFleet.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.player.gdata.fleets; import com.deepclone.lw.cmd.player.gdata.GameTime; import com.deepclone.lw.cmd.player.gdata.NameIdPair; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class MovingFleet extends StaticFleet { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private long timeLeft; private boolean attacking; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/ShortFleetView.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/ShortFleetView.java index a19833a..4f273bd 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/ShortFleetView.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/ShortFleetView.java @@ -3,6 +3,7 @@ package com.deepclone.lw.cmd.player.gdata.fleets; import com.deepclone.lw.cmd.player.gdata.GameTime; import com.deepclone.lw.cmd.player.gdata.NameIdPair; +import com.deepclone.lw.session.API; @@ -10,7 +11,7 @@ public class ShortFleetView extends NameIdPair { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int flightTime; private GameTime gameFlightTime; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/SplitShips.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/SplitShips.java index b464387..f36a872 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/SplitShips.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/SplitShips.java @@ -1,11 +1,13 @@ package com.deepclone.lw.cmd.player.gdata.fleets; +import com.deepclone.lw.session.API; + public class SplitShips extends FleetShips { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int id; private int selectedAmount = 0; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/StaticFleet.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/StaticFleet.java index 32d9ac9..d07362d 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/StaticFleet.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/fleets/StaticFleet.java @@ -6,6 +6,7 @@ import java.util.List; import com.deepclone.lw.cmd.player.gdata.GameTime; import com.deepclone.lw.cmd.player.gdata.NameIdPair; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class StaticFleet extends NameIdPair { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private FleetStatus status; private long penalty; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/map/MapPlanetData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/map/MapPlanetData.java index 8a04d19..783db11 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/map/MapPlanetData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/map/MapPlanetData.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.gdata.map; import java.io.Serializable; import com.deepclone.lw.cmd.player.gdata.PlanetRelationType; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class MapPlanetData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final long id; private final int picture; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/map/MapSystemData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/map/MapSystemData.java index db7a54a..c9c9f7d 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/map/MapSystemData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/map/MapSystemData.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata.map; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class MapSystemData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final MapPlanetData planets[] = new MapPlanetData[ 5 ]; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildableBuildingData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildableBuildingData.java index 34c5ce6..25ce6f7 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildableBuildingData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildableBuildingData.java @@ -1,11 +1,13 @@ package com.deepclone.lw.cmd.player.gdata.planets; +import com.deepclone.lw.session.API; + public class BuildableBuildingData extends BuildableItemData { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int workers; private String prodType; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildableItemData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildableItemData.java index 5ae878e..32ab59d 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildableItemData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildableItemData.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.gdata.planets; import java.io.Serializable; import com.deepclone.lw.cmd.player.gdata.GameTime; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public abstract class BuildableItemData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int id; private String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildableShipData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildableShipData.java index 99c6d5b..6277e0f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildableShipData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildableShipData.java @@ -1,13 +1,14 @@ package com.deepclone.lw.cmd.player.gdata.planets; import com.deepclone.lw.cmd.player.gdata.GameTime; +import com.deepclone.lw.session.API; public class BuildableShipData extends BuildableItemData { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int power; private int flightTime; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildingData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildingData.java index 7647c24..c62df08 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildingData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/BuildingData.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata.planets; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class BuildingData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private Integer id; private String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/OwnPlanetStatusData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/OwnPlanetStatusData.java index 6013826..34bc000 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/OwnPlanetStatusData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/OwnPlanetStatusData.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.gdata.planets; import java.io.Serializable; import com.deepclone.lw.cmd.player.gdata.GameTime; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class OwnPlanetStatusData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private boolean abandonPossible; private boolean renamePossible; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/PlanetBasicView.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/PlanetBasicView.java index 31de86e..2e9adb4 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/PlanetBasicView.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/PlanetBasicView.java @@ -3,13 +3,15 @@ package com.deepclone.lw.cmd.player.gdata.planets; import java.io.Serializable; +import com.deepclone.lw.session.API; + public class PlanetBasicView implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String name; private final int picture; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/PlanetOrbitalView.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/PlanetOrbitalView.java index 5992b9c..fc48a1d 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/PlanetOrbitalView.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/PlanetOrbitalView.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.player.gdata.planets; import java.io.Serializable; import java.util.List; +import com.deepclone.lw.session.API; + public class PlanetOrbitalView implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private long population; private long defencePoints; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/PlanetOwnView.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/PlanetOwnView.java index a567a8e..b61f708 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/PlanetOwnView.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/PlanetOwnView.java @@ -4,13 +4,15 @@ package com.deepclone.lw.cmd.player.gdata.planets; import java.io.Serializable; import java.util.List; +import com.deepclone.lw.session.API; + public class PlanetOwnView implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private int happiness; private int hChange; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/QueueData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/QueueData.java index 8aad730..90f4610 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/QueueData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/QueueData.java @@ -5,13 +5,15 @@ import java.io.Serializable; import java.util.Collections; import java.util.List; +import com.deepclone.lw.session.API; + public class QueueData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean appendPossible; private final List< QueueItemData > items; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/QueueItemData.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/QueueItemData.java index a1000df..7de850f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/QueueItemData.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/gdata/planets/QueueItemData.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.gdata.planets; import java.io.Serializable; import com.deepclone.lw.cmd.player.gdata.GameTime; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class QueueItemData implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private String name; private String description; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ComposeMessageCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ComposeMessageCommand.java index 8d7a441..d655d6b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ComposeMessageCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ComposeMessageCommand.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.player.msgs; import com.deepclone.lw.cmd.msgdata.MessageType; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -10,7 +11,7 @@ public class ComposeMessageCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final Boolean inbox; private final Long replyTo; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ComposeMessageResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ComposeMessageResponse.java index 45b95c0..f9b82b2 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ComposeMessageResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ComposeMessageResponse.java @@ -5,6 +5,7 @@ import com.deepclone.lw.cmd.msgdata.Message; import com.deepclone.lw.cmd.msgdata.MessageType; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class ComposeMessageResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private MessageType messageType; private String target; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/GetMessagesCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/GetMessagesCommand.java index 92d24ef..3accf00 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/GetMessagesCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/GetMessagesCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.msgs; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class GetMessagesCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean inbox; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/GetMessagesResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/GetMessagesResponse.java index 09025bc..94b67a7 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/GetMessagesResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/GetMessagesResponse.java @@ -6,6 +6,7 @@ import java.util.List; import com.deepclone.lw.cmd.msgdata.MessageListEntry; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class GetMessagesResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< MessageListEntry > messages; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ListTargetsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ListTargetsCommand.java index 9809a62..5974e5b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ListTargetsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ListTargetsCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.msgs; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,6 +10,6 @@ public class ListTargetsCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ListTargetsResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ListTargetsResponse.java index 28aa092..6c5fd7f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ListTargetsResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ListTargetsResponse.java @@ -8,6 +8,7 @@ import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.NameIdPair; import com.deepclone.lw.cmd.player.gdata.alliance.PublicAllianceInformation; +import com.deepclone.lw.session.API; @@ -15,7 +16,7 @@ public class ListTargetsResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final List< NameIdPair > empires; private final List< PublicAllianceInformation > alliances; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/MessageBoxCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/MessageBoxCommand.java index 757cd99..8891e05 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/MessageBoxCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/MessageBoxCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.msgs; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class MessageBoxCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final MessageBoxAction action; private final boolean inbox; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/PrepareMessageCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/PrepareMessageCommand.java index 3abe09e..c6ce810 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/PrepareMessageCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/PrepareMessageCommand.java @@ -2,6 +2,7 @@ package com.deepclone.lw.cmd.player.msgs; import com.deepclone.lw.cmd.msgdata.MessageType; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -10,7 +11,7 @@ public class PrepareMessageCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final MessageType type; private final Long id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ReadMessageCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ReadMessageCommand.java index 1656175..e1bd6fc 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ReadMessageCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ReadMessageCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.msgs; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ReadMessageCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean inbox; private final long id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ReadMessageResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ReadMessageResponse.java index 436de68..fe110a9 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ReadMessageResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/msgs/ReadMessageResponse.java @@ -4,6 +4,7 @@ package com.deepclone.lw.cmd.player.msgs; import com.deepclone.lw.cmd.msgdata.Message; import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.GameResponseBase; +import com.deepclone.lw.session.API; @@ -11,7 +12,7 @@ public class ReadMessageResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean inbox; private final Message message; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/AbandonPlanetCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/AbandonPlanetCommand.java index 34711e2..149fd04 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/AbandonPlanetCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/AbandonPlanetCommand.java @@ -1,10 +1,12 @@ package com.deepclone.lw.cmd.player.planets; +import com.deepclone.lw.session.API; + public class AbandonPlanetCommand extends ViewPlanetCommand { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean cancel; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/BuildShipsCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/BuildShipsCommand.java index 62d8521..12c159b 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/BuildShipsCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/BuildShipsCommand.java @@ -1,11 +1,13 @@ package com.deepclone.lw.cmd.player.planets; +import com.deepclone.lw.session.API; + public class BuildShipsCommand extends ViewPlanetCommand { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int sType; private final int amount; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/BuildingActionCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/BuildingActionCommand.java index 4d7ec2b..53e985e 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/BuildingActionCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/BuildingActionCommand.java @@ -1,11 +1,13 @@ package com.deepclone.lw.cmd.player.planets; +import com.deepclone.lw.session.API; + public class BuildingActionCommand extends ViewPlanetCommand { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int bType; private final int amount; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/BuildingActionResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/BuildingActionResponse.java index 86a4daf..c1a30b8 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/BuildingActionResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/BuildingActionResponse.java @@ -5,6 +5,7 @@ import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.planets.PlanetBasicView; import com.deepclone.lw.cmd.player.gdata.planets.PlanetOrbitalView; import com.deepclone.lw.cmd.player.gdata.planets.PlanetOwnView; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class BuildingActionResponse extends ViewPlanetResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean destructionFailed; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/FlushQueueCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/FlushQueueCommand.java index d2e1b08..5a456e0 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/FlushQueueCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/FlushQueueCommand.java @@ -1,10 +1,12 @@ package com.deepclone.lw.cmd.player.planets; +import com.deepclone.lw.session.API; + public class FlushQueueCommand extends ViewPlanetCommand { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final boolean military; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/RenamePlanetCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/RenamePlanetCommand.java index 09a586d..d0153ce 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/RenamePlanetCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/RenamePlanetCommand.java @@ -1,11 +1,13 @@ package com.deepclone.lw.cmd.player.planets; +import com.deepclone.lw.session.API; + public class RenamePlanetCommand extends ViewPlanetCommand { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String name; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/RenamePlanetResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/RenamePlanetResponse.java index 9073eb6..52b65e0 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/RenamePlanetResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/RenamePlanetResponse.java @@ -5,6 +5,7 @@ import com.deepclone.lw.cmd.player.gdata.GamePageData; import com.deepclone.lw.cmd.player.gdata.planets.PlanetBasicView; import com.deepclone.lw.cmd.player.gdata.planets.PlanetOrbitalView; import com.deepclone.lw.cmd.player.gdata.planets.PlanetOwnView; +import com.deepclone.lw.session.API; @@ -12,7 +13,7 @@ public class RenamePlanetResponse extends ViewPlanetResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final String renamingTo; private final String renameError; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/ViewPlanetCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/ViewPlanetCommand.java index b3d1137..c4c7a6f 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/ViewPlanetCommand.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/ViewPlanetCommand.java @@ -1,6 +1,7 @@ package com.deepclone.lw.cmd.player.planets; +import com.deepclone.lw.session.API; import com.deepclone.lw.session.Command; @@ -9,7 +10,7 @@ public class ViewPlanetCommand extends Command { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final int id; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/ViewPlanetResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/ViewPlanetResponse.java index 6761652..03c4810 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/ViewPlanetResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/planets/ViewPlanetResponse.java @@ -6,6 +6,7 @@ import com.deepclone.lw.cmd.player.gdata.GameResponseBase; import com.deepclone.lw.cmd.player.gdata.planets.PlanetBasicView; import com.deepclone.lw.cmd.player.gdata.planets.PlanetOrbitalView; import com.deepclone.lw.cmd.player.gdata.planets.PlanetOwnView; +import com.deepclone.lw.session.API; @@ -13,7 +14,7 @@ public class ViewPlanetResponse extends GameResponseBase { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private final Integer id; private final boolean ownershipError; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ImplementTechCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ImplementTechCommand.java new file mode 100644 index 0000000..d5187ac --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ImplementTechCommand.java @@ -0,0 +1,29 @@ +package com.deepclone.lw.cmd.player.research; + + +import com.deepclone.lw.session.API; +import com.deepclone.lw.session.Command; + + + +public class ImplementTechCommand + extends Command +{ + + private static final long serialVersionUID = API.Version; + + private final String tech; + + + public ImplementTechCommand( String tech ) + { + this.tech = tech; + } + + + public String getTech( ) + { + return tech; + } + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ResearchOperationResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ResearchOperationResponse.java new file mode 100644 index 0000000..9be7842 --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ResearchOperationResponse.java @@ -0,0 +1,87 @@ +package com.deepclone.lw.cmd.player.research; + + +import java.util.ArrayList; +import java.util.List; + +import com.deepclone.lw.cmd.player.gdata.GamePageData; +import com.deepclone.lw.cmd.player.gdata.empire.ResearchData; +import com.deepclone.lw.cmd.player.gdata.empire.TechnologyCategoryData; +import com.deepclone.lw.session.API; + + + +/** + * Response to a research operation ({@link SetResearchPrioritiesCommand} or + * {@link ImplementTechCommand}). When the operation was successful, the response does not carry any + * actual data; when an error occurs, however, it includes the standard research view. + * + * @author tseeker + */ +public class ResearchOperationResponse + extends ViewResearchResponse +{ + + private static final long serialVersionUID = API.Version; + + /** + * Possible results of the operation + */ + public static enum Result { + /** The operation succeeded */ + OK , + + /** Not enough resources (when the command was {@link ImplementTechCommand}) */ + ERR_RESOURCES , + + /** + * Technology already implemented (when the command was {@link ImplementTechCommand}) or + * list of research topics modified (when the command was + * {@link SetResearchPrioritiesCommand}). + */ + ERR_STATE_CHANGED , + + /** Invalid priority values (total is not 100, negative values, etc...) */ + ERR_INVALID + } + + /** Result of the operation */ + private final Result result; + + + /** Create a response indicating a successful operation */ + public ResearchOperationResponse( ) + { + super( null , new ArrayList< ResearchData >( ) , new ArrayList< TechnologyCategoryData >( ) ); + this.result = Result.OK; + } + + + /** + * Create a response indicating an error during the operation. + * + * @param page + * the basic page information + * @param research + * the list of research topics + * @param implemented + * the list of implemented technologies + * @param result + * the error code. + */ + public ResearchOperationResponse( GamePageData page , List< ResearchData > research , + List< TechnologyCategoryData > implemented , Result result ) + { + super( page , research , implemented ); + assert ( result != Result.OK ); + this.result = result; + } + + + /** @return the result of the operation */ + public Result getResult( ) + { + return result; + } + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/SetResearchPrioritiesCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/SetResearchPrioritiesCommand.java new file mode 100644 index 0000000..44134a7 --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/SetResearchPrioritiesCommand.java @@ -0,0 +1,32 @@ +package com.deepclone.lw.cmd.player.research; + + +import java.util.HashMap; +import java.util.Map; + +import com.deepclone.lw.session.API; +import com.deepclone.lw.session.Command; + + + +public class SetResearchPrioritiesCommand + extends Command +{ + + private static final long serialVersionUID = API.Version; + + private final Map< String , Integer > priorities; + + + public SetResearchPrioritiesCommand( Map< String , Integer > priorities ) + { + this.priorities = new HashMap< String , Integer >( priorities ); + } + + + public Map< String , Integer > getPriorities( ) + { + return priorities; + } + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ViewResearchCommand.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ViewResearchCommand.java new file mode 100644 index 0000000..66c8cf6 --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ViewResearchCommand.java @@ -0,0 +1,15 @@ +package com.deepclone.lw.cmd.player.research; + + +import com.deepclone.lw.session.API; +import com.deepclone.lw.session.Command; + + + +public class ViewResearchCommand + extends Command +{ + + private static final long serialVersionUID = API.Version; + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ViewResearchResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ViewResearchResponse.java new file mode 100644 index 0000000..c11df9d --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/cmd/player/research/ViewResearchResponse.java @@ -0,0 +1,45 @@ +package com.deepclone.lw.cmd.player.research; + + +import java.util.Collections; +import java.util.List; + +import com.deepclone.lw.cmd.player.gdata.GamePageData; +import com.deepclone.lw.cmd.player.gdata.GameResponseBase; +import com.deepclone.lw.cmd.player.gdata.empire.ResearchData; +import com.deepclone.lw.cmd.player.gdata.empire.TechnologyCategoryData; +import com.deepclone.lw.session.API; + + + +public class ViewResearchResponse + extends GameResponseBase +{ + + private static final long serialVersionUID = API.Version; + + private final List< ResearchData > research; + private final List< TechnologyCategoryData > implementedTechnologies; + + + public ViewResearchResponse( GamePageData page , List< ResearchData > research , + List< TechnologyCategoryData > implemented ) + { + super( page ); + this.research = Collections.unmodifiableList( research ); + this.implementedTechnologies = Collections.unmodifiableList( implemented ); + } + + + public List< ResearchData > getResearch( ) + { + return this.research; + } + + + public List< TechnologyCategoryData > getImplementedTechnologies( ) + { + return this.implementedTechnologies; + } + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/session/API.java b/legacyworlds-session/src/main/java/com/deepclone/lw/session/API.java new file mode 100644 index 0000000..84e513e --- /dev/null +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/session/API.java @@ -0,0 +1,15 @@ +package com.deepclone.lw.session; + + +public final class API +{ + + public static final long Version = 0x005099002; + + /* Prevent construction */ + private API( ) + { + // EMPTY + } + +} diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/session/Command.java b/legacyworlds-session/src/main/java/com/deepclone/lw/session/Command.java index 5733eae..419f17d 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/session/Command.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/session/Command.java @@ -8,7 +8,7 @@ import java.io.Serializable; public abstract class Command implements Serializable { - - private static final long serialVersionUID = 1L; + + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/session/CommandResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/session/CommandResponse.java index bef3cd8..f9d0eaf 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/session/CommandResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/session/CommandResponse.java @@ -9,6 +9,6 @@ public abstract class CommandResponse implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/session/NullResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/session/NullResponse.java index a7f44ab..19dfc94 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/session/NullResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/session/NullResponse.java @@ -5,6 +5,6 @@ public final class NullResponse extends CommandResponse { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; } diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionCommandException.java b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionCommandException.java index bc53083..671f59c 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionCommandException.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionCommandException.java @@ -5,7 +5,7 @@ public class SessionCommandException extends SessionException { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public SessionCommandException( String message ) diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionException.java b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionException.java index 8490fb9..708fdf9 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionException.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionException.java @@ -5,7 +5,7 @@ public abstract class SessionException extends Exception { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; private boolean keepSession; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionIdentifierException.java b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionIdentifierException.java index 4273f76..3218562 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionIdentifierException.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionIdentifierException.java @@ -10,7 +10,7 @@ public final class SessionIdentifierException extends SessionException { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public SessionIdentifierException( String identifier ) diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionInternalException.java b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionInternalException.java index 42474ee..f0b1614 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionInternalException.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionInternalException.java @@ -10,7 +10,7 @@ public final class SessionInternalException extends SessionException { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public SessionInternalException( boolean keep , Throwable cause ) diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionReference.java b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionReference.java index 4e7fb70..7605943 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionReference.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionReference.java @@ -19,7 +19,7 @@ public final class SessionReference implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; /** String identifier of the session */ public final String identifier; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionResponse.java b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionResponse.java index 6071671..2ebc3ac 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionResponse.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionResponse.java @@ -14,7 +14,7 @@ public class SessionResponse implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; /** Updated session reference */ public final SessionReference session; diff --git a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionStateException.java b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionStateException.java index eaa69e5..45ed6e0 100644 --- a/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionStateException.java +++ b/legacyworlds-session/src/main/java/com/deepclone/lw/session/SessionStateException.java @@ -10,7 +10,7 @@ public final class SessionStateException extends SessionException { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = API.Version; public SessionStateException( ) diff --git a/legacyworlds-utils/pom.xml b/legacyworlds-utils/pom.xml index 195d0d6..cf05448 100644 --- a/legacyworlds-utils/pom.xml +++ b/legacyworlds-utils/pom.xml @@ -4,12 +4,12 @@ legacyworlds com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-utils - 5.99.1 + 5.99.2 Legacy Worlds common utilities The classes in this package are used by all parts of the Legacy Worlds code. diff --git a/legacyworlds-web/legacyworlds-web-admin/WebContent/WEB-INF/fm/types/technologies.ftl b/legacyworlds-web/legacyworlds-web-admin/WebContent/WEB-INF/fm/types/technologies.ftl new file mode 100644 index 0000000..dd03803 --- /dev/null +++ b/legacyworlds-web/legacyworlds-web-admin/WebContent/WEB-INF/fm/types/technologies.ftl @@ -0,0 +1,22 @@ +<@page title="Technologies"> +

Technologies

+ <#if data.categories?size == 0> +

No technologies have been defined.

+ <#else> + <#list data.categories as category> +
  • Category ${category.name?xhtml} + (edit) + <#if category.techs?size == 0> +
    • No technologies in this category.
    + <#else> +
      + <#list category.techs as tech> +
    • ${tech?xhtml}
    • + +
    + +
+

 

+ + + \ No newline at end of file diff --git a/legacyworlds-web/legacyworlds-web-admin/WebContent/WEB-INF/fm/version.ftl b/legacyworlds-web/legacyworlds-web-admin/WebContent/WEB-INF/fm/version.ftl index c9406cf..e4abdb7 100644 --- a/legacyworlds-web/legacyworlds-web-admin/WebContent/WEB-INF/fm/version.ftl +++ b/legacyworlds-web/legacyworlds-web-admin/WebContent/WEB-INF/fm/version.ftl @@ -1,2 +1,2 @@ -<#macro version>Milestone 1 -<#macro full_version>Beta 6 milestone 1 (5.99.1) \ No newline at end of file +<#macro version>Milestone 2 +<#macro full_version>Beta 6 milestone 2 (5.99.2) \ No newline at end of file diff --git a/legacyworlds-web/legacyworlds-web-admin/pom.xml b/legacyworlds-web/legacyworlds-web-admin/pom.xml index 5d1f361..824b028 100644 --- a/legacyworlds-web/legacyworlds-web-admin/pom.xml +++ b/legacyworlds-web/legacyworlds-web-admin/pom.xml @@ -4,12 +4,12 @@ legacyworlds-web com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-web-admin - 5.99.1 + 5.99.2 war Legacy Worlds administration site diff --git a/legacyworlds-web/legacyworlds-web-admin/src/main/java/com/deepclone/lw/web/admin/TechnologyPages.java b/legacyworlds-web/legacyworlds-web-admin/src/main/java/com/deepclone/lw/web/admin/TechnologyPages.java new file mode 100644 index 0000000..ff32e08 --- /dev/null +++ b/legacyworlds-web/legacyworlds-web-admin/src/main/java/com/deepclone/lw/web/admin/TechnologyPages.java @@ -0,0 +1,37 @@ +package com.deepclone.lw.web.admin; + + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; + +import com.deepclone.lw.cmd.admin.techs.ListCategoriesResponse; +import com.deepclone.lw.session.SessionException; +import com.deepclone.lw.web.beans.intercept.SessionRequirement; +import com.deepclone.lw.web.beans.session.SessionMaintenanceException; +import com.deepclone.lw.web.beans.session.SessionServerException; +import com.deepclone.lw.web.beans.view.PageControllerBase; +import com.deepclone.lw.web.csess.AdminSession; + + + +@Controller +@SessionRequirement( value = true , subType = "main" , redirectTo = "admin-session" ) +public class TechnologyPages + extends PageControllerBase +{ + + @RequestMapping( "/techs" ) + public String viewStatus( HttpServletRequest request , Model model ) + throws SessionException , SessionServerException , SessionMaintenanceException + { + ListCategoriesResponse response = this.getSession( AdminSession.class , request ).getTechList( ); + if ( !response.isPrivilegeOk( ) ) { + return this.redirect( "main" ); + } + return this.render( model , "internal" , "en" , "technologies" , response ); + } + +} diff --git a/legacyworlds-web/legacyworlds-web-beans/pom.xml b/legacyworlds-web/legacyworlds-web-beans/pom.xml index 5560487..faef876 100644 --- a/legacyworlds-web/legacyworlds-web-beans/pom.xml +++ b/legacyworlds-web/legacyworlds-web-beans/pom.xml @@ -4,12 +4,12 @@ legacyworlds-web com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-web-beans - 5.99.1 + 5.99.2 Legacy Worlds common web beans Module for common web-related beans. jar diff --git a/legacyworlds-web/legacyworlds-web-beans/src/main/java/com/deepclone/lw/web/csess/AdminSession.java b/legacyworlds-web/legacyworlds-web-beans/src/main/java/com/deepclone/lw/web/csess/AdminSession.java index 2f89e3e..cd5522b 100644 --- a/legacyworlds-web/legacyworlds-web-beans/src/main/java/com/deepclone/lw/web/csess/AdminSession.java +++ b/legacyworlds-web/legacyworlds-web-beans/src/main/java/com/deepclone/lw/web/csess/AdminSession.java @@ -17,6 +17,8 @@ import com.deepclone.lw.cmd.admin.msg.*; import com.deepclone.lw.cmd.admin.naming.*; import com.deepclone.lw.cmd.admin.prefs.*; import com.deepclone.lw.cmd.admin.su.*; +import com.deepclone.lw.cmd.admin.techs.ListCategoriesCommand; +import com.deepclone.lw.cmd.admin.techs.ListCategoriesResponse; import com.deepclone.lw.cmd.admin.tick.*; import com.deepclone.lw.cmd.admin.users.*; import com.deepclone.lw.cmd.bt.*; @@ -539,4 +541,13 @@ public class AdminSession this.execute( new EndMaintenanceCommand( ) ); } + + /* Technology graph */ + + public ListCategoriesResponse getTechList( ) + throws SessionException , SessionServerException , SessionMaintenanceException + { + return (ListCategoriesResponse) this.execute( new ListCategoriesCommand( ) ); + } + } diff --git a/legacyworlds-web/legacyworlds-web-beans/src/main/java/com/deepclone/lw/web/csess/PlayerSession.java b/legacyworlds-web/legacyworlds-web-beans/src/main/java/com/deepclone/lw/web/csess/PlayerSession.java index 1cc1607..70559b6 100644 --- a/legacyworlds-web/legacyworlds-web-beans/src/main/java/com/deepclone/lw/web/csess/PlayerSession.java +++ b/legacyworlds-web/legacyworlds-web-beans/src/main/java/com/deepclone/lw/web/csess/PlayerSession.java @@ -17,6 +17,11 @@ import com.deepclone.lw.cmd.player.elist.*; import com.deepclone.lw.cmd.player.fleets.*; import com.deepclone.lw.cmd.player.gdata.*; import com.deepclone.lw.cmd.player.planets.*; +import com.deepclone.lw.cmd.player.research.ImplementTechCommand; +import com.deepclone.lw.cmd.player.research.ResearchOperationResponse; +import com.deepclone.lw.cmd.player.research.SetResearchPrioritiesCommand; +import com.deepclone.lw.cmd.player.research.ViewResearchCommand; +import com.deepclone.lw.cmd.player.research.ViewResearchResponse; import com.deepclone.lw.cmd.player.msgs.*; import com.deepclone.lw.session.Command; import com.deepclone.lw.session.SessionException; @@ -69,7 +74,7 @@ public class PlayerSession } - /* Empire commands */ + /* Overview */ public EmpireResponse getOverview( ) throws SessionException , SessionServerException , SessionMaintenanceException @@ -78,10 +83,26 @@ public class PlayerSession } - public EmpireResponse implementTechnology( int technology ) + /* Technologies */ + + public ViewResearchResponse viewResearch( ) throws SessionException , SessionServerException , SessionMaintenanceException { - return (EmpireResponse) this.execute( new ImplementTechCommand( technology ) ); + return (ViewResearchResponse) this.execute( new ViewResearchCommand( ) ); + } + + + public ResearchOperationResponse implementTechnology( String technology ) + throws SessionException , SessionServerException , SessionMaintenanceException + { + return (ResearchOperationResponse) this.execute( new ImplementTechCommand( technology ) ); + } + + + public ResearchOperationResponse setResearchPriorities( Map< String , Integer > priorities ) + throws SessionException , SessionServerException , SessionMaintenanceException + { + return (ResearchOperationResponse) this.execute( new SetResearchPrioritiesCommand( priorities ) ); } diff --git a/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/en/static/home.ftl b/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/en/static/home.ftl index a9dedfb..cc4a22b 100644 --- a/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/en/static/home.ftl +++ b/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/en/static/home.ftl @@ -1,4 +1,4 @@ -<@page title="Legacy Worlds Beta 6 - Milestone 1"> +<@page title="Legacy Worlds Beta 6 - Milestone 2">

Welcome to the first milestone release for Legacy Worlds' Beta 6.

diff --git a/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/en/types/overview.ftl b/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/en/types/overview.ftl index af04b79..b923794 100644 --- a/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/en/types/overview.ftl +++ b/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/en/types/overview.ftl @@ -2,7 +2,6 @@ <@page title="Empire"> <#assign ov = data.overview > - <#assign rs = data.research > <@tabs> @@ -61,56 +60,6 @@ - - <@tab id="research" title="Research"> - <#if rs?size == 0> -

Our scientists are still settling in.

- - <#list rs as research> -
-

${research.name?xhtml}

-

${research.description?xhtml}

- - <@left_column> - <#if research.implemented?size == 0> -

No usable technologies.

- <#else> - <@dt_main> - <#list research.implemented as tech> - <@dt_status> - ${tech.name?xhtml} -
${tech.description?xhtml}
- - - - - - - <#if research.current?has_content> - <@right_column> - <@dt_main> - <@dt_status> - Current research: ${research.current.name?xhtml} -

- ${research.current.description?xhtml} -

- - <@dt_entry title="Progress">${research.current.researched}% - <#if research.current.cost?has_content> - <@dt_entry title="Cost">${research.current.cost?string(",##0")} <@abbr_bgc/> - <#if data.page.cash gte research.current.cost && data.page.special! != 'v'> - <@dt_status>
-
<@ff_submit label="Implement technology" />
-
- - - - - - -
- - diff --git a/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/en/types/technologies.ftl b/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/en/types/technologies.ftl new file mode 100644 index 0000000..954dfe8 --- /dev/null +++ b/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/en/types/technologies.ftl @@ -0,0 +1,171 @@ +<#macro render_entry identifier title category description> +
+
${title?xhtml}
+
Category: ${category?xhtml}
+
${description?xhtml}
+ <#nested> +
+ +<#macro render_implementable entry> + <@render_entry entry.identifier entry.name entry.category entry.description> +
Cost: ${entry.cost?string(",##0")} <@abbr_bgc/>
+ <#if data.page.cash >= entry.cost> +
+ + +
+ + + +<#macro render_research entry title description display_priority_form> + <@render_entry entry.identifier title entry.category description> +
Progress: ${entry.completion}%
+ <#if display_priority_form> +
+ Priority: + + % + +
+ + + +<#macro render_unidentified entry display_priority_form> + <@render_research entry "Unidentified technology" "Our researchers are working on something new, but they have no clue where it will lead at this time." display_priority_form /> + +<#macro render_research_list entries> + <#local priority_form_started = false> + <#local priority_form_checked = false> + <#local display_priority_form = false> + <#local counter = 0> + <#-- List of in-progress research topics as well as implementable technologies --> + <#list entries as entry> + <#if entry.cost?has_content> + <#-- Technology that can be implemented --> + <#local counter = counter + 1> + <@render_implementable entry /> + <#else> + <#if ! priority_form_checked> + <#-- Check whether we need to display the priority form --> + <#if entries?size - counter > 1> + <#local display_priority_form = true> + + <#local priority_form_checked = true> + + <#-- Start of the research priority form, if necessary --> + <#if display_priority_form && ! priority_form_started> + <#local priority_form_started = true> +
+ + <#if entry.name?has_content> + <#-- Identified technology being researched --> + <@render_research entry entry.name entry.description display_priority_form /> + <#else> + <#-- Unidentified technology --> + <@render_unidentified entry display_priority_form /> + + + + <#-- End of the research priority form, if necessary --> + <#if priority_form_started> +
+ +
+
+ + +<#macro find_tech_name id lists> + <#local found=false> + <#list lists as cat> + <#list cat.technologies as tech> + <#if tech.identifier == id><#local found=true>${tech.name?xhtml}<#break> + + <#if found><#break> + + +<#macro render_tech_dependencies deps fullLists> + + +<#macro render_technology tech fullList> +
+
${tech.name?xhtml}
+
+

${tech.description?xhtml}

+
+ + <#if tech.dependsOn?size != 0> +
+ Depends on: + <@render_tech_dependencies tech.dependsOn fullList /> +
+ + + <#if tech.dependencyOf?size != 0> +
+ Required by: + <@render_tech_dependencies tech.dependencyOf fullList /> +
+ + +
+ +<#macro render_tech_list categories> + <#-- List categories --> + <#list categories as category> +
+

${category.name?xhtml}

+

${category.description?xhtml}

+ <#-- List technologies in the category --> + <#list category.technologies as technology> + <@render_technology technology categories /> + +
+ + +<#macro render> +<@page title="Technologies"> + + <#if data.research?size == 0 && data.implementedTechnologies?size == 0> +

Our scientists are still settling in, please come back in a little while...

+ <#return> + + + <@tabs> + + <#if data.research?size != 0> + <@tab id="research" title="Research"> + <#if data.result?exists> + <#switch data.result> + <#case "ERR_RESOURCES"> + <@standalone_error>We do not possess the necessary resources anymore. + <#break> + <#case "ERR_STATE_CHANGED"> + <@standalone_error>Something changed... Please try again. + <#break> + <#case "ERR_INVALID"> + <@standalone_error>Invalid priorities. + <#break> + <#default> + <#-- Ignore other error codes --> + <#break> + + + <#-- Render the list --> + <@render_research_list data.research /> + + + + <#if data.implementedTechnologies?size != 0> + <@tab id="implemented" title="Implemented technologies"> + <@render_tech_list data.implementedTechnologies /> + + + + + + + \ No newline at end of file diff --git a/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/fr/types/overview.ftl b/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/fr/types/overview.ftl index 919f8e9..61bdda4 100644 --- a/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/fr/types/overview.ftl +++ b/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/fr/types/overview.ftl @@ -2,7 +2,6 @@ <@page title="Empire"> <#assign ov = data.overview > - <#assign rs = data.research > <@tabs> @@ -61,56 +60,6 @@ - - <@tab id="research" title="Recherche"> - <#if rs?size == 0> -

Nos scientifiques sont encore en train de s'installer.

- - <#list rs as research> -
-

${research.name?xhtml}

-

${research.description?xhtml}

- - <@left_column> - <#if research.implemented?size == 0> -

Aucune technologie utilisable.

- <#else> - <@dt_main> - <#list research.implemented as tech> - <@dt_status> - ${tech.name?xhtml} -
${tech.description?xhtml}
- - - - - - - <#if research.current?has_content> - <@right_column> - <@dt_main> - <@dt_status> - Recherche actuelle : ${research.current.name?xhtml} -

- ${research.current.description?xhtml} -

- - <@dt_entry title="Progression">${research.current.researched}% - <#if research.current.cost?has_content> - <@dt_entry title="Coût">${research.current.cost?string(",##0")} <@abbr_bgc/> - <#if data.page.cash gte research.current.cost && data.page.special! != 'v'> - <@dt_status>
-
<@ff_submit label="Appliquer la technologie" />
-
- - - - - - -
- - diff --git a/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/fr/types/technologies.ftl b/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/fr/types/technologies.ftl new file mode 100644 index 0000000..5ae9fc6 --- /dev/null +++ b/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/fr/types/technologies.ftl @@ -0,0 +1,171 @@ +<#macro render_entry identifier title category description> +
+
${title?xhtml}
+
Catégorie: ${category?xhtml}
+
${description?xhtml}
+ <#nested> +
+ +<#macro render_implementable entry> + <@render_entry entry.identifier entry.name entry.category entry.description> +
Coût: ${entry.cost?string(",##0")} <@abbr_bgc/>
+ <#if data.page.cash >= entry.cost> +
+ + +
+ + + +<#macro render_research entry title description display_priority_form> + <@render_entry entry.identifier title entry.category description> +
Progrès: ${entry.completion}%
+ <#if display_priority_form> +
+ Priorité: + + % + +
+ + + +<#macro render_unidentified entry display_priority_form> + <@render_research entry "Technologie non identifiée" "Nos chercheurs travaillent sur une nouvelle technologie, mais ne savent pas encore où leurs travaux les mèneront." display_priority_form /> + +<#macro render_research_list entries> + <#local priority_form_started = false> + <#local priority_form_checked = false> + <#local display_priority_form = false> + <#local counter = 0> + <#-- List of in-progress research topics as well as implementable technologies --> + <#list entries as entry> + <#if entry.cost?has_content> + <#-- Technology that can be implemented --> + <#local counter = counter + 1> + <@render_implementable entry /> + <#else> + <#if ! priority_form_checked> + <#-- Check whether we need to display the priority form --> + <#if entries?size - counter > 1> + <#local display_priority_form = true> + + <#local priority_form_checked = true> + + <#-- Start of the research priority form, if necessary --> + <#if display_priority_form && ! priority_form_started> + <#local priority_form_started = true> +
+ + <#if entry.name?has_content> + <#-- Identified technology being researched --> + <@render_research entry entry.name entry.description display_priority_form /> + <#else> + <#-- Unidentified technology --> + <@render_unidentified entry display_priority_form /> + + + + <#-- End of the research priority form, if necessary --> + <#if priority_form_started> +
+ +
+
+ + +<#macro find_tech_name id lists> + <#local found=false> + <#list lists as cat> + <#list cat.technologies as tech> + <#if tech.identifier == id><#local found=true>${tech.name?xhtml}<#break> + + <#if found><#break> + + +<#macro render_tech_dependencies deps fullLists> + + +<#macro render_technology tech fullList> +
+
${tech.name?xhtml}
+
+

${tech.description?xhtml}

+
+ + <#if tech.dependsOn?size != 0> +
+ Dépend de: + <@render_tech_dependencies tech.dependsOn fullList /> +
+ + + <#if tech.dependencyOf?size != 0> +
+ Requise par: + <@render_tech_dependencies tech.dependencyOf fullList /> +
+ + +
+ +<#macro render_tech_list categories> + <#-- List categories --> + <#list categories as category> +
+

${category.name?xhtml}

+

${category.description?xhtml}

+ <#-- List technologies in the category --> + <#list category.technologies as technology> + <@render_technology technology categories /> + +
+ + +<#macro render> +<@page title="Technologies"> + + <#if data.research?size == 0 && data.implementedTechnologies?size == 0> +

Nos chercheurs sont encore en train de s'installer, revenez dans un petit moment...

+ <#return> + + + <@tabs> + + <#if data.research?size != 0> + <@tab id="research" title="Recherche"> + <#if data.result?exists> + <#switch data.result> + <#case "ERR_RESOURCES"> + <@standalone_error>Nous ne possédons plus les ressources nécessaires. + <#break> + <#case "ERR_STATE_CHANGED"> + <@standalone_error>Quelque chose a changé... Veuillez réessayer. + <#break> + <#case "ERR_INVALID"> + <@standalone_error>Priorités invalides. + <#break> + <#default> + <#-- Ignore other error codes --> + <#break> + + + <#-- Render the list --> + <@render_research_list data.research /> + + + + <#if data.implementedTechnologies?size != 0> + <@tab id="implemented" title="Technologies maîtrisées"> + <@render_tech_list data.implementedTechnologies /> + + + + + + + \ No newline at end of file diff --git a/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/version.ftl b/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/version.ftl index c9406cf..e4abdb7 100644 --- a/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/version.ftl +++ b/legacyworlds-web/legacyworlds-web-main/WebContent/WEB-INF/fm/version.ftl @@ -1,2 +1,2 @@ -<#macro version>Milestone 1 -<#macro full_version>Beta 6 milestone 1 (5.99.1) \ No newline at end of file +<#macro version>Milestone 2 +<#macro full_version>Beta 6 milestone 2 (5.99.2) \ No newline at end of file diff --git a/legacyworlds-web/legacyworlds-web-main/WebContent/css/main.css b/legacyworlds-web/legacyworlds-web-main/WebContent/css/main.css index 48ff3b4..40af4ab 100644 --- a/legacyworlds-web/legacyworlds-web-main/WebContent/css/main.css +++ b/legacyworlds-web/legacyworlds-web-main/WebContent/css/main.css @@ -839,4 +839,61 @@ tr.alliance-msg * { tr.empire-msg * { color: #afafaf; +} + +/* Research and technologies */ +div.research-entry { + padding: 0 0 15px 0; +} + +div.research-entry div { + padding: 0 0 0 20px; +} + +div.research-entry div.title { + color: white; + font-size: 110%; + font-weight: bold; + padding: 0; +} + +div.research-entry div.description { + padding: 0 0 5px 20px; + font-style: italic; +} + +div.research-entry div.progress { + padding: 0 0 5px 20px; +} + +div.research-entry span.progress { + font-weight: bold; + color: white; +} + +div.research-entry form.implement { + padding: 5px 0 0 40px; +} + +div.tech-category { + padding: 0 0 15px 0; +} + +div.technology { + padding: 15px 0 0 20px; +} + +div.technology div { + padding: 0 0 0 20px; +} + +div.technology div.title { + color: white; + font-size: 105%; + font-weight: bold; + padding: 0; +} + +div.technology div.description { + padding: 0; } \ No newline at end of file diff --git a/legacyworlds-web/legacyworlds-web-main/pom.xml b/legacyworlds-web/legacyworlds-web-main/pom.xml index 099a1af..577b5ee 100644 --- a/legacyworlds-web/legacyworlds-web-main/pom.xml +++ b/legacyworlds-web/legacyworlds-web-main/pom.xml @@ -4,12 +4,12 @@ legacyworlds-web com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-web-main - 5.99.1 + 5.99.2 war Legacy Worlds main site diff --git a/legacyworlds-web/legacyworlds-web-main/src/main/java/com/deepclone/lw/web/main/game/OverviewPage.java b/legacyworlds-web/legacyworlds-web-main/src/main/java/com/deepclone/lw/web/main/game/OverviewPage.java index ffbbf46..e8f4831 100644 --- a/legacyworlds-web/legacyworlds-web-main/src/main/java/com/deepclone/lw/web/main/game/OverviewPage.java +++ b/legacyworlds-web/legacyworlds-web-main/src/main/java/com/deepclone/lw/web/main/game/OverviewPage.java @@ -6,9 +6,7 @@ import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.SessionAttributes; import com.deepclone.lw.session.SessionException; @@ -35,21 +33,4 @@ public class OverviewPage return this.render( model , "game" , language , "overview" , pSession.getOverview( ) ); } - - @RequestMapping( value = "/implement-{tech}.action" , method = RequestMethod.POST ) - public String implement( HttpServletRequest request , @ModelAttribute( "language" ) String language , Model model , - @PathVariable String tech ) - throws SessionException , SessionServerException , SessionMaintenanceException - { - int techId; - try { - techId = Integer.parseInt( tech ); - } catch ( NumberFormatException e ) { - return this.redirect( "overview" ); - } - - PlayerSession pSession = this.getSession( PlayerSession.class , request ); - return this.render( model , "game" , language , "overview" , pSession.implementTechnology( techId ) ); - } - } diff --git a/legacyworlds-web/legacyworlds-web-main/src/main/java/com/deepclone/lw/web/main/game/TechnologyPages.java b/legacyworlds-web/legacyworlds-web-main/src/main/java/com/deepclone/lw/web/main/game/TechnologyPages.java new file mode 100644 index 0000000..1042912 --- /dev/null +++ b/legacyworlds-web/legacyworlds-web-main/src/main/java/com/deepclone/lw/web/main/game/TechnologyPages.java @@ -0,0 +1,143 @@ +package com.deepclone.lw.web.main.game; + + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.SessionAttributes; + +import com.deepclone.lw.cmd.player.gdata.empire.ResearchData; +import com.deepclone.lw.cmd.player.research.ResearchOperationResponse; +import com.deepclone.lw.cmd.player.research.ViewResearchResponse; +import com.deepclone.lw.cmd.player.research.ResearchOperationResponse.Result; +import com.deepclone.lw.session.SessionException; +import com.deepclone.lw.web.beans.intercept.SessionRequirement; +import com.deepclone.lw.web.beans.session.SessionMaintenanceException; +import com.deepclone.lw.web.beans.session.SessionServerException; +import com.deepclone.lw.web.beans.view.PageControllerBase; +import com.deepclone.lw.web.csess.PlayerSession; + + + +@Controller +@SessionRequirement( value = true , redirectTo = "player-session" , subType = "game" ) +@SessionAttributes( "language" ) +public class TechnologyPages + extends PageControllerBase +{ + + @RequestMapping( "/technologies" ) + public String viewTechnologies( HttpServletRequest request , @ModelAttribute( "language" ) String language , + Model model ) + throws SessionException , SessionServerException , SessionMaintenanceException + { + PlayerSession pSession = this.getSession( PlayerSession.class , request ); + return this.renderPage( model , language , pSession.viewResearch( ) ); + } + + + @RequestMapping( value = "/implement-tech.action" , method = RequestMethod.POST ) + public String implement( HttpServletRequest request , @ModelAttribute( "language" ) String language , Model model , + @RequestParam( "technology" ) String tech ) + throws SessionException , SessionServerException , SessionMaintenanceException + { + if ( tech == null || tech.equals( "" ) ) { + return this.redirect( "technologies" ); + } + + PlayerSession pSession = this.getSession( PlayerSession.class , request ); + ResearchOperationResponse response = pSession.implementTechnology( tech ); + if ( response.getResult( ) == Result.OK ) { + return this.redirect( "technologies" ); + } + return this.renderPage( model , language , response ); + } + + + @RequestMapping( value = "/set-research-priority.action" , method = RequestMethod.POST ) + public String setPriorities( HttpServletRequest request , @ModelAttribute( "language" ) String language , + Model model ) + throws SessionException , SessionServerException , SessionMaintenanceException + { + PlayerSession pSession = this.getSession( PlayerSession.class , request ); + ResearchOperationResponse response; + + Map< String , Integer > priorities = new HashMap< String , Integer >( ); + if ( this.getPriorityValues( priorities , request ) ) { + response = pSession.setResearchPriorities( priorities ); + if ( response.getResult( ) == Result.OK ) { + return this.redirect( "technologies" ); + } + } else { + response = this.createInvalidResponse( pSession , priorities ); + } + + return this.renderPage( model , language , response ); + } + + + private String renderPage( Model model , String language , ViewResearchResponse data ) + { + return this.render( model , "game" , language , "technologies" , data ); + } + + + private ResearchOperationResponse createInvalidResponse( PlayerSession pSession , Map< String , Integer > priorities ) + throws SessionException , SessionServerException , SessionMaintenanceException + { + ViewResearchResponse view = pSession.viewResearch( ); + for ( ResearchData research : view.getResearch( ) ) { + Integer nPrio = priorities.get( research.getIdentifier( ) ); + if ( nPrio != null && research.getPriority( ) != null ) { + research.setPriority( nPrio ); + } + } + return new ResearchOperationResponse( view.getPage( ) , view.getResearch( ) , + view.getImplementedTechnologies( ) , Result.ERR_INVALID ); + } + + + @SuppressWarnings( "unchecked" ) + private boolean getPriorityValues( Map< String , Integer > priorities , HttpServletRequest request ) + { + Map< String , String[] > parameters = request.getParameterMap( ); + int total = 0; + boolean ok = true; + + for ( String pName : parameters.keySet( ) ) { + if ( !pName.matches( "^priority-[A-Za-z0-9\\-]+" ) ) { + continue; + } + + String tName = pName.substring( "priority-".length( ) ); + String pValues[] = parameters.get( pName ); + if ( pValues.length != 1 || pValues[ 0 ] == null ) { + ok = false; + continue; + } + + int value; + try { + value = Integer.parseInt( pValues[ 0 ] ); + } catch ( NumberFormatException e ) { + ok = false; + continue; + } + + priorities.put( tName , value ); + total += value; + + ok = ok && ! ( value < 0 || value > 100 ); + } + + return ok && total == 100 && priorities.size( ) >= 2; + } +} diff --git a/legacyworlds-web/pom.xml b/legacyworlds-web/pom.xml index 67a4c72..24fa5cb 100644 --- a/legacyworlds-web/pom.xml +++ b/legacyworlds-web/pom.xml @@ -4,12 +4,12 @@ legacyworlds com.deepclone.lw - 5.99.1 + 5.99.2 com.deepclone.lw legacyworlds-web - 5.99.1 + 5.99.2 pom Legacy Worlds web sites Root module for Legacy Worlds web sites diff --git a/pom.xml b/pom.xml index 8f8a680..e1ad570 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.deepclone.lw legacyworlds - 5.99.1 + 5.99.2 pom Legacy Worlds Main Maven project for LW @@ -50,15 +50,15 @@ UTF-8 - 3.0.3.RELEASE + 3.0.5.RELEASE 1.2.16 - 1.5.11 - 1.2.2 + 1.6.1 + 1.4 1.4 2.2 1.4.1 1.3.1 - 4.7 + 4.8.2 2.3.16 diff --git a/runsrv.sh b/runsrv.sh index d761187..226099d 100755 --- a/runsrv.sh +++ b/runsrv.sh @@ -1,4 +1,4 @@ #!/bin/sh BASE="`dirname $0`" cd "$BASE/legacyworlds-server/legacyworlds-server-main" -java -jar target/legacyworlds-server-main-5.99.1.jar +java -Djava.rmi.server.hostname=localhost -jar target/legacyworlds-server-main-5.99.2.jar diff --git a/runtool.sh b/runtool.sh index 30ba8b1..037ac04 100755 --- a/runtool.sh +++ b/runtool.sh @@ -1,4 +1,4 @@ #!/bin/sh BASE="`dirname $0`" cd "$BASE/legacyworlds-server/legacyworlds-server-main" -java -jar target/legacyworlds-server-main-5.99.1.jar --run-tool $1 "$2" +java -Djava.rmi.server.hostname=localhost -jar target/legacyworlds-server-main-5.99.2.jar --run-tool $1 "$2"