void ScriptedAI::DoSpecialThings(uint32 diff, SpecialThing flags, float range, float speedRate) { if (m_specialThingTimer < diff) { if (flags & DO_PULSE_COMBAT) DoZoneInCombat(range); if (flags & DO_SPEED_UPDATE) { me->SetSpeed(MOVE_WALK, speedRate, true); me->SetSpeed(MOVE_RUN, speedRate, true); } if (flags & DO_EVADE_CHECK) { // need to call SetHomePosition ? WorldLocation home = me->GetHomePosition(); if (!me->IsWithinDistInMap(&home, range, true) || GetClosestPlayer(me, range) == NULL) EnterEvadeMode(); } m_specialThingTimer = 3000; } else m_specialThingTimer -= diff; }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) { if (m_uiCheckoutTapList <= uiDiff) { if (Creature* pTapList = m_creature->GetMap()->GetCreature(m_pInstance->GetData64(NPC_HORSEMEN_TAP_LIST))) if (Unit* pVictim = pTapList->getVictim()) m_creature->AI()->AttackStart(pVictim); m_uiCheckoutTapList = 2500; } else m_uiCheckoutTapList -= uiDiff; return; } Player* pPlayer = GetClosestPlayer(m_creature, MARK_DISTANCE); if (!pPlayer) { if (m_uiPainTimer <= uiDiff) { DoCastSpellIfCan(m_creature, SPELL_UNYILDING_PAIN); m_uiPainTimer = 2000; } else m_uiPainTimer -= uiDiff; return; } else if (m_uiShadowBoltTimer <= uiDiff) { DoCastSpellIfCan(pPlayer, m_bIsRegularMode ? SPELL_SHADOW_BOLT : SPELL_SHADOW_BOLT_H); m_uiShadowBoltTimer = 3000; } else m_uiShadowBoltTimer -= uiDiff; // Mark of Blaumeux if (m_uiMarkTimer <= uiDiff) { DoCastSpellIfCan(m_creature, SPELL_MARK_OF_BLAUMEUX, CAST_INTERRUPT_PREVIOUS); ++m_uiMarksCasted; if (m_uiMarksCasted >= 100) DoCastSpellIfCan(m_creature, SPELL_BESERK); m_uiMarkTimer = 15000; } else m_uiMarkTimer -= uiDiff; // Void Zone if (m_uiVoidZoneTimer <= uiDiff) { if (Unit* pUnit = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)) DoCastSpellIfCan(pUnit, m_bIsRegularMode ? SPELL_VOIDZONE : SPELL_VOIDZONE_H); m_uiVoidZoneTimer = 15000; } else m_uiVoidZoneTimer -= uiDiff; }
void Aimbot::CreateMove(CUserCmd* cmd) { Aimbot::UpdateValues(); if (!Settings::Aimbot::enabled) return; QAngle oldAngle; engine->GetViewAngles(oldAngle); float oldForward = cmd->forwardmove; float oldSideMove = cmd->sidemove; QAngle angle = cmd->viewangles; shouldAim = Settings::Aimbot::AutoShoot::enabled; C_BasePlayer* localplayer = (C_BasePlayer*) entityList->GetClientEntity(engine->GetLocalPlayer()); if (!localplayer || !localplayer->GetAlive()) return; if (Settings::Aimbot::IgnoreJump::enabled && !(localplayer->GetFlags() & FL_ONGROUND)) return; C_BaseCombatWeapon* activeWeapon = (C_BaseCombatWeapon*) entityList->GetClientEntityFromHandle(localplayer->GetActiveWeapon()); if (!activeWeapon || activeWeapon->GetInReload()) return; CSWeaponType weaponType = activeWeapon->GetCSWpnData()->GetWeaponType(); if (weaponType == CSWeaponType::WEAPONTYPE_C4 || weaponType == CSWeaponType::WEAPONTYPE_GRENADE || weaponType == CSWeaponType::WEAPONTYPE_KNIFE) return; Bone aw_bone; float bestDamage = 0.0f; C_BasePlayer* player = GetClosestPlayer(cmd, true, aw_bone, bestDamage); if (player) { bool skipPlayer = false; Vector eVecTarget = player->GetBonePosition((int) aw_bone); Vector pVecTarget = localplayer->GetEyePosition(); if (Settings::Aimbot::SmokeCheck::enabled && LineGoesThroughSmoke(pVecTarget, eVecTarget, true)) skipPlayer = true; if (Settings::Aimbot::FlashCheck::enabled && localplayer->GetFlashBangTime() - globalVars->curtime > 2.0f) skipPlayer = true; if (skipPlayer) player = nullptr; if (Settings::Aimbot::AutoAim::enabled && !skipPlayer) { if (cmd->buttons & IN_ATTACK && !Settings::Aimbot::aimkeyOnly) shouldAim = true; if (inputSystem->IsButtonDown(Settings::Aimbot::aimkey)) shouldAim = true; if (shouldAim) { if (Settings::Aimbot::Prediction::enabled) { pVecTarget = VelocityExtrapolate(localplayer, pVecTarget); // get eye pos next tick eVecTarget = VelocityExtrapolate(player, eVecTarget); // get target pos next tick } angle = Math::CalcAngle(pVecTarget, eVecTarget); if (Settings::Aimbot::ErrorMargin::enabled) ApplyErrorToAngle(&angle, Settings::Aimbot::ErrorMargin::value); } } } Aimbot::AimStep(player, angle, cmd); Aimbot::AutoCrouch(player, cmd); Aimbot::AutoSlow(player, oldForward, oldSideMove, bestDamage, activeWeapon, cmd); Aimbot::AutoPistol(activeWeapon, cmd); Aimbot::AutoShoot(player, activeWeapon, cmd); Aimbot::RCS(angle, player, cmd); Aimbot::Smooth(player, angle, cmd); Aimbot::ShootCheck(activeWeapon, cmd); Aimbot::NoShoot(activeWeapon, player, cmd); Math::NormalizeAngles(angle); Math::ClampAngles(angle); if (angle != cmd->viewangles) cmd->viewangles = angle; Math::CorrectMovement(oldAngle, cmd, oldForward, oldSideMove); if (!Settings::Aimbot::silent) engine->SetViewAngles(cmd->viewangles); }
void UpdateAI(const uint32 diff) { if(VisualTimer) { if(VisualTimer <= diff) { DoCast(me, SPELL_BLACK_HOLE_SUMMON_VISUAL, true); DoCast(me, SPELL_BLACK_HOLE_SUMMON_VISUAL_2, true); VisualTimer = 0; } else VisualTimer -= diff; return; } if(ActivationTimer) { if(ActivationTimer <= diff) { DoCast(me, SPELL_BLACK_HOLE_VISUAL_2, true); DoCast(me, SPELL_BLACK_HOLE_PASSIVE, true); ActivationTimer = 0; if(Player* victim = GetClosestPlayer(me, 100)) { victimGUID = victim->GetGUID(); me->GetMotionMaster()->MovePoint(0, victim->GetPositionX(), victim->GetPositionY(), 72.0, false); } ChasingTimer = 1000; } else ActivationTimer -= diff; } if(victimGUID && ChasingTimer) { if(ChasingTimer <= diff) { if (Unit* victim = me->GetUnit(victimGUID)) { if(me->IsWithinDistInMap(victim, 5.0)) { if(Unit* victim = SelectUnit(SELECT_TARGET_NEAREST, 0, 200, true, me->getVictimGUID(), 10.0)) { victimGUID = victim->GetGUID(); me->GetMotionMaster()->MovePoint(0, victim->GetPositionX(), victim->GetPositionY(), 72.0, false); } } else me->GetMotionMaster()->MovePoint(0, victim->GetPositionX(), victim->GetPositionY(), 72.0, false); } ChasingTimer = 2000; } else ChasingTimer -= diff; } if (DespawnTimer < diff) { me->Kill(me, false); me->RemoveCorpse(); } else DespawnTimer -= diff; }