Skip to content

Commit

Permalink
Refactor crafting item label and fix AppendWithSpace behavior
Browse files Browse the repository at this point in the history
- Updated `AppendWithSpace` in `Item.cs`:
  - Corrected conditional logic to minimize nesting for clarity

- Simplified maker's mark logic in `BaseArmor.cs`, `BaseClothing.cs`, and `BaseWeapon.cs`:
  - Removed redundant nested `if` blocks for better readability
  • Loading branch information
eamousing authored and kamronbatman committed Jan 9, 2025
1 parent 758c6cd commit 858f071
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
5 changes: 3 additions & 2 deletions Projects/Server/Items/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4128,9 +4128,10 @@ public static void AppendWithSpace(StringBuilder builder, string text)
{
if (!string.IsNullOrEmpty(text))
{
if (builder.Length > 0) builder.Append(" ");
builder.Append(text);
return;
}
if (builder.Length > 0) builder.Append(" ");
builder.Append(text);
}

public virtual void OnSingleClickPreAOS(Mobile from)
Expand Down
7 changes: 2 additions & 5 deletions Projects/UOContent/Items/Armor/BaseArmor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1582,12 +1582,9 @@ public override void OnSingleClickPreAOS(Mobile from)
}

// Add maker's mark
if (PlayerConstructed)
if (PlayerConstructed && Crafter != null)
{
if (Crafter != null)
{
LabelTo(from, 1050043, Crafter.ToString()); // crafted by ~1_NAME~
}
LabelTo(from, 1050043, Crafter.ToString()); // crafted by ~1_NAME~
}
}

Expand Down
7 changes: 2 additions & 5 deletions Projects/UOContent/Items/Clothing/BaseClothing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -958,12 +958,9 @@ public override void OnSingleClickPreAOS(Mobile from)
}

// Add maker's mark
if (PlayerConstructed)
if (PlayerConstructed && Crafter != null)
{
if (Crafter != null)
{
LabelTo(from, 1050043, Crafter.ToString()); // crafted by ~1_NAME~
}
LabelTo(from, 1050043, Crafter.ToString()); // crafted by ~1_NAME~
}
}

Expand Down
7 changes: 2 additions & 5 deletions Projects/UOContent/Items/Weapons/BaseWeapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3509,12 +3509,9 @@ public override void OnSingleClickPreAOS(Mobile from)
}

// Add maker's mark
if (PlayerConstructed)
if (PlayerConstructed && Crafter != null)
{
if (Crafter != null)
{
LabelTo(from, 1050043, Crafter.ToString()); // crafted by ~1_NAME~
}
LabelTo(from, 1050043, Crafter.ToString()); // crafted by ~1_NAME~
}
}

Expand Down

0 comments on commit 858f071

Please sign in to comment.