From e4c559a7a2d9d1a4660777a0dfe903880253679c Mon Sep 17 00:00:00 2001 From: Pablito Date: Sun, 22 Jan 2023 15:42:11 -0300 Subject: [PATCH] Solve HellFire items bug (all items it's ok. --- db/initdb/dump.sql | 60 +- .../BGS-Server/AccountsSystem/GameAccount.cs | 657 +++++++++++++++--- .../AccountsSystem/GameAccountManager.cs | 47 +- src/DiIiS-NA/BGS-Server/Toons/Toon.cs | 292 ++------ .../AccountDataBase/Entities/DBGameAccount.cs | 46 +- .../AccountDataBase/Entities/DBToon.cs | 15 - .../Mapper/DBGameAccountMapper.cs | 49 +- .../AccountDataBase/Mapper/DBToonMapper.cs | 12 - .../GSSystem/GameSystem/QuestManager.cs | 6 +- .../GSSystem/ItemsSystem/Item.cs | 146 ++-- .../GSSystem/PlayerSystem/Inventory.cs | 152 ++-- .../GSSystem/PlayerSystem/Player.cs | 37 +- .../PowerSystem/Payloads/DeathPayload.cs | 2 +- 13 files changed, 945 insertions(+), 576 deletions(-) diff --git a/db/initdb/dump.sql b/db/initdb/dump.sql index 07a1025..e1b0df1 100644 --- a/db/initdb/dump.sql +++ b/db/initdb/dump.sql @@ -302,37 +302,75 @@ ALTER TABLE public.craft_data_seq OWNER TO postgres; CREATE TABLE public.game_accounts ( id bigint NOT NULL, dbaccount_id bigint, + lastonline bigint, + flags integer, banner bytea, uiprefs bytea, uisettings bytea, seentutorials bytea, bossprogress bytea, stashicons bytea, - lastonline bigint, - flags integer, paragonlevel integer, paragonlevelhardcore integer, experience integer, experiencehardcore integer, lastplayedhero_id bigint, gold bigint, - platinum integer, hardcoregold bigint, + platinum integer, + hardplatinum integer, rmtcurrency bigint, + hardrmtcurrency bigint, bloodshards integer, hardcorebloodshards integer, stashsize integer, hardcorestashsize integer, seasonstashsize integer, + hardseasonstashsize integer, eliteskilled bigint, totalkilled bigint, totalgold bigint, + hardtotalgold bigint, totalbloodshards integer, + hardtotalbloodshards integer, totalbounties integer DEFAULT 0 NOT NULL, totalbountieshardcore integer DEFAULT 0 NOT NULL, pvptotalkilled bigint, + hardpvptotalkilled bigint, pvptotalwins bigint, - pvptotalgold bigint + hardpvptotalwins bigint, + pvptotalgold bigint, + hardpvptotalgold bigint, + craftitem1 integer, + hardcraftitem1 integer, + craftitem2 integer, + hardcraftitem2 integer, + craftitem3 integer, + hardcraftitem3 integer, + craftitem4 integer, + hardcraftitem4 integer, + craftitem5 integer, + hardcraftitem5 integer, + vialofputridness integer, + hardvialofputridness integer, + idolofterror integer, + hardidolofterror integer, + heartoffright integer, + hardheartoffright integer, + leorikkey integer, + hardleorikkey integer, + bigportalkey integer, + hardbigportalkey integer, + horadrica1 integer, + hardhoradrica1 integer, + horadrica2 integer, + hardhoradrica2 integer, + horadrica3 integer, + hardhoradrica3 integer, + horadrica4 integer, + hardhoradrica4 integer, + horadrica5 integer, + hardhoradrica5 integer ); @@ -749,19 +787,7 @@ CREATE TABLE public.toons ( cosmetic1 integer, cosmetic2 integer, cosmetic3 integer, - cosmetic4 integer, - craftitem1 integer, - craftitem2 integer, - craftitem3 integer, - craftitem4 integer, - craftitem5 integer, - bigportalkey integer, - leorikkey integer, - horadrica1 integer, - horadrica2 integer, - horadrica3 integer, - horadrica4 integer, - horadrica5 integer + cosmetic4 integer ); diff --git a/src/DiIiS-NA/BGS-Server/AccountsSystem/GameAccount.cs b/src/DiIiS-NA/BGS-Server/AccountsSystem/GameAccount.cs index cd4b0d7..b0f7094 100644 --- a/src/DiIiS-NA/BGS-Server/AccountsSystem/GameAccount.cs +++ b/src/DiIiS-NA/BGS-Server/AccountsSystem/GameAccount.cs @@ -1,52 +1,46 @@ //Blizzless Project 2022 -//Blizzless Project 2022 +//Blizzless Project 2022 using System; -//Blizzless Project 2022 +//Blizzless Project 2022 using System.Collections.Generic; -//Blizzless Project 2022 +//Blizzless Project 2022 using System.Linq; -//Blizzless Project 2022 -using System.Text; -//Blizzless Project 2022 +//Blizzless Project 2022 using bgs.protocol.presence.v1; -//Blizzless Project 2022 +//Blizzless Project 2022 using D3.Account; -//Blizzless Project 2022 +//Blizzless Project 2022 using D3.Achievements; -//Blizzless Project 2022 +//Blizzless Project 2022 using D3.Client; -//Blizzless Project 2022 +//Blizzless Project 2022 using D3.OnlineService; -//Blizzless Project 2022 +//Blizzless Project 2022 using D3.PartyMessage; -//Blizzless Project 2022 +//Blizzless Project 2022 using D3.Profile; -//Blizzless Project 2022 +//Blizzless Project 2022 using DiIiS_NA.Core.Extensions; -//Blizzless Project 2022 -using DiIiS_NA.Core.Helpers.Hash; -//Blizzless Project 2022 +//Blizzless Project 2022 using DiIiS_NA.Core.Storage; -//Blizzless Project 2022 +//Blizzless Project 2022 using DiIiS_NA.Core.Storage.AccountDataBase.Entities; -//Blizzless Project 2022 +//Blizzless Project 2022 using DiIiS_NA.LoginServer.Base; -//Blizzless Project 2022 +//Blizzless Project 2022 using DiIiS_NA.LoginServer.Battle; -//Blizzless Project 2022 +//Blizzless Project 2022 using DiIiS_NA.LoginServer.ChannelSystem; -//Blizzless Project 2022 +//Blizzless Project 2022 using DiIiS_NA.LoginServer.GuildSystem; -//Blizzless Project 2022 +//Blizzless Project 2022 using DiIiS_NA.LoginServer.Helpers; -//Blizzless Project 2022 +//Blizzless Project 2022 using DiIiS_NA.LoginServer.Objects; -//Blizzless Project 2022 +//Blizzless Project 2022 using DiIiS_NA.LoginServer.Toons; -//Blizzless Project 2022 +//Blizzless Project 2022 using Google.ProtocolBuffers; -//Blizzless Project 2022 -using static DiIiS_NA.LoginServer.Toons.Toon; namespace DiIiS_NA.LoginServer.AccountsSystem { @@ -397,87 +391,531 @@ namespace DiIiS_NA.LoginServer.AccountsSystem private ulong _currentToonId = 0; - public ulong Gold - { - get - { - return this.DBGameAccount.Gold; + public ulong Gold { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardcoreGold; + } + else { + return this.DBGameAccount.Gold; + } } - set - { - lock (this.DBGameAccount) - { - var dbGAcc = this.DBGameAccount; - dbGAcc.Gold = value; - DBSessions.SessionUpdate(dbGAcc); + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardcoreGold = value; + } + else { + dbGA.Gold = value; + } + DBSessions.SessionUpdate(dbGA); } } } - public ulong HardcoreGold - { - get - { - return this.DBGameAccount.HardcoreGold; + public int BloodShards { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardcoreBloodShards; + } + else { + return this.DBGameAccount.BloodShards; + } } - set - { - lock (this.DBGameAccount) - { - var dbGAcc = this.DBGameAccount; - dbGAcc.HardcoreGold = value; - DBSessions.SessionUpdate(dbGAcc); + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardcoreBloodShards = value; + } + else { + dbGA.BloodShards = value; + } + DBSessions.SessionUpdate(dbGA); } } } - public int BloodShards - { - get - { - return this.DBGameAccount.BloodShards; + public int TotalBloodShards { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardTotalBloodShards; + } + else { + return this.DBGameAccount.TotalBloodShards; + } } - set - { - lock (this.DBGameAccount) - { - var dbGAcc = this.DBGameAccount; - dbGAcc.BloodShards = value; - DBSessions.SessionUpdate(dbGAcc); + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardTotalBloodShards = value; + } + else { + dbGA.TotalBloodShards = value; + } + DBSessions.SessionUpdate(dbGA); } } } - public int HardcoreBloodShards - { - get - { - return this.DBGameAccount.HardcoreBloodShards; + public int StashSize { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardcoreStashSize; + } + else { + return this.DBGameAccount.StashSize; + } } - set - { - lock (this.DBGameAccount) - { - var dbGAcc = this.DBGameAccount; - dbGAcc.HardcoreBloodShards = value; - DBSessions.SessionUpdate(dbGAcc); + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardcoreStashSize = value; + } + else { + dbGA.StashSize = value; + } + DBSessions.SessionUpdate(dbGA); } } } - public int TotalBloodShards - { - get - { - return this.DBGameAccount.TotalBloodShards; + public int SeasonStashSize { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardSeasonStashSize; + } + else { + return this.DBGameAccount.SeasonStashSize; + } } - set - { - lock (this.DBGameAccount) - { - var dbGAcc = this.DBGameAccount; - dbGAcc.TotalBloodShards = value; - DBSessions.SessionUpdate(dbGAcc); + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardSeasonStashSize = value; + } + else { + dbGA.SeasonStashSize = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public ulong PvPTotalKilled { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardPvPTotalKilled; + } + else { + return this.DBGameAccount.PvPTotalKilled; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardPvPTotalKilled = value; + } + else { + dbGA.PvPTotalKilled = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public ulong PvPTotalWins { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardPvPTotalWins; + } + else { + return this.DBGameAccount.PvPTotalWins; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardPvPTotalWins = value; + } + else { + dbGA.PvPTotalWins = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public ulong PvPTotalGold { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardPvPTotalGold; + } + else { + return this.DBGameAccount.PvPTotalGold; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardPvPTotalGold = value; + } + else { + dbGA.PvPTotalGold = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int CraftItem1 { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardCraftItem1; + } + else { + return this.DBGameAccount.CraftItem1; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardCraftItem1 = value; + } + else { + dbGA.CraftItem1 = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int CraftItem2 { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardCraftItem2; + } + else { + return this.DBGameAccount.CraftItem2; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardCraftItem2 = value; + } + else { + dbGA.CraftItem2 = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int CraftItem3 { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardCraftItem3; + } + else { + return this.DBGameAccount.CraftItem3; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardCraftItem3 = value; + } + else { + dbGA.CraftItem3 = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int CraftItem4 { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardCraftItem4; + } + else { + return this.DBGameAccount.CraftItem4; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardCraftItem4 = value; + } + else { + dbGA.CraftItem4 = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int CraftItem5 { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardCraftItem5; + } + else { + return this.DBGameAccount.CraftItem5; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardCraftItem5 = value; + } + else { + dbGA.CraftItem5 = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int BigPortalKey { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardBigPortalKey; + } + else { + return this.DBGameAccount.BigPortalKey; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardBigPortalKey = value; + } + else { + dbGA.BigPortalKey = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int LeorikKey { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardLeorikKey; + } + else { + return this.DBGameAccount.LeorikKey; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardLeorikKey = value; + } + else { + dbGA.LeorikKey = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int VialofPutridness { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardVialofPutridness; + } + else { + return this.DBGameAccount.VialofPutridness; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardVialofPutridness = value; + } + else { + dbGA.VialofPutridness = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int IdolofTerror { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardIdolofTerror; + } + else { + return this.DBGameAccount.IdolofTerror; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardIdolofTerror = value; + } + else { + dbGA.IdolofTerror = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int HeartofFright { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardHeartofFright; + } + else { + return this.DBGameAccount.HeartofFright; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardHeartofFright = value; + } + else { + dbGA.HeartofFright = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int HoradricA1Res { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardHoradricA1; + } + else { + return this.DBGameAccount.HoradricA1; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardHoradricA1 = value; + } + else { + dbGA.HoradricA1 = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int HoradricA2Res { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardHoradricA2; + } + else { + return this.DBGameAccount.HoradricA2; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardHoradricA2 = value; + } + else { + dbGA.HoradricA2 = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int HoradricA3Res { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardHoradricA3; + } + else { + return this.DBGameAccount.HoradricA3; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardHoradricA3 = value; + } + else { + dbGA.HoradricA3 = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int HoradricA4Res { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardHoradricA4; + } + else { + return this.DBGameAccount.HoradricA4; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardHoradricA4 = value; + } + else { + dbGA.HoradricA4 = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } + + public int HoradricA5Res { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardHoradricA5; + } + else { + return this.DBGameAccount.HoradricA5; + } + } + set { + var dbGA = this.DBGameAccount; + lock (dbGA) { + if (this.CurrentToon.IsHardcore) { + dbGA.HardHoradricA5 = value; + } + else { + dbGA.HoradricA5 = value; + } + DBSessions.SessionUpdate(dbGA); } } } @@ -697,24 +1135,20 @@ namespace DiIiS_NA.LoginServer.AccountsSystem .SetBloodShardsCollected((uint)dbGAcc.TotalBloodShards) .SetSeasonId(1) .AddSeasons(1) - .SetElitesKilled(dbGAcc.ElitesKilled) - .SetGoldCollected(dbGAcc.TotalGold) //deprecated //.SetHighestDifficulty(Convert.ToUInt32(progress[0], 10)) .SetNumFallenHeroes(3) - .SetParagonLevelHardcore(0) // Уровень совершенства в гер. режиме - .SetBountiesCompleted((uint)dbGAcc.TotalBounties) //Выполнено поручений - .SetLootRunsCompleted(0) //Закрыто нефалемских порталов + .SetParagonLevelHardcore(0) // Level of perfection in ger mode + .SetBountiesCompleted((uint)dbGAcc.TotalBounties) // Executed orders + .SetLootRunsCompleted(0) // Closed by the Nephalemic Portals .SetPvpWins(0) .SetPvpTakedowns(0) .SetPvpDamage(0) - .SetMonstersKilled(dbGAcc.TotalKilled) //Убито монстров - .SetElitesKilled(this.DBGameAccount.ElitesKilled) //Убито особых противников - .SetGoldCollected(this.DBGameAccount.TotalGold) //Собрано золото - .SetHighestHardcoreLevel(0) // Максимальный уровень в гер. режиме - .SetHardcoreMonstersKilled(0) // Убито монстров в гер. режиме - + .SetMonstersKilled(dbGAcc.TotalKilled) // Killed monsters + .SetElitesKilled(dbGAcc.ElitesKilled) // Special Enemies Killed + .SetGoldCollected(dbGAcc.TotalGold) // Collected gold + .SetHighestHardcoreLevel(0) // Maximum level in hermetic mode + .SetHardcoreMonstersKilled(0) // Killed monsters in ger mode .SetHighestHardcoreLevel(GetHighestHardcoreLevel()) - .SetMonstersKilled(dbGAcc.TotalKilled) .SetClassBarbarian(GetClassInfo(ToonClass.Barbarian)) .SetClassCrusader(GetClassInfo(ToonClass.Crusader)) .SetClassDemonhunter(GetClassInfo(ToonClass.DemonHunter)) @@ -750,9 +1184,30 @@ namespace DiIiS_NA.LoginServer.AccountsSystem public static readonly EntityId AccountHasNoToons = EntityId.CreateBuilder().SetIdHigh(0).SetIdLow(0).Build(); + //Platinum - - public int Platinum { get { return this.DBGameAccount.Platinum; } set { lock (this.DBGameAccount) { var dbGA = this.DBGameAccount; dbGA.Platinum = value; DBSessions.SessionUpdate(dbGA); } } } + public int Platinum { + get { + if (this.CurrentToon.IsHardcore) { + return this.DBGameAccount.HardPlatinum; + } + else { + return this.DBGameAccount.Platinum; + } + } + set { + lock (this.DBGameAccount) { + var dbGA = this.DBGameAccount; + if (this.CurrentToon.IsHardcore) { + dbGA.HardPlatinum = value; + } + else { + dbGA.Platinum = value; + } + DBSessions.SessionUpdate(dbGA); + } + } + } public List Toons { diff --git a/src/DiIiS-NA/BGS-Server/AccountsSystem/GameAccountManager.cs b/src/DiIiS-NA/BGS-Server/AccountsSystem/GameAccountManager.cs index d6681ff..60d8436 100644 --- a/src/DiIiS-NA/BGS-Server/AccountsSystem/GameAccountManager.cs +++ b/src/DiIiS-NA/BGS-Server/AccountsSystem/GameAccountManager.cs @@ -81,24 +81,65 @@ namespace DiIiS_NA.LoginServer.AccountsSystem ParagonLevelHardcore = 0, Experience = 7200000, ExperienceHardcore = 7200000, - StashSize = 700, // Default stash sizes should be 70 with purchasable upgrades - HardcoreStashSize = 700, + StashSize = 700, // Default stash sizes should be 70 with purchasable upgrades. + HardcoreStashSize = 700, // Default stash sizes should be 70 with purchasable upgrades. SeasonStashSize = 700, + HardSeasonStashSize = 700, BloodShards = 0, HardcoreBloodShards = 0, BossProgress = new byte[] { 0xff, 0xff, 0xff, 0xff, 0xff }, SeenTutorials = new byte[] { 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, 0x00 }, StashIcons = new byte[] { 0x00, 0x00, 0x00, 0x00 }, RmtCurrency = 0, + HardRmtCurrency = 0, + Platinum = 0, + HardPlatinum = 0, Gold = 0, HardcoreGold = 0, ElitesKilled = 0, + HardElitesKilled = 0, TotalKilled = 0, + HardTotalKilled = 0, TotalGold = 0, + HardTotalGold = 0, TotalBloodShards = 0, + HardTotalBloodShards = 0, PvPTotalKilled = 0, + HardPvPTotalKilled = 0, PvPTotalWins = 0, - PvPTotalGold = 0 + HardPvPTotalWins = 0, + PvPTotalGold = 0, + HardPvPTotalGold = 0, + CraftItem1 = 0, + HardCraftItem1 = 0, + CraftItem2 = 0, + HardCraftItem2 = 0, + CraftItem3 = 0, + HardCraftItem3 = 0, + CraftItem4 = 0, + HardCraftItem4 = 0, + CraftItem5 = 0, + HardCraftItem5 = 0, + BigPortalKey = 0, + HardBigPortalKey = 0, + LeorikKey = 0, + HardLeorikKey = 0, + VialofPutridness = 0, + HardVialofPutridness = 0, + IdolofTerror = 0, + HardIdolofTerror = 0, + HeartofFright = 0, + HardHeartofFright = 0, + HoradricA1 = 0, + HardHoradricA1 = 0, + HoradricA2 = 0, + HardHoradricA2 = 0, + HoradricA3 = 0, + HardHoradricA3 = 0, + HoradricA4 = 0, + HardHoradricA4 = 0, + HoradricA5 = 0, + HardHoradricA5 = 0 }; DBSessions.SessionSave(newDBGameAccount); diff --git a/src/DiIiS-NA/BGS-Server/Toons/Toon.cs b/src/DiIiS-NA/BGS-Server/Toons/Toon.cs index 091c11a..869ac98 100644 --- a/src/DiIiS-NA/BGS-Server/Toons/Toon.cs +++ b/src/DiIiS-NA/BGS-Server/Toons/Toon.cs @@ -159,164 +159,6 @@ namespace DiIiS_NA.LoginServer.Toons public IntPresenceField HighestUnlockedDifficulty { get { return new IntPresenceField(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.Hero, 7, 0, 9); } } - public int CraftItem1 - { - get { return this.DBToon.CraftItem1; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.CraftItem1 = value; - DBSessions.SessionUpdate(dbToon); - } - } - } - public int CraftItem2 - { - get { return this.DBToon.CraftItem2; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.CraftItem2 = value; - DBSessions.SessionUpdate(dbToon); - } - } - } - public int CraftItem3 - { - get { return this.DBToon.CraftItem3; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.CraftItem3 = value; - DBSessions.SessionUpdate(dbToon); - } - } - } - public int CraftItem4 - { - get { return this.DBToon.CraftItem4; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.CraftItem4 = value; - DBSessions.SessionUpdate(dbToon); - } - } - } - public int CraftItem5 - { - get { return this.DBToon.CraftItem5; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.CraftItem5 = value; - DBSessions.SessionUpdate(dbToon); - } - } - } - public int BigPortalKey - { - get { return this.DBToon.BigPortalKey; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.BigPortalKey = value; - DBSessions.SessionUpdate(dbToon); - } - } - } - public int LeorikKey - { - get { return this.DBToon.LeorikKey; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.LeorikKey = value; - DBSessions.SessionUpdate(dbToon); - } - } - } - - public int HoradricA1Res - { - get { return this.DBToon.HoradricA1; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.HoradricA1 = value; - DBSessions.SessionUpdate(dbToon); - } - } - } - public int HoradricA2Res - { - get { return this.DBToon.HoradricA2; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.HoradricA2 = value; - DBSessions.SessionUpdate(dbToon); - } - } - } - public int HoradricA3Res - { - get { return this.DBToon.HoradricA3; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.HoradricA3 = value; - DBSessions.SessionUpdate(dbToon); - } - } - } - public int HoradricA4Res - { - get { return this.DBToon.HoradricA4; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.HoradricA4 = value; - DBSessions.SessionUpdate(dbToon); - } - } - } - public int HoradricA5Res - { - get { return this.DBToon.HoradricA5; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.HoradricA5 = value; - DBSessions.SessionUpdate(dbToon); - } - } - } - /// /// D3 EntityID encoded id. /// @@ -591,10 +433,7 @@ namespace DiIiS_NA.LoginServer.Toons { if (_paragonLevelChanged || !LoginServer.Config.Instance.Enabled) { - if (this.IsHardcore) - this._cachedParagonLevel = this.GameAccount.DBGameAccount.ParagonLevelHardcore; - else - this._cachedParagonLevel = this.GameAccount.DBGameAccount.ParagonLevel; + this._cachedParagonLevel = this.GameAccount.DBGameAccount.ParagonLevel; _paragonLevelChanged = false; } return this._cachedParagonLevel; @@ -726,33 +565,30 @@ namespace DiIiS_NA.LoginServer.Toons /// /// Killed monsters(total for account) /// - public ulong KilledMonsters - { - get { return this.GameAccount.DBGameAccount.TotalKilled; } - set - { - lock (this.GameAccount.DBGameAccount) - { - var dbGAcc = this.GameAccount.DBGameAccount; - dbGAcc.TotalKilled = value; - DBSessions.SessionUpdate(dbGAcc); + public ulong TotalKilled { + get { + return this.GameAccount.DBGameAccount.TotalKilled; + } + set { + var dbGA = this.GameAccount.DBGameAccount; + lock (dbGA) { + dbGA.TotalKilled = value; + DBSessions.SessionUpdate(dbGA); } } } - /// /// Killed elites(total for account) /// - public ulong KilledElites - { - get { return this.GameAccount.DBGameAccount.ElitesKilled; } - set - { - lock (this.GameAccount.DBGameAccount) - { - var dbGAcc = this.GameAccount.DBGameAccount; - dbGAcc.ElitesKilled = value; - DBSessions.SessionUpdate(dbGAcc); + public ulong ElitesKilled { + get { + return this.GameAccount.DBGameAccount.ElitesKilled; + } + set { + var dbGA = this.GameAccount.DBGameAccount; + lock (dbGA) { + dbGA.ElitesKilled = value; + DBSessions.SessionUpdate(dbGA); } } } @@ -760,50 +596,25 @@ namespace DiIiS_NA.LoginServer.Toons /// /// Bounties completed(total for account) /// - public int TotalBounties - { - get { return this.GameAccount.DBGameAccount.TotalBounties; } - set - { - lock (this.GameAccount.DBGameAccount) - { - var dbGAcc = this.GameAccount.DBGameAccount; - dbGAcc.TotalBounties = value; - DBSessions.SessionUpdate(dbGAcc); + public int TotalBounties { + get { + if (this.IsHardcore) { + return this.GameAccount.DBGameAccount.TotalBountiesHardcore; + } + else { + return this.GameAccount.DBGameAccount.TotalBounties; } } - } - - /// - /// Bounties completed(seasonal) - /// - public int TotalBountiesHardcore - { - get { return this.GameAccount.DBGameAccount.TotalBountiesHardcore; } - set - { - lock (this.GameAccount.DBGameAccount) - { - var dbGAcc = this.GameAccount.DBGameAccount; - dbGAcc.TotalBountiesHardcore = value; - DBSessions.SessionUpdate(dbGAcc); - } - } - } - - /// - /// Killed elites(seasonal) - /// - public int KilledElitesSeasonal - { - get { return this.DBToon.ElitesKilled; } - set - { - lock (this.DBToon) - { - var dbToon = this.DBToon; - dbToon.ElitesKilled = value; - DBSessions.SessionUpdate(dbToon); + set { + var dbGA = this.GameAccount.DBGameAccount; + lock (dbGA) { + if (this.IsHardcore) { + dbGA.TotalBountiesHardcore = value; + } + else { + dbGA.TotalBounties = value; + } + DBSessions.SessionUpdate(dbGA); } } } @@ -816,9 +627,9 @@ namespace DiIiS_NA.LoginServer.Toons get { return this.DBToon.Kills; } set { - lock (this.DBToon) + var dbToon = this.DBToon; + lock (dbToon) { - var dbToon = this.DBToon; dbToon.Kills = value; DBSessions.SessionUpdate(dbToon); } @@ -828,15 +639,24 @@ namespace DiIiS_NA.LoginServer.Toons /// /// Total collected Gold(total for account) /// - public ulong CollectedGold - { - get { return this.GameAccount.DBGameAccount.TotalGold; } - set - { - lock (this.GameAccount.DBGameAccount) - { - var dbGAcc = this.GameAccount.DBGameAccount; - dbGAcc.TotalGold = value; + public ulong CollectedGold { + get { + if (this.IsHardcore) { + return this.GameAccount.DBGameAccount.HardTotalGold; + } + else { + return this.GameAccount.DBGameAccount.TotalGold; + } + } + set { + var dbGAcc = this.GameAccount.DBGameAccount; + lock (dbGAcc) { + if (this.IsHardcore) { + dbGAcc.HardTotalGold = value; + } + else { + dbGAcc.TotalGold = value; + } DBSessions.SessionUpdate(dbGAcc); } } diff --git a/src/DiIiS-NA/Core/Storage/AccountDataBase/Entities/DBGameAccount.cs b/src/DiIiS-NA/Core/Storage/AccountDataBase/Entities/DBGameAccount.cs index 764a181..e09aab7 100644 --- a/src/DiIiS-NA/Core/Storage/AccountDataBase/Entities/DBGameAccount.cs +++ b/src/DiIiS-NA/Core/Storage/AccountDataBase/Entities/DBGameAccount.cs @@ -7,36 +7,76 @@ namespace DiIiS_NA.Core.Storage.AccountDataBase.Entities { public new virtual ulong Id { get; protected set; } public virtual DBAccount DBAccount { get; set; } + public virtual ulong LastOnline { get; set; } + public virtual DBToon LastPlayedHero { get; set; } + public virtual int Flags { get; set; } public virtual byte[] Banner { get; set; } public virtual byte[] UIPrefs { get; set; } public virtual byte[] UISettings { get; set; } public virtual byte[] SeenTutorials { get; set; } public virtual byte[] BossProgress { get; set; } public virtual byte[] StashIcons { get; set; } - public virtual int Flags { get; set; } public virtual int ParagonLevel { get; set; } public virtual int ParagonLevelHardcore { get; set; } public virtual long Experience { get; set; } public virtual long ExperienceHardcore { get; set; } - public virtual ulong LastOnline { get; set; } - public virtual DBToon LastPlayedHero { get; set; } public virtual ulong Gold { get; set; } public virtual int Platinum { get; set; } + public virtual int HardPlatinum { get; set; } public virtual ulong HardcoreGold { get; set; } public virtual ulong RmtCurrency { get; set; } + public virtual ulong HardRmtCurrency { get; set; } public virtual int BloodShards { get; set; } public virtual int HardcoreBloodShards { get; set; } public virtual int StashSize { get; set; } public virtual int HardcoreStashSize { get; set; } public virtual int SeasonStashSize { get; set; } + public virtual int HardSeasonStashSize { get; set; } public virtual ulong ElitesKilled { get; set; } + public virtual ulong HardElitesKilled { get; set; } public virtual ulong TotalKilled { get; set; } + public virtual ulong HardTotalKilled { get; set; } public virtual ulong TotalGold { get; set; } + public virtual ulong HardTotalGold { get; set; } public virtual int TotalBloodShards { get; set; } + public virtual int HardTotalBloodShards { get; set; } public virtual int TotalBounties { get; set; } public virtual int TotalBountiesHardcore { get; set; } public virtual ulong PvPTotalKilled { get; set; } + public virtual ulong HardPvPTotalKilled { get; set; } public virtual ulong PvPTotalWins { get; set; } + public virtual ulong HardPvPTotalWins { get; set; } public virtual ulong PvPTotalGold { get; set; } + public virtual ulong HardPvPTotalGold { get; set; } + public virtual int CraftItem1 { get; set; } + public virtual int HardCraftItem1 { get; set; } + public virtual int CraftItem2 { get; set; } + public virtual int HardCraftItem2 { get; set; } + public virtual int CraftItem3 { get; set; } + public virtual int HardCraftItem3 { get; set; } + public virtual int CraftItem4 { get; set; } + public virtual int HardCraftItem4 { get; set; } + public virtual int CraftItem5 { get; set; } + public virtual int HardCraftItem5 { get; set; } + public virtual int BigPortalKey { get; set; } + public virtual int HardBigPortalKey { get; set; } + public virtual int LeorikKey { get; set; } + public virtual int HardLeorikKey { get; set; } + public virtual int VialofPutridness { get; set; } + public virtual int HardVialofPutridness { get; set; } + public virtual int IdolofTerror { get; set; } + public virtual int HardIdolofTerror { get; set; } + public virtual int HeartofFright { get; set; } + public virtual int HardHeartofFright { get; set; } + public virtual int HoradricA1 { get; set; } + public virtual int HardHoradricA1 { get; set; } + public virtual int HoradricA2 { get; set; } + public virtual int HardHoradricA2 { get; set; } + public virtual int HoradricA3 { get; set; } + public virtual int HardHoradricA3 { get; set; } + public virtual int HoradricA4 { get; set; } + public virtual int HardHoradricA4 { get; set; } + public virtual int HoradricA5 { get; set; } + public virtual int HardHoradricA5 { get; set; } } } diff --git a/src/DiIiS-NA/Core/Storage/AccountDataBase/Entities/DBToon.cs b/src/DiIiS-NA/Core/Storage/AccountDataBase/Entities/DBToon.cs index e04b7ad..5d23a8a 100644 --- a/src/DiIiS-NA/Core/Storage/AccountDataBase/Entities/DBToon.cs +++ b/src/DiIiS-NA/Core/Storage/AccountDataBase/Entities/DBToon.cs @@ -14,12 +14,10 @@ namespace DiIiS_NA.Core.Storage.AccountDataBase.Entities public virtual ToonClass Class { get; set; } public virtual ToonFlags Flags { get; set; } public virtual byte Level { get; set; } - public virtual bool Dead { get; set; } public virtual bool StoneOfPortal { get; set; } public virtual int CreatedSeason { get; set; } public virtual int TimeDeadHarcode { get; set; } - public virtual long Experience { get; set; } public virtual ushort[] ParagonBonuses { get; set; } public virtual int PvERating { get; set; } @@ -47,18 +45,5 @@ namespace DiIiS_NA.Core.Storage.AccountDataBase.Entities public virtual int Cosmetic2 { get; set; } public virtual int Cosmetic3 { get; set; } public virtual int Cosmetic4 { get; set; } - public virtual int CraftItem1 { get; set; } - public virtual int CraftItem2 { get; set; } - public virtual int CraftItem3 { get; set; } - public virtual int CraftItem4 { get; set; } - public virtual int CraftItem5 { get; set; } - public virtual int BigPortalKey { get; set; } - public virtual int LeorikKey { get; set; } - - public virtual int HoradricA1 { get; set; } - public virtual int HoradricA2 { get; set; } - public virtual int HoradricA3 { get; set; } - public virtual int HoradricA4 { get; set; } - public virtual int HoradricA5 { get; set; } } } diff --git a/src/DiIiS-NA/Core/Storage/AccountDataBase/Mapper/DBGameAccountMapper.cs b/src/DiIiS-NA/Core/Storage/AccountDataBase/Mapper/DBGameAccountMapper.cs index c9837a2..ee73fa7 100644 --- a/src/DiIiS-NA/Core/Storage/AccountDataBase/Mapper/DBGameAccountMapper.cs +++ b/src/DiIiS-NA/Core/Storage/AccountDataBase/Mapper/DBGameAccountMapper.cs @@ -12,39 +12,78 @@ namespace DiIiS_NA.Core.Storage.AccountDataBase.Mapper Table("game_accounts"); Id(e => e.Id).CustomType().GeneratedBy.Sequence("game_accounts_seq").UnsavedValue(null); References(e => e.DBAccount); + Map(e => e.LastOnline).CustomType(); + References(e => e.LastPlayedHero).Nullable(); + Map(e => e.Flags); Map(e => e.Banner).CustomSqlType("Bytea"); Map(e => e.UIPrefs).CustomSqlType("Bytea"); - Map(e => e.UISettings).CustomSqlType("Bytea"); Map(e => e.SeenTutorials).CustomSqlType("Bytea"); Map(e => e.BossProgress).CustomSqlType("Bytea"); Map(e => e.StashIcons).CustomSqlType("Bytea"); - Map(e => e.LastOnline).CustomType(); - Map(e => e.Flags); Map(e => e.ParagonLevel); Map(e => e.ParagonLevelHardcore); Map(e => e.Experience); Map(e => e.ExperienceHardcore); //HasMany(e => e.DBToons).Cascade.All(); //HasMany(e => e.DBInventories).Cascade.All(); - References(e => e.LastPlayedHero).Nullable(); Map(e => e.Gold).CustomType(); - Map(e => e.Platinum); Map(e => e.HardcoreGold).CustomType(); + Map(e => e.Platinum); + Map(e => e.HardPlatinum); Map(e => e.RmtCurrency).CustomType(); + Map(e => e.HardRmtCurrency).CustomType(); Map(e => e.BloodShards); Map(e => e.HardcoreBloodShards); Map(e => e.StashSize); Map(e => e.HardcoreStashSize); Map(e => e.SeasonStashSize); + Map(e => e.HardSeasonStashSize); Map(e => e.ElitesKilled).CustomType(); + Map(e => e.HardElitesKilled).CustomType(); Map(e => e.TotalKilled).CustomType(); + Map(e => e.HardTotalKilled).CustomType(); Map(e => e.TotalGold).CustomType(); + Map(e => e.HardTotalGold).CustomType(); Map(e => e.TotalBloodShards); + Map(e => e.HardTotalBloodShards); Map(e => e.TotalBounties).Not.Nullable().Default("0"); Map(e => e.TotalBountiesHardcore).Not.Nullable().Default("0"); Map(e => e.PvPTotalKilled).CustomType(); + Map(e => e.HardPvPTotalKilled).CustomType(); Map(e => e.PvPTotalWins).CustomType(); + Map(e => e.HardPvPTotalWins).CustomType(); Map(e => e.PvPTotalGold).CustomType(); + Map(e => e.HardPvPTotalGold).CustomType(); + Map(e => e.CraftItem1); + Map(e => e.HardCraftItem1); + Map(e => e.CraftItem2); + Map(e => e.HardCraftItem2); + Map(e => e.CraftItem3); + Map(e => e.HardCraftItem3); + Map(e => e.CraftItem4); + Map(e => e.HardCraftItem4); + Map(e => e.CraftItem5); + Map(e => e.HardCraftItem5); + Map(e => e.BigPortalKey); + Map(e => e.HardBigPortalKey); + Map(e => e.LeorikKey); + Map(e => e.HardLeorikKey); + Map(e => e.VialofPutridness); + Map(e => e.HardVialofPutridness); + Map(e => e.IdolofTerror); + Map(e => e.HardIdolofTerror); + Map(e => e.HeartofFright); + Map(e => e.HardHeartofFright); + Map(e => e.HoradricA1); + Map(e => e.HardHoradricA1); + Map(e => e.HoradricA2); + Map(e => e.HardHoradricA2); + Map(e => e.HoradricA3); + Map(e => e.HardHoradricA3); + Map(e => e.HoradricA4); + Map(e => e.HardHoradricA4); + Map(e => e.HoradricA5); + Map(e => e.HardHoradricA5); } } } diff --git a/src/DiIiS-NA/Core/Storage/AccountDataBase/Mapper/DBToonMapper.cs b/src/DiIiS-NA/Core/Storage/AccountDataBase/Mapper/DBToonMapper.cs index 01e2d63..75529f8 100644 --- a/src/DiIiS-NA/Core/Storage/AccountDataBase/Mapper/DBToonMapper.cs +++ b/src/DiIiS-NA/Core/Storage/AccountDataBase/Mapper/DBToonMapper.cs @@ -46,18 +46,6 @@ namespace DiIiS_NA.Core.Storage.AccountDataBase.Mapper Map(e => e.Cosmetic2); Map(e => e.Cosmetic3); Map(e => e.Cosmetic4); - Map(e => e.CraftItem1); - Map(e => e.CraftItem2); - Map(e => e.CraftItem3); - Map(e => e.CraftItem4); - Map(e => e.CraftItem5); - Map(e => e.BigPortalKey); - Map(e => e.LeorikKey); - Map(e => e.HoradricA1); - Map(e => e.HoradricA2); - Map(e => e.HoradricA3); - Map(e => e.HoradricA4); - Map(e => e.HoradricA5); } } } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs index 4d23fa6..cc03beb 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/GameSystem/QuestManager.cs @@ -1046,14 +1046,12 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem .Build() ).Build() }); - //Добавляем критерий! + // Adding the criterion! player.GrantCriteria(3367569); - //Повышаем за выполнене поручения. + // Increase for the completion of the assignment. player.UpdateExp((int)xpReward); player.Inventory.AddGoldAmount((int)goldReward); player.Toon.TotalBounties++; - if (player.World.Game.IsHardcore) - player.Toon.TotalBountiesHardcore++; player.UpdateAchievementCounter(412, 1); } this.Finished = true; diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs index 51978e8..3a37b16 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs @@ -872,11 +872,11 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem public override void OnTargeted(Player player, TargetMessage message) { player.Inventory.RefreshInventoryToClient(); - + //var playerAcc = player.InGameClient.BnetClient.Account.GameAccount; switch (this.SNO) { case ActorSno._tieredlootrunkey_0: - player.Toon.BigPortalKey++; + player.Toon.GameAccount.BigPortalKey++; this.Destroy(); break; default: @@ -885,22 +885,29 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem } var Moneys = D3.Items.CurrencySavedData.CreateBuilder(); + var playerAcc = player.InGameClient.BnetClient.Account.GameAccount; D3.Items.CurrencyData GoldData = D3.Items.CurrencyData.CreateBuilder().SetId(0).SetCount((long)player.Inventory.GetGoldAmount()).Build(); - D3.Items.CurrencyData BloodShardData = D3.Items.CurrencyData.CreateBuilder().SetId(1).SetCount(player.InGameClient.BnetClient.Account.GameAccount.BloodShards).Build(); - D3.Items.CurrencyData PlatinumData = D3.Items.CurrencyData.CreateBuilder().SetId(2).SetCount(player.InGameClient.BnetClient.Account.GameAccount.Platinum).Build(); - D3.Items.CurrencyData Craft1Data = D3.Items.CurrencyData.CreateBuilder().SetId(3).SetCount(player.Toon.CraftItem1).Build(); - D3.Items.CurrencyData Craft2Data = D3.Items.CurrencyData.CreateBuilder().SetId(4).SetCount(player.Toon.CraftItem2).Build(); - D3.Items.CurrencyData Craft3Data = D3.Items.CurrencyData.CreateBuilder().SetId(5).SetCount(player.Toon.CraftItem3).Build(); - D3.Items.CurrencyData Craft4Data = D3.Items.CurrencyData.CreateBuilder().SetId(6).SetCount(player.Toon.CraftItem4).Build(); - D3.Items.CurrencyData Craft5Data = D3.Items.CurrencyData.CreateBuilder().SetId(7).SetCount(player.Toon.CraftItem5).Build(); - D3.Items.CurrencyData Craft6Data = D3.Items.CurrencyData.CreateBuilder().SetId(16).SetCount(player.Toon.LeorikKey).Build(); //Leorik Regret - D3.Items.CurrencyData Craft7Data = D3.Items.CurrencyData.CreateBuilder().SetId(20).SetCount(player.Toon.BigPortalKey).Build(); //Big Portal Key - D3.Items.CurrencyData Horadric1Data = D3.Items.CurrencyData.CreateBuilder().SetId(8).SetCount(player.Toon.HoradricA1Res).Build(); - D3.Items.CurrencyData Horadric2Data = D3.Items.CurrencyData.CreateBuilder().SetId(9).SetCount(player.Toon.HoradricA2Res).Build(); - D3.Items.CurrencyData Horadric3Data = D3.Items.CurrencyData.CreateBuilder().SetId(10).SetCount(player.Toon.HoradricA3Res).Build(); - D3.Items.CurrencyData Horadric4Data = D3.Items.CurrencyData.CreateBuilder().SetId(11).SetCount(player.Toon.HoradricA4Res).Build(); - D3.Items.CurrencyData Horadric5Data = D3.Items.CurrencyData.CreateBuilder().SetId(12).SetCount(player.Toon.HoradricA5Res).Build(); - //CraftItemLegendary - 2073430088 + D3.Items.CurrencyData BloodShardData = D3.Items.CurrencyData.CreateBuilder().SetId(1).SetCount(playerAcc.BloodShards).Build(); + D3.Items.CurrencyData PlatinumData = D3.Items.CurrencyData.CreateBuilder().SetId(2).SetCount(playerAcc.Platinum).Build(); + + D3.Items.CurrencyData Craft1Data = D3.Items.CurrencyData.CreateBuilder().SetId(3).SetCount(playerAcc.CraftItem1).Build(); // Reusable Parts. + D3.Items.CurrencyData Craft2Data = D3.Items.CurrencyData.CreateBuilder().SetId(4).SetCount(playerAcc.CraftItem2).Build(); // Arcanes Dust. + D3.Items.CurrencyData Craft3Data = D3.Items.CurrencyData.CreateBuilder().SetId(5).SetCount(playerAcc.CraftItem3).Build(); // Veiled Crystal. + D3.Items.CurrencyData Craft4Data = D3.Items.CurrencyData.CreateBuilder().SetId(6).SetCount(playerAcc.CraftItem4).Build(); // Death's Breath. + D3.Items.CurrencyData Craft5Data = D3.Items.CurrencyData.CreateBuilder().SetId(7).SetCount(playerAcc.CraftItem5).Build(); // Forgotten Soul. + + D3.Items.CurrencyData Horadric1Data = D3.Items.CurrencyData.CreateBuilder().SetId(8).SetCount(playerAcc.HoradricA1Res).Build(); // Khanduran Rune Bounty itens Act I. + D3.Items.CurrencyData Horadric2Data = D3.Items.CurrencyData.CreateBuilder().SetId(9).SetCount(playerAcc.HoradricA2Res).Build(); // Caldeum Nightshade Bounty itens Act II. + D3.Items.CurrencyData Horadric3Data = D3.Items.CurrencyData.CreateBuilder().SetId(10).SetCount(playerAcc.HoradricA3Res).Build(); // Arreat War Tapestry Bounty itens Act III. + D3.Items.CurrencyData Horadric4Data = D3.Items.CurrencyData.CreateBuilder().SetId(11).SetCount(playerAcc.HoradricA4Res).Build(); // Copputed Angel Flesh Bounty itens Act IV. + D3.Items.CurrencyData Horadric5Data = D3.Items.CurrencyData.CreateBuilder().SetId(12).SetCount(playerAcc.HoradricA5Res).Build(); // Westmarch Holy Water Bounty itens Act V. + + D3.Items.CurrencyData Craft8Data = D3.Items.CurrencyData.CreateBuilder().SetId(13).SetCount(playerAcc.HeartofFright).Build(); // Heart of Fright. + D3.Items.CurrencyData Craft9Data = D3.Items.CurrencyData.CreateBuilder().SetId(14).SetCount(playerAcc.VialofPutridness).Build(); // Idol of Terror. + D3.Items.CurrencyData Craft10Data = D3.Items.CurrencyData.CreateBuilder().SetId(15).SetCount(playerAcc.IdolofTerror).Build(); // Vail of Putridiness. + D3.Items.CurrencyData Craft11Data = D3.Items.CurrencyData.CreateBuilder().SetId(16).SetCount(playerAcc.LeorikKey).Build(); // Leorik Regret. + + D3.Items.CurrencyData Craft7Data = D3.Items.CurrencyData.CreateBuilder().SetId(20).SetCount(playerAcc.BigPortalKey).Build(); // KeyStone Greater Rift. Moneys.AddCurrency(GoldData); Moneys.AddCurrency(BloodShardData); @@ -910,13 +917,17 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem Moneys.AddCurrency(Craft3Data); Moneys.AddCurrency(Craft4Data); Moneys.AddCurrency(Craft5Data); - Moneys.AddCurrency(Craft6Data); Moneys.AddCurrency(Craft7Data); Moneys.AddCurrency(Horadric1Data); Moneys.AddCurrency(Horadric2Data); Moneys.AddCurrency(Horadric3Data); Moneys.AddCurrency(Horadric4Data); Moneys.AddCurrency(Horadric5Data); + Moneys.AddCurrency(Craft8Data); + Moneys.AddCurrency(Craft9Data); + Moneys.AddCurrency(Craft10Data); + Moneys.AddCurrency(Craft11Data); + player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Base.GenericBlobMessage(Opcodes.CurrencyDataFull) { Data = Moneys.Build().ToByteArray() }); } @@ -989,27 +1000,34 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem case LoginServer.Toons.ToonClass.Necromancer: Base = 8; break; case LoginServer.Toons.ToonClass.WitchDoctor: Base = 10; break; case LoginServer.Toons.ToonClass.Wizard: Base = 12; break; - } //0 - Варвар, 2 - Крестоносец, 4 - Охотник, 6 - Монах, 8 - Некромант, 10 - Колдун, 12 - Волшебник + } //0 - Barbarian, 2 - Crusader, 4 - Hunter, 6 - Monk, 8 - Necromancer, 10 - Sorcerer, 12 - Wizard string it = ""; - #region Калькуляция баланса + #region Balance calculation var Moneys = D3.Items.CurrencySavedData.CreateBuilder(); - D3.Items.CurrencyData GoldData = D3.Items.CurrencyData.CreateBuilder().SetId(0).SetCount((long)player.Inventory.GetGoldAmount()).Build(); - D3.Items.CurrencyData BloodShardData = D3.Items.CurrencyData.CreateBuilder().SetId(1).SetCount(player.InGameClient.BnetClient.Account.GameAccount.BloodShards).Build(); - D3.Items.CurrencyData PlatinumData = D3.Items.CurrencyData.CreateBuilder().SetId(2).SetCount(player.InGameClient.BnetClient.Account.GameAccount.Platinum).Build(); - D3.Items.CurrencyData Craft1Data = D3.Items.CurrencyData.CreateBuilder().SetId(3).SetCount(player.Toon.CraftItem1).Build(); - D3.Items.CurrencyData Craft2Data = D3.Items.CurrencyData.CreateBuilder().SetId(4).SetCount(player.Toon.CraftItem2).Build(); - D3.Items.CurrencyData Craft3Data = D3.Items.CurrencyData.CreateBuilder().SetId(5).SetCount(player.Toon.CraftItem3).Build(); - D3.Items.CurrencyData Craft4Data = D3.Items.CurrencyData.CreateBuilder().SetId(6).SetCount(player.Toon.CraftItem4).Build(); - D3.Items.CurrencyData Craft5Data = D3.Items.CurrencyData.CreateBuilder().SetId(7).SetCount(player.Toon.CraftItem5).Build(); - D3.Items.CurrencyData Craft6Data = D3.Items.CurrencyData.CreateBuilder().SetId(16).SetCount(player.Toon.LeorikKey).Build(); //Leorik Regret - D3.Items.CurrencyData Craft7Data = D3.Items.CurrencyData.CreateBuilder().SetId(20).SetCount(player.Toon.BigPortalKey).Build(); //Big Portal Key - D3.Items.CurrencyData Horadric1Data = D3.Items.CurrencyData.CreateBuilder().SetId(8).SetCount(player.Toon.HoradricA1Res).Build(); - D3.Items.CurrencyData Horadric2Data = D3.Items.CurrencyData.CreateBuilder().SetId(9).SetCount(player.Toon.HoradricA2Res).Build(); - D3.Items.CurrencyData Horadric3Data = D3.Items.CurrencyData.CreateBuilder().SetId(10).SetCount(player.Toon.HoradricA3Res).Build(); - D3.Items.CurrencyData Horadric4Data = D3.Items.CurrencyData.CreateBuilder().SetId(11).SetCount(player.Toon.HoradricA4Res).Build(); - D3.Items.CurrencyData Horadric5Data = D3.Items.CurrencyData.CreateBuilder().SetId(12).SetCount(player.Toon.HoradricA5Res).Build(); + var playerAcc = player.InGameClient.BnetClient.Account.GameAccount; - //CraftItemLegendary - 2073430088 + D3.Items.CurrencyData GoldData = D3.Items.CurrencyData.CreateBuilder().SetId(0).SetCount((long)player.Inventory.GetGoldAmount()).Build(); + D3.Items.CurrencyData BloodShardData = D3.Items.CurrencyData.CreateBuilder().SetId(1).SetCount(playerAcc.BloodShards).Build(); + D3.Items.CurrencyData PlatinumData = D3.Items.CurrencyData.CreateBuilder().SetId(2).SetCount(playerAcc.Platinum).Build(); + + D3.Items.CurrencyData Craft1Data = D3.Items.CurrencyData.CreateBuilder().SetId(3).SetCount(playerAcc.CraftItem1).Build(); // Reusable Parts. + D3.Items.CurrencyData Craft2Data = D3.Items.CurrencyData.CreateBuilder().SetId(4).SetCount(playerAcc.CraftItem2).Build(); // Arcanes Dust. + D3.Items.CurrencyData Craft3Data = D3.Items.CurrencyData.CreateBuilder().SetId(5).SetCount(playerAcc.CraftItem3).Build(); // Veiled Crystal. + D3.Items.CurrencyData Craft4Data = D3.Items.CurrencyData.CreateBuilder().SetId(6).SetCount(playerAcc.CraftItem4).Build(); // Death's Breath. + D3.Items.CurrencyData Craft5Data = D3.Items.CurrencyData.CreateBuilder().SetId(7).SetCount(playerAcc.CraftItem5).Build(); // Forgotten Soul. + + D3.Items.CurrencyData Horadric1Data = D3.Items.CurrencyData.CreateBuilder().SetId(8).SetCount(playerAcc.HoradricA1Res).Build(); // Khanduran Rune Bounty itens Act I. + D3.Items.CurrencyData Horadric2Data = D3.Items.CurrencyData.CreateBuilder().SetId(9).SetCount(playerAcc.HoradricA2Res).Build(); // Caldeum Nightshade Bounty itens Act II. + D3.Items.CurrencyData Horadric3Data = D3.Items.CurrencyData.CreateBuilder().SetId(10).SetCount(playerAcc.HoradricA3Res).Build(); // Arreat War Tapestry Bounty itens Act III. + D3.Items.CurrencyData Horadric4Data = D3.Items.CurrencyData.CreateBuilder().SetId(11).SetCount(playerAcc.HoradricA4Res).Build(); // Copputed Angel Flesh Bounty itens Act IV. + D3.Items.CurrencyData Horadric5Data = D3.Items.CurrencyData.CreateBuilder().SetId(12).SetCount(playerAcc.HoradricA5Res).Build(); // Westmarch Holy Water Bounty itens Act V. + + D3.Items.CurrencyData Craft8Data = D3.Items.CurrencyData.CreateBuilder().SetId(13).SetCount(playerAcc.HeartofFright).Build(); // Heart of Fright. + D3.Items.CurrencyData Craft9Data = D3.Items.CurrencyData.CreateBuilder().SetId(14).SetCount(playerAcc.VialofPutridness).Build(); // Idol of Terror. + D3.Items.CurrencyData Craft10Data = D3.Items.CurrencyData.CreateBuilder().SetId(15).SetCount(playerAcc.IdolofTerror).Build(); // Vail of Putridiness. + D3.Items.CurrencyData Craft11Data = D3.Items.CurrencyData.CreateBuilder().SetId(16).SetCount(playerAcc.LeorikKey).Build(); // Leorik Regret. + + D3.Items.CurrencyData Craft7Data = D3.Items.CurrencyData.CreateBuilder().SetId(20).SetCount(playerAcc.BigPortalKey).Build(); // KeyStone Greater Rift. Moneys.AddCurrency(GoldData); Moneys.AddCurrency(BloodShardData); @@ -1019,12 +1037,20 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem Moneys.AddCurrency(Craft3Data); Moneys.AddCurrency(Craft4Data); Moneys.AddCurrency(Craft5Data); - Moneys.AddCurrency(Craft6Data); Moneys.AddCurrency(Craft7Data); + Moneys.AddCurrency(Horadric1Data); + Moneys.AddCurrency(Horadric2Data); + Moneys.AddCurrency(Horadric3Data); + Moneys.AddCurrency(Horadric4Data); + Moneys.AddCurrency(Horadric5Data); + Moneys.AddCurrency(Craft8Data); + Moneys.AddCurrency(Craft9Data); + Moneys.AddCurrency(Craft10Data); + Moneys.AddCurrency(Craft11Data); #endregion switch (this.GBHandle.GBID) { - #region Дар Хедрига + #region The Gift of Horadric case -1249067449: items = new string[] { "Unique_Helm_Set_15_x1", "Unique_Gloves_Set_15_x1", "Unique_Helm_Set_12_x1", "Unique_Gloves_Set_12_x1", @@ -1065,11 +1091,11 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem it = items[RandomHelper.Next(Base, Base + 1)]; player.Inventory.PickUp(ItemGenerator.Cook(player, it)); break; #endregion - #region Сокровище Хорадримов - case -1575654862: //Сокровища 1 Акта - player.Toon.HoradricA1Res += RandomHelper.Next(1, 5); - player.Toon.CraftItem4 += RandomHelper.Next(2, 4); - Horadric1Data = D3.Items.CurrencyData.CreateBuilder().SetId(8).SetCount(player.Toon.HoradricA1Res).Build(); + #region The Treasure of the Khoradrim + case -1575654862: // The Treasure 1 Акта + playerAcc.HoradricA1Res += RandomHelper.Next(1, 5); + playerAcc.CraftItem4 += RandomHelper.Next(2, 4); + Horadric1Data = D3.Items.CurrencyData.CreateBuilder().SetId(8).SetCount(playerAcc.HoradricA1Res).Build(); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(3, 8)); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(3, 8)); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(5, 9)); @@ -1077,10 +1103,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem player.World.SpawnGold(player, player, 5000); player.World.SpawnBloodShards(player, player, RandomHelper.Next(10, 25)); break; - case -1575654861: //Сокровища 2 Акта - player.Toon.HoradricA2Res += RandomHelper.Next(1, 5); - player.Toon.CraftItem4 += RandomHelper.Next(2, 4); - Horadric2Data = D3.Items.CurrencyData.CreateBuilder().SetId(9).SetCount(player.Toon.HoradricA2Res).Build(); + case -1575654861: // The Treasure 2 Акта + playerAcc.HoradricA2Res += RandomHelper.Next(1, 5); + playerAcc.CraftItem4 += RandomHelper.Next(2, 4); + Horadric2Data = D3.Items.CurrencyData.CreateBuilder().SetId(9).SetCount(playerAcc.HoradricA2Res).Build(); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(3, 8)); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(3, 8)); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(5, 9)); @@ -1088,10 +1114,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem player.World.SpawnGold(player, player, 5000); player.World.SpawnBloodShards(player, player, RandomHelper.Next(10, 25)); break; - case -1575654860: //Сокровища 3 Акта - player.Toon.HoradricA3Res += RandomHelper.Next(1, 5); - player.Toon.CraftItem4 += RandomHelper.Next(2, 4); - Horadric3Data = D3.Items.CurrencyData.CreateBuilder().SetId(10).SetCount(player.Toon.HoradricA3Res).Build(); + case -1575654860: // The Treasure 3 Акта + playerAcc.HoradricA3Res += RandomHelper.Next(1, 5); + playerAcc.CraftItem4 += RandomHelper.Next(2, 4); + Horadric3Data = D3.Items.CurrencyData.CreateBuilder().SetId(10).SetCount(playerAcc.HoradricA3Res).Build(); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(3, 8)); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(3, 8)); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(5, 9)); @@ -1099,10 +1125,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem player.World.SpawnGold(player, player, 5000); player.World.SpawnBloodShards(player, player, RandomHelper.Next(10, 25)); break; - case -1575654859: //Сокровища 4 Акта - player.Toon.HoradricA4Res += RandomHelper.Next(1, 5); - player.Toon.CraftItem4 += RandomHelper.Next(2, 4); - Horadric4Data = D3.Items.CurrencyData.CreateBuilder().SetId(11).SetCount(player.Toon.HoradricA4Res).Build(); + case -1575654859: // The Treasure 4 Акта + playerAcc.HoradricA4Res += RandomHelper.Next(1, 5); + playerAcc.CraftItem4 += RandomHelper.Next(2, 4); + Horadric4Data = D3.Items.CurrencyData.CreateBuilder().SetId(11).SetCount(playerAcc.HoradricA4Res).Build(); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(3, 8)); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(3, 8)); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(5, 9)); @@ -1110,10 +1136,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem player.World.SpawnGold(player, player, 5000); player.World.SpawnBloodShards(player, player, RandomHelper.Next(10, 25)); break; - case -1575654858: //Сокровища 5 Акта - player.Toon.HoradricA5Res += RandomHelper.Next(1, 5); - player.Toon.CraftItem4 += RandomHelper.Next(2, 4); - Horadric5Data = D3.Items.CurrencyData.CreateBuilder().SetId(12).SetCount(player.Toon.HoradricA5Res).Build(); + case -1575654858: // The Treasure 5 Акта + playerAcc.HoradricA5Res += RandomHelper.Next(1, 5); + playerAcc.CraftItem4 += RandomHelper.Next(2, 4); + Horadric5Data = D3.Items.CurrencyData.CreateBuilder().SetId(12).SetCount(playerAcc.HoradricA5Res).Build(); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(3, 8)); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(3, 8)); player.World.SpawnRandomEquip(player, player, RandomHelper.Next(5, 9)); @@ -1125,7 +1151,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem default: Logger.Warn("This treasure bag - not implemented"); break; } - Craft4Data = D3.Items.CurrencyData.CreateBuilder().SetId(6).SetCount(player.Toon.CraftItem4).Build(); + Craft4Data = D3.Items.CurrencyData.CreateBuilder().SetId(6).SetCount(playerAcc.CraftItem4).Build(); Moneys.AddCurrency(Horadric1Data); Moneys.AddCurrency(Horadric2Data); Moneys.AddCurrency(Horadric3Data); diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Inventory.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Inventory.cs index c6a67f1..ae5f9cc 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Inventory.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Inventory.cs @@ -1401,7 +1401,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem switch (msg.SalvageType) { - //Простые предметы + // Simple items case 0: foreach (var item in this.GetBackPackItems()) if (!item.ItemDefinition.Name.ToLower().Contains("potion") && @@ -1420,7 +1420,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem count_reward += SalvageItem(item); } break; - //Магические предметы + // Magical items case 1: foreach (var item in this.GetBackPackItems()) if (item.Attributes[GameAttribute.Item_Quality_Level] > 2 & @@ -1431,7 +1431,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem count_reward += SalvageItem(item); } break; - //Редкие предметы + // Rare Items case 2: foreach (var item in this.GetBackPackItems()) if (item.Attributes[GameAttribute.Item_Quality_Level] > 5 & @@ -1490,14 +1490,15 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem Item reward = ItemGenerator.Cook(_owner, rewardName); int count_reward = RandomHelper.Next(1, 5) * (10 - item.Attributes[GameAttribute.Item_Quality_Level]); + var playerAcc = _owner.Toon.GameAccount; if (reward == null) return 0; for (int i = 0; i < count_reward; i++) { switch (rewardName) { - case "Crafting_AssortedParts_01": _owner.Toon.CraftItem1++; break; - case "Crafting_Magic_01": _owner.Toon.CraftItem2++; break; - case "Crafting_Rare_01": _owner.Toon.CraftItem3++; break; + case "Crafting_AssortedParts_01": playerAcc.CraftItem1++; break; + case "Crafting_Magic_01": playerAcc.CraftItem2++; break; + case "Crafting_Rare_01": playerAcc.CraftItem3++; break; } //Item reward1 = ItemGenerator.Cook(_owner, rewardName); //_inventoryGrid.AddItem(reward1); @@ -1537,7 +1538,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem brimstone = ItemGenerator.Cook(_owner, rewardName); if (brimstone != null) { - _owner.Toon.CraftItem5++; + _owner.Toon.GameAccount.CraftItem5++; //_inventoryGrid.AddItem(brimstone); haveBrimstone = true; } @@ -1625,9 +1626,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem { switch (rewardName) { - case "Crafting_AssortedParts_01": _owner.Toon.CraftItem1++; break; - case "Crafting_Magic_01": _owner.Toon.CraftItem2++; break; - case "Crafting_Rare_01": _owner.Toon.CraftItem3++; break; + case "Crafting_AssortedParts_01": _owner.Toon.GameAccount.CraftItem1++; break; + case "Crafting_Magic_01": _owner.Toon.GameAccount.CraftItem2++; break; + case "Crafting_Rare_01": _owner.Toon.GameAccount.CraftItem3++; break; } } //reward.Owner = _owner; @@ -1666,7 +1667,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem brimstone = ItemGenerator.Cook(_owner, rewardName); if (brimstone != null) { - _owner.Toon.CraftItem5++; + _owner.Toon.GameAccount.CraftItem5++; haveBrimstone = true; } } @@ -1732,16 +1733,16 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem if (ingr.ItemsGBID == -1 || ingr.ItemsGBID == 0) continue; switch (ingr.ItemsGBID) { - case -363607620: //Обычные детали - if(_owner.Toon.CraftItem1 < ingr.Count) + case -363607620: // Common parts. + if(_owner.Toon.GameAccount.CraftItem1 < ingr.Count) haveEnoughIngredients = false; break; - case -1585802162: //Чародейская пыль - if (_owner.Toon.CraftItem2 < ingr.Count) + case -1585802162: // Wizard Dust. + if (_owner.Toon.GameAccount.CraftItem2 < ingr.Count) haveEnoughIngredients = false; break; - case -605947593: //Затуманенный кристалл - if (_owner.Toon.CraftItem3 < ingr.Count) + case -605947593: // Blurred Crystal. + if (_owner.Toon.GameAccount.CraftItem3 < ingr.Count) haveEnoughIngredients = false; break; } @@ -1792,14 +1793,14 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem if (ingr.ItemsGBID == -1 || ingr.ItemsGBID == 0) continue; switch (ingr.ItemsGBID) { - case -363607620: //Обычные детали - _owner.Toon.CraftItem1 -= ingr.Count; + case -363607620: // Common parts. + _owner.Toon.GameAccount.CraftItem1 -= ingr.Count; break; - case -1585802162: //Чародейская пыль - _owner.Toon.CraftItem2 -= ingr.Count; + case -1585802162: // Wizard Dust. + _owner.Toon.GameAccount.CraftItem2 -= ingr.Count; break; - case -605947593: //Затуманенный кристалл - _owner.Toon.CraftItem3 -= ingr.Count; + case -605947593: // Blurred Crystal. + _owner.Toon.GameAccount.CraftItem3 -= ingr.Count; break; } } @@ -1992,12 +1993,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem _owner.Attributes.BroadcastChangedIfRevealed(); _stashGrid.ResizeGrid(_owner.Attributes[GameAttribute.Shared_Stash_Slots] / 7, 7); var dbGAcc = _owner.Toon.GameAccount.DBGameAccount; - if (_owner.World.Game.IsSeasoned) - dbGAcc.SeasonStashSize = _owner.Attributes[GameAttribute.Shared_Stash_Slots]; - else if (_owner.World.Game.IsHardcore) - dbGAcc.HardcoreStashSize = _owner.Attributes[GameAttribute.Shared_Stash_Slots]; - else - dbGAcc.StashSize = _owner.Attributes[GameAttribute.Shared_Stash_Slots]; + dbGAcc.StashSize = _owner.Attributes[GameAttribute.Shared_Stash_Slots]; _owner.World.Game.GameDBSession.SessionUpdate(dbGAcc); } @@ -2262,14 +2258,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem _inventoryGold.Attributes.SendChangedMessage(_owner.InGameClient); if (immediately) { - if (_owner.World.Game.IsHardcore) - _owner.Toon.GameAccount.HardcoreGold += (ulong)amount; - else - _owner.Toon.GameAccount.Gold += (ulong)amount; - - //_owner.Toon.CollectedGold += (ulong)amount; - - //_owner.UpdateAchievementCounter(10, (uint)amount); + _owner.Toon.GameAccount.Gold += (ulong)amount; } else _owner.GoldCollectedTempCount += amount; @@ -2282,11 +2271,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem _inventoryGold.Attributes[GameAttribute.Gold] -= amount; _inventoryGold.Attributes[GameAttribute.ItemStackQuantityLo] = _inventoryGold.Attributes[GameAttribute.Gold]; _inventoryGold.Attributes.SendChangedMessage(_owner.InGameClient); - if (_owner.World.Game.IsHardcore) - _owner.Toon.GameAccount.HardcoreGold -= (ulong)amount; - else - _owner.Toon.GameAccount.Gold -= (ulong)amount; - + _owner.Toon.GameAccount.Gold -= (ulong)amount; UpdateCurrencies(); } @@ -2310,51 +2295,42 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem var BloodShardsElement = D3.Items.CurrencyData.CreateBuilder().SetId(1); if (immediately) { - if (_owner.World.Game.IsHardcore) - { - _owner.Toon.GameAccount.HardcoreBloodShards += amount; - BloodShardsElement.SetCount(_owner.Toon.GameAccount.HardcoreBloodShards); - } - else - { - _owner.Toon.GameAccount.BloodShards += amount; - BloodShardsElement.SetCount(_owner.Toon.GameAccount.BloodShards); - } + BloodShardsElement.SetCount(_owner.Toon.GameAccount.BloodShards); } else { _owner.BloodShardsCollectedTempCount += amount; if (_owner.World.Game.IsHardcore) - { - BloodShardsElement.SetCount(_owner.BloodShardsCollectedTempCount + _owner.Toon.GameAccount.HardcoreBloodShards); - } - else - { - BloodShardsElement.SetCount(_owner.BloodShardsCollectedTempCount + _owner.Toon.GameAccount.BloodShards); - } + BloodShardsElement.SetCount(_owner.BloodShardsCollectedTempCount + _owner.Toon.GameAccount.BloodShards); } } public void UpdateCurrencies() { var Moneys = D3.Items.CurrencySavedData.CreateBuilder(); + var playerAcc = _owner.InGameClient.BnetClient.Account.GameAccount; D3.Items.CurrencyData GoldData = D3.Items.CurrencyData.CreateBuilder().SetId(0).SetCount((long)this.GetGoldAmount()).Build(); - D3.Items.CurrencyData BloodShardData = D3.Items.CurrencyData.CreateBuilder().SetId(1).SetCount(_owner.InGameClient.BnetClient.Account.GameAccount.BloodShards).Build(); - D3.Items.CurrencyData PlatinumData = D3.Items.CurrencyData.CreateBuilder().SetId(2).SetCount(_owner.InGameClient.BnetClient.Account.GameAccount.Platinum).Build(); - D3.Items.CurrencyData Craft1Data = D3.Items.CurrencyData.CreateBuilder().SetId(3).SetCount(_owner.Toon.CraftItem1).Build(); - D3.Items.CurrencyData Craft2Data = D3.Items.CurrencyData.CreateBuilder().SetId(4).SetCount(_owner.Toon.CraftItem2).Build(); - D3.Items.CurrencyData Craft3Data = D3.Items.CurrencyData.CreateBuilder().SetId(5).SetCount(_owner.Toon.CraftItem3).Build(); - D3.Items.CurrencyData Craft4Data = D3.Items.CurrencyData.CreateBuilder().SetId(6).SetCount(_owner.Toon.CraftItem4).Build(); - D3.Items.CurrencyData Craft5Data = D3.Items.CurrencyData.CreateBuilder().SetId(7).SetCount(_owner.Toon.CraftItem5).Build(); - D3.Items.CurrencyData Craft6Data = D3.Items.CurrencyData.CreateBuilder().SetId(16).SetCount(_owner.Toon.LeorikKey).Build(); //Leorik Regret - D3.Items.CurrencyData Craft7Data = D3.Items.CurrencyData.CreateBuilder().SetId(20).SetCount(_owner.Toon.BigPortalKey).Build(); //Big Portal Key - D3.Items.CurrencyData Horadric1Data = D3.Items.CurrencyData.CreateBuilder().SetId(8).SetCount(_owner.Toon.HoradricA1Res).Build(); - D3.Items.CurrencyData Horadric2Data = D3.Items.CurrencyData.CreateBuilder().SetId(9).SetCount(_owner.Toon.HoradricA2Res).Build(); - D3.Items.CurrencyData Horadric3Data = D3.Items.CurrencyData.CreateBuilder().SetId(10).SetCount(_owner.Toon.HoradricA3Res).Build(); - D3.Items.CurrencyData Horadric4Data = D3.Items.CurrencyData.CreateBuilder().SetId(11).SetCount(_owner.Toon.HoradricA4Res).Build(); - D3.Items.CurrencyData Horadric5Data = D3.Items.CurrencyData.CreateBuilder().SetId(12).SetCount(_owner.Toon.HoradricA5Res).Build(); + D3.Items.CurrencyData BloodShardData = D3.Items.CurrencyData.CreateBuilder().SetId(1).SetCount(playerAcc.BloodShards).Build(); + D3.Items.CurrencyData PlatinumData = D3.Items.CurrencyData.CreateBuilder().SetId(2).SetCount(playerAcc.Platinum).Build(); - //CraftItemLegendary - 2073430088 + D3.Items.CurrencyData Craft1Data = D3.Items.CurrencyData.CreateBuilder().SetId(3).SetCount(playerAcc.CraftItem1).Build(); // Reusable Parts. + D3.Items.CurrencyData Craft2Data = D3.Items.CurrencyData.CreateBuilder().SetId(4).SetCount(playerAcc.CraftItem2).Build(); // Arcanes Dust. + D3.Items.CurrencyData Craft3Data = D3.Items.CurrencyData.CreateBuilder().SetId(5).SetCount(playerAcc.CraftItem3).Build(); // Veiled Crystal. + D3.Items.CurrencyData Craft4Data = D3.Items.CurrencyData.CreateBuilder().SetId(6).SetCount(playerAcc.CraftItem4).Build(); // Death's Breath. + D3.Items.CurrencyData Craft5Data = D3.Items.CurrencyData.CreateBuilder().SetId(7).SetCount(playerAcc.CraftItem5).Build(); // Forgotten Soul. + + D3.Items.CurrencyData Horadric1Data = D3.Items.CurrencyData.CreateBuilder().SetId(8).SetCount(playerAcc.HoradricA1Res).Build(); // Khanduran Rune Bounty itens Act I. + D3.Items.CurrencyData Horadric2Data = D3.Items.CurrencyData.CreateBuilder().SetId(9).SetCount(playerAcc.HoradricA2Res).Build(); // Caldeum Nightshade Bounty itens Act II. + D3.Items.CurrencyData Horadric3Data = D3.Items.CurrencyData.CreateBuilder().SetId(10).SetCount(playerAcc.HoradricA3Res).Build(); // Arreat War Tapestry Bounty itens Act III. + D3.Items.CurrencyData Horadric4Data = D3.Items.CurrencyData.CreateBuilder().SetId(11).SetCount(playerAcc.HoradricA4Res).Build(); // Copputed Angel Flesh Bounty itens Act IV. + D3.Items.CurrencyData Horadric5Data = D3.Items.CurrencyData.CreateBuilder().SetId(12).SetCount(playerAcc.HoradricA5Res).Build(); // Westmarch Holy Water Bounty itens Act V. + + D3.Items.CurrencyData Craft8Data = D3.Items.CurrencyData.CreateBuilder().SetId(13).SetCount(playerAcc.HeartofFright).Build(); // Heart of Fright. + D3.Items.CurrencyData Craft9Data = D3.Items.CurrencyData.CreateBuilder().SetId(14).SetCount(playerAcc.VialofPutridness).Build(); // Idol of Terror. + D3.Items.CurrencyData Craft10Data = D3.Items.CurrencyData.CreateBuilder().SetId(15).SetCount(playerAcc.IdolofTerror).Build(); // Vail of Putridiness. + D3.Items.CurrencyData Craft11Data = D3.Items.CurrencyData.CreateBuilder().SetId(16).SetCount(playerAcc.LeorikKey).Build(); // Leorik Regret. + + D3.Items.CurrencyData Craft7Data = D3.Items.CurrencyData.CreateBuilder().SetId(20).SetCount(playerAcc.BigPortalKey).Build(); // KeyStone Greater Rift. Moneys.AddCurrency(GoldData); Moneys.AddCurrency(BloodShardData); @@ -2364,13 +2340,17 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem Moneys.AddCurrency(Craft3Data); Moneys.AddCurrency(Craft4Data); Moneys.AddCurrency(Craft5Data); - Moneys.AddCurrency(Craft6Data); Moneys.AddCurrency(Craft7Data); Moneys.AddCurrency(Horadric1Data); Moneys.AddCurrency(Horadric2Data); Moneys.AddCurrency(Horadric3Data); Moneys.AddCurrency(Horadric4Data); Moneys.AddCurrency(Horadric5Data); + Moneys.AddCurrency(Craft8Data); + Moneys.AddCurrency(Craft9Data); + Moneys.AddCurrency(Craft10Data); + Moneys.AddCurrency(Craft11Data); + _owner.InGameClient.SendMessage(new GenericBlobMessage(Opcodes.CurrencyDataFull) { Data = Moneys.Build().ToByteArray() }); } @@ -2382,12 +2362,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem public void RemoveBloodShardsAmount(int amount) { - this.BloodShards -= amount; - - if (_owner.World.Game.IsHardcore) - _owner.Toon.GameAccount.HardcoreBloodShards -= amount; - else - _owner.Toon.GameAccount.BloodShards -= amount; + this.BloodShards -= amount; + _owner.Toon.GameAccount.BloodShards -= amount; UpdateCurrencies(); } @@ -2401,21 +2377,13 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem //load everything and make a switch on slot_id Item item = null; - int goldAmount = _owner.World.Game.IsHardcore ? - (int)_owner.World.Game.GameDBSession.SessionGet(_owner.Toon.GameAccount.PersistentID).HardcoreGold : - (int)_owner.World.Game.GameDBSession.SessionGet(_owner.Toon.GameAccount.PersistentID).Gold; - this.BloodShards = _owner.World.Game.IsHardcore ? - (int)_owner.World.Game.GameDBSession.SessionGet(_owner.Toon.GameAccount.PersistentID).HardcoreBloodShards : - (int)_owner.World.Game.GameDBSession.SessionGet(_owner.Toon.GameAccount.PersistentID).BloodShards; + int goldAmount = (int)_owner.World.Game.GameDBSession.SessionGet(_owner.Toon.GameAccount.PersistentID).Gold; + this.BloodShards = (int)_owner.World.Game.GameDBSession.SessionGet(_owner.Toon.GameAccount.PersistentID).BloodShards; // Clear already present items // LoadFromDB is called every time World is changed, even entering a dungeon _inventoryGrid.Clear(); - // first of all load stash size - - var slots = _owner.World.Game.IsHardcore ? - _owner.World.Game.GameDBSession.SessionGet(_owner.Toon.GameAccount.PersistentID).HardcoreStashSize : - _owner.World.Game.GameDBSession.SessionGet(_owner.Toon.GameAccount.PersistentID).StashSize; + var slots = _owner.World.Game.GameDBSession.SessionGet(_owner.Toon.GameAccount.PersistentID).StashSize; if (slots > 0) { _owner.Attributes[GameAttribute.Shared_Stash_Slots] = slots; diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs index 42116df..8370a69 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs @@ -2487,7 +2487,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem this.Attributes[GameAttribute.Corpse_Resurrection_Charges] = 3; // Reset resurrection charges on zone change (TODO: do not reset charges on reentering the same zone) #if DEBUG - Logger.Warn("Местоположение игрока {0}, Scene: {1} SNO: {2} LevelArea: {3}", this.Toon.Name, this.CurrentScene.SceneSNO.Name, this.CurrentScene.SceneSNO.Id, this.CurrentScene.Specification.SNOLevelAreas[0]); + Logger.Warn("Player Location {0}, Scene: {1} SNO: {2} LevelArea: {3}", this.Toon.Name, this.CurrentScene.SceneSNO.Name, this.CurrentScene.SceneSNO.Id, this.CurrentScene.Specification.SNOLevelAreas[0]); #else #endif @@ -2964,11 +2964,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem // Check the gold if (this.InGameClient.Game.TickCounter % 120 == 0 && this.World != null && this.GoldCollectedTempCount > 0) { - if (this.World.Game.IsHardcore) - this.Toon.GameAccount.HardcoreGold += (ulong)this.GoldCollectedTempCount; - else - this.Toon.GameAccount.Gold += (ulong)this.GoldCollectedTempCount; - + this.Toon.GameAccount.Gold += (ulong)this.GoldCollectedTempCount; this.Toon.CollectedGold += (ulong)this.GoldCollectedTempCount; if (this.World.Game.IsHardcore) @@ -2982,13 +2978,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem // Check the blood shards if (this.InGameClient.Game.TickCounter % 120 == 0 && this.World != null && this.BloodShardsCollectedTempCount > 0) { - if (this.World.Game.IsHardcore) - this.Toon.GameAccount.HardcoreBloodShards += this.BloodShardsCollectedTempCount; - else - this.Toon.GameAccount.BloodShards += this.BloodShardsCollectedTempCount; - + this.Toon.GameAccount.BloodShards += this.BloodShardsCollectedTempCount; this.Toon.GameAccount.TotalBloodShards += this.BloodShardsCollectedTempCount; - this.BloodShardsCollectedTempCount = 0; } @@ -3107,21 +3098,18 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem { if (this.KilledMonstersTempCount != 0) { - this.Toon.KilledMonsters += (ulong)this.KilledMonstersTempCount; + this.Toon.TotalKilled += (ulong)this.KilledMonstersTempCount; this.KilledMonstersTempCount = 0; if (this.KilledElitesTempCount != 0) { - this.Toon.KilledElites += (ulong)this.KilledElitesTempCount; - if (this.World.Game.IsHardcore) - this.Toon.KilledElitesSeasonal += this.KilledElitesTempCount; + this.Toon.ElitesKilled += (ulong)this.KilledElitesTempCount; this.KilledElitesTempCount = 0; } if (this.KilledSeasonalTempCount != 0) { - if (this.World.Game.IsHardcore) - this.Toon.SeasonalKills += this.KilledSeasonalTempCount; + this.Toon.SeasonalKills += this.KilledSeasonalTempCount; this.KilledSeasonalTempCount = 0; } } @@ -3129,7 +3117,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem this.CheckAchievementCounters(); } - #region Призывы некроманта + #region Necromancer summons bool switchertobool = false; bool switchertoboolTwo = false; ActiveSkillSavedData NowSkillGolem = null; @@ -4428,13 +4416,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem public void LoadCurrencyData() { int bloodShards = 0; - if (this.World.Game.IsHardcore) - bloodShards = this.Toon.GameAccount.HardcoreBloodShards; - else - bloodShards = this.Toon.GameAccount.BloodShards; - + bloodShards = this.Toon.GameAccount.BloodShards; this.Inventory.UpdateCurrencies(); - } public void LoadMailData() @@ -5377,8 +5360,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem Type = (FloatingAmountMessage.FloatType)22, }); //*/ - this.Toon.CraftItem4++; - this.Inventory.UpdateCurrencies(); + Toon.GameAccount.CraftItem4++; + Inventory.UpdateCurrencies(); item.Destroy(); } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/DeathPayload.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/DeathPayload.cs index e95812e..223eeb3 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/DeathPayload.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/DeathPayload.cs @@ -814,7 +814,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads this.Target.World.SpawnGold(this.Target, plr); this.Target.World.SpawnGold(this.Target, plr); this.Target.World.SpawnGold(this.Target, plr); - plr.Toon.BigPortalKey++; + plr.Toon.GameAccount.BigPortalKey++; this.Target.World.Game.ActiveNephalemProgress = 0f; } }