Merge branch 'allegories'

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

@ -1705,12 +1705,13 @@ void addParam(const std::string &paramStr, std::vector<TBrickParam::IIdPtr> &Par
case TBrickParam::JEWEL_ATTRS: case TBrickParam::JEWEL_ATTRS:
// $*STRUCT CSBrickParamJewelAttrs TBrickParam::JEWEL_ATTRS // $*STRUCT CSBrickParamJewelAttrs TBrickParam::JEWEL_ATTRS
// $*-s std::string Attribute // attribute name // $*-s std::string Attribute // attribute name
// $*-s std::string Value // attribute value // $*-s std::string Value // attribute value
// $*-i uint32 Charge // initial charge of sapload // $*-i uint32 Charge // initial charge of sapload
// $*-i uint32 Modifier // Bonus on attribute // $*-i uint32 Modifier // Bonus on attribute
// $*-i uint32 Faction // Required faction // $*-i uint32 RequiredFaction // Required faction
// $*-i uint32 Fame // Required fame in faction (if fame >= 30, require the rite too) // $*-i uint32 RequiredFame // Required fame in faction (if fame >= 30, require the rite too)
// $*-s std::string RequiredZones // Required continent/regions (separated by ,)
Params.push_back(new CSBrickParamJewelAttrs(tail)); Params.push_back(new CSBrickParamJewelAttrs(tail));
break; break;
} }

@ -5190,6 +5190,9 @@ struct CSBrickParamJewelAttrs : public TBrickParam::IId
std::string RequiredFaction; std::string RequiredFaction;
// required Fame // required Fame
sint32 RequiredFame; sint32 RequiredFame;
// required Zone
std::string RequiredZones;
CSBrickParamJewelAttrs(): CSBrickParamJewelAttrs():
Attribute(), Attribute(),
@ -5197,7 +5200,8 @@ struct CSBrickParamJewelAttrs : public TBrickParam::IId
Charge(), Charge(),
Modifier(), Modifier(),
RequiredFaction(), RequiredFaction(),
RequiredFame() RequiredFame(),
RequiredZones()
{ {
_Id = TBrickParam::JEWEL_ATTRS; _Id = TBrickParam::JEWEL_ATTRS;
@ -5209,6 +5213,19 @@ struct CSBrickParamJewelAttrs : public TBrickParam::IId
*this=str; *this=str;
} }
void copy(const CSBrickParamJewelAttrs& attr)
{
ParsedOk=true;
Attribute = attr.Attribute;
Value = attr.Value;
Charge = attr.Charge;
Modifier = attr.Modifier;
RequiredFaction = attr.RequiredFaction;
RequiredFame = attr.RequiredFame;
RequiredZones = attr.RequiredZones;
}
const CSBrickParamJewelAttrs& operator=(const std::string& input) const CSBrickParamJewelAttrs& operator=(const std::string& input)
{ {
std::vector<std::string> args; std::vector<std::string> args;
@ -5222,8 +5239,9 @@ struct CSBrickParamJewelAttrs : public TBrickParam::IId
Value=args[1].c_str(); Value=args[1].c_str();
NLMISC::fromString(args[2], Charge); NLMISC::fromString(args[2], Charge);
NLMISC::fromString(args[3], Modifier); NLMISC::fromString(args[3], Modifier);
if (args.size() > 4)
RequiredFaction = args[4].c_str(); if (args.size() > 4 && args[4] != "*")
RequiredFaction = args[4];
else else
RequiredFaction = ""; RequiredFaction = "";
@ -5232,6 +5250,11 @@ struct CSBrickParamJewelAttrs : public TBrickParam::IId
else else
RequiredFame = -200; RequiredFame = -200;
if (args.size() > 6)
RequiredZones = args[6];
else
RequiredZones = "";
return *this; return *this;
} }
}; };

@ -1080,6 +1080,50 @@ void CGameItem::applyEnchantment( const vector< CSheetId >& action )
getInventory()->onItemChanged(getInventorySlot(), INVENTORIES::TItemChangeFlags(INVENTORIES::itc_enchant)); getInventory()->onItemChanged(getInventorySlot(), INVENTORIES::TItemChangeFlags(INVENTORIES::itc_enchant));
} }
void CGameItem::getJewelTagsEnchantments( vector< CSheetId >& sheets )
{
if (_Enchantment .empty())
return;
for ( uint i = 0; i< _Enchantment.size(); i++ )
{
const CStaticBrick * brick = CSheets::getSBrickForm(_Enchantment[i]);
if (brick && brick->Family == BRICK_FAMILIES::BSGMC)
{
if (brick->Params.size() > 0)
{
const TBrickParam::IId* param = brick->Params[0];
CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs*)param;
if (param->id() == TBrickParam::JEWEL_ATTRS && sbrickParam->Attribute == "tag")
sheets.push_back(_Enchantment[i]);
}
}
}
return;
}
void CGameItem::getJewelNonTagsEnchantments( vector< CSheetId >& sheets )
{
if (_Enchantment.empty())
return;
for ( uint i = 0; i< _Enchantment.size(); i++ )
{
const CStaticBrick * brick = CSheets::getSBrickForm(_Enchantment[i]);
if (brick && (brick->Family == BRICK_FAMILIES::BSGMC || brick->Family == BRICK_FAMILIES::BSGMCB))
{
if (brick->Params.size() > 0)
{
const TBrickParam::IId* param = brick->Params[0];
CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs*)param;
if (param->id() == TBrickParam::JEWEL_ATTRS && sbrickParam->Attribute != "tag")
sheets.push_back(_Enchantment[i]);
}
}
}
return;
}
//----------------------------------------------- //-----------------------------------------------
// resetEnchantment : // resetEnchantment :
//----------------------------------------------- //-----------------------------------------------

@ -437,6 +437,9 @@ public :
void consumeSapLoad( uint32 sapConsumed ); void consumeSapLoad( uint32 sapConsumed );
// apply an enchantment to item // apply an enchantment to item
void applyEnchantment( const std::vector< NLMISC::CSheetId >& action ); void applyEnchantment( const std::vector< NLMISC::CSheetId >& action );
// get jewel enchantements if are tags or not
void getJewelTagsEnchantments( std::vector< NLMISC::CSheetId >& sheets );
void getJewelNonTagsEnchantments( std::vector< NLMISC::CSheetId >& sheets );
// get enchantment // get enchantment
const std::vector< NLMISC::CSheetId >& getEnchantment() const { return _Enchantment; } const std::vector< NLMISC::CSheetId >& getEnchantment() const { return _Enchantment; }
// set sapLoad for recharge sap item // set sapLoad for recharge sap item

@ -122,8 +122,9 @@ void CEquipInvView::onItemChanged(uint32 slot, INVENTORIES::TItemChangeFlags cha
} }
} }
// Update tags // Update jewels enchants
getCharacter()->updateJewelsTags(false); getCharacter()->updateJewelsTags(false);
getCharacter()->updateJewelsModifiers();
} }
// **************************************************************************** // ****************************************************************************

@ -102,6 +102,15 @@ bool CExchangeView::putItemInExchange(uint32 bagSlot, uint32 exchangeSlot, uint3
return false; return false;
} }
// you cannot exchange jewels with non tags allegories
std::vector<CSheetId> sheets;
item->getJewelNonTagsEnchantments(sheets);
if (sheets.size() > 0)
{
CCharacter::sendDynamicSystemMessage(getCharacter()->getId(), "JEWEL_WITH_ALLEGORIES");
return false;
}
if( getCharacter()->isAnActiveXpCatalyser(item) ) if( getCharacter()->isAnActiveXpCatalyser(item) )
return false; return false;

@ -1001,6 +1001,15 @@ void CGuild::putItem( CCharacter * user, uint32 slot, uint32 quantity, uint16 se
return; return;
} }
// you cannot exchange jewels with non tags allegories
std::vector<CSheetId> sheets;
item->getJewelNonTagsEnchantments(sheets);
if (sheets.size() > 0)
{
CCharacter::sendDynamicSystemMessage( user->getId(),"GUILD_ITEM_CANT_BE_PUT" );
return;
}
// try to move the required quantity of the item // try to move the required quantity of the item
if ( CInventoryBase::moveItem( if ( CInventoryBase::moveItem(
user->getInventory(INVENTORIES::bag), slot, user->getInventory(INVENTORIES::bag), slot,

@ -1026,12 +1026,34 @@ NLMISC_COMMAND(deleteInventoryItems, "Delete items from a characters inventory",
return true; return true;
} }
string getJewelEnchantAttr(CSheetId sbrick)
{
const CStaticBrick * brick = CSheets::getSBrickForm(sbrick);
if (brick && (brick->Family == BRICK_FAMILIES::BSGMC || brick->Family == BRICK_FAMILIES::BSGMCB))
{
if (brick->Params.size() > 0)
{
const TBrickParam::IId* param = brick->Params[0];
CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs*)param;
if (param->id() == TBrickParam::JEWEL_ATTRS)
return sbrickParam->Attribute;
}
}
return "";
}
//enchantEquipedItem 530162 WristR jmod_focus_tryker_1.sbrick
//enchantEquipedItem 530162 Neck tag_fyros_3.sbrick
//enchantEquipedItem 530162 Neck jrez_fulllife_tryker.sbrick,jboost2.sbrick
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
NLMISC_COMMAND(enchantEquipedItem, "enchantEquipedItem", "<uid> <slotname> <sheet1>,[<sheet2> ...] [<maxSpaLoad>]") NLMISC_COMMAND(enchantEquipedItem, "enchantEquipedItem", "<uid> <slotname> <sheet1>,[<sheet2> ...] [<maxSpaLoad>]")
{ {
if (args.size () < 3) if (args.size () < 3)
{ {
log.displayNL("ERR: Invalid number of parameters. Parameters: <inventory> <sheetnames> <quality> <quantity>"); log.displayNL("ERR: Invalid number of parameters. Parameters: <uid> <slotname> <sheet1>,[<sheet2> ...] [<maxSpaLoad>]");
return false; return false;
} }
@ -1039,20 +1061,31 @@ NLMISC_COMMAND(enchantEquipedItem, "enchantEquipedItem", "<uid> <slotname> <shee
string selected_slot = args[1]; string selected_slot = args[1];
bool isTag = false;
std::vector<CSheetId> sheets; std::vector<CSheetId> sheets;
if (args[2] != "*") if (args[2] != "*")
{ {
std::vector<string> sheet_names; std::vector<string> sheet_names;
NLMISC::splitString(args[2], ",", sheet_names); NLMISC::splitString(args[2], ",", sheet_names);
for (uint32 i=0; i<sheet_names.size(); i++) for (uint32 i=0; i<sheet_names.size(); i++)
sheets.push_back(CSheetId(sheet_names[i])); {
CSheetId sheet = CSheetId(sheet_names[i]);
if (getJewelEnchantAttr(sheet) == "tag")
isTag = true;
sheets.push_back(sheet);
}
} }
CGameItemPtr itemPtr = c->getItem(INVENTORIES::equipment, SLOT_EQUIPMENT::stringToSlotEquipment(selected_slot)); CGameItemPtr itemPtr = c->getItem(INVENTORIES::equipment, SLOT_EQUIPMENT::stringToSlotEquipment(selected_slot));
if (itemPtr != NULL) if (itemPtr != NULL)
{ {
if (isTag)
itemPtr->getJewelNonTagsEnchantments(sheets);
else
itemPtr->getJewelTagsEnchantments(sheets);
itemPtr->applyEnchantment(sheets); itemPtr->applyEnchantment(sheets);
c->updateJewelsTags(false);
if (args.size() > 3) if (args.size() > 3)
{ {

@ -551,6 +551,11 @@ CCharacter::CCharacter()
for (uint i = 0; i < SCORES::NUM_SCORES; ++i) for (uint i = 0; i < SCORES::NUM_SCORES; ++i)
_ScorePermanentModifiers[i] = 0; _ScorePermanentModifiers[i] = 0;
// init jewel enchantement
for (uint i = 0; i < SLOT_EQUIPMENT::NB_SLOT_EQUIPMENT; ++i)
_JewelEnchants[i] = CSBrickParamJewelAttrs();
// init owner character for CItemsForSale class member // init owner character for CItemsForSale class member
_ItemsInShopStore = new CItemsForSale; _ItemsInShopStore = new CItemsForSale;
_ItemsInShopStore->setOwnerCharacter(this); _ItemsInShopStore->setOwnerCharacter(this);
@ -2022,19 +2027,60 @@ void CCharacter::respawn(sint32 x, sint32 y, sint32 z, float heading, bool apply
//--------------------------------------------------- //---------------------------------------------------
void CCharacter::applyRespawnEffects(bool applyDP) void CCharacter::applyRespawnEffects(bool applyDP)
{ {
CSheetId usedSheet;
CSBrickParamJewelAttrs sbrickParam = getJewelAttrs("rez", SLOT_EQUIPMENT::NECKLACE, usedSheet);
SM_STATIC_PARAMS_1(params, STRING_MANAGER::sbrick);
params[0].SheetId = usedSheet;
if (applyDP) if (applyDP)
{ {
// Check if in Powo and don't have dp flag
if (getPowoCell() != 0 && !getPowoFlag("dp"))
_NextDeathPenaltyFactor = 0;
if (sbrickParam.ParsedOk && sbrickParam.Value == "noDP" && (rand() % 100) < sbrickParam.Modifier)
{
sendDynamicSystemMessage(_Id, "ALLEGORY_EFFECT_TRIGGERED", params);
_NextDeathPenaltyFactor = 0;
}
if (_NextDeathPenaltyFactor != 0) if (_NextDeathPenaltyFactor != 0)
_DeathPenalties->addDeath(*this, _NextDeathPenaltyFactor); _DeathPenalties->addDeath(*this, _NextDeathPenaltyFactor);
resetNextDeathPenaltyFactor(); resetNextDeathPenaltyFactor();
} }
_PhysScores._PhysicalScores[SCORES::hit_points].Current = _PhysScores._PhysicalScores[SCORES::hit_points].Base / 10; if (sbrickParam.ParsedOk && sbrickParam.Value == "halfLife" && (rand() % 100) < sbrickParam.Modifier)
_PhysScores._PhysicalScores[SCORES::stamina].Current = _PhysScores._PhysicalScores[SCORES::stamina].Base / 10; {
_PhysScores._PhysicalScores[SCORES::sap].Current = _PhysScores._PhysicalScores[SCORES::sap].Base / 10; sendDynamicSystemMessage(_Id, "ALLEGORY_EFFECT_TRIGGERED", params);
_PhysScores._PhysicalScores[SCORES::focus].Current = _PhysScores._PhysicalScores[SCORES::focus].Base / 10; _PhysScores._PhysicalScores[SCORES::hit_points].Current = _PhysScores._PhysicalScores[SCORES::hit_points].Base / 2;
_PhysScores._PhysicalScores[SCORES::stamina].Current = _PhysScores._PhysicalScores[SCORES::stamina].Base / 2;
_PhysScores._PhysicalScores[SCORES::sap].Current = _PhysScores._PhysicalScores[SCORES::sap].Base / 2;
_PhysScores._PhysicalScores[SCORES::focus].Current = _PhysScores._PhysicalScores[SCORES::focus].Base / 2;
}
else if (sbrickParam.ParsedOk && sbrickParam.Value == "goodLife" && (rand() % 100) < sbrickParam.Modifier)
{
sendDynamicSystemMessage(_Id, "ALLEGORY_EFFECT_TRIGGERED", params);
_PhysScores._PhysicalScores[SCORES::hit_points].Current = _PhysScores._PhysicalScores[SCORES::hit_points].Base / 1.33333;
_PhysScores._PhysicalScores[SCORES::stamina].Current = _PhysScores._PhysicalScores[SCORES::stamina].Base / 1.33333;
_PhysScores._PhysicalScores[SCORES::sap].Current = _PhysScores._PhysicalScores[SCORES::sap].Base / 1.33333;
_PhysScores._PhysicalScores[SCORES::focus].Current = _PhysScores._PhysicalScores[SCORES::focus].Base / 1.33333;
}
else if (sbrickParam.ParsedOk && sbrickParam.Value == "fullLife" && (rand() % 100) < sbrickParam.Modifier)
{
sendDynamicSystemMessage(_Id, "ALLEGORY_EFFECT_TRIGGERED", params);
_PhysScores._PhysicalScores[SCORES::hit_points].Current = _PhysScores._PhysicalScores[SCORES::hit_points].Base;
_PhysScores._PhysicalScores[SCORES::stamina].Current = _PhysScores._PhysicalScores[SCORES::stamina].Base;
_PhysScores._PhysicalScores[SCORES::sap].Current = _PhysScores._PhysicalScores[SCORES::sap].Base;
_PhysScores._PhysicalScores[SCORES::focus].Current = _PhysScores._PhysicalScores[SCORES::focus].Base;
}
else
{
_PhysScores._PhysicalScores[SCORES::hit_points].Current = _PhysScores._PhysicalScores[SCORES::hit_points].Base / 10;
_PhysScores._PhysicalScores[SCORES::stamina].Current = _PhysScores._PhysicalScores[SCORES::stamina].Base / 10;
_PhysScores._PhysicalScores[SCORES::sap].Current = _PhysScores._PhysicalScores[SCORES::sap].Base / 10;
_PhysScores._PhysicalScores[SCORES::focus].Current = _PhysScores._PhysicalScores[SCORES::focus].Base / 10;
}
_Mode = MBEHAV::NORMAL; _Mode = MBEHAV::NORMAL;
_Behaviour = MBEHAV::IDLE; _Behaviour = MBEHAV::IDLE;
_IsDead = false; _IsDead = false;
@ -11801,9 +11847,22 @@ void CCharacter::setDontTranslate(const string &langs)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
CSBrickParamJewelAttrs *CCharacter::getJewelAttrs(const string &attribute, SLOT_EQUIPMENT::TSlotEquipment slot) CSBrickParamJewelAttrs CCharacter::getJewelAttrs(const string &attribute, SLOT_EQUIPMENT::TSlotEquipment slot, CSheetId &usedSheet)
{ {
string contName;
string regionName;
const CRegion* region = NULL;
const CContinent * cont = NULL;
CZoneManager::getInstance().getRegion(getState().X ,getState().Y, &region, &cont);
if (region)
regionName = region->getName();
if (cont)
contName = cont->getName();
CSBrickParamJewelAttrs returnSBrickParam;
CSBrickParamJewelAttrs* boostSBrickParam = NULL;
CInventoryPtr inv = getInventory(INVENTORIES::equipment); CInventoryPtr inv = getInventory(INVENTORIES::equipment);
if (inv) if (inv)
{ {
@ -11818,22 +11877,51 @@ CSBrickParamJewelAttrs *CCharacter::getJewelAttrs(const string &attribute, SLOT_
for (uint i = 0; i < enchant.size(); i++) for (uint i = 0; i < enchant.size(); i++)
{ {
const CStaticBrick * brick = CSheets::getSBrickForm(enchant[i]); const CStaticBrick * brick = CSheets::getSBrickForm(enchant[i]);
if (brick && brick->Family == BRICK_FAMILIES::BSGMC)
if (brick && brick->Family == BRICK_FAMILIES::BSGMCB)
{
if (brick->Params.size() > 0)
{
const TBrickParam::IId* param = brick->Params[0];
boostSBrickParam = (CSBrickParamJewelAttrs*)param;
}
}
else if (brick && brick->Family == BRICK_FAMILIES::BSGMC)
{ {
if (brick->Params.size() > 0) if (brick->Params.size() > 0)
{ {
const TBrickParam::IId* param = brick->Params[0]; const TBrickParam::IId* param = brick->Params[0];
CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs*)param; CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs*)param;
if (param->id() == TBrickParam::JEWEL_ATTRS && sbrickParam->Attribute == attribute) if (param->id() == TBrickParam::JEWEL_ATTRS && sbrickParam->Attribute == attribute)
{ {
bool valid = true;
// Check required fame (if no required faction, check are ok) // Check required fame (if no required faction, check are ok)
if (checkRequiredFame(sbrickParam->RequiredFaction, sbrickParam->RequiredFame)) if (!checkRequiredFame(sbrickParam->RequiredFaction, sbrickParam->RequiredFame))
valid = false;
// Require a faction/nation/org only for fame up to 30
else if (sbrickParam->RequiredFame >= 30 && !checkRequiredFaction(sbrickParam->RequiredFaction))
valid = false;
if (!sbrickParam->RequiredZones.empty())
{ {
// Require a faction/nation/org only for fame up to 30 bool zoneValid = false;
if (sbrickParam->RequiredFame < 30 || checkRequiredFaction(sbrickParam->RequiredFaction)) vector<string> zones;
NLMISC::splitString(sbrickParam->RequiredZones, ",", zones);
for (uint z = 0; z < zones.size(); z++)
{ {
return sbrickParam; if (zones[z] == contName || zones[z] == regionName)
zoneValid = true;
} }
if (!zoneValid)
valid = false;
}
if (valid)
{
usedSheet = enchant[i];
returnSBrickParam.copy(*sbrickParam);
} }
} }
} }
@ -11850,24 +11938,60 @@ CSBrickParamJewelAttrs *CCharacter::getJewelAttrs(const string &attribute, SLOT_
vector< CSheetId > enchant = item->getEnchantment(); vector< CSheetId > enchant = item->getEnchantment();
for (uint i = 0; i < enchant.size(); i++) for (uint i = 0; i < enchant.size(); i++)
{ {
const CStaticBrick * brick = CSheets::getSBrickForm(enchant[i]); const CStaticBrick * brick = CSheets::getSBrickForm(enchant[i]);
if (brick && brick->Family == BRICK_FAMILIES::BSGMC)
if (brick && brick->Family == BRICK_FAMILIES::BSGMCB)
{
if (brick->Params.size() > 0)
{
const TBrickParam::IId* param = brick->Params[0];
boostSBrickParam = (CSBrickParamJewelAttrs*)param;
}
}
else if (brick && brick->Family == BRICK_FAMILIES::BSGMC)
{ {
if (brick->Params.size() > 0) if (brick->Params.size() > 0)
{ {
const TBrickParam::IId* param = brick->Params[0]; const TBrickParam::IId* param = brick->Params[0];
CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs*)param; CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs*)param;
if (param->id() == TBrickParam::JEWEL_ATTRS && sbrickParam->Attribute == attribute) if (param->id() == TBrickParam::JEWEL_ATTRS && sbrickParam->Attribute == attribute)
{ {
bool valid = true;
// Check required fame (if no required faction, check are ok) // Check required fame (if no required faction, check are ok)
if (checkRequiredFame(sbrickParam->RequiredFaction, sbrickParam->RequiredFame)) if (!checkRequiredFame(sbrickParam->RequiredFaction, sbrickParam->RequiredFame))
{ {
// Require a faction/nation/org only for fame up to 30 valid = false;
if (sbrickParam->RequiredFame < 30 || checkRequiredFaction(sbrickParam->RequiredFaction)) }
else if (sbrickParam->RequiredFame >= 30 && !checkRequiredFaction(sbrickParam->RequiredFaction))
{
valid = false;
}
if (!sbrickParam->RequiredZones.empty())
{
bool zoneValid = false;
vector<string> zones;
NLMISC::splitString(sbrickParam->RequiredZones, ",", zones);
for (uint z = 0; z < zones.size(); z++)
{ {
return sbrickParam; if (zones[z] == contName || zones[z] == regionName)
{
zoneValid = true;
}
}
if (!zoneValid) {
valid = false;
} }
} }
if (valid)
{
usedSheet = enchant[i];
returnSBrickParam.copy(*sbrickParam);
}
} }
} }
} }
@ -11876,7 +12000,10 @@ CSBrickParamJewelAttrs *CCharacter::getJewelAttrs(const string &attribute, SLOT_
} }
} }
return NULL; if (boostSBrickParam)
returnSBrickParam.Modifier *= boostSBrickParam->Modifier;
return returnSBrickParam;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -15184,6 +15311,7 @@ void CCharacter::setCurrentRegion(uint16 region)
{ {
_CurrentRegion = region; _CurrentRegion = region;
updateMagicProtectionAndResistance(); updateMagicProtectionAndResistance();
updateJewelsModifiers();
} }
//----------------------------------------------- //-----------------------------------------------
@ -18484,11 +18612,15 @@ void CCharacter::onDisconnection(bool bCrashed)
// Remove handledAIGroups for all missions of the player // Remove handledAIGroups for all missions of the player
despawnAllHandledAIGroup(); despawnAllHandledAIGroup();
updateJewelsModifiers(true);
// update for the unified entity locator // update for the unified entity locator
if (IShardUnifierEvent::getInstance() != NULL && _Enter) if (IShardUnifierEvent::getInstance() != NULL && _Enter)
{ {
IShardUnifierEvent::getInstance()->charDisconnected(_Id); IShardUnifierEvent::getInstance()->charDisconnected(_Id);
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -21039,6 +21171,7 @@ void CPetAnimal::clear()
IsTpAllowed = false; IsTpAllowed = false;
spawnFlag = false; spawnFlag = false;
IsInBag = false; IsInBag = false;
LockedByOwner = false;
Cell = 0; Cell = 0;
} }
@ -21181,6 +21314,9 @@ uint32 CPetAnimal::getAnimalMaxBulk()
if (formBag) if (formBag)
{ {
// zig inventories have bulk proportionnal to size (size is 1->250)
if (creatureBagSheet == CSheetId("zig_inventory.sitem"))
return formBag->BulkMax*1.5;
return formBag->BulkMax; return formBag->BulkMax;
} }
} }
@ -21409,7 +21545,7 @@ void CCharacter::updateParry(ITEMFAMILY::EItemFamily family, SKILLS::ESkills ski
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CCharacter::updateJewelsTags(bool remove, bool update) void CCharacter::updateJewelsTags(bool justRemove, bool update)
{ {
if (!getEnterFlag() || !getOnLineStatus()) if (!getEnterFlag() || !getOnLineStatus())
return; return;
@ -21424,24 +21560,25 @@ void CCharacter::updateJewelsTags(bool remove, bool update)
setTagPvPA(""); setTagPvPA("");
setTagPvPB(""); setTagPvPB("");
if (remove) if (justRemove)
return; return;
CSBrickParamJewelAttrs *sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::HEADDRESS); CSheetId usedSheet;
if (sbrickParam) CSBrickParamJewelAttrs sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::HEADDRESS, usedSheet);
setTagA(sbrickParam->Value); if (sbrickParam.ParsedOk)
setTagA(sbrickParam.Value);
sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::NECKLACE); sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::NECKLACE, usedSheet);
if (sbrickParam) if (sbrickParam.ParsedOk)
setTagB(sbrickParam->Value); setTagB(sbrickParam.Value);
sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::EARL); sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::EARL, usedSheet);
if (sbrickParam) if (sbrickParam.ParsedOk)
setTagPvPA(sbrickParam->Value); setTagPvPA(sbrickParam.Value);
sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::EARR); sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::EARR, usedSheet);
if (sbrickParam) if (sbrickParam.ParsedOk)
setTagPvPB(sbrickParam->Value); setTagPvPB(sbrickParam.Value);
if (!update) if (!update)
@ -21453,6 +21590,59 @@ void CCharacter::updateJewelsTags(bool remove, bool update)
} }
} }
//----------------------------------------------------------------------------
void CCharacter::updateJewelsModifiers(bool justRemove)
{
if (!getEnterFlag())
return;
// Remove previous effects
if (_JewelEnchants[SLOT_EQUIPMENT::WRISTL].ParsedOk && _JewelEnchants[SLOT_EQUIPMENT::WRISTL].Attribute == "mod") {
CHARACTERISTICS::TCharacteristics ModifiedCharac = CHARACTERISTICS::toCharacteristic(_JewelEnchants[SLOT_EQUIPMENT::WRISTL].Value);
getCharacteristics()._PhysicalCharacteristics[ModifiedCharac].Modifier -= _JewelEnchants[SLOT_EQUIPMENT::WRISTL].Modifier;
}
if (_JewelEnchants[SLOT_EQUIPMENT::WRISTR].ParsedOk && _JewelEnchants[SLOT_EQUIPMENT::WRISTR].Attribute == "mod") {
CHARACTERISTICS::TCharacteristics ModifiedCharac = CHARACTERISTICS::toCharacteristic(_JewelEnchants[SLOT_EQUIPMENT::WRISTR].Value);
getCharacteristics()._PhysicalCharacteristics[ModifiedCharac].Modifier -= _JewelEnchants[SLOT_EQUIPMENT::WRISTR].Modifier;
}
if (justRemove)
{
_JewelEnchants[SLOT_EQUIPMENT::WRISTL].ParsedOk = false;
_JewelEnchants[SLOT_EQUIPMENT::WRISTR].ParsedOk = false;
computeMaxValue();
return;
}
CHARACTERISTICS::TCharacteristics ModifiedCharacL = CHARACTERISTICS::Unknown;
CSheetId usedSheet;
CSBrickParamJewelAttrs sbrickParamL = getJewelAttrs("mod", SLOT_EQUIPMENT::WRISTL, usedSheet);
if (sbrickParamL.ParsedOk)
{
ModifiedCharacL = CHARACTERISTICS::toCharacteristic(sbrickParamL.Value);
getCharacteristics()._PhysicalCharacteristics[ModifiedCharacL].Modifier += sbrickParamL.Modifier;
}
_JewelEnchants[SLOT_EQUIPMENT::WRISTL] = sbrickParamL;
CSBrickParamJewelAttrs sbrickParamR = getJewelAttrs("mod", SLOT_EQUIPMENT::WRISTR, usedSheet);
if (sbrickParamR.ParsedOk)
{
CHARACTERISTICS::TCharacteristics ModifiedCharac = CHARACTERISTICS::toCharacteristic(sbrickParamR.Value);
if (ModifiedCharacL != ModifiedCharac)
{
getCharacteristics()._PhysicalCharacteristics[ModifiedCharac].Modifier += sbrickParamR.Modifier;
}
else
sbrickParamR = NULL;
}
_JewelEnchants[SLOT_EQUIPMENT::WRISTR] = sbrickParamR;
computeMaxValue();
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CCharacter::updateMagicProtectionAndResistance() void CCharacter::updateMagicProtectionAndResistance()
{ {

@ -2439,7 +2439,10 @@ public:
void updateParry(ITEMFAMILY::EItemFamily family, SKILLS::ESkills skill); void updateParry(ITEMFAMILY::EItemFamily family, SKILLS::ESkills skill);
// Jewel enchants used for Tags // Jewel enchants used for Tags
void updateJewelsTags(bool remove, bool update=true); void updateJewelsTags(bool justRemove, bool update=true);
// Jewel enchants used for Modifiers
void updateJewelsModifiers(bool justRemove = false);
// Jewel equipment or skill or region are changed, recompute protection and resistances // Jewel equipment or skill or region are changed, recompute protection and resistances
void updateMagicProtectionAndResistance(); void updateMagicProtectionAndResistance();
@ -2619,7 +2622,7 @@ public:
std::string getDontTranslate() const; std::string getDontTranslate() const;
void setDontTranslate(const std::string &langs); void setDontTranslate(const std::string &langs);
CSBrickParamJewelAttrs *getJewelAttrs(const std::string &attribute, SLOT_EQUIPMENT::TSlotEquipment slot); CSBrickParamJewelAttrs getJewelAttrs(const std::string &attribute, SLOT_EQUIPMENT::TSlotEquipment slot, NLMISC::CSheetId &usedSheet);
uint32 getOrganization() const; uint32 getOrganization() const;
uint32 getOrganizationStatus() const; uint32 getOrganizationStatus() const;
@ -3758,6 +3761,8 @@ private:
uint32 _MagicProtection[PROTECTION_TYPE::NB_PROTECTION_TYPE]; uint32 _MagicProtection[PROTECTION_TYPE::NB_PROTECTION_TYPE];
uint32 _MaxAbsorption; uint32 _MaxAbsorption;
CSBrickParamJewelAttrs _JewelEnchants[SLOT_EQUIPMENT::NB_SLOT_EQUIPMENT];
// current resistance for each type of magic resistance // current resistance for each type of magic resistance
uint32 _MagicResistance[RESISTANCE_TYPE::NB_RESISTANCE_TYPE]; uint32 _MagicResistance[RESISTANCE_TYPE::NB_RESISTANCE_TYPE];

@ -808,6 +808,14 @@ inline NLMISC::CVector CCharacter::getBuildingExitPos() const
return _BuildingExitPos; return _BuildingExitPos;
} }
//------------------------------------------------------------------------------
inline NLMISC::CVector CCharacter::getOutOutpostPos() const
{
return _OutOutpostPos;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -1042,7 +1050,7 @@ inline bool CCharacter::checkRequiredFaction(std::string faction) const
inline bool CCharacter::checkRequiredFame(std::string faction, sint32 fame) const inline bool CCharacter::checkRequiredFame(std::string faction, sint32 fame) const
{ {
if (faction == "") if (faction == "" || faction == "*")
return true; return true;
uint32 fameIdx = PVP_CLAN::getFactionIndex(PVP_CLAN::fromString(faction)); uint32 fameIdx = PVP_CLAN::getFactionIndex(PVP_CLAN::fromString(faction));

@ -755,6 +755,7 @@ void CCharacter::destroyItem(INVENTORIES::TInventory invId, uint32 slot, uint32
} }
else if (quantity == item->getStackSize()) else if (quantity == item->getStackSize())
{ {
nlinfo("Player %s has destroy %d items %s(%s) Q%d at slot %d", getName().toString().c_str(), quantity, sheetId.toString().c_str(), item->getItemId().toString().c_str(), quality, slot);
// just delete the item // just delete the item
inv->deleteItem(slot); inv->deleteItem(slot);
remainingQuantity = 0; remainingQuantity = 0;
@ -1482,6 +1483,10 @@ bool CCharacter::checkPreRequired(const CGameItemPtr &item, bool equipCheck)
} }
} }
// check if it's a powo item
if (!item->getRequiredPowo().empty() && getPowoCell() == 0)
requiredRespected = false;
pair<PVP_CLAN::TPVPClan, PVP_CLAN::TPVPClan> allegeance = getAllegiance(); pair<PVP_CLAN::TPVPClan, PVP_CLAN::TPVPClan> allegeance = getAllegiance();
bool neutralcult = (allegeance.first == PVP_CLAN::Neutral || allegeance.first == PVP_CLAN::None); bool neutralcult = (allegeance.first == PVP_CLAN::Neutral || allegeance.first == PVP_CLAN::None);
bool neutralciv = (allegeance.second == PVP_CLAN::Neutral || allegeance.second == PVP_CLAN::None); bool neutralciv = (allegeance.second == PVP_CLAN::Neutral || allegeance.second == PVP_CLAN::None);

Loading…
Cancel
Save