Skip to content
This repository has been archived by the owner on Dec 10, 2017. It is now read-only.

Commit

Permalink
Merge pull request #218 from mrmin123/208_summer_event
Browse files Browse the repository at this point in the history
expanded summer event support
  • Loading branch information
mrmin123 committed Aug 18, 2016
2 parents e74af7a + 01ac0ae commit 63b875c
Show file tree
Hide file tree
Showing 24 changed files with 109 additions and 48 deletions.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*If you are submitting a feature request or a non-bug report, please feel free to delete this template. Also feel free to delete sections of this template you do not find relevant when submitting a bug report. Thanks!*
*Please read the FAQ/Common Issues section of the README before opening a ticket. If you are submitting a feature request or a non-bug report, please feel free to delete this template. Also feel free to delete sections of this template you do not find relevant when submitting a bug report. Thanks!*

#### Environment details

Expand All @@ -12,14 +12,14 @@ Is the issue consistent (can be reproduced consistently) or is it transient (onl
- [ ] Consistent
- [ ] Transient

[description of issue here, along with any screenshots and/or videos]
[replace this line with a description of issue, along with any screenshots and/or videos. Please be descriptive as possible, describing step by step what is happening in the game]

#### Console log (if applicable)
```
[log goes here]
[replace this line with ~50 lines of console log]
```

#### Relevant config snippet (if applicable)
```
[config snippet goes here]
[replace this line with relevant portion from config with comments removed]
```
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
> I make no guarantees that you will not be caught and penalized using kancolle-auto, so be smart about it. Don't spam expeditions and sorties nonstop 24/7. Try to mimic a human as much as possible with your use of this tool! Relevant discussion can be found [here](https://github.com/mrmin123/kancolle-auto/issues/130).
> In addition, if you let kancolle-auto sortie you might lose ships! It is highly unlikely (multiple checks occur to prevent this from happening) but I make no guarantees! Also, if you let kancolle-auto use buckets, make sure you can spare them!
> In addition, if you let kancolle-auto sortie you might lose ships! It is highly unlikely (multiple checks occur to prevent this from happening) but I make no guarantees! If you're using a viewer with subtitles, please read the 1st question and answer of the [FAQ](#faqcommon-issues)! Also, if you let kancolle-auto use buckets, make sure you can spare them!
***

Expand All @@ -34,7 +34,7 @@ Please read the [**kancolle-auto wiki**](https://github.com/mrmin123/kancolle-au
* Expedition module — automate expeditions
* PvP module — automate PvP
* Combat module — automate sorties, node selections, repairs, and submarine switching
* Supports Event maps, Combined Fleet maps, and LBAS maps
* Supports sorties to Event maps, Combined Fleets, LBAS, and pre-boss/boss support expeditions
* Quests module — automate quests
* Individual toggles for each of the above modules
* Scheduled sleeping/pausing of script
Expand All @@ -49,23 +49,29 @@ kancolle-auto was originally a fork of [these](https://github.com/amylase/kancol

#### Quick Start

1. Install [Java JRE 7](http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html)
1. Install [Java JRE 8](http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html)
2. Install [Sikuli 1.0.x](https://launchpad.net/sikuli/sikulix/1.0.1) (not 1.1.x!) with options 2 and 5
3. Install kancolle-auto
4. [Setup kancolle-auto's config file](https://github.com/mrmin123/kancolle-auto/wiki/Setup-config.ini) ([examples](https://github.com/mrmin123/kancolle-auto/wiki/Example-configs))
5. Run Kantai Collection
6. Run kancolle-auto using command `java -jar <path_to_sikuli>/sikuli-script.jar -r <path_to_kancolle_auto>/kancolle_auto.sikuli` (replacing `<path_to_sikuli>` and `<path_to_kancolle_auto>` with the correct directories for your installs)

#### FAQ/Commonly asked questions
#### FAQ/Common Issues

**Q: Can I do other stuff on the machine or play Kantai Collection while kancolle-auto is running?**
**Q: Can I lose my ships using kancolle-auto?**

A: Kinda. kancolle-auto takes control of the mouse as it runs so it will be difficult to do anything meaningful while kancolle-auto is actively running. During scheduled pauses, however, you have full control of the machine. Just make sure that Kantai Collection is not in the middle of a PvP or Sortie when the schedule pause ends. The script will crash and you will have to restart the script.
A: It's highly unlikely, but I can make no guarantees. There is a caveat to 'highly unlikely', however: if you're using a viewer with subtitles and those subtitles cover up ship portraits on the post-combat results screen (typically the last ship in a fleet if the subtitles are at the bottom of the screen), it can hinder kancolle-auto's ability to accurately detect ships in danger of being sunk. Either lower the subtitle's font size so that it does not cover up the results screen (I personally use a font size of 12px on KC3Kai), or disable them entirely.

You could also lose ships if you set the Combat module's LastNodePush to `True` and accidentally push into a comabt node. Hopefully the warnings in the config file will help you make the right decision regarding this flag.

**Q: Can I do other stuff on the machine/play Kantai Collection while kancolle-auto is running?**

A: Sometimes. kancolle-auto takes control of the mouse as it runs so it will be difficult to do anything meaningful while kancolle-auto is actively running. During scheduled pauses, however, you have full control of the machine. Just make sure that Kantai Collection is not in the middle of a PvP or Sortie when the schedule pause ends. The script will crash and you will have to restart the script.

**Q: kancolle-auto periodically crashes! (FindFailed errors)**

A: This is 99% not a bug in the program so please do not make a ticket. Instead, try raising the `SleepModifier` field in the config to 1 or 2 or 3. If this does not reduce the number of crashes, then please create a detailed ticket.
A: If you are on Windows, please try disabling time synchronization on the OS level ([relevant information](https://answers.launchpad.net/sikuli/+question/194095)). If that doesn't work, try raising the `SleepModifier` field in the config to 1, 2, or 3. If this does not reduce the number of crashes, then please open a detailed issue ticket.

**Q: I started getting catbombed frequently after I started using kancolle-auto!**

A: You're probably botting too much. Use the ScheduledSleep functionality and let the program pause itself for a few hours every day.
A: You probably botted too much and triggered the game's bot protection. Use the ScheduledSleep functionality and let the program pause itself for a few hours every day.
22 changes: 14 additions & 8 deletions config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
[General]
# The program/window name of your Kancolle container. Examples include Google Chrome,
# Firefox, KanColleViewer!, KanColleTool Viewer, Electronic Observer, etc...
# WARNING: IF YOU ARE USING A VIEWER WITH SUBTITLES, AND USING THE COMBAT MODULE, EITHER DISABLE
# THE SUBTITLES OR LOWER THEIR FONT SIZE TO 13PX OR LOWER. YOU MAY LOSE SHIPS IF YOU DO NOT DO
# THIS. PLEASE REFER TO THE FAQ IN THE README FOR DETAILS
Program: KC3

# Which built-in recovery method to use when you get catbomb'ed. Valid options are Browser,
Expand Down Expand Up @@ -183,10 +186,11 @@ PortCheck: False
# has been obtained. Only applicable to the monthly EOs (1-5, 2-5, 3-5, 4-5, 5-5).
MedalStop: False

# WARNING: READ THIS
# Whether or not to 'push' past the max number of defined combat nodes, REGARDLESS OF THE STATE
# OF YOUR FLEET. Only do this if the last node is a resource/non-combat node, like the end of 1-6
# and your path is 100% fixed!!! YOU MAY LOSE SHIPS WITH THIS SET TO TRUE.
# Set whether or not to 'push' past the max number of defined combat nodes, REGARDLESS OF THE
# STATE OF YOUR FLEET. Only do this if the last node is a resource/non-combat node, like the end
# of 1-6, and only if your path is 100% fixed!
# WARNING: YOU MAY LOSE SHIPS WITH THIS SET TO TRUE. PLEASE STUDY THE MAP YOU ARE SORTIEING TO AND
# MAKE AN EDUCATED DECISION
LastNodePush: False


Expand All @@ -195,11 +199,13 @@ LastNodePush: False
Enabled: False

# Enabled air support groups for the sortie, delimited by commas. Values should be 1, 2, or 3
EnabledGroups: 1
EnabledGroups:

# Node image names for each of the above enabled air support groups. Each group should have two
# nodes assigned to them. You'll have to generate these images yourself
Group1Nodes: _node_lbas_E-2-I_1.png, _node_lbas_E-2-I_2.png
# Node image names for each of the above enabled air support groups. Groups with node targets
# should have two nodes assigned to them. You'll have to generate these images yourself (or wait
# for the program to be updated on Github). Active groups with no node images are assumed to be
# air defense groups, and will be resupplied each sortie, but not assigned nodes on the map
Group1Nodes:
Group2Nodes:
Group3Nodes:

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified kancolle_auto.sikuli/combat.sikuli/_event_panel_1-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 30 additions & 16 deletions kancolle_auto.sikuli/combat.sikuli/combat.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, kc_region, settings):
self.lbas_nodes[2] = settings['lbas_group_2_nodes']
self.lbas_nodes[3] = settings['lbas_group_3_nodes']
self.damage_counts = [0, 0, 0]
self.dmg_similarity = 0.75
self.dmg_similarity = 0.7

# Tally and return number of ships of each damage state. Supports combined
# fleets (add=True) as well as pre-sortie and post-sortie screens
Expand Down Expand Up @@ -224,6 +224,11 @@ def go_sortie(self):
wait_and_click(global_regions['next'], 'next.png', 30, expand_areas('next'))
sleep(3)
# Tally damages at post-battle report screen
while not self.kc_region.exists('post_combat_result_screen.png'):
# Additional check to make sure that we're seeing the damage states of ships,
# otherwise keep hitting next button until we get there
check_and_click(global_regions['next'], 'next.png', expand_areas('next'))
sleep(1)
self.tally_damages(combat=True)
# Check for medal reward, if enabled
if self.medal_stop:
Expand Down Expand Up @@ -382,32 +387,41 @@ def lbas_resupply(self):
sleep(2)
for lbas_group in self.lbas_groups:
# Loop through active air support groups
log_msg("Resupplying LBAS group %s!" % lbas_group)
if lbas_group > 1:
# Ony click the tab if it's not the first group
check_and_click(self.kc_region, 'lbas_group_tab_%s.png' % lbas_group)
check_and_click(self.kc_region, Pattern('lbas_group_tab_%s.png' % lbas_group).similar(0.95))
sleep(1)
if check_and_click(self.kc_region, 'lbas_resupply_button_1.png'):
sleep(2)
sleep(1)
rejigger_mouse(self.kc_region, 50, 100, 50, 100)
sleep(1)
check_and_click(self.kc_region, 'lbas_resupply_button_2.png')
sleep(2)
sleep(3)
# Done resupplying
check_and_click(self.kc_region, 'lbas_resupply_menu_faded.png')
sleep(2)

# Sends air groups out to desired nodes at beginning of sortie
def lbas_sortie(self):
for lbas_group in self.lbas_groups:
# Check to see if the first specified node exists on screen... because the LBAS screen might be covering it
if not self.kc_region.exists(self.lbas_nodes[lbas_group][0]):
self.kc_region.mouseMove(self.kc_region.find('lbas_panel_switch.png'))
sleep(4)
check_and_click(self.kc_region, self.lbas_nodes[lbas_group][0], expand_areas('node_select'))
# Check to see if the second specified node exists on screen... because the LBAS screen might be covering it
if not self.kc_region.exists(self.lbas_nodes[lbas_group][1]):
self.kc_region.mouseMove(self.kc_region.find('lbas_panel_switch.png'))
sleep(4)
check_and_click(self.kc_region, self.lbas_nodes[lbas_group][1], expand_areas('node_select'))
sleep(2)
check_and_click(self.kc_region, 'lbas_assign_nodes.png')
# Only assign nodes if they were assigned to the LBAS group
if len(self.lbas_nodes[lbas_group]) == 2:
log_msg("Assigning targets to LBAS group %s" % lbas_group)
# Check to see if the first specified node exists on screen... because the LBAS screen might be covering it
if not self.kc_region.exists(self.lbas_nodes[lbas_group][0] + '.png'):
self.kc_region.mouseMove(self.kc_region.find('lbas_panel_switch.png'))
sleep(3)
check_and_click(self.kc_region, self.lbas_nodes[lbas_group][0] + '.png', expand_areas('node_select'))
sleep(2)
# Check to see if the second specified node exists on screen... because the LBAS screen might be covering it
if not self.kc_region.exists(self.lbas_nodes[lbas_group][1] + '.png'):
self.kc_region.mouseMove(self.kc_region.find('lbas_panel_switch.png'))
sleep(3)
check_and_click(self.kc_region, self.lbas_nodes[lbas_group][1] + '.png', expand_areas('node_select'))
sleep(2)
check_and_click(self.kc_region, 'lbas_assign_nodes.png')
log_msg("LBAS groups ready with their assignments!")

# Navigate to repair menu and repair any ship above damage threshold. Sets
# next sortie time accordingly
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions kancolle_auto.sikuli/config_reader.sikuli/config_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ def get_config(settings, sleep_cycle):
settings['lbas_groups'][i] = int(val)
settings['lbas_groups'].sort()
settings['lbas_group_1_nodes'] = config.get('LBAS', 'Group1Nodes').replace(' ', '').split(',')
if (1 in settings['lbas_groups'] and len(settings['lbas_group_1_nodes']) != 2):
log_error("You must specify two (2) nodes for active LBAS group 1!")
if (1 in settings['lbas_groups'] and (settings['lbas_group_1_nodes'] != [''] and len(settings['lbas_group_1_nodes']) != 2)):
log_error("You must specify zero (0) or two (2) nodes for active LBAS group 1!")
sys.exit()
settings['lbas_group_2_nodes'] = config.get('LBAS', 'Group2Nodes').replace(' ', '').split(',')
if (2 in settings['lbas_groups'] and len(settings['lbas_group_2_nodes']) != 2):
log_error("You must specify two (2) nodes for active LBAS group 2!")
if (2 in settings['lbas_groups'] and (settings['lbas_group_2_nodes'] != [''] and len(settings['lbas_group_2_nodes']) != 2)):
log_error("You must specify zero (0) or two (2) nodes for active LBAS group 2!")
sys.exit()
settings['lbas_group_3_nodes'] = config.get('LBAS', 'Group3Nodes').replace(' ', '').split(',')
if (3 in settings['lbas_groups'] and len(settings['lbas_group_3_nodes']) != 2):
log_error("You must specify two (2) nodes for active LBAS group 3!")
if (3 in settings['lbas_groups'] and (settings['lbas_group_3_nodes'] != [''] and len(settings['lbas_group_3_nodes']) != 2)):
log_error("You must specify zero (0) or two (2) nodes for active LBAS group 3!")
sys.exit()
else:
settings['lbas_enabled'] = False
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions kancolle_auto.sikuli/expedition.sikuli/expedition.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ def ensei_factory(ensei_id, fleet_id):
return Ensei(39, 'ensei_name_39.png', 'ensei_area_05.png', datetime.timedelta(hours=29, minutes=59, seconds=15), fleet_id)
elif ensei_id == 40:
return Ensei(40, 'ensei_name_40.png', 'ensei_area_05.png', datetime.timedelta(hours=6, minutes=49, seconds=15), fleet_id)
elif ensei_id == 189:
return Ensei(189, 'ensei_name_189.png', 'ensei_area_e.png', datetime.timedelta(hours=0, minutes=15, seconds=0), fleet_id)
elif ensei_id == 190:
return Ensei(190, 'ensei_name_190.png', 'ensei_area_e.png', datetime.timedelta(hours=0, minutes=30, seconds=0), fleet_id)
else:
log_warning("%s is an invalid/unsupported expedition! Defaulting to expedition 2!" % ensei_id)
return ensei_factory(2, fleet_id)
14 changes: 13 additions & 1 deletion kancolle_auto.sikuli/kancolle_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def pvp_action():

# Actions involved in conducting sorties
def sortie_action():
global fleet_needs_resupply, combat_item, quest_item, done_sorties, settings
global fleet_needs_resupply, combat_item, expedition_item, quest_item, done_sorties, settings
fleetcomp_switch_action(settings['combat_fleetcomp'])
if settings['expeditions_enabled']:
expedition_action_wrapper()
Expand All @@ -213,6 +213,13 @@ def sortie_action():
fleet_needs_resupply[0] = True
if settings['combined_fleet']:
fleet_needs_resupply[1] = True
# Check for event-specific expeditions
if settings['expeditions_enabled'] is True and expedition_item is not None:
for expedition in expedition_item.expedition_list:
if expedition.id in [189, 190]:
# Set event-specific expeditions to be done on sortie end
fleet_needs_resupply[expedition.fleet_id - 1] = True
expedition.check_later(0, -1)
# Check home, repair if needed, and resupply
go_home()
if combat_item.count_damage_above_limit('repair') > 0:
Expand All @@ -223,6 +230,10 @@ def sortie_action():
fleet_needs_resupply[1] = False
log_success("Next sortie!: %s" % combat_item)
else:
# Check for event-specific expeditions
if settings['expeditions_enabled'] is True and expedition_item is not None:
# If the sortie failed, disable the event-specific expeditions to not keep them going, since combat will also be disabled
expedition_item.expedition_list[:] = [expedition for expedition in expedition_item.expedition_list if expedition.id not in [189, 190]]
go_home()
settings['combat_enabled'] = False
log_success("Medal obtained! Stopping combat module!")
Expand Down Expand Up @@ -368,6 +379,7 @@ def init():
refresh_kancolle(kc_window, settings, e)

# initialize kancolle_auto
# debug_find('dmg_critical.png', 'Chrome', 0.75) # For debugging purposes only!
init()
log_msg("Initial checks and commands complete. Starting loop.")
main_loop = True
Expand Down
Loading

0 comments on commit 63b875c

Please sign in to comment.