瀏覽代碼

Migrated all look constants to source exports

Lemongrass3110 9 年之前
父節點
當前提交
33729eb961
共有 4 個文件被更改,包括 38 次插入24 次删除
  1. 0 10
      db/const.txt
  2. 14 14
      doc/script_commands.txt
  3. 1 0
      src/map/script.c
  4. 23 0
      src/map/script_constants.h

+ 0 - 10
db/const.txt

@@ -2381,16 +2381,6 @@ THANATOS_KEEP	10009
 4_F_ARUNA_POP2	10173
 4_JACK_HEAD	10174
 
-VAR_HEAD	1
-VAR_WEAPON	2
-VAR_HEAD_TOP	3
-VAR_HEAD_MID	4
-VAR_HEAD_BOTTOM	5
-VAR_HEADPALETTE	6
-VAR_BODYPALETTE	7
-VAR_SHIELD	8
-VAR_SHOES	9
-
 DIR_NORTH	0
 DIR_NORTHWEST	1
 DIR_WEST	2

+ 14 - 14
doc/script_commands.txt

@@ -4215,28 +4215,28 @@ type you want to change, then the palette you want to use. Make sure you specify
 a palette number that exists/is usable by the client you use.
 'changelook' works the same, but is only client side (it doesn't save the look value).
 
-    // This will change your hair(6), so that it uses palette 8, what ever your 
+    // This will change your hair color, so that it uses palette 8, what ever your 
     // palette 8 is, your hair will use that color
 
-    setlook 6,8;
+    setlook LOOK_HAIR_COLOR,8;
 
-    // This will change your clothes(7), so they are using palette 1, whatever 
+    // This will change your clothes color, so they are using palette 1, whatever 
     // your palette 1 is, your clothes will then use that set of colors.
     
-    setlook 7,1;
+    setlook LOOK_CLOTHES_COLOR,1;
 
 Here are the possible look types:
 
- 0 - Base sprite
- 1 - Hairstyle
- 2 - Weapon
- 3 - Head bottom
- 4 - Head top
- 5 - Head mid
- 6 - Hair color
- 7 - Clothes color
- 8 - Shield
- 9 - Shoes
+ LOOK_BASE - Base sprite
+ LOOK_HAIR - Hairstyle
+ LOOK_WEAPON - Weapon
+ LOOK_HEAD_BOTTOM - Head bottom
+ LOOK_HEAD_TOP - Head top
+ LOOK_HEAD_MID - Head mid
+ LOOK_HAIR_COLOR - Hair color
+ LOOK_CLOTHES_COLOR - Clothes color
+ LOOK_SHIELD - Shield
+ LOOK_SHOES - Shoes
 
 Whatever 'shoes' means is anyone's guess, ask Gravity - the client does nothing 
 with this value. It still wants it from the server though, so it is kept, but 

+ 1 - 0
src/map/script.c

@@ -14323,6 +14323,7 @@ BUILDIN_FUNC(getlook)
 	type=script_getnum(st,2);
 	val=-1;
 	switch(type) {
+		// TODO: implement LOOK_BASE as stated in script doc
 		case LOOK_HAIR:     	val=sd->status.hair; break; //1
 		case LOOK_WEAPON:   	val=sd->status.weapon; break; //2
 		case LOOK_HEAD_BOTTOM:	val=sd->status.head_bottom; break; //3

+ 23 - 0
src/map/script_constants.h

@@ -2606,6 +2606,29 @@
 	export_constant(FW_EXTRABOLD);
 	export_constant(FW_HEAVY);
 
+	/* look types */
+	export_constant(LOOK_BASE);
+	export_constant(LOOK_HAIR);
+	export_constant(LOOK_WEAPON);
+	export_constant(LOOK_HEAD_BOTTOM);
+	export_constant(LOOK_HEAD_TOP);
+	export_constant(LOOK_HEAD_MID);
+	export_constant(LOOK_HAIR_COLOR);
+	export_constant(LOOK_CLOTHES_COLOR);
+	export_constant(LOOK_SHIELD);
+	export_constant(LOOK_SHOES);
+
+	// For backwards compatability - might be removed in the near future
+	script_set_constant("VAR_HEAD",LOOK_HAIR,false);
+	script_set_constant("VAR_WEAPON",LOOK_WEAPON,false);
+	script_set_constant("VAR_HEAD_TOP",LOOK_HEAD_TOP,false); // This one was actually pointing to LOOK_HEAD_BOTTOM until now, so we might be safe to remove them anyway(since we got no bug report until today)
+	script_set_constant("VAR_HEAD_MID",LOOK_HEAD_MID,false); // This one was actually pointing to LOOK_HEAD_TOP until now, so we might be safe to remove them anyway(since we got no bug report until today)
+	script_set_constant("VAR_HEAD_BOTTOM",LOOK_HEAD_BOTTOM,false);  // This one was actually pointing to LOOK_HEAD_MID until now, so we might be safe to remove them anyway(since we got no bug report until today)
+	script_set_constant("VAR_HEADPALETTE",LOOK_HAIR_COLOR,false);
+	script_set_constant("VAR_BODYPALETTE",LOOK_CLOTHES_COLOR,false);
+	script_set_constant("VAR_SHIELD",LOOK_SHIELD,false);
+	script_set_constant("VAR_SHOES",LOOK_SHOES,false);
+
 	/* add skill types */
 	script_set_constant("SKILL_PERM",ADDSKILL_PERMANENT,false);
 	script_set_constant("SKILL_TEMP",ADDSKILL_TEMP,false);