-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow players to set their own Blessing assignments by whispering #5
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,6 +177,7 @@ function PallyPower:OnEnable() | |
self:ScanCooldowns() | ||
self:RegisterEvent("CHAT_MSG_ADDON") | ||
self:RegisterEvent("CHAT_MSG_SYSTEM") | ||
self:RegisterEvent("CHAT_MSG_WHISPER") | ||
self:RegisterEvent("ZONE_CHANGED") | ||
self:RegisterEvent("ZONE_CHANGED_NEW_AREA") | ||
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") | ||
|
@@ -1618,6 +1619,78 @@ function PallyPower:CHAT_MSG_SYSTEM(event, text) | |
end | ||
end | ||
|
||
-- set normal bless using whispering e.g. "/w paladin !BOK" will set Bless of King for the player who whisp | ||
function PallyPower:CHAT_MSG_WHISPER(event, text, a, b, c, wguid) | ||
if text then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. text cannot be nil |
||
text = string.upper(text) | ||
local blessID, blessName | ||
|
||
if sfind(text, "!WISDOM") then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also localization concerns once again, what about players not playing in english? |
||
blessID = 1 | ||
elseif sfind(text, "!MIGHT") or sfind(text, "!BOM") then | ||
blessID = 2 | ||
elseif sfind(text, "!KING") or sfind(text, "!BOK") then | ||
blessID = 3 | ||
elseif sfind(text, "!SALVATION") or sfind(text, "!BOS") or sfind(text, "!SALV") then | ||
blessID = 4 | ||
elseif sfind(text, "!LIGHT") or sfind(text, "!BOL") then | ||
blessID = 5 | ||
elseif sfind(text, "!SANCTUARY") or sfind(text, "!SANCT") then | ||
blessID = 6 | ||
elseif sfind(text, "!BLESSINFO") or sfind(text, "!PP") then | ||
blessID = 99 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, no; find a clean way to handle this special case that doesn't involve a magic blessing id |
||
else | ||
blessID = 0 | ||
end | ||
|
||
blessName = PallyPower.IDToBless[blessID] | ||
|
||
if blessID > 0 then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just |
||
local playerGuid = UnitGUID(wguid) | ||
-- self:Print(playerGuid) | ||
|
||
if playerGuid then | ||
local localizedClass, englishClass, localizedRace, englishRace, sex, playerName, realm = GetPlayerInfoByGUID(playerGuid) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we almost definitely already have this data somewhere; check the roster functions |
||
|
||
if blessID == 99 then | ||
local normalBlessText, normalBlessID | ||
for pally in pairs(AllPallys) do | ||
|
||
if PallyPower_Assignments[pally][PallyPower.ClassToID[englishClass]] then | ||
-- self:Print(PallyPower_Assignments[pally][PallyPower.ClassToID[englishClass]]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. get rid of your debug comments please |
||
-- self:Print(GetNormalBlessings(pally, PallyPower.ClassToID[englishClass], playerName)) | ||
normalBlessID = GetNormalBlessings(pally, PallyPower.ClassToID[englishClass], playerName) | ||
-- self:Print(normalBlessID) | ||
if normalBlessID then | ||
-- self:Print(normalBlessID) | ||
normalBlessText = " (single bless: " .. PallyPower.IDToBless[tonumber(normalBlessID)] .. ") " | ||
else | ||
normalBlessText = "" | ||
end | ||
|
||
SendChatMessage(pally .. " -> " .. PallyPower.IDToBless[PallyPower_Assignments[pally][PallyPower.ClassToID[englishClass]]] .. normalBlessText, "WHISPER", "Common", playerName) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also do we need a separate chat message for each paladin in the raid? concatenate this into a single reply, otherwise you'll quickly get spam filtered if many raiders use this (and you have lots of paladins in vanilla) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also this line of code is very unreadable, split it up |
||
end | ||
|
||
end | ||
-- self:Print(PallyPower_Assignments[PallyPower.player][PallyPower.ClassToID[englishClass]]) | ||
return false | ||
end | ||
-- self:Print(text) | ||
-- self:Print(PallyPower.player) | ||
-- self:Print(englishClass) | ||
-- self:Print(PallyPower.ClassToID[englishClass]) | ||
|
||
SetNormalBlessings(PallyPower.player, PallyPower.ClassToID[englishClass], playerName, blessID) | ||
|
||
self:Print(playerName .. " has now assigned " .. blessName .. " bless (small)") | ||
SendChatMessage("You have now assigned " .. blessName .. " bless (small)", "WHISPER", "Common", playerName) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as before, don't hardcode arg3 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also localization concerns here |
||
else | ||
self:Print("Player not found. Is he/she in your group?") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if a player is shown this message, what are they supposed to do about it? either silently discard or error reply to the sender, don't show anything to user |
||
end -- end playerGuid | ||
end -- end BlessID > 0 | ||
end --end text != nil | ||
end | ||
|
||
function PallyPower:UNIT_SPELLCAST_SUCCEEDED(event, unitTarget, castGUID, spellID) | ||
if select(2, UnitClass(unitTarget)) == "PALADIN" then | ||
for _, spells in pairs(self.Cooldowns) do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also add a message filter (cf.
ChatFrame_AddMessageEventFilter
) to hide these whispers and the auto-replies