Skip to content

Commit

Permalink
Implementing configurable exp rate
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlackParade committed Mar 23, 2020
1 parent 77536b3 commit 70a94ec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions data/config/server-config-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ rsaExp: '12747337179295870166838611986189126026507945904720545965726999254744592
host: '0.0.0.0'
port: 43594
showWelcome: true
expRate: 1
4 changes: 2 additions & 2 deletions src/world/actor/skills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Actor } from '@server/world/actor/actor';
import { Player } from '@server/world/actor/player/player';
import { dialogueAction } from '@server/world/actor/player/action/dialogue-action';
import { startsWithVowel } from '@server/util/strings';
import { serverConfig } from '@server/game-server';

export enum Skill {
ATTACK,
Expand Down Expand Up @@ -105,7 +106,7 @@ export class Skills {
public addExp(skillId: number, exp: number): void {
const currentExp = this._values[skillId].exp;
const currentLevel = this.getLevelForExp(currentExp);
let finalExp = currentExp + exp;
let finalExp = currentExp + (exp * serverConfig.expRate);
if(finalExp > 200000000) {
finalExp = 200000000;
}
Expand All @@ -120,7 +121,6 @@ export class Skills {

if(currentLevel !== finalLevel) {
this.setLevel(skillId, finalLevel);
// this.actor.playGraphics({ id: 199, delay: 0, height: 125 });

if(this.actor instanceof Player) {
const achievementDetails = skillDetails[skillId];
Expand Down
1 change: 1 addition & 0 deletions src/world/config/server-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface ServerConfig {
host: string;
port: number;
showWelcome: boolean;
expRate: number;
}

export function parseServerConfig(useDefault?: boolean): ServerConfig {
Expand Down

0 comments on commit 70a94ec

Please sign in to comment.