mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-11 21:45:43 -04:00
Merge branch 'master' of https://github.com/ProjectSWGCore/NGECore2
This commit is contained in:
@@ -13,6 +13,9 @@ def run(core, actor, target, commandString):
|
||||
|
||||
object = core.objectService.createObject(commandString, actor.getPlanet())
|
||||
|
||||
#object.setCustomizationVariable('/private/index_color_blade', 0x02)
|
||||
#object.setCustomizationVariable('private/alternate_shader_blade', 0x02)
|
||||
|
||||
if not object:
|
||||
return
|
||||
|
||||
|
||||
@@ -21,35 +21,40 @@
|
||||
******************************************************************************/
|
||||
package resources.objects.tangible;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import main.NGECore;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
import main.NGECore;
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import protocol.swg.PlayClientEffectObjectMessage;
|
||||
import protocol.swg.StopClientEffectObjectByLabel;
|
||||
import protocol.swg.UpdatePVPStatusMessage;
|
||||
import protocol.swg.objectControllerObjects.ShowFlyText;
|
||||
|
||||
import resources.common.RGB;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.visitors.IDManagerVisitor;
|
||||
import services.ai.AIActor;
|
||||
|
||||
import com.sleepycat.persist.model.NotPersistent;
|
||||
import com.sleepycat.persist.model.Persistent;
|
||||
|
||||
import engine.clientdata.ClientFileManager;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
@Persistent(version=0)
|
||||
@Persistent(version=1)
|
||||
public class TangibleObject extends SWGObject {
|
||||
|
||||
// TODO: Thread safety
|
||||
@@ -59,6 +64,7 @@ public class TangibleObject extends SWGObject {
|
||||
protected int pvpBitmask = 0;
|
||||
protected byte[] customization;
|
||||
private List<Integer> componentCustomizations = new ArrayList<Integer>();
|
||||
private Map<String, Byte> customizationVariables = new HashMap<String, Byte>();
|
||||
protected int optionsBitmask = 0;
|
||||
private int maxDamage = 1000;
|
||||
private boolean staticObject = true;
|
||||
@@ -241,6 +247,50 @@ public class TangibleObject extends SWGObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void setCustomizationVariable(String type, byte value)
|
||||
{
|
||||
if(customizationVariables.containsKey(type)) customizationVariables.replace(type, value);
|
||||
else customizationVariables.put(type, value);
|
||||
|
||||
buildCustomizationBytes();
|
||||
}
|
||||
|
||||
public void removeCustomizationVariable(String type)
|
||||
{
|
||||
if(customizationVariables.containsKey(type))
|
||||
{
|
||||
customizationVariables.remove(type);
|
||||
buildCustomizationBytes();
|
||||
}
|
||||
}
|
||||
|
||||
private void buildCustomizationBytes()
|
||||
{
|
||||
//if(customizationVariables.size() == 0) customization = { 0x00 };
|
||||
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
try
|
||||
{
|
||||
IDManagerVisitor visitor = ClientFileManager.loadFile("customization/customization_id_manager.iff", IDManagerVisitor.class);
|
||||
|
||||
stream.write((byte)0x02); // Unk
|
||||
stream.write((byte)customizationVariables.size()); // Number of customization attributes
|
||||
|
||||
for(String type : customizationVariables.keySet())
|
||||
{
|
||||
stream.write(visitor.getAttributeIndex(type)); // Index of palette type within "customization/customization_id_manager.iff"
|
||||
stream.write(customizationVariables.get(type)); // Value/Index within palette
|
||||
|
||||
// Seperator/Footer
|
||||
stream.write((byte) 0xC3);
|
||||
stream.write((byte) 0xBF);
|
||||
stream.write((byte) 0x03);
|
||||
}
|
||||
customization = stream.toByteArray();
|
||||
}
|
||||
catch (Exception e) { e.printStackTrace(); }
|
||||
}
|
||||
|
||||
public String getFaction() {
|
||||
synchronized(objectMutex) {
|
||||
return faction;
|
||||
|
||||
@@ -31,11 +31,11 @@ import engine.clientdata.VisitorInterface;
|
||||
|
||||
public class IDManagerVisitor implements VisitorInterface {
|
||||
|
||||
private ConcurrentHashMap<String, Short> customizationMap;
|
||||
private ConcurrentHashMap<String, Byte> customizationMap;
|
||||
private CharsetDecoder charsetDecoder;
|
||||
|
||||
public IDManagerVisitor() {
|
||||
customizationMap = new ConcurrentHashMap<String, Short>();
|
||||
customizationMap = new ConcurrentHashMap<String, Byte>();
|
||||
charsetDecoder = Charset.forName("US-ASCII").newDecoder();
|
||||
}
|
||||
|
||||
@@ -46,21 +46,28 @@ public class IDManagerVisitor implements VisitorInterface {
|
||||
return;
|
||||
|
||||
while(data.hasRemaining()) {
|
||||
short designNumber = data.getShort();
|
||||
|
||||
byte designNumber = data.get();
|
||||
data.get();
|
||||
String customizationType = data.getString(charsetDecoder);
|
||||
charsetDecoder.reset();
|
||||
|
||||
|
||||
customizationMap.put(customizationType, designNumber);
|
||||
|
||||
//System.out.println(designNumber + ": " + customizationType);
|
||||
}
|
||||
}
|
||||
|
||||
public byte getAttributeIndex(String type)
|
||||
{
|
||||
return customizationMap.get(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyFolder(String node, int depth) throws Exception {
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<String, Short> getCustomizationMap() {
|
||||
public ConcurrentHashMap<String, Byte> getCustomizationMap() {
|
||||
return this.customizationMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,27 +231,33 @@ public class DevService implements INetworkDispatch {
|
||||
return;
|
||||
// [Items] Weapons
|
||||
case 30: // Jedi Weapons
|
||||
SWGObject lightsaber1 = core.objectService.createObject("object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff", planet);
|
||||
TangibleObject lightsaber1 = (TangibleObject) core.objectService.createObject("object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff", planet);
|
||||
lightsaber1.setIntAttribute("required_combat_level", 90);
|
||||
lightsaber1.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1);
|
||||
lightsaber1.setStringAttribute("class_required", "Jedi");
|
||||
lightsaber1.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy");
|
||||
lightsaber1.setStringAttribute("cat_wpn_damage.damage", "689-1379");
|
||||
|
||||
SWGObject lightsaber2 = core.objectService.createObject("object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff", planet);
|
||||
TangibleObject lightsaber2 = (TangibleObject) core.objectService.createObject("object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff", planet);
|
||||
lightsaber2.setIntAttribute("required_combat_level", 90);
|
||||
lightsaber2.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1);
|
||||
lightsaber2.setStringAttribute("class_required", "Jedi");
|
||||
lightsaber2.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy");
|
||||
lightsaber2.setStringAttribute("cat_wpn_damage.damage", "689-1379");
|
||||
|
||||
SWGObject lightsaber3 = core.objectService.createObject("object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff", planet);
|
||||
TangibleObject lightsaber3 = (TangibleObject) core.objectService.createObject("object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff", planet);
|
||||
lightsaber3.setIntAttribute("required_combat_level", 90);
|
||||
lightsaber3.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1);
|
||||
lightsaber3.setStringAttribute("class_required", "Jedi");
|
||||
lightsaber3.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy");
|
||||
lightsaber3.setStringAttribute("cat_wpn_damage.damage", "689-1379");
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
lightsaber1.setCustomizationVariable("/private/index_color_blade", (byte) random.nextInt(47));
|
||||
lightsaber2.setCustomizationVariable("/private/index_color_blade", (byte) random.nextInt(47));
|
||||
lightsaber3.setCustomizationVariable("/private/index_color_blade", (byte) random.nextInt(47));
|
||||
|
||||
inventory.add(lightsaber1);
|
||||
inventory.add(lightsaber2);
|
||||
inventory.add(lightsaber3);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
private ConcurrentHashMap<Integer,Performance> performancesByIndex = new ConcurrentHashMap<Integer,Performance>();
|
||||
private ConcurrentHashMap<Integer,Performance> danceMap = new ConcurrentHashMap<Integer,Performance>();
|
||||
|
||||
private ConcurrentHashMap<String, Short> designMap = new ConcurrentHashMap<String, Short>();
|
||||
private ConcurrentHashMap<String, Byte> designMap = new ConcurrentHashMap<String, Byte>();
|
||||
|
||||
private Random ranWorkshop = new Random();
|
||||
|
||||
@@ -932,7 +932,7 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
|
||||
public String getCustomizationString(int number){
|
||||
synchronized (designMap) {
|
||||
for (Entry<String, Short> entry : designMap.entrySet()) {
|
||||
for (Entry<String, Byte> entry : designMap.entrySet()) {
|
||||
if (entry.getValue().intValue() == number) {
|
||||
return entry.getKey();
|
||||
}
|
||||
@@ -943,7 +943,7 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
|
||||
public int getCustomizationValue(String customizationString) {
|
||||
synchronized(designMap){
|
||||
for(Entry<String, Short> entry : designMap.entrySet()) {
|
||||
for(Entry<String, Byte> entry : designMap.entrySet()) {
|
||||
if (entry.getKey().equals(customizationString)) {
|
||||
return entry.getValue().intValue();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user