You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from geopy.geocoders import Nominatim
|
|
|
|
from ..core.location import Location
|
|
|
|
from .object import Object
|
|
|
|
|
|
|
|
class Player(Object):
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__()
|
|
|
|
self.current_cooldown = 0
|
|
|
|
|
|
|
|
def set_location_with_query(self, query):
|
|
|
|
loc = Nominatim(user_agent="GetLoc")
|
|
|
|
get_loc = loc.geocode(query)
|
|
|
|
|
|
|
|
self.location = Location(get_loc.latitude, get_loc.longitude)
|
|
|
|
|
|
|
|
def set_location(self, location, did_activity):
|
|
|
|
next_cd = self.cooldown_to(location)
|
|
|
|
if did_activity:
|
|
|
|
if next_cd + self.current_cooldown >= 120:
|
|
|
|
self.current_cooldown = 120
|
|
|
|
else:
|
|
|
|
self.current_cooldown += next_cd
|
|
|
|
self.location = location
|
|
|
|
|
|
|
|
def get_location(self):
|
|
|
|
return self.location
|