summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-09-05 00:07:08 +0200
committerHaru <haru@dotalux.com>2017-09-17 17:48:11 +0200
commita98b2d93f3727d18d8add5cb5c35830cbb171114 (patch)
tree39eda9621cf0a0f5f734a2d0d9360db3eeff73ff
parent00570591031eb6fc99c7c26ba58a2a7efb144e7f (diff)
downloadhercules-a98b2d93f3727d18d8add5cb5c35830cbb171114.tar.gz
hercules-a98b2d93f3727d18d8add5cb5c35830cbb171114.tar.bz2
hercules-a98b2d93f3727d18d8add5cb5c35830cbb171114.tar.xz
hercules-a98b2d93f3727d18d8add5cb5c35830cbb171114.zip
Split 'View' in two different fields in the item database
- The field was used both for sprite view IDs and for weapon or ammunition subtypes. Now the fields 'ViewSprite' and 'Subtype' are used respectively. Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--db/item_db2.conf3
-rw-r--r--db/pre-re/item_db.conf3
-rw-r--r--db/re/item_db.conf3
-rw-r--r--doc/item_db.txt10
-rw-r--r--doc/script_commands.txt4
-rw-r--r--src/common/mmo.h1
-rw-r--r--src/map/battle.c9
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/itemdb.c43
-rw-r--r--src/map/itemdb.h6
-rw-r--r--src/map/pc.c105
-rw-r--r--src/map/script.c4
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/status.c2
-rw-r--r--src/plugins/db2sql.c10
15 files changed, 124 insertions, 85 deletions
diff --git a/db/item_db2.conf b/db/item_db2.conf
index e6b467b58..3d388bf14 100644
--- a/db/item_db2.conf
+++ b/db/item_db2.conf
@@ -86,7 +86,8 @@ item_db: (
EquipLv: Equip required level (int, defaults to 0)
EquipLv: [min, max] (alternative syntax with min / max level)
Refine: Refineable (boolean, defaults to true)
- View: View ID (int, defaults to 0)
+ Subtype: Item Subtype (int, defaults to 0)
+ ViewSprite: Sprite view ID (int, defaults to 0)
BindOnEquip: true/false (boolean, defaults to false)
ForceSerial: true/false (boolean, defaults to false)
BuyingStore: true/false (boolean, defaults to false)
diff --git a/db/pre-re/item_db.conf b/db/pre-re/item_db.conf
index ee7166982..def5d692a 100644
--- a/db/pre-re/item_db.conf
+++ b/db/pre-re/item_db.conf
@@ -87,7 +87,8 @@ item_db: (
EquipLv: [min, max] (alternative syntax with min / max level)
Refine: Refineable (boolean, defaults to true)
DisableOptions: true/false (boolean, defaults to false !!for equipments only!!) [Smokexyz]
- View: View ID (int, defaults to 0)
+ Subtype: Item Subtype (int, defaults to 0)
+ ViewSprite: Sprite view ID (int, defaults to 0)
BindOnEquip: true/false (boolean, defaults to false)
ForceSerial: true/false (boolean, defaults to false)
BuyingStore: true/false (boolean, defaults to false)
diff --git a/db/re/item_db.conf b/db/re/item_db.conf
index 5b49f070f..b2268b909 100644
--- a/db/re/item_db.conf
+++ b/db/re/item_db.conf
@@ -87,7 +87,8 @@ item_db: (
EquipLv: [min, max] (alternative syntax with min / max level)
Refine: Refineable (boolean, defaults to true)
DisableOptions: true/false (boolean, defaults to false !!for equipments only!!) [Smokexyz]
- View: View ID (int, defaults to 0)
+ Subtype: Item Subtype (int, defaults to 0)
+ ViewSprite: Sprite view ID (int, defaults to 0)
BindOnEquip: true/false (boolean, defaults to false)
ForceSerial: true/false (boolean, defaults to false)
BuyingStore: true/false (boolean, defaults to false)
diff --git a/doc/item_db.txt b/doc/item_db.txt
index c43b5a69c..04f05fb4e 100644
--- a/doc/item_db.txt
+++ b/doc/item_db.txt
@@ -65,7 +65,8 @@ item_db: (
EquipLv: Equip required level (int, defaults to 0)
EquipLv: [min, max] (alternative syntax with min / max level)
Refine: Refineable (boolean, defaults to true)
- View: View ID (int, defaults to 0)
+ Subtype: Item Subtype (int, defaults to 0)
+ ViewSprite: Sprite view ID (int, defaults to 0)
BindOnEquip: true/false (boolean, defaults to false)
ForceSerial: true/false (boolean, defaults to false)
BuyingStore: true/false (boolean, defaults to false)
@@ -239,9 +240,10 @@ EquipLv: Base level required to be able to equip. It is possible to specify
Refineable: true if the item can be refined, false otherwise. If no value is
specified, it defaults to true.
-View: For normal items, defines a replacement view-sprite for the item (eg:
- Making apples look like apple juice). The special case are weapons
- and ammo where this value indicates the weapon-class of the item.
+ViewSprite: Defines a replacement view-sprite for the item (eg:
+ Making apples look like apple juice).
+
+Subtype: For weapons and ammo, indicates the weapon-class of the item.
For weapons, the types are:
W_FIST 0: Bare fist
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 779cd271c..79d609125 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -3186,7 +3186,7 @@ Valid types are:
if = 0, then monsters don't drop it at all (rare or a quest item)
if = 10000, then this item is sold in NPC shops only
4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
- 10 - slot; 11 - look; 12 - elv; 13 - wlv; 14 - view id
+ 10 - slot; 11 - subtype; 12 - elv; 13 - wlv; 14 - view id
If RENEWAL is defined, 15 - matk
@@ -8251,7 +8251,7 @@ Valid types are:
if = 0, then monsters don't drop it at all (rare or a quest item)
if = 10000, then this item is sold in NPC shops only
4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
- 10 - slot; 11 - look; 12 - elv; 13 - wlv; 14 - view id
+ 10 - slot; 11 - subtype; 12 - elv; 13 - wlv; 14 - view id
Example:
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 9bb9837ab..7670a7ac8 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -1132,6 +1132,7 @@ enum ammo_type {
A_KUNAI, //7
A_CANNONBALL, //8
A_THROWWEAPON, //9
+ MAX_AMMO_TYPE
};
enum e_char_server_type {
diff --git a/src/map/battle.c b/src/map/battle.c
index b5ad62407..9d67242a2 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -4575,8 +4575,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if(!skill_id) {
//Skills ALWAYS use ONLY your right-hand weapon (tested on Aegis 10.2)
- if (sd && sd->weapontype1 == 0 && sd->weapontype2 > 0)
- {
+ if (sd && sd->weapontype1 == W_FIST && sd->weapontype2 != W_FIST) {
flag.rh=0;
flag.lh=1;
}
@@ -6102,7 +6101,7 @@ bool battle_check_arrows(struct map_session_data *sd)
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]->subtype != A_ARROW) {
clif->arrow_fail(sd, 0);
return false;
}
@@ -6111,13 +6110,13 @@ bool battle_check_arrows(struct map_session_data *sd)
case W_RIFLE:
case W_GATLING:
case W_SHOTGUN:
- if (sd->inventory_data[index]->look != A_BULLET) {
+ if (sd->inventory_data[index]->subtype != A_BULLET) {
clif->skill_fail(sd, 0, USESKILL_FAIL_NEED_MORE_BULLET, 0);
return false;
}
break;
case W_GRENADE:
- if (sd->inventory_data[index]->look != A_GRENADE) {
+ if (sd->inventory_data[index]->subtype != A_GRENADE) {
clif->skill_fail(sd, 0, USESKILL_FAIL_NEED_MORE_BULLET, 0);
return false;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 1731e88ca..3599640b9 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2597,7 +2597,7 @@ void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *it, struc
#endif
#if PACKETVER >= 20100629
- p->wItemSpriteNumber = (id->equip&EQP_VISIBLE) ? id->look : 0;
+ p->wItemSpriteNumber = (id->equip&EQP_VISIBLE) ? id->view_sprite : 0;
#endif
#if PACKETVER >= 20120925
@@ -3527,7 +3527,7 @@ void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_IT
p.wearLocation = pos;
#if PACKETVER >= 20100629
if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&EQP_VISIBLE)
- p.wItemSpriteNumber = sd->inventory_data[n]->look;
+ p.wItemSpriteNumber = sd->inventory_data[n]->view_sprite;
else
p.wItemSpriteNumber = 0;
#endif
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 2b0847e1a..40dd9ab4f 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1638,9 +1638,9 @@ int itemdb_gendercheck(struct item_data *id)
return 1;
if (id->nameid == WEDDING_RING_F) //Bride Ring
return 0;
- if (id->look == W_MUSICAL && id->type == IT_WEAPON) //Musical instruments are always male-only
+ if (id->subtype == W_MUSICAL && id->type == IT_WEAPON) //Musical instruments are always male-only
return 1;
- if (id->look == W_WHIP && id->type == IT_WEAPON) //Whips are always female-only
+ if (id->subtype == W_WHIP && id->type == IT_WEAPON) //Whips are always female-only
return 0;
return (battle_config.ignore_items_gender) ? 2 : id->sex;
@@ -1788,10 +1788,14 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) {
memset(&entry->stack, '\0', sizeof(entry->stack));
}
- if (entry->type == IT_WEAPON && (entry->look < 0 || entry->look >= MAX_SINGLE_WEAPON_TYPE)) {
- ShowWarning("itemdb_validate_entry: Invalid View for weapon items. View value %d for item %d (%s) in '%s', defaulting to 1.\n",
- entry->look, entry->nameid, entry->jname, source);
- entry->look = 1;
+ if (entry->type == IT_WEAPON && (entry->subtype <= 0 || entry->subtype >= MAX_SINGLE_WEAPON_TYPE)) {
+ ShowWarning("itemdb_validate_entry: Invalid View for weapon items. View value %d for item %d (%s) in '%s', defaulting to W_DAGGER.\n",
+ entry->subtype, entry->nameid, entry->jname, source);
+ entry->subtype = W_DAGGER;
+ } else if (entry->type == IT_AMMO && (entry->subtype <= 0 || entry->subtype >= MAX_AMMO_TYPE)) {
+ ShowWarning("itemdb_validate_entry: Invalid View for ammunition items. View value %d for item %d (%s) in '%s', defaulting to A_ARROW.\n",
+ entry->subtype, entry->nameid, entry->jname, source);
+ entry->subtype = A_ARROW;
}
entry->wlv = cap_value(entry->wlv, REFINE_TYPE_ARMOR, REFINE_TYPE_MAX);
@@ -1986,6 +1990,14 @@ int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const char *
else if( !inherit )
id.type = IT_ETC;
+ if (itemdb->lookup_const(it, "Subtype", &i32) && i32 >= 0) {
+ if (id.type == IT_WEAPON || id.type == IT_AMMO)
+ id.subtype = i32;
+ else
+ ShowWarning("itemdb_readdb_libconfig_sub: Field 'Subtype' is only allowed for IT_WEAPON or IT_AMMO (Item #%d: %s). Ignoring.\n",
+ id.nameid, id.name);
+ }
+
if( itemdb->lookup_const(it, "Buy", &i32) )
id.value_buy = i32;
else if( !inherit )
@@ -2058,8 +2070,23 @@ int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const char *
if ((t = libconfig->setting_get_member(it, "DisableOptions")))
id.flag.no_options = libconfig->setting_get_bool(t) ? 1 : 0;
- if( itemdb->lookup_const(it, "View", &i32) && i32 >= 0 )
- id.look = i32;
+ if (itemdb->lookup_const(it, "ViewSprite", &i32) && i32 >= 0)
+ id.view_sprite = i32;
+
+ if (itemdb->lookup_const(it, "View", &i32) && i32 >= 0) { // TODO: Remove (Deprecated - 2016-09-04 [Haru])
+ if ((id.type == IT_WEAPON || id.type == IT_AMMO) && id.subtype == 0) {
+ ShowWarning("itemdb_readdb_libconfig_sub: The 'View' field is deprecated. Please rename it to 'Subtype' (or 'ViewSprite'). (Item #%d: %s)\n",
+ id.nameid, id.name);
+ id.subtype = i32;
+ } else if ((id.type != IT_WEAPON && id.type != IT_AMMO) && id.view_sprite == 0) {
+ ShowWarning("itemdb_readdb_libconfig_sub: The 'View' field is deprecated. Please rename it to 'ViewSprite' (or 'Subtype'). (Item #%d: %s)\n",
+ id.nameid, id.name);
+ id.view_sprite = i32;
+ } else {
+ ShowWarning("itemdb_readdb_libconfig_sub: The 'View' field is deprecated. Please rename it to 'Subtype' or 'ViewSprite'. (Item #%d: %s)\n",
+ id.nameid, id.name);
+ }
+ }
if( (t = libconfig->setting_get_member(it, "BindOnEquip")) )
id.flag.bindonequip = libconfig->setting_get_bool(t) ? 1 : 0;
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 0ab6ef65b..8a1799fbd 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -457,6 +457,7 @@ struct item_data {
int value_buy;
int value_sell;
int type;
+ int 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;
@@ -465,7 +466,7 @@ struct item_data {
int def;
int range;
int slot;
- int look;
+ int view_sprite;
int elv;
int wlv;
int view_id;
@@ -521,7 +522,8 @@ struct item_data {
#define itemdb_type(n) (itemdb->search(n)->type)
#define itemdb_atk(n) (itemdb->search(n)->atk)
#define itemdb_def(n) (itemdb->search(n)->def)
-#define itemdb_look(n) (itemdb->search(n)->look)
+#define itemdb_subtype(n) (itemdb->search(n)->subtype)
+#define itemdb_sprite(n) (itemdb->search(n)->view_sprite)
#define itemdb_weight(n) (itemdb->search(n)->weight)
#define itemdb_equip(n) (itemdb->search(n)->equip)
#define itemdb_usescript(n) (itemdb->search(n)->script)
diff --git a/src/map/pc.c b/src/map/pc.c
index f332feea8..904867f76 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -765,9 +765,9 @@ int pc_equippoint(struct map_session_data *sd,int n)
return 0; //Not equippable by players.
ep = sd->inventory_data[n]->equip;
- if (sd->inventory_data[n]->look == W_DAGGER
- || sd->inventory_data[n]->look == W_1HSWORD
- || sd->inventory_data[n]->look == W_1HAXE
+ if (sd->inventory_data[n]->subtype == W_DAGGER
+ || sd->inventory_data[n]->subtype == W_1HSWORD
+ || sd->inventory_data[n]->subtype == W_1HAXE
) {
if (pc->checkskill(sd,AS_LEFT) > 0
|| (sd->job & MAPID_UPPERMASK) == MAPID_ASSASSIN
@@ -794,9 +794,9 @@ int pc_item_equippoint(struct map_session_data *sd, struct item_data* id)
return 0; //Not equippable by players.
ep = id->equip;
- if (id->look == W_DAGGER ||
- id->look == W_1HSWORD ||
- id->look == W_1HAXE) {
+ if (id->subtype == W_DAGGER ||
+ id->subtype == W_1HSWORD ||
+ id->subtype == W_1HAXE) {
if (pc->checkskill(sd, AS_LEFT) > 0 ||
(sd->job & MAPID_UPPERMASK) == MAPID_ASSASSIN ||
(sd->job & MAPID_UPPERMASK) == MAPID_KAGEROUOBORO) {
@@ -837,7 +837,7 @@ int pc_calcweapontype(struct map_session_data *sd)
return 1;
}
// dual-wield
- sd->status.weapon = 0;
+ sd->status.weapon = W_FIST;
switch (sd->weapontype1){
case W_DAGGER:
switch (sd->weapontype2) {
@@ -861,7 +861,7 @@ int pc_calcweapontype(struct map_session_data *sd)
}
}
// unknown, default to right hand type
- if (!sd->status.weapon)
+ if (sd->status.weapon == W_FIST)
sd->status.weapon = sd->weapontype1;
return 2;
@@ -884,20 +884,18 @@ int pc_setequipindex(struct map_session_data *sd)
if(sd->status.inventory[i].equip & pc->equip_pos[j])
sd->equip_index[j] = i;
- if(sd->status.inventory[i].equip & EQP_HAND_R)
- {
- if(sd->inventory_data[i])
- sd->weapontype1 = sd->inventory_data[i]->look;
+ if (sd->status.inventory[i].equip & EQP_HAND_R) {
+ if (sd->inventory_data[i])
+ sd->weapontype1 = sd->inventory_data[i]->subtype;
else
- sd->weapontype1 = 0;
+ sd->weapontype1 = W_FIST;
}
- if( sd->status.inventory[i].equip & EQP_HAND_L )
- {
- if( sd->inventory_data[i] && sd->inventory_data[i]->type == IT_WEAPON )
- sd->weapontype2 = sd->inventory_data[i]->look;
+ if (sd->status.inventory[i].equip & EQP_HAND_L) {
+ if (sd->inventory_data[i] != NULL && sd->inventory_data[i]->type == IT_WEAPON)
+ sd->weapontype2 = sd->inventory_data[i]->subtype;
else
- sd->weapontype2 = 0;
+ sd->weapontype2 = W_FIST;
}
}
}
@@ -1088,13 +1086,13 @@ int pc_isequip(struct map_session_data *sd,int n)
return 1; //Can equip all helms
if (sd->status.base_level > 96 && item->equip & EQP_ARMS && item->type == IT_WEAPON)
- switch(item->look) { //In weapons, the look determines type of weapon.
- case W_DAGGER: //Level 4 Knives are equippable.. this means all knives, I'd guess?
- case W_1HSWORD: //All 1H swords
- case W_1HAXE: //All 1H Axes
- case W_MACE: //All 1H Maces
- case W_STAFF: //All 1H Staves
- return 1;
+ switch (item->subtype) { //In weapons, the look determines type of weapon.
+ case W_DAGGER: //Level 4 Knives are equippable.. this means all knives, I'd guess?
+ case W_1HSWORD: //All 1H swords
+ case W_1HAXE: //All 1H Axes
+ case W_MACE: //All 1H Maces
+ case W_STAFF: //All 1H Staves
+ return 1;
}
}
}
@@ -5942,7 +5940,7 @@ int pc_checkallowskill(struct map_session_data *sd)
status_change_end(&sd->bl, scw_list[i], INVALID_TIMER);
}
- if(sd->sc.data[SC_STRUP] && sd->status.weapon)
+ if(sd->sc.data[SC_STRUP] && sd->status.weapon != W_FIST)
// Spurt requires bare hands (feet, in fact xD)
status_change_end(&sd->bl, SC_STRUP, INVALID_TIMER);
@@ -9757,25 +9755,27 @@ void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n,
nullpo_retv(sd);
if ((!map_no_view(sd->bl.m,EQP_SHADOW_WEAPON) && pos & EQP_SHADOW_WEAPON) ||
(pos & EQP_HAND_R)) {
- if(id)
- sd->weapontype1 = id->look;
+ if (id != NULL)
+ sd->weapontype1 = id->subtype;
else
- sd->weapontype1 = 0;
+ sd->weapontype1 = W_FIST;
pc->calcweapontype(sd);
clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
}
if ((!map_no_view(sd->bl.m,EQP_SHADOW_SHIELD) && pos & EQP_SHADOW_SHIELD) ||
(pos & EQP_HAND_L)) {
- if (id) {
- if(id->type == IT_WEAPON) {
+ if (id != NULL) {
+ if (id->type == IT_WEAPON) {
sd->status.shield = 0;
- sd->weapontype2 = id->look;
- } else if(id->type == IT_ARMOR) {
- sd->status.shield = id->look;
- sd->weapontype2 = 0;
+ sd->weapontype2 = id->subtype;
+ } else if (id->type == IT_ARMOR) {
+ sd->status.shield = id->view_sprite;
+ sd->weapontype2 = W_FIST;
}
- } else
- sd->status.shield = sd->weapontype2 = 0;
+ } else {
+ sd->status.shield = 0;
+ sd->weapontype2 = W_FIST;
+ }
pc->calcweapontype(sd);
clif->changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
}
@@ -9783,42 +9783,42 @@ void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n,
//causes client to redraw item on top of itself. (suggested by Lupus)
if (!map_no_view(sd->bl.m,EQP_HEAD_LOW) && pos & EQP_HEAD_LOW && pc->checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1) {
if (id && !(pos&(EQP_HEAD_TOP|EQP_HEAD_MID)))
- sd->status.head_bottom = id->look;
+ sd->status.head_bottom = id->view_sprite;
else
sd->status.head_bottom = 0;
clif->changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
}
if (!map_no_view(sd->bl.m,EQP_HEAD_TOP) && pos & EQP_HEAD_TOP && pc->checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1) {
if (id)
- sd->status.head_top = id->look;
+ sd->status.head_top = id->view_sprite;
else
sd->status.head_top = 0;
clif->changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
}
if (!map_no_view(sd->bl.m,EQP_HEAD_MID) && pos & EQP_HEAD_MID && pc->checkequip(sd,EQP_COSTUME_HEAD_MID) == -1) {
if (id && !(pos&EQP_HEAD_TOP))
- sd->status.head_mid = id->look;
+ sd->status.head_mid = id->view_sprite;
else
sd->status.head_mid = 0;
clif->changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
}
if (!map_no_view(sd->bl.m,EQP_COSTUME_HEAD_TOP) && pos & EQP_COSTUME_HEAD_TOP) {
if (id){
- sd->status.head_top = id->look;
+ sd->status.head_top = id->view_sprite;
} else
sd->status.head_top = 0;
clif->changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
}
if (!map_no_view(sd->bl.m,EQP_COSTUME_HEAD_MID) && pos & EQP_COSTUME_HEAD_MID) {
if(id && !(pos&EQP_HEAD_TOP)){
- sd->status.head_mid = id->look;
+ sd->status.head_mid = id->view_sprite;
} else
sd->status.head_mid = 0;
clif->changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
}
if (!map_no_view(sd->bl.m,EQP_COSTUME_HEAD_LOW) && pos & EQP_COSTUME_HEAD_LOW) {
if (id && !(pos&(EQP_HEAD_TOP|EQP_HEAD_MID))){
- sd->status.head_bottom = id->look;
+ sd->status.head_bottom = id->view_sprite;
} else
sd->status.head_bottom = 0;
clif->changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
@@ -9827,12 +9827,12 @@ void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n,
if (!map_no_view(sd->bl.m,EQP_SHOES) && pos & EQP_SHOES)
clif->changelook(&sd->bl,LOOK_SHOES,0);
if (!map_no_view(sd->bl.m,EQP_GARMENT) && pos&EQP_GARMENT && pc->checkequip(sd,EQP_COSTUME_GARMENT) == -1) {
- sd->status.robe = id ? id->look : 0;
+ sd->status.robe = id ? id->view_sprite : 0;
clif->changelook(&sd->bl, LOOK_ROBE, sd->status.robe);
}
if (!map_no_view(sd->bl.m,EQP_COSTUME_GARMENT) && pos & EQP_COSTUME_GARMENT) {
- sd->status.robe = id ? id->look : 0;
+ sd->status.robe = id ? id->view_sprite : 0;
clif->changelook(&sd->bl,LOOK_ROBE,sd->status.robe);
}
}
@@ -9987,7 +9987,7 @@ void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos)
{
nullpo_retv(sd);
if (pos & EQP_HAND_R) {
- sd->weapontype1 = 0;
+ sd->weapontype1 = W_FIST;
sd->status.weapon = sd->weapontype2;
pc->calcweapontype(sd);
clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
@@ -9995,7 +9995,8 @@ void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos)
status_change_end(&sd->bl, SC_DANCING, INVALID_TIMER); // Unequipping => stop dancing.
}
if (pos & EQP_HAND_L) {
- sd->status.shield = sd->weapontype2 = 0;
+ sd->status.shield = 0;
+ sd->weapontype2 = W_FIST;
pc->calcweapontype(sd);
clif->changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
}
@@ -10013,17 +10014,17 @@ void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos)
}
if (pos & EQP_COSTUME_HEAD_TOP) {
- sd->status.head_top = ( pc->checkequip(sd,EQP_HEAD_TOP) >= 0 ) ? sd->inventory_data[pc->checkequip(sd,EQP_HEAD_TOP)]->look : 0;
+ sd->status.head_top = ( pc->checkequip(sd,EQP_HEAD_TOP) >= 0 ) ? sd->inventory_data[pc->checkequip(sd,EQP_HEAD_TOP)]->view_sprite : 0;
clif->changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
}
if (pos & EQP_COSTUME_HEAD_MID) {
- sd->status.head_mid = ( pc->checkequip(sd,EQP_HEAD_MID) >= 0 ) ? sd->inventory_data[pc->checkequip(sd,EQP_HEAD_MID)]->look : 0;
+ sd->status.head_mid = ( pc->checkequip(sd,EQP_HEAD_MID) >= 0 ) ? sd->inventory_data[pc->checkequip(sd,EQP_HEAD_MID)]->view_sprite : 0;
clif->changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
}
if (pos & EQP_COSTUME_HEAD_LOW) {
- sd->status.head_bottom = ( pc->checkequip(sd,EQP_HEAD_LOW) >= 0 ) ? sd->inventory_data[pc->checkequip(sd,EQP_HEAD_LOW)]->look : 0;
+ sd->status.head_bottom = ( pc->checkequip(sd,EQP_HEAD_LOW) >= 0 ) ? sd->inventory_data[pc->checkequip(sd,EQP_HEAD_LOW)]->view_sprite : 0;
clif->changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
}
@@ -10036,7 +10037,7 @@ void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos)
}
if (pos & EQP_COSTUME_GARMENT) {
- sd->status.robe = ( pc->checkequip(sd,EQP_GARMENT) >= 0 ) ? sd->inventory_data[pc->checkequip(sd,EQP_GARMENT)]->look : 0;
+ sd->status.robe = ( pc->checkequip(sd,EQP_GARMENT) >= 0 ) ? sd->inventory_data[pc->checkequip(sd,EQP_GARMENT)]->view_sprite : 0;
clif->changelook(&sd->bl,LOOK_ROBE,sd->status.robe);
}
}
@@ -10091,7 +10092,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
clif->unequipitemack(sd, n, pos, UIA_SUCCESS);
if ((pos & EQP_ARMS) &&
- sd->weapontype1 == 0 && sd->weapontype2 == 0 && (sd->sc.data[SC_TK_SEVENWIND] == 0 || sd->sc.data[SC_ASPERSIO])) //Check for seven wind (but not level seven!)
+ sd->weapontype1 == W_FIST && sd->weapontype2 == W_FIST && (sd->sc.data[SC_TK_SEVENWIND] == NULL || sd->sc.data[SC_ASPERSIO] != NULL)) //Check for seven wind (but not level seven!)
skill->enchant_elemental_end(&sd->bl, -1);
if (pos & EQP_ARMOR) {
diff --git a/src/map/script.c b/src/map/script.c
index 914bee75c..a919467cf 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -14034,7 +14034,7 @@ BUILDIN(getiteminfo)
script_pushint(st, it->slot);
break;
case 11:
- script_pushint(st, it->look);
+ script_pushint(st, it->subtype);
break;
case 12:
script_pushint(st, it->elv);
@@ -14287,7 +14287,7 @@ BUILDIN(setiteminfo)
it->slot = value;
break;
case 11:
- it->look = value;
+ it->subtype = value;
break;
case 12:
it->elv = value;
diff --git a/src/map/skill.c b/src/map/skill.c
index e187b7e8b..1f510e6fe 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -14555,7 +14555,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
clif->messagecolor_self(sd->fd, COLOR_RED, e_msg);
return 0;
}
- if (!(require.ammo&1<<sd->inventory_data[i]->look)) { //Ammo type check. Send the "wrong weapon type" message
+ if (!(require.ammo&1<<sd->inventory_data[i]->subtype)) { //Ammo type check. Send the "wrong weapon type" message
//which is the closest we have to wrong ammo type. [Skotlex]
clif->arrow_fail(sd,0); //Haplo suggested we just send the equip-arrows message instead. [Skotlex]
//clif->skill_fail(sd,skill_id,USESKILL_FAIL_THIS_WEAPON,0);
diff --git a/src/map/status.c b/src/map/status.c
index c98857736..0d2171eac 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -10747,7 +10747,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
}
if (begin_spurt && sce->val1 >= 7
&& DIFF_TICK(timer->gettick(), starttick) <= 1000
- && (!sd || (sd->weapontype1 == 0 && sd->weapontype2 == 0))
+ && (!sd || (sd->weapontype1 == W_FIST && sd->weapontype2 == W_FIST))
)
sc_start(bl, bl,SC_STRUP,100,sce->val1,skill->get_time2(status->sc2skill(type), sce->val1));
}
diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c
index 33a62757a..cb8660df9 100644
--- a/src/plugins/db2sql.c
+++ b/src/plugins/db2sql.c
@@ -255,6 +255,9 @@ int itemdb2sql_sub(struct config_setting_t *entry, int n, const char *source)
// type
StrBuf->Printf(&buf, "'%d',", it->flag.delay_consume ? IT_DELAYCONSUME : it->type);
+ // subtype
+ StrBuf->Printf(&buf, "'%d',", it->subtype);
+
// price_buy
StrBuf->Printf(&buf, "'%d',", it->value_buy);
@@ -324,8 +327,8 @@ int itemdb2sql_sub(struct config_setting_t *entry, int n, const char *source)
// disable_options
StrBuf->Printf(&buf, "'%d',", it->flag.no_options?1:0);
- // view
- StrBuf->Printf(&buf, "'%d',", it->look);
+ // view_sprite
+ StrBuf->Printf(&buf, "'%d',", it->view_sprite);
// bindonequip
StrBuf->Printf(&buf, "'%d',", it->flag.bindonequip?1:0);
@@ -449,6 +452,7 @@ void itemdb2sql_tableheader(void)
" `name_english` varchar(50) NOT NULL DEFAULT '',\n"
" `name_japanese` varchar(50) NOT NULL DEFAULT '',\n"
" `type` tinyint(2) UNSIGNED NOT NULL DEFAULT '0',\n"
+ " `subtype` tinyint(2) UNSIGNED DEFAULT NULL,\n"
" `price_buy` mediumint(10) DEFAULT NULL,\n"
" `price_sell` mediumint(10) DEFAULT NULL,\n"
" `weight` smallint(5) UNSIGNED DEFAULT NULL,\n"
@@ -466,7 +470,7 @@ void itemdb2sql_tableheader(void)
" `equip_level_max` smallint(5) UNSIGNED DEFAULT NULL,\n"
" `refineable` tinyint(1) UNSIGNED DEFAULT NULL,\n"
" `disable_options` tinyint(1) UNSIGNED DEFAULT NULL,\n"
- " `view` smallint(3) UNSIGNED DEFAULT NULL,\n"
+ " `view_sprite` smallint(3) UNSIGNED DEFAULT NULL,\n"
" `bindonequip` tinyint(1) UNSIGNED DEFAULT NULL,\n"
" `forceserial` tinyint(1) UNSIGNED DEFAULT NULL,\n"
" `buyingstore` tinyint(1) UNSIGNED DEFAULT NULL,\n"