Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
bd0bcc9ac7 | |||
c6f2226e64 | |||
308807d800 | |||
91565d840e | |||
b4a9dd88f8 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -102,5 +102,4 @@ ENV/
|
|||||||
|
|
||||||
debug/
|
debug/
|
||||||
log/
|
log/
|
||||||
docs/
|
|
||||||
*dump.json
|
*dump.json
|
||||||
|
13
.pre-commit-config.yaml
Normal file
13
.pre-commit-config.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# See https://pre-commit.com for more information
|
||||||
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v3.2.0
|
||||||
|
hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: check-yaml
|
||||||
|
- id: check-added-large-files
|
||||||
|
|
||||||
|
default_language_version:
|
||||||
|
python: python3.7
|
1
LICENSE
1
LICENSE
@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
|
@ -34,4 +34,3 @@ This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypack
|
|||||||
|
|
||||||
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
|
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
|
||||||
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
|
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
|
||||||
|
|
||||||
|
53
docs/erepublik.rst
Normal file
53
docs/erepublik.rst
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
erepublik package
|
||||||
|
=================
|
||||||
|
|
||||||
|
Submodules
|
||||||
|
----------
|
||||||
|
|
||||||
|
erepublik.access\_points module
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
.. automodule:: erepublik.access_points
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
erepublik.citizen module
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
.. automodule:: erepublik.citizen
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
erepublik.classes module
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
.. automodule:: erepublik.classes
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
erepublik.constants module
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
.. automodule:: erepublik.constants
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
erepublik.utils module
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
.. automodule:: erepublik.utils
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
Module contents
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. automodule:: erepublik
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
@ -393,7 +393,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
config.air = air.checked;
|
config.air = air.checked;
|
||||||
config.ground = ground.cehcked;
|
config.ground = ground.checked;
|
||||||
config.boosters = boosters.checked;
|
config.boosters = boosters.checked;
|
||||||
config.continuous_fighting = continuous_fighting.checked;
|
config.continuous_fighting = continuous_fighting.checked;
|
||||||
config.next_energy = next_energy.checked;
|
config.next_energy = next_energy.checked;
|
||||||
@ -402,10 +402,9 @@
|
|||||||
config.travel_to_fight = travel_to_fight.checked;
|
config.travel_to_fight = travel_to_fight.checked;
|
||||||
config.epic_hunt = epic_hunt.checked;
|
config.epic_hunt = epic_hunt.checked;
|
||||||
config.epic_hunt_ebs = config.epic_hunt ? epic_hunt_ebs.checked : config.epic_hunt;
|
config.epic_hunt_ebs = config.epic_hunt ? epic_hunt_ebs.checked : config.epic_hunt;
|
||||||
|
config.maverick = false;
|
||||||
|
|
||||||
// Advanced
|
// Advanced
|
||||||
|
|
||||||
|
|
||||||
let telegram = document.getElementById('telegram'); // Generated
|
let telegram = document.getElementById('telegram'); // Generated
|
||||||
config.telegram = telegram.checked;
|
config.telegram = telegram.checked;
|
||||||
let telegram_chat_id = document.getElementById('telegram_chat_id'); // Generated
|
let telegram_chat_id = document.getElementById('telegram_chat_id'); // Generated
|
||||||
|
7
docs/modules.rst
Normal file
7
docs/modules.rst
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
erepublik
|
||||||
|
=========
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 4
|
||||||
|
|
||||||
|
erepublik
|
@ -7,4 +7,3 @@ To use eRepublik script in a project::
|
|||||||
from erepublik import Citizen
|
from erepublik import Citizen
|
||||||
player = Citizen('email@domain.com', 'password')
|
player = Citizen('email@domain.com', 'password')
|
||||||
player.update_all()
|
player.update_all()
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
__author__ = """Eriks Karls"""
|
__author__ = """Eriks Karls"""
|
||||||
__email__ = 'eriks@72.lv'
|
__email__ = 'eriks@72.lv'
|
||||||
__version__ = '0.23.4.2'
|
__version__ = '0.23.4.3'
|
||||||
|
|
||||||
from erepublik import classes, constants, utils
|
from erepublik import classes, constants, utils
|
||||||
from erepublik.citizen import Citizen
|
from erepublik.citizen import Citizen
|
||||||
|
@ -595,6 +595,10 @@ class ErepublikProfileAPI(CitizenBaseAPI):
|
|||||||
data = dict(_token=self.token, rewardId=reward_id)
|
data = dict(_token=self.token, rewardId=reward_id)
|
||||||
return self.post(f"{self.url}/main/weekly-challenge-collect-reward", data=data)
|
return self.post(f"{self.url}/main/weekly-challenge-collect-reward", data=data)
|
||||||
|
|
||||||
|
def _post_main_weekly_challenge_collect_all(self, max_reward_id: int) -> Response:
|
||||||
|
data = dict(_token=self.token, maxRewardId=max_reward_id)
|
||||||
|
return self.post(f"{self.url}/main/weekly-challenge-collect-all", data=data)
|
||||||
|
|
||||||
def _post_main_profile_update(self, action: str, params: str):
|
def _post_main_profile_update(self, action: str, params: str):
|
||||||
data = {"action": action, "params": params, "_token": self.token}
|
data = {"action": action, "params": params, "_token": self.token}
|
||||||
return self.post(f"{self.url}/main/profile-update", data=data)
|
return self.post(f"{self.url}/main/profile-update", data=data)
|
||||||
|
@ -2,7 +2,7 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
import weakref
|
import weakref
|
||||||
from datetime import datetime, timedelta, time
|
from datetime import datetime, time, timedelta
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from itertools import product
|
from itertools import product
|
||||||
from threading import Event
|
from threading import Event
|
||||||
@ -11,7 +11,7 @@ from typing import Any, Dict, List, NoReturn, Optional, Set, Tuple, Union
|
|||||||
|
|
||||||
from requests import HTTPError, RequestException, Response
|
from requests import HTTPError, RequestException, Response
|
||||||
|
|
||||||
from . import access_points, classes, constants, utils, types
|
from . import access_points, classes, constants, types, utils
|
||||||
from .classes import OfferItem
|
from .classes import OfferItem
|
||||||
|
|
||||||
|
|
||||||
@ -2617,17 +2617,21 @@ class Citizen(CitizenAnniversary, CitizenCompanies, CitizenLeaderBoard,
|
|||||||
data = self._get_main_weekly_challenge_data().json()
|
data = self._get_main_weekly_challenge_data().json()
|
||||||
self.details.pp = data.get("player", {}).get("prestigePoints", 0)
|
self.details.pp = data.get("player", {}).get("prestigePoints", 0)
|
||||||
self.details.next_pp.clear()
|
self.details.next_pp.clear()
|
||||||
|
max_collectable_id = data.get('maxRewardId')
|
||||||
|
should_collect = False
|
||||||
for reward in data.get("rewards", {}).get("normal", {}):
|
for reward in data.get("rewards", {}).get("normal", {}):
|
||||||
status = reward.get("status", "")
|
status = reward.get("status", "")
|
||||||
if status == "rewarded":
|
if status == "rewarded":
|
||||||
continue
|
continue
|
||||||
elif status == "completed":
|
elif status == "completed":
|
||||||
self._post_main_weekly_challenge_reward(reward.get("id", 0))
|
should_collect = True
|
||||||
elif reward.get("icon", "") == "energy_booster":
|
elif reward.get("icon", "") == "energy_booster":
|
||||||
pps = re.search(r"Reach (\d+) Prestige Points to unlock the following reward: \+1 Energy",
|
pps = re.search(r"Reach (\d+) Prestige Points to unlock the following reward: \+1 Energy",
|
||||||
reward.get("tooltip", ""))
|
reward.get("tooltip", ""))
|
||||||
if pps:
|
if pps:
|
||||||
self.details.next_pp.append(int(pps.group(1)))
|
self.details.next_pp.append(int(pps.group(1)))
|
||||||
|
if should_collect:
|
||||||
|
self._post_main_weekly_challenge_collect_all(max_collectable_id)
|
||||||
|
|
||||||
def should_fight(self, silent: bool = True) -> Tuple[int, str, bool]:
|
def should_fight(self, silent: bool = True) -> Tuple[int, str, bool]:
|
||||||
count, log_msg, force_fight = super().should_fight()
|
count, log_msg, force_fight = super().should_fight()
|
||||||
|
@ -7,7 +7,7 @@ from typing import Any, Dict, Generator, Iterable, List, NamedTuple, NoReturn, T
|
|||||||
|
|
||||||
from requests import Response, Session, post
|
from requests import Response, Session, post
|
||||||
|
|
||||||
from . import constants, utils, types
|
from . import constants, types, utils
|
||||||
|
|
||||||
__all__ = ['Battle', 'BattleDivision', 'BattleSide', 'Company', 'Config', 'Details', 'Energy', 'ErepublikException',
|
__all__ = ['Battle', 'BattleDivision', 'BattleSide', 'Company', 'Config', 'Details', 'Energy', 'ErepublikException',
|
||||||
'ErepublikNetworkException', 'EnergyToFight',
|
'ErepublikNetworkException', 'EnergyToFight',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Dict, Union, List
|
from typing import Dict, List, Union
|
||||||
|
|
||||||
InvFinalItem = Dict[str, Union[str, int, List[Dict[str, Union[int, datetime]]]]]
|
InvFinalItem = Dict[str, Union[str, int, List[Dict[str, Union[int, datetime]]]]]
|
||||||
InvBooster = Dict[str, Dict[int, Dict[int, InvFinalItem]]]
|
InvBooster = Dict[str, Dict[int, Dict[int, InvFinalItem]]]
|
||||||
|
@ -5,14 +5,15 @@ flake8==3.8.4
|
|||||||
ipython>=7.19.0
|
ipython>=7.19.0
|
||||||
isort==5.7.0
|
isort==5.7.0
|
||||||
pip==20.3.3
|
pip==20.3.3
|
||||||
|
pre-commit==2.9.3
|
||||||
|
pur==5.3.0
|
||||||
PyInstaller==4.1
|
PyInstaller==4.1
|
||||||
pytz>=2020.0
|
PySocks==1.7.1
|
||||||
pytest==6.2.1
|
pytest==6.2.1
|
||||||
|
pytz>=2020.5
|
||||||
|
requests>=2.25.1
|
||||||
responses==0.12.1
|
responses==0.12.1
|
||||||
setuptools==51.1.1
|
setuptools==51.1.1
|
||||||
Sphinx==3.4.2
|
Sphinx==3.4.2
|
||||||
requests>=2.24.0,<2.26.0
|
|
||||||
PySocks==1.7.1
|
|
||||||
twine==3.3.0
|
twine==3.3.0
|
||||||
wheel==0.36.2
|
wheel==0.36.2
|
||||||
pur==5.3.0
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.23.4.2
|
current_version = 0.23.4.3
|
||||||
commit = True
|
commit = True
|
||||||
tag = True
|
tag = True
|
||||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?
|
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?
|
||||||
@ -37,4 +37,3 @@ warn_unused_configs = True
|
|||||||
[isort]
|
[isort]
|
||||||
multi_line_output = 2
|
multi_line_output = 2
|
||||||
line_length = 120
|
line_length = 120
|
||||||
not_skip = __init__.py
|
|
||||||
|
2
setup.py
2
setup.py
@ -50,6 +50,6 @@ setup(
|
|||||||
test_suite='tests',
|
test_suite='tests',
|
||||||
tests_require=test_requirements,
|
tests_require=test_requirements,
|
||||||
url='https://github.com/eeriks/erepublik/',
|
url='https://github.com/eeriks/erepublik/',
|
||||||
version='0.23.4.2',
|
version='0.23.4.3',
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user