Bladeren bron

Merge pull request #832 from CairoLee/master

Fixes #652 and #818
* Resolves players being able to talk to NPCs when a shop is open.
Thanks to @CairoLee, @anacondaqq, and @admkakaroto.
Aleos 9 jaren geleden
bovenliggende
commit
01ba54c77c
2 gewijzigde bestanden met toevoegingen van 6 en 7 verwijderingen
  1. 0 5
      src/map/npc.c
  2. 6 2
      src/map/script.c

+ 0 - 5
src/map/npc.c

@@ -1341,9 +1341,6 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type)
 	}
 	if (nd->sc.option & OPTION_INVISIBLE) // can't buy if npc is not visible (hack?)
 		return 1;
-	if( nd->class_ < 0 && !sd->state.callshop ) {// not called through a script and is not a visible NPC so an invalid call
-		return 1;
-	}
 
 	if (nd->subtype == NPCTYPE_ITEMSHOP) {
 		char output[CHAT_SIZE_MAX];
@@ -1360,8 +1357,6 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type)
 		clif_broadcast(&sd->bl,output,strlen(output) + 1,BC_BLUE,SELF);
 	}
 
-	// reset the callshop state for future calls
-	sd->state.callshop = 0;
 	sd->npc_shopid = id;
 
 	if (type == 0) {

+ 6 - 2
src/map/script.c

@@ -9086,8 +9086,12 @@ BUILDIN_FUNC(end)
 	if( st->mes_active )
 		st->mes_active = 0;
 
-	if (sd)
-		clif_scriptclose(sd, st->oid); // If a menu/select/prompt is active, close it.
+	if (sd){
+		if (sd->state.callshop == 0)
+			clif_scriptclose(sd, st->oid); // If a menu/select/prompt is active, close it.
+		else 
+			sd->state.callshop = 0;
+	}
 
 	return SCRIPT_CMD_SUCCESS;
 }