From e92d8378a0861aa6a1043636284f52db6bf89023 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Thu, 26 Jun 2014 00:12:01 +0200 Subject: [PATCH] Fixes for older issues Fixes #478 Fixes #599 Added rare components to foraging --- src/resources/common/Forager.java | 80 ++++++++++++++++++++++++++++++- src/services/SurveyService.java | 3 ++ 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/src/resources/common/Forager.java b/src/resources/common/Forager.java index 71874a78..98911cbc 100644 --- a/src/resources/common/Forager.java +++ b/src/resources/common/Forager.java @@ -22,6 +22,7 @@ package resources.common; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Random; import java.util.Vector; @@ -50,6 +51,71 @@ public class Forager { public static final int WORM_BAIT = 4; public static final int MYSTERIOUS_DATA_DISC = 5; + public static final String[] RARE_COMPONENTS_CORELLIA = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_charbote.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_goldfruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_kavasa_fruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_salthia.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_sunfruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_vweilu.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_yam.iff" + }; + + public static final String[] RARE_COMPONENTS_DANTOOINE = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_barabel.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_celonslay.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_dorian.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_kibla_greens.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_shefna_fruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_tritacale.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_yot_beans.iff" + }; + + public static final String[] RARE_COMPONENTS_DATHOMIR = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_beebleberry.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_driblis.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_dricklefruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_grape.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_hwotha.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_plaitfruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_qana.iff" + }; + + public static final String[] RARE_COMPONENTS_ENDOR = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_acorns.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_blumfruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_burr_ball.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_gin_jang_berry.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_honey_melon.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_sunberries.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_yubnut.iff" + }; + + public static final String[] RARE_COMPONENTS_NABOO = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_cligs.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_cracknut.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_denta.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_muja.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_ootoowergs.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_phraig.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_stinkmelon.iff" + }; + + public static final String[] RARE_COMPONENTS_TATOOINE = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_banthaweed.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_bestinnian.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_bloddle.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_bristlemelon.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_tatoes.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_wyykmelons.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_zog.iff" + }; + + public static final String[] RARE_COMPONENTS_YAVIN = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_blueleaf_shrub.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_celto.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_farrberries.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_sweetmelon.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_topatoes.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_trig_berries.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_wuli_nuts.iff" + }; + + private static final HashMap rareComponentHash= new HashMap(); + private int[] mapPlanetIDs = new int[]{6,7,8}; // consider foraged food food/foraged @@ -77,7 +143,14 @@ public class Forager { int[] forageChances = new int[]{10,10,25,25,25,5}; int[] forageChances2 = new int[]{12,10,21,23,24,10}; // Kommerken Steak int[] forageChances3 = new int[]{20,9,22,22,22,5}; // if you got the pig - + + rareComponentHash.put(1,RARE_COMPONENTS_TATOOINE); + rareComponentHash.put(2,RARE_COMPONENTS_NABOO); + rareComponentHash.put(3,RARE_COMPONENTS_CORELLIA); + rareComponentHash.put(6,RARE_COMPONENTS_DANTOOINE); + rareComponentHash.put(8,RARE_COMPONENTS_YAVIN); + rareComponentHash.put(9,RARE_COMPONENTS_ENDOR); + rareComponentHash.put(10,RARE_COMPONENTS_DATHOMIR); int chosenObject = 0; @@ -120,7 +193,10 @@ public class Forager { forager.sendSystemMessage("",(byte) 0); break; - case RARE_COMPONENT: template = "object/tangible/loot/beast/shared_enzyme_1.iff"; // for now, must find temp + case RARE_COMPONENT: template = ""; + String[] componentArray = rareComponentHash.get(forager.getPlanetId()); + int componentRoll = new Random().nextInt(componentArray.length); + template = componentArray[componentRoll]; foragedObject = (TangibleObject) NGECore.getInstance().objectService.createObject(template, forager.getPlanet()); foragerInventory.add(foragedObject); forager.sendSystemMessage("",(byte) 0); diff --git a/src/services/SurveyService.java b/src/services/SurveyService.java index b218982a..ff01a6fb 100644 --- a/src/services/SurveyService.java +++ b/src/services/SurveyService.java @@ -273,6 +273,9 @@ public class SurveyService implements INetworkDispatch { if (target==null) return; // target object not valid + if (crafter.getContainer()!=null) + return; + SurveyTool surveyTool = (SurveyTool)target; if (surveyTool.getToolType()==-1) return; // Survey tool type was not recognized