Snooping Implementation

Here you can post threads on the development of the current release of the core (100)

Moderator: POL Developer

Post Reply
Distro Developer
Posts: 100
Joined: Sun Jul 17, 2016 1:29 am

Snooping Implementation

Post by ThisIsMe » Thu Nov 18, 2021 12:35 am

I've over the last few months been working on implementing a system that enables snooping where the player double clicks the backpack of their victim.

To achieve this, I've hooked the double click packet because I had discussed Snooping in the past with I think Nando or maybe Kevin and I was told the core just drops the packet if you're double clicking on a backpack of another player.

While I'm not too thrilled about hooking the use item packet to achieve my goals and my system does work with a few minor errors including the disappearing backpack which I can't overcome at this moment, an idea came to me!

We have a number of scripts in /scripts/misc/ that are more or less optional, so why not have a snooping.src. The idea being that if this were present, the core would send the mobile who is trying to snoop and the victim being snooped or the container being snooped when a player tries to use another player's backpack. If the snooping.ecl is not present, then the core behaves as it does now, dropping the packet.

This was my initial thought on the matter at least, then I spoke with Kevin.

The Kevin Direct Messages:
Kevin had mentioned that snooping implementation had been mulled over, kicked around and generally thought about by the devs in the past but two questions had arisen that would be problematic.

1.) How do we handle the inserting and removing of an item to and from the snooping container?
2.) How does one stop the using of an item within the snooped container?

I had worked these out on my end in the main CanInsert/OnInsert/CanRemove/OnRemove scripts for containers checking to see if the root container was a container being actively snooped from and if so act accordingly. (deny removal via drag n drop, allow insertion via drag n drop)

For using an item I wrote a function which again checks to see if the item is in a container and if so, is the root container a container the user of said item is Snooping from and if so block the usage with a message of something like "You need to steal that first."

While this is likely an upheaval to implement on existing shards to have a snooping system that matches the official shards, I decided for further expansion, some additional functionality beyond a Snooping.src script, if possible, would be handy.

Expanded Things:
New Core Item similar to the WornItems container object for SnoopingContainer. This would allow for adding the appropriate needed snooping only scripts to without muddling up existing container scripts.

SendSnoopingContainer( mobile,, container)
The return values would be error or the snooping container ref on success.
This would send the container being snooped to the snooper using the above new item as the container.

AllowItemUsageInSnoopingContainer=0/1 (default 0)
If an item were being used within a Snooping Container, to block it's usage, it's an all or nothing solution that gives ease of control to shard developers if they don't want to script around the using of items in a snooping container but gives us the option if we so wish to do so.

snoopingcontainer member
This would return, similar to the tradewindow member, the active snooping container reference or error if none. This would allow us to disallow snooping from multiple victims in a more easy fashion.

Closing up:
In the end, I think the /scripts/misc/snooping.src is really all that is needed and if nothing else I'd really like to have a snooping.src core script so I don't have to hook the use item packet.

Post Reply