mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-12 05:05:24 -05:00
Some more fixing of processing leveling correctly and challenge processing adding the progress to the wrong user.
This commit is contained in:
22
dist/app/Models/User/PlayerData.php
vendored
22
dist/app/Models/User/PlayerData.php
vendored
@@ -142,6 +142,28 @@ public function getCumulativeExperience(): int
|
||||
return $experience;
|
||||
}
|
||||
|
||||
public function addFactionExperience(Faction $faction): PlayerData
|
||||
{
|
||||
if($faction === Faction::Runner) {
|
||||
++$this->runner_faction_experience;
|
||||
|
||||
if($this->runner_faction_level >= static::getRemainingFactionExperience($this->runner_faction_level)) {
|
||||
++$this->runner_faction_level;
|
||||
$this->runner_faction_experience = 0;
|
||||
}
|
||||
}
|
||||
else if($faction === Faction::Hunter) {
|
||||
++$this->hunter_faction_level;
|
||||
|
||||
if($this->hunter_faction_level >= static::getRemainingFactionExperience($this->hunter_faction_level)) {
|
||||
++$this->hunter_faction_level;
|
||||
$this->hunter_faction_experience = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public static function getRemainingFactionExperience(int $level): int
|
||||
{
|
||||
if($level <= 26)
|
||||
|
||||
Reference in New Issue
Block a user