Skip to content

Commit

Permalink
Merge pull request #640 from pacampbell/epitaph_fixes
Browse files Browse the repository at this point in the history
fixes: Fix reported Epitaph Road issues
  • Loading branch information
pacampbell authored Nov 28, 2024
2 parents 2b148dc + 4958f1f commit 174a238
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public override S2CInstanceEnemyKillRes Handle(GameClient client, C2SInstanceEne

if (packet.IsNoBattleReward)
{
return;
queuedPackets.Send();
}

var dropItemNtc = new S2CInstancePopDropItemNtc()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ public override S2CQuestSetPriorityQuestRes Handle(GameClient client, C2SQuestSe
var priorityQuests = Server.Database.GetPriorityQuestScheduleIds(client.Character.CommonId);
foreach (var questScheduleId in priorityQuests)
{
var quest = QuestManager.GetQuestByScheduleId(questScheduleId);
var questStateManager = QuestManager.GetQuestStateManager(client, quest);
var questState = questStateManager.GetQuestState(questScheduleId);
if (!QuestManager.IsQuestEnabled(questScheduleId) || questState is null)
if (!QuestManager.IsQuestEnabled(questScheduleId))
{
Logger.Error(client, $"Priority quest for quest state which doesn't exist or is not enabled, schedule {questScheduleId}");
Server.Database.DeletePriorityQuest(client.Character.CommonId, questScheduleId);
continue;
}

var quest = QuestManager.GetQuestByScheduleId(questScheduleId);
var questStateManager = QuestManager.GetQuestStateManager(client, quest);
var questState = questStateManager.GetQuestState(questScheduleId);
ntc.PriorityQuestList.Add(quest.ToCDataPriorityQuest(questState.Step));
}

Expand Down
7 changes: 6 additions & 1 deletion Arrowgene.Ddon.Shared/AssetReader/AssetCommonDeserializer.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Arrowgene.Ddon.Shared.Asset;
using Arrowgene.Ddon.Shared.Model;
using Arrowgene.Ddon.Shared.Model.Quest;
using Arrowgene.Logging;
Expand All @@ -18,7 +19,7 @@ public AssetCommonDeserializer(Dictionary<uint, NamedParam> namedParams)
NamedParams = namedParams;
}

public bool ParseEnemyGroups(Dictionary<uint, QuestEnemyGroup> EnemyGroups, JsonElement jElement)
public bool ParseEnemyGroups(QuestDropItemAsset questDrops, Dictionary<uint, QuestEnemyGroup> EnemyGroups, JsonElement jElement)
{
if (!jElement.TryGetProperty("enemy_groups", out JsonElement jGroups))
{
Expand Down Expand Up @@ -146,6 +147,10 @@ public bool ParseEnemyGroups(Dictionary<uint, QuestEnemyGroup> EnemyGroups, Json
{
questEnemy.DropsTable = customTable;
}
else
{
questEnemy.DropsTable = questDrops.GetDropTable(questEnemy.EnemyId, questEnemy.Lv);
}

enemyGroup.Enemies.Add(questEnemy);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ public class EpitaphTrialAssetDeserializer
private static readonly ILogger Logger = LogProvider.Logger(typeof(EpitaphTrialAssetDeserializer));

private AssetCommonDeserializer _CommonEnemyDeserializer;
private QuestDropItemAsset _QuestDrops;

public EpitaphTrialAssetDeserializer(AssetCommonDeserializer commonEnemyDeserializer)
public EpitaphTrialAssetDeserializer(AssetCommonDeserializer commonEnemyDeserializer, QuestDropItemAsset questDrops)
{
_CommonEnemyDeserializer = commonEnemyDeserializer;
_QuestDrops = questDrops;
}

public bool LoadTrialsFromDirectory(string path, EpitaphTrialAsset trialAssets)
Expand Down Expand Up @@ -118,7 +120,7 @@ public bool ParseTrial(EpitaphTrial assetData, JsonElement jTrial)
trialOption.EntryCost.Add(item);
}

if (!_CommonEnemyDeserializer.ParseEnemyGroups(trialOption.EnemyGroups, jOption))
if (!_CommonEnemyDeserializer.ParseEnemyGroups(_QuestDrops, trialOption.EnemyGroups, jOption))
{
Logger.Error($"Unable to parse enemies for epitah trial {trialOption.TrialName}:{trialOption.EpitaphId}. Skipping.");
return false;
Expand Down
7 changes: 1 addition & 6 deletions Arrowgene.Ddon.Shared/AssetReader/QuestAssetDeserializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private bool ParseQuest(QuestAssetData assetData, JsonElement jQuest)
return false;
}

if (!_CommonEnemyDeserializer.ParseEnemyGroups(assetData.EnemyGroups, jQuest))
if (!_CommonEnemyDeserializer.ParseEnemyGroups(_QuestDrops, assetData.EnemyGroups, jQuest))
{
Logger.Error($"Unable to create the quest '{assetData.QuestId}'. Skipping.");
return false;
Expand Down Expand Up @@ -1103,11 +1103,6 @@ private bool ParseRawBlock(JsonElement jBlock, QuestBlock questBlock)
return true;
}

private bool ParseAltConditions(JsonElement jAltConditions, QuestBlock questBlock)
{
return true;
}

private void ParseCommandParams(JsonElement jCommand, CDataQuestCommand command)
{
List<string> commandParams = new List<string>() { "Param1", "Param2", "Param3", "Param4" };
Expand Down
2 changes: 1 addition & 1 deletion Arrowgene.Ddon.Shared/AssetRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void Initialize()
var questAssetDeserializer = new QuestAssetDeserializer(commonEnemyDeserializer, QuestDropItemAsset);
questAssetDeserializer.LoadQuestsFromDirectory(Path.Combine(_directory.FullName, QuestAssestKey), QuestAssets);

var epitaphTrialDeserializer = new EpitaphTrialAssetDeserializer(commonEnemyDeserializer);
var epitaphTrialDeserializer = new EpitaphTrialAssetDeserializer(commonEnemyDeserializer, QuestDropItemAsset);
epitaphTrialDeserializer.LoadTrialsFromDirectory(Path.Combine(_directory.FullName, EpitaphAssestKey), EpitaphTrialAssets);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{
"trial_name": "Trial of the Heroes",
"constraints": [
{"type": "DefeatEnemyCount", "priority": "Primary", "Param1": 20},
{"type": "EliminateTheEnemy", "priority": "Primary"},
{"type": "CannotBeAffectedByAbnormalStatus", "priority": "Secondary", "Param1": 3},
{"type": "CompleteConditionsWithinTimeLimit", "priority": "Secondary", "Param1": 60}
],
Expand Down Expand Up @@ -40,36 +40,28 @@
"enemy_id": "0x010512",
"level": 83,
"exp": 8400,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 60
"named_enemy_params_id": 2286
},
{
"comment" : "Frost Corp Tortuerer",
"enemy_id": "0x010512",
"level": 83,
"exp": 8400,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 60
"named_enemy_params_id": 2286
},
{
"comment" : "Frost Skeleton",
"enemy_id": "0x010315",
"level": 83,
"exp": 8400,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 60
"named_enemy_params_id": 2286
},
{
"comment" : "Frost Skeleton",
"enemy_id": "0x010315",
"level": 83,
"exp": 8400,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 60
"named_enemy_params_id": 2286
}
]
}
Expand All @@ -78,7 +70,7 @@
{
"trial_name": "Trial of the Souls",
"constraints": [
{"type": "DefeatEnemyCount", "priority": "Primary", "Param1": 20},
{"type": "EliminateTheEnemy", "priority": "Primary"},
{"type": "CannotDieMoreThanOnce", "priority": "Secondary"},
{"type": "CompleteConditionsWithinTimeLimit", "priority": "Secondary", "Param1": 180}
],
Expand Down Expand Up @@ -115,36 +107,28 @@
"enemy_id": "0x010511",
"level": 83,
"exp": 8400,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 60
"named_enemy_params_id": 2286
},
{
"comment" : "Frost Corp Punisher",
"enemy_id": "0x010511",
"level": 83,
"exp": 8400,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 60
"named_enemy_params_id": 2286
},
{
"comment" : "Frost Skeleton Brute",
"enemy_id": "0x010321",
"level": 83,
"exp": 8400,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 60
"named_enemy_params_id": 2286
},
{
"comment" : "Frost Skeleton Brute",
"enemy_id": "0x010321",
"level": 83,
"exp": 8400,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 60
"named_enemy_params_id": 2286
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"constraints": [
{"type": "DefeatEnemyCount", "priority": "Primary", "Param1": 20},
{"type": "CannotDieMoreThanOnce", "priority": "Secondary"},
{"type": "DefeatEnemyWithAbnormalStatusCount", "priority": "Secondary", "Param1": 3}
{"type": "DefeatEnemyWithAbnormalStatusCount", "priority": "Secondary", "Param1": 5}
],
"cost": [],
"item_rewards": [
Expand All @@ -37,8 +37,7 @@
"named_enemy_params_id": 2287,
"is_boss": true,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
},
{
"comment" : "Grim Goblin Fighter",
Expand All @@ -48,8 +47,7 @@
"index": 0,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
},
{
"comment" : "Grim Goblin Fighter",
Expand All @@ -59,8 +57,7 @@
"index": 1,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
},
{
"comment" : "Grim Goblin Fighter",
Expand All @@ -70,8 +67,7 @@
"index": 2,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
},
{
"comment" : "Grim Goblin Fighter",
Expand All @@ -81,8 +77,7 @@
"index": 3,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
},
{
"comment" : "Grim Goblin Fighter",
Expand All @@ -92,8 +87,7 @@
"index": 4,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
},
{
"comment" : "Grim Goblin Fighter",
Expand All @@ -103,8 +97,7 @@
"index": 5,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
}
]
}
Expand All @@ -115,7 +108,7 @@
"constraints": [
{"type": "DefeatEnemyCount", "priority": "Primary", "Param1": 20},
{"type": "CannotDieMoreThanOnce", "priority": "Secondary"},
{"type": "DefeatEnemyWithAbnormalStatusCount", "priority": "Secondary", "Param1": 3}
{"type": "DefeatEnemyWithAbnormalStatusCount", "priority": "Secondary", "Param1": 5}
],
"cost": [
{"item_id": 18656, "amount": 20}
Expand All @@ -142,8 +135,7 @@
"named_enemy_params_id": 2287,
"is_boss": true,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
},
{
"comment" : "Goblin Shaman",
Expand All @@ -153,8 +145,7 @@
"index": 1,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
},
{
"comment" : "Goblin Shaman",
Expand All @@ -164,8 +155,7 @@
"index": 4,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
},
{
"comment" : "Goblin Shaman",
Expand All @@ -175,8 +165,7 @@
"index": 0,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
},
{
"comment" : "Goblin Aid Shaman",
Expand All @@ -186,8 +175,7 @@
"index": 3,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
},
{
"comment" : "Goblin Aid Shaman",
Expand All @@ -197,8 +185,7 @@
"index": 5,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
},
{
"comment" : "Goblin Aid Shaman",
Expand All @@ -208,8 +195,7 @@
"index": 0,
"named_enemy_params_id": 2286,
"repop_count": 50,
"repop_wait_second": 0,
"is_required": false
"repop_wait_second": 0
}
]
}
Expand Down

0 comments on commit 174a238

Please sign in to comment.