Merge branch 'ark'

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

@ -9057,14 +9057,21 @@ NLMISC_COMMAND(openTargetApp, "open target app", "<user_id>")
}
//----------------------------------------------------------------------------
NLMISC_COMMAND(openTargetUrl, "Open target url", "<user_id> <url>")
// (ulukyn) Very special case to use with ARK.
// !!! Never let user call openTargetUrl with a custom url or player
// will able to sign any url with server salt.
// It's why the url are hardcoded here
NLMISC_COMMAND(openTargetUrl, "Open target url", "<user_id> [bullying]")
{
if (args.size() < 2)
if (args.size() < 1)
return false;
GET_CHARACTER
c->sendUrl(args[1]);
if (args.size() > 1 && args[1] == "1")
c->sendUrl("app_arcc action=mScript_Run&script_name=TalkNpc&bullying=1&command=reset_all");
else
c->sendUrl("app_arcc action=mScript_Run&script_name=TalkNpc&command=reset_all");
}

@ -4027,16 +4027,33 @@ NLMISC_COMMAND(stopMoveBot,"stop move of a bot","<uid|*> [<target|eid>]")
GET_ACTIVE_CHARACTER2
if (c)
{
const CEntityId &target = c->getTarget();
if (target == CEntityId::Unknown)
{
log.displayNL("ERR: target");
return true;
}
TargetRowId = TheDataset.getDataSetRow(target);
TDataSetRow stoppedNpc = c->getStoppedNpc();
if (stoppedNpc == TargetRowId)
return true;
if (TheDataset.isAccessible(stoppedNpc))
{
CharacterBotChatBeginEnd.BotChatEnd.push_back(c->getEntityRowId());
CharacterBotChatBeginEnd.BotChatEnd.push_back(stoppedNpc);
}
CharacterBotChatBeginEnd.BotChatStart.push_back(c->getEntityRowId());
const CEntityId &target = c->getTarget();
if (target == CEntityId::Unknown)
c->setStoppedNpc(TargetRowId);
c->setStoppedNpcTick();
}
else
{
log.displayNL("ERR: target");
log.displayNL("ERR: user");
return true;
}
TargetRowId = TheDataset.getDataSetRow(target);
}
else
{
@ -4058,7 +4075,7 @@ NLMISC_COMMAND(stopMoveBot,"stop move of a bot","<uid|*> [<target|eid>]")
}
NLMISC_COMMAND(startMoveBot,"start move of a bot","<uid|*> [<target|eid>]")
NLMISC_COMMAND(startMoveBot,"start move bot or previous stopped bot","<uid|*> [<target|eid>]")
{
if ( args.size() < 1 )
return false;
@ -4073,17 +4090,16 @@ NLMISC_COMMAND(startMoveBot,"start move of a bot","<uid|*> [<target|eid>]")
GET_ACTIVE_CHARACTER2
if (c)
{
CharacterBotChatBeginEnd.BotChatEnd.push_back(c->getEntityRowId());
const CEntityId &target = c->getTarget();
if (target == CEntityId::Unknown)
TargetRowId = c->getStoppedNpc();
c->setStoppedNpc(TDataSetRow());
}
else
{
log.displayNL("ERR: target");
log.displayNL("ERR: user");
return true;
}
log.displayNL("%s", target.toString().c_str());
TargetRowId = TheDataset.getDataSetRow(target);
}
else
{
@ -4104,3 +4120,102 @@ NLMISC_COMMAND(startMoveBot,"start move of a bot","<uid|*> [<target|eid>]")
CharacterBotChatBeginEnd.BotChatEnd.push_back(TargetRowId);
log.displayNL("OK");
}
NLMISC_COMMAND(manageBuilding, "Manage a building", "<uid> <action>")
{
if (args.size() < 2) return false;
GET_ACTIVE_CHARACTER
string action = args[1]; // trigger_in, trigger_out, add_guild_room, add_player_room
if (action == "trigger_in" && args.size() == 3)
{
uint32 liftId;
NLMISC::fromString(args[2], liftId);
CBuildingManager::getInstance()->addTriggerRequest(c->getEntityRowId(), liftId);
}
else if (action == "trigger_out")
{
CBuildingManager::getInstance()->removeTriggerRequest(c->getEntityRowId());
}
else if (action == "add_guild_room" && args.size() == 3)
{
CBuildingPhysicalGuild * building = dynamic_cast<CBuildingPhysicalGuild *>(CBuildingManager::getInstance()->getBuildingPhysicalsByName(args[2]));
if (building)
building->addGuild(c->getGuildId());
else
{
log.displayNL("KO: no building");
return true;
}
}
else if (action == "add_player_room" && args.size () == 3)
{
CBuildingPhysicalPlayer * building = dynamic_cast<CBuildingPhysicalPlayer *>(CBuildingManager::getInstance()->getBuildingPhysicalsByName(args[2]));
if (building)
building->addPlayer(c->getId());
else
{
log.displayNL("KO: no building");
return true;
}
}
else if (action == "buy_guild_room" && args.size () == 3)
{
CBuildingPhysicalGuild * building = dynamic_cast<CBuildingPhysicalGuild *>(CBuildingManager::getInstance()->getBuildingPhysicalsByName(args[2]));
if (building)
{
CGuild * guild = CGuildManager::getInstance()->getGuildFromId(c->getGuildId());
if (guild != NULL)
guild->setBuilding(building->getAlias());
else
{
log.displayNL("KO: no guild");
return true;
}
}
}
else if (action == "buy_player_room" && args.size () == 3)
{
CBuildingPhysicalPlayer * building = dynamic_cast<CBuildingPhysicalPlayer *>(CBuildingManager::getInstance()->getBuildingPhysicalsByName(args[2]));
if ( building )
CBuildingManager::getInstance()->buyBuilding(c->getId(), building->getAlias());
else
{
log.displayNL("KO: no building");
return true;
}
}
else if (action == "set_player_room" && args.size () == 3)
{
/* CBuildingPhysicalPlayer * building = dynamic_cast<CBuildingPhysicalPlayer *>(CBuildingManager::getInstance()->getBuildingPhysicalsByName(args[2]));
if ( building )
{
c->getRoomInterface().setBuilding(building);
building->addPlayer(c->getId());
}
else
{
log.displayNL("KO: no building");
return true;
}*/
}
else if (action == "get_access_room" && args.size () == 3)
{
CCharacter *owner = PlayerManager.getCharacterByName(CShardNames::getInstance().makeFullNameFromRelative(c->getHomeMainlandSessionId(), args[2]));
if (owner)
owner->addRoomAccessToPlayer(c->getId());
else
{
log.displayNL("KO: no owner");
return true;
}
}
log.displayNL("OK");
return true;
}

@ -396,6 +396,7 @@ CCharacter::CCharacter()
_LastTickSufferGooDamage = CTickEventHandler::getGameCycle();
_LastTickSaved = CTickEventHandler::getGameCycle();
_LastTickCompassUpdated = CTickEventHandler::getGameCycle();
_LastTickNpcStopped = 0;
// harvest related
resetHarvestInfos();
_HarvestOpened = false;
@ -1617,6 +1618,21 @@ uint32 CCharacter::tickUpdate()
removeMissionFromHistories(missionAlias);
}
}
if (_LastTickNpcStopped && CTickEventHandler::getGameCycle() > _LastTickNpcStopped)
{
nlinfo("ULU: CTickEventHandler::getGameCycle() > _LastTickNpcStopped");
TDataSetRow stoppedNpc = getStoppedNpc();
if (TheDataset.isAccessible(stoppedNpc))
{
nlinfo("ULU: stop bot");
CharacterBotChatBeginEnd.BotChatEnd.push_back(getEntityRowId());
CharacterBotChatBeginEnd.BotChatEnd.push_back(stoppedNpc);
}
_LastTickNpcStopped = 0;
setStoppedNpc(TDataSetRow());
}
return nextUpdate;
} // tickUpdate //
@ -22520,6 +22536,22 @@ CAdminProperties &CCharacter::getAdminProperties()
return *_AdminProperties;
}
//------------------------------------------------------------------------------
void CCharacter::setStoppedNpc(const TDataSetRow &npc)
{
_StoppedNpc = npc;
}
//------------------------------------------------------------------------------
void CCharacter::setStoppedNpcTick()
{
nlinfo("ULU: setStopNpcTick in 60s");
_LastTickNpcStopped = CTickEventHandler::getGameCycle() + 10*60;
}
//------------------------------------------------------------------------------
void CCharacter::setMonitoringCSR(const TDataSetRow &csr)

@ -2259,6 +2259,11 @@ public:
const TDataSetRow &getMonitoringCSR();
void setMonitoringCSR(const TDataSetRow &csr);
/// accessors to the stopped npc
const TDataSetRow &getStoppedNpc();
void setStoppedNpc(const TDataSetRow &npc);
void setStoppedNpcTick();
/// get death penalties
CDeathPenalties &getDeathPenalties();
@ -3344,6 +3349,7 @@ private:
NLMISC::TGameCycle _LastTickSaved;
NLMISC::TGameCycle _LastTickCompassUpdated;
NLMISC::TGameCycle _LastTickNpcStopped;
/// permanent score modifiers (given by bricks)
sint32 _ScorePermanentModifiers[SCORES::NUM_SCORES];
@ -3696,6 +3702,8 @@ private:
/// number of creatures attacking the player
uint8 _AggroCount;
TDataSetRow _StoppedNpc;
/// guild id of the player
uint32 _GuildId;
/// guild id of the player

@ -742,6 +742,13 @@ inline const TDataSetRow& CCharacter::getMonitoringCSR()
//------------------------------------------------------------------------------
inline const TDataSetRow& CCharacter::getStoppedNpc()
{
return _StoppedNpc;
}
//------------------------------------------------------------------------------
inline float CCharacter::nextDeathPenaltyFactor() const
{
return _NextDeathPenaltyFactor;

Loading…
Cancel
Save