• Welcome to Valhalla Legends Archive.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - LordVader

#1
Noticed this packet that I have not seen documented anywhere..
I Added 0x89 to bnetdocs, and could use some more reasearch on it this is what I have so far:

Quote
Message ID:   0x89
   
Message Name:   D2GS_UNIQUEEVENTS
   
Message Status:   MORE RESEARCH NEEDED
   
Direction:   Server -> Client (Received)
   
Used By:   Diablo II, Diablo
   
Format:   (BYTE) EventId // see below,

Events known so far:
00 = Killed all the monsters in the den.
01 = Tristram portal opening for the first time.
03 = Staff being put into the oriface in act2
0b = Meph just died.
0c = The last seal in cs was hit diablo is now released.
0d = Diablo was killed or is dead.
06 = Ammy being poped in clawviper temple.
07 = Summoner area? death or when the tome is clicked unsure which.
08 = Duriel just died
   
Remarks: I'm sure there are many others, and am guessing that the "Diablo walks the earth" type of event would also be seen in this packet, even if you joined the game after the message had appeared -- that is an assumption and is unverified tho.

Note1: Unsure what to name this any suggestions will be taken into account.
Note2: This seems to relate to various events that relate directly or indirectly to key quest states//events.

Basically to fully document it you would need to start at lvl one and do every quest(and most every area) in the game, and I have not had time to do that yet.
So if anyone get's the urge that would be appreciated.
And any suggestions on a name for this packet would be helpfull also.

Credits:
Evan from redvex.net - discovered the 0x00 event which is seen when the den of evil has no monsters left, and helping to confirm some of the other events.
Everything else I documented.
#2
I am going to be editing the d2gs data on http://bnetdocs.dementedminds.net/.
Some of the packet names and things is needing some udpating and correction.
Before I go thru and start doing that I would like some input from people..

Mainly in regards to UNIT and OBJECT type references, and some of the actually packet names..

Here is an example:
Quote from: LordVader - from a different thread
some of the D2GS data is incorrect mostly the naming schemes.. someone should go thru and look thru + compare to this list:
http://www.edgeofnowhere.cc/viewtopic.php?t=303771

One that i notice off hand is for example:

Quote
Message ID:   0x2F
   
Message Name:   D2GS_NPCHEAL
   
Message Status:   RAW, NEW PACKET
   
Direction:   Client -> Server (Sent)
   
Used By:   Diablo II, Diablo
   
Format:   (DWORD) Unused(DWORD) NPC ID
   
Remarks:   Heals the player through the specified NPC. Please note: This message's official name is not known, and has been invented.

That should more correctly be refered to as NPCTalk or NPCChat happens once and only after you have sent an 0x13 packet to actually click the npc, and then you choose "talk" that is the 2f packet.
And also the first dword is entity kind, you can see more info about that also in the EON packet list.

C->S
0x2F - Initiate entity chat - 2F [DWORD Entity Kind] [DWORD Entity ID]

*Update:
The different Entity types:
Quote
Entities
--------

00 - Players
01 - Monsters, NPCs, and Mercenaries
02 - Stash, Waypoint, Chests, Corpses, and other objects.
03 - Missiles
04 - Items
05 - Entrances

Basically references to UNIT and OBJECT and things, have been in the actual D2 community refered to and covered by the blanket "Entity" and "Entity Kind".
That is one thing I would like to update,that and just adding more info and getting it uptodate.

If you compare the EON List which is a collaborative copy paste from probably 5 other sites and listings you'll see alot of variations between the two and in most instances the EON data is more accurate(to me in my own research).

So any input/suggestions on how people would prefer things or flaws in what I am suggesting are appreciated.

*Edit: I was mistaken the example above isn't directly in responce to clicking talk it actually indicates that you are now interacting with an NPC..
A dialog window is opened at this state and is prior to any choices being made(talk/trade etc).
#3
Web Development / Cleaning User input - php example
September 16, 2006, 04:53 AM
I've read a few threads that discuss data sanitation and this is always a subject of debate..

But this is what i've found to be most usefull and avoids having to depend on magic quotes or anything else.

Example code:

// This function included is a copy of phpbb_rtrim();
function data_rtrim($str, $charlist = false)
{
    if ($charlist === false)
    {
        return rtrim($str);
    }

    $php_version = explode('.', PHP_VERSION);

    // php version < 4.1.0
    if ((int) $php_version[0] < 4 || ((int) $php_version[0] == 4 && (int) $php_version[1] < 1))
    {
        while ($str{strlen($str)-1} == $charlist)
        {
            $str = substr($str, 0, strlen($str)-1);
        }
    }
    else
    {
        $str = rtrim($str, $charlist);
    }

    return $str;
}

// These functions parse out new lines, cariage returns
// and other bad data passed from the input fields
// Short input field 35 characters max
function cleanShort($data){
    // Monster header injection defence
    $data = str_replace("\n", NULL, $data);
    $data = str_replace("\r", NULL, $data);
    $data = str_replace("\t", NULL, $data);
    $data = str_replace("0x0D", NULL, $data);
    $data = str_replace("0x0A", NULL, $data);
    $data = str_replace("%0D", NULL, $data);
    $data = str_replace("%0A", NULL, $data);
    $data = str_replace("0x", NULL, $data);
    $data = str_replace("%0", NULL, $data);
    // Send data to be cleaned up.
    $data = substr(htmlspecialchars(str_replace("\'", "'", trim($data))), 0, 35);
    $data = data_rtrim($data, "\\");
    $data = str_replace("'", "\'", $data);
    return $data;
}
// Medium input field 55 characters max
function cleanMedium($data){
    // Monster header injection defence
    $data = str_replace("\n", NULL, $data);
    $data = str_replace("\r", NULL, $data);
    $data = str_replace("\t", NULL, $data);
    $data = str_replace("0x0D", NULL, $data);
    $data = str_replace("0x0A", NULL, $data);
    $data = str_replace("%0D", NULL, $data);
    $data = str_replace("%0A", NULL, $data);
    $data = str_replace("0x", NULL, $data);
    $data = str_replace("%0", NULL, $data);
    // Send data to be cleaned up.
    $data = substr(htmlspecialchars(str_replace("\'", "'", trim($data))), 0, 55);
    $data = data_rtrim($data, "\\");
    $data = str_replace("'", "\'", $data);

    return $data;
}
// Long input field 999 characters max
function cleanLong($data){
    // Monster header injection defence
    $data = str_replace("\n", NULL, $data);
    $data = str_replace("\r", NULL, $data);
    $data = str_replace("\t", NULL, $data);
    $data = str_replace("0x0D", NULL, $data);
    $data = str_replace("0x0A", NULL, $data);
    $data = str_replace("%0D", NULL, $data);
    $data = str_replace("%0A", NULL, $data);
    $data = str_replace("0x", NULL, $data);
    $data = str_replace("%0", NULL, $data);
    // Send data to be cleaned up.
    $data = substr(htmlspecialchars(str_replace("\'", "'", trim($data))), 0, 999);
    $data = data_rtrim($data, "\\");
    $data = str_replace("'", "\'", $data);

    return $data;
}


As you can see it's split up into expected data lengths (types?) so you can customize how you parse each.
This allows stuff such as logins or emails (small text blobs) to be parsed differently then something large ie: submitting a story(large text blobs) as this may need to contain quotes or links and things of that nature.. each would need a different function to properly handle single/double quotes etc...
#4
Have an idea for a  handy util for bots or any client application that connects to servers, but im unsure of the core functions that i'd need.. any idea's welcome..

Core program would do the following:
Input Domain(or ip), then dns the domain/ip then store the results in ini under:

[server=<domain>]
<domain>ip0=127.0.0.1
<domain>ip1=127.0.0.2
<domain>ip2=127.0.0.3

or similar etc..

basic socket/connecting, and config writing, is no big deal can manage that..
Mainly curious about methods|ideas to retrieve ipchains from say useast.battle.net etc..
#5
Say i had a DWORD..

(DWORD)szDWord = 1a2b;       

szDWord contains BYTE's 1a & 2b

Can someone give me a small example of how I could go about getting the individual bytes from that dword value?

I'm assuming a for or while loop but unsure not had luck with it yet.
#6
Building up my dialog in my bot, so far im able to handle check boxes and combo boxes altering states, and adding data where needed..

One thing I can't seem to find searching msdn/google/here is how to send a message to a specific dialog item, to disable/enable it..

Example when a user clicks..
Diablo II: Lord of Destruction <-- A button in my dialog..
I wish to send a message to the edit box item IDC_CONFIG_CDKEY2, to enable it.
So I can bring it from a disabled gray stay to an active state and the reverse also to disable it again when D2XP is not the selected client.

I'm assuming a sendmessage, or senddlgitemmessage to accomplish this, but unsure of the paramaters to send to enable|disable.
MF_ENABLED or BM_ENABLED maybe sent in WPARAM|LPARAM?

*Edit Problem solved:

EnableWindow(IDC_CONFIG_CDKEY2,true); //enables
EnableWindow(IDC_CONFIG_CDKEY2,false); //disables

Just place where you need to toggle things in your WM_INITDIALOG & WM_COMMANDS good deal.

*Edit fixed typo: goodle!  :P
  to google heh
#7
Ok, currently have my program going with a nice little icon in the system tray, uses WM_RBUTTONDOWN to display a menu to do various things(neato!)..

My problem is this:
I need to trap the mouse event when I leave the menu or move to another program or just to desktop currently tried/playing with:

WM_MOUSELEAVE
WM_NCHITTEST //(need to play with this more)
WM_MOUSEACTIVATE //(need to try this one)


Could anyone give me any idea's on which notifications to catch.
Also I'm assuming I should use:

DestroyMenu(HMENU hmenu); 

to go ahead and hide the menu is that correct?

Any idea's are appreciated.

*Update:
Just saw:

WM_CAPTURECHANGED

On msdn bout to try that ill reply if it works or not.
#8
I'm working on getting realm character logins going on my bot, have looked thru bnetdocs and done alot of packet logging so got most info I need.

Was wondering if someone who's been thru this would let me pick their brain a little bit..

Programming in C++ but imagine someone who's done it in VB would do just as well  :P


If so PM me or Email: [email protected]

Or /msg LordVader on Useast, in channel Op DBD
#10
C/C++ Programming / C++ Quick WM_Message question
September 02, 2004, 07:27 PM
When you click the "minimize" button uptop right of an application does that send a specific WM_message command that can be interprited so can make it also:

ShowWindow(hwnd, SW_HIDE);


WM_MINIMIZE? looked at msdn WM_Message list didn't see anything like that heh

Nvm Found it:
WM_SYSCOMMAND:

SC_CLOSE   Close the CWnd object.
SC_HOTKEY   Activate the CWnd object associated with the application-specified hot key. The low-order word of lParam identifies the HWND of the window to activate.
SC_HSCROLL   Scroll horizontally.
SC_KEYMENU   Retrieve a menu through a keystroke.
SC_MAXIMIZE (or SC_ZOOM)   Maximize the CWnd object.
SC_MINIMIZE (or SC_ICON)   Minimize the CWnd object.
SC_MOUSEMENU   Retrieve a menu through a mouse click.
SC_MOVE   Move the CWnd object.
SC_NEXTWINDOW   Move to the next window.
SC_PREVWINDOW   Move to the previous window.
SC_RESTORE   Restore window to normal position and size.
SC_SCREENSAVE   Executes the screen-saver application specified in the [boot] section of the SYSTEM.INI file.
SC_SIZE   Size the CWnd object.
SC_TASKLIST   Execute or activate the Windows Task Manager application.
SC_VSCROLL   Scroll vertically.


By default, OnSysCommand carries out the Control-menu request for the predefined actions specified in the preceding table.

In WM_SYSCOMMAND messages, the four low-order bits of the nID parameter are used internally by Windows. When an application tests the value of nID, it must combine the value 0xFFF0 with the nID value by using the bitwise-AND operator to obtain the correct result.
#11
C/C++ Programming / C++ Memory Use and Management
September 02, 2004, 10:23 AM
Curious to oppinions, when I first create a basic window program with nothing but the window and icon loaded into it. The residual memory it's using when executed is fairly high 2000 K+. I know in asm you can stream line the windows.inc file include by removing un-needed items as one example to reduce over all load and exe size..

Wondering if there are basic known equivelants to that in C++ (best practices basically) for includes and compile settings.

As well as ideas/theories on memory management in general on streamlining performance in applications when/where/method concepts..
#12
Spht's Forum / Style Scrypt bug.
September 02, 2004, 09:17 AM
Noticed after loading up the diff script.cfg's back to back after downloading them to see what they looked like and compare.
My windows font got set to one of the dark gray color's used in the scripts.

OS details if their relevant to this:
Windows 2000 Enterprise Server, Service Pack 4 (5.0 - 2195), (installed for) 20w 6d 5h 57m, (uptime) 16h 55m 38s, (record) 2w 3h 55m 25s (set on 24/08/2004 10:35 pm using Win2K)
#13
Spht's Forum / Problem with Profile Launcher..
September 02, 2004, 08:53 AM
I've been using it some on windows 2000, with virtual desktops setup..

Noticed a few bugs some minor and one major bug:

1. When switching between desktops, the icon duplicates itself in the systray for how ever many profiles/bots you have "Open/Active".

2. Not sure exactly what caused this:
   Guess 1 - If you end task the profile launcher while multiple icons are in place from switching between desktops.. next time you reboot the profile launcher get's confused and try's to auto load the bots that were "out of the loop, xtra icons created while switching between desktops"..
  Guess 2 -  Above happening + the "default" profile being setup, and you have ANY profiles set to autostart..

Result: it get's confused and seems to act as if it's in a loop consuming resources till you end task it (which is a pain to do in that state)..

Sorry for the 2nd instance being vague msg me if you like, can try to recreate it with your knowledge prolly better able to figure out what's going on.

LordVader on Useast, if not on try msn: darkside_net -@T- hotmail -dot- com
#14
Searched the forum only found one thread close was for java and not quite what im looking for..

Basically I want to create a switch that can fire when the program is started if an argument is passed via command (thru a shortcut to the program).. basically the same as you can do in Onlyers D2Loader..

Im assuming:
*Read the comments

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{

   WNDCLASSEX wc;
   HWND hwnd;
   MSG Msg;
   
   hWndInst = hInstance;

   // ---- Registering the Window Class
   wc.cbSize        = sizeof(WNDCLASSEX);
   wc.style         = 0;
   wc.lpfnWndProc   = WndProc;
   wc.cbClsExtra    = 0;
   wc.cbWndExtra    = 0;
   wc.hInstance     = hInstance;
   wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
   wc.hbrBackground = g_hbrBackground;
   wc.lpszClassName = g_szClassMainWnd;
   wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MAINMENU);
   wc.hIcon  = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN_ICON));
   wc.hIconSm  = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN_ICON), IMAGE_ICON, 16, 16, 0);
   
   if(!RegisterClassEx(&wc))
   {
       MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
       return 0;
   }

/******
Put a switch here to check for a -nogui switch to jump to:
an init main function to bypass window creation
Jump to a function to check if the switch was passed and use that as the switch
*******/

int argResults = FindIntMainArgs();

switch(argResults)
   {
   case NoGui:
       //Jump to a basic winmain init function
       break;
   default:
       {
        // Create the Window if no args were sent
        hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, g_szClassMainWnd, "Opbot Testing Console", WS_OVERLAPPEDWINDOW, 0, 0, 450, 200, NULL, NULL, hInstance, NULL);
       if(hwnd == NULL)
       {
           MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
       return 0;
       }
       break;
   }

   ShowWindow(hwnd, nCmdShow);
   UpdateWindow(hwnd);

   // ---- The Message Loop
   while(GetMessage(&Msg, NULL, 0, 0) > 0)
   {
   TranslateMessage(&Msg);
   DispatchMessage(&Msg);
   }
   return Msg.wParam;
}


Basically:
1. Is that in theory a correct/logical way to go about this?

2. What are the functions in C++ that can catch/interprit arg's passed via command line and maybe a small example.. or link..

Thanks in advanced and hope that code makes since..
Not using dialogs in this instance cause im try'n to learn the api i'm new to C++  :P
#15
basically in short:
In C/C++
info: 'c9' is expected and other similar info but i want to pass the data in variable -> zsVerByte instead.
that one problem is hanging me up all over unable to make needed switches for client case matches etc.. alot of different needed things heh.
example:
dBuf.add((int)'c9');

Am new to C++
In: globals.h
Would like to define:
#define GAME_VERBYTE zsVerByte
char zsVerByte[32];
And be able to reuse that properly but unsure of how to parse that elsewhere, to use in ifstatments and switches.. would appreciate any small examples just to see diff ways to accomplish this..

*Note zsVerByte ready to store/redefine the verbyte which comes from the config (storing the data to zsVerByte isn't the issue, using it is)


Thx - Vad