Skip to content

Commit

Permalink
Allow NPC view data modifications (rathena#4385)
Browse files Browse the repository at this point in the history
* Fixes rathena#4289.
* Updated script commands setunitdata and getunitdata to support the modification of NPC view data.
* Converted mob_avail database to YAML.
Thanks to @Lemongrass3110, @4144, @exneval, @Balferian, @cahya1992 and @teededung!
Co-authored-by: Lemongrass3110 <[email protected]>
  • Loading branch information
aleos89 authored Dec 22, 2019
1 parent f2a1b6e commit b011963
Show file tree
Hide file tree
Showing 19 changed files with 970 additions and 159 deletions.
16 changes: 0 additions & 16 deletions db/import-tmpl/mob_avail.txt

This file was deleted.

123 changes: 123 additions & 0 deletions db/import-tmpl/mob_avail.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# This file is a part of rAthena.
# Copyright(C) 2019 rAthena Development Team
# https://rathena.org - https://github.com/rathena
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###########################################################################
# Mob Availability and Alias Database
###########################################################################
#
# Mob Availability and Alias Settings
#
###########################################################################
# - Mob Mob to adjust.
# Sprite Sprite which will be sent to the client instead of Mob.
# Sex Sex (if Sprite is a player). (Default: Female)
# HairStyle Hair Style ID (if Sprite is a player). (Default: 0)
# HairColor Hair Color ID (if Sprite is a player). (Default: 0)
# ClothColor Cloth Color ID (if Sprite is a player). (Default: 0)
# Weapon Item name of weapon (if Sprite is a player). (Default: 0)
# Shield Item name of shield (if Sprite is a player). (Default: 0)
# HeadTop Item name of headgear (if Sprite is a player). (Default: 0)
# HeadMid Item name of headgear (if Sprite is a player). (Default: 0)
# HeadLow Item name of headgear (if Sprite is a player). (Default: 0)
# PetEquip Item name of pet equipment (if Mob is a valid pet). (Default: 0)
# Options: Set an option for an object. (Optional)
# <Option>: bool
###########################################################################

Header:
Type: MOB_AVAIL_DB
Version: 1

#Body:
# Examples
# - Mob: PORING
# Sprite: BAPHOMET
# - Mob: E_OBEAUNE
# Sprite: PORING
# PetEquip: Backpack

# Easter Event Monsters
# - Mob: MOROCC_3
# Sprite: DOPPELGANGER
# - Mob: MOROCC_4
# Sprite: ECLIPSE

# rAthena Dev Team
# Valaris
# - Mob: BOW_GUARDIAN_
# Sprite: JOB_ASSASSIN_CROSS
# Sex: Male
# HairStyle: 1
# HairColor: 1
# ClothColor: 1
# Weapon: Jamadhar
# HeadTop: Sahkkat
# HeadMid: Sunglasses
# HeadLow: Cigar
# Options:
# Falcon: true
# Valaris Worshiper
# - Mob: E_CONDOR
# Sprite: JOB_THIEF
# Sex: Male
# HairStyle: 1
# HairColor: 1
# ClothColor: 1
# Weapon: Gladius
# Shield: Guard
# HeadTop: Sahkkat
# HeadMid: Sunglasses
# HeadLow: Cigar
# MC Cameri
# - Mob: E_TREASURE1
# Sprite: JOB_CRUSADER
# Sex: Male
# HairStyle: 6
# HairColor: 6
# ClothColor: 3
# Weapon: Sword
# Shield: Shield
# Options:
# Riding: true
# Poki#3
# - Mob: E_TREASURE2
# Sprite: JOB_SNIPER
# Sex: Male
# HairStyle: 21
# Weapon: Bow_Of_Rudra
# HeadTop: Boy's_Cap
# HeadMid: Takius_Blindfold
# HeadLow: Centimental_Leaf
# Options:
# Falcon: true
# Sentry
# - Mob: BOMBPORING
# Sprite: KNIGHT_GUARDIAN

# iRO Halloween Event 2009
# - Mob: EP14_MORS_BOSSB
# Sprite: ZOMBIE
# - Mob: EP14_MORS_MOB1
# Sprite: GHOUL
# - Mob: EP14_MORS_MOB2
# Sprite: ZOMBIE_MASTER

# iRO Halloween Event 2009
# - Mob: EP14_3_DEATH_B_MOB2
# Sprite: WHISPER
# - Mob: EP14_3_DEATH_B_MOB3
# Sprite: DARK_LORD
44 changes: 0 additions & 44 deletions db/mob_avail.txt

This file was deleted.

108 changes: 108 additions & 0 deletions doc/mob_avail.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
//===== rAthena Documentation ================================
//= rAthena Monster Availability Database Reference
//===== By: ==================================================
//= rAthena Dev Team
//===== Last Updated: ========================================
//= 20191213
//===== Description: =========================================
//= Explanation of the mob_avail.yml file and structure.
//============================================================

---------------------------------------

Mob: The AEGIS name of the monster.

---------------------------------------

Sprite: The name of the sprite the monster will be changed to.

This can be another mob, a player (prefixed with 'JOB_'), or an NPC. When using an NPC sprite,
the prefix is not required in the mob_avail database as the script engine will strip it.

Example:
- Mob: POPORING
Sprite: PORING # This will change the Poporing into a Poring.

- Mob: PORING
Sprite: JOB_STALKER # This will change the Poring into a Stalker.

- Mob: WOLF
Sprite: 4_M_BARBER # This will change the Wolf into the Barber NPC.

These constants can be found in src/map/script_constants.hpp.

---------------------------------------

Sex: The sex to be displayed if the Sprite is a player.

Valid types:
Female
Male

---------------------------------------

HairStyle: The hair style ID to be displayed if the Sprite is a player.

---------------------------------------

HairColor: The hair color ID to be displayed if the Sprite is a player.

---------------------------------------

ClothColor: The cloth color ID to be displayed if the Sprite is a player.

---------------------------------------

Weapon: The AEGIS name of the item to be displayed if the Sprite is a player.

---------------------------------------

Shield: The AEGIS name of the item to be displayed if the Sprite is a player.

---------------------------------------

HeadTop: The AEGIS name of the item to be displayed if the Sprite is a player.

---------------------------------------

HeadMid: The AEGIS name of the item to be displayed if the Sprite is a player.

---------------------------------------

HeadLow: The AEGIS name of the item to be displayed if the Sprite is a player.

---------------------------------------

PetEquip: The AEGIS name of the item to be displayed if the Mob is a valid pet.

---------------------------------------

Options: The view option to be applied to the Mob.

Valid types:
Sight
Cart1
Falcon
Riding
Cart2
Cart3
Cart4
Cart5
Orcish
Wedding
Ruwach
Flying
Xmas
Transform
Summer
Dragon1
Wug
WugRider
MadoGear
Dragon2
Dragon3
Dragon4
Dragon5
Hanbok
Oktoberfest
Summer2
20 changes: 18 additions & 2 deletions doc/script_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7979,6 +7979,8 @@ Parameters (indexes) for monsters are:
UMOB_ADELAY
UMOB_DMOTION
UMOB_TARGETID
UMOB_ROBE
UMOB_BODY2

-----

Expand Down Expand Up @@ -8152,7 +8154,6 @@ Parameter (indexes) for elementals are:
-----

Parameter (indexes) for NPCs are:
UNPC_DISPLAY
UNPC_LEVEL
UNPC_HP
UNPC_MAXHP
Expand Down Expand Up @@ -8185,6 +8186,19 @@ Parameter (indexes) for NPCs are:
UNPC_AMOTION
UNPC_ADELAY
UNPC_DMOTION
UNPC_SEX
UNPC_CLASS
UNPC_HAIRSTYLE
UNPC_HAIRCOLOR
UNPC_HEADBOTTOM
UNPC_HEADMIDDLE
UNPC_HEADTOP
UNPC_CLOTHCOLOR
UNPC_SHIELD
UNPC_WEAPON
UNPC_ROBE
UNPC_BODY2
UNPC_DEADSIT

*Notes:
- *_SIZE: small (0); medium (1); large (2)
Expand All @@ -8201,12 +8215,14 @@ Parameter (indexes) for NPCs are:
- *_AMOTION: see doc/mob_db.txt
- *_ADELAY: see doc/mob_db.txt
- *_DMOTION: see doc/mob_db.txt
- *_BODY2: enable (1) the alternate display, or disable (0)

- UMOB_AI: none (0); attack (1); marine sphere (2); flora (3); zanzou (4); legion (5); faw (6)
- UMOB_SCOPTION: see the 'Variables' section at the top of this document
- UMOB_SLAVECPYMSTRMD: make the slave copy the master's mode (1), or not (0)

- UNPC_PLUSALLSTAT: same as 'bAllStats'; increases/decreses all stats by given amount
- UNPC_PLUSALLSTAT: same as 'bAllStats'; increases/decreases all stats by given amount
- UNPC_DEADSIT: stand (0), dead (1), sit (2)

Example:
// Spawn some Porings and save the Game ID.
Expand Down
22 changes: 22 additions & 0 deletions doc/yaml/db/mob_avail.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
###########################################################################
# Mob Availability and Alias Database
###########################################################################
#
# Mob Availability and Alias Settings
#
###########################################################################
# - Mob Mob to adjust.
# Sprite Sprite which will be sent to the client instead of Mob.
# Sex Sex (if Sprite is a player). (Default: Female)
# HairStyle Hair Style ID (if Sprite is a player). (Default: 0)
# HairColor Hair Color ID (if Sprite is a player). (Default: 0)
# ClothColor Cloth Color ID (if Sprite is a player). (Default: 0)
# Weapon Item name of weapon (if Sprite is a player). (Default: 0)
# Shield Item name of shield (if Sprite is a player). (Default: 0)
# HeadTop Item name of headgear (if Sprite is a player). (Default: 0)
# HeadMid Item name of headgear (if Sprite is a player). (Default: 0)
# HeadLow Item name of headgear (if Sprite is a player). (Default: 0)
# PetEquip Item name of pet equipment (if Mob is a valid pet). (Default: 0)
# Options: Set an option for an object. (Optional)
# <Option>: bool
###########################################################################
Loading

0 comments on commit b011963

Please sign in to comment.