Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore. update module #9

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -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)
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- First of all, THANK YOU for your contribution. -->

## Changes Proposed:
-
-

## Issues Addressed:
<!-- If your fix has a relating issue, link it below -->
- Closes

## SOURCE:
<!-- If you can, include a source that can strengthen your claim -->

## Tests Performed:
<!-- Does it build without errors? Did you test in-game? What did you test? On which OS did you test? Describe any other tests performed -->
-
-


## How to Test the Changes:
<!-- Describe in a detailed step-by-step order how to test the changes -->

1.
2.
3.
40 changes: 0 additions & 40 deletions README.md

This file was deleted.

13 changes: 9 additions & 4 deletions conf/who-logged.conf.dist
Original file line number Diff line number Diff line change
@@ -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
106 changes: 44 additions & 62 deletions src/who_logged.cpp
Original file line number Diff line number Diff line change
@@ -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<bool>("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<bool>("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);
}
20 changes: 20 additions & 0 deletions src/who_logged.h
Original file line number Diff line number Diff line change
@@ -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();
}
File renamed without changes.
Loading