How to get player affiliation?
-
Here is my other question, i tried to get player faction name, and found below code in FlakCommon
/*//Bad; can get repgroup id but not the nickname from it
HK_GET_CLIENTID(iClientID, wscCharname);
// check if logged in
if(iClientID == -1)
return HKE_PLAYER_NOT_LOGGED_IN;uint iRepGroupID;
uint iGroupName;
int iPlayerRep;
pub::Player::GetRep(iClientID, iPlayerRep);
pub::Reputation::GetAffiliation(iPlayerRep, iRepGroupID);
pub::Reputation::GetGroupName(iRepGroupID, iGroupName);
TString<16> nick;
Reputation::get_nickname(nick, iGroupName);
wscRepGroup = stows(nick.data);
FmtStr fsOut1 = FmtStr(0 , FmtStr::Val()), fsOut2 = FmtStr(0 , FmtStr::Val()); // I don’t know what’s this.
pub::Reputation::GetName(iPlayerRep, fsOut1, fsOut2);
wscRepGroup = stows(fsOut1.szBuf);*/but it not work, i copy it and make a new one like this:
uint iRepGroupID;
uint iGroupName;
int iPlayerRep;pub::Player::GetRep(iClientID, iPlayerRep);
pub::Reputation::GetAffiliation(iPlayerRep, iRepGroupID);
pub::Reputation::GetGroupName(iRepGroupID, iGroupName);stringstream  sstrm;
sstrm  << iGroupName << “|” << iPlayerRep << “|” << iRepGroupID;ConPrint(s2ws(sstrm.str())); Â
ConPrint show 0|1|4294967295, so, iGroupName is 0. can any body tell me how to get faction name in right way?
-
Thanks guys ;D
hummmm, i make a program for load decoded FLProfile, and get the rep_group = node, that is a nickname so i “(unsigned int)CreateID(sPfile.c_str())” it to get the ID, and i want to use this ID to get the faction name, how can i do this?
-
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?