mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
Compare commits
2 Commits
6db44b5296
...
e1f5064c9d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1f5064c9d | ||
|
|
ac99f45696 |
@ -7,7 +7,7 @@ INSERT INTO `ai_playerbot_texts`
|
|||||||
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
||||||
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
||||||
VALUES (
|
VALUES (
|
||||||
1740,
|
1743,
|
||||||
'bot_not_your_master',
|
'bot_not_your_master',
|
||||||
"You are not my master!",
|
"You are not my master!",
|
||||||
0, 0,
|
0, 0,
|
||||||
@ -35,7 +35,7 @@ INSERT INTO `ai_playerbot_texts`
|
|||||||
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
||||||
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
||||||
VALUES (
|
VALUES (
|
||||||
1741,
|
1744,
|
||||||
'bot_rndbot_no_logout',
|
'bot_rndbot_no_logout',
|
||||||
"You can't command me to logout!",
|
"You can't command me to logout!",
|
||||||
0, 0,
|
0, 0,
|
||||||
@ -56,4 +56,4 @@ VALUES (
|
|||||||
-- ruRU
|
-- ruRU
|
||||||
"Ты не можешь приказать мне выйти из игры!");
|
"Ты не можешь приказать мне выйти из игры!");
|
||||||
|
|
||||||
INSERT INTO ai_playerbot_texts_chance (name, probability) VALUES ('bot_rndbot_no_logout', 100);
|
INSERT INTO ai_playerbot_texts_chance (name, probability) VALUES ('bot_rndbot_no_logout', 100);
|
||||||
|
|||||||
@ -948,14 +948,15 @@ void MovementAction::UpdateMovementState()
|
|||||||
const auto liquidState = bot->GetLiquidData().Status;
|
const auto liquidState = bot->GetLiquidData().Status;
|
||||||
const float gZ = bot->GetMapWaterOrGroundLevel(bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ());
|
const float gZ = bot->GetMapWaterOrGroundLevel(bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ());
|
||||||
const bool onGroundZ = bot->GetPositionZ() < gZ + 1.f;
|
const bool onGroundZ = bot->GetPositionZ() < gZ + 1.f;
|
||||||
const bool canSwim = liquidState == LIQUID_MAP_IN_WATER || liquidState == LIQUID_MAP_UNDER_WATER;
|
const bool wantsSwim = liquidState == LIQUID_MAP_IN_WATER || liquidState == LIQUID_MAP_UNDER_WATER;
|
||||||
const bool canFly = bot->HasIncreaseMountedFlightSpeedAura() || bot->HasFlyAura();
|
const bool wantsFly = bot->HasIncreaseMountedFlightSpeedAura() || bot->HasFlyAura();
|
||||||
const bool canWaterWalk = bot->HasWaterWalkAura();
|
const bool canWaterWalk = bot->HasWaterWalkAura();
|
||||||
const bool isMasterFlying = master ? master->HasUnitMovementFlag(MOVEMENTFLAG_FLYING) : true;
|
const bool isMasterFlying = master ? master->HasUnitMovementFlag(MOVEMENTFLAG_FLYING) : true;
|
||||||
const bool isMasterSwimming = master ? master->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) : true;
|
const bool isMasterSwimming = master ? master->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) : true;
|
||||||
const bool isFlying = bot->HasUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
const bool isFlying = bot->HasUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
||||||
const bool isSwimming = bot->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
|
const bool isSwimming = bot->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
|
||||||
const bool isWaterWalking = bot->HasUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
const bool isWaterWalking = bot->HasUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
||||||
|
const bool hasGravityDisabled = bot->HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
||||||
bool movementFlagsUpdated = false;
|
bool movementFlagsUpdated = false;
|
||||||
|
|
||||||
// handle water (fragile logic do not alter without testing every detail, animation and transition)
|
// handle water (fragile logic do not alter without testing every detail, animation and transition)
|
||||||
@ -970,11 +971,11 @@ void MovementAction::UpdateMovementState()
|
|||||||
else if ((!canWaterWalk || isMasterSwimming) && isWaterWalking)
|
else if ((!canWaterWalk || isMasterSwimming) && isWaterWalking)
|
||||||
{
|
{
|
||||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
||||||
if (canSwim)
|
if (wantsSwim)
|
||||||
bot->SetSwim(true);
|
bot->SetSwim(true);
|
||||||
movementFlagsUpdated = true;
|
movementFlagsUpdated = true;
|
||||||
}
|
}
|
||||||
else if (!canSwim && isSwimming)
|
else if (!wantsSwim && isSwimming)
|
||||||
{
|
{
|
||||||
bot->SetSwim(false);
|
bot->SetSwim(false);
|
||||||
movementFlagsUpdated = true;
|
movementFlagsUpdated = true;
|
||||||
@ -990,17 +991,21 @@ void MovementAction::UpdateMovementState()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle flying
|
// handle flying
|
||||||
if ((canFly && !isFlying) && isMasterFlying)
|
if (wantsFly && !isFlying && isMasterFlying)
|
||||||
{
|
{
|
||||||
bot->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
bot->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
||||||
bot->AddUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
bot->AddUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
||||||
bot->AddUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
bot->AddUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
||||||
|
movementFlagsUpdated = true;
|
||||||
// required for transition and state monitoring.
|
|
||||||
if (MotionMaster* mm = bot->GetMotionMaster())
|
|
||||||
mm->MoveTakeoff(0, {bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ() + 1.F}, 0.F, true);
|
|
||||||
}
|
}
|
||||||
else if ((!canFly && !isWaterWalking && isFlying) || (!isMasterFlying && isFlying && onGroundZ))
|
else if (!wantsFly && !isWaterWalking && (isFlying || hasGravityDisabled))
|
||||||
|
{
|
||||||
|
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
||||||
|
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
||||||
|
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
||||||
|
movementFlagsUpdated = true;
|
||||||
|
}
|
||||||
|
else if (!isMasterFlying && isFlying && onGroundZ)
|
||||||
{
|
{
|
||||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
||||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user