Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing configurable exp rate #139

Merged
merged 1 commit into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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