Disabled oldSchool Shoooooooooot

This commit is contained in:
Eriks K 2021-02-03 01:48:53 +02:00
parent a9ced91741
commit b22349cb1a

View File

@ -1906,67 +1906,67 @@ class CitizenMilitary(CitizenTravel):
self.report_fighting(battle, not side.is_defender, division, total_damage, total_hits) self.report_fighting(battle, not side.is_defender, division, total_damage, total_hits)
return error_count return error_count
def _shoot(self, battle: classes.Battle, division: classes.BattleDivision, side: classes.BattleSide): # def _shoot(self, battle: classes.Battle, division: classes.BattleDivision, side: classes.BattleSide):
if division.is_air: # if division.is_air:
response = self._post_military_fight_air(battle.id, side.id, division.id) # response = self._post_military_fight_air(battle.id, side.id, division.id)
else: # else:
response = self._post_military_fight_ground(battle.id, side.id, division.id) # response = self._post_military_fight_ground(battle.id, side.id, division.id)
#
if 'Zone is not meant for ' in response.text: # if 'Zone is not meant for ' in response.text:
self.sleep(5) # self.sleep(5)
return 0, 1, 0 # return 0, 1, 0
try: # try:
r_json = response.json() # r_json = response.json()
except (ValueError, HTTPError, RequestException): # except (ValueError, HTTPError, RequestException):
return 0, 10, 0 # return 0, 10, 0
hits = 0 # hits = 0
damage = 0 # damage = 0
err = False # err = False
if r_json.get('error'): # if r_json.get('error'):
if r_json.get('message') == 'SHOOT_LOCKOUT': # if r_json.get('message') == 'SHOOT_LOCKOUT':
pass # pass
elif r_json.get('message') == 'NOT_ENOUGH_WEAPONS': # elif r_json.get('message') == 'NOT_ENOUGH_WEAPONS':
self.set_default_weapon(battle, division) # self.set_default_weapon(battle, division)
elif r_json.get('message') == "Cannot activate a zone with a non-native division": # elif r_json.get('message') == "Cannot activate a zone with a non-native division":
self.logger.warning('Wrong division!!') # self.logger.warning('Wrong division!!')
return 0, 10, 0 # return 0, 10, 0
elif r_json.get('message') == 'ZONE_INACTIVE': # elif r_json.get('message') == 'ZONE_INACTIVE':
self.logger.warning('Wrong division!!') # self.logger.warning('Wrong division!!')
return 0, 10, 0 # return 0, 10, 0
elif r_json.get('message') == 'NON_BELLIGERENT': # elif r_json.get('message') == 'NON_BELLIGERENT':
self.logger.warning("Dictatorship/Liberation wars are not supported!") # self.logger.warning("Dictatorship/Liberation wars are not supported!")
return 0, 10, 0 # return 0, 10, 0
elif r_json.get('message') in ['FIGHT_DISABLED', 'DEPLOYMENT_MODE']: # elif r_json.get('message') in ['FIGHT_DISABLED', 'DEPLOYMENT_MODE']:
self._post_main_profile_update('options', # self._post_main_profile_update('options',
params='{"optionName":"enable_web_deploy","optionValue":"off"}') # params='{"optionName":"enable_web_deploy","optionValue":"off"}')
self.set_default_weapon(battle, division) # self.set_default_weapon(battle, division)
else: # else:
if r_json.get('message') == 'UNKNOWN_SIDE': # if r_json.get('message') == 'UNKNOWN_SIDE':
self._rw_choose_side(battle, side) # self._rw_choose_side(battle, side)
elif r_json.get('message') == 'CHANGE_LOCATION': # elif r_json.get('message') == 'CHANGE_LOCATION':
countries = [side.country] + side.deployed # countries = [side.country] + side.deployed
self.travel_to_battle(battle, countries) # self.travel_to_battle(battle, countries)
err = True # err = True
elif r_json.get('message') == 'ENEMY_KILLED': # elif r_json.get('message') == 'ENEMY_KILLED':
# Non-InfantryKit players # # Non-InfantryKit players
if r_json['user']['earnedXp']: # if r_json['user']['earnedXp']:
hits = r_json['user']['earnedXp'] # hits = r_json['user']['earnedXp']
# InfantryKit player # # InfantryKit player
# The almost always safe way (breaks on levelup hit) # # The almost always safe way (breaks on levelup hit)
elif self.energy.recovered >= r_json['details']['wellness']: # Haven't reached levelup # elif self.energy.recovered >= r_json['details']['wellness']: # Haven't reached levelup
hits = (self.energy.recovered - r_json['details']['wellness']) // 10 # hits = (self.energy.recovered - r_json['details']['wellness']) // 10
else: # else:
hits = r_json['hits'] # hits = r_json['hits']
if r_json['user']['epicBattle']: # if r_json['user']['epicBattle']:
hits /= 1 + r_json['user']['epicBattle'] # hits /= 1 + r_json['user']['epicBattle']
#
self.energy.recovered = r_json['details']['wellness'] # self.energy.recovered = r_json['details']['wellness']
self.details.xp = int(r_json['details']['points']) # self.details.xp = int(r_json['details']['points'])
damage = r_json['user']['givenDamage'] * (1.1 if r_json['oldEnemy']['isNatural'] else 1) # damage = r_json['user']['givenDamage'] * (1.1 if r_json['oldEnemy']['isNatural'] else 1)
else: # else:
err = True # err = True
#
return hits, err, damage # return hits, err, damage
def deploy_bomb(self, battle: classes.Battle, division: classes.BattleDivision, bomb_id: int, inv_side: bool, def deploy_bomb(self, battle: classes.Battle, division: classes.BattleDivision, bomb_id: int, inv_side: bool,
count: int = 1) -> Optional[int]: count: int = 1) -> Optional[int]: