summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiyoshi Kyokai <kiyoshi.kyokai@gmail.com>2005-02-20 08:49:16 +0000
committerKiyoshi Kyokai <kiyoshi.kyokai@gmail.com>2005-02-20 08:49:16 +0000
commit3df76a3104320d7b15e5596cd0511be61c225c15 (patch)
treed7a09d61e7da50174fc6f2fcf0a8e9de8752c151
parent4be5313a359b326f80ee6e5903123c2bc298a8e6 (diff)
downloadmana-3df76a3104320d7b15e5596cd0511be61c225c15.tar.gz
mana-3df76a3104320d7b15e5596cd0511be61c225c15.tar.bz2
mana-3df76a3104320d7b15e5596cd0511be61c225c15.tar.xz
mana-3df76a3104320d7b15e5596cd0511be61c225c15.zip
added skill functionality
-rw-r--r--src/game.cpp5
-rw-r--r--src/main.cpp32
-rw-r--r--src/main.h13
3 files changed, 45 insertions, 5 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 4db888f8..82842504 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -690,7 +690,6 @@ void do_parse() {
break;
case 0x000c:
char_info->skill_point = RFIFOW(4);
- skillDialog->setPoints(char_info->skill_point);
break;
case 0x0037:
char_info->job_lv = RFIFOW(4);
@@ -910,7 +909,7 @@ void do_parse() {
int n_skills = (len - 4) / 37;
for (int k = 0; k < n_skills; k++)
{
- if (RFIFOW(4 + k * 37 + 6) != 0 ||
+ /*if (RFIFOW(4 + k * 37 + 6) != 0 ||
RFIFOB(4 + k * 37 + 36)!=0)
{
int skillId = RFIFOW(4 + k * 37);
@@ -925,7 +924,7 @@ void do_parse() {
RFIFOW(4 + k * 37 + 6),
RFIFOW(4 + k * 37 + 8));
}
- }
+ }*/
}
} break;
// MVP experience
diff --git a/src/main.cpp b/src/main.cpp
index 256b2943..4163b239 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -386,3 +386,35 @@ int main(int argc, char *argv[])
PHYSFS_deinit();
return 0;
}
+
+// GetSkill Function
+// Retrieves the level of the skill for the ID value given.
+// This function also increases the XP of the skill by the given parameter.
+// Call n_base to return the actual value, regardless of equipment modifiers.
+// ---by Kyokai
+int PLAYER_INFO::GetSkill(int n_ID, int n_XP, int n_base)
+{
+ if(n_ID>N_SKILLS||n_ID<0) // out of cheese error, abort function
+ return 0;
+ // 1. raise the exp value
+ m_Skill[n_ID].exp+=(n_XP*m_Skill[n_ID].mod);
+
+ // 2. Check for level up
+ if(m_Skill[n_ID].exp >= 20 * ((m_Skill[n_ID].level)^(6/5)))
+ {
+ m_Skill[n_ID].level += 1;
+ m_Skill[n_ID].exp = 0;
+ // TO DO: send the user a message that tells him his
+ // skill just leveled up!
+ }
+
+ // 3. getting the return value
+ int r = m_Skill[n_ID].level;
+ if(n_base)
+ {
+ // TO DO: alter values based on equipment bonuses
+ }
+
+ return r; // return the value
+}
+
diff --git a/src/main.h b/src/main.h
index 578b14e7..3b02a45c 100644
--- a/src/main.h
+++ b/src/main.h
@@ -29,6 +29,7 @@
#include "configuration.h"
#include "graphic/spriteset.h"
#include "resources/image.h"
+#include "gui/skill.h"
#include "log.h"
#include "game.h"
#include "net/protocol.h"
@@ -58,6 +59,8 @@
#define LEN_USERNAME 25
#define LEN_PASSWORD 25
+#define N_SKILLS 100 // skill count constant value
+#define XP_CONSTANT 1.2 // the exponent which determines skill exp curve
typedef struct {
int address;
@@ -65,7 +68,7 @@ typedef struct {
char name[20];
short online_users;
} SERVER_INFO;
-
+
typedef struct {
int id;
char name[24];
@@ -74,9 +77,15 @@ typedef struct {
int xp, xpForNextLevel, gp, job_xp, jobXpForNextLevel, job_lv;
short statp, skill_point, hair_color, hair_style;
char STR, AGI, VIT, INT, DEX, LUK;
- short weapon;
+ short weapon;
+ // skill list declaration
+ std::vector<SKILL> m_Skill; // array of N_SKILLS skills
+ // gets the requested skills level from char_info
+ int GetSkill(int n_ID, int n_XP=2, int n_base = false); // implemented in the body (main.cpp)
} PLAYER_INFO;
+
+
extern Image *login_wallpaper;
extern Spriteset *hairset, *playerset;
extern Graphics* graphics;