summaryrefslogtreecommitdiff
path: root/src/emap/pc.c
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-10-17 14:09:33 -0300
committerJesusaves <cpntb1@ymail.com>2019-10-17 14:09:33 -0300
commit50ee9e848cb9b87ea42580783051e6c883ed8f73 (patch)
tree58cd4f4607704e5c81c3a5d6e53b08c7e4c3c8e4 /src/emap/pc.c
parentb972376c3cd817d915e4a15cab84e46992a8d5a2 (diff)
downloadevol-hercules-50ee9e848cb9b87ea42580783051e6c883ed8f73.tar.gz
evol-hercules-50ee9e848cb9b87ea42580783051e6c883ed8f73.tar.bz2
evol-hercules-50ee9e848cb9b87ea42580783051e6c883ed8f73.tar.xz
evol-hercules-50ee9e848cb9b87ea42580783051e6c883ed8f73.zip
And now remove the cheat mentioned on previous commit; When resetting stats
equipment requeriments will be unequipped. FINALLY. The bug was data being set to NULL...
Diffstat (limited to 'src/emap/pc.c')
-rw-r--r--src/emap/pc.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/src/emap/pc.c b/src/emap/pc.c
index 0a3d1ce..5e8b3b0 100644
--- a/src/emap/pc.c
+++ b/src/emap/pc.c
@@ -22,6 +22,7 @@
#include "map/itemdb.h"
#include "map/npc.h"
#include "map/pc.h"
+#include "map/status.h"
#include "map/quest.h"
#include "plugins/HPMHooking.h"
@@ -1074,7 +1075,7 @@ int epc_equipitem_pre(struct map_session_data **sdPtr,
(data->requiredSkill && !pc->checkskill(sd, data->requiredSkill))
)
{
- clif->equipitemack(sd,n,0,EIA_FAIL); // fail
+ clif->equipitemack(sd,n,0,EIA_FAIL); // fail
hookStop();
return 0;
}
@@ -1083,6 +1084,54 @@ int epc_equipitem_pre(struct map_session_data **sdPtr,
return 0;
}
+int epc_resetstate_post(int retVal,
+ struct map_session_data *sd) {
+
+ // Do nothing if it failed
+ if (!retVal)
+ return retVal;
+
+ int i;
+ struct item_data *id;
+ struct ItemdExt *data;
+
+ // Check all your equipped items
+ for (i = 0; i < EQI_MAX; i++) {
+ int index = sd->equip_index[i];
+
+ id = sd->inventory_data[index];
+
+ // Skip possibly empty slots
+ if (id == NULL)
+ continue;
+
+ data = itemd_get(id);
+
+ // Skip broken pointers
+ if (data == NULL)
+ continue;
+
+ // Check for requeriments
+ if (sd->status.str < data->requiredStr ||
+ sd->status.agi < data->requiredAgi ||
+ sd->status.vit < data->requiredVit ||
+ sd->status.int_ < data->requiredInt ||
+ sd->status.dex < data->requiredDex ||
+ sd->status.luk < data->requiredLuk ||
+ sd->status.max_hp < data->requiredMaxHp ||
+ sd->status.max_sp < data->requiredMaxSp ||
+ (data->requiredSkill && !pc->checkskill(sd, data->requiredSkill))
+ )
+ {
+ // Unequip the item
+ pc->unequipitem(sd, index, PCUNEQUIPITEM_FORCE);
+ }
+ }
+ // Now recalculate, and return whatever it had to return
+ status_calc_pc(sd,SCO_NONE);
+ return retVal;
+}
+
// disable job based bonuses
void epc_calc_skilltree_bonus_pre(struct map_session_data **sdPtr __attribute__ ((unused)),
int *classidxPtr __attribute__ ((unused)))