Implemented SPA 469, 470

Implemented
SE_Chance_Best_in_Spell_Grp     469  Chance to cast highest scribed spell within a spell group. All base2 spells share roll chance, only 1 cast.

SE_Trigger_Best_in_Spell_Grp	470

Chance to cast highest scribed spell within a spell group. Each spell has own chance.

Additional Changes:
Rewrote TrySpellTrigger function used for SPA 340 since it incorporates SPA 469. Improved code so that chance of spell being triggered should be more accurate statistically.
This commit is contained in:
KayenEQ
2021-07-13 21:48:28 -04:00
parent a8345ae2aa
commit 3122cd3edb
5 changed files with 114 additions and 45 deletions
+21
View File
@@ -5251,6 +5251,27 @@ int Client::FindSpellBookSlotBySpellID(uint16 spellid) {
return -1; //default
}
uint32 Client::GetHighestScribedSpellinSpellGroup(uint32 spell_group)
{
//Typical live spells follow 1/5/10 rank value for actual ranks 1/2/3, but this can technically be set as anything.
int highest_rank = 0; //highest ranked found in spellgroup
uint32 highest_spell_id = 0; //spell_id of the highest ranked spell you have scribed in that spell rank.
for (int i = 0; i < EQ::spells::SPELLBOOK_SIZE; i++) {
if (IsValidSpell(m_pp.spell_book[i])) {
if (spells[m_pp.spell_book[i]].spellgroup == spell_group) {
if (highest_rank < spells[m_pp.spell_book[i]].rank) {
highest_rank = spells[m_pp.spell_book[i]].rank;
highest_spell_id = m_pp.spell_book[i];
}
}
}
}
return highest_spell_id;
}
bool Client::SpellGlobalCheck(uint16 spell_id, uint32 char_id) {
std::string spell_global_name;
int spell_global_value;