mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-30 15:13:10 -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:
@@ -16,47 +16,56 @@
|
||||
* 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.
|
||||
* 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.objects;
|
||||
|
||||
public class BuffItem {
|
||||
private String skillName;
|
||||
private int affectAmount;
|
||||
private int entertainerBonus;
|
||||
private int invested;
|
||||
private int bonusAmount; // expertise bonus (50%*4 = 200) which would then result in bonusAmount + (maxTimesApplied * affectAmount) = result
|
||||
|
||||
private String skillName;
|
||||
|
||||
public BuffItem() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public BuffItem(String skillName, int invested, int amount) {
|
||||
|
||||
public BuffItem(String skillName, int invested, int entBonus) {
|
||||
this.skillName = skillName;
|
||||
this.invested = invested;
|
||||
this.bonusAmount = amount;
|
||||
this.entertainerBonus = entBonus;
|
||||
}
|
||||
|
||||
public String getSkillName() {
|
||||
return skillName;
|
||||
public int getAffectAmount() {
|
||||
return affectAmount;
|
||||
}
|
||||
|
||||
public void setSkillName(String skillName) {
|
||||
this.skillName = skillName;
|
||||
public int getEntertainerBonus() {
|
||||
return entertainerBonus;
|
||||
}
|
||||
|
||||
public int getInvested() {
|
||||
return invested;
|
||||
}
|
||||
|
||||
public String getSkillName() {
|
||||
return skillName;
|
||||
}
|
||||
|
||||
public void setAffectAmount(int amount) {
|
||||
this.affectAmount = amount;
|
||||
}
|
||||
|
||||
public void setEntertainerBonus(int entertainerBonus) {
|
||||
this.entertainerBonus = entertainerBonus;
|
||||
}
|
||||
|
||||
public void setInvested(int invested) {
|
||||
this.invested = invested;
|
||||
}
|
||||
|
||||
public int getBonusAmount() {
|
||||
return bonusAmount;
|
||||
}
|
||||
|
||||
public void setBonusAmount(int amount) {
|
||||
this.bonusAmount = amount;
|
||||
public void setSkillName(String skillName) {
|
||||
this.skillName = skillName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/*******************************************************************************
|
||||
* 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.objects;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import com.sleepycat.persist.model.Persistent;
|
||||
|
||||
@Persistent
|
||||
public class SkillMod extends Delta {
|
||||
|
||||
private int base;
|
||||
private int modifier;
|
||||
private String name;
|
||||
|
||||
public SkillMod() {
|
||||
}
|
||||
|
||||
public SkillMod(String name, int base, int modifier) {
|
||||
this.name = name;
|
||||
this.base = base;
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public int getBase() {
|
||||
return base;
|
||||
}
|
||||
|
||||
public void setBase(int base) {
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
public int getModifier() {
|
||||
return modifier;
|
||||
}
|
||||
|
||||
public void setModifier(int modifier) {
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes() {
|
||||
IoBuffer buffer = createBuffer(name.length() + 10);
|
||||
|
||||
buffer.put(getAsciiString(name));
|
||||
buffer.putInt(base);
|
||||
buffer.putInt(modifier);
|
||||
|
||||
return buffer.array();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,9 +31,8 @@ import com.sleepycat.persist.model.Persistent;
|
||||
import engine.resources.common.CRC;
|
||||
import resources.objects.Buff;
|
||||
import resources.objects.ObjectMessageBuilder;
|
||||
import resources.objects.SkillMod;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.objects.SkillMod;
|
||||
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.weapon.WeaponObject;
|
||||
@@ -158,18 +157,22 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
buffer.putInt(0);
|
||||
} else {
|
||||
buffer.putInt(creature.getSkillMods().size());
|
||||
buffer.putInt(creature.getSkillModsUpdateCounter());
|
||||
buffer.putInt(creature.getSkillMods().getUpdateCounter());
|
||||
|
||||
for(SkillMod skillMod : creature.getSkillMods().get()) {
|
||||
for(SkillMod skillMod : creature.getSkillMods()) {
|
||||
buffer.put((byte) 0);
|
||||
buffer.put(getAsciiString(skillMod.getSkillModString()));
|
||||
buffer.put(getAsciiString(skillMod.getName()));
|
||||
buffer.putInt(skillMod.getBase());
|
||||
buffer.putInt(skillMod.getModifier());
|
||||
}
|
||||
}
|
||||
buffer.putFloat(creature.getSpeedMultiplierBase());
|
||||
buffer.putFloat(creature.getSpeedMultiplierMod());
|
||||
buffer.putLong(creature.getListenToId());
|
||||
|
||||
if(creature.getPerformanceListenee() != null)
|
||||
buffer.putLong(creature.getPerformanceListenee().getObjectId());
|
||||
else
|
||||
buffer.putLong(0);
|
||||
|
||||
buffer.putFloat(creature.getRunSpeed());
|
||||
|
||||
@@ -196,7 +199,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
buffer.putInt(1);
|
||||
}
|
||||
}
|
||||
buffer.putInt(0); // xp bar value
|
||||
buffer.putInt(creature.getXpBarValue()); // xp bar value
|
||||
int size = buffer.position();
|
||||
buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
|
||||
|
||||
@@ -213,21 +216,23 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putShort((short) 0x23);
|
||||
buffer.putInt(0x43);
|
||||
buffer.putInt(0x43); // serverId
|
||||
|
||||
buffer.putInt(0); // defenders list unused in NGE
|
||||
buffer.putInt(0);
|
||||
buffer.putShort((short) 0); // detaiLStfFilename
|
||||
buffer.putInt(0); // detailStfSpacer
|
||||
buffer.putShort((short) 0); // detailStfName
|
||||
|
||||
// TANO 6 lists TODO: research
|
||||
|
||||
buffer.put(creature.getCombatFlag());
|
||||
|
||||
buffer.putLong(0);
|
||||
buffer.putLong(0);
|
||||
buffer.putLong(0); // Vehicle vars or TANO 6 vars TODO: research
|
||||
buffer.putLong(0);
|
||||
buffer.putInt(0);
|
||||
|
||||
buffer.putLong(0); //List<Long> possibly defenders list
|
||||
buffer.putInt(0); //Int
|
||||
buffer.putLong(0); //List<Long>
|
||||
buffer.putLong(0); //List<Int>
|
||||
buffer.putLong(0); //List<Unknown>
|
||||
|
||||
buffer.putShort(creature.getLevel());
|
||||
//buffer.putShort((short) 90);
|
||||
buffer.putInt(creature.getGrantedHealth()); // From player_level.iff. Ranges from 0-2000 as you level, consistent with that table.
|
||||
|
||||
//0A
|
||||
@@ -253,8 +258,9 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
buffer.putLong(creature.getInviteCounter());
|
||||
|
||||
buffer.putInt(creature.getGuildId());
|
||||
//10
|
||||
buffer.putLong(creature.getTargetId());
|
||||
|
||||
buffer.putLong(creature.getLookAtTarget()); // lookAtTarget 0x10
|
||||
buffer.putLong(creature.getIntendedTarget()); // intendedTarget 0x11
|
||||
buffer.put(creature.getMoodId());
|
||||
buffer.putInt(creature.getPerformanceCounter());
|
||||
/*
|
||||
@@ -262,9 +268,6 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
* in the CREO, otherwise the evul note bubbles appear
|
||||
*/
|
||||
buffer.putInt((creature.getPerformanceType()) ? 0 : creature.getPerformanceId());
|
||||
|
||||
buffer.putInt(0); // unks
|
||||
buffer.putInt(0);
|
||||
|
||||
buffer.putInt(6); // Current HAM
|
||||
buffer.putInt(creature.getHamListCounter());
|
||||
@@ -332,9 +335,9 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
}
|
||||
|
||||
buffer.putShort((short) 0);
|
||||
buffer.putShort((short) 0); // costume
|
||||
//buffer.put(getAsciiString("appearance/gungan_m.sat"));
|
||||
buffer.put((byte) 1); // 0 = cloak
|
||||
buffer.put((byte) 1); // visible boolean. default: true. cloaked if false.
|
||||
|
||||
if(creature.getBuffList().isEmpty()) {
|
||||
buffer.putInt(0);
|
||||
@@ -377,10 +380,15 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
}
|
||||
|
||||
buffer.put((byte) 0); // crashes if 1
|
||||
buffer.put((byte) 0); // performing? boolean
|
||||
buffer.put(creature.getDifficulty());
|
||||
buffer.putInt(0xFFFFFFFF); // -1 normal appearance, 0 hologram
|
||||
buffer.put((byte) 1); // crashes if 0
|
||||
|
||||
if(creature.isHologram())
|
||||
buffer.putInt(0);
|
||||
else
|
||||
buffer.putInt(0xFFFFFFFF);
|
||||
|
||||
buffer.put((byte) 1); // visibleOnRadar? boolean
|
||||
buffer.put((byte) 0); // no effect for 1?
|
||||
buffer.put((byte) 0); // no effect for 1?
|
||||
|
||||
@@ -413,8 +421,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
buffer.putInt(0); // unk list
|
||||
buffer.putInt(0);
|
||||
buffer.putLong(0); // unk long
|
||||
|
||||
int size = buffer.position();
|
||||
buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
|
||||
@@ -665,16 +672,22 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer buildTargetDelta(long targetId) {
|
||||
|
||||
public IoBuffer buildLookAtTargetDelta(long targetId) {
|
||||
IoBuffer buffer = bufferPool.allocate(8, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putLong(targetId);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x10, buffer, size + 4);
|
||||
|
||||
return buffer;
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer buildIntendedTargetDelta(long targetId) {
|
||||
IoBuffer buffer = bufferPool.allocate(8, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putLong(targetId);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x11, buffer, size + 4);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildHealthDelta(int health) {
|
||||
@@ -823,7 +836,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer buildAddSkillModDelta(String name, int base) {
|
||||
/*public IoBuffer buildAddSkillModDelta(String name, int base) {
|
||||
|
||||
CreatureObject creature = (CreatureObject) object;
|
||||
|
||||
@@ -841,9 +854,9 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
return buffer;
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
public IoBuffer buildRemoveSkillModDelta(String name, int base) {
|
||||
/*public IoBuffer buildRemoveSkillModDelta(String name, int base) {
|
||||
|
||||
CreatureObject creature = (CreatureObject) object;
|
||||
|
||||
@@ -861,7 +874,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
return buffer;
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
public IoBuffer buildAddSkillDelta(String name) {
|
||||
|
||||
@@ -1050,13 +1063,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
|
||||
public IoBuffer buildAddEquipmentDelta(TangibleObject item) {
|
||||
|
||||
CreatureObject creature = (CreatureObject) object;
|
||||
@@ -1168,11 +1175,36 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
}
|
||||
|
||||
|
||||
public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
|
||||
switch (viewType) {
|
||||
case 1:
|
||||
case 3:
|
||||
case 4: {
|
||||
switch(updateType) {
|
||||
case 3: {
|
||||
buffer = createDelta("CREO", (byte) 4, (short) 1, (byte) 3, buffer.flip(), buffer.array().length + 4);
|
||||
|
||||
if (object.getClient() != null && object.getClient().getSession() != null) {
|
||||
//object.getClient().getSession().write(buffer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
case 6:
|
||||
case 8:
|
||||
case 9:
|
||||
default:
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,12 +46,11 @@ import com.sleepycat.persist.model.NotPersistent;
|
||||
|
||||
import engine.clients.Client;
|
||||
import engine.resources.objects.IPersistent;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
@Entity(version=0)
|
||||
@Entity(version=1)
|
||||
public class GuildObject extends UniverseObject implements IPersistent {
|
||||
|
||||
protected NGECore core;
|
||||
@@ -63,6 +62,8 @@ public class GuildObject extends UniverseObject implements IPersistent {
|
||||
@NotPersistent
|
||||
private Transaction txn;
|
||||
|
||||
private long nextInstanceId = 0;
|
||||
|
||||
// GILD 3
|
||||
private float complexity = 0x803F0F00;
|
||||
private String STFFile = "string_id_table";
|
||||
@@ -281,6 +282,12 @@ public class GuildObject extends UniverseObject implements IPersistent {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized long getNextInstanceId() {
|
||||
long ret = nextInstanceId;
|
||||
nextInstanceId++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
destination.getSession().write(messageBuilder.buildBaseline3());
|
||||
|
||||
@@ -233,8 +233,8 @@ public class PlayerObject extends IntangibleObject {
|
||||
synchronized(objectMutex) {
|
||||
xpExists = xpList.containsKey(type);
|
||||
xpList.put(type, amount);
|
||||
Console.println("Put " + type + " exp of " + amount + " in the map.");
|
||||
Console.println("Map is now: " + xpList.get(type).intValue());
|
||||
//Console.println("Put " + type + " exp of " + amount + " in the map.");
|
||||
//Console.println("Map is now: " + xpList.get(type).intValue());
|
||||
}
|
||||
|
||||
if (getContainer() != null && getContainer().getClient() != null && getContainer().getClient().getSession() != null) {
|
||||
@@ -687,7 +687,9 @@ public class PlayerObject extends IntangibleObject {
|
||||
}
|
||||
|
||||
public String getSpouseName() {
|
||||
return spouse;
|
||||
synchronized(objectMutex) {
|
||||
return spouse;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSpouseName(String spouse) {
|
||||
|
||||
@@ -321,6 +321,18 @@ public class TangibleObject extends SWGObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void showFlyText(String stfFile, String stfString, String customText, int xp, float scale, RGB color, int displayType, int unkInt) {
|
||||
//Set<Client> observers = getObservers();
|
||||
|
||||
if (getClient() != null) {
|
||||
getClient().getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(getObjectID(), getObjectID(), unkInt, 1, 1, -1, stfFile, stfString, customText, xp, scale, color, displayType))).serialize());
|
||||
}
|
||||
|
||||
/*for (Client client : observers) {
|
||||
client.getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(client.getParent().getObjectID(), getObjectID(), unkInt, 1, 1, -1, stfFile, stfString, customText, xp, scale, color, displayType))).serialize());
|
||||
}*/
|
||||
}
|
||||
|
||||
public void playEffectObject(String effectFile, String commandString) {
|
||||
notifyObservers(new PlayClientEffectObjectMessage(effectFile, getObjectID(), commandString), true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user