Openkore.com

OpenKore Forums
It is currently 21 Oct 2017, 11:39

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: koreGrowl - Growl notification support (Mac OS X) (8/26/08)
PostPosted: 20 Aug 2008, 23:22 
Offline
Perl Monk
Perl Monk

Joined: 04 Apr 2008, 17:26
Posts: 811
UPDATE: This plugin now requires SVN revision 6464 or higher. So far there's no support for timeouts in Mac::Growl (that I know of), but for future ease the timeout setting is handled, anyway.

You need to install Mac::Growl for this plugin. (This plugin is also 100% untested! :roll:) See the koreSnarl thread for installation instructions and more information. (simply ignore the parts about Win32::Snarl.)
Code:
####################################
# koreGrowl.pl: Written by sli     #
#                                  #
# This plugin adds support for the #
# Growl notification system.       #
####################################


package koreGrowl;

use Plugins;
use Globals;

use Mac::Growl ':all';
use utf8;

Plugins::register('koreGrowl','Adds support for the Growl notification system.', \&onUnload);
my $hooks = Plugins::addHooks(
   ['start3', \&onLoad, undef],
   ['packet_privMsg', \&onPrivMsg, undef],
   ['base_level', \&onLevelUp, undef],
   ['self_died', \&onDeath, undef],
   ['job_level', \&onJLevelUp, undef],
   ['pvp_mode', \&onPvpMode, undef],
   ['avoidGM_near', \&onGm, undef],
   ['avoidGM_talk', \&onGm, undef],
   ['in_game', \&onInGame, undef],
   ['item_gathered', \&onItemFound, undef],
   ['map_loaded', \&onMapLoaded, undef]
);

my $cmd = Commands::register(
   ["notify", "Triggers a Growl notification", \&cmdNotify],
);

my $dead = 0;
my @notifications = ("OpenKore Notice", "OpenKore Warning");

sub cmdNotify {
   my @args = @_;
   growlMessage($args[1], 0);
}

sub onLoad {
   if (!$timeout{notify}{timeout} && !$config{koreNotify_timeout}) {
      $timeout{notify}{timeout} = 5;
   } elsif (!$timeout{notify}{timeout} && $config{koreNotify_timeout}) {
      $timeout{notify}{timeout} = $config{koreNotify_timeout};
   }
   RegisterNotifications("OpenKore", \@notifications, \@notifications);
   growlMessage("koreGrowl loaded!", 0);
}

sub onPrivMsg {
   my @args = @_;
   growlMessage("From $args[1]{'privMsgUser'} : $args[1]{privMsg}", 1);
}

sub onLevelUp {
   @args = shift;
   growlMessage("$char->{name} has gained a level!", 0) unless ($args{name} ne $char->{name});
}

sub onJLevelUp {
   @args = shift;
   growlMessage("$char->{name} has gained a job level!", 0) unless ($args{name} ne $char->{name});
}

sub onDeath {
   growlMessage("$char->{name} has died!", 0) unless ($dead);
   $dead = 1;
}

sub onPvpMode {
   growlMessage("WARNING: $char->{name} has entered a PVP area!", 1);
}

sub onGm {
   my $ucname = uc($char->{name}) unless $ucname;
   growlMessage("WARNING: GM IS NEAR $ucname!", 1);
}

sub onInGame {
   growlMessage("$char->{name} is now in game.", 0);
}

sub onItemFound {
   my @args = @_;
   if ($config{koreNotify_items} =~ /$args[1]{item}/i) {
      growlMessage("$char->{name} has found a $args[1]{item}!", 0);
   }
}

sub onMapLoaded {
   # Prevents multiple notifications on death.
   $dead = 0;
}

sub growlMessage {
   $msg = shift;
   $type = shift;

   if ($config{koreNotify} == 1) {
      utf8::encode($msg);
      PostNotification("OpenKore", $notifications[$type], $notifications[$type], $msg, 0, 1, "openkore.png");
   }
}

sub onUnload {
   Plugins::delHooks($hooks);
   undef $ucname;
}

1;

_________________
cs : ee : realist


Top
 Profile  
 
 Post subject: Re: koreGrowl - Growl notification support (Mac OS X) (8/26/08)
PostPosted: 30 Aug 2008, 01:39 
Offline
Noob
Noob

Joined: 29 May 2008, 12:00
Posts: 11
$notifications{$type} => $notifications[$type]

Works great other then that :D


Top
 Profile  
 
 Post subject: Re: koreGrowl - Growl notification support (Mac OS X) (8/26/08)
PostPosted: 06 Sep 2008, 18:59 
Offline
Perl Monk
Perl Monk

Joined: 04 Apr 2008, 17:26
Posts: 811
Bump for bug fix.

_________________
cs : ee : realist


Top
 Profile  
 
 Post subject: Re: koreGrowl - Growl notification support (Mac OS X) (8/26/08)
PostPosted: 10 Sep 2008, 02:33 
Offline
Perl Monk
Perl Monk

Joined: 04 Apr 2008, 17:26
Posts: 811
Whoops, death bug was even more broken. Fixed it for real this time.

_________________
cs : ee : realist


Top
 Profile  
 
 Post subject: Re: koreGrowl - Growl notification support (Mac OS X) (8/26/08)
PostPosted: 14 Sep 2008, 23:52 
Offline
Perl Monk
Perl Monk

Joined: 04 Apr 2008, 17:26
Posts: 811
Bump, added the notify console command.

_________________
cs : ee : realist


Top
 Profile  
 
 Post subject: Re: koreGrowl - Growl notification support (Mac OS X) (8/26/08)
PostPosted: 27 Oct 2008, 15:06 
Offline
Super Moderators
Super Moderators
User avatar

Joined: 06 May 2008, 12:47
Posts: 800
koreGrowl is now in SVN:
https://openkore.svn.sourceforge.net/svnroot/openkore/plugins/koreGrowl/

_________________
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!


Top
 Profile  
 
 Post subject: Re: koreGrowl - Growl notification support (Mac OS X) (8/26/08)
PostPosted: 08 Sep 2017, 03:19 
Offline
Noob
Noob

Joined: 08 Sep 2017, 02:46
Posts: 1
I hate to bump this extremely old thread, but would anyone be able to help me get this working?
I have followed all the steps and installed Mac::Growl but it doesn't seem to work. I don't even get the RegisterNotifications onLoad after starting Openkore. Thank you.

Edit: Nevermind, I got it to work using Applescripts. Thank you for the great plugin!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group