mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
Add reward type "giveItem", for quest rewards that do not need full droplists.
This commit is contained in:
@@ -66,6 +66,9 @@ public final class ConversationController {
|
||||
case alignmentChange:
|
||||
addAlignmentReward(player, reward.rewardID, reward.value);
|
||||
break;
|
||||
case giveItem:
|
||||
addItemReward(reward.rewardID, reward.value, result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +100,10 @@ public final class ConversationController {
|
||||
world.dropLists.getDropList(droplistID).createRandomLoot(result.loot, player);
|
||||
}
|
||||
|
||||
private void addItemReward(String itemTypeID, int quantity, PhraseRewards result) {
|
||||
result.loot.add(world.itemTypes.getItemType(itemTypeID), quantity);
|
||||
}
|
||||
|
||||
private void addSkillReward(Player player, SkillCollection.SkillID skillID, PhraseRewards result) {
|
||||
SkillInfo skill = world.skills.getSkill(skillID);
|
||||
boolean addedSkill = controllers.skillController.levelUpSkillByQuest(player, skill);
|
||||
|
||||
@@ -5,11 +5,11 @@ import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.listeners.MapLayoutListeners;
|
||||
import com.gpl.rpg.AndorsTrail.controller.listeners.WorldEventListeners;
|
||||
import com.gpl.rpg.AndorsTrail.conversation.Phrase;
|
||||
import com.gpl.rpg.AndorsTrail.model.ability.SkillCollection;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.Actor;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.Monster;
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.Player;
|
||||
import com.gpl.rpg.AndorsTrail.model.conversation.Reply;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.LayeredTileMap;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.MapObject;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
||||
@@ -195,7 +195,7 @@ public final class MapController {
|
||||
@Override public void onConversationEndedWithCombat(Monster npc) { }
|
||||
@Override public void onConversationEndedWithRemoval(Monster npc) { }
|
||||
@Override public void onConversationCanProceedWithNext() { }
|
||||
@Override public void onConversationHasReply(Phrase.Reply r, String message) { }
|
||||
@Override public void onConversationHasReply(Reply r, String message) { }
|
||||
};
|
||||
public void prepareScriptsOnCurrentMap() {
|
||||
mapScriptExecutor = new ConversationController.ConversationStatemachine(world, controllers, conversationStateListener);
|
||||
|
||||
@@ -7,6 +7,7 @@ public final class Reward {
|
||||
,skillIncrease
|
||||
,actorCondition
|
||||
,alignmentChange
|
||||
,giveItem
|
||||
}
|
||||
|
||||
public final RewardType rewardType;
|
||||
|
||||
@@ -20,13 +20,7 @@ public final class DropList {
|
||||
final int quantityRollBias = SkillController.getDropQuantityRollBias(item, player);
|
||||
int quantity = Constants.rollValue(item.quantity, quantityRollBias);
|
||||
|
||||
if (quantity != 0) {
|
||||
if (ItemTypeCollection.isGoldItemType(item.itemType.id)) {
|
||||
loot.gold += quantity;
|
||||
} else {
|
||||
loot.items.addItem(item.itemType, quantity);
|
||||
}
|
||||
}
|
||||
loot.add(item.itemType, quantity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ public class ItemContainer {
|
||||
}
|
||||
|
||||
public void addItem(ItemType itemType, int quantity) {
|
||||
if (quantity == 0) return;
|
||||
|
||||
ItemEntry e = findItem(itemType.id);
|
||||
if (e != null) {
|
||||
e.quantity += quantity;
|
||||
|
||||
@@ -33,6 +33,14 @@ public final class Loot {
|
||||
this.items.add(l.items);
|
||||
}
|
||||
|
||||
public void add(ItemType itemType, int quantity) {
|
||||
if (ItemTypeCollection.isGoldItemType(itemType.id)) {
|
||||
gold += quantity;
|
||||
} else {
|
||||
items.addItem(itemType, quantity);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasItemsOrExp() {
|
||||
return exp != 0 || hasItemsOrGold();
|
||||
}
|
||||
@@ -61,7 +69,6 @@ public final class Loot {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void clear() {
|
||||
exp = 0;
|
||||
gold = 0;
|
||||
|
||||
Reference in New Issue
Block a user