Example #1
0
from azurlane import load_src

collection_srcs = load_src.load_sharecfg('world_collection_file_template')
group_srcs = load_src.load_sharecfg('world_collection_file_group')

group_names = {
    '051': 'Glimmer Project',
    '061': 'Mystery of the Cubes',
    '071': 'Code G',
    '081': 'Arms Race',
    '091': 'Confidential I',
    '101': 'Cold War Escalation',
}

result = ''

tabs = []

for group_id, group_src in group_srcs.items():
    group_id = group_src['id_2']
    group_name = group_names.get(group_id, group_src['name'])
    group_fullname = '%s - %s' % (group_id, group_name)
    tab = group_fullname + '=\n'
    # tab += '=== %s ===\n\n' % group_name
    for collection_id in group_src['child'].values():
        collection_src = collection_srcs[collection_id]
        collection_title = '%(group_ID)s - %(name)s' % collection_src
        tab += '==== %s ====\n\n' % collection_title
        if collection_src['pic']:
            tab += '[[File:Collectfile %s.png|thumb|alt=%s|%s]]\n\n' % (
                collection_src['pic'], collection_title, collection_title)
Example #2
0
from azurlane import load_src

buff_srcs = load_src.load_sharecfg('world_SLGbuff_data', key_type=int)

result = ''

for buff_id, buff_data in buff_srcs.items():
    result += '|-\n'
    result += '| %s || %s\n' % (buff_data['name'], buff_data['desc'])

print(result)
Example #3
0
import azurlane.common
from azurlane import load_src
from equipment_page_map import equipment_page_map
import urllib.parse

equip_data_srcs = load_src.load_sharecfg('equip_data_statistics')
item_data_srcs = load_src.load_sharecfg('item_data_statistics')
upgrade_srcs = load_src.load_sharecfg('equip_upgrade_data')


def get_links(equipment_id):
    if equipment_id in equipment_page_map:
        tab = equipment_page_map[equipment_id]
    else:
        tab = equip_data_srcs[equipment_id]['name']
        print('Missing page for equipment id', equipment_id, tab)
    return tab.split('#')[0], tab


def quote_link(link):
    return link.replace('"', '"')


seen_outputs = set()
items_using_material = {}

header = '{| class = "wikitable sortable"\n'
header += '! rowspan = "2" | Upgrade from !! colspan = "3" | Materials !! rowspan = "2" | {{Coin}} !! rowspan = "2" | Upgrade to\n'
header += '|-\n'
header += '! 1 !! 2 !! 3 \n'
Example #4
0
from azurlane import load_src

chapter_srcs = load_src.load_sharecfg('world_chapter_random', key_type=int)
target_srcs = load_src.load_sharecfg('world_target_data', key_type=int)
item_srcs = load_src.load_sharecfg('item_data_statistics', key_type=int)
world_item_srcs = load_src.load_sharecfg('world_item_data_template',
                                         key_type=int)
#world_expedition_srcs = load_src.load_sharecfg('world_chapter_template', key_type=int)


def get_item(item_id):
    return item_srcs.get(item_id, world_item_srcs.get(item_id, {}))


result = '{| class="wikitable sortable"\n'
result += '! ID !! Name !! Corruption !! Star objectives !! Rewards\n'

total_rewards = {}

for chapter_id, chapter_data in chapter_srcs.items():
    if chapter_id > 10 and chapter_id < 200:
        print(chapter_id)
        chapter_name = chapter_data['name']
        corruption = str(chapter_data['hazard_level'])
        ap_cost = str(chapter_data['enter_cost'])
        if ap_cost == '0': continue
        """
        if len(chapter_data['sairen_chapter']) > 0:
            siren_chapter_id = chapter_data['sairen_chapter'][1]
            siren_chapter_data = chapter_srcs[siren_chapter_id]
            siren_corruption = siren_chapter_data['hazard_level']
Example #5
0
from azurlane import load_src

item_srcs = load_src.load_sharecfg('item_data_statistics', key_type=int)
repair_srcs = load_src.load_sharecfg('ship_meta_repair', key_type=int)

data = {
    'cannon': [],
    'torpedo': [],
    'air': [],
    'reload': [],
}
item_types = {}

for repair_id, repair_data in repair_srcs.items():
    item = item_srcs[repair_data['item_id']]
    item_name = item['name']
    item_qty = repair_data['item_num']
    stat_name = repair_data['effect_attr'][1]
    stat_qty = repair_data['effect_attr'][2]
    item_types[stat_name] = item_name
    data[stat_name].append((item_qty, stat_qty))

max_steps = max(len(x) for x in data.values())

result = '{|class = "wikitable"\n'
result += '! rowspan = "2" | Step !! colspan = "4" | Item ⇒ Stat \n'
result += '|-\n'
result += '! {{Display|Crystallized Heat-Resistant Steel|G||24px}} ⇒ {{Firepower}} \n'
result += '! {{Display|Supercavitation Generator|G||24px}} ⇒ {{Torpedo}} \n'
result += '! {{Display|Nanoceramic Alloy|G||24px}} ⇒ {{Aviation}} \n'
result += '! {{Display|Neuroplastic Prostethic Arm|G||24px}} ⇒ {{Reload}} \n'
Example #6
0
from azurlane import load_src
from azurlane.math import Vector, camera_slope
from PIL import Image, ImageDraw
import copy
import random
import math

weapon_srcs = load_src.load_sharecfg('weapon_property')
barrage_srcs = load_src.load_sharecfg('barrage_template')
bullet_srcs = load_src.load_sharecfg('bullet_template')

bullet_models = {
    'BulletUSA' : ('bullet-04-y', 4, 1), # normal
    'BulletUK' : ('bullet_UK', 6, 2), # normal
    'BulletJP' : ('bulletjp', 5, 1.25), # HE
    'Bullet1' : ('kuasheAP', 6, 2), # AP
    'kuashe' : ('bullet_UK', 8, 3), # big normal
    'kuasheHE' : ('kuasheHE', 8, 4), # big HE
    'kuasheAP' : ('kuasheAP', 8, 4), # big AP
    'kuasheSAP' : ('kuasheAP', 8, 4), # big SAP
    'Torpedo01' : ('Torpedo01', 2, 1), 
    
    'kuashetuowei' : ('bullet_UK', 8, 3),
    'BulletGER' : ('bulletGER', 3, 3),
    'chuantoudan' : ('path_00269', 6, 0.5),
    'Bomberbomb500' : ('Bomberbomb150lb', 4, 2),
    'xingxingzidan01' : ('AL_Star01', 2, 2),
    'xingxingzidan02' : ('AL_Star02', 2, 2),
    'Bulletelc' : ('bulletUSA', 6, 2), # eldridge until i get the proper image
    'Torpedo_Vampire' : ('Torpedo_Vampire', 2, 1), 
    'shizijia_faxi' : ('AL_Trail00', 3, 3),
Example #7
0
import sys
import os

sys.path.append("..")
if os.path.exists('pywikibot.lwp'):
    os.remove('pywikibot.lwp')  #pepega

import pywikibot
from azurlane import load_src

os.chdir('..')

ship_data_srcs = load_src.load_sharecfg('ship_data_template')
ship_stats_srcs = load_src.load_sharecfg('ship_data_statistics')
ship_group_srcs = load_src.load_sharecfg('ship_data_group')
ship_lb_srcs = load_src.load_sharecfg('ship_data_breakout')
retro_srcs = load_src.load_sharecfg('transform_data_template')

retro_ship_ids = set()

for retro_data in retro_srcs.values():
    if len(retro_data['ship_id']) > 0:
        retro_ship_ids.add(retro_data['ship_id'][1][2])

display_id_by_group = {}
for display_id, group_data in ship_group_srcs.items():
    display_id_by_group[group_data['group_type']] = display_id

base_max = {}
base_kai = {}
Example #8
0
import sys
import os
sys.path.append("..")
if os.path.exists('pywikibot.lwp'):
    os.remove('pywikibot.lwp')  #pepega

import pywikibot
import azurlane.load_src
import azurlane.weapon
os.chdir('..')

equip_stats_srcs = load_src.load_sharecfg('equip_data_statistics')

equip_stats_srcs_base_only = {
    k: v
    for k, v in equip_stats_srcs.items() if 'base' not in v
}

import re

site = pywikibot.Site('azurlane')  # The site we want to run our bot on
site.login()
category = pywikibot.Category(site, 'Equipment')

equip_wiki_keys = [
    'Name',
    'ENName',
    'Image',
    'Stars',
    'BaseID',
    'Type',
Example #9
0
from azurlane import load_src

level_srcs = load_src.load_sharecfg('ship_meta_skilltask', key_type=int)
task_srcs = load_src.load_sharecfg('task_meta_data_template', key_type=int)

task_categories = [
    ('unlimited', [1, 2]),
    ('unrestricted', [3, 4]),
    ('Operation Siren-only', [5, 6, 7, 301, 302]),
    ('[META ship]-only', [x for x in range(101, 106)] + [x for x in range(200, 204)]),
    ]

task_notes = {
    3 : 'Also counts for Operation Siren battles.',
    4 : 'Also counts for Operation Siren battles (even lost battles).',
    101 : 'Also counts for Operation Siren battles.',
    102 : 'Also counts for Operation Siren battles.',
    103 : 'Also counts for Operation Siren battles.',
    104 : 'Also counts for Operation Siren battles.',
    105 : 'Also counts for Operation Siren battles.',
    201 : 'Actually Operation Siren only.',
    203 : 'Actually fleets rather than enemies.',
}

target_skill_id = 800040

tasks_by_level = []

need_xps = []

for data in level_srcs.values():
Example #10
0
from azurlane import load_src
from collections import defaultdict

event_id = 7001
battlepass_src = load_src.load_sharecfg('battlepass_event_pt')
resource_srcs = load_src.load_sharecfg('player_resource')
item_srcs = load_src.load_sharecfg('item_data_statistics')
ship_srcs = load_src.load_sharecfg('ship_data_statistics')
skin_srcs = load_src.load_sharecfg('ship_skin_template')


def get_reward(reward):
    reward_type = reward[1]
    reward_id = reward[2]
    reward_qty = reward[3]

    if reward_type == 1:
        reward_id = resource_srcs[reward_id]['itemid']
        reward_name = item_srcs[reward_id]['name']
    elif reward_type == 2:
        reward_name = item_srcs[reward_id]['name']
    elif reward_type == 4:
        reward_name = ship_srcs[reward_id]['name']
    elif reward_type == 7:
        reward_name = skin_srcs[reward_id]['name']

    reward_name = reward_name.strip()
    return reward_name, reward_qty


total_free = {}
Example #11
0
from azurlane import load_src

expedition_data_srcs = load_src.load_sharecfg('expedition_data_template')
enemy_data_srcs = load_src.load_sharecfg('enemy_data_statistics')

op_boss_level = 128
growth_mult = (op_boss_level - 1) / 1000.0


def get_stat(boss, stat):
    return int(round(boss[stat] + boss[stat + '_growth'] * growth_mult))


filter_strings = [
    "Defense Module",
    "Arbiter",
]

for expedition_data in expedition_data_srcs.values():
    if not any((s in expedition_data['name']) for s in filter_strings):
        continue
    dungeon_id = expedition_data['dungeon_id']
    dungeon_data = load_src.load_dungeon(dungeon_id)
    waves = dungeon_data['stages'][1]['waves']
    for wave in waves.values():
        for spawn in wave.get('spawn', {}).values():
            if 'bossData' in spawn:
                boss_id = spawn['monsterTemplateID']
                if boss_id not in enemy_data_srcs:
                    print('Missing boss id', boss_id, 'for',
                          expedition_data['name'])
Example #12
0
from azurlane import load_src
import numpy
from PIL import Image, ImageDraw, ImageFont

# Total XP is a bit over 4 million.

cn_data = load_src.load_sharecfg('ship_level', server='CN')
en_data = load_src.load_sharecfg('ship_level', server='EN')


def xp_list(data):
    normal = [0]
    ur = [0]
    for level in range(1, 125):
        normal.append(data[level]['exp'])
        ur.append(data[level]['exp_ur'])
    return normal, ur


xp_cn, _ = xp_list(cn_data)
xp_en, xp_ur = xp_list(en_data)

# level, color
areas = [
    (70, (191, 191, 191)),
    (80, (127, 127, 255)),
    (90, (191, 127, 255)),
    (99, (255, 127, 255)),
    (100, (255, 63, 255)),
    (105, (255, 255, 127)),
    (110, (255, 223, 127)),
Example #13
0
from azurlane import load_src
import re
import os

stories = {}

story_dir = os.path.join(load_src.src_dir, 'en-US', 'gamecfg', 'story')
ship_skin_srcs = load_src.load_sharecfg('ship_skin_template', key_type=int)
memory_srcs = load_src.load_sharecfg('memory_template', key_type=int)
memory_group_srcs = load_src.load_sharecfg('memory_group', key_type=int)

memory_titles = {}
memory_ids = {}

memory_group_titles = {}

for memory_group in memory_group_srcs.values():
    title = memory_group['title']
    for memory_id in memory_group['memories'].values():
        memory_group_titles[memory_id] = title

for memory in memory_srcs.values():
    chapter_id = memory['story']
    title = memory['title']
    memory_titles[chapter_id] = title
    if memory['id'] in memory_group_titles:
        #print(chapter_id)
        memory_group_titles[chapter_id] = memory_group_titles[memory['id']]

for filename in os.listdir(story_dir):
    m = re.match('(.*[^\d])([\d-]*)\.lua$', filename)
Example #14
0
from azurlane import load_src

resource_srcs = load_src.load_sharecfg('player_resource')
item_srcs = load_src.load_sharecfg('item_data_statistics')
ship_srcs = load_src.load_sharecfg('ship_data_statistics')

def get_reward(reward_id, reward_type):
    if reward_type == 1:
        reward_id = resource_srcs[reward_id]['itemid']
        return item_srcs[reward_id]
    elif reward_type == 2:
        return item_srcs[reward_id]
    elif reward_type == 4:
        return ship_srcs[reward_id]
    elif reward_type == 7:
        return skin_srcs[reward_id]
    else:
        raise ValueError('Unrecognized reward_type ' + reward_type)
Example #15
0
from azurlane import common, load_src

skill_data_srcs = load_src.load_sharecfg('skill_data_template')
skill_display_srcs = load_src.load_sharecfg('skill_data_display')
ship_data_srcs = load_src.load_sharecfg('ship_data_template')
ship_stats_srcs = load_src.load_sharecfg('ship_data_statistics')

# compute skill -> ship
skill_to_ship_names_map = {}

for ship_id, ship_data_src in ship_data_srcs.items():
    if not ship_data_src['buff_list_display']: continue
    for skill_id in ship_data_src['buff_list_display'].values():
        if skill_id not in skill_to_ship_names_map:
            skill_to_ship_names_map[skill_id] = set()
        if 'name' in ship_data_src:
            direct_name = ship_data_src['name']
            skill_to_ship_names_map[skill_id].add(direct_name)
        if ship_id in ship_stats_srcs:
            stats_name = ship_stats_srcs[ship_id]['name']
            skill_to_ship_names_map[skill_id].add(stats_name)


def get_last_effects(skill_id):
    try:
        skill_src = load_src.load_skill(skill_id)
    except FileNotFoundError:
        return None
    last_index = 0
    while last_index + 1 in skill_src:
        last_index += 1
Example #16
0
from azurlane import load_src

event_srcs = load_src.load_sharecfg('guild_base_event')

result = '{| class = "wikitable sortable"\n'
result += '! Event !! Operation !! Max duration (h) !! Nodes !! Bonuses \n'

operation_names = [
    'Pacific Base Patrol',
    'Northern Shipping Escort',
    'Peninsular Raid',
    'Solomon Air-Sea Battle',
]

for event_src in event_srcs.values():
    op_id = event_src['id'] // 1000 - 1
    event_src['op_name'] = operation_names[op_id]
    event_src['max_duration'] = event_src['workload'] / event_src[
        'base_point'] / 3600.0
    bonuses = [
        event_src['ship_camp_display'], event_src['ship_type_display'],
        event_src['extra_squadron_display']
    ]
    event_src['bonuses'] = '<br/>'.join(bonus for bonus in bonuses
                                        if len(bonus) >= 10)
    result += '|-\n'
    result += '| %(name)s || %(op_name)s || %(max_duration).1f || %(node_num)d || %(bonuses)s \n' % event_src

result += '|}\n'

print(result)
Example #17
0
from azurlane import common, load_src

fleet_tech_ship_src = load_src.load_sharecfg('fleet_tech_ship_template',
                                             key_type=int)
ship_data_src = load_src.load_sharecfg('ship_data_statistics', key_type=int)

ship_type_groups = [
    ['DD'],
    ['CL'],
    ['CA', 'BM', 'CB'],
    ['BB', 'BC', 'BBV'],
    ['CV', 'CVL'],
    ['AR'],
    ['AE'],
    ['SS', 'SSV'],
]

ship_type_group_map = {}

for ship_type_group in ship_type_groups:
    for ship_type in ship_type_group:
        ship_type_group_map[ship_type] = ship_type_group[0]


class Ship():
    def __init__(self, fleet_tech_ship, ship_data):
        self.points_collect = fleet_tech_ship['pt_get']
        self.points_lb = fleet_tech_ship['pt_upgrage']
        self.points_120 = fleet_tech_ship['pt_level']

        self.bonus_type_collect = common.attributes[