mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 22:37:45 +00:00
Reimplemented EventItem. Fixed bug with onDeath not triggering when bnpc kills player. Fixed EventItem struct. Implemented ClsThm050 quest. Fixed some wrong param names
This commit is contained in:
parent
6a9f5b683f
commit
ea2705165a
8 changed files with 407 additions and 63 deletions
2
deps/datReader/Exd/Structs.h
vendored
2
deps/datReader/Exd/Structs.h
vendored
|
@ -494,9 +494,11 @@ namespace Excel
|
|||
uint16_t Icon;
|
||||
uint16_t Action;
|
||||
uint8_t StackMax;
|
||||
int8_t padding0[1];
|
||||
uint8_t CastTime;
|
||||
uint8_t CastTimeLine;
|
||||
uint8_t Timeline;
|
||||
int8_t padding1[3];
|
||||
};
|
||||
|
||||
struct EventItemCastTimeLine
|
||||
|
|
343
src/scripts/quest/classquest/THM/ClsThm050.cpp
Normal file
343
src/scripts/quest/classquest/THM/ClsThm050.cpp
Normal file
|
@ -0,0 +1,343 @@
|
|||
// This is an automatically generated C++ script template
|
||||
// Content needs to be added by hand to make it function
|
||||
// In order for this script to be loaded, move it to the correct folder in <root>/scripts/
|
||||
|
||||
#include "Actor/BNpc.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <Actor/Player.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <Service.h>
|
||||
|
||||
#include "Territory/Territory.h"
|
||||
|
||||
// Quest Script: ClsThm050_00347
|
||||
// Quest Name: The Threat of Intimacy
|
||||
// Quest ID: 65883
|
||||
// Start NPC: 1001708 (Cocobuki)
|
||||
// End NPC: 1001709 (Cocobygo)
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
class ClsThm050 : public Sapphire::ScriptAPI::QuestScript
|
||||
{
|
||||
private:
|
||||
// Basic quest information
|
||||
// Quest vars / flags used
|
||||
// BitFlag8 - removes the wait destination
|
||||
// UI8AL - I think this is everything completed?
|
||||
// UI8BH - gives 1 dried fish
|
||||
// UI8BL - gives vulture meat
|
||||
|
||||
/// Countable Num: 1 Seq: 1 Event: 1 Listener: 1001709
|
||||
/// Countable Num: 1 Seq: 2 Event: 1 Listener: 2001468
|
||||
/// Countable Num: 1 Seq: 3 Event: 8 Listener: 2001468
|
||||
/// Countable Num: 1 Seq: 4 Event: 1 Listener: 2001469
|
||||
/// Countable Num: 1 Seq: 255 Event: 9 Listener: 12
|
||||
// Steps in this quest ( 0 is before accepting,
|
||||
// 1 is first, 255 means ready for turning it in
|
||||
enum Sequence : uint8_t
|
||||
{
|
||||
Seq0 = 0,
|
||||
Seq1 = 1,//speak with cocobygo
|
||||
Seq2 = 2,//place dried fish
|
||||
Seq3 = 3,//wait for chance to slay vulture
|
||||
Seq4 = 4,//hand slice of vulture meat
|
||||
SeqFinish = 255,
|
||||
};
|
||||
|
||||
// Entities found in the script data of the quest
|
||||
static constexpr auto ActorCocobuki = 1001708;// Cocobuki ( Pos: -250.347000 18.000000 80.903603 Teri: 130 )
|
||||
static constexpr auto ActorCocobygo = 1001709;// Cocobygo ( Pos: -240.473999 18.700001 85.611702 Teri: 130 )
|
||||
static constexpr auto ActorFafafono = 1002027;// Fafafono ( Pos: -255.229004 33.233601 407.295013 Teri: 140 )
|
||||
static constexpr auto ActorCocobusi = 1001713;// Cocobusi
|
||||
static constexpr auto CutClsthm05010 = 50;
|
||||
static constexpr auto enemyCirclingVulture = 4002289; //
|
||||
static constexpr auto fishDestinationEObject = 2001468;// Destination ( Pos: -87.371597 50.629902 315.605011 Teri: 140 )
|
||||
static constexpr auto waitDestinationEObject = 2001469;// Destination ( Pos: -74.943199 53.255798 336.807007 Teri: 140 )
|
||||
static constexpr auto EventActionSearch = 1;
|
||||
static constexpr auto EventActionWaitingShor = 11;
|
||||
static constexpr auto Item0 = 2000414;
|
||||
static constexpr auto Item1 = 2000415;
|
||||
static constexpr auto Item0Icon = 25919;
|
||||
static constexpr auto Item1Icon = 25151;
|
||||
|
||||
public:
|
||||
ClsThm050() : Sapphire::ScriptAPI::QuestScript( 65883 ){};
|
||||
~ClsThm050() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Event Handlers
|
||||
void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
switch( actorId )
|
||||
{
|
||||
case ActorCocobuki:
|
||||
{
|
||||
if( quest.getSeq() == Seq0 )
|
||||
{
|
||||
Scene00000( quest, player );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ActorCocobygo:
|
||||
{
|
||||
if( quest.getSeq() == Seq1 )
|
||||
{
|
||||
Scene00001( quest, player );
|
||||
}
|
||||
else if( quest.getSeq() == SeqFinish )
|
||||
{
|
||||
Scene00010( quest, player );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case fishDestinationEObject:
|
||||
{
|
||||
Scene00002( quest, player );
|
||||
break;
|
||||
}
|
||||
case waitDestinationEObject:
|
||||
{
|
||||
if( quest.getSeq() == Seq3 )
|
||||
{
|
||||
eventMgr().eventActionStart(
|
||||
player, getId(), EventActionWaitingShor,
|
||||
[ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional ) {
|
||||
quest.setSeq( Seq3 );
|
||||
Scene00005( quest, player );
|
||||
},
|
||||
nullptr, 0 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ActorFafafono:
|
||||
{
|
||||
if( quest.getSeq() == Seq4 )
|
||||
{
|
||||
Scene00008( quest, player );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ActorCocobusi:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onEventItem( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
switch( actorId )
|
||||
{
|
||||
case fishDestinationEObject:
|
||||
eventMgr().sendEventNotice( player, getId(), 1 );
|
||||
quest.setUI8BH( 0 );
|
||||
quest.setSeq( Seq3 );
|
||||
}
|
||||
}
|
||||
|
||||
void onBNpcKill( World::Quest& quest, Entity::BNpc& bnpc, Entity::Player& player ) override
|
||||
{
|
||||
|
||||
switch( bnpc.getLayoutId() )
|
||||
{
|
||||
case enemyCirclingVulture:
|
||||
{
|
||||
quest.setSeq( Seq4 );
|
||||
quest.setUI8BL( 1 );
|
||||
eventMgr().sendNotice( player, getId(), 2, { Item1Icon } );//wait for chance to slay with item icon
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onPlayerDeath( World::Quest& quest, Sapphire::Entity::Player& player ) override
|
||||
{
|
||||
//doesn't trigger
|
||||
if( quest.getSeq() == Seq3 )
|
||||
{
|
||||
auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() );
|
||||
|
||||
auto enemy = instance->getActiveBNpcByLayoutIdAndTriggerOwner( enemyCirclingVulture, player.getId() );
|
||||
|
||||
if( enemy != nullptr ) instance->removeActor( enemy );
|
||||
|
||||
quest.setBitFlag8( 1, false );
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Available Scenes in this quest, not necessarly all are used
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Scene00000( World::Quest& quest, Entity::Player& player )
|
||||
{
|
||||
eventMgr().playQuestScene( player, getId(), 0, HIDE_HOTBAR, bindSceneReturn( &ClsThm050::Scene00000Return ) );
|
||||
}
|
||||
|
||||
void Scene00000Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( result.getResult( 0 ) == 1 )// accept quest
|
||||
{
|
||||
quest.setSeq( Seq1 );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Scene00001( World::Quest& quest, Entity::Player& player )
|
||||
{
|
||||
eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, bindSceneReturn( &ClsThm050::Scene00001Return ) );
|
||||
}
|
||||
|
||||
void Scene00001Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
eventMgr().sendEventNotice( player, getId(), 0 );
|
||||
quest.setSeq( Seq2 );
|
||||
quest.setUI8BH( 1 );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Scene00002( World::Quest& quest, Entity::Player& player )
|
||||
{
|
||||
eventMgr().playQuestScene( player, getId(), 2, HIDE_HOTBAR, bindSceneReturn( &ClsThm050::Scene00002Return ) );
|
||||
}
|
||||
|
||||
void Scene00002Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( result.getResult( 0 ) == 1 )
|
||||
{
|
||||
eventMgr().eventItemActionStart(
|
||||
player, getId(), Item0,
|
||||
quest.getSeq(), fishDestinationEObject );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
// does nothing?
|
||||
void Scene00003( World::Quest& quest, Entity::Player& player )
|
||||
{
|
||||
eventMgr().playQuestScene( player, getId(), 3, NONE, bindSceneReturn( &ClsThm050::Scene00003Return ) );
|
||||
}
|
||||
|
||||
void Scene00003Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
// does nothing?
|
||||
void Scene00004( World::Quest& quest, Entity::Player& player )
|
||||
{
|
||||
eventMgr().playQuestScene( player, getId(), 4, HIDE_HOTBAR, bindSceneReturn( &ClsThm050::Scene00004Return ) );
|
||||
}
|
||||
|
||||
void Scene00004Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Scene00005( World::Quest& quest, Entity::Player& player )
|
||||
{
|
||||
eventMgr().playQuestScene( player, getId(), 5, HIDE_HOTBAR, bindSceneReturn( &ClsThm050::Scene00005Return ) );
|
||||
}
|
||||
|
||||
void Scene00005Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
quest.setBitFlag8( 1, true );//removes the location
|
||||
auto instance = teriMgr().getTerritoryByGuId( player.getTerritoryId() );
|
||||
auto enemy = instance->createBNpcFromLayoutId( enemyCirclingVulture, 90, Common::BNpcType::Enemy, player.getId() );
|
||||
enemy->hateListAdd( player.getAsPlayer(), 1 );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//does nothing
|
||||
void Scene00006( World::Quest& quest, Entity::Player& player )
|
||||
{
|
||||
eventMgr().playQuestScene( player, getId(), 6, NONE, bindSceneReturn( &ClsThm050::Scene00006Return ) );
|
||||
}
|
||||
|
||||
void Scene00006Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//does nothing
|
||||
void Scene00007( World::Quest& quest, Entity::Player& player )
|
||||
{
|
||||
eventMgr().playQuestScene( player, getId(), 7, NONE, bindSceneReturn( &ClsThm050::Scene00007Return ) );
|
||||
}
|
||||
|
||||
void Scene00007Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Scene00008( World::Quest& quest, Entity::Player& player )
|
||||
{
|
||||
eventMgr().playQuestScene( player, getId(), 8, HIDE_HOTBAR, bindSceneReturn( &ClsThm050::Scene00008Return ) );
|
||||
}
|
||||
|
||||
void Scene00008Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
if( result.getResult( 0 ) == 1 )
|
||||
{
|
||||
Scene00009( quest, player );
|
||||
}
|
||||
else
|
||||
{
|
||||
Scene00006( quest, player );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Scene00009( World::Quest& quest, Entity::Player& player )
|
||||
{
|
||||
eventMgr().playQuestScene( player, getId(), 9, FADE_OUT | HIDE_UI | SET_INVIS_BASE, bindSceneReturn( &ClsThm050::Scene00009Return ) );
|
||||
}
|
||||
|
||||
void Scene00009Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
quest.setSeq( SeqFinish );
|
||||
quest.setUI8BL( 0 );
|
||||
quest.setUI8AL( 1 );
|
||||
eventMgr().sendEventNotice( player, getId(), 3 );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Scene00010( World::Quest& quest, Entity::Player& player )
|
||||
{
|
||||
eventMgr().playQuestScene( player, getId(), 10, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI | SET_INVIS_BASE, bindSceneReturn( &ClsThm050::Scene00010Return ) );
|
||||
}
|
||||
|
||||
void Scene00010Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
Scene00011( quest, player );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Scene00011( World::Quest& quest, Entity::Player& player )
|
||||
{
|
||||
eventMgr().playQuestScene( player, getId(), 11, HIDE_HOTBAR, bindSceneReturn( &ClsThm050::Scene00011Return ) );
|
||||
}
|
||||
|
||||
void Scene00011Return( World::Quest& quest, Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
|
||||
if( result.getResult( 0 ) == 1 )
|
||||
{
|
||||
player.finishQuest( getId(), result.getResult( 1 ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_SCRIPT( ClsThm050 );
|
|
@ -1,22 +1,19 @@
|
|||
#include "EventItemAction.h"
|
||||
#include <Network/CommonActorControl.h>
|
||||
|
||||
#include <Exd/ExdData.h>
|
||||
#include <Exd/Structs.h>
|
||||
|
||||
#include <Actor/Player.h>
|
||||
#include <Network/PacketWrappers/EffectPacket.h>
|
||||
|
||||
#include "Manager/PlayerMgr.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include "Manager/PlayerMgr.h"
|
||||
|
||||
#include "Network/PacketWrappers/ActorControlPacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlTargetPacket.h"
|
||||
#include "Script/ScriptMgr.h"
|
||||
#include <Service.h>
|
||||
#include <Network/CommonActorControl.h>
|
||||
#include <WorldServer.h>
|
||||
#include "Network/PacketWrappers/ActorControlPacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlSelfPacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlTargetPacket.h"
|
||||
#include <Util/UtilMath.h>
|
||||
|
||||
#include <Common.h>
|
||||
|
||||
|
||||
|
@ -30,8 +27,7 @@ using namespace Sapphire::Network::ActorControl;
|
|||
|
||||
EventItemAction::EventItemAction( Sapphire::Entity::CharaPtr source, uint32_t eventItemId,
|
||||
std::shared_ptr< Excel::ExcelStruct< Excel::EventItem > > eventItemActionData,
|
||||
uint32_t sequence, uint64_t targetId ) :
|
||||
m_eventItemAction( std::move( eventItemActionData ) )
|
||||
uint32_t sequence, uint64_t targetId ) : m_eventItemAction( std::move( eventItemActionData ) )
|
||||
{
|
||||
m_id = eventItemId;
|
||||
m_eventItem = eventItemId;
|
||||
|
@ -56,21 +52,24 @@ bool EventItemAction::init()
|
|||
|
||||
void EventItemAction::execute()
|
||||
{
|
||||
Manager::PlayerMgr::sendDebug( *getSourceChara()->getAsPlayer(), "EventItemAction type {0} execute called.", m_eventItemAction->data().Action );
|
||||
Sapphire::Entity::PlayerPtr ptr = m_pSource->getAsPlayer();
|
||||
if( !ptr )
|
||||
{
|
||||
return;
|
||||
}
|
||||
Manager::PlayerMgr::sendDebug( *ptr, "EventItemAction type {0} execute called.", m_eventItemAction->data().Action );
|
||||
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||
|
||||
auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
|
||||
eventMgr.eventStart( *getSourceChara()->getAsPlayer(), m_targetId, m_eventItemAction->data().EventHandler,
|
||||
eventMgr.eventStart( *ptr, m_targetId, m_eventItemAction->data().EventHandler,
|
||||
Event::EventHandler::ActionResult, 0, 0 );
|
||||
|
||||
scriptMgr.onEventItem( *getSourceChara()->getAsPlayer(), m_eventItem, m_eventItemAction->data().EventHandler, m_targetId );
|
||||
eventMgr.checkEvent( *getSourceChara()->getAsPlayer(), m_eventItemAction->data().EventHandler );
|
||||
scriptMgr.onEventItem( *ptr, m_eventItem, m_eventItemAction->data().EventHandler, m_targetId );
|
||||
eventMgr.checkEvent( *ptr, m_eventItemAction->data().EventHandler );
|
||||
}
|
||||
|
||||
void EventItemAction::onStart()
|
||||
{
|
||||
}
|
||||
|
||||
void EventItemAction::onInterrupt()
|
||||
{
|
||||
}
|
||||
m_startTime = Common::Util::getTimeMs();
|
||||
}
|
|
@ -23,8 +23,6 @@ namespace Sapphire::World::Action
|
|||
|
||||
void execute() override;
|
||||
|
||||
void onInterrupt() override;
|
||||
|
||||
void onStart() override;
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "WorldServer.h"
|
||||
|
||||
#include "Action/EventAction.h"
|
||||
#include "Manager/PlayerMgr.h"
|
||||
#include "Service.h"
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
|
@ -52,7 +54,7 @@ void Sapphire::Entity::Player::removeEvent( uint32_t eventId )
|
|||
|
||||
void Sapphire::Entity::Player::onDeath()
|
||||
{
|
||||
|
||||
Service< World::Manager::PlayerMgr >::ref().onDeath( *this );
|
||||
}
|
||||
|
||||
// TODO: slightly ugly here and way too static. Needs too be done properly
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "Territory/InstanceContent.h"
|
||||
|
||||
#include "Action/EventAction.h"
|
||||
#include "Action/EventItemAction.h"
|
||||
#include "WorldServer.h"
|
||||
#include "Actor/Player.h"
|
||||
#include <Script/ScriptMgr.h>
|
||||
|
@ -118,7 +119,7 @@ std::string EventMgr::getEventName( uint32_t eventId )
|
|||
}
|
||||
}
|
||||
|
||||
return unknown + "Warp"; //who know
|
||||
return unknown + "Warp";//who know
|
||||
}
|
||||
|
||||
case Event::EventHandler::EventHandlerType::Shop:
|
||||
|
@ -139,7 +140,7 @@ std::string EventMgr::getEventName( uint32_t eventId )
|
|||
|
||||
std::string EventMgr::getErrorCodeName( uint8_t errorCode )
|
||||
{
|
||||
switch ( errorCode )
|
||||
switch( errorCode )
|
||||
{
|
||||
case Common::EventSceneError::EVENT_SCENE_SUCCESS:
|
||||
{
|
||||
|
@ -321,7 +322,6 @@ void EventMgr::handleReturnEventScene( Entity::Player& player, uint32_t eventId,
|
|||
else if( auto chainCallback = pEvent->getSceneChainCallback() )
|
||||
chainCallback( player );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
checkEvent( player, eventId );
|
||||
|
@ -347,7 +347,6 @@ void EventMgr::handleYieldEventScene( Entity::Player& player, uint32_t eventId,
|
|||
{
|
||||
PlayerMgr::sendDebug( player, "Yield not implemented in script, sending default" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void EventMgr::handleYieldStringEventScene( Entity::Player& player, uint32_t eventId, uint16_t sceneId, uint8_t resumeId, const std::string& resultString )
|
||||
|
@ -451,7 +450,6 @@ void EventMgr::handleReturnStringEventScene( Entity::Player& player, uint32_t ev
|
|||
else if( auto chainCallback = pEvent->getSceneChainCallback() )
|
||||
chainCallback( player );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
checkEvent( player, eventId );
|
||||
|
@ -484,16 +482,14 @@ void EventMgr::handleReturnIntAndStringEventScene( Entity::Player& player, uint3
|
|||
eventCallback( player, result );
|
||||
}
|
||||
|
||||
// we might have a scene chain callback instead so check for that too
|
||||
// we might have a scene chain callback instead so check for that too
|
||||
else if( auto chainCallback = pEvent->getSceneChainCallback() )
|
||||
chainCallback( player );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void EventMgr::checkEvent( Sapphire::Entity::Player &player, uint32_t eventId )
|
||||
void EventMgr::checkEvent( Sapphire::Entity::Player& player, uint32_t eventId )
|
||||
{
|
||||
auto pEvent = player.getEvent( eventId );
|
||||
|
||||
|
@ -575,7 +571,6 @@ void EventMgr::eventStart( Entity::Player& player, uint64_t actorId, uint32_t ev
|
|||
|
||||
server.queueForPlayer( player.getCharacterId(), std::make_shared< EventStartPacket >( player.getId(), actorId,
|
||||
eventId, eventType, eventParam1, eventParam2 ) );
|
||||
|
||||
}
|
||||
|
||||
void EventMgr::eventActionStart( Entity::Player& player, uint32_t eventId, uint32_t action,
|
||||
|
@ -605,15 +600,23 @@ void EventMgr::eventActionStart( Entity::Player& player, uint32_t eventId, uint3
|
|||
pEventAction->start();
|
||||
}
|
||||
|
||||
void EventMgr::eventItemActionStart( Entity::Player& player, uint32_t eventId, uint32_t action, World::Action::ActionCallback finishCallback,
|
||||
World::Action::ActionCallback interruptCallback, uint64_t additional )
|
||||
void EventMgr::eventItemActionStart( Entity::Player& player, uint32_t eventId, uint32_t action,
|
||||
uint32_t sequence, uint64_t targetId )
|
||||
{
|
||||
// Action::ActionPtr pEventItemAction = Action::make_EventItemAction( getAsChara(), eventId, action,
|
||||
// finishCallback, interruptCallback, additional );
|
||||
//
|
||||
// setCurrentAction( pEventItemAction );
|
||||
//
|
||||
// pEventItemAction->onStart();
|
||||
auto& exdData = Common::Service< Data::ExdData >::ref();
|
||||
|
||||
auto eventItemData = exdData.getRow< Excel::EventItem >( action );
|
||||
if( !eventItemData )
|
||||
{
|
||||
Logger::error( "Could not find eventItem #{0}", action );
|
||||
return;
|
||||
}
|
||||
|
||||
auto pEventItemAction = World::Action::make_EventItemAction( player.getAsChara(), eventId, exdData.getRow< Excel::EventItem >( action ), sequence, targetId );
|
||||
|
||||
player.setCurrentAction( pEventItemAction );
|
||||
|
||||
pEventItemAction->onStart();
|
||||
}
|
||||
|
||||
|
||||
|
@ -623,15 +626,15 @@ void EventMgr::playGilShop( Entity::Player& player, uint32_t eventId, uint32_t f
|
|||
if( !pEvent )
|
||||
return;
|
||||
|
||||
if( param1 == 0 ) //list items
|
||||
if( param1 == 0 )//list items
|
||||
{
|
||||
auto& shopMgr = Common::Service< ShopMgr >::ref();
|
||||
std::vector< uint32_t > params = std::vector< uint32_t >();
|
||||
|
||||
params.push_back( 201 ); //unknown
|
||||
params.push_back( 1 ); //command id
|
||||
params.push_back( 201 );//unknown
|
||||
params.push_back( 1 ); //command id
|
||||
params.push_back( 40 ); //max items for sell
|
||||
params.push_back( 0 ); //flag
|
||||
params.push_back( 0 ); //flag
|
||||
uint8_t index;
|
||||
for( index = 0; index < 40; index++ )
|
||||
{
|
||||
|
@ -640,27 +643,27 @@ void EventMgr::playGilShop( Entity::Player& player, uint32_t eventId, uint32_t f
|
|||
else
|
||||
break;
|
||||
}
|
||||
params[ 2 ] = static_cast< uint32_t >( params.size() - 4 ); //new max item size
|
||||
params[ 2 ] = static_cast< uint32_t >( params.size() - 4 );//new max item size
|
||||
auto& exdData = Common::Service< Data::ExdData >::ref();
|
||||
|
||||
for( auto it : *player.getSoldItems() )
|
||||
{
|
||||
auto item = exdData.getRow< Excel::Item >( it.first );
|
||||
params.push_back( it.first ); //itemCatalogId
|
||||
params.push_back( it.second ); //stack
|
||||
params.push_back( item->data().Price ); //price
|
||||
params.push_back( 0 );//flag isHQ
|
||||
params.push_back( 0 );//numOfMateria
|
||||
params.push_back( eventId ); //shopId
|
||||
params.push_back( it.first ); //itemCatalogId
|
||||
params.push_back( it.second ); //stack
|
||||
params.push_back( item->data().Price );//price
|
||||
params.push_back( 0 ); //flag isHQ
|
||||
params.push_back( 0 ); //numOfMateria
|
||||
params.push_back( eventId ); //shopId
|
||||
|
||||
params.push_back( 0 );//signatureId
|
||||
params.push_back( 0 );//signatureId
|
||||
|
||||
params.push_back( ( 1000 << 16 ) + 1000 );//durability + refine
|
||||
params.push_back( 0 );//stain
|
||||
params.push_back( 0 );//pattern
|
||||
params.push_back( 0 ); //stain
|
||||
params.push_back( 0 ); //pattern
|
||||
|
||||
for( uint8_t slot = 0; slot < 5; slot++ ) //materia
|
||||
for( uint8_t slot = 0; slot < 5; slot++ )//materia
|
||||
{
|
||||
params.push_back( 0 );
|
||||
}
|
||||
|
@ -668,9 +671,8 @@ void EventMgr::playGilShop( Entity::Player& player, uint32_t eventId, uint32_t f
|
|||
|
||||
playScene( player, eventId, 40, flags, params, std::move( eventCallback ) );
|
||||
}
|
||||
else if( param1 == 2 ) //sell item
|
||||
else if( param1 == 2 )//sell item
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -710,7 +712,7 @@ void EventMgr::resumeScene( Entity::Player& player, uint32_t eventId, uint32_t s
|
|||
pPacket = std::move( std::make_shared< EventResume64Packet >( player, eventId, scene, yieldId, values ) );
|
||||
else if( paramCount < 128 )
|
||||
pPacket = std::move( std::make_shared< EventResume128Packet >( player, eventId, scene, yieldId, values ) );
|
||||
else if ( paramCount < 255 )
|
||||
else if( paramCount < 255 )
|
||||
pPacket = std::move( std::make_shared< EventResume255Packet >( player, eventId, scene, yieldId, values ) );
|
||||
|
||||
auto& server = Common::Service< World::WorldServer >::ref();
|
||||
|
@ -815,7 +817,7 @@ bool EventMgr::sendEventPlay( Entity::Player& player, uint32_t eventId, uint32_t
|
|||
pPacket = std::move( std::make_shared< EventPlayPacket64 >( player, pEvent->getActorId(), pEvent->getId(), scene, flags ) );
|
||||
else if( paramCount < 128 )
|
||||
pPacket = std::move( std::make_shared< EventPlayPacket128 >( player, pEvent->getActorId(), pEvent->getId(), scene, flags ) );
|
||||
else if ( paramCount < 255 )
|
||||
else if( paramCount < 255 )
|
||||
pPacket = std::move( std::make_shared< EventPlayPacket255 >( player, pEvent->getActorId(), pEvent->getId(), scene, flags ) );
|
||||
|
||||
auto& server = Common::Service< World::WorldServer >::ref();
|
||||
|
@ -869,5 +871,4 @@ void EventMgr::sendNotice( Entity::Player& player, uint32_t questId, int8_t noti
|
|||
|
||||
auto& server = Common::Service< World::WorldServer >::ref();
|
||||
server.queueForPlayer( player.getCharacterId(), pPacket );
|
||||
|
||||
}
|
||||
|
|
|
@ -39,8 +39,7 @@ namespace Sapphire::World::Manager
|
|||
void eventActionStart( Entity::Player& player, uint32_t eventId, uint32_t action, World::Action::ActionCallback finishCallback,
|
||||
World::Action::ActionCallback interruptCallback, uint64_t additional );
|
||||
/*! start an event item action */
|
||||
void eventItemActionStart( Entity::Player& player, uint32_t eventId, uint32_t action, World::Action::ActionCallback finishCallback,
|
||||
World::Action::ActionCallback interruptCallback, uint64_t additional );
|
||||
void eventItemActionStart( Entity::Player& player, uint32_t eventId, uint32_t action, uint32_t sequence, uint64_t targetId );
|
||||
|
||||
void playGilShop( Entity::Player& player, uint32_t eventId, uint32_t flags, uint32_t param1, Event::EventHandler::SceneReturnCallback eventCallback );
|
||||
|
||||
|
|
|
@ -830,9 +830,9 @@ uint32_t Territory::getNextEffectSequence()
|
|||
return m_effectCounter++;
|
||||
}
|
||||
|
||||
Entity::BNpcPtr Territory::createBNpcFromLayoutId( uint32_t levelId, uint32_t hp, Common::BNpcType bnpcType, uint32_t triggerOwnerId )
|
||||
Entity::BNpcPtr Territory::createBNpcFromLayoutId( uint32_t layoutId, uint32_t hp, Common::BNpcType bnpcType, uint32_t triggerOwnerId )
|
||||
{
|
||||
auto infoPtr = m_bNpcBaseMap.find( levelId );
|
||||
auto infoPtr = m_bNpcBaseMap.find( layoutId );
|
||||
if( infoPtr == m_bNpcBaseMap.end() )
|
||||
return nullptr;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue