Skip to content

Commit

Permalink
Merge pull request #3 from EQEmu/master
Browse files Browse the repository at this point in the history
Update to Master
  • Loading branch information
Paul Coene committed Feb 16, 2020
2 parents 1528e7c + 952fd43 commit 8cda425
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 14 deletions.
2 changes: 1 addition & 1 deletion common/patches/rof2_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -4401,7 +4401,7 @@ struct SendAA_Struct {
/*0104*/ uint32 special_category;
/*0108*/ uint8 shroud;
/*0109*/ uint8 unknown109;
/*0110*/ uint8 layonhands; // 1 for lay on hands -- doesn't seem to matter?
/*0110*/ uint8 reset_on_death; // timer is reset on death
/*0111*/ uint8 unknown111;
/*0112*/ uint32 total_abilities;
/*0116*/ AA_Ability abilities[0];
Expand Down
2 changes: 1 addition & 1 deletion common/patches/rof_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -4341,7 +4341,7 @@ struct SendAA_Struct {
/*0104*/ uint32 special_category;
/*0108*/ uint8 shroud;
/*0109*/ uint8 unknown109;
/*0110*/ uint8 layonhands; // 1 for lay on hands -- doesn't seem to matter?
/*0110*/ uint8 reset_on_death; // timer is reset on death
/*0111*/ uint8 unknown111;
/*0112*/ uint32 total_abilities;
/*0116*/ AA_Ability abilities[0];
Expand Down
2 changes: 1 addition & 1 deletion common/patches/sod_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3780,7 +3780,7 @@ struct SendAA_Struct {
/*0092*/ uint32 special_category;
/*0096*/ uint8 shroud;
/*0097*/ uint8 unknown97;
/*0098*/ uint8 layonhands; // 1 for lay on hands -- doesn't seem to matter?
/*0098*/ uint8 reset_on_death; // timer is reset on death
/*0099*/ uint8 unknown99;
/*0100*/ uint32 total_abilities;
/*0104*/ AA_Ability abilities[0];
Expand Down
2 changes: 1 addition & 1 deletion common/patches/sof_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3704,7 +3704,7 @@ struct SendAA_Struct {
/*0088*/ uint32 aa_expansion;
/*0092*/ uint32 special_category;
/*0096*/ uint8 shroud;
/*0097*/ uint8 unknown97;
/*0097*/ uint8 reset_on_death; // timer is reset on death -- guess
/*0098*/ uint32 total_abilities;
/*0102*/ AA_Ability abilities[0];
};
Expand Down
2 changes: 1 addition & 1 deletion common/patches/uf_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3835,7 +3835,7 @@ struct SendAA_Struct {
/*0092*/ uint32 special_category;
/*0096*/ uint8 shroud;
/*0097*/ uint8 unknown97;
/*0098*/ uint8 layonhands; // 1 for lay on hands -- doesn't seem to matter?
/*0098*/ uint8 reset_on_death; // timer is reset on death
/*0099*/ uint8 unknown99;
/*0100*/ uint32 total_abilities;
/*0104*/ AA_Ability abilities[0];
Expand Down
1 change: 1 addition & 0 deletions common/ruletypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ RULE_BOOL(Character, EnableAggroMeter, true, "Enable Aggro Meter, for users with
RULE_BOOL(Character, KeepLevelOverMax, false, "Don't delevel a character that has somehow gone over the level cap")
RULE_INT(Character, FoodLossPerUpdate, 32, "How much food/water you lose per stamina update")
RULE_BOOL(Character, EnableHungerPenalties, false, "being hungry/thirsty has negative effects -- it does appear normal live servers do not have penalties")
RULE_BOOL(Character, EnableFoodRequirement, true, "if disabled, food is no longer required")
RULE_INT(Character, BaseInstrumentSoftCap, 36, "Softcap for instrument mods, 36 commonly referred to as \"3.6\" as well")
RULE_BOOL(Character, UseSpellFileSongCap, true, "When they removed the AA that increased the cap they removed the above and just use the spell field")
RULE_INT(Character, BaseRunSpeedCap, 158, "Base Run Speed Cap, on live it's 158% which will give you a runspeed of 1.580 hard capped to 225")
Expand Down
2 changes: 1 addition & 1 deletion common/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/

#define CURRENT_BINARY_DATABASE_VERSION 9148
#define CURRENT_BINARY_DATABASE_VERSION 9150

#ifdef BOTS
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9026
Expand Down
2 changes: 2 additions & 0 deletions utils/sql/db_update_manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@
9146|2020_01_10_character_soft_deletes.sql|SHOW COLUMNS FROM `character_data` LIKE 'deleted_at'|empty|
9147|2020_01_24_grid_centerpoint_wp.sql|SHOW COLUMNS FROM `grid_entries` LIKE 'centerpoint'|empty|
9148|2020_01_28_corpse_guild_consent_id.sql|SHOW COLUMNS FROM `character_corpses` LIKE 'guild_consent_id'|empty|
9149|2020_02_06_globalloot.sql|SHOW COLUMNS FROM `global_loot` LIKE 'hot_zone'|empty|
9150|2020_02_06_aa_reset_on_death.sql|SHOW COLUMNS FROM `aa_ability` LIKE 'reset_on_death'|empty|

# Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not
Expand Down
2 changes: 2 additions & 0 deletions utils/sql/git/required/2020_02_06_aa_reset_on_death.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `aa_ability` ADD `reset_on_death` TINYINT(4) NOT NULL DEFAULT '0';
UPDATE `aa_ability` SET `reset_on_death` = '1' WHERE `id` = 6001;
2 changes: 2 additions & 0 deletions utils/sql/git/required/2020_02_06_globalloot.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `global_loot` ADD `hot_zone` TINYINT NULL;

23 changes: 21 additions & 2 deletions zone/aa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,24 @@ void Client::ResetAlternateAdvancementTimers() {
safe_delete(outapp);
}

void Client::ResetOnDeathAlternateAdvancement() {
for (const auto &aa : aa_ranks) {
auto ability_rank = zone->GetAlternateAdvancementAbilityAndRank(aa.first, aa.second.first);
auto ability = ability_rank.first;
auto rank = ability_rank.second;

if (!ability)
continue;

if (!rank)
continue;

// since they're dying, we just need to clear the DB
if (ability->reset_on_death)
p_timers.Clear(&database, rank->spell_type + pTimerAAStart);
}
}

void Client::PurchaseAlternateAdvancementRank(int rank_id) {
AA::Rank *rank = zone->GetAlternateAdvancementRank(rank_id);
if(!rank) {
Expand Down Expand Up @@ -1646,7 +1664,7 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
LogInfo("Loading Alternate Advancement Abilities");
abilities.clear();
std::string query = "SELECT id, name, category, classes, races, deities, drakkin_heritage, status, type, charges, "
"grant_only, first_rank_id FROM aa_ability WHERE enabled = 1";
"grant_only, reset_on_death, first_rank_id FROM aa_ability WHERE enabled = 1";
auto results = QueryDatabase(query);
if(results.Success()) {
for(auto row = results.begin(); row != results.end(); ++row) {
Expand All @@ -1663,7 +1681,8 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
ability->type = atoi(row[8]);
ability->charges = atoi(row[9]);
ability->grant_only = atoi(row[10]) != 0 ? true : false;
ability->first_rank_id = atoi(row[11]);
ability->reset_on_death = atoi(row[11]) != 0 ? true : false;
ability->first_rank_id = atoi(row[12]);
ability->first = nullptr;

abilities[ability->id] = std::unique_ptr<AA::Ability>(ability);
Expand Down
1 change: 1 addition & 0 deletions zone/aa_ability.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Ability
int drakkin_heritage;
int status;
bool grant_only;
bool reset_on_death;
int type;
int charges;
int first_rank_id;
Expand Down
11 changes: 11 additions & 0 deletions zone/attack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1852,6 +1852,17 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQEmu::skills::Sk
BuffFadeDetrimental();
}

/*
Reset AA reuse timers that need to be, live-like this is only Lay on Hands
*/
ResetOnDeathAlternateAdvancement();

/*
Reset reuse timer for classic skill based Lay on Hands (For tit I guess)
*/
if (GetClass() == PALADIN) // we could check if it's not expired I guess, but should be fine not to
p_timers.Clear(&database, pTimerLayHands);

/*
Finally, send em home

Expand Down
7 changes: 4 additions & 3 deletions zone/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@ class Client : public Mob
void SendAlternateAdvancementTimers();
void ResetAlternateAdvancementTimer(int ability);
void ResetAlternateAdvancementTimers();
void ResetOnDeathAlternateAdvancement();

void SetAAPoints(uint32 points) { m_pp.aapoints = points; SendAlternateAdvancementStats(); }
void AddAAPoints(uint32 points) { m_pp.aapoints += points; SendAlternateAdvancementStats(); }
Expand Down Expand Up @@ -900,14 +901,14 @@ class Client : public Mob
void BreakFeignDeathWhenCastOn(bool IsResisted);
void LeaveGroup();

bool Hungry() const {if (GetGM()) return false; return m_pp.hunger_level <= 3000;}
bool Thirsty() const {if (GetGM()) return false; return m_pp.thirst_level <= 3000;}
bool Hungry() const {if (GetGM() || !RuleB(Character, EnableFoodRequirement)) return false; return m_pp.hunger_level <= 3000;}
bool Thirsty() const {if (GetGM() || !RuleB(Character, EnableFoodRequirement)) return false; return m_pp.thirst_level <= 3000;}
int32 GetHunger() const { return m_pp.hunger_level; }
int32 GetThirst() const { return m_pp.thirst_level; }
void SetHunger(int32 in_hunger);
void SetThirst(int32 in_thirst);
void SetConsumption(int32 in_hunger, int32 in_thirst);
bool IsStarved() const { if (GetGM() || !RuleB(Character, EnableHungerPenalties)) return false; return m_pp.hunger_level == 0 || m_pp.thirst_level == 0; }
bool IsStarved() const { if (GetGM() || !RuleB(Character, EnableFoodRequirement) || !RuleB(Character, EnableHungerPenalties)) return false; return m_pp.hunger_level == 0 || m_pp.thirst_level == 0; }

bool CheckTradeLoreConflict(Client* other);
bool CheckTradeNonDroppable();
Expand Down
9 changes: 9 additions & 0 deletions zone/global_loot_manager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "global_loot_manager.h"
#include "npc.h"
#include "client.h"
#include "zone.h"

extern Zone *zone;

std::vector<int> GlobalLootManager::GetGlobalLootTables(NPC *mob) const
{
Expand Down Expand Up @@ -78,6 +81,12 @@ bool GlobalLootEntry::PassesRules(NPC *mob) const
if (mob->GetBodyType() == r.value)
bPassesBodyType = true;
break;
case GlobalLoot::RuleTypes::HotZone: // value == 0 must not be hot_zone, value != must be hot_zone
if (zone->IsHotzone() && !r.value)
return false;
if (!zone->IsHotzone() && r.value)
return false;
break;
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions zone/global_loot_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ enum class RuleTypes {
BodyType = 4,
Rare = 5,
Raid = 6,
HotZone = 7,
Max
};

Expand Down
8 changes: 6 additions & 2 deletions zone/loottables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ void NPC::CheckGlobalLootTables()
void ZoneDatabase::LoadGlobalLoot()
{
auto query = StringFormat("SELECT id, loottable_id, description, min_level, max_level, rare, raid, race, "
"class, bodytype, zone FROM global_loot WHERE enabled = 1");
"class, bodytype, zone, hot_zone FROM global_loot WHERE enabled = 1");

auto results = QueryDatabase(query);
if (!results.Success() || results.RowCount() == 0)
Expand Down Expand Up @@ -518,9 +518,13 @@ void ZoneDatabase::LoadGlobalLoot()
auto bodytypes = SplitString(row[9], '|');

for (auto &b : bodytypes)
e.AddRule(GlobalLoot::RuleTypes::Class, std::stoi(b));
e.AddRule(GlobalLoot::RuleTypes::BodyType, std::stoi(b));
}

// null is not used
if (row[11])
e.AddRule(GlobalLoot::RuleTypes::HotZone, atoi(row[11]));

zone->AddGlobalLootEntry(e);
}
}
Expand Down
2 changes: 1 addition & 1 deletion zone/mob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ int Mob::_GetRunSpeed() const {
int runspeedcap = RuleI(Character,BaseRunSpeedCap);
runspeedcap += itembonuses.IncreaseRunSpeedCap + spellbonuses.IncreaseRunSpeedCap + aabonuses.IncreaseRunSpeedCap;

aa_mod = itembonuses.IncreaseRunSpeedCap + spellbonuses.IncreaseRunSpeedCap + aabonuses.IncreaseRunSpeedCap;
aa_mod += aabonuses.BaseMovementSpeed + aabonuses.movementspeed;
int spell_mod = spellbonuses.movementspeed + itembonuses.movementspeed;
int movemod = 0;

Expand Down

0 comments on commit 8cda425

Please sign in to comment.