Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
7.6 Map parsing - Page 2
Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: 7.6 Map parsing

  1. #11
    Senior Member
    Join Date
    Mar 2007
    Posts
    367

    RE: 7.6 Map parsing

    You made me into dlding 7.6 xD

    I've connected to first OT I've found and checked the structure.
    It goes almost same as with 7.7.

    Code:
    4 bytes - things count
    10*12 bytes - things in stack
    10*4 bytes - things stack pos
    4 bytes - filler
    HTH

  2. #12
    Junior Member
    Join Date
    Feb 2010
    Posts
    28

    RE: 7.6 Map parsing

    so... there should be structure, which consists:

    int
    array (10), which consists things in stack
    array(10) of int
    and the last int, which is a filler?

  3. #13
    Senior Member
    Join Date
    Mar 2007
    Posts
    367

    RE: 7.6 Map parsing

    Exactly.

    Something like this I believe:
    [code=c++]struct objectData{
    int objectId;
    int data1;
    int data2;
    };
    struct tileDef {
    int stackSize;
    objectData Data[10];
    int stackPos[10];
    int unknown;
    };[/code]

    To find yourself in the map array (selfPos) loop through the Data array stackSize times.

    For example:
    If you have a single map tile on the ground and yourself, the stackSize=2.
    Now... if you put rope under yourself and pick it back up, the stackSize will change to 3 and 2 afterwards.
    But the rope info will stay in the memory at stackPos=3.
    Same goes for creatures - there's lots of garbage in the memory map array and you have to loop only through number of things determined by stackSize.

    HTH

  4. #14
    Junior Member
    Join Date
    Feb 2010
    Posts
    28

    RE: 7.6 Map parsing

    After changing:
    Z is still 0.
    Comunicate from Tibia: "First go upstairs".
    Here is the code:
    Code:
    int mappointer=0x4AF478;
    struct objectData{
        int objectId;
        int data1;
        int data2;
    };
    struct tileDef {
        int stackSize;
        objectData Data[10];
        int stackPos[10];
        int unknown;
    };
    tileDef map[2016];
    	int goingto_x;
    	int goingto_y;
    	int goingto_z;
    
    void go(int x,int y, int z){
    	Battle B;
    	B=Read_Battle_List();
    	for (int i=0;i<150;i++){
    		if(B[i].idall==Read(0x4A1244,4)){
    			int val=1;
    			int addr=(0x4A12AC-4)+156*i+76;
    			int addr_x=0x4A1288;
    			int addr_y=0x4a1284;
    			int addr_z=0x4A1280;
    			WriteProcessMemory(process, (void*)addr_x, &x, 4, 0);
    			WriteProcessMemory(process, (void*)addr_y, &y, 4, 0);
    			WriteProcessMemory(process, (void*)addr_z, &z, 4, 0);
    			WriteProcessMemory(process, (void*)addr, &val, 4, 0);
    			break;
    		}
    	}
    }
    void download_map(){
            ReadProcessMemory(process, (LPVOID)Read(mappointer,4), map, sizeof(tileDef)*2016, NULL);
    }
    void search_for(int id){
    	download_map();
        for(int i=0;i<2016;i++){
            for(int e=0;e<map[i].stackSize;e++){
                if(map[i].Data[e].objectId==99){
    				if(map[i].Data[e].data1==id){
    				goingto_z = i/(14*18);
    				goingto_y= (i-goingto_z*14*18)/18;
    				goingto_x=(i-goingto_z*14*18-goingto_y*18);
    				char buff[10];
    				itoa(goingto_z,buff,10);
    				MessageBox(NULL,buff,"",MB_OK);
    				go(goingto_x-1,goingto_y,goingto_z);
    				}
                }
            }
        }
    }

  5. #15
    Senior Member
    Join Date
    Mar 2007
    Posts
    367

    RE: 7.6 Map parsing

    x/y/z you get from selfPos is your position in the memory map array.
    This has absolutely nothing to do with your character global position.
    You have to read memory map array position for your position and the target, and then apply it accordingly to your target.
    For example:
    If your global opsition is 32000x32000x7 and the target is 1 tile north and 3 tiles west from you then:
    find yourself in map array - 12x5x6 (made up)
    apply vector to your target - 12x5x6 + -3x-1x0 = 32000x32000x6 + -3x-1x0 = 31997x31999x7

    Now you have the global target position.

    HTH

  6. #16
    Super Moderator
    Join Date
    May 2007
    Posts
    1,191

    RE: 7.6 Map parsing

    goingto_z = i/(14*18);
    goingto_y= (i-goingto_z*14*18)/18;
    goingto_x=(i-goingto_z*14*18-goingto_y*18);

    This will only create a memory location. To get a world location out of it, you need to find the player's memory location, then adjust the both memory locations so that the player's memory location is in the center. Then offset the player's world location using the tile's memory location.

  7. #17
    Junior Member
    Join Date
    Feb 2010
    Posts
    28

    RE: 7.6 Map parsing

    I did it Thank you for everything Shall I post effects here for rest of forum?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •