diff options
author | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-19 04:36:53 +0000 |
---|---|---|
committer | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-19 04:36:53 +0000 |
commit | 28134ba1f33aea49a797f8e3be4aeaae80944231 (patch) | |
tree | 251fb85a5173d74476266ad0540b5d1a2d89c231 /src/map/script.c | |
parent | 06985798ef8ed35f2ef1d6e52d292ba6b3add99a (diff) | |
download | hercules-28134ba1f33aea49a797f8e3be4aeaae80944231.tar.gz hercules-28134ba1f33aea49a797f8e3be4aeaae80944231.tar.bz2 hercules-28134ba1f33aea49a797f8e3be4aeaae80944231.tar.xz hercules-28134ba1f33aea49a797f8e3be4aeaae80944231.zip |
* Recoded getmobdata script function. Fixed mob_damage typo sd -> mvp_sd. Cleanep up confusing indentation in clif.c.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5661 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 102 |
1 files changed, 83 insertions, 19 deletions
diff --git a/src/map/script.c b/src/map/script.c index b7322164c..2e218a29c 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -10138,31 +10138,95 @@ int buildin_getmobdata(struct script_state *st) { }
int buildin_setmobdata(struct script_state *st){
- int num, id, i = 0;
+ int num, id, value;
char *name;
struct script_data dat;
struct mob_data *md = NULL;
id = conv_num(st, & (st->stack->stack_data[st->start+2]));
+ value = conv_num(st, & (st->stack->stack_data[st->start+3]));
if(!(md = (struct mob_data *)map_id2bl(id)) || st->stack->stack_data[st->start+3].type!=C_NAME ){
- ShowWarning("buildin_setmobdata: Error in argiment!\n");
+ ShowWarning("buildin_setmobdata: Error in argument!\n");
} else {
-#define INCREMENT dat.type=C_NAME; dat.u.num=add_str((unsigned char *) name)+(i<<24); get_val(st,&dat); i++
-#define VALUE(x) x = (dat.u.num == -1)? x : dat.u.num
- num=st->stack->stack_data[st->start+2].u.num;
- name=(char *)(str_buf+str_data[num&0x00ffffff].str);
- INCREMENT; VALUE(md->class_); INCREMENT; VALUE(md->level);
- INCREMENT; VALUE(md->hp); INCREMENT; VALUE(md->max_hp);
- INCREMENT; VALUE(md->hp); INCREMENT; VALUE(md->master_id);
- INCREMENT; VALUE(md->bl.m); INCREMENT; VALUE(md->bl.x);
- INCREMENT; VALUE(md->bl.y); INCREMENT; VALUE(md->speed);
- INCREMENT; VALUE(md->mode); INCREMENT; VALUE(md->state.state);
- INCREMENT; VALUE(md->special_state.ai); INCREMENT; VALUE(md->db->option);
- INCREMENT; VALUE(md->db->sex); INCREMENT; VALUE(md->db->view_class);
- INCREMENT; VALUE(md->db->hair); INCREMENT; VALUE(md->db->hair_color);
- INCREMENT; VALUE(md->db->head_buttom); INCREMENT; VALUE(md->db->head_mid);
- INCREMENT; VALUE(md->db->head_top); INCREMENT; VALUE(md->db->clothes_color);
- INCREMENT; VALUE(md->db->equip); INCREMENT; VALUE(md->db->weapon);
- INCREMENT; VALUE(md->dir);
+ switch(id){
+ case 0:
+ md->class_ = (short)value;
+ break;
+ case 1:
+ md->level = (unsigned short)value;
+ break;
+ case 2:
+ md->hp = value;
+ break;
+ case 3:
+ md->max_hp = value;
+ break;
+ case 4:
+ md->master_id = value;
+ break;
+ case 5:
+ md->bl.m = (short)value;
+ break;
+ case 6:
+ md->bl.x = (short)value;
+ break;
+ case 7:
+ md->bl.y = (short)value;
+ break;
+ case 8:
+ md->speed = (short)value;
+ break;
+ case 9:
+ md->mode = (short)value;
+ break;
+ case 10:
+ md->state.state = (unsigned int)value;
+ break;
+ case 11:
+ md->special_state.ai = (unsigned int)value;
+ break;
+ case 12:
+ md->db->option = (short)value;
+ break;
+ case 13:
+ md->db->sex = value;
+ break;
+ case 14:
+ md->db->view_class = value;
+ break;
+ case 15:
+ md->db->hair = (short)value;
+ break;
+ case 16:
+ md->db->hair_color = (short)value;
+ break;
+ case 17:
+ md->db->head_buttom = (short)value;
+ break;
+ case 18:
+ md->db->head_mid = (short)value;
+ break;
+ case 19:
+ md->db->head_top = (short)value;
+ break;
+ case 20:
+ md->db->clothes_color = (short)value;
+ break;
+ case 21:
+ md->db->equip = value;
+ break;
+ case 22:
+ md->db->weapon = (short)value;
+ break;
+ case 23:
+ md->db->shield = (short)value;
+ break;
+ case 24:
+ md->dir = (short)value;
+ break;
+ default:
+ ShowError("buildin_setmobdata: argument id is not identified.");
+ break;
+ }
}
return 0;
}
|