Translation update

This commit is contained in:
Lucca Faria Ferri 2023-01-21 18:05:13 -08:00
parent 36926364dc
commit 236d2f5f7f
115 changed files with 5450 additions and 5372 deletions

View File

@ -202,7 +202,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
DBGameAccount = client.Account.GameAccount.DBGameAccount,
AchievementId = achievementId,
Criteria = new byte[0],
IsHardcore = AchievementManager.IsHardcore(achievementId),
IsHardcore = IsHardcore(achievementId),
CompleteTime = (int)DateTime.Now.ToUnixTime()
};
DBSessions.SessionSave(achievement);
@ -222,7 +222,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
UpdateSnapshot(client, achievementId);
if (AchievementManager.IsHardcore(achievementId))
if (IsHardcore(achievementId))
{
if (achs.Where(a => a.CompleteTime != -1 && a.IsHardcore == true).Count() >= 30) //31 in total
{
@ -271,7 +271,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
Logger.Trace("GrantCriteria(): creating new ach data");
achievement.DBGameAccount = client.Account.GameAccount.DBGameAccount;
achievement.AchievementId = definition.ParentAchievementId;
achievement.IsHardcore = AchievementManager.IsHardcore(definition.ParentAchievementId);
achievement.IsHardcore = IsHardcore(definition.ParentAchievementId);
achievement.CompleteTime = -1;
achievement.Quantity = 0;
List<uint> crits = new List<uint>();
@ -387,7 +387,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
Logger.Trace("UpdateQuantity(): id {0}", achievementId);
if (client.Account.GameAccount.Achievements.Where(a => a.AchievementId == achievementId && a.Completion != -1).Count() > 0) return;
ulong mainCriteriaId = AchievementManager.GetMainCriteria(achievementId);
ulong mainCriteriaId = GetMainCriteria(achievementId);
var aa = client.Account.GameAccount.AchievementCriteria;
D3.Achievements.CriteriaUpdateRecord mainCriteria;
lock (client.Account.GameAccount.AchievementCriteria)
@ -420,7 +420,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
Logger.Trace("UpdateQuantity(): creating new ach data");
achievement.DBGameAccount = client.Account.GameAccount.DBGameAccount;
achievement.AchievementId = achievementId;
achievement.IsHardcore = AchievementManager.IsHardcore(achievementId);
achievement.IsHardcore = IsHardcore(achievementId);
achievement.CompleteTime = -1;
List<uint> crits = new List<uint>();
achievement.Criteria = SerializeBytes(crits);

View File

@ -31,18 +31,18 @@ namespace DiIiS_NA.GameServer.ClientSystem.Base
// Note that this method should only be called prior to encryption!
public int Receive(int start, int count)
{
return this.Socket.Receive(_recvBuffer, start, count, SocketFlags.None);
return Socket.Receive(_recvBuffer, start, count, SocketFlags.None);
}
// Wrapper for the Send method that will send the data either to the
// Socket (unecnrypted) or to the TLSStream (encrypted).
public int _Send(byte[] buffer, int start, int count, SocketFlags flags)
{
if (!this.IsOpen()) return 0;
if (!IsOpen()) return 0;
int bytes = 0;
try
{
bytes = this.Socket.Send(buffer, start, count, flags);
bytes = Socket.Send(buffer, start, count, flags);
}
catch
{
@ -79,8 +79,8 @@ namespace DiIiS_NA.GameServer.ClientSystem.Base
if (socket == null)
throw new ArgumentNullException("socket");
this.LastKeepAliveTick = DateTime.Now.ToUnixTime();
this.Socket = socket;
LastKeepAliveTick = DateTime.Now.ToUnixTime();
Socket = socket;
}
#region socket stuff
@ -122,10 +122,10 @@ using (var socketEventargs = new SocketAsyncEventArgs())
socketEventargs.SetBuffer(_recvBuffer, 0, BufferSize);
socketEventargs.Completed += (sender, args) => ReadCallback(args);
socketEventargs.SocketFlags = SocketFlags.None;
socketEventargs.RemoteEndPoint = this.Socket.RemoteEndPoint;
socketEventargs.RemoteEndPoint = Socket.RemoteEndPoint;
socketEventargs.UserToken = this;
if (!this.Socket.ReceiveAsync(socketEventargs))
if (!Socket.ReceiveAsync(socketEventargs))
ReadCallback(socketEventargs);
}
}
@ -153,7 +153,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
{
if (a.BytesTransferred > 0)
{
this.Server.OnDataReceived(new ConnectionDataEventArgs(connection, connection.RecvBuffer.Enumerate(0, a.BytesTransferred))); // Raise the DataReceived event.
Server.OnDataReceived(new ConnectionDataEventArgs(connection, connection.RecvBuffer.Enumerate(0, a.BytesTransferred))); // Raise the DataReceived event.
if (connection.IsOpen())
connection.AsyncRead();
@ -184,7 +184,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
public int Send(byte[] buffer)
{
if (buffer == null) throw new ArgumentNullException("buffer");
if (!this.IsOpen()) return 0;
if (!IsOpen()) return 0;
return Send(buffer, 0, buffer.Length, SocketFlags.None);
}
@ -197,7 +197,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
public int Send(byte[] buffer, SocketFlags flags)
{
if (buffer == null) throw new ArgumentNullException("buffer");
if (!this.IsOpen()) return 0;
if (!IsOpen()) return 0;
return Send(buffer, 0, buffer.Length, flags);
}
@ -211,7 +211,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
public int Send(byte[] buffer, int start, int count)
{
if (buffer == null) throw new ArgumentNullException("buffer");
if (!this.IsOpen()) return 0;
if (!IsOpen()) return 0;
return Send(buffer, start, count, SocketFlags.None);
}
@ -226,19 +226,19 @@ using (var socketEventargs = new SocketAsyncEventArgs())
public int Send(byte[] buffer, int start, int count, SocketFlags flags)
{
if (buffer == null) throw new ArgumentNullException("buffer");
if (!this.IsOpen()) return 0;
if (!IsOpen()) return 0;
var totalBytesSent = 0;
var bytesRemaining = buffer.Length;
try
{
if (this.Socket == null || this.Socket.Available < 0) throw new Exception("socket is null");
lock (this.socketLock)
if (Socket == null || Socket.Available < 0) throw new Exception("socket is null");
lock (socketLock)
{
while (bytesRemaining > 0 && this.IsOpen() && !_closing) // Ensure we send every byte.
while (bytesRemaining > 0 && IsOpen() && !_closing) // Ensure we send every byte.
{
int bytesSent = this._Send(buffer, totalBytesSent, bytesRemaining, flags);
int bytesSent = _Send(buffer, totalBytesSent, bytesRemaining, flags);
if (bytesSent == 0) break;
bytesRemaining -= bytesSent;
@ -248,11 +248,11 @@ using (var socketEventargs = new SocketAsyncEventArgs())
}
catch (SocketException)
{
this.Disconnect();
Disconnect();
}
catch (Exception e)
{
this.Disconnect();
Disconnect();
Logger.WarnException(e, "Send");
}
@ -267,7 +267,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
public int Send(IEnumerable<byte> data)
{
if (data == null) throw new ArgumentNullException("data");
if (!this.IsOpen()) return 0;
if (!IsOpen()) return 0;
return Send(data, SocketFlags.None);
}
@ -280,7 +280,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
public int Send(IEnumerable<byte> data, SocketFlags flags)
{
if (data == null) throw new ArgumentNullException("data");
if (!this.IsOpen()) return 0;
if (!IsOpen()) return 0;
var buffer = data.ToArray();
return Send(buffer, 0, buffer.Length, SocketFlags.None);
}
@ -297,14 +297,14 @@ using (var socketEventargs = new SocketAsyncEventArgs())
Task.Run(() => {
try
{
this.Server.OnClientDisconnect(new ConnectionEventArgs(this));
if (this.Socket != null)
Server.OnClientDisconnect(new ConnectionEventArgs(this));
if (Socket != null)
{
try
{
this.Socket.Shutdown(SocketShutdown.Both);
this.Socket.Close();
this.Socket = null;
Socket.Shutdown(SocketShutdown.Both);
Socket.Close();
Socket = null;
}
catch (Exception)
{
@ -324,7 +324,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
{
get
{
return (this.Client is BattleClient);
return (Client is BattleClient);
}
}
@ -333,7 +333,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
_closed = true;
}
public bool IsOpen() { return !_closed && this.Socket != null/* && (!this.IsMooNet || this.LastKeepAliveTick > (DateTime.Now.ToUnixTime() - 120U))*/; }
public bool IsOpen() { return !_closed && Socket != null/* && (!this.IsMooNet || this.LastKeepAliveTick > (DateTime.Now.ToUnixTime() - 120U))*/; }
public uint LastKeepAliveTick { get; set; }
/// <summary>

View File

@ -18,7 +18,7 @@ namespace DiIiS_NA.GameServer.ClientSystem.Base
public ConnectionDataEventArgs(IConnection connection, IEnumerable<byte> data)
: base(connection)
{
this.Data = data ?? new byte[0];
Data = data ?? new byte[0];
}
public override string ToString()

View File

@ -19,7 +19,7 @@ namespace DiIiS_NA.GameServer.ClientSystem.Base
{
if (connection == null)
throw new ArgumentNullException("connection");
this.Connection = connection;
Connection = connection;
}
public override string ToString()

View File

@ -41,11 +41,11 @@ namespace DiIiS_NA.GameServer.ClientSystem.Base
public virtual bool Listen(string bindIP, int port)
{
// Check if the server has been disposed.
if (_disposed) throw new ObjectDisposedException(this.GetType().Name, "Server has been disposed.");
if (_disposed) throw new ObjectDisposedException(GetType().Name, "Server has been disposed.");
// Check if the server is already listening.
if (IsListening) throw new InvalidOperationException("Server is already listening.");
this.Port = port;
Port = port;
Acceptor = new AsyncAcceptor();
if (!Acceptor.Start(bindIP, port))

View File

@ -48,11 +48,11 @@ namespace DiIiS_NA.GameServer.ClientSystem
{
get
{
return this._tickingEnabled;
return _tickingEnabled;
}
set
{
this._tickingEnabled = value;
_tickingEnabled = value;
//if (value == true)
//this.SendTick();
}
@ -64,8 +64,8 @@ namespace DiIiS_NA.GameServer.ClientSystem
public GameClient(IConnection connection)
{
this.TickingEnabled = false;
this.Connection = connection;
TickingEnabled = false;
Connection = connection;
_outgoingBuffer.WriteInt(32, 0);
}
@ -87,12 +87,12 @@ namespace DiIiS_NA.GameServer.ClientSystem
_incomingBuffer.AppendData(e.Data.ToArray());
while (this.Connection.IsOpen() && _incomingBuffer.IsPacketAvailable())
while (Connection.IsOpen() && _incomingBuffer.IsPacketAvailable())
{
int end = _incomingBuffer.Position;
end += _incomingBuffer.ReadInt(32) * 8;
while ((end - _incomingBuffer.Position) >= 9 && this.Connection.IsOpen())
while ((end - _incomingBuffer.Position) >= 9 && Connection.IsOpen())
{
var message = _incomingBuffer.ParseMessage();
//217
@ -106,7 +106,7 @@ namespace DiIiS_NA.GameServer.ClientSystem
if (message.Consumer != Consumers.None)
{
if (message.Consumer == Consumers.ClientManager) ClientManager.Instance.Consume(this, message); // Client should be greeted by ClientManager and sent initial game-setup messages.
else this.Game.Route(this, message);
else Game.Route(this, message);
}
else if (message is ISelfHandler) (message as ISelfHandler).Handle(this); // if message is able to handle itself, let it do so.
@ -143,9 +143,9 @@ namespace DiIiS_NA.GameServer.ClientSystem
public virtual void SendMessage(GameMessage message)
{
//System.Threading.Thread.Sleep(50);
lock (this._outgoingBuffer)
lock (_outgoingBuffer)
{
if (this.Game.TickCounter > this.LastReplicatedTick && this.TickingEnabled && !(message is GameTickMessage) /*&& !(message is EndOfTickMessage)*/ && !this.Player.BetweenWorlds)
if (Game.TickCounter > LastReplicatedTick && TickingEnabled && !(message is GameTickMessage) /*&& !(message is EndOfTickMessage)*/ && !Player.BetweenWorlds)
{
/*var endMessage = new EndOfTickMessage()
{
@ -156,8 +156,8 @@ namespace DiIiS_NA.GameServer.ClientSystem
_outgoingBuffer.EncodeMessage(endMessage);
Connection.Send(_outgoingBuffer.GetPacketAndReset());*/
this.LastReplicatedTick = this.Game.TickCounter;
var tickMessage = new GameTickMessage(this.Game.TickCounter);
LastReplicatedTick = Game.TickCounter;
var tickMessage = new GameTickMessage(Game.TickCounter);
Logger.LogOutgoingPacket(tickMessage);
_outgoingBuffer.EncodeMessage(tickMessage);
Connection.Send(_outgoingBuffer.GetPacketAndReset());
@ -168,7 +168,7 @@ namespace DiIiS_NA.GameServer.ClientSystem
Logger.LogOutgoingPacket(message);
_outgoingBuffer.EncodeMessage(message); // change ConsoleTarget's level to Level.Dump in program.cs if u want to see messages on console.
if (this.TickingEnabled)
if (TickingEnabled)
{
var data = _outgoingBuffer.GetPacketAndReset();
Connection.Send(data);
@ -190,19 +190,19 @@ namespace DiIiS_NA.GameServer.ClientSystem
public void SendTick()
{
//if (_outgoingBuffer.Length <= 32) return;
lock (this._outgoingBuffer)
lock (_outgoingBuffer)
{
if (!dataSent) return;
if (this.TickingEnabled && this.Game.TickCounter > this.LastReplicatedTick)
if (TickingEnabled && Game.TickCounter > LastReplicatedTick)
{
/*this.SendMessage(new EndOfTickMessage()
{
Field0 = this.Game.TickCounter,
Field1 = this.LastReplicatedTick
}); // send the tick end.*/
this.SendMessage(new GameTickMessage(this.Game.TickCounter)); // send the tick.
this.LastReplicatedTick = this.Game.TickCounter;
SendMessage(new GameTickMessage(Game.TickCounter)); // send the tick.
LastReplicatedTick = Game.TickCounter;
//this.SendMessage(new GameTickMessage(0)); //before client enters game causes freeze with PvP scoreboard
/*this.SendMessage(new EndOfTickMessage()
{
@ -210,14 +210,14 @@ namespace DiIiS_NA.GameServer.ClientSystem
Field1 = 0
}); // send the tick end*/
dataSent = false;
this.FlushOutgoingBuffer();
FlushOutgoingBuffer();
}
}
}
public virtual void FlushOutgoingBuffer()
{
lock (this._outgoingBuffer)
lock (_outgoingBuffer)
{
if (_outgoingBuffer.Length <= 32) return;

View File

@ -28,9 +28,9 @@ namespace DiIiS_NA.GameServer.ClientSystem
public Bot DiscordBot { get; set; }
public GameServer()
{
this.OnConnect += ClientManager.Instance.OnConnect;
this.OnDisconnect += ClientManager.Instance.OnDisconnect;
this.DataReceived += GameServer_DataReceived;
OnConnect += ClientManager.Instance.OnConnect;
OnDisconnect += ClientManager.Instance.OnDisconnect;
DataReceived += GameServer_DataReceived;
}
void GameServer_DataReceived(object sender, ConnectionDataEventArgs e)
@ -43,7 +43,7 @@ namespace DiIiS_NA.GameServer.ClientSystem
{
int Port = 2001;
if (!this.Listen(Program.GAMESERVERIP, Port)) return;
if (!Listen(Program.GAMESERVERIP, Port)) return;
Logger.Info("Game Server Started - {0}:{1}...", Program.GAMESERVERIP, Port);
}
}

View File

@ -33,9 +33,9 @@ namespace DiIiS_NA.GameServer.CommandManager
public CommandGroupAttribute(string name, string help, Account.UserLevels minUserLevel = Account.UserLevels.Admin)
{
this.Name = name.ToLower();
this.Help = help;
this.MinUserLevel = minUserLevel;
Name = name.ToLower();
Help = help;
MinUserLevel = minUserLevel;
}
}
@ -59,9 +59,9 @@ namespace DiIiS_NA.GameServer.CommandManager
public CommandAttribute(string command, string help, Account.UserLevels minUserLevel = Account.UserLevels.User)
{
this.Name = command.ToLower();
this.Help = help;
this.MinUserLevel = minUserLevel;
Name = command.ToLower();
Help = help;
MinUserLevel = minUserLevel;
}
}

View File

@ -28,14 +28,14 @@ namespace DiIiS_NA.GameServer.CommandManager
public void Register(CommandGroupAttribute attributes)
{
this.Attributes = attributes;
this.RegisterDefaultCommand();
this.RegisterCommands();
Attributes = attributes;
RegisterDefaultCommand();
RegisterCommands();
}
private void RegisterCommands()
{
foreach (var method in this.GetType().GetMethods())
foreach (var method in GetType().GetMethods())
{
object[] attributes = method.GetCustomAttributes(typeof(CommandAttribute), true);
if (attributes.Length == 0) continue;
@ -43,8 +43,8 @@ namespace DiIiS_NA.GameServer.CommandManager
var attribute = (CommandAttribute)attributes[0];
if (attribute is DefaultCommand) continue;
if (!this._commands.ContainsKey(attribute))
this._commands.Add(attribute, method);
if (!_commands.ContainsKey(attribute))
_commands.Add(attribute, method);
else
Logger.Warn("There exists an already registered command '{0}'.", attribute.Name);
}
@ -52,38 +52,38 @@ namespace DiIiS_NA.GameServer.CommandManager
private void RegisterDefaultCommand()
{
foreach (var method in this.GetType().GetMethods())
foreach (var method in GetType().GetMethods())
{
object[] attributes = method.GetCustomAttributes(typeof(DefaultCommand), true);
if (attributes.Length == 0) continue;
if (method.Name.ToLower() == "fallback") continue;
this._commands.Add(new DefaultCommand(this.Attributes.MinUserLevel), method);
_commands.Add(new DefaultCommand(Attributes.MinUserLevel), method);
return;
}
// set the fallback command if we couldn't find a defined DefaultCommand.
this._commands.Add(new DefaultCommand(this.Attributes.MinUserLevel), this.GetType().GetMethod("Fallback"));
_commands.Add(new DefaultCommand(Attributes.MinUserLevel), GetType().GetMethod("Fallback"));
}
public virtual string Handle(string parameters, BattleClient invokerClient = null)
{
// check if the user has enough privileges to access command group.
// check if the user has enough privileges to invoke the command.
if (invokerClient != null && this.Attributes.MinUserLevel > invokerClient.Account.UserLevel)
if (invokerClient != null && Attributes.MinUserLevel > invokerClient.Account.UserLevel)
return "You don't have enough privileges to invoke that command.";
string[] @params = null;
CommandAttribute target = null;
if (parameters == string.Empty)
target = this.GetDefaultSubcommand();
target = GetDefaultSubcommand();
else
{
@params = parameters.Split(' ');
target = this.GetSubcommand(@params[0]) ?? this.GetDefaultSubcommand();
target = GetSubcommand(@params[0]) ?? GetDefaultSubcommand();
if (target != this.GetDefaultSubcommand())
if (target != GetDefaultSubcommand())
@params = @params.Skip(1).ToArray();
}
@ -91,12 +91,12 @@ namespace DiIiS_NA.GameServer.CommandManager
if (invokerClient != null && target.MinUserLevel > invokerClient.Account.UserLevel)
return "You don't have enough privileges to invoke that command.";
return (string)this._commands[target].Invoke(this, new object[] { @params, invokerClient });
return (string)_commands[target].Invoke(this, new object[] { @params, invokerClient });
}
public string GetHelp(string command)
{
foreach (var pair in this._commands)
foreach (var pair in _commands)
{
if (command != pair.Key.Name) continue;
return pair.Key.Help;
@ -109,7 +109,7 @@ namespace DiIiS_NA.GameServer.CommandManager
public virtual string Fallback(string[] @params = null, BattleClient invokerClient = null)
{
var output = "Available subcommands: ";
foreach (var pair in this._commands)
foreach (var pair in _commands)
{
if (pair.Key.Name.Trim() == string.Empty) continue; // skip fallback command.
if (invokerClient != null && pair.Key.MinUserLevel > invokerClient.Account.UserLevel) continue;
@ -121,12 +121,12 @@ namespace DiIiS_NA.GameServer.CommandManager
protected CommandAttribute GetDefaultSubcommand()
{
return this._commands.Keys.First();
return _commands.Keys.First();
}
protected CommandAttribute GetSubcommand(string name)
{
return this._commands.Keys.FirstOrDefault(command => command.Name == name);
return _commands.Keys.FirstOrDefault(command => command.Name == name);
}
}
}

View File

@ -171,7 +171,7 @@ namespace DiIiS_NA.GameServer.CommandManager
public override string Handle(string parameters, BattleClient invokerClient = null)
{
if (parameters == string.Empty)
return this.Fallback();
return Fallback();
string output = string.Empty;
bool found = false;

View File

@ -13,7 +13,7 @@ namespace DiIiS_NA.GameServer.CommandManager
{
public sealed class Config : DiIiS_NA.Core.Config.Config
{
public char CommandPrefix { get { return this.GetString("CommandPrefix", "!")[0]; } set { this.Set("CommandPrefix", value); } }
public char CommandPrefix { get { return GetString("CommandPrefix", "!")[0]; } set { Set("CommandPrefix", value); } }
private static readonly Config _instance = new Config();
public static Config Instance { get { return _instance; } }

View File

@ -347,7 +347,7 @@ namespace DiIiS_NA.GameServer.CommandManager
if (@params == null)
return this.Fallback();
return Fallback();
name = @params[0];
@ -487,7 +487,7 @@ namespace DiIiS_NA.GameServer.CommandManager
if (invokerClient.InGameClient.Player.World.Game.SideQuestProgress.GlobalQuestTriggers.ContainsKey(levelArea)) //EnterLevelArea
{
var trigger = invokerClient.InGameClient.Player.World.Game.SideQuestProgress.GlobalQuestTriggers[levelArea];
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.EnterLevelArea)
if (trigger.triggerType == QuestStepObjectiveType.EnterLevelArea)
{
try
{
@ -628,7 +628,7 @@ namespace DiIiS_NA.GameServer.CommandManager
public string Event(string[] @params, BattleClient invokerClient)
{
if (@params == null)
return this.Fallback();
return Fallback();
if (@params.Count() != 1)
return "Invalid arguments. Type 'help text public' to get help.";
@ -650,7 +650,7 @@ namespace DiIiS_NA.GameServer.CommandManager
public string Timer(string[] @params, BattleClient invokerClient)
{
if (@params == null)
return this.Fallback();
return Fallback();
if (@params.Count() != 2)
return "Invalid arguments. Type 'help text public' to get help.";
@ -671,7 +671,7 @@ namespace DiIiS_NA.GameServer.CommandManager
public string Search(string[] @params, BattleClient invokerClient)
{
if (@params == null)
return this.Fallback();
return Fallback();
var matches = new List<Asset>();
@ -817,7 +817,7 @@ namespace DiIiS_NA.GameServer.CommandManager
}
return matches.Aggregate(matches.Count >= 1 ? "World Matches:\n" : "No match found.",
(current, match) => current + string.Format("[{0}] {1} - {2}\n", match.SNOId.ToString("D6"), match.Name, (match.Data as DiIiS_NA.Core.MPQ.FileFormats.World).DynamicWorld));
(current, match) => current + string.Format("[{0}] {1} - {2}\n", match.SNOId.ToString("D6"), match.Name, (match.Data as World).DynamicWorld));
}
[Command("qr", "Show QuestRange of an actor.\nUsage: lookup qr <id>")]

View File

@ -13,27 +13,96 @@ namespace DiIiS_NA.GameServer
{
public sealed class Config : DiIiS_NA.Core.Config.Config
{
public bool Enabled { get { return this.GetBoolean("Enabled", true); } set { this.Set("Enabled", value); } }
public string BindIP { get { return this.GetString("BindIP", "127.0.0.1"); } set { this.Set("BindIP", value); } }
public int WebPort { get { return this.GetInt("WebPort", 9001); } set { this.Set("WebPort", value); } }
public int Port { get { return this.GetInt("Port", 1345); } set { this.Set("Port", value); } }
public string BindIPv6 { get { return this.GetString("BindIPv6", "::1"); } set { this.Set("BindIPv6", value); } }
public bool DRLGemu { get { return this.GetBoolean("DRLGemu", true); } set { this.Set("DRLGemu", value); } }
public bool CoreActive { get { return this.GetBoolean("CoreActive", true); } set { this.Set("CoreActive", value); } }
public bool Enabled
{
get => GetBoolean("Enabled", true);
set => Set("Enabled", value);
}
public string BindIP
{
get => GetString("BindIP", "127.0.0.1");
set => Set("BindIP", value);
}
public int WebPort
{
get => GetInt("WebPort", 9001);
set => Set("WebPort", value);
}
public int Port
{
get => GetInt("Port", 1345);
set => Set("Port", value);
}
public string BindIPv6
{
get => GetString("BindIPv6", "::1");
set => Set("BindIPv6", value);
}
public bool DRLGemu
{
get => GetBoolean("DRLGemu", true);
set => Set("DRLGemu", value);
}
public bool CoreActive
{
get => GetBoolean("CoreActive", true);
set => Set("CoreActive", value);
}
//Modding of Game-Server
public float RateEXP { get { return this.GetFloat("RateExp", 1); } set { this.Set("RateExp", value); } }
public float RateMoney { get { return this.GetFloat("RateMoney", 1); } set { this.Set("RateMoney", value); } }
public float RateDrop { get { return this.GetFloat("RateDrop", 1); } set { this.Set("RateDrop", value); } }
public float RateChangeDrop { get { return this.GetFloat("RateChangeDrop", 1); } set { this.Set("RateChangeDrop", value); } }
public float RateMonsterHP { get { return this.GetFloat("RateMonsterHP", 1); } set { this.Set("RateMonsterHP", value); } }
public float RateMonsterDMG { get { return this.GetFloat("RateMonsterHP", 1); } set { this.Set("RateMonsterHP", value); } }
public float RateEXP
{
get => GetFloat("RateExp", 1);
set => Set("RateExp", value);
}
public float RateMoney
{
get => GetFloat("RateMoney", 1);
set => Set("RateMoney", value);
}
public float RateDrop
{
get => GetFloat("RateDrop", 1);
set => Set("RateDrop", value);
}
public float RateChangeDrop
{
get => GetFloat("RateChangeDrop", 1);
set => Set("RateChangeDrop", value);
}
public float RateMonsterHP
{
get => GetFloat("RateMonsterHP", 1);
set => Set("RateMonsterHP", value);
}
public float RateMonsterDMG
{
get => GetFloat("RateMonsterHP", 1);
set => Set("RateMonsterHP", value);
}
public bool IWServer { get { return this.GetBoolean("IWServer", true); } set { this.Set("IWServer", value); } }
public bool IWServer
{
get => GetBoolean("IWServer", true);
set => Set("IWServer", value);
}
private static readonly Config _instance = new Config();
public static Config Instance { get { return _instance; } }
private Config() : base("Game-Server") { }
public static Config Instance { get; } = new();
private Config() : base("Game-Server")
{
}
}
}

View File

@ -45,10 +45,10 @@ namespace DiIiS_NA.GameServer.Core
public InventoryGrid(Actor owner, int rows, int columns, int slot = 0)
{
this._backpack = new uint[rows, columns];
this._owner = owner;
this.Items = new Dictionary<uint, Item>();
this.EquipmentSlot = slot;
_backpack = new uint[rows, columns];
_owner = owner;
Items = new Dictionary<uint, Item>();
EquipmentSlot = slot;
}
public void ResizeGrid(int rows, int columns)
@ -63,7 +63,7 @@ namespace DiIiS_NA.GameServer.Core
Items.Clear();
int r = Rows;
int c = Columns;
this._backpack = new uint[r, c];
_backpack = new uint[r, c];
}
// This should be in the database#
@ -165,13 +165,13 @@ namespace DiIiS_NA.GameServer.Core
}
}
foreach (var plr in this._owner.World.Players.Values)
foreach (var plr in _owner.World.Players.Values)
item.Unreveal(plr);
}
public bool HaveEnough(int GBid, int count)
{
List<Item> baseItems = this.Items.Values.Where(i => i.GBHandle.GBID == GBid).ToList();
List<Item> baseItems = Items.Values.Where(i => i.GBHandle.GBID == GBid).ToList();
int have = 0;
foreach (var itm in baseItems)
have += itm.Attributes[GameAttribute.ItemStackQuantityLo];
@ -183,7 +183,7 @@ namespace DiIiS_NA.GameServer.Core
public int TotalItemCount(int GBid)
{
List<Item> baseItems = this.Items.Values.Where(i => i.GBHandle.GBID == GBid).ToList();
List<Item> baseItems = Items.Values.Where(i => i.GBHandle.GBID == GBid).ToList();
int have = 0;
foreach (var itm in baseItems)
have += itm.Attributes[GameAttribute.ItemStackQuantityLo];
@ -193,7 +193,7 @@ namespace DiIiS_NA.GameServer.Core
public void GrabSomeItems(int GBid, int count) //only for stackable!
{
List<Item> baseItems = this.Items.Values.Where(i => i.GBHandle.GBID == GBid).ToList();
List<Item> baseItems = Items.Values.Where(i => i.GBHandle.GBID == GBid).ToList();
int estimate = count;
List<Item> consumed = new List<Item>();
foreach (var itm in baseItems)
@ -211,7 +211,7 @@ namespace DiIiS_NA.GameServer.Core
}
foreach (var itm in consumed)
{
this.RemoveItem(itm);
RemoveItem(itm);
itm.Unreveal(itm.Owner as Player);
//itm.Destroy();
}
@ -267,7 +267,7 @@ namespace DiIiS_NA.GameServer.Core
if (item.IsStackable() && _owner is Player)
{
// Find items of same type (GBID) and try to add it to one of them
List<Item> baseItems = this.Items.Values.Where(i => i.GBHandle.GBID == item.GBHandle.GBID).ToList();
List<Item> baseItems = Items.Values.Where(i => i.GBHandle.GBID == item.GBHandle.GBID).ToList();
foreach (Item baseItem in baseItems)
{
if (baseItem.Attributes[GameAttribute.ItemStackQuantityLo] + item.Attributes[GameAttribute.ItemStackQuantityLo] <= baseItem.ItemDefinition.MaxStackSize)
@ -361,7 +361,7 @@ namespace DiIiS_NA.GameServer.Core
{
if (GetItemInventorySize(item).Height > 1)
{
if (this.EquipmentSlot == 0 && row > 4) return false;
if (EquipmentSlot == 0 && row > 4) return false;
bool a = (_backpack[row, column] == 0 || _backpack[row, column] == item.GlobalID);
bool b = (_backpack[row + 1, column] == 0 || _backpack[row + 1, column] == item.GlobalID);
if (!((_backpack[row, column] == 0 || _backpack[row, column] == item.GlobalID) && (_backpack[row + 1, column] == 0 || _backpack[row + 1, column] == item.GlobalID)))
@ -410,7 +410,7 @@ namespace DiIiS_NA.GameServer.Core
public Item GetItem(int row, int column)
{
return this.GetItem(_backpack[row, column]);
return GetItem(_backpack[row, column]);
}
public bool Reveal(Player player)
@ -445,8 +445,8 @@ namespace DiIiS_NA.GameServer.Core
public Item GetItemByDynId(Player plr, uint dynId)
{
if (this.Items.Values.Where(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId).Count() > 0)
return this.Items.Values.Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
if (Items.Values.Where(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId).Count() > 0)
return Items.Values.Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
else
return null;
}

View File

@ -36,8 +36,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Collision
/// <param name="stream">The MPQFileStream to read from.</param>
public AABB(MpqFileStream stream)
{
this.Min = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
this.Max = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
Min = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
Max = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
}
/// <summary>
@ -64,8 +64,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Collision
public bool IsWithin(Vector3D v)
{
if (v >= this.Min &&
v <= this.Max)
if (v >= Min &&
v <= Max)
{
return true;
}
@ -75,13 +75,13 @@ namespace DiIiS_NA.GameServer.Core.Types.Collision
public bool Intersects(AABB other)
{
if (// Max < o.Min
this.Max.X < other.Min.X ||
this.Max.Y < other.Min.Y ||
this.Max.Z < other.Min.Z ||
Max.X < other.Min.X ||
Max.Y < other.Min.Y ||
Max.Z < other.Min.Z ||
// Min > o.Max
this.Min.X > other.Max.X ||
this.Min.Y > other.Max.Y ||
this.Min.Z > other.Max.Z)
Min.X > other.Max.X ||
Min.Y > other.Max.Y ||
Min.Z > other.Max.Z)
{
return false;
}
@ -102,7 +102,7 @@ namespace DiIiS_NA.GameServer.Core.Types.Collision
public override string ToString()
{
return string.Format("AABB: min:{0} max:{1}", this.Min, this.Max);
return string.Format("AABB: min:{0} max:{1}", Min, Max);
}
}
}

View File

@ -22,8 +22,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public Quaternion(Vector3D V, float inW)
{
this.Vector3D = V;
this.W = inW;
Vector3D = V;
W = inW;
}
/// <summary>
/// Creates an quaternion that rotates along the Z-axis by the specified "facing" angle.
@ -45,8 +45,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
/// <param name="stream">The MPQFileStream to read from.</param>
public Quaternion(MpqFileStream stream)
{
this.Vector3D = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
this.W = stream.ReadValueF32();
Vector3D = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
W = stream.ReadValueF32();
}
/// <summary>

View File

@ -33,8 +33,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public Vector2D(int x, int y)
{
this.X = x;
this.Y = y;
X = x;
Y = y;
}
/// <summary>

View File

@ -36,25 +36,25 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public Vector2F(float x, float y)
{
this.X = x;
this.Y = y;
X = x;
Y = y;
}
public Vector2F(float value)
{
this.X = this.Y = value;
X = Y = value;
}
public override string ToString()
{
CultureInfo currentCulture = CultureInfo.CurrentCulture;
return string.Format(currentCulture, "{{X:{0} Y:{1}}}",
new object[] { this.X.ToString(currentCulture), this.Y.ToString(currentCulture) });
new object[] { X.ToString(currentCulture), Y.ToString(currentCulture) });
}
public bool Equals(Vector2F other)
{
return ((this.X == other.X) && (this.Y == other.Y));
return ((X == other.X) && (Y == other.Y));
}
public override bool Equals(object obj)
@ -62,25 +62,25 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
bool flag = false;
if (obj is Vector2F)
{
flag = this.Equals((Vector2F)obj);
flag = Equals((Vector2F)obj);
}
return flag;
}
public override int GetHashCode()
{
return (this.X.GetHashCode() + this.Y.GetHashCode());
return (X.GetHashCode() + Y.GetHashCode());
}
public float Length()
{
float num = (this.X * this.X) + (this.Y * this.Y);
float num = (X * X) + (Y * Y);
return (float)System.Math.Sqrt((double)num);
}
public float LengthSquared()
{
return ((this.X * this.X) + (this.Y * this.Y));
return ((X * X) + (Y * Y));
}
public static float Distance(Vector2F value1, Vector2F value2)
@ -125,10 +125,10 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public void Normalize()
{
float num2 = (this.X * this.X) + (this.Y * this.Y);
float num2 = (X * X) + (Y * Y);
float num = 1f / ((float)System.Math.Sqrt((double)num2));
this.X *= num;
this.Y *= num;
X *= num;
Y *= num;
}
public static Vector2F Normalize(Vector2F value)
@ -166,7 +166,7 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
/// <returns></returns>
public float Rotation()
{
return Angle(Vector2F.UnitY) > Angle(-Vector2F.UnitY) ? -Angle(Vector2F.UnitX) : Angle(Vector2F.UnitX);
return Angle(UnitY) > Angle(-UnitY) ? -Angle(UnitX) : Angle(UnitX);
}

View File

@ -24,16 +24,16 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public Vector3D()
{
this.X = 0;
this.Y = 0;
this.Z = 0;
X = 0;
Y = 0;
Z = 0;
}
public Vector3D(Vector3D vector)
{
this.X = vector.X;
this.Y = vector.Y;
this.Z = vector.Z;
X = vector.X;
Y = vector.Y;
Z = vector.Z;
}
public Vector3D(float x, float y, float z)
@ -97,9 +97,9 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public void Set(float x, float y, float z)
{
this.X = x;
this.Y = y;
this.Z = z;
X = x;
Y = y;
Z = z;
}
/// <summary>
@ -118,8 +118,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public static bool operator ==(Vector3D a, Vector3D b)
{
if (object.ReferenceEquals(null, a))
return object.ReferenceEquals(null, b);
if (ReferenceEquals(null, a))
return ReferenceEquals(null, b);
return a.Equals(b);
}
@ -130,8 +130,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public static bool operator >(Vector3D a, Vector3D b)
{
if (object.ReferenceEquals(null, a))
return !object.ReferenceEquals(null, b);
if (ReferenceEquals(null, a))
return !ReferenceEquals(null, b);
return a.X > b.X
&& a.Y > b.Y
&& a.Z > b.Z;
@ -154,8 +154,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public static bool operator >=(Vector3D a, Vector3D b)
{
if (object.ReferenceEquals(null, a))
return object.ReferenceEquals(null, b);
if (ReferenceEquals(null, a))
return ReferenceEquals(null, b);
return a.X >= b.X
&& a.Y >= b.Y
&& a.Z >= b.Z;
@ -163,8 +163,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public static bool operator <=(Vector3D a, Vector3D b)
{
if (object.ReferenceEquals(null, a))
return object.ReferenceEquals(null, b);
if (ReferenceEquals(null, a))
return ReferenceEquals(null, b);
return a.X <= b.X
&& a.Y <= b.Y
&& a.Z <= b.Z;
@ -172,14 +172,14 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public override bool Equals(object o)
{
if (object.ReferenceEquals(this, o))
if (ReferenceEquals(this, o))
return true;
var v = o as Vector3D;
if (v != null)
{
return this.X == v.X
&& this.Y == v.Y
&& this.Z == v.Z;
return X == v.X
&& Y == v.Y
&& Z == v.Z;
}
return false;
}

View File

@ -22,8 +22,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Misc
/// </summary>
public Circle(Vector2F position, float radius)
{
this.Center = position;
this.Radius = radius;
Center = position;
Radius = radius;
}
/// <summary>
@ -40,31 +40,31 @@ namespace DiIiS_NA.GameServer.Core.Types.Misc
public bool Intersects(Rectangle rectangle)
{
// Find the closest point to the circle within the rectangle
float closestX = Clamp(this.Center.X, (float)rectangle.Left, (float)rectangle.Right);
float closestY = Clamp(this.Center.Y, (float)rectangle.Top, (float)rectangle.Bottom);
float closestX = Clamp(Center.X, (float)rectangle.Left, (float)rectangle.Right);
float closestY = Clamp(Center.Y, (float)rectangle.Top, (float)rectangle.Bottom);
// Calculate the distance between the circle's center and this closest point
float distanceX = this.Center.X - closestX;
float distanceY = this.Center.Y - closestY;
float distanceX = Center.X - closestX;
float distanceY = Center.Y - closestY;
// If the distance is less than the circle's radius, an intersection occurs
float distanceSquared = (distanceX * distanceX) + (distanceY * distanceY);
return distanceSquared < (this.Radius * this.Radius);
return distanceSquared < (Radius * Radius);
}
public bool Intersects(RectangleF rectangle)
{
// Find the closest point to the circle within the rectangle
float closestX = Clamp(this.Center.X, (float)rectangle.Left, (float)rectangle.Right);
float closestY = Clamp(this.Center.Y, (float)rectangle.Top, (float)rectangle.Bottom);
float closestX = Clamp(Center.X, (float)rectangle.Left, (float)rectangle.Right);
float closestY = Clamp(Center.Y, (float)rectangle.Top, (float)rectangle.Bottom);
// Calculate the distance between the circle's center and this closest point
float distanceX = this.Center.X - closestX;
float distanceY = this.Center.Y - closestY;
float distanceX = Center.X - closestX;
float distanceY = Center.Y - closestY;
// If the distance is less than the circle's radius, an intersection occurs
float distanceSquared = (distanceX * distanceX) + (distanceY * distanceY);
return distanceSquared < (this.Radius * this.Radius);
return distanceSquared < (Radius * Radius);
}
public static float Clamp(float value, float min, float max)

View File

@ -43,9 +43,9 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
/// <param name="maximumObjectsPerLeaf">Maximum number of objects per left before it's forced to split into sub-quadrans.</param>
public QuadTree(Size minimumLeafSize, int maximumObjectsPerLeaf)
{
this.RootNode = null;
this.MinimumLeafSize = minimumLeafSize;
this.MaximumObjectsPerLeaf = maximumObjectsPerLeaf;
RootNode = null;
MinimumLeafSize = minimumLeafSize;
MaximumObjectsPerLeaf = maximumObjectsPerLeaf;
}
/// <summary>
@ -65,18 +65,18 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
@object.Bounds.Y + @object.Bounds.Height / 2);
var rootOrigin = new PointF(center.X - rootSize.Width / 2, center.Y - rootSize.Height / 2);
this.RootNode = new QuadNode(new RectangleF(rootOrigin, rootSize));
RootNode = new QuadNode(new RectangleF(rootOrigin, rootSize));
}
int cycle = 0;
while (!RootNode.Bounds.Contains(@object.Bounds))
// if root-node's bounds does not contain object, expand the root.
{
this.ExpandRoot(@object.Bounds);
ExpandRoot(@object.Bounds);
cycle++;
if (cycle > 5) break;
}
this.InsertNodeObject(RootNode, @object); // insert the object to rootNode.
InsertNodeObject(RootNode, @object); // insert the object to rootNode.
}
/// <summary>
@ -88,16 +88,16 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
public List<T> Query<T>(RectangleF bounds, bool includeHierarchy = false) where T : WorldObject
{
var results = new List<T>();
if (this.RootNode != null)
this.Query(bounds, RootNode, results, includeHierarchy);
if (RootNode != null)
Query(bounds, RootNode, results, includeHierarchy);
return results;
}
public List<T> Query<T>(Circle proximity, bool includeHierarchy = false) where T : WorldObject
{
var results = new List<T>();
if (this.RootNode != null)
this.Query(proximity, RootNode, results, includeHierarchy);
if (RootNode != null)
Query(proximity, RootNode, results, includeHierarchy);
return results;
}
@ -128,7 +128,7 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
foreach (QuadNode childNode in node.Nodes) // query child-nodes too.
{
this.Query(bounds, childNode, results);
Query(bounds, childNode, results);
}
}
@ -152,7 +152,7 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
foreach (QuadNode childNode in node.Nodes) // query child-nodes too.
{
this.Query(proximity, childNode, results);
Query(proximity, childNode, results);
}
}
@ -179,9 +179,9 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
var newRootBounds = new RectangleF((float)newX, (float)newY, RootNode.Bounds.Width * 2f, RootNode.Bounds.Height * 2f);
var newRoot = new QuadNode(newRootBounds);
this.SetupChildNodes(newRoot);
SetupChildNodes(newRoot);
newRoot[rootDirection] = RootNode;
this.RootNode = newRoot;
RootNode = newRoot;
}
/// <summary>
@ -197,9 +197,9 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
recursionLimit++;
if (recursionLimit >= 20) return;
// If there's no child-nodes and when new object is insertedi if node's object count will be bigger then MaximumObjectsPerLeaf, force a split.
if (!node.HasChildNodes() && node.ContainedObjects.Count + 1 > this.MaximumObjectsPerLeaf)
if (!node.HasChildNodes() && node.ContainedObjects.Count + 1 > MaximumObjectsPerLeaf)
{
this.SetupChildNodes(node);
SetupChildNodes(node);
var childObjects = new List<WorldObject>(node.ContainedObjects.Values); // node's child objects.
var childrenToRelocate = new List<WorldObject>(); // child object to be relocated.
@ -220,8 +220,8 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
foreach (WorldObject childObject in childrenToRelocate) // relocate the child objects we marked.
{
this.RemoveObjectFromNode(childObject);
this.InsertNodeObject(node, childObject, recursionLimit);
RemoveObjectFromNode(childObject);
InsertNodeObject(node, childObject, recursionLimit);
}
}
@ -234,11 +234,11 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
if (!childNode.Bounds.Contains(@object.Bounds))
continue;
this.InsertNodeObject(childNode, @object, recursionLimit);
InsertNodeObject(childNode, @object, recursionLimit);
return;
}
this.AddObjectToNode(node, @object); // add the object to current node.
AddObjectToNode(node, @object); // add the object to current node.
}
/// <summary>
@ -284,12 +284,12 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
private void ObjectPositionChanged(object sender, EventArgs e)
{
var @object = sender as WorldObject;
if (@object == null || !this._objectToNodeLookup.ContainsKey(@object)) return;
if (@object == null || !_objectToNodeLookup.ContainsKey(@object)) return;
QuadNode node = this._objectToNodeLookup[@object];
QuadNode node = _objectToNodeLookup[@object];
if (node.Bounds.Contains(@object.Bounds) && !node.HasChildNodes()) return;
this.RemoveObjectFromNode(@object);
RemoveObjectFromNode(@object);
Insert(@object);
if (node.Parent != null)
CheckChildNodes(node.Parent);
@ -301,7 +301,7 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
/// <param name="node">The node.</param>
private void SetupChildNodes(QuadNode node)
{
if (this.MinimumLeafSize.Width > node.Bounds.Width / 2 || this.MinimumLeafSize.Height > node.Bounds.Height / 2)
if (MinimumLeafSize.Width > node.Bounds.Width / 2 || MinimumLeafSize.Height > node.Bounds.Height / 2)
// make sure we obey MinimumLeafSize.
return;
@ -397,7 +397,7 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
childNode.Parent = null;
}
this.RootNode = nodeWithObjects;
RootNode = nodeWithObjects;
}
}
}

View File

@ -182,9 +182,9 @@ namespace DiIiS_NA.GameServer.Core.Types.SNO
public override string ToString()
{
if (IsValid)
return string.Format("[{0}] {1} - {2}", this.Group, this.Id, this.Name);
return string.Format("[{0}] {1} - {2}", Group, Id, Name);
else
return string.Format("[{0}] {1} - Invalid handle", _group, this.Id);
return string.Format("[{0}] {1} - Invalid handle", _group, Id);
}
}
}

View File

@ -91,7 +91,7 @@ namespace DiIiS_NA.GameServer.Core.Types.TagMap
for (int i = 0; i < TagMapSize; i++)
{
var entry = new TagMapEntry(stream);
this._tagMapEntries.Add(entry.TagID, entry);
_tagMapEntries.Add(entry.TagID, entry);
}
}
@ -233,49 +233,49 @@ namespace DiIiS_NA.GameServer.Core.Types.TagMap
public TagMapEntry(MpqFileStream stream)
{
this.Type = stream.ReadValueS32();
this.TagID = stream.ReadValueS32();
Type = stream.ReadValueS32();
TagID = stream.ReadValueS32();
switch (this.Type)
switch (Type)
{
case 0:
this.Int = stream.ReadValueS32();
Int = stream.ReadValueS32();
break;
case 1:
Float = stream.ReadValueF32();
break;
case 2: // SNO
this.Int = stream.ReadValueS32();
Int = stream.ReadValueS32();
break;
// TODO: Create strong type for gbid (at least i think they are)
case 3:
this.Int = stream.ReadValueS32();
Int = stream.ReadValueS32();
break;
case 4:
this.ScriptFormula = new ScriptFormula(stream);
ScriptFormula = new ScriptFormula(stream);
break;
// TODO: Strong type for group hashes
case 5:
this.Int = stream.ReadValueS32();
Int = stream.ReadValueS32();
break;
// Todo: Strong type for ... hmmm.. is that a gameattributeindex?
case 6:
this.Int = stream.ReadValueS32();
Int = stream.ReadValueS32();
break;
// Todo: Strong type fo StartingLocationID
case 7:
this.Int = stream.ReadValueS32();
Int = stream.ReadValueS32();
break;
default:
// if this break hits, blizz introduced a new key type and most likey we should have to react to it
System.Diagnostics.Debugger.Break();
this.Int = stream.ReadValueS32();
Int = stream.ReadValueS32();
break;
}
}

View File

@ -43,23 +43,23 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem
protected Brain(Actor body)
{
this.Body = body;
this.State = BrainState.Idle;
this.Actions = new Queue<ActorAction>();
Body = body;
State = BrainState.Idle;
Actions = new Queue<ActorAction>();
}
protected void QueueAction(ActorAction action)
{
this.Actions.Enqueue(action);
Actions.Enqueue(action);
}
public virtual void Update(int tickCounter)
{
if (this.State == BrainState.Dead || this.Body == null || this.Body.World == null || this.State == BrainState.Off)
if (State == BrainState.Dead || Body == null || Body.World == null || State == BrainState.Off)
return;
this.Think(tickCounter); // let the brain think.
this.Perform(tickCounter); // perform any outstanding actions.
Think(tickCounter); // let the brain think.
Perform(tickCounter); // perform any outstanding actions.
}
/// <summary>
@ -73,38 +73,38 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem
/// </summary>
public virtual void Kill()
{
if (this.CurrentAction != null)
if (CurrentAction != null)
{
this.CurrentAction.Cancel(0);
this.CurrentAction = null;
CurrentAction.Cancel(0);
CurrentAction = null;
}
this.State = BrainState.Dead;
State = BrainState.Dead;
}
public void Activate()
{
if (this.State == BrainState.Off)
this.State = BrainState.Idle;
if (State == BrainState.Off)
State = BrainState.Idle;
}
public void DeActivate()
{
this.CurrentAction = null;
this.State = BrainState.Off;
CurrentAction = null;
State = BrainState.Off;
}
private void Perform(int tickCounter)
{
if (this.CurrentAction == null)
if (CurrentAction == null)
return;
if (!this.CurrentAction.Started)
this.CurrentAction.Start(tickCounter);
if (!CurrentAction.Started)
CurrentAction.Start(tickCounter);
else
this.CurrentAction.Update(tickCounter);
CurrentAction.Update(tickCounter);
if (this.CurrentAction.Done)
this.CurrentAction = null;
if (CurrentAction.Done)
CurrentAction = null;
}
}
}

View File

@ -38,7 +38,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public AggressiveNPCBrain(Actor body)
: base(body)
{
this.PresetPowers = new List<int>();
PresetPowers = new List<int>();
if (body.ActorData.MonsterSNO > 0)
{
@ -47,7 +47,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{
if (monsterSkill.SNOPower > 0)
{
this.PresetPowers.Add(monsterSkill.SNOPower);
PresetPowers.Add(monsterSkill.SNOPower);
}
}
}
@ -55,31 +55,31 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public override void Think(int tickCounter)
{
if (this.Body.Attributes[GameAttribute.Frozen] ||
this.Body.Attributes[GameAttribute.Stunned] ||
this.Body.Attributes[GameAttribute.Blind] ||
this.Body.Attributes[GameAttribute.Webbed] ||
this.Body.Disable ||
this.Body.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.KnockbackBuff>(this.Body) != null)
if (Body.Attributes[GameAttribute.Frozen] ||
Body.Attributes[GameAttribute.Stunned] ||
Body.Attributes[GameAttribute.Blind] ||
Body.Attributes[GameAttribute.Webbed] ||
Body.Disable ||
Body.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.KnockbackBuff>(Body) != null)
{
if (this.CurrentAction != null)
if (CurrentAction != null)
{
this.CurrentAction.Cancel(tickCounter);
this.CurrentAction = null;
CurrentAction.Cancel(tickCounter);
CurrentAction = null;
}
_powerDelay = null;
return;
}
if (this.CurrentAction == null)
if (CurrentAction == null)
{
if (_powerDelay == null)
_powerDelay = new SecondsTickTimer(this.Body.World.Game, 1f);
_powerDelay = new SecondsTickTimer(Body.World.Game, 1f);
if (_powerDelay.TimedOut)
{
var monsters = this.Body.GetObjectsInRange<Monster>(40f).Where(m => m.Visible & !m.Dead).ToList();
var monsters = Body.GetObjectsInRange<Monster>(40f).Where(m => m.Visible & !m.Dead).ToList();
if (monsters.Count != 0)
{
_target = monsters[0];
@ -87,23 +87,23 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
if (powerToUse > 0)
{
PowerSystem.PowerScript power = PowerSystem.PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = this.Body;
float attackRange = this.Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f);
float targetDistance = PowerSystem.PowerMath.Distance2D(_target.Position, this.Body.Position);
power.User = Body;
float attackRange = Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f);
float targetDistance = PowerSystem.PowerMath.Distance2D(_target.Position, Body.Position);
if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2)
{
if (_powerDelay.TimedOut)
{
_powerDelay = null;
this.Body.TranslateFacing(_target.Position, false);
Body.TranslateFacing(_target.Position, false);
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target);
CurrentAction = new PowerAction(Body, powerToUse, _target);
}
}
else
{
this.CurrentAction = new MoveToTargetWithPathfindAction(
this.Body,
CurrentAction = new MoveToTargetWithPathfindAction(
Body,
_target,
attackRange + _target.ActorData.Cylinder.Ax2
);
@ -112,7 +112,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
}
else
{
this.CurrentAction = new MoveToPointAction(this.Body, this.Body.CheckPointPosition);
CurrentAction = new MoveToPointAction(Body, Body.CheckPointPosition);
}
}
}
@ -120,11 +120,11 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
protected virtual int PickPowerToUse()
{
if (this.PresetPowers.Count > 0)
if (PresetPowers.Count > 0)
{
int powerIndex = RandomHelper.Next(this.PresetPowers.Count);
if (PowerSystem.PowerLoader.HasImplementationForPowerSNO(this.PresetPowers[powerIndex]))
return this.PresetPowers[powerIndex];
int powerIndex = RandomHelper.Next(PresetPowers.Count);
if (PowerSystem.PowerLoader.HasImplementationForPowerSNO(PresetPowers[powerIndex]))
return PresetPowers[powerIndex];
}
return -1;
@ -132,7 +132,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public void AddPresetPower(int powerSNO)
{
this.PresetPowers.Add(powerSNO);
PresetPowers.Add(powerSNO);
}
}
}

View File

@ -49,75 +49,75 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public HirelingBrain(Actor body, Player master)
: base(body)
{
this.Owner = master;
Owner = master;
this.PresetPowers = new List<int>();
PresetPowers = new List<int>();
if (body is Templar && body is MalthaelHireling)
this.PresetPowers.Add(30592); //melee instant
PresetPowers.Add(30592); //melee instant
if (body is Scoundrel)
this.PresetPowers.Add(99902); //Scoundrel_ranged_Projectile
PresetPowers.Add(99902); //Scoundrel_ranged_Projectile
if (body is Enchantress)
this.PresetPowers.Add(30273); //HirelingMage_MagicMissile
PresetPowers.Add(30273); //HirelingMage_MagicMissile
if (body is Leah)
this.PresetPowers.Add(99902); //Scoundrel_ranged_Projectile
PresetPowers.Add(99902); //Scoundrel_ranged_Projectile
}
public override void Think(int tickCounter)
{
if (this.Owner == null) return;
if (Owner == null) return;
if (this.Body.World.Game.Paused) return;
if (Body.World.Game.Paused) return;
// check if in disabled state, if so cancel any action then do nothing
if (this.Body.Attributes[GameAttribute.Frozen] ||
this.Body.Attributes[GameAttribute.Stunned] ||
this.Body.Attributes[GameAttribute.Blind] ||
this.Body.Attributes[GameAttribute.Webbed] ||
this.Body.Disable ||
this.Body.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.KnockbackBuff>(this.Body) != null)
if (Body.Attributes[GameAttribute.Frozen] ||
Body.Attributes[GameAttribute.Stunned] ||
Body.Attributes[GameAttribute.Blind] ||
Body.Attributes[GameAttribute.Webbed] ||
Body.Disable ||
Body.World.BuffManager.GetFirstBuff<KnockbackBuff>(Body) != null)
{
if (this.CurrentAction != null)
if (CurrentAction != null)
{
this.CurrentAction.Cancel(tickCounter);
this.CurrentAction = null;
CurrentAction.Cancel(tickCounter);
CurrentAction = null;
}
_powerDelay = null;
return;
}
if (this.Body.Attributes[GameAttribute.Feared])
if (Body.Attributes[GameAttribute.Feared])
{
if (!this.Feared || this.CurrentAction == null)
if (!Feared || CurrentAction == null)
{
if (this.CurrentAction != null)
if (CurrentAction != null)
{
this.CurrentAction.Cancel(tickCounter);
this.CurrentAction = null;
CurrentAction.Cancel(tickCounter);
CurrentAction = null;
}
this.Feared = true;
this.CurrentAction = new MoveToPointWithPathfindAction(
this.Body,
PowerContext.RandomDirection(this.Body.Position, 3f, 8f)
Feared = true;
CurrentAction = new MoveToPointWithPathfindAction(
Body,
PowerContext.RandomDirection(Body.Position, 3f, 8f)
);
return;
}
else return;
}
else
this.Feared = false;
Feared = false;
// select and start executing a power if no active action
if (this.CurrentAction == null)
if (CurrentAction == null)
{
// do a little delay so groups of monsters don't all execute at once
if (_powerDelay == null)
_powerDelay = new SecondsTickTimer(this.Body.World.Game, 1f);
_powerDelay = new SecondsTickTimer(Body.World.Game, 1f);
var targets = this.Owner.GetObjectsInRange<Monster>(40f).Where(p => !p.Dead && p.Visible).OrderBy(m => PowerMath.Distance2D(m.Position, this.Body.Position)).ToList();
if (targets.Count != 0 && PowerMath.Distance2D(this.Body.Position, this.Owner.Position) < 80f)
var targets = Owner.GetObjectsInRange<Monster>(40f).Where(p => !p.Dead && p.Visible).OrderBy(m => PowerMath.Distance2D(m.Position, Body.Position)).ToList();
if (targets.Count != 0 && PowerMath.Distance2D(Body.Position, Owner.Position) < 80f)
{
int powerToUse = PickPowerToUse();
if (powerToUse > 0)
@ -129,23 +129,23 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
_target = targets.First();
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = this.Body;
float attackRange = this.Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, this.Body.Position);
power.User = Body;
float attackRange = Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, Body.Position);
if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2)
{
if (_powerDelay.TimedOut)
{
_powerDelay = null;
this.Body.TranslateFacing(_target.Position, false);
Body.TranslateFacing(_target.Position, false);
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target);
CurrentAction = new PowerAction(Body, powerToUse, _target);
}
}
else
{
this.CurrentAction = new MoveToTargetWithPathfindAction(
this.Body,
CurrentAction = new MoveToTargetWithPathfindAction(
Body,
_target,
attackRange + _target.ActorData.Cylinder.Ax2
);
@ -154,15 +154,15 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
}
else
{
var distToMaster = PowerMath.Distance2D(this.Body.Position, this.Owner.Position);
var distToMaster = PowerMath.Distance2D(Body.Position, Owner.Position);
if ((distToMaster > 8f) || (distToMaster < 3f))
{
var Rand = FastRandom.Instance;
var position = this.Owner.Position;
var position = Owner.Position;
float angle = (float)(Rand.NextDouble() * Math.PI * 2);
float radius = 3f + (float)Rand.NextDouble() * (8f - 3f);
var near = new Vector3D(position.X + (float)Math.Cos(angle) * radius, position.Y + (float)Math.Sin(angle) * radius, position.Z);
this.CurrentAction = new MoveToPointAction(this.Body, near);
CurrentAction = new MoveToPointAction(Body, near);
}
}
}
@ -171,11 +171,11 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
protected virtual int PickPowerToUse()
{
// randomly used an implemented power
if (this.PresetPowers.Count > 0)
if (PresetPowers.Count > 0)
{
int powerIndex = RandomHelper.Next(this.PresetPowers.Count);
if (PowerSystem.PowerLoader.HasImplementationForPowerSNO(this.PresetPowers[powerIndex]))
return this.PresetPowers[powerIndex];
int powerIndex = RandomHelper.Next(PresetPowers.Count);
if (PowerLoader.HasImplementationForPowerSNO(PresetPowers[powerIndex]))
return PresetPowers[powerIndex];
}
// no usable power
@ -184,7 +184,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public void AddPresetPower(int powerSNO)
{
this.PresetPowers.Add(powerSNO);
PresetPowers.Add(powerSNO);
}
}
}

View File

@ -61,8 +61,8 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public LooterBrain(Actor body, bool lootsLegs)
: base(body)
{
this.LootLegendaries = lootsLegs;
this.PresetPowers = new Dictionary<int, Cooldown>();
LootLegendaries = lootsLegs;
PresetPowers = new Dictionary<int, Cooldown>();
// build list of powers defined in monster mpq data
if (body.ActorData.MonsterSNO > 0)
@ -72,7 +72,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{
if (monsterSkill.SNOPower > 0)
{
this.PresetPowers.Add(monsterSkill.SNOPower, new Cooldown { CooldownTimer = null, CooldownTime = 1f });
PresetPowers.Add(monsterSkill.SNOPower, new Cooldown { CooldownTimer = null, CooldownTime = 1f });
}
}
}
@ -82,52 +82,52 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{
base.Update(tickCounter);
List<Item> gold = this.Body.GetObjectsInRange<Item>(5f).Where(m => ((this.Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && Item.IsGold((m as Item).ItemType)).ToList();
List<Item> gold = Body.GetObjectsInRange<Item>(5f).Where(m => ((Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && Item.IsGold((m as Item).ItemType)).ToList();
foreach (var item in gold)
{
((this.Body as Minion).Master as Player).InGameClient.SendMessage(new FloatingAmountMessage()
((Body as Minion).Master as Player).InGameClient.SendMessage(new FloatingAmountMessage()
{
Place = new WorldPlace()
{
Position = this.Body.Position,
WorldID = this.Body.World.GlobalID,
Position = Body.Position,
WorldID = Body.World.GlobalID,
},
Amount = item.Attributes[GameAttribute.ItemStackQuantityLo],
Type = FloatingAmountMessage.FloatType.Gold,
});
((this.Body as Minion).Master as Player).Inventory.PickUpGold(item);
((this.Body as Minion).Master as Player).GroundItems.Remove(item.GlobalID);
((Body as Minion).Master as Player).Inventory.PickUpGold(item);
((Body as Minion).Master as Player).GroundItems.Remove(item.GlobalID);
item.Destroy();
}
if (this.LootLegendaries)
if (LootLegendaries)
{
List<Item> legendaries = this.Body.GetObjectsInRange<Item>(5f).Where(m => ((this.Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && (m as Item).ItemDefinition.Name.Contains("Unique_")).ToList();
List<Item> legendaries = Body.GetObjectsInRange<Item>(5f).Where(m => ((Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && (m as Item).ItemDefinition.Name.Contains("Unique_")).ToList();
foreach (var item in legendaries)
{
((this.Body as Minion).Master as Player).Inventory.PickUp(item);
((Body as Minion).Master as Player).Inventory.PickUp(item);
}
}
List<Item> shards = this.Body.GetObjectsInRange<Item>(5f).Where(m => ((this.Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && Item.IsBloodShard((m as Item).ItemType)).ToList();
List<Item> shards = Body.GetObjectsInRange<Item>(5f).Where(m => ((Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && Item.IsBloodShard((m as Item).ItemType)).ToList();
foreach (var item in shards)
{
((this.Body as Minion).Master as Player).InGameClient.SendMessage(new FloatingAmountMessage()
((Body as Minion).Master as Player).InGameClient.SendMessage(new FloatingAmountMessage()
{
Place = new WorldPlace()
{
Position = this.Body.Position,
WorldID = this.Body.World.GlobalID,
Position = Body.Position,
WorldID = Body.World.GlobalID,
},
Amount = item.Attributes[GameAttribute.ItemStackQuantityLo],
Type = FloatingAmountMessage.FloatType.BloodStone,
});
((this.Body as Minion).Master as Player).Inventory.PickUpBloodShard(item);
((this.Body as Minion).Master as Player).GroundItems.Remove(item.GlobalID);
((Body as Minion).Master as Player).Inventory.PickUpBloodShard(item);
((Body as Minion).Master as Player).GroundItems.Remove(item.GlobalID);
item.Destroy();
}
}
@ -136,39 +136,39 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{
// this needed? /mdz
//if (this.Body is NPC) return;
if ((this.Body as Minion).Master == null) return;
if ((Body as Minion).Master == null) return;
if (this.Body.World.Game.Paused) return;
if (Body.World.Game.Paused) return;
// select and start executing a power if no active action
if (this.CurrentAction == null)
if (CurrentAction == null)
{
// do a little delay so groups of monsters don't all execute at once
if (_powerDelay == null)
_powerDelay = new SecondsTickTimer(this.Body.World.Game, (float)RandomHelper.NextDouble());
_powerDelay = new SecondsTickTimer(Body.World.Game, (float)RandomHelper.NextDouble());
if (_powerDelay.TimedOut)
{
List<Actor> targets = this.Body.GetObjectsInRange<Item>(40f).Where(m => ((this.Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && Item.IsGold((m as Item).ItemType)).Cast<Actor>().ToList();
if (this.LootLegendaries)
targets.Concat(this.Body.GetObjectsInRange<Item>(40f).Where(m => ((this.Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && (m as Item).ItemDefinition.Name.Contains("Unique_")).Cast<Actor>().ToList());
if (targets.Count != 0 && PowerMath.Distance2D(this.Body.Position, (this.Body as Minion).Master.Position) < 80f)
List<Actor> targets = Body.GetObjectsInRange<Item>(40f).Where(m => ((Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && Item.IsGold((m as Item).ItemType)).Cast<Actor>().ToList();
if (LootLegendaries)
targets.Concat(Body.GetObjectsInRange<Item>(40f).Where(m => ((Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && (m as Item).ItemDefinition.Name.Contains("Unique_")).Cast<Actor>().ToList());
if (targets.Count != 0 && PowerMath.Distance2D(Body.Position, (Body as Minion).Master.Position) < 80f)
{
_target = targets.First();
//Logger.Trace("MoveToTargetWithPathfindAction to target");
this.CurrentAction = new MoveToPointAction(this.Body, _target.Position);
CurrentAction = new MoveToPointAction(Body, _target.Position);
}
else
{
var distToMaster = PowerMath.Distance2D(this.Body.Position, (this.Body as Minion).Master.Position);
var distToMaster = PowerMath.Distance2D(Body.Position, (Body as Minion).Master.Position);
if ((distToMaster > 8f) || (distToMaster < 3f))
{
var Rand = FastRandom.Instance;
var position = (this.Body as Minion).Master.Position;
var position = (Body as Minion).Master.Position;
float angle = (float)(Rand.NextDouble() * Math.PI * 2);
float radius = 3f + (float)Rand.NextDouble() * (8f - 3f);
var near = new Vector3D(position.X + (float)Math.Cos(angle) * radius, position.Y + (float)Math.Sin(angle) * radius, position.Z);
this.CurrentAction = new MoveToPointAction(this.Body, near);
CurrentAction = new MoveToPointAction(Body, near);
}
}
}

View File

@ -57,7 +57,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public MinionBrain(Actor body)
: base(body)
{
this.PresetPowers = new Dictionary<int, Cooldown>();
PresetPowers = new Dictionary<int, Cooldown>();
// build list of powers defined in monster mpq data
if (body.ActorData.MonsterSNO > 0)
@ -67,7 +67,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{
if (monsterSkill.SNOPower > 0)
{
this.PresetPowers.Add(monsterSkill.SNOPower, new Cooldown { CooldownTimer = null, CooldownTime = 1f });
PresetPowers.Add(monsterSkill.SNOPower, new Cooldown { CooldownTimer = null, CooldownTime = 1f });
}
}
}
@ -77,70 +77,70 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{
// this needed? /mdz
//if (this.Body is NPC) return;
if ((this.Body as Minion).Master == null) return;
if ((Body as Minion).Master == null) return;
if (this.Body.World.Game.Paused) return;
if (Body.World.Game.Paused) return;
// check if in disabled state, if so cancel any action then do nothing
if (this.Body.Attributes[GameAttribute.Frozen] ||
this.Body.Attributes[GameAttribute.Stunned] ||
this.Body.Attributes[GameAttribute.Blind] ||
this.Body.Attributes[GameAttribute.Webbed] ||
this.Body.Disable ||
this.Body.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.KnockbackBuff>(this.Body) != null)
if (Body.Attributes[GameAttribute.Frozen] ||
Body.Attributes[GameAttribute.Stunned] ||
Body.Attributes[GameAttribute.Blind] ||
Body.Attributes[GameAttribute.Webbed] ||
Body.Disable ||
Body.World.BuffManager.GetFirstBuff<KnockbackBuff>(Body) != null)
{
if (this.CurrentAction != null)
if (CurrentAction != null)
{
this.CurrentAction.Cancel(tickCounter);
this.CurrentAction = null;
CurrentAction.Cancel(tickCounter);
CurrentAction = null;
}
_powerDelay = null;
return;
}
if (this.Body.Attributes[GameAttribute.Feared])
if (Body.Attributes[GameAttribute.Feared])
{
if (!this.Feared || this.CurrentAction == null)
if (!Feared || CurrentAction == null)
{
if (this.CurrentAction != null)
if (CurrentAction != null)
{
this.CurrentAction.Cancel(tickCounter);
this.CurrentAction = null;
CurrentAction.Cancel(tickCounter);
CurrentAction = null;
}
this.Feared = true;
this.CurrentAction = new MoveToPointWithPathfindAction(
this.Body,
PowerContext.RandomDirection(this.Body.Position, 3f, 8f)
Feared = true;
CurrentAction = new MoveToPointWithPathfindAction(
Body,
PowerContext.RandomDirection(Body.Position, 3f, 8f)
);
return;
}
else return;
}
else
this.Feared = false;
Feared = false;
// select and start executing a power if no active action
if (this.CurrentAction == null)
if (CurrentAction == null)
{
// do a little delay so groups of monsters don't all execute at once
if (_powerDelay == null)
_powerDelay = new SecondsTickTimer(this.Body.World.Game, (float)RandomHelper.NextDouble());
_powerDelay = new SecondsTickTimer(Body.World.Game, (float)RandomHelper.NextDouble());
if (_powerDelay.TimedOut)
{
List<Actor> targets = (this.Body as Minion).Master
List<Actor> targets = (Body as Minion).Master
.GetObjectsInRange<Monster>(40f)
.Where(m => !m.Dead && m.Visible && m.SNO.IsTargetable())
.OrderBy(m => PowerMath.Distance2D(m.Position, this.Body.Position))
.OrderBy(m => PowerMath.Distance2D(m.Position, Body.Position))
.Cast<Actor>()
.ToList();
if (this.Body.World.Game.PvP)
targets = (this.Body as Minion).Master.GetObjectsInRange<Player>(30f).Where(p => p.GlobalID != (this.Body as Minion).Master.GlobalID && p.Attributes[GameAttribute.TeamID] != (this.Body as Minion).Master.Attributes[GameAttribute.TeamID]).Cast<Actor>().ToList();
if (this.Body.World.IsPvP)
targets = (this.Body as Minion).Master.GetObjectsInRange<Player>(30f).Where(p => p.GlobalID != (this.Body as Minion).Master.GlobalID).Cast<Actor>().ToList();
if (Body.World.Game.PvP)
targets = (Body as Minion).Master.GetObjectsInRange<Player>(30f).Where(p => p.GlobalID != (Body as Minion).Master.GlobalID && p.Attributes[GameAttribute.TeamID] != (Body as Minion).Master.Attributes[GameAttribute.TeamID]).Cast<Actor>().ToList();
if (Body.World.IsPvP)
targets = (Body as Minion).Master.GetObjectsInRange<Player>(30f).Where(p => p.GlobalID != (Body as Minion).Master.GlobalID).Cast<Actor>().ToList();
if (targets.Count != 0 && PowerMath.Distance2D(this.Body.Position, (this.Body as Minion).Master.Position) < 80f)
if (targets.Count != 0 && PowerMath.Distance2D(Body.Position, (Body as Minion).Master.Position) < 80f)
{
var elites = targets.Where(t => t is Champion || t is Rare || t is RareMinion);
if (elites.Count() > 0)
@ -152,30 +152,30 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
if (powerToUse > 0)
{
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = this.Body;
float attackRange = this.Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, this.Body.Position);
power.User = Body;
float attackRange = Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, Body.Position);
if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2)
{
if (this.Body.WalkSpeed != 0)
this.Body.TranslateFacing(_target.Position, false); //columns and other non-walkable shit can't turn
if (Body.WalkSpeed != 0)
Body.TranslateFacing(_target.Position, false); //columns and other non-walkable shit can't turn
float cdReduction = (this.Body as Minion).CooldownReduction;
float cdReduction = (Body as Minion).CooldownReduction;
//Logger.Trace("PowerAction to target");
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target);
CurrentAction = new PowerAction(Body, powerToUse, _target);
if (power is SummoningSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (7f * cdReduction) };
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (7f * cdReduction) };
if (this.PresetPowers[powerToUse].CooldownTime > 0f)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, this.PresetPowers[powerToUse].CooldownTime), CooldownTime = (this.PresetPowers[powerToUse].CooldownTime * cdReduction) };
if (PresetPowers[powerToUse].CooldownTime > 0f)
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, PresetPowers[powerToUse].CooldownTime), CooldownTime = (PresetPowers[powerToUse].CooldownTime * cdReduction) };
}
else
{
Logger.Trace("MoveToTargetWithPathfindAction to target");
this.CurrentAction = new MoveToTargetWithPathfindAction(
this.Body,
CurrentAction = new MoveToTargetWithPathfindAction(
Body,
//(
_target,// + MovementHelpers.GetMovementPosition(
//new Vector3D(0, 0, 0),
@ -191,15 +191,15 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
}
else
{
var distToMaster = PowerMath.Distance2D(this.Body.Position, (this.Body as Minion).Master.Position);
var distToMaster = PowerMath.Distance2D(Body.Position, (Body as Minion).Master.Position);
if ((distToMaster > 8f) || (distToMaster < 3f))
{
var Rand = FastRandom.Instance;
var position = (this.Body as Minion).Master.Position;
var position = (Body as Minion).Master.Position;
float angle = (float)(Rand.NextDouble() * Math.PI * 2);
float radius = 3f + (float)Rand.NextDouble() * (8f - 3f);
var near = new Vector3D(position.X + (float)Math.Cos(angle) * radius, position.Y + (float)Math.Sin(angle) * radius, position.Z);
this.CurrentAction = new MoveToPointAction(this.Body, near);
CurrentAction = new MoveToPointAction(Body, near);
}
}
}
@ -208,17 +208,17 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
protected virtual int PickPowerToUse()
{
if (!_warnedNoPowers && this.PresetPowers.Count == 0)
if (!_warnedNoPowers && PresetPowers.Count == 0)
{
Logger.Debug("Minion \"{0}\" has no usable powers. ", this.Body.Name);
Logger.Debug("Minion \"{0}\" has no usable powers. ", Body.Name);
_warnedNoPowers = true;
}
// randomly used an implemented power
if (this.PresetPowers.Count > 0)
if (PresetPowers.Count > 0)
{
//int power = this.PresetPowers[RandomHelper.Next(this.PresetPowers.Count)].Key;
List<int> availablePowers = Enumerable.ToList(this.PresetPowers.Where(p => (p.Value.CooldownTimer == null || p.Value.CooldownTimer.TimedOut) && PowerSystem.PowerLoader.HasImplementationForPowerSNO(p.Key)).Select(p => p.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));
if (availablePowers.Where(p => p != 30592).Count() > 0)
return availablePowers.Where(p => p != 30592).ToList()[RandomHelper.Next(availablePowers.Where(p => p != 30592).ToList().Count())];
else
@ -232,23 +232,23 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public void AddPresetPower(int powerSNO)
{
if (this.PresetPowers.ContainsKey(powerSNO))
if (PresetPowers.ContainsKey(powerSNO))
{
// Logger.Debug("AddPresetPower(): power sno {0} already defined for monster \"{1}\"",
//powerSNO, this.Body.ActorSNO.Name);
return;
}
if (this.PresetPowers.ContainsKey(30592)) //if can cast melee
this.PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 5f });
if (PresetPowers.ContainsKey(30592)) //if can cast melee
PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 5f });
else
this.PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 1f + (float)FastRandom.Instance.NextDouble() });
PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 1f + (float)FastRandom.Instance.NextDouble() });
}
public void RemovePresetPower(int powerSNO)
{
if (this.PresetPowers.ContainsKey(powerSNO))
if (PresetPowers.ContainsKey(powerSNO))
{
this.PresetPowers.Remove(powerSNO);
PresetPowers.Remove(powerSNO);
}
}
}

View File

@ -62,7 +62,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public MonsterBrain(Actor body)
: base(body)
{
this.PresetPowers = new Dictionary<int, Cooldown>();
PresetPowers = new Dictionary<int, Cooldown>();
// build list of powers defined in monster mpq data
if (body.ActorData.MonsterSNO > 0)
@ -72,117 +72,117 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
for (int i = 0; i < monsterData.SkillDeclarations.Count(); i++)
{
if (monsterData.SkillDeclarations[i].SNOPower == -1) continue;
if (PowerSystem.PowerLoader.HasImplementationForPowerSNO(monsterData.SkillDeclarations[i].SNOPower))
if (PowerLoader.HasImplementationForPowerSNO(monsterData.SkillDeclarations[i].SNOPower))
{
var cooldownTime = monsterData.MonsterSkillDeclarations[i].Timer / 10f;
this.PresetPowers.Add(monsterData.SkillDeclarations[i].SNOPower, new Cooldown { CooldownTimer = null, CooldownTime = cooldownTime });
PresetPowers.Add(monsterData.SkillDeclarations[i].SNOPower, new Cooldown { CooldownTimer = null, CooldownTime = cooldownTime });
}
}
if (!monsterData.SkillDeclarations.Any(s => s.SNOPower == 30592))
this.PresetPowers.Add(30592, new Cooldown { CooldownTimer = null, CooldownTime = 0f }); //hack for dummy mobs without powers
PresetPowers.Add(30592, new Cooldown { CooldownTimer = null, CooldownTime = 0f }); //hack for dummy mobs without powers
}
}
public override void Think(int tickCounter)
{
if (this.Body.SNO == ActorSno._uber_siegebreakerdemon ||
this.Body.SNO == ActorSno._a4dun_garden_corruption_monster ||
this.Body.SNO == ActorSno._a4dun_garden_hellportal_pillar)
if (Body.SNO == ActorSno._uber_siegebreakerdemon ||
Body.SNO == ActorSno._a4dun_garden_corruption_monster ||
Body.SNO == ActorSno._a4dun_garden_hellportal_pillar)
return;
if (this.Body.SNO == ActorSno._belialvoiceover) //BelialVoiceover
if (Body.SNO == ActorSno._belialvoiceover) //BelialVoiceover
return;
if (this.Body.Hidden == true)
if (Body.Hidden == true)
return;
if (this.CurrentAction != null && this.PriorityTarget != null && this.PriorityTarget.Attributes[GameAttribute.Is_Helper] == true)
if (CurrentAction != null && PriorityTarget != null && PriorityTarget.Attributes[GameAttribute.Is_Helper] == true)
{
this.PriorityTarget = null;
this.CurrentAction.Cancel(tickCounter);
this.CurrentAction = null;
PriorityTarget = null;
CurrentAction.Cancel(tickCounter);
CurrentAction = null;
return;
}
if (!(tickCounter % 60 == 0)) return;
if (this.Body is NPC) return;
if (Body is NPC) return;
if (!this.Body.Visible || this.Body.Dead) return;
if (!Body.Visible || Body.Dead) return;
if (this.Body.World.Game.Paused) return;
if (this.Body.Attributes[GameAttribute.Disabled]) return;
if (Body.World.Game.Paused) return;
if (Body.Attributes[GameAttribute.Disabled]) return;
if (this.Body.Attributes[GameAttribute.Frozen] ||
this.Body.Attributes[GameAttribute.Stunned] ||
this.Body.Attributes[GameAttribute.Blind] ||
this.Body.Attributes[GameAttribute.Webbed] ||
this.Body.Disable ||
this.Body.World.BuffManager.GetFirstBuff<KnockbackBuff>(this.Body) != null ||
this.Body.World.BuffManager.GetFirstBuff<SummonedBuff>(this.Body) != null)
if (Body.Attributes[GameAttribute.Frozen] ||
Body.Attributes[GameAttribute.Stunned] ||
Body.Attributes[GameAttribute.Blind] ||
Body.Attributes[GameAttribute.Webbed] ||
Body.Disable ||
Body.World.BuffManager.GetFirstBuff<KnockbackBuff>(Body) != null ||
Body.World.BuffManager.GetFirstBuff<SummonedBuff>(Body) != null)
{
if (this.CurrentAction != null)
if (CurrentAction != null)
{
this.CurrentAction.Cancel(tickCounter);
this.CurrentAction = null;
CurrentAction.Cancel(tickCounter);
CurrentAction = null;
}
_powerDelay = null;
return;
}
if (this.Body.Attributes[GameAttribute.Feared])
if (Body.Attributes[GameAttribute.Feared])
{
if (!this.Feared || this.CurrentAction == null)
if (!Feared || CurrentAction == null)
{
if (this.CurrentAction != null)
if (CurrentAction != null)
{
this.CurrentAction.Cancel(tickCounter);
this.CurrentAction = null;
CurrentAction.Cancel(tickCounter);
CurrentAction = null;
}
this.Feared = true;
this.CurrentAction = new MoveToPointWithPathfindAction(
this.Body,
PowerContext.RandomDirection(this.Body.Position, 3f, 8f)
Feared = true;
CurrentAction = new MoveToPointWithPathfindAction(
Body,
PowerContext.RandomDirection(Body.Position, 3f, 8f)
);
return;
}
else return;
}
else
this.Feared = false;
Feared = false;
if (this.CurrentAction == null)
if (CurrentAction == null)
{
if (_powerDelay == null)
_powerDelay = new SecondsTickTimer(this.Body.World.Game, 1.0f);
if (AttackedBy != null || this.Body.GetObjectsInRange<Player>(50f).Count != 0)
_powerDelay = new SecondsTickTimer(Body.World.Game, 1.0f);
if (AttackedBy != null || Body.GetObjectsInRange<Player>(50f).Count != 0)
{
if (_powerDelay.TimedOut)
{
_powerDelay = new SecondsTickTimer(this.Body.World.Game, 1.0f);
_powerDelay = new SecondsTickTimer(Body.World.Game, 1.0f);
if (AttackedBy != null)
this.PriorityTarget = AttackedBy;
PriorityTarget = AttackedBy;
if (this.PriorityTarget == null)
if (PriorityTarget == null)
{
List<Actor> targets = new List<Actor>();
if (this.Body.Attributes[GameAttribute.Team_Override] == 1)
targets = this.Body.GetObjectsInRange<Monster>(60f)
if (Body.Attributes[GameAttribute.Team_Override] == 1)
targets = Body.GetObjectsInRange<Monster>(60f)
.Where(p => !p.Dead)
.OrderBy((monster) => PowerMath.Distance2D(monster.Position, this.Body.Position))
.OrderBy((monster) => PowerMath.Distance2D(monster.Position, Body.Position))
.Cast<Actor>()
.ToList();
else
targets = this.Body.GetActorsInRange(50f)
targets = Body.GetActorsInRange(50f)
.Where(p => ((p is Player) && !p.Dead && p.Attributes[GameAttribute.Loading] == false && p.Attributes[GameAttribute.Is_Helper] == false && p.World.BuffManager.GetFirstBuff<ActorGhostedBuff>(p) == null)
|| ((p is Minion) && !p.Dead && p.Attributes[GameAttribute.Is_Helper] == false)
|| (p is DesctructibleLootContainer && p.SNO.IsDoorOrBarricade())
|| ((p is Hireling) && !p.Dead)
)
.OrderBy((actor) => PowerMath.Distance2D(actor.Position, this.Body.Position))
.OrderBy((actor) => PowerMath.Distance2D(actor.Position, Body.Position))
.Cast<Actor>()
.ToList();
@ -191,49 +191,49 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
_target = targets.First();
}
else
_target = this.PriorityTarget;
_target = PriorityTarget;
int powerToUse = PickPowerToUse();
if (powerToUse > 0)
{
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = this.Body;
float attackRange = this.Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : Math.Min((float)power.EvalTag(PowerKeys.AttackRadius), 35f)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, this.Body.Position);
power.User = Body;
float attackRange = Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : Math.Min((float)power.EvalTag(PowerKeys.AttackRadius), 35f)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, Body.Position);
if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2)
{
if (this.Body.WalkSpeed != 0)
this.Body.TranslateFacing(_target.Position, false);
if (Body.WalkSpeed != 0)
Body.TranslateFacing(_target.Position, false);
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target);
CurrentAction = new PowerAction(Body, powerToUse, _target);
if (power is SummoningSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (this.Body is Boss ? 15f : 7f) };
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (Body is Boss ? 15f : 7f) };
if (power is MonsterAffixSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime };
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime };
if (this.PresetPowers[powerToUse].CooldownTime > 0f)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, this.PresetPowers[powerToUse].CooldownTime), CooldownTime = this.PresetPowers[powerToUse].CooldownTime };
if (PresetPowers[powerToUse].CooldownTime > 0f)
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, PresetPowers[powerToUse].CooldownTime), CooldownTime = PresetPowers[powerToUse].CooldownTime };
if (powerToUse == 96925 ||
powerToUse == 223284)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, 10f), CooldownTime = 10f };
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, 10f), CooldownTime = 10f };
}
else if (this.Body.WalkSpeed != 0)
else if (Body.WalkSpeed != 0)
{
if (this.Body.SNO.IsWoodwraithOrWasp())
if (Body.SNO.IsWoodwraithOrWasp())
{
Logger.Trace("MoveToPointAction to target");
this.CurrentAction = new MoveToPointAction(
this.Body, _target.Position
CurrentAction = new MoveToPointAction(
Body, _target.Position
);
}
else
{
Logger.Trace("MoveToTargetWithPathfindAction to target");
this.CurrentAction = new MoveToTargetWithPathfindAction(
this.Body,
CurrentAction = new MoveToTargetWithPathfindAction(
Body,
_target,
attackRange + _target.ActorData.Cylinder.Ax2,
powerToUse
@ -242,60 +242,60 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
}
else
{
switch (this.Body.SNO)
switch (Body.SNO)
{
case ActorSno._a1dun_leor_firewall2:
powerToUse = 223284;
break;
}
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target);
CurrentAction = new PowerAction(Body, powerToUse, _target);
if (power is SummoningSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (this.Body is Boss ? 15f : 7f) };
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (Body is Boss ? 15f : 7f) };
if (power is MonsterAffixSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime };
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime };
if (this.PresetPowers[powerToUse].CooldownTime > 0f)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, this.PresetPowers[powerToUse].CooldownTime), CooldownTime = this.PresetPowers[powerToUse].CooldownTime };
if (PresetPowers[powerToUse].CooldownTime > 0f)
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, PresetPowers[powerToUse].CooldownTime), CooldownTime = PresetPowers[powerToUse].CooldownTime };
if (powerToUse == 96925 ||
powerToUse == 223284)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, 10f), CooldownTime = 10f };
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, 10f), CooldownTime = 10f };
}
}
}
}
else if (this.Body.GetObjectsInRange<Living>(50f).Count != 0)
else if (Body.GetObjectsInRange<Living>(50f).Count != 0)
{
if (_powerDelay.TimedOut)
{
_powerDelay = new SecondsTickTimer(this.Body.World.Game, 1.0f);
_powerDelay = new SecondsTickTimer(Body.World.Game, 1.0f);
if (AttackedBy != null)
this.PriorityTarget = AttackedBy;
PriorityTarget = AttackedBy;
if (this.PriorityTarget == null)
if (PriorityTarget == null)
{
List<Actor> targets = new List<Actor>();
targets = this.Body.GetActorsInRange(50f)
targets = Body.GetActorsInRange(50f)
.Where(p => ((p is LorathNahr_NPC) && !p.Dead)
|| ((p is CaptainRumford) && !p.Dead)
|| (p is DesctructibleLootContainer && p.SNO.IsDoorOrBarricade())
|| ((p is Cain) && !p.Dead))
.OrderBy((actor) => PowerMath.Distance2D(actor.Position, this.Body.Position))
.OrderBy((actor) => PowerMath.Distance2D(actor.Position, Body.Position))
.Cast<Actor>()
.ToList();
if (targets.Count == 0)
{
targets = this.Body.GetActorsInRange(20f)
targets = Body.GetActorsInRange(20f)
.Where(p => ((p is Monster) && !p.Dead)
|| ((p is CaptainRumford) && !p.Dead)
)
.OrderBy((actor) => PowerMath.Distance2D(actor.Position, this.Body.Position))
.OrderBy((actor) => PowerMath.Distance2D(actor.Position, Body.Position))
.Cast<Actor>()
.ToList();
@ -305,7 +305,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
foreach (var tar in targets)
if (_target == null)
if (tar is Monster && tar != this.Body)
if (tar is Monster && tar != Body)
if (((tar as Monster).Brain as MonsterBrain).AttackedBy != null)
_target = ((tar as Monster).Brain as MonsterBrain).AttackedBy;
}
@ -318,13 +318,13 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{ _target = tar; break; }
}
else
_target = this.PriorityTarget;
_target = PriorityTarget;
int powerToUse = PickPowerToUse();
if (powerToUse > 0)
{
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = this.Body;
power.User = Body;
if (_target == null)
{
/*
@ -339,39 +339,39 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
//*/
return;
}
float attackRange = this.Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : Math.Min((float)power.EvalTag(PowerKeys.AttackRadius), 35f)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, this.Body.Position);
float attackRange = Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : Math.Min((float)power.EvalTag(PowerKeys.AttackRadius), 35f)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, Body.Position);
if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2)
{
if (this.Body.WalkSpeed != 0)
this.Body.TranslateFacing(_target.Position, false); //columns and other non-walkable shit can't turn
if (Body.WalkSpeed != 0)
Body.TranslateFacing(_target.Position, false); //columns and other non-walkable shit can't turn
//Logger.Trace("PowerAction to target");
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target);
CurrentAction = new PowerAction(Body, powerToUse, _target);
if (power is SummoningSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (this.Body is Boss ? 15f : 7f) };
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (Body is Boss ? 15f : 7f) };
if (power is MonsterAffixSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime };
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime };
if (this.PresetPowers[powerToUse].CooldownTime > 0f)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, this.PresetPowers[powerToUse].CooldownTime), CooldownTime = this.PresetPowers[powerToUse].CooldownTime };
if (PresetPowers[powerToUse].CooldownTime > 0f)
PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, PresetPowers[powerToUse].CooldownTime), CooldownTime = PresetPowers[powerToUse].CooldownTime };
}
else if (this.Body.WalkSpeed != 0)
else if (Body.WalkSpeed != 0)
{
if (this.Body.SNO.IsWoodwraithOrWasp())
if (Body.SNO.IsWoodwraithOrWasp())
{
Logger.Trace("MoveToPointAction to target");
this.CurrentAction = new MoveToPointAction(
this.Body, _target.Position
CurrentAction = new MoveToPointAction(
Body, _target.Position
);
}
else
{
Logger.Trace("MoveToTargetWithPathfindAction to target");
this.CurrentAction = new MoveToTargetWithPathfindAction(
this.Body,
CurrentAction = new MoveToTargetWithPathfindAction(
Body,
//(
_target,// + MovementHelpers.GetMovementPosition(
//new Vector3D(0, 0, 0),
@ -392,8 +392,8 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
else
{
//Logger.Trace("No enemies in range, return to master");
if (this.Body.Position != this.Body.CheckPointPosition)
this.CurrentAction = new MoveToPointWithPathfindAction(this.Body, this.Body.CheckPointPosition);
if (Body.Position != Body.CheckPointPosition)
CurrentAction = new MoveToPointWithPathfindAction(Body, Body.CheckPointPosition);
}
}
}
@ -419,36 +419,36 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public void FastAttack(Actor target, int skillSNO)
{
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(skillSNO);
power.User = this.Body;
if (this.Body.WalkSpeed != 0)
this.Body.TranslateFacing(target.Position, false); //columns and other non-walkable shit can't turn
power.User = Body;
if (Body.WalkSpeed != 0)
Body.TranslateFacing(target.Position, false); //columns and other non-walkable shit can't turn
//Logger.Trace("Fast PowerAction to target");
this.CurrentAction = new PowerAction(this.Body, skillSNO, target);
CurrentAction = new PowerAction(Body, skillSNO, target);
if (power is SummoningSkill)
this.PresetPowers[skillSNO] = new Cooldown { CooldownTimer = null, CooldownTime = (this.Body is Boss ? 15f : 7f) };
PresetPowers[skillSNO] = new Cooldown { CooldownTimer = null, CooldownTime = (Body is Boss ? 15f : 7f) };
if (power is MonsterAffixSkill)
this.PresetPowers[skillSNO] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime };
PresetPowers[skillSNO] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime };
if (this.PresetPowers[skillSNO].CooldownTime > 0f)
this.PresetPowers[skillSNO] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, this.PresetPowers[skillSNO].CooldownTime), CooldownTime = this.PresetPowers[skillSNO].CooldownTime };
if (PresetPowers[skillSNO].CooldownTime > 0f)
PresetPowers[skillSNO] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, PresetPowers[skillSNO].CooldownTime), CooldownTime = PresetPowers[skillSNO].CooldownTime };
}
protected virtual int PickPowerToUse()
{
if (!_warnedNoPowers && this.PresetPowers.Count == 0)
if (!_warnedNoPowers && PresetPowers.Count == 0)
{
Logger.Info("Monster \"{0}\" has no usable powers. {1} are defined in mpq data.", this.Body.Name, _mpqPowerCount);
Logger.Info("Monster \"{0}\" has no usable powers. {1} are defined in mpq data.", Body.Name, _mpqPowerCount);
_warnedNoPowers = true;
}
// randomly used an implemented power
if (this.PresetPowers.Count > 0)
if (PresetPowers.Count > 0)
{
//int power = this.PresetPowers[RandomHelper.Next(this.PresetPowers.Count)].Key;
List<int> availablePowers = Enumerable.ToList(this.PresetPowers.Where(p => (p.Value.CooldownTimer == null || p.Value.CooldownTimer.TimedOut) && PowerSystem.PowerLoader.HasImplementationForPowerSNO(p.Key)).Select(p => p.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));
if (availablePowers.Where(p => p != 30592).Count() > 0)
{
int SelectedPower = availablePowers.Where(p => p != 30592).ToList()[RandomHelper.Next(availablePowers.Where(p => p != 30592).ToList().Count())];
@ -467,23 +467,23 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public void AddPresetPower(int powerSNO)
{
if (this.PresetPowers.ContainsKey(powerSNO))
if (PresetPowers.ContainsKey(powerSNO))
{
// Logger.Debug("AddPresetPower(): power sno {0} already defined for monster \"{1}\"",
//powerSNO, this.Body.ActorSNO.Name);
return;
}
if (this.PresetPowers.ContainsKey(30592)) //if can cast melee
this.PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 5f });
if (PresetPowers.ContainsKey(30592)) //if can cast melee
PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 5f });
else
this.PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 1f + (float)DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.NextDouble() });
PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 1f + (float)FastRandom.Instance.NextDouble() });
}
public void RemovePresetPower(int powerSNO)
{
if (this.PresetPowers.ContainsKey(powerSNO))
if (PresetPowers.ContainsKey(powerSNO))
{
this.PresetPowers.Remove(powerSNO);
PresetPowers.Remove(powerSNO);
}
}
}

View File

@ -43,7 +43,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public StayAggressiveNPCBrain(Actor body)
: base(body)
{
this.PresetPowers = new List<int>();
PresetPowers = new List<int>();
if (body.ActorData.MonsterSNO > 0)
@ -53,7 +53,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{
if (monsterSkill.SNOPower > 0)
{
this.PresetPowers.Add(monsterSkill.SNOPower);
PresetPowers.Add(monsterSkill.SNOPower);
}
}
}
@ -65,17 +65,17 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
//if (this.Body is NPC) return;
// check if in disabled state, if so cancel any action then do nothing
if (this.Body.Attributes[GameAttribute.Frozen] ||
this.Body.Attributes[GameAttribute.Stunned] ||
this.Body.Attributes[GameAttribute.Blind] ||
this.Body.Attributes[GameAttribute.Webbed] ||
this.Body.Disable ||
this.Body.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.KnockbackBuff>(this.Body) != null)
if (Body.Attributes[GameAttribute.Frozen] ||
Body.Attributes[GameAttribute.Stunned] ||
Body.Attributes[GameAttribute.Blind] ||
Body.Attributes[GameAttribute.Webbed] ||
Body.Disable ||
Body.World.BuffManager.GetFirstBuff<KnockbackBuff>(Body) != null)
{
if (this.CurrentAction != null)
if (CurrentAction != null)
{
this.CurrentAction.Cancel(tickCounter);
this.CurrentAction = null;
CurrentAction.Cancel(tickCounter);
CurrentAction = null;
}
_powerDelay = null;
@ -83,15 +83,15 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
}
// select and start executing a power if no active action
if (this.CurrentAction == null)
if (CurrentAction == null)
{
// do a little delay so groups of monsters don't all execute at once
if (_powerDelay == null)
_powerDelay = new SecondsTickTimer(this.Body.World.Game, 1f);
_powerDelay = new SecondsTickTimer(Body.World.Game, 1f);
if (_powerDelay.TimedOut)
{
var monsters = this.Body.GetObjectsInRange<Monster>(40f).Where(m => m.Visible & !m.Dead).ToList();
var monsters = Body.GetObjectsInRange<Monster>(40f).Where(m => m.Visible & !m.Dead).ToList();
if (monsters.Count != 0)
{
_target = monsters[0];
@ -100,18 +100,18 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
int powerToUse = PickPowerToUse();
if (powerToUse > 0)
{
PowerSystem.PowerScript power = PowerSystem.PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = this.Body;
float attackRange = this.Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f);
float targetDistance = PowerSystem.PowerMath.Distance2D(_target.Position, this.Body.Position);
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = Body;
float attackRange = Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, Body.Position);
if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2)
{
if (_powerDelay.TimedOut)
{
_powerDelay = null;
this.Body.TranslateFacing(_target.Position, false);
Body.TranslateFacing(_target.Position, false);
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target);
CurrentAction = new PowerAction(Body, powerToUse, _target);
}
}
else
@ -122,7 +122,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
}
else
{
this.CurrentAction = new MoveToPointAction(this.Body, this.Body.CheckPointPosition);
CurrentAction = new MoveToPointAction(Body, Body.CheckPointPosition);
}
}
}
@ -131,11 +131,11 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
protected virtual int PickPowerToUse()
{
// randomly used an implemented power
if (this.PresetPowers.Count > 0)
if (PresetPowers.Count > 0)
{
int powerIndex = RandomHelper.Next(this.PresetPowers.Count);
if (PowerSystem.PowerLoader.HasImplementationForPowerSNO(this.PresetPowers[powerIndex]))
return this.PresetPowers[powerIndex];
int powerIndex = RandomHelper.Next(PresetPowers.Count);
if (PowerLoader.HasImplementationForPowerSNO(PresetPowers[powerIndex]))
return PresetPowers[powerIndex];
}
// no usable power
@ -144,7 +144,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public void AddPresetPower(int powerSNO)
{
this.PresetPowers.Add(powerSNO);
PresetPowers.Add(powerSNO);
}
}
}

View File

@ -25,7 +25,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public GSBackend(string BattletHost, int BattlePort)
{
this.BattleNetSocket = new WatsonTcpClient(BattletHost, BattlePort, this._senderServerConnected, this._senderServerDisconnected, this._senderMessageReceived, false);
BattleNetSocket = new WatsonTcpClient(BattletHost, BattlePort, _senderServerConnected, _senderServerDisconnected, _senderMessageReceived, false);
}
@ -40,7 +40,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
switch (message[0])
{
case "diiiscg":
System.Threading.Tasks.Task.Run(() =>
Task.Run(() =>
{
try
{
@ -76,8 +76,8 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
{
//Logger.Info("GameServer подключен к BattleNet.");
System.Threading.Thread.Sleep(3000);
string BackEndIP = GameServer.Config.Instance.BindIP;
int BackEndPort = GameServer.Config.Instance.Port;
string BackEndIP = Config.Instance.BindIP;
int BackEndPort = Config.Instance.Port;
bool PVP = false;
if (!PVP)
RegisterGameServer(BackEndIP, BackEndPort);

File diff suppressed because it is too large Load Diff

View File

@ -49,12 +49,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
int missedTicks = 0;
Thread.BeginThreadAffinity();
if (this.CPUAffinity != 0)
if (CPUAffinity != 0)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
this.CurrentThread.ProcessorAffinity = new IntPtr((int)this.CPUAffinity);
CurrentThread.ProcessorAffinity = new IntPtr((int)CPUAffinity);
else
sched_setaffinity(0, new IntPtr(sizeof(ulong)), ref this.CPUAffinity);
sched_setaffinity(0, new IntPtr(sizeof(ulong)), ref CPUAffinity);
}
while (true)
@ -122,7 +122,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
{
lock (_lock)
{
this.Games.Add(game);
Games.Add(game);
}
}
@ -130,7 +130,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
{
get
{
int id = this.CurrentTId;
int id = CurrentTId;
return
(from ProcessThread th in Process.GetCurrentProcess().Threads
where th.Id == id

View File

@ -55,7 +55,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
{
get
{
return this.Game.CurrentAct;
return Game.CurrentAct;
}
}
@ -68,35 +68,35 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
/// <param name="game">The game is used to broadcast game messages to</param>
public QuestManager(Game game)
{
this.Game = game;
Game = game;
}
public void SetQuests()
{
this.Game.QuestProgress.SetQuests();
this.Game.SideQuestProgress.SetQuests();
this.Game.QuestSetuped = true;
Game.QuestProgress.SetQuests();
Game.SideQuestProgress.SetQuests();
Game.QuestSetuped = true;
}
public void ClearQuests()
{
this.Quests.Clear();
this.SideQuests.Clear();
Quests.Clear();
SideQuests.Clear();
}
public void ReloadQuests()
{
this.Quests.Clear();
this.Game.QuestProgress.SetQuests();
Quests.Clear();
Game.QuestProgress.SetQuests();
}
public void SetBounties()
{
this.Bounties.Clear();
Bounties.Clear();
var kill_boss_bounties = ItemGenerator.Bounties.Values
.Where(b => b.BountyData0.Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.KillBoss)
.Where(b => !this.Bounties.Select(b => b.LevelArea).Contains(b.BountyData0.LeveAreaSNO0))
.Where(b => !Bounties.Select(b => b.LevelArea).Contains(b.BountyData0.LeveAreaSNO0))
.OrderBy(b => FastRandom.Instance.Next())
.Select(b => new Bounty()
{
@ -125,15 +125,15 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
.Select(o => o.SNOName1.Id)
.ToList()
});
this.Bounties.AddRange(kill_boss_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A1).Take(1)); //A1
this.Bounties.AddRange(kill_boss_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A2).Take(1)); //A2
this.Bounties.AddRange(kill_boss_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A3).Take(1)); //A3
this.Bounties.AddRange(kill_boss_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A4).Take(1)); //A4
this.Bounties.AddRange(kill_boss_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A5).Take(1)); //A5
Bounties.AddRange(kill_boss_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A1).Take(1)); //A1
Bounties.AddRange(kill_boss_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A2).Take(1)); //A2
Bounties.AddRange(kill_boss_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A3).Take(1)); //A3
Bounties.AddRange(kill_boss_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A4).Take(1)); //A4
Bounties.AddRange(kill_boss_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A5).Take(1)); //A5
var kill_unique_bounties = ItemGenerator.Bounties.Values
.Where(b => b.BountyData0.Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.KillUnique)
.Where(b => !this.Bounties.Select(b => b.LevelArea).Contains(b.BountyData0.LeveAreaSNO0))
.Where(b => !Bounties.Select(b => b.LevelArea).Contains(b.BountyData0.LeveAreaSNO0))
.OrderBy(b => FastRandom.Instance.Next())
.GroupBy(b => b.BountyData0.LeveAreaSNO0)//b.QuestSteps.SelectMany(s => s.StepObjectiveSets).SelectMany(s => s.StepObjectives).Single(o => o.ObjectiveType == Mooege.Common.MPQ.FileFormats.QuestStepObjectiveType.KillAny).SNOName1.Id)
.Select(b => b.First())
@ -174,11 +174,11 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
.Select(o => o.SNOName1.Id)
.ToList()
});
this.Bounties.AddRange(kill_unique_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A1).Take(4)); //A1
this.Bounties.AddRange(kill_unique_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A2).Take(4)); //A2
this.Bounties.AddRange(kill_unique_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A3).Take(4)); //A3
this.Bounties.AddRange(kill_unique_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A4).Take(4)); //A4
this.Bounties.AddRange(kill_unique_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A5).Take(4)); //A5
Bounties.AddRange(kill_unique_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A1).Take(4)); //A1
Bounties.AddRange(kill_unique_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A2).Take(4)); //A2
Bounties.AddRange(kill_unique_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A3).Take(4)); //A3
Bounties.AddRange(kill_unique_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A4).Take(4)); //A4
Bounties.AddRange(kill_unique_bounties.Where(b => b.Act == DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A5).Take(4)); //A5
}
/// <summary>
@ -187,34 +187,34 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
/// <param name="snoQuest">snoID of the quest to advance</param>
public void Advance()
{
this.Quests[this.Game.CurrentQuest].Steps[this.Game.CurrentStep].Completed = true;
this.Game.CurrentStep = this.Quests[this.Game.CurrentQuest].Steps[this.Game.CurrentStep].NextStep;
this.Game.QuestProgress.QuestTriggers.Clear();
this.ClearQuestMarker();
Quests[Game.CurrentQuest].Steps[Game.CurrentStep].Completed = true;
Game.CurrentStep = Quests[Game.CurrentQuest].Steps[Game.CurrentStep].NextStep;
Game.QuestProgress.QuestTriggers.Clear();
ClearQuestMarker();
try
{
this.Quests[this.Game.CurrentQuest].Steps[this.Game.CurrentStep].OnAdvance.Invoke();
Quests[Game.CurrentQuest].Steps[Game.CurrentStep].OnAdvance.Invoke();
}
catch (Exception e)
{
Logger.WarnException(e, "Advance() exception caught:");
}
if (this.Quests[this.Game.CurrentQuest].Steps[this.Game.CurrentStep].NextStep != -1)
if (Quests[Game.CurrentQuest].Steps[Game.CurrentStep].NextStep != -1)
{
}
else
{
this.Quests[this.Game.CurrentQuest].Completed = true;
if (!this.Game.Empty)
Quests[Game.CurrentQuest].Completed = true;
if (!Game.Empty)
{
SaveQuestProgress(true);
Logger.Trace(" (Advance) quest {0} completed: {1}", this.Game.CurrentQuest, this.Quests[this.Game.CurrentQuest].Completed);
foreach (var player in this.Game.Players.Values)
Logger.Trace(" (Advance) quest {0} completed: {1}", Game.CurrentQuest, Quests[Game.CurrentQuest].Completed);
foreach (var player in Game.Players.Values)
{
int xpReward = (int)(this.Quests[this.Game.CurrentQuest].RewardXp * this.Game.XPModifier);
int goldReward = (int)(this.Quests[this.Game.CurrentQuest].RewardGold * this.Game.GoldModifier);
if (this.Game.CurrentQuest != 312429)
int xpReward = (int)(Quests[Game.CurrentQuest].RewardXp * Game.XPModifier);
int goldReward = (int)(Quests[Game.CurrentQuest].RewardGold * Game.GoldModifier);
if (Game.CurrentQuest != 312429)
{
player.InGameClient.SendMessage(new QuestStepCompleteMessage()
{
@ -223,7 +223,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
.SetReward(D3.Quests.QuestReward.CreateBuilder()
.SetGoldGranted(goldReward)
.SetXpGranted((ulong)xpReward)
.SetSnoQuest(this.Game.CurrentQuest)
.SetSnoQuest(Game.CurrentQuest)
)
.SetIsQuestComplete(true)
.Build()
@ -257,17 +257,17 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
player.UpdateExp(xpReward);
player.Inventory.AddGoldAmount(goldReward);
player.AddAchievementCounter(74987243307173, (uint)goldReward);
player.CheckQuestCriteria(this.Game.CurrentQuest);
player.CheckQuestCriteria(Game.CurrentQuest);
}
};
}
if (this.Quests[this.Game.CurrentQuest].NextQuest == -1) return;
this.Game.CurrentQuest = this.Quests[this.Game.CurrentQuest].NextQuest;
this.Game.CurrentStep = -1;
if (Quests[Game.CurrentQuest].NextQuest == -1) return;
Game.CurrentQuest = Quests[Game.CurrentQuest].NextQuest;
Game.CurrentStep = -1;
try
{
this.Quests[this.Game.CurrentQuest].Steps[this.Game.CurrentStep].OnAdvance.Invoke();
Quests[Game.CurrentQuest].Steps[Game.CurrentStep].OnAdvance.Invoke();
}
catch (Exception e)
{
@ -276,31 +276,31 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
//Пока только для одного квеста
// if (this.Game.CurrentQuest != 72221)
// if (this.Game.CurrentStep != -1)
this.Advance();
Advance();
}
if (!this.Game.Empty)
if (!Game.Empty)
{
RevealQuestProgress();
if (this.Quests[this.Game.CurrentQuest].Steps[this.Game.CurrentStep].Saveable)
if (Quests[Game.CurrentQuest].Steps[Game.CurrentStep].Saveable)
SaveQuestProgress(false);
}
OnQuestProgress();
this.AutoSetQuestMarker();
Logger.Trace(" (Advance) Advanced to quest {0}, step {1}", this.Game.CurrentQuest, this.Game.CurrentStep);
AutoSetQuestMarker();
Logger.Trace(" (Advance) Advanced to quest {0}, step {1}", Game.CurrentQuest, Game.CurrentStep);
}
public void SideAdvance()
{
if (this.Game.CurrentSideQuest == -1) return;
if (Game.CurrentSideQuest == -1) return;
this.Game.QuestTimer = null;
this.SideQuests[this.Game.CurrentSideQuest].Steps[this.Game.CurrentSideStep].Completed = true;
this.Game.CurrentSideStep = this.SideQuests[this.Game.CurrentSideQuest].Steps[this.Game.CurrentSideStep].NextStep;
this.Game.SideQuestProgress.QuestTriggers.Clear();
Game.QuestTimer = null;
SideQuests[Game.CurrentSideQuest].Steps[Game.CurrentSideStep].Completed = true;
Game.CurrentSideStep = SideQuests[Game.CurrentSideQuest].Steps[Game.CurrentSideStep].NextStep;
Game.SideQuestProgress.QuestTriggers.Clear();
try
{
this.SideQuests[this.Game.CurrentSideQuest].Steps[this.Game.CurrentSideStep].OnAdvance.Invoke();
SideQuests[Game.CurrentSideQuest].Steps[Game.CurrentSideStep].OnAdvance.Invoke();
}
catch (Exception e)
{
@ -309,16 +309,16 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
RevealSideQuestProgress();
if (this.SideQuests[this.Game.CurrentSideQuest].Steps[this.Game.CurrentSideStep].NextStep == -1 &&
this.SideQuests[this.Game.CurrentSideQuest].Steps[this.Game.CurrentSideStep] == this.SideQuests[this.Game.CurrentSideQuest].Steps.Last().Value)
if (SideQuests[Game.CurrentSideQuest].Steps[Game.CurrentSideStep].NextStep == -1 &&
SideQuests[Game.CurrentSideQuest].Steps[Game.CurrentSideStep] == SideQuests[Game.CurrentSideQuest].Steps.Last().Value)
{
this.SideQuests[this.Game.CurrentSideQuest].Completed = true;
Logger.Trace(" (SideAdvance) quest {0} completed: {1}", this.Game.CurrentSideQuest, this.SideQuests[this.Game.CurrentSideQuest].Completed);
SideQuests[Game.CurrentSideQuest].Completed = true;
Logger.Trace(" (SideAdvance) quest {0} completed: {1}", Game.CurrentSideQuest, SideQuests[Game.CurrentSideQuest].Completed);
foreach (var player in this.Game.Players.Values)
foreach (var player in Game.Players.Values)
{
int xpReward = (int)(this.SideQuests[this.Game.CurrentSideQuest].RewardXp * this.Game.XPModifier);
int goldReward = (int)(this.SideQuests[this.Game.CurrentSideQuest].RewardGold * this.Game.GoldModifier);
int xpReward = (int)(SideQuests[Game.CurrentSideQuest].RewardXp * Game.XPModifier);
int goldReward = (int)(SideQuests[Game.CurrentSideQuest].RewardGold * Game.GoldModifier);
player.InGameClient.SendMessage(new QuestStepCompleteMessage()
{
@ -327,7 +327,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
.SetReward(D3.Quests.QuestReward.CreateBuilder()
.SetGoldGranted(goldReward)
.SetXpGranted((ulong)xpReward)
.SetSnoQuest(this.Game.CurrentSideQuest)
.SetSnoQuest(Game.CurrentSideQuest)
)
.SetIsQuestComplete(true)
.Build()
@ -341,48 +341,48 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
player.AddAchievementCounter(74987243307173, (uint)goldReward);
int chance = this.Game.IsHardcore ? 6 : 2;
if (DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(100) < chance && this.Game.MonsterLevel >= 70)
int chance = Game.IsHardcore ? 6 : 2;
if (FastRandom.Instance.Next(100) < chance && Game.MonsterLevel >= 70)
{
player.World.SpawnRandomEquip(player, player, LootManager.Epic, player.Attributes[GameAttribute.Level]);
}
var toon = player.Toon.DBToon;
toon.EventsCompleted++;
this.Game.GameDBSession.SessionUpdate(toon);
player.CheckQuestCriteria(this.Game.CurrentSideQuest);
Game.GameDBSession.SessionUpdate(toon);
player.CheckQuestCriteria(Game.CurrentSideQuest);
};
this.Game.CurrentSideQuest = -1;
this.Game.CurrentSideStep = -1;
Game.CurrentSideQuest = -1;
Game.CurrentSideStep = -1;
}
OnQuestProgress();
Logger.Trace(" (SideAdvance) Advanced to side quest {0}, step {1}", this.Game.CurrentSideQuest, this.Game.CurrentSideStep);
Logger.Trace(" (SideAdvance) Advanced to side quest {0}, step {1}", Game.CurrentSideQuest, Game.CurrentSideStep);
}
public void LaunchSideQuest(int questId, bool forceAbandon = false)
{
if (!this.SideQuests.ContainsKey(questId)) return;
if (this.SideQuests[questId].Completed) return;
if (!SideQuests.ContainsKey(questId)) return;
if (SideQuests[questId].Completed) return;
if (this.Game.CurrentSideQuest != -1 && !forceAbandon) return;
if (Game.CurrentSideQuest != -1 && !forceAbandon) return;
this.Game.CurrentSideQuest = questId;
this.Game.CurrentSideStep = -1;
this.SideAdvance();
Game.CurrentSideQuest = questId;
Game.CurrentSideStep = -1;
SideAdvance();
}
public void AbandonSideQuest()
{
if (!this.SideQuests.ContainsKey(this.Game.CurrentSideQuest)) return;
if (this.SideQuests[this.Game.CurrentSideQuest].Completed) return;
if (!SideQuests.ContainsKey(Game.CurrentSideQuest)) return;
if (SideQuests[Game.CurrentSideQuest].Completed) return;
this.SideQuests[this.Game.CurrentSideQuest].Completed = true;
SideQuests[Game.CurrentSideQuest].Completed = true;
foreach (var player in this.Game.Players.Values)
foreach (var player in Game.Players.Values)
player.InGameClient.SendMessage(new QuestCounterMessage()
{
snoQuest = this.Game.CurrentSideQuest,
snoQuest = Game.CurrentSideQuest,
snoLevelArea = -1,
StepID = -1,
TaskIndex = 0,
@ -390,9 +390,9 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
Checked = 0,
});
if (this.Game.CurrentSideQuest == 120396)
if (Game.CurrentSideQuest == 120396)
{
foreach (var plr in this.Game.Players.Values)
foreach (var plr in Game.Players.Values)
{
if (plr.World.SNO == WorldSno.a2dun_zolt_timed01_level01)
{
@ -402,18 +402,18 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
}
}
this.Game.CurrentSideQuest = -1;
this.Game.CurrentSideStep = -1;
Game.CurrentSideQuest = -1;
Game.CurrentSideStep = -1;
}
public void AdvanceTo(int snoQuest, int stepId)
{
if (stepId == -1)
stepId = this.Quests[snoQuest].Steps[-1].NextStep;
stepId = Quests[snoQuest].Steps[-1].NextStep;
int cycle = 0;
while (!(this.Game.CurrentQuest == snoQuest && this.Game.CurrentStep == stepId) && this.Game.Working) //adjusting completed quests
while (!(Game.CurrentQuest == snoQuest && Game.CurrentStep == stepId) && Game.Working) //adjusting completed quests
{
this.Advance();
Advance();
cycle++;
if (cycle > 200) break;
}
@ -423,16 +423,16 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public void LaunchRiftQuestTimer(float duration, Action<int> onDone, int idSNO = 0)
{
foreach (var player in this.Game.Players.Values)
foreach (var player in Game.Players.Values)
{
};
this.QuestTimerEstimate = duration;
QuestTimerEstimate = duration;
this.Game.QuestTimer = SteppedTickTimer.WaitSecondsStepped(this.Game, 1f, duration, new Action<int>((q) =>
Game.QuestTimer = SteppedTickTimer.WaitSecondsStepped(Game, 1f, duration, new Action<int>((q) =>
{
this.QuestTimerEstimate -= 1f;
QuestTimerEstimate -= 1f;
}),
onDone);
@ -440,7 +440,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public void LaunchQuestTimer(int questId, float duration, Action<int> onDone, int Meterid = 0)
{
foreach (var player in this.Game.Players.Values)
foreach (var player in Game.Players.Values)
{
player.InGameClient.SendMessage(new QuestMeterMessage()
{
@ -450,18 +450,18 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
});
};
this.QuestTimerEstimate = duration;
QuestTimerEstimate = duration;
this.Game.QuestTimer = SteppedTickTimer.WaitSecondsStepped(this.Game, 1f, duration, new Action<int>((q) =>
Game.QuestTimer = SteppedTickTimer.WaitSecondsStepped(Game, 1f, duration, new Action<int>((q) =>
{
this.QuestTimerEstimate -= 1f;
foreach (var player in this.Game.Players.Values)
QuestTimerEstimate -= 1f;
foreach (var player in Game.Players.Values)
{
player.InGameClient.SendMessage(new QuestMeterMessage()
{
snoQuest = questId,
annMeter = Meterid,
flMeter = (this.QuestTimerEstimate / duration)
flMeter = (QuestTimerEstimate / duration)
});
};
}),
@ -470,26 +470,26 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public void CompleteObjective(int objId)
{
if (this.Quests[this.Game.CurrentQuest].Steps[this.Game.CurrentStep].Objectives[objId].Counter >= this.Quests[this.Game.CurrentQuest].Steps[this.Game.CurrentStep].Objectives[objId].Limit)
if (Quests[Game.CurrentQuest].Steps[Game.CurrentStep].Objectives[objId].Counter >= Quests[Game.CurrentQuest].Steps[Game.CurrentStep].Objectives[objId].Limit)
return;
Logger.Trace("(CompleteObjective) Completing objective through quest manager");
this.Quests[this.Game.CurrentQuest].Steps[this.Game.CurrentStep].Objectives[objId].Counter++;
Quests[Game.CurrentQuest].Steps[Game.CurrentStep].Objectives[objId].Counter++;
var objective = this.Quests[this.Game.CurrentQuest].Steps[this.Game.CurrentStep].Objectives[objId];
foreach (var player in this.Game.Players.Values)
var objective = Quests[Game.CurrentQuest].Steps[Game.CurrentStep].Objectives[objId];
foreach (var player in Game.Players.Values)
player.InGameClient.SendMessage(new QuestCounterMessage()
{
snoQuest = this.Game.CurrentQuest,
snoQuest = Game.CurrentQuest,
snoLevelArea = -1,
StepID = this.Game.CurrentStep,
StepID = Game.CurrentStep,
TaskIndex = objId,
Counter = objective.Counter,
Checked = objective.Counter < objective.Limit ? 0 : 1,
});
if (!this.Quests[this.Game.CurrentQuest].Steps[this.Game.CurrentStep].Objectives.Any(obj => obj.Counter < obj.Limit))
this.Advance();
if (!Quests[Game.CurrentQuest].Steps[Game.CurrentStep].Objectives.Any(obj => obj.Counter < obj.Limit))
Advance();
}
@ -499,12 +499,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
///
public void NotifyQuest(int value, bool complete)
{
foreach (var player in this.Game.Players.Values)
foreach (var player in Game.Players.Values)
player.InGameClient.SendMessage(new QuestCounterMessage()
{
snoQuest = this.Game.CurrentQuest,
snoQuest = Game.CurrentQuest,
snoLevelArea = -1,
StepID = this.Game.CurrentStep,
StepID = Game.CurrentStep,
TaskIndex = 0,
Counter = value,
Checked = complete ? 1 : 0,
@ -513,12 +513,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public void NotifySideQuest(int value, bool complete)
{
foreach (var player in this.Game.Players.Values)
foreach (var player in Game.Players.Values)
player.InGameClient.SendMessage(new QuestCounterMessage()
{
snoQuest = this.Game.CurrentSideQuest,
snoQuest = Game.CurrentSideQuest,
snoLevelArea = -1,
StepID = this.Game.CurrentSideStep,
StepID = Game.CurrentSideStep,
TaskIndex = 0,
Counter = value,
Checked = complete ? 1 : 0,
@ -530,12 +530,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
/// </summary>
public void NotifyBonus(int value, bool complete)
{
foreach (var player in this.Game.Players.Values)
foreach (var player in Game.Players.Values)
player.InGameClient.SendMessage(new QuestCounterMessage()
{
snoQuest = this.Game.CurrentQuest,
snoQuest = Game.CurrentQuest,
snoLevelArea = -1,
StepID = this.Game.CurrentStep,
StepID = Game.CurrentStep,
TaskIndex = 1,
Counter = value,
Checked = complete ? 1 : 0,
@ -544,12 +544,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public void AutoSetQuestMarker()
{
if (this.Game.QuestProgress.QuestTriggers.Count == 1)
if (Game.QuestProgress.QuestTriggers.Count == 1)
{
Logger.Trace("AutoSetQuestMarker()");
var trigger = this.Game.QuestProgress.QuestTriggers.First();
var trigger = Game.QuestProgress.QuestTriggers.First();
if (trigger.Value.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.InteractWithActor)
foreach (var world in this.Game.Worlds)
foreach (var world in Game.Worlds)
{
var actors = world.GetActorsBySNO((ActorSno)trigger.Key).Where(d => d.Visible);
Actor actor = null;
@ -575,7 +575,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
}
if (trigger.Value.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.HadConversation)
foreach (var world in this.Game.Worlds)
foreach (var world in Game.Worlds)
{
var actors = world.Actors.Values.Where(d => d.Visible && (d is InteractiveNPC) && (d as InteractiveNPC).Conversations.Any(c => c.ConversationSNO == trigger.Key));
Actor actor = null;
@ -604,7 +604,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public void SetBountyMarker(Player player)
{
foreach (var bounty in this.Bounties.Where(b => !b.Finished && b.Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.KillUnique))
foreach (var bounty in Bounties.Where(b => !b.Finished && b.Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.KillUnique))
{
var unique = player.World.GetActorsBySNO((ActorSno)bounty.Target).Where(u => !u.Dead).FirstOrDefault();
if (unique == null) continue;
@ -655,7 +655,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public void ClearQuestMarker()
{
foreach (var plr in this.Game.Players.Values)
foreach (var plr in Game.Players.Values)
plr.InGameClient.SendMessage(new MapMarkerInfoMessage
{
HashedName = StringHashHelper.HashItemName("QuestMarker"),
@ -676,20 +676,20 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public bool HasCurrentQuest(int snoQuest, int Step, bool strictFilter)
{
if (this.Quests.ContainsKey(snoQuest) || this.SideQuests.ContainsKey(snoQuest))
if (Quests.ContainsKey(snoQuest) || SideQuests.ContainsKey(snoQuest))
{
if (strictFilter)
{
if ((this.Game.CurrentQuest == snoQuest) && (this.Game.CurrentStep == Step)
if ((Game.CurrentQuest == snoQuest) && (Game.CurrentStep == Step)
||
(this.Game.CurrentSideQuest == snoQuest) && (this.Game.CurrentSideStep == Step))
(Game.CurrentSideQuest == snoQuest) && (Game.CurrentSideStep == Step))
return true;
}
else
{
if ((this.Game.CurrentQuest == snoQuest || snoQuest == -1) && (this.Game.CurrentStep == Step || Step == -1 || Step == 0)
if ((Game.CurrentQuest == snoQuest || snoQuest == -1) && (Game.CurrentStep == Step || Step == -1 || Step == 0)
||
(this.Game.CurrentSideQuest == snoQuest || snoQuest == -1) && (this.Game.CurrentSideStep == Step || Step == -1 || Step == 0))
(Game.CurrentSideQuest == snoQuest || snoQuest == -1) && (Game.CurrentSideStep == Step || Step == -1 || Step == 0))
return true;
}
}
@ -698,7 +698,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public bool HasQuest(int snoQuest)
{
return this.Quests.ContainsKey(snoQuest);
return Quests.ContainsKey(snoQuest);
}
public void SetQuestsForJoined(Player joinedPlayer)
@ -708,9 +708,9 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
joinedPlayer.InGameClient.SendMessage(new QuestUpdateMessage()
{
snoQuest = this.Game.CurrentQuest,
snoQuest = Game.CurrentQuest,
snoLevelArea = -1,
StepID = this.Game.CurrentStep,
StepID = Game.CurrentStep,
DisplayButton = true,
Failed = false
});
@ -718,13 +718,13 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public bool IsDone(int snoQuest)
{
return this.Quests.ContainsKey(snoQuest) && Quests[snoQuest].Completed;
return Quests.ContainsKey(snoQuest) && Quests[snoQuest].Completed;
}
public bool IsInQuestRange(DiIiS_NA.Core.MPQ.FileFormats.QuestRange range)
{
if (range.Header.SNOId == 312431) return (this.Game.CurrentAct == 3000);
if (range.Header.SNOId == 312431) return (Game.CurrentAct == 3000);
if (range.Header.SNOId == 214766) return true;
bool started = false;
@ -739,11 +739,11 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
started = true;
else
{
if (this.Quests.ContainsKey(range_entry.Start.SNOQuest) && this.Quests[range_entry.Start.SNOQuest].Steps.ContainsKey(range_entry.Start.StepID))
if (Quests.ContainsKey(range_entry.Start.SNOQuest) && Quests[range_entry.Start.SNOQuest].Steps.ContainsKey(range_entry.Start.StepID))
{
if (this.Quests[range_entry.Start.SNOQuest].Completed ||
this.Quests[range_entry.Start.SNOQuest].Steps[range_entry.Start.StepID].Completed ||
(this.Game.CurrentQuest == range_entry.Start.SNOQuest && this.Game.CurrentStep == range_entry.Start.StepID)) // rumford conversation needs current step
if (Quests[range_entry.Start.SNOQuest].Completed ||
Quests[range_entry.Start.SNOQuest].Steps[range_entry.Start.StepID].Completed ||
(Game.CurrentQuest == range_entry.Start.SNOQuest && Game.CurrentStep == range_entry.Start.StepID)) // rumford conversation needs current step
started = true;
}
//else logger.Warn("QuestRange {0} references unknown quest {1}", range.Header.SNOId, range.Start.SNOQuest);
@ -755,10 +755,10 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
ended = false;
else
{
if (this.Quests.ContainsKey(range_entry.End.SNOQuest) && this.Quests[range_entry.End.SNOQuest].Steps.ContainsKey(range_entry.End.StepID))
if (Quests.ContainsKey(range_entry.End.SNOQuest) && Quests[range_entry.End.SNOQuest].Steps.ContainsKey(range_entry.End.StepID))
{
if (this.Quests[range_entry.End.SNOQuest].Completed ||
this.Quests[range_entry.End.SNOQuest].Steps[range_entry.End.StepID].Completed)
if (Quests[range_entry.End.SNOQuest].Completed ||
Quests[range_entry.End.SNOQuest].Steps[range_entry.End.StepID].Completed)
ended = true;
}
//else logger.Warn("QuestRange {0} references unknown quest {1}", range.Header.SNOId, range.End.SNOQuest);
@ -781,13 +781,13 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public void RevealQuestProgress()
{
foreach (var player in this.Game.Players.Values)
foreach (var player in Game.Players.Values)
{
player.InGameClient.SendMessage(new QuestUpdateMessage()
{
snoQuest = this.Game.CurrentQuest,
snoQuest = Game.CurrentQuest,
snoLevelArea = -1,
StepID = this.Game.CurrentStep,
StepID = Game.CurrentStep,
DisplayButton = true,
Failed = false
});
@ -796,13 +796,13 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public void RevealSideQuestProgress()
{
foreach (var player in this.Game.Players.Values)
foreach (var player in Game.Players.Values)
{
player.InGameClient.SendMessage(new QuestUpdateMessage()
{
snoQuest = this.Game.CurrentSideQuest,
snoQuest = Game.CurrentSideQuest,
snoLevelArea = -1,
StepID = this.Game.CurrentSideStep,
StepID = Game.CurrentSideStep,
DisplayButton = true,
Failed = false
});
@ -811,30 +811,30 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public void SaveQuestProgress(bool questCompleted)
{
foreach (var player in this.Game.Players.Values)
foreach (var player in Game.Players.Values)
{
player.Toon.CurrentAct = this.CurrentAct;
player.Toon.CurrentQuestId = this.Game.CurrentQuest;
player.Toon.CurrentQuestStepId = this.Game.CurrentStep;
player.Toon.CurrentAct = CurrentAct;
player.Toon.CurrentQuestId = Game.CurrentQuest;
player.Toon.CurrentQuestStepId = Game.CurrentStep;
List<DBQuestHistory> query = this.Game.GameDBSession.SessionQueryWhere<DBQuestHistory>(
dbi => dbi.DBToon.Id == player.Toon.PersistentID && dbi.QuestId == this.Game.CurrentQuest);
List<DBQuestHistory> query = Game.GameDBSession.SessionQueryWhere<DBQuestHistory>(
dbi => dbi.DBToon.Id == player.Toon.PersistentID && dbi.QuestId == Game.CurrentQuest);
if (query.Count == 0)
{
var questHistory = new DBQuestHistory();
questHistory.DBToon = player.Toon.DBToon;
questHistory.QuestId = this.Game.CurrentQuest;
questHistory.QuestStep = this.Game.CurrentStep;
this.Game.GameDBSession.SessionSave(questHistory);
questHistory.QuestId = Game.CurrentQuest;
questHistory.QuestStep = Game.CurrentStep;
Game.GameDBSession.SessionSave(questHistory);
}
else
{
var questHistory = query.First();
if (this.Quests[this.Game.CurrentQuest].Steps[questHistory.QuestStep].Completed)
if (Quests[Game.CurrentQuest].Steps[questHistory.QuestStep].Completed)
{
questHistory.QuestStep = this.Game.CurrentStep;
questHistory.QuestStep = Game.CurrentStep;
if (questCompleted) questHistory.isCompleted = true;
this.Game.GameDBSession.SessionUpdate(questHistory);
Game.GameDBSession.SessionUpdate(questHistory);
}
}
}
@ -879,18 +879,18 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
};
public void CheckKillMonster(int levelArea)
{
if (this.Finished) return;
if (Finished) return;
if (levelArea == 19943) levelArea = 19780;
if (this.Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.KillUnique && this.LevelArea == levelArea && AdditionalTargetNeed != AdditionalTargetCounter)
if (Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.KillUnique && LevelArea == levelArea && AdditionalTargetNeed != AdditionalTargetCounter)
{
var Quest = DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[Core.Types.SNO.SNOGroup.Quest][BountySNOid];
this.AdditionalTargetCounter++;
AdditionalTargetCounter++;
foreach (var player in this.QuestManager.Game.Players.Values)
foreach (var player in QuestManager.Game.Players.Values)
player.InGameClient.SendMessage(new QuestCounterMessage()
{
snoQuest = this.BountySNOid,
snoLevelArea = this.LevelArea,
snoQuest = BountySNOid,
snoLevelArea = LevelArea,
StepID = 4,
TaskIndex = 0,
Counter = AdditionalTargetCounter,
@ -903,21 +903,21 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
//435868
//220789
if (this.Finished) return;
if (this.Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.KillBoss && this.Target == snoId)
if (Finished) return;
if (Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.KillBoss && Target == snoId)
{
this.Complete();
Complete();
}
if (this.Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.KillUnique && (this.LevelArea == levelArea || (LevelAreaOverrides.ContainsKey(levelArea) && LevelAreaOverrides[levelArea] == this.LevelArea)))
if (Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.KillUnique && (LevelArea == levelArea || (LevelAreaOverrides.ContainsKey(levelArea) && LevelAreaOverrides[levelArea] == LevelArea)))
{
this.AdditionalTargetCounter++;
foreach (var player in this.QuestManager.Game.Players.Values)
AdditionalTargetCounter++;
foreach (var player in QuestManager.Game.Players.Values)
{
List<MapSystem.Scene> Scenes = new List<MapSystem.Scene>();
int MonsterCount = 0;
foreach (var scene in this.QuestManager.Game.GetWorld(world).Scenes.Values)
foreach (var scene in QuestManager.Game.GetWorld(world).Scenes.Values)
if (!scene.SceneSNO.Name.ToLower().Contains("filler"))
if (scene.Specification.SNOLevelAreas[0] == this.LevelArea)
if (scene.Specification.SNOLevelAreas[0] == LevelArea)
{
Scenes.Add(scene);
foreach (var act in scene.Actors)
@ -928,12 +928,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
player.InGameClient.SendMessage(new QuestCounterMessage()
{
snoQuest = this.BountySNOid,
snoLevelArea = this.LevelArea,
snoQuest = BountySNOid,
snoLevelArea = LevelArea,
StepID = 4,
TaskIndex = this.AdditionalTaskId,
Counter = this.AdditionalTargetCounter,
Checked = (this.AdditionalTargetNeed <= this.AdditionalTargetCounter) ? 1 : 0
TaskIndex = AdditionalTaskId,
Counter = AdditionalTargetCounter,
Checked = (AdditionalTargetNeed <= AdditionalTargetCounter) ? 1 : 0
});
if (MonsterCount < AdditionalTargetCounter + 20)
{
@ -944,36 +944,36 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
while (true)
{
SP = new Core.Types.Math.Vector3D(SSV.X + RandomHelper.Next(0, 240), SSV.Y + RandomHelper.Next(0, 240), SSV.Z);
if (this.QuestManager.Game.GetWorld(world).CheckLocationForFlag(SP, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
if (QuestManager.Game.GetWorld(world).CheckLocationForFlag(SP, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
break;
}
this.QuestManager.Game.GetWorld(world).SpawnMonster((ActorSno)GeneratorsSystem.SpawnGenerator.Spawns[this.LevelArea].melee[FastRandom.Instance.Next(GeneratorsSystem.SpawnGenerator.Spawns[this.LevelArea].melee.Count())], SP);
QuestManager.Game.GetWorld(world).SpawnMonster((ActorSno)GeneratorsSystem.SpawnGenerator.Spawns[LevelArea].melee[FastRandom.Instance.Next(GeneratorsSystem.SpawnGenerator.Spawns[LevelArea].melee.Count())], SP);
MonsterCount++;
}
} //Нужен дополнительный спаун монстров, их мало
}
if (this.Target == snoId)
if (Target == snoId)
{
this.TargetKilled = true;
foreach (var player in this.QuestManager.Game.Players.Values)
TargetKilled = true;
foreach (var player in QuestManager.Game.Players.Values)
player.InGameClient.SendMessage(new QuestCounterMessage()
{
snoQuest = this.BountySNOid,
snoLevelArea = this.LevelArea,
snoQuest = BountySNOid,
snoLevelArea = LevelArea,
StepID = 4,
TaskIndex = this.TargetTaskId,
TaskIndex = TargetTaskId,
Counter = 1,
Checked = 1
});
}
if (!TargetSpawned)
if (this.QuestManager.Game.GetWorld(world).GetActorBySNO((ActorSno)this.Target) == null)
if (QuestManager.Game.GetWorld(world).GetActorBySNO((ActorSno)Target) == null)
{
List<MapSystem.Scene> Scenes = new List<MapSystem.Scene>();
foreach (var scene in this.QuestManager.Game.GetWorld(world).Scenes.Values)
foreach (var scene in QuestManager.Game.GetWorld(world).Scenes.Values)
{
if (!scene.SceneSNO.Name.ToLower().Contains("filler"))
if (scene.Specification.SNOLevelAreas[0] == this.LevelArea)
if (scene.Specification.SNOLevelAreas[0] == LevelArea)
Scenes.Add(scene);
}
@ -982,35 +982,35 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
while (true)
{
SP = new Core.Types.Math.Vector3D(SSV.X + RandomHelper.Next(0, 240), SSV.Y + RandomHelper.Next(0, 240), SSV.Z);
if (this.QuestManager.Game.GetWorld(world).CheckLocationForFlag(SP, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
if (QuestManager.Game.GetWorld(world).CheckLocationForFlag(SP, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
break;
}
this.QuestManager.Game.GetWorld(world).SpawnMonster((ActorSno)this.Target, SP);
QuestManager.Game.GetWorld(world).SpawnMonster((ActorSno)Target, SP);
TargetSpawned = true;
}
if (this.AdditionalTargetNeed <= this.AdditionalTargetCounter && this.TargetKilled)
this.Complete();
if (AdditionalTargetNeed <= AdditionalTargetCounter && TargetKilled)
Complete();
}
if (this.Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.ClearDungeon && this.World == world)
if (Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.ClearDungeon && World == world)
{
if (this.QuestManager.Game.WorldCleared(world))
this.Complete();
if (QuestManager.Game.WorldCleared(world))
Complete();
}
}
public void CheckLevelArea(int snoId)
{
if (this.Finished) return;
if (this.LevelAreaChecks.Contains(snoId))
if (Finished) return;
if (LevelAreaChecks.Contains(snoId))
{
foreach (var player in this.QuestManager.Game.Players.Values)
foreach (var player in QuestManager.Game.Players.Values)
player.InGameClient.SendMessage(new QuestCounterMessage()
{
snoQuest = this.BountySNOid,
snoLevelArea = this.LevelArea,
snoQuest = BountySNOid,
snoLevelArea = LevelArea,
StepID = 4,
TaskIndex = this.LevelAreaChecks.IndexOf(snoId),
TaskIndex = LevelAreaChecks.IndexOf(snoId),
Counter = 1,
Checked = 1
});
@ -1019,28 +1019,28 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
public void Complete()
{
foreach (var player in this.QuestManager.Game.Players.Values)
foreach (var player in QuestManager.Game.Players.Values)
{
var xpReward = 1000 * player.Level * (1 + (player.Level / 7)) * this.QuestManager.Game.XPModifier;
if (this.Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.KillUnique)
var xpReward = 1000 * player.Level * (1 + (player.Level / 7)) * QuestManager.Game.XPModifier;
if (Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.KillUnique)
xpReward *= 1.8f;
if (this.Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.ClearDungeon)
if (Type == DiIiS_NA.Core.MPQ.FileFormats.BountyData.BountyType.ClearDungeon)
xpReward *= 5f;
var goldReward = 10000 * this.QuestManager.Game.GoldModifier;
var goldReward = 10000 * QuestManager.Game.GoldModifier;
player.InGameClient.SendMessage(new QuestUpdateMessage()
{
snoQuest = this.BountySNOid,
snoLevelArea = this.LevelArea,
snoQuest = BountySNOid,
snoLevelArea = LevelArea,
StepID = 3,
DisplayButton = true,
Failed = false
});
player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Quest.QuestStepCompleteMessage()
player.InGameClient.SendMessage(new QuestStepCompleteMessage()
{
QuestStepComplete = D3.Quests.QuestStepComplete.CreateBuilder()
.SetIsQuestComplete(true)
.SetReward(D3.Quests.QuestReward.CreateBuilder()
.SetSnoQuest(this.BountySNOid)
.SetSnoQuest(BountySNOid)
.SetXpGranted((ulong)xpReward)
.SetGoldGranted((int)goldReward)
.Build()
@ -1056,26 +1056,26 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
player.Toon.TotalBountiesHardcore++;
player.UpdateAchievementCounter(412, 1);
}
this.Finished = true;
this.QuestManager.Game.BountiesCompleted[this.Act]++;
if (this.QuestManager.Game.BountiesCompleted[this.Act] == 5)
Finished = true;
QuestManager.Game.BountiesCompleted[Act]++;
if (QuestManager.Game.BountiesCompleted[Act] == 5)
{
switch (this.Act)
switch (Act)
{
case DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A1:
this.QuestManager.LaunchSideQuest(356988, true); //x1_AdventureMode_BountyTurnin_A1
QuestManager.LaunchSideQuest(356988, true); //x1_AdventureMode_BountyTurnin_A1
break;
case DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A2:
this.QuestManager.LaunchSideQuest(356994, true); //x1_AdventureMode_BountyTurnin_A2
QuestManager.LaunchSideQuest(356994, true); //x1_AdventureMode_BountyTurnin_A2
break;
case DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A3:
this.QuestManager.LaunchSideQuest(356996, true); //x1_AdventureMode_BountyTurnin_A3
QuestManager.LaunchSideQuest(356996, true); //x1_AdventureMode_BountyTurnin_A3
break;
case DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A4:
this.QuestManager.LaunchSideQuest(356999, true); //x1_AdventureMode_BountyTurnin_A4
QuestManager.LaunchSideQuest(356999, true); //x1_AdventureMode_BountyTurnin_A4
break;
case DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A5:
this.QuestManager.LaunchSideQuest(357001, true); //x1_AdventureMode_BountyTurnin_A5
QuestManager.LaunchSideQuest(357001, true); //x1_AdventureMode_BountyTurnin_A5
break;
}
}

View File

@ -54,9 +54,9 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
public static void RegenerateDensity()
{
//Logger.Info("Regenerating spawn density map...");
foreach (var spawn in SpawnGenerator.Spawns)
foreach (var spawn in Spawns)
{
SpawnGenerator.Spawns[spawn.Key].additional_density = FastRandom.Instance.Next(0, 6);
Spawns[spawn.Key].additional_density = FastRandom.Instance.Next(0, 6);
}
}

View File

@ -62,10 +62,10 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
public DRLGEmuScene(int _SnoID, int _Weather, int _Music, int _LevelArea)
{
this.SnoID = _SnoID;
this.Weather = _Weather;
this.Music = _Music;
this.LevelArea = _LevelArea;
SnoID = _SnoID;
Weather = _Weather;
Music = _Music;
LevelArea = _LevelArea;
}
}
@ -88,7 +88,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
public WorldGenerator(Game game)
{
this.Game = game;
Game = game;
}
public static Dictionary<int, int> DefaultConversationLists = new Dictionary<int, int>();
@ -98,12 +98,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
public void CheckLevelArea(World world, int levelAreaSNO)
{
if (SpawnGenerator.Spawns.ContainsKey(levelAreaSNO) && SpawnGenerator.Spawns[levelAreaSNO].lazy_load == true)
if (!this.LoadedLevelAreas.Contains(levelAreaSNO))
if (!LoadedLevelAreas.Contains(levelAreaSNO))
{
this.LoadedLevelAreas.Add(levelAreaSNO);
LoadedLevelAreas.Add(levelAreaSNO);
// Load monsters for level area
foreach (var scene in this.LazyLevelAreas[levelAreaSNO])
foreach (var scene in LazyLevelAreas[levelAreaSNO])
{
LoadMonstersLayout(world, levelAreaSNO, scene);
}
@ -120,7 +120,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
var worldAsset = MPQStorage.Data.Assets[SNOGroup.Worlds][(int)worldSNO];
Dictionary<int, List<Scene>> levelAreas = new Dictionary<int, List<Scene>>();
World world = new World(this.Game, worldSNO);
World world = new World(Game, worldSNO);
bool DRLGEmuActive = false;
world.worldData = (DiIiS_NA.Core.MPQ.FileFormats.World)worldAsset.Data;
if (worldSNO == WorldSno.a2dun_swr_swr_to_oasis_level01)
@ -129,11 +129,11 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
//445736 - p4_forest_snow_icecave_01
if (world.worldData.DynamicWorld && !worldSNO.IsNotDynamicWorld()) //Gardens of Hope - 2 lvl is NOT random
{
if (!GameServer.Config.Instance.DRLGemu)
if (!Config.Instance.DRLGemu)
Logger.Warn("DRLG-Emu деактивирован.");
string DRLGVersion = "1.8";
var WorldContainer = DBSessions.WorldSession.Query<DRLG_Container>().Where(dbt => dbt.WorldSNO == (int)worldSNO).ToList();
if (WorldContainer.Count > 0 && worldSNO != WorldSno.a1trdun_level05_templar && GameServer.Config.Instance.DRLGemu)
if (WorldContainer.Count > 0 && worldSNO != WorldSno.a1trdun_level05_templar && Config.Instance.DRLGemu)
{
DRLGEmuActive = true;
Logger.Warn("Мир - {0} [{1}] динамический! Найден контейнер, DRLG-Emu v{2} Активирован!", worldAsset.Name, worldAsset.SNOId, DRLGVersion);
@ -246,7 +246,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
Logger.Info("DRLG work - Completed");
}
var clusters = new Dictionary<int, DiIiS_NA.Core.MPQ.FileFormats.SceneCluster>();
var clusters = new Dictionary<int, SceneCluster>();
if (world.worldData.SceneClusterSet != null)
{
foreach (var cluster in world.worldData.SceneClusterSet.SceneClusters)
@ -273,10 +273,10 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
}
// For each cluster generate a list of randomly selected subcenes /fasbat
var clusterSelected = new Dictionary<int, List<DiIiS_NA.Core.MPQ.FileFormats.SubSceneEntry>>();
var clusterSelected = new Dictionary<int, List<SubSceneEntry>>();
foreach (var cID in clusterCount.Keys)
{
var selected = new List<DiIiS_NA.Core.MPQ.FileFormats.SubSceneEntry>();
var selected = new List<SubSceneEntry>();
clusterSelected[cID] = selected;
var count = clusterCount[cID];
foreach (var group in clusters[cID].SubSceneGroups) // First select from each subscene group /fasbat
@ -327,11 +327,11 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
else
{
var entries = clusterSelected[sceneChunk.SceneSpecification.ClusterID];
DiIiS_NA.Core.MPQ.FileFormats.SubSceneEntry subSceneEntry = null;
SubSceneEntry subSceneEntry = null;
if (entries.Count > 0)
{
subSceneEntry = RandomHelper.RandomItem<DiIiS_NA.Core.MPQ.FileFormats.SubSceneEntry>(entries, entry => 1);
subSceneEntry = RandomHelper.RandomItem<SubSceneEntry>(entries, entry => 1);
entries.Remove(subSceneEntry);
}
else
@ -442,7 +442,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
}
foreach (var door in world.GetActorsBySNO(ActorSno._house_door_trout_newtristram))
door.Destroy();
if (this.Game.CurrentAct == 3000)
if (Game.CurrentAct == 3000)
{
var TownDoor = world.GetActorBySNO(ActorSno._trout_newtristram_gate_town);
TownDoor.Attributes[GameAttribute.Team_Override] = 2;
@ -485,7 +485,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
break;
case WorldSno.a2dun_swr_swr_to_oasis_level01: //Убиваем ненужный портал в локации если игра не в режиме приключений
if (this.Game.CurrentAct != 3000)
if (Game.CurrentAct != 3000)
foreach (var wayp in world.GetActorsBySNO(ActorSno._waypoint)) wayp.Destroy();
break;
case WorldSno.a2dun_zolt_head_random01: //Убираем кровь кула
@ -498,7 +498,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
port.Destroy();
break;
case WorldSno.a3dun_keep_level04: //Убиваем ненужный портал в локации если игра не в режиме приключений
if (this.Game.CurrentAct != 3000)
if (Game.CurrentAct != 3000)
foreach (var wayp in world.GetActorsBySNO(ActorSno._waypoint)) wayp.Destroy();
break;
#region Убиваем все порталы в демонические разломы на первом этаже садов(теперь и на втором этаже), а то чет дохера их), создавать будет скрипт уничтожения скверны. Добалвяем голос Дьябло на несколько участков
@ -2075,7 +2075,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
Dictionary<int, TileInfo> acceptedTiles = new Dictionary<int, TileInfo>();
//By default use all tiles
acceptedTiles = tiles;
foreach (TileExits exit in System.Enum.GetValues(typeof(TileExits)))
foreach (TileExits exit in Enum.GetValues(typeof(TileExits)))
{
if (exitStatus[exit] == ExitStatus.Open) mustHaveExits += (int)exit;
@ -2094,7 +2094,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
else
return GetTileInfo(acceptedTiles.Where(
pair => pair.Value.TileType == tileType &&
!System.Enum.IsDefined(typeof(TileExits), pair.Value.ExitDirectionBits)
!Enum.IsDefined(typeof(TileExits), pair.Value.ExitDirectionBits)
).ToDictionary(pair => pair.Key, pair => pair.Value), mustHaveExits);
}
@ -2341,7 +2341,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
if (!SpawnGenerator.Spawns.ContainsKey(wid)) break;
if (SpawnGenerator.Spawns[wid].lazy_load == true)
{
this.LazyLevelAreas.Add(wid, levelAreas.First().Value);
LazyLevelAreas.Add(wid, levelAreas.First().Value);
break;
}
else
@ -2378,7 +2378,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
Y = (float)(y * 2.4 + scene.Position.Y) + (float)(FastRandom.Instance.NextDouble() * 20 - 10),
Z = scene.NavMesh.Squares[y * scene.NavMesh.SquaresCountX + x].Z + scene.Position.Z
},
Quaternion = Quaternion.FacingRotation((float)(FastRandom.Instance.NextDouble() * System.Math.PI * 2))
Quaternion = Quaternion.FacingRotation((float)(FastRandom.Instance.NextDouble() * Math.PI * 2))
},
world,
new TagMap()
@ -2421,7 +2421,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
Y = (float)(y * 2.4 + scene.Position.Y) + (float)(FastRandom.Instance.NextDouble() * 20 - 10),
Z = scene.NavMesh.Squares[y * scene.NavMesh.SquaresCountX + x].Z + scene.Position.Z
},
Quaternion = Quaternion.FacingRotation((float)(FastRandom.Instance.NextDouble() * System.Math.PI * 2))
Quaternion = Quaternion.FacingRotation((float)(FastRandom.Instance.NextDouble() * Math.PI * 2))
},
world,
new TagMap()
@ -2438,7 +2438,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
if (!SpawnGenerator.Spawns.ContainsKey(la)) break;
if (SpawnGenerator.Spawns[la].lazy_load == true)
{
this.LazyLevelAreas.Add(la, levelAreas[la]);
LazyLevelAreas.Add(la, levelAreas[la]);
break;
}
else
@ -2475,7 +2475,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
Y = (float)(y * 2.4 + scene.Position.Y) + (float)(FastRandom.Instance.NextDouble() * 20 - 10),
Z = scene.NavMesh.Squares[y * scene.NavMesh.SquaresCountX + x].Z + scene.Position.Z
},
Quaternion = Quaternion.FacingRotation((float)(FastRandom.Instance.NextDouble() * System.Math.PI * 2))
Quaternion = Quaternion.FacingRotation((float)(FastRandom.Instance.NextDouble() * Math.PI * 2))
},
world,
new TagMap()
@ -2518,7 +2518,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
Y = (float)(y * 2.4 + scene.Position.Y) + (float)(FastRandom.Instance.NextDouble() * 20 - 10),
Z = scene.NavMesh.Squares[y * scene.NavMesh.SquaresCountX + x].Z + scene.Position.Z
},
Quaternion = Quaternion.FacingRotation((float)(FastRandom.Instance.NextDouble() * System.Math.PI * 2))
Quaternion = Quaternion.FacingRotation((float)(FastRandom.Instance.NextDouble() * Math.PI * 2))
},
world,
new TagMap()
@ -2538,7 +2538,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
List<Affix> packAffixes = new List<Affix>();
int packs_count = world.worldData.DynamicWorld ? 5 : 4;
packs_count += (this.Game.Difficulty / 3);
packs_count += (Game.Difficulty / 3);
if (world.worldData.DRLGParams != null && world.worldData.DRLGParams.Count > 0)
{
@ -2548,7 +2548,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
packs_count += 2;
}
if (this.Game.Difficulty > 4)
if (Game.Difficulty > 4)
packs_count += SpawnGenerator.Spawns[la].additional_density;
var groupId = 0;
@ -2589,7 +2589,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
Y = (float)(y * 2.4 + scene.Position.Y) + (float)(FastRandom.Instance.NextDouble() * 20 - 10),
Z = scene.NavMesh.Squares[y * scene.NavMesh.SquaresCountX + x].Z + scene.Position.Z
},
Quaternion = Quaternion.FacingRotation((float)(FastRandom.Instance.NextDouble() * System.Math.PI * 2))
Quaternion = Quaternion.FacingRotation((float)(FastRandom.Instance.NextDouble() * Math.PI * 2))
},
world,
new TagMap(),
@ -2632,7 +2632,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
Y = (float)(y * 2.4 + scene.Position.Y) + (float)(FastRandom.Instance.NextDouble() * 20 - 10),
Z = scene.NavMesh.Squares[y * scene.NavMesh.SquaresCountX + x].Z + scene.Position.Z
},
Quaternion = Quaternion.FacingRotation((float)(FastRandom.Instance.NextDouble() * System.Math.PI * 2))
Quaternion = Quaternion.FacingRotation((float)(FastRandom.Instance.NextDouble() * Math.PI * 2))
},
world,
new TagMap(),
@ -2775,15 +2775,15 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
/// <summary>
/// Loads all markersets of a scene and looks for the one with the subscene position
/// </summary>
private Vector3D FindSubScenePosition(DiIiS_NA.Core.MPQ.FileFormats.SceneChunk sceneChunk)
private Vector3D FindSubScenePosition(SceneChunk sceneChunk)
{
var mpqScene = MPQStorage.Data.Assets[SNOGroup.Scene][sceneChunk.SNOHandle.Id].Data as DiIiS_NA.Core.MPQ.FileFormats.Scene;
foreach (var markerSet in mpqScene.MarkerSets)
{
var mpqMarkerSet = MPQStorage.Data.Assets[SNOGroup.MarkerSet][markerSet].Data as DiIiS_NA.Core.MPQ.FileFormats.MarkerSet;
var mpqMarkerSet = MPQStorage.Data.Assets[SNOGroup.MarkerSet][markerSet].Data as MarkerSet;
foreach (var marker in mpqMarkerSet.Markers)
if (marker.Type == DiIiS_NA.Core.MPQ.FileFormats.MarkerType.SubScenePosition)
if (marker.Type == MarkerType.SubScenePosition)
return marker.PRTransform.Vector3D;
}
return null;

View File

@ -37,7 +37,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
foreach (var affixDefinition in data.Affixes)
{
if (affixDefinition.Hash == this.AffixGbid) return affixDefinition;
if (affixDefinition.Hash == AffixGbid) return affixDefinition;
}
}
}
@ -49,7 +49,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
get
{
return (this.Definition == null ? 0 : this.Definition.Cost);
return (Definition == null ? 0 : Definition.Cost);
}
}
@ -57,7 +57,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
get
{
return (this.Definition == null ? 0 : this.Definition.AffixLevel);
return (Definition == null ? 0 : Definition.AffixLevel);
}
}
@ -67,7 +67,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
get
{
return (int)(this.Price * (1 + this.Score));
return (int)(Price * (1 + Score));
}
set { }
}

View File

@ -36,7 +36,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
static AffixGenerator()
{
foreach (var asset in DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[SNOGroup.GameBalance].Values)
foreach (var asset in MPQStorage.Data.Assets[SNOGroup.GameBalance].Values)
{
GameBalance data = asset.Data as GameBalance;
if (data != null && data.Type == BalanceType.AffixList)
@ -324,7 +324,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
for (int i = 0; i < 6; i++)
{
if (item.ItemDefinition.LegendaryAffixFamily[i] != -1)
AffixGenerator.AddAffix(item, AffixGenerator.FindSuitableAffix(item, item.ItemDefinition.LegendaryAffixFamily[i], item.ItemDefinition.MaxAffixLevel[i], (item.ItemDefinition.I38[i] == 1)));
AddAffix(item, FindSuitableAffix(item, item.ItemDefinition.LegendaryAffixFamily[i], item.ItemDefinition.MaxAffixLevel[i], (item.ItemDefinition.I38[i] == 1)));
}
}
}

View File

@ -18,8 +18,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
public HandledItemAttribute(params string[] names)
{
this.Names = new List<string>();
this.Names.AddRange(names);
Names = new List<string>();
Names.AddRange(names);
}
}
}

View File

@ -18,8 +18,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
public HandledTypeAttribute(params string[] types)
{
this.Types = new List<string>();
this.Types.AddRange(types);
Types = new List<string>();
Types.AddRange(types);
}
}
}

View File

@ -32,9 +32,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem.Implementations
{
player.PlayLore(LoreSNOId, true);
}
if (player.GroundItems.ContainsKey(this.GlobalID))
player.GroundItems.Remove(this.GlobalID);
this.Destroy();
if (player.GroundItems.ContainsKey(GlobalID))
player.GroundItems.Remove(GlobalID);
Destroy();
}
}
}

View File

@ -26,21 +26,21 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem.Implementations
//Debug.Assert(target != null);
if (target == null) return;
target.Attributes[GameAttribute.DyeType] = this.Attributes[GameAttribute.DyeType];
target.DBInventory.DyeType = this.Attributes[GameAttribute.DyeType];
target.Attributes[GameAttribute.DyeType] = Attributes[GameAttribute.DyeType];
target.DBInventory.DyeType = Attributes[GameAttribute.DyeType];
player.World.Game.GameDBSession.SessionUpdate(target.DBInventory);
player.Inventory.SendVisualInventory(player);
if (this.GBHandle.GBID == 1866876233 || this.GBHandle.GBID == 1866876234) return;
if (GBHandle.GBID == 1866876233 || GBHandle.GBID == 1866876234) return;
if (this.Attributes[GameAttribute.ItemStackQuantityLo] <= 1)
if (Attributes[GameAttribute.ItemStackQuantityLo] <= 1)
player.Inventory.DestroyInventoryItem(this); // No more dyes!
else
{
this.UpdateStackCount(--this.Attributes[GameAttribute.ItemStackQuantityLo]); // Just remove one
this.Attributes.SendChangedMessage(player.InGameClient);
UpdateStackCount(--Attributes[GameAttribute.ItemStackQuantityLo]); // Just remove one
Attributes.SendChangedMessage(player.InGameClient);
}
}
}

View File

@ -11,7 +11,7 @@
public override void OnTargeted(PlayerSystem.Player player, MessageSystem.Message.Definitions.World.TargetMessage message)
{
player.EnableStoneOfRecall();
this.Destroy();
Destroy();
}
}
}

View File

@ -58,7 +58,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
get
{
return ItemGenerator.GetItemDefinition(this.GBHandle.GBID);
return ItemGenerator.GetItemDefinition(GBHandle.GBID);
}
}
@ -66,7 +66,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
get
{
return ItemGroup.FromHash(this.ItemDefinition.ItemTypesGBID);
return ItemGroup.FromHash(ItemDefinition.ItemTypesGBID);
}
}
@ -76,8 +76,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
get
{
if (IsWeapon(this.ItemType)) return 485534122;
if (IsHelm(this.ItemType)) return 3851110;
if (IsWeapon(ItemType)) return 485534122;
if (IsHelm(ItemType)) return 3851110;
return 109305;
}
}
@ -91,7 +91,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
get
{
return this.AffixList.Select(a => a.Rating).Sum() + (int)this.Gems.Select(g => g.ItemDefinition.Cost * 6f).Sum();
return AffixList.Select(a => a.Rating).Sum() + (int)Gems.Select(g => g.ItemDefinition.Cost * 6f).Sum();
}
set { }
}
@ -133,16 +133,16 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
public override bool HasWorldLocation
{
get { return this.Owner == null; }
get { return Owner == null; }
}
public override InventoryLocationMessageData InventoryLocationMessage(Player plr)
{
return new InventoryLocationMessageData
{
OwnerID = (this.Owner != null) ? this.Owner.DynamicID(plr) : 0,
EquipmentSlot = this.EquipmentSlot,
InventoryLocation = this.InventoryLocation
OwnerID = (Owner != null) ? Owner.DynamicID(plr) : 0,
EquipmentSlot = EquipmentSlot,
InventoryLocation = InventoryLocation
};
}
@ -155,10 +155,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
return new InvLoc
{
OwnerID = (this.Owner != null) ? this.Owner.DynamicID(plr) : 0,
EquipmentSlot = this.EquipmentSlot,
Row = this.InventoryLocation.Y,
Column = this.InventoryLocation.X
OwnerID = (Owner != null) ? Owner.DynamicID(plr) : 0,
EquipmentSlot = EquipmentSlot,
Row = InventoryLocation.Y,
Column = InventoryLocation.X
};
}
@ -167,35 +167,35 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
public Item(World world, ItemTable definition, IEnumerable<Affix> affixList, string serializedGameAttributeMap, int count = 1)
: base(world, (ActorSno)definition.SNOActor)
{
this.GBHandle.GBID = definition.Hash;
GBHandle.GBID = definition.Hash;
SetInitialValues(definition);
this.Attributes.FillBySerialized(serializedGameAttributeMap);
if (this.Attributes[GameAttribute.Seed] == 0)
Attributes.FillBySerialized(serializedGameAttributeMap);
if (Attributes[GameAttribute.Seed] == 0)
{
this.Attributes[GameAttribute.Seed] = DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next();
Attributes[GameAttribute.Seed] = FastRandom.Instance.Next();
//this.Attributes[GameAttribute.Seed] = 0;
this.Attributes[GameAttribute.Item_Quality_Level] = 1;
this.Attributes[GameAttribute.TeamID] = 0;
Attributes[GameAttribute.Item_Quality_Level] = 1;
Attributes[GameAttribute.TeamID] = 0;
}
//for (int i = 50; i < 60; i++)
//Attributes[GameAttribute.Requirement, 57] = 10;
this.Attributes[GameAttribute.ItemStackQuantityLo] = count;
Attributes[GameAttribute.ItemStackQuantityLo] = count;
Attributes[GameAttribute.Loot_2_0_Drop] = true;
this.AffixList.Clear();
this.AffixList.AddRange(affixList);
AffixList.Clear();
AffixList.AddRange(affixList);
//this.Attributes[GameAttribute.EnchantAffix] = -758203990;
//this.Attributes[GameAttribute.EnchantAffix, 0] = -758203990;
//this.Attributes[GameAttribute.EnchantAffix, 1] = -758203990;
//this.Attributes[GameAttribute.EnchantRangeVal] = 1;
//*
if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType) || Item.IsOffhand(this.ItemType) || (Item.IsPotion(this.ItemType) && this.ItemDefinition.Name.Contains("Legendary")) || Item.IsAccessory(this.ItemType))
if (IsArmor(ItemType) || IsWeapon(ItemType) || IsOffhand(ItemType) || (IsPotion(ItemType) && ItemDefinition.Name.Contains("Legendary")) || IsAccessory(ItemType))
{
//Attributes[GameAttribute.Requirement, 64] = 0;
var reqLevel = (definition.RequiredLevel % 10 != 0) ? definition.RequiredLevel - 1 : definition.RequiredLevel;
var level = Math.Max(this.AffixList.Any() ? this.AffixList.Select(a => a.ItemLevel).Max() : 0, reqLevel);
var level = Math.Max(AffixList.Any() ? AffixList.Select(a => a.ItemLevel).Max() : 0, reqLevel);
Attributes[GameAttribute.Requirement, 57] = Math.Max(level - Attributes[GameAttribute.Item_Level_Requirement_Reduction], 0);
}
@ -225,38 +225,38 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
private void SetInitialValues(ItemTable definition)
{
this.ItemLevel = definition.ItemLevel;
this.GBHandle.Type = (int)ActorType.Gizmo;
this.EquipmentSlot = 0;
this.InventoryLocation = new Vector2D { X = 0, Y = 0 };
this.Scale = 1f;
this.RotationW = 0.0f;
this.RotationAxis.Set(0.0f, 0.0f, 1.0f);
this.CurrentState = ItemState.Normal;
ItemLevel = definition.ItemLevel;
GBHandle.Type = (int)ActorType.Gizmo;
EquipmentSlot = 0;
InventoryLocation = new Vector2D { X = 0, Y = 0 };
Scale = 1f;
RotationW = 0.0f;
RotationAxis.Set(0.0f, 0.0f, 1.0f);
CurrentState = ItemState.Normal;
//flags: 0x01 - socketable, 0x20 - blinking
this.Field2 = 0x1f;
this.Field7 = -1;
this.CollFlags = 0;
this.NameSNO = ActorSno.__NONE;
this.Field10 = 0x00;
Field2 = 0x1f;
Field7 = -1;
CollFlags = 0;
NameSNO = ActorSno.__NONE;
Field10 = 0x00;
this.Attributes[GameAttribute.TeamID] = 0;
Attributes[GameAttribute.TeamID] = 0;
}
public Item(MapSystem.World world, ItemTable definition, int ForceQualityLevel = -1, bool crafted = false, int seed = -1)
public Item(World world, ItemTable definition, int ForceQualityLevel = -1, bool crafted = false, int seed = -1)
: base(world, (ActorSno)definition.SNOActor)
{
this.GBHandle.GBID = definition.Hash;
GBHandle.GBID = definition.Hash;
SetInitialValues(definition);
this.ItemHasChanges = true;
ItemHasChanges = true;
Attributes[GameAttribute.IsCrafted] = crafted;
Attributes[GameAttribute.Item_Quality_Level] = 1;
Attributes[GameAttribute.Loot_2_0_Drop] = true;
if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType) || Item.IsOffhand(this.ItemType) || Item.IsAccessory(this.ItemType) || Item.IsShard(this.ItemType))
if (IsArmor(ItemType) || IsWeapon(ItemType) || IsOffhand(ItemType) || IsAccessory(ItemType) || IsShard(ItemType))
Attributes[GameAttribute.Item_Quality_Level] = RandomHelper.Next(8);
if (this.ItemType.Usable.HasFlag(ItemFlags.AtLeastMagical) && Attributes[GameAttribute.Item_Quality_Level] < 3)
if (ItemType.Usable.HasFlag(ItemFlags.AtLeastMagical) && Attributes[GameAttribute.Item_Quality_Level] < 3)
Attributes[GameAttribute.Item_Quality_Level] = 3;
if (definition.Name.ToLower().Contains("unique") || definition.Quality == ItemTable.ItemQuality.Legendary)
Attributes[GameAttribute.Item_Quality_Level] = 9;
@ -266,27 +266,27 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
Attributes[GameAttribute.Item_Quality_Level] = 9;
}
if (this.ItemDefinition.Name.ToLower().Contains("unique_gem"))
if (ItemDefinition.Name.ToLower().Contains("unique_gem"))
{
Attributes[GameAttribute.Item_Quality_Level] = 9;
if (!this.Attributes.Contains(GameAttribute.Jewel_Rank))
if (!Attributes.Contains(GameAttribute.Jewel_Rank))
Attributes[GameAttribute.Jewel_Rank] = 1;
//Attributes[GameAttribute.Jewel_Rank] = 1;
}
if (this.ItemDefinition.Name.ToLower().Contains("norm_season"))
if (ItemDefinition.Name.ToLower().Contains("norm_season"))
{
Attributes[GameAttribute.Item_Quality_Level] = 9;
}
if (this.ItemDefinition.Name.ToLower().StartsWith("p71_ethereal"))
if (ItemDefinition.Name.ToLower().StartsWith("p71_ethereal"))
{
Attributes[GameAttribute.Item_Quality_Level] = 9;
Attributes[GameAttribute.Attacks_Per_Second_Item] += 1.1f;
Attributes[GameAttribute.Damage_Weapon_Min, 0] = 15 + (this.World.Game.InitialMonsterLevel * 1.7f);
if (this.World.Game.InitialMonsterLevel > 70)
Attributes[GameAttribute.Damage_Weapon_Min, 0] = 15 + (World.Game.InitialMonsterLevel * 1.7f);
if (World.Game.InitialMonsterLevel > 70)
Attributes[GameAttribute.Damage_Weapon_Min, 0] *= 20f;
else if (this.World.Game.InitialMonsterLevel > 60)
else if (World.Game.InitialMonsterLevel > 60)
Attributes[GameAttribute.Damage_Weapon_Min, 0] *= 14f;
Attributes[GameAttribute.Damage_Weapon_Delta, 0] = 15;
@ -297,28 +297,28 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
Attributes[GameAttribute.ItemStackQuantityLo] = 1;
if (seed == -1)
Attributes[GameAttribute.Seed] = DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(); //unchecked((int)2286800181);
Attributes[GameAttribute.Seed] = FastRandom.Instance.Next(); //unchecked((int)2286800181);
else
Attributes[GameAttribute.Seed] = seed;
//Attributes[GameAttribute.Seed] = 0;
//Attributes[GameAttribute.Item_Quality_Level] = 1;
this.RandomGenerator = new ItemRandomHelper(Attributes[GameAttribute.Seed]);
this.RandomGenerator.Next();
if (Item.IsArmor(this.ItemType))
RandomGenerator = new ItemRandomHelper(Attributes[GameAttribute.Seed]);
RandomGenerator.Next();
if (IsArmor(ItemType))
{
if (!crafted)
this.RandomGenerator.Next();
RandomGenerator.Next();
if (Attributes[GameAttribute.Item_Quality_Level] >= 5 && Attributes[GameAttribute.Item_Quality_Level] <= 7)
this.RandomGenerator.Next();
RandomGenerator.Next();
}
this.RandomGenerator.ReinitSeed();
RandomGenerator.ReinitSeed();
if (Item.IsWeapon(this.ItemType) && !crafted)
if (IsWeapon(ItemType) && !crafted)
{
this.RandomGenerator.Next();
this.RandomGenerator.Next();
RandomGenerator.Next();
RandomGenerator.Next();
}
ApplyWeaponSpecificOptions(definition);
@ -340,7 +340,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
if (Attributes[GameAttribute.Item_Quality_Level] > 1)
AffixGenerator.Generate(this, affixNumber);
if (Item.IsShard(this.ItemType))
if (IsShard(ItemType))
Attributes[GameAttribute.Item_Quality_Level] = 1;
@ -364,15 +364,15 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
#endif
if (Attributes[GameAttribute.Item_Quality_Level] == 9)
{
this.Attributes[GameAttribute.MinimapActive] = true;
Attributes[GameAttribute.MinimapActive] = true;
}
if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType) || Item.IsOffhand(this.ItemType) || (Item.IsPotion(this.ItemType) && this.ItemDefinition.Name.Contains("Legendary")) || Item.IsAccessory(this.ItemType))
if (IsArmor(ItemType) || IsWeapon(ItemType) || IsOffhand(ItemType) || (IsPotion(ItemType) && ItemDefinition.Name.Contains("Legendary")) || IsAccessory(ItemType))
{
var a = Attributes[GameAttribute.Requirement, 57];
var reqLevel = (definition.RequiredLevel % 10 != 0) ? definition.RequiredLevel - 1 : definition.RequiredLevel;
var level = Math.Max(this.AffixList.Any() ? this.AffixList.Select(a => a.ItemLevel).Max() : 0, reqLevel);
var level = Math.Max(AffixList.Any() ? AffixList.Select(a => a.ItemLevel).Max() : 0, reqLevel);
Attributes[GameAttribute.Requirement, 57] = Math.Max(level - Attributes[GameAttribute.Item_Level_Requirement_Reduction], 0);
a = Attributes[GameAttribute.Requirement, 57];
}
@ -384,7 +384,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
else
Attributes[GameAttribute.Item_Level_Requirement_Override] = (int)Attributes[GameAttribute.Requirement, 57];
if (this.ItemDefinition.Name.ToLower().StartsWith("p71_ethereal"))
if (ItemDefinition.Name.ToLower().StartsWith("p71_ethereal"))
{
AffixGenerator.AddAffix(this, 1661455571, true); //1661455571
}
@ -394,20 +394,20 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
public void Identify()
{
this.Unidentified = false;
this.DBInventory.Unidentified = false;
this.Attributes[GameAttribute.Unidentified] = false;
Unidentified = false;
DBInventory.Unidentified = false;
Attributes[GameAttribute.Unidentified] = false;
this.Owner.World.Game.GameDBSession.SessionUpdate(this.DBInventory);
if (this.Owner is Player)
Owner.World.Game.GameDBSession.SessionUpdate(DBInventory);
if (Owner is Player)
{
this.Unreveal(this.Owner as Player);
this.Reveal(this.Owner as Player);
if (this.ItemDefinition.Name.Contains("Unique"))
Unreveal(Owner as Player);
Reveal(Owner as Player);
if (ItemDefinition.Name.Contains("Unique"))
{
(this.Owner as Player).UniqueItemIdentified(this.DBInventory.Id);
(Owner as Player).UniqueItemIdentified(DBInventory.Id);
//if (Program.MaxLevel == 70)
(this.Owner as Player).UnlockTransmog(this.ItemDefinition.Hash);
(Owner as Player).UnlockTransmog(ItemDefinition.Hash);
}
}
}
@ -434,7 +434,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
Attributes[GameAttribute.Damage_Weapon_Min, 0] += UniqueItems.GetWeaponDamageMin(hash);
Attributes[GameAttribute.Damage_Weapon_Delta, 0] += UniqueItems.GetWeaponDamageDelta(hash);
if (IsWeapon(this.ItemType))
if (IsWeapon(ItemType))
{
if (Attributes[GameAttribute.Damage_Weapon_Min, 0] == 0)
Attributes[GameAttribute.Damage_Weapon_Min, 0] = 34;
@ -562,7 +562,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
Attributes[GameAttribute.Armor_Item] += UniqueItems.GetArmor(hash);
//Unique items level scaling
if (IsArmor(this.ItemType))
if (IsArmor(ItemType))
if (Attributes[GameAttribute.Armor_Item] == 0)
Attributes[GameAttribute.Armor_Item] = 30;
@ -599,33 +599,33 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
public void UpdateDurability(int newDurability)
{
Attributes[GameAttribute.Durability_Cur] = newDurability;
this.DBInventory.Durability = newDurability;
this.Owner.World.Game.GameDBSession.SessionUpdate(this.DBInventory);
DBInventory.Durability = newDurability;
Owner.World.Game.GameDBSession.SessionUpdate(DBInventory);
}
public void UpdateTransmog(int newTransmogGBID)
{
Attributes[GameAttribute.TransmogGBID] = newTransmogGBID;
this.DBInventory.TransmogGBID = newTransmogGBID;
this.Owner.World.Game.GameDBSession.SessionUpdate(this.DBInventory);
DBInventory.TransmogGBID = newTransmogGBID;
Owner.World.Game.GameDBSession.SessionUpdate(DBInventory);
}
public void SaveAttributes()
{
this.DBInventory.Attributes = this.Attributes.Serialize();
this.Owner.World.Game.GameDBSession.SessionUpdate(this.DBInventory);
DBInventory.Attributes = Attributes.Serialize();
Owner.World.Game.GameDBSession.SessionUpdate(DBInventory);
}
public void UpdateStackCount(int newCount)
{
if (newCount > 0)
{
if (this.DBInventory == null) return;
this.Attributes[GameAttribute.ItemStackQuantityLo] = newCount;
this.Attributes.SendChangedMessage((Owner as Player).InGameClient);
if (DBInventory == null) return;
Attributes[GameAttribute.ItemStackQuantityLo] = newCount;
Attributes.SendChangedMessage((Owner as Player).InGameClient);
this.DBInventory.Count = newCount;
this.Owner.World.Game.GameDBSession.SessionUpdate(this.DBInventory);
DBInventory.Count = newCount;
Owner.World.Game.GameDBSession.SessionUpdate(DBInventory);
}
}
@ -654,7 +654,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
foreach (var effect in definition.Attribute)
{
float result;
if (FormulaScript.Evaluate(effect.Formula.ToArray(), this.RandomGenerator, out result))
if (FormulaScript.Evaluate(effect.Formula.ToArray(), RandomGenerator, out result))
{
//Logger.Debug("Randomized value for attribute " + GameAttribute.Attributes[effect.AttributeId].Name + " is " + result);
@ -683,8 +683,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
return new VisualItem()
{
GbId = (this.Attributes[GameAttribute.TransmogGBID] == -1 ? this.GBHandle.GBID : this.Attributes[GameAttribute.TransmogGBID]),
DyeType = this.Attributes[GameAttribute.DyeType],
GbId = (Attributes[GameAttribute.TransmogGBID] == -1 ? GBHandle.GBID : Attributes[GameAttribute.TransmogGBID]),
DyeType = Attributes[GameAttribute.DyeType],
ItemEffectType = 0,//Mooege.Common.Helpers.Math.FastRandom.Instance.Next(1, 14),
EffectLevel = -1//Mooege.Common.Helpers.Math.FastRandom.Instance.Next(1, 30)
};
@ -694,7 +694,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
public D3.Hero.VisualItem GetVisualItem()
{
var visualItem = D3.Hero.VisualItem.CreateBuilder()
.SetGbid((this.Attributes[GameAttribute.TransmogGBID] == -1 ? this.GBHandle.GBID : this.Attributes[GameAttribute.TransmogGBID]))
.SetGbid((Attributes[GameAttribute.TransmogGBID] == -1 ? GBHandle.GBID : Attributes[GameAttribute.TransmogGBID]))
.SetDyeType(Attributes[GameAttribute.DyeType])
.SetEffectLevel(0)
.SetItemEffectType(-1)
@ -704,10 +704,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
public int GetPrice()
{
int price = this.ItemDefinition.Cost;
int price = ItemDefinition.Cost;
//if (this.AffixList.Count == 0)
// price *= (1 + this.ItemDefinition.BuyCostMultiplier);
foreach (var affix in this.AffixList)
foreach (var affix in AffixList)
{
price += affix.Price;
}
@ -842,42 +842,42 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
public void SetInventoryLocation(int equipmentSlot, int column, int row)
{
this.EquipmentSlot = equipmentSlot;
this.InventoryLocation.X = column;
this.InventoryLocation.Y = row;
if (this.Owner is PlayerSystem.Player)
EquipmentSlot = equipmentSlot;
InventoryLocation.X = column;
InventoryLocation.Y = row;
if (Owner is Player)
{
var player = (this.Owner as PlayerSystem.Player);
if (!this.Reveal(player))
var player = (Owner as Player);
if (!Reveal(player))
{
player.InGameClient.SendMessage(this.ACDInventoryPositionMessage(player));
player.InGameClient.SendMessage(ACDInventoryPositionMessage(player));
}
}
}
public void SetNewWorld(World world)
{
if (this.World == world)
if (World == world)
return;
this.World = world;
World = world;
}
public void Drop(Player owner, Vector3D position)
{
this.Owner = owner;
this.EnterWorld(position);
Owner = owner;
EnterWorld(position);
}
public override void OnTargeted(Player player, TargetMessage message)
{
player.Inventory.RefreshInventoryToClient();
switch (this.SNO)
switch (SNO)
{
case ActorSno._tieredlootrunkey_0:
player.Toon.BigPortalKey++;
this.Destroy();
Destroy();
break;
default:
player.Inventory.PickUp(this);
@ -923,7 +923,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
public virtual void OnRequestUse(Player player, Item target, int actionId, WorldPlace worldPlace)
{
if (IsPotion(this.ItemType)) //if item is health potion
if (IsPotion(ItemType)) //if item is health potion
{
if (player.Attributes[GameAttribute.Hitpoints_Cur] == player.Attributes[GameAttribute.Hitpoints_Max])
return;
@ -943,40 +943,40 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
return;
}
if (IsRecipe(this.ItemType)) //if item is crafting recipe
if (IsRecipe(ItemType)) //if item is crafting recipe
{
Logger.Trace("Learning recipe...");
for (int i = 0; i < 10; i++)
{
if (this.ItemDefinition.RecipeToGrant[i] != -1)
player.LearnRecipe(player.ArtisanInteraction, this.ItemDefinition.RecipeToGrant[i]);
if (ItemDefinition.RecipeToGrant[i] != -1)
player.LearnRecipe(player.ArtisanInteraction, ItemDefinition.RecipeToGrant[i]);
else
break;
}
for (int i = 0; i < 8; i++)
{
if (this.ItemDefinition.TransmogsToGrant[i] != -1)
player.UnlockTransmog(this.ItemDefinition.TransmogsToGrant[i]);
if (ItemDefinition.TransmogsToGrant[i] != -1)
player.UnlockTransmog(ItemDefinition.TransmogsToGrant[i]);
else
break;
}
if (this.GBHandle.GBID == 1549850924) //Arma Haereticorum additional transmog
if (GBHandle.GBID == 1549850924) //Arma Haereticorum additional transmog
{
player.UnlockTransmog(974107120);
return;
}
if (this.Attributes[GameAttribute.ItemStackQuantityLo] <= 1)
if (Attributes[GameAttribute.ItemStackQuantityLo] <= 1)
player.Inventory.DestroyInventoryItem(this); // No more recipes!
else
{
this.UpdateStackCount(--this.Attributes[GameAttribute.ItemStackQuantityLo]); // Just remove one
this.Attributes.SendChangedMessage(player.InGameClient);
UpdateStackCount(--Attributes[GameAttribute.ItemStackQuantityLo]); // Just remove one
Attributes.SendChangedMessage(player.InGameClient);
}
return;
}
if (IsTreasureBag(this.ItemType))
if (IsTreasureBag(ItemType))
{
Logger.Warn("Treasure Bag system v0.2");
string[] items = new string[1];
@ -1022,7 +1022,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
Moneys.AddCurrency(Craft6Data);
Moneys.AddCurrency(Craft7Data);
#endregion
switch (this.GBHandle.GBID)
switch (GBHandle.GBID)
{
#region Дар Хедрига
case -1249067449:
@ -1137,42 +1137,42 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
return;
}
if (this.GBHandle.GBID == 237118774) //AngelWings_Blue
if (GBHandle.GBID == 237118774) //AngelWings_Blue
{
SwitchWingsBuff(player, 208706);
return;
}
if (this.GBHandle.GBID == -1424453175) //AngelWings_Red
if (GBHandle.GBID == -1424453175) //AngelWings_Red
{
SwitchWingsBuff(player, 317139);
return;
}
if (this.GBHandle.GBID == -1736870778) //BugWings
if (GBHandle.GBID == -1736870778) //BugWings
{
SwitchWingsBuff(player, 255336);
return;
}
if (this.GBHandle.GBID == -1364948604) //x1_AngelWings_Imperius
if (GBHandle.GBID == -1364948604) //x1_AngelWings_Imperius
{
SwitchWingsBuff(player, 378292);
return;
}
if (this.GBHandle.GBID == -762694428) //WoDFlag
if (GBHandle.GBID == -762694428) //WoDFlag
{
SwitchWingsBuff(player, 375412);
return;
}
if (IsDye(this.ItemType)) //if item is dye
if (IsDye(ItemType)) //if item is dye
{
if (target == null) return;
target.Attributes[GameAttribute.DyeType] = this.Attributes[GameAttribute.DyeType];
target.Attributes[GameAttribute.DyeType] = Attributes[GameAttribute.DyeType];
target.Attributes.BroadcastChangedIfRevealed();
target.DBInventory.DyeType = this.Attributes[GameAttribute.DyeType];
target.DBInventory.DyeType = Attributes[GameAttribute.DyeType];
player.World.Game.GameDBSession.SessionUpdate(target.DBInventory);
@ -1189,7 +1189,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
player.GrantAchievement(74987243307157);
}
switch ((uint)this.GBHandle.GBID)
switch ((uint)GBHandle.GBID)
{
case 4060770506:
player.GrantCriteria(74987243311599);
@ -1246,14 +1246,14 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
break;
}
if (this.GBHandle.GBID == 1866876233 || this.GBHandle.GBID == 1866876234) return; //CE dyes
if (GBHandle.GBID == 1866876233 || GBHandle.GBID == 1866876234) return; //CE dyes
if (this.Attributes[GameAttribute.ItemStackQuantityLo] <= 1)
if (Attributes[GameAttribute.ItemStackQuantityLo] <= 1)
player.Inventory.DestroyInventoryItem(this); // No more dyes!
else
{
this.UpdateStackCount(--this.Attributes[GameAttribute.ItemStackQuantityLo]); // Just remove one
this.Attributes.SendChangedMessage(player.InGameClient);
UpdateStackCount(--Attributes[GameAttribute.ItemStackQuantityLo]); // Just remove one
Attributes.SendChangedMessage(player.InGameClient);
}
@ -1261,7 +1261,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
return;
}
Logger.Warn("OnRequestUse(): gbid {0} not implemented", this.GBHandle.GBID);
Logger.Warn("OnRequestUse(): gbid {0} not implemented", GBHandle.GBID);
}
private void SwitchWingsBuff(Player player, int powerId)
@ -1295,12 +1295,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
public override bool Reveal(Player player)
{
if (this.CurrentState == ItemState.PickingUp && HasWorldLocation)
if (CurrentState == ItemState.PickingUp && HasWorldLocation)
return false;
foreach (var gplayer in player.World.Game.Players.Values)
{
if (gplayer.GroundItems.ContainsKey(this.GlobalID) && gplayer != player)
if (gplayer.GroundItems.ContainsKey(GlobalID) && gplayer != player)
return false;
}
@ -1318,24 +1318,24 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
player.InGameClient.SendMessage(new AffixMessage()
{
ActorID = DynamicID(player),
Field1 = (this.Unidentified ? 0x00000002 : 0x00000001),
Field1 = (Unidentified ? 0x00000002 : 0x00000001),
aAffixGBIDs = affixGbis,
});
}
foreach (var gem in this.Gems)
foreach (var gem in Gems)
gem.Reveal(player);
if (this.RareItemName != null)
if (RareItemName != null)
player.InGameClient.SendMessage(new RareItemNameMessage()
{
ann = DynamicID(player),
RareItemName = new RareItemName()
{
Field0 = this.RareItemName.ItemNameIsPrefix,
snoAffixStringList = this.RareItemName.SnoAffixStringList,
AffixStringListIndex = this.RareItemName.AffixStringListIndex,
ItemStringListIndex = this.RareItemName.ItemStringListIndex
Field0 = RareItemName.ItemNameIsPrefix,
snoAffixStringList = RareItemName.SnoAffixStringList,
AffixStringListIndex = RareItemName.AffixStringListIndex,
ItemStringListIndex = RareItemName.ItemStringListIndex
}
});
return true;
@ -1348,7 +1348,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
return false;
}
foreach (var gem in this.Gems)
foreach (var gem in Gems)
gem.Unreveal(player);
return base.Unreveal(player);
@ -1358,16 +1358,16 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
public override void OnPlayerApproaching(Player player)
{
if (PowerMath.Distance2D(player.Position, this.Position) < 3f && !this.ZPositionCorrected)
if (PowerMath.Distance2D(player.Position, Position) < 3f && !ZPositionCorrected)
{
foreach (var gplayer in player.World.Game.Players.Values)
{
if (gplayer.GroundItems.ContainsKey(this.GlobalID) && gplayer != player)
if (gplayer.GroundItems.ContainsKey(GlobalID) && gplayer != player)
return;
}
this.ZPositionCorrected = true;
this.Teleport(new Vector3D(this.Position.X, this.Position.Y, player.Position.Z));
ZPositionCorrected = true;
Teleport(new Vector3D(Position.X, Position.Y, player.Position.Z));
}
}
}

View File

@ -107,7 +107,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
foreach (var asset in MPQStorage.Data.Assets[SNOGroup.Quest].Values)
{
DiIiS_NA.Core.MPQ.FileFormats.Quest data = asset.Data as DiIiS_NA.Core.MPQ.FileFormats.Quest;
Quest data = asset.Data as Quest;
if (data != null && data.QuestType == QuestType.Bounty)
{
if (data.BountyData0.ActData == BountyData.ActT.Invalid)
@ -124,13 +124,13 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
data.BountyData0.ActData = BountyData.ActT.A5;
}
//fixes for bugged bounties
if (data.BountyData0.Type != BountyData.BountyType.CompleteEvent && data.QuestSteps.SelectMany(s => s.StepObjectiveSets).SelectMany(s => s.StepObjectives).Any(o => o.ObjectiveType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.CompleteQuest))
if (data.BountyData0.Type != BountyData.BountyType.CompleteEvent && data.QuestSteps.SelectMany(s => s.StepObjectiveSets).SelectMany(s => s.StepObjectives).Any(o => o.ObjectiveType == QuestStepObjectiveType.CompleteQuest))
data.BountyData0.Type = BountyData.BountyType.CompleteEvent;
if (data.BountyData0.Type == BountyData.BountyType.KillUnique && data.QuestSteps.SelectMany(s => s.StepObjectiveSets).SelectMany(s => s.StepObjectives).Any(o => o.ObjectiveType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.KillAll))
if (data.BountyData0.Type == BountyData.BountyType.KillUnique && data.QuestSteps.SelectMany(s => s.StepObjectiveSets).SelectMany(s => s.StepObjectives).Any(o => o.ObjectiveType == QuestStepObjectiveType.KillAll))
data.BountyData0.Type = BountyData.BountyType.ClearDungeon;
if (data.BountyData0.Type == BountyData.BountyType.KillUnique && !data.QuestSteps.SelectMany(s => s.StepObjectiveSets).SelectMany(s => s.StepObjectives).Any(o => o.ObjectiveType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.KillAny))
if (data.BountyData0.Type == BountyData.BountyType.KillUnique && !data.QuestSteps.SelectMany(s => s.StepObjectiveSets).SelectMany(s => s.StepObjectives).Any(o => o.ObjectiveType == QuestStepObjectiveType.KillAny))
continue;
if (data.BountyData0.Type == BountyData.BountyType.KillUnique && data.QuestSteps.SelectMany(s => s.StepObjectiveSets).SelectMany(s => s.StepObjectives).Where(o => o.ObjectiveType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.KillMonster).Count() > 1)
if (data.BountyData0.Type == BountyData.BountyType.KillUnique && data.QuestSteps.SelectMany(s => s.StepObjectiveSets).SelectMany(s => s.StepObjectives).Where(o => o.ObjectiveType == QuestStepObjectiveType.KillMonster).Count() > 1)
continue;
Bounties.Add(data.Header.SNOId, data);
@ -324,7 +324,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
//Logger.Info("LoadItems()");
foreach (var asset in MPQStorage.Data.Assets[SNOGroup.Quest].Values)
{
DiIiS_NA.Core.MPQ.FileFormats.Quest data = asset.Data as DiIiS_NA.Core.MPQ.FileFormats.Quest;
Quest data = asset.Data as Quest;
if (data != null)
{
Logger.Info("-------------");
@ -356,7 +356,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
Recipes.TryAdd(recipeDefinition.Hash, recipeDefinition);
if (recipeDefinition.SNORecipe > 0 && MPQStorage.Data.Assets[SNOGroup.Recipe].ContainsKey(recipeDefinition.SNORecipe))
{
var reward = (MPQStorage.Data.Assets[SNOGroup.Recipe][recipeDefinition.SNORecipe].Data as DiIiS_NA.Core.MPQ.FileFormats.Recipe).ItemSpecifierData.ItemGBId;
var reward = (MPQStorage.Data.Assets[SNOGroup.Recipe][recipeDefinition.SNORecipe].Data as Recipe).ItemSpecifierData.ItemGBId;
if (!CraftOnlyItems.Contains(reward))
CraftOnlyItems.Add(reward);
}
@ -434,7 +434,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
{
foreach (var asset in MPQStorage.Data.Assets[SNOGroup.Actor].Values)
{
DiIiS_NA.Core.MPQ.FileFormats.Actor data = asset.Data as DiIiS_NA.Core.MPQ.FileFormats.Actor;
Actor data = asset.Data as Actor;
if (data != null && data.TagMap.ContainsKey(ActorKeys.Lore))
{
if (Lore.ContainsKey(data.TagMap[ActorKeys.Lore].Id)) continue;
@ -562,7 +562,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
}*/
foreach (var asset in MPQStorage.Data.Assets[SNOGroup.Power].Values)
{
DiIiS_NA.Core.MPQ.FileFormats.Power data = asset.Data as DiIiS_NA.Core.MPQ.FileFormats.Power;
Power data = asset.Data as Power;
Logger.Info("{0} => array(\"name\" => \"{1}\", \"desc\" => \"{2}\"),", data.Header.SNOId, asset.Name, data.LuaName);
/*Logger.Info("---------------------------------------------------------");
Logger.Info("asset name: {0}", asset.Name);
@ -1497,9 +1497,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
owner.World.CachedItems[instance.Id] = itm;
if (instance.FirstGem != -1) itm.Gems.Add(ItemGenerator.CookFromDefinition(owner.World, ItemGenerator.GetItemDefinition(instance.FirstGem), 1));
if (instance.SecondGem != -1) itm.Gems.Add(ItemGenerator.CookFromDefinition(owner.World, ItemGenerator.GetItemDefinition(instance.SecondGem), 1));
if (instance.ThirdGem != -1) itm.Gems.Add(ItemGenerator.CookFromDefinition(owner.World, ItemGenerator.GetItemDefinition(instance.ThirdGem), 1));
if (instance.FirstGem != -1) itm.Gems.Add(CookFromDefinition(owner.World, GetItemDefinition(instance.FirstGem), 1));
if (instance.SecondGem != -1) itm.Gems.Add(CookFromDefinition(owner.World, GetItemDefinition(instance.SecondGem), 1));
if (instance.ThirdGem != -1) itm.Gems.Add(CookFromDefinition(owner.World, GetItemDefinition(instance.ThirdGem), 1));
for (int i = 0; i < itm.Gems.Count; i++)
{

View File

@ -49,61 +49,61 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
case 2:
case 3:
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9984f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 4: //T1
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9982f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 5: //T2
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9979f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 6: //T3
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9976f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 7: //T4
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9972f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 8: //T5
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9968f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 9: //T6
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9963f)
return LootManager.Rare;
return LootManager.Epic;
default: return LootManager.Common;
return Rare;
return Epic;
default: return Common;
}
case 1: //Champion
switch (difficulty)
@ -113,61 +113,61 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
case 2:
case 3:
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9984f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 4: //T1
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9982f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 5: //T2
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9979f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 6: //T3
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9976f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 7: //T4
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9972f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 8: //T5
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9968f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 9: //T6
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9963f)
return LootManager.Rare;
return LootManager.Epic;
default: return LootManager.Common;
return Rare;
return Epic;
default: return Common;
}
case 2: //Rare (Elite)
case 4: //Unique
@ -178,61 +178,61 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
case 2:
case 3:
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9984f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 4: //T1
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9982f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 5: //T2
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9979f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 6: //T3
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9976f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 7: //T4
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9972f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 8: //T5
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9968f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 9: //T6
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9963f)
return LootManager.Rare;
return LootManager.Epic;
default: return LootManager.Common;
return Rare;
return Epic;
default: return Common;
}
case 7: //Boss
switch (difficulty)
@ -242,64 +242,64 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
case 2:
case 3:
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.995f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 4: //T1
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9942f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 5: //T2
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9934f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 6: //T3
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9924f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 7: //T4
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9913f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 8: //T5
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.985f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 9: //T6
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.98f)
return LootManager.Rare;
return LootManager.Epic;
default: return LootManager.Common;
return Rare;
return Epic;
default: return Common;
}
default:
return LootManager.Common;
return Common;
}
}
@ -316,61 +316,61 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
case 2:
case 3:
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9952f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 4: //T1
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9945f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 5: //T2
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9938f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 6: //T3
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9927f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 7: //T4
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9916f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 8: //T5
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9904f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 9: //T6
if (roll < 0.2f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9889f)
return LootManager.Rare;
return LootManager.Epic;
default: return LootManager.Common;
return Rare;
return Epic;
default: return Common;
}
case 1: //Champion
switch (difficulty)
@ -380,61 +380,61 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
case 2:
case 3:
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9952f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 4: //T1
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9945f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 5: //T2
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9938f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 6: //T3
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9927f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 7: //T4
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9916f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 8: //T5
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9904f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 9: //T6
if (roll < 0.08f)
return LootManager.Common;
return Common;
if (roll < 0.5f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9889f)
return LootManager.Rare;
return LootManager.Epic;
default: return LootManager.Common;
return Rare;
return Epic;
default: return Common;
}
case 2: //Rare (Elite)
case 4: //Unique
@ -445,61 +445,61 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
case 2:
case 3:
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9952f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 4: //T1
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9945f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 5: //T2
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9938f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 6: //T3
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9927f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 7: //T4
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9916f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 8: //T5
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9904f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 9: //T6
if (roll < 0.05f)
return LootManager.Common;
return Common;
if (roll < 0.35f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9889f)
return LootManager.Rare;
return LootManager.Epic;
default: return LootManager.Common;
return Rare;
return Epic;
default: return Common;
}
case 7: //Boss
switch (difficulty)
@ -509,64 +509,64 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
case 2:
case 3:
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.985f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 4: //T1
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9827f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 5: //T2
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9802f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 6: //T3
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9772f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 7: //T4
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9737f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 8: //T5
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9698f)
return LootManager.Rare;
return LootManager.Epic;
return Rare;
return Epic;
case 9: //T6
if (roll < 0.03f)
return LootManager.Common;
return Common;
if (roll < 0.29f)
return LootManager.Uncommon;
return Uncommon;
if (roll < 0.9653f)
return LootManager.Rare;
return LootManager.Epic;
default: return LootManager.Common;
return Rare;
return Epic;
default: return Common;
}
default:
return LootManager.Common;
return Common;
}
}
@ -615,16 +615,16 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
switch (MonsterQuality)
{
case 0: //Normal
return new List<float> { 0.18f * DiIiS_NA.GameServer.Config.Instance.RateChangeDrop };
return new List<float> { 0.18f * Config.Instance.RateChangeDrop };
case 1: //Champion
return new List<float> { 1f, 1f, 1f, 1f, 0.75f * DiIiS_NA.GameServer.Config.Instance.RateChangeDrop };
return new List<float> { 1f, 1f, 1f, 1f, 0.75f * Config.Instance.RateChangeDrop };
case 2: //Rare (Elite)
case 4: //Unique
return new List<float> { 1f, 1f, 1f, 1f, 1f };
case 7: //Boss
return new List<float> { 1f, 1f, 1f, 1f, 1f, 0.75f * DiIiS_NA.GameServer.Config.Instance.RateChangeDrop, 0.4f * DiIiS_NA.GameServer.Config.Instance.RateChangeDrop };
return new List<float> { 1f, 1f, 1f, 1f, 1f, 0.75f * Config.Instance.RateChangeDrop, 0.4f * Config.Instance.RateChangeDrop };
default:
return new List<float> { 0.12f * DiIiS_NA.GameServer.Config.Instance.RateChangeDrop };
return new List<float> { 0.12f * Config.Instance.RateChangeDrop };
}
}

View File

@ -71,9 +71,9 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
get
{
if (!MPQStorage.Data.Assets[SNOGroup.Scene].ContainsKey(this.SceneSNO.Id))
Logger.Debug("AssetsForScene not found in MPQ Storage:Scene:{0}, Asset:{1}", SNOGroup.Scene, this.SceneSNO.Id);
return MPQStorage.Data.Assets[SNOGroup.Scene][this.SceneSNO.Id].Data as DiIiS_NA.Core.MPQ.FileFormats.Scene;
if (!MPQStorage.Data.Assets[SNOGroup.Scene].ContainsKey(SceneSNO.Id))
Logger.Debug("AssetsForScene not found in MPQ Storage:Scene:{0}, Asset:{1}", SNOGroup.Scene, SceneSNO.Id);
return MPQStorage.Data.Assets[SNOGroup.Scene][SceneSNO.Id].Data as DiIiS_NA.Core.MPQ.FileFormats.Scene;
}
}
/// <summary>
@ -96,7 +96,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// </summary>
public uint ParentChunkID
{
get { return (this.Parent != null) ? this.Parent.GlobalID : 0xFFFFFFFF; }
get { return (Parent != null) ? Parent.GlobalID : 0xFFFFFFFF; }
}
/// <summary>
@ -122,7 +122,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// </summary>
public PRTransform Transform
{
get { return new PRTransform { Quaternion = new Quaternion { W = this.RotationW, Vector3D = this.RotationAxis }, Vector3D = this.Position }; }
get { return new PRTransform { Quaternion = new Quaternion { W = RotationW, Vector3D = RotationAxis }, Vector3D = Position }; }
}
/// <summary>
@ -132,7 +132,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
get
{
return this.SceneData.AABBBounds;
return SceneData.AABBBounds;
}
}
/// <summary>
@ -142,7 +142,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
get
{
return this.SceneData.AABBMarketSetBounds;
return SceneData.AABBMarketSetBounds;
}
}
@ -153,7 +153,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
get
{
return this.SceneData.NavMesh;
return SceneData.NavMesh;
}
}
@ -164,7 +164,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
get
{
return this.SceneData.MarkerSets;
return SceneData.MarkerSets;
}
}
@ -175,7 +175,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
get
{
return this.SceneData.LookLink;
return SceneData.LookLink;
}
}
@ -188,7 +188,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
get
{
return this.SceneData.NavZone;
return SceneData.NavZone;
}
}
@ -207,42 +207,42 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public Scene(World world, Vector3D position, int snoId, Scene parent)
: base(world, world.NewSceneID)
{
this.SceneSNO = new SNOHandle(SNOGroup.Scene, snoId);
this.Parent = parent;
this.Subscenes = new List<Scene>();
this.Scale = 1.0f;
this.AppliedLabels = new int[0];
this.Field8 = new int[0];
this.Size = new Size(this.NavZone.V0.X * (int)this.NavZone.Float0, this.NavZone.V0.Y * (int)this.NavZone.Float0);
this.Position = position;
this.World.AddScene(this); // add scene to the world.
SceneSNO = new SNOHandle(SNOGroup.Scene, snoId);
Parent = parent;
Subscenes = new List<Scene>();
Scale = 1.0f;
AppliedLabels = new int[0];
Field8 = new int[0];
Size = new Size(NavZone.V0.X * (int)NavZone.Float0, NavZone.V0.Y * (int)NavZone.Float0);
Position = position;
World.AddScene(this); // add scene to the world.
}
#region range-queries
public List<Player> Players
{
get { return this.GetObjects<Player>(); }
get { return GetObjects<Player>(); }
}
public bool HasPlayers
{
get { return this.Players.Count > 0; }
get { return Players.Count > 0; }
}
public List<Actor> Actors
{
get { return this.GetObjects<Actor>(); }
get { return GetObjects<Actor>(); }
}
public bool HasActors
{
get { return this.Actors.Count > 0; }
get { return Actors.Count > 0; }
}
public List<T> GetObjects<T>() where T : WorldObject
{
return this.World.QuadTree.Query<T>(this.Bounds);
return World.QuadTree.Query<T>(Bounds);
}
#endregion
@ -254,22 +254,22 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// </summary>
public void LoadMarkers()
{
this.GizmoSpawningLocations = new List<PRTransform>[26]; // LocationA to LocationZ
GizmoSpawningLocations = new List<PRTransform>[26]; // LocationA to LocationZ
if (!PreCachedMarkers.ContainsKey(this.SceneSNO.Id)) return;
if (!PreCachedMarkers.ContainsKey(SceneSNO.Id)) return;
foreach (var marker in PreCachedMarkers[this.SceneSNO.Id])
foreach (var marker in PreCachedMarkers[SceneSNO.Id])
{
switch (marker.Type)
{
case MarkerType.Actor:
var actor = ActorFactory.Create(this.World, (ActorSno)marker.SNOHandle.Id, marker.TagMap); // try to create it.
var actor = ActorFactory.Create(World, (ActorSno)marker.SNOHandle.Id, marker.TagMap); // try to create it.
//Logger.Debug("not-lazy spawned {0}", actor.GetType().Name);
if (actor == null) continue;
if (this.World.SNO == WorldSno.a3_battlefields_02 && this.SceneSNO.Id == 145392 && actor is StartingPoint) continue; //arreat crater hack
if (this.World.SNO == WorldSno.x1_westm_intro && this.SceneSNO.Id == 311310 && actor is StartingPoint) continue; //A5 start location hack
if (World.SNO == WorldSno.a3_battlefields_02 && SceneSNO.Id == 145392 && actor is StartingPoint) continue; //arreat crater hack
if (World.SNO == WorldSno.x1_westm_intro && SceneSNO.Id == 311310 && actor is StartingPoint) continue; //A5 start location hack
var position = marker.PRTransform.Vector3D + this.Position; // calculate the position for the actor.
var position = marker.PRTransform.Vector3D + Position; // calculate the position for the actor.
actor.RotationW = marker.PRTransform.Quaternion.W;
actor.RotationAxis = marker.PRTransform.Quaternion.Vector3D;
actor.AdjustPosition = false;
@ -287,10 +287,10 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
Logger.Trace("Encounter option {0} - {1} - {2} - {3}", option.SNOSpawn, option.Probability, option.I1, option.I2);
}*/ //only for debugging purposes
var actor2 = ActorFactory.Create(this.World, (ActorSno)actorsno.SNOSpawn, marker.TagMap); // try to create it.
var actor2 = ActorFactory.Create(World, (ActorSno)actorsno.SNOSpawn, marker.TagMap); // try to create it.
if (actor2 == null) continue;
var position2 = marker.PRTransform.Vector3D + this.Position; // calculate the position for the actor.
var position2 = marker.PRTransform.Vector3D + Position; // calculate the position for the actor.
actor2.RotationW = marker.PRTransform.Quaternion.W;
actor2.RotationAxis = marker.PRTransform.Quaternion.Vector3D;
actor2.AdjustPosition = false;
@ -302,14 +302,14 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
default:
// Save gizmo locations. They are used to spawn loots and gizmos randomly in a level area
if ((int)marker.Type >= (int)DiIiS_NA.Core.MPQ.FileFormats.MarkerType.GizmoLocationA && (int)marker.Type <= (int)DiIiS_NA.Core.MPQ.FileFormats.MarkerType.GizmoLocationZ)
if ((int)marker.Type >= (int)MarkerType.GizmoLocationA && (int)marker.Type <= (int)MarkerType.GizmoLocationZ)
{
int index = (int)marker.Type - 50; // LocationA has id 50...
if (GizmoSpawningLocations[index] == null)
GizmoSpawningLocations[index] = new List<PRTransform>();
marker.PRTransform.Vector3D += this.Position;
marker.PRTransform.Vector3D += Position;
GizmoSpawningLocations[index].Add(marker.PRTransform);
}
//else
@ -391,7 +391,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <returns><see cref="bool"/></returns>
public bool IsRevealedToPlayer(Player player)
{
return player.RevealedObjects.ContainsKey(this.GlobalID);
return player.RevealedObjects.ContainsKey(GlobalID);
}
/// <summary>
@ -403,19 +403,19 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
lock (player.RevealedObjects)
{
if (player.RevealedObjects.ContainsKey(this.GlobalID)) return false;
if (player.RevealedObjects.ContainsKey(GlobalID)) return false;
player.RevealedObjects.Add(this.GlobalID, this.GlobalID);
player.RevealedObjects.Add(GlobalID, GlobalID);
RevealSceneMessage message = this.RevealMessage(player);
RevealSceneMessage message = RevealMessage(player);
if (player.EventWeatherEnabled)
//message.SceneSpec.SNOWeather = 50549; //Halloween
message.SceneSpec.SNOWeather = 75198; //New Year
player.InGameClient.SendMessage(message);// reveal the scene itself.
player.InGameClient.SendMessage(this.MapRevealMessage(player));
player.InGameClient.SendMessage(MapRevealMessage(player));
foreach (var sub in this.Subscenes)
foreach (var sub in Subscenes)
sub.Reveal(player);
return true;
@ -431,9 +431,9 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
lock (player.RevealedObjects)
{
if (!player.RevealedObjects.ContainsKey(this.GlobalID)) return false;
if (!player.RevealedObjects.ContainsKey(GlobalID)) return false;
foreach (var actor in this.Actors) actor.Unreveal(player);
foreach (var actor in Actors) actor.Unreveal(player);
/*
player.InGameClient.SendMessage(new PreloadSceneDataMessage(Opcodes.PreloadRemoveSceneMessage)
{
@ -442,11 +442,11 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
SnoLevelAreas = this.Specification.SNOLevelAreas
});
//*/
player.InGameClient.SendMessage(new DestroySceneMessage() { WorldID = this.World.GlobalID, SceneID = this.GlobalID });
player.InGameClient.SendMessage(new DestroySceneMessage() { WorldID = World.GlobalID, SceneID = GlobalID });
foreach (var subScene in this.Subscenes) subScene.Unreveal(player);
foreach (var subScene in Subscenes) subScene.Unreveal(player);
player.RevealedObjects.Remove(this.GlobalID);
player.RevealedObjects.Remove(GlobalID);
return true;
}
}
@ -460,14 +460,14 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// </summary>
public RevealSceneMessage RevealMessage(Player plr)
{
SceneSpecification specification = this.Specification;
SceneSpecification specification = Specification;
if (World.DRLGEmuActive)
{
specification.SNOMusic = World.Environment.snoMusic;
specification.SNOCombatMusic = -1;//World.Environment.snoCombatMusic;
specification.SNOAmbient = World.Environment.snoAmbient;
specification.SNOReverb = World.Environment.snoReverb;
specification.SNOPresetWorld = (int)this.World.SNO;
specification.SNOPresetWorld = (int)World.SNO;
}
else if (World.Environment != null)
{
@ -476,7 +476,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
specification.SNOAmbient = World.Environment.snoAmbient;
specification.SNOReverb = World.Environment.snoReverb;
specification.SNOWeather = World.Environment.snoWeather;
specification.SNOPresetWorld = (int)this.World.SNO;
specification.SNOPresetWorld = (int)World.SNO;
}
else
@ -487,13 +487,13 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
specification.SNOReverb = -1;
if (specification.SNOWeather == -1)
specification.SNOWeather = 0x00013220;
specification.SNOPresetWorld = (int)this.World.SNO;
specification.SNOPresetWorld = (int)World.SNO;
}
if (this.World.Game.NephalemGreater && this.World.SNO.IsDungeon())
if (World.Game.NephalemGreater && World.SNO.IsDungeon())
specification.SNOLevelAreas[0] = 332339;
switch (this.World.SNO)
switch (World.SNO)
{
case WorldSno.p43_ad_oldtristram: specification.SNOLevelAreas[0] = 455466; break; //p43_ad_oldtristram
case WorldSno.p43_ad_cathedral_level_01: specification.SNOLevelAreas[0] = 452986; break; //p43_ad_cathedral_level_01
@ -521,15 +521,15 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
}
return new RevealSceneMessage
{
WorldID = this.World.GlobalID,
WorldID = World.GlobalID,
SceneSpec = specification,
ChunkID = this.GlobalID,
Transform = this.Transform,
SceneSNO = this.SceneSNO.Id,
ParentChunkID = this.ParentChunkID,
SceneGroupSNO = this.SceneGroupSNO,
arAppliedLabels = this.AppliedLabels,
snoActors = this.Field8,
ChunkID = GlobalID,
Transform = Transform,
SceneSNO = SceneSNO.Id,
ParentChunkID = ParentChunkID,
SceneGroupSNO = SceneGroupSNO,
arAppliedLabels = AppliedLabels,
snoActors = Field8,
Vista = 0
};
}
@ -541,80 +541,80 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
if (
#region Город первого акта
this.SceneSNO.Id == 1904 ||
this.SceneSNO.Id == 33342 ||
this.SceneSNO.Id == 33343 ||
SceneSNO.Id == 1904 ||
SceneSNO.Id == 33342 ||
SceneSNO.Id == 33343 ||
this.SceneSNO.Id == 33347 ||
this.SceneSNO.Id == 33348 ||
this.SceneSNO.Id == 33349 ||
this.SceneSNO.Id == 414798
SceneSNO.Id == 33347 ||
SceneSNO.Id == 33348 ||
SceneSNO.Id == 33349 ||
SceneSNO.Id == 414798
#endregion
||
#region Город второго акта
this.SceneSNO.Id == 161516 ||
this.SceneSNO.Id == 161510 ||
this.SceneSNO.Id == 185542 ||
SceneSNO.Id == 161516 ||
SceneSNO.Id == 161510 ||
SceneSNO.Id == 185542 ||
this.SceneSNO.Id == 161507 ||
this.SceneSNO.Id == 161513 ||
this.SceneSNO.Id == 185545
SceneSNO.Id == 161507 ||
SceneSNO.Id == 161513 ||
SceneSNO.Id == 185545
#endregion
||
#region Город третьего акта
this.SceneSNO.Id == 172892 ||
this.SceneSNO.Id == 172880 ||
this.SceneSNO.Id == 172868 ||
SceneSNO.Id == 172892 ||
SceneSNO.Id == 172880 ||
SceneSNO.Id == 172868 ||
this.SceneSNO.Id == 172888 ||
this.SceneSNO.Id == 172876 ||
this.SceneSNO.Id == 172863 ||
SceneSNO.Id == 172888 ||
SceneSNO.Id == 172876 ||
SceneSNO.Id == 172863 ||
this.SceneSNO.Id == 172884 ||
this.SceneSNO.Id == 172872 ||
this.SceneSNO.Id == 172908
SceneSNO.Id == 172884 ||
SceneSNO.Id == 172872 ||
SceneSNO.Id == 172908
#endregion
||
#region Город четвертого акта
this.SceneSNO.Id == 183555 ||
this.SceneSNO.Id == 183556 ||
this.SceneSNO.Id == 183557 ||
SceneSNO.Id == 183555 ||
SceneSNO.Id == 183556 ||
SceneSNO.Id == 183557 ||
this.SceneSNO.Id == 183502 ||
this.SceneSNO.Id == 183505 ||
this.SceneSNO.Id == 183557 ||
SceneSNO.Id == 183502 ||
SceneSNO.Id == 183505 ||
SceneSNO.Id == 183557 ||
this.SceneSNO.Id == 183519 ||
this.SceneSNO.Id == 183545 ||
this.SceneSNO.Id == 183553
SceneSNO.Id == 183519 ||
SceneSNO.Id == 183545 ||
SceneSNO.Id == 183553
#endregion
||
#region Город пятого акта
this.SceneSNO.Id == 315706 ||
this.SceneSNO.Id == 311307 ||
this.SceneSNO.Id == 311295 ||
SceneSNO.Id == 315706 ||
SceneSNO.Id == 311307 ||
SceneSNO.Id == 311295 ||
this.SceneSNO.Id == 313849 ||
this.SceneSNO.Id == 311316 ||
this.SceneSNO.Id == 313845 ||
SceneSNO.Id == 313849 ||
SceneSNO.Id == 311316 ||
SceneSNO.Id == 313845 ||
this.SceneSNO.Id == 315710 ||
this.SceneSNO.Id == 311310 ||
this.SceneSNO.Id == 311298 ||
SceneSNO.Id == 315710 ||
SceneSNO.Id == 311310 ||
SceneSNO.Id == 311298 ||
this.SceneSNO.Id == 313853 ||
this.SceneSNO.Id == 311313 ||
this.SceneSNO.Id == 311301 ||
this.SceneSNO.Id == 313857
SceneSNO.Id == 313853 ||
SceneSNO.Id == 311313 ||
SceneSNO.Id == 311301 ||
SceneSNO.Id == 313857
#endregion
)
{
return new MapRevealSceneMessage
{
ChunkID = this.GlobalID,
SceneSNO = this.SceneSNO.Id,
Transform = this.Transform,
WorldID = this.World.GlobalID,
ChunkID = GlobalID,
SceneSNO = SceneSNO.Id,
Transform = Transform,
WorldID = World.GlobalID,
MiniMapVisibility = true
};
}
@ -622,10 +622,10 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
return new MapRevealSceneMessage
{
ChunkID = this.GlobalID,
SceneSNO = this.SceneSNO.Id,
Transform = this.Transform,
WorldID = this.World.GlobalID,
ChunkID = GlobalID,
SceneSNO = SceneSNO.Id,
Transform = Transform,
WorldID = World.GlobalID,
MiniMapVisibility = false
};
}
@ -635,7 +635,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public override string ToString()
{
return string.Format("[Scene] SNOId: {0} DynamicId: {1} Name: {2}", this.SceneSNO.Id, this.GlobalID, this.SceneSNO.Name);
return string.Format("[Scene] SNOId: {0} DynamicId: {1} Name: {2}", SceneSNO.Id, GlobalID, SceneSNO.Name);
}
}

View File

@ -86,7 +86,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
get
{
return (this.IsPvP ? _PvPQuadTree : _quadTree);
return (IsPvP ? _PvPQuadTree : _quadTree);
}
set { }
}
@ -117,7 +117,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
get
{
return (this.IsPvP ? _PvPscenes : _scenes);
return (IsPvP ? _PvPscenes : _scenes);
}
set { }
}
@ -133,7 +133,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
get
{
return (this.IsPvP ? _PvPActors : _actors);
return (IsPvP ? _PvPActors : _actors);
}
set { }
}
@ -151,7 +151,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
get
{
return (this.IsPvP ? _PvPPlayers : _players);
return (IsPvP ? _PvPPlayers : _players);
}
set { }
}
@ -159,14 +159,14 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <summary>
/// Returns true if the world has players in.
/// </summary>
public bool HasPlayersIn { get { return this.Players.Count > 0; } }
public bool HasPlayersIn { get { return Players.Count > 0; } }
/// <summary>
/// Returns a new dynamicId for scenes.
/// </summary>
public uint NewSceneID { get { return this.IsPvP ? World.NewPvPSceneID : this.Game.NewSceneID; } }
public uint NewSceneID { get { return IsPvP ? NewPvPSceneID : Game.NewSceneID; } }
public bool IsPvP { get { return this.SNO == WorldSno.pvp_duel_small_multi; } } //PvP_Duel_Small
public bool IsPvP { get { return SNO == WorldSno.pvp_duel_small_multi; } } //PvP_Duel_Small
public static bool PvPMapLoaded = false;
@ -187,7 +187,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
get
{
return ((DiIiS_NA.Core.MPQ.FileFormats.World)DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[SNOGroup.Worlds][this.WorldSNO.Id].Data).Environment;
return ((DiIiS_NA.Core.MPQ.FileFormats.World)DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[SNOGroup.Worlds][WorldSNO.Id].Data).Environment;
}
}
@ -223,28 +223,28 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// </summary>
public List<StartingPoint> StartingPoints
{
get { return this.Actors.Values.OfType<StartingPoint>().Select(actor => actor).ToList(); }
get { return Actors.Values.OfType<StartingPoint>().Select(actor => actor).ToList(); }
}
public List<Portal> Portals
{
get { return this.Actors.Values.OfType<Portal>().Select(actor => actor).ToList(); }
get { return Actors.Values.OfType<Portal>().Select(actor => actor).ToList(); }
}
public List<Monster> Monsters
{
get { return this.Actors.Values.OfType<Monster>().Select(actor => actor).ToList(); }
get { return Actors.Values.OfType<Monster>().Select(actor => actor).ToList(); }
}
private PowerManager _powerManager;
public static PowerManager _PvPPowerManager = new PowerManager();
public PowerManager PowerManager { get { return this.IsPvP ? World._PvPPowerManager : this._powerManager; } }
public PowerManager PowerManager { get { return IsPvP ? _PvPPowerManager : _powerManager; } }
private BuffManager _buffManager;
public static BuffManager _PvPBuffManager = new BuffManager();
public BuffManager BuffManager { get { return this.IsPvP ? World._PvPBuffManager : this._buffManager; } }
public BuffManager BuffManager { get { return IsPvP ? _PvPBuffManager : _buffManager; } }
/// <summary>
/// Creates a new world for the given game with given snoId.
@ -254,34 +254,34 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public World(Game game, WorldSno sno)
: base(sno == WorldSno.pvp_duel_small_multi ? 99999 : game.NewWorldID)
{
this.WorldSNO = new SNOHandle(SNOGroup.Worlds, (int)sno);
WorldSNO = new SNOHandle(SNOGroup.Worlds, (int)sno);
this.Game = game;
Game = game;
this._scenes = new ConcurrentDictionary<uint, Scene>();
this._actors = new ConcurrentDictionary<uint, Actor>();
this._players = new ConcurrentDictionary<uint, Player>();
this._quadTree = new QuadTree(new Size(60, 60), 0);
this.NextLocation = this.PrevLocation = new ResolvedPortalDestination
_scenes = new ConcurrentDictionary<uint, Scene>();
_actors = new ConcurrentDictionary<uint, Actor>();
_players = new ConcurrentDictionary<uint, Player>();
_quadTree = new QuadTree(new Size(60, 60), 0);
NextLocation = PrevLocation = new ResolvedPortalDestination
{
WorldSNO = (int)WorldSno.__NONE,
DestLevelAreaSNO = -1,
StartingPointActorTag = -1
};
this._powerManager = new PowerManager();
this._buffManager = new BuffManager();
_powerManager = new PowerManager();
_buffManager = new BuffManager();
this.Game.AddWorld(this);
Game.AddWorld(this);
//this.Game.StartTracking(this); // start tracking the dynamicId for the world.
if (this.SNO == WorldSno.x1_bog_01) //Blood Marsh
if (SNO == WorldSno.x1_bog_01) //Blood Marsh
{
var worlds = new List<WorldSno>() { WorldSno.x1_catacombs_level01, WorldSno.x1_catacombs_fakeentrance_02, WorldSno.x1_catacombs_fakeentrance_03, WorldSno.x1_catacombs_fakeentrance_04 };
var scenes = new List<int>() { 265624, 265655, 265678, 265693 };
foreach (var scene in scenes)
{
var wld = worlds[FastRandom.Instance.Next(worlds.Count)];
this.PortalOverrides.Add(scene, wld);
PortalOverrides.Add(scene, wld);
worlds.Remove(wld);
}
}
@ -291,14 +291,14 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public void Update(int tickCounter)
{
foreach (var player in this.Players.Values)
foreach (var player in Players.Values)
{
player.InGameClient.SendTick(); // if there's available messages to send, will handle ticking and flush the outgoing buffer.
}
var actorsToUpdate = new List<IUpdateable>(); // list of actor to update.
foreach (var player in this.Players.Values) // get players in the world.
foreach (var player in Players.Values) // get players in the world.
{
foreach (var actor in player.GetActorsInRange().OfType<IUpdateable>()) // get IUpdateable actors in range.
{
@ -308,7 +308,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
actorsToUpdate.Add(actor as IUpdateable);
}
}
foreach (var minion in this.Actors.Values.OfType<Minion>())
foreach (var minion in Actors.Values.OfType<Minion>())
{
if (actorsToUpdate.Contains(minion as IUpdateable))
continue;
@ -319,10 +319,10 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
actor.Update(tickCounter);
}
this.BuffManager.Update();
this.PowerManager.Update();
BuffManager.Update();
PowerManager.Update();
if (tickCounter % 6 == 0 && this._flippyTimers.Count() > 0)
if (tickCounter % 6 == 0 && _flippyTimers.Count() > 0)
{
UpdateFlippy(tickCounter);
}
@ -344,7 +344,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <param name="actor">The actor.</param>
public void BroadcastIfRevealed(Func<Player, GameMessage> message, Actor actor)
{
foreach (var player in this.Players.Values)
foreach (var player in Players.Values)
{
if (player.RevealedObjects.ContainsKey(actor.GlobalID))
player.InGameClient.SendMessage(message(player));
@ -357,7 +357,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <param name="message"></param>
public void BroadcastGlobal(Func<Player, GameMessage> message)
{
foreach (var player in this.Players.Values)
foreach (var player in Players.Values)
{
player.InGameClient.SendMessage(message(player));
}
@ -385,7 +385,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public void BroadcastExclusive(Func<Player, GameMessage> message, Actor actor, bool global = false)
{
var players = actor.GetPlayersInRange();
if (global) players = this.Players.Values.ToList();
if (global) players = Players.Values.ToList();
foreach (var player in players.Where(player => player != actor))
{
if (player.RevealedObjects.ContainsKey(actor.GlobalID)) //revealed only!
@ -406,15 +406,15 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
lock (player.RevealedObjects)
{
if (player.RevealedObjects.ContainsKey(this.GlobalID))
if (player.RevealedObjects.ContainsKey(GlobalID))
return false;
int sceneGridSize = this.SNO.IsUsingZoltCustomGrid() ? 100 : 60;
int sceneGridSize = SNO.IsUsingZoltCustomGrid() ? 100 : 60;
player.InGameClient.SendMessage(new RevealWorldMessage() // Reveal world to player
{
WorldID = this.GlobalID,
WorldSNO = this.WorldSNO.Id,
WorldID = GlobalID,
WorldSNO = WorldSNO.Id,
OriginX = 540,
OriginY = -600,
StitchSizeInFeetX = sceneGridSize,
@ -423,11 +423,11 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
WorldSizeInFeetY = 5040,
snoDungeonFinderSourceWorld = -1
});
player.InGameClient.SendMessage(new WorldStatusMessage() { WorldID = this.GlobalID, Field1 = false });
player.InGameClient.SendMessage(new WorldStatusMessage() { WorldID = GlobalID, Field1 = false });
//*
player.InGameClient.SendMessage(new WorldSyncedDataMessage()
{
WorldID = this.GlobalID,
WorldID = GlobalID,
SyncedData = new WorldSyncedData()
{
SnoWeatherOverride = -1,
@ -437,7 +437,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
});
//*/
player.RevealedObjects.Add(this.GlobalID, this.GlobalID);
player.RevealedObjects.Add(GlobalID, GlobalID);
return true;
}
@ -450,13 +450,13 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <returns></returns>
public bool Unreveal(Player player)
{
if (!player.RevealedObjects.ContainsKey(this.GlobalID)) return false;
if (!player.RevealedObjects.ContainsKey(GlobalID)) return false;
foreach (var scene in this.Scenes.Values) scene.Unreveal(player);
player.RevealedObjects.Remove(this.GlobalID);
foreach (var scene in Scenes.Values) scene.Unreveal(player);
player.RevealedObjects.Remove(GlobalID);
player.InGameClient.SendMessage(new WorldStatusMessage() { WorldID = this.GlobalID, Field1 = true });
player.InGameClient.SendMessage(new PrefetchDataMessage(Opcodes.PrefetchWorldMessage) { SNO = this.WorldSNO.Id });
player.InGameClient.SendMessage(new WorldStatusMessage() { WorldID = GlobalID, Field1 = true });
player.InGameClient.SendMessage(new PrefetchDataMessage(Opcodes.PrefetchWorldMessage) { SNO = WorldSNO.Id });
//player.InGameClient.SendMessage(new WorldDeletedMessage() { WorldID = this.GlobalID });
return true;
@ -472,7 +472,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <param name="actor">The actor entering the world.</param>
public void Enter(Actor actor)
{
this.AddActor(actor);
AddActor(actor);
actor.OnEnter(this);
// reveal actor to player's in-range.
@ -482,11 +482,11 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
}
//Убираем балки с проходов
if (this.SNO == WorldSno.trout_town)
if (SNO == WorldSno.trout_town)
{
foreach (var boarded in this.GetActorsBySNO(ActorSno._trout_oldtristram_cellardoor_boarded))
foreach (var boarded in GetActorsBySNO(ActorSno._trout_oldtristram_cellardoor_boarded))
boarded.Destroy();
foreach (var boarded in this.GetActorsBySNO(ActorSno._trout_oldtristram_cellardoor_rubble))
foreach (var boarded in GetActorsBySNO(ActorSno._trout_oldtristram_cellardoor_rubble))
boarded.Destroy();
}
}
@ -499,20 +499,20 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
actor.OnLeave(this);
foreach (var player in this.Players.Values)
foreach (var player in Players.Values)
{
actor.Unreveal(player);
}
if (this.HasActor(actor.GlobalID))
this.RemoveActor(actor);
if (HasActor(actor.GlobalID))
RemoveActor(actor);
if (!(actor is Player)) return; // if the leaving actors is a player, unreveal the actors revealed to him contained in the world.
var revealedObjects = (actor as Player).RevealedObjects.Keys.ToList(); // list of revealed actors.
foreach (var obj_id in revealedObjects)
{
var obj = this.GetActorByGlobalId(obj_id);
var obj = GetActorByGlobalId(obj_id);
//if (obj != actor) // do not unreveal the player itself.
try
{
@ -530,7 +530,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public Actor ShowOnlyNumNPC(ActorSno SNO, int Num)
{
Actor Setted = null;
foreach (var actor in this.GetActorsBySNO(SNO))
foreach (var actor in GetActorsBySNO(SNO))
{
var isVisible = actor.NumberInWorld == Num;
if (isVisible)
@ -538,7 +538,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
actor.Hidden = !isVisible;
actor.SetVisible(isVisible);
foreach (var plr in this.Players.Values)
foreach (var plr in Players.Values)
{
if (isVisible) actor.Reveal(plr); else actor.Unreveal(plr);
}
@ -900,7 +900,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <param name="position">The position for drop.</param>
public void SpawnGold(Actor source, Player player, int Min = -1)
{
int amount = (int)(LootManager.GetGoldAmount(player.Attributes[GameAttribute.Level]) * this.Game.GoldModifier * DiIiS_NA.GameServer.Config.Instance.RateMoney);
int amount = (int)(LootManager.GetGoldAmount(player.Attributes[GameAttribute.Level]) * Game.GoldModifier * Config.Instance.RateMoney);
if (Min != -1)
amount += Min;
var item = ItemGenerator.CreateGold(player, amount); // somehow the actual ammount is not shown on ground /raist.
@ -914,7 +914,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <param name="position">The position for drop.</param>
public void SpawnBloodShards(Actor source, Player player, int forceAmount = 0)
{
int amount = LootManager.GetBloodShardsAmount(this.Game.Difficulty + 3);
int amount = LootManager.GetBloodShardsAmount(Game.Difficulty + 3);
if (forceAmount == 0 && amount == 0) return; //don't drop shards on Normal
var item = ItemGenerator.CreateBloodShards(player, forceAmount > 0 ? forceAmount : amount); // somehow the actual ammount is not shown on ground /raist.
player.GroundItems[item.GlobalID] = item;
@ -932,7 +932,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public List<Portal> GetPortalsByLevelArea(int la)
{
List<Portal> portals = new List<Portal>();
foreach (var actor in this.Actors.Values)
foreach (var actor in Actors.Values)
{
if (actor is Portal)
if ((actor as Portal).Destination != null)
@ -964,7 +964,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public bool HasActorsInGroup(string group)
{
var groupHash = DiIiS_NA.Core.Helpers.Hash.StringHashHelper.HashItemName(group);
foreach (var actor in this.Actors.Values)
foreach (var actor in Actors.Values)
{
if (actor.Tags != null)
if (actor.Tags.ContainsKey(MarkerKeys.Group1Hash))
@ -981,7 +981,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
List<Actor> matchingActors = new List<Actor>();
var groupHash = DiIiS_NA.Core.Helpers.Hash.StringHashHelper.HashItemName(group);
foreach (var actor in this.Actors.Values)
foreach (var actor in Actors.Values)
{
if (actor.Tags != null)
if (actor.Tags.ContainsKey(MarkerKeys.Group1Hash))
@ -992,7 +992,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public List<Actor> GetActorsInGroup(int hash)
{
List<Actor> matchingActors = new List<Actor>();
foreach (var actor in this.Actors.Values)
foreach (var actor in Actors.Values)
{
if (actor.Tags != null)
if (actor.Tags.ContainsKey(MarkerKeys.Group1Hash))
@ -1060,7 +1060,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
float x = (float)(RandomHelper.NextDouble() - 0.5) * FlippyMaxDistanceManhattan;
float y = (float)(RandomHelper.NextDouble() - 0.5) * FlippyMaxDistanceManhattan;
item.Position = source.Position + new Vector3D(x, y, 0);
if (this.worldData.DynamicWorld)
if (worldData.DynamicWorld)
item.Position.Z = GetZForLocation(item.Position, source.Position.Z);
item.Unstuck();
@ -1106,8 +1106,8 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
if (scene.GlobalID == 0 || HasScene(scene.GlobalID))
throw new Exception(String.Format("Scene has an invalid ID or was already present (ID = {0})", scene.GlobalID));
this.Scenes.TryAdd(scene.GlobalID, scene); // add to scenes collection.
this.QuadTree.Insert(scene); // add it to quad-tree too.
Scenes.TryAdd(scene.GlobalID, scene); // add to scenes collection.
QuadTree.Insert(scene); // add it to quad-tree too.
}
/// <summary>
@ -1120,8 +1120,8 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
throw new Exception(String.Format("Scene has an invalid ID or was not present (ID = {0})", scene.GlobalID));
Scene remotedScene;
this.Scenes.TryRemove(scene.GlobalID, out remotedScene); // remove it from scenes collection.
this.QuadTree.Remove(scene); // remove from quad-tree too.
Scenes.TryRemove(scene.GlobalID, out remotedScene); // remove it from scenes collection.
QuadTree.Remove(scene); // remove from quad-tree too.
}
/// <summary>
@ -1132,7 +1132,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public Scene GetScene(uint dynamicID)
{
Scene scene;
this.Scenes.TryGetValue(dynamicID, out scene);
Scenes.TryGetValue(dynamicID, out scene);
return scene;
}
@ -1148,7 +1148,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <returns><see cref="bool"/></returns>
public bool HasScene(uint dynamicID)
{
return this.Scenes.ContainsKey(dynamicID);
return Scenes.ContainsKey(dynamicID);
}
/// <summary>
@ -1164,11 +1164,11 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
return;
}
this.Actors.TryAdd(actor.GlobalID, actor); // add to actors collection.
this.QuadTree.Insert(actor); // add it to quad-tree too.
Actors.TryAdd(actor.GlobalID, actor); // add to actors collection.
QuadTree.Insert(actor); // add it to quad-tree too.
if (actor.ActorType == ActorType.Player) // if actor is a player, add it to players collection too.
this.AddPlayer((Player)actor);
AddPlayer((Player)actor);
}
/// <summary>
@ -1177,21 +1177,21 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <param name="actor">The actor to remove.</param>
private void RemoveActor(Actor actor)
{
if (actor.GlobalID == 0 || !this.Actors.ContainsKey(actor.GlobalID))
if (actor.GlobalID == 0 || !Actors.ContainsKey(actor.GlobalID))
throw new Exception(String.Format("Actor has an invalid ID or was not present (ID = {0})", actor.GlobalID));
Actor removedActor;
this.Actors.TryRemove(actor.GlobalID, out removedActor); // remove it from actors collection.
this.QuadTree.Remove(actor); // remove from quad-tree too.
Actors.TryRemove(actor.GlobalID, out removedActor); // remove it from actors collection.
QuadTree.Remove(actor); // remove from quad-tree too.
if (actor.ActorType == ActorType.Player) // if actors is a player, remove it from players collection too.
this.RemovePlayer((Player)actor);
RemovePlayer((Player)actor);
}
public Actor GetActorByGlobalId(uint globalID)
{
Actor actor;
this.Actors.TryGetValue(globalID, out actor);
Actors.TryGetValue(globalID, out actor);
return actor;
}
@ -1216,7 +1216,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <returns></returns>
public Actor GetActorByGlobalId(uint dynamicID, ActorType matchType)
{
var actor = this.GetActorByGlobalId(dynamicID);
var actor = GetActorByGlobalId(dynamicID);
if (actor != null)
{
if (actor.ActorType == matchType)
@ -1235,7 +1235,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <returns><see cref="bool"/></returns>
public bool HasActor(uint dynamicID)
{
return this.Actors.ContainsKey(dynamicID);
return Actors.ContainsKey(dynamicID);
}
/// <summary>
@ -1246,7 +1246,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <returns></returns>
public bool HasActor(uint dynamicID, ActorType matchType)
{
var actor = this.GetActorByGlobalId(dynamicID, matchType);
var actor = GetActorByGlobalId(dynamicID, matchType);
return actor != null;
}
@ -1257,7 +1257,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <returns>Actor</returns>
public T GetActorInstance<T>() where T : Actor
{
return this.Actors.Values.OfType<T>().FirstOrDefault();
return Actors.Values.OfType<T>().FirstOrDefault();
}
/// <summary>
@ -1269,7 +1269,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
if (player.GlobalID == 0 || HasPlayer(player.GlobalID))
throw new Exception(String.Format("Player has an invalid ID or was already present (ID = {0})", player.GlobalID));
this.Players.TryAdd(player.GlobalID, player); // add it to players collection.
Players.TryAdd(player.GlobalID, player); // add it to players collection.
}
/// <summary>
@ -1278,11 +1278,11 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <param name="player"></param>
private void RemovePlayer(Player player)
{
if (player.GlobalID == 0 || !this.Players.ContainsKey(player.GlobalID))
if (player.GlobalID == 0 || !Players.ContainsKey(player.GlobalID))
throw new Exception(String.Format("Player has an invalid ID or was not present (ID = {0})", player.GlobalID));
Player removedPlayer;
this.Players.TryRemove(player.GlobalID, out removedPlayer); // remove it from players collection.
Players.TryRemove(player.GlobalID, out removedPlayer); // remove it from players collection.
}
/// <summary>
@ -1293,7 +1293,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public Player GetPlayer(uint dynamicID)
{
Player player;
this.Players.TryGetValue(dynamicID, out player);
Players.TryGetValue(dynamicID, out player);
return player;
}
@ -1304,7 +1304,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
/// <returns><see cref="bool"/></returns>
public bool HasPlayer(uint dynamicID)
{
return this.Players.ContainsKey(dynamicID);
return Players.ContainsKey(dynamicID);
}
/// <summary>
@ -1355,7 +1355,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public Actor FindAt(ActorSno actorSno, Vector3D position, float radius = 3.0f)
{
var proximityCircle = new Circle(position.X, position.Y, radius);
var actors = this.QuadTree.Query<Actor>(proximityCircle);
var actors = QuadTree.Query<Actor>(proximityCircle);
foreach (var actr in actors)
if (actr.Attributes[GameAttribute.Disabled] == false && actr.Attributes[GameAttribute.Gizmo_Has_Been_Operated] == false && actr.SNO == actorSno) return actr;
return null;
@ -1381,9 +1381,9 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
// TODO: Destroy pre-generated tile set
this.worldData = null;
worldData = null;
//Game game = this.Game;
this.Game = null;
Game = null;
//game.EndTracking(this);
}
@ -1393,7 +1393,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
// We loop Scenes as its far quicker than looking thru the QuadTree - DarkLotus
foreach (Scene s in this.Scenes.Values)
foreach (Scene s in Scenes.Values)
{
if (s.Bounds.Contains(location.X, location.Y))
{
@ -1430,7 +1430,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public float GetZForLocation(Vector3D location, float defaultZ)
{
foreach (Scene s in this.Scenes.Values)
foreach (Scene s in Scenes.Values)
{
if (s.Bounds.Contains(location.X, location.Y))
{
@ -1472,7 +1472,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
{
var proximity = new RectangleF(start.X - 1f, start.Y - 1f, 2f, 2f);
var scenes = this.QuadTree.Query<Scene>(proximity);
var scenes = QuadTree.Query<Scene>(proximity);
if (scenes.Count == 0) return false;
var scene = scenes[0]; // Parent scene /fasbat
@ -1488,7 +1488,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
public override string ToString()
{
return string.Format("[World] SNOId: {0} GlobalId: {1} Name: {2}", this.WorldSNO.Id, this.GlobalID, this.WorldSNO.Name);
return string.Format("[World] SNOId: {0} GlobalId: {1} Name: {2}", WorldSNO.Id, GlobalID, WorldSNO.Name);
}
}
}

View File

@ -22,10 +22,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
{
get
{
if (this.GlobalIDOverride > 0)
return this.GlobalIDOverride;
if (GlobalIDOverride > 0)
return GlobalIDOverride;
else
return this._globalID;
return _globalID;
}
private set
{ }
@ -42,7 +42,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
if (this is Player && (!(this as Player).IsInPvPWorld || this == plr))
return (uint)(this as Player).PlayerIndex;
//if(plr.RevealedObjects.ContainsKey(this.))
return plr.RevealedObjects[this.GlobalID];
return plr.RevealedObjects[GlobalID];
}
/// <summary>
@ -51,8 +51,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
/// <param name="dynamicID">The dynamic ID to initialize with.</param>
protected DynamicObject(uint globalID)
{
this._globalID = globalID;
this.GlobalIDOverride = 0;
_globalID = globalID;
GlobalIDOverride = 0;
}
/// <summary>

View File

@ -571,7 +571,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
public IEnumerable<int> ActiveIds
{
get { return this._attributeValues.Select(k => k.Key.Id); }
get { return _attributeValues.Select(k => k.Key.Id); }
}
public int?[] AttributeKeys(GameAttribute ga)
{
@ -580,7 +580,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
public void LogAll()
{
foreach (var pair in this._attributeValues)
foreach (var pair in _attributeValues)
{
Logger.Debug("attribute {0}, {1} => {2}", GameAttribute.Attributes[pair.Key.Id].Name, pair.Key.Key, (GameAttribute.Attributes[pair.Key.Id] is GameAttributeF ? pair.Value.ValueF : pair.Value.Value));
}
@ -588,7 +588,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
public bool Contains(GameAttribute attr)
{
foreach (var pair in this._attributeValues)
foreach (var pair in _attributeValues)
{
if (pair.Key.Id == attr.Id)
{

View File

@ -40,7 +40,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
{
_position = value;
if (_position == null) return;
this.Bounds = new RectangleF(this.Position.X, this.Position.Y, this.Size.Width, this.Size.Height);
Bounds = new RectangleF(Position.X, Position.Y, Size.Width, Size.Height);
var handler = PositionChanged;
if (handler != null) handler(this, EventArgs.Empty);
}
@ -81,10 +81,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
if (world == null) return;
//if (dynamicID == 0)
//this.DynamicID = world.NewActorID;
this.World = world;
World = world;
//this.World.StartTracking(this); // track the object.
this.RotationAxis = new Vector3D();
this._position = new Vector3D();
RotationAxis = new Vector3D();
_position = new Vector3D();
}
/// <summary>
@ -109,13 +109,13 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem
try
{
if (this is Actor)
if (this.World != null)
this.World.Leave(this as Actor);
if (World != null)
World.Leave(this as Actor);
//this.World.EndTracking(this);
}
catch { }
this.World = null;
World = null;
}
}
}

View File

@ -44,9 +44,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public Equipment(Player owner)
{
this._equipment = new uint[33];
this._owner = owner;
this.Items = new Dictionary<uint, Item>();
_equipment = new uint[33];
_owner = owner;
Items = new Dictionary<uint, Item>();
}
/// <summary>
@ -66,7 +66,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
if (save)
_owner.Inventory.ChangeItemSlotDB(slot, item);
this.EquipmentChanged = true;
EquipmentChanged = true;
if (item.Attributes[GameAttribute.Item_Quality_Level] > 5)
{
@ -117,9 +117,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
{
_equipment[slot] = 0;
item.Attributes[GameAttribute.Item_Equipped] = false; // Probaly should be handled by Equipable class /fasbat
item.Unreveal(this._owner);
item.Reveal(this._owner);
this.EquipmentChanged = true;
item.Unreveal(_owner);
item.Reveal(_owner);
EquipmentChanged = true;
return slot;
}
@ -175,19 +175,19 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
{
new VisuaCosmeticItem()
{
GbId = this._owner.Toon.Cosmetic1
GbId = _owner.Toon.Cosmetic1
},
new VisuaCosmeticItem()
{
GbId = this._owner.Toon.Cosmetic2
GbId = _owner.Toon.Cosmetic2
},
new VisuaCosmeticItem()
{
GbId = this._owner.Toon.Cosmetic3
GbId = _owner.Toon.Cosmetic3
},
new VisuaCosmeticItem()
{
GbId = this._owner.Toon.Cosmetic4
GbId = _owner.Toon.Cosmetic4
}
};
}
@ -225,7 +225,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
internal Item GetEquipment(int targetEquipSlot)
{
//Logger.Debug("GetEquipment Slot: {0}", targetEquipSlot);
return GetItem(this._equipment[targetEquipSlot]);
return GetItem(_equipment[targetEquipSlot]);
}
internal Item GetEquipment(EquipmentSlotId targetEquipSlot)
@ -271,8 +271,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public Item GetItemByDynId(Player plr, uint dynId)
{
if (this.Items.Values.Where(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId).Count() > 0)
return this.Items.Values.Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
if (Items.Values.Where(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId).Count() > 0)
return Items.Values.Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
else
return null;
}

View File

@ -71,16 +71,16 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public ExpBonusData(Player player)
{
this._player = player;
this._killstreakTickTime = 240;
this._killstreakPlayer = 0;
this._killstreakEnvironment = 0;
this._lastMonsterKillTick = 0;
this._lastMonsterAttackTick = 0;
this._lastMonsterAttackKills = 0;
this._lastEnvironmentDestroyTick = 0;
this._lastEnvironmentDestroyMonsterKills = 0;
this._lastEnvironmentDestroyMonsterKillTick = 0;
_player = player;
_killstreakTickTime = 240;
_killstreakPlayer = 0;
_killstreakEnvironment = 0;
_lastMonsterKillTick = 0;
_lastMonsterAttackTick = 0;
_lastMonsterAttackKills = 0;
_lastEnvironmentDestroyTick = 0;
_lastEnvironmentDestroyMonsterKills = 0;
_lastEnvironmentDestroyMonsterKillTick = 0;
}
public void Update(int attackerActorType, int defeatedActorType)
@ -90,57 +90,57 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
if (defeatedActorType == 1) // Monster
{
// Massacre
if (this._lastMonsterKillTick + this._killstreakTickTime > this._player.InGameClient.Game.TickCounter)
if (_lastMonsterKillTick + _killstreakTickTime > _player.InGameClient.Game.TickCounter)
{
this._killstreakPlayer++;
_killstreakPlayer++;
}
else
{
this._killstreakPlayer = 1;
_killstreakPlayer = 1;
}
// MightyBlow
if (Math.Abs(this._lastMonsterAttackTick - this._player.InGameClient.Game.TickCounter) <= 20)
if (Math.Abs(_lastMonsterAttackTick - _player.InGameClient.Game.TickCounter) <= 20)
{
this._lastMonsterAttackKills++;
_lastMonsterAttackKills++;
}
else
{
this._lastMonsterAttackKills = 1;
_lastMonsterAttackKills = 1;
}
this._lastMonsterKillTick = this._player.InGameClient.Game.TickCounter;
_lastMonsterKillTick = _player.InGameClient.Game.TickCounter;
}
else if (defeatedActorType == 5) // Environment
{
// Destruction
if (this._lastEnvironmentDestroyTick + this._killstreakTickTime > this._player.InGameClient.Game.TickCounter)
if (_lastEnvironmentDestroyTick + _killstreakTickTime > _player.InGameClient.Game.TickCounter)
{
this._killstreakEnvironment++;
_killstreakEnvironment++;
}
else
{
this._killstreakEnvironment = 1;
_killstreakEnvironment = 1;
}
this._lastEnvironmentDestroyTick = this._player.InGameClient.Game.TickCounter;
_lastEnvironmentDestroyTick = _player.InGameClient.Game.TickCounter;
}
}
else if (attackerActorType == 5) // Environment
{
// Pulverized
if (Math.Abs(this._lastEnvironmentDestroyMonsterKillTick - this._player.InGameClient.Game.TickCounter) <= 20)
if (Math.Abs(_lastEnvironmentDestroyMonsterKillTick - _player.InGameClient.Game.TickCounter) <= 20)
{
this._lastEnvironmentDestroyMonsterKills++;
_lastEnvironmentDestroyMonsterKills++;
}
else
{
this._lastEnvironmentDestroyMonsterKills = 1;
_lastEnvironmentDestroyMonsterKills = 1;
}
this._lastEnvironmentDestroyMonsterKillTick = this._player.InGameClient.Game.TickCounter;
_lastEnvironmentDestroyMonsterKillTick = _player.InGameClient.Game.TickCounter;
}
}
@ -153,44 +153,44 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
{
case 0: // Massacre
{
if ((this._killstreakPlayer > 10) && (this._lastMonsterKillTick + this._killstreakTickTime <= this._player.InGameClient.Game.TickCounter))
if ((_killstreakPlayer > 10) && (_lastMonsterKillTick + _killstreakTickTime <= _player.InGameClient.Game.TickCounter))
{
defeated = this._killstreakPlayer;
expBonus = (this._killstreakPlayer - 10) * 10;
defeated = _killstreakPlayer;
expBonus = (_killstreakPlayer - 10) * 10;
this._killstreakPlayer = 0;
_killstreakPlayer = 0;
}
break;
}
case 1: // Destruction
{
if ((this._killstreakEnvironment > 5) && (this._lastEnvironmentDestroyTick + this._killstreakTickTime <= this._player.InGameClient.Game.TickCounter))
if ((_killstreakEnvironment > 5) && (_lastEnvironmentDestroyTick + _killstreakTickTime <= _player.InGameClient.Game.TickCounter))
{
defeated = this._killstreakEnvironment;
expBonus = (this._killstreakEnvironment - 5) * 5;
defeated = _killstreakEnvironment;
expBonus = (_killstreakEnvironment - 5) * 5;
this._killstreakEnvironment = 0;
_killstreakEnvironment = 0;
}
break;
}
case 2: // Mighty Blow
{
if (this._lastMonsterAttackKills > 10)
if (_lastMonsterAttackKills > 10)
{
defeated = this._lastMonsterAttackKills;
expBonus = (this._lastMonsterAttackKills - 10) * 5;
defeated = _lastMonsterAttackKills;
expBonus = (_lastMonsterAttackKills - 10) * 5;
}
this._lastMonsterAttackKills = 0;
_lastMonsterAttackKills = 0;
break;
}
case 3: // Pulverized
{
if (this._lastEnvironmentDestroyMonsterKills > 9)
if (_lastEnvironmentDestroyMonsterKills > 9)
{
defeated = this._lastEnvironmentDestroyMonsterKills;
expBonus = (this._lastEnvironmentDestroyMonsterKills - 9) * 10;
defeated = _lastEnvironmentDestroyMonsterKills;
expBonus = (_lastEnvironmentDestroyMonsterKills - 9) * 10;
}
this._lastEnvironmentDestroyMonsterKills = 0;
_lastEnvironmentDestroyMonsterKills = 0;
break;
}
default:
@ -202,9 +202,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
if (expBonus > 0)
{
expBonus = (int)(expBonus * this._player.World.Game.XPModifier);
expBonus = (int)(expBonus * _player.World.Game.XPModifier);
this._player.InGameClient.SendMessage(new KillCounterUpdateMessage()
_player.InGameClient.SendMessage(new KillCounterUpdateMessage()
{
BonusType = bonusType,
KilledCount = defeated,
@ -213,16 +213,16 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
Expired = true,
});
this._player.UpdateExp(expBonus);
this._player.Conversations.StartConversation(0x0002A73F);
_player.UpdateExp(expBonus);
_player.Conversations.StartConversation(0x0002A73F);
}
}
public void MonsterAttacked(int monsterAttackTick)
{
this._lastMonsterAttackTick = monsterAttackTick;
if (this._killstreakPlayer > 10)
this._player.InGameClient.SendMessage(new KillCounterUpdateMessage()
_lastMonsterAttackTick = monsterAttackTick;
if (_killstreakPlayer > 10)
_player.InGameClient.SendMessage(new KillCounterUpdateMessage()
{
BonusType = 0,
KilledCount = _killstreakPlayer,

View File

@ -81,13 +81,13 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public Inventory(Player owner)
{
this._owner = owner;
this._equipment = new Equipment(owner);
this._inventoryGrid = new InventoryGrid(owner, owner.Attributes[GameAttribute.Backpack_Slots] / 10, 10);
this._stashGrid = new InventoryGrid(owner, owner.Attributes[GameAttribute.Shared_Stash_Slots] / 7, 7, (int)EquipmentSlotId.Stash);
this._buybackGrid = new InventoryGrid(owner, 1, 20, (int)EquipmentSlotId.VendorBuyback);
this._skillSocketRunes = new uint[6];
this.StashRevealed = false;
_owner = owner;
_equipment = new Equipment(owner);
_inventoryGrid = new InventoryGrid(owner, owner.Attributes[GameAttribute.Backpack_Slots] / 10, 10);
_stashGrid = new InventoryGrid(owner, owner.Attributes[GameAttribute.Shared_Stash_Slots] / 7, 7, (int)EquipmentSlotId.Stash);
_buybackGrid = new InventoryGrid(owner, 1, 20, (int)EquipmentSlotId.VendorBuyback);
_skillSocketRunes = new uint[6];
StashRevealed = false;
}
private void AcceptMoveRequest(Item item)
@ -97,61 +97,61 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public List<Item> GetBackPackItems()
{
return new List<Item>(this._inventoryGrid.Items.Values);
return new List<Item>(_inventoryGrid.Items.Values);
}
public InventoryGrid GetBag()
{
return this._inventoryGrid;
return _inventoryGrid;
}
public List<Item> GetStashItems()
{
return new List<Item>(this._stashGrid.Items.Values);
return new List<Item>(_stashGrid.Items.Values);
}
public List<Item> GetEquippedItems()
{
return this._equipment.Items.Values.ToList();
return _equipment.Items.Values.ToList();
}
public List<Item> GetBuybackItems()
{
return new List<Item>(this._buybackGrid.Items.Values);
return new List<Item>(_buybackGrid.Items.Values);
}
public InventoryGrid GetBuybackGrid()
{
return this._buybackGrid;
return _buybackGrid;
}
public bool HaveEnough(int GBid, int count)
{
return (this._inventoryGrid.TotalItemCount(GBid) + this._stashGrid.TotalItemCount(GBid)) >= count;
return (_inventoryGrid.TotalItemCount(GBid) + _stashGrid.TotalItemCount(GBid)) >= count;
}
public void GrabSomeItems(int GBid, int count)
{
if (this._inventoryGrid.HaveEnough(GBid, count))
this._inventoryGrid.GrabSomeItems(GBid, count);
if (_inventoryGrid.HaveEnough(GBid, count))
_inventoryGrid.GrabSomeItems(GBid, count);
else
{
int inBag = this._inventoryGrid.TotalItemCount(GBid);
this._inventoryGrid.GrabSomeItems(GBid, inBag);
int inBag = _inventoryGrid.TotalItemCount(GBid);
_inventoryGrid.GrabSomeItems(GBid, inBag);
count -= inBag;
this._stashGrid.GrabSomeItems(GBid, count);
_stashGrid.GrabSomeItems(GBid, count);
}
}
public int GetGearScore()
{
return this.GetEquippedItems().Where(item => item.Attributes[GameAttribute.Item_Binding_Level_Override] == 0).Select(i => i.Rating).Sum();
return GetEquippedItems().Where(item => item.Attributes[GameAttribute.Item_Binding_Level_Override] == 0).Select(i => i.Rating).Sum();
}
public int GetAvgLevel()
{
if (this.GetEquippedItems().Count == 0) return 0;
return (int)this.GetEquippedItems().Select(item => item.ItemDefinition.ItemLevel).Average();
if (GetEquippedItems().Count == 0) return 0;
return (int)GetEquippedItems().Select(item => item.ItemDefinition.ItemLevel).Average();
}
@ -163,18 +163,18 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
//player.InGameClient.SendMessage(message);
player.World.BroadcastIfRevealed(plr => new VisualInventoryMessage()
{
ActorID = this._owner.DynamicID(plr),
ActorID = _owner.DynamicID(plr),
EquipmentList = new VisualEquipment()
{
Equipment = this._equipment.GetVisualEquipment(),
CosmeticEquipment = this._equipment.GetVisualCosmeticEquipment()
Equipment = _equipment.GetVisualEquipment(),
CosmeticEquipment = _equipment.GetVisualCosmeticEquipment()
},
}, this._owner);
}, _owner);
}
public D3.Hero.VisualEquipment GetVisualEquipment()
{
return this._equipment.GetVisualEquipmentForToon();
return _equipment.GetVisualEquipmentForToon();
}
public bool HasInventorySpace(Item item)
@ -241,7 +241,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
success = true;
item.CurrentState = ItemState.Normal;
foreach (var plr in this._owner.World.Players.Values)
foreach (var plr in _owner.World.Players.Values)
if (plr != _owner)
item.Unreveal(plr);
AcceptMoveRequest(item);
@ -266,8 +266,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
/// <param name="slot"></param>
public void EquipItem(Item item, int slot, bool save = true)
{
this._equipment.EquipItem(item, slot, save);
if (save) this.ChangeItemSlotDB(slot, item);
_equipment.EquipItem(item, slot, save);
if (save) ChangeItemSlotDB(slot, item);
}
public List<Item> PublicFindSameItems(int gbid)
@ -346,7 +346,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
int cost = (int)Math.Floor(item.GetPrice() / 25f) * Math.Max(1, item.Attributes[GameAttribute.Gold]);
_inventoryGrid.RemoveItem(item);
item.Unreveal(_owner);
this.AddGoldAmount(cost);
AddGoldAmount(cost);
(vendor as Vendor).AddBuybackItem(item, _owner);
_owner.PlayEffect(Effect.Sound, 36744);
}
@ -357,7 +357,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
if (Item.IsGem(target_item.ItemType)) return false; //can't equip gem
if (target_item.Attributes[GameAttribute.Requirement, 67] > (this._owner.Level + 5)) return false; //can't equip too high level
if (target_item.Attributes[GameAttribute.Requirement, 67] > (_owner.Level + 5)) return false; //can't equip too high level
if (destination_slot == 14 || destination_slot == 16 || destination_slot == 17)
return false; //can't equip in utility slots
@ -388,7 +388,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
item = _owner.ActiveHireling.GetItemByDynId(_owner, request.ItemID);
}
if (!this.CheckItemSlots(item, request.Location.EquipmentSlot)) return;
if (!CheckItemSlots(item, request.Location.EquipmentSlot)) return;
if (item.InvLoc(_owner).EquipmentSlot > 20)
{
@ -468,7 +468,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
AcceptMoveRequest(oldEquipItem);
}
SendVisualInventory(this._owner);
SendVisualInventory(_owner);
}
}
// Request to move an item (from backpack or equipmentslot)
@ -509,7 +509,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
if (_equipment.IsItemEquipped(item))
{
_equipment.UnequipItem(item); // Unequip the item
SendVisualInventory(this._owner);
SendVisualInventory(_owner);
}
else
{
@ -527,7 +527,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
{//if item in cell already exists (swaps them)
if (_equipment.IsItemEquipped(item))
{
SendVisualInventory(this._owner);
SendVisualInventory(_owner);
return; //don't allow to swap item from equipped
}
@ -747,8 +747,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
}
}
this.RefreshInventoryToClient();
this.CheckAchievements();
RefreshInventoryToClient();
CheckAchievements();
}
private void Recheckall()
@ -758,14 +758,14 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
private void CheckAchievements()
{
if (this.GetEquippedItems().Count == 0) return;
if (GetEquippedItems().Count == 0) return;
if (this.GetAvgLevel() >= 25)
if (GetAvgLevel() >= 25)
_owner.GrantAchievement(74987243307124);
if (this.GetAvgLevel() >= 60)
if (GetAvgLevel() >= 60)
_owner.GrantAchievement(74987243307126);
var items = this.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
_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
@ -787,7 +787,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
if (item == null || (request.DestEquipmentSlot != (int)EquipmentSlotId.Stash && request.DestEquipmentSlot != (int)EquipmentSlotId.Inventory))
return;
if (!this.CheckItemSlots(item, request.DestEquipmentSlot)) return;
if (!CheckItemSlots(item, request.DestEquipmentSlot)) return;
// Identify source and destination grids
var destinationGrid = request.DestEquipmentSlot == 0 ? _inventoryGrid : _stashGrid;
@ -819,7 +819,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
{
if (Item.Is2H(itemMainHand.ItemType))
{
if (Item.IsShield(itemOffHand.ItemType) && !this._owner.Attributes[GameAttribute.Allow_2H_And_Shield])
if (Item.IsShield(itemOffHand.ItemType) && !_owner.Attributes[GameAttribute.Allow_2H_And_Shield])
bugged = true; //Crusader - Heavenly Strength
if (Item.IsBow(itemMainHand.ItemType) && !Item.IsQuiver(itemOffHand.ItemType))
@ -845,7 +845,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
RemoveItemFromDB(itemOffHand);
_inventoryGrid.AddItem(itemOffHand);
SendVisualInventory(this._owner);
SendVisualInventory(_owner);
}
}
@ -913,10 +913,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public float GetMagicFind()
{
if (this._owner.World == null)
return this.GetItemBonus(GameAttribute.Magic_Find);
if (_owner.World == null)
return GetItemBonus(GameAttribute.Magic_Find);
var difficulty = this._owner.World.Game.Difficulty;
var difficulty = _owner.World.Game.Difficulty;
var mult = 1f;
switch (difficulty)
@ -934,15 +934,15 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
default: mult = 1f; break;
}
return this.GetItemBonus(GameAttribute.Magic_Find) * mult;
return GetItemBonus(GameAttribute.Magic_Find) * mult;
}
public float GetGoldFind()
{
if (this._owner.World == null)
return this.GetItemBonus(GameAttribute.Gold_Find);
if (_owner.World == null)
return GetItemBonus(GameAttribute.Gold_Find);
var difficulty = this._owner.World.Game.Difficulty;
var difficulty = _owner.World.Game.Difficulty;
var mult = 1f;
switch (difficulty)
@ -960,7 +960,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
default: mult = 1f; break;
}
return this.GetItemBonus(GameAttribute.Gold_Find) * mult;
return GetItemBonus(GameAttribute.Gold_Find) * mult;
}
@ -1023,7 +1023,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
//_equipment.EquipItem(item, (int)EquipmentSlotId.Main_Hand); //why it's here? it's just a check or not?
AcceptMoveRequest(item);
SendVisualInventory(this._owner);
SendVisualInventory(_owner);
return true;
}
@ -1070,8 +1070,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
item.Owner = _owner;
InventoryGrid targetGrid = (msg.InvLoc.EquipmentSlot == (int)EquipmentSlotId.Stash) ? _stashGrid : _inventoryGrid;
this.SaveItemToDB(_owner.Toon.GameAccount.DBGameAccount, _owner.Toon.DBToon, EquipmentSlotId.Inventory, item);
this.ChangeItemLocationDB(msg.InvLoc.Column, msg.InvLoc.Row, item);
SaveItemToDB(_owner.Toon.GameAccount.DBGameAccount, _owner.Toon.DBToon, EquipmentSlotId.Inventory, item);
ChangeItemLocationDB(msg.InvLoc.Column, msg.InvLoc.Row, item);
item.UpdateStackCount(amount);
targetGrid.PlaceItem(item, msg.InvLoc.Row, msg.InvLoc.Column);
}
@ -1102,12 +1102,12 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
if (_equipment.IsItemEquipped(item))
{
_equipment.UnequipItem(item);
SendVisualInventory(this._owner);
SendVisualInventory(_owner);
RemoveItemFromDB(item);
}
else
{
var sourceGrid = (item.InvLoc(this._owner).EquipmentSlot == 0 ? _inventoryGrid : _stashGrid);
var sourceGrid = (item.InvLoc(_owner).EquipmentSlot == 0 ? _inventoryGrid : _stashGrid);
sourceGrid.RemoveItem(item);
}
@ -1125,7 +1125,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public void Consume(GameClient client, GameMessage message)
{
if (client.Game.PvP) return;
if (this._owner.IsCasting) this._owner.StopCasting();
if (_owner.IsCasting) _owner.StopCasting();
if (message is InventoryRequestMoveMessage) HandleInventoryRequestMoveMessage(message as InventoryRequestMoveMessage);
else if (message is InventoryRequestQuickMoveMessage) HandleInventoryRequestQuickMoveMessage(message as InventoryRequestQuickMoveMessage);
else if (message is InventorySplitStackMessage) OnInventorySplitStackMessage(message as InventorySplitStackMessage);
@ -1146,7 +1146,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
else if (message is InventoryRepairAllMessage) RepairAll();
else if (message is InventoryRepairEquippedMessage) RepairEquipment();
if (this._equipment.EquipmentChanged)
if (_equipment.EquipmentChanged)
{
_owner.World.BuffManager.RemoveAllBuffs(_owner, false);
_owner.SetAttributesByItems();
@ -1156,18 +1156,18 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
_owner.SetAttributesByPassives();
_owner.SetAttributesByParagon();
_owner.SetAttributesSkillSets();
this.CheckWeapons();
CheckWeapons();
_owner.Attributes.BroadcastChangedIfRevealed();
_owner.SaveStats();
_owner.UpdatePercentageHP(_owner.PercHPbeforeChange);
_owner.Toon.PvERating = this.GetGearScore();
this._equipment.EquipmentChanged = false;
_owner.Toon.PvERating = GetGearScore();
_equipment.EquipmentChanged = false;
_owner.ToonStateChanged();
}
}
private void OnDyeItemMessage(GameClient client, DyeItemMessage msg)
{
this._equipment.EquipmentChanged = true;
_equipment.EquipmentChanged = true;
var Item = GetItemByDynId(_owner, msg.ItemID);
;
Item.Attributes[GameAttribute.DyeType] = msg.DyeID;
@ -1177,7 +1177,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
private void OnEnchantAffixMessage(GameClient client, EnchantAffixMessage msg)
{
this._equipment.EquipmentChanged = true;
_equipment.EquipmentChanged = true;
List<Affix> ListWithoutNo = new List<Affix>();
Affix ReloadAffix = null;
@ -1403,7 +1403,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
//Простые предметы
case 0:
foreach (var item in this.GetBackPackItems())
foreach (var item in GetBackPackItems())
if (!item.ItemDefinition.Name.ToLower().Contains("potion") &&
!item.ItemDefinition.Name.ToLower().Contains("gem") &&
!item.ItemType.Name.ToLower().Contains("gem") &&
@ -1422,7 +1422,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
break;
//Магические предметы
case 1:
foreach (var item in this.GetBackPackItems())
foreach (var item in GetBackPackItems())
if (item.Attributes[GameAttribute.Item_Quality_Level] > 2 &
item.Attributes[GameAttribute.Item_Quality_Level] < 6)
{
@ -1433,7 +1433,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
break;
//Редкие предметы
case 2:
foreach (var item in this.GetBackPackItems())
foreach (var item in GetBackPackItems())
if (item.Attributes[GameAttribute.Item_Quality_Level] > 5 &
item.Attributes[GameAttribute.Item_Quality_Level] < 9)
{
@ -1528,7 +1528,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
bool haveBrimstone = false;
Item brimstone = null;
if (item.Attributes[GameAttribute.Item_Quality_Level] > 8 || DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(1, 1000) == 1)
if (item.Attributes[GameAttribute.Item_Quality_Level] > 8 || FastRandom.Instance.Next(1, 1000) == 1)
{
if (item.ItemLevel >= 60)
rewardName = "Crafting_Legendary_01"; //Forgotten Soul
@ -1657,7 +1657,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
bool haveBrimstone = false;
Item brimstone = null;
if (item.Attributes[GameAttribute.Item_Quality_Level] > 8 || DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(1, 1000) == 1)
if (item.Attributes[GameAttribute.Item_Quality_Level] > 8 || FastRandom.Instance.Next(1, 1000) == 1)
{
if (item.ItemLevel >= 60)
rewardName = "Crafting_Legendary_01"; //Forgotten Soul
@ -1708,7 +1708,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
var recipeGBId = msg.GBIDRecipe;
var recipeDefinition = ItemGenerator.GetRecipeDefinition(recipeGBId);
//if (!this._owner.RecipeAvailable(recipeDefinition)) return;
var recipe = (DiIiS_NA.Core.MPQ.FileFormats.Recipe)MPQStorage.Data.Assets[SNOGroup.Recipe][recipeDefinition.SNORecipe].Data;
var recipe = (Recipe)MPQStorage.Data.Assets[SNOGroup.Recipe][recipeDefinition.SNORecipe].Data;
var extraAffixCount = recipe.ItemSpecifierData.AdditionalRandomAffixes + FastRandom.Instance.Next(0, recipe.ItemSpecifierData.AdditionalRandomAffixesDelta);
Item reward = ItemGenerator.CookFromDefinition(_owner.World, ItemGenerator.GetItemDefinition(recipe.ItemSpecifierData.ItemGBId), Math.Min(extraAffixCount, 9), false, true);
@ -1748,7 +1748,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
if (Item.IsGem(reward.ItemType))
{
Item FoundedItem = null;
foreach (var item in this.GetBackPackItems())
foreach (var item in GetBackPackItems())
if (item.ItemDefinition.Hash == ingr.ItemsGBID)
{
FoundedItem = item;
@ -1766,7 +1766,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
return;
}
if (FoundedItem == null)
foreach (var item in this.GetStashItems())
foreach (var item in GetStashItems())
if (item.ItemDefinition.Hash == ingr.ItemsGBID)
{
if (item.Attributes[GameAttribute.ItemStackQuantityLo] == ingr.Count)
@ -1834,9 +1834,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
if (Item.IsGem(reward.ItemType))
{
if (!this._achievementGranted)
if (!_achievementGranted)
{
this._achievementGranted = true;
_achievementGranted = true;
_owner.GrantAchievement(74987243307784);
}
if (_owner.Toon.isSeassoned)
@ -1846,9 +1846,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
//74987245885431
}
if (reward.ItemDefinition.Name.Contains("_06") && !this._radiantAchievementGranted)
if (reward.ItemDefinition.Name.Contains("_06") && !_radiantAchievementGranted)
{
this._radiantAchievementGranted = true;
_radiantAchievementGranted = true;
_owner.GrantAchievement(74987243307785);
}
@ -1969,7 +1969,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
RemoveGoldAmount(amount);
item.UpdateTransmog(msg.GBIDTransmog);
item.Attributes.BroadcastChangedIfRevealed();
SendVisualInventory(this._owner);
SendVisualInventory(_owner);
}
_owner.GrantCriteria(74987253143400);
}
@ -2085,14 +2085,14 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
if (item.DBInventory.FirstGem != -1)
{
this.PickUp(ItemGenerator.CookFromDefinition(_owner.World, ItemGenerator.GetItemDefinition(item.DBInventory.FirstGem)));
PickUp(ItemGenerator.CookFromDefinition(_owner.World, ItemGenerator.GetItemDefinition(item.DBInventory.FirstGem)));
}
if (item.DBInventory.SecondGem != -1)
this.PickUp(ItemGenerator.CookFromDefinition(_owner.World, ItemGenerator.GetItemDefinition(item.DBInventory.SecondGem)));
PickUp(ItemGenerator.CookFromDefinition(_owner.World, ItemGenerator.GetItemDefinition(item.DBInventory.SecondGem)));
if (item.DBInventory.ThirdGem != -1)
this.PickUp(ItemGenerator.CookFromDefinition(_owner.World, ItemGenerator.GetItemDefinition(item.DBInventory.ThirdGem)));
PickUp(ItemGenerator.CookFromDefinition(_owner.World, ItemGenerator.GetItemDefinition(item.DBInventory.ThirdGem)));
item.DBInventory.FirstGem = -1;
item.DBInventory.SecondGem = -1;
@ -2114,7 +2114,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
{
RepairEquipment();
int cost = 0;
foreach (var item in this.GetBackPackItems())
foreach (var item in GetBackPackItems())
if (item.Attributes[GameAttribute.Durability_Cur] < item.Attributes[GameAttribute.Durability_Max])
{
cost += (int)((item.GetPrice() * (item.Attributes[GameAttribute.Durability_Max] - item.Attributes[GameAttribute.Durability_Cur])) / (item.Attributes[GameAttribute.Durability_Max] * 25));
@ -2126,7 +2126,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public void RepairEquipment()
{
int cost = 0;
foreach (var item in this.GetEquippedItems())
foreach (var item in GetEquippedItems())
if (item.Attributes[GameAttribute.Durability_Cur] < item.Attributes[GameAttribute.Durability_Max])
{
cost += (int)((item.GetPrice() * (item.Attributes[GameAttribute.Durability_Max] - item.Attributes[GameAttribute.Durability_Cur])) / (item.Attributes[GameAttribute.Durability_Max] * 25));
@ -2168,7 +2168,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public void DecreaseItemStack(Item item, int count = 1)
{
this.GrabSomeItems(item.GBHandle.GBID, count);
GrabSomeItems(item.GBHandle.GBID, count);
}
public void DestroyInventoryItem(Item item)
@ -2227,8 +2227,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public Item GetItemByDynId(Player plr, uint dynId)
{
if (this._inventoryGrid.Items.Values.Union(_stashGrid.Items.Values).Union(_equipment.Items.Values).Where(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId).Count() > 0)
return this._inventoryGrid.Items.Values.Union(_stashGrid.Items.Values).Union(_equipment.Items.Values).Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
if (_inventoryGrid.Items.Values.Union(_stashGrid.Items.Values).Union(_equipment.Items.Values).Where(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId).Count() > 0)
return _inventoryGrid.Items.Values.Union(_stashGrid.Items.Values).Union(_equipment.Items.Values).Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
else
return null;
}
@ -2305,7 +2305,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
int C3 = 0; foreach (var item in FindSameItems(-605947593)) C3 += item.Attributes[GameAttribute.ItemStackQuantityLo];
var Moneys = D3.Items.CurrencySavedData.CreateBuilder();
D3.Items.CurrencyData GoldData = D3.Items.CurrencyData.CreateBuilder().SetId(0).SetCount((long)this.GetGoldAmount()).Build();
D3.Items.CurrencyData GoldData = D3.Items.CurrencyData.CreateBuilder().SetId(0).SetCount((long)GetGoldAmount()).Build();
//D3.Items.CurrencyData.CreateBuilder().SetId(1).SetCount(_owner.InGameClient.BnetClient.Account.GameAccount.BloodShards).Build();
var BloodShardsElement = D3.Items.CurrencyData.CreateBuilder().SetId(1);
if (immediately)
@ -2338,7 +2338,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public void UpdateCurrencies()
{
var Moneys = D3.Items.CurrencySavedData.CreateBuilder();
D3.Items.CurrencyData GoldData = D3.Items.CurrencyData.CreateBuilder().SetId(0).SetCount((long)this.GetGoldAmount()).Build();
D3.Items.CurrencyData GoldData = D3.Items.CurrencyData.CreateBuilder().SetId(0).SetCount((long)GetGoldAmount()).Build();
D3.Items.CurrencyData BloodShardData = D3.Items.CurrencyData.CreateBuilder().SetId(1).SetCount(_owner.InGameClient.BnetClient.Account.GameAccount.BloodShards).Build();
D3.Items.CurrencyData PlatinumData = D3.Items.CurrencyData.CreateBuilder().SetId(2).SetCount(_owner.InGameClient.BnetClient.Account.GameAccount.Platinum).Build();
D3.Items.CurrencyData Craft1Data = D3.Items.CurrencyData.CreateBuilder().SetId(3).SetCount(_owner.Toon.CraftItem1).Build();
@ -2382,7 +2382,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public void RemoveBloodShardsAmount(int amount)
{
this.BloodShards -= amount;
BloodShards -= amount;
if (_owner.World.Game.IsHardcore)
_owner.Toon.GameAccount.HardcoreBloodShards -= amount;
@ -2393,7 +2393,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public int GetBloodShardsAmount()
{
return this.BloodShards;
return BloodShards;
}
public void LoadFromDB()
@ -2404,7 +2404,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
int goldAmount = _owner.World.Game.IsHardcore ?
(int)_owner.World.Game.GameDBSession.SessionGet<DBGameAccount>(_owner.Toon.GameAccount.PersistentID).HardcoreGold :
(int)_owner.World.Game.GameDBSession.SessionGet<DBGameAccount>(_owner.Toon.GameAccount.PersistentID).Gold;
this.BloodShards = _owner.World.Game.IsHardcore ?
BloodShards = _owner.World.Game.IsHardcore ?
(int)_owner.World.Game.GameDBSession.SessionGet<DBGameAccount>(_owner.Toon.GameAccount.PersistentID).HardcoreBloodShards :
(int)_owner.World.Game.GameDBSession.SessionGet<DBGameAccount>(_owner.Toon.GameAccount.PersistentID).BloodShards;
// Clear already present items
@ -2444,7 +2444,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
//item.DBInventory = inv;
if (slot == (int)EquipmentSlotId.Inventory)
{
this._inventoryGrid.PlaceItem(item, inv.LocationY, inv.LocationX);
_inventoryGrid.PlaceItem(item, inv.LocationY, inv.LocationX);
}
else
{
@ -2452,14 +2452,14 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
}
}
}
this.SendVisualInventory(_owner);
SendVisualInventory(_owner);
_owner.SetAttributesByItems();
_owner.SetAttributesByItemProcs();
_owner.SetAttributesByGems();
_owner.SetAttributesByItemSets();
_owner.SetAttributesByPassives();
_owner.SetAttributesByParagon();
this.CheckWeapons();
CheckWeapons();
_owner.Attributes.BroadcastChangedIfRevealed();
Task.Delay(3000).ContinueWith((t) => {
try
@ -2470,17 +2470,17 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
});
//}).ContinueWith((a) =>{
this._inventoryGold = ItemGenerator.CreateGold(this._owner, goldAmount);
this._inventoryGold.Attributes[GameAttribute.Gold] = goldAmount;
this._inventoryGold.Attributes[GameAttribute.ItemStackQuantityLo] = goldAmount; // This is the attribute that makes the gold visible in gamethe gold visible in game
this._inventoryGold.Owner = _owner;
this._inventoryGold.SetInventoryLocation((int)EquipmentSlotId.Gold, 0, 0);
_inventoryGold = ItemGenerator.CreateGold(_owner, goldAmount);
_inventoryGold.Attributes[GameAttribute.Gold] = goldAmount;
_inventoryGold.Attributes[GameAttribute.ItemStackQuantityLo] = goldAmount; // This is the attribute that makes the gold visible in gamethe gold visible in game
_inventoryGold.Owner = _owner;
_inventoryGold.SetInventoryLocation((int)EquipmentSlotId.Gold, 0, 0);
//this.inventoryPotion = ItemGenerator.CreateItem(this._owner, ItemGenerator.GetItemDefinition(DiIiS_NA.Core.Helpers.Hash.StringHashHelper.HashItemName("HealthPotionBottomless")));
//this.inventoryPotion.Owner = _owner;
//this.inventoryPotion.SetInventoryLocation((int)EquipmentSlotId.Inventory, 0, 0);
//*/
this.Loaded = true;
Loaded = true;
UpdateCurrencies();
//});
_owner.UpdatePercentageHP(_owner.PercHPbeforeChange);
@ -2512,34 +2512,34 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
// load stash
item = ItemGenerator.LoadFromDB(_owner, inv);
item.DBInventory = inv;
this._stashGrid.PlaceItem(item, inv.LocationY, inv.LocationX);
_stashGrid.PlaceItem(item, inv.LocationY, inv.LocationX);
}
}
//}).Wait();
this.StashLoaded = true;
StashLoaded = true;
}
public void UnrevealStash()
{
this._stashGrid.Unreveal(this._owner);
_stashGrid.Unreveal(_owner);
}
public void RefreshInventoryToClient()
{
var itemsToUpdate = new List<Item>();
itemsToUpdate.AddRange(this._inventoryGrid.Items.Values);
if (this.StashRevealed)
itemsToUpdate.AddRange(this._stashGrid.Items.Values);
itemsToUpdate.AddRange(this._buybackGrid.Items.Values);
itemsToUpdate.Add(this._inventoryGold);
itemsToUpdate.AddRange(_inventoryGrid.Items.Values);
if (StashRevealed)
itemsToUpdate.AddRange(_stashGrid.Items.Values);
itemsToUpdate.AddRange(_buybackGrid.Items.Values);
itemsToUpdate.Add(_inventoryGold);
//Task.Run(() =>
//{
foreach (var itm in itemsToUpdate)
{
if (itm.Owner is PlayerSystem.Player)
if (itm.Owner is Player)
{
var player = (itm.Owner as PlayerSystem.Player);
var player = (itm.Owner as Player);
//Thread.Sleep(30);
if (!itm.Reveal(player))
{
@ -2547,7 +2547,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
}
}
}
this.SendVisualInventory(_owner);
SendVisualInventory(_owner);
_owner.SetAttributesByItems();
_owner.SetAttributesByItemProcs();
_owner.SetAttributesByGems();
@ -2657,37 +2657,37 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
#region EqupimentStats
public float GetItemBonus(GameAttributeF attributeF)
{
if (!this.Loaded) return _owner.Attributes[attributeF];
if (!Loaded) return _owner.Attributes[attributeF];
var stats = this.GetEquippedItems().Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0);
var stats = GetEquippedItems().Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0);
return stats.Sum(item => item.Attributes[attributeF]);
}
public int GetItemBonus(GameAttributeI attributeI)
{
return this.Loaded ? this.GetEquippedItems().Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0).Sum(item => item.Attributes[attributeI]) : _owner.Attributes[attributeI];
return Loaded ? GetEquippedItems().Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0).Sum(item => item.Attributes[attributeI]) : _owner.Attributes[attributeI];
}
public bool GetItemBonus(GameAttributeB attributeB)
{
return this.Loaded ? (this.GetEquippedItems().Where(item => item.Attributes[attributeB] == true).Count() > 0) : _owner.Attributes[attributeB];
return Loaded ? (GetEquippedItems().Where(item => item.Attributes[attributeB] == true).Count() > 0) : _owner.Attributes[attributeB];
}
public float GetItemBonus(GameAttributeF attributeF, int attributeKey)
{
return this.Loaded ? this.GetEquippedItems().Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0).Sum(item => item.Attributes[attributeF, attributeKey]) : _owner.Attributes[attributeF];
return Loaded ? GetEquippedItems().Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0).Sum(item => item.Attributes[attributeF, attributeKey]) : _owner.Attributes[attributeF];
}
public int GetItemBonus(GameAttributeI attributeI, int attributeKey)
{
return this.Loaded ? this.GetEquippedItems().Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0).Sum(item => item.Attributes[attributeI, attributeKey]) : _owner.Attributes[attributeI];
return Loaded ? GetEquippedItems().Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0).Sum(item => item.Attributes[attributeI, attributeKey]) : _owner.Attributes[attributeI];
}
public void SetGemBonuses()
{
uint countofGems = 0;
foreach (var equip in this.GetEquippedItems())
foreach (var equip in GetEquippedItems())
{
foreach (var gem in equip.Gems)
{
@ -2711,15 +2711,15 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
_owner.Attributes.BroadcastChangedIfRevealed();
//_owner.Attributes[effect.Attribute[0].]
countofGems++;
if (this._owner.InGameClient.Game.IsSeasoned && countofGems >= 5)
this._owner.GrantCriteria(74987254401623);
if (_owner.InGameClient.Game.IsSeasoned && countofGems >= 5)
_owner.GrantCriteria(74987254401623);
}
}
}
public void SetItemSetBonuses()
{
foreach (var set in this.GetEquippedItems().Where(i => i.ItemDefinition.SNOSet != -1).GroupBy(i => i.ItemDefinition.SNOSet))
foreach (var set in GetEquippedItems().Where(i => i.ItemDefinition.SNOSet != -1).GroupBy(i => i.ItemDefinition.SNOSet))
{
for (int c = 1; c <= set.Count(); c++)
{
@ -2750,7 +2750,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public void DecreaseDurability(float percent)
{
foreach (var equip in this.GetEquippedItems())
foreach (var equip in GetEquippedItems())
{
if (equip.Attributes[GameAttribute.Item_Indestructible] == false)
{

File diff suppressed because it is too large Load Diff

View File

@ -46,12 +46,12 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
public ActorMover(Actor target)
{
this.Target = target;
Target = target;
}
public void Move(Vector3D destination, float speed, ACDTranslateNormalMessage baseMessage = null)
{
if (this.Target == null || this.Target.World == null) return;
if (Target == null || Target.World == null) return;
//if (destination == this.Target.Position) return;
_SetupMove(destination, speed);
_moveCommand = MoveCommandType.Normal;
@ -61,16 +61,16 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
//baseMessage.ActorId = (int)this.Target.DynamicID;
baseMessage.Position = destination;
baseMessage.Angle = (float)Math.Acos(this.Target.RotationW) * 2f;
baseMessage.Angle = (float)Math.Acos(Target.RotationW) * 2f;
baseMessage.MovementSpeed = speed;
this.Target.World.BroadcastIfRevealed(plr => { baseMessage.ActorId = this.Target.DynamicID(plr); return baseMessage; }, this.Target);
Target.World.BroadcastIfRevealed(plr => { baseMessage.ActorId = Target.DynamicID(plr); return baseMessage; }, Target);
}
public void MoveFixed(Vector3D targetPosition, float speed, ACDTranslateFixedMessage baseMessage = null)
{
if (this.Target == null || this.Target.World == null) return;
if (Target == null || Target.World == null) return;
_SetupMove(targetPosition, speed);
_moveCommand = MoveCommandType.Fixed;
@ -78,9 +78,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
baseMessage = new ACDTranslateFixedMessage();
//baseMessage.ActorId = (int)this.Target.DynamicID;
baseMessage.Velocity = this.Velocity;
baseMessage.Velocity = Velocity;
this.Target.World.BroadcastIfRevealed(plr => { baseMessage.ActorId = (int)this.Target.DynamicID(plr); return baseMessage; }, this.Target);
Target.World.BroadcastIfRevealed(plr => { baseMessage.ActorId = (int)Target.DynamicID(plr); return baseMessage; }, Target);
}
public bool IsFixedMove()
@ -95,7 +95,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
public void MoveArc(Vector3D destination, float height, float gravity, ACDTranslateArcMessage baseMessage = null)
{
if (this.Target == null || this.Target.World == null) return;
if (Target == null || Target.World == null) return;
_SetupArcMove(destination, height, gravity);
_moveCommand = MoveCommandType.Arc;
@ -103,27 +103,27 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
baseMessage = new ACDTranslateArcMessage();
//baseMessage.ActorId = (int)this.Target.DynamicID;
baseMessage.Start = this.Target.Position;
baseMessage.Velocity = this.Velocity;
baseMessage.Start = Target.Position;
baseMessage.Velocity = Velocity;
baseMessage.Gravity = gravity;
baseMessage.DestinationZ = destination.Z;
this.Target.World.BroadcastIfRevealed(plr => { baseMessage.ActorId = (int)this.Target.DynamicID(plr); return baseMessage; }, this.Target);
Target.World.BroadcastIfRevealed(plr => { baseMessage.ActorId = (int)Target.DynamicID(plr); return baseMessage; }, Target);
}
public void MoveCircle(Vector3D center, float radius, float speed, float duration, ACDTranslateDetPathSpiralMessage baseMessage = null)
{
if (this.Target == null || this.Target.World == null) return;
if (Target == null || Target.World == null) return;
_curvatureCenter = new Vector3D(center);
_curvatureRadius = radius;
_angularSpeed = speed / radius;
_SetCircleVelocity(); //projectile is placed on trajectory in LaunchCircle
this.ArrivalTime = new RelativeTickTimer(this.Target.World.Game, (int)(duration * 60f));
ArrivalTime = new RelativeTickTimer(Target.World.Game, (int)(duration * 60f));
_startPosition = this.Target.Position;
_startPosition = Target.Position;
_endPosition = null;
_startTick = this.Target.World.Game.TickCounter;
_startTick = Target.World.Game.TickCounter;
_moveCommand = MoveCommandType.Circle;
if (baseMessage == null)
@ -131,38 +131,38 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
//baseMessage.ActorId = (int)this.Target.DynamicID;
baseMessage.StartPosition = _startPosition;
baseMessage.TargetPosition = this.Velocity;
baseMessage.TargetPosition = Velocity;
this.Target.World.BroadcastIfRevealed(plr => { baseMessage.DynamicId = this.Target.DynamicID(plr); return baseMessage; }, this.Target);
Target.World.BroadcastIfRevealed(plr => { baseMessage.DynamicId = Target.DynamicID(plr); return baseMessage; }, Target);
}
private void _SetCircleVelocity()
{
Vector3D angular = _curvatureCenter + new Vector3D(0, 0, _angularSpeed);
this.Velocity = PowerMath.CrossProduct(angular, this.Target.Position);
Velocity = PowerMath.CrossProduct(angular, Target.Position);
}
public bool Update()
{
if (this.Target == null || this.Target.World == null) return true;
if (Target == null || Target.World == null) return true;
_UpdatePosition();
return this.Arrived;
return Arrived;
}
private void _SetupMove(Vector3D destination, float speed)
{
Vector3D dir_normal = PowerMath.Normalize(new Vector3D(destination.X - this.Target.Position.X,
destination.Y - this.Target.Position.Y,
destination.Z - this.Target.Position.Z));
Vector3D dir_normal = PowerMath.Normalize(new Vector3D(destination.X - Target.Position.X,
destination.Y - Target.Position.Y,
destination.Z - Target.Position.Z));
this.Velocity = new Vector3D(dir_normal.X * speed,
Velocity = new Vector3D(dir_normal.X * speed,
dir_normal.Y * speed,
dir_normal.Z * speed);
this.ArrivalTime = new RelativeTickTimer(this.Target.World.Game,
(int)(PowerMath.Distance2D(this.Target.Position, destination) / speed));
_startPosition = this.Target.Position;
ArrivalTime = new RelativeTickTimer(Target.World.Game,
(int)(PowerMath.Distance2D(Target.Position, destination) / speed));
_startPosition = Target.Position;
_endPosition = destination;
_startTick = this.Target.World.Game.TickCounter;
_startTick = Target.World.Game.TickCounter;
}
private void _SetupArcMove(Vector3D destination, float crestHeight, float gravity)
@ -172,60 +172,60 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
float arcLength = (float)Math.Sqrt(2f * crestHeight / absGravity);
int arrivalTicks = (int)(arcLength * 2f);
float distance = PowerMath.Distance2D(this.Target.Position, destination);
Vector3D normal = PowerMath.Normalize(new Vector3D(destination.X - this.Target.Position.X,
destination.Y - this.Target.Position.Y,
float distance = PowerMath.Distance2D(Target.Position, destination);
Vector3D normal = PowerMath.Normalize(new Vector3D(destination.X - Target.Position.X,
destination.Y - Target.Position.Y,
0f));
this.Velocity = new Vector3D(normal.X * (distance / arrivalTicks),
Velocity = new Vector3D(normal.X * (distance / arrivalTicks),
normal.Y * (distance / arrivalTicks),
absGravity * arcLength);
this.ArrivalTime = new RelativeTickTimer(this.Target.World.Game, arrivalTicks);
_startPosition = this.Target.Position;
ArrivalTime = new RelativeTickTimer(Target.World.Game, arrivalTicks);
_startPosition = Target.Position;
_endPosition = destination;
_startTick = this.Target.World.Game.TickCounter;
_startTick = Target.World.Game.TickCounter;
_arcGravity = gravity;
}
private void _UpdatePosition()
{
if (_moveCommand == MoveCommandType.Circle && this.Arrived)
if (_moveCommand == MoveCommandType.Circle && Arrived)
{
this.Target.Destroy();
Target.Destroy();
return;
}
if (_moveCommand != MoveCommandType.Fixed && this.Arrived)
if (_moveCommand != MoveCommandType.Fixed && Arrived)
{
this.Target.Position = _endPosition;
Target.Position = _endPosition;
return;
}
int moveTicks = 1;
try
{
moveTicks = this.Target.World.Game.TickCounter - _startTick;
moveTicks = Target.World.Game.TickCounter - _startTick;
}
catch { }
if (_moveCommand == MoveCommandType.Arc)
{
this.Target.Position = new Vector3D(_startPosition.X + this.Velocity.X * moveTicks,
_startPosition.Y + this.Velocity.Y * moveTicks,
_startPosition.Z + 0.5f * _arcGravity * (moveTicks * moveTicks) + this.Velocity.Z * moveTicks);
Target.Position = new Vector3D(_startPosition.X + Velocity.X * moveTicks,
_startPosition.Y + Velocity.Y * moveTicks,
_startPosition.Z + 0.5f * _arcGravity * (moveTicks * moveTicks) + Velocity.Z * moveTicks);
}
else if (_moveCommand == MoveCommandType.Circle)
{
this.Target.Position = new Vector3D(_startPosition.X + this.Velocity.X * moveTicks,
_startPosition.Y + this.Velocity.Y * moveTicks,
_startPosition.Z + this.Velocity.Z * moveTicks);
Target.Position = new Vector3D(_startPosition.X + Velocity.X * moveTicks,
_startPosition.Y + Velocity.Y * moveTicks,
_startPosition.Z + Velocity.Z * moveTicks);
_SetCircleVelocity();
//this.Target.TranslateFacing(this.Target.Position + this.Velocity, true);
}
else
{
this.Target.Position = new Vector3D(_startPosition.X + this.Velocity.X * moveTicks,
_startPosition.Y + this.Velocity.Y * moveTicks,
_startPosition.Z + this.Velocity.Z * moveTicks);
Target.Position = new Vector3D(_startPosition.X + Velocity.X * moveTicks,
_startPosition.Y + Velocity.Y * moveTicks,
_startPosition.Z + Velocity.Z * moveTicks);
}
}
}

View File

@ -39,7 +39,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
Target.Attributes[GameAttribute.Buff_Exclusive_Type_Active, PowerSNO] = false;
Target.Attributes.BroadcastChangedIfRevealed();
}
this.Removed = true;
Removed = true;
}
public virtual void Init() { }
@ -57,18 +57,18 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
{
if (Target.World == null)
{
this.Remove();
Remove();
return true;
}
return (this.Timeout != null && this.Timeout.TimedOut) || this.Removed;
return (Timeout != null && Timeout.TimedOut) || Removed;
}
public override bool Stack(Buff buff)
{
TimedBuff newbuff = (TimedBuff)buff;
// update buff if new timeout is longer than current one, or if new buff has no timeout
if (newbuff.Timeout == null || this.Timeout != null && newbuff.Timeout.TimeoutTick > this.Timeout.TimeoutTick)
this.Timeout = newbuff.Timeout;
if (newbuff.Timeout == null || Timeout != null && newbuff.Timeout.TimeoutTick > Timeout.TimeoutTick)
Timeout = newbuff.Timeout;
return true;
}
@ -77,8 +77,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
{
TimedBuff newbuff = (TimedBuff)buff;
// update buff if new timeout is longer than current one, or if new buff has no timeout
if (newbuff.Timeout == null || this.Timeout != null && newbuff.Timeout.TimeoutTick > this.Timeout.TimeoutTick)
this.Timeout = newbuff.Timeout;
if (newbuff.Timeout == null || Timeout != null && newbuff.Timeout.TimeoutTick > Timeout.TimeoutTick)
Timeout = newbuff.Timeout;
return true;
}
@ -96,7 +96,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
public PowerBuff()
{
// try to load buff options from attribute
var attributes = (ImplementsPowerBuff[])this.GetType().GetCustomAttributes(typeof(ImplementsPowerBuff), true);
var attributes = (ImplementsPowerBuff[])GetType().GetCustomAttributes(typeof(ImplementsPowerBuff), true);
foreach (var attr in attributes)
{
BuffSlot = attr.BuffSlot;
@ -108,19 +108,19 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
{
base.Apply();
if (this.StartTick == 0)
this.StartTick = this.Target.World.Game.TickCounter;
if (StartTick == 0)
StartTick = Target.World.Game.TickCounter;
Target.Attributes[_Power_Buff_N_VisualEffect_R, PowerSNO] = true;
if (this.Timeout != null)
if (Timeout != null)
{
Target.Attributes[_Buff_Icon_Start_TickN, PowerSNO] = this.StartTick;
Target.Attributes[_Buff_Icon_End_TickN, PowerSNO] = this.Timeout.TimeoutTick;
Target.Attributes[_Buff_Icon_Start_TickN, PowerSNO] = StartTick;
Target.Attributes[_Buff_Icon_End_TickN, PowerSNO] = Timeout.TimeoutTick;
Target.Attributes[_Buff_Icon_CountN, PowerSNO] = 1;
}
Target.Attributes.BroadcastChangedIfRevealed();
this.StackCount = 1;
StackCount = 1;
return true;
}
@ -130,7 +130,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
base.Remove();
Target.Attributes[_Power_Buff_N_VisualEffect_R, PowerSNO] = false;
if (this.Timeout != null)
if (Timeout != null)
{
Target.Attributes[_Buff_Icon_Start_TickN, PowerSNO] = 0;
Target.Attributes[_Buff_Icon_End_TickN, PowerSNO] = 0;
@ -145,20 +145,20 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
{
base.Stack(buff);
bool canStack = this.IsCountingStacks && StackCount != MaxStackCount;
bool canStack = IsCountingStacks && StackCount != MaxStackCount;
if (this.Timeout != null)
if (Timeout != null)
{
this.StartTick = this.Target.World.Game.TickCounter;
Target.Attributes[_Buff_Icon_Start_TickN, PowerSNO] = this.StartTick;
Target.Attributes[_Buff_Icon_End_TickN, PowerSNO] = this.Timeout.TimeoutTick;
StartTick = Target.World.Game.TickCounter;
Target.Attributes[_Buff_Icon_Start_TickN, PowerSNO] = StartTick;
Target.Attributes[_Buff_Icon_End_TickN, PowerSNO] = Timeout.TimeoutTick;
if (canStack)
Target.Attributes[_Buff_Icon_CountN, PowerSNO] += 1;
}
Target.Attributes.BroadcastChangedIfRevealed();
if (canStack)
this.StackCount += 1;
StackCount += 1;
return true;
}
@ -167,38 +167,38 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
{
base.DeStack(buff);
bool canDeStack = this.IsCountingStacks && StackCount > 1;
bool canDeStack = IsCountingStacks && StackCount > 1;
if (this.Timeout != null)
if (Timeout != null)
{
Target.Attributes[_Buff_Icon_Start_TickN, PowerSNO] = this.Timeout.TimeoutTick;
Target.Attributes[_Buff_Icon_End_TickN, PowerSNO] = this.Timeout.TimeoutTick;
Target.Attributes[_Buff_Icon_Start_TickN, PowerSNO] = Timeout.TimeoutTick;
Target.Attributes[_Buff_Icon_End_TickN, PowerSNO] = Timeout.TimeoutTick;
if (canDeStack)
Target.Attributes[_Buff_Icon_CountN, PowerSNO] -= 1;
}
Target.Attributes.BroadcastChangedIfRevealed();
if (canDeStack) this.StackCount -= 1;
if (canDeStack) StackCount -= 1;
return true;
}
public void Extend(int ticks)
{
this.Timeout.TimeoutTick += ticks;
Target.Attributes[_Buff_Icon_End_TickN, PowerSNO] = this.Timeout.TimeoutTick;
Timeout.TimeoutTick += ticks;
Target.Attributes[_Buff_Icon_End_TickN, PowerSNO] = Timeout.TimeoutTick;
Target.Attributes.BroadcastChangedIfRevealed();
}
public void Reduce(int ticks)
{
this.Timeout.TimeoutTick -= ticks;
Timeout.TimeoutTick -= ticks;
if (this is CooldownBuff)
{
Target.Attributes[GameAttribute.Power_Cooldown_Start, (this as CooldownBuff).TargetPowerSNO] -= ticks;
Target.Attributes[GameAttribute.Power_Cooldown, (this as CooldownBuff).TargetPowerSNO] = this.Timeout.TimeoutTick;
Target.Attributes[GameAttribute.Power_Cooldown, (this as CooldownBuff).TargetPowerSNO] = Timeout.TimeoutTick;
}
Target.Attributes[_Buff_Icon_End_TickN, PowerSNO] = this.Timeout.TimeoutTick;
Target.Attributes[_Buff_Icon_End_TickN, PowerSNO] = Timeout.TimeoutTick;
Target.Attributes.BroadcastChangedIfRevealed();
}

View File

@ -40,29 +40,29 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
public EffectActor(PowerContext context, ActorSno actorSNO, Vector3D position)
: base(context.World, actorSNO)
{
this.Context = context;
Context = context;
this.Field2 = 0x8;
if (this.Scale == 0f)
this.Scale = 1f;
this.Position = position;
Field2 = 0x8;
if (Scale == 0f)
Scale = 1f;
Position = position;
// copy in important effect params from user
if (context != null)
if (context.PowerSNO != 0)
{
this.Attributes[GameAttribute.Rune_A, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_A, context.PowerSNO];
this.Attributes[GameAttribute.Rune_B, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_B, context.PowerSNO];
this.Attributes[GameAttribute.Rune_C, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_C, context.PowerSNO];
this.Attributes[GameAttribute.Rune_D, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_D, context.PowerSNO];
this.Attributes[GameAttribute.Rune_E, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_E, context.PowerSNO];
Attributes[GameAttribute.Rune_A, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_A, context.PowerSNO];
Attributes[GameAttribute.Rune_B, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_B, context.PowerSNO];
Attributes[GameAttribute.Rune_C, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_C, context.PowerSNO];
Attributes[GameAttribute.Rune_D, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_D, context.PowerSNO];
Attributes[GameAttribute.Rune_E, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_E, context.PowerSNO];
}
}
public void Spawn(float facingAngle = 0)
{
this.SetFacingRotation(facingAngle);
this.World.Enter(this);
SetFacingRotation(facingAngle);
World.Enter(this);
}
public virtual void Update(int tickCounter)
@ -72,15 +72,15 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
if (OnTimeout != null)
OnTimeout();
this.Destroy();
Destroy();
}
else if (OnUpdate != null)
{
if (_updateTimer == null || _updateTimer.TimedOut)
{
OnUpdate();
if (this.UpdateDelay > 0f)
_updateTimer = new SecondsTickTimer(this.Context.World.Game, this.UpdateDelay);
if (UpdateDelay > 0f)
_updateTimer = new SecondsTickTimer(Context.World.Game, UpdateDelay);
else
_updateTimer = null;
}

View File

@ -43,15 +43,15 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override bool Apply()
{
base.Apply();
this.Target.Attributes[GameAttribute.Invulnerable] = true;
this.Target.Attributes[GameAttribute.Has_Look_Override] = true;//0x0782CAC5;
Target.Attributes[GameAttribute.Invulnerable] = true;
Target.Attributes[GameAttribute.Has_Look_Override] = true;//0x0782CAC5;
return true;
}
public override void Remove()
{
this.Target.Attributes[GameAttribute.Invulnerable] = false;
this.Target.Attributes[GameAttribute.Has_Look_Override] = false;
Target.Attributes[GameAttribute.Invulnerable] = false;
Target.Attributes[GameAttribute.Has_Look_Override] = false;
base.Remove();
}
}
@ -70,7 +70,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override bool Apply()
{
base.Apply();
this.Target.Attributes[GameAttribute.Invulnerable] = true;
Target.Attributes[GameAttribute.Invulnerable] = true;
return true;
}
@ -102,7 +102,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override void Remove()
{
this.Target.Attributes[GameAttribute.Invulnerable] = false;
Target.Attributes[GameAttribute.Invulnerable] = false;
base.Remove();
}
}
@ -121,16 +121,16 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
: base()
{
Timeout = timeout;
this.Radius = radius;
this.Monsters = mobs;
this.LastMob = lastMob;
this.LastSolo = lastSolo;
Radius = radius;
Monsters = mobs;
LastMob = lastMob;
LastSolo = lastSolo;
}
public override bool Apply()
{
base.Apply();
this.Target.Attributes[GameAttribute.Invulnerable] = true;
Target.Attributes[GameAttribute.Invulnerable] = true;
return true;
}
@ -141,11 +141,11 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (_tickTimer == null || _tickTimer.TimedOut)
{
var monster = ActorFactory.Create(Target.World, this.Monsters[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, this.Monsters.Count())], new TagMap());
monster.EnterWorld(RandomDirection(Target.Position, 5f, this.Radius));
var monster = ActorFactory.Create(Target.World, Monsters[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, Monsters.Count())], new TagMap());
monster.EnterWorld(RandomDirection(Target.Position, 5f, Radius));
monster.HasLoot = (Target.World.Game.CurrentAct == 3000);
monster.Unstuck();
monster.Teleport(new Vector3D(monster.Position.X, monster.Position.Y, monster.World.GetZForLocation(monster.Position, this.Target.Position.Z)));
monster.Teleport(new Vector3D(monster.Position.X, monster.Position.Y, monster.World.GetZForLocation(monster.Position, Target.Position.Z)));
_tickTimer = WaitSeconds(0.5f);
}
return false;
@ -153,36 +153,36 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override void Remove()
{
if (this.LastMob != ActorSno.__NONE)
if (LastMob != ActorSno.__NONE)
{
Monster leaderMob = null;
List<Affix> packAffixes = new List<Affix>();
for (int n = 0; n < (this.LastSolo ? 1 : 4); n++)
for (int n = 0; n < (LastSolo ? 1 : 4); n++)
{
if (n == 0)
{
if (this.LastSolo)
leaderMob = new Unique(Target.World, this.LastMob, new TagMap());
if (LastSolo)
leaderMob = new Unique(Target.World, LastMob, new TagMap());
else
leaderMob = new Rare(Target.World, this.LastMob, new TagMap());
leaderMob = new Rare(Target.World, LastMob, new TagMap());
leaderMob.EnterWorld(Target.Position);
leaderMob.Unstuck();
leaderMob.Teleport(new Vector3D(leaderMob.Position.X, leaderMob.Position.Y, leaderMob.World.GetZForLocation(leaderMob.Position, this.Target.Position.Z)));
leaderMob.Teleport(new Vector3D(leaderMob.Position.X, leaderMob.Position.Y, leaderMob.World.GetZForLocation(leaderMob.Position, Target.Position.Z)));
packAffixes = MonsterAffixGenerator.Generate(leaderMob, Math.Min(Target.World.Game.Difficulty + 1, 5));
}
else
{
var minion = new RareMinion(Target.World, this.LastMob, new TagMap());
var minion = new RareMinion(Target.World, LastMob, new TagMap());
minion.EnterWorld(RandomDirection(leaderMob.Position, 5f, 10f));
minion.Unstuck();
minion.Teleport(new Vector3D(minion.Position.X, minion.Position.Y, minion.World.GetZForLocation(minion.Position, this.Target.Position.Z)));
minion.Teleport(new Vector3D(minion.Position.X, minion.Position.Y, minion.World.GetZForLocation(minion.Position, Target.Position.Z)));
MonsterAffixGenerator.CopyAffixes(minion, packAffixes);
}
}
}
this.Target.Attributes[GameAttribute.Invulnerable] = false;
Target.Attributes[GameAttribute.Invulnerable] = false;
base.Remove();
this.Target.Destroy();
Target.Destroy();
}
}
[ImplementsPowerBuff(2)]
@ -197,9 +197,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public WavedInvasionBuff(List<ActorSno> mobs, float radius, ActorSno lastMob)
: base()
{
this.Radius = radius;
this.Monsters = mobs;
this.LastMob = lastMob;
Radius = radius;
Monsters = mobs;
LastMob = lastMob;
}
public override void Init()
@ -211,7 +211,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override bool Apply()
{
base.Apply();
this.Target.Attributes[GameAttribute.Invulnerable] = true;
Target.Attributes[GameAttribute.Invulnerable] = true;
return true;
}
@ -224,11 +224,11 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
for (int i = 0; i < 10; i++)
{
var monster = ActorFactory.Create(Target.World, this.Monsters[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, this.Monsters.Count())], new TagMap());
monster.EnterWorld(RandomDirection(Target.Position, 5f, this.Radius));
var monster = ActorFactory.Create(Target.World, Monsters[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, Monsters.Count())], new TagMap());
monster.EnterWorld(RandomDirection(Target.Position, 5f, Radius));
monster.HasLoot = (Target.World.Game.CurrentAct == 3000);
monster.Unstuck();
monster.Teleport(new Vector3D(monster.Position.X, monster.Position.Y, monster.World.GetZForLocation(monster.Position, this.Target.Position.Z)));
monster.Teleport(new Vector3D(monster.Position.X, monster.Position.Y, monster.World.GetZForLocation(monster.Position, Target.Position.Z)));
}
_tickTimer = WaitSeconds(4f);
}
@ -237,7 +237,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override void Remove()
{
if (this.LastMob != ActorSno.__NONE)
if (LastMob != ActorSno.__NONE)
{
Monster leaderMob = null;
List<Affix> packAffixes = new List<Affix>();
@ -245,25 +245,25 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
if (n == 0)
{
leaderMob = new Rare(Target.World, this.LastMob, new TagMap());
leaderMob = new Rare(Target.World, LastMob, new TagMap());
leaderMob.EnterWorld(Target.Position);
leaderMob.Unstuck();
leaderMob.Teleport(new Vector3D(leaderMob.Position.X, leaderMob.Position.Y, leaderMob.World.GetZForLocation(leaderMob.Position, this.Target.Position.Z)));
leaderMob.Teleport(new Vector3D(leaderMob.Position.X, leaderMob.Position.Y, leaderMob.World.GetZForLocation(leaderMob.Position, Target.Position.Z)));
packAffixes = MonsterAffixGenerator.Generate(leaderMob, Math.Min(Target.World.Game.Difficulty + 1, 5));
}
else
{
var minion = new RareMinion(Target.World, this.LastMob, new TagMap());
var minion = new RareMinion(Target.World, LastMob, new TagMap());
minion.EnterWorld(RandomDirection(leaderMob.Position, 5f, 10f));
minion.Unstuck();
minion.Teleport(new Vector3D(minion.Position.X, minion.Position.Y, minion.World.GetZForLocation(minion.Position, this.Target.Position.Z)));
minion.Teleport(new Vector3D(minion.Position.X, minion.Position.Y, minion.World.GetZForLocation(minion.Position, Target.Position.Z)));
MonsterAffixGenerator.CopyAffixes(minion, packAffixes);
}
}
}
this.Target.Attributes[GameAttribute.Invulnerable] = false;
Target.Attributes[GameAttribute.Invulnerable] = false;
base.Remove();
this.Target.Destroy();
Target.Destroy();
}
}
}

View File

@ -50,8 +50,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (!base.Apply())
return false;
Target.Attributes[GameAttribute.Power_Cooldown_Start, TargetPowerSNO] = this.World.Game.TickCounter;
Target.Attributes[GameAttribute.Power_Cooldown, TargetPowerSNO] = this.Timeout.TimeoutTick;
Target.Attributes[GameAttribute.Power_Cooldown_Start, TargetPowerSNO] = World.Game.TickCounter;
Target.Attributes[GameAttribute.Power_Cooldown, TargetPowerSNO] = Timeout.TimeoutTick;
Target.Attributes.BroadcastChangedIfRevealed();
return true;
}
@ -101,8 +101,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (!base.Apply())
return false;
Target.Attributes[GameAttribute.Recharge_Start_Time, TargetPowerSNO] = this.World.Game.TickCounter;
Target.Attributes[GameAttribute.Next_Charge_Gained_time, TargetPowerSNO] = this.Timeout.TimeoutTick;
Target.Attributes[GameAttribute.Recharge_Start_Time, TargetPowerSNO] = World.Game.TickCounter;
Target.Attributes[GameAttribute.Next_Charge_Gained_time, TargetPowerSNO] = Timeout.TimeoutTick;
Target.Attributes.BroadcastChangedIfRevealed();
return true;
}

View File

@ -46,7 +46,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
_magnitude < 0f ? User.Position : Target.Position,
(float)Math.Sqrt(Math.Abs(_magnitude)));
if (!this.World.CheckLocationForFlag(destination, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
if (!World.CheckLocationForFlag(destination, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
return false;
_mover = new ActorMover(Target);
@ -103,7 +103,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
_magnitude < 0f ? _source : Target.Position,
(float)Math.Sqrt(Math.Abs(_magnitude)));
if (!this.World.CheckLocationForFlag(destination, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
if (!World.CheckLocationForFlag(destination, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
return false;
_mover = new ActorMover(Target);

View File

@ -22,7 +22,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
public override IEnumerable<TickTimer> Run()
{
User.PlayEffectGroup(Player.LevelUpEffects[this.User.Attributes[GameAttribute.Level] - 1]);
User.PlayEffectGroup(Player.LevelUpEffects[User.Attributes[GameAttribute.Level] - 1]);
yield return WaitSeconds(0.6f);
WeaponDamage(GetEnemiesInRadius(User.Position, ScriptFormula(2)), ScriptFormula(0), DamageType.Physical);
yield break;

View File

@ -30,7 +30,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override bool Apply()
{
base.Apply();
_currentBonus = 0.033f * this.StackCount;
_currentBonus = 0.033f * StackCount;
Target.Attributes[GameAttribute.Magic_Find] += _currentBonus;
Target.Attributes[GameAttribute.Gold_Find] += _currentBonus;
Target.Attributes[GameAttribute.Experience_Bonus_Percent] += _currentBonus;
@ -50,7 +50,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
Target.Attributes[GameAttribute.Gold_Find] -= _currentBonus;
Target.Attributes[GameAttribute.Experience_Bonus_Percent] -= _currentBonus;
_currentBonus = 0.033f * this.StackCount;
_currentBonus = 0.033f * StackCount;
Target.Attributes[GameAttribute.Magic_Find] += _currentBonus;
Target.Attributes[GameAttribute.Gold_Find] += _currentBonus;
Target.Attributes[GameAttribute.Experience_Bonus_Percent] += _currentBonus;

View File

@ -68,7 +68,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
(User as Player).InGameClient.SendMessage(new FloatingNumberMessage
{
ActorID = this.Target.DynamicID(User as Player),
ActorID = Target.DynamicID(User as Player),
Type = _floatMessage.Value
});
}
@ -278,7 +278,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
}
Speed = Target.WalkSpeed;
Target.WalkSpeed = 0f;
this.Target.World.BroadcastIfRevealed(plr => new MessageSystem.Message.Definitions.ACD.ACDTranslateSyncMessage() { ActorId = this.Target.DynamicID(plr), Position = this.Target.Position, Snap = false }, this.Target);
Target.World.BroadcastIfRevealed(plr => new MessageSystem.Message.Definitions.ACD.ACDTranslateSyncMessage() { ActorId = Target.DynamicID(plr), Position = Target.Position, Snap = false }, Target);
return true;
}

View File

@ -26,11 +26,11 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
base.Apply();
this.Target.HasLoot = false;
Target.HasLoot = false;
// lookup and play spawn animation, otherwise fail
if (this.Target.AnimationSet != null && this.Target.AnimationSet.TagExists(AnimationTags.Spawn))
if (Target.AnimationSet != null && Target.AnimationSet.TagExists(AnimationTags.Spawn))
{
this.Target.PlayActionAnimation(this.Target.AnimationSet.GetAniSNO(AnimationTags.Spawn));
Target.PlayActionAnimation(Target.AnimationSet.GetAniSNO(AnimationTags.Spawn));
return true;
}
else

View File

@ -46,16 +46,16 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
var Targets = User.GetActorsInRange(20f);
TickTimer waitForImpact = WaitSeconds(1.3f - 0.1f);
SpawnEffect(ActorSno._belial_groundbomb_pending, this.User.Position, 0, WaitSeconds(5f)); //[161822] [Actor] Belial_GroundBomb_Pending
SpawnEffect(ActorSno._belial_groundbomb_pending, User.Position, 0, WaitSeconds(5f)); //[161822] [Actor] Belial_GroundBomb_Pending
yield return waitForImpact;
SpawnEffect(ActorSno._belial_groundmeteor, this.User.Position, 0, WaitSeconds(3f)); //[185108] [Actor] Belial_GroundMeteor
SpawnEffect(ActorSno._belial_groundmeteor, User.Position, 0, WaitSeconds(3f)); //[185108] [Actor] Belial_GroundMeteor
yield return waitForImpact;
var Fire = SpawnEffect(ActorSno._belial_groundbomb_impact, this.User.Position, 0, WaitSeconds(3f));
var Fire = SpawnEffect(ActorSno._belial_groundbomb_impact, User.Position, 0, WaitSeconds(3f));
Fire.UpdateDelay = 1f;
Fire.OnUpdate = () =>
{
AttackPayload Attack = new AttackPayload(this);
Attack.Targets = GetEnemiesInRadius(this.User.Position, 15f);
Attack.Targets = GetEnemiesInRadius(User.Position, 15f);
Attack.AddWeaponDamage(10f, DamageType.Poison);
Attack.OnHit = hitPayload =>
{
@ -125,16 +125,16 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
yield return WaitSeconds(8f);
bool inCombat = false;
if (this.World.GetActorBySNO(ActorSno._butcher) != null)
if (World.GetActorBySNO(ActorSno._butcher) != null)
inCombat = true;
if (inCombat == false)
{
(this.User as ActorSystem.Monster).Brain.DeActivate();
(User as ActorSystem.Monster).Brain.DeActivate();
yield break;
}
AddBuff(User, new Burn());
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][this.PowerSNO].Data;
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][PowerSNO].Data;
//yield return WaitSeconds(18f);
//yield break;
@ -181,7 +181,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
foreach (var target in Targets)
if (target is PlayerSystem.Player || target is ActorSystem.Monster)
{
this.User.Attributes[GameAttribute.Damage_Min] = target.Attributes[GameAttribute.Hitpoints_Max] / 20f;
User.Attributes[GameAttribute.Damage_Min] = target.Attributes[GameAttribute.Hitpoints_Max] / 20f;
WeaponDamage(target, 1.5f, DamageType.Fire);
}
//*/
@ -337,16 +337,16 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
yield return WaitSeconds(8f);
bool inCombat = false;
if(this.World.GetActorBySNO(ActorSno._butcher) != null)
if(World.GetActorBySNO(ActorSno._butcher) != null)
inCombat = true;
if (inCombat == false)
{
(this.User as ActorSystem.Monster).Brain.DeActivate();
(User as ActorSystem.Monster).Brain.DeActivate();
yield break;
}
AddBuff(User, new Burn());
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][this.PowerSNO].Data;
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][PowerSNO].Data;
//yield return WaitSeconds(18f);
//yield break;
@ -366,7 +366,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
proxy = SpawnProxy(User.Position, WaitSeconds(8.5f));
#region Выборка анимации
int EffectOfActivate = 0;
switch (this.User.SNO)
switch (User.SNO)
{
case ActorSno._butcherlair_floorpanel_upperleft_base: EffectOfActivate = 201257; break;//[201423] [Actor] ButcherLair_FloorPanel_UpperLeft_Base
case ActorSno._butcherlair_floorpanel_uppermid_base: EffectOfActivate = 201444; break;//[201438][Actor] ButcherLair_FloorPanel_UpperMid_Base

View File

@ -260,7 +260,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
int EnemiesHit = 1;
public LeapAttackArmorBuff(int enemies)
{
this.EnemiesHit = enemies;
EnemiesHit = enemies;
}
public override void Init()
@ -273,7 +273,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (!base.Apply())
return false;
User.Attributes[GameAttribute.Armor_Bonus_Percent] += (ScriptFormula(33) * this.EnemiesHit);
User.Attributes[GameAttribute.Armor_Bonus_Percent] += (ScriptFormula(33) * EnemiesHit);
User.Attributes.BroadcastChangedIfRevealed();
return true;
@ -283,7 +283,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
base.Remove();
User.Attributes[GameAttribute.Armor_Bonus_Percent] -= (ScriptFormula(33) * this.EnemiesHit);
User.Attributes[GameAttribute.Armor_Bonus_Percent] -= (ScriptFormula(33) * EnemiesHit);
User.Attributes.BroadcastChangedIfRevealed();
}
}
@ -857,7 +857,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (Rand.NextDouble() < ScriptFormula(5))
{
//ScriptFormula(4) -> extends duration
this.Extend((int)ScriptFormula(4) * 60);
Extend((int)ScriptFormula(4) * 60);
}
}
if (Rune_C > 0)
@ -2289,7 +2289,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (GainedFury >= (1 / ScriptFormula(21)))
{
GainedFury -= (1 / ScriptFormula(21));
this.Extend(60);
Extend(60);
}
return false;
}
@ -2344,7 +2344,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
if (i == 0)
{
var ancient = new AncientKorlic(this.World, this, i);
var ancient = new AncientKorlic(World, this, i);
ancient.Brain.DeActivate();
ancient.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
ancient.Attributes[GameAttribute.Untargetable] = true;
@ -2355,7 +2355,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
}
if (i == 1)
{
var ancient = new AncientTalic(this.World, this, i);
var ancient = new AncientTalic(World, this, i);
ancient.Brain.DeActivate();
ancient.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
ancient.Attributes[GameAttribute.Untargetable] = true;
@ -2366,7 +2366,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
}
if (i == 2)
{
var ancient = new AncientMawdawc(this.World, this, i);
var ancient = new AncientMawdawc(World, this, i);
ancient.Brain.DeActivate();
ancient.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
ancient.Attributes[GameAttribute.Untargetable] = true;

View File

@ -869,7 +869,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
// FIXME: check actor
var proj = new Projectile(this, ActorSno._x1_crusader_shieldbash_shieldcross, User.Position);
proj.Timeout = new SecondsTickTimer(this.World.Game, 1f);
proj.Timeout = new SecondsTickTimer(World.Game, 1f);
proj.OnCollision = (hit) =>
{
if ((Target != null) && (hit == Target)) return;
@ -1053,7 +1053,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
public override IEnumerable<TickTimer> Main()
{
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[Core.Types.SNO.SNOGroup.Power][this.PowerSNO].Data;
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[Core.Types.SNO.SNOGroup.Power][PowerSNO].Data;
var proj = new Projectile(this, ActorSno._x1_crusader_holyhammer_hammer, User.Position);
proj.Position.Z += 2f;
@ -1384,7 +1384,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
for (int i = 0; i < maxAvatars; i++)
{
var avatar = new AvatarRanged(this.World, this, i, ScriptFormula(8) * damageMult, WaitSeconds(ScriptFormula(35) + 2f));
var avatar = new AvatarRanged(World, this, i, ScriptFormula(8) * damageMult, WaitSeconds(ScriptFormula(35) + 2f));
avatar.Brain.DeActivate();
avatar.Position = RandomDirection(User.Position, 3f, 8f);
avatar.Attributes[GameAttribute.Untargetable] = true;
@ -1421,7 +1421,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
for (int i = 0; i < maxAvatars; i++)
{
var avatar = new AvatarMelee(this.World, this, i, ScriptFormula(46) * damageMult, WaitSeconds(ScriptFormula(36) + 2f));
var avatar = new AvatarMelee(World, this, i, ScriptFormula(46) * damageMult, WaitSeconds(ScriptFormula(36) + 2f));
avatar.Brain.DeActivate();
avatar.Position = RandomDirection(User.Position, 3f, 8f);
avatar.Attributes[GameAttribute.Untargetable] = true;
@ -1577,7 +1577,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
for (int i = 0; i < maxAvatars; i++)
{
var avatar = new AvatarMelee(this.World, this, i, ScriptFormula(49), WaitSeconds(ScriptFormula(28) + 2f));
var avatar = new AvatarMelee(World, this, i, ScriptFormula(49), WaitSeconds(ScriptFormula(28) + 2f));
avatar.Brain.DeActivate();
avatar.Position = RandomDirection(User.Position, 3f, 8f);
avatar.Attributes[GameAttribute.Untargetable] = true;

View File

@ -940,7 +940,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override IEnumerable<TickTimer> Main()
{
var DataOfSkill = DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[DiIiS_NA.GameServer.Core.Types.SNO.SNOGroup.Power][131192].Data;
var DataOfSkill = DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[Core.Types.SNO.SNOGroup.Power][131192].Data;
var proj1 = new Projectile(
this,
RuneSelect(
@ -1370,7 +1370,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if ((User as Player).SkillSet.HasPassive(218398)) //NumbingTraps (DH)
{
foreach (var tgt in GetEnemiesInRadius(GroundSpot.Position, ScriptFormula(5)).Actors)
if (tgt.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.DamageReduceDebuff>(tgt) == null)
if (tgt.World.BuffManager.GetFirstBuff<DamageReduceDebuff>(tgt) == null)
AddBuff(tgt, new DamageReduceDebuff(0.25f, WaitSeconds(3f)));
}
}
@ -2168,7 +2168,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
proj.Position.Z += 2f;
proj.Launch(TargetPosition, 0.2f);
this.World.PlayZigAnimation(proj, User, PowerSNO, TargetPosition);
World.PlayZigAnimation(proj, User, PowerSNO, TargetPosition);
proj.OnCollision = (hit) =>
{
WeaponDamage(hit, ScriptFormula(0), RuneSelect(DamageType.Physical, DamageType.Fire, DamageType.Lightning, DamageType.Poison, DamageType.Physical, DamageType.Physical));
@ -2179,7 +2179,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
proj.Position.Z += 2f;
proj.Launch(TargetPosition, 0.2f);
this.World.PlaySpiralAnimation(proj, User, PowerSNO, TargetPosition);
World.PlaySpiralAnimation(proj, User, PowerSNO, TargetPosition);
proj.OnCollision = (hit) =>
{
WeaponDamage(hit, ScriptFormula(0), RuneSelect(DamageType.Physical, DamageType.Fire, DamageType.Lightning, DamageType.Poison, DamageType.Physical, DamageType.Physical));
@ -2189,7 +2189,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
var dproj = new Projectile(this, runeActorSno, User.Position);
dproj.Position.Z += 2f;
dproj.Launch(TargetPosition, 0.2f);
this.World.PlayReverSpiralAnimation(dproj, User, PowerSNO, TargetPosition);
World.PlayReverSpiralAnimation(dproj, User, PowerSNO, TargetPosition);
dproj.OnCollision = (hit) =>
{
WeaponDamage(hit, ScriptFormula(0), RuneSelect(DamageType.Physical, DamageType.Fire, DamageType.Lightning, DamageType.Poison, DamageType.Physical, DamageType.Physical));
@ -2541,7 +2541,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
if (!base.Apply()) return false;
if (this.companion != null) return false;
if (companion != null) return false;
if (User.World == null) return false;
var minionID = ActorSno._dh_companion; //Raven
if (User.Attributes[GameAttribute.Rune_A, SkillsSystem.Skills.DemonHunter.Discipline.Companion] > 0)
@ -2555,16 +2555,16 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (User.Attributes[GameAttribute.Rune_E, SkillsSystem.Skills.DemonHunter.Discipline.Companion] > 0)
minionID = ActorSno._dh_companion_runee; //Ferret
this.companion = new CompanionMinion(this.World, this, minionID);
this.companion.Brain.DeActivate();
this.companion.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
this.companion.Attributes[GameAttribute.Untargetable] = true;
this.companion.EnterWorld(this.companion.Position);
companion = new CompanionMinion(World, this, minionID);
companion.Brain.DeActivate();
companion.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
companion.Attributes[GameAttribute.Untargetable] = true;
companion.EnterWorld(companion.Position);
//Logger.Debug("companion spawned");
(this.companion as Minion).Brain.Activate();
this.companion.Attributes[GameAttribute.Untargetable] = false;
this.companion.Attributes.BroadcastChangedIfRevealed();
(companion as Minion).Brain.Activate();
companion.Attributes[GameAttribute.Untargetable] = false;
companion.Attributes.BroadcastChangedIfRevealed();
if (User.Attributes[GameAttribute.Rune_B, SkillsSystem.Skills.DemonHunter.Discipline.Companion] > 0) //Boar
{
@ -2593,10 +2593,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
base.Remove();
if (this.companion != null)
if (companion != null)
{
this.companion.Destroy();
this.companion = null;
companion.Destroy();
companion = null;
}
if (User.Attributes[GameAttribute.Rune_B, SkillsSystem.Skills.DemonHunter.Discipline.Companion] > 0) //Boar
@ -2782,7 +2782,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if ((User as Player).SkillSet.HasPassive(218398)) //NumbingTraps (DH)
{
if (hit.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.DamageReduceDebuff>(hit) == null)
if (hit.World.BuffManager.GetFirstBuff<DamageReduceDebuff>(hit) == null)
AddBuff(hit, new DamageReduceDebuff(0.25f, WaitSeconds(3f)));
}
@ -2817,7 +2817,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if ((User as Player).SkillSet.HasPassive(218398)) //NumbingTraps (DH)
{
foreach (var tgt in targets.Actors)
if (tgt.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.DamageReduceDebuff>(tgt) == null)
if (tgt.World.BuffManager.GetFirstBuff<DamageReduceDebuff>(tgt) == null)
AddBuff(tgt, new DamageReduceDebuff(0.25f, WaitSeconds(3f)));
}
}
@ -2857,7 +2857,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if ((User as Player).SkillSet.HasPassive(218398)) //NumbingTraps (DH)
{
foreach (var tgt in targets.Actors)
if (tgt.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.DamageReduceDebuff>(tgt) == null)
if (tgt.World.BuffManager.GetFirstBuff<DamageReduceDebuff>(tgt) == null)
AddBuff(tgt, new DamageReduceDebuff(0.25f, WaitSeconds(3f)));
}
base.Remove();

View File

@ -2758,8 +2758,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (GuidingLight) //Guiding Light passive
{
float missingHP = (User.Attributes[GameAttribute.Hitpoints_Max_Total] - User.Attributes[GameAttribute.Hitpoints_Cur]) / User.Attributes[GameAttribute.Hitpoints_Max_Total];
if (!HasBuff<PowerSystem.Implementations.GuidingLightBuff>(User))
AddBuff(User, new PowerSystem.Implementations.GuidingLightBuff(Math.Min(missingHP, 0.3f), TickTimer.WaitSeconds(this.World.Game, 10.0f)));
if (!HasBuff<GuidingLightBuff>(User))
AddBuff(User, new GuidingLightBuff(Math.Min(missingHP, 0.3f), TickTimer.WaitSeconds(World.Game, 10.0f)));
}
return true;
@ -3251,7 +3251,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (Target is Player)
{
if ((Target as Player).SkillSet.HasPassive(205707)) //Juggernaut (barbarian)
if (DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(100) < 30)
if (FastRandom.Instance.Next(100) < 30)
(Target as Player).AddPercentageHP(20);
}
return true;
@ -3415,8 +3415,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (GuidingLight) //Guiding Light passive
{
float missingHP = (Target.Attributes[GameAttribute.Hitpoints_Max_Total] - User.Attributes[GameAttribute.Hitpoints_Cur]) / Target.Attributes[GameAttribute.Hitpoints_Max_Total];
if (!HasBuff<PowerSystem.Implementations.GuidingLightBuff>(Target))
AddBuff(Target, new PowerSystem.Implementations.GuidingLightBuff(Math.Min(missingHP, 0.3f), TickTimer.WaitSeconds(this.World.Game, 10.0f)));
if (!HasBuff<GuidingLightBuff>(Target))
AddBuff(Target, new GuidingLightBuff(Math.Min(missingHP, 0.3f), TickTimer.WaitSeconds(World.Game, 10.0f)));
}
return true;
@ -3553,8 +3553,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (GuidingLight) //Guiding Light passive
{
float missingHP = (User.Attributes[GameAttribute.Hitpoints_Max_Total] - User.Attributes[GameAttribute.Hitpoints_Cur]) / User.Attributes[GameAttribute.Hitpoints_Max_Total];
if (!HasBuff<PowerSystem.Implementations.GuidingLightBuff>(User))
AddBuff(User, new PowerSystem.Implementations.GuidingLightBuff(Math.Min(missingHP, 0.3f), TickTimer.WaitSeconds(this.World.Game, 10.0f)));
if (!HasBuff<GuidingLightBuff>(User))
AddBuff(User, new GuidingLightBuff(Math.Min(missingHP, 0.3f), TickTimer.WaitSeconds(World.Game, 10.0f)));
}
return true;
@ -3603,7 +3603,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (Target is Player)
{
if ((Target as Player).SkillSet.HasPassive(205707)) //Juggernaut (barbarian)
if (DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(100) < 30)
if (FastRandom.Instance.Next(100) < 30)
(Target as Player).AddPercentageHP(20);
}
@ -3788,7 +3788,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
if (!base.Apply()) return false;
if (this.ally != null) return false;
if (ally != null) return false;
if (User.World == null) return false;
int gender = (User as Player).Toon.Gender;
@ -3806,16 +3806,16 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (User.Attributes[GameAttribute.Rune_E, 0x00058676] > 0) //Indigo
AllyId = allys[5];
this.ally = new MysticAllyMinion(this.World, this, AllyId);
this.ally.Brain.DeActivate();
this.ally.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
this.ally.Attributes[GameAttribute.Untargetable] = true;
this.ally.EnterWorld(this.ally.Position);
this.ally.PlayActionAnimation(130606);
ally = new MysticAllyMinion(World, this, AllyId);
ally.Brain.DeActivate();
ally.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
ally.Attributes[GameAttribute.Untargetable] = true;
ally.EnterWorld(ally.Position);
ally.PlayActionAnimation(130606);
(this.ally as Minion).Brain.Activate();
this.ally.Attributes[GameAttribute.Untargetable] = false;
this.ally.Attributes.BroadcastChangedIfRevealed();
(ally as Minion).Brain.Activate();
ally.Attributes[GameAttribute.Untargetable] = false;
ally.Attributes.BroadcastChangedIfRevealed();
if (User.Attributes[GameAttribute.Rune_A, 0x00058676] > 0) //Fire Ally
{
@ -3860,10 +3860,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
User.Attributes.BroadcastChangedIfRevealed();
if (this.ally != null)
if (ally != null)
{
this.ally.Destroy();
this.ally = null;
ally.Destroy();
ally = null;
}
}
@ -3874,18 +3874,18 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (User.World.Game.TickCounter % 300 == 0)
{
if (this.ally != null && this.ally.Dead)
if (ally != null && ally.Dead)
{
this.ally = new MysticAllyMinion(this.World, this, AllyId);
this.ally.Brain.DeActivate();
this.ally.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
this.ally.Attributes[GameAttribute.Untargetable] = true;
this.ally.EnterWorld(this.ally.Position);
this.ally.PlayActionAnimation(130606);
ally = new MysticAllyMinion(World, this, AllyId);
ally.Brain.DeActivate();
ally.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
ally.Attributes[GameAttribute.Untargetable] = true;
ally.EnterWorld(ally.Position);
ally.PlayActionAnimation(130606);
(this.ally as Minion).Brain.Activate();
this.ally.Attributes[GameAttribute.Untargetable] = false;
this.ally.Attributes.BroadcastChangedIfRevealed();
(ally as Minion).Brain.Activate();
ally.Attributes[GameAttribute.Untargetable] = false;
ally.Attributes.BroadcastChangedIfRevealed();
}
}

View File

@ -260,7 +260,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
public override IEnumerable<TickTimer> Main()
{
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][this.PowerSNO].Data;
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][PowerSNO].Data;
TargetPosition = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, 7f);
DamageType DType = DamageType.Physical;
@ -492,7 +492,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override void OnChannelOpen()
{
this.EffectsPerSecond = 0.5f;
EffectsPerSecond = 0.5f;
{
_beamEnd = SpawnEffect(ActorSno._p6_necro_siphonblood_a_target_attractchunks, User.Position, 0, WaitInfinite());
@ -515,7 +515,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override IEnumerable<TickTimer> Main()
{
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][this.PowerSNO].Data;
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][PowerSNO].Data;
AttackPayload attack = new AttackPayload(this);
{
if (attack.Targets == null)
@ -692,7 +692,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
#endregion
public override IEnumerable<TickTimer> Main()
{
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][this.PowerSNO].Data;
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][PowerSNO].Data;
UsePrimaryResource(EvalTag(PowerKeys.ResourceCost));
if (Rune_E > 0)
@ -945,7 +945,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (Rune_B > 0)
{
Count = this.User.Attributes[GameAttribute.Resource_Cur, (int)(this.User as PlayerSystem.Player).Toon.HeroTable.PrimaryResource];
Count = User.Attributes[GameAttribute.Resource_Cur, (int)(User as PlayerSystem.Player).Toon.HeroTable.PrimaryResource];
UsePrimaryResource(Count);
}
else if (Rune_C > 0)
@ -956,10 +956,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
else
UsePrimaryResource(EvalTag(PowerKeys.ResourceCost));
var DataOfSkill = MPQStorage.Data.Assets[SNOGroup.Power][this.PowerSNO].Data;
var DataOfSkill = MPQStorage.Data.Assets[SNOGroup.Power][PowerSNO].Data;
var Mage = new SkeletalMage(
this.World,
World,
this,
0,
RuneSelect(
@ -1279,7 +1279,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
BoomEffect = 472863;
DType = DamageType.Poison;
var Proxy = SpawnProxy(User.Position, new TickTimer(this.User.World.Game, 300));
var Proxy = SpawnProxy(User.Position, new TickTimer(User.World.Game, 300));
Proxy.PlayEffectGroup(471115);
foreach (var act in GetEnemiesInRadius(TargetPosition, 25f).Actors)
{
@ -1317,7 +1317,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
float Radius = 20f;
float Damage = 10.5f;
DamageType DType = DamageType.Physical;
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][this.PowerSNO].Data;
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][PowerSNO].Data;
var Point = SpawnEffect(ActorSno._p6_necro_bonespikes, TargetPosition, 0, WaitSeconds(0.2f));
Point.PlayEffect(Effect.PlayEffectGroup, RuneSelect(459954, 473926, 459954, 473907, 459954//D
, 473864));
@ -1336,7 +1336,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (Rune_B > 0)
{
var Bomb = this.World.GetActorByGlobalId(actor);
var Bomb = World.GetActorByGlobalId(actor);
var NearEnemy = Bomb.GetActorsInRange(20f).First();
if (NearEnemy != null)
Bomb.Teleport(NearEnemy.Position);
@ -1345,8 +1345,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
var Explosion = SpawnEffect(
ActorSno._p6_necro_corpseexplosion_projectile_spawn,
this.World.GetActorByGlobalId(actor).Position,
ActorSystem.Movement.MovementHelpers.GetFacingAngle(User, this.World.GetActorByGlobalId(actor)),
World.GetActorByGlobalId(actor).Position,
ActorSystem.Movement.MovementHelpers.GetFacingAngle(User, World.GetActorByGlobalId(actor)),
WaitSeconds(0.2f)
);
Explosion.PlayEffect(Effect.PlayEffectGroup, RuneSelect(457183, 471539, 471258, 471249, 471247, 471236));
@ -1368,7 +1368,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
};
attack.Apply();
};
this.World.GetActorByGlobalId(actor).Destroy();
World.GetActorByGlobalId(actor).Destroy();
}
@ -1386,7 +1386,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
private Actor _beamEnd;
private bool WaitTo(TickerSystem.TickTimer timer)
private bool WaitTo(TickTimer timer)
{
while (timer.TimedOut != true)
{
@ -1420,15 +1420,15 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
Actor Flesh = null;
if (User.Attributes[GameAttribute.Necromancer_Corpse_Free_Casting] == true)
{
Flesh = this.User;
Flesh = User;
}
else
Flesh = this.User.GetActorsInRange<ActorSystem.Implementations.NecromancerFlesh>(60f).First();
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][this.PowerSNO].Data;
Flesh = User.GetActorsInRange<ActorSystem.Implementations.NecromancerFlesh>(60f).First();
var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][PowerSNO].Data;
DamageType DType = DamageType.Physical;
var Explosion = SpawnEffect(ActorSno._p6_necro_corpseexplosion_projectile, Flesh.Position, 0, WaitSeconds(0.2f));
Explosion.PlayEffect(Effect.PlayEffectGroup, 457183);
var Proxy = SpawnProxy(Flesh.Position, new TickTimer(this.User.World.Game, 300));
var Proxy = SpawnProxy(Flesh.Position, new TickTimer(User.World.Game, 300));
if (User.Attributes[GameAttribute.Necromancer_Corpse_Free_Casting] == false)
Flesh.Destroy();
//1, 2, 3, 4
@ -1437,29 +1437,29 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (Rune_B > 0)
DType = DamageType.Cold;
foreach (var plr in this.User.World.Players.Values)
foreach (var plr in User.World.Players.Values)
{
plr.InGameClient.SendMessage(new EffectGroupACDToACDMessage()
{
//A, D, E?
EffectSNOId = RuneSelect(468032, 468032, 468240, 467966, 468032, 474474),//468032,
ActorID = Proxy.DynamicID(plr),
TargetID = this.Target.DynamicID(plr)
TargetID = Target.DynamicID(plr)
});
plr.InGameClient.SendMessage(new EffectGroupACDToACDMessage()
{
EffectSNOId = 474690,
ActorID = this.Target.DynamicID(plr),
ActorID = Target.DynamicID(plr),
TargetID = Proxy.DynamicID(plr)
});
}
if (Rune_C > 0)
{
var NewProxy = SpawnProxy(User.Position, new TickTimer(this.User.World.Game, 300));
var NewProxy = SpawnProxy(User.Position, new TickTimer(User.World.Game, 300));
foreach (var plr in this.User.World.Players.Values)
foreach (var plr in User.World.Players.Values)
{
plr.InGameClient.SendMessage(new EffectGroupACDToACDMessage()
{
@ -1476,7 +1476,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
});
}
TickTimer Timeout1 = new SecondsTickTimer(this.Target.World.Game, 0.4f);
TickTimer Timeout1 = new SecondsTickTimer(Target.World.Game, 0.4f);
var Boom1 = Task<bool>.Factory.StartNew(() => WaitTo(Timeout1));
Boom1.ContinueWith(delegate
{
@ -1486,7 +1486,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
}
TickTimer Timeout = new SecondsTickTimer(this.Target.World.Game, 0.4f);
TickTimer Timeout = new SecondsTickTimer(Target.World.Game, 0.4f);
var Boom = Task<bool>.Factory.StartNew(() => WaitTo(Timeout));
Boom.ContinueWith(delegate
{
@ -1495,7 +1495,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (Rune_A > 0)// && RandomHelper.Next(1,100) > 80)
{
var NewProxy = SpawnProxy(Target.Position, new TickTimer(this.User.World.Game, 300));
var NewProxy = SpawnProxy(Target.Position, new TickTimer(User.World.Game, 300));
Actor NewTarget = null;
var NearTargets = GetEnemiesInRadius(Target.Position, 24f).Actors;
@ -1503,7 +1503,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (NewTarget != null)
{
foreach (var plr in this.User.World.Players.Values)
foreach (var plr in User.World.Players.Values)
{
plr.InGameClient.SendMessage(new EffectGroupACDToACDMessage()
{
@ -1520,7 +1520,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
});
}
TickTimer Timeout1 = new SecondsTickTimer(this.Target.World.Game, 0.3f);
TickTimer Timeout1 = new SecondsTickTimer(Target.World.Game, 0.3f);
var Boom = Task<bool>.Factory.StartNew(() => WaitTo(Timeout1));
Boom.ContinueWith(delegate
{
@ -1670,14 +1670,14 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
#endregion
public override IEnumerable<TickTimer> Main()
{
var DataOfSkill = DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[SNOGroup.Power][this.PowerSNO].Data;
var DataOfSkill = MPQStorage.Data.Assets[SNOGroup.Power][PowerSNO].Data;
//454066
var Flesh = this.User.GetActorsInRange<ActorSystem.Implementations.NecromancerFlesh>(60f);
var Flesh = User.GetActorsInRange<ActorSystem.Implementations.NecromancerFlesh>(60f);
foreach (var act in Flesh)
{
var Proxy = SpawnProxy(User.Position, new TickTimer(this.User.World.Game, 300));
var Proxy = SpawnProxy(User.Position, new TickTimer(User.World.Game, 300));
foreach (var plr in this.User.World.Players.Values)
foreach (var plr in User.World.Players.Values)
{
plr.InGameClient.SendMessage(new EffectGroupACDToACDMessage()
{
@ -1688,7 +1688,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
}
act.PlayEffectGroup(RuneSelect(467200, 462756, 467230, 470482, 470549, 470574));
act.Destroy();
this.User.Attributes[GameAttribute.Resource_Cur, (int)(this.User as PlayerSystem.Player).Toon.HeroTable.PrimaryResource] += 10f;
User.Attributes[GameAttribute.Resource_Cur, (int)(User as PlayerSystem.Player).Toon.HeroTable.PrimaryResource] += 10f;
if (Rune_A > 0)
(User as PlayerSystem.Player).AddPercentageHP(3);
@ -1704,10 +1704,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
else
{
minion.Destroy();
this.User.Attributes[GameAttribute.Resource_Cur, (int)(this.User as PlayerSystem.Player).Toon.HeroTable.PrimaryResource] += 10f;
User.Attributes[GameAttribute.Resource_Cur, (int)(User as PlayerSystem.Player).Toon.HeroTable.PrimaryResource] += 10f;
}
}
this.User.Attributes.BroadcastChangedIfRevealed();
User.Attributes.BroadcastChangedIfRevealed();
}
@ -1843,9 +1843,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
#endregion
public override IEnumerable<TickTimer> Main()
{
var DataOfSkill = DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[SNOGroup.Power][this.PowerSNO].Data;
var DataOfSkill = MPQStorage.Data.Assets[SNOGroup.Power][PowerSNO].Data;
//454066
var Proxy = SpawnProxy(TargetPosition, new TickTimer(this.User.World.Game, 300));
var Proxy = SpawnProxy(TargetPosition, new TickTimer(User.World.Game, 300));
var Flesh = Proxy.GetActorsInRange<ActorSystem.Implementations.NecromancerFlesh>(20f);
bool Resurrected = false;
@ -1889,7 +1889,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (Resurrected)
if (Rune_E > 0)
{
var Enemys = Proxy.GetActorsInRange<ActorSystem.Monster>(20f);
var Enemys = Proxy.GetActorsInRange<Monster>(20f);
foreach (var Enemy in Enemys)
AddBuff(Enemy, new DebuffFeared(WaitSeconds(3f)));
}
@ -2035,7 +2035,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
[ImplementsPowerSNO(SkillsSystem.Skills.Necromancer.ExtraSkills.CommandGolem)]
public class RaiseGolem : Skill
{
private bool WaitTo(TickerSystem.TickTimer timer)
private bool WaitTo(TickTimer timer)
{
while (timer.TimedOut != true)
{
@ -2061,7 +2061,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
//AddBuff(User, new TBuff());
//AddBuff(User, new FrBuff());
//*/
var Golem = (this.User as PlayerSystem.Player).ActiveGolem;
var Golem = (User as PlayerSystem.Player).ActiveGolem;
int countofFlesh = 5;
float cooldown = 5f;
if (Rune_D > 0)
@ -2070,8 +2070,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
float targetDistance = PowerMath.Distance2D(TargetPosition, Golem.Position);
if (Rune_E > 0)
{
((this.User as PlayerSystem.Player).ActiveGolem as Minion).Brain.DeActivate();
(this.User as PlayerSystem.Player).ActiveGolem.PlayActionAnimation(474026);
((User as PlayerSystem.Player).ActiveGolem as Minion).Brain.DeActivate();
(User as PlayerSystem.Player).ActiveGolem.PlayActionAnimation(474026);
var proxy = SpawnProxy(TargetPosition, WaitSeconds(3f));
proxy.PlayEffectGroup(474839);
@ -2084,7 +2084,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
};
attack.Apply();
yield return WaitSeconds(1f);
((this.User as PlayerSystem.Player).ActiveGolem as Minion).Brain.Activate();
((User as PlayerSystem.Player).ActiveGolem as Minion).Brain.Activate();
}
else if (Rune_A > 0)
{
@ -2100,7 +2100,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
yield return WaitSeconds(targetDistance * 0.024f);
//Индикация зоны
(this.User as PlayerSystem.Player).ActiveGolem.PlayActionAnimation(466348);
(User as PlayerSystem.Player).ActiveGolem.PlayActionAnimation(466348);
var proxy = SpawnProxy(TargetPosition, WaitSeconds(2f));
//Рывок
proxy.PlayEffectGroup(466735); //[466735] p6_necro_golem_bone_areaIndicator
@ -2211,7 +2211,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
(Golem as Minion).Kill(this);
Golem.Destroy();
(this.User as PlayerSystem.Player).ActiveGolem = null;
(User as PlayerSystem.Player).ActiveGolem = null;
});
@ -2226,13 +2226,13 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public PlayerHasGolemBuff(List<Actor> dogs)
{
this.golem = dogs;
golem = dogs;
}
public override bool Apply()
{
if (!base.Apply())
return false;
this.User.Attributes[GameAttribute.Skill_Toggled_State, SkillsSystem.Skills.Necromancer.ExtraSkills.CommandGolem] = true;
User.Attributes[GameAttribute.Skill_Toggled_State, SkillsSystem.Skills.Necromancer.ExtraSkills.CommandGolem] = true;
User.Attributes.BroadcastChangedIfRevealed();
return true;
@ -2541,7 +2541,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override IEnumerable<TickTimer> Main()
{
StartCooldown(EvalTag(PowerKeys.CooldownTime));
var DataOfSkill = DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[SNOGroup.Power][460358].Data;
var DataOfSkill = MPQStorage.Data.Assets[SNOGroup.Power][460358].Data;
var EffectSNO = ActorSno._necro_aotd_a_emitter;
float Range = 15f;
@ -2563,7 +2563,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
DType = DamageType.Cold;
Damage = 5.2f;
var Angle = ActorSystem.Movement.MovementHelpers.GetFacingAngle(this.User, TargetPosition);
var Angle = ActorSystem.Movement.MovementHelpers.GetFacingAngle(User, TargetPosition);
var E = SpawnEffect(ActorSno._necro_aotd_b_north_emitter, TargetPosition, Angle);
E.UpdateDelay = 0.2f;
@ -2652,7 +2652,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override IEnumerable<TickTimer> Main()
{
StartCooldown(EvalTag(PowerKeys.CooldownTime));
var DataOfSkill = DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[SNOGroup.Power][465839].Data;
var DataOfSkill = MPQStorage.Data.Assets[SNOGroup.Power][465839].Data;
AddBuff(User, new ZBuff());
if (Rune_A > 0)
@ -3201,7 +3201,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
alr.Destroy();
var proxy = SpawnEffect(ActorSno._p6_necro_leech_e_proxyactor, TargetPosition,
ActorSystem.Movement.MovementHelpers.GetFacingAngle(this.User, TargetPosition),
ActorSystem.Movement.MovementHelpers.GetFacingAngle(User, TargetPosition),
WaitSeconds(30f));
proxy.Attributes[GameAttribute.Summoner_ID] = (User as PlayerSystem.Player).PlayerIndex;
AddBuff(User, new Rune_DBuff(proxy));
@ -3218,7 +3218,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
ActorSno._p6_necro_leech_f_groundarea
),
TargetPosition,
ActorSystem.Movement.MovementHelpers.GetFacingAngle(this.User, TargetPosition),
ActorSystem.Movement.MovementHelpers.GetFacingAngle(User, TargetPosition),
WaitSeconds(0.2f)
);
@ -4590,43 +4590,43 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
}
else
{
var StartTP = SpawnProxy(User.Position, new TickTimer(this.User.World.Game, 500));
var PointTP = SpawnProxy(TargetPosition, new TickTimer(this.User.World.Game, 500));
var StartTP = SpawnProxy(User.Position, new TickTimer(User.World.Game, 500));
var PointTP = SpawnProxy(TargetPosition, new TickTimer(User.World.Game, 500));
foreach (var plr in this.User.World.Players.Values)
foreach (var plr in User.World.Players.Values)
{
//473 637
plr.InGameClient.SendMessage(new ACDTranslateSyncMessage()
{
ActorId = this.User.DynamicID(plr),
Position = this.User.Position,
ActorId = User.DynamicID(plr),
Position = User.Position,
Snap = true,
Field3 = 0xE56D
});
plr.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Actor.ActorLookOverrideChangedMessage()
{
Field0 = (int)this.User.DynamicID(plr),
Field0 = (int)User.DynamicID(plr),
Field1 = -1,
Field2 = unchecked((int)0xD8A4C675)
});
(this.User as PlayerSystem.Player).InGameClient.SendMessage(new ACDTranslateSnappedMessage()
(User as PlayerSystem.Player).InGameClient.SendMessage(new ACDTranslateSnappedMessage()
{
ActorId = (int)this.User.DynamicID(this.User as PlayerSystem.Player),
ActorId = (int)User.DynamicID(User as PlayerSystem.Player),
Position = PointTP.Position,
Angle = ActorSystem.Movement.MovementHelpers.GetFacingAngle(this.User, PointTP),
Angle = ActorSystem.Movement.MovementHelpers.GetFacingAngle(User, PointTP),
Field3 = true,
Field4 = 0x90,
CameraSmoothingTime = 0x30,
Field6 = 0x100
});
//*/
this.User.Position = PointTP.Position;
User.Position = PointTP.Position;
plr.InGameClient.SendMessage(new ACDTranslateSyncMessage()
{
ActorId = this.User.DynamicID(plr),
Position = this.User.Position,
ActorId = User.DynamicID(plr),
Position = User.Position,
Snap = true,
Field3 = 0xE56D
});
@ -4637,7 +4637,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
Type = 0,
EffectSNO = 0x00073E50,
SourceActorId = (int)PointTP.DynamicID(plr),
TargetActorId = (int)this.User.DynamicID(plr),
TargetActorId = (int)User.DynamicID(plr),
Param1 = 0,
Param2 = 0
@ -4654,7 +4654,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
Type = 0,
EffectSNO = 0x00073E50,
SourceActorId = (int)PointTP.DynamicID(plr),
TargetActorId = (int)this.User.DynamicID(plr),
TargetActorId = (int)User.DynamicID(plr),
Param1 = 0,
Param2 = 0

View File

@ -186,8 +186,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
base.Stack(buff);
if (!stacked) return true;
HPTreshold = User.Attributes[GameAttribute.Hitpoints_Max_Total] * 0.02f * this.StackCount;
this.Extend(30);
HPTreshold = User.Attributes[GameAttribute.Hitpoints_Max_Total] * 0.02f * StackCount;
Extend(30);
return true;
}
@ -227,7 +227,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
if (!base.Apply())
return false;
_currentBonus = 0.01f * this.StackCount;
_currentBonus = 0.01f * StackCount;
Target.Attributes[GameAttribute.Strength_Bonus_Percent] += _currentBonus;
Target.Attributes.BroadcastChangedIfRevealed();
return true;
@ -245,7 +245,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
Target.Attributes[GameAttribute.Strength_Bonus_Percent] -= _currentBonus;
_currentBonus = 0.01f * this.StackCount;
_currentBonus = 0.01f * StackCount;
Target.Attributes[GameAttribute.Strength_Bonus_Percent] += _currentBonus;
User.Attributes.BroadcastChangedIfRevealed();
@ -277,7 +277,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
if (!base.Apply())
return false;
_currentBonus = 0.05f * this.StackCount;
_currentBonus = 0.05f * StackCount;
Target.Attributes[GameAttribute.Amplify_Damage_Percent] += _currentBonus;
Target.Attributes.BroadcastChangedIfRevealed();
return true;
@ -297,7 +297,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
Target.Attributes[GameAttribute.Amplify_Damage_Percent] -= _currentBonus;
_currentBonus = 0.05f * this.StackCount;
_currentBonus = 0.05f * StackCount;
Target.Attributes[GameAttribute.Amplify_Damage_Percent] += _currentBonus;
User.Attributes.BroadcastChangedIfRevealed();
@ -841,7 +841,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
if (!base.Apply())
return false;
_currentBonus = IntBonus * this.StackCount;
_currentBonus = IntBonus * StackCount;
Target.Attributes[GameAttribute.Intelligence] += _currentBonus;
Target.Attributes.BroadcastChangedIfRevealed();
return true;
@ -853,7 +853,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
return false;
Target.Attributes[GameAttribute.Intelligence] -= _currentBonus;
_currentBonus = IntBonus * this.StackCount;
_currentBonus = IntBonus * StackCount;
Target.Attributes[GameAttribute.Intelligence] += _currentBonus;
Target.Attributes.BroadcastChangedIfRevealed();
return true;
@ -1060,7 +1060,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
if (!base.Apply())
return false;
_currentBonus = 0.04f * this.StackCount;
_currentBonus = 0.04f * StackCount;
Target.Attributes[GameAttribute.Weapon_Crit_Chance] += _currentBonus;
Target.Attributes.BroadcastChangedIfRevealed();
return true;
@ -1094,7 +1094,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
Target.Attributes[GameAttribute.Weapon_Crit_Chance] -= _currentBonus;
_currentBonus = 0.04f * this.StackCount;
_currentBonus = 0.04f * StackCount;
Target.Attributes[GameAttribute.Weapon_Crit_Chance] += _currentBonus;
User.Attributes.BroadcastChangedIfRevealed();
@ -1126,7 +1126,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
if (!base.Apply())
return false;
_currentBonus = 0.06f * this.StackCount;
_currentBonus = 0.06f * StackCount;
Target.Attributes[GameAttribute.Dodge_Chance_Bonus] += _currentBonus;
Target.Attributes.BroadcastChangedIfRevealed();
return true;
@ -1160,7 +1160,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
Target.Attributes[GameAttribute.Dodge_Chance_Bonus] -= _currentBonus;
_currentBonus = 0.06f * this.StackCount;
_currentBonus = 0.06f * StackCount;
Target.Attributes[GameAttribute.Dodge_Chance_Bonus] += _currentBonus;
Target.Attributes.BroadcastChangedIfRevealed();

View File

@ -93,9 +93,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
};
proj.Launch(TargetPosition, 1f);
if ((User as Player).SkillSet.HasPassive(218588) && DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
if ((User as Player).SkillSet.HasPassive(218588) && FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
{
var Fetish = new FetishMelee(this.World, this, 0);
var Fetish = new FetishMelee(World, this, 0);
Fetish.Brain.DeActivate();
Fetish.Position = RandomDirection(User.Position, 3f, 8f);
Fetish.Attributes[GameAttribute.Untargetable] = true;
@ -126,7 +126,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if ((User as Player).SkillSet.HasPassive(218588) && FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
{
var Fetish = new FetishMelee(this.World, this, 0);
var Fetish = new FetishMelee(World, this, 0);
Fetish.Brain.DeActivate();
Fetish.Position = RandomDirection(User.Position, 3f, 8f);
Fetish.Attributes[GameAttribute.Untargetable] = true;
@ -163,9 +163,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
yield return WaitSeconds(0.3f); // have tongue hang there for a bit
var tongueMover = new KnockbackBuff(-0.01f, 3f, -0.1f);
this.World.BuffManager.AddBuff(bigtoad, tongueEnd, tongueMover);
World.BuffManager.AddBuff(bigtoad, tongueEnd, tongueMover);
if (ValidTarget())
this.World.BuffManager.AddBuff(bigtoad, Target, new KnockbackBuff(-0.01f, 3f, -0.1f));
World.BuffManager.AddBuff(bigtoad, Target, new KnockbackBuff(-0.01f, 3f, -0.1f));
yield return tongueMover.ArrivalTime;
tongueEnd.Destroy();
@ -189,7 +189,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
_SetHiddenAttribute(Target, false);
bigtoad.PlayActionAnimation(110637); // regurgitate ani
this.World.BuffManager.AddBuff(bigtoad, Target, new Implementations.KnockbackBuff(36f));
World.BuffManager.AddBuff(bigtoad, Target, new KnockbackBuff(36f));
Target.PlayEffectGroup(18281); // actual regurgitate efg isn't working so use generic acid effect
yield return WaitSeconds(0.9f);
}
@ -366,7 +366,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public DamageGroundDebuff(Player player)
{
this.plr = player;
plr = player;
}
public override void OnPayload(Payload payload)
@ -378,17 +378,17 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (Rand.NextDouble() < ScriptFormula(21))
{
//produce a health globe or summon a dog
if (DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.NextDouble() > 0.5)
Target.World.SpawnHealthGlobe(Target, this.plr, Target.Position);
if (FastRandom.Instance.NextDouble() > 0.5)
Target.World.SpawnHealthGlobe(Target, plr, Target.Position);
else
{
var dog = new ZombieDog(User.World, this.plr, 0);
var dog = new ZombieDog(User.World, plr, 0);
dog.Brain.DeActivate();
dog.Position = Target.Position;
dog.Attributes[GameAttribute.Untargetable] = true;
dog.EnterWorld(dog.Position);
dog.PlayActionAnimation(11437);
System.Threading.Tasks.Task.Delay(1000).ContinueWith(d =>
Task.Delay(1000).ContinueWith(d =>
{
dog.Brain.Activate();
dog.Attributes[GameAttribute.Untargetable] = false;
@ -602,7 +602,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if ((User as Player).SkillSet.HasPassive(218588) && FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
{
var Fetish = new FetishMelee(this.World, this, 0);
var Fetish = new FetishMelee(World, this, 0);
Fetish.Brain.DeActivate();
Fetish.Position = RandomDirection(User.Position, 3f, 8f);
Fetish.Attributes[GameAttribute.Untargetable] = true;
@ -872,7 +872,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if ((User as Player).SkillSet.HasPassive(218588) && FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
{
var Fetish = new FetishMelee(this.World, this, 0);
var Fetish = new FetishMelee(World, this, 0);
Fetish.Brain.DeActivate();
Fetish.Position = RandomDirection(User.Position, 3f, 8f);
Fetish.Attributes[GameAttribute.Untargetable] = true;
@ -1025,9 +1025,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
UsePrimaryResource(EvalTag(PowerKeys.ResourceCost));
if ((User as Player).SkillSet.HasPassive(218588) && DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
if ((User as Player).SkillSet.HasPassive(218588) && FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
{
var Fetish = new FetishMelee(this.World, this, 0);
var Fetish = new FetishMelee(World, this, 0);
Fetish.Brain.DeActivate();
Fetish.Position = RandomDirection(User.Position, 3f, 8f);
Fetish.Attributes[GameAttribute.Untargetable] = true;
@ -1069,7 +1069,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
var targets = GetEnemiesInRadius(grenadeN.Position, ScriptFormula(11));
if (targets.Actors.Count > 0)
{
var target = targets.Actors[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, targets.Actors.Count)];
var target = targets.Actors[FastRandom.Instance.Next(0, targets.Actors.Count)];
grenadeN.LaunchArc(PowerMath.TranslateDirection2D(grenadeN.Position, target.Position, grenadeN.Position, PowerMath.Distance2D(grenadeN.Position, target.Position)), height, ScriptFormula(2));
yield return grenadeN.ArrivalTime;
@ -1422,9 +1422,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
UsePrimaryResource(EvalTag(PowerKeys.ResourceCost));
if ((User as Player).SkillSet.HasPassive(218588) && DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
if ((User as Player).SkillSet.HasPassive(218588) && FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
{
var Fetish = new FetishMelee(this.World, this, 0);
var Fetish = new FetishMelee(World, this, 0);
Fetish.Brain.DeActivate();
Fetish.Position = RandomDirection(User.Position, 3f, 8f);
Fetish.Attributes[GameAttribute.Untargetable] = true;
@ -1705,7 +1705,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if ((User as Player).SkillSet.HasPassive(218588) && FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
{
var Fetish = new FetishMelee(this.World, this, 0);
var Fetish = new FetishMelee(World, this, 0);
Fetish.Brain.DeActivate();
Fetish.Position = RandomDirection(User.Position, 3f, 8f);
Fetish.Attributes[GameAttribute.Untargetable] = true;
@ -1999,7 +1999,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
dog.Attributes[GameAttribute.Untargetable] = true;
dog.EnterWorld(dog.Position);
dog.PlayActionAnimation(11437);
System.Threading.Tasks.Task.Delay(1000).ContinueWith(d =>
Task.Delay(1000).ContinueWith(d =>
{
dog.Brain.Activate();
dog.Attributes[GameAttribute.Untargetable] = false;
@ -2028,9 +2028,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
StartCooldown(EvalTag(PowerKeys.CooldownTime));
UsePrimaryResource(EvalTag(PowerKeys.ResourceCost));
if ((User as Player).SkillSet.HasPassive(218588) && DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
if ((User as Player).SkillSet.HasPassive(218588) && FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
{
var Fetish = new FetishMelee(this.World, this, 0);
var Fetish = new FetishMelee(World, this, 0);
Fetish.Brain.DeActivate();
Fetish.Position = RandomDirection(User.Position, 3f, 8f);
Fetish.Attributes[GameAttribute.Untargetable] = true;
@ -2130,7 +2130,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
List<Actor> Creepers = new List<Actor>();
for (int i = 0; i < maxCreepers; i++)
{
var Creeper = new WallCreeper(this.World, this, i);
var Creeper = new WallCreeper(World, this, i);
Creeper.Brain.DeActivate();
Creeper.Position = RandomDirection(Wall.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
Creeper.Attributes[GameAttribute.Untargetable] = true;
@ -2165,7 +2165,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
List<Actor> Fetishes = new List<Actor>();
for (int i = 0; i < maxFetishes; i++)
{
var Fetish = new FetishMelee(this.World, this, i);
var Fetish = new FetishMelee(World, this, i);
Fetish.Brain.DeActivate();
Fetish.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
Fetish.Attributes[GameAttribute.Untargetable] = true;
@ -2178,7 +2178,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
for (int i = 0; i < ScriptFormula(10); i++)
{
var Fetish = new FetishShaman(this.World, this, i);
var Fetish = new FetishShaman(World, this, i);
Fetish.Brain.DeActivate();
Fetish.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
Fetish.Attributes[GameAttribute.Untargetable] = true;
@ -2192,7 +2192,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
for (int i = 0; i < ScriptFormula(13); i++)
{
var Fetish = new FetishHunter(this.World, this, i);
var Fetish = new FetishHunter(World, this, i);
Fetish.Brain.DeActivate();
Fetish.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
Fetish.Attributes[GameAttribute.Untargetable] = true;
@ -2276,7 +2276,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
var dog = new ZombieDog(User.World, User, 0);
dog.Brain.DeActivate();
dog.Position = PowerContext.RandomDirection(User.Position, 3f, 8f);
dog.Position = RandomDirection(User.Position, 3f, 8f);
dog.Attributes[GameAttribute.Untargetable] = true;
dog.EnterWorld(dog.Position);
dog.PlayActionAnimation(11437);
@ -2331,7 +2331,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override IEnumerable<TickTimer> Main()
{
StartCooldown(EvalTag(PowerKeys.CooldownTime));
var garg = new GargantuanMinion(this.World, this, 0);
var garg = new GargantuanMinion(World, this, 0);
garg.Brain.DeActivate();
garg.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
garg.Attributes[GameAttribute.Untargetable] = true;
@ -2422,7 +2422,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (!base.Apply())
return false;
var garg = (this.Target as GargantuanMinion);
var garg = (Target as GargantuanMinion);
garg.WalkSpeed *= 1.2f;
garg.CooldownReduction *= 0.65f;
return true;
@ -2438,7 +2438,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override void Remove()
{
var garg = (this.Target as GargantuanMinion);
var garg = (Target as GargantuanMinion);
garg.WalkSpeed /= 1.2f;
garg.CooldownReduction /= 0.65f;
base.Remove();
@ -2462,7 +2462,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
}
else
{
var hex = new HexMinion(this.World, this, 0);
var hex = new HexMinion(World, this, 0);
hex.Brain.DeActivate();
hex.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
hex.Attributes[GameAttribute.Untargetable] = true;
@ -2552,7 +2552,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (Rune_B > 0)
{
var spider = new CorpseSpiderQueen(this.World, this, 0);
var spider = new CorpseSpiderQueen(World, this, 0);
spider.Brain.DeActivate();
spider.Scale = 3f;
spider.Position = RandomDirection(TargetPosition, 3f, 8f);
@ -2570,7 +2570,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
for (int i = 0; i < (int)ScriptFormula(0); i++)
{
var spider = new CorpseSpider(
this.World,
World,
this,
RuneSelect(
ActorSno._witchdoctor_corpsespider,
@ -2597,7 +2597,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if ((User as Player).SkillSet.HasPassive(218588) && FastRandom.Instance.Next(100) < 5) //FetishSycophants (wd)
{
var Fetish = new FetishMelee(this.World, this, 0);
var Fetish = new FetishMelee(World, this, 0);
Fetish.Brain.DeActivate();
Fetish.Position = RandomDirection(User.Position, 3f, 8f);
Fetish.Attributes[GameAttribute.Untargetable] = true;
@ -2686,7 +2686,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
List<Actor> dogs = new List<Actor>();
for (int i = 0; i < maxDogs; i++)
{
var dog = new ZombieDog(this.World, User, i, ScriptFormula(13));
var dog = new ZombieDog(World, User, i, ScriptFormula(13));
dog.Brain.DeActivate();
dog.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
dog.Attributes[GameAttribute.Untargetable] = true;

View File

@ -2236,7 +2236,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override void OnChannelOpen()
{
this.EffectsPerSecond = 0.3f;
EffectsPerSecond = 0.3f;
if (Rune_B > 0)
{
@ -2465,7 +2465,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
List<Actor> Images = new List<Actor>();
for (int i = 0; i < maxImages; i++)
{
var Image = new MirrorImageMinion(this.World, this, i, ScriptFormula(9));
var Image = new MirrorImageMinion(World, this, i, ScriptFormula(9));
Image.Brain.DeActivate();
Image.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
Image.Attributes[GameAttribute.Untargetable] = true;
@ -3984,7 +3984,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
List<Actor> Images = new List<Actor>();
for (int i = 0; i < maxImages; i++)
{
var Image = new MirrorImageMinion(this.World, this, i, ScriptFormula(2));
var Image = new MirrorImageMinion(World, this, i, ScriptFormula(2));
Image.Brain.DeActivate();
Image.Position = RandomDirection(User.Position, 3f, 8f); //Kind of hacky until we get proper collisiondetection
Image.Attributes[GameAttribute.Untargetable] = true;

View File

@ -28,10 +28,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (User.GetActorsInRange(80f).Count < 100)
for (int i = 0; i < 3; i++)
{
var monster = ActorFactory.Create(User.World, (ActorSno)(this.User as Monster).SNOSummons[0], new TagMap());
var monster = ActorFactory.Create(User.World, (ActorSno)(User as Monster).SNOSummons[0], new TagMap());
monster.Scale = 1.35f;
monster.EnterWorld(RandomDirection(Target.Position, 3, 10));
this.World.BuffManager.AddBuff(User, monster, new Implementations.SummonedBuff());
World.BuffManager.AddBuff(User, monster, new SummonedBuff());
}
yield break;
}
@ -225,7 +225,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
monster.Scale = 1.35f;
monster.EnterWorld(RandomDirection(User.Position, 3, 10));
monster.Unstuck();
this.World.BuffManager.AddBuff(User, monster, new Implementations.SummonedBuff());
World.BuffManager.AddBuff(User, monster, new SummonedBuff());
}
yield break;
}
@ -313,7 +313,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
monster.Scale = 1.35f;
monster.EnterWorld(RandomDirection(Target.Position, 3, 10));
monster.Unstuck();
this.World.BuffManager.AddBuff(User, monster, new Implementations.SummonedBuff());
World.BuffManager.AddBuff(User, monster, new SummonedBuff());
}
yield break;
}

View File

@ -273,7 +273,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
Target.Attributes[GameAttribute.IsRooted] = true;
Target.Attributes.BroadcastChangedIfRevealed();
}
this.Target.World.BroadcastIfRevealed(plr => new MessageSystem.Message.Definitions.ACD.ACDTranslateSyncMessage() { ActorId = this.Target.DynamicID(plr), Position = this.Target.Position, Snap = false }, this.Target);
Target.World.BroadcastIfRevealed(plr => new MessageSystem.Message.Definitions.ACD.ACDTranslateSyncMessage() { ActorId = Target.DynamicID(plr), Position = Target.Position, Snap = false }, Target);
return true;
}

View File

@ -58,7 +58,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations.MonsterSkills
{
var projectileId = ActorSno._d3arrow;//default
switch (this.User.SNO)
switch (User.SNO)
{
case ActorSno._fleshpitflyer_b: projectileId = ActorSno._skeletonmage_poison_projectile; break;
case ActorSno._demonflyer_c_bomber: projectileId = ActorSno._demonflyer_bomb_projectile; break;//demonFlyer_bomb_projectile
@ -353,7 +353,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations.MonsterSkills
{
var proj = ActorSno._skeletonmage_fire_projectile;
float dmg = 1.1f;
if (this.User.SNO == ActorSno._p6_necro_skeletonmage_f_archer)
if (User.SNO == ActorSno._p6_necro_skeletonmage_f_archer)
{
proj = ActorSno._p6_necro_skeletonmage_f_archer_projectile;
dmg = 4f;
@ -496,7 +496,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations.MonsterSkills
{
for (int i = 0; i < 4; i++)
{
var _destination = PowerContext.RandomDirection(User.Position, 20f, 30f);
var _destination = RandomDirection(User.Position, 20f, 30f);
var moveBuff = new MoverBuff(MovementHelpers.GetCorrectPosition(User.Position, _destination, User.World));
AddBuff(User, moveBuff);
yield return moveBuff.Timeout;
@ -569,7 +569,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations.MonsterSkills
public override IEnumerable<TickTimer> Main()
{
var _destination = PowerContext.RandomDirection(User.Position, 10f, 20f);
var _destination = RandomDirection(User.Position, 10f, 20f);
var moveBuff = new MoverBuff(MovementHelpers.GetCorrectPosition(User.Position, _destination, User.World));
AddBuff(User, moveBuff);
yield return moveBuff.Timeout;

View File

@ -30,18 +30,18 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
protected void RandomPostion() // spawn actor at random postion
{
this.SpawnPosition = RandomDirection(User.Position, 5, 10);
SpawnPosition = RandomDirection(User.Position, 5, 10);
}
protected void UserPostion() // spawn actor at user postion
{
this.SpawnPosition = User.Position;
SpawnPosition = User.Position;
}
protected void InFrontPostion() // spawn actor in front of user
{
float userFacing = (float)Math.Acos(this.User.RotationW) * 2f;
this.SpawnPosition = new Vector3D(User.Position.X + 8 * (float)Math.Cos(userFacing),
float userFacing = (float)Math.Acos(User.RotationW) * 2f;
SpawnPosition = new Vector3D(User.Position.X + 8 * (float)Math.Cos(userFacing),
User.Position.Y + 8 * (float)Math.Sin(userFacing),
User.Position.Z);
}
@ -51,8 +51,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (User.GetActorsInRange(80f).Count > 100) return;
var monster = ActorFactory.Create(User.World, actorSNO, new TagMap());
monster.Scale = 1f; // TODO: look this up properly
monster.EnterWorld(this.SpawnPosition);
this.World.BuffManager.AddBuff(User, monster, new Implementations.SummonedBuff());
monster.EnterWorld(SpawnPosition);
World.BuffManager.AddBuff(User, monster, new SummonedBuff());
}
}
@ -62,7 +62,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override IEnumerable<TickTimer> Main()
{
InFrontPostion();
SummonMonster((this.User as Monster).SNOSummons[0]);
SummonMonster((User as Monster).SNOSummons[0]);
yield break;
}
}
@ -72,7 +72,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
public override IEnumerable<TickTimer> Main()
{
this.World.BuffManager.AddBuff(User, User, new DeathTriggerBuff());
World.BuffManager.AddBuff(User, User, new DeathTriggerBuff());
if ((User is Monster) && ((User as Monster).Brain is MonsterBrain))
((User as Monster).Brain as MonsterBrain).PresetPowers.Remove(30550);
yield break;
@ -87,12 +87,12 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (payload.Target == User && payload is DeathPayload)
{
if (User.GetActorsInRange(80f).Count > 100) return;
var monster = ActorFactory.Create(User.World, (this.User as Monster).SNOSummons[0], new TagMap());
var monster = ActorFactory.Create(User.World, (User as Monster).SNOSummons[0], new TagMap());
if (monster != null)
{
monster.Scale = 1.35f;
monster.EnterWorld(User.Position);
this.World.BuffManager.AddBuff(User, monster, new Implementations.SummonedBuff());
World.BuffManager.AddBuff(User, monster, new SummonedBuff());
}
}
}
@ -104,7 +104,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
public override IEnumerable<TickTimer> Main()
{
this.World.BuffManager.AddBuff(User, User, new DeathTriggerBuff());
World.BuffManager.AddBuff(User, User, new DeathTriggerBuff());
if ((User is Monster) && ((User as Monster).Brain is MonsterBrain))
((User as Monster).Brain as MonsterBrain).PresetPowers.Remove(30178);
yield break;
@ -122,10 +122,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
User.PlayAnimation(11, User.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Explode]);
for (int i = 0; i < 3; i++)
{
var monster = ActorFactory.Create(User.World, (this.User as Monster).SNOSummons[0], new TagMap());
var monster = ActorFactory.Create(User.World, (User as Monster).SNOSummons[0], new TagMap());
monster.Scale = 1.35f;
monster.EnterWorld(RandomDirection(User.Position, 1, 3));
this.World.BuffManager.AddBuff(User, monster, new Implementations.SummonedBuff());
World.BuffManager.AddBuff(User, monster, new SummonedBuff());
}
}
}
@ -137,7 +137,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
public override IEnumerable<TickTimer> Main()
{
this.World.BuffManager.AddBuff(User, User, new SuicideBuff());
World.BuffManager.AddBuff(User, User, new SuicideBuff());
if ((User is Monster) && ((User as Monster).Brain is MonsterBrain))
((User as Monster).Brain as MonsterBrain).PresetPowers.Remove(66547);
yield break;
@ -196,7 +196,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
{
RandomPostion();
if (User is Monster)
SummonMonster((this.User as Monster).SNOSummons[0]);
SummonMonster((User as Monster).SNOSummons[0]);
yield break;
}
}
@ -217,7 +217,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
public override IEnumerable<TickTimer> Main()
{
UserPostion();
SummonMonster((this.User as Monster).SNOSummons[0]);
SummonMonster((User as Monster).SNOSummons[0]);
yield break;
}
}

View File

@ -79,8 +79,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
public void SetSingleTarget(Actor target)
{
this.Targets = new TargetList();
this.Targets.Actors.Add(target);
Targets = new TargetList();
Targets.Actors.Add(target);
}
public void AddBuffOnHit<T>() where T : Buff, new()
@ -90,49 +90,49 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
public void Apply()
{
if (this.Targets == null) this.Targets = new TargetList();
if (this.Target.World != null)
if (Targets == null) Targets = new TargetList();
if (Target.World != null)
{
if (!this.Target.World.Game.Working) return;
this.Target.World.BuffManager.SendTargetPayload(this.Target, this);
if (!Target.World.Game.Working) return;
Target.World.BuffManager.SendTargetPayload(Target, this);
if (this.Context.User != null) this.Target.World.BuffManager.SendTargetPayload(this.Context.User, this);
if (Context.User != null) Target.World.BuffManager.SendTargetPayload(Context.User, this);
}
if (new System.Diagnostics.StackTrace().FrameCount > 35)
{
return;
}
if (this.Target is Player && this.DamageEntries.Count > 0)
if (Target is Player && DamageEntries.Count > 0)
{
Player player = (Player)this.Target;
foreach (Actor extra in this.Targets.ExtraActors)
Player player = (Player)Target;
foreach (Actor extra in Targets.ExtraActors)
if (extra is DesctructibleLootContainer)
extra.OnTargeted(player, null);
}
if (this.Context.User is Player && this.Context.Target is Monster && this.Context.Target.GBHandle.Type == 1)
if (Context.User is Player && Context.Target is Monster && Context.Target.GBHandle.Type == 1)
{
(this.Context.User as Player).ExpBonusData.MonsterAttacked((this.Context.User as Player).InGameClient.Game.TickCounter);
((this.Context.Target as Monster).Brain as AISystem.Brains.MonsterBrain).AttackedBy = this.Context.User;
(Context.User as Player).ExpBonusData.MonsterAttacked((Context.User as Player).InGameClient.Game.TickCounter);
((Context.Target as Monster).Brain as AISystem.Brains.MonsterBrain).AttackedBy = Context.User;
}
foreach (Actor target in this.Targets.Actors)
foreach (Actor target in Targets.Actors)
{
if (target == null || target.World == null || target.World != null && target.World.PowerManager.IsDeletingActor(target))
continue;
var payload = new HitPayload(this, _DoCriticalHit(this.Context.User, target, chcBonus)
var payload = new HitPayload(this, _DoCriticalHit(Context.User, target, chcBonus)
, target);
payload.AutomaticHitEffects = this.AutomaticHitEffects;
payload.AutomaticHitEffects = AutomaticHitEffects;
payload.OnDeath = OnDeath;
foreach (Func<Buff> buffFactory in _hitBuffs)
this.Context.AddBuff(target, buffFactory());
Context.AddBuff(target, buffFactory());
if (payload.Successful)
{
try
{
if (OnHit != null && this.AutomaticHitEffects)
if (OnHit != null && AutomaticHitEffects)
OnHit(payload);
}
catch { }
@ -146,7 +146,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
if (target.Attributes[GameAttribute.Ignores_Critical_Hits]) return false;
//Monk -> Exploding Palm
if (this.Context.PowerSNO == 97328 && this.Context.Rune_E <= 0) return false;
if (Context.PowerSNO == 97328 && Context.Rune_E <= 0) return false;
float additionalCritChance = chcBonus;
@ -169,7 +169,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
target.World.BuffManager.RemoveBuffs(target, SkillsSystem.Skills.Crusader.FaithGenerators.Punish);
}
var totalCritChance = user.Attributes[GameAttribute.Weapon_Crit_Chance] + user.Attributes[GameAttribute.Crit_Percent_Bonus_Capped] + user.Attributes[GameAttribute.Crit_Percent_Bonus_Uncapped] + user.Attributes[GameAttribute.Power_Crit_Percent_Bonus, this.Context.PowerSNO] + target.Attributes[GameAttribute.Bonus_Chance_To_Be_Crit_Hit] + additionalCritChance;
var totalCritChance = user.Attributes[GameAttribute.Weapon_Crit_Chance] + user.Attributes[GameAttribute.Crit_Percent_Bonus_Capped] + user.Attributes[GameAttribute.Crit_Percent_Bonus_Uncapped] + user.Attributes[GameAttribute.Power_Crit_Percent_Bonus, Context.PowerSNO] + target.Attributes[GameAttribute.Bonus_Chance_To_Be_Crit_Hit] + additionalCritChance;
if (totalCritChance > 0.85f) totalCritChance = 0.85f;
return PowerContext.Rand.NextDouble() < totalCritChance;
}

View File

@ -890,16 +890,25 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
float seed = (float)FastRandom.Instance.NextDouble();
foreach (float rate in dropRates)
if (seed < (rate * (1f + plr.Attributes[GameAttribute.Magic_Find]) * Config.Instance.RateDrop))
{
// if seed is less than the drop rate, drop the item
if (seed < (rate * (1f
+ plr.Attributes[GameAttribute.Magic_Find])
* Config.Instance.RateDrop))
{
//Logger.Debug("rate: {0}", rate);
var lootQuality = Target.World.Game.IsHardcore ? LootManager.GetSeasonalLootQuality((int)Target.Quality, Target.World.Game.Difficulty) : LootManager.GetLootQuality((int)Target.Quality, Target.World.Game.Difficulty);
var lootQuality = Target.World.Game.IsHardcore
? LootManager.GetSeasonalLootQuality((int)Target.Quality,
Target.World.Game.Difficulty)
: LootManager.GetLootQuality((int)Target.Quality, Target.World.Game.Difficulty);
Target.World.SpawnRandomEquip(Target, plr, lootQuality);
if (Target is Goblin)
Target.World.SpawnRandomGem(Target, plr);
}
else
break;
}
if ((int)Target.Quality >= 4 && plr.AdditionalLootItems > 0)
for (int d = 0; d < plr.AdditionalLootItems; d++)
{
@ -907,7 +916,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
Target.World.SpawnRandomEquip(Target, plr, lootQuality);
}
if (Target is Champion || Target is Rare || Target is Unique || Target is Boss)
if (Target is Champion or Rare or Unique or Boss)
{
//if (FastRandom.Instance.NextDouble() < LootManager.GetEssenceDropChance(this.Target.World.Game.Difficulty))
// this.Target.World.SpawnEssence(this.Target, plr);

View File

@ -56,7 +56,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
public bool AutomaticHitEffects = true;
public Action<DeathPayload> OnDeath = null;
private bool WaitTo(TickerSystem.TickTimer timer)
private bool WaitTo(TickTimer timer)
{
while (timer.TimedOut != true)
{
@ -68,153 +68,153 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
public HitPayload(AttackPayload attackPayload, bool criticalHit, Actor target)
: base(attackPayload.Context, target)
{
this.IsCriticalHit = criticalHit;
this.IsDodged = false;
this.IsWeaponDamage = (attackPayload.DamageEntries.Count > 0 ? attackPayload.DamageEntries.First().IsWeaponBasedDamage : false);
IsCriticalHit = criticalHit;
IsDodged = false;
IsWeaponDamage = (attackPayload.DamageEntries.Count > 0 ? attackPayload.DamageEntries.First().IsWeaponBasedDamage : false);
if (this.Context.User == null)
this.Context.User = target;
if (Context.User == null)
Context.User = target;
if (this.Target == null)
this.Target = target;
if (Target == null)
Target = target;
if (this.Target == null) return;
if (Target == null) return;
if (this.Target.World == null) return;
if (Target.World == null) return;
if (!this.Target.World.Game.Working) return;
if (!Target.World.Game.Working) return;
if (this.Target.World.Game.Paused) return;
if (Target.World.Game.Paused) return;
if (!this.Target.Visible) return;
if (!Target.Visible) return;
if (this.Target.Dead) return;
if (Target.Dead) return;
if (this.Context.User is Monster && this.Context.Target is Player)
if (!this.Context.User.IsRevealedToPlayer(this.Context.Target as Player))
if (Context.User is Monster && Context.Target is Player)
if (!Context.User.IsRevealedToPlayer(Context.Target as Player))
return;
this.Successful = true;
Successful = true;
//float weaponMinDamage = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0];
//float weaponDamageDelta = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0];
// calculate and add up damage amount for each element type
this.ElementDamages = new Dictionary<DamageType, float>();
ElementDamages = new Dictionary<DamageType, float>();
foreach (var entry in attackPayload.DamageEntries)
{
if (!this.ElementDamages.ContainsKey(entry.DamageType))
this.ElementDamages[entry.DamageType] = 0f;
if (!ElementDamages.ContainsKey(entry.DamageType))
ElementDamages[entry.DamageType] = 0f;
switch (this.Context.User)
switch (Context.User)
{
case Player:
if (entry.IsWeaponBasedDamage)
{
this.ElementDamages[entry.DamageType] += entry.WeaponDamageMultiplier
ElementDamages[entry.DamageType] += entry.WeaponDamageMultiplier
* (
this.Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0] + ((int)entry.DamageType.HitEffect > 0 ? this.Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, (int)entry.DamageType.HitEffect] : 0)
Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0] + ((int)entry.DamageType.HitEffect > 0 ? Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, (int)entry.DamageType.HitEffect] : 0)
+
((float)PowerContext.Rand.NextDouble() * (this.Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0] + ((int)entry.DamageType.HitEffect > 0 ? this.Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, (int)entry.DamageType.HitEffect] : 0)))
((float)PowerContext.Rand.NextDouble() * (Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0] + ((int)entry.DamageType.HitEffect > 0 ? Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, (int)entry.DamageType.HitEffect] : 0)))
);
}
else
this.ElementDamages[entry.DamageType] += entry.MinDamage + (float)PowerContext.Rand.NextDouble() * entry.DamageDelta;
ElementDamages[entry.DamageType] += entry.MinDamage + (float)PowerContext.Rand.NextDouble() * entry.DamageDelta;
break;
case Minion:
var master = (this.Context.User as Minion).Master;
var dmg_mul = (this.Context.User as Minion).DamageCoefficient;
var master = (Context.User as Minion).Master;
var dmg_mul = (Context.User as Minion).DamageCoefficient;
this.ElementDamages[entry.DamageType] += entry.WeaponDamageMultiplier * dmg_mul * (
ElementDamages[entry.DamageType] += entry.WeaponDamageMultiplier * dmg_mul * (
master.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0] + ((int)entry.DamageType.HitEffect > 0 ? master.Attributes[GameAttribute.Damage_Weapon_Min_Total, (int)entry.DamageType.HitEffect] : 0) +
((float)PowerContext.Rand.NextDouble() * (master.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0] + ((int)entry.DamageType.HitEffect > 0 ? master.Attributes[GameAttribute.Damage_Weapon_Delta_Total, (int)entry.DamageType.HitEffect] : 0)))
);
break;
default:
this.ElementDamages[entry.DamageType] += entry.WeaponDamageMultiplier * (this.Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0] + ((float)PowerContext.Rand.NextDouble() * this.Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0]));
ElementDamages[entry.DamageType] += entry.WeaponDamageMultiplier * (Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0] + ((float)PowerContext.Rand.NextDouble() * Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0]));
break;
}
this.ElementDamages[entry.DamageType] *= 1f + this.Context.User.Attributes[GameAttribute.Damage_Type_Percent_Bonus, (int)entry.DamageType.HitEffect] + this.Context.User.Attributes[GameAttribute.Damage_Dealt_Percent_Bonus, (int)entry.DamageType.HitEffect];
ElementDamages[entry.DamageType] *= 1f + Context.User.Attributes[GameAttribute.Damage_Type_Percent_Bonus, (int)entry.DamageType.HitEffect] + Context.User.Attributes[GameAttribute.Damage_Dealt_Percent_Bonus, (int)entry.DamageType.HitEffect];
if (this.Target.Attributes[GameAttribute.Immunity, (int)entry.DamageType.HitEffect] == true) this.ElementDamages[entry.DamageType] = 0f; //Immunity
if (Target.Attributes[GameAttribute.Immunity, (int)entry.DamageType.HitEffect] == true) ElementDamages[entry.DamageType] = 0f; //Immunity
switch (this.Target)
switch (Target)
{
case Player:
this.ElementDamages[entry.DamageType] *= HitPayload.ReductionFromResistance(this.Target.Attributes[GameAttribute.Resistance_Total, (int)entry.DamageType.HitEffect], this.Context.User.Attributes[GameAttribute.Level]);
this.ElementDamages[entry.DamageType] *= 1f - this.Target.Attributes[GameAttribute.Damage_Percent_Reduction_From_Type, (int)entry.DamageType.HitEffect] + this.Target.Attributes[GameAttribute.Amplify_Damage_Type_Percent, (int)entry.DamageType.HitEffect];
if ((this.Target as Player).SkillSet.HasPassive(205491) && (int)entry.DamageType.HitEffect != 0)
this.ElementDamages[entry.DamageType] *= 0.8f;
ElementDamages[entry.DamageType] *= ReductionFromResistance(Target.Attributes[GameAttribute.Resistance_Total, (int)entry.DamageType.HitEffect], Context.User.Attributes[GameAttribute.Level]);
ElementDamages[entry.DamageType] *= 1f - Target.Attributes[GameAttribute.Damage_Percent_Reduction_From_Type, (int)entry.DamageType.HitEffect] + Target.Attributes[GameAttribute.Amplify_Damage_Type_Percent, (int)entry.DamageType.HitEffect];
if ((Target as Player).SkillSet.HasPassive(205491) && (int)entry.DamageType.HitEffect != 0)
ElementDamages[entry.DamageType] *= 0.8f;
if((Target as Player).SkillSet.HasSkill(462239))
foreach (var skill in (Target as Player).SkillSet.ActiveSkills)
if (skill.snoSkill == 462239 && skill.snoRune == 2)
TotalDamage *= 1f - (Target as Player).Revived.Count * 0.03f;
break;
case Hireling:
this.ElementDamages[entry.DamageType] *= HitPayload.ReductionFromResistance(this.Target.Attributes[GameAttribute.Resistance_Total, (int)entry.DamageType.HitEffect], this.Context.User.Attributes[GameAttribute.Level]);
this.ElementDamages[entry.DamageType] *= 1f - this.Target.Attributes[GameAttribute.Damage_Percent_Reduction_From_Type, (int)entry.DamageType.HitEffect] + this.Target.Attributes[GameAttribute.Amplify_Damage_Type_Percent, (int)entry.DamageType.HitEffect];
ElementDamages[entry.DamageType] *= ReductionFromResistance(Target.Attributes[GameAttribute.Resistance_Total, (int)entry.DamageType.HitEffect], Context.User.Attributes[GameAttribute.Level]);
ElementDamages[entry.DamageType] *= 1f - Target.Attributes[GameAttribute.Damage_Percent_Reduction_From_Type, (int)entry.DamageType.HitEffect] + Target.Attributes[GameAttribute.Amplify_Damage_Type_Percent, (int)entry.DamageType.HitEffect];
break;
case Minion:
this.ElementDamages[entry.DamageType] *= HitPayload.ReductionFromResistance((this.Target as Minion).Master.Attributes[GameAttribute.Resistance_Total, (int)entry.DamageType.HitEffect], this.Context.User.Attributes[GameAttribute.Level]);
ElementDamages[entry.DamageType] *= ReductionFromResistance((Target as Minion).Master.Attributes[GameAttribute.Resistance_Total, (int)entry.DamageType.HitEffect], Context.User.Attributes[GameAttribute.Level]);
break;
}
}
this.TotalDamage = this.ElementDamages.Sum(kv => kv.Value);
TotalDamage = ElementDamages.Sum(kv => kv.Value);
if (this.Context.User.Attributes[GameAttribute.God] == true)
this.TotalDamage = 0f;
if (Context.User.Attributes[GameAttribute.God] == true)
TotalDamage = 0f;
// apply critical damage boost
if (criticalHit)
{
this.TotalDamage *= (1f + this.Context.User.Attributes[GameAttribute.Crit_Damage_Percent]);
if (this.Context.User is Player && (this.Context.User as Player).Toon.Class == ToonClass.Wizard && this.Context.User.Attributes[GameAttribute.Resource_On_Crit, 1] > 0)
if (FastRandom.Instance.NextDouble() < this.Context.GetProcCoefficient())
(this.Context.User as Player).GeneratePrimaryResource(this.Context.User.Attributes[GameAttribute.Resource_On_Crit, 1]);
TotalDamage *= (1f + Context.User.Attributes[GameAttribute.Crit_Damage_Percent]);
if (Context.User is Player && (Context.User as Player).Toon.Class == ToonClass.Wizard && Context.User.Attributes[GameAttribute.Resource_On_Crit, 1] > 0)
if (FastRandom.Instance.NextDouble() < Context.GetProcCoefficient())
(Context.User as Player).GeneratePrimaryResource(Context.User.Attributes[GameAttribute.Resource_On_Crit, 1]);
}
var targetArmor = target.Attributes[GameAttribute.Armor_Total];
var attackerLevel = attackPayload.Context.User.Attributes[GameAttribute.Level];
this.TotalDamage *= HitPayload.ReductionFromArmor(targetArmor, attackerLevel);
TotalDamage *= ReductionFromArmor(targetArmor, attackerLevel);
//this.TotalDamage *= 1f - target.Attributes[GameAttribute.Armor_Bonus_Percent];
//this.TotalDamage *= 1f + target.Attributes[GameAttribute.Amplify_Damage_Percent];
//this.TotalDamage *= 1f + attackPayload.Context.User.Attributes[GameAttribute.Multiplicative_Damage_Percent_Bonus_No_Pets];
this.TotalDamage *= 1f - attackPayload.Context.User.Attributes[GameAttribute.Damage_Done_Reduction_Percent];
this.TotalDamage *= 1f + this.Context.User.Attributes[GameAttribute.Power_Damage_Percent_Bonus, attackPayload.Context.PowerSNO];
TotalDamage *= 1f - attackPayload.Context.User.Attributes[GameAttribute.Damage_Done_Reduction_Percent];
TotalDamage *= 1f + Context.User.Attributes[GameAttribute.Power_Damage_Percent_Bonus, attackPayload.Context.PowerSNO];
if (PowerMath.Distance2D(this.Context.User.Position, this.Target.Position) < 6f)
this.TotalDamage *= 1f - this.Target.Attributes[GameAttribute.Damage_Percent_Reduction_From_Melee];
if (PowerMath.Distance2D(Context.User.Position, Target.Position) < 6f)
TotalDamage *= 1f - Target.Attributes[GameAttribute.Damage_Percent_Reduction_From_Melee];
else
this.TotalDamage *= 1f - this.Target.Attributes[GameAttribute.Damage_Percent_Reduction_From_Ranged];
TotalDamage *= 1f - Target.Attributes[GameAttribute.Damage_Percent_Reduction_From_Ranged];
this.DominantDamageType = this.ElementDamages.OrderByDescending(kv => kv.Value).FirstOrDefault().Key;
if (this.DominantDamageType == null) this.DominantDamageType = DamageType.Physical;
DominantDamageType = ElementDamages.OrderByDescending(kv => kv.Value).FirstOrDefault().Key;
if (DominantDamageType == null) DominantDamageType = DamageType.Physical;
switch (this.Context.User)
switch (Context.User)
{
case Player:
if (this.IsWeaponDamage)
if (IsWeaponDamage)
{
var plr = this.Context.User as Player;
this.TotalDamage = TotalDamage * (1 + (plr.PrimaryAttribute / 100f));
if (FastRandom.Instance.NextDouble() < this.Context.GetProcCoefficient())
var plr = Context.User as Player;
TotalDamage = TotalDamage * (1 + (plr.PrimaryAttribute / 100f));
if (FastRandom.Instance.NextDouble() < Context.GetProcCoefficient())
plr.GeneratePrimaryResource(plr.Attributes[GameAttribute.Resource_On_Hit]);
switch (plr.Toon.Class)
{
case ToonClass.WitchDoctor:
if (plr.SkillSet.HasPassive(217826) && this.ElementDamages.ContainsKey(DamageType.Poison) && this.ElementDamages[DamageType.Poison] > 0f) //BadMedicine (wd)
plr.World.BuffManager.AddBuff(this.Context.User, this.Target, new DamageReduceDebuff(0.2f, TickTimer.WaitSeconds(plr.World.Game, 3f)));
if (plr.SkillSet.HasPassive(217826) && ElementDamages.ContainsKey(DamageType.Poison) && ElementDamages[DamageType.Poison] > 0f) //BadMedicine (wd)
plr.World.BuffManager.AddBuff(Context.User, Target, new DamageReduceDebuff(0.2f, TickTimer.WaitSeconds(plr.World.Game, 3f)));
if (plr.SkillSet.HasPassive(208628))
this.TotalDamage *= 1.2f;
TotalDamage *= 1.2f;
if (plr.SkillSet.HasPassive(209041) &&
(
@ -224,45 +224,45 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
))
plr.World.BuffManager.AddBuff(plr, plr, new VisionQuestBuff());
if (FastRandom.Instance.NextDouble() < this.Context.GetProcCoefficient())
if (FastRandom.Instance.NextDouble() < Context.GetProcCoefficient())
plr.GeneratePrimaryResource(plr.Attributes[GameAttribute.Resource_On_Hit, 0]);
break;
case ToonClass.Barbarian:
if (plr.SkillSet.HasPassive(205187))
if (plr.Attributes[GameAttribute.Resource_Max_Total, 2] == plr.Attributes[GameAttribute.Resource_Cur, 2])
this.TotalDamage *= 1.25f;
TotalDamage *= 1.25f;
if (plr.SkillSet.HasPassive(205133))
if (plr.GetObjectsInRange<Monster>(8f).Count >= 3)
this.TotalDamage *= 1.2f;
TotalDamage *= 1.2f;
if (plr.SkillSet.HasPassive(205175))
if (this.Target.Attributes[GameAttribute.Hitpoints_Cur] < (this.Target.Attributes[GameAttribute.Hitpoints_Max_Total] * 0.3f))
this.TotalDamage *= 1.4f;
if (Target.Attributes[GameAttribute.Hitpoints_Cur] < (Target.Attributes[GameAttribute.Hitpoints_Max_Total] * 0.3f))
TotalDamage *= 1.4f;
break;
case ToonClass.DemonHunter:
if (plr.SkillSet.HasPassive(164363))
if (plr.GetObjectsInRange<Monster>(10f).Count == 0)
this.TotalDamage *= 1.2f;
TotalDamage *= 1.2f;
if (plr.SkillSet.HasPassive(352920))
if (this.Target.Attributes[GameAttribute.Hitpoints_Cur] > (this.Target.Attributes[GameAttribute.Hitpoints_Max_Total] * 0.75f))
this.TotalDamage *= 1.4f;
if (Target.Attributes[GameAttribute.Hitpoints_Cur] > (Target.Attributes[GameAttribute.Hitpoints_Max_Total] * 0.75f))
TotalDamage *= 1.4f;
if (plr.SkillSet.HasPassive(218350) && criticalHit)
if (FastRandom.Instance.NextDouble() < this.Context.GetProcCoefficient())
if (FastRandom.Instance.NextDouble() < Context.GetProcCoefficient())
plr.GenerateSecondaryResource(1f);
if (plr.SkillSet.HasPassive(155721) && this.Target.Attributes[GameAttribute.Slow] == true)
this.TotalDamage *= 1.20f;
if (plr.SkillSet.HasPassive(155721) && Target.Attributes[GameAttribute.Slow] == true)
TotalDamage *= 1.20f;
if (plr.SkillSet.HasPassive(155725))
plr.World.BuffManager.AddBuff(plr, plr, new SpeedBuff(0.2f, TickTimer.WaitSeconds(plr.World.Game, 2f)));
if (plr.SkillSet.HasPassive(211225) && plr.World.BuffManager.GetFirstBuff<Implementations.ThrillOfTheHuntCooldownBuff>(plr) == null) //ThrillOfTheHunt (DH)
if (plr.SkillSet.HasPassive(211225) && plr.World.BuffManager.GetFirstBuff<ThrillOfTheHuntCooldownBuff>(plr) == null) //ThrillOfTheHunt (DH)
{
if (!plr.World.BuffManager.HasBuff<DebuffStunned>(this.Target))
plr.World.BuffManager.AddBuff(plr, this.Target, new DebuffStunned(TickTimer.WaitSeconds(plr.World.Game, 3f)));
if (!plr.World.BuffManager.HasBuff<DebuffStunned>(Target))
plr.World.BuffManager.AddBuff(plr, Target, new DebuffStunned(TickTimer.WaitSeconds(plr.World.Game, 3f)));
plr.World.BuffManager.AddBuff(plr, plr, new ThrillOfTheHuntCooldownBuff());
}
@ -277,90 +277,90 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
}
break;
case ToonClass.Wizard:
if (plr.SkillSet.HasPassive(208477) && this.ElementDamages.ContainsKey(DamageType.Arcane) && this.ElementDamages[DamageType.Arcane] > 0f) //TemporalFlux (wizard)
if (!plr.World.BuffManager.HasBuff<DebuffSlowed>(this.Target))
plr.World.BuffManager.AddBuff(this.Context.User, this.Target, new DebuffSlowed(0.8f, TickTimer.WaitSeconds(plr.World.Game, 2f)));
if (plr.SkillSet.HasPassive(208477) && ElementDamages.ContainsKey(DamageType.Arcane) && ElementDamages[DamageType.Arcane] > 0f) //TemporalFlux (wizard)
if (!plr.World.BuffManager.HasBuff<DebuffSlowed>(Target))
plr.World.BuffManager.AddBuff(Context.User, Target, new DebuffSlowed(0.8f, TickTimer.WaitSeconds(plr.World.Game, 2f)));
if (plr.SkillSet.HasPassive(226348) && this.ElementDamages.ContainsKey(DamageType.Lightning) && this.ElementDamages[DamageType.Lightning] > 0f) //Paralysis (wizard)
if (this.AutomaticHitEffects && !plr.World.BuffManager.HasBuff<DebuffStunned>(this.Target))
if (FastRandom.Instance.NextDouble() < 0.15f * this.Context.GetProcCoefficient())
plr.World.BuffManager.AddBuff(this.Context.User, this.Target, new DebuffStunned(TickTimer.WaitSeconds(plr.World.Game, 1.5f)));
if (plr.SkillSet.HasPassive(226348) && ElementDamages.ContainsKey(DamageType.Lightning) && ElementDamages[DamageType.Lightning] > 0f) //Paralysis (wizard)
if (AutomaticHitEffects && !plr.World.BuffManager.HasBuff<DebuffStunned>(Target))
if (FastRandom.Instance.NextDouble() < 0.15f * Context.GetProcCoefficient())
plr.World.BuffManager.AddBuff(Context.User, Target, new DebuffStunned(TickTimer.WaitSeconds(plr.World.Game, 1.5f)));
if (plr.SkillSet.HasPassive(218044) && this.ElementDamages.ContainsKey(DamageType.Fire) && this.ElementDamages[DamageType.Fire] > 0f) //Conflagration (wizard)
plr.World.BuffManager.AddBuff(this.Context.User, this.Target, new ArmorReduceDebuff(0.1f, TickTimer.WaitSeconds(plr.World.Game, 3f)));
if (plr.SkillSet.HasPassive(218044) && ElementDamages.ContainsKey(DamageType.Fire) && ElementDamages[DamageType.Fire] > 0f) //Conflagration (wizard)
plr.World.BuffManager.AddBuff(Context.User, Target, new ArmorReduceDebuff(0.1f, TickTimer.WaitSeconds(plr.World.Game, 3f)));
if (plr.SkillSet.HasPassive(226301)) //ColdBlooded (Wizard)
if (this.Target.Attributes[GameAttribute.Frozen] || this.Target.Attributes[GameAttribute.Chilled])
this.TotalDamage *= 1.1f;
if (Target.Attributes[GameAttribute.Frozen] || Target.Attributes[GameAttribute.Chilled])
TotalDamage *= 1.1f;
if (plr.SkillSet.HasPassive(208471)) //GlassCannon (Wizard)
this.TotalDamage *= 1.15f;
TotalDamage *= 1.15f;
if (this.Target.World.BuffManager.HasBuff<EnergyTwister.GaleForceDebuff>(this.Target)) //Wizard -> Gale Force
if (this.DominantDamageType == DamageType.Fire)
this.TotalDamage *= (1f + (this.Target.World.BuffManager.GetFirstBuff<EnergyTwister.GaleForceDebuff>(this.Target).Percentage));
if (Target.World.BuffManager.HasBuff<EnergyTwister.GaleForceDebuff>(Target)) //Wizard -> Gale Force
if (DominantDamageType == DamageType.Fire)
TotalDamage *= (1f + (Target.World.BuffManager.GetFirstBuff<EnergyTwister.GaleForceDebuff>(Target).Percentage));
if (this.Target.World.BuffManager.HasBuff<WizardWaveOfForce.StaticPulseDebuff>(this.Target)) //Wizard -> Static Pulse
if (this.DominantDamageType == DamageType.Lightning)
this.TotalDamage *= (1f + (this.Target.World.BuffManager.GetFirstBuff<WizardWaveOfForce.StaticPulseDebuff>(this.Target).Percentage));
if (Target.World.BuffManager.HasBuff<WizardWaveOfForce.StaticPulseDebuff>(Target)) //Wizard -> Static Pulse
if (DominantDamageType == DamageType.Lightning)
TotalDamage *= (1f + (Target.World.BuffManager.GetFirstBuff<WizardWaveOfForce.StaticPulseDebuff>(Target).Percentage));
if (this.Target.World.BuffManager.HasBuff<WizardRayOfFrost.SnowBlastDebuff>(this.Target)) //Wizard -> Snow Blast
if (this.DominantDamageType == DamageType.Cold)
this.TotalDamage *= (1f + (this.Target.World.BuffManager.GetFirstBuff<WizardRayOfFrost.SnowBlastDebuff>(this.Target).Percentage));
if (Target.World.BuffManager.HasBuff<WizardRayOfFrost.SnowBlastDebuff>(Target)) //Wizard -> Snow Blast
if (DominantDamageType == DamageType.Cold)
TotalDamage *= (1f + (Target.World.BuffManager.GetFirstBuff<WizardRayOfFrost.SnowBlastDebuff>(Target).Percentage));
if (this.Target.World.BuffManager.HasBuff<WizardDisintegrate.IntensifyDebuff>(this.Target)) //Wizard -> Intensify
if (this.DominantDamageType == DamageType.Arcane)
this.TotalDamage *= (1f + (this.Target.World.BuffManager.GetFirstBuff<WizardDisintegrate.IntensifyDebuff>(this.Target).Percentage));
if (Target.World.BuffManager.HasBuff<WizardDisintegrate.IntensifyDebuff>(Target)) //Wizard -> Intensify
if (DominantDamageType == DamageType.Arcane)
TotalDamage *= (1f + (Target.World.BuffManager.GetFirstBuff<WizardDisintegrate.IntensifyDebuff>(Target).Percentage));
if (plr.World.BuffManager.HasBuff<WizardSpectralBlade.FlameBuff>(plr)) //Wizard -> Flame Blades
if (this.DominantDamageType == DamageType.Fire)
this.TotalDamage *= (1f + (plr.World.BuffManager.GetFirstBuff<WizardSpectralBlade.FlameBuff>(plr).StackCount * 0.01f));
if (DominantDamageType == DamageType.Fire)
TotalDamage *= (1f + (plr.World.BuffManager.GetFirstBuff<WizardSpectralBlade.FlameBuff>(plr).StackCount * 0.01f));
if (plr.World.BuffManager.HasBuff<ArcaneOrb.OrbShockBuff>(plr)) //Wizard -> Spark
if (this.DominantDamageType == DamageType.Lightning)
this.TotalDamage *= (1f + (plr.World.BuffManager.GetFirstBuff<ArcaneOrb.OrbShockBuff>(plr).StackCount * 0.02f));
if (DominantDamageType == DamageType.Lightning)
TotalDamage *= (1f + (plr.World.BuffManager.GetFirstBuff<ArcaneOrb.OrbShockBuff>(plr).StackCount * 0.02f));
if (plr.World.BuffManager.HasBuff<WizardWaveOfForce.AttuneBuff>(plr)) //Wizard -> Arcane Attunement
if (this.DominantDamageType == DamageType.Arcane)
this.TotalDamage *= (1f + (plr.World.BuffManager.GetFirstBuff<WizardWaveOfForce.AttuneBuff>(plr).StackCount * 0.04f));
if (DominantDamageType == DamageType.Arcane)
TotalDamage *= (1f + (plr.World.BuffManager.GetFirstBuff<WizardWaveOfForce.AttuneBuff>(plr).StackCount * 0.04f));
if (plr.World.BuffManager.HasBuff<WizardBlackHole.ColdBuff>(plr)) //Wizard -> Absolute Zero
if (this.DominantDamageType == DamageType.Cold)
this.TotalDamage *= (1f + (plr.World.BuffManager.GetFirstBuff<WizardBlackHole.ColdBuff>(plr).StackCount * 0.03f));
if (DominantDamageType == DamageType.Cold)
TotalDamage *= (1f + (plr.World.BuffManager.GetFirstBuff<WizardBlackHole.ColdBuff>(plr).StackCount * 0.03f));
if (plr.World.BuffManager.HasBuff<WizardBlackHole.DamageBuff>(plr)) //Wizard -> SpellSteal
this.TotalDamage *= (1f + (plr.World.BuffManager.GetFirstBuff<WizardBlackHole.DamageBuff>(plr).StackCount * 0.03f));
TotalDamage *= (1f + (plr.World.BuffManager.GetFirstBuff<WizardBlackHole.DamageBuff>(plr).StackCount * 0.03f));
if (plr.World.BuffManager.HasBuff<DynamoBuff>(plr)) //Wizard -> Arcane Dynamo
if (plr.World.BuffManager.GetFirstBuff<DynamoBuff>(plr).StackCount >= 5)
if (this.Context.PowerSNO != 0x00007818 && this.Context.PowerSNO != 0x0000783F &&
this.Context.PowerSNO != 0x0001177C && this.Context.PowerSNO != 0x000006E5) //non-signature
if (Context.PowerSNO != 0x00007818 && Context.PowerSNO != 0x0000783F &&
Context.PowerSNO != 0x0001177C && Context.PowerSNO != 0x000006E5) //non-signature
{
this.TotalDamage *= 1.6f;
TotalDamage *= 1.6f;
plr.World.BuffManager.RemoveBuffs(plr, 208823);
}
if (plr.SkillSet.HasPassive(341540)) //Audacity (Wiz)
if (PowerMath.Distance2D(plr.Position, this.Target.Position) <= 15f)
this.TotalDamage *= 1.15f;
if (PowerMath.Distance2D(plr.Position, Target.Position) <= 15f)
TotalDamage *= 1.15f;
if (plr.SkillSet.HasPassive(342326)) //Elemental Exposure (Wiz)
{
var dmgElement = (int)this.DominantDamageType.HitEffect;
var dmgElement = (int)DominantDamageType.HitEffect;
if (dmgElement == 1 || dmgElement == 2 || dmgElement == 3 || dmgElement == 5)
{
if (this.Target.World.BuffManager.HasBuff<ElementalExposureBuff>(this.Target))
if (Target.World.BuffManager.HasBuff<ElementalExposureBuff>(Target))
{
if (this.Target.World.BuffManager.GetFirstBuff<ElementalExposureBuff>(this.Target).LastDamageType != dmgElement)
if (Target.World.BuffManager.GetFirstBuff<ElementalExposureBuff>(Target).LastDamageType != dmgElement)
{
this.Target.World.BuffManager.AddBuff(plr, this.Target, new ElementalExposureBuff());
this.Target.World.BuffManager.GetFirstBuff<ElementalExposureBuff>(this.Target).LastDamageType = dmgElement;
Target.World.BuffManager.AddBuff(plr, Target, new ElementalExposureBuff());
Target.World.BuffManager.GetFirstBuff<ElementalExposureBuff>(Target).LastDamageType = dmgElement;
}
}
else
{
this.Target.World.BuffManager.AddBuff(plr, this.Target, new ElementalExposureBuff());
this.Target.World.BuffManager.GetFirstBuff<ElementalExposureBuff>(this.Target).LastDamageType = dmgElement;
Target.World.BuffManager.AddBuff(plr, Target, new ElementalExposureBuff());
Target.World.BuffManager.GetFirstBuff<ElementalExposureBuff>(Target).LastDamageType = dmgElement;
}
}
}
@ -368,86 +368,86 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
case ToonClass.Monk:
if (plr.World.BuffManager.HasBuff<MysticAllyPassive.MysticAllyBuff>(plr)) //Monk -> Water Ally
if (plr.World.BuffManager.GetFirstBuff<MysticAllyPassive.MysticAllyBuff>(plr).WaterAlly)
if (!plr.World.BuffManager.HasBuff<DebuffSlowed>(this.Target))
plr.World.BuffManager.AddBuff(this.Context.User, this.Target, new DebuffSlowed(0.8f, TickTimer.WaitSeconds(plr.World.Game, 2f)));
if (!plr.World.BuffManager.HasBuff<DebuffSlowed>(Target))
plr.World.BuffManager.AddBuff(Context.User, Target, new DebuffSlowed(0.8f, TickTimer.WaitSeconds(plr.World.Game, 2f)));
if (this.Target.World.BuffManager.HasBuff<MantraOfConviction.ActiveDeBuff>(this.Target)) //Monk -> Mantra of Conviction Active effect
this.TotalDamage *= (1f + (this.Target.World.BuffManager.GetFirstBuff<MantraOfConviction.ActiveDeBuff>(this.Target).RedAmount));
if (Target.World.BuffManager.HasBuff<MantraOfConviction.ActiveDeBuff>(Target)) //Monk -> Mantra of Conviction Active effect
TotalDamage *= (1f + (Target.World.BuffManager.GetFirstBuff<MantraOfConviction.ActiveDeBuff>(Target).RedAmount));
if (this.Target.World.BuffManager.HasBuff<MantraOfConvictionPassive.DeBuff>(this.Target)) //Monk -> Mantra of Conviction Passive effect
this.TotalDamage *= (1f + (this.Target.World.BuffManager.GetFirstBuff<MantraOfConvictionPassive.DeBuff>(this.Target).RedAmount));
if (Target.World.BuffManager.HasBuff<MantraOfConvictionPassive.DeBuff>(Target)) //Monk -> Mantra of Conviction Passive effect
TotalDamage *= (1f + (Target.World.BuffManager.GetFirstBuff<MantraOfConvictionPassive.DeBuff>(Target).RedAmount));
if (this.Target.World.BuffManager.HasBuff<InnerSanctuary.InnerDebuff>(this.Target)) //Monk -> Forbidden Palace
this.TotalDamage *= (1f + (this.Target.World.BuffManager.GetFirstBuff<InnerSanctuary.InnerDebuff>(this.Target).DamagePercentage));
if (Target.World.BuffManager.HasBuff<InnerSanctuary.InnerDebuff>(Target)) //Monk -> Forbidden Palace
TotalDamage *= (1f + (Target.World.BuffManager.GetFirstBuff<InnerSanctuary.InnerDebuff>(Target).DamagePercentage));
if (plr.SkillSet.HasPassive(211581)) //Resolve (Monk)
if (!plr.World.BuffManager.HasBuff<DamageReduceDebuff>(this.Target))
plr.World.BuffManager.AddBuff(this.Context.User, this.Target, new DamageReduceDebuff(0.20f, TickTimer.WaitSeconds(plr.World.Game, 2.5f)));
if (!plr.World.BuffManager.HasBuff<DamageReduceDebuff>(Target))
plr.World.BuffManager.AddBuff(Context.User, Target, new DamageReduceDebuff(0.20f, TickTimer.WaitSeconds(plr.World.Game, 2.5f)));
break;
case ToonClass.Crusader:
if (plr.SkillSet.HasPassive(310804)) //Crusader -> HolyCause
if (this.IsWeaponDamage)
if (this.DominantDamageType == DamageType.Holy)
if (IsWeaponDamage)
if (DominantDamageType == DamageType.Holy)
plr.AddPercentageHP(1);
if (plr.SkillSet.HasPassive(348773)) //Crusader -> Blunt
if (attackPayload.Context.PowerSNO == 325216 || //Justice
attackPayload.Context.PowerSNO == 266766) //Blessed Hammer
this.TotalDamage *= 1.2f;
TotalDamage *= 1.2f;
if (plr.SkillSet.HasPassive(348741)) //Crusader -> Lord Commander
if (attackPayload.Context.PowerSNO == 330729) //Phalanx
this.TotalDamage *= 1.2f;
TotalDamage *= 1.2f;
if (plr.World.BuffManager.HasBuff<CrusaderAkaratChampion.AkaratBuff>(plr)) //AkaratChampion -> Rally
if (plr.World.BuffManager.GetFirstBuff<CrusaderAkaratChampion.AkaratBuff>(plr).CDRActive)
if (FastRandom.Instance.NextDouble() < 0.5f * this.Context.GetProcCoefficient())
foreach (var cdBuff in plr.World.BuffManager.GetBuffs<PowerSystem.Implementations.CooldownBuff>(plr))
if (FastRandom.Instance.NextDouble() < 0.5f * Context.GetProcCoefficient())
foreach (var cdBuff in plr.World.BuffManager.GetBuffs<CooldownBuff>(plr))
if (!(cdBuff.TargetPowerSNO == 269032)) //do not CDR AkaratChampionBuff
cdBuff.Reduce(60);
break;
}
if (this.Target is Monster)
if (Target is Monster)
{
this.TotalDamage *= 1 + plr.Attributes[GameAttribute.Damage_Percent_Bonus_Vs_Monster_Type, (this.Target as Monster).MonsterType];
TotalDamage *= 1 + plr.Attributes[GameAttribute.Damage_Percent_Bonus_Vs_Monster_Type, (Target as Monster).MonsterType];
if ((this.Target as Monster).Quality > 0)
this.TotalDamage *= 1 + plr.Attributes[GameAttribute.Damage_Percent_Bonus_Vs_Elites];
if ((Target as Monster).Quality > 0)
TotalDamage *= 1 + plr.Attributes[GameAttribute.Damage_Percent_Bonus_Vs_Elites];
if (attackPayload.Targets.Actors.Count == 1 && !(attackPayload.Context is Buff) && attackPayload.AutomaticHitEffects)
{
float procCoeff = this.Context.GetProcCoefficient();
float procCoeff = Context.GetProcCoefficient();
if (FastRandom.Instance.NextDouble() < plr.Attributes[GameAttribute.On_Hit_Fear_Proc_Chance] * procCoeff)
plr.World.BuffManager.AddBuff(plr, this.Target, new DebuffFeared(TickTimer.WaitSeconds(plr.World.Game, 1.5f)));
plr.World.BuffManager.AddBuff(plr, Target, new DebuffFeared(TickTimer.WaitSeconds(plr.World.Game, 1.5f)));
if (FastRandom.Instance.NextDouble() < plr.Attributes[GameAttribute.On_Hit_Stun_Proc_Chance] * procCoeff)
plr.World.BuffManager.AddBuff(plr, this.Target, new DebuffStunned(TickTimer.WaitSeconds(plr.World.Game, 1.5f)));
plr.World.BuffManager.AddBuff(plr, Target, new DebuffStunned(TickTimer.WaitSeconds(plr.World.Game, 1.5f)));
if (FastRandom.Instance.NextDouble() < plr.Attributes[GameAttribute.On_Hit_Blind_Proc_Chance] * procCoeff)
plr.World.BuffManager.AddBuff(plr, this.Target, new DebuffBlind(TickTimer.WaitSeconds(plr.World.Game, 1.5f)));
plr.World.BuffManager.AddBuff(plr, Target, new DebuffBlind(TickTimer.WaitSeconds(plr.World.Game, 1.5f)));
if (FastRandom.Instance.NextDouble() < plr.Attributes[GameAttribute.On_Hit_Freeze_Proc_Chance] * procCoeff)
plr.World.BuffManager.AddBuff(plr, this.Target, new DebuffFrozen(TickTimer.WaitSeconds(plr.World.Game, 1.5f)));
plr.World.BuffManager.AddBuff(plr, Target, new DebuffFrozen(TickTimer.WaitSeconds(plr.World.Game, 1.5f)));
if (FastRandom.Instance.NextDouble() < plr.Attributes[GameAttribute.On_Hit_Chill_Proc_Chance] * procCoeff)
plr.World.BuffManager.AddBuff(plr, this.Target, new DebuffChilled(0.3f, TickTimer.WaitSeconds(plr.World.Game, 2f)));
plr.World.BuffManager.AddBuff(plr, Target, new DebuffChilled(0.3f, TickTimer.WaitSeconds(plr.World.Game, 2f)));
if (FastRandom.Instance.NextDouble() < plr.Attributes[GameAttribute.On_Hit_Slow_Proc_Chance] * procCoeff)
plr.World.BuffManager.AddBuff(plr, this.Target, new DebuffSlowed(0.3f, TickTimer.WaitSeconds(plr.World.Game, 2f)));
plr.World.BuffManager.AddBuff(plr, Target, new DebuffSlowed(0.3f, TickTimer.WaitSeconds(plr.World.Game, 2f)));
if (FastRandom.Instance.NextDouble() < plr.Attributes[GameAttribute.On_Hit_Knockback_Proc_Chance] * procCoeff)
plr.World.BuffManager.AddBuff(plr, this.Target, new KnockbackBuff(3f));
plr.World.BuffManager.AddBuff(plr, Target, new KnockbackBuff(3f));
}
}
}
break;
case Minion:
var mn = this.Context.User as Minion;
this.TotalDamage *= (1 + (mn.PrimaryAttribute / 100f));
this.TotalDamage *= mn.Master.Attributes[GameAttribute.Attacks_Per_Second_Total];
var mn = Context.User as Minion;
TotalDamage *= (1 + (mn.PrimaryAttribute / 100f));
TotalDamage *= mn.Master.Attributes[GameAttribute.Attacks_Per_Second_Total];
if (mn.Master is Player)
{
@ -457,36 +457,36 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
mstr.World.BuffManager.AddBuff(mstr, mstr, new VisionQuestBuff());
if (mn.SNO == ActorSno._dh_companion_spider)
if (!this.Context.Target.World.BuffManager.HasBuff<Companion.SpiderWebbedDebuff>(this.Context.Target))
this.Context.Target.World.BuffManager.AddBuff(this.Context.Target, this.Context.Target, new Companion.SpiderWebbedDebuff());
if (!Context.Target.World.BuffManager.HasBuff<Companion.SpiderWebbedDebuff>(Context.Target))
Context.Target.World.BuffManager.AddBuff(Context.Target, Context.Target, new Companion.SpiderWebbedDebuff());
if (this.Context.Target.World.BuffManager.HasBuff<Fragile.Rune_D_Buff>(this.Context.Target))
this.TotalDamage *= 1.15f;
if (Context.Target.World.BuffManager.HasBuff<Fragile.Rune_D_Buff>(Context.Target))
TotalDamage *= 1.15f;
}
break;
}
if (this.Target is Player) //check for passives here (incoming damage)
if (Target is Player) //check for passives here (incoming damage)
{
var plr = this.Target as Player;
var plr = Target as Player;
if (!plr.Attributes[GameAttribute.Cannot_Dodge] && FastRandom.Instance.NextDouble() < plr.DodgeChance)
this.IsDodged = true;
IsDodged = true;
if (plr.Toon.Class == ToonClass.Monk) //Monk defensive passives
{
this.TotalDamage *= 0.7f; //Class damage reduction bonus
TotalDamage *= 0.7f; //Class damage reduction bonus
if (plr.World.BuffManager.HasBuff<TempestRush.TempestEffect>(plr)) //Tempest rush -> Slipstream
if (plr.World.BuffManager.GetFirstBuff<TempestRush.TempestEffect>(plr)._slipStream)
this.TotalDamage *= 0.8f;
TotalDamage *= 0.8f;
if (plr.World.BuffManager.HasBuff<Epiphany.EpiphanyBuff>(plr)) //Epiphany -> Desert Shroud
if (plr.World.BuffManager.GetFirstBuff<Epiphany.EpiphanyBuff>(plr).DesertShroud)
this.TotalDamage *= 0.5f;
TotalDamage *= 0.5f;
if (this.IsDodged) //Mantra of Evasion -> Backlash
if (IsDodged) //Mantra of Evasion -> Backlash
if (plr.World.BuffManager.HasBuff<MantraOfEvasionPassive.MantraOfEvasionBuff>(plr))
if (plr.World.BuffManager.GetFirstBuff<MantraOfEvasionPassive.MantraOfEvasionBuff>(plr).Backlash)
plr.World.BuffManager.GetFirstBuff<MantraOfEvasionPassive.MantraOfEvasionBuff>(plr).BacklashTrigger = true;
@ -494,37 +494,37 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
if (plr.Toon.Class == ToonClass.Barbarian) //Barb defensive passives
{
this.TotalDamage *= 0.7f; //Class damage reduction bonus
TotalDamage *= 0.7f; //Class damage reduction bonus
if (plr.SkillSet.HasPassive(205491) && PowerMath.Distance2D(this.Context.User.Position, plr.Position) > 6f) //Superstition (barbarian)
if (FastRandom.Instance.NextDouble() < this.Context.GetProcCoefficient())
if (plr.SkillSet.HasPassive(205491) && PowerMath.Distance2D(Context.User.Position, plr.Position) > 6f) //Superstition (barbarian)
if (FastRandom.Instance.NextDouble() < Context.GetProcCoefficient())
plr.GeneratePrimaryResource(2f);
if (plr.SkillSet.HasPassive(205398) && (plr.Attributes[GameAttribute.Hitpoints_Cur] - this.TotalDamage) < (plr.Attributes[GameAttribute.Hitpoints_Max_Total] * 0.2f)) //Relentless (barbarian)
this.TotalDamage *= 0.5f;
if (plr.SkillSet.HasPassive(205398) && (plr.Attributes[GameAttribute.Hitpoints_Cur] - TotalDamage) < (plr.Attributes[GameAttribute.Hitpoints_Max_Total] * 0.2f)) //Relentless (barbarian)
TotalDamage *= 0.5f;
}
if (plr.Toon.Class == ToonClass.Wizard) //Wizard defensive passives
{
if (plr.SkillSet.HasPassive(208471)) //GlassCannon (Wizard)
this.TotalDamage *= 1.1f;
TotalDamage *= 1.1f;
if (plr.SkillSet.HasPassive(208547) && this.TotalDamage > (plr.Attributes[GameAttribute.Hitpoints_Max_Total] * 0.15f)) //Illusionist (Wizard)
if (plr.SkillSet.HasPassive(208547) && TotalDamage > (plr.Attributes[GameAttribute.Hitpoints_Max_Total] * 0.15f)) //Illusionist (Wizard)
{
foreach (var cdBuff in plr.World.BuffManager.GetBuffs<PowerSystem.Implementations.CooldownBuff>(plr))
foreach (var cdBuff in plr.World.BuffManager.GetBuffs<CooldownBuff>(plr))
if (cdBuff.TargetPowerSNO == 1769 || cdBuff.TargetPowerSNO == 168344)
cdBuff.Remove();
}
if (plr.SkillSet.HasPassive(208474) && (plr.Attributes[GameAttribute.Hitpoints_Cur] - this.TotalDamage) <= 0) //UnstableAnomaly (wizard)
if (plr.SkillSet.HasPassive(208474) && (plr.Attributes[GameAttribute.Hitpoints_Cur] - TotalDamage) <= 0) //UnstableAnomaly (wizard)
{
if (plr.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.UnstableAnomalyCooldownBuff>(plr) == null)
if (plr.World.BuffManager.GetFirstBuff<UnstableAnomalyCooldownBuff>(plr) == null)
{
plr.AddPercentageHP(45);
plr.World.BuffManager.AddBuff(plr, plr, new UnstableAnomalyCooldownBuff());
plr.World.PowerManager.RunPower(plr, 30796);
plr.GenerateSecondaryResource(25f);
foreach (var cdBuff in plr.World.BuffManager.GetBuffs<PowerSystem.Implementations.CooldownBuff>(plr))
foreach (var cdBuff in plr.World.BuffManager.GetBuffs<CooldownBuff>(plr))
if (cdBuff.TargetPowerSNO == 30796)
cdBuff.Remove();
}
@ -534,26 +534,26 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
if (plr.Toon.Class == ToonClass.WitchDoctor) //Witch Doctor defensive passives
{
if (plr.SkillSet.HasPassive(217968)) //JungleFortitude (WD)
this.TotalDamage *= 0.85f;
TotalDamage *= 0.85f;
}
if (plr.Toon.Class == ToonClass.DemonHunter) //DH defensive passives
{
if (plr.SkillSet.HasPassive(210801) && plr.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.BroodingCooldownBuff>(plr) == null) //Brooding (DH)
if (plr.SkillSet.HasPassive(210801) && plr.World.BuffManager.GetFirstBuff<BroodingCooldownBuff>(plr) == null) //Brooding (DH)
plr.World.BuffManager.AddBuff(plr, plr, new BroodingCooldownBuff());
}
if (plr.Toon.Class == ToonClass.Crusader) //Crusader defensive passives
{
this.TotalDamage *= 0.7f; //Class damage reduction bonus
TotalDamage *= 0.7f; //Class damage reduction bonus
if (plr.SkillSet.HasPassive(310626)) //Vigilant
if (!(this.DominantDamageType == DamageType.Physical))
this.TotalDamage *= 0.95f;
if (!(DominantDamageType == DamageType.Physical))
TotalDamage *= 0.95f;
if (plr.World.BuffManager.HasBuff<CrusaderAkaratChampion.AkaratBuff>(plr)) //AkaratChampion resurrect once
if (plr.World.BuffManager.GetFirstBuff<CrusaderAkaratChampion.AkaratBuff>(plr).resurrectActive)
if ((plr.Attributes[GameAttribute.Hitpoints_Cur] - this.TotalDamage) <= 0)
if ((plr.Attributes[GameAttribute.Hitpoints_Cur] - TotalDamage) <= 0)
{
plr.World.BuffManager.GetFirstBuff<CrusaderAkaratChampion.AkaratBuff>(plr).resurrectActive = false;
plr.AddPercentageHP(100);
@ -562,14 +562,14 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
if (plr.World.BuffManager.HasBuff<CrusaderLawsOfJustice.LawsResBuff>(plr)) //Protect the Innocent
if (!plr.World.BuffManager.GetFirstBuff<CrusaderLawsOfJustice.LawsResBuff>(plr).Primary)
if (plr.World.BuffManager.GetFirstBuff<CrusaderLawsOfJustice.LawsResBuff>(plr).Redirect)
this.TotalDamage *= 0.8f;
TotalDamage *= 0.8f;
}
this.TotalDamage *= 0.1f;
TotalDamage *= 0.1f;
}
else if (this.Target is Minion) //check for passives here (incoming damage, minions)
else if (Target is Minion) //check for passives here (incoming damage, minions)
{
var minion = this.Target as Minion;
var minion = Target as Minion;
if (minion.Master != null && minion.Master is Player)
{
var plr = minion.Master as Player;
@ -577,12 +577,12 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
var masterArmor = plr.Attributes[GameAttribute.Armor_Total];
var attackLevel = attackPayload.Context.User.Attributes[GameAttribute.Level];
this.TotalDamage *= HitPayload.ReductionFromArmor(masterArmor, attackLevel);
TotalDamage *= ReductionFromArmor(masterArmor, attackLevel);
if (plr.SkillSet.HasPassive(217968)) //JungleFortitude (WD)
this.TotalDamage *= 0.85f;
TotalDamage *= 0.85f;
this.TotalDamage *= 0.1f; //hack for unkillable minions
TotalDamage *= 0.1f; //hack for unkillable minions
}
}
}
@ -611,24 +611,24 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
public void Apply()
{
if (this.Target == null) return;
if (Target == null) return;
if (!this.Target.World.Game.Working) return;
if (!Target.World.Game.Working) return;
if (this.Target.World.Game.Paused) return;
if (Target.World.Game.Paused) return;
if (!this.Target.Visible)
if (!Target.Visible)
return;
if ((this.Target.Attributes[GameAttribute.Invulnerable] == true || this.Target.Attributes[GameAttribute.Immunity] == true) && this.Target.World != null)
if ((Target.Attributes[GameAttribute.Invulnerable] == true || Target.Attributes[GameAttribute.Immunity] == true) && Target.World != null)
{
if (!(this.Target is Minion))
this.Target.World.BroadcastIfRevealed(plr => new FloatingNumberMessage()
if (!(Target is Minion))
Target.World.BroadcastIfRevealed(plr => new FloatingNumberMessage()
{
ActorID = this.Target.DynamicID(plr),
ActorID = Target.DynamicID(plr),
Number = 0f,
Type = FloatingNumberMessage.FloatType.Immune
}, this.Target);
}, Target);
return;
}
if (new System.Diagnostics.StackTrace().FrameCount > 35) // some arbitrary limit
@ -637,19 +637,19 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
return;
}
if (this.Target is Player)
if (Target is Player)
{
var plr = (this.Target as Player);
var plr = (Target as Player);
if (plr.Dead) return;
if (this.IsDodged)
if (IsDodged)
{
this.Target.World.BroadcastIfRevealed(plr => new FloatingNumberMessage()
Target.World.BroadcastIfRevealed(plr => new FloatingNumberMessage()
{
ActorID = this.Target.DynamicID(plr),
ActorID = Target.DynamicID(plr),
Number = 0f,
Type = FloatingNumberMessage.FloatType.Dodge
}, this.Target);
}, Target);
plr.DodgesInARow++;
if (plr.Toon.Class == ToonClass.Monk && plr.DodgesInARow >= 15)
{
@ -672,18 +672,18 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
plr.DodgesInARow = 0;
}
if (FastRandom.Instance.NextDouble() < this.Target.Attributes[GameAttribute.Block_Chance_Capped_Total])
if (FastRandom.Instance.NextDouble() < Target.Attributes[GameAttribute.Block_Chance_Capped_Total])
{
this.TotalDamage -= (float)FastRandom.Instance.NextDouble((double)this.Target.Attributes[GameAttribute.Block_Amount_Total_Min], (double)this.Target.Attributes[GameAttribute.Block_Amount_Total_Max]);
if (this.TotalDamage < 0f) this.TotalDamage = 0f;
this.Target.World.BroadcastIfRevealed(plr => new FloatingNumberMessage()
TotalDamage -= (float)FastRandom.Instance.NextDouble((double)Target.Attributes[GameAttribute.Block_Amount_Total_Min], (double)Target.Attributes[GameAttribute.Block_Amount_Total_Max]);
if (TotalDamage < 0f) TotalDamage = 0f;
Target.World.BroadcastIfRevealed(plr => new FloatingNumberMessage()
{
ActorID = this.Target.DynamicID(plr),
Number = this.TotalDamage,
ActorID = Target.DynamicID(plr),
Number = TotalDamage,
Type = FloatingNumberMessage.FloatType.Block
}, this.Target);
}, Target);
this.Blocked = true;
Blocked = true;
plr.BlocksInARow++;
if (plr.Toon.Class == ToonClass.Barbarian)
{
@ -699,86 +699,86 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
plr.BlocksInARow = 0;
}
}
if (this.Target is DesctructibleLootContainer)
if (Target is DesctructibleLootContainer)
{
(this.Target as DesctructibleLootContainer).ReceiveDamage(this.Target, 100);
if (this.Context.PowerSNO == 96296)
(this.Context.User as Player).AddAchievementCounter(74987243307049, 1);
(Target as DesctructibleLootContainer).ReceiveDamage(Target, 100);
if (Context.PowerSNO == 96296)
(Context.User as Player).AddAchievementCounter(74987243307049, 1);
return;
}
if (this.Target.World != null)
this.Target.World.BuffManager.SendTargetPayload(this.Target, this);
if (this.Context.User != null)
this.Target.World.BuffManager.SendTargetPayload(this.Context.User, this);
if (Target.World != null)
Target.World.BuffManager.SendTargetPayload(Target, this);
if (Context.User != null)
Target.World.BuffManager.SendTargetPayload(Context.User, this);
if (this.Target == null || this.Target.World == null) return; //in case Target was killed in OnPayload
if (Target == null || Target.World == null) return; //in case Target was killed in OnPayload
if (this.Context.User is Player)
if (Context.User is Player)
{
this.CheckItemProcs(this.Context.User as Player);
if (this.Context.User.Attributes[GameAttribute.Steal_Health_Percent] > 0)
(this.Context.User as Player).AddHP(this.TotalDamage * this.Context.User.Attributes[GameAttribute.Steal_Health_Percent]);
if (this.Context.User.Attributes[GameAttribute.Hitpoints_On_Hit] > 0)
(this.Context.User as Player).AddHP(this.Context.User.Attributes[GameAttribute.Hitpoints_On_Hit]);
if (this.IsCriticalHit)
if ((this.Context.User as Player).Toon.Class == ToonClass.Wizard)
if (FastRandom.Instance.NextDouble() < this.Context.GetProcCoefficient())
(this.Context.User as Player).GeneratePrimaryResource(this.Context.User.Attributes[GameAttribute.Resource_On_Hit, 1]);
CheckItemProcs(Context.User as Player);
if (Context.User.Attributes[GameAttribute.Steal_Health_Percent] > 0)
(Context.User as Player).AddHP(TotalDamage * Context.User.Attributes[GameAttribute.Steal_Health_Percent]);
if (Context.User.Attributes[GameAttribute.Hitpoints_On_Hit] > 0)
(Context.User as Player).AddHP(Context.User.Attributes[GameAttribute.Hitpoints_On_Hit]);
if (IsCriticalHit)
if ((Context.User as Player).Toon.Class == ToonClass.Wizard)
if (FastRandom.Instance.NextDouble() < Context.GetProcCoefficient())
(Context.User as Player).GeneratePrimaryResource(Context.User.Attributes[GameAttribute.Resource_On_Hit, 1]);
}
if (this.Context.User is Hireling)
if (Context.User is Hireling)
{
if (this.Context.User.Attributes[GameAttribute.Steal_Health_Percent] > 0)
(this.Context.User as Hireling).AddHP(this.TotalDamage * this.Context.User.Attributes[GameAttribute.Steal_Health_Percent]);
if (this.Context.User.Attributes[GameAttribute.Hitpoints_On_Hit] > 0)
(this.Context.User as Hireling).AddHP(this.Context.User.Attributes[GameAttribute.Hitpoints_On_Hit]);
if (Context.User.Attributes[GameAttribute.Steal_Health_Percent] > 0)
(Context.User as Hireling).AddHP(TotalDamage * Context.User.Attributes[GameAttribute.Steal_Health_Percent]);
if (Context.User.Attributes[GameAttribute.Hitpoints_On_Hit] > 0)
(Context.User as Hireling).AddHP(Context.User.Attributes[GameAttribute.Hitpoints_On_Hit]);
}
// floating damage number
if (this.Target.World != null)
if (Target.World != null)
{
this.Target.World.BroadcastIfRevealed(plr => new FloatingNumberMessage
Target.World.BroadcastIfRevealed(plr => new FloatingNumberMessage
{
ActorID = this.Target.DynamicID(plr),
Number = this.TotalDamage,
ActorID = Target.DynamicID(plr),
Number = TotalDamage,
// make player damage red, all other damage white
Type = this.IsCriticalHit ?
(this.Target is Player) ? FloatingNumberMessage.FloatType.RedCritical : FloatingNumberMessage.FloatType.Golden
Type = IsCriticalHit ?
(Target is Player) ? FloatingNumberMessage.FloatType.RedCritical : FloatingNumberMessage.FloatType.Golden
:
(this.Target is Player) ? FloatingNumberMessage.FloatType.Red : FloatingNumberMessage.FloatType.White
}, this.Target);
(Target is Player) ? FloatingNumberMessage.FloatType.Red : FloatingNumberMessage.FloatType.White
}, Target);
}
if (this.AutomaticHitEffects)
if (AutomaticHitEffects)
{
// play override hit effect it power context has one
if (this.Context.EvalTag(PowerKeys.OverrideHitEffects) > 0)
if (Context.EvalTag(PowerKeys.OverrideHitEffects) > 0)
{
int efg = this.Context.EvalTag(PowerKeys.HitEffect);
int efg = Context.EvalTag(PowerKeys.HitEffect);
if (efg != -1)
this.Target.PlayEffectGroup(efg);
Target.PlayEffectGroup(efg);
}
else
{
this.Target.PlayHitEffect((int)this.DominantDamageType.HitEffect, this.Context.User);
Target.PlayHitEffect((int)DominantDamageType.HitEffect, Context.User);
}
if (this.TotalDamage > 0f)
if (TotalDamage > 0f)
{
// play override hitsound if any, otherwise just default to playing metal weapon hit for now
int overridenSound = this.Context.EvalTag(PowerKeys.HitsoundOverride);
int overridenSound = Context.EvalTag(PowerKeys.HitsoundOverride);
int hitsound = overridenSound != -1 ? overridenSound : 1;
if (hitsound > 0)
this.Target.PlayEffect(Effect.Hit, hitsound);
Target.PlayEffect(Effect.Hit, hitsound);
}
}
// update hp
float new_hp = Math.Max(this.Target.Attributes[GameAttribute.Hitpoints_Cur] - this.TotalDamage, 0f);
this.Target.Attributes[GameAttribute.Hitpoints_Cur] = new_hp;
this.Target.Attributes.BroadcastChangedIfRevealed();
float new_hp = Math.Max(Target.Attributes[GameAttribute.Hitpoints_Cur] - TotalDamage, 0f);
Target.Attributes[GameAttribute.Hitpoints_Cur] = new_hp;
Target.Attributes.BroadcastChangedIfRevealed();
//thorns
//not working for some reason
@ -800,45 +800,45 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
// if hp=0 do death
if (new_hp <= 0f)
{
var deathload = new DeathPayload(this.Context, this.DominantDamageType, this.Target, this.Target.HasLoot);
deathload.AutomaticHitEffects = this.AutomaticHitEffects;
var deathload = new DeathPayload(Context, DominantDamageType, Target, Target.HasLoot);
deathload.AutomaticHitEffects = AutomaticHitEffects;
if (deathload.Successful)
{
this.Target.Dead = true;
Target.Dead = true;
try
{
if (OnDeath != null && this.AutomaticHitEffects)
if (OnDeath != null && AutomaticHitEffects)
OnDeath(deathload);
}
catch { }
deathload.Apply();
}
}
else if (this.AutomaticHitEffects && this.Target.World != null && !(this.Target is Player))
else if (AutomaticHitEffects && Target.World != null && !(Target is Player))
{
// target didn't die, so play hit animation if the actor has one
if (this.Target.World.BuffManager.GetFirstBuff<Implementations.KnockbackBuff>(this.Target) == null &&
this.Target.AnimationSet != null)
if (Target.World.BuffManager.GetFirstBuff<KnockbackBuff>(Target) == null &&
Target.AnimationSet != null)
{
if (this.Target.AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.GetHit) && FastRandom.Instance.Next(100) < 33)
if (Target.AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.GetHit) && FastRandom.Instance.Next(100) < 33)
{
int hitAni = this.Target.AnimationSet.TagMapAnimDefault[AnimationSetKeys.GetHit];
int hitAni = Target.AnimationSet.TagMapAnimDefault[AnimationSetKeys.GetHit];
if (hitAni != -1)
{
// HACK: hardcoded animation speed/ticks, need to base those off hit recovery speed
this.Target.PlayAnimation(6, hitAni, 1.0f, 40);
foreach (var plr in this.Target.World.Players.Values)
Target.PlayAnimation(6, hitAni, 1.0f, 40);
foreach (var plr in Target.World.Players.Values)
{
if (this.Target.IsRevealedToPlayer(plr))
if (Target.IsRevealedToPlayer(plr))
{
float BackSpeed = this.Target.WalkSpeed;
this.Target.WalkSpeed = 0f;
TickerSystem.TickTimer Timeout = new TickerSystem.SecondsTickTimer(this.Target.World.Game, 0.3f);
var Boom = System.Threading.Tasks.Task<bool>.Factory.StartNew(() => WaitTo(Timeout));
float BackSpeed = Target.WalkSpeed;
Target.WalkSpeed = 0f;
TickTimer Timeout = new SecondsTickTimer(Target.World.Game, 0.3f);
var Boom = Task<bool>.Factory.StartNew(() => WaitTo(Timeout));
Boom.ContinueWith(delegate
{
this.Target.WalkSpeed = BackSpeed;
Target.WalkSpeed = BackSpeed;
});
}
}

View File

@ -12,8 +12,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
public Payload(PowerContext context, Actor target)
{
this.Context = context;
this.Target = target;
Context = context;
Target = target;
}
}
}

View File

@ -380,10 +380,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
public float ScriptFormula(int index)
{
float result;
if (!ScriptFormulaEvaluator.Evaluate(this.PowerSNO, PowerTagHelper.GenerateTagForScriptFormula(index),
if (!ScriptFormulaEvaluator.Evaluate(PowerSNO, PowerTagHelper.GenerateTagForScriptFormula(index),
User.Attributes, Rand, out result))
{
Logger.Warn("Not Found ScriptFormula({0}) for power {1}", index, this.PowerSNO);
Logger.Warn("Not Found ScriptFormula({0}) for power {1}", index, PowerSNO);
return 0;
}
@ -420,7 +420,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
public float EvalTag(TagKeyScript key)
{
float result;
if (!ScriptFormulaEvaluator.Evaluate(this.PowerSNO, key,
if (!ScriptFormulaEvaluator.Evaluate(PowerSNO, key,
User.Attributes, Rand, out result))
return 0;

View File

@ -88,7 +88,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
if (user.Attributes[GameAttribute.Disabled] == true) return false;
if (user is Player && targetPosition != null)
this.CheckItemProcs(user as Player);
CheckItemProcs(user as Player);
//break stun if possible
if (PowerTagHelper.FindTagMapWithKey(power.PowerSNO, PowerKeys.BreaksStun) != null)
@ -284,7 +284,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
{
_deletingActors.Add(actor, new SecondsTickTimer(actor.World.Game, 10f));
}
catch (System.ArgumentException) { }
catch (ArgumentException) { }
}
public bool IsDeletingActor(Actor actor)

View File

@ -67,32 +67,32 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
//this.Field2 = 0x0;
//this.Field7 = -1; // TODO: test if this is necessary
this.Field2 = 0x8;
this.Field7 = -1;
this.GBHandle.Type = (int)ActorType.Projectile; this.GBHandle.GBID = -1;
Field2 = 0x8;
Field7 = -1;
GBHandle.Type = (int)ActorType.Projectile; GBHandle.GBID = -1;
this.CollFlags = 0;
CollFlags = 0;
if (this.Scale == 0f)
this.Scale = 1.00f;
if (Scale == 0f)
Scale = 1.00f;
this.Context = context;
this.Position = new Vector3D(position);
Context = context;
Position = new Vector3D(position);
// offset position by mpq collision data
this.Position.Z += this.ActorData.Cylinder.Ax1 - this.ActorData.Cylinder.Position.Z;
Position.Z += ActorData.Cylinder.Ax1 - ActorData.Cylinder.Position.Z;
// 2 second default timeout for projectiles
this.Timeout = new SecondsTickTimer(context.World.Game, 3f);
Timeout = new SecondsTickTimer(context.World.Game, 3f);
// copy in important effect params from user
this.Attributes[GameAttribute.Rune_A, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_A, context.PowerSNO];
this.Attributes[GameAttribute.Rune_B, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_B, context.PowerSNO];
this.Attributes[GameAttribute.Rune_C, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_C, context.PowerSNO];
this.Attributes[GameAttribute.Rune_D, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_D, context.PowerSNO];
this.Attributes[GameAttribute.Rune_E, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_E, context.PowerSNO];
Attributes[GameAttribute.Rune_A, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_A, context.PowerSNO];
Attributes[GameAttribute.Rune_B, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_B, context.PowerSNO];
Attributes[GameAttribute.Rune_C, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_C, context.PowerSNO];
Attributes[GameAttribute.Rune_D, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_D, context.PowerSNO];
Attributes[GameAttribute.Rune_E, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_E, context.PowerSNO];
if (this.Context.User.Attributes[GameAttribute.Displays_Team_Effect] == true)
this.Attributes[GameAttribute.Displays_Team_Effect] = true;
if (Context.User.Attributes[GameAttribute.Displays_Team_Effect] == true)
Attributes[GameAttribute.Displays_Team_Effect] = true;
_prevUpdatePosition = null;
_launchPosition = null;
@ -105,33 +105,33 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
_onArrivalCalled = false;
OnArrival = AArrival;
_prevUpdatePosition = this.Position;
_launchPosition = this.Position;
_prevUpdatePosition = Position;
_launchPosition = Position;
this.Attributes[GameAttribute.Projectile_Speed] = speed * 0.75f;
Attributes[GameAttribute.Projectile_Speed] = speed * 0.75f;
this.TranslateFacing(targetPosition, true);
TranslateFacing(targetPosition, true);
targetPosition = new Vector3D(targetPosition);
//targetPosition.Z = this.Context.User.Position.Z + 5f + this.ActorData.Cylinder.Ax1 - this.ActorData.Cylinder.Position.Z;
targetPosition.Z += this.ActorData.Cylinder.Ax1 - this.ActorData.Cylinder.Position.Z;
targetPosition.Z += ActorData.Cylinder.Ax1 - ActorData.Cylinder.Position.Z;
if (this.Attributes[GameAttribute.Projectile_Speed] <= 0)
if (Attributes[GameAttribute.Projectile_Speed] <= 0)
{
this.Destroy();
Destroy();
return;
}
this.Attributes[GameAttribute.DestroyWhenPathBlocked] = true;
Attributes[GameAttribute.DestroyWhenPathBlocked] = true;
if (!_spawned)
{
this.EnterWorld(this.Position);
EnterWorld(Position);
_spawned = true;
}
_lastSpeed = this.Attributes[GameAttribute.Projectile_Speed];
_lastSpeed = Attributes[GameAttribute.Projectile_Speed];
_mover.MoveFixed(targetPosition, this.Attributes[GameAttribute.Projectile_Speed], new MessageSystem.Message.Definitions.ACD.ACDTranslateFixedMessage
_mover.MoveFixed(targetPosition, Attributes[GameAttribute.Projectile_Speed], new MessageSystem.Message.Definitions.ACD.ACDTranslateFixedMessage
{
MoveFlags = 0x7fffffff,
AnimationTag = AnimationSetKeys.IdleDefault.ID,
@ -144,34 +144,34 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
public void Launch(Vector3D targetPosition, float speed)
{
_onArrivalCalled = false;
_prevUpdatePosition = this.Position;
_launchPosition = this.Position;
_prevUpdatePosition = Position;
_launchPosition = Position;
this.Attributes[GameAttribute.Projectile_Speed] = speed * 0.75f;
Attributes[GameAttribute.Projectile_Speed] = speed * 0.75f;
this.TranslateFacing(targetPosition, true);
TranslateFacing(targetPosition, true);
targetPosition = new Vector3D(targetPosition);
//targetPosition.Z = this.Context.User.Position.Z + 5f + this.ActorData.Cylinder.Ax1 - this.ActorData.Cylinder.Position.Z;
targetPosition.Z += this.ActorData.Cylinder.Ax1 - this.ActorData.Cylinder.Position.Z;
targetPosition.Z += ActorData.Cylinder.Ax1 - ActorData.Cylinder.Position.Z;
if (this.Attributes[GameAttribute.Projectile_Speed] <= 0)
if (Attributes[GameAttribute.Projectile_Speed] <= 0)
{
this.Destroy();
Destroy();
return;
}
this.Attributes[GameAttribute.DestroyWhenPathBlocked] = true;
Attributes[GameAttribute.DestroyWhenPathBlocked] = true;
if (!_spawned)
{
this.EnterWorld(this.Position);
EnterWorld(Position);
_spawned = true;
}
_lastSpeed = this.Attributes[GameAttribute.Projectile_Speed];
_lastSpeed = Attributes[GameAttribute.Projectile_Speed];
_mover.MoveFixed(targetPosition, this.Attributes[GameAttribute.Projectile_Speed], new MessageSystem.Message.Definitions.ACD.ACDTranslateFixedMessage
_mover.MoveFixed(targetPosition, Attributes[GameAttribute.Projectile_Speed], new MessageSystem.Message.Definitions.ACD.ACDTranslateFixedMessage
{
MoveFlags = 0x7fffffff,
AnimationTag = AnimationSetKeys.IdleDefault.ID,
@ -183,34 +183,34 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
public void LaunchCircle(Vector3D centerPosition, float radius, float speed, float duration)
{
this.Position.X += radius;
Position.X += radius;
_onArrivalCalled = false;
_prevUpdatePosition = this.Position;
_launchPosition = this.Position;
_prevUpdatePosition = Position;
_launchPosition = Position;
this.Attributes[GameAttribute.Projectile_Speed] = speed;
Attributes[GameAttribute.Projectile_Speed] = speed;
//targetPosition = new Vector3D(targetPosition);
//targetPosition.Z = this.Context.User.Position.Z + 5f + this.ActorData.Cylinder.Ax1 - this.ActorData.Cylinder.Position.Z;
//targetPosition.Z += this.ActorData.Cylinder.Ax1 - this.ActorData.Cylinder.Position.Z;
if (this.Attributes[GameAttribute.Projectile_Speed] <= 0)
if (Attributes[GameAttribute.Projectile_Speed] <= 0)
{
this.Destroy();
Destroy();
return;
}
this.Attributes[GameAttribute.DestroyWhenPathBlocked] = false;
Attributes[GameAttribute.DestroyWhenPathBlocked] = false;
if (!_spawned)
{
this.EnterWorld(this.Position);
EnterWorld(Position);
_spawned = true;
}
_lastSpeed = this.Attributes[GameAttribute.Projectile_Speed];
_lastSpeed = Attributes[GameAttribute.Projectile_Speed];
_mover.MoveCircle(centerPosition, radius, this.Attributes[GameAttribute.Projectile_Speed], duration, new MessageSystem.Message.Definitions.ACD.ACDTranslateDetPathSpiralMessage
_mover.MoveCircle(centerPosition, radius, Attributes[GameAttribute.Projectile_Speed], duration, new MessageSystem.Message.Definitions.ACD.ACDTranslateDetPathSpiralMessage
{
AnimTag = AnimationSetKeys.IdleDefault.ID
});
@ -221,13 +221,13 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
public void LaunchArc(Vector3D destination, float arcHeight, float arcGravity, float visualBounce = 0f)
{
_onArrivalCalled = false;
_prevUpdatePosition = this.Position;
_launchPosition = this.Position;
_prevUpdatePosition = Position;
_launchPosition = Position;
this.TranslateFacing(destination, true);
TranslateFacing(destination, true);
if (!_spawned)
{
this.EnterWorld(this.Position);
EnterWorld(Position);
_spawned = true;
}
@ -236,90 +236,90 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
Field3 = 0x00800000,
FlyingAnimationTagID = AnimationSetKeys.IdleDefault.ID,
LandingAnimationTagID = -1,
PowerSNO = this.Context.PowerSNO,
PowerSNO = Context.PowerSNO,
Bounce = visualBounce
});
}
public void LaunchChain(Actor Caster, Vector3D TargetPos, Action<Actor, int> OnTargetHit, float Speed = 1f, int numTargets = 0, float ChainRadius = 10f)
{
this.Position.Z += 5f; // fix height
this.ChainCurrent = Caster;
this.ChainTargetsRemain = numTargets;
Position.Z += 5f; // fix height
ChainCurrent = Caster;
ChainTargetsRemain = numTargets;
this.OnCollision = (hit) =>
OnCollision = (hit) =>
{
if (hit == this.ChainCurrent) return;
else this.ChainCurrent = hit;
if (hit == ChainCurrent) return;
else ChainCurrent = hit;
OnTargetHit(this.ChainCurrent, this.ChainIteration);
OnTargetHit(ChainCurrent, ChainIteration);
this.ChainTargetsRemain--;
if (this.ChainTargetsRemain <= 0)
ChainTargetsRemain--;
if (ChainTargetsRemain <= 0)
{
this.Destroy();
Destroy();
return;
}
if (this.ChainCurrent == null)
if (ChainCurrent == null)
{
this.Destroy();
Destroy();
return;
}
var targets = this.Context.GetEnemiesInRadius(this.ChainCurrent.Position, ChainRadius);
targets.Actors.Remove(this.ChainCurrent);
var targets = Context.GetEnemiesInRadius(ChainCurrent.Position, ChainRadius);
targets.Actors.Remove(ChainCurrent);
if (targets.Actors.Count() == 0)
{
this.Destroy();
Destroy();
return;
}
var nextProj = new Projectile(this.Context, this.SNO, this.ChainCurrent.Position);
var nextProj = new Projectile(Context, SNO, ChainCurrent.Position);
nextProj.Position.Z += 5f;
nextProj.ChainCurrent = this.ChainCurrent;
nextProj.ChainCurrent = ChainCurrent;
nextProj.ChainNextPos = targets.Actors[PowerContext.Rand.Next(targets.Actors.Count())].Position;
nextProj.ChainTargetsRemain = this.ChainTargetsRemain;
nextProj.ChainIteration = this.ChainIteration + 1;
nextProj.ChainTargetsRemain = ChainTargetsRemain;
nextProj.ChainIteration = ChainIteration + 1;
nextProj.OnCollision = this.OnCollision;
this.Destroy();
nextProj.OnCollision = OnCollision;
Destroy();
nextProj.Launch(nextProj.ChainNextPos, Speed);
};
this.Launch(TargetPos, Speed);
Launch(TargetPos, Speed);
}
private void _CheckCollisions()
{
if (OnCollision == null) return;
if (this.World != this.Context.User.World)
if (World != Context.User.World)
{
this.Destroy();
Destroy();
return;
}
if (MovementHelpers.GetDistance(_launchPosition, _prevUpdatePosition) >= 60.0f)
{
this.Destroy();
Destroy();
return;
}
if (!(this.World.CheckLocationForFlag(_prevUpdatePosition, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk) || this.World.CheckLocationForFlag(_prevUpdatePosition, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowProjectile)))
if (!(World.CheckLocationForFlag(_prevUpdatePosition, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk) || World.CheckLocationForFlag(_prevUpdatePosition, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowProjectile)))
{
this.Destroy();
Destroy();
return;
}
// check if we collided with anything since last update
float radius = this.ActorData.Cylinder.Ax2 * RadiusMod;
float radius = ActorData.Cylinder.Ax2 * RadiusMod;
Circle startCircle = new Circle(_prevUpdatePosition.X, _prevUpdatePosition.Y, radius);
// make a velocity representing the change to the current position
Vector2F velocity = PowerMath.VectorWithoutZ(this.Position - _prevUpdatePosition);
Vector2F velocity = PowerMath.VectorWithoutZ(Position - _prevUpdatePosition);
Actor hit = null;
TargetList targets = this.Context.GetEnemiesInRadius(this.Position, radius + 45f);
TargetList targets = Context.GetEnemiesInRadius(Position, radius + 45f);
if (CollisionFilter != null)
targets.Actors.RemoveAll(actor => !CollisionFilter(actor));
targets.SortByDistanceFrom(_prevUpdatePosition);
@ -334,11 +334,11 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
}
}
if (hit != null && !this.CollidedActors.Contains(hit) && hit != this.Context.User && hit.Visible && !(hit is Door && (hit as Door).isOpened))
if (hit != null && !CollidedActors.Contains(hit) && hit != Context.User && hit.Visible && !(hit is Door && (hit as Door).isOpened))
{
{
FirstTimeCollided = true;
this.CollidedActors.Add(hit);
CollidedActors.Add(hit);
OnCollision(hit);
}
//Logger.Trace("Projectile collided, actor: {0}", hit.ActorSNO.Name);
@ -353,41 +353,41 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
// gotta make sure the actor hasn't been deleted after processing each handler
if (_lastSpeed != this.Attributes[GameAttribute.Projectile_Speed])
if (_lastSpeed != Attributes[GameAttribute.Projectile_Speed])
{
if (_mover.IsFixedMove())
{
this.Launch(_mover.GetDestination(), this.Attributes[GameAttribute.Projectile_Speed]);
Launch(_mover.GetDestination(), Attributes[GameAttribute.Projectile_Speed]);
return;
}
}
if (this.World != null)
if (World != null)
_CheckCollisions();
// doing updates after collision tests
if (this.World != null)
if (World != null)
{
_prevUpdatePosition = this.Position;
_prevUpdatePosition = Position;
_mover.Update();
}
if (OnUpdate != null)
OnUpdate();
if (this.World != null && this.Arrived)
if (World != null && Arrived)
{
if (OnArrival != null && _onArrivalCalled == false)
{
_onArrivalCalled = true;
OnArrival();
}
if (this.World != null && this.DestroyOnArrival &&
this.Arrived) // double check arrival in case OnArrival() re-launched
if (World != null && DestroyOnArrival &&
Arrived) // double check arrival in case OnArrival() re-launched
Destroy();
}
if (this.World != null)
if (World != null)
{
if (Timeout.TimedOut)
{

View File

@ -116,10 +116,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
int animationSNO = GetActionAnimationSNO();
#region Патч анимаций
if(animationSNO == -1)
switch (this.User.SNO)
switch (User.SNO)
{
case ActorSno._x1_skeletonarcher_westmarch_a: //x1_SkeletonArcher_Westmarch_A
if (this.PowerSNO == 30334)
if (PowerSNO == 30334)
animationSNO = 303905;
break;
case ActorSno._p6_necro_skeletonmage_f_archer: //p6_necro_skeletonMage_F_archer

View File

@ -19,24 +19,24 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
public TargetList()
{
this.Actors = new List<Actor>();
this.ExtraActors = new List<Actor>();
Actors = new List<Actor>();
ExtraActors = new List<Actor>();
}
public void SortByDistanceFrom(Vector3D position)
{
this.Actors = this.Actors.OrderBy(actor => PowerMath.Distance2D(actor.Position, position)).ToList();
Actors = Actors.OrderBy(actor => PowerMath.Distance2D(actor.Position, position)).ToList();
}
public TargetList FilterByType<T>()
{
this.Actors = this.Actors.Where(actor => actor is T).ToList();
Actors = Actors.Where(actor => actor is T).ToList();
return this;
}
public TargetList Distinct()
{
this.Actors = this.Actors.Distinct().ToList();
Actors = Actors.Distinct().ToList();
return this;
}
@ -44,7 +44,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem
{
Actor closest = null;
float closestDistance = float.MaxValue;
foreach (Actor actor in this.Actors)
foreach (Actor actor in Actors)
{
float distance = PowerMath.Distance2D(actor.Position, position);
if (distance < closestDistance)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -45,36 +45,36 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
public override void SetQuests()
{
#region Siege of the Bastion
this.Game.QuestManager.Quests.Add(93595, new Quest { RewardXp = 6200, RewardGold = 580, Completed = false, Saveable = true, NextQuest = 93684, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.Quests.Add(93595, new Quest { RewardXp = 6200, RewardGold = 580, Completed = false, Saveable = true, NextQuest = 93684, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.Quests[93595].Steps.Add(-1, new QuestStep
Game.QuestManager.Quests[93595].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 8,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => {
this.Game.GetWorld(WorldSno.a3dun_hub_adria_tower_intro).GetActorBySNO(ActorSno._tyrael_act3, true).NotifyConversation(1);
Game.GetWorld(WorldSno.a3dun_hub_adria_tower_intro).GetActorBySNO(ActorSno._tyrael_act3, true).NotifyConversation(1);
ListenInteract(ActorSno._tyrael_act3, 1, new LaunchConversation(204905));
ListenConversation(204905, new Advance());
})
});
this.Game.QuestManager.Quests[93595].Steps.Add(8, new QuestStep
Game.QuestManager.Quests[93595].Steps.Add(8, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 26,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //use fire torches
var world = this.Game.GetWorld(WorldSno.a3dun_hub_adria_tower_intro);
var world = Game.GetWorld(WorldSno.a3dun_hub_adria_tower_intro);
ListenInteract(ActorSno._a3dunrmpt_interactives_signal_fire_a, 5, new Advance());
StartConversation(world, 204915);
world.GetActorBySNO(ActorSno._tyrael_act3, true).NotifyConversation(0);
})
});
this.Game.QuestManager.Quests[93595].Steps.Add(26, new QuestStep
Game.QuestManager.Quests[93595].Steps.Add(26, new QuestStep
{
Completed = false,
Saveable = true,
@ -84,11 +84,11 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
UnlockTeleport(0);
ListenProximity(ActorSno._bastionskeepguard_melee_b_02_sgt_dalen, new LaunchConversation(196152));
ListenConversation(196152, new Advance());
if (this.Game.Empty) UnlockTeleport(1);
if (Game.Empty) UnlockTeleport(1);
})
});
this.Game.QuestManager.Quests[93595].Steps.Add(3, new QuestStep
Game.QuestManager.Quests[93595].Steps.Add(3, new QuestStep
{
Completed = false,
Saveable = true,
@ -100,9 +100,9 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
#endregion
#region Raise the catapults
this.Game.QuestManager.Quests.Add(93684, new Quest { RewardXp = 9000, RewardGold = 980, Completed = false, Saveable = true, NextQuest = 93697, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.Quests.Add(93684, new Quest { RewardXp = 9000, RewardGold = 980, Completed = false, Saveable = true, NextQuest = 93697, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.Quests[93684].Steps.Add(-1, new QuestStep
Game.QuestManager.Quests[93684].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = true,
@ -112,17 +112,17 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[93684].Steps.Add(18, new QuestStep
Game.QuestManager.Quests[93684].Steps.Add(18, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 20,
Objectives = new List<Objective> { new Objective { Limit = 3, Counter = 0 } },
OnAdvance = new Action(() => { //use 3 catapults
this.Game.AddOnLoadWorldAction(WorldSno.a3dun_rmpt_level02, () =>
Game.AddOnLoadWorldAction(WorldSno.a3dun_rmpt_level02, () =>
{
var world = this.Game.GetWorld(WorldSno.a3dun_rmpt_level02);
if (this.Game.CurrentQuest == 93684 && this.Game.CurrentStep == 18)
var world = Game.GetWorld(WorldSno.a3dun_rmpt_level02);
if (Game.CurrentQuest == 93684 && Game.CurrentStep == 18)
{
//StartConversation(this.Game.GetWorld(81019), 106160);
}
@ -136,7 +136,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[93684].Steps.Add(20, new QuestStep
Game.QuestManager.Quests[93684].Steps.Add(20, new QuestStep
{
Completed = false,
Saveable = true,
@ -148,7 +148,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[93684].Steps.Add(2, new QuestStep
Game.QuestManager.Quests[93684].Steps.Add(2, new QuestStep
{
Completed = false,
Saveable = true,
@ -160,9 +160,9 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
#endregion
#region Bastion breach
this.Game.QuestManager.Quests.Add(93697, new Quest { RewardXp = 2475, RewardGold = 300, Completed = false, Saveable = true, NextQuest = 203595, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.Quests.Add(93697, new Quest { RewardXp = 2475, RewardGold = 300, Completed = false, Saveable = true, NextQuest = 203595, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.Quests[93697].Steps.Add(-1, new QuestStep
Game.QuestManager.Quests[93697].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = true,
@ -172,7 +172,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[93697].Steps.Add(20, new QuestStep
Game.QuestManager.Quests[93697].Steps.Add(20, new QuestStep
{
Completed = false,
Saveable = true,
@ -183,16 +183,16 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[93697].Steps.Add(18, new QuestStep
Game.QuestManager.Quests[93697].Steps.Add(18, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 22,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //find breach on 2nd level
if (this.Game.Empty)
if (Game.Empty)
{
var world = this.Game.GetWorld(WorldSno.a3dun_hub_keep);
var world = Game.GetWorld(WorldSno.a3dun_hub_keep);
while (world.GetActorBySNO(ActorSno._demontrooper_a, true) != null)
world.GetActorBySNO(ActorSno._demontrooper_a, true).Destroy();
}
@ -202,7 +202,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[93697].Steps.Add(22, new QuestStep
Game.QuestManager.Quests[93697].Steps.Add(22, new QuestStep
{
Completed = false,
Saveable = true,
@ -213,7 +213,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[93697].Steps.Add(1, new QuestStep
Game.QuestManager.Quests[93697].Steps.Add(1, new QuestStep
{
Completed = false,
Saveable = true,
@ -221,11 +221,11 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //kill gluttony
UnlockTeleport(3);
this.Game.AddOnLoadWorldAction(WorldSno.gluttony_boss, () =>
Game.AddOnLoadWorldAction(WorldSno.gluttony_boss, () =>
{
if (this.Game.CurrentQuest == 93697)
if (Game.CurrentQuest == 93697)
{
var world = this.Game.GetWorld(WorldSno.gluttony_boss);
var world = Game.GetWorld(WorldSno.gluttony_boss);
// TODO: extract this static method as extension
ActII.DisableEveryone(world, true);
//Старт катсцены
@ -241,7 +241,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[93697].Steps.Add(16, new QuestStep
Game.QuestManager.Quests[93697].Steps.Add(16, new QuestStep
{
Completed = false,
Saveable = true,
@ -252,7 +252,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[93697].Steps.Add(3, new QuestStep
Game.QuestManager.Quests[93697].Steps.Add(3, new QuestStep
{
Completed = false,
Saveable = true,
@ -264,16 +264,16 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
#endregion
#region Stone shake
this.Game.QuestManager.Quests.Add(203595, new Quest { RewardXp = 0, RewardGold = 0, Completed = false, Saveable = true, NextQuest = 101756, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.Quests.Add(203595, new Quest { RewardXp = 0, RewardGold = 0, Completed = false, Saveable = true, NextQuest = 101756, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.Quests[203595].Steps.Add(-1, new QuestStep
Game.QuestManager.Quests[203595].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 1,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => {
var Tyrael = this.Game.GetWorld(WorldSno.a3dun_hub_keep).GetActorBySNO(ActorSno._tyrael_act3);
var Tyrael = Game.GetWorld(WorldSno.a3dun_hub_keep).GetActorBySNO(ActorSno._tyrael_act3);
(Tyrael as InteractiveNPC).Conversations.Add(new ActorSystem.Interactions.ConversationInteraction(183792));
Tyrael.Attributes[GameAttribute.Conversation_Icon, 0] = 2;
Tyrael.Attributes.BroadcastChangedIfRevealed();
@ -281,14 +281,14 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[203595].Steps.Add(1, new QuestStep
Game.QuestManager.Quests[203595].Steps.Add(1, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = 4,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //go to Armory
var Tyrael = this.Game.GetWorld(WorldSno.a3dun_hub_keep).GetActorBySNO(ActorSno._tyrael_act3);
var Tyrael = Game.GetWorld(WorldSno.a3dun_hub_keep).GetActorBySNO(ActorSno._tyrael_act3);
(Tyrael as InteractiveNPC).Conversations.Clear();
Tyrael.Attributes[GameAttribute.Conversation_Icon, 0] = 1;
Tyrael.Attributes.BroadcastChangedIfRevealed();
@ -296,16 +296,16 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[203595].Steps.Add(4, new QuestStep
Game.QuestManager.Quests[203595].Steps.Add(4, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = 6,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //kill shadows
this.Game.AddOnLoadWorldAction(WorldSno.a3dun_keep_hub_inn, () =>
Game.AddOnLoadWorldAction(WorldSno.a3dun_keep_hub_inn, () =>
{
var world = this.Game.GetWorld(WorldSno.a3dun_keep_hub_inn);
var world = Game.GetWorld(WorldSno.a3dun_keep_hub_inn);
bool Activated = false;
var NStone = world.GetActorBySNO(ActorSno._a2dun_zolt_black_soulstone);//156328
NStone.Attributes[GameAttribute.Team_Override] = (Activated ? -1 : 2);
@ -326,7 +326,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
//atr.PlayEffectGroup(205460); //Add Rope channel to NStone
atr.SetFacingRotation(facingAngle);
}
if (this.Game.CurrentQuest == 203595)
if (Game.CurrentQuest == 203595)
{
ActII.DisableEveryone(world, true);
//Старт катсцены
@ -342,7 +342,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[203595].Steps.Add(6, new QuestStep
Game.QuestManager.Quests[203595].Steps.Add(6, new QuestStep
{
Completed = false,
Saveable = false,
@ -353,8 +353,8 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
ListenConversation(134266, new Advance());
try
{
this.Game.GetWorld(WorldSno.a3dun_hub_keep).FindAt(ActorSno._a3dun_hub_drawbridge_01, new Vector3D { X = 127.121f, Y = 353.211f, Z = 0.22f }, 25f).Hidden = true;
var world = this.Game.GetWorld(WorldSno.a3dun_keep_hub_inn);
Game.GetWorld(WorldSno.a3dun_hub_keep).FindAt(ActorSno._a3dun_hub_drawbridge_01, new Vector3D { X = 127.121f, Y = 353.211f, Z = 0.22f }, 25f).Hidden = true;
var world = Game.GetWorld(WorldSno.a3dun_keep_hub_inn);
var NStone = world.GetActorBySNO(ActorSno._a2dun_zolt_black_soulstone);//156328
foreach (var atr in world.GetActorsBySNO(ActorSno._leah))
{
@ -366,7 +366,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[203595].Steps.Add(8, new QuestStep
Game.QuestManager.Quests[203595].Steps.Add(8, new QuestStep
{
Completed = false,
Saveable = true,
@ -379,9 +379,9 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
#endregion
#region Machines of War
this.Game.QuestManager.Quests.Add(101756, new Quest { RewardXp = 9075, RewardGold = 900, Completed = false, Saveable = true, NextQuest = 101750, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.Quests.Add(101756, new Quest { RewardXp = 9075, RewardGold = 900, Completed = false, Saveable = true, NextQuest = 101750, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.Quests[101756].Steps.Add(-1, new QuestStep
Game.QuestManager.Quests[101756].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = true,
@ -391,7 +391,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101756].Steps.Add(4, new QuestStep
Game.QuestManager.Quests[101756].Steps.Add(4, new QuestStep
{
Completed = false,
Saveable = false,
@ -402,14 +402,14 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101756].Steps.Add(6, new QuestStep
Game.QuestManager.Quests[101756].Steps.Add(6, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = 9,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //talk with sergeant Pale
var Serge = this.Game.GetWorld(WorldSno.a3_battlefields_02).GetActorBySNO(ActorSno._a3_battlefield_guard_sargeant);
var Serge = Game.GetWorld(WorldSno.a3_battlefields_02).GetActorBySNO(ActorSno._a3_battlefield_guard_sargeant);
(Serge as InteractiveNPC).Conversations.Add(new ActorSystem.Interactions.ConversationInteraction(170486));
Serge.Attributes[GameAttribute.Conversation_Icon, 0] = 1;
//this.Game.GetWorld(95804).SpawnMonster(202730, new Vector3D(4394.2188f, 396.80215f, -2.293509f));
@ -418,67 +418,67 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101756].Steps.Add(9, new QuestStep
Game.QuestManager.Quests[101756].Steps.Add(9, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = 1,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //go through Korsikk bridge
this.Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_02, () =>
Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_02, () =>
{
if (this.Game.CurrentQuest == 101756 && this.Game.CurrentStep == 9)
if (Game.CurrentQuest == 101756 && Game.CurrentStep == 9)
{
StartConversation(this.Game.GetWorld(WorldSno.a3_battlefields_02), 187146);
StartConversation(Game.GetWorld(WorldSno.a3_battlefields_02), 187146);
}
});
ListenProximity(ActorSno._waypoint, new Advance());
})
});
this.Game.QuestManager.Quests[101756].Steps.Add(1, new QuestStep
Game.QuestManager.Quests[101756].Steps.Add(1, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 18,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 }, new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //kill 3 ballistas/destroy trebuchet
if (this.Game.Empty) UnlockTeleport(4);
this.Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_02, () =>
if (Game.Empty) UnlockTeleport(4);
Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_02, () =>
{
Open(this.Game.GetWorld(WorldSno.a3_battlefields_02), ActorSno._a3_battlefield_guardcatapult_door);
Open(Game.GetWorld(WorldSno.a3_battlefields_02), ActorSno._a3_battlefield_guardcatapult_door);
});
ListenKill(ActorSno._a3_battlefield_demonic_ballista, 2, new CompleteObjective(0));
ListenKill(ActorSno._a3battlefield_demon_trebuchetdevice, 1, new CompleteObjective(1));
})
});
this.Game.QuestManager.Quests[101756].Steps.Add(18, new QuestStep
Game.QuestManager.Quests[101756].Steps.Add(18, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 21,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //find Rakkis bridge
if (!this.Game.Empty) UnlockTeleport(4);
if (!Game.Empty) UnlockTeleport(4);
//69504
//ListenTeleport(69504, new Advance());
ListenProximity(ActorSno._tyrael_act3, new Advance());
})
});
this.Game.QuestManager.Quests[101756].Steps.Add(21, new QuestStep
Game.QuestManager.Quests[101756].Steps.Add(21, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 3,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //talk with Tyrael
this.Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_02, () =>
Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_02, () =>
{
if (this.Game.CurrentQuest == 101756 && this.Game.CurrentStep == 21)
if (Game.CurrentQuest == 101756 && Game.CurrentStep == 21)
{
var Tyrael = this.Game.GetWorld(WorldSno.a3_battlefields_02).GetActorBySNO(ActorSno._tyrael_act3);
var Tyrael = Game.GetWorld(WorldSno.a3_battlefields_02).GetActorBySNO(ActorSno._tyrael_act3);
(Tyrael as InteractiveNPC).Conversations.Add(new ActorSystem.Interactions.ConversationInteraction(209125));
//StartConversation(this.Game.GetWorld(95804), 209125);
}
@ -487,7 +487,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101756].Steps.Add(3, new QuestStep
Game.QuestManager.Quests[101756].Steps.Add(3, new QuestStep
{
Completed = false,
Saveable = true,
@ -499,9 +499,9 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
#endregion
#region Assault Beast
this.Game.QuestManager.Quests.Add(101750, new Quest { RewardXp = 0, RewardGold = 0, Completed = false, Saveable = true, NextQuest = 101758, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.Quests.Add(101750, new Quest { RewardXp = 0, RewardGold = 0, Completed = false, Saveable = true, NextQuest = 101758, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.Quests[101750].Steps.Add(-1, new QuestStep
Game.QuestManager.Quests[101750].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = true,
@ -511,30 +511,30 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101750].Steps.Add(1, new QuestStep
Game.QuestManager.Quests[101750].Steps.Add(1, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 10,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //find demonic gates to Siegebreaker
if (this.Game.Empty) UnlockTeleport(5);
if (Game.Empty) UnlockTeleport(5);
ListenProximity(ActorSno._a3dun_crater_st_demon_chainpylon_fire_azmodan, new Advance());
ListenTeleport(112580, new Advance());
})
});
this.Game.QuestManager.Quests[101750].Steps.Add(10, new QuestStep
Game.QuestManager.Quests[101750].Steps.Add(10, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 17,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //kill Siegebreaker
if (!this.Game.Empty) UnlockTeleport(5);
this.Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_03, () =>
if (!Game.Empty) UnlockTeleport(5);
Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_03, () =>
{
var world = this.Game.GetWorld(WorldSno.a3_battlefields_03);
var world = Game.GetWorld(WorldSno.a3_battlefields_03);
try { world.GetActorBySNO(ActorSno._siegebreakerdemon).Destroy(); } catch { }
world.SpawnMonster(ActorSno._siegebreakerdemon, world.GetActorBySNO(ActorSno._adria, true).Position);
});
@ -542,21 +542,21 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101750].Steps.Add(17, new QuestStep
Game.QuestManager.Quests[101750].Steps.Add(17, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 3,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //talk with Adria
this.Game.CurrentEncounter.activated = false;
Game.CurrentEncounter.activated = false;
ListenProximity(ActorSno._adria, new LaunchConversation(196366));
ListenConversation(196366, new Advance());
if (this.Game.Empty) UnlockTeleport(6);
if (Game.Empty) UnlockTeleport(6);
})
});
this.Game.QuestManager.Quests[101750].Steps.Add(3, new QuestStep
Game.QuestManager.Quests[101750].Steps.Add(3, new QuestStep
{
Completed = false,
Saveable = true,
@ -569,9 +569,9 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
#endregion
#region Heart of Sin
this.Game.QuestManager.Quests.Add(101758, new Quest { RewardXp = 24600, RewardGold = 1535, Completed = false, Saveable = true, NextQuest = -1, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.Quests.Add(101758, new Quest { RewardXp = 24600, RewardGold = 1535, Completed = false, Saveable = true, NextQuest = -1, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.Quests[101758].Steps.Add(-1, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = true,
@ -581,94 +581,94 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(10, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(10, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 41,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //find Tower of the Doomed lv. 1
this.Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_03, () =>
Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_03, () =>
{
Open(this.Game.GetWorld(WorldSno.a3_battlefields_03), ActorSno._a3_battlefield_siegebreakergate_a);
Open(Game.GetWorld(WorldSno.a3_battlefields_03), ActorSno._a3_battlefield_siegebreakergate_a);
});
this.Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_02, () =>
Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_02, () =>
{
Open(this.Game.GetWorld(WorldSno.a3_battlefields_02), ActorSno._a3_battlefield_siegebreakergate_a);
Open(Game.GetWorld(WorldSno.a3_battlefields_02), ActorSno._a3_battlefield_siegebreakergate_a);
});
ListenTeleport(80791, new Advance());
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(41, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(41, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 25,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //find Heart of Sin
if (!this.Game.Empty) UnlockTeleport(6);
if (this.Game.Empty) UnlockTeleport(7);
if (!Game.Empty) UnlockTeleport(6);
if (Game.Empty) UnlockTeleport(7);
ListenTeleport(85202, new Advance());
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(25, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(25, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 14,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 }, new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //kill Daughters of Pain / Destroy Heart of Sin
if (!this.Game.Empty) UnlockTeleport(7);
if (!Game.Empty) UnlockTeleport(7);
ListenKill(ActorSno._succubus_daughterofpain, 3, new CompleteObjective(0));
ListenKill(ActorSno._a3dun_crater_st_giantdemonheart_mob, 1, new CompleteObjective(1));
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(14, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(14, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 29,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //find Tower of Damned lv. 1
if (this.Game.Empty) UnlockTeleport(8);
this.Game.AddOnLoadWorldAction(WorldSno.a3dun_crater_st_level04, () =>
if (Game.Empty) UnlockTeleport(8);
Game.AddOnLoadWorldAction(WorldSno.a3dun_crater_st_level04, () =>
{
Open(this.Game.GetWorld(WorldSno.a3dun_crater_st_level04), ActorSno._a3dun_battlefield_demon_chainpylon_locked);
Open(Game.GetWorld(WorldSno.a3dun_crater_st_level04), ActorSno._a3dun_battlefield_demon_chainpylon_locked);
});
ListenTeleport(119653, new Advance());
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(29, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(29, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 23,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //find Heart of Sin
if (!this.Game.Empty) UnlockTeleport(8);
if (this.Game.Empty) UnlockTeleport(9);
if (!Game.Empty) UnlockTeleport(8);
if (Game.Empty) UnlockTeleport(9);
ListenTeleport(119656, new Advance());
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(23, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(23, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 27,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //kill Cydaea
if (!this.Game.Empty) UnlockTeleport(9);
if (!Game.Empty) UnlockTeleport(9);
ListenKill(ActorSno._mistressofpain, 1, new Advance());
this.Game.AddOnLoadWorldAction(WorldSno.a3dun_crater_st_level04b, () =>
Game.AddOnLoadWorldAction(WorldSno.a3dun_crater_st_level04b, () =>
{
try
{
var world = this.Game.GetWorld(WorldSno.a3dun_crater_st_level04b);
var world = Game.GetWorld(WorldSno.a3dun_crater_st_level04b);
(world.FindAt(ActorSno._a3dun_crater_st_demon_chainpylon_fire_mistressofpain, new Vector3D { X = 457.04f, Y = 359.03f, Z = 0.39f }, 20f) as Door).Open();
(world.FindAt(ActorSno._a3dun_crater_st_demon_chainpylon_fire_mistressofpain, new Vector3D { X = 356.04f, Y = 267.03f, Z = 0.28f }, 20f) as Door).Open();
SetActorOperable(world, ActorSno._a3dun_crater_st_giantdemonheart_mob, false);
@ -678,38 +678,38 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(27, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(27, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 1,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //Destroy Heart of Sin
this.Game.CurrentEncounter.activated = false;
Game.CurrentEncounter.activated = false;
ListenKill(ActorSno._a3dun_crater_st_giantdemonheart_mob, 1, new Advance());
this.Game.AddOnLoadWorldAction(WorldSno.a3dun_crater_st_level04b, () =>
Game.AddOnLoadWorldAction(WorldSno.a3dun_crater_st_level04b, () =>
{
try
{
SetActorOperable(this.Game.GetWorld(WorldSno.a3dun_crater_st_level04b), ActorSno._a3dun_crater_st_giantdemonheart_mob, true);
SetActorOperable(Game.GetWorld(WorldSno.a3dun_crater_st_level04b), ActorSno._a3dun_crater_st_giantdemonheart_mob, true);
}
catch { }
});
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(1, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(1, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 32,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //kill Azmodan, finally
if (this.Game.Empty) UnlockTeleport(10);
if (Game.Empty) UnlockTeleport(10);
ListenKill(ActorSno._azmodan, 1, new Advance());
this.Game.AddOnLoadWorldAction(WorldSno.a3dun_azmodan_arena, () =>
Game.AddOnLoadWorldAction(WorldSno.a3dun_azmodan_arena, () =>
{
var world = this.Game.GetWorld(WorldSno.a3dun_azmodan_arena);
var world = Game.GetWorld(WorldSno.a3dun_azmodan_arena);
OpenAll(world, ActorSno._a3dun_crater_st_demon_chainpylon_fire_azmodan);
try { world.GetActorBySNO(ActorSno._azmodan).Destroy(); } catch { };
world.SpawnMonster(ActorSno._azmodan, new Vector3D { X = 395.553f, Y = 394.966f, Z = 0.1f });
@ -717,23 +717,23 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(32, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(32, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 5,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //get Azmodan's soul
this.Game.CurrentEncounter.activated = false;
Game.CurrentEncounter.activated = false;
ListenProximity(ActorSno._azmodan_bss_soulremnants, new Advance());
this.Game.AddOnLoadWorldAction(WorldSno.a3dun_azmodan_arena, () =>
Game.AddOnLoadWorldAction(WorldSno.a3dun_azmodan_arena, () =>
{
this.Game.GetWorld(WorldSno.a3dun_azmodan_arena).SpawnMonster(ActorSno._azmodan_bss_soulremnants, new Vector3D { X = 395.553f, Y = 394.966f, Z = 0.1f });
Game.GetWorld(WorldSno.a3dun_azmodan_arena).SpawnMonster(ActorSno._azmodan_bss_soulremnants, new Vector3D { X = 395.553f, Y = 394.966f, Z = 0.1f });
});
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(5, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(5, new QuestStep
{
Completed = false,
Saveable = true,
@ -741,14 +741,14 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //return to base
ListenProximity(ActorSno._tyrael_act3, new Advance());
this.Game.AddOnLoadWorldAction(WorldSno.a3dun_azmodan_arena, () =>
Game.AddOnLoadWorldAction(WorldSno.a3dun_azmodan_arena, () =>
{
this.Game.GetWorld(WorldSno.a3dun_azmodan_arena).GetActorBySNO(ActorSno._azmodan_bss_soulremnants).Destroy();
Game.GetWorld(WorldSno.a3dun_azmodan_arena).GetActorBySNO(ActorSno._azmodan_bss_soulremnants).Destroy();
});
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(39, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(39, new QuestStep
{
Completed = false,
Saveable = true,
@ -760,7 +760,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(46, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(46, new QuestStep
{
Completed = false,
Saveable = true,
@ -771,7 +771,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(34, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(34, new QuestStep
{
Completed = false,
Saveable = true,
@ -779,7 +779,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() =>
{ //go to Adria tower event
var World = this.Game.GetWorld(WorldSno.a3dun_hub_adria_tower);
var World = Game.GetWorld(WorldSno.a3dun_hub_adria_tower);
//Удаляем дубликаты
var Guardian = World.GetActorBySNO(ActorSno._bastionskeepguard_event47, true);
var Leah = World.GetActorBySNO(ActorSno._leah_event47, true);
@ -789,7 +789,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
foreach (var actor in World.GetActorsBySNO(ActorSno._tyrael_event47)) if (actor.GlobalID != Tyrael.GlobalID) actor.Destroy(); //Тираэль
foreach (var actor in World.GetActorsBySNO(ActorSno._leah_event47)) if (actor.GlobalID != Leah.GlobalID) actor.Destroy(); //Лея
this.Game.AddOnLoadWorldAction(WorldSno.a3dun_hub_adria_tower, () =>
Game.AddOnLoadWorldAction(WorldSno.a3dun_hub_adria_tower, () =>
{
var portal = World.GetActorBySNO(ActorSno._townportal_red);
var Bportal = World.GetActorBySNO(ActorSno._event47_bigportal);
@ -887,7 +887,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(36, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(36, new QuestStep
{
Completed = false,
Saveable = true,
@ -898,14 +898,14 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[101758].Steps.Add(4, new QuestStep
Game.QuestManager.Quests[101758].Steps.Add(4, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = -1,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //complete
this.Game.CurrentEncounter.activated = false;
Game.CurrentEncounter.activated = false;
})
});

View File

@ -39,9 +39,9 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
public override void SetQuests()
{
#region Fall of Heavens
this.Game.QuestManager.Quests.Add(112498, new Quest { RewardXp = 7000, RewardGold = 620, Completed = false, Saveable = true, NextQuest = 113910, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.Quests.Add(112498, new Quest { RewardXp = 7000, RewardGold = 620, Completed = false, Saveable = true, NextQuest = 113910, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.Quests[112498].Steps.Add(-1, new QuestStep
Game.QuestManager.Quests[112498].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = true,
@ -49,7 +49,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => {
UnlockTeleport(0); //{[World] SNOId: 182944 GlobalId: 117440513 Name: a4dun_heaven_1000_monsters_fight_entrance}
var Tyrael = this.Game.GetWorld(WorldSno.a4dun_heaven_1000_monsters_fight_entrance).GetActorBySNO(ActorSno._tyrael) as InteractiveNPC;
var Tyrael = Game.GetWorld(WorldSno.a4dun_heaven_1000_monsters_fight_entrance).GetActorBySNO(ActorSno._tyrael) as InteractiveNPC;
Tyrael.Conversations.Clear();
Tyrael.OverridedConv = true;
Tyrael.Attributes[GameAttribute.Conversation_Icon, 0] = 1;
@ -60,7 +60,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[112498].Steps.Add(2, new QuestStep
Game.QuestManager.Quests[112498].Steps.Add(2, new QuestStep
{
Completed = false,
Saveable = false,
@ -68,11 +68,11 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //talk with Tyrael
UnlockTeleport(1);
this.Game.AddOnLoadWorldAction(WorldSno.a4dun_heaven_1000_monsters_fight_entrance, () =>
Game.AddOnLoadWorldAction(WorldSno.a4dun_heaven_1000_monsters_fight_entrance, () =>
{
if (this.Game.CurrentQuest == 112498 && this.Game.CurrentStep == 2)
if (Game.CurrentQuest == 112498 && Game.CurrentStep == 2)
{
var Tyrael = this.Game.GetWorld(WorldSno.a4dun_heaven_1000_monsters_fight_entrance).GetActorBySNO(ActorSno._tyrael) as InteractiveNPC;
var Tyrael = Game.GetWorld(WorldSno.a4dun_heaven_1000_monsters_fight_entrance).GetActorBySNO(ActorSno._tyrael) as InteractiveNPC;
Tyrael.Conversations.Clear();
Tyrael.Conversations.Add(new ActorSystem.Interactions.ConversationInteraction(112449));
Tyrael.OverridedConv = true;
@ -87,7 +87,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[112498].Steps.Add(17, new QuestStep
Game.QuestManager.Quests[112498].Steps.Add(17, new QuestStep
{
Completed = false,
Saveable = false,
@ -99,16 +99,16 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[112498].Steps.Add(15, new QuestStep
Game.QuestManager.Quests[112498].Steps.Add(15, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = 12,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //kill Iskatu
if (!this.Game.Empty)
if (!Game.Empty)
{
var world = this.Game.GetWorld(WorldSno.a4dun_heaven_1000_monsters_fight);
var world = Game.GetWorld(WorldSno.a4dun_heaven_1000_monsters_fight);
script = new Invasion(world.Players.First().Value.Position, 50f, new List<ActorSno> { ActorSno._shadowvermin_a }, 30f, ActorSno._terrordemon_a_unique_1000monster, true);
script.Execute(world);
ListenKill(ActorSno._terrordemon_a_unique_1000monster, 1, new Advance());
@ -116,22 +116,22 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[112498].Steps.Add(12, new QuestStep
Game.QuestManager.Quests[112498].Steps.Add(12, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = -1,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //complete
this.Game.CurrentEncounter.activated = false;
Game.CurrentEncounter.activated = false;
})
});
#endregion
#region Restoration of Hope
this.Game.QuestManager.Quests.Add(113910, new Quest { RewardXp = 12600, RewardGold = 1260, Completed = false, Saveable = true, NextQuest = 114795, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.Quests.Add(113910, new Quest { RewardXp = 12600, RewardGold = 1260, Completed = false, Saveable = true, NextQuest = 114795, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.Quests[113910].Steps.Add(-1, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = true,
@ -141,15 +141,15 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(66, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(66, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = 58,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //find Iterael
var world = this.Game.GetWorld(WorldSno.a4dun_heaven_1000_monsters_fight);
if (this.Game.Empty) UnlockTeleport(2);
var world = Game.GetWorld(WorldSno.a4dun_heaven_1000_monsters_fight);
if (Game.Empty) UnlockTeleport(2);
try
{
if (world.GetActorBySNO(ActorSno._a4dungarden_corruption_gate, true) != null)
@ -166,7 +166,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(58, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(58, new QuestStep
{
Completed = false,
Saveable = false,
@ -174,7 +174,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //talk with Iterael
var Ityrael = this.Game.GetWorld(WorldSno.a4dun_heaven_1000_monsters_fight).GetActorBySNO(ActorSno._fate) as InteractiveNPC;
var Ityrael = Game.GetWorld(WorldSno.a4dun_heaven_1000_monsters_fight).GetActorBySNO(ActorSno._fate) as InteractiveNPC;
Ityrael.Conversations.Clear();
Ityrael.Conversations.Add(new ActorSystem.Interactions.ConversationInteraction(112763));
Ityrael.OverridedConv = true;
@ -186,16 +186,16 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(40, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(40, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = 17,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //find Library of Fate
if (!this.Game.Empty) UnlockTeleport(2);
if (this.Game.Empty) UnlockTeleport(3);
var Ityrael = this.Game.GetWorld(WorldSno.a4dun_heaven_1000_monsters_fight).GetActorBySNO(ActorSno._fate) as InteractiveNPC;
if (!Game.Empty) UnlockTeleport(2);
if (Game.Empty) UnlockTeleport(3);
var Ityrael = Game.GetWorld(WorldSno.a4dun_heaven_1000_monsters_fight).GetActorBySNO(ActorSno._fate) as InteractiveNPC;
Ityrael.Conversations.Clear();
Ityrael.Attributes[GameAttribute.Conversation_Icon, 0] = 1;
Ityrael.Attributes.BroadcastChangedIfRevealed();
@ -205,7 +205,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(17, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(17, new QuestStep
{
Completed = false,
Saveable = false,
@ -216,18 +216,18 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(11, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(11, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = 13,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //kill Rakanoth
if (!this.Game.Empty) UnlockTeleport(3);
var Library = this.Game.GetWorld(WorldSno.a4dun_libraryoffate);
if (!Game.Empty) UnlockTeleport(3);
var Library = Game.GetWorld(WorldSno.a4dun_libraryoffate);
ListenKill(ActorSno._despair, 1, new Advance());
this.Game.AddOnLoadWorldAction(WorldSno.a4dun_libraryoffate, () =>
Game.AddOnLoadWorldAction(WorldSno.a4dun_libraryoffate, () =>
{
var Fate = Library.GetActorBySNO(ActorSno._fate); Vector3D Fate_Dist = Fate.Position; Library.Leave(Fate);
var Hope = Library.GetActorBySNO(ActorSno._hope); Vector3D Hope_Dist = Hope.Position; Library.Leave(Hope);
@ -248,16 +248,16 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(13, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(13, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = 33,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //destroy Auriel's jail
this.Game.CurrentEncounter.activated = false;
Game.CurrentEncounter.activated = false;
var Library = this.Game.GetWorld(WorldSno.a4dun_libraryoffate);
var Library = Game.GetWorld(WorldSno.a4dun_libraryoffate);
StartConversation(Library, 217223); // Голос дъябло после битвы
var Hope_Bound = Library.GetActorBySNO(ActorSno._a4dunspire_interactives_hope_bound);
@ -270,7 +270,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(33, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(33, new QuestStep
{
Completed = false,
Saveable = false,
@ -278,7 +278,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //talk with Auriel
var Library = this.Game.GetWorld(WorldSno.a4dun_libraryoffate);
var Library = Game.GetWorld(WorldSno.a4dun_libraryoffate);
var Hope_Bound = Library.GetActorBySNO(ActorSno._a4dunspire_interactives_hope_bound);
var Hope = Library.SpawnMonster(ActorSno._hope, new Vector3D(Hope_Bound.Position.X - 0.3854f, Hope_Bound.Position.Y + 0.44201f, Hope_Bound.Position.Z));
var Fate = Library.SpawnMonster(ActorSno._fate, new Vector3D(Hope_Bound.Position.X - 18.6041f, Hope_Bound.Position.Y + 2.35458f, Hope_Bound.Position.Z));
@ -298,7 +298,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(38, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(38, new QuestStep
{
Completed = false,
Saveable = false,
@ -306,7 +306,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //return to Gardens of Hope lv. 1
PlayCutscene(1);
var Library = this.Game.GetWorld(WorldSno.a4dun_libraryoffate);
var Library = Game.GetWorld(WorldSno.a4dun_libraryoffate);
var Hope = Library.GetActorBySNO(ActorSno._hope, true);
(Hope as InteractiveNPC).Conversations.Clear();
Hope.Attributes[GameAttribute.Conversation_Icon, 0] = 1;
@ -322,7 +322,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(42, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(42, new QuestStep
{
Completed = false,
Saveable = true,
@ -333,7 +333,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(44, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(44, new QuestStep
{
Completed = false,
Saveable = false,
@ -345,21 +345,21 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(62, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(62, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = 50,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //leave demonic rift
var World = this.Game.GetWorld(WorldSno.a4dun_hell_portal_01);
var World = Game.GetWorld(WorldSno.a4dun_hell_portal_01);
World.SpawnMonster(ActorSno._diablo_vo, World.Players.Values.First().Position);
StartConversation(World, 217230);
ListenTeleport(109514, new Advance());
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(50, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(50, new QuestStep
{
Completed = false,
Saveable = true,
@ -370,19 +370,19 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(52, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(52, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 48,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //find another demonic rift
if (this.Game.Empty) UnlockTeleport(4);
if (Game.Empty) UnlockTeleport(4);
ListenProximity(ActorSno._a4_heaven_gardens_hellportal, new Advance());
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(48, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(48, new QuestStep
{
Completed = false,
Saveable = true,
@ -393,21 +393,21 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(60, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(60, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 56,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //leave demonic rift
var World = this.Game.GetWorld(WorldSno.a4dun_hell_portal_02);
var World = Game.GetWorld(WorldSno.a4dun_hell_portal_02);
World.SpawnMonster(ActorSno._diablo_vo, World.Players.Values.First().Position);
StartConversation(World, 217232);
ListenTeleport(109516, new Advance());
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(56, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(56, new QuestStep
{
Completed = false,
Saveable = true,
@ -418,16 +418,16 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(54, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(54, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 23,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //talk with Tyrael
if (!this.Game.Empty) UnlockTeleport(4);
if (!Game.Empty) UnlockTeleport(4);
var Garden = this.Game.GetWorld(WorldSno.a4dun_garden_of_hope_random);
var Garden = Game.GetWorld(WorldSno.a4dun_garden_of_hope_random);
var Tyrael = Garden.GetActorBySNO(ActorSno._tyrael_heaven_spire);
Tyrael.Attributes[GameAttribute.MinimapActive] = true;
(Tyrael as InteractiveNPC).Conversations.Clear();
@ -439,7 +439,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(23, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(23, new QuestStep
{
Completed = false,
Saveable = true,
@ -450,23 +450,23 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[113910].Steps.Add(29, new QuestStep
Game.QuestManager.Quests[113910].Steps.Add(29, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = -1,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //complete
this.Game.CurrentEncounter.activated = false;
Game.CurrentEncounter.activated = false;
PlayCutscene(2);
})
});
#endregion
#region To the Spire
this.Game.QuestManager.Quests.Add(114795, new Quest { RewardXp = 0, RewardGold = 0, Completed = false, Saveable = true, NextQuest = 114901, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.Quests.Add(114795, new Quest { RewardXp = 0, RewardGold = 0, Completed = false, Saveable = true, NextQuest = 114901, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.Quests[114795].Steps.Add(-1, new QuestStep
Game.QuestManager.Quests[114795].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = true,
@ -476,20 +476,20 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[114795].Steps.Add(14, new QuestStep
Game.QuestManager.Quests[114795].Steps.Add(14, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 18,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //find Imperius
var CrystalWorld = this.Game.GetWorld(WorldSno.a4dun_garden3_spireentrance);
var CrystalWorld = Game.GetWorld(WorldSno.a4dun_garden3_spireentrance);
this.Game.AddOnLoadWorldAction(WorldSno.a4dun_garden3_spireentrance, () =>
Game.AddOnLoadWorldAction(WorldSno.a4dun_garden3_spireentrance, () =>
{
foreach (var mob in CrystalWorld.GetActorsBySNO(ActorSno._bigred_a))
{
(mob as ActorSystem.Monster).Brain.DeActivate();
(mob as Monster).Brain.DeActivate();
mob.Attributes[GameAttribute.Untargetable] = true;
}
script = new ImperiumScene();
@ -499,7 +499,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[114795].Steps.Add(18, new QuestStep
Game.QuestManager.Quests[114795].Steps.Add(18, new QuestStep
{
Completed = false,
Saveable = true,
@ -511,23 +511,23 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[114795].Steps.Add(16, new QuestStep
Game.QuestManager.Quests[114795].Steps.Add(16, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 12,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //go to road to Spire
this.Game.AddOnLoadWorldAction(WorldSno.a4dun_garden3_spireentrance, () =>
Game.AddOnLoadWorldAction(WorldSno.a4dun_garden3_spireentrance, () =>
{
var CrystalWorld = this.Game.GetWorld(WorldSno.a4dun_garden3_spireentrance);
var CrystalWorld = Game.GetWorld(WorldSno.a4dun_garden3_spireentrance);
foreach (var plr in CrystalWorld.Players.Values)
{
plr.InGameClient.SendMessage(new BoolDataMessage(Opcodes.CameraTriggerFadeToBlackMessage) { Field0 = true });
plr.InGameClient.SendMessage(new SimpleMessage(Opcodes.CameraSriptedSequenceStopMessage) { });
}
if (this.Game.CurrentQuest == 114795 && this.Game.CurrentStep == 16)
if (Game.CurrentQuest == 114795 && Game.CurrentStep == 16)
{
StartConversation(CrystalWorld, 196566);
}
@ -536,7 +536,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[114795].Steps.Add(12, new QuestStep
Game.QuestManager.Quests[114795].Steps.Add(12, new QuestStep
{
Completed = false,
Saveable = true,
@ -548,9 +548,9 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
#endregion
#region United Evil
this.Game.QuestManager.Quests.Add(114901, new Quest { RewardXp = 21000, RewardGold = 1600, Completed = false, Saveable = true, NextQuest = -1, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.Quests.Add(114901, new Quest { RewardXp = 21000, RewardGold = 1600, Completed = false, Saveable = true, NextQuest = -1, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.Quests[114901].Steps.Add(-1, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = true,
@ -560,29 +560,29 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[114901].Steps.Add(24, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(24, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 26,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //go to Spire exterior
if (this.Game.Empty) UnlockTeleport(5);
if (Game.Empty) UnlockTeleport(5);
ListenTeleport(215396, new Advance());
})
});
this.Game.QuestManager.Quests[114901].Steps.Add(26, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(26, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 7,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //kill Izual
if (!this.Game.Empty) UnlockTeleport(5);
this.Game.AddOnLoadWorldAction(WorldSno.a4dun_spire_exterior, () =>
if (!Game.Empty) UnlockTeleport(5);
Game.AddOnLoadWorldAction(WorldSno.a4dun_spire_exterior, () =>
{
var world = this.Game.GetWorld(WorldSno.a4dun_spire_exterior);
var world = Game.GetWorld(WorldSno.a4dun_spire_exterior);
world.SpawnMonster(ActorSno._bigred_izual, new Vector3D { X = 585.439f, Y = 560.823f, Z = 0.1f });
var iceBarrier = world.GetActorBySNO(ActorSno._a4dunspire_interactives_izual_ice_barrier_a);
while (iceBarrier != null)
@ -595,33 +595,33 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[114901].Steps.Add(7, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(7, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 20,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //go to Spire entrance (heavens peak)
if (this.Game.Empty) UnlockTeleport(6);
if (Game.Empty) UnlockTeleport(6);
ListenTeleport(205434, new Advance());
})
});
this.Game.QuestManager.Quests[114901].Steps.Add(20, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(20, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 22,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //talk with Tyrael
if (!this.Game.Empty) UnlockTeleport(6);
if (this.Game.Empty) UnlockTeleport(7);
if (!Game.Empty) UnlockTeleport(6);
if (Game.Empty) UnlockTeleport(7);
ListenProximity(ActorSno._tyrael_heaven_spire, new LaunchConversation(199698));
ListenConversation(199698, new Advance());
})
});
this.Game.QuestManager.Quests[114901].Steps.Add(22, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(22, new QuestStep
{
Completed = false,
Saveable = true,
@ -632,34 +632,34 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[114901].Steps.Add(10, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(10, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 1,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //find Diablo
if (!this.Game.Empty) UnlockTeleport(7);
this.Game.AddOnLoadWorldAction(WorldSno.a4dun_diablo_arena, () =>
if (!Game.Empty) UnlockTeleport(7);
Game.AddOnLoadWorldAction(WorldSno.a4dun_diablo_arena, () =>
{
Open(this.Game.GetWorld(WorldSno.a4dun_diablo_arena), ActorSno._a4dun_diablo_bone_gate);
Open(Game.GetWorld(WorldSno.a4dun_diablo_arena), ActorSno._a4dun_diablo_bone_gate);
});
ListenProximity(ActorSno._a4dun_diablo_bone_gate, new Advance());
})
});
this.Game.QuestManager.Quests[114901].Steps.Add(1, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(1, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 6,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //kill Diablo (1st phase, to 50% hp)
this.Game.AddOnLoadWorldAction(WorldSno.a4dun_diablo_arena, () =>
Game.AddOnLoadWorldAction(WorldSno.a4dun_diablo_arena, () =>
{
if (this.Game.CurrentQuest == 114901 && this.Game.CurrentStep == 1)
if (Game.CurrentQuest == 114901 && Game.CurrentStep == 1)
{
StartConversation(this.Game.GetWorld(WorldSno.a4dun_diablo_arena), 132632);
StartConversation(Game.GetWorld(WorldSno.a4dun_diablo_arena), 132632);
}
});
//seems hacky but works
@ -667,7 +667,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[114901].Steps.Add(6, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(6, new QuestStep
{
Completed = false,
Saveable = true,
@ -678,49 +678,49 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[114901].Steps.Add(12, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(12, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 3,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //kill Diablo (3rd phase)
var targetWorld = this.Game.GetWorld(WorldSno.a4dun_diablo_arena_phase3);
TeleportToWorld(this.Game.GetWorld(WorldSno.a4dun_diablo_shadowrealm_01), targetWorld, 172);
var targetWorld = Game.GetWorld(WorldSno.a4dun_diablo_arena_phase3);
TeleportToWorld(Game.GetWorld(WorldSno.a4dun_diablo_shadowrealm_01), targetWorld, 172);
StartConversation(targetWorld, 132640);
ListenKill(ActorSno._diablo, 1, new Advance());
})
});
this.Game.QuestManager.Quests[114901].Steps.Add(3, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(3, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 17,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //destroy Diablo
StartConversation(this.Game.GetWorld(WorldSno.a4dun_diablo_arena_phase3), 205783);
StartConversation(Game.GetWorld(WorldSno.a4dun_diablo_arena_phase3), 205783);
ListenConversation(205783, new Advance());
})
});
this.Game.QuestManager.Quests[114901].Steps.Add(17, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(17, new QuestStep
{
Completed = false,
Saveable = true,
NextStep = 5,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //talk with Auriel
this.Game.GetWorld(WorldSno.a4dun_diablo_arena_phase3).GetActorBySNO(ActorSno._hope).NotifyConversation(1);
if (this.Game.IsHardcore)
Game.GetWorld(WorldSno.a4dun_diablo_arena_phase3).GetActorBySNO(ActorSno._hope).NotifyConversation(1);
if (Game.IsHardcore)
{
foreach (var plr in this.Game.Players.Values)
foreach (var plr in Game.Players.Values)
if (!plr.Toon.GameAccount.Flags.HasFlag(GameAccount.GameAccountFlags.HardcoreMasterUnlocked))
plr.Toon.GameAccount.Flags = plr.Toon.GameAccount.Flags | GameAccount.GameAccountFlags.HardcoreMasterUnlocked;
}
else
{
foreach (var plr in this.Game.Players.Values)
foreach (var plr in Game.Players.Values)
if (!plr.Toon.GameAccount.Flags.HasFlag(GameAccount.GameAccountFlags.MasterUnlocked))
plr.Toon.GameAccount.Flags = plr.Toon.GameAccount.Flags | GameAccount.GameAccountFlags.MasterUnlocked;
}
@ -729,7 +729,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[114901].Steps.Add(5, new QuestStep
Game.QuestManager.Quests[114901].Steps.Add(5, new QuestStep
{
Completed = false,
Saveable = true,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -37,9 +37,9 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
public override void SetQuests()
{
#region x1_OpenWorld_quest
this.Game.QuestManager.Quests.Add(312429, new Quest { RewardXp = 1125, RewardGold = 370, Completed = false, Saveable = true, NextQuest = -1, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.Quests.Add(312429, new Quest { RewardXp = 1125, RewardGold = 370, Completed = false, Saveable = true, NextQuest = -1, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.Quests[312429].Steps.Add(-1, new QuestStep
Game.QuestManager.Quests[312429].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = true,
@ -47,30 +47,30 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => {
script = new CryptPortals();
script.Execute(this.Game.GetWorld(WorldSno.trout_town));
this.Game.AddOnLoadWorldAction(WorldSno.a1dun_spidercave_02, () =>
script.Execute(Game.GetWorld(WorldSno.trout_town));
Game.AddOnLoadWorldAction(WorldSno.a1dun_spidercave_02, () =>
{
this.Game.GetWorld(WorldSno.a1dun_spidercave_02).SpawnMonster(ActorSno._spiderqueen, new Vector3D { X = 149.439f, Y = 121.452f, Z = 13.794f });
Game.GetWorld(WorldSno.a1dun_spidercave_02).SpawnMonster(ActorSno._spiderqueen, new Vector3D { X = 149.439f, Y = 121.452f, Z = 13.794f });
});//spawn spider queen
this.Game.AddOnLoadWorldAction(WorldSno.trdun_butcherslair_02, () =>
Game.AddOnLoadWorldAction(WorldSno.trdun_butcherslair_02, () =>
{
this.Game.GetWorld(WorldSno.trdun_butcherslair_02).SpawnMonster(ActorSno._butcher, new Vector3D { X = 93.022f, Y = 89.86f, Z = 0.1f });
Game.GetWorld(WorldSno.trdun_butcherslair_02).SpawnMonster(ActorSno._butcher, new Vector3D { X = 93.022f, Y = 89.86f, Z = 0.1f });
});//spawn Butcher
this.Game.AddOnLoadWorldAction(WorldSno.a4dun_spire_exterior, () =>
Game.AddOnLoadWorldAction(WorldSno.a4dun_spire_exterior, () =>
{
this.Game.GetWorld(WorldSno.a4dun_spire_exterior).SpawnMonster(ActorSno._bigred_izual, new Vector3D { X = 585.439f, Y = 560.823f, Z = 0.1f });
Game.GetWorld(WorldSno.a4dun_spire_exterior).SpawnMonster(ActorSno._bigred_izual, new Vector3D { X = 585.439f, Y = 560.823f, Z = 0.1f });
});//spawn Izual
//this.Game.AddOnLoadAction(109984, () => { foreach (var giz in this.Game.GetWorld(109894).GetActorsBySNO(180254)) giz.Destroy(); });//destroy walls for Belial
this.Game.GetWorld(WorldSno.a4dun_garden_of_hope_01).SpawnMonster(ActorSno._waypoint, new Vector3D { X = 931.48f, Y = 1172.24f, Z = -14.7f }); //waypoint
this.Game.AddOnLoadWorldAction(WorldSno.a3dun_azmodan_arena, () =>
Game.GetWorld(WorldSno.a4dun_garden_of_hope_01).SpawnMonster(ActorSno._waypoint, new Vector3D { X = 931.48f, Y = 1172.24f, Z = -14.7f }); //waypoint
Game.AddOnLoadWorldAction(WorldSno.a3dun_azmodan_arena, () =>
{
var world = this.Game.GetWorld(WorldSno.a3dun_azmodan_arena);
var world = Game.GetWorld(WorldSno.a3dun_azmodan_arena);
try { world.GetActorBySNO(ActorSno._azmodan).Destroy(); } catch { };
world.SpawnMonster(ActorSno._azmodan, new Vector3D { X = 395.553f, Y = 394.966f, Z = 0.1f });
}); //spawn Azmodan
this.Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_03, () =>
Game.AddOnLoadWorldAction(WorldSno.a3_battlefields_03, () =>
{
var world = this.Game.GetWorld(WorldSno.a3_battlefields_03);
var world = Game.GetWorld(WorldSno.a3_battlefields_03);
try { world.GetActorBySNO(ActorSno._siegebreakerdemon).Destroy(); } catch { }
world.SpawnMonster(ActorSno._siegebreakerdemon, new Vector3D { X = 396.565f, Y = 366.167f, Z = 0.1f });
}); //spawn Siegebreaker
@ -78,7 +78,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[312429].Steps.Add(2, new QuestStep
Game.QuestManager.Quests[312429].Steps.Add(2, new QuestStep
{
Completed = false,
Saveable = true,
@ -88,7 +88,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.Quests[312429].Steps.Add(1, new QuestStep
Game.QuestManager.Quests[312429].Steps.Add(1, new QuestStep
{
Completed = false,
Saveable = true,
@ -101,9 +101,9 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
#region Nephalem Portal
this.Game.QuestManager.SideQuests.Add(382695, new Quest { RewardXp = 10000, RewardGold = 1000, Completed = false, Saveable = false, NextQuest = -1, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.SideQuests.Add(382695, new Quest { RewardXp = 10000, RewardGold = 1000, Completed = false, Saveable = false, NextQuest = -1, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.SideQuests[382695].Steps.Add(-1, new QuestStep
Game.QuestManager.SideQuests[382695].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = false,
@ -114,7 +114,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.SideQuests[382695].Steps.Add(1, new QuestStep
Game.QuestManager.SideQuests[382695].Steps.Add(1, new QuestStep
{
Completed = false,
Saveable = false,
@ -127,17 +127,17 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.SideQuests[382695].Steps.Add(3, new QuestStep
Game.QuestManager.SideQuests[382695].Steps.Add(3, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = -1,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //complete
var NephalemWorld = this.Game.GetWorld(this.Game.WorldOfPortalNephalem);
var NephalemWorld = Game.GetWorld(Game.WorldOfPortalNephalem);
ActorSystem.Actor BossOfPortal = null;
switch (this.Game.WorldOfPortalNephalem)
switch (Game.WorldOfPortalNephalem)
{
default:
List<MapSystem.Scene> Scenes = new List<MapSystem.Scene>();
@ -163,7 +163,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.SideQuests[382695].Steps.Add(10, new QuestStep
Game.QuestManager.SideQuests[382695].Steps.Add(10, new QuestStep
{
Completed = false,
Saveable = false,
@ -173,14 +173,14 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.SideQuests[382695].Steps.Add(5, new QuestStep
Game.QuestManager.SideQuests[382695].Steps.Add(5, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = -1,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //complete
foreach (var plr in this.Game.Players.Values)
foreach (var plr in Game.Players.Values)
{
}
@ -192,9 +192,9 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
#region Nephalem Portal
this.Game.QuestManager.SideQuests.Add(337492, new Quest { RewardXp = 10000, RewardGold = 1000, Completed = false, Saveable = false, NextQuest = -1, Steps = new Dictionary<int, QuestStep> { } });
Game.QuestManager.SideQuests.Add(337492, new Quest { RewardXp = 10000, RewardGold = 1000, Completed = false, Saveable = false, NextQuest = -1, Steps = new Dictionary<int, QuestStep> { } });
this.Game.QuestManager.SideQuests[337492].Steps.Add(-1, new QuestStep
Game.QuestManager.SideQuests[337492].Steps.Add(-1, new QuestStep
{
Completed = false,
Saveable = false,
@ -205,7 +205,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.SideQuests[337492].Steps.Add(1, new QuestStep
Game.QuestManager.SideQuests[337492].Steps.Add(1, new QuestStep
{
Completed = false,
Saveable = false,
@ -216,7 +216,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.SideQuests[337492].Steps.Add(3, new QuestStep
Game.QuestManager.SideQuests[337492].Steps.Add(3, new QuestStep
{
Completed = false,
Saveable = false,
@ -228,7 +228,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.SideQuests[337492].Steps.Add(10, new QuestStep
Game.QuestManager.SideQuests[337492].Steps.Add(10, new QuestStep
{
Completed = false,
Saveable = false,
@ -239,14 +239,14 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
})
});
this.Game.QuestManager.SideQuests[337492].Steps.Add(5, new QuestStep
Game.QuestManager.SideQuests[337492].Steps.Add(5, new QuestStep
{
Completed = false,
Saveable = false,
NextStep = -1,
Objectives = new List<Objective> { new Objective { Limit = 1, Counter = 0 } },
OnAdvance = new Action(() => { //complete
foreach (var plr in this.Game.Players.Values)
foreach (var plr in Game.Players.Values)
{
}

View File

@ -10,12 +10,12 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents
public AskBossEncounter(int encSNOid)
: base(0)
{
this.Encounter = encSNOid;
Encounter = encSNOid;
}
public override void Execute(MapSystem.World world)
{
world.Game.TeleportToBossEncounter(this.Encounter);
world.Game.TeleportToBossEncounter(Encounter);
}
}
}

View File

@ -9,7 +9,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents
public ChangeAct(int actId)
: base(0)
{
this.ActId = actId;
ActId = actId;
}
public override void Execute(MapSystem.World world)
@ -18,7 +18,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents
plr.ShowConfirmation(world.GetActorBySNO(GetChangeActor()).DynamicID(plr), (() =>
{
world.Game.QuestManager.Advance();
world.Game.ChangeAct(this.ActId);
world.Game.ChangeAct(ActId);
}));
}

View File

@ -19,7 +19,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents
public CompleteObjective(int objId)
: base(0)
{
this.objectiveId = objId;
objectiveId = objId;
}
public override void Execute(MapSystem.World world)
@ -27,7 +27,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents
if (!outplayed)
{
outplayed = true;
world.Game.QuestManager.CompleteObjective(this.objectiveId);
world.Game.QuestManager.CompleteObjective(objectiveId);
}
}
}

View File

@ -43,7 +43,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents
foreach (var plr in world.Players.Values)
{
plr.Conversations.StartConversation(this.ConversationId);
plr.Conversations.StartConversation(ConversationId);
plr.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Camera.CameraCriptedSequenceStartMessage() { Activate = true });
plr.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Camera.CameraFocusMessage() { ActorID = (int)Imperius.DynamicID(plr), Duration = 1f, Snap = false });

View File

@ -28,18 +28,18 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents
public Invasion(Vector3D center, float radius, List<ActorSno> mobs, float duration, ActorSno lastMob, bool lastSolo)
: base(0)
{
this.Radius = radius;
this.Center = center;
this.Monsters = mobs;
this.Duration = duration;
this.LastMob = lastMob;
this.LastSolo = lastSolo;
Radius = radius;
Center = center;
Monsters = mobs;
Duration = duration;
LastMob = lastMob;
LastSolo = lastSolo;
}
public override void Execute(MapSystem.World world)
{
var marker = world.SpawnMonster(ActorSno._generic_proxy_normal, this.Center);
world.BuffManager.AddBuff(marker, marker, new PowerSystem.Implementations.InvasionBuff(TickTimer.WaitSeconds(world.Game, this.Duration), this.Monsters, this.Radius, this.LastMob, this.LastSolo));
var marker = world.SpawnMonster(ActorSno._generic_proxy_normal, Center);
world.BuffManager.AddBuff(marker, marker, new PowerSystem.Implementations.InvasionBuff(TickTimer.WaitSeconds(world.Game, Duration), Monsters, Radius, LastMob, LastSolo));
}
}
}

View File

@ -19,14 +19,14 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents
public LaunchConversation(int convSNOid)
: base(0)
{
this.ConversationId = convSNOid;
ConversationId = convSNOid;
}
public override void Execute(MapSystem.World world)
{
foreach (var plr in world.Players.Values)
{
plr.Conversations.StartConversation(this.ConversationId);
plr.Conversations.StartConversation(ConversationId);
}
}
}

Some files were not shown because too many files have changed in this diff Show More