Skip to content

Commit 78632a7

Browse files
committed
2.2
1 parent d0452f6 commit 78632a7

File tree

6 files changed

+104
-50
lines changed

6 files changed

+104
-50
lines changed

RageBlock/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
// Revision
2929
// You can specify all the values or you can default the Build and Revision Numbers
3030
// by using the '*' as shown below:
31-
[assembly: AssemblyVersion("2.1.0")]
32-
[assembly: AssemblyFileVersion("2.1.0")]
31+
[assembly: AssemblyVersion("2.2.0")]
32+
[assembly: AssemblyFileVersion("2.2.0")]
Lines changed: 69 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Drawing;
66
using System.Linq;
77
using System.Text.RegularExpressions;
8+
using System.Threading.Tasks;
89

910
using LeagueSharp;
1011
using LeagueSharp.Common;
@@ -14,7 +15,7 @@
1415
/// <summary>
1516
/// Program class.
1617
/// </summary>
17-
internal class Program
18+
internal class RageBlock
1819
{
1920
#region Constants
2021

@@ -44,7 +45,12 @@ internal class Program
4445
private static readonly Dictionary<int, Count> HeroCount = new Dictionary<int, Count>();
4546

4647
/// <summary>
47-
/// The last tick.
48+
/// Queue Worker in terms of a list.
49+
/// </summary>
50+
private static readonly List<Task> Queue = new List<Task>();
51+
52+
/// <summary>
53+
/// Last Tick of Environment.TickCount.
4854
/// </summary>
4955
private static float lastTick;
5056

@@ -75,7 +81,7 @@ private static void GameOnGameLoad(EventArgs args)
7581
{
7682
m = new Menu(R, R, true);
7783
m.AddItem(new MenuItem("Status", "Enable").SetValue(true)).ValueChanged +=
78-
delegate(object sender, OnValueChangeEventArgs eventArgs)
84+
delegate (object sender, OnValueChangeEventArgs eventArgs)
7985
{
8086
if (eventArgs.GetNewValue<bool>())
8187
{
@@ -96,7 +102,7 @@ private static void GameOnGameLoad(EventArgs args)
96102
};
97103
m.AddItem(
98104
new MenuItem("Block", "Block modus:").SetValue(new StringList(new[] { "Block and Mute", "Block" })))
99-
.ValueChanged += delegate(object sender, OnValueChangeEventArgs eventArgs)
105+
.ValueChanged += delegate (object sender, OnValueChangeEventArgs eventArgs)
100106
{
101107
if (eventArgs.GetNewValue<StringList>().SelectedIndex == 0)
102108
{
@@ -108,29 +114,29 @@ private static void GameOnGameLoad(EventArgs args)
108114
m.AddItem(new MenuItem("CallOut", "Block words for scripting"))
109115
.SetTooltip("Add/Remove words for scripting to the word filter.")
110116
.SetValue(true)
111-
.ValueChanged += delegate(object sender, OnValueChangeEventArgs eventArgs)
117+
.ValueChanged += delegate (object sender, OnValueChangeEventArgs eventArgs)
112118
{
113119
if (eventArgs.GetNewValue<bool>())
114120
{
115-
foreach (var entry in Rage.IDont)
121+
foreach (var entry in WordFilter.IDont)
116122
{
117-
Rage.Flame.Add(entry);
123+
WordFilter.Flame.Add(entry);
118124
}
119125

120-
Rage.Flame.Add(GetRegex(Rage.IDont));
126+
WordFilter.Flame.Add(GetRegex(WordFilter.IDont));
121127
}
122128

123129
if (eventArgs.GetNewValue<bool>())
124130
{
125131
return;
126132
}
127133

128-
foreach (var entry in Rage.IDont)
134+
foreach (var entry in WordFilter.IDont)
129135
{
130-
Rage.Flame.Remove(entry);
136+
WordFilter.Flame.Remove(entry);
131137
}
132138

133-
Rage.Flame.Remove(GetRegex(Rage.IDont));
139+
WordFilter.Flame.Remove(GetRegex(WordFilter.IDont));
134140
};
135141

136142
m.AddItem(new MenuItem("Ping", "Block ping abuser"))
@@ -154,7 +160,14 @@ private static void GameOnGameLoad(EventArgs args)
154160
.ValueChanged += (sender, eventArgs) =>
155161
{
156162
var name = (MenuItem)sender;
157-
Game.Say("/mute " + name.Tooltip);
163+
164+
if (m.Item("Block").GetValue<StringList>().SelectedIndex != 0)
165+
{
166+
return;
167+
}
168+
169+
Queue.Add(new Task(delegate { Game.Say("/mute " + name.Tooltip); }));
170+
Log("Release a key to mute " + name.Tooltip + ".");
158171
};
159172
}
160173

@@ -169,20 +182,27 @@ private static void GameOnGameLoad(EventArgs args)
169182
.ValueChanged += (sender, eventArgs) =>
170183
{
171184
var name = (MenuItem)sender;
172-
Game.Say("/mute " + name.Tooltip);
185+
186+
if (m.Item("Block").GetValue<StringList>().SelectedIndex != 0)
187+
{
188+
return;
189+
}
190+
191+
Queue.Add(new Task(delegate { Game.Say("/mute " + name.Tooltip); }));
192+
Log("Release a key to mute " + name.Tooltip + ".");
173193
};
174194
}
175195

176196
m.AddToMainMenu();
177197

178198
if (m.Item("CallOut").GetValue<bool>())
179199
{
180-
foreach (var entry in Rage.IDont)
200+
foreach (var entry in WordFilter.IDont)
181201
{
182-
Rage.Flame.Add(entry);
202+
WordFilter.Flame.Add(entry);
183203
}
184204

185-
Rage.Flame.Add(GetRegex(Rage.IDont));
205+
WordFilter.Flame.Add(GetRegex(WordFilter.IDont));
186206
}
187207

188208
foreach (var hero in
@@ -207,11 +227,12 @@ private static void GameOnChat(GameChatEventArgs args)
207227
{
208228
if (!m.Item("Status").GetValue<bool>()
209229
|| args.Sender == null
210-
|| args.Sender.IsMe
230+
|| !args.Sender.IsMe
211231
|| args.Sender.IsBot
232+
|| !args.Sender.IsValid
212233
|| m.Item(args.Sender.NetworkId.ToString()).GetValue<bool>()
213-
|| !new Regex(@"(?<!\S)(" + string.Join(@"|", Rage.Flame) + @")(?!\S)", RegexOptions.IgnoreCase).Match(
214-
args.Message).Success)
234+
|| !new Regex(@"(?<!\S)(" + string.Join(@"|", WordFilter.Flame) + @")(?!\S)", RegexOptions.IgnoreCase)
235+
.Match(Regex.Replace(args.Message, @"\p{P}\p{S}", string.Empty)).Success)
215236
{
216237
return;
217238
}
@@ -223,13 +244,7 @@ private static void GameOnChat(GameChatEventArgs args)
223244
return;
224245
}
225246

226-
Utility.DelayAction.Add(
227-
new Random().Next(127, 723),
228-
() =>
229-
m.SubMenu("Muted")
230-
.SubMenu(args.Sender.IsAlly ? "Allies" : "Enemies")
231-
.Item(args.Sender.Name)
232-
.SetValue(true));
247+
m.SubMenu("Muted").SubMenu(args.Sender.IsAlly ? "Allies" : "Enemies").Item(args.Sender.Name).SetValue(true);
233248
}
234249

235250
/// <summary>
@@ -242,14 +257,15 @@ private static void GameOnInput(GameInputEventArgs args)
242257
{
243258
if (!m.Item("Status").GetValue<bool>()
244259
|| !new Regex(
245-
@"^(?!\/(?:whisper|w|reply|r)(?!\S)).*(?<!\S)(" + string.Join(@"|", Rage.Flame) + @")(?!\S)",
246-
RegexOptions.IgnoreCase).Match(args.Input).Success)
260+
@"^(?!\/(?:whisper|w|reply|r)(?!\S)).*(?<!\S)(" + string.Join(@"|", WordFilter.Flame)
261+
+ @")(?!\S)",
262+
RegexOptions.IgnoreCase).Match(Regex.Replace(args.Input, @"\p{P}\p{S}", string.Empty)).Success)
247263
{
248264
return;
249265
}
250266

251267
args.Process = false;
252-
Log(Rage.Jokes[new Random().Next(0, Rage.Jokes.Length)]);
268+
Log(WordFilter.Jokes[new Random().Next(0, WordFilter.Jokes.Length)]);
253269
}
254270

255271
/// <summary>
@@ -261,7 +277,10 @@ private static void GameOnInput(GameInputEventArgs args)
261277
private static void GameOnPing(GamePingEventArgs args)
262278
{
263279
var hero = (Obj_AI_Hero)args.Source;
264-
if (hero == null
280+
if (!m.Item("Status").GetValue<bool>()
281+
|| !m.Item("Ping").GetValue<bool>()
282+
|| hero == null
283+
|| !hero.IsValid
265284
|| hero.IsMe
266285
|| !HeroCount.ContainsKey(hero.NetworkId))
267286
{
@@ -286,11 +305,29 @@ private static void GameOnPing(GamePingEventArgs args)
286305
/// </param>
287306
private static void GameOnUpdate(EventArgs args)
288307
{
308+
if (!m.Item("Status").GetValue<bool>()
309+
|| !m.Item("Ping").GetValue<bool>())
310+
{
311+
return;
312+
}
313+
289314
foreach (var hero in
290315
HeroManager.AllHeroes.Where(me => !me.IsMe && !me.IsBot).Select(hero => hero.NetworkId).ToList())
291316
{
292317
LowerCount(hero);
293318
}
319+
320+
if (Orbwalking.Orbwalker.Instances.Count != 0
321+
&& Orbwalking.Orbwalker.Instances.Any(o => o.ActiveMode != Orbwalking.OrbwalkingMode.None))
322+
{
323+
return;
324+
}
325+
326+
foreach (var task in Queue.ToList().Where(task => Queue.Any()))
327+
{
328+
task.Start();
329+
Queue.Remove(task);
330+
}
294331
}
295332

296333
/// <summary>
@@ -365,6 +402,8 @@ private static void Log(object value)
365402
Game.PrintChat("[" + DateTime.Now.ToString("HH:mm") + "] <font color='#eb7577'>" + R + "</font>: " + value);
366403
}
367404

405+
#endregion
406+
368407
/// <summary>
369408
/// Class count.
370409
/// </summary>
@@ -379,6 +418,5 @@ private class Count
379418

380419
#endregion
381420
}
382-
#endregion
383421
}
384422
}

RageBlock/RageBlock.csproj

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
@@ -36,7 +36,6 @@
3636
<DebugSymbols>true</DebugSymbols>
3737
<DebugType>full</DebugType>
3838
<Optimize>false</Optimize>
39-
<OutputPath>bin\Release</OutputPath>
4039
<DefineConstants>DEBUG;TRACE</DefineConstants>
4140
<ErrorReport>prompt</ErrorReport>
4241
<WarningLevel>4</WarningLevel>
@@ -45,7 +44,6 @@
4544
<PlatformTarget>x86</PlatformTarget>
4645
<DebugType>pdbonly</DebugType>
4746
<Optimize>true</Optimize>
48-
<OutputPath>bin\Release</OutputPath>
4947
<DefineConstants>TRACE</DefineConstants>
5048
<ErrorReport>prompt</ErrorReport>
5149
<WarningLevel>4</WarningLevel>
@@ -57,17 +55,7 @@
5755
<Reference Include="LeagueSharp.Common">
5856
<HintPath>E:\LeagueSharp\System\LeagueSharp.Common.dll</HintPath>
5957
</Reference>
60-
<Reference Include="LeagueSharp.SDK">
61-
<HintPath>E:\LeagueSharp\System\LeagueSharp.SDK.dll</HintPath>
62-
</Reference>
63-
<Reference Include="SharpDX, Version=2.6.3.0, Culture=neutral, PublicKeyToken=345b829e6e492981, processorArchitecture=MSIL">
64-
<SpecificVersion>False</SpecificVersion>
65-
<HintPath>E:\LeagueSharp\System\SharpDX.dll</HintPath>
66-
</Reference>
67-
<Reference Include="SharpDX.Direct3D9, Version=2.6.3.0, Culture=neutral, PublicKeyToken=345b829e6e492981, processorArchitecture=MSIL">
68-
<SpecificVersion>False</SpecificVersion>
69-
<HintPath>E:\LeagueSharp\System\SharpDX.Direct3D9.dll</HintPath>
70-
</Reference>
58+
<Reference Include="PresentationCore" />
7159
<Reference Include="System" />
7260
<Reference Include="System.Core" />
7361
<Reference Include="System.Drawing" />
@@ -76,11 +64,14 @@
7664
<Reference Include="System.Data" />
7765
<Reference Include="System.Xml" />
7866
<Reference Include="WindowsBase" />
67+
<Reference Include="SharpDX">
68+
<HintPath>E:\LeagueSharp\System\SharpDX.dll</HintPath>
69+
</Reference>
7970
</ItemGroup>
8071
<ItemGroup>
81-
<Compile Include="Program.cs" />
72+
<Compile Include="RageBlock.cs" />
8273
<Compile Include="Properties\AssemblyInfo.cs" />
83-
<Compile Include="Rage.cs" />
74+
<Compile Include="WordFilter.cs" />
8475
</ItemGroup>
8576
<ItemGroup>
8677
<None Include="App.config" />

RageBlock/RageBlock.sln

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RageBlock", "RageBlock.csproj", "{5177BBD9-34B3-4D5B-BF32-6FC8CA860BC8}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Any CPU = Debug|Any CPU
9+
Release|Any CPU = Release|Any CPU
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{5177BBD9-34B3-4D5B-BF32-6FC8CA860BC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13+
{5177BBD9-34B3-4D5B-BF32-6FC8CA860BC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
14+
{5177BBD9-34B3-4D5B-BF32-6FC8CA860BC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
15+
{5177BBD9-34B3-4D5B-BF32-6FC8CA860BC8}.Release|Any CPU.Build.0 = Release|Any CPU
16+
EndGlobalSection
17+
EndGlobal

RageBlock/RageBlock.userprefs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Properties StartupItem="RageBlock.csproj">
2+
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
3+
<MonoDevelop.Ide.Workbench />
4+
<MonoDevelop.Ide.DebuggingService.Breakpoints>
5+
<BreakpointStore />
6+
</MonoDevelop.Ide.DebuggingService.Breakpoints>
7+
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
8+
</Properties>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/// <summary>
66
/// The class Rage.
77
/// </summary>
8-
public static class Rage
8+
public static class WordFilter
99
{
1010
#region Static Fields
1111

0 commit comments

Comments
 (0)