diff --git a/src/resources/common/Difficulty.java b/src/resources/common/Difficulty.java new file mode 100644 index 00000000..e1229723 --- /dev/null +++ b/src/resources/common/Difficulty.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * 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.common; + +public class Difficulty { + + public static byte NORMAL = 0; // Normal + public static byte ELITE = 1; // Elite + public static byte BOSS = 2; // Gold elite + +} diff --git a/src/resources/common/Options.java b/src/resources/common/Options.java index 136c7462..5b8faa0e 100644 --- a/src/resources/common/Options.java +++ b/src/resources/common/Options.java @@ -25,7 +25,7 @@ public class Options { // Any uncommented ones are confirmed correct for NGE with detailed analysis - public static int NONE = 0; + public static int NONE = 0; // HAM is visible, but health is grey without the Attackable flag public static int SPACE_ATTACKABLE = 1; // Ships that are attackable in space. Includes everything except stations and asteroids so far public static int USABLE = 2; // Vendors, collections (hand icon) public static int INSURED = 4; // Unused in NGE diff --git a/src/resources/objects/creature/CreatureMessageBuilder.java b/src/resources/objects/creature/CreatureMessageBuilder.java index ac7ceac5..90ed5851 100644 --- a/src/resources/objects/creature/CreatureMessageBuilder.java +++ b/src/resources/objects/creature/CreatureMessageBuilder.java @@ -366,8 +366,9 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { buffer.putInt(1); } - - buffer.putShort((short) 0); + + buffer.put((byte) 0); + buffer.put(creature.getDifficulty()); buffer.putInt(0xFFFFFFFF); buffer.put((byte) 1); buffer.putShort((short) 0); @@ -982,6 +983,15 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { } + public IoBuffer buildDifficultyDelta(byte difficulty) { + IoBuffer buffer = bufferPool.allocate(1, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.put(difficulty); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x1C, buffer, size + 4); + return buffer; + } + @Override public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { // TODO Auto-generated method stub diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 84601b4a..ea367d8f 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -45,7 +45,6 @@ import engine.clients.Client; import resources.objects.Buff; import resources.objects.DamageOverTime; import resources.objects.SWGList; -import engine.resources.common.CRC; import engine.resources.objects.IPersistent; import engine.resources.objects.MissionCriticalObject; import engine.resources.objects.SWGObject; @@ -56,7 +55,7 @@ import engine.resources.scene.Quaternion; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; -@Entity(version=2) +@Entity(version=3) public class CreatureObject extends TangibleObject implements IPersistent { @NotPersistent @@ -131,6 +130,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { private SWGList buffList = new SWGList(); @NotPersistent private int buffListUpdateCounter = 0; + private byte difficulty = 0; private SWGList appearanceEquipmentList; @NotPersistent private int appearanceEquipmentListUpdateCounter = 0; @@ -1321,4 +1321,18 @@ public class CreatureObject extends TangibleObject implements IPersistent { notifyObservers(new UpdatePVPStatusMessage(getObjectID(), getPvPBitmask(), getFaction()), false); } + public byte getDifficulty() { + synchronized(objectMutex) { + return difficulty; + } + } + + public void setDifficulty(byte difficulty) { + synchronized(objectMutex) { + this.difficulty = difficulty; + } + + notifyObservers(messageBuilder.buildDifficultyDelta(difficulty), true); + } + }