diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-18 04:32:20 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-18 04:32:20 +0000 |
commit | fd42f3d7e7a803d997a82c25a9f7b853797a6aa3 (patch) | |
tree | 7cc429cee5aea97fda5fb1d5dc4cd58e146df860 | |
parent | c7ee688020983ae148eabb853b7cf5bae00fd32d (diff) | |
download | hercules-fd42f3d7e7a803d997a82c25a9f7b853797a6aa3.tar.gz hercules-fd42f3d7e7a803d997a82c25a9f7b853797a6aa3.tar.bz2 hercules-fd42f3d7e7a803d997a82c25a9f7b853797a6aa3.tar.xz hercules-fd42f3d7e7a803d997a82c25a9f7b853797a6aa3.zip |
- Added the official adoption method.
( Parents need to create a party, invite a novice/first class, both equip the wedding rings and someone just right click the future baby ).
- Fixed a bug sometimes client don't show job's bonus stats.
- Removed the problematic adoption script.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12389 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | db/packet_db.txt | 4 | ||||
-rw-r--r-- | npc/custom/adoption.txt | 504 | ||||
-rw-r--r-- | npc/scripts_custom.conf | 2 | ||||
-rw-r--r-- | src/char_sql/int_auction.c | 1 | ||||
-rw-r--r-- | src/map/atcommand.c | 9 | ||||
-rw-r--r-- | src/map/clif.c | 139 | ||||
-rw-r--r-- | src/map/clif.h | 5 | ||||
-rw-r--r-- | src/map/guild.c | 2 | ||||
-rw-r--r-- | src/map/map.h | 1 | ||||
-rw-r--r-- | src/map/party.c | 2 | ||||
-rw-r--r-- | src/map/pc.c | 160 | ||||
-rw-r--r-- | src/map/pc.h | 5 | ||||
-rw-r--r-- | src/map/script.c | 27 | ||||
-rw-r--r-- | src/map/trade.c | 2 |
14 files changed, 209 insertions, 654 deletions
diff --git a/db/packet_db.txt b/db/packet_db.txt index 551ba9004..ab9c49581 100644 --- a/db/packet_db.txt +++ b/db/packet_db.txt @@ -414,9 +414,9 @@ packet_ver: 5 0x01f4,32 0x01f5,9 0x01f6,34 -0x01f7,14 +0x01f7,14,adoptreply,0 0x01f8,2 -0x01f9,6,adopt,5 +0x01f9,6,adoptrequest,0 0x01fa,48 0x01fb,56 0x01fc,-1 diff --git a/npc/custom/adoption.txt b/npc/custom/adoption.txt deleted file mode 100644 index 18d942e7e..000000000 --- a/npc/custom/adoption.txt +++ /dev/null @@ -1,504 +0,0 @@ -//===== eAthena Script ======================================= -//= Simple Adoption Script -//===== By =================================================== -//= Fredzilla with help from Kamari,Acky -//===== Version ============================================== -//= 1.7 Moved warps to the southern exit of the main chappel. [L0ne_W0lf] -//= 1.6a Fixed wrong label name [KarLaeda] -//= 1.6 Removed call to function Is_Taekwon_Class in favor of baseClass == Job_Taekwon [Silentdragon] -//= 1.5 Added GM menu to reset current adoption [Lupus] -//= 1.4 Got rid of useless "event_adoptXXX" variables [Lupus] -//= 1.3c - Slightly rewrote the anti-taekwon protection to -//= detect problems more easily [DracoRPG] -//= 1.3a - Added anti Taekwon Classes protection (they can't -//= be adopted) [Lupus] -//= 1.3 - Now it can teach parents/baby their missing skills. -//= Your old families should talk to these NPCs to get -//= their family skills [Lupus] -//= 1.2b - More fixes + Added Acky's teacher to the end -//= (stoped it from saying a particular word I thought -//= was inapropriate for a kids game) -//= 1.1 - Minor correction, replaced missing close; and mes :D -//= 1.0 - First Release, most likely going to have some bugs -//= Is using @adopt instead of proper NPC script command -//===== Compatible With ====================================== -//= eAthena Final (SVN), any version that contained the GM command @adopt -//= This is any version released after 03/29/05, don't know the number -//===== Description ========================================== -//= A simple adoption script that lets couples adopt a -//= lvl 1/1 novice without the help of a GM there -//===== Comments ============================================= -//= List or Variables used -//= $@AdoptionActive = Stops other people trying to use -//= the adoption NPC's intill the currant one is over. -//= @AdoptionReady = Marks person that talks to first NPC, -//= this person will end up being ParentOne. -//= $@ParentOne$ = Explains itself. -//= $@ParentTwo$ = "" "" -//= $@Baby$ = "" "" -//= $@GenderBaby$ = Set so it can state boy or girl. -//= $@FinalQuestion = Lets the parents take one last chance -//= to cancel the adoption before it is perminant. -//= $@CheckAll = Follow on from the last one, when this = 3, -//= the adoption will take place and will be perminant. -//= @regged = Stops the same person being counted twice -//= before the adoption is completed. -//= Lupus removed: -//= *event_adopt = Put on the parents so they cannot adopt again. -//= *event_adopted = Put on baby so it can't be adopted again. -//= Use "getchildid()>0" insread of event_adopt -//= Use "Upper==2" insread of event_adopted -//============================================================ - -prt_church,83,122,0 warp prtch03 1,2,prt_church,164,171 -prt_church,162,171,0 warp prtch01-3 1,2,prt_church,86,122 - -prt_church,166,176,3 script Adoption Man 61,{ - - //If u're a GM you can always reset current Adoption process - if(getgmlevel()>=90) { - mes "[GM Menu]"; - mes "Would you like to reset curent adoption?"; - next; - menu "Yes",-,"No",L_SKIP; - callfunc "AdoptReset","GM reset"; - close; - } -L_SKIP: - - if($@AdoptionActive == 1) goto A_Cannot; - mes "[Oliver]"; - if (Upper==2) goto A_YouBaby; - if (getchildid()>0 && getskilllv(410)<=0) goto A_GetSkill; - if (getchildid()>0) goto A_Already; - mes "Would you like to adopt someone?"; - next; - menu "Yes",A_Yes,"No",-; -A_No: - mes "[Oliver]"; - mes "I am sorry to hear that, please come back when you believe you are ready."; - close; -A_Cannot: - mes "[Oliver]"; - mes "There is currentlly an adoption in progress, come back when it is finished."; - close; -A_Yes: - mes "[Oliver]"; - mes "Good to hear it!"; - mes "But do you meet the requirements for adoption?"; - next; - mes "[Oliver]"; - mes "We can't just give out babies at the drop of a hat."; - mes "Before we can let you leave with a baby we have to know you are strong enough to take care of it."; - next; - mes "[Oliver]"; - mes "We also need to know you have a partner you are married to."; - mes "We won't give a baby to an un-married couple."; - next; - mes "[Oliver]"; - mes "Do you think you meet these criteria?"; - next; - menu "Yes, I would love to adopt?",-,"No, I don't think I can",A_No; - mes "[Oliver]"; - mes "Well you seem set on this."; - next; - deltimer "timeadopt::OnAdopt"; - addtimer 300000,"timeadopt::OnAdopt"; - if ($@AdoptionActive == 1) goto A_Cannot; - set $@AdoptionActive,1; - set @AdoptionReady,1; - mes "[Oliver]"; - mes "I will refer you to my coleage over there."; - close; - -A_GetSkill: - mes "You have just adopted a baby. I'll teach you a useful skill CALL BABY !"; - next; - emotion 46; - skill 410,1,0; - mes "[Oliver]"; - mes "Done! Tell your partner to call me, too."; - mes "Our children are our future!"; - close; -A_Already: - emotion 1; - mes "How is your baby today?"; - close; -A_YouBaby: - emotion 2; - mes "Say HI to your parents! Be cool!"; - if (getskilllv(408)<=0 || getskilllv(409)<=0) mes "By the way, our Teacher's wanting to see you."; - close; -} - -prt_church,172,177,3 script Adoption Lady 103,{ - if (Upper==2) goto A_YouBaby; - if (getchildid()>0 && getskilllv(410)<=0) goto A_GetSkill; - if (getchildid()>0) goto A_Already; - if ($@FinalQuestion==1 && $@ParentOne$==strcharinfo(0)) goto A_ParentOneEnd; - if ($@FinalQuestion==1 && $@ParentTwo$==strcharinfo(0)) goto A_ParentTwoEnd; - if ($@FinalQuestion==1 && $@Baby$==strcharinfo(0)) goto A_BabyEnd; - if (strcharinfo(0)==$@Baby$) goto A_FinalTest; - if (strcharinfo(0)==$@ParentTwo$) goto A_SecondReg; - if (@AdoptionReady==0 || $@AdoptionActive==0) goto A_SeeFriend; - mes "[Inanna]"; - deltimer "timeadopt::OnAdopt"; - addtimer 300000,"timeadopt::OnAdopt"; - mes "So you think you meet our strict requirements?"; - mes "Let's see here, are you over level 70?"; - next; - menu "Yes, I am over level 70",A_lvl,"No, sorry to bother you",-; - mes "[Inanna]"; - mes "Oh, I am sorry to hear that, please return when you meet this requirement."; - callfunc "AdoptReset","the parent didn't meet level requirements"; - close; -A_SeeFriend: - mes "[Inanna]"; - mes "Seems you haven't talked to my friend here."; - mes "He will refer you to me, when he thinks you are ready."; - close; -A_lvl: - if(BaseLevel >= 70) goto A_lvlpassed; - mes "[Inanna]"; - mes "Not only should I fail you on being a low level, but you also lied to me."; - next; - mes "[Inanna]"; - mes "I can't give a baby to you"; - callfunc "AdoptReset","the parent didn't meet level requirements"; - close; -A_lvlpassed: - mes "[Inanna]"; - mes "WOW, you have passed the test of strength."; - next; - mes "[Inanna]"; - mes "But lets see if you are happily married."; - mes "For this I will need to see your wedding ring."; - next; - mes "[Inanna]"; - mes "Do you have you wedding ring on you now?"; - next; - menu "Yes, here you go",A_Wedring,"No, Sorry I don't",A_Noring,"I am not married",-; - mes "[Inanna]"; - mes "Well, as my fried said here, we will not give a baby to a family that is not married"; - callfunc "AdoptReset","the parent isn't married"; - close; -A_Noring: - mes "[Inanna]"; - mes "I can't believe you are in a loving marriage when you don't have your ring on you at all times!!!"; - next; - mes "[Inanna]"; - mes "I don't believe you deserve a baby."; - callfunc "AdoptReset","the parent hasn't got a wedding ring as proof of marriage."; - close; -A_Wedring: - if ( countitem(2634)>0 || countitem(2635)>0 ) goto A_Wedringpassed; - goto A_Noring; -A_Wedringpassed: - mes "[Inanna]"; - mes "Awwwww, such a lovely ring, you must love your partner."; - next; - if (getchildid()>0) goto A_AlreadyHaveBaby; - mes "[Inanna]"; - mes "I need to see them, please tell me their name."; - next; - input $@ParentTwo$; - set $@ParentOne$, strcharinfo(0); - mes "[Inanna]"; - mes "Your partner now has 5 min to talk to me before the adoption is canceled."; - next; - deltimer "timeadopt::OnAdopt"; - addtimer 300000,"timeadopt::OnAdopt"; - areaannounce "prt_church",0,0,350,350,"Can I please see "+$@ParentTwo$+" please",0; - mes "[Inanna]"; - mes "Can you now please wait for me to call you again, thank you."; - close; -A_AlreadyHaveBaby: - mes "Now lets look at the inscription on your ring, oh it seems you already have a baby."; - next; - mes "[Inanna]"; - mes "I am sorry, you can only ever adopt once."; - mes "Please take care of you baby."; - callfunc "AdoptReset","the parent has already adopted once before"; - close; -A_SecondReg: - deltimer "timeadopt::OnAdopt"; - addtimer 300000,"timeadopt::OnAdopt"; - mes "[Inanna]"; - mes "You must be "+$@ParentTwo$+", I just talked to your partner "+$@ParentOne$+", they mentioned you want to adopt baby."; - next; - mes "[Inanna]"; - mes "Do you agree with "+$@ParentOne$+", do you want to adopt?"; - next; - menu "Yes, I agree with them",A_agree,"No, I don't want to adopt",-; - mes "[Inanna]"; - mes "This is bad news, I am very sorry to hear this."; - callfunc "AdoptReset","the 2nd parent does not want to adopt"; - close; -A_agree: - mes "[Inanna]"; - mes "Now I will put you through the same test as your partner."; - next; - if(BaseLevel >= 70) goto A_lvltwo; - mes "[Inanna]"; - mes "Sorry you are not over level 70."; - callfunc "AdoptReset","the 2nd parent didn't meet the level requirements"; - close; -A_lvltwo: - if ( countitem(2634)>0 || countitem(2635)>0 ) goto A_Wedringtwo; - mes "[Inanna]"; - mes "Sorry you don't have a wedding ring on you as proof of marriage."; - callfunc "AdoptReset","the 2nd parent hasnt got a wedding ring as proof of marriage"; - close; -A_Wedringtwo: - if (getchildid()>0) goto A_AlreadyHaveBaby; - mes "[Inanna]"; - mes "You have checked out, and have passed all the requirements."; - mes "All you need is a novice to adopt."; - next; - mes "[Inanna]"; - mes "Do you have a novice to adopt?"; - next; - menu "Yes, right here",A_YesBaby,"No, I'm sorry",-; - mes "[Inanna]"; - mes "I suggest you find one, remember to get your parent to talk to my friend first when you return."; - callfunc "AdoptReset","there is no novice present to be adopted"; - close; -A_YesBaby: - mes "[Inanna]"; - mes "Can I please know thier name?"; - next; - input $@Baby$; - mes "[Inanna]"; - mes "The novice now has 5min to come and talk to me, or the adopt will be canceled."; - next; - deltimer "timeadopt::OnAdopt"; - addtimer 300000,"timeadopt::OnAdopt"; - mes "[Inanna]"; - mes "Thank you, can you please wait with your partner, and wait to be called back."; - areaannounce "prt_church",0,0,350,350,"Can I please see "+$@Baby$+", please",0; - close; -A_FinalTest: - deltimer "timeadopt::OnAdopt"; - addtimer 300000,"timeadopt::OnAdopt"; - if(Upper==2) goto A_AlreadyAdopted; - if(baseClass == Job_Taekwon) goto A_CantBeAdopted; - mes "[Inanna]"; - mes "You must be "+$@Baby$+", its very nice to meet you."; - mes "Some very nice people, "+$@ParentOne$+" and "+$@ParentTwo$+", have asked to adopt you."; - next; - if(sex!=0) set $@GenderBaby$,"boy"; - if(sex==0) set $@GenderBaby$,"girl"; - - mes "[Inanna]"; - mes "Now can you be a good "+$@GenderBaby$+" and go with these nice people?"; - next; - menu "Yes, me would luv too",A_BabyYes,"NOOOOO!!!",-; - mes "[Inanna]"; - mes "Please calm down."; - mes "I will try and find better parents for you next time."; - callfunc "AdoptReset","the novice didn't want to be adopted"; - close; -A_BabyYes: - mes "[Inanna]"; - mes "Awwww, so cute, good to hear it."; - mes "Now lets see here."; - next; - mes "[Inanna]"; - mes "I need to do a check on your level to prove you are a novice, stand still."; - next; - if (BaseLevel == 1 && JobLevel == 1) goto A_Ready; - mes "[Inanna]"; - mes "Sorry but you are higher than level one, and cause of this you are a true novice."; - callfunc "AdoptReset","the person that would be adopted, is over level 1"; - close; -A_Ready: - mes "[Inanna]"; - mes "You are just as sweet an inocent as the day our lord made you."; - next; - mes "[Inanna]"; - mes "I have no objections to you being adopted."; - mes "Before you can be adopted I will need to see your parents, and you, one last time."; - set $@FinalQuestion,1; - areaannounce "prt_church",0,0,350,350,"Can I please see all people involved with this adoption please",0; - deltimer "timeadopt::OnAdopt"; - addtimer 300000,"timeadopt::OnAdopt"; - close; -A_AlreadyAdopted: - mes "[Inanna]"; - mes "Oh you are already adopted, so you can't be adopted again."; - callfunc "AdoptReset","the person that would be adopted has already been adopted before"; - close; -A_CantBeAdopted: - mes "[Inanna]"; - mes "Sorry, but your job does not allow adoption."; - callfunc "AdoptReset","the person that would be adopted has a job that can't be adopted"; - close; -A_ParentOneEnd: - if (@regged>1) goto A_AlreadyReged; - if ($@ParentOne$==$@ParentTwo$) goto A_SameFail; - mes "[Inanna]"; - mes "Nice to talk to you again "+$@ParentOne$; - mes "This is you last chance to back out"; - next; - mes "[Inanna]"; - mes "You can only ever adopt once, so if you adopt "+$@Baby$+", you can never adopt any one else ever"; - next; - mes "[Inanna]"; - mes "Are you sure you want to proceed"; - next; - menu "Yes",A_FinalYesP,"No",-; - mes "[Inanna]"; - mes "I cannot believe you would come this far to say no!"; - mes "Are you sure you want to stop now?"; - next; - menu "Yes, I don't want to adopt",-,"No, I made a mistake",A_ParentOneEnd; -A_Failend: - mes "[Inanna]"; - mes "Well if you are sure"; - callfunc "AdoptReset","a parent or the novice pulled out"; - close; -A_FinalYesP: - mes "[Inanna]"; - mes "OK everything is ready to start this adoption"; - mes "I will announce to everyone when it is complete"; - set @regged,1; - set $@checkall,$@checkall+1; - if ($@checkall==3) goto THEEND; - close; -A_ParentTwoEnd: - if (@regged>1) goto A_AlreadyReged; - mes "[Inanna]"; - mes "Nice to talk to you again "+$@ParentTwo$; - mes "This is you last chance to back out"; - next; - mes "[Inanna]"; - mes "You can only ever adopt once, so if you adopt "+$@Baby$+", you can never adopt any one else ever"; - next; - mes "[Inanna]"; - mes "Are you sure you want to proceed"; - next; - menu "Yes",A_FinalYesP,"No",-; - mes "[Inanna]"; - mes "I cannot believe you would come this far to say no!"; - mes "Are you sure you want to stop now?"; - next; - menu "Yes, I don't want to adopt",A_Failend,"No, I made a mistake",A_ParentTwoEnd; -A_AlreadyReged: - mes "[Inanna]"; - mes "Please wait for the others to talk to me"; - close; -A_BabyEnd: - if (@regged>1) goto A_AlreadyReged; - mes "[Inanna]"; - mes "Nice to talk to you again "+$@Baby$; - mes "This is you last chance to back out"; - next; - mes "[Inanna]"; - mes "You can only ever be adopted once, so if you are adopted by "+$@ParentOne$+" and "+$@ParentTwo$+", you can never be adopted again"; - next; - mes "[Inanna]"; - mes "Are you sure you want to proceed"; - next; - menu "Yes",A_FinalYesB,"No",-; - mes "[Inanna]"; - mes "I cannot believe you would come this far to say no!"; - mes "Are you sure you want to stop now?"; - next; - menu "Yes, I don't want to adopt",A_Failend,"No, I made a mistake",A_BabyEnd; -A_FinalYesB: - mes "[Inanna]"; - mes "OK everything is ready to start this adoption"; - mes "I will announce to everyone when it is complete"; - set @regged,1; - set $@checkall,$@checkall+1; - if ($@checkall==3) goto THEEND; - close; -A_SameFail: - mes "[Inanna]"; - mes "Sorry, it seems you have registered as both parents, this isn't allowed"; - callfunc "AdoptReset","both parents are the same person"; - close; - -A_GetSkill: - emotion 20; - mes "[Inanna]"; - mes "You can't see your baby often?.. I'll try to teach you one skil... Where's my skills manual?"; - next; - mes "[Oliver]"; - mes "Hey, Inanna! This is my job. Pass them to me!"; - close; -A_Already: - mes "[Inanna]"; - emotion 21; - mes "How is your baby now?"; - close; -A_YouBaby: - mes "[Inanna]"; - emotion 30; - mes "Tell your father he's a good father!"; - if (getskilllv(408)<=0 || getskilllv(409)<=0) mes "You should talk to our Teacher."; - close; - -THEEND: - logmes "Adoption: "+$@Baby$+" adopted by "+$@ParentOne$+" and "+$@ParentTwo$+"."; - adopt $@ParentOne$,$@ParentTwo$,$@Baby$; - announce $@ParentOne$+" and "+$@ParentTwo$+" has just adopted a new baby "+$@GenderBaby$+", called "+$@Baby$,5; - deltimer "timeadopt::OnAdopt"; - set $@AdoptionActive, 0; - set $@ParentOne$, null; - set $@ParentTwo$, null; - set $@Baby$, null; - set $@GenderBaby$, null; - set $@FinalQuestion, 0; - set $@CheckAll, 0; - close; - end; -} - -prt_church,165,175,0 script timeadopt -1,{ -OnAdopt: - callfunc "AdoptReset","too much time has passed between steps"; - end; -} -function script AdoptReset { - deltimer "timeadopt::OnAdopt"; - set $@AdoptionActive, 0; - set $@ParentOne$, null; - set $@ParentTwo$, null; - set $@Baby$, null; - set $@GenderBaby$, null; - set $@FinalQuestion, 0; - set $@CheckAll, 0; - areaannounce "prt_church",0,0,350,350,"The adoption has been canceled because "+getarg(0),0; - return; -} - -prt_church,165,166,6 script Teacher#adopt 97,{ - mes "[Mario]"; - if (Upper==2 && (getskilllv(408)<=0 || getskilllv(409)<=0)) goto L_Teach; - if (Upper==2) mes "Hello, baby! How are you?"; - if (Upper!=2) mes "How are you?"; - next; - menu "Great!",-,"Fine.",-,"So-so...",-,"Shoot me, please.",-; - mes "[Mario]"; - mes "So nice!"; - emotion rand(19,21); - close; - -L_Teach: - skill 408,1,0; - skill 409,1,0; - mes "Ta-da! Now you know 2 quite useful skills!"; - mes "1. Call your Parents (when you're in a danger)."; - mes "2. Protect your parents' EXP with yor love!"; - emotion 41; - next; - mes "[Mario]"; - mes "On seeing a baby tell them to visit me."; - next; - -L_Cancel: - mes "[Mario]"; - mes "Bye bye!"; - close; -} diff --git a/npc/scripts_custom.conf b/npc/scripts_custom.conf index da258fe23..226724032 100644 --- a/npc/scripts_custom.conf +++ b/npc/scripts_custom.conf @@ -9,8 +9,6 @@ // Your scripts go here!! // -------------------------------------------------------------- // ----------------------- Basic Scripts ----------------------- -// -- Adoption NPC [Fredzilla] -npc: npc/custom/adoption.txt // -- Auctioneer - Use at own risk [Fredzilla] // Warning: It dupe items. //npc: npc/custom/Auctioneer.txt diff --git a/src/char_sql/int_auction.c b/src/char_sql/int_auction.c index 2e5e90c1d..15b316bb8 100644 --- a/src/char_sql/int_auction.c +++ b/src/char_sql/int_auction.c @@ -22,7 +22,6 @@ static DBMap* auction_db_ = NULL; // int auction_id -> struct auction_data* void auction_delete(struct auction_data *auction); static int auction_end_timer(int tid, unsigned int tick, int id, int data); -// Copy Paste from map/mail.c static int auction_count(int char_id, bool buy) { int i = 0; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 7a202d3fd..917d119bf 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -7536,9 +7536,7 @@ int atcommand_whereis(const int fd, struct map_session_data* sd, const char* com *------------------------------------------*/ int atcommand_adopt(const int fd, struct map_session_data* sd, const char* command, const char* message) { - struct map_session_data *pl_sd1 = NULL; - struct map_session_data *pl_sd2 = NULL; - struct map_session_data *pl_sd3 = NULL; + struct map_session_data *pl_sd1, *pl_sd2, *pl_sd3; char player1[NAME_LENGTH], player2[NAME_LENGTH], player3[NAME_LENGTH]; char output[256]; @@ -7570,7 +7568,7 @@ int atcommand_adopt(const int fd, struct map_session_data* sd, const char* comma return -1; } - if( pc_adoption(pl_sd1, pl_sd2, pl_sd3) != 0 ) { + if( !pc_adoption(pl_sd1, pl_sd2, pl_sd3) ) { return -1; } @@ -8218,7 +8216,10 @@ int atcommand_auction(const int fd, struct map_session_data *sd, const char *com { nullpo_retr(0,sd); +#ifndef TXT_ONLY clif_Auction_openwindow(sd); +#endif + return 0; } diff --git a/src/map/clif.c b/src/map/clif.c index 3f6cf94f6..f910e5418 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5311,7 +5311,7 @@ int clif_party_member_info(struct party_data *p, struct map_session_data *sd) WBUFW(buf, 0) = 0x1e9; WBUFL(buf, 2) = sd->status.account_id; - WBUFL(buf, 6) = 0; //Apparently setting this to 1 makes you adoptable. + WBUFL(buf, 6) = 0; WBUFW(buf,10) = sd->bl.x; WBUFW(buf,12) = sd->bl.y; WBUFB(buf,14) = 0; //Unconfirmed byte, could be online/offline. @@ -6735,19 +6735,7 @@ void clif_callpartner(struct map_session_data *sd) return; } */ -/*========================================== - * Adopt baby [Celest] - *------------------------------------------*/ -void clif_adopt_process(struct map_session_data *sd) -{ - int fd; - nullpo_retv(sd); - fd=sd->fd; - WFIFOHEAD(fd,packet_len(0x1f8)); - WFIFOW(fd,0)=0x1f8; - WFIFOSET(fd,packet_len(0x1f8)); -} /*========================================== * Marry [DracoRPG] *------------------------------------------*/ @@ -6781,18 +6769,6 @@ void clif_divorced(struct map_session_data* sd, const char* name) /*========================================== * *------------------------------------------*/ -void clif_parse_ReqAdopt(int fd, struct map_session_data *sd) -{ - nullpo_retv(sd); - - WFIFOHEAD(fd,packet_len(0x1f6)); - WFIFOW(fd,0)=0x1f6; - WFIFOSET(fd, packet_len(0x1f6)); -} - -/*========================================== - * - *------------------------------------------*/ void clif_parse_ReqMarriage(int fd, struct map_session_data *sd) { nullpo_retv(sd); @@ -7959,7 +7935,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) //Login Event npc_script_event(sd, NPCE_LOGIN); mob_barricade_get(sd); - } else if( sd->state.changemap ) { + } else { //For some reason the client "loses" these on map-change. clif_updatestatus(sd,SP_STR); clif_updatestatus(sd,SP_AGI); @@ -7967,15 +7943,20 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_updatestatus(sd,SP_INT); clif_updatestatus(sd,SP_DEX); clif_updatestatus(sd,SP_LUK); + } - //New 'night' effect by dynamix [Skotlex] + if( sd->state.changemap ) + { if (night_flag && map[sd->bl.m].flag.nightenabled) { //Display night. - if (!sd->state.night) { + if( !sd->state.night ) + { sd->state.night = 1; clif_status_load(&sd->bl, SI_NIGHT, 1); } - } else if (sd->state.night) { //Clear night display. + } + else if( sd->state.night ) + { //Clear night display. sd->state.night = 0; clif_status_load(&sd->bl, SI_NIGHT, 0); } @@ -11216,24 +11197,6 @@ void clif_parse_ReqFeel(int fd, struct map_session_data *sd, int skilllv) sd->menuskill_val = skilllv; } -void clif_parse_AdoptRequest(int fd,struct map_session_data *sd) -{ - //TODO: add somewhere the adopt code, checks for exploits, etc, etc. - //Missing packets are the client's reply packets to the adopt request one. - //[Skotlex] - int account_id; - struct map_session_data *sd2; - - account_id = RFIFOL(fd,2); - sd2 = map_id2sd(account_id); - if(sd2 && sd2->fd && sd2 != sd && sd2->status.party_id == sd->status.party_id) { //FIXME: No checks whatsoever are in place yet! - fd = sd2->fd; - WFIFOHEAD(fd,packet_len(0x1f9)); - WFIFOW(fd,0)=0x1f9; - WFIFOSET(fd, packet_len(0x1f9)); - } -} - /*========================================== * Homunculus packets *------------------------------------------*/ @@ -11725,6 +11688,24 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd) * AUCTION SYSTEM * By Zephyrus *==========================================*/ +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd = sd->fd; + + if( sd->state.storage_flag || sd->vender_id || sd->state.trading ) + return; + + WFIFOHEAD(fd,12); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOB(fd,6) = 0xb6; + WFIFOB(fd,7) = 0x00; + WFIFOB(fd,8) = 0xa6; + WFIFOB(fd,9) = 0xde; + WFIFOW(fd,10) = 0; + WFIFOSET(fd,12); +} + void clif_Auction_results(struct map_session_data *sd, short count, short pages, unsigned char *buf) { int i, fd = sd->fd, len = sizeof(struct auction_data); @@ -12039,24 +12020,59 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) } /*========================================== - * AUCTIONS SYSTEM + * Adoption System *==========================================*/ -void clif_Auction_openwindow(struct map_session_data *sd) + +// 0 : You cannot adopt more that 1 son +// 1 : You should be at least lvl 70 to adopt +// 2 : You cannot adopt a married player +void clif_Adopt_reply(struct map_session_data *sd, int type) { int fd = sd->fd; - if( sd->state.storage_flag || sd->vender_id || sd->state.trading ) - return; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x0216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} - WFIFOHEAD(fd,12); - WFIFOW(fd,0) = 0x25f; - WFIFOL(fd,2) = 0; - WFIFOB(fd,6) = 0xb6; - WFIFOB(fd,7) = 0x00; - WFIFOB(fd,8) = 0xa6; - WFIFOB(fd,9) = 0xde; - WFIFOW(fd,10) = 0; - WFIFOSET(fd,12); +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) +{ + int fd = sd->fd; + + WFIFOSET(fd,34); + WFIFOW(fd,0) = 0x01f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, NAME_LENGTH); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) +{ + struct map_session_data *tsd = map_id2sd(RFIFOL(fd,2)), *p_sd = map_charid2sd(sd->status.partner_id); + + if( pc_can_Adopt(sd, tsd, p_sd) ) + { + tsd->adopt_invite = sd->status.account_id; + clif_Adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) +{ + struct map_session_data *p1_sd = map_id2sd(RFIFOL(fd,2)), *p2_sd = map_id2sd(RFIFOL(fd,6)); + int result = RFIFOL(fd,10), pid = sd->adopt_invite; + + sd->adopt_invite = 0; + + if( pid != p1_sd->status.account_id ) + return; // Not the same sender + + if( pc_can_Adopt(p1_sd, p2_sd, sd) ) + { + // Lets do the adoption!! + } } /*========================================== @@ -12497,7 +12513,6 @@ static int packetdb_readdb(void) {clif_parse_Taekwon,"taekwon"}, {clif_parse_RankingPk,"rankingpk"}, {clif_parse_FeelSaveOk,"feelsaveok"}, - {clif_parse_AdoptRequest,"adopt"}, {clif_parse_debug,"debug"}, {clif_parse_ChangeHomunculusName,"changehomunculusname"}, {clif_parse_HomMoveToMaster,"hommovetomaster"}, @@ -12508,6 +12523,8 @@ static int packetdb_readdb(void) {clif_parse_Hotkey,"hotkey"}, {clif_parse_AutoRevive,"autorevive"}, {clif_parse_Check,"check"}, + {clif_parse_Adopt_request,"adoptrequest"}, + {clif_parse_Adopt_reply,"adoptreply"}, #ifndef TXT_ONLY // MAIL SYSTEM {clif_parse_Mail_refreshinbox,"mailrefresh"}, diff --git a/src/map/clif.h b/src/map/clif.h index 286eaa6f1..8c48b7277 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -408,6 +408,7 @@ void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title); void clif_Mail_refreshinbox(struct map_session_data *sd); void clif_Mail_getattachment(int fd, uint8 flag); // AUCTION SYSTEM +void clif_Auction_openwindow(struct map_session_data *sd); void clif_Auction_results(struct map_session_data *sd, short count, short pages, unsigned char *buf); void clif_Auction_message(int fd, unsigned char flag); void clif_Auction_close(int fd, unsigned char flag); @@ -416,7 +417,7 @@ void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd); void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd); -// AUCTION SYSTEM -void clif_Auction_openwindow(struct map_session_data *sd); +// ADOPTION +void clif_Adopt_reply(struct map_session_data *sd, int type); #endif /* _CLIF_H_ */ diff --git a/src/map/guild.c b/src/map/guild.c index 5644793b2..ed35aaccb 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -618,7 +618,7 @@ int guild_invite(struct map_session_data *sd,struct map_session_data *tsd) return 0; //Invite permission. if(!battle_config.invite_request_check) { - if (tsd->party_invite>0 || tsd->trade_partner) { // 相手が取引中かどうか + if (tsd->party_invite>0 || tsd->trade_partner || tsd->adopt_invite ) { // 相手が取引中かどうか clif_guild_inviteack(sd,0); return 0; } diff --git a/src/map/map.h b/src/map/map.h index c15af9b79..611e55d6e 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -746,6 +746,7 @@ struct map_session_data { } deal; int party_invite,party_invite_account; + int adopt_invite; // Adoption int guild_invite,guild_invite_account; int guild_emblem_id,guild_alliance,guild_alliance_account; diff --git a/src/map/party.c b/src/map/party.c index be89f6345..2e5370a80 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -288,7 +288,7 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd) } if(!battle_config.invite_request_check) { - if (tsd->guild_invite>0 || tsd->trade_partner) { + if (tsd->guild_invite>0 || tsd->trade_partner || tsd->adopt_invite) { clif_party_inviteack(sd,tsd->status.name,0); return 0; } diff --git a/src/map/pc.c b/src/map/pc.c index a06f1c474..9d8ef409b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -537,6 +537,119 @@ static int pc_isAllowedCardOn(struct map_session_data *sd,int s,int eqindex,int return 1; } +bool pc_isequipped(struct map_session_data *sd, int nameid) +{ + int i, j, index; + + for( i = 0; i < EQI_MAX; i++ ) + { + index = sd->equip_index[i]; + if( index < 0 ) continue; + + if( i == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index ) continue; + if( i == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == index ) continue; + if( i == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == index || sd->equip_index[EQI_HEAD_LOW] == index) ) continue; + + if( !sd->inventory_data[index] ) continue; + + if( sd->inventory_data[index]->nameid == nameid ) + return true; + + for( j = 0; j < sd->inventory_data[index]->slot; j++ ) + if( sd->status.inventory[index].card[j] == nameid ) + return true; + } + + return false; +} + +bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd ) +{ + if( !p1_sd || !p2_sd || !b_sd ) + return false; + + if( b_sd->status.father || b_sd->status.mother || b_sd->adopt_invite ) + return false; // allready adopted baby / in adopt request + + if( !p1_sd->status.partner_id || !p1_sd->status.party_id || p1_sd->status.party_id != b_sd->status.party_id ) + return false; // You need to be married and in party with baby to adopt + + if( p1_sd->status.partner_id != p2_sd->status.char_id || p2_sd->status.partner_id != p1_sd->status.char_id ) + return false; // Not married, wrong married + + if( p2_sd->status.party_id != p1_sd->status.party_id ) + return false; // Both parents need to be in the same party + + // Parents need to have their ring equipped + if( !pc_isequipped(p1_sd, WEDDING_RING_M) && !pc_isequipped(p1_sd, WEDDING_RING_F) ) + return false; + + if( !pc_isequipped(p2_sd, WEDDING_RING_M) && !pc_isequipped(p2_sd, WEDDING_RING_F) ) + return false; + + // Allready adopted a baby + if( p1_sd->status.child || p2_sd->status.child ) { + clif_Adopt_reply(p1_sd, 0); + return false; + } + + // Fathers need at least lvl 70 to adopt + if( p1_sd->status.base_level < 70 || p2_sd->status.base_level < 70 ) { + clif_Adopt_reply(p1_sd, 1); + return false; + } + + if( b_sd->status.partner_id ) { + clif_Adopt_reply(p1_sd, 2); + return false; + } + + return ( b_sd->status.class_ >= JOB_NOVICE && b_sd->status.class_ <= JOB_THIEF ); +} + +/*========================================== + * Adoption Process + *------------------------------------------*/ +bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd) +{ + int job, joblevel; + unsigned int jobexp; + + if( !pc_can_Adopt(p1_sd, p2_sd, b_sd) ) + return false; + + // Preserve current job levels and progress + joblevel = b_sd->status.job_level; + jobexp = b_sd->status.job_exp; + + job = pc_mapid2jobid(b_sd->class_|JOBL_BABY, b_sd->status.sex); + if( job != -1 && !pc_jobchange(b_sd, job, 0) ) + { // Success, proceed to configure parents and baby skills + p1_sd->status.child = b_sd->status.char_id; + p2_sd->status.child = b_sd->status.char_id; + b_sd->status.father = p1_sd->status.char_id; + b_sd->status.mother = p2_sd->status.char_id; + + // Restore progress + b_sd->status.job_level = joblevel; + clif_updatestatus(b_sd, SP_JOBLEVEL); + b_sd->status.job_exp = jobexp; + clif_updatestatus(b_sd, SP_JOBEXP); + + // Baby Skills + pc_skill(b_sd, WE_BABY, 1, 0); + pc_skill(b_sd, WE_CALLPARENT, 1, 0); + + // Parents Skills + pc_skill(p1_sd, WE_CALLBABY, 1, 0); + pc_skill(p1_sd, WE_CALLBABY, 1, 0); + + return true; + } + + return false; // Job Change Fail +} + int pc_isequip(struct map_session_data *sd,int n) { struct item_data *item; @@ -6712,53 +6825,6 @@ int pc_divorce(struct map_session_data *sd) } /*========================================== - * sd - father dstsd - mother jasd - child - *------------------------------------------*/ -int pc_adoption(struct map_session_data *sd,struct map_session_data *dstsd, struct map_session_data *jasd) -{ - int j,level, job; - unsigned int exp; - if (sd == NULL || dstsd == NULL || jasd == NULL || - sd->status.partner_id <= 0 || dstsd->status.partner_id <= 0 || - sd->status.partner_id != dstsd->status.char_id || dstsd->status.partner_id != sd->status.char_id || - sd->status.child > 0 || dstsd->status.child || jasd->status.father > 0 || jasd->status.mother > 0) - return -1; - jasd->status.father = sd->status.char_id; - jasd->status.mother = dstsd->status.char_id; - sd->status.child = jasd->status.char_id; - dstsd->status.child = jasd->status.char_id; - - for (j=0; j < MAX_INVENTORY; j++) { - if(jasd->status.inventory[j].nameid>0 && jasd->status.inventory[j].equip!=0) - pc_unequipitem(jasd, j, 3); - } - - //Preserve level and exp. - level = jasd->status.job_level; - exp = jasd->status.job_exp; - job = jasd->class_|JOBL_BABY; //Preserve current Job by babyfying it. [Skotlex] - job = pc_mapid2jobid(job, jasd->status.sex); - if (job != -1 && pc_jobchange(jasd, job, 0) == 0) - { //Success, and give Junior the Baby skills. [Skotlex] - //Restore job level and experience. - jasd->status.job_level = level; - jasd->status.job_exp = exp; - clif_updatestatus(jasd,SP_JOBLEVEL); - clif_updatestatus(jasd,SP_JOBEXP); - pc_skill(jasd,WE_BABY,1,0); - pc_skill(jasd,WE_CALLPARENT,1,0); - clif_displaymessage(jasd->fd, msg_txt(12)); // Your job has been changed. - //We should also grant the parent skills to the parents [Skotlex] - pc_skill(sd,WE_CALLBABY,1,0); - pc_skill(dstsd,WE_CALLBABY,1,0); - } else { - clif_displaymessage(jasd->fd, msg_txt(155)); // Impossible to change your job. - return -1; - } - return 0; -} - -/*========================================== * sdの相方のmap_session_dataを返す *------------------------------------------*/ struct map_session_data *pc_get_partner(struct map_session_data *sd) diff --git a/src/map/pc.h b/src/map/pc.h index da032deed..7942aab9d 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -190,6 +190,10 @@ int pc_cartitem_amount(struct map_session_data *sd,int idx,int amount); int pc_takeitem(struct map_session_data*,struct flooritem_data*); int pc_dropitem(struct map_session_data*,int,int); +bool pc_isequipped(struct map_session_data *sd, int nameid); +bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd ); +bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd); + int pc_updateweightstatus(struct map_session_data *sd); int pc_autoscript_add(struct s_autoscript *scripts, int max, short rate, short flag, struct script_code *script); @@ -289,7 +293,6 @@ int pc_calc_pvprank_timer(int tid,unsigned int tick,int id,int data); int pc_ismarried(struct map_session_data *sd); int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd); int pc_divorce(struct map_session_data *sd); -int pc_adoption(struct map_session_data *sd,struct map_session_data *dstsd,struct map_session_data *jasd); struct map_session_data *pc_get_partner(struct map_session_data *sd); struct map_session_data *pc_get_father(struct map_session_data *sd); struct map_session_data *pc_get_mother(struct map_session_data *sd); diff --git a/src/map/script.c b/src/map/script.c index 36c29e8d5..438fde722 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11424,32 +11424,6 @@ BUILDIN_FUNC(getrefine) } /*======================================================= - * Allows 2 Parents to adopt a character as a Baby - *-------------------------------------------------------*/ -BUILDIN_FUNC(adopt) -{ - int ret; - - const char *parent1 = script_getstr(st,2); - const char *parent2 = script_getstr(st,3); - const char *child = script_getstr(st,4); - - TBL_PC *p1_sd = map_nick2sd(parent1); - TBL_PC *p2_sd = map_nick2sd(parent2); - TBL_PC *c_sd = map_nick2sd(child); - - if (!p1_sd || !p2_sd || !c_sd || - p1_sd->status.base_level < 70 || - p2_sd->status.base_level < 70) - return 0; - - ret = pc_adoption(p1_sd, p2_sd, c_sd); - script_pushint(st,ret); - - return 0; -} - -/*======================================================= * Day/Night controls *-------------------------------------------------------*/ BUILDIN_FUNC(night) @@ -13310,7 +13284,6 @@ struct script_function buildin_func[] = { BUILDIN_DEF(isequippedcnt,"i*"), // check how many items/cards are being equipped [Celest] BUILDIN_DEF(cardscnt,"i*"), // check how many items/cards are being equipped in the same arm [Lupus] BUILDIN_DEF(getrefine,"*"), // returns the refined number of the current item, or an item with index specified [celest] - BUILDIN_DEF(adopt,"sss"), // allows 2 parents to adopt a child BUILDIN_DEF(night,""), // sets the server to night time BUILDIN_DEF(day,""), // sets the server to day time #ifdef PCRE_SUPPORT diff --git a/src/map/trade.c b/src/map/trade.c index a9f2a2fd5..4371bf6a8 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -49,7 +49,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta } if (!battle_config.invite_request_check) { - if (target_sd->guild_invite > 0 || target_sd->party_invite > 0) { + if (target_sd->guild_invite > 0 || target_sd->party_invite > 0 || target_sd->adopt_invite) { clif_tradestart(sd, 2); return; } |