Skip to content

Commit

Permalink
- Remove redundant warning
Browse files Browse the repository at this point in the history
  • Loading branch information
agilbert1412 committed Jun 5, 2024
1 parent 4c9c404 commit c1e5af7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions StardewArchipelago/Archipelago/ArchipelagoClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ private string FixDatapackageIds(ItemSendLogMessage itemMessage, string message)
{
if (long.TryParse(words[i], out var id) && words[i].StartsWith("7"))
{
var locationName = GetLocationName(id);
var locationName = GetLocationName(id, false);
if (!string.IsNullOrWhiteSpace(locationName) && locationName != words[i] && locationName != MISSING_LOCATION_NAME)
{
words[i] = locationName;
Expand Down Expand Up @@ -534,7 +534,7 @@ public List<ReceivedItem> GetAllReceivedItems()
var apItem = apItems[itemIndex];
var itemName = GetItemName(apItem.Item);
var playerName = GetPlayerName(apItem.Player);
var locationName = GetLocationName(apItem.Location) ?? "Thin air";
var locationName = GetLocationName(apItem.Location);

var receivedItem = new ReceivedItem(locationName, itemName, playerName, apItem.Location, apItem.Item, apItem.Player, itemIndex);

Expand Down Expand Up @@ -627,7 +627,7 @@ public void ReportGoalCompletion()
_session.Socket.SendPacket(statusUpdatePacket);
}

public string GetLocationName(long locationId)
public string GetLocationName(long locationId, bool required = true)
{
if (!MakeSureConnected())
{
Expand All @@ -641,8 +641,12 @@ public string GetLocationName(long locationId)
}

if (string.IsNullOrWhiteSpace(locationName))
{
_console.Log($"Failed at getting the location name for location {locationId}. This is probably due to a corrupted datapackage. Unexpected behaviors may follow", LogLevel.Error);
{
if (required)
{
_console.Log($"Failed at getting the location name for location {locationId}. This is probably due to a corrupted datapackage. Unexpected behaviors may follow", LogLevel.Error);
}

return MISSING_LOCATION_NAME;
}

Expand Down

0 comments on commit c1e5af7

Please sign in to comment.