Example #1
0
int32 Client::CalcBaseManaRegen()
{
	uint8 clevel = GetLevel();
	int32 regen = 0;
	if (IsSitting() || (GetHorseId() != 0)) {
		if (HasSkill(EQEmu::skills::SkillMeditate)) {
			regen = (((GetSkill(EQEmu::skills::SkillMeditate) / 10) + (clevel - (clevel / 4))) / 4) + 4;
		}
		else {
			regen = 2;
		}
	}
	else {
		regen = 2;
	}
	return regen;
}
Example #2
0
void Client::SummonHorse(uint16 spell_id) {
    if (GetHorseId() != 0) {
        Message(13,"You already have a Horse. Get off, Fatbutt!");
        return;
    }
    if(!Horse::IsHorseSpell(spell_id)) {
        LogFile->write(EQEMuLog::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id);
        return;
    }

    // No Horse, lets get them one.

    Horse* horse = new Horse(this, spell_id, GetX(), GetY(), GetZ(), GetHeading());

    //we want to manage the spawn packet ourself.
    //another reason is we dont want quests executing on it.
    entity_list.AddNPC(horse, false);

    // Okay, lets say they have a horse now.


    EQApplicationPacket outapp;
    horse->CreateHorseSpawnPacket(&outapp, GetName(), GetID());
    /*	// Doodman: Kludged in here instead of adding a field to PCType. FIXME!
    	NewSpawn_Struct* ns=(NewSpawn_Struct*)outapp->pBuffer;
    	ns->spawn.texture=mount_color;
    	ns->spawn.pet_owner_id=0;
    	ns->spawn.walkspeed=npc_type->walkspeed;
    	ns->spawn.runspeed=npc_type->runspeed;
    */
    entity_list.QueueClients(horse, &outapp);


    uint16 tmpID = horse->GetID();
    SetHorseId(tmpID);

}
Example #3
0
int32 Client::CalcEnduranceRegen(bool bCombat)
{
	int base = 0;
	if (!IsStarved()) {
		auto base_data = database.GetBaseData(GetLevel(), GetClass());
		if (base_data) {
			base = static_cast<int>(base_data->end_regen);
			if (!auto_attack && base > 0)
				base += base / 2;
		}
	}

	// so when we are mounted, our local client SpeedRun is always 0, so this is always false, but the packets we process it to our own shit :P
	bool is_running = runmode && animation != 0 && GetHorseId() == 0; // TODO: animation is really what MQ2 calls SpeedRun

	int weight_limit = GetSTR();
	auto level = GetLevel();
	if (GetClass() == MONK) {
		if (level > 99)
			weight_limit = 58;
		else if (level > 94)
			weight_limit = 57;
		else if (level > 89)
			weight_limit = 56;
		else if (level > 84)
			weight_limit = 55;
		else if (level > 79)
			weight_limit = 54;
		else if (level > 64)
			weight_limit = 53;
		else if (level > 63)
			weight_limit = 50;
		else if (level > 61)
			weight_limit = 47;
		else if (level > 59)
			weight_limit = 45;
		else if (level > 54)
			weight_limit = 40;
		else if (level > 50)
			weight_limit = 38;
		else if (level > 44)
			weight_limit = 36;
		else if (level > 29)
			weight_limit = 34;
		else if (level > 14)
			weight_limit = 32;
		else
			weight_limit = 30;
	}

	bool encumbered = (CalcCurrentWeight() / 10) >= weight_limit;

	if (is_running)
		base += level / -15;

	if (encumbered)
		base += level / -15;

	auto item_bonus = GetHeroicAGI() + GetHeroicDEX() + GetHeroicSTA() + GetHeroicSTR();
	item_bonus = item_bonus / 4 / 50;
	item_bonus += itembonuses.EnduranceRegen; // this is capped already
	base += item_bonus;

	base = base * AreaEndRegen + 0.5f;

	auto aa_regen = aabonuses.EnduranceRegen;

	int regen = base;
	if (!bCombat && CanFastRegen() && (IsSitting() || CanMedOnHorse())) {
		auto max_end = GetMaxEndurance();
		int fast_regen = 6 * (max_end / zone->newzone_data.FastRegenEndurance);
		if (aa_regen < fast_regen) // weird, but what the client is doing
			aa_regen = fast_regen;
	}

	regen += aa_regen;
	regen += spellbonuses.EnduranceRegen; // TODO: client does this in buff tick

	return (regen * RuleI(Character, EnduranceRegenMultiplier) / 100);
}