""" This file is part of RuneOptimizer. RuneOptimizer is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. RuneOptimizer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with RuneOptimizer. If not, see . """ import database.database as database class UnitTeam(): """ A team of a unit. Very similar to the Team class, but this one doesn't load units, so it's safe to have as property of Unit. Parameters ---------- id : str Team identifier. name : str Team name. priority : int Team priority, from 1 to 50. """ _id = None _name = "" _priority = 1 def __init__(self, id=None): if id != None: self._load(id) def _load(self, id): cursor = database.CONNECTION.execute( "SELECT id, name, priority FROM teams WHERE id = ?", (id,) ) row = cursor.fetchone() if row != None: self._id = str(row[0]) self._name = str(row[1]) self._priority = int(row[2]) @property def id(self): return self._id @property def name(self): return self._name @property def priority(self): return self._priority