Skip to content

Commit

Permalink
feat: Epitaph Road
Browse files Browse the repository at this point in the history
Added support for Epitaph Road endgame content.
  • Loading branch information
pacampbell committed Nov 10, 2024
1 parent 59caba9 commit ad2777a
Show file tree
Hide file tree
Showing 136 changed files with 76,905 additions and 81,674 deletions.
10 changes: 10 additions & 0 deletions Arrowgene.Ddon.Database/Arrowgene.Ddon.Database.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,18 @@
<TargetPath>Files\%(RecursiveDir)%(Filename)%(Extension)</TargetPath>
</ContentWithTargetPath>
</ItemGroup>

<ItemGroup>
<ContentWithTargetPath Remove="files\database\script\migration_epitaph_road.sql" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Arrowgene.Ddon.Shared\Arrowgene.Ddon.Shared.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="Files\Database\Script\migration_epitaph_road.sql">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Arrowgene.Ddon.Database/DdonDatabaseBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static class DdonDatabaseBuilder
private static readonly ILogger Logger = LogProvider.Logger<Logger>(typeof(DdonDatabaseBuilder));
private const string DefaultSchemaFile = "Script/schema_sqlite.sql";

public const uint Version = 23;
public const uint Version = 24;

public static IDatabase Build(DatabaseSetting settings)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE ddon_epitaph_road_unlocks (
"character_id" INTEGER NOT NULL,
"epitaph_id" INTEGER NOT NULL,
CONSTRAINT "pk_ddon_epitaph_road_unlocks" PRIMARY KEY ("character_id", "epitaph_id"),
CONSTRAINT "fk_ddon_epitaph_road_unlocks_character_id" FOREIGN KEY ("character_id") REFERENCES "ddon_character"("character_id") ON DELETE CASCADE
);
Original file line number Diff line number Diff line change
Expand Up @@ -750,3 +750,10 @@ CREATE TABLE IF NOT EXISTS "ddon_clan_membership"
CONSTRAINT "fk_ddon_clan_membership_character_id" FOREIGN KEY ("character_id") REFERENCES "ddon_character" ("character_id") ON DELETE CASCADE,
CONSTRAINT "fk_ddon_clan_membership_clan_id" FOREIGN KEY ("clan_id") REFERENCES "ddon_clan_param" ("clan_id") ON DELETE CASCADE
);

CREATE TABLE IF NOT EXISTS "ddon_epitaph_road_unlocks" (
"character_id" INTEGER NOT NULL,
"epitaph_id" INTEGER NOT NULL,
CONSTRAINT "pk_ddon_epitaph_road_unlocks" PRIMARY KEY ("character_id", "epitaph_id"),
CONSTRAINT "fk_ddon_epitaph_road_unlocks_character_id" FOREIGN KEY ("character_id") REFERENCES "ddon_character"("character_id") ON DELETE CASCADE
);
4 changes: 4 additions & 0 deletions Arrowgene.Ddon.Database/IDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -578,5 +578,9 @@ bool InsertBBMContentTreasure(
List<CDataClanMemberInfo> GetClanMemberList(uint clanId, DbConnection? connectionIn = null);
CDataClanMemberInfo GetClanMember(uint characterId, DbConnection? connectionIn = null);
bool UpdateClanMember(CDataClanMemberInfo memberInfo, uint clanId, DbConnection? connectionIn = null);

// Epitaph Road
bool InsertEpitahRoadUnlock(uint characterId, uint epitaphId, DbConnection? connectionIn = null);
List<uint> GetEpitahRoadUnlocks(uint characterId, DbConnection? connectionIn = null);
}
}
53 changes: 53 additions & 0 deletions Arrowgene.Ddon.Database/Sql/Core/DdonSqlDbEpitaphRoadUnlocks.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System.Collections.Generic;
using System.Data.Common;

namespace Arrowgene.Ddon.Database.Sql.Core
{
public abstract partial class DdonSqlDb<TCon, TCom, TReader> : SqlDb<TCon, TCom, TReader>
where TCon : DbConnection
where TCom : DbCommand
where TReader : DbDataReader
{
/* ddon_epitaph_road_unlocks */
protected static readonly string[] EpitaphRoadUnlocksFields = new string[]
{
"character_id", "epitaph_id"
};

private readonly string SqlSelectEpitaphUnlocks = $"SELECT {BuildQueryField(EpitaphRoadUnlocksFields)} FROM \"ddon_epitaph_road_unlocks\" WHERE \"character_id\"=@character_id;";
private readonly string SqlInsertEpitaphUnlocks = $"INSERT INTO \"ddon_epitaph_road_unlocks\" ({BuildQueryField(EpitaphRoadUnlocksFields)}) VALUES ({BuildQueryInsert(EpitaphRoadUnlocksFields)});";

public bool InsertEpitahRoadUnlock(uint characterId, uint epitaphId, DbConnection? connectionIn = null)
{
using TCon connection = OpenNewConnection();
return ExecuteNonQuery(connection, SqlInsertEpitaphUnlocks, command =>
{
AddParameter(command, "character_id", characterId);
AddParameter(command, "epitaph_id", epitaphId);
}) == 1;
}

public List<uint> GetEpitahRoadUnlocks(uint characterId, DbConnection? connectionIn = null)
{
using TCon connection = OpenNewConnection();

var results = new List<uint>();

ExecuteInTransaction(connection =>
{
ExecuteReader(connection, SqlSelectEpitaphUnlocks, command =>
{
AddParameter(command, "character_id", characterId);
}, reader =>
{
while (reader.Read())
{
results.Add(GetUInt32(reader, "epitaph_id"));
}
});
});

return results;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Data.Common;

namespace Arrowgene.Ddon.Database.Sql.Core.Migration
{
public class EpitaphRoadMigration : IMigrationStrategy
{
public uint From => 23;
public uint To => 24;

private readonly DatabaseSetting DatabaseSetting;

public EpitaphRoadMigration(DatabaseSetting databaseSetting)
{
DatabaseSetting = databaseSetting;
}

public bool Migrate(IDatabase db, DbConnection conn)
{
string adaptedSchema = DdonDatabaseBuilder.GetAdaptedSchema(DatabaseSetting, "Script/migration_epitaph_road.sql");
db.Execute(conn, adaptedSchema);
return true;
}
}
}
8 changes: 6 additions & 2 deletions Arrowgene.Ddon.GameServer/Characters/BonusDungeonManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ public void StartDungeon(PartyGroup party)
}

var dungeonId = _ContentId[party.Id];
var dungeonInfo = _BonusDungeonAsset.DungeonInfo[dungeonId];
if (!_BonusDungeonAsset.DungeonInfo.ContainsKey(dungeonId))
{
return;
}

var dungeonInfo = _BonusDungeonAsset.DungeonInfo[dungeonId];
foreach (var memberClient in party.Clients)
{
var itemUpdateList = new List<CDataItemUpdateResult>();
Expand All @@ -57,7 +61,7 @@ public void StartDungeon(PartyGroup party)

EndPartyReadyCheck(party);

var ntc = new S2CStageTicketDungeonStartNtc()
var ntc = new S2CStageDungeonStartNtc()
{
Unk0 = dungeonId,
StageId = dungeonInfo.StageId,
Expand Down
2 changes: 2 additions & 0 deletions Arrowgene.Ddon.GameServer/Characters/CharacterManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public Character SelectCharacter(uint characterId)
return null;
}

character.EpitaphRoadState.UnlockedContent = _Server.Database.GetEpitahRoadUnlocks(character.CharacterId);

UpdateCharacterExtendedParams(character);

SelectPawns(character);
Expand Down
Loading

0 comments on commit ad2777a

Please sign in to comment.