Skip to content

Commit 935194d

Browse files
author
Rochet2
committed
Merge TrinityCore 3.3.5 to ElunaTrinityWotlk [skip ci]
2 parents 2d2816c + afd6900 commit 935194d

File tree

10 files changed

+53
-10
lines changed

10 files changed

+53
-10
lines changed

src/server/database/Database/Implementation/WorldDatabase.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
8080
PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction, npcflag, speed_walk, speed_run, scale, `rank`, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, dynamicflags, family, type, type_flags, lootid, pickpocketloot, skinloot, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, ctm.Ground, ctm.Swim, ctm.Flight, ctm.Rooted, ctm.Chase, ctm.Random, ctm.InteractionPauseTimer, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, spell_school_immune_mask, flags_extra, ScriptName, StringId FROM creature_template ct LEFT JOIN creature_template_movement ctm ON ct.entry = ctm.CreatureId WHERE entry = ?", CONNECTION_SYNCH);
8181
PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH);
8282
PrepareStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH);
83+
PrepareStatement(WORLD_SEL_ITEM_TEMPLATE_LOCALE_BY_NAME, "SELECT ID FROM item_template_locale WHERE Name = ?", CONNECTION_SYNCH);
8384
PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH);
8485
PrepareStatement(WORLD_SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH);
8586
PrepareStatement(WORLD_SEL_CREATURE_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM creature WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH);

src/server/database/Database/Implementation/WorldDatabase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ enum WorldDatabaseStatements : uint32
8585
WORLD_SEL_CREATURE_TEMPLATE,
8686
WORLD_SEL_WAYPOINT_SCRIPT_BY_ID,
8787
WORLD_SEL_ITEM_TEMPLATE_BY_NAME,
88+
WORLD_SEL_ITEM_TEMPLATE_LOCALE_BY_NAME,
8889
WORLD_SEL_CREATURE_BY_ID,
8990
WORLD_SEL_GAMEOBJECT_NEAREST,
9091
WORLD_SEL_CREATURE_NEAREST,

src/server/game/DataStores/DBCStores.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore(ItemRandomSuffixfmt);
123123
DBCStorage <ItemSetEntry> sItemSetStore(ItemSetEntryfmt);
124124

125125
DBCStorage <LFGDungeonEntry> sLFGDungeonStore(LFGDungeonEntryfmt);
126+
DBCStorage <LFGDungeonExpansionEntry> sLFGDungeonExpansionStore(LFGDungeonExpansionfmt);
126127
DBCStorage <LightEntry> sLightStore(LightEntryfmt);
127128
DBCStorage <LiquidTypeEntry> sLiquidTypeStore(LiquidTypefmt);
128129
DBCStorage <LockEntry> sLockStore(LockEntryfmt);
@@ -346,6 +347,7 @@ void LoadDBCStores(const std::string& dataPath)
346347
LOAD_DBC(sItemRandomSuffixStore, "ItemRandomSuffix.dbc");
347348
LOAD_DBC(sItemSetStore, "ItemSet.dbc");
348349
LOAD_DBC(sLFGDungeonStore, "LFGDungeons.dbc");
350+
LOAD_DBC(sLFGDungeonExpansionStore, "LFGDungeonExpansion.dbc");
349351
LOAD_DBC(sLightStore, "Light.dbc");
350352
LOAD_DBC(sLiquidTypeStore, "LiquidType.dbc");
351353
LOAD_DBC(sLockStore, "Lock.dbc");

src/server/game/DataStores/DBCStores.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ TC_GAME_API extern DBCStorage <ItemRandomPropertiesEntry> sItemRandomProperti
152152
TC_GAME_API extern DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore;
153153
TC_GAME_API extern DBCStorage <ItemSetEntry> sItemSetStore;
154154
TC_GAME_API extern DBCStorage <LFGDungeonEntry> sLFGDungeonStore;
155+
TC_GAME_API extern DBCStorage <LFGDungeonExpansionEntry> sLFGDungeonExpansionStore;
155156
TC_GAME_API extern DBCStorage <LightEntry> sLightStore;
156157
TC_GAME_API extern DBCStorage <LiquidTypeEntry> sLiquidTypeStore;
157158
TC_GAME_API extern DBCStorage <LockEntry> sLockStore;

src/server/game/DungeonFinding/LFGMgr.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "LFGQueue.h"
3232
#include "Log.h"
3333
#include "Map.h"
34+
#include "MapUtils.h"
3435
#include "ObjectAccessor.h"
3536
#include "ObjectMgr.h"
3637
#include "Player.h"
@@ -43,15 +44,16 @@
4344
namespace lfg
4445
{
4546

46-
LFGDungeonData::LFGDungeonData() : id(0), name(), map(0), type(0), expansion(0), group(0), minlevel(0),
47-
maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
47+
LFGDungeonData::LFGDungeonData() : id(0), name(), map(0), type(0), expansion(0), group(0), minlevel(),
48+
maxlevel(), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
4849
{
4950
}
5051

5152
LFGDungeonData::LFGDungeonData(LFGDungeonEntry const* dbc) : id(dbc->ID), name(dbc->Name[0]), map(dbc->MapID),
5253
type(dbc->TypeID), expansion(uint8(dbc->ExpansionLevel)), group(uint8(dbc->GroupID)),
53-
minlevel(uint8(dbc->MinLevel)), maxlevel(uint8(dbc->MaxLevel)), difficulty(Difficulty(dbc->Difficulty)),
54-
seasonal((dbc->Flags & LFG_FLAG_SEASONAL) != 0), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
54+
minlevel({ uint8(dbc->MinLevel), uint8(dbc->MinLevel), uint8(dbc->MinLevel) }),
55+
maxlevel({ uint8(dbc->MaxLevel), uint8(dbc->MaxLevel), uint8(dbc->MaxLevel) }),
56+
difficulty(Difficulty(dbc->Difficulty)), seasonal((dbc->Flags & LFG_FLAG_SEASONAL) != 0), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
5557
{
5658
}
5759

@@ -209,6 +211,15 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
209211
}
210212
}
211213

214+
for (LFGDungeonExpansionEntry const* dungeonExpansion : sLFGDungeonExpansionStore)
215+
{
216+
if (LFGDungeonData* dungeon = Trinity::Containers::MapGetValuePtr(LfgDungeonStore, dungeonExpansion->LfgID))
217+
{
218+
dungeon->minlevel[dungeonExpansion->ExpansionLevel] = dungeonExpansion->HardLevelMin;
219+
dungeon->maxlevel[dungeonExpansion->ExpansionLevel] = dungeonExpansion->HardLevelMax;
220+
}
221+
}
222+
212223
// Fill teleport locations from DB
213224
// 0 1 2 3 4
214225
QueryResult result = WorldDatabase.Query("SELECT dungeonId, position_x, position_y, position_z, orientation FROM lfg_dungeon_template");
@@ -1700,9 +1711,9 @@ LfgLockMap const LFGMgr::GetLockedDungeons(ObjectGuid guid)
17001711
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
17011712
else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
17021713
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
1703-
else if (dungeon->minlevel > level)
1714+
else if (dungeon->minlevel[expansion] > level)
17041715
lockData = LFG_LOCKSTATUS_TOO_LOW_LEVEL;
1705-
else if (dungeon->maxlevel < level)
1716+
else if (dungeon->maxlevel[expansion] < level)
17061717
lockData = LFG_LOCKSTATUS_TOO_HIGH_LEVEL;
17071718
else if (dungeon->seasonal && !IsSeasonActive(dungeon->id))
17081719
lockData = LFG_LOCKSTATUS_NOT_IN_SEASON;
@@ -2134,7 +2145,7 @@ LfgDungeonSet LFGMgr::GetRandomAndSeasonalDungeons(uint8 level, uint8 expansion)
21342145
{
21352146
lfg::LFGDungeonData const& dungeon = itr->second;
21362147
if ((dungeon.type == lfg::LFG_TYPE_RANDOM || (dungeon.seasonal && sLFGMgr->IsSeasonActive(dungeon.id)))
2137-
&& dungeon.expansion <= expansion && dungeon.minlevel <= level && level <= dungeon.maxlevel)
2148+
&& dungeon.expansion <= expansion && dungeon.minlevel[expansion] <= level && level <= dungeon.maxlevel[expansion])
21382149
randomDungeons.insert(dungeon.Entry());
21392150
}
21402151
return randomDungeons;

src/server/game/DungeonFinding/LFGMgr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ struct LFGDungeonData
290290
uint8 type;
291291
uint8 expansion;
292292
uint8 group;
293-
uint8 minlevel;
294-
uint8 maxlevel;
293+
std::array<uint8, MAX_EXPANSIONS> minlevel;
294+
std::array<uint8, MAX_EXPANSIONS> maxlevel;
295295
Difficulty difficulty;
296296
bool seasonal;
297297
float x, y, z, o;

src/server/game/Spells/SpellEffects.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2134,14 +2134,14 @@ void Spell::EffectSummonType()
21342134
// Summons a vehicle, but doesn't force anyone to enter it (see SUMMON_CATEGORY_VEHICLE)
21352135
case SUMMON_TYPE_VEHICLE:
21362136
case SUMMON_TYPE_VEHICLE2:
2137+
case SUMMON_TYPE_LIGHTWELL:
21372138
{
21382139
if (!unitCaster)
21392140
return;
21402141

21412142
summon = unitCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, unitCaster, m_spellInfo->Id);
21422143
break;
21432144
}
2144-
case SUMMON_TYPE_LIGHTWELL:
21452145
case SUMMON_TYPE_TOTEM:
21462146
{
21472147
if (!unitCaster)

src/server/scripts/Commands/cs_misc.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,13 @@ class misc_commandscript : public CommandScript
11751175
stmt->setString(0, itemName);
11761176
PreparedQueryResult result = WorldDatabase.Query(stmt);
11771177

1178+
if (!result)
1179+
{
1180+
stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_LOCALE_BY_NAME);
1181+
stmt->setString(0, itemName);
1182+
result = WorldDatabase.Query(stmt);
1183+
}
1184+
11781185
if (!result)
11791186
{
11801187
handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1);
@@ -1315,6 +1322,13 @@ class misc_commandscript : public CommandScript
13151322
stmt->setString(0, itemName);
13161323
PreparedQueryResult result = WorldDatabase.Query(stmt);
13171324

1325+
if (!result)
1326+
{
1327+
stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_LOCALE_BY_NAME);
1328+
stmt->setString(0, itemName);
1329+
result = WorldDatabase.Query(stmt);
1330+
}
1331+
13181332
if (!result)
13191333
{
13201334
handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr + 1);

src/server/shared/DataStores/DBCStructure.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,18 @@ struct LFGDungeonEntry
10131013
uint32 Entry() const { return ID + (TypeID << 24); }
10141014
};
10151015

1016+
struct LFGDungeonExpansionEntry
1017+
{
1018+
//uint32 ID; // 0
1019+
uint32 LfgID; // 1
1020+
uint32 ExpansionLevel; // 2
1021+
//uint32 RandomID; // 3
1022+
uint32 HardLevelMin; // 4
1023+
uint32 HardLevelMax; // 5
1024+
//uint32 TargetLevelMin; // 6
1025+
//uint32 TargetLevelMax; // 7
1026+
};
1027+
10161028
struct LightEntry
10171029
{
10181030
uint32 ID; // 0

src/server/shared/DataStores/DBCfmt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ char constexpr ItemRandomPropertiesfmt[] = "nxiiixxssssssssssssssssx";
8484
char constexpr ItemRandomSuffixfmt[] = "nssssssssssssssssxxiiixxiiixx";
8585
char constexpr ItemSetEntryfmt[] = "dssssssssssssssssxiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii";
8686
char constexpr LFGDungeonEntryfmt[] = "nssssssssssssssssxiiiiiiiiixxixixxxxxxxxxxxxxxxxx";
87+
char constexpr LFGDungeonExpansionfmt[] = "diixiixx";
8788
char constexpr LightEntryfmt[] = "nifffxxxxxxxxxx";
8889
char constexpr LiquidTypefmt[] = "nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
8990
char constexpr LockEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx";

0 commit comments

Comments
 (0)