diff --git a/src/protocol/swg/ObjControllerMessage.java b/src/protocol/swg/ObjControllerMessage.java index e307d7c2..7eda7054 100644 --- a/src/protocol/swg/ObjControllerMessage.java +++ b/src/protocol/swg/ObjControllerMessage.java @@ -52,6 +52,7 @@ public class ObjControllerMessage extends SWGMessage { public static final int OBJECT_MENU_RESPONSE = 0x0147; public static final int SHOW_FLY_TEXT = 0x01BD; public static final int START_TASK = 0x448; + public static final int ANIMATION = 0x00F2; public ObjControllerMessage() { diff --git a/src/protocol/swg/objectControllerObjects/Animation.java b/src/protocol/swg/objectControllerObjects/Animation.java new file mode 100644 index 00000000..c3475969 --- /dev/null +++ b/src/protocol/swg/objectControllerObjects/Animation.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * 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 protocol.swg.objectControllerObjects; + +import java.nio.ByteOrder; + +import org.apache.mina.core.buffer.IoBuffer; + +import protocol.swg.ObjControllerMessage; +import protocol.swg.SWGMessage; + +public class Animation extends ObjControllerObject { + + private long objectId; + private String animation; + + public Animation(long objectId, String animation) { + this.objectId = objectId; + this.animation = animation; + } + + @Override + public void deserialize(IoBuffer data) { + + } + + @Override + public IoBuffer serialize() { + IoBuffer result = IoBuffer.allocate(36).order(ByteOrder.LITTLE_ENDIAN); + + result.putInt(ObjControllerMessage.ANIMATION); + + result.putLong(objectId); // person performing animation's id + result.putInt(0); // seems to be just a place holder + result.put(getAsciiString(animation)); // animation name ex: tumble_to_standing + + return result.flip(); + } + + public long getObjectId() { + return objectId; + } + + public void setObjectId(long objectId) { + this.objectId = objectId; + } + + public String getAnimation() { + return animation; + } + + public void setAnimation(String animation) { + this.animation = animation; + } + +} diff --git a/src/resources/common/AnimationType.java b/src/resources/common/AnimationType.java new file mode 100644 index 00000000..b0bd9a17 --- /dev/null +++ b/src/resources/common/AnimationType.java @@ -0,0 +1,35 @@ +package resources.common; + +public class AnimationType { + public static String Explain = "explain"; + public static String NodHeadOnce = "nod_head_once"; + public static String Bow = "bow"; + public static String Wave1 = "wave1"; + public static String Beckon = "beckon"; + public static String Dive = "dive"; + public static String HitLight = "get_hit_light"; + public static String HitLightHighCenter = "get_hit_light_high_center"; + public static String HitHighLightHighLeft = "get_hit_light_high_left"; + public static String HitLightHighRight = "get_hit_light_high_right"; + public static String HitLightLowLeft = "get_hit_light_low_left"; + public static String HitLightLowRight = "get_hit_light_low_right"; + public static String HitLightMidCenter = "get_hit_light_mid_center"; + public static String HitLightMidLeft = "get_hit_light_mid_left"; + public static String HitLightMidRight = "get_hit_light_mid_right"; + public static String HitMedium = "get_hit_medium"; + public static String HitMediumHighCenter = "get_hit_medium_high_center"; + public static String HitMediumHighLeft = "get_hit_medium_high_left"; + public static String HitMediumHighRight = "get_hit_medium_high_right"; + public static String HitMediumLowLeft = "get_hit_medium_low_left"; + public static String HitMediumLowRight = "get_hit_medium_low_right"; + public static String HitMediumMidCenter = "get_hit_medium_mid_center"; + public static String HitMediumMidLeft = "get_hit_medium_mid_left"; + public static String HitMediumMidRight = "get_hit_medium_mid_right"; + public static String HealOther = "heal_other"; + public static String HealSelf = "heal_self"; + public static String HurryToKneeling = "hurry_to_kneeling"; + public static String HurryToProne = "hurry_to_prone"; + public static String HurryToStanding = "hurry_to_standing"; + public static String Throw = "throw"; + public static String TumbleToStanding = "tumble_to_standing"; +} diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index b5863ba7..cdcede62 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -33,6 +33,7 @@ import protocol.swg.ObjControllerMessage; import protocol.swg.PlayMusicMessage; import protocol.swg.UpdatePVPStatusMessage; import protocol.swg.UpdatePostureMessage; +import protocol.swg.objectControllerObjects.Animation; import protocol.swg.objectControllerObjects.Posture; import com.sleepycat.je.Environment; @@ -51,7 +52,6 @@ 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; @@ -707,6 +707,10 @@ public class CreatureObject extends TangibleObject implements IPersistent { synchronized(objectMutex) { this.currentAnimation = currentAnimation; } + Animation animation = new Animation(getObjectId(), currentAnimation); + ObjControllerMessage objController = new ObjControllerMessage(0x1B, animation); + + notifyObservers(objController, true); } public String getMoodAnimation() {