Obtain the ID of Last Item/Weapon/Armor Received

I feel like this is probably something simple, but I'm having issues trying to figure it out. What I'm trying to do is use Yanfly's Message Core to put an items name in a message. The tricky part is that I'm not only using instanced items (with Item Core), but also using DreamX's Prefixes and Suffixes. I'd rather not have a message stating "You received a sword" while the actual item that will appear in inventory is a Fire Sword, or whatever. From what I understand, Item Core is creating a new item ID with the instanced item, and then DreamX's plugin takes the added pre/suffixes and creates yet another new item ID. I need to be able to retrieve that last one. Is it possible? Or, I suppose it would also work to figure out how DreamX's plugin creates the new item in database and get the ID that way? Sorry for being long winded, hopefully my explanation makes sense.
I've been twisting my brain over this, and have come, maybe, half way to achieving what I want? The code I came up with is returning the name of the nth item in my database instead of my inventory. I tried to use $gameParty.items[], but it didn't work (or maybe I was just doing it wrong). I feel like I'm so close, yet so far away! please, send help! ;_;

JavaScript:
var itemCount = 0;

for(var i = 0; i < $dataItems.length; i++){

itemCount += $gameParty.numItems($dataItems[i]);

}

$gameMessage.add("You got " + $dataItems[itemCount].name + "!");
Please try my plugin for this.
Maliki's Last Item Register

It's a snippet, so if you need more help, let me know.
Please try my plugin for this.
Maliki's Last Item Register

It's a snippet, so if you need more help, let me know.
Thank you so much for your help! I tried it out, though and it keeps returning 0 for the id and undefined for the name. I could be doing something wrong, but here's the script I'm using:

$gameVariables.setValue(21, $gameVariables.value(22).id)
$gameMessage.add("You got " + $gameVariables.value(21).id + "!");

$gameVariables.setValue(21, $gameVariables.value(22).name)
$gameMessage.add("You got " + $gameVariables.value(21).name + "!");

I've also tried it with out the .id or .name. Sorry for troubling you further, but any help would be appreciated.
Maliki, Game_Party doesn't have a registerNewItem function. What are you overwriting and where is it being called?
Oh sorry. The function is made in YFs Item Core so my plugin will need to be placed under that. The OP mentioned it, so I thought they had it installed.

Also, the name of the plugin must be the same as the header (Mal_lastitemRegister.js)
Been mulling over this for two days. I figured out a way to do it using the "On Independent Item Creation" Lunatic Mode for Yanfly's Item Core.

First, any weapons/items that will have their names randomized/changed get this tag:

<On Creation Eval>
$gameVariables.setValue(x, item.name) //(where x is a variable of your choice)
</On Creation Eval>

Then, this script call will properly display the item's altered name.

$gameMessage.add("You got " + $gameVariables.value(12) + "!");

I have no idea if this will work for anyone else because I have never done anything with java before but it seems to work for my project, at least so far. Thanks to everyone in this thread for the ideas, I hope my caveman efforts can be of use.

Original thread: https://forums.rpgmakerweb.com/threads/obtain-the-id-of-last-item-weapon-armor-received.124665/