Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
FurkanS1821 committed Oct 2, 2018
1 parent 74349c1 commit 3d5645c
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Content/LeagueSandbox-Default
2 changes: 1 addition & 1 deletion GameServerLib/Chatbox/Commands/ReloadScriptsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public ReloadScriptsCommand(ChatCommandManager chatCommandManager, Game game)

public override void Execute(Peer peer, bool hasReceivedArguments, string arguments = "")
{
if (Game.LoadScripts())
if (Game.LoadScripts(true))
{
ChatCommandManager.SendDebugMsgFormatted(DebugMsgType.INFO, "Scripts reloaded.");
}
Expand Down
2 changes: 1 addition & 1 deletion GameServerLib/Content/CharData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void Load(string name)
HpRegenPerLevel = file.GetFloat("Data", "HPRegenPerLevel", HpRegenPerLevel);
MpRegenPerLevel = file.GetFloat("Data", "MPRegenPerLevel", MpRegenPerLevel);
AttackSpeedPerLevel = file.GetFloat("Data", "AttackSpeedPerLevel", AttackSpeedPerLevel);
IsMelee = file.GetString("Data", "IsMelee", IsMelee ? "Yes" : "No").ToLower().Equals("yes");
IsMelee = file.GetString("Data", "IsMelee", IsMelee ? "Yes" : "No").ToLowerInvariant().Equals("yes");
PathfindingCollisionRadius =
file.GetFloat("Data", "PathfindingCollisionRadius", PathfindingCollisionRadius);
GameplayCollisionRadius = file.GetFloat("Data", "GameplayCollisionRadius", GameplayCollisionRadius);
Expand Down
5 changes: 3 additions & 2 deletions GameServerLib/Content/ContentFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ public int[] GetIntArray(string section, string name, int[] defaultValue)
{
for (var i = 0; i < defaultValue.Length; i++)
{
float value;
if (float.TryParse(list[i], NumberStyles.Any, CultureInfo.InvariantCulture, out value))
if (float.TryParse(list[i], NumberStyles.Any, CultureInfo.InvariantCulture, out var value))
{
defaultValue[i] = (int)value;
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions GameServerLib/Content/ContentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public static ContentManager LoadGameMode(Game game, string gameModeName, string
}
}

// Read non-zipped data
foreach (var file in Directory.GetFiles(contentPath, "*.*", SearchOption.AllDirectories))
{
var relativePath = file.Replace(contentPath, "").Replace(gameModeName, "").Substring(2)
Expand Down
2 changes: 1 addition & 1 deletion GameServerLib/Content/ItemManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void LoadItems(ContentManager contentManager)
var iniParser = new FileIniDataParser();
foreach (var content in contentManager.Content)
{
if (!content.Key.StartsWith("DATA/Items"))
if (!content.Key.StartsWith("DATA/Items") || !content.Key.EndsWith(".ini"))
{
continue;
}
Expand Down
6 changes: 4 additions & 2 deletions GameServerLib/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ public void Initialize(Address address, string blowfishKey, Config config)
_logger.Info("Game is ready.");
}

public bool LoadScripts()
public bool LoadScripts(bool doReloadContent = false)
{
// todo: use the optional arg to *actually* reload the scripts
// current code only takes what was loaded in the startup and loads them back in, so it does nothing
var scripts = new Dictionary<string, byte[]>();
foreach (var contentData in Config.ContentManager.Content)
{
Expand All @@ -143,7 +145,7 @@ public bool LoadScripts()
scripts.Add(contentData.Key, contentData.Value);
}

return ScriptEngine.LoadFromFiles(scripts);
return ScriptEngine.LoadFromData(scripts);
}

public void NetLoop()
Expand Down
2 changes: 1 addition & 1 deletion GameServerLib/Scripting/CSharp/CSharpScriptEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public CSharpScriptEngine()
}

//Takes about 300 milliseconds for a single script
public bool LoadFromFiles(Dictionary<string, byte[]> scriptFiles)
public bool LoadFromData(Dictionary<string, byte[]> scriptFiles)
{
bool compiledSuccessfully;
var treeList = new List<SyntaxTree>();
Expand Down

0 comments on commit 3d5645c

Please sign in to comment.