int needed = sd,skill->dbs->db[skill_id].itemid[i];
int id;
if(needed == ITEMID_WHITE_POTION)
{
if (map->list[sd->bl.m].flag.gvg)
id = pc->search_inventory(sd, ITEMID_WOEWHITEPOT);
else if(map->list[sd->bl.m].flag.battleground)
id = pc->search_inventory(sd, ITEMID_BGWHITEPOT);
else id = pc->search_inventory(sd,skill->dbs->db[skill_id].itemid[x]);
if(id != INDEX_NOT_FOUND)
j = id;
}
else if(needed == ITEMID_BLUE_POTION)
{
if (map->list[sd->bl.m].flag.gvg)
id = pc->search_inventory(sd, ITEMID_WOEBLUEPOT);
else if(map->list[sd->bl.m].flag.battleground)
id = pc->search_inventory(sd, ITEMID_BGBLUEPOT);
else id = pc->search_inventory(sd,skill->dbs->db[skill_id].itemid[x]);
if(id != INDEX_NOT_FOUND)
j = id;
}