1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 22:57:45 +00:00

Merge remote-tracking branch 'origin/develop' into packet_work

Conflicts:
	src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp
	src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp
This commit is contained in:
Mordred Admin 2018-07-03 09:32:14 +02:00
commit b2aeed0f8a
42 changed files with 1037 additions and 228 deletions

5
.gitignore vendored
View file

@ -117,4 +117,7 @@ src/servers/Scripts/*/ScriptLoader.cpp
# cotire generated files/folders
cotire/
*_cotire.cmake
*_cotire.cmake
*objects.txt
*exports.def

View file

@ -2,7 +2,7 @@
Host = 127.0.0.1
Port = 3306
Database = sapphire
Username = sapphire
Username = root
Password =
SyncThreads = 2
AsyncThreads = 2
@ -12,6 +12,7 @@ ServerSecret = default
DataPath = C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack
[GlobalNetwork]
; Values definining how Users and other servers will access - these have to be set to your public IP when running a public server
ZoneHost = 127.0.0.1
ZonePort = 54992

View file

@ -1,4 +1,8 @@
[Lobby]
WorldID = 67
AllowNoSessionConnect = false
WorldName = Sapphire
WorldName = Sapphire
[LobbyNetwork]
ListenIp = 0.0.0.0
ListenPort = 54994

View file

@ -1,2 +1,6 @@
[CharacterCreation]
DefaultGMRank = 255
DefaultGMRank = 255
[RestNetwork]
ListenIp = 0.0.0.0
ListenPort = 80

View file

@ -9,6 +9,10 @@ HotSwap = true
[Network]
DisconnectTimeout = 20
[ZoneNetwork]
ListenIp = 0.0.0.0
ListenPort = 54992
[General]
; Sent on login - each line must be shorter than 307 characters, split lines with ';'
MotD = Welcome to Sapphire!;This is a very good server;You can change these messages by editing General.MotD in config/zone.ini

View file

@ -0,0 +1,15 @@
#include <Script/NativeScriptApi.h>
#include "../ScriptObject.h"
#include <Actor/Player.h>
class ActionReturn6 : public ActionScript
{
public:
ActionReturn6() : ActionScript( 6 )
{}
void onCastFinish( Core::Entity::Player& player, Core::Entity::Chara& targetActor ) override
{
player.returnToHomepoint();
}
};

View file

@ -1,5 +1,4 @@
#include <Script/NativeScriptApi.h>
#include "../ScriptObject.h"
#include <ScriptObject.h>
#include <Actor/Player.h>
class ActionSprint3 : public ActionScript

View file

@ -1,5 +1,4 @@
#include "Script/NativeScriptApi.h"
#include "../ScriptObject.h"
#include <ScriptObject.h>
#include <Actor/Player.h>
#define ACTION_ATTUNE 0x13

View file

@ -1,5 +1,4 @@
#include <Script/NativeScriptApi.h>
#include "../ScriptObject.h"
#include <ScriptObject.h>
#include <Actor/Player.h>

View file

@ -1,5 +1,4 @@
#include <Script/NativeScriptApi.h>
#include "../ScriptObject.h"
#include <ScriptObject.h>
#include <Actor/Player.h>
class CmnDefCutSceneReplay : public EventScript

View file

@ -1,5 +1,4 @@
#include <Script/NativeScriptApi.h>
#include "../ScriptObject.h"
#include <ScriptObject.h>
#include <Actor/Player.h>
class CmnDefInnBed : public EventScript

View file

@ -1,5 +1,4 @@
#include <Script/NativeScriptApi.h>
#include "../ScriptObject.h"
#include <ScriptObject.h>
#include <Actor/Player.h>
#define ACTION_CREATE 2

View file

@ -1,5 +1,4 @@
#include <Script/NativeScriptApi.h>
#include "../ScriptObject.h"
#include <ScriptObject.h>
#include <Actor/Player.h>
class HouFurOrchestrion : public EventScript

View file

@ -1,4 +1,3 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include <ScriptObject.h>

View file

@ -1,4 +1,3 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include <ScriptObject.h>

View file

@ -1,4 +1,3 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include <ScriptObject.h>

View file

@ -1,7 +1,6 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include <sapphire_zone/Event/EventHandler.h>
#include "../ScriptObject.h"
#include <ScriptObject.h>
#include "Event/EventHelper.h"
// Quest Script: ManFst001_00039

View file

@ -1,8 +1,7 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include <sapphire_zone/Event/EventHandler.h>
#include "Event/EventHelper.h"
#include "../ScriptObject.h"
#include <ScriptObject.h>
// Quest Script: ManFst002_00124
// Quest Name: Close to Home

View file

@ -1,7 +1,6 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "../ScriptObject.h"
#include <ScriptObject.h>
// Quest Script: ManFst003_00123
// Quest Name: Close to Home
@ -11,15 +10,238 @@
class ManFst003 : public EventScript
{
private:
private:
// Basic quest information
// Quest vars / flags used
// GetQuestBitFlag8
// GetQuestUI8AL
// GetQuestUI8BH
// GetQuestUI8BL
// GetQuestUI8CH
enum Sequence : uint8_t
{
Seq0 = 0,
Seq1 = 1,
SeqFinish = 255,
};
public:
ManFst003() : EventScript( 65659 )
{}
// Quest rewards
static constexpr auto RewardExpFactor = 100;
static constexpr auto RewardGil = 107;
// Entities found in the script data of the quest
static constexpr auto Actor0 = 1001140;
static constexpr auto Actor1 = 2;
static constexpr auto Actor2 = 1000197;
static constexpr auto Actor20 = 1000159;
static constexpr auto Actor3 = 1000768;
static constexpr auto Actor4 = 1000100;
static constexpr auto BindActor0 = 6229224;
static constexpr auto Item0 = 2000119;
static constexpr auto LocActor0 = 1003159;
static constexpr auto LocMarker01 = 2153091;
static constexpr auto LocMarker02 = 2153104;
static constexpr auto LocMarker03 = 2153111;
static constexpr auto LocMarker04 = 2154539;
static constexpr auto LocMarker05 = 2154540;
static constexpr auto LocMarker06 = 2154541;
static constexpr auto LocMarker07 = 2210446;
static constexpr auto LocMarker08 = 2210454;
static constexpr auto LocMarker09 = 2210461;
static constexpr auto LocMotion0 = 799;
static constexpr auto Poprange0 = 2280858;
static constexpr auto RewardDesion = 1;
static constexpr auto Seq0Actor0 = 0;
static constexpr auto Seq0Actor0Lq = 50;
static constexpr auto Seq1Actor0 = 4;
static constexpr auto Seq1Actor1 = 1;
static constexpr auto Seq1Actor1Wait = 51;
static constexpr auto Seq1Actor2 = 2;
static constexpr auto Seq1Actor3 = 3;
static constexpr auto Seq1Actor3Npctradeno = 99;
static constexpr auto Seq1Actor3Npctradeok = 100;
static constexpr auto Seq2Actor4 = 5;
static constexpr auto Territorytype0 = 132;
static constexpr auto UnlockDesion = 14;
public:
ManFst003() : EventScript( 65659 ){};
~ManFst003(){};
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{
Scene00000( player );
}
else if( actor == Actor1 )
{
player.eventActionStart( 0x050002, 0x13,
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
player.sendQuestMessage( 0x050002, 0, 1, 0, 0 );
player.registerAetheryte( 2 );
player.learnAction( 1 );
Scene00051( player );
},
nullptr, eventId );
}
else if( actor == Actor2 )
{
Scene00002( player );
}
else if( actor == Actor3 )
{
Scene00003( player );
}
else if( actor == Actor4 )
{
Scene00005( player );
}
}
};
private:
void checkQuestCompletion( Entity::Player& player, uint32_t varIdx )
{
if( varIdx == 3 )
{
player.sendQuestMessage( getId(), 1, 0, 0, 0 );
}
else if( varIdx == 2 )
{
player.sendQuestMessage( getId(), 2, 0, 0, 0 );
}
else
{
player.sendQuestMessage( getId(), 0, 0, 0, 0 );
}
auto questId = getId();
auto QUEST_VAR_ATTUNE = player.getQuestUI8AL( questId );
auto QUEST_VAR_CLASS = player.getQuestUI8BH( questId );
auto QUEST_VAR_TRADE = player.getQuestUI8BL( questId );
if( QUEST_VAR_ATTUNE == 1 && QUEST_VAR_CLASS == 1 && QUEST_VAR_TRADE == 1 )
{
player.updateQuest( questId, 255 );
}
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
{
Scene00050( player );
}
} );
}
void Scene00001( Entity::Player& player )
{
player.playScene( getId(), 1, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.setQuestUI8AL( getId(), 1 );
checkQuestCompletion( player, 0 );
} );
}
void Scene00002( Entity::Player& player )
{
player.playScene( getId(), 2, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.setQuestUI8BH( getId(), 1 );
checkQuestCompletion( player, 3 );
} );
}
void Scene00003( Entity::Player& player )
{
player.playScene( getId(), 3, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
{
Scene00100( player );
}
else
{
Scene00099( player );
}
} );
}
void Scene00004( Entity::Player& player )
{
player.playScene( getId(), 4, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.playScene( getId(), 4, 0, 0, 0 );
} );
}
void Scene00005( Entity::Player& player )
{
player.playScene( getId(), 5, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
{
if( player.giveQuestRewards( getId(), 0 ) )
{
player.finishQuest( getId() );
}
}
} );
}
void Scene00050( Entity::Player& player )
{
player.playScene( getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.updateQuest( getId(), 1 );
player.setQuestUI8CH( getId(), 1 );
player.forceZoneing( 132 );
} );
}
void Scene00051( Entity::Player& player )
{
player.playScene( getId(), 51, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
Scene00001( player );
} );
}
void Scene00099( Entity::Player& player )
{
player.playScene( getId(), 99, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
Scene00004( player );
} );
}
void Scene00100( Entity::Player& player )
{
player.playScene( getId(), 100, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.setQuestUI8CH( getId(), 0 );
player.setQuestUI8BL( getId(), 1 );
checkQuestCompletion( player, 2 );
} );
}
};

View file

@ -1,4 +1,3 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include <ScriptObject.h>

View file

@ -1,4 +1,3 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include <ScriptObject.h>

View file

@ -1,7 +1,6 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "../ScriptObject.h"
#include <ScriptObject.h>
// Quest Script: ManSea002_00108
// Quest Name: Close to Home
@ -33,122 +32,162 @@ private:
static constexpr auto SCREENIMAGE0 = 14;
static constexpr auto UNLOCK_DESION = 14;
void Scene00000( Entity::Player& player )
{
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 ) // accept quest
Scene00050( player );
};
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
}
void Scene00001( Entity::Player& player )
{
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
{
};
player.playScene( getId(), 1, NONE, callback );
}
void Scene00002( Entity::Player& player )
{
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
{
};
player.playScene( getId(), 2, NONE, callback );
}
void Scene00003( Entity::Player& player )
{
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
{
};
player.playScene( getId(), 3, NONE, callback );
}
void Scene00004( Entity::Player& player )
{
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
{
};
player.playScene( getId(), 4, NONE, callback );
}
void Scene00005( Entity::Player& player )
{
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
{
};
player.playScene( getId(), 5, NONE, callback );
}
void Scene00006( Entity::Player& player )
{
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
{
};
player.playScene( getId(), 6, NONE, callback );
}
void Scene00007( Entity::Player& player )
{
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
{
};
player.playScene( getId(), 7, NONE, callback );
}
void Scene00008( Entity::Player& player )
{
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
{
};
player.playScene( getId(), 8, NONE, callback );
}
void Scene00050( Entity::Player& player )
{
auto callback = [&]( Entity::Player& player, const Event::SceneResult& result )
{
// on quest accept
player.updateQuest( getId(), 1 );
player.setQuestUI8CH( getId(), 1 ); // receive key item
// teleport to real limsa
player.forceZoneing( 128 );
};
player.playScene( getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI, 0, 0, callback );
}
public:
ManSea002() : EventScript( 65644 )
{}
~ManSea002()
{};
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
// todo: this doesn't actually play a cutscene after accepting the quest
if( actor == ACTOR0 )
{
Scene00000( player );
}
else if( actor == AETHERYTE0 )
{
player.eventActionStart( 0x050002, 0x13,
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
player.sendQuestMessage( 0x050002, 0, 1, 0, 0 );
player.registerAetheryte( 2 );
player.learnAction( 1 );
Scene00002( player );
},
nullptr, eventId );
}
else if( actor == ACTOR1 )
{
Scene00004( player );
}
else if( actor == ACTOR2 )
{
Scene00006( player );
}
else if( actor == ACTOR3 )
{
Scene00007( player );
}
}
private:
void checkQuestCompletion( Entity::Player& player, uint32_t varIdx )
{
if( varIdx == 1 )
{
player.sendQuestMessage( getId(), 1, 0, 0, 0 );
}
else if( varIdx == 2 )
{
player.sendQuestMessage( getId(), 2, 0, 0, 0 );
}
else
{
player.sendQuestMessage( getId(), 0, 0, 0, 0 );
}
auto questId = getId();
auto QUEST_VAR_ATTUNE = player.getQuestUI8AL( questId );
auto QUEST_VAR_CLASS = player.getQuestUI8BH( questId );
auto QUEST_VAR_TRADE = player.getQuestUI8BL( questId );
if ( QUEST_VAR_ATTUNE == 1 && QUEST_VAR_CLASS == 1 && QUEST_VAR_TRADE == 1 )
{
player.updateQuest( questId, SEQ_FINISH );
}
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if (result.param2 == 1)
{
Scene00001(player);
}
} );
}
void Scene00001( Entity::Player& player )
{
player.playScene( getId(), 1, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.updateQuest( getId(), 1 );
player.setQuestUI8CH( getId(), 1 );
} );
}
void Scene00002( Entity::Player& player )
{
player.playScene( getId(), 2, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
Scene00003( player );
} );
}
void Scene00003( Entity::Player& player )
{
player.playScene( getId(), 3, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.setQuestUI8BL( getId(), 1 );
checkQuestCompletion( player, 0 );
} );
}
void Scene00004( Entity::Player& player )
{
player.playScene( getId(), 4, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
{
Scene00005( player );
}
else return;
} );
}
void Scene00005( Entity::Player& player )
{
player.playScene( getId(), 5, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ, 0, 0,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.setQuestUI8CH( getId(), 0 );
player.setQuestUI8BH( getId(), 1 );
checkQuestCompletion( player, 1 );
} );
}
void Scene00006( Entity::Player& player )
{
player.playScene( getId(), 6, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.setQuestUI8AL( getId(), 1 );
checkQuestCompletion( player, 2 );
} );
}
void Scene00007( Entity::Player& player )
{
player.playScene( getId(), 7, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ, 0, 0,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if ( result.param2 == 1 )
{
if (player.giveQuestRewards( getId(), 0 ) )
{
player.finishQuest( getId() );
}
}
} );
}
};

View file

@ -0,0 +1,208 @@
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include <ScriptObject.h>
// Quest Script: ManSea003_00109
// Quest Name: Close to Home
// Quest ID: 65645
// Start NPC: 1002697
// End NPC: 1000972
class ManSea003 : public EventScript
{
private:
// Basic quest information
// Quest vars / flags used
// GetQuestBitFlag8
// GetQuestUI8AL
// GetQuestUI8BH
// GetQuestUI8BL
// GetQuestUI8CH
enum Sequence : uint8_t
{
Seq0 = 0,
Seq1 = 1,
SeqFinish = 255,
};
// Quest rewards
static constexpr auto RewardExpFactor = 100;
static constexpr auto RewardGil = 107;
// Entities found in the script data of the quest
static constexpr auto Actor0 = 1002697;
static constexpr auto Actor1 = 1001217;
static constexpr auto Actor2 = 1000895;
static constexpr auto Actor3 = 1000972;
static constexpr auto Aetheryte0 = 8;
static constexpr auto BindActor0 = 6229226;
static constexpr auto Item0 = 2000105;
static constexpr auto LocActor1 = 1001023;
static constexpr auto LocFace0 = 604;
static constexpr auto LocFace1 = 605;
static constexpr auto LocPosCam1 = 4106696;
static constexpr auto LocPosCam2 = 4106698;
static constexpr auto Reward0 = 1;
static constexpr auto Screenimage0 = 14;
static constexpr auto UnlockDesion = 14;
public:
ManSea003() : EventScript( 65645 )
{};
~ManSea003()
{};
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0)
{
Scene00000( player );
}
else if( actor == Aetheryte0 )
{
player.eventActionStart( 0x050002, 0x13,
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
player.sendQuestMessage( 0x050002, 0, 1, 0, 0 );
player.registerAetheryte( 2 );
player.learnAction( 1 );
Scene00002( player );
},
nullptr, eventId );
}
else if( actor == Actor1 )
{
Scene00004( player );
}
else if( actor == Actor2 )
{
Scene00006( player );
}
else if( actor == Actor3 )
{
Scene00007( player );
}
}
private:
void checkQuestCompletion( Entity::Player& player, uint32_t varIdx )
{
if( varIdx == 1 )
{
player.sendQuestMessage( getId(), 1, 0, 0, 0 );
}
else if( varIdx == 2 )
{
player.sendQuestMessage( getId(), 2, 0, 0, 0 );
}
else
{
player.sendQuestMessage( getId(), 0, 0, 0, 0 );
}
auto questId = getId();
auto QUEST_VAR_ATTUNE = player.getQuestUI8AL( questId );
auto QUEST_VAR_CLASS = player.getQuestUI8BH( questId );
auto QUEST_VAR_TRADE = player.getQuestUI8BL( questId );
if( QUEST_VAR_ATTUNE == 1 && QUEST_VAR_CLASS == 1 && QUEST_VAR_TRADE == 1 )
{
player.updateQuest( questId, 255 );
}
}
void Scene00000( Entity::Player& player)
{
player.playScene( getId(), 0, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if (result.param2 == 1)
{
Scene00001(player);
}
} );
}
void Scene00001( Entity::Player& player)
{
player.playScene( getId(), 1, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.updateQuest( getId(), 1 );
player.setQuestUI8CH( getId(), 1 );
} );
}
void Scene00002( Entity::Player& player)
{
player.playScene( getId(), 2, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
Scene00003( player );
} );
}
void Scene00003( Entity::Player& player)
{
player.playScene( getId(), 3, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.setQuestUI8BL( getId(), 1 );
checkQuestCompletion( player, 0 );
} );
}
void Scene00004( Entity::Player& player)
{
player.playScene( getId(), 4, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
{
Scene00005( player );
}
else return;
} );
}
void Scene00005( Entity::Player& player)
{
player.playScene( getId(), 5, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ, 0, 0,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.setQuestUI8CH( getId(), 0 );
player.setQuestUI8BH( getId(), 1 );
checkQuestCompletion( player, 1 );
} );
}
void Scene00006( Entity::Player& player)
{
player.playScene( getId(), 6, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.setQuestUI8AL( getId(), 1 );
checkQuestCompletion( player, 2 );
} );
}
void Scene00007( Entity::Player& player)
{
player.playScene( getId(), 7, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ, 0, 0,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
{
if(player.giveQuestRewards( getId(), 0 ) )
{
player.finishQuest( getId() );
}
}
} );
}
};

View file

@ -1,7 +1,6 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "../ScriptObject.h"
#include <ScriptObject.h>
// Quest Script: ManWil001_00594
// Quest Name: Coming to Ul'dah

View file

@ -1,7 +1,6 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "../ScriptObject.h"
#include <ScriptObject.h>
// Quest Script: ManWil002_00568
// Quest Name: Close to Home

View file

@ -1,7 +1,6 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "../../../ScriptObject.h"
#include <ScriptObject.h>
// Quest Script: SubFst001_00024
// Quest Name: Coarse Correspondence

View file

@ -1,7 +1,6 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "../../../ScriptObject.h"
#include <ScriptObject.h>
// Quest Script: SubFst002_00025
// Quest Name: Quarrels with Squirrels

View file

@ -1,7 +1,6 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "../../../ScriptObject.h"
#include <ScriptObject.h>
// Quest Script: SubFst010_00001
// Quest Name: A Good Adventurer Is Hard to Find

View file

@ -1,7 +1,6 @@
#include <Script/NativeScriptApi.h>
#include <ScriptObject.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "../../../ScriptObject.h"
// Quest Script: SubFst013_00040
// Quest Name: For Friendship

View file

@ -0,0 +1,336 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include <ScriptObject.h>
// Quest Script: SubSea001_00111
// Quest Name: Making a Name
// Quest ID: 65647
// Start NPC: 1002698
// End NPC: 1003604
class SubSea001 : public EventScript
{
private:
// Basic quest information
// Quest vars / flags used
// GetQuestBitFlag8
// GetQuestUI8AL
// GetQuestUI8BH
enum Sequence : uint8_t
{
Seq0 = 0,
Seq1 = 1,
Seq2 = 2,
SeqFinish = 255,
};
// Quest rewards
static constexpr auto RewardExpFactor = 50;
static constexpr auto RewardItem = 4551;
static constexpr auto RewardItemCount = 2;
// Entities found in the script data of the quest
static constexpr auto Actor0 = 1002698;
static constexpr auto Actor1 = 1000969;
static constexpr auto Actor2 = 1003604;
static constexpr auto Eobject0 = 2001563;
static constexpr auto Eobject1 = 2001564;
static constexpr auto Eobject2 = 2001565;
static constexpr auto Eobject3 = 2001566;
static constexpr auto Eobject4 = 2001567;
static constexpr auto Eobject5 = 2001568;
static constexpr auto EventActionProcess = 14;
static constexpr auto Item0 = 2000447;
static constexpr auto Poprange0 = 4161445;
static constexpr auto Quest0 = 65644;
static constexpr auto Quest1 = 65645;
static constexpr auto Territorytype0 = 129;
public:
SubSea001() : EventScript(65647)
{};
~SubSea001()
{};
void onTalk(uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto currentCC = player.getQuestUI8AL( getId() );
if( actor == Actor0 )
{
Scene00000( player );
}
else if( actor == Actor1 )
{
Scene00002( player );
}
else if( actor == Actor2 )
{
Scene00016( player );
}
//EOBJECTS CHECK
else if( actor == Eobject0 )
{
player.eventActionStart( getId(), 0x0E,
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
Scene00003( player );
},
nullptr, eventId );
}
else if( actor == Eobject1 )
{
player.eventActionStart( getId(), 0x0E,
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
Scene00005( player );
},
nullptr, eventId );
}
else if( actor == Eobject2 )
{
player.eventActionStart( getId(), 0x0E,
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
Scene00007( player );
},
nullptr, eventId );
}
else if( actor == Eobject3 )
{
player.eventActionStart( getId(), 0x0E,
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
Scene00009( player );
},
nullptr, eventId );
}
else if( actor == Eobject4 )
{
player.eventActionStart( getId(), 0x0E,
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
Scene00011( player );
},
nullptr, eventId );
}
else if( actor == Eobject5 )
{
player.eventActionStart( getId(), 0x0E,
[&]( Entity::Player& player, uint32_t eventId, uint64_t additional )
{
Scene00013( player );
},
nullptr, eventId );
}
};
private:
void checkQuestCompletion( Entity::Player& player )
{
auto currentCC = player.getQuestUI8BH( getId() );
player.sendQuestMessage( getId(), 1, 3, currentCC + 1, 6 );
if( currentCC + 1 >= 6 )
{
player.updateQuest( getId(), SeqFinish );
player.setQuestUI8BH(getId(), currentCC + 1);
player.setQuestUI8AL(getId(), currentCC + 1);
}
else
{
player.setQuestUI8BH( getId(), currentCC + 1 );
player.setQuestUI8AL( getId(), currentCC + 1 );
}
}
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
player.updateQuest( getId(), 1 );
} );
}
void Scene00001( Entity::Player& player )
{
player.playScene( getId(), 1, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
} );
}
void Scene00002( Entity::Player& player )
{
player.playScene( getId(), 2, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if( player.hasQuest( Quest0 ) || player.hasQuest( Quest1 ) )
{
if( result.param2 == 1 )
{
player.updateQuest( getId(), 2 );
player.changePosition( 10, 21, 13, -2 );
player.forceZoneing( Territorytype0 ); // teleport to real limsa
}
}
else return;
} );
}
void Scene00003( Entity::Player& player )
{
player.playScene( getId(), 3, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
Scene00004( player );
} );
}
void Scene00004( Entity::Player& player )
{
player.playScene( getId(), 4, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
checkQuestCompletion( player );
player.setQuestBitFlag8( getId(), 7, true );
} );
}
void Scene00005( Entity::Player& player )
{
player.playScene( getId(), 5, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
Scene00006( player );
} );
}
void Scene00006( Entity::Player& player )
{
player.playScene( getId(), 6, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
checkQuestCompletion( player );
player.setQuestBitFlag8( getId(), 6, true );
} );
}
void Scene00007( Entity::Player& player )
{
player.playScene( getId(), 7, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
Scene00008( player );
} );
}
void Scene00008( Entity::Player& player )
{
player.playScene( getId(), 8, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
checkQuestCompletion( player );
player.setQuestBitFlag8( getId(), 5, true );
} );
}
void Scene00009( Entity::Player& player )
{
player.playScene( getId(), 9, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
Scene00010( player );
} );
}
void Scene00010( Entity::Player& player )
{
player.playScene( getId(), 10, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
checkQuestCompletion( player );
player.setQuestBitFlag8( getId(), 4, true );
} );
}
void Scene00011( Entity::Player& player )
{
player.playScene( getId(), 11, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
Scene00012( player );
} );
}
void Scene00012( Entity::Player& player )
{
player.playScene( getId(), 12, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
checkQuestCompletion( player );
player.setQuestBitFlag8( getId(), 3, true );
} );
}
void Scene00013( Entity::Player& player )
{
player.playScene( getId(), 13, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
Scene00014( player );
} );
}
void Scene00014( Entity::Player& player )
{
player.playScene( getId(), 14, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
checkQuestCompletion( player );
player.setQuestBitFlag8( getId(), 2, true );
} );
}
void Scene00015( Entity::Player& player )
{
player.playScene( getId(), 15, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
player.playScene( getId(), 15, 0, 0, 0 );
} );
}
void Scene00016( Entity::Player& player )
{
player.playScene( getId(), 16, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
{
Scene00017( player );
}
} );
}
void Scene00017( Entity::Player& player )
{
player.playScene( getId(), 17, HIDE_HOTBAR,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if( result.param2 == 1 )
{
if( player.giveQuestRewards( getId(), 0 ) )
player.finishQuest( getId() );
}
} );
}
};

View file

@ -95,12 +95,11 @@ bool loadSettings( int32_t argc, char* argv[] )
if( arg == "ip" )
{
// todo: ip addr in config
m_pConfig->setValue< std::string >( "GlobalNetwork.RestHost", val );
m_pConfig->setValue< std::string >( "RestNetwork.ListenIp", val );
}
else if( arg == "p" || arg == "port" )
{
m_pConfig->setValue< std::string >( "GlobalNetwork.RestPort", val );
m_pConfig->setValue< std::string >( "RestNetwork.ListenPort", val );
}
else if( arg == "exdpath" || arg == "datapath" )
{
@ -164,7 +163,8 @@ bool loadSettings( int32_t argc, char* argv[] )
if( !loader.initDbs() )
return false;
server.config.port = static_cast< uint16_t >( std::stoul( m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort", "80" ) ) );
server.config.port = static_cast< uint16_t >( std::stoul( m_pConfig->getValue< std::string >( "RestNetwork.ListenPort", "80" ) ) );
server.config.address = m_pConfig->getValue< std::string >( "RestNetwork.ListenIp", "0.0.0.0" );
g_log.info( "Database: Connected to " + info.host + ":" + std::to_string( info.port ) );
@ -756,9 +756,6 @@ int main( int argc, char* argv[] )
if( !loadSettings( argc, argv ) )
throw std::exception();
server.config.port = stoi( m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort", "80" ) );
g_log.info( "Starting API server at port " + m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort", "80" ) + "..." );
server.resource["^/ZoneName/([0-9]+)$"]["GET"] = &getZoneName;
server.resource["^/sapphire-api/lobby/createAccount"]["POST"] = &createAccount;
server.resource["^/sapphire-api/lobby/login"]["POST"] = &login;
@ -781,6 +778,8 @@ int main( int argc, char* argv[] )
server.start();
} );
g_log.info( "API server running on " + m_pConfig->getValue< std::string >( "RestNetwork.ListenIp", "0.0.0.0" ) + ":" + m_pConfig->getValue< std::string >( "RestNetwork.ListenPort", "80" ) );
//Wait for server to start so that the client can connect
this_thread::sleep_for( chrono::seconds( 1 ) );

View file

@ -75,7 +75,7 @@ namespace Core {
Network::HivePtr hive( new Network::Hive() );
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive );
g_log.info( "Lobbyserver ready for connections." );
g_log.info( "Lobby server running on " + m_pConfig->getValue< std::string >( "LobbyNetwork.ListenIp", "0.0.0.0" ) + ":" + m_pConfig->getValue< std::string >( "LobbyNetwork.ListenPort", "80" ) );
boost::thread_group worker_threads;
worker_threads.create_thread( boost::bind( &Network::Hive::Run, hive.get() ) );
@ -109,11 +109,11 @@ namespace Core {
if( arg == "ip" )
{
// todo: ip addr in config
m_pConfig->setValue< std::string >( "GlobalNetwork.LobbyHost", val );
m_pConfig->setValue< std::string >( "LobbyNetwork.ListenIp", val );
}
else if( arg == "p" || arg == "port" )
{
m_pConfig->setValue< std::string >( "GlobalNetwork.LobbyPort", val );
m_pConfig->setValue< std::string >( "LobbyNetwork.LobbyPort", val );
}
else if( arg == "worldip" || arg == "worldip" )
{
@ -131,8 +131,8 @@ namespace Core {
}
}
m_port = m_pConfig->getValue< uint16_t >( "GlobalNetwork.LobbyPort", 54994 );
m_ip = m_pConfig->getValue< std::string >( "GlobalNetwork.LobbyHost", "0.0.0.0" );
m_port = m_pConfig->getValue< uint16_t >( "LobbyNetwork.ListenPort", 54994 );
m_ip = m_pConfig->getValue< std::string >( "LobbyNetwork.ListenIp", "0.0.0.0" );
g_restConnector.restHost = m_pConfig->getValue< std::string >( "GlobalNetwork.RestHost" ) + ":" + m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort" );
g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" );

View file

@ -135,6 +135,12 @@ void Core::Entity::Player::setGmInvis( bool invis )
m_gmInvis = invis;
}
bool Core::Entity::Player::isActingAsGm() const
{
auto status = getOnlineStatus();
return status == OnlineStatus::GameMaster || status == OnlineStatus::GameMaster1 || status == OnlineStatus::GameMaster2;
}
uint8_t Core::Entity::Player::getMode() const
{
return m_mode;
@ -160,7 +166,7 @@ bool Core::Entity::Player::isMarkedForRemoval() const
return m_markedForRemoval;
}
Core::Common::OnlineStatus Core::Entity::Player::getOnlineStatus()
Core::Common::OnlineStatus Core::Entity::Player::getOnlineStatus() const
{
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
if( !pExdData )

View file

@ -325,7 +325,7 @@ public:
/*! sets players combat state */
void setInCombat( bool mode );
/*! return current online status depending on current state / activity */
Common::OnlineStatus getOnlineStatus();
Common::OnlineStatus getOnlineStatus() const;
/*! sets the players zone, initiating a zoning process */
void setZone( uint32_t zoneId );
/*! sets the players instance & initiates zoning process */
@ -551,6 +551,8 @@ public:
bool getGmInvis() const;
void setGmInvis( bool invis );
bool isActingAsGm() const;
uint8_t getMode() const;
void setMode( uint8_t mode );

View file

@ -134,7 +134,10 @@ Core::ItemPtr Core::Inventory::createItem( uint32_t catalogId, uint16_t quantity
auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
auto itemInfo = pExdData->get< Core::Data::Item >( catalogId );
uint8_t itemAmount = quantity;
if( !itemInfo )
return nullptr;
uint16_t itemAmount = quantity;
if( itemInfo->stackSize == 1 )
itemAmount = 1;
@ -144,16 +147,14 @@ Core::ItemPtr Core::Inventory::createItem( uint32_t catalogId, uint16_t quantity
uint8_t flags = 0;
// std::string itemName( itemInfo->name );
ItemPtr pItem( new Item( catalogId ) );
ItemPtr pItem = make_Item( getNextUId(),
catalogId,
itemInfo->modelMain,
itemInfo->modelSub );
pItem->setStackSize( itemAmount );
pItem->setUId( getNextUId() );
pItem->setModelIds( itemInfo->modelMain, itemInfo->modelSub );
pItem->setCategory( static_cast< ItemUICategory >( itemInfo->itemUICategory ) );
pDb->execute( "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " +
pDb->execute( "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " +
std::to_string( m_pOwner->getId() ) + ", " +
std::to_string( pItem->getUId() ) + ", " +
std::to_string( pItem->getId() ) + ", " +
@ -161,7 +162,6 @@ Core::ItemPtr Core::Inventory::createItem( uint32_t catalogId, uint16_t quantity
std::to_string( flags ) + ");" );
return pItem;
}
@ -741,13 +741,14 @@ Core::ItemPtr Core::Inventory::loadItem( uint64_t uId )
try
{
auto itemInfo = pExdData->get< Core::Data::Item >( itemRes->getUInt( 1 ) );
bool isHq = itemRes->getUInt( 3 ) == 1 ? true : false;
ItemPtr pItem( new Item( uId,
bool isHq = itemRes->getUInt( 3 ) == 1;
ItemPtr pItem = make_Item( uId,
itemRes->getUInt( 1 ),
itemInfo->modelMain,
itemInfo->modelSub,
static_cast< ItemUICategory >( itemInfo->itemUICategory ),
isHq ) );
isHq );
pItem->setStackSize( itemRes->getUInt( 2 ) );
return pItem;

View file

@ -1,46 +1,31 @@
#include <Common.h>
#include <Exd/ExdDataGenerated.h>
#include <CommonGen.h>
#include "Framework.h"
#include "Item.h"
extern Core::Framework g_fw;
Core::Item::Item()
{
}
Core::Item::Item( uint32_t catalogId ) :
m_id( catalogId ),
m_isHq( false )
{
}
Core::Item::Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t model2, Common::ItemUICategory categoryId, bool isHq ) :
Core::Item::Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t model2, bool isHq ) :
m_id( catalogId ),
m_uId( uId ),
m_category( categoryId ),
m_model1( model1 ),
m_model2( model2 ),
m_isHq( isHq )
{
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
auto itemInfo = pExdData->get< Core::Data::Item >( catalogId );
m_delayMs = itemInfo->delayms;
m_physicalDmg = itemInfo->damagePhys;
m_magicalDmg = itemInfo->damageMag;
m_weaponDmg = ( m_physicalDmg != 0 ) ? m_physicalDmg : m_magicalDmg;
m_autoAttackDmg = static_cast< float >( m_weaponDmg * m_delayMs ) / 3000;
m_category = static_cast< Common::ItemUICategory >( itemInfo->itemUICategory );
m_itemLevel = itemInfo->levelItem;
}
Core::Item::~Item()
{
}
float Core::Item::getAutoAttackDmg() const
{
return m_autoAttackDmg;

View file

@ -9,10 +9,8 @@ class Item
{
public:
Item();
Item( uint32_t catalogId );
Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t model2, Common::ItemUICategory categoryId, bool isHq = false );
~Item();
Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t model2, bool isHq = false );
~Item() = default;
uint32_t getId() const;

View file

@ -451,12 +451,13 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
case GmCommand::TeriInfo:
{
auto pCurrentZone = player.getCurrentZone();
player.sendNotice( "ZoneId: " + std::to_string( player.getZoneId() ) + "\nName: " +
pCurrentZone->getName() + "\nInternalName: " +
pCurrentZone->getInternalName() + "\nPopCount: " +
std::to_string( pCurrentZone->getPopCount() ) +
"\nCurrentWeather:" + std::to_string( static_cast< uint8_t >( pCurrentZone->getCurrentWeather() ) ) +
"\nNextWeather:" + std::to_string( static_cast< uint8_t >( pCurrentZone->getNextWeather() ) ) );
player.sendNotice( "ZoneId: " + std::to_string( player.getZoneId() ) +
"\nName: " + pCurrentZone->getName() +
"\nInternalName: " + pCurrentZone->getInternalName() +
"\nGuId: " + std::to_string( pCurrentZone->getGuId() ) +
"\nPopCount: " + std::to_string( pCurrentZone->getPopCount() ) +
"\nCurrentWeather: " + std::to_string( static_cast< uint8_t >( pCurrentZone->getCurrentWeather() ) ) +
"\nNextWeather: " + std::to_string( static_cast< uint8_t >( pCurrentZone->getNextWeather() ) ) );
break;
}
case GmCommand::Jump:
@ -525,6 +526,7 @@ void Core::Network::GameConnection::gm2Handler( const Packets::FFXIVARR_PACKET_R
targetPlayer->resetHp();
targetPlayer->resetMp();
targetPlayer->setStatus( Entity::Chara::ActorStatus::Idle );
targetPlayer->sendZoneInPackets( 0x01, 0x01, 0, 113, true );
targetPlayer->sendToInRangeSet( boost::make_shared< ActorControlPacket143 >( player.getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
targetPlayer->sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( player.getId(), SetStatus,

View file

@ -523,7 +523,7 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
{
case ChatType::Say:
{
if (player.getGmRank() > 0)
if ( player.isActingAsGm() )
chatPacket->data().chatType = ChatType::GMSay;
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
@ -531,7 +531,7 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
}
case ChatType::Yell:
{
if( player.getGmRank() > 0 )
if( player.isActingAsGm() )
chatPacket->data().chatType = ChatType::GMYell;
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
@ -539,7 +539,7 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
}
case ChatType::Shout:
{
if( player.getGmRank() > 0 )
if( player.isActingAsGm() )
chatPacket->data().chatType = ChatType::GMShout;
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );

View file

@ -85,11 +85,11 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
if( arg == "ip" )
{
// todo: ip addr in config
pConfig->setValue< std::string >( "GlobalNetwork.ZoneIP", val );
pConfig->setValue< std::string >( "ZoneNetwork.ListenIp", val );
}
else if( arg == "p" || arg == "port" )
{
pConfig->setValue< std::string >( "GlobalNetwork.ZonePort", val );
pConfig->setValue< std::string >( "ZoneNetwork.ListenPort", val );
}
else if( arg == "exdpath" || arg == "datapath" )
{
@ -145,8 +145,8 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
if( !loader.initDbs() )
return false;
m_port = pConfig->getValue< uint16_t >( "GlobalNetwork.ZonePort", 54992 );
m_ip = pConfig->getValue< std::string >( "GlobalNetwork.ZoneIP", "0.0.0.0" );
m_port = pConfig->getValue< uint16_t >( "ZoneNetwork.ListenPort", 54992 );
m_ip = pConfig->getValue< std::string >( "ZoneNetwork.ListenIp", "0.0.0.0" );
return true;
}
@ -184,8 +184,7 @@ void Core::ServerZone::run( int32_t argc, char* argv[] )
std::vector< std::thread > thread_list;
thread_list.emplace_back( std::thread( std::bind( &Network::Hive::Run, hive.get() ) ) );
pLog->info( "Server listening on port: " + std::to_string( m_port ) );
pLog->info( "Ready for connections..." );
pLog->info( "Zone server running on " + m_ip + ":" + std::to_string( m_port ) );
mainLoop();

View file

@ -132,7 +132,7 @@ bool Core::TerritoryMgr::createDefaultTerritories()
InstanceIdToZonePtrMap instanceMap;
instanceMap[guid] = pZone;
m_instanceIdToZonePtrMap[guid] = pZone;
m_territoryInstanceMap[territoryId] = instanceMap;
m_territoryIdToInstanceGuidMap[territoryId] = instanceMap;
m_zoneSet.insert( { pZone } );
}
@ -161,8 +161,9 @@ Core::ZonePtr Core::TerritoryMgr::createTerritoryInstance( uint32_t territoryTyp
auto pZone = make_Zone( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name );
pZone->init();
m_territoryInstanceMap[pZone->getTerritoryId()][pZone->getGuId()] = pZone;
m_instanceIdToZonePtrMap[pZone->getGuId()] = pZone;
m_territoryIdToInstanceGuidMap[pZone->getTerritoryId()][pZone->getGuId()] = pZone;
m_zoneSet.insert( { pZone } );
return pZone;
}
@ -205,8 +206,8 @@ bool Core::TerritoryMgr::removeTerritoryInstance( uint32_t instanceId )
m_instanceIdToZonePtrMap.erase( pZone->getGuId() );
if( m_instanceZoneSet.count( pZone ) )
m_instanceZoneSet.erase( pZone );
m_instanceZoneSet.erase( pZone );
m_zoneSet.erase( pZone );
if( isInstanceContentTerritory( pZone->getTerritoryId() ) )
{
@ -214,7 +215,7 @@ bool Core::TerritoryMgr::removeTerritoryInstance( uint32_t instanceId )
m_instanceContentToInstanceMap[instance->getInstanceContentId()].erase( pZone->getGuId() );
}
else
m_territoryInstanceMap[pZone->getTerritoryId()].erase( pZone->getGuId() );
m_territoryIdToInstanceGuidMap[pZone->getTerritoryId()].erase( pZone->getGuId() );
return true;
@ -275,8 +276,8 @@ Core::ZonePositionPtr Core::TerritoryMgr::getTerritoryPosition( uint32_t territo
Core::ZonePtr Core::TerritoryMgr::getZoneByTerriId( uint32_t territoryId ) const
{
auto zoneMap = m_territoryInstanceMap.find( territoryId );
if( zoneMap == m_territoryInstanceMap.end() )
auto zoneMap = m_territoryIdToInstanceGuidMap.find( territoryId );
if( zoneMap == m_territoryIdToInstanceGuidMap.end() )
return nullptr;
// TODO: actually select the proper one

View file

@ -135,7 +135,7 @@ namespace Core
TerritoryTypeDetailCache m_territoryTypeDetailCacheMap;
/*! map holding actual instances of default territories */
TerritoryIdToInstanceMap m_territoryInstanceMap;
TerritoryIdToInstanceMap m_territoryIdToInstanceGuidMap;
/*! map holding actual instances of InstanceContent */
InstanceContentIdToInstanceMap m_instanceContentToInstanceMap;