Example #1
0
void Client::InspectBuffs(Client* Inspector, int Rank)
{
	if (!Inspector || (Rank == 0)) return;

	Inspector->Message_StringID(CC_Default, CURRENT_SPELL_EFFECTS, GetName());
	uint32 buff_count = GetMaxTotalSlots();
	for (uint32 i = 0; i < buff_count; ++i)
	{
		if (buffs[i].spellid != SPELL_UNKNOWN)
		{
			if (Rank == 1)
				Inspector->Message(0, "%s", spells[buffs[i].spellid].name);
			else
			{
				if (spells[buffs[i].spellid].buffdurationformula == DF_Permanent)
					Inspector->Message(0, "%s (Permanent)", spells[buffs[i].spellid].name);
				else {
					char *TempString = nullptr;
					MakeAnyLenString(&TempString, "%.1f", static_cast<float>(buffs[i].ticsremaining) / 10.0f);
					Inspector->Message_StringID(CC_Default, BUFF_MINUTES_REMAINING, spells[buffs[i].spellid].name, TempString);
					safe_delete_array(TempString);
				}
			}
		}
	}
}
Example #2
0
File: aa.cpp Project: af4t/Server
void Client::InspectBuffs(Client* Inspector, int Rank)
{
	// At some point the removed the restriction of being a group member for this to work
	// not sure when, but the way it's coded now, it wouldn't work with mobs.
	if (!Inspector || Rank == 0)
		return;

	auto outapp = new EQApplicationPacket(OP_InspectBuffs, sizeof(InspectBuffs_Struct));
	InspectBuffs_Struct *ib = (InspectBuffs_Struct *)outapp->pBuffer;

	uint32 buff_count = GetMaxTotalSlots();
	uint32 packet_index = 0;
	for (uint32 i = 0; i < buff_count; i++) {
		if (buffs[i].spellid == SPELL_UNKNOWN)
			continue;
		ib->spell_id[packet_index] = buffs[i].spellid;
		if (Rank > 1)
			ib->tics_remaining[packet_index] = spells[buffs[i].spellid].buffdurationformula == DF_Permanent ? 0xFFFFFFFF : buffs[i].ticsremaining;
		packet_index++;
	}

	Inspector->FastQueuePacket(&outapp);
}
Example #3
0
int32 Client::GetActSpellCost(uint16 spell_id, int32 cost)
{
    // Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell
    if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5)
    {
        int16 mana_back = this->itembonuses.Clairvoyance * MakeRandomInt(1, 100) / 100;
        // Doesnt generate mana, so best case is a free spell
        if(mana_back > cost)
            mana_back = cost;

        cost -= mana_back;
    }

    // This formula was derived from the following resource:
    // http://www.eqsummoners.com/eq1/specialization-library.html
    // WildcardX
    float PercentManaReduction = 0;
    float SpecializeSkill = GetSpecializeSkillValue(spell_id);
    int SuccessChance = MakeRandomInt(0, 100);

    float bonus = 1.0;
    switch(GetAA(aaSpellCastingMastery))
    {
    case 1:
        bonus += 0.05;
        break;
    case 2:
        bonus += 0.15;
        break;
    case 3:
        bonus += 0.30;
        break;
    }

    bonus += 0.05 * GetAA(aaAdvancedSpellCastingMastery);

    if(SuccessChance <= (SpecializeSkill * 0.3 * bonus))
    {
        PercentManaReduction = 1 + 0.05 * SpecializeSkill;
        switch(GetAA(aaSpellCastingMastery))
        {
        case 1:
            PercentManaReduction += 2.5;
            break;
        case 2:
            PercentManaReduction += 5.0;
            break;
        case 3:
            PercentManaReduction += 10.0;
            break;
        }

        switch(GetAA(aaAdvancedSpellCastingMastery))
        {
        case 1:
            PercentManaReduction += 2.5;
            break;
        case 2:
            PercentManaReduction += 5.0;
            break;
        case 3:
            PercentManaReduction += 10.0;
            break;
        }
    }

    int16 focus_redux = GetFocusEffect(focusManaCost, spell_id);

    if(focus_redux > 0)
    {
        PercentManaReduction += MakeRandomFloat(1, (double)focus_redux);
    }

    cost -= (cost * (PercentManaReduction / 100));

    // Gift of Mana - reduces spell cost to 1 mana
    if(focus_redux >= 100) {
        uint32 buff_max = GetMaxTotalSlots();
        for (int buffSlot = 0; buffSlot < buff_max; buffSlot++) {
            if (buffs[buffSlot].spellid == 0 || buffs[buffSlot].spellid >= SPDAT_RECORDS)
                continue;

            if(IsEffectInSpell(buffs[buffSlot].spellid, SE_ReduceManaCost)) {
                if(CalcFocusEffect(focusManaCost, buffs[buffSlot].spellid, spell_id) == 100)
                    cost = 1;
            }
        }
    }

    if(cost < 0)
        cost = 0;

    return cost;
}
Example #4
0
void Client::GetExpLoss(Mob* killerMob, uint16 spell, int &exploss)
{
	float loss;
	uint8 level = GetLevel();
	if(level >= 1 && level <= 29)
		loss = 0.16f;
	if(level == 30)
		loss = 0.08f;
	if(level >= 31 && level <= 34)
		loss = 0.15f;
	if(level == 35)
		loss = 0.075f;
	if(level >= 36 && level <= 39)
		loss = 0.14f;
	if(level == 40)
		loss = 0.07f;
	if(level >= 41 && level <= 44)
		loss = 0.13f;
	if(level == 45)
		loss = 0.065f;
	if(level >= 46 && level <= 50)
		loss = 0.12f;
	if(level >= 51)
		loss = 0.06f;

	if(RuleB(Character, SmoothEXPLoss))
	{
		if(loss >= 0.12)
			loss /= 2;
	}

	int requiredxp = GetEXPForLevel(level + 1) - GetEXPForLevel(level);
	exploss=(int)((float)requiredxp * (loss * RuleR(Character, EXPLossMultiplier)));

	if( (level < RuleI(Character, DeathExpLossLevel)) || (level > RuleI(Character, DeathExpLossMaxLevel)) || IsBecomeNPC() )
	{
		exploss = 0;
	}
	else if( killerMob )
	{
		if( killerMob->IsClient() )
		{
			exploss = 0;
		}
		else if( killerMob->GetOwner() && killerMob->GetOwner()->IsClient() )
		{
			exploss = 0;
		}
	}

	if(spell != SPELL_UNKNOWN)
	{
		uint32 buff_count = GetMaxTotalSlots();
		for(uint16 buffIt = 0; buffIt < buff_count; buffIt++)
		{
			if(buffs[buffIt].spellid == spell && buffs[buffIt].client)
			{
				exploss = 0;	// no exp loss for pvp dot
				break;
			}
		}
	}
}