Merge TheNoim's current changes.

This commit is contained in:
Kay Kaprolat 2021-12-09 22:32:47 +01:00
commit ecbf886e52
25 changed files with 338 additions and 54 deletions

View File

@ -5,11 +5,12 @@ BUILD_THREADS=1
# Updates NET_VERSION in CMakeVariables.txt # Updates NET_VERSION in CMakeVariables.txt
BUILD_VERSION=171022 BUILD_VERSION=171022
# make sure this is a long random string # make sure this is a long random string
# grab a "SHA 256-bit Key" from here: https://keygen.io/
ACCOUNT_MANAGER_SECRET= ACCOUNT_MANAGER_SECRET=
# Should be the externally facing IP of your server host # Should be the externally facing IP of your server host
EXTERNAL_IP=localhost EXTERNAL_IP=localhost
# Database values # Database values
MARIADB_USER=SECRET_VALUE_CHANGE_ME MARIADB_USER=darkflame
MARIADB_PASSWORD=SECRET_VALUE_CHANGE_ME MARIADB_PASSWORD=SECRET_VALUE_CHANGE_ME
MARIADB_ROOT_PASSWORD=SECRET_VALUE_CHANGE_ME MARIADB_ROOT_PASSWORD=SECRET_VALUE_CHANGE_ME
MARIADB_DATABASE=SECRET_VALUE_CHANGE_ME MARIADB_DATABASE=darkflame

51
.github/ISSUE_TEMPLATE/bug_report.yaml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Bug Report
description: Report incorrect behavior in DarkflameServer
title: "BUG: "
labels: ["bug", "triage"]
body:
- type: checkboxes
id: checks
attributes:
options:
- label: >
I have checked that this issue has not already been reported.
required: true
- label: >
I have validated that this issue is not a syntax error of either MySQL or SQLite.
required: true
- label: >
I have pulled the latest version of the main branch of DarkflameServer and have confirmed that the issue exists there.
required: true
- type: textarea
id: problem
attributes:
label: Issue Description
description: >
Please provide a description of the issue. If this is an in-game bug, please also include pictures that showcase the issue.
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Reproduction steps
description: >
Please provide a concise list of steps needed to reproduce this issue.
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected Behavior
description: >
Please describe what you expected to happen instead of the issue.
validations:
required: true
- type: textarea
id: environment
attributes:
label: Environment
description: >
Please include the environment you're running DarkflameServer on (for example: Windows, macOS, Ubuntu, WSL, etc).
validations:
required: true

View File

@ -0,0 +1,42 @@
name: Documentation Improvement
description: Report wrong or missing documentation
title: "DOC: "
labels: ["docs", "triage"]
body:
- type: checkboxes
attributes:
options:
- label: >
I have checked that this issue has not already been reported.
required: true
- label: >
I have validated that the documentation is wrong or missing on the latest version of the main branch of DarkflameServer
required: true
- type: textarea
id: location
attributes:
label: Location of the documentation
description: >
Please provide the location of the documentation, e.g. "Entity.cpp" or the
URL of the documentation, e.g.
"https://github.com/DarkflameUniverse/DarkflameServer/blob/main/README.md"
placeholder: https://github.com/DarkflameUniverse/DarkflameServer/blob/main/README.md
validations:
required: true
- type: textarea
id: problem
attributes:
label: Documentation problem
description: >
Please provide a description of what documentation you believe needs to be fixed/improved
validations:
required: true
- type: textarea
id: suggested-fix
attributes:
label: Suggested fix for documentation
description: >
Please explain the suggested fix and **why** it's better than the existing documentation
validations:
required: true

View File

@ -0,0 +1,40 @@
name: Feature Request
description: Suggest an idea for DarkflameServer
title: "ENH: "
labels: ["enhancement", "triage"]
body:
- type: textarea
id: problem
attributes:
label: Is your feature request related to a problem?
description: >
Please provide a description of what the problem is, e.g. "I wish I could use DarkflameServer to do [...]"
validations:
required: true
- type: textarea
id: solution
attributes:
label: Describe the solution you'd like
description: >
Please provide a description of the feature request, e.g. "`SlashCommandHandler.cpp` should get a new command `/unlimited-coins` that [...]", try to write a docstring for the desired feature
validations:
required: true
- type: textarea
id: implications
attributes:
label: Repository breaking implications
description: >
Please provide a description of how this feature will affect the DarkflameServer repository
- type: textarea
id: alternatives
attributes:
label: Describe alternatives you've considered
description: >
Please provide a description of any alternative solutions or features you've considered
- type: textarea
id: example
attributes:
label: Additional context
description: >
Please add any other context, code examples, or references to existing implementations about the feature request here

View File

@ -0,0 +1,53 @@
name: Installation Issue
description: Report issues installing the DarkflameServer on your system
title: "BUILD: "
labels: ["build", "triage"]
body:
- type: checkboxes
id: checks
attributes:
options:
- label: >
I have read the [installation guide](https://github.com/DarkflameUniverse/DarkflameServer/blob/main/README.md).
required: true
- type: dropdown
id: platform
attributes:
label: Platform
description: >
Please provide on which platform you've tried to install DarkflameServer
options:
- Windows
- WSL1
- WSL2
- macOS
- Ubuntu
- Other
validations:
required: true
- type: dropdown
id: architecture
attributes:
label: Architecture
description: >
Please provide on which architecture you've tried to install DarkflameServer
options:
- x86
- ARM
validations:
required: true
- type: textarea
id: logs
attributes:
label: Error Logs
description: >
If possible, please copy and paste the error logs when attempting to install DarkflameServer.
value: >
<details>
Replace this line with the error logs.
</details>

View File

@ -0,0 +1,33 @@
name: Performance Issue
description: Report slow performance or memory issues when running DarkflameServer
title: "PERF: "
labels: ["performance", "triage"]
body:
- type: checkboxes
id: checks
attributes:
options:
- label: >
I have checked that this issue has not already been reported.
required: true
- label: >
I have pulled the latest version of the main branch of DarkflameServer and have confirmed that the issue exists there.
required: true
- type: textarea
id: example
attributes:
label: Reproducible Example
description: >
Please provide a minimal, example that quantifies slow runtime or memory issues.
Ideally include screenshots of CPU usage or memory usage. And if possible point
to the code that you may suspect to cause the issue.
validations:
required: true
- type: textarea
id: prior-performance
attributes:
label: Prior Performance
description: >
If applicable, please provide the prior version of DarkflameServer and output
of the same reproducible example where the performance issue did not exist.

View File

@ -36,12 +36,89 @@ In general, we follow the "fork-and-pull" Git workflow
- Open a PR in our repository. - Open a PR in our repository.
PRs should include (when applicable): PRs should include (when applicable):
- A descriptive title that covers the **entire** content of the pull request
- Description - Description
- Motivation and Context - Motivation and Context
- Type of Changes - Type of Changes
- How Has This Been Tested? - How Has This Been Tested?
- Screenshots - Screenshots
## Commits
Commits to this project should be concise, descriptive and to the point. Writing proper commits helps define a clear project history and makes it easier to browse the source and pinpoint issues. Although this might seem trivial, a pull request with improperly formatted commits will not be accepted. An overview of good commit practices can be found in [this](https://cbea.ms/git-commit/) article. In a nutshell, a good commit has:
#### one conceptual change with a subject line that reflects it
The subject line of the commit is what you specify when doing `git commit -m "<subject-line>"`. When making commit, make sure that you create it for one conceptual change. E.g. do not use a commit to dump all the changes you have locally, but split your changes into commits that conceptually make sense and use the subject line to refelct that. Some examples:
**Bad:**
Commit message: `Document MovementAIComponent and add Avant Gardens Mech Scripts and fix Entity.cpp bug causing infinite loops`
Changed files:
- MovementAIComponent.cpp
- AgMechScript.cpp
- Entity.cpp
**Good:**
Commit message: `Document MovementAIComponent`
Changed files:
- MovementAIComponent.cpp
Commit message: `Add Avant Gardens Mech Scripts`
Changed files:
- AgMechScript.cpp
Commit message: `Fix Entity.cpp bug causing infinite loops`
Changed files:
- Entity.cpp
Not only does this logically make more sense, it'll make it easier to revert a conceptual change once something wrong with it. If you commit using the bad example but your bugfix turned out to introduce an even worse bug, all your changes have to be reverted, even though your other changes might not be broken. Splitting your commits into conceptually unique commits makes it easier to find and revert issues.
#### an imperative subject line
In the subject line it's also important to have an imperative writing style that covers the contents of your commit so that it easily reflects what it'll do when applied. We pick an imperative writing style so that all commits have equal tonality. An easy check for this is placing `When applied, this commit will ...` in front of your commit message and checking if that makes sense. Some examples:
**Bad:**
```
Nice commit :) -> "When applied, this commit will nice commit :)"
```
**Bad:**
```
fixed bug -> "When applied, this commit will fixed bug"
```
**Good:**
```
Fix Entity.cpp bug causing infinite loop -> "When applied, this commit will fix Entity.cpp bug causing infinite loop"
```
**Good:**
```
Add Avant Gardens mech scripts -> "When applied, this commit will add Avant Gardens mech scripts"
```
#### a subject line and a body
A good commit has a subject line that summarizes the change and a body that further describes the context required to understand the change. In this body you don't have to explain *what* the change was, as the code should reflect that, but *why* a change was made. Some examples:
**Bad:**
```
Add Avant Gardens mech scripts
Added the Avant Gardens mech scripts by creaing a new file called
AgMechScripts.cpp and then adding the proper event handlers to that
to send events to the client regarding changes of the mech.
```
**Good:**
```
Add Avant Gardens mech scripts
Added the Avant Gardens mech scripts as they were previously not
added, which produced InvalidScript errors.
```
## Development Resources ## Development Resources
Check out a compiled list of development resources and tools [here](https://lu-dev.net/). Check out a compiled list of development resources and tools [here](https://lu-dev.net/).

View File

@ -11,15 +11,11 @@
1. Copy `.env.example` and save it as `.env` inside the root directory of this repository 1. Copy `.env.example` and save it as `.env` inside the root directory of this repository
2. Edit the `.env` file and add your path to your LEGO® Universe Client after `CLIENT_PATH=` 2. Edit the `.env` file and add your path to your LEGO® Universe Client after `CLIENT_PATH=`
3. Update other values in the `.env` file as need (be sure to update passwords!) 3. Update other values in the `.env` file as need (be sure to update passwords!)
4. Run `docker-compose up --build setup` 4. Run `docker compose up -d --build`
5. Run `docker-compose up -d database` 5. Run `docker compose exec darkflame /app/MasterServer -a` and setup your admin account
6. Run `docker-compose up --build -d account-manager brickbuildfix` 6. Now you can see the output of the server with `docker compose logs -f --tail 100` or `docker compose logs -f --tail 100`. This can help you understand issues and there you can also see when the server finishes it's startup. Exit this with Ctrl+C.
7. Run `docker-compose build darkflame` 7. You're ready to connect your client!
8. Run `docker-compose exec darkflame /app/MasterServer -a` and setup your admin account 8. You can stop the server with `docker-compose stop` and start it again with `docker-compose up -d`.
9. Run `docker-compose up -d darkflame`
10. Now you can see the output of the server with `docker compose logs -f --tail 100` or `docker-compose logs -f --tail 100`. This can help you understand issues and there you can also see when the server finishes it's startup. Exit this with Ctrl+C.
11. You're ready to connect your client!
12. You can stop the server with `docker-compose stop` and start it again with `docker-compose up -d`.
## Disable brickbuildfix ## Disable brickbuildfix

View File

@ -460,7 +460,7 @@ void ChatPacketHandler::HandleTeamPromote(Packet* packet)
std::string promotedPlayer = PacketUtils::ReadString(0x14, packet, true); std::string promotedPlayer = PacketUtils::ReadString(0x14, packet, true);
Game::logger->Log("ChatPacketHandler", "(%llu) promiting (%s) to team leader\n", playerID, promotedPlayer.c_str()); Game::logger->Log("ChatPacketHandler", "(%llu) promoting (%s) to team leader\n", playerID, promotedPlayer.c_str());
auto* promoted = playerContainer.GetPlayerData(promotedPlayer); auto* promoted = playerContainer.GetPlayerData(promotedPlayer);

View File

@ -296,7 +296,7 @@ void InventoryComponent::RemoveItem(const LOT lot, const uint32_t count, eInvent
{ {
if (count == 0) if (count == 0)
{ {
Game::logger->Log("InventoryComponent", "Attempted to remove 0 of item (%i) to the inventory!\n", lot); Game::logger->Log("InventoryComponent", "Attempted to remove 0 of item (%i) from the inventory!\n", lot);
return; return;
} }

View File

@ -718,7 +718,7 @@ void RacingControlComponent::Update(float deltaTime) {
m_Started = true; m_Started = true;
Game::logger->Log("RacingControlComponent", "Starting rase\n"); Game::logger->Log("RacingControlComponent", "Starting race\n");
EntityManager::Instance()->SerializeEntity(m_Parent); EntityManager::Instance()->SerializeEntity(m_Parent);
@ -871,7 +871,7 @@ void RacingControlComponent::Update(float deltaTime) {
} }
Game::logger->Log("RacingControlComponent", Game::logger->Log("RacingControlComponent",
"Rached point (%i)/(%i)\n", player.respawnIndex, "Reached point (%i)/(%i)\n", player.respawnIndex,
path->pathWaypoints.size()); path->pathWaypoints.size());
break; break;

View File

@ -237,7 +237,7 @@ void Inventory::AddManagedItem(Item* item)
if (slots.find(slot) != slots.end()) if (slots.find(slot) != slots.end())
{ {
Game::logger->Log("Inventory", "Attempting to add an item with and already present slot (%i)!\n", slot); Game::logger->Log("Inventory", "Attempting to add an item with an already present slot (%i)!\n", slot);
return; return;
} }

View File

@ -1,9 +0,0 @@
#include "AgDarklingMech.h"
#include "DestroyableComponent.h"
void AgDarklingMech::OnStartup(Entity *self) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
destroyableComponent->SetFaction(4);
}
}

View File

@ -1,6 +0,0 @@
#pragma once
#include "BaseEnemyMech.h"
class AgDarklingMech : public BaseEnemyMech {
void OnStartup(Entity* self) override;
};

View File

@ -3,9 +3,6 @@
void AmDarklingMech::OnStartup(Entity* self) void AmDarklingMech::OnStartup(Entity* self)
{ {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>(); BaseEnemyMech::OnStartup(self);
destroyableComponent->SetFaction(4);
qbTurretLOT = 13171; qbTurretLOT = 13171;
} }

View File

@ -7,6 +7,14 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "dpWorld.h" #include "dpWorld.h"
#include "GeneralUtils.h" #include "GeneralUtils.h"
#include "DestroyableComponent.h"
void BaseEnemyMech::OnStartup(Entity* self) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
destroyableComponent->SetFaction(4);
}
}
void BaseEnemyMech::OnDie(Entity* self, Entity* killer) { void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
ControllablePhysicsComponent* controlPhys = static_cast<ControllablePhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS)); ControllablePhysicsComponent* controlPhys = static_cast<ControllablePhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS));

View File

@ -4,6 +4,7 @@
class BaseEnemyMech : public CppScripts::Script class BaseEnemyMech : public CppScripts::Script
{ {
public: public:
void OnStartup(Entity* self) override;
void OnDie(Entity* self, Entity* killer) override; void OnDie(Entity* self, Entity* killer) override;
protected: protected:
LOT qbTurretLOT = 6254; LOT qbTurretLOT = 6254;

View File

@ -243,7 +243,7 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
// Prep the selected spider egg // Prep the selected spider egg
//randomEgg:FireEvent{s}erID=self, args="prepEgg"} //randomEgg:FireEvent{s}erID=self, args="prepEgg"}
eggEntity->OnFireEventServerSide(self, "prepEgg"); eggEntity->OnFireEventServerSide(self, "prepEgg");
Game::logger->Log("SpiderQueen", "Preppign egg %llu\n", eggEntity->GetObjectID()); Game::logger->Log("SpiderQueen", "Prepping egg %llu\n", eggEntity->GetObjectID());
// Add the prepped egg to our hatchList // Add the prepped egg to our hatchList
hatchList.push_back(eggEntity->GetObjectID()); hatchList.push_back(eggEntity->GetObjectID());

View File

@ -51,7 +51,6 @@
#include "NpcCowboyServer.h" #include "NpcCowboyServer.h"
#include "ZoneAgMedProperty.h" #include "ZoneAgMedProperty.h"
#include "AgStromlingProperty.h" #include "AgStromlingProperty.h"
#include "AgDarklingMech.h"
#include "AgDarkSpiderling.h" #include "AgDarkSpiderling.h"
#include "PropertyFXDamage.h" #include "PropertyFXDamage.h"
#include "AgPropguards.h" #include "AgPropguards.h"
@ -377,7 +376,7 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
else if (scriptName == "scripts\\ai\\AG\\L_AG_STROMBIE_PROPERTY.lua") else if (scriptName == "scripts\\ai\\AG\\L_AG_STROMBIE_PROPERTY.lua")
script = new AgStromlingProperty(); script = new AgStromlingProperty();
else if (scriptName == "scripts\\ai\\AG\\L_AG_DARKLING_MECH.lua") else if (scriptName == "scripts\\ai\\AG\\L_AG_DARKLING_MECH.lua")
script = new AgDarklingMech(); script = new BaseEnemyMech();
else if (scriptName == "scripts\\ai\\AG\\L_AG_DARK_SPIDERLING.lua") else if (scriptName == "scripts\\ai\\AG\\L_AG_DARK_SPIDERLING.lua")
script = new AgDarkSpiderling(); script = new AgDarkSpiderling();
else if (scriptName == "scripts\\ai\\PROPERTY\\L_PROP_GUARDS.lua") else if (scriptName == "scripts\\ai\\PROPERTY\\L_PROP_GUARDS.lua")

View File

@ -275,7 +275,7 @@ void ImgBrickConsoleQB::OnTimerDone(Entity* self, std::string timerName)
{ {
if (timerName == "reset") if (timerName == "reset")
{ {
Game::logger->Log("ImgBrickConsoleQB", "Reseting...\n"); Game::logger->Log("ImgBrickConsoleQB", "Resetting...\n");
auto* rebuildComponent = self->GetComponent<RebuildComponent>(); auto* rebuildComponent = self->GetComponent<RebuildComponent>();

View File

@ -1,5 +1,6 @@
#include "VeMech.h" #include "VeMech.h"
void VeMech::OnStartup(Entity *self) { void VeMech::OnStartup(Entity *self) {
BaseEnemyMech::OnStartup(self);
qbTurretLOT = 8432; qbTurretLOT = 8432;
} }

View File

@ -30,8 +30,7 @@ services:
- database:/var/lib/mysql - database:/var/lib/mysql
networks: networks:
- darkflame - darkflame
# (optional) ports only exposed so that DB management tools can connect # You can expose these so that DB management tools can connect (WARNING: INSECURE)
# Remove the # of the next two lines to expose your database
# ports: # ports:
# - 3306:3306 # - 3306:3306

View File

@ -58,7 +58,7 @@ update_ini_values
if [[ ! -d "/client" ]]; then if [[ ! -d "/client" ]]; then
echo "Client not found." echo "Client not found."
echo "Did you forgot to mount the client into the \"/client\" directory?" echo "Did you forget to mount the client into the \"/client\" directory?"
exit 1 exit 1
fi fi
@ -69,8 +69,8 @@ if [[ ! -f "/client/extracted" ]]; then
touch /client/extracted touch /client/extracted
else else
echo "Client already extracted. Skip this step" echo "Client already extracted. Skip this step..."
echo "If you want to force re-extract, just delete the file called \"extracted\" in the client directory" echo "If you want to force a re-extract, just delete the file called \"extracted\" in the client directory"
fi fi
if [[ ! -f "/client/migrated" ]]; then if [[ ! -f "/client/migrated" ]]; then
@ -80,6 +80,6 @@ if [[ ! -f "/client/migrated" ]]; then
touch /client/migrated touch /client/migrated
else else
echo "Client db already migrated. Skip this step" echo "Client db already migrated. Skip this step..."
echo "If you want to force re-migrate, just delete the file called \"migrated\" in the client directory" echo "If you want to force a re-migrate, just delete the file called \"migrated\" in the client directory"
fi fi

View File

@ -37,12 +37,13 @@ else
echo "Server already initialized" echo "Server already initialized"
fi fi
while [ ! -f "/client/migrated" ]; do # check to make sure the setup has completed
echo "Client setup not finished. Waiting for setup container to complete" while [ ! -f "/client/extracted" ] || [ ! -f "/client/migrated" ]; do
sleep 1 echo "Client setup not finished. Waiting for setup container to complete..."
sleep 5
done done
# start the server # start the server
echo "Start MasterServer" echo "Starting MasterServer"
./MasterServer ./MasterServer
tail -f /dev/null tail -f /dev/null