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

Commit 3d5645c

Browse files
committed
Minor changes
1 parent 74349c1 commit 3d5645c

File tree

8 files changed

+13
-9
lines changed

8 files changed

+13
-9
lines changed

Content/LeagueSandbox-Default

GameServerLib/Chatbox/Commands/ReloadScriptsCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public ReloadScriptsCommand(ChatCommandManager chatCommandManager, Game game)
1414

1515
public override void Execute(Peer peer, bool hasReceivedArguments, string arguments = "")
1616
{
17-
if (Game.LoadScripts())
17+
if (Game.LoadScripts(true))
1818
{
1919
ChatCommandManager.SendDebugMsgFormatted(DebugMsgType.INFO, "Scripts reloaded.");
2020
}

GameServerLib/Content/CharData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void Load(string name)
115115
HpRegenPerLevel = file.GetFloat("Data", "HPRegenPerLevel", HpRegenPerLevel);
116116
MpRegenPerLevel = file.GetFloat("Data", "MPRegenPerLevel", MpRegenPerLevel);
117117
AttackSpeedPerLevel = file.GetFloat("Data", "AttackSpeedPerLevel", AttackSpeedPerLevel);
118-
IsMelee = file.GetString("Data", "IsMelee", IsMelee ? "Yes" : "No").ToLower().Equals("yes");
118+
IsMelee = file.GetString("Data", "IsMelee", IsMelee ? "Yes" : "No").ToLowerInvariant().Equals("yes");
119119
PathfindingCollisionRadius =
120120
file.GetFloat("Data", "PathfindingCollisionRadius", PathfindingCollisionRadius);
121121
GameplayCollisionRadius = file.GetFloat("Data", "GameplayCollisionRadius", GameplayCollisionRadius);

GameServerLib/Content/ContentFile.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ public int[] GetIntArray(string section, string name, int[] defaultValue)
9494
{
9595
for (var i = 0; i < defaultValue.Length; i++)
9696
{
97-
float value;
98-
if (float.TryParse(list[i], NumberStyles.Any, CultureInfo.InvariantCulture, out value))
97+
if (float.TryParse(list[i], NumberStyles.Any, CultureInfo.InvariantCulture, out var value))
98+
{
9999
defaultValue[i] = (int)value;
100+
}
100101
}
101102
}
102103
}

GameServerLib/Content/ContentManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ public static ContentManager LoadGameMode(Game game, string gameModeName, string
175175
}
176176
}
177177

178+
// Read non-zipped data
178179
foreach (var file in Directory.GetFiles(contentPath, "*.*", SearchOption.AllDirectories))
179180
{
180181
var relativePath = file.Replace(contentPath, "").Replace(gameModeName, "").Substring(2)

GameServerLib/Content/ItemManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void LoadItems(ContentManager contentManager)
4747
var iniParser = new FileIniDataParser();
4848
foreach (var content in contentManager.Content)
4949
{
50-
if (!content.Key.StartsWith("DATA/Items"))
50+
if (!content.Key.StartsWith("DATA/Items") || !content.Key.EndsWith(".ini"))
5151
{
5252
continue;
5353
}

GameServerLib/Game.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ public void Initialize(Address address, string blowfishKey, Config config)
130130
_logger.Info("Game is ready.");
131131
}
132132

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

146-
return ScriptEngine.LoadFromFiles(scripts);
148+
return ScriptEngine.LoadFromData(scripts);
147149
}
148150

149151
public void NetLoop()

GameServerLib/Scripting/CSharp/CSharpScriptEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public CSharpScriptEngine()
2222
}
2323

2424
//Takes about 300 milliseconds for a single script
25-
public bool LoadFromFiles(Dictionary<string, byte[]> scriptFiles)
25+
public bool LoadFromData(Dictionary<string, byte[]> scriptFiles)
2626
{
2727
bool compiledSuccessfully;
2828
var treeList = new List<SyntaxTree>();

0 commit comments

Comments
 (0)