Fixed wrong mvp format string for @mobinfo (would not show big mvp exp rewards correctly).

Added data length check to chrif_authok(), to detect a mismatch between charserver's and mapserver's mmo_charstatus structure size.
Corrected some typos in the cash shop code.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12277 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2008-03-02 17:36:59 +00:00
parent 0e67834489
commit d84310bc4e
6 changed files with 23 additions and 14 deletions

View File

@ -6962,7 +6962,7 @@ int atcommand_mobinfo(const int fd, struct map_session_data* sd, const char* com
clif_displaymessage(fd, atcmd_output); clif_displaymessage(fd, atcmd_output);
// mvp // mvp
if (mob->mexp) { if (mob->mexp) {
sprintf(atcmd_output, " MVP Bonus EXP:%d %02.02f%%", mob->mexp, (float)mob->mexpper / 100); sprintf(atcmd_output, " MVP Bonus EXP:%u %02.02f%%", mob->mexp, (float)mob->mexpper / 100);
clif_displaymessage(fd, atcmd_output); clif_displaymessage(fd, atcmd_output);
strcpy(atcmd_output, " MVP Items:"); strcpy(atcmd_output, " MVP Items:");
j = 0; j = 0;

View File

@ -543,6 +543,14 @@ void chrif_authok(int fd)
struct mmo_charstatus *status = (struct mmo_charstatus *)RFIFOP(fd, 20); struct mmo_charstatus *status = (struct mmo_charstatus *)RFIFOP(fd, 20);
int char_id = status->char_id; int char_id = status->char_id;
TBL_PC* sd; TBL_PC* sd;
//Check if both servers agree on the struct's size
if( RFIFOW(fd,2) - 20 != sizeof(struct mmo_charstatus) )
{
ShowError("chrif_authok: Data size mismatch! %d != %d\n", RFIFOW(fd,2) - 20, sizeof(struct mmo_charstatus));
return;
}
//Check if we don't already have player data in our server //Check if we don't already have player data in our server
//Causes problems if the currently connected player tries to quit or this data belongs to an already connected player which is trying to re-auth. //Causes problems if the currently connected player tries to quit or this data belongs to an already connected player which is trying to re-auth.
if ((sd = map_id2sd(account_id)) != NULL) if ((sd = map_id2sd(account_id)) != NULL)

View File

@ -11723,7 +11723,7 @@ void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd)
{ {
struct item_data* id = itemdb_search(nd->u.shop.shop_item[i].nameid); struct item_data* id = itemdb_search(nd->u.shop.shop_item[i].nameid);
WFIFOL(fd,12+i*11) = nd->u.shop.shop_item[i].value; WFIFOL(fd,12+i*11) = nd->u.shop.shop_item[i].value;
WFIFOL(fd,16+i*11) = nd->u.shop.shop_item[i].value; // Discount Prize? Maybe a Discount item WFIFOL(fd,16+i*11) = nd->u.shop.shop_item[i].value; // Discount Price? Maybe a Discount item
WFIFOB(fd,20+i*11) = itemtype(id->type); WFIFOB(fd,20+i*11) = itemtype(id->type);
WFIFOW(fd,21+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; WFIFOW(fd,21+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid;
} }

View File

@ -110,6 +110,7 @@ int npc_enable_sub(struct block_list *bl, va_list ap)
//aFree(name); //aFree(name);
return 0; return 0;
} }
int npc_enable(const char* name, int flag) int npc_enable(const char* name, int flag)
{ {
struct npc_data* nd = strdb_get(npcname_db, name); struct npc_data* nd = strdb_get(npcname_db, name);
@ -1022,7 +1023,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
{ {
struct npc_data *nd = (struct npc_data *)map_id2bl(sd->npc_shopid); struct npc_data *nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
struct item_data *item; struct item_data *item;
int i, prize, w; int i, price, w;
if( !nd || nd->subtype != CASHSHOP ) if( !nd || nd->subtype != CASHSHOP )
return 1; return 1;
@ -1060,16 +1061,16 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
if( w + sd->weight > sd->max_weight ) if( w + sd->weight > sd->max_weight )
return 3; return 3;
prize = nd->u.shop.shop_item[i].value * amount; price = nd->u.shop.shop_item[i].value * amount;
if( points > prize ) if( points > price )
points = prize; points = price;
if( sd->cashPoints < prize - points ) if( sd->cashPoints < price - points )
return 6; return 6;
if( sd->kafraPoints < points ) if( sd->kafraPoints < points )
return 6; return 6;
pc_paycash(sd, prize, points); pc_paycash(sd, price, points);
if( !pet_create_egg(sd, nameid) ) if( !pet_create_egg(sd, nameid) )
{ {
@ -1673,7 +1674,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
if( value < 0 ) if( value < 0 )
{ {
if( type == SHOP ) value = id->value_buy; if( type == SHOP ) value = id->value_buy;
else value = 0; // Cashshop don't have a "buy prize" in the item_db else value = 0; // Cashshop doesn't have a "buy price" in the item_db
} }
if( type == SHOP && value*0.75 < id->value_sell*1.24 ) if( type == SHOP && value*0.75 < id->value_sell*1.24 )

View File

@ -2702,10 +2702,10 @@ int pc_payzeny(struct map_session_data *sd,int zeny)
* Cash Shop * Cash Shop
*------------------------------------------*/ *------------------------------------------*/
void pc_paycash(struct map_session_data *sd, int prize, int points) void pc_paycash(struct map_session_data *sd, int price, int points)
{ {
char output[128]; char output[128];
int cash = prize - points; int cash = price - points;
nullpo_retv(sd); nullpo_retv(sd);
if( cash > 0 ) if( cash > 0 )

View File

@ -178,7 +178,7 @@ int pc_getzeny(struct map_session_data*,int);
int pc_delitem(struct map_session_data*,int,int,int); int pc_delitem(struct map_session_data*,int,int,int);
// Special Shop System // Special Shop System
void pc_paycash(struct map_session_data *sd, int prize, int points); void pc_paycash(struct map_session_data *sd, int price, int points);
void pc_getcash(struct map_session_data *sd, int cash, int points); void pc_getcash(struct map_session_data *sd, int cash, int points);
int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount); int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount);