Innkeeper position and windows compile error

This commit is contained in:
Yunfan Li
2024-12-03 22:57:39 +08:00
parent 5c3591ae5a
commit 87e8c05b20
4 changed files with 48 additions and 23 deletions

View File

@@ -714,10 +714,10 @@ AiPlayerbot.RandomBotArenaTeamMinRating = 1000
AiPlayerbot.DeleteRandomBotArenaTeams = 0
# PvP Restricted Zones (bots don't pvp)
AiPlayerbot.PvpProhibitedZoneIds = "2255,656,2361,2362,2363,976,35,2268,3425,392,541,1446,3828,3712,3738,3565,3539,3623,4152,3988,4658,4284,4418,4436,4275,4323,4395,3703,4298"
AiPlayerbot.PvpProhibitedZoneIds = "2255,656,2361,2362,2363,976,35,2268,3425,392,541,1446,3828,3712,3738,3565,3539,3623,4152,3988,4658,4284,4418,4436,4275,4323,4395,3703,4298,139"
# PvP Restricted Areas (bots don't pvp)
AiPlayerbot.PvpProhibitedAreaIds = "976,35,392"
AiPlayerbot.PvpProhibitedAreaIds = "976,35,392,2268"
# Improve react speed in battleground and arena (may cause lag)
AiPlayerbot.FastReactInBG = 1

View File

@@ -560,7 +560,7 @@ bool PlayerbotAIConfig::IsInRandomQuestItemList(uint32 id)
bool PlayerbotAIConfig::IsPvpProhibited(uint32 zoneId, uint32 areaId)
{
return IsInPvpProhibitedZone(zoneId) || IsInPvpProhibitedArea(areaId);
return IsInPvpProhibitedZone(zoneId) || IsInPvpProhibitedArea(areaId) || IsInPvpProhibitedZone(areaId);
}
bool PlayerbotAIConfig::IsInPvpProhibitedZone(uint32 id)

View File

@@ -39,9 +39,11 @@
#include "PlayerbotCommandServer.h"
#include "PlayerbotFactory.h"
#include "Playerbots.h"
#include "Position.h"
#include "Random.h"
#include "ServerFacade.h"
#include "SharedDefines.h"
#include "TravelMgr.h"
#include "Unit.h"
#include "UpdateTime.h"
#include "World.h"
@@ -1420,7 +1422,7 @@ void RandomPlayerbotMgr::PrepareTeleportCache()
"position_x, "
"position_y, "
"position_z, "
"t.minlevel "
"t.maxlevel "
"FROM "
"(SELECT "
"map, "
@@ -1431,12 +1433,15 @@ void RandomPlayerbotMgr::PrepareTeleportCache()
"WHERE "
"t.npcflag = 0 "
"AND t.lootid != 0 "
"AND t.unit_flags != 768 "
"AND t.maxlevel - t.minlevel < 3 "
"AND map IN ({}) "
"AND c.id1 != 32820 "
"AND t.entry != 32820 "
"AND t.entry != 24196 "
"AND c.spawntimesecs < 1000 "
"AND t.faction != 188 "
"AND t.faction not in (11, 71, 79, 85, 188) "
"AND (t.unit_flags & 256) = 0 "
"AND (t.unit_flags & 4096) = 0 "
// "AND (t.flags_extra & 32768) = 0 "
"GROUP BY "
"map, "
"ROUND(position_x / 50), "
@@ -1516,23 +1521,42 @@ void RandomPlayerbotMgr::PrepareTeleportCache()
continue;
const AreaTableEntry* area = sAreaTableStore.LookupEntry(map->GetAreaId(1, x, y, z));
uint32 level = area->area_level;
// LOG_INFO("playerbots", "Area: {} Level: {} creature_entry: {}", area->ID, level, c_entry);
int range = level <= 10 ? 6 : 8;
for (int32 l = (int32)level; l <= (int32)level + range; l++)
for (int i = 2; i<= 80; i++)
{
if (l < 1 || l > maxLevel)
std::vector<WorldLocation> &locs = locsPerLevelCache[i - 1];
for (auto &levelLoc : locs)
{
continue;
}
if (!(entry->hostileMask & 4))
{
hordeInnkeeperPerLevelCache[(uint8)l].push_back(loc);
}
if (!(entry->hostileMask & 2))
{
allianceInnkeeperPerLevelCache[(uint8)l].push_back(loc);
if (loc.GetMapId() == levelLoc.GetMapId() && loc.GetExactDist(levelLoc) <= 500.0f)
{
if (!(entry->hostileMask & 4))
{
hordeInnkeeperPerLevelCache[i].push_back(loc);
}
if (!(entry->hostileMask & 2))
{
allianceInnkeeperPerLevelCache[i].push_back(loc);
}
// LOG_INFO("playerbots", "Area: {} Level: {} creature_entry: {} add to: {} ({},{},{},{})", area->ID, level, c_entry, i, levelLoc.GetPositionX(), levelLoc.GetPositionY(), levelLoc.GetPositionZ(), levelLoc.GetMapId());
break;
}
}
}
// int range = level <= 10 ? 6 : 8;
// for (int32 l = (int32)level; l <= (int32)level + range; l++)
// {
// if (l < 1 || l > maxLevel)
// {
// continue;
// }
// if (!(entry->hostileMask & 4))
// {
// hordeInnkeeperPerLevelCache[(uint8)l].push_back(loc);
// }
// if (!(entry->hostileMask & 2))
// {
// allianceInnkeeperPerLevelCache[(uint8)l].push_back(loc);
// }
// }
} while (results->NextRow());
}
// add all initial position
@@ -1547,7 +1571,7 @@ void RandomPlayerbotMgr::PrepareTeleportCache()
WorldPosition pos(info->mapId, info->positionX, info->positionY, info->positionZ, info->orientation);
for (int32 l = 1; l <= 6; l++)
for (int32 l = 1; l <= 5; l++)
{
if ((1 << (i - 1)) & RACEMASK_ALLIANCE)
allianceInnkeeperPerLevelCache[(uint8)l].push_back(pos);
@@ -1676,7 +1700,7 @@ void RandomPlayerbotMgr::RandomTeleportForLevel(Player* bot)
locs = &locsPerLevelCache[level];
LOG_DEBUG("playerbots", "Random teleporting bot {} for level {} ({} locations available)", bot->GetName().c_str(),
bot->GetLevel(), locs->size());
if (level >= 5 && urand(0, 100) < sPlayerbotAIConfig->probTeleToBankers * 100)
if (level >= 10 && urand(0, 100) < sPlayerbotAIConfig->probTeleToBankers * 100)
{
RandomTeleport(bot, bankerLocsPerLevelCache[level], true);
}

View File

@@ -1,6 +1,7 @@
#include "NewRpgAction.h"
#include <cmath>
#include <cstdint>
#include "NewRpgStrategy.h"
#include "ObjectDefines.h"
@@ -217,7 +218,7 @@ bool NewRpgGoFarAwayPosAction::MoveFarTo(WorldPosition dest)
}
int attempt = 10;
float minDelta = MAXFLOAT;
float minDelta = M_PI;
const float x = bot->GetPositionX();
const float y = bot->GetPositionY();
const float z = bot->GetPositionZ();