Skip to content

Commit

Permalink
2.2.1
Browse files Browse the repository at this point in the history
- Update multiclient
- Fix 7-2 secret weapon logic
- Fix hint message coloring
  • Loading branch information
TRPG0 committed Jun 2, 2024
1 parent f4f47e4 commit 8fad610
Show file tree
Hide file tree
Showing 51 changed files with 4,620 additions and 444 deletions.
5 changes: 4 additions & 1 deletion apworld/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -2483,7 +2483,10 @@ def rules(ultrakillworld):
add_rule(multiworld.get_location("7-2: Switch #3", player),
lambda state: state.has("Red Skull (7-2)", player))
set_rule(multiworld.get_location("7-2: Secret Weapon", player),
lambda state: state.has_all({"Violence Switch I", "Violence Switch II", "Violence Switch III"}, player))
lambda state: (
arm2(state, player)
and state.has_all({"Violence Switch I", "Violence Switch II", "Violence Switch III"}, player)
))

set_rule(multiworld.get_location("Cleared 7-2", player),
lambda state: arm2(state, player))
Expand Down
6 changes: 3 additions & 3 deletions mod/ArchipelagoULTRAKILL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<Reference Include="0Harmony">
<HintPath>D:\steam games\steamapps\common\ULTRAKILL\BepInEx\core\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Archipelago.MultiClient.Net, Version=5.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Archipelago.MultiClient.Net.5.0.5\lib\net45\Archipelago.MultiClient.Net.dll</HintPath>
<Reference Include="Archipelago.MultiClient.Net, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Archipelago.MultiClient.Net.6.0.0-rc5\lib\net45\Archipelago.MultiClient.Net.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>D:\steam games\steamapps\common\ULTRAKILL\ULTRAKILL_Data\Managed\Assembly-CSharp.dll</HintPath>
Expand Down Expand Up @@ -74,7 +74,7 @@
<HintPath>D:\steam games\steamapps\common\ULTRAKILL\BepInEx\core\MonoMod.Utils.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Archipelago.MultiClient.Net.5.0.5\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>packages\Archipelago.MultiClient.Net.6.0.0-rc5\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="plog, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
2 changes: 1 addition & 1 deletion mod/Commands/Say.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Execute(Console con, string[] args)
else
{
string message = string.Join(" ", args);
Multiworld.Session.Socket.SendPacket(new SayPacket() { Text = message });
Multiworld.Session.Say(message);
return;
}
}
Expand Down
7 changes: 4 additions & 3 deletions mod/ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Color = UnityEngine.Color;
using Archipelago.MultiClient.Net.Packets;
using ArchipelagoULTRAKILL.Structures;
using TMPro;

namespace ArchipelagoULTRAKILL
{
Expand Down Expand Up @@ -133,9 +134,9 @@ public static void Initialize()
serverAddress = new StringField(playerPanel, "ADDRESS", "serverAddress", "archipelago.gg", false, true);
serverPassword = new StringField(playerPanel, "PASSWORD", "serverPassword", "", true, true);
hintMode = new BoolField(playerPanel, "HINT MODE", "hintMode", false, false);
new ConfigHeader(playerPanel, "Hint mode disables all randomization, and allows connecting to other games' slots to unlock hints while playing The Cyber Grind.", 12, TextAnchor.UpperLeft);
new ConfigHeader(playerPanel, "Hint mode disables all randomization, and allows connecting to other games' slots to unlock hints while playing The Cyber Grind.", 12, TextAlignmentOptions.TopLeft);

connectionInfo = new ConfigHeader(playerPanel, "", 16, TextAnchor.UpperCenter);
connectionInfo = new ConfigHeader(playerPanel, "", 16, TextAlignmentOptions.Top);

connectButton = new ButtonField(playerPanel, "CONNECT", "connectButton");
connectButton.onClick += () =>
Expand Down Expand Up @@ -205,7 +206,7 @@ public static void Initialize()
{
if (Multiworld.Authenticated)
{
if (value != "") Multiworld.Session.Socket.SendPacket(new SayPacket() { Text = value });
if (value != "") Multiworld.Session.Say(value);
chat.value = "";
}
};
Expand Down
2 changes: 1 addition & 1 deletion mod/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Core : BaseUnityPlugin
{
public const string PluginGUID = "trpg.archipelagoultrakill";
public const string PluginName = "Archipelago";
public const string PluginVersion = "2.2.0";
public const string PluginVersion = "2.2.1";

public static string workingPath;
public static string workingDir;
Expand Down
27 changes: 16 additions & 11 deletions mod/LocationManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Archipelago.MultiClient.Net.Enums;
using Archipelago.MultiClient.Net.Models;
using Archipelago.MultiClient.Net.Packets;
using ArchipelagoULTRAKILL.Components;
using ArchipelagoULTRAKILL.Structures;
Expand All @@ -7,6 +8,7 @@
using System.Linq;
using UnityEngine;
using Random = UnityEngine.Random;
using Color = UnityEngine.Color;

namespace ArchipelagoULTRAKILL
{
Expand Down Expand Up @@ -364,27 +366,27 @@ public static void GetRandomHint()
var locationId = available[Random.Range(0, available.Length)];

Multiworld.Session.Locations.ScoutLocationsAsync(true, locationId);
LocationInfoPacket info = Multiworld.Session.Locations.ScoutLocationsAsync(false, locationId).Result;
ScoutedItemInfo info = Multiworld.Session.Locations.ScoutLocationsAsync(false, locationId).Result[locationId];

string itemColor = ColorUtility.ToHtmlStringRGB(GetUKMessageColor(Multiworld.Session.Items.GetItemName(info.Locations[0].Item)));
Color color = GetUKMessageColor(Multiworld.Session.Items.GetItemName(info.Locations[0].Item));
string itemColor = ColorUtility.ToHtmlStringRGB(GetUKMessageColor(info.ItemName));
Color color = GetUKMessageColor(info.ItemName);
if (itemColor == "FFFFFF")
{
itemColor = ColorUtility.ToHtmlStringRGB(GetAPMessageColor(info.Locations[0].Flags));
color = GetAPMessageColor(info.Locations[0].Flags);
itemColor = ColorUtility.ToHtmlStringRGB(GetAPMessageColor(info.Flags));
color = GetAPMessageColor(info.Flags);
}
string playerColor = ColorUtility.ToHtmlStringRGB(Colors.PlayerOther);
string locationColor = ColorUtility.ToHtmlStringRGB(GetUKMessageColor(Multiworld.Session.Locations.GetLocationNameFromId(info.Locations[0].Location).Substring(0, 3)));
string locationColor = ColorUtility.ToHtmlStringRGB(GetUKMessageColor(info.LocationName.Substring(0, 3)));

string hint = "HINT: <color=#" + itemColor + "FF>";
hint += Multiworld.Session.Items.GetItemName(info.Locations[0].Item).ToUpper() + "</color> ";
if (Multiworld.Session.Players.GetPlayerName(info.Locations[0].Player) != Core.data.slot_name)
hint += "(<color=#" + playerColor + "FF>" + Multiworld.Session.Players.GetPlayerAlias(info.Locations[0].Player) + "</color>) ";
hint += "at <color=#" + locationColor + "FF>" + Multiworld.Session.Locations.GetLocationNameFromId(info.Locations[0].Location) + "</color>";
hint += info.ItemName.ToUpper() + "</color> ";
if (Multiworld.Session.Players.GetPlayerName(info.Player) != Core.data.slot_name)
hint += "(<color=#" + playerColor + "FF>" + Multiworld.Session.Players.GetPlayerAlias(info.Player) + "</color>) ";
hint += "at <color=#" + locationColor + "FF>" + info.LocationName + "</color>";

messages.Add(new Message
{
image = GetUKMessageImage(Multiworld.Session.Items.GetItemName(info.Locations[0].Item)),
image = GetUKMessageImage(info.ItemName),
color = color,
message = hint
});
Expand Down Expand Up @@ -645,6 +647,7 @@ public static Color GetUKMessageColor(string itemName)
case "5-2":
case "5-3":
case "5-4":
case "5-S":
case "LAYER 5: WRATH":
return Colors.Layer5;
case "Blue Skull (0-2)":
Expand Down Expand Up @@ -693,6 +696,7 @@ public static Color GetUKMessageColor(string itemName)
case "7-2":
case "7-3":
case "7-4":
case "7-S":
case "LAYER 7: VIOLENCE":
return Colors.Layer7;
case "P-1: SOUL SURVIVOR":
Expand Down Expand Up @@ -748,6 +752,7 @@ public static Color GetUKMessageColor(string itemName)
case "4-2":
case "4-3":
case "4-4":
case "4-S":
case "Clash Mode":
return Colors.Layer4;
case "Dual Wield":
Expand Down
34 changes: 17 additions & 17 deletions mod/Multiworld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace ArchipelagoULTRAKILL
{
public static class Multiworld
{
public static int[] AP_VERSION = new int[] { 0, 4, 6 };
public static int[] AP_VERSION = new int[] { 0, 5, 0 };
public static DeathLinkService DeathLinkService = null;
public static bool DeathLinkKilling = false;

Expand Down Expand Up @@ -260,10 +260,10 @@ public static bool Connect()

foreach (string weapon in Core.shopPrices.Keys)
{
LocationInfoPacket info = Session.Locations.ScoutLocationsAsync(false, LocationManager.locations[$"shop_{weapon}"]).Result;
long itemId = info.Locations[0].Item;
string itemName = Session.Items.GetItemName(itemId);
string playerName = Session.Players.GetPlayerName(info.Locations[0].Player);
long locationId = LocationManager.locations[$"shop_{weapon}"];
ScoutedItemInfo info = Session.Locations.ScoutLocationsAsync(false, LocationManager.locations[$"shop_{weapon}"]).Result[locationId];
string itemName = info.ItemName;
string playerName = Session.Players.GetPlayerName(info.Player);
UKType? type = LocationManager.GetTypeFromName(itemName);
if (type.HasValue)
{
Expand All @@ -280,7 +280,7 @@ public static bool Connect()
{
itemName = itemName,
playerName = playerName,
type = info.Locations[0].Flags
type = info.Flags
});
}
}
Expand Down Expand Up @@ -409,7 +409,7 @@ public static void PacketReceived(ArchipelagoPacketBase packet)
&& Session.Players.GetPlayerName(int.Parse(p.Data[0].Text)) == Core.data.slot_name
&& p.Data[1].Text == " sent ")
{
string itemName = Session.Items.GetItemName(long.Parse(p.Data[2].Text));
string itemName = Session.Items.GetItemName(long.Parse(p.Data[2].Text), Session.Players.GetPlayerInfo(p.Data[2].Player.Value).Game);
string forPlayer = Session.Players.GetPlayerAlias(int.Parse(p.Data[4].Text));
Color messageColor = Color.white;

Expand Down Expand Up @@ -473,7 +473,7 @@ public static void PacketReceived(ArchipelagoPacketBase packet)
}
if (long.TryParse(messagePart.Text, out long itemId))
{
string itemName = Session.Items.GetItemName(itemId) ?? $"Item: {itemId}";
string itemName = Session.Items.GetItemName(itemId, Session.Players.GetPlayerInfo(messagePart.Player.Value).Game) ?? $"Item: {itemId}";
richText += color + itemName + "</color>";
plainText += itemName;
}
Expand All @@ -487,7 +487,7 @@ public static void PacketReceived(ArchipelagoPacketBase packet)
color = "<color=#" + ColorUtility.ToHtmlStringRGB(Colors.Location) + "FF>";
if (long.TryParse(messagePart.Text, out long locationId))
{
string locationName = Session.Locations.GetLocationNameFromId(locationId) ?? $"Location: {locationId}";
string locationName = Session.Locations.GetLocationNameFromId(locationId, Session.Players.GetPlayerInfo(messagePart.Player.Value).Game) ?? $"Location: {locationId}";
richText += color + locationName + "</color>";
plainText += locationName;
}
Expand All @@ -513,24 +513,25 @@ public static void PacketReceived(ArchipelagoPacketBase packet)

public static void ItemReceived(ReceivedItemsHelper helper)
{
bool shouldGetItemAgain = LocationManager.ShouldGetItemAgain(LocationManager.GetTypeFromName(helper.PeekItemName()).Value);
bool shouldGetItemAgain = LocationManager.ShouldGetItemAgain(LocationManager.GetTypeFromName(helper.PeekItem().ItemName).Value);
bool silent = !(helper.Index > Core.data.index) && shouldGetItemAgain;
if (helper.Index > Core.data.index || shouldGetItemAgain)
{
string name = helper.PeekItemName();
string player = Session.Players.GetPlayerName(helper.PeekItem().Player);
ItemInfo item = helper.PeekItem();
string name = item.ItemName;
string player = Session.Players.GetPlayerName(item.Player);
if (player == Core.data.slot_name) player = null;
else player = (Session.Players.GetPlayerAlias(helper.PeekItem().Player) == "") ? "?" : Session.Players.GetPlayerAlias(helper.PeekItem().Player);
else player = (Session.Players.GetPlayerAlias(item.Player) == "") ? "?" : Session.Players.GetPlayerAlias(item.Player);
if (helper.Index > Core.data.index) Core.Logger.LogInfo("Name: \"" + name + "\" | Type: " + LocationManager.GetTypeFromName(name) + " | Player: \"" + player + "\"");

UKItem item = new UKItem()
UKItem ukitem = new UKItem()
{
itemName = name,
type = LocationManager.GetTypeFromName(name).Value,
playerName = Core.data.slot_name
};

LocationManager.itemQueue.Add(new QueuedItem(item, player, silent));
LocationManager.itemQueue.Add(new QueuedItem(ukitem, player, silent));
if (helper.Index > Core.data.index) Core.data.index++;
}
helper.DequeueItem();
Expand Down Expand Up @@ -570,8 +571,7 @@ public static void DeathLinkReceived(DeathLink deathLink)

public static void SendCompletion()
{
var packet = new StatusUpdatePacket() { Status = ArchipelagoClientState.ClientGoal };
Session.Socket.SendPacket(packet);
Session.SetGoalAchieved();
}
}
}
4 changes: 2 additions & 2 deletions mod/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.0")]
[assembly: AssemblyFileVersion("2.2.0")]
[assembly: AssemblyVersion("2.2.1")]
[assembly: AssemblyFileVersion("2.2.1")]
2 changes: 1 addition & 1 deletion mod/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Archipelago.MultiClient.Net" version="5.0.5" targetFramework="net472" />
<package id="Archipelago.MultiClient.Net" version="6.0.0-rc5" targetFramework="net472" />
</packages>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ A client library for use with .NET based applications for interfacing with Archi

# Documentation

### URI: https://archipelagomw.github.io/Archipelago.MultiClient.Net/index.html

## Create Session Instance

```csharp
Expand Down Expand Up @@ -406,5 +408,3 @@ public static void send_completion()
Session.Socket.SendPacket(statusUpdatePacket);
}
```


Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 8fad610

Please sign in to comment.