Browse Source

- Simplified the global function "getJobName"
- Simplified function agitcheck so it isn't crash prone. Now it takes no arguments, and will return whether WoE is on or not.
- Updated bundled scripts as required for this change.


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

skotlex 18 years ago
parent
commit
fa1c4b2e47

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 
 2006/12/22
 2006/12/22
+	* Simplified function agitcheck so it isn't crash prone. Now it takes no
+	  arguments, and will return whether WoE is on or not.
 	* Now when you specify a max level beyond what the exp table has, the last
 	* Now when you specify a max level beyond what the exp table has, the last
 	  entry of the exp table will be duplicated to fill in the remaining levels.
 	  entry of the exp table will be duplicated to fill in the remaining levels.
 	  [Skotlex]
 	  [Skotlex]

+ 4 - 0
npc/Changelog.txt

@@ -33,6 +33,10 @@ KarLaeda
 
 
 Date		Added
 Date		Added
 ======
 ======
+
+2006/12/22
+	* Corrected scripts to use the new format of agitcheck
+	* Simplified the global function "getJobName" [Skotlex]
 2006/12/19
 2006/12/19
 	* Now root functions calls can have parenthesis (will take any parenthesis
 	* Now root functions calls can have parenthesis (will take any parenthesis
 	  after the function as the start of the argument list).
 	  after the function as the start of the argument list).

+ 3 - 3
npc/custom/WoE_Setter.txt

@@ -120,7 +120,7 @@ L_Reset:
 	mes "Are you sure?";
 	mes "Are you sure?";
 	next;
 	next;
 	menu "No, what was I thinking",L_No,"Yes I really want to do it",-;
 	menu "No, what was I thinking",L_No,"Yes I really want to do it",-;
-	if(agitcheck(0)==1) goto L_WoEOn;
+	if(agitcheck()) goto L_WoEOn;
 	deletearray $sday[0],200;
 	deletearray $sday[0],200;
 	deletearray $eday[0],200;
 	deletearray $eday[0],200;
 	deletearray $woetime[0],200;
 	deletearray $woetime[0],200;
@@ -173,14 +173,14 @@ L_StartLoop:
 
 
 // Stop WoE
 // Stop WoE
 L_End:
 L_End:
-	if(agitcheck(0)==0) end;
+	if(!agitcheck()) end;
 	Announce "The War Of Emperium is over!",8;
 	Announce "The War Of Emperium is over!",8;
 	AgitEnd;
 	AgitEnd;
 	end;
 	end;
 
 
 // Start WoE
 // Start WoE
 L_Start:
 L_Start:
-	if(agitcheck(0)==1) end;
+	if(agitcheck()) end;
 	Announce "The War Of Emperium has begun!",8;
 	Announce "The War Of Emperium has begun!",8;
 	AgitStart;
 	AgitStart;
 	end;
 	end;

+ 1 - 1
npc/custom/eAAC_Scripts/kafraExpress/ke_warp_woe.txt

@@ -25,7 +25,7 @@ function	script	F_keWarpWOE	{
 		callfunc "F_keIntro", e_srt, "Sorry, these warps are only available to people who belong to a Guild.";
 		callfunc "F_keIntro", e_srt, "Sorry, these warps are only available to people who belong to a Guild.";
 		return;
 		return;
 	}
 	}
-	if ($@kewg_checkAgit && agitcheck(0) == 0) {
+	if ($@kewg_checkAgit && !agitcheck()) {
 		callfunc "F_keIntro", e_srt, "Sorry, these warps are only enabled during the Guild Wars.";
 		callfunc "F_keIntro", e_srt, "Sorry, these warps are only enabled during the Guild Wars.";
 		return;
 		return;
 	}
 	}

+ 1 - 1
npc/guild/gldfunc_manager.txt

@@ -231,7 +231,7 @@ function	script	F_GldManager	{
 		//set @SGuardian,strmobinfo(4,1287) + (@Defence*2000);
 		//set @SGuardian,strmobinfo(4,1287) + (@Defence*2000);
 
 
 		//uncomment the following line to disable guardians Installation during WoE
 		//uncomment the following line to disable guardians Installation during WoE
-		//if(agitcheck(0) != 0) goto L_CantGuard;
+		//if(agitcheck()) goto L_CantGuard;
 		mes "Would you like to install a guardian? Guardians will protect the guild base from enemies.";
 		mes "Would you like to install a guardian? Guardians will protect the guild base from enemies.";
 		mes "Please choose a guardian.";
 		mes "Please choose a guardian.";
 		next;
 		next;

+ 2 - 162
npc/other/Global_Functions.txt

@@ -282,167 +282,7 @@ function	script	F_ItemName	{
 //////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////
 
 
 function	script	getJobName	{
 function	script	getJobName	{
-	switch(getarg(0)){
-		case Job_Novice:
-			return "Novice";
-		case Job_Swordman:
-			return "Swordman";
-		case Job_Mage:
-			return "Magician";
-		case Job_Archer:
-			return "Archer";
-		case Job_Acolyte:
-			return "Acolyte";
-		case Job_Merchant:
-			return "Merchant";
-		case Job_Thief:
-			return "Thief";
-		case Job_Knight:
-		case Job_Knight2:
-			return "Knight";
-		case Job_Priest:
-			return "Priest";
-		case Job_Wizard:
-			return "Wizard";
-		case Job_Blacksmith:
-			return "Blacksmith";
-		case Job_Hunter:
-			return "Hunter";
-		case Job_Assassin:
-			return "Assassin";
-		case Job_Crusader:
-		case Job_Crusader2:
-			return "Crusader";
-		case Job_Monk:
-			return "Monk";
-		case Job_Sage:
-			return "Sage";
-		case Job_Rogue:
-			return "Rogue";
-		case Job_Alchem:
-			return "Alchemist";
-		case Job_Bard:
-			return "Bard";
-		case Job_Dancer:
-			return "Dancer";
-		case Job_SuperNovice:
-			return "Super Novice";
-		case Job_Gunslinger:
-			return "Gunsligner";
-		case Job_Ninja:
-			return "Ninja";
-		case Job_Xmas:
-			return "Xmas";
-		case Job_Novice_High:
-			return "Novice High";
-		case Job_Swordman_High:
-			return "Swordman High";
-		case Job_Mage_High:
-			return "Magician High";
-		case Job_Archer_High:
-			return "Archer High";
-		case Job_Acolyte_High:
-			return "Acolyte High";
-		case Job_Merchant_High:
-			return "Merchant High";
-		case Job_Thief_High:
-			return "Thief High";
-		case Job_Lord_Knight:
-		case Job_Lord_Knight2:
-			return "Lord Knight";
-		case Job_High_Priest:
-			return "High Priest";
-		case Job_High_Wizard:
-			return "High Wizard";
-		case Job_Whitesmith:
-			return "Whitesmith";
-		case Job_Sniper:
-			return "Sniper";
-		case Job_Assassin_Cross:
-			return "Assassin Cross";
-		case Job_Paladin:
-		case Job_Paladin2:
-			return "Paladin";
-		case Job_Champion:
-			return "Champion";
-		case Job_Professor:
-			return "Professor";
-		case Job_Stalker:
-			return "Stalker";
-		case Job_Creator:
-			return "Creator";
-		case Job_Clown:
-			return "Clown";
-		case Job_Gypsy:
-			return "Gypsy";
-		case Job_Baby:
-			return "Baby";
-		case Job_Baby_Swordman:
-			return "Baby Swordman";
-		case Job_Baby_Mage:
-			return "Baby Magician";
-		case Job_Baby_Archer:
-			return "Baby Archer";
-		case Job_Baby_Acolyte:
-			return "Baby Acolyte";
-		case Job_Baby_Merchant:
-			return "Baby Merchant";
-		case Job_Baby_Thief:
-			return "Baby Thief";
-		case Job_Baby_Knight:
-		case Job_Baby_Knight2:
-			return "Baby Knight";
-		case Job_Baby_Priest:
-			return "Baby Priest";
-		case Job_Baby_Wizard:
-			return "Baby Wizard";
-		case Job_Baby_Blacksmith:
-			return "Baby Blacksmith";
-		case Job_Baby_Hunter:
-			return "Baby Hunter";
-		case Job_Baby_Assassin:
-			return "Baby Assassin";
-		case Job_Baby_Crusader:
-		case Job_Baby_Crusader2:
-			return "Baby Crusader";
-		case Job_Baby_Monk:
-			return "Baby Monk";
-		case Job_Baby_Sage:
-			return "Baby Sage";
-		case Job_Baby_Rogue:
-			return "Baby Rogue";
-		case Job_Baby_Alchem:
-			return "Baby Alchemist";
-		case Job_Baby_Bard:
-			return "Baby Bard";
-		case Job_Baby_Dancer:
-			return "Baby Dancer";
-		case Job_Super_Baby:
-			return "Super Baby";
-		case Job_Taekwon:
-			if(Sex == 0)
-				return "Taekwon Girl";
-			else
-				return "Taekwon Boy";
-		case Job_Star_Gladiator:
-		case Job_Star_Gladiator2:
-			return "Star Gladiator";
-		case Job_Soul_Linker:
-			return "Soul Linker";
-		case Job_Ninja:
-			return "Ninja";
-		case Job_Gunslinger:
-			return "Gunslinger";
-		case Job_Xmas:
-			return "Christmas";
-		case Option_Wedding:
-			if(Sex == 0)
-				return "Bride";
-			else
-				return "Bridegroom";
-		default:
-			return "omghaxor";
-	}
+	return jobname(getarg(0));
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////
@@ -483,4 +323,4 @@ function	script	F_Load2Skills	{
 	}
 	}
 	set ADV_QSK2,0; //Clear var
 	set ADV_QSK2,0; //Clear var
 	return;
 	return;
-}
+}

+ 1 - 3
src/map/guild.c

@@ -1898,8 +1898,7 @@ int guild_agit_break(struct mob_data *md)
 {	// Run One NPC_Event[OnAgitBreak]
 {	// Run One NPC_Event[OnAgitBreak]
 	char *evname;
 	char *evname;
 
 
-	nullpo_retr(0, md);
-
+	if(!agit_flag) return 0;	// Agit already End
 	evname=(char *)aMallocA((strlen(md->npc_event) + 1)*sizeof(char));
 	evname=(char *)aMallocA((strlen(md->npc_event) + 1)*sizeof(char));
 
 
 	strcpy(evname,md->npc_event);
 	strcpy(evname,md->npc_event);
@@ -1908,7 +1907,6 @@ int guild_agit_break(struct mob_data *md)
 // But Script will be stop, so nothing...
 // But Script will be stop, so nothing...
 // Maybe will be changed in the futher..
 // Maybe will be changed in the futher..
 //      int c = npc_event_do(evname);
 //      int c = npc_event_do(evname);
-	if(!agit_flag) return 0;	// Agit already End
 	add_timer(gettick()+battle_config.gvg_eliminate_time,guild_gvg_eliminate_timer,md->bl.m,(int)evname);
 	add_timer(gettick()+battle_config.gvg_eliminate_time,guild_gvg_eliminate_timer,md->bl.m,(int)evname);
 	return 0;
 	return 0;
 }
 }

+ 4 - 17
src/map/script.c

@@ -3806,7 +3806,7 @@ struct script_function buildin_func[] = {
 	{buildin_maprespawnguildid,"maprespawnguildid","sii"},
 	{buildin_maprespawnguildid,"maprespawnguildid","sii"},
 	{buildin_agitstart,"agitstart",""},	// <Agit>
 	{buildin_agitstart,"agitstart",""},	// <Agit>
 	{buildin_agitend,"agitend",""},
 	{buildin_agitend,"agitend",""},
-	{buildin_agitcheck,"agitcheck","i"},   // <Agitcheck>
+	{buildin_agitcheck,"agitcheck",""},   // <Agitcheck>
 	{buildin_flagemblem,"flagemblem","i"},	// Flag Emblem
 	{buildin_flagemblem,"flagemblem","i"},	// Flag Emblem
 	{buildin_getcastlename,"getcastlename","s"},
 	{buildin_getcastlename,"getcastlename","s"},
 	{buildin_getcastledata,"getcastledata","si*"},
 	{buildin_getcastledata,"getcastledata","si*"},
@@ -8790,28 +8790,15 @@ int buildin_agitend(struct script_state *st)
 	return 0;
 	return 0;
 }
 }
 /*==========================================
 /*==========================================
- * agitcheck 1;    // choice script
- * if(@agit_flag == 1) goto agit;
- * if(agitcheck(0) == 1) goto agit;
+ * Returns whether woe is on or off.	// choice script
  *------------------------------------------
  *------------------------------------------
  */
  */
 int buildin_agitcheck(struct script_state *st)
 int buildin_agitcheck(struct script_state *st)
 {
 {
-	struct map_session_data *sd;
-	int cond;
-
-	cond=conv_num(st,& (st->stack->stack_data[st->start+2]));
-
-	if(cond == 0) {
-		if (agit_flag==1) push_val(st->stack,C_INT,1);
-		if (agit_flag==0) push_val(st->stack,C_INT,0);
-	} else {
-		sd=script_rid2sd(st);
-		if (agit_flag==1) pc_setreg(sd,add_str("@agit_flag"),1);
-		if (agit_flag==0) pc_setreg(sd,add_str("@agit_flag"),0);
-	}
+	push_val(st->stack,C_INT,agit_flag);
 	return 0;
 	return 0;
 }
 }
+
 int buildin_flagemblem(struct script_state *st)
 int buildin_flagemblem(struct script_state *st)
 {
 {
 	int g_id=conv_num(st,& (st->stack->stack_data[st->start+2]));
 	int g_id=conv_num(st,& (st->stack->stack_data[st->start+2]));