mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-09 04:24:36 -05:00
Add .X=*Y (property copy) feature
This commit is contained in:
parent
d0f2b6eeb5
commit
3ebf5279cc
|
|
@ -65,6 +65,7 @@ public static class BatchEditing
|
|||
internal const string CONST_SHINY = "$shiny";
|
||||
internal const string CONST_SUGGEST = "$suggest";
|
||||
private const string CONST_BYTES = "$[]";
|
||||
private const string CONST_POINTER = "*";
|
||||
|
||||
internal const string PROP_LEGAL = "Legal";
|
||||
internal const string PROP_TYPENAME = "ObjectType";
|
||||
|
|
@ -360,7 +361,14 @@ private static ModifyResult SetPKMProperty(StringInstruction cmd, BatchInfo info
|
|||
if (!pi.CanWrite)
|
||||
return ModifyResult.Error;
|
||||
|
||||
object val = cmd.Random ? cmd.RandomValue : cmd.PropertyValue;
|
||||
object val;
|
||||
if (cmd.Random)
|
||||
val = cmd.RandomValue;
|
||||
else if (cmd.PropertyValue.StartsWith(CONST_POINTER) && props.TryGetValue(cmd.PropertyValue[1..], out var opi))
|
||||
val = opi.GetValue(pk);
|
||||
else
|
||||
val = cmd.PropertyValue;
|
||||
|
||||
ReflectUtil.SetValue(pi, pk, val);
|
||||
return ModifyResult.Modified;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user