-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGamePlayer.cs
122 lines (107 loc) · 2.9 KB
/
GamePlayer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
using BepInEx;
using Dark_Age_of_Valheim.EpicLoot;
using Dark_Age_of_Valheim.LevelSystem;
using EpicLoot;
using EpicMMOSystem;
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Runtime.Remoting.Messaging;
using UnityEngine;
namespace Dark_Age_of_Valheim;
public partial class GamePlayer
{
/**
*
* @TODO: Split Buffed Stats from Armor and from buffs/pots.
* Used for calculation of stats. E.G. getParameter(Parameter.Strenghth) + buffedStrength will yield actual stats.
*
*/
protected int _buffedStrength = 0;
protected int _buffedAgility = 0;
protected int _buffedIntellect = 0;
protected int _buffedBody = 0;
protected string? _specalization;
public int buffedStrength
{
get { return _buffedStrength; }
set { _buffedStrength = value; }
}
public int buffedAgility
{
get { return _buffedAgility; }
set { _buffedAgility = value; }
}
public int buffedIntellect
{
get { return _buffedIntellect; }
set { _buffedIntellect = value; }
}
public int buffedBody
{
get { return _buffedBody; }
set { _buffedBody = value; }
}
public const string epicMMOPluginKey = "EpicMMOSystem";
public const string middleKey = "LevelSystem";
public Dictionary<Parameter, int> statBuffs = new Dictionary<Parameter, int>();
#region Singlton
private static GamePlayer? _instance;
public static GamePlayer Instance
{
get
{
if (_instance == null)
{
_instance = new GamePlayer();
return _instance;
}
return _instance;
}
}
#endregion
public GamePlayer()
{
this.Init();
}
private void Init()
{
LevelSystemPatch.OnLevelUp += LevelUpAnnouncement;
}
public int getBonusPointsForParameter(Parameter parameter)
{
switch(parameter)
{
case Parameter.Strength:
{
return this.buffedStrength;
}
case Parameter.Intellect:
{
return this.buffedIntellect;
}
case Parameter.Agility:
{
return this.buffedAgility;
}
case Parameter.Body:
{
return this.buffedBody;
}
}
return 0;
}
/*
*
* Maybe every 10 levels? (level%10 == 0)
* Should be able to disable as well.
* Notifies clients that Player has leveled up.
*
*/
public void LevelUpAnnouncement(int level)
{
Player localPlayer = Player.m_localPlayer;
string text = string.Format("Player {0} has reached level {1}",localPlayer.GetPlayerName(), level);
Chat.instance.SendText(Talker.Type.Normal, text);
}
}