mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-23 11:32:24 +00:00
Fixes for mobs on pause waypoints dancing around.
Fixes for runspeed <= 0 as reported by demonstar55
This commit is contained in:
parent
4424afac94
commit
76d7fe1586
56
zone/bot.cpp
56
zone/bot.cpp
@ -373,7 +373,7 @@ NPCType Bot::FillNPCTypeStruct(uint32 botSpellsID, std::string botName, std::str
|
||||
BotNPCType.d_melee_texture2 = 0;
|
||||
BotNPCType.qglobal = false;
|
||||
BotNPCType.attack_speed = 0;
|
||||
BotNPCType.runspeed = 1.25;
|
||||
BotNPCType.runspeed = 0.7f;
|
||||
BotNPCType.bodytype = 1;
|
||||
BotNPCType.findable = 0;
|
||||
BotNPCType.hp_regen = 1;
|
||||
@ -410,7 +410,7 @@ NPCType Bot::CreateDefaultNPCTypeStructForBot(std::string botName, std::string b
|
||||
Result.drakkin_details = 0;
|
||||
Result.drakkin_heritage = 0;
|
||||
Result.drakkin_tattoo = 0;
|
||||
Result.runspeed = 1.25;
|
||||
Result.runspeed = 0.7f;
|
||||
Result.bodytype = 1;
|
||||
Result.findable = 0;
|
||||
Result.hp_regen = 1;
|
||||
@ -3739,8 +3739,6 @@ void Bot::AI_Process() {
|
||||
if(dist < GetFollowDistance() + 1000)
|
||||
speed = follow->GetWalkspeed();
|
||||
|
||||
SetRunAnimSpeed(0);
|
||||
|
||||
if(dist > GetFollowDistance()) {
|
||||
CalculateNewPosition2(follow->GetX(), follow->GetY(), follow->GetZ(), speed);
|
||||
if(rest_timer.Enabled())
|
||||
@ -3832,12 +3830,10 @@ void Bot::PetAIProcess() {
|
||||
botPet->GetAIMovementTimer()->Check();
|
||||
|
||||
if(botPet->IsMoving()) {
|
||||
botPet->SetRunAnimSpeed(0);
|
||||
botPet->SetHeading(botPet->GetTarget()->GetHeading());
|
||||
if(moved) {
|
||||
moved=false;
|
||||
botPet->SendPosition();
|
||||
botPet->SetMoving(false);
|
||||
botPet->SetRunAnimSpeed(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10542,52 +10538,6 @@ bool Bot::CanHeal() {
|
||||
}
|
||||
|
||||
bool Bot::CalculateNewPosition2(float x, float y, float z, float speed, bool checkZ) {
|
||||
// 2.5625 is the inverse of 0.3902439. The only difference is in implementation.
|
||||
// NOTE: You can not change just one of the constants below. They are the same number, just expressed inversly of each other.
|
||||
// const float clientOverServerRatio = 2.5625f;
|
||||
const float serverOverClientRatio = 0.3902439f;
|
||||
|
||||
// Use this block if using 2.5625 as the ratio.
|
||||
// const int clientAnimationMovementRateTypeMultiple = 8;
|
||||
|
||||
// WildcardX: These are valid rates and observations based on painstaking testing of the client response to these values
|
||||
//
|
||||
//
|
||||
// 0 * 8 = 0 : No Movement
|
||||
// 1 * 8 = 8 : Death Walk
|
||||
// 2 * 8 = 16 : Slow Walk
|
||||
// 3 * 8 = 24 : Normal Walk
|
||||
// 4 * 8 = 32 : Jog
|
||||
// 5 * 8 = 40 : Normal Run
|
||||
// 6 * 8 = 48 : Faster Run
|
||||
// 7 * 8 = 56 : Even Faster Run
|
||||
// 8 * 8 = 64 : Fastest Yet Run (Bard Song Speed?)
|
||||
// 9 * 8 = 72 : Faster Fastest Yet Run
|
||||
// 10 * 8 = 80 : .... you get the idea, this is pretty fast
|
||||
// 11 * 8 = 88 : .... warp speed anyone?
|
||||
// 12 * 8 = 96 : .... transwarp drive was invented by gnomes in Norrath
|
||||
// 13 * 8 = 104 : ... who needs warp drives when you can just displace through time and space?
|
||||
//
|
||||
//
|
||||
// You get the idea here with these... These seem to be "benchmark values" of animation movement and how fast
|
||||
// the client thinks the Mob is moving so it can make it all look seemless between updates from the server.
|
||||
// This chart is scalable by the client so you can pass an animation rate of 50 and get a "faster run" but not quite a "even faster run"
|
||||
|
||||
// Convert the Bot movement rate to a value the client understands based on the chart above
|
||||
// Use this block if using 2.5625 as the ratio.
|
||||
// speed *= clientMovementRateTypeMultiple;
|
||||
|
||||
|
||||
// This sets the movement animation rate with the client
|
||||
// Use this block if using 2.5625 as the ratio.
|
||||
// pRunAnimSpeed = speed;
|
||||
pRunAnimSpeed = ((serverOverClientRatio * 10.0f) * speed) * 10.0f;
|
||||
|
||||
// Now convert our "speed" from the value necessary for the client to animate the correct movement type rate to the server side speed
|
||||
// Use this block if using 2.5625 as the ratio.
|
||||
// speed *= serverOverClientRatio;
|
||||
speed = pRunAnimSpeed / serverOverClientRatio;
|
||||
|
||||
return MakeNewPositionAndSendUpdate(x, y, z, speed, checkZ);
|
||||
}
|
||||
|
||||
|
||||
10
zone/mob.cpp
10
zone/mob.cpp
@ -599,7 +599,7 @@ int Mob::_GetWalkSpeed() const {
|
||||
speed_mod += (base_run * movemod / 100);
|
||||
|
||||
if(speed_mod < 1)
|
||||
return(1);
|
||||
return(0);
|
||||
|
||||
//runspeed cap.
|
||||
if(IsClient())
|
||||
@ -670,7 +670,7 @@ int Mob::_GetRunSpeed() const {
|
||||
// basically stoped
|
||||
if(speed_mod < 1)
|
||||
{
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
// moving slowly
|
||||
if (speed_mod < 8)
|
||||
@ -687,7 +687,7 @@ int Mob::_GetRunSpeed() const {
|
||||
|
||||
if(speed_mod < 1)
|
||||
{
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
//runspeed cap.
|
||||
if(IsClient())
|
||||
@ -736,7 +736,7 @@ int Mob::_GetFearSpeed() const {
|
||||
{
|
||||
if (hp_ratio < 25)
|
||||
{
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
if (hp_ratio < 50)
|
||||
return (8);
|
||||
@ -766,7 +766,7 @@ int Mob::_GetFearSpeed() const {
|
||||
}
|
||||
}
|
||||
if (speed_mod < 1)
|
||||
return (1);
|
||||
return (0);
|
||||
if (speed_mod < 9)
|
||||
return (8);
|
||||
if (speed_mod < 13)
|
||||
|
||||
@ -1719,14 +1719,16 @@ void NPC::AI_DoMovement() {
|
||||
if (m_CurrentWayPoint.x == GetX() && m_CurrentWayPoint.y == GetY())
|
||||
{ // are we there yet? then stop
|
||||
Log.Out(Logs::Detail, Logs::AI, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid());
|
||||
SetWaypointPause();
|
||||
if(GetAppearance() != eaStanding)
|
||||
SetAppearance(eaStanding, false);
|
||||
SetMoving(false);
|
||||
if (m_CurrentWayPoint.w >= 0.0) {
|
||||
SetHeading(m_CurrentWayPoint.w);
|
||||
if (cur_wp_pause != 0) {
|
||||
SetWaypointPause();
|
||||
if(GetAppearance() != eaStanding)
|
||||
SetAppearance(eaStanding, false);
|
||||
SetMoving(false);
|
||||
if (m_CurrentWayPoint.w >= 0.0) {
|
||||
SetHeading(m_CurrentWayPoint.w);
|
||||
}
|
||||
SendPosition();
|
||||
}
|
||||
SendPosition();
|
||||
|
||||
//kick off event_waypoint arrive
|
||||
char temp[16];
|
||||
|
||||
@ -492,7 +492,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
|
||||
if(GetID()==0)
|
||||
return true;
|
||||
|
||||
if(speed == 0)
|
||||
if(speed <= 0)
|
||||
{
|
||||
SetCurrentSpeed(0);
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user