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
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
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
void PlayerbotMageAI::DoNonCombatActions() { PlayerbotAI *ai = GetAI(); Player *m_bot = GetPlayerBot(); if (!m_bot || !ai || m_bot->isDead()) { return; } // make sure pet stays by your side uint64 pet_guid = m_bot->GetPetGUID(); if (pet_guid>0){ Pet* pet = ObjectAccessor::GetPet(*m_bot, pet_guid); Unit *unit = ObjectAccessor::GetUnit(*m_bot, pet_guid); if (unit!=NULL){ m_bot->GetSession()->HandlePetActionHelper(unit, pet_guid, COMMAND_FOLLOW, ACT_COMMAND, 0); m_bot->GetSession()->HandlePetActionHelper(unit, pet_guid, REACT_DEFENSIVE, ACT_REACTION, 0); } } //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,30,0,0,0,1,1)) { return; } //Own Buffs if (MOLTEN_ARMOR) { if ( CastSpell(MOLTEN_ARMOR,m_bot)) { return; } } else if (CastSpell(MAGE_ARMOR,m_bot)) { return; } if (CastSpell(COMBUSTION,m_bot)) { } //nogcd if (!HasAuraName(m_bot, MANA_SHIELD)) CastSpell (MANA_SHIELD); //conjure food & water Item *pItem = ai->FindDrink(); if(pItem == NULL && ai->GetManaPercent() >= 48) { if (CastSpell(CONJURE_REFRESHMENT, m_bot)) { return; } if (CastSpell(CONJURE_WATER, m_bot)) { return; } return; } pItem = ai->FindFood(); if(pItem == NULL && ai->GetManaPercent() >= 48) { if (CastSpell(CONJURE_REFRESHMENT, m_bot)) { return; } if (CastSpell(CONJURE_FOOD, m_bot)) { return; } return; } //Conjure mana gem?? //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() < 50 && CastSpell (EVOCATION, m_bot)) { return; } if (ai->GetManaPercent() < 50 || ai->GetHealthPercent() < 50) { ai->Feast(); } } //end DoNonCombatActions
void PlayerbotRogueAI::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 Up if (ChangeWeaponEnchants()) { return; } //mana/hp check if (m_bot->getRace() == (uint8) RACE_UNDEAD_PLAYER && ai->GetHealthPercent() < 75 && CastSpell(R_CANNIBALIZE,m_bot)) { return; } if (ai->GetHealthPercent() < 50) { ai->Feast(); } } //end DoNonCombatActions
void PlayerbotHunterAI::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 group if (CastSpell(TRUESHOT_AURA, 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 (ai->GetManaPercent() < 20 || ai->GetHealthPercent() < 30) { ai->Feast(); } #pragma region Check Pet // check for pet if( PET_SUMMON>0 && !m_petSummonFailed && HasPet(m_bot) ) { // we can summon pet, and no critical summon errors before Pet *pet = m_bot->GetPet(); if( !pet ) { // summon pet if( PET_SUMMON>0 && ai->CastSpell(PET_SUMMON,m_bot) ) ai->TellMaster( "summoning pet." ); else { m_petSummonFailed = true; ai->TellMaster( "summon pet failed!" ); } } else if( pet->getDeathState() != ALIVE ) { // revive pet if( PET_REVIVE>0 && ai->GetManaPercent()>=80 && ai->CastSpell(PET_REVIVE,m_bot) ) ai->TellMaster( "reviving pet." ); } else if( ((float)pet->GetHealth()/(float)pet->GetMaxHealth()) < 0.5f ) { // heal pet when health lower 50% if( PET_MEND>0 && !pet->getDeathState() != ALIVE && !pet->HasAura(PET_MEND,0) && ai->GetManaPercent()>=13 && ai->CastSpell(PET_MEND,m_bot) ) ai->TellMaster( "healing pet." ); } else if(pet->GetHappinessState() != HAPPY) // if pet is hungry { Unit *caster = (Unit*)m_bot; // list out items in main backpack for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; slot++) { Item* const pItem = m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot); if (pItem) { const ItemTemplate* const pItemProto = pItem->GetTemplate(); if (!pItemProto ) continue; if(pet->HaveInDiet(pItemProto)) // is pItem in pets diet { //sLog.outDebug("Food for pet: %s",pItemProto->Name1); caster->CastSpell(caster,51284,true); // pet feed visual uint32 count = 1; // number of items used int32 benefit = pet->GetCurrentFoodBenefitLevel(pItemProto->ItemLevel); // nutritional value of food m_bot->DestroyItemCount(pItem,count,true); // remove item from inventory m_bot->CastCustomSpell(m_bot,PET_FEED,&benefit,NULL,NULL,true); // feed pet ai->TellMaster( "feeding pet." ); ai->SetIgnoreUpdateTime(10); return; } } } // list out items in other removable backpacks for (uint8 bag = INVENTORY_SLOT_BAG_START; bag < INVENTORY_SLOT_BAG_END; ++bag) { const Bag* const pBag = (Bag*) m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, bag); if (pBag) { for (uint8 slot = 0; slot < pBag->GetBagSize(); ++slot) { Item* const pItem = m_bot->GetItemByPos(bag, slot); if (pItem) { const ItemTemplate* const pItemProto = pItem->GetTemplate(); if (!pItemProto ) continue; if(pet->HaveInDiet(pItemProto)) // is pItem in pets diet { //sLog.outDebug("Food for pet: %s",pItemProto->Name1); caster->CastSpell(caster,51284,true); // pet feed visual uint32 count = 1; // number of items used int32 benefit = pet->GetCurrentFoodBenefitLevel(pItemProto->ItemLevel); // nutritional value of food m_bot->DestroyItemCount(pItem,count,true); // remove item from inventory m_bot->CastCustomSpell(m_bot,PET_FEED,&benefit,NULL,NULL,true); // feed pet ai->TellMaster( "feeding pet." ); ai->SetIgnoreUpdateTime(10); return; } } } } } if( pet->HasAura(PET_MEND, 0) && !pet->HasAura(PET_FEED, 0)) ai->TellMaster( "..no pet food!" ); ai->SetIgnoreUpdateTime(7); } #pragma endregion } } // end DoNonCombatActions