瀏覽代碼

* Applied suggestion in tid:76276. Added script commands sit and stand.
- Added a new parameter to readparam, Sitting.

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

aleos 12 年之前
父節點
當前提交
7bbd35a052
共有 5 個文件被更改,包括 43 次插入0 次删除
  1. 1 0
      db/const.txt
  2. 8 0
      doc/script_commands.txt
  3. 1 0
      src/map/map.h
  4. 1 0
      src/map/pc.c
  5. 32 0
      src/map/script.c

+ 1 - 0
db/const.txt

@@ -414,6 +414,7 @@ BaseJob	119	1
 BaseClass	120	1
 killerrid	121 1
 killedrid	122 1
+Sitting	123	1
 
 bMaxHP	6
 bMaxSP	8

+ 8 - 0
doc/script_commands.txt

@@ -5087,6 +5087,14 @@ everything not equippable by the new job class anyway.
 
 ---------------------------------------
 
+*sit {"<character name>"};
+*stand {"<character name>"};
+
+These commands will make a character sit if standing and stanf if sitting.
+If no character is specified, the command will run for the invoking character.
+
+---------------------------------------
+
 *disguise <Monster ID>;
 *undisguise;
 

+ 1 - 0
src/map/map.h

@@ -367,6 +367,7 @@ enum _sp {
 	SP_BASECLASS=120,	//Hmm.. why 100+19? I just use the next one... [Skotlex]
 	SP_KILLERRID=121,
 	SP_KILLEDRID=122,
+	SP_SITTING=123,
 
 	// Mercenaries
 	SP_MERCFLEE=165, SP_MERCKILLS=189, SP_MERCFAITH=190,

+ 1 - 0
src/map/pc.c

@@ -6910,6 +6910,7 @@ int pc_readparam(struct map_session_data* sd,int type)
 		case SP_FAME:            val = sd->status.fame; break;
 		case SP_KILLERRID:       val = sd->killerrid; break;
 		case SP_KILLEDRID:       val = sd->killedrid; break;
+		case SP_SITTING:         val = pc_issit(sd)?1:0; break;
 		case SP_CRITICAL:        val = sd->battle_status.cri/10; break;
 		case SP_ASPD:            val = (2000-sd->battle_status.amotion)/10; break;
 		case SP_BASE_ATK:	     val = sd->battle_status.batk; break;

+ 32 - 0
src/map/script.c

@@ -17398,6 +17398,36 @@ BUILDIN_FUNC(consumeitem)
 	return 0;
 }
 
+/* Make a player sit/stand.
+ * sit {"<character name>"};
+ * stand {"<character name>"};
+ * Note: Use readparam(Sitting) which returns 1 or 0 (sitting or standing). */
+BUILDIN_FUNC(sit)
+{
+	TBL_PC *sd;
+
+	if( script_hasdata(st, 2) )
+		sd = map_nick2sd(script_getstr(st, 2));
+	else
+		sd = script_rid2sd(st);
+
+	if( sd == NULL)
+		return 0;
+
+	if( pc_issit(sd) ) {
+		pc_setstand(sd);
+		skill_sit(sd, 0);
+		clif_standing(&sd->bl);
+	} else {
+		unit_stop_walking(&sd->bl, 1|4);
+		pc_setsit(sd);
+		skill_sit(sd, 1);
+		clif_sitting(&sd->bl);
+	}
+
+	return 0;
+}
+
 // declarations that were supposed to be exported from npc_chat.c
 #ifdef PCRE_SUPPORT
 BUILDIN_FUNC(defpattern);
@@ -17844,6 +17874,8 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(npcskill,"viii"),
 	BUILDIN_DEF(consumeitem,"v"),
 	BUILDIN_DEF(delequip,"i"),
+	BUILDIN_DEF(sit,"?"),
+	BUILDIN_DEF2(sit,"stand","?"),
 	/**
 	 * @commands (script based)
 	 **/