Skip to content

Commit

Permalink
Fixed wapr mirror spell description
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurocosh committed Mar 16, 2024
1 parent a26eb22 commit c6c455d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
16 changes: 16 additions & 0 deletions Content/Items/Mirrors/BoundMagicMirror.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public override ModItem Clone(Item item)
clone.WorldName = WorldName;
clone.LocationName = LocationName;
clone.BoundLocation = BoundLocation;
clone.UpdateName();
return clone;
}

Expand Down Expand Up @@ -110,6 +111,7 @@ public override void LoadData(TagCompound tag)
float locationX = tag.GetFloat("BoundLocationX");
float locationY = tag.GetFloat("BoundLocationY");
BoundLocation = new Vector2(locationX, locationY);
UpdateName();
}

public override bool? UseItem(Player player)
Expand All @@ -132,6 +134,20 @@ public override void NetReceive(BinaryReader reader)
float locationX = reader.ReadSingle();
float locationY = reader.ReadSingle();
BoundLocation = new Vector2(locationX, locationY);
UpdateName();
}

public void UpdateName()
{
if (LocationName.Length == 0)
{
Item.ClearNameOverride();
}
else
{
var itemName = Lang.GetItemNameValue(Type);
Item.SetNameOverride($"{itemName} ({LocationName})");
}
}

// UseStyle is called each frame that the item is being actively used.
Expand Down
1 change: 1 addition & 0 deletions Content/Spells/Enchant/BindMirrorSpell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public override bool Cast(Player player, int playerLevel, SpellData spellData)
modItem.WorldName = Main.worldName;
modItem.LocationName = locationName;
modItem.BoundLocation = player.position;
modItem.UpdateName();

if (Main.netMode == NetmodeID.MultiplayerClient)
NetMessage.SendData(MessageID.SyncItem, -1, -1, null, itemId, 1);
Expand Down
8 changes: 6 additions & 2 deletions Localization/en-US.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,11 @@ Mods: {
'''
Creates a bound mirror from a silver mirror. Bound mirror is linked to the place where it
was created. When a mirror is used it will teleport the user to the linked place. This spell
can be extended. To the incantation a column followed by any text can be appended. Following
can be extended. To the incantation a colon (:) followed by any text can be appended. Following
text will be recorded in the mirror shard as a label.
Bound mirrors are infinite use items.

Incantation "Bind mirror" will create bound mirror without a label. Incantation "Bind Mirror: Home base" will create bound mirror with a label "Home base".
'''
}

Expand All @@ -710,9 +712,11 @@ Mods: {
'''
Creates a warped mirror from a silver mirror. Warped mirror is linked to the place where
it was created. When a mirror is used it will teleport the user to the linked place. This
spell can be extended. To the incantation a column followed by any text can be appended.
spell can be extended. To the incantation a colon (:) followed by any text can be appended.
Following text will be recorded in the mirror shard as a label.
Warped mirrors are single use items.

Incantation "Warp mirror" will create warped mirror without a label. Incantation "Warp Mirror: Home base" will create warped mirror with a label "Home base".
'''
}

Expand Down
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
displayName = Spellwright
author = Aurocosh
version = 0.8.2.2
version = 0.8.2.3
dllReferences = NetSerializer
languageVersion = 7
buildIgnore = *.csproj, *.sln, *.user, *.md, obj\*, bin\*, .vs\*, .git\*, .gitignore
Expand Down

0 comments on commit c6c455d

Please sign in to comment.