mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 22:57:45 +00:00
OnWithin and OnOutside range have been adjusted to include Quest object, minor fix to onEmote function quest updates
This commit is contained in:
parent
27b218fd78
commit
3eb5fbf6fa
4 changed files with 60 additions and 13 deletions
|
@ -524,7 +524,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
|
|||
|
||||
auto pe4 = std::make_shared< FFXIVRawPacket >( 0x08, 0x18, 0, 0 );
|
||||
*reinterpret_cast< unsigned int* >( &pe4->data()[ 0 ] ) = id;
|
||||
*reinterpret_cast< unsigned int* >( &pe4->data()[ 4 ] ) = timeStamp;
|
||||
*reinterpret_cast< unsigned int* >( &pe4->data()[ 4 ] ) = Util::getTimeSeconds();
|
||||
sendSinglePacket( pe4 );
|
||||
|
||||
break;
|
||||
|
|
|
@ -158,11 +158,11 @@ namespace Sapphire::ScriptAPI
|
|||
{
|
||||
}
|
||||
|
||||
void QuestScript::onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z )
|
||||
void QuestScript::onWithinRange( World::Quest& quest, Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z )
|
||||
{
|
||||
}
|
||||
|
||||
void QuestScript::onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z )
|
||||
void QuestScript::onOutsideRange( World::Quest& quest, Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -223,9 +223,9 @@ namespace Sapphire::ScriptAPI
|
|||
|
||||
virtual void onEnterTerritory( World::Quest& quest, Sapphire::Entity::Player& player, uint16_t param1, uint16_t param2 );
|
||||
|
||||
virtual void onWithinRange( Sapphire::Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
||||
virtual void onWithinRange( World::Quest& quest, Sapphire::Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
||||
|
||||
virtual void onOutsideRange( Sapphire::Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
||||
virtual void onOutsideRange( World::Quest& quest, Sapphire::Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z );
|
||||
|
||||
virtual void onEventHandlerTradeReturn( Sapphire::Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param,
|
||||
uint32_t catalogId );
|
||||
|
|
|
@ -264,19 +264,63 @@ bool Sapphire::Scripting::ScriptMgr::onEnterTerritory( Entity::Player& player, u
|
|||
|
||||
bool Sapphire::Scripting::ScriptMgr::onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z )
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
||||
if( !script )
|
||||
return false;
|
||||
script->onWithinRange( player, eventId, param1, x, y, z );
|
||||
const auto eventType = static_cast< uint16_t >( eventId >> 16 );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
|
||||
if( eventType == Event::EventHandler::EventHandlerType::Quest )
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::QuestScript >( eventId );
|
||||
if( !script )
|
||||
return false;
|
||||
if( player.hasQuest( eventId ) )
|
||||
{
|
||||
auto idx = player.getQuestIndex( eventId );
|
||||
auto& quest = player.getQuestByIndex( idx );
|
||||
World::Quest preQ = quest;
|
||||
script->onWithinRange( quest, player, eventId, param1, x, y, z );
|
||||
if( quest != preQ )
|
||||
player.updateQuest( quest );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
||||
if( !script )
|
||||
return false;
|
||||
script->onWithinRange( player, eventId, param1, x, y, z );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Sapphire::Scripting::ScriptMgr::onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z )
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
||||
if( !script )
|
||||
return false;
|
||||
script->onOutsideRange( player, eventId, param1, x, y, z );
|
||||
const auto eventType = static_cast< uint16_t >( eventId >> 16 );
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
|
||||
if( eventType == Event::EventHandler::EventHandlerType::Quest )
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::QuestScript >( eventId );
|
||||
if( !script )
|
||||
return false;
|
||||
if( player.hasQuest( eventId ) )
|
||||
{
|
||||
auto idx = player.getQuestIndex( eventId );
|
||||
auto& quest = player.getQuestByIndex( idx );
|
||||
World::Quest preQ = quest;
|
||||
script->onOutsideRange( quest, player, eventId, param1, x, y, z );
|
||||
if( quest != preQ )
|
||||
player.updateQuest( quest );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
||||
if( !script )
|
||||
return false;
|
||||
script->onOutsideRange( player, eventId, param1, x, y, z );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -295,7 +339,10 @@ bool Sapphire::Scripting::ScriptMgr::onEmote( Entity::Player& player, uint64_t a
|
|||
{
|
||||
auto idx = player.getQuestIndex( eventId );
|
||||
auto& quest = player.getQuestByIndex( idx );
|
||||
World::Quest preQ = quest;
|
||||
script->onEmote( quest, actor, emoteId, player );
|
||||
if( quest != preQ )
|
||||
player.updateQuest( quest );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue