Bug Fixes
* Fixed the cash shop stacking non-stackable items upon purchase. (bugreport:7580, bugreport:7879, bugreport:8224) * Fixed an issue with selling pet eggs in the cash shop (Hercules d57781c) * Cleaned up some compile warnings from CPPCheck. (bugreport:9043)
This commit is contained in:
parent
9eb5e60b8e
commit
fff4877004
@ -533,11 +533,10 @@ int chclif_parse_char_delete2_cancel(int fd, struct char_session_data* sd) {
|
||||
* charserv can handle a MAX_SERVERS mapservs
|
||||
*/
|
||||
int chclif_parse_maplogin(int fd){
|
||||
int i;
|
||||
|
||||
if (RFIFOREST(fd) < 60)
|
||||
return 0;
|
||||
else {
|
||||
int i;
|
||||
char* l_user = (char*)RFIFOP(fd,2);
|
||||
char* l_pass = (char*)RFIFOP(fd,26);
|
||||
l_user[23] = '\0';
|
||||
@ -810,7 +809,7 @@ int chclif_parse_charselect(int fd, struct char_session_data* sd,uint32 ipl){
|
||||
// S 0970 <name>.24B <slot>.B <hair color>.W <hair style>.W
|
||||
// S 0067 <name>.24B <str>.B <agi>.B <vit>.B <int>.B <dex>.B <luk>.B <slot>.B <hair color>.W <hair style>.W
|
||||
int chclif_parse_createnewchar(int fd, struct char_session_data* sd,int cmd){
|
||||
int i=0, ch;
|
||||
int i = 0;
|
||||
|
||||
if (cmd == 0x970) FIFOSD_CHECK(31) //>=20120307
|
||||
else if (cmd == 0x67) FIFOSD_CHECK(37)
|
||||
@ -843,7 +842,7 @@ int chclif_parse_createnewchar(int fd, struct char_session_data* sd,int cmd){
|
||||
}
|
||||
WFIFOSET(fd,3);
|
||||
} else {
|
||||
int len;
|
||||
int len, ch;
|
||||
// retrieve data
|
||||
struct mmo_charstatus char_dat;
|
||||
char_mmo_char_fromsql(i, &char_dat, false); //Only the short data is needed.
|
||||
@ -1093,7 +1092,6 @@ int chclif_parse_chkcaptcha(int fd){
|
||||
* @param fd: file descriptor to parse, (link to client)
|
||||
*/
|
||||
int chclif_parse(int fd) {
|
||||
unsigned short cmd;
|
||||
struct char_session_data* sd = (struct char_session_data*)session[fd]->session_data;
|
||||
uint32 ipl = session[fd]->client_addr;
|
||||
|
||||
@ -1118,7 +1116,9 @@ int chclif_parse(int fd) {
|
||||
|
||||
while( RFIFOREST(fd) >= 2 )
|
||||
{
|
||||
int next=1;
|
||||
int next = 1;
|
||||
unsigned short cmd;
|
||||
|
||||
cmd = RFIFOW(fd,0);
|
||||
switch( cmd )
|
||||
{
|
||||
|
@ -956,7 +956,7 @@ int chmapif_parse_reqauth(int fd, int id){
|
||||
struct auth_node* node;
|
||||
struct mmo_charstatus* cd;
|
||||
struct mmo_charstatus char_dat;
|
||||
bool autotrade = false;
|
||||
bool autotrade;
|
||||
|
||||
DBMap* auth_db = char_get_authdb();
|
||||
DBMap* char_db_ = char_get_chardb();
|
||||
@ -966,7 +966,7 @@ int chmapif_parse_reqauth(int fd, int id){
|
||||
login_id1 = RFIFOL(fd,10);
|
||||
sex = RFIFOB(fd,14);
|
||||
ip = ntohl(RFIFOL(fd,15));
|
||||
autotrade = RFIFOB(fd,19);
|
||||
autotrade = RFIFOB(fd,19);
|
||||
RFIFOSKIP(fd,20);
|
||||
|
||||
node = (struct auth_node*)idb_get(auth_db, account_id);
|
||||
|
@ -121,18 +121,18 @@ int inter_pet_delete(int pet_id){
|
||||
//------------------------------------------------------
|
||||
int mapif_pet_created(int fd, int account_id, struct s_pet *p)
|
||||
{
|
||||
WFIFOHEAD(fd, 11);
|
||||
WFIFOW(fd, 0) =0x3880;
|
||||
WFIFOL(fd, 2) =account_id;
|
||||
WFIFOHEAD(fd, 12);
|
||||
WFIFOW(fd, 0) = 0x3880;
|
||||
WFIFOL(fd, 2) = account_id;
|
||||
if(p!=NULL){
|
||||
WFIFOB(fd, 6)=0;
|
||||
WFIFOL(fd, 7) =p->pet_id;
|
||||
WFIFOW(fd, 6) = p->class_;
|
||||
WFIFOL(fd, 8) = p->pet_id;
|
||||
ShowInfo("int_pet: created pet %d - %s\n", p->pet_id, p->name);
|
||||
}else{
|
||||
WFIFOB(fd, 6)=1;
|
||||
WFIFOL(fd, 7)=0;
|
||||
WFIFOB(fd, 6) = 0;
|
||||
WFIFOL(fd, 8) = 0;
|
||||
}
|
||||
WFIFOSET(fd, 11);
|
||||
WFIFOSET(fd, 12);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -232,9 +232,8 @@ bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, u
|
||||
clif_cashshop_result( sd, nameid, CASHSHOP_RESULT_ERROR_UNKONWN_ITEM );
|
||||
return false;
|
||||
}else if( !itemdb_isstackable( nameid ) && quantity > 1 ){
|
||||
uint32* quantity_ptr = (uint32*)item_list + i * 5 + 2;
|
||||
ShowWarning( "Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable cash item %hu!\n", sd->status.name, sd->status.account_id, sd->status.char_id, quantity, nameid );
|
||||
*quantity_ptr = 1;
|
||||
/* ShowWarning( "Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable cash item %hu!\n", sd->status.name, sd->status.account_id, sd->status.char_id, quantity, nameid ); */
|
||||
quantity = 1;
|
||||
}
|
||||
|
||||
switch( pc_checkadditem( sd, nameid, quantity ) ){
|
||||
@ -271,9 +270,10 @@ bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, u
|
||||
unsigned short nameid = *( item_list + i * 5 );
|
||||
uint32 quantity = *( item_list + i * 5 + 2 );
|
||||
|
||||
if( itemdb_type( nameid ) == IT_PETEGG ){
|
||||
pet_create_egg( sd, nameid );
|
||||
}else{
|
||||
if (!itemdb_isstackable(nameid) && quantity > 1)
|
||||
quantity = 1;
|
||||
|
||||
if (!pet_create_egg(sd, nameid)) {
|
||||
struct item item_tmp;
|
||||
memset( &item_tmp, 0, sizeof( item_tmp ) );
|
||||
|
||||
|
@ -753,7 +753,7 @@ void clif_dropflooritem(struct flooritem_data* fitem)
|
||||
|
||||
nullpo_retv(fitem);
|
||||
|
||||
if (fitem->item_data.nameid <= 0)
|
||||
if (fitem->item_data.nameid == 0)
|
||||
return;
|
||||
|
||||
WBUFW(buf, offset+0) = header;
|
||||
|
@ -42,7 +42,7 @@ static const int packet_len_table[]={
|
||||
-1,-1, 7, 7, 7,11, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3850 Auctions [Zephyrus] itembound[Akinari]
|
||||
-1, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3860 Quests [Kevin] [Inkfish]
|
||||
-1, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, 3, 0, //0x3870 Mercenaries [Zephyrus] / Elemental [pakpil]
|
||||
11,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880
|
||||
12,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880
|
||||
-1,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3890 Homunculus [albator]
|
||||
};
|
||||
|
||||
@ -1294,7 +1294,7 @@ int intif_parse_GuildMasterChanged(int fd)
|
||||
// Request pet creation
|
||||
int intif_parse_CreatePet(int fd)
|
||||
{
|
||||
pet_get_egg(RFIFOL(fd,2),RFIFOL(fd,7),RFIFOB(fd,6));
|
||||
pet_get_egg(RFIFOL(fd,2),RFIFOW(fd,6),RFIFOL(fd,8));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -750,7 +750,7 @@ static bool itemdb_read_itemtrade(char* str[], int columns, int current) {
|
||||
flag = atoi(str[1]);
|
||||
gmlv = atoi(str[2]);
|
||||
|
||||
if( flag < 0 || flag > 511 ) {//Check range
|
||||
if( flag > 511 ) {//Check range
|
||||
ShowWarning("itemdb_read_itemtrade: Invalid trading mask %hu for item id %hu.\n", flag, nameid);
|
||||
return false;
|
||||
}
|
||||
|
@ -3264,7 +3264,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
|
||||
x = bl->x;
|
||||
y = bl->y;
|
||||
// Look for an area to cast the spell around...
|
||||
if (skill_target >= MST_AROUND1 || skill_target >= MST_AROUND5) {
|
||||
if (skill_target >= MST_AROUND5) {
|
||||
j = skill_target >= MST_AROUND1?
|
||||
(skill_target-MST_AROUND1) +1:
|
||||
(skill_target-MST_AROUND5) +1;
|
||||
|
@ -4247,7 +4247,7 @@ char pc_additem(struct map_session_data *sd,struct item *item,int amount,e_log_p
|
||||
nullpo_retr(1, sd);
|
||||
nullpo_retr(1, item);
|
||||
|
||||
if( item->nameid <= 0 || amount <= 0 )
|
||||
if( item->nameid == 0 || amount <= 0 )
|
||||
return ADDITEM_INVALID;
|
||||
if( amount > MAX_AMOUNT )
|
||||
return ADDITEM_OVERAMOUNT;
|
||||
@ -4686,7 +4686,7 @@ int pc_useitem(struct map_session_data *sd,int n)
|
||||
item = sd->status.inventory[n];
|
||||
id = sd->inventory_data[n];
|
||||
|
||||
if (item.nameid <= 0 || item.amount <= 0)
|
||||
if (item.nameid == 0 || item.amount <= 0)
|
||||
return 0;
|
||||
|
||||
if( !pc_isUseitem(sd,n) )
|
||||
@ -4812,7 +4812,7 @@ unsigned char pc_cart_additem(struct map_session_data *sd,struct item *item,int
|
||||
nullpo_retr(1, sd);
|
||||
nullpo_retr(1, item);
|
||||
|
||||
if(item->nameid <= 0 || amount <= 0)
|
||||
if(item->nameid == 0 || amount <= 0)
|
||||
return 1;
|
||||
data = itemdb_search(item->nameid);
|
||||
|
||||
|
@ -548,26 +548,38 @@ int pet_catch_process2(struct map_session_data* sd, int target_id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pet_get_egg(int account_id,int pet_id,int flag)
|
||||
{ //This function is invoked when a new pet has been created, and at no other time!
|
||||
/**
|
||||
* Is invoked _only_ when a new pet has been created is a product of packet 0x3880
|
||||
* see mapif_pet_created@int_pet.c for more information
|
||||
* Handles new pet data from inter-server and prepares item information
|
||||
* to add pet egg
|
||||
*
|
||||
* pet_id - Should contain pet id otherwise means failure
|
||||
* returns true on success
|
||||
**/
|
||||
bool pet_get_egg(int account_id, short pet_class, int pet_id ) {
|
||||
struct map_session_data *sd;
|
||||
struct item tmp_item;
|
||||
int i=0;
|
||||
unsigned char ret = 0;
|
||||
int i = 0, ret = 0;
|
||||
|
||||
if(flag)
|
||||
return 0;
|
||||
if( pet_id == 0 || pet_class == 0 )
|
||||
return false;
|
||||
|
||||
sd = map_id2sd(account_id);
|
||||
if(sd == NULL)
|
||||
return 0;
|
||||
if( sd == NULL )
|
||||
return false;
|
||||
|
||||
i = search_petDB_index(sd->catch_target_class,PET_CLASS);
|
||||
// i = pet_search_petDB_index(sd->catch_target_class,PET_CLASS);
|
||||
// issue: 8150
|
||||
// Before this change in cases where more than one pet egg were requested in a short
|
||||
// period of time it wasn't possible to know which kind of egg was being requested after
|
||||
// the first request. [Panikon]
|
||||
i = search_petDB_index(pet_class,PET_CLASS);
|
||||
sd->catch_target_class = -1;
|
||||
|
||||
if(i < 0) {
|
||||
intif_delete_petdata(pet_id);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
memset(&tmp_item,0,sizeof(tmp_item));
|
||||
@ -582,7 +594,7 @@ int pet_get_egg(int account_id,int pet_id,int flag)
|
||||
map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd);
|
||||
|
@ -115,7 +115,7 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag);
|
||||
int pet_select_egg(struct map_session_data *sd,short egg_index);
|
||||
int pet_catch_process1(struct map_session_data *sd,int target_class);
|
||||
int pet_catch_process2(struct map_session_data *sd,int target_id);
|
||||
int pet_get_egg(int account_id,int pet_id,int flag);
|
||||
bool pet_get_egg(int account_id, short pet_class, int pet_id);
|
||||
int pet_menu(struct map_session_data *sd,int menunum);
|
||||
int pet_change_name(struct map_session_data *sd,char *name);
|
||||
int pet_change_name_ack(struct map_session_data *sd, char* name, int flag);
|
||||
|
@ -12494,7 +12494,7 @@ BUILDIN_FUNC(getiteminfo)
|
||||
n = script_getnum(st,3);
|
||||
i_data = itemdb_exists(item_id);
|
||||
|
||||
if (i_data && n>=0 && n<=14) {
|
||||
if (i_data && n <= 14) {
|
||||
item_arr = (int*)&i_data->value_buy;
|
||||
script_pushint(st,item_arr[n]);
|
||||
} else
|
||||
|
@ -12229,8 +12229,6 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un
|
||||
{
|
||||
struct skill_unit_group *sg;
|
||||
struct block_list *ss;
|
||||
TBL_PC* sd;
|
||||
struct status_data *status;
|
||||
struct status_change *sc;
|
||||
struct status_change_entry *sce;
|
||||
enum sc_type type;
|
||||
@ -12252,9 +12250,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un
|
||||
if( skill_get_inf2(sg->skill_id)&(INF2_SONG_DANCE|INF2_ENSEMBLE_SKILL) && map_getcell(bl->m, bl->x, bl->y, CELL_CHKBASILICA) )
|
||||
return 0; //Songs don't work in Basilica
|
||||
|
||||
sd = BL_CAST(BL_PC,bl);
|
||||
sc = status_get_sc(bl);
|
||||
status = status_get_status_data(bl);
|
||||
|
||||
if (sc && sc->option&OPTION_HIDE && sg->skill_id != WZ_HEAVENDRIVE && sg->skill_id != WL_EARTHSTRAIN)
|
||||
return 0; //Hidden characters are immune to AoE skills except to these. [Skotlex]
|
||||
@ -15617,7 +15613,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) {
|
||||
return; //Invalid index??
|
||||
|
||||
item = &target_sd->status.inventory[idx];
|
||||
if( item->nameid <= 0 || item->attribute == 0 )
|
||||
if( item->nameid == 0 || item->attribute == 0 )
|
||||
return; //Again invalid item....
|
||||
|
||||
if( sd != target_sd && !battle_check_range(&sd->bl,&target_sd->bl, skill_get_range2(&sd->bl, sd->menuskill_id,sd->menuskill_val2) ) ){
|
||||
@ -18134,7 +18130,7 @@ int skill_arrow_create (struct map_session_data *sd, unsigned short nameid)
|
||||
tmp_item.card[2]=GetWord(sd->status.char_id,0); // CharId
|
||||
tmp_item.card[3]=GetWord(sd->status.char_id,1);
|
||||
}
|
||||
if(tmp_item.nameid <= 0 || tmp_item.amount <= 0)
|
||||
if(tmp_item.nameid == 0 || tmp_item.amount <= 0)
|
||||
continue;
|
||||
if((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
|
||||
clif_additem(sd,0,0,flag);
|
||||
|
@ -2023,7 +2023,7 @@ int status_check_visibility(struct block_list *src, struct block_list *target)
|
||||
|
||||
if (((tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK)) || tsc->data[SC_CAMOUFLAGE] || tsc->data[SC_STEALTHFIELD]) && !(status->mode&MD_BOSS) && (tsd->special_state.perfect_hiding || !(status->mode&MD_DETECTOR)))
|
||||
return 0;
|
||||
if (tsc->data[SC_CLOAKINGEXCEED] && !(status->mode&MD_BOSS) && (tsd->special_state.perfect_hiding || (status->mode&MD_DETECTOR)))
|
||||
if (tsc->data[SC_CLOAKINGEXCEED] && !(status->mode&MD_BOSS) && ((tsd &&tsd->special_state.perfect_hiding) || (status->mode&MD_DETECTOR)))
|
||||
return 0;
|
||||
if (tsc && tsc->data[SC__FEINTBOMB] && !(status->mode&(MD_BOSS|MD_DETECTOR)))
|
||||
return 0;
|
||||
|
@ -164,7 +164,7 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
|
||||
struct item_data *data;
|
||||
int i;
|
||||
|
||||
if( item_data->nameid <= 0 || amount <= 0 )
|
||||
if( item_data->nameid == 0 || amount <= 0 )
|
||||
return 1;
|
||||
|
||||
data = itemdb_search(item_data->nameid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user