Resultados 1 a 9 de 9

Threaded View

  1. #1
    Uploader Goten's Avatar

    Data de Ingresso
    Feb 2020
    Posts
    239
    Thanks Thanks Given 
    94
    Thanks Thanks Received 
    3,945
    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.

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