From 27a800cc5e8209773716cf0c393682e9b246a853 Mon Sep 17 00:00:00 2001 From: Alice Ogeda Date: Fri, 14 Jan 2022 01:34:58 -0300 Subject: [PATCH] expose playermgr() to nativescript; fix friendlist insert on new character; --- src/api/PlayerMinimal.cpp | 5 +++++ src/world/Script/NativeScriptApi.h | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/api/PlayerMinimal.cpp b/src/api/PlayerMinimal.cpp index 41b6c919..cc91b7b3 100644 --- a/src/api/PlayerMinimal.cpp +++ b/src/api/PlayerMinimal.cpp @@ -273,6 +273,11 @@ void PlayerMinimal::saveAsNew() std::vector< uint8_t > friendIds( 1600, 0 ); std::vector< uint8_t > inviteIds( 1600, 0 ); + stmtFriendList->setUInt64( 1, m_characterId ); + stmtFriendList->setBinary( 2, friendIds ); + stmtFriendList->setBinary( 3, inviteIds ); + g_charaDb.directExecute( stmtFriendList ); + // Blacklist related auto stmtBlacklist = g_charaDb.getPreparedStatement( Db::ZoneDbStatements::CHARA_BLACKLIST_INS ); std::vector< uint8_t > blIds( 1600, 0 ); diff --git a/src/world/Script/NativeScriptApi.h b/src/world/Script/NativeScriptApi.h index 87351995..b229801a 100644 --- a/src/world/Script/NativeScriptApi.h +++ b/src/world/Script/NativeScriptApi.h @@ -6,6 +6,7 @@ #include "Event/EventHandler.h" #include "Manager/EventMgr.h" #include "Manager/LinkshellMgr.h" +#include "Manager/PlayerMgr.h" #include "Service.h" #ifdef _MSC_VER @@ -170,6 +171,7 @@ namespace Sapphire::ScriptAPI virtual void onEObjHit( Sapphire::Entity::Player& player, uint64_t actorId, uint32_t actionId ); + World::Manager::EventMgr& eventMgr() { return Common::Service< World::Manager::EventMgr >::ref(); @@ -179,6 +181,11 @@ namespace Sapphire::ScriptAPI { return Common::Service< World::Manager::LinkshellMgr >::ref(); } + + World::Manager::PlayerMgr& playerMgr() + { + return Common::Service< World::Manager::PlayerMgr >::ref(); + } }; class QuestScript : public ScriptObject @@ -229,6 +236,11 @@ namespace Sapphire::ScriptAPI { return Common::Service< World::Manager::EventMgr >::ref(); } + + World::Manager::PlayerMgr& playerMgr() + { + return Common::Service< World::Manager::PlayerMgr >::ref(); + } }; /*! @@ -245,6 +257,11 @@ namespace Sapphire::ScriptAPI { return Common::Service< World::Manager::EventMgr >::ref(); } + + World::Manager::PlayerMgr& playerMgr() + { + return Common::Service< World::Manager::PlayerMgr >::ref(); + } }; /*! @@ -286,6 +303,11 @@ namespace Sapphire::ScriptAPI { return Common::Service< World::Manager::EventMgr >::ref(); } + + World::Manager::PlayerMgr& playerMgr() + { + return Common::Service< World::Manager::PlayerMgr >::ref(); + } }; /*! @@ -313,6 +335,11 @@ namespace Sapphire::ScriptAPI { return Common::Service< World::Manager::EventMgr >::ref(); } + + World::Manager::PlayerMgr& playerMgr() + { + return Common::Service< World::Manager::PlayerMgr >::ref(); + } }; }