Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
Version 0.3.0 from develop.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMaximum authored Jan 10, 2017
2 parents 73eafd1 + 4646fe4 commit 2823ac3
Show file tree
Hide file tree
Showing 87 changed files with 5,006 additions and 438 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ doc/latex/

# Configuration file
config.yaml

# Local build script
localbuild.sh
localmake.sh
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ env:

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.9
- g++-4.9

- doxygen
- doxygen-doc
- doxygen-latex
Expand All @@ -23,6 +28,10 @@ addons:

script:
- ./install.sh

- cmake -DCMAKE_BUILD_TYPE=Debug -H. -Bbuild -DCMAKE_CXX_COMPILER=g++-4.9 -DCMAKE_C_COMPILER=gcc-4.9
- cd ./build
- make

after_success:
- cd $TRAVIS_BUILD_DIR/doc
Expand Down
33 changes: 33 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
0.3.0: Database and ManiaLink support
* Database support (MySQL)
* Includes: maps, players, records, karma, times
* ManiaLink support
* Easy action handling
* Easy-to-use ManiaLink list (UIList)
* Chat command support
* Support for plugin configuration via .yaml-file
* Improved access from plugins to controller features
* Added Jukebox/Map list plugin
* Added Karma plugin
* Karma widget (Eyepiece-style)
* WhoKarma overview
* Added Local Records plugin
* Local Records widget (Eyepiece-style)
* Added Map Widget plugin (Eyepiece-style)

0.2.0: Plugin system
* Plugin system
* (Dynamically) loading shared object files
* CallBack events
* Access to methods, playerlist and maplist
* Proper CallBack handling
* Easy way to call server methods (via Methods)

0.1.0: GbxRemote, request/callback handling
* GbxRemote
* Socket connection with the server
* Send requests and receive responses
* Receive callbacks
* Handling of callbacks
* Keeping playerlist up-to-date
* Reading configuration file
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ add_definitions(-Wno-deprecated)
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
link_directories(${PROJECT_SOURCE_DIR}/lib/yaml/build)
include_directories("${PROJECT_SOURCE_DIR}/lib/yaml/include")
include_directories("${PROJECT_SOURCE_DIR}/lib/json")

set (PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)

set (VERSION_MAJOR 0)
set (VERSION_MINOR 2)
set (VERSION_MINOR 3)
set (VERSION_PATCH 0)

# configure a header file to pass some of the CMake settings
Expand All @@ -27,4 +28,8 @@ file(GLOB_RECURSE SOURCES src/*.cpp)

add_executable(Mania++ ${SOURCES}
lib/pugixml/libpugixml.a)
target_link_libraries(Mania++ yaml-cpp ${EXECUTABLE_OUTPUT_PATH}/lib/pugixml/libpugixml.a dl)
target_link_libraries(Mania++ yaml-cpp
${EXECUTABLE_OUTPUT_PATH}/lib/pugixml/libpugixml.a
dl
mysqlcppconn
curl)
37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,51 @@ Mania++ and its sources are available under the [GNU General Public License v3](
## Tested environments ##
* Ubuntu 16.10 (Linux 4.8.0-30), 64-bit with gcc 6.2.0 (development)
* Ubuntu 16.04.1 LTS (Linux 4.4.0-31), 32-bit with gcc 5.4.0 (testing)
* Ubuntu 14.04.5 LTS (Linux 4.4.0-51), 64-bit with gcc 4.8.4 (Travis)
* Ubuntu 14.04.5 LTS (Linux 4.4.0-51), 64-bit with gcc 4.9.4 (Travis)
* Debian 8.6 (Linux 3.16.0-4), 64-bit with gcc 4.9.2 (production)
* "Bash on Ubuntu 14.04.5 LTS on Windows 10" (Linux 4.4.0-51), 64-bit with gcc 4.9.4 (development)

Mania++ is (currently) not compatible with Windows systems and the ```./install.sh```-script requires a Debian-like system to function (with ```apt-get```).
The ```./install.sh```-script requires a Debian-like system to function (with ```apt-get```). The JSON library requires gcc/g++ v4.9+, the 14.04 LTS only comes with 4.8.4, so you will have to [upgrade the version by hand](http://askubuntu.com/a/456849) and tell the build script that you want to use that version: ```-DCMAKE_CXX_COMPILER=g++-4.9 -DCMAKE_C_COMPILER=gcc-4.9```.

## Requirements ##
* C++11
* Git _(if you want the latest develop)_
* Minimum gcc 4.9 / C++11
* Git
* [CMake](https://cmake.org)

## Aims and working points ##
* [Be comparable or better than standard PhpRemote](https://themaximum.github.io/mania-pp/comparison.html)
* Create more usable objects (f.e. `Record`?)
* Expand usable objects (`Player` and `Map`)
* Working plugin system
* Plugin interface
* Callback handling
* Access to server, database and ManiaLink
* Database support
* ManiaLink support

## Achieved goals ##
* Working GbxRemote module
* Send methods and receive responses
* Receive callbacks
* De-XMLify responses and callbacks
* Create usable objects (f.e. `Player` and `Map`)
* Easy-to-use objects (f.e. `Player` and `Map`)
* Working configuration system (YAML)
* Database support (MySQL)
* ManiaLink support
* ManiaLink handler (`UIManager`)
* Easy use of a ManiaLink list (`UIList`)
* Chat command handling
* Working plugin system
* Plugin interface
* Callback handling
* Access to server, database, playerlist, maplist and ManiaLink
* Chat commands
* Receive settings from configuration file
* _Welcome/goodbye, maplist/jukebox, local records, map karma and mapinfo widget_

## Installing for the first time ##
* ```./install.sh```
* Installs Boost (requirement for yaml-cpp)
* Installs [yaml-cpp](https://github.com/jbeder/yaml-cpp/) 0.5.3
* Installs [pugixml](https://github.com/zeux/pugixml) 1.8.1
* Builds the code (via ```build.sh```)
* Installs [JSON for Modern C++](https://github.com/nlohmann/json) 2.0.10

## Building (updates) ##
## Building ##
* ```./build.sh```
* Move ```config.dist.yaml``` to ```config.yaml```
* Edit the configuration file with the server information
* Edit the configuration file with the server/database information

## Running ##
* ```./Mania++```
Expand Down
29 changes: 29 additions & 0 deletions config.dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,32 @@ config:
authentication:
username: 'SuperAdmin'
password: '***'

database:
address: 'localhost'
port: 3306
authentication:
username: '***'
password: '***'
database: 'maniapp'

program:
checkVersion: true

plugins:
- 'HelloGoodbye'
- 'Jukebox':
skipMapWhenLeft: true
- 'LocalRecords':
limit: 100
widgetEntries: 22
widgetTopCount: 5
widgetX: 49.2
widgetY: 28.2
- 'Karma':
widgetX: 49.2
widgetY: 39.2
voteAfterFinishes: 0
- 'MapWidget':
widgetX: 49.2
widgetY: 48.2
18 changes: 13 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Install Boost and xerces
sudo apt-get -y install libboost-dev
# Install Git, Boost and MySQL
sudo apt-get -y install git libboost-dev libmysqlcppconn-dev libcurl4-openssl-dev

# Go to libraries directory
cd ./lib/
Expand All @@ -18,6 +18,17 @@ make yaml-cpp
# Return to lib directory
cd ../../

# Create and go to JSON directory
mkdir json
cd ./json

# Download version 2.0.10 of the JSON library (remove older/existing version)
rm ./json.hpp
wget https://github.com/nlohmann/json/releases/download/v2.0.10/json.hpp

# Return to lib directory
cd ../

# Download version 1.8.1 of the PugiXML library
git clone https://github.com/zeux/pugixml.git pugixml/
cd pugixml/
Expand All @@ -29,6 +40,3 @@ make

# Return to root directory
cd ../../

# Build project as normal
./build.sh
99 changes: 99 additions & 0 deletions maniapp.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

--
-- Database: `maniapp`
--

-- --------------------------------------------------------

--
-- Tablestructure for table `karma`
--

CREATE TABLE IF NOT EXISTS `karma` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`MapId` mediumint(9) NOT NULL DEFAULT '0',
`PlayerId` mediumint(9) NOT NULL DEFAULT '0',
`Score` tinyint(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`Id`),
UNIQUE KEY `PlayerId` (`PlayerId`,`MapId`),
KEY `MapId` (`MapId`),
KEY `Score` (`Score`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

-- --------------------------------------------------------

--
-- Tablestructure for table `maps`
--

CREATE TABLE IF NOT EXISTS `maps` (
`Id` mediumint(9) NOT NULL AUTO_INCREMENT,
`Uid` varchar(27) NOT NULL DEFAULT '',
`Name` varchar(100) NOT NULL DEFAULT '',
`Author` varchar(30) NOT NULL DEFAULT '',
`Environment` varchar(10) NOT NULL DEFAULT '',
`RoundsJuke` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`Id`),
UNIQUE KEY `Uid` (`Uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

-- --------------------------------------------------------

--
-- Tablestructure for table `players`
--

CREATE TABLE IF NOT EXISTS `players` (
`Id` mediumint(9) NOT NULL AUTO_INCREMENT,
`Login` varchar(50) NOT NULL DEFAULT '',
`NickName` varchar(100) DEFAULT NULL,
`Nation` varchar(150) NOT NULL DEFAULT '',
`UpdatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Wins` mediumint(9) NOT NULL DEFAULT '0',
`TimePlayed` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`Id`),
UNIQUE KEY `Login` (`Login`),
KEY `Nation` (`Nation`),
KEY `Wins` (`Wins`),
KEY `UpdatedAt` (`UpdatedAt`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

-- --------------------------------------------------------

--
-- Tablestructure for table `records`
--

CREATE TABLE IF NOT EXISTS `records` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`MapId` mediumint(9) NOT NULL DEFAULT '0',
`PlayerId` mediumint(9) NOT NULL DEFAULT '0',
`Score` int(11) NOT NULL DEFAULT '0',
`Date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Checkpoints` text NOT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `PlayerId` (`PlayerId`,`MapId`),
KEY `MapId` (`MapId`),
KEY `Score` (`Score`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

-- --------------------------------------------------------

--
-- Tablestructure for table `times`
--

CREATE TABLE IF NOT EXISTS `times` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`MapId` mediumint(9) NOT NULL DEFAULT '0',
`PlayerId` mediumint(9) NOT NULL DEFAULT '0',
`Score` int(11) NOT NULL DEFAULT '0',
`Date` int(10) unsigned NOT NULL DEFAULT '0',
`Checkpoints` text NOT NULL,
PRIMARY KEY (`Id`),
KEY `PlayerId` (`PlayerId`,`MapId`),
KEY `MapId` (`MapId`),
KEY `Score` (`Score`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
14 changes: 8 additions & 6 deletions plugins/HelloGoodbye/src/HelloGoodbyePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@ HelloGoodbyePlugin::HelloGoodbyePlugin()

void HelloGoodbyePlugin::Init()
{
std::cout << "[ INFO ] Current amount of maps: " << maps->size() << std::endl;

}

void HelloGoodbyePlugin::OnPlayerConnect(Player player)
{
std::cout << "PLUGIN Player Connected: " << player.Login << "!" << std::endl;

std::stringstream chatMessage;
chatMessage << "Player joins: ";
chatMessage << "$39fPlayer joins: ";
chatMessage << player.NickName;
chatMessage << " $s$Ladder: ";
chatMessage << " $z$s$39fNation: $fff";
chatMessage << player.Country;
chatMessage << " $z$s$39fLadder: $fff";
chatMessage << player.LadderRanking;

methods->ChatSendServerMessage(chatMessage.str());
controller->Server->ChatSendServerMessage(chatMessage.str());
}

void HelloGoodbyePlugin::OnPlayerDisconnect(Player player)
Expand All @@ -33,7 +35,7 @@ void HelloGoodbyePlugin::OnPlayerDisconnect(Player player)

std::stringstream chatMessage;
chatMessage << player.NickName;
chatMessage << " $s$zhas left the game.";
chatMessage << " $z$s$39fhas left the game.";

methods->ChatSendServerMessage(chatMessage.str());
controller->Server->ChatSendServerMessage(chatMessage.str());
}
20 changes: 20 additions & 0 deletions plugins/Jukebox/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required (VERSION 2.6)
project (JukeboxPlugin)

add_definitions(-std=c++11)
add_definitions(-Wno-deprecated)
add_definitions(-Wl,--export-dynamic)
add_definitions(-rdynamic)

set (LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
link_directories(${PROJECT_SOURCE_DIR}/../../lib/yaml/build)
include_directories("${PROJECT_SOURCE_DIR}/../../lib/yaml/include")
set (PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)

include_directories("${PROJECT_BINARY_DIR}")
include_directories("${PROJECT_SOURCE_DIR}/../../../src")

file(GLOB_RECURSE SOURCES src/*.cpp)

add_library(JukeboxPlugin SHARED ${SOURCES})
target_link_libraries(JukeboxPlugin yaml-cpp mysqlcppconn)
4 changes: 4 additions & 0 deletions plugins/Jukebox/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake -DCMAKE_BUILD_TYPE=Debug -H. -Bbuild

cd ./build
make
Loading

0 comments on commit 2823ac3

Please sign in to comment.