[ Index ]

PHP Cross Reference of miniNEAB Engine

title

Body

[close]

/ -> misc_util.php (summary)

Miscelanious functions used in the game.

Author: Alain Bertrand - (c) 2005-2006
File Size: 1280 lines (38 kb)
Included or required: 34 times
Referenced: 0 times
Includes or requires: 1 file
 config.inc

Defines 45 functions

  get_quest_variable()
  set_quest_variable()
  read_db_entry()
  check_skill()
  add_spell()
  is_wearing()
  remove_spell()
  add_skill()
  remove_skill()
  set_resurect()
  add_skill_level()
  skill_level()
  activity_performed()
  max_performed()
  action_performed()
  is_ignored()
  send_message()
  arena_gain()
  check_medal_rights()
  player_link()
  was_stolen()
  was_pickpocketed()
  thief_add()
  add_thief_bounty()
  add_pickpocket_bounty()
  change_fullness()
  lock()
  unlock()
  add_chat_line()
  store_prefs()
  read_prefs()
  smilies()
  http_link()
  random_name()
  secure()
  check_cert()
  find_user()
  select_list()
  dbExec()
  delete_user()
  is_included()
  remove_tags()
  exit_loc()
  button()
  gen_button()

Functions
Functions that are not part of a class:

get_quest_variable($quest,$var,$default="")   X-Ref
Retreives a quest variable

param: integer $quest
param: integer $var
param: string $default
return: string

set_quest_variable($quest,$var,$value)   X-Ref
Stores a quest variable

param: integer $quest
param: integer $var
param: string $value

read_db_entry($db,$sql)   X-Ref
Reads one DB record and return it as an array with the columns names as keys

param: database_object $db
param: string $sql
return: array

check_skill($skillid)   X-Ref
Check if the player have this skill and return true if yes and false otherwise.

param: integer $skillid
return: boolean

add_spell($spellid)   X-Ref
Add the specified spell to the player spellbook.

param: integer $spellid

is_wearing($objid)   X-Ref
Return true if the player is wearing the objid specified

param: integer $objid
return: boolean

remove_spell($spellid)   X-Ref
Remove the specified spell from the player spellbook

param: integer $spellid

add_skill($skillid)   X-Ref
Give the specified skill to the player

param: integer $skillid

remove_skill($skillid)   X-Ref
Remove the specified skill

param: integer $skillid

set_resurect($locid)   X-Ref
Define the resurection location
(in case of death or game bug),
by default it's 12 (Castle Soupir)

param: integer $locid

add_skill_level($skillid,$gain)   X-Ref
Increament the skill level (at 10000 it will be maxed)
the value is then divided by 100 to show a %

param: integer $skillid
param: integer $gain

skill_level($skillid)   X-Ref
Retreive the skill level.
Needs to be divided by 100 to find a %

param: integer $skillid
return: integer

activity_performed($acttype)   X-Ref
Increment a counter for the realtime statistics.
Check the table ACTIVITIES to see the possible $acttype.

param: integer $acttype

max_performed($acttype,$nb)   X-Ref
Update the max of a counter for the realtime statistics.
Check the table ACTIVITIES to see the possible $acttype.

param: integer $acttype

action_performed($act,$nb=1)   X-Ref
Increment the number of time where a player did some action.
Check the table ACTION_TYPES to see the valid act.

param: integer $act
param: integer $nb

is_ignored($uid)   X-Ref
Check if a player ignores the current player.

param: integer $uid (destination player)
return: boolean (true if the current player is ignored, false if not)

send_message($uid,$subject,$msg,$msgcopy = false,$anonymous = false,$gold=0,$rent=0)   X-Ref
Send a message (post office) to a given player.

param: integer $uid (destination player)
param: string $subject (subject of the message)
param: string $msg (message to send)
param: boolean $msgcopy (true = make a copy in the sent box of the current player)
param: boolean $anonymous (true = sent by the system, false = sent by the current player)
param: integer $gold (gold attacked or requested if negative)
param: integer $rent (rent asked)
return: integer (the message ID sent or 0 if there is an error)

arena_gain($uid,$points)   X-Ref
Add some arena points to the specified player

param: integer $uid (player to modify)
param: integer $points (number of points to add or remove)
return: integer (new value)

check_medal_rights($medal)   X-Ref
Checks if the player has the right to buy one medal.
Verify the table MEDALS to see which medal exists.

param: integer $medal
return: boolean

player_link($id,$name,$channel="")   X-Ref
Create a HTML link which pop up the player info page.

param: integer $id (the player to show)
param: string $name (name of the player to show as link text)
param: string $channel (name of the channel which invoqued this function (used for commands in the player info page))
return: string (the HTML produced)

was_stolen()   X-Ref
Checks if some gold has been taken from this player.

return: boolean

was_pickpocketed()   X-Ref
Checks if the player has been pickpocked.

return: boolean

thief_add($userid,$from,$gold)   X-Ref
The player robed some gold from $from. Store this info.

param: integer $userid (who robbed)
param: integer $from (from who the gold as been robed)
param: intger $gold

add_thief_bounty()   X-Ref
Calculate the bounty of the player.

return: integer (the ammount of gold the player has bounty)

add_pickpocket_bounty()   X-Ref
Update the bounty calculating the pickpocket acts the player did.

return: integer (the ammount of gold the player has bounty)

change_fullness($food)   X-Ref
Change the current fullness of the player.

param: integer $food (add or remove some fullness)

lock($file)   X-Ref
Create a lock file

param: string $file (file to lock)

unlock($file)   X-Ref
Remove a lock file

param: string $file (file to unlock)

add_chat_line($loc,$line,$to="*")   X-Ref
Add a line into the chat.

param: string $loc (channel or location)
param: string $line (text to display in the chat)
param: string $to (destination. "*" is for all, or specify the username of the person which may see this)

store_prefs($pos,$val)   X-Ref
Store some preferences into a cookie

param: integer $pos
param: string $val

read_prefs($pos)   X-Ref
Read the preference stored in the cookie

param: integer $pos
return: string

smilies($msg)   X-Ref
Replace the ":-)" sting with corrisponding smily image.

param: string $msg
return: strimg

http_link($msg)   X-Ref
Search the http:// string and create the link tag

param: string $msg
return: string

random_name()   X-Ref
Generate a random name

return: string

secure($buffer,$force=false)   X-Ref
Search all "game.php" strings and add the CRC

param: string $buffer
param: boolean $force (if true add the CRC even if it's not after a " or a =)
return: string

check_cert()   X-Ref
Check if the CRC is correct

return: boolean

find_user($user)   X-Ref
Search the id of a user (searching by username, email, or id)

param: string $user
return: integer

select_list($list,$val)   X-Ref
Output the list of "<OPTION>" and select the one where the key is equal to $val.
The list key is used as value, and the value as text shown.

param: array $list
param: string $val (default selected value)

dbExec($sql,$debug = false)   X-Ref
Execute a database function.

param: string $sql
param: boolean $debug (if true shows the SQL executed)

delete_user($uid,$debug = false)   X-Ref
Delete the specified user and all the linked tables.

param: integer $uid (user to delete)
param: boolean $debug (if true shows all the SQL statements)

is_included($str)   X-Ref
Checks if a specific php code is currently included (loaded)

param: string $str
return: boolean

remove_tags($str)   X-Ref
Removes the tags from the string.

param: string $str
return: string

exit_loc()   X-Ref
Find the location which have a link the the current one

return: integer

button($label,$link,$javascript="")   X-Ref
Generate the HTML needed to show a "button"

param: string $label
param: string $link
param: string $javascript

gen_button($label)   X-Ref
This function do not currently produce anything,
but is keept in order to keep compatibility with the main NEAB code.

param: unknown_type $label



Generated: Sun Mar 11 17:28:20 2007 Cross-referenced by PHPXref 0.7