Skip to content

Commit c822939

Browse files
authored
Add files via upload
1 parent 205a809 commit c822939

1 file changed

Lines changed: 39 additions & 21 deletions

File tree

‎Source/items.cpp‎

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -609,35 +609,49 @@ void CalcItemValue(Item &item)
609609
item._iIvalue = std::max(v, 1);
610610
}
611611

612+
// เวทที่หนังสือขายเฉพาะที่ Pepin ไม่ดรอป ไม่ขายที่ Adria
613+
// (SpellID::Invisibility คือช่องที่เปลี่ยนเป็น Holy Armor)
614+
const std::array<SpellID, 3> PepinBookSpells = { SpellID::Healing, SpellID::HealOther, SpellID::Invisibility };
615+
SpellID ForcedBookSpell = SpellID::Invalid;
616+
617+
bool IsPepinOnlyBook(SpellID spell)
618+
{
619+
return std::find(PepinBookSpells.begin(), PepinBookSpells.end(), spell) != PepinBookSpells.end();
620+
}
621+
612622
void GetBookSpell(Item &item, int lvl)
613623
{
614624
if (lvl == 0)
615625
lvl = 1;
616626

617-
int rv = GenerateRnd(static_cast<int32_t>(SpellsData.size())) + 1;
627+
SpellID bs = SpellID::Firebolt;
628+
if (ForcedBookSpell != SpellID::Invalid) {
629+
bs = ForcedBookSpell;
630+
} else {
631+
int rv = GenerateRnd(static_cast<int32_t>(SpellsData.size())) + 1;
618632

619-
if (gbIsSpawn && lvl > 5)
620-
lvl = 5;
633+
if (gbIsSpawn && lvl > 5)
634+
lvl = 5;
621635

622-
int s = static_cast<int8_t>(SpellID::Firebolt);
623-
SpellID bs = SpellID::Firebolt;
624-
while (rv > 0) {
625-
const int sLevel = GetSpellBookLevel(static_cast<SpellID>(s));
626-
if (sLevel != -1 && lvl >= sLevel) {
627-
rv--;
628-
bs = static_cast<SpellID>(s);
629-
}
630-
s++;
631-
if (!gbIsMultiplayer) {
632-
if (s == static_cast<int8_t>(SpellID::Resurrect))
633-
s = static_cast<int8_t>(SpellID::Telekinesis);
634-
}
635-
if (!gbIsMultiplayer) {
636-
if (s == static_cast<int8_t>(SpellID::HealOther))
637-
s = static_cast<int8_t>(SpellID::BloodStar);
636+
int s = static_cast<int8_t>(SpellID::Firebolt);
637+
while (rv > 0) {
638+
const int sLevel = GetSpellBookLevel(static_cast<SpellID>(s));
639+
if (sLevel != -1 && lvl >= sLevel && !IsPepinOnlyBook(static_cast<SpellID>(s))) {
640+
rv--;
641+
bs = static_cast<SpellID>(s);
642+
}
643+
s++;
644+
if (!gbIsMultiplayer) {
645+
if (s == static_cast<int8_t>(SpellID::Resurrect))
646+
s = static_cast<int8_t>(SpellID::Telekinesis);
647+
}
648+
if (!gbIsMultiplayer) {
649+
if (s == static_cast<int8_t>(SpellID::HealOther))
650+
s = static_cast<int8_t>(SpellID::BloodStar);
651+
}
652+
if (static_cast<size_t>(s) == SpellsData.size())
653+
s = 1;
638654
}
639-
if (static_cast<size_t>(s) == SpellsData.size())
640-
s = 1;
641655
}
642656
const std::string_view spellName = GetSpellData(bs).sNameText;
643657
const size_t iNameLen = std::string_view(item._iName).size();
@@ -2139,6 +2153,10 @@ void RecreateHealerItem(const Player &player, Item &item, _item_indexes idx, int
21392153
{
21402154
if (IsAnyOf(idx, IDI_HEAL, IDI_FULLHEAL, IDI_RESURRECT)) {
21412155
GetItemAttrs(item, idx, lvl);
2156+
} else if (idx == IDI_BOOK1) {
2157+
ForcedBookSpell = PepinBookSpells[static_cast<uint32_t>(iseed) % PepinBookSpells.size()];
2158+
GetItemAttrs(item, idx, lvl);
2159+
ForcedBookSpell = SpellID::Invalid;
21422160
} else {
21432161
SetRndSeed(iseed);
21442162
const _item_indexes itype = RndHealerItem(player, lvl);

0 commit comments

Comments
 (0)