mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
[Bug Fix] Allow High Level Spells to be Unmemorized. (#2641)
* [Bug Fix] Allow High Level Spells to be Unmemorized. # Notes - If you deleveled below a spell's level, you couldn't unmemorize it, this fixes that. * Update client_process.cpp
This commit is contained in:
parent
bc277ac296
commit
337dc54eb9
@ -1083,72 +1083,86 @@ void Client::OPTGB(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
void Client::OPMemorizeSpell(const EQApplicationPacket* app)
|
void Client::OPMemorizeSpell(const EQApplicationPacket* app)
|
||||||
{
|
{
|
||||||
if(app->size != sizeof(MemorizeSpell_Struct))
|
if (app->size != sizeof(MemorizeSpell_Struct)) {
|
||||||
{
|
LogError(
|
||||||
LogError("[Client::OPMemorizeSpell] Wrong size on OP_MemorizeSpell. Got: [{}] Expected: [{}]", app->size, sizeof(MemorizeSpell_Struct));
|
"[Client::OPMemorizeSpell] Wrong size on OP_MemorizeSpell. Got: [{}] Expected: [{}]",
|
||||||
|
app->size,
|
||||||
|
sizeof(MemorizeSpell_Struct)
|
||||||
|
);
|
||||||
DumpPacket(app);
|
DumpPacket(app);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MemorizeSpell_Struct* memspell = (const MemorizeSpell_Struct*) app->pBuffer;
|
const auto* m = (MemorizeSpell_Struct*) app->pBuffer;
|
||||||
|
|
||||||
if(!IsValidSpell(memspell->spell_id))
|
if (!IsValidSpell(m->spell_id)) {
|
||||||
{
|
Message(
|
||||||
Message(Chat::Red, "Unexpected error: spell id out of range");
|
Chat::Red,
|
||||||
|
fmt::format(
|
||||||
|
"Spell ID {} does not exist or is invalid.",
|
||||||
|
m->spell_id
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if
|
if (
|
||||||
(
|
m->scribing != memSpellForget &&
|
||||||
GetClass() > 16 ||
|
(
|
||||||
GetLevel() < spells[memspell->spell_id].classes[GetClass()-1]
|
!EQ::ValueWithin(GetClass(), PLAYER_CLASS_WARRIOR, PLAYER_CLASS_BERSERKER) ||
|
||||||
)
|
GetLevel() < spells[m->spell_id].classes[GetClass() - 1]
|
||||||
{
|
)
|
||||||
char val1[20]={0};
|
) {
|
||||||
MessageString(Chat::Red,SPELL_LEVEL_TO_LOW,ConvertArray(spells[memspell->spell_id].classes[GetClass()-1],val1),spells[memspell->spell_id].name);
|
MessageString(
|
||||||
//Message(Chat::Red, "Unexpected error: Class cant use this spell at your level!");
|
Chat::Red,
|
||||||
|
SPELL_LEVEL_TO_LOW,
|
||||||
|
std::to_string(spells[m->spell_id].classes[GetClass() - 1]).c_str(),
|
||||||
|
spells[m->spell_id].name
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(memspell->scribing)
|
switch (m->scribing) {
|
||||||
{
|
case memSpellScribing: {
|
||||||
case memSpellScribing: { // scribing spell to book
|
const auto* inst = m_inv[EQ::invslot::slotCursor];
|
||||||
const EQ::ItemInstance* inst = m_inv[EQ::invslot::slotCursor];
|
|
||||||
|
|
||||||
if (inst && inst->IsClassCommon())
|
if (inst && inst->IsClassCommon()) {
|
||||||
{
|
const auto* item = inst->GetItem();
|
||||||
const EQ::ItemData* item = inst->GetItem();
|
|
||||||
|
|
||||||
if (RuleB(Character, RestrictSpellScribing) && !item->IsEquipable(GetRace(), GetClass())) {
|
if (
|
||||||
|
RuleB(Character, RestrictSpellScribing) &&
|
||||||
|
!item->IsEquipable(GetRace(), GetClass())
|
||||||
|
) {
|
||||||
MessageString(Chat::Red, CANNOT_USE_ITEM);
|
MessageString(Chat::Red, CANNOT_USE_ITEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(item && item->Scroll.Effect == (int32)(memspell->spell_id))
|
if (item && item->Scroll.Effect == static_cast<int32>(m->spell_id)) {
|
||||||
{
|
ScribeSpell(m->spell_id, m->slot);
|
||||||
ScribeSpell(memspell->spell_id, memspell->slot);
|
|
||||||
DeleteItemInInventory(EQ::invslot::slotCursor, 1, true);
|
DeleteItemInInventory(EQ::invslot::slotCursor, 1, true);
|
||||||
|
} else {
|
||||||
|
Message(Chat::Red, "Scribing spell: Item Instance exists but item does not or spell ids do not match.");
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
Message(0,"Scribing spell: inst exists but item does not or spell ids do not match.");
|
Message(Chat::Red, "Scribing a spell without an Item Instance on your cursor?");
|
||||||
}
|
|
||||||
else
|
|
||||||
Message(0,"Scribing a spell without an inst on your cursor?");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case memSpellMemorize: { // memming spell
|
|
||||||
if(HasSpellScribed(memspell->spell_id))
|
|
||||||
{
|
|
||||||
MemSpell(memspell->spell_id, memspell->slot);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
database.SetMQDetectionFlag(AccountName(), GetName(), "OP_MemorizeSpell but we don't have this spell scribed...", zone->GetShortName());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case memSpellForget: { // unmemming spell
|
case memSpellMemorize: {
|
||||||
UnmemSpell(memspell->slot);
|
if (HasSpellScribed(m->spell_id)) {
|
||||||
|
MemSpell(m->spell_id, m->slot);
|
||||||
|
} else {
|
||||||
|
database.SetMQDetectionFlag(
|
||||||
|
AccountName(),
|
||||||
|
GetName(),
|
||||||
|
"OP_MemorizeSpell but we don't have this spell scribed...",
|
||||||
|
zone->GetShortName()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case memSpellForget: {
|
||||||
|
UnmemSpell(m->slot);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user