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
12 changes: 6 additions & 6 deletions Client/MirScenes/Dialogs/BuffDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,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 +214,7 @@ private void UpdateWindow()
{
_buffCount = _buffList.Count;

var baseImage = 20;
var baseImage = (Index >= 40 && Index <= 53) ? 40 : 20;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't understand this logic?

If there are 2 buff dialog colours, then you should have a new property that controls which one to use

var heightOffset = Location.Y;

//foreach (var dialog in GameScene.Scene.BuffDialogs)
Expand Down Expand Up @@ -255,7 +255,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 +560,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 +836,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 +867,7 @@ private void UpdateWindow()
{
var oldWidth = Size.Width;

Index = 20;
Index = 40;

var newX = Location.X - Size.Width + oldWidth;
var newY = heightOffset;
Expand Down
7 changes: 7 additions & 0 deletions Client/MirScenes/GameScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5186,6 +5186,8 @@ private void AddBuff(S.AddBuff p)

if (Hero != null && buff.ObjectID == Hero.ObjectID)
{
if (HeroBuffsDialog.Index < 40 || HeroBuffsDialog.Index > 53) HeroBuffsDialog.Index = 40;

for (int i = 0; i < HeroBuffsDialog.Buffs.Count; i++)
{
if (HeroBuffsDialog.Buffs[i].Type != buff.Type) continue;
Expand Down Expand Up @@ -5237,6 +5239,8 @@ private void RemoveBuff(S.RemoveBuff p)

if (Hero != null && Hero.ObjectID == p.ObjectID)
{
if (HeroBuffsDialog.Index < 40 || HeroBuffsDialog.Index > 53) HeroBuffsDialog.Index = 40;

for (int i = 0; i < HeroBuffsDialog.Buffs.Count; i++)
{
if (HeroBuffsDialog.Buffs[i].Type != p.Type) continue;
Expand Down Expand Up @@ -5293,6 +5297,8 @@ private void PauseBuff(S.PauseBuff p)

if (Hero != null && Hero.ObjectID == p.ObjectID)
{
if (HeroBuffsDialog.Index < 40 || HeroBuffsDialog.Index > 53) HeroBuffsDialog.Index = 40;

for (int i = 0; i < HeroBuffsDialog.Buffs.Count; i++)
{
if (HeroBuffsDialog.Buffs[i].Type != p.Type) continue;
Expand Down Expand Up @@ -6161,6 +6167,7 @@ private void HeroInformation(S.HeroInformation p)
GetExpandedParameter = () => { return Settings.ExpandedHeroBuffWindow; },
SetExpandedParameter = (value) => { Settings.ExpandedHeroBuffWindow = value; }
};
HeroBuffsDialog.Index = 40;
MainDialog.HeroInfoPanel.Update();

Hero.RefreshStats();
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