From 0447321d92f00803ab3bc3611e55f12987a02d33 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 17 Jun 2015 02:47:05 -0400 Subject: [PATCH] Implement songcap needed for the AA revamp Added rule Character:UseSpellFileSongCap defaulted to true since most servers will probably be updating everything. --- common/ruletypes.h | 1 + common/shareddb.cpp | 5 +++-- common/spdat.h | 4 ++-- zone/client_mods.cpp | 11 ++++++++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 9a36b77f4..f066b9115 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -99,6 +99,7 @@ RULE_BOOL ( Character, EnableXTargetting, true) // Enable Extended Targetting Wi RULE_BOOL ( Character, KeepLevelOverMax, false) // Don't delevel a character that has somehow gone over the level cap RULE_INT ( Character, FoodLossPerUpdate, 35) // How much food/water you lose per stamina update 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. RULE_INT ( Character, OrnamentationAugmentType, 20) //Ornamentation Augment Type RULE_REAL(Character, EnvironmentDamageMulipliter, 1) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index aa4924665..c9106ea04 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1682,6 +1682,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { sp[tempid].not_extendable = atoi(row[197]) != 0; sp[tempid].suspendable = atoi(row[200]) != 0; sp[tempid].viral_range = atoi(row[201]); + sp[tempid].songcap = atoi(row[202]); sp[tempid].no_block = atoi(row[205]); sp[tempid].spellgroup=atoi(row[207]); sp[tempid].rank = atoi(row[208]); @@ -2021,7 +2022,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) { void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) { std::string query = StringFormat("SELECT `inspect_message` FROM `character_inspect_messages` WHERE `id` = %u LIMIT 1", character_id); - auto results = QueryDatabase(query); + auto results = QueryDatabase(query); auto row = results.begin(); memset(message, '\0', sizeof(InspectMessage_Struct)); for (auto row = results.begin(); row != results.end(); ++row) { @@ -2031,7 +2032,7 @@ void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMes void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message) { std::string query = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message) VALUES (%u, '%s')", character_id, EscapeString(message->text).c_str()); - auto results = QueryDatabase(query); + auto results = QueryDatabase(query); } void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message) { diff --git a/common/spdat.h b/common/spdat.h index 24e982aee..c8e039f15 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -735,8 +735,8 @@ struct SPDat_Spell_Struct /* 198- 199 */ /* 200 */ bool suspendable; // buff is suspended in suspended buff zones /* 201 */ int viral_range; -/* 202 */ -/* 203 */ //int songcap; // individual song cap (how live currently does it, not implemented) +/* 202 */ int songcap; // individual song cap +/* 203 */ /* 204 */ /* 205 */ bool no_block; /* 206 */ diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 56a22de9a..76ce5195c 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -1978,7 +1978,11 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const return 10; uint32 effectmod = 10; - int effectmodcap = RuleI(Character, BaseInstrumentSoftCap); + int effectmodcap = 0; + if (RuleB(Character, UseSpellFileSongCap)) + effectmodcap = spells[spell_id].songcap / 10; + else + effectmodcap = RuleI(Character, BaseInstrumentSoftCap); // this should never use spell modifiers... // if a spell grants better modifers, they are copied into the item mods // because the spells are supposed to act just like having the intrument. @@ -2048,10 +2052,11 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const effectmod = 10; return effectmod; } - effectmodcap += aabonuses.songModCap + spellbonuses.songModCap + itembonuses.songModCap; + if (!RuleB(Character, UseSpellFileSongCap)) + effectmodcap += aabonuses.songModCap + spellbonuses.songModCap + itembonuses.songModCap; if (effectmod < 10) effectmod = 10; - if (effectmod > effectmodcap) + if (effectmodcap && effectmod > effectmodcap) // if the cap is calculated to be 0 using new rules, no cap. effectmod = effectmodcap; Log.Out(Logs::Detail, Logs::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id, effectmod, effectmodcap);