Jump to content

[Python] Job and race select


Recommended Posts

A small example, I not tested, is just one example.

 	listEmpire = { 
		net.EMPIRE_A : localeInfo.EMPIRE_A,  #Shinshoo    
		net.EMPIRE_B : localeInfo.EMPIRE_B,  #Chunjo
		net.EMPIRE_C : localeInfo.EMPIRE_C	 #Jinno 
	}

	mRace = net.GetMainActorRace()
	mEmpire = net.GetEmpireID()

	if mRace == 5 and mEmpire == 1 or mEmpire == 2:
		self.PopupMessage("This character is only available for Jinno's Kingdom!")
		return False
#### If your current realm that is Chunjo stay or Shinshoo and your character is one type wolfman not have access to enter the kingdom of nature than from Jinno.

	if mRace == 1 or mRace == 2 or mRace == 3 or mRace == 4 and mEmpire == 3 or mEmpire == 1:
		self.PopupMessage("This character is only available for Chunjo's Kingdom!")
		return False
#### If your current realm that is Jinno or Shinshoo stay and your character is Warrior / Sura / Ninja / Shaman do not have access to enter the character than if you are on Chunjoo kingdom.

 
  • Love 1
Link to comment
Share on other sites

I got stuck... I've tried in that way - my CreateCharacter func:

Spoiler

def CreateCharacter(self):
        if -1 != self.reservingRaceIndex:
            return
        
        textName = self.editCharacterName.GetText()
        if self.__CheckCreateCharacter(textName) == FALSE:
            return
        
        if musicInfo.selectMusic != "":
            snd.FadeLimitOutMusic("BGM/"+musicInfo.selectMusic, systemSetting.GetMusicVolume()*0.05)
        
        self.DisableWindow()
        chr_id = self.__GetSlotChrID(self.gender, self.slot)
        chr.SelectInstance(chr_id)
        self.reservingRaceIndex = chr.GetRace()
        
        print("========================================================")
        print("Race : %d" % (self.reservingRaceIndex))
        print("========================================================")
        
        self.reservingShapeIndex = self.shapeList[self.gender][self.slot]
        self.reservingStartTime = app.GetTime()
        for eachSlot in xrange(SLOT_COUNT):
            sel_id = self.__GetSlotChrID(self.gender, eachSlot)
            chr.SelectInstance(sel_id)
            if eachSlot == self.slot:
                chr.PushOnceMotion(chr.MOTION_INTRO_SELECTED)
            else:
                chr.PushOnceMotion(chr.MOTION_INTRO_NOT_SELECTED)
        
        race_vegas = net.GetMainActorRace()
        empire_vegas = net.GetMainActorEmpire()
        
        if self.__CheckCreateRace(race_vegas, empire_vegas) == FALSE:
            return

And added __CheckCreateRace func:

Spoiler

def __CheckCreateRace(self, race_var, empire_var):
        if (race_var == 8) and (empire_var == 1 or empire_var == 2):
            self.PopupMessage(localeInfo.CREATE_INPUT_NAME, self.EnableWindow)
            return FALSE
        if (race_var == 1 or race_var == 2 or race_var == 3 or race_var == 4) and (empire_var == 3 or empire_var == 1):
            self.PopupMessage(localeInfo.CREATE_INPUT_NAME, self.EnableWindow)
            return FALSE
            
        return TRUE

 

Link to comment
Share on other sites

Use this : 

net.SendCreateCharacterPacket(2 , job number)

 

 

 

PyObject* netSendCreateCharacterPacket(PyObject* poSelf, PyObject* poArgs)
{
    int index;
    if (!PyTuple_GetInteger(poArgs, 0, &index))
        return Py_BuildException();

    char* name;
    if (!PyTuple_GetString(poArgs, 1, &name))
        return Py_BuildException();

    int job;
    if (!PyTuple_GetInteger(poArgs, 2, &job))
        return Py_BuildException();

    int shape;
    if (!PyTuple_GetInteger(poArgs, 3, &shape))
        return Py_BuildException();

    int stat1;
    if (!PyTuple_GetInteger(poArgs, 4, &stat1))
        return Py_BuildException();
    int stat2;
    if (!PyTuple_GetInteger(poArgs, 5, &stat2))
        return Py_BuildException();
    int stat3;
    if (!PyTuple_GetInteger(poArgs, 6, &stat3))
        return Py_BuildException();
    int stat4;
    if (!PyTuple_GetInteger(poArgs, 7, &stat4))
        return Py_BuildException();

    if (index<0 && index>3)
        return Py_BuildException();

    CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
    rkNetStream.SendCreateCharacterPacket((BYTE) index, name, (BYTE) job, (BYTE) shape, stat1, stat2, stat3, stat4);
    return Py_BuildNone();
}

  • Love 1
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


×
×
  • 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.