summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/achievement.c7
-rw-r--r--src/map/npc.c5
-rw-r--r--src/map/script.c14
3 files changed, 18 insertions, 8 deletions
diff --git a/src/map/achievement.c b/src/map/achievement.c
index 0369b0fb5..6abdb74ee 100644
--- a/src/map/achievement.c
+++ b/src/map/achievement.c
@@ -1378,11 +1378,10 @@ static bool achievement_readdb_validate_criteria_itemtype(const struct config_se
}
} else if ((tt = libconfig->setting_get_member(t, "ItemType")) && config_setting_is_array(tt)) {
int j = 0;
- uint32 it_type = 0;
while (j < libconfig->setting_length(tt)) {
if ((val = libconfig->setting_get_int_elem(tt, j))) {
- if (val < IT_HEALING || val >= IT_MAX) {
+ if (val < IT_HEALING || val > IT_MAX) {
ShowError("achievement_readdb_validate_criteria_itemtype: Invalid ItemType %d provided (Achievement: %d, Objective: %d). Skipping...\n", val, entry_id, obj_idx);
continue;
}
@@ -1405,8 +1404,6 @@ static bool achievement_readdb_validate_criteria_itemtype(const struct config_se
}
j++;
}
-
- obj->item_type = it_type;
} else if (achievement_criteria_itemtype(type)) {
ShowError("achievement_readdb_validate_criteria_itemtype: Criteria requires a ItemType field (Achievement: %d, Objective: %d). Skipping...\n", entry_id, obj_idx);
return false;
@@ -1780,7 +1777,7 @@ static void achievement_readb(void)
if (libconfig->setting_lookup_int(conf, "Id", &t_ad.id) == 0) {
ShowError("achievement_readdb: Id field for entry %d is not provided! Skipping...\n", entry);
continue;
- } else if (t_ad.id <= 0 || t_ad.id > INT32_MAX) {
+ } else if (t_ad.id <= 0) {
ShowError("achievement_readdb: Invalid Id %d for entry %d. Skipping...\n", t_ad.id, entry);
continue;
}
diff --git a/src/map/npc.c b/src/map/npc.c
index 3a00b38ea..f80f8443a 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2272,10 +2272,11 @@ static int npc_selllist(struct map_session_data *sd, struct itemlist *item_list)
}
}
- pc->delitem(sd, idx, entry->amount, 0, DELITEM_SOLD, LOG_TYPE_NPC);
-
// Achievements [Smokexyz/Hercules]
achievement->validate_item_sell(sd, sd->status.inventory[idx].nameid, entry->amount);
+
+ pc->delitem(sd, idx, entry->amount, 0, DELITEM_SOLD, LOG_TYPE_NPC);
+
}
if (z + sd->status.zeny > MAX_ZENY && nd->master_nd == NULL)
diff --git a/src/map/script.c b/src/map/script.c
index bc59f9cf8..6c09bc6c9 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -17791,14 +17791,26 @@ static BUILDIN(getd)
char varname[100];
const char *buffer;
int elem;
+ int id;
buffer = script_getstr(st, 2);
if (sscanf(buffer, "%99[^[][%d]", varname, &elem) < 2)
elem = 0;
+ id = script->search_str(varname);
+
+ if (id < 0) {
+ id = script->add_str(varname);
+ script->str_data[id].type = C_NAME;
+ } else if (script->str_data[id].type != C_NAME) {
+ ShowError("script:getd: `%s` is already used by something that is not a variable.\n", varname);
+ st->state = END;
+ return false;
+ }
+
// Push the 'pointer' so it's more flexible [Lance]
- script->push_val(st->stack, C_NAME, reference_uid(script->add_str(varname), elem),NULL);
+ script->push_val(st->stack, C_NAME, reference_uid(id, elem),NULL);
return true;
}