diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/battle.c | 4 | ||||
-rw-r--r-- | src/map/clif.c | 47 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/irc-bot.c | 9 | ||||
-rw-r--r-- | src/map/mail.c | 2 | ||||
-rw-r--r-- | src/map/packets_struct.h | 7 | ||||
-rw-r--r-- | src/map/pc.c | 18 | ||||
-rw-r--r-- | src/map/pc.h | 3 | ||||
-rw-r--r-- | src/map/skill.c | 4 | ||||
-rw-r--r-- | src/map/status.c | 4 | ||||
-rw-r--r-- | src/map/status.h | 3 | ||||
-rw-r--r-- | src/map/storage.c | 10 |
12 files changed, 72 insertions, 40 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 135247734..2016efa3b 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -444,8 +444,8 @@ int battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uin if( flag&2 && sd->bonus.arrow_atk ) damage += sd->bonus.arrow_atk; - if( sd->bonus.eatk > 0 ) - eatk = sd->bonus.eatk; + if( sd->battle_status.equip_atk != 0 ) + eatk = sd->base_status.equip_atk; } if( sc && sc->count ){ diff --git a/src/map/clif.c b/src/map/clif.c index f17766f50..1b96d45fb 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11133,13 +11133,16 @@ void clif_parse_StopAttack(int fd,struct map_session_data *sd) /// Request to move an item from inventory to cart (CZ_MOVE_ITEM_FROM_BODY_TO_CART). /// 0126 <index>.W <amount>.L -void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) -{ +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; if (pc_istrading(sd)) return; if (!pc_iscarton(sd)) return; - pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } } @@ -11859,9 +11862,9 @@ void clif_parse_ResetChar(int fd, struct map_session_data *sd) { char cmd[15]; if( RFIFOW(fd,2) ) - sprintf(cmd,"%cresetskill",atcommand->at_symbol); + sprintf(cmd,"%cskreset",atcommand->at_symbol); else - sprintf(cmd,"%cresetstat",atcommand->at_symbol); + sprintf(cmd,"%cstreset",atcommand->at_symbol); atcommand->parse(fd, sd, cmd, 1); } @@ -13376,23 +13379,25 @@ void clif_parse_GMRecall2(int fd, struct map_session_data* sd) void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) { char *monster_item_name; + struct mob_db *mob_data; + struct item_data *item_data; char command[NAME_LENGTH+10]; monster_item_name = (char*)RFIFOP(fd,2); monster_item_name[NAME_LENGTH-1] = '\0'; - // FIXME: Should look for item first, then for monster. - // FIXME: /monster takes mob_db Sprite_Name as argument - if( mobdb_searchname(monster_item_name) ) { - snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, monster_item_name); + if( (item_data=itemdb->search_name(monster_item_name)) != NULL + && strcmp(item_data->name, monster_item_name) != 0 ) { // It only accepts aegis name + if( item_data->type == IT_WEAPON || item_data->type == IT_ARMOR ) // nonstackable + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_data->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_data->nameid); atcommand->parse(fd, sd, command, 1); return; } - // FIXME: Stackables have a quantity of 20. - // FIXME: Equips are supposed to be unidentified. - - if( itemdb->search_name(monster_item_name) ) { - snprintf(command, sizeof(command)-1, "%citem %s", atcommand->at_symbol, monster_item_name); + if( (mob_data=mob_db(mobdb_searchname(monster_item_name))) + && strcmp(mob_data->sprite, monster_item_name) != 0 ) { // It only accepts sprite name + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_data->name); atcommand->parse(fd, sd, command, 1); return; } @@ -17580,7 +17585,18 @@ void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { WFIFOSET(fd,4+(offset*count)); } - +/* [Ind/Hercules] - Data Thanks to Yommy + * - ADDITEM_TO_CART_FAIL_WEIGHT = 0x0 + * - ADDITEM_TO_CART_FAIL_COUNT = 0x1 + */ +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} /* */ unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { if( sd ) { @@ -17917,6 +17933,7 @@ void clif_defaults(void) { clif->addcards2 = clif_addcards2; clif->item_sub = clif_item_sub; clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; /* unit-related */ clif->clearunit_single = clif_clearunit_single; clif->clearunit_area = clif_clearunit_area; diff --git a/src/map/clif.h b/src/map/clif.h index a0946a48a..e1744b4e8 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -501,6 +501,7 @@ struct clif_interface { void (*addcards2) (unsigned short *cards, struct item* item); void (*item_sub) (unsigned char *buf, int n, struct item *i, struct item_data *id, int equip); void (*getareachar_item) (struct map_session_data* sd,struct flooritem_data* fitem); + void (*cart_additem_ack) (struct map_session_data *sd, int flag); void (*cashshop_load) (void); void (*package_announce) (struct map_session_data *sd, unsigned short nameid, unsigned short containerid); /* unit-related */ diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index 0be8074c8..d3782bd9b 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -120,15 +120,12 @@ void irc_parse_source(char *source, char *nick, char *ident, char *host) { for(i = 0; i < len; i++) { if( stage == 0 && source[i] == '!' ) { - memcpy(nick, &source[0], min(i,IRC_NICK_LENGTH)); - nick[i] = '\0'; + safestrncpy(nick, &source[0], min(i + 1, IRC_NICK_LENGTH)); pos = i+1; stage = 1; } else if( stage == 1 && source[i] == '@' ) { - memcpy(ident, &source[pos], min(i - pos,IRC_IDENT_LENGTH)); - ident[i-pos] = '\0'; - memcpy(host, &source[i+1], min(len - i,IRC_HOST_LENGTH)); - host[len] = '\0'; + safestrncpy(ident, &source[pos], min(i - pos + 1, IRC_IDENT_LENGTH)); + safestrncpy(host, &source[i+1], min(len - i, IRC_HOST_LENGTH)); break; } } diff --git a/src/map/mail.c b/src/map/mail.c index 021a51cde..93304bac0 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -200,4 +200,4 @@ void mail_defaults(void) mail->openmail = mail_openmail; mail->deliveryfail = mail_deliveryfail; mail->invalid_operation = mail_invalid_operation; -}
\ No newline at end of file +} diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index f6e6a8a3f..d56e9ce01 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -18,6 +18,7 @@ struct EQUIPSLOTINFO { * **/ enum packet_headers { + cart_additem_ackType = 0x12c, sc_notickType = 0x196, #if PACKETVER < 20061218 additemType = 0xa0, @@ -459,6 +460,7 @@ struct packet_script_clear { short PacketType; unsigned int NpcID; } __attribute__((packed)); + /* made possible thanks to Yommy!! */ struct packet_package_item_announce { short PacketType; @@ -471,6 +473,11 @@ struct packet_package_item_announce { unsigned short BoxItemID; } __attribute__((packed)); +struct packet_cart_additem_ack { + short PacketType; + char result; +} __attribute__((packed)); + #pragma pack(pop) #endif /* _PACKETS_STRUCT_H_ */ diff --git a/src/map/pc.c b/src/map/pc.c index 87e80c264..84cfe7eb3 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2091,8 +2091,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) case SP_BASE_ATK: if(sd->state.lr_flag != 2) { #ifdef RENEWAL - sd->bonus.eatk += val; - clif->updatestatus(sd,SP_ATK2); + status->equip_atk += val; #else bonus = status->batk + val; status->batk = cap_value(bonus, 0, USHRT_MAX); @@ -4432,7 +4431,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun if( !itemdb_cancartstore(item_data, pc->get_group_level(sd)) ) { // Check item trade restrictions [Skotlex] clif->message (sd->fd, msg_txt(264)); - return 1; + return 1;/* TODO: there is no official response to this? */ } if( (w = data->weight*amount) + sd->cart_weight > sd->cart_weight_max ) @@ -4450,7 +4449,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun if( i < MAX_CART ) {// item already in cart, stack it if( amount > MAX_AMOUNT - sd->status.cart[i].amount || ( data->stack.cart && amount > data->stack.amount - sd->status.cart[i].amount ) ) - return 1; // no room + return 2; // no room sd->status.cart[i].amount+=amount; clif->cart_additem(sd,i,amount,0); @@ -4459,7 +4458,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun {// item not stackable or not present, add it ARR_FIND( 0, MAX_CART, i, sd->status.cart[i].nameid == 0 ); if( i == MAX_CART ) - return 1; // no room + return 2; // no room memcpy(&sd->status.cart[i],item_data,sizeof(sd->status.cart[0])); sd->status.cart[i].amount=amount; @@ -4513,6 +4512,7 @@ int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) { struct item *item_data; + int flag; nullpo_ret(sd); @@ -4524,10 +4524,10 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) if( item_data->nameid == 0 || amount < 1 || item_data->amount < amount || sd->state.vending ) return 1; - if( pc->cart_additem(sd,item_data,amount,LOG_TYPE_NONE) == 0 ) + if( (flag = pc->cart_additem(sd,item_data,amount,LOG_TYPE_NONE)) == 0 ) return pc->delitem(sd,idx,amount,0,5,LOG_TYPE_NONE); - return 1; + return flag; } /*========================================== @@ -4569,11 +4569,11 @@ int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount) if(item_data->nameid==0 || amount < 1 || item_data->amount<amount || sd->state.vending ) return 1; + if((flag = pc->additem(sd,item_data,amount,LOG_TYPE_NONE)) == 0) return pc->cart_delitem(sd,idx,amount,0,LOG_TYPE_NONE); - clif->additem(sd,0,0,flag); - return 1; + return flag; } /*========================================== diff --git a/src/map/pc.h b/src/map/pc.h index 7f0e8cf46..58dd85083 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -327,7 +327,6 @@ struct map_session_data { int fixcastrate,varcastrate; int add_fixcast,add_varcast; int ematk; // matk bonus from equipment - int eatk; // atk bonus from equipment } bonus; // zeroed vars end here. int castrate,delayrate,hprate,sprate,dsprate; @@ -655,7 +654,7 @@ enum equip_pos { // clientside display macros (values to the left/right of the "+") #ifdef RENEWAL #define pc_leftside_atk(sd) ((sd)->battle_status.batk) - #define pc_rightside_atk(sd) ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->bonus.eatk ) + #define pc_rightside_atk(sd) ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ) #define pc_leftside_def(sd) ((sd)->battle_status.def2) #define pc_rightside_def(sd) ((sd)->battle_status.def) #define pc_leftside_mdef(sd) ((sd)->battle_status.mdef2) diff --git a/src/map/skill.c b/src/map/skill.c index deb6643c1..1b350f74c 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -744,10 +744,10 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint temp = skill->get_time2(iStatus->sc2skill(type),7); if (sd->addeff[i].flag&ATF_TARGET) - iStatus->change_start(bl,type,rate,7,0,0,0,temp,0); + iStatus->change_start(bl,type,rate,7,0,(type == SC_BURNING)?src->id:0,0,temp,0); if (sd->addeff[i].flag&ATF_SELF) - iStatus->change_start(src,type,rate,7,0,0,0,temp,0); + iStatus->change_start(src,type,rate,7,0,(type == SC_BURNING)?src->id:0,0,temp,0); } } diff --git a/src/map/status.c b/src/map/status.c index 20d88e296..0d8bedc5e 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4045,6 +4045,10 @@ void status_calc_bl_(struct block_list* bl, enum scb_flag flag, bool first) clif->updatestatus(sd,SP_HP); if(b_status.sp != status->sp) clif->updatestatus(sd,SP_SP); +#ifdef RENEWAL + if(b_status.equip_atk != status->equip_atk) + clif->updatestatus(sd,SP_ATK2); +#endif } else if( bl->type == BL_HOM ) { TBL_HOM* hd = BL_CAST(BL_HOM, bl); if( hd->master && memcmp(&b_status, status, sizeof(struct status_data)) != 0 ) diff --git a/src/map/status.h b/src/map/status.h index 11a78dc9f..5f8a515f6 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -1632,6 +1632,9 @@ struct status_data { size, race; struct weapon_atk rhw, lhw; //Right Hand/Left Hand Weapon. +#ifdef RENEWAL + int equip_atk; +#endif }; //Additional regen data that only players have. diff --git a/src/map/storage.c b/src/map/storage.c index 7a4649a98..e0b751863 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -294,8 +294,8 @@ int storage_storageaddfromcart(struct map_session_data* sd, int index, int amoun * 0 : fail * 1 : success *------------------------------------------*/ -int storage_storagegettocart(struct map_session_data* sd, int index, int amount) -{ +int storage_storagegettocart(struct map_session_data* sd, int index, int amount) { + int flag = 0; nullpo_ret(sd); if( index < 0 || index >= MAX_STORAGE ) @@ -307,8 +307,12 @@ int storage_storagegettocart(struct map_session_data* sd, int index, int amount) if( amount < 1 || amount > sd->status.storage.items[index].amount ) return 0; - if( pc->cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE) == 0 ) + if( (flag = pc->cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE)) == 0 ) storage->delitem(sd,index,amount); + else { + clif->dropitem(sd, index,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } return 1; } |