This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -291,6 +291,9 @@ void YamlDatabase::invalidWarning( const YAML::Node &node, const char* fmt, ...

va_start(ap, fmt);

// Remove any remaining garbage of a previous loading line
ShowMessage( CL_CLL );
// Print the actual error
_vShowMessage( MSG_ERROR, fmt, ap );

va_end(ap);
@@ -266,7 +266,7 @@ struct item {
};

//Equip position constants
enum equip_pos {
enum equip_pos : uint32 {
EQP_HEAD_LOW = 0x000001,
EQP_HEAD_MID = 0x000200, // 512
EQP_HEAD_TOP = 0x000100, // 256
@@ -972,9 +972,10 @@ enum e_job {
JOB_MAX,
};

enum e_sex {
enum e_sex : uint8 {
SEX_FEMALE = 0,
SEX_MALE,
SEX_BOTH,
SEX_SERVER
};

@@ -2422,7 +2422,7 @@ ACMD_FUNC(produce)
if ((flag = pc_additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
clif_additem(sd, 0, 0, flag);
} else {
sprintf(atcmd_output, msg_txt(sd,169), item_id, item_data->name); // The item (%u: '%s') is not equipable.
sprintf(atcmd_output, msg_txt(sd,169), item_id, item_data->name.c_str()); // The item (%u: '%s') is not equipable.
clif_displaymessage(fd, atcmd_output);
return -1;
}
@@ -3734,7 +3734,7 @@ ACMD_FUNC(idsearch)
clif_displaymessage(fd, atcmd_output);
}
for(i = 0; i < match; i++) {
sprintf(atcmd_output, msg_txt(sd,78), item_array[i]->jname, item_array[i]->nameid); // %s: %u
sprintf(atcmd_output, msg_txt(sd,78), item_array[i]->ename.c_str(), item_array[i]->nameid); // %s: %u
clif_displaymessage(fd, atcmd_output);
}
sprintf(atcmd_output, msg_txt(sd,79), match); // It is %d affair above.
@@ -6335,7 +6335,7 @@ ACMD_FUNC(autolootitem)
return -1;
}
sd->state.autolootid[i] = item_data->nameid; // Autoloot Activated
sprintf(atcmd_output, msg_txt(sd,1192), item_data->name, item_data->jname, item_data->nameid); // Autolooting item: '%s'/'%s' {%u}
sprintf(atcmd_output, msg_txt(sd,1192), item_data->name.c_str(), item_data->ename.c_str(), item_data->nameid); // Autolooting item: '%s'/'%s' {%u}
clif_displaymessage(fd, atcmd_output);
sd->state.autolooting = 1;
break;
@@ -6346,7 +6346,7 @@ ACMD_FUNC(autolootitem)
return -1;
}
sd->state.autolootid[i] = 0;
sprintf(atcmd_output, msg_txt(sd,1194), item_data->name, item_data->jname, item_data->nameid); // Removed item: '%s'/'%s' {%u} from your autolootitem list.
sprintf(atcmd_output, msg_txt(sd,1194), item_data->name.c_str(), item_data->ename.c_str(), item_data->nameid); // Removed item: '%s'/'%s' {%u} from your autolootitem list.
clif_displaymessage(fd, atcmd_output);
ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] != 0);
if (i == AUTOLOOTITEM_SIZE) {
@@ -6371,7 +6371,7 @@ ACMD_FUNC(autolootitem)
ShowDebug("Non-existant item %d on autolootitem list (account_id: %d, char_id: %d)", sd->state.autolootid[i], sd->status.account_id, sd->status.char_id);
continue;
}
sprintf(atcmd_output, "'%s'/'%s' {%u}", item_data->name, item_data->jname, item_data->nameid);
sprintf(atcmd_output, "'%s'/'%s' {%u}", item_data->name.c_str(), item_data->ename.c_str(), item_data->nameid);
clif_displaymessage(fd, atcmd_output);
}
}
@@ -7424,10 +7424,10 @@ ACMD_FUNC(mobinfo)
#endif
if (pc_isvip(sd)) // Display drop rate increase for VIP
droprate += (droprate * battle_config.vip_drop_increase) / 100;
if (item_data->slot)
sprintf(atcmd_output2, " - %s[%d] %02.02f%%", item_data->jname, item_data->slot, (float)droprate / 100);
if (item_data->slots)
sprintf(atcmd_output2, " - %s[%d] %02.02f%%", item_data->ename.c_str(), item_data->slots, (float)droprate / 100);
else
sprintf(atcmd_output2, " - %s %02.02f%%", item_data->jname, (float)droprate / 100);
sprintf(atcmd_output2, " - %s %02.02f%%", item_data->ename.c_str(), (float)droprate / 100);
strcat(atcmd_output, atcmd_output2);
if (++j % 3 == 0) {
clif_displaymessage(fd, atcmd_output);
@@ -7457,15 +7457,15 @@ ACMD_FUNC(mobinfo)
if (mvppercent > 0) {
j++;
if (j == 1) {
if (item_data->slot)
sprintf(atcmd_output2, " %s[%d] %02.02f%%", item_data->jname, item_data->slot, mvppercent);
if (item_data->slots)
sprintf(atcmd_output2, " %s[%d] %02.02f%%", item_data->ename.c_str(), item_data->slots, mvppercent);
else
sprintf(atcmd_output2, " %s %02.02f%%", item_data->jname, mvppercent);
sprintf(atcmd_output2, " %s %02.02f%%", item_data->ename.c_str(), mvppercent);
} else {
if (item_data->slot)
sprintf(atcmd_output2, " - %s[%d] %02.02f%%", item_data->jname, item_data->slot, mvppercent);
if (item_data->slots)
sprintf(atcmd_output2, " - %s[%d] %02.02f%%", item_data->ename.c_str(), item_data->slots, mvppercent);
else
sprintf(atcmd_output2, " - %s %02.02f%%", item_data->jname, mvppercent);
sprintf(atcmd_output2, " - %s %02.02f%%", item_data->ename.c_str(), mvppercent);
}
strcat(atcmd_output, atcmd_output2);
}
@@ -7890,8 +7890,8 @@ ACMD_FUNC(iteminfo)
for (i = 0; i < count; i++) {
struct item_data * item_data = item_array[i];
sprintf(atcmd_output, msg_txt(sd,1277), // Item: '%s'/'%s'[%d] (%u) Type: %s | Extra Effect: %s
item_data->name,item_data->jname,item_data->slot,item_data->nameid,
(item_data->type != IT_AMMO) ? itemdb_typename((enum item_types)item_data->type) : itemdb_typename_ammo((enum e_item_ammo)item_data->look),
item_data->name.c_str(),item_data->ename.c_str(),item_data->slots,item_data->nameid,
(item_data->type != IT_AMMO) ? itemdb_typename((enum item_types)item_data->type) : itemdb_typename_ammo((e_ammo_type)item_data->look),
(item_data->script==NULL)? msg_txt(sd,1278) : msg_txt(sd,1279) // None / With script
);
clif_displaymessage(fd, atcmd_output);
@@ -7940,7 +7940,7 @@ ACMD_FUNC(whodrops)
}
for (i = 0; i < count; i++) {
item_data = item_array[i];
sprintf(atcmd_output, msg_txt(sd,1285), item_data->jname, item_data->slot, item_data->nameid); // Item: '%s'[%d] (ID: %u)
sprintf(atcmd_output, msg_txt(sd,1285), item_data->ename.c_str(), item_data->slots, item_data->nameid); // Item: '%s'[%d] (ID:%u)
clif_displaymessage(fd, atcmd_output);

if (item_data->mob[0].chance == 0) {
@@ -8927,9 +8927,9 @@ ACMD_FUNC(itemlist)
}

if( it->refine )
StringBuf_Printf(&buf, "%d %s %+d (%s, id: %u)", it->amount, itd->jname, it->refine, itd->name, it->nameid);
StringBuf_Printf(&buf, "%d %s %+d (%s, id: %u)", it->amount, itd->ename.c_str(), it->refine, itd->name.c_str(), it->nameid);
else
StringBuf_Printf(&buf, "%d %s (%s, id: %u)", it->amount, itd->jname, itd->name, it->nameid);
StringBuf_Printf(&buf, "%d %s (%s, id: %u)", it->amount, itd->ename.c_str(), itd->name.c_str(), it->nameid);

if( it->equip ) {
char equipstr[CHAT_SIZE_MAX];
@@ -9015,7 +9015,7 @@ ACMD_FUNC(itemlist)
} else { // normal item
int counter2 = 0;

for( j = 0; j < itd->slot; ++j ) {
for( j = 0; j < itd->slots; ++j ) {
struct item_data* card;

if( it->card[j] == 0 || (card = itemdb_exists(it->card[j])) == NULL )
@@ -9029,7 +9029,7 @@ ACMD_FUNC(itemlist)
if( counter2 != 1 )
StringBuf_AppendStr(&buf, ", ");

StringBuf_Printf(&buf, "#%d %s (id: %u)", counter2, card->jname, card->nameid);
StringBuf_Printf(&buf, "#%d %s (id: %u)", counter2, card->ename.c_str(), card->nameid);
}

if( counter2 > 0 )
@@ -7587,7 +7587,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
if (sd->inventory_data[index]) {
switch (sd->status.weapon) {
case W_BOW:
if (sd->inventory_data[index]->look != A_ARROW) {
if (sd->inventory_data[index]->look != AMMO_ARROW) {
clif_arrow_fail(sd,0);
return ATK_NONE;
}
@@ -7596,17 +7596,17 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
case W_RIFLE:
case W_GATLING:
case W_SHOTGUN:
if (sd->inventory_data[index]->look != A_BULLET) {
if (sd->inventory_data[index]->look != AMMO_BULLET) {
clif_skill_fail(sd,0,USESKILL_FAIL_NEED_MORE_BULLET,0);
return ATK_NONE;
}
break;
case W_GRENADE:
if (sd->inventory_data[index]->look !=
#ifdef RENEWAL
A_BULLET) {
AMMO_BULLET) {
#else
A_GRENADE) {
AMMO_GRENADE) {
#endif
clif_skill_fail(sd,0,USESKILL_FAIL_NEED_MORE_BULLET,0);
return ATK_NONE;
@@ -671,7 +671,7 @@ void do_init_buyingstore_autotrade( void ) {
Sql_GetData(mmysql_handle, 0, &data, NULL); at->id = atoi(data);
Sql_GetData(mmysql_handle, 1, &data, NULL); at->account_id = atoi(data);
Sql_GetData(mmysql_handle, 2, &data, NULL); at->char_id = atoi(data);
Sql_GetData(mmysql_handle, 3, &data, NULL); at->sex = (data[0] == 'F') ? 0 : 1;
Sql_GetData(mmysql_handle, 3, &data, NULL); at->sex = (data[0] == 'F') ? SEX_FEMALE : SEX_MALE;
Sql_GetData(mmysql_handle, 4, &data, &len); safestrncpy(at->title, data, zmin(len + 1, MESSAGE_SIZE));
Sql_GetData(mmysql_handle, 5, &data, NULL); at->limit = atoi(data);
Sql_GetData(mmysql_handle, 6, &data, NULL); at->dir = atoi(data);
@@ -2643,7 +2643,7 @@ static void clif_addcards( struct EQUIPSLOTINFO* buf, struct item* item ){
int i = 0, j;

// Client only receives four cards.. so randomly send them a set of cards. [Skotlex]
if( MAX_SLOTS > 4 && ( j = itemdb_slot( item->nameid ) ) > 4 ){
if( MAX_SLOTS > 4 && ( j = itemdb_slots( item->nameid ) ) > 4 ){
i = rnd() % ( j - 3 ); //eg: 6 slots, possible i values: 0->3, 1->4, 2->5 => i = rnd()%3;
}

@@ -6767,8 +6767,8 @@ void clif_use_card(struct map_session_data *sd,int idx)
if(sd->inventory_data[i]->type == IT_ARMOR && (ep & EQP_ACC) && ((ep & EQP_ACC) != EQP_ACC) && ((sd->inventory_data[i]->equip & EQP_ACC) != (ep & EQP_ACC)) ) // specific accessory-card can only be inserted to specific accessory.
continue;

ARR_FIND( 0, sd->inventory_data[i]->slot, j, sd->inventory.u.items_inventory[i].card[j] == 0 );
if( j == sd->inventory_data[i]->slot ) // No room
ARR_FIND( 0, sd->inventory_data[i]->slots, j, sd->inventory.u.items_inventory[i].card[j] == 0 );
if( j == sd->inventory_data[i]->slots ) // No room
continue;

if( sd->inventory.u.items_inventory[i].equip > 0 ) // Do not check items that are already equipped
@@ -6965,7 +6965,7 @@ void clif_item_refine_list( struct map_session_data *sd ){

int count = 0;
for( int i = 0; i < MAX_INVENTORY; i++ ){
unsigned char wlv;
uint16 wlv;

if( sd->inventory.u.items_inventory[i].nameid > 0 && sd->inventory.u.items_inventory[i].refine < skill_lv &&
sd->inventory.u.items_inventory[i].identify && ( wlv = itemdb_wlv(sd->inventory.u.items_inventory[i].nameid ) ) >= 1 &&
@@ -16538,7 +16538,7 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd)
return;
}

safestrncpy(auction.item_name, item->jname, sizeof(auction.item_name));
safestrncpy(auction.item_name, item->ename.c_str(), sizeof(auction.item_name));
auction.type = item->type;
memcpy(&auction.item, &sd->inventory.u.items_inventory[sd->auction.index], sizeof(struct item));
auction.item.amount = 1;

Large diffs are not rendered by default.

@@ -4,10 +4,17 @@
#ifndef ITEMDB_HPP
#define ITEMDB_HPP

#include <vector>

#include "../common/database.hpp"
#include "../common/db.hpp"
#include "../common/malloc.hpp"
#include "../common/mmo.hpp" // ITEM_NAME_LENGTH

#include "script.hpp"
#include "status.hpp"

enum e_ammo_type : uint8;

///Use apple for unknown items.
const t_itemid UNKNOWN_ITEM_ID = 512;
@@ -207,36 +214,23 @@ enum poison_item_list : t_itemid
ITEMID_VENOMBLEED,
};

///Item No Use List
enum item_nouse_list
{
NOUSE_SITTING = 0x01,
};

///Item job
enum e_item_job
enum e_item_job : uint16
{
ITEMJ_NONE = 0x00,
ITEMJ_NORMAL = 0x01,
ITEMJ_UPPER = 0x02,
ITEMJ_BABY = 0x04,
ITEMJ_THIRD = 0x08,
ITEMJ_THIRD_TRANS = 0x10,
ITEMJ_THIRD_UPPER = 0x10,
ITEMJ_THIRD_BABY = 0x20,
};
ITEMJ_MAX = 0xFF,

enum e_item_ammo
{
AMMO_ARROW = 1,
AMMO_THROWABLE_DAGGER,
AMMO_BULLET,
AMMO_SHELL,
AMMO_GRENADE,
AMMO_SHURIKEN,
AMMO_KUNAI,
AMMO_CANNONBALL,
AMMO_THROWABLE_ITEM, ///Sling items

MAX_AMMO_TYPE,
#ifdef RENEWAL
ITEMJ_ALL = ITEMJ_NORMAL | ITEMJ_UPPER | ITEMJ_BABY | ITEMJ_THIRD | ITEMJ_THIRD_UPPER | ITEMJ_THIRD_BABY,
#else
ITEMJ_ALL = ITEMJ_NORMAL | ITEMJ_UPPER | ITEMJ_BABY,
#endif
};

#define AMMO_TYPE_ALL ((1<<MAX_AMMO_TYPE)-1)
@@ -756,16 +750,40 @@ enum e_itemshop_restrictions {
ISR_BOUND_GUILDLEADER_ONLY = 0x8,
};

///Item combo struct
struct item_combo
{
struct script_code *script;
t_itemid *nameid;/* nameid array */
unsigned char count;
unsigned short id;/* id of this combo */
bool isRef;/* whether this struct is a reference or the master */
/// Enum for item drop effects
enum e_item_drop_effect : uint16 {
DROPEFFECT_NONE = 0,
DROPEFFECT_CLIENT,
DROPEFFECT_WHITE_PILLAR,
DROPEFFECT_BLUE_PILLAR,
DROPEFFECT_YELLOW_PILLAR,
DROPEFFECT_PURPLE_PILLAR,
DROPEFFECT_ORANGE_PILLAR,
DROPEFFECT_MAX
};

/// Enum for items with delayed consumption
enum e_delay_consume : uint8 {
DELAYCONSUME_NONE = 0x0,
DELAYCONSUME_TEMP = 0x1, // Items that are not consumed immediately upon double-click
DELAYCONSUME_NOCONSUME = 0x2, // Items that are not removed upon double-click
};

/// Item combo struct
struct s_item_combo {
std::vector<t_itemid> nameid;
script_code *script;
uint32 id;

~s_item_combo() {
if (this->script) {
script_free_code(this->script);
this->script = nullptr;
}

this->nameid.clear();
}
};

/// Struct of item group entry
struct s_item_group_entry
@@ -808,34 +826,34 @@ extern struct s_roulette_db rd;
struct item_data
{
t_itemid nameid;
char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH];
std::string name, ename;

//Do not add stuff between value_buy and view_id (see how getiteminfo works)
int value_buy;
int value_sell;
int type;
uint32 value_buy;
uint32 value_sell;
item_types type;
uint8 subtype;
int maxchance; //For logs, for external game info, for scripts: Max drop chance of this item (e.g. 0.01% , etc.. if it = 0, then monsters don't drop it, -1 denotes items sold in shops only) [Lupus]
int sex;
int equip;
int weight;
int atk;
int def;
int range;
int slot;
int look;
int elv;
int wlv;
uint8 sex;
uint32 equip;
uint32 weight;
uint32 atk;
uint32 def;
uint16 range;
uint16 slots;
uint32 look;
uint16 elv;
uint16 wlv;
t_itemid view_id;
int elvmax; ///< Maximum level for this item
uint16 elvmax; ///< Maximum level for this item
#ifdef RENEWAL
int matk;
uint32 matk;
#endif

int delay;
//Lupus: I rearranged order of these fields due to compatibility with ITEMINFO script command
// some script commands should be revised as well...
uint64 class_base[3]; //Specifies if the base can wear this item (split in 3 indexes per type: 1-1, 2-1, 2-2)
unsigned class_upper : 6; //Specifies if the class-type can equip it (0x01: normal, 0x02: trans, 0x04: baby, 0x08:third, 0x10:trans-third, 0x20-third-baby)
uint16 class_upper; //Specifies if the class-type can equip it (See e_item_job)
struct {
int chance;
int id;
@@ -847,33 +865,52 @@ struct item_data
unsigned available : 1;
uint32 no_equip;
unsigned no_refine : 1; // [celest]
unsigned delay_consume : 2; // 1 - Signifies items that are not consumed immediately upon double-click; 2 - Signifies items that are not removed on consumption [Skotlex]
unsigned trade_restriction : 9; //Item restrictions mask [Skotlex]
unsigned delay_consume; // [Skotlex]
struct {
bool drop, trade, trade_partner, sell, cart, storage, guild_storage, mail, auction;
} trade_restriction; //Item restrictions mask [Skotlex]
unsigned autoequip: 1;
unsigned buyingstore : 1;
unsigned dead_branch : 1; // As dead branch item. Logged at `branchlog` table and cannot be used at 'nobranch' mapflag [Cydh]
unsigned group : 1; // As item group container [Cydh]
bool buyingstore;
bool dead_branch; // As dead branch item. Logged at `branchlog` table and cannot be used at 'nobranch' mapflag [Cydh]
bool group; // As item group container [Cydh]
unsigned guid : 1; // This item always be attached with GUID and make it as bound item! [Cydh]
unsigned broadcast : 1; ///< Will be broadcasted if someone obtain the item [Cydh]
bool broadcast; ///< Will be broadcasted if someone obtain the item [Cydh]
bool bindOnEquip; ///< Set item as bound when equipped
uint8 dropEffect; ///< Drop Effect Mode
e_item_drop_effect dropEffect; ///< Drop Effect Mode
} flag;
struct {// item stacking limitation
unsigned short amount;
unsigned int inventory:1;
unsigned int cart:1;
unsigned int storage:1;
unsigned int guildstorage:1;
uint16 amount;
bool inventory, cart, storage, guild_storage;
} stack;
struct {// used by item_nouse.txt
unsigned int flag;
unsigned short override;
struct {
uint16 override;
bool sitting;
} item_usage;
short gm_lv_trade_override; //GM-level to override trade_restriction
/* bugreport:309 */
struct item_combo **combos;
unsigned char combos_count;
short delay_sc; ///< Use delay group if any instead using player's item_delay data [Cydh]
std::vector<std::shared_ptr<s_item_combo>> combos;
struct {
uint32 duration;
sc_type sc; ///< Use delay group if any instead using player's item_delay data [Cydh]
} delay;

~item_data() {
if (this->script){
script_free_code(this->script);
this->script = nullptr;
}

if (this->equip_script){
script_free_code(this->equip_script);
this->equip_script = nullptr;
}

if (this->unequip_script){
script_free_code(this->unequip_script);
this->unequip_script = nullptr;
}

this->combos.clear();
}

bool isStackable();
int inventorySlotNeeded(int quantity);
@@ -904,14 +941,27 @@ struct s_random_opt_group {
uint16 total;
};

class ItemDatabase : public TypesafeCachedYamlDatabase<t_itemid, item_data> {
public:
ItemDatabase() : TypesafeCachedYamlDatabase("ITEM_DB", 1) {

}

const std::string getDefaultLocation();
uint64 parseBodyNode(const YAML::Node& node);
};

extern ItemDatabase item_db;

struct item_data* itemdb_searchname(const char *name);
struct item_data* itemdb_search_aegisname( const char *str );
int itemdb_searchname_array(struct item_data** data, int size, const char *str);
struct item_data* itemdb_search(t_itemid nameid);
struct item_data* itemdb_exists(t_itemid nameid);
#define itemdb_name(n) itemdb_search(n)->name
#define itemdb_jname(n) itemdb_search(n)->jname
#define itemdb_name(n) itemdb_search(n)->name.c_str()
#define itemdb_ename(n) itemdb_search(n)->ename.c_str()
#define itemdb_type(n) itemdb_search(n)->type
#define itemdb_subtype(n) itemdb_search(n)->subtype
#define itemdb_atk(n) itemdb_search(n)->atk
#define itemdb_def(n) itemdb_search(n)->def
#define itemdb_look(n) itemdb_search(n)->look
@@ -921,14 +971,14 @@ struct item_data* itemdb_exists(t_itemid nameid);
#define itemdb_equipscript(n) itemdb_search(n)->script
#define itemdb_wlv(n) itemdb_search(n)->wlv
#define itemdb_range(n) itemdb_search(n)->range
#define itemdb_slot(n) itemdb_search(n)->slot
#define itemdb_slots(n) itemdb_search(n)->slots
#define itemdb_available(n) (itemdb_search(n)->flag.available)
#define itemdb_traderight(n) (itemdb_search(n)->flag.trade_restriction)
#define itemdb_viewid(n) (itemdb_search(n)->view_id)
#define itemdb_autoequip(n) (itemdb_search(n)->flag.autoequip)
#define itemdb_dropeffect(n) (itemdb_search(n)->flag.dropEffect)
const char* itemdb_typename(enum item_types type);
const char *itemdb_typename_ammo (enum e_item_ammo ammo);
const char *itemdb_typename_ammo (e_ammo_type ammo);

struct s_item_group_entry *itemdb_get_randgroupitem(uint16 group_id, uint8 sub_group);
t_itemid itemdb_searchrandomid(uint16 group_id, uint8 sub_group);
@@ -965,7 +1015,7 @@ bool itemdb_isstackable2(struct item_data *id);
#define itemdb_isstackable(nameid) itemdb_isstackable2(itemdb_search(nameid))
bool itemdb_isNoEquip(struct item_data *id, uint16 m);

struct item_combo *itemdb_combo_exists(unsigned short combo_id);
s_item_combo *itemdb_combo_exists(uint32 combo_id);

struct s_item_group_db *itemdb_group_exists(unsigned short group_id);
bool itemdb_group_item_exists(unsigned short group_id, t_itemid nameid);
@@ -311,25 +311,18 @@
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\homun_skill_tree.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\homun_skill_tree.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\homunculus_db.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\homunculus_db.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\instance_db.yml" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\instance_db.yml')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_avail.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_avail.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_bluebox.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_bluebox.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_buyingstore.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_buyingstore.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_cardalbum.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_cardalbum.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_cash_db.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_cash_db.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_combo_db.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_combo_db.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_db.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_db.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_delay.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_delay.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_flag.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_flag.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_db.yml" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_db.yml')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_giftbox.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_giftbox.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_group_db.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_group_db.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_misc.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_misc.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_noequip.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_noequip.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_nouse.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_nouse.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_package.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_package.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_randomopt_db.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_randomopt_db.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_randomopt_group.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_randomopt_group.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_stack.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_stack.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_trade.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_trade.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\item_violetbox.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\item_violetbox.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\job_basehpsp_db.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\job_basehpsp_db.txt')" />
<Copy SourceFiles="$(SolutionDir)db\import-tmpl\job_db1.txt" DestinationFolder="$(SolutionDir)db\import\" ContinueOnError="true" Condition="!Exists('$(SolutionDir)db\import\job_db1.txt')" />
@@ -1841,7 +1841,7 @@ int map_addflooritem(struct item *item, int amount, int16 m, int16 x, int16 y, i

nullpo_ret(item);

if (!(flags&4) && battle_config.item_onfloor && (itemdb_traderight(item->nameid)&1))
if (!(flags&4) && battle_config.item_onfloor && (itemdb_traderight(item->nameid).trade))
return 0; //can't be dropped

if (!map_searchrandfreecell(m,&x,&y,flags&2?1:0))
@@ -73,6 +73,7 @@ void map_msg_reload(void);
#define MAPID_BASEMASK 0x00ff
#define MAPID_UPPERMASK 0x0fff
#define MAPID_THIRDMASK (JOBL_THIRD|MAPID_UPPERMASK)
#define MAPID_ALL 0xffff

//First Jobs
//Note the oddity of the novice:
@@ -2794,7 +2794,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
//A Rare Drop Global Announce by Lupus
if( mvp_sd && drop_rate <= battle_config.rare_drop_announce ) {
char message[128];
sprintf (message, msg_txt(NULL,541), mvp_sd->status.name, md->name, it->jname, (float)drop_rate/100);
sprintf (message, msg_txt(NULL,541), mvp_sd->status.name, md->name, it->ename.c_str(), (float)drop_rate/100);
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
intif_broadcast(message,strlen(message)+1,BC_DEFAULT);
}
@@ -2948,7 +2948,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
//A Rare MVP Drop Global Announce by Lupus
if(temp<=battle_config.rare_drop_announce) {
char message[128];
sprintf (message, msg_txt(NULL,541), mvp_sd->status.name, md->name, i_data->jname, temp/100.);
sprintf (message, msg_txt(NULL,541), mvp_sd->status.name, md->name, i_data->ename.c_str(), temp/100.);
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
intif_broadcast(message,strlen(message)+1,BC_DEFAULT);
}
@@ -4530,7 +4530,7 @@ uint64 MobAvailDatabase::parseBodyNode(const YAML::Node &node) {
if (!this->asString(node, "Weapon", weapon))
return 0;

struct item_data *item = itemdb_searchname(weapon.c_str());
struct item_data *item = itemdb_search_aegisname(weapon.c_str());

if (item == nullptr) {
this->invalidWarning(node["Weapon"], "Weapon %s is not a valid item.\n", weapon.c_str());
@@ -4551,7 +4551,7 @@ uint64 MobAvailDatabase::parseBodyNode(const YAML::Node &node) {
if (!this->asString(node, "Shield", shield))
return 0;

struct item_data *item = itemdb_searchname(shield.c_str());
struct item_data *item = itemdb_search_aegisname(shield.c_str());

if (item == nullptr) {
this->invalidWarning(node["Shield"], "Shield %s is not a valid item.\n", shield.c_str());
@@ -4574,7 +4574,7 @@ uint64 MobAvailDatabase::parseBodyNode(const YAML::Node &node) {

struct item_data *item;

if ((item = itemdb_searchname(head.c_str())) == nullptr) {
if ((item = itemdb_search_aegisname(head.c_str())) == nullptr) {
this->invalidWarning(node["HeadTop"], "HeadTop %s is not a valid item.\n", head.c_str());
return 0;
}
@@ -4593,7 +4593,7 @@ uint64 MobAvailDatabase::parseBodyNode(const YAML::Node &node) {
if (!this->asString(node, "HeadMid", head))
return 0;

struct item_data *item = itemdb_searchname(head.c_str());
struct item_data *item = itemdb_search_aegisname(head.c_str());

if (item == nullptr) {
this->invalidWarning(node["HeadMid"], "HeadMid %s is not a valid item.\n", head.c_str());
@@ -4614,7 +4614,7 @@ uint64 MobAvailDatabase::parseBodyNode(const YAML::Node &node) {
if (!this->asString(node, "HeadLow", head))
return 0;

struct item_data *item = itemdb_searchname(head.c_str());
struct item_data *item = itemdb_search_aegisname(head.c_str());

if (item == nullptr) {
this->invalidWarning(node["HeadLow"], "HeadLow %s is not a valid item.\n", head.c_str());
@@ -4637,7 +4637,7 @@ uint64 MobAvailDatabase::parseBodyNode(const YAML::Node &node) {
if (!this->asString(node, "PetEquip", equipment))
return 0;

struct item_data *item = itemdb_searchname(equipment.c_str());
struct item_data *item = itemdb_search_aegisname(equipment.c_str());

if (item == nullptr) {
this->invalidWarning(node["PetEquip"], "PetEquip %s is not a valid item.\n", equipment.c_str());
@@ -1614,7 +1614,7 @@ static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int

memset(output, '\0', sizeof(output));

sprintf(output, msg_txt(sd, 712), id->jname, id->nameid); // You do not have enough %s (%u).
sprintf(output, msg_txt(sd, 712), id->ename.c_str(), id->nameid); // You do not have enough %s (%u).
clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);
return ERROR_TYPE_PURCHASE_FAIL;
}
@@ -1797,7 +1797,7 @@ void npc_shop_currency_type(struct map_session_data *sd, struct npc_data *nd, in

memset(output, '\0', sizeof(output));

sprintf(output, msg_txt(sd, 714), id->jname, id->nameid); // Item Shop List: %s (%u)
sprintf(output, msg_txt(sd, 714), id->ename.c_str(), id->nameid); // Item Shop List: %s (%u)
clif_broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE,SELF);
}

@@ -1886,7 +1886,7 @@ int npc_cashshop_buy(struct map_session_data *sd, t_itemid nameid, int amount, i

if( (double)nd->u.shop.shop_item[i].value * amount > INT_MAX )
{
ShowWarning("npc_cashshop_buy: Item '%s' (%u) price overflow attempt!\n", item->name, nameid);
ShowWarning("npc_cashshop_buy: Item '%s' (%u) price overflow attempt!\n", item->name.c_str(), nameid);
ShowDebug("(NPC:'%s' (%s,%d,%d), player:'%s' (%d/%d), value:%d, amount:%d)\n",
nd->exname, map_mapid2mapname(nd->bl.m), nd->bl.x, nd->bl.y, sd->status.name, sd->status.account_id, sd->status.char_id, nd->u.shop.shop_item[i].value, amount);
return ERROR_TYPE_ITEM_ID;
@@ -3004,15 +3004,15 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
}
if (value == 0 && (type == NPCTYPE_SHOP || type == NPCTYPE_MARKETSHOP)) { // NPC selling items for free!
ShowWarning("npc_parse_shop: Item %s [%u] is being sold for FREE in file '%s', line '%d'.\n",
id->name, nameid2, filepath, strline(buffer,start-buffer));
id->name.c_str(), nameid2, filepath, strline(buffer,start-buffer));
}
if( type == NPCTYPE_SHOP && value*0.75 < id->value_sell*1.24 ) { // Exploit possible: you can buy and sell back with profit
ShowWarning("npc_parse_shop: Item %s [%u] discounted buying price (%d->%d) is less than overcharged selling price (%d->%d) at file '%s', line '%d'.\n",
id->name, nameid2, value, (int)(value*0.75), id->value_sell, (int)(id->value_sell*1.24), filepath, strline(buffer,start-buffer));
id->name.c_str(), nameid2, value, (int)(value*0.75), id->value_sell, (int)(id->value_sell*1.24), filepath, strline(buffer,start-buffer));
}
if (type == NPCTYPE_MARKETSHOP && (!qty || qty > UINT16_MAX)) {
ShowWarning("npc_parse_shop: Item %s [%u] is stocked with invalid value %d, changed to 1. File '%s', line '%d'.\n",
id->name, nameid2, qty, filepath, strline(buffer,start-buffer));
id->name.c_str(), nameid2, qty, filepath, strline(buffer,start-buffer));
qty = 1;
}
//for logs filters, atcommands and iteminfo script command

Large diffs are not rendered by default.

@@ -258,6 +258,18 @@ struct s_regen {
int tick;
};

/// Item combo struct
struct s_combos {
script_code *bonus;
uint32 id;
uint32 pos;

~s_combos() {
if (this->bonus)
script_free_code(this->bonus);
}
};

struct map_session_data {
struct block_list bl;
struct unit_data ud;
@@ -699,12 +711,7 @@ struct map_session_data {
enum npc_timeout_type npc_idle_type;
#endif

struct s_combos {
struct script_code **bonus;/* the script */
unsigned short *id;/* array of combo ids */
unsigned int *pos;/* array of positions*/
unsigned char count;
} combos;
std::vector<std::shared_ptr<s_combos>> combos;

/**
* Guarantees your friend request is legit (for bugreport:4629)
@@ -804,7 +811,7 @@ extern struct eri *str_reg_ers;
/* Global Expiration Timer ID */
extern int pc_expiration_tid;

enum weapon_type {
enum weapon_type : uint8 {
W_FIST, //Bare hands
W_DAGGER, //1
W_1HSWORD, //2
@@ -842,16 +849,18 @@ enum weapon_type {

#define WEAPON_TYPE_ALL ((1<<MAX_WEAPON_TYPE)-1)

enum ammo_type {
A_ARROW = 1,
A_DAGGER, //2
A_BULLET, //3
A_SHELL, //4
A_GRENADE, //5
A_SHURIKEN, //6
A_KUNAI, //7
A_CANNONBALL, //8
A_THROWWEAPON //9
enum e_ammo_type : uint8 {
AMMO_NONE = 0,
AMMO_ARROW,
AMMO_DAGGER,
AMMO_BULLET,
AMMO_SHELL,
AMMO_GRENADE,
AMMO_SHURIKEN,
AMMO_KUNAI,
AMMO_CANNONBALL,
AMMO_THROWWEAPON,
MAX_AMMO_TYPE
};

enum idletime_option {
@@ -2483,7 +2483,6 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
const char *p,*tmpp;
int i;
struct script_code* code = NULL;
static bool first=true;
char end;
bool unresolved_names = false;

@@ -2495,12 +2494,6 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
return NULL;// empty script

memset(&syntax,0,sizeof(syntax));
if(first){
add_buildin_func();
read_constdb();
script_hardcoded_constants();
first=false;
}

script_buf=(unsigned char *)aMalloc(SCRIPT_BLOCK_SIZE*sizeof(unsigned char));
script_pos=0;
@@ -4841,6 +4834,9 @@ void do_init_script(void) {
next_id = 0;

mapreg_init();
add_buildin_func();
read_constdb();
script_hardcoded_constants();
}

void script_reload(void) {
@@ -8959,7 +8955,7 @@ BUILDIN_FUNC(getequipname)

item = sd->inventory_data[i];
if( item != 0 )
script_pushstrcopy(st,item->jname);
script_pushstrcopy(st,item->ename.c_str());
else
script_pushconststr(st,"");

@@ -13320,7 +13316,7 @@ BUILDIN_FUNC(getequipcardcnt)
}

count = 0;
for( j = 0; j < sd->inventory_data[i]->slot; j++ )
for( j = 0; j < sd->inventory_data[i]->slots; j++ )
if( sd->inventory.u.items_inventory[i].card[j] && itemdb_type(sd->inventory.u.items_inventory[i].card[j]) == IT_CARD )
count++;

@@ -13352,7 +13348,7 @@ BUILDIN_FUNC(successremovecards) {
if(itemdb_isspecial(sd->inventory.u.items_inventory[i].card[0]))
return SCRIPT_CMD_SUCCESS;

for( c = sd->inventory_data[i]->slot - 1; c >= 0; --c ) {
for( c = sd->inventory_data[i]->slots - 1; c >= 0; --c ) {
if( sd->inventory.u.items_inventory[i].card[c] && itemdb_type(sd->inventory.u.items_inventory[i].card[c]) == IT_CARD ) {// extract this card from the item
unsigned char flag = 0;
struct item item_tmp;
@@ -13369,7 +13365,7 @@ BUILDIN_FUNC(successremovecards) {
}

if(cardflag == 1) {//if card was remove remplace item with no card
unsigned char flag = 0, j;
unsigned char flag = 0;
struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));

@@ -13380,10 +13376,10 @@ BUILDIN_FUNC(successremovecards) {
item_tmp.expire_time = sd->inventory.u.items_inventory[i].expire_time;
item_tmp.bound = sd->inventory.u.items_inventory[i].bound;

for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
for (int j = sd->inventory_data[i]->slots; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->inventory.u.items_inventory[i].card[j];

for (j = 0; j < MAX_ITEM_RDM_OPT; j++){
for (int j = 0; j < MAX_ITEM_RDM_OPT; j++){
item_tmp.option[j].id=sd->inventory.u.items_inventory[i].option[j].id;
item_tmp.option[j].value=sd->inventory.u.items_inventory[i].option[j].value;
item_tmp.option[j].param=sd->inventory.u.items_inventory[i].option[j].param;
@@ -13428,7 +13424,7 @@ BUILDIN_FUNC(failedremovecards) {
if(itemdb_isspecial(sd->inventory.u.items_inventory[i].card[0]))
return SCRIPT_CMD_SUCCESS;

for( c = sd->inventory_data[i]->slot - 1; c >= 0; --c ) {
for( c = sd->inventory_data[i]->slots - 1; c >= 0; --c ) {
if( sd->inventory.u.items_inventory[i].card[c] && itemdb_type(sd->inventory.u.items_inventory[i].card[c]) == IT_CARD ) {
cardflag = 1;

@@ -13453,7 +13449,7 @@ BUILDIN_FUNC(failedremovecards) {
if(typefail == 0 || typefail == 2){ // destroy the item
pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
}else if(typefail == 1){ // destroy the card
unsigned char flag = 0, j;
unsigned char flag = 0;
struct item item_tmp;

memset(&item_tmp,0,sizeof(item_tmp));
@@ -13465,10 +13461,10 @@ BUILDIN_FUNC(failedremovecards) {
item_tmp.expire_time = sd->inventory.u.items_inventory[i].expire_time;
item_tmp.bound = sd->inventory.u.items_inventory[i].bound;

for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
for (int j = sd->inventory_data[i]->slots; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->inventory.u.items_inventory[i].card[j];

for (j = 0; j < MAX_ITEM_RDM_OPT; j++){
for (int j = 0; j < MAX_ITEM_RDM_OPT; j++){
item_tmp.option[j].id=sd->inventory.u.items_inventory[i].option[j].id;
item_tmp.option[j].value=sd->inventory.u.items_inventory[i].option[j].value;
item_tmp.option[j].param=sd->inventory.u.items_inventory[i].option[j].param;
@@ -13912,7 +13908,7 @@ BUILDIN_FUNC(getitemname)
}
item_name=(char *)aMalloc(ITEM_NAME_LENGTH*sizeof(char));

memcpy(item_name, i_data->jname, ITEM_NAME_LENGTH);
memcpy(item_name, i_data->ename.c_str(), ITEM_NAME_LENGTH);
script_pushstr(st,item_name);
return SCRIPT_CMD_SUCCESS;
}
@@ -13929,7 +13925,7 @@ BUILDIN_FUNC(getitemslots)
i_data = itemdb_exists(item_id);

if (i_data)
script_pushint(st,i_data->slot);
script_pushint(st,i_data->slots);
else
script_pushint(st,-1);
return SCRIPT_CMD_SUCCESS;
@@ -15114,7 +15110,7 @@ BUILDIN_FUNC(checkequipedcard)
if(sd->inventory.u.items_inventory[i].nameid > 0 && sd->inventory.u.items_inventory[i].amount && sd->inventory_data[i]){
if (itemdb_isspecial(sd->inventory.u.items_inventory[i].card[0]))
continue;
for(n=0;n<sd->inventory_data[i]->slot;n++){
for(n=0;n<sd->inventory_data[i]->slots;n++){
if(sd->inventory.u.items_inventory[i].card[n] == c) {
script_pushint(st,1);
return SCRIPT_CMD_SUCCESS;
@@ -15666,7 +15662,7 @@ BUILDIN_FUNC(isequippedcnt)
} else { //Count cards.
if (itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0]))
continue; //No cards
for (short k = 0; k < sd->inventory_data[index]->slot; k++) {
for (short k = 0; k < sd->inventory_data[index]->slots; k++) {
if (sd->inventory.u.items_inventory[index].card[k] == id)
ret++; //[Lupus]
}
@@ -15722,11 +15718,11 @@ BUILDIN_FUNC(isequipped)
break;
} else { //Cards
short k;
if (sd->inventory_data[index]->slot == 0 ||
if (sd->inventory_data[index]->slots == 0 ||
itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0]))
continue;

for (k = 0; k < sd->inventory_data[index]->slot; k++)
for (k = 0; k < sd->inventory_data[index]->slots; k++)
{ //New hash system which should support up to 4 slots on any equipment. [Skotlex]
unsigned int hash = 0;
if (sd->inventory.u.items_inventory[index].card[k] != id)
@@ -15796,7 +15792,7 @@ BUILDIN_FUNC(cardscnt)
} else {
if (itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0]))
continue;
for(k=0; k<sd->inventory_data[index]->slot; k++) {
for(k=0; k<sd->inventory_data[index]->slots; k++) {
if (sd->inventory.u.items_inventory[index].card[k] == id)
ret++;
}
@@ -260,9 +260,11 @@
export_constant2("EAJ_BLACKSMITH",MAPID_BLACKSMITH);
export_constant2("EAJ_ASSASSIN",MAPID_ASSASSIN);
export_constant2("EAJ_STAR_GLADIATOR",MAPID_STAR_GLADIATOR);
export_constant2("EAJ_STARGLADIATOR",MAPID_STAR_GLADIATOR);
export_constant2("EAJ_REBELLION",MAPID_REBELLION);
export_constant2("EAJ_KAGEROUOBORO",MAPID_KAGEROUOBORO);
export_constant2("EAJ_DEATH_KNIGHT",MAPID_DEATH_KNIGHT);
export_constant2("EAJ_DEATHKNIGHT",MAPID_DEATH_KNIGHT);

export_constant2("EAJ_CRUSADER",MAPID_CRUSADER);
export_constant2("EAJ_SAGE",MAPID_SAGE);
@@ -271,7 +273,9 @@
export_constant2("EAJ_ALCHEMIST",MAPID_ALCHEMIST);
export_constant2("EAJ_ROGUE",MAPID_ROGUE);
export_constant2("EAJ_SOUL_LINKER",MAPID_SOUL_LINKER);
export_constant2("EAJ_SOULLINKER",MAPID_SOUL_LINKER);
export_constant2("EAJ_DARK_COLLECTOR",MAPID_DARK_COLLECTOR);
export_constant2("EAJ_DARKCOLLECTOR",MAPID_DARK_COLLECTOR);

export_constant2("EAJ_NOVICE_HIGH",MAPID_NOVICE_HIGH);
export_constant2("EAJ_SWORDMAN_HIGH",MAPID_SWORDMAN_HIGH);
@@ -378,6 +382,7 @@
export_constant2("EAJ_BABY_SOUL_REAPER",MAPID_BABY_SOUL_REAPER);

export_constant2("EAJ_SUPER_NOVICE",MAPID_SUPER_NOVICE);
export_constant2("EAJ_SUPERNOVICE",MAPID_SUPER_NOVICE);
export_constant2("EAJ_SUPER_BABY",MAPID_SUPER_BABY);
export_constant2("EAJ_SUPER_NOVICE_E",MAPID_SUPER_NOVICE_E);
export_constant2("EAJ_SUPER_BABY_E",MAPID_SUPER_BABY_E);
@@ -387,6 +392,7 @@
/* sex */
export_constant(SEX_FEMALE);
export_constant(SEX_MALE);
export_constant(SEX_BOTH);

/* broadcasts */
export_constant(BC_ALL);
@@ -807,6 +813,13 @@
export_constant(EQP_ACC_RL);
export_constant(EQP_SHADOW_ACC_RL);

export_constant2("EQP_Right_Hand", EQP_HAND_R);
export_constant2("EQP_Left_Hand", EQP_HAND_L);
export_constant2("EQP_Right_Accessory", EQP_ACC_R);
export_constant2("EQP_Left_Accessory", EQP_ACC_L);
export_constant2("EQP_Shadow_Right_Accessory", EQP_SHADOW_ACC_R);
export_constant2("EQP_Shadow_Left_Accessory", EQP_SHADOW_ACC_L);

/* looks */
export_constant(LOOK_BASE);
export_constant(LOOK_HAIR);
@@ -4049,15 +4062,27 @@
export_constant(MAX_WEAPON_TYPE_ALL);

/* ammunition types */
export_constant(A_ARROW);
export_constant(A_DAGGER);
export_constant(A_BULLET);
export_constant(A_SHELL);
export_constant(A_GRENADE);
export_constant(A_SHURIKEN);
export_constant(A_KUNAI);
export_constant(A_CANNONBALL);
export_constant(A_THROWWEAPON);
/* Send deprecation notice and temporarily replace with new constant value. */
export_deprecated_constant3("A_ARROW", AMMO_ARROW, "AMMO_ARROW");
export_deprecated_constant3("A_DAGGER", AMMO_DAGGER, "AMMO_DAGGER");
export_deprecated_constant3("A_BULLET", AMMO_BULLET, "AMMO_BULLET");
export_deprecated_constant3("A_SHELL", AMMO_SHELL, "AMMO_SHELL");
export_deprecated_constant3("A_GRENADE", AMMO_GRENADE, "AMMO_GRENADE");
export_deprecated_constant3("A_SHURIKEN", AMMO_SHURIKEN, "AMMO_SHURIKEN");
export_deprecated_constant3("A_KUNAI", AMMO_KUNAI, "AMMO_KUNAI");
export_deprecated_constant3("A_CANNONBALL", AMMO_CANNONBALL, "AMMO_CANNONBALL");
export_deprecated_constant3("A_THROWWEAPON", AMMO_THROWWEAPON, "AMMO_THROWWEAPON");

export_constant(AMMO_ARROW);
export_constant(AMMO_DAGGER);
export_constant(AMMO_BULLET);
export_constant(AMMO_SHELL);
export_constant(AMMO_GRENADE);
export_constant(AMMO_SHURIKEN);
export_constant(AMMO_KUNAI);
export_constant(AMMO_CANNONBALL);
export_constant(AMMO_THROWWEAPON);
export_constant(MAX_AMMO_TYPE);

/* monsterinfo types */
export_constant(MOB_NAME);
@@ -7937,6 +7962,24 @@
export_constant(BG_INFO_MAPS);
export_constant(BG_INFO_DESERTER_TIME);

/* item job classes */
export_constant(ITEMJ_NORMAL);
export_constant(ITEMJ_UPPER);
export_constant(ITEMJ_BABY);
export_constant(ITEMJ_THIRD);
export_constant(ITEMJ_THIRD_UPPER);
export_constant(ITEMJ_THIRD_BABY);

/* item drop effects */
export_constant(DROPEFFECT_NONE);
export_constant(DROPEFFECT_CLIENT);
export_constant(DROPEFFECT_WHITE_PILLAR);
export_constant(DROPEFFECT_BLUE_PILLAR);
export_constant(DROPEFFECT_YELLOW_PILLAR);
export_constant(DROPEFFECT_PURPLE_PILLAR);
export_constant(DROPEFFECT_ORANGE_PILLAR);
export_constant(DROPEFFECT_MAX);

#undef export_constant
#undef export_constant2
#undef export_parameter
@@ -15510,7 +15510,7 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i
if( (i = sd->itemindex) == -1 ||
sd->inventory.u.items_inventory[i].nameid != sd->itemid ||
sd->inventory_data[i] == NULL ||
!sd->inventory_data[i]->flag.delay_consume ||
sd->inventory_data[i]->flag.delay_consume == DELAYCONSUME_NONE ||
sd->inventory.u.items_inventory[i].amount < 1
)
{ //Something went wrong, item exploit?
@@ -15521,7 +15521,7 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i
//Consume
sd->itemid = 0;
sd->itemindex = -1;
if( (skill_id == WZ_EARTHSPIKE && sc && sc->data[SC_EARTHSCROLL] && rnd()%100 > sc->data[SC_EARTHSCROLL]->val2) || sd->inventory_data[i]->flag.delay_consume == 2 ) // [marquis007]
if( (skill_id == WZ_EARTHSPIKE && sc && sc->data[SC_EARTHSCROLL] && rnd()%100 > sc->data[SC_EARTHSCROLL]->val2) || sd->inventory_data[i]->flag.delay_consume & DELAYCONSUME_NOCONSUME ) // [marquis007]
; //Do not consume item.
else if( sd->inventory.u.items_inventory[i].expire_time == 0 )
pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME); // Rental usable items are not consumed until expiration
@@ -16627,7 +16627,7 @@ bool skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
sprintf(e_msg,msg_txt(sd,381), //Skill Failed. [%s] requires %dx %s.
skill_get_desc(skill_id),
require.ammo_qty,
itemdb_jname(sd->inventory.u.items_inventory[i].nameid));
itemdb_ename(sd->inventory.u.items_inventory[i].nameid));
clif_messagecolor(&sd->bl,color_table[COLOR_RED],e_msg,false,SELF);
return false;
}
@@ -22319,7 +22319,7 @@ uint64 SkillDatabase::parseBodyNode(const YAML::Node &node) {
skill->require.ammo = 0;
} else {
for (const auto &it : ammoNode) {
std::string ammo = it.first.as<std::string>(), ammo_constant = "A_" + ammo;
std::string ammo = it.first.as<std::string>(), ammo_constant = "AMMO_" + ammo;
int64 constant;

if (!script_get_constant(ammo_constant.c_str(), &constant)) {
@@ -4022,31 +4022,38 @@ int status_calc_pc_sub(struct map_session_data* sd, enum e_status_calc_opt opt)
}
}

// We've got combos to process and check
if( sd->combos.count ) {
for (i = 0; i < sd->combos.count; i++) {
uint8 j = 0;
bool no_run = false;
struct item_combo *combo = NULL;
// Process and check item combos
if (!sd->combos.empty()) {
for (const auto &combo : sd->combos) {
s_item_combo *item_combo;

current_equip_item_index = -1;
current_equip_combo_pos = sd->combos.pos[i];
current_equip_combo_pos = combo->pos;

if (!sd->combos.bonus[i] || !(combo = itemdb_combo_exists(sd->combos.id[i])))
if (combo->bonus == nullptr || !(item_combo = itemdb_combo_exists(combo->id)))
continue;

bool no_run = false;
size_t j = 0;

// Check combo items
while (j < combo->count) {
struct item_data *id = itemdb_exists(combo->nameid[j]);
while (j < item_combo->nameid.size()) {
item_data *id = itemdb_exists(item_combo->nameid[j]);

// Don't run the script if at least one of combo's pair has restriction
if (id && !pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT) && itemdb_isNoEquip(id, sd->bl.m)) {
no_run = true;
break;
}

j++;
}

if (no_run)
continue;
run_script(sd->combos.bonus[i],0,sd->bl.id,0);

run_script(combo->bonus, 0, sd->bl.id, 0);

if (!calculating) // Abort, run_script retriggered this
return 1;
}
@@ -771,7 +771,7 @@ bool storage_guild_additem(struct map_session_data* sd, struct s_storage* stor,

id = itemdb_search(item_data->nameid);

if( id->stack.guildstorage && amount > id->stack.amount ) // item stack limitation
if( id->stack.guild_storage && amount > id->stack.amount ) // item stack limitation
return false;

if (!itemdb_canguildstore(item_data, pc_get_group_level(sd)) || item_data->expire_time) { // Check if item is storable. [Skotlex]
@@ -787,7 +787,7 @@ bool storage_guild_additem(struct map_session_data* sd, struct s_storage* stor,
if(itemdb_isstackable2(id)) { //Stackable
for(i = 0; i < stor->max_amount; i++) {
if(compare_item(&stor->u.items_guild[i], item_data)) {
if( amount > MAX_AMOUNT - stor->u.items_guild[i].amount || ( id->stack.guildstorage && amount > id->stack.amount - stor->u.items_guild[i].amount ) )
if( amount > MAX_AMOUNT - stor->u.items_guild[i].amount || ( id->stack.guild_storage && amount > id->stack.amount - stor->u.items_guild[i].amount ) )
return false;

stor->u.items_guild[i].amount += amount;
@@ -842,9 +842,9 @@ bool storage_guild_additem2(struct s_storage* stor, struct item* item, int amoun
for (i = 0; i < stor->max_amount; i++) {
if (compare_item(&stor->u.items_guild[i], item)) {
// Set the amount, make it fit with max amount
amount = min(amount, ((id->stack.guildstorage) ? id->stack.amount : MAX_AMOUNT) - stor->u.items_guild[i].amount);
amount = min(amount, ((id->stack.guild_storage) ? id->stack.amount : MAX_AMOUNT) - stor->u.items_guild[i].amount);
if (amount != item->amount)
ShowWarning("storage_guild_additem2: Stack limit reached! Altered amount of item \"" CL_WHITE "%s" CL_RESET "\" (%u). '" CL_WHITE "%d" CL_RESET "' -> '" CL_WHITE"%d" CL_RESET "'.\n", id->name, id->nameid, item->amount, amount);
ShowWarning("storage_guild_additem2: Stack limit reached! Altered amount of item \"" CL_WHITE "%s" CL_RESET "\" (%u). '" CL_WHITE "%d" CL_RESET "' -> '" CL_WHITE"%d" CL_RESET "'.\n", id->name.c_str(), id->nameid, item->amount, amount);
stor->u.items_guild[i].amount += amount;
stor->dirty = true;
return true;
@@ -3378,12 +3378,7 @@ int unit_free(struct block_list *bl, clr_type clrtype)
sd->npc_id = 0;
}

if( sd->combos.count ) {
aFree(sd->combos.bonus);
aFree(sd->combos.id);
aFree(sd->combos.pos);
sd->combos.count = 0;
}
sd->combos.clear();

if( sd->sc_display_count ) { /* [Ind] */
for( i = 0; i < sd->sc_display_count; i++ )
@@ -451,7 +451,7 @@ bool vending_searchall(struct map_session_data* sd, const struct s_search_store_
if( itemdb_isspecial(it->card[0]) ) { // something, that is not a carded
continue;
}
slot = itemdb_slot(it->nameid);
slot = itemdb_slots(it->nameid);

for( c = 0; c < slot && it->card[c]; c ++ ) {
ARR_FIND( 0, s->card_count, cidx, s->cardlist[cidx].itemId == it->card[c] );
@@ -4,10 +4,6 @@ COMMON_DIR_OBJ = $(COMMON_OBJ:%=../common/obj/%)
COMMON_H = $(shell ls ../common/*.hpp)
COMMON_INCLUDE = -I../common/

LIBCONFIG_H = $(shell ls ../../3rdparty/libconfig/*.h)
LIBCONFIG_AR = ../../3rdparty/libconfig/obj/libconfig.a
LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig

YAML_CPP_OBJ = $(shell find ../../3rdparty/yaml-cpp/ -type f -name "*.cpp" | sed -e "s/\.cpp/\.o/g" )
YAML_CPP_DIR_OBJ = $(YAML_CPP_OBJ:%=obj/%)
YAML_CPP_AR = ../../3rdparty/yaml-cpp/obj/yaml-cpp.a
@@ -20,29 +16,36 @@ MAPCACHE_OBJ = obj_all/mapcache.o

CSV2YAML_OBJ = obj_all/csv2yaml.o

YAML2SQL_OBJ = obj_all/yaml2sql.o

@SET_MAKE@

#####################################################################
.PHONY : all mapcache csv2yaml clean help
.PHONY : all mapcache csv2yaml yaml2sql clean help

all: mapcache csv2yaml
all: mapcache csv2yaml yaml2sql

mapcache: obj_all $(MAPCACHE_OBJ) $(COMMON_DIR_OBJ) $(LIBCONFIG_OBJ)
mapcache: obj_all $(MAPCACHE_OBJ) $(COMMON_DIR_OBJ)
@echo " LD $@"
@@CXX@ @LDFLAGS@ -o ../../mapcache@EXEEXT@ $(MAPCACHE_OBJ) $(COMMON_DIR_OBJ) $(LIBCONFIG_AR) @LIBS@
@@CXX@ @LDFLAGS@ -o ../../mapcache@EXEEXT@ $(MAPCACHE_OBJ) $(COMMON_DIR_OBJ) @LIBS@

csv2yaml: obj_all $(CSV2YAML_OBJ) $(COMMON_DIR_OBJ) $(YAML_CPP_AR)
@echo " LD $@"
@@CXX@ @LDFLAGS@ -o ../../csv2yaml@EXEEXT@ $(CSV2YAML_OBJ) $(COMMON_DIR_OBJ) $(YAML_CPP_AR) @LIBS@
@@CXX@ @LDFLAGS@ -o ../../csv2yaml@EXEEXT@ $(CSV2YAML_OBJ) $(COMMON_DIR_OBJ) ../common/obj/database.o $(YAML_CPP_AR) @LIBS@

yaml2sql: obj_all $(YAML2SQL_OBJ) $(COMMON_DIR_OBJ) $(YAML_CPP_AR)
@echo " LD $@"
@@CXX@ @LDFLAGS@ -o ../../yaml2sql@EXEEXT@ $(YAML2SQL_OBJ) $(COMMON_DIR_OBJ) $(YAML_CPP_AR) @LIBS@

clean:
@echo " CLEAN tool"
@rm -rf obj_all/*.o ../../mapcache@EXEEXT@
@rm -rf obj_all/*.o ../../mapcache@EXEEXT@ ../../csv2yaml@EXEEXT@ ../../yaml2sql@EXEEXT@

help:
@echo "possible targets are 'mapcache' 'all' 'clean' 'help'"
@echo "possible targets are 'mapcache' 'csv2yaml' 'yaml2sql' 'all' 'clean' 'help'"
@echo "'mapcache' - mapcache generator"
@echo "'csv2yaml' - csv2yaml converter"
@echo "'csv2yaml' - converts TXT databases to YAML"
@echo "'yaml2sql' - converts YAML databases to SQL"
@echo "'all' - builds all above targets"
@echo "'clean' - cleans builds and objects"
@echo "'help' - outputs this message"
@@ -52,16 +55,13 @@ help:
obj_all:
-mkdir obj_all

obj_all/%.o: %.cpp $(COMMON_H) $(OTHER_H) $(LIBCONFIG_H) $(YAML_CPP_H)
obj_all/%.o: %.cpp $(COMMON_H) $(OTHER_H) $(YAML_CPP_H)
@echo " CXX $<"
@@CXX@ @CXXFLAGS@ $(COMMON_INCLUDE) $(LIBCONFIG_INCLUDE) $(YAML_CPP_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
@@CXX@ @CXXFLAGS@ $(COMMON_INCLUDE) $(YAML_CPP_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $<

# missing common object files
$(COMMON_DIR_OBJ):
@$(MAKE) -C ../common server

$(LIBCONFIG_AR):
@$(MAKE) -C ../../3rdparty/libconfig

$(YAML_CPP_AR):
@$(MAKE) -C ../../3rdparty/yaml-cpp

Large diffs are not rendered by default.

@@ -159,8 +159,12 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\common\database.cpp" />
<ClCompile Include="csv2yaml.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\common\database.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
@@ -14,5 +14,13 @@
<ClCompile Include="csv2yaml.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\common\database.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\common\database.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

Large diffs are not rendered by default.

@@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{CDBBB260-B245-44EC-80FB-3F9421885E40}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>yaml2sql</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)</OutDir>
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)</OutDir>
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)</OutDir>
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)</OutDir>
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>$(DefineConstants);WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;MINICORE;_DEBUG;_CONSOLE;_LIB;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;$(SolutionDir).vs\build\common-minicore.lib;$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.lib;$(SolutionDir).vs\build\yaml-cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>$(DefineConstants);WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;MINICORE;_DEBUG;_CONSOLE;_LIB;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;$(SolutionDir).vs\build\common-minicore.lib;$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.lib;$(SolutionDir).vs\build\yaml-cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>$(DefineConstants);WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;MINICORE;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>ws2_32.lib;$(SolutionDir).vs\build\common-minicore.lib;$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.lib;$(SolutionDir).vs\build\yaml-cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>$(DefineConstants);WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;MINICORE;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>ws2_32.lib;$(SolutionDir).vs\build\common-minicore.lib;$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.lib;$(SolutionDir).vs\build\yaml-cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="yaml2sql.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<Target Name="AfterClean">
<Delete Files="$(SolutionDir)zlib.dll" ContinueOnError="true" />
<Delete Files="$(SolutionDir)serv.bat" ContinueOnError="true" />
<Delete Files="$(SolutionDir)yaml2sql.bat" ContinueOnError="true" />
</Target>
<Target Name="AfterBuild">
<Copy SourceFiles="$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.dll" DestinationFolder="$(SolutionDir)" ContinueOnError="true" Condition="!Exists('$(SolutionDir)zlib.dll')" />
<Copy SourceFiles="$(SolutionDir)tools\serv.bat" DestinationFolder="$(SolutionDir)" ContinueOnError="true" Condition="!Exists('$(SolutionDir)serv.bat')" />
<Copy SourceFiles="$(SolutionDir)tools\yaml2sql.bat" DestinationFolder="$(SolutionDir)" ContinueOnError="true" Condition="!Exists('$(SolutionDir)yaml2sql.bat')" />
</Target>
</Project>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="yaml2sql.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
@@ -10,9 +10,13 @@ set MYSQL_PWD=%DB_ROOTPW%
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\logs.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\item_cash_db.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\item_cash_db2.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\item_db.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\item_db_usable.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\item_db_equip.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\item_db_etc.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\item_db2.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\item_db_re.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\item_db_re_usable.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\item_db_re_equip.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\item_db_re_etc.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\item_db2_re.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\mob_db.sql"
%MYSQL% -u %DB_ROOT% %DB_NAME% -e "source sql-files\mob_db2.sql"
@@ -10,9 +10,13 @@ mysql -u $DB_ROOT $DB_NAME < sql-files/main.sql || aborterror "Unable to import
mysql -u $DB_ROOT $DB_NAME < sql-files/logs.sql || aborterror "Unable to import logs database."
mysql -u $DB_ROOT $DB_NAME < sql-files/item_cash_db.sql || aborterror "Unable to import cash item table."
mysql -u $DB_ROOT $DB_NAME < sql-files/item_cash_db2.sql || aborterror "Unable to import cash item 2 table."
mysql -u $DB_ROOT $DB_NAME < sql-files/item_db.sql || aborterror "Unable to import pre-renewal item table."
mysql -u $DB_ROOT $DB_NAME < sql-files/item_db_usable.sql || aborterror "Unable to import pre-renewal usable item table."
mysql -u $DB_ROOT $DB_NAME < sql-files/item_db_equip.sql || aborterror "Unable to import pre-renewal equip item table."
mysql -u $DB_ROOT $DB_NAME < sql-files/item_db_etc.sql || aborterror "Unable to import pre-renewal etc item table."
mysql -u $DB_ROOT $DB_NAME < sql-files/item_db2.sql || aborterror "Unable to import pre-renewal item 2 table."
mysql -u $DB_ROOT $DB_NAME < sql-files/item_db_re.sql || aborterror "Unable to import renewal item table."
mysql -u $DB_ROOT $DB_NAME < sql-files/item_db_re_usable.sql || aborterror "Unable to import renewal usable item table."
mysql -u $DB_ROOT $DB_NAME < sql-files/item_db_re_equip.sql || aborterror "Unable to import renewal equip item table."
mysql -u $DB_ROOT $DB_NAME < sql-files/item_db_re_etc.sql || aborterror "Unable to import renewal etc item table."
mysql -u $DB_ROOT $DB_NAME < sql-files/item_db2_re.sql || aborterror "Unable to import renewal item 2 table."
mysql -u $DB_ROOT $DB_NAME < sql-files/mob_db.sql || aborterror "Unable to import pre-renewal monster table."
mysql -u $DB_ROOT $DB_NAME < sql-files/mob_db2.sql || aborterror "Unable to import pre-renewal monster 2 table."

This file was deleted.

@@ -1,9 +1,5 @@
#!/usr/bin/perl

# Item Database:
# --i=../db/pre-re/item_db.txt --o=../sql-files/item_db.sql --t=pre --m=item --table=item_db
# --i=../db/re/item_db.txt --o=../sql-files/item_db_re.sql --t=re --m=item --table=item_db_re
#
# Mob Database:
# --i=../db/pre-re/mob_db.txt --o=../sql-files/mob_db.sql --t=pre --m=mob --table=mob_db
# --i=../db/re/mob_db.txt --o=../sql-files/mob_db_re.sql --t=re --m=mob --table=mob_db_re
@@ -42,12 +38,12 @@ sub GetArgs {
'i=s' => \$sFilein, #Output file name.
'o=s' => \$sFileout, #Input file name.
't=s' => \$sTarget, #Renewal setting: pre-re, re.
'm=s' => \$sType, #Database: item, mob, mob_skill.
'm=s' => \$sType, #Database: mob, mob_skill.
'table=s' => \$sTable, #Table name.
'help!' => \$sHelp,
) or $sHelp=1; #Display help if invalid options are supplied.
my $sValidTarget = "re|pre";
my $sValidType = "item|mob|mob_skill";
my $sValidType = "mob|mob_skill";

if( $sHelp ) {
print "Incorrect option specified. Available options:\n"
@@ -109,21 +105,10 @@ sub Main {
if ($ligne =~ $line_format ) { @champ = ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19); }
}
elsif ($sType =~ /mob/i) { @champ = split(",",$ligne); }
elsif ($sType =~ /item/i ) {
if ($ligne =~ $line_format) { @champ = ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22); }
}
if ($#champ != $nb_columns - 1) { #Can't parse, it's a real comment.
printf $sFHout ("%s\n", $ligne);
} else {
printf $sFHout ("REPLACE INTO `%s` VALUES (", $db);
if( $sType =~ /item/i and $sWasCom == 0){ #check if aegis name is duplicate, (only for not com)
$hAEgisName{$champ[1]}++;
if($hAEgisName{$champ[1]} > 1){
print "Warning, aegisName=$champ[1] multiple occurence found, val=$hAEgisName{$champ[1]}, line=$ligne\n" ;
$champ[1] = $champ[1]."_"x($hAEgisName{$champ[1]}-1);
print "Converted into '$champ[1]'\n" ;
}
}
for (my $i=0; $i<$#champ; $i++) {
printField($sFHout,$champ[$i],",",$i);
}
@@ -192,95 +177,7 @@ sub Main {
sub BuildDataForType{ my($sTarget,$sType) = @_;
print "Starting BuildDataForType with: \n\t Target=$sTarget, Type=$sType \n";

if($sType =~ /item/i) {
if($sTarget =~ /Pre/i){
$db = $sTable;
$db = "item_db" unless($db);
$nb_columns = 22;
@str_col = (1,2,19,20,21);
@str_col2 = (19,20,21);
$line_format = "([^\,]*),"x($nb_columns-3)."(\{.*\}),"x(2)."(\{.*\})"; #Last 3 columns are scripts.
$create_table =
"#
# Table structure for table `$db`
#

DROP TABLE IF EXISTS `$db`;
CREATE TABLE `$db` (
`id` int(10) unsigned NOT NULL DEFAULT '0',
`name_english` varchar(50) NOT NULL DEFAULT '',
`name_japanese` varchar(50) NOT NULL DEFAULT '',
`type` tinyint(2) unsigned NOT NULL DEFAULT '0',
`price_buy` mediumint(8) unsigned DEFAULT NULL,
`price_sell` mediumint(8) unsigned DEFAULT NULL,
`weight` smallint(5) unsigned NOT NULL DEFAULT '0',
`attack` smallint(5) unsigned DEFAULT NULL,
`defence` smallint(5) unsigned DEFAULT NULL,
`range` tinyint(2) unsigned DEFAULT NULL,
`slots` tinyint(2) unsigned DEFAULT NULL,
`equip_jobs` bigint(20) unsigned DEFAULT NULL,
`equip_upper` tinyint(2) unsigned DEFAULT NULL,
`equip_genders` tinyint(1) unsigned DEFAULT NULL,
`equip_locations` mediumint(7) unsigned DEFAULT NULL,
`weapon_level` tinyint(1) unsigned DEFAULT NULL,
`equip_level` tinyint(3) unsigned DEFAULT NULL,
`refineable` tinyint(1) unsigned DEFAULT NULL,
`view` smallint(5) unsigned DEFAULT NULL,
`script` text,
`equip_script` text,
`unequip_script` text,
PRIMARY KEY (`id`),
UNIQUE INDEX `UniqueAegisName` (`name_english`)
) ENGINE=MyISAM;
";
#NOTE: These do not match the table struct defaults.
@defaults = ('0','\'\'','\'\'','0','NULL','NULL',0,'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL');
}
elsif($sTarget =~ /Re/i){
$db = $sTable;
$db = "item_db_re" unless($db);
$nb_columns = 22;
@str_col = (1,2,7,16,19,20,21);
@str_col2 = (19,20,21);
$line_format = "([^\,]*),"x($nb_columns-3)."(\{.*\}),"x(2)."(\{.*\})"; #Last 3 columns are scripts.
$create_table =
"#
# Table structure for table `$db`
#

DROP TABLE IF EXISTS `$db`;
CREATE TABLE `$db` (
`id` int(10) unsigned NOT NULL DEFAULT '0',
`name_english` varchar(50) NOT NULL DEFAULT '',
`name_japanese` varchar(50) NOT NULL DEFAULT '',
`type` tinyint(2) unsigned NOT NULL DEFAULT '0',
`price_buy` mediumint(8) unsigned DEFAULT NULL,
`price_sell` mediumint(8) unsigned DEFAULT NULL,
`weight` smallint(5) unsigned NOT NULL DEFAULT '0',
`atk:matk` varchar(11) DEFAULT NULL,
`defence` smallint(5) unsigned DEFAULT NULL,
`range` tinyint(2) unsigned DEFAULT NULL,
`slots` tinyint(2) unsigned DEFAULT NULL,
`equip_jobs` bigint(20) unsigned DEFAULT NULL,
`equip_upper` tinyint(2) unsigned DEFAULT NULL,
`equip_genders` tinyint(1) unsigned DEFAULT NULL,
`equip_locations` mediumint(7) unsigned DEFAULT NULL,
`weapon_level` tinyint(1) unsigned DEFAULT NULL,
`equip_level` varchar(10) DEFAULT NULL,
`refineable` tinyint(1) unsigned DEFAULT NULL,
`view` smallint(5) unsigned DEFAULT NULL,
`script` text,
`equip_script` text,
`unequip_script` text,
PRIMARY KEY (`id`),
UNIQUE INDEX `UniqueAegisName` (`name_english`)
) ENGINE=MyISAM;
";
#NOTE: These do not match the table struct defaults.
@defaults = ('0','\'\'','\'\'','0','NULL','NULL',0,'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL');
}
}
elsif($sType =~ /mob_skill/i) { #Same format for Pre-Renewal and Renewal.
if($sType =~ /mob_skill/i) { #Same format for Pre-Renewal and Renewal.
$db = $sTable;
if($sTarget =~ /Pre/i){
$db = "mob_skill_db" unless($db);
@@ -0,0 +1,2 @@
@ECHO OFF
CALL serv.bat yaml2sql.exe YAML 2 SQL