Skip to content

Commit

Permalink
3rd Class Effects Update
Browse files Browse the repository at this point in the history
http://hercules.ws/board/topic/561-3rd-class-effects-update/
Signed-off-by: shennetsind <ind@henn.et>
  • Loading branch information
shennetsind committed May 5, 2013
1 parent 3eb517a commit 8cc9012
Show file tree
Hide file tree
Showing 8 changed files with 192 additions and 83 deletions.
70 changes: 20 additions & 50 deletions src/map/clif.c
Expand Up @@ -1354,18 +1354,13 @@ int clif_spawn(struct block_list *bl)
clif->specialeffect(bl,421,AREA);
if( sd->bg_id && map[sd->bl.m].flag.battleground )
clif->sendbgemblem_area(sd);
if( sd->sc.data[SC_ALL_RIDING] ) {
//New Mounts are not complaint to the original method, so we gotta tell this guy that he is mounting.
clif->sc_notick(&sd->bl,SI_ALL_RIDING,2,1,0,0);
for( i = 0; i < sd->sc_display_count; i++ ) {
clif->sc_load(&sd->bl, sd->bl.id,AREA,StatusIconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3);
}
for(i = 1; i < 5; i++){
if( sd->talisman[i] > 0 )
clif->talisman(sd, i);
}
#ifdef NEW_CARTS
if( sd->sc.data[SC_PUSH_CART] )
clif->sc_notick(&sd->bl, SI_ON_PUSH_CART, 2, sd->sc.data[SC_PUSH_CART]->val1, 0, 0);
#endif
if (sd->status.robe)
clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA);
}
Expand Down Expand Up @@ -4306,14 +4301,9 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds
if( dstsd->talisman[i] > 0 )
clif->talisman_single(sd->fd, dstsd, i);
}
if( dstsd->sc.data[SC_ALL_RIDING] ) {
//New Mounts are not complaint to the original method, so we gotta tell this guy that I'm mounting.
clif->sc_single(sd->fd,dstsd->bl.id,SI_ALL_RIDING,2,1,0,0);
for( i = 0; i < dstsd->sc_display_count; i++ ) {
clif->sc_load(&sd->bl,dstsd->bl.id,SELF,StatusIconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3);
}
#ifdef NEW_CARTS
if( dstsd->sc.data[SC_PUSH_CART] )
clif->sc_single(sd->fd, dstsd->bl.id, SI_ON_PUSH_CART, 2, dstsd->sc.data[SC_PUSH_CART]->val1, 0, 0);
#endif
if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || //Party-mate, or hpdisp setting.
(sd->bg_id && sd->bg_id == dstsd->bg_id) || //BattleGround
pc_has_permission(sd, PC_PERM_VIEW_HPMETER)
Expand Down Expand Up @@ -16455,40 +16445,6 @@ int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uin
return 1;

}
/**
* Sends a new status without a tick (currently used by the new mounts)
**/
int clif_status_load_notick(struct block_list *bl,int type,int flag,int val1, int val2, int val3) {
unsigned char buf[32];

nullpo_ret(bl);

WBUFW(buf,0)=0x043f;
WBUFW(buf,2)=type;
WBUFL(buf,4)=bl->id;
WBUFB(buf,8)=flag;
WBUFL(buf,9) = 0;
WBUFL(buf,13) = val1;
WBUFL(buf,17) = val2;
WBUFL(buf,21) = val3;

clif->send(buf,packet_len(0x043f),bl,AREA);
return 0;
}
//Notifies FD of ID's type
int clif_status_load_single(int fd, int id,int type,int flag,int val1, int val2, int val3) {
WFIFOHEAD(fd, packet_len(0x043f));
WFIFOW(fd,0)=0x043f;
WFIFOW(fd,2)=type;
WFIFOL(fd,4)=id;
WFIFOB(fd,8)=flag;
WFIFOL(fd,9) = 0;
WFIFOL(fd,13) = val1;
WFIFOL(fd,17) = val2;
WFIFOL(fd,21) = val3;
WFIFOSET(fd, packet_len(0x043f));
return 0;
}
// msgstringtable.txt
// 0x291 <line>.W
void clif_msgtable(int fd, int line) {
Expand Down Expand Up @@ -16818,6 +16774,21 @@ void clif_maptypeproperty2(struct block_list *bl,enum send_target t) {
#endif
}

void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) {
struct packet_status_change2 p;

p.PacketType = status_change2Type;
p.index = type;
p.AID = tid;
p.state = 1;
p.Left = -1;// officially its 9999 but -1 is a explicit "no-duration" which behaves best [Ind/Hercules]
p.val1 = val1;
p.val2 = val2;
p.val3 = val3;

clif->send(&p,sizeof(p), bl, target);
}

void clif_partytickack(struct map_session_data* sd, bool flag) {

WFIFOHEAD(sd->fd, packet_len(0x2c9));
Expand Down Expand Up @@ -17227,8 +17198,7 @@ void clif_defaults(void) {
clif->poison_list = clif_poison_list;
clif->autoshadowspell_list = clif_autoshadowspell_list;
clif->skill_itemlistwindow = clif_skill_itemlistwindow;
clif->sc_notick = clif_status_load_notick;
clif->sc_single = clif_status_load_single;
clif->sc_load = clif_status_change2;
clif->initialstatus = clif_initialstatus;
/* player-unit-specific-related */
clif->updatestatus = clif_updatestatus;
Expand Down
3 changes: 1 addition & 2 deletions src/map/clif.h
Expand Up @@ -596,8 +596,7 @@ struct clif_interface {
int (*poison_list) (struct map_session_data *sd, uint16 skill_lv);
int (*autoshadowspell_list) (struct map_session_data *sd);
int (*skill_itemlistwindow) ( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv );
int (*sc_notick) (struct block_list *bl,int type,int flag,int val1, int val2, int val3);
int (*sc_single) (int fd, int id,int type,int flag,int val1, int val2, int val3);
void (*sc_load) (struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3);
void (*initialstatus) (struct map_session_data *sd);
/* player-unit-specific-related */
void (*updatestatus) (struct map_session_data *sd,int type);
Expand Down
12 changes: 12 additions & 0 deletions src/map/packets_struct.h
Expand Up @@ -50,6 +50,7 @@ enum packet_headers {
#else
status_changeType = sc_notickType,/* 0x196 */
#endif
status_change2Type = 0x43f,
#if PACKETVER < 4
spawn_unitType = 0x79,
#elif PACKETVER < 7
Expand Down Expand Up @@ -352,6 +353,17 @@ struct packet_status_change {
#endif
} __attribute__((packed));

struct packet_status_change2 {
short PacketType;
short index;
unsigned int AID;
unsigned char state;
unsigned int Left;
int val1;
int val2;
int val3;
} __attribute__((packed));

struct packet_maptypeproperty2 {
short PacketType;
short type;
Expand Down
23 changes: 13 additions & 10 deletions src/map/pc.c
Expand Up @@ -1096,7 +1096,11 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
* Check if player have any item cooldowns on
**/
pc_itemcd_do(sd,true);


/* [Ind/Hercules] */
sd->sc_display = NULL;
sd->sc_display_count = 0;

// Request all registries (auth is considered completed whence they arrive)
intif_request_registry(sd,7);
return true;
Expand Down Expand Up @@ -1572,16 +1576,11 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd)
pc_setglobalreg (sd, "jobchange_level", sd->change_level_2nd);
}

if (skill_point < novice_skills + (sd->change_level_2nd - 1))
{
if (skill_point < novice_skills + (sd->change_level_2nd - 1)) {
c &= MAPID_BASEMASK;
}
// limit 3rd class to 2nd class/trans job levels
else if(sd->class_&JOBL_THIRD)
{
} else if(sd->class_&JOBL_THIRD) { // limit 3rd class to 2nd class/trans job levels
// regenerate change_level_3rd
if (!sd->change_level_3rd)
{
if (!sd->change_level_3rd) {
sd->change_level_3rd = 1 + skill_point + sd->status.skill_point
- (sd->status.job_level - 1)
- (sd->change_level_2nd - 1)
Expand Down Expand Up @@ -7718,7 +7717,7 @@ int pc_setcart(struct map_session_data *sd,int type) {
clif->cartlist(sd);
clif->updatestatus(sd, SP_CARTINFO);
sc_start(&sd->bl, SC_PUSH_CART, 100, type, 0);
clif->sc_notick(&sd->bl, SI_ON_PUSH_CART, 2 , type, 0, 0);
clif->sc_load(&sd->bl, sd->bl.id, AREA, SI_ON_PUSH_CART, type, 0, 0);
if( sd->sc.data[SC_PUSH_CART] )/* forcefully update */
sd->sc.data[SC_PUSH_CART]->val1 = type;
break;
Expand Down Expand Up @@ -9822,6 +9821,8 @@ void do_final_pc(void) {
db_destroy(itemcd_db);

do_final_pc_groups();

ers_destroy(pc_sc_display_ers);
return;
}

Expand Down Expand Up @@ -9859,6 +9860,8 @@ int do_init_pc(void) {
}

do_init_pc_groups();

pc_sc_display_ers = ers_new(sizeof(struct sc_display_entry), "pc.c:pc_sc_display_ers", ERS_OPT_NONE);

return 0;
}
7 changes: 7 additions & 0 deletions src/map/pc.h
Expand Up @@ -6,6 +6,7 @@
#define _PC_H_

#include "../common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus
#include "../common/ers.h"
#include "../common/timer.h" // INVALID_TIMER
#include "atcommand.h" // AtCommandType
#include "battle.h" // battle_config
Expand Down Expand Up @@ -513,12 +514,18 @@ struct map_session_data {
unsigned char fontcolor;
unsigned int hchsysch_tick;

/* [Ind/Hercules] */
struct sc_display_entry **sc_display;
unsigned char sc_display_count;

// temporary debugging of bug #3504
const char* delunit_prevfile;
int delunit_prevline;

};

struct eri *pc_sc_display_ers;

//Update this max as necessary. 55 is the value needed for Super Baby currently
//Raised to 84 since Expanded Super Novice needs it.
#define MAX_SKILL_TREE 84
Expand Down

0 comments on commit 8cc9012

Please sign in to comment.