Prechádzať zdrojové kódy

Add new script commands

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@880 54d463be-8e91-2dee-dedb-b68131a5f0ec
amber 20 rokov pred
rodič
commit
2b85267cda
2 zmenil súbory, kde vykonal 58 pridanie a 0 odobranie
  1. 2 0
      Changelog.txt
  2. 56 0
      src/map/script.c

+ 2 - 0
Changelog.txt

@@ -4,6 +4,8 @@ SVN: $Rev$
 
 Date	Added
 12/30
+        * Added ispartneron, getpartnerid, and warppartner script
+          commands to properly support jawaii NPC's (SVN 880) [MouseJstr]
         * Moved supernovice guardian angel messages to msg_athena.conf [celest]
 
 12/29

+ 56 - 0
src/map/script.c

@@ -250,6 +250,9 @@ int buildin_failedremovecards(struct script_state *st);
 int buildin_marriage(struct script_state *st);
 int buildin_wedding_effect(struct script_state *st);
 int buildin_divorce(struct script_state *st);
+int buildin_ispartneron(struct script_state *st);
+int buildin_getpartnerid(struct script_state *st);
+int buildin_warppartner(struct script_state *st);
 int buildin_getitemname(struct script_state *st);
 int buildin_makepet(struct script_state *st);
 int buildin_getexp(struct script_state *st);
@@ -467,6 +470,9 @@ struct {
 	{buildin_marriage,"marriage","s"},
 	{buildin_wedding_effect,"wedding",""},
 	{buildin_divorce,"divorce",""},
+	{buildin_ispartneron,"ispartneron",""},
+	{buildin_getpartnerid,"getpartnerid",""},
+	{buildin_warppartner,"warppartner","sii"},
 	{buildin_getitemname,"getitemname","i"},
 	{buildin_makepet,"makepet","i"},
 	{buildin_getexp,"getexp","ii"},
@@ -5450,6 +5456,56 @@ int buildin_divorce(struct script_state *st)
 	return 0;
 }
 
+int buildin_ispartneron(struct script_state *st)
+{
+	struct map_session_data *sd=script_rid2sd(st);
+	struct map_session_data *p_sd=NULL;
+
+	if(sd==NULL || !pc_ismarried(sd) ||
+            ((p_sd=map_nick2sd(map_charid2nick(sd->status.partner_id))) == NULL)) {
+		push_val(st->stack,C_INT,0);
+		return 0;
+	}
+
+	push_val(st->stack,C_INT,1);
+	return 0;
+}
+
+int buildin_getpartnerid(struct script_state *st)
+{
+    struct map_session_data *sd=script_rid2sd(st);
+    if (sd == NULL) {
+        push_val(st->stack,C_INT,0);
+        return 0;
+    }
+
+    push_val(st->stack,C_INT,sd->status.partner_id);
+    return 0;
+}
+
+int buildin_warppartner(struct script_state *st)
+{
+	int x,y;
+	char *str;
+	struct map_session_data *sd=script_rid2sd(st);
+	struct map_session_data *p_sd=NULL;
+
+	if(sd==NULL || !pc_ismarried(sd) ||
+            ((p_sd=map_nick2sd(map_charid2nick(sd->status.partner_id))) == NULL)) {
+		push_val(st->stack,C_INT,0);
+		return 0;
+	}
+
+        str=conv_str(st,& (st->stack->stack_data[st->start+2]));
+	x=conv_num(st,& (st->stack->stack_data[st->start+3]));
+	y=conv_num(st,& (st->stack->stack_data[st->start+4]));
+
+        pc_setpos(p_sd,str,x,y,0);
+
+	push_val(st->stack,C_INT,1);
+	return 0;
+}
+
 /*================================================
  * Script for Displaying MOB Information [Valaris]
  *------------------------------------------------