diff --git a/options.cfg b/options.cfg index 4f6d91ad..cb743c88 100644 --- a/options.cfg +++ b/options.cfg @@ -1,2 +1,3 @@ -LOAD.SNAPSHOT_OBJECTS=1 -LOAD.BUILDOUT_OBJECTS=1 \ No newline at end of file +LOAD.SNAPSHOT_OBJECTS=0 +LOAD.BUILDOUT_OBJECTS=0 +LOAD.RESOURCE.SYSTEM=1 \ No newline at end of file diff --git a/scripts/object/mobile/tusken_raider.py b/scripts/object/mobile/tusken_raider.py index 37e94fa4..8c20d758 100644 --- a/scripts/object/mobile/tusken_raider.py +++ b/scripts/object/mobile/tusken_raider.py @@ -1,17 +1,24 @@ import sys +from java.util import TreeSet +from java.util import TreeMap def setup(core, object): - - lootSpecification = [ - [ - ['Junk',90], - ['Rifles',70], - ['ParentProbability',60] - ], - [ - ['Colorcrystal',100], - ['ParentProbability',50] - ] - ] - object.setLootSpecification(lootSpecification) + + lootSpecification = TreeSet() + #lootSpecification = [[['Junk',90],['Rifles',70],['ParentProbability',60]],[['Colorcrystal',100],['ParentProbability',50]]] + #object.setLootSpecification(lootSpecification) + + lootPoolNames_1 = ['Junk','Rifles'] + lootPoolChances_1 = [90,70] + lootGroupChance_1 = 80 + core.lootService.saveLootData(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) + #object.addToLootGroups(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) + + lootPoolNames2 = ['Colorcrystal'] + lootPoolChances2 = [50] + lootGroupChance2 = 60 + #core.lootService.saveLootData(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + #object.addToLootGroups(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + + #core.lootService.test3(allLootPoolNames) return \ No newline at end of file diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 0762507f..d465c5f1 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -59,6 +59,7 @@ import services.EquipmentService; import services.GroupService; import services.InstanceService; import services.LoginService; +import services.LootService; import services.MissionService; import services.PlayerService; import services.ScriptService; @@ -175,6 +176,7 @@ public class NGECore { public ResourceService resourceService; public ConversationService conversationService; + public LootService lootService; // Login Server @@ -286,6 +288,7 @@ public class NGECore { entertainmentService = new EntertainmentService(this); devService = new DevService(this); conversationService = new ConversationService(this); + lootService = new LootService(this); if (config.keyExists("JYTHONCONSOLE.PORT")) { int jythonPort = config.getInt("JYTHONCONSOLE.PORT"); diff --git a/src/resources/objects/loot/LootDrop.java b/src/resources/objects/loot/LootDrop.java index 211fdca3..08e01fbf 100644 --- a/src/resources/objects/loot/LootDrop.java +++ b/src/resources/objects/loot/LootDrop.java @@ -1,3 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ package resources.objects.loot; import java.util.ArrayList; diff --git a/src/resources/objects/loot/LootGroup.java b/src/resources/objects/loot/LootGroup.java new file mode 100644 index 00000000..1558a624 --- /dev/null +++ b/src/resources/objects/loot/LootGroup.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.objects.loot; + +/** + * @author Charon + */ + +public class LootGroup { + + private String[] lootPoolNames; + private int[] lootPoolChances; + private int lootGroupChance; + + public LootGroup(){ + + } + + public LootGroup(String[] lootPoolName, int[] lootPoolChance, int lootGroupChance){ + this.lootPoolNames = lootPoolNames; + this.lootPoolChances = lootPoolChances; + this.lootGroupChance = lootGroupChance; + } + + public void addLootData(String[] lootPoolNames, int[] lootPoolChances, int lootGroupChance){ + this.lootPoolNames = lootPoolNames; + this.lootPoolChances = lootPoolChances; + this.lootGroupChance = lootGroupChance; + } +} diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 6639ac5f..69dc7d65 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -46,6 +46,7 @@ import protocol.swg.UpdatePVPStatusMessage; import protocol.swg.objectControllerObjects.ShowFlyText; import resources.common.RGB; import resources.objects.creature.CreatureObject; +import resources.objects.loot.LootGroup; import resources.visitors.IDManagerVisitor; import services.ai.AIActor; @@ -82,8 +83,9 @@ public class TangibleObject extends SWGObject { private int respawnTime = 0; private Point3D spawnCoordinates = new Point3D(0, 0, 0); - private TreeSet> lootSpecification = new TreeSet>(); - + //private TreeSet> lootSpecification = new TreeSet>(); + private List lootGroups = new ArrayList(); + @NotPersistent private TangibleObject killer = null; @@ -451,14 +453,6 @@ public class TangibleObject extends SWGObject { } } - public TreeSet> getLootSpecification() { - return lootSpecification; - } - - public void setLootSpecification( - TreeSet> lootSpecification) { - this.lootSpecification = lootSpecification; - } @Override public void sendBaselines(Client destination) { @@ -483,4 +477,13 @@ public class TangibleObject extends SWGObject { } + + public List getLootGroups() { + return lootGroups; + } + + public void addToLootGroups(String[] lootPoolName, int[] lootPoolChance, int lootGroupChance) { + LootGroup lootGroup = new LootGroup(lootPoolName, lootPoolChance, lootGroupChance); + this.lootGroups.add(lootGroup); + } } diff --git a/src/services/DevService.java b/src/services/DevService.java index 2ce2c1f6..306958f1 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -85,6 +85,7 @@ public class DevService implements INetworkDispatch { suiOptions.put((long) 22, "Misc Items"); suiOptions.put((long) 23, "Jedi Items"); suiOptions.put((long) 110, "Survey Devices"); + suiOptions.put((long) 111, "Spawn Tusken"); break; case 3: // [Items] Weapons suiOptions.put((long) 30, "Jedi Weapons"); @@ -992,8 +993,11 @@ public class DevService implements INetworkDispatch { inventory.add(solarSurveyTool); - core.staticService.spawnObject("object/mobile/shared_tusken_raider.iff", "tatooine", 0L, 3522F, 4F, -4801F, 0.70F, 0.71F); + + break; + case 111: + core.staticService.spawnObject("object/mobile/shared_tusken_raider.iff", "tatooine", 0L, 3522F, 4F, -4801F, 0.70F, 0.71F); break; } } diff --git a/src/services/LootService.java b/src/services/LootService.java index bfa233aa..32039cb5 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -126,7 +126,7 @@ public class LootService implements INetworkDispatch { } } - + // ToDo: Group loot settings etc. // [20:35] <@_Light> your actual loot chance was lootgroupchance*lootchance @@ -158,4 +158,28 @@ public class LootService implements INetworkDispatch { return lootDropList; } + + + public void test(TreeSet test1){ + + } + + public void test2(String test2){ + System.out.println(test2); + } + + public void saveLootData(String[] lootPoolName, int[] lootPoolChance, int lootGroupChance){ + for (String ui : lootPoolName){ + System.out.println(ui); + } + for (int ui : lootPoolChance){ + System.out.println(ui); + } + + System.out.println(lootGroupChance); + + } + + + }