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.
27 lines
791 B
27 lines
791 B
2 years ago
|
from geopy.geocoders import Nominatim
|
||
2 years ago
|
from ..core.location import Location
|
||
2 years ago
|
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")
|
||
|
getLoc = loc.geocode(query)
|
||
|
|
||
|
self.location = Location(getLoc.latitude, getLoc.longitude)
|
||
|
|
||
|
def set_location(self, location, did_activity):
|
||
2 years ago
|
next_cd = self.cooldown_to(location)
|
||
2 years ago
|
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
|