Language: 
To browser these website, it's necessary to store cookies on your computer.
The cookies contain no personal information, they are required for program control.
  the storage of cookies while browsing this website, on Login and Register.

Author Topic:  auto loot  (Read 195 times)

0 Members and 1 Guest are viewing this topic.

Dolfo

« on: 15, August 2023, 16:23:36 »
I am trying to build an auto loot logic in relation to marked containers, restricted to corpse opening atm. I have more ideas for high players later, but this would be an improvment for all players. Thinking of a new player finding a pouch, asking for what i need a pouch, he got answered in chat : "Ah mark it, then you have auto loot for money, gems"

Autoloot must behind container_link logic, because this handles traps in corpse.

Update: Logic must be in container_link before esrv_open_container.

Code: [Select]
// auto loot in marked container on corpse on maps
if (sack->subtype & SUBTYPE_CONTAINER_CORPSE && sack->map)
{
    object_t *mark = find_marked_object(pl->ob);
    if (mark && mark->type==CONTAINER)
    {
        object_t *this, *next;
        FOREACH_OBJECT_IN_OBJECT(this, sack, next)
        {
            // we only precheck race, we don't want the messages here from thing_pick_up
            if (this->race == mark->race)
            {
                // thing_pick_up handle all other. it's also adjust nrof, when we have nrof 0 items.
                thing_pick_up(pl->ob, this, mark, this->nrof);
            }
        }
    }
}
thing_pick_up normaly only allow a where container, when this is linked to the player. this is mostly only when a player had applied and open the container in inventory. If we send where for a unapplied player container like our marked item, we need to change the sanity check in thing_pick_up too.
Code: [Select]
// when we have a where, we need a linked player container (applied and open) or a marked container for autoloot logic
if (where)
{
    if (!pl || where != pl->container && where != find_marked_object(who))
        return NULL;
}
« Last Edit: 12, November 2023, 01:45:17 by Dolfo »
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Dolfo

« Reply #1 on: 19, August 2023, 19:54:58 »
Client is not updating the corpse pile and player inventory. I need update the corpse manually (walk away or close/reopen it)

« Last Edit: 12, September 2023, 17:04:56 by Dolfo »
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Dolfo

« Reply #2 on: 20, August 2023, 12:51:02 »
Instead of auto loot we could also go for my pickup corpse idea, leading to a pickup all command or implement a real pickup all command?

https://www.daimonin.org/12339/pickup-all/msg110211/#msg110211

But i like the idea of giving containers an auto loot feature. Changing game from micro management to  more automated (lesser micro) management when players advance in game.

In this situation finding their first container. Activating the autoloot by marking them.  8)

As player i am tired of applying 1000 corpses followed by cursor right, get, get, get, get ... commands
And in group this goes more insane, when players come same spot shifting my corpse more to the right, so i need re adjust my corspe with more cursor key(s). This is a pain of micromanagment in late game and no fun for players.  ::)
« Last Edit: 20, August 2023, 12:59:53 by Dolfo »
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Dolfo

« Reply #3 on: 23, August 2023, 19:57:33 »
When i looked in client side event.t,  KEYFUNC_APPLY has mainly a small logic before sending apply command to server, where KEYFUNC_GET has a much complexer logic.

This leads to a "syncron" client/server behavior when command is get, also with my pickup all logic there. But when i use same pickup logic in apply, client is missing updating his view.

So i could go in clientsite and do the update for autopick in KEYFUNC_APPLY or try to send from serversite an "update your data" command.

Looks like i need OBJECT_UPDATE_UPD(object, flag) somehow to make the autoloot working?  ::)
« Last Edit: 12, November 2023, 01:45:47 by Dolfo »
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Dolfo

« Reply #4 on: 13, September 2023, 17:33:07 »
 :'(

For the moment i need to stop here. Client is refusing to update. Everything else works fine, server sided we have a "clean" autoloot to the marked container. If we walk one step aside or simply close/reopen the corpse all is looted.

It's also interesting that i can produce the server fkey chaos with this logic. So problem looks like it is more than simple the missing item update for the view. It confuses the client in his item order and from there in his assigned fkeys.

Without oberserving simultaneously the client, i think i have no chance to come closer to the problem(s).  ::) I have updated the logic in first post.
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Dolfo

« Reply #5 on: 11, November 2023, 15:49:45 »
So I know now, why this happens.

When applying the corpse, we call first container_link. This is handling all the stuff to open the corpse, triggering traps, flashing traps, showing items in container and send a SERVER_CMD_DRAWINFO2 to client to show the items on ground.

Then I come with my logic and delete items on ground and insert this in the marked player container.

And this works all fine, except the SERVER_CMD_DRAWINFO2 from containerlink is executed as last command. So client gets the order to show the content, before we picked up (deleted) all. This situation also means for the client to delete items in player inventory, we moved "before" there and add this back to floor.

This bug is the similiar situation as our container pickup bug.

We work with FiFO mechanics, but somehow this don't work clean?  We could try a kind of timestamp check, so client can react intelligent, like a kind of "oh this show item on floor command, is timestamped before a delete item from floor command I executed before, so I ignore this."

I found an easier solution, like the trap flashing, I put autoloot in container_link function before esrv_open_container is called. So finally this works.

Was a hard trip to come here.  ::)

So we can mark now containers and have autoloot, when we apply corpses on ground. We can use this to auto loot all, what is allowed for the marked container and what fits in or we can filter money and jewelry with pouches.  8)
« Last Edit: 12, November 2023, 01:41:21 by Dolfo »
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Tags:
 

Related Topics

  Subject / Started by Replies Last post
4 Replies
5999 Views
Last post 14, June 2010, 18:30:57
by smacky
7 Replies
19946 Views
Last post 26, November 2011, 18:50:31
by blingking114
8 Replies
5168 Views
Last post 09, July 2014, 08:12:06
by petarkiller
5 Replies
124 Views
Last post 27, October 2022, 19:05:31
by _people_
4 Replies
382 Views
Last post 07, April 2023, 00:32:25
by Shroud