Merge with Ark

feature/prepare-cross-merge
Nuno Gonçalves 5 years ago committed by kaetemi
parent dad6e43285
commit 417b42487d
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -2997,6 +2997,7 @@ void setEventCode_sss_(CStateInstance* entity, CScriptStack& stack)
strFindReplace(code, "http://", "");
strFindReplace(code, "https://", "");
strFindReplace(code, "/index.php?", " ");
strFindReplace(code, "&nbsp&", " ");
CGroup* group = entity->getGroup();
FOREACH(botIt, CCont<CBot>, group->bots())

@ -8207,6 +8207,8 @@ NLMISC_COMMAND(eScript, "executes a script on an event npc group", "<player eid>
pos = arg.find("(eid:");
}
strFindReplace(arg, "#item:", "");
strFindReplace(arg, "#rrp:", "");
msgout.serial(arg);
}
CWorldInstances::instance().msgToAIInstance2(instanceNumber, msgout);

@ -62,6 +62,13 @@ public:
updataDb(user);
}
double getDeathXPToGain() { return _DeathXPToGain - _CurrentDeathXP; }
void addDeathXP(CCharacter *user, double xp)
{
_CurrentDeathXP += xp;
updataDb(*user);
}
void addDeath(CCharacter& user, float deathPenaltyFactor);
uint32 updateResorption( CCharacter& user );

@ -36,6 +36,7 @@
#include "team_manager/team.h"
#include "team_manager/team_manager.h"
#include "weather_everywhere.h"
#include "death_penalties.h"
#include "mission_manager/mission_team.h"
#include "mission_manager/mission_step_ai.h"
#include "mission_manager/mission_guild.h"
@ -3103,6 +3104,30 @@ NLMISC_COMMAND(getPlayerPets, "get player pets", "<uid>")
return true;
}
//----------------------------------------------------------------------------
NLMISC_COMMAND(spawnPlayerPet, "spawn player pet", "<uid> <slot>")
{
if (args.size() < 2)
return false;
GET_ACTIVE_CHARACTER
uint32 index;
fromString(args[0], index);
c->setRespawnMainLandInTown(true);
c->spawnCharacterAnimal(index);
c->setRespawnMainLandInTown(false);
log.displayNL("OK");
return true;
}
//----------------------------------------------------------------------------
NLMISC_COMMAND(setPlayerPetName, "change the name of a player pet", "<uid> <index> <name>")
{
@ -3113,7 +3138,10 @@ NLMISC_COMMAND(setPlayerPetName, "change the name of a player pet", "<uid> <inde
uint8 index;
fromString(args[1], index);
ucstring customName;
customName.fromUtf8(args[2]);
if (args[2] != "-")
customName.fromUtf8(args[2]);
else
customName = "";
c->setAnimalName(index, customName);
log.displayNL("OK");
return true;
@ -3532,6 +3560,30 @@ NLMISC_COMMAND(addXp, "Gain experience in a given skills", "<uid> <xp> <skill> [
return true;
}
NLMISC_COMMAND(removeDp, "Update the DP", "<uid> <dp>")
{
if (args.size() < 2) return false;
GET_ACTIVE_CHARACTER
double dpToGain = c->getDeathPenalties().getDeathXPToGain();
log.displayNL("%d", dpToGain);
uint32 remove;
NLMISC::fromString(args[1], remove);
if (remove <= 100 && remove >0)
{
dpToGain = remove * (dpToGain / 100);
c->getDeathPenalties().addDeathXP(c, dpToGain);
}
log.displayNL("%d", dpToGain);
return true;
}
NLMISC_COMMAND(addBricks, "Specified player learns given brick", "<uid> <brick1,brick2>")
{
if (args.size() != 2) return false;

@ -22514,7 +22514,7 @@ void CCharacter::setMonitoringCSR(const TDataSetRow &csr)
//------------------------------------------------------------------------------
const CDeathPenalties &CCharacter::getDeathPenalties() const
CDeathPenalties &CCharacter::getDeathPenalties()
{
return *_DeathPenalties;
}

@ -2260,7 +2260,7 @@ public:
void setMonitoringCSR(const TDataSetRow &csr);
/// get death penalties
const CDeathPenalties &getDeathPenalties() const;
CDeathPenalties &getDeathPenalties();
float nextDeathPenaltyFactor() const;
void resetNextDeathPenaltyFactor();
@ -2600,6 +2600,8 @@ public:
uint32 getLastMountTick() const;
uint32 getLastFreeMount() const;
uint32 getLastExchangeMount() const;
bool getRespawnMainLandInTown() const;
void setRespawnMainLandInTown(bool status);
const std::list<TCharacterLogTime> &getLastLogStats() const;
void updateConnexionStat();

@ -1049,6 +1049,15 @@ inline uint32 CCharacter::getLastExchangeMount() const
return _LastExchangeMount;
}
inline bool CCharacter::getRespawnMainLandInTown() const
{
return _RespawnMainLandInTown;
}
inline void CCharacter::setRespawnMainLandInTown(bool status)
{
_RespawnMainLandInTown = status;
}
//------------------------------------------------------------------------------
inline const std::list<TCharacterLogTime>& CCharacter::getLastLogStats() const

@ -69,6 +69,7 @@
#include "player_manager/player.h"
#include "team_manager/team_manager.h"
#include "pvp_manager/pvp.h"
#include "shop_type/named_items.h"
#include "pvp_manager/pvp_faction_reward_manager/pvp_faction_reward_manager.h"
#include "server_share/r2_variables.h"
@ -355,7 +356,92 @@ void CCharacterProgressionPVE::creatureDeath(TDataSetRow creature)
{
CCharacter* player = PlayerManager.getChar(*itPlayer);
if (player)
player->sendUrl(url);
{
if (url.substr(0, 6) == "#item:")
{
nlinfo("item");
vector<string> items_infos;
NLMISC::splitString(url, ":", items_infos);
if (items_infos.size() == 5)
{ // item sheet:quality:quantity
nlinfo("item sheet");
INVENTORIES::TInventory selected_inv = INVENTORIES::toInventory(items_infos[1].c_str());
if (selected_inv != INVENTORIES::temporary && selected_inv !=INVENTORIES::temporary)
selected_inv = INVENTORIES::bag;
string sheetname = items_infos[2]+".sitem";
CSheetId sheet = CSheetId(sheetname.c_str());
if (sheet != CSheetId::Unknown)
{
uint16 quality;
NLMISC::fromString(items_infos[3], quality);
uint16 quantity;
NLMISC::fromString(items_infos[4], quantity);
CGameItemPtr item;
if (quantity == 0)
item = GameItemManager.createItem(sheet, quality, false, false);
else
{
CMissionItem mItem;
items_infos[0] = items_infos[2];
items_infos[1] = items_infos[3];
items_infos[2] = "0";
items_infos.resize(3);
mItem.buildFromScript(items_infos);
item = mItem.createItem(quantity);
}
if (item != NULL)
{
if (player->addItemToInventory(selected_inv, item))
{
SM_STATIC_PARAMS_3(params, STRING_MANAGER::integer, STRING_MANAGER::item, STRING_MANAGER::integer);
params[0].Int = quantity;
params[1].SheetId = sheet;
params[2].Int = quality;
PHRASE_UTILITIES::sendDynamicSystemMessage(player->getEntityRowId(), "AUTO_LOOT_SUCCESS", params);
}
else
{
item.deleteItem();
}
}
}
}
else if (items_infos.size() == 4)
{ // named item id:quantity
nlinfo("named item");
INVENTORIES::TInventory selected_inv = INVENTORIES::toInventory(items_infos[1].c_str());
if (selected_inv != INVENTORIES::temporary && selected_inv !=INVENTORIES::temporary)
selected_inv = INVENTORIES::bag;
string name = items_infos[2];
uint16 quantity;
NLMISC::fromString(items_infos[3], quantity);
CGameItemPtr item = CNamedItems::getInstance().createNamedItem(name, quantity);
if (item != NULL)
{
if (player->addItemToInventory(selected_inv, item)) {
SM_STATIC_PARAMS_2(params, STRING_MANAGER::dyn_string_id, STRING_MANAGER::integer);
params[0].StringId = item->sendNameId(player);
params[1].Int = quantity;
PHRASE_UTILITIES::sendDynamicSystemMessage(player->getEntityRowId(),"MIS_RECV_NAMED_ITEM", params);
}
else
{
item.deleteItem();
}
}
}
}
else
{
player->sendUrl(url);
}
}
}
}

Loading…
Cancel
Save