viewing paste topic/4812- town_banker.c | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../map/pc.h"
#include "../map/clif.h"
#include "../common/HPMi.h"
 
#include "../common/HPMDataCheck.h" // should always be the last file included! (if you don't make it last, it'll intentionally break compile time)
 
HPExport struct hplugin_info pinfo = {
    "townbanking",          // Plugin name
    SERVER_TYPE_MAP,// Which server types this plugin works with?
    "0.1",          // Plugin version
    HPM_VERSION,    // HPM Version (don't change, macro is automatically updated)
};
 
int tmp_feature_banking;
 
void clif_pBankCheck_pre(int fd, struct map_session_data* sd) {
    tmp_feature_banking = battle->bc->feature_banking;
    if ( !map->list[sd->bl.m].flag.town )
        battle->bc->feature_banking = 0;
    return;
}
 
void clif_pBankCheck_post(int retVal,int fd, struct map_session_data* sd) {
    if ( battle->bc->feature_banking != tmp_feature_banking )
        battle->bc->feature_banking = tmp_feature_banking;
    return;
}
 
HPExport void plugin_init (void)
{
    battle = GET_SYMBOL("battle");
    map = GET_SYMBOL("map");
 
    addHookPre("clif->pBankCheck", clif_pBankCheck_pre);
    addHookPost("clif->pBankCheck",clif_pBankCheck_post);
}
Viewed 1286 times, submitted by AnnieRuru.