Example #1
0
void
GFGClass::Populate()
{
	const JSize bcount = GetBaseClassCount();
	if (bcount == 0)
		{
		return;
		}

	JString classname, filename;

	// Parse these in reverse order so newer declarations override
	// older ones.

	const JSize count = GetAncestorCount();
	for (JIndex i=count; i>=1; i--)
		{
		GetAncestor(i, &classname, &filename);
		itsLink->ParseClass(this, filename, classname);
		}

	// Parse these last so their function declarations override
	// those of their ancestors.

	for (JIndex i = 1; i <= bcount; i++)
		{
		GetBaseClass(i, &classname, &filename);
		itsLink->ParseClass(this, filename, classname);
		}
}
Example #2
0
bool ObjectInfo::IsSubclassOf(wxString classname)
{
	bool found = false;

	if (GetClassName() == classname)
		found = true;
	else

		for (unsigned int i=0; !found && i < GetBaseClassCount() ; i++)
		{
			shared_ptr<ObjectInfo> base = GetBaseClass(i);
			found = base->IsSubclassOf(classname);
		}

		return found;
}
Example #3
0
File: aa.cpp Project: af4t/Server
void Client::FinishAlternateAdvancementPurchase(AA::Rank *rank, bool ignore_cost) {
	int rank_id = rank->base_ability->first_rank_id;

	if(rank->base_ability->charges > 0) {
		uint32 charges = 0;
		GetAA(rank_id, &charges);

		if(charges > 0) {
			return;
		}

		SetAA(rank_id, rank->current_value, rank->base_ability->charges);
	}
	else {
		SetAA(rank_id, rank->current_value, 0);

		//if not max then send next aa
		if(rank->next) {
			SendAlternateAdvancementRank(rank->base_ability->id, rank->next->current_value);
		}
	}

	int cost = !ignore_cost ? rank->cost : 0;

	m_pp.aapoints -= cost ;
	SaveAA();

	SendAlternateAdvancementPoints();
	SendAlternateAdvancementStats();

	if(rank->prev) {
		Message_StringID(15, AA_IMPROVE,
						 std::to_string(rank->title_sid).c_str(),
						 std::to_string(rank->prev->current_value).c_str(),
						 std::to_string(cost).c_str(),
						 cost == 1 ? std::to_string(AA_POINT).c_str() : std::to_string(AA_POINTS).c_str());

		/* QS: Player_Log_AA_Purchases */
		if(RuleB(QueryServ, PlayerLogAAPurchases)) {
			std::string event_desc = StringFormat("Ranked AA Purchase :: aa_id:%i at cost:%i in zoneid:%i instid:%i", rank->id, cost, GetZoneID(), GetInstanceID());
			QServ->PlayerLogEvent(Player_Log_AA_Purchases, CharacterID(), event_desc);
		}
	}
	else {
		Message_StringID(15, AA_GAIN_ABILITY,
						 std::to_string(rank->title_sid).c_str(),
						 std::to_string(cost).c_str(),
						 cost == 1 ? std::to_string(AA_POINT).c_str() : std::to_string(AA_POINTS).c_str());
		/* QS: Player_Log_AA_Purchases */
		if(RuleB(QueryServ, PlayerLogAAPurchases)) {
			std::string event_desc = StringFormat("Initial AA Purchase :: aa_id:%i at cost:%i in zoneid:%i instid:%i", rank->id, cost, GetZoneID(), GetInstanceID());
			QServ->PlayerLogEvent(Player_Log_AA_Purchases, CharacterID(), event_desc);
		}
	}

	CalcBonuses();

	if(cost > 0) {
		if(title_manager.IsNewAATitleAvailable(m_pp.aapoints_spent, GetBaseClass()))
			NotifyNewTitlesAvailable();
	}
}
Example #4
0
bool Client::CastDiscipline(uint8 disc_id, uint8 level_to_use)
{
    uint8 current_level = GetLevel();
    if(current_level > 60)
        current_level = 60;

    if(level_to_use > current_level || level_to_use == 0)
        return false;

    // reuse_timer is in seconds, ability_timer is in milliseconds.
    uint32 reuse_timer = 0, ability_timer = 0, string = 0;
    int16 spellid = 0;

    switch(disc_id)
    {
    case disc_aggressive:
        reuse_timer = 1620 - (current_level - level_to_use) * 60;
        ability_timer = 180000;
        spellid = 4498;
        string = DISCIPLINE_AGRESSIVE;

        break;
    case disc_precision:
        reuse_timer = 1800 - (current_level - level_to_use) * 60;
        ability_timer = 180000;
        spellid = 4501;
        string = DISCIPLINE_PRECISION;

        break;
    case disc_defensive:
        reuse_timer = 900 - (current_level - level_to_use) * 60;
        ability_timer = 180000;
        spellid = 4499;
        string = DISCIPLINE_DEFENSIVE;

        break;
    case disc_evasive:
        reuse_timer = 900 - (current_level - level_to_use) * 60;
        ability_timer = 180000;
        spellid = 4503;
        string = DISCIPLINE_EVASIVE;

        break;
    case disc_ashenhand:
        reuse_timer = 4320 - (current_level - level_to_use) * 60;
        spellid = 4508;
        string = DISCIPLINE_ASHENHAND;

        break;
    case disc_furious:
        reuse_timer = 3600 - (current_level - level_to_use) * 60;
        ability_timer = 9000;
        if(GetBaseClass() == WARRIOR)
            spellid = 4674;
        else if(GetBaseClass() == MONK)
            spellid = 4509;
        else if(GetBaseClass() == ROGUE)
            spellid = 4673;
        string = DISCIPLINE_FURIOUS;

        break;
    case disc_stonestance:
        reuse_timer = 720 - (current_level - level_to_use) * 60;
        ability_timer = 12000;
        if(GetBaseClass() == MONK)
            spellid = 4510;
        else if(GetBaseClass() == BEASTLORD)
            spellid = 4671;
        string = DISCIPLINE_STONESTANCE;

        break;
    case disc_thunderkick:
        reuse_timer = 420 - (current_level - level_to_use) * 60;
        spellid = 4511;
        string = DISCIPLINE_THUNDERKICK;

        break;
    case disc_fortitude:
        reuse_timer = 3600 - (current_level - level_to_use) * 60;
        ability_timer = 8000;
        if(GetBaseClass() == WARRIOR)
            spellid = 4670;
        else if(GetBaseClass() == MONK)
            spellid = 4502;
        string = DISCIPLINE_FORTITUDE;

        break;
    case disc_fellstrike:
        reuse_timer = 1800 - (current_level - level_to_use) * 60;
        ability_timer = 12000;
        if(GetBaseClass() == WARRIOR)
            spellid = 4675;
        else if(GetBaseClass() == MONK)
            spellid = 4512;
        else if(GetBaseClass() == ROGUE)
            spellid = 4676;
        else if(GetBaseClass() == BEASTLORD)
            spellid = 4678;
        string = DISCIPLINE_FELLSTRIKE;

        break;
    case disc_hundredfist:
        reuse_timer = 1800 - (current_level - level_to_use) * 60;
        ability_timer = 15000;
        if(GetBaseClass() == MONK)
            spellid = 4513;
        else if(GetBaseClass() == ROGUE)
            spellid = 4677;
        string = DISCIPLINE_HUNDREDFIST;

        break;
    case disc_charge:
        reuse_timer = 1800 - (current_level - level_to_use) * 60;
        ability_timer = 14000;
        if(GetBaseClass() == WARRIOR)
            spellid = 4672;
        else if(GetBaseClass() == ROGUE)
            spellid = 4505;
        string = DISCIPLINE_CHARGE;

        break;
    case disc_mightystrike:
        reuse_timer = 3600 - (current_level - level_to_use) * 60;
        ability_timer = 10000;
        spellid = 4514;
        string = DISCIPLINE_MIGHTYSTRIKE;

        break;
    case disc_nimble:
        reuse_timer = 1800 - (current_level - level_to_use) * 60;
        ability_timer = 12000;
        spellid = 4515;
        string = DISCIPLINE_NIMBLE;

        break;
    case disc_silentfist:
        reuse_timer = 540 - (current_level - level_to_use) * 60;
        spellid = 4507;
        if(GetRace() == IKSAR)
            string = DISCIPLINE_SILENTFIST_IKSAR;
        else
            string = DISCIPLINE_SILENTFIST;

        break;
    case disc_kinesthetics:
        reuse_timer = 1800 - (current_level - level_to_use) * 60;
        ability_timer = 18000;
        spellid = 4517;
        string = DISCIPLINE_KINESTHETICS;

        break;
    case disc_holyforge:
        reuse_timer = 4320 - (current_level - level_to_use) * 60;
        ability_timer = 120000;
        spellid = 4500;
        string = DISCIPLINE_HOLYFORGE;

        break;
    case disc_sanctification:
        reuse_timer = 4320 - (current_level - level_to_use) * 60;
        ability_timer = 10000;
        spellid = 4518;
        string = DISCIPLINE_SANCTIFICATION;

        break;
    case disc_trueshot:
        reuse_timer = 4320 - (current_level - level_to_use) * 60;
        ability_timer = 120000;
        spellid = 4506;
        string = DISCIPLINE_TRUESHOT;

        break;
    case disc_weaponshield:
        reuse_timer = 4320 - (current_level - level_to_use) * 60;
        ability_timer = 15000;
        spellid = 4519;
        if(GetGender() == 0)
            string = DISCIPLINE_WPNSLD_MALE;
        else if(GetGender() == 1)
            string = DISCIPLINE_WPNSLD_FEMALE;
        else
            string = DISCIPLINE_WPNSLD_MONSTER;

        break;
    case disc_unholyaura:
        reuse_timer = 4320 - (current_level - level_to_use) * 60;
        spellid = 4520;
        string = DISCIPLINE_UNHOLYAURA;

        break;
    case disc_leechcurse:
        reuse_timer = 4320 - (current_level - level_to_use) * 60;
        ability_timer = 15000;
        spellid = 4504;
        string = DISCIPLINE_LEECHCURSE;

        break;
    case disc_deftdance:
        reuse_timer = 4320 - (current_level - level_to_use) * 60;
        ability_timer = 10000;
        spellid = 4516;
        string = DISCIPLINE_DEFTDANCE;

        break;
    case disc_puretone:
        reuse_timer = 4320 - (current_level - level_to_use) * 60;
        ability_timer = 120000;
        spellid = 4586;
        string = DISCIPLINE_PURETONE;

        break;
    case disc_resistant:
        reuse_timer = 3600 - (current_level - level_to_use) * 60;
        ability_timer = 60000;
        spellid = 4585;
        string = DISCIPLINE_RESISTANT;

        break;
    case disc_fearless:
        reuse_timer = 3600 - (current_level - level_to_use) * 60;
        ability_timer = 11000;
        spellid = 4587;
        string = DISCIPLINE_FEARLESS;

        break;
    default:
        Log.Out(Logs::General, Logs::Discs, "Invalid disc id %d was passed to CastDiscipline.", disc_id);
        return false;
    }

    if(string > 0 && IsDisc(spellid))
    {
        entity_list.MessageClose_StringID(this, false, 50, CC_User_Disciplines, string, GetName());
        p_timers.Start(pTimerDisciplineReuseStart, reuse_timer);
        if(ability_timer > 0)
        {
            disc_ability_timer.SetTimer(ability_timer);
        }
        else
        {
            Log.Out(Logs::General, Logs::Discs, "Disc %d is an instant effect", disc_id);
        }

        SetActiveDisc(disc_id, spellid);
        SpellFinished(spellid, this);
    }
    else
    {
        Log.Out(Logs::General, Logs::Discs, "Disc: %d Invalid stringid or spellid specified.", disc_id);
        return false;
    }

    EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineChange, sizeof(ClientDiscipline_Struct));
    ClientDiscipline_Struct *d = (ClientDiscipline_Struct*)outapp->pBuffer;
    d->disc_id = disc_id;
    QueuePacket(outapp);
    safe_delete(outapp);

    return true;
}