Пример #1
0
    void OnLoad()
    {
        if (_unit->IsPet())
        {
            Pet* s = TO< Pet* >(_unit);
            Player* owner = s->GetPetOwner();

            float owner_bonus = static_cast<float>(owner->GetDamageDoneMod(SCHOOL_SHADOW) * 0.375f); // 37.5%
            s->BaseAttackType = SCHOOL_SHADOW; // Melee hits are supposed to do damage with the shadow school
            s->SetBaseAttackTime(MELEE, 1500); // Shadowfiend is supposed to do 10 attacks, sometimes it can be 11
            s->SetMinDamage(s->GetMinDamage() + owner_bonus);
            s->SetMaxDamage(s->GetMaxDamage() + owner_bonus);
            s->BaseDamage[0] += owner_bonus;
            s->BaseDamage[1] += owner_bonus;

            Unit* uTarget = s->GetMapMgr()->GetUnit(owner->GetTargetGUID());
            if ((uTarget != NULL) && isAttackable(owner, uTarget))
            {
                s->GetAIInterface()->AttackReaction(uTarget, 1);
                s->GetAIInterface()->setNextTarget(uTarget);
            }
        }
    }
Пример #2
0
//.pet create
bool ChatHandler::HandlePetCreateCommand(const char* args, WorldSession* m_session)
{
    Player* selected_player = GetSelectedPlayer(m_session, true, true);
    if (selected_player == nullptr)
        return true;

    if (!*args)
        return false;

    uint32 entry = atol(args);
    CreatureProperties const* creature_proto = sMySQLStore.GetCreatureProperties(entry);
    if (creature_proto == nullptr)
    {
        RedSystemMessage(m_session, "Creature Entry: %u is not a valid endtry!", entry);
        return true;
    }

    selected_player->DismissActivePets();
    selected_player->RemoveFieldSummon();

    float followangle = -M_PI_FLOAT * 2;
    LocationVector vector(selected_player->GetPosition());
    vector.x += (3 * (cosf(followangle + selected_player->GetOrientation())));
    vector.y += (3 * (sinf(followangle + selected_player->GetOrientation())));

    Pet* pet = objmgr.CreatePet(entry);
    if (!pet->CreateAsSummon(entry, creature_proto, nullptr, selected_player, nullptr, 1, 0, &vector, true))
    {
        pet->DeleteMe();
        return true;
    }

    pet->GetAIInterface()->SetUnitToFollowAngle(followangle);

    if (selected_player != m_session->GetPlayer())
    {
        sGMLog.writefromsession(m_session, "used created pet with entry %u for player %s", entry, selected_player->GetName());
        BlueSystemMessage(m_session, "Pet with entry %u created for player %s.", entry, selected_player->GetName());
        BlueSystemMessage(selected_player->GetSession(), "%s created a pet with entry %u for you.", m_session->GetPlayer()->GetName(), entry);

    }
    else
    {
        BlueSystemMessage(m_session, "Pet with entry %u created.", entry);
    }

    return true;
}