Page 11 of 13

Re: Plug-in system for Latikai's client

PostPosted: Mon Jul 03, 2017 12:50 pm
by Goodman12
Qiresea wrote:this alert system doesnt sound very balanced. does it add a huge amount of insanity to the player who has activated it every time a player appears on the minimap? if not, i should like to suggest it does.

Things such as gaining insanity when an action is done can only be added by the devs themselves.Furthermore I don't think that's even doable when it comes to how plugins work.

Re: Plug-in system for Latikai's client

PostPosted: Mon Jul 03, 2017 2:49 pm
by Kandarim
Goodman12 wrote:
Qiresea wrote:this alert system doesnt sound very balanced. does it add a huge amount of insanity to the player who has activated it every time a player appears on the minimap? if not, i should like to suggest it does.

Furthermore I don't think that's even doable when it comes to how plugins work.


indeed: much as the client has no idea about many things going on on the server, the server has no idea about what kind of wizardry is running within your client. Consider it a delicate balance.

Re: Plug-in system for Latikai's client

PostPosted: Mon Jul 03, 2017 4:09 pm
by Taipion
Kandarim wrote:
Goodman12 wrote:
Qiresea wrote:this alert system doesnt sound very balanced. does it add a huge amount of insanity to the player who has activated it every time a player appears on the minimap? if not, i should like to suggest it does.

Furthermore I don't think that's even doable when it comes to how plugins work.


indeed: much as the client has no idea about many things going on on the server, the server has no idea about what kind of wizardry is running within your client. Consider it a delicate balance.


From the balance perspective, Marp and JC wanted it, Marp even made the icon for it, so that's that.
Also, it is so simple to make, that I suspect many already have such a tool, it is more a question of having an even playing field.

And population is so sparse anyways, it may help turn some near miss into a more entertaining encounter. :D

Re: Plug-in system for Latikai's client

PostPosted: Tue Jul 04, 2017 12:32 am
by Goodman12
This is how this is gonna play out:
People forget to turn alarm on but since they are too dependent on it they will lose all their awareness of map and the area around them thus making it easier for other players to sneak up on them. At least that's what's gonna happen for people in the same bracket as heffernan when it comes to common sense.

Re: Plug-in system for Latikai's client

PostPosted: Tue Jul 04, 2017 12:35 am
by Goodman12
btw links for the fuel fuller plugin isn't there

Re: Plug-in system for Latikai's client

PostPosted: Tue Jul 04, 2017 6:19 am
by Lihz
I Think the reason the devs likes it is because it's probably gonna be used at least as much as an offensive addon.

Re: Plug-in system for Latikai's client

PostPosted: Tue Jul 04, 2017 6:37 am
by Goodman12
Lihz wrote:I Think the reason the devs likes it is because it's probably gonna be used at least as much as an offensive addon.

wrong

Re: Plug-in system for Latikai's client

PostPosted: Tue Jul 04, 2017 7:18 am
by Kandarim
Goodman12 wrote:btw links for the fuel fuller plugin isn't there


fixed. Should get around to taipion's alarm plugin soon.

Re: Plug-in system for Latikai's client

PostPosted: Sat Jul 08, 2017 3:52 am
by nosfirebird
has the distiller plugin been fixed yet?

Re: Plug-in system for Latikai's client

PostPosted: Mon Jul 17, 2017 5:14 pm
by Darwoth
Taipion wrote:Now adding a false sense of security for everyone...

I present to you, a player alert plugin!

Someone came to me and asked for a plugin like this, and I sent him to Marp to get it approved, as I did not think this would be OK.
Much to my surprise, Marp said that he AND JC think it's ok!
And to cast away the last of my doubts, Marp even made the icon for this one!
And no, it's not a phallic symbol, at least if you don't turn it upside down...

HEYQcDD.png


Shamelessly salvaging code from Kandarims Frog/Critter Plugin, and some code from the clients timers that were originally made by Ender,
I basically had not much to do myself to make it work, or in other words, it really is so simple.

Note: You can use a custom wave file as alert sound, simply name it alertsound.wav and place it in your salem folder, usually found under "Users/YourUser/Salem".
Note2: You can also use a custom wave file for the timers of the custom clients, by placing a file there named timer.wav in the same place.


Usage:

Simply turn it on by clicking the icon, or using the hotkey "j".

It will use the timers alarm sound as default.

And it will go off if anything with a player model (except yourself) is nearby, this may include: other players, NPCs, friends, mannequins, the recently deceased, ....

After a successful alarm, you need to manually re-activate it for another use.



Here's the most important java part of the code:
Code: Select all
package haven.plugins;

import haven.*;

import static java.lang.Thread.sleep;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.List;

import org.ender.timer.Timer;

public class PlayerAlertPlugin extends Plugin {

   private static UI ui = null;

   private static boolean isRunning = false;
   private static boolean signalToStop = false;

   public void load(UI ui) {
      Glob glob = ui.sess.glob;
      Collection<Glob.Pagina> p = glob.paginae;
      p.add(glob.paginafor(Resource.load("paginae/add/playeralertplugin")));
      XTendedPaginae.registerPlugin("playeralertplugin", this);
   }

   public void execute(UI ui) {

      PlayerAlertPlugin.ui = ui;

      if (!isRunning) {
         isRunning = true;
         new Thread(new Runnable() {
            @Override
            public void run() {
               perform_task();
            }
         }, "Pickup Plugin").start();
      } else {
         signalToStop = true;
         ui.message("[PlayerAlertPlugin] Stopping...", GameUI.MsgType.INFO);
      }

   }

   private void perform_task() {

      ui.message("[PlayerAlertPlugin] Turning on player detection... ", GameUI.MsgType.INFO);

      while (!signalToStop) {

         Collection<Gob> gobs = ui.sess.glob.oc.getGobs();
         Iterator<Gob> gobs_iterator = gobs.iterator();
         Gob current_gob = null;
         int bodyCount = 0;
         String nm = null;

         // Pretty standard iterating over gobs code from Kandarim...
         while (gobs_iterator.hasNext()) {
            current_gob = gobs_iterator.next();
            try {
               ResDrawable rd = current_gob.getattr(ResDrawable.class);
               Composite cmp = current_gob.getattr(Composite.class);
               if (cmp != null) {
                  nm = cmp.base.get().name;
               }
            } catch (Loading l) {
            }

            // This will match players, yourself, other players, npcs,
            // mannequins, recently deceased,...
            if (nm != null && nm.contains("gfx/borka/body")) {
               bodyCount++;
            }
            nm = null;
         }

         // If there is more than one player visible...
         if (bodyCount > 1) {
            // ...put a nice, red message out
            ui.message("[PlayerAlertPlugin] Nearby Player detected!!!", GameUI.MsgType.BAD);
            try {
               Object file1;
               // ...play a (customizeable) sound
               try {
                  // place a file called "alertsound.wav" in your Salem
                  // folder for custom sound,
                  // code taken from the clients timers (made by Ender)
                  file1 = new FileInputStream(Config.userhome + "/alertsound.wav");
               } catch (FileNotFoundException arg4) {
                  file1 = Timer.class.getResourceAsStream("/timer.wav");
               }
               Audio.play((InputStream) file1, 1.0D, 1.0D);
            } catch (Exception e) {
               ui.message("[PlayerAlertPlugin] Error on the Audio thingy: " + e.getMessage(), GameUI.MsgType.INFO);
            }
            // ...and exit the outer loop to stop the plugin
            break;
         }

         // Interval in between checks
         try {
            sleep(500);
         } catch (InterruptedException ignored) {
         }
      }

      if (!signalToStop) {
         // wait a sec to not overwrite the red alert message...
         try {
            sleep(3000);
         } catch (InterruptedException ignored) {
         }
      }
      
      ui.message("[PlayerAlertPlugin] Stopped", GameUI.MsgType.INFO);
      
      isRunning = false;
      signalToStop = false;
   }

}


And some links...

... one for the bold and reckless, to an already compiled jar

... and one to a .zip of the project



been a while since i nauseated myself by checking this thread, i am certain the game needed this as badly as a nuclear emp pulse in the sky over the server.