forked from ornfelt/azerothcore_lua_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReputation_Rates.lua
More file actions
60 lines (51 loc) · 2.17 KB
/
Reputation_Rates.lua
File metadata and controls
60 lines (51 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
ReputationRatesModule = {}
ReputationRatesModule.enabled = true -- disable the script with true or false
ReputationRatesModule.GMonly = false -- determine whether you want only GMs to be able to use said command
local function getPlayerCharacterGUID(player)
return player:GetGUIDLow()
end
local function GMONLY(player)
-- player:SendBroadcastMessage("|cffff0000You don't have permission to use this command.|r")
end
function ReputationRatesModule.OnLogin(event, player)
local aura = player:GetAura(80118)
if aura then
local RepRate = aura:GetStackAmount()
player:SendBroadcastMessage(string.format("|cff5af304Your reputation rate is currently set to %dx|r", RepRate))
end
end
function ReputationRatesModule.SetRepRate(event, player, command)
local mingmrank = 3
if command:find("rep") then
local rate = tonumber(command:sub(5))
if command == "rep" then
player:SendBroadcastMessage("|cff5af304To set your reputation rate, type '.rep X' where X is a value between 1 and 10.|r")
return false
end
if rate and rate >= 1 and rate <= 10 then
if player:HasItem(800048, 1) then
player:SendBroadcastMessage("|cffff0000You cannot use this command in Slow and Steady Mode.|r")
return false
end
if ReputationRatesModule.GMonly and player:GetGMRank() < mingmrank then
GMONLY(player)
return false
else
player:RemoveAura(80118)
if rate > 1 then
local aura = player:AddAura(80118, player)
aura:SetStackAmount(rate)
end
player:SendBroadcastMessage(string.format("|cff5af304You changed your reputation rate to %dx|r", rate))
return false
end
else
player:SendBroadcastMessage("|cffff0000Invalid reputation rate. Please enter a value between 1 and 10.|r")
return false
end
end
end
if ReputationRatesModule.enabled then
RegisterPlayerEvent(3, ReputationRatesModule.OnLogin)
RegisterPlayerEvent(42, ReputationRatesModule.SetRepRate)
end