Yeah and then back to why I started this topic:
How do I change the items.xml to match the ids? It's basically what I try to do.
You make it seem like it's so easy but it's exactly what I try do here....
And I don't know how to change the items.otb to it either. So I am stuck at this point.
I either try convert CipSoft item ids to OT ids, and put them in items.xml.
Or I must somehow change the items.xml and items.otb to CipSoft id, also my map editor.
How can I edit the items.otb?
I have my default Avesta 7.4 items.xml and it is so incorrect on so many things.
That's why I extracted the items from 7.72 leaked files and made some changes.
But now I have a list of the (correct) item names, descriptions, etc. But it's using id like 3031 for gold.
I need to convert these to 2148 for gold, etc.
I found 1 function in the C++ code but I have no idea how to make a new function for it.
Code:
const ItemType& Items::getItemIdByClientId(int32_t spriteId) const
{
uint32_t i = 100;
ItemType* iType;
do{
iType = items.getElement(i);
if(iType && iType->clientId == spriteId){
return *iType;
}
i++;
}while(iType);
static ItemType dummyItemType; // use this for invalid ids
return dummyItemType;
}
And it's used here:
Code:
else if(pos.y == 0 && pos.z == 0){
const ItemType& it = Item::items.getItemIdByClientId(spriteId);
if(it.id == 0){
return NULL;
}
int32_t subType = -1;
if(it.isFluidContainer()){
int32_t maxFluidType = sizeof(reverseFluidMap) / sizeof(uint32_t);
if(index < maxFluidType){
subType = reverseFluidMap[index];
}
}
return findItemOfType(player, it.id, true, subType);
}
But how can I make it like a command in-game to help me convert my id 3031 to 2148?
I wanna make it available in the Lua commands.
So I can write like:
/convert 3031
and in my console it will print 2148.
This way I can convert all my items to the ot id.
So there is this function in C++:
Item::items.getItemIdByClientId(spriteId);
How can I make a custom command in C++ that would call this function?
Anyone is good at it?
This is using Avesta 7.4 sources.
For example in the game there is that "getThing(uid)" command.
Any way to copy it and modify it a bit, to make it call the "
getItemIdByClientId(spriteId)" function?
I'm sure someone has done it. I googled a lot and I found maaaany topics about this stuff. But nobody posted a solution yet.
But some people said they had fixed it. So if anyone knows how to make a custom command in the C++ files, tell me what files to edit and where to put the code, then I recompile and try it.
I wanna make in-game command:
/convert (item id)
eg. /convert 3031
and it will call C++ function
getItemIdByClientId(spriteId) and then return the id
If I can't do it via code, I will sit 12 hours and go through items.xml (Avesta 7.4) with my correct items.xml (CipSoft) and manually do the changes. But it seems like a waste of time, when you can maybe make a command for it in-game.
Then I put an array of all my CipSoft id's and run the function, it prints out the values (or saves to a .txt file) and I'm done!
tl/dr: I have a list of CipSoft item id's (correct name, description, article, etc...) and I want to put them in my items.xml (Avesta). Best way would be to maybe make an in-game lua command that calls a C++ function, that converts the item id's. Then the output of that command will be a list of all corrected id's, then I can just put them in my items.xml