vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2 This is a simple text file to allow players to change stance
3 via the chat.
4  
5 By Alexander Brazie
6 ]]
7  
8 UltimateUI_ShapeshiftList = {
9 -- Stances
10 ["Battle Stance"] = 1;
11 ["Defensive Stance"] = 2;
12 ["Beserker Stance"] = 3;
13  
14 -- Rogue Stealth
15 ["Stealth"] = 1;
16  
17 -- Shapeshifts
18 ["Bear Form"] = 1;
19 ["Water Form"] = 2;
20 ["Cat Form"] = 3;
21 ["Travel Form"] = 4;
22  
23 -- Aliases
24  
25 -- Stances
26 ["battle"] = 1;
27 ["btl"] = 1;
28 ["defensive"] = 2;
29 ["def"] = 2;
30 ["beserk"] = 3;
31 ["bzrk"] = 3;
32  
33 -- Rogue Stealth
34 ["stl"] = 1;
35  
36 -- Shapeshifts
37 ["bear"] = 1;
38 ["seal"] = 2;
39 ["cat"] = 3;
40 ["travel"] = 4;
41 };
42  
43 UltimateUI_ShapeshiftList_ByClass = {
44  
45 ["Druid"] = {
46 -- Shapeshifts
47 ["bear form"] = 1,
48 ["water form"] = 2,
49 ["cat form"] = 3,
50 ["travel form"] = 4,
51  
52 -- Aliases
53  
54 ["bear"] = 1,
55 ["seal"] = 2,
56 ["cat"] = 3,
57 ["travel"] = 4,
58  
59 ["tank"] = 1,
60 ["aqua"] = 2,
61 ["dps"] = 3;
62 },
63  
64 ["Rogue"] = {
65 -- Rogue Stealth
66 ["stealth"] = 1,
67  
68 -- Aliases
69  
70 ["stl"] = 1;
71 },
72  
73 ["Warrior"] = {
74 -- Stances
75 ["battle stance"] = 1,
76 ["defensive stance"] = 2,
77 ["beserker stance"] = 3,
78  
79 -- Aliases
80  
81 ["battle"] = 1,
82 ["btl"] = 1,
83 ["defensive"] = 2,
84 ["def"] = 2,
85 ["beserk"] = 3,
86 ["bzrk"] = 3;
87 }
88  
89 };
90  
91  
92 function ShapeshiftByNumber(id)
93 CastShapeshiftForm(id);
94 end
95  
96 function ShapeshiftByName(name)
97 local list = UltimateUI_ShapeshiftList_ByClass[UnitClass("player")];
98  
99 if ( not list ) then
100 return false;
101 end
102  
103 if ( not name ) then
104 return false;
105 end
106 local text = string.lower(name);
107 if ( not text ) then
108 return false;
109 end
110  
111 for k,v in list do
112 if (text == v) then
113 ShapeshiftByNumber(v);
114 return true;
115 end
116 end
117 for k,v in list do
118 if (string.find(text,v) ~= nil) then
119 ShapeshiftByNumber(v);
120 return true;
121 end
122 end
123 return false;
124 end
125  
126 function ShapeshiftByChat(text)
127 local shapeshiftId = tonumber(text);
128 if ( shapeshiftId ) then
129 ShapeshiftByNumber(text);
130 else
131 ShapeshiftByName(text);
132 end
133  
134 end
135  
136 function ShapeshiftStealth()
137 ShapeshiftByNumber(1);
138 end
139  
140 function ShapeshiftCommands_Register()
141 -- Register the chat bindings
142 UltimateUI_RegisterChatCommand(
143 "SSC_STANCE",
144 SHAPE_COMM1,
145 ShapeshiftByChat,
146 SHAPE_COMM1_INFO,
147 CSM_CHAINNONE
148 );
149 UltimateUI_RegisterChatCommand(
150 "SSC_STEALTH",
151 SHAPE_COMM2,
152 ShapeshiftStealth,
153 SHAPE_COMM2_INFO,
154 CSM_CHAINNONE
155 );
156 UltimateUI_RegisterChatCommand(
157 "SSC_SHAPESHIFT",
158 SHAPE_COMM3,
159 ShapeshiftByChat,
160 SHAPE_COMM3_INFO,
161 CSM_CHAINNONE
162 );
163  
164 end