Thread Tools Display Modes
01-18-12, 08:47 AM   #1
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
[Request] Mass Promote

Someone tell me if there is a way to promote au several members in accordance with the reputation he has with the guild?

Honorable = Rank 2
Respected = Rank 3

and so on.

I have a code that promotes according to the activity, do not know if it will help in any way.
Code:
/run for i=1,GetNumGuildMembers() do local name=GetGuildRosterInfo(i); if GetGuildRosterContribution(i) >= 3796304 and name ~= "Espartaco" then SetGuildMemberRank(i,5)end end
  Reply With Quote
01-18-12, 09:27 AM   #2
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
There is no API to check the reputation standing with other players.
  Reply With Quote
01-18-12, 11:24 AM   #3
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
There is a way to check the score of the activity related to reputation?
  Reply With Quote
01-18-12, 12:27 PM   #4
Taffu
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 149
Not for other players. GetGuildFactionInfo does not allow indexing of roster information, it only returns 'your' information. So while you can get other players contribution in relation to the Guild, you cannot actually retrieve their faction tier (That I know of...)
  Reply With Quote
01-18-12, 12:43 PM   #5
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
I understand,
But is there any association between the "Guild Activity" and "Guild Reputation."

For example, if the player reaches 5k guild activity he upa reputation or something?

Or every 5 points of an activity point of reputation.
  Reply With Quote
01-18-12, 11:46 PM   #6
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
I got exactly what I was looking for, just need to make some adjustments.

How do I get this code does not encourage members who are at rank 2, rank 3 and rank 4?
Code:
/run for i=1,GetNumGuildMembers()do local _,_,a,b=GetGuildRosterInfo(i)if select(2,GetGuildRosterContribution(i))>=300000 and select(2,GetGuildRosterContribution(i))<= 320000 then SetGuildMemberRank(i,9)end end
  Reply With Quote
01-19-12, 06:46 AM   #7
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
I was looking yesterday morning and found all that will help me, so need to do a small fix in the code as it is not promoting anyone.
Code:
function PromoteFromGuild(aKk)
    if aKk and not CanGuildRemove() then
        return
    end
    for i = 1, GetNumGuildMembers() do
        local _, _, a, b = GetGuildRosterInfo(i)
        if rank >= 4 then
            local totalXP = GetGuildRosterContribution(i)
            if totalXP >= 1000000 then
                if aKk then
                    SetGuildMemberRank(i,5)
                end
            end
        end
    end
end
local frame = CreateFrame("Frame")
frame:RegisterEvent("GUILD_ROSTER_UPDATE")
frame:SetScript("OnEvent", function(self, event, ...)
   PromoteFromGuild(true)
end)
what is wrong?
  Reply With Quote
01-19-12, 08:59 PM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
An easy way to figure out where your logic is failing would be to add some debug prints so you can follow what's going on:
Lua Code:
  1. function PromoteFromGuild(aKk)
  2.     print("PromoteFromGuild", aKk)
  3.     if aKk and not CanGuildRemove() then
  4.         print("quit")
  5.         return
  6.     end
  7.     for i = 1, GetNumGuildMembers() do
  8.         local name, _, a, b = GetGuildRosterInfo(i)
  9.         print(i, name, "rank", a, "level", b)
  10.         if a >= 4 then
  11.             local totalXP = GetGuildRosterContribution(i)
  12.             print("totalXP:", totalXP)
  13.             if totalXP >= 1000000 then
  14.                 if aKk then
  15.                     print("SetGuildMemberRank", i, rank)
  16.                     SetGuildMemberRank(i,5)
  17.                 end
  18.             end
  19.         end
  20.     end
  21. end
Depending on which messages do or do not appear, you can tell when something's happening that shouldn't be, or vice versa.

Last edited by Phanx : 01-20-12 at 07:19 PM.
  Reply With Quote
01-20-12, 09:35 AM   #9
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
I used the code that gave me this error and returns.

Code:
Message: Interface\AddOns\Espartanos\Kick\Promover.lua:10: attempt to compare number with nil
Time: 01/20/12 13:33:32
Count: 2
Stack: Interface\AddOns\Espartanos\Kick\Promover.lua:10: in function `PromoteFromGuild'
Interface\AddOns\Espartanos\Kick\Promover.lua:25: in function <Interface\AddOns\Espartanos\Kick\Promover.lua:24>

Locals: aKk = true
(for index) = 1
(for limit) = 569
(for step) = 1
i = 1
name = "Shäke"
_ = "Soldado"
a = 9
b = 13
(*temporary) = nil
(*temporary) = 1
(*temporary) = "Shäke"
(*temporary) = "rank"
(*temporary) = 9
(*temporary) = "level"
(*temporary) = 13
(*temporary) = "attempt to compare number with nil"
  Reply With Quote
01-20-12, 07:20 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Typo, sorry. Change this:
Code:
if rank >= 4 then
to this:
Code:
if a >= 4 then
  Reply With Quote
02-01-12, 06:48 AM   #11
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
The addon is working perfectly, but he continues to promote members who are third in rank, rank 2 and rank 1.

Is there any way this addon does not promote members who are already at rank 5, rank 3, rank 2 and rank 1?
  Reply With Quote
02-01-12, 05:35 PM   #12
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Unless you made some additional change to the code I posted, it should not attempt to change the rank of players whose rank number is lower than 4 (so, it should not try to promote ranks 1, 2, or 3).

If you only want it to promote people whose current rank is below rank 5 (higher rank number, so rank 6+), simply change that part of the logic. Also, using descriptive variable names will help you see what to change in the future.

Lua Code:
  1. function PromoteFromGuild(reallyPromote)
  2.     print("PromoteFromGuild", reallyPromote)
  3.     if reallyPromote and not CanGuldPromote() then
  4.         print("quit")
  5.         return
  6.     end
  7.     for i = 1, GetNumGuildMembers() do
  8.         local name, _, rank, level = GetGuildRosterInfo(i)
  9.         print(i, name, "rank:", rank, "level:", level)
  10.         --
  11.         -- CHANGE THE NEXT LINE TO CHANGE WHICH RANKS ARE AFFECTED:
  12.         if rank >= 5 then
  13.             local totalXP = GetGuildRosterContribution(i)
  14.             print("totalXP:", totalXP)
  15.             if totalXP >= 1000000 then
  16.                 if reallyPromote then
  17.                     print("SetGuildMemberRank", i, rank)
  18.                     SetGuildMemberRank(i, 5)
  19.                 else
  20.                     print("Would promote", name)
  21.                 end
  22.             end
  23.         end
  24.     end
  25. end

You should also be able to see exactly what it's trying to do by looking at the messages it prints in your chat frame when the function is run. If you want any more advice on why it's not doing what you want, you will need to post the messages it's printing, in the order it's printing them, and point out which lines you think are wrong.
  Reply With Quote
02-02-12, 08:00 AM   #13
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
I used the code you posted, but he keeps changing the rank of the members who are in category 5, 4, 3, 2 ​​and 1.

It seems that he is ignoring the command (if rank> = 5 then) or this command is not working.
  Reply With Quote
02-03-12, 03:35 AM   #14
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Phanx View Post
If you want any more advice on why it's not doing what you want, you will need to post the messages it's printing, in the order it's printing them, and point out which lines you think are wrong.
^^^^^^^^^^
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » [Request] Mass Promote


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off