Pārlūkot izejas kodu

Fixed bugreport:5497, LK/RG/PD/RG new mounts are now available again to clients prior to november 2011, items with delayed consumption are no longer available to users in new mount state. Updated setoption to consider pc_cant_mount and remove OPTION_MOUNTING from the opt bundle

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15808 54d463be-8e91-2dee-dedb-b68131a5f0ec
shennetsind 13 gadi atpakaļ
vecāks
revīzija
7f57ab9eee
3 mainītis faili ar 18 papildinājumiem un 7 dzēšanām
  1. 7 6
      src/map/pc.c
  2. 8 0
      src/map/pc.h
  3. 3 1
      src/map/script.c

+ 7 - 6
src/map/pc.c

@@ -4007,6 +4007,10 @@ int pc_useitem(struct map_session_data *sd,int n)
 	// Store information for later use before it is lost (via pc_delitem) [Paradox924X]
 	nameid = sd->inventory_data[n]->nameid;
 
+	/* Items with delayed consume are not meant to work while in mounts except reins of mount(12622) */
+	if( sd->inventory_data[n]->flag.delay_consume && nameid != 12622 && sd->sc.option&OPTION_MOUNTING )
+		return 0;
+
 	//Since most delay-consume items involve using a "skill-type" target cursor,
 	//perform a skill-use check before going through. [Skotlex]
 	//resurrection was picked as testing skill, as a non-offensive, generic skill, it will do.
@@ -4058,14 +4062,11 @@ int pc_useitem(struct map_session_data *sd,int n)
 	//Check if the item is to be consumed immediately [Skotlex]
 	if( sd->inventory_data[n]->flag.delay_consume )
 		clif_useitemack(sd,n,amount,true);
-	else
-	{
-		if( sd->status.inventory[n].expire_time == 0 )
-		{
+	else {
+		if( sd->status.inventory[n].expire_time == 0 ) {
 			clif_useitemack(sd,n,amount-1,true);
 			pc_delitem(sd,n,1,1,0,LOG_TYPE_CONSUME); // Rental Usable Items are not deleted until expiration
-		}
-		else
+		} else
 			clif_useitemack(sd,n,0,false);
 	}
 	if(sd->status.inventory[n].card[0]==CARD0_CREATE &&

+ 8 - 0
src/map/pc.h

@@ -630,6 +630,14 @@ enum e_pc_permission {
 		( ((sd)->class_&MAPID_BASEMASK) == MAPID_SWORDMAN && (sd)->status.class_ != JOB_SWORDMAN )  \
 	)
 
+/**
+ * New Mounts are available to all jobs prior to November 2011
+ **/
+#if PACKETVER <= 20111100
+	#undef pc_cant_newmount
+	#define pc_cant_newmount(sd) 0
+#endif
+
 #define pc_stop_walking(sd, type) unit_stop_walking(&(sd)->bl, type)
 #define pc_stop_attack(sd) unit_stop_attack(&(sd)->bl)
 

+ 3 - 1
src/map/script.c

@@ -7473,6 +7473,8 @@ BUILDIN_FUNC(setoption)
 	if( flag ){// Add option
 		if( option&OPTION_WEDDING && !battle_config.wedding_modifydisplay )
 			option &= ~OPTION_WEDDING;// Do not show the wedding sprites
+		else if ( option&OPTION_MOUNTING && pc_cant_newmount(sd) )
+			option &= ~OPTION_MOUNTING;
 		pc_setoption(sd, sd->sc.option|option);
 	} else// Remove option
 		pc_setoption(sd, sd->sc.option&~option);
@@ -15798,7 +15800,7 @@ BUILDIN_FUNC(setmounting) {
 	TBL_PC* sd;
 	if( (sd = script_rid2sd(st)) == NULL )
 		return 0;
-	if( sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR) )
+	if( sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR) || pc_cant_newmount(sd) )
 		script_pushint(st,0);//can't mount with one of these
 	else {
 		if( sd->sc.option&OPTION_MOUNTING )