summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-09-08 11:01:36 +0200
committerHaru <haru@dotalux.com>2015-09-08 11:06:33 +0200
commit092644a577d9e770c9efd9b2c9ec3f000ddfb270 (patch)
treeb500f6ca8d1c9acee59c406b39712c38205a39cf
parent4d0c83b84594763e1f14cc5814bd147e36f249fd (diff)
downloadhercules-092644a577d9e770c9efd9b2c9ec3f000ddfb270.tar.gz
hercules-092644a577d9e770c9efd9b2c9ec3f000ddfb270.tar.bz2
hercules-092644a577d9e770c9efd9b2c9ec3f000ddfb270.tar.xz
hercules-092644a577d9e770c9efd9b2c9ec3f000ddfb270.zip
Added pre-re/re support to the pet db. Fixes #702
Thanks to aleprincess Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--db/pre-re/pet_db.txt118
-rw-r--r--db/re/pet_db.txt (renamed from db/pet_db.txt)0
-rw-r--r--src/map/pet.c71
3 files changed, 151 insertions, 38 deletions
diff --git a/db/pre-re/pet_db.txt b/db/pre-re/pet_db.txt
new file mode 100644
index 000000000..37401dca4
--- /dev/null
+++ b/db/pre-re/pet_db.txt
@@ -0,0 +1,118 @@
+// Pet Database
+//
+// Structure of Database:
+// MobID,Name,JName,LureID,EggID,EquipID,FoodID,Fullness,HungryDelay,R_Hungry,R_Full,Intimate,Die,Capture,Speed,S_Performance,talk_convert_class,attack_rate,defence_attack_rate,change_target_rate,pet_script,loyal_script
+//
+// 01. MobID Monster ID of the pet.
+// 02. Name Name of the monster as defined in the database.
+// 03. JName The display name of the monster when hatched.
+// 04. LureID Pet Tame Item ID.
+// 05. EggID Pet Egg ID.
+// 06. EquipID Pet Accessory ID.
+// 07. FoodID Pet Food ID.
+// 08. Fullness The amount Hunger is decreased every [HungryDelay] seconds.
+// 09. HungryDelay The amount of time it takes for hunger to decrease after feeding. (Default: 60 seconds)
+// 10. R_Hungry Amount of Intimacy that is increased when fed.
+// 11. R_Full Amount of Intimacy that is decreased when over-fed.
+// 12. Intimate Amount of Intimacy the pet starts with.
+// 13. Die Amount of Intimacy that is decreased when the pet owner dies.
+// 14. Capture Capture succes rate (10000 = 100%)
+// 15. Speed Pet's walk speed. (Defaul: 150)
+// 16. S_Performance Special Performance. (Yes = 1, No = 0)
+// 17. talk_convert_class Disables pet talk (instead of talking they emote with /!.)
+// 18. attack_rate Rate of which the pet will attack (requires at least pet_support_min_friendly intimacy).
+// 19. defence_attack_rate Rate of which the pet will retaliate when master is being attacked (requires at least pet_support_min_friendly intimacy).
+// 20. change_target_rate Rate of which the pet will change its attack target.
+// 21. pet_script Script to execute when the pet is hatched.
+// 22. loyal_script Script to execute when the pet is hatched (requires at least pet_equip_min_friendly intimacy, independent of pet_script).
+//NOTE: The max value (100%) of attack_rate, defense_rate & change_target_rate is 10000.
+
+//In theory you can use any valid script, but it is run only once upon pet
+//loading, so it is recommended you use the specific pet scripts:
+
+//petskillattack skillid, skilllv, hits, rate, bonusrate
+//Skill attack that triggers while the pet is attacking. Rate is the base
+//chance of execution per attack. Bonusrate is an additional success rate when
+//intimacy reaches max. If hits is specified and different than 0, it will make
+//the pet cast the skill with a fixed amount of damage inflicted and the
+//specified number of hits. A value of zero uses the skill's defaults.
+
+//petskillsupport skillid, skilllv, delay, hp%, sp%
+//Casts a support skill when the health levels are below the specified hp% and
+//sp%. Delay is the minimum time in seconds before the skill can be cast again
+
+//petrecovery type, delay: Cures the "type" status effect after "delay" seconds
+
+//petskillbonus type, value, duration, delay
+//Gives bonus stats. Type is the stat to increase (bStr, bLuk), value is the
+//amount by which it is increased, duration signals how long the bonus lasts
+//delay is the time elapsed after the bonus ends and before it starts again.
+
+//A single pet can have petloot, petskillbonus, petskillattack and
+//petskillsupport at the same time, but only one of each.
+
+1002,PORING,Poring,619,9001,10013,531,80,60,50,100,250,20,2000,150,1,0,350,400,800,{ petloot 10; },{ bonus bLuk,2; bonus bCritical,1; }
+1113,DROPS,Drops,620,9002,10013,508,80,60,40,100,250,20,1500,150,1,0,300,400,500,{ petloot 10; },{ bonus bHit,3; bonus bAtk,3; }
+1031,POPORING,Poporing,621,9003,10013,511,80,60,30,100,250,20,1000,150,1,0,300,500,400,{ petloot 15; },{ bonus bLuk,2; bonus2 bSubEle,Ele_Poison,10; }
+1063,LUNATIC,Lunatic,622,9004,10007,534,80,60,40,100,250,20,1500,150,0,0,300,300,1000,{ petskillbonus bLuk,3,10,50; },{ bonus bCritical,2; bonus bAtk,2; }
+1049,PICKY,Picky,623,9005,10012,507,80,60,40,100,250,20,2000,150,1,0,500,600,50,{ petskillbonus bStr,3,10,50;},{ bonus bStr,1; bonus bAtk,5; }
+1011,CHONCHON,ChonChon,624,9006,10002,537,80,60,30,100,250,20,1500,150,1,0,500,500,250,{ petskillbonus bAgi,4,10,50; },{ bonus bAgi,1; bonus bFlee,2; }
+1042,STEEL_CHONCHON,Steel ChonChon,625,9007,10002,1002,80,60,20,100,250,20,1000,150,1,0,500,500,200,{ petskillbonus bAgiVit,4,20,40; },{ bonus bFlee,6; bonus bAgi,-1; }
+1035,HUNTER_FLY,Hunter Fly,626,9008,10002,716,80,60,10,100,250,20,500,150,1,0,500,500,200,{ petskillattack "NPC_WINDATTACK",888,2,0,10; },{ bonus bFlee,-5; bonus bFlee2,2; }
+1167,SAVAGE_BABE,Savage Babe,627,9009,10015,537,80,60,40,100,250,20,1500,150,0,0,500,500,200,{ petskillbonus bVit,4,10,50; },{ bonus bVit,1; bonus bMaxHP,50; }
+1107,DESERT_WOLF_B,Baby Desert Wolf,628,9010,10003,537,80,60,40,100,250,20,1000,150,0,0,400,400,400,{ petskillattack "SM_PROVOKE",1,0,0,5;},{ bonus bInt,1; bonus bMaxSP,50; }
+1052,ROCKER,Rocker,629,9011,10014,537,80,60,30,100,250,20,1500,150,0,0,350,350,600,{ petskillbonus bAllStats,1,10,50; },{ bonus bHPrecovRate,5; bonus bMaxHP,25; }
+1014,SPORE,Spore,630,9012,10017,537,80,60,30,100,250,20,1500,150,0,0,350,500,500,{ petrecovery SC_POISON,60; },{ bonus bHit,5; bonus bAtk,-2; }
+1077,POISON_SPORE,Poison Spore,631,9013,10017,537,80,60,20,100,250,20,1000,150,0,0,600,200,400,{ petskillattack "NPC_POISON",20,0,0,10; },{ bonus bStr,1; bonus bInt,1; }
+1019,PECOPECO,PecoPeco,632,9014,10010,537,80,60,30,100,250,20,1000,150,1,0,400,500,800,{ petskillbonus bSpeedRate,25,20,20; },{ bonus bMaxHP,150; bonus bMaxSP,-10; }
+1056,SMOKIE,Smokie,633,9015,10019,537,80,60,30,100,250,20,1000,150,1,0,600,600,100,{ petskillbonus bPerfectHide,1,3600,0; },{ bonus bAgi,1; bonus bFlee2,1; }
+1057,YOYO,Yoyo,634,9016,10018,532,80,60,20,100,250,20,1000,150,1,0,300,800,400,{ petloot 20; },{ bonus bCritical,3; bonus bLuk,-1; }
+1023,ORK_WARRIOR,Orc Warrior,635,9017,10009,537,80,60,20,100,250,20,500,150,1,0,600,200,300,{ petskillattack "NPC_PIERCINGATT",100,1,0,10; },{ bonus bAtk,10; bonus bDef,-3; }
+1026,MUNAK,Munak,636,9018,10008,537,80,60,20,100,250,20,500,150,0,0,300,750,300,{ petskillattack "NPC_DARKNESSATTACK",444,1,0,10; },{ bonus bInt,1; bonus bDef,1; }
+1110,DOKEBI,Dokebi,637,9019,10005,537,80,60,20,100,250,20,500,150,0,0,300,300,800,{ petskillattack "BS_HAMMERFALL",1,0,0,10; },{ bonus bMatkRate,1; bonus bAtkRate,-1; }
+1170,SOHEE,Sohee,638,9020,10016,537,80,60,10,100,250,20,500,150,0,0,100,1000,200,{ petskillsupport AL_HEAL,10,60,33,100; },{ bonus bStr,1; bonus bDex,1; }
+1029,ISIS,Isis,639,9021,10006,537,80,60,10,100,250,20,500,150,0,0,650,450,150,{ petskillsupport "PR_MAGNIFICAT",2,60,50,50; },{ bonus bMatkRate,-1; bonus bAtkRate,1; }
+1155,PETIT,Petite,640,9022,10011,537,80,60,20,100,250,20,500,150,0,0,800,400,100,{ petskillattack "WZ_HEAVENDRIVE",500,1,0,10; },{ bonus bDef,-2; bonus bMdef,-2; bonus bAspdRate,1; }
+1109,DEVIRUCHI,Deviruchi,641,9023,10004,711,80,60,10,100,250,20,500,150,0,0,800,200,100,{ petskillbonus bAgiDexStr,6,20,40; },{ bonus bMatkRate,1; bonus bAtkRate,1; bonus bMaxHPrate,-3; bonus bMaxSPrate,-3; }
+1101,BAPHOMET_,Baphomet Jr.,642,9024,10001,518,80,60,10,100,250,20,200,150,0,0,1000,100,200,{ petskillattack "NPC_DARKNESSATTACK",1776,4,0,5; },{ bonus bDef,1; bonus bMdef,1; bonus2 bResEff,Eff_Stun,-100; }
+1188,BON_GUN,Bon Gun,659,9025,10020,537,80,60,30,100,250,20,500,150,1,0,600,200,400,{ petskillattack "NPC_DARKNESSATTACK",555,1,1,1; },{ bonus bVit,1; bonus2 bResEff,Eff_Stun,100; }
+1200,ZHERLTHSH,Zealotus,660,9026,0,929,80,60,10,100,250,20,300,150,0,0,1000,100,500,{ petskillattack "AS_SONICBLOW",1,0,0,3; },{ bonus2 bAddRace,RC_DemiPlayer,2; bonus2 bMagicAddRace,RC_DemiPlayer,2; }
+1275,ALICE,Alice,661,9027,0,504,80,60,20,100,250,20,800,150,0,0,100,1000,200,{ petskillsupport "AL_HEAL",5,60,25,100; },{ bonus bMdef,1; if (RENEWAL) { bonus2 bAddRaceTolerance,RC_DemiPlayer,1; } else { bonus2 bSubRace,RC_DemiPlayer,1; } }
+1815,EVENT_RICECAKE,Rice Cake,0,9028,0,511,80,60,50,100,250,20,2000,150,1,0,500,500,200,{ petskillsupport "CR_DEFENDER",3,240,50,100; },{ bonus2 bSubEle,Ele_Neutral,1; bonus bMaxHPrate,-1; }
+1245,GOBLINE_XMAS,Christmas Goblin,12225,9029,0,911,80,60,50,100,250,20,2000,150,0,0,300,300,800,{ petskillattack "MG_SIGHT",5,0,5,5; },{ bonus bMaxHP,30; bonus2 bSubEle,Ele_Water,1; }
+
+// Newest pets.
+1519,CHUNG_E,Green Maiden,12395,9030,0,6115,80,60,50,100,250,20,2000,150,0,0,300,300,800,{ petskillattack "CR_SHIELDCHARGE",5,0,5,5; },{ bonus bDef,1; if (RENEWAL) { bonus2 bAddRaceTolerance,RC_DemiPlayer,1; } else { bonus2 bSubRace,RC_DemiPlayer,1; } }
+1879,ECLIPSE_P,Spring Rabbit,0,9031,0,7766,80,60,50,100,250,20,2000,150,0,0,300,300,800,{ petskillattack "TF_THROWSTONE",1,0,5,5; },{}
+1122,GOBLIN_1,Goblin,14569,9032,0,7821,80,60,50,100,250,20,800,150,0,0,300,300,800,{ petskillattack "NPC_WINDATTACK",5,0,5,5; },{}
+1123,GOBLIN_2,Goblin,14570,9033,0,7821,80,60,50,100,250,20,800,150,0,0,300,300,800,{ petskillattack "NPC_FIREATTACK",5,0,5,5; },{}
+1125,GOBLIN_4,Goblin,14571,9034,0,7821,80,60,50,100,250,20,800,150,0,0,300,300,800,{ petskillattack "NPC_GROUNDATTACK",5,0,5,5; },{}
+1385,DELETER_,Deleter,14572,9035,0,7822,80,60,20,100,250,20,800,150,0,0,300,300,800,{ petskillattack "SM_MAGNUM",5,0,5,5; },{}
+1382,DIABOLIC,Diabolic,14573,9036,0,7823,80,60,10,100,250,20,800,150,0,0,300,300,800,{ petskillattack "WZ_METEOR",2,0,5,5; },{}
+1208,WANDER_MAN,Wanderer,14574,9037,0,7824,80,60,20,100,250,20,800,150,0,0,300,300,800,{ petskillattack "NPC_UNDEADATTACK",5,0,5,5; },{}
+
+1963,P_CHUNG_E,New Year Doll,0,9038,0,554,80,60,30,100,250,20,800,150,0,0,300,300,800,{ petskillattack "CR_SHIELDCHARGE",5,0,5,5; },{}
+
+// New pets JapanRO Mobile
+1040,GOLEM,Golem,12371,9053,10035,6111,80,60,20,100,250,20,500,150,0,0,300,300,800,{},{ bonus bMaxHP,100; bonus bFlee,-5; }
+1143,MARIONETTE,Marionette,12361,9043,10025,6098,80,60,10,100,250,20,500,150,0,0,300,300,800,{},{ bonus bSPrecovRate,3; }
+1148,MEDUSA,Medusa,12368,9050,10032,6108,80,60,10,100,250,20,200,150,0,0,300,300,800,{},{ bonus bVit,1; bonus2 bResEff,Eff_Stone,500; }
+1179,WHISPER,Whisper,12363,9045,10027,6100,80,60,20,100,250,20,500,150,0,0,300,300,800,{},{ bonus bFlee,7; bonus bDef,-3; }
+1299,GOBLIN_LEADER,Goblin Leader,12364,9046,10028,6104,80,60,10,100,250,20,50,150,0,0,300,300,800,{},{ bonus2 bAddRace,RC_DemiPlayer,3; }
+1370,SUCCUBUS,Succubus,12373,9055,10037,6113,80,60,10,100,250,20,200,150,0,0,300,300,800,{},{ bonus2 bHPDrainRate,50,5; }
+1374,INCUBUS,Incubus,12370,9052,10034,6110,80,60,10,100,250,20,50,150,0,0,300,300,800,{},{ bonus bMaxSPrate,3; }
+1379,NIGHTMARE_TERROR,Nightmare Terror,12372,9054,10036,6112,80,60,10,100,250,20,200,150,0,0,300,300,800,{},{ bonus2 bResEff,Eff_Sleep,10000; }
+1401,SHINOBI,Shinobi,12362,9044,10026,6099,80,60,20,100,250,20,500,150,0,0,300,300,800,{},{ bonus bAgi,2; }
+1404,MIYABI_NINGYO,Miyabi Doll,12366,9048,10030,6106,80,60,15,100,250,20,200,150,0,0,300,300,800,{},{ bonus bInt,1; bonus bCastrate,-3; }
+1416,WICKED_NYMPH,Evil Nymph,12365,9047,10029,6105,80,60,15,100,250,20,500,150,0,0,300,300,800,{},{ bonus bMaxSP,30; bonus bSPrecovRate,5; }
+1495,STONE_SHOOTER,Stone Shooter,12369,9051,10033,6109,80,60,20,100,250,20,500,150,0,0,300,300,800,{},{ bonus2 bSubEle,Ele_Fire,3; }
+1504,DULLAHAN,Dullahan,12367,9049,10031,6107,80,60,10,100,250,20,200,150,0,0,300,300,800,{},{ bonus bCritAtkRate,5; }
+1505,LOLI_RURI,Loli Ruri,12360,9042,10024,6097,80,60,15,100,250,20,200,150,0,0,300,300,800,{},{ bonus bMaxHPrate,3; bonus3 bAutoSpellWhenHit,"AL_HEAL",1,50; }
+1513,CIVIL_SERVANT,Mao Guai,12358,9040,10022,6095,80,60,10,100,250,20,500,150,0,0,300,300,800,{},{ bonus bMaxSP,10; }
+1586,LEAF_CAT,Leaf Cat,12359,9041,10023,6096,80,60,20,100,250,20,200,150,0,0,300,300,800,{},{ if (RENEWAL) { bonus2 bAddRaceTolerance,RC_Brute,2; } else { bonus2 bSubRace,RC_Brute,3; } }
+1630,BACSOJIN_,White Lady,12357,9039,10021,6094,80,60,10,100,250,20,2000,150,0,0,300,300,800,{},{}
+1837,IMP,Fire Imp,12374,9056,10038,6114,80,60,10,100,250,20,200,150,0,0,300,300,800,{},{ bonus2 bSubEle,Ele_Fire,2; bonus2 bAddEle,Ele_Fire,2; }
+
+// Brasilis Quest - Suspicious Beach [UNHATCHABLE]
+2057,E_CRAMP,Strange Cramp,12408,6221,0,0,0,0,0,0,0,0,50,0,0,0,350,400,800,{},{} // kRO version
+2081,E_HYDRA,Strange Hydra,12408,6221,0,0,0,0,0,0,0,0,50,0,0,0,350,400,800,{},{} // iRO/cRO version
diff --git a/db/pet_db.txt b/db/re/pet_db.txt
index 22f7d553f..22f7d553f 100644
--- a/db/pet_db.txt
+++ b/db/re/pet_db.txt
diff --git a/src/map/pet.c b/src/map/pet.c
index 1ac6d117a..81a61459f 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -4,6 +4,7 @@
#define HERCULES_CORE
+#include "config/core.h" // DBPATH
#include "pet.h"
#include "map/atcommand.h" // msg_txt()
@@ -1154,26 +1155,24 @@ int pet_skill_support_timer(int tid, int64 tick, int id, intptr_t data) {
return 0;
}
-/*==========================================
- * Pet read db data
- * pet->db.txt
- * pet->db2.txt
- *------------------------------------------*/
+/**
+ * Loads (or reloads) the pet database.
+ */
int read_petdb()
{
- char* filename[] = {"pet_db.txt","pet_db2.txt"};
- int nameid,i,j,k;
+ const char *filename[] = {
+ DBPATH"pet_db.txt",
+ "pet_db2.txt",
+ };
+ int i,j;
// Remove any previous scripts in case reloaddb was invoked.
- for( j = 0; j < MAX_PET_DB; j++ )
- {
- if( pet->db[j].pet_script )
- {
+ for (j = 0; j < MAX_PET_DB; j++) {
+ if (pet->db[j].pet_script) {
script->free_code(pet->db[j].pet_script);
pet->db[j].pet_script = NULL;
}
- if( pet->db[j].equip_script )
- {
+ if (pet->db[j].equip_script) {
script->free_code(pet->db[j].equip_script);
pet->db[j].equip_script = NULL;
}
@@ -1183,59 +1182,56 @@ int read_petdb()
memset(pet->db,0,sizeof(pet->db));
j = 0; // entry counter
- for( i = 0; i < ARRAYLENGTH(filename); i++ ) {
+ for (i = 0; i < ARRAYLENGTH(filename); i++) {
char line[1024];
int lines, entries;
FILE *fp;
sprintf(line, "%s/%s", map->db_path, filename[i]);
fp=fopen(line,"r");
- if( fp == NULL ) {
- if( i == 0 )
+ if (fp == NULL) {
+ if (i == 0)
ShowError("can't read %s\n",line);
continue;
}
lines = entries = 0;
- while( fgets(line, sizeof(line), fp) && j < MAX_PET_DB ) {
+ while (fgets(line, sizeof(line), fp) && j < MAX_PET_DB) {
char *str[22], *p;
+ int nameid, k;
lines++;
- if(line[0] == '/' && line[1] == '/')
+ if (line[0] == '/' && line[1] == '/')
continue;
memset(str, 0, sizeof(str));
p = line;
- while( ISSPACE(*p) )
+ while (ISSPACE(*p))
++p;
- if( *p == '\0' )
+ if (*p == '\0')
continue; // empty line
- for( k = 0; k < 20; ++k )
- {
+ for (k = 0; k < 20; ++k) {
str[k] = p;
p = strchr(p,',');
- if( p == NULL )
+ if (p == NULL)
break; // comma not found
*p = '\0';
++p;
}
- if( p == NULL )
- {
+ if (p == NULL) {
ShowError("read_petdb: Insufficient columns in line %d, skipping.\n", lines);
continue;
}
// Pet Script
- if( *p != '{' )
- {
+ if (*p != '{') {
ShowError("read_petdb: Invalid format (Pet Script column) in line %d, skipping.\n", lines);
continue;
}
str[20] = p;
p = strstr(p+1,"},");
- if( p == NULL )
- {
+ if (p == NULL) {
ShowError("read_petdb: Invalid format (Pet Script column) in line %d, skipping.\n", lines);
continue;
}
@@ -1243,18 +1239,17 @@ int read_petdb()
p += 2;
// Equip Script
- if( *p != '{' )
- {
+ if (*p != '{') {
ShowError("read_petdb: Invalid format (Equip Script column) in line %d, skipping.\n", lines);
continue;
}
str[21] = p;
- if( (nameid = atoi(str[0])) <= 0 )
+ nameid = atoi(str[0]);
+ if (nameid <= 0)
continue;
- if( !mob->db_checkid(nameid) )
- {
+ if (!mob->db_checkid(nameid)) {
ShowWarning("pet_db reading: Invalid mob-class %d, pet not read.\n", nameid);
continue;
}
@@ -1269,7 +1264,7 @@ int read_petdb()
pet->db[j].fullness=atoi(str[7]);
pet->db[j].hungry_delay=atoi(str[8])*1000;
pet->db[j].r_hungry=atoi(str[9]);
- if( pet->db[j].r_hungry <= 0 )
+ if (pet->db[j].r_hungry <= 0)
pet->db[j].r_hungry=1;
pet->db[j].r_full=atoi(str[10]);
pet->db[j].intimate=atoi(str[11]);
@@ -1284,16 +1279,16 @@ int read_petdb()
pet->db[j].pet_script = NULL;
pet->db[j].equip_script = NULL;
- if( *str[20] )
+ if (*str[20])
pet->db[j].pet_script = script->parse(str[20], filename[i], lines, 0, NULL);
- if( *str[21] )
+ if (*str[21])
pet->db[j].equip_script = script->parse(str[21], filename[i], lines, 0, NULL);
j++;
entries++;
}
- if( j >= MAX_PET_DB )
+ if (j >= MAX_PET_DB)
ShowWarning("read_petdb: Reached max number of pets [%d]. Remaining pets were not read.\n ", MAX_PET_DB);
fclose(fp);
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' pets in '"CL_WHITE"%s"CL_RESET"'.\n", entries, filename[i]);