Page 1 of 5 123 ... LastLast
Results 1 to 15 of 73
  1. #1
    Nisuxen's Avatar
    Join Date
    May 2012
    Gender
    male
    Posts
    164
    Reputation
    10
    Thanks
    95

    Realm Relay autoloot

    Neat script to make. It's pretty quick on the first pick up of an item but is not super fast at subsequent ones such as multiple items in a bag or multiple bags close to eachother. But it should get em all. I'm also not positive it works for all bag types but it should.

    This script will also give all your characters a backpack. It's a bit buggy but it will store items. You don't seem to be able to drop items from the backpack but you can put things from it to your vault. It also doesn't update with the game so things might seem to be missing or invisible to you but using a portal will update it. The autoloot will put things in it but again, they may not appear until you change portals.

    Of course, if you already have a backpack it will work the same as always.

    The list of items it will autoloot only has potions. Look through xmls and add items as you desire. Let me know if bugs pop up as I did not extensively test it. I'll probably make loot notifications soon. Shouldn't be bad with this script done.

     
    Code:
    // autoloot.js
    
    var ID_MOVE = $.findPacketId("MOVE");
    var ID_UPDATE = $.findPacketId("UPDATE");
    var ID_NEW_TICK = $.findPacketId("NEW_TICK");
    var ID_CREATE_SUCCESS = $.findPacketId("CREATE_SUCCESS");
    var ID_INV_SWAP = $.findPacketId("INVSWAP");
    
    var player_id = -1;
    var playerLocation = null;
    var lootbags = {};
    var lootbaglocs = {};
    var playerInventory = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];
    
    var tier = 11; // Minimum tier of items to be autolooted
    
    var desirables = [
    					0xa20, // Def Pot
    					0xa1f, // Att Pot
    					0xa21, // Spd Pot
    					0xa34, // Vit Pot
    					0xa35, // Wis Pot
    					0xa4c, // Dex Pot
    					0xae9, // Life Pot
    					0xaea  // Mana Pot
    				];
    
    function onClientPacket(event) {
    	var packet = event.getPacket();
    	switch (packet.id()) {
    		case ID_MOVE: {
    			var time = packet.time;
    			playerLocation = packet.newPosition;
    
    			for(var bag in lootbags){
    				if(lootbaglocs[bag].distanceSquaredTo(playerLocation) <= 2){
    					for(var idx in lootbags[bag]){
    						if(lootbags[bag][idx] != -1){
    							for(var i = 0; i < playerInventory.length; i++){
    								if(playerInventory[i] == -1){
    									var swapPacket = event.createPacket(ID_INV_SWAP);
    									swapPacket.time = time;
    									swapPacket.position = playerLocation;
    									swapPacket.slotObject1 = event.createSlotObject();
    									swapPacket.slotObject1.objectId = bag;
    									swapPacket.slotObject1.slotId = idx;
    									swapPacket.slotObject1.objectType = lootbags[bag][idx];
    									swapPacket.slotObject2 = event.createSlotObject();
    									swapPacket.slotObject2.objectId = player_id;
    									swapPacket.slotObject2.slotId = i + 4;
    									swapPacket.slotObject2.objectType = -1;
    									event.sendToServer(swapPacket);
    									playerInventory[i] = lootbags[bag][idx];
    									break;
    								}
    							}
    						}
    					}
    				}
    			}
    			break;
    		}
    	}
    }
    
    function onServerPacket(event) {
    	var packet = event.getPacket();
    	switch (packet.id()) {
    		case ID_CREATE_SUCCESS: {
    			player_id = packet.objectId;
    			break;
    		}
    		case ID_UPDATE: {
    			// New objects
    			for (var i = 0; i < packet.newObjs.length; i++) {
    				var objectData = packet.newObjs[i];
    				if(objectData == null)
    					break;
    
    				var type = objectData.objectType;
    
    				if(type == 1280 || type == 1283 || (type >= 1286 && type <= 1296)){
    					// new loot bag
    					var bagId = objectData.status.objectId;
    					lootbags[bagId] = [-1,-1,-1,-1,-1,-1,-1,-1];
    					lootbaglocs[bagId] = objectData.status.pos;
    
    					for (var j = 0; j < objectData.status.data.length; j++){
    						var statData = objectData.status.data[j];
    						if(statData.obf0 >= 8 && statData.obf0 <= 15){
    							if(statData.obf1 != -1){
    								var item = $.findItem(statData.obf1);
    
    								if(item.tier >= tier || item.bagType == 4 || desirables.indexOf(statData.obf1) != -1){
    									lootbags[bagId][statData.obf0 - 8] = statData.obf1;
    								}
    							}
    
    						}
    					}
    				}
    
    				if(objectData.status.objectId == player_id){
    					for (var j = 0; j < objectData.status.data.length; j++){
    						var statData = objectData.status.data[j];
    
    						if(statData.obf0 >= 12 && statData.obf0 <= 19){
    							playerInventory[statData.obf0-12] = statData.obf1;
    						}
    						else if(statData.obf0 >= 71 && statData.obf0 <= 78){
    							playerInventory[statData.obf0-63] = statData.obf1;
    						}
    						else if(statData.obf0 == 79){
    							objectData.status.data[j].obf1 = 1;
    						}
    					}
    				}
    			}
    
    			// Removed objects
    			for (var i = 0; i < packet.drops.length; i++) {
    				var droppedObjectId = packet.drops[i];
    
    				if(lootbags[droppedObjectId] != null){
    					delete lootbags[droppedObjectId];
    					delete lootbaglocs[droppedObjectId];		
    				}
    			}
    
    			break;
    		}
    		case ID_NEW_TICK: {
    			for (var i = 0; i < packet.statuses.length; i++) {
    				var status = packet.statuses[i];
    
    				if(lootbags[status.objectId] != null){
    					for (var j = 0; j < status.data.length; j++){
    						var statData = status.data[j];
    						if(statData.obf0 >= 8 && statData.obf0 <= 15){
    							if(statData.obf1 == -1){
    								lootbags[status.objectId][statData.obf0 - 8] = statData.obf1;
    							}else{
    								var item = $.findItem(statData.obf1);
    
    								if(item.tier >= tier || item.bagType == 4 || desirables.indexOf(statData.obf1) != -1){
    									lootbags[status.objectId][statData.obf0 - 8] = statData.obf1;
    								}
    							}
    
    						}
    					}
    				}
    
    				if(status.objectId == player_id){
    					for (var j = 0; j < status.data.length; j++){
    						var statData = status.data[j];
    
    						if(statData.obf0 >= 12 && statData.obf0 <= 19){
    							playerInventory[statData.obf0-12] = statData.obf1;
    						}
    						else if(statData.obf0 >= 71 && statData.obf0 <= 78){
    							playerInventory[statData.obf0-63] = statData.obf1;
    						}
    						else if(statData.obf0 == 79){
    							status.data[j].obf1 = 1;
    						}
    					}
    				}
    			}
    			break;
    		}
    	}
    }


    Updated to autoloot items of tier 11 or higher. Also loots white bag items.
    Fixed issue where it wasn't picking up from bags that went out of loaded area.
    Last edited by Nisuxen; 10-25-2013 at 12:41 PM.

  2. The Following 7 Users Say Thank You to Nisuxen For This Useful Post:

    059 (03-02-2014),LaserplasmaX (03-01-2014),maat7043 (03-22-2014),Pepsi Cola (01-23-2014),Tignite (11-04-2013),whomedude (03-25-2014),zekikez (11-21-2013)

  3. #2
    DeVoidCoder's Avatar
    Join Date
    Oct 2013
    Gender
    male
    Posts
    105
    Reputation
    10
    Thanks
    702
    You might want to also use $.findItem(searchterm) since you could additionally check each item's tier.
    Rough example of how to use it:
    Code:
    if ($.findItem(slotObject.objectType).tier > 9) {
    // pick it up
    }
    e. I was testing it some time ago, and you can only pick up an item about every 0.5 seconds.
    Last edited by DeVoidCoder; 10-24-2013 at 03:01 PM.

  4. The Following User Says Thank You to DeVoidCoder For This Useful Post:

    Nisuxen (10-24-2013)

  5. #3
    Nisuxen's Avatar
    Join Date
    May 2012
    Gender
    male
    Posts
    164
    Reputation
    10
    Thanks
    95
    Quote Originally Posted by DeVoidCoder View Post
    You might want to also use $.findItem(searchterm) since you could additionally check each item's tier.
    Rough example of how to use it:
    Code:
    if ($.findItem(slotObject.objectType).tier > 9) {
    // pick it up
    }
    Brilliant. I didnt even consider doing that. I'll add that when I can.

  6. #4
    Nisuxen's Avatar
    Join Date
    May 2012
    Gender
    male
    Posts
    164
    Reputation
    10
    Thanks
    95
    Quote Originally Posted by DeVoidCoder View Post
    I was testing it some time ago, and you can only pick up an item about every 0.5 seconds.
    Is that something thats enforced in general or are you commenting on the speed of this autoloot script?

  7. #5
    DeVoidCoder's Avatar
    Join Date
    Oct 2013
    Gender
    male
    Posts
    105
    Reputation
    10
    Thanks
    702
    Quote Originally Posted by Nisuxen View Post
    Is that something thats enforced in general or are you commenting on the speed of this autoloot script?
    It is enforced by the server. Attempting to pick up more than 1 item in 0.5 seconds will result in the first item being picked up. The server will prevent the second item from being picked up.

  8. #6
    dg123's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Posts
    552
    Reputation
    10
    Thanks
    264
    My Mood
    Bored
    Quote Originally Posted by DeVoidCoder View Post
    It is enforced by the server. Attempting to pick up more than 1 item in 0.5 seconds will result in the first item being picked up. The server will prevent the second item from being picked up.
    will the first thing being picked up time be increased?

  9. #7
    dg123's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Posts
    552
    Reputation
    10
    Thanks
    264
    My Mood
    Bored
    if adding backpacks are possible....would it be possible to store more hp/mp pots? have no limit

  10. #8
    DANWARPER's Avatar
    Join Date
    Aug 2013
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0
    My Mood
    Blah
    Firs of all yeah the snail guy whose name i cant see has an awesome idea and second of all could you post the code so it loots hp/mp pots too?? that would be awesome. Also im thinking about a script which uses hp pots(if you have any) when you health is oh lets say 50 percent. in combination with auto nexus would make a great combination

  11. #9
    DeVoidCoder's Avatar
    Join Date
    Oct 2013
    Gender
    male
    Posts
    105
    Reputation
    10
    Thanks
    702
    Quote Originally Posted by dg123 View Post
    if adding backpacks are possible....would it be possible to store more hp/mp pots? have no limit
    The hp and mp potions are stored in a different way than normal items. They could be auto-looted with a script, but I think the limit would still be in effect.

  12. #10
    gorgor's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    Toxic Sewer
    Posts
    583
    Reputation
    15
    Thanks
    161
    I believe this will cause huges lags, as it will perform check every time you have a loot bag in the screen...

  13. #11
    dg123's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Posts
    552
    Reputation
    10
    Thanks
    264
    My Mood
    Bored
    Quote Originally Posted by gorgor View Post
    I believe this will cause huges lags, as it will perform check every time you have a loot bag in the screen...
    i get no lag

  14. #12
    DeVoidCoder's Avatar
    Join Date
    Oct 2013
    Gender
    male
    Posts
    105
    Reputation
    10
    Thanks
    702
    Quote Originally Posted by gorgor View Post
    I believe this will cause huges lags, as it will perform check every time you have a loot bag in the screen...
    The loot bag data is already loaded before you even see the loot bag in the client. The checks are only done if the player is within a small distance of the bag, and even then, there is not much processing for the inventory checks.

  15. #13
    dg123's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Posts
    552
    Reputation
    10
    Thanks
    264
    My Mood
    Bored
    Devoid u ever gonna make GUI for realmrelay...so we can turn scripts off while its still running....

  16. #14
    Nisuxen's Avatar
    Join Date
    May 2012
    Gender
    male
    Posts
    164
    Reputation
    10
    Thanks
    95
    Quote Originally Posted by dg123 View Post
    Devoid u ever gonna make GUI for realmrelay...so we can turn scripts off while its still running....
    While a GUI would be welcome as it would open the path towards an Odom like interface for more visual scripts such as dyes and pets, in the mean time it is quite easy to set a text command that will enable or disable a script. See my ability auto aim for an example.

  17. #15
    dg123's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Posts
    552
    Reputation
    10
    Thanks
    264
    My Mood
    Bored
    Quote Originally Posted by Nisuxen View Post
    While a GUI would be welcome as it would open the path towards an Odom like interface for more visual scripts such as dyes and pets, in the mean time it is quite easy to set a text command that will enable or disable a script. See my ability auto aim for an example.
    well if i have more then 3 scripts i cant connect to usw .... even if i disable your auto aim with the text chat

Page 1 of 5 123 ... LastLast

Similar Threads

  1. PLEASE NEED HELP WITH REALM RElAY
    By DANWARPER in forum Realm of the Mad God Help & Requests
    Replies: 18
    Last Post: 01-04-2014, 05:38 AM
  2. Realm Relay /con
    By Nisuxen in forum Realm of the Mad God Tutorials & Source Code
    Replies: 5
    Last Post: 12-15-2013, 12:10 PM
  3. Realm Relay /wc
    By Nisuxen in forum Realm of the Mad God Tutorials & Source Code
    Replies: 5
    Last Post: 10-27-2013, 11:32 PM
  4. [Release] Realm Relay Command Script!
    By angelofsilence123 in forum Realm of the Mad God Hacks & Cheats
    Replies: 7
    Last Post: 10-21-2013, 02:06 AM
  5. [Outdated] Realm Relay v1.0.0 - Proxy for RotMG 17.2
    By DeVoidCoder in forum Realm of the Mad God Hacks & Cheats
    Replies: 126
    Last Post: 10-17-2013, 10:23 PM