;'Guild Watch'

GuildID = GetUserGuild(#USERID)
If GuildID < 1
	SendMessageToUser(#USERID,GetUserName(TargetID)+" isn't in your guild.",#MSG_EMOTE)
	SetUserSkill(#USERID,29,0)
EndIf

TargetID = GetUserID(GetUserMessage(#USERID))

If TargetID > 0
	If GetUserGuild(TargetID) <> GuildID
		If GetUserAccess(#USERID) < 6
			SendMessageToUser(#USERID,GetUserName(TargetID)+" isn't in your guild.",#MSG_EMOTE)
			GoTo END
		EndIf
	EndIf
Else
	SendMessageToUser(#USERID,"Type the name of a member of your guild, and then use this skill.",#MSG_EMOTE)
	GoTo END
EndIf

GuildRankText=""

If GetUserGuildRank(TargetID) = #GUILDRANK_INVITED 
	SendMessageToUser(#USERID,GetUserName(TargetID)+" isn't in your guild.",#MSG_EMOTE)
	GoTo END
ElseIf GetUserGuildRank(TargetID) = #GUILDRANK_INITIATE 
	GuildRankText="Guild Servant"
ElseIf GetUserGuildRank(TargetID) = #GUILDRANK_MEMBER 
	GuildRankText="Honored Member"
ElseIf GetUserGuildRank(TargetID) = #GUILDRANK_LORD
	GuildRankText="Lord of the Guild"
EndIf

SendMessageToUser(#USERID,"Member: "+GetUserName(TargetID),#MSG_EMOTE)
SendMessageToUser(#USERID,"Rank: "+GuildRankText,#MSG_EMOTE)

If GetUserGuildRank(#USERID) = #GUILDRANK_INITIATE 
	TargetLvl = GetUserStrength(TargetID)+GetUserEndurance(TargetID) + GetUserWisdom(TargetID) + GetUserAgility(TargetID)
	TargetLvl = TargetLvl / 4
	TargetLvl = Abs(TargetLvl)
	TargetLvl = FTrim(TargetLvl) 
	
	UserLvl = GetUserStrength(#USERID)+GetUserEndurance(#USERID) + GetUserWisdom(#USERID) + GetUserAgility(#USERID)
	UserLvl = UserLvl / 4
	UserLvl = Abs(UserLvl)
	UserLvl = FTrim(UserLvl)

	POWER_MARK ="is about equal to you."

	If UserLvl > TargetLvl
		POWER_MARK ="is slightly weaker than you."
		
     	TargetLvl = TargetLvl+ 5
     	If UserLvl > TargetLvl
        		POWER_MARK ="is weaker than you."
        		
        		TargetLvl = TargetLvl+ 5
        		If UserLvl > TargetLvl
           		POWER_MARK ="is alot weaker than you."
        		EndIf
     	EndIf
	ElseIf UserLvl < TargetLvl
		POWER_MARK ="is somewhat stronger than you."
     
     	UserLvl = UserLvl + 5
     	If UserLvl < TargetLvl
        		POWER_MARK ="is stronger than you."
        
        		UserLvl = UserLvl + 5
        		If UserLvl < TargetLvl
           		POWER_MARK ="is much stronger than you."
        		EndIf
     	EndIf
	EndIf

	SendMessageToUser(#USERID,GetUserName(TargetID)+" "+POWER_MARK,#MSG_EMOTE)
ElseIf GetUserGuildRank(#USERID) = #GUILDRANK_MEMBER 
	TargetLvl = GetUserStrength(TargetID)+GetUserEndurance(TargetID) + GetUserWisdom(TargetID) + GetUserAgility(TargetID)
	TargetLvl = TargetLvl / 4
	TargetLvl = Abs(TargetLvl)
	TargetLvl = Floor(TargetLvl)
	
	SendMessageToUser(#USERID,"Average stat level: "+TargetLvl,#MSG_EMOTE)
ElseIf GetUserGuildRank(#USERID) = #GUILDRANK_LORD
	TargetLvl = GetUserStrength(TargetID)+GetUserEndurance(TargetID) + GetUserWisdom(TargetID) + GetUserAgility(TargetID)
	TargetLvl = TargetLvl / 4
	TargetLvl = Abs(TargetLvl)
	TargetLvl = Floor(TargetLvl)

	Money=GetUserSilver(TargetID)
	Money=Money+GetUserFlag(TargetID,47)
	Wealth="Poor"
	If Money > 50000000
		Wealth="More than he knows what to do with it"
	ElseIf Money > 25000000
		Wealth="Measures by roomfills not weights"
	ElseIf Money > 10000000
		Wealth="Has no need for more"
	ElseIf Money > 5000000
		Wealth="Has a literal fortune"
	ElseIf Money > 2500000
		Wealth="Multi-millionair"
	ElseIf Money > 1000000
		Wealth="Millionair"
	ElseIf Money > 500000
		Wealth="Exceedingly Wealthy"
	ElseIf Money > 250000
		Wealth="Wealthy"
	ElseIf Money > 100000
		Wealth="Moderately Wealthy"
	ElseIf Money > 75000
		Wealth="Well off"
	ElseIf Money > 50000
		Wealth="A fairly decent amount"
	ElseIf Money > 10000
		Wealth="Enough for the time"
	ElseIf Money > 5000
		Wealth="Getting by"
	Else
		Wealth="Poor"
	EndIf
	
	SendMessageToUser(#USERID,"Wealth: "+Wealth,#MSG_EMOTE)
	SendMessageToUser(#USERID,"Average stat level:"+TargetLvl,#MSG_EMOTE)
	
	If IsOnline(TargetID) = 1
		SendMessageToUser(#USERID,"Location: "+GetMapName(GetUserMap(TargetID)),#MSG_EMOTE)
	Else
		SendMessageToUser(#USERID,"Location: [offline]",#MSG_EMOTE)
	EndIf
EndIf

Label END

Continue = 1