Skip to content

Conversation

@dastgirp
Copy link
Member

@dastgirp dastgirp commented Dec 18, 2017

Pull Request Prelude

Changes Proposed

Moved delitem before getitem.
So even if somebody manages to do some kind of manipulation to items, delitem would stop the script execution

Affected Branches:

  • master
    Issues addressed:

Known Issues and TODO List

@HerculesWSAPI
Copy link
Contributor

This change is Reviewable

@ghost ghost assigned dastgirp Dec 18, 2017
@ghost ghost added the status:inprogress Issue is being worked on / the pull request is still a WIP label Dec 18, 2017
@dastgirp dastgirp removed the status:inprogress Issue is being worked on / the pull request is still a WIP label Dec 18, 2017
@dastgirp dastgirp removed their assignment Dec 18, 2017
@Asheraf
Copy link
Contributor

Asheraf commented Dec 20, 2017

I believe adding a if (countitem() < x) close(); would be better, making the delitem() stop script execution would not show close button to the user which is not very nice.

@Asheraf Asheraf changed the base branch from stable to master December 20, 2017 18:02
@dastgirp
Copy link
Member Author

dastgirp commented Dec 20, 2017

  1. we should always prefer delitem before getitem
  2. countitem checks are there, script will stop execution if the player tries to cheat the npc through some ways.

Anyways, open to suggestions, if everyone's ok with countitem, then I would do like that

@Asheraf
Copy link
Contributor

Asheraf commented Dec 21, 2017

@dastgir i agree about delitem() being first however the issue in this script is not that, the problem is there is a pause between the check for item and the delete of item (multiple next() in this example) so the proper fix for such an issue is to either make a double item check if you want to keep the script on the official structure or move the check to exactly before the item delete, stopping the script execution would require the player to restart his client which is not a good thing assuming that someone may unintentionally lose the items before delete as this is now exploitable via rodex but would be the same issue with any future official/custom system that allows moving inventory items.

@4144
Copy link
Contributor

4144 commented Dec 21, 2017

Yes main issue is in script. First should be item deleted and and without pauses after it should be given new items. If need second check can be added.

@Asheraf Asheraf added codereview:needsedits Some edits have been requested before the pull request can be accepted type:bug Issue is a bug or describes an incorrect behavior that should be fixed component:scripts Affecting the scripts and NPCs labels Jan 28, 2018
@MishimaHaruna MishimaHaruna added this to the Release v2018.04.08 milestone Mar 12, 2018
@MishimaHaruna MishimaHaruna modified the milestones: Release v2018.04.08, future release Apr 7, 2018
	* delitem should be called before getitem.
Fixes HerculesWS#1934
@dastgirp
Copy link
Member Author

dastgirp commented Oct 2, 2019

@Asheraf please check

@dastgirp dastgirp modified the milestones: future release, Release v2019.10.20 Oct 2, 2019
@MishimaHaruna MishimaHaruna merged commit 3b8f08e into HerculesWS:master Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codereview:needsedits Some edits have been requested before the pull request can be accepted component:scripts Affecting the scripts and NPCs type:bug Issue is a bug or describes an incorrect behavior that should be fixed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants