From 8e8876587c5521fb8ca3eef4d560db32e2f03af9 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 18 Feb 2024 18:25:26 -0600 Subject: [PATCH] resource merchant work --- src/engine/server/world/WorldServer.java | 49 +++++++++++++++++++----- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index c18e4953..ac8c1c3e 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -649,28 +649,57 @@ public class WorldServer { Logger.error("FAILED TO ADD RUNE MERCHANT"); } try { - Building sdrHut = BuildingManager.getBuilding(27984); - if(sdrHut.getHirelings().size() < 2) { - NPC resourceMerchant = NPC.createNPC("Resource Merchant", 830, Vector3fImmutable.ZERO, Guild.getGuild(6), ZoneManager.getZoneByUUID(656), (short) 70, null); + Building sdrHut = BuildingManager.getBuilding(27979); + if (sdrHut.getHirelings().size() < 1) { + NPC resourceMerchant = NPC.createNPC("Resource Merchant", 12287, Vector3fImmutable.ZERO, Guild.getGuild(6), ZoneManager.getZoneByUUID(656), (short) 70, null); resourceMerchant.sellPercent = 0; - resourceMerchant.contract.vendorDialog = VendorDialog.getVendorDialog(623); resourceMerchant.buildingUUID = sdrHut.getObjectUUID(); resourceMerchant.building = sdrHut; NPCManager.slotCharacterInBuilding(resourceMerchant); resourceMerchant.setLoc(resourceMerchant.bindLoc); - //resourceMerchant.contract.getSellInventory().clear(); - for(int resourceID : Warehouse.getMaxResources().keySet()){ - if(resourceID == 7 || resourceID == 1580021) + resourceMerchant.contract.getSellInventory().clear(); + for(int resourceID : Warehouse.getMaxResources().keySet()) { + if (resourceID == 7 || resourceID == 1580021) continue; - MobLoot resource = new MobLoot(resourceMerchant,ItemBase.getItemBase(resourceID), 1, true); - resource.setValue(Warehouse.getCostForResource(resourceID)); - resourceMerchant.getCharItemManager().addItemToInventory(resource); + //MobLoot resource = new MobLoot(resourceMerchant, ItemBase.getItemBase(resourceID), 1, true); + //resource.setValue(Warehouse.getCostForResource(resourceID)); + //resourceMerchant.getCharItemManager().addItemToInventory(resource); + MobEquipment resource = new MobEquipment(ItemBase.getItemBase(resourceID),0,0); + resourceMerchant.contract.getSellInventory().add(resource); + } + for (MobEquipment item : resourceMerchant.contract.getSellInventory()) { + item.magicValue = Warehouse.getCostForResource(item.getItemBase().getUUID()); } } } catch(Exception e){ Logger.error("FAILED TO ADD RUNE MERCHANT"); } + + //try { + // Building sdrHut = BuildingManager.getBuilding(27984); + // if(sdrHut.getHirelings().size() < 2) { + // NPC resourceMerchant = NPC.createNPC("Resource Merchant", 830, Vector3fImmutable.ZERO, Guild.getGuild(6), ZoneManager.getZoneByUUID(656), (short) 70, null); + // resourceMerchant.sellPercent = 0; + // resourceMerchant.contract.vendorDialog = VendorDialog.getVendorDialog(623); + // resourceMerchant.buildingUUID = sdrHut.getObjectUUID(); + // resourceMerchant.building = sdrHut; + // NPCManager.slotCharacterInBuilding(resourceMerchant); + // resourceMerchant.setLoc(resourceMerchant.bindLoc); + // //resourceMerchant.contract.getSellInventory().clear(); + // Contract contract = resourceMerchant.contract. + // for(int resourceID : Warehouse.getMaxResources().keySet()){ + // if(resourceID == 7 || resourceID == 1580021) + // continue; + // MobLoot resource = new MobLoot(resourceMerchant,ItemBase.getItemBase(resourceID), 1, true); + // resource.setValue(Warehouse.getCostForResource(resourceID)); + // resourceMerchant.getCharItemManager().addItemToInventory(resource); + // } + // } + //} + //catch(Exception e){ + // Logger.error("FAILED TO ADD RUNE MERCHANT"); + //} Logger.info("time to load World Objects: " + (System.currentTimeMillis() - start) + " ms"); }