mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 08:27:46 +00:00
Add bosses (messy)
This commit is contained in:
parent
7d8624eda2
commit
9702ad1d72
1 changed files with 74 additions and 20 deletions
|
@ -1,11 +1,20 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Territory/InstanceContent.h>
|
#include <Territory/InstanceContent.h>
|
||||||
#include <Manager/RNGMgr.h>
|
#include <Manager/RNGMgr.h>
|
||||||
|
|
||||||
#include <Actor/EventObject.h>
|
#include <Actor/EventObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Actor/BNpc.h>
|
#include <Actor/BNpc.h>
|
||||||
|
|
||||||
|
#include <WorldServer.h>
|
||||||
|
|
||||||
|
#include <Network/GamePacket.h>
|
||||||
|
#include <Network/GameConnection.h>
|
||||||
|
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
using namespace Sapphire::Network::Packets;
|
||||||
|
using namespace Sapphire::Network::Packets::WorldPackets;
|
||||||
|
|
||||||
class Sastasha :
|
class Sastasha :
|
||||||
public Sapphire::ScriptAPI::InstanceContentScript
|
public Sapphire::ScriptAPI::InstanceContentScript
|
||||||
|
@ -30,12 +39,17 @@ private:
|
||||||
Seq2 = 3,
|
Seq2 = 3,
|
||||||
Seq3 = 7,
|
Seq3 = 7,
|
||||||
Seq4 = 15,
|
Seq4 = 15,
|
||||||
SeqFinish = 31
|
SeqFinish = 255
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr auto EventActionTouch = 24;
|
static constexpr auto EventActionTouch = 24;
|
||||||
static constexpr auto EventActionShort = 15;
|
static constexpr auto EventActionShort = 15;
|
||||||
|
|
||||||
|
Entity::BNpcPtr denn;
|
||||||
|
Entity::BNpcPtr madison2;
|
||||||
|
Entity::BNpcPtr madison;
|
||||||
|
Entity::BNpcPtr chopper;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Sastasha() :
|
Sastasha() :
|
||||||
Sapphire::ScriptAPI::InstanceContentScript( 4 )
|
Sapphire::ScriptAPI::InstanceContentScript( 4 )
|
||||||
|
@ -113,7 +127,26 @@ public:
|
||||||
|
|
||||||
void onUpdate( InstanceContent& instance, uint64_t tickCount ) override
|
void onUpdate( InstanceContent& instance, uint64_t tickCount ) override
|
||||||
{
|
{
|
||||||
|
if( madison && !madison->isAlive() )
|
||||||
|
{
|
||||||
|
instance.setVar( 0, Seq3 );
|
||||||
|
instance.getEObjByName( "Rambadedoor" )->setState( 1 );
|
||||||
|
madison2 = instance.createBNpcFromInstanceId( 4035056, 600, Common::BNpcType::Enemy );
|
||||||
|
madison = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( madison2 && !madison2->isAlive() )
|
||||||
|
{
|
||||||
|
instance.getEObjByName( "Rambadedoor_1" )->setState( 1 );
|
||||||
|
madison2 = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( denn && !denn->isAlive() )
|
||||||
|
{
|
||||||
|
instance.setVar( 0, SeqFinish );
|
||||||
|
instance.sendDutyComplete();
|
||||||
|
denn = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onTalk( InstanceContent& instance, Entity::Player& player, Entity::EventObject& eobj, uint32_t eventId ) override
|
void onTalk( InstanceContent& instance, Entity::Player& player, Entity::EventObject& eobj, uint32_t eventId ) override
|
||||||
|
@ -140,7 +173,7 @@ public:
|
||||||
// TODO: summon boss, do this after boss is defeated
|
// TODO: summon boss, do this after boss is defeated
|
||||||
instance.registerEObj( "Inconspicuousswitch", 2000216, 3653858, 4, { 62.907951f, 33.969521f, -31.172279f }, 1.000000f, -1.396264f );
|
instance.registerEObj( "Inconspicuousswitch", 2000216, 3653858, 4, { 62.907951f, 33.969521f, -31.172279f }, 1.000000f, -1.396264f );
|
||||||
instance.setVar( 0, Seq1 );
|
instance.setVar( 0, Seq1 );
|
||||||
Logger::debug( "correct coral!" );
|
instance.sendEventLogMessage( player, instance, 2034, { 0, 0 } );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -155,6 +188,10 @@ public:
|
||||||
|
|
||||||
// Open the door and progress duty
|
// Open the door and progress duty
|
||||||
if( eobj.getName() == "Inconspicuousswitch" )
|
if( eobj.getName() == "Inconspicuousswitch" )
|
||||||
|
{
|
||||||
|
if( !chopper )
|
||||||
|
chopper = instance.createBNpcFromInstanceId( 4035011, 400, Common::BNpcType::Enemy );
|
||||||
|
else if( chopper && !chopper->isAlive() )
|
||||||
{
|
{
|
||||||
eventMgr().eventActionStart( player, getId(), EventActionTouch,
|
eventMgr().eventActionStart( player, getId(), EventActionTouch,
|
||||||
[ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
[ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
||||||
|
@ -162,9 +199,12 @@ public:
|
||||||
instance.getEObjByName( "Hiddendoor" )->setState( 1 );
|
instance.getEObjByName( "Hiddendoor" )->setState( 1 );
|
||||||
eobj.setState( 1 );
|
eobj.setState( 1 );
|
||||||
instance.setVar( 0, Seq2 );
|
instance.setVar( 0, Seq2 );
|
||||||
|
instance.sendEventLogMessage( player, instance, 2064, { 0, 0 } );
|
||||||
|
madison = instance.createBNpcFromInstanceId( 3988325, 600, Common::BNpcType::Enemy );
|
||||||
},
|
},
|
||||||
nullptr, getId() );
|
nullptr, getId() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: set Seq3 and SeqFinish
|
// TODO: set Seq3 and SeqFinish
|
||||||
|
|
||||||
|
@ -175,7 +215,8 @@ public:
|
||||||
[ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
[ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
||||||
{
|
{
|
||||||
eobj.setState( 1 );
|
eobj.setState( 1 );
|
||||||
instance.setVar( 0, Seq4 );
|
instance.setCustomVar( ObtainedKey, true );
|
||||||
|
instance.sendEventLogMessage( player, instance, 2031, { 34432 } );
|
||||||
},
|
},
|
||||||
nullptr, getId() );
|
nullptr, getId() );
|
||||||
}
|
}
|
||||||
|
@ -187,22 +228,35 @@ public:
|
||||||
[ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
[ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
||||||
{
|
{
|
||||||
eobj.setState( 1 );
|
eobj.setState( 1 );
|
||||||
instance.setCustomVar( ObtainedKey, true );
|
instance.setVar( 0, Seq4 );
|
||||||
|
instance.sendEventLogMessage( player, instance, 2031, { 34433 } );
|
||||||
|
denn = instance.createBNpcFromInstanceId( 3978771, 1000, Common::BNpcType::Enemy );
|
||||||
},
|
},
|
||||||
nullptr, getId() );
|
nullptr, getId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the door if the right key has been obtained
|
// Open the door if the right key has been obtained
|
||||||
if( ( eobj.getName() == "Captainsquarters" && instance.getDirectorVar( 0 ) == Seq4 ) ||
|
if( ( eobj.getName() == "Captainsquarters" && instance.getCustomVar( ObtainedKey ) ) ||
|
||||||
( eobj.getName() == "WaveriderGate" && instance.getCustomVar( ObtainedKey ) ) )
|
( eobj.getName() == "WaveriderGate" && instance.getDirectorVar( 0 ) == Seq4 ) )
|
||||||
|
{
|
||||||
|
eventMgr().playScene( player, eventId, 1, HIDE_HOTBAR, { 1 },
|
||||||
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
if( result.getResult( 0 ) == 0 )
|
||||||
{
|
{
|
||||||
eventMgr().eventActionStart( player, getId(), EventActionTouch,
|
eventMgr().eventActionStart( player, getId(), EventActionTouch,
|
||||||
[ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
[ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
||||||
{
|
{
|
||||||
eobj.setState( 1 );
|
eobj.setState( 1 );
|
||||||
|
if( eobj.getName() == "Captainsquarters" )
|
||||||
|
instance.sendEventLogMessage( player, instance, 2059, { 668 } );
|
||||||
|
else
|
||||||
|
instance.sendEventLogMessage( player, instance, 2059, { 671 } );
|
||||||
},
|
},
|
||||||
nullptr, getId() );
|
nullptr, getId() );
|
||||||
}
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onEnterTerritory( InstanceContent& instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
|
void onEnterTerritory( InstanceContent& instance, Entity::Player& player, uint32_t eventId, uint16_t param1,
|
||||||
|
|
Loading…
Add table
Reference in a new issue