Fix start up errors

This commit is contained in:
Hondacrx
2025-09-04 22:57:43 -04:00
parent f5906bce10
commit 0279fa9a0d
3 changed files with 95 additions and 96 deletions
+1 -1
View File
@@ -207,7 +207,7 @@ namespace Game.Chat
return true;
}
[Command("info", RBACPermissions.CommandGuildInfo, true)]
[Command("list", RBACPermissions.CommandGuildInfo, true)]
static bool HandleGuildListCommand(CommandHandler handler)
{
string titleAndSummaryColor = handler.IsConsole() ? "" : "|cff00ff00";
+88 -84
View File
@@ -212,89 +212,6 @@ namespace Game.Chat
return true;
}
[CommandNonGroup("damage", RBACPermissions.CommandDamage)]
static bool HandleDamageCommand(CommandHandler handler, uint damage, OptionalArg<SpellSchools> school, OptionalArg<SpellInfo> spellInfo)
{
Unit target = handler.GetSelectedUnit();
if (target == null || handler.GetSession().GetPlayer().GetTarget().IsEmpty())
{
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
return false;
}
Player player = target.ToPlayer();
if (player != null)
if (handler.HasLowerSecurity(player, ObjectGuid.Empty, false))
return false;
if (!target.IsAlive())
return true;
Player attacker = handler.GetSession().GetPlayer();
// flat melee damage without resistence/etc reduction
if (!school.HasValue)
{
Unit.DealDamage(attacker, target, damage, null, DamageEffectType.Direct, SpellSchoolMask.Normal, null, false);
if (target != attacker)
attacker.SendAttackStateUpdate(HitInfo.AffectsVictim, target, SpellSchoolMask.Normal, damage, 0, 0, VictimState.Hit, 0, 0);
return true;
}
SpellSchoolMask schoolmask = (SpellSchoolMask)(1 << (int)school.Value);
if (Unit.IsDamageReducedByArmor(schoolmask))
damage = Unit.CalcArmorReducedDamage(handler.GetPlayer(), target, damage, null, WeaponAttackType.BaseAttack);
// melee damage by specific school
if (!spellInfo.HasValue)
{
DamageInfo dmgInfo = new(attacker, target, damage, null, schoolmask, DamageEffectType.SpellDirect, WeaponAttackType.BaseAttack);
Unit.CalcAbsorbResist(dmgInfo);
if (dmgInfo.GetDamage() == 0)
return true;
damage = dmgInfo.GetDamage();
uint absorb = dmgInfo.GetAbsorb();
uint resist = dmgInfo.GetResist();
Unit.DealDamageMods(attacker, target, ref damage, ref absorb);
Unit.DealDamage(attacker, target, damage, null, DamageEffectType.Direct, schoolmask, null, false);
attacker.SendAttackStateUpdate(HitInfo.AffectsVictim, target, schoolmask, damage, absorb, resist, VictimState.Hit, 0, 0);
return true;
}
// non-melee damage
SpellNonMeleeDamage damageInfo = new(attacker, target, spellInfo, new SpellCastVisual(spellInfo.Value.GetSpellXSpellVisualId(attacker), 0), spellInfo.Value.SchoolMask);
damageInfo.damage = damage;
Unit.DealDamageMods(damageInfo.attacker, damageInfo.target, ref damageInfo.damage, ref damageInfo.absorb);
target.DealSpellDamage(damageInfo, true);
target.SendSpellNonMeleeDamageLog(damageInfo);
return true;
}
[CommandNonGroup("damage go", RBACPermissions.CommandDamage)]
static bool HandleDamageGoCommand(CommandHandler handler, VariantArg<GameobjectLinkData, ulong> spawnId, int damage)
{
GameObject go = handler.GetObjectFromPlayerMapByDbGuid(spawnId);
if (go == null)
{
handler.SendSysMessage(CypherStrings.CommandObjnotfound, spawnId);
return false;
}
if (!go.IsDestructibleBuilding())
{
handler.SendSysMessage(CypherStrings.InvalidGameobjectType);
return false;
}
go.ModifyHealth(-damage, handler.GetSession().GetPlayer());
handler.SendSysMessage(CypherStrings.GameobjectDamaged, go.GetName(), spawnId, -damage, go.GetGoValue().Building.Health);
return true;
}
[CommandNonGroup("dev", RBACPermissions.CommandDev)]
static bool HandleDevCommand(CommandHandler handler, OptionalArg<bool> enableArg)
{
@@ -2163,7 +2080,7 @@ namespace Game.Chat
}
[Command("", RBACPermissions.CommandAdditem, true)]
[Command("", RBACPermissions.CommandAdditem)]
static bool HandleAddItemCommand(CommandHandler handler, VariantArg<ItemLinkData, uint, string> item, OptionalArg<int> countArg, OptionalArg<string> bonusListIdString, OptionalArg<byte> itemContextArg)
{
Player player = handler.GetSession().GetPlayer();
@@ -2265,4 +2182,91 @@ namespace Game.Chat
return HandleAddItemCommandHelper(handler, player, target.GetConnectedPlayer(), item, countArg, bonusListIdString, itemContextArg);
}
}
[CommandGroup("damage")]
class MiscDamageCommands
{
[Command("", RBACPermissions.CommandDamage)]
static bool HandleDamageCommand(CommandHandler handler, uint damage, OptionalArg<SpellSchools> school, OptionalArg<SpellInfo> spellInfo)
{
Unit target = handler.GetSelectedUnit();
if (target == null || handler.GetSession().GetPlayer().GetTarget().IsEmpty())
{
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
return false;
}
Player player = target.ToPlayer();
if (player != null)
if (handler.HasLowerSecurity(player, ObjectGuid.Empty, false))
return false;
if (!target.IsAlive())
return true;
Player attacker = handler.GetSession().GetPlayer();
// flat melee damage without resistence/etc reduction
if (!school.HasValue)
{
Unit.DealDamage(attacker, target, damage, null, DamageEffectType.Direct, SpellSchoolMask.Normal, null, false);
if (target != attacker)
attacker.SendAttackStateUpdate(HitInfo.AffectsVictim, target, SpellSchoolMask.Normal, damage, 0, 0, VictimState.Hit, 0, 0);
return true;
}
SpellSchoolMask schoolmask = (SpellSchoolMask)(1 << (int)school.Value);
if (Unit.IsDamageReducedByArmor(schoolmask))
damage = Unit.CalcArmorReducedDamage(handler.GetPlayer(), target, damage, null, WeaponAttackType.BaseAttack);
// melee damage by specific school
if (!spellInfo.HasValue)
{
DamageInfo dmgInfo = new(attacker, target, damage, null, schoolmask, DamageEffectType.SpellDirect, WeaponAttackType.BaseAttack);
Unit.CalcAbsorbResist(dmgInfo);
if (dmgInfo.GetDamage() == 0)
return true;
damage = dmgInfo.GetDamage();
uint absorb = dmgInfo.GetAbsorb();
uint resist = dmgInfo.GetResist();
Unit.DealDamageMods(attacker, target, ref damage, ref absorb);
Unit.DealDamage(attacker, target, damage, null, DamageEffectType.Direct, schoolmask, null, false);
attacker.SendAttackStateUpdate(HitInfo.AffectsVictim, target, schoolmask, damage, absorb, resist, VictimState.Hit, 0, 0);
return true;
}
// non-melee damage
SpellNonMeleeDamage damageInfo = new(attacker, target, spellInfo, new SpellCastVisual(spellInfo.Value.GetSpellXSpellVisualId(attacker), 0), spellInfo.Value.SchoolMask);
damageInfo.damage = damage;
Unit.DealDamageMods(damageInfo.attacker, damageInfo.target, ref damageInfo.damage, ref damageInfo.absorb);
target.DealSpellDamage(damageInfo, true);
target.SendSpellNonMeleeDamageLog(damageInfo);
return true;
}
[Command("go", RBACPermissions.CommandDamage)]
static bool HandleDamageGoCommand(CommandHandler handler, VariantArg<GameobjectLinkData, ulong> spawnId, int damage)
{
GameObject go = handler.GetObjectFromPlayerMapByDbGuid(spawnId);
if (go == null)
{
handler.SendSysMessage(CypherStrings.CommandObjnotfound, spawnId);
return false;
}
if (!go.IsDestructibleBuilding())
{
handler.SendSysMessage(CypherStrings.InvalidGameobjectType);
return false;
}
go.ModifyHealth(-damage, handler.GetSession().GetPlayer());
handler.SendSysMessage(CypherStrings.GameobjectDamaged, go.GetName(), spawnId, -damage, go.GetGoValue().Building.Health);
return true;
}
}
}
+6 -11
View File
@@ -500,7 +500,7 @@ namespace Game
validateStartLevel(WorldCfg.StartAlliedRaceLevel, "StartDemonHunterPlayerLevel");
validateStartLevel(WorldCfg.MaxRecruitAFriendBonusPlayerLevel, "RecruitAFriend.MaxLevel");
if ((int)Values[WorldCfg.StartGmLevel] < (int)Values[WorldCfg.StartPlayerLevel])
if ((uint)Values[WorldCfg.StartGmLevel] < (uint)Values[WorldCfg.StartPlayerLevel])
{
Log.outError(LogFilter.ServerLoading, $"GM.StartLevel ({Values[WorldCfg.StartGmLevel]}) must be in range StartPlayerLevel({Values[WorldCfg.StartPlayerLevel]})..{SharedConst.MaxLevel}. Set to {Values[WorldCfg.StartPlayerLevel]}.");
Values[WorldCfg.StartGmLevel] = Values[WorldCfg.StartPlayerLevel];
@@ -508,18 +508,13 @@ namespace Game
Log.outInfo(LogFilter.ServerLoading, $"Will clear `logs` table of entries older than {Values[WorldCfg.LogdbCleartime]} seconds every {Values[WorldCfg.LogdbClearinterval]} minutes.");
if ((int)Values[WorldCfg.MaxOverspeedPings] != 0 && (int)Values[WorldCfg.MaxOverspeedPings] < 2)
if ((uint)Values[WorldCfg.MaxOverspeedPings] != 0 && (uint)Values[WorldCfg.MaxOverspeedPings] < 2)
{
Log.outError(LogFilter.ServerLoading, $"MaxOverspeedPings ({Values[WorldCfg.MaxOverspeedPings]}) must be in range 2..infinity (or 0 to disable check). Set to 2.");
Values[WorldCfg.MaxOverspeedPings] = 2;
}
// always use declined names in the russian client
Cfg_CategoriesRecord category = CliDB.CfgCategoriesStorage.LookupByKey(Values[WorldCfg.RealmZone]);
if (category != null && category.GetCreateCharsetMask().HasFlag(CfgCategoriesCharsets.Russian))
Values[WorldCfg.DeclinedNamesUsed] = true;
if ((int)Values[WorldCfg.ClientCacheVersion] == 0)
if ((uint)Values[WorldCfg.ClientCacheVersion] == 0)
Values[WorldCfg.ClientCacheVersion] = databaseCacheVersion;
void validateVisibilityDistance(WorldCfg config, string name)
@@ -545,17 +540,17 @@ namespace Game
validateVisibilityDistance(WorldCfg.MaxVisibilityDistanceArena, "Visibility.Distance.Arenas");
// No aggro from gray mobs
if ((int)Values[WorldCfg.NoGrayAggroAbove] > (int)Values[WorldCfg.MaxPlayerLevel])
if ((uint)Values[WorldCfg.NoGrayAggroAbove] > (uint)Values[WorldCfg.MaxPlayerLevel])
{
Log.outError(LogFilter.ServerLoading, $"NoGrayAggro.Above ({Values[WorldCfg.NoGrayAggroAbove]}) must be in range 0..{Values[WorldCfg.MaxPlayerLevel]}. Set to {Values[WorldCfg.MaxPlayerLevel]}.");
Values[WorldCfg.NoGrayAggroAbove] = Values[WorldCfg.MaxPlayerLevel];
}
if ((int)Values[WorldCfg.NoGrayAggroBelow] > (int)Values[WorldCfg.MaxPlayerLevel])
if ((uint)Values[WorldCfg.NoGrayAggroBelow] > (uint)Values[WorldCfg.MaxPlayerLevel])
{
Log.outError(LogFilter.ServerLoading, $"NoGrayAggro.Below ({Values[WorldCfg.NoGrayAggroBelow]}) must be in range 0..{Values[WorldCfg.MaxPlayerLevel]}. Set to {Values[WorldCfg.MaxPlayerLevel]}.");
Values[WorldCfg.NoGrayAggroBelow] = Values[WorldCfg.MaxPlayerLevel];
}
if ((int)Values[WorldCfg.NoGrayAggroAbove] > 0 && (int)Values[WorldCfg.NoGrayAggroAbove] < (int)Values[WorldCfg.NoGrayAggroBelow])
if ((uint)Values[WorldCfg.NoGrayAggroAbove] > 0 && (uint)Values[WorldCfg.NoGrayAggroAbove] < (uint)Values[WorldCfg.NoGrayAggroBelow])
{
Log.outError(LogFilter.ServerLoading, $"NoGrayAggro.Below ({Values[WorldCfg.NoGrayAggroBelow]}) cannot be greater than NoGrayAggro.Above ({Values[WorldCfg.NoGrayAggroAbove]}). Set to {Values[WorldCfg.NoGrayAggroAbove]}.");
Values[WorldCfg.NoGrayAggroBelow] = Values[WorldCfg.NoGrayAggroAbove];