1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 06:47:45 +00:00

HP/MP/TP Regeneration following new rules;

Bumped level cap up to 70;
Additional checks for autoattacking;
Using auto-attack damage from weapon;
This commit is contained in:
Maru 2017-08-11 00:58:35 -03:00
parent 3634ccdb4e
commit d7c97491c3
7 changed files with 56 additions and 24 deletions

View file

@ -425,6 +425,7 @@ boost::shared_ptr< Core::Data::ItemInfo >
info->is_hqable = getField< bool >( row, 20 ); info->is_hqable = getField< bool >( row, 20 );
info->model_primary = getField< uint64_t >( row, 45 ); info->model_primary = getField< uint64_t >( row, 45 );
info->model_secondary = getField< uint64_t >( row, 46 ); info->model_secondary = getField< uint64_t >( row, 46 );
info->physical_damage = getField< uint16_t >( row, 49 );
info->delayMs = getField< uint16_t >( row, 51 ); info->delayMs = getField< uint16_t >( row, 51 );
info->is_unique = getField< int16_t >( row, 64 ) != 0 ? true : false; info->is_unique = getField< int16_t >( row, 64 ) != 0 ? true : false;
info->is_untradeable = getField< uint8_t >( row, 65 ) != 0 ? true : false; info->is_untradeable = getField< uint8_t >( row, 65 ) != 0 ? true : false;

View file

@ -201,20 +201,21 @@ namespace Core {
struct ItemInfo struct ItemInfo
{ {
uint32_t id; uint32_t id;
std::string name; //0 std::string name; //0
uint16_t item_level;//11 uint16_t item_level; //11
uint8_t required_level;//12 uint8_t required_level; //12
uint32_t stack_size;//19 uint16_t unknown_category; //15
uint16_t unknown_category;//15 uint16_t ui_category; //17
uint16_t ui_category;//17 uint32_t stack_size; //19
bool is_hqable;//20 bool is_hqable; //20
uint64_t model_primary;//28 uint64_t model_primary; //28
uint64_t model_secondary;//29 uint64_t model_secondary; //29
uint32_t class_job_requirement;//58 uint16_t physical_damage; //49
uint16_t delayMs; //59 uint32_t class_job_requirement; //58
bool is_unique;//72 uint16_t delayMs; //59
bool is_untradeable;//73 bool is_unique; //72
uint32_t class_job_index;//86 bool is_untradeable; //73
uint32_t class_job_index; //86
}; };
struct ActionInfo struct ActionInfo

View file

@ -26,6 +26,8 @@ Core::Item::Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t mo
{ {
auto itemInfo = g_exdData.getItemInfo( catalogId ); auto itemInfo = g_exdData.getItemInfo( catalogId );
m_delayMs = itemInfo->delayMs; m_delayMs = itemInfo->delayMs;
m_physicalDmg = itemInfo->physical_damage;
m_autoAttackDmg = float(m_physicalDmg * m_delayMs) / 3000;
} }
Core::Item::~Item() Core::Item::~Item()
@ -33,11 +35,21 @@ Core::Item::~Item()
} }
float Core::Item::getAutoAttackDmg() const
{
return m_autoAttackDmg;
}
uint16_t Core::Item::getDelay() const uint16_t Core::Item::getDelay() const
{ {
return m_delayMs; return m_delayMs;
} }
uint16_t Core::Item::getPhysicalDmg() const
{
return m_physicalDmg;
}
uint32_t Core::Item::getId() const uint32_t Core::Item::getId() const
{ {
return m_id; return m_id;

View file

@ -39,8 +39,13 @@ public:
bool isHq() const; bool isHq() const;
void setHq( bool isHq ); void setHq( bool isHq );
uint16_t getDelay() const; uint16_t getDelay() const;
uint16_t getPhysicalDmg() const;
float getAutoAttackDmg() const;
protected: protected:
uint32_t m_id; uint32_t m_id;
@ -58,6 +63,8 @@ protected:
bool m_isHq; bool m_isHq;
uint16_t m_delayMs; uint16_t m_delayMs;
uint16_t m_physicalDmg;
float m_autoAttackDmg;
}; };

View file

@ -798,10 +798,13 @@ void Core::Network::GameConnection::actionHandler( Core::Network::Packets::GameP
{ {
case 0x01: case 0x01:
{ {
if( param11 == 1 ) if (param11 == 1)
pPlayer->setStance( Entity::Actor::Stance::Active ); pPlayer->setStance(Entity::Actor::Stance::Active);
else else
pPlayer->setStance( Entity::Actor::Stance::Passive ); {
pPlayer->setStance(Entity::Actor::Stance::Passive);
pPlayer->setAutoattack(false);
}
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), 0, param11, 1 ) ); pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), 0, param11, 1 ) );
@ -810,7 +813,10 @@ void Core::Network::GameConnection::actionHandler( Core::Network::Packets::GameP
case 0x02: case 0x02:
{ {
if (param11 == 1) if (param11 == 1)
{
pPlayer->setAutoattack( true ); pPlayer->setAutoattack( true );
pPlayer->setStance(Entity::Actor::Stance::Active);
}
else else
pPlayer->setAutoattack( false ); pPlayer->setAutoattack( false );

View file

@ -615,7 +615,7 @@ void Core::Entity::Player::gainExp( uint32_t amount )
queuePacket( ActorControlPacket143( getId(), GainExpMsg, static_cast< uint8_t >( getClass() ), amount ) ); queuePacket( ActorControlPacket143( getId(), GainExpMsg, static_cast< uint8_t >( getClass() ), amount ) );
if( level >= 60 ) // temporary fix for leveling over levelcap if( level >= 70 ) // temporary fix for leveling over levelcap
{ {
queuePacket( ActorControlPacket143( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), amount ) ); queuePacket( ActorControlPacket143( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), amount ) );
return; return;
@ -1085,7 +1085,9 @@ void Core::Entity::Player::update( int64_t currTime )
if( isAutoattackOn() && if( isAutoattackOn() &&
actor->getId() == m_targetId && actor->getId() == m_targetId &&
actor->isAlive() && actor->isAlive() &&
mainWeap ) mainWeap &&
m_currentStance == Entity::Actor::Stance::Active
)
{ {
// default autoattack range // default autoattack range
// TODO make this dependant on bnpc size // TODO make this dependant on bnpc size
@ -1430,11 +1432,13 @@ void Core::Entity::Player::setIsLogin( bool bIsLogin )
void Core::Entity::Player::autoAttack( ActorPtr pTarget ) void Core::Entity::Player::autoAttack( ActorPtr pTarget )
{ {
auto mainWeap = m_pInventory->getItemAt(Inventory::GearSet0, Inventory::EquipSlot::MainHand);
pTarget->onActionHostile( shared_from_this() ); pTarget->onActionHostile( shared_from_this() );
//uint64_t tick = Util::getTimeMs(); //uint64_t tick = Util::getTimeMs();
//srand(static_cast< uint32_t >(tick)); //srand(static_cast< uint32_t >(tick));
uint32_t damage = 10 + rand() % 12;
uint32_t damage = mainWeap->getAutoAttackDmg() + rand() % 12;
uint32_t variation = 0 + rand() % 3; uint32_t variation = 0 + rand() % 3;
if( getClass() == 5 || getClass() == 23 || getClass() == 31 ) if( getClass() == 5 || getClass() == 23 || getClass() == 31 )

View file

@ -263,12 +263,14 @@ void Core::Entity::Player::onTick()
return; return;
int32_t addHp = getMaxHp() * 0.1f + 1; int32_t addHp = getMaxHp() * 0.1f + 1;
int32_t addMp = 8 * 0.1f + 1; int32_t addMp = getMaxMp() * 0.06f + 1;
int32_t addTp = 100;
if( !m_actorIdTohateSlotMap.empty() ) if( !m_actorIdTohateSlotMap.empty() )
{ {
addHp = getMaxHp() * 0.01f + 1; addHp = getMaxHp() * 0.01f + 1;
addMp = getMaxHp() * 0.01f + 1; addMp = getMaxHp() * 0.02f + 1;
addTp = 60;
} }
if( m_hp < getMaxHp() ) if( m_hp < getMaxHp() )
@ -295,7 +297,6 @@ void Core::Entity::Player::onTick()
if( m_tp < 1000 ) if( m_tp < 1000 )
{ {
int32_t addTp = 100;
if( m_tp + addTp < 1000 ) if( m_tp + addTp < 1000 )
m_tp += addTp; m_tp += addTp;
else else