Jump to content
  • 0

@Arealoot


Dragonis1701

Question


  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   7
  • Joined:  05/25/12
  • Last Seen:  

So, I've looked at hercules' plugin for @arealoot and saw that it used greed's code to help do what it wanted. I decided to try and use it for myself and convert it over to rAthena but I'm having a bit of trouble. I don't dabble that much in the source, so I'm not very good at it but this is what I have so far:
 

Incorrect code removed.

It compiles but it does not change anything. It does give me a warning, though. This one: "1>c:\rathena\src\map\pc.c(4254): warning C4047: '==' : 'int (__cdecl *)(map_session_data *,flooritem_data *)' differs in levels of indirection from 'int'" I  think I understand what it means but I'm not sure how to fix it. Please help. =X

Edited by Dragonis1701
Link to comment
Share on other sites

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   7
  • Joined:  05/25/12
  • Last Seen:  

Care to share?

 

I've been trying my hand at this on and off for months now.

 

 

Can you share your code?

Oh, hey guys. Sorry, I didn't know you replied to this topic. I'm quoting you both so you both get a notification. Here is the code:

void clif_parse_TakeItem(int fd, struct map_session_data *sd)
{
    struct flooritem_data *fitem;
    int map_object_id;
    int skill_greed(struct block_list *bl, va_list ap);

    //First we declare a variable that gets the return value
    int debug_i = 0;

    map_object_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);

    fitem = (struct flooritem_data*)map_id2bl(map_object_id);
    do {
        if (pc_isdead(sd)) {
            clif_clearunit_area(&sd->bl, CLR_DEAD);
            break;
        }

        if (fitem == NULL || fitem->bl.type != BL_ITEM || fitem->bl.m != sd->bl.m)
            break;

        if (pc_cant_act(sd))
            break;
        
        if (sd->state.arealoot == 1) {
        //Now we give the variable
        debug_i = map_foreachinrange(skill_greed,&sd->bl,3,BL_ITEM,&sd->bl);

        //Now we print it to the map-server console so you can see what it is while playing
        //ShowDebug("debug_i=%d", debug_i);

        //Give fail packet if no item was looted
        if(debug_i == 0)
            break;
        }
        else {
        if (!pc_takeitem(sd, fitem))
            break;
        }
        return;
    } while (0);
    // Client REQUIRES a fail packet or you can no longer pick items.
    clif_additem(sd,0,0,6);
}

That code is located in clif.c. I also added a command @arealoot in the atcommand.c. If you need that code as well, just let me know.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   7
  • Joined:  05/25/12
  • Last Seen:  

So, I worked on it some more and found that using the already existing code was better. So, now I have it where the code is like this:

Incorrect code removed.

And now with this code, it will clear multiple items but it will not loot multiple items. Is there a command I'm missing that can provide this function?


Got it to work with Playtester's help. ^^

Edited by Dragonis1701
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  01/09/13
  • Last Seen:  

Care to share?

 

I've been trying my hand at this on and off for months now.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Can you share your code?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

 

Care to share?

 

I've been trying my hand at this on and off for months now.

 

 

Can you share your code?

Oh, hey guys. Sorry, I didn't know you replied to this topic. I'm quoting you both so you both get a notification. Here is the code:

 

void clif_parse_TakeItem(int fd, struct map_session_data *sd)
{
    struct flooritem_data *fitem;
    int map_object_id;
    int skill_greed(struct block_list *bl, va_list ap);

    //First we declare a variable that gets the return value
    int debug_i = 0;

    map_object_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);

    fitem = (struct flooritem_data*)map_id2bl(map_object_id);
    do {
        if (pc_isdead(sd)) {
            clif_clearunit_area(&sd->bl, CLR_DEAD);
            break;
        }

        if (fitem == NULL || fitem->bl.type != BL_ITEM || fitem->bl.m != sd->bl.m)
            break;

        if (pc_cant_act(sd))
            break;
        
        if (sd->state.arealoot == 1) {
        //Now we give the variable
        debug_i = map_foreachinrange(skill_greed,&sd->bl,3,BL_ITEM,&sd->bl);

        //Now we print it to the map-server console so you can see what it is while playing
        //ShowDebug("debug_i=%d", debug_i);

        //Give fail packet if no item was looted
        if(debug_i == 0)
            break;
        }
        else {
        if (!pc_takeitem(sd, fitem))
            break;
        }
        return;
    } while (0);
    // Client REQUIRES a fail packet or you can no longer pick items.
    clif_additem(sd,0,0,6);
}

That code is located in clif.c. I also added a command @arealoot in the atcommand.c. If you need that code as well, just let me know.

 

 

Can you post the full code or share it via message? Thanks!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   7
  • Joined:  05/25/12
  • Last Seen:  

atcommand.c

/*==========================================
 * @arealoot
 *------------------------------------------*/
ACMD_FUNC(arealoot) {
    if (sd->state.arealoot) {
        sd->state.arealoot = 0;
        clif_displaymessage(sd->fd,"Arealoot is now disabled.");
        return 0;
    }

    sd->state.arealoot = 1;
    clif_displaymessage(sd->fd,"Arealoot is now enabled.");
    return 0;
}
void atcommand_basecommands(void) {
 
AtCommandInfo atcommand_base[] = {
 
ACMD_DEF(arealoot),
Edited by Dragonis1701
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

 

atcommand.c

/*==========================================
 * @arealoot
 *------------------------------------------*/
ACMD_FUNC(arealoot) {
    if (sd->state.arealoot) {
        sd->state.arealoot = 0;
        clif_displaymessage(sd->fd,"Arealoot is now disabled.");
        return 0;
    }

    sd->state.arealoot = 1;
    clif_displaymessage(sd->fd,"Arealoot is now enabled.");
    return 0;
}

 

The first 2 post goes to pc.c? the void code goes to clif.c and last one is atcommand.c?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   7
  • Joined:  05/25/12
  • Last Seen:  

Nah, the pc.c codes are not right. You just do the last two codes I posted: the one in clif.c and the one in atcommand.c

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  99
  • Reputation:   10
  • Joined:  01/13/12
  • Last Seen:  

pc.h

bool arealoot;
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

 

pc.h

bool arealoot;

 

where do you add this?

Nah, the pc.c codes are not right. You just do the last two codes I posted: the one in clif.c and the one in atcommand.c

 

Jr2JFgv.jpg

 

i'm having error because of the state->arealoot 

Edited by Meister
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   7
  • Joined:  05/25/12
  • Last Seen:  

Are you using a different emulator? My code says sd->state.arealoot not struct s_state.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Are you using a different emulator? My code says sd->state.arealoot not struct s_state.

 

using rAthena only.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   7
  • Joined:  05/25/12
  • Last Seen:  

Then the code should work for you if you copied it correctly.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Then the code should work for you if you copied it correctly.

 

I copied it correctly, mind attaching .txt file for it?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   7
  • Joined:  05/25/12
  • Last Seen:  

It's going to be exactly what I already posted but okay.

text.txt

Edited by Dragonis1701
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

It's going to be exactly what I already posted but okay.

 

I think its not on pc.c its on clif.c the one on the text.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  174
  • Reputation:   6
  • Joined:  07/01/12
  • Last Seen:  

its not compiling

 

any one can help us?

 

guys help me !!!

error compiling.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  45
  • Reputation:   7
  • Joined:  11/07/14
  • Last Seen:  

On 17/02/2018 at 8:02 PM, Felipe Martins said:

guys help me !!!

error compiling.png

I get the same error as he does. Anything on that?!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  12
  • Reputation:   0
  • Joined:  12/23/17
  • Last Seen:  

me too i get this error

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  115
  • Reputation:   4
  • Joined:  08/14/16
  • Last Seen:  

bump! we need this amazing code

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  12
  • Reputation:   3
  • Joined:  06/16/18
  • Last Seen:  

Finally i make this .diff manualy, it work on my rathena's version

Edit: Resolved some issues, and added possibility to config range in battle_conf
But don't know why, when i put range to 10 that make not difference with 3

 

@arealoot.diff

Edited by Metahego
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  115
  • Reputation:   4
  • Joined:  08/14/16
  • Last Seen:  

@Metahego im currently using the latest rathena, and i can't compile my server it causes errors. Would you like to help me resolve this? tyvm

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  12
  • Reputation:   3
  • Joined:  06/16/18
  • Last Seen:  

wakefield21 Can you send me your compile errors ?

Edited by Metahego
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  115
  • Reputation:   4
  • Joined:  08/14/16
  • Last Seen:  

@Metahego i already fixed the compiling part, then i stumbled on this error which i think is critical.

if the command @arealoot is disabled and you drop an item example a red potion and pick it up the item will be duplicated and there will be an error on the console like this one.

164781473_errorofserver.jpg.a6f166dba8fb738993ef4dd8abc51c9b.jpg

now if the command @arealoot is enabled there will be no errors on the console and there will be no item duplication.

I hope this will be fixed asap as this command is very helpful.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...