Skip to content

Commit

Permalink
Merge pull request #2188 from bWolfie/cell_noskill
Browse files Browse the repository at this point in the history
Adds 'cell_noskill' which blocks skill usage.
  • Loading branch information
MishimaHaruna authored May 4, 2020
2 parents 43b9a69 + cd593de commit a126526
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
26 changes: 16 additions & 10 deletions db/constants.conf
Original file line number Diff line number Diff line change
Expand Up @@ -428,30 +428,36 @@ constants_db: {
mf_nogstorage: 60

comment__: "Cell Properties"
cell_walkable: 0
cell_shootable: 1
cell_water: 2
cell_npc: 3
cell_basilica: 4
cell_landprotector: 5
cell_novending: 6
cell_nochat: 7
cell_walkable: 0
cell_shootable: 1
cell_water: 2
cell_npc: 3
cell_basilica: 4
cell_landprotector: 5
cell_novending: 6
cell_nochat: 7
cell_icewall: 8
cell_noicewall: 9
cell_noskill: 10

comment__: "Cell checks"
//cell_gettype: 0
cell_gettype: 0
cell_chkwall: 1
cell_chkwater: 2
cell_chkcliff: 3
cell_chkpass: 4
cell_chkreach: 5
cell_chknopass: 6
cell_chknoreach: 7
//cell_chkstack: 8
cell_chkstack: 8
cell_chknpc: 9
cell_chkbasilica: 10
cell_chklandprotector: 11
cell_chknovending: 12
cell_chknochat: 13
cell_chkicewall: 14
cell_chknoicewall: 15
cell_chknoskill: 16

comment__: "Bonuses / Parameter IDs"
bMaxHP: 6
Expand Down
6 changes: 6 additions & 0 deletions doc/constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@
- `cell_landprotector`: 5
- `cell_novending`: 6
- `cell_nochat`: 7
- `cell_icewall`: 8
- `cell_noicewall`: 9
- `cell_noskill`: 10

### Cell checks

Expand All @@ -390,6 +393,9 @@
- `cell_chklandprotector`: 11
- `cell_chknovending`: 12
- `cell_chknochat`: 13
- `cell_chkicewall`: 14
- `cell_chknoicewall`: 15
- `cell_chknoskill`: 16

### Bonuses / Parameter IDs

Expand Down
3 changes: 3 additions & 0 deletions src/map/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -3077,6 +3077,8 @@ static int map_getcellp(struct map_data *m, const struct block_list *bl, int16 x
return (cell.icewall);
case CELL_CHKNOICEWALL:
return (cell.noicewall);
case CELL_CHKNOSKILL:
return (cell.noskill);

// special checks
case CELL_CHKPASS:
Expand Down Expand Up @@ -3141,6 +3143,7 @@ static void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag)
case CELL_NOCHAT: map->list[m].cell[j].nochat = flag; break;
case CELL_ICEWALL: map->list[m].cell[j].icewall = flag; break;
case CELL_NOICEWALL: map->list[m].cell[j].noicewall = flag; break;
case CELL_NOSKILL: map->list[m].cell[j].noskill = flag; break;

default:
ShowWarning("map_setcell: invalid cell type '%d'\n", (int)cell);
Expand Down
5 changes: 4 additions & 1 deletion src/map/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ typedef enum {
CELL_NOCHAT,
CELL_ICEWALL,
CELL_NOICEWALL,
CELL_NOSKILL,

} cell_t;

Expand All @@ -612,6 +613,7 @@ typedef enum {
CELL_CHKNOCHAT,
CELL_CHKICEWALL,
CELL_CHKNOICEWALL,
CELL_CHKNOSKILL,

} cell_chk;

Expand All @@ -630,7 +632,8 @@ struct mapcell {
novending : 1,
nochat : 1,
icewall : 1,
noicewall : 1;
noicewall : 1,
noskill : 1;

#ifdef CELL_NOSTACK
int cell_bl; //Holds amount of bls in this cell.
Expand Down
3 changes: 3 additions & 0 deletions src/map/skill.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,9 @@ static int skillnotok(uint16 skill_id, struct map_session_data *sd)
if (pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL))
return 0; // can do any damn thing they want

if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOSKILL))
return 1; // block usage on 'noskill' cells [Wolfie]

if (skill_id == AL_TELEPORT && sd->autocast.type == AUTOCAST_ITEM && sd->autocast.skill_lv > 2)
return 0; // Teleport level 3 and higher bypasses this check if cast by itemskill() script commands.

Expand Down

0 comments on commit a126526

Please sign in to comment.