-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1116 from kareking1/master
Proper pull request for LVPM listpatch
- Loading branch information
Showing
6 changed files
with
213 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,36 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Xe.BinaryMapper; | ||
|
||
namespace OpenKh.Kh2.Battle | ||
{ | ||
public class Lvpm | ||
{ | ||
public ushort HpMultiplier { get; set; } // (Hp * HpMultiplier + 99) / 100 | ||
public ushort Strength { get; set; } | ||
public ushort Defense { get; set; } | ||
public ushort MaxStrength { get; set; } | ||
public ushort MinStrength { get; set; } | ||
public ushort Experience { get; set; } | ||
[Data] public ushort HpMultiplier { get; set; } // (Hp * HpMultiplier + 99) / 100 | ||
[Data] public ushort Strength { get; set; } | ||
[Data] public ushort Defense { get; set; } | ||
[Data] public ushort MaxStrength { get; set; } | ||
[Data] public ushort MinStrength { get; set; } | ||
[Data] public ushort Experience { get; set; } | ||
|
||
public static List<Lvpm> Read(Stream stream) => BaseTable<Lvpm>.Read(stream); | ||
//Default | ||
public static List<Lvpm> Read(Stream stream) => BaseList<Lvpm>.Read(stream, 99); | ||
|
||
public static void Write(Stream stream, IEnumerable<Lvpm> items) => | ||
BaseTable<Lvpm>.Write(stream, 2, items); | ||
//Override for having a custom amount of entries | ||
public static List<Lvpm> Read(Stream stream, int count) => BaseList<Lvpm>.Read(stream, count); | ||
|
||
public static void Write(Stream stream, IEnumerable<Lvpm> items) => BaseList<Lvpm>.Write(stream, items); | ||
|
||
public Lvpm() { } | ||
|
||
public Lvpm(ushort HP, ushort Str, ushort Def, ushort MaxStr, ushort MinStr, ushort Exp) | ||
{ | ||
HpMultiplier = HP; | ||
Strength = Str; | ||
Defense = Def; | ||
MaxStrength = MaxStr; | ||
MinStrength = MinStr; | ||
Experience = Exp; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace OpenKh.Kh2.Battle | ||
{ | ||
public class LvpmHelper | ||
{ | ||
public ushort Level { get; set; } //Dummy ID to make lvpm listpatchable | ||
public ushort HpMultiplier { get; set; } // (Hp * HpMultiplier + 99) / 100 | ||
public ushort Strength { get; set; } | ||
public ushort Defense { get; set; } | ||
public ushort MaxStrength { get; set; } | ||
public ushort MinStrength { get; set; } | ||
public ushort Experience { get; set; } | ||
|
||
public LvpmHelper() { } | ||
|
||
public LvpmHelper(ushort level, ushort hpMultiplier, ushort strength, ushort defense, ushort maxStrength, ushort minStrength, ushort experience) | ||
{ | ||
Level = level; | ||
HpMultiplier = hpMultiplier; | ||
Strength = strength; | ||
Defense = defense; | ||
MaxStrength = maxStrength; | ||
MinStrength = minStrength; | ||
Experience = experience; | ||
} | ||
|
||
public static Lvpm ConvertLvpmHelperToLvpm(LvpmHelper lvl) | ||
{ | ||
return new Lvpm(lvl.HpMultiplier, lvl.Strength, lvl.Defense, lvl.MaxStrength, lvl.MinStrength, lvl.Experience); | ||
} | ||
|
||
public static List<LvpmHelper> ConvertLvpmListToHelper(List<Lvpm> lvpmList) | ||
{ | ||
ushort Id = 0; | ||
var helperList = new List<LvpmHelper>(); | ||
foreach (var lvpm in lvpmList) | ||
{ | ||
helperList.Add(new LvpmHelper(Id, lvpm.HpMultiplier, lvpm.Strength, lvpm.Defense, lvpm.MaxStrength, lvpm.MinStrength, lvpm.Experience)); | ||
Id++; | ||
} | ||
return helperList; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters