View Single Post
  #3  
Old 08-27-2014, 02:59 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,603
Default

I don't believe special_abilities have been added to Perl yet, it is something that could be done, but I haven't seen it used any where yet.

Here's the $npc->ModifyNPCStat code (this is also used for quest::modifynpcstat):
Code:
void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
{
    std::string id = identifier;
    std::string val = newValue;
    for(int i = 0; i < id.length(); ++i)
    {
        id[i] = std::tolower(id[i]);
    }

    if(id == "ac")
    {
        AC = atoi(val.c_str());
        return;
    }

    if(id == "str")
    {
        STR = atoi(val.c_str());
        return;
    }

    if(id == "sta")
    {
        STA = atoi(val.c_str());
        return;
    }

    if(id == "agi")
    {
        AGI = atoi(val.c_str());
        return;
    }

    if(id == "dex")
    {
        DEX = atoi(val.c_str());
        return;
    }

    if(id == "wis")
    {
        WIS = atoi(val.c_str());
        CalcMaxMana();
        return;
    }

    if(id == "int" || id == "_int")
    {
        INT = atoi(val.c_str());
        CalcMaxMana();
        return;
    }

    if(id == "cha")
    {
        CHA = atoi(val.c_str());
        return;
    }

    if(id == "max_hp")
    {
        base_hp = atoi(val.c_str());
        CalcMaxHP();
        if(cur_hp > max_hp)
            cur_hp = max_hp;
        return;
    }

    if(id == "max_mana")
    {
        npc_mana = atoi(val.c_str());
        CalcMaxMana();
        if(cur_mana > max_mana)
            cur_mana = max_mana;
        return;
    }

    if(id == "mr")
    {
        MR = atoi(val.c_str());
        return;
    }

    if(id == "fr")
    {
        FR = atoi(val.c_str());
        return;
    }

    if(id == "cr")
    {
        CR = atoi(val.c_str());
        return;
    }

    if(id == "pr")
    {
        PR = atoi(val.c_str());
        return;
    }

    if(id == "dr")
    {
        DR = atoi(val.c_str());
        return;
    }

    if(id == "PhR")
    {
        PhR = atoi(val.c_str());
        return;
    }

    if(id == "runspeed")
    {
        runspeed = (float)atof(val.c_str());
        CalcBonuses();
        return;
    }

    if(id == "special_attacks")
    {
        //Added reset flag.
        NPCSpecialAttacks(val.c_str(), 0, 1);
        return;
    }

    if(id == "attack_speed")
    {
        attack_speed = (float)atof(val.c_str());
        CalcBonuses();
        return;
    }

    if(id == "atk")
    {
        ATK = atoi(val.c_str());
        return;
    }

    if(id == "accuracy")
    {
        accuracy_rating = atoi(val.c_str());
        return;
    }

    if(id == "avoidance")
    {
        avoidance_rating = atoi(val.c_str());
        return;
    }

    if(id == "trackable")
    {
        trackable = atoi(val.c_str());
        return;
    }

    if(id == "min_hit")
    {
        min_dmg = atoi(val.c_str());
        return;
    }

    if(id == "max_hit")
    {
        max_dmg = atoi(val.c_str());
        return;
    }

    if(id == "attack_count")
    {
        attack_count = atoi(val.c_str());
        return;
    }

    if(id == "see_invis")
    {
        see_invis = atoi(val.c_str());
        return;
    }

    if(id == "see_invis_undead")
    {
        see_invis_undead = atoi(val.c_str());
        return;
    }

    if(id == "see_hide")
    {
        see_hide = atoi(val.c_str());
        return;
    }

    if(id == "see_improved_hide")
    {
        see_improved_hide = atoi(val.c_str());
        return;
    }

    if(id == "hp_regen")
    {
        hp_regen = atoi(val.c_str());
        return;
    }

    if(id == "mana_regen")
    {
        mana_regen = atoi(val.c_str());
        return;
    }

    if(id == "level")
    {
        SetLevel(atoi(val.c_str()));
        return;
    }

    if(id == "aggro")
    {
        pAggroRange = atof(val.c_str());
        return;
    }

    if(id == "assist")
    {
        pAssistRange = atof(val.c_str());
        return;
    }

    if(id == "slow_mitigation")
    {
        slow_mitigation = atoi(val.c_str());
        return;
    }
    if(id == "loottable_id")
    {
        loottable_id = atof(val.c_str());
        return;
    }
    if(id == "healscale")
    {
        healscale = atof(val.c_str());
        return;
    }
    if(id == "spellscale")
    {
        spellscale = atof(val.c_str());
        return;
    }
}
Reply With Quote