Skip to content

Commit

Permalink
tidied(?) up xp scrolls
Browse files Browse the repository at this point in the history
  • Loading branch information
3vcloud committed Apr 11, 2024
1 parent fb0c0a4 commit b64a0a9
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions GWToolboxdll/Windows/Pcons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,36 +832,34 @@ bool PconLunar::CanUseByEffect() const
bool PconScroll::CanUseByEffect() const
{
using namespace GW::Constants;
const GW::Agent* _player = GW::Agents::GetPlayer();
if (!_player) {
return false; // player doesn't exist?
}

GW::EffectArray* effects = GW::Effects::GetPlayerEffects();
const auto effects = GW::Agents::GetPlayer() ? GW::Effects::GetPlayerEffects() : nullptr;
if (!effects) {
return true;
}

for (DWORD i = 0; i < effects->size(); i++) {
if (effects->at(i).GetTimeRemaining() < 1000) {
for (auto& effect : *effects) {
if (effect.GetTimeRemaining() < 1000)
continue;
switch (effect.skill_id) {
case SkillID::Adventurers_Insight:
case SkillID::Berserkers_Insight:
case SkillID::Heros_Insight:
case SkillID::Hunters_Insight:
case SkillID::Lightbringers_Insight:
case SkillID::Rampagers_Insight:
case SkillID::Slayers_Insight:
return false;
}
if (effects->at(i).skill_id == SkillID::Adventurers_Insight
|| effects->at(i).skill_id == SkillID::Berserkers_Insight
|| effects->at(i).skill_id == SkillID::Heros_Insight
|| effects->at(i).skill_id == SkillID::Hunters_Insight
|| effects->at(i).skill_id == SkillID::Lightbringers_Insight
|| effects->at(i).skill_id == SkillID::Rampagers_Insight
|| effects->at(i).skill_id == SkillID::Slayers_Insight) {
return false; // already on
}
}
return true;
}

size_t PconScroll::QuantityForEach(const GW::Item* item) const
{
using namespace GW::Constants;
if (!item)
return 0;

switch (item->model_id) {
case ItemID::ScrollOfAdventurersInsight:
case ItemID::ScrollOfBerserkersInsight:
Expand Down

0 comments on commit b64a0a9

Please sign in to comment.