1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 14:57:44 +00:00

Preload defense / block values into items

This commit is contained in:
Mordred 2019-03-20 22:16:02 +01:00
parent b639db836e
commit 497761a282
6 changed files with 112 additions and 16 deletions

View file

@ -15,6 +15,11 @@ bool operator==( const uint8_t& g, const ActionCategory& t )
return static_cast< uint8_t >( t ) == g; return static_cast< uint8_t >( t ) == g;
} }
bool operator==( const uint8_t& g, const BaseParam& t )
{
return static_cast< uint8_t >( t ) == g;
}
bool operator==( const BeastReputationRank& t, const uint8_t& g ) bool operator==( const BeastReputationRank& t, const uint8_t& g )
{ {
return static_cast< uint8_t >( t ) == g; return static_cast< uint8_t >( t ) == g;

View file

@ -31,6 +31,86 @@ enum class ActionCategory : uint8_t
AdrenalineRush = 15, AdrenalineRush = 15,
}; };
///////////////////////////////////////////////////////////
//BaseParam.exd
enum class BaseParam : uint8_t
{
None = 0,
Strength = 1,
Dexterity = 2,
Vitality = 3,
Intelligence = 4,
Mind = 5,
Piety = 6,
HP = 7,
MP = 8,
TP = 9,
GP = 10,
CP = 11,
PhysicalDamage = 12,
MagicDamage = 13,
Delay = 14,
AdditionalEffect = 15,
AttackSpeed = 16,
BlockRate = 17,
BlockStrength = 18,
Tenacity = 19,
AttackPower = 20,
Defense = 21,
DirectHitRate = 22,
Evasion = 23,
MagicDefense = 24,
CriticalHitPower = 25,
CriticalHitResilience = 26,
CriticalHit = 27,
CriticalHitEvasion = 28,
SlashingResistance = 29,
PiercingResistance = 30,
BluntResistance = 31,
ProjectileResistance = 32,
AttackMagicPotency = 33,
HealingMagicPotency = 34,
EnhancementMagicPotency = 35,
ElementalBonus = 36,
FireResistance = 37,
IceResistance = 38,
WindResistance = 39,
EarthResistance = 40,
LightningResistance = 41,
WaterResistance = 42,
MagicResistance = 43,
Determination = 44,
SkillSpeed = 45,
SpellSpeed = 46,
Haste = 47,
Morale = 48,
Enmity = 49,
EnmityReduction = 50,
CarefulDesynthesis = 51,
EXPBonus = 52,
Regen = 53,
Refresh = 54,
MainAttribute = 55,
SecondaryAttribute = 56,
SlowResistance = 57,
PetrificationResistance = 58,
ParalysisResistance = 59,
SilenceResistance = 60,
BlindResistance = 61,
PoisonResistance = 62,
StunResistance = 63,
SleepResistance = 64,
BindResistance = 65,
HeavyResistance = 66,
DoomResistance = 67,
ReducedDurabilityLoss = 68,
IncreasedSpiritbondGain = 69,
Craftsmanship = 70,
Control = 71,
Gathering = 72,
Perception = 73,
};
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
//BeastReputationRank.exd //BeastReputationRank.exd
enum class BeastReputationRank : uint8_t enum class BeastReputationRank : uint8_t

View file

@ -110,6 +110,7 @@ int main()
result += "namespace Sapphire {\n"; result += "namespace Sapphire {\n";
result += "namespace Common {\n"; result += "namespace Common {\n";
result += generateEnum( "ActionCategory", 0, "uint8_t" ); result += generateEnum( "ActionCategory", 0, "uint8_t" );
result += generateEnum( "BaseParam", 1, "uint8_t" );
result += generateEnum( "BeastReputationRank", 1, "uint8_t" ); result += generateEnum( "BeastReputationRank", 1, "uint8_t" );
result += generateEnum( "BeastTribe", 11, "uint8_t" ); result += generateEnum( "BeastTribe", 11, "uint8_t" );
result += generateEnum( "ClassJob", 0, "uint8_t" ); result += generateEnum( "ClassJob", 0, "uint8_t" );

View file

@ -147,22 +147,6 @@ void Sapphire::Entity::Player::equipSoulCrystal( ItemPtr pItem, bool updateJob )
setClassJob( newClassJob ); setClassJob( newClassJob );
} }
// equip an item
void Sapphire::Entity::Player::equipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem, bool sendUpdate )
{
//g_framework.getLogger().debug( "Equipping into slot " + std::to_string( equipSlotId ) );
if( sendUpdate )
{
updateModels( equipSlotId, pItem, true );
this->sendModel();
m_itemLevel = calculateEquippedGearItemLevel();
sendItemLevel();
}
else
updateModels( equipSlotId, pItem, false );
}
void Sapphire::Entity::Player::updateModels( GearSetSlot equipSlotId, const Sapphire::ItemPtr& pItem, bool updateClass ) void Sapphire::Entity::Player::updateModels( GearSetSlot equipSlotId, const Sapphire::ItemPtr& pItem, bool updateClass )
{ {
uint64_t model = pItem->getModelId1(); uint64_t model = pItem->getModelId1();
@ -230,6 +214,23 @@ Sapphire::Common::GearModelSlot Sapphire::Entity::Player::equipSlotToModelSlot(
} }
} }
// equip an item
void Sapphire::Entity::Player::equipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem, bool sendUpdate )
{
//g_framework.getLogger().debug( "Equipping into slot " + std::to_string( equipSlotId ) );
if( sendUpdate )
{
updateModels( equipSlotId, pItem, true );
sendModel();
m_itemLevel = calculateEquippedGearItemLevel();
sendItemLevel();
}
else
updateModels( equipSlotId, pItem, false );
}
void Sapphire::Entity::Player::unequipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem ) void Sapphire::Entity::Player::unequipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem )
{ {
auto modelSlot = equipSlotToModelSlot( equipSlotId ); auto modelSlot = equipSlotToModelSlot( equipSlotId );

View file

@ -29,6 +29,10 @@ Sapphire::Item::Item( uint64_t uId, uint32_t catalogId, FrameworkPtr pFw, bool i
m_itemLevel = itemInfo->levelItem; m_itemLevel = itemInfo->levelItem;
m_maxStackSize = itemInfo->stackSize; m_maxStackSize = itemInfo->stackSize;
m_additionalData = itemInfo->additionalData; m_additionalData = itemInfo->additionalData;
m_blockRate = itemInfo->blockRate;
m_block = itemInfo->block;
m_defense = itemInfo->defensePhys;
m_defenseMag = itemInfo->defenseMag;
} }
float Sapphire::Item::getAutoAttackDmg() const float Sapphire::Item::getAutoAttackDmg() const

View file

@ -99,6 +99,11 @@ namespace Sapphire
uint16_t m_spiritBond; uint16_t m_spiritBond;
uint32_t m_reservedFlag; uint32_t m_reservedFlag;
uint32_t m_blockRate;
uint32_t m_block;
uint32_t m_defense;
uint32_t m_defenseMag;
FrameworkPtr m_pFw; FrameworkPtr m_pFw;
uint32_t m_additionalData; uint32_t m_additionalData;
}; };