Update.
This commit is contained in:
parent
03ba08341c
commit
425378eff2
2
.gitignore
vendored
2
.gitignore
vendored
@ -373,3 +373,5 @@ db/pgadmin/*
|
|||||||
/src/DiIiS-NA/config.ini
|
/src/DiIiS-NA/config.ini
|
||||||
/src/DiIiS-NA/database.Account.config
|
/src/DiIiS-NA/database.Account.config
|
||||||
/src/DiIiS-NA/database.Worlds.config
|
/src/DiIiS-NA/database.Worlds.config
|
||||||
|
/src/DiIiS-NA/database.Account.Debug.config
|
||||||
|
/src/DiIiS-NA/database.Worlds.Debug.config
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
|
|||||||
{
|
{
|
||||||
ByteStringPresenceField<D3.OnlineService.EntityId> val = null;
|
ByteStringPresenceField<D3.OnlineService.EntityId> val = null;
|
||||||
if (GameAccount.CurrentToon != null)
|
if (GameAccount.CurrentToon != null)
|
||||||
val = new ByteStringPresenceField<D3.OnlineService.EntityId>(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.Account, 1, 0, GameAccount.CurrentToon.D3EntityID);
|
val = new ByteStringPresenceField<D3.OnlineService.EntityId>(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.Account, 1, 0, GameAccount.CurrentToon.D3EntityId);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var Fake = D3.OnlineService.EntityId.CreateBuilder().SetIdHigh(0).SetIdLow(0);
|
var Fake = D3.OnlineService.EntityId.CreateBuilder().SetIdHigh(0).SetIdLow(0);
|
||||||
|
|||||||
@ -90,8 +90,8 @@ public class GameAccount : PersistentRPCObject
|
|||||||
|
|
||||||
public EntityId LastPlayedHeroId =>
|
public EntityId LastPlayedHeroId =>
|
||||||
CurrentToon == null
|
CurrentToon == null
|
||||||
? Toons.Count > 0 ? Toons.First().D3EntityID : AccountHasNoToons
|
? Toons.Count > 0 ? Toons.First().D3EntityId : AccountHasNoToons
|
||||||
: CurrentToon.D3EntityID;
|
: CurrentToon.D3EntityId;
|
||||||
|
|
||||||
public ByteStringPresenceField<bgs.protocol.channel.v1.ChannelId> PartyIdField =>
|
public ByteStringPresenceField<bgs.protocol.channel.v1.ChannelId> PartyIdField =>
|
||||||
new(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.Party, 1, 0)
|
new(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.Party, 1, 0)
|
||||||
@ -271,7 +271,7 @@ public class GameAccount : PersistentRPCObject
|
|||||||
_currentToonId = value.PersistentID;
|
_currentToonId = value.PersistentID;
|
||||||
lock (DBGameAccount)
|
lock (DBGameAccount)
|
||||||
{
|
{
|
||||||
SetField(x=>x.LastPlayedHero = value.DBToon);
|
SetField(x=>x.LastPlayedHero = value.DbToon);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangedFields.SetPresenceFieldValue(LastPlayedHeroIdField);
|
ChangedFields.SetPresenceFieldValue(LastPlayedHeroIdField);
|
||||||
@ -924,9 +924,9 @@ public class GameAccount : PersistentRPCObject
|
|||||||
foreach (var hero in Toons)
|
foreach (var hero in Toons)
|
||||||
profile.AddHeroes(HeroMiniProfile.CreateBuilder()
|
profile.AddHeroes(HeroMiniProfile.CreateBuilder()
|
||||||
.SetHeroName(hero.Name)
|
.SetHeroName(hero.Name)
|
||||||
.SetHeroGbidClass((int)hero.ClassID)
|
.SetHeroGbidClass((int)hero.ClassId)
|
||||||
.SetHeroFlags((uint)hero.Flags)
|
.SetHeroFlags((uint)hero.Flags)
|
||||||
.SetHeroId((uint)hero.D3EntityID.IdLow)
|
.SetHeroId((uint)hero.D3EntityId.IdLow)
|
||||||
.SetHeroLevel(hero.Level)
|
.SetHeroLevel(hero.Level)
|
||||||
.SetHeroVisualEquipment(hero.HeroVisualEquipmentField.Value)
|
.SetHeroVisualEquipment(hero.HeroVisualEquipmentField.Value)
|
||||||
);
|
);
|
||||||
@ -1423,7 +1423,7 @@ public class GameAccount : PersistentRPCObject
|
|||||||
}
|
}
|
||||||
else if (queryKey.Group == 3 && queryKey.Field == 1) // Hero's class (GbidClass)
|
else if (queryKey.Group == 3 && queryKey.Field == 1) // Hero's class (GbidClass)
|
||||||
{
|
{
|
||||||
field.SetValue(bgs.protocol.Variant.CreateBuilder().SetIntValue(CurrentToon.ClassID).Build());
|
field.SetValue(bgs.protocol.Variant.CreateBuilder().SetIntValue(CurrentToon.ClassId).Build());
|
||||||
}
|
}
|
||||||
else if (queryKey.Group == 3 && queryKey.Field == 2) // Hero's current level
|
else if (queryKey.Group == 3 && queryKey.Field == 2) // Hero's current level
|
||||||
{
|
{
|
||||||
|
|||||||
@ -46,9 +46,9 @@ namespace DiIiS_NA.LoginServer.GamesSystem
|
|||||||
{
|
{
|
||||||
this.GameCreateParams = D3.OnlineService.GameCreateParams.ParseFrom(attribute.Value.BlobValue);
|
this.GameCreateParams = D3.OnlineService.GameCreateParams.ParseFrom(attribute.Value.BlobValue);
|
||||||
if (this.GameCreateParams.CreationFlags == 256 || this.GameCreateParams.CreationFlags == 262400) this.Public = true;
|
if (this.GameCreateParams.CreationFlags == 256 || this.GameCreateParams.CreationFlags == 262400) this.Public = true;
|
||||||
lock (owner.Account.GameAccount.CurrentToon.DBToon)
|
lock (owner.Account.GameAccount.CurrentToon.DbToon)
|
||||||
{
|
{
|
||||||
var toonByClient = owner.Account.GameAccount.CurrentToon.DBToon;
|
var toonByClient = owner.Account.GameAccount.CurrentToon.DbToon;
|
||||||
toonByClient.CurrentAct = this.GameCreateParams.CampaignOrAdventureMode.Act;
|
toonByClient.CurrentAct = this.GameCreateParams.CampaignOrAdventureMode.Act;
|
||||||
toonByClient.CurrentQuestId = (this.GameCreateParams.CampaignOrAdventureMode.SnoQuest == 0 ? 87700 : this.GameCreateParams.CampaignOrAdventureMode.SnoQuest);
|
toonByClient.CurrentQuestId = (this.GameCreateParams.CampaignOrAdventureMode.SnoQuest == 0 ? 87700 : this.GameCreateParams.CampaignOrAdventureMode.SnoQuest);
|
||||||
toonByClient.CurrentQuestStepId = (this.GameCreateParams.CampaignOrAdventureMode.QuestStepId == 0 ? -1 : this.GameCreateParams.CampaignOrAdventureMode.QuestStepId);
|
toonByClient.CurrentQuestStepId = (this.GameCreateParams.CampaignOrAdventureMode.QuestStepId == 0 ? -1 : this.GameCreateParams.CampaignOrAdventureMode.QuestStepId);
|
||||||
@ -75,7 +75,7 @@ namespace DiIiS_NA.LoginServer.GamesSystem
|
|||||||
public void StartGame(List<BattleClient> clients, ulong objectId)
|
public void StartGame(List<BattleClient> clients, ulong objectId)
|
||||||
{
|
{
|
||||||
Logger.MethodTrace($"objectId: {objectId}");
|
Logger.MethodTrace($"objectId: {objectId}");
|
||||||
var owner = this.Owner.Account.GameAccount.CurrentToon.DBToon;
|
var owner = this.Owner.Account.GameAccount.CurrentToon.DbToon;
|
||||||
|
|
||||||
if (Program.BattleBackend.GameServers.Count == 0) return;
|
if (Program.BattleBackend.GameServers.Count == 0) return;
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,7 @@ namespace DiIiS_NA.LoginServer
|
|||||||
public string Motd
|
public string Motd
|
||||||
{
|
{
|
||||||
get => GetString(nameof(Motd),
|
get => GetString(nameof(Motd),
|
||||||
$"Welcome to Blizzless Server Build {Program.Build} - Stage: {Program.Stage} [{Program.TypeBuild}]!");
|
$"Welcome to Blizzless Server Build {Program.BUILD} - Stage: {Program.STAGE} [{Program.TypeBuild}]!");
|
||||||
set => Set(nameof(Motd), value);
|
set => Set(nameof(Motd), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -97,9 +97,9 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
|
|||||||
var paramsBuilder = D3.OnlineService.GameCreateParams.CreateBuilder(gameCreateParams);
|
var paramsBuilder = D3.OnlineService.GameCreateParams.CreateBuilder(gameCreateParams);
|
||||||
var Mode = D3.OnlineService.CampaignOrAdventureModeCreateParams.CreateBuilder(gameCreateParams.CampaignOrAdventureMode);
|
var Mode = D3.OnlineService.CampaignOrAdventureModeCreateParams.CreateBuilder(gameCreateParams.CampaignOrAdventureMode);
|
||||||
|
|
||||||
lock (((HandlerController) controller).Client.Account.GameAccount.CurrentToon.DBToon)
|
lock (((HandlerController) controller).Client.Account.GameAccount.CurrentToon.DbToon)
|
||||||
{
|
{
|
||||||
DBToon toonByClient = (((HandlerController) controller).Client).Account.GameAccount.CurrentToon.DBToon;
|
DBToon toonByClient = (((HandlerController) controller).Client).Account.GameAccount.CurrentToon.DbToon;
|
||||||
if(toonByClient.CurrentAct == 400)
|
if(toonByClient.CurrentAct == 400)
|
||||||
toonByClient.CurrentAct = gameCreateParams.CampaignOrAdventureMode.Act;
|
toonByClient.CurrentAct = gameCreateParams.CampaignOrAdventureMode.Act;
|
||||||
if (!clear_quests)
|
if (!clear_quests)
|
||||||
@ -152,7 +152,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
|
|||||||
{
|
{
|
||||||
var gameCreateParamsBuilder = D3.OnlineService.GameCreateParams.CreateBuilder();
|
var gameCreateParamsBuilder = D3.OnlineService.GameCreateParams.CreateBuilder();
|
||||||
var toon = (((HandlerController) controller).Client).Account.GameAccount.CurrentToon;
|
var toon = (((HandlerController) controller).Client).Account.GameAccount.CurrentToon;
|
||||||
var dbToon = (((HandlerController) controller).Client).Account.GameAccount.CurrentToon.DBToon;
|
var dbToon = (((HandlerController) controller).Client).Account.GameAccount.CurrentToon.DbToon;
|
||||||
gameCreateParamsBuilder.SetGameType(1);
|
gameCreateParamsBuilder.SetGameType(1);
|
||||||
gameCreateParamsBuilder.SetCreationFlags(0);
|
gameCreateParamsBuilder.SetCreationFlags(0);
|
||||||
gameCreateParamsBuilder.SetCampaignOrAdventureMode(D3.OnlineService.CampaignOrAdventureModeCreateParams.CreateBuilder()
|
gameCreateParamsBuilder.SetCampaignOrAdventureMode(D3.OnlineService.CampaignOrAdventureModeCreateParams.CreateBuilder()
|
||||||
@ -160,7 +160,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
|
|||||||
.SetAct(dbToon.CurrentAct)
|
.SetAct(dbToon.CurrentAct)
|
||||||
.SetSnoQuest(dbToon.CurrentQuestId)
|
.SetSnoQuest(dbToon.CurrentQuestId)
|
||||||
.SetQuestStepId(dbToon.CurrentQuestStepId)
|
.SetQuestStepId(dbToon.CurrentQuestStepId)
|
||||||
.SetResumeFromSaveHeroId(toon.D3EntityID)
|
.SetResumeFromSaveHeroId(toon.D3EntityId)
|
||||||
.SetDeprecatedOpenToFriends(true)
|
.SetDeprecatedOpenToFriends(true)
|
||||||
.SetDeprecatedOpenToFriendsMessage("TestGame")
|
.SetDeprecatedOpenToFriendsMessage("TestGame")
|
||||||
);
|
);
|
||||||
|
|||||||
@ -64,7 +64,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
|
|||||||
foreach (Toon t in Client.Account.GameAccount.Toons)
|
foreach (Toon t in Client.Account.GameAccount.Toons)
|
||||||
{
|
{
|
||||||
d.AddDigestList(t.Digest);
|
d.AddDigestList(t.Digest);
|
||||||
GAS.AddHeroListOrder(t.D3EntityID);
|
GAS.AddHeroListOrder(t.D3EntityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Init.SetGameAccountSettings(GAS);
|
Init.SetGameAccountSettings(GAS);
|
||||||
@ -661,7 +661,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
|
|||||||
if (hero != null)
|
if (hero != null)
|
||||||
{
|
{
|
||||||
var Snapshot = D3.Leaderboard.HeroSnapshot.CreateBuilder()
|
var Snapshot = D3.Leaderboard.HeroSnapshot.CreateBuilder()
|
||||||
.SetHeroId(hero.D3EntityID)
|
.SetHeroId(hero.D3EntityId)
|
||||||
.AddCosmeticItems(D3.Leaderboard.HeroCosmeticItem.CreateBuilder().SetCosmeticVisualInventorySlot(1)
|
.AddCosmeticItems(D3.Leaderboard.HeroCosmeticItem.CreateBuilder().SetCosmeticVisualInventorySlot(1)
|
||||||
.SetGbid(hero.Cosmetic1))
|
.SetGbid(hero.Cosmetic1))
|
||||||
.AddCosmeticItems(D3.Leaderboard.HeroCosmeticItem.CreateBuilder().SetCosmeticVisualInventorySlot(2)
|
.AddCosmeticItems(D3.Leaderboard.HeroCosmeticItem.CreateBuilder().SetCosmeticVisualInventorySlot(2)
|
||||||
@ -671,21 +671,21 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
|
|||||||
.AddCosmeticItems(D3.Leaderboard.HeroCosmeticItem.CreateBuilder().SetCosmeticVisualInventorySlot(4)
|
.AddCosmeticItems(D3.Leaderboard.HeroCosmeticItem.CreateBuilder().SetCosmeticVisualInventorySlot(4)
|
||||||
.SetGbid(hero.Cosmetic4))
|
.SetGbid(hero.Cosmetic4))
|
||||||
.SetActiveSkills(SkillsWithRunes.CreateBuilder()
|
.SetActiveSkills(SkillsWithRunes.CreateBuilder()
|
||||||
.AddRunes(SkillWithRune.CreateBuilder().SetSkill(hero.DBActiveSkills.Skill0)
|
.AddRunes(SkillWithRune.CreateBuilder().SetSkill(hero.DbActiveSkills.Skill0)
|
||||||
.SetRuneType(hero.DBActiveSkills.Rune0))
|
.SetRuneType(hero.DbActiveSkills.Rune0))
|
||||||
.AddRunes(SkillWithRune.CreateBuilder().SetSkill(hero.DBActiveSkills.Skill1)
|
.AddRunes(SkillWithRune.CreateBuilder().SetSkill(hero.DbActiveSkills.Skill1)
|
||||||
.SetRuneType(hero.DBActiveSkills.Rune1))
|
.SetRuneType(hero.DbActiveSkills.Rune1))
|
||||||
.AddRunes(SkillWithRune.CreateBuilder().SetSkill(hero.DBActiveSkills.Skill2)
|
.AddRunes(SkillWithRune.CreateBuilder().SetSkill(hero.DbActiveSkills.Skill2)
|
||||||
.SetRuneType(hero.DBActiveSkills.Rune2))
|
.SetRuneType(hero.DbActiveSkills.Rune2))
|
||||||
.AddRunes(SkillWithRune.CreateBuilder().SetSkill(hero.DBActiveSkills.Skill3)
|
.AddRunes(SkillWithRune.CreateBuilder().SetSkill(hero.DbActiveSkills.Skill3)
|
||||||
.SetRuneType(hero.DBActiveSkills.Rune3))
|
.SetRuneType(hero.DbActiveSkills.Rune3))
|
||||||
.AddRunes(SkillWithRune.CreateBuilder().SetSkill(hero.DBActiveSkills.Skill4)
|
.AddRunes(SkillWithRune.CreateBuilder().SetSkill(hero.DbActiveSkills.Skill4)
|
||||||
.SetRuneType(hero.DBActiveSkills.Rune4))
|
.SetRuneType(hero.DbActiveSkills.Rune4))
|
||||||
.AddRunes(SkillWithRune.CreateBuilder().SetSkill(hero.DBActiveSkills.Skill5)
|
.AddRunes(SkillWithRune.CreateBuilder().SetSkill(hero.DbActiveSkills.Skill5)
|
||||||
.SetRuneType(hero.DBActiveSkills.Rune5)))
|
.SetRuneType(hero.DbActiveSkills.Rune5)))
|
||||||
.SetActiveTraits(PassiveSkills.CreateBuilder().AddSnoTraits(hero.DBActiveSkills.Passive0)
|
.SetActiveTraits(PassiveSkills.CreateBuilder().AddSnoTraits(hero.DbActiveSkills.Passive0)
|
||||||
.AddSnoTraits(hero.DBActiveSkills.Passive1).AddSnoTraits(hero.DBActiveSkills.Passive2)
|
.AddSnoTraits(hero.DbActiveSkills.Passive1).AddSnoTraits(hero.DbActiveSkills.Passive2)
|
||||||
.AddSnoTraits(hero.DBActiveSkills.Passive3));
|
.AddSnoTraits(hero.DbActiveSkills.Passive3));
|
||||||
|
|
||||||
foreach (var item in hero.Profile.Equipment.ItemsList)
|
foreach (var item in hero.Profile.Equipment.ItemsList)
|
||||||
{
|
{
|
||||||
@ -842,7 +842,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
|
|||||||
.SetHeroAltLevel((uint)gameAccount2.DBGameAccount.ParagonLevel)
|
.SetHeroAltLevel((uint)gameAccount2.DBGameAccount.ParagonLevel)
|
||||||
.SetHeroFlags((uint)Hero.Flags)
|
.SetHeroFlags((uint)Hero.Flags)
|
||||||
.SetHeroLevel((uint)Hero.Level)
|
.SetHeroLevel((uint)Hero.Level)
|
||||||
.SetHeroGbidClass((uint)Hero.ClassID)
|
.SetHeroGbidClass((uint)Hero.ClassId)
|
||||||
.SetHeroName(Hero.Name)
|
.SetHeroName(Hero.Name)
|
||||||
.SetHeroSnapshotAvailable(true)
|
.SetHeroSnapshotAvailable(true)
|
||||||
.SetHeroVisualEquipment(gameAccount2.Toons[0].Digest.VisualEquipment);
|
.SetHeroVisualEquipment(gameAccount2.Toons[0].Digest.VisualEquipment);
|
||||||
@ -1001,7 +1001,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
|
|||||||
.SetHeroAltLevel((uint)gameAccount.DBGameAccount.ParagonLevel)
|
.SetHeroAltLevel((uint)gameAccount.DBGameAccount.ParagonLevel)
|
||||||
.SetHeroFlags((uint)hero.Flags)
|
.SetHeroFlags((uint)hero.Flags)
|
||||||
.SetHeroLevel((uint)hero.Level)
|
.SetHeroLevel((uint)hero.Level)
|
||||||
.SetHeroGbidClass((uint)hero.ClassID)
|
.SetHeroGbidClass((uint)hero.ClassId)
|
||||||
.SetHeroName(hero.Name)
|
.SetHeroName(hero.Name)
|
||||||
.SetHeroSnapshotAvailable(true)
|
.SetHeroSnapshotAvailable(true)
|
||||||
.SetHeroVisualEquipment(gameAccount.Toons[0].Digest.VisualEquipment);
|
.SetHeroVisualEquipment(gameAccount.Toons[0].Digest.VisualEquipment);
|
||||||
@ -1097,7 +1097,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
|
|||||||
var newToon = ToonManager.CreateNewToon(createParams.Name, createParams.GbidClass,
|
var newToon = ToonManager.CreateNewToon(createParams.Name, createParams.GbidClass,
|
||||||
createParams.IsFemale ? ToonFlags.Female : ToonFlags.Male, 1, createParams.IsHardcore,
|
createParams.IsFemale ? ToonFlags.Female : ToonFlags.Male, 1, createParams.IsHardcore,
|
||||||
client.Account.GameAccount, createParams.IsSeason ? 1 : 0);
|
client.Account.GameAccount, createParams.IsSeason ? 1 : 0);
|
||||||
return CreateHeroResponse.CreateBuilder().SetHeroId(newToon.D3EntityID.IdLow).Build().ToByteString();
|
return CreateHeroResponse.CreateBuilder().SetHeroId(newToon.D3EntityId.IdLow).Build().ToByteString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ByteString OnHeroDeleteParams(BattleClient client, ByteString data)
|
private ByteString OnHeroDeleteParams(BattleClient client, ByteString data)
|
||||||
@ -3118,7 +3118,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
|
|||||||
var Response = RebirthHeroResponse.CreateBuilder();
|
var Response = RebirthHeroResponse.CreateBuilder();
|
||||||
foreach (Toon t in client.Account.GameAccount.Toons)
|
foreach (Toon t in client.Account.GameAccount.Toons)
|
||||||
{
|
{
|
||||||
if (t.D3EntityID.IdLow == Request.HeroId)
|
if (t.D3EntityId.IdLow == Request.HeroId)
|
||||||
{
|
{
|
||||||
//t.SetSeason(1);
|
//t.SetSeason(1);
|
||||||
|
|
||||||
|
|||||||
@ -19,12 +19,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public int Cosmetic1
|
public int Cosmetic1
|
||||||
{
|
{
|
||||||
get => DBToon.Cosmetic1;
|
get => DbToon.Cosmetic1;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.Cosmetic1 = value;
|
dbToon.Cosmetic1 = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -33,12 +33,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public int Cosmetic2
|
public int Cosmetic2
|
||||||
{
|
{
|
||||||
get => DBToon.Cosmetic2;
|
get => DbToon.Cosmetic2;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.Cosmetic2 = value;
|
dbToon.Cosmetic2 = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -47,12 +47,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public int Cosmetic3
|
public int Cosmetic3
|
||||||
{
|
{
|
||||||
get => DBToon.Cosmetic3;
|
get => DbToon.Cosmetic3;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.Cosmetic3 = value;
|
dbToon.Cosmetic3 = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -61,12 +61,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public int Cosmetic4
|
public int Cosmetic4
|
||||||
{
|
{
|
||||||
get => DBToon.Cosmetic4;
|
get => DbToon.Cosmetic4;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.Cosmetic4 = value;
|
dbToon.Cosmetic4 = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public DBToon DBToon
|
public DBToon DbToon
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
/*
|
/*
|
||||||
@ -93,11 +93,11 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DBToon CachedDBToon { get; set; }
|
private DBToon CachedDbToon { get; set; }
|
||||||
|
|
||||||
public bool IsHardcore { get; set; }
|
public bool IsHardcore { get; set; }
|
||||||
|
|
||||||
public DBActiveSkills DBActiveSkills
|
public DBActiveSkills DbActiveSkills
|
||||||
{
|
{
|
||||||
get { return DBSessions.SessionQuerySingle<DBActiveSkills>(s => s.DBToon.Id == PersistentID); }
|
get { return DBSessions.SessionQuerySingle<DBActiveSkills>(s => s.DBToon.Id == PersistentID); }
|
||||||
set { }
|
set { }
|
||||||
@ -108,7 +108,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
var val = new IntPresenceField(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.Hero, 1, 0,
|
var val = new IntPresenceField(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.Hero, 1, 0,
|
||||||
ClassID);
|
ClassId);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,13 +152,13 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
FieldKeyHelper.OriginatingClass.Hero, 5, 0, _heroName);
|
FieldKeyHelper.OriginatingClass.Hero, 5, 0, _heroName);
|
||||||
|
|
||||||
private D3.Hero.VisualEquipment _visualEquipment = null;
|
private D3.Hero.VisualEquipment _visualEquipment = null;
|
||||||
public bool _visualEquipmentChanged = true;
|
public bool VisualEquipmentChanged = true;
|
||||||
|
|
||||||
public ByteStringPresenceField<D3.Hero.VisualEquipment> HeroVisualEquipmentField
|
public ByteStringPresenceField<D3.Hero.VisualEquipment> HeroVisualEquipmentField
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_visualEquipmentChanged)
|
if (VisualEquipmentChanged)
|
||||||
{
|
{
|
||||||
var visualItems = new[]
|
var visualItems = new[]
|
||||||
{
|
{
|
||||||
@ -171,7 +171,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
D3.Hero.VisualItem.CreateBuilder().SetEffectLevel(0).Build(), // Shoulders
|
D3.Hero.VisualItem.CreateBuilder().SetEffectLevel(0).Build(), // Shoulders
|
||||||
D3.Hero.VisualItem.CreateBuilder().SetEffectLevel(0).Build(), // Legs
|
D3.Hero.VisualItem.CreateBuilder().SetEffectLevel(0).Build(), // Legs
|
||||||
};
|
};
|
||||||
var CosmeticItems = new[]
|
var cosmeticItems = new[]
|
||||||
{
|
{
|
||||||
D3.Hero.VisualCosmeticItem.CreateBuilder().SetGbid(Cosmetic1).Build(), // Wings
|
D3.Hero.VisualCosmeticItem.CreateBuilder().SetGbid(Cosmetic1).Build(), // Wings
|
||||||
D3.Hero.VisualCosmeticItem.CreateBuilder().SetGbid(Cosmetic2).Build(), // Flag
|
D3.Hero.VisualCosmeticItem.CreateBuilder().SetGbid(Cosmetic2).Build(), // Flag
|
||||||
@ -197,8 +197,8 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
}
|
}
|
||||||
|
|
||||||
_visualEquipment = D3.Hero.VisualEquipment.CreateBuilder().AddRangeVisualItem(visualItems)
|
_visualEquipment = D3.Hero.VisualEquipment.CreateBuilder().AddRangeVisualItem(visualItems)
|
||||||
.AddRangeCosmeticItem(CosmeticItems).Build();
|
.AddRangeCosmeticItem(cosmeticItems).Build();
|
||||||
_visualEquipmentChanged = false;
|
VisualEquipmentChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ByteStringPresenceField<D3.Hero.VisualEquipment>(FieldKeyHelper.Program.D3,
|
return new ByteStringPresenceField<D3.Hero.VisualEquipment>(FieldKeyHelper.Program.D3,
|
||||||
@ -212,19 +212,19 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// D3 EntityID encoded id.
|
/// D3 EntityID encoded id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public D3.OnlineService.EntityId D3EntityID { get; private set; }
|
public D3.OnlineService.EntityId D3EntityId { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True if toon has been recently deleted;
|
/// True if toon has been recently deleted;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Deleted
|
public bool Deleted
|
||||||
{
|
{
|
||||||
get => DBToon.Deleted;
|
get => DbToon.Deleted;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.Deleted = value;
|
dbToon.Deleted = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -235,12 +235,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public int SeasonCreated
|
public int SeasonCreated
|
||||||
{
|
{
|
||||||
get => DBToon.CreatedSeason;
|
get => DbToon.CreatedSeason;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.CreatedSeason = value;
|
dbToon.CreatedSeason = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -249,12 +249,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public bool StoneOfPortal
|
public bool StoneOfPortal
|
||||||
{
|
{
|
||||||
get => DBToon.StoneOfPortal;
|
get => DbToon.StoneOfPortal;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.StoneOfPortal = value;
|
dbToon.StoneOfPortal = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -263,12 +263,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public bool Dead
|
public bool Dead
|
||||||
{
|
{
|
||||||
get => DBToon.Dead;
|
get => DbToon.Dead;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.Dead = value;
|
dbToon.Dead = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -280,12 +280,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Archieved
|
public bool Archieved
|
||||||
{
|
{
|
||||||
get => DBToon.Archieved;
|
get => DbToon.Archieved;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.Archieved = value;
|
dbToon.Archieved = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -319,9 +319,9 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_heroName = value;
|
_heroName = value;
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.Name = value;
|
dbToon.Name = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -350,9 +350,9 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
GameAccountId = value.PersistentID;
|
GameAccountId = value.PersistentID;
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.DBGameAccount = value.DBGameAccount;
|
dbToon.DBGameAccount = value.DBGameAccount;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -414,9 +414,9 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_flags = value;
|
_flags = value;
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.Flags = value;
|
dbToon.Flags = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -440,7 +440,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
{
|
{
|
||||||
if (_levelChanged || !LoginServerConfig.Instance.Enabled)
|
if (_levelChanged || !LoginServerConfig.Instance.Enabled)
|
||||||
{
|
{
|
||||||
_cachedLevel = DBToon.Level;
|
_cachedLevel = DbToon.Level;
|
||||||
_levelChanged = false;
|
_levelChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,10 +448,10 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
}
|
}
|
||||||
private set
|
private set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
_cachedLevel = value;
|
_cachedLevel = value;
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.Level = value;
|
dbToon.Level = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -459,7 +459,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int _cachedParagonLevel = 0;
|
private int _cachedParagonLevel = 0;
|
||||||
public bool _paragonLevelChanged = true;
|
public bool ParagonLevelChanged = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Toon's Paragon level.
|
/// Toon's Paragon level.
|
||||||
@ -468,9 +468,9 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!_paragonLevelChanged && LoginServerConfig.Instance.Enabled) return _cachedParagonLevel;
|
if (!ParagonLevelChanged && LoginServerConfig.Instance.Enabled) return _cachedParagonLevel;
|
||||||
_cachedParagonLevel = GameAccount.DBGameAccount.ParagonLevel;
|
_cachedParagonLevel = GameAccount.DBGameAccount.ParagonLevel;
|
||||||
_paragonLevelChanged = false;
|
ParagonLevelChanged = false;
|
||||||
|
|
||||||
return _cachedParagonLevel;
|
return _cachedParagonLevel;
|
||||||
}
|
}
|
||||||
@ -494,16 +494,16 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public long ExperienceNext
|
public long ExperienceNext
|
||||||
{
|
{
|
||||||
get => (Level >= 70 ? ParagonExperienceNext : DBToon.Experience);
|
get => (Level >= 70 ? ParagonExperienceNext : DbToon.Experience);
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (Level >= 70)
|
if (Level >= 70)
|
||||||
ParagonExperienceNext = value;
|
ParagonExperienceNext = value;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.Experience = value;
|
dbToon.Experience = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -530,12 +530,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public int CurrentAct
|
public int CurrentAct
|
||||||
{
|
{
|
||||||
get => DBToon.CurrentAct;
|
get => DbToon.CurrentAct;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.CurrentAct = value;
|
dbToon.CurrentAct = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -544,12 +544,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public int CurrentQuestId
|
public int CurrentQuestId
|
||||||
{
|
{
|
||||||
get => DBToon.CurrentQuestId;
|
get => DbToon.CurrentQuestId;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.CurrentQuestId = value;
|
dbToon.CurrentQuestId = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -558,12 +558,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public int PvERating
|
public int PvERating
|
||||||
{
|
{
|
||||||
get => DBToon.PvERating;
|
get => DbToon.PvERating;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.PvERating = value;
|
dbToon.PvERating = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -572,12 +572,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public int CurrentQuestStepId
|
public int CurrentQuestStepId
|
||||||
{
|
{
|
||||||
get => DBToon.CurrentQuestStepId;
|
get => DbToon.CurrentQuestStepId;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.CurrentQuestStepId = value;
|
dbToon.CurrentQuestStepId = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -586,12 +586,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public int CurrentDifficulty
|
public int CurrentDifficulty
|
||||||
{
|
{
|
||||||
get => DBToon.CurrentDifficulty;
|
get => DbToon.CurrentDifficulty;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.CurrentDifficulty = value;
|
dbToon.CurrentDifficulty = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -606,11 +606,11 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
get => GameAccount.DBGameAccount.TotalKilled;
|
get => GameAccount.DBGameAccount.TotalKilled;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
var dbGA = GameAccount.DBGameAccount;
|
var dbGa = GameAccount.DBGameAccount;
|
||||||
lock (dbGA)
|
lock (dbGa)
|
||||||
{
|
{
|
||||||
dbGA.TotalKilled = value;
|
dbGa.TotalKilled = value;
|
||||||
DBSessions.SessionUpdate(dbGA);
|
DBSessions.SessionUpdate(dbGa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -623,11 +623,11 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
get => GameAccount.DBGameAccount.ElitesKilled;
|
get => GameAccount.DBGameAccount.ElitesKilled;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
var dbGA = GameAccount.DBGameAccount;
|
var dbGa = GameAccount.DBGameAccount;
|
||||||
lock (dbGA)
|
lock (dbGa)
|
||||||
{
|
{
|
||||||
dbGA.ElitesKilled = value;
|
dbGa.ElitesKilled = value;
|
||||||
DBSessions.SessionUpdate(dbGA);
|
DBSessions.SessionUpdate(dbGa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -650,19 +650,19 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
var dbGA = GameAccount.DBGameAccount;
|
var dbGa = GameAccount.DBGameAccount;
|
||||||
lock (dbGA)
|
lock (dbGa)
|
||||||
{
|
{
|
||||||
if (IsHardcore)
|
if (IsHardcore)
|
||||||
{
|
{
|
||||||
dbGA.TotalBountiesHardcore = value;
|
dbGa.TotalBountiesHardcore = value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dbGA.TotalBounties = value;
|
dbGa.TotalBounties = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBSessions.SessionUpdate(dbGA);
|
DBSessions.SessionUpdate(dbGa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -672,10 +672,10 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int SeasonalKills
|
public int SeasonalKills
|
||||||
{
|
{
|
||||||
get => DBToon.Kills;
|
get => DbToon.Kills;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
lock (dbToon)
|
lock (dbToon)
|
||||||
{
|
{
|
||||||
dbToon.Kills = value;
|
dbToon.Kills = value;
|
||||||
@ -714,12 +714,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int CollectedGoldSeasonal
|
public int CollectedGoldSeasonal
|
||||||
{
|
{
|
||||||
get => DBToon.GoldGained;
|
get => DbToon.GoldGained;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.GoldGained = value;
|
dbToon.GoldGained = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -731,12 +731,12 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int TimePlayed
|
public int TimePlayed
|
||||||
{
|
{
|
||||||
get => DBToon.TimePlayed;
|
get => DbToon.TimePlayed;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
lock (DBToon)
|
lock (DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
dbToon.TimePlayed = value;
|
dbToon.TimePlayed = value;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -751,7 +751,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Database handler for this toon
|
/// Database handler for this toon
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GameDBSession DBSession { get; set; }
|
public GameDBSession DbSession { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Settings for toon.
|
/// Settings for toon.
|
||||||
@ -772,14 +772,14 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
if (IsHardcore) dbToon.Flags |= ToonFlags.Hardcore;
|
if (IsHardcore) dbToon.Flags |= ToonFlags.Hardcore;
|
||||||
//var isSeason = Convert.ToUInt16(isSeassoned);
|
//var isSeason = Convert.ToUInt16(isSeassoned);
|
||||||
|
|
||||||
var digest = D3.Hero.Digest.CreateBuilder().SetVersion(905)
|
var digest = D3.Hero.Digest.CreateBuilder().SetVersion(905)
|
||||||
.SetHeroId(D3EntityID)
|
.SetHeroId(D3EntityId)
|
||||||
.SetHeroName(Name)
|
.SetHeroName(Name)
|
||||||
.SetGbidClass((int)ClassID)
|
.SetGbidClass((int)ClassId)
|
||||||
.SetLevel(Level)
|
.SetLevel(Level)
|
||||||
//deprecated //.SetAltLevel(dbToon.ParagonLevel)
|
//deprecated //.SetAltLevel(dbToon.ParagonLevel)
|
||||||
.SetPlayerFlags((uint)dbToon.Flags) // + isSeason)
|
.SetPlayerFlags((uint)dbToon.Flags) // + isSeason)
|
||||||
@ -936,7 +936,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
.SetIdHigh(0x3C000002517A293 + invItem.Id))
|
.SetIdHigh(0x3C000002517A293 + invItem.Id))
|
||||||
.SetHirelingClass(0)
|
.SetHirelingClass(0)
|
||||||
.SetItemSlot(272 + invItem.EquipmentSlot * 16)
|
.SetItemSlot(272 + invItem.EquipmentSlot * 16)
|
||||||
.SetOwnerEntityId(D3EntityID)
|
.SetOwnerEntityId(D3EntityId)
|
||||||
.SetSquareIndex(0)
|
.SetSquareIndex(0)
|
||||||
.SetUsedSocketCount(0);
|
.SetUsedSocketCount(0);
|
||||||
|
|
||||||
@ -1014,7 +1014,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
}
|
}
|
||||||
|
|
||||||
//*/
|
//*/
|
||||||
var dbToon = DBToon;
|
var dbToon = DbToon;
|
||||||
string[] stats = dbToon.Stats.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
string[] stats = dbToon.Stats.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
var profile = D3.Profile.HeroProfile.CreateBuilder()
|
var profile = D3.Profile.HeroProfile.CreateBuilder()
|
||||||
.SetHardcore(IsHardcore)
|
.SetHardcore(IsHardcore)
|
||||||
@ -1022,7 +1022,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
//deprecated //.SetLife(0)
|
//deprecated //.SetLife(0)
|
||||||
.SetSnoKillLocation(71150)
|
.SetSnoKillLocation(71150)
|
||||||
.SetKillerInfo(D3.Profile.KillerInfo.CreateBuilder().SetSnoKiller(6031).SetRarity(4))
|
.SetKillerInfo(D3.Profile.KillerInfo.CreateBuilder().SetSnoKiller(6031).SetRarity(4))
|
||||||
.SetHeroId(D3EntityID)
|
.SetHeroId(D3EntityId)
|
||||||
//deprecated //.SetHighestDifficulty(0)
|
//deprecated //.SetHighestDifficulty(0)
|
||||||
.SetHighestLevel(dbToon.Level)
|
.SetHighestLevel(dbToon.Level)
|
||||||
//.SetMonstersKilled(111)
|
//.SetMonstersKilled(111)
|
||||||
@ -1045,9 +1045,9 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
//.SetResistCold(110)
|
//.SetResistCold(110)
|
||||||
//.SetResistPoison(111)
|
//.SetResistPoison(111)
|
||||||
.SetEquipment(itemList);
|
.SetEquipment(itemList);
|
||||||
if (DBActiveSkills != null)
|
if (DbActiveSkills != null)
|
||||||
{
|
{
|
||||||
var dbActiveSkills = DBActiveSkills;
|
var dbActiveSkills = DbActiveSkills;
|
||||||
var skills = new[]
|
var skills = new[]
|
||||||
{
|
{
|
||||||
D3.Profile.SkillWithRune.CreateBuilder()
|
D3.Profile.SkillWithRune.CreateBuilder()
|
||||||
@ -1104,7 +1104,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ClassID =>
|
public int ClassId =>
|
||||||
Class switch
|
Class switch
|
||||||
{
|
{
|
||||||
ToonClass.Barbarian => 0x4FB91EE2,
|
ToonClass.Barbarian => 0x4FB91EE2,
|
||||||
@ -1118,7 +1118,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Used for Conversations
|
// Used for Conversations
|
||||||
public int VoiceClassID =>
|
public int VoiceClassId =>
|
||||||
Class switch
|
Class switch
|
||||||
{
|
{
|
||||||
ToonClass.DemonHunter => 0,
|
ToonClass.DemonHunter => 0,
|
||||||
@ -1139,21 +1139,21 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
private readonly Dictionary<int, int> _visualToSlotMapping = new() { { 1, 0 }, { 2, 1 }, { 7, 2 }, { 5, 3 }, { 4, 4 }, { 3, 5 }, { 8, 6 }, { 9, 7 } };
|
private readonly Dictionary<int, int> _visualToSlotMapping = new() { { 1, 0 }, { 2, 1 }, { 7, 2 }, { 5, 3 }, { 4, 4 }, { 3, 5 }, { 8, 6 }, { 9, 7 } };
|
||||||
|
|
||||||
private static readonly Core.MPQ.FileFormats.GameBalance HeroData =
|
public static readonly Core.MPQ.FileFormats.GameBalance HeroData =
|
||||||
(Core.MPQ.FileFormats.GameBalance)MPQStorage.Data.Assets[SNOGroup.GameBalance][19740].Data;
|
(Core.MPQ.FileFormats.GameBalance)MPQStorage.Data.Assets[SNOGroup.GameBalance][19740].Data;
|
||||||
|
|
||||||
public Toon(DBToon dbToon, GameDBSession DBSession = null)
|
public Toon(DBToon dbToon, GameDBSession dbSession = null)
|
||||||
: base(dbToon.Id)
|
: base(dbToon.Id)
|
||||||
{
|
{
|
||||||
D3EntityID = D3.OnlineService.EntityId.CreateBuilder().SetIdHigh((ulong)EntityIdHelper.HighIdType.ToonId)
|
D3EntityId = D3.OnlineService.EntityId.CreateBuilder().SetIdHigh((ulong)EntityIdHelper.HighIdType.ToonId)
|
||||||
.SetIdLow(PersistentID).Build();
|
.SetIdLow(PersistentID).Build();
|
||||||
_heroName = dbToon.Name;
|
_heroName = dbToon.Name;
|
||||||
_flags = dbToon.Flags;
|
_flags = dbToon.Flags;
|
||||||
GameAccountId = dbToon.DBGameAccount.Id;
|
GameAccountId = dbToon.DBGameAccount.Id;
|
||||||
_toonClass = dbToon.Class;
|
_toonClass = dbToon.Class;
|
||||||
|
|
||||||
DBToon = dbToon;
|
DbToon = dbToon;
|
||||||
this.DBSession = DBSession;
|
this.DbSession = dbSession;
|
||||||
IsHardcore = dbToon.isHardcore;
|
IsHardcore = dbToon.isHardcore;
|
||||||
IsSeasoned = dbToon.isSeasoned;
|
IsSeasoned = dbToon.isSeasoned;
|
||||||
HeroTable = HeroData.Heros.Find(item => item.Name == Class.ToString());
|
HeroTable = HeroData.Heros.Find(item => item.Name == Class.ToString());
|
||||||
@ -1190,7 +1190,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
{
|
{
|
||||||
var questHistory = new DBQuestHistory
|
var questHistory = new DBQuestHistory
|
||||||
{
|
{
|
||||||
DBToon = DBToon,
|
DBToon = DbToon,
|
||||||
QuestId = quest,
|
QuestId = quest,
|
||||||
QuestStep = -1,
|
QuestStep = -1,
|
||||||
isCompleted = true
|
isCompleted = true
|
||||||
@ -1209,8 +1209,8 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
public void StateChanged()
|
public void StateChanged()
|
||||||
{
|
{
|
||||||
_levelChanged = true;
|
_levelChanged = true;
|
||||||
_paragonLevelChanged = true;
|
ParagonLevelChanged = true;
|
||||||
_visualEquipmentChanged = true;
|
VisualEquipmentChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Notifications
|
#region Notifications
|
||||||
@ -1242,7 +1242,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public static ToonClass GetClassByID(int classId) =>
|
public static ToonClass GetClassById(int classId) =>
|
||||||
classId switch
|
classId switch
|
||||||
{
|
{
|
||||||
0x4FB91EE2 => ToonClass.Barbarian,
|
0x4FB91EE2 => ToonClass.Barbarian,
|
||||||
@ -1257,7 +1257,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"{{ Toon: {Name} [lowId: {D3EntityID.IdLow}] }}";
|
return $"{{ Toon: {Name} [lowId: {D3EntityId.IdLow}] }}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -240,7 +240,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
|
|
||||||
var newDBToon = new DBToon
|
var newDBToon = new DBToon
|
||||||
{
|
{
|
||||||
Class = @Toon.GetClassByID(classId),
|
Class = @Toon.GetClassById(classId),
|
||||||
Name = name,
|
Name = name,
|
||||||
/*HashCode = GetUnusedHashCodeForToonName(name),*/
|
/*HashCode = GetUnusedHashCodeForToonName(name),*/
|
||||||
Flags = toonFlags,
|
Flags = toonFlags,
|
||||||
@ -309,19 +309,19 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
public static void CreateStartEquipment(Toon toon, bool isHardcore)
|
public static void CreateStartEquipment(Toon toon, bool isHardcore)
|
||||||
{
|
{
|
||||||
DBInventory pants = NewbiePants;
|
DBInventory pants = NewbiePants;
|
||||||
pants.DBToon = toon.DBToon;
|
pants.DBToon = toon.DbToon;
|
||||||
pants.DBGameAccount = toon.GameAccount.DBGameAccount;
|
pants.DBGameAccount = toon.GameAccount.DBGameAccount;
|
||||||
pants.isHardcore = isHardcore;
|
pants.isHardcore = isHardcore;
|
||||||
DBSessions.SessionSave(pants);
|
DBSessions.SessionSave(pants);
|
||||||
|
|
||||||
DBInventory armor = NewbieArmor;
|
DBInventory armor = NewbieArmor;
|
||||||
armor.DBToon = toon.DBToon;
|
armor.DBToon = toon.DbToon;
|
||||||
armor.DBGameAccount = toon.GameAccount.DBGameAccount;
|
armor.DBGameAccount = toon.GameAccount.DBGameAccount;
|
||||||
armor.isHardcore = isHardcore;
|
armor.isHardcore = isHardcore;
|
||||||
DBSessions.SessionSave(armor);
|
DBSessions.SessionSave(armor);
|
||||||
|
|
||||||
DBInventory weapon;
|
DBInventory weapon;
|
||||||
switch (toon.DBToon.Class)
|
switch (toon.DbToon.Class)
|
||||||
{
|
{
|
||||||
case ToonClass.Barbarian:
|
case ToonClass.Barbarian:
|
||||||
weapon = NewbieAxe;
|
weapon = NewbieAxe;
|
||||||
@ -348,14 +348,14 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
weapon = NewbieKnife;
|
weapon = NewbieKnife;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
weapon.DBToon = toon.DBToon;
|
weapon.DBToon = toon.DbToon;
|
||||||
weapon.DBGameAccount = toon.GameAccount.DBGameAccount;
|
weapon.DBGameAccount = toon.GameAccount.DBGameAccount;
|
||||||
weapon.isHardcore = isHardcore;
|
weapon.isHardcore = isHardcore;
|
||||||
DBSessions.SessionSave(weapon);
|
DBSessions.SessionSave(weapon);
|
||||||
if (toon.DBToon.Class == ToonClass.Crusader) //add shield
|
if (toon.DbToon.Class == ToonClass.Crusader) //add shield
|
||||||
{
|
{
|
||||||
weapon = NewbieShield;
|
weapon = NewbieShield;
|
||||||
weapon.DBToon = toon.DBToon;
|
weapon.DBToon = toon.DbToon;
|
||||||
weapon.DBGameAccount = toon.GameAccount.DBGameAccount;
|
weapon.DBGameAccount = toon.GameAccount.DBGameAccount;
|
||||||
weapon.isHardcore = isHardcore;
|
weapon.isHardcore = isHardcore;
|
||||||
DBSessions.SessionSave(weapon);
|
DBSessions.SessionSave(weapon);
|
||||||
@ -367,7 +367,7 @@ namespace DiIiS_NA.LoginServer.Toons
|
|||||||
DBSessions.SessionSave(new DBHireling
|
DBSessions.SessionSave(new DBHireling
|
||||||
{
|
{
|
||||||
Class = type,
|
Class = type,
|
||||||
DBToon = toon.DBToon,
|
DBToon = toon.DbToon,
|
||||||
Skill1SNOId = -1,
|
Skill1SNOId = -1,
|
||||||
Skill2SNOId = -1,
|
Skill2SNOId = -1,
|
||||||
Skill3SNOId = -1,
|
Skill3SNOId = -1,
|
||||||
|
|||||||
@ -219,4 +219,12 @@ namespace DiIiS_NA.Core.Helpers.Math
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool Chance(float successPercentage) => Next(100) < successPercentage;
|
public bool Chance(float successPercentage) => Next(100) < successPercentage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class NumberExtensions
|
||||||
|
{
|
||||||
|
public static float ToFloat(this double value, int decimals = 4) => (float)System.Math.Round(value, decimals);
|
||||||
|
public static float ToFloat(this float value, int decimals = 4) => (float)System.Math.Round(value, decimals);
|
||||||
|
public static double ToDouble(this float value, int decimals = 4) => (double)System.Math.Round(value, decimals);
|
||||||
|
public static double ToDouble(this double value, int decimals = 4) => (double)System.Math.Round(value, decimals);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,21 @@ public static class RandomHelper
|
|||||||
return Random.Next(minValue, maxValue);
|
return Random.Next(minValue, maxValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float NextFloat()
|
||||||
|
{
|
||||||
|
return (float)Random.NextDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float NextFloat(float min, float max)
|
||||||
|
{
|
||||||
|
return min + (float)Random.NextDouble() * (max - min);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float NextFloat(float max)
|
||||||
|
{
|
||||||
|
return (float)Random.NextDouble() * max;
|
||||||
|
}
|
||||||
|
|
||||||
public static void NextBytes(byte[] buffer)
|
public static void NextBytes(byte[] buffer)
|
||||||
{
|
{
|
||||||
Random.NextBytes(buffer);
|
Random.NextBytes(buffer);
|
||||||
|
|||||||
@ -22,28 +22,19 @@ namespace DiIiS_NA.Core.Logging
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal readonly static Dictionary<string, Logger> Loggers = new();
|
internal readonly static Dictionary<string, Logger> Loggers = new();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates and returns a logger named with declaring type.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A <see cref="Logger"/> instance.</returns>
|
|
||||||
public static Logger CreateLogger([CallerFilePath] string filePath = "")
|
|
||||||
{
|
|
||||||
var frame = new StackFrame(1, false); // read stack frame.
|
|
||||||
var name = frame.GetMethod().DeclaringType.Name; // get declaring type's name.
|
|
||||||
|
|
||||||
if (name == null) // see if we got a name.
|
|
||||||
throw new Exception("Error getting full name for declaring type.");
|
|
||||||
|
|
||||||
return CreateLogger(name, filePath); // return the newly created logger.
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates and returns a logger with given name.
|
/// Creates and returns a logger with given name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <returns>A <see cref="Logger"/> instance.</returns>
|
/// <returns>A <see cref="Logger"/> instance.</returns>
|
||||||
public static Logger CreateLogger(string name, [CallerFilePath] string filePath = "")
|
public static Logger CreateLogger(string? name = null, [CallerFilePath] string filePath = "")
|
||||||
{
|
{
|
||||||
|
if (name == null)
|
||||||
|
{
|
||||||
|
var frame = new StackFrame(1, false); // read stack frame.
|
||||||
|
name = frame.GetMethod()?.DeclaringType?.Name ?? "Unknown"; // get declaring type's name.
|
||||||
|
}
|
||||||
|
|
||||||
if (!Loggers.ContainsKey(name)) // see if we already have instance for the given name.
|
if (!Loggers.ContainsKey(name)) // see if we already have instance for the given name.
|
||||||
Loggers.Add(name, new Logger(name, filePath)); // add it to dictionary of loggers.
|
Loggers.Add(name, new Logger(name, filePath)); // add it to dictionary of loggers.
|
||||||
|
|
||||||
|
|||||||
@ -36,10 +36,7 @@ namespace DiIiS_NA.Core.Storage.AccountDataBase
|
|||||||
{
|
{
|
||||||
_config = new Configuration();
|
_config = new Configuration();
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (File.Exists(Path.Combine(FileHelpers.AssemblyRoot, "database.Account.Debug.config")))
|
_config = _config.Configure(File.Exists(Path.Combine(FileHelpers.AssemblyRoot, "database.Account.Debug.config")) ? Path.Combine(FileHelpers.AssemblyRoot, "database.Account.Debug.config") : Path.Combine(FileHelpers.AssemblyRoot, "database.Account.config"));
|
||||||
_config = _config.Configure(Path.Combine(FileHelpers.AssemblyRoot, "database.Account.Debug.config"));
|
|
||||||
else
|
|
||||||
_config = _config.Configure(Path.Combine(FileHelpers.AssemblyRoot, "database.Account.config"));
|
|
||||||
#else
|
#else
|
||||||
_config = _config.Configure(Path.Combine(FileHelpers.AssemblyRoot, "database.Account.config"));
|
_config = _config.Configure(Path.Combine(FileHelpers.AssemblyRoot, "database.Account.config"));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -35,8 +35,11 @@ namespace DiIiS_NA.Core.Storage.WorldSceneBase
|
|||||||
if (_config == null)
|
if (_config == null)
|
||||||
{
|
{
|
||||||
_config = new Configuration();
|
_config = new Configuration();
|
||||||
|
#if DEBUG
|
||||||
|
_config = _config.Configure(File.Exists(Path.Combine(FileHelpers.AssemblyRoot, "database.Worlds.Debug.config")) ? Path.Combine(FileHelpers.AssemblyRoot, "database.Worlds.Debug.config") : Path.Combine(FileHelpers.AssemblyRoot, "database.Worlds.config"));
|
||||||
|
#else
|
||||||
_config = _config.Configure(Path.Combine(FileHelpers.AssemblyRoot, "database.Worlds.config"));
|
_config = _config.Configure(Path.Combine(FileHelpers.AssemblyRoot, "database.Worlds.config"));
|
||||||
|
#endif
|
||||||
|
|
||||||
var replacedProperties = new Dictionary<string, string>();
|
var replacedProperties = new Dictionary<string, string>();
|
||||||
foreach (var prop in _config.Properties)
|
foreach (var prop in _config.Properties)
|
||||||
|
|||||||
@ -281,7 +281,7 @@ namespace DiIiS_NA.GameServer.Core
|
|||||||
if (EquipmentSlot == 15)
|
if (EquipmentSlot == 15)
|
||||||
ownerPlayer.Inventory.SaveItemToDB(ownerPlayer.Toon.GameAccount.DBGameAccount, null, EquipmentSlotId.Stash, item);
|
ownerPlayer.Inventory.SaveItemToDB(ownerPlayer.Toon.GameAccount.DBGameAccount, null, EquipmentSlotId.Stash, item);
|
||||||
else
|
else
|
||||||
ownerPlayer.Inventory.SaveItemToDB(ownerPlayer.Toon.GameAccount.DBGameAccount, ownerPlayer.Toon.DBToon, EquipmentSlotId.Inventory, item);
|
ownerPlayer.Inventory.SaveItemToDB(ownerPlayer.Toon.GameAccount.DBGameAccount, ownerPlayer.Toon.DbToon, EquipmentSlotId.Inventory, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,9 @@ using DiIiS_NA.Core.Storage;
|
|||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using DiIiS_NA.Core.Helpers.Math;
|
using DiIiS_NA.Core.Helpers.Math;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using DiIiS_NA.GameServer.GSSystem.ActorSystem;
|
||||||
|
|
||||||
namespace DiIiS_NA.GameServer.Core.Types.Math
|
namespace DiIiS_NA.GameServer.Core.Types.Math
|
||||||
{
|
{
|
||||||
@ -112,6 +115,18 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
|
|||||||
|
|
||||||
return ((x * x) + (y * y)) + (z * z);
|
return ((x * x) + (y * y)) + (z * z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double Distance(Vector3D vector1, Vector3D vector2)
|
||||||
|
{
|
||||||
|
return ((vector1.X * vector2.X) + (vector1.Y * vector2.Y) + (vector1.Z * vector2.Z));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsInDistanceSquared(Vector3D position, Vector3D relative, double distanceMax, double distanceMin = -1f)
|
||||||
|
{
|
||||||
|
var dist = Distance(position, relative);
|
||||||
|
return dist < distanceMax && dist > distanceMin;
|
||||||
|
}
|
||||||
|
|
||||||
private static Random rand = new Random();
|
private static Random rand = new Random();
|
||||||
|
|
||||||
public Vector3D Around(float radius)
|
public Vector3D Around(float radius)
|
||||||
@ -185,5 +200,34 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
|
|||||||
public override string ToString() => $"X:{X:F4}, Y:{Y:F4} Z:{Z:F4}";
|
public override string ToString() => $"X:{X:F4}, Y:{Y:F4} Z:{Z:F4}";
|
||||||
|
|
||||||
public bool IsNear(Vector3D other, float distance) => DistanceSquared(ref other) < distance;
|
public bool IsNear(Vector3D other, float distance) => DistanceSquared(ref other) < distance;
|
||||||
|
|
||||||
|
public override int GetHashCode() => HashCode.Combine(X.ToDouble(decimals: 6), Y.ToDouble(decimals: 6), Z.ToDouble(decimals: 6));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class VectorExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Takes all actors from the given collection that are within the specified distance of the reference position.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TActor"></typeparam>
|
||||||
|
/// <param name="actors"></param>
|
||||||
|
/// <param name="referencePosition"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static TSearch[] WhereNearbyOf<TActor, TSearch>(
|
||||||
|
this IEnumerable<TActor> actors,
|
||||||
|
TSearch[] referenceActors,
|
||||||
|
Func<TSearch, bool> query,
|
||||||
|
double maxDistance = 50f,
|
||||||
|
double minDistance = 1f)
|
||||||
|
where TActor : Actor
|
||||||
|
where TSearch : Actor
|
||||||
|
{
|
||||||
|
return actors.OfType<TSearch>()
|
||||||
|
.Where(actor => query(actor))
|
||||||
|
.Where((actor, dist) =>
|
||||||
|
referenceActors.Any(refActor => refActor.GlobalID != actor.GlobalID && Vector3D.IsInDistanceSquared(refActor.Position, actor.Position, maxDistance, minDistance)))
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
|||||||
World.SpawnRandomEquip(player, player,
|
World.SpawnRandomEquip(player, player,
|
||||||
FastRandom.Instance.Next(100) < chance ? LootManager.Epic : LootManager.Rare, player.Level);
|
FastRandom.Instance.Next(100) < chance ? LootManager.Epic : LootManager.Rare, player.Level);
|
||||||
|
|
||||||
var toon = player.Toon.DBToon;
|
var toon = player.Toon.DbToon;
|
||||||
toon.ChestsOpened++;
|
toon.ChestsOpened++;
|
||||||
World.Game.GameDbSession.SessionUpdate(toon);
|
World.Game.GameDbSession.SessionUpdate(toon);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,7 +94,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
|||||||
|
|
||||||
if (haveDrop)
|
if (haveDrop)
|
||||||
{
|
{
|
||||||
var dropRates = World.Game.IsHardcore ? LootManager.GetSeasonalDropRates((int)Quality, Program.MaxLevel) : LootManager.GetDropRates((int)Quality, Program.MaxLevel);
|
var dropRates = World.Game.IsHardcore ? LootManager.GetSeasonalDropRates((int)Quality, Program.MAX_LEVEL) : LootManager.GetDropRates((int)Quality, Program.MAX_LEVEL);
|
||||||
foreach (var rate in dropRates)
|
foreach (var rate in dropRates)
|
||||||
foreach (var plr in GetPlayersInRange(30))
|
foreach (var plr in GetPlayersInRange(30))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,6 +18,16 @@ using DiIiS_NA.GameServer.GSSystem.AISystem.Brains;
|
|||||||
using DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations;
|
using DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations;
|
||||||
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
||||||
using World = DiIiS_NA.GameServer.GSSystem.MapSystem.World;
|
using World = DiIiS_NA.GameServer.GSSystem.MapSystem.World;
|
||||||
|
using DiIiS_NA.Core.Helpers.Math;
|
||||||
|
using DiIiS_NA.LoginServer.Toons;
|
||||||
|
using static DiIiS_NA.Core.MPQ.FileFormats.Monster;
|
||||||
|
using D3.Store;
|
||||||
|
using DiIiS_NA.GameServer.GSSystem.AISystem;
|
||||||
|
using DiIiS_NA.GameServer.GSSystem.MapSystem;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using static DiIiS_NA.Core.Logging.Logger;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net.NetworkInformation;
|
||||||
|
|
||||||
namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
||||||
{
|
{
|
||||||
@ -40,8 +50,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
|||||||
|
|
||||||
public int LoreSnoId => Monster.IsValid ? ((MonsterFF)Monster.Target).SNOLore : -1;
|
public int LoreSnoId => Monster.IsValid ? ((MonsterFF)Monster.Target).SNOLore : -1;
|
||||||
|
|
||||||
public int MonsterType => Monster.IsValid ? (int)((MonsterFF)Monster.Target).Type : -1;
|
public int MonsterTypeValue => Monster.IsValid ? (int)((MonsterFF)Monster.Target).Type : -1;
|
||||||
|
public MonsterType MonsterType => (MonsterType)(((MonsterFF)Monster.Target)?.Type ?? MonsterType.Unknown);
|
||||||
public float HpMultiplier => Monster.IsValid ? (1f + ((MonsterFF)Monster.Target).AttributeModifiers[4]) : 1f;
|
public float HpMultiplier => Monster.IsValid ? (1f + ((MonsterFF)Monster.Target).AttributeModifiers[4]) : 1f;
|
||||||
|
|
||||||
public float DmgMultiplier => Monster.IsValid ? (1f + ((MonsterFF)Monster.Target).AttributeModifiers[55]) : 1f;
|
public float DmgMultiplier => Monster.IsValid ? (1f + ((MonsterFF)Monster.Target).AttributeModifiers[55]) : 1f;
|
||||||
@ -87,6 +97,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
|||||||
|
|
||||||
public void UpdateStats()
|
public void UpdateStats()
|
||||||
{
|
{
|
||||||
|
// TODO: Level up is getting harder from level 3+. 1 seems stable. check the difficulty.
|
||||||
|
// TODO: Level up is getting harder from level 3+. 1 seems stable. check the difficulty.
|
||||||
|
// TODO: Level up is getting harder from level 3+. 1 seems stable. check the difficulty.
|
||||||
|
|
||||||
var monsterLevels = (GameBalance)DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[SNOGroup.GameBalance][19760].Data;
|
var monsterLevels = (GameBalance)DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[SNOGroup.GameBalance][19760].Data;
|
||||||
bool fullHp = (Math.Abs(Attributes[GameAttributes.Hitpoints_Cur] - Attributes[GameAttributes.Hitpoints_Max_Total]) < Globals.FLOAT_TOLERANCE);
|
bool fullHp = (Math.Abs(Attributes[GameAttributes.Hitpoints_Cur] - Attributes[GameAttributes.Hitpoints_Max_Total]) < Globals.FLOAT_TOLERANCE);
|
||||||
Attributes[GameAttributes.Level] = World.Game.MonsterLevel;
|
Attributes[GameAttributes.Level] = World.Game.MonsterLevel;
|
||||||
@ -94,40 +108,169 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
|
|||||||
int monsterLevel = 1;
|
int monsterLevel = 1;
|
||||||
monsterLevel = World.Game.ConnectedPlayers.Length > 1 ? World.Game.ConnectedPlayers[0].Level : World.Game.InitialMonsterLevel;
|
monsterLevel = World.Game.ConnectedPlayers.Length > 1 ? World.Game.ConnectedPlayers[0].Level : World.Game.InitialMonsterLevel;
|
||||||
|
|
||||||
|
var connectedPlayers = World.Game.ConnectedPlayers.ToArray();
|
||||||
|
double maxUsersHealth = 1f;
|
||||||
|
double deltaDamageUsers = 1f;
|
||||||
|
int userLevelAverage = 1;
|
||||||
|
|
||||||
Attributes[GameAttributes.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);
|
if (connectedPlayers.Any())
|
||||||
Attributes[GameAttributes.Hitpoints_Max_Percent_Bonus_Multiplicative] = ((int)World.Game.ConnectedPlayers.Length + 1) * 1.5f;
|
|
||||||
Attributes[GameAttributes.Hitpoints_Max_Percent_Bonus_Multiplicative] *= GameModsConfig.Instance.Monster.HealthMultiplier;
|
|
||||||
if (World.Game.ConnectedPlayers.Length > 1)
|
|
||||||
Attributes[GameAttributes.Hitpoints_Max_Percent_Bonus_Multiplicative] = Attributes[GameAttributes.Hitpoints_Max_Percent_Bonus_Multiplicative];// / 2f;
|
|
||||||
var hpMax = Attributes[GameAttributes.Hitpoints_Max];
|
|
||||||
var hpTotal = Attributes[GameAttributes.Hitpoints_Max_Total];
|
|
||||||
float damageMin = monsterLevels.MonsterLevel[World.Game.MonsterLevel].Dmg * DmgMultiplier;// * 0.5f;
|
|
||||||
float damageDelta = damageMin;
|
|
||||||
Attributes[GameAttributes.Damage_Weapon_Min, 0] = damageMin * World.Game.DmgModifier * GameModsConfig.Instance.Monster.DamageMultiplier;
|
|
||||||
Attributes[GameAttributes.Damage_Weapon_Delta, 0] = damageDelta;
|
|
||||||
|
|
||||||
if (monsterLevel > 30)
|
|
||||||
{
|
{
|
||||||
Attributes[GameAttributes.Hitpoints_Max_Percent_Bonus_Multiplicative] = Attributes[GameAttributes.Hitpoints_Max_Percent_Bonus_Multiplicative];// * 0.5f;
|
maxUsersHealth = connectedPlayers.Average(x => x.Attributes[GameAttributes.Hitpoints_Max]);
|
||||||
Attributes[GameAttributes.Damage_Weapon_Min, 0] = damageMin * World.Game.DmgModifier * GameModsConfig.Instance.Monster.DamageMultiplier;// * 0.2f;
|
deltaDamageUsers = connectedPlayers.Average(x => x.Attributes[GameAttributes.Damage_Delta]);
|
||||||
Attributes[GameAttributes.Damage_Weapon_Delta, 0] = damageDelta;
|
userLevelAverage = (int)connectedPlayers.Average(x => x.Level);
|
||||||
}
|
Logger.MethodTrace($"$[yellow]${connectedPlayers.Length}$[/]$ $[green]$players online$[/]$: $[blue dim]${maxUsersHealth}$[/]$ $[bold]$avg. max health$[/]$ / $[blue dim italic]${deltaDamageUsers}$[/]$ $[bold]$avg. delta damage$[/]$");
|
||||||
if (monsterLevel > 60)
|
|
||||||
{
|
|
||||||
Attributes[GameAttributes.Hitpoints_Max_Percent_Bonus_Multiplicative] = Attributes[GameAttributes.Hitpoints_Max_Percent_Bonus_Multiplicative];// * 0.7f;
|
|
||||||
Attributes[GameAttributes.Damage_Weapon_Min, 0] = damageMin * World.Game.DmgModifier * GameModsConfig.Instance.Monster.DamageMultiplier;// * 0.15f;
|
|
||||||
//this.Attributes[GameAttribute.Damage_Weapon_Delta, 0] = DamageDelta * 0.5f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_nativeHp = Attributes[GameAttributes.Hitpoints_Max_Total];
|
var difficulty = World.Game.Difficulty;
|
||||||
_nativeDmg = Attributes[GameAttributes.Damage_Weapon_Min, 0];
|
var maxHP = (monsterLevels.MonsterLevel[monsterLevel].HPMin +
|
||||||
|
RandomHelper.NextFloat(0f, monsterLevels.MonsterLevel[monsterLevel].HPDelta)) *
|
||||||
|
HpMultiplier * World.Game.HpModifier;
|
||||||
|
var bonus = CalculateLevelAdjustment(LevelAdjustmentEnum.LinearScaling, difficulty, connectedPlayers);
|
||||||
|
|
||||||
|
Attributes[GameAttributes.Hitpoints_Max] = maxHP;
|
||||||
|
Attributes[GameAttributes.Hitpoints_Max_Percent_Bonus_Multiplicative] = bonus;
|
||||||
|
|
||||||
|
var baseHp = Attributes[GameAttributes.Hitpoints_Max];
|
||||||
|
var baseDamage = Attributes[GameAttributes.Damage_Weapon_Min, 0];
|
||||||
|
|
||||||
|
// Apply calculated scaling
|
||||||
|
baseHp *= bonus;
|
||||||
|
baseDamage *= bonus;
|
||||||
|
|
||||||
|
// Apply configuration modifiers
|
||||||
|
baseHp *= GameModsConfig.Instance.Monster.HealthMultiplier;
|
||||||
|
baseDamage *= GameModsConfig.Instance.Monster.DamageMultiplier;
|
||||||
|
|
||||||
|
// Assign modified values
|
||||||
|
Attributes[GameAttributes.Hitpoints_Max_Total] = baseHp;
|
||||||
|
Attributes[GameAttributes.Damage_Weapon_Min, 0] = baseDamage;
|
||||||
//if (full_hp)
|
//if (full_hp)
|
||||||
Attributes[GameAttributes.Hitpoints_Cur] = Attributes[GameAttributes.Hitpoints_Max_Total];
|
Attributes[GameAttributes.Hitpoints_Cur] = Attributes[GameAttributes.Hitpoints_Max_Total];
|
||||||
|
|
||||||
Attributes.BroadcastChangedIfRevealed();
|
Attributes.BroadcastChangedIfRevealed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum LevelAdjustmentEnum { LinearScaling, DiminishedReturns, CurveScaling, LinearScalingAndDiminishedReturnsAfterThreshold }
|
||||||
|
|
||||||
|
private float CalculateLevelAdjustment(LevelAdjustmentEnum levelAdjustment, int difficulty = 0, params Player[] players)
|
||||||
|
{
|
||||||
|
var playersStats = players.Select(s =>
|
||||||
|
new
|
||||||
|
{
|
||||||
|
s.Attributes,
|
||||||
|
TotalLevel = s.Level + s.ParagonLevel * 1.05f,
|
||||||
|
Health = s.Attributes[GameAttributes.Hitpoints_Max],
|
||||||
|
Damage = s.Attributes[GameAttributes.Damage_Weapon_Min, 0],
|
||||||
|
Toughness = s.Attributes[GameAttributes.Armor_Total],
|
||||||
|
DPS = s.Attributes[GameAttributes.DPS]
|
||||||
|
}
|
||||||
|
).ToArray();
|
||||||
|
var monstersNearbyStats = players.WhereNearbyOf(World.Monsters.ToArray(), s => s.Visible && s.Alive && s.Attributes[GameAttributes.Hitpoints_Max] * 0.8 > Attributes[GameAttributes.Hitpoints_Cur], 120f, 1f).ToArray();
|
||||||
|
var monsterStats = monstersNearbyStats.Select(s =>
|
||||||
|
new
|
||||||
|
{
|
||||||
|
s.Attributes,
|
||||||
|
Health = s.Attributes[GameAttributes.Hitpoints_Max],
|
||||||
|
Damage = s.Attributes[GameAttributes.Damage_Weapon_Min, 0],
|
||||||
|
Toughness = s.Attributes[GameAttributes.Armor_Total],
|
||||||
|
DPS = s.Attributes[GameAttributes.DPS]
|
||||||
|
}
|
||||||
|
).ToArray();
|
||||||
|
|
||||||
|
// Define configuration constants
|
||||||
|
// This is the multiplier for linear scaling. It determines how much the monster's level increases for each player level.
|
||||||
|
// If you increase this value, monsters will become stronger faster as player levels increase.
|
||||||
|
const float linearMultiplierConfig = 0.025f;
|
||||||
|
|
||||||
|
// This is the multiplier for diminished returns scaling. It determines how much the monster's level increases for each player level,
|
||||||
|
// but the increase becomes smaller as player levels get higher. If you increase this value, monsters will become stronger faster at lower player levels.
|
||||||
|
const float diminishedMultiplierConfig = 0.1f;
|
||||||
|
|
||||||
|
// This is the base value for diminished returns scaling. It's the starting point for the monster's level before any scaling is applied.
|
||||||
|
// If you increase this value, monsters will start off stronger before any player level scaling is applied.
|
||||||
|
const float diminishedBaseConfig = 1.0f;
|
||||||
|
|
||||||
|
// This is the multiplier for curve scaling. It determines how much the monster's level increases for each player level,
|
||||||
|
// but the increase becomes larger as player levels get higher. If you increase this value, monsters will become stronger faster at higher player levels.
|
||||||
|
const float curveMultiplierConfig = 0.1f;
|
||||||
|
|
||||||
|
// This is the base value for curve scaling. It's the starting point for the monster's level before any scaling is applied.
|
||||||
|
// If you increase this value, monsters will start off stronger before any player level scaling is applied.
|
||||||
|
const float curveBaseConfig = 30.0f;
|
||||||
|
|
||||||
|
// This is the exponent for curve scaling. It determines the shape of the curve for how much the monster's level increases for each player level.
|
||||||
|
// If you increase this value, the curve will be steeper, meaning monsters will become much stronger at higher player levels.
|
||||||
|
const float curveExponentConfig = 0.1f;
|
||||||
|
|
||||||
|
// This is the multiplier for linear scaling after a certain threshold. It determines how much the monster's level increases for each player level
|
||||||
|
// after the player level has reached a certain threshold. If you increase this value, monsters will become stronger faster after player levels reach the threshold.
|
||||||
|
const float linearMultiplierThresholdConfig = 0.005f;
|
||||||
|
|
||||||
|
// This is the multiplier for log scaling. It determines how much the monster's level increases for each player level,
|
||||||
|
// but the increase becomes smaller as player levels get higher. If you increase this value, monsters will become stronger faster at lower player levels.
|
||||||
|
const float logMultiplierConfig = 0.1f;
|
||||||
|
|
||||||
|
// This is the threshold for linear scaling. It determines the player level at which linear scaling starts to apply.
|
||||||
|
// If you increase this value, linear scaling will start to apply at higher player levels.
|
||||||
|
const float thresholdConfig = 40.0f;
|
||||||
|
|
||||||
|
// This is the ratio for DPS (Damage Per Second) scaling. It determines how much the monster's level increases for each unit of player DPS.
|
||||||
|
// If you increase this value, monsters will become stronger faster as player DPS increases.
|
||||||
|
const float dpsRatioConfig = 1.2f;
|
||||||
|
|
||||||
|
// This is the ratio for toughness scaling. It determines how much the monster's level increases for each unit of player toughness.
|
||||||
|
// If you increase this value, monsters will become stronger faster as player toughness increases.
|
||||||
|
const float toughnessRatioConfig = 0.1f;
|
||||||
|
|
||||||
|
// Define variables for average user and monster stats
|
||||||
|
// float avgUserLevel = playersStats.Average(s => s.TotalLevel);
|
||||||
|
// float avgUserDPS = playersStats.Average(s => s.DPS);
|
||||||
|
// float avgUserToughness = playersStats.Average(s => s.Toughness);
|
||||||
|
//float avgMonsterDPS = playersStats.Average(s => s.DPS);
|
||||||
|
// float avgMonsterToughness = monsterStats.Average(s => s.Toughness);
|
||||||
|
//var tierMultiplier = GetMonsterTierMultiplier();
|
||||||
|
float avgUserLevel = 1f, avgUserDPS = 1f, avgUserToughness = 1f, avgMonsterDPS = 1f, avgMonsterToughness = 1f, tierMultiplier = 1f;
|
||||||
|
|
||||||
|
if (playersStats.Any())
|
||||||
|
{
|
||||||
|
avgUserLevel = playersStats.Average(s => s.TotalLevel);
|
||||||
|
avgUserDPS = playersStats.Average(s => s.DPS);
|
||||||
|
avgUserToughness = playersStats.Average(s => s.Toughness);
|
||||||
|
}
|
||||||
|
if (monsterStats.Any())
|
||||||
|
{
|
||||||
|
avgMonsterDPS = playersStats.Average(s => s.DPS);
|
||||||
|
avgMonsterToughness = monsterStats.Average(s => s.Toughness);
|
||||||
|
tierMultiplier = GetMonsterTierMultiplier();
|
||||||
|
}
|
||||||
|
float LevelScaling() => 1.0f + 0.1f * MathF.Log10(avgUserLevel + 1) * tierMultiplier;
|
||||||
|
float DiminishedReturns() => diminishedBaseConfig + diminishedMultiplierConfig * avgUserLevel;
|
||||||
|
float CurveScaling() => curveBaseConfig * MathF.Pow(avgUserLevel, curveExponentConfig) * curveMultiplierConfig;
|
||||||
|
float LinearScalingAndDiminishedReturnsAfterThreshold() => MathF.Max(1.0f, MathF.Min(1.5f, logMultiplierConfig * MathF.Log10(avgUserLevel + 1) + (avgUserLevel - thresholdConfig) * linearMultiplierThresholdConfig) * tierMultiplier);
|
||||||
|
|
||||||
|
return levelAdjustment switch
|
||||||
|
{
|
||||||
|
LevelAdjustmentEnum.LinearScaling => LevelScaling(),
|
||||||
|
LevelAdjustmentEnum.DiminishedReturns => DiminishedReturns(),
|
||||||
|
LevelAdjustmentEnum.CurveScaling => CurveScaling(),
|
||||||
|
LevelAdjustmentEnum.LinearScalingAndDiminishedReturnsAfterThreshold => LinearScalingAndDiminishedReturnsAfterThreshold(),
|
||||||
|
_ => LinearScalingAndDiminishedReturnsAfterThreshold()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private float GetMonsterTierMultiplier()
|
||||||
|
{
|
||||||
|
return MonsterType switch
|
||||||
|
{
|
||||||
|
MonsterType.Beast => 1.1f,
|
||||||
|
MonsterType.Demon => 1.15f,
|
||||||
|
MonsterType.Human => 1.25f,
|
||||||
|
MonsterType.Undead => 1.4f, // Steeper jump here
|
||||||
|
_ => 1.0f,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int _bleedFirstTick = 0;
|
int _bleedFirstTick = 0;
|
||||||
int _caltropsFirstTick = 0;
|
int _caltropsFirstTick = 0;
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
private bool SenderMessageReceived(byte[] data)
|
private bool SenderMessageReceived(byte[] data)
|
||||||
{
|
{
|
||||||
string msg = "";
|
string msg = "";
|
||||||
if (data != null && data.Length > 0) msg = Encoding.UTF8.GetString(data);
|
if (data is { Length: > 0 }) msg = Encoding.UTF8.GetString(data);
|
||||||
Logger.Debug("Message from Battle.net: {0}", msg);
|
Logger.Debug("Message from Battle.net: {0}", msg);
|
||||||
|
|
||||||
var message = msg.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
var message = msg.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|||||||
@ -31,7 +31,6 @@ using DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings;
|
|||||||
using DiIiS_NA.GameServer.GSSystem.GeneratorsSystem;
|
using DiIiS_NA.GameServer.GSSystem.GeneratorsSystem;
|
||||||
using DiIiS_NA.GameServer.GSSystem.AISystem.Brains;
|
using DiIiS_NA.GameServer.GSSystem.AISystem.Brains;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using DiIiS_NA.Core.MPQ.FileFormats;
|
using DiIiS_NA.Core.MPQ.FileFormats;
|
||||||
using DiIiS_NA.D3_GameServer;
|
using DiIiS_NA.D3_GameServer;
|
||||||
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
||||||
@ -40,6 +39,7 @@ using Actor = DiIiS_NA.GameServer.GSSystem.ActorSystem.Actor;
|
|||||||
using Monster = DiIiS_NA.GameServer.GSSystem.ActorSystem.Monster;
|
using Monster = DiIiS_NA.GameServer.GSSystem.ActorSystem.Monster;
|
||||||
using Scene = DiIiS_NA.GameServer.GSSystem.MapSystem.Scene;
|
using Scene = DiIiS_NA.GameServer.GSSystem.MapSystem.Scene;
|
||||||
using World = DiIiS_NA.GameServer.GSSystem.MapSystem.World;
|
using World = DiIiS_NA.GameServer.GSSystem.MapSystem.World;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||||
{
|
{
|
||||||
@ -138,8 +138,8 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
public int AcceptedPlayers;
|
public int AcceptedPlayers;
|
||||||
};
|
};
|
||||||
|
|
||||||
public readonly Dictionary<WorldSno, List<Action>> OnLoadWorldActions = new();
|
public readonly Dictionary<WorldSno, List<System.Action>> OnLoadWorldActions = new();
|
||||||
public readonly Dictionary<int, List<Action>> OnLoadSceneActions = new();
|
public readonly Dictionary<int, List<System.Action>> OnLoadSceneActions = new();
|
||||||
|
|
||||||
public BossEncounter CurrentEncounter = new() { SnoId = -1, Activated = false, AcceptedPlayers = 0 };
|
public BossEncounter CurrentEncounter = new() { SnoId = -1, Activated = false, AcceptedPlayers = 0 };
|
||||||
|
|
||||||
@ -661,7 +661,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
/// <param name="joinedPlayer">The new player.</param>
|
/// <param name="joinedPlayer">The new player.</param>
|
||||||
public void Enter(Player joinedPlayer)
|
public void Enter(Player joinedPlayer)
|
||||||
{
|
{
|
||||||
if (IsHardcore && !joinedPlayer.Toon.DBToon.isHardcore)
|
if (IsHardcore && !joinedPlayer.Toon.DbToon.isHardcore)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1270,9 +1270,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
|
|
||||||
public void SetDifficulty(int diff)
|
public void SetDifficulty(int diff)
|
||||||
{
|
{
|
||||||
Difficulty = diff;
|
Difficulty = Math.Clamp(diff, 0, 19);
|
||||||
if (Difficulty < 0) Difficulty = 0;
|
|
||||||
if (Difficulty > 19) Difficulty = 19;
|
|
||||||
diff++;
|
diff++;
|
||||||
if (diff > 0)
|
if (diff > 0)
|
||||||
{
|
{
|
||||||
@ -1342,13 +1340,13 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
target.InGameClient.SendMessage(new NewPlayerMessage
|
target.InGameClient.SendMessage(new NewPlayerMessage
|
||||||
{
|
{
|
||||||
PlayerIndex = joinedPlayer.PlayerIndex,
|
PlayerIndex = joinedPlayer.PlayerIndex,
|
||||||
NewToonId = (long)joinedPlayer.Toon.D3EntityID.IdLow,
|
NewToonId = (long)joinedPlayer.Toon.D3EntityId.IdLow,
|
||||||
GameAccountId = new GameAccountHandle()
|
GameAccountId = new GameAccountHandle()
|
||||||
{ ID = (uint)joinedPlayer.Toon.GameAccount.BnetEntityId.Low, Program = 0x00004433, Region = 1 },
|
{ ID = (uint)joinedPlayer.Toon.GameAccount.BnetEntityId.Low, Program = 0x00004433, Region = 1 },
|
||||||
ToonName = joinedPlayer.Toon.Name,
|
ToonName = joinedPlayer.Toon.Name,
|
||||||
Team = 0x00000002,
|
Team = 0x00000002,
|
||||||
Class = joinedPlayer.ClassSno,
|
Class = joinedPlayer.ClassSno,
|
||||||
snoActorPortrait = joinedPlayer.Toon.DBToon.Cosmetic4,
|
snoActorPortrait = joinedPlayer.Toon.DbToon.Cosmetic4,
|
||||||
Level = joinedPlayer.Toon.Level,
|
Level = joinedPlayer.Toon.Level,
|
||||||
AltLevel = (ushort)joinedPlayer.Toon.ParagonLevel,
|
AltLevel = (ushort)joinedPlayer.Toon.ParagonLevel,
|
||||||
HighestHeroSoloRiftLevel = 0,
|
HighestHeroSoloRiftLevel = 0,
|
||||||
|
|||||||
@ -10,6 +10,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using NHibernate.Util;
|
||||||
|
|
||||||
namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@ using DiIiS_NA.Core.Logging;
|
|||||||
|
|
||||||
namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
||||||
{
|
{
|
||||||
[Obsolete("Doesn't seem to be used anywhere, and may use more resources.")]
|
[Obsolete("This class is obsolete and will be removed in the future.")]
|
||||||
public class GameUpdateManager
|
public class GameUpdateManager
|
||||||
{
|
{
|
||||||
private static readonly Logger Logger = LogManager.CreateLogger<GameUpdateManager>();
|
private static readonly Logger Logger = LogManager.CreateLogger<GameUpdateManager>();
|
||||||
@ -22,15 +22,13 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
int CPUCount = Environment.ProcessorCount;
|
int CPUCount = Environment.ProcessorCount;
|
||||||
for (int coreId = 0; coreId < CPUCount; coreId++)
|
for (int coreId = 0; coreId < CPUCount; coreId++)
|
||||||
{
|
{
|
||||||
var thread = new GameUpdateThread
|
var thread = new GameUpdateThread();
|
||||||
{
|
//thread.CPUAffinity = (1UL << coreId);
|
||||||
CPUAffinity = (1UL << coreId)
|
|
||||||
};
|
|
||||||
_updateWorkers.Add(thread);
|
_updateWorkers.Add(thread);
|
||||||
var loopThread = new Thread(thread.Run) { Name = "UpdateWorkerThread", IsBackground = true }; ; // create the game update thread.
|
var loopThread = new Thread(thread.Run) { Name = "UpdateWorkerThread", IsBackground = true }; ; // create the game update thread.
|
||||||
loopThread.Start();
|
loopThread.Start();
|
||||||
}
|
}
|
||||||
Logger.Info("Using {0} worker threads for game updates.", CPUCount);
|
Logger.Info("Started {0} threads", CPUCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameUpdateThread FindWorker()
|
public static GameUpdateThread FindWorker()
|
||||||
|
|||||||
@ -20,18 +20,24 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
[DllImport("libc.so.6")]
|
[DllImport("libc.so.6")]
|
||||||
private static extern int sched_setaffinity(int pid, IntPtr cpusetsize, ref ulong cpuset);
|
private static extern int sched_setaffinity(int pid, IntPtr cpusetsize, ref ulong cpuset);
|
||||||
|
|
||||||
private int CurrentTId => RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? GetCurrentThreadId() : getpid();
|
private int CurrentTId
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? GetCurrentThreadId() : getpid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.CreateLogger();
|
private static readonly Logger Logger = LogManager.CreateLogger();
|
||||||
public List<Game> Games = new List<Game>();
|
public List<Game> Games = new List<Game>();
|
||||||
|
|
||||||
private object _lock = new object();
|
private object _lock = new object();
|
||||||
|
|
||||||
public ulong CPUAffinity { get; }
|
public ulong CPUAffinity = 0;
|
||||||
|
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
List<Game> InactiveGames = new List<Game>();
|
List<Game> inactiveGames = new List<Game>();
|
||||||
int missedTicks = 0;
|
int missedTicks = 0;
|
||||||
|
|
||||||
Thread.BeginThreadAffinity();
|
Thread.BeginThreadAffinity();
|
||||||
@ -45,15 +51,15 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Stopwatch _tickWatch = new Stopwatch();
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
_tickWatch.Restart();
|
stopwatch.Restart();
|
||||||
|
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
foreach (var game in Games)
|
foreach (var game in Games)
|
||||||
{
|
{
|
||||||
if (!game.Working)
|
if (!game.Working)
|
||||||
InactiveGames.Add(game);
|
inactiveGames.Add(game);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!game.UpdateInProgress)
|
if (!game.UpdateInProgress)
|
||||||
@ -65,7 +71,11 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
{
|
{
|
||||||
game.Update();
|
game.Update();
|
||||||
}
|
}
|
||||||
catch { }
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.ErrorException(ex, "Error in Game.Update()");
|
||||||
|
}
|
||||||
|
|
||||||
game.MissedTicks = 0;
|
game.MissedTicks = 0;
|
||||||
game.UpdateInProgress = false;
|
game.UpdateInProgress = false;
|
||||||
});
|
});
|
||||||
@ -73,25 +83,33 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
game.MissedTicks += 6;
|
game.MissedTicks += 6;
|
||||||
}
|
if (game.MissedTicks > 60)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var game in InactiveGames)
|
|
||||||
Games.Remove(game);
|
|
||||||
|
|
||||||
InactiveGames.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
_tickWatch.Stop();
|
|
||||||
|
|
||||||
var compensation = (int)(100 - _tickWatch.ElapsedMilliseconds); // the compensation value we need to sleep in order to get consistent 100 ms Game.Update().
|
|
||||||
|
|
||||||
if (_tickWatch.ElapsedMilliseconds > 100)
|
|
||||||
{
|
{
|
||||||
Logger.Trace("Game.Update() took [{0}ms] more than Game.UpdateFrequency [{1}ms].", _tickWatch.ElapsedMilliseconds, 100);
|
Logger.Warn("Game.Update() is running too slow. GameId: {0}", game.GameId);
|
||||||
compensation = (int)(100 - (_tickWatch.ElapsedMilliseconds % 100));
|
game.MissedTicks = 0;
|
||||||
missedTicks = 6 * (int)(_tickWatch.ElapsedMilliseconds / 100);
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var game in inactiveGames)
|
||||||
|
{
|
||||||
|
game.Working = false;
|
||||||
|
Games.Remove(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
inactiveGames.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
stopwatch.Stop();
|
||||||
|
|
||||||
|
var compensation = (int)(100 - stopwatch.ElapsedMilliseconds); // the compensation value we need to sleep in order to get consistent 100 ms Game.Update().
|
||||||
|
|
||||||
|
if (stopwatch.ElapsedMilliseconds > 100)
|
||||||
|
{
|
||||||
|
Logger.Trace("Game.Update() took [{0}ms] more than Game.UpdateFrequency [{1}ms].", stopwatch.ElapsedMilliseconds, 100);
|
||||||
|
compensation = (int)(100 - (stopwatch.ElapsedMilliseconds % 100));
|
||||||
|
missedTicks = 6 * (int)(stopwatch.ElapsedMilliseconds / 100);
|
||||||
Thread.Sleep(Math.Max(0, compensation)); // sleep until next Update().
|
Thread.Sleep(Math.Max(0, compensation)); // sleep until next Update().
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -360,7 +360,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
|||||||
{
|
{
|
||||||
player.World.SpawnRandomEquip(player, player, LootManager.Epic, player.Attributes[GameAttributes.Level]);
|
player.World.SpawnRandomEquip(player, player, LootManager.Epic, player.Attributes[GameAttributes.Level]);
|
||||||
}
|
}
|
||||||
var toon = player.Toon.DBToon;
|
var toon = player.Toon.DbToon;
|
||||||
toon.EventsCompleted++;
|
toon.EventsCompleted++;
|
||||||
Game.GameDbSession.SessionUpdate(toon);
|
Game.GameDbSession.SessionUpdate(toon);
|
||||||
player.CheckQuestCriteria(Game.CurrentSideQuest);
|
player.CheckQuestCriteria(Game.CurrentSideQuest);
|
||||||
@ -850,7 +850,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
|
|||||||
{
|
{
|
||||||
var questHistory = new DBQuestHistory
|
var questHistory = new DBQuestHistory
|
||||||
{
|
{
|
||||||
DBToon = player.Toon.DBToon,
|
DBToon = player.Toon.DbToon,
|
||||||
QuestId = Game.CurrentQuest,
|
QuestId = Game.CurrentQuest,
|
||||||
QuestStep = Game.CurrentStep
|
QuestStep = Game.CurrentStep
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2295,7 +2295,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gizmoLocations.Count > 0 && world.Game.MonsterLevel >= Program.MaxLevel && FastRandom.Instance.Next(100) < 30)
|
if (gizmoLocations.Count > 0 && world.Game.MonsterLevel >= Program.MAX_LEVEL && FastRandom.Instance.Next(100) < 30)
|
||||||
{
|
{
|
||||||
var handleChest = new SNOHandle(96993); //leg chest
|
var handleChest = new SNOHandle(96993); //leg chest
|
||||||
if (handleChest == null) continue;
|
if (handleChest == null) continue;
|
||||||
|
|||||||
@ -1353,7 +1353,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
|
|||||||
player.Attributes[GameAttributes.Buff_Icon_Count0, powerId] = activated ? 0 : 1;
|
player.Attributes[GameAttributes.Buff_Icon_Count0, powerId] = activated ? 0 : 1;
|
||||||
player.Attributes.BroadcastChangedIfRevealed();
|
player.Attributes.BroadcastChangedIfRevealed();
|
||||||
player.Inventory.SendVisualInventory(player);
|
player.Inventory.SendVisualInventory(player);
|
||||||
var dbToon = player.Toon.DBToon;
|
var dbToon = player.Toon.DbToon;
|
||||||
dbToon.WingsActive = player.CurrentWingsPowerId;
|
dbToon.WingsActive = player.CurrentWingsPowerId;
|
||||||
player.World.Game.GameDbSession.SessionUpdate(dbToon);
|
player.World.Game.GameDbSession.SessionUpdate(dbToon);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -868,7 +868,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
|
|||||||
player.GroundItems[item.GlobalID] = item;
|
player.GroundItems[item.GlobalID] = item;
|
||||||
DropItem(source, null, item);
|
DropItem(source, null, item);
|
||||||
|
|
||||||
if (source.Attributes[GameAttributes.Level] >= Program.MaxLevel)
|
if (source.Attributes[GameAttributes.Level] >= Program.MAX_LEVEL)
|
||||||
{
|
{
|
||||||
item = ItemGenerator.GenerateRandomCraftItem(player, 35);
|
item = ItemGenerator.GenerateRandomCraftItem(player, 35);
|
||||||
if (item == null) return;
|
if (item == null) return;
|
||||||
|
|||||||
@ -65,7 +65,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
// If there is no matching childnode, there must be one with -1 which only combines all class specific into one
|
// If there is no matching childnode, there must be one with -1 which only combines all class specific into one
|
||||||
private int GetDuration()
|
private int GetDuration()
|
||||||
{
|
{
|
||||||
var node = currentLineNode.ChildNodes.FirstOrDefault(a => a.ClassFilter == player.Toon.VoiceClassID);
|
var node = currentLineNode.ChildNodes.FirstOrDefault(a => a.ClassFilter == player.Toon.VoiceClassId);
|
||||||
node ??= currentLineNode.ChildNodes.FirstOrDefault(a => a.ClassFilter == -1);
|
node ??= currentLineNode.ChildNodes.FirstOrDefault(a => a.ClassFilter == -1);
|
||||||
|
|
||||||
if (node == null)
|
if (node == null)
|
||||||
@ -74,7 +74,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
return node.CompressedDisplayTimes[(int)manager.ClientLanguage]
|
return node.CompressedDisplayTimes[(int)manager.ClientLanguage]
|
||||||
.Languages[player.Toon.VoiceClassID * 2 + (player.Toon.Gender == 0 ? 0 : 1)];
|
.Languages[player.Toon.VoiceClassId * 2 + (player.Toon.Gender == 0 ? 0 : 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// This returns the dynamicID of other conversation partners. The client uses its position to identify where you can hear the conversation.
|
// This returns the dynamicID of other conversation partners. The client uses its position to identify where you can hear the conversation.
|
||||||
@ -573,10 +573,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
LineID = currentLineNode.LineID,
|
LineID = currentLineNode.LineID,
|
||||||
Speaker = currentLineNode.LineSpeaker,
|
Speaker = currentLineNode.LineSpeaker,
|
||||||
LineGender = -1,
|
LineGender = -1,
|
||||||
AudioClass = (GameBalance.Class)player.Toon.VoiceClassID,
|
AudioClass = (GameBalance.Class)player.Toon.VoiceClassId,
|
||||||
Gender = (player.Toon.Gender == 0) ? VoiceGender.Male : VoiceGender.Female,
|
Gender = (player.Toon.Gender == 0) ? VoiceGender.Male : VoiceGender.Female,
|
||||||
TextClass = currentLineNode.LineSpeaker == Speaker.Player
|
TextClass = currentLineNode.LineSpeaker == Speaker.Player
|
||||||
? (GameBalance.Class)player.Toon.VoiceClassID
|
? (GameBalance.Class)player.Toon.VoiceClassId
|
||||||
: GameBalance.Class.None,
|
: GameBalance.Class.None,
|
||||||
SNOSpeakerActor = (int)GetSpeaker(currentLineNode.LineSpeaker).SNO,
|
SNOSpeakerActor = (int)GetSpeaker(currentLineNode.LineSpeaker).SNO,
|
||||||
LineFlags = 0x00000000,
|
LineFlags = 0x00000000,
|
||||||
|
|||||||
@ -1043,7 +1043,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
item.Owner = _owner;
|
item.Owner = _owner;
|
||||||
|
|
||||||
InventoryGrid targetGrid = (msg.InvLoc.EquipmentSlot == (int)EquipmentSlotId.Stash) ? _stashGrid : _inventoryGrid;
|
InventoryGrid targetGrid = (msg.InvLoc.EquipmentSlot == (int)EquipmentSlotId.Stash) ? _stashGrid : _inventoryGrid;
|
||||||
SaveItemToDB(_owner.Toon.GameAccount.DBGameAccount, _owner.Toon.DBToon, EquipmentSlotId.Inventory, item);
|
SaveItemToDB(_owner.Toon.GameAccount.DBGameAccount, _owner.Toon.DbToon, EquipmentSlotId.Inventory, item);
|
||||||
ChangeItemLocationDB(msg.InvLoc.Column, msg.InvLoc.Row, item);
|
ChangeItemLocationDB(msg.InvLoc.Column, msg.InvLoc.Row, item);
|
||||||
item.UpdateStackCount(amount);
|
item.UpdateStackCount(amount);
|
||||||
targetGrid.PlaceItem(item, msg.InvLoc.Row, msg.InvLoc.Column);
|
targetGrid.PlaceItem(item, msg.InvLoc.Row, msg.InvLoc.Column);
|
||||||
@ -2579,7 +2579,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
|
|||||||
if (slotId == 15)
|
if (slotId == 15)
|
||||||
item.DBInventory.DBToon = null;
|
item.DBInventory.DBToon = null;
|
||||||
else
|
else
|
||||||
item.DBInventory.DBToon = (_owner as Player).Toon.DBToon;
|
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);
|
//Logger.Debug("ChangeItemSlotDB success, item dbid: {0}", item.DBInventory.Id);
|
||||||
|
|||||||
@ -223,9 +223,9 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
if (value == null)
|
if (value == null)
|
||||||
{
|
{
|
||||||
HirelingId = null;
|
HirelingId = null;
|
||||||
lock (Toon.DBToon)
|
lock (Toon.DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = Toon.DBToon;
|
var dbToon = Toon.DbToon;
|
||||||
dbToon.ActiveHireling = null;
|
dbToon.ActiveHireling = null;
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -233,9 +233,9 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
else if (value != _activeHireling)
|
else if (value != _activeHireling)
|
||||||
{
|
{
|
||||||
HirelingId = value.Attributes[GameAttributes.Hireling_Class];
|
HirelingId = value.Attributes[GameAttributes.Hireling_Class];
|
||||||
lock (Toon.DBToon)
|
lock (Toon.DbToon)
|
||||||
{
|
{
|
||||||
var dbToon = Toon.DBToon;
|
var dbToon = Toon.DbToon;
|
||||||
dbToon.ActiveHireling = value.Attributes[GameAttributes.Hireling_Class];
|
dbToon.ActiveHireling = value.Attributes[GameAttributes.Hireling_Class];
|
||||||
DBSessions.SessionUpdate(dbToon);
|
DBSessions.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
@ -294,10 +294,10 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
PlayerGroupIndex = InGameClient.Game.PlayerGroupIndexCounter;
|
PlayerGroupIndex = InGameClient.Game.PlayerGroupIndexCounter;
|
||||||
Toon = bnetToon;
|
Toon = bnetToon;
|
||||||
LevelingBoosted = Toon.LevelingBoosted;
|
LevelingBoosted = Toon.LevelingBoosted;
|
||||||
var dbToon = Toon.DBToon;
|
var dbToon = Toon.DbToon;
|
||||||
HirelingId = dbToon.ActiveHireling;
|
HirelingId = dbToon.ActiveHireling;
|
||||||
GBHandle.Type = (int)ActorType.Player;
|
GBHandle.Type = (int)ActorType.Player;
|
||||||
GBHandle.GBID = Toon.ClassID;
|
GBHandle.GBID = Toon.ClassId;
|
||||||
Level = dbToon.Level;
|
Level = dbToon.Level;
|
||||||
ParagonLevel = Toon.ParagonLevel;
|
ParagonLevel = Toon.ParagonLevel;
|
||||||
ExperienceNext = Toon.ExperienceNext;
|
ExperienceNext = Toon.ExperienceNext;
|
||||||
@ -357,7 +357,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
else if (InGameClient.Game.CurrentAct == 3000)
|
else if (InGameClient.Game.CurrentAct == 3000)
|
||||||
EnableStoneOfRecall();
|
EnableStoneOfRecall();
|
||||||
|
|
||||||
var lores = UnserializeBytes(Toon.DBToon.Lore);
|
var lores = UnserializeBytes(Toon.DbToon.Lore);
|
||||||
var num = 0;
|
var num = 0;
|
||||||
foreach (var lore in lores)
|
foreach (var lore in lores)
|
||||||
{
|
{
|
||||||
@ -1448,10 +1448,10 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
Attributes[GameAttributes.Casting_Speed] = 1f;
|
Attributes[GameAttributes.Casting_Speed] = 1f;
|
||||||
|
|
||||||
//Basic stats
|
//Basic stats
|
||||||
Attributes[GameAttributes.Level_Cap] = Program.MaxLevel;
|
Attributes[GameAttributes.Level_Cap] = Program.MAX_LEVEL;
|
||||||
Attributes[GameAttributes.Level] = Level;
|
Attributes[GameAttributes.Level] = Level;
|
||||||
Attributes[GameAttributes.Alt_Level] = ParagonLevel;
|
Attributes[GameAttributes.Alt_Level] = ParagonLevel;
|
||||||
if (Level == Program.MaxLevel)
|
if (Level == Program.MAX_LEVEL)
|
||||||
{
|
{
|
||||||
Attributes[GameAttributes.Alt_Experience_Next_Lo] = (int)(ExperienceNext % uint.MaxValue);
|
Attributes[GameAttributes.Alt_Experience_Next_Lo] = (int)(ExperienceNext % uint.MaxValue);
|
||||||
Attributes[GameAttributes.Alt_Experience_Next_Hi] = (int)(ExperienceNext / uint.MaxValue);
|
Attributes[GameAttributes.Alt_Experience_Next_Hi] = (int)(ExperienceNext / uint.MaxValue);
|
||||||
@ -2196,7 +2196,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
// message.Amount have the value send to add on attr of Paragon tabs.
|
// message.Amount have the value send to add on attr of Paragon tabs.
|
||||||
ParagonBonuses[bonus.Category * 4 + bonus.Index - 1] += (ushort)message.Amount;
|
ParagonBonuses[bonus.Category * 4 + bonus.Index - 1] += (ushort)message.Amount;
|
||||||
|
|
||||||
var dbToon = Toon.DBToon;
|
var dbToon = Toon.DbToon;
|
||||||
dbToon.ParagonBonuses = ParagonBonuses;
|
dbToon.ParagonBonuses = ParagonBonuses;
|
||||||
World.Game.GameDbSession.SessionUpdate(dbToon);
|
World.Game.GameDbSession.SessionUpdate(dbToon);
|
||||||
|
|
||||||
@ -2214,7 +2214,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
{
|
{
|
||||||
ParagonBonuses = new ushort[]
|
ParagonBonuses = new ushort[]
|
||||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
var dbToon = Toon.DBToon;
|
var dbToon = Toon.DbToon;
|
||||||
dbToon.ParagonBonuses = ParagonBonuses;
|
dbToon.ParagonBonuses = ParagonBonuses;
|
||||||
World.Game.GameDbSession.SessionUpdate(dbToon);
|
World.Game.GameDbSession.SessionUpdate(dbToon);
|
||||||
|
|
||||||
@ -2902,7 +2902,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
//*/
|
//*/
|
||||||
private void OnEquipPotion(GameClient client, ChangeUsableItemMessage message)
|
private void OnEquipPotion(GameClient client, ChangeUsableItemMessage message)
|
||||||
{
|
{
|
||||||
var activeSkills = Toon.DBActiveSkills;
|
var activeSkills = Toon.DbActiveSkills;
|
||||||
activeSkills.PotionGBID = message.Field1;
|
activeSkills.PotionGBID = message.Field1;
|
||||||
World.Game.GameDbSession.SessionUpdate(activeSkills);
|
World.Game.GameDbSession.SessionUpdate(activeSkills);
|
||||||
}
|
}
|
||||||
@ -4225,7 +4225,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
serialized += Inventory.GetItemBonus(GameAttributes.Armor_Item).ToString("F0");
|
serialized += Inventory.GetItemBonus(GameAttributes.Armor_Item).ToString("F0");
|
||||||
serialized += ";";
|
serialized += ";";
|
||||||
serialized += totalDamage.ToString("F0");
|
serialized += totalDamage.ToString("F0");
|
||||||
var dbStats = Toon.DBToon;
|
var dbStats = Toon.DbToon;
|
||||||
dbStats.Stats = serialized;
|
dbStats.Stats = serialized;
|
||||||
World.Game.GameDbSession.SessionUpdate(dbStats);
|
World.Game.GameDbSession.SessionUpdate(dbStats);
|
||||||
}
|
}
|
||||||
@ -4322,7 +4322,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
bonusSet.Claimed = true;
|
bonusSet.Claimed = true;
|
||||||
bonusSet.ClaimedToon = Toon.DBToon;
|
bonusSet.ClaimedToon = Toon.DbToon;
|
||||||
}
|
}
|
||||||
|
|
||||||
//BonusSetsList.CollectionEditions[bonusSet.SetId].Claim(this);
|
//BonusSetsList.CollectionEditions[bonusSet.SetId].Claim(this);
|
||||||
@ -4529,8 +4529,8 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
foreach (var mail in mailData)
|
foreach (var mail in mailData)
|
||||||
{
|
{
|
||||||
var mailRow = D3.Items.Mail.CreateBuilder()
|
var mailRow = D3.Items.Mail.CreateBuilder()
|
||||||
.SetAccountTo(Toon.D3EntityID)
|
.SetAccountTo(Toon.D3EntityId)
|
||||||
.SetAccountFrom(Toon.D3EntityID)
|
.SetAccountFrom(Toon.D3EntityId)
|
||||||
.SetMailId(mail.Id)
|
.SetMailId(mail.Id)
|
||||||
.SetTitle(mail.Title)
|
.SetTitle(mail.Title)
|
||||||
.SetBody(mail.Body);
|
.SetBody(mail.Body);
|
||||||
@ -5983,7 +5983,7 @@ public class Player : Actor, IMessageConsumer, IUpdateable
|
|||||||
LearnedLore.Count++; // Count
|
LearnedLore.Count++; // Count
|
||||||
UpdateHeroState();
|
UpdateHeroState();
|
||||||
Logger.Trace("Learning lore #{0}", loreSNOId);
|
Logger.Trace("Learning lore #{0}", loreSNOId);
|
||||||
var dbToon = Toon.DBToon;
|
var dbToon = Toon.DbToon;
|
||||||
dbToon.Lore = SerializeBytes(LearnedLore.m_snoLoreLearned.Take(LearnedLore.Count).ToList());
|
dbToon.Lore = SerializeBytes(LearnedLore.m_snoLoreLearned.Take(LearnedLore.Count).ToList());
|
||||||
World.Game.GameDbSession.SessionUpdate(dbToon);
|
World.Game.GameDbSession.SessionUpdate(dbToon);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Quest;
|
|||||||
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.World;
|
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.World;
|
||||||
using DiIiS_NA.GameServer.MessageSystem.Message.Fields;
|
using DiIiS_NA.GameServer.MessageSystem.Message.Fields;
|
||||||
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
|
||||||
|
using static DiIiS_NA.Core.MPQ.FileFormats.Monster.MonsterType;
|
||||||
namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
||||||
{
|
{
|
||||||
public class DeathPayload : Payload
|
public class DeathPayload : Payload
|
||||||
@ -124,7 +124,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Target is Minion { Master: Player masterPlr2 }
|
if (Target is Minion { Master: Player masterPlr2 }
|
||||||
and (BaseGolem or IceGolem or BoneGolem or DecayGolem or ConsumeFleshGolem or BloodGolem))
|
and (BaseGolem or IceGolem or BoneGolem or DecayGolem or ConsumeFleshGolem or DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions.BloodGolem))
|
||||||
{
|
{
|
||||||
masterPlr2.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Pet.PetDetachMessage()
|
masterPlr2.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Pet.PetDetachMessage()
|
||||||
{
|
{
|
||||||
@ -445,7 +445,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
|||||||
{
|
{
|
||||||
if (rangedPlayer.Toon.Class == ToonClass.DemonHunter)
|
if (rangedPlayer.Toon.Class == ToonClass.DemonHunter)
|
||||||
{
|
{
|
||||||
if (monster.MonsterType == (int)DiIiS_NA.Core.MPQ.FileFormats.Monster.MonsterType.Demon)
|
if (monster.MonsterTypeValue == (int)DiIiS_NA.Core.MPQ.FileFormats.Monster.MonsterType.Demon)
|
||||||
rangedPlayer.AddAchievementCounter(74987243307065, 1);
|
rangedPlayer.AddAchievementCounter(74987243307065, 1);
|
||||||
|
|
||||||
if (PowerMath.Distance2D(rangedPlayer.Position, monster.Position) >= 45f)
|
if (PowerMath.Distance2D(rangedPlayer.Position, monster.Position) >= 45f)
|
||||||
@ -1224,7 +1224,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
|||||||
if (player.World.Game.IsHardcore)
|
if (player.World.Game.IsHardcore)
|
||||||
{
|
{
|
||||||
player.AddTimedAction(3f, (_) => player.Revive(player.CheckPointPosition));
|
player.AddTimedAction(3f, (_) => player.Revive(player.CheckPointPosition));
|
||||||
var toon = player.Toon.DBToon;
|
var toon = player.Toon.DbToon;
|
||||||
toon.Deaths++;
|
toon.Deaths++;
|
||||||
player.World.Game.GameDbSession.SessionUpdate(toon);
|
player.World.Game.GameDbSession.SessionUpdate(toon);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -376,7 +376,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
|||||||
|
|
||||||
if (Target is Monster monster)
|
if (Target is Monster monster)
|
||||||
{
|
{
|
||||||
TotalDamage *= 1 + plr.Attributes[GameAttributes.Damage_Percent_Bonus_Vs_Monster_Type, monster.MonsterType];
|
TotalDamage *= 1 + plr.Attributes[GameAttributes.Damage_Percent_Bonus_Vs_Monster_Type, monster.MonsterTypeValue];
|
||||||
|
|
||||||
if (monster.Quality > 0)
|
if (monster.Quality > 0)
|
||||||
TotalDamage *= 1 + plr.Attributes[GameAttributes.Damage_Percent_Bonus_Vs_Elites];
|
TotalDamage *= 1 + plr.Attributes[GameAttributes.Damage_Percent_Bonus_Vs_Elites];
|
||||||
|
|||||||
@ -26,7 +26,7 @@ namespace DiIiS_NA.GameServer.GSSystem.SkillsSystem
|
|||||||
ToonClass = toonClass;
|
ToonClass = toonClass;
|
||||||
Player = player;
|
Player = player;
|
||||||
// var dbToon = player.Toon.DBToon;
|
// var dbToon = player.Toon.DBToon;
|
||||||
var dbActiveSkills = player.Toon.DBActiveSkills;
|
var dbActiveSkills = player.Toon.DbActiveSkills;
|
||||||
ActiveSkills = new ActiveSkillSavedData[6]
|
ActiveSkills = new ActiveSkillSavedData[6]
|
||||||
{
|
{
|
||||||
new()
|
new()
|
||||||
@ -82,7 +82,7 @@ namespace DiIiS_NA.GameServer.GSSystem.SkillsSystem
|
|||||||
public void UpdateSkills(int hotBarIndex, int SNOSkill, int SNORune, Toon toon)
|
public void UpdateSkills(int hotBarIndex, int SNOSkill, int SNORune, Toon toon)
|
||||||
{
|
{
|
||||||
Logger.MethodTrace(string.Format("Update index {0} skill {1} rune {2}", hotBarIndex, SNOSkill, SNORune));
|
Logger.MethodTrace(string.Format("Update index {0} skill {1} rune {2}", hotBarIndex, SNOSkill, SNORune));
|
||||||
var dbActiveSkills = Player.Toon.DBActiveSkills;
|
var dbActiveSkills = Player.Toon.DbActiveSkills;
|
||||||
switch (hotBarIndex)
|
switch (hotBarIndex)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -127,7 +127,7 @@ namespace DiIiS_NA.GameServer.GSSystem.SkillsSystem
|
|||||||
public void UpdatePassiveSkills(Toon toon)
|
public void UpdatePassiveSkills(Toon toon)
|
||||||
{
|
{
|
||||||
Logger.Debug("Update passive to {0} {1} {2} {3}", PassiveSkills[0], PassiveSkills[1], PassiveSkills[2], PassiveSkills[3]);
|
Logger.Debug("Update passive to {0} {1} {2} {3}", PassiveSkills[0], PassiveSkills[1], PassiveSkills[2], PassiveSkills[3]);
|
||||||
var dbActiveSkills = Player.Toon.DBActiveSkills;
|
var dbActiveSkills = Player.Toon.DbActiveSkills;
|
||||||
dbActiveSkills.Passive0 = PassiveSkills[0];
|
dbActiveSkills.Passive0 = PassiveSkills[0];
|
||||||
dbActiveSkills.Passive1 = PassiveSkills[1];
|
dbActiveSkills.Passive1 = PassiveSkills[1];
|
||||||
dbActiveSkills.Passive2 = PassiveSkills[2];
|
dbActiveSkills.Passive2 = PassiveSkills[2];
|
||||||
|
|||||||
@ -56,12 +56,18 @@ public class MonsterConfig
|
|||||||
public float AttacksPerSecond { get; set; } = 1.2f;
|
public float AttacksPerSecond { get; set; } = 1.2f;
|
||||||
|
|
||||||
public float HealthMultiplier { get; set; } = 1;
|
public float HealthMultiplier { get; set; } = 1;
|
||||||
|
public float HealthBonusMultiplier { get; set; } = 1;
|
||||||
public float DamageMultiplier { get; set; } = 1;
|
public float DamageMultiplier { get; set; } = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attack target range
|
/// Attack target range
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float LookupRange { get; set; } = 50f;
|
public float LookupRange { get; set; } = 80f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Total health bonus multiplier that can be applied to a monster
|
||||||
|
/// </summary>
|
||||||
|
public float HealthBonusMultiplierCap { get; set; } = 1.025f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class QuestConfig
|
public class QuestConfig
|
||||||
|
|||||||
@ -48,12 +48,12 @@ namespace DiIiS_NA
|
|||||||
}
|
}
|
||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
private static readonly Logger Logger = LogManager.CreateLogger("BZ.Net");
|
private static readonly Logger Logger = LogManager.CreateLogger("Blizzless");
|
||||||
public static readonly DateTime StartupTime = DateTime.Now;
|
public static readonly DateTime StartupTime = DateTime.Now;
|
||||||
public static BattleBackend BattleBackend { get; set; }
|
public static BattleBackend BattleBackend { get; set; }
|
||||||
public bool GameServersAvailable = true;
|
public bool GameServersAvailable = true;
|
||||||
|
|
||||||
public const int MaxLevel = 70;
|
public const int MAX_LEVEL = 70;
|
||||||
|
|
||||||
public static GameServer.ClientSystem.GameServer GameServer;
|
public static GameServer.ClientSystem.GameServer GameServer;
|
||||||
public static Watchdog Watchdog;
|
public static Watchdog Watchdog;
|
||||||
@ -66,10 +66,10 @@ namespace DiIiS_NA
|
|||||||
public static string RestServerIp = RestConfig.Instance.IP;
|
public static string RestServerIp = RestConfig.Instance.IP;
|
||||||
public static string PublicGameServerIp = DiIiS_NA.GameServer.NATConfig.Instance.PublicIP;
|
public static string PublicGameServerIp = DiIiS_NA.GameServer.NATConfig.Instance.PublicIP;
|
||||||
|
|
||||||
public const int Build = 30;
|
public const int BUILD = 30;
|
||||||
public const int Stage = 3;
|
public const int STAGE = 3;
|
||||||
public static TypeBuildEnum TypeBuild => TypeBuildEnum.Beta;
|
public static TypeBuildEnum TypeBuild => TypeBuildEnum.Beta;
|
||||||
private static bool DiabloCoreEnabled = DiIiS_NA.GameServer.GameServerConfig.Instance.CoreActive;
|
private static bool _diabloCoreEnabled = DiIiS_NA.GameServer.GameServerConfig.Instance.CoreActive;
|
||||||
|
|
||||||
private static readonly CancellationTokenSource CancellationTokenSource = new();
|
private static readonly CancellationTokenSource CancellationTokenSource = new();
|
||||||
public static readonly CancellationToken Token = CancellationTokenSource.Token;
|
public static readonly CancellationToken Token = CancellationTokenSource.Token;
|
||||||
@ -84,8 +84,8 @@ namespace DiIiS_NA
|
|||||||
void RightTextRule(string text, string ruleStyle) => AnsiConsole.Write(new Rule(text).RuleStyle(ruleStyle));
|
void RightTextRule(string text, string ruleStyle) => AnsiConsole.Write(new Rule(text).RuleStyle(ruleStyle));
|
||||||
string Url(string url) => $"[link={url}]{url}[/]";
|
string Url(string url) => $"[link={url}]{url}[/]";
|
||||||
RightTextRule("[dodgerblue1]Blizz[/][deepskyblue2]less[/]", "steelblue1");
|
RightTextRule("[dodgerblue1]Blizz[/][deepskyblue2]less[/]", "steelblue1");
|
||||||
RightTextRule($"[dodgerblue3]Build [/][deepskyblue3]{Build}[/]", "steelblue1_1");
|
RightTextRule($"[dodgerblue3]Build [/][deepskyblue3]{BUILD}[/]", "steelblue1_1");
|
||||||
RightTextRule($"[dodgerblue3]Stage [/][deepskyblue3]{Stage}[/]", "steelblue1_1");
|
RightTextRule($"[dodgerblue3]Stage [/][deepskyblue3]{STAGE}[/]", "steelblue1_1");
|
||||||
RightTextRule($"[deepskyblue3]{TypeBuild}[/]", "steelblue1_1");
|
RightTextRule($"[deepskyblue3]{TypeBuild}[/]", "steelblue1_1");
|
||||||
RightTextRule($"Diablo III [red]RoS 2.7.4.84161[/] - {Url("https://github.com/blizzless/blizzless-diiis")}",
|
RightTextRule($"Diablo III [red]RoS 2.7.4.84161[/] - {Url("https://github.com/blizzless/blizzless-diiis")}",
|
||||||
"red");
|
"red");
|
||||||
@ -100,14 +100,14 @@ namespace DiIiS_NA
|
|||||||
DbProviderFactories.RegisterFactory("Npgsql", NpgsqlFactory.Instance);
|
DbProviderFactories.RegisterFactory("Npgsql", NpgsqlFactory.Instance);
|
||||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||||
|
|
||||||
string name = $"Blizzless: Build {Build}, Stage: {Stage} - {TypeBuild}";
|
string name = $"Blizzless: Build {BUILD}, Stage: {STAGE} - {TypeBuild}";
|
||||||
SetTitle(name);
|
SetTitle(name);
|
||||||
if (LogConfig.Instance.Targets.Any(x => x.MaximizeWhenEnabled && x.Enabled))
|
if (LogConfig.Instance.Targets.Any(x => x.MaximizeWhenEnabled && x.Enabled))
|
||||||
Maximize();
|
Maximize();
|
||||||
WriteBanner();
|
WriteBanner();
|
||||||
InitLoggers();
|
InitLoggers();
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
DiabloCoreEnabled = true;
|
_diabloCoreEnabled = true;
|
||||||
Logger.Info("Forcing Diablo III Core to be $[green]$enabled$[/]$ on debug mode.");
|
Logger.Info("Forcing Diablo III Core to be $[green]$enabled$[/]$ on debug mode.");
|
||||||
#else
|
#else
|
||||||
if (!DiabloCoreEnabled)
|
if (!DiabloCoreEnabled)
|
||||||
@ -208,7 +208,7 @@ namespace DiIiS_NA
|
|||||||
GuildManager.PreLoadGuilds();
|
GuildManager.PreLoadGuilds();
|
||||||
|
|
||||||
Logger.Info("Loading Diablo III - Core...");
|
Logger.Info("Loading Diablo III - Core...");
|
||||||
if (DiabloCoreEnabled)
|
if (_diabloCoreEnabled)
|
||||||
{
|
{
|
||||||
if (!MPQStorage.Initialized)
|
if (!MPQStorage.Initialized)
|
||||||
{
|
{
|
||||||
@ -241,7 +241,7 @@ namespace DiIiS_NA
|
|||||||
BattleBackend = new BattleBackend(loginConfig.BindIP, loginConfig.WebPort);
|
BattleBackend = new BattleBackend(loginConfig.BindIP, loginConfig.WebPort);
|
||||||
|
|
||||||
//Diablo 3 Game-Server
|
//Diablo 3 Game-Server
|
||||||
if (DiabloCoreEnabled)
|
if (_diabloCoreEnabled)
|
||||||
StartGameServer();
|
StartGameServer();
|
||||||
else Logger.Fatal("Game server is disabled in the configs.");
|
else Logger.Fatal("Game server is disabled in the configs.");
|
||||||
|
|
||||||
@ -385,28 +385,17 @@ namespace DiIiS_NA
|
|||||||
if (!targetConfig.Enabled)
|
if (!targetConfig.Enabled)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LogTarget target = null;
|
LogTarget target = targetConfig.Target.ToLower() switch
|
||||||
switch (targetConfig.Target.ToLower())
|
|
||||||
{
|
{
|
||||||
case "ansi":
|
"ansi" => new AnsiTarget(targetConfig.MinimumLevel, targetConfig.MaximumLevel,
|
||||||
target = new AnsiTarget(
|
targetConfig.IncludeTimeStamps, targetConfig.TimeStampFormat),
|
||||||
targetConfig.MinimumLevel,
|
"console" => new ConsoleTarget(targetConfig.MinimumLevel, targetConfig.MaximumLevel,
|
||||||
targetConfig.MaximumLevel,
|
targetConfig.IncludeTimeStamps, targetConfig.TimeStampFormat),
|
||||||
targetConfig.IncludeTimeStamps,
|
"file" => new FileTarget(targetConfig.FileName, targetConfig.MinimumLevel,
|
||||||
targetConfig.TimeStampFormat);
|
targetConfig.MaximumLevel, targetConfig.IncludeTimeStamps, targetConfig.TimeStampFormat,
|
||||||
break;
|
targetConfig.ResetOnStartup),
|
||||||
case "console":
|
_ => null
|
||||||
target = new ConsoleTarget(targetConfig.MinimumLevel, targetConfig.MaximumLevel,
|
};
|
||||||
targetConfig.IncludeTimeStamps,
|
|
||||||
targetConfig.TimeStampFormat);
|
|
||||||
break;
|
|
||||||
case "file":
|
|
||||||
target = new FileTarget(targetConfig.FileName, targetConfig.MinimumLevel,
|
|
||||||
targetConfig.MaximumLevel, targetConfig.IncludeTimeStamps,
|
|
||||||
targetConfig.TimeStampFormat,
|
|
||||||
targetConfig.ResetOnStartup);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target != null)
|
if (target != null)
|
||||||
LogManager.AttachLogTarget(target);
|
LogManager.AttachLogTarget(target);
|
||||||
@ -464,7 +453,6 @@ namespace DiIiS_NA
|
|||||||
const int RESTORE = 9;
|
const int RESTORE = 9;
|
||||||
private static void Maximize()
|
private static void Maximize()
|
||||||
{
|
{
|
||||||
// if it's running on windows
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||||
|
|||||||
@ -136,9 +136,7 @@ namespace DiIiS_NA.REST.Extensions
|
|||||||
|
|
||||||
public static void Swap<T>(ref T left, ref T right)
|
public static void Swap<T>(ref T left, ref T right)
|
||||||
{
|
{
|
||||||
T temp = left;
|
(left, right) = (right, left);
|
||||||
left = right;
|
|
||||||
right = temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Strings
|
#region Strings
|
||||||
|
|||||||
@ -88,7 +88,7 @@ namespace DiIiS_NA.REST
|
|||||||
void HandleInfoRequest(HttpHeader request)
|
void HandleInfoRequest(HttpHeader request)
|
||||||
{
|
{
|
||||||
SendResponseHtml(HttpCode.OK, "Welcome to BlizzLess.Net" +
|
SendResponseHtml(HttpCode.OK, "Welcome to BlizzLess.Net" +
|
||||||
"\nBuild " + Program.Build +
|
"\nBuild " + Program.BUILD +
|
||||||
"\nSupport: 2.7.4");
|
"\nSupport: 2.7.4");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Enabled = true
|
|||||||
; IP address on which the server will be bound
|
; IP address on which the server will be bound
|
||||||
BindIP = 127.0.0.1
|
BindIP = 127.0.0.1
|
||||||
; Port for web interactions
|
; Port for web interactions
|
||||||
WebPort = 9800
|
WebPort = 83
|
||||||
; Port for the server
|
; Port for the server
|
||||||
Port = 1119
|
Port = 1119
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ MotdRemoteUrl = https://your-site.local/yourmotd
|
|||||||
[REST]
|
[REST]
|
||||||
IP = 127.0.0.1
|
IP = 127.0.0.1
|
||||||
PublicIP = 127.0.0.1
|
PublicIP = 127.0.0.1
|
||||||
PORT = 80
|
PORT = 83
|
||||||
Public = true
|
Public = true
|
||||||
|
|
||||||
; Game Server Settings
|
; Game Server Settings
|
||||||
@ -49,7 +49,7 @@ CoreActive = true
|
|||||||
; IP address on which the game server will be bound
|
; IP address on which the game server will be bound
|
||||||
BindIP = 127.0.0.1
|
BindIP = 127.0.0.1
|
||||||
; Port for web interactions
|
; Port for web interactions
|
||||||
WebPort = 9001
|
WebPort = 83
|
||||||
; Port for game server connections
|
; Port for game server connections
|
||||||
Port = 1345
|
Port = 1345
|
||||||
; IP address for IPv6 bindings
|
; IP address for IPv6 bindings
|
||||||
|
|||||||
Loading…
Reference in New Issue
user.block.title