Misc updates/fixes

This commit is contained in:
hondacrx
2022-01-27 12:36:56 -05:00
parent 169abc1531
commit 6c0e21b4de
36 changed files with 415 additions and 354 deletions
+14 -16
View File
@@ -27,11 +27,8 @@ namespace Game.Chat
class CastCommands
{
[Command("", RBACPermissions.CommandCast)]
static bool HandleCastCommand(CommandHandler handler, StringArguments args)
static bool HandleCastCommand(CommandHandler handler, SpellInfo spell, string triggeredStr)
{
if (args.Empty())
return false;
Unit target = handler.GetSelectedUnit();
if (!target)
{
@@ -39,22 +36,19 @@ namespace Game.Chat
return false;
}
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spellId = handler.ExtractSpellIdFromLink(args);
if (spellId == 0)
if (!CheckSpellExistsAndIsValid(handler, spell))
return false;
if (!CheckSpellExistsAndIsValid(handler, spellId))
return false;
string triggeredStr = args.NextString();
if (!string.IsNullOrEmpty(triggeredStr))
TriggerCastFlags triggerFlags = TriggerCastFlags.None;
if (!triggeredStr.IsEmpty())
{
if (triggeredStr != "triggered")
if ("triggered".Contains(triggeredStr)) // check if "triggered" starts with *triggeredStr (e.g. "trig", "trigger", etc.)
triggerFlags = TriggerCastFlags.FullDebugMask;
else
return false;
}
handler.GetSession().GetPlayer().CastSpell(target, spellId, !triggeredStr.IsEmpty());
handler.GetSession().GetPlayer().CastSpell(target, spell.Id, new CastSpellExtraArgs(triggerFlags));
return true;
}
@@ -228,7 +222,11 @@ namespace Game.Chat
static bool CheckSpellExistsAndIsValid(CommandHandler handler, uint spellId)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
return CheckSpellExistsAndIsValid(handler, Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None));
}
static bool CheckSpellExistsAndIsValid(CommandHandler handler, SpellInfo spellInfo)
{
if (spellInfo == null)
{
handler.SendSysMessage(CypherStrings.CommandNospellfound);
@@ -237,7 +235,7 @@ namespace Game.Chat
if (!Global.SpellMgr.IsSpellValid(spellInfo, handler.GetPlayer()))
{
handler.SendSysMessage(CypherStrings.CommandSpellBroken, spellId);
handler.SendSysMessage(CypherStrings.CommandSpellBroken, spellInfo.Id);
return false;
}
return true;
@@ -144,7 +144,7 @@ namespace Game.Chat
target.SetName(newName);
session = target.GetSession();
if (session != null)
session.KickPlayer();
session.KickPlayer("HandleCharacterRenameCommand GM Command renaming character");
}
else
{
@@ -463,7 +463,7 @@ namespace Game.Chat
{
characterGuid = player.GetGUID();
accountId = player.GetSession().GetAccountId();
player.GetSession().KickPlayer();
player.GetSession().KickPlayer("HandleCharacterEraseCommand GM Command deleting character");
}
else
{
@@ -1331,6 +1331,41 @@ namespace Game.Chat
}
}
[CommandGroup("pvp", RBACPermissions.CommandDebug)]
class PvpCommands
{
[Command("warmode", RBACPermissions.CommandDebug)]
static bool HandleDebugWarModeFactionBalanceCommand(CommandHandler handler, string command, int rewardValue = 0)
{
// USAGE: .debug pvp fb <alliance|horde|neutral|off> [pct]
// neutral Sets faction balance off.
// alliance Set faction balance to alliance.
// horde Set faction balance to horde.
// off Reset the faction balance and use the calculated value of it
switch (command.ToLower())
{
default: // workaround for Variant of only ExactSequences not being supported
handler.SendSysMessage(CypherStrings.BadValue);
return false;
case "alliance":
Global.WorldMgr.SetForcedWarModeFactionBalanceState(TeamId.Alliance, rewardValue);
break;
case "horde":
Global.WorldMgr.SetForcedWarModeFactionBalanceState(TeamId.Horde, rewardValue);
break;
case "neutral":
Global.WorldMgr.SetForcedWarModeFactionBalanceState(TeamId.Neutral);
break;
case "off":
Global.WorldMgr.DisableForcedWarModeFactionBalanceState();
break;
}
return true;
}
}
[CommandGroup("send", RBACPermissions.CommandDebugSend)]
class SendCommands
{
+1 -1
View File
@@ -42,7 +42,7 @@ namespace Game.Chat.Commands
return DoTeleport(handler, new Position(at.Pos.X, at.Pos.Y, at.Pos.Z), at.ContinentID);
}
[Command("areatrigger", RBACPermissions.CommandGo)]
[Command("boss", RBACPermissions.CommandGo)]
static bool HandleGoBossCommand(CommandHandler handler, string[] needles)
{
if (needles.Empty())
+1 -1
View File
@@ -1115,7 +1115,7 @@ namespace Game.Chat
else
handler.SendSysMessage(CypherStrings.CommandKickmessage, playerName);
target.GetSession().KickPlayer();
target.GetSession().KickPlayer("HandleKickPlayerCommand GM Command");
return true;
}