...
 
Commits (2)
......@@ -8,7 +8,7 @@ from list_diff import clean_diff
from load import load_char
output_path = "C:/Users/WydD/Desktop/export/"
output_path = "result/"
char_path = "D:/Steam/SteamApps/common/StreetFighterV/StreetFighterV/Content/Paks/moves/StreetFighterV/Content/Chara"
chars = sorted(a for a in os.listdir(char_path) if a != "NDK")
versions = {re.sub("s([0-9\.]*)-.*","\\1", version): {line[:3]: line[4:] for line in open("../sfv-simulator/versions/"+version).read().strip().split("\n")} for version in os.listdir("../sfv-simulator/versions") if version[-3:] == "txt"}
......
......@@ -70,7 +70,7 @@ def parse_autocancel_condition(data):
def transform_autocancel(data):
res = transform_time_element(data)
res["Script"] = "Self" if data["MoveIndex"] < 0 else data["MoveIndex"]
if data["Unknown2"] == 0:
if (data["Unknown2"] & 2) == 0:
res["ScriptTime"] = data["Unknown1"]
condition, params = parse_autocancel_condition(data)
res["Condition"] = condition
......
......@@ -34,6 +34,7 @@ def transform_hitbox_effect(data):
"KnockdownDuration": data["Index17"],
"KnockBack": data["KnockBack"],
"FallSpeed": data["FallSpeed"],
"JuggleStart": data["Index18"] & 0xFF,
"DamageScalingGroup": data["Index19"] if data["Index19"] != 0 else None
}
unk = dict()
......@@ -41,8 +42,8 @@ def transform_hitbox_effect(data):
unk["HitStunFramesAttacker_HI"] = data["HitStunFramesAttacker"] >> 8
if data["HitStunFramesDefender"] >> 8:
unk["HitStunFramesDefender_HI"] = data["HitStunFramesDefender"] >> 8
if data["Index18"]:
unk["Index18"] = read_flags(data["Index18"])
if data["Index18"] >> 8:
unk["Index18_HI"] = read_flags(data["Index18"] >> 8)
if data["Index9"]:
unk["Index9"] = data["Index9"]
if data["Index22"]:
......
......@@ -26,7 +26,8 @@ function onTickClick(tick, gridElement) {
$(".grid").removeClass("selected");
gridElement.addClass("selected");
$(".box").hide();
location.hash = "#"+ (tick+1);
var baseUrl = window.location.href.split('#')[0];
window.location.replace( baseUrl + "#"+ (tick+1) );
$("#submenu .dropdown-menu a").each(function(i, e) {
$(e).attr("href", $(e).attr("href").replace(/#.*/, "") + "#"+(tick+1));
});
......@@ -110,6 +111,7 @@ $(".timeline").on("click", function(e) {
$("#" + targetBox+"-old").addClass("selected");
}
});
$(".property").on("click", function(e) { e.stopPropagation(); });
$(".timeline-container > div").prepend(grid);
$(".unknown").hide();
$(function () {
......
......@@ -118,6 +118,8 @@ def alter_pos(pos, reset_temporary, tick, timeline):
for f in timeline.at(tick):
target = f["Target"]
mode = f["Mode"]
if mode == "Set" and (f["TickEnd"] - f["TickStart"]) > 1:
continue
amount = FLT(f["Amount"])
if target == "Horizontal Speed":
if mode == "Set":
......
......@@ -16,8 +16,8 @@ from view.render.routing import he_path, script_path, move_path
from view.render.script import render_script
from view.render.version_menu import render_version_menu, char_label
output_path = "C:/Users/WydD/Desktop/export/"
# output_path = "result/"
# output_path = "C:/Users/WydD/Desktop/export/"
output_path = "result/"
basepath = "D:/Steam/SteamApps/common/StreetFighterV/StreetFighterV/Content/Paks/moves/StreetFighterV/Content/Chara"
......@@ -54,7 +54,7 @@ def extract_version_map(char_path):
return res
def write_move(menu_data, output, data, diff):
def write_move(zf, menu_data, output, data, diff):
moves_diff = get_from_path(["BCM", "Moves"], diff) or {}
moves = get_from_path(["BCM", "Moves"], data) or {}
input = get_from_path(["BCM", "Inputs"], data) or {}
......@@ -63,22 +63,22 @@ def write_move(menu_data, output, data, diff):
href = move_path(move)
menu_data["path"] = href
rendered = render_move(move, moves_diff.get(k, {}), menu_data, input, charges, data)
with open(output + href, "w", encoding='utf-8') as f:
f.write(rendered)
with zf.open(output + href, "w") as f:
f.write(rendered.encode("utf-8"))
def write_hitbox_effects(menu_data, output, data, diff, path, **kwargs):
def write_hitbox_effects(zf, menu_data, output, data, diff, path, **kwargs):
he_diff = get_from_path(path, diff) or {}
heffects = get_from_path(path, data) or {}
for k, he in heffects.items():
href = he_path(k, **kwargs)
menu_data["path"] = href
rendered = render_hitbox_effect(k, he, he_diff.get(k, {}), menu_data)
with open(output + href, "w", encoding='utf-8') as f:
f.write(rendered)
with zf.open(output + href, "w") as f:
f.write(rendered.encode("utf-8"))
def write_scripts(menu_data, output, data, diff, before, path, **kwargs):
def write_scripts(zf, menu_data, output, data, diff, before, path, **kwargs):
script_diff = get_from_path(path, diff) or {}
scripts = get_from_path(path, data) or {}
old_version = get_from_path(path, before) or {}
......@@ -86,14 +86,15 @@ def write_scripts(menu_data, output, data, diff, before, path, **kwargs):
href = script_path(script, **kwargs)
menu_data["path"] = href
rendered = render_script(script, script_diff.get(k, {}), old_version.get(k), menu_data, data=data, **kwargs)
with open(output + href, "w", encoding='utf-8') as f:
f.write(rendered)
with zf.open(output + href, "w") as f:
f.write(rendered.encode("utf-8"))
def get_output_dir(char, version):
output = output_path + char + "/" + version + "/"
return output
if not os.path.exists(output_path + char):
os.mkdir(output_path + char)
output = output_path + char + "/" + version + "/"
if not os.path.exists(output):
os.mkdir(output)
......@@ -106,7 +107,7 @@ def get_output_dir(char, version):
return output
def write_version(char_path, char_versions, char, version):
def write_version(char_path, char_versions, char, version, zf):
char_version = char_versions[char][version]
data = load_char(char_path, char_version[-1], version)
if char_version[4]:
......@@ -124,46 +125,47 @@ def write_version(char_path, char_versions, char, version):
"char_versions": char_versions[data["char"]],
"path": "index.html"
}
with open(output + "../" + menu_data["path"], "w", encoding='utf-8') as f:
f.write(render("version-selection.html", title="", menu_data=menu_data))
try:
zf.getinfo(output_path + data["char"] + "/" + menu_data["path"])
except KeyError:
with zf.open(output_path + data["char"] + "/" + menu_data["path"], "w") as f:
f.write(render("version-selection.html", title="", menu_data=menu_data).encode("utf-8"))
menu_data["version"] = data["version"]
menu_data["version_label"] = char_versions[data["char"]][data["version"]]
with open(output + menu_data["path"], "w", encoding='utf-8') as f:
f.write(render_version_menu(data, diff, menu_data))
with zf.open(output + menu_data["path"], "w") as f:
f.write(render_version_menu(data, diff, menu_data).encode("utf-8"))
t = time.time()
write_move(menu_data, output, data, diff)
write_move(zf, menu_data, output, data, diff)
t = time.time() - t
print(t, "seconds to write moves")
t = time.time()
write_hitbox_effects(menu_data, output, data, diff, ["BAC", "HitboxEffects"])
write_hitbox_effects(menu_data, output, data, diff, ["BAC_eff", "HitboxEffects"], projectile=True)
write_hitbox_effects(zf, menu_data, output, data, diff, ["BAC", "HitboxEffects"])
write_hitbox_effects(zf, menu_data, output, data, diff, ["BAC_eff", "HitboxEffects"], projectile=True)
t = time.time() - t
print(t, "seconds to write hiteffects")
t = time.time()
write_scripts(menu_data, output, data, diff, before, ["BAC", "Scripts", "Normal"])
write_scripts(menu_data, output, data, diff, before, ["BAC", "Scripts", "Alternate"], alt=True)
write_scripts(menu_data, output, data, diff, before, ["BAC_eff", "Scripts", "Normal"], projectile=True)
write_scripts(zf, menu_data, output, data, diff, before, ["BAC", "Scripts", "Normal"])
write_scripts(zf, menu_data, output, data, diff, before, ["BAC", "Scripts", "Alternate"], alt=True)
write_scripts(zf, menu_data, output, data, diff, before, ["BAC_eff", "Scripts", "Normal"], projectile=True)
t = time.time() - t
print(t, "seconds to write script")
with open(output_path + "index.html", "w", encoding='utf-8') as f:
f.write(render("main.html", title="", menu_data={}, chars=char_label))
version_map = extract_version_map(basepath)
# for version in version_map["CMY"]:
# print(version)
# write_version(basepath, version_map, "SKR", "000")
for char, versions in sorted(version_map.items()):
# if char != "URN":
# continue
for version, version_content in sorted(versions.items()):
# if version != "020":
# continue
print(char, version, version_content)
write_version(basepath, version_map, char, version)
from zipfile36 import ZipFile, ZIP_DEFLATED
with ZipFile("result/dump.zip", "w", compression=ZIP_DEFLATED) as zf:
with zf.open(output_path + "index.html", "w") as f:
f.write(render("main.html", title="", menu_data={}, chars=char_label).encode("utf-8"))
version_map = extract_version_map(basepath)
# for version in version_map["CMY"]:
# print(version)
# write_version(basepath, version_map, "SKR", "000")
for char, versions in sorted(version_map.items()):
for version, version_content in sorted(versions.items()):
print(char, version, version_content)
write_version(basepath, version_map, char, version, zf)
......@@ -4,7 +4,7 @@ from view.render.jinja import render
def render_hitbox_effect(key, hitbox_effect, diff, menu_data):
attributes = [
"Type", "Script", "Flag", "Damage", "Stun", "EXAttacker", "EXDefender", "VGauge",
"HitFreezeAttacker", "HitFreezeDefender", "MainRecoveryDuration", "KnockdownDuration", "KnockBack", "FallSpeed"
"HitFreezeAttacker", "HitFreezeDefender", "MainRecoveryDuration", "KnockdownDuration", "KnockBack", "FallSpeed", "JuggleStart"
]
situations = ["HIT_STAND", "HIT_CROUCH", "HIT_OTG", "HIT_AIR", "COUNTERHIT_STAND", "COUNTERHIT_CROUCH", "COUNTERHIT_OTG",
"COUNTERHIT_AIR", "GUARD_STAND", "GUARD_CROUCH"]
......
......@@ -76,6 +76,8 @@ def label_render(key, path, value, tooltip=False, data=None, **kwargs):
if key == "Script" and type(value) == int:
route, script = get_script_routing(data, value, **kwargs)
return "Script: <a href='../%s'>#%d - %s</a>" % (route, script["Index"], script["Name"])
if key == "ScriptTime":
value += 1
render = render_label.get(path, dict())
label = None
if key in render:
......
......@@ -53,6 +53,7 @@
{%- call(v) row("KnockdownDuration") %}{{ v }}{%- endcall %}
{%- call(v) row("KnockBack") %}{{ v|round(6) }}{%- endcall %}
{%- call(v) row("FallSpeed") %}{{ v|round(6) }}{%- endcall %}
{%- call(v) row("JuggleStart") %}{{ v }}{%- endcall %}
{%- for uk in unknowns %}
{%- call(v) row(uk, "unknown") %}{{ v|round(6) if v is number else v }}{%- endcall %}
{%- endfor %}
......