1 |
6 |
MrJackdaw-1942 |
import "Turbine" |
2 |
|
MrJackdaw-1942 |
import "Turbine.UI"; |
3 |
|
MrJackdaw-1942 |
import "Turbine.UI.Lotro"; |
4 |
|
MrJackdaw-1942 |
import "Turbine.Gameplay"; |
5 |
|
MrJackdaw-1942 |
import "JackdawPlugins.BuffWatch.Functions" |
6 |
|
MrJackdaw-1942 |
import "JackdawPlugins.BuffWatch.Options" |
7 |
|
MrJackdaw-1942 |
|
8 |
|
MrJackdaw-1942 |
--[[ |
9 |
|
MrJackdaw-1942 |
Buff Watch |
10 |
|
MrJackdaw-1942 |
*******************]]-- |
11 |
8 |
MrJackdaw-1942 |
verno="0.4 Beta" |
12 |
6 |
MrJackdaw-1942 |
--[[ |
13 |
|
MrJackdaw-1942 |
Reminds you to replace some buffs if you forget. |
14 |
|
MrJackdaw-1942 |
|
15 |
|
MrJackdaw-1942 |
You can click the window to dismiss it... but it will always come back! |
16 |
|
MrJackdaw-1942 |
|
17 |
|
MrJackdaw-1942 |
Will watch for a maximum of 10 categories of buffs. More than enough I think... |
18 |
|
MrJackdaw-1942 |
|
19 |
|
MrJackdaw-1942 |
The slash commands /bw or /buffwatch will bring up the options window. |
20 |
|
MrJackdaw-1942 |
|
21 |
8 |
MrJackdaw-1942 |
The showincombat option below allows the window to show even in combat! Only added for testing purposes. |
22 |
6 |
MrJackdaw-1942 |
|
23 |
|
MrJackdaw-1942 |
NOTES: |
24 |
8 |
MrJackdaw-1942 |
There seems to be a bug in effects. EffectRemoved that means it is fired even when you GAIN a buff. |
25 |
6 |
MrJackdaw-1942 |
So, currently this calls all the functions TWICE when a buff is gained. |
26 |
|
MrJackdaw-1942 |
|
27 |
8 |
MrJackdaw-1942 |
KNOWN "Features"; |
28 |
|
MrJackdaw-1942 |
If you click "New Category" after editing the current categories buffs then... you lose the changes. Not serious enough to block. |
29 |
|
MrJackdaw-1942 |
|
30 |
6 |
MrJackdaw-1942 |
TODO: |
31 |
|
MrJackdaw-1942 |
Turbine bug - checkboxes you must click on the text NOT the checkbox. |
32 |
|
MrJackdaw-1942 |
Make more efficient by not always "scanning all" whenever a buff changes. -- See note above however. |
33 |
|
MrJackdaw-1942 |
]]-- |
34 |
|
MrJackdaw-1942 |
|
35 |
|
MrJackdaw-1942 |
--Load data |
36 |
|
MrJackdaw-1942 |
RemindMe=Turbine.PluginData.Load( Turbine.DataScope.Character, "BuffWatch" ); |
37 |
|
MrJackdaw-1942 |
|
38 |
|
MrJackdaw-1942 |
if RemindMe==nil then |
39 |
|
MrJackdaw-1942 |
--Default to a hunter who wants food, would like to be in at least one stance and likes to run quick... |
40 |
|
MrJackdaw-1942 |
RemindMe={} |
41 |
|
MrJackdaw-1942 |
|
42 |
|
MrJackdaw-1942 |
RemindMe[1]={} |
43 |
|
MrJackdaw-1942 |
RemindMe[1].bufflist={ "Stance: Strength", |
44 |
|
MrJackdaw-1942 |
"Stance: Precision", |
45 |
|
MrJackdaw-1942 |
"Stance: Endurance", |
46 |
|
MrJackdaw-1942 |
"Stance: Fleet"} |
47 |
|
MrJackdaw-1942 |
RemindMe[1].reminder= "Stance" |
48 |
|
MrJackdaw-1942 |
RemindMe[1].AndOr="or" |
49 |
|
MrJackdaw-1942 |
|
50 |
|
MrJackdaw-1942 |
RemindMe[2]={} |
51 |
|
MrJackdaw-1942 |
RemindMe[2].bufflist={ "Find the Path"} |
52 |
|
MrJackdaw-1942 |
RemindMe[2].reminder= "Find the Path" |
53 |
|
MrJackdaw-1942 |
RemindMe[2].AndOr="or" |
54 |
|
MrJackdaw-1942 |
|
55 |
|
MrJackdaw-1942 |
RemindMe[3]={} |
56 |
|
MrJackdaw-1942 |
RemindMe[3].bufflist={ "Food"} |
57 |
|
MrJackdaw-1942 |
RemindMe[3].reminder= "Food" |
58 |
|
MrJackdaw-1942 |
RemindMe[3].AndOr="or" |
59 |
|
MrJackdaw-1942 |
end |
60 |
|
MrJackdaw-1942 |
--This is a compatability module to stop problems with those who downloaded the original version of this plugin. |
61 |
|
MrJackdaw-1942 |
for i=1, #RemindMe do |
62 |
|
MrJackdaw-1942 |
if RemindMe[i].AndOr==nil then |
63 |
|
MrJackdaw-1942 |
RemindMe[i].AndOr="or" |
64 |
|
MrJackdaw-1942 |
end |
65 |
|
MrJackdaw-1942 |
end |
66 |
|
MrJackdaw-1942 |
if RemindMe.x==nil then RemindMe.x,RemindMe.y=(Turbine.UI.Display.GetWidth()/2)-75,50 end |
67 |
|
MrJackdaw-1942 |
|
68 |
|
MrJackdaw-1942 |
--Variables |
69 |
|
MrJackdaw-1942 |
--********* |
70 |
9 |
MrJackdaw-1942 |
Player = Turbine.Gameplay.LocalPlayer.GetInstance(); |
71 |
6 |
MrJackdaw-1942 |
effects = Player:GetEffects(); |
72 |
|
MrJackdaw-1942 |
showincombat=false |
73 |
|
MrJackdaw-1942 |
|
74 |
|
MrJackdaw-1942 |
--Register for events |
75 |
|
MrJackdaw-1942 |
|
76 |
10 |
MrJackdaw-1942 |
handle1 = AddCallback(effects, "EffectAdded", function(sender, args) |
77 |
6 |
MrJackdaw-1942 |
--Called when an effect is added |
78 |
|
MrJackdaw-1942 |
if Player:IsInCombat() then |
79 |
|
MrJackdaw-1942 |
Reminder.window:SetVisible(showincombat) |
80 |
|
MrJackdaw-1942 |
if showincombat then scanner () end |
81 |
|
MrJackdaw-1942 |
else |
82 |
|
MrJackdaw-1942 |
scanner() |
83 |
|
MrJackdaw-1942 |
end |
84 |
10 |
MrJackdaw-1942 |
end) |
85 |
6 |
MrJackdaw-1942 |
|
86 |
10 |
MrJackdaw-1942 |
handle2 = AddCallback(effects, "EffectRemoved", function(sender, args) |
87 |
6 |
MrJackdaw-1942 |
--Called when an effect is removed, |
88 |
|
MrJackdaw-1942 |
-- but FRUSTRATINGLY!, also called when an effect is added, unless the player has no buffs. I think this is because it is re-ordering the buffs. |
89 |
|
MrJackdaw-1942 |
if Player:IsInCombat() then |
90 |
|
MrJackdaw-1942 |
Reminder.window:SetVisible(showincombat) |
91 |
|
MrJackdaw-1942 |
if showincombat then scanner () end |
92 |
|
MrJackdaw-1942 |
else |
93 |
|
MrJackdaw-1942 |
scanner () |
94 |
|
MrJackdaw-1942 |
end |
95 |
10 |
MrJackdaw-1942 |
end) |
96 |
6 |
MrJackdaw-1942 |
|
97 |
|
MrJackdaw-1942 |
--EffectsCleared not called when adding or removing buffs. |
98 |
|
MrJackdaw-1942 |
--effects.EffectsCleared = function(sender, args) |
99 |
|
MrJackdaw-1942 |
--end |
100 |
11 |
MrJackdaw-1942 |
-- add a callback |
101 |
|
MrJackdaw-1942 |
handle3 = AddCallback(Player, "InCombatChanged", function( sender, args ) |
102 |
12 |
MrJackdaw-1942 |
--Turbine.Shell.WriteLine("BW: In combat changed") |
103 |
6 |
MrJackdaw-1942 |
--called when entering or leaving combat |
104 |
|
MrJackdaw-1942 |
if Player:IsInCombat() then |
105 |
|
MrJackdaw-1942 |
Reminder.window:SetVisible(showincombat) |
106 |
|
MrJackdaw-1942 |
if showincombat then scanner () end |
107 |
|
MrJackdaw-1942 |
else |
108 |
|
MrJackdaw-1942 |
--Always do a full scan on leaving combat |
109 |
|
MrJackdaw-1942 |
scanner () |
110 |
|
MrJackdaw-1942 |
end |
111 |
11 |
MrJackdaw-1942 |
end) |
112 |
6 |
MrJackdaw-1942 |
|
113 |
|
MrJackdaw-1942 |
--Build the table |
114 |
|
MrJackdaw-1942 |
BuildTable() |
115 |
|
MrJackdaw-1942 |
--And finally - run for the first time! |
116 |
|
MrJackdaw-1942 |
scanner() |