Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typing for choice rewards #20

Merged
merged 2 commits into from
Oct 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions odysseus/convertFtbQuests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import parseStringifiedNbt from "./parseStringifiedNbt";
import {RegistryValue, ResourceLocation, TagKey} from "./types";
import {HeraclesQuest, HeraclesQuestIcon, HeraclesQuestReward, HeraclesQuestTask} from "./HeraclesQuest";
import {Json, JsonObject, Long} from "./Json";
import {JsonObject, Long} from "./Json";
import {QuestInputFileSystem, QuestOutputFileSystem} from "./QuestFileSystem";
import * as JSONBigInt from 'json-bigint'

Expand Down Expand Up @@ -50,8 +50,8 @@ type RewardTable = BasicQuestObject & {
use_title?: boolean;

rewards: {
item: ResourceLocation;
count?: number;
item: Item;
count?: Long;
tag?: JsonObject;
weight?: number;
}[];
Expand Down Expand Up @@ -802,12 +802,13 @@ function convertReward(reward: QuestReward, rewardTables: (RewardTable & OrderIn
if (rewardTable.rewards) {
let rewards: Record<string, HeraclesQuestReward> = {};
rewardTable.rewards.forEach((tableReward, i) => {
const item = typeof tableReward.item === 'object' ? tableReward.item : {id: tableReward.item}
rewards[reward.id + '_' + i] = {
type: 'heracles:item',
item: {
id: tableReward.item,
count: tableReward.count,
nbt: convertItemNbt(tableReward.tag)
id: convertItemId(item.id),
count: truncateLong(tableReward.count) ?? item.Count,
nbt: convertItemNbt(tableReward.tag) ?? convertItemNbt(item.tag)
}
};
});
Expand Down