POT
POT
POT
Main menu

Download

Forum

SVN

Prev Next

Global resources

How to make your resources to be loaded everywhere.

Table of Contents

Globalisation

POT creates some kind of enviroment within which all OTServ world information is loaded. You can create your loacal instances of some resources but they are completly independent. To make something accessible globaly you need to load it within global POT scope.

Sometimes it is required to create such instances before executing some operations like for example to read player's vocation name, or hes/her items information.

POT class contains methods to load all kind of resources globaly:

  • loadVocations() - to load vocations names mapping.
  • loadMonsters() - to load monsters list.
  • loadItems() - to load items list.
  • loadSpells() - to load spells list.
  • loadMap() - to load OTBM map (as spawns list mainly).
  • loadHouses() - to load houses list. If you load map global resource and it has assigned external house information file, houses list will be automaticly loaded.

You can see some examples of global resources loading in tutorial about creating complete framework enviroment.

Retriving resources

While resources are loaded you can get them everywhere in the code by calling to POT global instance. To get resource handle you can use one of following methods:

Checking state

If you are not sure about working enviroment, to make sure that resource which you need is loaded you should use one of following methods before getting it:

Attempt to get not-loaded resource will cause E_OTS_NotLoaded exception to be thrown.


Prev Up Next
data/ directory resources data/ directory resources Cache drivers