mirror of
https://github.com/noisiver/mod-weekendbonus.git
synced 2026-01-13 00:58:36 +00:00
Initial commit
Added the script taken directly from the old assistant code.
This commit is contained in:
18
README.md
18
README.md
@@ -1 +1,17 @@
|
|||||||
# mod-weekendbonus
|
# Weekend Bonus
|
||||||
|
This is a module for [AzerothCore](https://github.com/azerothcore/azerothcore-wotlk).
|
||||||
|
|
||||||
|
# Features
|
||||||
|
This module will increase the experience and reputation gained on weekends. That means friday, saturday and sunday.
|
||||||
|
|
||||||
|
The multiplier can be changed using the config.
|
||||||
|
|
||||||
|
# Additional information
|
||||||
|
This module is part of my collection of modules.
|
||||||
|
|
||||||
|
[ActivateZones](https://github.com/tkn963/mod-activatezones) : Set creatures as active in zones that has players in it.
|
||||||
|
[Assistant](https://github.com/tkn963/mod-assistant) : Allows players to obtain certain items and utilities from an NPC.
|
||||||
|
[LearnSpells](https://github.com/tkn963/mod-learnspells) : Lets players learn class spells, talent ranks, proficiencies and mounts when leveling up or logging into the world.
|
||||||
|
[RecruitAFriend](https://github.com/tkn963/mod-recruitafriend) : Lets players activate recruit a friend with an in-game command.
|
||||||
|
[SpawnPoints](https://github.com/tkn963/mod-spawnpoints) : Makes new characters spawn in specified locations when entering the world for the first time.
|
||||||
|
[WeekendBonus](https://github.com/tkn963/mod-weekendbonus) : Increases the experience and reputation gained on weekends.
|
||||||
|
|||||||
7
conf/WeekendBonus.conf.dist
Normal file
7
conf/WeekendBonus.conf.dist
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[worldserver]
|
||||||
|
|
||||||
|
# Multiplier for experience gains on weekends
|
||||||
|
Multiplier.Experience = 1
|
||||||
|
|
||||||
|
# Multiplier for reputation gains on weekends
|
||||||
|
Multiplier.Reputation = 1
|
||||||
1
conf/conf.sh.dist
Normal file
1
conf/conf.sh.dist
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
8
include.sh
Normal file
8
include.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
MOD_WEEKENDBONUS_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )"
|
||||||
|
|
||||||
|
source $MOD_WEEKENDBONUS_ROOT"/conf/conf.sh.dist"
|
||||||
|
|
||||||
|
if [ -f $MOD_WEEKENDBONUS_ROOT"/conf/conf.sh" ]; then
|
||||||
|
source $MOD_WEEKENDBONUS_ROOT"/conf/conf.sh"
|
||||||
|
fi
|
||||||
6
src/ModWeekendBonus_Loader.cpp
Normal file
6
src/ModWeekendBonus_Loader.cpp
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
void AddWeekendBonusScripts();
|
||||||
|
|
||||||
|
void Addmod_weekendbonusScripts()
|
||||||
|
{
|
||||||
|
AddWeekendBonusScripts();
|
||||||
|
}
|
||||||
39
src/WeekendBonus.cpp
Normal file
39
src/WeekendBonus.cpp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#include "Chat.h"
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Player.h"
|
||||||
|
#include "ScriptMgr.h"
|
||||||
|
|
||||||
|
class WeekendBonus : public PlayerScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WeekendBonus() : PlayerScript("WeekendBonus") {}
|
||||||
|
|
||||||
|
void OnGiveXP(Player* player, uint32& amount, Unit* /*victim*/) override
|
||||||
|
{
|
||||||
|
time_t t = time(NULL);
|
||||||
|
|
||||||
|
if (localtime(&t)->tm_wday == 5 /*Friday*/ || localtime(&t)->tm_wday == 6 /*Saturday*/ || localtime(&t)->tm_wday == 0 /*Sunday*/)
|
||||||
|
amount *= sConfigMgr->GetIntDefault("Multiplier.Experience", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnReputationChange(Player* player, uint32 /*factionId*/, int32& standing, bool /*incremental*/) override
|
||||||
|
{
|
||||||
|
time_t t = time(NULL);
|
||||||
|
|
||||||
|
if (localtime(&t)->tm_wday == 5 /*Friday*/ || localtime(&t)->tm_wday == 6 /*Saturday*/ || localtime(&t)->tm_wday == 0 /*Sunday*/)
|
||||||
|
standing *= sConfigMgr->GetIntDefault("Multiplier.Reputation", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnLogin(Player* player) override
|
||||||
|
{
|
||||||
|
time_t t = time(NULL);
|
||||||
|
|
||||||
|
if (localtime(&t)->tm_wday == 5 /*Friday*/ || localtime(&t)->tm_wday == 6 /*Saturday*/ || localtime(&t)->tm_wday == 0 /*Sunday*/)
|
||||||
|
ChatHandler(player->GetSession()).SendSysMessage("The weekend bonus is active, increasing the experience and reputation received!");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void AddWeekendBonusScripts()
|
||||||
|
{
|
||||||
|
new WeekendBonus();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user