diff --git a/modules/client_entergame/entergame.otmod b/modules/client_entergame/entergame.otmod index 9d489e52fd..0c2c8eab4f 100644 --- a/modules/client_entergame/entergame.otmod +++ b/modules/client_entergame/entergame.otmod @@ -4,8 +4,9 @@ Module author: edubart website: https://github.com/edubart/otclient - dependencies: - - client_topmenu + load-later: + - game_features + - game_things @onLoad: | dofile 'entergame' diff --git a/modules/game_features/features.lua b/modules/game_features/features.lua new file mode 100644 index 0000000000..9280a60454 --- /dev/null +++ b/modules/game_features/features.lua @@ -0,0 +1,220 @@ +controller = Controller:new() +controller:registerEvents(g_game, { + onClientVersionChange = function(version) + g_game.enableFeature(GameFormatCreatureName); + + if version >= 750 then + g_game.enableFeature(GameSoul); + end + + if version >= 760 then + g_game.enableFeature(GameLevelU16); + end + + if version >= 770 then + g_game.enableFeature(GameLooktypeU16); + g_game.enableFeature(GameMessageStatements); + g_game.enableFeature(GameLoginPacketEncryption); + end + + if version >= 780 then + g_game.enableFeature(GamePlayerAddons); + g_game.enableFeature(GamePlayerStamina); + g_game.enableFeature(GameNewFluids); + g_game.enableFeature(GameMessageLevel); + g_game.enableFeature(GamePlayerStateU16); + g_game.enableFeature(GameNewOutfitProtocol); + end + + if version >= 790 then + g_game.enableFeature(GameWritableDate); + end + + if version >= 840 then + g_game.enableFeature(GameProtocolChecksum); + g_game.enableFeature(GameAccountNames); + g_game.enableFeature(GameDoubleFreeCapacity); + end + + if version >= 841 then + g_game.enableFeature(GameChallengeOnLogin); + g_game.enableFeature(GameMessageSizeCheck); + end + + if version >= 854 then + g_game.enableFeature(GameCreatureEmblems); + end + + if version >= 860 then + g_game.enableFeature(GameAttackSeq); + end + + if version >= 862 then + g_game.enableFeature(GamePenalityOnDeath); + end + + if version >= 870 then + g_game.enableFeature(GameDoubleExperience); + g_game.enableFeature(GamePlayerMounts); + g_game.enableFeature(GameSpellList); + end + + if version >= 910 then + g_game.enableFeature(GameNameOnNpcTrade); + g_game.enableFeature(GameTotalCapacity); + g_game.enableFeature(GameSkillsBase); + g_game.enableFeature(GamePlayerRegenerationTime); + g_game.enableFeature(GameChannelPlayerList); + g_game.enableFeature(GameEnvironmentEffect); + g_game.enableFeature(GameItemAnimationPhase); + end + + if version >= 940 then + g_game.enableFeature(GamePlayerMarket); + end + + if version >= 953 then + g_game.enableFeature(GamePurseSlot); + g_game.enableFeature(GameClientPing); + end + + if version >= 960 then + g_game.enableFeature(GameSpritesU32); + g_game.enableFeature(GameOfflineTrainingTime); + end + + if version >= 963 then + g_game.enableFeature(GameAdditionalVipInfo); + end + + if version >= 980 then + g_game.enableFeature(GamePreviewState); + g_game.enableFeature(GameClientVersion); + end + + if version >= 981 then + g_game.enableFeature(GameLoginPending); + g_game.enableFeature(GameNewSpeedLaw); + end + + if version >= 984 then + g_game.enableFeature(GameContainerPagination); + g_game.enableFeature(GameBrowseField); + end + + if version >= 1000 then + g_game.enableFeature(GameThingMarks); + g_game.enableFeature(GamePVPMode); + end + + if version >= 1035 then + g_game.enableFeature(GameDoubleSkills); + g_game.enableFeature(GameBaseSkillU16); + end + + if version >= 1036 then + g_game.enableFeature(GameCreatureIcons); + g_game.enableFeature(GameHideNpcNames); + end + + if version >= 1038 then + g_game.enableFeature(GamePremiumExpiration); + end + + if version >= 1050 then + g_game.enableFeature(GameEnhancedAnimations); + end + + if version >= 1053 then + g_game.enableFeature(GameUnjustifiedPoints); + end + + if version >= 1054 then + g_game.enableFeature(GameExperienceBonus); + end + + if version >= 1055 then + g_game.enableFeature(GameDeathType); + end + + if version >= 1057 then + g_game.enableFeature(GameIdleAnimations); + end + + if version >= 1061 then + g_game.enableFeature(GameOGLInformation); + end + + if version >= 1071 then + g_game.enableFeature(GameContentRevision); + end + + if version >= 1072 then + g_game.enableFeature(GameAuthenticator); + end + + if version >= 1074 then + g_game.enableFeature(GameSessionKey); + end + + if version >= 1080 then + g_game.enableFeature(GameIngameStore); + end + + if version >= 1092 then + g_game.enableFeature(GameIngameStoreServiceType); + end + + if version >= 1093 then + g_game.enableFeature(GameIngameStoreHighlights); + end + + if version >= 1094 then + g_game.enableFeature(GameAdditionalSkills); + end + + if version >= 1200 then + g_game.enableFeature(GamePrey); + g_game.enableFeature(GameThingQuickLoot); + g_game.enableFeature(GameTournamentPackets); + g_game.enableFeature(GameVipGroups); + end + + if version >= 1260 then + g_game.enableFeature(GameThingQuiver); + end + + if version >= 1264 then + g_game.enableFeature(GameThingPodium); + end + + if version >= 1272 then + g_game.enableFeature(GameThingUpgradeClassification); + end + + if version >= 1281 then + g_game.disableFeature(GameEnvironmentEffect); + g_game.disableFeature(GameItemAnimationPhase); + end + + if version >= 1290 then + g_game.enableFeature(GameSequencedPackets); + g_game.enableFeature(GameThingClock); + g_game.enableFeature(GameThingCounter); + g_game.enableFeature(GameThingPodiumItemType); + g_game.enableFeature(GameDoubleShopSellAmount); + end + + if version >= 1300 then + g_game.enableFeature(GameDoubleHealth); + g_game.enableFeature(GameUshortSpell); + g_game.enableFeature(GameConcotions); + g_game.enableFeature(GameAnthem); + end + + if version >= 1314 then + g_game.disableFeature(GameTournamentPackets); + g_game.enableFeature(GameDynamicForgeVariables); + end + end +}) diff --git a/modules/game_features/features.otmod b/modules/game_features/features.otmod new file mode 100644 index 0000000000..9e7666b3e4 --- /dev/null +++ b/modules/game_features/features.otmod @@ -0,0 +1,8 @@ +Module + name: game_features + description: Manager game features + reloadable: false + sandboxed: true + scripts: [features] + @onLoad: controller:init() + @onUnload: controller:terminate() diff --git a/modules/gamelib/const.lua b/modules/gamelib/const.lua index dd560d4264..eee9bfde8e 100644 --- a/modules/gamelib/const.lua +++ b/modules/gamelib/const.lua @@ -124,13 +124,16 @@ GameLooktypeU16 = 42 GamePlayerStamina = 43 GamePlayerAddons = 44 GameMessageStatements = 45 -GameMesssageLevel = 46 +GameMessageLevel = 46 GameNewFluids = 47 GamePlayerStateU16 = 48 GameNewOutfitProtocol = 49 GamePVPMode = 50 GameWritableDate = 51 GameAdditionalVipInfo = 52 +GameBaseSkillU16 = 53 +GameCreatureIcons = 54 +GameHideNpcNames = 55 GameSpritesAlphaChannel = 56 GamePremiumExpiration = 57 GameBrowseField = 58 @@ -178,10 +181,10 @@ GameCreatureShader = 102 GameCreatureAttachedEffect = 103 TextColors = { - red = '#f55e5e', -- '#c83200' + red = '#f55e5e', -- '#c83200' orange = '#f36500', -- '#c87832' yellow = '#ffff00', -- '#e6c832' - green = '#00EB00', -- '#3fbe32' + green = '#00EB00', -- '#3fbe32' lightblue = '#5ff7f7', blue = '#9f9dfd', -- blue1 = '#6e50dc', @@ -256,16 +259,16 @@ MessageModes = { } OTSERV_RSA = '1091201329673994292788609605089955415282375029027981291234687579' .. - '3726629149257644633073969600111060390723088861007265581882535850' .. - '3429057592827629436413108566029093628212635953836686562675849720' .. - '6207862794310902180176810615217550567108238764764442605581471797' .. - '07119674283982419152118103759076030616683978566631413' + '3726629149257644633073969600111060390723088861007265581882535850' .. + '3429057592827629436413108566029093628212635953836686562675849720' .. + '6207862794310902180176810615217550567108238764764442605581471797' .. + '07119674283982419152118103759076030616683978566631413' CIPSOFT_RSA = '1321277432058722840622950990822933849527763264961655079678763618' .. - '4334395343554449668205332383339435179772895415509701210392836078' .. - '6959821132214473291575712138800495033169914814069637740318278150' .. - '2907336840325241747827401343576296990629870233111328210165697754' .. - '88792221429527047321331896351555606801473202394175817' + '4334395343554449668205332383339435179772895415509701210392836078' .. + '6959821132214473291575712138800495033169914814069637740318278150' .. + '2907336840325241747827401343576296990629870233111328210165697754' .. + '88792221429527047321331896351555606801473202394175817' -- set to the latest Tibia.pic signature to make otclient compatible with official tibia PIC_SIGNATURE = 0x56C5DDE7 diff --git a/modules/gamelib/gamelib.otmod b/modules/gamelib/gamelib.otmod index 9739e30d34..4e066fb4b0 100644 --- a/modules/gamelib/gamelib.otmod +++ b/modules/gamelib/gamelib.otmod @@ -4,9 +4,6 @@ Module author: OTClient team website: https://github.com/edubart/otclient - dependencies: - - game_things - @onLoad: | dofile 'const' dofile 'util' diff --git a/src/client/game.cpp b/src/client/game.cpp index 408ee222e7..ba9cc31eb0 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1543,221 +1543,6 @@ void Game::setClientVersion(int version) throw Exception("Client version %d not supported", version); m_features.reset(); - enableFeature(Otc::GameFormatCreatureName); - - if (version >= 750) { - enableFeature(Otc::GameSoul); - } - - if (version >= 760) { - enableFeature(Otc::GameLevelU16); - } - - if (version >= 770) { - enableFeature(Otc::GameLooktypeU16); - enableFeature(Otc::GameMessageStatements); - enableFeature(Otc::GameLoginPacketEncryption); - } - - if (version >= 780) { - enableFeature(Otc::GamePlayerAddons); - enableFeature(Otc::GamePlayerStamina); - enableFeature(Otc::GameNewFluids); - enableFeature(Otc::GameMessageLevel); - enableFeature(Otc::GamePlayerStateU16); - enableFeature(Otc::GameNewOutfitProtocol); - } - - if (version >= 790) { - enableFeature(Otc::GameWritableDate); - } - - if (version >= 840) { - enableFeature(Otc::GameProtocolChecksum); - enableFeature(Otc::GameAccountNames); - enableFeature(Otc::GameDoubleFreeCapacity); - } - - if (version >= 841) { - enableFeature(Otc::GameChallengeOnLogin); - enableFeature(Otc::GameMessageSizeCheck); - } - - if (version >= 854) { - enableFeature(Otc::GameCreatureEmblems); - } - - if (version >= 860) { - enableFeature(Otc::GameAttackSeq); - } - - if (version >= 862) { - enableFeature(Otc::GamePenalityOnDeath); - } - - if (version >= 870) { - enableFeature(Otc::GameDoubleExperience); - enableFeature(Otc::GamePlayerMounts); - enableFeature(Otc::GameSpellList); - } - - if (version >= 910) { - enableFeature(Otc::GameNameOnNpcTrade); - enableFeature(Otc::GameTotalCapacity); - enableFeature(Otc::GameSkillsBase); - enableFeature(Otc::GamePlayerRegenerationTime); - enableFeature(Otc::GameChannelPlayerList); - enableFeature(Otc::GameEnvironmentEffect); - enableFeature(Otc::GameItemAnimationPhase); - } - - if (version >= 940) { - enableFeature(Otc::GamePlayerMarket); - } - - if (version >= 953) { - enableFeature(Otc::GamePurseSlot); - enableFeature(Otc::GameClientPing); - } - - if (version >= 960) { - enableFeature(Otc::GameSpritesU32); - enableFeature(Otc::GameOfflineTrainingTime); - } - - if (version >= 963) { - enableFeature(Otc::GameAdditionalVipInfo); - } - - if (version >= 980) { - enableFeature(Otc::GamePreviewState); - enableFeature(Otc::GameClientVersion); - } - - if (version >= 981) { - enableFeature(Otc::GameLoginPending); - enableFeature(Otc::GameNewSpeedLaw); - } - - if (version >= 984) { - enableFeature(Otc::GameContainerPagination); - enableFeature(Otc::GameBrowseField); - } - - if (version >= 1000) { - enableFeature(Otc::GameThingMarks); - enableFeature(Otc::GamePVPMode); - } - - if (version >= 1035) { - enableFeature(Otc::GameDoubleSkills); - enableFeature(Otc::GameBaseSkillU16); - } - - if (version >= 1036) { - enableFeature(Otc::GameCreatureIcons); - enableFeature(Otc::GameHideNpcNames); - } - - if (version >= 1038) { - enableFeature(Otc::GamePremiumExpiration); - } - - if (version >= 1050) { - enableFeature(Otc::GameEnhancedAnimations); - } - - if (version >= 1053) { - enableFeature(Otc::GameUnjustifiedPoints); - } - - if (version >= 1054) { - enableFeature(Otc::GameExperienceBonus); - } - - if (version >= 1055) { - enableFeature(Otc::GameDeathType); - } - - if (version >= 1057) { - enableFeature(Otc::GameIdleAnimations); - } - - if (version >= 1061) { - enableFeature(Otc::GameOGLInformation); - } - - if (version >= 1071) { - enableFeature(Otc::GameContentRevision); - } - - if (version >= 1072) { - enableFeature(Otc::GameAuthenticator); - } - - if (version >= 1074) { - enableFeature(Otc::GameSessionKey); - } - - if (version >= 1080) { - enableFeature(Otc::GameIngameStore); - } - - if (version >= 1092) { - enableFeature(Otc::GameIngameStoreServiceType); - } - - if (version >= 1093) { - enableFeature(Otc::GameIngameStoreHighlights); - } - - if (version >= 1094) { - enableFeature(Otc::GameAdditionalSkills); - } - - if (version >= 1200) { - enableFeature(Otc::GamePrey); - enableFeature(Otc::GameThingQuickLoot); - enableFeature(Otc::GameTournamentPackets); - enableFeature(Otc::GameVipGroups); - } - - if (version >= 1260) { - enableFeature(Otc::GameThingQuiver); - } - - if (version >= 1264) { - enableFeature(Otc::GameThingPodium); - } - - if (version >= 1272) { - enableFeature(Otc::GameThingUpgradeClassification); - } - - if (version >= 1281) { - disableFeature(Otc::GameEnvironmentEffect); - disableFeature(Otc::GameItemAnimationPhase); - } - - if (version >= 1290) { - enableFeature(Otc::GameSequencedPackets); - enableFeature(Otc::GameThingClock); - enableFeature(Otc::GameThingCounter); - enableFeature(Otc::GameThingPodiumItemType); - enableFeature(Otc::GameDoubleShopSellAmount); - } - - if (version >= 1300) { - enableFeature(Otc::GameDoubleHealth); - enableFeature(Otc::GameUshortSpell); - enableFeature(Otc::GameConcotions); - enableFeature(Otc::GameAnthem); - } - - if (version >= 1314) { - disableFeature(Otc::GameTournamentPackets); - enableFeature(Otc::GameDynamicForgeVariables); - } m_clientVersion = version;