Merge pull request #112 from goremykin/optimizations
Refactor random and more multiple enumerations
This commit is contained in:
commit
68a512cae6
@ -85,7 +85,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
|
|||||||
public static Account GetAccountByDiscordId(ulong discordId)
|
public static Account GetAccountByDiscordId(ulong discordId)
|
||||||
{
|
{
|
||||||
List<DBAccount> dbAcc = DBSessions.SessionQueryWhere<DBAccount>(dba => dba.DiscordId == discordId).ToList();
|
List<DBAccount> dbAcc = DBSessions.SessionQueryWhere<DBAccount>(dba => dba.DiscordId == discordId).ToList();
|
||||||
if (dbAcc.Count() == 0)
|
if (!dbAcc.Any())
|
||||||
{
|
{
|
||||||
Logger.Warn("GetAccountByDiscordId {0}: DBAccount is null!", discordId);
|
Logger.Warn("GetAccountByDiscordId {0}: DBAccount is null!", discordId);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -1197,7 +1197,7 @@ public class GameAccount : PersistentRPCObject
|
|||||||
|
|
||||||
public uint AchievementPoints
|
public uint AchievementPoints
|
||||||
{
|
{
|
||||||
get { return (uint)Achievements.Where(a => a.Completion != -1).Count() * 10U; }
|
get { return (uint)Achievements.Count(a => a.Completion != -1) * 10U; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLoggedIn { get; set; }
|
public bool IsLoggedIn { get; set; }
|
||||||
|
|||||||
@ -14,10 +14,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
|
|||||||
|
|
||||||
public static readonly ConcurrentDictionary<ulong, GameAccount> LoadedGameAccounts = new();
|
public static readonly ConcurrentDictionary<ulong, GameAccount> LoadedGameAccounts = new();
|
||||||
|
|
||||||
public static int TotalAccounts
|
public static int TotalAccounts => DBSessions.SessionQuery<DBGameAccount>().Count;
|
||||||
{
|
|
||||||
get { return DBSessions.SessionQuery<DBGameAccount>().Count(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void PreLoadGameAccounts()
|
public static void PreLoadGameAccounts()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -70,7 +70,7 @@ namespace DiIiS_NA.LoginServer.FriendsSystem
|
|||||||
Logger.MethodTrace($": owner {owner.PersistentID}, target {target.PersistentID}");
|
Logger.MethodTrace($": owner {owner.PersistentID}, target {target.PersistentID}");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (DBSessions.SessionQueryWhere<DBAccountLists>(dbl => dbl.ListOwner.Id == owner.PersistentID && dbl.ListTarget.Id == target.PersistentID && dbl.Type == "IGNORE").Count() > 0) return;
|
if (DBSessions.SessionQueryWhere<DBAccountLists>(dbl => dbl.ListOwner.Id == owner.PersistentID && dbl.ListTarget.Id == target.PersistentID && dbl.Type == "IGNORE").Any()) return;
|
||||||
|
|
||||||
var blockRecord = new DBAccountLists
|
var blockRecord = new DBAccountLists
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,6 +7,7 @@ using DiIiS_NA.LoginServer.ChannelSystem;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using DiIiS_NA.Core.Extensions;
|
||||||
|
|
||||||
namespace DiIiS_NA.LoginServer.GamesSystem
|
namespace DiIiS_NA.LoginServer.GamesSystem
|
||||||
{
|
{
|
||||||
@ -19,7 +20,7 @@ namespace DiIiS_NA.LoginServer.GamesSystem
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return GameCreators.Values.Where(game => game.PlayersCount > 0).Count();
|
return GameCreators.Values.Count(game => game.PlayersCount > 0);
|
||||||
}
|
}
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
@ -95,13 +96,12 @@ namespace DiIiS_NA.LoginServer.GamesSystem
|
|||||||
GameDescriptor TagGame = null;
|
GameDescriptor TagGame = null;
|
||||||
if (client.GameTeamTag != "") TagGame = FindTagGame(client.GameTeamTag);
|
if (client.GameTeamTag != "") TagGame = FindTagGame(client.GameTeamTag);
|
||||||
|
|
||||||
var rand = new Random();
|
|
||||||
GameDescriptor gameDescriptor = null;
|
GameDescriptor gameDescriptor = null;
|
||||||
|
|
||||||
if(TagGame != null)
|
if(TagGame != null)
|
||||||
gameDescriptor = TagGame;
|
gameDescriptor = TagGame;
|
||||||
else if (request_type == "find" && matchingGames.Count > 0)
|
else if (request_type == "find" && matchingGames.Count > 0)
|
||||||
gameDescriptor = matchingGames[rand.Next(matchingGames.Count)];
|
gameDescriptor = matchingGames.PickRandom();
|
||||||
else
|
else
|
||||||
gameDescriptor = CreateGame(client, request.Options, requestId);
|
gameDescriptor = CreateGame(client, request.Options, requestId);
|
||||||
|
|
||||||
|
|||||||
@ -224,10 +224,11 @@ namespace DiIiS_NA.Core.Discord
|
|||||||
{
|
{
|
||||||
var message = await guild.GetTextChannel(channelId).GetMessageAsync(param.First().Value);
|
var message = await guild.GetTextChannel(channelId).GetMessageAsync(param.First().Value);
|
||||||
var reactedUsers = await (message as IUserMessage).GetReactionUsersAsync(Emote.Parse("<:wolfRNG:607868292979490816>"), 100).FlattenAsync();
|
var reactedUsers = await (message as IUserMessage).GetReactionUsersAsync(Emote.Parse("<:wolfRNG:607868292979490816>"), 100).FlattenAsync();
|
||||||
var contestants = reactedUsers.Where(u => !u.IsBot).ToList();
|
var contestants = reactedUsers.Where(u => !u.IsBot).ToArray();
|
||||||
if (contestants.Count() > 0)
|
|
||||||
|
if (contestants.Length > 0)
|
||||||
{
|
{
|
||||||
var winner = reactedUsers.Where(u => !u.IsBot).ToList()[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, reactedUsers.Count() - 1)];
|
var winner = contestants[Helpers.Math.FastRandom.Instance.Next(0, contestants.Length - 1)];
|
||||||
winnerName = guild.GetUser(winner.Id).Nickname;
|
winnerName = guild.GetUser(winner.Id).Nickname;
|
||||||
await winner.SendMessageAsync("Congratulations! You have won **7 days of D3 Reflection Premium**!.\nYour account has already had its Premium prolonged. Have a nice game!");
|
await winner.SendMessageAsync("Congratulations! You have won **7 days of D3 Reflection Premium**!.\nYour account has already had its Premium prolonged. Have a nice game!");
|
||||||
var acc = AccountManager.GetAccountByDiscordId(winner.Id);
|
var acc = AccountManager.GetAccountByDiscordId(winner.Id);
|
||||||
|
|||||||
@ -33,11 +33,11 @@ namespace DiIiS_NA.Core.Discord.Modules
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (registerInfo.Count() == 3)
|
if (registerInfo.Length == 3)
|
||||||
{
|
{
|
||||||
if (!email.Contains('@'))
|
if (!email.Contains('@'))
|
||||||
{
|
{
|
||||||
await ReplyAsync($"<@{Context.User.Id}> " + string.Format("'{0}' is not a valid email address.", email));
|
await ReplyAsync($"<@{Context.User.Id}> " + $"'{email}' is not a valid email address.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!IsValid(email))
|
if (!IsValid(email))
|
||||||
|
|||||||
@ -1,61 +1,70 @@
|
|||||||
//Blizzless Project 2022
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using DiIiS_NA.Core.Helpers.Math;
|
||||||
|
|
||||||
namespace DiIiS_NA.Core.Extensions
|
namespace DiIiS_NA.Core.Extensions;
|
||||||
|
|
||||||
|
public static class EnumerableExtensions
|
||||||
{
|
{
|
||||||
public static class EnumerableExtensions
|
public static string HexDump(this IEnumerable<byte> collection)
|
||||||
{
|
{
|
||||||
public static string HexDump(this IEnumerable<byte> collection)
|
var sb = new StringBuilder();
|
||||||
|
foreach (byte value in collection)
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
sb.Append(value.ToString("X2"));
|
||||||
foreach (byte value in collection)
|
sb.Append(' ');
|
||||||
{
|
|
||||||
sb.Append(value.ToString("X2"));
|
|
||||||
sb.Append(' ');
|
|
||||||
}
|
|
||||||
if (sb.Length > 0)
|
|
||||||
sb.Remove(sb.Length - 1, 1);
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
}
|
||||||
|
if (sb.Length > 0)
|
||||||
|
sb.Remove(sb.Length - 1, 1);
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public static string ToEncodedString(this IEnumerable<byte> collection, Encoding encoding)
|
public static string ToEncodedString(this IEnumerable<byte> collection, Encoding encoding)
|
||||||
{
|
{
|
||||||
return encoding.GetString(collection.ToArray());
|
return encoding.GetString(collection.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Dump(this IEnumerable<byte> collection)
|
public static string Dump(this IEnumerable<byte> collection)
|
||||||
|
{
|
||||||
|
var output = new StringBuilder();
|
||||||
|
var hex = new StringBuilder();
|
||||||
|
var text = new StringBuilder();
|
||||||
|
int i = 0;
|
||||||
|
foreach (byte value in collection)
|
||||||
{
|
{
|
||||||
var output = new StringBuilder();
|
if (i > 0 && ((i % 16) == 0))
|
||||||
var hex = new StringBuilder();
|
|
||||||
var text = new StringBuilder();
|
|
||||||
int i = 0;
|
|
||||||
foreach (byte value in collection)
|
|
||||||
{
|
{
|
||||||
if (i > 0 && ((i % 16) == 0))
|
output.Append(hex);
|
||||||
{
|
output.Append(' ');
|
||||||
output.Append(hex);
|
output.Append(text);
|
||||||
output.Append(' ');
|
output.Append(Environment.NewLine);
|
||||||
output.Append(text);
|
hex.Clear(); text.Clear();
|
||||||
output.Append(Environment.NewLine);
|
|
||||||
hex.Clear(); text.Clear();
|
|
||||||
}
|
|
||||||
hex.Append(value.ToString("X2"));
|
|
||||||
hex.Append(' ');
|
|
||||||
text.Append(string.Format("{0}", (char.IsWhiteSpace((char)value) && (char)value != ' ') ? '.' : (char)value)); // prettify text
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
var hexstring = hex.ToString();
|
hex.Append(value.ToString("X2"));
|
||||||
if (text.Length < 16)
|
hex.Append(' ');
|
||||||
{
|
text.Append($"{((char.IsWhiteSpace((char)value) && (char)value != ' ') ? '.' : (char)value)}"); // prettify text
|
||||||
hexstring = hexstring.PadRight(48); // pad the hex representation in-case it's smaller than a regular 16 value line.
|
++i;
|
||||||
}
|
|
||||||
output.Append(hexstring);
|
|
||||||
output.Append(' ');
|
|
||||||
output.Append(text);
|
|
||||||
return output.ToString();
|
|
||||||
}
|
}
|
||||||
|
var hexstring = hex.ToString();
|
||||||
|
if (text.Length < 16)
|
||||||
|
{
|
||||||
|
hexstring = hexstring.PadRight(48); // pad the hex representation in-case it's smaller than a regular 16 value line.
|
||||||
|
}
|
||||||
|
output.Append(hexstring);
|
||||||
|
output.Append(' ');
|
||||||
|
output.Append(text);
|
||||||
|
return output.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TItem PickRandom<TItem>(this IEnumerable<TItem> source)
|
||||||
|
{
|
||||||
|
return RandomHelper.RandomItem(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TryPickRandom<TItem>(this IEnumerable<TItem> source, out TItem randomItem)
|
||||||
|
{
|
||||||
|
return RandomHelper.TryGetRandomItem(source, out randomItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,112 +1,122 @@
|
|||||||
//Blizzless Project 2022
|
using System;
|
||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DiIiS_NA.Core.Logging;
|
|
||||||
|
|
||||||
namespace DiIiS_NA.Core.Helpers.Math
|
namespace DiIiS_NA.Core.Helpers.Math;
|
||||||
|
|
||||||
|
public static class RandomHelper
|
||||||
{
|
{
|
||||||
public class RandomHelper
|
private static readonly Random Random = new();
|
||||||
|
|
||||||
|
public static int Next()
|
||||||
{
|
{
|
||||||
private readonly static Random _random;
|
return Random.Next();
|
||||||
|
|
||||||
static RandomHelper()
|
|
||||||
{
|
|
||||||
_random = new Random();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int Next()
|
|
||||||
{
|
|
||||||
return _random.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int Next(Int32 maxValue)
|
|
||||||
{
|
|
||||||
return _random.Next(maxValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int Next(Int32 minValue, Int32 maxValue)
|
|
||||||
{
|
|
||||||
return _random.Next(minValue, maxValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void NextBytes(byte[] buffer)
|
|
||||||
{
|
|
||||||
_random.NextBytes(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double NextDouble()
|
|
||||||
{
|
|
||||||
return _random.NextDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*IEnumerable<TValue>*/
|
|
||||||
public static TValue RandomValue<TKey, TValue>(IDictionary<TKey, TValue> dictionary)
|
|
||||||
{
|
|
||||||
List<TValue> values = Enumerable.ToList(dictionary.Values);
|
|
||||||
int size = dictionary.Count;
|
|
||||||
/*while (true)
|
|
||||||
{
|
|
||||||
yield return values[_random.Next(size)];
|
|
||||||
}*/
|
|
||||||
return values[_random.Next(size)];
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Picks a random item from a list
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <param name="list"></param>
|
|
||||||
/// <param name="probability">A function that assigns each item a probability. If the probabilities dont sum up to 1, they are normalized</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static T RandomItem<T>(IEnumerable<T> list, Func<T, float> probability)
|
|
||||||
{
|
|
||||||
int cumulative = (int)list.Select(x => probability(x)).Sum();
|
|
||||||
|
|
||||||
int randomRoll = RandomHelper.Next(cumulative);
|
|
||||||
float cumulativePercentages = 0;
|
|
||||||
|
|
||||||
foreach (T element in list)
|
|
||||||
{
|
|
||||||
cumulativePercentages += probability(element);
|
|
||||||
if (cumulativePercentages > randomRoll)
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
return list.First();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ItemRandomHelper
|
public static int Next(int maxValue)
|
||||||
{
|
{
|
||||||
private static readonly Logger Logger = LogManager.CreateLogger("RH");
|
return Random.Next(maxValue);
|
||||||
uint a;
|
}
|
||||||
uint b;
|
|
||||||
public ItemRandomHelper(int seed)
|
public static int Next(int minValue, int maxValue)
|
||||||
|
{
|
||||||
|
return Random.Next(minValue, maxValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void NextBytes(byte[] buffer)
|
||||||
|
{
|
||||||
|
Random.NextBytes(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double NextDouble()
|
||||||
|
{
|
||||||
|
return Random.NextDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T RandomItem<T>(IEnumerable<T> source)
|
||||||
|
{
|
||||||
|
var collection = source as IReadOnlyCollection<T> ?? source?.ToArray();
|
||||||
|
if (collection == null || collection.Count == 0)
|
||||||
{
|
{
|
||||||
a = (uint)seed;
|
throw new ArgumentException("Cannot be null or empty", nameof(source));
|
||||||
b = 666;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReinitSeed()
|
var randomIndex = Next(collection.Count);
|
||||||
|
return collection.ElementAt(randomIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TryGetRandomItem<T>(IEnumerable<T> source, out T randomItem)
|
||||||
|
{
|
||||||
|
var collection = source as IReadOnlyCollection<T> ?? source?.ToArray();
|
||||||
|
if (collection == null)
|
||||||
{
|
{
|
||||||
b = 666;
|
throw new ArgumentException("Cannot be null", nameof(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint Next()
|
if (collection.Count == 0)
|
||||||
{
|
{
|
||||||
ulong temp = 1791398085UL * (ulong)a + (ulong)b;
|
randomItem = default;
|
||||||
a = (uint)temp;
|
return false;
|
||||||
b = (uint)(temp >> 32);
|
|
||||||
|
|
||||||
//Logger.MethodTrace("a {0}, b {1}", a, b);
|
|
||||||
return (uint)a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Next(float min, float max)
|
var randomIndex = Next(collection.Count);
|
||||||
|
randomItem = collection.ElementAt(randomIndex);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Picks a random item from a list
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="probability">A function that assigns each item a probability. If the probabilities dont sum up to 1, they are normalized</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static T RandomItem<T>(IEnumerable<T> source, Func<T, float> probability)
|
||||||
|
{
|
||||||
|
var collection = source as IReadOnlyCollection<T> ?? source.ToArray();
|
||||||
|
int cumulative = (int)collection.Select(probability).Sum();
|
||||||
|
|
||||||
|
int randomRoll = Next(cumulative);
|
||||||
|
float cumulativePercentages = 0;
|
||||||
|
|
||||||
|
foreach (T element in collection)
|
||||||
{
|
{
|
||||||
return min + (Next() % (uint)(max - min + 1));
|
cumulativePercentages += probability(element);
|
||||||
|
if (cumulativePercentages > randomRoll)
|
||||||
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return collection.First();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ItemRandomHelper
|
||||||
|
{
|
||||||
|
uint _a;
|
||||||
|
uint _b;
|
||||||
|
public ItemRandomHelper(int seed)
|
||||||
|
{
|
||||||
|
_a = (uint)seed;
|
||||||
|
_b = 666;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReinitSeed()
|
||||||
|
{
|
||||||
|
_b = 666;
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint Next()
|
||||||
|
{
|
||||||
|
ulong temp = 1791398085UL * _a + _b;
|
||||||
|
_a = (uint)temp;
|
||||||
|
_b = (uint)(temp >> 32);
|
||||||
|
|
||||||
|
return _a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Next(float min, float max)
|
||||||
|
{
|
||||||
|
return min + (Next() % (uint)(max - min + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,6 +7,7 @@ using DiIiS_NA.Core.MPQ.FileFormats.Types;
|
|||||||
using DiIiS_NA.GameServer.Core.Types.TagMap;
|
using DiIiS_NA.GameServer.Core.Types.TagMap;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System;
|
using System;
|
||||||
|
using DiIiS_NA.Core.Extensions;
|
||||||
using DiIiS_NA.Core.Helpers.Math;
|
using DiIiS_NA.Core.Helpers.Math;
|
||||||
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
||||||
|
|
||||||
@ -102,7 +103,9 @@ namespace DiIiS_NA.Core.MPQ.FileFormats
|
|||||||
{
|
{
|
||||||
return AnimationSno._NONE;
|
return AnimationSno._NONE;
|
||||||
}
|
}
|
||||||
return deathTags.Select(x => GetAniSNO(x)).Where(x => x != AnimationSno._NONE).OrderBy(x => RandomHelper.Next()).First();
|
|
||||||
|
var possibleDeaths = deathTags.Select(GetAniSNO).Where(x => x != AnimationSno._NONE);
|
||||||
|
return possibleDeaths.PickRandom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public enum AnimationTags
|
public enum AnimationTags
|
||||||
|
|||||||
@ -178,7 +178,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
|
|||||||
lock (client.ServiceLock)
|
lock (client.ServiceLock)
|
||||||
{
|
{
|
||||||
Logger.MethodTrace($"id {achievementId}");
|
Logger.MethodTrace($"id {achievementId}");
|
||||||
if (client.Account.GameAccount.Achievements.Where(a => a.AchievementId == achievementId && a.Completion != -1).Count() > 0) return;
|
if (client.Account.GameAccount.Achievements.Any(a => a.AchievementId == achievementId && a.Completion != -1)) return;
|
||||||
DBAchievements achievement = null;
|
DBAchievements achievement = null;
|
||||||
var achs = DBSessions.SessionQueryWhere<DBAchievements>(dbi =>
|
var achs = DBSessions.SessionQueryWhere<DBAchievements>(dbi =>
|
||||||
dbi.DBGameAccount.Id == client.Account.GameAccount.PersistentID);
|
dbi.DBGameAccount.Id == client.Account.GameAccount.PersistentID);
|
||||||
@ -218,7 +218,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
|
|||||||
|
|
||||||
if (IsHardcore(achievementId))
|
if (IsHardcore(achievementId))
|
||||||
{
|
{
|
||||||
if (achs.Where(a => a.CompleteTime != -1 && a.IsHardcore == true).Count() >= 30) //31 in total
|
if (achs.Count(a => a.CompleteTime != -1 && a.IsHardcore) >= 30) //31 in total
|
||||||
{
|
{
|
||||||
var toons = DBSessions.SessionQueryWhere<DBToon>(dbt => dbt.DBGameAccount.Id == client.Account.GameAccount.PersistentID && dbt.isHardcore == true && dbt.Archieved == false);
|
var toons = DBSessions.SessionQueryWhere<DBToon>(dbt => dbt.DBGameAccount.Id == client.Account.GameAccount.PersistentID && dbt.isHardcore == true && dbt.Archieved == false);
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ach_data = _achievements.AchievementList.Single(a => a.Id == definition.ParentAchievementId);
|
var ach_data = _achievements.AchievementList.Single(a => a.Id == definition.ParentAchievementId);
|
||||||
if (!ach_data.HasSupersedingAchievementId || client.Account.GameAccount.Achievements.Where(a => a.AchievementId == ach_data.SupersedingAchievementId && a.Completion > 0).Count() > 0)
|
if (!ach_data.HasSupersedingAchievementId || client.Account.GameAccount.Achievements.Any(a => a.AchievementId == ach_data.SupersedingAchievementId && a.Completion > 0))
|
||||||
UpdateSnapshot(client, 0, criteriaId);
|
UpdateSnapshot(client, 0, criteriaId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -380,14 +380,14 @@ namespace DiIiS_NA.GameServer.AchievementSystem
|
|||||||
{
|
{
|
||||||
if (additionalQuantity == 0) return;
|
if (additionalQuantity == 0) return;
|
||||||
Logger.MethodTrace($"id {achievementId}");
|
Logger.MethodTrace($"id {achievementId}");
|
||||||
if (client.Account.GameAccount.Achievements.Where(a => a.AchievementId == achievementId && a.Completion != -1).Count() > 0) return;
|
if (client.Account.GameAccount.Achievements.Any(a => a.AchievementId == achievementId && a.Completion != -1)) return;
|
||||||
|
|
||||||
ulong mainCriteriaId = GetMainCriteria(achievementId);
|
ulong mainCriteriaId = GetMainCriteria(achievementId);
|
||||||
var aa = client.Account.GameAccount.AchievementCriteria;
|
var aa = client.Account.GameAccount.AchievementCriteria;
|
||||||
D3.Achievements.CriteriaUpdateRecord mainCriteria;
|
D3.Achievements.CriteriaUpdateRecord mainCriteria;
|
||||||
lock (client.Account.GameAccount.AchievementCriteria)
|
lock (client.Account.GameAccount.AchievementCriteria)
|
||||||
{
|
{
|
||||||
mainCriteria = client.Account.GameAccount.AchievementCriteria.Where(c => c.CriteriaId32AndFlags8 == (uint)mainCriteriaId).FirstOrDefault();
|
mainCriteria = client.Account.GameAccount.AchievementCriteria.FirstOrDefault(c => c.CriteriaId32AndFlags8 == (uint)mainCriteriaId);
|
||||||
}
|
}
|
||||||
if (mainCriteria == null)
|
if (mainCriteria == null)
|
||||||
mainCriteria = D3.Achievements.CriteriaUpdateRecord.CreateBuilder()
|
mainCriteria = D3.Achievements.CriteriaUpdateRecord.CreateBuilder()
|
||||||
@ -531,7 +531,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
|
|||||||
(c.AdvanceEvent.Id == 105 && c.AdvanceEvent.Comparand == actorId64)).ToList();
|
(c.AdvanceEvent.Id == 105 && c.AdvanceEvent.Comparand == actorId64)).ToList();
|
||||||
|
|
||||||
if (!isHardcore)
|
if (!isHardcore)
|
||||||
criterias = criterias.Where(c => c.AdvanceEvent.ModifierList.Where(m => m.NecessaryCondition == 306).Count() == 0).ToList();
|
criterias = criterias.Where(c => c.AdvanceEvent.ModifierList.All(m => m.NecessaryCondition != 306)).ToList();
|
||||||
|
|
||||||
criterias = criterias.Where(c => c.AdvanceEvent.ModifierList.Single(m => m.NecessaryCondition == 103).Comparand == type64).ToList();
|
criterias = criterias.Where(c => c.AdvanceEvent.ModifierList.Single(m => m.NecessaryCondition == 103).Comparand == type64).ToList();
|
||||||
|
|
||||||
|
|||||||
@ -13,14 +13,14 @@ namespace DiIiS_NA.GameServer.ClientSystem.Base
|
|||||||
public ConnectionDataEventArgs(IConnection connection, IEnumerable<byte> data)
|
public ConnectionDataEventArgs(IConnection connection, IEnumerable<byte> data)
|
||||||
: base(connection)
|
: base(connection)
|
||||||
{
|
{
|
||||||
Data = data ?? new byte[0];
|
Data = data ?? Array.Empty<byte>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return Connection.RemoteEndPoint != null
|
return Connection.RemoteEndPoint != null
|
||||||
? string.Format("{0}: {1} bytes", Connection.RemoteEndPoint, Data.Count())
|
? $"{Connection.RemoteEndPoint}: {Data.Count()} bytes"
|
||||||
: string.Format("Not Connected: {0} bytes", Data.Count());
|
: $"Not Connected: {Data.Count()} bytes";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ namespace DiIiS_NA.GameServer.ClientSystem.Base
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_newSockets.Count() == 0)
|
if (!_newSockets.Any())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock (_newSockets)
|
lock (_newSockets)
|
||||||
|
|||||||
@ -33,7 +33,7 @@ namespace DiIiS_NA.GameServer.CommandManager
|
|||||||
[Command("add", "Allows you to add a new user account.\nUsage: account add <email> <password> <battletag> [userlevel]", Account.UserLevels.GM)]
|
[Command("add", "Allows you to add a new user account.\nUsage: account add <email> <password> <battletag> [userlevel]", Account.UserLevels.GM)]
|
||||||
public string Add(string[] @params, BattleClient invokerClient)
|
public string Add(string[] @params, BattleClient invokerClient)
|
||||||
{
|
{
|
||||||
if (@params.Count() < 3)
|
if (@params.Length < 3)
|
||||||
return "Invalid arguments. Type 'help account add' to get help.";
|
return "Invalid arguments. Type 'help account add' to get help.";
|
||||||
|
|
||||||
var email = @params[0];
|
var email = @params[0];
|
||||||
@ -41,7 +41,7 @@ namespace DiIiS_NA.GameServer.CommandManager
|
|||||||
var battleTagName = @params[2];
|
var battleTagName = @params[2];
|
||||||
var userLevel = Account.UserLevels.User;
|
var userLevel = Account.UserLevels.User;
|
||||||
|
|
||||||
if (@params.Count() == 4)
|
if (@params.Length == 4)
|
||||||
{
|
{
|
||||||
var level = @params[3].ToLower();
|
var level = @params[3].ToLower();
|
||||||
switch (level)
|
switch (level)
|
||||||
@ -88,7 +88,7 @@ namespace DiIiS_NA.GameServer.CommandManager
|
|||||||
[Command("setpassword", "Allows you to set a new password for account\nUsage: account setpassword <email> <password>", Account.UserLevels.GM)]
|
[Command("setpassword", "Allows you to set a new password for account\nUsage: account setpassword <email> <password>", Account.UserLevels.GM)]
|
||||||
public string SetPassword(string[] @params, BattleClient invokerClient)
|
public string SetPassword(string[] @params, BattleClient invokerClient)
|
||||||
{
|
{
|
||||||
if (@params.Count() < 2)
|
if (@params.Length < 2)
|
||||||
return "Invalid arguments. Type 'help account setpassword' to get help.";
|
return "Invalid arguments. Type 'help account setpassword' to get help.";
|
||||||
|
|
||||||
var email = @params[0];
|
var email = @params[0];
|
||||||
@ -109,7 +109,7 @@ namespace DiIiS_NA.GameServer.CommandManager
|
|||||||
[Command("setbtag", "Allows you to change battle tag for account\nUsage: account setbtag <email> <newname>", Account.UserLevels.GM)]
|
[Command("setbtag", "Allows you to change battle tag for account\nUsage: account setbtag <email> <newname>", Account.UserLevels.GM)]
|
||||||
public string SetBTag(string[] @params, BattleClient invokerClient)
|
public string SetBTag(string[] @params, BattleClient invokerClient)
|
||||||
{
|
{
|
||||||
if (@params.Count() < 2)
|
if (@params.Length < 2)
|
||||||
return "Invalid arguments. Type 'help account setbtag' to get help.";
|
return "Invalid arguments. Type 'help account setbtag' to get help.";
|
||||||
|
|
||||||
var email = @params[0];
|
var email = @params[0];
|
||||||
@ -127,7 +127,7 @@ namespace DiIiS_NA.GameServer.CommandManager
|
|||||||
[Command("setuserlevel", "Allows you to set a new user level for account\nUsage: account setuserlevel <email> <user level>.\nAvailable user levels: owner, admin, gm, user.", Account.UserLevels.GM)]
|
[Command("setuserlevel", "Allows you to set a new user level for account\nUsage: account setuserlevel <email> <user level>.\nAvailable user levels: owner, admin, gm, user.", Account.UserLevels.GM)]
|
||||||
public string SetLevel(string[] @params, BattleClient invokerClient)
|
public string SetLevel(string[] @params, BattleClient invokerClient)
|
||||||
{
|
{
|
||||||
if (@params.Count() < 2)
|
if (@params.Length < 2)
|
||||||
return "Invalid arguments. Type 'help account setuserlevel' to get help.";
|
return "Invalid arguments. Type 'help account setuserlevel' to get help.";
|
||||||
|
|
||||||
var email = @params[0];
|
var email = @params[0];
|
||||||
@ -170,7 +170,7 @@ namespace DiIiS_NA.GameServer.CommandManager
|
|||||||
[DefaultCommand(Account.UserLevels.GM)]
|
[DefaultCommand(Account.UserLevels.GM)]
|
||||||
public string Mute(string[] @params, BattleClient invokerClient)
|
public string Mute(string[] @params, BattleClient invokerClient)
|
||||||
{
|
{
|
||||||
if (@params.Count() < 2)
|
if (@params.Length < 2)
|
||||||
return "Invalid arguments. Type 'help mute' to get help.";
|
return "Invalid arguments. Type 'help mute' to get help.";
|
||||||
|
|
||||||
var bTagName = @params[0];
|
var bTagName = @params[0];
|
||||||
@ -196,7 +196,7 @@ namespace DiIiS_NA.GameServer.CommandManager
|
|||||||
{
|
{
|
||||||
if(@params == null)
|
if(@params == null)
|
||||||
return "Wrong game tag. Example: !tag mytag";
|
return "Wrong game tag. Example: !tag mytag";
|
||||||
if (@params.Count() != 1)
|
if (@params.Length != 1)
|
||||||
return "Invalid arguments. Enter one string tag.";
|
return "Invalid arguments. Enter one string tag.";
|
||||||
|
|
||||||
string Tag = @params[0];
|
string Tag = @params[0];
|
||||||
|
|||||||
@ -175,7 +175,7 @@ namespace DiIiS_NA.GameServer.CommandManager
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
var @params = parameters.Split(' ');
|
var @params = parameters.Split(' ');
|
||||||
var group = @params[0];
|
var group = @params[0];
|
||||||
var command = @params.Count() > 1 ? @params[1] : string.Empty;
|
var command = @params.Length > 1 ? @params[1] : string.Empty;
|
||||||
|
|
||||||
foreach (var pair in CommandGroups.Where(pair => group == pair.Key.Name))
|
foreach (var pair in CommandGroups.Where(pair => group == pair.Key.Name))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -301,7 +301,7 @@ public class SpawnCommand : CommandGroup
|
|||||||
actorSNO = 6652;
|
actorSNO = 6652;
|
||||||
|
|
||||||
|
|
||||||
if (@params.Count() > 1)
|
if (@params.Length > 1)
|
||||||
if (!int.TryParse(@params[1], out amount))
|
if (!int.TryParse(@params[1], out amount))
|
||||||
amount = 1;
|
amount = 1;
|
||||||
if (amount > 100) amount = 100;
|
if (amount > 100) amount = 100;
|
||||||
@ -563,7 +563,7 @@ public class ItemCommand : CommandGroup
|
|||||||
return "You need to specify a valid item name!";
|
return "You need to specify a valid item name!";
|
||||||
|
|
||||||
|
|
||||||
if (@params.Count() == 1 || !int.TryParse(@params[1], out amount))
|
if (@params.Length == 1 || !int.TryParse(@params[1], out amount))
|
||||||
amount = 1;
|
amount = 1;
|
||||||
|
|
||||||
if (amount > 100) amount = 100;
|
if (amount > 100) amount = 100;
|
||||||
@ -605,7 +605,7 @@ public class ItemCommand : CommandGroup
|
|||||||
if (type == null)
|
if (type == null)
|
||||||
return "The type given is not a valid item type.";
|
return "The type given is not a valid item type.";
|
||||||
|
|
||||||
if (@params.Count() == 1 || !int.TryParse(@params[1], out amount))
|
if (@params.Length == 1 || !int.TryParse(@params[1], out amount))
|
||||||
amount = 1;
|
amount = 1;
|
||||||
|
|
||||||
if (amount > 100) amount = 100;
|
if (amount > 100) amount = 100;
|
||||||
@ -766,7 +766,7 @@ public class ConversationCommand : CommandGroup
|
|||||||
if (invokerClient.InGameClient == null)
|
if (invokerClient.InGameClient == null)
|
||||||
return "You can only invoke this command while in-game.";
|
return "You can only invoke this command while in-game.";
|
||||||
|
|
||||||
if (@params.Count() != 1)
|
if (@params.Length != 1)
|
||||||
return "Invalid arguments. Type 'help conversation' to get help.";
|
return "Invalid arguments. Type 'help conversation' to get help.";
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -875,7 +875,7 @@ public class ModifySpeedCommand : CommandGroup
|
|||||||
if (@params == null)
|
if (@params == null)
|
||||||
return Fallback();
|
return Fallback();
|
||||||
|
|
||||||
if (@params.Count() != 1)
|
if (@params.Length != 1)
|
||||||
return "Invalid arguments. Type 'help text public' to get help.";
|
return "Invalid arguments. Type 'help text public' to get help.";
|
||||||
|
|
||||||
var questId = int.Parse(@params[0]);
|
var questId = int.Parse(@params[0]);
|
||||||
@ -897,7 +897,7 @@ public class ModifySpeedCommand : CommandGroup
|
|||||||
if (@params == null)
|
if (@params == null)
|
||||||
return Fallback();
|
return Fallback();
|
||||||
|
|
||||||
if (@params.Count() != 2)
|
if (@params.Length != 2)
|
||||||
return "Invalid arguments. Type 'help text public' to get help.";
|
return "Invalid arguments. Type 'help text public' to get help.";
|
||||||
|
|
||||||
var eventId = int.Parse(@params[0]);
|
var eventId = int.Parse(@params[0]);
|
||||||
|
|||||||
@ -436,10 +436,10 @@ namespace DiIiS_NA.GameServer.Core
|
|||||||
|
|
||||||
public Item GetItemByDynId(Player plr, uint dynId)
|
public Item GetItemByDynId(Player plr, uint dynId)
|
||||||
{
|
{
|
||||||
if (Items.Values.Where(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId).Count() > 0)
|
if (Items.Values.Any(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId))
|
||||||
return Items.Values.Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
|
return Items.Values.Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
|
||||||
else
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using DiIiS_NA.Core.Extensions;
|
||||||
|
|
||||||
namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
|
namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
|
||||||
{
|
{
|
||||||
@ -70,7 +71,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
|
|||||||
{
|
{
|
||||||
_target = monsters[0];
|
_target = monsters[0];
|
||||||
int powerToUse = PickPowerToUse();
|
int powerToUse = PickPowerToUse();
|
||||||
if (powerToUse > 0)
|
if (powerToUse > 0) // FIXME: probably >= 0 as 0 can be a valid power?
|
||||||
{
|
{
|
||||||
PowerSystem.PowerScript power = PowerSystem.PowerLoader.CreateImplementationForPowerSNO(powerToUse);
|
PowerSystem.PowerScript power = PowerSystem.PowerLoader.CreateImplementationForPowerSNO(powerToUse);
|
||||||
power.User = Body;
|
power.User = Body;
|
||||||
@ -108,9 +109,11 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
|
|||||||
{
|
{
|
||||||
if (PresetPowers.Count > 0)
|
if (PresetPowers.Count > 0)
|
||||||
{
|
{
|
||||||
int powerIndex = RandomHelper.Next(PresetPowers.Count);
|
var randomPower = PresetPowers.PickRandom();
|
||||||
if (PowerSystem.PowerLoader.HasImplementationForPowerSNO(PresetPowers[powerIndex]))
|
|
||||||
return PresetPowers[powerIndex];
|
// should we try several times or pick random from implemented only powers?
|
||||||
|
if (PowerSystem.PowerLoader.HasImplementationForPowerSNO(randomPower))
|
||||||
|
return randomPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using DiIiS_NA.Core.Extensions;
|
||||||
using DiIiS_NA.Core.Helpers.Math;
|
using DiIiS_NA.Core.Helpers.Math;
|
||||||
using DiIiS_NA.Core.MPQ;
|
using DiIiS_NA.Core.MPQ;
|
||||||
using DiIiS_NA.GameServer.Core.Types.Math;
|
using DiIiS_NA.GameServer.Core.Types.Math;
|
||||||
@ -102,7 +103,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
|
|||||||
if (targets.Count != 0 && PowerMath.Distance2D(Body.Position, Owner.Position) < 80f)
|
if (targets.Count != 0 && PowerMath.Distance2D(Body.Position, Owner.Position) < 80f)
|
||||||
{
|
{
|
||||||
int powerToUse = PickPowerToUse();
|
int powerToUse = PickPowerToUse();
|
||||||
if (powerToUse > 0)
|
if (powerToUse > 0) // maybe >= 0 as 0 can be a valid power???
|
||||||
{
|
{
|
||||||
var elite = targets.FirstOrDefault(t => t is Champion or Rare or RareMinion);
|
var elite = targets.FirstOrDefault(t => t is Champion or Rare or RareMinion);
|
||||||
_target = elite ?? targets.First();
|
_target = elite ?? targets.First();
|
||||||
@ -149,12 +150,14 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
|
|||||||
|
|
||||||
protected virtual int PickPowerToUse()
|
protected virtual int PickPowerToUse()
|
||||||
{
|
{
|
||||||
// randomly used an implemented power
|
// randomly used an implemented power
|
||||||
if (PresetPowers.Count > 0)
|
if (PresetPowers.Count > 0)
|
||||||
{
|
{
|
||||||
int powerIndex = RandomHelper.Next(PresetPowers.Count);
|
var randomPower = PresetPowers.PickRandom();
|
||||||
if (PowerLoader.HasImplementationForPowerSNO(PresetPowers[powerIndex]))
|
|
||||||
return PresetPowers[powerIndex];
|
// should we try several times or pick random from implemented only powers?
|
||||||
|
if (PowerLoader.HasImplementationForPowerSNO(randomPower))
|
||||||
|
return randomPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no usable power
|
// no usable power
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using DiIiS_NA.Core.Extensions;
|
||||||
using DiIiS_NA.Core.Helpers.Math;
|
using DiIiS_NA.Core.Helpers.Math;
|
||||||
using DiIiS_NA.Core.MPQ;
|
using DiIiS_NA.Core.MPQ;
|
||||||
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
||||||
@ -196,13 +197,12 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
|
|||||||
// randomly used an implemented power
|
// randomly used an implemented power
|
||||||
if (PresetPowers.Count > 0)
|
if (PresetPowers.Count > 0)
|
||||||
{
|
{
|
||||||
//int power = this.PresetPowers[RandomHelper.Next(this.PresetPowers.Count)].Key;
|
// int power = this.PresetPowers[RandomHelper.Next(this.PresetPowers.Count)].Key;
|
||||||
List<int> availablePowers = Enumerable.ToList(PresetPowers.Where(p => (p.Value.CooldownTimer == null || p.Value.CooldownTimer.TimedOut) && PowerLoader.HasImplementationForPowerSNO(p.Key)).Select(p => p.Key));
|
List<int> availablePowers = PresetPowers.Where(p => (p.Value.CooldownTimer == null || p.Value.CooldownTimer.TimedOut) && PowerLoader.HasImplementationForPowerSNO(p.Key)).Select(p => p.Key).ToList();
|
||||||
if (availablePowers.Where(p => p != 30592).Count() > 0)
|
if (availablePowers.Where(p => p != 30592).TryPickRandom(out var randomItem))
|
||||||
return availablePowers.Where(p => p != 30592).ToList()[RandomHelper.Next(availablePowers.Where(p => p != 30592).ToList().Count())];
|
return randomItem;
|
||||||
else
|
if (availablePowers.Contains(30592))
|
||||||
if (availablePowers.Contains(30592))
|
return 30592; // melee attack
|
||||||
return 30592; //melee attack
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// no usable power
|
// no usable power
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using DiIiS_NA.Core.Extensions;
|
||||||
using DiIiS_NA.Core.Helpers.Math;
|
using DiIiS_NA.Core.Helpers.Math;
|
||||||
using DiIiS_NA.Core.Logging;
|
using DiIiS_NA.Core.Logging;
|
||||||
using DiIiS_NA.Core.MPQ;
|
using DiIiS_NA.Core.MPQ;
|
||||||
@ -59,7 +60,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
|
|||||||
}
|
}
|
||||||
var monsterData = (DiIiS_NA.Core.MPQ.FileFormats.Monster)MPQStorage.Data.Assets[SNOGroup.Monster][body.ActorData.MonsterSNO].Data;
|
var monsterData = (DiIiS_NA.Core.MPQ.FileFormats.Monster)MPQStorage.Data.Assets[SNOGroup.Monster][body.ActorData.MonsterSNO].Data;
|
||||||
_mpqPowerCount = monsterData.SkillDeclarations.Count(e => e.SNOPower != -1);
|
_mpqPowerCount = monsterData.SkillDeclarations.Count(e => e.SNOPower != -1);
|
||||||
for (int i = 0; i < monsterData.SkillDeclarations.Count(); i++)
|
for (int i = 0; i < monsterData.SkillDeclarations.Length; i++)
|
||||||
{
|
{
|
||||||
if (monsterData.SkillDeclarations[i].SNOPower == -1) continue;
|
if (monsterData.SkillDeclarations[i].SNOPower == -1) continue;
|
||||||
if (PowerLoader.HasImplementationForPowerSNO(monsterData.SkillDeclarations[i].SNOPower))
|
if (PowerLoader.HasImplementationForPowerSNO(monsterData.SkillDeclarations[i].SNOPower))
|
||||||
@ -435,16 +436,13 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
|
|||||||
|
|
||||||
//int power = this.PresetPowers[RandomHelper.Next(this.PresetPowers.Count)].Key;
|
//int power = this.PresetPowers[RandomHelper.Next(this.PresetPowers.Count)].Key;
|
||||||
var availablePowers = PresetPowers.Where(p => (p.Value.CooldownTimer == null || p.Value.CooldownTimer.TimedOut) && PowerLoader.HasImplementationForPowerSNO(p.Key)).Select(p => p.Key).ToList();
|
var availablePowers = PresetPowers.Where(p => (p.Value.CooldownTimer == null || p.Value.CooldownTimer.TimedOut) && PowerLoader.HasImplementationForPowerSNO(p.Key)).Select(p => p.Key).ToList();
|
||||||
if (availablePowers.Count(p => p != 30592) > 0)
|
if (availablePowers.Where(p => p != 30592).TryPickRandom(out var selectedPower))
|
||||||
{
|
{
|
||||||
int SelectedPower = availablePowers.Where(p => p != 30592).ToList()[RandomHelper.Next(availablePowers.Where(p => p != 30592).ToList().Count())];
|
return selectedPower;
|
||||||
//if(SelectedPower == 73824)
|
|
||||||
//if(SkeletonKingWhirlwind)
|
|
||||||
return SelectedPower;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (availablePowers.Contains(30592))
|
if (availablePowers.Contains(30592))
|
||||||
return 30592; //melee attack
|
return 30592; // melee attack
|
||||||
|
|
||||||
// no usable power
|
// no usable power
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using DiIiS_NA.Core.Extensions;
|
||||||
using DiIiS_NA.Core.Helpers.Math;
|
using DiIiS_NA.Core.Helpers.Math;
|
||||||
using DiIiS_NA.Core.MPQ;
|
using DiIiS_NA.Core.MPQ;
|
||||||
using DiIiS_NA.GameServer.Core.Types.SNO;
|
using DiIiS_NA.GameServer.Core.Types.SNO;
|
||||||
@ -82,7 +83,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
|
|||||||
//System.Console.Out.WriteLine("Enemy in range, use powers");
|
//System.Console.Out.WriteLine("Enemy in range, use powers");
|
||||||
//This will only attack when you and your minions are not moving..TODO: FIX.
|
//This will only attack when you and your minions are not moving..TODO: FIX.
|
||||||
int powerToUse = PickPowerToUse();
|
int powerToUse = PickPowerToUse();
|
||||||
if (powerToUse > 0)
|
if (powerToUse > 0) // maybe >= 0 as 0 can be a valid power?
|
||||||
{
|
{
|
||||||
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse);
|
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse);
|
||||||
power.User = Body;
|
power.User = Body;
|
||||||
@ -117,9 +118,11 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
|
|||||||
// randomly used an implemented power
|
// randomly used an implemented power
|
||||||
if (PresetPowers.Count > 0)
|
if (PresetPowers.Count > 0)
|
||||||
{
|
{
|
||||||
int powerIndex = RandomHelper.Next(PresetPowers.Count);
|
var randomPower = PresetPowers.PickRandom();
|
||||||
if (PowerLoader.HasImplementationForPowerSNO(PresetPowers[powerIndex]))
|
|
||||||
return PresetPowers[powerIndex];
|
// should we try several times or pick from implemented only?
|
||||||
|
if (PowerLoader.HasImplementationForPowerSNO(randomPower))
|
||||||
|
return randomPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no usable power
|
// no usable power
|
||||||
|
|||||||
@ -31,7 +31,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
|||||||
_collapsed = true;
|
_collapsed = true;
|
||||||
|
|
||||||
World.Game.SideQuestGizmo = this;
|
World.Game.SideQuestGizmo = this;
|
||||||
World.Game.QuestManager.LaunchSideQuest(eventIds[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, eventIds.Count())], true);
|
World.Game.QuestManager.LaunchSideQuest(eventIds[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, eventIds.Count)], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|||||||
@ -35,7 +35,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
|||||||
_collapsed = true;
|
_collapsed = true;
|
||||||
|
|
||||||
World.Game.SideQuestGizmo = this;
|
World.Game.SideQuestGizmo = this;
|
||||||
World.Game.QuestManager.LaunchSideQuest(eventIds[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, eventIds.Count())], true);
|
World.Game.QuestManager.LaunchSideQuest(eventIds[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, eventIds.Count)], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|||||||
@ -510,12 +510,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
|||||||
UnequipItem(owner, slot, item);
|
UnequipItem(owner, slot, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item GetItemByDynId(Player player, uint DynamicId)
|
public Item GetItemByDynId(Player player, uint dynamicId)
|
||||||
{
|
{
|
||||||
if (_equipment[player].Values.Where(it => it.IsRevealedToPlayer(player) && it.DynamicID(player) == DynamicId).Count() > 0)
|
if (_equipment[player].Values.Any(it => it.IsRevealedToPlayer(player) && it.DynamicID(player) == dynamicId))
|
||||||
return _equipment[player].Values.Single(it => it.IsRevealedToPlayer(player) && it.DynamicID(player) == DynamicId);
|
return _equipment[player].Values.Single(it => it.IsRevealedToPlayer(player) && it.DynamicID(player) == dynamicId);
|
||||||
else
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshEquipment(Player player)
|
public void RefreshEquipment(Player player)
|
||||||
@ -530,18 +530,23 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
|||||||
|
|
||||||
#region EqupimentStats
|
#region EqupimentStats
|
||||||
|
|
||||||
public List<Item> GetEquippedItems(Player player)
|
public IEnumerable<Item> GetEquippedItems(Player player)
|
||||||
{
|
{
|
||||||
return _equipment[player].Values.ToList();
|
return _equipment[player].Values;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetItemBonus(GameAttributeF attributeF)
|
public float GetItemBonus(GameAttributeF attributeF)
|
||||||
{
|
{
|
||||||
var stats = GetEquippedItems(owner).Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0);
|
var stats = GetEquippedItems(owner)
|
||||||
|
.Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 ||
|
||||||
|
item.Attributes[GameAttribute.Durability_Max] == 0);
|
||||||
|
|
||||||
if (attributeF == GameAttribute.Attacks_Per_Second_Item)
|
if (attributeF == GameAttribute.Attacks_Per_Second_Item)
|
||||||
return stats.Count() > 0 ? stats.Select(item => item.Attributes[attributeF]).Where(a => a > 0f).Aggregate(1f, (x, y) => x * y) : 0f;
|
{
|
||||||
|
return stats.Any()
|
||||||
|
? stats.Select(item => item.Attributes[attributeF]).Where(a => a > 0f).Aggregate(1f, (x, y) => x * y)
|
||||||
|
: 0f;
|
||||||
|
}
|
||||||
return stats.Sum(item => item.Attributes[attributeF]);
|
return stats.Sum(item => item.Attributes[attributeF]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,7 +557,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
|||||||
|
|
||||||
public bool GetItemBonus(GameAttributeB attributeB)
|
public bool GetItemBonus(GameAttributeB attributeB)
|
||||||
{
|
{
|
||||||
return GetEquippedItems(owner).Where(item => item.Attributes[attributeB] == true).Count() > 0;
|
return GetEquippedItems(owner).Any(item => item.Attributes[attributeB]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetItemBonus(GameAttributeF attributeF, int attributeKey)
|
public float GetItemBonus(GameAttributeF attributeF, int attributeKey)
|
||||||
|
|||||||
@ -34,12 +34,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
|
|||||||
|
|
||||||
LifeTime = TickTimer.WaitSeconds(world.Game, lifetime);
|
LifeTime = TickTimer.WaitSeconds(world.Game, lifetime);
|
||||||
|
|
||||||
if (Master != null && context.ScriptFormula(1) < (Master as Player).Followers.Values.Where(f => f == SNO).Count())
|
if (Master != null && context.ScriptFormula(1) < (Master as Player).Followers.Values.Count(f => f == SNO))
|
||||||
{
|
{
|
||||||
if (Master is Player)
|
if (Master is Player)
|
||||||
{
|
{
|
||||||
var rem = new List<uint>();
|
var rem = new List<uint>();
|
||||||
foreach (var fol in (Master as Player).Followers.Where(f => f.Key != GlobalID).Take((Master as Player).Followers.Values.Where(f => f == SNO).Count() - (int)context.ScriptFormula(1)))
|
foreach (var fol in (Master as Player).Followers.Where(f => f.Key != GlobalID).Take((Master as Player).Followers.Values.Count(f => f == SNO) - (int)context.ScriptFormula(1)))
|
||||||
if (fol.Value == SNO)
|
if (fol.Value == SNO)
|
||||||
rem.Add(fol.Key);
|
rem.Add(fol.Key);
|
||||||
foreach (var rm in rem)
|
foreach (var rm in rem)
|
||||||
|
|||||||
@ -208,9 +208,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
|||||||
if (ConversationList != null)
|
if (ConversationList != null)
|
||||||
{
|
{
|
||||||
var suitable_entries = ConversationList.AmbientConversationListEntries.Where(entry => entry.SpecialEventFlag == World.Game.CurrentAct).ToList();
|
var suitable_entries = ConversationList.AmbientConversationListEntries.Where(entry => entry.SpecialEventFlag == World.Game.CurrentAct).ToList();
|
||||||
if (suitable_entries.Count() > 0)
|
if (suitable_entries.Count > 0)
|
||||||
{
|
{
|
||||||
var random_conv = suitable_entries[FastRandom.Instance.Next(suitable_entries.Count())];
|
var random_conv = suitable_entries[FastRandom.Instance.Next(suitable_entries.Count)];
|
||||||
player.Conversations.StartConversation(random_conv.SNOConversation);
|
player.Conversations.StartConversation(random_conv.SNOConversation);
|
||||||
if (ForceConversationSNO == Conversations[0].ConversationSNO) ForceConversationSNO = -1;
|
if (ForceConversationSNO == Conversations[0].ConversationSNO) ForceConversationSNO = -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -151,7 +151,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
public void CheckKillMonsterCriteria(ulong gameAccountId, int actorId, int type, bool isHardcore)
|
public void CheckKillMonsterCriteria(ulong gameAccountId, int actorId, int type, bool isHardcore)
|
||||||
{
|
{
|
||||||
Logger.MethodTrace($"gameAccountId {gameAccountId}, actorId {actorId}, type {type}, hc {isHardcore}");
|
Logger.MethodTrace($"gameAccountId {gameAccountId}, actorId {actorId}, type {type}, hc {isHardcore}");
|
||||||
BattleNetSocketSend($"ckmc|{gameAccountId}/{actorId}/{type}/{ (isHardcore ? "True" : "False")}");
|
BattleNetSocketSend($"ckmc|{gameAccountId}/{actorId}/{type}/{(isHardcore ? "True" : "False")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CheckSalvageItemCriteria(ulong gameAccountId, int itemId)
|
public void CheckSalvageItemCriteria(ulong gameAccountId, int itemId)
|
||||||
|
|||||||
@ -1716,7 +1716,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
|
|
||||||
public bool WorldCleared(WorldSno worldSno)
|
public bool WorldCleared(WorldSno worldSno)
|
||||||
{
|
{
|
||||||
return _worlds[worldSno].Actors.Values.OfType<Monster>().Where(m => m.OriginalLevelArea != -1 && !m.Dead).Count() < 5;
|
return _worlds[worldSno].Actors.Values.OfType<Monster>().Count(m => m.OriginalLevelArea != -1 && !m.Dead) < 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -32,7 +32,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
|
|
||||||
public static GameUpdateThread FindWorker()
|
public static GameUpdateThread FindWorker()
|
||||||
{
|
{
|
||||||
return UpdateWorkers.OrderBy(t => t.Games.Count()).First();
|
return UpdateWorkers.OrderBy(t => t.Games.Count).First();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -940,7 +940,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
|||||||
{
|
{
|
||||||
while (monsterCount < AdditionalTargetCounter + 20)
|
while (monsterCount < AdditionalTargetCounter + 20)
|
||||||
{
|
{
|
||||||
GameServer.Core.Types.Math.Vector3D scenePoint = Scenes[RandomHelper.Next(0, Scenes.Count)].Position;
|
GameServer.Core.Types.Math.Vector3D scenePoint = Scenes.PickRandom().Position;
|
||||||
GameServer.Core.Types.Math.Vector3D point = null;
|
GameServer.Core.Types.Math.Vector3D point = null;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@ -948,7 +948,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
|||||||
if (QuestManager.Game.GetWorld(world).CheckLocationForFlag(point, Scene.NavCellFlags.AllowWalk))
|
if (QuestManager.Game.GetWorld(world).CheckLocationForFlag(point, Scene.NavCellFlags.AllowWalk))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QuestManager.Game.GetWorld(world).SpawnMonster((ActorSno)GameServer.GSSystem.GeneratorsSystem.SpawnGenerator.Spawns[LevelArea].melee[FastRandom.Instance.Next(GameServer.GSSystem.GeneratorsSystem.SpawnGenerator.Spawns[LevelArea].melee.Count())], point);
|
QuestManager.Game.GetWorld(world).SpawnMonster((ActorSno)GameServer.GSSystem.GeneratorsSystem.SpawnGenerator.Spawns[LevelArea].melee[FastRandom.Instance.Next(GameServer.GSSystem.GeneratorsSystem.SpawnGenerator.Spawns[LevelArea].melee.Count)], point);
|
||||||
monsterCount++;
|
monsterCount++;
|
||||||
}
|
}
|
||||||
} // Need additional monster spawn, there are few of them
|
} // Need additional monster spawn, there are few of them
|
||||||
@ -978,6 +978,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
|||||||
scenes.Add(scene);
|
scenes.Add(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Probably RandomHelper.Next(0, scenes.Count)???
|
||||||
GameServer.Core.Types.Math.Vector3D scenePoint = scenes[RandomHelper.Next(0, scenes.Count - 1)].Position;
|
GameServer.Core.Types.Math.Vector3D scenePoint = scenes[RandomHelper.Next(0, scenes.Count - 1)].Position;
|
||||||
GameServer.Core.Types.Math.Vector3D point = null;
|
GameServer.Core.Types.Math.Vector3D point = null;
|
||||||
while (true)
|
while (true)
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using DiIiS_NA.Core.Logging;
|
using DiIiS_NA.Core.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using DiIiS_NA.Core.Extensions;
|
||||||
using DiIiS_NA.GameServer.GSSystem.AISystem.Brains;
|
using DiIiS_NA.GameServer.GSSystem.AISystem.Brains;
|
||||||
using static DiIiS_NA.Core.MPQ.FileFormats.GameBalance;
|
using static DiIiS_NA.Core.MPQ.FileFormats.GameBalance;
|
||||||
using Actor = DiIiS_NA.GameServer.GSSystem.ActorSystem.Actor;
|
using Actor = DiIiS_NA.GameServer.GSSystem.ActorSystem.Actor;
|
||||||
@ -250,14 +251,14 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
|
|
||||||
public static int GeneratePrefixName()
|
public static int GeneratePrefixName()
|
||||||
{
|
{
|
||||||
var randomPrefix = NamesList.Where(n => n.AffixType == AffixType.Prefix).OrderBy(x => RandomHelper.Next()).ToList().First();
|
var randomPrefix = NamesList.Where(n => n.AffixType == AffixType.Prefix).PickRandom();
|
||||||
return randomPrefix.Hash;
|
return randomPrefix.Hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GenerateSuffixName()
|
public static int GenerateSuffixName()
|
||||||
{
|
{
|
||||||
var randomSuffix = NamesList.Where(n => n.AffixType == AffixType.Suffix).OrderBy(x => RandomHelper.Next()).ToList().First();
|
var randomPrefix = NamesList.Where(n => n.AffixType == AffixType.Suffix).PickRandom();
|
||||||
return randomSuffix.Hash;
|
return randomPrefix.Hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -302,11 +302,8 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var entries = clusterSelected[sceneChunk.SceneSpecification.ClusterID];
|
var entries = clusterSelected[sceneChunk.SceneSpecification.ClusterID];
|
||||||
SubSceneEntry subSceneEntry = null;
|
if (entries.TryPickRandom(out var subSceneEntry))
|
||||||
|
|
||||||
if (entries.Count > 0)
|
|
||||||
{
|
{
|
||||||
subSceneEntry = RandomHelper.RandomItem<SubSceneEntry>(entries, entry => 1);
|
|
||||||
entries.Remove(subSceneEntry);
|
entries.Remove(subSceneEntry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -566,7 +563,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
List<Scene> scenes = world.Scenes.Values.ToList();
|
List<Scene> scenes = world.Scenes.Values.ToList();
|
||||||
if (levelArea != -1) scenes = scenes.Where(sc => sc.Specification.SNOLevelAreas[0] == levelArea && !sc.SceneSNO.Name.ToLower().Contains("filler")).ToList();
|
if (levelArea != -1) scenes = scenes.Where(sc => sc.Specification.SNOLevelAreas[0] == levelArea && !sc.SceneSNO.Name.ToLower().Contains("filler")).ToList();
|
||||||
else scenes = scenes.Where(sc => !sc.SceneSNO.Name.ToLower().Contains("filler")).ToList();
|
else scenes = scenes.Where(sc => !sc.SceneSNO.Name.ToLower().Contains("filler")).ToList();
|
||||||
int randomScene = RandomHelper.Next(0, scenes.Count - 1);
|
int randomScene = RandomHelper.Next(0, scenes.Count - 1); // FIXME: probably RandomHelper.Next(0, scenes.Count)???
|
||||||
Vector3D SSV = scenes[randomScene].Position;
|
Vector3D SSV = scenes[randomScene].Position;
|
||||||
Vector3D startingPoint = null;
|
Vector3D startingPoint = null;
|
||||||
|
|
||||||
@ -638,7 +635,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
bool rift = world.SNO.IsGenerated();
|
bool rift = world.SNO.IsGenerated();
|
||||||
//Getting Enter
|
//Getting Enter
|
||||||
var loadedScene = new SceneChunk();
|
var loadedScene = new SceneChunk();
|
||||||
currentScene = DRLGContainers[0][RandomHelper.Next(0, DRLGContainers[0].Count)];
|
currentScene = DRLGContainers[0].PickRandom();
|
||||||
loadedScene.SNOHandle = new SNOHandle(SNOGroup.Scene, currentScene.SnoID);
|
loadedScene.SNOHandle = new SNOHandle(SNOGroup.Scene, currentScene.SnoID);
|
||||||
loadedScene.PRTransform = new PRTransform(new Quaternion(new Vector3D(0f, 0f, 0f), 1), new Vector3D(0, 0, 0));
|
loadedScene.PRTransform = new PRTransform(new Quaternion(new Vector3D(0f, 0f, 0f), 1), new Vector3D(0, 0, 0));
|
||||||
loadedScene.SceneSpecification = new SceneSpecification(
|
loadedScene.SceneSpecification = new SceneSpecification(
|
||||||
@ -676,7 +673,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
{
|
{
|
||||||
if (prestScene.SNOHandle.Name.StartsWith("x1_Pand"))
|
if (prestScene.SNOHandle.Name.StartsWith("x1_Pand"))
|
||||||
positionOfNav = 3;
|
positionOfNav = 3;
|
||||||
currentScene = DRLGContainers[2][RandomHelper.Next(0, DRLGContainers[2].Count)];
|
currentScene = DRLGContainers[2].PickRandom();
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length > 1) //Way
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length > 1) //Way
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -715,7 +712,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
if (prestScene.SNOHandle.Name.StartsWith("x1_Pand"))
|
if (prestScene.SNOHandle.Name.StartsWith("x1_Pand"))
|
||||||
positionOfNav = 3;
|
positionOfNav = 3;
|
||||||
|
|
||||||
currentScene = DRLGContainers[2][RandomHelper.Next(0, DRLGContainers[2].Count)];
|
currentScene = DRLGContainers[2].PickRandom();
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length > 1) //Way
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length > 1) //Way
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -753,7 +750,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
if (prestScene.SNOHandle.Name.StartsWith("x1_Pand"))
|
if (prestScene.SNOHandle.Name.StartsWith("x1_Pand"))
|
||||||
positionOfNav = 3;
|
positionOfNav = 3;
|
||||||
|
|
||||||
currentScene = DRLGContainers[2][RandomHelper.Next(0, DRLGContainers[2].Count)];
|
currentScene = DRLGContainers[2].PickRandom();
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length > 1) //Way
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length > 1) //Way
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -793,7 +790,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
if (prestScene.SNOHandle.Name.StartsWith("x1_Pand"))
|
if (prestScene.SNOHandle.Name.StartsWith("x1_Pand"))
|
||||||
positionOfNav = 3;
|
positionOfNav = 3;
|
||||||
|
|
||||||
currentScene = DRLGContainers[2][RandomHelper.Next(0, DRLGContainers[2].Count)];
|
currentScene = DRLGContainers[2].PickRandom();
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length > 1) //Way
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length > 1) //Way
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -832,7 +829,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
currentNav = 'E';
|
currentNav = 'E';
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[2][RandomHelper.Next(0, DRLGContainers[2].Count)];
|
currentScene = DRLGContainers[2].PickRandom();
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length > 1) //Way
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length > 1) //Way
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -865,7 +862,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
currentNav = 'W';
|
currentNav = 'W';
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[2][RandomHelper.Next(0, DRLGContainers[2].Count)];
|
currentScene = DRLGContainers[2].PickRandom();
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length > 1) //Way
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length > 1) //Way
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -919,7 +916,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
{
|
{
|
||||||
if (hasExit)
|
if (hasExit)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];
|
currentScene = DRLGContainers[3].PickRandom();
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //Way
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //Way
|
||||||
{
|
{
|
||||||
@ -929,7 +926,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[1][RandomHelper.Next(0, DRLGContainers[1].Count)];
|
currentScene = DRLGContainers[1].PickRandom();
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav)) //Exit
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav)) //Exit
|
||||||
{
|
{
|
||||||
@ -941,7 +938,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[2][RandomHelper.Next(0, DRLGContainers[2].Count)];
|
currentScene = DRLGContainers[2].PickRandom();
|
||||||
#region проверка на будущее
|
#region проверка на будущее
|
||||||
toWaitChunks = currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray();
|
toWaitChunks = currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray();
|
||||||
bool ForceStop = false;
|
bool ForceStop = false;
|
||||||
@ -955,7 +952,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X + RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X + RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -972,7 +969,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X - RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X - RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -989,7 +986,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y + RangetoNext, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y + RangetoNext, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1006,7 +1003,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y - RangetoNext, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y - RangetoNext, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1067,7 +1064,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
{
|
{
|
||||||
if (hasExit)
|
if (hasExit)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];
|
currentScene = DRLGContainers[3].PickRandom();
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //Way
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //Way
|
||||||
{
|
{
|
||||||
@ -1077,7 +1074,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[1][RandomHelper.Next(0, DRLGContainers[1].Count)];
|
currentScene = DRLGContainers[1].PickRandom();
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav)) //Exit
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav)) //Exit
|
||||||
{
|
{
|
||||||
@ -1089,7 +1086,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[2][RandomHelper.Next(0, DRLGContainers[2].Count)];
|
currentScene = DRLGContainers[2].PickRandom();
|
||||||
#region проверка на будущее
|
#region проверка на будущее
|
||||||
toWaitChunks = currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray();
|
toWaitChunks = currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray();
|
||||||
bool forceStop = false;
|
bool forceStop = false;
|
||||||
@ -1103,7 +1100,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X + RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X + RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1119,7 +1116,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X - RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X - RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1135,7 +1132,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y + RangetoNext, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y + RangetoNext, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1151,7 +1148,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y - RangetoNext, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y - RangetoNext, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;// else PosOfNav = 3;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;// else PosOfNav = 3;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1212,7 +1209,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
{
|
{
|
||||||
if (hasExit)
|
if (hasExit)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];
|
currentScene = DRLGContainers[3].PickRandom();
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //Way
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //Way
|
||||||
{
|
{
|
||||||
@ -1222,7 +1219,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[1][RandomHelper.Next(0, DRLGContainers[1].Count)];
|
currentScene = DRLGContainers[1].PickRandom();
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav)) //Exit
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav)) //Exit
|
||||||
{
|
{
|
||||||
@ -1234,7 +1231,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[2][RandomHelper.Next(0, DRLGContainers[2].Count)];
|
currentScene = DRLGContainers[2].PickRandom();
|
||||||
#region проверка на будущее
|
#region проверка на будущее
|
||||||
toWaitChunks = currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray();
|
toWaitChunks = currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray();
|
||||||
bool ForceStop = false;
|
bool ForceStop = false;
|
||||||
@ -1252,7 +1249,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X + RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X + RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom();//CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1267,7 +1264,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X - RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X - RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom();//CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1282,7 +1279,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y + RangetoNext, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y + RangetoNext, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1297,7 +1294,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y - RangetoNext, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y - RangetoNext, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1358,7 +1355,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
{
|
{
|
||||||
if (hasExit)
|
if (hasExit)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];
|
currentScene = DRLGContainers[3].PickRandom();
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //Way
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //Way
|
||||||
{
|
{
|
||||||
@ -1368,7 +1365,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[1][RandomHelper.Next(0, DRLGContainers[1].Count)];
|
currentScene = DRLGContainers[1].PickRandom();
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav)) //Exit
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav)) //Exit
|
||||||
{
|
{
|
||||||
@ -1380,7 +1377,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[2][RandomHelper.Next(0, DRLGContainers[2].Count)];
|
currentScene = DRLGContainers[2].PickRandom();
|
||||||
#region проверка на будущее
|
#region проверка на будущее
|
||||||
toWaitChunks = currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray();
|
toWaitChunks = currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray();
|
||||||
bool ForceStop = false;
|
bool ForceStop = false;
|
||||||
@ -1398,7 +1395,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X + RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X + RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1413,7 +1410,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X - RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X - RangetoNext, placeToNewScene.Y, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1428,7 +1425,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y + RangetoNext, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y + RangetoNext, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1443,7 +1440,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y - RangetoNext, placeToNewScene.Z))))
|
(reservedChunks.Contains(new Vector3D(placeToNewScene.X, placeToNewScene.Y - RangetoNext, placeToNewScene.Z))))
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[3][RandomHelper.Next(0, DRLGContainers[3].Count)];//CurrentScene Switch
|
currentScene = DRLGContainers[3].PickRandom(); // CurrentScene Switch
|
||||||
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
if (currentScene.Asset.Name.ToLower().Contains("hexmaze_edge") || currentScene.Asset.Name.ToLower().Contains("hexmaze_exit")) positionOfNav = 4;
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(currentNav) & currentScene.Asset.Name.Split('_')[positionOfNav].ToCharArray().Length == 1) //End
|
||||||
{
|
{
|
||||||
@ -1540,7 +1537,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
char Nav = chunk.SNOHandle.Name.Split('_')[positionOfNav].ToCharArray()[0];
|
char Nav = chunk.SNOHandle.Name.Split('_')[positionOfNav].ToCharArray()[0];
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[1][RandomHelper.Next(0, DRLGContainers[1].Count)];
|
currentScene = DRLGContainers[1].PickRandom();
|
||||||
|
|
||||||
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(Nav)) //Exit
|
if (currentScene.Asset.Name.Split('_')[positionOfNav].Contains(Nav)) //Exit
|
||||||
{
|
{
|
||||||
@ -1603,7 +1600,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
|
|
||||||
if (!busy)
|
if (!busy)
|
||||||
{
|
{
|
||||||
currentScene = DRLGContainers[4][RandomHelper.Next(0, DRLGContainers[4].Count)];
|
currentScene = DRLGContainers[4].PickRandom();
|
||||||
|
|
||||||
var newscene = new SceneChunk
|
var newscene = new SceneChunk
|
||||||
{
|
{
|
||||||
@ -1975,7 +1972,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//Chose a random exit to test
|
//Chose a random exit to test
|
||||||
Vector3D chosenExitPosition = RandomHelper.RandomValue(exitTypes);
|
Vector3D chosenExitPosition = exitTypes.PickRandom().Value;
|
||||||
var chosenExitDirection = (from pair in exitTypes
|
var chosenExitDirection = (from pair in exitTypes
|
||||||
where pair.Value == chosenExitPosition
|
where pair.Value == chosenExitPosition
|
||||||
select pair.Key).FirstOrDefault();
|
select pair.Key).FirstOrDefault();
|
||||||
@ -2077,7 +2074,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
//return filler
|
//return filler
|
||||||
return GetTileInfo(tiles, TileTypes.Filler);
|
return GetTileInfo(tiles, TileTypes.Filler);
|
||||||
}
|
}
|
||||||
List<TileInfo> tilesWithRightDirection = (from pair in tiles where ((pair.Value.ExitDirectionBits & exitDirectionBits) > 0) select pair.Value).ToList<TileInfo>();
|
List<TileInfo> tilesWithRightDirection = (from pair in tiles where ((pair.Value.ExitDirectionBits & exitDirectionBits) > 0) select pair.Value).ToList();
|
||||||
|
|
||||||
if (tilesWithRightDirection.Count == 0)
|
if (tilesWithRightDirection.Count == 0)
|
||||||
{
|
{
|
||||||
@ -2087,7 +2084,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RandomHelper.RandomItem(tilesWithRightDirection, x => 1.0f);
|
return tilesWithRightDirection.PickRandom();
|
||||||
}
|
}
|
||||||
|
|
||||||
private TileInfo GetTile(Dictionary<int, TileInfo> tiles, int snoId)
|
private TileInfo GetTile(Dictionary<int, TileInfo> tiles, int snoId)
|
||||||
@ -2100,12 +2097,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
/// Returns a tileinfo from a list of tiles that has a specific type
|
/// Returns a tileinfo from a list of tiles that has a specific type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tiles"></param>
|
/// <param name="tiles"></param>
|
||||||
/// <param name="exitDirectionBits"></param>
|
/// <param name="tileType"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private TileInfo GetTileInfo(Dictionary<int, TileInfo> tiles, TileTypes tileType)
|
private TileInfo GetTileInfo(Dictionary<int, TileInfo> tiles, TileTypes tileType)
|
||||||
{
|
{
|
||||||
var tilesWithRightType = (from pair in tiles where (pair.Value.TileType == (int)tileType) select pair.Value);
|
var tilesWithRightType = tiles.Values.Where(tile => tile.TileType == (int)tileType);
|
||||||
return RandomHelper.RandomItem(tilesWithRightType, x => 1);
|
return tilesWithRightType.PickRandom();
|
||||||
}
|
}
|
||||||
|
|
||||||
private TileInfo GetTileInfo(Dictionary<int, TileInfo> tiles, TileTypes tileType, int exitDirectionBits)
|
private TileInfo GetTileInfo(Dictionary<int, TileInfo> tiles, TileTypes tileType, int exitDirectionBits)
|
||||||
|
|||||||
@ -171,30 +171,28 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
|
|
||||||
if (IsUnique)
|
if (IsUnique)
|
||||||
{
|
{
|
||||||
var restrictedFamily = item.ItemDefinition.LegendaryAffixFamily.Where(af => af != -1);
|
var restrictedFamily = item.ItemDefinition.LegendaryAffixFamily.Where(af => af != -1).ToHashSet();
|
||||||
filteredList = filteredList.Where(
|
filteredList = filteredList
|
||||||
a =>
|
.Where(a => !(restrictedFamily.Contains(a.AffixFamily0) || restrictedFamily.Contains(a.AffixFamily1)));
|
||||||
!(restrictedFamily.Contains(a.AffixFamily0) || restrictedFamily.Contains(a.AffixFamily1))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (restrictedFamily.Contains(1616088365) ||
|
if (restrictedFamily.Contains(1616088365) ||
|
||||||
restrictedFamily.Contains(-1461069734) ||
|
restrictedFamily.Contains(-1461069734) ||
|
||||||
restrictedFamily.Contains(234326220) ||
|
restrictedFamily.Contains(234326220) ||
|
||||||
restrictedFamily.Contains(1350281776) ||
|
restrictedFamily.Contains(1350281776) ||
|
||||||
restrictedFamily.Contains(-812845450) ||
|
restrictedFamily.Contains(-812845450) ||
|
||||||
restrictedFamily.Contains(1791554648) ||
|
restrictedFamily.Contains(1791554648) ||
|
||||||
restrictedFamily.Contains(125900958)) //MinMaxDam and ele damage
|
restrictedFamily.Contains(125900958)) //MinMaxDam and ele damage
|
||||||
filteredList = filteredList.Where(
|
{
|
||||||
a =>
|
filteredList = filteredList
|
||||||
!a.Name.Contains("FireD") &&
|
.Where(a => !a.Name.Contains("FireD") &&
|
||||||
!a.Name.Contains("PoisonD") &&
|
!a.Name.Contains("PoisonD") &&
|
||||||
!a.Name.Contains("HolyD") &&
|
!a.Name.Contains("HolyD") &&
|
||||||
!a.Name.Contains("ColdD") &&
|
!a.Name.Contains("ColdD") &&
|
||||||
!a.Name.Contains("LightningD") &&
|
!a.Name.Contains("LightningD") &&
|
||||||
!a.Name.Contains("ArcaneD") &&
|
!a.Name.Contains("ArcaneD") &&
|
||||||
!a.Name.Contains("MinMaxDam") &&
|
!a.Name.Contains("MinMaxDam") &&
|
||||||
isCrafting ? !a.Name.ToLower().Contains("socket") : !a.Name.Contains("ASDHUIOPASDHIOU")
|
isCrafting ? !a.Name.ToLower().Contains("socket") : !a.Name.Contains("ASDHUIOPASDHIOU"));
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (affixesCount <= 1)
|
if (affixesCount <= 1)
|
||||||
@ -321,24 +319,28 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
public static int FindSuitableAffix(Item item, int affixGroup, int affixLevel, bool extendedFilter)
|
public static int FindSuitableAffix(Item item, int affixGroup, int affixLevel, bool extendedFilter)
|
||||||
{
|
{
|
||||||
if (affixGroup == -1) return -1;
|
if (affixGroup == -1) return -1;
|
||||||
var all_group = LegendaryAffixList.Where(a => (a.AffixFamily0 == affixGroup || a.AffixFamily1 == affixGroup) && (Item.Is2H(item.ItemType) ? !a.Name.EndsWith("1h") : (!a.Name.Contains("Two-Handed") && !a.Name.EndsWith("2h"))));
|
var allGroup = LegendaryAffixList
|
||||||
|
.Where(a => (a.AffixFamily0 == affixGroup || a.AffixFamily1 == affixGroup) && (Item.Is2H(item.ItemType) ? !a.Name.EndsWith("1h") : (!a.Name.Contains("Two-Handed") && !a.Name.EndsWith("2h"))))
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
if (all_group.Count() == 0) return -1;
|
if (!allGroup.Any()) return -1;
|
||||||
|
|
||||||
bool secondGroup = (all_group.First().AffixFamily1 == affixGroup);
|
bool secondGroup = allGroup.First().AffixFamily1 == affixGroup;
|
||||||
|
|
||||||
var suitable = all_group.Where(a => a.AffixLevel <= affixLevel || affixLevel <= 0);
|
var suitable = allGroup.Where(a => a.AffixLevel <= affixLevel || affixLevel <= 0).ToArray();
|
||||||
|
|
||||||
if (suitable.Count() == 0) return -1;
|
if (!suitable.Any()) return -1;
|
||||||
|
|
||||||
List<int> itemTypes = ItemGroup.HierarchyToHashList(item.ItemType);
|
List<int> itemTypes = ItemGroup.HierarchyToHashList(item.ItemType);
|
||||||
|
|
||||||
suitable = suitable.Where(a => itemTypes.ContainsAtLeastOne(a.ItemGroup) || (extendedFilter ? itemTypes.ContainsAtLeastOne(a.LegendaryAllowedTypes) : false));
|
suitable = suitable.Where(a =>
|
||||||
|
itemTypes.ContainsAtLeastOne(a.ItemGroup) ||
|
||||||
|
(extendedFilter && itemTypes.ContainsAtLeastOne(a.LegendaryAllowedTypes))).ToArray();
|
||||||
|
|
||||||
if (suitable.Count() == 0) return -1;
|
if (!suitable.Any()) return -1;
|
||||||
|
|
||||||
int suitableAffixLevel = suitable.OrderByDescending(a => a.AffixLevel).First().AffixLevel;
|
int suitableAffixLevel = suitable.MaxBy(a => a.AffixLevel).AffixLevel;
|
||||||
suitable = suitable.Where(a => a.AffixLevel == suitableAffixLevel);
|
suitable = suitable.Where(a => a.AffixLevel == suitableAffixLevel).ToArray();
|
||||||
|
|
||||||
//if (i18 && !secondGroup)
|
//if (i18 && !secondGroup)
|
||||||
// suitable = suitable.Where(a => a.MaxLevel <= (Program.MaxLevel + 4));
|
// suitable = suitable.Where(a => a.MaxLevel <= (Program.MaxLevel + 4));
|
||||||
@ -347,8 +349,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
//else
|
//else
|
||||||
//suitable = suitable.Where(a => itemTypes.ContainsAtLeastOne(a.I10));
|
//suitable = suitable.Where(a => itemTypes.ContainsAtLeastOne(a.I10));
|
||||||
|
|
||||||
if (suitable.Count() == 0)
|
if (!suitable.Any())
|
||||||
suitable = all_group.Where(a => a.AffixLevel == 1);
|
suitable = allGroup.Where(a => a.AffixLevel == 1).ToArray();
|
||||||
|
|
||||||
/*int suitableMaxLevel = suitable.OrderByDescending(a => a.AffixLevel).First().MaxLevel;
|
/*int suitableMaxLevel = suitable.OrderByDescending(a => a.AffixLevel).First().MaxLevel;
|
||||||
int suitableAffixLevel = suitable.OrderByDescending(a => a.AffixLevel).First().AffixLevel;
|
int suitableAffixLevel = suitable.OrderByDescending(a => a.AffixLevel).First().AffixLevel;
|
||||||
@ -361,36 +363,36 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
if (suitable.Count() > 1 && i18 && !secondGroup && suitable.Where(a => a.Name.Contains("Secondary")).Count() > 0)
|
if (suitable.Count() > 1 && i18 && !secondGroup && suitable.Where(a => a.Name.Contains("Secondary")).Count() > 0)
|
||||||
suitable = suitable.Where(a => a.Name.Contains("Secondary"));*/
|
suitable = suitable.Where(a => a.Name.Contains("Secondary"));*/
|
||||||
|
|
||||||
if (suitable.Count() > 0)
|
if (suitable.Any())
|
||||||
return suitable.ToList()[FastRandom.Instance.Next(0, suitable.Count())].Hash;
|
return suitable[FastRandom.Instance.Next(0, suitable.Length)].Hash;
|
||||||
else
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddAffix(Item item, int AffixGbId, bool findFromTotal = false)
|
public static void AddAffix(Item item, int affixGbId, bool findFromTotal = false)
|
||||||
{
|
{
|
||||||
if (AffixGbId == -1) return;
|
if (affixGbId == -1) return;
|
||||||
AffixTable definition = null;
|
AffixTable definition = null;
|
||||||
|
|
||||||
if (findFromTotal)
|
if (findFromTotal)
|
||||||
{
|
{
|
||||||
definition = AllAffix.Where(def => def.Hash == AffixGbId).FirstOrDefault();
|
definition = AllAffix.FirstOrDefault(def => def.Hash == affixGbId);
|
||||||
var testc = AllAffix.Where(def => def.ItemGroup[0] == AffixGbId || def.ItemGroup[1] == AffixGbId).FirstOrDefault();
|
var testc = AllAffix.FirstOrDefault(def => def.ItemGroup[0] == affixGbId || def.ItemGroup[1] == affixGbId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
definition = AffixList.Where(def => def.Hash == AffixGbId).FirstOrDefault();
|
definition = AffixList.FirstOrDefault(def => def.Hash == affixGbId);
|
||||||
|
|
||||||
if (definition == null)
|
if (definition == null)
|
||||||
{
|
{
|
||||||
definition = LegendaryAffixList.Where(def => def.Hash == AffixGbId).FirstOrDefault();
|
definition = LegendaryAffixList.FirstOrDefault(def => def.Hash == affixGbId);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (definition == null)
|
if (definition == null)
|
||||||
{
|
{
|
||||||
Logger.Warn("Affix {0} was not found!", AffixGbId);
|
Logger.Warn("Affix {0} was not found!", affixGbId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,7 +446,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var affix = new Affix(AffixGbId);
|
var affix = new Affix(affixGbId);
|
||||||
affix.Score = (Scores.Count == 0 ? 0 : Scores.Average());
|
affix.Score = (Scores.Count == 0 ? 0 : Scores.Average());
|
||||||
item.AffixList.Add(affix);
|
item.AffixList.Add(affix);
|
||||||
//item.Attributes[GameAttribute.Item_Quality_Level]++;
|
//item.Attributes[GameAttribute.Item_Quality_Level]++;
|
||||||
|
|||||||
@ -1088,7 +1088,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
it = items[RandomHelper.Next(@base, @base + 1)];
|
it = items[RandomHelper.Next(@base, @base + 1)]; // FIXME: this random always returns @base
|
||||||
player.Inventory.PickUp(ItemGenerator.Cook(player, it));
|
player.Inventory.PickUp(ItemGenerator.Cook(player, it));
|
||||||
break;
|
break;
|
||||||
case -1249067448:
|
case -1249067448:
|
||||||
@ -1102,7 +1102,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
"Unique_Shoulder_Set_09_x1", "Unique_Boots_Set_09_x1",
|
"Unique_Shoulder_Set_09_x1", "Unique_Boots_Set_09_x1",
|
||||||
"Unique_Shoulder_Set_06_x1", "Unique_Boots_Set_06_x1"
|
"Unique_Shoulder_Set_06_x1", "Unique_Boots_Set_06_x1"
|
||||||
};
|
};
|
||||||
it = items[RandomHelper.Next(@base, @base + 1)];
|
it = items[RandomHelper.Next(@base, @base + 1)]; // FIXME: this random always returns @base
|
||||||
player.Inventory.PickUp(ItemGenerator.Cook(player, it));
|
player.Inventory.PickUp(ItemGenerator.Cook(player, it));
|
||||||
break;
|
break;
|
||||||
case -1249067447:
|
case -1249067447:
|
||||||
@ -1116,7 +1116,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
"Unique_Chest_Set_09_x1", "Unique_Pants_Set_09_x1",
|
"Unique_Chest_Set_09_x1", "Unique_Pants_Set_09_x1",
|
||||||
"Unique_Chest_Set_06_x1", "Unique_Pants_Set_06_x1"
|
"Unique_Chest_Set_06_x1", "Unique_Pants_Set_06_x1"
|
||||||
};
|
};
|
||||||
it = items[RandomHelper.Next(@base, @base + 1)];
|
it = items[RandomHelper.Next(@base, @base + 1)]; // FIXME: this random always returns @base
|
||||||
player.Inventory.PickUp(ItemGenerator.Cook(player, it));
|
player.Inventory.PickUp(ItemGenerator.Cook(player, it));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@ -335,7 +335,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
data.NumberOfCompletionSteps);
|
data.NumberOfCompletionSteps);
|
||||||
foreach (var step in data.QuestSteps)
|
foreach (var step in data.QuestSteps)
|
||||||
{
|
{
|
||||||
int nextID = step.StepObjectiveSets.Count() > 0
|
int nextID = step.StepObjectiveSets.Any()
|
||||||
? step.StepObjectiveSets.First().FollowUpStepID
|
? step.StepObjectiveSets.First().FollowUpStepID
|
||||||
: -1;
|
: -1;
|
||||||
Logger.Info("Step [{0}] {1} -> {2}", step.ID, step.Name, nextID);
|
Logger.Info("Step [{0}] {1} -> {2}", step.ID, step.Name, nextID);
|
||||||
@ -1168,7 +1168,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
//var found = false;
|
//var found = false;
|
||||||
//ItemTable itemDefinition = null;
|
//ItemTable itemDefinition = null;
|
||||||
|
|
||||||
if (pool.Count() == 0) return null;
|
if (pool.Count == 0) return null;
|
||||||
List<ItemTable> pool_filtered = pool.Where(it =>
|
List<ItemTable> pool_filtered = pool.Where(it =>
|
||||||
it.SNOActor != -1 &&
|
it.SNOActor != -1 &&
|
||||||
it.WeaponDamageMin != 100.0f &&
|
it.WeaponDamageMin != 100.0f &&
|
||||||
@ -1222,7 +1222,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
).ToList();
|
).ToList();
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
if (pool_filtered.Count() == 0) return null;
|
if (pool_filtered.Count == 0) return null;
|
||||||
|
|
||||||
|
|
||||||
ItemTable selected = pool_filtered[FastRandom.Instance.Next(0, pool_filtered.Count() - 1)];
|
ItemTable selected = pool_filtered[FastRandom.Instance.Next(0, pool_filtered.Count() - 1)];
|
||||||
@ -1234,7 +1234,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
//var found = false;
|
//var found = false;
|
||||||
//ItemTable itemDefinition = null;
|
//ItemTable itemDefinition = null;
|
||||||
|
|
||||||
if (pool.Count() == 0) return null;
|
if (pool.Count == 0) return null;
|
||||||
List<ItemTable> pool_filtered = pool.Where(it =>
|
List<ItemTable> pool_filtered = pool.Where(it =>
|
||||||
it.SNOActor != -1 &&
|
it.SNOActor != -1 &&
|
||||||
it.WeaponDamageMin != 100.0f &&
|
it.WeaponDamageMin != 100.0f &&
|
||||||
@ -1262,7 +1262,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
(it.Cost == 0)) && // i hope it catches all lore with npc spawned /xsochor
|
(it.Cost == 0)) && // i hope it catches all lore with npc spawned /xsochor
|
||||||
!(!GBIDHandlers.ContainsKey(it.Hash) && !AllowedItemTypes.Contains(it.ItemTypesGBID))
|
!(!GBIDHandlers.ContainsKey(it.Hash) && !AllowedItemTypes.Contains(it.ItemTypesGBID))
|
||||||
).ToList();
|
).ToList();
|
||||||
if (pool_filtered.Count() == 0) return null;
|
if (pool_filtered.Count == 0) return null;
|
||||||
|
|
||||||
ItemTable selected = pool_filtered[FastRandom.Instance.Next(0, pool_filtered.Count() - 1)];
|
ItemTable selected = pool_filtered[FastRandom.Instance.Next(0, pool_filtered.Count() - 1)];
|
||||||
return selected;
|
return selected;
|
||||||
|
|||||||
@ -282,7 +282,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
|
|||||||
BuffManager.Update();
|
BuffManager.Update();
|
||||||
PowerManager.Update();
|
PowerManager.Update();
|
||||||
|
|
||||||
if (tickCounter % 6 == 0 && _flippyTimers.Count() > 0)
|
if (tickCounter % 6 == 0 && _flippyTimers.Any())
|
||||||
{
|
{
|
||||||
UpdateFlippy(tickCounter);
|
UpdateFlippy(tickCounter);
|
||||||
}
|
}
|
||||||
@ -1033,7 +1033,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_flippyTimers.Dequeue().Dequeue().Invoke();
|
_flippyTimers.Dequeue().Dequeue().Invoke();
|
||||||
if (_flippyTimers.Count() > 0)
|
if (_flippyTimers.Any())
|
||||||
_flippyTimers.Peek().Dequeue().Invoke();
|
_flippyTimers.Peek().Dequeue().Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,6 +52,7 @@ using DiIiS_NA.GameServer.Core.Types.Math;
|
|||||||
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Conversation;
|
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Conversation;
|
||||||
//Blizzless Project 2022
|
//Blizzless Project 2022
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
using DiIiS_NA.Core.Extensions;
|
||||||
//Blizzless Project 2022
|
//Blizzless Project 2022
|
||||||
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Quest;
|
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Quest;
|
||||||
//Blizzless Project 2022
|
//Blizzless Project 2022
|
||||||
@ -572,8 +573,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (asset.RootTreeNodes[lineIndex].ConvNodeType == 4)
|
if (asset.RootTreeNodes[lineIndex].ConvNodeType == 4)
|
||||||
currentLineNode = asset.RootTreeNodes[lineIndex]
|
currentLineNode = asset.RootTreeNodes[lineIndex].ChildNodes.PickRandom();
|
||||||
.ChildNodes[RandomHelper.Next(asset.RootTreeNodes[lineIndex].ChildNodes.Count)];
|
|
||||||
else
|
else
|
||||||
currentLineNode = asset.RootTreeNodes[lineIndex];
|
currentLineNode = asset.RootTreeNodes[lineIndex];
|
||||||
|
|
||||||
|
|||||||
@ -261,7 +261,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
|
|
||||||
public Item GetItemByDynId(Player plr, uint dynId)
|
public Item GetItemByDynId(Player plr, uint dynId)
|
||||||
{
|
{
|
||||||
if (Items.Values.Where(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId).Count() > 0)
|
if (Items.Values.Any(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId))
|
||||||
return Items.Values.Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
|
return Items.Values.Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -286,9 +286,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
{
|
{
|
||||||
string itemType = originalItem.ItemDefinition.Name.Substring(3);
|
string itemType = originalItem.ItemDefinition.Name.Substring(3);
|
||||||
if (itemType.Contains("1HWeapon"))
|
if (itemType.Contains("1HWeapon"))
|
||||||
itemType = OneHandedWeapons[FastRandom.Instance.Next(OneHandedWeapons.Count())];
|
itemType = OneHandedWeapons[FastRandom.Instance.Next(OneHandedWeapons.Count)];
|
||||||
if (itemType.Contains("2HWeapon"))
|
if (itemType.Contains("2HWeapon"))
|
||||||
itemType = TwoHandedWeapons[FastRandom.Instance.Next(TwoHandedWeapons.Count())];
|
itemType = TwoHandedWeapons[FastRandom.Instance.Next(TwoHandedWeapons.Count)];
|
||||||
if (itemType.Contains("Pants"))
|
if (itemType.Contains("Pants"))
|
||||||
itemType = "Legs";
|
itemType = "Legs";
|
||||||
_inventoryGrid.AddItem(ItemGenerator.GetRandomItemOfType(_owner, ItemGroup.FromString(itemType)));
|
_inventoryGrid.AddItem(ItemGenerator.GetRandomItemOfType(_owner, ItemGroup.FromString(itemType)));
|
||||||
@ -739,15 +739,15 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
_owner.GrantAchievement(74987243307126);
|
_owner.GrantAchievement(74987243307126);
|
||||||
|
|
||||||
var items = GetEquippedItems();
|
var items = GetEquippedItems();
|
||||||
if (items.Where(item => ItemGroup.IsSubType(item.ItemType, "Belt_Barbarian")).Count() > 0 && (items.Where(item => ItemGroup.IsSubType(item.ItemType, "MightyWeapon1H")).Count() > 0 || items.Where(item => ItemGroup.IsSubType(item.ItemType, "MightyWeapon2H")).Count() > 0)) //barb
|
if (items.Any(item => ItemGroup.IsSubType(item.ItemType, "Belt_Barbarian")) && (items.Any(item => ItemGroup.IsSubType(item.ItemType, "MightyWeapon1H")) || items.Any(item => ItemGroup.IsSubType(item.ItemType, "MightyWeapon2H")))) //barb
|
||||||
_owner.GrantAchievement(74987243307046);
|
_owner.GrantAchievement(74987243307046);
|
||||||
if (items.Where(item => ItemGroup.IsSubType(item.ItemType, "Cloak")).Count() > 0 && items.Where(item => ItemGroup.IsSubType(item.ItemType, "HandXbow")).Count() > 0) //dh
|
if (items.Any(item => ItemGroup.IsSubType(item.ItemType, "Cloak")) && items.Any(item => ItemGroup.IsSubType(item.ItemType, "HandXbow"))) //dh
|
||||||
_owner.GrantAchievement(74987243307058);
|
_owner.GrantAchievement(74987243307058);
|
||||||
if (items.Where(item => ItemGroup.IsSubType(item.ItemType, "SpiritStone_Monk")).Count() > 0 && (items.Where(item => ItemGroup.IsSubType(item.ItemType, "FistWeapon")).Count() > 0 || items.Where(item => ItemGroup.IsSubType(item.ItemType, "CombatStaff")).Count() > 0)) //monk
|
if (items.Any(item => ItemGroup.IsSubType(item.ItemType, "SpiritStone_Monk")) && (items.Any(item => ItemGroup.IsSubType(item.ItemType, "FistWeapon")) || items.Any(item => ItemGroup.IsSubType(item.ItemType, "CombatStaff")))) //monk
|
||||||
_owner.GrantAchievement(74987243307544);
|
_owner.GrantAchievement(74987243307544);
|
||||||
if (items.Where(item => ItemGroup.IsSubType(item.ItemType, "VoodooMask")).Count() > 0 && items.Where(item => ItemGroup.IsSubType(item.ItemType, "CeremonialDagger")).Count() > 0 && items.Where(item => ItemGroup.IsSubType(item.ItemType, "Mojo")).Count() > 0) //wd
|
if (items.Any(item => ItemGroup.IsSubType(item.ItemType, "VoodooMask")) && items.Any(item => ItemGroup.IsSubType(item.ItemType, "CeremonialDagger")) && items.Any(item => ItemGroup.IsSubType(item.ItemType, "Mojo"))) //wd
|
||||||
_owner.GrantAchievement(74987243307561);
|
_owner.GrantAchievement(74987243307561);
|
||||||
if (items.Where(item => ItemGroup.IsSubType(item.ItemType, "WizardHat")).Count() > 0 && items.Where(item => ItemGroup.IsSubType(item.ItemType, "Wand")).Count() > 0 && items.Where(item => ItemGroup.IsSubType(item.ItemType, "Orb")).Count() > 0) //wiz
|
if (items.Any(item => ItemGroup.IsSubType(item.ItemType, "WizardHat")) && items.Any(item => ItemGroup.IsSubType(item.ItemType, "Wand")) && items.Any(item => ItemGroup.IsSubType(item.ItemType, "Orb"))) //wiz
|
||||||
_owner.GrantAchievement(74987243307582);
|
_owner.GrantAchievement(74987243307582);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1099,23 +1099,23 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
{
|
{
|
||||||
if (client.Game.PvP) return;
|
if (client.Game.PvP) return;
|
||||||
if (_owner.IsCasting) _owner.StopCasting();
|
if (_owner.IsCasting) _owner.StopCasting();
|
||||||
if (message is InventoryRequestMoveMessage) HandleInventoryRequestMoveMessage(message as InventoryRequestMoveMessage);
|
if (message is InventoryRequestMoveMessage moveMessage) HandleInventoryRequestMoveMessage(moveMessage);
|
||||||
else if (message is InventoryRequestQuickMoveMessage) HandleInventoryRequestQuickMoveMessage(message as InventoryRequestQuickMoveMessage);
|
else if (message is InventoryRequestQuickMoveMessage quickMoveMessage) HandleInventoryRequestQuickMoveMessage(quickMoveMessage);
|
||||||
else if (message is InventorySplitStackMessage) OnInventorySplitStackMessage(message as InventorySplitStackMessage);
|
else if (message is InventorySplitStackMessage stackMessage) OnInventorySplitStackMessage(stackMessage);
|
||||||
else if (message is InventoryStackTransferMessage) OnInventoryStackTransferMessage(message as InventoryStackTransferMessage);
|
else if (message is InventoryStackTransferMessage transferMessage) OnInventoryStackTransferMessage(transferMessage);
|
||||||
else if (message is InventoryDropItemMessage) OnInventoryDropItemMessage(message as InventoryDropItemMessage);
|
else if (message is InventoryDropItemMessage dropItemMessage) OnInventoryDropItemMessage(dropItemMessage);
|
||||||
else if (message is InventoryRequestUseMessage) OnInventoryRequestUseMessage(message as InventoryRequestUseMessage);
|
else if (message is InventoryRequestUseMessage useMessage) OnInventoryRequestUseMessage(useMessage);
|
||||||
else if (message is InventoryRequestSocketMessage) OnSocketMessage(message as InventoryRequestSocketMessage);
|
else if (message is InventoryRequestSocketMessage socketMessage) OnSocketMessage(socketMessage);
|
||||||
else if (message is InventoryGemsExtractMessage) OnGemsExtractMessage(message as InventoryGemsExtractMessage);
|
else if (message is InventoryGemsExtractMessage extractMessage) OnGemsExtractMessage(extractMessage);
|
||||||
else if (message is RequestBuySharedStashSlotsMessage) OnBuySharedStashSlots(message as RequestBuySharedStashSlotsMessage);
|
else if (message is RequestBuySharedStashSlotsMessage slotsMessage) OnBuySharedStashSlots(slotsMessage);
|
||||||
else if (message is InventoryIdentifyItemMessage) OnInventoryIdentifyItemMessage(message as InventoryIdentifyItemMessage);
|
else if (message is InventoryIdentifyItemMessage identifyItemMessage) OnInventoryIdentifyItemMessage(identifyItemMessage);
|
||||||
else if (message is InventoryUseIdentifyItemMessage) OnInventoryUseIdentifyItemMessage(message as InventoryUseIdentifyItemMessage);
|
else if (message is InventoryUseIdentifyItemMessage itemMessage) OnInventoryUseIdentifyItemMessage(itemMessage);
|
||||||
else if (message is TrySalvageMessage) OnTrySalvageMessage(message as TrySalvageMessage);
|
else if (message is TrySalvageMessage salvageMessage) OnTrySalvageMessage(salvageMessage);
|
||||||
else if (message is TrySalvageAllMessage) OnTrySalvageAllMessage(message as TrySalvageAllMessage);
|
else if (message is TrySalvageAllMessage allMessage) OnTrySalvageAllMessage(allMessage);
|
||||||
else if (message is CraftItemsMessage) OnCraftItemMessage(client, message as CraftItemsMessage);
|
else if (message is CraftItemsMessage itemsMessage) OnCraftItemMessage(client, itemsMessage);
|
||||||
else if (message is EnchantAffixMessage) OnEnchantAffixMessage(client, message as EnchantAffixMessage);
|
else if (message is EnchantAffixMessage affixMessage) OnEnchantAffixMessage(client, affixMessage);
|
||||||
else if (message is TryTransmogItemMessage) OnTryTransmogItemMessage(client, message as TryTransmogItemMessage);
|
else if (message is TryTransmogItemMessage transmogItemMessage) OnTryTransmogItemMessage(client, transmogItemMessage);
|
||||||
else if (message is DyeItemMessage) OnDyeItemMessage(client, message as DyeItemMessage);
|
else if (message is DyeItemMessage dyeItemMessage) OnDyeItemMessage(client, dyeItemMessage);
|
||||||
else if (message is InventoryRepairAllMessage) RepairAll();
|
else if (message is InventoryRepairAllMessage) RepairAll();
|
||||||
else if (message is InventoryRepairEquippedMessage) RepairEquipment();
|
else if (message is InventoryRepairEquippedMessage) RepairEquipment();
|
||||||
|
|
||||||
@ -1201,6 +1201,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
if (!ReloadAffix.Definition.Name.Contains("Secondary")) filteredList = filteredList.Where( a => !a.Name.Contains("Secondary") );
|
if (!ReloadAffix.Definition.Name.Contains("Secondary")) filteredList = filteredList.Where( a => !a.Name.Contains("Secondary") );
|
||||||
if (!ReloadAffix.Definition.Name.Contains("Experience")) filteredList = filteredList.Where(a => !a.Name.Contains("Experience"));
|
if (!ReloadAffix.Definition.Name.Contains("Experience")) filteredList = filteredList.Where(a => !a.Name.Contains("Experience"));
|
||||||
if (!ReloadAffix.Definition.Name.Contains("Archon")) filteredList = filteredList.Where(a => !a.Name.Contains("Archon"));
|
if (!ReloadAffix.Definition.Name.Contains("Archon")) filteredList = filteredList.Where(a => !a.Name.Contains("Archon"));
|
||||||
|
// FIXME: always true?
|
||||||
if (ReloadAffix.Definition.Hash == ReloadAffix.Definition.Hash) filteredList = filteredList.Where(a => a.Hash != ReloadAffix.Definition.Hash);
|
if (ReloadAffix.Definition.Hash == ReloadAffix.Definition.Hash) filteredList = filteredList.Where(a => a.Hash != ReloadAffix.Definition.Hash);
|
||||||
if (Item.GBHandle.GBID == -4139386) filteredList = filteredList.Where( a => !a.Name.Contains("Str") && !a.Name.Contains("Dex") && !a.Name.Contains("Int") && !a.Name.Contains("Vit" ));
|
if (Item.GBHandle.GBID == -4139386) filteredList = filteredList.Where( a => !a.Name.Contains("Str") && !a.Name.Contains("Dex") && !a.Name.Contains("Int") && !a.Name.Contains("Vit" ));
|
||||||
|
|
||||||
@ -1218,15 +1219,20 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
|
|
||||||
//if (bestDefinitions.Values.Where(a => a.Name.Contains("PoisonD")).Count() > 0) Logger.Debug("PoisonD in bestDefinitions");
|
//if (bestDefinitions.Values.Where(a => a.Name.Contains("PoisonD")).Count() > 0) Logger.Debug("PoisonD in bestDefinitions");
|
||||||
List<AffixTable> selectedGroups = bestDefinitions.Values
|
List<AffixTable> selectedGroups = bestDefinitions.Values
|
||||||
.OrderBy(x => FastRandom.Instance.Next()) //random order
|
.OrderBy(_ => FastRandom.Instance.Next()) //random order
|
||||||
.GroupBy(x => (x.AffixFamily1 == -1) ? x.AffixFamily0 : x.AffixFamily1)
|
.GroupBy(x => x.AffixFamily1 == -1 ? x.AffixFamily0 : x.AffixFamily1)
|
||||||
.Select(x => x.First()) //only one from group
|
.Select(x => x.First()) // only one from group
|
||||||
.Take(1) //take needed amount
|
.Take(1) // take needed amount
|
||||||
.ToList();
|
.ToList();
|
||||||
if (selectedGroups.Count == 0)
|
if (selectedGroups.Count == 0)
|
||||||
if (ReloadAffix.Definition.Name.ToLower().Contains("socket"))
|
if (ReloadAffix.Definition.Name.ToLower().Contains("socket"))
|
||||||
selectedGroups = SocketsAffixs.Where(x => x.OverrideLevelReq <= ReloadAffix.Definition.AffixLevelMax //&& x.AffixLevelMin == ReloadAffix.Definition.AffixLevelMin
|
{
|
||||||
).OrderBy(x => FastRandom.Instance.Next()).Take(1).ToList();
|
selectedGroups = SocketsAffixs
|
||||||
|
.Where(x => x.OverrideLevelReq <= ReloadAffix.Definition.AffixLevelMax) //&& x.AffixLevelMin == ReloadAffix.Definition.AffixLevelMin
|
||||||
|
.OrderBy(_ => FastRandom.Instance.Next())
|
||||||
|
.Take(1)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2196,10 +2202,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
|
|
||||||
public Item GetItemByDynId(Player plr, uint dynId)
|
public Item GetItemByDynId(Player plr, uint dynId)
|
||||||
{
|
{
|
||||||
if (_inventoryGrid.Items.Values.Union(_stashGrid.Items.Values).Union(_equipment.Items.Values).Where(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId).Count() > 0)
|
if (_inventoryGrid.Items.Values.Union(_stashGrid.Items.Values).Union(_equipment.Items.Values).Any(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId))
|
||||||
return _inventoryGrid.Items.Values.Union(_stashGrid.Items.Values).Union(_equipment.Items.Values).Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
|
return _inventoryGrid.Items.Values.Union(_stashGrid.Items.Values).Union(_equipment.Items.Values).Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
|
||||||
else
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasItem(int GBid)
|
public bool HasItem(int GBid)
|
||||||
@ -2612,7 +2618,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
|
|
||||||
public bool GetItemBonus(GameAttributeB attributeB)
|
public bool GetItemBonus(GameAttributeB attributeB)
|
||||||
{
|
{
|
||||||
return Loaded ? (GetEquippedItems().Where(item => item.Attributes[attributeB] == true).Count() > 0) : _owner.Attributes[attributeB];
|
return Loaded ? GetEquippedItems().Any(item => item.Attributes[attributeB]) : _owner.Attributes[attributeB];
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetItemBonus(GameAttributeF attributeF, int attributeKey)
|
public float GetItemBonus(GameAttributeF attributeF, int attributeKey)
|
||||||
|
|||||||
@ -1869,7 +1869,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
foreach (var oldp in World.GetActorsBySNO(ActorSno._x1_openworld_lootrunportal,
|
foreach (var oldp in World.GetActorsBySNO(ActorSno._x1_openworld_lootrunportal,
|
||||||
ActorSno._x1_openworld_tiered_rifts_portal)) oldp.Destroy();
|
ActorSno._x1_openworld_tiered_rifts_portal)) oldp.Destroy();
|
||||||
|
|
||||||
map = maps[RandomHelper.Next(0, maps.Length)];
|
map = maps.PickRandom();
|
||||||
//map = 288823;
|
//map = 288823;
|
||||||
newTagMap.Add(new TagKeySNO(526850), new TagMapEntry(526850, (int)map, 0)); //World
|
newTagMap.Add(new TagKeySNO(526850), new TagMapEntry(526850, (int)map, 0)); //World
|
||||||
newTagMap.Add(new TagKeySNO(526853), new TagMapEntry(526853, 288482, 0)); //Zone
|
newTagMap.Add(new TagKeySNO(526853), new TagMapEntry(526853, 288482, 0)); //Zone
|
||||||
@ -1878,7 +1878,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
map = maps[RandomHelper.Next(0, maps.Length)];
|
map = maps.PickRandom();
|
||||||
if (map != InGameClient.Game.WorldOfPortalNephalem) break;
|
if (map != InGameClient.Game.WorldOfPortalNephalem) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2068,7 +2068,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
InGameClient.Game.NephalemGreater = true;
|
InGameClient.Game.NephalemGreater = true;
|
||||||
//disable banner while greater is active enable once boss is killed or portal is closed /advocaite
|
//disable banner while greater is active enable once boss is killed or portal is closed /advocaite
|
||||||
Attributes[GameAttribute.Banner_Usable] = false;
|
Attributes[GameAttribute.Banner_Usable] = false;
|
||||||
map = maps[RandomHelper.Next(0, maps.Length)];
|
map = maps.PickRandom();
|
||||||
newTagMap.Add(new TagKeySNO(526850), new TagMapEntry(526850, (int)map, 0)); //World
|
newTagMap.Add(new TagKeySNO(526850), new TagMapEntry(526850, (int)map, 0)); //World
|
||||||
newTagMap.Add(new TagKeySNO(526853), new TagMapEntry(526853, 288482, 0)); //Zone
|
newTagMap.Add(new TagKeySNO(526853), new TagMapEntry(526853, 288482, 0)); //Zone
|
||||||
newTagMap.Add(new TagKeySNO(526851), new TagMapEntry(526851, 172, 0)); //Entry-Pointа
|
newTagMap.Add(new TagKeySNO(526851), new TagMapEntry(526851, 172, 0)); //Entry-Pointа
|
||||||
@ -4652,8 +4652,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
public void GrantAchievement(ulong id)
|
public void GrantAchievement(ulong id)
|
||||||
{
|
{
|
||||||
if (_unlockedAchievements.Contains(id)) return;
|
if (_unlockedAchievements.Contains(id)) return;
|
||||||
if (InGameClient.BnetClient.Account.GameAccount.Achievements
|
if (InGameClient.BnetClient.Account.GameAccount.Achievements.Any(a => a.AchievementId == id && a.Completion != -1)) return;
|
||||||
.Where(a => a.AchievementId == id && a.Completion != -1).Count() > 0) return;
|
|
||||||
if (_unlockedAchievements.Contains(id)) return;
|
if (_unlockedAchievements.Contains(id)) return;
|
||||||
_unlockedAchievements.Add(id);
|
_unlockedAchievements.Add(id);
|
||||||
try
|
try
|
||||||
@ -6130,13 +6129,13 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
public int FindFollowerIndex(ActorSno sno)
|
public int FindFollowerIndex(ActorSno sno)
|
||||||
{
|
{
|
||||||
if (HaveFollower(sno))
|
if (HaveFollower(sno))
|
||||||
return _followerIndexes.Where(i => i.Value == sno).FirstOrDefault().Key;
|
return _followerIndexes.FirstOrDefault(i => i.Value == sno).Key;
|
||||||
else return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int CountFollowers(ActorSno sno)
|
public int CountFollowers(ActorSno sno)
|
||||||
{
|
{
|
||||||
return Followers.Values.Where(f => f == sno).Count();
|
return Followers.Values.Count(f => f == sno);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int CountAllFollowers()
|
public int CountAllFollowers()
|
||||||
|
|||||||
@ -15,6 +15,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using DiIiS_NA.Core.Extensions;
|
||||||
|
|
||||||
namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
||||||
{
|
{
|
||||||
@ -1544,7 +1545,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
if (!targets.Actors.Any()) return;
|
if (!targets.Actors.Any()) return;
|
||||||
|
|
||||||
AttackPayload shock = new AttackPayload(this);
|
AttackPayload shock = new AttackPayload(this);
|
||||||
shock.SetSingleTarget(targets.Actors[Rand.Next(targets.Actors.Count())]);
|
shock.SetSingleTarget(targets.Actors.PickRandom());
|
||||||
shock.Targets.Actors.First().PlayEffectGroup(312568);
|
shock.Targets.Actors.First().PlayEffectGroup(312568);
|
||||||
shock.AddWeaponDamage(ScriptFormula(21), DamageType.Lightning);
|
shock.AddWeaponDamage(ScriptFormula(21), DamageType.Lightning);
|
||||||
shock.OnHit = (hitPayload) =>
|
shock.OnHit = (hitPayload) =>
|
||||||
|
|||||||
@ -17,6 +17,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using DiIiS_NA.Core.Extensions;
|
||||||
|
|
||||||
namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
||||||
{
|
{
|
||||||
@ -300,10 +301,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
var targets = GetEnemiesInRadius(User.Position, ScriptFormula(18)).Actors;
|
var targets = GetEnemiesInRadius(User.Position, ScriptFormula(18)).Actors;
|
||||||
Actor target = null;
|
targets.TryPickRandom(out var target);
|
||||||
|
|
||||||
if (targets.Count() > 0)
|
|
||||||
target = targets[Rand.Next(targets.Count())];
|
|
||||||
|
|
||||||
var position = target == null ? RandomDirection(User.Position, 1f, 15f) : target.Position;
|
var position = target == null ? RandomDirection(User.Position, 1f, 15f) : target.Position;
|
||||||
_CreateArrowPool(ActorSno._demonhunter_rainofarrows_indigo_buff, position, ScriptFormula(16), 2f);
|
_CreateArrowPool(ActorSno._demonhunter_rainofarrows_indigo_buff, position, ScriptFormula(16), 2f);
|
||||||
|
|||||||
@ -1350,7 +1350,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
|
|
||||||
if (Rune_A > 0) //Barrage
|
if (Rune_A > 0) //Barrage
|
||||||
{
|
{
|
||||||
if (dash.Targets.Actors.Count() > 0)
|
if (dash.Targets.Actors.Any())
|
||||||
AddBuff(dash.Targets.GetClosestTo(TargetPosition), new DashingBarrageDotBuff());
|
AddBuff(dash.Targets.GetClosestTo(TargetPosition), new DashingBarrageDotBuff());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3114,7 +3114,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
Target.Attributes[GameAttribute.Damage_Weapon_Percent_Bonus] -= _unityDamageBonus;
|
Target.Attributes[GameAttribute.Damage_Weapon_Percent_Bonus] -= _unityDamageBonus;
|
||||||
Target.Attributes[GameAttribute.Damage_Percent_All_From_Skills] -= _unityDamageBonus;
|
Target.Attributes[GameAttribute.Damage_Percent_All_From_Skills] -= _unityDamageBonus;
|
||||||
|
|
||||||
_unityDamageBonus = 0.05f * Target.GetActorsInRange<Player>(ScriptFormula(0)).Count();
|
_unityDamageBonus = 0.05f * Target.GetActorsInRange<Player>(ScriptFormula(0)).Count;
|
||||||
|
|
||||||
Target.Attributes[GameAttribute.Damage_Weapon_Percent_Bonus] += _unityDamageBonus;
|
Target.Attributes[GameAttribute.Damage_Weapon_Percent_Bonus] += _unityDamageBonus;
|
||||||
Target.Attributes[GameAttribute.Damage_Percent_All_From_Skills] += _unityDamageBonus;
|
Target.Attributes[GameAttribute.Damage_Percent_All_From_Skills] += _unityDamageBonus;
|
||||||
@ -3657,7 +3657,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
if (Rune_B > 0) //Water Ally
|
if (Rune_B > 0) //Water Ally
|
||||||
{
|
{
|
||||||
var targets = GetEnemiesInRadius(petAlly.Position, 20f, 7).Actors;
|
var targets = GetEnemiesInRadius(petAlly.Position, 20f, 7).Actors;
|
||||||
if (targets.Count() <= 0) yield break;
|
if (!targets.Any()) yield break;
|
||||||
|
|
||||||
foreach (var target in targets)
|
foreach (var target in targets)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,6 +17,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using DiIiS_NA.Core.Extensions;
|
||||||
|
|
||||||
namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
||||||
{
|
{
|
||||||
@ -2587,8 +2588,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
{
|
{
|
||||||
if (Rune_C > 0)
|
if (Rune_C > 0)
|
||||||
{
|
{
|
||||||
int[] Effects = new int[] { 47400, 474402, 474435, 474437, 474453, 474455, 474464, 474466 };
|
int[] Effects = { 47400, 474402, 474435, 474437, 474453, 474455, 474464, 474466 };
|
||||||
Tar.PlayEffectGroup(Effects[RandomHelper.Next(0, 7)]);
|
Tar.PlayEffectGroup(Effects[RandomHelper.Next(0, 7)]); // FIXME: looks like we can't pick the last effect
|
||||||
yield return WaitSeconds(0.5f);
|
yield return WaitSeconds(0.5f);
|
||||||
WeaponDamage(Tar, Damage, DType);
|
WeaponDamage(Tar, Damage, DType);
|
||||||
|
|
||||||
@ -3300,9 +3301,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
Remove();
|
Remove();
|
||||||
|
|
||||||
var newms = payload.Target.GetMonstersInRange(40f);
|
var newms = payload.Target.GetMonstersInRange(40f);
|
||||||
|
if (newms.TryPickRandom(out var target))
|
||||||
if (newms.Count > 0)
|
{
|
||||||
AddBuff(newms.OrderBy(x => Guid.NewGuid()).Take(1).Single(), new Rune_B_Buff());
|
AddBuff(target, new Rune_B_Buff());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4493,8 +4495,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
if (projectile.GetMonstersInRange(15f).Count > 0)
|
if (projectile.GetMonstersInRange(15f).Count > 0)
|
||||||
{
|
{
|
||||||
Founded = true;
|
Founded = true;
|
||||||
var Target = projectile.GetMonstersInRange(25f).OrderBy(x => Guid.NewGuid()).Take(1).Single();
|
var possibleTargets = projectile.GetMonstersInRange(25f);
|
||||||
projectile.Launch(Target.Position, 1f);
|
var target = possibleTargets.PickRandom();
|
||||||
|
projectile.Launch(target.Position, 1f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
yield break;
|
yield break;
|
||||||
|
|||||||
@ -2316,7 +2316,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
if (!HasBuff<GargantuanEnrageCDBuff>(Target))
|
if (!HasBuff<GargantuanEnrageCDBuff>(Target))
|
||||||
{
|
{
|
||||||
var targets = GetEnemiesInRadius(Target.Position, 10f);
|
var targets = GetEnemiesInRadius(Target.Position, 10f);
|
||||||
if (targets.Actors.Count >= 5 || targets.Actors.Where(a => a is Boss || a is Champion || a is Rare || a is Unique).Count() > 1)
|
if (targets.Actors.Count >= 5 || targets.Actors.Count(a => a is Boss or Champion or Rare or Unique) > 1)
|
||||||
{
|
{
|
||||||
AddBuff(Target, new GargantuanEnrageCDBuff());
|
AddBuff(Target, new GargantuanEnrageCDBuff());
|
||||||
AddBuff(Target, new GargantuanEnrageBuff());
|
AddBuff(Target, new GargantuanEnrageBuff());
|
||||||
@ -2704,7 +2704,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
if (payload is HitPayload && payload.Target == Target)
|
if (payload is HitPayload && payload.Target == Target)
|
||||||
{
|
{
|
||||||
Player usr = (Target as Player);
|
Player usr = (Target as Player);
|
||||||
float dmg = (payload as HitPayload).TotalDamage * ScriptFormula(9) / usr.Followers.Values.Where(a => a == ActorSno._wd_zombiedog).Count();
|
float dmg = (payload as HitPayload).TotalDamage * ScriptFormula(9) / usr.Followers.Values.Count(a => a == ActorSno._wd_zombiedog);
|
||||||
(payload as HitPayload).TotalDamage *= 1 - ScriptFormula(9);
|
(payload as HitPayload).TotalDamage *= 1 - ScriptFormula(9);
|
||||||
//List<Actor> dogs = GetAlliesInRadius(Target.Position, 100f).Actors.Where(a => a.ActorSNO.Id == 51353).ToList();
|
//List<Actor> dogs = GetAlliesInRadius(Target.Position, 100f).Actors.Where(a => a.ActorSNO.Id == 51353).ToList();
|
||||||
foreach (var dog in GetAlliesInRadius(Target.Position, 100f).Actors.Where(a => a.SNO == ActorSno._wd_zombiedog))
|
foreach (var dog in GetAlliesInRadius(Target.Position, 100f).Actors.Where(a => a.SNO == ActorSno._wd_zombiedog))
|
||||||
@ -2738,7 +2738,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
if (payload is HitPayload && payload.Context.User == Target)
|
if (payload is HitPayload && payload.Context.User == Target)
|
||||||
{
|
{
|
||||||
Player master = (Target as ZombieDog).Master as Player;
|
Player master = (Target as ZombieDog).Master as Player;
|
||||||
float heal = (payload as HitPayload).TotalDamage * ScriptFormula(8) / (master.Followers.Values.Where(a => a == ActorSno._wd_zombiedog).Count() + 1);
|
float heal = (payload as HitPayload).TotalDamage * ScriptFormula(8) / (master.Followers.Values.Count(a => a == ActorSno._wd_zombiedog) + 1);
|
||||||
(payload as HitPayload).TotalDamage *= 1 - ScriptFormula(9);
|
(payload as HitPayload).TotalDamage *= 1 - ScriptFormula(9);
|
||||||
master.AddHP(heal);
|
master.AddHP(heal);
|
||||||
foreach (var dog in GetAlliesInRadius(Target.Position, 100f).Actors.Where(a => a.SNO == ActorSno._wd_zombiedog))
|
foreach (var dog in GetAlliesInRadius(Target.Position, 100f).Actors.Where(a => a.SNO == ActorSno._wd_zombiedog))
|
||||||
|
|||||||
@ -724,7 +724,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
|
|
||||||
Vector3D[] spawnPoints = PowerMath.GenerateSpreadPositions(TgtPosition, TgtPosition + new Vector3D(3f, 0, 0), 120, 3);
|
Vector3D[] spawnPoints = PowerMath.GenerateSpreadPositions(TgtPosition, TgtPosition + new Vector3D(3f, 0, 0), 120, 3);
|
||||||
|
|
||||||
for (int i = 0; i < spawnPoints.Count(); i++)
|
for (int i = 0; i < spawnPoints.Length; i++)
|
||||||
{
|
{
|
||||||
if (!User.World.CheckLocationForFlag(spawnPoints[i], DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
|
if (!User.World.CheckLocationForFlag(spawnPoints[i], DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
|
||||||
continue;
|
continue;
|
||||||
@ -801,7 +801,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
Actor curTarget = target;
|
Actor curTarget = target;
|
||||||
Actor nextTarget = null;
|
Actor nextTarget = null;
|
||||||
var c = 0;
|
var c = 0;
|
||||||
while (targets.Count() < 3)
|
while (targets.Count < 3)
|
||||||
{
|
{
|
||||||
nextTarget = GetEnemiesInRadius(curTarget.Position, 6f).Actors.FirstOrDefault(a => !targets.Contains(a));
|
nextTarget = GetEnemiesInRadius(curTarget.Position, 6f).Actors.FirstOrDefault(a => !targets.Contains(a));
|
||||||
if (nextTarget == null) break;
|
if (nextTarget == null) break;
|
||||||
@ -1980,7 +1980,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
|||||||
AddBuff(hitPayload.Target, new ShatterDebuff(User, ScriptFormula(14), WaitSeconds(2f)));
|
AddBuff(hitPayload.Target, new ShatterDebuff(User, ScriptFormula(14), WaitSeconds(2f)));
|
||||||
}
|
}
|
||||||
if (Rune_E > 0) //Deep Freeze
|
if (Rune_E > 0) //Deep Freeze
|
||||||
if (nova.Targets.Actors.Count() > ScriptFormula(13))
|
if (nova.Targets.Actors.Count > ScriptFormula(13))
|
||||||
if (!HasBuff<DeepFreezeChCBuff>(User))
|
if (!HasBuff<DeepFreezeChCBuff>(User))
|
||||||
AddBuff(User, new DeepFreezeChCBuff(ScriptFormula(18), WaitSeconds(ScriptFormula(19))));
|
AddBuff(User, new DeepFreezeChCBuff(ScriptFormula(18), WaitSeconds(ScriptFormula(19))));
|
||||||
};
|
};
|
||||||
|
|||||||
@ -141,7 +141,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
|||||||
float additionalCritChance = chcBonus;
|
float additionalCritChance = chcBonus;
|
||||||
|
|
||||||
if (user is Player && (user as Player).SkillSet.HasPassive(338859)) //Single Out
|
if (user is Player && (user as Player).SkillSet.HasPassive(338859)) //Single Out
|
||||||
if (target.GetMonstersInRange(20f).Where(m => m != target).Count() == 0)
|
if (target.GetMonstersInRange(20f).All(m => m == target))
|
||||||
additionalCritChance += 0.25f;
|
additionalCritChance += 0.25f;
|
||||||
|
|
||||||
//Wizard -> Spectral Blade -> Ice Blades
|
//Wizard -> Spectral Blade -> Ice Blades
|
||||||
|
|||||||
@ -256,7 +256,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
|
|||||||
|
|
||||||
var targets = Context.GetEnemiesInRadius(ChainCurrent.Position, ChainRadius);
|
var targets = Context.GetEnemiesInRadius(ChainCurrent.Position, ChainRadius);
|
||||||
targets.Actors.Remove(ChainCurrent);
|
targets.Actors.Remove(ChainCurrent);
|
||||||
if (targets.Actors.Count() == 0)
|
if (!targets.Actors.Any())
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
return;
|
return;
|
||||||
@ -266,7 +266,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
|
|||||||
nextProj.Position.Z += 5f;
|
nextProj.Position.Z += 5f;
|
||||||
|
|
||||||
nextProj.ChainCurrent = ChainCurrent;
|
nextProj.ChainCurrent = ChainCurrent;
|
||||||
nextProj.ChainNextPos = targets.Actors[PowerContext.Rand.Next(targets.Actors.Count())].Position;
|
nextProj.ChainNextPos = targets.Actors[PowerContext.Rand.Next(targets.Actors.Count)].Position;
|
||||||
|
|
||||||
nextProj.ChainTargetsRemain = ChainTargetsRemain;
|
nextProj.ChainTargetsRemain = ChainTargetsRemain;
|
||||||
nextProj.ChainIteration = ChainIteration + 1;
|
nextProj.ChainIteration = ChainIteration + 1;
|
||||||
|
|||||||
@ -56,7 +56,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents.Implementations
|
|||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
var rand_pos = ActorsVector3D[FastRandom.Instance.Next(ActorsVector3D.Count())];
|
var rand_pos = ActorsVector3D[FastRandom.Instance.Next(ActorsVector3D.Count)];
|
||||||
world.SpawnMonster(ActorSno._ghost_jail_prisoner, rand_pos);
|
world.SpawnMonster(ActorSno._ghost_jail_prisoner, rand_pos);
|
||||||
ActorsVector3D.Remove(rand_pos);
|
ActorsVector3D.Remove(rand_pos);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,7 +106,7 @@ namespace DiIiS_NA
|
|||||||
var cpuTime = proc.TotalProcessorTime;
|
var cpuTime = proc.TotalProcessorTime;
|
||||||
var text =
|
var text =
|
||||||
$"{name} | " +
|
$"{name} | " +
|
||||||
$"{PlayerManager.OnlinePlayers.Count()} onlines in {PlayerManager.OnlinePlayers.Count(s => s.InGameClient?.Player?.World != null)} worlds | " +
|
$"{PlayerManager.OnlinePlayers.Count} onlines in {PlayerManager.OnlinePlayers.Count(s => s.InGameClient?.Player?.World != null)} worlds | " +
|
||||||
$"Memory: {totalMemory:0.000} GB | " +
|
$"Memory: {totalMemory:0.000} GB | " +
|
||||||
$"CPU Time: {cpuTime.ToSmallText()} | " +
|
$"CPU Time: {cpuTime.ToSmallText()} | " +
|
||||||
$"Uptime: {uptime.ToSmallText()}";
|
$"Uptime: {uptime.ToSmallText()}";
|
||||||
|
|||||||
Loading…
Reference in New Issue
user.block.title