Issue information

Issue ID
#2567
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Dec 22, 2008 23:42
Last Post
Hercules Elf Bot
Apr 4, 2012 9:07
Confirmation
N/A

Hercules Elf Bot - Dec 22, 2008 23:42

Originally posted by [b]SoulBlaker[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=2567

This more for a suggestion, most think this will help more in cashshop functionality of the system, tested in some of the mods br eathena this until today there and I wonder, why not here?

+ script.c

in npcshopitem:

CODE
    if( !nd || (nd->subtype != SHOP && nd->subtype != CASHSHOP) )
    {    //Not found.
        script_pushint(st,0);
        return 0;
    }


in npcshopadditem:

CODE
    if( !nd || (nd->subtype != SHOP && nd->subtype != CASHSHOP) )
    {    //Not found.
        script_pushint(st,0);
        return 0;
    }


in npcshopdelitem:

CODE
    if( !nd || (nd->subtype != SHOP && nd->subtype != CASHSHOP) )
    {    //Not found.
        script_pushint(st,0);
        return 0;
    }


in npcshopattach:

CODE
    if( !nd || (nd->subtype != SHOP && nd->subtype != CASHSHOP) )
    {    //Not found.
        script_pushint(st,0);
        return 0;
    }



+ end script.c

+ npc.c

add afeter static npc_buylist_sub:

[codebox]
static int npc_cashshop_sub(struct map_session_data *sd, int nameid, int amount, int points, int price, struct npc_data* nd)
{
char npc_ev[NAME_LENGTH*2+3];
int regkey = add_str("@bought_nameid");
int regkey2 = add_str("@bought_amount");
int regkey3 = add_str("@bought_points");
int regkey4 = add_str("@bought_cash");
int cash = price - points;
snprintf(npc_ev, ARRAYLENGTH(npc_ev), "%s::OnCashBuy", nd->exname);
pc_setreg(sd,regkey,nameid);
pc_setreg(sd,regkey2,amount);
pc_setreg(sd,regkey3,points);
pc_setreg(sd,regkey4,cash);
npc_event(sd, npc_ev, 0);
return 0;
}
[/codebox]

in npc_cashshop_buy afeter pc_paycash(sd, price, points);

CODE
if (nd->master_nd)
        return npc_cashshop_sub(sd,nameid,amount,price,points,nd->master_nd);


Functional? (IMG:style_emoticons/default/smile.gif)

Diff Comp. eAr13411: Attached File  changeset_r34.diff ( 2.15K ) Number of downloads: 0


This post has been edited by SoulBlaker: Dec 24 2008, 03:43 PM

Hercules Elf Bot - Dec 10, 2011 0:27

Originally posted by [b]Ind[/b]
has been fixed in a previous revision