Ver Fonte

* Implemented @breakguild (tid:75159) and @hommutate (tid:74651).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17038 54d463be-8e91-2dee-dedb-b68131a5f0ec
momacabu há 12 anos atrás
pai
commit
0b758eca8b
4 ficheiros alterados com 63 adições e 3 exclusões
  1. 1 0
      conf/groups.conf
  2. 60 0
      src/map/atcommand.c
  3. 1 1
      src/map/guild.c
  4. 1 2
      src/map/script.c

+ 1 - 0
conf/groups.conf

@@ -129,6 +129,7 @@ groups: (
 		autotrade: true
 		request: true
 		go: true
+		breakguild: true
 	}
 	permissions: {
 	}

+ 60 - 0
src/map/atcommand.c

@@ -3308,6 +3308,37 @@ ACMD_FUNC(guild)
 	return 0;
 }
 
+ACMD_FUNC(breakguild)
+{
+	int ret = 0;
+	struct guild *g;
+	nullpo_retr(-1, sd);
+
+	if (sd->status.guild_id) { // Check if the player has a guild
+		g = guild_search(sd->status.guild_id); // Search the guild
+		if (g) { // Check if guild was found
+			if (sd->state.gmaster_flag) { // Check if player is guild master
+				ret = guild_break(sd, g->name); // Break guild
+				if (ret) { // Check if anything went wrong
+					return 0; // Guild was broken
+				} else {
+					return -1; // Something went wrong
+				}
+			} else { // Not guild master
+				clif_displaymessage(fd, msg_txt(1181)); // You need to be a Guild Master to use this command.
+				return -1;
+			}
+		} else { // Guild was not found. HOW?
+			clif_displaymessage(fd, msg_txt(252)); // You are not in a guild.
+			return -1;
+		}
+	} else { // Player does not have a guild
+		clif_displaymessage(fd, msg_txt(252)); // You are not in a guild.
+		return -1;
+	}
+	return 0;
+}
+
 /*==========================================
  *
  *------------------------------------------*/
@@ -6879,6 +6910,33 @@ ACMD_FUNC(homevolution)
 	return 0;
 }
 
+ACMD_FUNC(hommutate)
+{
+	int homun_id, m_class = 0, m_id;
+	nullpo_retr(-1, sd);
+
+	if (!merc_is_hom_active(sd->hd)) {
+		clif_displaymessage(fd, msg_txt(1254)); // You do not have a homunculus.
+		return -1;
+	}
+
+	if (!message || !*message) {
+		homun_id = 6048 + (rnd() % 4);
+	} else {
+		homun_id = atoi(message);
+	}
+
+	m_class = hom_class2mapid(sd->hd->homunculus.class_);
+	m_id	= hom_class2mapid(homun_id);
+
+	if (m_class != -1 && m_id != -1 && m_class&HOM_EVO && m_id&HOM_S && sd->hd->homunculus.level >= 99) {
+		hom_mutate(sd->hd, homun_id);
+	} else {
+		clif_emotion(&sd->hd->bl, E_SWT);
+	}
+	return 0;
+}
+
 /*==========================================
  * call choosen homunculus [orn]
  *------------------------------------------*/
@@ -8844,6 +8902,7 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(spiritball),
 		ACMD_DEF(party),
 		ACMD_DEF(guild),
+		ACMD_DEF(breakguild),
 		ACMD_DEF(agitstart),
 		ACMD_DEF(agitend),
 		ACMD_DEF(mapexit),
@@ -8974,6 +9033,7 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(request),
 		ACMD_DEF(homlevel),
 		ACMD_DEF(homevolution),
+		ACMD_DEF(hommutate),
 		ACMD_DEF(makehomun),
 		ACMD_DEF(homfriendly),
 		ACMD_DEF(homhungry),

+ 1 - 1
src/map/guild.c

@@ -1798,7 +1798,7 @@ int guild_break(struct map_session_data *sd,char *name)
 	}
 
 	intif_guild_break(g->guild_id);
-	return 0;
+	return 1;
 }
 
 /**

+ 1 - 2
src/map/script.c

@@ -10117,7 +10117,6 @@ BUILDIN_FUNC(homunculus_evolution)
 BUILDIN_FUNC(homunculus_mutate)
 {
 	int homun_id, m_class, m_id;
-	int homun_array[5] = {6048,6049,6050,6051,6052};
 	TBL_PC *sd;
 
 	sd = script_rid2sd(st);
@@ -10127,7 +10126,7 @@ BUILDIN_FUNC(homunculus_mutate)
 	if(script_hasdata(st,2))
 		homun_id = script_getnum(st,2);
 	else
-		homun_id = homun_array[rnd() % 5];
+		homun_id = 6048 + (rnd() % 4);
 
 	if(merc_is_hom_active(sd->hd)) {
 		m_class = hom_class2mapid(sd->hd->homunculus.class_);