Skip to main content

TeenyPatches

A class in TavernLib, TavernLib.Patches.

Small Harmony patches that let the game run without Alta's services: local cosmetic presets, free cosmetics only, local server joins, TavernLib's join token check and an always-online flag. Both sides.

Constructors​

MemberWhat it is
TeenyPatches()Created by TavernLib; mods don't make one.

Methods​

MemberWhat it is
static bool AlwaysAllowAnyItem(ref Task<bool> __result)Prefix on PurchasedList.ValidatePlayersOwnedItems that answers true, so a player's look is always accepted.
static bool CheckJoinToken(string tokenString, int playerId, ref Task<ServerPlayerConnectionHandlerOld.PlayerJoinResult> __result)Prefix on ServerPlayerConnectionHandlerOld.CheckIfPlayerIsAllowedCustom: checks the token's user id, the player limit and sets the status from roles.
static bool DisallowPaidCosmetics(ref Task __result, PurchasedList __instance)Prefix on PurchasedList.Refresh that skips it and sets owned and available cosmetics to the free-for-all set only.
static void IsConnectedToInternetInternal_Postfix(ref bool __result)Postfix on ApiAccess.IsConnectedToInternetInternal that always answers true.
static bool LocalCreateCosmeticPreset(int presetId, uint[] data, int byteSize, ref Task<UserPresetDataInfo> __result)Prefix on UserApiClient.CreateCosmeticsPreset that writes the preset to A Township Tale\presets\<id>.preset instead.
static bool LocalDeleteCosmeticPreset(int presetId, ref Task __result)Three prefixes: deletes a local preset file, empties the store rotation (never applied, it has no prefix marker), and replaces Player.SyncCosmetics.
static bool LocalDeleteCosmeticPreset(ref Task __result)Three prefixes: deletes a local preset file, empties the store rotation (never applied, it has no prefix marker), and replaces Player.SyncCosmetics.
static bool LocalDeleteCosmeticPreset(IPlayer player, Stream stream, Player __instance)Three prefixes: deletes a local preset file, empties the store rotation (never applied, it has no prefix marker), and replaces Player.SyncCosmetics.
static void LocalGameServerInfo_Postfix(int sceneIndex, ref GameServerInfo __result)Postfix on MenuSettings.LocalGameServerInfo: applies the forced scene and points a local join at loopback with the command-line ports.
static bool LocalGetAllCosmeticPresets(ref Task<IEnumerable<UserPresetDataInfo>> __result)Prefix on UserApiClient.GetAllCosmeticsPresets that reads every .preset file in A Township Tale\presets instead.
static bool LocalJoinArg()Prefix on ApplicationStartupManager.RunStartupActions: with /join_local_server, skips startup and joins the server from the command line.
static bool QuitOnMenuReturn(ReturnToMainMenuAction __instance)Prefix on ReturnToMainMenuAction.LetGoValid that quits the game instead of going back to the main menu.
3 private and internal methods
MemberWhat it is
private static ServerPlayerConnectionHandlerOld.PlayerJoinResult JoinResult(string tokenString, int playerId)Server side: checks the join token's user id and the player limit and returns an allowed or denied result.
internal static PlayerSubscriberStatus MemberStatusFromRoles(string username)Internal: the game status for a username from its roles: dev is Developer, mod is AltaMod, supporter is Subscriber.
private static int? WebPortArg()The web port from the dev server web port argument, or null if it is missing or out of range.