| 2462 | -------------------------------------------------------------------------------*/ |
| 2463 | |
| 2464 | bool Entity::increaseSkill(int skill, bool notify) |
| 2465 | { |
| 2466 | Stat* myStats = this->getStats(); |
| 2467 | int player = -1; |
| 2468 | if ( this->behavior == &actPlayer ) |
| 2469 | { |
| 2470 | player = this->skill[2]; |
| 2471 | } |
| 2472 | |
| 2473 | if ( myStats == NULL ) |
| 2474 | { |
| 2475 | return false; |
| 2476 | } |
| 2477 | |
| 2478 | if ( skill == PRO_LEGACY_SWIMMING ) |
| 2479 | { |
| 2480 | if ( !(svFlags & SV_FLAG_HUNGER) ) |
| 2481 | { |
| 2482 | // hunger off and swimming is raised. |
| 2483 | serverUpdatePlayerGameplayStats(player, STATISTICS_HOT_TUB_TIME_MACHINE, 1); |
| 2484 | } |
| 2485 | return true; |
| 2486 | } |
| 2487 | if ( skill >= NUMPROFICIENCIES ) |
| 2488 | { |
| 2489 | return false; |
| 2490 | } |
| 2491 | |
| 2492 | if ( this->behavior == &actPlayer ) |
| 2493 | { |
| 2494 | if ( gameModeManager.currentSession.challengeRun.isActive() |
| 2495 | && gameModeManager.currentSession.challengeRun.eventType == GameModeManager_t::CurrentSession_t::ChallengeRun_t::CHEVENT_NOSKILLS ) |
| 2496 | { |
| 2497 | return false; |
| 2498 | } |
| 2499 | } |
| 2500 | |
| 2501 | bool increased = false; |
| 2502 | |
| 2503 | Uint32 color = makeColorRGB(255, 255, 0); |
| 2504 | if ( myStats->getProficiency(skill) < 100 ) |
| 2505 | { |
| 2506 | myStats->setProficiency(skill, myStats->getProficiency(skill) + 1); |
| 2507 | if ( notify ) |
| 2508 | { |
| 2509 | if ( player >= 0 ) |
| 2510 | { |
| 2511 | messagePlayerColor(player, MESSAGE_SPAM_MISC, color, Language::get(615), getSkillLangEntry(skill)); |
| 2512 | if ( players[player]->isLocalPlayer() ) |
| 2513 | { |
| 2514 | skillUpAnimation[player].addSkillUp(skill, myStats->getProficiency(skill) - 1, 1); |
| 2515 | } |
| 2516 | } |
| 2517 | } |
| 2518 | switch ( myStats->getProficiency(skill) ) |
| 2519 | { |
| 2520 | case 20: |
| 2521 | messagePlayerColor(player, MESSAGE_PROGRESSION, color, Language::get(616), getSkillLangEntry(skill)); |
no test coverage detected