Which of the following cases would be more efficient? I'm pretty sure I know which, but I'd like some input from eithers.
Both cases are clientside.
The first case (a) is to create a class to hold groups of functions, then join it to NPCs that require functions that deal with certain objects.
i.e.
PHP Code:
// Class - mudfunctions
//#CLIENTSIDE
function GetItemPower(itemid) {
return (@"item-" @ itemid).power;
}
PHP Code:
// Some other weapon
//#CLIENTSIDE
function onCreated() {
join("mudfunctions");
echo(GetItemPower(3324));
}
The second case (b) is to create a weapon for each group of functions and refer a global variable to itself in the onCreated block.
i.e.
PHP Code:
// Weapon - MUD Library Functions
//#CLIENTSIDE
function onCreated() {
mud = this;
}
public function GetItemPower(itemid) {
return (@"item-" @ itemid).power;
}
PHP Code:
// Some other weapon
//#CLIENTSIDE
function onCreated() {
echo(mud.GetItemPower(3324));
}