Misc fixes
This commit is contained in:
@@ -751,7 +751,7 @@ namespace Framework.Constants
|
||||
CompleteTrackingQuest = 250, /*NYI*/
|
||||
|
||||
GainLevels = 253, // Gain levels
|
||||
Count
|
||||
Count = 257
|
||||
}
|
||||
|
||||
public enum CriteriaDataType
|
||||
|
||||
@@ -37,10 +37,10 @@ namespace Framework.Database
|
||||
fileName = @"/sql/base/characters_database.sql";
|
||||
break;
|
||||
case "WorldDatabase":
|
||||
fileName = @"/sql/TDB_full_world_1015.23071_2023_07_14.sql";
|
||||
fileName = @"/sql/TDB_full_world_1020.23111_2023_11_15.sql";
|
||||
break;
|
||||
case "HotfixDatabase":
|
||||
fileName = @"/sql/TDB_full_hotfixes_1015.23071_2023_07_14.sql";
|
||||
fileName = @"/sql/TDB_full_hotfixes_1020.23111_2023_11_15.sql";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace Game.AI
|
||||
temp.Link = result.Read<ushort>(3);
|
||||
|
||||
bool invalidDifficulties = false;
|
||||
foreach (string token in new StringArray(result.Read<string>(4), ' '))
|
||||
foreach (string token in result.Read<string>(4).Split(' ', StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
if (!Enum.TryParse<Difficulty>(token, out Difficulty difficultyId))
|
||||
{
|
||||
|
||||
@@ -294,15 +294,11 @@ namespace Game
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CheckPassword(uint accountId, string password)
|
||||
public bool CheckPassword(string username, string password)
|
||||
{
|
||||
string username;
|
||||
PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_CHECK_PASSWORD_BY_NAME);
|
||||
stmt.AddValue(0, username);
|
||||
|
||||
if (!GetName(accountId, out username))
|
||||
return false;
|
||||
|
||||
PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_CHECK_PASSWORD);
|
||||
stmt.AddValue(0, accountId);
|
||||
SQLResult result = DB.Login.Query(stmt);
|
||||
if (!result.IsEmpty())
|
||||
{
|
||||
@@ -315,6 +311,14 @@ namespace Game
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CheckPassword(uint accountId, string password)
|
||||
{
|
||||
if (!GetName(accountId, out string username))
|
||||
return false;
|
||||
|
||||
return CheckPassword(username, password);
|
||||
}
|
||||
|
||||
public bool CheckEmail(uint accountId, string newEmail)
|
||||
{
|
||||
string oldEmail;
|
||||
|
||||
@@ -20,7 +20,11 @@ namespace Game
|
||||
{
|
||||
public sealed class ConditionManager : Singleton<ConditionManager>
|
||||
{
|
||||
ConditionManager() { }
|
||||
ConditionManager()
|
||||
{
|
||||
for (ConditionSourceType i = 0; i < ConditionSourceType.Max; ++i)
|
||||
ConditionStorage[i] = new();
|
||||
}
|
||||
|
||||
public GridMapTypeMask GetSearcherTypeMaskForConditionList(List<Condition> conditions)
|
||||
{
|
||||
@@ -42,7 +46,7 @@ namespace Game
|
||||
if (i.ReferenceId != 0) // handle reference
|
||||
{
|
||||
var refe = ConditionStorage[ConditionSourceType.ReferenceCondition].LookupByKey(new ConditionId(i.ReferenceId, 0, 0));
|
||||
Cypher.Assert(refe.Empty(), "ConditionMgr.GetSearcherTypeMaskForConditionList - incorrect reference");
|
||||
Cypher.Assert(refe != null, "ConditionMgr.GetSearcherTypeMaskForConditionList - incorrect reference");
|
||||
elseGroupSearcherTypeMasks[i.ElseGroup] &= GetSearcherTypeMaskForConditionList(refe);
|
||||
}
|
||||
else // handle normal condition
|
||||
@@ -78,7 +82,7 @@ namespace Game
|
||||
if (condition.ReferenceId != 0)//handle reference
|
||||
{
|
||||
var refe = ConditionStorage[ConditionSourceType.ReferenceCondition].LookupByKey(new ConditionId(condition.ReferenceId, 0, 0));
|
||||
if (!refe.Empty())
|
||||
if (refe != null)
|
||||
{
|
||||
if (!IsObjectMeetToConditionList(sourceInfo, refe))
|
||||
elseGroupStore[condition.ElseGroup] = false;
|
||||
@@ -118,7 +122,7 @@ namespace Game
|
||||
|
||||
public bool IsObjectMeetToConditions(ConditionSourceInfo sourceInfo, List<Condition> conditions)
|
||||
{
|
||||
if (conditions.Empty())
|
||||
if (conditions == null)
|
||||
return true;
|
||||
|
||||
Log.outDebug(LogFilter.Condition, "ConditionMgr.IsObjectMeetToConditions");
|
||||
@@ -189,7 +193,7 @@ namespace Game
|
||||
if (sourceType > ConditionSourceType.None && sourceType < ConditionSourceType.Max)
|
||||
{
|
||||
var conditions = ConditionStorage[sourceType].LookupByKey(new ConditionId(0, (int)entry, 0));
|
||||
if (!conditions.Empty())
|
||||
if (conditions != null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Condition, "GetConditionsForNotGroupedEntry: found conditions for type {0} and entry {1}", sourceType, entry);
|
||||
return IsObjectMeetToConditions(sourceInfo, conditions);
|
||||
@@ -222,7 +226,7 @@ namespace Game
|
||||
public bool IsObjectMeetingSpellClickConditions(uint creatureId, uint spellId, WorldObject clicker, WorldObject target)
|
||||
{
|
||||
var conditions = ConditionStorage[ConditionSourceType.SpellClickEvent].LookupByKey(new ConditionId(creatureId, (int)spellId, 0));
|
||||
if (!conditions.Empty())
|
||||
if (conditions != null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Condition, "GetConditionsForSpellClickEvent: found conditions for SpellClickEvent entry {0} spell {1}", creatureId, spellId);
|
||||
ConditionSourceInfo sourceInfo = new(clicker, target);
|
||||
@@ -259,7 +263,7 @@ namespace Game
|
||||
public bool IsObjectMeetingSmartEventConditions(long entryOrGuid, uint eventId, SmartScriptType sourceType, Unit unit, WorldObject baseObject)
|
||||
{
|
||||
var conditions = ConditionStorage[ConditionSourceType.SmartEvent].LookupByKey(new ConditionId(eventId + 1, (int)entryOrGuid, (uint)sourceType));
|
||||
if (!conditions.Empty())
|
||||
if (conditions != null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Condition, "GetConditionsForSmartEvent: found conditions for Smart Event entry or guid {0} eventId {1}", entryOrGuid, eventId);
|
||||
ConditionSourceInfo sourceInfo = new(unit, baseObject);
|
||||
@@ -272,7 +276,7 @@ namespace Game
|
||||
public bool IsObjectMeetingVendorItemConditions(uint creatureId, uint itemId, Player player, Creature vendor)
|
||||
{
|
||||
var conditions = ConditionStorage[ConditionSourceType.NpcVendor].LookupByKey(new ConditionId(creatureId, (int)itemId, 0));
|
||||
if (!conditions.Empty())
|
||||
if (conditions != null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Condition, "GetConditionsForNpcVendor: found conditions for creature entry {0} item {1}", creatureId, itemId);
|
||||
ConditionSourceInfo sourceInfo = new(player, vendor);
|
||||
@@ -295,7 +299,7 @@ namespace Game
|
||||
public bool IsObjectMeetingTrainerSpellConditions(uint trainerId, uint spellId, Player player)
|
||||
{
|
||||
var conditions = ConditionStorage[ConditionSourceType.NpcVendor].LookupByKey(new ConditionId(trainerId, (int)spellId, 0));
|
||||
if (!conditions.Empty())
|
||||
if (conditions != null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Condition, $"GetConditionsForTrainerSpell: found conditions for trainer id {trainerId} spell {spellId}");
|
||||
return IsObjectMeetToConditions(player, conditions);
|
||||
@@ -307,7 +311,7 @@ namespace Game
|
||||
public bool IsObjectMeetingVisibilityByObjectIdConditions(uint objectType, uint entry, WorldObject seer)
|
||||
{
|
||||
var conditions = ConditionStorage[ConditionSourceType.ObjectIdVisibility].LookupByKey(new ConditionId(objectType, (int)entry, 0));
|
||||
if (!conditions.Empty())
|
||||
if (conditions != null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Condition, $"IsObjectMeetingVisibilityByObjectIdConditions: found conditions for objectType {objectType} entry {entry}");
|
||||
return IsObjectMeetToConditions(seer, conditions);
|
||||
@@ -330,7 +334,7 @@ namespace Game
|
||||
}
|
||||
|
||||
SQLResult result = DB.World.Query("SELECT SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionTarget, " +
|
||||
" ConditionValue1, ConditionValue2, ConditionValue3, NegativeCondition, ErrorType, ErrorTextId, ScriptName FROM conditions");
|
||||
"ConditionValue1, ConditionValue2, ConditionValue3, ConditionStringValue1, NegativeCondition, ErrorType, ErrorTextId, ScriptName FROM conditions");
|
||||
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
|
||||
@@ -694,11 +694,13 @@ namespace Game.DataStorage
|
||||
hotfixRecord.HotfixStatus = status;
|
||||
hotfixRecord.AvailableLocalesMask = availableDb2Locales.ToBlockRange()[0];//Ulgy i know
|
||||
|
||||
if (!_hotfixData.ContainsKey(id))
|
||||
_hotfixData[id] = new();
|
||||
|
||||
HotfixPush push = _hotfixData[id];
|
||||
push.Records.Add(hotfixRecord);
|
||||
push.AvailableLocalesMask |= hotfixRecord.AvailableLocalesMask;
|
||||
|
||||
_hotfixData.Add(id, push);
|
||||
deletedRecords[(tableHash, recordId)] = status == HotfixRecord.Status.RecordRemoved;
|
||||
|
||||
++count;
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Game.Entities
|
||||
m_areaTriggerData = new AreaTriggerFieldData();
|
||||
|
||||
_spline = new();
|
||||
_stationaryPosition = new();
|
||||
}
|
||||
|
||||
public override void AddToWorld()
|
||||
@@ -261,9 +262,9 @@ namespace Game.Entities
|
||||
|
||||
SpellInfo spellInfo = null;
|
||||
SpellCastVisual spellVisual = default;
|
||||
if (spawnData.SpellForVisuals != 0)
|
||||
if (spawnData.SpellForVisuals.HasValue)
|
||||
{
|
||||
spellInfo = Global.SpellMgr.GetSpellInfo((uint)spawnData.SpellForVisuals, Difficulty.None);
|
||||
spellInfo = Global.SpellMgr.GetSpellInfo(spawnData.SpellForVisuals.Value, Difficulty.None);
|
||||
if (spellInfo != null)
|
||||
spellVisual.SpellXSpellVisualID = spellInfo.GetSpellXSpellVisualId();
|
||||
}
|
||||
|
||||
@@ -1909,7 +1909,7 @@ namespace Game.Entities
|
||||
public virtual float GetNativeObjectScale() { return 1.0f; }
|
||||
|
||||
public float GetDisplayScale() { return m_unitData.DisplayScale; }
|
||||
|
||||
|
||||
public uint GetDisplayId() { return m_unitData.DisplayID; }
|
||||
|
||||
public virtual void SetDisplayId(uint displayId, bool setNative = false)
|
||||
@@ -2088,7 +2088,17 @@ namespace Game.Entities
|
||||
return IsCharmed() ? GetCharmerGUID() : GetOwnerGUID();
|
||||
}
|
||||
|
||||
Player GetControllingPlayer()
|
||||
public Unit GetDemonCreator()
|
||||
{
|
||||
return Global.ObjAccessor.GetUnit(this, GetDemonCreatorGUID());
|
||||
}
|
||||
|
||||
public Player GetDemonCreatorPlayer()
|
||||
{
|
||||
return Global.ObjAccessor.GetPlayer(this, GetDemonCreatorGUID());
|
||||
}
|
||||
|
||||
public Player GetControllingPlayer()
|
||||
{
|
||||
ObjectGuid guid = GetCharmerOrOwnerGUID();
|
||||
if (!guid.IsEmpty())
|
||||
|
||||
@@ -316,8 +316,8 @@ namespace Game.Guilds
|
||||
}
|
||||
}
|
||||
|
||||
GetAchievementMgr().SendAllTrackedCriterias(player, criteriaIds);
|
||||
member.SetTrackedCriteriaIds(criteriaIds);
|
||||
GetAchievementMgr().SendAllTrackedCriterias(player, member.GetTrackedCriteriaIds());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2794,7 +2794,6 @@ namespace Game.Guilds
|
||||
public uint GetTotalReputation() { return m_totalReputation; }
|
||||
public uint GetWeekReputation() { return m_weekReputation; }
|
||||
|
||||
public List<uint> GetTrackedCriteriaIds() { return m_trackedCriteriaIds; }
|
||||
public void SetTrackedCriteriaIds(List<uint> criteriaIds) { m_trackedCriteriaIds = criteriaIds; }
|
||||
public bool IsTrackingCriteriaId(uint criteriaId) { return m_trackedCriteriaIds.Contains(criteriaId); }
|
||||
public bool IsOnline() { return m_flags.HasFlag(GuildMemberFlags.Online); }
|
||||
|
||||
@@ -713,11 +713,6 @@ namespace Game
|
||||
Values[WorldCfg.ThreatRadius] = GetDefaultValue("ThreatRadius", 60.0f);
|
||||
|
||||
Values[WorldCfg.DeclinedNamesUsed] = GetDefaultValue("DeclinedNames", false);
|
||||
// always use declined names in the russian client
|
||||
var category = CliDB.CfgCategoriesStorage.LookupByKey((uint)Values[WorldCfg.RealmZone]);
|
||||
if (category != null && category.GetCreateCharsetMask().HasFlag(CfgCategoriesCharsets.Russian))
|
||||
Values[WorldCfg.DeclinedNamesUsed] = true;
|
||||
|
||||
Values[WorldCfg.ListenRangeSay] = GetDefaultValue("ListenRange.Say", 25.0f);
|
||||
Values[WorldCfg.ListenRangeTextemote] = GetDefaultValue("ListenRange.TextEmote", 25.0f);
|
||||
Values[WorldCfg.ListenRangeYell] = GetDefaultValue("ListenRange.Yell", 300.0f);
|
||||
|
||||
@@ -2836,7 +2836,7 @@ namespace Game.Spells
|
||||
|
||||
foreach (WorldObject unit in units)
|
||||
{
|
||||
if (!targets.ContainsKey(unit))
|
||||
if (!targets.ContainsKey(unit.ToUnit()))
|
||||
targets[unit.ToUnit()] = 0;
|
||||
|
||||
targets[unit.ToUnit()] |= 1u << (int)spellEffectInfo.EffectIndex;
|
||||
|
||||
@@ -1601,6 +1601,8 @@ namespace Game.Spells
|
||||
summon.SetTempSummonType(summonType);
|
||||
if (properties.Control == SummonCategory.Ally)
|
||||
summon.SetOwnerGUID(caster.GetGUID());
|
||||
else if (properties.Control == SummonCategory.Wild && caster.IsPlayer()) // there might be more conditions involved
|
||||
summon.SetDemonCreatorGUID(caster.GetGUID());
|
||||
|
||||
ExecuteLogEffectSummonObject(effectInfo.Effect, summon);
|
||||
}
|
||||
|
||||
@@ -4522,7 +4522,7 @@ namespace Game.Entities
|
||||
ushort dispelType = result.Read<ushort>(2);
|
||||
ulong mechanics = result.Read<ulong>(3);
|
||||
|
||||
CreatureImmunities immunities = mCreatureImmunities[id];
|
||||
CreatureImmunities immunities = new();
|
||||
immunities.School = new BitSet(new uint[] { school });
|
||||
immunities.DispelType = new BitSet(new uint[] { dispelType });
|
||||
immunities.Mechanic = new BitSet(mechanics);
|
||||
@@ -4536,7 +4536,7 @@ namespace Game.Entities
|
||||
if (immunities.Mechanic.ToUInt() != mechanics)
|
||||
Log.outError(LogFilter.Sql, $"Invalid value in `MechanicsMask` {mechanics} for creature immunities {id}, truncated");
|
||||
|
||||
foreach (string token in new StringArray(result.Read<string>(4), ','))
|
||||
foreach (string token in result.Read<string>(4).Split(',', StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
if (uint.TryParse(token, out uint effect) && effect != 0 && effect < (int)SpellEffectName.TotalSpellEffects)
|
||||
immunities.Effect.Add((SpellEffectName)effect);
|
||||
@@ -4544,13 +4544,15 @@ namespace Game.Entities
|
||||
Log.outError(LogFilter.Sql, $"Invalid effect type in `Effects` {token} for creature immunities {id}, skipped");
|
||||
}
|
||||
|
||||
foreach (string token in new StringArray(result.Read<string>(5), ','))
|
||||
foreach (string token in result.Read<string>(5).Split(',', StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
if (uint.TryParse(token, out uint aura) && aura != 0 && aura < (int)AuraType.Total)
|
||||
immunities.Aura.Add((AuraType)aura);
|
||||
else
|
||||
Log.outError(LogFilter.Sql, $"Invalid aura type in `Auras` {token} for creature immunities {id}, skipped");
|
||||
}
|
||||
|
||||
mCreatureImmunities[id] = immunities;
|
||||
}
|
||||
while (result.NextRow());
|
||||
}
|
||||
|
||||
@@ -451,6 +451,11 @@ namespace Game
|
||||
//Load weighted graph on taxi nodes path
|
||||
TaxiPathGraph.Initialize();
|
||||
|
||||
// always use declined names in the russian client
|
||||
var category = CliDB.CfgCategoriesStorage.LookupByKey(WorldConfig.GetUIntValue(WorldCfg.RealmZone));
|
||||
if (category != null && category.GetCreateCharsetMask().HasFlag(CfgCategoriesCharsets.Russian))
|
||||
WorldConfig.SetValue(WorldCfg.DeclinedNamesUsed, true);
|
||||
|
||||
MultiMap<uint, uint> mapData = new();
|
||||
foreach (MapRecord mapEntry in CliDB.MapStorage.Values)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user