Browse Source

Resource Merchant

lakebane-master
FatBoy-DOTC 9 months ago
parent
commit
267549ce15
  1. 14
      src/engine/server/world/WorldServer.java

14
src/engine/server/world/WorldServer.java

@ -660,10 +660,13 @@ public class WorldServer {
try { try {
Building sdrHut = BuildingManager.getBuilding(27984); Building sdrHut = BuildingManager.getBuilding(27984);
Zone sdr = sdrHut.parentZone; Zone sdr = sdrHut.parentZone;
NPC resourceMerchant = null;
boolean exists = false; boolean exists = false;
for(NPC merchant : sdr.zoneNPCSet) for(NPC merchant : sdr.zoneNPCSet)
if(merchant.contract.getContractID() == 900) if(merchant.contract.getContractID() == 900) {
exists = true; exists = true;
resourceMerchant = merchant;
}
if (!exists) { if (!exists) {
NPC runeMerchant = NPC.createNPC("Stocky", 900, Vector3fImmutable.ZERO, Guild.getGuild(6), ZoneManager.getZoneByUUID(656), (short) 70, null); NPC runeMerchant = NPC.createNPC("Stocky", 900, Vector3fImmutable.ZERO, Guild.getGuild(6), ZoneManager.getZoneByUUID(656), (short) 70, null);
runeMerchant.sellPercent = 9999.00f; runeMerchant.sellPercent = 9999.00f;
@ -672,6 +675,15 @@ public class WorldServer {
NPCManager.slotCharacterInBuilding(runeMerchant); NPCManager.slotCharacterInBuilding(runeMerchant);
runeMerchant.setLoc(runeMerchant.bindLoc); runeMerchant.setLoc(runeMerchant.bindLoc);
runeMerchant.updateDatabase(); 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){ catch(Exception e){

Loading…
Cancel
Save