Auto Clan Roster Ranking script

HasteBro

Member
Hey guys, I need help on another script. I'm trying to make my buffbot into a clanbot as well.

So, that means I need it to do the ranks automatically. Currently, I got some stuff down (the script attached), such as detecting on which page of the roster is the clannie who needs his rank changed and printing it in Mafia's CLI.

The thing is, currently it is dependent on a python tool someone else in the clan developed, which prints the ranks that need to be done as an ASH map, like this:

Code:
 [line number] [clannie name] [current rank] [target rank]

I was writing the script and got stuck when it started involving too much PHP, which I know nothing about.

What I want to know is:
1) How to make the script change the ranks
2) How to automate the map creation. (Would it be possible to make the scrip call the python tool automatically?)


View attachment RankTest.ash
 

Quertle

New member
Does this help?

Code:
visit_url( "clan_members.php?pwd&action=modify&pids[]=" + playerid + "&level" + playerid + "=" + rank_value );

Note that the value of a rank is different from its degree. Check the frame source of the member list (as a character with power to promote players) to find out the values of ranks.
 

HasteBro

Member
That does help a lot. I really have barely any idea how to use visit_url to actually modify ranks. Thanks Quertle!

And yeah, I already have the correct values for the ranks, now I have to put everything I have in a single script.
 

mredge73

Member
I did this a few years ago; I haven't looked at the code for a while now but the bot is still in operation although I no longer host it. Use this as a guide only, I am sure I am using some functions in here that are included else ware.

Code:
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//AutoUpdate Karma Based Ranks
//Requires 2 custom files in your data or script folder


//ClanRanks.txt, this is a tabbed spaced list for each rankname and minium karma requried for the rank
// Example: 12	Bucko	500000
//"12" is the rank weight, rank 12 is higher than rank 11
//"Bucko" is the rank title/name
//"500000" is the minium karma requirment to make the rank


//Administrators.txt, this is a tabbed spaced list for members that are not to have their ranks changed, like officers.
// Example: MrEdge73	1
//"MrEdge73" is an officer and clan administrator
//"1" is used for other functions than the UpdateRanks() function.  I use 1 to identify a super user and 2 to identify a regular officer.
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
void UpdateRanks()
{
	int members=BuildRoster();
	
	playerlog[string] CurrentRoster;
	File_To_Map("ClanRoster.txt", CurrentRoster);
	
	record
	{
		string RankName;
		int KarmaMin;
	}[int]KarmaRank;
	File_To_Map("ClanRanks.txt",KarmaRank);
	
	int[string] Admins;
	File_To_Map("Administrators.txt",Admins);
		
	
	string NewRank= "dude";
	string MemberPage=visit_url("clan_members.php");
		
	foreach Clannie in CurrentRoster
	{
		for counter from 0 upto (count(KarmaRank)-1)
		{
			if (CurrentRoster[Clannie].Karma >= KarmaRank[counter].KarmaMin)
			NewRank=KarmaRank[counter].RankName;			
		}
		
		switch 
		{
		case Admins contains(Clannie):
			break;		
		case CurrentRoster[Clannie].Rank=="BOOTED":
			break;
		case NewRank==CurrentRoster[Clannie].Rank:
			break;
		default :
			print("Changed Rank for " +Clannie+ " to " +NewRank,"blue");
			visit_url("clan_members.php?&action=modify&pids[]=" +CurrentRoster[Clannie].ID+ "&level" +CurrentRoster[Clannie].ID+ "=" +GetRankID(NewRank, MemberPage)+ "&title" +CurrentRoster[Clannie].ID+ "=" +GetTitle(CurrentRoster[Clannie].ID) + "&modify=Modify Members");
			break;		
		}	 
	}	
	print("You have "+BuildRoster()+ " members in your clan!","blue");
}
 

HasteBro

Member
That did the magic! Thanks MrEdge73!

The script is working very well now, I had to make a few adjustments to include some special ranks our clan have, but I got it all worked out!
 

HasteBro

Member
Sorry to kinda necro this topic.

The new challenge path kind of screwed the BuildRoster function. The entry added to the map looks like this when someone is in a Zombie Slayer run:
Code:
(player)	1955580	</td><td class=small>36	27	24	87	10	1	0	0	500</td></tr><tr><td class=small><a class=nounder href="showplayer.php?who=(ID)"><b>(different player)</b>  </a>	0
(I censored the player name and ID, they do show up)

In the clan_detailedroster.php page, Zombie Slayer doesn't have a class acronym, it's just a blank space.

Is there anyway this can be fixed in mafia or should I send a bug report asking to add an acronym or something?
 
Last edited:

Theraze

Active member
Sounds like a KoL bug, not a mafia one... they'll probably fix it after more people have actually ascended.
 
Top