Results 1 to 14 of 14
  1. #1
    Nisuxen's Avatar
    Join Date
    May 2012
    Gender
    male
    Posts
    164
    Reputation
    10
    Thanks
    95

    Realm Relay Loot Notifs

    Super similar to auto loot.

     
    Code:
    // lootnotif.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_NOTIFICATION = $.findPacketId("NOTIFICATION");
    
    var player_id = -1;
    var playerLocation = null;
    var lootbags = {};
    var lootbaglocs = {};
    var send_notif = true;
    
    var tier = 11; // Minimum tier of items to be notifi'ied
    
    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;
    
    			if(send_notif){
    				for(var bag in lootbags){
    					if(lootbaglocs[bag].distanceSquaredTo(playerLocation) <= 200){
    						var params = {} 
    						toNotif = "";
    
    						for(var idx in lootbags[bag]){
    							if(lootbags[bag][idx] != -1){
    								var item = $.findItem(lootbags[bag][idx]);
    								toNotif += "\\n" + item.id
    							}
    						}
    						if(toNotif == ""){
    							continue;
    						}
    						this.displayNotification(event,bag,0x00ffff,toNotif);						
    					}
    				}
    				send_notif = false;
    				$.scheduleEvent(2, "refresh_notif");
    			}
    			
    			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;
    								}
    							}
    
    						}
    					}
    
    				}
    			}
    
    			// 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;
    								}
    							}
    
    						}
    					}
    				}
    			}
    			break;
    		}
    	}
    }
    
    function displayNotification(event, playerObjectId, color, text) {
    	var notificationPacket = event.createPacket(ID_NOTIFICATION);
    	notificationPacket.objectId = playerObjectId;
    	notificationPacket.message = "{\"key\":\"blank\",\"tokens\":{\"data\":\"" + text + "\"}}";
    	notificationPacke*****lor = color;
    	event.sendToClient(notificationPacket);
    }
    
    function refresh_notif(event) {
    	send_notif = true;
    }

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

    059 (12-24-2013),Cyeclops (10-26-2013),DANWARPER (10-27-2013),HappyMan20 (01-10-2015),lookbehindyou (10-26-2013),Yotsuba (01-05-2014),Zong14 (11-08-2013)

  3. #2
    Zong14's Avatar
    Join Date
    Nov 2013
    Gender
    male
    Posts
    26
    Reputation
    10
    Thanks
    1
    Is it possible to convert this to be usable without RR?

  4. #3
    superbromo's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    58
    Reputation
    10
    Thanks
    149
    So, stupid question. could you help me with figuring out how to add hp/mp pots to this?


    IGN: MANOFNONE - GWS in ROTMG

  5. #4
    059's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    California
    Posts
    3,312
    Reputation
    700
    Thanks
    92,772
    Quote Originally Posted by superbromo View Post
    So, stupid question. could you help me with figuring out how to add hp/mp pots to this?
    in here:

    0xa20, // Def Pot
    0xa1f, // Att Pot
    0xa21, // Spd Pot
    0xa34, // Vit Pot
    0xa35, // Wis Pot
    0xa4c, // Dex Pot
    0xae9, // Life Pot
    0xaea // Mana Pot

    add another two lines with the hex codes for an hp pot and mp pot (they're in muledump in constants.js)
    My Vouches
    Having an issue with RotMG? Check for the solution here.


    Need Realm items? Come to RealmStock!

    Accepting PayPal - Bitcoin - Giftcards
    Selling ST Sets, Class Top Sets, Life Pots, and much more!


    Find it here: MPGH Sales Thread

  6. The Following 2 Users Say Thank You to 059 For This Useful Post:

    Alde. (12-28-2013),Yotsuba (01-05-2014)

  7. #5
    059's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    California
    Posts
    3,312
    Reputation
    700
    Thanks
    92,772
    sorry double posted
    My Vouches
    Having an issue with RotMG? Check for the solution here.


    Need Realm items? Come to RealmStock!

    Accepting PayPal - Bitcoin - Giftcards
    Selling ST Sets, Class Top Sets, Life Pots, and much more!


    Find it here: MPGH Sales Thread

  8. #6
    FainTMako's Avatar
    Join Date
    Nov 2013
    Gender
    male
    Posts
    332
    Reputation
    10
    Thanks
    244
    My Mood
    Inspired
    0xa22, // Health Pot
    0xa23, // Magic Potion

    I used that to quickly find health and magic pots

  9. #7
    HappyMan20's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    295
    Reputation
    10
    Thanks
    35
    My Mood
    Relaxed
    Quote Originally Posted by 059 View Post
    in here:

    0xa20, // Def Pot
    0xa1f, // Att Pot
    0xa21, // Spd Pot
    0xa34, // Vit Pot
    0xa35, // Wis Pot
    0xa4c, // Dex Pot
    0xae9, // Life Pot
    0xaea // Mana Pot

    add another two lines with the hex codes for an hp pot and mp pot (they're in muledump in constants.js)
    I know this is an old post. So are the pots the only items it displays a name for? And could I add any item (such as Acclaim) to the list to get a loot notification for the item (Acclaim)?

  10. #8
    JustAnoobROTMG's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    1,916
    Reputation
    185
    Thanks
    18,230
    Quote Originally Posted by HappyMan20 View Post
    I know this is an old post. So are the pots the only items it displays a name for? And could I add any item (such as Acclaim) to the list to get a loot notification for the item (Acclaim)?
    ofc .
    Find the item ID from client's XMLs (use swfbinextract) and add it to the list
    Due to a recent DMCA takedown attempt we had to remove Faintmako brain. Please do not paid attention to what he say or do.


  11. The Following User Says Thank You to JustAnoobROTMG For This Useful Post:

    HappyMan20 (01-10-2015)

  12. #9
    kills64's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    52
    Reputation
    10
    Thanks
    19
    My Mood
    Angelic
    Quote Originally Posted by JustAnoobROTMG View Post
    ofc .
    Find the item ID from client's XMLs (use swfbinextract) and add it to the list
    Or you can find xml here: https://static.drips.pw/rotmg/production/current/xml/
    To find acclaim you need to Equip.xml

  13. The Following 2 Users Say Thank You to kills64 For This Useful Post:

    HappyMan20 (01-10-2015),Sztucznooki (01-27-2015)

  14. #10
    Sztucznooki's Avatar
    Join Date
    Dec 2014
    Gender
    male
    Posts
    20
    Reputation
    10
    Thanks
    0
    My Mood
    Inspired
    @JustAnoobROTMG do you know maybe why isn't it working? I mean. When I have this script running, and there is a bag nearby I get D/C ( I can't see the bag even. Like the looting packet crashes something)


    Code:
    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;
    								}
    							}
    
    						}
    					}
    
    				}
    What are those types that I bolded? - trying to figure out what can possibly go wrong


    Edit2:
    MY debugger said, that that green line crashes. Now I will check what's inside that function
    Last edited by Sztucznooki; 01-27-2015 at 03:30 PM.

  15. #11
    JustAnoobROTMG's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    1,916
    Reputation
    185
    Thanks
    18,230
    Quote Originally Posted by Sztucznooki View Post
    @JustAnoobROTMG do you know maybe why isn't it working? I mean. When I have this script running, and there is a bag nearby I get D/C ( I can't see the bag even. Like the looting packet crashes something)


    Code:
    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;
                                    }
                                }
    
                            }
                        }
    
                    }
    What are those types that I bolded? - trying to figure out what can possibly go wrong


    Edit2:
    MY debugger said, that that green line crashes. Now I will check what's inside that function
    red : Bag type ids
    green : get the item type from the XML using its numerical id (obf1?)

    Equip.xml may be ...outdated?
    Due to a recent DMCA takedown attempt we had to remove Faintmako brain. Please do not paid attention to what he say or do.


  16. #12
    Sztucznooki's Avatar
    Join Date
    Dec 2014
    Gender
    male
    Posts
    20
    Reputation
    10
    Thanks
    0
    My Mood
    Inspired
    Quote Originally Posted by JustAnoobROTMG View Post
    red : Bag type ids
    green : get the item type from the XML using its numerical id (obf1?)

    Equip.xml may be ...outdated?
    No, I updated it with this one: https://static.drips.pw/rotmg/product.../xml/Equip.xml and named it "items.xml"

    still don't know where is the problem

  17. #13
    Knorrex's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Location
    ~
    Posts
    517
    Reputation
    15
    Thanks
    975
    My Mood
    Angelic
    Quote Originally Posted by Sztucznooki View Post
    @JustAnoobROTMG do you know maybe why isn't it working? I mean. When I have this script running, and there is a bag nearby I get D/C ( I can't see the bag even. Like the looting packet crashes something)


    Code:
    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;
                                    }
                                }
    
                            }
                        }
    
                    }
    What are those types that I bolded? - trying to figure out what can possibly go wrong


    Edit2:
    MY debugger said, that that green line crashes. Now I will check what's inside that function
    Only thing I can think of is: stop using java 8

  18. #14
    Sztucznooki's Avatar
    Join Date
    Dec 2014
    Gender
    male
    Posts
    20
    Reputation
    10
    Thanks
    0
    My Mood
    Inspired
    Quote Originally Posted by Knorrex View Post
    Only thing I can think of is: stop using java 8
    ohh... I am using it! So you think, there is the problem? I will try uninstalling it and installing the 7th as soon as I come back home. Thanks for an advice!

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. [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
  3. [Outdated] [HEXED TO 16.2] RotMG In-Game Mod selector (new update) LOOT NOTIFICATIONS
    By Mmozoc in forum Realm of the Mad God Hacks & Cheats
    Replies: 56
    Last Post: 09-07-2013, 03:21 AM
  4. [Help Request] loot notification
    By recloud in forum Realm of the Mad God Help & Requests
    Replies: 15
    Last Post: 08-29-2013, 08:31 PM
  5. [Help Request] Loot notifications?
    By Skatzi in forum Realm of the Mad God Help & Requests
    Replies: 6
    Last Post: 08-01-2013, 09:32 AM