-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Party list updates with proper progress. - Track completion of world quests. - Treat quest accept as a checkpoint for saving progress. - Fix issue where shallow copy didn't really shallow copy in the quest structure. - Fix issue where changing additional members of quest structure on accident.
- Loading branch information
1 parent
c44978c
commit 962eb44
Showing
32 changed files
with
741 additions
and
142 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
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.Design; | ||
using System.Data.Common; | ||
using System.Reflection.Metadata.Ecma335; | ||
using System.Text.RegularExpressions; | ||
using System.Web; | ||
using System.Xml; | ||
using Arrowgene.Ddon.Shared.Entity.Structure; | ||
using Arrowgene.Ddon.Shared.Model; | ||
using Arrowgene.Ddon.Shared.Model.Quest; | ||
|
||
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_completed_quests */ | ||
protected static readonly string[] PriorityQuestFields = new string[] | ||
{ | ||
"character_common_id", "quest_id" | ||
}; | ||
|
||
private readonly string SqlInsertIfNotExistPriorityQuestId = $"INSERT INTO \"ddon_priority_quests\" ({BuildQueryField(PriorityQuestFields)}) SELECT " + | ||
$"{BuildQueryInsert(PriorityQuestFields)} WHERE NOT EXISTS (SELECT 1 FROM \"ddon_priority_quests\" WHERE " + | ||
$"\"character_common_id\" = @character_common_id AND \"quest_id\" = @quest_id);"; | ||
private readonly string SqlSelectPriorityQuests = $"SELECT {BuildQueryField(PriorityQuestFields)} FROM \"ddon_priority_quests\" WHERE \"character_common_id\" = @character_common_id;"; | ||
private readonly string SqlDeletePriorityQuest = $"DELETE FROM \"ddon_priority_quests\" WHERE \"character_common_id\" = @character_common_id AND \"quest_id\" = @quest_id;"; | ||
|
||
public bool InsertPriorityQuest(uint characterCommonId, QuestId questId) | ||
{ | ||
using TCon connection = OpenNewConnection(); | ||
return InsertPriorityQuest(connection, characterCommonId, questId); | ||
} | ||
|
||
public bool InsertPriorityQuest(TCon connection, uint characterCommonId, QuestId questId) | ||
{ | ||
return ExecuteNonQuery(connection, SqlInsertIfNotExistPriorityQuestId, command => | ||
{ | ||
AddParameter(command, "character_common_id", characterCommonId); | ||
AddParameter(command, "quest_id", (uint)questId); | ||
}) == 1; | ||
} | ||
|
||
public List<QuestId> GetPriorityQuests(uint characterCommonId) | ||
{ | ||
using TCon connection = OpenNewConnection(); | ||
return GetPriorityQuests(connection, characterCommonId); | ||
} | ||
public List<QuestId> GetPriorityQuests(TCon connection, uint characterCommonId) | ||
{ | ||
List<QuestId> results = new List<QuestId>(); | ||
ExecuteInTransaction(conn => | ||
{ | ||
ExecuteReader(conn, SqlSelectPriorityQuests, | ||
command => { | ||
AddParameter(command, "@character_common_id", characterCommonId); | ||
}, reader => { | ||
while (reader.Read()) | ||
{ | ||
results.Add((QuestId)GetUInt32(reader, "quest_id")); | ||
} | ||
}); | ||
}); | ||
return results; | ||
} | ||
|
||
public bool DeletePriorityQuest(uint characterCommonId, QuestId questId) | ||
{ | ||
using TCon connection = OpenNewConnection(); | ||
return DeletePriorityQuest(connection, characterCommonId, questId); | ||
} | ||
|
||
public bool DeletePriorityQuest(TCon connection, uint characterCommonId, QuestId questId) | ||
{ | ||
return ExecuteNonQuery(connection, SqlDeletePriorityQuest, command => | ||
{ | ||
AddParameter(command, "@character_common_id", characterCommonId); | ||
AddParameter(command, "quest_id", (uint)questId); | ||
}) == 1; | ||
} | ||
} | ||
} | ||
|
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
Oops, something went wrong.