1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 14:07:46 +00:00

#34 - Implemented tracking of opnening sequence, firstlogin may be obsolete now

This commit is contained in:
Mordred 2017-08-20 02:24:19 +02:00
parent bb4a84d51a
commit 6561cf566e
10 changed files with 64 additions and 43 deletions

View file

@ -37,7 +37,7 @@ class OpeningGridaniaDef
player.eventPlay( this.id, 0, 0x2001, 0, 1, player.eventPlay( this.id, 0, 0x2001, 0, 1,
fun( player, eventId, param1, param2, param3 ) fun( player, eventId, param1, param2, param3 )
{ {
player.setFirstLogin( false ); player.setOpeningSequence( 1 );
OpeningGridania.Scene00001( player ); OpeningGridania.Scene00001( player );
} ); } );
} }
@ -62,7 +62,7 @@ class OpeningGridaniaDef
player.eventPlay( this.id, 40, 1, 2, 1, player.eventPlay( this.id, 40, 1, 2, 1,
fun( player, eventId, param1, param2, param3 ) fun( player, eventId, param1, param2, param3 )
{ {
if( player.hasQuest( ManFst001.id ) ) if( player.getOpeningSequence() == 2 )
{ {
// update the instance boundaries // update the instance boundaries
OpeningGridania.Scene00030( player ); OpeningGridania.Scene00030( player );
@ -74,7 +74,7 @@ class OpeningGridaniaDef
def onEnterTerritory( eventId, player, param1, param2) def onEnterTerritory( eventId, player, param1, param2)
{ {
if( player.isFirstLogin() == true ) if( player.getOpeningSequence() == 0 )
{ {
this.Scene00000( player ); this.Scene00000( player );
} }

View file

@ -47,7 +47,7 @@ class OpeningLimsaLominsaDef
player.eventPlay( this.id, 0, 0x04AC05, 0, 1, player.eventPlay( this.id, 0, 0x04AC05, 0, 1,
fun( player, eventId, param1, param2, param3 ) fun( player, eventId, param1, param2, param3 )
{ {
player.setFirstLogin( false ); player.setOpeningSequence( 1 );
OpeningLimsaLominsa.Scene00001( player ); OpeningLimsaLominsa.Scene00001( player );
} ); } );
} }
@ -73,7 +73,7 @@ class OpeningLimsaLominsaDef
fun( player, eventId, param1, param2, param3 ) fun( player, eventId, param1, param2, param3 )
{ {
player.eventFinish( eventId, UNLOCK ); player.eventFinish( eventId, UNLOCK );
if( player.hasQuest( ManSea001.id ) ) if( player.getOpeningSequence() == 2 )
{ {
// update the instance boundaries // update the instance boundaries
OpeningLimsaLominsa.Scene00030( player ); OpeningLimsaLominsa.Scene00030( player );
@ -85,14 +85,14 @@ class OpeningLimsaLominsaDef
def onEnterTerritory( eventId, player, param1, param2) def onEnterTerritory( eventId, player, param1, param2)
{ {
// if( player.isFirstLogin() == true ) if( player.getOpeningSequence() == 0 )
// { {
this.Scene00000( player ); this.Scene00000( player );
// } }
//else else
// { {
// this.Scene00040( player ); this.Scene00040( player );
// } }
} }
def onWithinRange( eventId, player, param1, x, y, z) def onWithinRange( eventId, player, param1, x, y, z)

View file

@ -38,7 +38,7 @@ class OpeningUldahDef
player.eventPlay( this.id, 0, 0x2001, 0, 1, player.eventPlay( this.id, 0, 0x2001, 0, 1,
fun( player, eventId, param1, param2, param3 ) fun( player, eventId, param1, param2, param3 )
{ {
player.setFirstLogin( false ); player.setOpeningSequence( 1 );
OpeningUldah.Scene00001( player ); OpeningUldah.Scene00001( player );
} ); } );
} }
@ -63,7 +63,7 @@ class OpeningUldahDef
player.eventPlay( this.id, 40, 1, 2, 1, player.eventPlay( this.id, 40, 1, 2, 1,
fun( player, eventId, param1, param2, param3 ) fun( player, eventId, param1, param2, param3 )
{ {
if( player.hasQuest( ManWil001.id ) ) if( player.getOpeningSequence() == 2 )
{ {
// update the instance boundaries // update the instance boundaries
OpeningUldah.Scene00030( player ); OpeningUldah.Scene00030( player );
@ -75,7 +75,7 @@ class OpeningUldahDef
def onEnterTerritory( eventId, player, param1, param2) def onEnterTerritory( eventId, player, param1, param2)
{ {
if( player.isFirstLogin() == true ) if( player.getOpeningSequence() == 0 )
{ {
this.Scene00000( player ); this.Scene00000( player );
} }

View file

@ -52,6 +52,7 @@ class ManFst001Def
{ {
if( param2 == 1 ) // accept quest if( param2 == 1 ) // accept quest
{ {
player.setOpeningSequence( 2 );
ManFst001.Scene00001( player ); ManFst001.Scene00001( player );
} }
}); });
@ -115,7 +116,6 @@ class ManFst001Def
this.Scene00004( player ); this.Scene00004( player );
} }
// Script content to be added here....
} }
}; };

View file

@ -1,27 +1,22 @@
RENAME TABLE `dbaccounts` TO `accounts`; ALTER TABLE `charaiteminventory` ADD `container_25` INT(20) NOT NULL AFTER `container_24`,
RENAME TABLE `dbbattlenpc` TO `battlenpc`; ADD `container_26` INT(20) NOT NULL AFTER `container_25`,
RENAME TABLE `dbchara` TO `charabase`; ADD `container_27` INT(20) NOT NULL AFTER `container_26`,
RENAME TABLE `dbcharapcclass` TO `characlass`; ADD `container_28` INT(20) NOT NULL AFTER `container_27`,
RENAME TABLE `dbcharapc` TO `charadetail`; ADD `container_29` INT(20) NOT NULL AFTER `container_28`,
RENAME TABLE `dbcharaitems` TO `charaglobalitem`; ADD `container_30` INT(20) NOT NULL AFTER `container_29`,
RENAME TABLE `dbcharainfoblacklist` TO `charainfoblacklist`; ADD `container_31` INT(20) NOT NULL AFTER `container_30`,
RENAME TABLE `dbcharainfofriendlist` TO `charainfofriendlist`; ADD `container_32` INT(20) NOT NULL AFTER `container_31`,
RENAME TABLE `dbcharainfolinkshell` TO `charainfolinkshell`; ADD `container_33` INT(20) NOT NULL AFTER `container_32`,
RENAME TABLE `dbcharainfoprofile` TO `charainfosearch`; ADD `container_34` INT(20) NOT NULL AFTER `container_33`;
RENAME TABLE `dbcharaitemcrystal` TO `charaitemcrystal`;
RENAME TABLE `dbcharaitemcurrency` TO `charaitemcurrency`;
RENAME TABLE `dbcharaitemmannequin` TO `charaitemgearset`;
RENAME TABLE `dbcharaitembaggage` TO `charaiteminventory`;
RENAME TABLE `dbcharaquest` TO `charaquest`;
RENAME TABLE `dbdiscoveryref` TO `discoveryinfo`;
RENAME TABLE `dbinfolinkshell` TO `infolinkshell`;
RENAME TABLE `dbuniqueiddata` TO `uniqueiddata`;
RENAME TABLE `dbzonemapping` TO `zonemapping`;
RENAME TABLE `dbzonepositions` TO `zonepositions`;
RENAME TABLE `dbzoneservers` TO `zoneservers`;
ALTER TABLE `charaiteminventory` ADD `container_25` INT(20) NOT NULL AFTER `container_24`, ADD `container_26` INT(20) NOT NULL AFTER `container_25`, ADD `container_27` INT(20) NOT NULL AFTER `container_26`, ADD `container_28` INT(20) NOT NULL AFTER `container_27`, ADD `container_29` INT(20) NOT NULL AFTER `container_28`, ADD `container_30` INT(20) NOT NULL AFTER `container_29`, ADD `container_31` INT(20) NOT NULL AFTER `container_30`, ADD `container_32` INT(20) NOT NULL AFTER `container_31`, ADD `container_33` INT(20) NOT NULL AFTER `container_32`, ADD `container_34` INT(20) NOT NULL AFTER `container_33`; ALTER TABLE `characlass` ADD `Lv_24` INT(5) NOT NULL DEFAULT '0' AFTER `Exp_23`,
ADD `Exp_24` INT(10) NOT NULL DEFAULT '0' AFTER `Lv_24`,
ADD `Lv_25` INT(5) NOT NULL DEFAULT '0' AFTER `Exp_24`,
ADD `Exp_25` INT(19) NOT NULL DEFAULT '0' AFTER `Lv_25`;
ALTER TABLE `characlass` ADD `Lv_24` INT(5) NOT NULL DEFAULT '0' AFTER `Exp_23`, ADD `Exp_24` INT(10) NOT NULL DEFAULT '0' AFTER `Lv_24`, ADD `Lv_25` INT(5) NOT NULL DEFAULT '0' AFTER `Exp_24`, ADD `Exp_25` INT(19) NOT NULL DEFAULT '0' AFTER `Lv_25`; ALTER TABLE `charadetail` CHANGE `Aetheryte` `Aetheryte` BINARY(16) NULL DEFAULT NULL,
CHANGE `HowTo` `HowTo` BINARY(33) NULL DEFAULT NULL,
CHANGE `Minions` `Minions` BINARY(33) NULL DEFAULT NULL,
CHANGE `Mounts` `Mounts` BINARY(13) NULL DEFAULT NULL;
ALTER TABLE `charadetail` CHANGE `Aetheryte` `Aetheryte` BINARY(16) NULL DEFAULT NULL, CHANGE `HowTo` `HowTo` BINARY(33) NULL DEFAULT NULL, CHANGE `Minions` `Minions` BINARY(33) NULL DEFAULT NULL, CHANGE `Mounts` `Mounts` BINARY(13) NULL DEFAULT NULL; ALTER TABLE `charadetail` CHANGE `OpeningSequence` `OpeningSequence` INT(3) NULL DEFAULT '0';

View file

@ -285,7 +285,7 @@ namespace Core {
HpMp = 0x00000800, HpMp = 0x00000800,
QuestTracker = 0x00001000, QuestTracker = 0x00001000,
NewGame = 0x00002000, NewGame = 0x00002000,
// 0x4000 is missing here OpeningSeq = 0x00004000,
Unlocks = 0x00008000, Unlocks = 0x00008000,
PlayTime = 0x00010000, PlayTime = 0x00010000,
NewAdventurer = 0x00020000, NewAdventurer = 0x00020000,

View file

@ -1605,3 +1605,14 @@ void Core::Entity::Player::setCFPenaltyMinutes( uint32_t minutes )
auto currentTimestamp = Core::Util::getTimeSeconds(); auto currentTimestamp = Core::Util::getTimeSeconds();
setCFPenaltyTimestamp(static_cast< uint32_t >( currentTimestamp + minutes * 60 )); setCFPenaltyTimestamp(static_cast< uint32_t >( currentTimestamp + minutes * 60 ));
} }
uint8_t Core::Entity::Player::getOpeningSequence() const
{
return m_openingSequence;
}
void Core::Entity::Player::setOpeningSequence( uint8_t seq )
{
setSyncFlag( OpeningSeq );
m_openingSequence = seq;
}

View file

@ -124,6 +124,10 @@ public:
void updateQuestsCompleted( uint32_t questId ); void updateQuestsCompleted( uint32_t questId );
/*! remove a quest from the completed quest mask */ /*! remove a quest from the completed quest mask */
void removeQuestsCompleted( uint32_t questId ); void removeQuestsCompleted( uint32_t questId );
/*! get the curent opening sequence */
uint8_t getOpeningSequence() const;
/*! set te current opening sequence */
void setOpeningSequence( uint8_t seq );
bool giveQuestRewards( uint32_t questId, uint32_t optionalChoice ); bool giveQuestRewards( uint32_t questId, uint32_t optionalChoice );
@ -573,6 +577,8 @@ private:
uint8_t m_aetheryte[16]; uint8_t m_aetheryte[16];
uint8_t m_unlocks[64]; uint8_t m_unlocks[64];
uint8_t m_openingSequence;
InventoryPtr m_pInventory; InventoryPtr m_pInventory;
std::map< uint32_t, Event::EventPtr > m_eventMap; std::map< uint32_t, Event::EventPtr > m_eventMap;
std::map< uint32_t, uint8_t > m_playerIdToSpawnIdMap; // maps player to spawn id std::map< uint32_t, uint8_t > m_playerIdToSpawnIdMap; // maps player to spawn id

View file

@ -79,7 +79,8 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
"c.IsNewAdventurer, " "c.IsNewAdventurer, "
"cd.GrandCompany, " "cd.GrandCompany, "
"cd.GrandCompanyRank, " "cd.GrandCompanyRank, "
"cd.CFPenaltyUntil " "cd.CFPenaltyUntil, "
"cd.OpeningSequence "
"FROM charabase AS c " "FROM charabase AS c "
" INNER JOIN charadetail AS cd " " INNER JOIN charadetail AS cd "
" ON c.CharacterId = cd.CharacterId " " ON c.CharacterId = cd.CharacterId "
@ -170,6 +171,8 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
m_cfPenaltyUntil = field[35].getUInt32(); m_cfPenaltyUntil = field[35].getUInt32();
m_openingSequence = field[36].getUInt32();
m_pCell = nullptr; m_pCell = nullptr;
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() ) if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
@ -353,6 +356,11 @@ void Core::Entity::Player::createUpdateSql()
charaDetailSet.insert( " Status = " + std::to_string( static_cast< uint8_t >( getStatus() ) ) ); charaDetailSet.insert( " Status = " + std::to_string( static_cast< uint8_t >( getStatus() ) ) );
} }
if( m_updateFlags & PlayerSyncFlags::OpeningSeq )
{
charaDetailSet.insert( " OpeningSequence = " + std::to_string( static_cast< uint8_t >( getOpeningSequence() ) ) );
}
if( m_updateFlags & PlayerSyncFlags::Quests ) if( m_updateFlags & PlayerSyncFlags::Quests )
{ {
charaDetailSet.insert( " QuestCompleteFlags = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_questCompleteFlags ), 200 ) ) + "')" ); charaDetailSet.insert( " QuestCompleteFlags = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_questCompleteFlags ), 200 ) ) + "')" );

View file

@ -69,7 +69,8 @@ int Core::Scripting::ScriptManager::init()
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::hasQuest ), "hasQuest" ); m_pChaiHandler->add( chaiscript::fun( &Entity::Player::hasQuest ), "hasQuest" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getZoneId ), "getZoneId" ); m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getZoneId ), "getZoneId" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::handleScriptSkill ), "handleScriptSkill" ); m_pChaiHandler->add( chaiscript::fun( &Entity::Player::handleScriptSkill ), "handleScriptSkill" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::getOpeningSequence ), "getOpeningSequence" );
m_pChaiHandler->add( chaiscript::fun( &Entity::Player::setOpeningSequence ), "setOpeningSequence" );
m_pChaiHandler->add( chaiscript::fun( &Core::Event::mapEventActorToRealActor ), "mapActor" ); m_pChaiHandler->add( chaiscript::fun( &Core::Event::mapEventActorToRealActor ), "mapActor" );