From bd58805ccbfaa4dbc0364aaf0693923c247af080 Mon Sep 17 00:00:00 2001 From: Dave Corley <smokydave@icloud.com> Date: Mon, 9 Oct 2023 19:04:29 -0500 Subject: [PATCH 1/4] Doc(clientVariableScopes): Experimental annotations for clientVariableScopes --- scripts/clientVariableScopes.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/clientVariableScopes.lua b/scripts/clientVariableScopes.lua index e2e2178c..49ac5351 100644 --- a/scripts/clientVariableScopes.lua +++ b/scripts/clientVariableScopes.lua @@ -20,10 +20,31 @@ -- * "worldwide" is where you place variables that are always shared across all players -- because they affect the physical world in a way that should be visible to everyone, -- i.e. they affect structures, mechanism states, water levels, and so on + +--- @alias addedVariableScopes clientVariableScopes +--- @alias variable string +--- @alias varTable table <variable> +--- @alias syncState +---| "ignored", table> # Variables which never send traffic +---| "personal" string # Varibles exclusive to specific players +---| "quest" string # Variables that should synchronized if config.shareJournal is enabled +---| "kills" string # Variables that are handled like killcounts, if config.shareKills is enabled +---| "factionRanks" string # Variables related to faction ranks which are shared if config.shareFactionRanks is enabled +---| "factionExpulsion" string # Variables for faction expulsion which sync if config.shareFactionExpulsion is enabled +---| "worldwide" string # Variables always shared across all players +---| "unknown", string # Unknown handling + +--- @see NOTE: Does not sync member or local variables currently +--- @class clientVariableScopes +--- @field public globals { syncState: varTable } local clientVariableScopes = { globals = {} } +--globas is a Table +-- each field is also a named table +-- those tables are keyed with the sync state, and its values are a string[]? + if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Morrowind.esm") then local addedVariableScopes = { From 8fd242b8c2f6c8169d2b843eae23c143b7455d0a Mon Sep 17 00:00:00 2001 From: Dave Corley <smokydave@icloud.com> Date: Tue, 10 Oct 2023 02:00:26 -0500 Subject: [PATCH 2/4] Fix(clientVariableScopes): Clearer annotations for variable scopes and removed redundant docs --- scripts/clientVariableScopes.lua | 103 +++++++++---------------------- 1 file changed, 30 insertions(+), 73 deletions(-) diff --git a/scripts/clientVariableScopes.lua b/scripts/clientVariableScopes.lua index 49ac5351..4fb24eea 100644 --- a/scripts/clientVariableScopes.lua +++ b/scripts/clientVariableScopes.lua @@ -1,53 +1,29 @@ --- Place clientside variables in different categories to decide how they are synchronized, --- saved and loaded --- --- Note: Currently, only global variables are handled, not local or member variables --- --- Descriptions: --- * "ignored" is where you place variables that clients should not send packets about, --- either because they are already handled in other packets or because they would cause --- unnecessary packet spam --- * "personal" is where you place variables that are always exclusive to specific players --- and that should not be shared regardless of other server options --- * "quest" is where you place variables that should be synchronized and shared across --- players based on the value of config.shareJournal --- * "kills" is where you place variables that should be handled the same as kill counts --- and should be cleared whenever the regular kill counts are --- * "factionRanks" is where you place variables that should be synchronized and shared across --- players based on the value of config.shareFactionRanks --- * "factionExpulsion" is where you place variables that should be synchronized and shared across --- players based on the value of config.shareFactionExpulsion --- * "worldwide" is where you place variables that are always shared across all players --- because they affect the physical world in a way that should be visible to everyone, --- i.e. they affect structures, mechanism states, water levels, and so on +--- @class TypedVariableScopes +--- @field ignored string[]? Variables which never send traffic +--- @field personal string[]? Variables exclusive to specific players +--- @field quest string[]? Variables that should synchronized if config.shareJournal is enabled +--- @field kills string[]? Variables that are handled like killcounts, if config.shareKills is enabled +--- @field factionRanks string[]? Variables related to faction ranks which are shared if config.shareFactionRanks is enabled +--- @field factionExpulsion string[]? Variables for faction expulsion which sync if config.shareFactionExpulsion is enabled +--- @field worldwide string[]? Variables always shared across all players +--- @field unknown string[]? Unknown handling ---- @alias addedVariableScopes clientVariableScopes ---- @alias variable string ---- @alias varTable table <variable> ---- @alias syncState ----| "ignored", table> # Variables which never send traffic ----| "personal" string # Varibles exclusive to specific players ----| "quest" string # Variables that should synchronized if config.shareJournal is enabled ----| "kills" string # Variables that are handled like killcounts, if config.shareKills is enabled ----| "factionRanks" string # Variables related to faction ranks which are shared if config.shareFactionRanks is enabled ----| "factionExpulsion" string # Variables for faction expulsion which sync if config.shareFactionExpulsion is enabled ----| "worldwide" string # Variables always shared across all players ----| "unknown", string # Unknown handling - ---- @see NOTE: Does not sync member or local variables currently ---- @class clientVariableScopes ---- @field public globals { syncState: varTable } +--- Place clientside variables in different categories to decide how they are synchronized, saved and loaded +--- Master table containing all variable types, and a table with named scopes +--- containing a list of variables and their respective sync states +--- NOTE: Does not actually sync member or local variables currently +--- @class ClientVariableScopes +--- @field globals TypedVariableScopes Global MWScript variables +--- @field locals TypedVariableScopes? Local MWScript variables +--- @field members TypedVariableScopes? Actually I'm not sure what these are for local clientVariableScopes = { - globals = {} + globals = { + }, } ---globas is a Table --- each field is also a named table --- those tables are keyed with the sync state, and its values are a string[]? - if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Morrowind.esm") then - - local addedVariableScopes = { + --- @type ClientVariableScopes + local addedVariableScopes = { globals = { ignored = { -- game state @@ -125,7 +101,7 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Morrowind.esm") t end if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Tribunal.esm") then - + --- @type ClientVariableScopes local addedVariableScopes = { globals = { ignored = { @@ -165,7 +141,7 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Tribunal.esm") th end if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Bloodmoon.esm") then - + --- @type ClientVariableScopes local addedVariableScopes = { globals = { ignored = { @@ -207,7 +183,7 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Bloodmoon.esm") t end if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Tamriel_Data.ESM") then - + --- @type ClientVariableScopes local addedVariableScopes = { globals = { ignored = { @@ -215,8 +191,7 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Tamriel_Data.ESM" "TR_MapPos", "TR_CellX", "TR_CellY", "TR_Test", "PC_NoLore", "T_Glob_cleanup_x", "T_Glob_cleanup_y", "T_Glob_cleanup_z", "T_Glob_cleanup_state", "T_Glob_DWelk_cleanup", "T_Glb_GetTeleportingDisabled", "T_Glob_PassTimeHours", "T_Glob_GetTeleportingDisabled", "T_Glob_Speech_Debug", "T_Glob_Speech_Sway", - "T_Glob_Speech_Haggle", "T_Glob_Speech_Debate", - + "T_Glob_Speech_Haggle", "T_Glob_Speech_Debate", -- card game "T_Glob_CardHortX", "T_Glob_CardHortY", "T_Glob_CardHortZ", "T_Glob_CardHortReshapeX", "T_Glob_CardHortReshapeY", "T_Glob_CardHortCol1Len", "T_Glob_CardHortCol2Len", "T_Glob_CardHortCol3Len", "T_Glob_CardHortCol4Len", @@ -226,30 +201,24 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Tamriel_Data.ESM" "T_Glob_CardHortCol5Lock2", "T_Glob_CardHortCol6Lock2", "T_Glob_CardHortSaveLoad", "T_Glob_CardHortActiveLen", "T_Glob_CardHortTop", "T_Glob_CardHortDummy", "T_Glob_CardHortState", "T_Glob_CardHortTracker", "T_Glob_CardHortRow", "T_Glob_CardHortRot", "T_Glob_CardHortRank", "T_Glob_CardHortCol", "T_Glob_CardHortHouse" - }, personal = { -- player state "T_Glob_PorphyricInfected", "T_Glob_WereInfected", - -- Bank accounts "T_Glob_Bank_All_CurrentBank", "T_Glob_Bank_Bri_AcctAmount", "T_Glob_Bank_Bri_LoanAmount", "T_Glob_Bank_Bri_LoanDate", "T_Glob_Bank_Bri_LoanFail", "T_Glob_Bank_Hla_LoanFail", "T_Glob_Bank_Hla_AcctAmount", "T_Glob_Bank_Hla_LoanAmount", "T_Glob_Bank_Hla_LoanDate", - }, quest = { -- reputation "T_Glob_Rep_Sky_Pr", "T_Glob_Rep_Sky_Re" }, kills = { - }, factionRanks = { - }, factionExpulsion = { - }, worldwide = { -- mechanisms @@ -257,19 +226,17 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Tamriel_Data.ESM" -- objects "T_Glob_KingOrgCoffer_Uses", -- news - "T_Glob_News_Bellman_Pick1", "T_Glob_News_Bellman_Pick2", "T_Glob_News_Bellman_Tracker1", "T_Glob_News_Bellman_Tracker2" + "T_Glob_News_Bellman_Pick1", "T_Glob_News_Bellman_Pick2", "T_Glob_News_Bellman_Tracker1", "T_Glob_News_Bellman_Tracker2" }, unknown = { - } } } - tableHelper.merge(clientVariableScopes, addedVariableScopes, true) end if tableHelper.containsCaseInsensitiveString(clientDataFiles, "TR_Mainland.ESM") then - + --- @type ClientVariableScopes local addedVariableScopes = { globals = { ignored = { @@ -321,13 +288,10 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "TR_Mainland.ESM") "TR_m3_TT_ProverbCounter", "TR_m3_TT_Lloris4Indoril", "TR_m3_TT_Lloris4Hlaalu", "TR_m3_VysAssanudCheck", "TR_m3_TT_LatestRumorATGlobal", "TR_m3_Kha_SY_convinced", "TR_m3_Kha_SY_final", "TR_m3_TT_RIP_garvs_heresy", "TR_m3_TT_RIP_refusecount", "TR_m4_TJ_Court_State", "TR_m2_NisirelConfronted", "TR_m3_q_A3_Seen_Basement", "TR_m3_OE_elysanadiamondstole", "TR_m3_OE_KtD_Tur", "TR_m3_OE_KtD_Gul", "TR_m3_OE_KtD_Mur", "TR_m3_OE_KtD_Ema", "TR_m3_OE_StendarrIdolsOutlawed" - }, kills = { - }, factionRanks = { - }, factionExpulsion = { -- faction expulsion forgiveness and timers @@ -353,7 +317,6 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "TR_Mainland.ESM") "TR_Thirr_Conflict_Score", "TR_Thirr_Conflict_Heat", "TR_m3_TT_g_ritstart" }, unknown = { - } } } @@ -362,7 +325,7 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "TR_Mainland.ESM") end if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Cyrodiil_Main.esm") then - + --- @type ClientVariableScopes local addedVariableScopes = { globals = { ignored = { @@ -374,23 +337,18 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Cyrodiil_Main.esm "PC_Rent_Stirk_Sloads_Tale", "PC_Rent_Stirk_Safe_Harbor" }, quest = { - }, kills = { - }, factionRanks = { - }, factionExpulsion = { - }, worldwide = { -- mechanisms "PC_i1_51_Gate_State" }, unknown = { - } } } @@ -399,7 +357,7 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Cyrodiil_Main.esm end if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Sky_Main.esm") then - + --- @type ClientVariableScopes local addedVariableScopes = { globals = { ignored = { @@ -432,7 +390,6 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Sky_Main.esm") th "Sky_qRe_DSW01_Dagger_glb", "Sky_qRe_DSW01_Scimitar_glb", "Sky_qRe_DSW01_Saber_glb", "Sky_qRe_DSW02_Auth_glb", "Sky_qRe_KG5_SViir_glb", "Sky_qRe_KWFG04_Owner_glb", "Sky_qRE_KWTG07_Glb_QuestDone", "Sky_qRe_MAI04_Counter_glb", "Sky_qRe_NAR01_Investigate_glb" - }, kills = { -- main quest @@ -471,7 +428,7 @@ if tableHelper.containsCaseInsensitiveString(clientDataFiles, "Sky_Main.esm") th "Sky_qRe_DSE_ArenaFight_glb" }, unknown = { - + } } } From 6e97305116419315c0eae72c6e2179116871e948 Mon Sep 17 00:00:00 2001 From: Dave Corley <smokydave@icloud.com> Date: Tue, 10 Oct 2023 02:41:10 -0500 Subject: [PATCH 3/4] Experiment(clientVariableScopes): Place optional marker next to field name instead of type name --- scripts/clientVariableScopes.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/clientVariableScopes.lua b/scripts/clientVariableScopes.lua index 4fb24eea..2779a0c6 100644 --- a/scripts/clientVariableScopes.lua +++ b/scripts/clientVariableScopes.lua @@ -1,12 +1,12 @@ --- @class TypedVariableScopes ---- @field ignored string[]? Variables which never send traffic ---- @field personal string[]? Variables exclusive to specific players ---- @field quest string[]? Variables that should synchronized if config.shareJournal is enabled ---- @field kills string[]? Variables that are handled like killcounts, if config.shareKills is enabled ---- @field factionRanks string[]? Variables related to faction ranks which are shared if config.shareFactionRanks is enabled ---- @field factionExpulsion string[]? Variables for faction expulsion which sync if config.shareFactionExpulsion is enabled ---- @field worldwide string[]? Variables always shared across all players ---- @field unknown string[]? Unknown handling +--- @field ignored? string[] Variables which never send traffic +--- @field personal? string[] Variables exclusive to specific players +--- @field quest? string[] Variables that should synchronized if config.shareJournal is enabled +--- @field kills? string[] Variables that are handled like killcounts, if config.shareKills is enabled +--- @field factionRanks? string[] Variables related to faction ranks which are shared if config.shareFactionRanks is enabled +--- @field factionExpulsion? string[] Variables for faction expulsion which sync if config.shareFactionExpulsion is enabled +--- @field worldwide? string[] Variables always shared across all players +--- @field unknown? string[] Unknown handling --- Place clientside variables in different categories to decide how they are synchronized, saved and loaded --- Master table containing all variable types, and a table with named scopes From 00c335cf7c37d5bb02ada22d42148de73a822746 Mon Sep 17 00:00:00 2001 From: Dave Corley <smokydave@icloud.com> Date: Tue, 10 Oct 2023 02:43:45 -0500 Subject: [PATCH 4/4] Fix(clientVariableScopes): Also place optional marker next to field name in clientvariablescopes --- scripts/clientVariableScopes.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/clientVariableScopes.lua b/scripts/clientVariableScopes.lua index 2779a0c6..cb5a550e 100644 --- a/scripts/clientVariableScopes.lua +++ b/scripts/clientVariableScopes.lua @@ -14,8 +14,8 @@ --- NOTE: Does not actually sync member or local variables currently --- @class ClientVariableScopes --- @field globals TypedVariableScopes Global MWScript variables ---- @field locals TypedVariableScopes? Local MWScript variables ---- @field members TypedVariableScopes? Actually I'm not sure what these are for +--- @field locals? TypedVariableScopes Local MWScript variables +--- @field members? TypedVariableScopes Actually I'm not sure what these are for local clientVariableScopes = { globals = { },