| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- """
- 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 <https://www.gnu.org/licenses/>.
- """
- class RuneStat():
- """
- A stat of a rune.
-
- Any stat of a rune. Values are validated on setting and capped
- automatically.
- Parameters
- ----------
- slot : int
- Position of the stat.
- stat : int
- Stat identifier (Com2Us ID).
- name : str
- Stat name.
- value : int
- Value of the stat, before grinding.
- grind : int
- Grinded value of the stat. 0 if it has not been grinded.
- total : int
- Total value of stat, including grinding.
- is_enchanted : bool
- Indicates if the stat has been enchanted (changed).
- """
- _slot = -1
- _stat = 0
- _stat_name = ""
- _value = 0
- _grind = 0
- _total = 0
- _is_enchanted = False
- def __init__(self):
- pass
-
- @property
- def slot(self):
- return self._slot
-
- @slot.setter
- def slot(self, value):
- value = int(value)
- if value < -1 or value > 4:
- value = -1;
- self._slot = value
-
- @property
- def stat(self):
- return self._stat
-
- @stat.setter
- def stat(self, value):
- value = int(value)
- if value < 0:
- value = 0;
- self._stat = value
- self._stat_name = STAT_NAMES[value]
-
- @property
- def name(self):
- return self._stat_name
-
- @property
- def value(self):
- return self._value
-
- @value.setter
- def value(self, value):
- value = int(value)
- if value < 1:
- value = 1;
- self._value = value
- self._total = self._value + self._grind
-
- @property
- def grind(self):
- return self._grind
-
- @grind.setter
- def grind(self, value):
- value = int(value)
- self._grind = value
- self._total = self._value + self._grind
-
- @property
- def total(self):
- return self._total
-
- @property
- def is_enchanted(self):
- return self._is_enchanted
-
- @is_enchanted.setter
- def is_enchanted(self, value):
- if (value == True or int(value) == 1):
- self._is_enchanted = True
- else:
- self._is_enchanted = False
|