Skip to content

Commit

Permalink
Augments (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Codinablack committed Sep 8, 2024
1 parent 254dc7c commit 5ed7fbb
Show file tree
Hide file tree
Showing 26 changed files with 1,638 additions and 1,104 deletions.
19 changes: 0 additions & 19 deletions data/scripts/#discord.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1 @@
local LoginEvent = CreatureEvent("DiscordHook")

--Discord webhook enums
--MESSAGE_NORMAL
--MESSAGE_ERROR;
--MESSAGE_LOG;
--MESSAGE_INFO;

local webhookLink = "TOKEN HERE"

function LoginEvent.onLogin(player)
Game.sendDiscordMessage(webhookLink, MESSAGE_INFO, "Player: " .. player:getName() .. " has logged in")
Game.sendDiscordMessage(webhookLink, MESSAGE_ERROR, "Player: " .. player:getName() .. " has logged in")
Game.sendDiscordMessage(webhookLink, MESSAGE_NORMAL, "Player: " .. player:getName() .. " has logged in")
Game.sendDiscordMessage(webhookLink, MESSAGE_LOG, "Player: " .. player:getName() .. " has logged in")
return true
end

LoginEvent:type("login")
LoginEvent:register()
13 changes: 9 additions & 4 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,32 @@ workspace "Black-Tek-Server"
objdir "build/%{cfg.buildcfg}/obj"
location ""
files { "src/**.cpp", "src/**.h" }
flags {"LinkTimeOptimization", "MultiProcessorCompile"}
flags {"MultiProcessorCompile", "LinkTimeOptimization", "NoIncrementalLink"}
enableunitybuild "On"
intrinsics "On"

filter "configurations:Debug"
defines { "DEBUG" }
runtime "Debug"
symbols "On"
optimize "Debug"
filter {}

filter "configurations:Release"
defines { "NDEBUG" }
symbols "On"
optimize "Speed"
runtime "Release"
symbols "Off"
editandcontinue "Off"
optimize "Full"
filter {}

filter "platforms:64"
architecture "x86_64"
filter {}

filter "platforms:ARM64"
architecture "ARM64"
filter {}

filter "system:not windows"
buildoptions { "-Wall", "-Wextra", "-pedantic", "-pipe", "-fvisibility=hidden", "-Wno-unused-local-typedefs" }
Expand All @@ -42,9 +47,9 @@ workspace "Black-Tek-Server"
filter "system:windows"
openmp "On"
characterset "MBCS"
debugformat "c7"
linkoptions {"/IGNORE:4099"}
vsprops { VcpkgEnableManifest = "true" }
symbolspath '$(OutDir)$(TargetName).pdb'
filter {}

filter "architecture:amd64"
Expand Down
50 changes: 50 additions & 0 deletions src/augment.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Credits: BlackTek Server Creator [email protected].
// This project is based of otland's The Forgottenserver.
// Any and all code taken from otland's The Forgottenserver is licensed under GPL 2.0
// Any code Authored by: Codinablack or BlackTek contributers, that is not already licensed, is hereby licesned MIT.
// The GPL 2.0 License that can be found in the LICENSE file.
// All code found in this file is licensed under MIT and can be found in the LICENSE file.


#include "augment.h"

Augment::Augment(std::string_view name) : m_name(name), m_mod_list(std::make_shared<ModifierList>()) {
m_mod_list->initializeSharedPointer();
}

Augment::Augment(std::shared_ptr<Augment>& original) : m_name(original->m_name), m_mod_list(original->m_mod_list) {
m_mod_list->initializeSharedPointer();
}

inline std::shared_ptr<Augment> Augment::MakeAugment(std::string_view augmentName) {
auto augment = std::make_shared<Augment>(augmentName);
return augment;
}

inline std::shared_ptr<Augment> Augment::MakeAugment(std::shared_ptr<Augment>& originalRef)
{
auto augmentClone = std::make_shared<Augment>(originalRef);
return augmentClone;
}

inline const std::string_view Augment::getName() const {
return m_name;
}

inline void Augment::addModifier(std::shared_ptr<DamageModifier> modifier) {
m_mod_list->addModifier(modifier);
}

inline void Augment::removeModifier(std::shared_ptr<DamageModifier>& modifier) {
m_mod_list->removeModifier(modifier);
}

std::vector<std::shared_ptr<DamageModifier>>& Augment::getAttackModifiers(uint8_t modType)
{
return m_mod_list->getAttackModifiers(modType);
}

std::vector<std::shared_ptr<DamageModifier>>& Augment::getDefenseModifiers(uint8_t modType)
{
return m_mod_list->getDefenseModifiers(modType);
}
44 changes: 44 additions & 0 deletions src/augment.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Credits: BlackTek Server Creator [email protected].
// This project is based of otland's The Forgottenserver.
// Any and all code taken from otland's The Forgottenserver is licensed under GPL 2.0
// Any code Authored by: Codinablack or BlackTek contributers, that is not already licensed, is hereby licesned MIT.
// The GPL 2.0 License that can be found in the LICENSE file.
// All code found in this file is licensed under MIT and can be found in the LICENSE file.


#ifndef FS_AUGMENT_H
#define FS_AUGMENT_H

#include "damagemodifier.h"

class Augment : public std::enable_shared_from_this<Augment> {

public:
Augment() = default;
Augment(std::string_view name);
Augment(std::shared_ptr<Augment>& original);

~Augment() = default;

// allow copying
explicit Augment(const Augment&) = default;
Augment& operator=(const Augment&) = default;

const std::string_view getName() const;
static std::shared_ptr<Augment> MakeAugment(std::string_view augmentName);
static std::shared_ptr<Augment> MakeAugment(std::shared_ptr<Augment>& originalPointer);

void addModifier(std::shared_ptr<DamageModifier> modifier);
void removeModifier(std::shared_ptr<DamageModifier>& modifier);

std::vector<std::shared_ptr<DamageModifier>>& getAttackModifiers(uint8_t modType);
std::vector<std::shared_ptr<DamageModifier>>& getDefenseModifiers(uint8_t modType);

private:

std::shared_ptr<ModifierList> m_mod_list;
std::string_view m_name;
};


#endif
Loading

0 comments on commit 5ed7fbb

Please sign in to comment.