summaryrefslogtreecommitdiff
path: root/src/map/chrif.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-04-27 13:33:10 -0300
committershennetsind <ind@henn.et>2013-04-27 13:33:10 -0300
commit0f4a50d13538c3e5d3ca4d3822f92217c8da0479 (patch)
tree2daf0a99ca0104d6a7fa95637e0377e7a9a0d6ed /src/map/chrif.c
parent1f6360f2e157d8eb742a32baed4c5ec7c68c0ef1 (diff)
downloadhercules-0f4a50d13538c3e5d3ca4d3822f92217c8da0479.tar.gz
hercules-0f4a50d13538c3e5d3ca4d3822f92217c8da0479.tar.bz2
hercules-0f4a50d13538c3e5d3ca4d3822f92217c8da0479.tar.xz
hercules-0f4a50d13538c3e5d3ca4d3822f92217c8da0479.zip
Skill ID Processing Overhaul
http://hercules.ws/board/topic/512-skill-id-processing-overhaul/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/chrif.c')
-rw-r--r--src/map/chrif.c54
1 files changed, 38 insertions, 16 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c
index b816ca4b5..e2ce37e28 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -68,7 +68,7 @@ static const int packet_len_table[0x3d] = { // U - used, F - free
//2b08: Outgoing, chrif_searchcharid -> '...'
//2b09: Incoming, map_addchariddb -> 'Adds a name to the nick db'
//2b0a: Incoming/Outgoing, socket_datasync()
-//2b0b: FREE
+//2b0b: Outgoing, update charserv skillid2idx
//2b0c: Outgoing, chrif_changeemail -> 'change mail address ...'
//2b0d: Incoming, chrif_changedsex -> 'Change sex of acc XY'
//2b0e: Outgoing, chrif_char_ask_name -> 'Do some operations (change sex, ban / unban etc)'
@@ -470,6 +470,7 @@ int chrif_connectack(int fd) {
}
socket_datasync(fd, true);
+ chrif_skillid2idx(fd);
return 0;
}
@@ -882,21 +883,23 @@ int chrif_changedsex(int fd) {
// reset skill of some job
if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER) {
- int i;
+ int i, idx = 0;
// remove specifical skills of Bard classes
for(i = 315; i <= 322; i++) {
- if (sd->status.skill[i].id > 0 && sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) {
- sd->status.skill_point += sd->status.skill[i].lv;
- sd->status.skill[i].id = 0;
- sd->status.skill[i].lv = 0;
+ idx = skill->get_index(i);
+ if (sd->status.skill[idx].id > 0 && sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) {
+ sd->status.skill_point += sd->status.skill[idx].lv;
+ sd->status.skill[idx].id = 0;
+ sd->status.skill[idx].lv = 0;
}
}
// remove specifical skills of Dancer classes
for(i = 323; i <= 330; i++) {
- if (sd->status.skill[i].id > 0 && sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) {
- sd->status.skill_point += sd->status.skill[i].lv;
- sd->status.skill[i].id = 0;
- sd->status.skill[i].lv = 0;
+ idx = skill->get_index(i);
+ if (sd->status.skill[idx].id > 0 && sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) {
+ sd->status.skill_point += sd->status.skill[idx].lv;
+ sd->status.skill[idx].id = 0;
+ sd->status.skill[idx].lv = 0;
}
}
clif->updatestatus(sd, SP_SKILLPOINT);
@@ -963,20 +966,21 @@ int chrif_divorceack(int char_id, int partner_id) {
*------------------------------------------*/
int chrif_deadopt(int father_id, int mother_id, int child_id) {
struct map_session_data* sd;
+ int idx = skill->get_index(WE_CALLBABY);
if( father_id && ( sd = map_charid2sd(father_id) ) != NULL && sd->status.child == child_id ) {
sd->status.child = 0;
- sd->status.skill[WE_CALLBABY].id = 0;
- sd->status.skill[WE_CALLBABY].lv = 0;
- sd->status.skill[WE_CALLBABY].flag = 0;
+ sd->status.skill[idx].id = 0;
+ sd->status.skill[idx].lv = 0;
+ sd->status.skill[idx].flag = 0;
clif->deleteskill(sd,WE_CALLBABY);
}
if( mother_id && ( sd = map_charid2sd(mother_id) ) != NULL && sd->status.child == child_id ) {
sd->status.child = 0;
- sd->status.skill[WE_CALLBABY].id = 0;
- sd->status.skill[WE_CALLBABY].lv = 0;
- sd->status.skill[WE_CALLBABY].flag = 0;
+ sd->status.skill[idx].id = 0;
+ sd->status.skill[idx].lv = 0;
+ sd->status.skill[idx].flag = 0;
clif->deleteskill(sd,WE_CALLBABY);
}
@@ -1370,6 +1374,24 @@ void chrif_keepalive(int fd) {
void chrif_keepalive_ack(int fd) {
session[fd]->flag.ping = 0;/* reset ping state, we received a packet */
}
+void chrif_skillid2idx(int fd) {
+ int i, count = 0;
+
+ if( fd == 0 ) fd = char_fd;
+
+ WFIFOHEAD(fd,4 + (MAX_SKILL * 4));
+ WFIFOW(fd,0) = 0x2b0b;
+ for(i = 0; i < MAX_SKILL; i++) {
+ if( skill_db[i].nameid ) {
+ WFIFOW(fd, 4 + (count*4)) = skill_db[i].nameid;
+ WFIFOW(fd, 6 + (count*4)) = i;
+ count++;
+ }
+ }
+ WFIFOW(fd,2) = 4 + (count * 4);
+ WFIFOSET(fd,4 + (count * 4));
+
+}
/*==========================================
*
*------------------------------------------*/