Skip to content

Conversation

@Emistry
Copy link
Member

@Emistry Emistry commented Aug 27, 2017

Pull Request Prelude

Changes Proposed

Autoloot are useful and popular among the players.
However, sometimes when we try to restrict the autoloot usage at certain map, we can only rely on mapflag nocommand to disable the autoloot, or some tricky ways of using the npc script (bindatcmd/OnPCLoadMapEvent..etc).
With this mapflag, server has more control over the autoloot usage and prevent player abuse the autoloot feature when the server doesn't want them to use it at certain maps.

Affected Branches:

  • : Master

Issues addressed:
Enable server to disable autoloot settings for certain maps.

@Emistry Emistry added status:inprogress Issue is being worked on / the pull request is still a WIP type:enhancement Issue describes an enhancement or feature that should be implemented labels Aug 27, 2017
@Emistry Emistry self-assigned this Aug 27, 2017
@HerculesWSAPI
Copy link
Contributor

This change is Reviewable

@Emistry Emistry force-pushed the mapflag_noautoloot branch from bb31943 to 22e3fe9 Compare August 27, 2017 18:11
if (map->list[m_id].flag.guildlock)
strcat(atcmd_output, msg_fd(fd,1097)); // GuildLock |
if (map->list[m_id].flag.noautoloot)
strcat(atcmd_output, "No Autoloot |"); // NoViewID |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change comment appropriately

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, will change it

int i;
int action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset

// Disable autoloot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra tab

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

src/map/mob.c Outdated

if( sd
&& (drop_rate <= sd->state.autoloot || pc->isautolooting(sd, ditem->item_data.nameid))
&& ((drop_rate <= sd->state.autoloot || pc->isautolooting(sd, ditem->item_data.nameid)) && !map->list[sd->bl.m].flag.noautoloot)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not need this, instead you can edit
pc_isautolooting to return false if player is on noautoloot

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but i think the pc_isautolooting doesnt cover the sd->state.autoloot

src/map/pc.c Outdated
pc->setrestartvalue(sd,1);
}

if (map->list[m].flag.noautoloot) { // Disable autoloot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not need this, as this would be doing unnecessary setting of variables to 0, even if they are 0.
pc_isautolooting should be enough

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this would mean.
Warping from noautoloot map to other maps where autoloot is allowed would make autoloot list empty.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this part, auto loot list will be remain upon enter/leave the map with noautoloot mapflag.

@Emistry Emistry force-pushed the mapflag_noautoloot branch 2 times, most recently from 1ccde8e to 94f81f8 Compare September 3, 2017 07:29
@Emistry Emistry removed the status:inprogress Issue is being worked on / the pull request is still a WIP label Sep 3, 2017
@dastgirp
Copy link
Member

dastgirp commented Sep 4, 2017

Should we do the way it is now(not allowing to turn autoloot on/off or add items) or allow autoloot commands but also display message that autoloot is off in current map?

@dastgirp
Copy link
Member

dastgirp commented Sep 4, 2017

Also just a message when warping to new map would be good. To let player know autoloot is off.

@Emistry
Copy link
Member Author

Emistry commented Sep 4, 2017

Should we do the way it is now(not allowing to turn autoloot on/off or add items) or allow autoloot commands but also display message that autoloot is off in current map?

I think its good to turn it off. Prevent player asking "Why I can use @autoloot but its not looting any items."

Also just a message when warping to new map would be good. To let player know autoloot is off.

erm, I think should be fine without any message to notify them.... just like any other mapflags (nosave, nocommand) we doesn't display any message to alert them that these commands are disabled when they enter the map.

@Helianthella Helianthella added this to the next release milestone Oct 8, 2017
Copy link
Member

@Helianthella Helianthella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested, works fine

@MishimaHaruna
Copy link
Member

The way this is implemented doesn't offer a great user experience in my opinion. Some critical points that I'd like to be addressed before merging this:

  • If an user has autoloot enabled, and wants to disable it while in a map with this flag, they won't be able to. They instead see a message saying that auto looting items is disabled in the current map (but that's not what they were trying to do to begin with).
  • Assuming that a server implements an OnPCLoginEvent that enables autoloot for the users, it'll fail if they log in while in a map with this flag (and won't turn on if they later leave that map).

I'd personally prefer to have the ability to toggle the setting regardless of whether the map allows autolooting. Since autoloot is a global setting attached to the player (rather than attached to the map), then maps shouldn't disallow any changes to the setting, but just disable its effect.

@MishimaHaruna MishimaHaruna added the codereview:needsedits Some edits have been requested before the pull request can be accepted label Oct 16, 2017
@Emistry Emistry force-pushed the mapflag_noautoloot branch from 94f81f8 to 4aac1d7 Compare October 18, 2017 16:57
@ghost ghost added the status:inprogress Issue is being worked on / the pull request is still a WIP label Oct 18, 2017
@Emistry
Copy link
Member Author

Emistry commented Oct 18, 2017

Removed the restriction to use the atcommands in the map that has this mapflag.

@Emistry Emistry removed the status:inprogress Issue is being worked on / the pull request is still a WIP label Oct 18, 2017
Copy link
Member

@MishimaHaruna MishimaHaruna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, just one more thing: db/constants.conf needs a mf_noautoloot entry (and an update to mv_noviewid, since its value changed. I believe it's ready to merge afterwards

- Enable server to disable autoloot settings for certain maps.
@Emistry Emistry force-pushed the mapflag_noautoloot branch from 4aac1d7 to 2c2839c Compare October 21, 2017 16:15
@ghost ghost added the status:inprogress Issue is being worked on / the pull request is still a WIP label Oct 21, 2017
@Emistry
Copy link
Member Author

Emistry commented Oct 21, 2017

Aw, didn't realize that. Thank you and I have updated it.

@MishimaHaruna MishimaHaruna removed the codereview:needsedits Some edits have been requested before the pull request can be accepted label Oct 21, 2017
@MishimaHaruna MishimaHaruna removed the status:inprogress Issue is being worked on / the pull request is still a WIP label Oct 21, 2017
@MishimaHaruna
Copy link
Member

Thank you, I'm merging it now

@MishimaHaruna MishimaHaruna merged commit 58fdbea into HerculesWS:master Oct 21, 2017
@Emistry Emistry deleted the mapflag_noautoloot branch October 21, 2017 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:enhancement Issue describes an enhancement or feature that should be implemented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants