Other question: Ids_name To "Friendly Name"
-
and M0tah, do you mind me add your code to my flhook? i will credit you ;D
Of course. I do say in the readme that
You may use it for
whatever purpose you wish. If you use it in one of your projects, I would
appreciate being mentioned somewhere.
Though if youāre just making a plugin it would make more sense to just use the flak_common plugin in its compiled form. All you have to do is include the FlakCommonExports.h file and put FlakCommon.lib in your linker dependency.Information i need to get: Player Name, Player Rank, Player Cash, Player Online Time Count, Last Base, Last System, Ship.
To get the friendly name of the ship youāll need to get the updated Archetype::Ship struct that includes iIDSName. Then you can get the ids_name of the ship like this:
uint iShipID; pub::Player::GetShipID(iClientID, iShipID); Archetype::Ship *ship = Archetype::GetShip(iShipID); if(ship->iIDSName) { wstring wscShip = stows(HkGetStringFromIDS(ship->iIDSName)); //do stuff with name here } ```To get the last system you'll have to keep track of it yourself, as I don't think FLServer does. Then you can get the IDS from **pub::System::GetName(uint iSystemID, uint iNameIDS)**. Also, a note on the HkGetStringFromIDS function. As you can see, it returns a string. However, you'd expect it to return a wstring instead because the data in stringtables is stored in unicode. This is because the CResString class that reads data from stringtables in DLLs (which I made modifications to and which HKGetStringFromIDS uses) internally converts the wide chars to regular chars. This means that any special characters in the strings will be lost. This will be fixed in the next version of flak_common. Thanks to JONG for reporting this bug.
-
and M0tah, do you mind me add your code to my flhook? i will credit you ;D
Of course. I do say in the readme that
You may use it for
whatever purpose you wish. If you use it in one of your projects, I would
appreciate being mentioned somewhere.
Though if youāre just making a plugin it would make more sense to just use the flak_common plugin in its compiled form. All you have to do is include the FlakCommonExports.h file and put FlakCommon.lib in your linker dependency.Information i need to get: Player Name, Player Rank, Player Cash, Player Online Time Count, Last Base, Last System, Ship.
To get the friendly name of the ship youāll need to get the updated Archetype::Ship struct that includes iIDSName. Then you can get the ids_name of the ship like this:
uint iShipID; pub::Player::GetShipID(iClientID, iShipID); Archetype::Ship *ship = Archetype::GetShip(iShipID); if(ship->iIDSName) { wstring wscShip = stows(HkGetStringFromIDS(ship->iIDSName)); //do stuff with name here } ```To get the last system you'll have to keep track of it yourself, as I don't think FLServer does. Then you can get the IDS from **pub::System::GetName(uint iSystemID, uint iNameIDS)**. Also, a note on the HkGetStringFromIDS function. As you can see, it returns a string. However, you'd expect it to return a wstring instead because the data in stringtables is stored in unicode. This is because the CResString class that reads data from stringtables in DLLs (which I made modifications to and which HKGetStringFromIDS uses) internally converts the wide chars to regular chars. This means that any special characters in the strings will be lost. This will be fixed in the next version of flak_common. Thanks to JONG for reporting this bug.
I see that problem about losting string, and other new problem is, then i include FlakCommon plugin in my DLL (or just install it as a plugin) , FLServer will crash at startā¦ā¦
-
@Nieckey: Could you give me the value of the āMod Nameā field in the dialog that tells you that FLServer has crashed? Also, are you using any freelancer.ini hacks that make it so Datastorm, etc donāt work? Finally, what version of the plugin version are you using?
@JONG: The flak_common plugin contains functions that I wrote in 88 Flakās FLHook. I made the plugin to facilitate making plugins out of the features in that FLHook, but it does not contain any new features on its own. If I didnāt have that plugin Iād have to include some of those functions in each plugin I made. Having them in a separate plugin means I only have to do that once. I hope that answers your question.
-
Hi M0tah, Where i can find the āMod Nameā field? i only get this when i start flserverā¦
and, i have some encoded Freelancer ini file, but im not remeber i hacked the Freelancer.ini
so that is a strange problemā¦.
PS, im try to copy your code to my plugin for geting string form dll by ids number, but compiler output some warning like C4267 C4018 C4311 C4312 in resstring.cpp, how to reslove it?
-
a simply idea for load DLL string:
i checked the ids number with FL-IDS, and i found this:
First DLLās IDS Number limlited: 0 - 65535;
Second: 65536(= 65535 + 1) - 131071(= 65536 + 65535);
Third: 131072(131071 + 1) - 196607(= 131072 + 65535);so, if a IDS_Name is 196932, it must in Third DLL (196932 / 65536 = 3.00494384765625 ignore all float), and String_ID is 196932 - (65536*3) = 324 ;D
-
You mean that you was fix the CResString ?
Do you mind to share your fix code ?
yep, i think it is, but i have not testing full yet. and please waiting im done my plug in OK?
PS. Im feeling strange to talking you with english, PM me on our web site all right? ;D
-
Hi M0tah, Where i can find the āMod Nameā field? i only get this when i start flserverā¦
Iām not sure what it is on Vista or in Chinese?, but here it is on Windows XP.
and, i have some encoded Freelancer ini file, but im not remeber i hacked the Freelancer.ini
This may be making the flak_common plugin not able to read the DLLs from the [Resources] section in Freelancer.ini. Iāll change the plugin to use FLās own INI_Reader in the next version, which will hopefully fix this problem.
PS, im try to copy your code to my plugin for geting string form dll by ids number, but compiler output some warning like C4267 C4018 C4311 C4312 in resstring.cpp, how to reslove it?
The compiler warnings shouldnāt be a problem - as long as you donāt get any errors it should work. Looks like you did get something working though.
So if I need your new FLHook 1.61 functions, I canāt use this FLHook plugin version, right ?
Right.
-
Iāve made the necessary changes to CResString for it to return wstrings.
In ResString.cpp add (after the int CResString::GetString( UINT nIndex, LPSTR pszText ) and string CResString::GetString( UINT nIndex ) methods respectively):```
int CResString::GetWString( UINT nIndex, LPWSTR pswzText )
{
if( NULL == pStrBlock )
{
return INVALID_BLOCK;
}
if( (nIndex < 0) || (nIndex >= NO_OF_STRINGS_PER_BLOCK) )
{
return INVALID_BLOCK_INDEX;
}
if( NULL == pswzText )
{
return INVALID_STRING;
}
wcscpy(pswzText, pStrBlock->strArray[nIndex]);return SUCCESS_MADE;
}
wstring CResString::GetWString( UINT nIndex )
{
wstring wscText;
LPWSTR pwText;
int nLen = GetStringLength( nIndex ); // Determin length of stringpwText = (LPWSTR)malloc(sizeof(LPWSTR) * nLen); // Allocate memory for string if( this->GetWString( nIndex, pwText ) ) // Retrieve string { wscText = pwText; free( pwText ); // Free memory from retrieving text return wscText; }else return L""; // Return string;
}
In ResString.h add (same as above):
// Retrieves the wstring at nIndex
int GetWString( UINT nIndex, LPWSTR pswzText );wstring GetWString( UINT nIndex );
In HkFuncTools.cpp add:
wstring HkGetWStringFromIDS(uint iIDS) //Only works for names
{
if(!iIDS)
return L"";uint iDLL = iIDS / 0x10000; iIDS -= iDLL * 0x10000; if(vDLLs[iDLL-1].GetStringBlock((iIDS / 16) + 1, 0) != 1000) return L""; return vDLLs[iDLL-1].GetWString(iIDS - ((iIDS / 16) * 16));
}
-
Yeah, the fix worked, but Euyis helps me to this by other way, ;D
and M0tah, im still trying to load system name and player rank, thanks for reply me on 88flak forum, but i canāt load that two thing successfuly, im not found GetRank or GetName in my SDK or FLHook also in FlakCommon plugin(without a āClass callā named āpub::Reputation::GetName(iPlayerRep, fsOut1, fsOut2);ā, but it be /**/edā¦.)ā¦, so that so strangeā¦
-
Thanks M0tah, now I can fix it myself.
Why you donāt share your āother wayā before the M0tah fix ?
This issue let me disable some function in flhook.
You know that, I will kill you ASAP. ;D
Sorry but im busy to do building a classified project so i have not any free time for clean up my code. ;D
-
Yes I know that, share or not, thatās up to you.
Seem like some issue, please look this picture:
You can find it have a ā=ā in those Chines word, how to fix it ?
Hehe, you need to clear one thing first, i donāt says āIm not shareā ;D
Actually, i must share this moded module because other people helps me. but i need to clean code first to take the code out from my project that need take time but im working on other thing. so i need time ;D
And, i shared my idea here, take a look my post on page 1, i just make the idea come true and get success ;D
-
Seem like some issue, please look this picture:
You can find it have a ā=ā in those Chines word, how to fix it ?
Does this happen with every IDS read or just with a specific one? And are characters the right ones other than the ā=ā? Iām not really sure what could be causing this.
and M0tah, im still trying to load system name and player rank, thanks for reply me on 88flak forum, but i canāt load that two thing successfuly, im not found GetRank or GetName in my SDK or FLHook also in FlakCommon plugin(without a āClass callā named āpub::Reputation::GetName(iPlayerRep, fsOut1, fsOut2);ā, but it be /**/edā¦.)ā¦, so that so strangeā¦
Both of the method declarations are in the FLCoreServer.h file in the FLCoreSDK. pub::System::GetName is on line 654 and pub::Player::GetRank is on line 525.
-
Itās happen with that, when the faction name or IDS name bigger then 3 Chinese characters (1 Chinese characters = 2 English characters), and every time the characters is not same like ā=ā, some time is āIā, some time is ā>ā, some time is other characters.
Chinese characters is use two bytes characters make up, its first characters bigger then ASCII 127, but the seconds characters is no limit, so how to get it ?
Oh, and one thing I forget to tell you, some time the player get killed by NPC, but it will show the player be killed by another player, even the player not in same systme, why ?
Clear one thing first ? Is what ?