TomenetGame / tomenet

TomeNET is an online multiplayer roguelike role-playing game
https://www.tomenet.eu/
Other
70 stars 12 forks source link

Feature/auto pickup #17

Closed EvgenijK closed 3 years ago

EvgenijK commented 3 years ago

Hello.

This code implements mostly client sided auto-pickup feature.   Changes on the server are done for code improvement and neater work of this feature.  

With this feature it's possible to go through piles of items, automatically picking up only items you want, destroying others. This drastically decreases time on checking piles of items when farming.

Main purpose of this feature is gameplay improvement for high-level characters, who can farm pits and have auto-id.   Right now it's very time consuming to check all loot, e.g. after a D pit.   There is a choice to check all loot item by item or just destroy all destroyable items and get what's left.  

This feature comes from an idea of picking up all items, inscribing valuable ones by auto-inscription rules with !k and destroying others. 

Low-mid level characters can use auto-pickup with destroy_on_auto_pickup option off - to only pick up easy id items like stat potions or valuable jewelry and not destroying other items.

What is implemented

checking logic

Is based on auto-inscription code and uses an auto-inscriptions list.   Items that match one of the rules are picked up. if option destroy_on_auto_pickup is on, other items are destroyed.

There is a special check for rules that are starting with !! - this item will not be picked up nor destroyed(if destroy_on_auto_pickup option is on).

new packet type

Has to be done to separate messages of what items the character sees under him from other "You see ..." messages, because all of them are sent by msg_format().   Without this packet type I would have to add string parsing code to Receive_message().

new player indicator destroyed_floor_item

To allow a character to spend energy on destroying items on the floor only once after entering a grid, until he enters another grid. This with destroy_on_auto_pickup option creates a loop on item piles that ends if item matches no-pickup rule or cannot be destroyed, or there are no more items under the character. Basically this is implemented for faster looting.

auto_pickup client option

Simple toggling of this feature. Also I added a slash command to allow creating macros for fast toggling (you usually don't want to always pick up items, e.g. you are in a fight or walking in you house).

destroy_on_auto_pickup client option

If this option is on, all items that don't match the rules will be destroyed. This behaviour can be changed for rules, starting with !! (see "checking logic").