Merge branch 'community' into optimizations
# Conflicts: # src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/Game.cs # src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs
This commit is contained in:
commit
f39f26f7e2
@ -266,7 +266,7 @@ namespace DiIiS_NA.LoginServer.Battle
|
||||
if (method.Name == "KeepAlive")
|
||||
{
|
||||
Logger.Debug(
|
||||
$"Call: $[olive]{service.GetType().Name}$[/]$, Service hash: $[olive]{header.ServiceHash}$[/]$, Method: $[olive]{method.Name}$[/]$, ID: $[olive]{header.MethodId}$[/]$");
|
||||
$"Call: $[olive]${service.GetType().Name}$[/]$, Service hash: $[olive]${header.ServiceHash}$[/]$, Method: $[olive]${method.Name}$[/]$, ID: $[olive]${header.MethodId}$[/]$");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -77,9 +77,9 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
|
||||
const int seasonState = 1;
|
||||
const int leaderboardEra = 1;
|
||||
const int anniversaryEventStatus = 1;
|
||||
const int challangeRiftNumber = 1;
|
||||
const int challengeRiftNumber = 1;
|
||||
const bool freeToPlay = true;
|
||||
const bool storeStatus = true; // false
|
||||
const bool storeStatus = false; // false
|
||||
const string catalogDigest = "C42DC6117A7008EDA2006542D6C07EAD096DAD90";
|
||||
const string catalogVersion = "633565800390338000";
|
||||
const int regionId = 1;
|
||||
@ -89,7 +89,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
|
||||
$" OnlineService.Season.State={seasonState}" + //Season status, 1 - Activated, 0 - Deactivated
|
||||
$" OnlineService.Leaderboard.Era={leaderboardEra}" +
|
||||
$" OnlineService.AnniversaryEvent.Status={anniversaryEventStatus}" + //Anniversary Event, 1st Old Tristam
|
||||
$" ChallengeRift.ChallengeNumber={challangeRiftNumber}" + //Rift portal number.
|
||||
$" ChallengeRift.ChallengeNumber={challengeRiftNumber}" + //Rift portal number.
|
||||
$" OnlineService.FreeToPlay={freeToPlay}" + //Shop for Platinum
|
||||
$" OnlineService.Store.Status={(storeStatus ? "1" : "0")}" + //Store Status, 0 - Enabled, 1 - Disabled
|
||||
$" OnlineService.Store.ProductCatalogDigest={catalogDigest}" + //China
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Spectre.Console;
|
||||
@ -93,39 +94,57 @@ public class AnsiTarget : LogTarget
|
||||
{
|
||||
if (CancellationTokenSource.IsCancellationRequested)
|
||||
return;
|
||||
if (IncludeTimeStamps)
|
||||
_table.AddRow(
|
||||
new Markup(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff"), GetStyleByLevel(level)),
|
||||
new Markup(level.ToString(), GetStyleByLevel(level)).RightJustified(),
|
||||
new Markup(logger, GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup(Cleanup(message), GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup("", new Style(foreground: Color.Green3_1)).Centered());
|
||||
else
|
||||
_table.AddRow(
|
||||
new Markup(level.ToString()).RightJustified(),
|
||||
new Markup(logger, GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup(Cleanup(message), GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup("", new Style(foreground: Color.Green3_1)).Centered());
|
||||
try
|
||||
{
|
||||
if (IncludeTimeStamps)
|
||||
_table.AddRow(
|
||||
new Markup(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff"), GetStyleByLevel(level)),
|
||||
new Markup(level.ToString(), GetStyleByLevel(level)).RightJustified(),
|
||||
new Markup(logger, GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup(Cleanup(message), GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup("", new Style(foreground: Color.Green3_1)).Centered());
|
||||
else
|
||||
_table.AddRow(
|
||||
new Markup(level.ToString()).RightJustified(),
|
||||
new Markup(logger, GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup(Cleanup(message), GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup("", new Style(foreground: Color.Green3_1)).Centered());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debugger.Break();
|
||||
}
|
||||
}
|
||||
|
||||
public override void LogException(Logger.Level level, string logger, string message, Exception exception)
|
||||
{
|
||||
if (CancellationTokenSource.IsCancellationRequested)
|
||||
return;
|
||||
if (IncludeTimeStamps)
|
||||
_table.AddRow(
|
||||
new Markup(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff"), GetStyleByLevel(level)),
|
||||
new Markup(level.ToString(), GetStyleByLevel(level)).RightJustified(),
|
||||
new Markup(logger, GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup(Cleanup(message), GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup($"[underline red3_1 on white]{exception.GetType().Name}[/]\n" + Cleanup(exception.Message), new Style(foreground: Color.Red3_1)).Centered());
|
||||
else
|
||||
_table.AddRow(
|
||||
new Markup(level.ToString()).RightJustified(),
|
||||
new Markup(logger, GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup(message, GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup($"[underline red3_1 on white]{exception.GetType().Name}[/]\n" + Cleanup(exception.Message), new Style(foreground: Color.Red3_1)).Centered());
|
||||
}
|
||||
try
|
||||
{
|
||||
if (IncludeTimeStamps)
|
||||
_table.AddRow(
|
||||
new Markup(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff"), GetStyleByLevel(level)),
|
||||
new Markup(level.ToString(), GetStyleByLevel(level)).RightJustified(),
|
||||
new Markup(logger, GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup(Cleanup(message), GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup(
|
||||
$"[underline red3_1 on white]{exception.GetType().Name}[/]\n" + Cleanup(exception.Message),
|
||||
new Style(foreground: Color.Red3_1)).Centered());
|
||||
else
|
||||
_table.AddRow(
|
||||
new Markup(level.ToString()).RightJustified(),
|
||||
new Markup(logger, GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup(message, GetStyleByLevel(level)).LeftJustified(),
|
||||
new Markup(
|
||||
$"[underline red3_1 on white]{exception.GetType().Name}[/]\n" + Cleanup(exception.Message),
|
||||
new Style(foreground: Color.Red3_1)).Centered());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debugger.Break();
|
||||
}
|
||||
}
|
||||
|
||||
private static Style GetStyleByLevel(Logger.Level level)
|
||||
{
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
//Blizzless Project 2022
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
@ -102,7 +103,14 @@ namespace DiIiS_NA.Core.Logging
|
||||
public void Trace(string message, params object[] args) => Log(Level.Trace, message, args);
|
||||
|
||||
/// <param name="message">The log message.</param>
|
||||
public void MethodTrace(string message, [CallerMemberName] string methodName = "") => Log(Level.MethodTrace, $"$[olive]${methodName}()$[/]$: " + message, null);
|
||||
public void MethodTrace(string message, [CallerMemberName] string methodName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0)
|
||||
{
|
||||
#if DEBUG
|
||||
Log(Level.MethodTrace, $"$[darkolivegreen3_2]${methodName}()$[/]$ @ {lineNumber}: " + message, null);
|
||||
#else
|
||||
Log(Level.MethodTrace, $"$[darkolivegreen3_2]${methodName}()$[/]$: " + message, null);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <param name="message">The log message.</param>
|
||||
public void Debug(string message) => Log(Level.Debug, message, null);
|
||||
|
||||
@ -56,17 +56,17 @@ namespace DiIiS_NA.GameServer.ClientSystem
|
||||
var game = GameManager.GetGameById(message.SGameId);
|
||||
Toon toon = null;
|
||||
if (game != null)
|
||||
toon = ToonManager.GetToonByLowID((ulong)message.HeroID, game.GameDBSession);
|
||||
toon = ToonManager.GetToonByLowID((ulong)message.HeroID, game.GameDbSession);
|
||||
bool PVP = false;
|
||||
if (PVP)
|
||||
toon = new Toon(ToonManager.CreateFakeDBToon(toon.GameAccount.Owner.BattleTag, toon.GameAccount.DBGameAccount), game.GameDBSession);
|
||||
toon = new Toon(ToonManager.CreateFakeDBToon(toon.GameAccount.Owner.BattleTag, toon.GameAccount.DBGameAccount), game.GameDbSession);
|
||||
|
||||
if (game == null)
|
||||
{
|
||||
if (PVP)
|
||||
{
|
||||
game = GameManager.CreateGame(message.SGameId, 1);
|
||||
toon = ToonManager.GetToonByLowID((ulong)message.HeroID, game.GameDBSession);
|
||||
toon = ToonManager.GetToonByLowID((ulong)message.HeroID, game.GameDbSession);
|
||||
game.SetAct(0);
|
||||
}
|
||||
else
|
||||
|
||||
@ -125,6 +125,15 @@ namespace DiIiS_NA.GameServer
|
||||
set => Set(nameof(ChanceNormalUnidentified), value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resurrection charges on changing worlds
|
||||
/// </summary>
|
||||
public int ResurrectionCharges
|
||||
{
|
||||
get => GetInt(nameof(ResurrectionCharges), 3);
|
||||
set => Set(nameof(ResurrectionCharges), value);
|
||||
}
|
||||
|
||||
public static Config Instance { get; } = new();
|
||||
|
||||
private Config() : base("Game-Server")
|
||||
|
||||
@ -220,7 +220,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
||||
/// <param name="sno">SNOId of the actor.</param>
|
||||
/// <param name="tags">TagMapEntry dictionary read for the actor from MPQ's..</param>
|
||||
protected Actor(World world, ActorSno sno, TagMap tags, bool isMarker = false)
|
||||
: base(world, world.IsPvP ? World.NewActorPvPID : world.Game.NewActorGameID)
|
||||
: base(world, world.IsPvP ? World.NewActorPvPID : world.Game.NewActorGameId)
|
||||
{
|
||||
Tags = tags;
|
||||
|
||||
|
||||
@ -235,7 +235,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
||||
if (Encounter == 0) return;
|
||||
//if (this.World.Game.CurrentEncounter.activated) return;
|
||||
|
||||
World.Game.CurrentEncounter.activated = true;
|
||||
World.Game.CurrentEncounter.Activated = true;
|
||||
World.Game.CurrentEncounter.SnoId = Encounter;
|
||||
|
||||
foreach (Player plr in World.Game.Players.Values)
|
||||
|
||||
@ -7,6 +7,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DiIiS_NA.Core.Logging;
|
||||
using DiIiS_NA.Core.MPQ.FileFormats;
|
||||
|
||||
namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
||||
{
|
||||
@ -66,6 +68,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
||||
)/*Act Bosses*/]
|
||||
public sealed class Boss : Monster
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.CreateLogger(nameof(Boss));
|
||||
public Boss(MapSystem.World world, ActorSno sno, TagMap tags)
|
||||
: base(world, sno, tags)
|
||||
{
|
||||
@ -74,9 +77,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
||||
//this.Attributes[GameAttribute.Immune_To_Charm] = true;
|
||||
Attributes[GameAttribute.using_Bossbar] = true;
|
||||
Attributes[GameAttribute.InBossEncounter] = true;
|
||||
Attributes[GameAttribute.Hitpoints_Max] *= 10.0f;
|
||||
Attributes[GameAttribute.Damage_Weapon_Min, 0] *= 7.8f;
|
||||
Attributes[GameAttribute.Damage_Weapon_Delta, 0] *= 7.8f;
|
||||
Attributes[GameAttribute.Hitpoints_Max] *= 4f;
|
||||
Attributes[GameAttribute.Damage_Weapon_Min, 0] *= 3f;
|
||||
Attributes[GameAttribute.Damage_Weapon_Delta, 0] *= 3f;
|
||||
Attributes[GameAttribute.Hitpoints_Cur] = Attributes[GameAttribute.Hitpoints_Max_Total];
|
||||
Attributes[GameAttribute.TeamID] = 10;
|
||||
|
||||
@ -181,14 +184,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
||||
|
||||
public override int Quality
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)DiIiS_NA.Core.MPQ.FileFormats.SpawnType.Boss;
|
||||
}
|
||||
set
|
||||
{
|
||||
// TODO MonsterQuality setter not implemented. Throwing a NotImplementedError is catched as message not beeing implemented and nothing works anymore...
|
||||
}
|
||||
get => (int) SpawnType.Boss;
|
||||
set => Logger.Warn("Boss MonsterQuality setter not implemented.");
|
||||
// TODO MonsterQuality setter not implemented. Throwing a NotImplementedError is catched as message not beeing implemented and nothing works anymore...
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
|
||||
public void SetSkill(Player player, int SkillSNOId)
|
||||
{
|
||||
var dbhireling = player.World.Game.GameDBSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 3).ToList().First();
|
||||
var dbhireling = player.World.Game.GameDbSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 3).ToList().First();
|
||||
switch (SkillSNOId)
|
||||
{
|
||||
case 102057:
|
||||
@ -40,7 +40,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.BroadcastChangedIfRevealed();
|
||||
|
||||
dbhireling.Skill1SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
case 102133:
|
||||
case 101461:
|
||||
@ -50,7 +50,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.BroadcastChangedIfRevealed();
|
||||
|
||||
dbhireling.Skill2SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
case 101990:
|
||||
case 220872:
|
||||
@ -60,7 +60,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.BroadcastChangedIfRevealed();
|
||||
|
||||
dbhireling.Skill3SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
case 101425:
|
||||
case 201524:
|
||||
@ -70,7 +70,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.BroadcastChangedIfRevealed();
|
||||
|
||||
dbhireling.Skill4SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@ -79,12 +79,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
|
||||
public void Retrain(Player player)
|
||||
{
|
||||
var dbhireling = player.World.Game.GameDBSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 3).ToList().First();
|
||||
var dbhireling = player.World.Game.GameDbSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 3).ToList().First();
|
||||
dbhireling.Skill1SNOId = -1;
|
||||
dbhireling.Skill2SNOId = -1;
|
||||
dbhireling.Skill3SNOId = -1;
|
||||
dbhireling.Skill4SNOId = -1;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
|
||||
player.HirelingInfo[3].Skill1SNOId = -1;
|
||||
player.HirelingInfo[3].Skill2SNOId = -1;
|
||||
|
||||
@ -448,7 +448,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
public void LoadInventory(Player player)
|
||||
{
|
||||
_equipment.Add(player, new Dictionary<int, Item>());
|
||||
var inventory_list = World.Game.GameDBSession.SessionQueryWhere<DBInventory>(dbi => dbi.DBToon.Id == player.Toon.PersistentID && dbi.HirelingId != 0 && dbi.HirelingId == Attributes[GameAttribute.Hireling_Class]);
|
||||
var inventory_list = World.Game.GameDbSession.SessionQueryWhere<DBInventory>(dbi => dbi.DBToon.Id == player.Toon.PersistentID && dbi.HirelingId != 0 && dbi.HirelingId == Attributes[GameAttribute.Hireling_Class]);
|
||||
foreach (var inv_item in inventory_list)
|
||||
{
|
||||
Item item = ItemGenerator.LoadFromDB(player, inv_item);
|
||||
@ -476,7 +476,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
item.DBInventory.EquipmentSlot = slot;
|
||||
item.DBInventory.LocationX = 0;
|
||||
item.DBInventory.LocationY = 0;
|
||||
World.Game.GameDBSession.SessionUpdate(item.DBInventory);
|
||||
World.Game.GameDbSession.SessionUpdate(item.DBInventory);
|
||||
item.Attributes[GameAttribute.Item_Equipped] = true;
|
||||
_equipment[owner].Add(slot, item);
|
||||
RefreshEquipment(owner);
|
||||
@ -494,7 +494,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
|
||||
item.Owner = owner;
|
||||
_equipment[owner].Remove(slot);
|
||||
World.Game.GameDBSession.SessionDelete(item.DBInventory);
|
||||
World.Game.GameDbSession.SessionDelete(item.DBInventory);
|
||||
owner.Inventory.PickUp(item);
|
||||
item.Unreveal(owner);
|
||||
item.Attributes[GameAttribute.Item_Equipped] = false;
|
||||
|
||||
@ -31,7 +31,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
|
||||
public void SetSkill(Player player, int SkillSNOId)
|
||||
{
|
||||
var dbhireling = player.World.Game.GameDBSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 3).ToList().First();
|
||||
var dbhireling = player.World.Game.GameDbSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 3).ToList().First();
|
||||
switch (SkillSNOId)
|
||||
{
|
||||
case 102057:
|
||||
@ -42,7 +42,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.BroadcastChangedIfRevealed();
|
||||
|
||||
dbhireling.Skill1SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
case 102133:
|
||||
case 101461:
|
||||
@ -52,7 +52,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.BroadcastChangedIfRevealed();
|
||||
|
||||
dbhireling.Skill2SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
case 101990:
|
||||
case 220872:
|
||||
@ -62,7 +62,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.BroadcastChangedIfRevealed();
|
||||
|
||||
dbhireling.Skill3SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
case 101425:
|
||||
case 201524:
|
||||
@ -72,7 +72,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.BroadcastChangedIfRevealed();
|
||||
|
||||
dbhireling.Skill4SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@ -81,12 +81,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
|
||||
public void Retrain(Player player)
|
||||
{
|
||||
var dbhireling = player.World.Game.GameDBSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 3).ToList().First();
|
||||
var dbhireling = player.World.Game.GameDbSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 3).ToList().First();
|
||||
dbhireling.Skill1SNOId = -1;
|
||||
dbhireling.Skill2SNOId = -1;
|
||||
dbhireling.Skill3SNOId = -1;
|
||||
dbhireling.Skill4SNOId = -1;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
|
||||
player.HirelingInfo[3].Skill1SNOId = -1;
|
||||
player.HirelingInfo[3].Skill2SNOId = -1;
|
||||
|
||||
@ -29,7 +29,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
|
||||
public void SetSkill(Player player, int SkillSNOId)
|
||||
{
|
||||
var dbhireling = player.World.Game.GameDBSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 2).ToList().First();
|
||||
var dbhireling = player.World.Game.GameDbSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 2).ToList().First();
|
||||
switch (SkillSNOId)
|
||||
{
|
||||
case 95675:
|
||||
@ -40,7 +40,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.SendChangedMessage(player.InGameClient);
|
||||
|
||||
dbhireling.Skill1SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
case 97436:
|
||||
case 30464:
|
||||
@ -50,7 +50,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.SendChangedMessage(player.InGameClient);
|
||||
|
||||
dbhireling.Skill2SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
case 95690:
|
||||
case 30458:
|
||||
@ -60,7 +60,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.SendChangedMessage(player.InGameClient);
|
||||
|
||||
dbhireling.Skill3SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
case 200169:
|
||||
case 30454:
|
||||
@ -70,7 +70,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.SendChangedMessage(player.InGameClient);
|
||||
|
||||
dbhireling.Skill4SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@ -79,12 +79,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
|
||||
public void Retrain(Player player)
|
||||
{
|
||||
var dbhireling = player.World.Game.GameDBSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 2).ToList().First();
|
||||
var dbhireling = player.World.Game.GameDbSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 2).ToList().First();
|
||||
dbhireling.Skill1SNOId = -1;
|
||||
dbhireling.Skill2SNOId = -1;
|
||||
dbhireling.Skill3SNOId = -1;
|
||||
dbhireling.Skill4SNOId = -1;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
|
||||
player.HirelingInfo[2].Skill1SNOId = -1;
|
||||
player.HirelingInfo[2].Skill2SNOId = -1;
|
||||
|
||||
@ -29,7 +29,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
|
||||
public void SetSkill(Player player, int SkillSNOId)
|
||||
{
|
||||
var dbhireling = player.World.Game.GameDBSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 1).ToList().First();
|
||||
var dbhireling = player.World.Game.GameDbSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 1).ToList().First();
|
||||
switch (SkillSNOId)
|
||||
{
|
||||
case 1747:
|
||||
@ -40,7 +40,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.SendChangedMessage(player.InGameClient);
|
||||
|
||||
dbhireling.Skill1SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
case 30357:
|
||||
case 93901:
|
||||
@ -50,7 +50,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.SendChangedMessage(player.InGameClient);
|
||||
|
||||
dbhireling.Skill2SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
case 30360:
|
||||
case 93888:
|
||||
@ -60,7 +60,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.SendChangedMessage(player.InGameClient);
|
||||
|
||||
dbhireling.Skill3SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
case 30356:
|
||||
case 30359:
|
||||
@ -70,7 +70,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
Attributes.SendChangedMessage(player.InGameClient);
|
||||
|
||||
dbhireling.Skill4SNOId = SkillSNOId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@ -79,12 +79,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
|
||||
|
||||
public void Retrain(Player player)
|
||||
{
|
||||
var dbhireling = player.World.Game.GameDBSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 1).ToList().First();
|
||||
var dbhireling = player.World.Game.GameDbSession.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == player.Toon.PersistentID && dbh.Class == 1).ToList().First();
|
||||
dbhireling.Skill1SNOId = -1;
|
||||
dbhireling.Skill2SNOId = -1;
|
||||
dbhireling.Skill3SNOId = -1;
|
||||
dbhireling.Skill4SNOId = -1;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbhireling);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbhireling);
|
||||
|
||||
player.HirelingInfo[1].Skill1SNOId = -1;
|
||||
player.HirelingInfo[1].Skill2SNOId = -1;
|
||||
|
||||
@ -59,7 +59,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
||||
|
||||
var toon = player.Toon.DBToon;
|
||||
toon.ChestsOpened++;
|
||||
World.Game.GameDBSession.SessionUpdate(toon);
|
||||
World.Game.GameDbSession.SessionUpdate(toon);
|
||||
}
|
||||
|
||||
base.OnTargeted(player, message);
|
||||
|
||||
@ -45,7 +45,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
||||
private void ReadWaypointId()
|
||||
{
|
||||
bool isOpenWorld = World.Game.CurrentAct == 3000;
|
||||
var actData = ((DiIiS_NA.Core.MPQ.FileFormats.Act)MPQStorage.Data.Assets[SNOGroup.Act][World.Game.CurrentActSNOid].Data).WayPointInfo.ToList();
|
||||
var actData = ((DiIiS_NA.Core.MPQ.FileFormats.Act)MPQStorage.Data.Assets[SNOGroup.Act][World.Game.CurrentActSnoId].Data).WayPointInfo.ToList();
|
||||
if (isOpenWorld)
|
||||
actData = ((DiIiS_NA.Core.MPQ.FileFormats.Act)MPQStorage.Data.Assets[SNOGroup.Act][70015].Data).WayPointInfo
|
||||
.Union(((DiIiS_NA.Core.MPQ.FileFormats.Act)MPQStorage.Data.Assets[SNOGroup.Act][70016].Data).WayPointInfo)
|
||||
@ -234,7 +234,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
||||
|
||||
if (World.Game.OpenedWaypoints.Contains(WaypointId) || World.Game.CurrentAct == 3000) return;
|
||||
|
||||
Logger.Debug("(OnTargeted) Waypoint has been activated: {0}, levelArea: {1}", WaypointId, SNOLevelArea);
|
||||
Logger.MethodTrace($"Waypoint has been activated: {WaypointId}, levelArea: {SNOLevelArea}");
|
||||
|
||||
World.BroadcastIfRevealed(plr => new WaypointActivatedMessage
|
||||
{
|
||||
|
||||
@ -1,109 +1,73 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MonsterFF = DiIiS_NA.Core.MPQ.FileFormats.Monster;
|
||||
using GameBalance = DiIiS_NA.Core.MPQ.FileFormats.GameBalance;
|
||||
using DiIiS_NA.GameServer.GSSystem.ObjectsSystem;
|
||||
using DiIiS_NA.Core.Logging;
|
||||
using DiIiS_NA.Core.MPQ.FileFormats;
|
||||
using DiIiS_NA.GameServer.GSSystem.TickerSystem;
|
||||
using DiIiS_NA.GameServer.MessageSystem;
|
||||
using DiIiS_NA.GameServer.Core.Types.SNO;
|
||||
using DiIiS_NA.GameServer.GSSystem.PlayerSystem;
|
||||
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.World;
|
||||
using DiIiS_NA.GameServer.Core.Types.TagMap;
|
||||
using DiIiS_NA.GameServer.GSSystem.MapSystem;
|
||||
using DiIiS_NA.GameServer.Core.Types.Math;
|
||||
using DiIiS_NA.GameServer.GSSystem.AISystem.Brains;
|
||||
using DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations;
|
||||
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.ACD;
|
||||
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
||||
using World = DiIiS_NA.GameServer.GSSystem.MapSystem.World;
|
||||
|
||||
namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
||||
{
|
||||
public class Monster : Living, IUpdateable
|
||||
{
|
||||
public override ActorType ActorType { get { return ActorType.Monster; } }
|
||||
private static readonly Logger Logger = LogManager.CreateLogger(nameof(Monster));
|
||||
|
||||
static readonly Logger Logger = LogManager.CreateLogger();
|
||||
public override ActorType ActorType => ActorType.Monster;
|
||||
public TickTimer DestroyTimer { get; }
|
||||
|
||||
public TickTimer DestroyTimer;
|
||||
|
||||
private int AdjustedPlayers = 1;
|
||||
private object adjustLock = new object();
|
||||
private float _nativeHP = 0f;
|
||||
private int _adjustedPlayers = 1;
|
||||
private object _adjustLock = new object();
|
||||
private float _nativeHp = 0f;
|
||||
private float _nativeDmg = 0f;
|
||||
public Vector3D CorrectedPosition = null;
|
||||
public override int Quality
|
||||
{
|
||||
get
|
||||
{
|
||||
if(SNO == ActorSno._x1_lr_boss_mistressofpain)
|
||||
return 7;
|
||||
return (int)DiIiS_NA.Core.MPQ.FileFormats.SpawnType.Normal;
|
||||
//return (int)Mooege.Common.MPQ.FileFormats.SpawnType.Champion;
|
||||
//return (int)Mooege.Common.MPQ.FileFormats.SpawnType.Rare;
|
||||
//return (int)Mooege.Common.MPQ.FileFormats.SpawnType.Minion;
|
||||
//return (int)Mooege.Common.MPQ.FileFormats.SpawnType.Unique;
|
||||
//return (int)Mooege.Common.MPQ.FileFormats.SpawnType.Hireling;
|
||||
//return (int)Mooege.Common.MPQ.FileFormats.SpawnType.Clone;
|
||||
//return (int)Mooege.Common.MPQ.FileFormats.SpawnType.Boss;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
get => SNO == ActorSno._x1_lr_boss_mistressofpain ? 7 : (int)SpawnType.Normal;
|
||||
set => Logger.Warn("Quality of monster cannot be changed");
|
||||
}
|
||||
|
||||
public int LoreSNOId
|
||||
{
|
||||
get
|
||||
{
|
||||
return Monster.IsValid ? (Monster.Target as MonsterFF).SNOLore : -1;
|
||||
}
|
||||
}
|
||||
public int LoreSnoId => Monster.IsValid ? ((MonsterFF)Monster.Target).SNOLore : -1;
|
||||
|
||||
public int MonsterType
|
||||
{
|
||||
get
|
||||
{
|
||||
return Monster.IsValid ? (int)(Monster.Target as MonsterFF).Type : -1;
|
||||
}
|
||||
}
|
||||
public int MonsterType => Monster.IsValid ? (int)((MonsterFF)Monster.Target).Type : -1;
|
||||
|
||||
public float HPMultiplier
|
||||
{
|
||||
get
|
||||
{
|
||||
return Monster.IsValid ? (1f + (Monster.Target as MonsterFF).AttributeModifiers[4]) : 1f;
|
||||
}
|
||||
}
|
||||
public float HpMultiplier => Monster.IsValid ? (1f + ((MonsterFF)Monster.Target).AttributeModifiers[4]) : 1f;
|
||||
|
||||
public float DmgMultiplier
|
||||
{
|
||||
get
|
||||
{
|
||||
return Monster.IsValid ? (1f + (Monster.Target as MonsterFF).AttributeModifiers[55]) : 1f;
|
||||
}
|
||||
}
|
||||
public float DmgMultiplier => Monster.IsValid ? (1f + ((MonsterFF)Monster.Target).AttributeModifiers[55]) : 1f;
|
||||
public Vector3D BasePoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Actors summoning fields from the mpq's and returns them in format for Monsters.
|
||||
/// Useful for the Monsters spawning/summoning skills.
|
||||
/// </summary>
|
||||
public ActorSno[] SNOSummons
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Monster.Target as MonsterFF).SNOSummonActor.Select(x => (ActorSno)x).ToArray();
|
||||
}
|
||||
}
|
||||
public ActorSno[] SnoSummons => ((MonsterFF)Monster.Target).SNOSummonActor.Select(x => (ActorSno)x).ToArray();
|
||||
|
||||
public Monster(World world, ActorSno sno, TagMap tags)
|
||||
: base(world, sno, tags)
|
||||
{
|
||||
#if DEBUG
|
||||
if (this is Boss boss)
|
||||
{
|
||||
Logger.Info($"Boss $[underline]${boss.SNO}$[/]$ created");
|
||||
}
|
||||
#endif
|
||||
|
||||
Field2 = 0x8;
|
||||
GBHandle.Type = (int)ActorType.Monster; GBHandle.GBID = 1;
|
||||
Attributes[GameAttribute.TeamID] = 9;
|
||||
if (Monster.Id != -1)
|
||||
WalkSpeed = (Monster.Target as MonsterFF).AttributeModifiers[129];
|
||||
WalkSpeed = ((MonsterFF)Monster.Target).AttributeModifiers[129];
|
||||
//WalkSpeed /= 2f;
|
||||
|
||||
Brain = new MonsterBrain(this);
|
||||
@ -114,48 +78,49 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
||||
|
||||
public override void OnTargeted(Player player, TargetMessage message)
|
||||
{
|
||||
|
||||
#if DEBUG
|
||||
string monster = "monster";
|
||||
if (this is Boss) monster = "boss";
|
||||
Logger.MethodTrace($"Player {player.Name} targeted {monster} {GetType().Name}.");
|
||||
#endif
|
||||
}
|
||||
|
||||
public void UpdateStats()
|
||||
{
|
||||
var monsterLevels = (GameBalance)DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[SNOGroup.GameBalance][19760].Data;
|
||||
bool full_hp = (Attributes[GameAttribute.Hitpoints_Cur] == Attributes[GameAttribute.Hitpoints_Max_Total]);
|
||||
bool fullHp = (Math.Abs(Attributes[GameAttribute.Hitpoints_Cur] - Attributes[GameAttribute.Hitpoints_Max_Total]) < 0.001);
|
||||
Attributes[GameAttribute.Level] = World.Game.MonsterLevel;
|
||||
//this.Attributes[GameAttribute.Hitpoints_Max] = (int)monsterLevels.MonsterLevel[this.World.Game.MonsterLevel - 1].HPMin * (int)this.HPMultiplier * (int)this.World.Game.HPModifier;
|
||||
int MonsterLevel = 1;
|
||||
if (World.Game.ConnectedPlayers.Count > 1)
|
||||
MonsterLevel = World.Game.ConnectedPlayers[0].Level;
|
||||
else
|
||||
MonsterLevel = World.Game.InitialMonsterLevel;
|
||||
int monsterLevel = 1;
|
||||
monsterLevel = World.Game.ConnectedPlayers.Length > 1 ? World.Game.ConnectedPlayers[0].Level : World.Game.InitialMonsterLevel;
|
||||
|
||||
|
||||
Attributes[GameAttribute.Hitpoints_Max] = (int)((int)monsterLevels.MonsterLevel[MonsterLevel].HPMin + DiIiS_NA.Core.Helpers.Math.RandomHelper.Next(0, (int)monsterLevels.MonsterLevel[MonsterLevel].HPDelta) * HPMultiplier * World.Game.HPModifier);
|
||||
Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative] = ((int)World.Game.ConnectedPlayers.Count + 1) * 1.5f;
|
||||
Attributes[GameAttribute.Hitpoints_Max] = (int)((int)monsterLevels.MonsterLevel[monsterLevel].HPMin + DiIiS_NA.Core.Helpers.Math.RandomHelper.Next(0, (int)monsterLevels.MonsterLevel[monsterLevel].HPDelta) * HpMultiplier * World.Game.HpModifier);
|
||||
Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative] = ((int)World.Game.ConnectedPlayers.Length + 1) * 1.5f;
|
||||
Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative] *= Config.Instance.RateMonsterHP;
|
||||
if (World.Game.ConnectedPlayers.Count > 1)
|
||||
if (World.Game.ConnectedPlayers.Length > 1)
|
||||
Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative] = Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative];// / 2f;
|
||||
var HPM = Attributes[GameAttribute.Hitpoints_Max];
|
||||
var HPMT = Attributes[GameAttribute.Hitpoints_Max_Total];
|
||||
float DamageMin = monsterLevels.MonsterLevel[World.Game.MonsterLevel].Dmg * DmgMultiplier;// * 0.5f;
|
||||
float DamageDelta = DamageMin;
|
||||
Attributes[GameAttribute.Damage_Weapon_Min, 0] = DamageMin * World.Game.DmgModifier * Config.Instance.RateMonsterDMG;
|
||||
Attributes[GameAttribute.Damage_Weapon_Delta, 0] = DamageDelta;
|
||||
var hpMax = Attributes[GameAttribute.Hitpoints_Max];
|
||||
var hpTotal = Attributes[GameAttribute.Hitpoints_Max_Total];
|
||||
float damageMin = monsterLevels.MonsterLevel[World.Game.MonsterLevel].Dmg * DmgMultiplier;// * 0.5f;
|
||||
float damageDelta = damageMin;
|
||||
Attributes[GameAttribute.Damage_Weapon_Min, 0] = damageMin * World.Game.DmgModifier * Config.Instance.RateMonsterDMG;
|
||||
Attributes[GameAttribute.Damage_Weapon_Delta, 0] = damageDelta;
|
||||
|
||||
if (MonsterLevel > 30)
|
||||
if (monsterLevel > 30)
|
||||
{
|
||||
Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative] = Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative];// * 0.5f;
|
||||
Attributes[GameAttribute.Damage_Weapon_Min, 0] = DamageMin * World.Game.DmgModifier * Config.Instance.RateMonsterDMG;// * 0.2f;
|
||||
Attributes[GameAttribute.Damage_Weapon_Delta, 0] = DamageDelta;
|
||||
Attributes[GameAttribute.Damage_Weapon_Min, 0] = damageMin * World.Game.DmgModifier * Config.Instance.RateMonsterDMG;// * 0.2f;
|
||||
Attributes[GameAttribute.Damage_Weapon_Delta, 0] = damageDelta;
|
||||
}
|
||||
if (MonsterLevel > 60)
|
||||
if (monsterLevel > 60)
|
||||
{
|
||||
Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative] = Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative];// * 0.7f;
|
||||
Attributes[GameAttribute.Damage_Weapon_Min, 0] = DamageMin * World.Game.DmgModifier * Config.Instance.RateMonsterDMG;// * 0.15f;
|
||||
Attributes[GameAttribute.Damage_Weapon_Min, 0] = damageMin * World.Game.DmgModifier * Config.Instance.RateMonsterDMG;// * 0.15f;
|
||||
//this.Attributes[GameAttribute.Damage_Weapon_Delta, 0] = DamageDelta * 0.5f;
|
||||
}
|
||||
|
||||
_nativeHP = Attributes[GameAttribute.Hitpoints_Max_Total];
|
||||
_nativeHp = Attributes[GameAttribute.Hitpoints_Max_Total];
|
||||
_nativeDmg = Attributes[GameAttribute.Damage_Weapon_Min, 0];
|
||||
//if (full_hp)
|
||||
Attributes[GameAttribute.Hitpoints_Cur] = Attributes[GameAttribute.Hitpoints_Max_Total];
|
||||
@ -163,8 +128,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
||||
Attributes.BroadcastChangedIfRevealed();
|
||||
}
|
||||
|
||||
int _BleedFirstTick = 0;
|
||||
int _CaltropsFirstTick = 0;
|
||||
int _bleedFirstTick = 0;
|
||||
int _caltropsFirstTick = 0;
|
||||
|
||||
public void Update(int tickCounter)
|
||||
{
|
||||
@ -194,24 +159,24 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
||||
if (this is Boss)
|
||||
{
|
||||
if (!World.BuffManager.HasBuff<PowerSystem.Implementations.Caltrops.ActiveCalTrops>(this))
|
||||
_CaltropsFirstTick = tickCounter;
|
||||
_caltropsFirstTick = tickCounter;
|
||||
|
||||
if ((tickCounter - _CaltropsFirstTick) >= 2400)
|
||||
if ((tickCounter - _caltropsFirstTick) >= 2400)
|
||||
{
|
||||
var buff_owner = World.BuffManager.GetFirstBuff<PowerSystem.Implementations.Caltrops.ActiveCalTrops>(this).User;
|
||||
if (buff_owner is Player)
|
||||
(buff_owner as Player).GrantAchievement(74987243307067);
|
||||
var buffOwner = World.BuffManager.GetFirstBuff<PowerSystem.Implementations.Caltrops.ActiveCalTrops>(this).User;
|
||||
if (buffOwner is Player player)
|
||||
player.GrantAchievement(74987243307067);
|
||||
}
|
||||
|
||||
}
|
||||
if (!World.BuffManager.HasBuff<PowerSystem.Implementations.Rend.RendDebuff>(this))
|
||||
_BleedFirstTick = tickCounter;
|
||||
_bleedFirstTick = tickCounter;
|
||||
|
||||
if ((tickCounter - _BleedFirstTick) >= 1200)
|
||||
if ((tickCounter - _bleedFirstTick) >= 1200)
|
||||
{
|
||||
var buff_owner = World.BuffManager.GetFirstBuff<PowerSystem.Implementations.Rend.RendDebuff>(this).User;
|
||||
if (buff_owner is Player)
|
||||
(buff_owner as Player).GrantAchievement(74987243307052);
|
||||
var buffOwner = World.BuffManager.GetFirstBuff<PowerSystem.Implementations.Rend.RendDebuff>(this).User;
|
||||
if (buffOwner is Player player)
|
||||
player.GrantAchievement(74987243307052);
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,32 +185,29 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
||||
if (!base.Reveal(player))
|
||||
return false;
|
||||
|
||||
|
||||
|
||||
lock (adjustLock)
|
||||
lock (_adjustLock)
|
||||
{
|
||||
int count = player.World.Game.Players.Count;
|
||||
if (count > 0 && AdjustedPlayers != count)
|
||||
if (count > 0 && _adjustedPlayers != count)
|
||||
{
|
||||
Attributes[GameAttribute.Damage_Weapon_Min, 0] = _nativeDmg * (1f + (0.05f * (count - 1) * player.World.Game.Difficulty));
|
||||
Attributes[GameAttribute.Hitpoints_Max] = _nativeHP * (1f + ((0.75f + (0.1f * player.World.Game.Difficulty)) * (count - 1)));
|
||||
Attributes[GameAttribute.Hitpoints_Max] = _nativeHp * (1f + ((0.75f + (0.1f * player.World.Game.Difficulty)) * (count - 1)));
|
||||
Attributes[GameAttribute.Hitpoints_Cur] = Attributes[GameAttribute.Hitpoints_Max_Total];
|
||||
Attributes.BroadcastChangedIfRevealed();
|
||||
AdjustedPlayers = count;
|
||||
_adjustedPlayers = count;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
public Vector3D basePoint = null;
|
||||
|
||||
public override void EnterWorld(Vector3D position)
|
||||
{
|
||||
base.EnterWorld(position);
|
||||
if (!Spawner)
|
||||
if (basePoint == null)
|
||||
basePoint = position;
|
||||
if (BasePoint == null)
|
||||
BasePoint = position;
|
||||
|
||||
if (SNO == ActorSno._a3_battlefield_demonic_ballista) //ballistas hack
|
||||
{
|
||||
@ -262,14 +224,14 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
||||
/// </summary>
|
||||
public void PlayLore()
|
||||
{
|
||||
if (LoreSNOId != -1)
|
||||
if (LoreSnoId != -1)
|
||||
{
|
||||
var players = GetPlayersInRange();
|
||||
if (players != null)
|
||||
{
|
||||
foreach (var player in players.Where(player => !player.HasLore(LoreSNOId)))
|
||||
foreach (var player in players.Where(player => !player.HasLore(LoreSnoId)))
|
||||
{
|
||||
player.PlayLore(LoreSNOId, false);
|
||||
player.PlayLore(LoreSnoId, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ using GameBalance = DiIiS_NA.Core.MPQ.FileFormats.GameBalance;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -13,8 +14,6 @@ using DiIiS_NA.Core.Storage;
|
||||
using DiIiS_NA.Core.Helpers.Hash;
|
||||
using DiIiS_NA.GameServer.ClientSystem;
|
||||
using DiIiS_NA.GameServer.GSSystem.TickerSystem;
|
||||
using DiIiS_NA.GameServer.GSSystem.ActorSystem;
|
||||
using DiIiS_NA.GameServer.GSSystem.MapSystem;
|
||||
using DiIiS_NA.GameServer.GSSystem.QuestSystem;
|
||||
using DiIiS_NA.GameServer.Core.Types.Math;
|
||||
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Game;
|
||||
@ -32,11 +31,26 @@ using DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings;
|
||||
using DiIiS_NA.GameServer.GSSystem.GeneratorsSystem;
|
||||
using DiIiS_NA.GameServer.GSSystem.AISystem.Brains;
|
||||
using System.Diagnostics;
|
||||
using DiIiS_NA.Core.MPQ.FileFormats;
|
||||
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
||||
using DiIiS_NA.D3_GameServer.GSSystem.GameSystem;
|
||||
using Actor = DiIiS_NA.GameServer.GSSystem.ActorSystem.Actor;
|
||||
using Monster = DiIiS_NA.GameServer.GSSystem.ActorSystem.Monster;
|
||||
using Scene = DiIiS_NA.GameServer.GSSystem.MapSystem.Scene;
|
||||
using World = DiIiS_NA.GameServer.GSSystem.MapSystem.World;
|
||||
using DiIiS_NA.Core.MPQ.FileFormats;
|
||||
|
||||
namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
{
|
||||
public enum ActEnum
|
||||
{
|
||||
Act1 = 0,
|
||||
Act2 = 100,
|
||||
Act3 = 200,
|
||||
Act4 = 300,
|
||||
Act5 = 400,
|
||||
OpenWorld = 3000
|
||||
}
|
||||
public class Game : IMessageConsumer
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.CreateLogger();
|
||||
@ -51,7 +65,8 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
/// </summary>
|
||||
public ConcurrentDictionary<GameClient, Player> Players { get; private set; }
|
||||
|
||||
public List<Player> ConnectedPlayers = new List<Player>();
|
||||
public ImmutableArray<Player> ConnectedPlayers => Players.Where(s => s.Value != null && s.Key.Connection.IsOpen() && !s.Key.IsLoggingOut)
|
||||
.Select(s=>s.Value).ToImmutableArray();
|
||||
|
||||
public bool QuestSetup = false;
|
||||
|
||||
@ -84,20 +99,20 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
/// <summary>
|
||||
/// DynamicId counter for objects.
|
||||
/// </summary>
|
||||
private uint _lastObjectID = 10001;
|
||||
private uint _lastObjectId = 10001;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a new dynamicId for objects.
|
||||
/// </summary>
|
||||
private object obj = new object();
|
||||
public uint NewActorGameID
|
||||
private readonly object _obj = new();
|
||||
public uint NewActorGameId
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (obj)
|
||||
lock (_obj)
|
||||
{
|
||||
_lastObjectID++;
|
||||
return _lastObjectID;
|
||||
_lastObjectId++;
|
||||
return _lastObjectId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -108,13 +123,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
/// </summary>
|
||||
private readonly ConcurrentDictionary<WorldSno, World> _worlds;
|
||||
|
||||
public List<World> Worlds
|
||||
{
|
||||
get
|
||||
{
|
||||
return _worlds.Values.ToList();
|
||||
}
|
||||
}
|
||||
public List<World> Worlds => _worlds.Values.ToList();
|
||||
|
||||
public Mode GameMode = Mode.Campaign;
|
||||
public enum Mode
|
||||
@ -126,19 +135,19 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
public struct BossEncounter
|
||||
{
|
||||
public int SnoId;
|
||||
public bool activated;
|
||||
public int acceptedPlayers;
|
||||
public bool Activated;
|
||||
public int AcceptedPlayers;
|
||||
};
|
||||
|
||||
public Dictionary<WorldSno, List<Action>> OnLoadWorldActions = new Dictionary<WorldSno, List<Action>>();
|
||||
public Dictionary<int, List<Action>> OnLoadSceneActions = new Dictionary<int, List<Action>>();
|
||||
public readonly Dictionary<WorldSno, List<Action>> OnLoadWorldActions = new();
|
||||
public readonly Dictionary<int, List<Action>> OnLoadSceneActions = new();
|
||||
|
||||
public BossEncounter CurrentEncounter = new BossEncounter { SnoId = -1, activated = false, acceptedPlayers = 0 };
|
||||
public BossEncounter CurrentEncounter = new() { SnoId = -1, Activated = false, AcceptedPlayers = 0 };
|
||||
|
||||
/// <summary>
|
||||
/// Starting world's sno.
|
||||
/// </summary>
|
||||
public WorldSno StartingWorldSNO { get; private set; }
|
||||
public WorldSno StartingWorldSno { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Starting world's monster level
|
||||
@ -147,7 +156,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
public int MonsterLevel { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Is it world without players?
|
||||
/// Is it a world without players?
|
||||
/// </summary>
|
||||
public bool Empty { get; private set; }
|
||||
|
||||
@ -156,18 +165,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
/// </summary>
|
||||
public bool Paused { get; private set; }
|
||||
|
||||
private bool UpdateEnabled = true;
|
||||
private bool _updateEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// Starting world for the game.
|
||||
/// </summary>
|
||||
public World StartingWorld
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetWorld(StartingWorldSNO);
|
||||
}
|
||||
}
|
||||
public World StartingWorld => GetWorld(StartingWorldSno);
|
||||
|
||||
/// <summary>
|
||||
/// Player index counter.
|
||||
@ -192,14 +195,19 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
/// </summary>
|
||||
public int CurrentAct = -1;
|
||||
|
||||
public ActEnum CurrentActEnum => CurrentAct != -1 ? (ActEnum)CurrentAct : ActEnum.Act1;
|
||||
private int _difficulty = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Current difficulty system id.
|
||||
/// Min: 0, Max: 19
|
||||
/// </summary>
|
||||
public int Difficulty = 0;
|
||||
public float HPModifier = 1f;
|
||||
public float DmgModifier = 1f;
|
||||
public float XPModifier = 1f;
|
||||
public float GoldModifier = 1f;
|
||||
public int Difficulty { get => _difficulty; set => _difficulty = Math.Clamp(value, 0, 19); }
|
||||
|
||||
public float HpModifier { get; set; } = 1f;
|
||||
public float DmgModifier { get; set; } = 1f;
|
||||
public float XpModifier { get; set; } = 1f;
|
||||
public float GoldModifier { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Hardcore mode flag.
|
||||
@ -207,41 +215,31 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
public bool IsHardcore = false;
|
||||
public bool IsSeasoned = false;
|
||||
|
||||
public List<int> OpenedWaypoints = new List<int>();
|
||||
public List<int> OpenedWaypoints = new();
|
||||
|
||||
public Dictionary<DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT, int> BountiesCompleted = new Dictionary<DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT, int>()
|
||||
public readonly Dictionary<BountyData.ActT, int> BountiesCompleted = new()
|
||||
{
|
||||
{DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A1, 0},
|
||||
{DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A2, 0},
|
||||
{DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A3, 0},
|
||||
{DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A4, 0},
|
||||
{DiIiS_NA.Core.MPQ.FileFormats.BountyData.ActT.A5, 0}
|
||||
{BountyData.ActT.A1, 0},
|
||||
{BountyData.ActT.A2, 0},
|
||||
{BountyData.ActT.A3, 0},
|
||||
{BountyData.ActT.A4, 0},
|
||||
{BountyData.ActT.A5, 0}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Current act SNO id.
|
||||
/// </summary>
|
||||
public int CurrentActSNOid
|
||||
{
|
||||
get
|
||||
public int CurrentActSnoId =>
|
||||
CurrentActEnum switch
|
||||
{
|
||||
switch (CurrentAct)
|
||||
{
|
||||
case 0:
|
||||
return 70015;
|
||||
case 100:
|
||||
return 70016;
|
||||
case 200:
|
||||
return 70017;
|
||||
case 300:
|
||||
return 70018;
|
||||
case 400:
|
||||
return 236915;
|
||||
default:
|
||||
return 70015;
|
||||
}
|
||||
}
|
||||
}
|
||||
ActEnum.Act1 => 70015,
|
||||
ActEnum.Act2 => 70016,
|
||||
ActEnum.Act3 => 70017,
|
||||
ActEnum.Act4 => 70018,
|
||||
ActEnum.Act5 => 236915,
|
||||
ActEnum.OpenWorld => 70015,
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Last completed quest SNOid.
|
||||
@ -273,7 +271,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
/// <summary>
|
||||
/// Database connection for this game
|
||||
/// </summary>
|
||||
public GameDBSession GameDBSession;
|
||||
public GameDBSession GameDbSession;
|
||||
|
||||
/// <summary>
|
||||
/// Update frequency for the game - 100 ms.
|
||||
@ -293,32 +291,29 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
/// <summary>
|
||||
/// Returns the latest tick count.
|
||||
/// </summary>
|
||||
public int TickCounter
|
||||
{
|
||||
get { return _tickCounter; }
|
||||
}
|
||||
public int TickCounter => _tickCounter;
|
||||
|
||||
/// <summary>
|
||||
/// Stopwatch that measures time takent to get a full Game.Update().
|
||||
/// </summary>
|
||||
// /// <summary>
|
||||
// /// Stopwatch that measures time takent to get a full Game.Update().
|
||||
// /// </summary>
|
||||
//private readonly Stopwatch _tickWatch;
|
||||
|
||||
/// <summary>
|
||||
/// DynamicId counter for scene.
|
||||
/// </summary>
|
||||
private uint _lastSceneID = 0x04000000;
|
||||
private uint _lastSceneId = 0x04000000;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a new dynamicId for scenes.
|
||||
/// </summary>
|
||||
public uint NewSceneID
|
||||
public uint NewSceneId
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (obj)
|
||||
lock (_obj)
|
||||
{
|
||||
_lastSceneID++;
|
||||
return _lastSceneID;
|
||||
_lastSceneId++;
|
||||
return _lastSceneId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -338,41 +333,29 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3D StartPosition
|
||||
{
|
||||
get
|
||||
public Vector3D StartPosition =>
|
||||
CurrentActEnum switch
|
||||
{
|
||||
switch (CurrentAct)
|
||||
{
|
||||
case 0:
|
||||
return StartingWorld.GetStartingPointById(24).Position;
|
||||
case 100:
|
||||
return StartingWorld.GetStartingPointById(59).Position;
|
||||
case 200:
|
||||
return StartingWorld.GetStartingPointById(172).Position;
|
||||
case 300:
|
||||
return StartingWorld.GetStartingPointById(172).Position;
|
||||
case 400:
|
||||
return StartingWorld.GetStartingPointById(172).Position;
|
||||
case 3000:
|
||||
return StartingWorld.GetStartingPointById(24).Position;
|
||||
default:
|
||||
return StartingWorld.StartingPoints.First().Position;
|
||||
}
|
||||
}
|
||||
}
|
||||
ActEnum.Act1 => StartingWorld.GetStartingPointById(24).Position,
|
||||
ActEnum.Act2 => StartingWorld.GetStartingPointById(59).Position,
|
||||
ActEnum.Act3 => StartingWorld.GetStartingPointById(172).Position,
|
||||
ActEnum.Act4 => StartingWorld.GetStartingPointById(172).Position,
|
||||
ActEnum.Act5 => StartingWorld.GetStartingPointById(172).Position,
|
||||
ActEnum.OpenWorld => StartingWorld.GetStartingPointById(24).Position,
|
||||
_ => StartingWorld.StartingPoints.First().Position
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// DynamicId counter for worlds.
|
||||
/// </summary>
|
||||
private uint _lastWorldID = 0x07000000;
|
||||
private uint _lastWorldId = 0x07000000;
|
||||
|
||||
public int WeatherSeed = DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next();
|
||||
|
||||
/// <summary>
|
||||
/// Returns a new dynamicId for worlds.
|
||||
/// </summary>
|
||||
public uint NewWorldID { get { return _lastWorldID++; } }
|
||||
public uint NewWorldId => _lastWorldId++;
|
||||
|
||||
public QuestManager QuestManager { get; private set; }
|
||||
//public AI.Pather Pathfinder { get; private set; }
|
||||
@ -388,11 +371,11 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
public Game(int gameId, int initalLevel, bool endless = false)
|
||||
{
|
||||
GameId = gameId;
|
||||
_lastObjectID = (uint)gameId * 100000;
|
||||
_lastObjectId = (uint)gameId * 100000;
|
||||
Empty = true;
|
||||
Players = new ConcurrentDictionary<GameClient, Player>();
|
||||
_worlds = new ConcurrentDictionary<WorldSno, World>();
|
||||
StartingWorldSNO = WorldSno.pvp_caout_arena_01;// FIXME: track the player's save point and toss this stuff.
|
||||
StartingWorldSno = WorldSno.pvp_caout_arena_01;// FIXME: track the player's save point and toss this stuff.
|
||||
InitialMonsterLevel = initalLevel;
|
||||
MonsterLevel = initalLevel;
|
||||
QuestManager = new QuestManager(this);
|
||||
@ -409,12 +392,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
loopThread.Start();
|
||||
|
||||
WorldGenerator = new WorldGenerator(this);
|
||||
GameDBSession = new GameDBSession();
|
||||
GameDbSession = new GameDBSession();
|
||||
LockdownTimer = TickTimer.WaitSeconds(this, 60f, new Action<int>((q) =>
|
||||
{
|
||||
if (Empty || Players.IsEmpty)
|
||||
{
|
||||
Logger.Info("All players disconnected, closing game session.");
|
||||
Logger.Warn("All players disconnected, closing game session.");
|
||||
Dispose();
|
||||
GameManager.Games.Remove(GameId);
|
||||
}
|
||||
@ -425,7 +408,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
|
||||
#region update & tick managment
|
||||
|
||||
private object updateLock = new object();
|
||||
private readonly object _updateLock = new();
|
||||
|
||||
public int MissedTicks = 0;
|
||||
public bool UpdateInProgress = false;
|
||||
@ -436,11 +419,11 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
{
|
||||
while (Working)
|
||||
{
|
||||
Stopwatch _tickWatch = new Stopwatch();
|
||||
_tickWatch.Restart();
|
||||
Stopwatch tickWatch = new Stopwatch();
|
||||
tickWatch.Restart();
|
||||
if (Players.Count == 0 && !Empty)
|
||||
{
|
||||
Logger.Info("Все игроки отключены, сессия игры завершена");
|
||||
Logger.Info("All players disconnected, game session closed");
|
||||
Dispose();
|
||||
GameManager.Games.Remove(GameId);
|
||||
return;
|
||||
@ -450,11 +433,11 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
Interlocked.Add(ref _tickCounter, (TickRate + MissedTicks)); // +6 ticks per 100ms. Verified by setting LogoutTickTimeMessage.Ticks to 600 which eventually renders a 10 sec logout timer on client. /raist
|
||||
MissedTicks = 0;
|
||||
|
||||
if (UpdateEnabled && !Paused)
|
||||
if (_updateEnabled && !Paused)
|
||||
{
|
||||
// Lock Game instance to prevent incoming messages from modifying state while updating
|
||||
// only update worlds with active players in it - so mob brain()'s in empty worlds doesn't get called and take actions for nothing. /raist.
|
||||
lock (updateLock)
|
||||
lock (_updateLock)
|
||||
{
|
||||
foreach (var pair in _worlds.Where(pair => pair.Value.HasPlayersIn))
|
||||
{
|
||||
@ -468,33 +451,40 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
}
|
||||
}
|
||||
|
||||
if (PvPTimer != null)
|
||||
PvPTimer.Update(_tickCounter);
|
||||
|
||||
if (GlobalPvPTimer != null)
|
||||
GlobalPvPTimer.Update(_tickCounter);
|
||||
|
||||
if (LockdownTimer != null)
|
||||
LockdownTimer.Update(_tickCounter);
|
||||
|
||||
if (QuestTimer != null)
|
||||
QuestTimer.Update(_tickCounter);
|
||||
PvPTimer?.Update(_tickCounter);
|
||||
GlobalPvPTimer?.Update(_tickCounter);
|
||||
LockdownTimer?.Update(_tickCounter);
|
||||
QuestTimer?.Update(_tickCounter);
|
||||
}
|
||||
}
|
||||
_tickWatch.Stop();
|
||||
tickWatch.Stop();
|
||||
|
||||
Stopwatch _calcWatch = new Stopwatch();
|
||||
_calcWatch.Restart();
|
||||
var compensation = (int)(UpdateFrequency - _tickWatch.ElapsedMilliseconds); // the compensation value we need to sleep in order to get consistent 100 ms Game.Update().
|
||||
Stopwatch calcWatch = new();
|
||||
calcWatch.Start();
|
||||
var compensation = (int)(UpdateFrequency - tickWatch.ElapsedMilliseconds); // the compensation value we need to sleep in order to get consistent 100 ms Game.Update().
|
||||
|
||||
if (_tickWatch.ElapsedMilliseconds > UpdateFrequency)
|
||||
if (tickWatch.ElapsedMilliseconds > UpdateFrequency)
|
||||
{
|
||||
Logger.Trace("Game.Update() took [{0}ms] more than Game.UpdateFrequency [{1}ms].", _tickWatch.ElapsedMilliseconds, UpdateFrequency);
|
||||
compensation = (int)(UpdateFrequency - (_tickWatch.ElapsedMilliseconds % UpdateFrequency));
|
||||
MissedTicks = TickRate * (int)(_tickWatch.ElapsedMilliseconds / UpdateFrequency);
|
||||
if (tickWatch.ElapsedMilliseconds >= UpdateFrequency * 2)
|
||||
{
|
||||
Logger.Error($"took [{tickWatch.ElapsedMilliseconds}ms] more than Game.UpdateFrequency [{UpdateFrequency}ms].");
|
||||
}
|
||||
else if (tickWatch.ElapsedMilliseconds >= UpdateFrequency * 1.5)
|
||||
{
|
||||
Logger.Warn(
|
||||
$"took [{tickWatch.ElapsedMilliseconds}ms] more than Game.UpdateFrequency [{UpdateFrequency}ms].");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Trace(
|
||||
$"took [{tickWatch.ElapsedMilliseconds}ms] more than Game.UpdateFrequency [{UpdateFrequency}ms].");
|
||||
}
|
||||
|
||||
compensation = (int)(UpdateFrequency - (tickWatch.ElapsedMilliseconds % UpdateFrequency));
|
||||
MissedTicks = TickRate * (int)(tickWatch.ElapsedMilliseconds / UpdateFrequency);
|
||||
}
|
||||
_calcWatch.Stop();
|
||||
Thread.Sleep(Math.Max(0, compensation - (int)_calcWatch.ElapsedMilliseconds)); // sleep until next Update().
|
||||
calcWatch.Stop();
|
||||
Thread.Sleep(Math.Max(0, compensation - (int)calcWatch.ElapsedMilliseconds)); // sleep until next Update().
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@ -507,7 +497,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
/// <param name="message"></param>
|
||||
public void Route(GameClient client, GameMessage message)
|
||||
{
|
||||
UpdateEnabled = false;
|
||||
_updateEnabled = false;
|
||||
try
|
||||
{
|
||||
switch (message.Consumer)
|
||||
@ -538,13 +528,13 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
}
|
||||
finally
|
||||
{
|
||||
UpdateEnabled = true;
|
||||
_updateEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Consume(GameClient client, GameMessage message)
|
||||
{
|
||||
lock (updateLock)
|
||||
lock (_updateLock)
|
||||
{
|
||||
if (message is PauseGameMessage) OnPause(client, (PauseGameMessage)message);
|
||||
else if (message is RaiseGameDifficulty) RaiseDifficulty(client, (RaiseGameDifficulty)message);
|
||||
@ -881,17 +871,17 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
|
||||
}
|
||||
|
||||
private int[] questsOrder_a1 = new[] { 87700, 72095, 72221, 72061, 117779, 72738, 73236, 72546, 72801, 136656 };
|
||||
private readonly int[] _questsOrderA1 = new[] { 87700, 72095, 72221, 72061, 117779, 72738, 73236, 72546, 72801, 136656 };
|
||||
|
||||
private int[] questsOrder_a2 = new[] { 80322, 93396, 74128, 57331, 78264, 78266, 57335, 57337, 121792, 57339 };
|
||||
private readonly int[] _questsOrderA2 = new[] { 80322, 93396, 74128, 57331, 78264, 78266, 57335, 57337, 121792, 57339 };
|
||||
|
||||
private int[] questsOrder_a3 = new[] { 93595, 93684, 93697, 203595, 101756, 101750, 101758 };
|
||||
private readonly int[] _questsOrderA3 = new[] { 93595, 93684, 93697, 203595, 101756, 101750, 101758 };
|
||||
|
||||
private int[] questsOrder_a4 = new[] { 112498, 113910, 114795, 114901 };
|
||||
private readonly int[] _questsOrderA4 = new[] { 112498, 113910, 114795, 114901 };
|
||||
|
||||
private int[] questsOrder_a5 = new[] { 251355, 284683, 285098, 257120, 263851, 273790, 269552, 273408 };
|
||||
private readonly int[] _questsOrderA5 = new[] { 251355, 284683, 285098, 257120, 263851, 273790, 269552, 273408 };
|
||||
|
||||
private int[] questsOrder_openWorld = new[] { 312429 };
|
||||
private readonly int[] _questsOrderOpenWorld = new[] { 312429 };
|
||||
|
||||
|
||||
public void SetQuestProgress(int currQuest, int step)
|
||||
@ -940,7 +930,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
{
|
||||
case Mode.Portals:
|
||||
QuestsOrder = new int[] { -1 };
|
||||
StartingWorldSNO = WorldSno.weekly_challenge_hub;
|
||||
StartingWorldSno = WorldSno.weekly_challenge_hub;
|
||||
QuestProgress = new QuestRegistry(this);
|
||||
break;
|
||||
}
|
||||
@ -950,9 +940,9 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
if (PvP)
|
||||
{
|
||||
CurrentAct = 0;
|
||||
QuestsOrder = questsOrder_a1;
|
||||
QuestsOrder = _questsOrderA1;
|
||||
QuestProgress = new QuestRegistry(this);
|
||||
StartingWorldSNO = WorldSno.pvp_caout_arena_01;
|
||||
StartingWorldSno = WorldSno.pvp_caout_arena_01;
|
||||
return;
|
||||
}
|
||||
if (CurrentAct != act)
|
||||
@ -962,39 +952,39 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
switch (act)
|
||||
{
|
||||
case 0:
|
||||
QuestsOrder = questsOrder_a1;
|
||||
StartingWorldSNO = WorldSno.trout_town;
|
||||
QuestsOrder = _questsOrderA1;
|
||||
StartingWorldSno = WorldSno.trout_town;
|
||||
QuestProgress = new ActI(this);
|
||||
break;
|
||||
case 100:
|
||||
QuestsOrder = questsOrder_a2;
|
||||
StartingWorldSNO = WorldSno.caout_refugeecamp;
|
||||
QuestsOrder = _questsOrderA2;
|
||||
StartingWorldSno = WorldSno.caout_refugeecamp;
|
||||
QuestProgress = new ActII(this);
|
||||
break;
|
||||
case 200:
|
||||
QuestsOrder = questsOrder_a3;
|
||||
StartingWorldSNO = WorldSno.a3dun_hub_keep;
|
||||
QuestsOrder = _questsOrderA3;
|
||||
StartingWorldSno = WorldSno.a3dun_hub_keep;
|
||||
QuestProgress = new ActIII(this);
|
||||
break;
|
||||
case 300:
|
||||
QuestsOrder = questsOrder_a4;
|
||||
StartingWorldSNO = WorldSno.a4dun_heaven_hub_keep;
|
||||
QuestsOrder = _questsOrderA4;
|
||||
StartingWorldSno = WorldSno.a4dun_heaven_hub_keep;
|
||||
QuestProgress = new ActIV(this);
|
||||
break;
|
||||
case 400:
|
||||
QuestsOrder = questsOrder_a5;
|
||||
StartingWorldSNO = WorldSno.x1_westmarch_hub;
|
||||
QuestsOrder = _questsOrderA5;
|
||||
StartingWorldSno = WorldSno.x1_westmarch_hub;
|
||||
QuestProgress = new ActV(this);
|
||||
break;
|
||||
case 3000:
|
||||
QuestsOrder = questsOrder_openWorld;
|
||||
StartingWorldSNO = WorldSno.x1_tristram_adventure_mode_hub;
|
||||
QuestsOrder = _questsOrderOpenWorld;
|
||||
StartingWorldSno = WorldSno.x1_tristram_adventure_mode_hub;
|
||||
QuestProgress = new OpenWorld(this);
|
||||
QuestManager.SetBounties();
|
||||
break;
|
||||
default:
|
||||
QuestsOrder = questsOrder_a1;
|
||||
StartingWorldSNO = WorldSno.trout_town;
|
||||
QuestsOrder = _questsOrderA1;
|
||||
StartingWorldSno = WorldSno.trout_town;
|
||||
QuestProgress = new QuestRegistry(this);
|
||||
break;
|
||||
}
|
||||
@ -1159,9 +1149,9 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
if (diff > 0)
|
||||
{
|
||||
var handicapLevels = (GameBalance)MPQStorage.Data.Assets[SNOGroup.GameBalance][256027].Data;
|
||||
HPModifier = handicapLevels.HandicapLevelTables[diff].HPMod;
|
||||
HpModifier = handicapLevels.HandicapLevelTables[diff].HPMod;
|
||||
DmgModifier = handicapLevels.HandicapLevelTables[diff].DmgMod;
|
||||
XPModifier = (1f + handicapLevels.HandicapLevelTables[diff].XPMod);
|
||||
XpModifier = (1f + handicapLevels.HandicapLevelTables[diff].XPMod);
|
||||
GoldModifier = (1f + handicapLevels.HandicapLevelTables[diff].GoldMod);
|
||||
}
|
||||
foreach (var wld in _worlds)
|
||||
@ -1287,8 +1277,8 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
}
|
||||
else
|
||||
{
|
||||
var TotalWinner = Players.Values.Where(p => p.Attributes[GameAttribute.TeamID] == (RedTeamWins > BlueTeamWins ? 2 : 3)).FirstOrDefault();
|
||||
BroadcastMessage("Winner: " + TotalWinner.Toon.Name);
|
||||
var totalWinner = Players.Values.Where(p => p.Attributes[GameAttribute.TeamID] == (RedTeamWins > BlueTeamWins ? 2 : 3)).FirstOrDefault();
|
||||
BroadcastMessage("Winner: " + totalWinner.Toon.Name);
|
||||
}
|
||||
|
||||
//foreach (var player in this.Players.Values)
|
||||
@ -1331,7 +1321,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
plr.Connection.Disconnect();
|
||||
_worlds.Clear();
|
||||
Thread.Sleep(1000);
|
||||
GameDBSession.SessionDispose();
|
||||
GameDbSession.SessionDispose();
|
||||
GameManager.Games.Remove(GameId);
|
||||
}
|
||||
|
||||
@ -1413,12 +1403,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
|
||||
var levelArea = scene.Specification.SNOLevelAreas[0];
|
||||
|
||||
foreach (var g_player in Players)
|
||||
foreach (var gPlayer in Players)
|
||||
{
|
||||
if (g_player.Value.World == encWorld)
|
||||
g_player.Value.Teleport(startPoint);
|
||||
if (gPlayer.Value.World == encWorld)
|
||||
gPlayer.Value.Teleport(startPoint);
|
||||
else
|
||||
g_player.Value.ChangeWorld(encWorld, startPoint);
|
||||
gPlayer.Value.ChangeWorld(encWorld, startPoint);
|
||||
}
|
||||
|
||||
|
||||
@ -1429,7 +1419,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
if (QuestProgress.QuestTriggers.ContainsKey(levelArea)) //EnterLevelArea
|
||||
{
|
||||
var trigger = QuestProgress.QuestTriggers[levelArea];
|
||||
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.EnterLevelArea)
|
||||
if (trigger.triggerType == QuestStepObjectiveType.EnterLevelArea)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -1460,56 +1450,56 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
ActorID = (int)encWorld.GetActorBySNO(ActorSno._test_cainintro_greybox_bridge_trout_tempworking).DynamicID(plr), Duration = 1f, Snap = false
|
||||
});
|
||||
|
||||
Actor CainRun = null;
|
||||
Actor CainQuest = null;
|
||||
Actor cainRun = null;
|
||||
Actor cainQuest = null;
|
||||
//Убираем лишнего каина.
|
||||
foreach (var Cain in encWorld.GetActorsBySNO(ActorSno._cain_intro))
|
||||
if (Cain.Position.Y > 140)
|
||||
foreach (var cain in encWorld.GetActorsBySNO(ActorSno._cain_intro))
|
||||
if (cain.Position.Y > 140)
|
||||
{
|
||||
Cain.SetVisible(false);
|
||||
foreach (var plr in Players.Values) Cain.Unreveal(plr);
|
||||
CainQuest = Cain;
|
||||
cain.SetVisible(false);
|
||||
foreach (var plr in Players.Values) cain.Unreveal(plr);
|
||||
cainQuest = cain;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cain.SetVisible(true);
|
||||
foreach (var plr in Players.Values) Cain.Reveal(plr);
|
||||
CainRun = Cain;
|
||||
cain.SetVisible(true);
|
||||
foreach (var plr in Players.Values) cain.Reveal(plr);
|
||||
cainRun = cain;
|
||||
}
|
||||
|
||||
|
||||
//Скелеты
|
||||
var Skeletons = encWorld.GetActorsBySNO(ActorSno._skeleton_cain);
|
||||
var skeletons = encWorld.GetActorsBySNO(ActorSno._skeleton_cain);
|
||||
//Камни
|
||||
//var Rocks = encWorld.GetActorsBySNO(176);
|
||||
//Берем позицию для леорика, а самого на мороз
|
||||
Vector3D FakeLeoricPosition = new Vector3D(0f, 0f, 0f);
|
||||
Vector3D fakeLeoricPosition = new Vector3D(0f, 0f, 0f);
|
||||
foreach (var fake in encWorld.GetActorsBySNO(ActorSno._skeletonking_ghost))
|
||||
{
|
||||
FakeLeoricPosition = fake.Position;
|
||||
fakeLeoricPosition = fake.Position;
|
||||
fake.Destroy();
|
||||
}
|
||||
//Берем каина
|
||||
var FirstPoint = new Vector3D(120.92718f, 121.26151f, 0.099973306f);
|
||||
var SecondPoint = new Vector3D(120.73298f, 160.61829f, 0.31863004f);
|
||||
var SceletonPoint = new Vector3D(120.11514f, 140.77332f, 0.31863004f);
|
||||
var firstPoint = new Vector3D(120.92718f, 121.26151f, 0.099973306f);
|
||||
var secondPoint = new Vector3D(120.73298f, 160.61829f, 0.31863004f);
|
||||
var sceletonPoint = new Vector3D(120.11514f, 140.77332f, 0.31863004f);
|
||||
|
||||
var FirstfacingAngle = ActorSystem.Movement.MovementHelpers.GetFacingAngle(CainRun, FirstPoint);
|
||||
var SecondfacingAngle = ActorSystem.Movement.MovementHelpers.GetFacingAngle(FirstPoint, SecondPoint);
|
||||
var ThirdfacingAngle = ActorSystem.Movement.MovementHelpers.GetFacingAngle(SecondPoint, FakeLeoricPosition);
|
||||
var firstfacingAngle = ActorSystem.Movement.MovementHelpers.GetFacingAngle(cainRun, firstPoint);
|
||||
var secondfacingAngle = ActorSystem.Movement.MovementHelpers.GetFacingAngle(firstPoint, secondPoint);
|
||||
var thirdfacingAngle = ActorSystem.Movement.MovementHelpers.GetFacingAngle(secondPoint, fakeLeoricPosition);
|
||||
//Подготовления завершены - НАЧИНАЕМ ТЕАТР=)
|
||||
Task.Delay(3000).ContinueWith(delegate
|
||||
{
|
||||
CainRun.Move(FirstPoint, FirstfacingAngle);
|
||||
cainRun.Move(firstPoint, firstfacingAngle);
|
||||
foreach (var plr in Players.Values)
|
||||
plr.Conversations.StartConversation(80920);//Запуск диалога - 80920 //Фраза Каина, бежит первым до начала мостика, оглядывается. //"Cain_Run_CainIntro", 81080 - Анимация
|
||||
Task.Delay(5000).ContinueWith(delegate
|
||||
{
|
||||
foreach (var skeleton in Skeletons)
|
||||
foreach (var skeleton in skeletons)
|
||||
{
|
||||
skeleton.Move(SceletonPoint, ActorSystem.Movement.MovementHelpers.GetFacingAngle(skeleton, SceletonPoint));
|
||||
skeleton.Move(sceletonPoint, ActorSystem.Movement.MovementHelpers.GetFacingAngle(skeleton, sceletonPoint));
|
||||
}
|
||||
CainRun.Move(SecondPoint, SecondfacingAngle);
|
||||
cainRun.Move(secondPoint, secondfacingAngle);
|
||||
|
||||
Task.Delay(7000).ContinueWith(delegate
|
||||
{
|
||||
@ -1520,7 +1510,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
var bridge = encWorld.GetActorBySNO(ActorSno._test_cainintro_greybox_bridge_trout_tempworking);
|
||||
bridge.PlayAnimation(5, (AnimationSno)bridge.AnimationSet.TagMapAnimDefault[AnimationSetKeys.DeathDefault]);
|
||||
//}
|
||||
foreach (var skeleton in Skeletons)
|
||||
foreach (var skeleton in skeletons)
|
||||
{
|
||||
//Убиваем скелетов
|
||||
skeleton.Destroy();
|
||||
@ -1528,11 +1518,11 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
});
|
||||
Task.Delay(5000).ContinueWith(delegate
|
||||
{
|
||||
CainRun.Move(SecondPoint, ThirdfacingAngle);
|
||||
cainRun.Move(secondPoint, thirdfacingAngle);
|
||||
|
||||
//(Должен быть диалог Король скилет.)
|
||||
var Leoric = encWorld.SpawnMonster(ActorSno._skeletonking_ghost, FakeLeoricPosition);
|
||||
Leoric.PlayActionAnimation(AnimationSno.skeletonking_ghost_spawn);
|
||||
var leoric = encWorld.SpawnMonster(ActorSno._skeletonking_ghost, fakeLeoricPosition);
|
||||
leoric.PlayActionAnimation(AnimationSno.skeletonking_ghost_spawn);
|
||||
Task.Delay(1000).ContinueWith(delegate
|
||||
{
|
||||
foreach (var plr in Players.Values)
|
||||
@ -1541,7 +1531,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
{
|
||||
//Leoric.PlayActionAnimation(9854); //Леорик призывает скелетов
|
||||
|
||||
Leoric.PlayActionAnimation(AnimationSno.skeletonking_ghost_despawn); //Себаса
|
||||
leoric.PlayActionAnimation(AnimationSno.skeletonking_ghost_despawn); //Себаса
|
||||
Task.Delay(1000).ContinueWith(delegate
|
||||
{
|
||||
foreach (var plr in Players.Values)
|
||||
@ -1549,12 +1539,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
plr.InGameClient.SendMessage(new BoolDataMessage(Opcodes.CameraTriggerFadeToBlackMessage) { Field0 = true });
|
||||
plr.InGameClient.SendMessage(new SimpleMessage(Opcodes.CameraSriptedSequenceStopMessage) { });
|
||||
}
|
||||
CainQuest.SetVisible(true);
|
||||
CainRun.SetVisible(false);
|
||||
cainQuest.SetVisible(true);
|
||||
cainRun.SetVisible(false);
|
||||
|
||||
foreach (var fake in encWorld.GetActorsBySNO(ActorSno._skeletonking_ghost))
|
||||
{
|
||||
FakeLeoricPosition = fake.Position;
|
||||
fakeLeoricPosition = fake.Position;
|
||||
fake.Destroy();
|
||||
}
|
||||
});
|
||||
@ -1573,13 +1563,13 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
case 158915: //ButcherLair
|
||||
//if (this.CurrentAct == 0)
|
||||
|
||||
var Butcher = encWorld.GetActorBySNO(ActorSno._butcher);
|
||||
if (Butcher != null)
|
||||
(Butcher as Monster).Brain.DeActivate();
|
||||
var butcher = encWorld.GetActorBySNO(ActorSno._butcher);
|
||||
if (butcher != null)
|
||||
(butcher as Monster).Brain.DeActivate();
|
||||
else
|
||||
{
|
||||
Butcher = encWorld.SpawnMonster(ActorSno._butcher, new Vector3D { X = 93.022f, Y = 89.86f, Z = 0.1f });
|
||||
(Butcher as Monster).Brain.DeActivate();
|
||||
butcher = encWorld.SpawnMonster(ActorSno._butcher, new Vector3D { X = 93.022f, Y = 89.86f, Z = 0.1f });
|
||||
(butcher as Monster).Brain.DeActivate();
|
||||
}
|
||||
Task.Delay(1000).ContinueWith(delegate
|
||||
{
|
||||
@ -1589,10 +1579,10 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
|
||||
Task.Delay(1000).ContinueWith(delegate
|
||||
{
|
||||
if (Butcher != null)
|
||||
(Butcher as Monster).Brain.DeActivate();
|
||||
if (butcher != null)
|
||||
(butcher as Monster).Brain.DeActivate();
|
||||
foreach (var plr in Players.Values)
|
||||
plr.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Camera.CameraFocusMessage() { ActorID = (int)Butcher.DynamicID(plr), Duration = 1f, Snap = false });
|
||||
plr.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Camera.CameraFocusMessage() { ActorID = (int)butcher.DynamicID(plr), Duration = 1f, Snap = false });
|
||||
|
||||
|
||||
foreach (var plr in Players.Values)
|
||||
@ -1608,7 +1598,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
}
|
||||
Task.Delay(1500).ContinueWith(delegate
|
||||
{
|
||||
(Butcher as Monster).Brain.Activate();
|
||||
(butcher as Monster).Brain.Activate();
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -1620,46 +1610,46 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
foreach (var bounty in QuestManager.Bounties)
|
||||
bounty.CheckLevelArea(levelArea);
|
||||
|
||||
CurrentEncounter.acceptedPlayers = 0;
|
||||
CurrentEncounter.activated = false;
|
||||
CurrentEncounter.AcceptedPlayers = 0;
|
||||
CurrentEncounter.Activated = false;
|
||||
}
|
||||
|
||||
public void AcceptBossEncounter()
|
||||
{
|
||||
CurrentEncounter.acceptedPlayers++;
|
||||
if (CurrentEncounter.acceptedPlayers >= Players.Count)
|
||||
CurrentEncounter.AcceptedPlayers++;
|
||||
if (CurrentEncounter.AcceptedPlayers >= Players.Count)
|
||||
TeleportToBossEncounter(CurrentEncounter.SnoId);
|
||||
}
|
||||
|
||||
public void DeclineBossEncounter()
|
||||
{
|
||||
CurrentEncounter.activated = false;
|
||||
CurrentEncounter.acceptedPlayers = 0;
|
||||
CurrentEncounter.Activated = false;
|
||||
CurrentEncounter.AcceptedPlayers = 0;
|
||||
}
|
||||
|
||||
public void AddOnLoadWorldAction(WorldSno worldSNO, Action action)
|
||||
public void AddOnLoadWorldAction(WorldSno worldSno, Action action)
|
||||
{
|
||||
Logger.Trace("AddOnLoadWorldAction: {0}", worldSNO);
|
||||
if (Players.Values.Any(p => p.World != null && p.World.SNO == worldSNO))
|
||||
Logger.Trace("AddOnLoadWorldAction: {0}", worldSno);
|
||||
if (Players.Values.Any(p => p.World != null && p.World.SNO == worldSno))
|
||||
{
|
||||
action.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!OnLoadWorldActions.ContainsKey(worldSNO))
|
||||
OnLoadWorldActions.Add(worldSNO, new List<Action>());
|
||||
if (!OnLoadWorldActions.ContainsKey(worldSno))
|
||||
OnLoadWorldActions.Add(worldSno, new List<Action>());
|
||||
|
||||
OnLoadWorldActions[worldSNO].Add(action);
|
||||
OnLoadWorldActions[worldSno].Add(action);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddOnLoadSceneAction(int sceneSNO, Action action)
|
||||
public void AddOnLoadSceneAction(int sceneSno, Action action)
|
||||
{
|
||||
Logger.Trace("AddOnLoadSceneAction: {0}", sceneSNO);
|
||||
if (!OnLoadSceneActions.ContainsKey(sceneSNO))
|
||||
OnLoadSceneActions.Add(sceneSNO, new List<Action>());
|
||||
Logger.Trace("AddOnLoadSceneAction: {0}", sceneSno);
|
||||
if (!OnLoadSceneActions.ContainsKey(sceneSno))
|
||||
OnLoadSceneActions.Add(sceneSno, new List<Action>());
|
||||
|
||||
OnLoadSceneActions[sceneSNO].Add(action);
|
||||
OnLoadSceneActions[sceneSno].Add(action);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -1683,17 +1673,17 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
_worlds.TryRemove(world.SNO, out removed);
|
||||
}
|
||||
|
||||
public World GetWorld(WorldSno worldSNO)
|
||||
public World GetWorld(WorldSno worldSno)
|
||||
{
|
||||
if (worldSNO == WorldSno.__NONE)
|
||||
if (worldSno == WorldSno.__NONE)
|
||||
return null;
|
||||
|
||||
World world;
|
||||
|
||||
if (CurrentAct != 3000 && worldSNO == WorldSno.x1_tristram_adventure_mode_hub) //fix for a1 Tristram
|
||||
worldSNO = WorldSno.trout_town;
|
||||
if (CurrentAct != 3000 && worldSno == WorldSno.x1_tristram_adventure_mode_hub) //fix for a1 Tristram
|
||||
worldSno = WorldSno.trout_town;
|
||||
|
||||
if (!WorldExists(worldSNO)) // If it doesn't exist, try to load it
|
||||
if (!WorldExists(worldSno)) // If it doesn't exist, try to load it
|
||||
{
|
||||
//Task loading = Task.Run(() => {world = this.WorldGenerator.Generate(worldSNO);});
|
||||
//if (!loading.Wait(TimeSpan.FromSeconds(30)))
|
||||
@ -1712,21 +1702,21 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
timer.Start();*/
|
||||
//Task.Delay(1000).ContinueWith(t => { if (!this.WorldGenerator.Actions.Contains(action)) loaded = true; }).Wait();
|
||||
//}
|
||||
world = WorldGenerator.Generate(worldSNO);
|
||||
if (world == null) Logger.Warn("Failed to generate world with sno: {0}", worldSNO);
|
||||
world = WorldGenerator.Generate(worldSno);
|
||||
if (world == null) Logger.Warn("Failed to generate world with sno: {0}", worldSno);
|
||||
}
|
||||
_worlds.TryGetValue(worldSNO, out world);
|
||||
_worlds.TryGetValue(worldSno, out world);
|
||||
return world;
|
||||
}
|
||||
|
||||
public bool WorldExists(WorldSno worldSNO)
|
||||
public bool WorldExists(WorldSno worldSno)
|
||||
{
|
||||
return _worlds.ContainsKey(worldSNO);
|
||||
return _worlds.ContainsKey(worldSno);
|
||||
}
|
||||
|
||||
public bool WorldCleared(WorldSno worldSNO)
|
||||
public bool WorldCleared(WorldSno worldSno)
|
||||
{
|
||||
return _worlds[worldSNO].Actors.Values.OfType<Monster>().Count(m => m.OriginalLevelArea != -1 && !m.Dead) < 5;
|
||||
return _worlds[worldSno].Actors.Values.OfType<Monster>().Count(m => m.OriginalLevelArea != -1 && !m.Dead) < 5;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -1736,15 +1726,21 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||
/// <returns><see cref="World"/></returns>
|
||||
public World GetWayPointWorldById(int id)
|
||||
{
|
||||
Logger.MethodTrace($"id {id}");
|
||||
bool isOpenWorld = CurrentAct == 3000;
|
||||
var actData = ((DiIiS_NA.Core.MPQ.FileFormats.Act)MPQStorage.Data.Assets[SNOGroup.Act][CurrentActSNOid].Data).WayPointInfo.ToList();
|
||||
ImmutableArray<WaypointInfo> actData;
|
||||
if (isOpenWorld)
|
||||
actData = ((DiIiS_NA.Core.MPQ.FileFormats.Act)MPQStorage.Data.Assets[SNOGroup.Act][70015].Data).WayPointInfo
|
||||
.Union(((DiIiS_NA.Core.MPQ.FileFormats.Act)MPQStorage.Data.Assets[SNOGroup.Act][70016].Data).WayPointInfo)
|
||||
.Union(((DiIiS_NA.Core.MPQ.FileFormats.Act)MPQStorage.Data.Assets[SNOGroup.Act][70017].Data).WayPointInfo)
|
||||
.Union(((DiIiS_NA.Core.MPQ.FileFormats.Act)MPQStorage.Data.Assets[SNOGroup.Act][70018].Data).WayPointInfo)
|
||||
.Union(((DiIiS_NA.Core.MPQ.FileFormats.Act)MPQStorage.Data.Assets[SNOGroup.Act][236915].Data).WayPointInfo)
|
||||
.Where(w => w.SNOWorld != -1).ToList();
|
||||
actData = ((Act)MPQStorage.Data.Assets[SNOGroup.Act][70015].Data).WayPointInfo
|
||||
.Union(((Act)MPQStorage.Data.Assets[SNOGroup.Act][70016].Data).WayPointInfo)
|
||||
.Union(((Act)MPQStorage.Data.Assets[SNOGroup.Act][70017].Data).WayPointInfo)
|
||||
.Union(((Act)MPQStorage.Data.Assets[SNOGroup.Act][70018].Data).WayPointInfo)
|
||||
.Union(((Act)MPQStorage.Data.Assets[SNOGroup.Act][236915].Data).WayPointInfo)
|
||||
.Where(w => w.SNOWorld != -1).ToImmutableArray();
|
||||
else
|
||||
{
|
||||
actData = ((Act)MPQStorage.Data.Assets[SNOGroup.Act][CurrentActSnoId].Data).WayPointInfo.ToImmutableArray();
|
||||
|
||||
}
|
||||
var wayPointInfo = actData.Where(w => w.Flags == 3 || (isOpenWorld ? (w.Flags == 2) : (w.Flags == 1))).ToList();
|
||||
//Logger.Debug("GetWayPointWorldById: world id {0}", wayPointInfo[id].SNOWorld);
|
||||
return GetWorld((WorldSno)wayPointInfo[id].SNOWorld);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using DiIiS_NA.Core.Extensions;
|
||||
@ -191,10 +192,10 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
if (!Game.Empty)
|
||||
{
|
||||
SaveQuestProgress(true);
|
||||
Logger.Trace($"$[white]$(Advance)$[/]$ Game {Game.GameId} Advanced to quest $[underline white]${Game.CurrentQuest}$[/], completed $[underline white]${Quests[Game.CurrentQuest].Completed}$[/]$");
|
||||
Logger.Trace($"$[white]$(Advance)$[/]$ Game {Game.GameId} Advanced to quest $[underline white]${Game.CurrentQuest}$[/]$, completed $[underline white]${Quests[Game.CurrentQuest].Completed}$[/]$");
|
||||
foreach (var player in Game.Players.Values)
|
||||
{
|
||||
int xpReward = (int)(Quests[Game.CurrentQuest].RewardXp * Game.XPModifier);
|
||||
int xpReward = (int)(Quests[Game.CurrentQuest].RewardXp * Game.XpModifier);
|
||||
int goldReward = (int)(Quests[Game.CurrentQuest].RewardGold * Game.GoldModifier);
|
||||
if (Game.CurrentQuest != 312429)
|
||||
{
|
||||
@ -269,7 +270,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
}
|
||||
OnQuestProgress();
|
||||
AutoSetQuestMarker();
|
||||
Logger.Trace($"$[white]$(Advance)$[/]$ Game {Game.GameId} Advanced to quest $[underline white]${Game.CurrentQuest}$[/], step $[underline white]${Game.CurrentStep}$[/]$");
|
||||
Logger.Trace($"$[white]$(Advance)$[/]$ Game {Game.GameId} Advanced to quest $[underline white]${Game.CurrentQuest}$[/]$, step $[underline white]${Game.CurrentStep}$[/]$");
|
||||
}
|
||||
|
||||
public void SideAdvance()
|
||||
@ -299,7 +300,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
|
||||
foreach (var player in Game.Players.Values)
|
||||
{
|
||||
int xpReward = (int)(SideQuests[Game.CurrentSideQuest].RewardXp * Game.XPModifier);
|
||||
int xpReward = (int)(SideQuests[Game.CurrentSideQuest].RewardXp * Game.XpModifier);
|
||||
int goldReward = (int)(SideQuests[Game.CurrentSideQuest].RewardGold * Game.GoldModifier);
|
||||
|
||||
player.InGameClient.SendMessage(new QuestStepCompleteMessage()
|
||||
@ -330,7 +331,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
}
|
||||
var toon = player.Toon.DBToon;
|
||||
toon.EventsCompleted++;
|
||||
Game.GameDBSession.SessionUpdate(toon);
|
||||
Game.GameDbSession.SessionUpdate(toon);
|
||||
player.CheckQuestCriteria(Game.CurrentSideQuest);
|
||||
};
|
||||
|
||||
@ -538,61 +539,75 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
|
||||
public void AutoSetQuestMarker()
|
||||
{
|
||||
Logger.MethodTrace(
|
||||
$"{Game.QuestProgress.QuestTriggers.Count} triggers found on {Game.CurrentActEnum.ToString()} - quest {Game.CurrentQuest} step {Game.CurrentStep}");
|
||||
|
||||
// TODO: more triggers?
|
||||
#if DEBUG
|
||||
if (Game.QuestProgress.QuestTriggers.Count > 1)
|
||||
Logger.Warn($"Found {Game.QuestProgress.QuestTriggers.Count} triggers on {Game.CurrentActEnum.ToString()} - quest {Game.CurrentQuest} step {Game.CurrentStep} but only one is supported");
|
||||
#endif
|
||||
if (Game.QuestProgress.QuestTriggers.Count == 1)
|
||||
{
|
||||
Logger.MethodTrace($"{Game.QuestProgress.QuestTriggers.Count} triggers found");
|
||||
var trigger = Game.QuestProgress.QuestTriggers.First();
|
||||
if (trigger.Value.triggerType == QuestStepObjectiveType.InteractWithActor)
|
||||
foreach (var world in Game.Worlds)
|
||||
switch (trigger.Value.triggerType)
|
||||
{
|
||||
case QuestStepObjectiveType.InteractWithActor:
|
||||
{
|
||||
var actors = world.GetActorsBySNO((ActorSno)trigger.Key).Where(d => d.Visible);
|
||||
Actor actor = null;
|
||||
if (actors.Count() == 1) actor = actors.First();
|
||||
if (actor != null)
|
||||
foreach (var plr in world.Players.Values)
|
||||
plr.InGameClient.SendMessage(new MapMarkerInfoMessage
|
||||
{
|
||||
HashedName = StringHashHelper.HashItemName("QuestMarker"),
|
||||
Place = new WorldPlace { Position = actor.Position, WorldID = world.GlobalID },
|
||||
ImageInfo = 81058,
|
||||
Label = -1,
|
||||
snoStringList = -1,
|
||||
snoKnownActorOverride = -1,
|
||||
snoQuestSource = -1,
|
||||
Image = -1,
|
||||
Active = true,
|
||||
CanBecomeArrow = true,
|
||||
RespectsFoW = false,
|
||||
IsPing = true,
|
||||
PlayerUseFlags = 0
|
||||
});
|
||||
}
|
||||
foreach (var world in Game.Worlds)
|
||||
{
|
||||
var actor = world.GetActorsBySNO((ActorSno)trigger.Key).FirstOrDefault(d => d.Visible);
|
||||
if (actor != null)
|
||||
world.BroadcastOperation(player =>
|
||||
player.InGameClient.SendMessage(new MapMarkerInfoMessage
|
||||
{
|
||||
HashedName = StringHashHelper.HashItemName("QuestMarker"),
|
||||
Place = new WorldPlace { Position = actor.Position, WorldID = world.GlobalID },
|
||||
ImageInfo = 81058,
|
||||
Label = -1,
|
||||
snoStringList = -1,
|
||||
snoKnownActorOverride = -1,
|
||||
snoQuestSource = -1,
|
||||
Image = -1,
|
||||
Active = true,
|
||||
CanBecomeArrow = true,
|
||||
RespectsFoW = false,
|
||||
IsPing = true,
|
||||
PlayerUseFlags = 0
|
||||
}));
|
||||
}
|
||||
|
||||
if (trigger.Value.triggerType == QuestStepObjectiveType.HadConversation)
|
||||
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;
|
||||
if (actors.Count() == 1) actor = actors.First();
|
||||
if (actor != null)
|
||||
foreach (var plr in world.Players.Values)
|
||||
plr.InGameClient.SendMessage(new MapMarkerInfoMessage
|
||||
{
|
||||
HashedName = StringHashHelper.HashItemName("QuestMarker"),
|
||||
Place = new WorldPlace { Position = actor.Position, WorldID = world.GlobalID },
|
||||
ImageInfo = 81058,
|
||||
Label = -1,
|
||||
snoStringList = -1,
|
||||
snoKnownActorOverride = -1,
|
||||
snoQuestSource = -1,
|
||||
Image = -1,
|
||||
Active = true,
|
||||
CanBecomeArrow = true,
|
||||
RespectsFoW = false,
|
||||
IsPing = true,
|
||||
PlayerUseFlags = 0
|
||||
});
|
||||
break;
|
||||
}
|
||||
case QuestStepObjectiveType.HadConversation:
|
||||
{
|
||||
foreach (var world in Game.Worlds)
|
||||
{
|
||||
var actor = world.Actors.Values.FirstOrDefault(d => d.Visible && (d is InteractiveNPC npc)
|
||||
&& npc.Conversations.Any(c => c.ConversationSNO == trigger.Key));
|
||||
if (actor != null)
|
||||
world.BroadcastOperation(player =>
|
||||
player.InGameClient.SendMessage(new MapMarkerInfoMessage
|
||||
{
|
||||
HashedName = StringHashHelper.HashItemName("QuestMarker"),
|
||||
Place = new WorldPlace { Position = actor.Position, WorldID = world.GlobalID },
|
||||
ImageInfo = 81058,
|
||||
Label = -1,
|
||||
snoStringList = -1,
|
||||
snoKnownActorOverride = -1,
|
||||
snoQuestSource = -1,
|
||||
Image = -1,
|
||||
Active = true,
|
||||
CanBecomeArrow = true,
|
||||
RespectsFoW = false,
|
||||
IsPing = true,
|
||||
PlayerUseFlags = 0
|
||||
}));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -670,30 +685,26 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
|
||||
public bool HasCurrentQuest(int snoQuest, int Step, bool strictFilter)
|
||||
{
|
||||
if (Quests.ContainsKey(snoQuest) || SideQuests.ContainsKey(snoQuest))
|
||||
if (!Quests.ContainsKey(snoQuest) && !SideQuests.ContainsKey(snoQuest)) return false;
|
||||
if (strictFilter)
|
||||
{
|
||||
if (strictFilter)
|
||||
{
|
||||
if ((Game.CurrentQuest == snoQuest) && (Game.CurrentStep == Step)
|
||||
||
|
||||
(Game.CurrentSideQuest == snoQuest) && (Game.CurrentSideStep == Step))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Game.CurrentQuest == snoQuest || snoQuest == -1) && (Game.CurrentStep == Step || Step == -1 || Step == 0)
|
||||
||
|
||||
(Game.CurrentSideQuest == snoQuest || snoQuest == -1) && (Game.CurrentSideStep == Step || Step == -1 || Step == 0))
|
||||
return true;
|
||||
}
|
||||
if ((Game.CurrentQuest == snoQuest) && (Game.CurrentStep == Step) ||
|
||||
(Game.CurrentSideQuest == snoQuest) && (Game.CurrentSideStep == Step))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Game.CurrentQuest == snoQuest || snoQuest == -1) &&
|
||||
(Game.CurrentStep == Step || Step == -1 || Step == 0) ||
|
||||
(Game.CurrentSideQuest == snoQuest || snoQuest == -1) &&
|
||||
(Game.CurrentSideStep == Step || Step == -1 || Step == 0))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasQuest(int snoQuest)
|
||||
{
|
||||
return Quests.ContainsKey(snoQuest);
|
||||
}
|
||||
public bool HasQuest(int snoQuest) => Quests.ContainsKey(snoQuest);
|
||||
|
||||
public void SetQuestsForJoined(Player joinedPlayer)
|
||||
{
|
||||
@ -710,14 +721,10 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
});
|
||||
}
|
||||
|
||||
public bool IsDone(int snoQuest)
|
||||
{
|
||||
return Quests.ContainsKey(snoQuest) && Quests[snoQuest].Completed;
|
||||
}
|
||||
public bool IsDone(int snoQuest) => Quests.ContainsKey(snoQuest) && Quests[snoQuest].Completed;
|
||||
|
||||
public bool IsInQuestRange(QuestRange range)
|
||||
{
|
||||
|
||||
if (range.Header.SNOId == 312431) return (Game.CurrentAct == 3000);
|
||||
if (range.Header.SNOId == 214766) return true;
|
||||
|
||||
@ -725,19 +732,19 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
bool ended = false;
|
||||
|
||||
|
||||
foreach (var range_entry in range.Enitys)
|
||||
foreach (var rangeEntry in range.Enitys)
|
||||
{
|
||||
if (range_entry != null)
|
||||
if (rangeEntry != null)
|
||||
{
|
||||
if (range_entry.Start.SNOQuest == -1 || range_entry.Start.StepID == -1)
|
||||
if (rangeEntry.Start.SNOQuest == -1 || rangeEntry.Start.StepID == -1)
|
||||
started = true;
|
||||
else
|
||||
{
|
||||
if (Quests.ContainsKey(range_entry.Start.SNOQuest) && Quests[range_entry.Start.SNOQuest].Steps.ContainsKey(range_entry.Start.StepID))
|
||||
if (Quests.ContainsKey(rangeEntry.Start.SNOQuest) && Quests[rangeEntry.Start.SNOQuest].Steps.ContainsKey(rangeEntry.Start.StepID))
|
||||
{
|
||||
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
|
||||
if (Quests[rangeEntry.Start.SNOQuest].Completed ||
|
||||
Quests[rangeEntry.Start.SNOQuest].Steps[rangeEntry.Start.StepID].Completed ||
|
||||
(Game.CurrentQuest == rangeEntry.Start.SNOQuest && Game.CurrentStep == rangeEntry.Start.StepID)) // rumford conversation needs current step
|
||||
started = true;
|
||||
}
|
||||
//else logger.Warn("QuestRange {0} references unknown quest {1}", range.Header.SNOId, range.Start.SNOQuest);
|
||||
@ -745,14 +752,14 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
|
||||
//Logger.Debug("IsInQuestRange {0} and started? {1} ", range.Header.SNOId, started);
|
||||
|
||||
if (range_entry.End.SNOQuest == -1 || range_entry.End.StepID < 0)
|
||||
if (rangeEntry.End.SNOQuest == -1 || rangeEntry.End.StepID < 0)
|
||||
ended = false;
|
||||
else
|
||||
{
|
||||
if (Quests.ContainsKey(range_entry.End.SNOQuest) && Quests[range_entry.End.SNOQuest].Steps.ContainsKey(range_entry.End.StepID))
|
||||
if (Quests.ContainsKey(rangeEntry.End.SNOQuest) && Quests[rangeEntry.End.SNOQuest].Steps.ContainsKey(rangeEntry.End.StepID))
|
||||
{
|
||||
if (Quests[range_entry.End.SNOQuest].Completed ||
|
||||
Quests[range_entry.End.SNOQuest].Steps[range_entry.End.StepID].Completed)
|
||||
if (Quests[rangeEntry.End.SNOQuest].Completed ||
|
||||
Quests[rangeEntry.End.SNOQuest].Steps[rangeEntry.End.StepID].Completed)
|
||||
ended = true;
|
||||
}
|
||||
//else logger.Warn("QuestRange {0} references unknown quest {1}", range.Header.SNOId, range.End.SNOQuest);
|
||||
@ -811,7 +818,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
player.Toon.CurrentQuestId = Game.CurrentQuest;
|
||||
player.Toon.CurrentQuestStepId = Game.CurrentStep;
|
||||
|
||||
List<DBQuestHistory> query = Game.GameDBSession.SessionQueryWhere<DBQuestHistory>(
|
||||
List<DBQuestHistory> query = Game.GameDbSession.SessionQueryWhere<DBQuestHistory>(
|
||||
dbi => dbi.DBToon.Id == player.Toon.PersistentID && dbi.QuestId == Game.CurrentQuest);
|
||||
if (query.Count == 0)
|
||||
{
|
||||
@ -819,7 +826,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
questHistory.DBToon = player.Toon.DBToon;
|
||||
questHistory.QuestId = Game.CurrentQuest;
|
||||
questHistory.QuestStep = Game.CurrentStep;
|
||||
Game.GameDBSession.SessionSave(questHistory);
|
||||
Game.GameDbSession.SessionSave(questHistory);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -828,7 +835,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
{
|
||||
questHistory.QuestStep = Game.CurrentStep;
|
||||
if (questCompleted) questHistory.isCompleted = true;
|
||||
Game.GameDBSession.SessionUpdate(questHistory);
|
||||
Game.GameDbSession.SessionUpdate(questHistory);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -908,7 +915,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
foreach (var player in QuestManager.Game.Players.Values)
|
||||
{
|
||||
List<GameServer.GSSystem.MapSystem.Scene> Scenes = new List<GameServer.GSSystem.MapSystem.Scene>();
|
||||
int MonsterCount = 0;
|
||||
int monsterCount = 0;
|
||||
foreach (var scene in QuestManager.Game.GetWorld(world).Scenes.Values)
|
||||
if (!scene.SceneSNO.Name.ToLower().Contains("filler"))
|
||||
if (scene.Specification.SNOLevelAreas[0] == LevelArea)
|
||||
@ -916,7 +923,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
Scenes.Add(scene);
|
||||
foreach (var act in scene.Actors)
|
||||
if (act is Monster)
|
||||
MonsterCount++;
|
||||
monsterCount++;
|
||||
}
|
||||
|
||||
|
||||
@ -929,22 +936,22 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
Counter = AdditionalTargetCounter,
|
||||
Checked = (AdditionalTargetNeed <= AdditionalTargetCounter) ? 1 : 0
|
||||
});
|
||||
if (MonsterCount < AdditionalTargetCounter + 20)
|
||||
if (monsterCount < AdditionalTargetCounter + 20)
|
||||
{
|
||||
while (MonsterCount < AdditionalTargetCounter + 20)
|
||||
while (monsterCount < AdditionalTargetCounter + 20)
|
||||
{
|
||||
GameServer.Core.Types.Math.Vector3D SSV = Scenes[RandomHelper.Next(0, Scenes.Count)].Position;
|
||||
GameServer.Core.Types.Math.Vector3D SP = null;
|
||||
GameServer.Core.Types.Math.Vector3D scenePoint = Scenes[RandomHelper.Next(0, Scenes.Count)].Position;
|
||||
GameServer.Core.Types.Math.Vector3D point = null;
|
||||
while (true)
|
||||
{
|
||||
SP = new GameServer.Core.Types.Math.Vector3D(SSV.X + RandomHelper.Next(0, 240), SSV.Y + RandomHelper.Next(0, 240), SSV.Z);
|
||||
if (QuestManager.Game.GetWorld(world).CheckLocationForFlag(SP, Scene.NavCellFlags.AllowWalk))
|
||||
point = new GameServer.Core.Types.Math.Vector3D(scenePoint.X + RandomHelper.Next(0, 240), scenePoint.Y + RandomHelper.Next(0, 240), scenePoint.Z);
|
||||
if (QuestManager.Game.GetWorld(world).CheckLocationForFlag(point, Scene.NavCellFlags.AllowWalk))
|
||||
break;
|
||||
}
|
||||
QuestManager.Game.GetWorld(world).SpawnMonster((ActorSno)GameServer.GSSystem.GeneratorsSystem.SpawnGenerator.Spawns[LevelArea].melee[FastRandom.Instance.Next(GameServer.GSSystem.GeneratorsSystem.SpawnGenerator.Spawns[LevelArea].melee.Count)], SP);
|
||||
MonsterCount++;
|
||||
QuestManager.Game.GetWorld(world).SpawnMonster((ActorSno)GameServer.GSSystem.GeneratorsSystem.SpawnGenerator.Spawns[LevelArea].melee[FastRandom.Instance.Next(GameServer.GSSystem.GeneratorsSystem.SpawnGenerator.Spawns[LevelArea].melee.Count)], point);
|
||||
monsterCount++;
|
||||
}
|
||||
} //Нужен дополнительный спаун монстров, их мало
|
||||
} // Need additional monster spawn, there are few of them
|
||||
}
|
||||
if (Target == snoId)
|
||||
{
|
||||
@ -963,23 +970,23 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
if (!TargetSpawned)
|
||||
if (QuestManager.Game.GetWorld(world).GetActorBySNO((ActorSno)Target) == null)
|
||||
{
|
||||
List<GameServer.GSSystem.MapSystem.Scene> Scenes = new List<GameServer.GSSystem.MapSystem.Scene>();
|
||||
List<GameServer.GSSystem.MapSystem.Scene> scenes = new List<GameServer.GSSystem.MapSystem.Scene>();
|
||||
foreach (var scene in QuestManager.Game.GetWorld(world).Scenes.Values)
|
||||
{
|
||||
if (!scene.SceneSNO.Name.ToLower().Contains("filler"))
|
||||
if (scene.Specification.SNOLevelAreas[0] == LevelArea)
|
||||
Scenes.Add(scene);
|
||||
scenes.Add(scene);
|
||||
}
|
||||
|
||||
GameServer.Core.Types.Math.Vector3D SSV = Scenes[RandomHelper.Next(0, Scenes.Count - 1)].Position;
|
||||
GameServer.Core.Types.Math.Vector3D SP = null;
|
||||
GameServer.Core.Types.Math.Vector3D scenePoint = scenes[RandomHelper.Next(0, scenes.Count - 1)].Position;
|
||||
GameServer.Core.Types.Math.Vector3D point = null;
|
||||
while (true)
|
||||
{
|
||||
SP = new GameServer.Core.Types.Math.Vector3D(SSV.X + RandomHelper.Next(0, 240), SSV.Y + RandomHelper.Next(0, 240), SSV.Z);
|
||||
if (QuestManager.Game.GetWorld(world).CheckLocationForFlag(SP, Scene.NavCellFlags.AllowWalk))
|
||||
point = new GameServer.Core.Types.Math.Vector3D(scenePoint.X + RandomHelper.Next(0, 240), scenePoint.Y + RandomHelper.Next(0, 240), scenePoint.Z);
|
||||
if (QuestManager.Game.GetWorld(world).CheckLocationForFlag(point, Scene.NavCellFlags.AllowWalk))
|
||||
break;
|
||||
}
|
||||
QuestManager.Game.GetWorld(world).SpawnMonster((ActorSno)Target, SP);
|
||||
QuestManager.Game.GetWorld(world).SpawnMonster((ActorSno)Target, point);
|
||||
TargetSpawned = true;
|
||||
}
|
||||
|
||||
@ -1015,7 +1022,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
{
|
||||
foreach (var player in QuestManager.Game.Players.Values)
|
||||
{
|
||||
var xpReward = 1000 * player.Level * (1 + (player.Level / 7)) * QuestManager.Game.XPModifier;
|
||||
var xpReward = 1000 * player.Level * (1 + (player.Level / 7)) * QuestManager.Game.XpModifier;
|
||||
if (Type == BountyData.BountyType.KillUnique)
|
||||
xpReward *= 1.8f;
|
||||
if (Type == BountyData.BountyType.ClearDungeon)
|
||||
@ -1049,8 +1056,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
||||
player.UpdateAchievementCounter(412, 1);
|
||||
}
|
||||
Finished = true;
|
||||
QuestManager.Game.BountiesCompleted[Act]++;
|
||||
if (QuestManager.Game.BountiesCompleted[Act] == 5)
|
||||
if (++QuestManager.Game.BountiesCompleted[Act] == 5)
|
||||
{
|
||||
switch (Act)
|
||||
{
|
||||
|
||||
@ -24,7 +24,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem.Implementations
|
||||
target.Attributes[GameAttribute.DyeType] = Attributes[GameAttribute.DyeType];
|
||||
target.DBInventory.DyeType = Attributes[GameAttribute.DyeType];
|
||||
|
||||
player.World.Game.GameDBSession.SessionUpdate(target.DBInventory);
|
||||
player.World.Game.GameDbSession.SessionUpdate(target.DBInventory);
|
||||
|
||||
player.Inventory.SendVisualInventory(player);
|
||||
|
||||
|
||||
@ -359,7 +359,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
||||
// DBInventory.Unidentified = false;
|
||||
Attributes[GameAttribute.Unidentified] = false;
|
||||
|
||||
Owner.World.Game.GameDBSession.SessionUpdate(DBInventory);
|
||||
Owner.World.Game.GameDbSession.SessionUpdate(DBInventory);
|
||||
if (Owner is Player player)
|
||||
{
|
||||
Unreveal(player);
|
||||
@ -572,20 +572,20 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
||||
{
|
||||
Attributes[GameAttribute.Durability_Cur] = newDurability;
|
||||
DBInventory.Durability = newDurability;
|
||||
Owner.World.Game.GameDBSession.SessionUpdate(DBInventory);
|
||||
Owner.World.Game.GameDbSession.SessionUpdate(DBInventory);
|
||||
}
|
||||
|
||||
public void UpdateTransmog(int newTransmogGBID)
|
||||
{
|
||||
Attributes[GameAttribute.TransmogGBID] = newTransmogGBID;
|
||||
DBInventory.TransmogGBID = newTransmogGBID;
|
||||
Owner.World.Game.GameDBSession.SessionUpdate(DBInventory);
|
||||
Owner.World.Game.GameDbSession.SessionUpdate(DBInventory);
|
||||
}
|
||||
|
||||
public void SaveAttributes()
|
||||
{
|
||||
DBInventory.Attributes = Attributes.Serialize();
|
||||
Owner.World.Game.GameDBSession.SessionUpdate(DBInventory);
|
||||
Owner.World.Game.GameDbSession.SessionUpdate(DBInventory);
|
||||
}
|
||||
|
||||
public void UpdateStackCount(int newCount)
|
||||
@ -597,7 +597,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
||||
Attributes.SendChangedMessage((Owner as Player).InGameClient);
|
||||
|
||||
DBInventory.Count = newCount;
|
||||
Owner.World.Game.GameDBSession.SessionUpdate(DBInventory);
|
||||
Owner.World.Game.GameDbSession.SessionUpdate(DBInventory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1242,7 +1242,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
||||
target.Attributes.BroadcastChangedIfRevealed();
|
||||
target.DBInventory.DyeType = Attributes[GameAttribute.DyeType];
|
||||
|
||||
player.World.Game.GameDBSession.SessionUpdate(target.DBInventory);
|
||||
player.World.Game.GameDbSession.SessionUpdate(target.DBInventory);
|
||||
|
||||
player.Inventory.SendVisualInventory(player);
|
||||
|
||||
@ -1359,7 +1359,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
||||
player.Inventory.SendVisualInventory(player);
|
||||
var dbToon = player.Toon.DBToon;
|
||||
dbToon.WingsActive = player.CurrentWingsPowerId;
|
||||
player.World.Game.GameDBSession.SessionUpdate(dbToon);
|
||||
player.World.Game.GameDbSession.SessionUpdate(dbToon);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
|
||||
/// <summary>
|
||||
/// Returns a new dynamicId for scenes.
|
||||
/// </summary>
|
||||
public uint NewSceneID => IsPvP ? NewPvPSceneID : Game.NewSceneID;
|
||||
public uint NewSceneID => IsPvP ? NewPvPSceneID : Game.NewSceneId;
|
||||
|
||||
public bool IsPvP => SNO == WorldSno.pvp_duel_small_multi; //PvP_Duel_Small
|
||||
|
||||
@ -212,7 +212,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
|
||||
/// <param name="game">The parent game.</param>
|
||||
/// <param name="sno">The sno for the world.</param>
|
||||
public World(Game game, WorldSno sno)
|
||||
: base(sno == WorldSno.pvp_duel_small_multi ? 99999 : game.NewWorldID)
|
||||
: base(sno == WorldSno.pvp_duel_small_multi ? 99999 : game.NewWorldId)
|
||||
{
|
||||
WorldSNO = new SNOHandle(SNOGroup.Worlds, (int)sno);
|
||||
|
||||
|
||||
@ -195,7 +195,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
||||
|
||||
if (expBonus > 0)
|
||||
{
|
||||
expBonus = (int)(expBonus * _player.World.Game.XPModifier);
|
||||
expBonus = (int)(expBonus * _player.World.Game.XpModifier);
|
||||
|
||||
_player.InGameClient.SendMessage(new KillCounterUpdateMessage()
|
||||
{
|
||||
|
||||
@ -1973,7 +1973,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
||||
_stashGrid.ResizeGrid(_owner.Attributes[GameAttribute.Shared_Stash_Slots] / 7, 7);
|
||||
var dbGAcc = _owner.Toon.GameAccount.DBGameAccount;
|
||||
dbGAcc.StashSize = _owner.Attributes[GameAttribute.Shared_Stash_Slots];
|
||||
_owner.World.Game.GameDBSession.SessionUpdate(dbGAcc);
|
||||
_owner.World.Game.GameDbSession.SessionUpdate(dbGAcc);
|
||||
}
|
||||
|
||||
if (_owner.Attributes[GameAttribute.Shared_Stash_Slots] >= 280)
|
||||
@ -2000,15 +2000,15 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
||||
{
|
||||
case 1:
|
||||
item.DBInventory.FirstGem = gem.GBHandle.GBID;
|
||||
_owner.World.Game.GameDBSession.SessionUpdate(item.DBInventory);
|
||||
_owner.World.Game.GameDbSession.SessionUpdate(item.DBInventory);
|
||||
break;
|
||||
case 2:
|
||||
item.DBInventory.SecondGem = gem.GBHandle.GBID;
|
||||
_owner.World.Game.GameDBSession.SessionUpdate(item.DBInventory);
|
||||
_owner.World.Game.GameDbSession.SessionUpdate(item.DBInventory);
|
||||
break;
|
||||
case 3:
|
||||
item.DBInventory.ThirdGem = gem.GBHandle.GBID;
|
||||
_owner.World.Game.GameDBSession.SessionUpdate(item.DBInventory);
|
||||
_owner.World.Game.GameDbSession.SessionUpdate(item.DBInventory);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2073,7 +2073,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
||||
item.DBInventory.SecondGem = -1;
|
||||
item.DBInventory.ThirdGem = -1;
|
||||
|
||||
_owner.World.Game.GameDBSession.SessionUpdate(item.DBInventory);
|
||||
_owner.World.Game.GameDbSession.SessionUpdate(item.DBInventory);
|
||||
|
||||
foreach (var gem in item.Gems)
|
||||
gem.Unreveal(_owner);
|
||||
@ -2352,14 +2352,14 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
||||
//load everything and make a switch on slot_id
|
||||
|
||||
Item item = null;
|
||||
int goldAmount = (int)_owner.World.Game.GameDBSession.SessionGet<DBGameAccount>(_owner.Toon.GameAccount.PersistentID).Gold;
|
||||
int goldAmount = (int)_owner.World.Game.GameDbSession.SessionGet<DBGameAccount>(_owner.Toon.GameAccount.PersistentID).Gold;
|
||||
// Logger.Warn($"User {this._owner.Toon.PersistentID} has {goldAmount} gold.");
|
||||
this.BloodShards = (int)_owner.World.Game.GameDBSession.SessionGet<DBGameAccount>(_owner.Toon.GameAccount.PersistentID).BloodShards;
|
||||
this.BloodShards = (int)_owner.World.Game.GameDbSession.SessionGet<DBGameAccount>(_owner.Toon.GameAccount.PersistentID).BloodShards;
|
||||
// Clear already present items
|
||||
// LoadFromDB is called every time World is changed, even entering a dungeon
|
||||
_inventoryGrid.Clear();
|
||||
// first of all load stash size
|
||||
var slots = _owner.World.Game.GameDBSession.SessionGet<DBGameAccount>(_owner.Toon.GameAccount.PersistentID).StashSize;
|
||||
var slots = _owner.World.Game.GameDbSession.SessionGet<DBGameAccount>(_owner.Toon.GameAccount.PersistentID).StashSize;
|
||||
if (slots > 0)
|
||||
{
|
||||
_owner.Attributes[GameAttribute.Shared_Stash_Slots] = slots;
|
||||
@ -2370,7 +2370,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
||||
|
||||
|
||||
// next read all items
|
||||
var allInventoryItems = _owner.World.Game.GameDBSession.SessionQueryWhere<DBInventory>(
|
||||
var allInventoryItems = _owner.World.Game.GameDbSession.SessionQueryWhere<DBInventory>(
|
||||
dbi =>
|
||||
dbi.DBToon != null &&
|
||||
dbi.HirelingId == 0 &&
|
||||
@ -2441,7 +2441,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
||||
|
||||
// next load all stash items
|
||||
var stashInventoryItems =
|
||||
_owner.World.Game.GameDBSession.SessionQueryWhere<DBInventory>(
|
||||
_owner.World.Game.GameDbSession.SessionQueryWhere<DBInventory>(
|
||||
dbi =>
|
||||
dbi.DBGameAccount.Id == _owner.Toon.GameAccount.PersistentID &&
|
||||
dbi.HirelingId == 0 &&
|
||||
@ -2546,7 +2546,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
||||
ItemGenerator.SaveToDB(item);
|
||||
|
||||
//Logger.Debug("SaveItemToDB, SessionSave");
|
||||
_owner.World.Game.GameDBSession.SessionSave(item.DBInventory);
|
||||
_owner.World.Game.GameDbSession.SessionSave(item.DBInventory);
|
||||
//Logger.Debug("SaveItemToDB success, item dbid: {0}", item.DBInventory.Id);
|
||||
}
|
||||
|
||||
@ -2559,7 +2559,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
||||
return;
|
||||
//var inventory = item.Owner.World.Game.GameDBSession.SessionGet<DBInventory>(item.DBInventory.Id);
|
||||
|
||||
_owner.World.Game.GameDBSession.SessionDelete(item.DBInventory);
|
||||
_owner.World.Game.GameDbSession.SessionDelete(item.DBInventory);
|
||||
|
||||
//Logger.Debug("RemoveItemFromDB success, item dbid: {0}", item.DBInventory.Id);
|
||||
item.DBInventory = null;
|
||||
@ -2582,7 +2582,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
||||
else
|
||||
item.DBInventory.DBToon = (_owner as Player).Toon.DBToon;
|
||||
|
||||
item.Owner.World.Game.GameDBSession.SessionUpdate(item.DBInventory);
|
||||
item.Owner.World.Game.GameDbSession.SessionUpdate(item.DBInventory);
|
||||
//Logger.Debug("ChangeItemSlotDB success, item dbid: {0}", item.DBInventory.Id);
|
||||
}
|
||||
|
||||
@ -2597,7 +2597,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
||||
item.DBInventory.LocationX = locX;
|
||||
item.DBInventory.LocationY = locY;
|
||||
|
||||
item.Owner.World.Game.GameDBSession.SessionUpdate(item.DBInventory);
|
||||
item.Owner.World.Game.GameDbSession.SessionUpdate(item.DBInventory);
|
||||
//Logger.Debug("ChangeItemLocationDB success, item dbid: {0}", item.DBInventory.Id);
|
||||
}
|
||||
|
||||
|
||||
@ -380,7 +380,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
EventWeatherEnabled = false;
|
||||
|
||||
var achievements =
|
||||
InGameClient.Game.GameDBSession.SessionQueryWhere<DBAchievements>(dba =>
|
||||
InGameClient.Game.GameDbSession.SessionQueryWhere<DBAchievements>(dba =>
|
||||
dba.DBGameAccount.Id == Toon.GameAccount.PersistentID);
|
||||
|
||||
BlacksmithUnlocked = achievements.Any(dba => dba.AchievementId == 74987243307766);
|
||||
@ -1754,7 +1754,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
|
||||
public void DeclineBossEncounter()
|
||||
{
|
||||
InGameClient.Game.CurrentEncounter.activated = false;
|
||||
InGameClient.Game.CurrentEncounter.Activated = false;
|
||||
}
|
||||
|
||||
public void TransmuteItemsPlayer(GameClient client, TransmuteItemsMessage message)
|
||||
@ -1892,36 +1892,35 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
exitSceneSno = scene.SceneSNO.Id;
|
||||
var exitSetted = false;
|
||||
foreach (var actor in nephalemPWorld.Actors.Values)
|
||||
if (actor is Portal)
|
||||
if (actor is Portal actor1)
|
||||
{
|
||||
var p = actor as Portal;
|
||||
if (!actor.CurrentScene.SceneSNO.Name.ToLower().Contains("entrance"))
|
||||
if (!actor1.CurrentScene.SceneSNO.Name.ToLower().Contains("entrance"))
|
||||
{
|
||||
if (!actor.CurrentScene.SceneSNO.Name.ToLower().Contains("exit"))
|
||||
if (!actor1.CurrentScene.SceneSNO.Name.ToLower().Contains("exit"))
|
||||
{
|
||||
actor.Destroy();
|
||||
actor1.Destroy();
|
||||
}
|
||||
else if (!exitSetted)
|
||||
{
|
||||
p.Destination.DestLevelAreaSNO = 288684;
|
||||
p.Destination.WorldSNO = (int)InGameClient.Game.WorldOfPortalNephalemSec;
|
||||
actor1.Destination.DestLevelAreaSNO = 288684;
|
||||
actor1.Destination.WorldSNO = (int)InGameClient.Game.WorldOfPortalNephalemSec;
|
||||
exitSetted = true;
|
||||
|
||||
var nephalemPWorldS2 =
|
||||
InGameClient.Game.GetWorld(InGameClient.Game.WorldOfPortalNephalemSec);
|
||||
foreach (var atr in nephalemPWorldS2.Actors.Values)
|
||||
if (atr is Portal)
|
||||
if (atr is Portal portal1)
|
||||
{
|
||||
if (!atr.CurrentScene.SceneSNO.Name.ToLower().Contains("entrance"))
|
||||
if (!portal1.CurrentScene.SceneSNO.Name.ToLower().Contains("entrance"))
|
||||
{
|
||||
atr.Destroy();
|
||||
portal1.Destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
(atr as Portal).Destination.DestLevelAreaSNO = 332339;
|
||||
(atr as Portal).Destination.WorldSNO =
|
||||
portal1.Destination.DestLevelAreaSNO = 332339;
|
||||
portal1.Destination.WorldSNO =
|
||||
(int)WorldSno.x1_tristram_adventure_mode_hub;
|
||||
(atr as Portal).Destination.StartingPointActorTag = 172;
|
||||
portal1.Destination.StartingPointActorTag = 172;
|
||||
}
|
||||
}
|
||||
else if (atr is Waypoint)
|
||||
@ -1931,14 +1930,14 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
}
|
||||
else
|
||||
{
|
||||
actor.Destroy();
|
||||
actor1.Destroy();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
p.Destination.DestLevelAreaSNO = 332339;
|
||||
p.Destination.WorldSNO = (int)WorldSno.x1_tristram_adventure_mode_hub;
|
||||
p.Destination.StartingPointActorTag = 24;
|
||||
actor1.Destination.DestLevelAreaSNO = 332339;
|
||||
actor1.Destination.WorldSNO = (int)WorldSno.x1_tristram_adventure_mode_hub;
|
||||
actor1.Destination.StartingPointActorTag = 24;
|
||||
}
|
||||
}
|
||||
else if (actor is Waypoint)
|
||||
@ -2077,17 +2076,17 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
|
||||
nephalemPWorld = InGameClient.Game.GetWorld(map);
|
||||
foreach (var actor in nephalemPWorld.Actors.Values)
|
||||
if (actor is Portal)
|
||||
if (actor is Portal portal1)
|
||||
{
|
||||
if (!actor.CurrentScene.SceneSNO.Name.ToLower().Contains("entrance"))
|
||||
if (!portal1.CurrentScene.SceneSNO.Name.ToLower().Contains("entrance"))
|
||||
{
|
||||
actor.Destroy();
|
||||
portal1.Destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
(actor as Portal).Destination.DestLevelAreaSNO = 332339;
|
||||
(actor as Portal).Destination.WorldSNO = (int)WorldSno.x1_tristram_adventure_mode_hub;
|
||||
(actor as Portal).Destination.StartingPointActorTag = 24;
|
||||
portal1.Destination.DestLevelAreaSNO = 332339;
|
||||
portal1.Destination.WorldSNO = (int)WorldSno.x1_tristram_adventure_mode_hub;
|
||||
portal1.Destination.StartingPointActorTag = 24;
|
||||
}
|
||||
}
|
||||
else if (actor is Waypoint)
|
||||
@ -2267,7 +2266,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
|
||||
var dbToon = Toon.DBToon;
|
||||
dbToon.ParagonBonuses = ParagonBonuses;
|
||||
World.Game.GameDBSession.SessionUpdate(dbToon);
|
||||
World.Game.GameDbSession.SessionUpdate(dbToon);
|
||||
|
||||
SetAttributesByItems();
|
||||
SetAttributesByItemProcs();
|
||||
@ -2285,7 +2284,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
var dbToon = Toon.DBToon;
|
||||
dbToon.ParagonBonuses = ParagonBonuses;
|
||||
World.Game.GameDBSession.SessionUpdate(dbToon);
|
||||
World.Game.GameDbSession.SessionUpdate(dbToon);
|
||||
|
||||
SetAttributesByItems();
|
||||
SetAttributesByItemProcs();
|
||||
@ -2304,10 +2303,10 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
|
||||
private void OnMailRetrieve(GameClient client, MailRetrieveMessage message)
|
||||
{
|
||||
var dbMail = World.Game.GameDBSession.SessionGet<DBMail>((ulong)message.MailId);
|
||||
var dbMail = World.Game.GameDbSession.SessionGet<DBMail>((ulong)message.MailId);
|
||||
if (dbMail == null || dbMail.DBToon.Id != Toon.PersistentID) return;
|
||||
dbMail.Claimed = true;
|
||||
World.Game.GameDBSession.SessionUpdate(dbMail);
|
||||
World.Game.GameDbSession.SessionUpdate(dbMail);
|
||||
|
||||
if (dbMail.ItemGBID != -1)
|
||||
Inventory.PickUp(ItemGenerator.CookFromDefinition(World, ItemGenerator.GetItemDefinition(dbMail.ItemGBID),
|
||||
@ -2686,15 +2685,19 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
VacuumPickup();
|
||||
if (World.Game.OnLoadWorldActions.ContainsKey(World.SNO))
|
||||
{
|
||||
Logger.Debug("OnLoadWorldActions: {0}", World.SNO);
|
||||
Logger.MethodTrace($"OnLoadWorldActions: {World.SNO}");
|
||||
lock (World.Game.OnLoadWorldActions[World.SNO])
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var action in World.Game.OnLoadWorldActions[World.SNO]) action.Invoke();
|
||||
}
|
||||
catch
|
||||
foreach (var action in World.Game.OnLoadWorldActions[World.SNO])
|
||||
{
|
||||
try
|
||||
{
|
||||
action();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WarnException(ex, "OnLoadWorldActions");
|
||||
}
|
||||
}
|
||||
|
||||
World.Game.OnLoadWorldActions[World.SNO].Clear();
|
||||
@ -2703,15 +2706,21 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
|
||||
if (World.Game.OnLoadSceneActions.ContainsKey(CurrentScene.SceneSNO.Id))
|
||||
{
|
||||
Logger.Debug("OnLoadSceneActions: {0}", CurrentScene.SceneSNO.Id);
|
||||
Logger.MethodTrace($"OnLoadSceneActions: {CurrentScene.SceneSNO.Id}");
|
||||
|
||||
Logger.MethodTrace(World.SNO.ToString());
|
||||
lock (World.Game.OnLoadSceneActions[CurrentScene.SceneSNO.Id])
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var action in World.Game.OnLoadSceneActions[CurrentScene.SceneSNO.Id]) action.Invoke();
|
||||
}
|
||||
catch
|
||||
foreach (var action in World.Game.OnLoadSceneActions[CurrentScene.SceneSNO.Id])
|
||||
{
|
||||
try
|
||||
{
|
||||
action();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WarnException(ex, "OnLoadSceneActions");
|
||||
}
|
||||
}
|
||||
|
||||
World.Game.OnLoadSceneActions[CurrentScene.SceneSNO.Id].Clear();
|
||||
@ -2728,6 +2737,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.EnterLevelArea)
|
||||
try
|
||||
{
|
||||
Logger.MethodTrace($"EnterLevelArea: {levelArea}");
|
||||
trigger.questEvent.Execute(World); // launch a questEvent
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -2735,14 +2745,11 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
Logger.WarnException(e, "questEvent()");
|
||||
}
|
||||
}
|
||||
|
||||
Attributes[GameAttribute.Corpse_Resurrection_Charges] =
|
||||
3; // Reset resurrection charges on zone change (TODO: do not reset charges on reentering the same zone)
|
||||
// Reset resurrection charges on zone change - TODO: do not reset charges on reentering the same zone
|
||||
Attributes[GameAttribute.Corpse_Resurrection_Charges] = Config.Instance.ResurrectionCharges;
|
||||
|
||||
#if DEBUG
|
||||
Logger.Warn("Player Location {0}, Scene: {1} SNO: {2} LevelArea: {3}", Toon.Name,
|
||||
CurrentScene.SceneSNO.Name, CurrentScene.SceneSNO.Id, CurrentScene.Specification.SNOLevelAreas[0]);
|
||||
#else
|
||||
Logger.Warn($"Player Location {Toon.Name}, Scene: {CurrentScene.SceneSNO.Name} SNO: {CurrentScene.SceneSNO.Id} LevelArea: {CurrentScene.Specification.SNOLevelAreas[0]}");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2838,7 +2845,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
public void RefreshReveal()
|
||||
{
|
||||
var range = 200f;
|
||||
if (InGameClient.Game.CurrentEncounter.activated)
|
||||
if (InGameClient.Game.CurrentEncounter.Activated)
|
||||
range = 360f;
|
||||
|
||||
foreach (var actor in GetActorsInRange(range).Where(actor => actor is not Player))
|
||||
@ -2888,7 +2895,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
//*
|
||||
private void OnHirelingDismiss(GameClient client, PetAwayMessage message)
|
||||
{
|
||||
Logger.MethodTrace($"{message.ActorID}");
|
||||
Logger.MethodTrace(message.ActorID.ToString());
|
||||
var petId = World.GetGlobalId(this, message.ActorID);
|
||||
var pet = World.GetActorByGlobalId(petId);
|
||||
if (pet is Hireling)
|
||||
@ -2905,16 +2912,16 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
switch (hireling.Attributes[GameAttribute.Hireling_Class])
|
||||
{
|
||||
case 1:
|
||||
if (!(hireling is Templar)) return;
|
||||
(hireling as Templar).SetSkill(this, message.PowerSNOId);
|
||||
if (hireling is not Templar templar) return;
|
||||
templar.SetSkill(this, message.PowerSNOId);
|
||||
break;
|
||||
case 2:
|
||||
if (!(hireling is Scoundrel)) return;
|
||||
(hireling as Scoundrel).SetSkill(this, message.PowerSNOId);
|
||||
if (hireling is not Scoundrel scoundrel) return;
|
||||
scoundrel.SetSkill(this, message.PowerSNOId);
|
||||
break;
|
||||
case 3:
|
||||
if (!(hireling is Enchantress)) return;
|
||||
(hireling as Enchantress).SetSkill(this, message.PowerSNOId);
|
||||
if (hireling is not Enchantress enchantress) return;
|
||||
enchantress.SetSkill(this, message.PowerSNOId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -2950,7 +2957,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
{
|
||||
var activeSkills = Toon.DBActiveSkills;
|
||||
activeSkills.PotionGBID = message.Field1;
|
||||
World.Game.GameDBSession.SessionUpdate(activeSkills);
|
||||
World.Game.GameDbSession.SessionUpdate(activeSkills);
|
||||
}
|
||||
|
||||
public void ToonStateChanged()
|
||||
@ -2999,7 +3006,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
Inventory.GrabSomeItems(ingr.ItemsGBID, ingr.Count);
|
||||
|
||||
trainHelper.DbRef.Level++;
|
||||
World.Game.GameDBSession.SessionUpdate(trainHelper.DbRef);
|
||||
World.Game.GameDbSession.SessionUpdate(trainHelper.DbRef);
|
||||
|
||||
if (trainHelper.Achievement is not null)
|
||||
GrantAchievement(trainHelper.Achievement.Value);
|
||||
@ -3031,7 +3038,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
Logger.Trace("Learning transmog #{0}", transmogGBID);
|
||||
learnedTransmogs.Add(transmogGBID);
|
||||
mystic_data.LearnedRecipes = SerializeBytes(learnedTransmogs);
|
||||
World.Game.GameDBSession.SessionUpdate(mystic_data);
|
||||
World.Game.GameDbSession.SessionUpdate(mystic_data);
|
||||
|
||||
LoadCrafterData();
|
||||
}
|
||||
@ -3487,7 +3494,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
public void RevealActorsToPlayer()
|
||||
{
|
||||
var Range = 200f;
|
||||
if (InGameClient.Game.CurrentEncounter.activated)
|
||||
if (InGameClient.Game.CurrentEncounter.Activated)
|
||||
Range = 360f;
|
||||
|
||||
var specialWorlds = new WorldSno[]
|
||||
@ -3506,15 +3513,15 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
if (actor is Player) // if the actors is already revealed, skip it.
|
||||
continue;
|
||||
|
||||
if (World.SNO == WorldSno.x1_tristram_adventure_mode_hub && actor is Portal)
|
||||
if ((actor as Portal).Destination.WorldSNO == (int)WorldSno.x1_tristram_adventure_mode_hub)
|
||||
if (World.SNO == WorldSno.x1_tristram_adventure_mode_hub && actor is Portal portal)
|
||||
if (portal.Destination.WorldSNO == (int)WorldSno.x1_tristram_adventure_mode_hub)
|
||||
continue;
|
||||
if (World.SNO == WorldSno.trout_town && actor is Portal)
|
||||
if ((actor as Portal).Destination.WorldSNO == (int)WorldSno.trout_town &&
|
||||
(actor as Portal).Destination.DestLevelAreaSNO == 19947)
|
||||
if (World.SNO == WorldSno.trout_town && actor is Portal portal1)
|
||||
if (portal1.Destination.WorldSNO == (int)WorldSno.trout_town &&
|
||||
portal1.Destination.DestLevelAreaSNO == 19947)
|
||||
{
|
||||
(actor as Portal).Destination.WorldSNO = (int)WorldSno.x1_tristram_adventure_mode_hub;
|
||||
(actor as Portal).Destination.StartingPointActorTag = 483;
|
||||
portal1.Destination.WorldSNO = (int)WorldSno.x1_tristram_adventure_mode_hub;
|
||||
portal1.Destination.StartingPointActorTag = 483;
|
||||
}
|
||||
|
||||
if (actor.ActorType != ActorType.ClientEffect && actor.ActorType != ActorType.AxeSymbol &&
|
||||
@ -4258,7 +4265,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
serialized += totalDamage.ToString("F0");
|
||||
var dbStats = Toon.DBToon;
|
||||
dbStats.Stats = serialized;
|
||||
World.Game.GameDBSession.SessionUpdate(dbStats);
|
||||
World.Game.GameDbSession.SessionUpdate(dbStats);
|
||||
}
|
||||
|
||||
public List<PlayerQuestRewardHistoryEntry> QuestRewardHistory
|
||||
@ -4326,7 +4333,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
|
||||
public void CheckBonusSets()
|
||||
{
|
||||
var sets = World.Game.GameDBSession
|
||||
var sets = World.Game.GameDbSession
|
||||
.SessionQueryWhere<DBBonusSets>(dbi => dbi.DBAccount.Id == Toon.GameAccount.AccountId).ToList();
|
||||
foreach (var bonusSet in sets)
|
||||
{
|
||||
@ -4357,14 +4364,14 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
}
|
||||
|
||||
//BonusSetsList.CollectionEditions[bonusSet.SetId].Claim(this);
|
||||
World.Game.GameDBSession.SessionUpdate(bonusSet);
|
||||
World.Game.GameDbSession.SessionUpdate(bonusSet);
|
||||
//this.InGameClient.SendMessage(new BroadcastTextMessage() { Field0 = "You have been granted with gifts from bonus pack!" });
|
||||
}
|
||||
}
|
||||
|
||||
public HirelingInfo GetHirelingInfo(int type)
|
||||
{
|
||||
var query = World.Game.GameDBSession
|
||||
var query = World.Game.GameDbSession
|
||||
.SessionQueryWhere<DBHireling>(dbh => dbh.DBToon.Id == Toon.PersistentID && dbh.Class == type).ToList();
|
||||
if (query.Count == 0)
|
||||
{
|
||||
@ -4433,14 +4440,14 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
{
|
||||
learnedBlacksmithRecipes.Add(recipe);
|
||||
blacksmith_data.LearnedRecipes = SerializeBytes(learnedBlacksmithRecipes);
|
||||
World.Game.GameDBSession.SessionUpdate(blacksmith_data);
|
||||
World.Game.GameDbSession.SessionUpdate(blacksmith_data);
|
||||
UpdateAchievementCounter(404, 1, 0);
|
||||
}
|
||||
else if (artisan == ArtisanType.Jeweler)
|
||||
{
|
||||
learnedJewelerRecipes.Add(recipe);
|
||||
jeweler_data.LearnedRecipes = SerializeBytes(learnedJewelerRecipes);
|
||||
World.Game.GameDBSession.SessionUpdate(jeweler_data);
|
||||
World.Game.GameDbSession.SessionUpdate(jeweler_data);
|
||||
UpdateAchievementCounter(404, 1, 1);
|
||||
}
|
||||
|
||||
@ -4478,7 +4485,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
if (blacksmith_data == null)
|
||||
{
|
||||
var craft_data =
|
||||
World.Game.GameDBSession.SessionQueryWhere<DBCraft>(dbc =>
|
||||
World.Game.GameDbSession.SessionQueryWhere<DBCraft>(dbc =>
|
||||
dbc.DBGameAccount.Id == Toon.GameAccount.PersistentID);
|
||||
|
||||
blacksmith_data = craft_data.Single(dbc =>
|
||||
@ -4555,7 +4562,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
public void LoadMailData()
|
||||
{
|
||||
var mail_data =
|
||||
World.Game.GameDBSession.SessionQueryWhere<DBMail>(dbm =>
|
||||
World.Game.GameDbSession.SessionQueryWhere<DBMail>(dbm =>
|
||||
dbm.DBToon.Id == Toon.PersistentID && dbm.Claimed == false);
|
||||
var mails = D3.Items.Mails.CreateBuilder();
|
||||
foreach (var mail in mail_data)
|
||||
@ -4855,14 +4862,14 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
public void SetProgress(int act, int difficulty)
|
||||
{
|
||||
if (act > 400) return;
|
||||
var dbGAcc = World.Game.GameDBSession.SessionGet<DBGameAccount>(Toon.GameAccount.PersistentID);
|
||||
var dbGAcc = World.Game.GameDbSession.SessionGet<DBGameAccount>(Toon.GameAccount.PersistentID);
|
||||
var progress = dbGAcc.BossProgress;
|
||||
if (progress[act / 100] == 0xff || progress[act / 100] < (byte)difficulty)
|
||||
{
|
||||
progress[act / 100] = (byte)difficulty;
|
||||
|
||||
dbGAcc.BossProgress = progress;
|
||||
World.Game.GameDBSession.SessionUpdate(dbGAcc);
|
||||
World.Game.GameDbSession.SessionUpdate(dbGAcc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6018,7 +6025,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
||||
Logger.Trace("Learning lore #{0}", loreSNOId);
|
||||
var dbToon = Toon.DBToon;
|
||||
dbToon.Lore = SerializeBytes(LearnedLore.m_snoLoreLearned.Take(LearnedLore.Count).ToList());
|
||||
World.Game.GameDBSession.SessionUpdate(dbToon);
|
||||
World.Game.GameDbSession.SessionUpdate(dbToon);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ 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)(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));
|
||||
World.BuffManager.AddBuff(User, monster, new SummonedBuff());
|
||||
|
||||
@ -16,26 +16,24 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations.MonsterSkills
|
||||
public abstract class SingleProjectileSkill : ActionTimedSkill
|
||||
{
|
||||
protected Projectile projectile;
|
||||
protected float speed;
|
||||
private float _speed;
|
||||
|
||||
protected void SetProjectile(PowerContext context, ActorSno actorSNO, Vector3D position, float speed = 1f, Action<Actor> OnCollision = null)
|
||||
{
|
||||
if (User is Monster)
|
||||
// FIXME: Non-exist world id
|
||||
if (User.World.WorldSNO.Id == 1 ||
|
||||
User.World.WorldSNO.Id == 1)
|
||||
position.Z = (User as Monster).CorrectedPosition.Z;
|
||||
projectile = new Projectile(context, actorSNO, position);
|
||||
|
||||
|
||||
projectile.OnCollision = OnCollision;
|
||||
this.speed = speed;
|
||||
if (User is Monster monster)
|
||||
// TODO: FIXME: Non-exist world id
|
||||
if (monster.World.WorldSNO.Id is 1)
|
||||
position.Z = monster.Position.Z;
|
||||
projectile = new(context, actorSNO, position)
|
||||
{
|
||||
OnCollision = OnCollision
|
||||
};
|
||||
_speed = speed;
|
||||
}
|
||||
|
||||
protected IEnumerable<TickTimer> Launch()
|
||||
{
|
||||
|
||||
projectile.Launch(new Vector3D(Target.Position.X, Target.Position.Y, Target.Position.Z + 5f), speed);
|
||||
projectile.Launch(new Vector3D(Target.Position.X, Target.Position.Y, Target.Position.Z + 5f), _speed);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
||||
public override IEnumerable<TickTimer> Main()
|
||||
{
|
||||
InFrontPostion();
|
||||
SummonMonster((User as Monster).SNOSummons[0]);
|
||||
SummonMonster((User as Monster).SnoSummons[0]);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
@ -76,7 +76,7 @@ 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, (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;
|
||||
@ -111,7 +111,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
||||
User.PlayAnimation(11, (AnimationSno)User.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Explode]);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
var monster = ActorFactory.Create(User.World, (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));
|
||||
World.BuffManager.AddBuff(User, monster, new SummonedBuff());
|
||||
@ -185,7 +185,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
||||
{
|
||||
RandomPostion();
|
||||
if (User is Monster)
|
||||
SummonMonster((User as Monster).SNOSummons[0]);
|
||||
SummonMonster((User as Monster).SnoSummons[0]);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
@ -206,7 +206,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
|
||||
public override IEnumerable<TickTimer> Main()
|
||||
{
|
||||
UserPostion();
|
||||
SummonMonster((User as Monster).SNOSummons[0]);
|
||||
SummonMonster((User as Monster).SnoSummons[0]);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
||||
{
|
||||
int grantedExp = 0;
|
||||
if (plr.Attributes[GameAttribute.Level] <= Target.Attributes[GameAttribute.Level])
|
||||
grantedExp = (int)(Player.LevelBorders[plr.Attributes[GameAttribute.Level]] / (40 * Target.Attributes[GameAttribute.Level] * 0.85f) * (Target is Monster ? Math.Min((Target as Monster).HPMultiplier, 3f) : 1f));
|
||||
grantedExp = (int)(Player.LevelBorders[plr.Attributes[GameAttribute.Level]] / (40 * Target.Attributes[GameAttribute.Level] * 0.85f) * (Target is Monster ? Math.Min((Target as Monster).HpMultiplier, 3f) : 1f));
|
||||
else
|
||||
grantedExp = (int)(Player.LevelBorders[plr.Attributes[GameAttribute.Level]] / (40 * Target.Attributes[GameAttribute.Level] * 0.85f) * (1 - Math.Abs(plr.Attributes[GameAttribute.Level] - Target.Attributes[GameAttribute.Level]) / 20));
|
||||
|
||||
@ -401,7 +401,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
||||
|
||||
if (LootAndExp)
|
||||
{
|
||||
grantedExp = (int)(grantedExp * plr.World.Game.XPModifier);
|
||||
grantedExp = (int)(grantedExp * plr.World.Game.XpModifier);
|
||||
|
||||
float tempEXP = grantedExp * Config.Instance.RateExp;
|
||||
|
||||
@ -1152,7 +1152,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
||||
player.AddTimedAction(3f, new Action<int>((q) => player.Revive(player.CheckPointPosition)));
|
||||
var toon = player.Toon.DBToon;
|
||||
toon.Deaths++;
|
||||
player.World.Game.GameDBSession.SessionUpdate(toon);
|
||||
player.World.Game.GameDbSession.SessionUpdate(toon);
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
@ -511,7 +511,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = () =>
|
||||
{ //go with Cain
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
StartConversation(Game.GetWorld(WorldSno.trdun_cain_intro), 72496);
|
||||
ListenTeleport(19938, new Advance());
|
||||
}
|
||||
@ -1111,7 +1111,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = () =>
|
||||
{ //go to fallen star room
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
ListenTeleport(117411, new Advance());
|
||||
Game.AddOnLoadWorldAction(WorldSno.a1trdun_king_level08, () =>
|
||||
{
|
||||
@ -1890,7 +1890,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
(LeahAfterEvent as ActorSystem.InteractiveNPC).Attributes[GameAttribute.Conversation_Icon, 0] = 2;
|
||||
(LeahAfterEvent as ActorSystem.InteractiveNPC).Attributes.BroadcastChangedIfRevealed();
|
||||
ListenConversation(93337, new Advance());
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
}
|
||||
});
|
||||
|
||||
@ -2259,7 +2259,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = () =>
|
||||
{ //find Tyrael
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
Game.AddOnLoadWorldAction(WorldSno.trdun_butcherslair_02, () =>
|
||||
{
|
||||
SetActorOperable(Game.GetWorld(WorldSno.trdun_butcherslair_02), ActorSno._a1dun_leor_gate_a, true);
|
||||
|
||||
@ -439,7 +439,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
NextStep = 10,
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = new Action(() => { //return to camp
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
Game.AddOnLoadWorldAction(WorldSno.caout_cellar_alcarnus_main, () =>
|
||||
{
|
||||
Open(Game.GetWorld(WorldSno.caout_cellar_alcarnus_main), ActorSno._caout_stingingwinds_arena_bridge);
|
||||
@ -645,7 +645,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
world.ShowOnlyNumNPC(ActorSno._leahsewer, -1); //Leave all LeahSewer
|
||||
}
|
||||
});
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
})
|
||||
});
|
||||
|
||||
@ -723,7 +723,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = new Action(() => { //talk with Adria in camp
|
||||
var world = Game.GetWorld(WorldSno.a2dun_swr_adria_level01);
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
if (world.GetActorBySNO(ActorSno._adria) != null)
|
||||
RemoveConversations(world.GetActorBySNO(ActorSno._adria));
|
||||
|
||||
@ -1501,7 +1501,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
NextStep = 27,
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = new Action(() => { //get Belial's soul
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
Game.AddOnLoadWorldAction(WorldSno.a2_belial_room_01, () =>
|
||||
{
|
||||
(Game.GetWorld(WorldSno.a2_belial_room_01).GetActorBySNO(ActorSno._a2dun_cald_belial_room_a_breakable_main) as BelialRoom).Rebuild();
|
||||
|
||||
@ -533,7 +533,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
NextStep = 3,
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = new Action(() => { //talk with Adria
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
ListenProximity(ActorSno._adria, new LaunchConversation(196366));
|
||||
ListenConversation(196366, new Advance());
|
||||
if (Game.Empty) UnlockTeleport(6);
|
||||
@ -669,7 +669,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
NextStep = 1,
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = new Action(() => { //Destroy Heart of Sin
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
ListenKill(ActorSno._a3dun_crater_st_giantdemonheart_mob, 1, new Advance());
|
||||
Game.AddOnLoadWorldAction(WorldSno.a3dun_crater_st_level04b, () =>
|
||||
{
|
||||
@ -708,7 +708,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
NextStep = 5,
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = new Action(() => { //get Azmodan's soul
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
ListenProximity(ActorSno._azmodan_bss_soulremnants, new Advance());
|
||||
Game.AddOnLoadWorldAction(WorldSno.a3dun_azmodan_arena, () =>
|
||||
{
|
||||
@ -889,7 +889,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
NextStep = -1,
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = new Action(() => { //complete
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
NextStep = -1,
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = new Action(() => { //complete
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
})
|
||||
});
|
||||
|
||||
@ -242,7 +242,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
NextStep = 33,
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = new Action(() => { //destroy Auriel's jail
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
|
||||
var Library = Game.GetWorld(WorldSno.a4dun_libraryoffate);
|
||||
StartConversation(Library, 217223); // Голос дъябло после битвы
|
||||
@ -444,7 +444,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
NextStep = -1,
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = new Action(() => { //complete
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
PlayCutscene(2);
|
||||
})
|
||||
});
|
||||
|
||||
@ -735,7 +735,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
var malthael = Game.GetWorld(WorldSno.x1_urzael_arena).SpawnMonster(ActorSno._x1_malthael, new Vector3D { X = 97.65f, Y = 350.23f, Z = 0.1f });
|
||||
malthael.NotifyConversation(1);
|
||||
});
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
ListenInteract(ActorSno._x1_malthael, 1, new LaunchConversation(274423));
|
||||
ListenConversation(274423, new Advance());
|
||||
})
|
||||
@ -1016,7 +1016,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = new Action(() => {
|
||||
//talk to Lorath
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
var world = Game.GetWorld(WorldSno.x1_adria_boss_arena_02);
|
||||
|
||||
foreach (var Myst in world.GetActorsBySNO(ActorSno._x1_npc_lorathnahr)) //284530
|
||||
@ -1033,7 +1033,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
{
|
||||
world.GetActorBySNO(ActorSno._x1_npc_lorathnahr).NotifyConversation(1);
|
||||
});
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
|
||||
//ListenInteract(284530, 1, new LaunchConversation(260191));
|
||||
ListenConversation(260191, new Advance());
|
||||
@ -1441,7 +1441,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
//enter Breach
|
||||
var RamWorld = Game.GetWorld(WorldSno.x1_pand_batteringram);
|
||||
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
ListenTeleport(271234, new Advance());
|
||||
Game.AddOnLoadWorldAction(WorldSno.x1_pand_batteringram, () =>
|
||||
{
|
||||
@ -1625,7 +1625,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
|
||||
Objectives = new List<Objective> { Objective.Default() },
|
||||
OnAdvance = new Action(() => {
|
||||
//Success
|
||||
Game.CurrentEncounter.activated = false;
|
||||
Game.CurrentEncounter.Activated = false;
|
||||
ListenProximity(ActorSno._tyrael, new LaunchConversation(351334));
|
||||
ListenConversation(351334, new Advance());
|
||||
if (Game.IsHardcore)
|
||||
|
||||
@ -93,7 +93,7 @@ namespace DiIiS_NA.GameServer.GSSystem.SkillsSystem
|
||||
}
|
||||
if (!Player.World.Game.PvP)
|
||||
{
|
||||
Player.World.Game.GameDBSession.SessionUpdate(dbActiveSkills);
|
||||
Player.World.Game.GameDbSession.SessionUpdate(dbActiveSkills);
|
||||
}
|
||||
|
||||
}
|
||||
@ -115,7 +115,7 @@ namespace DiIiS_NA.GameServer.GSSystem.SkillsSystem
|
||||
dbActiveSkills.Passive3 = PassiveSkills[3];
|
||||
if (!Player.World.Game.PvP)
|
||||
{
|
||||
Player.World.Game.GameDBSession.SessionUpdate(dbActiveSkills);
|
||||
Player.World.Game.GameDbSession.SessionUpdate(dbActiveSkills);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
user.block.title