mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 15:39:26 +08:00
add: add python implementation for gg factor
This commit is contained in:
@@ -111,7 +111,8 @@
|
||||
"NoEmotionWarning": false
|
||||
},
|
||||
"ShipProperty": {
|
||||
"Enable": false,
|
||||
"Method": "disable",
|
||||
"Factor": 1.0,
|
||||
"Armor": -1,
|
||||
"Speed": -1,
|
||||
"AntiAircraft": -1,
|
||||
|
||||
@@ -548,9 +548,18 @@
|
||||
}
|
||||
},
|
||||
"ShipProperty": {
|
||||
"Enable": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
"Method": {
|
||||
"type": "select",
|
||||
"value": "disable",
|
||||
"option": [
|
||||
"disable",
|
||||
"gg_factor",
|
||||
"final_properties"
|
||||
]
|
||||
},
|
||||
"Factor": {
|
||||
"type": "input",
|
||||
"value": 1.0
|
||||
},
|
||||
"Armor": {
|
||||
"type": "input",
|
||||
|
||||
@@ -166,7 +166,10 @@ HookGeneral:
|
||||
value: ""
|
||||
type: textarea
|
||||
ShipProperty:
|
||||
Enable: false
|
||||
Method:
|
||||
value: disable
|
||||
option: [ disable, gg_factor, final_properties ]
|
||||
Factor: 1.0
|
||||
Armor: -1
|
||||
Speed: -1
|
||||
AntiAircraft: -1
|
||||
|
||||
@@ -87,7 +87,8 @@ class GeneratedConfig:
|
||||
HookGeneral_GameLibDir = None
|
||||
|
||||
# Group `ShipProperty`
|
||||
ShipProperty_Enable = False
|
||||
ShipProperty_Method = 'disable' # disable, gg_factor, final_properties
|
||||
ShipProperty_Factor = 1.0
|
||||
ShipProperty_Armor = -1
|
||||
ShipProperty_Speed = -1
|
||||
ShipProperty_AntiAircraft = -1
|
||||
|
||||
@@ -769,9 +769,16 @@
|
||||
"name": "ShipProperty._info.name",
|
||||
"help": "ShipProperty._info.help"
|
||||
},
|
||||
"Enable": {
|
||||
"name": "ShipProperty.Enable.name",
|
||||
"help": "ShipProperty.Enable.help"
|
||||
"Method": {
|
||||
"name": "ShipProperty.Method.name",
|
||||
"help": "ShipProperty.Method.help",
|
||||
"disable": "disable",
|
||||
"gg_factor": "gg_factor",
|
||||
"final_properties": "final_properties"
|
||||
},
|
||||
"Factor": {
|
||||
"name": "ShipProperty.Factor.name",
|
||||
"help": "ShipProperty.Factor.help"
|
||||
},
|
||||
"Armor": {
|
||||
"name": "ShipProperty.Armor.name",
|
||||
|
||||
@@ -769,9 +769,16 @@
|
||||
"name": "ShipProperty._info.name",
|
||||
"help": "ShipProperty._info.help"
|
||||
},
|
||||
"Enable": {
|
||||
"name": "ShipProperty.Enable.name",
|
||||
"help": "ShipProperty.Enable.help"
|
||||
"Method": {
|
||||
"name": "ShipProperty.Method.name",
|
||||
"help": "ShipProperty.Method.help",
|
||||
"disable": "disable",
|
||||
"gg_factor": "gg_factor",
|
||||
"final_properties": "final_properties"
|
||||
},
|
||||
"Factor": {
|
||||
"name": "ShipProperty.Factor.name",
|
||||
"help": "ShipProperty.Factor.help"
|
||||
},
|
||||
"Armor": {
|
||||
"name": "ShipProperty.Armor.name",
|
||||
|
||||
@@ -769,9 +769,16 @@
|
||||
"name": "修改舰船属性",
|
||||
"help": "该功能下所有的属性设置均为-1表示不修改该属性,默认为-1"
|
||||
},
|
||||
"Enable": {
|
||||
"name": "启用",
|
||||
"help": ""
|
||||
"Method": {
|
||||
"name": "修改方式",
|
||||
"help": "",
|
||||
"disable": "不使用",
|
||||
"gg_factor": "GG倍率",
|
||||
"final_properties": "修改最终属性"
|
||||
},
|
||||
"Factor": {
|
||||
"name": "倍率",
|
||||
"help": "可以是小数,默认为1.0,表示不修改"
|
||||
},
|
||||
"Armor": {
|
||||
"name": "装甲类型",
|
||||
|
||||
@@ -769,9 +769,16 @@
|
||||
"name": "ShipProperty._info.name",
|
||||
"help": "ShipProperty._info.help"
|
||||
},
|
||||
"Enable": {
|
||||
"name": "ShipProperty.Enable.name",
|
||||
"help": "ShipProperty.Enable.help"
|
||||
"Method": {
|
||||
"name": "ShipProperty.Method.name",
|
||||
"help": "ShipProperty.Method.help",
|
||||
"disable": "disable",
|
||||
"gg_factor": "gg_factor",
|
||||
"final_properties": "final_properties"
|
||||
},
|
||||
"Factor": {
|
||||
"name": "ShipProperty.Factor.name",
|
||||
"help": "ShipProperty.Factor.help"
|
||||
},
|
||||
"Armor": {
|
||||
"name": "ShipProperty.Armor.name",
|
||||
|
||||
@@ -29,6 +29,23 @@ ALL_ENABLE_OPS = [
|
||||
CrackOp.EnableGGFactor,
|
||||
]
|
||||
|
||||
REMOTE_PORT = 23897
|
||||
|
||||
|
||||
class Cracker(CrackApi):
|
||||
def __init__(self, config: AzurLaneConfig, device: Device):
|
||||
self.config = config
|
||||
self.device = device
|
||||
super().__init__(f"http://127.0.0.1:{device.adb.forward_port(REMOTE_PORT)}")
|
||||
|
||||
|
||||
def fix_Hook_ShipProperty_config(config: AzurLaneConfig):
|
||||
enable = deep_get(config.data, "Hook.ShipProperty.Enable", False)
|
||||
if not enable:
|
||||
return
|
||||
else:
|
||||
config.modified["Hook.ShipProperty.Method"] = "final_properties"
|
||||
|
||||
|
||||
def do_crack_op(config: AzurLaneConfig, device: Device, ops: Union[Type[CrackOp.Op], List[Type[CrackOp.Op]]]):
|
||||
if not deep_get(config.data, "Hook.HookGeneral.Enable", False):
|
||||
@@ -41,13 +58,14 @@ def do_crack_op(config: AzurLaneConfig, device: Device, ops: Union[Type[CrackOp.
|
||||
else:
|
||||
l = [ops]
|
||||
|
||||
base_url = f"http://127.0.0.1:{device.adb.forward_port(23897)}"
|
||||
base_url = f"http://127.0.0.1:{device.adb.forward_port(REMOTE_PORT)}"
|
||||
api = CrackApi(base_url)
|
||||
for op in l:
|
||||
if op == CrackOp.DisableAll:
|
||||
api.disable_all()
|
||||
elif op == CrackOp.EnableGlobalShipProperties:
|
||||
if not deep_get(config.data, "Hook.ShipProperty.Enable", False):
|
||||
fix_Hook_ShipProperty_config(config)
|
||||
if deep_get(config.data, "Hook.ShipProperty.Method", "disable") != "final_properties":
|
||||
continue
|
||||
api.update_global_ship_properties(
|
||||
CrackApi.ShipProperties(
|
||||
@@ -132,9 +150,12 @@ def do_crack_op(config: AzurLaneConfig, device: Device, ops: Union[Type[CrackOp.
|
||||
elif op == CrackOp.DisableOpsiFastMove:
|
||||
api.disable_opsi_fast_move()
|
||||
elif op == CrackOp.EnableGGFactor:
|
||||
...
|
||||
if deep_get(config.data, "Hook.ShipProperty.Method", "disable") != "gg_factor":
|
||||
continue
|
||||
api.update_gg_factor(deep_get(config.data, "Hook.ShipProperty.Factor", 1.0))
|
||||
api.enable_gg_factor()
|
||||
elif op == CrackOp.DisableGGFactor:
|
||||
...
|
||||
api.disable_gg_factor()
|
||||
else:
|
||||
raise ValueError(f"Unknown op: {op}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user