temp commit before merge

This commit is contained in:
darkk1138
2013-12-04 22:43:34 +01:00
parent cde8e11be5
commit 6bd1c7b02c
5 changed files with 138 additions and 3 deletions
+23
View File
@@ -50,3 +50,26 @@ def startDance(core, actor, danceName):
actor.sendSystemMessage('@performance:dance_lack_skill_self',0)
return
return
if actor.getPerformanceId() > 0:
actor.sendSystemMessage('@performance:already_performing_self',0)
return
performance = entSvc.getPerformance(danceName)
#TODO: check costume, posture, etc
actor.sendSystemMessage('@performance:dance_start_self');
actor.notifyAudience('@performance:dance_start_other');
if not actor.getPerformanceWatchee():
#this also needs to notify the client with a delta4
actor.setPerformanceWatchee(actor)
#this should send a CREO3
actor.setPosture(0x09);
# send CREO6 here
# second param is some sort of counter or start tick
actor.startPerformance(performance.getLineNumber(), 0xCDCC4C3C, 'dance_' . performance.getVisualId true)
+9
View File
@@ -29,6 +29,7 @@ public class Performance {
private String flourish8;
private String intro;
private String outro;
private int lineNumber;
public Performance() {
@@ -141,6 +142,10 @@ public class Performance {
public int getHealShockWound() {
return healShockWound;
}
public int getLineNumber() {
return lineNumber;
}
public void setHealShockWound(int healShockWound) {
this.healShockWound = healShockWound;
@@ -241,5 +246,9 @@ public class Performance {
public void setOutro(String outro) {
this.outro = outro;
}
public void setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
}
}
@@ -173,7 +173,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
}
buffer.putFloat(creature.getSpeedMultiplierBase());
buffer.putFloat(creature.getSpeedMultiplierMod());
buffer.putLong(0); // unk
buffer.putLong(creature.getListenToId());
buffer.putFloat(creature.getRunSpeed());
@@ -234,10 +234,12 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
//buffer.putShort((short) 90);
buffer.putInt(creature.getGrantedHealth()); // From player_level.iff. Ranges from 0-2000 as you level, consistent with that table.
//0A
if(creature.getCurrentAnimation() == null || creature.getCurrentAnimation().length() == 0)
buffer.putShort((short) 0);
else
buffer.put(getAsciiString(creature.getCurrentAnimation()));
if(creature.getMoodAnimation() == null || creature.getMoodAnimation().length() == 0)
buffer.put(getAsciiString("neutral"));
else
@@ -251,10 +253,11 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
buffer.putShort((short) 0);
else
buffer.put(getAsciiString(creature.getInviteSenderName()));
buffer.putLong(creature.getInviteCounter());
buffer.putInt(creature.getGuildId());
//10
buffer.putLong(creature.getTargetId());
buffer.put(creature.getMoodId());
buffer.putInt(creature.getPerformanceCounter());
@@ -267,6 +270,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
buffer.putInt(creature.getHamListCounter());
buffer.putInt(creature.getHealth());
//1A
buffer.putInt(0);
buffer.putInt(creature.getAction());
buffer.putInt(0);
@@ -975,6 +979,51 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
}
public IoBuffer buildListenToId(long creatureObjectId) {
IoBuffer buffer = bufferPool.allocate(8, false).order(ByteOrder.LITTLE_ENDIAN);
buffer.putLong(creatureObjectId);
int size = buffer.position();
buffer.flip();
buffer = createDelta("CREO", (byte) 4, (short) 1, (short) 2, buffer, size + 4);
return buffer;
}
public IoBuffer buildPerformanceId(int performanceId) {
IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(performanceId);
int size = buffer.position();
buffer.flip();
buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 2, buffer, size + 4);
return buffer;
}
public IoBuffer buildPerformanceCounter(int performanceCounter) {
IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(performanceCounter);
int size = buffer.position();
buffer.flip();
buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 2, buffer, size + 4);
return buffer;
}
public IoBuffer buildSkillName(String skillName) {
IoBuffer buffer = bufferPool.allocate(getUnicodeString(skillName).length, false).order(ByteOrder.LITTLE_ENDIAN);
int size = buffer.position();
buffer.flip();
buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 2, buffer, size + 4);
return buffer;
}
public IoBuffer buildStartPerformance(boolean doStart) {
IoBuffer buffer = bufferPool.allocate(1, false).order(ByteOrder.LITTLE_ENDIAN);
buffer.put((byte) ((doStart) ? 1 : 0));
int size = buffer.position();
buffer.flip();
buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 2, buffer, size + 4);
return buffer;
}
@Override
public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
// TODO Auto-generated method stub
@@ -985,5 +1034,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
public void sendBaselines() {
}
}
@@ -56,7 +56,8 @@ import engine.resources.scene.Quaternion;
import resources.objects.tangible.TangibleObject;
import resources.objects.weapon.WeaponObject;
@Entity(version=2)
@Entity(version=4)
public class CreatureObject extends TangibleObject implements IPersistent {
@NotPersistent
@@ -116,6 +117,8 @@ public class CreatureObject extends TangibleObject implements IPersistent {
private byte moodId = 0;
private int performanceCounter = 0;
private int performanceId = 0;
private CreatureObject performanceWatchee;
private CreatureObject performanceListenee;
private int health = 1000;
private int action = 300;
@NotPersistent
@@ -1261,5 +1264,49 @@ public class CreatureObject extends TangibleObject implements IPersistent {
public boolean setStaticNPC(boolean staticNPC) {
return this.staticNPC = staticNPC;
}
public CreatureObject getPerformanceWatchee() {
synchronized(objectMutex) {
return performanceWatchee;
}
}
public void setPerformanceWatchee(CreatureObject performanceWatchee) {
synchronized(objectMutex) {
this.performanceWatchee = performanceWatchee;
}
getClient().getSession().write(messageBuilder.buildListenToId(performanceWatchee.getObjectId()));
}
public CreatureObject getPerformanceListenee() {
synchronized(objectMutex) {
return performanceListenee;
}
}
public void setPerformanceListenee(CreatureObject performanceListenee) {
synchronized(objectMutex) {
this.performanceListenee = performanceListenee;
}
}
public void startPerformance(int performanceId, int performanceCounter, String skillName, boolean doStart) {
synchronized(objectMutex) {
this.performanceId = performanceId;
this.performanceCounter = performanceCounter;
}
if (doStart) { getClient().getSession().write(messageBuilder.buildPerformanceId(performanceId)); }
if (doStart) { getClient().getSession().write(messageBuilder.buildPerformanceCounter(performanceCounter)); }
if (doStart) { getClient().getSession().write(messageBuilder.buildSkillName(skillName)); }
getClient().getSession().write(messageBuilder.buildStartPerformance(doStart));
}
public void notifyAudience() {
//TODO: stub
}
}
+5
View File
@@ -176,6 +176,7 @@ public class EntertainmentService implements INetworkDispatch {
p.setFlourish8((String) PerformanceVisitor.getObject(r, 23));
p.setIntro((String) PerformanceVisitor.getObject(r, 24));
p.setOutro((String) PerformanceVisitor.getObject(r, 25));
p.setLineNumber(r);
if (p.getType() == -1788534963) {
danceMap.put(new Integer(p.getDanceVisualId()), p);
@@ -269,6 +270,10 @@ public class EntertainmentService implements INetworkDispatch {
return canDance(actor, performances.get(danceName));
}
public Performance getPerformance(String name) {
return performances.get(name);
}
@Override
public void shutdown() {