@takaro/modules 0.0.0-next.0da151e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/BuiltinModule.d.ts +62 -0
- package/dist/BuiltinModule.d.ts.map +1 -0
- package/dist/BuiltinModule.js +245 -0
- package/dist/BuiltinModule.js.map +1 -0
- package/dist/community-modules.json +21 -0
- package/dist/dto/base.d.ts +7 -0
- package/dist/dto/base.d.ts.map +1 -0
- package/dist/dto/base.js +28 -0
- package/dist/dto/base.js.map +1 -0
- package/dist/dto/discordEvents.d.ts +32 -0
- package/dist/dto/discordEvents.d.ts.map +1 -0
- package/dist/dto/discordEvents.js +92 -0
- package/dist/dto/discordEvents.js.map +1 -0
- package/dist/dto/gameEvents.d.ts +83 -0
- package/dist/dto/gameEvents.d.ts.map +1 -0
- package/dist/dto/gameEvents.js +205 -0
- package/dist/dto/gameEvents.js.map +1 -0
- package/dist/dto/index.d.ts +54 -0
- package/dist/dto/index.d.ts.map +1 -0
- package/dist/dto/index.js +18 -0
- package/dist/dto/index.js.map +1 -0
- package/dist/dto/takaroEvents.d.ts +276 -0
- package/dist/dto/takaroEvents.d.ts.map +1 -0
- package/dist/dto/takaroEvents.js +794 -0
- package/dist/dto/takaroEvents.js.map +1 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +35 -0
- package/dist/main.js.map +1 -0
- package/dist/modules/chatBridge/hooks/DiscordToGame.d.ts +2 -0
- package/dist/modules/chatBridge/hooks/DiscordToGame.d.ts.map +1 -0
- package/dist/modules/chatBridge/hooks/DiscordToGame.js +18 -0
- package/dist/modules/chatBridge/hooks/DiscordToGame.js.map +1 -0
- package/dist/modules/chatBridge/hooks/GameToDiscord.d.ts +2 -0
- package/dist/modules/chatBridge/hooks/GameToDiscord.d.ts.map +1 -0
- package/dist/modules/chatBridge/hooks/GameToDiscord.js +14 -0
- package/dist/modules/chatBridge/hooks/GameToDiscord.js.map +1 -0
- package/dist/modules/chatBridge/hooks/PlayerConnected.d.ts +2 -0
- package/dist/modules/chatBridge/hooks/PlayerConnected.d.ts.map +1 -0
- package/dist/modules/chatBridge/hooks/PlayerConnected.js +9 -0
- package/dist/modules/chatBridge/hooks/PlayerConnected.js.map +1 -0
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.d.ts +2 -0
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.d.ts.map +1 -0
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.js +9 -0
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.js.map +1 -0
- package/dist/modules/chatBridge/index.d.ts +5 -0
- package/dist/modules/chatBridge/index.d.ts.map +1 -0
- package/dist/modules/chatBridge/index.js +64 -0
- package/dist/modules/chatBridge/index.js.map +1 -0
- package/dist/modules/dailyRewards/commands/daily.d.ts +2 -0
- package/dist/modules/dailyRewards/commands/daily.d.ts.map +1 -0
- package/dist/modules/dailyRewards/commands/daily.js +103 -0
- package/dist/modules/dailyRewards/commands/daily.js.map +1 -0
- package/dist/modules/dailyRewards/commands/streak.d.ts +2 -0
- package/dist/modules/dailyRewards/commands/streak.d.ts.map +1 -0
- package/dist/modules/dailyRewards/commands/streak.js +34 -0
- package/dist/modules/dailyRewards/commands/streak.js.map +1 -0
- package/dist/modules/dailyRewards/commands/topstreak.d.ts +2 -0
- package/dist/modules/dailyRewards/commands/topstreak.d.ts.map +1 -0
- package/dist/modules/dailyRewards/commands/topstreak.js +44 -0
- package/dist/modules/dailyRewards/commands/topstreak.js.map +1 -0
- package/dist/modules/dailyRewards/functions/utils.d.ts +6 -0
- package/dist/modules/dailyRewards/functions/utils.d.ts.map +1 -0
- package/dist/modules/dailyRewards/functions/utils.js +32 -0
- package/dist/modules/dailyRewards/functions/utils.js.map +1 -0
- package/dist/modules/dailyRewards/hooks/dailyLoginCheck.d.ts +2 -0
- package/dist/modules/dailyRewards/hooks/dailyLoginCheck.d.ts.map +1 -0
- package/dist/modules/dailyRewards/hooks/dailyLoginCheck.js +19 -0
- package/dist/modules/dailyRewards/hooks/dailyLoginCheck.js.map +1 -0
- package/dist/modules/dailyRewards/index.d.ts +5 -0
- package/dist/modules/dailyRewards/index.d.ts.map +1 -0
- package/dist/modules/dailyRewards/index.js +127 -0
- package/dist/modules/dailyRewards/index.js.map +1 -0
- package/dist/modules/economyUtils/commands/balance.d.ts +2 -0
- package/dist/modules/economyUtils/commands/balance.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/balance.js +7 -0
- package/dist/modules/economyUtils/commands/balance.js.map +1 -0
- package/dist/modules/economyUtils/commands/claim.d.ts +2 -0
- package/dist/modules/economyUtils/commands/claim.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/claim.js +35 -0
- package/dist/modules/economyUtils/commands/claim.js.map +1 -0
- package/dist/modules/economyUtils/commands/confirmTransfer.d.ts +2 -0
- package/dist/modules/economyUtils/commands/confirmTransfer.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/confirmTransfer.js +38 -0
- package/dist/modules/economyUtils/commands/confirmTransfer.js.map +1 -0
- package/dist/modules/economyUtils/commands/grantCurrency.d.ts +2 -0
- package/dist/modules/economyUtils/commands/grantCurrency.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/grantCurrency.js +28 -0
- package/dist/modules/economyUtils/commands/grantCurrency.js.map +1 -0
- package/dist/modules/economyUtils/commands/revokeCurrency.d.ts +2 -0
- package/dist/modules/economyUtils/commands/revokeCurrency.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/revokeCurrency.js +28 -0
- package/dist/modules/economyUtils/commands/revokeCurrency.js.map +1 -0
- package/dist/modules/economyUtils/commands/shop.d.ts +2 -0
- package/dist/modules/economyUtils/commands/shop.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/shop.js +69 -0
- package/dist/modules/economyUtils/commands/shop.js.map +1 -0
- package/dist/modules/economyUtils/commands/topCurrency.d.ts +2 -0
- package/dist/modules/economyUtils/commands/topCurrency.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/topCurrency.js +22 -0
- package/dist/modules/economyUtils/commands/topCurrency.js.map +1 -0
- package/dist/modules/economyUtils/commands/transfer.d.ts +2 -0
- package/dist/modules/economyUtils/commands/transfer.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/transfer.js +55 -0
- package/dist/modules/economyUtils/commands/transfer.js.map +1 -0
- package/dist/modules/economyUtils/cronJobs/zombieKillReward.d.ts +2 -0
- package/dist/modules/economyUtils/cronJobs/zombieKillReward.d.ts.map +1 -0
- package/dist/modules/economyUtils/cronJobs/zombieKillReward.js +66 -0
- package/dist/modules/economyUtils/cronJobs/zombieKillReward.js.map +1 -0
- package/dist/modules/economyUtils/index.d.ts +5 -0
- package/dist/modules/economyUtils/index.d.ts.map +1 -0
- package/dist/modules/economyUtils/index.js +192 -0
- package/dist/modules/economyUtils/index.js.map +1 -0
- package/dist/modules/geoBlock/hooks/IPDetected.d.ts +2 -0
- package/dist/modules/geoBlock/hooks/IPDetected.d.ts.map +1 -0
- package/dist/modules/geoBlock/hooks/IPDetected.js +50 -0
- package/dist/modules/geoBlock/hooks/IPDetected.js.map +1 -0
- package/dist/modules/geoBlock/index.d.ts +9 -0
- package/dist/modules/geoBlock/index.d.ts.map +1 -0
- package/dist/modules/geoBlock/index.js +329 -0
- package/dist/modules/geoBlock/index.js.map +1 -0
- package/dist/modules/gimme/commands/gimme.d.ts +2 -0
- package/dist/modules/gimme/commands/gimme.d.ts.map +1 -0
- package/dist/modules/gimme/commands/gimme.js +25 -0
- package/dist/modules/gimme/commands/gimme.js.map +1 -0
- package/dist/modules/gimme/index.d.ts +5 -0
- package/dist/modules/gimme/index.d.ts.map +1 -0
- package/dist/modules/gimme/index.js +75 -0
- package/dist/modules/gimme/index.js.map +1 -0
- package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts +2 -0
- package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts.map +1 -0
- package/dist/modules/highPingKicker/cronJobs/Ping check.js +59 -0
- package/dist/modules/highPingKicker/cronJobs/Ping check.js.map +1 -0
- package/dist/modules/highPingKicker/index.d.ts +5 -0
- package/dist/modules/highPingKicker/index.d.ts.map +1 -0
- package/dist/modules/highPingKicker/index.js +44 -0
- package/dist/modules/highPingKicker/index.js.map +1 -0
- package/dist/modules/lottery/commands/buyTicket.d.ts +2 -0
- package/dist/modules/lottery/commands/buyTicket.d.ts.map +1 -0
- package/dist/modules/lottery/commands/buyTicket.js +51 -0
- package/dist/modules/lottery/commands/buyTicket.js.map +1 -0
- package/dist/modules/lottery/commands/nextDraw.d.ts +2 -0
- package/dist/modules/lottery/commands/nextDraw.d.ts.map +1 -0
- package/dist/modules/lottery/commands/nextDraw.js +34 -0
- package/dist/modules/lottery/commands/nextDraw.js.map +1 -0
- package/dist/modules/lottery/commands/viewTickets.d.ts +2 -0
- package/dist/modules/lottery/commands/viewTickets.d.ts.map +1 -0
- package/dist/modules/lottery/commands/viewTickets.js +20 -0
- package/dist/modules/lottery/commands/viewTickets.js.map +1 -0
- package/dist/modules/lottery/cronJobs/drawLottery.d.ts +2 -0
- package/dist/modules/lottery/cronJobs/drawLottery.d.ts.map +1 -0
- package/dist/modules/lottery/cronJobs/drawLottery.js +96 -0
- package/dist/modules/lottery/cronJobs/drawLottery.js.map +1 -0
- package/dist/modules/lottery/index.d.ts +5 -0
- package/dist/modules/lottery/index.d.ts.map +1 -0
- package/dist/modules/lottery/index.js +85 -0
- package/dist/modules/lottery/index.js.map +1 -0
- package/dist/modules/playerOnboarding/commands/starterkit.d.ts +2 -0
- package/dist/modules/playerOnboarding/commands/starterkit.d.ts.map +1 -0
- package/dist/modules/playerOnboarding/commands/starterkit.js +47 -0
- package/dist/modules/playerOnboarding/commands/starterkit.js.map +1 -0
- package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts +2 -0
- package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts.map +1 -0
- package/dist/modules/playerOnboarding/hooks/playerConnected.js +11 -0
- package/dist/modules/playerOnboarding/hooks/playerConnected.js.map +1 -0
- package/dist/modules/playerOnboarding/index.d.ts +5 -0
- package/dist/modules/playerOnboarding/index.d.ts.map +1 -0
- package/dist/modules/playerOnboarding/index.js +83 -0
- package/dist/modules/playerOnboarding/index.js.map +1 -0
- package/dist/modules/serverMessages/cronJobs/Automated message.d.ts +2 -0
- package/dist/modules/serverMessages/cronJobs/Automated message.d.ts.map +1 -0
- package/dist/modules/serverMessages/cronJobs/Automated message.js +41 -0
- package/dist/modules/serverMessages/cronJobs/Automated message.js.map +1 -0
- package/dist/modules/serverMessages/index.d.ts +5 -0
- package/dist/modules/serverMessages/index.d.ts.map +1 -0
- package/dist/modules/serverMessages/index.js +45 -0
- package/dist/modules/serverMessages/index.js.map +1 -0
- package/dist/modules/teleports/commands/deletetp.d.ts +2 -0
- package/dist/modules/teleports/commands/deletetp.d.ts.map +1 -0
- package/dist/modules/teleports/commands/deletetp.js +20 -0
- package/dist/modules/teleports/commands/deletetp.js.map +1 -0
- package/dist/modules/teleports/commands/deletewaypoint.d.ts +2 -0
- package/dist/modules/teleports/commands/deletewaypoint.d.ts.map +1 -0
- package/dist/modules/teleports/commands/deletewaypoint.js +20 -0
- package/dist/modules/teleports/commands/deletewaypoint.js.map +1 -0
- package/dist/modules/teleports/commands/listwaypoints.d.ts +2 -0
- package/dist/modules/teleports/commands/listwaypoints.d.ts.map +1 -0
- package/dist/modules/teleports/commands/listwaypoints.js +17 -0
- package/dist/modules/teleports/commands/listwaypoints.js.map +1 -0
- package/dist/modules/teleports/commands/setprivate.d.ts +2 -0
- package/dist/modules/teleports/commands/setprivate.d.ts.map +1 -0
- package/dist/modules/teleports/commands/setprivate.js +29 -0
- package/dist/modules/teleports/commands/setprivate.js.map +1 -0
- package/dist/modules/teleports/commands/setpublic.d.ts +2 -0
- package/dist/modules/teleports/commands/setpublic.d.ts.map +1 -0
- package/dist/modules/teleports/commands/setpublic.js +45 -0
- package/dist/modules/teleports/commands/setpublic.js.map +1 -0
- package/dist/modules/teleports/commands/settp.d.ts +2 -0
- package/dist/modules/teleports/commands/settp.d.ts.map +1 -0
- package/dist/modules/teleports/commands/settp.js +40 -0
- package/dist/modules/teleports/commands/settp.js.map +1 -0
- package/dist/modules/teleports/commands/setwaypoint.d.ts +2 -0
- package/dist/modules/teleports/commands/setwaypoint.d.ts.map +1 -0
- package/dist/modules/teleports/commands/setwaypoint.js +28 -0
- package/dist/modules/teleports/commands/setwaypoint.js.map +1 -0
- package/dist/modules/teleports/commands/teleport.d.ts +2 -0
- package/dist/modules/teleports/commands/teleport.d.ts.map +1 -0
- package/dist/modules/teleports/commands/teleport.js +68 -0
- package/dist/modules/teleports/commands/teleport.js.map +1 -0
- package/dist/modules/teleports/commands/teleportwaypoint.d.ts +2 -0
- package/dist/modules/teleports/commands/teleportwaypoint.d.ts.map +1 -0
- package/dist/modules/teleports/commands/teleportwaypoint.js +43 -0
- package/dist/modules/teleports/commands/teleportwaypoint.js.map +1 -0
- package/dist/modules/teleports/commands/tplist.d.ts +2 -0
- package/dist/modules/teleports/commands/tplist.d.ts.map +1 -0
- package/dist/modules/teleports/commands/tplist.js +46 -0
- package/dist/modules/teleports/commands/tplist.js.map +1 -0
- package/dist/modules/teleports/cronJobs/Waypoint reconciler.d.ts +2 -0
- package/dist/modules/teleports/cronJobs/Waypoint reconciler.d.ts.map +1 -0
- package/dist/modules/teleports/cronJobs/Waypoint reconciler.js +6 -0
- package/dist/modules/teleports/cronJobs/Waypoint reconciler.js.map +1 -0
- package/dist/modules/teleports/functions/utils.d.ts +14 -0
- package/dist/modules/teleports/functions/utils.d.ts.map +1 -0
- package/dist/modules/teleports/functions/utils.js +156 -0
- package/dist/modules/teleports/functions/utils.js.map +1 -0
- package/dist/modules/teleports/index.d.ts +5 -0
- package/dist/modules/teleports/index.d.ts.map +1 -0
- package/dist/modules/teleports/index.js +208 -0
- package/dist/modules/teleports/index.js.map +1 -0
- package/dist/modules/timedShutdown/cronJobs/Shutdown.d.ts +2 -0
- package/dist/modules/timedShutdown/cronJobs/Shutdown.d.ts.map +1 -0
- package/dist/modules/timedShutdown/cronJobs/Shutdown.js +7 -0
- package/dist/modules/timedShutdown/cronJobs/Shutdown.js.map +1 -0
- package/dist/modules/timedShutdown/cronJobs/warning.d.ts +2 -0
- package/dist/modules/timedShutdown/cronJobs/warning.d.ts.map +1 -0
- package/dist/modules/timedShutdown/cronJobs/warning.js +10 -0
- package/dist/modules/timedShutdown/cronJobs/warning.js.map +1 -0
- package/dist/modules/timedShutdown/index.d.ts +5 -0
- package/dist/modules/timedShutdown/index.d.ts.map +1 -0
- package/dist/modules/timedShutdown/index.js +43 -0
- package/dist/modules/timedShutdown/index.js.map +1 -0
- package/dist/modules/utils/commands/help.d.ts +2 -0
- package/dist/modules/utils/commands/help.d.ts.map +1 -0
- package/dist/modules/utils/commands/help.js +84 -0
- package/dist/modules/utils/commands/help.js.map +1 -0
- package/dist/modules/utils/commands/ping.d.ts +2 -0
- package/dist/modules/utils/commands/ping.d.ts.map +1 -0
- package/dist/modules/utils/commands/ping.js +6 -0
- package/dist/modules/utils/commands/ping.js.map +1 -0
- package/dist/modules/utils/index.d.ts +5 -0
- package/dist/modules/utils/index.d.ts.map +1 -0
- package/dist/modules/utils/index.js +52 -0
- package/dist/modules/utils/index.js.map +1 -0
- package/dist/modules.json +757 -0
- package/package.json +17 -0
- package/scripts/buildBuiltinJson.ts +81 -0
- package/src/BuiltinModule.ts +159 -0
- package/src/__tests__/aliases.integration.test.ts +90 -0
- package/src/__tests__/bugRepros.integration.test.ts +485 -0
- package/src/__tests__/builtinmodule.unit.test.ts +15 -0
- package/src/__tests__/commandArgs.integration.test.ts +291 -0
- package/src/__tests__/crossServerPlayer.integration.test.ts +176 -0
- package/src/__tests__/economy/claim.integration.test.ts +250 -0
- package/src/__tests__/economy/economyUtils.integration.test.ts +495 -0
- package/src/__tests__/economy/shop.integration.test.ts +177 -0
- package/src/__tests__/economy/zombieKillReward.integration.test.ts +293 -0
- package/src/__tests__/geoblock.integration.test.ts +322 -0
- package/src/__tests__/gimme.integration.test.ts +106 -0
- package/src/__tests__/help.integration.test.ts +314 -0
- package/src/__tests__/highPingKicker.integration.test.ts +618 -0
- package/src/__tests__/lottery.integration.test.ts +344 -0
- package/src/__tests__/modulePermission.integration.test.ts +387 -0
- package/src/__tests__/onboarding.integration.test.ts +122 -0
- package/src/__tests__/ping.integration.test.ts +36 -0
- package/src/__tests__/roleExpiry.integration.test.ts +78 -0
- package/src/__tests__/serverMessages.integration.test.ts +116 -0
- package/src/__tests__/systemConfigCooldown.integration.test.ts +84 -0
- package/src/__tests__/systemConfigCost.integration.test.ts +194 -0
- package/src/__tests__/teleports/listtp.integration.test.ts +189 -0
- package/src/__tests__/teleports/publicteleports.integration.test.ts +345 -0
- package/src/__tests__/teleports/teleport.integration.test.ts +153 -0
- package/src/__tests__/teleports/tpManagement.integration.test.ts +175 -0
- package/src/__tests__/teleports/waypoints.integration.test.ts +832 -0
- package/src/community-modules/README.md +5 -0
- package/src/community-modules/modules/vote.json +19 -0
- package/src/dto/base.ts +13 -0
- package/src/dto/discordEvents.ts +69 -0
- package/src/dto/gameEvents.ts +159 -0
- package/src/dto/index.ts +25 -0
- package/src/dto/takaroEvents.ts +525 -0
- package/src/main.ts +47 -0
- package/src/modules/.eslintrc +5 -0
- package/src/modules/chatBridge/hooks/DiscordToGame.js +18 -0
- package/src/modules/chatBridge/hooks/GameToDiscord.js +18 -0
- package/src/modules/chatBridge/hooks/PlayerConnected.js +11 -0
- package/src/modules/chatBridge/hooks/PlayerDisconnected.js +11 -0
- package/src/modules/chatBridge/index.ts +64 -0
- package/src/modules/dailyRewards/commands/daily.js +114 -0
- package/src/modules/dailyRewards/commands/streak.js +42 -0
- package/src/modules/dailyRewards/commands/topstreak.js +54 -0
- package/src/modules/dailyRewards/functions/utils.js +36 -0
- package/src/modules/dailyRewards/hooks/dailyLoginCheck.js +24 -0
- package/src/modules/dailyRewards/index.ts +138 -0
- package/src/modules/economyUtils/commands/balance.js +8 -0
- package/src/modules/economyUtils/commands/claim.js +42 -0
- package/src/modules/economyUtils/commands/confirmTransfer.js +55 -0
- package/src/modules/economyUtils/commands/grantCurrency.js +34 -0
- package/src/modules/economyUtils/commands/revokeCurrency.js +34 -0
- package/src/modules/economyUtils/commands/shop.js +87 -0
- package/src/modules/economyUtils/commands/topCurrency.js +29 -0
- package/src/modules/economyUtils/commands/transfer.js +73 -0
- package/src/modules/economyUtils/cronJobs/zombieKillReward.js +82 -0
- package/src/modules/economyUtils/index.ts +197 -0
- package/src/modules/geoBlock/hooks/IPDetected.js +53 -0
- package/src/modules/geoBlock/index.ts +333 -0
- package/src/modules/gimme/commands/gimme.js +30 -0
- package/src/modules/gimme/index.ts +76 -0
- package/src/modules/highPingKicker/cronJobs/Ping check.js +68 -0
- package/src/modules/highPingKicker/index.ts +44 -0
- package/src/modules/lottery/commands/buyTicket.js +64 -0
- package/src/modules/lottery/commands/nextDraw.js +47 -0
- package/src/modules/lottery/commands/viewTickets.js +28 -0
- package/src/modules/lottery/cronJobs/drawLottery.js +124 -0
- package/src/modules/lottery/index.ts +86 -0
- package/src/modules/playerOnboarding/commands/starterkit.js +61 -0
- package/src/modules/playerOnboarding/hooks/playerConnected.js +14 -0
- package/src/modules/playerOnboarding/index.ts +86 -0
- package/src/modules/serverMessages/cronJobs/Automated message.js +47 -0
- package/src/modules/serverMessages/index.ts +46 -0
- package/src/modules/teleports/commands/deletetp.js +25 -0
- package/src/modules/teleports/commands/deletewaypoint.js +24 -0
- package/src/modules/teleports/commands/listwaypoints.js +23 -0
- package/src/modules/teleports/commands/setprivate.js +39 -0
- package/src/modules/teleports/commands/setpublic.js +60 -0
- package/src/modules/teleports/commands/settp.js +50 -0
- package/src/modules/teleports/commands/setwaypoint.js +31 -0
- package/src/modules/teleports/commands/teleport.js +84 -0
- package/src/modules/teleports/commands/teleportwaypoint.js +57 -0
- package/src/modules/teleports/commands/tplist.js +62 -0
- package/src/modules/teleports/cronJobs/Waypoint reconciler.js +7 -0
- package/src/modules/teleports/functions/utils.js +189 -0
- package/src/modules/teleports/index.ts +217 -0
- package/src/modules/timedShutdown/cronJobs/Shutdown.js +8 -0
- package/src/modules/timedShutdown/cronJobs/warning.js +13 -0
- package/src/modules/timedShutdown/index.ts +45 -0
- package/src/modules/utils/commands/help.js +100 -0
- package/src/modules/utils/commands/ping.js +7 -0
- package/src/modules/utils/index.ts +53 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +9 -0
- package/typedoc.json +3 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { EventsAwaiter, expect, IntegrationTest, IShopSetup, shopSetup } from '@takaro/test';
|
|
2
|
+
import { HookEvents } from '../../dto/index.js';
|
|
3
|
+
import { Client, PlayerOutputDTO } from '@takaro/apiclient';
|
|
4
|
+
import { describe } from 'node:test';
|
|
5
|
+
|
|
6
|
+
const group = 'EconomyUtils:ZombieKillReward';
|
|
7
|
+
|
|
8
|
+
async function triggerKills(client: Client, player: PlayerOutputDTO, gameServerId: string, count: number) {
|
|
9
|
+
const events = (await new EventsAwaiter().connect(client)).waitForEvents(HookEvents.ENTITY_KILLED, count);
|
|
10
|
+
|
|
11
|
+
if (!player.playerOnGameServers) throw new Error('Player has no pogs');
|
|
12
|
+
const pog = player.playerOnGameServers.find((pog) => pog.gameServerId === gameServerId);
|
|
13
|
+
if (!pog) throw new Error('Player not found on game server');
|
|
14
|
+
|
|
15
|
+
await Promise.all(
|
|
16
|
+
Array.from({ length: count }, () => {
|
|
17
|
+
return client.gameserver.gameServerControllerExecuteCommand(gameServerId, {
|
|
18
|
+
command: `triggerKill ${pog.gameId}`,
|
|
19
|
+
});
|
|
20
|
+
}),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
await events;
|
|
24
|
+
return events;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const tests = [
|
|
28
|
+
new IntegrationTest<IShopSetup>({
|
|
29
|
+
group,
|
|
30
|
+
snapshot: false,
|
|
31
|
+
setup: shopSetup,
|
|
32
|
+
name: 'Simple happy path, killing one zombie gives one currency',
|
|
33
|
+
test: async function () {
|
|
34
|
+
const pogBefore = (
|
|
35
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
36
|
+
this.setupData.gameserver.id,
|
|
37
|
+
this.setupData.players[0].id,
|
|
38
|
+
)
|
|
39
|
+
).data.data;
|
|
40
|
+
|
|
41
|
+
(
|
|
42
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
43
|
+
gameServerId: this.setupData.gameserver.id,
|
|
44
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
45
|
+
})
|
|
46
|
+
).data.data;
|
|
47
|
+
const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
|
|
48
|
+
(cronjob) => cronjob.name === 'zombieKillReward',
|
|
49
|
+
);
|
|
50
|
+
if (!zombieKillCronjob) throw new Error('Cronjob not found');
|
|
51
|
+
await triggerKills(this.client, this.setupData.players[0], this.setupData.gameserver.id, 1);
|
|
52
|
+
await this.client.cronjob.cronJobControllerTrigger({
|
|
53
|
+
gameServerId: this.setupData.gameserver.id,
|
|
54
|
+
moduleId: this.setupData.economyUtilsModule.id,
|
|
55
|
+
cronjobId: zombieKillCronjob.id,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.CRONJOB_EXECUTED, 1);
|
|
59
|
+
await events;
|
|
60
|
+
|
|
61
|
+
const pogAfter = (
|
|
62
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
63
|
+
this.setupData.gameserver.id,
|
|
64
|
+
this.setupData.players[0].id,
|
|
65
|
+
)
|
|
66
|
+
).data.data;
|
|
67
|
+
expect(pogAfter.currency).to.equal(pogBefore.currency + 1);
|
|
68
|
+
},
|
|
69
|
+
}),
|
|
70
|
+
/**
|
|
71
|
+
* First kill 3 zombies, then trigger the cronjob
|
|
72
|
+
* Check if the player has 3 currency
|
|
73
|
+
* Then kill 4 zombies
|
|
74
|
+
* Check if the player has 7 currency
|
|
75
|
+
*/
|
|
76
|
+
new IntegrationTest<IShopSetup>({
|
|
77
|
+
group,
|
|
78
|
+
snapshot: false,
|
|
79
|
+
setup: shopSetup,
|
|
80
|
+
name: 'Killing multiple zombies',
|
|
81
|
+
test: async function () {
|
|
82
|
+
const pogBefore = (
|
|
83
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
84
|
+
this.setupData.gameserver.id,
|
|
85
|
+
this.setupData.players[0].id,
|
|
86
|
+
)
|
|
87
|
+
).data.data;
|
|
88
|
+
|
|
89
|
+
(
|
|
90
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
91
|
+
gameServerId: this.setupData.gameserver.id,
|
|
92
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
93
|
+
})
|
|
94
|
+
).data.data;
|
|
95
|
+
const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
|
|
96
|
+
(cronjob) => cronjob.name === 'zombieKillReward',
|
|
97
|
+
);
|
|
98
|
+
if (!zombieKillCronjob) throw new Error('Cronjob not found');
|
|
99
|
+
await triggerKills(this.client, this.setupData.players[0], this.setupData.gameserver.id, 3);
|
|
100
|
+
await this.client.cronjob.cronJobControllerTrigger({
|
|
101
|
+
gameServerId: this.setupData.gameserver.id,
|
|
102
|
+
moduleId: this.setupData.economyUtilsModule.id,
|
|
103
|
+
cronjobId: zombieKillCronjob.id,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.CRONJOB_EXECUTED, 1);
|
|
107
|
+
await events;
|
|
108
|
+
|
|
109
|
+
let pogAfter = (
|
|
110
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
111
|
+
this.setupData.gameserver.id,
|
|
112
|
+
this.setupData.players[0].id,
|
|
113
|
+
)
|
|
114
|
+
).data.data;
|
|
115
|
+
expect(pogAfter.currency).to.equal(pogBefore.currency + 3);
|
|
116
|
+
|
|
117
|
+
await triggerKills(this.client, this.setupData.players[0], this.setupData.gameserver.id, 4);
|
|
118
|
+
await this.client.cronjob.cronJobControllerTrigger({
|
|
119
|
+
gameServerId: this.setupData.gameserver.id,
|
|
120
|
+
moduleId: this.setupData.economyUtilsModule.id,
|
|
121
|
+
cronjobId: zombieKillCronjob.id,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const events2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.CRONJOB_EXECUTED, 1);
|
|
125
|
+
await events2;
|
|
126
|
+
|
|
127
|
+
pogAfter = (
|
|
128
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
129
|
+
this.setupData.gameserver.id,
|
|
130
|
+
this.setupData.players[0].id,
|
|
131
|
+
)
|
|
132
|
+
).data.data;
|
|
133
|
+
expect(pogAfter.currency).to.equal(pogBefore.currency + 7);
|
|
134
|
+
},
|
|
135
|
+
}),
|
|
136
|
+
new IntegrationTest<IShopSetup>({
|
|
137
|
+
group,
|
|
138
|
+
snapshot: false,
|
|
139
|
+
setup: shopSetup,
|
|
140
|
+
name: 'Different players killing zombies assigns the right amount to the right players',
|
|
141
|
+
test: async function () {
|
|
142
|
+
const pogBefore1 = (
|
|
143
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
144
|
+
this.setupData.gameserver.id,
|
|
145
|
+
this.setupData.players[0].id,
|
|
146
|
+
)
|
|
147
|
+
).data.data;
|
|
148
|
+
const pogBefore2 = (
|
|
149
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
150
|
+
this.setupData.gameserver.id,
|
|
151
|
+
this.setupData.players[1].id,
|
|
152
|
+
)
|
|
153
|
+
).data.data;
|
|
154
|
+
|
|
155
|
+
(
|
|
156
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
157
|
+
gameServerId: this.setupData.gameserver.id,
|
|
158
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
159
|
+
})
|
|
160
|
+
).data.data;
|
|
161
|
+
const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
|
|
162
|
+
(cronjob) => cronjob.name === 'zombieKillReward',
|
|
163
|
+
);
|
|
164
|
+
if (!zombieKillCronjob) throw new Error('Cronjob not found');
|
|
165
|
+
await triggerKills(this.client, this.setupData.players[0], this.setupData.gameserver.id, 3);
|
|
166
|
+
await triggerKills(this.client, this.setupData.players[1], this.setupData.gameserver.id, 4);
|
|
167
|
+
await this.client.cronjob.cronJobControllerTrigger({
|
|
168
|
+
gameServerId: this.setupData.gameserver.id,
|
|
169
|
+
moduleId: this.setupData.economyUtilsModule.id,
|
|
170
|
+
cronjobId: zombieKillCronjob.id,
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.CRONJOB_EXECUTED, 1);
|
|
174
|
+
await events;
|
|
175
|
+
|
|
176
|
+
const pogAfter1 = (
|
|
177
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
178
|
+
this.setupData.gameserver.id,
|
|
179
|
+
this.setupData.players[0].id,
|
|
180
|
+
)
|
|
181
|
+
).data.data;
|
|
182
|
+
const pogAfter2 = (
|
|
183
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
184
|
+
this.setupData.gameserver.id,
|
|
185
|
+
this.setupData.players[1].id,
|
|
186
|
+
)
|
|
187
|
+
).data.data;
|
|
188
|
+
expect(pogAfter1.currency).to.equal(pogBefore1.currency + 3);
|
|
189
|
+
expect(pogAfter2.currency).to.equal(pogBefore2.currency + 4);
|
|
190
|
+
},
|
|
191
|
+
}),
|
|
192
|
+
new IntegrationTest<IShopSetup>({
|
|
193
|
+
group,
|
|
194
|
+
snapshot: false,
|
|
195
|
+
setup: shopSetup,
|
|
196
|
+
name: 'Can configure a custom amount of currency per kill',
|
|
197
|
+
test: async function () {
|
|
198
|
+
const pogBefore = (
|
|
199
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
200
|
+
this.setupData.gameserver.id,
|
|
201
|
+
this.setupData.players[0].id,
|
|
202
|
+
)
|
|
203
|
+
).data.data;
|
|
204
|
+
(
|
|
205
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
206
|
+
gameServerId: this.setupData.gameserver.id,
|
|
207
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
208
|
+
userConfig: JSON.stringify({ zombieKillReward: 5 }),
|
|
209
|
+
})
|
|
210
|
+
).data.data;
|
|
211
|
+
const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
|
|
212
|
+
(cronjob) => cronjob.name === 'zombieKillReward',
|
|
213
|
+
);
|
|
214
|
+
if (!zombieKillCronjob) throw new Error('Cronjob not found');
|
|
215
|
+
await triggerKills(this.client, this.setupData.players[0], this.setupData.gameserver.id, 1);
|
|
216
|
+
await this.client.cronjob.cronJobControllerTrigger({
|
|
217
|
+
gameServerId: this.setupData.gameserver.id,
|
|
218
|
+
moduleId: this.setupData.economyUtilsModule.id,
|
|
219
|
+
cronjobId: zombieKillCronjob.id,
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.CRONJOB_EXECUTED, 1);
|
|
223
|
+
await events;
|
|
224
|
+
|
|
225
|
+
const pogAfter = (
|
|
226
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
227
|
+
this.setupData.gameserver.id,
|
|
228
|
+
this.setupData.players[0].id,
|
|
229
|
+
)
|
|
230
|
+
).data.data;
|
|
231
|
+
expect(pogAfter.currency).to.equal(pogBefore.currency + 5);
|
|
232
|
+
},
|
|
233
|
+
}),
|
|
234
|
+
new IntegrationTest<IShopSetup>({
|
|
235
|
+
group,
|
|
236
|
+
snapshot: false,
|
|
237
|
+
setup: shopSetup,
|
|
238
|
+
name: 'Can override amount earned per role',
|
|
239
|
+
test: async function () {
|
|
240
|
+
const zombieKillEarnerPermission = await this.client.permissionCodesToInputs(['ZOMBIE_KILL_REWARD_OVERRIDE']);
|
|
241
|
+
await this.client.role.roleControllerUpdate(this.setupData.role.id, {
|
|
242
|
+
permissions: [
|
|
243
|
+
{
|
|
244
|
+
permissionId: zombieKillEarnerPermission[0].permissionId,
|
|
245
|
+
count: 3,
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
const pogBefore = (
|
|
251
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
252
|
+
this.setupData.gameserver.id,
|
|
253
|
+
this.setupData.players[0].id,
|
|
254
|
+
)
|
|
255
|
+
).data.data;
|
|
256
|
+
(
|
|
257
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
258
|
+
gameServerId: this.setupData.gameserver.id,
|
|
259
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
260
|
+
userConfig: JSON.stringify({ zombieKillReward: 5 }),
|
|
261
|
+
})
|
|
262
|
+
).data.data;
|
|
263
|
+
|
|
264
|
+
const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
|
|
265
|
+
(cronjob) => cronjob.name === 'zombieKillReward',
|
|
266
|
+
);
|
|
267
|
+
if (!zombieKillCronjob) throw new Error('Cronjob not found');
|
|
268
|
+
await triggerKills(this.client, this.setupData.players[0], this.setupData.gameserver.id, 1);
|
|
269
|
+
await this.client.cronjob.cronJobControllerTrigger({
|
|
270
|
+
gameServerId: this.setupData.gameserver.id,
|
|
271
|
+
moduleId: this.setupData.economyUtilsModule.id,
|
|
272
|
+
cronjobId: zombieKillCronjob.id,
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.CRONJOB_EXECUTED, 1);
|
|
276
|
+
await events;
|
|
277
|
+
|
|
278
|
+
const pogAfter = (
|
|
279
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerGetOne(
|
|
280
|
+
this.setupData.gameserver.id,
|
|
281
|
+
this.setupData.players[0].id,
|
|
282
|
+
)
|
|
283
|
+
).data.data;
|
|
284
|
+
expect(pogAfter.currency).to.equal(pogBefore.currency + 3);
|
|
285
|
+
},
|
|
286
|
+
}),
|
|
287
|
+
];
|
|
288
|
+
|
|
289
|
+
describe(group, function () {
|
|
290
|
+
tests.forEach((test) => {
|
|
291
|
+
test.run();
|
|
292
|
+
});
|
|
293
|
+
});
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
|
+
import { HookEvents } from '../dto/index.js';
|
|
3
|
+
import { TakaroEventPlayerNewIpDetected } from '@takaro/modules';
|
|
4
|
+
import { faker } from '@faker-js/faker';
|
|
5
|
+
import { describe } from 'node:test';
|
|
6
|
+
|
|
7
|
+
const group = 'Geo Block';
|
|
8
|
+
|
|
9
|
+
const customSetup = async function (this: IntegrationTest<IModuleTestsSetupData>): Promise<IModuleTestsSetupData> {
|
|
10
|
+
const setupData = await modulesTestSetup.bind(this)();
|
|
11
|
+
|
|
12
|
+
await Promise.all(
|
|
13
|
+
setupData.players.map(async (player) => {
|
|
14
|
+
await this.client.player.playerControllerRemoveRole(player.id, setupData.role.id);
|
|
15
|
+
}),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return setupData;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const tests = [
|
|
22
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
23
|
+
group,
|
|
24
|
+
snapshot: false,
|
|
25
|
+
setup: customSetup,
|
|
26
|
+
name: 'DENY MODE: Blocked country detected -> player gets kicked based on configuration',
|
|
27
|
+
test: async function () {
|
|
28
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
29
|
+
gameServerId: this.setupData.gameserver.id,
|
|
30
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
31
|
+
userConfig: JSON.stringify({
|
|
32
|
+
mode: 'deny',
|
|
33
|
+
countries: ['RU'],
|
|
34
|
+
ban: false,
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
37
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.PLAYER_DISCONNECTED);
|
|
38
|
+
await this.client.hook.hookControllerTrigger({
|
|
39
|
+
gameServerId: this.setupData.gameserver.id,
|
|
40
|
+
playerId: this.setupData.players[0].id,
|
|
41
|
+
eventType: HookEvents.PLAYER_NEW_IP_DETECTED,
|
|
42
|
+
eventMeta: new TakaroEventPlayerNewIpDetected({
|
|
43
|
+
city: 'nowhere',
|
|
44
|
+
country: 'RU',
|
|
45
|
+
latitude: '0',
|
|
46
|
+
longitude: '0',
|
|
47
|
+
ip: faker.internet.ip(),
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
expect((await events).length).to.be.eq(1);
|
|
52
|
+
expect((await events)[0].data.playerId).to.be.eq(this.setupData.players[0].id);
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
56
|
+
group,
|
|
57
|
+
snapshot: false,
|
|
58
|
+
setup: customSetup,
|
|
59
|
+
name: 'DENY MODE: Non-blocked country detected -> no action taken',
|
|
60
|
+
test: async function () {
|
|
61
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
62
|
+
gameServerId: this.setupData.gameserver.id,
|
|
63
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
64
|
+
userConfig: JSON.stringify({
|
|
65
|
+
mode: 'deny',
|
|
66
|
+
countries: ['RU'],
|
|
67
|
+
ban: false,
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
70
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.HOOK_EXECUTED);
|
|
71
|
+
|
|
72
|
+
await this.client.hook.hookControllerTrigger({
|
|
73
|
+
gameServerId: this.setupData.gameserver.id,
|
|
74
|
+
playerId: this.setupData.players[0].id,
|
|
75
|
+
eventType: HookEvents.PLAYER_NEW_IP_DETECTED,
|
|
76
|
+
eventMeta: new TakaroEventPlayerNewIpDetected({
|
|
77
|
+
city: 'nowhere',
|
|
78
|
+
country: 'BE',
|
|
79
|
+
latitude: '0',
|
|
80
|
+
longitude: '0',
|
|
81
|
+
ip: faker.internet.ip(),
|
|
82
|
+
}),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
expect((await events).length).to.be.eq(1);
|
|
86
|
+
const containsAllowedCountryMessage = (await events)[0].data.meta.result.logs.some((log: any) => {
|
|
87
|
+
return log.msg.includes('Allowed country detected, no action');
|
|
88
|
+
});
|
|
89
|
+
expect(containsAllowedCountryMessage).to.be.eq(true, 'Decision message not found');
|
|
90
|
+
},
|
|
91
|
+
}),
|
|
92
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
93
|
+
group,
|
|
94
|
+
snapshot: false,
|
|
95
|
+
setup: customSetup,
|
|
96
|
+
name: 'ALLOW MODE: Allowed country detected -> no action taken',
|
|
97
|
+
test: async function () {
|
|
98
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
99
|
+
gameServerId: this.setupData.gameserver.id,
|
|
100
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
101
|
+
userConfig: JSON.stringify({
|
|
102
|
+
mode: 'allow',
|
|
103
|
+
countries: ['RU'],
|
|
104
|
+
ban: false,
|
|
105
|
+
}),
|
|
106
|
+
});
|
|
107
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.HOOK_EXECUTED);
|
|
108
|
+
|
|
109
|
+
await this.client.hook.hookControllerTrigger({
|
|
110
|
+
gameServerId: this.setupData.gameserver.id,
|
|
111
|
+
playerId: this.setupData.players[0].id,
|
|
112
|
+
eventType: HookEvents.PLAYER_NEW_IP_DETECTED,
|
|
113
|
+
eventMeta: new TakaroEventPlayerNewIpDetected({
|
|
114
|
+
city: 'nowhere',
|
|
115
|
+
country: 'RU',
|
|
116
|
+
latitude: '0',
|
|
117
|
+
longitude: '0',
|
|
118
|
+
ip: faker.internet.ip(),
|
|
119
|
+
}),
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
expect((await events).length).to.be.eq(1);
|
|
123
|
+
const containsAllowedCountryMessage = (await events)[0].data.meta.result.logs.some((log: any) => {
|
|
124
|
+
return log.msg.includes('Allowed country detected, no action');
|
|
125
|
+
});
|
|
126
|
+
expect(containsAllowedCountryMessage).to.be.eq(true, 'Decision message not found');
|
|
127
|
+
},
|
|
128
|
+
}),
|
|
129
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
130
|
+
group,
|
|
131
|
+
snapshot: false,
|
|
132
|
+
setup: customSetup,
|
|
133
|
+
name: 'ALLOW MODE: Non-Allowed country detected -> player gets kicked/banned based on configuration',
|
|
134
|
+
test: async function () {
|
|
135
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
136
|
+
gameServerId: this.setupData.gameserver.id,
|
|
137
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
138
|
+
userConfig: JSON.stringify({
|
|
139
|
+
mode: 'allow',
|
|
140
|
+
countries: ['RU'],
|
|
141
|
+
ban: false,
|
|
142
|
+
}),
|
|
143
|
+
});
|
|
144
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.PLAYER_DISCONNECTED);
|
|
145
|
+
|
|
146
|
+
await this.client.hook.hookControllerTrigger({
|
|
147
|
+
gameServerId: this.setupData.gameserver.id,
|
|
148
|
+
playerId: this.setupData.players[0].id,
|
|
149
|
+
eventType: HookEvents.PLAYER_NEW_IP_DETECTED,
|
|
150
|
+
eventMeta: new TakaroEventPlayerNewIpDetected({
|
|
151
|
+
city: 'nowhere',
|
|
152
|
+
country: 'BE',
|
|
153
|
+
latitude: '0',
|
|
154
|
+
longitude: '0',
|
|
155
|
+
ip: faker.internet.ip(),
|
|
156
|
+
}),
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
expect((await events).length).to.be.eq(1);
|
|
160
|
+
expect((await events)[0].data.playerId).to.be.eq(this.setupData.players[0].id);
|
|
161
|
+
},
|
|
162
|
+
}),
|
|
163
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
164
|
+
group,
|
|
165
|
+
snapshot: false,
|
|
166
|
+
setup: customSetup,
|
|
167
|
+
name: 'BAN CONFIGURATION: Ban enabled -> player gets banned instead of kicked',
|
|
168
|
+
test: async function () {
|
|
169
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
170
|
+
gameServerId: this.setupData.gameserver.id,
|
|
171
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
172
|
+
userConfig: JSON.stringify({
|
|
173
|
+
mode: 'allow',
|
|
174
|
+
countries: ['RU'],
|
|
175
|
+
ban: true,
|
|
176
|
+
}),
|
|
177
|
+
});
|
|
178
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.PLAYER_DISCONNECTED);
|
|
179
|
+
|
|
180
|
+
await this.client.hook.hookControllerTrigger({
|
|
181
|
+
gameServerId: this.setupData.gameserver.id,
|
|
182
|
+
playerId: this.setupData.players[0].id,
|
|
183
|
+
eventType: HookEvents.PLAYER_NEW_IP_DETECTED,
|
|
184
|
+
eventMeta: new TakaroEventPlayerNewIpDetected({
|
|
185
|
+
city: 'nowhere',
|
|
186
|
+
country: 'BE',
|
|
187
|
+
latitude: '0',
|
|
188
|
+
longitude: '0',
|
|
189
|
+
ip: faker.internet.ip(),
|
|
190
|
+
}),
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
expect((await events).length).to.be.eq(1);
|
|
194
|
+
expect((await events)[0].data.playerId).to.be.eq(this.setupData.players[0].id);
|
|
195
|
+
},
|
|
196
|
+
}),
|
|
197
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
198
|
+
group,
|
|
199
|
+
snapshot: false,
|
|
200
|
+
setup: customSetup,
|
|
201
|
+
name: 'MULTIPLE COUNTRIES: Handling multiple countries in the whitelist or blacklist',
|
|
202
|
+
test: async function () {
|
|
203
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
204
|
+
gameServerId: this.setupData.gameserver.id,
|
|
205
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
206
|
+
userConfig: JSON.stringify({
|
|
207
|
+
mode: 'deny',
|
|
208
|
+
countries: ['RU', 'BE'],
|
|
209
|
+
ban: true,
|
|
210
|
+
message: 'Custom message',
|
|
211
|
+
}),
|
|
212
|
+
});
|
|
213
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.PLAYER_DISCONNECTED);
|
|
214
|
+
|
|
215
|
+
await this.client.hook.hookControllerTrigger({
|
|
216
|
+
gameServerId: this.setupData.gameserver.id,
|
|
217
|
+
playerId: this.setupData.players[0].id,
|
|
218
|
+
eventType: HookEvents.PLAYER_NEW_IP_DETECTED,
|
|
219
|
+
eventMeta: new TakaroEventPlayerNewIpDetected({
|
|
220
|
+
city: 'nowhere',
|
|
221
|
+
country: 'BE',
|
|
222
|
+
latitude: '0',
|
|
223
|
+
longitude: '0',
|
|
224
|
+
ip: faker.internet.ip(),
|
|
225
|
+
}),
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
expect((await events).length).to.be.eq(1);
|
|
229
|
+
expect((await events)[0].data.playerId).to.be.eq(this.setupData.players[0].id);
|
|
230
|
+
},
|
|
231
|
+
}),
|
|
232
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
233
|
+
group,
|
|
234
|
+
snapshot: false,
|
|
235
|
+
setup: customSetup,
|
|
236
|
+
name: 'IMMUNITY PERMISSION: Player with GEOBLOCK_IMMUNITY permission is neither kicked nor banned',
|
|
237
|
+
test: async function () {
|
|
238
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
239
|
+
gameServerId: this.setupData.gameserver.id,
|
|
240
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
241
|
+
userConfig: JSON.stringify({
|
|
242
|
+
mode: 'deny',
|
|
243
|
+
countries: ['RU'],
|
|
244
|
+
ban: true,
|
|
245
|
+
message: 'Custom message',
|
|
246
|
+
}),
|
|
247
|
+
});
|
|
248
|
+
const permissions = await this.client.permissionCodesToInputs(['GEOBLOCK_IMMUNITY']);
|
|
249
|
+
const roleRes = await this.client.role.roleControllerCreate({
|
|
250
|
+
name: 'Immune to geoblock',
|
|
251
|
+
permissions,
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
await this.client.player.playerControllerAssignRole(this.setupData.players[0].id, roleRes.data.data.id);
|
|
255
|
+
|
|
256
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.HOOK_EXECUTED);
|
|
257
|
+
|
|
258
|
+
await this.client.hook.hookControllerTrigger({
|
|
259
|
+
gameServerId: this.setupData.gameserver.id,
|
|
260
|
+
playerId: this.setupData.players[0].id,
|
|
261
|
+
eventType: HookEvents.PLAYER_NEW_IP_DETECTED,
|
|
262
|
+
eventMeta: new TakaroEventPlayerNewIpDetected({
|
|
263
|
+
city: 'nowhere',
|
|
264
|
+
country: 'RU',
|
|
265
|
+
latitude: '0',
|
|
266
|
+
longitude: '0',
|
|
267
|
+
ip: faker.internet.ip(),
|
|
268
|
+
}),
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
expect((await events).length).to.be.eq(1);
|
|
272
|
+
const containsAllowedCountryMessage = (await events)[0].data.meta.result.logs.some((log: any) => {
|
|
273
|
+
return log.msg.includes('Player has immunity, no action');
|
|
274
|
+
});
|
|
275
|
+
expect(containsAllowedCountryMessage).to.be.eq(true, 'Decision message not found');
|
|
276
|
+
},
|
|
277
|
+
}),
|
|
278
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
279
|
+
group,
|
|
280
|
+
snapshot: false,
|
|
281
|
+
setup: customSetup,
|
|
282
|
+
name: 'NO COUNTRIES CONFIGURED: No action taken if countries array is empty',
|
|
283
|
+
test: async function () {
|
|
284
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
285
|
+
gameServerId: this.setupData.gameserver.id,
|
|
286
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
287
|
+
userConfig: JSON.stringify({
|
|
288
|
+
mode: 'deny',
|
|
289
|
+
countries: [],
|
|
290
|
+
ban: true,
|
|
291
|
+
message: 'Custom message',
|
|
292
|
+
}),
|
|
293
|
+
});
|
|
294
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.HOOK_EXECUTED);
|
|
295
|
+
|
|
296
|
+
await this.client.hook.hookControllerTrigger({
|
|
297
|
+
gameServerId: this.setupData.gameserver.id,
|
|
298
|
+
playerId: this.setupData.players[0].id,
|
|
299
|
+
eventType: HookEvents.PLAYER_NEW_IP_DETECTED,
|
|
300
|
+
eventMeta: new TakaroEventPlayerNewIpDetected({
|
|
301
|
+
city: 'nowhere',
|
|
302
|
+
country: 'BE',
|
|
303
|
+
latitude: '0',
|
|
304
|
+
longitude: '0',
|
|
305
|
+
ip: faker.internet.ip(),
|
|
306
|
+
}),
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
expect((await events).length).to.be.eq(1);
|
|
310
|
+
const containsAllowedCountryMessage = (await events)[0].data.meta.result.logs.some((log: any) => {
|
|
311
|
+
return log.msg.includes('Allowed country detected, no action');
|
|
312
|
+
});
|
|
313
|
+
expect(containsAllowedCountryMessage).to.be.eq(true, 'Decision message not found');
|
|
314
|
+
},
|
|
315
|
+
}),
|
|
316
|
+
];
|
|
317
|
+
|
|
318
|
+
describe(group, function () {
|
|
319
|
+
tests.forEach((test) => {
|
|
320
|
+
test.run();
|
|
321
|
+
});
|
|
322
|
+
});
|