Bläddra i källkod

- Small fix in pet_attack that would make pets not unlock their target in some situations.
- Fixed invisible shops. callshop scrip command now works!
- Added proper documentation of script command callshop


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5195 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 år sedan
förälder
incheckning
1b71a1a4da
4 ändrade filer med 28 tillägg och 4 borttagningar
  1. 1 0
      Changelog-Trunk.txt
  2. 23 0
      doc/script_commands.txt
  3. 1 1
      src/map/npc.c
  4. 3 3
      src/map/pet.c

+ 1 - 0
Changelog-Trunk.txt

@@ -5,6 +5,7 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.  EV
 GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
 
 2006/02/05
+	* Fixed and documented script command "callshop". [Skotlex]
 	* Updated sq;-files/mob_db.sql with current mob_db. [Skotlex]
 	* Updated sql-files/item_db.sql with current item_db. [Skotlex]
 2006/02/04

+ 23 - 0
doc/script_commands.txt

@@ -3384,6 +3384,29 @@ You can see the full list of available effect types you can possibly inflict in
 
 It is pretty certain that addressing the target by an ID number will not 
 currently work due to a bug.
+
---------------------------------------
+
+*callshop "<shop name>",<flag>;
+
+This command forces an npc shop to be invoked as if the player clicked on it.
+With normal shops it will not work unless the player is within clicking range,
+but the real use of this script command is together with "invisible shops",
+which are specified in the same way an invisible npc would be specified.
+For example, a generic invisible tool shop could be:
+
+-	shop	INVISIBLE_SHOP	-,611:-1,1750:-1,501:-1,502:-1,503:-1,504:-1,506:-1
+
+Which players cannot click on, but can be invoked using:
+
+callshop "INVISIBLE_SHOP", 0;
+
+The flag values are: 1 invokes the buying window, 2 invokes the selling
+window, any other value invokes the buy/sell dialogue.
+
+The function returns 1 on success, and the script is not automatically
+closed, so be careful to not do any item trading on the same script to prevent
+possible exploits (if possible, use close or close2 before invoking the shop
+itself).
 
 ---------------------------------------
 

+ 1 - 1
src/map/npc.c

@@ -1764,7 +1764,7 @@ static int npc_parse_shop (char *w1, char *w2, char *w3, char *w4)
 	nd->flag = 0;
 	memcpy(nd->name, w3, NAME_LENGTH-1);
 	nd->name[NAME_LENGTH-1] = '\0';
-	nd->class_ = m==-1?0:atoi(w4);
+	nd->class_ = m==-1?-1:atoi(w4);
 	nd->speed = 200;
 	
 	nd = (struct npc_data *)aRealloc(nd,

+ 3 - 3
src/map/pet.c

@@ -176,9 +176,6 @@ static int pet_attack(struct pet_data *pd,unsigned int tick,int data)
 
 	target= map_id2bl(pd->target_id);
 
-	if(!status_check_skilluse(&pd->bl, target, 0, 0))
-		return 0;
-	
 	if(target == NULL || pd->bl.m != target->m || target->prev == NULL ||
 		!check_distance_bl(&pd->bl, target, pd->db->range3))
 	{
@@ -186,6 +183,9 @@ static int pet_attack(struct pet_data *pd,unsigned int tick,int data)
 		return 0;
 	}
 
+	if(!status_check_skilluse(&pd->bl, target, 0, 0))
+		return 0;
+
 	range = pd->db->range;
 	if (battle_iswalking(&pd->bl)) range++;
 	if (battle_iswalking(target)) range++;