Merge branch 'ark'

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

@ -1708,7 +1708,9 @@ void addParam(const std::string &paramStr, std::vector<TBrickParam::IIdPtr> &Par
// $*-s std::string Attribute // attribute name
// $*-s std::string Value // attribute value
// $*-i uint32 Charge // initial charge of sapload
// $*-i uint32 Modifier // onus on attribute
// $*-i uint32 Modifier // Bonus on attribute
// $*-i uint32 Faction // Required faction
// $*-i uint32 Fame // Required fame in faction (if fame >= 30, require the rite too)
Params.push_back(new CSBrickParamJewelAttrs(tail));
break;
}

@ -5188,13 +5188,16 @@ struct CSBrickParamJewelAttrs : public TBrickParam::IId
uint32 Modifier;
// required Faction
std::string RequiredFaction;
// required Fame
sint32 RequiredFame;
CSBrickParamJewelAttrs():
Attribute(),
Value(),
Charge(),
Modifier(),
RequiredFaction()
RequiredFaction(),
RequiredFame()
{
_Id = TBrickParam::JEWEL_ATTRS;
@ -5224,6 +5227,11 @@ struct CSBrickParamJewelAttrs : public TBrickParam::IId
else
RequiredFaction = "";
if (!RequiredFaction.empty() && args.size() > 5)
NLMISC::fromString(args[5], RequiredFame);
else
RequiredFame = -200;
return *this;
}
};

@ -1015,7 +1015,7 @@ NLMISC_COMMAND(deleteInventoryItems, "Delete items from a characters inventory",
}
//----------------------------------------------------------------------------
NLMISC_COMMAND(enchantEquipedItem, "enchantEquipedItem", "<uid> <slotname> <sheet1>,[<sheet2> ...]")
NLMISC_COMMAND(enchantEquipedItem, "enchantEquipedItem", "<uid> <slotname> <sheet1>,[<sheet2> ...] [<maxSpaLoad>]")
{
if (args.size () < 3)
{
@ -1027,12 +1027,12 @@ NLMISC_COMMAND(enchantEquipedItem, "enchantEquipedItem", "<uid> <slotname> <shee
string selected_slot = args[1];
std::vector<CSheetId> sheets;
if (args[2] != "*")
{
std::vector<string> sheet_names;
NLMISC::splitString(args[2], ",", sheet_names);
std::vector<CSheetId> sheets;
for (uint32 i=0; i<sheet_names.size(); i++)
{
sheets.push_back(CSheetId(sheet_names[i]));
}
@ -1041,6 +1041,14 @@ NLMISC_COMMAND(enchantEquipedItem, "enchantEquipedItem", "<uid> <slotname> <shee
{
itemPtr->applyEnchantment(sheets);
c->updateJewelsTags(false);
if (args.size() > 3)
{
float maxSapLoad;
fromString(args[3], maxSapLoad);
itemPtr->setMaxSapLoad(maxSapLoad);
}
log.displayNL("OK");
return true;
}
@ -1048,7 +1056,72 @@ NLMISC_COMMAND(enchantEquipedItem, "enchantEquipedItem", "<uid> <slotname> <shee
return true;
}
//----------------------------------------------------------------------------
NLMISC_COMMAND(getEnchantmentInEquipedItem, "getEnchantmentInEquipedItem", "<uid> <slotname>")
{
if (args.size () < 2)
{
log.displayNL("ERR: Invalid number of parameters. Parameters: <uid> <slotname>");
return false;
}
GET_ACTIVE_CHARACTER
string selected_slot = args[1];
CGameItemPtr itemPtr = c->getItem(INVENTORIES::equipment, SLOT_EQUIPMENT::stringToSlotEquipment(selected_slot));
if (itemPtr != NULL)
{
const std::vector<CSheetId> &sheets = itemPtr->getEnchantment();
for (uint32 i=0; i<sheets.size(); i++)
log.displayNL("%s", sheets[i].toString().c_str());
}
return true;
}
//----------------------------------------------------------------------------
NLMISC_COMMAND(sapLoadInEquipedItem, "reloadSapLoadInEquipedItem", "<uid> <slotname> [<value>]")
{
if (args.size () < 2)
{
log.displayNL("ERR: invalid arg count");
return false;
}
GET_ACTIVE_CHARACTER
string selected_slot = args[1];
CGameItemPtr itemPtr = c->getItem(INVENTORIES::equipment, SLOT_EQUIPMENT::stringToSlotEquipment(selected_slot));
if (itemPtr != NULL)
{
if (args.size() >= 3)
{
string quant = args[2];
uint32 quantity;
if (quant[0] == '-')
{
if (quant.size() > 1)
{
fromString(quant.substr(1), quantity);
itemPtr->consumeSapLoad(quantity);
}
}
else
{
fromString(quant, quantity);
itemPtr->reloadSapLoad(quantity);
}
}
uint32 sapLoad = itemPtr->sapLoad();
uint32 max = itemPtr->maxSapLoad();
log.displayNL("%u / %u", sapLoad, max);
}
return true;
}
//----------------------------------------------------------------------------
@ -4173,15 +4246,15 @@ NLMISC_COMMAND(closeDynChat, "close DynChat", "<uid> <process missions?>")
return true;
}
NLMISC_COMMAND(manageBuilding, "Manage a building", "<uid> <action>")
NLMISC_COMMAND(manageBuilding, "Manage a building", "<uid> <action> <value>")
{
if (args.size() < 2) return false;
if (args.size() < 3) 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)
if (action == "trigger_in")
{
uint32 liftId;
NLMISC::fromString(args[2], liftId);
@ -4192,7 +4265,7 @@ NLMISC_COMMAND(manageBuilding, "Manage a building", "<uid> <action>")
CBuildingManager::getInstance()->removeTriggerRequest(c->getEntityRowId());
}
else if (action == "add_guild_room" && args.size() == 3)
else if (action == "add_guild_room")
{
CBuildingPhysicalGuild * building = dynamic_cast<CBuildingPhysicalGuild *>(CBuildingManager::getInstance()->getBuildingPhysicalsByName(args[2]));
if (building)
@ -4203,7 +4276,7 @@ NLMISC_COMMAND(manageBuilding, "Manage a building", "<uid> <action>")
return true;
}
}
else if (action == "add_player_room" && args.size () == 3)
else if (action == "add_player_room")
{
CBuildingPhysicalPlayer * building = dynamic_cast<CBuildingPhysicalPlayer *>(CBuildingManager::getInstance()->getBuildingPhysicalsByName(args[2]));
if (building)
@ -4214,7 +4287,7 @@ NLMISC_COMMAND(manageBuilding, "Manage a building", "<uid> <action>")
return true;
}
}
else if (action == "buy_guild_room" && args.size () == 3)
else if (action == "buy_guild_room")
{
CBuildingPhysicalGuild * building = dynamic_cast<CBuildingPhysicalGuild *>(CBuildingManager::getInstance()->getBuildingPhysicalsByName(args[2]));
if (building)
@ -4229,7 +4302,7 @@ NLMISC_COMMAND(manageBuilding, "Manage a building", "<uid> <action>")
}
}
}
else if (action == "buy_player_room" && args.size () == 3)
else if (action == "buy_player_room")
{
CBuildingPhysicalPlayer * building = dynamic_cast<CBuildingPhysicalPlayer *>(CBuildingManager::getInstance()->getBuildingPhysicalsByName(args[2]));
if ( building )
@ -4240,7 +4313,7 @@ NLMISC_COMMAND(manageBuilding, "Manage a building", "<uid> <action>")
return true;
}
}
else if (action == "set_player_room" && args.size () == 3)
else if (action == "set_player_room")
{
/* CBuildingPhysicalPlayer * building = dynamic_cast<CBuildingPhysicalPlayer *>(CBuildingManager::getInstance()->getBuildingPhysicalsByName(args[2]));
if ( building )
@ -4254,7 +4327,7 @@ NLMISC_COMMAND(manageBuilding, "Manage a building", "<uid> <action>")
return true;
}*/
}
else if (action == "get_access_room" && args.size () == 3)
else if (action == "get_access_room")
{
CCharacter *owner = PlayerManager.getCharacterByName(CShardNames::getInstance().makeFullNameFromRelative(c->getHomeMainlandSessionId(), args[2]));

@ -11674,30 +11674,29 @@ void CCharacter::setNewTitle(const string &title)
}
//-----------------------------------------------------------------------------
void CCharacter::setTagPvPA(const string &tag)
void CCharacter::setTagA(const string &tag)
{
_TagPvPA = tag;
_TagA = tag;
}
//-----------------------------------------------------------------------------
void CCharacter::setTagPvPB(const string &tag)
void CCharacter::setTagB(const string &tag)
{
_TagPvPB = tag;
_TagB = tag;
}
//-----------------------------------------------------------------------------
void CCharacter::setTagA(const string &tag)
void CCharacter::setTagPvPA(const string &tag)
{
_TagA = tag;
_TagPvPA = tag;
}
//-----------------------------------------------------------------------------
void CCharacter::setTagB(const string &tag)
void CCharacter::setTagPvPB(const string &tag)
{
_TagB = tag;
_TagPvPB = tag;
}
//-----------------------------------------------------------------------------
void CCharacter::setDontTranslate(const string &langs)
{
@ -11731,7 +11730,12 @@ CSBrickParamJewelAttrs *CCharacter::getJewelAttrs(const string &attribute, SLOT_
CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs*)param;
if (param->id() == TBrickParam::JEWEL_ATTRS && sbrickParam->Attribute == attribute)
{
if (checkRequiredFaction(sbrickParam->RequiredFaction)) {
// Check required fame (if no required faction, check are ok)
if (checkRequiredFame(sbrickParam->RequiredFaction, sbrickParam->RequiredFame))
{
// Require a faction/nation/org only for fame up to 30
if (sbrickParam->RequiredFame < 30 || checkRequiredFaction(sbrickParam->RequiredFaction))
{
return sbrickParam;
}
}
@ -11741,6 +11745,7 @@ CSBrickParamJewelAttrs *CCharacter::getJewelAttrs(const string &attribute, SLOT_
}
}
}
}
else
{
const CGameItemPtr item = inv->getItem(slot);
@ -11758,7 +11763,12 @@ CSBrickParamJewelAttrs *CCharacter::getJewelAttrs(const string &attribute, SLOT_
CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs*)param;
if (param->id() == TBrickParam::JEWEL_ATTRS && sbrickParam->Attribute == attribute)
{
if (checkRequiredFaction(sbrickParam->RequiredFaction)) {
// Check required fame (if no required faction, check are ok)
if (checkRequiredFame(sbrickParam->RequiredFaction, sbrickParam->RequiredFame))
{
// Require a faction/nation/org only for fame up to 30
if (sbrickParam->RequiredFame < 30 || checkRequiredFaction(sbrickParam->RequiredFaction))
{
return sbrickParam;
}
}
@ -11768,6 +11778,7 @@ CSBrickParamJewelAttrs *CCharacter::getJewelAttrs(const string &attribute, SLOT_
}
}
}
}
return NULL;
}
@ -15675,8 +15686,23 @@ void CCharacter::sendUrl(const string &url)
string targetInfos = getTargetInfos();
string serverInfos = getServerInfos(getState().X / 1000., getState().Y / 1000.);
strFindReplace(targetInfos, " ", "%20");
string final_url;
if (url.find("$(") != string::npos )
{
final_url = url;
strFindReplace(final_url, "$(pos)", playerPos);
strFindReplace(final_url, "$(target)", targetInfos);
strFindReplace(final_url, "$(server)", serverInfos);
strFindReplace(final_url, "$(hands)", getEquipementInfos(INVENTORIES::handling));
strFindReplace(final_url, "$(equiped)", getEquipementInfos(INVENTORIES::equipment));
final_url += toString("&urlidx=%d", getUrlIndex());
}
else
{
final_url = url + toString("&urlidx=%d", getUrlIndex())+"&player_pos="+playerPos+"&target_infos="+targetInfos+"&server_infos="+serverInfos;
}
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();
uint32 userId = PlayerManager.getPlayerId(getId());
@ -21223,31 +21249,41 @@ void CCharacter::updateJewelsTags(bool remove, bool update)
string tagA = getTagA();
string tagB = getTagB();
string tagPvPA = getTagPvPA();
string tagPvPB = getTagPvPB();
setTagA("");
setTagB("");
setTagPvPA("");
setTagPvPB("");
if (remove)
return;
CSBrickParamJewelAttrs *sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::HEADDRESS);
if (sbrickParam)
{
setTagA(sbrickParam->Value);
}
sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::NECKLACE);
if (sbrickParam)
{
setTagB(sbrickParam->Value);
}
sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::EARL);
if (sbrickParam)
setTagPvPA(sbrickParam->Value);
sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::EARR);
if (sbrickParam)
setTagPvPB(sbrickParam->Value);
if (!update)
return;
if (getTagA() != tagA || getTagB() != tagB) {
if (getTagA() != tagA || getTagB() != tagB || getTagPvPA() != tagPvPA || getTagPvPB() != tagPvPB)
{
registerName();
}
}
}
//----------------------------------------------------------------------------

@ -2592,6 +2592,7 @@ public:
std::string getFullTitle() const;
bool checkRequiredFaction(std::string faction) const;
bool checkRequiredFame(std::string faction, sint32 fame) const;
std::string getTagA() const;
void setTagA(const std::string &tag);

@ -1040,6 +1040,21 @@ inline bool CCharacter::checkRequiredFaction(std::string faction) const
(faction == "zorai" && allegeance.second == PVP_CLAN::Zorai && getOrganization() == 0));
}
inline bool CCharacter::checkRequiredFame(std::string faction, sint32 fame) const
{
if (faction == "")
return true;
uint32 fameIdx = PVP_CLAN::getFactionIndex(PVP_CLAN::fromString(faction));
sint32 playerFame = CFameInterface::getInstance().getFameIndexed(_Id, fameIdx);
if (fame == NO_FAME)
return false;
return playerFame >= (fame * 6000);
}
//------------------------------------------------------------------------------
inline uint32 CCharacter::getOrganization() const

Loading…
Cancel
Save