summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 3e11a510e..c57b086f4 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -8268,20 +8268,36 @@ BUILDIN(addtoskill) {
/// guildskill <skill id>,<amount>;
/// guildskill "<skill name>",<amount>;
BUILDIN(guildskill) {
- int id;
+ int skill_id, id, max_points;
int level;
+
TBL_PC* sd;
- int i;
+ struct guild *gd;
+ struct guild_skill gd_skill;
sd = script->rid2sd(st);
if( sd == NULL )
- return true;// no player attached, report source
+ return false; // no player attached, report source
- id = ( script_isstringtype(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) );
+ if( (gd = sd->guild) == NULL )
+ return true;
+
+ skill_id = ( script_isstringtype(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) );
level = script_getnum(st,3);
- for( i=0; i < level; i++ )
- guild->skillup(sd, id);
+ id = skill_id - GD_SKILLBASE;
+ max_points = guild->skill_get_max(skill_id);
+
+ if( (gd->skill[id].lv + level) > max_points )
+ level = max_points - gd->skill[id].lv;
+
+ if( level == 0 )
+ return true;
+
+ memcpy(&gd_skill, &(gd->skill[id]), sizeof(gd->skill[id]));
+ gd_skill.lv += level;
+
+ intif->guild_change_basicinfo( gd->guild_id, GBI_SKILLLV, &(gd_skill), sizeof(gd_skill) );
return true;
}
@@ -18538,6 +18554,13 @@ BUILDIN(tradertype) {
npc->market_delfromsql(nd,USHRT_MAX);
}
+#if PACKETVER < 20131223
+ if( type == NST_MARKET ) {
+ ShowWarning("buildin_tradertype: NST_MARKET is only available with PACKETVER 20131223 or newer!\n");
+ script->reportsrc(st);
+ }
+#endif
+
nd->u.scr.shop->type = type;
return true;