瀏覽代碼

- Fixed some missing max levels for npc skills
- Expanded isloggedin script command to support an optional argument (char id)
- Expanded warpparty command to accept target "Leader", this will warp the party to the leader.
- Added a summon structure to handle non-dead-branch mob-groups since the current implementation totally fails for mob groups that don't have MANY integrants
- Fixed mobs not attempting an IDLE skill right before unlocking a target.
- Removed a useless variable in the pet_data structure


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

skotlex 18 年之前
父節點
當前提交
9e9847a83e
共有 7 個文件被更改,包括 82 次插入16 次删除
  1. 9 0
      Changelog-Trunk.txt
  2. 2 0
      db/Changelog.txt
  3. 3 3
      db/skill_db.txt
  4. 12 3
      doc/script_commands.txt
  5. 0 1
      src/map/map.h
  6. 30 6
      src/map/mob.c
  7. 26 3
      src/map/script.c

+ 9 - 0
Changelog-Trunk.txt

@@ -3,6 +3,15 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2007/08/07
+	* Expanded isloggedin script command to support an optional argument (char id)
+	* Expanded warpparty command to accept target "Leader", this will warp the
+	  party to the leader.
+	* Added a summon structure to handle non-dead-branch mob-groups since the
+	  current implementation totally fails for mob groups that don't have MANY
+	  integrants.
+	* Fixed mobs not attempting an IDLE skill right before unlocking a target.
+	  [Skotlex]
 2007/08/06
 	* Slightly deobfuscated the max-hp calculation functionality
 	- fixed hp/sp calc code adding extra few points from item bonuses

+ 2 - 0
db/Changelog.txt

@@ -48,6 +48,8 @@
 	13107 Western_Outlaw		Need correct HIT and ASPD Rate
 	----
 ========================
+08/07
+	* Fixed some missing max levels for npc skills [Skotlex]
 08/06
 	* Added custom Hollow Poring mob_db2 entry
 	* Added Job_Baby_Alchemist define to complement the Job_Alchemist update

+ 3 - 3
db/skill_db.txt

@@ -376,7 +376,7 @@
 335,9,6,4,0,0x1,0,1,1,yes,0,0x4,0,none,0	//WE_FEMALE#I Look up to You#
 336,9,6,4,0,0x1,3,1,1,yes,0,0x4,1,none,0	//WE_CALLPARTNER#I miss You#
 337,9,6,1,-1,0,0,1,1,no,0,0x2,0,weapon,0	//ITM_TOMAHAWK#Throw Tomahawk#
-338,-1,8,1,7,0,0,0,-2,no,0,0x2,0,weapon,0	//NPC_DARKCROSS#Cross of Darkness#
+338,-1,8,1,7,0,0,10,-2,no,0,0x2,0,weapon,0	//NPC_DARKCROSS#Cross of Darkness#
 339,5,6,4,7,0x48,0,10,1,no,33,0x102,0,magic,0		//NPC_GRANDDARKNESS#Grand cross of Darkness#
 340,9,8,1,7,0,0,10,1:1:2:2:3:3:4:4:5:5,yes,0,0x2,0,magic,0	//NPC_DARKSTRIKE#Soul Strike of Darkness#
 341,9,8,1,7,0,0,10,3:4:5:6:7:8:9:10:11:12,yes,0,0x2,0,magic,2:3:3:4:4:5:5:6:6:7	//NPC_DARKTHUNDER#Darkness Jupiter#
@@ -389,9 +389,9 @@
 348,9,0,1,9,0x1,0,5,1,no,0,0x2,0,magic,0	//NPC_CHANGEUNDEAD
 349,0,6,4,0,0x1,0,10,0,no,0,0x2,0,weapon,0	//NPC_POWERUP
 350,0,6,4,0,0x1,0,10,0,no,0,0x2,0,none,0	//NPC_AGIUP
-351,0,0,0,0,0x1,0,0,0,no,0,0x2,0,none,0	//NPC_SIEGEMODE
+351,0,0,0,0,0x1,0,1,0,no,0,0x2,0,none,0	//NPC_SIEGEMODE
 352,2,0,4,0,0x1,0,1,0,no,0,0x2,0,none,0	//NPC_CALLSLAVE
-353,0,0,0,0,0x1,0,0,0,no,0,0x2,0,none,0	//NPC_INVISIBLE
+353,0,0,0,0,0x1,0,1,0,no,0,0x2,0,none,0	//NPC_INVISIBLE
 354,2,6,4,0,0x1,0,20,0,no,0,0x2,0,misc,0	//NPC_RUN
 355,0,6,4,0,0x1,0,5,1,no,0,0,0,weapon,0	//LK_AURABLADE#Aura Blade#
 356,0,6,4,0,0x1,0,10,1,no,0,0,0,weapon,0	//LK_PARRYING#Parrying#

+ 12 - 3
doc/script_commands.txt

@@ -2876,10 +2876,10 @@ account ID.
 
 -------------------------
 
-*isloggedin(<account id>)
+*isloggedin(<account id>{,<char id>});
 
 This function returns 1 if the specified account is logged in and 0 if they 
-aren't.
+aren't. You can also pass the char_id to check for both account and char id.
 
 ---------------------------------------
 
@@ -3235,7 +3235,16 @@ See also 'warp'.
  
 Warps a party to specified map and coordinate given the party ID, which you can get with
 getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>).
- 
+
+You can use the following "map names" for special warping behaviour:
+Random:       All party members are randomly warped in their current map (as if they
+              all used a fly wing)
+SavePointAll: All party members are warped to their respective save point.
+SavePoint:    All party members are warped to the save point of the currently
+              attached player (will fail if there's no player attached).
+Leader:       All party members are warped to the leader's position. The leader must
+              be online and in the current map-server for this to work.
+
 Example:
 mes "[Party Warper]";
 mes "Here you go!";

+ 0 - 1
src/map/map.h

@@ -981,7 +981,6 @@ struct pet_data {
 	struct pet_db *petDB;
 	int pet_hungry_timer;
 	int target_id;
-	short n;
 	struct {
 		unsigned skillbonus : 1;
 	} state;

+ 30 - 6
src/map/mob.c

@@ -56,6 +56,12 @@ struct mob_db *mob_db(int index) { if (index < 0 || index > MAX_MOB_DB || mob_db
 
 static struct eri *item_drop_ers; //For loot drops delay structures.
 static struct eri *item_drop_list_ers;
+
+static struct {
+	int qty;
+	int class_[150];
+} summon[MAX_RANDOMMONSTER];
+
 #define CLASSCHANGE_BOSS_NUM 21
 
 /*==========================================
@@ -249,7 +255,10 @@ int mob_get_random_id(int type, int flag, int lv)
 		return 0;
 	}
 	do {
-		class_ = rand() % MAX_MOB_DB;
+		if (type)
+			class_ = summon[type].class_[rand()%summon[type].qty];
+		else //Dead branch
+			class_ = rand() % MAX_MOB_DB;
 		mob = mob_db(class_);
 	} while ((mob == mob_dummy ||
 		mob_is_clone(class_) ||
@@ -986,7 +995,7 @@ int mob_unlocktarget(struct mob_data *md,int tick)
 		md->state.skillstate = MSS_IDLE;
 	case MSS_IDLE:
 		// Idle skill.
-		if (!(++md->ud.walk_count%IDLE_SKILL_INTERVAL) &&
+		if ((md->target_id || !(++md->ud.walk_count%IDLE_SKILL_INTERVAL)) &&
 			mobskill_use(md, tick, -1))
 			break;
 		//Random walk.
@@ -3555,6 +3564,8 @@ static int mob_read_randommonster(void)
 		"mob_boss.txt",
 		"mob_pouch.txt"};
 
+	memset(&summon, 0, sizeof(summon));
+
 	for(i=0;i<MAX_RANDOMMONSTER;i++){
 		mob_db_data[0]->summonper[i] = 1002;	// 設定し忘れた場合はポリンが出るようにしておく
 		sprintf(line, "%s/%s", db_path, mobfile[i]);
@@ -3565,7 +3576,7 @@ static int mob_read_randommonster(void)
 		}
 		while(fgets(line, sizeof(line), fp))
 		{
-			int class_,per;
+			int class_;
 			if(line[0] == '/' && line[1] == '/')
 				continue;
 			memset(str,0,sizeof(str));
@@ -3579,9 +3590,22 @@ static int mob_read_randommonster(void)
 				continue;
 
 			class_ = atoi(str[0]);
-			per=atoi(str[2]);
-			if(mob_db(class_) != mob_dummy)
-				mob_db_data[class_]->summonper[i]=per;
+			if(mob_db(class_) == mob_dummy)
+				continue;
+			mob_db_data[class_]->summonper[i]=atoi(str[2]);
+			if (i) {
+				if (summon[i].qty < sizeof(summon[i].class_)/sizeof(summon[i].class_[0])) //MvPs
+					summon[i].class_[summon[i].qty++] = class_;
+				else {
+					ShowDebug("Can't store more random mobs from %s, increase size of mob.c:summon variable!\n", mobfile[i]);
+					break;
+				}
+			}
+		}
+		if (i && !summon[i].qty)
+		{ //At least have the default here.
+			summon[i].class_[0] = mob_db_data[0]->summonper[i];
+			summon[i].qty = 1;
 		}
 		fclose(fp);
 		ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n",mobfile[i]);

+ 26 - 3
src/map/script.c

@@ -4215,7 +4215,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(warpwaitingpc,"sii?"),
 	BUILDIN_DEF(attachrid,"i"),
 	BUILDIN_DEF(detachrid,""),
-	BUILDIN_DEF(isloggedin,"i"),
+	BUILDIN_DEF(isloggedin,"i?"),
 	BUILDIN_DEF(setmapflagnosave,"ssii"),
 	BUILDIN_DEF(setmapflag,"si*"),
 	BUILDIN_DEF(removemapflag,"si"),
@@ -5118,6 +5118,26 @@ BUILDIN_FUNC(warpparty)
 			}
 		}
 	}
+	else if(strcmp(str,"Leader")==0)
+	{
+		for(i = 0; i < MAX_PARTY && !p->party.member[i].leader; i++);
+		if (i == MAX_PARTY || !p->data[i].sd) //Leader not found / not online
+			return 0;
+		if(map[p->data[i].sd->bl.m].flag.nowarpto)
+			return 0;
+		mapindex = p->data[i].sd->mapindex;
+		x = p->data[i].sd->bl.x;
+		y = p->data[i].sd->bl.y;
+		for (i = 0; i < MAX_PARTY; i++)
+		{
+			pl_sd = p->data[i].sd;
+			if (!pl_sd)
+				continue;
+			if(map[pl_sd->bl.m].flag.noreturn || map[pl_sd->bl.m].flag.nowarp)
+				continue;
+			pc_setpos(pl_sd,mapindex,x,y,3);
+		}
+	}
 	else
 	{
 		mapindex = mapindex_name2id(str);
@@ -9195,8 +9215,11 @@ BUILDIN_FUNC(detachrid)
  *------------------------------------------*/
 BUILDIN_FUNC(isloggedin)
 {
-	push_val(st->stack,C_INT, map_id2sd(
-		script_getnum(st,2) )!=NULL );
+	TBL_PC* sd = map_id2sd(script_getnum(st,2));
+	if (script_hasdata(st,3) && sd &&
+		sd->status.char_id != script_getnum(st,3))
+		sd = NULL;
+	push_val(st->stack,C_INT,sd!=NULL);
 	return 0;
 }