Merge branch 'ark'

feature/prepare-cross-merge
Nuno 4 years ago committed by kaetemi
parent 3ccdb43683
commit 4108367413
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -3193,7 +3193,64 @@ void resetHealGroups_(CStateInstance* entity, CScriptStack& stack)
}
//----------------------------------------------------------------------------
/** @page code
@subsection spawnGroup_fsssffff_
Spawn new group.
Arguments: f(NbrBots), f(spawnBot) s(Sheet), s(Name), s(Look), f(x), f(y), f(orientation), f(dispersion) ->
@code
@endcode
*/
// CGroup
void spawnGroup_ffsssffff_(CStateInstance* entity, CScriptStack& stack)
{
double dispersionRadius = (double)(float)stack.top();
stack.pop();
double orientation = (double)(float)stack.top();
stack.pop();
double y = (double)(float)stack.top();
stack.pop();
double x = (double)(float)stack.top();
stack.pop();
string look = (string)stack.top();
stack.pop();
string name = (string)stack.top();
stack.pop();
CSheetId sheetId((string)stack.top());
stack.pop();
bool spawn = (float&)stack.top()!=0.0f;
stack.pop();
uint nbBots = (uint)(float)stack.top();
stack.pop();
IManagerParent* const managerParent = entity->getGroup()->getOwner()->getOwner();
CAIInstance* const aiInstance = dynamic_cast<CAIInstance*>(managerParent);
if (!aiInstance)
return;
CGroupNpc* grp = dynamic_cast<CGroupNpc*>(entity->getGroup());
if (grp)
{
CSpawnGroupNpc* spawnGroup = grp->getSpawnObj();
if (spawnGroup)
aiInstance->eventCreateNpcGroup(nbBots, sheetId, CAIVector(x, y), dispersionRadius, spawn, orientation, name, look, spawnGroup->getCell());
else
aiInstance->eventCreateNpcGroup(nbBots, sheetId, CAIVector(x, y), dispersionRadius, spawn, orientation, name, look);
}
}
std::map<std::string, FScrptNativeFunc> nfGetNpcGroupNativeFunctions()
@ -3269,6 +3326,8 @@ std::map<std::string, FScrptNativeFunc> nfGetNpcGroupNativeFunctions()
REGISTER_NATIVE_FUNC(functions, setUserModel_s_);
REGISTER_NATIVE_FUNC(functions, setCustomLoot_s_);
REGISTER_NATIVE_FUNC(functions, spawnGroup_ffsssffff_);
// REGISTER_NATIVE_FUNC(functions, hideMissionStepIcon_b_);
// REGISTER_NATIVE_FUNC(functions, hideMissionGiverIcon_b_);

@ -71,7 +71,7 @@ using namespace NLNET;
return true; \
} \
#define GET_INVITATION_MODULE( _id_ ) \
GET_CHAR( _id_ ) \
CGuildMember *gmModule = NULL; \
@ -279,6 +279,64 @@ NLMISC_COMMAND(guildSetLeader, "set the leader of a guild", "<guildName|<shardId
return true;
}
//----------------------------------------------------------------------------
NLMISC_COMMAND(guildMoney, "get money of guild (if quantity, give/take/set the money)", "<guildName|<shardId>:<guildId> [+-]<quantity>")
{
if (args.size() != 2)
return false;
GET_GUILD(true);
if (guild)
{
uint64 money = guild->getMoney();
if (args.size() == 2)
{
string quant = args[1];
uint64 quantity;
if (quant[0] == '+')
{
if (quant.size() > 1)
{
fromString(quant.substr(1), quantity);
money += quantity;
}
}
else if (quant[0] == '-')
{
if (quant.size() > 1)
{
fromString(quant.substr(1), quantity);
if (money >= quantity)
{
money -= quantity;
}
else
{
log.displayNL("-1"); // No enough money
return true;
}
}
}
else
{
fromString(quant, money);
}
guild->setMoney(money);
}
log.displayNL("%" NL_I64 "u", money);
} else {
log.displayNL("ERR: no guild");
}
return true;
}
//----------------------------------------------------------------------------
// TEST COMMANDS
@ -292,7 +350,7 @@ NLMISC_COMMAND(guildMOTD,"Set the guild message of the day","<userId><message of
CEntityId eId;
eId.fromString(args[0].c_str());
GET_CHAR(eId);
CGuild * guild = CGuildManager::getInstance()->getGuildFromId( user->getGuildId() );
if( guild )
@ -315,7 +373,7 @@ NLMISC_COMMAND(guildCreate,"create a new guild","<userId><name><description><ico
ucstring name = args[1];
ucstring description = args[2];
uint64 icon = NLMISC::atoiInt64( args[3].c_str() );
// get the character and build a proxy from it
GET_CHAR(eId);
CGuildCharProxy proxy(user);
@ -343,9 +401,9 @@ NLMISC_COMMAND(guildJoinInvitation,"guild Join Invitation","<user><target>")
eId2.fromString(args[1].c_str());
CCharacter * firstChar = PlayerManager.getChar( eId1 );
if ( !firstChar )
{
{
log.displayNL("<GUILD>'%s' is not a valid char. Cant process command",eId1.toString().c_str());
return true;
return true;
}
firstChar->setTarget( eId2 );
GET_GUILD_MODULE(eId1);
@ -491,7 +549,7 @@ NLMISC_COMMAND( importGuildFile, "Import a guild file into the server", "<filena
static CPersistentDataRecord pdr;
pdr.clear();
// check if we have a guild file
if ( file.size() == len &&
file.find( "guild_" ) == 0 &&

@ -1471,6 +1471,12 @@ NLMISC_COMMAND(getTarget, "get target of player", "<uid>")
NLMISC_COMMAND(getMoney, "get money of player (if quantity, give/take/set the money)", "<uid> [+-]<quantity>")
{
if (args.size () < 2)
{
log.displayNL("ERR: invalid arg count");
return false;
}
GET_ACTIVE_CHARACTER
uint64 money = c->getMoney();
@ -1516,6 +1522,62 @@ NLMISC_COMMAND(getMoney, "get money of player (if quantity, give/take/set the mo
return true;
}
//----------------------------------------------------------------------------
NLMISC_COMMAND(getGuildMoney, "get money of guild (if quantity, give/take/set the money)", "<uid> [+-]<quantity>")
{
GET_ACTIVE_CHARACTER
CGuild * g = CGuildManager::getInstance()->getGuildFromId(c->getGuildId());
if (g)
{
uint64 money = g->getMoney();
if (args.size() == 2)
{
string quant = args[1];
uint64 quantity;
if (quant[0] == '+')
{
if (quant.size() > 1)
{
fromString(quant.substr(1), quantity);
money += quantity;
}
}
else if (quant[0] == '-')
{
if (quant.size() > 1)
{
fromString(quant.substr(1), quantity);
if (money >= quantity)
{
money -= quantity;
}
else
{
log.displayNL("-1"); // No enough money
return true;
}
}
}
else
{
fromString(quant, money);
}
g->setMoney(money);
}
log.displayNL("%" NL_I64 "u", money);
} else {
log.displayNL("ERR: no guild");
}
return true;
}
//----------------------------------------------------------------------------
NLMISC_COMMAND(getPvpPoints, "get pvp points of player (if quantity, give/take/set the points)", "<uid> [+-]<quantity>")
@ -3879,6 +3941,9 @@ NLMISC_COMMAND(getPlayerGuild, "get player guild informations", "<uid>")
log.displayNL("%d", c->getGuildId());
log.displayNL("%s", guild->getName().toString().c_str());
CGuild::TAllegiances allegiance = guild->getAllegiance();
log.displayNL("%s", PVP_CLAN::toString(allegiance.first).c_str());
log.displayNL("%s", PVP_CLAN::toString(allegiance.second).c_str());
return true;
}
}
@ -4614,7 +4679,7 @@ NLMISC_COMMAND(despawnTargetSource, "Despawn the target source", "<uid>")
//----------------------------------------------------------------------------
NLMISC_COMMAND(setServerPhrase, "Set an IOS phrase", "<id> <phrase> [<language code>]")
NLMISC_COMMAND(setServerPhrase, "Set an IOS phrase", "<phrase> [<language code>]")
{
if (args.size() < 2)
return false;

Loading…
Cancel
Save