Skip to content

Commit

Permalink
0.7.0 FF13
Browse files Browse the repository at this point in the history
  • Loading branch information
bartz24games@gmail.com committed Jun 5, 2022
1 parent bf99fca commit 76db02f
Show file tree
Hide file tree
Showing 95 changed files with 4,591 additions and 71 deletions.
6 changes: 4 additions & 2 deletions Bartz24.Docs/Components/HTMLPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ protected HtmlDocument GetMainDocument(string mainFolder)
return doc;
}

public void Generate(string fileName, string mainFolder)
public void Generate(string fileName, string mainFolder, Docs docs)
{
HtmlDocument doc = GetMainDocument(mainFolder);

new Header(docs.Pages.ToDictionary(p => p.Key, p => p.Value.Name), docs.Settings.Name, "common/header.html", mainFolder).Generate().ForEach(n => doc.GetBody().AppendChild(n));
GenerateContent(doc);
doc.Save(fileName);
}
Expand All @@ -44,7 +46,7 @@ protected virtual void GenerateContent(HtmlDocument doc)
HtmlNode title = doc.GetHead().SelectSingleNode("//title");
title.InnerHtml = HtmlDocument.HtmlEncode(Name);

HtmlNode contentNode = doc.DocumentNode.SelectSingleNode(".//*[contains(concat(\" \",normalize-space(@class),\" \"),\"tm-content\")]");
HtmlNode contentNode = doc.DocumentNode.SelectSingleNode("//div[contains(@class, 'container')]");
HTMLElements.ForEach(e => e.Generate().ForEach(n => contentNode.AppendChild(n)));
}
}
Expand Down
28 changes: 21 additions & 7 deletions Bartz24.Docs/Components/Header.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bartz24.Docs
{
public class Header : HTMLPage
public class Header : HTMLElement
{
private Dictionary<string, string> Links { get; }
private string DocsName { get; }
public Header(Dictionary<string, string> links, string docsName, string templateFileName) : base("Header", templateFileName)
private string TemplateFileName { get; }
private string MainFolder { get; }
public Header(Dictionary<string, string> links, string docsName, string templateFileName, string mainFolder) : base("Header", null)
{
Links = links;
DocsName = docsName;
TemplateFileName = templateFileName;
MainFolder = mainFolder;
}

protected override void GenerateContent(HtmlDocument doc)
public override List<HtmlNode> Generate()
{
HtmlNode navUlNode = doc.DocumentNode.SelectSingleNode(".//*[contains(concat(\" \",normalize-space(@class),\" \"),\"tm-nav\")]/ul");
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(File.ReadAllText(MainFolder + "/" + TemplateFileName));
HtmlNode node = doc.DocumentNode.FirstChild;
GenerateContent(node);
return new List<HtmlNode>() { node };
}

protected override void GenerateContent(HtmlNode node)
{
HtmlNode navUlNode = node.OwnerDocument.DocumentNode.SelectSingleNode(".//*[contains(concat(\" \",normalize-space(@class),\" \"),\"navbar-nav\")]");
foreach (string key in Links.Keys)
{
HtmlNode node = HtmlNode.CreateNode($"<li><a href = \"../{key + ".html"}\", target = \"_top\">{Links[key]}</a></li>");
navUlNode.AppendChild(node);
HtmlNode nav = HtmlNode.CreateNode($"<a class=\"nav-link\" href = \"{key + ".html"}\">{Links[key]}</a>");
navUlNode.AppendChild(nav);
}
HtmlNode nameNode = doc.DocumentNode.SelectSingleNode(".//*[contains(concat(\" \",normalize-space(@class),\" \"),\"tm-name\")]");
HtmlNode nameNode = node.OwnerDocument.DocumentNode.SelectSingleNode(".//*[contains(concat(\" \",normalize-space(@class),\" \"),\"navbar-brand\")]");
nameNode.InnerHtml = HtmlDocument.HtmlEncode(DocsName);

}
Expand Down
2 changes: 2 additions & 0 deletions Bartz24.Docs/Components/Table.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public override List<HtmlNode> Generate()

protected override void GenerateContent(HtmlNode node)
{
"table table-sm table-dark table-hover align-middle".Split(" ").ToList().ForEach(c => node.AddClass(c));

HtmlNode colgroup = HtmlNode.CreateNode("<colgroup></colgroup>");
foreach (int width in ColumnWidths)
{
Expand Down
6 changes: 2 additions & 4 deletions Bartz24.Docs/Docs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Bartz24.Docs
public class Docs
{
public DocsSettings Settings { get; set; } = new DocsSettings();
private Dictionary<string, HTMLPage> Pages { get; } = new Dictionary<string, HTMLPage>();
public Dictionary<string, HTMLPage> Pages { get; } = new Dictionary<string, HTMLPage>();

public void AddPage(string path, HTMLPage page)
{
Expand All @@ -25,11 +25,9 @@ public void Generate(string mainFolder, string templateFolder)

CopyFromTemplate(mainFolder, templateFolder);

Pages.Add("common/header", new Header(Pages.ToDictionary(p => p.Key, p => p.Value.Name), Settings.Name, "common/header.html"));

foreach (string path in Pages.Keys)
{
Pages[path].Generate(mainFolder + "/" + path + ".html", mainFolder);
Pages[path].Generate(mainFolder + "/" + path + ".html", mainFolder, this);
}

DeleteTemplateFiles(mainFolder);
Expand Down
11 changes: 11 additions & 0 deletions Bartz24.FF13Series/Bartz24.FF13Series.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Bartz24.Data\Bartz24.Data.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
using Bartz24.Data;
using System;
using System.Data;
using System.Data.SQLite;
using System.Linq;
using Dapper;
using System.Collections.Generic;
using System.Reflection;
using System.IO;
using System.Text.RegularExpressions;

namespace Bartz24.FF13_2LR
namespace Bartz24.FF13Series
{
public class DataStoreZTRText
{
Expand Down
14 changes: 0 additions & 14 deletions FF12Rando/Data/FF12ItemLocation.cs

This file was deleted.

4 changes: 2 additions & 2 deletions FF12Rando/Logic/FF12AssumedItemPlacementAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

namespace FF12Rando
{
public class FF12AssumedItemPlacementAlgorithm : AssumedItemPlacementAlgorithm<FF12ItemLocation>
public class FF12AssumedItemPlacementAlgorithm : AssumedItemPlacementAlgorithm<ItemLocation>
{
TreasureRando treasureRando;

Dictionary<string, int> AreaDepths = new Dictionary<string, int>();

public FF12AssumedItemPlacementAlgorithm(Dictionary<string, FF12ItemLocation> itemLocations, List<string> hintsByLocations, RandomizerManager randomizers, int maxFail) : base(itemLocations, hintsByLocations, maxFail)
public FF12AssumedItemPlacementAlgorithm(Dictionary<string, ItemLocation> itemLocations, List<string> hintsByLocations, RandomizerManager randomizers, int maxFail) : base(itemLocations, hintsByLocations, maxFail)
{
treasureRando = randomizers.Get<TreasureRando>("Treasures");
}
Expand Down
4 changes: 2 additions & 2 deletions FF12Rando/Logic/FF12ItemPlacementAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

namespace FF12Rando
{
public class FF12ItemPlacementAlgorithm : ItemPlacementAlgorithm<FF12ItemLocation>
public class FF12ItemPlacementAlgorithm : ItemPlacementAlgorithm<ItemLocation>
{
TreasureRando treasureRando;

Dictionary<string, int> AreaDepths = new Dictionary<string, int>();

public FF12ItemPlacementAlgorithm(Dictionary<string, FF12ItemLocation> itemLocations, List<string> hintsByLocations, RandomizerManager randomizers, int maxFail) : base(itemLocations, hintsByLocations, maxFail)
public FF12ItemPlacementAlgorithm(Dictionary<string, ItemLocation> itemLocations, List<string> hintsByLocations, RandomizerManager randomizers, int maxFail) : base(itemLocations, hintsByLocations, maxFail)
{
treasureRando = randomizers.Get<TreasureRando>("Treasures");
}
Expand Down
8 changes: 4 additions & 4 deletions FF12Rando/Randos/TreasureRando.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ public class TreasureRando : Randomizer
public List<List<string>> hints = Enumerable.Range(0, 35).Select(_ => new List<string>()).ToList();

public Dictionary<string, string> areaMapping = new Dictionary<string, string>();
Dictionary<string, FF12ItemLocation> itemLocations = new Dictionary<string, FF12ItemLocation>();
Dictionary<string, ItemLocation> itemLocations = new Dictionary<string, ItemLocation>();
public Dictionary<string, string> missableTreasureLinks = new Dictionary<string, string>();

FF12AssumedItemPlacementAlgorithm placementAlgo;
FF12ItemPlacementAlgorithm placementAlgoBackup;
private bool usingBackup = false;
public ItemPlacementAlgorithm<FF12ItemLocation> PlacementAlgo { get => usingBackup ? placementAlgoBackup : placementAlgo; }
public ItemPlacementAlgorithm<ItemLocation> PlacementAlgo { get => usingBackup ? placementAlgoBackup : placementAlgo; }

public List<string> treasuresToPlace = new List<string>();
public List<string> treasuresAllowed = new List<string>();
Expand Down Expand Up @@ -652,7 +652,7 @@ private string GetTreasureDisplay(DataStoreTreasure treasure, bool hintableOnly
return String.Join(", ", stringList);
}

public class TreasureData : FF12ItemLocation
public class TreasureData : ItemLocation
{
public override string ID { get; }
public int Index { get; }
Expand Down Expand Up @@ -718,7 +718,7 @@ public override void SetData(dynamic obj, string newItem, int newCount)
}
}

public class RewardData : FF12ItemLocation
public class RewardData : ItemLocation
{
public override string ID { get; }
public int IntID { get; }
Expand Down
11 changes: 11 additions & 0 deletions FF13/Bartz24.FF13.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Bartz24.Data\Bartz24.Data.csproj" />
</ItemGroup>

</Project>
30 changes: 30 additions & 0 deletions FF13/DataStoreBtCharaSpec.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Bartz24.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bartz24.FF13
{
public class DataStoreBtCharaSpec : DataStoreWDBEntry
{
public uint sDropItem0_pointer
{
get { return Data.ReadUInt(0xF0); }
set { Data.SetUInt(0xF0, value); }
}
public string sDropItem0_string { get; set; }
public uint sDropItem1_pointer
{
get { return Data.ReadUInt(0xF4); }
set { Data.SetUInt(0xF4, value); }
}
public string sDropItem1_string { get; set; }

public override int GetDefaultLength()
{
return 0x168;
}
}
}
24 changes: 24 additions & 0 deletions FF13/DataStoreBtScene.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Bartz24.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bartz24.FF13
{
public class DataStoreBtScene : DataStoreWDBEntry
{
public uint sDrop100Id_pointer
{
get { return Data.ReadUInt(0x34); }
set { Data.SetUInt(0x34, value); }
}
public string sDrop100Id_string { get; set; }

public override int GetDefaultLength()
{
return 0x60;
}
}
}
96 changes: 96 additions & 0 deletions FF13/DataStoreCrystarium.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
using Bartz24.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bartz24.FF13
{
public enum CrystariumType : byte
{
HP = 1,
Strength = 2,
Magic = 3,
Accessory = 4,
ATBLevel = 5,
Ability = 6,
RoleLevel = 7,
Unknown = 0
}

public enum Role : byte
{
None = 0,
Commando = 2,
Ravager = 3,
Sentinel = 1,
Synergist = 4,
Medic = 6,
Saboteur = 5
}
public class DataStoreCrystarium : DataStoreWDBEntry
{
public uint iCPCost
{
get { return Data.ReadUInt(0x0); }
set { Data.SetUInt(0x0, value); }
}

public string sAbility_string { get; set; }

public uint sAbility_pointer
{
get { return Data.ReadUInt(0x4); }
set { Data.SetUInt(0x4, value); }
}

public ushort iValue
{
get { return Data.ReadUShort(0x8); }
set { Data.SetUShort(0x8, value); }
}

public CrystariumType iType
{
get { return (CrystariumType)Data.ReadByte(0xA); }
set { Data.SetByte(0xA, (byte)value); }
}

public byte iStage
{
get { return (byte)(Data.ReadByte(0xB) / 0x10); }
set { Data.SetByte(0xB, (byte)(value * 0x10 + (byte)iRole)); }
}

public Role iRole
{
get { return (Role)(Data.ReadByte(0xB) % 0x10); }
set { Data.SetByte(0xB, (byte)(iStage * 0x10 + (byte)value)); }
}

public override int GetDefaultLength()
{
return 0xC;
}

public void SwapStats(DataStoreCrystarium other)
{
CrystariumType type = other.iType;
ushort value = other.iValue;
other.iType = this.iType;
other.iValue = this.iValue;
this.iType = type;
this.iValue = value;
}

public void SwapStatsAbilities(DataStoreCrystarium other)
{
SwapStats(other);

string abilityName = other.sAbility_string;
other.sAbility_string = this.sAbility_string;
this.sAbility_string = abilityName;
}
}
}
Loading

0 comments on commit 76db02f

Please sign in to comment.