summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-11-14 14:21:47 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-11-14 14:21:47 +0000
commitc9d4051012392245ec08e1ee25395bd22555e638 (patch)
tree772d7b672d421ed0e07df450d7904d9174f2eb56
parentaf5a9674dc39e941466fe92502d77f1a6861d0c0 (diff)
downloadhercules-c9d4051012392245ec08e1ee25395bd22555e638.tar.gz
hercules-c9d4051012392245ec08e1ee25395bd22555e638.tar.bz2
hercules-c9d4051012392245ec08e1ee25395bd22555e638.tar.xz
hercules-c9d4051012392245ec08e1ee25395bd22555e638.zip
- Characters with Karma may fight amongst them anywhere.
- Added mapflags partylock and guildlock, which lock the state of the parties/guilds on said maps. partylock blocks user party requests to create/invite/leave/kick, while guildlock blocks user guild requests to create/invite/leave/expel/make alliance/make opposition/delete alliance/delete opposition/break git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9216 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt21
-rw-r--r--conf-tmpl/msg_athena.conf4
-rw-r--r--db/const.txt3
-rw-r--r--src/map/atcommand.c4
-rw-r--r--src/map/battle.c3
-rw-r--r--src/map/clif.c72
-rw-r--r--src/map/guild.c23
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/npc.c6
-rw-r--r--src/map/script.c19
10 files changed, 142 insertions, 15 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index ff7c9dcd0..eacb9df3b 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,27 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2006/11/14
+ * Early Christmas present. 3 new "features" which were very easy to code,
+ and should help scripters tremendously. Eapp is quite a way from being
+ ready, so these can't hurt:
+ * Implemented Karma: It turns out that when someone has karma, the client
+ believes this character is "evil", and will give you a cursor sword on top
+ of them automatically. So now the code will let characters with karma to
+ fight each other. This enables duels and other types of restricted pvp
+ where only the characters with karma can hit each others, and the rest of
+ players with neutral karma cannot be affected. Note that Karma cannot be
+ negative, and it can have any value between 0 and 256 (any non-zero value
+ makes them appear evil on the client). For now, characters with karma can
+ hit each other regardless of karma value, but perhaps it may be better to
+ let them to hit each other ONLY if they have the same karma (the whole
+ duel implementation COULD be cleaned up using Karma instead!)
+ * Added mapflags partylock and guildlock, which lock the state of the
+ parties/guilds on said maps:
+ partylock: blocks user party requests to create/invite/leave/kick
+ guildlock: blocks user guild requests to create/invite/leave/expel/
+ make alliance/make opposition/delete alliance/delete opposition/
+ break guild
2006/11/13
* Fixed a bug where the char-txt server was incorrectly saving memos,
causing character data to be lost on restart. [Skotlex]
diff --git a/conf-tmpl/msg_athena.conf b/conf-tmpl/msg_athena.conf
index e168c057b..c0defb3eb 100644
--- a/conf-tmpl/msg_athena.conf
+++ b/conf-tmpl/msg_athena.conf
@@ -240,8 +240,8 @@
224: %s %d minutes
225: %s and %d second
226: %s and %d seconds
-227: Cannot wear disguise while riding a Peco.
-228: Character cannot wear disguise while riding a Peco.
+227: Party modification is disabled on this map.
+228: Guild modification is disabled on this map.
229: Your Effect Has Changed.
230: Server time (normal time): %A, %B %d %Y %X.
231: Game time: The game is in permanent daylight.
diff --git a/db/const.txt b/db/const.txt
index 3bbc658bb..233170ec9 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -188,7 +188,7 @@ mf_gvg_noparty 10
mf_notrade 11
mf_noskill 12
mf_nowarp 13
-mf_nopvp 14
+mf_partylock 14
mf_noicewall 15
mf_snow 16
mf_fog 17
@@ -219,6 +219,7 @@ mf_novending 41
mf_loadevent 42
mf_nochat 43
mf_noexppenalty 44
+mf_guildlock 45
cell_wall 1
cell_water 3
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 1f31c6303..3f0a3c475 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5652,6 +5652,10 @@ int atcommand_mapinfo(
strcat(atcmd_output, "NoMobLoot | ");
if (map[m_id].flag.nomvploot)
strcat(atcmd_output, "NoMVPLoot | ");
+ if (map[m_id].flag.partylock)
+ strcat(atcmd_output, "PartyLock | ");
+ if (map[m_id].flag.guildlock)
+ strcat(atcmd_output, "GuildLock | ");
clif_displaymessage(fd, atcmd_output);
diff --git a/src/map/battle.c b/src/map/battle.c
index 0a7dee67c..ffc39c595 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3230,6 +3230,9 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
case BL_PC:
{
TBL_PC *sd = (TBL_PC*)t_bl;
+ if (sd->status.karma && t_bl != s_bl && s_bl->type == BL_PC &&
+ ((TBL_PC*)s_bl)->status.karma)
+ state |= BCT_ENEMY; //Characters with bad karma may fight amongst them.
if (sd->state.monster_ignore && t_bl != s_bl && flag&BCT_ENEMY)
return 0; //Global inmunity to attacks.
if (sd->state.killable && t_bl != s_bl)
diff --git a/src/map/clif.c b/src/map/clif.c
index 01032a535..bc3f1e2e7 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -10308,6 +10308,11 @@ void clif_parse_CloseKafra(int fd, struct map_session_data *sd) {
*/
void clif_parse_CreateParty(int fd, struct map_session_data *sd) {
RFIFOHEAD(fd);
+ if(map[sd->bl.m].flag.partylock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(227));
+ return;
+ }
if (battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 7) {
party_create(sd,(char*)RFIFOP(fd,2),0,0);
} else
@@ -10319,6 +10324,11 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd) {
*------------------------------------------
*/
void clif_parse_CreateParty2(int fd, struct map_session_data *sd) {
+ if(map[sd->bl.m].flag.partylock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(227));
+ return;
+ }
if (battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 7){
RFIFOHEAD(fd);
party_create(sd,(char*)RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27));
@@ -10335,6 +10345,12 @@ void clif_parse_PartyInvite(int fd, struct map_session_data *sd) {
struct map_session_data *t_sd;
RFIFOHEAD(fd);
+ if(map[sd->bl.m].flag.partylock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(227));
+ return;
+ }
+
t_sd = map_id2sd(RFIFOL(sd->fd,2));
// @noask [LuzZza]
@@ -10365,6 +10381,11 @@ void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) {
*------------------------------------------
*/
void clif_parse_LeaveParty(int fd, struct map_session_data *sd) {
+ if(map[sd->bl.m].flag.partylock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(227));
+ return;
+ }
party_leave(sd);
}
@@ -10374,6 +10395,11 @@ void clif_parse_LeaveParty(int fd, struct map_session_data *sd) {
*/
void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) {
RFIFOHEAD(fd);
+ if(map[sd->bl.m].flag.partylock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(227));
+ return;
+ }
party_removemember(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6));
}
@@ -10471,6 +10497,11 @@ void clif_parse_OpenVending(int fd,struct map_session_data *sd) {
*/
void clif_parse_CreateGuild(int fd,struct map_session_data *sd) {
RFIFOHEAD(fd);
+ if(map[sd->bl.m].flag.guildlock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(228));
+ return;
+ }
guild_create(sd, (char*)RFIFOP(fd,6));
}
@@ -10580,6 +10611,13 @@ void clif_parse_GuildInvite(int fd,struct map_session_data *sd) {
struct map_session_data *t_sd;
RFIFOHEAD(fd);
+
+ if(map[sd->bl.m].flag.guildlock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(228));
+ return;
+ }
+
t_sd = map_id2sd(RFIFOL(sd->fd,2));
// @noask [LuzZza]
@@ -10606,6 +10644,11 @@ void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) {
*/
void clif_parse_GuildLeave(int fd,struct map_session_data *sd) {
RFIFOHEAD(fd);
+ if(map[sd->bl.m].flag.guildlock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(228));
+ return;
+ }
guild_leave(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),(char*)RFIFOP(fd,14));
}
@@ -10615,6 +10658,11 @@ void clif_parse_GuildLeave(int fd,struct map_session_data *sd) {
*/
void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) {
RFIFOHEAD(fd);
+ if(map[sd->bl.m].flag.guildlock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(228));
+ return;
+ }
guild_expulsion(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),(char*)RFIFOP(fd,14));
}
@@ -10654,6 +10702,13 @@ void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) {
struct map_session_data *t_sd;
RFIFOHEAD(fd);
+
+ if(map[sd->bl.m].flag.guildlock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(228));
+ return;
+ }
+
t_sd = map_id2sd(RFIFOL(sd->fd,2));
// @noask [LuzZza]
@@ -10680,6 +10735,11 @@ void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) {
*/
void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) {
RFIFOHEAD(fd);
+ if(map[sd->bl.m].flag.guildlock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(228));
+ return;
+ }
guild_delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6));
}
@@ -10692,6 +10752,13 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) {
struct map_session_data *t_sd;
RFIFOHEAD(fd);
+
+ if(map[sd->bl.m].flag.guildlock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(228));
+ return;
+ }
+
t_sd = map_id2sd(RFIFOL(sd->fd,2));
// @noask [LuzZza]
@@ -10709,6 +10776,11 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) {
*/
void clif_parse_GuildBreak(int fd, struct map_session_data *sd) {
RFIFOHEAD(fd);
+ if(map[sd->bl.m].flag.guildlock)
+ { //Guild locked.
+ clif_displaymessage(fd, msg_txt(228));
+ return;
+ }
guild_break(sd,(char*)RFIFOP(fd,2));
}
diff --git a/src/map/guild.c b/src/map/guild.c
index 428951a22..609e84700 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -427,17 +427,19 @@ int guild_create(struct map_session_data *sd,char *name)
{
nullpo_retr(0, sd);
- if(sd->status.guild_id==0){
- if(!battle_config.guild_emperium_check || pc_search_inventory(sd,714) >= 0) {
- struct guild_member m;
- guild_makemember(&m,sd);
- m.position=0;
- intif_guild_create(name,&m);
- } else
- clif_guild_created(sd,3); // エンペリウムがいない
- }else
+ if(sd->status.guild_id)
+ {
clif_guild_created(sd,1); // すでに所属している
-
+ return 0;
+ }
+ if(!battle_config.guild_emperium_check || pc_search_inventory(sd,714) >= 0) {
+ struct guild_member m;
+ guild_makemember(&m,sd);
+ m.position=0;
+ intif_guild_create(name,&m);
+ return 1;
+ }
+ clif_guild_created(sd,3); // エンペリウムがいない
return 0;
}
@@ -635,6 +637,7 @@ int guild_invite(struct map_session_data *sd,struct map_session_data *tsd)
if(tsd==NULL || g==NULL)
return 0;
+
if(!battle_config.invite_request_check) {
if (tsd->party_invite>0 || tsd->trade_partner) { // 相手が取引中かどうか
clif_guild_inviteack(sd,0);
diff --git a/src/map/map.h b/src/map/map.h
index b9a21036f..882a91882 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1118,6 +1118,8 @@ struct map_data {
unsigned novending : 1;
unsigned loadevent : 1;
unsigned nochat :1;
+ unsigned partylock :1;
+ unsigned guildlock :1;
} flag;
struct point save;
struct npc_data *npc[MAX_NPC_PER_MAP];
diff --git a/src/map/npc.c b/src/map/npc.c
index 075cc2fe1..44b73d8f5 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2567,6 +2567,12 @@ static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4)
else if (strcmpi(w3,"nochat")==0) { // Skotlex
map[m].flag.nochat=state;
}
+ else if (strcmpi(w3,"partylock")==0) { // Skotlex
+ map[m].flag.partylock=state;
+ }
+ else if (strcmpi(w3,"guildlock")==0) { // Skotlex
+ map[m].flag.guildlock=state;
+ }
return 0;
}
diff --git a/src/map/script.c b/src/map/script.c
index a995b12bb..551e286f1 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -176,7 +176,7 @@ enum {
MF_NOTRADE,
MF_NOSKILL,
MF_NOWARP,
- MF_FREE,
+ MF_PARTYLOCK,
MF_NOICEWALL,
MF_SNOW,
MF_FOG,
@@ -206,7 +206,8 @@ enum {
MF_NOVENDING,
MF_LOADEVENT,
MF_NOCHAT,
- MF_NOEXPPENALTY
+ MF_NOEXPPENALTY,
+ MF_GUILDLOCK
};
//Reports on the console the src of an script error.
@@ -8378,6 +8379,13 @@ int buildin_setmapflag(struct script_state *st)
break;
case MF_NOCHAT:
map[m].flag.nochat=1;
+ break;
+ case MF_PARTYLOCK:
+ map[m].flag.partylock=1;
+ break;
+ case MF_GUILDLOCK:
+ map[m].flag.guildlock=1;
+ break;
}
}
@@ -8523,6 +8531,13 @@ int buildin_removemapflag(struct script_state *st)
break;
case MF_NOCHAT:
map[m].flag.nochat=0;
+ break;
+ case MF_PARTYLOCK:
+ map[m].flag.partylock=0;
+ break;
+ case MF_GUILDLOCK:
+ map[m].flag.guildlock=0;
+ break;
}
}