Exemple #1
0
void Client::ChangeTributeSettings(TributeInfo_Struct *t) {
	int r;
	for (r = 0; r < EQEmu::legacy::TRIBUTE_SIZE; r++) {

		m_pp.tributes[r].tribute = TRIBUTE_NONE;

		uint32 tid = t->tributes[r];
		if(tid == TRIBUTE_NONE)
			continue;

		if(tribute_list.count(tid) != 1)
			continue;	//print a cheater warning?

		TributeData &d = tribute_list[tid];

		//make sure they chose a valid tier
		if(t->tiers[r] >= d.tier_count)
			continue;	//print a cheater warning?

		//might want to check required level, even though its checked before activate

		m_pp.tributes[r].tribute = tid;
		m_pp.tributes[r].tier = t->tiers[r];
	}

	DoTributeUpdate();
}
Exemple #2
0
void Client::ToggleTribute(bool enabled) {
	if(enabled) {
		//make sure they have enough points to be activating this...
		int r;
		uint32 cost = 0;
		uint32 level = GetLevel();
		for (r = 0; r < EQEmu::legacy::TRIBUTE_SIZE; r++) {
			uint32 tid = m_pp.tributes[r].tribute;
			if(tid == TRIBUTE_NONE)
				continue;

			if(tribute_list.count(tid) != 1)
				continue;

			if(m_pp.tributes[r].tier >= MAX_TRIBUTE_TIERS) {
				m_pp.tributes[r].tier = 0;	//sanity check.
				continue;
			}

			TributeData &d = tribute_list[tid];

			TributeLevel_Struct &tier = d.tiers[m_pp.tributes[r].tier];

			if(level < tier.level) {
				Message(0, "You are not high enough level to activate this tribute!");
				ToggleTribute(false);
				continue;
			}

			cost += tier.cost;
		}

		if(cost > m_pp.tribute_points) {
			Message(13, "You do not have enough tribute points to activate your tribute!");
			ToggleTribute(false);
			return;
		}
		AddTributePoints(0-cost);

		//reset their timer, since they just paid for a full duration
		m_pp.tribute_time_remaining = Tribute_duration;	//full duration
		tribute_timer.Start(m_pp.tribute_time_remaining);

		m_pp.tribute_active = 1;
	} else {
		m_pp.tribute_active = 0;
		tribute_timer.Disable();
	}
	DoTributeUpdate();
}
Exemple #3
0
void Client::SetLevel(uint8 set_level, bool command)
{
        if (GetEXPForLevel(set_level) == 0xFFFFFFFF) {
                LogFile->write(EQEMuLog::Error,"Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level);
                return;
        }

        EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct));
        LevelUpdate_Struct* lu = (LevelUpdate_Struct*)outapp->pBuffer;
        lu->level = set_level;
        if(m_pp.level2 != 0)
                lu->level_old = m_pp.level2;
        else
                lu->level_old = level;

        level = set_level;

        if(IsRaidGrouped())
        {
                Raid *r = this->GetRaid();
                if(r){
                        r->UpdateLevel(GetName(), set_level);
                }
        }
        if(set_level > m_pp.level2)
        {
                if(m_pp.level2 == 0)
                        m_pp.points += 5;
                else
                        m_pp.points += (5 * (set_level - m_pp.level2));

                m_pp.level2 = set_level;
        }
        if(set_level > m_pp.level) {
            parse->EventPlayer(EVENT_LEVEL_UP, this, "", 0);
        }

        m_pp.level = set_level;
        if (command){
                m_pp.exp = GetEXPForLevel(set_level);
                Message(15, "Welcome to level %i!", set_level);
                lu->exp = 0;
        }
        else {
                float tmpxp = (float) ( (float) m_pp.exp - GetEXPForLevel( GetLevel() )) /
                                                ( (float) GetEXPForLevel(GetLevel()+1) - GetEXPForLevel(GetLevel()));
                lu->exp =  (uint32)(330.0f * tmpxp);
    }
        QueuePacket(outapp);
        safe_delete(outapp);
        this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change

		LogFile->write(EQEMuLog::Normal,"Setting Level for %s to %i", GetName(), set_level);

        CalcBonuses();
        if(!RuleB(Character, HealOnLevel))
        {
                int mhp = CalcMaxHP();
                if(GetHP() > mhp)
                        SetHP(mhp);
        }
        else
        {
                SetHP(CalcMaxHP());             // Why not, lets give them a free heal
        }
		
		DoTributeUpdate();
        SendHPUpdate();
        SetMana(CalcMaxMana());
        UpdateWho();
		if(GetMerc())
			UpdateMercLevel();
        Save();
}
Exemple #4
0
void Client::SetLevel(uint8 set_level, bool command)
{
	if (GetEXPForLevel(set_level) == 0xFFFFFFFF) {
		Log.Out(Logs::General, Logs::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level);
		return;
	}

	EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct));
	LevelUpdate_Struct* lu = (LevelUpdate_Struct*)outapp->pBuffer;
	lu->level = set_level;
	if(m_pp.level2 != 0)
		lu->level_old = m_pp.level2;
	else
		lu->level_old = level;

	level = set_level;

	if(IsRaidGrouped()) {
		Raid *r = this->GetRaid();
		if(r){
			r->UpdateLevel(GetName(), set_level);
		}
	}
	if(set_level > m_pp.level2) {
		if(m_pp.level2 == 0)
			m_pp.points += 5;
		else
			m_pp.points += (5 * (set_level - m_pp.level2));

		m_pp.level2 = set_level;
	}
	if(set_level > m_pp.level) {
		parse->EventPlayer(EVENT_LEVEL_UP, this, "", 0);
		/* QS: PlayerLogLevels */
		if (RuleB(QueryServ, PlayerLogLevels)){
			std::string event_desc = StringFormat("Leveled UP :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, this->GetZoneID(), this->GetInstanceID());
			QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc); 
		}
	}
	else if (set_level < m_pp.level){
		/* QS: PlayerLogLevels */
		if (RuleB(QueryServ, PlayerLogLevels)){
			std::string event_desc = StringFormat("Leveled DOWN :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, this->GetZoneID(), this->GetInstanceID());
			QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc);
		}
	}

	m_pp.level = set_level;
	if (command){
		m_pp.exp = GetEXPForLevel(set_level);
		Message(15, "Welcome to level %i!", set_level);
		lu->exp = 0;
	}
	else {
		float tmpxp = (float) ( (float) m_pp.exp - GetEXPForLevel( GetLevel() )) / ( (float) GetEXPForLevel(GetLevel()+1) - GetEXPForLevel(GetLevel()));
		lu->exp = (uint32)(330.0f * tmpxp);
	}
	QueuePacket(outapp);
	safe_delete(outapp);
	this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change

	Log.Out(Logs::General, Logs::Normal, "Setting Level for %s to %i", GetName(), set_level);

	CalcBonuses();

	if(!RuleB(Character, HealOnLevel)) {
		int mhp = CalcMaxHP();
		if(GetHP() > mhp)
			SetHP(mhp);
	}
	else {
		SetHP(CalcMaxHP()); // Why not, lets give them a free heal
	}

	DoTributeUpdate();
	SendHPUpdate();
	SetMana(CalcMaxMana());
	UpdateWho();

	UpdateMercLevel();

	Save();
}