Only add xp reward to repeatable quests when value is > 0
This commit is contained in:
parent
0abcd8b3b7
commit
5e919f4793
@ -875,27 +875,34 @@ export class RepeatableQuestGenerator
|
|||||||
let roublesBudget = rewardRoubles;
|
let roublesBudget = rewardRoubles;
|
||||||
let rewardItemPool = this.chooseRewardItemsWithinBudget(repeatableConfig, roublesBudget, traderId);
|
let rewardItemPool = this.chooseRewardItemsWithinBudget(repeatableConfig, roublesBudget, traderId);
|
||||||
|
|
||||||
// Add xp reward
|
|
||||||
const rewards: IRewards = {
|
const rewards: IRewards = {
|
||||||
Started: [],
|
Started: [],
|
||||||
Success: [{ value: rewardXP, type: "Experience", index: 0 }],
|
Success: [],
|
||||||
Fail: [],
|
Fail: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let rewardIndex = 0;
|
||||||
|
// Add xp reward
|
||||||
|
if (rewardXP > 0)
|
||||||
|
{
|
||||||
|
rewards.Success.push({ value: rewardXP, type: "Experience", index: rewardIndex });
|
||||||
|
rewardIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
// Add money reward
|
// Add money reward
|
||||||
if (traderId === Traders.PEACEKEEPER || traderId === Traders.FENCE)
|
if (traderId === Traders.PEACEKEEPER || traderId === Traders.FENCE)
|
||||||
{
|
{
|
||||||
// convert to equivalent dollars
|
// convert to equivalent dollars
|
||||||
rewards.Success.push(
|
rewards.Success.push(
|
||||||
this.generateRewardItem(Money.EUROS, this.handbookHelper.fromRUB(rewardRoubles, Money.EUROS), 1),
|
this.generateRewardItem(Money.EUROS, this.handbookHelper.fromRUB(rewardRoubles, Money.EUROS), rewardIndex),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rewards.Success.push(this.generateRewardItem(Money.ROUBLES, rewardRoubles, 1));
|
rewards.Success.push(this.generateRewardItem(Money.ROUBLES, rewardRoubles, rewardIndex));
|
||||||
}
|
}
|
||||||
|
rewardIndex++;
|
||||||
|
|
||||||
let index = 2;
|
|
||||||
if (rewardItemPool.length > 0)
|
if (rewardItemPool.length > 0)
|
||||||
{
|
{
|
||||||
let weaponRewardCount = 0;
|
let weaponRewardCount = 0;
|
||||||
@ -946,14 +953,15 @@ export class RepeatableQuestGenerator
|
|||||||
itemCount = 2;
|
itemCount = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
rewards.Success.push(this.generateRewardItem(itemSelected._id, itemCount, index, children));
|
rewards.Success.push(this.generateRewardItem(itemSelected._id, itemCount, rewardIndex, children));
|
||||||
|
rewardIndex++;
|
||||||
|
|
||||||
const itemCost = (this.itemHelper.isOfBaseclass(itemSelected._id, BaseClasses.WEAPON))
|
const itemCost = (this.itemHelper.isOfBaseclass(itemSelected._id, BaseClasses.WEAPON))
|
||||||
? this.itemHelper.getItemMaxPrice(children[0]._tpl) // use if preset is not default : this.itemHelper.getWeaponPresetPrice(children[0], children, this.itemHelper.getStaticItemPrice(itemSelected._id))
|
? this.itemHelper.getItemMaxPrice(children[0]._tpl) // use if preset is not default : this.itemHelper.getWeaponPresetPrice(children[0], children, this.itemHelper.getStaticItemPrice(itemSelected._id))
|
||||||
: this.itemHelper.getStaticItemPrice(itemSelected._id);
|
: this.itemHelper.getStaticItemPrice(itemSelected._id);
|
||||||
roublesBudget -= itemCount * itemCost;
|
roublesBudget -= itemCount * itemCost;
|
||||||
index += 1;
|
|
||||||
|
|
||||||
// if we still have budget narrow down the items
|
// If we still have budget narrow down possible items
|
||||||
if (roublesBudget > 0)
|
if (roublesBudget > 0)
|
||||||
{
|
{
|
||||||
// Filter possible reward items to only items with a price below the remaining budget
|
// Filter possible reward items to only items with a price below the remaining budget
|
||||||
@ -975,18 +983,19 @@ export class RepeatableQuestGenerator
|
|||||||
// Add rep reward to rewards array
|
// Add rep reward to rewards array
|
||||||
if (rewardReputation > 0)
|
if (rewardReputation > 0)
|
||||||
{
|
{
|
||||||
const reward: IReward = { target: traderId, value: rewardReputation, type: "TraderStanding", index: index };
|
const reward: IReward = { target: traderId, value: rewardReputation, type: "TraderStanding", index: rewardIndex };
|
||||||
rewards.Success.push(reward);
|
rewards.Success.push(reward);
|
||||||
|
rewardIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Chance of adding skill reward
|
||||||
if (this.randomUtil.getChance100(skillRewardChance * 100))
|
if (this.randomUtil.getChance100(skillRewardChance * 100))
|
||||||
{
|
{
|
||||||
index++;
|
|
||||||
const reward: IReward = {
|
const reward: IReward = {
|
||||||
target: this.randomUtil.getArrayValue(questConfig.possibleSkillRewards),
|
target: this.randomUtil.getArrayValue(questConfig.possibleSkillRewards),
|
||||||
value: skillPointReward,
|
value: skillPointReward,
|
||||||
type: "Skill",
|
type: "Skill",
|
||||||
index: index,
|
index: rewardIndex,
|
||||||
};
|
};
|
||||||
rewards.Success.push(reward);
|
rewards.Success.push(reward);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user