Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Client/MirScenes/Dialogs/BuffDialog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Client.MirControls;
using Client.MirControls;
using Client.MirGraphics;
using Client.MirSounds;

Expand All @@ -7,6 +7,7 @@ namespace Client.MirScenes.Dialogs
public class BuffDialog : MirImageControl
{
public List<ClientBuff> Buffs = new List<ClientBuff>();
public int BaseImageIndex { get; set; } = 20;

protected MirButton _expandCollapseButton;
protected MirLabel _buffCountLabel;
Expand All @@ -29,7 +30,7 @@ public BuffDialog()
{
Index = 20;
Library = Libraries.Prguse2;
Movable = false;
Movable = true;
Size = new Size(44, 34);
Location = new Point(Settings.ScreenWidth - 170, 0);
Sort = true;
Expand Down Expand Up @@ -214,7 +215,7 @@ private void UpdateWindow()
{
_buffCount = _buffList.Count;

var baseImage = 20;
var baseImage = BaseImageIndex;
var heightOffset = Location.Y;

//foreach (var dialog in GameScene.Scene.BuffDialogs)
Expand Down Expand Up @@ -255,7 +256,7 @@ private void UpdateWindow()
{
var oldWidth = Size.Width;

Index = 20;
Index = baseImage;

var newX = Location.X - Size.Width + oldWidth;
var newY = heightOffset;
Expand Down Expand Up @@ -560,7 +561,7 @@ public PoisonBuffDialog()
{
Index = 40;
Library = Libraries.Prguse2;
Movable = false;
Movable = true;
Size = new Size(44, 34);
Location = new Point(Settings.ScreenWidth - 170, 0);
Sort = true;
Expand Down Expand Up @@ -836,7 +837,7 @@ private void UpdateWindow()
{
_buffCount = _buffList.Count;

var baseImage = 20;
var baseImage = 40;
var heightOffset = 36;

if (_buffCount > 0 && Settings.ExpandedBuffWindow)
Expand Down Expand Up @@ -867,7 +868,7 @@ private void UpdateWindow()
{
var oldWidth = Size.Width;

Index = 20;
Index = 40;

var newX = Location.X - Size.Width + oldWidth;
var newY = heightOffset;
Expand Down
1 change: 1 addition & 0 deletions Client/MirScenes/GameScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6158,6 +6158,7 @@ private void HeroInformation(S.HeroInformation p)
Parent = this,
Visible = true,
Location = new Point(Settings.ScreenWidth - 170, 80),
BaseImageIndex = 40,
GetExpandedParameter = () => { return Settings.ExpandedHeroBuffWindow; },
SetExpandedParameter = (value) => { Settings.ExpandedHeroBuffWindow = value; }
};
Expand Down
18 changes: 18 additions & 0 deletions Server/MirDatabase/HeroInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ public override void Load(BinaryReader reader, int version, int customVersion)
magic.CastTime = int.MinValue;
Magics.Add(magic);
}

// Buff persistence (matches player CharacterInfo.Buffs)
if (version > 116)
{
count = reader.ReadInt32();
for (int i = 0; i < count; i++)
{
Buff buff = new Buff(reader, version, customVersion);
Buffs.Add(buff);
}
}

if (version > 99)
{
Expand Down Expand Up @@ -137,6 +148,13 @@ public override void Save(BinaryWriter writer)
Magics[i].Save(writer);
}

// Buff persistence (matches player CharacterInfo.Buffs)
writer.Write(Buffs.Count);
for (int i = 0; i < Buffs.Count; i++)
{
Buffs[i].Save(writer);
}

writer.Write(AutoPot);
writer.Write(Grade);
writer.Write(HPItemIndex);
Expand Down
2 changes: 1 addition & 1 deletion Server/MirEnvir/Envir.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class Envir
public static object LoadLock = new object();

public const int MinVersion = 60;
public const int Version = 116;
public const int Version = 117;
public const int CustomVersion = 0;
public static readonly string DatabasePath = Path.Combine(".", "Server.MirDB");
public static readonly string AccountPath = Path.Combine(".", "Server.MirADB");
Expand Down
2 changes: 2 additions & 0 deletions Server/MirObjects/HeroObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ protected override void Load(CharacterInfo info, MirConnection connection)
if (Level == 0) NewCharacter();

RefreshStats();
RefreshNameColour();
SendInfo();

switch (HP)
Expand Down Expand Up @@ -1201,6 +1202,7 @@ private void SendInfo()
{
ObjectID = ObjectID,
Name = Name,
NameColour = NameColour,
Class = Class,
Gender = Gender,
Level = Level,
Expand Down
6 changes: 6 additions & 0 deletions Server/MirObjects/PlayerObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1845,6 +1845,9 @@ public override Color GetNameColour(HumanObject human)
{
if (human == null) return NameColour;

// Heroes have a fixed, server-defined colour (do not apply PK/brown/warzone logic).
if (human is HeroObject hero) return hero.NameColour;

if (human is PlayerObject player)
{
if (player.PKPoints >= 200)
Expand Down Expand Up @@ -14486,6 +14489,9 @@ public void SealHero()

if (Hero != null)
{
// Sealing (marbling) a hero should wipe all buffs so they can't be stored/traded with remaining durations.
CurrentHero.Buffs?.Clear();

DespawnHero();
Info.HeroSpawned = false;
Enqueue(new S.UpdateHeroSpawnState { State = HeroSpawnState.None });
Expand Down
2 changes: 2 additions & 0 deletions Shared/ServerPackets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4707,6 +4707,7 @@ protected override void ReadPacket(BinaryReader reader)
{
ObjectID = reader.ReadUInt32();
Name = reader.ReadString();
NameColour = Color.FromArgb(reader.ReadInt32());
Class = (MirClass)reader.ReadByte();
Gender = (MirGender)reader.ReadByte();
Level = reader.ReadUInt16();
Expand Down Expand Up @@ -4756,6 +4757,7 @@ protected override void WritePacket(BinaryWriter writer)
{
writer.Write(ObjectID);
writer.Write(Name);
writer.Write(NameColour.ToArgb());
writer.Write((byte)Class);
writer.Write((byte)Gender);
writer.Write(Level);
Expand Down