diff --git a/docs/commands-list.md b/docs/commands-list.md index 88fa3fb..311c4e0 100644 --- a/docs/commands-list.md +++ b/docs/commands-list.md @@ -43,6 +43,9 @@ Switch private Tag for connect ### !powerful Makes your character with absurd amount of damage. Useful for testing. +### !resourceful +Makes your character with full resource. Useful for testing. + ### !info Get current game information. diff --git a/src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs b/src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs index 9eddce5..5c275dd 100644 --- a/src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs +++ b/src/DiIiS-NA/D3-GameServer/CommandManager/GameCommands.cs @@ -55,6 +55,33 @@ public class PowerfulCommand : CommandGroup } } +[CommandGroup("resourcefull", "Makes your character with full resource. Useful for testing.", + Account.UserLevels.Tester)] +public class ResourcefullCommand : CommandGroup +{ + [DefaultCommand] + public string Resourcefull(string[] @params, BattleClient invokerClient) + { + if (invokerClient?.InGameClient?.Player is not { } player) + return "You must be in game to use this command."; + + if (player.Attributes.FixedMap.Contains(FixedAttribute.Resourcefull)) + { + player.Attributes.FixedMap.Remove(FixedAttribute.Resourcefull); + player.Attributes.BroadcastChangedIfRevealed(); + return "You are no longer Resourcefull."; + } + + player.Attributes.FixedMap.Add(FixedAttribute.Resourcefull, (attributes) => + { + attributes[GameAttribute.Resource_Cur, 1] = 100; + }); + + player.Attributes.BroadcastChangedIfRevealed(); + return "You are full resource."; + } +} + [CommandGroup("info", "Get current game information.")] public class InfoCommand : CommandGroup { diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/GSBackend.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/GSBackend.cs index 09ea9a2..b5ad416 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/GSBackend.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/GSBackend.cs @@ -43,8 +43,8 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem { game.SetAct(int.Parse(args[2].Trim())); game.SetGameMode((Game.Mode)int.Parse(args[7].Trim())); - game.IsHardcore = (args[6].Trim() == "True" ? true : false); - game.IsSeasoned = (args[8].Trim() == "True" ? true : false); + game.IsHardcore = args[6].Trim() == "True" ? true : false; + game.IsSeasoned = args[8].Trim() == "True" ? true : false; game.SetDifficulty(int.Parse(args[3].Trim())); if (game.GameMode != Game.Mode.Portals) game.SetQuestProgress(int.Parse(args[4].Trim()), int.Parse(args[5].Trim())); @@ -92,140 +92,138 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem }); } - private void BattleNetSocketSend(string data) => BattleNetSocketSend(Encoding.UTF8.GetBytes(data)); + private void BattleNetSocketSend(string data) => BattleNetSocketSend(data); private bool SenderServerDisconnected() { - Logger.Warn("MooNetServer was disconnected!"); + Logger.Warn("Blizznet was disconnected!"); return true; } public void RegisterGameServer(string ip, int port) { Logger.MethodTrace($"ip {ip}, port {port}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"rngsr|{ip}/{port}")); + BattleNetSocketSend($"rngsr|{ip}/{port}"); } public void RegisterPvPGameServer(string ip, int port) { Logger.MethodTrace($"ip {ip}, port {port}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"rnpvpgsr|{ip}/{port}")); + BattleNetSocketSend($"rnpvpgsr|{ip}/{port}"); } public void GrantAchievement(ulong gameAccountId, ulong achievementId) { Logger.MethodTrace($"gameAccountId {gameAccountId}, achievementId {achievementId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"grachi|{gameAccountId}/{achievementId}")); + BattleNetSocketSend($"grachi|{gameAccountId}/{achievementId}"); } public void GrantCriteria(ulong gameAccountId, ulong criteriaId) { Logger.MethodTrace($"gameAccountId {gameAccountId}, achievementId {criteriaId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"gcrit|{gameAccountId}/{criteriaId}")); + BattleNetSocketSend($"gcrit|{gameAccountId}/{criteriaId}"); } public void UpdateAchievementCounter(ulong gameAccountId, int type, uint addCounter, int comparand, ulong achievement = 0) { Logger.MethodTrace($"type {type}, addCounter {addCounter}, comparand {comparand}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes( - $"uoacce|{gameAccountId}/{type}/{addCounter}/{comparand}/{achievement}")); + BattleNetSocketSend($"uoacce|{gameAccountId}/{type}/{addCounter}/{comparand}/{achievement}"); } public void UpdateSingleAchievementCounter(ulong gameAccountId, ulong achId, uint addCounter) { Logger.MethodTrace($"type {achId}, addCounter {addCounter}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"upsnaccr|{gameAccountId}/{achId}/{addCounter}")); + BattleNetSocketSend($"upsnaccr|{gameAccountId}/{achId}/{addCounter}"); } public void UpdateQuantity(ulong gameAccountId, ulong achievementId, uint addCounter) { Logger.MethodTrace($"achievementId {achievementId}, addCounter {addCounter}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"upequt|{gameAccountId}/{achievementId}/{addCounter}")); + BattleNetSocketSend($"upequt|{gameAccountId}/{achievementId}/{addCounter}"); } public void CheckQuestCriteria(ulong gameAccountId, int questId, bool isCoop) { Logger.MethodTrace($"gameAccountId {gameAccountId}, questId {questId}, coop {isCoop}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"cqc|{gameAccountId}/{questId}/{(isCoop ? "True" : "False")}")); + BattleNetSocketSend($"cqc|{gameAccountId}/{questId}/{(isCoop ? "True" : "False")}"); } public void CheckKillMonsterCriteria(ulong gameAccountId, int actorId, int type, bool isHardcore) { Logger.MethodTrace($"gameAccountId {gameAccountId}, actorId {actorId}, type {type}, hc {isHardcore}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes( - $"ckmc|{gameAccountId}/{actorId}/{type}/{(isHardcore ? "True" : "False")}")); + BattleNetSocketSend($"ckmc|{gameAccountId}/{actorId}/{type}/{ (isHardcore ? "True" : "False")}"); } public void CheckSalvageItemCriteria(ulong gameAccountId, int itemId) { Logger.MethodTrace($"gameAccountId {gameAccountId}, itemId {itemId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"csic|{gameAccountId}/{itemId}")); + BattleNetSocketSend($"csic|{gameAccountId}/{itemId}"); } public void CheckLevelCap(ulong gameAccountId) { Logger.MethodTrace($"gameAccountId {gameAccountId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"clc|{gameAccountId}")); + BattleNetSocketSend($"clc|{gameAccountId}"); } public void CheckConversationCriteria(ulong gameAccountId, int convId) { Logger.MethodTrace($"gameAccountId {gameAccountId}, convId {convId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"ccc|{gameAccountId}/{convId}")); + BattleNetSocketSend($"ccc|{gameAccountId}/{convId}"); } public void CheckLevelAreaCriteria(ulong gameAccountId, int laId) { Logger.MethodTrace($"gameAccountId {gameAccountId}, laId {laId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"clac|{gameAccountId}/{laId}")); + BattleNetSocketSend($"clac|{gameAccountId}/{laId}"); } public void UpdateClient(ulong gameAccountId, int level, int screen) { Logger.MethodTrace($"gameAccountId {gameAccountId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"uc|{gameAccountId}/{level}/{screen}")); + BattleNetSocketSend($"uc|{gameAccountId}/{level}/{screen}"); } public void PlayerJoined(int gameId) { Logger.MethodTrace($"gameId {gameId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"gpj|{gameId}")); + BattleNetSocketSend($"gpj|{gameId}"); } public void PlayerLeft(int gameId) { Logger.MethodTrace($"gameId {gameId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"gpl|{gameId}")); + BattleNetSocketSend($"gpl|{gameId}"); } public void SetGamePublic(int gameId) { Logger.MethodTrace($"gameId {gameId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"gsp|{gameId}")); + BattleNetSocketSend($"gsp|{gameId}"); } public void PvPSaveProgress(ulong gameAccountId, int kills, int wins, int gold) { Logger.MethodTrace($"game account id {gameAccountId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"pvpsp|{gameAccountId}/{kills}/{wins}/{gold}")); + BattleNetSocketSend($"pvpsp|{gameAccountId}/{kills}/{wins}/{gold}"); } public void ParagonLevelUp(ulong gameAccountId) { Logger.MethodTrace($"game account id {gameAccountId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"plu|{gameAccountId}")); + BattleNetSocketSend($"plu|{gameAccountId}"); } public void ToonStateChanged(ulong toonId) { Logger.MethodTrace($"game account id {toonId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"tsc|{toonId}")); + BattleNetSocketSend($"tsc|{toonId}"); } public void UniqueItemIdentified(ulong gameAccountId, ulong itemId) { Logger.MethodTrace($"gameAccountId {gameAccountId}, itemId {itemId}"); - BattleNetSocketSend(Encoding.UTF8.GetBytes($"uii|{gameAccountId}/{itemId}")); + BattleNetSocketSend($"uii|{gameAccountId}/{itemId}"); } } } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ObjectsSystem/FixedMap.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ObjectsSystem/FixedMap.cs index 9f5724a..82ec63d 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ObjectsSystem/FixedMap.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ObjectsSystem/FixedMap.cs @@ -8,7 +8,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem { Invulnerable, Speed, - Powerful + Powerful, + Resourcefull } public class FixedMap