Plus Notice With Item Link

07/27/2025 01:33 ryaneichner#1
#SOLVED
07/28/2025 11:03 romio100#2
thanks for the explanation and detailed code!
from my analysis of the code, the reason the item link isn't showing up in the Plus notification is: The linkKey format isn't in the correct client-supported format.
string linkKey = $"<{itemName}>"; is invalid.

The element link format officially supported by the client (such as iSRO/vSRO) is:
string linkKey = $"{session.SessionData.Charname}_{DateTime.UtcNow. Ticks}";
string message = $"[{session.SessionData.Charname}] Fuse $item:{linkKey} to Plus[{totalPlus}] {prefix}";

notice the big difference:

a linkKey is a unique key used in the cache (it's not based solely on the item name).

the message contains $item:{linkKey}, which makes the link appear, turn blue, and be clickable.

the correct code is

// Generate a unique key for the item
string linkKey = $"{session.SessionData.Charname}_{DateTime.UtcNow. Ticks}";

// Generate the message text with the item link
string message = $"[{session.SessionData.Charname}] Fuse $item:{linkKey} to Plus[{totalPlus}] {prefix}";

// Save the item data in the cache using the key
SharedObjects.ItemLinkInfo[linkKey] = fullItemInfo;

// Send the item link to the player
await session.SendItemLink(linkKey, fullItemInfo);

// Create the notification packet
var globalPacket = SERVER_AGENT_CHAT_UPDATE.of(ChatType.Notice, session.SessionData.Charname, message);

// Send the notification to the same player
await session.SendToClient(globalPacket);

// Send the notification and link to all other players
foreach (var s in SharedObjects.AgentSessions)
{
if (s != null && s != session)
{
await s.SendItemLink(linkKey, fullItemInfo);
await s.SendToClient(globalPacket);
}
}

Console.WriteLine("[Alchemy] Broadcast completed.");

the correct code is

// Generate a unique key for the item
string linkKey = $"{session.SessionData.Charname}_{DateTime.UtcNow. Ticks}";

// Generate the message text with the item link
string message = $"[{session.SessionData.Charname}] Fuse $item:{linkKey} to Plus[{totalPlus}] {prefix}";

// Save the item data in the cache using the key
SharedObjects.ItemLinkInfo[linkKey] = fullItemInfo;

// Send the item link to the player
await session.SendItemLink(linkKey, fullItemInfo);

// Create the notification packet
var globalPacket = SERVER_AGENT_CHAT_UPDATE.of(ChatType.Notice, session.SessionData.Charname, message);

// Send the notification to the same player
await session.SendToClient(globalPacket);

// Send the notification and link to all other players
foreach (var s in SharedObjects.AgentSessions)
{
if (s != null && s != session)
{
await s.SendItemLink(linkKey, fullItemInfo);
await s.SendToClient(globalPacket);
}
}

Console.WriteLine("[Alchemy] Broadcast completed.");

the correct code is

// Generate a unique key for the item
string linkKey = $"{session.SessionData.Charname}_{DateTime.UtcNow. Ticks}";

// Generate the message text with the item link
string message = $"[{session.SessionData.Charname}] Fuse $item:{linkKey} to Plus[{totalPlus}] {prefix}";

// Save the item data in the cache using the key
SharedObjects.ItemLinkInfo[linkKey] = fullItemInfo;

// Send the item link to the player
await session.SendItemLink(linkKey, fullItemInfo);

// Create the notification packet
var globalPacket = SERVER_AGENT_CHAT_UPDATE.of(ChatType.Notice, session.SessionData.Charname, message);

// Send the notification to the same player
await session.SendToClient(globalPacket);

// Send the notification and link to all other players
foreach (var s in SharedObjects.AgentSessions)
{
if (s != null && s != session)
{
await s.SendItemLink(linkKey, fullItemInfo);
await s.SendToClient(globalPacket);
}
}

Console.WriteLine("[Alchemy] Broadcast completed.");

the correct code is

// Generate a unique key for the item
string linkKey = $"{session.SessionData.Charname}_{DateTime.UtcNow. Ticks}";

// Generate the message text with the item link
string message = $"[{session.SessionData.Charname}] Fuse $item:{linkKey} to Plus[{totalPlus}] {prefix}";

// Save the item data in the cache using the key
SharedObjects.ItemLinkInfo[linkKey] = fullItemInfo;

// Send the item link to the player
await session.SendItemLink(linkKey, fullItemInfo);

// Create the notification packet
var globalPacket = SERVER_AGENT_CHAT_UPDATE.of(ChatType.Notice, session.SessionData.Charname, message);

// Send the notification to the same player
await session.SendToClient(globalPacket);

// Send the notification and link to all other players
foreach (var s in SharedObjects.AgentSessions)
{
if (s != null && s != session)
{
await s.SendItemLink(linkKey, fullItemInfo);
await s.SendToClient(globalPacket);
}
}

Console.WriteLine("[Alchemy] Broadcast completed.");

Correct code file dll




if (msg->msgid() == 0x184B)
{
BYTE type;
std::n_string notice;

*msg >> type >> notice;

// Convert the notification to a wide string (for Unicode)
std::wstring wNotice = notice.to_wstring();

// Default color for text in chat
D3DCOLOR color = D3DCOLOR_ARGB(255, 255, 255, 255);

// Customize the color based on the notification type
switch (type)
{
case 1: // Notice
g_pCGInterface->ShowMessage_Notice(wNotice.c_str());
g_pCGInterface->GetSystemMessageView()->WriteMessage(0xff, D3DCOLOR_RGBA(0x68, 0xBB, 0xE3, 255), wNotice.c_str(), 0, 1);
break;

case 2://Warning
g_pCGInterface->ShowMessage_Warning(wNotice.c_str());
g_pCGInterface->GetSystemMessageView()->WriteMessage(0xff, D3DCOLOR_RGBA(0xFF, 0xB2, 0x2E, 255), wNotice.c_str(), 0, 1);
break;

case 3: //Quest
g_pCGInterface->ShowMessage_Quest(wNotice.c_str());
g_pCGInterface->GetSystemMessageView()->WriteMessage(0xff, D3DCOLOR_RGBA(0x2E, 0xFF, 0x2E, 255), wNotice.c_str(), 0, 1);
break;

default:
break;
}

// Always write to the bottom chat window
CIFChatViewer* chatView = (CIFChatViewer*)g_pCGInterface->m_IRM.GetResObj(1, 1);
if (chatView)
{
chatView->WriteToChatW(wNotice.c_str(), color, 1);
}
}
07/28/2025 17:32 ryaneichner#3
Quote:
Originally Posted by romio100 View Post
thanks for the explanation and detailed code!
from my analysis of the code, the reason the item link isn't showing up in the Plus notification is: The linkKey format isn't in the correct client-supported format.
string linkKey = $"<{itemName}>"; is invalid.

The element link format officially supported by the client (such as iSRO/vSRO) is:
string linkKey = $"{session.SessionData.Charname}_{DateTime.UtcNow. Ticks}";
string message = $"[{session.SessionData.Charname}] Fuse $item:{linkKey} to Plus[{totalPlus}] {prefix}";

notice the big difference:

a linkKey is a unique key used in the cache (it's not based solely on the item name).

the message contains $item:{linkKey}, which makes the link appear, turn blue, and be clickable.

the correct code is

// Generate a unique key for the item
string linkKey = $"{session.SessionData.Charname}_{DateTime.UtcNow. Ticks}";

// Generate the message text with the item link
string message = $"[{session.SessionData.Charname}] Fuse $item:{linkKey} to Plus[{totalPlus}] {prefix}";

// Save the item data in the cache using the key
SharedObjects.ItemLinkInfo[linkKey] = fullItemInfo;

// Send the item link to the player
await session.SendItemLink(linkKey, fullItemInfo);

// Create the notification packet
var globalPacket = SERVER_AGENT_CHAT_UPDATE.of(ChatType.Notice, session.SessionData.Charname, message);

// Send the notification to the same player
await session.SendToClient(globalPacket);

// Send the notification and link to all other players
foreach (var s in SharedObjects.AgentSessions)
{
if (s != null && s != session)
{
await s.SendItemLink(linkKey, fullItemInfo);
await s.SendToClient(globalPacket);
}
}

Console.WriteLine("[Alchemy] Broadcast completed.");

the correct code is

// Generate a unique key for the item
string linkKey = $"{session.SessionData.Charname}_{DateTime.UtcNow. Ticks}";

// Generate the message text with the item link
string message = $"[{session.SessionData.Charname}] Fuse $item:{linkKey} to Plus[{totalPlus}] {prefix}";

// Save the item data in the cache using the key
SharedObjects.ItemLinkInfo[linkKey] = fullItemInfo;

// Send the item link to the player
await session.SendItemLink(linkKey, fullItemInfo);

// Create the notification packet
var globalPacket = SERVER_AGENT_CHAT_UPDATE.of(ChatType.Notice, session.SessionData.Charname, message);

// Send the notification to the same player
await session.SendToClient(globalPacket);

// Send the notification and link to all other players
foreach (var s in SharedObjects.AgentSessions)
{
if (s != null && s != session)
{
await s.SendItemLink(linkKey, fullItemInfo);
await s.SendToClient(globalPacket);
}
}

Console.WriteLine("[Alchemy] Broadcast completed.");

the correct code is

// Generate a unique key for the item
string linkKey = $"{session.SessionData.Charname}_{DateTime.UtcNow. Ticks}";

// Generate the message text with the item link
string message = $"[{session.SessionData.Charname}] Fuse $item:{linkKey} to Plus[{totalPlus}] {prefix}";

// Save the item data in the cache using the key
SharedObjects.ItemLinkInfo[linkKey] = fullItemInfo;

// Send the item link to the player
await session.SendItemLink(linkKey, fullItemInfo);

// Create the notification packet
var globalPacket = SERVER_AGENT_CHAT_UPDATE.of(ChatType.Notice, session.SessionData.Charname, message);

// Send the notification to the same player
await session.SendToClient(globalPacket);

// Send the notification and link to all other players
foreach (var s in SharedObjects.AgentSessions)
{
if (s != null && s != session)
{
await s.SendItemLink(linkKey, fullItemInfo);
await s.SendToClient(globalPacket);
}
}

Console.WriteLine("[Alchemy] Broadcast completed.");

the correct code is

// Generate a unique key for the item
string linkKey = $"{session.SessionData.Charname}_{DateTime.UtcNow. Ticks}";

// Generate the message text with the item link
string message = $"[{session.SessionData.Charname}] Fuse $item:{linkKey} to Plus[{totalPlus}] {prefix}";

// Save the item data in the cache using the key
SharedObjects.ItemLinkInfo[linkKey] = fullItemInfo;

// Send the item link to the player
await session.SendItemLink(linkKey, fullItemInfo);

// Create the notification packet
var globalPacket = SERVER_AGENT_CHAT_UPDATE.of(ChatType.Notice, session.SessionData.Charname, message);

// Send the notification to the same player
await session.SendToClient(globalPacket);

// Send the notification and link to all other players
foreach (var s in SharedObjects.AgentSessions)
{
if (s != null && s != session)
{
await s.SendItemLink(linkKey, fullItemInfo);
await s.SendToClient(globalPacket);
}
}

Console.WriteLine("[Alchemy] Broadcast completed.");

Correct code file dll




if (msg->msgid() == 0x184B)
{
BYTE type;
std::n_string notice;

*msg >> type >> notice;

// Convert the notification to a wide string (for Unicode)
std::wstring wNotice = notice.to_wstring();

// Default color for text in chat
D3DCOLOR color = D3DCOLOR_ARGB(255, 255, 255, 255);

// Customize the color based on the notification type
switch (type)
{
case 1: // Notice
g_pCGInterface->ShowMessage_Notice(wNotice.c_str());
g_pCGInterface->GetSystemMessageView()->WriteMessage(0xff, D3DCOLOR_RGBA(0x68, 0xBB, 0xE3, 255), wNotice.c_str(), 0, 1);
break;

case 2://Warning
g_pCGInterface->ShowMessage_Warning(wNotice.c_str());
g_pCGInterface->GetSystemMessageView()->WriteMessage(0xff, D3DCOLOR_RGBA(0xFF, 0xB2, 0x2E, 255), wNotice.c_str(), 0, 1);
break;

case 3: //Quest
g_pCGInterface->ShowMessage_Quest(wNotice.c_str());
g_pCGInterface->GetSystemMessageView()->WriteMessage(0xff, D3DCOLOR_RGBA(0x2E, 0xFF, 0x2E, 255), wNotice.c_str(), 0, 1);
break;

default:
break;
}

// Always write to the bottom chat window
CIFChatViewer* chatView = (CIFChatViewer*)g_pCGInterface->m_IRM.GetResObj(1, 1);
if (chatView)
{
chatView->WriteToChatW(wNotice.c_str(), color, 1);
}
}


Thanks alot i will try this <3

Have a good day sir.