Пример #1
0
void CheckSpellLevels(CCharEntity* PChar)
{
    uint8 level = 0;
    if (PChar->GetMJob() == JOB_BLU)
    {
        level = PChar->GetMLevel();
    }
    else if (PChar->GetSJob() == JOB_BLU)
    {
        level = PChar->GetSLevel();
    }

    if (level != 0)
    {
        for (int slot = 0; slot < 20; slot++)
        {
            if (PChar->m_SetBlueSpells[slot] != 0)
            {
                CBlueSpell* PSpell = (CBlueSpell*)spell::GetSpell(PChar->m_SetBlueSpells[slot] + 0x200);
                if (PSpell && level < PSpell->getJob(JOB_BLU))
                {
                    SetBlueSpell(PChar, PSpell, slot, false);
                }
            }
        }
    }
}
Пример #2
0
void ValidateBlueSpells(CCharEntity* PChar)
{
    CheckSpellLevels(PChar);

    uint8 maxSetPoints = GetTotalBlueMagicPoints(PChar);
    uint8 currentPoints = 0;

    for (int slot = 0; slot < 20; slot++)
    {
        if (PChar->m_SetBlueSpells[slot] != 0)
        {
            CBlueSpell* PSpell = (CBlueSpell*)spell::GetSpell(PChar->m_SetBlueSpells[slot] + 0x200);
            if (currentPoints + PSpell->getSetPoints() > maxSetPoints)
            {
                SetBlueSpell(PChar, PSpell, slot, false);
            }
            else
            {
                currentPoints += PSpell->getSetPoints();
            }
        }
    }

    CompactSpells(PChar);

    uint8 maxSlots = GetTotalSlots(PChar);

    for (int slot = maxSlots; slot < 20; slot++)
    {
        if (PChar->m_SetBlueSpells[slot] != 0)
        {
            SetBlueSpell(PChar, (CBlueSpell*)spell::GetSpell(PChar->m_SetBlueSpells[slot] + 0x200), slot, false);
        }
    }

    SaveSetSpells(PChar);
    PChar->status = STATUS_UPDATE;
    charutils::BuildingCharTraitsTable(PChar);
	PChar->pushPacket(new CCharJobExtraPacket(PChar, true));
	PChar->pushPacket(new CCharJobExtraPacket(PChar, false));
	PChar->pushPacket(new CCharStatsPacket(PChar));
	charutils::CalculateStats(PChar);
	PChar->UpdateHealth();
	PChar->pushPacket(new CCharHealthPacket(PChar));
}
Пример #3
0
void ValidateBlueSpells(CCharEntity* PChar)
{
    CheckSpellLevels(PChar);

    uint8 maxSetPoints = GetTotalBlueMagicPoints(PChar);
    uint8 currentPoints = 0;

    for (int slot = 0; slot < 20; slot++)
    {
        if (PChar->m_SetBlueSpells[slot] != 0)
        {
            CBlueSpell* PSpell = (CBlueSpell*)spell::GetSpell(static_cast<SpellID>(PChar->m_SetBlueSpells[slot] + 0x200));
            if (currentPoints + PSpell->getSetPoints() > maxSetPoints)
            {
                SetBlueSpell(PChar, PSpell, slot, false);
            }
            else
            {
                currentPoints += PSpell->getSetPoints();
            }
        }
    }

    CompactSpells(PChar);

    uint8 maxSlots = GetTotalSlots(PChar);

    for (int slot = maxSlots; slot < 20; slot++)
    {
        if (PChar->m_SetBlueSpells[slot] != 0)
        {
            SetBlueSpell(PChar, (CBlueSpell*)spell::GetSpell(static_cast<SpellID>(PChar->m_SetBlueSpells[slot] + 0x200)), slot, false);
        }
    }

    SaveSetSpells(PChar);
}