Ewe wrote: ↑Thu Jan 27, 2022 1:14 pm
zhazz wrote: ↑Wed Jan 26, 2022 11:34 pm
Items already have a unique identifier associated with them. It's visible in the combat log when looting with the
/lootall command from the Skywing Extension.
Keep in mind we don't have the source code for the game server or client. I'm not sure what kind of development work you've done, but reverse engineering and engine hacks for executables without having any source code are quite complex compared to having access to and compiling high level source code.
Of this I am aware
From my own limited experience, and talking with Valefort in the past, it is my understanding that nearly all of what is mod-able in the game happen either true the 2da files, or event subscriptions: e.g. PCEquipsItemEvent or AttackHitsTargetEvent.
Any changes or additions to the game code has to happen through these events, and some of them are unfortunately limited in what data they expose; either through no visibility at all for said data, or that data being read-only.
The following pseude-example (don't know all the syntax and loops and hoops) is how to possibly generate and use a unique character id.
The only time there will be an issue with it, is if the player decides to RCR their character (new DMFI Tool), while also changing the name of their character (RP reasons or mis-spellings). Name changes, however, are usually handled by the staff, or have been in the past at least.
Maybe our developers have already thought and scrapped this option, if so, I'll continue to scratch my head and hope something falls out.
Pseudo-code example of unique character id generation and usage.
Code: Select all
void OnCharacterLogInEvent(var oTarget, ..., ...)
{
const string DMFITOOL_CHARACTERID_KEY = "UniqueCharId";
if (!IsPC(oTarget))
return;
var oDMFITool = GetDMFIToolFromPC(oTarget);
var dictDMFIEntries = GetDatabaseFromDMFITool(oDMFITool); // Might be an array? I don't know.
string uniqueCharId = dictDMFIEntries.GetEntryByKey(DMFITOOL_CHARACTERID_KEY);
if (uniqueCharId != NULL && uniqueCharId != "")
return;
string uniquePlayerId = GlobalTools.GetCurrentPlayerId(); // Might be the CD-Key, might be something else.
string characterName = GetCharacterName(oTarget);
uniqueCharId = GlobalTools.MD5(uniquePlayerId + characterName);
dictDMFIEntries.AddEntry(DMFITOOL_CHARACTERID_KEY, uniqueCharId);
}
void OnItemAddedToContainer(var oTarget, var oItem, ..., ...)
{
const string DMFITOOL_CHARACTERID_KEY = "UniqueCharId";
const string TBL_PLAYER_CONTAINERS = "tblPlayerContainers";
if (!IsPC(oTarget))
return;
var oDMFITool = GetDMFIToolFromPC(oTarget); // Psedu-example
var dictDMFIEntries = GetDatabaseFromDMFITool(oDMFITool); // More Psedu-example
string uniqueCharId = dictDMFIEntries.GetEntryByKey(DMFITOOL_CHARACTERID_KEY);
string uniqueItemId = GetUniqueItemId(oItem); // Not sure how to do this (yet)
if(GlobalTools.Database.CheckEntryExists(TBL_PLAYER_CONTAINERS, new [] { uniqueCharId, uniqueItemId })) // Check for multi-column unique key.
return;
GlobalTools.Database.AddEntry(TBL_PLAYER_CONTAINERS, uniqueCharId, uniqueItemId);
}