diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..5610d2b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,72 @@ +name: Bug report +description: Create a bug report to help us improve. +title: "Bug: " +body: + - type: textarea + id: current + attributes: + label: Current Behaviour + description: | + Description of the problem or issue here. + Include entries of affected creatures / items / quests / spells etc. + If this is a crash, post the crashlog (upload to https://gist.github.com/) and include the link here. + Never upload files! Use GIST for text and YouTube for videos! + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected Behaviour + description: | + Tell us what should happen instead. + validations: + required: true + - type: textarea + id: reproduce + attributes: + label: Steps to reproduce the problem + description: | + What does someone else need to do to encounter the same bug? + placeholder: | + 1. Step 1 + 2. Step 2 + 3. Step 3 + validations: + required: true + - type: textarea + id: extra + attributes: + label: Extra Notes + description: | + Do you have any extra notes that can help solve the issue that does not fit any other field? + placeholder: | + None + validations: + required: false + - type: textarea + id: commit + attributes: + label: AC rev. hash/commit + description: | + Copy the result of the `.server debug` command (if you need to run it from the client get a prat addon) + validations: + required: true + - type: input + id: os + attributes: + label: Operating system + description: | + The Operating System the Server is running on. + i.e. Windows 11 x64, Debian 10 x64, macOS 12, Ubuntu 20.04 + validations: + required: true + - type: textarea + id: custom + attributes: + label: Custom changes or Modules + description: | + List which custom changes or modules you have applied, i.e. Eluna module, etc. + placeholder: | + None + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..2981f68 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,33 @@ +name: Feature request +description: Suggest an idea for this project +title: "Feature: " +body: + - type: markdown + attributes: + value: | + Thank you for taking your time to fill out a feature request. Remember to fill out all fields including the title above. + An issue that is not properly filled out will be closed. + - type: textarea + id: description + attributes: + label: Describe your feature request or suggestion in detail + description: | + A clear and concise description of what you want to happen. + validations: + required: true + - type: textarea + id: solution + attributes: + label: Describe a possible solution to your feature or suggestion in detail + description: | + A clear and concise description of any alternative solutions or features you've considered. + validations: + required: false + - type: textarea + id: additional + attributes: + label: Additional context + description: | + Add any other context or screenshots about the feature request here. + validations: + required: false diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 0000000..6a092c2 --- /dev/null +++ b/.github/README.md @@ -0,0 +1,32 @@ +# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore + +## Who Logged + +### This is a module for [AzerothCore](http://www.azerothcore.org) + +- Latest build status with azerothcore: + +[![Build Status](https://github.com/azerothcore/mod-who-logged/workflows/core-build/badge.svg)](https://github.com/azerothcore/mod-who-logged) + +![logger](https://github.com/azerothcore/mod-who-logged/assets/2810187/0ab044ab-1070-4012-be8e-99e8995ca6e3) + +Current features: + +-**This Module outputs to the console when a player logs into the world.** + +### How to install + +1. Simply place the module under the `modules` folder of your AzerothCore source folder. +2. Re-run cmake and launch a clean build of AzerothCore + +**That's it.** + +### (Optional) Edit module configuration + +- Copy `who-logged.conf.dist` to `who-logged.conf` and edit it as you prefer. + +### Credits + +- Author: [talamortis](https://github.com/talamortis) +- Updates from the AzerothCore community +- AzerothCore: [repository](https://github.com/azerothcore) - [website](https://azerothcore.org/) - [discord chat community](https://discord.gg/PaqQRkd) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..21c9245 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,25 @@ + + +## Changes Proposed: +- +- + +## Issues Addressed: + +- Closes + +## SOURCE: + + +## Tests Performed: + +- +- + + +## How to Test the Changes: + + +1. +2. +3. diff --git a/README.md b/README.md deleted file mode 100644 index 15bde15..0000000 --- a/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore -## Who Logged -### This is a module for [AzerothCore](http://www.azerothcore.org) -- Latest build status with azerothcore: [![Build Status](https://github.com/azerothcore/mod-who-logged/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-who-logged) - -Current features: - --**This Module outputs to the console when a player logs into the world. - -Upcoming features: - -## Screenshots -https://cdn.discordapp.com/attachments/309418302923472898/385923854666563586/unknown.png - -## Requirements - -Who logged Module currently requires: - -AzerothCore v1.0.1+ - -## How to install - -###1) Simply place the module under the `modules` folder of your AzerothCore source folder. - -###2) Input the SQL file to the character database. (if any) - -###3) Re-run cmake and launch a clean build of AzerothCore - -**That's it.** - -### (Optional) Edit module configuration - -If you need to change the module configuration, go to your server configuration folder (e.g. **etc**), copy `who-logged.conf.dist` to `who-logged.conf` and edit it as you prefer. - -# Show your appreciation -[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SBJFTAJKUNEXC) - - - - diff --git a/conf/who-logged.conf.dist b/conf/who-logged.conf.dist index 78db386..397e205 100644 --- a/conf/who-logged.conf.dist +++ b/conf/who-logged.conf.dist @@ -1,8 +1,13 @@ [worldserver] # -# PlayerAnnounce -# Description: This will show the console on what players are logged in -# Default: Enabled = 1 -# Disabled = 0 +# PlayerAnnounce +# Description: This will show the console on what players are logged in +# Default: 1 +# Value: +# 1 (Enabled) +# 0 (Disabled) +# + + PlayerAnnounce = 1 diff --git a/src/who_logged.cpp b/src/who_logged.cpp index e0e2948..21d41d2 100644 --- a/src/who_logged.cpp +++ b/src/who_logged.cpp @@ -1,70 +1,52 @@ -#include "loader.h" -#include "Configuration/Config.h" -#include "Player.h" -#include "Creature.h" -#include "AccountMgr.h" -#include "ScriptMgr.h" -#include "Define.h" -#include "GossipDef.h" +#include "who_logged.h" -class WhoLoggedAnnounce : public PlayerScript +void WhoLoggedAnnounce::OnLogin(Player* player) { -public: - WhoLoggedAnnounce() : PlayerScript("WhoLoggedAnnounce") { } - - void OnLogin(Player* player) + if (!sConfigMgr->GetOption("PlayerAnnounce", true)) { - std::string playerIP = player->GetSession()->GetRemoteAddress(); - std::string playerName = player->GetName(); - uint32 pAccountID = player->GetSession()->GetAccountId(); - uint32 pLevel = player->getLevel(); - std::string pClass; - std::ostringstream message; - - if (!sConfigMgr->GetOption("PlayerAnnounce", true)) - { - return; - } + return; + } - switch (player->getClass()) - { - case CLASS_WARLOCK: - pClass = "Warlock"; - break; - case CLASS_WARRIOR: - pClass = "Warrior"; - break; - case CLASS_MAGE: - pClass = "Mage"; - break; - case CLASS_SHAMAN: - pClass = "Shaman"; - break; - case CLASS_DEATH_KNIGHT: - pClass = "Death Knight"; - break; - case CLASS_DRUID: - pClass = "Druid"; - break; - case CLASS_HUNTER: - pClass = "Hunter"; - break; - case CLASS_PALADIN: - pClass = "Paladin"; - break; - case CLASS_ROGUE: - pClass = "Rogue"; - break; - case CLASS_PRIEST: - pClass = "Priest"; - break; - } + std::string playerIP = player->GetSession()->GetRemoteAddress(); + std::string playerName = player->GetName(); + uint32 playerAccountID = player->GetSession()->GetAccountId(); + uint32 playerLevel = player->GetLevel(); + std::string playerClass; + std::ostringstream message; - LOG_INFO("module", "Player '{}' has logged in : Level '{}' : Class '{}' : IP '{}' : AccountID '{}'", playerName.c_str(), pLevel, pClass.c_str(), playerIP.c_str(), pAccountID); + switch (player->getClass()) + { + case CLASS_WARLOCK: + playerClass = "Warlock"; + break; + case CLASS_WARRIOR: + playerClass = "Warrior"; + break; + case CLASS_MAGE: + playerClass = "Mage"; + break; + case CLASS_SHAMAN: + playerClass = "Shaman"; + break; + case CLASS_DEATH_KNIGHT: + playerClass = "Death Knight"; + break; + case CLASS_DRUID: + playerClass = "Druid"; + break; + case CLASS_HUNTER: + playerClass = "Hunter"; + break; + case CLASS_PALADIN: + playerClass = "Paladin"; + break; + case CLASS_ROGUE: + playerClass = "Rogue"; + break; + case CLASS_PRIEST: + playerClass = "Priest"; + break; } -}; -void AddWhoLoggedScripts() -{ - new WhoLoggedAnnounce(); + LOG_INFO("module", "Player '{}' has logged in : Level '{}' : Class '{}' : IP '{}' : AccountID '{}'", playerName.c_str(), std::to_string(playerLevel), playerClass.c_str(), playerIP.c_str(), playerAccountID); } diff --git a/src/who_logged.h b/src/who_logged.h new file mode 100644 index 0000000..2fc97e6 --- /dev/null +++ b/src/who_logged.h @@ -0,0 +1,20 @@ +#include "Configuration/Config.h" +#include "Player.h" +#include "Creature.h" +#include "AccountMgr.h" +#include "ScriptMgr.h" +#include "Define.h" +#include "GossipDef.h" + +class WhoLoggedAnnounce : public PlayerScript +{ +public: + WhoLoggedAnnounce() : PlayerScript("WhoLoggedAnnounce") {} + + void OnLogin(Player* player) override; +}; + +void AddWhoLoggedScripts() +{ + new WhoLoggedAnnounce(); +} diff --git a/src/loader.h b/src/wl_loader.cpp similarity index 100% rename from src/loader.h rename to src/wl_loader.cpp