File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Intersect.Server.Core/Entities Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1358,6 +1358,18 @@ public void AddLevels(int levels = 1, bool resetExperience = true)
13581358
13591359 public void GiveExperience ( long amount )
13601360 {
1361+ // ReSharper disable once ConvertIfStatementToSwitchStatement
1362+ if ( amount == 0 )
1363+ {
1364+ return ;
1365+ }
1366+
1367+ if ( amount < 0 )
1368+ {
1369+ TakeExperience ( - amount ) ;
1370+ return ;
1371+ }
1372+
13611373 Exp += ( int ) Math . Round ( amount + ( amount * ( GetEquipmentBonusEffect ( ItemEffect . EXP ) / 100f ) ) ) ;
13621374 if ( Exp < 0 )
13631375 {
@@ -1372,6 +1384,18 @@ public void GiveExperience(long amount)
13721384
13731385 public void TakeExperience ( long amount , bool enableLosingLevels = false , bool force = false )
13741386 {
1387+ // ReSharper disable once ConvertIfStatementToSwitchStatement
1388+ if ( amount == 0 )
1389+ {
1390+ return ;
1391+ }
1392+
1393+ if ( amount < 0 )
1394+ {
1395+ GiveExperience ( - amount ) ;
1396+ return ;
1397+ }
1398+
13751399 if ( ! force && Options . Instance . Map . DisableExpLossInArenaMaps && Map . ZoneType == MapZone . Arena )
13761400 {
13771401 return ;
You can’t perform that action at this time.
0 commit comments