Mailing menu

Shout-Out

User Tag List

Thread: Mailing

Results 1 to 5 of 5
  1. #1
    fofgogjoj's Avatar Member
    Reputation
    4
    Join Date
    Nov 2019
    Posts
    26
    Thanks G/R
    8/3
    Trade Feedback
    4 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mailing

    hello folk!
    the last couple of days i've been trying to add sending mail for my bot. i found three ways to solve this problem:
    1. make a miniaddon and create a macro
    Code:
    			realmName = GetRealmName()
    			englishFaction, localizedFaction = UnitFactionGroup("player")
    			str = realmName .. " " .. englishFaction
    			characterName = nil
    			 
    			characterName = "PLAYERNAME"
    
    		
    			 if (characterName ~= nil) then
    				for b=0,4 do 
    					for s=1,32 do 
    						if select(10,GetContainerItemInfo(b,s)) == ITEMID then 
    							PickupContainerItem(b,s) 
    							ClickSendMailItemButton() 
    						end 
    					end 
    				end 
    				SendMail(characterName,"From")
    			 end
    			 return
    i have already used this method before, i think if it doesn’t work out differently, i will return to this.
    2.
    MailFrameTab2:Click()
    UseContainerItem()
    SendMail()
    3.
    PickupContainerItem()
    ClickSendMailItemButton()
    SendMail()

    i like the third option better and i started looking. i got the addresses of the functions, but i can't figure out what their parameters are.
    for ClickSendMailItemButton nothing complicated, i just pass a pointer to the player and it works.

    this is how PickupContainerItem looks in the macOS dump:
    Code:
    int __cdecl Script_PickupContainerItem(int a1)
    {
      int ActivePlayer; // eax
      int v3; // edx
      CGPlayer_C *v4; // esi
      int ItemPointer; // eax
      int v6; // edi
      int Record; // edx
      int v8; // ebx
      CDataStore *v9; // edx
      int v10; // edi
      int Item; // eax
      unsigned int RepairCost; // edi
      __int64 v13; // rax
      int v14; // eax
      int v15; // eax
      int v16; // edx
      CGPlayer_C *v17; // eax
      int VirtualItemCount; // eax
      CGPlayer_C *v19; // [esp+0h] [ebp-1B8h]
      unsigned __int64 v20; // [esp+4h] [ebp-1B4h]
      unsigned __int64 v21; // [esp+4h] [ebp-1B4h]
      unsigned __int64 v22; // [esp+4h] [ebp-1B4h]
      int v23; // [esp+4h] [ebp-1B4h]
      int v24; // [esp+4h] [ebp-1B4h]
      char v25; // [esp+4h] [ebp-1B4h]
      CDataStore *v26; // [esp+4h] [ebp-1B4h]
      unsigned int *v27; // [esp+8h] [ebp-1B0h]
      int v28; // [esp+8h] [ebp-1B0h]
      int v29; // [esp+8h] [ebp-1B0h]
      int v30; // [esp+8h] [ebp-1B0h]
      unsigned int *v31; // [esp+Ch] [ebp-1ACh]
      unsigned __int64 v32; // [esp+Ch] [ebp-1ACh]
      const char *v33; // [esp+1Ch] [ebp-19Ch]
      int v34; // [esp+20h] [ebp-198h]
      unsigned __int64 v35; // [esp+30h] [ebp-188h]
      char v36; // [esp+3Ch] [ebp-17Ch]
      unsigned __int64 v37; // [esp+40h] [ebp-178h]
      unsigned __int64 v38; // [esp+48h] [ebp-170h]
      char SlotIndex; // [esp+53h] [ebp-165h]
      CGGuildBankInfo *v40; // [esp+54h] [ebp-164h]
      __int64 v41; // [esp+58h] [ebp-160h]
      int *v42; // [esp+64h] [ebp-154h] BYREF
      int v43; // [esp+68h] [ebp-150h] BYREF
      int v44; // [esp+6Ch] [ebp-14Ch] BYREF
      int v45[2]; // [esp+70h] [ebp-148h] BYREF
      int v46; // [esp+78h] [ebp-140h]
      int v47[2]; // [esp+88h] [ebp-130h] BYREF
      unsigned __int64 v48; // [esp+90h] [ebp-128h] BYREF
      unsigned __int64 v49; // [esp+98h] [ebp-120h] BYREF
      CGGuildBankInfo *v50; // [esp+A0h] [ebp-118h] BYREF
      CGGuildBankInfo *v51; // [esp+A4h] [ebp-114h] BYREF
      CGMerchantInfo *v52; // [esp+A8h] [ebp-110h] BYREF
      CGGuildBankInfo *v53; // [esp+ACh] [ebp-10Ch] BYREF
      unsigned __int64 v54; // [esp+B0h] [ebp-108h] BYREF
      CGItem_C *v55; // [esp+B8h] [ebp-100h] BYREF
      CGPlayer_C *v56; // [esp+BCh] [ebp-FCh] BYREF
      char v57[12]; // [esp+C0h] [ebp-F8h] BYREF
      int v58; // [esp+CCh] [ebp-ECh]
      int v59; // [esp+184h] [ebp-34h]
      int v60; // [esp+188h] [ebp-30h]
      int v61; // [esp+18Ch] [ebp-2Ch]
    
      if ( !lua_isnumber(a1, 1) || !lua_isnumber(a1, 2) )
      {
        luaL_error(a1, "Usage: PickupContainerItem(index, slot)");
        return 0;
      }
      ActivePlayer = ClntObjMgrGetActivePlayer();
      v4 = (CGPlayer_C *)ClntObjMgrObjectPtr(ActivePlayer, v3, 16, (char)"../Object/ObjectClient/Player_C.h", 199);
      if ( v4
        && (CGGameUI::m_hasControl || (*(_BYTE *)(*((_DWORD *)v4 + 50) + 186) & 0x10) != 0)
        && CGContainerInfo::GetLuaBagAndSlot(a1, &v56, &v55, (char *)&v54 + 4)
        && (!*((_BYTE *)v56 + 16)
         || (unsigned int)v55 - 39 > 0x22
         || *((_DWORD *)&CGBankInfo::m_banker + 1) | CGBankInfo::m_banker) )
      {
        CGGameUI::GetCursorItem((CGGameUI *)&v49, &v48, &v54, v31);
        CGGameUI::GetCursorVirtualItem((CGGameUI *)&v53, (unsigned int *)&v52, v27);
        ItemPointer = CGBag_C::GetItemPointer(v56, (int)v55);
        v6 = ItemPointer;
        v38 = 0LL;
        if ( ItemPointer )
          v38 = *(_QWORD *)*(_DWORD *)(ItemPointer + 8);
        if ( v49 )
        {
          if ( v49 != v38 )
          {
            if ( CGGameUI::m_stackSplit )
            {
              CGPlayer_C::SplitItem(v4, v49, v48, v54, *((_QWORD *)v56 + 1), (int)v55, (int)CGGameUI::m_stackSplit);
              CGGameUI::ClearCursor(0, 1, v29);
            }
            else if ( (!v38 || v48) && (!ItemPointer || (*(_BYTE *)(ItemPointer + 1148) & 1) == 0) )
            {
              LODWORD(v20) = HIDWORD(v38);
              CGGameUI::LockItem((CGGameUI *)v38, v20);
              CGPlayer_C::SwapItems(v4, v49, v48, v54, *((_QWORD *)v56 + 1), (int)v55, 0);
            }
            return 0;
          }
    LABEL_42:
          CGGameUI::ClearCursor((CGGameUI *)1, 1, SHIDWORD(v20));
          return 0;
        }
        if ( !v53 )
        {
          if ( ItemPointer )
          {
            if ( (unsigned __int8)Spell_C_IsTargeting() )
              Spell_C_StopTargeting();
            if ( CursorGetResetMode() == 17 && CGMerchantInfo::CanRepair(v19) )
            {
              RepairCost = CGMerchantInfo::GetRepairCost((CGMerchantInfo *)v6, (CGItem_C *)v20);
              v41 = *(_QWORD *)*((_DWORD *)v4 + 2);
              LODWORD(v13) = ClntObjMgrGetActivePlayer();
              v35 = 0LL;
              if ( v41 == v13 )
              {
                v14 = *((_DWORD *)v4 + 1180);
                if ( !v14 )
                {
                  SErrDisplayError(-2062548992, "../Object/Player.h", 632, "m_plyr", 0, 1, 0, 286331153);
                  v14 = *((_DWORD *)v4 + 1180);
                }
                v35 = *(_QWORD *)(v14 + 6376);
              }
              if ( v35 >= RepairCost )
              {
                v59 = 0;
                v60 = 0;
                v61 = 0;
                v58 = -1;
                SE3SoundKitProperties::ResetToDefaults((SE3SoundKitProperties *)v57);
                SE3::PlaySoundKit(
                  (SE3 *)"ITEM_REPAIR",
                  0,
                  (const C3Vector *)v57,
                  0,
                  (unsigned int *)"/Users/patchman/buildserver/wow-b/work/WoW-code/trunk/WoW/Source/Mac/../Ui/ContainerFrame.cpp",
                  (const char *)0x40A,
                  (int)"Script_PickupContainerItem()",
                  v33);
                v43 = 0;
                v44 = 0;
                v45[0] = 0;
                v45[1] = 0;
                v46 = -1;
                v42 = &`vtable for'WDataStore + 2;
                ((void (__cdecl *)(int **, int *, int *, int *))*(&`vtable for'WDataStore + 2))(&v42, &v43, &v44, v45);
                CDataStore::Put((CDataStore *)&v42, 3042);
                CDataStore::Put((CDataStore *)&v42, CGMerchantInfo::m_merchant);
                CDataStore::Put((CDataStore *)&v42, v38);
                CDataStore::Put((CDataStore *)&v42, 0);
                if ( v46 != -1 )
                  SErrDisplayError(
                    -2062548992,
                    "../../../Engine/Source/Base/CDataStore.h",
                    478,
                    "!IsFinal()",
                    0,
                    1,
                    0,
                    286331153);
                v46 = 0;
                ClientServices::Send2((ClientServices *)&v42, v26);
                v42 = &`vtable for'WDataStore + 2;
                if ( v45[0] != -1 )
                  ((void (__cdecl *)(int **, int *, int *, int *))*(&`vtable for'WDataStore + 3))(&v42, &v43, &v44, v45);
                v42 = &`vtable for'CDataStore + 2;
                if ( v45[0] != -1 )
                  ((void (__cdecl *)(int **, int *, int *, int *))*(&`vtable for'CDataStore + 3))(&v42, &v43, &v44, v45);
              }
              else
              {
                CGGameUI::DisplayError(40, v25);
              }
            }
            else if ( (unsigned __int8)CGPlayer_C::IsGiftWrapping(v19) )
            {
              v15 = ClntObjMgrGetActivePlayer();
              v17 = (CGPlayer_C *)ClntObjMgrObjectPtr(v15, v16, 16, (char)"../Object/ObjectClient/Player_C.h", 199);
              if ( v17 )
                CGPlayer_C::GiftWrap(v17, (CGItem_C *)v6);
            }
            else if ( (*(_BYTE *)(v6 + 1148) & 1) == 0 )
            {
              HIDWORD(v32) = v55;
              HIDWORD(v21) = *((_DWORD *)v56 + 2);
              LODWORD(v32) = *((_DWORD *)v56 + 3);
              LODWORD(v21) = HIDWORD(v38);
              CGGameUI::SetCursorItem((CGGameUI *)v38, v21, v32, (CGGameUI *)1, 0, 1u, v34);
              LODWORD(v22) = HIDWORD(v38);
              CGGameUI::LockItem((CGGameUI *)v38, v22);
            }
          }
          return 0;
        }
        if ( CGGameUI::m_cursorItemType != 5 )
        {
          if ( CGGameUI::m_cursorItemType != 10 )
            goto LABEL_42;
          if ( !(*((_DWORD *)&CGGuildBankInfo::m_banker + 1) | CGGuildBankInfo::m_banker) )
            return 0;
          v51 = 0;
          v50 = 0;
          CGGameUI::GetCursorVirtualItem((CGGameUI *)&v51, (unsigned int *)&v50, (unsigned int *)HIDWORD(v20));
          if ( !v53 )
            return 0;
          SlotIndex = CGPlayer_C::FindSlotIndex(v4, *((_QWORD *)v56 + 1));
          v47[0] = 0;
          v47[1] = 0;
          Record = WowClientDB2<ItemRecSparse_C>::GetRecord(&g_itemSparseDB, v51, v47, 0, 0, 0);
          v40 = 0;
          if ( v6 )
            v40 = *(CGGuildBankInfo **)(*(_DWORD *)(v6 + 8) + 20);
          if ( !Record )
            goto LABEL_40;
          v8 = *(_DWORD *)(Record + 88);
          if ( !v8 )
            goto LABEL_40;
          if ( v40 )
          {
            if ( v40 != v51 )
            {
    LABEL_40:
              v9 = 0;
              if ( v40 == v53 )
              {
                CGGameUI::ClearCursor((CGGameUI *)1, 1, v28);
                CGGameUI::UnlockVirtualItem(v51, (int)v50, 0);
                return 0;
              }
              goto LABEL_41;
            }
            if ( CGGameUI::m_stackSplit )
            {
              v9 = (CDataStore *)(v8 - *(_DWORD *)(*(_DWORD *)(v6 + 204) + 32));
              if ( (int)v9 > (int)CGGameUI::m_stackSplit )
                v9 = CGGameUI::m_stackSplit;
            }
            else
            {
              VirtualItemCount = CGGameUI::GetVirtualItemCount((int)v40, v50, 0);
              v9 = (CDataStore *)(v8 - *(_DWORD *)(*(_DWORD *)(v6 + 204) + 32));
              if ( VirtualItemCount < (int)v9 )
                v9 = (CDataStore *)CGGameUI::GetVirtualItemCount((int)v51, v50, 0);
            }
          }
          else
          {
            v9 = CGGameUI::m_stackSplit;
          }
    LABEL_41:
          CGPlayer_C::SwapGuildBankItem(v4, (unsigned int)v51, (unsigned int)v50, SlotIndex, (char)v55, (int)v9);
          goto LABEL_42;
        }
        if ( *((_DWORD *)&CGMerchantInfo::m_merchant + 1) | CGMerchantInfo::m_merchant && CGMerchantInfo::GetItem(v52, v20) )
        {
          v36 = (char)v55;
          v37 = *((_QWORD *)v56 + 1);
          v10 = *(_DWORD *)(CGMerchantInfo::GetItem(v52, v23) + 28);
          Item = CGMerchantInfo::GetItem(v52, v24);
          CGPlayer_C::XBuyItem(CGMerchantInfo::m_merchant, Item, v10, v37, v36);
          CGGameUI::ClearCursor((CGGameUI *)1, 1, v30);
        }
      }
      return 0;
    }
    and this is how SendMail looks in the macOS dump:
    Code:
    int __cdecl Script_SendMail(int a1)
    {
      __int64 *v2; // edi
      int v3; // eax
      unsigned int *v4; // eax
      unsigned int v5; // ebx
      unsigned int v6; // esi
      __int64 v7; // rax
      unsigned int v8; // edi
      int v9; // ebx
      char *v10; // ecx
      int v11; // edx
      char v12; // al
      char *v13; // ecx
      int v14; // edx
      char v15; // al
      char *v16; // ecx
      int v17; // edx
      char v18; // al
      unsigned int v19; // esi
      unsigned int i; // ecx
      unsigned int v21; // edx
      JamCliStructMailAttachment *v22; // esi
      unsigned int v23; // ebx
      int v24; // ebx
      int v25; // edi
      int v26; // eax
      int v27; // ebx
      int v28; // esi
      int GameError; // eax
      int v30; // eax
      int v31; // ebx
      unsigned int v32; // eax
      const JamCliStructMailAttachment *v33; // ebx
      int v34; // esi
      JamClientMessage *v35; // [esp+4h] [ebp-9D4h]
      int v36; // [esp+28h] [ebp-9B0h]
      int v37; // [esp+2Ch] [ebp-9ACh]
      char *v38; // [esp+30h] [ebp-9A8h]
      const char *v39; // [esp+34h] [ebp-9A4h]
      const char *v40; // [esp+38h] [ebp-9A0h]
      int v41; // [esp+3Ch] [ebp-99Ch]
      __int64 v42; // [esp+40h] [ebp-998h]
      __int64 v43; // [esp+48h] [ebp-990h]
      unsigned int v44; // [esp+54h] [ebp-984h]
      unsigned int v45; // [esp+58h] [ebp-980h]
      JamCliStructMailAttachment *v46; // [esp+5Ch] [ebp-97Ch]
      int v47; // [esp+60h] [ebp-978h]
      __int64 *v48; // [esp+64h] [ebp-974h]
      unsigned int v49; // [esp+68h] [ebp-970h]
      unsigned int v50; // [esp+6Ch] [ebp-96Ch]
      char v51[16]; // [esp+7Ch] [ebp-95Ch] BYREF
      int v52; // [esp+8Ch] [ebp-94Ch]
      int v53; // [esp+90h] [ebp-948h]
      char v54; // [esp+94h] [ebp-944h] BYREF
      char v55; // [esp+C4h] [ebp-914h] BYREF
      char v56; // [esp+1C4h] [ebp-814h] BYREF
      int v57; // [esp+994h] [ebp-44h]
      int v58; // [esp+998h] [ebp-40h]
      unsigned int v59; // [esp+99Ch] [ebp-3Ch]
      unsigned int v60; // [esp+9A0h] [ebp-38h]
      JamCliStructMailAttachment *v61; // [esp+9A4h] [ebp-34h]
      unsigned int v62; // [esp+9A8h] [ebp-30h]
      __int64 v63; // [esp+9ACh] [ebp-2Ch]
      __int64 v64; // [esp+9B4h] [ebp-24h]
    
      if ( lua_isstring(a1, 1) )
      {
        if ( !CGMailInfo::m_commandPending )
        {
          v36 = CGMailInfo::m_object;
          v37 = *(&CGMailInfo::m_object + 1);
          if ( CGMailInfo::m_object )
          {
            if ( !CGMailInfo::m_sendPending )
            {
              v38 = (char *)lua_tolstring(a1, 1, 0);
              if ( *v38 )
              {
                v39 = "";
                if ( lua_isstring(a1, 2) )
                  v39 = (const char *)lua_tolstring(a1, 2, 0);
                if ( *v39 )
                {
                  v40 = "";
                  if ( lua_isstring(a1, 3) )
                    v40 = (const char *)lua_tolstring(a1, 3, 0);
                  v41 = CGMailInfo::m_selectedStationery;
                  if ( CGMailInfo::m_selectedStationery )
                  {
                    v48 = &CGMailInfo::m_sendItems;
                    v2 = &CGMailInfo::m_sendItems;
                    v50 = 0;
                    v49 = 0;
                    do
                    {
                      if ( *v2 )
                      {
                        v3 = ClntObjMgrObjectPtr(
                               *(_DWORD *)v2,
                               *((_DWORD *)v2 + 1),
                               2,
                               (char)"/Users/patchman/buildserver/wow-b/work/WoW-code/trunk/WoW/Source/Mac/../Ui/MailInfo.cpp",
                               1704);
                        if ( !v3
                          || (v4 = *(unsigned int **)(v3 + 204),
                              v5 = *v4,
                              v6 = v4[1],
                              LODWORD(v7) = ClntObjMgrGetActivePlayer(),
                              v7 != __PAIR64__(v6, v5)) )
                        {
                          GameError = CGBag_C::GetGameError(23);
                          CGGameUI::DisplayError(GameError, (char)v35);
                          if ( v50 <= 0xB )
                          {
                            v30 = 5 * v50;
                            *((_DWORD *)&CGMailInfo::m_sendItems + v30) = 0;
                            *((_DWORD *)&CGMailInfo::m_sendItems + v30 + 1) = 0;
                            dword_16A8E48[v30] = 0;
                            dword_16A8E4C[v30] = 0;
                            LOBYTE(dword_16A8E50[v30]) = 0;
                          }
                          FrameScript_SignalEvent(161, 0);
                          return 0;
                        }
                        ++v49;
                      }
                      ++v50;
                      v2 = (__int64 *)((char *)v2 + 20);
                    }
                    while ( v50 != 16 );
                    v8 = v49;
                    v9 = 0;
                    if ( v49 )
                      v9 = CGMailInfo::m_selectedPackage;
                    v42 = CGMailInfo::m_sendMoney;
                    v43 = CGMailInfo::m_sendCOD;
                    if ( CGMailInfo::m_sendMoney )
                    {
                      if ( CGMailInfo::m_sendCOD )
                        return 0;
                    }
                    else if ( CGMailInfo::m_sendCOD && !v49 )
                    {
                      return 0;
                    }
                    UserClientSendMail::UserClientSendMail((UserClientSendMail *)v51);
                    v52 = v36;
                    v53 = v37;
                    v10 = &v54;
                    v11 = 47;
                    while ( 1 )
                    {
                      v12 = *v38;
                      *v10++ = *v38++;
                      if ( !v12 )
                        break;
                      if ( !--v11 )
                      {
                        *v10 = 0;
                        break;
                      }
                    }
                    v13 = &v55;
                    v14 = 255;
                    while ( 1 )
                    {
                      v15 = *v39;
                      *v13++ = *v39++;
                      if ( !v15 )
                        break;
                      if ( !--v14 )
                      {
                        *v13 = 0;
                        break;
                      }
                    }
                    if ( !v40 )
                      SErrDisplayError(0, (int)"../../../Storm/H/SStr.inl", 111, (char)"source", 0, 1, 0);
                    v16 = &v56;
                    v17 = 1999;
                    while ( 1 )
                    {
                      v18 = *v40;
                      *v16++ = *v40++;
                      if ( !v18 )
                        break;
                      if ( !--v17 )
                      {
                        *v16 = 0;
                        break;
                      }
                    }
                    v57 = v41;
                    v58 = v9;
                    v19 = v60;
                    if ( v60 >= v49 )
                    {
                      if ( v60 > v49 )
                      {
                        v31 = 12 * v49;
                        do
                        {
                          JamCliStructMailAttachment::~JamCliStructMailAttachment((JamCliStructMailAttachment *)((char *)v61 + v31));
                          ++v49;
                          v31 += 12;
                        }
                        while ( v60 > v49 );
                      }
                    }
                    else
                    {
                      if ( v59 >= v49 )
                        goto LABEL_58;
                      i = v62;
                      if ( v62 )
                      {
                        v21 = v49 % v62;
                      }
                      else if ( v49 > 0x14 )
                      {
                        v62 = 21;
                        v21 = v49 % 0x15;
                        i = 21;
                      }
                      else
                      {
                        for ( i = v49; (i & (i - 1)) != 0; i &= i - 1 )
                          ;
                        if ( i )
                        {
                          v21 = v49 % i;
                        }
                        else
                        {
                          i = 1;
                          v21 = 0;
                        }
                      }
                      if ( v21 )
                        v49 = i + v49 - v21;
                      v46 = v61;
                      if ( v49 < v60 )
                      {
                        v22 = (JamCliStructMailAttachment *)((char *)v61 + 12 * v49);
                        v23 = v49;
                        do
                        {
                          JamCliStructMailAttachment::~JamCliStructMailAttachment(v22);
                          ++v23;
                          v22 = (JamCliStructMailAttachment *)((char *)v22 + 12);
                        }
                        while ( v60 > v23 );
                      }
                      v59 = v49;
                      v61 = (JamCliStructMailAttachment *)SMemReAlloc(v46, 12 * v49, "", -2, 16);
                      if ( !v61 )
                      {
                        v61 = (JamCliStructMailAttachment *)SMemAlloc(12 * v49, (int)"", -2, 0);
                        if ( v46 )
                        {
                          v32 = v60;
                          if ( v49 <= v60 )
                            v32 = v49;
                          v45 = v32;
                          if ( v32 )
                          {
                            v33 = v46;
                            v47 = 0;
                            v34 = 0;
                            do
                            {
                              if ( (JamCliStructMailAttachment *)((char *)v61 + v34) )
                                JamCliStructMailAttachment::Copy((JamCliStructMailAttachment *)((char *)v61 + v34), v33);
                              JamCliStructMailAttachment::~JamCliStructMailAttachment(v33);
                              ++v47;
                              v34 += 12;
                              v33 = (const JamCliStructMailAttachment *)((char *)v33 + 12);
                            }
                            while ( v47 != v45 );
                          }
                          v35 = (JamClientMessage *)"";
                          SMemFree(v46);
                        }
                      }
                      v19 = v60;
                      if ( v60 < v8 )
                      {
    LABEL_58:
                        v24 = 12 * v19;
                        do
                        {
                          if ( (JamCliStructMailAttachment *)((char *)v61 + v24) )
                            JamCliStructMailAttachment::JamCliStructMailAttachment((JamCliStructMailAttachment *)((char *)v61 + v24));
                          ++v19;
                          v24 += 12;
                        }
                        while ( v19 < v8 );
                      }
                    }
                    v60 = v8;
                    v25 = 0;
                    v44 = 0;
                    do
                    {
                      v27 = *(_DWORD *)v48;
                      v28 = *((_DWORD *)v48 + 1);
                      if ( *v48 )
                      {
                        if ( v44 >= v60 )
                          SErrDisplayErrorFmt(-2062548864, "", -2, 1, 1, "index (0x%08X), array size (0x%08X)", v44, v60);
                        *((_BYTE *)v61 + 12 * v44 + 8) = v25;
                        if ( v44 >= v60 )
                          SErrDisplayErrorFmt(-2062548864, "", -2, 1, 1, "index (0x%08X), array size (0x%08X)", v44, v60);
                        v26 = (int)v61;
                        *((_DWORD *)v61 + 3 * v44) = v27;
                        *(_DWORD *)(v26 + 12 * v44++ + 4) = v28;
                      }
                      ++v25;
                      v48 = (__int64 *)((char *)v48 + 20);
                    }
                    while ( v25 != 16 );
                    v63 = v42;
                    v64 = v43;
                    ClientServices::Send((ClientServices *)v51, v35);
                    CGMailInfo::m_sendPending = 1;
                    CGMailInfo::m_commandPending = 1;
                    UserClientSendMail::~UserClientSendMail((UserClientSendMail *)v51);
                  }
                }
              }
            }
          }
        }
      }
      else
      {
        luaL_error(a1, "Usage: SendMail(target, subject, body)");
      }
      return 0;
    }
    i tried passing a pointer to WoWItem for PickupContainerItem, it didn't work. i do not think that there should be parameters that are written on wowwiki. any ideas?

    Mailing
  2. #2
    ChrisIsMe's Avatar Contributor
    Reputation
    164
    Join Date
    Apr 2017
    Posts
    210
    Thanks G/R
    67/100
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    aaaaaaaaaaaaaaaaaaaa
    Last edited by ChrisIsMe; 11-01-2023 at 05:06 PM.

  3. Thanks fofgogjoj (1 members gave Thanks to ChrisIsMe for this useful post)
  4. #3
    fofgogjoj's Avatar Member
    Reputation
    4
    Join Date
    Nov 2019
    Posts
    26
    Thanks G/R
    8/3
    Trade Feedback
    4 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by ChrisIsMe View Post
    lol the function parameter used here, in both methods, is (lua_state* L) not an CGObject pointer. These are LuaC Methods.

    Reference: Register C++ function in Lua? - Stack Overflow | Calling C++ Functions From Lua

    Look at how the JamClient works, it's pretty simple.

    JamCliStructMailAttachment::JamCliStructMailAttachment((JamCliStructMailAttachme nt *)((char *)v61 + v24));
    thanks for the tip, i'll take a look!

  5. #4
    Jadd's Avatar 🐸 Premium Seller
    Reputation
    1515
    Join Date
    May 2008
    Posts
    2,433
    Thanks G/R
    81/336
    Trade Feedback
    1 (100%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Code:
    using System.Collections.Generic;
    using System.Text;
    using Afterglow.Internal.Client.Network.IO;
    using Afterglow.Internal.Client.Objects.Structures;
    
    namespace Afterglow.Internal.Client.Network.Packets {
        [NetworkEventRequest("CMSG_SEND_MAIL")]
        public class UserClientSendMail : NetworkEvent {
            public SmartGuid Mailbox { get; set; }
            public int StationaryId { get; set; }
            public long Money { get; set; }
            public long Cod { get; set; }
            public string Recipient { get; set; }
            public string Subject { get; set; }
            public string Body { get; set; }
            public List<MailAttachment> Attachments { get; set; }
    
            public override void OnRead(EventReader stream) {
                Mailbox      = stream.Read<SmartGuid>();
                StationaryId = stream.Read<int>();
                Money        = stream.Read<long>();
                Cod          = stream.Read<long>();
                
                var recipientLength  = (int) stream.ReadBits(9);
                var subjectLength    = (int) stream.ReadBits(9);
                var bodyLength       = (int) stream.ReadBits(11);
                var attachmentsCount = (int) stream.ReadBits(5);
                
                Recipient   = stream.ReadString(Encoding.UTF8, recipientLength);
                Subject     = stream.ReadString(Encoding.UTF8, subjectLength);
                Body        = stream.ReadString(Encoding.UTF8, bodyLength);
                Attachments = stream.ReadList<MailAttachment>(attachmentsCount);
            }
    
            public override void OnWrite(EventWriter stream) {
                var hasRecipient   = Recipient != null;
                var hasSubject     = Subject != null;
                var hasBody        = Body != null;
                var hasAttachments = Attachments != null && Attachments.Count > 0;
    
                stream.Write(Mailbox);
                stream.Write(StationaryId);
                stream.Write(Money);
                stream.Write(Cod);
                
                stream.WriteBits(9,  hasRecipient   ? Encoding.UTF8.GetByteCount(Recipient) : 0);
                stream.WriteBits(9,  hasSubject     ? Encoding.UTF8.GetByteCount(Subject) : 0);
                stream.WriteBits(11, hasBody        ? Encoding.UTF8.GetByteCount(Body) : 0);
                stream.WriteBits(5,  hasAttachments ? Attachments.Count : 0);
                stream.FlushBits();
                
                if (hasRecipient)
                    stream.WriteString(Recipient, Encoding.UTF8);
    
                if (hasSubject)
                    stream.WriteString(Subject, Encoding.UTF8);
    
                if (hasBody)
                    stream.WriteString(Body, Encoding.UTF8);
    
                if (hasAttachments)
                    stream.WriteList(Attachments);
            }
        }
    
        public class MailAttachment : IEventObject {
            public byte Position { get; set; }
            public SmartGuid Item { get; set; }
    
            static MailAttachment() {
                EventMemberSerializer.Register<MailAttachment>();
            }
    
            public void OnRead(EventReader stream) {
                Position = stream.Read<byte>();
                Item     = stream.Read<SmartGuid>();
            }
    
            public void OnWrite(EventWriter stream) {
                stream.Write(Position);
                stream.Write(Item);
            }
        }
    }
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Afterglow.Internal.Client.Enums;
    using Afterglow.Internal.Client.Network;
    using Afterglow.Internal.Client.Network.Packets;
    using Afterglow.Internal.Client.Objects;
    using Afterglow.Internal.Logic;
    
    namespace Afterglow.Internal.Client.API {
        public static class Mail {
            /// <summary>
            /// Attempts to send mail to the specified player.
            /// </summary>
            /// <param name="mailbox">The mailbox object.</param>
            /// <param name="recipient">The player that the mail will be sent to.</param>
            /// <param name="subject">The mail subject.</param>
            /// <param name="message">The mail body text.</param>
            public static void SendMail(WowGameObject mailbox, string recipient, string subject, string message) {
                SendMail(mailbox, recipient, subject, message, null, 0, false);
            }
            
            /// <summary>
            /// Attempts to send mail to the specified player.
            /// </summary>
            /// <param name="mailbox">The mailbox object.</param>
            /// <param name="recipient">The player that the mail will be sent to.</param>
            /// <param name="subject">The mail subject.</param>
            /// <param name="message">The mail body text.</param>
            /// <param name="attachments">An array of items in the player's inventory to attach to the mail.</param>
            public static void SendMail(WowGameObject mailbox, string recipient, string subject, string message, IEnumerable<WowItem> attachments) {
                SendMail(mailbox, recipient, subject, message, attachments, 0, false);
            }
            
            /// <summary>
            /// Attempts to send mail to the specified player.
            /// </summary>
            /// <param name="mailbox">The mailbox object.</param>
            /// <param name="recipient">The player that the mail will be sent to.</param>
            /// <param name="subject">The mail subject.</param>
            /// <param name="message">The mail body text.</param>
            /// <param name="money">The amount of money, in coppers, to attach to the mail.</param>
            /// <param name="cod"><see langword="true"/> if the attached money is sent as a request from the recipient; <see langword="false"/> if the money will be sent to the recipient.</param>
            public static void SendMail(WowGameObject mailbox, string recipient, string subject, string message, long money, bool cod) {
                SendMail(mailbox, recipient, subject, message, null, money, false);
            }
    
            /// <summary>
            /// Attempts to send mail to the specified player.
            /// </summary>
            /// <param name="mailbox">The mailbox object.</param>
            /// <param name="recipient">The player that the mail will be sent to.</param>
            /// <param name="subject">The mail subject.</param>
            /// <param name="message">The mail body text.</param>
            /// <param name="attachments">An array of items in the player's inventory to attach to the mail.</param>
            /// <param name="money">The amount of money, in coppers, to attach to the mail.</param>
            /// <param name="cod"><see langword="true"/> if the attached money is sent as a request from the recipient; <see langword="false"/> if the money will be sent to the recipient.</param>
            /// <remarks>
            /// Sending more than 12 attachments will split the mail into multiple messages.
            /// Sending mail with a cash-on-delivery request imposes a 12 item attachment limit.
            /// </remarks>
            public static void SendMail(WowGameObject mailbox, string recipient, string subject, string message, IEnumerable<WowItem> attachments, long money, bool cod) {
                // Initialize mailing info.
                var mail = NetworkEvent.Factory.Create<UserClientSendMail>(NetworkEventType.Outgoing);
                mail.Mailbox = mailbox.Guid;
                mail.StationaryId = 41;
                mail.Subject = subject;
                mail.Recipient = recipient;
                mail.Body = message;
                
                // Handle attached money.
                if (cod)
                    mail.Cod = money;
                else
                    mail.Money = money;
    
                // Handle attached items.
                if (attachments != null) {
                    var items = attachments.ToList();
                    if (items.Count > 12 && cod && money > 0)
                        throw new ArgumentException("Too many item attachments specified in a cash-on-delivery mail request.", nameof(attachments));
    
                    if (items.Count != 0) {
                        mail.Attachments = new List<MailAttachment>();
                        var itemCount = (byte) 0;
    
                        foreach (var attachment in items) {
                            mail.Attachments.Add(new MailAttachment { Item = attachment.Guid, Position = itemCount++ });
                            if (itemCount < 12)
                                continue;
    
                            // Too many items - send the remainder in another mail.
                            Connection.SendPacket(mail);
                            mail.Money = 0;
                            mail.Attachments.Clear();
                            itemCount = 0;
                        }
    
                        if (itemCount == 0)
                            return;
                    }
                }
                
                Connection.SendPacket(mail);
            }
    
            /// <summary>
            /// Attempts to get the mailbox object nearest to the player.
            /// </summary>
            public static WowGameObject FindMailbox() {
                return Manager.Objects.GameObjects.FromPosition(Manager.LocalPlayer.Position, out _,
                    gameObject => gameObject.InteractType == InteractType.Mail);
            }
        }
    }

  6. Thanks fofgogjoj, Corthezz (2 members gave Thanks to Jadd for this useful post)
  7. #5
    fofgogjoj's Avatar Member
    Reputation
    4
    Join Date
    Nov 2019
    Posts
    26
    Thanks G/R
    8/3
    Trade Feedback
    4 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Jadd View Post
    Code:
    using System.Collections.Generic;
    using System.Text;
    using Afterglow.Internal.Client.Network.IO;
    using Afterglow.Internal.Client.Objects.Structures;
    
    namespace Afterglow.Internal.Client.Network.Packets {
        [NetworkEventRequest("CMSG_SEND_MAIL")]
        public class UserClientSendMail : NetworkEvent {
            public SmartGuid Mailbox { get; set; }
            public int StationaryId { get; set; }
            public long Money { get; set; }
            public long Cod { get; set; }
            public string Recipient { get; set; }
            public string Subject { get; set; }
            public string Body { get; set; }
            public List<MailAttachment> Attachments { get; set; }
    
            public override void OnRead(EventReader stream) {
                Mailbox      = stream.Read<SmartGuid>();
                StationaryId = stream.Read<int>();
                Money        = stream.Read<long>();
                Cod          = stream.Read<long>();
                
                var recipientLength  = (int) stream.ReadBits(9);
                var subjectLength    = (int) stream.ReadBits(9);
                var bodyLength       = (int) stream.ReadBits(11);
                var attachmentsCount = (int) stream.ReadBits(5);
                
                Recipient   = stream.ReadString(Encoding.UTF8, recipientLength);
                Subject     = stream.ReadString(Encoding.UTF8, subjectLength);
                Body        = stream.ReadString(Encoding.UTF8, bodyLength);
                Attachments = stream.ReadList<MailAttachment>(attachmentsCount);
            }
    
            public override void OnWrite(EventWriter stream) {
                var hasRecipient   = Recipient != null;
                var hasSubject     = Subject != null;
                var hasBody        = Body != null;
                var hasAttachments = Attachments != null && Attachments.Count > 0;
    
                stream.Write(Mailbox);
                stream.Write(StationaryId);
                stream.Write(Money);
                stream.Write(Cod);
                
                stream.WriteBits(9,  hasRecipient   ? Encoding.UTF8.GetByteCount(Recipient) : 0);
                stream.WriteBits(9,  hasSubject     ? Encoding.UTF8.GetByteCount(Subject) : 0);
                stream.WriteBits(11, hasBody        ? Encoding.UTF8.GetByteCount(Body) : 0);
                stream.WriteBits(5,  hasAttachments ? Attachments.Count : 0);
                stream.FlushBits();
                
                if (hasRecipient)
                    stream.WriteString(Recipient, Encoding.UTF8);
    
                if (hasSubject)
                    stream.WriteString(Subject, Encoding.UTF8);
    
                if (hasBody)
                    stream.WriteString(Body, Encoding.UTF8);
    
                if (hasAttachments)
                    stream.WriteList(Attachments);
            }
        }
    
        public class MailAttachment : IEventObject {
            public byte Position { get; set; }
            public SmartGuid Item { get; set; }
    
            static MailAttachment() {
                EventMemberSerializer.Register<MailAttachment>();
            }
    
            public void OnRead(EventReader stream) {
                Position = stream.Read<byte>();
                Item     = stream.Read<SmartGuid>();
            }
    
            public void OnWrite(EventWriter stream) {
                stream.Write(Position);
                stream.Write(Item);
            }
        }
    }
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Afterglow.Internal.Client.Enums;
    using Afterglow.Internal.Client.Network;
    using Afterglow.Internal.Client.Network.Packets;
    using Afterglow.Internal.Client.Objects;
    using Afterglow.Internal.Logic;
    
    namespace Afterglow.Internal.Client.API {
        public static class Mail {
            /// <summary>
            /// Attempts to send mail to the specified player.
            /// </summary>
            /// <param name="mailbox">The mailbox object.</param>
            /// <param name="recipient">The player that the mail will be sent to.</param>
            /// <param name="subject">The mail subject.</param>
            /// <param name="message">The mail body text.</param>
            public static void SendMail(WowGameObject mailbox, string recipient, string subject, string message) {
                SendMail(mailbox, recipient, subject, message, null, 0, false);
            }
            
            /// <summary>
            /// Attempts to send mail to the specified player.
            /// </summary>
            /// <param name="mailbox">The mailbox object.</param>
            /// <param name="recipient">The player that the mail will be sent to.</param>
            /// <param name="subject">The mail subject.</param>
            /// <param name="message">The mail body text.</param>
            /// <param name="attachments">An array of items in the player's inventory to attach to the mail.</param>
            public static void SendMail(WowGameObject mailbox, string recipient, string subject, string message, IEnumerable<WowItem> attachments) {
                SendMail(mailbox, recipient, subject, message, attachments, 0, false);
            }
            
            /// <summary>
            /// Attempts to send mail to the specified player.
            /// </summary>
            /// <param name="mailbox">The mailbox object.</param>
            /// <param name="recipient">The player that the mail will be sent to.</param>
            /// <param name="subject">The mail subject.</param>
            /// <param name="message">The mail body text.</param>
            /// <param name="money">The amount of money, in coppers, to attach to the mail.</param>
            /// <param name="cod"><see langword="true"/> if the attached money is sent as a request from the recipient; <see langword="false"/> if the money will be sent to the recipient.</param>
            public static void SendMail(WowGameObject mailbox, string recipient, string subject, string message, long money, bool cod) {
                SendMail(mailbox, recipient, subject, message, null, money, false);
            }
    
            /// <summary>
            /// Attempts to send mail to the specified player.
            /// </summary>
            /// <param name="mailbox">The mailbox object.</param>
            /// <param name="recipient">The player that the mail will be sent to.</param>
            /// <param name="subject">The mail subject.</param>
            /// <param name="message">The mail body text.</param>
            /// <param name="attachments">An array of items in the player's inventory to attach to the mail.</param>
            /// <param name="money">The amount of money, in coppers, to attach to the mail.</param>
            /// <param name="cod"><see langword="true"/> if the attached money is sent as a request from the recipient; <see langword="false"/> if the money will be sent to the recipient.</param>
            /// <remarks>
            /// Sending more than 12 attachments will split the mail into multiple messages.
            /// Sending mail with a cash-on-delivery request imposes a 12 item attachment limit.
            /// </remarks>
            public static void SendMail(WowGameObject mailbox, string recipient, string subject, string message, IEnumerable<WowItem> attachments, long money, bool cod) {
                // Initialize mailing info.
                var mail = NetworkEvent.Factory.Create<UserClientSendMail>(NetworkEventType.Outgoing);
                mail.Mailbox = mailbox.Guid;
                mail.StationaryId = 41;
                mail.Subject = subject;
                mail.Recipient = recipient;
                mail.Body = message;
                
                // Handle attached money.
                if (cod)
                    mail.Cod = money;
                else
                    mail.Money = money;
    
                // Handle attached items.
                if (attachments != null) {
                    var items = attachments.ToList();
                    if (items.Count > 12 && cod && money > 0)
                        throw new ArgumentException("Too many item attachments specified in a cash-on-delivery mail request.", nameof(attachments));
    
                    if (items.Count != 0) {
                        mail.Attachments = new List<MailAttachment>();
                        var itemCount = (byte) 0;
    
                        foreach (var attachment in items) {
                            mail.Attachments.Add(new MailAttachment { Item = attachment.Guid, Position = itemCount++ });
                            if (itemCount < 12)
                                continue;
    
                            // Too many items - send the remainder in another mail.
                            Connection.SendPacket(mail);
                            mail.Money = 0;
                            mail.Attachments.Clear();
                            itemCount = 0;
                        }
    
                        if (itemCount == 0)
                            return;
                    }
                }
                
                Connection.SendPacket(mail);
            }
    
            /// <summary>
            /// Attempts to get the mailbox object nearest to the player.
            /// </summary>
            public static WowGameObject FindMailbox() {
                return Manager.Objects.GameObjects.FromPosition(Manager.LocalPlayer.Position, out _,
                    gameObject => gameObject.InteractType == InteractType.Mail);
            }
        }
    }
    thanks for the help! i will look into this and let you know if i have any difficulties

Similar Threads

  1. How to: Send Anonymous Mail Exploit
    By Matt in forum World of Warcraft Exploits
    Replies: 9
    Last Post: 04-05-2007, 10:51 PM
  2. Mail from IF as a Horde
    By GtR[MoÐ] in forum World of Warcraft Exploits
    Replies: 4
    Last Post: 09-14-2006, 08:21 AM
  3. Send Mails to each other.
    By Goggelpuff in forum Community Chat
    Replies: 1
    Last Post: 08-17-2006, 12:53 PM
  4. Sorry..newb mail question
    By nolbishop in forum World of Warcraft General
    Replies: 2
    Last Post: 06-07-2006, 07:21 PM
All times are GMT -5. The time now is 10:32 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search