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:
// $*STRUCT CSBrickParamJewelAttrs TBrickParam::JEWEL_ATTRS
// $*-s std::string Attribute // attribute name
// $*-s std::string Value // attribute value
// $*-i uint32 Charge // initial charge of sapload
// $*-s std::string Attribute // attribute name
// $*-s std::string Value // attribute value
// $*-i uint32 Charge // initial charge of sapload
// $*-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)
// $*-i uint32 RequiredFaction // Required faction
// $*-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));
break;
}

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

@ -437,6 +437,9 @@ public :
void consumeSapLoad( uint32 sapConsumed );
// apply an enchantment to item
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
const std::vector< NLMISC::CSheetId >& getEnchantment() const { return _Enchantment; }
// set sapLoad for recharge sap item

@ -42,7 +42,7 @@ uint32 CEquipInventory::getMaxSlot() const
float CEquipInventory::getWearMalus()
{
float fWearEquipmentMalus = 0.0f;
for (uint i = 0; i < getSlotCount(); ++i)
{
CGameItemPtr pItem = getItem(i);
@ -55,7 +55,7 @@ float CEquipInventory::getWearMalus()
deleteItem(i);
}
}
return fWearEquipmentMalus;
}
@ -74,7 +74,7 @@ void CEquipInvView::onItemChanged(uint32 slot, INVENTORIES::TItemChangeFlags cha
{
const CGameItemPtr item = getInventory()->getItem(slot);
nlassert(item != NULL);
updateClientSlot(slot, item);
const CStaticItem * form = CSheets::getForm( item->getSheetId() );
@ -82,9 +82,9 @@ void CEquipInvView::onItemChanged(uint32 slot, INVENTORIES::TItemChangeFlags cha
{
getCharacter()->addWearMalus(form->WearEquipmentMalus);
}
getCharacter()->applyItemModifiers(item);
// if equipped item is a jewel, re-compute max protection and resistance
if( form )
{
@ -100,10 +100,10 @@ void CEquipInvView::onItemChanged(uint32 slot, INVENTORIES::TItemChangeFlags cha
{
const CGameItemPtr item = getInventory()->getItem(slot);
nlassert(item != NULL);
updateClientSlot(slot, item);
}
if (changeFlags.checkEnumValue(INVENTORIES::itc_removed))
{
const CGameItemPtr item = getInventory()->getItem(slot);
@ -117,13 +117,14 @@ void CEquipInvView::onItemChanged(uint32 slot, INVENTORIES::TItemChangeFlags cha
if( form->Family == ITEMFAMILY::JEWELRY )
{
getCharacter()->updateMagicProtectionAndResistance();
}
}
}
}
}
// Update tags
// Update jewels enchants
getCharacter()->updateJewelsTags(false);
getCharacter()->updateJewelsModifiers();
}
// ****************************************************************************

@ -102,6 +102,15 @@ bool CExchangeView::putItemInExchange(uint32 bagSlot, uint32 exchangeSlot, uint3
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) )
return false;

@ -1001,6 +1001,15 @@ void CGuild::putItem( CCharacter * user, uint32 slot, uint32 quantity, uint16 se
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
if ( CInventoryBase::moveItem(
user->getInventory(INVENTORIES::bag), slot,

@ -1026,12 +1026,34 @@ NLMISC_COMMAND(deleteInventoryItems, "Delete items from a characters inventory",
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>]")
{
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;
}
@ -1039,20 +1061,31 @@ NLMISC_COMMAND(enchantEquipedItem, "enchantEquipedItem", "<uid> <slotname> <shee
string selected_slot = args[1];
bool isTag = false;
std::vector<CSheetId> sheets;
if (args[2] != "*")
{
std::vector<string> sheet_names;
NLMISC::splitString(args[2], ",", sheet_names);
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));
if (itemPtr != NULL)
{
if (isTag)
itemPtr->getJewelNonTagsEnchantments(sheets);
else
itemPtr->getJewelTagsEnchantments(sheets);
itemPtr->applyEnchantment(sheets);
c->updateJewelsTags(false);
if (args.size() > 3)
{

@ -551,6 +551,11 @@ CCharacter::CCharacter()
for (uint i = 0; i < SCORES::NUM_SCORES; ++i)
_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
_ItemsInShopStore = new CItemsForSale;
_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)
{
CSheetId usedSheet;
CSBrickParamJewelAttrs sbrickParam = getJewelAttrs("rez", SLOT_EQUIPMENT::NECKLACE, usedSheet);
SM_STATIC_PARAMS_1(params, STRING_MANAGER::sbrick);
params[0].SheetId = usedSheet;
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)
_DeathPenalties->addDeath(*this, _NextDeathPenaltyFactor);
resetNextDeathPenaltyFactor();
}
_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;
if (sbrickParam.ParsedOk && sbrickParam.Value == "halfLife" && (rand() % 100) < sbrickParam.Modifier)
{
sendDynamicSystemMessage(_Id, "ALLEGORY_EFFECT_TRIGGERED", params);
_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;
_Behaviour = MBEHAV::IDLE;
_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);
if (inv)
{
@ -11818,22 +11877,51 @@ CSBrickParamJewelAttrs *CCharacter::getJewelAttrs(const string &attribute, SLOT_
for (uint i = 0; i < enchant.size(); 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)
{
const TBrickParam::IId* param = brick->Params[0];
CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs*)param;
if (param->id() == TBrickParam::JEWEL_ATTRS && sbrickParam->Attribute == attribute)
{
bool valid = true;
// 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
if (sbrickParam->RequiredFame < 30 || checkRequiredFaction(sbrickParam->RequiredFaction))
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);
}
}
}
@ -11850,24 +11938,60 @@ CSBrickParamJewelAttrs *CCharacter::getJewelAttrs(const string &attribute, SLOT_
vector< CSheetId > enchant = item->getEnchantment();
for (uint i = 0; i < enchant.size(); 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)
{
const TBrickParam::IId* param = brick->Params[0];
CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs*)param;
if (param->id() == TBrickParam::JEWEL_ATTRS && sbrickParam->Attribute == attribute)
{
bool valid = true;
// 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
if (sbrickParam->RequiredFame < 30 || checkRequiredFaction(sbrickParam->RequiredFaction))
valid = false;
}
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;
updateMagicProtectionAndResistance();
updateJewelsModifiers();
}
//-----------------------------------------------
@ -18484,11 +18612,15 @@ void CCharacter::onDisconnection(bool bCrashed)
// Remove handledAIGroups for all missions of the player
despawnAllHandledAIGroup();
updateJewelsModifiers(true);
// update for the unified entity locator
if (IShardUnifierEvent::getInstance() != NULL && _Enter)
{
IShardUnifierEvent::getInstance()->charDisconnected(_Id);
}
}
//----------------------------------------------------------------------------
@ -21039,6 +21171,7 @@ void CPetAnimal::clear()
IsTpAllowed = false;
spawnFlag = false;
IsInBag = false;
LockedByOwner = false;
Cell = 0;
}
@ -21181,6 +21314,9 @@ uint32 CPetAnimal::getAnimalMaxBulk()
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;
}
}
@ -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())
return;
@ -21424,24 +21560,25 @@ void CCharacter::updateJewelsTags(bool remove, bool update)
setTagPvPA("");
setTagPvPB("");
if (remove)
if (justRemove)
return;
CSBrickParamJewelAttrs *sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::HEADDRESS);
if (sbrickParam)
setTagA(sbrickParam->Value);
CSheetId usedSheet;
CSBrickParamJewelAttrs sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::HEADDRESS, usedSheet);
if (sbrickParam.ParsedOk)
setTagA(sbrickParam.Value);
sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::NECKLACE);
if (sbrickParam)
setTagB(sbrickParam->Value);
sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::NECKLACE, usedSheet);
if (sbrickParam.ParsedOk)
setTagB(sbrickParam.Value);
sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::EARL);
if (sbrickParam)
setTagPvPA(sbrickParam->Value);
sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::EARL, usedSheet);
if (sbrickParam.ParsedOk)
setTagPvPA(sbrickParam.Value);
sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::EARR);
if (sbrickParam)
setTagPvPB(sbrickParam->Value);
sbrickParam = getJewelAttrs("tag", SLOT_EQUIPMENT::EARR, usedSheet);
if (sbrickParam.ParsedOk)
setTagPvPB(sbrickParam.Value);
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()
{

@ -2439,7 +2439,10 @@ public:
void updateParry(ITEMFAMILY::EItemFamily family, SKILLS::ESkills skill);
// 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
void updateMagicProtectionAndResistance();
@ -2619,7 +2622,7 @@ public:
std::string getDontTranslate() const;
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 getOrganizationStatus() const;
@ -3758,6 +3761,8 @@ private:
uint32 _MagicProtection[PROTECTION_TYPE::NB_PROTECTION_TYPE];
uint32 _MaxAbsorption;
CSBrickParamJewelAttrs _JewelEnchants[SLOT_EQUIPMENT::NB_SLOT_EQUIPMENT];
// current resistance for each type of magic resistance
uint32 _MagicResistance[RESISTANCE_TYPE::NB_RESISTANCE_TYPE];

@ -808,6 +808,14 @@ inline NLMISC::CVector CCharacter::getBuildingExitPos() const
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
{
if (faction == "")
if (faction == "" || faction == "*")
return true;
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())
{
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
inv->deleteItem(slot);
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();
bool neutralcult = (allegeance.first == PVP_CLAN::Neutral || allegeance.first == PVP_CLAN::None);
bool neutralciv = (allegeance.second == PVP_CLAN::Neutral || allegeance.second == PVP_CLAN::None);

Loading…
Cancel
Save