@@ -584,8 +584,6 @@ local HekiliSpecMixin = {
584
584
end
585
585
end ,
586
586
587
-
588
-
589
587
RegisterPotion = function ( self , potion , data )
590
588
self .potions [ potion ] = data
591
589
@@ -1017,31 +1015,88 @@ local HekiliSpecMixin = {
1017
1015
1018
1016
RegisterPet = function ( self , token , id , spell , duration , ... )
1019
1017
CommitKey ( token )
1020
-
1018
+
1019
+ -- Register the main pet.
1021
1020
self .pets [ token ] = {
1022
1021
id = type ( id ) == " function" and setfenv ( id , state ) or id ,
1023
1022
token = token ,
1024
1023
spell = spell ,
1025
1024
duration = type ( duration ) == " function" and setfenv ( duration , state ) or duration
1026
1025
}
1027
-
1026
+
1027
+ -- Process copies.
1028
1028
local n = select ( " #" , ... )
1029
-
1030
1029
if n and n > 0 then
1031
1030
for i = 1 , n do
1032
1031
local copy = select ( i , ... )
1033
1032
self .pets [ copy ] = self .pets [ token ]
1034
1033
end
1035
1034
end
1036
1035
end ,
1036
+
1037
+
1038
+ RegisterPets = function ( self , pets )
1039
+ for token , data in pairs ( pets ) do
1040
+ -- Extract fields from the pet definition.
1041
+ local id = data .id
1042
+ local spell = data .spell
1043
+ local duration = data .duration
1044
+ local copy = data .copy
1045
+
1046
+ -- Register the pet and handle the copy field if it exists.
1047
+ if copy then
1048
+ self :RegisterPet ( token , id , spell , duration , copy )
1049
+ else
1050
+ self :RegisterPet ( token , id , spell , duration )
1051
+ end
1052
+ end
1053
+ end ,
1037
1054
1038
- RegisterTotem = function ( self , token , id )
1055
+
1056
+ RegisterTotem = function ( self , token , id , ... )
1057
+ -- Register the primary totem.
1039
1058
self .totems [ token ] = id
1040
1059
self .totems [ id ] = token
1041
-
1060
+
1061
+ -- Handle copies if provided.
1062
+ local n = select ( " #" , ... )
1063
+ if n and n > 0 then
1064
+ for i = 1 , n do
1065
+ local copy = select ( i , ... )
1066
+ self .totems [ copy ] = id
1067
+ self .totems [ id ] = copy
1068
+ end
1069
+ end
1070
+
1071
+ -- Commit the primary token.
1042
1072
CommitKey ( token )
1043
1073
end ,
1044
1074
1075
+ RegisterTotems = function ( self , totems )
1076
+ for token , data in pairs ( totems ) do
1077
+ local id = data .id
1078
+ local copy = data .copy
1079
+
1080
+ -- Register the primary totem.
1081
+ self .totems [ token ] = id
1082
+ self .totems [ id ] = token
1083
+
1084
+ -- Register any copies (aliases).
1085
+ if copy then
1086
+ if type ( copy ) == " string" then
1087
+ self .totems [ copy ] = id
1088
+ self .totems [ id ] = copy
1089
+ elseif type ( copy ) == " table" then
1090
+ for _ , alias in ipairs ( copy ) do
1091
+ self .totems [ alias ] = id
1092
+ self .totems [ id ] = alias
1093
+ end
1094
+ end
1095
+ end
1096
+
1097
+ CommitKey ( token )
1098
+ end
1099
+ end ,
1045
1100
1046
1101
GetSetting = function ( self , info )
1047
1102
local setting = info [ # info ]
0 commit comments