mirror of
https://github.com/YouHaveTrouble/GuildMaster.git
synced 2026-05-12 06:26:59 +00:00
quests need an id
This commit is contained in:
+9
-1
@@ -99,7 +99,7 @@ export async function loadAvailableQuests(): Promise<{ [key: string]: { [key: st
|
||||
const questRankData = questsData.ranks[questRank];
|
||||
|
||||
for (const quest of questRankData) {
|
||||
const id = quest.id;
|
||||
const id = hash(JSON.stringify(quest));
|
||||
|
||||
const phases = [] as Array<QuestPhase>;
|
||||
if (Array.isArray(quest?.phases)) {
|
||||
@@ -171,3 +171,11 @@ export function removeAlreadyHiredAdventurers(
|
||||
}
|
||||
return adventurersForHire;
|
||||
}
|
||||
|
||||
function hash(str: string): string {
|
||||
let hash = 5381;
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
hash = (hash * 33) ^ str.charCodeAt(i);
|
||||
}
|
||||
return (hash >>> 0).toString(16);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user