Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • King Bosnia: Any recommendations to private servers?
      October 18, 2018, 04:47:35 PM
    • FightMexoxo: oi i have the files if anyone whats em
      October 18, 2018, 12:44:42 AM
    • The Wanderer: Whoops
      October 15, 2018, 12:56:18 AM
    • The Wanderer: Making own operating system
      October 15, 2018, 12:56:11 AM
    • Travas: no
      October 07, 2018, 04:03:36 PM
    • Saltyspade10: Server still up and running?
      October 05, 2018, 07:13:41 PM
    • Wesam: Can someone upload moparscape.jar?
      October 05, 2018, 11:43:43 AM
    • Ligoe: yo
      September 30, 2018, 12:48:15 PM
    • Ligoe: how come i can't login the game
      September 30, 2018, 12:48:03 PM
    • fuzzout: Anybody here with experience in using Luna source? I'm looking to develop something, but can't seem to get any of my clients to work with it...
      September 26, 2018, 10:47:27 AM
    • `Discardedx2`: ?
      September 21, 2018, 12:24:09 PM
    • Pookey71: ARE YOU HERE TO RECEIVE MY LIMP PENIS!?
      September 20, 2018, 11:55:24 PM
    • Pookey71: THIS IS DEMOCRACY MANIFESTO
      September 20, 2018, 11:55:07 PM
    • Vasi28: Гранд
      September 03, 2018, 07:06:22 PM
    • Rash: test
      August 30, 2018, 09:09:18 PM
    • Guruu:[link]
      August 30, 2018, 12:04:45 AM
    • Guruu: am i allowed to post links shoutbox?
      August 30, 2018, 12:03:46 AM
    • drubrkletern:[link] feedback wanted
      August 28, 2018, 03:55:17 PM
    • bugz000: Anyone got a link for the old ass silab client and cache.zip? from mopar 3.2 era :) 317
      August 25, 2018, 12:48:15 AM
    • cholland2015: Does anyone know where I can download the old moparscape client/server?
      August 24, 2018, 02:30:51 PM

    Author Topic: Spam click protection?  (Read 710 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineMiraak

    • First Time Poster
    • *
    • Posts: 3
    • Thanks: +0/-0
      • View Profile
    Spam click protection?
    « on: July 22, 2015, 04:05:04 AM »
    SOLVED, CAN SOMEONE EXPLAIN TO ME HOW TO ADD SPAM PROTECTION?
     I.e only allowing one click to be registered per second?



    Quote
    I'm using this class to handle sheap shearing

    Code: [Select]
    package ardi.model.npcs;

    import ardi.model.npcs.NPCHandler;
    import ardi.model.players.Client;
    import ardi.event.*;

    public class NPCTransform {

    public static void TransformNPC(final Client c, final int i, final int newId, int anim, final String forceChat, final String msg, final int addItem, final int timer , final int timer2) {
    if (c == null || i < 0 || NPCHandler.npcs[i].lastTransformed < 0)
    return;
    NPCHandler.npcs[i].transformTime = timer2*1000;
    //int npcId = NPCHandler.npcs[i].npcId;
    //final int x = NPCHandler.npcs[i].getX(), y = NPCHandler.npcs[i].getY();

    if (anim != -1)
    c.startAnimation(anim);

    CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    @Override
    public void execute(CycleEventContainer container) {
    if (addItem != -1)
    c.getItems().addItem(addItem, 1);
    if (forceChat.length() > 1)
    NPCHandler.npcs[i].forceChat(forceChat);
    if (msg.length() > 1)
    c.sendMessage(msg);
    NPCHandler.npcs[i].requestTransform(newId);

    container.stop();
    }
    @Override
    public void stop() {
    NPCHandler.npcs[i].lastTransformed = (int) System.currentTimeMillis();
    }
    }, timer);
    }
    }

    Originally provided here: https://www.rune-server.ee/runescape-development/google/snippets/507558-pi-transformnpc.html

    Here's my firstclick:

    Code: [Select]
    case FIRST_CLICK:
    c.npcClickIndex = c.inStream.readSignedWordBigEndian();
    c.npcType = NPCHandler.npcs[c.npcClickIndex].npcType;
    int id = NPCHandler.npcs[c.npcClickIndex].npcId;
    if (c.goodDistance(NPCHandler.npcs[c.npcClickIndex].getX(),
    NPCHandler.npcs[c.npcClickIndex].getY(), c.getX(),
    c.getY(), 2)) {
    c.turnPlayerTo(NPCHandler.npcs[c.npcClickIndex].getX(),
    NPCHandler.npcs[c.npcClickIndex].getY());
    NPCHandler.npcs[c.npcClickIndex].facePlayer(c.playerId);
    c.getActions().firstClickNpc(c.npcType);
    [B][COLOR="#FF0000"]switch(c.npcType){
    case 43:
    NPCTransform.TransformNPC(c,id,42, 893,"Baa!", "You obtain some wool.", 1737, 0 , 5);
    break;
    }[/COLOR][/B]

    c.sendMessage("List Id: " + Integer.toString(id));
    c.sendMessage("NPC Id: " + Integer.toString(c.npcType));
    c.sendMessage("NPC Id2: " + Integer.toString(NPCHandler.npcs[id].npcType));
    } else {

    The issue is, the code isn't working as expected. I suppose timer is for how long it should take for the sheep to revert back to woolen state and timer2 is the delay from click to transformation?
    This is what happens:



    a) The sheep can only be shorn once, even after reverting to its wooly state b)The sheep always returns to wooly state very rapidly
    I've tried playing around with the timer values but I can't seem to make sense of it.

    In addition can someone please clearly explain how this cycleevent/timing/container stuff works? Something tells me I'll be needing to use this a lot, but I just cant wrap my head around it right now.

    THANKS!
    « Last Edit: July 22, 2015, 08:00:08 AM by Miraak »
    Runescape Gambling

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal