From ba1e827b6b4c17c35a163e6b55be8c122de632b8 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 10 Apr 2021 03:00:20 -0300 Subject: Add several convenience functions. Fix some bugs regarding misuse of readparam() --- npc/commands/marry.txt | 68 -------------------------------------------------- 1 file changed, 68 deletions(-) delete mode 100755 npc/commands/marry.txt (limited to 'npc/commands/marry.txt') diff --git a/npc/commands/marry.txt b/npc/commands/marry.txt deleted file mode 100755 index ad2ed5fc..00000000 --- a/npc/commands/marry.txt +++ /dev/null @@ -1,68 +0,0 @@ -- script special-marry NPC32767,{ - .@target_id = getcharid(3, @args$); - if (.@target_id < 1 || !(isloggedin(.@target_id)) || .@target_id == BL_ID) goto L_NotFound; - if (PARTNER || get(PARTNER, .@target_id)) goto L_AlreadyMarried; - if (isin("014-1",29,36,34,39) == 0 && isin("001-1",20,27,22,27) == 0) goto L_NotInArea; - if (distance(BL_ID, .@target_id) != 1) goto L_AwayFromPartner; - if (BaseLevel < WEDDING_MIN_LEVEL || get(BaseLevel, .@target_id) < WEDDING_MIN_LEVEL) goto L_TooYoung; - if (getequipid(equip_shield) != 702 || getequipid(equip_shield, @args$) != 702) goto L_NoRing; - - if (get(@marriage[0], .@target_id) == BL_ID) goto L_Proceed; - - setarray @marriage[0], .@target_id, gettimetick(2); - addtimer (.timeout * 1000), strnpcinfo(0) + "::OnTimeout"; - announce strcharinfo(0) + " is asking " + strcharinfo(0, .@target_id) + " for marriage.", 2; - message strcharinfo(0, .@target_id), "Marriage : ##3##B" + strcharinfo(0) + " wishes to marry you. To accept, write `##1#marry "+strcharinfo(0)+"##3` within the next "+.timeout+" seconds."; - end; - -L_NotFound: - message strcharinfo(0), "Marriage : ##3##BThe target player is either not found or yourself."; - end; - -L_TooYoung: - message strcharinfo(0), "Marriage : ##3##BYou and your partner need to be at least level "+ WEDDING_MIN_LEVEL +"."; - end; - -L_NoRing: - message strcharinfo(0), "Marriage : ##3##BYou and your partner need to have ["+ getitemlink("WeddingRing") +"] equipped."; - end; - -L_AwayFromPartner: - message strcharinfo(0), "Marriage : ##3##BYou and your partner need to be standing next to each other."; - end; - -L_NotInArea: - message strcharinfo(0), "Marriage : ##3##BYou are not standing in a designated marriage area."; - end; - -L_Proceed: - if ((gettimetick(2) - .timeout) > get(@marriage[1], .@target_id)) goto L_TooLate; - PARTNER = CHAR_ID, .@target_id; - if (PARTNER == get(CHAR_ID, .@target_id)) goto L_Success; - PARTNER = 0, .@target_id; - PARTNER = 0; - end; - -L_Success: - announce strcharinfo(0) + " and " + strcharinfo(0, .@target_id) + " are now married.", 2; - end; - -OnTimeout: - goto L_TooLate; - -L_TooLate: - message strcharinfo(0), "Marriage : ##3##BThe proposal expired. Please try again."; - message strcharinfo(0, @marriage[0]), "Marriage : ##3##BThe proposal expired. Please try again."; - @marriage[0] = 0, @marriage[0]; - @marriage[0] = 0; - end; - -L_AlreadyMarried: - message strcharinfo(0), "Marriage : ##3##BYou"+ if_then_else(PARTNER, " are", "r partner is") +" already married."; - end; - -OnInit: - set .timeout, 30; // timeout for proposal - registercmd "#marry", strnpcinfo(0); // we NEED to use a # before `marry` because otherwise manaplus does not strip colors - end; -} -- cgit v1.2.3-70-g09d2