当前位置: 首页>>代码示例>>C++>>正文


C++ GetPlayerBot函数代码示例

本文整理汇总了C++中GetPlayerBot函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPlayerBot函数的具体用法?C++ GetPlayerBot怎么用?C++ GetPlayerBot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetPlayerBot函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetPlayerBot

void PlayerbotHunterAI::Pull()
{
    if (!AUTO_SHOT) return;

    // check ammo
    uint32 ammo_id = GetPlayerBot()->GetUInt32Value(PLAYER_AMMO_ID);
    if (!ammo_id) {
        GetPlayerBot()->Say("I'm out of ammo.", LANG_UNIVERSAL);
        return;
    }

    Unit* pTarget = ObjectAccessor::GetUnit(*GetMaster(), GetMaster()->GetSelection());
    if (pTarget==NULL || pTarget->IsFriendlyTo(GetMaster()))
    {
        GetPlayerBot()->Say("Invalid target", LANG_UNIVERSAL);
        GetAI()->Follow(*GetMaster());
        return;
    }

    m_role = BOT_ROLE_DPS_RANGED;
    m_pulling = true;
    GetAI()->SetIgnoreUpdateTime(0);

    if(GetPlayerBot()->GetPet())
        GetPlayerBot()->GetPet()->SetReactState(REACT_PASSIVE);
}
开发者ID:Anonymus111,项目名称:chaoscore,代码行数:26,代码来源:PlayerbotHunterAI.cpp

示例2: GetHealthPercentRaid

uint8 PlayerbotClassAI::GetHealthPercentRaid(Player *gPlayer, uint8 &countNeedHealing)
{
    uint8 validMemberCount=0;
    uint16 totalHPPercent=0;
    std::list<Unit*> unitList;
    gPlayer->GetRaidMember(unitList,30);
    if(!unitList.empty()){
      for (std::list<Unit*>::iterator itr = unitList.begin() ; itr!=unitList.end();++itr) {
        //Player *tPlayer = GetPlayerBot()->GetObjPlayer((*itr)->GetGUID());
        Unit *tPlayer = sObjectMgr->GetPlayer((*itr)->GetGUID());
        if(tPlayer == NULL) continue;
        if(tPlayer->isDead()) continue;
        if(GetPlayerBot()->GetAreaId() != tPlayer->GetAreaId()) continue;
        //if(tPlayer->GetGUID() == GetPlayerBot()->GetGUID()) continue;
        if(GetPlayerBot()->GetDistance(tPlayer) > 30) continue;
        uint8 fndHPPercent =  tPlayer->GetHealth()*100 / tPlayer->GetMaxHealth();
        totalHPPercent+=fndHPPercent;
        validMemberCount++;
        if (fndHPPercent < 100) countNeedHealing++;

        //const std::string myname = GetPlayerBot()->GetName();
        //const std::string hisname = tPlayer->GetName();
        //sLog->outDebug("me = %s, checked= %s %u [%u / %u]", myname.c_str(), hisname.c_str(), fndHPPercent, tPlayer->GetHealth(), tPlayer->GetMaxHealth());

      }
    }
    if (validMemberCount == 0) return 100;
    return totalHPPercent / validMemberCount;
}
开发者ID:Togy,项目名称:prydevserv_backup,代码行数:29,代码来源:PlayerbotClassAI.cpp

示例3: GetPlayerBot

bool PlayerbotDruidAI::RezTarget (Unit *target)
{
    if(!target || target->isAlive()) return false;
    Player *m_bot = GetPlayerBot();
    if (target->IsNonMeleeSpellCasted(true)) { return false; } //Already resurrected

    if (m_bot->isInCombat())
    {
        if (!CanCast(REBIRTH,target)) return false;
        Unit *m_tank = FindMainTankInRaid(m_bot);
        if (!m_tank) m_tank = m_bot;
        if (target->GetGUID() != m_tank->GetGUID() &&
            (target->getClass() != (uint8) CLASS_PRIEST || target->getClass() != (uint8) CLASS_DRUID || target->getClass() != (uint8) CLASS_PALADIN) ) return false;
        std::string msg = "Rezzing ";
        msg += target->GetName();
       // msg += " with ";
       // msg += *REZZSpell->SpellName;
        GetPlayerBot()->Say(msg, LANG_UNIVERSAL);
        return CastSpell(REBIRTH, target);
    }
    else
    {
        if (!CanCast(REVIVE,target)) return false;
        std::string msg = "Rezzing ";
        msg += target->GetName();
       // msg += " with ";
       // msg += *REZZSpell->SpellName;
        GetPlayerBot()->Say(msg, LANG_UNIVERSAL);
        return CastSpell(REVIVE, target);
    }
    return false;
}
开发者ID:Anonymus111,项目名称:chaoscore,代码行数:32,代码来源:PlayerbotDruidAI.cpp

示例4: u_check

Unit *PlayerbotClassAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
{
    Unit *pUnit = NULL;
    Trinity::MostHPMissingInRange u_check(GetPlayerBot(), range, MinHPDiff);
    Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(GetPlayerBot(), pUnit, u_check);

    GetPlayerBot()->VisitNearbyObject(range, searcher);

    return pUnit;
}
开发者ID:Togy,项目名称:prydevserv_backup,代码行数:10,代码来源:PlayerbotClassAI.cpp

示例5: GetPlayerBot

bool PlayerbotPaladinAI::RezTarget (Unit *target)
{
    if(!target || target->isAlive()) return false;
    Player *m_bot = GetPlayerBot();
    if (target->IsNonMeleeSpellCasted(true)) { return false; } //Already resurrected
    if (m_bot->isInCombat()) { return false; }

    if (!CanCast(REDEMPTION,target)) return false;
    std::string msg = "Rezzing ";
    msg += target->GetName();
    GetPlayerBot()->Say(msg, LANGUAGE_UNIVERSAL);
    return CastSpell(REDEMPTION, target, false);
}
开发者ID:Crash911,项目名称:RaptoredSkyFire,代码行数:13,代码来源:PlayerbotPaladinAI.cpp

示例6: GetAI

bool PlayerbotRogueAI::ChangeWeaponEnchants()
{
    PlayerbotAI *ai = GetAI();
    Player *m_bot = GetPlayerBot();
    if (!m_bot || !ai || m_bot->isDead()) { return false; }

    Item *weap;
    Item *poison;
        
    weap = m_bot->GetWeaponForAttack(BASE_ATTACK);
    if (weap && !weap->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
    {
        poison = GetAI()->FindPoisonForward();
        if(poison == NULL) return false;
        GetAI()->PoisonWeapon(*poison, poison->GetProto()->Spells[0].SpellId, TARGET_FLAG_ITEM, EQUIPMENT_SLOT_MAINHAND);
        return true;
    }
    weap = m_bot->GetWeaponForAttack(OFF_ATTACK);
    if (weap && !weap->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
    {
        poison = GetAI()->FindPoisonBackward();
        if(poison == NULL) return false;
        GetAI()->PoisonWeapon(*poison, poison->GetProto()->Spells[0].SpellId, TARGET_FLAG_ITEM, EQUIPMENT_SLOT_OFFHAND);
        return true;
    }
    return false;
}
开发者ID:Mferrill,项目名称:BotCore,代码行数:27,代码来源:PlayerbotRogueAI.cpp

示例7: GetAI

void PlayerbotDeathKnightAI::DoNonCombatActions()
{
	PlayerbotAI* ai = GetAI();
	Player *m_bot = GetPlayerBot();
    if (!m_bot)
        return;

    SpellSequence = SPELL_DK_UNHOLY;

    // buff master with HORN_OF_WINTER
    if (HORN_OF_WINTER> 0)
        (!GetMaster()->HasAura(HORN_OF_WINTER,0) && ai->CastSpell (HORN_OF_WINTER, *GetMaster()));

    // hp check
    if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
        m_bot->SetStandState(UNIT_STAND_STATE_STAND);

    Item* pItem = ai->FindFood();
    Item* fItem = ai->FindBandage();

    if (pItem != NULL && ai->GetHealthPercent() < 30)
    {
        ai->TellMaster("I could use some food.");
        ai->UseItem(*pItem);
        ai->SetIgnoreUpdateTime(30);
        return;
    }
    else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, 0) && ai->GetHealthPercent() < 70)
    {
        ai->TellMaster("I could use first aid.");
        ai->UseItem(*fItem);
        ai->SetIgnoreUpdateTime(8);
        return;
    }
} // end DoNonCombatActions
开发者ID:Chrissuit33,项目名称:mangos,代码行数:35,代码来源:PlayerbotDeathKnightAI.cpp

示例8: GetAI

void PlayerbotDruidAI::HealTarget(Unit &target, uint8 hp)
{
    PlayerbotAI* ai = GetAI();
    Player *m_bot = GetPlayerBot();

    if (hp < 70 && REJUVENATION > 0 && !target.HasAura(REJUVENATION, EFFECT_INDEX_0) && !target.HasAura(REGROWTH, EFFECT_INDEX_0) && ai->GetManaPercent() >=21)
        ai->CastSpell(REJUVENATION, target);

	if (hp < 60 && LIFEBLOOM > 0 && !target.HasAura(LIFEBLOOM, EFFECT_INDEX_0) && ai->GetManaPercent() >= 28)
        ai->CastSpell(LIFEBLOOM, target);

    if (hp < 55 && REGROWTH > 0 && !target.HasAura(REGROWTH, EFFECT_INDEX_0) && !target.HasAura(REJUVENATION, EFFECT_INDEX_0) && ai->GetManaPercent() >= 33)
        ai->CastSpell(REGROWTH, target);

	if (hp < 50 && SWIFTMEND > 0 && target.HasAura(REJUVENATION, EFFECT_INDEX_0) || target.HasAura(REGROWTH, EFFECT_INDEX_0) && ai->GetManaPercent() >= 16)
        ai->CastSpell(SWIFTMEND, target);

    if (hp < 45 && WILD_GROWTH > 0 && !target.HasAura(WILD_GROWTH, EFFECT_INDEX_0) && ai->GetManaPercent() >= 26)
        ai->CastSpell(WILD_GROWTH, target);

	if (hp < 30 && NOURISH > 0 && ai->GetManaPercent() >= 18)
        ai->CastSpell(NOURISH, target);

	if (hp < 25 && HEALING_TOUCH > 0 && ai->GetManaPercent() >= 38)
        ai->CastSpell(HEALING_TOUCH, target);
} // end HealTarget
开发者ID:aresxii,项目名称:aresxii,代码行数:26,代码来源:PlayerbotDruidAI.cpp

示例9: GetPlayerBot

bool PlayerbotShamanAI::HealTarget(Unit *target, uint8 hp)
{
    if(!target || target->isDead()) return false;
    Player *m_bot = GetPlayerBot();

    if(hp < 30 && m_bot->isInCombat() && CastSpell(NATURES_SWIFTNESS, m_bot)) {} // NO gcd
    if(hp < 60 && CanCast(HEAL,target,true) && m_bot->HasAura(NATURES_SWIFTNESS) && CastSpell(HEAL, target, false)) {
        return true;
    }
    if(hp < 30 && CastSpell(LESSER_HEAL,target,true,true)) {
        return true;
    }
    if(hp < 40 && m_bot->getRace() == (uint8) RACE_DRAENEI && CastSpell(R_GIFT_OF_NAARU,target)) {} // no GCD
    if(hp < 65 && CanCast(EARTH_SHIELD,target) && !m_bot->HasAura(EARTH_SHIELD,m_bot->GetGUID()) && CastSpell(EARTH_SHIELD,target,false)) {
        return true;
    }
    if(hp < 65 && CastSpell(HEAL,target,true,true)) {
        return true;
    }
    if(hp < 85 && CastSpell(LESSER_HEAL,target,true,true)) {
        return true;
    }

    return false;
} //end HealTarget
开发者ID:Crash911,项目名称:RaptoredSkyFire,代码行数:25,代码来源:PlayerbotShamanAI.cpp

示例10: GetAI

void PlayerbotDruidAI::DoNonCombatActions()
{
    PlayerbotAI *ai = GetAI();
    Player *m_bot = GetPlayerBot();
    if (!m_bot || !ai || m_bot->isDead()) { return; }

    //If Casting or Eating/Drinking return
    if (m_bot->HasUnitState(UNIT_STAT_CASTING)) { return; }
    if (m_bot->getStandState() == UNIT_STAND_STATE_SIT) { return; }

    //buff and heal raid
    if (DoSupportRaid(GetMaster())) { return; }
    if (m_bot->GetGroup() && GetMaster()->GetGroup() != m_bot->GetGroup() && DoSupportRaid(m_bot)) { return; }

    //heal pets and bots
    Unit *target = DoSelectLowestHpFriendly(30, 1000);
    if (target && target->isAlive() && HealTarget(target, target->GetHealth()*100 / target->GetMaxHealth())) { return; }

    //mana/hp check
    //Don't bother with eating, if low on hp, just let it heal themself
    if (m_bot->getRace() == (uint8) RACE_UNDEAD_PLAYER && ai->GetHealthPercent() < 75 && CastSpell(R_CANNIBALIZE,m_bot)) { return; }
    if (ai->GetManaPercent() < 10 && CastSpell (INNERVATE, m_bot)) { return; } //Need mana fast
    if (m_bot->GetHealth() < m_bot->GetMaxHealth() &&
        (ai->GetForm() != FORM_CAT && ai->GetForm() != FORM_MOONKIN && ai->GetForm() != FORM_DIREBEAR && ai->GetForm() != FORM_BEAR)
        && CastSpell(REGROWTH,m_bot)) { return; }
    if (ai->GetManaPercent() < 50) { ai->Feast(); }

} //end DoNonCombatActions
开发者ID:Anonymus111,项目名称:chaoscore,代码行数:28,代码来源:PlayerbotDruidAI.cpp

示例11:

Player * PlayerbotClassAI::FindMage(Player *gPlayer)
{
    Group::MemberSlotList const &groupSlot = gPlayer->GetGroup()->GetMemberSlots();
    for(Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
    {
        Player *tPlayer = sObjectMgr->GetPlayer(itr->guid);

        if(tPlayer == NULL) continue;
        if(tPlayer->GetGUID() == GetPlayerBot()->GetGUID()) continue;
        if(GetPlayerBot()->GetAreaId() != gPlayer->GetAreaId()) continue;
        if(GetPlayerBot()->GetDistance(tPlayer) > 30) continue;

        if (tPlayer->getClass() == CLASS_MAGE) return tPlayer;
    }
    return NULL;
}
开发者ID:Togy,项目名称:prydevserv_backup,代码行数:16,代码来源:PlayerbotClassAI.cpp

示例12: GetPlayerBot

//Playerbot mod: logs out a Playerbot.
void WorldSession::LogoutPlayerBot(uint64 guid, bool Save)
{
    Player *pPlayerBot = GetPlayerBot(guid);

    if(pPlayerBot) //log out any playbots I have
    {
        //if (pPlayerBot->IsMounted()) pPlayerBot->GetPlayerbotAI()->GetClassAI()->Unmount();

        pPlayerBot->CombatStop();
        if(pPlayerBot->HaveBot())
            pPlayerBot->SetBotMustDie();

        // remove from group
        Group* m_group = pPlayerBot->GetGroup();
        if (m_group) {
            if (m_group->RemoveMember(pPlayerBot->GetGUID(),GROUP_REMOVEMETHOD_DEFAULT) <= 1) {
                delete m_group;
            }
        }

        WorldSession *pPlayerBotWorldSession = pPlayerBot->m_session;
        m_playerBots.erase(guid); //deletes bot player ptr inside this WorldSession PlayerBotMap
        pPlayerBotWorldSession->LogoutPlayer(Save); //this will delete the bot Player object and PlayerbotAI object
        delete pPlayerBotWorldSession; //finally delete the bot's WorldSession
    }
}
开发者ID:Erotix8210,项目名称:prydevserv_backup,代码行数:27,代码来源:WorldSession.cpp

示例13: GetAI

void PlayerbotDeathKnightAI::DoNonCombatActions()
{
    PlayerbotAI *ai = GetAI();
    Player *m_bot = GetPlayerBot();
    if (!m_bot || !ai || m_bot->isDead()) { return; }

    //If Casting or Eating/Drinking return
    if (m_bot->HasUnitState(UNIT_STATE_CASTING)) { return; }
    if (m_bot->getStandState() == UNIT_STAND_STATE_SIT) { return; }

    //Buff UP
    if (CastSpell(HORN_OF_WINTER,m_bot)) { return; }
    if (CastSpell(BONE_SHIELD,m_bot)) { return; }

    //mana/hp check
    if (m_bot->getRace() == (uint8) RACE_UNDEAD_PLAYER && ai->GetHealthPercent() < 75 && CastSpell(R_CANNIBALIZE,m_bot)) { return; }
    if (m_bot->GetHealth() < m_bot->GetMaxHealth() && CastSpell(RUNE_TAP,m_bot)) { return; } //no gcd but lets give the others a time to heal
    if (ai->GetHealthPercent() < 30) { ai->Feast(); }
    //Item* fItem = ai->FindBandage();
    /* if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, 0) && ai->GetHealthPercent() < 70)
    {
        ai->TellMaster("I could use first aid.");
        ai->UseItem(*fItem);
        ai->SetIgnoreUpdateTime(8);
        return;
    }  */
} // end DoNonCombatActions
开发者ID:Crash911,项目名称:RaptoredSkyFire,代码行数:27,代码来源:PlayerbotDeathKnightAI.cpp

示例14: GetPlayerBot

void PlayerbotMgr::LogoutPlayerBot(ObjectGuid guid)
{
    Player* bot = GetPlayerBot(guid);
    if (bot)
    {
        for (uint8 i = 0; i < MAX_ARENA_SLOT; ++i)
        {
            uint32 a_id = bot->GetArenaTeamId(i);
            if (a_id==0)
                continue;

            ArenaTeam *at = sObjectMgr.GetArenaTeamById(a_id);
            if (!at)
                continue;

            if (at->DisbandNoSave(bot))
                delete at;
        }

        if (bot->GetGroup())
            bot->RemoveFromGroup();

        WorldSession * botWorldSessionPtr = bot->GetSession();
        botWorldSessionPtr->LogoutPlayer(true); // this will delete the bot Player object and PlayerbotAI object
        delete botWorldSessionPtr;  // finally delete the bot's WorldSession
    }
}
开发者ID:Archives,项目名称:easy-mangos,代码行数:27,代码来源:PlayerbotMgr.cpp

示例15: GetAI

void PlayerbotShamanAI::DoNonCombatActions()
{
    PlayerbotAI *ai = GetAI();
    Player *m_bot = GetPlayerBot();
    if (!m_bot || !ai || m_bot->isDead()) { return; }

    //If Casting or Eating/Drinking return
    if (m_bot->HasUnitState(UNIT_STAT_CASTING)) { return; }
    if (m_bot->getStandState() == UNIT_STAND_STATE_SIT) { return; }

    //buff and heal raid
    if (DoSupportRaid(m_bot)) { return; }

    //heal pets and bots
    Unit *target = DoSelectLowestHpFriendly(40, 1000);
    if (target && target->isAlive() && HealTarget(target, target->GetHealth()*100 / target->GetMaxHealth())) { return; }

    //Buffs
    if (ChangeWeaponEnchants()) { return; }
    if (CastSpell(WATER_SHIELD,m_bot)) { return; }
    if (CastSpell(EARTH_SHIELD,m_bot)) { return; }

    //mana/hp check
    //Don't bother with eating, if low on hp, just let it heal themself
    if (m_bot->getRace() == (uint8) RACE_UNDEAD_PLAYER && ai->GetHealthPercent() < 75 && CastSpell(R_CANNIBALIZE,m_bot)) { return; }
    if (m_bot->GetHealth() < m_bot->GetMaxHealth() && CastSpell(LESSER_HEAL,m_bot)) { return; }
	if (ai->GetManaPercent() < 50) { ai->Feast(); }

} //end DoNonCombatActions
开发者ID:Anonymus111,项目名称:chaoscore,代码行数:29,代码来源:PlayerbotShamanAI.cpp


注:本文中的GetPlayerBot函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。