vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | Saved Variables Configuration and management code |
||
3 | ]] |
||
4 | |||
5 | Gatherer_Settings = {}; |
||
6 | |||
7 | Gatherer_Configuration = {}; |
||
8 | _G = getfenv(0); |
||
9 | local metatable = { __index = _G }; |
||
10 | Gatherer_Configuration.global = _G; |
||
11 | Gatherer_Configuration._G = _G; |
||
12 | setmetatable( Gatherer_Configuration, metatable ); |
||
13 | setfenv(1, Gatherer_Configuration); |
||
14 | |||
15 | Default_Settings = { |
||
16 | ["minderTime"] = 5, |
||
17 | ["maxDist"] = 20, |
||
18 | ["alphaUnderMinIcon"] = 80, |
||
19 | ["number"] = 10, |
||
20 | ["mapMinder"] = false, |
||
21 | ["showWorldMapFilters"] = 0, |
||
22 | ["logInfo"] = "on", |
||
23 | ["iconSet"] = "shaded", |
||
24 | --["Version"] = "2.2.3.1", |
||
25 | ["ToggleWorldNotes"] = 0, |
||
26 | ["IconSize"] = 12, |
||
27 | ["useMinimapText"] = "on", |
||
28 | ["disableWMFreezeWorkaround"] = 1, |
||
29 | ["filter"] = "all", |
||
30 | |||
31 | -- Minimap Display Options |
||
32 | ["NoIconOnMinDist"] = 0, |
||
33 | ["HideIcon"] = 0, |
||
34 | ["HideMiniNotes"] = 0, |
||
35 | ["miniIconDist"] = 30, --old default of 40 |
||
36 | ["fadeDist"] = 60, --old default of 40 |
||
37 | ["fadePerc"] = 80, |
||
38 | |||
39 | -- |
||
40 | ["rareOre"] = 0, |
||
41 | |||
42 | -- MiniMap Icon Show Menu Options |
||
43 | ["ShowOnMouse"] = 1, |
||
44 | ["ShowOnClick"] = 0, |
||
45 | ["ShowOnButton"] = 0, |
||
46 | ["HideOnMouse"] = 1, |
||
47 | ["HideOnClick"] = 0, |
||
48 | ["HideOnButton"] = 0, |
||
49 | |||
50 | -- Minimap Icon Position |
||
51 | ["Position"] = 12, |
||
52 | ["Radius"] = 80, |
||
53 | |||
54 | -- location display |
||
55 | ["useMainmap"] = true, |
||
56 | ["useMinimap"] = true, |
||
57 | |||
58 | -- per gather type tables |
||
59 | -- these tables are filled in by the code immediately after this table definition |
||
60 | ["interested"] = {}, |
||
61 | ["filterRecording"] = {}, |
||
62 | ["filters"] = {}, |
||
63 | |||
64 | -- min skill filters |
||
65 | ["minSetOreSkill"] = nil, |
||
66 | ["minSetHerbSkill"] = nil, |
||
67 | |||
68 | -- debug |
||
69 | ["debug"] = false, |
||
70 | |||
71 | ['p2p'] = true, |
||
72 | } |
||
73 | |||
74 | --set per gather type defaults |
||
75 | for gatherType, nodeTypes in pairs(Gather_DB_IconIndex) do |
||
76 | Default_Settings.filterRecording[gatherType] = false; |
||
77 | Default_Settings.filters[gatherType] = "auto"; |
||
78 | |||
79 | local interestedTypeTable = {}; |
||
80 | for nodeType in pairs(nodeTypes) do |
||
81 | if ( nodeType ~= "default" ) then |
||
82 | interestedTypeTable[nodeType] = true; |
||
83 | end |
||
84 | end |
||
85 | Default_Settings.interested[gatherType] = interestedTypeTable; |
||
86 | end |
||
87 | |||
88 | --defines keys which are saved in the PerCharacter settings |
||
89 | PerCharacter = { |
||
90 | "interested", |
||
91 | "filterRecording", |
||
92 | "filters", |
||
93 | "minSetOreSkill", |
||
94 | "minSetHerbSkill", |
||
95 | } |
||
96 | |||
97 | --Load settings from the SavedVariables tables |
||
98 | function Load() |
||
99 | local Gatherer_Settings = Gatherer_Settings; |
||
100 | for key, value in pairs(Default_Settings) do |
||
101 | Gatherer_Settings[key] = value; |
||
102 | end |
||
103 | |||
104 | if ( Gatherer_SavedSettings_AccountWide ) then |
||
105 | for key, value in pairs(Gatherer_SavedSettings_AccountWide) do |
||
106 | Gatherer_Settings[key] = value; |
||
107 | end |
||
108 | end |
||
109 | |||
110 | if ( Gatherer_SavedSettings_PerCharacter ) then |
||
111 | for key, value in pairs(Gatherer_SavedSettings_PerCharacter) do |
||
112 | Gatherer_Settings[key] = value; |
||
113 | end |
||
114 | end |
||
115 | end |
||
116 | |||
117 | --Save settings to the SavedVariables tables |
||
118 | -- Call this when the PLAYER_LOGOUT event fires or saved settings |
||
119 | -- will not be updated |
||
120 | function Save() |
||
121 | local Gatherer_Settings = Gatherer_Settings; |
||
122 | |||
123 | local accountSettings = {}; |
||
124 | for key in pairs(Gatherer_Settings) do |
||
125 | accountSettings[key] = Gatherer_Settings[key]; |
||
126 | end |
||
127 | global.Gatherer_SavedSettings_AccountWide = accountSettings |
||
128 | |||
129 | local characterSettings = {}; |
||
130 | for _, key in pairs(PerCharacter) do |
||
131 | characterSettings[key] = Gatherer_Settings[key]; |
||
132 | end |
||
133 | global.Gatherer_SavedSettings_PerCharacter = characterSettings; |
||
134 | end |