diff --git a/ngengine_public.jar b/ngengine_public.jar index 079df450..d64a9419 100644 Binary files a/ngengine_public.jar and b/ngengine_public.jar differ diff --git a/scripts/loot/lootItems/exceptionallootchest/legendary_e5_carbine.py b/scripts/loot/lootItems/exceptionallootchest/legendary_e5_carbine.py index 7550577b..1e01cd9c 100644 --- a/scripts/loot/lootItems/exceptionallootchest/legendary_e5_carbine.py +++ b/scripts/loot/lootItems/exceptionallootchest/legendary_e5_carbine.py @@ -30,7 +30,7 @@ def itemStats(): stats += ['attackspeed','0.6','0.6'] stats += ['maxrange','0','50'] stats += ['damagetype','energy','energy'] - stats += ['elemtype','@obj_attr_n:elemental_electricity','@obj_attr_n:elemental_electricity'] + stats += ['elemtype','elemental_electricity','elemental_electricity'] stats += ['elemdamage','23','23'] stats += ['weapontype','1','1'] diff --git a/scripts/loot/lootItems/exceptionallootchest/legendary_fwg5_pistol.py b/scripts/loot/lootItems/exceptionallootchest/legendary_fwg5_pistol.py index 81e1e8b5..75f4059a 100644 --- a/scripts/loot/lootItems/exceptionallootchest/legendary_fwg5_pistol.py +++ b/scripts/loot/lootItems/exceptionallootchest/legendary_fwg5_pistol.py @@ -30,7 +30,7 @@ def itemStats(): stats += ['attackspeed','0.4','0.4'] stats += ['maxrange','0','35'] stats += ['damagetype','energy','energy'] - stats += ['elemtype','@obj_attr_n:elemental_heat','@obj_attr_n:elemental_heat'] + stats += ['elemtype','elemental_heat','elemental_heat'] stats += ['elemdamage','35','35'] stats += ['weapontype','2','2'] diff --git a/scripts/loot/lootItems/exceptionallootchest/legendary_nightsister_energy_lance.py b/scripts/loot/lootItems/exceptionallootchest/legendary_nightsister_energy_lance.py index 58756024..c61909e8 100644 --- a/scripts/loot/lootItems/exceptionallootchest/legendary_nightsister_energy_lance.py +++ b/scripts/loot/lootItems/exceptionallootchest/legendary_nightsister_energy_lance.py @@ -30,7 +30,7 @@ def itemStats(): stats += ['attackspeed','1.0','1.0'] stats += ['maxrange','0','5'] stats += ['damagetype','energy','energy'] - stats += ['elemtype','@obj_attr_n:elemental_electricity','@obj_attr_n:elemental_electricity'] + stats += ['elemtype','elemental_electricity','elemental_electricity'] stats += ['elemdamage','50','50'] stats += ['weapontype','7','7'] diff --git a/scripts/loot/lootItems/exceptionallootchest/legendary_power_hammer.py b/scripts/loot/lootItems/exceptionallootchest/legendary_power_hammer.py index 3224b384..6d005e80 100644 --- a/scripts/loot/lootItems/exceptionallootchest/legendary_power_hammer.py +++ b/scripts/loot/lootItems/exceptionallootchest/legendary_power_hammer.py @@ -30,7 +30,7 @@ def itemStats(): stats += ['attackspeed','1.0','1.0'] stats += ['maxrange','0','5'] stats += ['damagetype','energy','energy'] - stats += ['elemtype','@obj_attr_n:elemental_acid','@obj_attr_n:elemental_acid'] + stats += ['elemtype','elemental_acid','elemental_acid'] stats += ['elemdamage','20','20'] stats += ['weapontype','5','5'] diff --git a/scripts/loot/lootItems/exceptionallootchest/legendary_stun_baton.py b/scripts/loot/lootItems/exceptionallootchest/legendary_stun_baton.py index cbc9cb70..d5b7f390 100644 --- a/scripts/loot/lootItems/exceptionallootchest/legendary_stun_baton.py +++ b/scripts/loot/lootItems/exceptionallootchest/legendary_stun_baton.py @@ -30,7 +30,7 @@ def itemStats(): stats += ['attackspeed','1.0','1.0'] stats += ['maxrange','0','5'] stats += ['damagetype','energy','energy'] - stats += ['elemtype','@obj_attr_n:elemental_electricity','@obj_attr_n:elemental_electricity'] + stats += ['elemtype','elemental_electricity','elemental_electricity'] stats += ['elemdamage','75','75'] stats += ['weapontype','5','5'] diff --git a/scripts/loot/lootItems/exceptionallootchest/legendary_t21_rifle.py b/scripts/loot/lootItems/exceptionallootchest/legendary_t21_rifle.py index 66a8dd30..16fd22cf 100644 --- a/scripts/loot/lootItems/exceptionallootchest/legendary_t21_rifle.py +++ b/scripts/loot/lootItems/exceptionallootchest/legendary_t21_rifle.py @@ -30,7 +30,7 @@ def itemStats(): stats += ['attackspeed','0.8','0.8'] stats += ['maxrange','0','64'] stats += ['damagetype','energy','energy'] - stats += ['elemtype','@obj_attr_n:elemental_acid','@obj_attr_n:elemental_acid'] + stats += ['elemtype','elemental_acid','elemental_acid'] stats += ['elemdamage','30','30'] stats += ['weapontype','0','0'] diff --git a/src/services/LootService.java b/src/services/LootService.java index e710b4a2..fe64b7e9 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -42,7 +42,6 @@ import java.util.concurrent.atomic.AtomicInteger; import protocol.swg.PlayClientEffectObjectTransformMessage; import protocol.swg.StopClientEffectObjectByLabel; -import resources.objects.craft.DraftSchematic; import resources.common.OutOfBand; import resources.datatables.DisplayType; import resources.loot.LootGroup; @@ -76,7 +75,7 @@ public class LootService implements INetworkDispatch { private NGECore core; private static int prepInvCnt = 0; String testDropTemplate = null; - //String testDropTemplate = "sunriders_destiny"; + //String testDropTemplate = "composite_armor_bracer_left"; public LootService(NGECore core) { this.core = core; @@ -544,7 +543,8 @@ public class LootService implements INetworkDispatch { if (randomItemFromPool<=remainder){ // this element has been chosen e.g. kraytpearl_flawless //System.err.println("CHOSEN ITEM " + itemNames.get(i)); - handleLootPoolItems(itemNames.get(i), lootRollSession); + handleLootPoolItems(itemNames.get(i), lootRollSession); + //handleLootPoolItems(testDropTemplate, lootRollSession); //break; return; } @@ -564,6 +564,7 @@ public class LootService implements INetworkDispatch { rollSession.setSessionPlanet(requester.getPlanet()); handleLootPoolItems(template, rollSession); + if(rollSession.getDroppedItems().get(0) != null) return rollSession.getDroppedItems().get(0); return null; @@ -615,9 +616,12 @@ public class LootService implements INetworkDispatch { String requiredFaction = ""; Vector customizationAttributes = null; Vector customizationValues = null; + int customColor1 = 0; + String lootDescriptor = ""; Vector itemStats = null; Vector itemSkillMods = null; Vector STFparams = null; + String addToCollection = null; if(core.scriptService.getMethod(itemPath,"","itemTemplate")==null){ String errorMessage = "Loot item '" + itemName + "' has no template function assigned in its script. Please contact Charon about this issue."; @@ -645,6 +649,12 @@ public class LootService implements INetworkDispatch { if(core.scriptService.getMethod(itemPath,"","customizationValues")!=null) customizationValues = (Vector)core.scriptService.fetchIntegerVector(itemPath,"customizationValues"); + if(core.scriptService.getMethod(itemPath,"","customColor1")!=null) + customColor1 = (Integer)core.scriptService.fetchInteger(itemPath,"customColor1"); + + if(core.scriptService.getMethod(itemPath,"","lootDescriptor")!=null) + lootDescriptor = (String)core.scriptService.fetchString(itemPath,"lootDescriptor"); + if(core.scriptService.getMethod(itemPath,"","itemStats")!=null) itemStats = (Vector)core.scriptService.fetchStringVector(itemPath,"itemStats"); @@ -675,6 +685,9 @@ public class LootService implements INetworkDispatch { if(core.scriptService.getMethod(itemPath,"","STFparams")!=null) STFparams = (Vector)core.scriptService.fetchStringVector(itemPath,"STFparams"); + if(core.scriptService.getMethod(itemPath,"","AddToCollection")!=null) + addToCollection = (String)core.scriptService.fetchString(itemPath,"AddToCollection"); + System.out.println("itemTemplate " + itemTemplate); @@ -683,6 +696,10 @@ public class LootService implements INetworkDispatch { droppedItem.setLootItem(true); droppedItem.setAttachment("LootItemName", itemName); + droppedItem.setAttachment("customColor1", customColor1); + droppedItem.setAttachment("lootDescriptor", lootDescriptor); + droppedItem.setAttachment("customName", customName); + if(core.scriptService.getMethod(itemPath,"","randomStatJewelry")!=null){ customName = setRandomStatsJewelry(droppedItem, lootRollSession); @@ -716,7 +733,7 @@ public class LootService implements INetworkDispatch { lootRollSession.addErrorMessage(errorMessage); return; } - handleStats(droppedItem, itemStats); + handleStats(droppedItem, itemStats, lootRollSession); } if (itemSkillMods!=null){ @@ -727,6 +744,12 @@ public class LootService implements INetworkDispatch { setSTFParams(droppedItem, STFparams); } + if (addToCollection!=null){ + droppedItem.getAttributes().put("@obj_attr_n:collection_name", "@collection_n:"+addToCollection); + //droppedItem.getAttributes().put("@obj_attr_n:collection_name", "\\#FFFF00 @collection_n:"+addToCollection + " \\#FFFFFF "); + //core.collectionService.addCollection(actor, "new_prof_officer_master") + } + // if (customizationValues!=null) @@ -1171,7 +1194,7 @@ public class LootService implements INetworkDispatch { String errorMessage = "Loot item '" + itemName + "' has a wrong number of itemstats. Please contact Charon about this issue."; return; } - handleStats(droppedItem, itemStats); + handleStats(droppedItem, itemStats,null); } if (itemSkillMods!=null){ @@ -1183,7 +1206,8 @@ public class LootService implements INetworkDispatch { } if (addToCollection!=null){ - droppedItem.getAttributes().put("@obj_attr_n:collection_name", addToCollection); + droppedItem.getAttributes().put("@obj_attr_n:collection_name", "@collection_n:"+addToCollection); + //droppedItem.getAttributes().put("@obj_attr_n:collection_name", "\\#FFFF00 @collection_n:"+addToCollection + " \\#FFFFFF "); //core.collectionService.addCollection(actor, "new_prof_officer_master") } @@ -1252,6 +1276,10 @@ public class LootService implements INetworkDispatch { droppedItem.getAttributes().put("@obj_attr_n:color", resources.datatables.LightsaberColors.get(crystalColor)); droppedItem.setAttachment("radial_filename", "item/tunable"); //droppedItem.getAttributes().put("@obj_attr_n:color", "@jedi_spam:saber_color_" + crystalColor); // Commented out for now + + String[] crystalColorElementalMapping = new String[]{"heat","heat","acid","acid","cold","cold","cold","acid","electricity","electricity","heat","heat"}; + setCrystalStat(droppedItem, "elemtype", crystalColorElementalMapping[crystalColor],crystalColorElementalMapping[crystalColor]); + setCrystalStat(droppedItem, "elemdamage", "2", "2"); } else { for (int i=0; i itemStats) { + private void handleStats(TangibleObject droppedItem, Vector itemStats, LootRollSession lootRollSession) { if (droppedItem.getTemplate().contains("object/weapon")){ WeaponObject weaponObject = (WeaponObject) droppedItem; @@ -1321,8 +1349,10 @@ public class LootService implements INetworkDispatch { String statName = itemStats.get(3*i); String minValue = itemStats.get(3*i+1); String maxValue = itemStats.get(3*i+2); - setArmorStat(droppedItem, statName, minValue, maxValue); + setArmorStat(droppedItem, statName, minValue, maxValue); } + if (lootRollSession != null) + setRandomAttributes(droppedItem,lootRollSession); } String lootDescriptor = (String)droppedItem.getAttachment("lootDescriptor"); @@ -1334,6 +1364,7 @@ public class LootService implements INetworkDispatch { String minValue = itemStats.get(3*i+1); String maxValue = itemStats.get(3*i+2); setCrystalStat(droppedItem, statName, minValue, maxValue); + return; } } @@ -1343,11 +1374,89 @@ public class LootService implements INetworkDispatch { String minValue = itemStats.get(3*i+1); String maxValue = itemStats.get(3*i+2); setBuffItemStat(droppedItem, statName, minValue, maxValue); + return; } - } - + } } + private void setRandomAttributes(TangibleObject droppedItem, LootRollSession lootRollSession){ + + //determine number of stats #20 yt + int statNumber = 1; + int levelOfDrop = lootRollSession.getLootedObjectLevel(); + int difficultyLevel = lootRollSession.getLootedObjectDifficulty(); // better for calculation + + int statRoll = new Random().nextInt(100); + int difficultyBonus = 0; + +// // stage 1 +// if (difficultyLevel==1) +// difficultyBonus = 60; +// if (difficultyLevel>=2) +// difficultyBonus = 75; +// +// if (statRoll<20+difficultyBonus) // diff 3 95% diff 2 70 diff1 20 +// statNumber++; +// +// // stage 2 +// difficultyBonus = 0; +// if (difficultyLevel==1) +// difficultyBonus = 20; +// if (difficultyLevel>=2) +// difficultyBonus = 60; +// +// if (statRoll<10+difficultyBonus) // diff 3 70% diff 2 30 diff1 10 +// statNumber++; +// +// // stage 3 +// difficultyBonus = 0; +// if (difficultyLevel==1) +// difficultyBonus = 3; +// if (difficultyLevel>=2) +// difficultyBonus = 5; +// +// if (statRoll<1+difficultyBonus) +// statNumber++; + + if (levelOfDrop>60 && levelOfDrop<=90 && difficultyLevel<1){ + statNumber=2; + } + + if (levelOfDrop>84 && difficultyLevel>=1){ + statNumber=3; + } + + + int primaryAttribute = new Random().nextInt(7); // 0-6 + int maxValue = (int) (levelOfDrop*25/90); + int minValue = (int) (0.75*maxValue); + minValue = Math.max(1, minValue); + maxValue = Math.max(2, maxValue); + droppedItem.setIntAttribute(getAttributeSTF(primaryAttribute), getStatValue(minValue,maxValue)); + //maxValue -= 2; //secondary attributes must have less maxValue + minValue = (int) (0.75*maxValue); + minValue = Math.max(1, minValue); + maxValue = Math.max(2, maxValue); + String prefix = getJewelryPrefix(droppedItem); + String suffix = getJewelrySuffix(primaryAttribute, statNumber); + String itemName = prefix + suffix; + Vector alreadyUsedStats = new Vector(); + alreadyUsedStats.add(primaryAttribute); + int attribute = primaryAttribute; + + List statList = new ArrayList(); + for (int i=0;i<7;i++) + statList.add(i); + statList.remove(primaryAttribute); + + for (int i=0;i skillMods) { for (int i=0;i