diff --git a/assets/prefabs/buildings/marketPlace.prefab b/assets/prefabs/buildings/marketPlace.prefab index 9ec726d2..24b964d7 100644 --- a/assets/prefabs/buildings/marketPlace.prefab +++ b/assets/prefabs/buildings/marketPlace.prefab @@ -9,12 +9,11 @@ }, "MarketSubscriber" : { "production" : { - "waffles" : 10, - "Blueberry": 1, - "Raspberry": 1, - "Strawberry": 1 + "AdditionalFruits:Blueberry": 3, + "AdditionalFruits:Raspberry": 3, + "AdditionalFruits:Strawberry": 3 }, - "productionInterval" : 100 + "productionInterval" : 10000 }, "InfiniteStorage" : { "inventory" : {} diff --git a/src/main/java/org/terasology/metalrenegades/economy/actions/ShowMarketScreenAction.java b/src/main/java/org/terasology/metalrenegades/economy/actions/ShowMarketScreenAction.java index 0ede3176..56cecbe0 100644 --- a/src/main/java/org/terasology/metalrenegades/economy/actions/ShowMarketScreenAction.java +++ b/src/main/java/org/terasology/metalrenegades/economy/actions/ShowMarketScreenAction.java @@ -45,8 +45,5 @@ public void execute(EntityRef charEntity, EntityRef talkTo) { talkTo.send(new MarketScreenRequestEvent(marketID, charEntity, type)); } - public long getMarketID() { - return marketID; - } } diff --git a/src/main/java/org/terasology/metalrenegades/economy/events/MarketTransactionRequest.java b/src/main/java/org/terasology/metalrenegades/economy/events/MarketTransactionRequest.java new file mode 100644 index 00000000..71089c0b --- /dev/null +++ b/src/main/java/org/terasology/metalrenegades/economy/events/MarketTransactionRequest.java @@ -0,0 +1,32 @@ +package org.terasology.metalrenegades.economy.events; + +import org.terasology.entitySystem.event.Event; +import org.terasology.metalrenegades.economy.ui.MarketItem; +import org.terasology.network.ServerEvent; + +/** + * A client-to-server event which requests the transaction of a particular item. + */ +@ServerEvent +public class MarketTransactionRequest implements Event { + + /** + * The item to be bought/sold. + */ + public MarketItem item; + + /** + * The type of transaction to take place. + */ + public TransactionType type; + + public MarketTransactionRequest(MarketItem item, TransactionType type) { + this.item = item; + this.type = type; + } + + public MarketTransactionRequest() { + + } + +} diff --git a/src/main/java/org/terasology/metalrenegades/economy/events/UpdateMarketScreenEvent.java b/src/main/java/org/terasology/metalrenegades/economy/events/UpdateMarketScreenEvent.java new file mode 100644 index 00000000..6f29c1dc --- /dev/null +++ b/src/main/java/org/terasology/metalrenegades/economy/events/UpdateMarketScreenEvent.java @@ -0,0 +1,9 @@ +package org.terasology.metalrenegades.economy.events; + +import org.terasology.entitySystem.event.Event; + +public class UpdateMarketScreenEvent implements Event { + + public UpdateMarketScreenEvent() { } + +} diff --git a/src/main/java/org/terasology/metalrenegades/economy/systems/MarketCitizenSpawnSystem.java b/src/main/java/org/terasology/metalrenegades/economy/systems/MarketCitizenSpawnSystem.java index 773cfe42..c2f0a0e5 100644 --- a/src/main/java/org/terasology/metalrenegades/economy/systems/MarketCitizenSpawnSystem.java +++ b/src/main/java/org/terasology/metalrenegades/economy/systems/MarketCitizenSpawnSystem.java @@ -32,6 +32,7 @@ import org.terasology.entitySystem.event.ReceiveEvent; import org.terasology.entitySystem.prefab.Prefab; import org.terasology.entitySystem.systems.BaseComponentSystem; +import org.terasology.entitySystem.systems.RegisterMode; import org.terasology.entitySystem.systems.RegisterSystem; import org.terasology.math.geom.Rect2i; import org.terasology.math.geom.Vector3f; @@ -47,7 +48,7 @@ /** * Spawns a market citizen in all markets */ -@RegisterSystem +@RegisterSystem(RegisterMode.AUTHORITY) public class MarketCitizenSpawnSystem extends BaseComponentSystem { @In @@ -71,7 +72,6 @@ public void onMarketPlaceSpawn(BuildingEntitySpawnedEvent event, EntityRef entit trader.addComponent(settlementRefComponent); MarketComponent marketComponent = settlementRefComponent.settlement.getComponent(MarketComponent.class); - DialogComponent dialogComponent = new DialogComponent(); dialogComponent.pages = new ArrayList<>(); @@ -81,12 +81,12 @@ public void onMarketPlaceSpawn(BuildingEntitySpawnedEvent event, EntityRef entit DialogResponse buyResponse = new DialogResponse(); buyResponse.action = new ArrayList<>(); - buyResponse.action.add(new ShowMarketScreenAction(marketComponent.market.getId(), TransactionType.BUYING)); + buyResponse.action.add(new ShowMarketScreenAction(marketComponent.getMarketId(), TransactionType.BUYING)); buyResponse.text = "Buy"; DialogResponse sellResponse = new DialogResponse(); sellResponse.action = new ArrayList<>(); - sellResponse.action.add(new ShowMarketScreenAction(marketComponent.market.getId(), TransactionType.SELLING)); + sellResponse.action.add(new ShowMarketScreenAction(marketComponent.getMarketId(), TransactionType.SELLING)); sellResponse.text = "Sell"; DialogResponse closeResponse = new DialogResponse(); diff --git a/src/main/java/org/terasology/metalrenegades/economy/systems/MarketManagementSystem.java b/src/main/java/org/terasology/metalrenegades/economy/systems/MarketManagementSystem.java index aac5f884..0e028d9c 100644 --- a/src/main/java/org/terasology/metalrenegades/economy/systems/MarketManagementSystem.java +++ b/src/main/java/org/terasology/metalrenegades/economy/systems/MarketManagementSystem.java @@ -28,34 +28,31 @@ import org.terasology.dynamicCities.settlements.components.ActiveSettlementComponent; import org.terasology.dynamicCities.settlements.components.MarketComponent; import org.terasology.dynamicCities.settlements.events.SettlementRegisterEvent; -import org.terasology.economy.components.InfiniteStorageComponent; -import org.terasology.economy.components.MarketSubscriberComponent; -import org.terasology.economy.components.MultiInvStorageComponent; -import org.terasology.economy.events.ResourceDrawEvent; -import org.terasology.economy.events.ResourceInfoRequestEvent; -import org.terasology.economy.events.ResourceStoreEvent; -import org.terasology.economy.events.SubscriberRegistrationEvent; -import org.terasology.economy.events.UpdateWalletEvent; +import org.terasology.economy.components.*; +import org.terasology.economy.events.*; import org.terasology.economy.handler.MultiInvStorageHandler; import org.terasology.economy.systems.MarketLogisticSystem; -import org.terasology.economy.systems.WalletSystem; +import org.terasology.economy.systems.WalletAuthoritySystem; import org.terasology.entitySystem.entity.EntityManager; import org.terasology.entitySystem.entity.EntityRef; import org.terasology.entitySystem.event.ReceiveEvent; import org.terasology.entitySystem.prefab.Prefab; import org.terasology.entitySystem.systems.BaseComponentSystem; +import org.terasology.entitySystem.systems.RegisterMode; import org.terasology.entitySystem.systems.RegisterSystem; import org.terasology.entitySystem.systems.UpdateSubscriberSystem; import org.terasology.logic.inventory.InventoryManager; import org.terasology.logic.inventory.ItemComponent; -import org.terasology.logic.players.LocalPlayer; +import org.terasology.logic.players.event.OnPlayerSpawnedEvent; +import org.terasology.metalrenegades.economy.events.MarketTransactionRequest; import org.terasology.metalrenegades.economy.events.TransactionType; import org.terasology.metalrenegades.economy.ui.MarketItem; -import org.terasology.network.ClientComponent; +import org.terasology.network.NetworkComponent; import org.terasology.registry.In; import org.terasology.registry.Share; import org.terasology.world.block.BlockManager; import org.terasology.world.block.entity.BlockCommands; +import org.terasology.world.block.items.BlockItemComponent; import java.util.Set; @@ -63,7 +60,7 @@ * Handles most core market features */ @Share(MarketManagementSystem.class) -@RegisterSystem +@RegisterSystem(RegisterMode.AUTHORITY) public class MarketManagementSystem extends BaseComponentSystem implements UpdateSubscriberSystem { @In @@ -81,9 +78,6 @@ public class MarketManagementSystem extends BaseComponentSystem implements Updat @In private InventoryManager inventoryManager; - @In - private LocalPlayer localPlayer; - @In private BlockCommands blockCommands; @@ -94,19 +88,20 @@ public class MarketManagementSystem extends BaseComponentSystem implements Updat private MultiInvStorageHandler handler; @In - private WalletSystem walletSystem; - - private EntityRef playerResourceStore; + private WalletAuthoritySystem walletAuthoritySystem; private final int COOLDOWN = 200; private int counter = 0; private Logger logger = LoggerFactory.getLogger(MarketManagementSystem.class); - @Override - public void postBegin() { - playerResourceStore = entityManager.create(); + @ReceiveEvent + public void onPlayerJoin(OnPlayerSpawnedEvent onPlayerSpawnedEvent, EntityRef player) { + EntityRef playerResourceStore = entityManager.create(); playerResourceStore.addComponent(new InfiniteStorageComponent(1)); + playerResourceStore.setOwner(player); + + player.addComponent(new PlayerResourceStoreComponent(playerResourceStore)); } @Override @@ -139,7 +134,9 @@ public void update(float delta) { @ReceiveEvent(components = {ActiveSettlementComponent.class, PopulationComponent.class, CultureComponent.class}) public void onSettlementSpawnEvent(SettlementRegisterEvent event, EntityRef settlement) { EntityRef market = entityManager.create(new InfiniteStorageComponent(1)); + settlement.addComponent(new NetworkComponent()); MarketComponent marketComponent = new MarketComponent(market); + marketComponent.marketId = market.getId(); settlement.addComponent(marketComponent); } @@ -156,83 +153,54 @@ public void onBuildingEntitySpawned(BuildingEntitySpawnedEvent event, EntityRef entityRef.send(new SubscriberRegistrationEvent()); } - // TODO: Expose transaction logic as events -// @ReceiveEvent -// public void onMarketTransactionConfirm(MarketTransactionEvent event, EntityRef character) { -// -// } - /** * Initiate a transaction and delegate to an appropriate method depending * on the nature of the transaction - * @param item MarketItem to be bought/sold - * @param type TransactionType - * @return updated MarketItem */ - public MarketItem handleTransaction(MarketItem item, TransactionType type) { - if (type == TransactionType.BUYING) { - return buy(item); - } else if (type == TransactionType.SELLING) { - return sell(item); + @ReceiveEvent + public void onMarketTransactionRequest(MarketTransactionRequest request, EntityRef character) { + if (request.type == TransactionType.BUYING) { + buy(character, request.item); + } else if (request.type == TransactionType.SELLING) { + sell(character, request.item); } else { logger.warn("TransactionType invalid"); - return item; } } - private MarketItem buy(MarketItem item) { - if (!walletSystem.isValidTransaction(-1 * item.cost)) { + private MarketItem buy(EntityRef character, MarketItem item) { + if (!walletAuthoritySystem.isValidTransaction(character,-1 * item.cost)) { logger.warn("Insufficient funds"); return item; } else if (item.quantity > 0) { - if (!createItemOrBlock(item.name)) { + if (!createItemOrBlock(character, item.name)) { logger.warn("Failed to create entity"); return item; } - Iterable storageBuildings = entityManager.getEntitiesWith(MultiInvStorageComponent.class, SettlementRefComponent.class); - for (EntityRef bldg : storageBuildings) { - if (!bldg.isActive() || !bldg.exists()) { - continue; - } - - MultiInvStorageComponent component = bldg.getComponent(MultiInvStorageComponent.class); - - playerResourceStore.send(new ResourceDrawEvent(item.name, 1, bldg)); - - logger.info("\n\n playerStore: {} \n bldg: {} \n\n", - playerResourceStore.getComponent(InfiniteStorageComponent.class).inventory.get(item.name), - handler.availableResourceAmount(component, item.name)); - - item.quantity--; - localPlayer.getCharacterEntity().send(new UpdateWalletEvent(-1 * item.cost)); - break; - } + SettlementRefComponent playerSettlementRef = character.getComponent(SettlementRefComponent.class); + EntityRef playerResourceStore = character.getComponent(PlayerResourceStoreComponent.class).resourceStore; + playerResourceStore.send(new ResourceDrawEvent(item.name, 1, playerSettlementRef.settlement.getComponent(MarketComponent.class).market)); + character.send(new WalletTransactionEvent(-1 * item.cost)); + item.quantity--; } return item; } - private MarketItem sell(MarketItem item) { - if (item.quantity <=0 || !destroyItemOrBlock(item.name)) { - logger.warn("Failed to create entity"); + private MarketItem sell(EntityRef character, MarketItem item) { + if (item.quantity <=0 || !destroyItemOrBlock(character, item.name)) { + logger.warn("Failed to destroy entity"); return item; } + EntityRef playerResourceStore = character.getComponent(PlayerResourceStoreComponent.class).resourceStore; + SettlementRefComponent settlementRefComponent = character.getComponent(SettlementRefComponent.class); + playerResourceStore.send(new ResourceStoreEvent(item.name, 1, settlementRefComponent.settlement.getComponent(MarketComponent.class).market)); - Iterable storageBuildings = entityManager.getEntitiesWith(MultiInvStorageComponent.class, SettlementRefComponent.class); - for (EntityRef bldg : storageBuildings) { - if (!bldg.isActive() || !bldg.exists()) { - continue; - } - - SettlementRefComponent settlementRefComponent = bldg.getComponent(SettlementRefComponent.class); - playerResourceStore.send(new ResourceStoreEvent(item.name, 1, settlementRefComponent.settlement.getComponent(MarketComponent.class).market)); - item.quantity--; - localPlayer.getCharacterEntity().send(new UpdateWalletEvent(item.cost)); - break; - } + character.send(new WalletTransactionEvent(item.cost)); + item.quantity--; return item; } @@ -243,22 +211,28 @@ private MarketItem sell(MarketItem item) { * @param name Name of the item bought * @return Boolean indication whether the creating was a success or a failure */ - private boolean createItemOrBlock(String name) { + private boolean createItemOrBlock(EntityRef character, String name) { Set matches = assetManager.resolve(name, Prefab.class); + SettlementRefComponent playerSettlementRef = character.getComponent(SettlementRefComponent.class); + ResourceInfoRequestEvent request = playerSettlementRef.settlement.getComponent(MarketComponent.class).market.send(new ResourceInfoRequestEvent()); + + if (!request.isHandled || request.resources.get(name) <= 0) { + return false; + } if (matches.size() == 1) { Prefab prefab = assetManager.getAsset(matches.iterator().next(), Prefab.class).orElse(null); if (prefab != null && prefab.getComponent(ItemComponent.class) != null) { - EntityRef playerEntity = localPlayer.getClientEntity().getComponent(ClientComponent.class).character; EntityRef entity = entityManager.create(prefab); - if (!inventoryManager.giveItem(playerEntity, playerEntity, entity)) { + if (!inventoryManager.giveItem(character, character, entity)) { entity.destroy(); return true; } } } - String message = blockCommands.giveBlock(localPlayer.getClientEntity(), name, 1, null); + String blockURI = matches.iterator().next().getModuleName() + ":" + matches.iterator().next().getResourceName(); + String message = blockCommands.giveBlock(character.getOwner(), blockURI, 1, null); if (message != null) { return true; } @@ -271,18 +245,32 @@ private boolean createItemOrBlock(String name) { * @param name Name of the item sold * @return Boolean indication whether the removal was a success or a failure */ - private boolean destroyItemOrBlock(String name) { - EntityRef player = localPlayer.getCharacterEntity(); + private boolean destroyItemOrBlock(EntityRef character, String name) { EntityRef item = EntityRef.NULL; try { - for (int i = 0; i < inventoryManager.getNumSlots(player); i++) { - EntityRef current = inventoryManager.getItemInSlot(player, i); - if (!EntityRef.NULL.equals(current) && name.equalsIgnoreCase(current.getParentPrefab().getName())) { + for (int i = 0; i < inventoryManager.getNumSlots(character); i++) { + EntityRef current = inventoryManager.getItemInSlot(character, i); + + if (EntityRef.NULL.equals(current)) { + continue; + } + + if (name.equalsIgnoreCase(current.getParentPrefab().getName())) { item = current; break; } + + if (current.getParentPrefab().getName().equalsIgnoreCase("engine:blockItemBase")) { + if (current.getComponent(BlockItemComponent.class).blockFamily.getURI().toString().equalsIgnoreCase(name)) { + item = current; + break; + } + } + } + if (item == EntityRef.NULL) { + return false; } - inventoryManager.removeItem(localPlayer.getCharacterEntity(), EntityRef.NULL, item, true, 1); + inventoryManager.removeItem(character, EntityRef.NULL, item, true, 1); } catch (Exception e) { logger.error("Could not create entity from {}. Exception: {}", name, e.getMessage()); return false; diff --git a/src/main/java/org/terasology/metalrenegades/economy/ui/MarketScreen.java b/src/main/java/org/terasology/metalrenegades/economy/ui/MarketScreen.java index 5b2efeab..4deb5f35 100644 --- a/src/main/java/org/terasology/metalrenegades/economy/ui/MarketScreen.java +++ b/src/main/java/org/terasology/metalrenegades/economy/ui/MarketScreen.java @@ -18,7 +18,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.terasology.logic.players.LocalPlayer; +import org.terasology.metalrenegades.economy.events.MarketTransactionRequest; import org.terasology.metalrenegades.economy.events.TransactionType; +import org.terasology.metalrenegades.economy.events.UpdateMarketScreenEvent; import org.terasology.metalrenegades.economy.systems.MarketManagementSystem; import org.terasology.registry.In; import org.terasology.rendering.nui.CoreScreenLayer; @@ -129,10 +131,12 @@ public List get() { confirm = find("confirm", UIButton.class); confirm.subscribe((widget -> { if (type == TransactionType.BUYING || type == TransactionType.SELLING) { - // TODO: Expose transaction logic as events -// player.getCharacterEntity().send(new MarketTransactionEvent(selected, type)); - selected = marketManagementSystem.handleTransaction(selected, type); + MarketTransactionRequest marketTransactionRequest = new MarketTransactionRequest(); + marketTransactionRequest.item = selected; + marketTransactionRequest.type = type; + player.getCharacterEntity().send(marketTransactionRequest); logger.info("Confirmed transaction of one {}", selected.name); + player.getCharacterEntity().send(new UpdateMarketScreenEvent()); } else { logger.warn("TransactionType not recognised. No transaction."); } diff --git a/src/main/java/org/terasology/metalrenegades/economy/ui/MarketUISystem.java b/src/main/java/org/terasology/metalrenegades/economy/ui/MarketUISystem.java index 9227eed9..0f1921ca 100644 --- a/src/main/java/org/terasology/metalrenegades/economy/ui/MarketUISystem.java +++ b/src/main/java/org/terasology/metalrenegades/economy/ui/MarketUISystem.java @@ -18,7 +18,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.terasology.assets.ResourceUrn; -import org.terasology.economy.events.ResourceInfoRequestEvent; +import org.terasology.economy.events.MarketInfoClientRequestEvent; +import org.terasology.economy.events.MarketInfoClientResponseEvent; import org.terasology.entitySystem.entity.EntityManager; import org.terasology.entitySystem.entity.EntityRef; import org.terasology.entitySystem.event.ReceiveEvent; @@ -30,12 +31,14 @@ import org.terasology.logic.players.LocalPlayer; import org.terasology.metalrenegades.economy.events.MarketScreenRequestEvent; import org.terasology.metalrenegades.economy.events.TransactionType; +import org.terasology.metalrenegades.economy.events.UpdateMarketScreenEvent; import org.terasology.registry.In; import org.terasology.registry.Share; import org.terasology.rendering.nui.NUIManager; +import org.terasology.world.block.items.BlockItemComponent; +import org.terasology.world.time.WorldTimeEvent; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -62,11 +65,22 @@ public class MarketUISystem extends BaseComponentSystem { private MarketScreen marketScreen; + private long marketID; + + private TransactionType type; + @Override public void initialise() { marketScreen = (MarketScreen) nuiManager.createScreen("MetalRenegades:marketScreen"); } + @ReceiveEvent + public void onWorldTimeCycle(WorldTimeEvent worldTimeEvent, EntityRef entity) { + if (marketID != 0 && type != null) { + updateScreenInformation(); + } + } + @ReceiveEvent public void onToggleInventory(MarketScreenRequestEvent event, EntityRef entity) { ResourceUrn activeInteractionScreenUri = InteractionUtil.getActiveInteractionScreenUri(entity); @@ -80,40 +94,62 @@ public void onToggleInventory(MarketScreenRequestEvent event, EntityRef entity) @ReceiveEvent public void onMarketScreenAction(MarketScreenRequestEvent event, EntityRef entityRef) { List marketItemList = new ArrayList<>(); + marketScreen.setItemList(marketItemList); // clear out any old item listings from the UI. - if (event.type == TransactionType.BUYING) { - EntityRef market = entityManager.getEntity(event.market); - ResourceInfoRequestEvent resourceInfoRequestEvent = new ResourceInfoRequestEvent(); - Map resources; - market.send(resourceInfoRequestEvent); - - if (resourceInfoRequestEvent.isHandled) { - resources = resourceInfoRequestEvent.resources; - } else { - logger.error("Could not retrieve resource information."); - return; - } + this.marketID = event.market; + this.type = event.type; - for (Map.Entry entry : resources.entrySet()) { - MarketItem item = MarketItemBuilder.get(entry.getKey(), entry.getValue()); - marketItemList.add(item); - } - } else if (event.type == TransactionType.SELLING){ + updateScreenInformation(); + + marketScreen.setType(event.type); + } + + @ReceiveEvent + public void onResourceInfoResponse(MarketInfoClientResponseEvent marketInfoResponseEvent, EntityRef character) { + List marketItemList = new ArrayList<>(); + Map resources; + + resources = marketInfoResponseEvent.resources; + + for (Map.Entry entry : resources.entrySet()) { + MarketItem item = MarketItemBuilder.get(entry.getKey(), entry.getValue()); + marketItemList.add(item); + } + + marketScreen.setItemList(marketItemList); + } + + @ReceiveEvent + public void onUpdateScreenEvent(UpdateMarketScreenEvent event, EntityRef entity) { + updateScreenInformation(); + } + + private void updateScreenInformation() { + List marketItemList = new ArrayList<>(); + + if (type == TransactionType.BUYING) { + localPlayer.getCharacterEntity().send(new MarketInfoClientRequestEvent(marketID)); + } else if (type == TransactionType.SELLING){ EntityRef player = localPlayer.getCharacterEntity(); int slots = inventoryManager.getNumSlots(player); for (int i = 0; i < slots; i++) { EntityRef entity = inventoryManager.getItemInSlot(player, i); if (entity.getParentPrefab() != null) { - MarketItem item = MarketItemBuilder.get(entity.getParentPrefab().getName(), 1); // TODO: 1? + MarketItem item; + logger.info(entity.getParentPrefab().getName() + " == " + "blockItemBase"); + if (entity.getParentPrefab().getName().equalsIgnoreCase("engine:blockItemBase")) { + item = MarketItemBuilder.get(entity.getComponent(BlockItemComponent.class).blockFamily.getURI().toString(), inventoryManager.getStackSize(entity)); + } else { + item = MarketItemBuilder.get(entity.getParentPrefab().getName(), inventoryManager.getStackSize(entity)); + } marketItemList.add(item); } } + marketScreen.setItemList(marketItemList); } else { logger.warn("TransactionType not recognised."); } - - marketScreen.setType(event.type); - marketScreen.setItemList(marketItemList); } + } diff --git a/src/main/java/org/terasology/metalrenegades/quests/FetchQuestSystem.java b/src/main/java/org/terasology/metalrenegades/quests/FetchQuestSystem.java index d86885a5..7f2bdb89 100644 --- a/src/main/java/org/terasology/metalrenegades/quests/FetchQuestSystem.java +++ b/src/main/java/org/terasology/metalrenegades/quests/FetchQuestSystem.java @@ -20,7 +20,7 @@ import org.terasology.dynamicCities.buildings.components.SettlementRefComponent; import org.terasology.dynamicCities.construction.events.BuildingEntitySpawnedEvent; import org.terasology.dynamicCities.parcels.DynParcel; -import org.terasology.economy.events.UpdateWalletEvent; +import org.terasology.economy.events.WalletTransactionEvent; import org.terasology.entitySystem.entity.EntityManager; import org.terasology.entitySystem.entity.EntityRef; import org.terasology.entitySystem.event.ReceiveEvent; @@ -173,7 +173,7 @@ public void onQuestComplete(QuestCompleteEvent event, EntityRef client) { inventoryManager.removeItem(character, EntityRef.NULL, item, true, amounts.getOrDefault(ITEM_ID, 0)); // Pay the player - character.send(new UpdateWalletEvent(REWARD)); + character.send(new WalletTransactionEvent(REWARD)); // Remove the minmap overlay character.send(new RemoveBeaconOverlayEvent(activeQuestEntity));