import requests

import re

# Purpose of Script

# - Determines how much fame you need to get to white star from your realm eye profile (only using base fame)

# - provide basic example on how to pull info from realm eye via python script

# Assumptions

# - You have 14 character classes showing on your realm eye

# - Script is only concerned with base fame

# - You actually care about white star

r = requests. get ( 'https://www.realmeye.com/player/Zoycitek' )

page_text = r. text

pattern = r '<td>([a-zA-Z]+)< \/ td> \s *<td>( \d +?)< \/ td> \s *<td>(.*?)< \/ td> \s *<td>(.*?)< \/ td> \s *<td>(.*?)< \/ td>'

match_obj = re . findall ( pattern , page_text , flags = re . M | re . I )

classes = [

'Necromancer' , 'Warrior' , 'Assassin' , 'Priest' , 'Ninja' ,

'Trickster' , 'Paladin' , 'Rogue' , 'Huntress' , 'Sorcerer' ,

'Wizard' , 'Archer' , 'Mystic' , 'Knight'

]

field_map = [

"class" , "level" , "cqc" , "bf" , "exp"

]

total_fame = 0

total_exp = 0

total_stars = 0

fame_to_ws = 14 * 2000

not_ws_fame = 0

not_ws_chars = 0

for character in match_obj:

# make sure we didnt get any BS content

c_class = character [ 0 ]

if c_class in classes:

c_level = character [ 1 ]

c_cqc = character [ 2 ]

c_bf = character [ 3 ]

c_exp = character [ 4 ]

total_fame = total_fame + int ( c_bf )

total_exp = total_exp + int ( c_exp )

if int ( c_bf ) > 2000 :

fame_to_ws = fame_to_ws - 2000

#print( "{} is over 2k @{}".format(c_class, c_bf) )

else :

fame_to_ws = fame_to_ws - int ( c_bf )

not_ws_fame = not_ws_fame + int ( c_bf )

not_ws_chars = not_ws_chars + 1

print ( "Total Fame: {}" . format ( total_fame ) )

print ( "Total XP: {}" . format ( total_exp ) )

print ( "Fame Left: {}" . format ( fame_to_ws ) )

print ( "Not WS Fame: {}" . format ( not_ws_fame ) )

print ( "Not WS Chars: {}" . format ( not_ws_chars ) )

try :

print ( "Avg Fame per class to WS: {}" . format ( fame_to_ws/not_ws_chars ) )

except :