Jump to content

Python client -> pc.get_sex?


Recommended Posts

  • Premium

Try:

PythonPlayer.h

search:

DWORD	GetRace();

under add this:

const char * GetSex();

PythonPlayer.cpp

 

search:

DWORD CPythonPlayer::GetRace()

under add this:

const char * CPythonPlayer::GeSex()
{
	switch(GetRace())
	{
		case MAIN_RACE_WARRIOR_W:
		case MAIN_RACE_ASSASSIN_W:
		case MAIN_RACE_SURA_W:
		case MAIN_RACE_SHAMAN_W:
			return "w";
			break;
		case MAIN_RACE_WARRIOR_M:
		case MAIN_RACE_ASSASSIN_M:
		case MAIN_RACE_SURA_M:
		case MAIN_RACE_SHAMAN_M:
			return "m";
			break;

	}
		return "m"; //this is the default value
}

PythonPlayerModule.cpp

search:

PyObject * playerGetRace(PyObject* poSelf, PyObject* poArgs)

under add this:

PyObject * PlayerGetSex(PyObject* poSelf, PyObject* poArgs)
{
	return PyBuildValue("s", CPythonPlayer::Instance().GetSex());
}

now search:

{ "GetRace",					playerGetRace,						METH_VARARGS },

under add this:

{ "GetSex",						PlayerGetSex,						METH_VARARGS },
  • Love 2
Link to comment
Share on other sites

Python form ;

import playerSettingModule
import net

def IsFemale(raceIndex):
	if (playerSettingModule.RACE_WARRIOR_W == raceIndex or playerSettingModule.RACE_ASSASSIN_W == raceIndex or playerSettingModule.RACE_SURA_W == raceIndex or player.SettingModule.RACE_SHAMAN_W == raceIndex):
		return True
	else:
		return False
		

def IsMale(raceIndex):
	if (playerSettingModule.RACE_WARRIOR_M == raceIndex or playerSettingModule.RACE_ASSASSIN_M == raceIndex or playerSettingModule.RACE_SURA_M == raceIndex or player.SettingModule.RACE_SHAMAN_M == raceIndex or playerSettingModule.RACE_WOLFMAN_M == raceIndex):
		return True
	else:
		return False
		


## Use
race = net.GetMainActorRace()
print(IsMale(race))

Kind Regards

Ken

Edited by Ken
  • Love 1

Do not be sorry, be better.

Link to comment
Share on other sites

  • 3 years later...

Also if you want to get the gender during select screen like I wanted to you will have to use the following syntax:
 

import chr
import net

chr.RaceToSex(chr.GetRace(net.ACCOUNT_CHARACTER_SLOT_ID))

And as @RatCatcher said, it will return an integer value: 1 for males and 0 for females

Cheers!

  • Love 1
for brain_cells in xrange(brain):
  if brain_cells == 0:
    print("0x3703c7 Fatal error occurred. Please replace the brain.")
    break
  if brain_cells == "damaged":
    print("0x3703c7 Error occurred. Please repair damaged brain_cells")
    break
  
  print("brain_cells are at 100% capacity.")

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.