summaryrefslogtreecommitdiff
path: root/src/emap
diff options
context:
space:
mode:
Diffstat (limited to 'src/emap')
-rw-r--r--src/emap/init.c4
-rw-r--r--src/emap/pc.c19
-rw-r--r--src/emap/script.c22
-rw-r--r--src/emap/script_buildins.c7
-rw-r--r--src/emap/skill.c4
5 files changed, 35 insertions, 21 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 510d40b..647f56a 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -361,8 +361,8 @@ HPExport void plugin_init (void)
itemdb->isidentified = eitemdb_isidentified;
itemdb->isidentified2 = eitemdb_isidentified2;
- langScriptId = script->add_str("Lang");
- mountScriptId = script->add_str("mount");
+ langScriptId = script->add_variable("Lang");
+ mountScriptId = script->add_variable("mount");
isInit = true;
}
diff --git a/src/emap/pc.c b/src/emap/pc.c
index afea705..e54b9e7 100644
--- a/src/emap/pc.c
+++ b/src/emap/pc.c
@@ -733,6 +733,11 @@ bool epc_adoption_pre(struct map_session_data **p1_sdPtr,
pc->skill(p1_sd, WE_CALLBABY, 1, SKILL_GRANT_PERMANENT);
pc->skill(p2_sd, WE_CALLBABY, 1, SKILL_GRANT_PERMANENT);
+ // Achievements [Smokexyz/Hercules]
+ achievement->validate_adopt(p1_sd, true); // Parent 1
+ achievement->validate_adopt(p2_sd, true); // Parent 2
+ achievement->validate_adopt(b_sd, false); // Baby
+
hookStop();
return true;
}
@@ -833,13 +838,13 @@ int epc_jobchange(struct map_session_data *sd,
{
// changing from 1st to 2nd job
sd->change_level_2nd = sd->status.job_level;
- pc_setglobalreg(sd, script->add_str("jobchange_level"), sd->change_level_2nd);
+ pc_setglobalreg(sd, script->add_variable("jobchange_level"), sd->change_level_2nd);
}
else if ((job & JOBL_THIRD) != 0 && (sd->job & JOBL_THIRD) == 0)
{
// changing from 2nd to 3rd job
sd->change_level_3rd = sd->status.job_level;
- pc_setglobalreg(sd, script->add_str("jobchange_level_3rd"), sd->change_level_3rd);
+ pc_setglobalreg(sd, script->add_variable("jobchange_level_3rd"), sd->change_level_3rd);
}
*/
@@ -854,8 +859,8 @@ int epc_jobchange(struct map_session_data *sd,
clif->deleteskill(sd, sd->cloneskill_id);
}
sd->cloneskill_id = 0;
- pc_setglobalreg(sd, script->add_str("CLONE_SKILL"), 0);
- pc_setglobalreg(sd, script->add_str("CLONE_SKILL_LV"), 0);
+ pc_setglobalreg(sd, script->add_variable("CLONE_SKILL"), 0);
+ pc_setglobalreg(sd, script->add_variable("CLONE_SKILL_LV"), 0);
}
if(sd->reproduceskill_id)
@@ -869,8 +874,8 @@ int epc_jobchange(struct map_session_data *sd,
clif->deleteskill(sd, sd->reproduceskill_id);
}
sd->reproduceskill_id = 0;
- pc_setglobalreg(sd, script->add_str("REPRODUCE_SKILL"),0);
- pc_setglobalreg(sd, script->add_str("REPRODUCE_SKILL_LV"),0);
+ pc_setglobalreg(sd, script->add_variable("REPRODUCE_SKILL"),0);
+ pc_setglobalreg(sd, script->add_variable("REPRODUCE_SKILL_LV"),0);
}
/*
@@ -1012,6 +1017,8 @@ int epc_jobchange(struct map_session_data *sd,
quest->questinfo_refresh(sd);
+ achievement->validate_jobchange(sd); // Achievements [Smokexyz/Hercules]
+
return 0;
}
diff --git a/src/emap/script.c b/src/emap/script.c
index 4bc427b..5e8d1ae 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -410,7 +410,7 @@ void escript_run_use_script_pre(struct map_session_data **sdPtr,
const int oid = *oidPtr;
if (oid == 0)
{
- pc->setreg(sd, script->add_str("@useType"), 0);
+ pc->setreg(sd, script->add_variable("@useType"), 0);
script->current_item_id = itemData->nameid;
script->run(itemData->script, 0, sd->bl.id, oid);
script->current_item_id = 0;
@@ -425,11 +425,11 @@ void escript_run_use_script_pre(struct map_session_data **sdPtr,
return;
}
- pc->setreg(sd, script->add_str("@useType"), data->tmpUseType);
+ pc->setreg(sd, script->add_variable("@useType"), data->tmpUseType);
script->current_item_id = itemData->nameid;
script->run(itemData->script, 0, sd->bl.id, oid);
script->current_item_id = 0;
- pc->setreg(sd, script->add_str("@useType"), 0);
+ pc->setreg(sd, script->add_variable("@useType"), 0);
data->tmpUseType = 0;
}
hookStop();
@@ -444,11 +444,11 @@ void script_run_item_amount_script(TBL_PC *sd,
return;
script->current_item_id = itemId;
- pc->setreg(sd, script->add_str("@itemId"), itemId);
- pc->setreg(sd, script->add_str("@itemAmount"), amount);
+ pc->setreg(sd, script->add_variable("@itemId"), itemId);
+ pc->setreg(sd, script->add_variable("@itemAmount"), amount);
script->run(itemScript, 0, sd->bl.id, npc->fake_nd->bl.id);
- pc->setreg(sd, script->add_str("@itemId"), 0);
- pc->setreg(sd, script->add_str("@itemAmount"), 0);
+ pc->setreg(sd, script->add_variable("@itemId"), 0);
+ pc->setreg(sd, script->add_variable("@itemAmount"), 0);
script->current_item_id = 0;
}
@@ -461,10 +461,10 @@ void script_run_card_script(TBL_PC *sd,
return;
script->current_item_id = itemId;
- pc->setreg(sd, script->add_str("@itemId"), itemId);
- pc->setreg(sd, script->add_str("@cardId"), cardId);
+ pc->setreg(sd, script->add_variable("@itemId"), itemId);
+ pc->setreg(sd, script->add_variable("@cardId"), cardId);
script->run(itemScript, 0, sd->bl.id, npc->fake_nd->bl.id);
- pc->setreg(sd, script->add_str("@itemId"), 0);
- pc->setreg(sd, script->add_str("@cardId"), 0);
+ pc->setreg(sd, script->add_variable("@itemId"), 0);
+ pc->setreg(sd, script->add_variable("@cardId"), 0);
script->current_item_id = 0;
}
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c
index 78fb940..02b26cd 100644
--- a/src/emap/script_buildins.c
+++ b/src/emap/script_buildins.c
@@ -1094,6 +1094,9 @@ BUILDIN(failedRefIndex)
if (sd->status.inventory[n].nameid <= 0 || sd->status.inventory[n].amount <= 0)
return false;
+ // Call before changing refine to 0.
+ achievement->validate_refine(sd, n, false);
+
sd->status.inventory[n].refine = 0;
if (sd->status.inventory[n].equip)
pc->unequipitem(sd, n, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE);
@@ -1124,6 +1127,9 @@ BUILDIN(downRefIndex)
clif->delitem(sd, n, 1, DELITEM_MATERIALCHANGE);
logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[n], sd->inventory_data[n]);
clif->additem(sd, n, 1, 0);
+
+ achievement->validate_refine(sd, n, false); // Achievements [Smokexyz/Hercules]
+
clif->misceffect(&sd->bl, 2);
return true;
}
@@ -1152,6 +1158,7 @@ BUILDIN(successRefIndex)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[n],sd->inventory_data[n]);
clif->additem(sd, n, 1, 0);
clif->misceffect(&sd->bl, 3);
+ achievement->validate_refine(sd, i, true); // Achievements [Smokexyz/Hercules]
if (sd->status.inventory[n].refine == 10 &&
sd->status.inventory[n].card[0] == CARD0_FORGE &&
diff --git a/src/emap/skill.c b/src/emap/skill.c
index a45792f..20e4a82 100644
--- a/src/emap/skill.c
+++ b/src/emap/skill.c
@@ -59,8 +59,8 @@ int eskill_check_condition_castend_post(int retVal,
struct event_data* ev = node->data;
if (ev)
{
- pc->setreg(sd, script->add_str("@skillId"), skill_id);
- pc->setreg(sd, script->add_str("@skillLv"), skill_lv);
+ pc->setreg(sd, script->add_variable("@skillId"), skill_id);
+ pc->setreg(sd, script->add_variable("@skillLv"), skill_lv);
script->run(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id);
}
node = node->next;