find command now shows tunnels
parent
cc1324c5bb
commit
847e33ed6e
|
@ -140,7 +140,7 @@ class DatabaseInterface:
|
||||||
return player
|
return player
|
||||||
|
|
||||||
def search_all_fields(self, session, search):
|
def search_all_fields(self, session, search):
|
||||||
loc_string = ''
|
loc_string = '\n**Locations:**'
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
expr = Location.owner.has(Player.name.ilike('%{}%'.format(search))) | Location.name.ilike('%{}%'.format(search))
|
expr = Location.owner.has(Player.name.ilike('%{}%'.format(search))) | Location.name.ilike('%{}%'.format(search))
|
||||||
|
@ -148,9 +148,11 @@ class DatabaseInterface:
|
||||||
loc_string = "{}\n{}".format(loc_string, loc)
|
loc_string = "{}\n{}".format(loc_string, loc)
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
expr = Tunnel.owner.has(Player.name.ilike('%{}%'.format(search))) & Tunnel.location is None
|
loc_string = loc_string + '\n\n**Tunnels:**'
|
||||||
for loc in self.database.query_by_filter(session, Tunnel, expr):
|
|
||||||
loc_string = "{}\n{}".format(loc_string, loc)
|
expr = Tunnel.owner.has(Player.name.ilike('%{}%'.format(search))) & Tunnel.location == None
|
||||||
|
for tunnel in self.database.query_by_filter(session, Tunnel, expr):
|
||||||
|
loc_string = "{}\n{}".format(loc_string, tunnel.full_str())
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
if count == 0:
|
if count == 0:
|
||||||
|
|
|
@ -154,6 +154,9 @@ class Tunnel(SQL_Base):
|
||||||
except (ValueError, IndexError):
|
except (ValueError, IndexError):
|
||||||
raise TunnelInitError
|
raise TunnelInitError
|
||||||
|
|
||||||
|
def full_str(self):
|
||||||
|
return 'Owner: **{}**\'s Tunnel: **{}**'.format(self.owner.name, self.__str__())
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{} {}'.format(self.tunnel_direction.value.title(), self.tunnel_number)
|
return '{} {}'.format(self.tunnel_direction.value.title(), self.tunnel_number)
|
||||||
|
|
||||||
|
@ -201,7 +204,8 @@ class Location(SQL_Base):
|
||||||
return '(x= {}, z= {}) in the {}'.format(self.x, self.z, self.dimension.value.title())
|
return '(x= {}, z= {}) in the {}'.format(self.x, self.z, self.dimension.value.title())
|
||||||
|
|
||||||
def info_str(self):
|
def info_str(self):
|
||||||
return "Name: **{}**, Type: **{}** Position: **{}**".format(self.name, self.type, self.pos_to_str())
|
return "Name: **{}**, Type: **{}**, Owner: **{}** Position: **{}**".format(self.name, self.type,
|
||||||
|
self.owner.name, self.pos_to_str())
|
||||||
|
|
||||||
def full_str(self):
|
def full_str(self):
|
||||||
return self.__str__() + '\n' + self.dynmap_link()
|
return self.__str__() + '\n' + self.dynmap_link()
|
||||||
|
|
Loading…
Reference in New Issue