update module (#8)

* update module

* update readme
This commit is contained in:
Micrah
2019-12-21 14:29:57 +11:00
committed by WiZZy
parent ee4f5fe791
commit 457e8853d1
8 changed files with 110 additions and 54 deletions

View File

@@ -1,42 +1,76 @@
sudo: required
dist: trusty # (14.04)
# xenial (16.04) is not supported yet
dist: bionic # (18.04)
language: cpp
compiler:
- clang
cache: ccache
addons:
apt:
update: true
services:
- mysql
git:
depth: 1
depth: 10
before_install:
- sudo apt-get -y install build-essential libtool make cmake cmake-data openssl
- sudo apt-get -y install libssl-dev libmysqlclient-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev libace-dev
- git config user.email "travis@build.bot" && git config user.name "Travis CI"
- git tag -a -m "Travis build" init
stages:
- prepare_cache
- run
install:
- cd ..
- git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore
- mv mod-reward-playtime azerothcore/modules
- cd azerothcore
- git submodule update --init --recursive
jobs:
include:
- stage: prepare_cache
env: TRAVIS_BUILD_ID="1"
before_install:
- cd ..
- git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk
- mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules
- cd azerothcore-wotlk
- source ./apps/ci/ci-before_install.sh
install:
- source ./apps/ci/ci-install.sh OFF
script:
- source ./apps/ci/ci-compile.sh
- mysql -uroot -e 'create database test_mysql;'
- cd bin
- cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=0 -DSCRIPTS=1 -DSERVERS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=check_install
- cd ..
- stage: run
env: TRAVIS_BUILD_ID="1"
before_install:
- cd ..
- git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk
- mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules
- cd azerothcore-wotlk
- source ./apps/ci/ci-before_install.sh
install:
- source ./apps/ci/ci-install.sh ON
- source ./apps/ci/ci-import-db.sh
script:
- source ./apps/ci/ci-compile.sh
- source ./apps/ci/ci-worldserver-dry-run.sh
script:
- $CXX --version
- mysql -uroot < data/sql/create/create_mysql.sql
- cat data/sql/base/db_auth/*.sql | mysql -uacore -pacore auth
- cat data/sql/base/db_characters/*.sql | mysql -uacore -pacore characters
- cat data/sql/base/db_world/*.sql | mysql -uacore -pacore world
- cat data/sql/updates/db_auth/*.sql | mysql -uacore -pacore auth
- cat data/sql/updates/db_characters/*.sql | mysql -uacore -pacore characters
- cat data/sql/updates/db_world/*.sql | mysql -uacore -pacore world
- mysql -uroot < data/sql/create/drop_mysql.sql
- cd bin
- make -j 8 -k && make install
- cd check_install/bin
- stage: prepare_cache
env: TRAVIS_BUILD_ID="2"
before_install:
- cd ..
- git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk
- mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules
- cd azerothcore-wotlk
- source ./apps/ci/ci-before_install.sh
install:
- source ./apps/ci/ci-install.sh OFF
script:
- source ./apps/ci/ci-compile.sh
- stage: run
env: TRAVIS_BUILD_ID="2"
before_install:
- cd ..
- git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk
- mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules
- cd azerothcore-wotlk
- source ./apps/ci/ci-before_install.sh
install:
- source ./apps/ci/ci-install.sh ON
script:
- source ./apps/ci/ci-compile.sh

View File

@@ -4,6 +4,6 @@ AC_ADD_SCRIPT("${CMAKE_CURRENT_LIST_DIR}/src/reward_system.cpp")
AC_ADD_SCRIPT_LOADER("RewardSystem" "${CMAKE_CURRENT_LIST_DIR}/src/loader.h")
CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_CURRENT_LIST_DIR}/src/cmake/after_ws_install.cmake")
AC_ADD_CONFIG_FILE("${CMAKE_CURRENT_LIST_DIR}/conf/reward_system.conf.dist")
message("-- REWARD SYSTEM CONFIGURED --")

View File

@@ -1,4 +1,7 @@
# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore
# Reward System
-- Latest build status with azerothcore: [![Build Status](https://travis-ci.org/azerothcore/mod-reward-played-time.svg?branch=master)](https://travis-ci.org/azerothcore/mod-reward-played-time)
This is a module for [AzerothCore](http://www.azerothcore.org) that adds items for players that have stayed logged in the x amount of time.

9
conf/conf.sh.dist Normal file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
#
# CUSTOM
#
DB_CHARACTERS_CUSTOM_PATHS+=(
$MOD_REWARD_SYSTEM_ROOT"/sql/characters/"
)

View File

@@ -1,5 +1,12 @@
[worldserver]
#
# RewardSystemAnnounce
# Description: Announce the reward system
# Default: 1 - (Enabled)
#
RewardSystem.Announce = 1
#
# RewardSystemEnable
# Description: Enable the reward system

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
MOD_REWARD_SYSTEM_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )"
source $MOD_REWARD_SYSTEM_ROOT"/conf/conf.sh.dist"
if [ -f $MOD_REWARD_SYSTEM_ROOT"/conf/conf.sh" ]; then
source $MOD_REWARD_SYSTEM_ROOT"/conf/conf.sh"
fi

View File

@@ -16,9 +16,6 @@ CREATE TABLE IF NOT EXISTS `reward_system` (
`roll` int(11) NOT NULL,
`item` int(11) NOT NULL,
`quantity` int(11)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Data exporting was unselected.
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

View File

@@ -3,10 +3,10 @@
#include "Configuration/Config.h"
#include "Player.h"
#include "AccountMgr.h"
#include "Chat.h"
#include "ScriptMgr.h"
#include "Define.h"
#include "GossipDef.h"
#include "Chat.h"
bool RewardSystem_Enable;
uint32 Max_roll;
@@ -14,23 +14,21 @@ uint32 Max_roll;
class reward_system : public PlayerScript
{
public:
reward_system() : PlayerScript("rewardsystem") {}
reward_system() : PlayerScript("reward_system") {}
uint32 RewardTimer;
int32 roll;
void OnLogin(Player* p)
{
if (RewardSystem_Enable)
{
ChatHandler(p->GetSession()).SendSysMessage("This server is running the |cff4CFF00Player Reward System |rmodule.");
RewardTimer = (sConfigMgr->GetIntDefault("RewardTime", 1)*HOUR*IN_MILLISECONDS);
}
}
void OnLogin(Player* player) override
{
if (sConfigMgr->GetBoolDefault("RewardSystem.Announce", true)) {
ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00Reward Time Played |rmodule.");
}
}
void OnBeforeUpdate(Player* player, uint32 p_time)
void OnBeforeUpdate(Player* player, uint32 p_time) override
{
if (RewardSystem_Enable)
if (sConfigMgr->GetBoolDefault("RewardSystemEnable", true))
{
if (RewardTimer > 0)
{
@@ -89,7 +87,6 @@ public:
std::string cfg_def_file = cfg_file + ".dist";
sConfigMgr->LoadMore(cfg_def_file.c_str());
sConfigMgr->LoadMore(cfg_file.c_str());
RewardSystem_Enable = sConfigMgr->GetBoolDefault("RewardSystemEnable", true);
Max_roll = sConfigMgr->GetIntDefault("MaxRoll", 1000);
}
}