How to get player affiliation?
-
Hi, Cannon. thanks for tell me this, i got the plugin and seen it, and seems you load those name from a list in ini file, not from memory(to get IDS_Name). But “make a map in ini and load it” not my target right now, im trying to load the faction info from memory just like load System IDS_Name by “pub::System::GetName(iSystemID, iNameIDS);” , then i can use the iNameIDS to get the name in DLL. If i can’t do this successful, i will give it up in this prototype version. ;D
All the same, thanks you guys.
-
Ah, I’d forgotten about that. When I first wrote those plugins I ran out of time trying to figure out how to get the ID string for the faction and gave up. I know a little more about how FL works now so I think it is possible to retrieve the ID string. I’ll think about it.
-
Hehe, the almost technical Issues has been solved, without faction name. So i will gave up this function in prototype 0.01, and return all faction name as L"Freeman" (hope Gordon not angry for this ;D).
Programming for Freelancer is most interesting ;D
-
Hehe, the almost technical Issues has been solved, without faction name. So i will gave up this function in prototype 0.01, and return all faction name as L"Freeman" (hope Gordon not angry for this ;D).
Programming for Freelancer is most interesting ;D
You got that right…
-
And how to call in this code flhook command “readcharfile <hisnick>” and catch rep_group value for affilation?</hisnick>
-
@HeIIoween
I want to directly get the group name from FLServer memory, but i have’t try any new way after post this post.I ask this for my project (paused), And the code you can find here, nothing is change:
http://code.google.com/p/flboardplugin/source/browse/trunk/Freelancer+Board+Prototype/sources/WebFrontEnd_GameInfo.cppAnd if you really want to load file, you may try this:
http://code.google.com/p/flboardplugin/source/browse/trunk/Freelancer+Board+Prototype/sources/WebFrontEnd_Profile.cppFeProfileDecodec function will load player profile to a string and return it. If you want to get something form the string, see FeProfileParse function.
That’s all i can offer, because i paused the project for my mod, and now i paused the mod for my website.
-
Why paused? Router?
-
Even if the thread is pretty old:
The easy way to get the faction name would be something like that:
int iPlayerRep; pub::Player::GetRep(iClientID, iPlayerRep); uint iAff; Reputation::Vibe::GetAffiliation(iPlayerRep, iAff, false); TString<16> tsNick; Reputation::get_nickname(tsNick, iAff); uint iGroupName; pub::Reputation::GetGroupName(iAff, iGroupName); HINSTANCE hInstance = GetModuleHandle("NameResources.dll"); if(!hInstance) { return; } char szBuf [1024]; int iLength = LoadString( hInstance, iGroupName, szBuf, sizeof(szBuf) ); ConPrint(L"Length: %i, text: %s\n", iLength, stows(szBuf).c_str());
tsNick will be the nickname (eg “li_n_grp”) and szBuf the full name (eg “Liberty Navy”). [If you don’t need to get the nickname you can ignore the TString part).
This will ofc only work if the name is stored in NameResources.dll (like the original fl faction names). So there’s prolly a better way but as said: That’s the crappy and easy one
-
@HeIIoween, Mainy problem is i been busy on work, and i cannot do 3 things at same time. My plan is first my website, then the mod, then the other related things include the plugin. But it is open source and base on GPL, so if you want to continue or make your new one, just feel free to do it.
@Crazy, MARK. LOL Useful code, Thanks Crazy.
-
In Console, I thought I used a function to get the name directly, but no, it returns the id and I used Freelancer’s function to read the string. It’s at 4347E0:
typedef UINT (*TGetString)( LPVOID, // resource table? UINT, // resource number LPWSTR, // buffer for string UINT // length of buffer (chars, not bytes) ); extern TGetString GetString; #define RSRC *(LPVOID*)0x67eca8 // the resource table // Make use of Freelancer's string buffer. LPWSTR const wstrbuf = (LPWSTR)0x66dc60; PUINT const wstrlen = (PUINT)0x6119f8; UINT strid; pub::Reputation::GetShortGroupName( fac, strid ); GetString( RSRC, strid, wstrbuf, *wstrlen );
-
Of course, you’re running the server, not the client. The function in FLServer.exe is at 4176B0. Same parameters, but RSRC is just 0/NULL. BTW, it returns the length of the string (0 if doesn’t exist; length of buffer minus one if too long). Buffer may be NULL, in which case it just finds the length.
-
Brrrr, problem is to found player affilation of player who destroyed dockable base, i mean…:
[player]
…
house = 0, fc_maquis_grp
house = -0.3, fc_corse_grp
house = -0.3, fc_brigands_grp
…
rep_group = fc_freelancer ; <-- this string
…for example to show in event mode:
basedestroy basename=Li01_08_Base basehash=3197728322 solarhash=2810150415 by=Poupkine with affilation=fc_freelancer
So at server side function to get affilation gives always 0?
-
I mean that from how FL works internally, players never have an affiliation. Of course they can have a rep-group, but they wont have an affiliation as regards the reputation methods and so on (-> get-affiliation always returning 0). Correct me if Im wrong.
-
w0dk4 wrote:
Ah, good to know!yes very… i always thought it was set via the NewCharacter.ini & linked into “co_ic_grp” & its reputations in empathy.ini
so… that’s SP only im reading here? For MP its set differently… especially when hook is involved. im very intrigued…