[RealmRelay] Updated Event Notifier

Posts 15 of 5 · Page 1 of 1
[RealmRelay] Updated Event Notifier
Show a notification for :

- Events ( Oryx events ) : The notification will say if the boss is dead or if he just spawned
- Events called by players ( lab, horse, cland, manor ) : The notification will say who called for the event and what he said

Teleport command :

/tpto ( Teleport to the last guy who called for an event

Example :

- Player A : lab tp !!
- You : /tpto

It will teleport you to Player A

 
EventNotif.js
Code:
//EventNotif.js

var ID_TEXT = $.findPacketId("TEXT");
var ID_PLAYER_TEXT = $.findPacketId("PLAYERTEXT");
var ID_CREATE_SUCCESS = $.findPacketId("CREATE_SUCCESS");
var ID_NOTIFICATION = $.findPacketId("NOTIFICATION");
var ID_UPDATE = $.findPacketId("UPDATE");
var ID_TELEPORT = $.findPacketId("TELEPORT");



var playerObjectId = -1 ;
var iDtpTo = -1 ;

// colors
	var white = 0xFFFFFF;
	var black = 0x000000;
	var lightGrey = 0xC0C0C0;
	var grey = 0x808080;
	var red = 0xFF0000;
	var orange = 0xF0A804;
	var yellow = 0xFFFF00;
	var green = 0x008000;
	var blue = 0x0000FF;
	var purple = 0x800080;


// Messages
	// Crystal
		var Crystal = [
			"Sweet treasure awaits for powerful adventurers!",
			"I think you need more people...",
			"If you are not very strong, this could kill you"
		];
		var CrystalBroke = [
			"You cracked the crystal! Soon we shall emerge! You might want to BACK AWAY..!!"
		];

	// Sphinx
		var Sphinx = [
			"At last, a Grand Sphinx will teach you to respect!",
		    "A Grand Sphinx is more than a match for this rabble.",
		    "My Grand Sphinxes will bewitch you with their beauty!"
		];

		var lastSphinx = [
			"You festering rat-catchers! A Grand Sphinx will make you doubt your purpose!",
			"Gaze upon the beauty of the Grand Sphinx and feel your last hopes drain away."
		];


		var SphinxDead = [
			 "My Grand Sphinx, she was so beautiful. I will kill you myself",
		     "My Grand Sphinx had lived for thousands of years!",
		     "you up-jumped goat herder! You shall pay for defeating my Grand Sphinx!",
		     "you pestiferous lout! I will not forget what you did to my Grand Sphinx!",
		     "you foul ruffian! Do not think I forget your defiling of my Grand Sphinx!"
		];

	// Hermit
		var Hermit = [
			"My Hermit God's thousand tentacles shall drag you to a watery grave!"
		];
		var HermitDead = [
			"My Hermit God was more than you'll ever be",
	        "Without my Hermit God, Dreadstump is free to roam the seas without fear!"
		];

	// Ship
		var Ship = [
			"My Ghost Ship will terrorize you pathetic peasants!",
			"A Ghost Ship has entered the Realm."
		];
		var ShipDead = [
			"defeat my dreaded Ghost Ship?!",
	        "has crossed me for the last time! My Ghost Ship shall be avenged.",
	        "The spirits of the sea will seek revenge on your worthless soul"
		];

	// Skull Shrine

		var Skull = [
			"Your futile efforts are no match for a Skull Shrine!"
		];
		var SkullDead = [
			"defaced a Skull Shrine! Minions, to arms!",
	        "razed one of my Skull Shrines -- I WILL HAVE MY REVENGE!",
	        "you will rue the day you dared to defile my Skull Shrine!",
	        "you contemptible pig! Ruining my Skull Shrine will be the last mistake you ever make!",
	        "{PLAYER}, you insignificant cur! The penalty for destroying a Skull Shrine is death!"
		];

	// Cube

		var Cube = [
			"Your meager abilities cannot possibly challenge a Cube God!",
			"Worthless mortals! A mighty Cube God defends me!"
		];
		var CubeDead = [
			"You have dispatched my Cube God",
			"I have many more Cube Gods",
			"you wretched dog! You killed my Cube God!",
			"you pathetic swine! How dare you assault my Cube God!"
		];

	// Pentaract

		var Pentaract = [
			"Behold my Pentaract, and despair!",
			"Ignorant fools! A Pentaract guards me still!"
		];
		var PentaractDead = [
			"That was but one of many Pentaracts",
			"you destoryed my Pentaract!",
			"by destroying my Pentaract you have sealed your own doom!"
		];

	// Lord
		var Lord = [
	        "Pathetic fools! My Lord of the Lost Lands will crush you all!",
	        "My Lord of the Lost Lands will make short work of you!",
	        "Cower in fear of my Lord of the Lost Lands!"
		];
		var LordDead = [
			"How dare you foul-mouthed hooligans treat my Lord of the Lost Lands with such indignity!",
	        "What trickery is this?! My Lord of the Lost Lands was invincible!"
		];

	// lich
		var finalLich = [
			"My final Lich shall consume your souls!",
		    "My final Lich will protect me forever!"
		];



function onClientPacket(event) {
	var packet = event.getPacket();
	switch (packet.id()) {
		case ID_PLAYER_TEXT: {
			var text = packet.text.toLowerCase();

			// Tp to the guy who called for event	
			if(text == "/tpto"){

				tpto(event);
			}
			break;
		}
	}
}




function onServerPacket(event) {
	
	var packet = event.getPacket();

	switch (packet.id()) {

		case ID_CREATE_SUCCESS: {
			playerObjectId = packet.objectId;
			break;
		}
	
	
		case ID_TEXT: {
			
		

				var text = packet.text;
				var filteredText = packet.text.toLowerCase();
				

                // Print the chat in console ( remove the line if unwanted )
				$.echo(packet.name+"+ "+text);
				// Print Saved ID
				$.echo("Saved ID: "+iDtpTo);




					// Player calling for something
						if (filteredText.indexOf('lab') >= 0) {

							displayRealmRelayNotification(event, playerObjectId, purple, packet.name +": Called for Lab! : "+ text);
							iDtpTo = packet.objectId;
						}

						if (filteredText.indexOf('horse') >= 0) {

							displayRealmRelayNotification(event, playerObjectId, grey, packet.name +": Called for Horse! : "+ text);
							iDtpTo = packet.objectId;
						}

						if (filteredText.indexOf('crystal') >= 0) {

							displayRealmRelayNotification(event, playerObjectId, blue, packetname +": Called for Crystal! : "+ text);
							iDtpTo = packet.objectId;
							
						}

						if (filteredText.indexOf('cland') >= 0) {

							displayRealmRelayNotification(event, playerObjectId, red, packet.name +": Called for Candy Land!"+ text);
							iDtpTo = packet.objectId;
						}
						if (filteredText.indexOf('manor') >= 0) {

							displayRealmRelayNotification(event, playerObjectId, red, packet.name +": Called for Manor!"+ text);
							iDtpTo = packet.objectId;
						}


						
					// Events
						// Crystal
							if (text == Crystal) {
								
								displayRealmRelayNotification(event, playerObjectId, blue,"Crystal found!");
					
							}
							if (text == CrystalBroke) {
								
								displayRealmRelayNotification(event, playerObjectId, blue,"Crystal Broke!");
					
							}
						
						// Sphinx
							if (text == Sphinx) {
							
							displayRealmRelayNotification(event, playerObjectId, orange,"Sphinx Somewhere!");
				
							}
							if (text == SphinxDead) {
							
							displayRealmRelayNotification(event, playerObjectId, purple,"Sphinx is Dead!");
				
							}

						// Hermit
							if (text == Hermit) {
							
							displayRealmRelayNotification(event, playerObjectId, orange,"Hermit Somewhere!");
				
							}
							if (text == HermitDead) {
							
							displayRealmRelayNotification(event, playerObjectId, purple,"Hermit is Dead!");
				
							}

						// Ship
							if (text == Ship) {
							
							displayRealmRelayNotification(event, playerObjectId, orange,"Ghost Ship Somewhere!");
				
							}
							if (text == ShipDead) {
							
							displayRealmRelayNotification(event, playerObjectId, purple,"Ghost Ship is Dead!");
				
							}

						// Skull Shrine
							if (text == Skull) {
							
							displayRealmRelayNotification(event, playerObjectId, orange,"Skull Shrine Somewhere!");
				
							}
							if (text == SkullDead) {
							
							displayRealmRelayNotification(event, playerObjectId, purple,"Skull Shrine is Dead!");
				
							}

						// Cube
							if (text == Cube) {
							
							displayRealmRelayNotification(event, playerObjectId, orange,"Cube Somewhere!");
				
							}
							if (text == CubeDead) {
							
							displayRealmRelayNotification(event, playerObjectId, purple,"Cube is Dead!");
				
							}

						// Pentaract
							if (text == Pentaract) {
							
							displayRealmRelayNotification(event, playerObjectId, orange,"Pentaract Somewhere!");
				
							}
							if (text == PentaractDead) {
							
							displayRealmRelayNotification(event, playerObjectId, purple,"Pentaract is Dead!");
				
							}

						// Lord
							if (text == Lord) {
							
							displayRealmRelayNotification(event, playerObjectId, orange,"Lord of the Lost Lands Somewhere!");
				
							}
							if (text == LordDead) {
							
							displayRealmRelayNotification(event, playerObjectId, purple,"Lord of the Lost Lands is Dead!");
				
							}

						// lich
							if (text == finalLich) {
							
							displayRealmRelayNotification(event, playerObjectId, orange,"FINAL LICH!!");
				
							}

			
		}

	}
}



function displayRealmRelayNotification(event, playerObjectId, color, text) {
	var notificationPacket = event.createPacket(ID_NOTIFICATION);
	notificationPacket.objectId = playerObjectId;
	notificationPacket.message = "{\"key\":\"blank\",\"tokens\":{\"data\":\"" + text + "\"}}";
	notificationPacket.color = color;
	event.sendToClient(notificationPacket);
}


function tpto(event) {
	
	//send tp packet
	var tp_packet = event.createPacket(ID_TELEPORT);
	tp_packet.objectId = iDtpTo;
	event.sendToServer(tp_packet);
}
Don't know if it works, but i looks nice, anyway thanks.
It doesn't work very well, atleast it's not showing anything on the client, btw the /tpto works.
Grey notifications are kinda a stupid move in glands, but works well.
It doesn't show Oryx notif...
Posts 15 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?