Added in Emerald's 'Chatbar as Command Line'

This commit is contained in:
CharleyLevenque
2010-08-23 01:29:10 -04:00
parent e4d4db02ca
commit 4bac221317
11 changed files with 865 additions and 10 deletions

View File

@@ -51,6 +51,7 @@ typedef enum e_chat_type
CHAT_TYPE_WHISPER = 0,
CHAT_TYPE_NORMAL = 1,
CHAT_TYPE_SHOUT = 2,
CHAT_TYPE_OOC = 3,
CHAT_TYPE_START = 4,
CHAT_TYPE_STOP = 5,
CHAT_TYPE_DEBUG_MSG = 6,

View File

@@ -154,6 +154,7 @@ const U8 LL_PCODE_PATH_IGNORE = 0x00;
const U8 LL_PCODE_PATH_MIN = 0x01; // min/max needs to be >> 4 of real min/max
const U8 LL_PCODE_PATH_LINE = 0x10;
const U8 LL_PCODE_PATH_CIRCLE = 0x20;
const U8 LL_PCODE_PATH_CIRCLE_33 = 0x21;
const U8 LL_PCODE_PATH_CIRCLE2 = 0x30;
const U8 LL_PCODE_PATH_TEST = 0x40;
const U8 LL_PCODE_PATH_FLEXIBLE = 0x80;

View File

@@ -70,6 +70,7 @@ set(viewer_SOURCE_FILES
hippogridmanager.cpp
hipporestrequest.cpp
jcfloaterareasearch.cpp
chatbar_as_cmdline.cpp
llagent.cpp
llagentaccess.cpp
llagentdata.cpp
@@ -513,6 +514,7 @@ set(viewer_HEADER_FILES
hippogridmanager.h
hipporestrequest.h
jcfloaterareasearch.h
chatbar_as_cmdline.h
llagent.h
llagentaccess.h
llagentdata.h

View File

@@ -114,6 +114,171 @@
<integer>0</integer>
</map>
<!-- Ascent-Specific Settings -->
<key>AscentCmdLine</key>
<map>
<key>Comment</key>
<string>Would you like the chatbar to be able to be used for command line functions?</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>AscentCmdLineClearChat</key>
<map>
<key>Comment</key>
<string>Clear chat hsitory to stop lag from chat spam</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>clrchat</string>
</map>
<key>AscentCmdLineHeight</key>
<map>
<key>Comment</key>
<string>Teleport to height function command</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>gth</string>
</map>
<key>AscentCmdLinePos</key>
<map>
<key>Comment</key>
<string>Teleport to position function command</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>gtp</string>
</map>
<key>AscentCmdLineGround</key>
<map>
<key>Comment</key>
<string>Teleport to ground function command</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>flr</string>
</map>
<key>AscentCmdLineTeleportHome</key>
<map>
<key>Comment</key>
<string>Teleport to home function command</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>tph</string>
</map>
<key>AscentCmdLineRezPlatform</key>
<map>
<key>Comment</key>
<string>Rez a platform underneath you</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>rezplat</string>
</map>
<key>AscentPlatformSize</key>
<map>
<key>Comment</key>
<string>How wide the rezzed platform will appear to be.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>30</real>
</map>
<key>AscentCmdLineMapTo</key>
<map>
<key>Comment</key>
<string>Teleport to a region by name rapidly</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>mapto</string>
</map>
<key>AscentCmdLineDrawDistance</key>
<map>
<key>Comment</key>
<string>Change draw distance quickly</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>dd</string>
</map>
<key>AscentCmdTeleportToCam</key>
<map>
<key>Comment</key>
<string>Teleport to your camera</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>tp2cam</string>
</map>
<key>AscentCmdLineKeyToName</key>
<map>
<key>Comment</key>
<string>Use a fast key to name querry</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>key2name</string>
</map>
<key>AscentCmdLineOfferTp</key>
<map>
<key>Comment</key>
<string>Offer a teleport to target avatar</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>offertp</string>
</map>
<key>AscentCmdLineCalc</key>
<map>
<key>Comment</key>
<string>Calculates an expression</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>calc</string>
</map>
<key>AscentCmdLineTP2</key>
<map>
<key>Comment</key>
<string>Teleport to a person by name, partials work.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>tp2</string>
</map>
<key>AscentStoreSettingsPerAccount</key>
<map>
<key>Comment</key>

View File

@@ -0,0 +1,577 @@
/* Copyright (c) 2009
*
* Modular Systems All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* 3. Neither the name Modular Systems 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 MODULAR SYSTEMS AND CONTRIBUTORS <20>AS IS<49>
* 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 MODULAR SYSTEMS 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.
*/
#include "llviewerprecompiledheaders.h"
#include "chatbar_as_cmdline.h"
#include "llcalc.h"
#include "llchatbar.h"
#include "llagent.h"
#include "stdtypes.h"
#include "llviewerregion.h"
#include "llworld.h"
#include "lluuid.h"
#include "llviewercontrol.h"
#include "material_codes.h"
#include "llvolume.h"
#include "object_flags.h"
#include "llvolumemessage.h"
#include "llurldispatcher.h"
#include "llworld.h"
#include "llworldmap.h"
#include "llfloateravatarlist.h"
#include "llviewerobjectlist.h"
#include "llviewertexteditor.h"
#include "llvoavatar.h"
#include "lltooldraganddrop.h"
#include "llinventorymodel.h"
#include "llselectmgr.h"
#include <iosfwd>
#include <float.h>
#include "llchat.h"
#include "llfloaterchat.h"
void cmdline_printchat(std::string message);
void cmdline_rezplat(bool use_saved_value = true, F32 visual_radius = 30.0);
void cmdline_tp2name(std::string target);
LLUUID cmdline_partial_name2key(std::string name);
LLViewerInventoryItem::item_array_t findInventoryInFolder(const std::string& ifolder)
{
LLUUID folder = gInventory.findCategoryByName(ifolder);
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
//ObjectContentNameMatches objectnamematches(ifolder);
gInventory.collectDescendents(folder,cats,items,FALSE);//,objectnamematches);
return items;
}
class JCZface : public LLEventTimer
{
public:
JCZface(std::stack<LLViewerInventoryItem*> stack, LLUUID dest, F32 pause) : LLEventTimer( pause )
{
cmdline_printchat("initialized");
instack = stack;
indest = dest;
}
~JCZface()
{
cmdline_printchat("deinitialized");
}
BOOL tick()
{
LLViewerInventoryItem* subj = instack.top();
instack.pop();
LLViewerObject *objectp = gObjectList.findObject(indest);
if(objectp)
{
cmdline_printchat(std::string("dropping ")+subj->getName());
LLToolDragAndDrop::dropInventory(objectp,subj,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID());
return (instack.size() == 0);
}else
{
cmdline_printchat("object lost");
return TRUE;
}
}
private:
std::stack<LLViewerInventoryItem*> instack;
LLUUID indest;
};
class JCZtake : public LLEventTimer
{
public:
static BOOL ztakeon;
JCZtake() : LLEventTimer(2.0f)
{
ztakeon = FALSE;
cmdline_printchat("initialized");
}
~JCZtake()
{
cmdline_printchat("deinitialized");
}
BOOL tick()
{
{
LLMessageSystem *msg = gMessageSystem;
for(LLObjectSelection::iterator itr=LLSelectMgr::getInstance()->getSelection()->begin();
itr!=LLSelectMgr::getInstance()->getSelection()->end();++itr)
{
LLSelectNode* node = (*itr);
LLViewerObject* object = node->getObject();
U32 localid=object->getLocalID();
if(done_prims.find(localid) == done_prims.end())
{
done_prims.insert(localid);
std::string name = llformat("%fx%fx%f",object->getScale().mV[VX],object->getScale().mV[VY],object->getScale().mV[VZ]);
cmdline_printchat(std::string("Rename&take ")+name);
msg->newMessageFast(_PREHASH_ObjectName);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID,gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_LocalID,localid);
msg->addStringFast(_PREHASH_Name,name);
gAgent.sendReliableMessage();
msg->newMessageFast(_PREHASH_DeRezObject);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID,gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_AgentBlock);
msg->addUUIDFast(_PREHASH_GroupID,LLUUID::null);
msg->addU8Fast(_PREHASH_Destination,4);
msg->addUUIDFast(_PREHASH_DestinationID,LLUUID::null);
LLUUID rand;
rand.generate();
msg->addUUIDFast(_PREHASH_TransactionID,rand);
msg->addU8Fast(_PREHASH_PacketCount,1);
msg->addU8Fast(_PREHASH_PacketNumber,0);
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID,localid);
gAgent.sendReliableMessage();
}
}
}
return ztakeon;
}
private:
std::set<U32> done_prims;
};
void invrepair()
{
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
//ObjectContentNameMatches objectnamematches(ifolder);
gInventory.collectDescendents(gAgent.getInventoryRootID(),cats,items,FALSE);//,objectnamematches);
}
bool cmd_line_chat(std::string revised_text, EChatType type)
{
if(gSavedSettings.getBOOL("AscentCmdLine"))
{
std::istringstream i(revised_text);
std::string command;
i >> command;
if(command != "")
{
if(command == gSavedSettings.getString("AscentCmdLinePos"))
{
F32 x,y,z;
if (i >> x)
{
if (i >> y)
{
if (i >> z)
{
LLVector3 agentPos = gAgent.getPositionAgent();
LLViewerRegion* agentRegionp = gAgent.getRegion();
if(agentRegionp)
{
LLVector3 targetPos(x,y,z);
LLVector3d pos_global = from_region_handle(agentRegionp->getHandle());
pos_global += LLVector3d((F64)targetPos.mV[0],(F64)targetPos.mV[1],(F64)targetPos.mV[2]);
gAgent.teleportViaLocation(pos_global);
return false;
}
}
}
}
}
else if(command == gSavedSettings.getString("AscentCmdLineDrawDistance"))
{
int drawDist;
if(i >> drawDist)
{
gSavedSettings.setF32("RenderFarClip", drawDist);
gAgent.mDrawDistance=drawDist;
char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */
snprintf(buffer,sizeof(buffer),"Draw distance set to: %dm",drawDist);
cmdline_printchat(std::string(buffer));
return false;
}
}
else if(command == gSavedSettings.getString("AscentCmdTeleportToCam"))
{
gAgent.teleportViaLocation(gAgent.getCameraPositionGlobal());
return false;
}
else if(command == gSavedSettings.getString("AscentCmdLineKeyToName"))
{
LLUUID targetKey;
if(i >> targetKey)
{
std::string object_name;
gCacheName->getFullName(targetKey, object_name);
char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */
snprintf(buffer,sizeof(buffer),"%s: (%s)",targetKey.asString().c_str(), object_name.c_str());
cmdline_printchat(std::string(buffer));
}
return false;
}
else if(command == gSavedSettings.getString("AscentCmdLineOfferTp"))
{
std::string avatarKey;
// llinfos << "CMD DEBUG 0 " << command << " " << avatarName << llendl;
if(i >> avatarKey)
{
// llinfos << "CMD DEBUG 0 afterif " << command << " " << avatarName << llendl;
LLUUID tempUUID;
if(LLUUID::parseUUID(avatarKey, &tempUUID))
{
char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */
LLDynamicArray<LLUUID> ids;
ids.push_back(tempUUID);
std::string tpMsg="Join me!";
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_StartLure);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_Info);
msg->addU8Fast(_PREHASH_LureType, (U8)0);
msg->addStringFast(_PREHASH_Message, tpMsg);
for(LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr)
{
msg->nextBlockFast(_PREHASH_TargetData);
msg->addUUIDFast(_PREHASH_TargetID, *itr);
}
gAgent.sendReliableMessage();
snprintf(buffer,sizeof(buffer),"Offered TP to key %s",tempUUID.asString().c_str());
cmdline_printchat(std::string(buffer));
return false;
}
}
}
else if(command == gSavedSettings.getString("AscentCmdLineGround"))
{
LLVector3 agentPos = gAgent.getPositionAgent();
U64 agentRegion = gAgent.getRegion()->getHandle();
LLVector3 targetPos(agentPos.mV[0],agentPos.mV[1],LLWorld::getInstance()->resolveLandHeightAgent(agentPos));
LLVector3d pos_global = from_region_handle(agentRegion);
pos_global += LLVector3d((F64)targetPos.mV[0],(F64)targetPos.mV[1],(F64)targetPos.mV[2]);
gAgent.teleportViaLocation(pos_global);
return false;
}else if(command == gSavedSettings.getString("AscentCmdLineHeight"))
{
F32 z;
if(i >> z)
{
LLVector3 agentPos = gAgent.getPositionAgent();
U64 agentRegion = gAgent.getRegion()->getHandle();
LLVector3 targetPos(agentPos.mV[0],agentPos.mV[1],z);
LLVector3d pos_global = from_region_handle(agentRegion);
pos_global += LLVector3d((F64)targetPos.mV[0],(F64)targetPos.mV[1],(F64)targetPos.mV[2]);
gAgent.teleportViaLocation(pos_global);
return false;
}
}else if(command == gSavedSettings.getString("AscentCmdLineTeleportHome"))
{
gAgent.teleportHome();
return false;
}else if(command == gSavedSettings.getString("AscentCmdLineRezPlatform"))
{
F32 width;
if (i >> width) cmdline_rezplat(false, width);
else cmdline_rezplat();
return false;
}else if(command == gSavedSettings.getString("AscentCmdLineMapTo"))
{
if (revised_text.length() > command.length() + 1) //Typing this command with no argument was causing a crash. -Madgeek
{
LLVector3d agentPos = gAgent.getPositionGlobal();
S32 agent_x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) );
S32 agent_y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) );
S32 agent_z = llround( (F32)agentPos.mdV[VZ] );
std::string region_name = LLWeb::escapeURL(revised_text.substr(command.length()+1));
std::string url;
if(!gSavedSettings.getBOOL("AscentMapToKeepPos"))
{
agent_x = 128;
agent_y = 128;
agent_z = 0;
}
url = llformat("secondlife:///app/teleport/%s/%d/%d/%d",region_name.c_str(),agent_x,agent_y,agent_z);
LLURLDispatcher::dispatch(url, NULL, true);
}
return false;
}else if(command == gSavedSettings.getString("AscentCmdLineCalc"))//Cryogenic Blitz
{
bool success;
F32 result = 0.f;
if(revised_text.length() > command.length() + 1)
{
std::string expr = revised_text.substr(command.length()+1);
LLStringUtil::toUpper(expr);
success = LLCalc::getInstance()->evalString(expr, result);
std::string out;
if (!success)
{
out = "Calculation Failed";
}
else
{
// Replace the expression with the result
std::ostringstream result_str;
result_str << expr;
result_str << " = ";
result_str << result;
out = result_str.str();
}
cmdline_printchat(out);
return false;
}
}else if(command == gSavedSettings.getString("AscentCmdLineTP2"))
{
if (revised_text.length() > command.length() + 1) //Typing this command with no argument was causing a crash. -Madgeek
{
std::string name = revised_text.substr(command.length()+1);
cmdline_tp2name(name);
}
return false;
}else if (revised_text == "xyzzy")
{
//Zwag: I wonder how many people will actually get this?
cmdline_printchat("Nothing happens.");
return false;
}else if(command == "typingstop")
{
std::string text;
if(i >> text)
{
gChatBar->sendChatFromViewer(text, CHAT_TYPE_STOP, FALSE);
}
}
else if(command == gSavedSettings.getString("AscentCmdLineClearChat"))
{
LLFloaterChat* chat = LLFloaterChat::getInstance(LLSD());
if(chat)
{
LLViewerTextEditor* history_editor = chat->getChild<LLViewerTextEditor>("Chat History Editor");
LLViewerTextEditor* history_editor_with_mute = chat->getChild<LLViewerTextEditor>("Chat History Editor with mute");
history_editor->clear();
history_editor_with_mute->clear();
return false;
}
}else if(command == "zdrop")
{
cmdline_printchat("lolZ");
std::string lolfolder;
if(i >> lolfolder)
{
cmdline_printchat("lolfolder");
std::stack<LLViewerInventoryItem*> lolstack;
LLDynamicArray<LLPointer<LLViewerInventoryItem> > lolinv = findInventoryInFolder(lolfolder);
for(LLDynamicArray<LLPointer<LLViewerInventoryItem> >::iterator it = lolinv.begin(); it != lolinv.end(); ++it)
{
LLViewerInventoryItem* item = *it;
lolstack.push(item);
}
if(lolstack.size())
{
cmdline_printchat("lolstack.size()");
std::string loldest;
if(i >> loldest)
{
cmdline_printchat("loldest");
LLUUID sdest = LLUUID(loldest);
new JCZface(lolstack, sdest, 2.5f);
}
}else cmdline_printchat("no size");
}
}else if(command == "invrepair")
{
invrepair();
}
}
}
return true;
}
//case insensative search for avatar in draw distance
//TODO: make this use the avatar list floaters list so we have EVERYONE
// even if they are out of draw distance.
LLUUID cmdline_partial_name2key(std::string partial_name)
{
std::vector<LLUUID> avatars;
std::string av_name;
LLStringUtil::toLower(partial_name);
LLWorld::getInstance()->getAvatars(&avatars);
typedef std::vector<LLUUID>::const_iterator av_iter;
bool has_avatarlist = (LLFloaterAvatarList::getInstance() ? true : false);
if(has_avatarlist)
LLFloaterAvatarList::getInstance()->updateAvatarList();
for(av_iter i = avatars.begin(); i != avatars.end(); ++i)
{
if(has_avatarlist)
{
LLAvatarListEntry* entry = LLFloaterAvatarList::getInstance()->getAvatarEntry(*i);
if(entry)
{
av_name = entry->getName();
}
}
if (av_name.empty() && !gCacheName->getFullName(*i, av_name))
{
LLViewerObject *obj = gObjectList.findObject(*i);
if(obj)
{
LLVOAvatar* avatarp = dynamic_cast<LLVOAvatar*>(obj);
av_name = avatarp->getFullname();
}
}
LLStringUtil::toLower(av_name);
if(strstr(av_name.c_str(), partial_name.c_str()))
{
return *i;
}
}
return LLUUID::null;
}
void cmdline_tp2name(std::string target)
{
LLUUID avkey = cmdline_partial_name2key(target);
if(avkey.isNull())
{
cmdline_printchat("Avatar not found.");
return;
}
LLFloaterAvatarList* avlist = LLFloaterAvatarList::getInstance();
LLViewerObject* obj = gObjectList.findObject(avkey);
if(obj)
{
LLVector3d pos = obj->getPositionGlobal();
pos.mdV[VZ] += 2.0;
gAgent.teleportViaLocation(pos);
}
else if(avlist)
{
LLAvatarListEntry* entry = avlist->getAvatarEntry(avkey);
if(entry)
{
LLVector3d pos = entry->getPosition();
pos.mdV[VZ] += 2.0;
gAgent.teleportViaLocation(pos);
}
}
}
void cmdline_rezplat(bool use_saved_value, F32 visual_radius) //cmdline_rezplat() will still work... just will use the saved value
{
LLVector3 agentPos = gAgent.getPositionAgent()+(gAgent.getVelocity()*(F32)0.333);
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectAdd);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU8Fast(_PREHASH_PCode, LL_PCODE_VOLUME);
msg->addU8Fast(_PREHASH_Material, LL_MCODE_METAL);
if(agentPos.mV[2] > 4096.0)msg->addU32Fast(_PREHASH_AddFlags, FLAGS_CREATE_SELECTED);
else msg->addU32Fast(_PREHASH_AddFlags, 0);
LLVolumeParams volume_params;
volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_CIRCLE_33 );
volume_params.setRatio ( 2, 2 );
volume_params.setShear ( 0, 0 );
volume_params.setTaper(2.0f,2.0f);
volume_params.setTaperX(0.f);
volume_params.setTaperY(0.f);
LLVolumeMessage::packVolumeParams(&volume_params, msg);
LLVector3 rezpos = agentPos - LLVector3(0.0f,0.0f,2.5f);
LLQuaternion rotation;
rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);
if (use_saved_value) visual_radius = gSavedSettings.getF32("AscentPlatformSize");
F32 realsize = visual_radius / 3.0f;
if (realsize < 0.01f) realsize = 0.01f;
else if (realsize > 10.0f) realsize = 10.0f;
msg->addVector3Fast(_PREHASH_Scale, LLVector3(0.01f,realsize,realsize) );
msg->addQuatFast(_PREHASH_Rotation, rotation );
msg->addVector3Fast(_PREHASH_RayStart, rezpos );
msg->addVector3Fast(_PREHASH_RayEnd, rezpos );
msg->addU8Fast(_PREHASH_BypassRaycast, (U8)1 );
msg->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE );
msg->addU8Fast(_PREHASH_State, 0);
msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null );
msg->sendReliable(gAgent.getRegionHost());
}
void cmdline_printchat(std::string message)
{
LLChat chat;
chat.mText = message;
chat.mSourceType = CHAT_SOURCE_SYSTEM;
LLFloaterChat::addChat(chat, FALSE, FALSE);
}

View File

@@ -0,0 +1,36 @@
/* Copyright (c) 2009
*
* Modular Systems All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* 3. Neither the name Modular Systems 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 MODULAR SYSTEMS AND CONTRIBUTORS <20>AS IS<49>
* 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 MODULAR SYSTEMS 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.
*/
#include "llviewerprecompiledheaders.h"
#include "llchatbar.h"
bool cmd_line_chat(std::string revised_text, EChatType type);

View File

@@ -68,6 +68,7 @@
#include "llviewermenu.h"
#include "lluictrlfactory.h"
#include "chatbar_as_cmdline.h"
//
// Globals
@@ -387,7 +388,7 @@ LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel)
}
}
// <dogmode>
void LLChatBar::sendChat( EChatType type )
{
if (mInputEditor)
@@ -397,15 +398,74 @@ void LLChatBar::sendChat( EChatType type )
{
// store sent line in history, duplicates will get filtered
if (mInputEditor) mInputEditor->updateHistory();
// Check if this is destined for another channel
S32 channel = 0;
stripChannelNumber(text, &channel);
std::string utf8text = wstring_to_utf8str(text);
std::string utf8text = wstring_to_utf8str(text);//+" and read is "+llformat("%f",readChan)+" and undone is "+llformat("%d",undoneChan)+" but actualy channel is "+llformat("%d",channel);
// Try to trigger a gesture, if not chat to a script.
std::string utf8_revised_text;
if (0 == channel)
{
if (gSavedSettings.getBOOL("AscentAutoCloseOOC"))
{
// Chalice - OOC autoclosing patch based on code by Henri Beauchamp
int needsClosingType=0;
if (utf8text.find("((") == 0 && utf8text.find("))") == -1)
needsClosingType=1;
else if(utf8text.find("[[") == 0 && utf8text.find("]]") == -1)
needsClosingType=2;
if(needsClosingType==1)
{
// Chalice - OOC autoclosing patch based on code by Henri Beauchamp
int needsClosingType=0;
if (utf8text.find("((") == 0 && utf8text.find("))") == -1)
needsClosingType=1;
else if(utf8text.find("[[") == 0 && utf8text.find("]]") == -1)
needsClosingType=2;
if(needsClosingType==1)
{
if(utf8text.at(utf8text.length() - 1) == ')')
utf8text+=" ";
utf8text+="))";
}
else if(needsClosingType==2)
{
if(utf8text.at(utf8text.length() - 1) == ']')
utf8text+=" ";
utf8text+="]]";
}
needsClosingType=0;
if (utf8text.find("((") == -1 && utf8text.find("))") == (utf8text.length() - 2))
needsClosingType=1;
else if (utf8text.find("[[") == -1 && utf8text.find("]]") == (utf8text.length() - 2))
needsClosingType=2;
if(needsClosingType==1)
{
if(utf8text.at(0) == '(')
utf8text.insert(0," ");
utf8text.insert(0,"((");
}
else if(needsClosingType==2)
{
if(utf8text.at(0) == '[')
utf8text.insert(0," ");
utf8text.insert(0,"[[");
}
}
}
// Convert MU*s style poses into IRC emotes here.
if (gSavedSettings.getBOOL("AscentAllowMUpose") && utf8text.find(":") == 0 && utf8text.length() > 3)
{
if (utf8text.find(":'") == 0)
{
utf8text.replace(0, 1, "/me");
}
else if (isalpha(utf8text.at(1))) // Do not prevent smileys and such.
{
utf8text.replace(0, 1, "/me ");
}
}
// discard returned "found" boolean
gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text);
}
@@ -415,11 +475,15 @@ void LLChatBar::sendChat( EChatType type )
}
utf8_revised_text = utf8str_trim(utf8_revised_text);
if (!utf8_revised_text.empty())
EChatType nType;
if(type == CHAT_TYPE_OOC)
nType=CHAT_TYPE_NORMAL;
else
nType=type;
if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, nType))
{
// Chat with animation
sendChatFromViewer(utf8_revised_text, type, TRUE);
sendChatFromViewer(utf8_revised_text, nType, TRUE);
}
}
}

View File

@@ -58,6 +58,8 @@
#include "llvoavatar.h"
#include "llviewerstats.h"
#include "chatbar_as_cmdline.h"
LLGestureManager gGestureManager;
// Longest time, in seconds, to wait for all animations to stop playing
@@ -870,7 +872,10 @@ void LLGestureManager::runStep(LLMultiGesture* gesture, LLGestureStep* step)
// other playing animations.
const BOOL animate = FALSE;
gChatBar->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
if ( cmd_line_chat(chat_text, CHAT_TYPE_NORMAL))
{
gChatBar->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
}
gesture->mCurrentStep++;
break;
}

View File

@@ -485,7 +485,7 @@ BOOL LLFloaterTexturePicker::postBuild()
LLFloater::postBuild();
LLInventoryItem* itemp = gInventory.getItem(mImageAssetID);
if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
childSetValue("texture_uuid", mImageAssetID);
else
@@ -935,7 +935,7 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te, void *da
}
else
{
self->childSetValue("texture_uuid", te.getID().asString());
self->childSetValue("texture_uuid", inventory_item_id.asString());
}
self->commitIfImmediateSet();

View File

@@ -48,6 +48,8 @@
#include "llviewernetwork.h"
#include "llagent.h"
#include "chatbar_as_cmdline.h"
// Globals
LLViewerGestureList gGestureList;
@@ -132,6 +134,7 @@ void LLViewerGesture::doTrigger( BOOL send_chat )
}
}
cmd_line_chat(mOutputString, CHAT_TYPE_NORMAL);
if ( send_chat && !mOutputString.empty())
{
// Don't play nodding animation, since that might not blend

View File

@@ -947,6 +947,7 @@ void init_client_menu(LLMenuGL* menu)
// <dogmode>
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
if (!LLViewerLogin::getInstance()->isInProductionGrid())
{
@@ -957,7 +958,7 @@ void init_client_menu(LLMenuGL* menu)
(void*)"HackedGodmode"));
}
#endif
// </dogmode>
menu->append(new LLMenuItemCallGL("Clear Group Cache",
LLGroupMgr::debugClearAllGroups));
menu->appendSeparator();