Skip to content

Commit

Permalink
Initial commit of the sapphire server
Browse files Browse the repository at this point in the history
  • Loading branch information
Mordred Admin committed Aug 8, 2017
0 parents commit e691d05
Show file tree
Hide file tree
Showing 227 changed files with 40,373 additions and 0 deletions.
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 2.6)
project (Sapphire)

set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})

set(PROJECT_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)

# boost stuff
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
set(Boost_COMPILER "-vc140")
endif()
set(SAPPHIRE_BOOST_VER 1.60.0)
set(SAPPHIRE_BOOST_FOLDER_NAME boost_1_60_0)

include_directories("${PROJECT_INCLUDE_DIR}")
include_directories("${PROJECT_SOURCE_DIR}")

add_subdirectory("src/servers")
add_subdirectory("src/libraries/sapphire/datReader")
37 changes: 37 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
// See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file.
"configurations": [
{
"name": "x86-Debug",
"generator": "Visual Studio 14 2015",
"configurationType" : "Debug",
"buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal"
},
{
"name": "x86-Release",
"generator": "Visual Studio 14 2015",
"configurationType": "Release",
"buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal"
},
{
"name": "x64-Debug",
"generator": "Visual Studio 14 2015 Win64",
"configurationType" : "Debug",
"buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal"
},
{
"name": "x64-Release",
"generator": "Visual Studio 14 2015 Win64",
"configurationType": "Release",
"buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal"
}
]
}
662 changes: 662 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Sapphire - FINAL FANTASY XIV Server Emulator
[![Discord Server](https://img.shields.io/badge/discord-Sapphire-7289DA.svg)](https://discord.gg/KfrZCkx)

![FFXIV Sapphire](http://i.imgur.com/I4bj1tR.png)

Sapphire is a FINAL FANTASY XIV 4.0+ Server Emulator currently in development.

## Features

* Fully working base world servers, including character creation, chat, player interaction, etc.
* Basic action/battle system
* Teleports, discovery
* NPCs, enemies
* Support for most Quest types(instanced content planned, to be added later)
* Content scripting via ChaiScript
* Retail GM commands working

## Dependencies + Compiling
Sapphire requires the following software:

| *Name* | *Windows* | *Linux* |
| ------ | --------- | ------- |
| CMake 2.6+ and C++14 capable compiler | [Visual Studio 2017](https://www.visualstudio.com/) | Your favorite C++14 capable compiler |
| Boost 1.63.0 | [Win32 precompiled binaries](https://sourceforge.net/projects/boost/files/boost-binaries/1.63.0/boost_1_63_0-msvc-14.0-32.exe/download) | Boost libraries from your distribution's package manager |
| MySQL Server 5.7 | [Official Site](https://dev.mysql.com/downloads/mysql/) | MySQL server from your distribution's package manager |
| C# Compiler(used for various tools) | [Visual Studio 2017](https://www.visualstudio.com/) \| [Mono](http://www.mono-project.com/) | [Mono](http://www.mono-project.com/) from your distribution's package manager |

**Windows**
Set the environment variables ``BOOST_ROOT_DIR`` and ``BOOST_LIB_DIR`` to ``[boost main folder]`` and ``[boost main folder]/lib32-msvc-14.0`` respectively **or** copy your boost installation into the project's ``src/lib`` folder.
* In *Visual Studio 2017*: Open the project via ``File`` > ``Open`` > ``Folder`` and wait, till CMake automatically finishes cache generation. Right click any CMakeLists.txt and select build to build a application.
To configure debug startup parameters, select ``Debug and Launch settings``, the application you want to set up parameters for, and add a ``args`` json array containing your launch parameters in ``configurations``.
If Visual Studio fails to generate a CMake Cache or does not show options to build, make sure that the newest version of it is installed and all environment variables are set correctly. Keep in mind that generating a cache can take a while on some machines.
* In *Visual Studio 2015*: Generate a Visual Studio project via CMake: ``cmake -G "Visual Studio 14 2015"`` and open it as a normal solution in Visual Studio.

**Linux**
Generate a cache with CMake and use your favorite C++14 capable compiler to compile those wonderful lines of code into binaries with ``make``.
Sapphire is **not** currently configured to compile in 64bit. Make sure that all libraries have their ``:i386`` versions installed.

## Links

* [Sapphire on YouTube](https://www.youtube.com/channel/UCJKYuovoGsq7PxSAfrNJKbw)

Final Fantasy XIV © 2010-2017 SQUARE ENIX CO., LTD. All Rights Reserved. We are not affiliated with SQUARE ENIX CO., LTD. in any way.
27 changes: 27 additions & 0 deletions bin/config/settings_lobby.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Settings>
<General>
<!-- Port the lobby server accepts client connections on -->
<ListenPort>54994</ListenPort>
<AuthPort>54998</AuthPort>
<!-- Ip the lobby server listens on -->
<ListenIp>127.0.0.1</ListenIp>
<!-- Path of FFXIV dat files -->
<DataPath>C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv</DataPath>
<!-- IP of the world server -->
<ZoneIp>127.0.0.1</ZoneIp>
<!-- Port the world server listens for clients -->
<ZonePort>54992</ZonePort>
<!-- Address to connect to the rest server -->
<RestHost>127.0.0.1:8080</RestHost>
<!-- Secret for server authentication -->
<ServerSecret>default</ServerSecret>
<!-- Connection settings for the mysql db -->
<Mysql>
<Host>127.0.0.1</Host>
<Port>3306</Port>
<Username>root</Username>
<Pass></Pass>
<Database>sapphire</Database>
</Mysql>
</General>
</Settings>
26 changes: 26 additions & 0 deletions bin/config/settings_rest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Settings>
<General>
<!-- Port the lobby server accepts client connections on -->
<ListenPort>54994</ListenPort>
<AuthPort>54998</AuthPort>
<!-- Ip the lobby server listens on -->
<ListenIp>127.0.0.1</ListenIp>
<!-- Path of FFXIV dat files -->
<DataPath>C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv</DataPath>
<!-- IP of the lobby server -->
<LobbyHost>127.0.0.1</LobbyHost>
<!-- IP of the frontier server -->
<FrontierHost>127.0.0.1</FrontierHost>
<!-- Secret used for server auth -->
<ServerSecret>default</ServerSecret>
<!-- Web server port -->
<HttpPort>8080</HttpPort>
<Mysql>
<Host>127.0.0.1</Host>
<Port>3306</Port>
<Username>root</Username>
<Pass></Pass>
<Database>sapphire</Database>
</Mysql>
</General>
</Settings>
22 changes: 22 additions & 0 deletions bin/config/settings_zone.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Settings>

<General>
<!-- ID of this server -->
<ServerId>100</ServerId>
<!-- Port the zone server accepts game conenctions on -->
<ListenPort>54992</ListenPort>
<!-- Ip the zone server conenctions on -->
<ListenIp>127.0.0.1</ListenIp>
<!-- Path of FFXIV dat files -->
<DataPath>C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv</DataPath>
<!-- Connection settings for the mysql db -->
<Mysql>
<Host>127.0.0.1</Host>
<Port>3306</Port>
<Username>root</Username>
<Pass></Pass>
<Database>sapphire</Database>
</Mysql>
</General>

</Settings>
Binary file added bin/libmysql.dll
Binary file not shown.
61 changes: 61 additions & 0 deletions bin/scripts/chai/CmnDefCutSceneReplay.chai_outdated
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// This is an automatically generated chai script template
// Content needs to be added by hand to make it function
// In order for this script to be loaded, change its extension to .chai


// Quest Script: SubFst004_00027
// Quest Name: Preserving the Past
// Quest ID: 65563
// Start NPC: 1000194
// End NPC: 1000789

class CmnDefCutSceneReplayDef
{
// Basic quest information
var quest_name
var quest_id

// These are the quest vars / flags used in this quest
// GetQuestUI8AL
// GetQuestUI8BH

// Available Scenes in this quest, not necessarly all are used
attr onScene00000;

// Quest rewards
var RewardExpFactor;
var RewardItem;
var RewardItemCount;

// Entities found in the script data of the quest
// some of these may be useful
var ACTOR0;
var ACTOR1;
var ACTOR2;
var ITEM0;

def CmnDefCutSceneReplayDef()
{

}

def Scene00000( player, eventId, flags, unk, unk1 )
{
player.eventPlay(eventId, 0, 0x2000, unk, 1,
fun( player, eventId, subEvent, param1, param2, param3 )
{
player.eventFinish(eventId, 1);
} );
}

};


def CmnDefCutSceneReplay_START(player, actorId, eventId)
{
var quest = CmnDefCutSceneReplay();
var actor = mapActor( actorId );

player.eventStart( actorId, eventId, 1, 0, 0 );
CmnDefCutSceneReplay.Scene00000( player, eventId, 0, 0, 0 );
}
57 changes: 57 additions & 0 deletions bin/scripts/chai/aetheryte/Aethernet.chai
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//Aethernet - Aetheryte

class AethernetDef
{

def AethernetDef()
{
this.AetheryteBaseId = 0x50000;
this.AETHERYTE_MENU_AETHERNET = 1;
this.AETHERYTE_MENU_HOUSING = 2;
this.AETHERYTE_MENU_HOME_POINT = 3;
this.AETHERYTE_MENU_FAVORITE_POINT = 4;
this.AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN = 5;
}

def onTalk( eventId, player, actorId )
{
var actor = mapActor( actorId );

if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
{
player.eventPlay( eventId, 2, NONE,
fun ( player, eventId, param1, param2, param3 )
{
var aetherId = eventId & 0xFFFF;

if ( param1 == 256 ) // aethernet
{
//player.setTeleporting( true );
player.teleport( param2, 2 );
}
} );
}
else
{
var ACTION_ATTUNE = 0x13;
player.eventActionStart( eventId,
ACTION_ATTUNE,
// callback function for finished casting
fun ( player, eventId, additional )
{

var aetherId = eventId & 0xFFFF;
player.aetheryteRegister( aetherId );
player.eventPlay( eventId, 3, 0, 0, 0);

},
// callback for interrupted action.
fun ( player, eventId, additional ){},
0);
player.unlock();

}

}
}
GLOBAL Aethernet = AethernetDef();
71 changes: 71 additions & 0 deletions bin/scripts/chai/aetheryte/Aetheryte.chai
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//Aethernet - Aetheryte

class AetheryteDef
{

def AetheryteDef()
{
this.AetheryteBaseId = 0x50000;
this.AETHERYTE_MENU_AETHERNET = 1;
this.AETHERYTE_MENU_HOUSING = 2;
this.AETHERYTE_MENU_HOME_POINT = 3;
this.AETHERYTE_MENU_FAVORITE_POINT = 4;
this.AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN = 5;
}

def onTalk( eventId, player, actorId )
{
if( player.isAetheryteRegistered( eventId & 0xFFFF ) )
{
player.eventPlay( eventId, 0, 1,
fun ( player, eventId, param1, param2, param3 )
{
var aetherId = eventId & 0xFFFF;

if ( param1 == 256 ) // set homepoint
{
player.setHomepoint( aetherId );
player.questMessage( eventId, 2, 0xEA, 0, 0);
}
else if ( param1 == 512 && param2 == 4 ) // aethernet
{
player.setTeleporting( true );
player.teleport( param3, 2 );
}

} );
}
else
{
var ACTION_ATTUNE = 0x13;
player.eventActionStart(eventId,
ACTION_ATTUNE,
// callback function for finished casting
fun ( player, eventId, additional )
{
var aetherId = eventId & 0xFFFF;
player.aetheryteRegister(aetherId);

// check if teleport is already unlocked
if( player.isActionLearned( 4 ) )
{
player.questMessage( eventId, 0, 2, 0, 0);
}
else
{
player.questMessage( eventId, 0, 1, 1, 0);
player.learnAction( 4 );
}
},
// callback for interrupted action.
fun ( player, eventId, additional )
{
},
0);
player.unlock();
}

}
}

GLOBAL Aetheryte = AetheryteDef();
Loading

0 comments on commit e691d05

Please sign in to comment.