BFA Update (still lots of testing to do tho)

This commit is contained in:
hondacrx
2018-12-10 12:46:25 -05:00
parent 468b053946
commit 8e20114e10
256 changed files with 35613 additions and 10459 deletions
+76 -1
View File
@@ -265,6 +265,81 @@ namespace Game.Chat
return true;
}
[Command("changeaccount", RBACPermissions.CommandCharacterChangeaccount, true)]
static bool HandleCharacterChangeAccountCommand(StringArguments args, CommandHandler handler)
{
string playerNameStr;
string accountName;
handler.extractOptFirstArg(args, out playerNameStr, out accountName);
if (accountName.IsEmpty())
return false;
ObjectGuid targetGuid;
string targetName;
Player playerNotUsed;
if (!handler.extractPlayerTarget(new StringArguments(playerNameStr), out playerNotUsed, out targetGuid, out targetName))
return false;
CharacterInfo characterInfo = Global.WorldMgr.GetCharacterInfo(targetGuid);
if (characterInfo == null)
{
handler.SendSysMessage(CypherStrings.PlayerNotFound);
return false;
}
uint oldAccountId = characterInfo.AccountId;
uint newAccountId = oldAccountId;
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_ID_BY_NAME);
stmt.AddValue(0, accountName);
SQLResult result = DB.Login.Query(stmt);
if (!result.IsEmpty())
newAccountId = result.Read<uint>(0);
else
{
handler.SendSysMessage(CypherStrings.AccountNotExist, accountName);
return false;
}
// nothing to do :)
if (newAccountId == oldAccountId)
return true;
uint charCount = Global.AccountMgr.GetCharactersCount(newAccountId);
if (charCount != 0)
{
if (charCount >= WorldConfig.GetIntValue(WorldCfg.CharactersPerRealm))
{
handler.SendSysMessage(CypherStrings.AccountCharacterListFull, accountName, newAccountId);
return false;
}
}
stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ACCOUNT_BY_GUID);
stmt.AddValue(0, newAccountId);
stmt.AddValue(1, targetGuid.GetCounter());
DB.Characters.DirectExecute(stmt);
Global.WorldMgr.UpdateRealmCharCount(oldAccountId);
Global.WorldMgr.UpdateRealmCharCount(newAccountId);
Global.WorldMgr.UpdateCharacterInfoAccount(targetGuid, newAccountId);
handler.SendSysMessage(CypherStrings.ChangeAccountSuccess, targetName, accountName);
string logString = $"changed ownership of player {targetName} ({targetGuid.ToString()}) from account {oldAccountId} to account {newAccountId}";
WorldSession session = handler.GetSession();
if (session != null)
{
Player player = session.GetPlayer();
if (player != null)
Log.outCommand(session.GetAccountId(), $"GM {player.GetName()} (Account: {session.GetAccountId()}) {logString}");
}
else
Log.outCommand(0, $"{handler.GetCypherString(CypherStrings.Console)} {logString}");
return true;
}
[Command("changefaction", RBACPermissions.CommandCharacterChangefaction, true)]
static bool HandleCharacterChangeFactionCommand(StringArguments args, CommandHandler handler)
{
@@ -702,7 +777,7 @@ namespace Game.Chat
{
player.GiveLevel((uint)newLevel);
player.InitTalentForLevel();
player.SetUInt32Value(PlayerFields.Xp, 0);
player.SetUInt32Value(ActivePlayerFields.Xp, 0);
if (handler.needReportToTarget(player))
{
+2 -2
View File
@@ -245,9 +245,9 @@ namespace Game.Chat.Commands
for (ushort i = 0; i < PlayerConst.ExploredZonesSize; ++i)
{
if (flag != 0)
handler.GetSession().GetPlayer().SetFlag(PlayerFields.ExploredZones1 + i, 0xFFFFFFFF);
handler.GetSession().GetPlayer().SetFlag(ActivePlayerFields.ExploredZones + i, 0xFFFFFFFF);
else
handler.GetSession().GetPlayer().SetFlag(PlayerFields.ExploredZones1 + i, 0);
handler.GetSession().GetPlayer().SetFlag(ActivePlayerFields.ExploredZones + i, 0);
}
return true;
+1 -1
View File
@@ -1173,7 +1173,7 @@ namespace Game.Chat
phaseShift.AddPhase(phase, PhaseFlags.None, null);
if (uint.TryParse(args.NextString(), out uint map))
phaseShift.AddUiWorldMapAreaIdSwap(map);
phaseShift.AddUiMapPhaseId(map);
PhasingHandler.SendToPlayer(handler.GetSession().GetPlayer(), phaseShift);
return true;
+10 -2
View File
@@ -542,7 +542,11 @@ namespace Game.Chat
}
if (handler.GetSession() != null)
handler.SendSysMessage(CypherStrings.QuestListChat, qInfo.Id, qInfo.Id, qInfo.Level, title, statusStr);
handler.SendSysMessage(CypherStrings.QuestListChat, qInfo.Id, qInfo.Id,
handler.GetSession().GetPlayer().GetQuestLevel(qInfo),
handler.GetSession().GetPlayer().GetQuestMinLevel(qInfo),
qInfo.MaxScalingLevel, qInfo.ScalingFactionGroup,
title, statusStr);
else
handler.SendSysMessage(CypherStrings.QuestListConsole, qInfo.Id, title, statusStr);
@@ -590,7 +594,11 @@ namespace Game.Chat
}
if (handler.GetSession() != null)
handler.SendSysMessage(CypherStrings.QuestListChat, qInfo.Id, qInfo.Id, qInfo.Level, _title, statusStr);
handler.SendSysMessage(CypherStrings.QuestListChat, qInfo.Id, qInfo.Id,
handler.GetSession().GetPlayer().GetQuestLevel(qInfo),
handler.GetSession().GetPlayer().GetQuestMinLevel(qInfo),
qInfo.MaxScalingLevel, qInfo.ScalingFactionGroup,
_title, statusStr);
else
handler.SendSysMessage(CypherStrings.QuestListConsole, qInfo.Id, _title, statusStr);
+5 -5
View File
@@ -192,7 +192,7 @@ namespace Game.Chat
float zoneX = obj.GetPositionX();
float zoneY = obj.GetPositionY();
Global.DB2Mgr.Map2ZoneCoordinates(zoneId, ref zoneX, ref zoneY);
Global.DB2Mgr.Map2ZoneCoordinates((int)zoneId, ref zoneX, ref zoneY);
Map map = obj.GetMap();
float groundZ = map.GetHeight(obj.GetPhaseShift(), obj.GetPositionX(), obj.GetPositionY(), MapConst.MaxHeight);
@@ -1189,8 +1189,8 @@ namespace Game.Chat
}
uint val = (1u << (area.AreaBit % 32));
uint currFields = playerTarget.GetUInt32Value(PlayerFields.ExploredZones1 + offset);
playerTarget.SetUInt32Value(PlayerFields.ExploredZones1 + offset, (currFields | val));
uint currFields = playerTarget.GetUInt32Value(ActivePlayerFields.ExploredZones + offset);
playerTarget.SetUInt32Value(ActivePlayerFields.ExploredZones + offset, (currFields | val));
handler.SendSysMessage(CypherStrings.ExploreArea);
return true;
@@ -1230,8 +1230,8 @@ namespace Game.Chat
}
uint val = (1u << (area.AreaBit % 32));
uint currFields = playerTarget.GetUInt32Value(PlayerFields.ExploredZones1 + offset);
playerTarget.SetUInt32Value(PlayerFields.ExploredZones1 + offset, (currFields ^ val));
uint currFields = playerTarget.GetUInt32Value(ActivePlayerFields.ExploredZones + offset);
playerTarget.SetUInt32Value(ActivePlayerFields.ExploredZones + offset, (currFields ^ val));
handler.SendSysMessage(CypherStrings.UnexploreArea);
return true;
+5 -1
View File
@@ -215,7 +215,11 @@ namespace Game.Chat
if (CheckModifySpeed(args, handler, target, out Scale, 0.1f, 10.0f, false))
{
NotifyModification(handler, target, CypherStrings.YouChangeSize, CypherStrings.YoursSizeChanged, Scale);
target.SetObjectScale(Scale);
Creature creatureTarget = target.ToCreature();
if (creatureTarget)
creatureTarget.SetFloatValue(UnitFields.DisplayScale, Scale);
else
target.SetObjectScale(Scale);
return true;
}
return false;
+4 -4
View File
@@ -38,7 +38,7 @@ namespace Game.Chat
}
// .addquest #entry'
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level:min_level:max_level:scaling_faction|h[name]|h|r
string cId = handler.extractKeyFromLink(args, "Hquest");
if (!uint.TryParse(cId, out uint entry))
return false;
@@ -78,7 +78,7 @@ namespace Game.Chat
}
// .quest complete #entry
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level:min_level:max_level:scaling_faction|h[name]|h|r
string cId = handler.extractKeyFromLink(args, "Hquest");
if (!uint.TryParse(cId, out uint entry))
return false;
@@ -170,7 +170,7 @@ namespace Game.Chat
}
// .removequest #entry'
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level:min_level:max_level:scaling_faction|h[name]|h|r
string cId = handler.extractKeyFromLink(args, "Hquest");
if (!uint.TryParse(cId, out uint entry))
return false;
@@ -224,7 +224,7 @@ namespace Game.Chat
}
// .quest reward #entry
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level:min_level:max_level:scaling_faction|h[name]|h|r
string cId = handler.extractKeyFromLink(args, "Hquest");
if (!uint.TryParse(cId, out uint entry))
return false;
+4 -4
View File
@@ -51,8 +51,8 @@ namespace Game.Chat
if (!handler.extractPlayerTarget(args, out target))
return false;
target.SetUInt32Value(PlayerFields.Kills, 0);
target.SetUInt32Value(PlayerFields.LifetimeHonorableKills, 0);
target.SetUInt32Value(ActivePlayerFields.Kills, 0);
target.SetUInt32Value(ActivePlayerFields.LifetimeHonorableKills, 0);
target.UpdateCriteria(CriteriaTypes.EarnHonorableKill);
return true;
@@ -85,7 +85,7 @@ namespace Game.Chat
player.SetUInt32Value(UnitFields.Flags, (uint)UnitFlags.PvpAttackable);
//-1 is default value
player.SetUInt32Value(PlayerFields.WatchedFactionIndex, 0xFFFFFFFF);
player.SetUInt32Value(ActivePlayerFields.WatchedFactionIndex, 0xFFFFFFFF);
return true;
}
@@ -110,7 +110,7 @@ namespace Game.Chat
target.InitStatsForLevel(true);
target.InitTaxiNodesForLevel();
target.InitTalentForLevel();
target.SetUInt32Value(PlayerFields.Xp, 0);
target.SetUInt32Value(ActivePlayerFields.Xp, 0);
target._ApplyAllLevelScaleItemMods(true);
+1 -1
View File
@@ -189,7 +189,7 @@ namespace Game.Chat.Commands
titles &= ~titles2; // remove not existed titles
target.SetUInt64Value(PlayerFields.KnownTitles, titles);
target.SetUInt64Value(ActivePlayerFields.KnownTitles, titles);
handler.SendSysMessage(CypherStrings.Done);
if (!target.HasTitle(target.GetUInt32Value(PlayerFields.ChosenTitle)))