parent
6d2ef66bbb
commit
827517f8cf
469
src/map/clif.cpp
469
src/map/clif.cpp
@ -7243,56 +7243,33 @@ void clif_item_identified(map_session_data *sd,int idx,int flag)
|
||||
|
||||
/// Presents a list of items that can be repaired.
|
||||
/// 01fc <packet len>.W { <index>.W <name id>.W <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }* (ZC_REPAIRITEMLIST)
|
||||
void clif_item_repair_list( map_session_data *sd,map_session_data *dstsd, int lv ){
|
||||
// TODO: Change sd to reference
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
void clif_item_repair_list( map_session_data& sd, map_session_data& dstsd, uint16 lv ){
|
||||
PACKET_ZC_REPAIRITEMLIST* p = (PACKET_ZC_REPAIRITEMLIST*)packet_buffer;
|
||||
|
||||
// TODO: Change dstsd to reference
|
||||
if( dstsd == nullptr ){
|
||||
return;
|
||||
}
|
||||
p->packetType = HEADER_ZC_REPAIRITEMLIST;
|
||||
p->packetLength = sizeof( *p );
|
||||
|
||||
int fd = sd->fd;
|
||||
size_t c = 0;
|
||||
|
||||
if( !session_isActive( fd ) ){
|
||||
return;
|
||||
}
|
||||
|
||||
int len = MAX_INVENTORY * sizeof( struct REPAIRITEM_INFO ) + sizeof( struct PACKET_ZC_REPAIRITEMLIST );
|
||||
|
||||
// Preallocate the maximum size
|
||||
WFIFOHEAD( fd, len );
|
||||
|
||||
struct PACKET_ZC_REPAIRITEMLIST *p = (struct PACKET_ZC_REPAIRITEMLIST *)WFIFOP( fd, 0 );
|
||||
|
||||
int c = 0;
|
||||
|
||||
for( int i = 0; i < MAX_INVENTORY; i++ ){
|
||||
if( dstsd->inventory.u.items_inventory[i].nameid > 0 && dstsd->inventory.u.items_inventory[i].attribute != 0 && !itemdb_ishatched_egg( &dstsd->inventory.u.items_inventory[i] ) ){ // && skill_can_repair(sd,nameid)){
|
||||
p->items[c].index = i;
|
||||
p->items[c].itemId = client_nameid( dstsd->inventory.u.items_inventory[i].nameid );
|
||||
p->items[c].refine = dstsd->inventory.u.items_inventory[i].refine;
|
||||
clif_addcards( &p->items[c].slot, &dstsd->inventory.u.items_inventory[i] );
|
||||
for( size_t i = 0; i < MAX_INVENTORY; i++ ){
|
||||
if( dstsd.inventory.u.items_inventory[i].nameid > 0 && dstsd.inventory.u.items_inventory[i].attribute != 0 && !itemdb_ishatched_egg( &dstsd.inventory.u.items_inventory[i] ) ){ // && skill_can_repair(sd,nameid)){
|
||||
p->items[c].index = static_cast<decltype( p->items[0].index )>( i );
|
||||
p->items[c].itemId = client_nameid( dstsd.inventory.u.items_inventory[i].nameid );
|
||||
p->items[c].refine = dstsd.inventory.u.items_inventory[i].refine;
|
||||
clif_addcards( &p->items[c].slot, &dstsd.inventory.u.items_inventory[i] );
|
||||
p->packetLength += sizeof( p->items[0] );
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
if( c > 0 ){
|
||||
p->packetType = HEADER_ZC_REPAIRITEMLIST;
|
||||
clif_send( p, p->packetLength, &sd.bl, SELF );
|
||||
|
||||
// Recalculate real length
|
||||
len = c * sizeof( struct REPAIRITEM_INFO ) + sizeof( struct PACKET_ZC_REPAIRITEMLIST );
|
||||
p->packetLength = len;
|
||||
|
||||
WFIFOSET( fd, len );
|
||||
|
||||
sd->menuskill_id = BS_REPAIRWEAPON;
|
||||
sd->menuskill_val = dstsd->bl.id;
|
||||
sd->menuskill_val2 = lv;
|
||||
sd.menuskill_id = BS_REPAIRWEAPON;
|
||||
sd.menuskill_val = dstsd.bl.id;
|
||||
sd.menuskill_val2 = lv;
|
||||
}else{
|
||||
clif_skill_fail( *sd, sd->ud.skill_id );
|
||||
clif_skill_fail( sd, sd.ud.skill_id );
|
||||
}
|
||||
}
|
||||
|
||||
@ -11750,114 +11727,108 @@ void clif_parse_HowManyConnections(int fd, map_session_data *sd)
|
||||
clif_user_count(sd, map_getusers());
|
||||
}
|
||||
|
||||
void clif_parse_ActionRequest_sub(map_session_data *sd, int action_type, int target_id, t_tick tick)
|
||||
{
|
||||
// TODO: Change sd to reference
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
|
||||
if (pc_isdead(sd)) {
|
||||
clif_clearunit_area(&sd->bl, CLR_DEAD);
|
||||
void clif_parse_ActionRequest_sub( map_session_data& sd, int action_type, int target_id, t_tick tick ){
|
||||
if (pc_isdead(&sd)) {
|
||||
clif_clearunit_area(&sd.bl, CLR_DEAD);
|
||||
return;
|
||||
}
|
||||
|
||||
// Statuses that don't let the player sit / stand / talk with NPCs (targeted)
|
||||
if (action_type != 0x00 && action_type != 0x07) {
|
||||
if (sd->sc.cant.interact)
|
||||
if (sd.sc.cant.interact)
|
||||
return;
|
||||
pc_stop_walking(sd, 1);
|
||||
pc_stop_walking(&sd, 1);
|
||||
}
|
||||
pc_stop_attack(sd);
|
||||
pc_stop_attack(&sd);
|
||||
|
||||
if(target_id<0 && -target_id == sd->bl.id) // for disguises [Valaris]
|
||||
target_id = sd->bl.id;
|
||||
if(target_id<0 && -target_id == sd.bl.id) // for disguises [Valaris]
|
||||
target_id = sd.bl.id;
|
||||
|
||||
switch(action_type)
|
||||
{
|
||||
case 0x00: // once attack
|
||||
case 0x07: // continuous attack
|
||||
|
||||
if( pc_cant_act(sd) )
|
||||
if( pc_cant_act(&sd) )
|
||||
return;
|
||||
|
||||
if (!battle_config.sdelay_attack_enable && pc_checkskill(sd, SA_FREECAST) <= 0) {
|
||||
if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) {
|
||||
clif_skill_fail( *sd, 1, USESKILL_FAIL_SKILLINTERVAL );
|
||||
if (!battle_config.sdelay_attack_enable && pc_checkskill(&sd, SA_FREECAST) <= 0) {
|
||||
if (DIFF_TICK(tick, sd.ud.canact_tick) < 0) {
|
||||
clif_skill_fail( sd, 1, USESKILL_FAIL_SKILLINTERVAL );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pc_delinvincibletimer(sd);
|
||||
pc_delinvincibletimer(&sd);
|
||||
if (battle_config.idletime_option&IDLE_ATTACK)
|
||||
sd->idletime = last_tick;
|
||||
if (battle_config.hom_idle_no_share && sd->hd && battle_config.idletime_hom_option&IDLE_ATTACK)
|
||||
sd->idletime_hom = last_tick;
|
||||
if (battle_config.mer_idle_no_share && sd->md && battle_config.idletime_mer_option&IDLE_ATTACK)
|
||||
sd->idletime_mer = last_tick;
|
||||
unit_attack(&sd->bl, target_id, action_type != 0);
|
||||
sd.idletime = last_tick;
|
||||
if (battle_config.hom_idle_no_share && sd.hd && battle_config.idletime_hom_option&IDLE_ATTACK)
|
||||
sd.idletime_hom = last_tick;
|
||||
if (battle_config.mer_idle_no_share && sd.md && battle_config.idletime_mer_option&IDLE_ATTACK)
|
||||
sd.idletime_mer = last_tick;
|
||||
unit_attack(&sd.bl, target_id, action_type != 0);
|
||||
break;
|
||||
case 0x02: // sitdown
|
||||
if (battle_config.basic_skill_check && pc_checkskill(sd, NV_BASIC) < 3 && pc_checkskill(sd, SU_BASIC_SKILL) < 1) {
|
||||
clif_skill_fail( *sd, 1, USESKILL_FAIL_LEVEL, 2 );
|
||||
if (battle_config.basic_skill_check && pc_checkskill(&sd, NV_BASIC) < 3 && pc_checkskill(&sd, SU_BASIC_SKILL) < 1) {
|
||||
clif_skill_fail( sd, 1, USESKILL_FAIL_LEVEL, 2 );
|
||||
break;
|
||||
}
|
||||
|
||||
if(pc_issit(sd)) {
|
||||
if(pc_issit(&sd)) {
|
||||
//Bugged client? Just refresh them.
|
||||
clif_sitting(&sd->bl);
|
||||
clif_sitting(&sd.bl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sd->ud.skilltimer != INVALID_TIMER || (sd->sc.opt1 && sd->sc.opt1 != OPT1_STONEWAIT && sd->sc.opt1 != OPT1_BURNING))
|
||||
if (sd.ud.skilltimer != INVALID_TIMER || (sd.sc.opt1 && sd.sc.opt1 != OPT1_STONEWAIT && sd.sc.opt1 != OPT1_BURNING))
|
||||
break;
|
||||
|
||||
if (sd->sc.count && (
|
||||
sd->sc.getSCE(SC_DANCING) ||
|
||||
(sd->sc.getSCE(SC_GRAVITATION) && sd->sc.getSCE(SC_GRAVITATION)->val3 == BCT_SELF)
|
||||
if (sd.sc.count && (
|
||||
sd.sc.getSCE(SC_DANCING) ||
|
||||
(sd.sc.getSCE(SC_GRAVITATION) && sd.sc.getSCE(SC_GRAVITATION)->val3 == BCT_SELF)
|
||||
)) //No sitting during these states either.
|
||||
break;
|
||||
|
||||
if (sd->state.block_action & PCBLOCK_SITSTAND) {
|
||||
clif_displaymessage(sd->fd, msg_txt(sd,794)); // This action is currently blocked.
|
||||
if (sd.state.block_action & PCBLOCK_SITSTAND) {
|
||||
clif_displaymessage(sd.fd, msg_txt(&sd,794)); // This action is currently blocked.
|
||||
break;
|
||||
}
|
||||
|
||||
if (battle_config.idletime_option&IDLE_SIT)
|
||||
sd->idletime = last_tick;
|
||||
if (battle_config.hom_idle_no_share && sd->hd && battle_config.idletime_hom_option&IDLE_SIT)
|
||||
sd->idletime_hom = last_tick;
|
||||
if (battle_config.mer_idle_no_share && sd->md && battle_config.idletime_mer_option&IDLE_SIT)
|
||||
sd->idletime_mer = last_tick;
|
||||
sd.idletime = last_tick;
|
||||
if (battle_config.hom_idle_no_share && sd.hd && battle_config.idletime_hom_option&IDLE_SIT)
|
||||
sd.idletime_hom = last_tick;
|
||||
if (battle_config.mer_idle_no_share && sd.md && battle_config.idletime_mer_option&IDLE_SIT)
|
||||
sd.idletime_mer = last_tick;
|
||||
|
||||
pc_setsit(sd);
|
||||
skill_sit(sd, true);
|
||||
clif_sitting(&sd->bl);
|
||||
pc_setsit(&sd);
|
||||
skill_sit(&sd, true);
|
||||
clif_sitting(&sd.bl);
|
||||
break;
|
||||
case 0x03: // standup
|
||||
if (!pc_issit(sd)) {
|
||||
if (!pc_issit(&sd)) {
|
||||
//Bugged client? Just refresh them.
|
||||
clif_standing(&sd->bl);
|
||||
clif_standing(&sd.bl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sd->sc.opt1 && sd->sc.opt1 != OPT1_STONEWAIT && sd->sc.opt1 != OPT1_BURNING)
|
||||
if (sd.sc.opt1 && sd.sc.opt1 != OPT1_STONEWAIT && sd.sc.opt1 != OPT1_BURNING)
|
||||
break;
|
||||
|
||||
if (sd->state.block_action & PCBLOCK_SITSTAND) {
|
||||
clif_displaymessage(sd->fd, msg_txt(sd,794)); // This action is currently blocked.
|
||||
if (sd.state.block_action & PCBLOCK_SITSTAND) {
|
||||
clif_displaymessage(sd.fd, msg_txt(&sd,794)); // This action is currently blocked.
|
||||
break;
|
||||
}
|
||||
|
||||
if (pc_setstand(sd, false)) {
|
||||
if (pc_setstand(&sd, false)) {
|
||||
if (battle_config.idletime_option&IDLE_SIT)
|
||||
sd->idletime = last_tick;
|
||||
if (battle_config.hom_idle_no_share && sd->hd && battle_config.idletime_hom_option&IDLE_SIT)
|
||||
sd->idletime_hom = last_tick;
|
||||
if (battle_config.mer_idle_no_share && sd->md && battle_config.idletime_mer_option&IDLE_SIT)
|
||||
sd->idletime_mer = last_tick;
|
||||
skill_sit(sd, false);
|
||||
clif_standing(&sd->bl);
|
||||
sd.idletime = last_tick;
|
||||
if (battle_config.hom_idle_no_share && sd.hd && battle_config.idletime_hom_option&IDLE_SIT)
|
||||
sd.idletime_hom = last_tick;
|
||||
if (battle_config.mer_idle_no_share && sd.md && battle_config.idletime_mer_option&IDLE_SIT)
|
||||
sd.idletime_mer = last_tick;
|
||||
skill_sit(&sd, false);
|
||||
clif_standing(&sd.bl);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -11877,8 +11848,12 @@ void clif_parse_ActionRequest_sub(map_session_data *sd, int action_type, int tar
|
||||
/// There are various variants of this packet, some of them have padding between fields.
|
||||
void clif_parse_ActionRequest(int fd, map_session_data *sd)
|
||||
{
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
|
||||
struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
|
||||
clif_parse_ActionRequest_sub(sd,
|
||||
clif_parse_ActionRequest_sub( *sd,
|
||||
RFIFOB(fd,info->pos[1]),
|
||||
RFIFOL(fd,info->pos[0]),
|
||||
gettick()
|
||||
@ -12254,6 +12229,10 @@ void clif_parse_UnequipItem(int fd,map_session_data *sd)
|
||||
/// 1 = click
|
||||
void clif_parse_NpcClicked(int fd,map_session_data *sd)
|
||||
{
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
|
||||
struct block_list *bl;
|
||||
struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
|
||||
|
||||
@ -12278,7 +12257,7 @@ void clif_parse_NpcClicked(int fd,map_session_data *sd)
|
||||
switch (bl->type) {
|
||||
case BL_MOB:
|
||||
case BL_PC:
|
||||
clif_parse_ActionRequest_sub(sd, 0x07, bl->id, gettick());
|
||||
clif_parse_ActionRequest_sub( *sd, 0x07, bl->id, gettick() );
|
||||
break;
|
||||
case BL_NPC:
|
||||
#ifdef RENEWAL
|
||||
@ -12865,7 +12844,7 @@ static void clif_parse_UseSkillToId_mercenary(s_mercenary_data *md, map_session_
|
||||
|
||||
if( !md )
|
||||
return;
|
||||
if( skill_isNotOk_mercenary(skill_id, md) )
|
||||
if( skill_isNotOk_mercenary(skill_id, *md) )
|
||||
return;
|
||||
if( md->bl.id != target_id && skill_get_inf(skill_id)&INF_SELF_SKILL )
|
||||
target_id = md->bl.id;
|
||||
@ -12888,7 +12867,7 @@ static void clif_parse_UseSkillToPos_mercenary(s_mercenary_data *md, map_session
|
||||
int lv;
|
||||
if( !md )
|
||||
return;
|
||||
if( skill_isNotOk_mercenary(skill_id, md) )
|
||||
if( skill_isNotOk_mercenary(skill_id, *md) )
|
||||
return;
|
||||
if( md->ud.skilltimer != INVALID_TIMER )
|
||||
return;
|
||||
@ -12913,6 +12892,10 @@ static void clif_parse_UseSkillToPos_mercenary(s_mercenary_data *md, map_session
|
||||
}
|
||||
|
||||
void clif_parse_skill_toid( map_session_data* sd, uint16 skill_id, uint16 skill_lv, int target_id ){
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
|
||||
t_tick tick = gettick();
|
||||
|
||||
if( skill_lv < 1 ) skill_lv = 1; //No clue, I have seen the client do this with guild skills :/ [Skotlex]
|
||||
@ -12963,7 +12946,7 @@ void clif_parse_skill_toid( map_session_data* sd, uint16 skill_id, uint16 skill_
|
||||
if( pc_issit(sd) )
|
||||
return;
|
||||
|
||||
if( skill_isNotOk(skill_id, sd) )
|
||||
if( skill_isNotOk(skill_id, *sd) )
|
||||
return;
|
||||
|
||||
if( sd->bl.id != target_id && inf&INF_SELF_SKILL )
|
||||
@ -13040,99 +13023,93 @@ void clif_parse_UseSkillToId( int fd, map_session_data *sd ){
|
||||
/*==========================================
|
||||
* Client tells server he'd like to use AoE skill id 'skill_id' of level 'skill_lv' on 'x','y' location
|
||||
*------------------------------------------*/
|
||||
static void clif_parse_UseSkillToPosSub(int fd, map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo)
|
||||
{
|
||||
static void clif_parse_UseSkillToPosSub( int fd, map_session_data& sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo ){
|
||||
t_tick tick = gettick();
|
||||
|
||||
// TODO: Change sd to reference
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
|
||||
if( !(skill_get_inf(skill_id)&INF_GROUND_SKILL) )
|
||||
return; //Using a target skill on the ground? WRONG.
|
||||
|
||||
if (sd->state.block_action & PCBLOCK_SKILL) {
|
||||
clif_msg(sd, WORK_IN_PROGRESS);
|
||||
if (sd.state.block_action & PCBLOCK_SKILL) {
|
||||
clif_msg(&sd, WORK_IN_PROGRESS);
|
||||
return;
|
||||
}
|
||||
|
||||
if( SKILL_CHK_HOMUN(skill_id) ) {
|
||||
clif_parse_UseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo);
|
||||
clif_parse_UseSkillToPos_homun(sd.hd, &sd, tick, skill_id, skill_lv, x, y, skillmoreinfo);
|
||||
return;
|
||||
}
|
||||
|
||||
if( SKILL_CHK_MERC(skill_id) ) {
|
||||
clif_parse_UseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo);
|
||||
clif_parse_UseSkillToPos_mercenary(sd.md, &sd, tick, skill_id, skill_lv, x, y, skillmoreinfo);
|
||||
return;
|
||||
}
|
||||
|
||||
if( pc_hasprogress( sd, WIP_DISABLE_SKILLITEM ) ){
|
||||
if( pc_hasprogress( &sd, WIP_DISABLE_SKILLITEM ) ){
|
||||
#ifdef RENEWAL
|
||||
clif_msg( sd, WORK_IN_PROGRESS );
|
||||
clif_msg( &sd, WORK_IN_PROGRESS );
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
//Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex]
|
||||
if (battle_config.idletime_option&IDLE_USESKILLTOPOS)
|
||||
sd->idletime = last_tick;
|
||||
if (battle_config.hom_idle_no_share && sd->hd && battle_config.idletime_hom_option&IDLE_USESKILLTOPOS)
|
||||
sd->idletime_hom = last_tick;
|
||||
if (battle_config.mer_idle_no_share && sd->md && battle_config.idletime_mer_option&IDLE_USESKILLTOPOS)
|
||||
sd->idletime_mer = last_tick;
|
||||
sd.idletime = last_tick;
|
||||
if (battle_config.hom_idle_no_share && sd.hd && battle_config.idletime_hom_option&IDLE_USESKILLTOPOS)
|
||||
sd.idletime_hom = last_tick;
|
||||
if (battle_config.mer_idle_no_share && sd.md && battle_config.idletime_mer_option&IDLE_USESKILLTOPOS)
|
||||
sd.idletime_mer = last_tick;
|
||||
|
||||
if( skill_isNotOk(skill_id, sd) )
|
||||
return;
|
||||
if( skillmoreinfo != -1 ) {
|
||||
if( pc_issit(sd) ) {
|
||||
clif_skill_fail( *sd, skill_id );
|
||||
if( pc_issit(&sd) ) {
|
||||
clif_skill_fail( sd, skill_id );
|
||||
return;
|
||||
}
|
||||
//You can't use Graffiti/TalkieBox AND have a vending open, so this is safe.
|
||||
safestrncpy(sd->message, RFIFOCP(fd,skillmoreinfo), MESSAGE_SIZE);
|
||||
safestrncpy(sd.message, RFIFOCP(fd,skillmoreinfo), MESSAGE_SIZE);
|
||||
}
|
||||
|
||||
if( sd->ud.skilltimer != INVALID_TIMER )
|
||||
if( sd.ud.skilltimer != INVALID_TIMER )
|
||||
return;
|
||||
|
||||
if( DIFF_TICK(tick, sd->ud.canact_tick) < 0 ) {
|
||||
if( sd->skillitem != skill_id ) {
|
||||
clif_skill_fail( *sd, skill_id, USESKILL_FAIL_SKILLINTERVAL );
|
||||
if( DIFF_TICK(tick, sd.ud.canact_tick) < 0 ) {
|
||||
if( sd.skillitem != skill_id ) {
|
||||
clif_skill_fail( sd, skill_id, USESKILL_FAIL_SKILLINTERVAL );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( sd->sc.option&OPTION_COSTUME )
|
||||
if( sd.sc.option&OPTION_COSTUME )
|
||||
return;
|
||||
|
||||
#ifndef RENEWAL
|
||||
if( sd->sc.getSCE(SC_BASILICA) && (skill_id != HP_BASILICA || sd->sc.getSCE(SC_BASILICA)->val4 != sd->bl.id) )
|
||||
if( sd.sc.getSCE(SC_BASILICA) && (skill_id != HP_BASILICA || sd.sc.getSCE(SC_BASILICA)->val4 != sd.bl.id) )
|
||||
return; // On basilica only caster can use Basilica again to stop it.
|
||||
#endif
|
||||
|
||||
if( sd->menuskill_id ) {
|
||||
if( sd->menuskill_id == SA_TAMINGMONSTER ) {
|
||||
clif_menuskill_clear(sd); //Cancel pet capture.
|
||||
}else if( sd->menuskill_id == SG_FEEL ){
|
||||
clif_menuskill_clear( sd ); // Cancel selection
|
||||
} else if( sd->menuskill_id != SA_AUTOSPELL )
|
||||
if( sd.menuskill_id ) {
|
||||
if( sd.menuskill_id == SA_TAMINGMONSTER ) {
|
||||
clif_menuskill_clear(&sd); //Cancel pet capture.
|
||||
}else if( sd.menuskill_id == SG_FEEL ){
|
||||
clif_menuskill_clear( &sd ); // Cancel selection
|
||||
} else if( sd.menuskill_id != SA_AUTOSPELL )
|
||||
return; //Can't use skills while a menu is open.
|
||||
}
|
||||
|
||||
pc_delinvincibletimer(sd);
|
||||
pc_delinvincibletimer(&sd);
|
||||
|
||||
if( sd->skillitem == skill_id ) {
|
||||
if( skill_lv != sd->skillitemlv )
|
||||
skill_lv = sd->skillitemlv;
|
||||
unit_skilluse_pos(&sd->bl, x, y, skill_id, skill_lv);
|
||||
if( sd.skillitem == skill_id ) {
|
||||
if( skill_lv != sd.skillitemlv )
|
||||
skill_lv = sd.skillitemlv;
|
||||
unit_skilluse_pos(&sd.bl, x, y, skill_id, skill_lv);
|
||||
} else {
|
||||
int lv;
|
||||
sd->skillitem = sd->skillitemlv = 0;
|
||||
if( (lv = pc_checkskill(sd, skill_id)) > 0 ) {
|
||||
sd.skillitem = sd.skillitemlv = 0;
|
||||
if( (lv = pc_checkskill(&sd, skill_id)) > 0 ) {
|
||||
if( skill_lv > lv )
|
||||
skill_lv = lv;
|
||||
unit_skilluse_pos(&sd->bl, x, y, skill_id,skill_lv);
|
||||
unit_skilluse_pos(&sd.bl, x, y, skill_id,skill_lv);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13145,13 +13122,17 @@ static void clif_parse_UseSkillToPosSub(int fd, map_session_data *sd, uint16 ski
|
||||
/// There are various variants of this packet, some of them have padding between fields.
|
||||
void clif_parse_UseSkillToPos(int fd, map_session_data *sd)
|
||||
{
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
|
||||
struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
|
||||
if (pc_cant_act(sd))
|
||||
return;
|
||||
if (pc_issit(sd))
|
||||
return;
|
||||
|
||||
clif_parse_UseSkillToPosSub(fd, sd,
|
||||
clif_parse_UseSkillToPosSub(fd, *sd,
|
||||
RFIFOW(fd,info->pos[0]), //skill lv
|
||||
RFIFOW(fd,info->pos[1]), //skill num
|
||||
RFIFOW(fd,info->pos[2]), //pos x
|
||||
@ -13169,13 +13150,17 @@ void clif_parse_UseSkillToPos(int fd, map_session_data *sd)
|
||||
/// There are various variants of this packet, some of them have padding between fields.
|
||||
void clif_parse_UseSkillToPosMoreInfo(int fd, map_session_data *sd)
|
||||
{
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
|
||||
struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
|
||||
if (pc_cant_act(sd))
|
||||
return;
|
||||
if (pc_issit(sd))
|
||||
return;
|
||||
|
||||
clif_parse_UseSkillToPosSub(fd, sd,
|
||||
clif_parse_UseSkillToPosSub(fd, *sd,
|
||||
RFIFOW(fd,info->pos[0]), //Skill lv
|
||||
RFIFOW(fd,info->pos[1]), //Skill num
|
||||
RFIFOW(fd,info->pos[2]), //pos x
|
||||
@ -13311,7 +13296,7 @@ void clif_parse_RepairItem( int fd, map_session_data *sd ){
|
||||
clif_menuskill_clear(sd);
|
||||
return;
|
||||
}
|
||||
skill_repairweapon( sd, p->item.index );
|
||||
skill_repairweapon( *sd, p->item.index );
|
||||
clif_menuskill_clear(sd);
|
||||
}
|
||||
|
||||
@ -13331,7 +13316,7 @@ void clif_parse_WeaponRefine( int fd, map_session_data *sd ){
|
||||
clif_menuskill_clear(sd);
|
||||
return;
|
||||
}
|
||||
skill_weaponrefine( sd, server_index( RFIFOL( fd, 2 ) ) );
|
||||
skill_weaponrefine( *sd, server_index( RFIFOL( fd, 2 ) ) );
|
||||
clif_menuskill_clear(sd);
|
||||
}
|
||||
|
||||
@ -13490,10 +13475,10 @@ void clif_parse_SelectArrow(int fd,map_session_data *sd) {
|
||||
skill_produce_mix(sd,SA_CREATECON,p->itemId,0,0,0,1,-1);
|
||||
break;
|
||||
case GC_POISONINGWEAPON:
|
||||
skill_poisoningweapon(sd,p->itemId);
|
||||
skill_poisoningweapon(*sd,p->itemId);
|
||||
break;
|
||||
case NC_MAGICDECOY:
|
||||
skill_magicdecoy(sd,p->itemId);
|
||||
skill_magicdecoy(*sd,p->itemId);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -14177,6 +14162,10 @@ void clif_parse_PurchaseReq2(int fd, map_session_data* sd){
|
||||
/// 0 = canceled
|
||||
/// 1 = open
|
||||
void clif_parse_OpenVending(int fd, map_session_data* sd){
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
|
||||
int cmd = RFIFOW(fd,0);
|
||||
struct s_packet_db* info = &packet_db[cmd];
|
||||
short len = (short)RFIFOW(fd,info->pos[0]);
|
||||
@ -14211,7 +14200,7 @@ void clif_parse_OpenVending(int fd, map_session_data* sd){
|
||||
if( message[0] == '\0' ) // invalid input
|
||||
return;
|
||||
|
||||
vending_openvending(sd, message, data, len/8, NULL);
|
||||
vending_openvending(*sd, message, data, len/8, NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -14394,6 +14383,10 @@ static enum e_result_validate_emblem clif_validate_emblem(const uint8* emblem, u
|
||||
/// Request to update the guild emblem (CZ_REGISTER_GUILD_EMBLEM_IMG).
|
||||
/// 0153 <packet len>.W <emblem data>.?B
|
||||
void clif_parse_GuildChangeEmblem(int fd,map_session_data *sd){
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
|
||||
struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
|
||||
unsigned long emblem_len = RFIFOW(fd,info->pos[0])-4;
|
||||
const uint8* emblem = RFIFOP(fd,info->pos[1]);
|
||||
@ -14418,13 +14411,15 @@ void clif_parse_GuildChangeEmblem(int fd,map_session_data *sd){
|
||||
return;
|
||||
}
|
||||
|
||||
guild_change_emblem(sd, emblem_len, (const char*)emblem);
|
||||
guild_change_emblem( *sd, emblem_len, (const char*)emblem );
|
||||
}
|
||||
|
||||
/// Request to update the guild emblem id (version, according to Gravity)
|
||||
/// 0b46 <guild id>.L <version>.L
|
||||
void clif_parse_GuildChangeEmblem2(int fd, map_session_data* sd) {
|
||||
nullpo_retv(sd);
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
|
||||
#if PACKETVER >= 20190724
|
||||
const PACKET_CZ_GUILD_EMBLEM_CHANGE2* p = (PACKET_CZ_GUILD_EMBLEM_CHANGE2*)RFIFOP(fd, 0);
|
||||
@ -14441,7 +14436,7 @@ void clif_parse_GuildChangeEmblem2(int fd, map_session_data* sd) {
|
||||
return;
|
||||
}
|
||||
|
||||
guild_change_emblem_version(sd, p->version);
|
||||
guild_change_emblem_version( *sd, p->version );
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -18951,6 +18946,10 @@ void clif_parse_LessEffect(int fd, map_session_data* sd){
|
||||
|
||||
/// 07e4 <length>.w <option>.l <val>.l {<index>.w <amount>.w).4b* (CZ_ITEMLISTWIN_RES)
|
||||
void clif_parse_ItemListWindowSelected(int fd, map_session_data* sd) {
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
|
||||
struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
|
||||
int n = (RFIFOW(fd,info->pos[0])-12) / 4;
|
||||
int type = RFIFOL(fd,info->pos[1]);
|
||||
@ -18976,7 +18975,7 @@ void clif_parse_ItemListWindowSelected(int fd, map_session_data* sd) {
|
||||
break;
|
||||
case 1: // Level 1: Pure to Rough
|
||||
case 2: // Level 2: Rough to Pure
|
||||
skill_elementalanalysis(sd,n,type,item_list);
|
||||
skill_elementalanalysis(*sd,n,type,item_list);
|
||||
break;
|
||||
}
|
||||
clif_menuskill_clear(sd);
|
||||
@ -19600,119 +19599,93 @@ void clif_millenniumshield(struct block_list *bl, short shields) {
|
||||
/*==========================================
|
||||
* Magic Decoy Material List
|
||||
*------------------------------------------*/
|
||||
void clif_magicdecoy_list( map_session_data *sd, uint16 skill_lv, short x, short y ){
|
||||
// TODO: Change sd to reference
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
void clif_magicdecoy_list( map_session_data& sd, uint16 skill_lv, short x, short y ){
|
||||
PACKET_ZC_MAKINGARROW_LIST* p = (PACKET_ZC_MAKINGARROW_LIST*)packet_buffer;
|
||||
|
||||
int fd = sd->fd;
|
||||
|
||||
if( !session_isActive( fd ) ){
|
||||
return;
|
||||
}
|
||||
|
||||
WFIFOHEAD( fd, sizeof( struct PACKET_ZC_MAKINGARROW_LIST ) + MAX_INVENTORY * sizeof( struct PACKET_ZC_MAKINGARROW_LIST_sub ) );
|
||||
struct PACKET_ZC_MAKINGARROW_LIST *p = (struct PACKET_ZC_MAKINGARROW_LIST *)WFIFOP(fd, 0);
|
||||
p->packetType = HEADER_ZC_MAKINGARROW_LIST;
|
||||
p->packetLength = sizeof( *p );
|
||||
|
||||
int count = 0;
|
||||
for( int i = 0; i < MAX_INVENTORY; i++ ){
|
||||
if( itemdb_group.item_exists( IG_ELEMENT, sd->inventory.u.items_inventory[i].nameid ) ) {
|
||||
p->items[count].itemId = client_nameid( sd->inventory.u.items_inventory[i].nameid );
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if( count > 0 ) {
|
||||
p->packetLength = sizeof( struct PACKET_ZC_MAKINGARROW_LIST ) + count * sizeof( struct PACKET_ZC_MAKINGARROW_LIST_sub );
|
||||
WFIFOSET( fd, p->packetLength );
|
||||
sd->menuskill_id = NC_MAGICDECOY;
|
||||
sd->menuskill_val = skill_lv;
|
||||
sd->sc.comet_x = x;
|
||||
sd->sc.comet_y = y;
|
||||
}else{
|
||||
clif_skill_fail( *sd, NC_MAGICDECOY );
|
||||
}
|
||||
}
|
||||
/*==========================================
|
||||
* Guillotine Cross Poisons List
|
||||
*------------------------------------------*/
|
||||
void clif_poison_list( map_session_data *sd, uint16 skill_lv ){
|
||||
// TODO: Change sd to reference
|
||||
if( sd == nullptr ){
|
||||
return;
|
||||
}
|
||||
|
||||
int fd = sd->fd;
|
||||
|
||||
if( !session_isActive( fd ) ){
|
||||
return;
|
||||
}
|
||||
|
||||
WFIFOHEAD( fd, sizeof( struct PACKET_ZC_MAKINGARROW_LIST ) + MAX_INVENTORY * sizeof( struct PACKET_ZC_MAKINGARROW_LIST_sub ) );
|
||||
struct PACKET_ZC_MAKINGARROW_LIST *p = (struct PACKET_ZC_MAKINGARROW_LIST *)WFIFOP( fd, 0 );
|
||||
p->packetType = HEADER_ZC_MAKINGARROW_LIST;
|
||||
|
||||
int count = 0;
|
||||
for( int i = 0; i < MAX_INVENTORY; i++ ){
|
||||
if( itemdb_group.item_exists( IG_POISON, sd->inventory.u.items_inventory[i].nameid ) ){
|
||||
p->items[count].itemId = client_nameid( sd->inventory.u.items_inventory[i].nameid );
|
||||
size_t count = 0;
|
||||
for( size_t i = 0; i < MAX_INVENTORY; i++ ){
|
||||
if( itemdb_group.item_exists( IG_ELEMENT, sd.inventory.u.items_inventory[i].nameid ) ){
|
||||
p->items[count].itemId = client_nameid( sd.inventory.u.items_inventory[i].nameid );
|
||||
p->packetLength += sizeof( p->items[0] );
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if( count > 0 ){
|
||||
p->packetLength = sizeof( struct PACKET_ZC_MAKINGARROW_LIST ) + count * sizeof( struct PACKET_ZC_MAKINGARROW_LIST_sub );
|
||||
WFIFOSET( fd, p->packetLength );
|
||||
sd->menuskill_id = GC_POISONINGWEAPON;
|
||||
sd->menuskill_val = skill_lv;
|
||||
clif_send( p, p->packetLength, &sd.bl, SELF );
|
||||
|
||||
sd.menuskill_id = NC_MAGICDECOY;
|
||||
sd.menuskill_val = skill_lv;
|
||||
sd.sc.comet_x = x;
|
||||
sd.sc.comet_y = y;
|
||||
}else{
|
||||
clif_skill_fail( *sd, GC_POISONINGWEAPON, USESKILL_FAIL_GUILLONTINE_POISON );
|
||||
clif_skill_fail( sd, NC_MAGICDECOY );
|
||||
}
|
||||
}
|
||||
/*==========================================
|
||||
* Guillotine Cross Poisons List
|
||||
*------------------------------------------*/
|
||||
void clif_poison_list( map_session_data& sd, uint16 skill_lv ){
|
||||
PACKET_ZC_MAKINGARROW_LIST* p = (PACKET_ZC_MAKINGARROW_LIST*)packet_buffer;
|
||||
|
||||
p->packetType = HEADER_ZC_MAKINGARROW_LIST;
|
||||
p->packetLength = sizeof( *p );
|
||||
|
||||
size_t count = 0;
|
||||
for( size_t i = 0; i < MAX_INVENTORY; i++ ){
|
||||
if( itemdb_group.item_exists( IG_POISON, sd.inventory.u.items_inventory[i].nameid ) ){
|
||||
p->items[count].itemId = client_nameid( sd.inventory.u.items_inventory[i].nameid );
|
||||
p->packetLength += sizeof( p->items[0] );
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if( count > 0 ){
|
||||
clif_send( p, p->packetLength, &sd.bl, SELF );
|
||||
|
||||
sd.menuskill_id = GC_POISONINGWEAPON;
|
||||
sd.menuskill_val = skill_lv;
|
||||
}else{
|
||||
clif_skill_fail( sd, GC_POISONINGWEAPON, USESKILL_FAIL_GUILLONTINE_POISON );
|
||||
}
|
||||
}
|
||||
|
||||
/// 0442 <Length>.W <count>.L <Skill_list>.W (ZC_SKILL_SELECT_REQUEST).
|
||||
int clif_autoshadowspell_list(map_session_data *sd) {
|
||||
// TODO: Change sd to reference
|
||||
if( sd == nullptr ){
|
||||
return 0;
|
||||
}
|
||||
/// 0442 <Length>.W <why>.L { <Skill_Id>.W }* (ZC_SKILL_SELECT_REQUEST).
|
||||
void clif_autoshadowspell_list( map_session_data& sd ){
|
||||
#if PACKETVER >= 20081210
|
||||
if( sd.menuskill_id == SC_AUTOSHADOWSPELL )
|
||||
return;
|
||||
|
||||
int fd, i, c;
|
||||
PACKET_ZC_SKILL_SELECT_REQUEST* p = (PACKET_ZC_SKILL_SELECT_REQUEST*)packet_buffer;
|
||||
|
||||
fd = sd->fd;
|
||||
|
||||
if( !session_isActive(fd) )
|
||||
return 0;
|
||||
|
||||
if( sd->menuskill_id == SC_AUTOSHADOWSPELL )
|
||||
return 0;
|
||||
|
||||
WFIFOHEAD(fd, 2 * 6 + 4);
|
||||
WFIFOW(fd,0) = 0x442;
|
||||
p->packetType = HEADER_ZC_SKILL_SELECT_REQUEST;
|
||||
p->packetLength = sizeof( *p );
|
||||
p->why = 1; // enum PACKET_ZC_SKILL_SELECT_REQUEST::enumWHY::WHY_SC_AUTOSHADOWSPELL = 0x1
|
||||
|
||||
//AEGIS listed the specified skills that available for SC_AUTOSHADOWSPELL
|
||||
for( i = 0, c = 0; i < MAX_SKILL; i++ )
|
||||
if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 &&
|
||||
skill_get_inf2(sd->status.skill[i].id, INF2_ISAUTOSHADOWSPELL))
|
||||
size_t count = 0;
|
||||
for( size_t i = 0; i < MAX_SKILL; i++ ){
|
||||
if( sd.status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd.status.skill[i].id > 0 &&
|
||||
skill_get_inf2(sd.status.skill[i].id, INF2_ISAUTOSHADOWSPELL))
|
||||
{
|
||||
WFIFOW(fd,8+c*2) = sd->status.skill[i].id;
|
||||
c++;
|
||||
p->skills[count].skill_id = sd.status.skill[i].id;
|
||||
p->packetLength += sizeof( p->skills[0] );
|
||||
count++;
|
||||
}
|
||||
|
||||
if( c > 0 ) {
|
||||
WFIFOW(fd,2) = 8 + c * 2;
|
||||
WFIFOL(fd,4) = c;
|
||||
WFIFOSET(fd,WFIFOW(fd,2));
|
||||
sd->menuskill_id = SC_AUTOSHADOWSPELL;
|
||||
sd->menuskill_val = c;
|
||||
} else {
|
||||
status_change_end(&sd->bl,SC_STOP);
|
||||
clif_skill_fail( *sd, SC_AUTOSHADOWSPELL, USESKILL_FAIL_IMITATION_SKILL_NONE );
|
||||
}
|
||||
|
||||
return 1;
|
||||
if( count > 0 ) {
|
||||
clif_send( p, p->packetLength, &sd.bl, SELF );
|
||||
|
||||
sd.menuskill_id = SC_AUTOSHADOWSPELL;
|
||||
sd.menuskill_val = count;
|
||||
} else {
|
||||
status_change_end( &sd.bl, SC_STOP );
|
||||
clif_skill_fail( sd, SC_AUTOSHADOWSPELL, USESKILL_FAIL_IMITATION_SKILL_NONE );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*===========================================
|
||||
@ -19764,7 +19737,7 @@ void clif_parse_SkillSelectMenu(int fd, map_session_data *sd) {
|
||||
return;
|
||||
}
|
||||
|
||||
skill_select_menu(sd, RFIFOW(fd, info->pos[1]));
|
||||
skill_select_menu(*sd, RFIFOW(fd, info->pos[1]));
|
||||
} else
|
||||
return;
|
||||
|
||||
|
@ -702,7 +702,7 @@ void clif_divorced(map_session_data* sd, const char* name);
|
||||
void clif_callpartner(map_session_data& sd);
|
||||
void clif_playBGM( map_session_data& sd, const char* name );
|
||||
void clif_soundeffect( struct block_list& bl, const char* name, int type, enum send_target target );
|
||||
void clif_parse_ActionRequest_sub(map_session_data *sd, int action_type, int target_id, t_tick tick);
|
||||
void clif_parse_ActionRequest_sub( map_session_data& sd, int action_type, int target_id, t_tick tick );
|
||||
void clif_parse_LoadEndAck(int fd,map_session_data *sd);
|
||||
void clif_hotkeys_send(map_session_data *sd, int tab);
|
||||
|
||||
@ -796,7 +796,7 @@ void clif_clearcart(int fd);
|
||||
|
||||
void clif_item_identify_list(map_session_data *sd);
|
||||
void clif_item_identified(map_session_data *sd,int idx,int flag);
|
||||
void clif_item_repair_list(map_session_data *sd, map_session_data *dstsd, int lv);
|
||||
void clif_item_repair_list( map_session_data& sd, map_session_data& dstsd, uint16 lv );
|
||||
void clif_item_repaireffect(map_session_data *sd, int idx, int flag);
|
||||
void clif_item_damaged(map_session_data* sd, unsigned short position);
|
||||
void clif_item_refine_list(map_session_data *sd);
|
||||
@ -1094,11 +1094,11 @@ void clif_elementalconverter_list(map_session_data *sd);
|
||||
|
||||
void clif_millenniumshield(struct block_list *bl, short shields);
|
||||
|
||||
void clif_magicdecoy_list(map_session_data *sd, uint16 skill_lv, short x, short y);
|
||||
void clif_magicdecoy_list( map_session_data& sd, uint16 skill_lv, short x, short y );
|
||||
|
||||
void clif_poison_list(map_session_data *sd, uint16 skill_lv);
|
||||
void clif_poison_list( map_session_data& sd, uint16 skill_lv );
|
||||
|
||||
int clif_autoshadowspell_list(map_session_data *sd);
|
||||
void clif_autoshadowspell_list( map_session_data& sd );
|
||||
|
||||
int clif_skill_itemlistwindow( map_session_data *sd, uint16 skill_id, uint16 skill_lv );
|
||||
void clif_elemental_info(map_session_data *sd);
|
||||
|
@ -1334,7 +1334,6 @@
|
||||
|
||||
// 2008-12-10aSakexe
|
||||
#if PACKETVER >= 20081210
|
||||
packet(0x0442,-1);
|
||||
parseable_packet(0x0443,8,clif_parse_SkillSelectMenu,2,6);
|
||||
#endif
|
||||
|
||||
@ -1412,7 +1411,6 @@
|
||||
packet(0x01a2,37);
|
||||
//packet(0x0440,10);
|
||||
//packet(0x0441,4);
|
||||
//packet(0x0442,8);
|
||||
//packet(0x0443,8);
|
||||
#endif
|
||||
|
||||
|
@ -316,7 +316,7 @@ int elemental_action(s_elemental_data *ed, block_list *bl, t_tick tick) {
|
||||
uint16 skill_id = skill->id;
|
||||
uint16 skill_lv = skill->lv;
|
||||
|
||||
if( elemental_skillnotok(skill_id, ed) )
|
||||
if( elemental_skillnotok(skill_id, *ed) )
|
||||
return 0;
|
||||
|
||||
if( ed->ud.skilltimer != INVALID_TIMER )
|
||||
@ -389,7 +389,7 @@ int elemental_change_mode_ack(s_elemental_data *ed, e_elemental_skillmode skill_
|
||||
uint16 skill_id = skill->id;
|
||||
uint16 skill_lv = skill->lv;
|
||||
|
||||
if( elemental_skillnotok(skill_id, ed) )
|
||||
if( elemental_skillnotok(skill_id, *ed) )
|
||||
return 0;
|
||||
|
||||
if( ed->ud.skilltimer != INVALID_TIMER )
|
||||
@ -460,10 +460,19 @@ int elemental_unlocktarget(s_elemental_data *ed) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool elemental_skillnotok(uint16 skill_id, s_elemental_data *ed) {
|
||||
bool elemental_skillnotok( uint16 skill_id, s_elemental_data& ed ){
|
||||
uint16 idx = skill_get_index(skill_id);
|
||||
nullpo_retr(1,ed);
|
||||
return idx == 0 ? false : skill_isNotOk(skill_id,ed->master); // return false or check if it,s ok for master as well
|
||||
|
||||
if( idx == 0 ){
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if it's ok for master as well
|
||||
if( ed.master != nullptr ){
|
||||
return skill_isNotOk( skill_id, *ed.master );
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
struct s_skill_condition elemental_skill_get_requirements(uint16 skill_id, uint16 skill_lv){
|
||||
|
@ -123,7 +123,7 @@ void elemental_summon_stop(s_elemental_data *ed);
|
||||
t_tick elemental_get_lifetime(s_elemental_data *ed);
|
||||
|
||||
int elemental_unlocktarget(s_elemental_data *ed);
|
||||
bool elemental_skillnotok(uint16 skill_id, s_elemental_data *ed);
|
||||
bool elemental_skillnotok( uint16 skill_id, s_elemental_data& ed );
|
||||
int elemental_set_target( map_session_data *sd, block_list *bl );
|
||||
int elemental_clean_effect(s_elemental_data *ed);
|
||||
int elemental_action(s_elemental_data *ed, block_list *bl, t_tick tick);
|
||||
|
@ -1481,17 +1481,11 @@ int guild_notice_changed(int guild_id,const char *mes1,const char *mes2) {
|
||||
/*====================================================
|
||||
* Check condition for changing guild emblem
|
||||
*---------------------------------------------------*/
|
||||
bool guild_check_emblem_change_condition(map_session_data *sd)
|
||||
{
|
||||
// TODO: Change sd to reference
|
||||
if( sd == nullptr ){
|
||||
return false;
|
||||
}
|
||||
|
||||
auto &g = sd->guild;
|
||||
bool guild_check_emblem_change_condition( map_session_data& sd ){
|
||||
auto &g = sd.guild;
|
||||
|
||||
if (battle_config.require_glory_guild && g != nullptr && guild_checkskill(g->guild, GD_GLORYGUILD) > 0) {
|
||||
clif_skill_fail( *sd, GD_GLORYGUILD );
|
||||
clif_skill_fail( sd, GD_GLORYGUILD );
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1501,28 +1495,23 @@ bool guild_check_emblem_change_condition(map_session_data *sd)
|
||||
/*====================================================
|
||||
* Change guild emblem
|
||||
*---------------------------------------------------*/
|
||||
int guild_change_emblem(map_session_data *sd,int len,const char *data) {
|
||||
nullpo_ret(sd);
|
||||
|
||||
int guild_change_emblem( map_session_data& sd, int len, const char* data ){
|
||||
if (!guild_check_emblem_change_condition(sd)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return intif_guild_emblem(sd->status.guild_id,len,data);
|
||||
return intif_guild_emblem( sd.status.guild_id, len, data );
|
||||
}
|
||||
|
||||
/*====================================================
|
||||
* Change guild emblem version
|
||||
*---------------------------------------------------*/
|
||||
int guild_change_emblem_version(map_session_data* sd, int version)
|
||||
{
|
||||
nullpo_ret(sd);
|
||||
|
||||
int guild_change_emblem_version( map_session_data& sd, int version ){
|
||||
if (!guild_check_emblem_change_condition(sd)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return intif_guild_emblem_version(sd->status.guild_id, version);
|
||||
return intif_guild_emblem_version( sd.status.guild_id, version );
|
||||
}
|
||||
|
||||
/*====================================================
|
||||
|
@ -87,8 +87,8 @@ int guild_change_position(int guild_id,int idx,int mode,int exp_mode,const char
|
||||
int guild_position_changed(int guild_id,int idx,struct guild_position *p);
|
||||
int guild_change_notice(map_session_data *sd,int guild_id,const char *mes1,const char *mes2);
|
||||
int guild_notice_changed(int guild_id,const char *mes1,const char *mes2);
|
||||
int guild_change_emblem(map_session_data *sd,int len,const char *data);
|
||||
int guild_change_emblem_version(map_session_data* sd, int version);
|
||||
int guild_change_emblem( map_session_data& sd, int len, const char* data );
|
||||
int guild_change_emblem_version( map_session_data& sd, int version );
|
||||
int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data);
|
||||
int guild_send_message(map_session_data *sd,const char *mes,int len);
|
||||
int guild_recv_message(int guild_id,uint32 account_id,const char *mes,int len);
|
||||
|
@ -4118,7 +4118,7 @@ int mob_clone_spawn(map_session_data *sd, int16 m, int16 x, int16 y, const char
|
||||
/**
|
||||
* The clone should be able to cast the skill (e.g. have the required weapon) bugreport:5299)
|
||||
**/
|
||||
if( !skill_check_condition_castbegin(sd,skill_id,sd->status.skill[sk_idx].lv) )
|
||||
if( !skill_check_condition_castbegin(*sd,skill_id,sd->status.skill[sk_idx].lv) )
|
||||
continue;
|
||||
|
||||
std::shared_ptr<s_mob_skill> ms = std::make_shared<s_mob_skill>();
|
||||
|
@ -427,6 +427,17 @@ struct PACKET_ZC_INVENTORY_TAB{
|
||||
bool favorite;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct PACKET_ZC_SKILL_SELECT_REQUEST_sub{
|
||||
int16 skill_id;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct PACKET_ZC_SKILL_SELECT_REQUEST{
|
||||
int16 packetType;
|
||||
int16 packetLength;
|
||||
int32 why;
|
||||
struct PACKET_ZC_SKILL_SELECT_REQUEST_sub skills[];
|
||||
} __attribute__((packed));
|
||||
|
||||
// NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
|
||||
#if !defined( sun ) && ( !defined( __NETBSD__ ) || __NetBSD_Version__ >= 600000000 )
|
||||
#pragma pack( pop )
|
||||
@ -458,6 +469,7 @@ DEFINE_PACKET_HEADER(ZC_BOSS_INFO, 0x293)
|
||||
DEFINE_PACKET_HEADER(ZC_CASH_TIME_COUNTER, 0x298)
|
||||
DEFINE_PACKET_HEADER(ZC_CASH_ITEM_DELETE, 0x299)
|
||||
DEFINE_PACKET_HEADER(ZC_NOTIFY_BIND_ON_EQUIP, 0x2d3)
|
||||
DEFINE_PACKET_HEADER(ZC_SKILL_SELECT_REQUEST, 0x442)
|
||||
DEFINE_PACKET_HEADER(ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER, 0x824)
|
||||
DEFINE_PACKET_HEADER(CZ_SSILIST_ITEM_CLICK, 0x83c)
|
||||
DEFINE_PACKET_HEADER(CZ_REQ_SE_CASH_TAB_CODE, 0x846)
|
||||
|
@ -14598,7 +14598,7 @@ TIMER_FUNC(pc_autotrade_timer){
|
||||
sd->autotrade_tid = INVALID_TIMER;
|
||||
|
||||
if (sd->state.autotrade&2)
|
||||
vending_reopen(sd);
|
||||
vending_reopen(*sd);
|
||||
if (sd->state.autotrade&4)
|
||||
buyingstore_reopen(sd);
|
||||
|
||||
|
@ -19867,7 +19867,7 @@ BUILDIN_FUNC(unitattack)
|
||||
case BL_PC: {
|
||||
map_session_data* sd = (map_session_data*)unit_bl;
|
||||
|
||||
clif_parse_ActionRequest_sub(sd, actiontype > 0 ? 0x07 : 0x00, target_bl->id, gettick());
|
||||
clif_parse_ActionRequest_sub( *sd, actiontype > 0 ? 0x07 : 0x00, target_bl->id, gettick() );
|
||||
script_pushint(st, sd->ud.target == target_bl->id);
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -596,8 +596,8 @@ void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id);
|
||||
int skill_check_bl_sc(struct block_list *target, va_list ap);
|
||||
|
||||
// Skill conditions check and remove [Inkfish]
|
||||
bool skill_check_condition_castbegin(map_session_data *sd, uint16 skill_id, uint16 skill_lv);
|
||||
bool skill_check_condition_castend(map_session_data *sd, uint16 skill_id, uint16 skill_lv);
|
||||
bool skill_check_condition_castbegin( map_session_data& sd, uint16 skill_id, uint16 skill_lv );
|
||||
bool skill_check_condition_castend( map_session_data& sd, uint16 skill_id, uint16 skill_lv );
|
||||
int skill_check_condition_char_sub (struct block_list *bl, va_list ap);
|
||||
void skill_consume_requirement(map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type);
|
||||
struct s_skill_condition skill_get_requirement(map_session_data *sd, uint16 skill_id, uint16 skill_lv);
|
||||
@ -610,9 +610,9 @@ void skill_unit_move_unit_group( std::shared_ptr<s_skill_unit_group> group, int1
|
||||
void skill_unit_move_unit(struct block_list *bl, int dx, int dy);
|
||||
|
||||
int skill_sit(map_session_data *sd, bool sitting);
|
||||
void skill_repairweapon(map_session_data *sd, int idx);
|
||||
void skill_repairweapon( map_session_data& sd, int idx );
|
||||
void skill_identify(map_session_data *sd,int idx);
|
||||
void skill_weaponrefine(map_session_data *sd,int idx); // [Celest]
|
||||
void skill_weaponrefine( map_session_data& sd, int idx ); // [Celest]
|
||||
int skill_autospell(map_session_data *md,uint16 skill_id);
|
||||
|
||||
int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, bool heal);
|
||||
@ -621,9 +621,9 @@ bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce
|
||||
int8 skill_isCopyable(map_session_data *sd, uint16 skill_id);
|
||||
|
||||
// Abnormal status
|
||||
bool skill_isNotOk(uint16 skill_id, map_session_data *sd);
|
||||
bool skill_isNotOk( uint16 skill_id, map_session_data& sd );
|
||||
bool skill_isNotOk_hom(struct homun_data *hd, uint16 skill_id, uint16 skill_lv);
|
||||
bool skill_isNotOk_mercenary(uint16 skill_id, s_mercenary_data *md);
|
||||
bool skill_isNotOk_mercenary( uint16 skill_id, s_mercenary_data& md);
|
||||
|
||||
bool skill_isNotOk_npcRange(struct block_list *src, uint16 skill_id, uint16 skill_lv, int pos_x, int pos_y);
|
||||
|
||||
@ -2775,19 +2775,19 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s
|
||||
/**
|
||||
* Mechanic
|
||||
**/
|
||||
int skill_magicdecoy(map_session_data *sd, t_itemid nameid);
|
||||
void skill_magicdecoy( map_session_data& sd, t_itemid nameid );
|
||||
|
||||
/**
|
||||
* Guiltoine Cross
|
||||
**/
|
||||
int skill_poisoningweapon( map_session_data *sd, t_itemid nameid);
|
||||
void skill_poisoningweapon( map_session_data& sd, t_itemid nameid );
|
||||
|
||||
/**
|
||||
* Auto Shadow Spell (Shadow Chaser)
|
||||
**/
|
||||
int skill_select_menu(map_session_data *sd,uint16 skill_id);
|
||||
void skill_select_menu( map_session_data& sd, uint16 skill_id );
|
||||
|
||||
int skill_elementalanalysis(map_session_data *sd, int n, uint16 skill_lv, unsigned short *item_list); // Sorcerer Four Elemental Analisys.
|
||||
int skill_elementalanalysis( map_session_data& sd, int n, uint16 skill_lv, unsigned short *item_list ); // Sorcerer Four Elemental Analisys.
|
||||
int skill_changematerial(map_session_data *sd, int n, unsigned short *item_list); // Genetic Change Material.
|
||||
int skill_get_elemental_type(uint16 skill_id, uint16 skill_lv);
|
||||
|
||||
|
@ -1646,7 +1646,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
|
||||
if (sc && sc->getSCE(SC_COMBO) &&
|
||||
skill_is_combo(skill_id) &&
|
||||
(sc->getSCE(SC_COMBO)->val1 == skill_id ||
|
||||
(sd?skill_check_condition_castbegin(sd,skill_id,skill_lv):0) )) {
|
||||
(sd?skill_check_condition_castbegin(*sd,skill_id,skill_lv):0) )) {
|
||||
if (skill_is_combo(skill_id) == 2 && target_id == src->id && ud->target > 0)
|
||||
target_id = ud->target;
|
||||
else if (sc->getSCE(SC_COMBO)->val2)
|
||||
@ -1665,7 +1665,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
|
||||
|
||||
if (sd) {
|
||||
// Target_id checking.
|
||||
if(skill_isNotOk(skill_id, sd))
|
||||
if(skill_isNotOk(skill_id, *sd))
|
||||
return 0;
|
||||
|
||||
switch(skill_id) { // Check for skills that auto-select target
|
||||
@ -1848,7 +1848,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
|
||||
break;
|
||||
}
|
||||
|
||||
if (!skill_check_condition_castbegin(sd, skill_id, skill_lv))
|
||||
if (!skill_check_condition_castbegin(*sd, skill_id, skill_lv))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2161,7 +2161,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
|
||||
return 0;
|
||||
|
||||
if( sd ) {
|
||||
if( skill_isNotOk(skill_id, sd) || !skill_check_condition_castbegin(sd, skill_id, skill_lv) )
|
||||
if( skill_isNotOk(skill_id, *sd) || !skill_check_condition_castbegin(*sd, skill_id, skill_lv) )
|
||||
return 0;
|
||||
if (skill_id == MG_FIREWALL && !skill_pos_maxcount_check(src, skill_x, skill_y, skill_id, skill_lv, BL_PC, true))
|
||||
return 0; // Special check for Firewall only
|
||||
|
@ -295,38 +295,32 @@ void vending_purchasereq(map_session_data* sd, int aid, int uid, const uint8* da
|
||||
* @param at Autotrader info, or NULL if requetsed not from autotrade persistance
|
||||
* @return 0 If success, 1 - Cannot open (die, not state.prevend, trading), 2 - No cart, 3 - Count issue, 4 - Cart data isn't saved yet, 5 - No valid item found
|
||||
*/
|
||||
int8 vending_openvending(map_session_data* sd, const char* message, const uint8* data, int count, struct s_autotrader *at)
|
||||
{
|
||||
int8 vending_openvending( map_session_data& sd, const char* message, const uint8* data, int count, struct s_autotrader *at ){
|
||||
int i, j;
|
||||
int vending_skill_lvl;
|
||||
char message_sql[MESSAGE_SIZE*2];
|
||||
StringBuf buf;
|
||||
|
||||
// TODO: Change sd to reference
|
||||
if( sd == nullptr ){
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( pc_isdead(sd) || !sd->state.prevend || pc_istrading(sd)) {
|
||||
if ( pc_isdead(&sd) || !sd.state.prevend || pc_istrading(&sd)) {
|
||||
return 1; // can't open vendings lying dead || didn't use via the skill (wpe/hack) || can't have 2 shops at once
|
||||
}
|
||||
|
||||
vending_skill_lvl = pc_checkskill(sd, MC_VENDING);
|
||||
vending_skill_lvl = pc_checkskill(&sd, MC_VENDING);
|
||||
|
||||
// skill level and cart check
|
||||
if( !vending_skill_lvl || !pc_iscarton(sd) ) {
|
||||
clif_skill_fail( *sd, MC_VENDING );
|
||||
if( !vending_skill_lvl || !pc_iscarton(&sd) ) {
|
||||
clif_skill_fail( sd, MC_VENDING );
|
||||
return 2;
|
||||
}
|
||||
|
||||
// check number of items in shop
|
||||
if( count < 1 || count > MAX_VENDING || count > 2 + vending_skill_lvl ) { // invalid item count
|
||||
clif_skill_fail( *sd, MC_VENDING );
|
||||
clif_skill_fail( sd, MC_VENDING );
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (save_settings&CHARSAVE_VENDING) // Avoid invalid data from saving
|
||||
chrif_save(sd, CSAVE_INVENTORY|CSAVE_CART);
|
||||
chrif_save(&sd, CSAVE_INVENTORY|CSAVE_CART);
|
||||
|
||||
// filter out invalid items
|
||||
i = 0;
|
||||
@ -338,51 +332,51 @@ int8 vending_openvending(map_session_data* sd, const char* message, const uint8*
|
||||
index -= 2; // offset adjustment (client says that the first cart position is 2)
|
||||
|
||||
if( index < 0 || index >= MAX_CART // invalid position
|
||||
|| pc_cartitem_amount(sd, index, amount) < 0 // invalid item or insufficient quantity
|
||||
|| pc_cartitem_amount(&sd, index, amount) < 0 // invalid item or insufficient quantity
|
||||
//NOTE: official server does not do any of the following checks!
|
||||
|| !sd->cart.u.items_cart[index].identify // unidentified item
|
||||
|| sd->cart.u.items_cart[index].attribute == 1 // broken item
|
||||
|| sd->cart.u.items_cart[index].expire_time // It should not be in the cart but just in case
|
||||
|| (sd->cart.u.items_cart[index].bound && !pc_can_give_bounded_items(sd)) // can't trade account bound items and has no permission
|
||||
|| !itemdb_cantrade(&sd->cart.u.items_cart[index], pc_get_group_level(sd), pc_get_group_level(sd)) ) // untradeable item
|
||||
|| !sd.cart.u.items_cart[index].identify // unidentified item
|
||||
|| sd.cart.u.items_cart[index].attribute == 1 // broken item
|
||||
|| sd.cart.u.items_cart[index].expire_time // It should not be in the cart but just in case
|
||||
|| (sd.cart.u.items_cart[index].bound && !pc_can_give_bounded_items(&sd)) // can't trade account bound items and has no permission
|
||||
|| !itemdb_cantrade(&sd.cart.u.items_cart[index], pc_get_group_level(&sd), pc_get_group_level(&sd)) ) // untradeable item
|
||||
continue;
|
||||
|
||||
sd->vending[i].index = index;
|
||||
sd->vending[i].amount = amount;
|
||||
sd->vending[i].value = min(value, (unsigned int)battle_config.vending_max_value);
|
||||
sd.vending[i].index = index;
|
||||
sd.vending[i].amount = amount;
|
||||
sd.vending[i].value = min(value, (unsigned int)battle_config.vending_max_value);
|
||||
i++; // item successfully added
|
||||
}
|
||||
|
||||
if (i != j) {
|
||||
clif_displaymessage(sd->fd, msg_txt(sd, 266)); //"Some of your items cannot be vended and were removed from the shop."
|
||||
clif_skill_fail( *sd, MC_VENDING ); // custom reply packet
|
||||
clif_displaymessage(sd.fd, msg_txt(&sd, 266)); //"Some of your items cannot be vended and were removed from the shop."
|
||||
clif_skill_fail( sd, MC_VENDING ); // custom reply packet
|
||||
return 5;
|
||||
}
|
||||
|
||||
if( i == 0 ) { // no valid item found
|
||||
clif_skill_fail( *sd, MC_VENDING ); // custom reply packet
|
||||
clif_skill_fail( sd, MC_VENDING ); // custom reply packet
|
||||
return 5;
|
||||
}
|
||||
|
||||
sd->state.prevend = 0;
|
||||
sd->state.vending = true;
|
||||
sd->state.workinprogress = WIP_DISABLE_NONE;
|
||||
sd->vender_id = vending_getuid();
|
||||
sd->vend_num = i;
|
||||
safestrncpy(sd->message, message, MESSAGE_SIZE);
|
||||
sd.state.prevend = 0;
|
||||
sd.state.vending = true;
|
||||
sd.state.workinprogress = WIP_DISABLE_NONE;
|
||||
sd.vender_id = vending_getuid();
|
||||
sd.vend_num = i;
|
||||
safestrncpy(sd.message, message, MESSAGE_SIZE);
|
||||
|
||||
Sql_EscapeString( mmysql_handle, message_sql, sd->message );
|
||||
Sql_EscapeString( mmysql_handle, message_sql, sd.message );
|
||||
|
||||
if( Sql_Query( mmysql_handle, "INSERT INTO `%s`(`id`, `account_id`, `char_id`, `sex`, `map`, `x`, `y`, `title`, `autotrade`, `body_direction`, `head_direction`, `sit`) "
|
||||
"VALUES( %d, %d, %d, '%c', '%s', %d, %d, '%s', %d, '%d', '%d', '%d' );",
|
||||
vendings_table, sd->vender_id, sd->status.account_id, sd->status.char_id, sd->status.sex == SEX_FEMALE ? 'F' : 'M', map_getmapdata(sd->bl.m)->name, sd->bl.x, sd->bl.y, message_sql, sd->state.autotrade, at ? at->dir : sd->ud.dir, at ? at->head_dir : sd->head_dir, at ? at->sit : pc_issit(sd) ) != SQL_SUCCESS ) {
|
||||
vendings_table, sd.vender_id, sd.status.account_id, sd.status.char_id, sd.status.sex == SEX_FEMALE ? 'F' : 'M', map_getmapdata(sd.bl.m)->name, sd.bl.x, sd.bl.y, message_sql, sd.state.autotrade, at ? at->dir : sd.ud.dir, at ? at->head_dir : sd.head_dir, at ? at->sit : pc_issit(&sd) ) != SQL_SUCCESS ) {
|
||||
Sql_ShowDebug(mmysql_handle);
|
||||
}
|
||||
|
||||
StringBuf_Init(&buf);
|
||||
StringBuf_Printf(&buf, "INSERT INTO `%s`(`vending_id`,`index`,`cartinventory_id`,`amount`,`price`) VALUES", vending_items_table);
|
||||
for (j = 0; j < i; j++) {
|
||||
StringBuf_Printf(&buf, "(%d,%d,%d,%d,%d)", sd->vender_id, j, sd->cart.u.items_cart[sd->vending[j].index].id, sd->vending[j].amount, sd->vending[j].value);
|
||||
StringBuf_Printf(&buf, "(%d,%d,%d,%d,%d)", sd.vender_id, j, sd.cart.u.items_cart[sd.vending[j].index].id, sd.vending[j].amount, sd.vending[j].value);
|
||||
if (j < i-1)
|
||||
StringBuf_AppendStr(&buf, ",");
|
||||
}
|
||||
@ -390,10 +384,10 @@ int8 vending_openvending(map_session_data* sd, const char* message, const uint8*
|
||||
Sql_ShowDebug(mmysql_handle);
|
||||
StringBuf_Destroy(&buf);
|
||||
|
||||
clif_openvending(sd,sd->bl.id,sd->vending);
|
||||
clif_showvendingboard( *sd );
|
||||
clif_openvending(&sd,sd.bl.id,sd.vending);
|
||||
clif_showvendingboard( sd );
|
||||
|
||||
idb_put(vending_db, sd->status.char_id, sd);
|
||||
idb_put(vending_db, sd.status.char_id, &sd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -497,15 +491,13 @@ bool vending_searchall(map_session_data* sd, const struct s_search_store_search*
|
||||
* Open vending for Autotrader
|
||||
* @param sd Player as autotrader
|
||||
*/
|
||||
void vending_reopen( map_session_data* sd )
|
||||
void vending_reopen( map_session_data& sd )
|
||||
{
|
||||
struct s_autotrader *at = NULL;
|
||||
int8 fail = -1;
|
||||
|
||||
nullpo_retv(sd);
|
||||
|
||||
// Open vending for this autotrader
|
||||
if ((at = (struct s_autotrader *)uidb_get(vending_autotrader_db, sd->status.char_id)) && at->count && at->entries) {
|
||||
if ((at = (struct s_autotrader *)uidb_get(vending_autotrader_db, sd.status.char_id)) && at->count && at->entries) {
|
||||
uint8 *data, *p;
|
||||
uint16 j, count;
|
||||
|
||||
@ -519,7 +511,7 @@ void vending_reopen( map_session_data* sd )
|
||||
uint32 *value = (uint32*)(p + 4);
|
||||
|
||||
// Find item position in cart
|
||||
ARR_FIND(0, MAX_CART, entry->index, sd->cart.u.items_cart[entry->index].id == entry->cartinventory_id);
|
||||
ARR_FIND(0, MAX_CART, entry->index, sd.cart.u.items_cart[entry->index].id == entry->cartinventory_id);
|
||||
|
||||
if (entry->index == MAX_CART) {
|
||||
count--;
|
||||
@ -527,35 +519,35 @@ void vending_reopen( map_session_data* sd )
|
||||
}
|
||||
|
||||
*index = entry->index + 2;
|
||||
*amount = itemdb_isstackable(sd->cart.u.items_cart[entry->index].nameid) ? entry->amount : 1;
|
||||
*amount = itemdb_isstackable(sd.cart.u.items_cart[entry->index].nameid) ? entry->amount : 1;
|
||||
*value = entry->price;
|
||||
|
||||
p += 8;
|
||||
}
|
||||
|
||||
sd->state.prevend = 1; // Set him into a hacked prevend state
|
||||
sd->state.autotrade = 1;
|
||||
sd.state.prevend = 1; // Set him into a hacked prevend state
|
||||
sd.state.autotrade = 1;
|
||||
|
||||
// Make sure abort all NPCs
|
||||
npc_event_dequeue(sd);
|
||||
pc_cleareventtimer(sd);
|
||||
npc_event_dequeue(&sd);
|
||||
pc_cleareventtimer(&sd);
|
||||
|
||||
// Open the vending again
|
||||
if( (fail = vending_openvending(sd, at->title, data, count, at)) == 0 ) {
|
||||
// Make vendor look perfect
|
||||
pc_setdir(sd, at->dir, at->head_dir);
|
||||
clif_changed_dir(&sd->bl, AREA_WOS);
|
||||
pc_setdir(&sd, at->dir, at->head_dir);
|
||||
clif_changed_dir(&sd.bl, AREA_WOS);
|
||||
if( at->sit ) {
|
||||
pc_setsit(sd);
|
||||
skill_sit(sd, 1);
|
||||
clif_sitting(&sd->bl);
|
||||
pc_setsit(&sd);
|
||||
skill_sit(&sd, 1);
|
||||
clif_sitting(&sd.bl);
|
||||
}
|
||||
|
||||
// Immediate save
|
||||
chrif_save(sd, CSAVE_AUTOTRADE);
|
||||
chrif_save(&sd, CSAVE_AUTOTRADE);
|
||||
|
||||
ShowInfo("Vending loaded for '" CL_WHITE "%s" CL_RESET "' with '" CL_WHITE "%d" CL_RESET "' items at " CL_WHITE "%s (%d,%d)" CL_RESET "\n",
|
||||
sd->status.name, count, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);
|
||||
sd.status.name, count, mapindex_id2name(sd.mapindex), sd.bl.x, sd.bl.y);
|
||||
}
|
||||
aFree(data);
|
||||
}
|
||||
@ -567,8 +559,8 @@ void vending_reopen( map_session_data* sd )
|
||||
}
|
||||
|
||||
if (fail != 0) {
|
||||
ShowError("vending_reopen: (Error:%d) Load failed for autotrader '" CL_WHITE "%s" CL_RESET "' (CID=%d/AID=%d)\n", fail, sd->status.name, sd->status.char_id, sd->status.account_id);
|
||||
map_quit(sd);
|
||||
ShowError("vending_reopen: (Error:%d) Load failed for autotrader '" CL_WHITE "%s" CL_RESET "' (CID=%d/AID=%d)\n", fail, sd.status.name, sd.status.char_id, sd.status.account_id);
|
||||
map_quit(&sd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,9 @@ void do_final_vending(void);
|
||||
void do_init_vending(void);
|
||||
void do_init_vending_autotrade( void );
|
||||
|
||||
void vending_reopen( map_session_data* sd );
|
||||
void vending_reopen( map_session_data& sd );
|
||||
void vending_closevending(map_session_data* sd);
|
||||
int8 vending_openvending(map_session_data* sd, const char* message, const uint8* data, int count, struct s_autotrader *at);
|
||||
int8 vending_openvending( map_session_data& sd, const char* message, const uint8* data, int count, struct s_autotrader *at );
|
||||
void vending_vendinglistreq(map_session_data* sd, int id);
|
||||
void vending_purchasereq(map_session_data* sd, int aid, int uid, const uint8* data, int count);
|
||||
bool vending_search(map_session_data* sd, t_itemid nameid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user