/*
* 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
{
///
/// Triggered on incoming chat messages
///
///
///
///
///
///
///
public delegate void ChatCallback(string message, byte audible, byte type, byte sourcetype,
string fromName, LLUUID id, LLUUID ownerid, LLVector3 position);
///
/// Triggered when the L$ account balance for this avatar changes
///
/// The new account balance
public delegate void BalanceCallback(int balance);
///
/// Tiggered on incoming instant messages
///
///
///
///
///
///
///
///
///
///
///
///
///
///
public delegate void InstantMessageCallback(LLUUID fromAgentID, string fromAgentName,
LLUUID toAgentID, uint parentEstateID, LLUUID regionID, LLVector3 position,
byte dialog, bool groupIM, LLUUID imSessionID, DateTime timestamp, string message,
byte offline, byte[] binaryBucket);
///
/// Triggered for any status updates of a teleport (progress, failed, succeeded)
///
/// A message about the current teleport status
public delegate void TeleportCallback(string message, TeleportStatus status);
///
/// Current teleport status
///
public enum TeleportStatus
{
///
None,
///
Start,
///
Progress,
///
Failed,
///
Finished
}
///
/// Special commands used in Instant Messages
///
public enum InstantMessageDialog
{
/// Indicates a regular IM from another agent
MessageFromAgent = 0,
/// Indicates that someone has given the user inventory
GiveInventory = 4,
/// Indicates that the IM is from an object
MessageFromObject = 19,
/// Indicates that the IM is a teleport invitation
RequestTeleport = 22,
/// Response sent to the agent which inititiated a teleport invitation
AcceptTeleport = 23,
/// Response sent to the agent which inititiated a teleport invitation
DenyTeleport = 24,
/// Indicates that a user has started typing
StartTyping = 41,
/// Indicates that a user has stopped typing
StopTyping = 42
}
///
/// Basic class to hold other Avatar's data.
///
public class Avatar
{
///
///
///
[Flags]
public enum AgentUpdateFlags
{
/// 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,
///
AGENT_CONTROL_FLY = 0x1 << CONTROL_FLY_INDEX,
///
AGENT_CONTROL_STOP = 0x1 << CONTROL_STOP_INDEX,
///
AGENT_CONTROL_FINISH_ANIM = 0x1 << CONTROL_FINISH_ANIM_INDEX,
///
AGENT_CONTROL_STAND_UP = 0x1 << CONTROL_STAND_UP_INDEX,
///
AGENT_CONTROL_SIT_ON_GROUND = 0x1 << CONTROL_SIT_ON_GROUND_INDEX,
///
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
}
/// The Avatar's UUID, asset server
public LLUUID ID;
/// Avatar ID in Region (sim) it is in
public uint LocalID;
/// Full Name of Avatar
public string Name;
/// Active Group of Avatar
public string GroupName;
/// Online Status of Avatar
public bool Online;
/// Location of Avatar (x,y,z probably)
public LLVector3 Position;
/// Rotational Position of Avatar
public LLQuaternion Rotation;
/// Region (aka sim) the Avatar is in
public Region CurrentRegion;
///
public string BornOn;
///
public LLUUID ProfileImage;
///
public LLUUID PartnerID;
///
public string AboutText;
///
public uint WantToMask;
///
public string WantToText;
///
public uint SkillsMask;
///
public string SkillsText;
///
public string FirstLifeText;
///
public LLUUID FirstLifeImage;
///
public bool Identified;
///
public bool Transacted;
///
public bool AllowPublish;
///
public bool MaturePublish;
///
public string CharterMember;
///
public float Behavior;
///
public float Appearance;
///
public float Building;
///
public string LanguagesText;
///
public TextureEntry Textures;
///
public string ProfileURL;
protected const int CONTROL_AT_POS_INDEX = 0;
protected const int CONTROL_AT_NEG_INDEX = 1;
protected const int CONTROL_LEFT_POS_INDEX = 2;
protected const int CONTROL_LEFT_NEG_INDEX = 3;
protected const int CONTROL_UP_POS_INDEX = 4;
protected const int CONTROL_UP_NEG_INDEX = 5;
protected const int CONTROL_PITCH_POS_INDEX = 6;
protected const int CONTROL_PITCH_NEG_INDEX = 7;
protected const int CONTROL_YAW_POS_INDEX = 8;
protected const int CONTROL_YAW_NEG_INDEX = 9;
protected const int CONTROL_FAST_AT_INDEX = 10;
protected const int CONTROL_FAST_LEFT_INDEX = 11;
protected const int CONTROL_FAST_UP_INDEX = 12;
protected const int CONTROL_FLY_INDEX = 13;
protected const int CONTROL_STOP_INDEX = 14;
protected const int CONTROL_FINISH_ANIM_INDEX = 15;
protected const int CONTROL_STAND_UP_INDEX = 16;
protected const int CONTROL_SIT_ON_GROUND_INDEX = 17;
protected const int CONTROL_MOUSELOOK_INDEX = 18;
protected const int CONTROL_NUDGE_AT_POS_INDEX = 19;
protected const int CONTROL_NUDGE_AT_NEG_INDEX = 20;
protected const int CONTROL_NUDGE_LEFT_POS_INDEX = 21;
protected const int CONTROL_NUDGE_LEFT_NEG_INDEX = 22;
protected const int CONTROL_NUDGE_UP_POS_INDEX = 23;
protected const int CONTROL_NUDGE_UP_NEG_INDEX = 24;
protected const int CONTROL_TURN_LEFT_INDEX = 25;
protected const int CONTROL_TURN_RIGHT_INDEX = 26;
protected const int CONTROL_AWAY_INDEX = 27;
protected const int CONTROL_LBUTTON_DOWN_INDEX = 28;
protected const int CONTROL_LBUTTON_UP_INDEX = 29;
protected const int CONTROL_ML_LBUTTON_DOWN_INDEX = 30;
protected const int CONTROL_ML_LBUTTON_UP_INDEX = 31;
protected const int TOTAL_CONTROLS = 32;
}
}