/* * Copyright (c) 2006, Second Life Reverse Engineering Team * All rights reserved. * * - Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * - Neither the name of the Second Life Reverse Engineering Team nor the names * of its contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ using System; using System.Timers; using System.Net; using System.Collections.Generic; using libsecondlife.Packets; namespace libsecondlife { /// /// Basic class to hold other Avatar's data. /// public class Avatar { /// /// /// [Flags] public enum AgentUpdateFlags { /// Empty flag NONE = 0, /// Move Forward (SL Keybinding: W/Up Arrow) AGENT_CONTROL_AT_POS = 0x1 << CONTROL_AT_POS_INDEX, /// Move Backward (SL Keybinding: S/Down Arrow) AGENT_CONTROL_AT_NEG = 0x1 << CONTROL_AT_NEG_INDEX, /// Move Left (SL Keybinding: Shift-(A/Left Arrow)) AGENT_CONTROL_LEFT_POS = 0x1 << CONTROL_LEFT_POS_INDEX, /// Move Right (SL Keybinding: Shift-(D/Right Arrow)) AGENT_CONTROL_LEFT_NEG = 0x1 << CONTROL_LEFT_NEG_INDEX, /// Not Flying: Jump/Flying: Move Up (SL Keybinding: E) AGENT_CONTROL_UP_POS = 0x1 << CONTROL_UP_POS_INDEX, /// Not Flying: Croutch/Flying: Move Down (SL Keybinding: C) AGENT_CONTROL_UP_NEG = 0x1 << CONTROL_UP_NEG_INDEX, /// Unused AGENT_CONTROL_PITCH_POS = 0x1 << CONTROL_PITCH_POS_INDEX, /// Unused AGENT_CONTROL_PITCH_NEG = 0x1 << CONTROL_PITCH_NEG_INDEX, /// Unused AGENT_CONTROL_YAW_POS = 0x1 << CONTROL_YAW_POS_INDEX, /// Unused AGENT_CONTROL_YAW_NEG = 0x1 << CONTROL_YAW_NEG_INDEX, /// ORed with AGENT_CONTROL_AT_* if the keyboard is being used AGENT_CONTROL_FAST_AT = 0x1 << CONTROL_FAST_AT_INDEX, /// ORed with AGENT_CONTROL_LEFT_* if the keyboard is being used AGENT_CONTROL_FAST_LEFT = 0x1 << CONTROL_FAST_LEFT_INDEX, /// ORed with AGENT_CONTROL_UP_* if the keyboard is being used AGENT_CONTROL_FAST_UP = 0x1 << CONTROL_FAST_UP_INDEX, /// Fly AGENT_CONTROL_FLY = 0x1 << CONTROL_FLY_INDEX, /// AGENT_CONTROL_STOP = 0x1 << CONTROL_STOP_INDEX, /// Finish our current animation AGENT_CONTROL_FINISH_ANIM = 0x1 << CONTROL_FINISH_ANIM_INDEX, /// Stand up from the ground or a prim seat AGENT_CONTROL_STAND_UP = 0x1 << CONTROL_STAND_UP_INDEX, /// Sit on the ground at our current location AGENT_CONTROL_SIT_ON_GROUND = 0x1 << CONTROL_SIT_ON_GROUND_INDEX, /// Whether mouselook is currently enabled AGENT_CONTROL_MOUSELOOK = 0x1 << CONTROL_MOUSELOOK_INDEX, /// Legacy, used if a key was pressed for less than a certain amount of time AGENT_CONTROL_NUDGE_AT_POS = 0x1 << CONTROL_NUDGE_AT_POS_INDEX, /// Legacy, used if a key was pressed for less than a certain amount of time AGENT_CONTROL_NUDGE_AT_NEG = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX, /// Legacy, used if a key was pressed for less than a certain amount of time AGENT_CONTROL_NUDGE_LEFT_POS = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX, /// Legacy, used if a key was pressed for less than a certain amount of time AGENT_CONTROL_NUDGE_LEFT_NEG = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX, /// Legacy, used if a key was pressed for less than a certain amount of time AGENT_CONTROL_NUDGE_UP_POS = 0x1 << CONTROL_NUDGE_UP_POS_INDEX, /// Legacy, used if a key was pressed for less than a certain amount of time AGENT_CONTROL_NUDGE_UP_NEG = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX, /// AGENT_CONTROL_TURN_LEFT = 0x1 << CONTROL_TURN_LEFT_INDEX, /// AGENT_CONTROL_TURN_RIGHT = 0x1 << CONTROL_TURN_RIGHT_INDEX, /// Set when the avatar is idled or set to away. Note that the away animation is /// activated separately from setting this flag AGENT_CONTROL_AWAY = 0x1 << CONTROL_AWAY_INDEX, /// AGENT_CONTROL_LBUTTON_DOWN = 0x1 << CONTROL_LBUTTON_DOWN_INDEX, /// AGENT_CONTROL_LBUTTON_UP = 0x1 << CONTROL_LBUTTON_UP_INDEX, /// AGENT_CONTROL_ML_LBUTTON_DOWN = 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX, /// AGENT_CONTROL_ML_LBUTTON_UP = 0x1 << CONTROL_ML_LBUTTON_UP_INDEX } /// /// Positive and negative ratings /// public struct Statistics { /// Positive ratings for Behavior public int BehaviorPositive; /// Negative ratings for Behavior public int BehaviorNegative; /// Positive ratings for Appearance public int AppearancePositive; /// Negative ratings for Appearance public int AppearanceNegative; /// Positive ratings for Building public int BuildingPositive; /// Negative ratings for Building public int BuildingNegative; /// Positive ratings given by this avatar public int GivenPositive; /// Negative ratings given by this avatar public int GivenNegative; } /// /// Avatar properties including about text, profile URL, image IDs and /// publishing settings /// public struct Properties { /// Should this profile be published on the web public bool AllowPublish; /// First Life about text public string FirstLifeText; /// First Life image ID public LLUUID FirstLifeImage; /// public LLUUID Partner; /// public string AboutText; /// public string BornOn; /// public string CharterMember; /// Profile image ID public LLUUID ProfileImage; /// Is this a mature profile public bool MaturePublish; /// public bool Identified; /// public bool Transacted; /// Web URL for this profile public string ProfileURL; } /// /// Avatar interests including spoken languages, skills, and "want to" /// choices /// public struct Interests { /// Languages profile field public string LanguagesText; /// public uint SkillsMask; /// public string SkillsText; /// public uint WantToMask; /// public string WantToText; } /// UUID for this avatar public LLUUID ID = LLUUID.Zero; /// Temporary ID for this avatar, local to the current region public uint LocalID = 0; /// Full name public string Name = String.Empty; /// Active group public string GroupName = String.Empty; /// Groups that this avatar is a member of public List Groups = new List(); /// Online status public bool Online = false; /// Positive and negative ratings public Statistics ProfileStatistics = new Statistics(); /// Avatar properties including about text, profile URL, image IDs and /// publishing settings public Properties ProfileProperties = new Properties(); /// Avatar interests including spoken languages, skills, and "want to" /// choices public Interests ProfileInterests = new Interests(); /// Local location, relative to the sim or what the avatar is /// sitting on public LLVector3 Position = LLVector3.Zero; /// Rotational position, relative to the sim or what the avatar /// is sitting on public LLQuaternion Rotation = LLQuaternion.Identity; /// Region the avatar is in public Region CurrentRegion = null; /// Textures for this avatars clothing public TextureEntry Textures = new TextureEntry(); /// Gets the local ID of the prim the avatar is sitting on, /// zero if the avatar is not currently sitting public uint SittingOn { get { return sittingOn; } } internal uint sittingOn = 0; private const int CONTROL_AT_POS_INDEX = 0; private const int CONTROL_AT_NEG_INDEX = 1; private const int CONTROL_LEFT_POS_INDEX = 2; private const int CONTROL_LEFT_NEG_INDEX = 3; private const int CONTROL_UP_POS_INDEX = 4; private const int CONTROL_UP_NEG_INDEX = 5; private const int CONTROL_PITCH_POS_INDEX = 6; private const int CONTROL_PITCH_NEG_INDEX = 7; private const int CONTROL_YAW_POS_INDEX = 8; private const int CONTROL_YAW_NEG_INDEX = 9; private const int CONTROL_FAST_AT_INDEX = 10; private const int CONTROL_FAST_LEFT_INDEX = 11; private const int CONTROL_FAST_UP_INDEX = 12; private const int CONTROL_FLY_INDEX = 13; private const int CONTROL_STOP_INDEX = 14; private const int CONTROL_FINISH_ANIM_INDEX = 15; private const int CONTROL_STAND_UP_INDEX = 16; private const int CONTROL_SIT_ON_GROUND_INDEX = 17; private const int CONTROL_MOUSELOOK_INDEX = 18; private const int CONTROL_NUDGE_AT_POS_INDEX = 19; private const int CONTROL_NUDGE_AT_NEG_INDEX = 20; private const int CONTROL_NUDGE_LEFT_POS_INDEX = 21; private const int CONTROL_NUDGE_LEFT_NEG_INDEX = 22; private const int CONTROL_NUDGE_UP_POS_INDEX = 23; private const int CONTROL_NUDGE_UP_NEG_INDEX = 24; private const int CONTROL_TURN_LEFT_INDEX = 25; private const int CONTROL_TURN_RIGHT_INDEX = 26; private const int CONTROL_AWAY_INDEX = 27; private const int CONTROL_LBUTTON_DOWN_INDEX = 28; private const int CONTROL_LBUTTON_UP_INDEX = 29; private const int CONTROL_ML_LBUTTON_DOWN_INDEX = 30; private const int CONTROL_ML_LBUTTON_UP_INDEX = 31; private const int TOTAL_CONTROLS = 32; public Avatar() { } } }