viewing paste diff pk_cell | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
 db/const.txt     | 1 +
 src/map/battle.c | 5 +++++
 src/map/map.c    | 3 +++
 src/map/map.h    | 5 ++++-
 4 files changed, 13 insertions(+), 1 deletion(-)
 
diff --git a/db/const.txt b/db/const.txt
index 778ed35..6417bae 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -391,6 +391,7 @@ cell_novending  6
 cell_nochat    7
 cell_maelstrom 8
 cell_icewall   9
+cell_pk    10
 
 //cell_gettype 0
 cell_chkwall   1
diff --git a/src/map/battle.c b/src/map/battle.c
index 76f7fc1..246d19c 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -6818,6 +6818,11 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
            if(s_guild && t_guild && (s_guild == t_guild || guild_isallied(s_guild, t_guild)))
                state |= BCT_GUILD;
        }
+       if ( s_bl->type == BL_PC && t_bl->type == BL_PC ) {
+           struct map_session_data *sd = BL_CAST( BL_PC, s_bl ), *tsd = BL_CAST( BL_PC, t_bl );
+           if ( map_getcell( sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKPK ) && map_getcell( tsd->bl.m, tsd->bl.x, tsd->bl.y, CELL_CHKPK ) )
+               state |= BCT_ENEMY;
+       }
     } //end non pvp/gvg chk rivality
 
    if( !state ) //If not an enemy, nor a guild, nor party, nor yourself, it's neutral.
diff --git a/src/map/map.c b/src/map/map.c
index 6bd8b2b..1586436 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2678,6 +2678,8 @@ int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk)
            return (cell.maelstrom);
        case CELL_CHKICEWALL:
            return (cell.icewall);
+       case CELL_CHKPK:
+           return (cell.pk);
 
        // special checks
        case CELL_CHKPASS:
@@ -2732,6 +2734,7 @@ void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag)
        case CELL_NOCHAT:        map[m].cell[j].nochat = flag;        break;
        case CELL_MAELSTROM:     map[m].cell[j].maelstrom = flag;     break;
        case CELL_ICEWALL:       map[m].cell[j].icewall = flag;       break;
+       case CELL_PK:            map[m].cell[j].pk = flag;            break;
        default:
            ShowWarning("map_setcell: invalid cell type '%d'\n", (int)cell);
            break;
diff --git a/src/map/map.h b/src/map/map.h
index 3e44813..f084213 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -460,6 +460,7 @@ typedef enum {
    CELL_NOCHAT,
    CELL_MAELSTROM,
    CELL_ICEWALL,
+   CELL_PK,
 
 } cell_t;
 
@@ -484,6 +485,7 @@ typedef enum {
    CELL_CHKNOCHAT,
    CELL_CHKMAELSTROM,
    CELL_CHKICEWALL,
+   CELL_CHKPK,
 
 } cell_chk;
 
@@ -503,7 +505,8 @@ struct mapcell
        novending : 1,
        nochat : 1,
        maelstrom : 1,
-       icewall : 1;
+       icewall : 1,
+       pk : 1;
 
 #ifdef CELL_NOSTACK
    unsigned char cell_bl; //Holds amount of bls in this cell.
 
Viewed 908 times, submitted by Mihael.