Misc fixes.

This commit is contained in:
hondacrx
2022-01-09 14:33:39 -05:00
parent ebb1379d49
commit 595338284c
11 changed files with 37 additions and 83 deletions
+6 -1
View File
@@ -1319,7 +1319,7 @@ namespace Framework.Constants
Model = 32, // Source = Creature, Datalong = Model Id Model = 32, // Source = Creature, Datalong = Model Id
CloseGossip = 33, // Source = Player CloseGossip = 33, // Source = Player
Playmovie = 34, // Source = Player, Datalong = Movie Id Playmovie = 34, // Source = Player, Datalong = Movie Id
Movement = 35, // Source = Creature, datalong = MovementType, datalong2 = MovementDistance (spawndist f.ex.), dataint = pathid Movement = 35, // Source = Creature, datalong = MovementType, datalong2 = MovementDistance (wander_distance f.ex.), dataint = pathid
PlayAnimkit = 36 // Source = Creature, datalong = AnimKit id PlayAnimkit = 36 // Source = Creature, datalong = AnimKit id
} }
@@ -1455,6 +1455,11 @@ namespace Framework.Constants
CleanCharacterDb, CleanCharacterDb,
CleanOldMailTime, CleanOldMailTime,
ClientCacheVersion, ClientCacheVersion,
CommunityAllowBnetClubTypeEnabled,
CommunityAllowCharacterClubTypeEnabled,
CommunityChatKeepDays,
CommunityClubFinderEnabled,
CommunityClubsEnabled,
Compression, Compression,
CorpseDecayElite, CorpseDecayElite,
CorpseDecayNormal, CorpseDecayNormal,
+3
View File
@@ -477,8 +477,11 @@ namespace Game.Entities
val = maxHealth; val = maxHealth;
} }
ulong oldVal = GetHealth();
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Health), val); SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Health), val);
TriggerOnHealthChangeAuras(oldVal, val);
// group update // group update
Player player = ToPlayer(); Player player = ToPlayer();
if (player) if (player)
+1 -1
View File
@@ -547,7 +547,7 @@ namespace Game.Entities
void LoadStaticPassengers() void LoadStaticPassengers()
{ {
uint mapId = (uint)GetGoInfo().MoTransport.SpawnMap; uint mapId = (uint)GetGoInfo().MoTransport.SpawnMap;
var cells = Global.ObjectMgr.GetMapObjectGuids(mapId, (byte)GetMap().GetDifficultyID()); var cells = Global.ObjectMgr.GetMapObjectGuids(mapId, GetMap().GetDifficultyID());
if (cells == null) if (cells == null)
return; return;
foreach (var cell in cells) foreach (var cell in cells)
+1 -1
View File
@@ -753,7 +753,7 @@ namespace Game.Garrisons
if (go.GetGoType() == GameObjectTypes.GarrisonBuilding && go.GetGoInfo().garrisonBuilding.SpawnMap != 0) if (go.GetGoType() == GameObjectTypes.GarrisonBuilding && go.GetGoInfo().garrisonBuilding.SpawnMap != 0)
{ {
foreach (var cellGuids in Global.ObjectMgr.GetMapObjectGuids((uint)go.GetGoInfo().garrisonBuilding.SpawnMap, (byte)map.GetDifficultyID())) foreach (var cellGuids in Global.ObjectMgr.GetMapObjectGuids((uint)go.GetGoInfo().garrisonBuilding.SpawnMap, map.GetDifficultyID()))
{ {
foreach (var spawnId in cellGuids.Value.creatures) foreach (var spawnId in cellGuids.Value.creatures)
{ {
+7 -11
View File
@@ -50,19 +50,9 @@ namespace Game
return; return;
} }
if (packet.ChannelName.Length > 31)
{
ChannelNotify channelNotify = new();
channelNotify.Type = ChatNotify.InvalidNameNotice;
channelNotify.Channel = packet.ChannelName;
SendPacket(channelNotify);
Log.outError(LogFilter.Network, $"Player {GetPlayer().GetGUID()} tried to create a channel with a name more than 31 characters long - blocked");
return;
}
if (packet.Password.Length > 127) if (packet.Password.Length > 127)
{ {
Log.outError(LogFilter.Network, $"Player {GetPlayer().GetGUID()} tried to create a channel with a password more that 127 characters long - blocked"); Log.outError(LogFilter.Network, $"Player {GetPlayer().GetGUID()} tried to create a channel with a password more than 127 characters long - blocked");
return; return;
} }
@@ -79,6 +69,12 @@ namespace Game
else else
{ {
// custom channel // custom channel
if (packet.ChannelName.Length > 31)
{
Log.outError(LogFilter.Network, $"Player {GetPlayer().GetGUID()} tried to create a channel with a name more than 31 characters long - blocked");
return;
}
Channel channel = cMgr.GetCustomChannel(packet.ChannelName); Channel channel = cMgr.GetCustomChannel(packet.ChannelName);
if (channel != null) if (channel != null)
channel.JoinChannel(GetPlayer(), packet.Password); channel.JoinChannel(GetPlayer(), packet.Password);
+4 -5
View File
@@ -3121,13 +3121,12 @@ namespace Game.Maps
public void SaveRespawnInfoDB(RespawnInfo info, SQLTransaction dbTrans = null) public void SaveRespawnInfoDB(RespawnInfo info, SQLTransaction dbTrans = null)
{ {
// Just here for support of compatibility mode
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_RESPAWN); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_RESPAWN);
stmt.AddValue(0, (ushort)info.type); stmt.AddValue(0, (ushort)info.type);
stmt.AddValue(0, info.spawnId); stmt.AddValue(1, info.spawnId);
stmt.AddValue(1, info.respawnTime); stmt.AddValue(2, info.respawnTime);
stmt.AddValue(2, GetId()); stmt.AddValue(3, GetId());
stmt.AddValue(3, GetInstanceId()); stmt.AddValue(4, GetInstanceId());
DB.Characters.ExecuteOrAppend(dbTrans, stmt); DB.Characters.ExecuteOrAppend(dbTrans, stmt);
} }
+4 -5
View File
@@ -228,7 +228,7 @@ namespace Game
if (activeCount != pool.numActive) if (activeCount != pool.numActive)
{ {
doRegenerate = true; doRegenerate = true;
Log.outError(LogFilter.Sql, "Table `pool_quest_save` has %u active members saved for pool %u, which requests %u active members. Pool spawns re-generated.", activeCount, pool.poolId, pool.numActive); Log.outError(LogFilter.Sql, $"Table `pool_quest_save` has {activeCount} active members saved for pool {pool.poolId}, which requests {pool.numActive} active members. Pool spawns re-generated.");
} }
} }
@@ -242,13 +242,12 @@ namespace Game
{ {
foreach (uint quest in pool.members[memberKey]) foreach (uint quest in pool.members[memberKey])
{ {
QuestPool refe = _poolLookup[quest]; if (_poolLookup.ContainsKey(quest))
if (refe != null)
{ {
Log.outError(LogFilter.Sql, "Table `quest_pool_members` lists quest %u as member of pool %u, but it is already a member of pool %u. Skipped.", quest, pool.poolId, refe.poolId); Log.outError(LogFilter.Sql, $"Table `quest_pool_members` lists quest {quest} as member of pool {pool.poolId}, but it is already a member of pool {_poolLookup[quest].poolId}. Skipped.");
continue; continue;
} }
refe = pool; _poolLookup[quest] = pool;
} }
} }
} }
+6
View File
@@ -991,6 +991,12 @@ namespace Game
// Whether to use LoS from game objects // Whether to use LoS from game objects
Values[WorldCfg.CheckGobjectLos] = GetDefaultValue("CheckGameObjectLoS", true); Values[WorldCfg.CheckGobjectLos] = GetDefaultValue("CheckGameObjectLoS", true);
// FactionBalance
Values[WorldCfg.FactionBalanceLevelCheckDiff] = GetDefaultValue("Pvp.FactionBalance.LevelCheckDiff", 0);
Values[WorldCfg.CallToArms5Pct] = GetDefaultValue("Pvp.FactionBalance.Pct5", 0.6f);
Values[WorldCfg.CallToArms10Pct] = GetDefaultValue("Pvp.FactionBalance.Pct10", 0.7f);
Values[WorldCfg.CallToArms20Pct] = GetDefaultValue("Pvp.FactionBalance.Pct20", 0.8f);
// call ScriptMgr if we're reloading the configuration // call ScriptMgr if we're reloading the configuration
if (reload) if (reload)
Global.ScriptMgr.OnConfigLoad(reload); Global.ScriptMgr.OnConfigLoad(reload);
+1
View File
@@ -3309,6 +3309,7 @@ namespace Game.Spells
case 61716: // Rabbit Costume case 61716: // Rabbit Costume
case 61734: // Noblegarden Bunny case 61734: // Noblegarden Bunny
case 62344: // Fists of Stone case 62344: // Fists of Stone
case 50344: // Dream Funnel
case 61819: // Manabonked! (item) case 61819: // Manabonked! (item)
case 61834: // Manabonked! (minigob) case 61834: // Manabonked! (minigob)
case 73523: // Rigor Mortis case 73523: // Rigor Mortis
+4 -42
View File
@@ -309,7 +309,7 @@ namespace Scripts.World.GameObjects
public const uint Darnassus = 1657; public const uint Darnassus = 1657;
public const uint Ashenvale = 331; public const uint Ashenvale = 331;
public const uint HillsbradFoothills = 267; public const uint HillsbradFoothills = 267;
public const uint Duskwood = 42; public const uint Duskwood = 10;
} }
struct Misc struct Misc
@@ -328,32 +328,6 @@ namespace Scripts.World.GameObjects
public const uint EventRingBell = 1; public const uint EventRingBell = 1;
} }
[Script]
class go_cat_figurine : GameObjectAI
{
public go_cat_figurine(GameObject go) : base(go) { }
public override bool GossipHello(Player player)
{
player.CastSpell(player, SpellIds.SummonGhostSaber, true);
return false;
}
}
[Script]
class go_barov_journal : GameObjectAI
{
public go_barov_journal(GameObject go) : base(go) { }
public override bool GossipHello(Player player)
{
if (player.HasSkill(SkillType.Tailoring) && player.GetBaseSkillValue(SkillType.Tailoring) >= 280 && !player.HasSpell(26086))
player.CastSpell(player, 26095, false);
return true;
}
}
[Script] [Script]
class go_gilded_brazier : GameObjectAI class go_gilded_brazier : GameObjectAI
{ {
@@ -374,20 +348,6 @@ namespace Scripts.World.GameObjects
} }
} }
[Script]
class go_orb_of_command : GameObjectAI
{
public go_orb_of_command(GameObject go) : base(go) { }
public override bool GossipHello(Player player)
{
if (player.GetQuestRewardStatus(7761))
player.CastSpell(player, 23460, true);
return true;
}
}
[Script] [Script]
class go_tablet_of_madness : GameObjectAI class go_tablet_of_madness : GameObjectAI
{ {
@@ -1320,7 +1280,9 @@ namespace Scripts.World.GameObjects
if (eventId == Misc.GameEventHourlyBells && start) if (eventId == Misc.GameEventHourlyBells && start)
{ {
var localTm = Time.UnixTimeToDateTime(GameTime.GetGameTime()).ToLocalTime(); var localTm = Time.UnixTimeToDateTime(GameTime.GetGameTime()).ToLocalTime();
int _rings = (localTm.Hour - 1) % 12 + 1; int _rings = localTm.Hour % 12;
if (_rings == 0) // 00:00 and 12:00
_rings = 12;
for (var i = 0; i < _rings; ++i) for (var i = 0; i < _rings; ++i)
_scheduler.Schedule(TimeSpan.FromSeconds(i * 4 + 1), task => me.PlayDirectSound(_soundId)); _scheduler.Schedule(TimeSpan.FromSeconds(i * 4 + 1), task => me.PlayDirectSound(_soundId));
-17
View File
@@ -165,23 +165,6 @@ namespace Scripts.World.ItemScripts
} }
} }
[Script]
class item_incendiary_explosives : ItemScript
{
public item_incendiary_explosives() : base("item_incendiary_explosives") { }
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
{
if (player.FindNearestCreature(26248, 15) || player.FindNearestCreature(26249, 15))
return false;
else
{
player.SendEquipError(InventoryResult.OutOfRange, item, null);
return true;
}
}
}
[Script] [Script]
class item_mysterious_egg : ItemScript class item_mysterious_egg : ItemScript
{ {