This reverts commit 179cb50557.
This commit is contained in:
parent
179cb50557
commit
c2ecc76457
588 changed files with 16260 additions and 10926 deletions
|
|
@ -19,9 +19,8 @@
|
|||
***************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public enum GuildType
|
||||
{
|
||||
|
|
@ -73,9 +72,23 @@ namespace Server
|
|||
return g;
|
||||
}
|
||||
|
||||
public static BaseGuild FindByName(string name) => List.Values.FirstOrDefault(g => g.Name == name);
|
||||
public static BaseGuild FindByName(string name)
|
||||
{
|
||||
foreach (BaseGuild g in List.Values)
|
||||
if (g.Name == name)
|
||||
return g;
|
||||
|
||||
public static BaseGuild FindByAbbrev(string abbr) => List.Values.FirstOrDefault(g => g.Abbreviation == abbr);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static BaseGuild FindByAbbrev(string abbr)
|
||||
{
|
||||
foreach (BaseGuild g in List.Values)
|
||||
if (g.Abbreviation == abbr)
|
||||
return g;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<BaseGuild> Search(string find)
|
||||
{
|
||||
|
|
@ -83,8 +96,19 @@ namespace Server
|
|||
List<BaseGuild> results = new List<BaseGuild>();
|
||||
|
||||
foreach (BaseGuild g in List.Values)
|
||||
if (words.All(t => g.Name.ToLower().IndexOf(t) != -1))
|
||||
{
|
||||
bool match = true;
|
||||
string name = g.Name.ToLower();
|
||||
for (int i = 0; i < words.Length; i++)
|
||||
if (name.IndexOf(words[i]) == -1)
|
||||
{
|
||||
match = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (match)
|
||||
results.Add(g);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue