Merge branch 'ark'

feature/prepare-cross-merge
Ulukyn 5 years ago committed by kaetemi
parent 62457be418
commit 887dbdad0d
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -196,6 +196,7 @@ AdminCommandsInit[] =
"showOnline", true, "showOnline", true,
"openTargetApp", true, "openTargetApp", true,
"openTargetUrl", true,
// DEPECRATED !!! // DEPECRATED !!!
"webExecCommand", true, "webExecCommand", true,
@ -9050,6 +9051,18 @@ NLMISC_COMMAND(openTargetApp, "open target app", "<user_id>")
} }
} }
//----------------------------------------------------------------------------
NLMISC_COMMAND(openTargetUrl, "Open target url", "<user_id> <url>")
{
if (args.size() < 2)
return false;
GET_CHARACTER
c->sendUrl(args[1]);
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
NLMISC_COMMAND(eventSetBotURL, "changes the url of a bot", "<bot eid> [<url>]") NLMISC_COMMAND(eventSetBotURL, "changes the url of a bot", "<bot eid> [<url>]")
{ {

@ -665,6 +665,20 @@ void updateConvertFile()
} }
} }
string getServerInfos(float x, float y)
{
CVector pos;
pos.x = x;
pos.y = y;
pos.z = 0;
CRyzomTime::EWeather weather = WeatherEverywhere.getWeather(pos, CTimeDateSeasonManager::getRyzomTimeReference());
return toString("%f|%d|%s|%u",
CTimeDateSeasonManager::getRyzomTimeReference().getRyzomTime(),
CTimeDateSeasonManager::getRyzomTimeReference().getRyzomDay(),
EGSPD::CSeason::toString(CTimeDateSeasonManager::getRyzomTimeReference().getRyzomSeason()).c_str(),
(uint)weather);
}
//--------------------------------------------------- //---------------------------------------------------

@ -36,6 +36,7 @@ void cbConnection( const std::string &serviceName, NLNET::TServiceId sid, void *
void cbDisconnection( const std::string &serviceName, NLNET::TServiceId sid, void *arg ); void cbDisconnection( const std::string &serviceName, NLNET::TServiceId sid, void *arg );
void cbMirrorUp( const std::string &serviceName, NLNET::TServiceId sid, void *arg ); void cbMirrorUp( const std::string &serviceName, NLNET::TServiceId sid, void *arg );
void cbMirrorDn( const std::string &serviceName, NLNET::TServiceId sid, void *arg ); void cbMirrorDn( const std::string &serviceName, NLNET::TServiceId sid, void *arg );
std::string getServerInfos(float x, float y);
/** /**
* CPlayerService * CPlayerService

@ -61,6 +61,8 @@ using namespace NLMISC;
using namespace NLNET; using namespace NLNET;
using namespace std; using namespace std;
extern CCharacterBotChatBeginEnd CharacterBotChatBeginEnd;
NLMISC_COMMAND(forceMissionProgress,"debug command used to trigger debug commands","<user>") NLMISC_COMMAND(forceMissionProgress,"debug command used to trigger debug commands","<user>")
{ {
if (args.empty() || args.size() > 3) if (args.empty() || args.size() > 3)
@ -2518,7 +2520,7 @@ NLMISC_COMMAND(getServerStats,"get server stats","<uid> <stat1,stat2,stat3..> [<
log.displayNL("%f", CTimeDateSeasonManager::getRyzomTimeReference().getRyzomTime ()); log.displayNL("%f", CTimeDateSeasonManager::getRyzomTimeReference().getRyzomTime ());
else if (stats[i] == "date") // Atys date else if (stats[i] == "date") // Atys date
log.displayNL("%d", CTimeDateSeasonManager::getRyzomTimeReference().getRyzomDay ()); log.displayNL("%d", CTimeDateSeasonManager::getRyzomTimeReference().getRyzomDay ());
else if (stats[i] == "season") // Atys date else if (stats[i] == "season") // Atys season
log.displayNL("%s", EGSPD::CSeason::toString(CTimeDateSeasonManager::getRyzomTimeReference().getRyzomSeason()).c_str()); log.displayNL("%s", EGSPD::CSeason::toString(CTimeDateSeasonManager::getRyzomTimeReference().getRyzomSeason()).c_str());
else if (stats[i] == "weather") // Atys weather else if (stats[i] == "weather") // Atys weather
{ {
@ -3612,7 +3614,7 @@ NLMISC_COMMAND(delBrick, "Specified player unlearns given brick", "<uid> <brick1
} }
NLMISC_COMMAND(execAiAction, "Specified player unlearns given brick", "<uid> <brick1> <target?>") NLMISC_COMMAND(execAiAction, "Exec Ai Action", "<uid> <brick1> <target?>")
{ {
if (args.size() < 2) return false; if (args.size() < 2) return false;
@ -3726,3 +3728,344 @@ NLMISC_COMMAND(spawnToxic, "Spawn a toxic cloud", "<uid> <posX> <posY> <fx> <Rad
} }
return true; return true;
} }
NLMISC_COMMAND(searchEntity, "Search an Entity (Player, Creature or Npc)", "<uid> <type=creature|bot|race|player> <name>")
{
if ( args.size() < 3 )
return false;
GET_ACTIVE_CHARACTER
float x = (float)c->getX() / 1000.f;
float y = (float)c->getY() / 1000.f;
if ( args[1] == "creature" )
{
CSheetId creatureSheetId(args[2]);
if( creatureSheetId != CSheetId::Unknown )
{
double minDistance = -1.;
CCreature * creature = NULL;
TMapCreatures::const_iterator it;
const TMapCreatures& creatures = CreatureManager.getCreature();
for( it = creatures.begin(); it != creatures.end(); ++it )
{
CSheetId sheetId = (*it).second->getType();
if( sheetId == creatureSheetId )
{
double distance = PHRASE_UTILITIES::getDistance( c->getEntityRowId(), (*it).second->getEntityRowId() );
if( !creature || (creature && distance < minDistance) )
{
creature = (*it).second;
minDistance = distance;
}
}
}
if( creature )
{
float fx = 0, fy = 0, fz = 0;
fx = creature->getState().X() / 1000.0f;
fy = creature->getState().Y() / 1000.0f;
fz = creature->getState().Z() / 1000.0f;
log.displayNL("%.2f,%.2f,%.2f,%.2f,%.2f,%.2f", fx, fy, fz, minDistance, x-fx, y-fy);
return true;
}
}
else
{
log.displayNL("ERR: sheet not found");
}
}
else if ( args[1] == "race" )
{
EGSPD::CPeople::TPeople race;
race = EGSPD::CPeople::fromString(args[2]);
if ( race != EGSPD::CPeople::EndPeople )
{
double minDistance = -1.;
CCreature * creature = NULL;
TMapCreatures::const_iterator it;
const TMapCreatures& creatures = CreatureManager.getCreature();
for( it = creatures.begin(); it != creatures.end(); ++it )
{
if( race == (*it).second->getRace() )
{
double distance = PHRASE_UTILITIES::getDistance( c->getEntityRowId(), (*it).second->getEntityRowId() );
if( !creature || (creature && distance < minDistance) )
{
creature = (*it).second;
minDistance = distance;
}
}
}
if( creature )
{
float fx = 0, fy = 0, fz = 0;
fx = creature->getState().X() / 1000.0f;
fy = creature->getState().Y() / 1000.0f;
fz = creature->getState().Z() / 1000.0f;
log.displayNL("%.2f,%.2f,%.2f,%.2f,%.2f,%.2f", fx, fy, fz, minDistance, x-fx, y-fy);
return true;
}
}
else
{
log.displayNL("ERR: race not found");
}
}
else if ( args[1] == "player" )
{
CEntityBase *entityBase = PlayerManager.getCharacterByName(CShardNames::getInstance().makeFullNameFromRelative(c->getHomeMainlandSessionId(), args[2]));
if (entityBase != NULL)
{
double minDistance = PHRASE_UTILITIES::getDistance( c->getEntityRowId(), entityBase->getEntityRowId() );
float fx = 0, fy = 0, fz = 0;
fx = entityBase->getState().X / 1000.0f;
fy = entityBase->getState().Y / 1000.0f;
fz = entityBase->getState().Z / 1000.0f;
log.displayNL("%.2f,%.2f,%.2f,%.2f,%.2f,%.2f", fx, fy, fz, minDistance, x-fx, y-fy);
return true;
}
else
{
log.displayNL("ERR: player not found");
}
} else {
// try to find the bot name
vector<TAIAlias> aliases;
CAIAliasTranslator::getInstance()->getNPCAliasesFromName( args[2], aliases );
if ( !aliases.empty() )
{
TAIAlias alias = aliases[0];
const CEntityId & botId = CAIAliasTranslator::getInstance()->getEntityId(alias);
if ( botId != CEntityId::Unknown )
{
CEntityBase *entityBase = CreatureManager.getCreature(botId);
if (entityBase != NULL)
{
double minDistance = PHRASE_UTILITIES::getDistance( c->getEntityRowId(), entityBase->getEntityRowId() );
float fx = 0, fy = 0, fz = 0;
fx = entityBase->getState().X / 1000.0f;
fy = entityBase->getState().Y / 1000.0f;
fz = entityBase->getState().Z / 1000.0f;
log.displayNL("%.2f,%.2f,%.2f,%.2f,%.2f,%.2f", fx, fy, fz, minDistance, x-fx, y-fy);
return true;
}
}
}
else
{
log.displayNL("ERR: bot not found");
}
}
log.displayNL("0,0,0,0,0,0");
return true;
}
NLMISC_COMMAND(setBehaviour," change entity behaviour","<uid|*> <behaviour> [<target|eid>]")
{
if ( args.size() < 2 )
return false;
CEntityId id;
CEntityBase *e = NULL;
bool isChar = false;
if (args[0] != "*")
{
CCharacter *c = NULL;
GET_ACTIVE_CHARACTER2
if ( args.size() > 2 && args[2] == "target")
{
id = c->getTarget();
if( id.getType() == 0 )
{
CCharacter *c = PlayerManager.getChar(id);
if (c && c->getEnterFlag())
e = c;
}
else
{
e = CreatureManager.getCreature(id);
}
}
else
e = c;
}
else
{
if ( args.size() < 3 )
return false;
id.fromString( args[2].c_str() );
e = CreatureManager.getCreature(id);
}
if (e)
{
sint behav;
NLMISC::fromString(args[1], behav);
MBEHAV::EBehaviour behaviour = MBEHAV::EBehaviour(behav);
e->setBehaviour( behaviour );
log.displayNL("%s", toString( e->getBehaviour() ).c_str() );
}
else
{
log.displayNL("ERR: entity not found");
}
return true;
}
NLMISC_COMMAND(getBehaviour," get entity behaviour","<uid|*> [<target|eid>]")
{
if ( args.size() < 1 )
return false;
CEntityId id;
CEntityBase *e = NULL;
bool isChar = false;
if (args[0] != "*")
{
CCharacter *c = NULL;
GET_ACTIVE_CHARACTER2
if ( args.size() > 2 && args[2] == "target")
{
id = c->getTarget();
if( id.getType() == 0 )
{
CCharacter *c = PlayerManager.getChar(id);
if (c && c->getEnterFlag())
e = c;
}
else
{
e = CreatureManager.getCreature(id);
}
}
else
e = c;
}
else
{
if ( args.size() < 2 )
return false;
id.fromString( args[2].c_str() );
e = CreatureManager.getCreature(id);
}
if (e)
{
log.displayNL("%s", toString( e->getBehaviour() ).c_str() );
}
else
{
log.displayNL("ERR: entity not found");
}
return true;
}
NLMISC_COMMAND(stopMoveBot,"stop move of a bot","<uid|*> [<target|eid>]")
{
if ( args.size() < 1 )
return false;
TDataSetRow TargetRowId;
CEntityBase *e = NULL;
bool isChar = false;
if (args[0] != "*")
{
CCharacter *c = NULL;
GET_ACTIVE_CHARACTER2
if (c)
CharacterBotChatBeginEnd.BotChatStart.push_back(c->getEntityRowId());
const CEntityId &target = c->getTarget();
if (target == CEntityId::Unknown)
{
log.displayNL("ERR: target");
return true;
}
TargetRowId = TheDataset.getDataSetRow(target);
}
else
{
if ( args.size() < 2 )
return false;
CEntityId target;
target.fromString( args[2].c_str() );
if (target == CEntityId::Unknown)
{
log.displayNL("ERR: target");
return true;
}
TargetRowId = TheDataset.getDataSetRow(target);
}
CharacterBotChatBeginEnd.BotChatStart.push_back(TargetRowId);
}
NLMISC_COMMAND(startMoveBot,"start move of a bot","<uid|*> [<target|eid>]")
{
if ( args.size() < 1 )
return false;
TDataSetRow TargetRowId;
CEntityBase *e = NULL;
bool isChar = false;
if (args[0] != "*")
{
CCharacter *c = NULL;
GET_ACTIVE_CHARACTER2
if (c)
CharacterBotChatBeginEnd.BotChatEnd.push_back(c->getEntityRowId());
const CEntityId &target = c->getTarget();
if (target == CEntityId::Unknown)
{
log.displayNL("ERR: target");
return true;
}
log.displayNL("%s", target.toString().c_str());
TargetRowId = TheDataset.getDataSetRow(target);
}
else
{
if ( args.size() < 2 )
return false;
CEntityId target;
target.fromString( args[2].c_str() );
if (target == CEntityId::Unknown)
{
log.displayNL("ERR: target");
return true;
}
TargetRowId = TheDataset.getDataSetRow(target);
}
CharacterBotChatBeginEnd.BotChatEnd.push_back(TargetRowId);
log.displayNL("OK");
}

@ -6117,6 +6117,9 @@ void CCharacter::respawnPet()
{ {
for (uint i = 0; i < _PlayerPets.size(); ++i) for (uint i = 0; i < _PlayerPets.size(); ++i)
{ {
if (_PlayerPets[i].PetStatus == CPetAnimal::in_bag)
continue;
if (_PlayerPets[i].PetStatus != CPetAnimal::not_present if (_PlayerPets[i].PetStatus != CPetAnimal::not_present
&& (_PlayerPets[i].PetStatus != CPetAnimal::stable || _RespawnMainLandInTown)) && (_PlayerPets[i].PetStatus != CPetAnimal::stable || _RespawnMainLandInTown))
{ {
@ -6308,6 +6311,7 @@ bool CCharacter::spawnCharacterAnimal(uint index)
msg.Coordinate_Y = _PlayerPets[index].Landscape_Y; msg.Coordinate_Y = _PlayerPets[index].Landscape_Y;
msg.Coordinate_H = _PlayerPets[index].Landscape_Z; msg.Coordinate_H = _PlayerPets[index].Landscape_Z;
msg.Heading = 0.0f; msg.Heading = 0.0f;
msg.Cell = 0;
break; break;
case CPetAnimal::stable: case CPetAnimal::stable:
@ -14796,7 +14800,7 @@ string CCharacter::getTargetInfos()
string msg = target.toString()+"|"; string msg = target.toString()+"|";
if (target == CEntityId::Unknown) if (target == CEntityId::Unknown)
return "0"; return "?";
if (target.getType() == RYZOMID::creature) if (target.getType() == RYZOMID::creature)
msg += "c|"; msg += "c|";
@ -14838,7 +14842,7 @@ string CCharacter::getTargetInfos()
CMirrorPropValueRO<TYPE_CELL> srcCell(TheDataset, dsr, DSPropertyCELL); CMirrorPropValueRO<TYPE_CELL> srcCell(TheDataset, dsr, DSPropertyCELL);
sint32 cell = srcCell; sint32 cell = srcCell;
msg += toString("%.2f|%.2f|%.2f|%.2f|%.4f|%d", dist, x, y, z, h, cell); msg += toString("%.2f|%.2f|%.2f|%.2f|%.4f|%d|", dist, x, y, z, h, cell)+cTarget->getType().toString()+"|"+EGSPD::CPeople::toString(cTarget->getRace())+"|"+toString("%d", cTarget->getGender());
} }
} }
else else
@ -14871,7 +14875,7 @@ string CCharacter::getTargetInfos()
CMirrorPropValueRO<TYPE_CELL> srcCell(TheDataset, dsr, DSPropertyCELL); CMirrorPropValueRO<TYPE_CELL> srcCell(TheDataset, dsr, DSPropertyCELL);
sint32 cell = srcCell; sint32 cell = srcCell;
msg += toString("%.2f|%.2f|%.2f|%.2f|%.4f|%d", dist, x, y, z, h, cell); msg += toString("%.2f|%.2f|%.2f|%.2f|%.4f|%d|", dist, x, y, z, h, cell)+cTarget->getType().toString()+"|"+EGSPD::CPeople::toString(cTarget->getRace())+"|"+toString("%d", cTarget->getGender());
} }
} }
@ -15564,9 +15568,10 @@ void CCharacter::sendUrl(const string &url)
string playerPos = getPositionInfos(); string playerPos = getPositionInfos();
strFindReplace(playerPos, " ", "%20"); strFindReplace(playerPos, " ", "%20");
string targetInfos = getTargetInfos(); string targetInfos = getTargetInfos();
string serverInfos = getServerInfos(getState().X / 1000., getState().Y / 1000.);
strFindReplace(targetInfos, " ", "%20"); strFindReplace(targetInfos, " ", "%20");
string final_url = url + toString("&urlidx=%d", getUrlIndex())+"&player_pos="+playerPos+"&target_infos="+targetInfos; string final_url = url + toString("&urlidx=%d", getUrlIndex())+"&player_pos="+playerPos+"&target_infos="+targetInfos+"&server_infos="+serverInfos;
control = "&hmac="+ getHMacSHA1((uint8*)&final_url[0], (uint32)final_url.size(), (uint8*)&salt[0], (uint32)salt.size()).toString(); control = "&hmac="+ getHMacSHA1((uint8*)&final_url[0], (uint32)final_url.size(), (uint8*)&salt[0], (uint32)salt.size()).toString();
uint32 userId = PlayerManager.getPlayerId(getId()); uint32 userId = PlayerManager.getPlayerId(getId());

Loading…
Cancel
Save