Added lure data parsing

This commit is contained in:
phr0z3nt04st
2010-05-18 21:31:43 -05:00
parent e057fc1335
commit bc3855d130
4 changed files with 195 additions and 55 deletions

View File

@@ -136,7 +136,9 @@
#include "llappviewer.h"
#include "llviewerjoystick.h"
#include "llfollowcam.h"
// <edit>
#include "llworldmapmessage.h"
// </edit>
using namespace LLVOAvatarDefines;
extern LLMenuBarGL* gMenuBarView;
@@ -222,7 +224,6 @@ LLAgent gAgent;
// <edit>
// For MapBlockReply funk 'cause I dunno what I'm doing
/* not *quite* there yet, and I don't want to break head.
BOOL LLAgent::lure_show = FALSE;
std::string LLAgent::lure_name;
LLVector3d LLAgent::lure_posglobal;
@@ -232,7 +233,7 @@ int LLAgent::lure_x;
int LLAgent::lure_y;
int LLAgent::lure_z;
std::string LLAgent::lure_maturity;
*/
// </edit>
const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f;
@@ -8019,5 +8020,60 @@ std::string LLAgent::getCapability(const std::string& name) const
}
return iter->second;
}
// <edit>
void LLAgent::showLureDestination(const std::string fromname, const int global_x, const int global_y, const int x, const int y, const int z, const std::string maturity)
{
const LLVector3d posglobal = LLVector3d(F64(global_x), F64(global_y), F64(0));
LLSimInfo* siminfo;
siminfo = LLWorldMap::getInstance()->simInfoFromPosGlobal(posglobal);
if(siminfo)
{
llinfos << fromname << "'s teleport lure is to " << siminfo->getName() << " (" << maturity << ")" << llendl;
std::string url = LLURLDispatcher::buildSLURL(siminfo->getName(), S32(x), S32(y), S32(z));
std::string msg;
msg = llformat("%s's teleport lure is to %s", fromname.c_str(), url.c_str());
if(maturity != "")
msg.append(llformat(" (%s)", maturity.c_str()));
LLChat chat(msg);
LLFloaterChat::addChat(chat);
}
else
{
LLAgent::lure_show = TRUE;
LLAgent::lure_name = fromname;
LLAgent::lure_posglobal = posglobal;
LLAgent::lure_global_x = U16(global_x / 256);
LLAgent::lure_global_y = U16(global_y / 256);
LLAgent::lure_x = x;
LLAgent::lure_y = y;
LLAgent::lure_z = z;
LLAgent::lure_maturity = maturity;
LLWorldMapMessage::getInstance()->sendMapBlockRequest(lure_global_x, lure_global_y, lure_global_x, lure_global_y, true);
}
}
void LLAgent::onFoundLureDestination()
{
LLAgent::lure_show = FALSE;
LLSimInfo* siminfo;
siminfo = LLWorldMap::getInstance()->simInfoFromPosGlobal(LLAgent::lure_posglobal);
if(siminfo)
{
llinfos << LLAgent::lure_name << "'s teleport lure is to " << siminfo->getName() << " (" << LLAgent::lure_maturity << ")" << llendl;
std::string url = LLURLDispatcher::buildSLURL(siminfo->getName(), S32(LLAgent::lure_x), S32(LLAgent::lure_y), S32(LLAgent::lure_z));
std::string msg;
msg = llformat("%s's teleport lure is to %s", LLAgent::lure_name.c_str(), url.c_str());
if(LLAgent::lure_maturity != "")
msg.append(llformat(" (%s)", LLAgent::lure_maturity.c_str()));
LLChat chat(msg);
LLFloaterChat::addChat(chat);
}
else
llwarns << "Grand scheme failed" << llendl;
}
// </edit>
// EOF