summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-09-06 15:21:25 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-09-06 15:21:25 +0000
commit59e98faf7bfc79b13cf1f2d006d19e1c08e8d5d1 (patch)
tree61eab22a7f17de14dfc078b8c91f432fcabbdb53 /src/map/script.c
parent0769d6ded1ef403ed60d7d5d010ff4cec8b02c19 (diff)
downloadhercules-59e98faf7bfc79b13cf1f2d006d19e1c08e8d5d1.tar.gz
hercules-59e98faf7bfc79b13cf1f2d006d19e1c08e8d5d1.tar.bz2
hercules-59e98faf7bfc79b13cf1f2d006d19e1c08e8d5d1.tar.xz
hercules-59e98faf7bfc79b13cf1f2d006d19e1c08e8d5d1.zip
- Renamed createmercenary to mercenary_create.
- Added other required mercenary script commands for official script. - New Constants entries for this script. - Update to missing configuration on mercenary skills. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13195 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c130
1 files changed, 128 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c
index d2a77036b..dc1a0fa6d 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -12810,7 +12810,7 @@ BUILDIN_FUNC(setcell)
/*==========================================
* Mercenary Commands
*------------------------------------------*/
-BUILDIN_FUNC(createmercenary)
+BUILDIN_FUNC(mercenary_create)
{
struct map_session_data *sd;
int class_, contract_time;
@@ -12860,6 +12860,128 @@ BUILDIN_FUNC(mercenary_sc_start)
return 0;
}
+BUILDIN_FUNC(mercenary_get_calls)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+ int guild;
+
+ if( sd == NULL )
+ return 0;
+
+ guild = script_getnum(st,2);
+ switch( guild )
+ {
+ case ARCH_MERC_GUILD:
+ script_pushint(st,sd->status.arch_calls);
+ break;
+ case SPEAR_MERC_GUILD:
+ script_pushint(st,sd->status.spear_calls);
+ break;
+ case SWORD_MERC_GUILD:
+ script_pushint(st,sd->status.sword_calls);
+ break;
+ default:
+ script_pushint(st,0);
+ break;
+ }
+
+ return 0;
+}
+
+BUILDIN_FUNC(mercenary_set_calls)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+ int guild, value, *calls;
+
+ if( sd == NULL )
+ return 0;
+
+ guild = script_getnum(st,2);
+ value = script_getnum(st,3);
+
+ switch( guild )
+ {
+ case ARCH_MERC_GUILD:
+ calls = &sd->status.arch_calls;
+ break;
+ case SPEAR_MERC_GUILD:
+ calls = &sd->status.spear_calls;
+ break;
+ case SWORD_MERC_GUILD:
+ calls = &sd->status.sword_calls;
+ break;
+ default:
+ return 0; // Invalid Guild
+ }
+
+ *calls += value;
+ *calls = cap_value(*calls, 0, INT_MAX);
+
+ return 0;
+}
+
+BUILDIN_FUNC(mercenary_get_faith)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+ int guild;
+
+ if( sd == NULL )
+ return 0;
+
+ guild = script_getnum(st,2);
+ switch( guild )
+ {
+ case ARCH_MERC_GUILD:
+ script_pushint(st,sd->status.arch_faith);
+ break;
+ case SPEAR_MERC_GUILD:
+ script_pushint(st,sd->status.spear_faith);
+ break;
+ case SWORD_MERC_GUILD:
+ script_pushint(st,sd->status.sword_faith);
+ break;
+ default:
+ script_pushint(st,0);
+ break;
+ }
+
+ return 0;
+}
+
+BUILDIN_FUNC(mercenary_set_faith)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+ int guild, value, *calls;
+
+ if( sd == NULL )
+ return 0;
+
+ guild = script_getnum(st,2);
+ value = script_getnum(st,3);
+
+ switch( guild )
+ {
+ case ARCH_MERC_GUILD:
+ calls = &sd->status.arch_faith;
+ break;
+ case SPEAR_MERC_GUILD:
+ calls = &sd->status.spear_faith;
+ break;
+ case SWORD_MERC_GUILD:
+ calls = &sd->status.sword_faith;
+ break;
+ default:
+ return 0; // Invalid Guild
+ }
+
+ *calls += value;
+ *calls = cap_value(*calls, 0, INT_MAX);
+ if( mercenary_get_guild(sd->md) == guild )
+ clif_mercenary_updatestatus(sd,SP_MERCFAITH);
+
+ return 0;
+}
+
/******************
Questlog script commands
*******************/
@@ -13290,8 +13412,12 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(hasquest, "i"),
BUILDIN_DEF(setwall,"siiiiis"),
BUILDIN_DEF(delwall,"s"),
- BUILDIN_DEF(createmercenary,"ii"),
+ BUILDIN_DEF(mercenary_create,"ii"),
BUILDIN_DEF(mercenary_heal,"ii"),
BUILDIN_DEF(mercenary_sc_start,"iii"),
+ BUILDIN_DEF(mercenary_get_calls,"i"),
+ BUILDIN_DEF(mercenary_get_faith,"i"),
+ BUILDIN_DEF(mercenary_set_calls,"ii"),
+ BUILDIN_DEF(mercenary_set_faith,"ii"),
{NULL,NULL,NULL},
};