mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-31 01:15:57 -04:00
Merge branch 'master' of https://github.com/ProjectSWGCore/NGECore2
Conflicts: src/resources/objects/creature/CreatureMessageBuilder.java src/resources/objects/creature/CreatureObject.java src/services/PlayerService.java
This commit is contained in:
@@ -31,6 +31,7 @@ import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import protocol.swg.ChatSystemMessage;
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import protocol.swg.PlayClientEffectObjectMessage;
|
||||
import protocol.swg.PlayMusicMessage;
|
||||
import protocol.swg.UpdatePostureMessage;
|
||||
import protocol.swg.UpdatePVPStatusMessage;
|
||||
@@ -46,17 +47,17 @@ import engine.clients.Client;
|
||||
import resources.objects.Buff;
|
||||
import resources.objects.DamageOverTime;
|
||||
import resources.objects.SWGList;
|
||||
import resources.objects.SkillMod;
|
||||
import engine.resources.objects.IPersistent;
|
||||
import engine.resources.objects.MissionCriticalObject;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.objects.SkillMod;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
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
|
||||
@@ -85,7 +86,6 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
private int skillModsUpdateCounter = 0;
|
||||
private float speedMultiplierBase = 1;
|
||||
private float speedMultiplierMod = 1;
|
||||
private long listenToId = 0;
|
||||
private float runSpeed = (float) 7.3;
|
||||
private float slopeModAngle = 1;
|
||||
private float slopeModPercent = 1;
|
||||
@@ -113,16 +113,14 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
private String inviteSenderName;
|
||||
private long inviteCounter = 0;
|
||||
private int guildId = 0;
|
||||
private long lookAtTarget = 0;
|
||||
private long targetId = 0;
|
||||
private byte moodId = 0;
|
||||
private int performanceCounter = 0;
|
||||
private int performanceId = 0;
|
||||
//FIXME: this is a bit of a hack.
|
||||
private boolean hologram = false;
|
||||
private boolean performanceType = false;
|
||||
//FIXME: hmm.. or persistent?
|
||||
@NotPersistent
|
||||
private boolean acceptBandflourishes = true;
|
||||
@NotPersistent
|
||||
private boolean groupDance = true;
|
||||
private CreatureObject performanceWatchee;
|
||||
private CreatureObject performanceListenee;
|
||||
@@ -161,10 +159,18 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
@NotPersistent
|
||||
private ScheduledFuture<?> inspirationTick;
|
||||
|
||||
@NotPersistent
|
||||
private ScheduledFuture<?> spectatorTask;
|
||||
|
||||
private boolean staticNPC = false; // temp
|
||||
@NotPersistent
|
||||
private int flourishCount = 0;
|
||||
|
||||
@NotPersistent
|
||||
private boolean performingEffect;
|
||||
|
||||
private int coverCharge;
|
||||
|
||||
public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
|
||||
super(objectID, planet, Template, position, orientation);
|
||||
messageBuilder = new CreatureMessageBuilder(this);
|
||||
@@ -354,11 +360,10 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
this.posture = posture;
|
||||
}
|
||||
|
||||
IoBuffer postureDelta = messageBuilder.buildPostureDelta(posture);
|
||||
Posture postureUpdate = new Posture(getObjectID(), posture);
|
||||
ObjControllerMessage objController = new ObjControllerMessage(0x1B, postureUpdate);
|
||||
|
||||
notifyObservers(postureDelta, true);
|
||||
notifyObservers(messageBuilder.buildPostureDelta(posture), true);
|
||||
notifyObservers(objController, true);
|
||||
|
||||
if (needsStopPerformance) {
|
||||
@@ -376,6 +381,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
public void stopPerformance() {
|
||||
String type = "";
|
||||
synchronized(objectMutex) {
|
||||
// TODO: Minimum check to wait for song to finish before stopping... ?
|
||||
setPerformanceId(0,true);
|
||||
setPerformanceCounter(0);
|
||||
setCurrentAnimation("");
|
||||
@@ -412,7 +418,9 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
next.setMoodAnimation("");
|
||||
}
|
||||
if (next == this) { continue; }
|
||||
next.sendSystemMessage("@performance:" + type + "_stop_other",(byte)0);
|
||||
if(performanceType) { next.sendSystemMessage("You stop watching " + getCustomName() + ".",(byte)0); }
|
||||
else { next.sendSystemMessage("You stop listening to " + getCustomName() + ".",(byte)0); }
|
||||
next.getSpectatorTask().cancel(true);
|
||||
}
|
||||
//not sure if this behaviour is correct. might need fixing later.
|
||||
performanceAudience = new SWGList<CreatureObject>();
|
||||
@@ -427,11 +435,15 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
}
|
||||
|
||||
public ScheduledFuture<?> getInspirationTick() {
|
||||
return inspirationTick;
|
||||
synchronized(objectMutex) {
|
||||
return inspirationTick;
|
||||
}
|
||||
}
|
||||
|
||||
public void setInspirationTick(ScheduledFuture<?> inspirationTick) {
|
||||
this.inspirationTick = inspirationTick;
|
||||
synchronized(objectMutex) {
|
||||
this.inspirationTick = inspirationTick;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -547,7 +559,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
public SkillMod getSkillMod(String name) {
|
||||
synchronized(skillMods.getMutex()) {
|
||||
for(SkillMod skillMod : skillMods.get()) {
|
||||
if(skillMod.getSkillModString().equals(name))
|
||||
if(skillMod.getName().equals(name))
|
||||
return skillMod;
|
||||
}
|
||||
}
|
||||
@@ -562,18 +574,21 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
|
||||
public void addSkillMod(String name, int base) {
|
||||
if(getSkillMod(name) == null) {
|
||||
// TODO: Send skill mods delta in sendListDelta
|
||||
SkillMod skillMod = new SkillMod();
|
||||
skillMod.setBase(base);
|
||||
skillMod.setSkillModString(name);
|
||||
skillMod.setName(name);
|
||||
skillMod.setModifier(0);
|
||||
skillMods.add(skillMod);
|
||||
} else {
|
||||
|
||||
SkillMod mod = getSkillMod(name);
|
||||
mod.setBase(mod.getBase() + base);
|
||||
if(getClient() != null) {
|
||||
|
||||
/*if(getClient() != null) {
|
||||
setSkillModsUpdateCounter((short) (getSkillModsUpdateCounter() + 1));
|
||||
getClient().getSession().write(messageBuilder.buildAddSkillModDelta(name, mod.getBase()));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
@@ -589,24 +604,23 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
if(mod.getBase() <= 0) {
|
||||
removeSkillMod(mod);
|
||||
} else {
|
||||
if(getClient() != null) {
|
||||
skillMods.set(skillMods.indexOf(mod), mod);
|
||||
System.out.println("Deducted mod!");
|
||||
/*if(getClient() != null) {
|
||||
setSkillModsUpdateCounter((short) (getSkillModsUpdateCounter() + 1));
|
||||
getClient().getSession().write(messageBuilder.buildAddSkillModDelta(name, mod.getBase()));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeSkillMod(SkillMod mod) {
|
||||
|
||||
skillMods.remove(mod);
|
||||
|
||||
if(getClient() != null) {
|
||||
/*if(getClient() != null) {
|
||||
setSkillModsUpdateCounter((short) (getSkillModsUpdateCounter() + 1));
|
||||
getClient().getSession().write(messageBuilder.buildRemoveSkillModDelta(mod.getSkillModString(), mod.getBase()));
|
||||
}
|
||||
|
||||
|
||||
getClient().getSession().write(messageBuilder.buildRemoveSkillModDelta(mod.getName(), mod.getBase()));
|
||||
}*/
|
||||
}
|
||||
|
||||
public short getSkillModsUpdateCounter() {
|
||||
@@ -653,18 +667,6 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
notifyObservers(speedDelta, true);
|
||||
}
|
||||
|
||||
public long getListenToId() {
|
||||
synchronized(objectMutex) {
|
||||
return listenToId;
|
||||
}
|
||||
}
|
||||
|
||||
public void setListenToId(long listenToId) {
|
||||
synchronized(objectMutex) {
|
||||
this.listenToId = listenToId;
|
||||
}
|
||||
}
|
||||
|
||||
public float getRunSpeed() {
|
||||
synchronized(objectMutex) {
|
||||
return runSpeed;
|
||||
@@ -957,23 +959,43 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
this.guildId = guildId;
|
||||
}
|
||||
}
|
||||
|
||||
public long getTargetId() {
|
||||
|
||||
public long getLookAtTarget() {
|
||||
synchronized(objectMutex) {
|
||||
return lookAtTarget;
|
||||
}
|
||||
}
|
||||
|
||||
public void setLookAtTarget(long lookAtTarget) {
|
||||
synchronized(objectMutex) {
|
||||
this.lookAtTarget = lookAtTarget;
|
||||
}
|
||||
|
||||
notifyObservers(messageBuilder.buildLookAtTargetDelta(lookAtTarget), true);
|
||||
}
|
||||
|
||||
public long getIntendedTarget() {
|
||||
synchronized(objectMutex) {
|
||||
return targetId;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTargetId(long targetId) {
|
||||
public void setIntendedTarget(long intendedTarget) {
|
||||
synchronized(objectMutex) {
|
||||
this.targetId = targetId;
|
||||
this.targetId = intendedTarget;
|
||||
}
|
||||
IoBuffer targetDelta = messageBuilder.buildTargetDelta(targetId);
|
||||
|
||||
notifyObservers(targetDelta, false);
|
||||
|
||||
notifyObservers(messageBuilder.buildIntendedTargetDelta(intendedTarget), true);
|
||||
}
|
||||
|
||||
|
||||
public long getTargetId() {
|
||||
return getIntendedTarget();
|
||||
}
|
||||
|
||||
public void setTargetId(long targetId) {
|
||||
setIntendedTarget(targetId);
|
||||
}
|
||||
|
||||
public long getInviteCounter() {
|
||||
synchronized(objectMutex) {
|
||||
return inviteCounter;
|
||||
@@ -1149,7 +1171,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
*/
|
||||
|
||||
destination.getSession().write(upvpm.serialize());
|
||||
UpdatePostureMessage upm = new UpdatePostureMessage(getObjectID(), (byte) 0);
|
||||
UpdatePostureMessage upm = new UpdatePostureMessage(getObjectID(), getPosture());
|
||||
destination.getSession().write(upm.serialize());
|
||||
}
|
||||
}
|
||||
@@ -1504,7 +1526,11 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
public void removeAudience(CreatureObject audienceMember) {
|
||||
synchronized(objectMutex) {
|
||||
if (performanceAudience == null) { return; }
|
||||
performanceAudience.remove(audienceMember);
|
||||
if (audienceMember.getInspirationTick() != null)
|
||||
audienceMember.getInspirationTick().cancel(true);
|
||||
|
||||
if(performanceAudience.contains(audienceMember))
|
||||
performanceAudience.remove(audienceMember); // SWGList error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1518,9 +1544,9 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
synchronized(objectMutex) {
|
||||
this.performanceWatchee = performanceWatchee;
|
||||
}
|
||||
// not sure at this point if it makes a difference really.
|
||||
// on Live, an empty CREO4 was sent, at least when listenToId was empty.
|
||||
//getClient().getSession().write(messageBuilder.buildListenToId(0));
|
||||
|
||||
//if(this.performanceListenee == null)
|
||||
//getClient().getSession().write(messageBuilder.buildListenToId(0));
|
||||
}
|
||||
|
||||
public CreatureObject getPerformanceListenee() {
|
||||
@@ -1532,10 +1558,8 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
public void setPerformanceListenee(CreatureObject performanceListenee) {
|
||||
synchronized(objectMutex) {
|
||||
this.performanceListenee = performanceListenee;
|
||||
//possibly redundant, need to research this further.
|
||||
this.listenToId = performanceListenee.getObjectId();
|
||||
}
|
||||
getClient().getSession().write(messageBuilder.buildListenToId(this.listenToId));
|
||||
getClient().getSession().write(messageBuilder.buildListenToId(performanceListenee.getObjectId()));
|
||||
}
|
||||
|
||||
|
||||
@@ -1619,7 +1643,6 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
this.appearanceEquipmentListUpdateCounter = appearanceEquipmentListUpdateCounter;
|
||||
}
|
||||
}
|
||||
|
||||
public int getXpBarValue() {
|
||||
synchronized(objectMutex) {
|
||||
return xpBarValue;
|
||||
@@ -1633,4 +1656,51 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
getClient().getSession().write(messageBuilder.buildXPBarDelta(xpBarValue));
|
||||
}
|
||||
|
||||
public ScheduledFuture<?> getSpectatorTask() {
|
||||
synchronized(objectMutex) {
|
||||
return spectatorTask;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSpectatorTask(ScheduledFuture<?> spectatorTask) {
|
||||
synchronized(objectMutex) {
|
||||
this.spectatorTask = spectatorTask;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPerformingEffect() {
|
||||
synchronized(objectMutex) {
|
||||
return performingEffect;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPerformingEffect(boolean hasEffect) {
|
||||
synchronized(objectMutex) {
|
||||
this.performingEffect = hasEffect;
|
||||
}
|
||||
}
|
||||
|
||||
public void setHologram(boolean isHologram) {
|
||||
synchronized(objectMutex) {
|
||||
this.hologram = isHologram;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isHologram() {
|
||||
synchronized(objectMutex) {
|
||||
return hologram;
|
||||
}
|
||||
}
|
||||
|
||||
public int getCoverCharge() {
|
||||
synchronized(objectMutex) {
|
||||
return coverCharge;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCoverCharge(int coverCharge) {
|
||||
synchronized (objectMutex) {
|
||||
this.coverCharge = coverCharge;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user