OpenTibiaBR
GithubDiscordSponsor
  • Home
    • 📖Welcome!
    • 💵Donate
  • OpenTibiaBR
    • 🖥️Projects
      • 🐦Canary
        • About
        • Getting Started
          • Compiling
            • Linux
              • [Linux] Compiling Canary Sources
            • Windows
              • Visual Studio
                • [Windows][VC2022][CMake] Compiling Canary Sources
                • [Windows][VC2022][Solution] Compiling Canary Sources
              • WSL
                • [WSL] Compiling Canary Sources
          • Installing
            • aaPanel
              • [Linux] Canary + aaPanel + MyAAC
            • Docker
              • [Docker] Canary + MariaDB + MyAAC
            • Linux
              • Nginx + MariaDB + MyAAC
            • Windows
              • Uniform Server
                • [Windows][Basic] Canary + Uniform Server + MyAAC
              • XAMPP
                • [Windows][Advanced] Canary + XAMPP + MyAAC
        • Tutorials
          • Basic
            • Auto Backup Server Database
            • Auto Restart and Linux Logs
            • Custom Bestiary / Prey with Canary Monster Editor
            • Event Schedule Canary / OTServBR-Global
            • How to make a custom server with Canary
            • How to reset players in your database
            • How to secure a Linux server
            • SSL Certificates
            • Webhook Discord
            • [Outdated] Custom Bestiary / Prey
            • [Linux] Backup + Upload - Google Drive
            • [Linux] How to install Linux headers
            • VPS Linux
            • [Windows] SSL/HTTPS Certificate with XAMPP
          • Mapping
            • [Windows] Remere's Map Editor - Opening Canary / OTServBR-Global Map
            • [Windows] Remere's Map Editor - Converting map server id to client id
          • Programming & Scripting
            • How to add a new vocation
            • Revscriptsys
            • Guide Lua Objects
            • How to get raceId for monsters
          • Websites
            • [Canary][OTServBR-Global][GesiorAAC][MyAAC] Set up Initial Character
          • Miscellaneous
            • Useful Tutorials
            • Video Tutorials
      • 🗺️Remere's Map Editor
        • About
        • Getting Started
          • Linux
            • [Linux] Compiling Remere's Map Editor Sources
          • Windows
            • WSL
              • [WSL] Compiling Remere's Map Editor Sources
            • Visual Studio
              • [Windows][VC2022][CMake] Compiling Remere's Map Editor Sources
              • [Windows][VC2022][Solution] Compiling Remere's Map Editor Sources
      • 🎮OTClient Redemption
        • About
        • Getting Started
          • Android
            • [Android] Compiling OTClient Redemption Sources
          • Linux
            • [Linux] Compiling OTClient Redemption Sources
          • Windows
            • WSL
              • [WSL] Compiling OTClient Redemption Sources
            • Visual Studio
              • [Windows][VC2022][CMake] Compiling OTClient Redemption Sources
              • [Windows][VC2022][Solution] Compiling OTClient Redemption Sources
          • Web
            • [Web] OTClient Redemption
        • Tutorials
          • Basic
            • Client Updater
    • 🔗Downloads
      • 🎮Clients
        • Client 11
        • Client 14
          • Tutorials
            • Client with HexEditorXVI32
            • Client with Notepad++
            • Client with config.ini
            • [Windows] How to change client background
        • OTClientV8
          • About
          • Getting Started
            • Android
              • [Android] Compiling OTClientV8 Sources
            • Linux
              • [Linux] Compiling OTClientV8 Sources
            • Windows
              • WSL
                • [WSL] Compiling OTClientV8 Sources
              • Visual Studio
                • [Windows][VC2022][CMake] Compiling OTClientV8 Sources
                • [Windows][VC2022][Solution] Compiling OTClientV8 Sources
          • Features
            • Health and Mana bar backgrounds
            • HTTP support
            • OTML Improvement
            • Simple cam recorder and player
            • Updater, encryption and compression
            • WebSockets
        • Minimap
      • 📑Codes
        • C++
        • Events
        • Functions
        • Libs
        • Modules
        • Others
      • 🖼️Images
        • PSDs
        • Others
      • 🗺️Maps
        • Custom
        • Global
      • 📑Revscripts
        • Actions
        • CreatureEvents
        • GlobalEvents
        • MoveEvents
        • NPCs
        • Spells
        • Systems
        • TalkActions
      • ⚔️Sprites
      • ⚙️Tools
        • Editors
        • Launchers
          • Canary Launcher
            • About
            • Getting Started
              • Windows
                • [Windows][VC2022][Solution] Compiling Canary Launcher Sources
          • Slender Launcher
            • About
            • Getting Started
              • Windows
                • [Windows][Go] Compiling Slender Launcher Sources
        • Login Server
          • About
          • Getting Started
        • Map Generators
      • 🌐Web Packages
        • Linux
        • Windows
      • 🌐Website Applications
        • Websites
          • CanaryAAC
            • About
            • Informations
              • Features
              • Functions
              • API
              • Routes
              • Middleware
            • CanaryAAC Bot
          • Gesior2012
            • About
          • GesiorAAC Global
            • About
          • MyAAC
            • About
          • MyAAC Global
            • About
          • SlenderAAC
            • About
          • ZnoteAAC
            • About
        • Applications
        • Layouts
        • APIs and SDKs
Powered by GitBook
On this page
  • 1 - src/creatures/creatures_definitions.hpp and search for:
  • 2 - data/libs/vocation.lua:
  • 3 - data/libs/functions/player.lua and search for:
  • 4 - data/XML/vocations.xml:
  • 5 - Credits:
  1. OpenTibiaBR
  2. Projects
  3. Canary
  4. Tutorials
  5. Programming & Scripting

How to add a new vocation

Tutorial explaining how to add a new vocation in Canary Server. After add the new vocation, the server need to be compiled to apply the changes.

1 - src/creatures/creatures_definitions.hpp and search for:

enum Vocation_t : uint16_t {
	VOCATION_NONE = 0,
	VOCATION_SORCERER = 1,
	VOCATION_DRUID = 2,
	VOCATION_PALADIN = 3,
	VOCATION_KNIGHT = 4,
	VOCATION_MASTER_SORCERER = 5,
	VOCATION_ELDER_DRUID = 6,
	VOCATION_ROYAL_PALADIN = 7,
	VOCATION_ELITE_KNIGHT = 8,
	VOCATION_LAST = VOCATION_ELITE_KNIGHT
};
  • Add your new vocation, in the example was used Warrior And Elite Warrior vocations;

  • Being the last vocation you add it to the VOCATION_LAST.

  • It will look like this:

enum Vocation_t : uint16_t {
    VOCATION_NONE = 0,
    VOCATION_SORCERER = 1,
    VOCATION_DRUID = 2,
    VOCATION_PALADIN = 3,
    VOCATION_KNIGHT = 4,
    VOCATION_MASTER_SORCERER = 5,
    VOCATION_ELDER_DRUID = 6,
    VOCATION_ROYAL_PALADIN = 7,
    VOCATION_ELITE_KNIGHT = 8,
    VOCATION_WARRIOR = 9,
    VOCATION_ELITE_WARRIOR = 10,
    VOCATION_LAST = VOCATION_ELITE_WARRIOR
};

2 - data/libs/vocation.lua:

  • Add your new vocation following the example below:

  • In ClientID is 0, it will show in the client Vocation: None (but it will be a Warrior or a Elite Warrior). This will appear only at the time of log in and showing the characters, once in the game it will show that the vocation is a Warrior or a Elite Warrior.

VOCATION = {
    ID = {
        NONE = 0,
        SORCERER = 1,
        DRUID = 2,
        PALADIN = 3,
        KNIGHT = 4,
        MASTER_SORCERER = 5,
        ELDER_DRUID = 6,
        ROYAL_PALADIN = 7,
        ELITE_KNIGHT = 8,
        WARRIOR = 9,
        ELITE_WARRIOR = 10
    },
    CLIENT_ID = {
        NONE = 0,
        KNIGHT = 1,
        PALADIN = 2,
        SORCERER = 3,
        DRUID = 4,
        ELITE_KNIGHT = 11,
        ROYAL_PALADIN = 12,
        MASTER_SORCERER = 13,
        ELDER_DRUID = 14,
        WARRIOR = 0,
        ELITE_WARRIOR = 0
    },
    BASE_ID = {
        NONE = 0,
        SORCERER = 1,
        DRUID = 2,
        PALADIN = 3,
        KNIGHT = 4,
        WARRIOR = 5
    }
}

3 - data/libs/functions/player.lua and search for:

function Player.isSorcerer(self)
	return table.contains({VOCATION.ID.SORCERER, VOCATION.ID.MASTER_SORCERER}, self:getVocation():getId())
end

function Player.isDruid(self)
	return table.contains({VOCATION.ID.DRUID, VOCATION.ID.ELDER_DRUID}, self:getVocation():getId())
end

function Player.isKnight(self)
	return table.contains({VOCATION.ID.KNIGHT, VOCATION.ID.ELITE_KNIGHT}, self:getVocation():getId())
end

function Player.isPaladin(self)
	return table.contains({VOCATION.ID.PALADIN, VOCATION.ID.ROYAL_PALADIN}, self:getVocation():getId())
end

function Player.isMage(self)
	return table.contains({VOCATION.ID.SORCERER, VOCATION.ID.MASTER_SORCERER, VOCATION.ID.DRUID, VOCATION.ID.ELDER_DRUID},
		self:getVocation():getId())
end
  • Below the vocations functions add the function for the new vocation:

function Player.isWarrior(self)
    return table.contains({VOCATION.ID.WARRIOR, VOCATION.ID.ELITE_WARRIOR}, self:getVocation():getId())
end

4 - data/XML/vocations.xml:

  • Add the new vocation like the example below:

<vocation id="9" clientid="0" baseid="5" name="Warrior" description="a warrior" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4000" gainhpamount="1" gainmanaticks="6000" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="110" soulmax="200" gainsoulticks="15000" fromvoc="5">
		<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
		<skill id="0" multiplier="1.1" />
		<skill id="1" multiplier="1.1" />
		<skill id="2" multiplier="1.1" />
		<skill id="3" multiplier="1.1" />
		<skill id="4" multiplier="1.4" />
		<skill id="5" multiplier="1.1" />
		<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="10" clientid="0" baseid="6" name="Elite Warrior" description="a elite warrior" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4000" gainhpamount="1" gainmanaticks="6000" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="110" soulmax="200" gainsoulticks="15000" fromvoc="5">
		<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
		<skill id="0" multiplier="1.1" />
		<skill id="1" multiplier="1.1" />
		<skill id="2" multiplier="1.1" />
		<skill id="3" multiplier="1.1" />
		<skill id="4" multiplier="1.4" />
		<skill id="5" multiplier="1.1" />
		<skill id="6" multiplier="1.1" />
</vocation>

5 - Credits:

  • Majesty

Last updated 2 months ago

🖥️
🐦