summaryrefslogtreecommitdiff
path: root/src/emap/battleground.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-28 18:36:58 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-28 18:36:58 +0300
commit07758e21abf23ad6742b0f6aacedbb7c60c81e98 (patch)
tree7f5b9b0bd7107426f97bc91150b52d2655e0d3f4 /src/emap/battleground.c
parent7218f15b792d6ae2bf88b65f6901ae5aa86ecb7a (diff)
downloadevol-hercules-07758e21abf23ad6742b0f6aacedbb7c60c81e98.tar.gz
evol-hercules-07758e21abf23ad6742b0f6aacedbb7c60c81e98.tar.bz2
evol-hercules-07758e21abf23ad6742b0f6aacedbb7c60c81e98.tar.xz
evol-hercules-07758e21abf23ad6742b0f6aacedbb7c60c81e98.zip
Add support for team id for battleground players.
New script function: setbgteam bgid, num It set for 'bgid' team id to 'num'.
Diffstat (limited to 'src/emap/battleground.c')
-rw-r--r--src/emap/battleground.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/emap/battleground.c b/src/emap/battleground.c
new file mode 100644
index 0000000..9b028a5
--- /dev/null
+++ b/src/emap/battleground.c
@@ -0,0 +1,52 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#include "common/hercules.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common/db.h"
+#include "common/HPMi.h"
+#include "common/malloc.h"
+#include "common/mmo.h"
+#include "common/socket.h"
+#include "common/strlib.h"
+#include "common/timer.h"
+#include "map/battleground.h"
+#include "map/itemdb.h"
+#include "map/map.h"
+#include "map/pc.h"
+
+#include "emap/data/bgd.h"
+#include "emap/data/session.h"
+#include "emap/struct/bgdext.h"
+#include "emap/struct/sessionext.h"
+
+bool ebg_team_warp(int *bg_idPtr, unsigned short *map_index, short *x, short *y)
+{
+ int i;
+ int bg_id = *bg_idPtr;
+ struct battleground_data *bgd = bg->team_search(bg_id);
+ if (bgd == NULL)
+ return false;
+ struct BgdExt *bdata = bgd_get(bgd);
+ if (!bdata)
+ {
+ ShowWarning("bdata empty\n");
+ return true;
+ }
+ for (i = 0; i < MAX_BG_MEMBERS; i++)
+ {
+ TBL_PC *sd = bgd->members[i].sd;
+ if (sd != NULL)
+ {
+ struct SessionExt *sdata = session_get_bysd(sd);
+ if (sdata)
+ sdata->teamId = bdata->teamId;
+ pc->setpos(bgd->members[i].sd, *map_index, *x, *y, CLR_TELEPORT);
+ }
+ }
+ return true;
+}