Guida Come inserire 4 Inventari - Src

Stato
Discussione chiusa ad ulteriori risposte.

Michs

Bannato
8 Dicembre 2015
1,789
70
257
593
Ciao a tutti ragazzi di Inforge.net!
Oggi vi spiego come inserire i 4 inventari. Tutto ciò è possibile modificando la source.
La guida si dividerà in parte server/client source e parte client normale.

Lato Server Source:

Rechiamoci su /vostrasource/Server/Common e apriamo il file length.h
Cerchiamo questa stringa:
Codice:
INVENTORY_MAX_NUM        = 90,
e modifichiamola cosi':
Codice:
INVENTORY_MAX_NUM        = 180,

Okey ora rechiamoci su /vostrasource/Server/game e apriamo il file char_item.cpp
Cerchiamo questa stringa:
Codice:
BYTE bPage = bCell / (INVENTORY_MAX_NUM / 2);
e modifichiamola cosi':
Codice:
BYTE bPage = bCell / (INVENTORY_MAX_NUM / 4);

Cerchiamo questa stringa:
Codice:
if (p / (INVENTORY_MAX_NUM / 2) != bPage)
e modifichiamola cosi':
Codice:
if (p / (INVENTORY_MAX_NUM / 4) != bPage)

Ora apriamo il file exchange.cpp
Cerchiamo la stringa:
Codice:
static CGrid s_grid2(5, INVENTORY_MAX_NUM/5 / 2);
e modifichiamo cosi':
Codice:
static CGrid s_grid1(5, INVENTORY_MAX_NUM/5 / 2); // pagina 1
    static CGrid s_grid2(5, INVENTORY_MAX_NUM/5 / 2); // pagina 2
    static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // pagina 3
    static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // pagina 4

    s_grid1.Clear();
    s_grid2.Clear();
    s_grid3.Clear();
    s_grid4.Clear();

e subito sotto modifichiamo la funzione del for con questa:
Codice:
for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;

        s_grid1.Put(i, 1, item->GetSize());
    }
    for (i = INVENTORY_MAX_NUM / 4; i < INVENTORY_MAX_NUM; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;

        s_grid2.Put(i - INVENTORY_MAX_NUM / 4, 1, item->GetSize());
    }

    for (i = INVENTORY_MAX_NUM / 4; i < INVENTORY_MAX_NUM; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;

        s_grid3.Put(i - INVENTORY_MAX_NUM / 4, 1, item->GetSize());
    }
    for (i = INVENTORY_MAX_NUM / 4; i < INVENTORY_MAX_NUM; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;

        s_grid4.Put(i - INVENTORY_MAX_NUM / 4, 1, item->GetSize());
    }


Lato Client Source:

Rechiamoci su /vostrasource/UserInterface e apriamo il file GameType.h
Cerchiamo questa stringa:
Codice:
const DWORD c_Inventory_Page_Count = 2;
modifichiamola cosi':
Codice:
const DWORD c_Inventory_Page_Count = 4;

Lato Client Python:
Apriamo uiinventory.py
Cerchiamo questa stringa:
Codice:
self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
Sotto quella stringa aggiungiamo:
Codice:
self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
            self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
Ora Cerchiamo questa stringa:
Codice:
self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
e modifichiamola cosi':
Codice:
self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
        self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
Cerchiamo questa stringa:
Codice:
self.inventoryTab[0].Down()
Sotto scriviamo questo:
Codice:
self.inventoryPageIndex = 0

Ora cerchiamo la funzione SetInventoryPage e sostituiamola in questo modo
Codice:
def SetInventoryPage(self, page):
    self.inventoryTab[self.inventoryPageIndex].SetUp()
    self.inventoryPageIndex = page
    self.inventoryTab[self.inventoryPageIndex].Down()
    self.RefreshBagSlotWindow()

Aprite beltinventorywindow.py e cerchiamo questa stringa:
Codice:
EQUIPMENT_START_INDEX = 90
e modifichiamola cosi':
Codice:
EQUIPMENT_START_INDEX = 180

Aprite inventorywindow.py,svuotatelo.
Ora incollate questo:
Codice:
import uiScriptLocale
import item

EQUIPMENT_START_INDEX = 180

window = {
    "name" : "InventoryWindow",

    ## 600 - (width + 오른쪽으로 부터 띄우기 24 px)
    "x" : SCREEN_WIDTH - 176,
    "y" : SCREEN_HEIGHT - 37 - 565,

    "style" : ("movable", "float",),

    "width" : 176,
    "height" : 585,

    "children" :
    (
        ## Inventory, Equipment Slots
        {
            "name" : "board",
            "type" : "board",
            "style" : ("attach",),

            "x" : 0,
            "y" : 0,

            "width" : 176,
            "height" : 585,

            "children" :
            (
                ## Title
                {
                    "name" : "TitleBar",
                    "type" : "titlebar",
                    "style" : ("attach",),

                    "x" : 8,
                    "y" : 7,

                    "width" : 161,
                    "color" : "yellow",

                    "children" :
                    (
                        { "name":"TitleName", "type":"text", "x":77, "y":3, "text":uiScriptLocale.INVENTORY_TITLE, "text_horizontal_align":"center" },
                    ),
                },

                ## Equipment Slot
                {
                    "name" : "Equipment_Base",
                    "type" : "image",

                    "x" : 10,
                    "y" : 33,

                    "image" : "d:/ymir work/ui/equipment_bg_without_ring.tga",

                    "children" :
                    (

                        {
                            "name" : "EquipmentSlot",
                            "type" : "slot",

                            "x" : 3,
                            "y" : 3,

                            "width" : 150,
                            "height" : 182,

                            "slot" : (
                                        {"index":EQUIPMENT_START_INDEX+0, "x":39, "y":37, "width":32, "height":64},
                                        {"index":EQUIPMENT_START_INDEX+1, "x":39, "y":2, "width":32, "height":32},
                                        {"index":EQUIPMENT_START_INDEX+2, "x":39, "y":145, "width":32, "height":32},
                                        {"index":EQUIPMENT_START_INDEX+3, "x":75, "y":67, "width":32, "height":32},
                                        {"index":EQUIPMENT_START_INDEX+4, "x":3, "y":3, "width":32, "height":96},
                                        {"index":EQUIPMENT_START_INDEX+5, "x":114, "y":67, "width":32, "height":32},
                                        {"index":EQUIPMENT_START_INDEX+6, "x":114, "y":35, "width":32, "height":32},
                                        {"index":EQUIPMENT_START_INDEX+7, "x":2, "y":145, "width":32, "height":32},
                                        {"index":EQUIPMENT_START_INDEX+8, "x":75, "y":145, "width":32, "height":32},
                                        {"index":EQUIPMENT_START_INDEX+9, "x":114, "y":2, "width":32, "height":32},
                                        {"index":EQUIPMENT_START_INDEX+10, "x":75, "y":35, "width":32, "height":32},
                                        ## 새 반지1
                                        ##{"index":item.EQUIPMENT_RING1, "x":2, "y":106, "width":32, "height":32},
                                        ## 새 반지2
                                        ##{"index":item.EQUIPMENT_RING2, "x":75, "y":106, "width":32, "height":32},
                                        ## 새 벨트
                                        {"index":item.EQUIPMENT_BELT, "x":39, "y":106, "width":32, "height":32},
                                    ),
                        },
                        ## Dragon Soul Button
                        {
                            "name" : "DSSButton",
                            "type" : "button",

                            "x" : 114,
                            "y" : 107,

                            "tooltip_text" : uiScriptLocale.TASKBAR_DRAGON_SOUL,

                            "default_image" : "d:/ymir work/ui/dragonsoul/dss_inventory_button_01.tga",
                            "over_image" : "d:/ymir work/ui/dragonsoul/dss_inventory_button_02.tga",
                            "down_image" : "d:/ymir work/ui/dragonsoul/dss_inventory_button_03.tga",
                        },
                        ## MallButton
                        {
                            "name" : "MallButton",
                            "type" : "button",

                            "x" : 118,
                            "y" : 148,

                            "tooltip_text" : uiScriptLocale.MALL_TITLE,

                            "default_image" : "d:/ymir work/ui/game/TaskBar/Mall_Button_01.tga",
                            "over_image" : "d:/ymir work/ui/game/TaskBar/Mall_Button_02.tga",
                            "down_image" : "d:/ymir work/ui/game/TaskBar/Mall_Button_03.tga",
                        },
                        ## CostumeButton
                        {
                            "name" : "CostumeButton",
                            "type" : "button",

                            "x" : 78,
                            "y" : 5,

                            "tooltip_text" : uiScriptLocale.COSTUME_TITLE,

                            "default_image" : "d:/ymir work/ui/game/taskbar/costume_Button_01.tga",
                            "over_image" : "d:/ymir work/ui/game/taskbar/costume_Button_02.tga",
                            "down_image" : "d:/ymir work/ui/game/taskbar/costume_Button_03.tga",
                        },                       
                        {
                            "name" : "Equipment_Tab_01",
                            "type" : "radio_button",

                            "x" : 86,
                            "y" : 161,

                            "default_image" : "d:/ymir work/ui/game/windows/tab_button_small_01.sub",
                            "over_image" : "d:/ymir work/ui/game/windows/tab_button_small_02.sub",
                            "down_image" : "d:/ymir work/ui/game/windows/tab_button_small_03.sub",

                            "children" :
                            (
                                {
                                    "name" : "Equipment_Tab_01_Print",
                                    "type" : "text",

                                    "x" : 0,
                                    "y" : 0,

                                    "all_align" : "center",

                                    "text" : "I",
                                },
                            ),
                        },
                        {
                            "name" : "Equipment_Tab_02",
                            "type" : "radio_button",

                            "x" : 86 + 32,
                            "y" : 161,

                            "default_image" : "d:/ymir work/ui/game/windows/tab_button_small_01.sub",
                            "over_image" : "d:/ymir work/ui/game/windows/tab_button_small_02.sub",
                            "down_image" : "d:/ymir work/ui/game/windows/tab_button_small_03.sub",

                            "children" :
                            (
                                {
                                    "name" : "Equipment_Tab_02_Print",
                                    "type" : "text",

                                    "x" : 0,
                                    "y" : 0,

                                    "all_align" : "center",

                                    "text" : "II",
                                },
                            ),
                        },

                    ),
                },

                {
                    "name" : "Inventory_Tab_01",
                    "type" : "radio_button",

                    "x" : 10,
                    "y" : 33 + 189,

                    "default_image" : "d:/ymir work/ui/game/windows/tab_button_large_01.sub",
                    "over_image" : "d:/ymir work/ui/game/windows/tab_button_large_02.sub",
                    "down_image" : "d:/ymir work/ui/game/windows/tab_button_large_03.sub",
                    "tooltip_text" : uiScriptLocale.INVENTORY_PAGE_BUTTON_TOOLTIP_1,

                    "children" :
                    (
                        {
                            "name" : "Inventory_Tab_01_Print",
                            "type" : "text",

                            "x" : 0,
                            "y" : 0,

                            "all_align" : "center",

                            "text" : "I",
                        },
                    ),
                },
                {
                    "name" : "Inventory_Tab_02",
                    "type" : "radio_button",

                    "x" : 10 + 78,
                    "y" : 33 + 189,

                    "default_image" : "d:/ymir work/ui/game/windows/tab_button_large_01.sub",
                    "over_image" : "d:/ymir work/ui/game/windows/tab_button_large_02.sub",
                    "down_image" : "d:/ymir work/ui/game/windows/tab_button_large_03.sub",
                    "tooltip_text" : uiScriptLocale.INVENTORY_PAGE_BUTTON_TOOLTIP_2,

                    "children" :
                    (
                        {
                            "name" : "Inventory_Tab_02_Print",
                            "type" : "text",

                            "x" : 0,
                            "y" : 0,

                            "all_align" : "center",

                            "text" : "II",
                        },
                    ),
                },
                {
                    "name" : "Inventory_Tab_03",
                    "type" : "radio_button",

                    "x" : 10,
                    "y" : 33 + 210,

                    "default_image" : "d:/ymir work/ui/game/windows/tab_button_large_01.sub",
                    "over_image" : "d:/ymir work/ui/game/windows/tab_button_large_02.sub",
                    "down_image" : "d:/ymir work/ui/game/windows/tab_button_large_03.sub",
                    "tooltip_text" : uiScriptLocale.INVENTORY_PAGE_BUTTON_TOOLTIP_3,

                    "children" :
                    (
                        {
                            "name" : "Inventory_Tab_03_Print",
                            "type" : "text",

                            "x" : 0,
                            "y" : 0,

                            "all_align" : "center",

                            "text" : "III",
                        },
                    ),
                },
                {
                    "name" : "Inventory_Tab_04",
                    "type" : "radio_button",

                    "x" : 10 + 78,
                    "y" : 33 + 210,

                    "default_image" : "d:/ymir work/ui/game/windows/tab_button_large_01.sub",
                    "over_image" : "d:/ymir work/ui/game/windows/tab_button_large_02.sub",
                    "down_image" : "d:/ymir work/ui/game/windows/tab_button_large_03.sub",
                    "tooltip_text" : uiScriptLocale.INVENTORY_PAGE_BUTTON_TOOLTIP_4,

                    "children" :
                    (
                        {
                            "name" : "Inventory_Tab_04_Print",
                            "type" : "text",

                            "x" : 0,
                            "y" : 0,

                            "all_align" : "center",

                            "text" : "IV",
                        },
                    ),
                },               

                ## Item Slot
                {
                    "name" : "ItemSlot",
                    "type" : "grid_table",

                    "x" : 8,
                    "y" : 264,

                    "start_index" : 0,
                    "x_count" : 5,
                    "y_count" : 9,
                    "x_step" : 32,
                    "y_step" : 32,

                    "image" : "d:/ymir work/ui/public/Slot_Base.sub"
                },

                ## Print
                {
                    "name":"Money_Slot",
                    "type":"button",

                    "x":8,
                    "y":28,

                    "horizontal_align":"center",
                    "vertical_align":"bottom",

                    "default_image" : "d:/ymir work/ui/public/parameter_slot_05.sub",
                    "over_image" : "d:/ymir work/ui/public/parameter_slot_05.sub",
                    "down_image" : "d:/ymir work/ui/public/parameter_slot_05.sub",

                    "children" :
                    (
                        {
                            "name":"Money_Icon",
                            "type":"image",

                            "x":-18,
                            "y":2,

                            "image":"d:/ymir work/ui/game/windows/money_icon.sub",
                        },

                        {
                            "name" : "Money",
                            "type" : "text",

                            "x" : 3,
                            "y" : 3,

                            "horizontal_align" : "right",
                            "text_horizontal_align" : "right",

                            "text" : "123456789",
                        },
                    ),
                },

            ),
        },
    ),
}

Ultimo passaggio e abbiamo finito :D!

Andiamo su locale/it/ e apriamo il file locale_interface.txt
Cerchiamo questa stringa:
Codice:
INVENTORY_PAGE_BUTTON_TOOLTIP_2
e sotto aggiungiamo questo:
Codice:
INVENTORY_PAGE_BUTTON_TOOLTIP_3    3° Inventario
INVENTORY_PAGE_BUTTON_TOOLTIP_4    4° Inventario

Se avete problemi non esitate a contattarmi o a scrivere qui' sotto.
Bye - Mr.Slime
 
Met******v everywere! Grazie per l'inventorywindow.py con i tab piccoli almeno ç.ç
Ah si, la funzione SetInventoryView non va sul client di asterix,devi usare questa:
Codice:
def SetInventoryPage(self, page):
     self.inventoryPageIndex = page
     for i in xrange(4):
       if i != self.inventoryPageIndex:
         self.inventoryTab[i].SetUp()
         self.inventoryTab[self.inventoryPageIndex].Down()
     self.RefreshBagSlotWindow()
Non la ho fatta io, lascio i crediti a Ocelot2606 per la funzione
 
Non usando il client di Asterix,non mi faccio certi problemi :)
Comunque bravo per aver postato una *fix* se possiamo definirla ;)
 
Stato
Discussione chiusa ad ulteriori risposte.