Skip to content

Commit

Permalink
Add SPP Solocraft
Browse files Browse the repository at this point in the history
-Adds SoloCraft as an option to CMake to enable/disable mod
-Updated CI files to test on push and build one daily release with SoloCraft

Credit to acidmanifesto and the TrinityCore project for the heavy legwork on getting this created
  • Loading branch information
Niam5 committed Sep 9, 2023
1 parent 30c5044 commit 159b113
Show file tree
Hide file tree
Showing 20 changed files with 898 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/windows-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- OPTIONAL_DEFINES: ""
TYPE: "default"

- OPTIONAL_DEFINES: "-DBUILD_EXTRACTORS=ON -DBUILD_IKE3_BOTS=ON -DBUILD_RECASTDEMOMOD=ON -DBUILD_GIT_ID=ON -DBUILD_ELUNA=ON"
- OPTIONAL_DEFINES: "-DBUILD_ELUNA=ON -DBUILD_SOLOCRAFT=ON -DBUILD_IKE3_BOTS=ON -DBUILD_EXTRACTORS=ON -DBUILD_RECASTDEMOMOD=ON -DBUILD_GIT_ID=ON "
TYPE: "with-all"

- OPTIONAL_DEFINES: "-DBUILD_IKE3_BOTS=ON -DBUILD_ELUNA=ON"
Expand Down
2 changes: 2 additions & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ option(BUILD_LOGIN_SERVER "Build login server" ON)
option(BUILD_EXTRACTORS "Build map/dbc/vmap/mmap extractors" OFF)
option(BUILD_SCRIPTDEV "Build ScriptDev. (OFF Speedup build)" ON)
option(BUILD_ELUNA "Build Eluna Lua Engine" OFF)
option(BUILD_SOLOCRAFT "Build SoloCraft mod" OFF)
option(BUILD_PLAYERBOT "Build Playerbot mod" OFF)
option(BUILD_IKE3_BOTS "Build ike3 Playerbots" OFF)
option(BUILD_AHBOT "Build Auction House Bot mod" OFF)
Expand Down Expand Up @@ -37,6 +38,7 @@ message(STATUS
BUILD_EXTRACTORS Build map/dbc/vmap/mmap extractor
BUILD_SCRIPTDEV Build scriptdev. (Disable it to speedup build in dev mode by not including scripts)
BUILD_ELUNA Build Eluna Lua Engine
BUILD_SOLOCRAFT Build SoloCraft Mod
BUILD_PLAYERBOT Build Playerbot mod
BUILD_IKE3_BOTS Build Ike3 Playerbot mod
BUILD_AHBOT Build Auction House Bot mod
Expand Down
6 changes: 6 additions & 0 deletions cmake/showoptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ else()
message(STATUS "Build Eluna LuaEngine : No (default)")
endif()

if(BUILD_SOLOCRAFT)
message(STATUS "Build SoloCraft Mod : Yes")
else()
message(STATUS "Build SoloCraft Mod : No (default)")
endif()

if(BUILD_AHBOT)
message(STATUS "Build AHBot : Yes")
else()
Expand Down
23 changes: 23 additions & 0 deletions sql/base/characters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,29 @@ LOCK TABLES `creature_respawn` WRITE;
/*!40000 ALTER TABLE `creature_respawn` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `custom_solocraft_character_stats`
--

DROP TABLE IF EXISTS `custom_solocraft_character_stats`;
CREATE TABLE `custom_solocraft_character_stats` (
`GUID` int(11) unsigned NOT NULL,
`Difficulty` float NOT NULL,
`GroupSize` int(11) NOT NULL,
`SpellPower` int(10) unsigned NOT NULL DEFAULT '0',
`Stats` float NOT NULL DEFAULT '100',
PRIMARY KEY (`GUID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- Dumping data for table `custom_solocraft_character_stats`
--

LOCK TABLES `custom_solocraft_character_stats` WRITE;
/*!40000 ALTER TABLE `custom_solocraft_character_stats` DISABLE KEYS */;
/*!40000 ALTER TABLE `custom_solocraft_character_stats` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `game_event_status`
--
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DROP TABLE IF EXISTS `custom_solocraft_character_stats`;
CREATE TABLE `custom_solocraft_character_stats` (
`GUID` int(11) unsigned NOT NULL,
`Difficulty` float NOT NULL,
`GroupSize` int(11) NOT NULL,
`SpellPower` int(10) unsigned NOT NULL DEFAULT '0',
`Stats` float NOT NULL DEFAULT '100',
PRIMARY KEY (`GUID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
4 changes: 4 additions & 0 deletions src/game/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ else()
add_definitions(-DBUILD_ELUNA -DCMANGOS -DCLASSIC)
endif()

if(BUILD_SOLOCRAFT)
add_definitions(-DBUILD_SOLOCRAFT)
endif()

if(NOT BUILD_PLAYERBOT)
# exclude Playerbot folder
set (EXCLUDE_DIR "PlayerBot/")
Expand Down
13 changes: 13 additions & 0 deletions src/game/Entities/CharacterHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,19 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
sEluna->OnLogin(pCurrChar);
#endif

#ifdef BUILD_SOLOCRAFT
bool SoloCraftEnable = sWorld.getConfig(CONFIG_BOOL_SOLOCRAFT_ENABLED);
bool SoloCraftAnnounceModule = sWorld.getConfig(CONFIG_BOOL_SOLOCRAFT_ANNOUNCE);

if (SoloCraftEnable)
{
if (SoloCraftAnnounceModule)
{
ChatHandler(pCurrChar->GetSession()).SendSysMessage("This server is running |cff4CFF00SPP SoloCraft Custom |rmodule.");
}
}
#endif

delete holder;
}

Expand Down
4 changes: 4 additions & 0 deletions src/game/Entities/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,10 @@ Player::Player(WorldSession* session): Unit(), m_taxiTracker(*this), m_mover(thi
for (auto& enchantMod : m_enchantmentFlatMod)
enchantMod = 0;

#ifdef BUILD_SOLOCRAFT
m_baseSpellPower = 0;
#endif

// Player summoning
m_summon_expire = 0;
m_summon_mapid = 0;
Expand Down
10 changes: 10 additions & 0 deletions src/game/Entities/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,9 @@ class Player : public Unit
void UpdateMaxPower(Powers power) override;
void UpdateAttackPowerAndDamage(bool ranged = false) override;
void UpdateDamagePhysical(WeaponAttackType attType) override;
#ifdef BUILD_SOLOCRAFT
void ApplySpellPowerBonus(int32 amount, bool apply);
#endif
void UpdateSpellDamageBonus();

void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, float& min_damage, float& max_damage, uint8 index = 0);
Expand All @@ -1645,6 +1648,9 @@ class Player : public Unit
float GetMeleeCritFromAgility() const;
float GetDodgeFromAgility(float amount) const;
float GetSpellCritFromIntellect() const;
#ifdef BUILD_SOLOCRAFT
uint32 GetBaseSpellPowerBonus() const { return m_baseSpellPower; }
#endif

void UpdateBlockPercentage();
void UpdateCritPercentage(WeaponAttackType attType);
Expand Down Expand Up @@ -2414,6 +2420,10 @@ class Player : public Unit

float m_auraBaseMod[BASEMOD_END][MOD_END];

#ifdef BUILD_SOLOCRAFT
uint16 m_baseSpellPower;
#endif

uint32 m_enchantmentFlatMod[MAX_ATTACK]; // TODO: Stat system - incorporate generically, exposes a required hidden weapon stat that does not apply when unarmed

SpellModList m_spellMods[MAX_SPELLMOD];
Expand Down
12 changes: 12 additions & 0 deletions src/game/Entities/StatSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ bool Player::UpdateStats(Stats stat)
return true;
}

#ifdef BUILD_SOLOCRAFT
void Player::ApplySpellPowerBonus(int32 amount, bool apply)
{
m_baseSpellPower += apply ? amount : -amount;

// For speed just update for client
//ApplyModUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, amount, apply);
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, amount, apply);
}
#endif

void Player::UpdateSpellDamageBonus()
{
// Magic damage modifiers implemented in Unit::SpellDamageBonusDone
Expand Down
10 changes: 10 additions & 0 deletions src/game/Entities/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7358,6 +7358,11 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)

if (GetTypeId() == TYPEID_PLAYER)
{
#ifdef BUILD_SOLOCRAFT
// Base value
DoneAdvertisedBenefit += ((Player*)this)->GetBaseSpellPowerBonus();
#endif

// Damage bonus from stats
AuraList const& mDamageDoneOfStatPercent = GetAurasByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT);
for (auto i : mDamageDoneOfStatPercent)
Expand Down Expand Up @@ -7562,6 +7567,11 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
// Healing bonus of spirit, intellect and strength
if (GetTypeId() == TYPEID_PLAYER)
{
#ifdef BUILD_SOLOCRAFT
// Base value
AdvertisedBenefit += ((Player*)this)->GetBaseSpellPowerBonus();
#endif

// Healing bonus from stats
AuraList const& mHealingDoneOfStatPercent = GetAurasByType(SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT);
for (auto i : mHealingDoneOfStatPercent)
Expand Down
3 changes: 3 additions & 0 deletions src/game/Entities/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,9 @@ class Unit : public WorldObject
void SetMaxHealth(uint32 val);
void SetHealthPercent(float percent);
int32 ModifyHealth(int32 dVal);
#ifdef BUILD_SOLOCRAFT
void SetFullHealth() { SetHealth(GetMaxHealth()); }
#endif
float OCTRegenHPPerSpirit() const;
float OCTRegenMPPerSpirit() const;

Expand Down
Loading

0 comments on commit 159b113

Please sign in to comment.