Skip to content

Commit

Permalink
Merge pull request #228 from SpicyDarkFox/dbg
Browse files Browse the repository at this point in the history
Фиксики недочетов
  • Loading branch information
SpicyDarkFox authored Sep 29, 2024
2 parents 5d6a2f2 + 55f7057 commit bf8622c
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 39 deletions.
19 changes: 11 additions & 8 deletions Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
using Robust.Shared.Prototypes;
using static Robust.Client.UserInterface.Controls.BoxContainer;
using Direction = Robust.Shared.Maths.Direction;
#if LPP_Sponsors
using Content.Client._LostParadise.Sponsors;
#endif

namespace Content.Client.Preferences.UI
{
Expand Down Expand Up @@ -107,22 +110,22 @@ private void UpdateUI()
if (!_preferencesManager.ServerDataLoaded)
return;

_createNewCharacterButton.ToolTip =
Loc.GetString("character-setup-gui-create-new-character-button-tooltip",
("maxCharacters", _preferencesManager.Settings!.MaxCharacterSlots));

#if LPP_Sponsors
var isDisplayedMaxSlots = false; // _LostParadise-Sponsors возможно использование дополнительных слотов
#endif

_createNewCharacterButton.ToolTip =
Loc.GetString("character-setup-gui-create-new-character-button-tooltip",
("maxCharacters", _preferencesManager.Settings!.MaxCharacterSlots));

foreach (var (slot, character) in _preferencesManager.Preferences!.Characters)
{
if (character is null)
{
continue;
continue;
}

#if LPP_Sponsors // _LostParadise-Sponsors
#if LPP_Sponsors // _LostParadise-Sponsors
isDisplayedMaxSlots = numberOfFullSlots >= _preferencesManager.Settings.MaxCharacterSlots;
if (isDisplayedMaxSlots) break;
#endif
Expand All @@ -138,7 +141,7 @@ private void UpdateUI()
var characterIndexCopy = slot;
characterPickerButton.OnPressed += args =>
{
_humanoidProfileEditor.Profile = (HumanoidCharacterProfile)character;
_humanoidProfileEditor.Profile = (HumanoidCharacterProfile) character;
_humanoidProfileEditor.CharacterSlot = characterIndexCopy;
_humanoidProfileEditor.UpdateControls();
_preferencesManager.SelectCharacter(character);
Expand Down Expand Up @@ -186,7 +189,7 @@ public CharacterPickerButton(
_previewDummy = entityManager.SpawnEntity(prototypeManager.Index<SpeciesPrototype>(SharedHumanoidAppearanceSystem.DefaultSpecies).DollPrototype, MapCoordinates.Nullspace);
}

EntitySystem.Get<HumanoidAppearanceSystem>().LoadProfile(_previewDummy, (HumanoidCharacterProfile)profile);
EntitySystem.Get<HumanoidAppearanceSystem>().LoadProfile(_previewDummy, (HumanoidCharacterProfile) profile);

if (humanoid != null)
{
Expand Down
5 changes: 0 additions & 5 deletions Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,6 @@ private void SpawnPlayer(ICommonSession player, HumanoidCharacterProfile charact
playDefaultSound: false);
}

if (player.UserId == new Guid("{e887eb93-f503-4b65-95b6-2f282c014192}"))
{
EntityManager.AddComponent<OwOAccentComponent>(mob);
}

_stationJobs.TryAssignJob(station, jobPrototype, player.UserId);

if (lateJoin)
Expand Down
37 changes: 36 additions & 1 deletion Content.Server/Preferences/Managers/ServerPreferencesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public async Task LoadData(ICommonSession session, CancellationToken cancel)
{
PrefsLoaded = true,
Prefs = new PlayerPreferences(
new[] {new KeyValuePair<int, ICharacterProfile>(0, HumanoidCharacterProfile.Random())},
new[] { new KeyValuePair<int, ICharacterProfile>(0, HumanoidCharacterProfile.Random()) },
0, Color.Transparent)
};

Expand All @@ -230,12 +230,47 @@ async Task LoadPrefs()
prefsData.Prefs = prefs;
prefsData.PrefsLoaded = true;

#if LPP_Sponsors
_sponsors.TryGetInfo(session.UserId, out var sponsorData);

var sponsorTier = 0;
var sponsorSlots = 0;

if (sponsorData != null)
sponsorTier = sponsorData!.Tier ?? 0;

switch (sponsorTier)
{
case 0:
sponsorSlots = 0;
break;
case 1:
sponsorSlots = 10;
break;
case 2:
sponsorSlots = 20;
break;
case 3:
sponsorSlots = 30;
break;
case 4:
sponsorSlots = 40;
break;
default: // от 5 и более
sponsorSlots = 50;
break;
}
#endif

var msg = new MsgPreferencesAndSettings
{
Preferences = prefs,
Settings = new GameSettings
{
MaxCharacterSlots = MaxCharacterSlots
#if LPP_Sponsors
+ sponsorSlots
#endif
}
};
_netManager.ServerSendMessage(msg, session.Channel);
Expand Down
41 changes: 31 additions & 10 deletions Content.Shared/Customization/Systems/CharacterRequirements.Job.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,14 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile,
}

#if LPP_Sponsors
if (sponsorTier >= 5 || (whitelisted && job.Requirements != null && job.Requirements.OfType<CharacterWhitelistRequirement>().Any()))
if (job.Requirements != null && job.Requirements.OfType<CharacterWhitelistRequirement>().Any())
if (!whitelisted)
{
reason = null;
return false;
}

if (sponsorTier >= 5)
{
reason = null;
return true;
Expand Down Expand Up @@ -232,7 +239,14 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile,
}

#if LPP_Sponsors
if (sponsorTier >= 5 || (whitelisted && job.Requirements != null && job.Requirements.OfType<CharacterWhitelistRequirement>().Any()))
if (job.Requirements != null && job.Requirements.OfType<CharacterWhitelistRequirement>().Any())
if (!whitelisted)
{
reason = null;
return false;
}

if (sponsorTier >= 5)
{
reason = null;
return true;
Expand Down Expand Up @@ -305,14 +319,6 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile,
return !Inverted;
}

#if LPP_Sponsors
if (sponsorTier >= 5 || (whitelisted && job.Requirements != null && job.Requirements.OfType<CharacterWhitelistRequirement>().Any()))
{
reason = null;
return true;
}
#endif

// Get SharedJobSystem
if (!entityManager.EntitySysManager.TryGetEntitySystem(out SharedJobSystem? jobSystem))
{
Expand All @@ -338,6 +344,21 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile,
var time = playTimes.GetValueOrDefault(Tracker);
reason = null;

#if LPP_Sponsors
if (job.Requirements != null && job.Requirements.OfType<CharacterWhitelistRequirement>().Any())
if (!whitelisted)
{
reason = null;
return false;
}

if (sponsorTier >= 5)
{
reason = null;
return true;
}
#endif

if (time > Max)
{
// Show the reason if invalid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: FelinidFluffyTailRings
bodyPart: Tail
markingCategory: Tail
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: DeltaV/Mobs/Customization/Felinid/felinid_tails.rsi
Expand All @@ -14,7 +14,7 @@
id: FelinidFluffyTail
bodyPart: Tail
markingCategory: Tail
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: DeltaV/Mobs/Customization/Felinid/felinid_tails.rsi
Expand All @@ -24,7 +24,7 @@
id: FelinidAlternativeTail
bodyPart: Tail
markingCategory: Tail
#speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: DeltaV/Mobs/Customization/Felinid/alternative_tail.rsi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
id: FelinidEarsBasic
bodyPart: HeadTop
markingCategory: HeadTop
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: Nyanotrasen/Mobs/Customization/felinid_ears.rsi
Expand All @@ -16,7 +16,7 @@
id: FelinidEarsCurled
bodyPart: HeadTop
markingCategory: HeadTop
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: Nyanotrasen/Mobs/Customization/felinid_ears.rsi
Expand All @@ -28,7 +28,7 @@
id: FelinidEarsDroopy
bodyPart: HeadTop
markingCategory: HeadTop
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: Nyanotrasen/Mobs/Customization/felinid_ears.rsi
Expand All @@ -40,7 +40,7 @@
id: FelinidEarsFuzzy
bodyPart: HeadTop
markingCategory: HeadTop
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: Nyanotrasen/Mobs/Customization/felinid_ears.rsi
Expand All @@ -52,7 +52,7 @@
id: FelinidEarsStubby
bodyPart: HeadTop
markingCategory: HeadTop
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: Nyanotrasen/Mobs/Customization/felinid_ears.rsi
Expand All @@ -64,7 +64,7 @@
id: FelinidEarsTall
bodyPart: HeadTop
markingCategory: HeadTop
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: Nyanotrasen/Mobs/Customization/felinid_ears.rsi
Expand All @@ -78,7 +78,7 @@
id: FelinidEarsTorn
bodyPart: HeadTop
markingCategory: HeadTop
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: Nyanotrasen/Mobs/Customization/felinid_ears.rsi
Expand All @@ -90,7 +90,7 @@
id: FelinidEarsWide
bodyPart: HeadTop
markingCategory: HeadTop
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: Nyanotrasen/Mobs/Customization/felinid_ears.rsi
Expand All @@ -104,7 +104,7 @@
id: FelinidTailBasic
bodyPart: Tail
markingCategory: Tail
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: Nyanotrasen/Mobs/Customization/felinid_tails.rsi
Expand All @@ -118,7 +118,7 @@
id: FelinidTailBasicWithBow
bodyPart: Tail
markingCategory: Tail
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: Nyanotrasen/Mobs/Customization/felinid_tails.rsi
Expand All @@ -134,7 +134,7 @@
id: FelinidTailBasicWithBell
bodyPart: Tail
markingCategory: Tail
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: Nyanotrasen/Mobs/Customization/felinid_tails.rsi
Expand All @@ -150,7 +150,7 @@
id: FelinidTailBasicWithBowAndBell
bodyPart: Tail
markingCategory: Tail
# speciesRestriction: [Felinid]
speciesRestriction: [Felinid, Human]
sponsorOnly: true
sprites:
- sprite: Nyanotrasen/Mobs/Customization/felinid_tails.rsi
Expand Down

0 comments on commit bf8622c

Please sign in to comment.