From 267549ce154055eb5b3b99c69eec7773a22a3735 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 22 Feb 2024 19:15:13 -0600 Subject: [PATCH] Resource Merchant --- src/engine/server/world/WorldServer.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index eca57199..eead8124 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -660,10 +660,13 @@ public class WorldServer { try { Building sdrHut = BuildingManager.getBuilding(27984); Zone sdr = sdrHut.parentZone; + NPC resourceMerchant = null; boolean exists = false; for(NPC merchant : sdr.zoneNPCSet) - if(merchant.contract.getContractID() == 900) + if(merchant.contract.getContractID() == 900) { exists = true; + resourceMerchant = merchant; + } if (!exists) { NPC runeMerchant = NPC.createNPC("Stocky", 900, Vector3fImmutable.ZERO, Guild.getGuild(6), ZoneManager.getZoneByUUID(656), (short) 70, null); runeMerchant.sellPercent = 9999.00f; @@ -672,6 +675,15 @@ public class WorldServer { NPCManager.slotCharacterInBuilding(runeMerchant); runeMerchant.setLoc(runeMerchant.bindLoc); runeMerchant.updateDatabase(); + }else{ + if(resourceMerchant != null){ + for(int resourceID : Warehouse.getMaxResources().keySet()){ + MobLoot resource = new MobLoot(resourceMerchant,ItemBase.getItemBase(resourceID),1,false); + resourceMerchant.getInventory().add(resource); + } + resourceMerchant.sellPercent = 0.0f; + resourceMerchant.updateDatabase(); + } } } catch(Exception e){