Forráskód Böngészése

Added a new flag SCF_NOFORCEDEND (#6679)

The old hardcoded lists were not in sync and this was a specific list of status changes that could not even be forcibly ended with sc_end. Therefore a new flag is needed. Additionally improved error reporting.

Fixes #6666

Thanks to @eppc0330
Lemongrass3110 3 éve
szülő
commit
11f3d4b100
6 módosított fájl, 90 hozzáadás és 2 törlés
  1. 38 0
      db/pre-re/status.yml
  2. 38 0
      db/re/status.yml
  3. 1 0
      doc/status.txt
  4. 11 2
      src/map/script.cpp
  5. 1 0
      src/map/script_constants.hpp
  6. 1 0
      src/map/status.hpp

+ 38 - 0
db/pre-re/status.yml

@@ -583,6 +583,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Weight90
     Icon: EFST_WEIGHTOVER90
     Flags:
@@ -593,6 +594,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Aspdpotion0
     Icon: EFST_ATTHASTE_POTION1
     CalcFlags:
@@ -1003,6 +1005,7 @@ Body:
       NoBanishingBuster: true
       OverlapFail: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Protectexp
     Icon: EFST_PROTECTEXP
     DurationLookup: WE_BABY
@@ -2815,6 +2818,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Giantgrowth
     Icon: EFST_GIANTGROWTH
     DurationLookup: RK_GIANTGROWTH
@@ -4952,6 +4956,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapIgnoreLevel: true
+      NoForcedEnd: true
   - Status: Spellbook1
     Icon: EFST_SPELLBOOK1
     Flags:
@@ -5080,6 +5085,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Tinder_Breaker
     Icon: EFST_TINDER_BREAKER_POSTDELAY
     DurationLookup: MH_TINDER_BREAKER
@@ -5355,6 +5361,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Angel_Protect
     Icon: EFST_ANGEL_PROTECT
     Flags:
@@ -5484,6 +5491,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Rangeatk
     Icon: EFST_MTF_RANGEATK
     CalcFlags:
@@ -5495,6 +5503,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Matk
     Icon: EFST_MTF_MATK
     CalcFlags:
@@ -5505,6 +5514,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Mleatked
     Icon: EFST_MTF_MLEATKED
     CalcFlags:
@@ -5515,6 +5525,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Cridamage
     Icon: EFST_MTF_CRIDAMAGE
     CalcFlags:
@@ -5525,6 +5536,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Oktoberfest
     States:
       NoAttack: true
@@ -5605,6 +5617,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
     End:
       All_Riding: true
     EndReturn: true
@@ -5647,6 +5660,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Rangeatk2
     Icon: EFST_MTF_RANGEATK2
     CalcFlags:
@@ -5657,6 +5671,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Matk2
     Icon: EFST_MTF_MATK2
     CalcFlags:
@@ -5667,6 +5682,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: 2011rwc_Scroll
     Icon: EFST_2011RWC_SCROLL
     CalcFlags:
@@ -5709,6 +5725,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Msp
     Icon: EFST_MTF_MSP
     CalcFlags:
@@ -5719,6 +5736,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Pumpkin
     Icon: EFST_MTF_PUMPKIN
     Flags:
@@ -5727,6 +5745,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Hitflee
     Icon: EFST_MTF_HITFLEE
     CalcFlags:
@@ -5739,6 +5758,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Vacuum_Extreme_Postdelay
     DurationLookup: SO_VACUUM_EXTREME
     Flags:
@@ -5766,6 +5786,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapIgnoreLevel: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_A
     Icon: EFST_REUSE_LIMIT_A
     Flags:
@@ -5775,6 +5796,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_B
     Icon: EFST_REUSE_LIMIT_B
     Flags:
@@ -5784,6 +5806,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_C
     Icon: EFST_REUSE_LIMIT_C
     Flags:
@@ -5793,6 +5816,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_D
     Icon: EFST_REUSE_LIMIT_D
     Flags:
@@ -5802,6 +5826,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_E
     Icon: EFST_REUSE_LIMIT_E
     Flags:
@@ -5811,6 +5836,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_F
     Icon: EFST_REUSE_LIMIT_F
     Flags:
@@ -5820,6 +5846,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_G
     Icon: EFST_REUSE_LIMIT_G
     Flags:
@@ -5829,6 +5856,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_H
     Icon: EFST_REUSE_LIMIT_H
     Flags:
@@ -5838,6 +5866,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_Mtf
     Icon: EFST_REUSE_LIMIT_MTF
     Flags:
@@ -5847,6 +5876,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_Aspd_Potion
     Icon: EFST_REUSE_LIMIT_ASPD_POTION
     Flags:
@@ -5856,6 +5886,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Millenniumshield
     Icon: EFST_REUSE_MILLENNIUMSHIELD
     Flags:
@@ -5865,6 +5896,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Crushstrike
     Icon: EFST_REUSE_CRUSHSTRIKE
     Flags:
@@ -5874,6 +5906,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Stormblast
     Icon: EFST_REUSE_STORMBLAST
     Flags:
@@ -5883,6 +5916,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: All_Riding_Reuse_Limit
     Icon: EFST_ALL_RIDING_REUSE_LIMIT
     Flags:
@@ -5892,6 +5926,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_Ecl
     Icon: EFST_REUSE_LIMIT_ECL
     Flags:
@@ -5901,6 +5936,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_Recall
     Icon: EFST_REUSE_LIMIT_RECALL
     Flags:
@@ -5910,6 +5946,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Promote_Health_Reserch
     Icon: EFST_PROMOTE_HEALTH_RESERCH
     CalcFlags:
@@ -6004,6 +6041,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Ljosalfar
     Icon: EFST_LJOSALFAR
     Flags:

+ 38 - 0
db/re/status.yml

@@ -596,6 +596,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Weight90
     Icon: EFST_WEIGHTOVER90
     Flags:
@@ -606,6 +607,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Aspdpotion0
     Icon: EFST_ATTHASTE_POTION1
     CalcFlags:
@@ -1017,6 +1019,7 @@ Body:
       NoBanishingBuster: true
       OverlapFail: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Protectexp
     Icon: EFST_PROTECTEXP
     DurationLookup: WE_BABY
@@ -2923,6 +2926,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Giantgrowth
     Icon: EFST_GIANTGROWTH
     DurationLookup: RK_GIANTGROWTH
@@ -5190,6 +5194,7 @@ Body:
       NoClearance: true
       SendVal1: true
       OverlapIgnoreLevel: true
+      NoForcedEnd: true
   - Status: Spellbook1
     Icon: EFST_SPELLBOOK1
     Flags:
@@ -5318,6 +5323,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Tinder_Breaker
     Icon: EFST_TINDER_BREAKER_POSTDELAY
     DurationLookup: MH_TINDER_BREAKER
@@ -5584,6 +5590,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       SendVal1: true
+      NoForcedEnd: true
   - Status: Angel_Protect
     Icon: EFST_ANGEL_PROTECT
     Flags:
@@ -5716,6 +5723,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Rangeatk
     Icon: EFST_MTF_RANGEATK
     CalcFlags:
@@ -5727,6 +5735,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Matk
     Icon: EFST_MTF_MATK
     CalcFlags:
@@ -5737,6 +5746,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Mleatked
     Icon: EFST_MTF_MLEATKED
     CalcFlags:
@@ -5747,6 +5757,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Cridamage
     Icon: EFST_MTF_CRIDAMAGE
     CalcFlags:
@@ -5757,6 +5768,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Oktoberfest
     States:
       NoAttack: true
@@ -5837,6 +5849,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
     End:
       All_Riding: true
     EndReturn: true
@@ -5887,6 +5900,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Rangeatk2
     Icon: EFST_MTF_RANGEATK2
     CalcFlags:
@@ -5897,6 +5911,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Matk2
     Icon: EFST_MTF_MATK2
     CalcFlags:
@@ -5907,6 +5922,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: 2011rwc_Scroll
     Icon: EFST_2011RWC_SCROLL
     CalcFlags:
@@ -5950,6 +5966,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Msp
     Icon: EFST_MTF_MSP
     CalcFlags:
@@ -5960,6 +5977,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Pumpkin
     Icon: EFST_MTF_PUMPKIN
     Flags:
@@ -5968,6 +5986,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Mtf_Hitflee
     Icon: EFST_MTF_HITFLEE
     CalcFlags:
@@ -5980,6 +5999,7 @@ Body:
       NoDispell: true
       NoBanishingBuster: true
       NoClearance: true
+      NoForcedEnd: true
   - Status: Vacuum_Extreme_Postdelay
     DurationLookup: SO_VACUUM_EXTREME
     Flags:
@@ -6007,6 +6027,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapIgnoreLevel: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_A
     Icon: EFST_REUSE_LIMIT_A
     Flags:
@@ -6016,6 +6037,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_B
     Icon: EFST_REUSE_LIMIT_B
     Flags:
@@ -6025,6 +6047,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_C
     Icon: EFST_REUSE_LIMIT_C
     Flags:
@@ -6034,6 +6057,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_D
     Icon: EFST_REUSE_LIMIT_D
     Flags:
@@ -6043,6 +6067,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_E
     Icon: EFST_REUSE_LIMIT_E
     Flags:
@@ -6052,6 +6077,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_F
     Icon: EFST_REUSE_LIMIT_F
     Flags:
@@ -6061,6 +6087,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_G
     Icon: EFST_REUSE_LIMIT_G
     Flags:
@@ -6070,6 +6097,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_H
     Icon: EFST_REUSE_LIMIT_H
     Flags:
@@ -6079,6 +6107,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_Mtf
     Icon: EFST_REUSE_LIMIT_MTF
     Flags:
@@ -6088,6 +6117,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_Aspd_Potion
     Icon: EFST_REUSE_LIMIT_ASPD_POTION
     Flags:
@@ -6097,6 +6127,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Millenniumshield
     Icon: EFST_REUSE_MILLENNIUMSHIELD
     Flags:
@@ -6106,6 +6137,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Crushstrike
     Icon: EFST_REUSE_CRUSHSTRIKE
     Flags:
@@ -6115,6 +6147,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Stormblast
     Icon: EFST_REUSE_STORMBLAST
     Flags:
@@ -6124,6 +6157,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: All_Riding_Reuse_Limit
     Icon: EFST_ALL_RIDING_REUSE_LIMIT
     Flags:
@@ -6133,6 +6167,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_Ecl
     Icon: EFST_REUSE_LIMIT_ECL
     Flags:
@@ -6142,6 +6177,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Reuse_Limit_Recall
     Icon: EFST_REUSE_LIMIT_RECALL
     Flags:
@@ -6151,6 +6187,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       OverlapFail: true
+      NoForcedEnd: true
   - Status: Promote_Health_Reserch
     Icon: EFST_PROMOTE_HEALTH_RESERCH
     CalcFlags:
@@ -6248,6 +6285,7 @@ Body:
       NoBanishingBuster: true
       NoClearance: true
       SendVal1: true
+      NoForcedEnd: true
    # deprecated
    #- Status: Cloud_Kill
   - Status: Ljosalfar

+ 1 - 0
doc/status.txt

@@ -213,6 +213,7 @@ Flags: Various status flags for specific status change events.
 	SendVal3              - Notifies the client of a status change (val3).
 
 	NoClearbuff           - Cannot be removed by 'status_change_clear_buffs()', 'sc_end SC_ALL', 'status_change_clear(3)', etc.
+	NoForcedEnd           - Cannot be removed by sc_end.
 	NoRemoveOnDead        - Cannot be removed when a player dies.
 	NoDispell             - Cannot be removed by SA_DISPELL.
 	NoClearance           - Cannot be removed by AB_CLEARANCE.

+ 11 - 2
src/map/script.cpp

@@ -12009,8 +12009,17 @@ BUILDIN_FUNC(sc_end)
 		if (sce == nullptr)
 			return SCRIPT_CMD_SUCCESS;
 
-		if (status_db.hasSCF(sc, SCF_NOCLEARBUFF))
-			return SCRIPT_CMD_SUCCESS;
+		std::shared_ptr<s_status_change_db> sc_db = status_db.find( type );
+
+		if( sc_db == nullptr ){
+			ShowError( "buildin_sc_end: Unknown status change %d.\n", type );
+			return SCRIPT_CMD_FAILURE;
+		}
+
+		if( sc_db->flag[SCF_NOCLEARBUFF] && sc_db->flag[SCF_NOFORCEDEND] ){
+			ShowError( "buildin_sc_end: Status %d cannot be cleared.\n", type );
+			return SCRIPT_CMD_FAILURE;
+		}
 
 		//This should help status_change_end force disabling the SC in case it has no limit.
 		sce->val1 = sce->val2 = sce->val3 = sce->val4 = 0;

+ 1 - 0
src/map/script_constants.hpp

@@ -8895,6 +8895,7 @@
 	export_constant(SCF_SENDVAL1);
 	export_constant(SCF_SENDVAL2);
 	export_constant(SCF_SENDVAL3);
+	export_constant(SCF_NOFORCEDEND);
 
 	#undef export_constant
 	#undef export_constant2

+ 1 - 0
src/map/status.hpp

@@ -2852,6 +2852,7 @@ enum e_status_change_flag : uint16 {
 	SCF_SENDVAL1,
 	SCF_SENDVAL2,
 	SCF_SENDVAL3,
+	SCF_NOFORCEDEND,
 	SCF_MAX
 };