Tinyfugue Group Breakdown

From AvatarWiki
Revision as of 11:05, 5 April 2007 by Laventish (talk | contribs) (→‎Usage: looks better)
Jump to navigation Jump to search

Ok here goes, this is a paste of my group breakdown thingee. It also includes modifcations to color medium/low hitpoints/mana of groupies and probably some misc other stuff. Im not going to be to detailed, you can ask me on avatar if you have problems.

Semi messy code, live with it or clean it up yourself :p

This is based of Waites RoAClient Group Breakdown so the information there might be useful also.

Usage

  • /bd does the breakdown
  • /cp <start of person names> checks the groupline of person whose start of name matches whatever you type
  • /names shows a breakdown in gtell
  • /ptot and /tot shows percantage and number based current/total in gtell
  • /bdbrutes /bdfp /bdhealer /bdhitter shows just the fitting line
  • /list_steel /list_invinc steels or invinces all classes in group that probably cant cast the spell on themself (bark can be added same way, I just havent bothered since I dont have anything at lord that barks)

Source code

;attempt to make colored hitpoint/mana in grouplist

;/def -ag -F -mregexp -t"((Sleep|Rest|Stand) +)([0-9]+)/([0-9]+)( *)([0-9]+)/([0-9]+)" group_format =\


/def -mregexp -t"^##| Level" start_of_group_listing=\
	/set brutehp=0%;\
	/set brutehptotal= 0%;\
	/set fpmana=0%;\
	/set fpmanatotal=0%;\
	/set healermana=0%;\
	/set healermanatotal=0%;\


/def -mregexp -ag -F -t"\|([ 0-9]+)(Lgnd|Lord|Hero) ([^ ]+)([^0-9]+)([0-9]+)/([0-9]+)([^0-9]*)([0-9]+)/([0-9]+)" group_format=\
;	/echo %P3 %P5 %P8%;\
	/set lastname=%P3%;\
	/if (do_last)\
		last %P3%;\
	/endif%;\
;	Check vars and do the summa summarum for stuff
	/set thisclass=$[determine_class({P3})]%;\
;	/eval /echo %thisclass%;\
	/if (thisclass =~ "fp")\
;		/echo YAY%;\
		/set fpmana=$[{fpmana} + {P8}]%;\
		/set fpmanatotal=$[{fpmanatotal} + {P9}]%;\
	/elseif (thisclass =~ "brute")\
		/set brutehp=$[{brutehp} + {P5}]%;\
		/set brutehptotal=$[{brutehptotal} + {P6}]%;\
	/elseif (thisclass =~ "healer")\
		/set healermana=$[{healermana} + {P8}]%;\
		/set healermanatotal=$[{healermanatotal} + {P9}]%;\
	/endif%;\
;	Health part	
	/set percent=$[strcat({P5}, ".0") / {P6}]%;\
	/if (percent <= 0.2)\
		/set health=@{Cred}%P5/%P6@{n}%;\
	/elseif (percent <= 0.4)\
		/set health=@{Cyellow}%P5/%P6@{n}%;\
	/else \
		/set health=%P5/%P6%;\
	/endif%;\
;	Mana part	
	/set percent=$[strcat({P8}, ".0") / {P9}]%;\
	/if (percent <= 0.2)\
		/set mana=@{Cred}%P8/%P9@{n}%;\
	/elseif (percent <= 0.4)\
		/set mana=@{Cyellow}%P8/%P9@{n}%;\
	/else \
		/set mana=%P8/%P9%;\
	/endif%;\
;	Echo part
	/if (checkperson)\
		/if (%P3 =/ strcat(%checkpersonstring,'*'))\
			/test echo("%PL|%P1%P2 %P3%P4%health%P7%mana%PR", "Ccyan", 1)%;\
		/endif%;\
	/else \
		/test echo("%PL|%P1%P2 %P3%P4%health%P7%mana%PR", "Ccyan", 1)%;\
	/endif%;\

/def cp =\
	/set checkperson=1%;\
	/set checkpersonstring=%1%;\
	group%;\
	/repeat -5 1 /set checkperson=0%;

/def bd =\
	/breakdown%;
	
/def breakdown =\
	/unset brutestring%;\
	/unset firestring%;\
	/unset healerstring%;\
	/unset hitterstring%;\
	/set brutecount=0%;\
	/set firepowercount=0%;\
	/set healercount=0%;\
	/set hittercount=0%;\
	/set bzkcount=0%;\
	/set warcount=0%;\
	/set bodcount=0%;\
	/set palcount=0%;\
	/set rancount=0%;\
	/set moncount=0%;\
	/set shfcount=0%;\
	/set sorcount=0%;\
	/set magcount=0%;\
	/set wzdcount=0%;\
	/set psicount=0%;\
	/set mndcount=0%;\
	/set stmcount=0%;\
	/set prscount=0%;\
	/set clecount=0%;\
	/set drucount=0%;\
	/set asncount=0%;\
	/set rogcount=0%;\
	/set bcicount=0%;\
	/set arccount=0%;\
	/set fuscount=0%;\
	/set bzknames=%;\
	/set warnames=%;\
	/set bodnames=%;\
	/set palnames=%;\
	/set rannames=%;\
	/set monnames=%;\
	/set shfnames=%;\
	/set sornames=%;\
	/set magnames=%;\
	/set wzdnames=%;\
	/set psinames=%;\
	/set mndnames=%;\
	/set stmnames=%;\
	/set prsnames=%;\
	/set clenames=%;\
	/set drunames=%;\
	/set asnnames=%;\
	/set rognames=%;\
	/set bcinames=%;\
	/set arcnames=%;\
	/set fusnames=%;\
	/set groupnames=%;\
	/set fpnames=%;\
	/set brutenames=%;\
	/set healernames=%;\
	/set hitternames=%;\
	/set needinvinc=%;\
	/set needsteel=%;\
	/set do_last=1%;\
	/def -mregexp -t"(^[^ ]+) the .+ is a [^ ]+ level (Lord|Hero|Legend) ([^,]*)," check_last =\
		/set groupnames=%%groupnames%%PL\\-%%;\
		/if (%%{P3} =~ "Berserker")\
			/set bzkcount=$$[bzkcount + 1]%%;\
			/set brutecount=$$[brutecount + 1]%%;\
			/set bzknames=%%bzknames %%P1%%;\
			/set brutenames=%%brutenames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Warrior")\
			/set warcount=$$[warcount + 1]%%;\
			/set brutecount=$$[brutecount + 1]%%;\
			/set warnames=%%warnames %%P1%%;\
			/set brutenames=%%brutenames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Bodyguard")\
			/set bodcount=$$[bodcount + 1]%%;\
			/set brutecount=$$[brutecount + 1]%%;\
			/set bodnames=%%bodnames %%P1%%;\
			/set brutenames=%%brutenames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Paladin")\
			/set palcount=$$[palcount + 1]%%;\
			/set brutecount=$$[brutecount + 1]%%;\
			/set palnames=%%palnames %%P1%%;\
			/set brutenames=%%brutenames%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Ranger")\
			/set rancount=$$[rancount + 1]%%;\
			/set brutecount=$$[brutecount + 1]%%;\
			/set rannames=%%rannames %%P1%%;\
			/set brutenames=%%brutenames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Monk")\
			/set moncount=$$[moncount + 1]%%;\
			/set brutecount=$$[brutecount + 1]%%;\
			/set monnames=%%monnames %%P1%%;\
			/set brutenames=%%brutenames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Shadowfist")\
			/set shfcount=$$[shfcount + 1]%%;\
			/set brutecount=$$[brutecount + 1]%%;\
			/set shfnames=%%shfnames %%P1%%;\
			/set brutenames=%%brutenames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Sorcerer")\
			/set sorcount=$$[sorcount + 1]%%;\
			/set firepowercount=$$[firepowercount + 1]%%;\
			/set sornames=%%sornames %%P1%%;\
			/set fpnames=%%fpnames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Mage")\
			/set magcount=$$[magcount + 1]%%;\
			/set firepowercount=$$[firepowercount + 1]%%;\
			/set magnames=%%magnames %%P1%%;\
			/set fpnames=%%fpnames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Wizard")\
			/set wzdcount=$$[wzdcount + 1]%%;\
			/set firepowercount=$$[firepowercount + 1]%%;\
			/set wzdnames=%%wzdnames %%P1%%;\
			/set fpnames=%%fpnames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Psionicist")\
			/set psicount=$$[psicount + 1]%%;\
			/set firepowercount=$$[firepowercount + 1]%%;\
			/set psinames=%%psinames %%P1%%;\
			/set fpnames=%%fpnames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
		/elseif (%%{P3} =~ "Mindbender")\
			/set mndcount=$$[mndcount + 1]%%;\
			/set firepowercount=$$[firepowercount + 1]%%;\
			/set mndnames=%%mndnames %%P1%%;\
			/set fpnames=%%fpnames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
		/elseif (%%{P3} =~ "Stormlord")\
			/set stmcount=$$[stmcount + 1]%%;\
			/set firepowercount=$$[firepowercount + 1]%%;\
			/set stmnames=%%stmnames %%P1%%;\
			/set fpnames=%%fpnames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Priest")\
			/set prscount=$$[prscount + 1]%%;\
			/set healercount=$$[healercount + 1]%%;\
			/set prsnames=%%prsnames %%P1%%;\
			/set healernames=%%healernames%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Cleric")\
			/set clecount=$$[clecount + 1]%%;\
			/set healercount=$$[healercount + 1]%%;\
			/set clenames=%%clenames %%P1%%;\
			/set healernames=%%healernames%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Druid")\
			/set drucount=$$[drucount + 1]%%;\
			/set healercount=$$[healercount + 1]%%;\
			/set drunames=%%drunames %%P1%%;\
			/set healernames=%%healernames%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Assassin")\
			/set asncount=$$[asncount + 1]%%;\
			/set hittercount=$$[hittercount + 1]%%;\
			/set asnnames=%%asnnames %%P1%%;\
			/set hitternames=%%hitternames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Rogue")\
			/set rogcount=$$[rogcount + 1]%%;\
			/set hittercount=$$[hittercount + 1]%%;\
			/set rognames=%%rognames %%P1%%;\
			/set hitternames=%%hitternames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Black Circle Initiate")\
			/set bcicount=$$[bcicount + 1]%%;\
			/set hittercount=$$[hittercount + 1]%%;\
			/set bcinames=%%bcinames %%P1%%;\
			/set hitternames=%%hitternames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
		/elseif (%%{P3} =~ "Archer")\
			/set arccount=$$[arccount+1]%%;\
			/set hittercount=$$[hittercount + 1]%%;\
			/set arcnames=%%arcnames %%P1%%;\
			/set hitternames=%%hitternames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/elseif (%%{P3} =~ "Fusilier")\
			/set fuscount=$$[fuscount+1]%%;\
			/set hittercount=$$[hittercount + 1]%%;\
			/set fusnames=%%fusnames %%P1%%;\
			/set hitternames=%%hitternames%%P1\\-%%;\
			/set needinvinc=%%needinvinc%%P1\\-%%;\
			/set needsteel=%%needsteel%%P1\\-%%;\
		/endif%%;\
		/if (%%{lastname} =~ %%{P1})\
			/break2%%;\
		/endif%;\
	group%;

/def break2 =\
	/set do_last=0%;\
	/undef check_last%;\
	/set bzknames=$(/strchomp %bzknames)%;\
	/set warnames=$(/strchomp %warnames)%;\
	/set bodnames=$(/strchomp %bodnames)%;\
	/set palnames=$(/strchomp %palnames)%;\
	/set rannames=$(/strchomp %rannames)%;\
	/set monnames=$(/strchomp %monnames)%;\
	/set shfnames=$(/strchomp %shfnames)%;\
	/set sornames=$(/strchomp %sornames)%;\
	/set magnames=$(/strchomp %magnames)%;\
	/set wzdnames=$(/strchomp %wzdnames)%;\
	/set psinames=$(/strchomp %psinames)%;\
	/set mndnames=$(/strchomp %mndnames)%;\
	/set stmnames=$(/strchomp %stmnames)%;\
	/set prsnames=$(/strchomp %prsnames)%;\
	/set clenames=$(/strchomp %clenames)%;\
	/set drunames=$(/strchomp %drunames)%;\
	/set asnnames=$(/strchomp %asnnames)%;\
	/set rognames=$(/strchomp %rognames)%;\
	/set bcinames=$(/strchomp %bcinames)%;\
	/set arcnames=$(/strchomp %arcnames)%;\
	/set fusnames=$(/strchomp %fusnames)%;\
	/set brutestring=|c|%brutecount Brute(s)%;\
	/set firestring=|r|%firepowercount Firepower%;\
	/set healerstring=|w|%healercount Healer(s)%;\
	/set hitterstring=|g|%hittercount Hitter(s)%;\
	/if (bzkcount > 0)\
		/set brutestring=%brutestring |c|Bzk(|bc|%bzkcount|c|) {%bzknames}%;\
	/endif%;\
	/if (warcount > 0)\
		/set brutestring=%brutestring |c|War(|bc|%warcount|c|) {%warnames}%;\
	/endif%;\
	/if (bodcount > 0)\
		/set brutestring=%brutestring |c|Bod(|bc|%bodcount|c|) {%bodnames}%;\
	/endif%;\
	/if (palcount > 0)\
		/set brutestring=%brutestring |c|Pal(|bc|%palcount|c|) {%palnames}%;\
	/endif%;\
	/if (rancount > 0)\
		/set brutestring=%brutestring |c|Ran(|bc|%rancount|c|) {%rannames}%;\
	/endif%;\
	/if (moncount > 0)\
		/set brutestring=%brutestring |c|Mon(|bc|%moncount|c|) {%monnames}%;\
	/endif%;\
	/if (shfcount > 0)\
		/set brutestring=%brutestring |c|Shf(|bc|%shfcount|c|) {%shfnames}%;\
	/endif%;\
	/if (sorcount > 0)\
		/set firestring=%firestring |r|Sor(|br|%sorcount|r|) {%sornames}%;\
	/endif%;\
	/if (magcount > 0)\
		/set firestring=%firestring |r|Mag(|br|%magcount|r|) {%magnames}%;\
	/endif%;\
	/if (wzdcount > 0)\
		/set firestring=%firestring |r|Wzd(|br|%wzdcount|r|) {%wzdnames}%;\
	/endif%;\
	/if (psicount > 0)\
		/set firestring=%firestring |r|Psi(|br|%psicount|r|) {%psinames}%;\
	/endif%;\
	/if (mndcount > 0)\
		/set firestring=%firestring |r|Mnd(|br|%mndcount|r|) {%mndnames}%;\
	/endif%;\
	/if (stmcount > 0)\
		/set firestring=%firestring |r|Stm(|br|%stmcount|r|) {%stmnames}%;\
	/endif%;\
	/if (prscount > 0)\
		/set healerstring=%healerstring |w|Prs(|bw|%prscount|w|) {%prsnames}%;\
	/endif%;\
	/if (clecount > 0)\
		/set healerstring=%healerstring |w|Cle(|bw|%clecount|w|) {%clenames}%;\
	/endif%;\
	/if (drucount > 0)\
		/set healerstring=%healerstring |w|Dru(|bw|%drucount|w|) {%drunames}%;\
	/endif%;\
	/if (asncount > 0)\
		/set hitterstring=%hitterstring |g|Asn(|bg|%asncount|g|) {%asnnames}%;\
	/endif%;\
	/if (rogcount > 0)\
		/set hitterstring=%hitterstring |g|Rog(|bg|%rogcount|g|) {%rognames}%;\
	/endif%;\
	/if (bcicount > 0)\
		/set hitterstring=%hitterstring |g|Bci(|bg|%bcicount|g|) {%bcinames}%;\
	/endif%;\
	/if (arccount > 0)\
		/set hitterstring=%hitterstring |g|Arc(|bg|%arccount|g|) {%arcnames}%;\
	/endif%;\
	/if (fuscount > 0)\
		/set hitterstring=%hitterstring |g|Fus(|bg|%fuscount|g|) {%fusnames}%;\
	/endif%;\


/def ptot=\
	group%;\
	/repeat -4 1 /ptot_do%; 

/def ptot_do=\
	/set doptot=0%;\
	/if ({brutehptotal} > 0)\
		/let brutepercent=$[%brutehp*100/%brutehptotal]%;\
	/else%;\
		/let brutepercent=0%;\
	/endif%;\
	/if ({fpmanatotal} > 0)\
		/let fppercent=$[%fpmana*100/%fpmanatotal]%;\
	/else%;\
		/let fppercent=0%;\
	/endif%;\
	/if ({healermanatotal} > 0)\
		/let healerpercent=$[%healermana*100/%healermanatotal]%;\
	/else%;\
		/let healerpercent=0%;\
	/endif%;\
	gt |g|Brute hp: \{|bg|%brutepercent\%|g|\} |r|Firepower mana: \{|br|%fppercent\%|r|\} |w|Healer mana: \{|bw|%healerpercent\%|w|\}
	 

/def tot=\
	group%;\
	/repeat -4 1 /tot_do%; 

/def tot_do=\
	/set dotot=0%;\
	gt |g|Brute hp: \{|bg|%brutehp/%brutehptotal|g|\} |r|Firepower mana: \{|br|%fpmana/%fpmanatotal|r|\} |w|Healer mana: \{|bw|%healermana/%healermanatotal|w|\} %;\

/def names =\
	gt %brutestring%;\
	gt %firestring%;\
	gt %healerstring%;\
	gt %hitterstring%;\

/def bdbrutes =\
	gt %brutestring%;\

/def bdfp =\
	gt %firestring%;\

/def bdhealer =\
	gt %healerstring%;\

/def bdhitter =\
	gt %hitterstring%;\

/def determine_class = \
	/let detname=$[strcat({*}, "-")]%;\
	/if (strstr({brutenames}, {detname}) != -1)\
		/return "brute"%;\
	/endif%;\
	/if (strstr({fpnames}, {detname}) != -1)\
		/return "fp"%;\
	/endif%;\
	/if (strstr({healernames}, {detname}) != -1)\
		/return "healer"%;\
	/endif%;\
	/if (strstr({hitternames}, {detname}) != -1)\
		/return "hitter"%;\
	/endif%;\
	/return "Unknown"%;\


/def strchomp =\
	/set chomped={*}%;\
	/while ( substr(%chomped,0,1) =~ " ")\
		/eval /set chomped=$[substr(%chomped,1)]%;\
	/done%;\
	/while (substr(%chomped,-1,1) =~ " ")\
		/eval /set chomped=$[substr(%chomped,0,-1)]%;\
	/done%;\
	/result %{chomped}%;\


;for internal use by list macros
/set listspell=bogus;
/def listspell =\
	/let namelist=$[{*}]%;\
	/let limit=$[strstr(%namelist, "-")]%;\
	/while ( {limit} != -1)\
		/let thisname=$[substr(%namelist, 0, %limit)]%;\
		/let namelist=$[substr(%namelist, %limit+1)]%;\
		/let limit=$[strstr(%namelist, "-")]%;\
		cast %listspell %thisname%;\
	/done
	
/def list_steel =\
	/set listspell=steel%;\
	/listspell %needsteel
	

/def list_invinc =\
	/set listspell=invincibility%;\
	/listspell %needinvinc


Syntax highlighted source code

Couldnt make this quite work with wiki since it wouldnt interpret color within <pre> Post a discussion comment if you know how and Ill add it with syntax highlightning to (using vims :TOhtml)