summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml4
-rw-r--r--src/map/pc.cpp5
-rw-r--r--src/map/script-fun.cpp50
3 files changed, 56 insertions, 3 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0368723..1cc7c15 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,9 +5,7 @@ stages:
variables: &base_vars
DEBIAN_COMMON_PACKAGES: make git gcc g++
- # Depth of clone. If no tag is made after this many commits, then
- # the git describe call and version header generation will fail.
- GIT_DEPTH: 100 # Will break again eventually.
+ GIT_DEPTH: 0 # avoid shallow clone since version is based on latest tag
GIT_SUBMODULE_STRATEGY: normal
.prerequisites: &prerequisites
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 9ef70fe..ecfd50e 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -871,6 +871,11 @@ int pc_authok(AccountId id, int login_id2, ClientVersion client_version,
sd->quick_regeneration_sp.amount = 0;
sd->heal_xp = 0;
sd->max_weight_override = 0;
+ sd->activity.kills = 0;
+ sd->activity.casts = 0;
+ sd->activity.items_used = 0;
+ sd->activity.tiles_walked = 0;
+ sd->activity.attacks = 0;
sd->canact_tick = tick;
sd->canmove_tick = tick;
sd->attackabletime = tick;
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 27807b9..64ba542 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -5517,6 +5517,53 @@ void builtin_getmapnamefromhash(ScriptState *st)
}
/*==========================================
+ * Look if a map exists
+ * return value:
+ * 0 = map does not exist
+ * 1 = map exists
+ *------------------------------------------
+ */
+static
+void builtin_mapexists(ScriptState *st)
+{
+ MapName mapname = stringish<MapName>(ZString(conv_str(st, &AARG(0))));
+ push_int<ScriptDataInt>(st->stack, map_mapname2mapid(mapname).is_some());
+}
+
+/*==========================================
+ * Returns number of available maps
+ *------------------------------------------
+ */
+static
+void builtin_numberofmaps(ScriptState *st)
+{
+ push_int<ScriptDataInt>(st->stack, maps_db.size());
+}
+
+/*==========================================
+ * Get the map name of a specific maps_db index
+ *------------------------------------------
+ */
+static
+void builtin_getmapnamebyindex(ScriptState *st)
+{
+ int index = conv_num(st, &AARG(0));
+ int count = 0;
+
+ for (auto& mit : maps_db)
+ {
+ if (count == index)
+ {
+ push_str<ScriptDataStr>(st->stack, mit.second->name_);
+ return;
+ }
+ ++count;
+ }
+
+ push_str<ScriptDataStr>(st->stack, ""_s);
+}
+
+/*==========================================
* Get the NPC's info
*------------------------------------------
*/
@@ -5782,6 +5829,9 @@ BuiltinFunction builtin_functions[] =
BUILTIN(getmapmaxy, "M"_s, 'i'),
BUILTIN(getmaphash, "M"_s, 'i'),
BUILTIN(getmapnamefromhash, "i"_s, 's'),
+ BUILTIN(mapexists, "M"_s, 'i'),
+ BUILTIN(numberofmaps, ""_s, 'i'),
+ BUILTIN(getmapnamebyindex, "i"_s, 's'),
BUILTIN(mapexit, ""_s, '\0'),
BUILTIN(freeloop, "i"_s, '\0'),
BUILTIN(if_then_else, "iii"_s, 'v'),