Resultados 1 a 9 de 9
  1. #1
    Uploader Goten's Avatar

    Data de Ingresso
    Feb 2020
    Posts
    239
    Thanks Thanks Given 
    94
    Thanks Thanks Received 
    3,847
    Thanked in
    177 Posts
    Mencionado
    7 Post(s)
    País
    Brazil

    Right Click Mouse para main 1.04E



    //================ Client =======================

    Import.h
    Código:
    #define pChaosBoxState *(BYTE*)(*(DWORD*)(0x98670C4) + 0xC8)
    post_item.cpp
    Código:
    PostItem::PostItem ()
    
    #if(MOVE_ITEM)
        last_tickcount_moveitem_ = 0;
    #endif
    Código:
    void PostItem::Hook()
    #if(MOVE_ITEM)
        SetCompleteHook(0xE9, 0x0083B7E4 + 0x150, &Equipments);//1.04D->0x0083B7E4
    #endif
    Código:
    #if(MOVE_ITEM)
    void __declspec (naked) PostItem::Equipments() {
        static DWORD mem = 0;
        _asm {
            mov eax, dword ptr ds : [ebp - 04]
                mov mem, eax
        }
        RemoveEquipment((void *)mem);
        _asm {
            mov esp, ebp
                pop ebp
                ret 0004
        }
    }
    void PostItem::RemoveEquipment(void * item_data) {
        // check window, not allow for shop, inventory, warehouse, etc
        if (gInterface.CheckWindow(Trade) ||
            gInterface.CheckWindow(Warehouse) ||
            gInterface.CheckWindow(Shop) ||
            gInterface.CheckWindow(Store) ||
            gInterface.CheckWindow(OtherStore) ||
            gInterface.CheckWindow(CashShop) ||
            gInterface.CheckWindow(ExpandWarehouse)) {
            return;
        }
        if (GetKeyState(VK_RBUTTON) & 0x8000 && GetTickCount() >= gPostItem.last_tickcount_moveitem_ + 250) {
    
            ObjectItem * lItem = (ObjectItem*)item_data;
    
            if (lItem->ItemID < 0) { return; }
    
            PMSG_ITEM_MOVE_RECV pMsg = { 0 };
    
            pMsg.h.set(0x79, 0x01, sizeof(pMsg));
    
            pMsg.sFlag = 0;
            pMsg.tFlag = 0;
            pMsg.Source = lItem->PosX;
            pMsg.Target = 0;
    
            DataSend((BYTE*)&pMsg, pMsg.h.size);
    
            gPostItem.last_tickcount_moveitem_ = GetTickCount();
        }
    }
    #endif
    Código:
    void PostItem::PostItemToWorldChatChannelImp ( void * item_data ) {
        // check window, not allow for shop, inventory, warehouse, etc
        if ( gInterface.CheckWindow ( Trade ) ||
                gInterface.CheckWindow ( Warehouse ) ||
                gInterface.CheckWindow ( Shop ) ||
                gInterface.CheckWindow ( Store ) ||
                gInterface.CheckWindow ( OtherStore ) ||
                gInterface.CheckWindow ( CashShop ) ||
                gInterface.CheckWindow ( ExpandWarehouse ) ) {
            return;
        }
    
        if ( GetTickCount() <= gPostItem.last_tickcount_post_ + 3000 ) { return; }
    
        if ( GetKeyState ( VK_RBUTTON ) & 0x8000 && GetKeyState ( VK_CONTROL ) & 0x8000 ) {
            PMSG_POSTITEM iMsg = { '\0' };
            strcpy_s ( iMsg.chatmsg, ( char* ) pCurrentViewingItemName );
            memcpy_s ( &iMsg.chatid[0], 10, ( char* ) oUserObjectStruct_, 10 );
            memcpy_s ( &iMsg.item_data[0], 107, item_data, 107 );
            iMsg.header.set ( ( LPBYTE ) &iMsg, 0x78, sizeof ( iMsg ) );
            DataSend2 ( ( LPBYTE ) &iMsg, iMsg.header.size );
            gPostItem.last_tickcount_post_ = GetTickCount();
        }
    #if(MOVE_ITEM)
        else if (GetKeyState(VK_RBUTTON) & 0x8000 && GetTickCount() >= gPostItem.last_tickcount_moveitem_ + 250) {
    
            ObjectItem * lItem = (ObjectItem*)item_data;
    
            if (lItem->ItemID < 0) { return; }
    
            PMSG_ITEM_MOVE_RECV pMsg = { 0 };
    
            pMsg.h.set(0x79, 0x01, sizeof(pMsg));
            pMsg.Target = -1;
    
            if (gInterface.CheckWindow(ChaosBox) && gInterface.CheckWindow(Inventory)) {
                if ((pCursorX > 460))
                {
                    pMsg.sFlag = 0;
                    pMsg.tFlag = 3;
                    pMsg.Target = 0;
                    pMsg.Source = lItem->PosX + lItem->PosY * 8 + 12;
                }
                else if (gInterface.CheckWindow(ExpandInventory) && pCursorX > 260)
                {
                    pMsg.sFlag = 0;
                    pMsg.tFlag = 3;
                    pMsg.Target = 0;
                    pMsg.Source = lItem->PosX + lItem->PosY * 8 + 12 + 64;
                    if (pCursorY > 130)
                        pMsg.Source += 32;
                }
                else {
                    pMsg.sFlag = 3;
                    pMsg.tFlag = 0;
                    pMsg.Target = 0;
                    pMsg.Source = lItem->PosX + lItem->PosY * 8;
                }
            }
            else {
                float v1 = 0;
                if (gInterface.CheckWindow(Character))
                    v1 = *(float*)(0x00D24E88);
                if ((pCursorX > 460 - v1))
                {
                    pMsg.sFlag = 0;
                    pMsg.tFlag = 0;
                    pMsg.Source = lItem->PosX + lItem->PosY * 8 + 12;
    
                }
                else if (gInterface.CheckWindow(ExpandInventory) && pCursorX > 260 - v1)
                {
                    pMsg.sFlag = 0;
                    pMsg.tFlag = 0;
                    pMsg.Source = lItem->PosX + lItem->PosY * 8 + 12 + 64;
                    if (pCursorY > 130)
                        pMsg.Source += 32;
                }
                pMsg.Target = 0;
            }
    
            DataSend((BYTE*)&pMsg, pMsg.h.size);
            gPostItem.last_tickcount_moveitem_ = GetTickCount();
        }
    #endif
    post_item.h

    Código:
    #if(MOVE_ITEM)
        static void Equipments();
        static void RemoveEquipment(void * item_data);
    #endif
    private:
    Código:
    #if(MOVE_ITEM)
        DWORD last_tickcount_moveitem_;
    #endif

    Protocol.cpp
    Código:
    #if(MOVE_ITEM)
            case 0xEE:
                SetChaosBoxState((PMSG_SET_CHAOSBOX_STATE*)lpMsg);
            return 1;
    #endif
    Código:
    #if(MOVE_ITEM)
    void SetChaosBoxState(PMSG_SET_CHAOSBOX_STATE* Data){
        pChaosBoxState = Data->state;
        return;
    }
    #endif

    Protocol.h
    Código:
    #if(MOVE_ITEM)
    struct PMSG_ITEM_MOVE_RECV
    {
        PSBMSG_HEAD h;
        BYTE sFlag;
        BYTE tFlag;
        BYTE Source;
        BYTE Target;
    };
    
    #if(MOVE_ITEM)
    void SetChaosBoxState(PMSG_SET_CHAOSBOX_STATE* Data);
    #endif

    //================ Server =======================


    ItemMannager.cpp
    Código:
    #if(MOVE_ITEM)
    BYTE CItemManager::InventoryCheckInsertItem(int aIndex, WORD item) // OK
    {
        ITEM_INFO ItemInfo;
    
        if (this->GetInfo(item, &ItemInfo) == 0)
        {
            return 0xFF;
        }
    
        int MaxY = (this->GetInventoryMaxValue(&gObj[aIndex]) - INVENTORY_WEAR_SIZE) / 8;
    
        for (int y = 0; y < MaxY; y++)
        {
            for (int x = 0; x < 8; x++)
            {
                if (gObj[aIndex].InventoryMap[((y * 8) + x)] == 0xFF) // y *  8
                {
                    BYTE slot = this->InventoryRectCheck(aIndex, x, y, ItemInfo.Width, ItemInfo.Height);
    
                    if (slot != 0xFF)
                    {
                        return slot;
                    }
                }
            }
        }
    
        return 0xFF;
    }
    #endif

    Código:
    #if(MOVE_ITEM)
    void CItemManager::CGMoveItemProc(PMSG_MOVEITEM* aRecv, short aIndex) {
    
        if (OBJMAX_RANGE(aIndex) == 0) { return; }
    
    
        LPOBJ lpObj = &gObj[aIndex];
    
    
        if (aRecv->Target == -1) { return; }
    
    
        if (aRecv->tFlag == 3 & aRecv->sFlag == 0 && lpObj->Inventory[aRecv->Source].IsItem()) //check input item
        {
            if (IsLuckyItem(lpObj->Inventory[aRecv->Source].m_Index))
            {
                return;
            }
    
            BYTE btItemType = 0;
            btItemType |= (lpObj->Inventory[aRecv->Source].m_Index & 0x1E00) >> 5;
    
            if ((btItemType + 2) == lpObj->Inventory[aRecv->Source].m_ItemOptionEx)
            {
                return;
            }
        }
    
    
        PMSG_ITEM_MOVE_RECV pMsg = { 0 };
    
        pMsg.TargetSlot = -1;
    
        if (aRecv->tFlag == 3 & aRecv->sFlag == 0) //move Inv -> ChaosBox
        {
            if (!lpObj->Inventory[aRecv->Source].IsItem())
                return; //no item
            int p = 0, c = 0, d = 0, w = 0, h = 0, n = 0;
            int Target = -1;
            int TargetMap[CHAOS_BOX_SIZE] = { '\0' };
    
            ITEM_INFO ItemInfo;
    
            for (n = 0; n < CHAOS_BOX_SIZE; n++) {
                if (lpObj->ChaosBox[n].IsItem()) {
                    if (this->GetInfo(lpObj->ChaosBox[n].m_Index, &ItemInfo) == 0)
                    {
                        return; //invalid item.
                    }
                    w = ItemInfo.Width;
                    h = ItemInfo.Height;
    
                    for (c = 0; c < w; c++) {
                        for (d = 0; d < h; d++) {
                            p = c + d * 8 + n;
                            if (p < CHAOS_BOX_SIZE) {
                                TargetMap[p] = 1;
                            }
                        }
                    }
                }
            }
    
            for (n = 0; n < CHAOS_BOX_SIZE; n++) {
                if (!TargetMap[n]) {
                    Target = n;
                    if (this->GetInfo(lpObj->Inventory[aRecv->Source].m_Index, &ItemInfo) == 0)
                    {
                        return; //invalid item.
                    }
                    w = ItemInfo.Width;
                    h = ItemInfo.Height;
                    for (c = 0; c < w; c++) {
                        for (d = 0; d < h; d++) {
                            p = c + d * 8 + n;
                            if (p >= CHAOS_BOX_SIZE || TargetMap[p] || (n % 8) + c > 7) //   8) = 8
                                                    {   
                                Target = -1;
                            }
                        }
                    }
                    if (Target != -1)
                        break;
                }
            }
            if (Target != -1)
            {
                pMsg.TargetSlot = Target;
                this->ItemByteConvert(pMsg.ItemInfo, lpObj->Inventory[aRecv->Source]);
            }
            else {
                return; //no more empty slot to add.
            }
        }
        else if (aRecv->tFlag == 0 & aRecv->sFlag == 3) //move ChaosBox -> Inv
        {
            if (!lpObj->ChaosBox[aRecv->Source].IsItem())
                return; //no item
            this->ItemByteConvert(pMsg.ItemInfo, lpObj->ChaosBox[aRecv->Source]);
    
            int Target = this->InventoryCheckInsertItem(aIndex, lpObj->ChaosBox[aRecv->Source].m_Index);
    
            if (Target == 0xFF)
            {
                return;
            }
    
            pMsg.TargetSlot = Target;
        }
        else if (aRecv->tFlag == 0 & aRecv->sFlag == 0) //equip/unequip item
        {
            if (!lpObj->Inventory[aRecv->Source].IsItem())
                return;
            this->ItemByteConvert(pMsg.ItemInfo, lpObj->Inventory[aRecv->Source]);
    
            if (aRecv->Source > 11) { //wear equipment case
                ITEM_INFO ItemInfo;
                if (this->GetInfo(lpObj->Inventory[aRecv->Source].m_Index, &ItemInfo) == 0)
                {
                    return; //invalid item.
                }
                pMsg.TargetSlot = ItemInfo.Slot;
                if (pMsg.TargetSlot == 0
                    && lpObj->Inventory[0].IsItem() //slot 0 already has item
                    && !lpObj->Inventory[1].IsItem() //slot 1 is empty
                    && lpObj->Inventory[aRecv->Source].m_Index < GET_ITEM(1, 0)) //sword item
                    pMsg.TargetSlot = 1;
                else if (lpObj->Inventory[ItemInfo.Slot].IsItem())
                    return; //already has item this slot
            }
            else { //unequipment case
                int Target = this->InventoryCheckInsertItem(aIndex, lpObj->Inventory[aRecv->Source].m_Index);
    
                if (Target == 0xFF)
                {
                    return;
                }
    
                pMsg.TargetSlot = Target;
            }
        }
        else {
            return; //invalid case
        }
    
        pMsg.SourceFlag = aRecv->sFlag;
        pMsg.TargetFlag = aRecv->tFlag;
        pMsg.SourceSlot = aRecv->Source;
    
    
        this->CGItemMoveRecv(&pMsg, aIndex);
    
        if (aRecv->tFlag == 0 & aRecv->sFlag == 3){
            gChaosBox.GCChaosBoxSend(lpObj, 0);
    
            //update chaosBox by new packet????
            PMSG_SET_CHAOSBOX_STATE pMsg = { 0 };
    
            pMsg.header.set(0xF3, 0xEE, sizeof(pMsg));
    
            pMsg.state = 0; //0 = allow mix || 2 = disable mix
    
            DataSend(aIndex, (LPBYTE)&pMsg, pMsg.header.size);
        }
        else if ((aRecv->tFlag == 3 & aRecv->sFlag == 0) || (aRecv->tFlag == 0 & aRecv->sFlag == 0))
        {
            if (!lpObj->Inventory[aRecv->Source].IsItem()) {
                this->GCItemDeleteSend(aIndex, aRecv->Source, aRecv->sFlag);
            }
        }
    
    
        return;
    }
    #endif
    ItemManager.h
    Código:
    #if(MOVE_ITEM)
    
    struct PMSG_MOVEITEM {
        PSBMSG_HEAD h;
        BYTE sFlag;
        BYTE tFlag;
        BYTE Source;
        BYTE Target;
    };
    
    struct PMSG_SET_CHAOSBOX_STATE
    {
        PSBMSG_HEAD header; // C1:32
        BYTE state;
    };
    
    #endif
    Código:
    #if(MOVE_ITEM)
        void CGMoveItemProc(PMSG_MOVEITEM* aRecv, short aIndex);
        BYTE InventoryCheckInsertItem(int aIndex, WORD item);
    #endif
    Protocol.cpp
    Código:
    #if(MOVE_ITEM)
            case 0x79:
                switch (lpMsg[3])
                {
                case 0x01:
                    gItemManager.CGMoveItemProc((PMSG_MOVEITEM*)lpMsg, aIndex);
                    break;
                }
                break;
    #endif
    User.h
    Código:
    #if(MOVE_ITEM)
    #define OBJMAX_RANGE(aIndex)        (((aIndex) < 0 )?FALSE:( (aIndex) > MAX_OBJECT-1 )?FALSE:TRUE)
    #endif
    Créditos:
    Thành Văn
    Last edited by Goten; 29/05/2020 at 07:05 PM.

  2. #2
    Membro alefmfoda's Avatar
    Data de Ingresso
    Dec 2019
    Posts
    25
    Thanks Thanks Given 
    10
    Thanks Thanks Received 
    2
    Thanked in
    1 Post
    Mencionado
    2 Post(s)
    País
    Brazil
    Alguém tem tutoriais pra colocar nisso na sounce?

  3. #3
    Old Guard Team GangoX's Avatar
    Data de Ingresso
    Jul 2017
    Posts
    92
    Thanks Thanks Given 
    194
    Thanks Thanks Received 
    32
    Thanked in
    23 Posts
    Mencionado
    6 Post(s)
    MEU HUMOR
    Angelic
    País
    Brazil
    Funciona no season 4


  4. #4
    Membro ailsoncost's Avatar
    Data de Ingresso
    Sep 2017
    Posts
    87
    Thanks Thanks Given 
    142
    Thanks Thanks Received 
    6
    Thanked in
    1 Post
    Mencionado
    7 Post(s)
    MEU HUMOR
    Cool
    País
    Brazil
    Boa noite, arrumando gameserver com sucesso e main 1 failed então algum me ajuda



    1>c:\users\applayo\downloads\muonlines\applayo games\[ex614] source\main_ex614\main\Protocol.h(647): fatal error C1004: unexpected end-of-file found

    [Somente membros podem ver os links. ]
    [Somente membros podem ver os links. ]


  5. #5
    Developer C++ louis's Avatar



    Data de Ingresso
    Apr 2016
    Posts
    1,681
    Thanks Thanks Given 
    39
    Thanks Thanks Received 
    811
    Thanked in
    67 Posts
    Mencionado
    499 Post(s)
    País
    Brazil
    Citação Originally Posted by ailsoncost Ver Post
    Boa noite, arrumando gameserver com sucesso e main 1 failed então algum me ajuda



    1>c:\users\applayo\downloads\muonlines\applayo games\[ex614] source\main_ex614\main\Protocol.h(647): fatal error C1004: unexpected end-of-file found
    muda isso:
    #if(MOVE_ITEM)
    struct PMSG_ITEM_MOVE_RECV
    {
    PSBMSG_HEAD h;
    BYTE sFlag;
    BYTE tFlag;
    BYTE Source;
    BYTE Target;
    };

    #if(MOVE_ITEM)
    void SetChaosBoxState(PMSG_SET_CHAOSBOX_STATE* Data);
    #endif

    para isso:



    struct PMSG_ITEM_MOVE_RECV
    {
    PSBMSG_HEAD h;
    BYTE sFlag;
    BYTE tFlag;
    BYTE Source;
    BYTE Target;
    };


    void SetChaosBoxState(PMSG_SET_CHAOSBOX_STATE* Data);
    Meu canal no YouTube com vídeos sobre os sistemas que desenvolvo:
    [Somente membros podem ver os links. ]

  6. The Following User Says Thank You to louis For This Useful Post:


  7. #6
    Membro ailsoncost's Avatar
    Data de Ingresso
    Sep 2017
    Posts
    87
    Thanks Thanks Given 
    142
    Thanks Thanks Received 
    6
    Thanked in
    1 Post
    Mencionado
    7 Post(s)
    MEU HUMOR
    Cool
    País
    Brazil





    to sozinho tentei conesgui resolvido!
    Last edited by ailsoncost; 02/10/2020 at 11:39 PM.

    [Somente membros podem ver os links. ]
    [Somente membros podem ver os links. ]


  8. #7
    Membro Gta1100's Avatar
    Data de Ingresso
    Nov 2018
    Posts
    76
    Thanks Thanks Given 
    99
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Mencionado
    2 Post(s)
    País
    Brazil


    Alguém me ajuda , gameserver deu certo , agora no main ta dando ruim

  9. #8
    Fundador PerfectZone Mentor's Avatar


    Data de Ingresso
    Jun 2013
    Posts
    2,850
    Thanks Thanks Given 
    784
    Thanks Thanks Received 
    2,189
    Thanked in
    355 Posts
    Mencionado
    804 Post(s)
    MEU HUMOR
    Twisted
    País
    Brazil
    Tem de incluir o post_item.h
    Perfect Zone Brasil



    Inscreva-se no meu canal clicando [Somente membros podem ver os links. ]

  10. #9
    Membro Gta1100's Avatar
    Data de Ingresso
    Nov 2018
    Posts
    76
    Thanks Thanks Given 
    99
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Mencionado
    2 Post(s)
    País
    Brazil


    mesma coisa mano ... ja coloquei

    [Somente membros podem ver os links. ] "post_item.h"

Permissões de Postagem

  • Você não pode iniciar novos tópicos
  • You may not post Resposta(s)
  • Você não pode enviar anexos
  • Você não pode editar suas mensagens
  •  
Sobre nós
Somos uma comunidade em atividade a 8 anos que aborda assuntos relacionados a games em geral, principalmente games MMORPG. e que busca sempre ajudar os membros através de conteúdos, tutoriais e suporte...
Nossos anunciantes
Hinetworks
VelozHost
InovHost
Rede Sociais