setDifficulty(Difficulty.NORMAL/ELITE/BOSS)

This commit is contained in:
Treeku
2013-12-05 12:53:34 +00:00
parent 42fca91fa5
commit 3bb0d0534c
4 changed files with 59 additions and 5 deletions
+30
View File
@@ -0,0 +1,30 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* 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 <http://www.gnu.org/licenses/>.
*
* 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
}
+1 -1
View File
@@ -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
@@ -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
@@ -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<Buff> buffList = new SWGList<Buff>();
@NotPersistent
private int buffListUpdateCounter = 0;
private byte difficulty = 0;
private SWGList<SWGObject> 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);
}
}