From 6749d6567aa972b5cc46e1ed85986be21e2ec799 Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 11 Jul 2006 16:32:37 +0000 Subject: - Coded @reset. - Reenabled @changesex - Added function pet_create_egg which handles creating pet eggs correctly (when passed item id is indeed a valid petegg). Applied this on @createitem and getitem. - Cleaned up code of @item - Added define UNKNOWN_ITEM_ID (512 = apple) - Added IT_* enumation item_Types to identify said data from items. - Cleaned up the itemdb_isequip functions. itemdb_isequip will now return if the item is equipable by players, itemdb_isstackable returns if the item can be stacked, and itemdb_isidentified returns if the item should drop identified. - Added defines CARD0_PET/CARD0_FORGE/CARD0_CREATED to identify if a given item has "invalid" cards, added define function itemdb_isspecial to simplify this check. - Removed itemdb.c considering item ids above 20000 as invalid. - Cleaned up script commands getitem and card-counting related ones. - Cleaned up a bit more pc_isequip git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7613 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/pet.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/map/pet.c') diff --git a/src/map/pet.c b/src/map/pet.c index 3bec8da30..2f5e210ad 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -108,6 +108,20 @@ static int pet_calc_pos(struct pet_data *pd,int tx,int ty,int dir) return 0; } +int pet_create_egg(struct map_session_data *sd, int item_id) +{ + int pet_id = search_petDB_index(item_id, PET_EGG); + if (pet_id < 0) return 0; //No pet egg here. + sd->catch_target_class = pet_db[pet_id].class_; + intif_create_pet(sd->status.account_id, sd->status.char_id, + (short)pet_db[pet_id].class_, + (short)mob_db(pet_db[pet_id].class_)->lv, + (short)pet_db[pet_id].EggID, 0, + (short)pet_db[pet_id].intimate, + 100, 0, 1, pet_db[pet_id].jname); + return 1; +} + int pet_unlocktarget(struct pet_data *pd) { nullpo_retr(0, pd); @@ -335,7 +349,7 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) memset(&tmp_item,0,sizeof(tmp_item)); tmp_item.nameid = pd->petDB->EggID; tmp_item.identify = 1; - tmp_item.card[0] = (short)0xff00; + tmp_item.card[0] = CARD0_PET; tmp_item.card[1] = GetWord(sd->pet.pet_id,0); tmp_item.card[2] = GetWord(sd->pet.pet_id,1); tmp_item.card[3] = sd->pet.rename_flag; @@ -481,7 +495,7 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag) int i; //Delete egg from inventory. [Skotlex] for (i = 0; i < MAX_INVENTORY; i++) { - if(sd->status.inventory[i].card[0] == (short)0xff00 && + if(sd->status.inventory[i].card[0] == CARD0_PET && p->pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])) break; } @@ -517,7 +531,7 @@ int pet_select_egg(struct map_session_data *sd,short egg_index) if(egg_index < 0 || egg_index >= MAX_INVENTORY) return 0; //Forged packet! - if(sd->status.inventory[egg_index].card[0] == (short)0xff00) + if(sd->status.inventory[egg_index].card[0] == CARD0_PET) intif_request_petdata(sd->status.account_id, sd->status.char_id, MakeDWord(sd->status.inventory[egg_index].card[1], sd->status.inventory[egg_index].card[2]) ); else { if(battle_config.error_log) @@ -637,7 +651,7 @@ int pet_get_egg(int account_id,int pet_id,int flag) memset(&tmp_item,0,sizeof(tmp_item)); tmp_item.nameid = pet_db[i].EggID; tmp_item.identify = 1; - tmp_item.card[0] = (short)0xff00; + tmp_item.card[0] = CARD0_PET; tmp_item.card[1] = GetWord(pet_id,0); tmp_item.card[2] = GetWord(pet_id,1); tmp_item.card[3] = 0; //New pets are not named. -- cgit v1.2.3-70-g09d2