Jump to content

Changer coiffure à la création du personnage


Recommended Posts

 

031034ezgif-2-2ae7a0d4f98a.gif

 

 

 

Dans root/introcreate.py
Chercher :

DESCRIPTION_FILE_NAME =    (
        uiScriptLocale.JOBDESC_WARRIOR_PATH,
        uiScriptLocale.JOBDESC_ASSASSIN_PATH,

Ajouter ça avant :

  HAIR_DATA = (
        [ 1, 2, 3, 4, 5, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, ], ## Warrior
        [ 1, 2, 3, 4, 5, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, ], ## Assassin
        [ 1, 2, 3, 4, 5, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010, 3011, ], ## Sura
        [ 1, 2, 3, 4, 5, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, ], ## Shaman
    )

Chercher :

        ###########################################################
      if -1 != self.reservingRaceIndex:
            if app.GetTime() - self.reservingStartTime >= 1.5:
                chrSlot=self.stream.GetCharacterSlot()
                textName = self.editCharacterName.GetText()
                raceIndex = self.reservingRaceIndex
                shapeIndex = self.reservingShapeIndex
                startStat = self.START_STAT[self.reservingRaceIndex]
                statCon = self.stat[0] - startStat[0]
                statInt = self.stat[1] - startStat[1]
                statStr = self.stat[2] - startStat[2]
                statDex = self.stat[3] - startStat[3]
                net.SendCreateCharacterPacket(chrSlot, textName, raceIndex, shapeIndex, statCon, statInt, statStr, statDex)
                self.reservingRaceIndex = -1
        ###########################################################

Replacer par :

 ###########################################################
        if -1 != self.reservingRaceIndex:
            if app.GetTime() - self.reservingStartTime >= 1.5:
                chrSlot=self.stream.GetCharacterSlot()
                textName = self.editCharacterName.GetText()
                raceIndex = self.reservingRaceIndex
                shapeIndex = self.reservingShapeIndex
                hairIndex = self.HAIR_DATA[chr.RaceToJob(self.reservingRaceIndex)][self.hairIndex]#New hair
                startStat = self.START_STAT[self.reservingRaceIndex]
                statCon = self.stat[0] - startStat[0]
                statInt = self.stat[1] - startStat[1]
                statStr = self.stat[2] - startStat[2]
                statDex = self.stat[3] - startStat[3]
                
                net.SendCreateCharacterPacket(chrSlot, textName, raceIndex, shapeIndex, hairIndex, statCon, statInt, statStr, statDex) #New hair
                self.reservingRaceIndex = -1
        ###########################################################    

Chercher :

 def OverOutStatButton(self):
            self.toolTip.Hide()

Ajouter ça après :

def IncreaseHair(self):
        chr_id = self.__GetSlotChrID(self.gender, self.slot)
        chr.SelectInstance(chr_id)
        if(self.hairIndex >= len(self.HAIR_DATA[chr.RaceToJob(chr.GetRace())]) - 1):
            return
            
        self.hairIndex += 1
        chr.SetHair(self.HAIR_DATA[chr.RaceToJob(chr.GetRace())][self.hairIndex])
        self.hairNumber.SetText(str(self.hairIndex))
        chr.SetMotionMode(chr.MOTION_MODE_GENERAL)
        chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)
        
    def DecreaseHair(self):
        chr_id = self.__GetSlotChrID(self.gender, self.slot)
        chr.SelectInstance(chr_id)
        if(self.hairIndex == 0):
            return
        
        self.hairIndex -= 1
        self.hairNumber.SetText(str(self.hairIndex))
        chr.SetHair(self.HAIR_DATA[chr.RaceToJob(chr.GetRace())][self.hairIndex])
        chr.SetMotionMode(chr.MOTION_MODE_GENERAL)
        chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)

Chercher :

self.btnCreate = getChild("create_button")
            self.btnCancel = getChild("cancel_button")
            self.btnPrev = getChild("prev_button")
            self.btnNext = getChild("next_button")
            self.btnLeft = getChild("left_button")
            self.btnRight = getChild("right_button")
            self.textBoard = getChild("text_board")

Ajouter ça après :

 self.btnIncreaseHair = getChild("increase_hair")
            self.hairNumber = getChild("hair_number")
            self.btnDecreaseHair = getChild("decrease_hair")

Chercher :

   getChild("hth_button").ShowToolTip = lambda arg=self.STAT_CON: self.OverInStatButton(arg)
            getChild("hth_button").HideToolTip = lambda arg=self.STAT_CON: self.OverOutStatButton()
            getChild("int_button").ShowToolTip = lambda arg=self.STAT_INT: self.OverInStatButton(arg)
            getChild("int_button").HideToolTip = lambda arg=self.STAT_INT: self.OverOutStatButton()
            getChild("str_button").ShowToolTip = lambda arg=self.STAT_STR: self.OverInStatButton(arg)
            getChild("str_button").HideToolTip = lambda arg=self.STAT_STR: self.OverOutStatButton()
            getChild("dex_button").ShowToolTip = lambda arg=self.STAT_DEX: self.OverInStatButton(arg)
            getChild("dex_button").HideToolTip = lambda arg=self.STAT_DEX: self.OverOutStatButton()

Ajouter ça après :

self.btnIncreaseHair.SetEvent(ui.__mem_func__(self.IncreaseHair))
            self.btnDecreaseHair.SetEvent(ui.__mem_func__(self.DecreaseHair))

Chercher :

    def Open(self):
        print "OPEN CREATE WINDOW ----------------------------------------------------------------------------"
        playerSettingModule.LoadGameData("INIT")
        self.reservingRaceIndex = -1
        self.reservingShapeIndex = -1

Ajouter ça après :

self.hairIndex = 0

Chercher :

  def __DecreaseSlotIndex(self):

Ajouter ça en dessous :

 if(self.hairIndex > 0):
            for i in xrange(SLOT_COUNT):
                chr.SelectInstance(self.__GetSlotChrID(0, i))
                chr.SetHair(0)
                self.hairIndex = 0
                self.hairNumber.SetText(str(self.hairIndex))
                
            for i in xrange(SLOT_COUNT):
                chr.SelectInstance(self.__GetSlotChrID(1, i))
                chr.SetHair(0)
                self.hairIndex = 0
                self.hairNumber.SetText(str(self.hairIndex))

Chercher :

def __IncreaseSlotIndex(self):

Ajouter ça en dessous :

 if(self.hairIndex > 0):
            for i in xrange(SLOT_COUNT):
                chr.SelectInstance(self.__GetSlotChrID(0, i))
                chr.SetHair(0)
                self.hairIndex = 0
                self.hairNumber.SetText(self.hairIndex)
                
            for i in xrange(SLOT_COUNT):
                chr.SelectInstance(self.__GetSlotChrID(1, i))
                chr.SetHair(0)
                self.hairIndex = 0
                self.hairNumber.SetText(self.hairIndex)

 


Dans locale/xx/ui/createcharacterwindow.py
Chercher :

{
                    "name" : "shape_button_02",
                    "type" : "radio_button",
                    "x" : 139,
                    "y" : 239 + TEMPORARY_HEIGHT,
                    "text" : "2",
                    "default_image" : ROOT_PATH + "Middle_Button_01.sub",
                    "over_image" : ROOT_PATH + "Middle_Button_02.sub",
                    "down_image" : ROOT_PATH + "Middle_Button_03.sub",
                },

Ajouter après :

{
                    "name" : "increase_hair",
                    "type" : "button",
                    
                    "x" : 81,
                    "y" : 239 + TEMPORARY_HEIGHT + 25,
                    
                    "default_image" : "d:/ymir work/ui/game/windows/btn_plus_up.sub",
                    "over_image" : "d:/ymir work/ui/game/windows/btn_plus_over.sub",
                    "down_image" : "d:/ymir work/ui/game/windows/btn_plus_down.sub",
                    },                
                
                    {
                    "name" : "hair_number",
                    "type" : "text",
                    
                    "x" : 110,
                    "y" : 239 + TEMPORARY_HEIGHT + 25,
                    
                    "text" : "0",
                    },
                
                    {
                    "name" : "character_hairstyle",
                    "type" : "text",
                    "x" : 43,
                    "y" : 293,
                    "text" : "HairStyle",
                    "text_horizontal_align" : "center",
                    },                
                
                    {
                    "name" : "decrease_hair",
                    "type" : "button",
                    
                    "x" : 139,                    
                    "y" : 239 + TEMPORARY_HEIGHT + 25,
                    
                    "default_image" : "d:/ymir work/ui/game/windows/btn_minus_up.sub",                    
                    "over_image" : "d:/ymir work/ui/game/windows/btn_minus_over.sub",                    
                    "down_image" : "d:/ymir work/ui/game/windows/btn_minus_down.sub",                    
                    },


Sur ces 2 fonctions:

"name" : "create_button",

 

"name" : "cancel_button",


Chercher :

"y" : 265 + TEMPORARY_HEIGHT,
Changer par :
"y" : 285 + TEMPORARY_HEIGHT,

 


Dans UserInterface/Packet.h
Chercher :

typedef struct command_player_create {
    BYTE        header;
    BYTE        index;
    char        name[CHARACTER_NAME_MAX_LEN + 1];
    WORD        job;
    BYTE        shape;
    BYTE        CON;
    BYTE        INT;
    BYTE        STR;
    BYTE        DEX;
} TPacketCGCreateCharacter;

Replacer par :

typedef struct command_player_create {
    BYTE        header;
    BYTE        index;
    char        name[CHARACTER_NAME_MAX_LEN + 1];
    WORD        job;
    BYTE        shape;
    WORD        hair;
    BYTE        CON;
    BYTE        INT;
    BYTE        STR;
    BYTE        DEX;
} TPacketCGCreateCharacter;


Dans UserInterface/PythonNetworkStreamPhaseSelect.cpp
Chercher :

bool CPythonNetworkStream::SendCreateCharacterPacket (BYTE index, const char *name, BYTE job, BYTE shape, BYTE byCON, BYTE byINT, BYTE bySTR, BYTE byDEX)
{
    TPacketCGCreateCharacter createCharacterPacket;
    createCharacterPacket.header = HEADER_CG_PLAYER_CREATE;
    createCharacterPacket.index = index;
    strncpy (createCharacterPacket.name, name, CHARACTER_NAME_MAX_LEN);
    createCharacterPacket.job = job;
    createCharacterPacket.shape = shape;
    createCharacterPacket.CON = byCON;
    createCharacterPacket.INT = byINT;
    createCharacterPacket.STR = bySTR;
    createCharacterPacket.DEX = byDEX;

Replacer par :

bool CPythonNetworkStream::SendCreateCharacterPacket(BYTE index, const char *name, BYTE job, BYTE shape,WORD wHair, BYTE byCON, BYTE byINT, BYTE bySTR, BYTE byDEX)
{
    TPacketCGCreateCharacter createCharacterPacket;
    createCharacterPacket.header = HEADER_CG_PLAYER_CREATE;
    createCharacterPacket.index = index;
    strncpy(createCharacterPacket.name, name, CHARACTER_NAME_MAX_LEN);
    createCharacterPacket.job = job;
    createCharacterPacket.shape = shape;
    createCharacterPacket.hair = wHair;
    createCharacterPacket.CON = byCON;
    createCharacterPacket.INT = byINT;
    createCharacterPacket.STR = bySTR;
    createCharacterPacket.DEX = byDEX;

 

 

Dans UserInterface/PythonNetworkStream.h
Chercher :

bool SendCreateCharacterPacket (BYTE index, const char *name, BYTE job, BYTE shape, BYTE byStat1, BYTE byStat2, BYTE byStat3, BYTE byStat4);

Replacer par :

bool SendCreateCharacterPacket(BYTE index, const char *name, BYTE job, BYTE shape, WORD wHair, BYTE byStat1, BYTE byStat2, BYTE byStat3, BYTE byStat4);


 

Dans UserInterface/PythonNetworkStreamModule.cpp
Chercher :

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();
}

Replacer par :

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 hair;
    if (!PyTuple_GetInteger(poArgs, 4, &hair))
        return Py_BuildException();
    int stat1;
    if (!PyTuple_GetInteger(poArgs, 5, &stat1))
        return Py_BuildException();
    int stat2;
    if (!PyTuple_GetInteger(poArgs, 6, &stat2))
        return Py_BuildException();
    int stat3;
    if (!PyTuple_GetInteger(poArgs, 7, &stat3))
        return Py_BuildException();
    int stat4;
    if (!PyTuple_GetInteger(poArgs, 8, &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, (WORD)hair, stat1, stat2, stat3, stat4);
    return Py_BuildNone();
}

 


Dans game/src/Packet.h
Chercher:

typedef struct command_player_create
{
    BYTE        header;
    BYTE        index;
    char        name[CHARACTER_NAME_MAX_LEN + 1];
    WORD        job;
    BYTE    shape;
    BYTE    Con;
    BYTE    Int;
    BYTE    Str;
    BYTE    Dex;
} TPacketCGPlayerCreate;

Replacer par :

typedef struct command_player_create
{
    BYTE        header;
    BYTE        index;
    char        name[CHARACTER_NAME_MAX_LEN + 1];
    WORD        job;
    BYTE    shape;
    WORD    hair;
    BYTE    Con;
    BYTE    Int;
    BYTE    Str;
    BYTE    Dex;
} TPacketCGPlayerCreate;

 


Go to db/src/ClientManagerPlayer.cpp
Dans :

void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerCreatePacket* packet)
This is default query. Please check your query of your source and adjust according.

Chercher :

   queryLen = snprintf(queryStr, sizeof(queryStr),
            "INSERT INTO player%s "
            "(id, account_id, name, level, st, ht, dx, iq, "
            "job, voice, dir, x, y, z, "
            "hp, mp, random_hp, random_sp, stat_point, stamina, part_base, part_main, part_hair, gold, playtime, "
            "skill_level, quickslot) "
            "VALUES(0, %u, '%s', %d, %d, %d, %d, %d, "
            "%d, %d, %d, %d, %d, %d, %d, "
            "%d, %d, %d, %d, %d, %d, %d, 0, %d, 0, ",
            GetTablePostfix(),
            packet->account_id, packet->player_table.name, packet->player_table.level, packet->player_table.st, packet->player_table.ht, packet->player_table.dx, packet->player_table.iq,
            packet->player_table.job, packet->player_table.voice, packet->player_table.dir, packet->player_table.x, packet->player_table.y, packet->player_table.z,
            packet->player_table.hp, packet->player_table.sp, packet->player_table.sRandomHP, packet->player_table.sRandomSP, packet->player_table.stat_point,             packet->player_table.stamina, packet->player_table.part_base, packet->player_table.part_base, packet->player_table.gold);
    sys_log(0, "PlayerCreate accountid %d name %s level %d gold %d, st %d ht %d job %d",
            packet->account_id,
            packet->player_table.name,
            packet->player_table.level,
            packet->player_table.gold,
            packet->player_table.st,
            packet->player_table.ht,
            packet->player_table.job);

Replace par :

 queryLen = snprintf(queryStr, sizeof(queryStr),             "INSERT INTO player%s "
            "(id, account_id, name, level, st, ht, dx, iq, "
            "job, voice, dir, x, y, z, "
            "hp, mp, random_hp, random_sp, stat_point, stamina, part_base, part_main, part_hair, gold, playtime, "
            "skill_level, quickslot) "
            "VALUES(0, %u, '%s', %d, %d, %d, %d, %d, "
            "%d, %d, %d, %d, %d, %d, %d, "
            "%d, %d, %d, %d, %d, %d, %d, %d, %d, 0, ",
            GetTablePostfix(),
            packet->account_id, packet->player_table.name, packet->player_table.level, packet->player_table.st, packet->player_table.ht, packet->player_table.dx, packet->player_table.iq,
            packet->player_table.job, packet->player_table.voice, packet->player_table.dir, packet->player_table.x, packet->player_table.y, packet->player_table.z,
            packet->player_table.hp, packet->player_table.sp, packet->player_table.sRandomHP, packet->player_table.sRandomSP, packet->player_table.stat_point,             packet->player_table.stamina, packet->player_table.part_base, packet->player_table.part_base, packet->player_table.parts[PART_HAIR], packet->player_table.gold);
    sys_log(0, "PlayerCreate accountid %d name %s level %d gold %d, st %d ht %d job %d hair %d",
            packet->account_id,             packet->player_table.name,             packet->player_table.level,             packet->player_table.gold,             packet->player_table.st,             packet->player_table.ht,             packet->player_table.job,
            packet->player_table.parts[PART_HAIR]);

Chercher :

pack.player.wMainPart        = packet->player_table.part_base;

Ajouter après:

pack.player.wHairPart		= packet->player_table.parts[PART_HAIR];

 


Dans game/src/input_login.cpp
Chercher:

bool NewPlayerTable2(TPlayerTable * table, const char * name, BYTE race, BYTE shape, BYTE bEmpire)

Replacer par:

bool NewPlayerTable2(TPlayerTable * table, const char * name, BYTE race, BYTE shape, WORD hair, BYTE bEmpire)

Chercher :

table->part_base	= shape;

Ajouter après :

table->parts[PART_HAIR] = hair;

Chercher :

void CInputLogin::CharacterCreate(LPDESC d, const char * data)
{
    struct command_player_create * pinfo = (struct command_player_create *) data;
    TPlayerCreatePacket player_create_packet;
    sys_log(0, "PlayerCreate: name %s pos %d job %d shape %d",
			pinfo->name,
			pinfo->index,
 			pinfo->job,
			pinfo->shape);

Remplacer par :

void CInputLogin::CharacterCreate(LPDESC d, const char * data)
{
    struct command_player_create * pinfo = (struct command_player_create *) data;
    TPlayerCreatePacket player_create_packet;
    sys_log(0, "PlayerCreate: name %s pos %d job %d shape %d hair %d",
            pinfo->name,			pinfo->index,			pinfo->job,			pinfo->shape,
 			pinfo->hair);

Chercher :

if (!NewPlayerTable2(&player_create_packet.player_table, pinfo->name, pinfo->job, pinfo->shape, d->GetEmpire()))

Replace par :

if (!NewPlayerTable2(&player_create_packet.player_table, pinfo->name, pinfo->job, pinfo->shape, pinfo->hair, d->GetEmpire()))

 

Edited by Veltor88 (see edit history)
  • Like 9
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Flux d'Activité

    1. 1

      Mondial2 Remastered - New School International Private Server Open 27/11/2020

    2. 17

      serveur Metin2

    3. 29

      Dump Proto 2014

    4. 17

      serveur Metin2

    5. 15

      Mustang SF - Full - 1.8

    6. 17

      serveur Metin2

    7. 17

      serveur Metin2

  • Recently Browsing

    No registered users viewing this page.

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