Initial commit
17
lotgd-web/Dockerfile
Executable file
@ -0,0 +1,17 @@
|
||||
#This image is the NGINX webserver that holds the LotGD PHP files and connects to the DB and PHP containers
|
||||
FROM nginx:alpine
|
||||
|
||||
MAINTAINER Chris P
|
||||
|
||||
#Copies the game's PHP files to the container
|
||||
COPY lotgd /var/www/lotgd
|
||||
|
||||
#Removes the default NGINX config (otherwise localhost won't work)
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
|
||||
#Copies in the pre-configured lotgd config
|
||||
COPY lotgd.conf /etc/nginx/conf.d/lotgd.conf
|
||||
|
||||
#Port 443 is exposed in case one wants to use SSL, but there is no cert, reverse proxy is advised
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
73
lotgd-web/lotgd.conf
Executable file
@ -0,0 +1,73 @@
|
||||
##
|
||||
# You should look at the following URL's in order to grasp a solid understanding
|
||||
# of Nginx configuration files in order to fully unleash the power of Nginx.
|
||||
# https://www.nginx.com/resources/wiki/start/
|
||||
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
|
||||
# https://wiki.debian.org/Nginx/DirectoryStructure
|
||||
#
|
||||
# In most cases, administrators will remove this file from sites-enabled/ and
|
||||
# leave it as reference inside of sites-available where it will continue to be
|
||||
# updated by the nginx packaging team.
|
||||
#
|
||||
# This file will automatically load configuration files provided by other
|
||||
# applications, such as Drupal or Wordpress. These applications will be made
|
||||
# available underneath a path with that package name, such as /drupal8.
|
||||
#
|
||||
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
|
||||
##
|
||||
|
||||
# Default server configuration
|
||||
#
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
root /var/www/lotgd;
|
||||
|
||||
# Add index.php to the list if you are using PHP
|
||||
index index.html index.php index.htm index.nginx-debian.html;
|
||||
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
# First attempt to serve request as file, then
|
||||
# as directory, then fall back to displaying a 404.
|
||||
try_files $uri $uri/ =404;
|
||||
aio threads;
|
||||
}
|
||||
|
||||
# pass PHP scripts to FastCGI server
|
||||
#
|
||||
location ~ \.php$ {
|
||||
include fastcgi.conf;
|
||||
fastcgi_pass lotgd-php:9000;
|
||||
fastcgi_index index.php;
|
||||
}
|
||||
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
#location ~ /\.ht {
|
||||
# deny all;
|
||||
#}
|
||||
}
|
||||
|
||||
|
||||
# Virtual Host configuration for example.com
|
||||
#
|
||||
# You can move that to a different file under sites-available/ and symlink that
|
||||
# to sites-enabled/ to enable it.
|
||||
#
|
||||
#server {
|
||||
# listen 80;
|
||||
# listen [::]:80;
|
||||
#
|
||||
# server_name example.com;
|
||||
#
|
||||
# root /var/www/example.com;
|
||||
# index index.html;
|
||||
#
|
||||
# location / {
|
||||
# try_files $uri $uri/ =404;
|
||||
# }
|
||||
#}
|
7
lotgd-web/lotgd/.bash_logout
Executable file
@ -0,0 +1,7 @@
|
||||
# ~/.bash_logout: executed by bash(1) when login shell exits.
|
||||
|
||||
# when leaving the console clear the screen to increase privacy
|
||||
|
||||
if [ "$SHLVL" = 1 ]; then
|
||||
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
|
||||
fi
|
117
lotgd-web/lotgd/.bashrc
Executable file
@ -0,0 +1,117 @@
|
||||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
#force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# some more ls aliases
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
# Add an "alert" alias for long running commands. Use like so:
|
||||
# sleep 10; alert
|
||||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
0
lotgd-web/lotgd/.cache/motd.legal-displayed
Executable file
27
lotgd-web/lotgd/.profile
Executable file
@ -0,0 +1,27 @@
|
||||
# ~/.profile: executed by the command interpreter for login shells.
|
||||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
||||
# exists.
|
||||
# see /usr/share/doc/bash/examples/startup-files for examples.
|
||||
# the files are located in the bash-doc package.
|
||||
|
||||
# the default umask is set in /etc/profile; for setting the umask
|
||||
# for ssh logins, install and configure the libpam-umask package.
|
||||
#umask 022
|
||||
|
||||
# if running bash
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
# include .bashrc if it exists
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/bin" ] ; then
|
||||
PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/.local/bin" ] ; then
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
18
lotgd-web/lotgd/AFTERUPGRADE.txt
Executable file
@ -0,0 +1,18 @@
|
||||
Things you have to do after an upgrade:
|
||||
|
||||
|
||||
All:
|
||||
-check your races...remove the hook to "charstats" if they only add in the race under Vital Info. Now the core does this for you, including the translation.
|
||||
-all with datacache turned on: as the caching has been shifted to the dbconnect.php file... you need to edit this file and place in:
|
||||
|
||||
$DB_USEDATACACHE = 1;
|
||||
$DB_DATACACHEPATH = "/your/caching/dir";
|
||||
|
||||
where you put in your directory/path to the cache directory WITHOUT ending /
|
||||
|
||||
|
||||
|
||||
Translators:
|
||||
-Replace the Ramius/Karissa/Cedrik names with %s using the Translation Wizard... or translate the sentences anew.
|
||||
-Check if your language was de-it-fr-en-es-dk ... if not, then you need to add your language to the game settings as server supported language and also add all languages you WANT and drop those you DON'T WANT
|
||||
|
38
lotgd-web/lotgd/BUG FIXES.txt
Executable file
@ -0,0 +1,38 @@
|
||||
• common.php
|
||||
Removal of session_register(), replaced with session_start().
|
||||
• create.php
|
||||
Fixing of ability to use same name as another, with multiple spaces.
|
||||
• dragon.php
|
||||
Dragonkills incremented on page after kill, to prevent timing out to stay at level 15, but keeping the new dragonkill.
|
||||
• payment.php
|
||||
Trim the IPN validation response.
|
||||
• prefs.php
|
||||
Change from split() to explode().
|
||||
• rawsql.php
|
||||
Switched the debuglog() and db_query(), so that the db_error() function is connected to the latter, instead of the former.
|
||||
• lib/datetime.php
|
||||
checkday() does not redirect to the new day page if there are posted variables (e.g. commentary, prefs, etc.) to prevent loss of entered text.
|
||||
• lib/errorhandling.php
|
||||
set_magic_quotes_runtime() removed.
|
||||
• lib/events.php
|
||||
Change from split() to explode().
|
||||
• lib/forms.php
|
||||
Crash-safe event added to keep value of chat input in case the browser or tab crashes.
|
||||
• lib/installer/installer_stage_1.php
|
||||
Removal of <base> tags, so that the installation is smooth-running, and doesn't link to the commons lincense website.
|
||||
• lib/modules.php
|
||||
"showFormTabIndex" not saved as a module setting, object pref or user pref.
|
||||
• lib/pageparts.php
|
||||
Change from split() to explode().
|
||||
• lib/pullurl.php
|
||||
Change from split() to explode().
|
||||
"if (function_exists("curl_init")) return _curl($url);" removed.
|
||||
"curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);" removed.
|
||||
• lib/settings.php
|
||||
"showFormTabIndex" not saved as a game setting.
|
||||
• lib/showform.php
|
||||
Change from split() to explode().
|
||||
• lib/su_access.php
|
||||
Fixed usage of $_SERVER['HTTP_REFERER'] variable.
|
||||
• lib/tabldescriptor.php
|
||||
Replace ") Type=$type"; with ") engine=$type";
|
170
lotgd-web/lotgd/CHANGELOG.txt
Executable file
@ -0,0 +1,170 @@
|
||||
Changelog
|
||||
Changes from 1.1.1 to 1.1.2
|
||||
[FIX] - Moved gardener away from foot-gardens hook so it doesn't appear in events
|
||||
[FIX] - Minor colouring errors and typos
|
||||
[FIX] - You have been healed for 1 points! changed and translatable
|
||||
[FIX] - newest player cache for homepage now invalidates on account creation
|
||||
[FIX] - regdate preserved on dk
|
||||
|
||||
[UPDATE] - Raw SQL/PHP usage now added to debuglog
|
||||
[UPDATE] - Bans cleaned up on newday-runonce
|
||||
|
||||
Changes from 1.1.0 to 1.1.1
|
||||
[FIX] - configuration.php--lib/pageparts.php made the text "Legend of the Green Dragon Site Donation from" in the donationscreen settable in the grotto.
|
||||
[FIX] - configuration.php--lib/pageparts.php made a setting for the primarily country in order to select the correct paypal language when the button 'site admin' is clicked. Normally this would be the paypal account owners country. But in some cases this might differ.
|
||||
[FIX] - lib/pageparts.php page_header fixed (had infinite loop when calling page_header twice and the base call was not from a module)
|
||||
[FIX] - motd.php now does not only refresh the last X (setting) motd news by pressing the ">" button but browses through the last messages like it was supposed to. Alteration: motd is ONLY cached for the last X items, if you browse they are queried normally. Also the archive IS now cached (was not before) and this really makes sense normally.
|
||||
[FIX] - lib/battle-buffs.php did show an extra line if regen message was left out
|
||||
[FIX] - lib/modules.php in the module manager it showed greyed navs after inactive modules, added a `0
|
||||
[FIX] - /lib/partner.php set marriedto=0 when called for a player with spouse but w/o the $player variable
|
||||
[FIX] - home.php now displays correctly when cookies are blocked from the browser
|
||||
[FIX] - /modules/cities.php fixed a tl-glitch together with lib/forestoutcomes.php
|
||||
[FIX] - clans now fully functional for custom ranks
|
||||
[FIX] - /modules/abigail.php now speaks English with the spouse and is translation ready
|
||||
[FIX] - /modules/lovers.php module buff now translatable
|
||||
[FIX] - Now several timeout-incorrect login etc message are translatable
|
||||
[FIX] - taunts.php: when you saved a new taunt, it did not save the taunt but only inserted a new empty row.
|
||||
[FIX] - installer.php did display the 1ast recommended module as not recommended, now it does (install did work)
|
||||
[FIX] - tl-readiness of the racecities -> urlencode was missing in the addnav in the do_hook -> case travel
|
||||
[FIX] - modules/gardener.php is now translation-ready (questions were not translatable)
|
||||
[FIX] - modules/petra.php on line 232 there was a variable missspelled
|
||||
[FIX] - hook queries slightly changed and also added an index at the module_hooks table to "location"
|
||||
[FIX] - user.php now also searches *again* for email address, IP, ID etc... formerly did only search for name + loginname
|
||||
[FIX] - goodwordlist was not cached which caused the lotgdnet.php to make too many queries
|
||||
[FIX] - /modules/outhouse.php had a `2 missing after the name which caused colour errors
|
||||
[FIX] - corrected create.php who had two queries with emailvalidation='$id' AND emailvalidation!='' ... where the last part made no sense
|
||||
[FIX] - translatortool.php are the namespace+intext now readonly...they should *not* be editable, same goes for untranslated.php
|
||||
[FIX] - lib/datetime.php reltime($date,$short=true) is now tl-ready, you can have minutes/hours etc in your language. also the date outputs there are not in the tlschema "datetime"
|
||||
[FIX] - validation email now translation ready
|
||||
|
||||
[FIX] - Moved datacache settings into dbconnect.php. Otherwise settings-query could not be cached.
|
||||
[FIX] - pvp and bio now do not use the players' login as reference but their acctid (changes to pvp.php, bio.php, lib/commentary.php, lib/pvplist.php, lib/pvpsupport.php)
|
||||
[FIX] - Fixed a bug in lib/commentary.php which lead to mysql errors if browsing through commentaries and then clicking on a bio link in a comment that hasn't been posted when started browsing
|
||||
[FIX] - Fixed an error in lib/modules.php which prevented objprefs to be shown correctly. They were saved correctly, but the module_objpref_edit() function did not show the values.
|
||||
[FIX] - Inserted constant CLAN_FOUNDER.
|
||||
[FIX] - Fixed a typo in specialtymysticpower.php. Thanks to Maeher for reporting!
|
||||
|
||||
[FIX] - Character expiration email is now tl-ready
|
||||
[FIX] - Many unset variables/indexes
|
||||
[FIX] - Donation point mail now tl-ready for when 1 point is given
|
||||
[FIX] - Many incorrect slashes fixed (\letter when it should be \\letter)
|
||||
[FIX] - dragon death page now more translation ready
|
||||
[FIX] - Multifight limits now use the settings
|
||||
[FIX] - $options['denyflawless'] now passed to forestvictory()
|
||||
[FIX] - Misspelled variables
|
||||
[FIX] - setting $charsleft to false in previewfrom() now works
|
||||
[FIX] - favour needed to restore your soul now shown on every page when talking with Ramius
|
||||
[FIX] - Updating from <0.9.8 should now work
|
||||
[FIX] - haberdasher now appears in main city
|
||||
[FIX] - meaninglesscode doesn't remove new colour codes
|
||||
[FIX] - installer can now create database without dying
|
||||
|
||||
[FEATURE] - new hook $drunkadd = modulehook("modify-drunkeness",$row); added to modules/drinks/run.php to modify each drink drunkeness. An elf gets faster drunk than a dwarf... just modify after the hook $args['drunkeness'] like you want it to. You will get all drink informations via this hook.
|
||||
[FEATURE] - now you have in your talkine view a little javascript tell you "You have xxx characters left" counting down when you type. Lets you know when to make a new line.
|
||||
[FEATURE] - now moderators can delete post by directly clicking on a "Del" Button beside the post.
|
||||
[FEATURE] - added a village-$city hook and a village-desc-$city hook where $city is $session['user']['location']. I.e. you can now save lots of unnecessary queries when you want only to execute at ONE certain village square. To incorporate in a module, either add a hook to i.e. village-Glorfindal ... (bad if you want to have working all-round modules) but make a location setting, also changesetting (like always before) and upon a changesetting or a change in your module you *HAVE* to reinstall it. Make sure to do so, else the hook won't be fired off.
|
||||
[FEATURE] - clans can now be turned off (auto set to on)
|
||||
[FEATURE] - now translations can be cached via a setting in the grotto. *warning* test if this really speeds up your game. tests on a very big server showed that this function even slowed down the page generation. so handle with care. needless to say that this won't work without having the datacache turned on
|
||||
[FEATURE] - the % you lose when die in the forest is now settable (standard 10%)
|
||||
[FEATURE] - the skins now get sorted in natural order, not arbitrary anymore (themes in /lib/showform.php)
|
||||
[FEATURE] - now Cedrik (barkeep), Ramius (death overlord) and Karissa (clan registrar) can be (game settings) changed to any name you like. NOTICE TO TRANSLATORS: change "`\$Ramius"to "%s", "Cedrik" to "%s" and also Karissa to "%s" (there may also be other changes needed, but should be very few) in your translations table. (You may use the search+replace function in the Translation Wizard)
|
||||
[FEATURE] - modules/avatar.php changed to let the users have linked avatar pictures, coming with a validation in the grotto for moderators. It does not check if it has been changed on the remote server, but it should be ok. You can turn all of this on or off.
|
||||
[FEATURE] - /lib/modules.php incorporates an increment_module_objpref function you can use to increase numerical values with little effort. Do not use it for ASCII values! Signature of the function: increment_module_objpref($objtype,$objid,$name,$value=1,$module=false)
|
||||
[FEATURE] - addnav_notl($text,$link=false,$priv=false,$pop=false,$popsize="500x300") is now possible, the content in the text won't get translated
|
||||
[FEATURE] - added a hook to the gemchance... so you can modify the gem chance via module too. name: "alter-gemchance"
|
||||
[FEATURE] - added two hooks to the battle.php -> battle-pvp-victory and battle-pvp-defeat to make it easier to decide without having to boost the victory hook for *every* fight just for a pvp battle.
|
||||
[FEATURE] - user.php added a hook to put more informations about the user to the main view when you edit a user, hook: modulehook("modifyuserview", array("userinfo"=>$userinfo, "user"=>$row))..usage explained in user.php at the given location
|
||||
[FEATURE] - battle.php now knows also a $badguy['hidehitpoints'] which you can set to true in your module when creating it ("hidehitpoints"=>1) and then the enemy will have "?" hitpoints... good for some specials... more exitement. You can drop a line in your module "your enemy is now about half-dead" or so
|
||||
[FEATURE] - newday turns after resurrection can now be modified by a game setting (default -6 turns) that handles also a percentage (integer with a % afterwards)... turns can't turn negative and the base is (turns per day) + (dk points spent for turns)
|
||||
[FEATURE] - now the superuserflag SU_IS_GAMEMASTER exists, which can be set at the grotto. It invocates no hiding from HOF etc, and its function is simple: to post comments without name into a chat. Not more. /game is replaced (only when gamemaster) with no text at all. Also the preview will only hide it for gamemasters. modules/drinks/dohook.php has been changed, it does NOT differ if /game was from a SU_IS_GAMEMASTER or not.
|
||||
|
||||
[FEATURE] - fighting multiple enemies now possible
|
||||
[FEATURE] - badguys can now have new flags set:
|
||||
1) essentialleader: either "true" or a text like "{badguy} falls and all other enemies surrender".
|
||||
This flag defines one or more enemies as "essential" for the fight. Should one of them die, the fight will be won, even if some badguys are still alive.
|
||||
2) cannotbetarget: pretty much self-explanatory. A creature with this flag set can never be your target in battle. In can only be damaged by riposting or area buffs. To win such a battle, the following flag should be set, too.
|
||||
3) fleesifalone: If only badguys with this flag set are left living, they will abort the fight and flee.
|
||||
4) alwaysattacks: Normally only a certain amount of enemies can attack per round (default: 4). Enemies with this flag do not count towards this limit. (Imagine a swarm of bees. ;) )
|
||||
[FEATURE] - Buffs can have new flags set:
|
||||
1) aura: If this is set to true, 1/3 of the healing power is also given to any healable companion. This flag only works for buffs with the "regen" power.
|
||||
2) areadamage: Normally a buff will only harm the enemy you have targetted. Areadamge harms every enemy around. (Only valid for buffs with "minioncount").
|
||||
[FEATURE] - companions can now join you in fights
|
||||
[FEATURE] - companions can be suspended just like buffs
|
||||
[FEATURE] - last motd item now shown in daily news
|
||||
[FEATURE] - new function "previetext()" used in commentary section. This function will support coloured preview throughout the whole game with just a single declaration of usable colours.
|
||||
[FEATURE] - Last MotD item now shown on top of the news page.
|
||||
[FEATURE] - Petition categories now extendable via modules.
|
||||
[FEATURE] - New showform type: "textarearesizeable". Exactly like "textarea" but will show two buttons to increase/decrease size of the field. Needs javascript enabled.
|
||||
[FEATURE] - mysqli support has been implemented. To use mysqli instead of mysql go to lib/dbwrapper.php and change the dbtype. If you don't know what this means it's probably best you simply ignore this fact.
|
||||
[FEATURE] - increment_specialty() now also supports incrementing specialties which are not your's. just call increment_specialty('`$', "DA") e.g. to increment someone's level in Dark Arts, even they are a thief.
|
||||
[FEATURE] - Abigail's gifts are now extendable / changeable via a modulehook.
|
||||
[FEATURE] - Especially important for european servers: There's now a setting to add an impressum to the about page.
|
||||
|
||||
[FEATURE] - Modules now need _install, _uninstall and _getmoduleinfo functions before the can be installed
|
||||
[FEATURE] - Setting to allow packs of badguys (all same type)
|
||||
[FEATURE] - invalidatedatacache() can now invalidate a full path name
|
||||
[FEATURE] - on install, default settings that haven't been set are now added to the database
|
||||
[FEATURE] - game masters can now send YoMs from anyone
|
||||
[FEATURE] - added blocknavcat() and unblocknavcat()
|
||||
[FEATURE] - can now stop page_footer from saving the user by calling page_footer(false);
|
||||
[FEATURE] - added invisible setting type
|
||||
[FEATURE] - new hooks: everyhit-loggedin, everyfooter-loggedin, everyheader-loggedin
|
||||
|
||||
[UPDATE] - languages in prefs.php and configuration.php depend now on a setting "serverlanguages" where you can enter a string (enum) to make sure you have your language in the translator tool. No hardcode edits anymore.
|
||||
[UPDATE] - home.php altered the select query from laston etc to a simple counting statement which is enough for what we need here
|
||||
[UPDATE] - now mail.php shows in reply "Original Message from {username}" which makes it easiert to keep track
|
||||
[UPDATE] - now lotgdnet only notices main server at the login. There are no additional "pings" out. This will reduce traffic and increase performance.
|
||||
[UPDATE] - Skin selection now gets sorted alphabetically and not anymore in chronological order
|
||||
[UPDATE] - lib/expire_chars now runs after 23h if called, not after 24. Reason: if you have the newdays at the same time, it might occurr that hit the next exactly at or even bevor the daytime of the last. So only at the next newday the chars expire... which leads to more than 1 day expirations. This fixes it.
|
||||
[UPDATE] - moved the char, commentary, debuglog expiration to the newday_runonce (also fixed the debuglog bug when set to 0 days...)
|
||||
[UPDATE] - cron.php ... now guarded by a htaccess file to NOT let peopl trigger newdays from the outside... (security issue). Also removed the redundancy, now the same code is executed.
|
||||
[UPDATE] - /modules/gardener.php removed the footer-runmodule hook and put in footer-newbieisland. better performance.
|
||||
[UPDATE] - Edorians idea of moving the output field from the accounts table to a new table implemented. Now the large output field (needed only for badnavs) is not loaded each pagehit anymore (yet updated like always)
|
||||
[UPDATE] - donators.php removed the debugs and made clear outputs, saying the reason and also after the submit a real sentence.
|
||||
[UPDATE] - commentary posting limiter (limits posts for one user to 50% of the posting area, normally 10) can be deactivated in the game settings
|
||||
[UPDATE] - hooking into events now uses the following hook: #modulehook("runevent_$module", array("type"=>$type, "baselink"=>$baseLink, "get"=>httpallget(), "post"=>httpallpost()));# so you can now hook at "runevent_abigail" and get executed there (pls don't call a page_footer in your module there, only if you know what you do)
|
||||
[UPDATE] - added "ob_start('ob_gzhandler');" to the common.php to enable the gzip compression. This will produce a bit more CPU load, but the traffic will decrease by 30%-40% estimated and your users will have the pages displayed usually a bit quicker as less bytes need to be transferred. This setting proved to be worth adding on smaller and bigger servers, so it is now going to be core.
|
||||
[UPDATE/FIX] - in the user editor (and if you call the lib/lookup_user.php yourself in any module) you can now use % as tags like in a mysql query. in 1.1.0 it was introduced that you have to enter the *exact* (case-insensitive) name/login of the player. Which was ... not good. Now you can look for an exact match (enter the name normally) or use the % tags to search for any number of letters at this point. I.e. '%man' finds 'Talisman', but not 'Chadmann', 'Tali%' finds 'Talisman', but not 'ReTailMan'.. you can use them at any position (even '%man%' which would find any usernames containing 'man').
|
||||
[UPDATE/FIX] - get_module_pref now check first if the pref has been loaded previously and THEN calls load_module_prefs (and check again). As most guys have prefs for certain modules sooner or later, on if-isset afterwards is faster than many function calls who come back empty.
|
||||
[UPDATE] - lib/forestoutcomes.php now also shows a creaturewin phrase automatically if entered in the creature table, same like the creaturelose phrase that is displayed normally. also edited creatures.php (small code cleanup)
|
||||
[UPDATE] - lib/battleskills has now a is_buff_active($buffname) to determine if a buff is active¬ suspended or not active or suspended. If you want to check if the buff exists use hasbuff($buffname)
|
||||
[UPDATE] - added a few more key indices to the account table to be more innodb friendly
|
||||
[UPDATE] - lib/translator.php modified, now a translate_inline($intext,$namespace=FALSE) is possible, i.e you don't need to construct for a single line a tlschema and reset it afterwards
|
||||
[UPDATE] - mail.php,lib/systemmail.php,lib/pageparts.php now cache the amount of mails the user has, this speeds things up on the servers (nasty sum query...(Edorian)
|
||||
[UPDATE] - game settings are cached now (were not before) which caused the move of the datacachepath and the usedatacache to be shifted to the dbconnect.php ... fresh installs will get this automatically, upgrades need to do it manually (see AFTERUPGRADE.txt)
|
||||
[UPDATE] - lib/checkban.php has its messages now in the ban scheme and those are therefore translatable
|
||||
[UPDATE] - now races don't need to hook into charstats (an everyhit hook) anymore just to display the race the user has. It has been moved into core.
|
||||
[UPDATE] - racenames SHOULD now be adressed within the "race" scheme... translate_inline($session['user']['race'],"race") should therefore get you the race name. For people who don't want to remember the scheme and add a few more chars to their translate_inline please use the function get_racename($thisuser=TRUE). If you want the race of the current user, call get_racename(), if you have fetched the race i.e. from the DB directly for a third user, enter the plain race as parameter $thisuser.
|
||||
[UPDATE] - now core includes .htaccess files who (if apache accepts them) block ANY direct access from the outside to the lib+modules directory (incl. subdirs) to prevent execution of code from the outside without the runmodule or other files in your homeroot. This affects all php files, no other files
|
||||
[UPDATE] - Many module files have been split up into libs to decrease memory usage (lib files for / files in lib/$filename and for modules in /modules/$filename):
|
||||
-modules/oldman.php
|
||||
-graveyard.php (optimized for tormenting)
|
||||
-user.php (split up)
|
||||
-petition.php (2/3 FAQs are not needed for petitions, and the other way around)
|
||||
-installer.php (though not needed often, it is better to have the steps better displayed -better to modify-)
|
||||
-newday.php (some parts like dk-point spending)
|
||||
-about.php (general split up)
|
||||
-inn.php (sanity reasons, also switched the villagenav up)
|
||||
-modules/cities.php (village doesn't need travels loaded everytime)
|
||||
-modules/customeq.php (gets called only in charstats mostly)
|
||||
-modules/scavenge.php (village special not executed 20kb of code all the time... only when running it needs it)
|
||||
|
||||
[UPDATE] - updated specialtydarkarts.php to summon a skeleton warrior as companion, not as a buff
|
||||
[UPDATE] - updated specialtymysticpower.php to have an aura buff (regeneration) and an area buff (earth fist)
|
||||
[UPDATE] - updated thieves.php. Lonestrider will now truly attack with multiple thieves. Module also shows how "essentialleader" and "fleesifalone" attributes for badguys work
|
||||
[UPDATE] - removed admin ability to change passwords.
|
||||
[UPDATE] - objprefs now cached, too.
|
||||
|
||||
[UPDATE] - Creatures editor now uses formula to generate stats, instead of a large table
|
||||
[UPDATE] - After killing dragon, location is set to the server setting, not LOCATION_FIELDS
|
||||
[UPDATE] - When succesfully fleeing, one fight companions expire
|
||||
[UPDATE] - module download link can now be https,ftp,ftps or http
|
||||
[UPDATE] - companions can now have a longer name and category
|
||||
[UPDATE] - If $module_install() returns false, installing stops
|
||||
[UPDATE] - default module settings are set before calling _install()
|
||||
[UPDATE] - page title is now sanitized
|
||||
[UPDATE/FIX] - JS from collapse is now in HTML comments
|
||||
[UPDATE] - can now specify wether content/nav sections can be collapsed on a system wide level
|
||||
[UPDATE] - prizemount payments are now cumulative
|
||||
[UPDATE/FIX] - pvpblock now checks bands are valid
|
||||
[UPDATE] - source.php now displays files by folders, decreasing clutter
|
66
lotgd-web/lotgd/LICENSE.txt
Executable file
@ -0,0 +1,66 @@
|
||||
I'm going to take a few moments to try and explain this new license and
|
||||
the reasons behind it in plain English. The legalese for the license can
|
||||
be found online at http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
|
||||
and should be read and understood in detail before you use this code.
|
||||
|
||||
This new license was chosen because of a failing with the GPL. It only
|
||||
covered distribution of source if and only if binaries were distributed.
|
||||
|
||||
In a web environment, specifically an interpreted web environment, merely
|
||||
installing a game does not constitute distribution, and therefore people
|
||||
were taking our work, making modifications to it and not releasing the
|
||||
source code to their modifications so that the entire community could
|
||||
benefit. They worked with the letter but not the spirit of the law.
|
||||
|
||||
Investigation on the part of the authors however, led to the fact that the
|
||||
right of public performance was one of the rights normally restricted to
|
||||
copyright holders, AND that computer programs, specifically video games and
|
||||
interactive ones such as Legend of the Green Dragon were considered to be
|
||||
publically performed if run from a public server.
|
||||
|
||||
The new license restricts public performance of the work unless the source
|
||||
code of the modified work is made available on demand.
|
||||
|
||||
In plain English, this means that if you put this game on a web server and
|
||||
allow people 'outside of a normal circle of family and its social
|
||||
acquaintances' to play there, then you are publically performing this work and
|
||||
MUST either a) make any and ALL changes which you make to the game available
|
||||
on request (note this doesn't have to be available via the online source
|
||||
display link, but they must be able to ask you for the code AND receive it
|
||||
in toto), b) make arrangements privately with the authors wherein they
|
||||
grant you a special license, or c) remove the code entirely from the machine.
|
||||
|
||||
We do recognize that people want to have areas of their game which are theirs
|
||||
and theirs alone. To that end we will make the following exception to the
|
||||
normal requirements for source code distribution -- any module file which is
|
||||
not modified or derived from a module file included in the base distribution
|
||||
AND which does not require any other module files AND which does not require
|
||||
any modifications to the core code (code distributed with the base release)
|
||||
may be withheld at the authors discretion.
|
||||
|
||||
For purposes of this license, base releases of this code include all versions
|
||||
created and distributed by Eric Stevens and JT Traub. In addition to these
|
||||
versions, the developers at Dragonprime.net are hereby granted a revokable
|
||||
authority to produce new distributions which enjoy the same restrictions and
|
||||
exceptions as this entire license. This authority may be revoked at any time,
|
||||
but such revocation will be purely proactive, and existing releases will still
|
||||
enjoy the full liberty of this license.
|
||||
Although revocation may be for any reason, the only foreseeable reason that such
|
||||
revocation would be enacted is if these distributions were discovered to contain
|
||||
module hooks designed to circumvent the spirit of this license. The intention is
|
||||
to let these developers continue where Eric and JT have left off.
|
||||
|
||||
We also want to make very clear that version 0.9.7 (also known as version
|
||||
0.9.7+jt) was the final version released under the GPL. All versions,
|
||||
starting with the 0.9.8-prerelease code are only licensed under the Creative
|
||||
Commons license. We EXPLICITLY deny the right to import any code from a
|
||||
0.9.8-prerelease or later release into a 0.9.7 and earlier release. Allowing
|
||||
this would cause that imported code to be released under the GPL and that is
|
||||
not something we wish to allow. Authors of modifications to 0.9.7 will
|
||||
need to re-release their modifications as derivitives/modifications to
|
||||
0.9.8 code and place them under the same Creative Commons license. It must
|
||||
be done by the original author since only the original author has the right
|
||||
to change the copyright or license upon their work. [Additionally,
|
||||
reworking the modifications will be a good idea anyway as the mechanism for
|
||||
making modifications is substantially cleaner/clearer starting with the
|
||||
0.9.8-prerelease code.]
|
135
lotgd-web/lotgd/README.txt
Executable file
@ -0,0 +1,135 @@
|
||||
Legend of the Green Dragon
|
||||
by Eric "MightyE" Stevens (http://www.mightye.org)
|
||||
and JT "Kendaer" Traub (http://www.dragoncat.net)
|
||||
|
||||
Software Project Page:
|
||||
http://sourceforge.net/projects/lotgd
|
||||
|
||||
Modification AND Support Community Page:
|
||||
http://dragonprime.net
|
||||
|
||||
Primary game servers:
|
||||
http://lotgd.net
|
||||
http://logd.dragoncat.net
|
||||
|
||||
For a new installation, see INSTALLATION below.
|
||||
For upgrading a new installation, see UPGRADING below.
|
||||
If you have problems, please visit Dragonprime at the address above.
|
||||
|
||||
----------------------------------------------
|
||||
-- UPGRADING: --------------------------------
|
||||
----------------------------------------------
|
||||
ALWAYS extract the new distribution into a new directory!
|
||||
|
||||
BEFORE ANYTHING ELSE, read and understand the new code license. This code
|
||||
is no longer under the GPL! Be aware that if you install this new version
|
||||
on a publically accessible web server you are bound by the terms of the
|
||||
license.
|
||||
|
||||
We also *STRONGLY* recommend that you shut down access to your game and
|
||||
BACK UP your game database AND existing logd source files before attempting
|
||||
an upgrade as most of the changes are NOT easily reversible!
|
||||
|
||||
If you are running a version after 0.9.7 you can do this by going
|
||||
into the manage modules, installing the serversuspend module and then
|
||||
activating it. If you are running a 0.9.7 version, you will need to do
|
||||
this some other way, such as via .htaccess under apache. Consult the
|
||||
documentation for your web server.
|
||||
|
||||
Once you have done this, copy the new code into the site directory. Due to
|
||||
the need of the installer, you have to do this before running the
|
||||
installer! Make sure that you copy all of the files from all of the
|
||||
subdirectories.
|
||||
|
||||
As of 0.9.8-prerelease.11, the only way to install or upgrade the game is
|
||||
via the included installer. To access the installer, log out of the game and
|
||||
then access installer.php (for instance, if your game was installed at
|
||||
http://logd.dragoncat.net, you would access the installer at
|
||||
http://logd.dragoncat.net/installer.php)
|
||||
|
||||
From here, it should be a simple matter of walking through the steps!
|
||||
Choose upgrade as the type of install (it defaults to *new* install, so
|
||||
watch out for this!!) and choose the version you currently have installed and
|
||||
it will perform an upgrade.
|
||||
|
||||
Once this is done, read the note for upgrading from 0.9.7 if you are, and
|
||||
then go read the POST INSTALLATION section below.
|
||||
|
||||
*** NOTE FOR THOSE UPGRADING FROM 0.9.7 ***
|
||||
In 0.9.8 and above, the 'specials' directory has been removed and that
|
||||
functionality is now handled by modules. If you have specials which are not
|
||||
yet converted to modules, they will be unavailable until you convert them.
|
||||
Move your specials directory to another directory name (for instance
|
||||
specials.save) and work on converting them. Most specials should convert
|
||||
easily and you can look at existing examples. If you haven't created (or
|
||||
modified) specials on your server, just remove this directory.
|
||||
|
||||
----------------------------------------------
|
||||
-- INSTALLATION: -----------------------------
|
||||
----------------------------------------------
|
||||
These instructions cover a new LoGD installation.
|
||||
You will need access to a MySQL database and a PHP hosting
|
||||
location to run this game. Your SQL user needs the LOCK TABLES
|
||||
privelege in order to run the game correct.
|
||||
|
||||
Extract the files into the directory where you will want the code to live.
|
||||
|
||||
BEFORE ANYTHING ELSE, read and understand the license that this game is
|
||||
released under. You are legally bound by the license if you install this
|
||||
game on a publically accessible web server!
|
||||
|
||||
MySQL Setup:
|
||||
Setup should be pretty straightforward, create the database, create
|
||||
an account to access the database on behalf of the site; this account
|
||||
should have full permissions on the database.
|
||||
|
||||
After you have the database created, point your browser at the location you
|
||||
have the logd files installed at and load up installer.php (for instance,
|
||||
if the files are accessible as http://logd.dragoncat.net, you will want to
|
||||
load http://logd.dragoncat.net/installer.php in the browser). The installer
|
||||
will walk you through a complete setup from the ground up. Make sure to
|
||||
follow all instructions!
|
||||
|
||||
Once you have completed the installation, read the POST INSTALLATION section
|
||||
below.
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
-- POST INSTALLATION: ------------------------
|
||||
----------------------------------------------
|
||||
|
||||
Now that you have the game installed, you need to take a couple of sensible
|
||||
precautions.
|
||||
|
||||
Firstly, make SURE that your dbconnect.php is not writeable. Under unix,
|
||||
you do this by typing
|
||||
chmod -w dbconnect.php
|
||||
This is to keep you from making unintentional changes to this file.
|
||||
|
||||
The installer will have installed, but not activated, some common modules
|
||||
which we feel make for a good baseline of the game.
|
||||
|
||||
You should log into the game (using the admin account created during
|
||||
installation if this is a new install, or your regular admin account if this
|
||||
is an update) and go into the manage modules section of the Superuser Grotto.
|
||||
Go through the installed and uninstalled modules and make sure that the
|
||||
modules you want are installed. Do NOT activate them yet.
|
||||
*** NOTE *** If this is a first-time install, you will see some messages about
|
||||
races and specials not being installed during your character setup. This is
|
||||
fine and correct since you have not yet configured these items.
|
||||
|
||||
Now, go to the game settings page, and configure the game settings for the
|
||||
base game and for the modules. For an update, this should be just a
|
||||
matter of looking at the non-active (grey-ed out) modules. For an initial
|
||||
install, this is a LOT of configuration, but taking your time here will
|
||||
make your game MUCH better.
|
||||
|
||||
If you are upgrading from 0.9.7, look at your old game settings and make
|
||||
the new ones similar. A *lot* of settings have moved from the old
|
||||
configuration screen and are now controlled by modules, so you will want
|
||||
to write down your old configuration values BEFORE you start the upgrade.
|
||||
|
||||
Once you have things configured to your liking, you should go back to the
|
||||
manage modules page and ACTIVATE any modules that you want to have running.
|
||||
|
||||
Good luck and enjoy your new LotGD server!
|
29
lotgd-web/lotgd/TODO.txt
Executable file
@ -0,0 +1,29 @@
|
||||
Eternal tasks:
|
||||
- Poke MightyE to keep the todo list up to date
|
||||
|
||||
Would be nice for 1.0 release:
|
||||
- Move some other forest events onto the travel events hook as well.
|
||||
- Change the way mounts are enabled in certain areas only in order to be
|
||||
consistent.
|
||||
- Explain the advertising opt-out link (cost, etc) in the lodge.
|
||||
|
||||
Miscellaneous suggestions to be worked on 'sometime':
|
||||
- Have a method for allowing the village to decide the 'danger level'
|
||||
of travel between any other place and it. Or to require the trip to
|
||||
be something other than just fights (for instance, the way Strider has
|
||||
the Eythgim village set up on Legendgaard). Aes' worldmap module is a nice
|
||||
start on this.
|
||||
- Implement two-pass hotkey system so that links which want a specific hot-key
|
||||
get first choice.
|
||||
- Make an in-game task list for deletions/cleanup so that all of it isn't
|
||||
run in big chunks.
|
||||
|
||||
Ideas which probably won't be done anytime soon:
|
||||
- Suggestion by JRMinga: it seems less glorious somehow to have the statue
|
||||
only in d'burg. perhaps at least in one's home city, one can see a
|
||||
representation of the latest DK of that race?
|
||||
- anyanka wants an internal description for clan members in addition to the
|
||||
external description for all and a motd for clan members
|
||||
- investigate alternate gem procurement methods (black market?)
|
||||
- investigate means to talk in the village after a person is dead
|
||||
(Ramius, costing a few favor?)
|
32
lotgd-web/lotgd/about.php
Executable file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
define("ALLOW_ANONYMOUS",true);
|
||||
require_once("common.php");
|
||||
require_once("lib/showform.php");
|
||||
require_once("lib/http.php");
|
||||
|
||||
tlschema("about");
|
||||
|
||||
page_header("About Legend of the Green Dragon");
|
||||
$details = gametimedetails();
|
||||
|
||||
checkday();
|
||||
$op = httpget('op');
|
||||
|
||||
switch ($op) {
|
||||
case "setup": case "listmodules": case "license":
|
||||
require("lib/about/about_$op.php");
|
||||
break;
|
||||
default:
|
||||
require("lib/about/about_default.php");
|
||||
break;
|
||||
}
|
||||
if ($session['user']['loggedin']) {
|
||||
addnav("Return to the news","news.php");
|
||||
}else{
|
||||
addnav("Login Page","index.php");
|
||||
}
|
||||
page_footer();
|
||||
?>
|
166
lotgd-web/lotgd/armor.php
Executable file
@ -0,0 +1,166 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/villagenav.php");
|
||||
|
||||
tlschema("armor");
|
||||
|
||||
checkday();
|
||||
$tradeinvalue = round(($session['user']['armorvalue']*.75),0);
|
||||
$basetext=array(
|
||||
"title" => "Pegasus Armor",
|
||||
"desc" => array(
|
||||
"`5The fair and beautiful `#Pegasus`5 greets you with a warm smile as you stroll over to her brightly colored gypsy wagon, which is placed, not out of coincidence, right next to `!MightyE`5's weapon shop.",
|
||||
"Her outfit is as brightly colored and outrageous as her wagon, and it is almost (but not quite) enough to make you look away from her huge gray eyes and flashes of skin between her not-quite-sufficient gypsy clothes.`n`n",
|
||||
),
|
||||
"tradein" => array(
|
||||
"`5You look over the various pieces of apparel, and wonder if `#Pegasus`5 would be so good as to try some of them on for you, when you realize that she is busy staring dreamily at `!MightyE`5 through the window of his shop as he, bare-chested, demonstrates the use of one of his fine wares to a customer.",
|
||||
array("Noticing for a moment that you are browsing her wares, she glances at your `&%s`5 and says that she'll give you `^%s`5 for them.`0`n`n",$session['user']['armor'], $tradeinvalue),
|
||||
),
|
||||
"nosuchweapon" => "`#Pegasus`5 looks at you, confused for a second, then realizes that you've apparently taken one too many bonks on the head, and nods and smiles.",
|
||||
"tryagain" => "Try again?",
|
||||
"notenoughgold" => "`5Waiting until `#Pegasus`5 looks away, you reach carefully for the `%%s`5, which you silently remove from the stack of clothes on which it sits. Secure in your theft, you begin to turn around only to realize that your turning action is hindered by a fist closed tightly around your throat. Glancing down, you trace the fist to the arm on which it is attached, which in turn is attached to a very muscular `!MightyE`5. You try to explain what happened here, but your throat doesn't seem to be able to open up to let your voice through, let alone essential oxygen.`n`nAs darkness creeps in on the edge of your vision, you glance pleadingly, but futilely at `%Pegasus`5 who is staring dreamily at `!MightyE`5, her hands clutched next to her face, which is painted with a large admiring smile.`n`n`n`nYou wake up some time later, having been tossed unconscious into the street.",
|
||||
"payarmor" => "`#Pegasus`5 takes your gold, and much to your surprise she also takes your `%%s`5 and promptly puts a price on it, setting it neatly on another stack of clothes.`n`nIn return, she hands you a beautiful new `%%s`5.`n`nYou begin to protest, \"`@Won't I look silly wearing nothing but my `&%s`@?`5\" you ask. You ponder it a moment, and then realize that everyone else in the town is doing the same thing. \"`@Oh well, when in Rome...`5\"",
|
||||
);
|
||||
|
||||
$schemas = array(
|
||||
"title"=>"armor",
|
||||
"desc"=>"armor",
|
||||
"tradein"=>"armor",
|
||||
"nosuchweapon"=>"armor",
|
||||
"tryagain"=>"armor",
|
||||
"notenoughgold"=>"armor",
|
||||
"payarmor"=>"armor",
|
||||
);
|
||||
|
||||
$basetext['schemas'] = $schemas;
|
||||
$texts = modulehook("armortext",$basetext);
|
||||
$schemas = $texts['schemas'];
|
||||
|
||||
tlschema($schemas['title']);
|
||||
page_header($texts['title']);
|
||||
output("`c`b`%".$texts['title']."`0`b`c");
|
||||
tlschema();
|
||||
$op = httpget('op');
|
||||
if ($op==""){
|
||||
tlschema($schemas['desc']);
|
||||
if (is_array($texts['desc'])) {
|
||||
foreach ($texts['desc'] as $description) {
|
||||
output_notl(sprintf_translate($description));
|
||||
}
|
||||
} else {
|
||||
output($texts['desc']);
|
||||
}
|
||||
tlschema();
|
||||
|
||||
$sql = "SELECT max(level) AS level FROM " . db_prefix("armor") . " WHERE level<=".$session['user']['dragonkills'];
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
|
||||
$sql = "SELECT * FROM " . db_prefix("armor") . " WHERE level={$row['level']} ORDER BY value";
|
||||
$result = db_query($sql);
|
||||
|
||||
tlschema($schemas['tradein']);
|
||||
if (is_array($texts['tradein'])) {
|
||||
foreach ($texts['tradein'] as $description) {
|
||||
output_notl(sprintf_translate($description));
|
||||
}
|
||||
} else {
|
||||
output($texts['tradein']);
|
||||
}
|
||||
tlschema();
|
||||
|
||||
$aname = translate_inline("`bName`b");
|
||||
$adef = translate_inline("`bDefense`b");
|
||||
$acost = translate_inline("`bCost`b");
|
||||
rawoutput("<table border='0' cellpadding='0'>");
|
||||
rawoutput("<tr class='trhead'><td>");
|
||||
output_notl($aname);
|
||||
rawoutput("</td><td align='center'>");
|
||||
output_notl($adef);
|
||||
rawoutput("</td><td align='right'>");
|
||||
output_notl($acost);
|
||||
rawoutput("</td></tr>");
|
||||
$i = 0;
|
||||
while($row = db_fetch_assoc($result)) {
|
||||
$link = true;
|
||||
$row = modulehook("modify-armor", $row);
|
||||
if (isset($row['skip']) && $row['skip'] === true) {
|
||||
continue;
|
||||
}
|
||||
if (isset($row['unavailable']) && $row['unavailable'] == true) {
|
||||
$link = false;
|
||||
}
|
||||
rawoutput("<tr class='".($i%2==1?"trlight":"trdark")."'>");
|
||||
rawoutput("<td>");
|
||||
$color = "`)";
|
||||
if ($row['value']<=($session['user']['gold']+$tradeinvalue)){
|
||||
if ($link) {
|
||||
$color = "`&";
|
||||
rawoutput("<a href='armor.php?op=buy&id={$row['armorid']}'>");
|
||||
} else {
|
||||
$color = "`7";
|
||||
}
|
||||
output_notl("%s%s`0", $color, $row['armorname']);
|
||||
if ($link) {
|
||||
rawoutput("</a>");
|
||||
}
|
||||
addnav("","armor.php?op=buy&id={$row['armorid']}");
|
||||
}else{
|
||||
output_notl("%s%s`0", $color, $row['armorname']);
|
||||
addnav("","armor.php?op=buy&id={$row['armorid']}");
|
||||
}
|
||||
rawoutput("</td><td align='center'>");
|
||||
output_notl("%s%s`0", $color, $row['defense']);
|
||||
rawoutput("</td><td align='right'>");
|
||||
if (isset($row['alternatetext']) && $row['alternatetext'] > "") {
|
||||
output("%s%s`0", $color, $row['alternatetext']);
|
||||
} else {
|
||||
output_notl("%s%s`0",$color,$row['value']);
|
||||
}
|
||||
rawoutput("</td></tr>");
|
||||
++$i;
|
||||
}
|
||||
rawoutput("</table>",true);
|
||||
villagenav();
|
||||
}elseif ($op=="buy"){
|
||||
$id = httpget('id');
|
||||
$sql = "SELECT * FROM " . db_prefix("armor") . " WHERE armorid='$id'";
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)==0){
|
||||
tlschema($schemas['nosuchweapon']);
|
||||
output($texts['nosuchweapon']);
|
||||
tlschema();
|
||||
tlschema($schemas['tryagain']);
|
||||
addnav($texts['tryagain'],"armor.php");
|
||||
tlschema();
|
||||
villagenav();
|
||||
}else{
|
||||
$row = db_fetch_assoc($result);
|
||||
$row = modulehook("modify-armor", $row);
|
||||
if ($row['value']>($session['user']['gold']+$tradeinvalue)){
|
||||
tlschema($schemas['notenoughgold']);
|
||||
output($texts['notenoughgold'],$row['armorname']);
|
||||
tlschema();
|
||||
villagenav();
|
||||
}else{
|
||||
tlschema($schemas['payarmor']);
|
||||
output($texts['payarmor'],$session['user']['armor'],$row['armorname'],$row['armorname']);
|
||||
tlschema();
|
||||
debuglog("spent " . ($row['value']-$tradeinvalue) . " gold on the " . $row['armorname'] . " armor");
|
||||
$session['user']['gold']-=$row['value'];
|
||||
$session['user']['armor'] = $row['armorname'];
|
||||
$session['user']['gold']+=$tradeinvalue;
|
||||
$session['user']['defense']-=$session['user']['armordef'];
|
||||
$session['user']['armordef'] = $row['defense'];
|
||||
$session['user']['defense']+=$session['user']['armordef'];
|
||||
$session['user']['armorvalue'] = $row['value'];
|
||||
villagenav();
|
||||
}
|
||||
}
|
||||
}
|
||||
page_footer();
|
||||
?>
|
109
lotgd-web/lotgd/armoreditor.php
Executable file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/showform.php");
|
||||
require_once("lib/http.php");
|
||||
|
||||
check_su_access(SU_EDIT_EQUIPMENT);
|
||||
|
||||
tlschema("armor");
|
||||
|
||||
page_header("Armor Editor");
|
||||
$armorlevel = (int)httpget('level');
|
||||
require_once("lib/superusernav.php");
|
||||
superusernav();
|
||||
addnav("Armor Editor");
|
||||
addnav("Armor Editor Home","armoreditor.php?level=$armorlevel");
|
||||
|
||||
addnav("Add armor","armoreditor.php?op=add&level=$armorlevel");
|
||||
$values = array(1=>48,225,585,990,1575,2250,2790,3420,4230,5040,5850,6840,8010,9000,10350);
|
||||
output("`&<h3>Armor for %s Dragon Kills</h3>`0",$armorlevel,true);
|
||||
|
||||
$armorarray=array(
|
||||
"Armor,title",
|
||||
"armorid"=>"Armor ID,hidden",
|
||||
"armorname"=>"Armor Name",
|
||||
"defense"=>"Defense,range,1,15,1");
|
||||
$op = httpget('op');
|
||||
$id = httpget('id');
|
||||
if($op=="edit" || $op=="add"){
|
||||
if ($op=="edit"){
|
||||
$sql = "SELECT * FROM " . db_prefix("armor") . " WHERE armorid='$id'";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
}else{
|
||||
$sql = "SELECT max(defense+1) AS defense FROM " . db_prefix("armor") . " WHERE level=$armorlevel";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
}
|
||||
rawoutput("<form action='armoreditor.php?op=save&level=$armorlevel' method='POST'>");
|
||||
addnav("","armoreditor.php?op=save&level=$armorlevel");
|
||||
showform($armorarray,$row);
|
||||
rawoutput("</form>");
|
||||
}else if($op=="del"){
|
||||
$sql = "DELETE FROM " . db_prefix("armor") . " WHERE armorid='$id'";
|
||||
db_query($sql);
|
||||
//output($sql);
|
||||
$op = "";
|
||||
httpset("op", $op);
|
||||
}else if($op=="save"){
|
||||
$armorid = httppost('armorid');
|
||||
$armorname = httppost('armorname');
|
||||
$defense = httppost('defense');
|
||||
if ($armorid>0){
|
||||
$sql = "UPDATE " . db_prefix("armor") . " SET armorname=\"$armorname\",defense=\"$defense\",value=".$values[$defense]." WHERE armorid='$armorid'";
|
||||
}else{
|
||||
$sql = "INSERT INTO " . db_prefix("armor") . " (level,defense,armorname,value) VALUES ($armorlevel,\"$defense\",\"$armorname\",".$values[$defense].")";
|
||||
}
|
||||
db_query($sql);
|
||||
$op = "";
|
||||
httpset("op", $op);
|
||||
}
|
||||
if ($op==""){
|
||||
$sql = "SELECT max(level+1) AS level FROM " . db_prefix("armor");
|
||||
$res = db_query($sql);
|
||||
$row = db_fetch_assoc($res);
|
||||
$max = $row['level'];
|
||||
for ($i=0;$i<=$max;$i++){
|
||||
if ($i == 1)
|
||||
addnav(array("Armor for %s DK",$i),"armoreditor.php?level=$i");
|
||||
else
|
||||
addnav(array("Armor for %s DKs",$i),"armoreditor.php?level=$i");
|
||||
}
|
||||
$sql = "SELECT * FROM " . db_prefix("armor") . " WHERE level=$armorlevel ORDER BY defense";
|
||||
$result= db_query($sql);
|
||||
$ops = translate_inline("Ops");
|
||||
$name = translate_inline("Name");
|
||||
$cost = translate_inline("Cost");
|
||||
$defense = translate_inline("Defense");
|
||||
$level = translate_inline("Level");
|
||||
$edit = translate_inline("Edit");
|
||||
$del = translate_inline("Del");
|
||||
$delconfirm = translate_inline("Are you sure you wish to delete this armor?");
|
||||
|
||||
rawoutput("<table border=0 cellpadding=2 cellspacing=1 bgcolor='#999999'>");
|
||||
rawoutput("<tr class='trhead'><td>$ops</td><td>$name</td><td>$cost</td><td>$defense</td><td>$level</td></tr>");
|
||||
$number=db_num_rows($result);
|
||||
for ($i=0;$i<$number;$i++){
|
||||
$row = db_fetch_assoc($result);
|
||||
rawoutput("<tr class='".($i%2?"trdark":"trlight")."'>");
|
||||
rawoutput("<td>[<a href='armoreditor.php?op=edit&id={$row['armorid']}&level=$armorlevel'>$edit</a>|<a href='armoreditor.php?op=del&id={$row['armorid']}&level=$armorlevel' onClick='return confirm(\"$delconfirm\");'>$del</a>]</td>");
|
||||
addnav("","armoreditor.php?op=edit&id={$row['armorid']}&level=$armorlevel");
|
||||
addnav("","armoreditor.php?op=del&id={$row['armorid']}&level=$armorlevel");
|
||||
rawoutput("<td>");
|
||||
output_notl($row['armorname']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl($row['value']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl($row['defense']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl($row['level']);
|
||||
rawoutput("</td>");
|
||||
rawoutput("</tr>");
|
||||
}
|
||||
rawoutput("</table>");
|
||||
}
|
||||
page_footer();
|
||||
?>
|
51
lotgd-web/lotgd/badnav.php
Executable file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
define("OVERRIDE_FORCED_NAV",true);
|
||||
require_once("common.php");
|
||||
require_once("lib/villagenav.php");
|
||||
|
||||
tlschema("badnav");
|
||||
|
||||
if ($session['user']['loggedin'] && $session['loggedin']){
|
||||
if (strpos($session['output'],"<!--CheckNewDay()-->")){
|
||||
checkday();
|
||||
}
|
||||
while (list($key,$val)=each($session['allowednavs'])){
|
||||
//hack-tastic.
|
||||
if (
|
||||
trim($key)=="" ||
|
||||
$key===0 ||
|
||||
substr($key,0,8)=="motd.php" ||
|
||||
substr($key,0,8)=="mail.php"
|
||||
) unset($session['allowednavs'][$key]);
|
||||
}
|
||||
$sql="SELECT output FROM ".db_prefix("accounts_output")." WHERE acctid={$session['user']['acctid']};";
|
||||
$result=db_query($sql);
|
||||
$row=db_fetch_assoc($result);
|
||||
if (!is_array($session['allowednavs']) ||
|
||||
count($session['allowednavs'])==0 || $row['output']=="") {
|
||||
$session['allowednavs']=array();
|
||||
page_header("Your Navs Are Corrupted");
|
||||
if ($session['user']['alive']) {
|
||||
villagenav();
|
||||
output("Your navs are corrupted, please return to %s.",
|
||||
$session['user']['location']);
|
||||
} else {
|
||||
addnav("Return to Shades", "shades.php");
|
||||
output("Your navs are corrupted, please return to the Shades.");
|
||||
}
|
||||
page_footer();
|
||||
}
|
||||
echo $row['output'];
|
||||
$session['debug']="";
|
||||
$session['user']['allowednavs']=$session['allowednavs'];
|
||||
saveuser();
|
||||
}else{
|
||||
$session=array();
|
||||
translator_setup();
|
||||
redirect("index.php");
|
||||
}
|
||||
|
||||
?>
|
172
lotgd-web/lotgd/badword.php
Executable file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/http.php");
|
||||
|
||||
check_su_access(SU_EDIT_COMMENTS);
|
||||
|
||||
tlschema("badword");
|
||||
|
||||
$op = httpget('op');
|
||||
//yuck, this page is a mess, but it gets the job done.
|
||||
page_header("Bad word editor");
|
||||
|
||||
require_once("lib/superusernav.php");
|
||||
superusernav();
|
||||
addnav("Bad Word Editor");
|
||||
|
||||
addnav("Refresh the list","badword.php");
|
||||
output("`7Here you can edit the words that the game filters. Using * at the start or end of a word will be a wildcard matching anything else attached to the word. These words are only filtered if bad word filtering is turned on in the game settings page.`n`n`0");
|
||||
|
||||
$test = translate_inline("Test");
|
||||
rawoutput("<form action='badword.php?op=test' method='POST'>");
|
||||
addnav("","badword.php?op=test");
|
||||
output("`7Test a word:`0");
|
||||
rawoutput("<input name='word'><input type='submit' class='button' value='$test'></form>");
|
||||
if ($op=="test"){
|
||||
$word = httppost("word");
|
||||
$return = soap($word,true);
|
||||
if ($return == $word)
|
||||
output("`7\"%s\" does not trip any filters.`0`n`n", $word);
|
||||
else
|
||||
output("`7%s`0`n`n", $return);
|
||||
}
|
||||
|
||||
output_notl("<font size='+1'>", true);
|
||||
output("`7`bGood Words`b`0");
|
||||
rawoutput("</font>");
|
||||
output("`7 (bad word exceptions)`0`n");
|
||||
|
||||
$add = translate_inline("Add");
|
||||
$remove = translate_inline("Remove");
|
||||
rawoutput("<form action='badword.php?op=addgood' method='POST'>");
|
||||
addnav("","badword.php?op=addgood");
|
||||
output("`7Add a word:`0");
|
||||
rawoutput("<input name='word'><input type='submit' class='button' value='$add'></form>");
|
||||
rawoutput("<form action='badword.php?op=removegood' method='POST'>");
|
||||
addnav("","badword.php?op=removegood");
|
||||
output("`7Remove a word:`0");
|
||||
rawoutput("<input name='word'><input type='submit' class='button' value='$remove'></form>");
|
||||
|
||||
|
||||
$sql = "SELECT * FROM ".db_prefix("nastywords")." WHERE type='good'";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
$words = explode(" ",$row['words']);
|
||||
if ($op=="addgood"){
|
||||
|
||||
$newregexp = stripslashes(httppost('word'));
|
||||
|
||||
// not sure if the line below should appear, as the strings in the good
|
||||
// word list have different behaviour than those in the nasty word list,
|
||||
// and strings with single quotes in them currently have odd and
|
||||
// unreliable behaviour, both under the good word list and the nasty
|
||||
// word list
|
||||
// $newregexp = preg_replace('/(?<!\\\\)\'/', '\\\'', $newregexp);
|
||||
|
||||
// $newregexp = str_replace("\n", '', $newregexp);
|
||||
// appears to only remove the line feed character, chr(10),
|
||||
// but leaves the carriage return character, chr(13), intact
|
||||
$newregexp = str_replace("\n", '', $newregexp);
|
||||
$newregexp = str_replace("\r", '', $newregexp);
|
||||
|
||||
if ( $newregexp !== '' )
|
||||
array_push($words,$newregexp);
|
||||
|
||||
//array_push($words,stripslashes(httppost('word')));
|
||||
}
|
||||
if ($op=="removegood"){
|
||||
|
||||
// false if not found
|
||||
$removekey = array_search(stripslashes(httppost('word')),$words);
|
||||
// $removekey can be 0
|
||||
if ( $removekey !== false ) unset($words[$removekey]);
|
||||
|
||||
//unset($words[array_search(stripslashes(httppost('word')),$words)]);
|
||||
}
|
||||
|
||||
show_word_list($words);
|
||||
if ($op=="addgood" || $op=="removegood"){
|
||||
$sql = "DELETE FROM " . db_prefix("nastywords") . " WHERE type='good'";
|
||||
db_query($sql);
|
||||
$sql = "INSERT INTO " . db_prefix("nastywords") . " (words,type) VALUES ('" . addslashes(join(" ",$words)) . "','good')";
|
||||
db_query($sql);
|
||||
invalidatedatacache("goodwordlist");
|
||||
}
|
||||
|
||||
output_notl("`0`n`n");
|
||||
rawoutput("<font size='+1'>");
|
||||
output("`7`bNasty Words`b`0");
|
||||
rawoutput("</font>");
|
||||
output_notl("`n");
|
||||
|
||||
rawoutput("<form action='badword.php?op=add' method='POST'>");
|
||||
addnav("","badword.php?op=add");
|
||||
output("`7Add a word:`0");
|
||||
rawoutput("<input name='word'><input type='submit' class='button' value='$add'></form>");
|
||||
rawoutput("<form action='badword.php?op=remove' method='POST'>");
|
||||
addnav("","badword.php?op=remove");
|
||||
output("`7Remove a word:`0");
|
||||
rawoutput("<input name='word'><input type='submit' class='button' value='$remove'></form>");
|
||||
|
||||
$sql = "SELECT * FROM " . db_prefix("nastywords") . " WHERE type='nasty'";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
$words = explode(" ",$row['words']);
|
||||
reset($words);
|
||||
|
||||
if ($op=="add"){
|
||||
|
||||
$newregexp = stripslashes(httppost('word'));
|
||||
|
||||
// automagically escapes all unescaped single quote characters
|
||||
$newregexp = preg_replace('/(?<!\\\\)\'/', '\\\'', $newregexp);
|
||||
|
||||
// $newregexp = str_replace("\n", '', $newregexp);
|
||||
// appears to only remove the line feed character, chr(10),
|
||||
// but leaves the carriage return character, chr(13), intact
|
||||
$newregexp = str_replace("\n", '', $newregexp);
|
||||
$newregexp = str_replace("\r", '', $newregexp);
|
||||
|
||||
if ( $newregexp !== '' ) array_push($words,$newregexp);
|
||||
|
||||
//array_push($words,stripslashes(httppost('word')));
|
||||
}
|
||||
if ($op=="remove"){
|
||||
// false if not found
|
||||
$removekey = array_search(stripslashes(httppost('word')),$words);
|
||||
// $removekey can be 0
|
||||
if ( $removekey !== false ) unset($words[$removekey]);
|
||||
|
||||
//unset($words[array_search(stripslashes(httppost('word')),$words)]);
|
||||
}
|
||||
show_word_list($words);
|
||||
output_notl("`0");
|
||||
|
||||
if ($op=="add" || $op=="remove"){
|
||||
$sql = "DELETE FROM " . db_prefix("nastywords") . " WHERE type='nasty'";
|
||||
db_query($sql);
|
||||
$sql = "INSERT INTO " . db_prefix("nastywords") . " (words,type) VALUES ('" . addslashes(join(" ",$words)) . "','nasty')";
|
||||
db_query($sql);
|
||||
invalidatedatacache("nastywordlist");
|
||||
}
|
||||
page_footer();
|
||||
|
||||
function show_word_list($words){
|
||||
sort($words);
|
||||
$lastletter="";
|
||||
while (list($key,$val)=each($words)){
|
||||
if (trim($val)==""){
|
||||
unset($words[$key]);
|
||||
}else{
|
||||
if (substr($val,0,1)!=$lastletter){
|
||||
$lastletter = substr($val,0,1);
|
||||
output_notl("`n`n`^`b%s`b`@`n", strtoupper($lastletter));
|
||||
}
|
||||
output_notl("%s ", $val);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
268
lotgd-web/lotgd/bank.php
Executable file
@ -0,0 +1,268 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/systemmail.php");
|
||||
require_once("lib/sanitize.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/villagenav.php");
|
||||
|
||||
tlschema("bank");
|
||||
|
||||
page_header("Ye Olde Bank");
|
||||
output("`^`c`bYe Olde Bank`b`c");
|
||||
$op = httpget('op');
|
||||
if ($op==""){
|
||||
checkday();
|
||||
output("`6As you approach the pair of impressive carved rock crystal doors, they part to allow you entrance into the bank.");
|
||||
output("You find yourself standing in a room of exquisitely vaulted ceilings of carved stone.");
|
||||
output("Light filters through tall windows in shafts of soft radiance.");
|
||||
output("About you, clerks are bustling back and forth.");
|
||||
output("The sounds of gold being counted can be heard, though the treasure is nowhere to be seen.`n`n");
|
||||
output("You walk up to a counter of jet black marble.`n`n");
|
||||
output("`@Elessa`6, a petite woman in an immaculately tailored business dress, greets you from behind reading spectacles with polished silver frames.`n`n");
|
||||
output("`6\"`5Greetings, my good lady,`6\" you greet her, \"`5Might I inquire as to my balance this fine day?`6\"`n`n");
|
||||
output("`@Elessa`6 blinks for a moment and then smiles, \"`@Hmm, `&%s`@, let's see.....`6\" she mutters as she scans down a page in her ledger.",$session['user']['name']);
|
||||
if ($session['user']['goldinbank']>=0){
|
||||
output("`6\"`@Aah, yes, here we are. You have `^%s gold`@ in our prestigious bank. Is there anything else I can do for you?`6\"",$session['user']['goldinbank']);
|
||||
}else{
|
||||
output("`6\"`@Aah, yes, here we are. You have a `&debt`@ of `^%s gold`@ in our prestigious bank. Is there anything else I can do for you?`6\"",abs($session['user']['goldinbank']));
|
||||
}
|
||||
}elseif($op=="transfer"){
|
||||
output("`6`bTransfer Money`b:`n");
|
||||
if ($session['user']['goldinbank']>=0){
|
||||
output("`@Elessa`6 tells you, \"`@Just so that you are fully aware of our policies, you may only transfer `^%s`@ gold per the recipient's level.",getsetting("transferperlevel",25));
|
||||
$maxout = $session['user']['level']*getsetting("maxtransferout",25);
|
||||
output("Similarly, you may transfer no more than `^%s`@ gold total during the day.`6\"`n",$maxout);
|
||||
if ($session['user']['amountouttoday'] > 0) {
|
||||
output("`6She scans her ledgers briefly, \"`@For your knowledge, you have already transferred `^%s`@ gold today.`6\"`n",$session['user']['amountouttoday']);
|
||||
}
|
||||
output_notl("`n");
|
||||
$preview = translate_inline("Preview Transfer");
|
||||
rawoutput("<form action='bank.php?op=transfer2' method='POST'>");
|
||||
output("Transfer how much: ");
|
||||
rawoutput("<input name='amount' id='amount' width='5'>");
|
||||
output_notl("`n");
|
||||
output("To: ");
|
||||
rawoutput("<input name='to'>");
|
||||
output(" (partial names are ok, you will be asked to confirm the transaction before it occurs).`n");
|
||||
rawoutput("<input type='submit' class='button' value='$preview'></form>");
|
||||
rawoutput("<script language='javascript'>document.getElementById('amount').focus();</script>");
|
||||
addnav("","bank.php?op=transfer2");
|
||||
}else{
|
||||
output("`@Elessa`6 tells you that she refuses to transfer money for someone who is in debt.");
|
||||
}
|
||||
}elseif($op=="transfer2"){
|
||||
output("`6`bConfirm Transfer`b:`n");
|
||||
$string="%";
|
||||
$to = httppost('to');
|
||||
for ($x=0;$x<strlen($to);$x++){
|
||||
$string .= substr($to,$x,1)."%";
|
||||
}
|
||||
$sql = "SELECT name,login FROM " . db_prefix("accounts") . " WHERE name LIKE '".addslashes($string)."' AND locked=0 ORDER by login='$to' DESC, name='$to' DESC, login";
|
||||
$result = db_query($sql);
|
||||
$amt = abs((int)httppost('amount'));
|
||||
if (db_num_rows($result)==1){
|
||||
$row = db_fetch_assoc($result);
|
||||
$msg = translate_inline("Complete Transfer");
|
||||
rawoutput("<form action='bank.php?op=transfer3' method='POST'>");
|
||||
output("`6Transfer `^%s`6 to `&%s`6.",$amt,$row['name']);
|
||||
rawoutput("<input type='hidden' name='to' value='".HTMLEntities($row['login'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."'><input type='hidden' name='amount' value='$amt'><input type='submit' class='button' value='$msg'></form>",true);
|
||||
addnav("","bank.php?op=transfer3");
|
||||
}elseif(db_num_rows($result)>100){
|
||||
output("`@Elessa`6 looks at you disdainfully and coldly, but politely, suggests you try narrowing down the field of who you want to send money to just a little bit!`n`n");
|
||||
$msg = translate_inline("Preview Transfer");
|
||||
rawoutput("<form action='bank.php?op=transfer2' method='POST'>");
|
||||
output("Transfer how much: ");
|
||||
rawoutput("<input name='amount' id='amount' width='5' value='$amt'><br>");
|
||||
output("To: ");
|
||||
rawoutput("<input name='to' value='$to'>");
|
||||
output(" (partial names are ok, you will be asked to confirm the transaction before it occurs).`n");
|
||||
rawoutput("<input type='submit' class='button' value='$msg'></form>");
|
||||
rawoutput("<script language='javascript'>document.getElementById('amount').focus();</script>",true);
|
||||
addnav("","bank.php?op=transfer2");
|
||||
}elseif(db_num_rows($result)>1){
|
||||
rawoutput("<form action='bank.php?op=transfer3' method='POST'>");
|
||||
output("`6Transfer `^%s`6 to ",$amt);
|
||||
rawoutput("<select name='to' class='input'>");
|
||||
$number=db_num_rows($result);
|
||||
for ($i=0;$i<$number;$i++){
|
||||
$row = db_fetch_assoc($result);
|
||||
rawoutput("<option value=\"".HTMLEntities($row['login'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">".full_sanitize($row['name'])."</option>");
|
||||
}
|
||||
$msg = translate_inline("Complete Transfer");
|
||||
rawoutput("</select><input type='hidden' name='amount' value='$amt'><input type='submit' class='button' value='$msg'></form>",true);
|
||||
addnav("","bank.php?op=transfer3");
|
||||
}else{
|
||||
output("`@Elessa`6 blinks at you from behind her spectacles, \"`@I'm sorry, but I can find no one matching that name who does business with our bank! Please try again.`6\"");
|
||||
}
|
||||
}elseif($op=="transfer3"){
|
||||
$amt = abs((int)httppost('amount'));
|
||||
$to = httppost('to');
|
||||
output("`6`bTransfer Completion`b`n");
|
||||
if ($session['user']['gold']+$session['user']['goldinbank']<$amt){
|
||||
output("`@Elessa`6 stands up to her full, but still diminutive height and glares at you, \"`@How can you transfer `^%s`@ gold when you only possess `^%s`@?`6\"",$amt,$session['user']['gold']+$session['user']['goldinbank']);
|
||||
}else{
|
||||
$sql = "SELECT name,acctid,level,transferredtoday FROM " . db_prefix("accounts") . " WHERE login='$to'";
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)==1){
|
||||
$row = db_fetch_assoc($result);
|
||||
$maxout = $session['user']['level']*getsetting("maxtransferout",25);
|
||||
$maxtfer = $row['level']*getsetting("transferperlevel",25);
|
||||
if ($session['user']['amountouttoday']+$amt > $maxout) {
|
||||
output("`@Elessa`6 shakes her head, \"`@I'm sorry, but I cannot complete that transfer; you are not allowed to transfer more than `^%s`@ gold total per day.`6\"",$maxout);
|
||||
}else if ($maxtfer<$amt){
|
||||
output("`@Elessa`6 shakes her head, \"`@I'm sorry, but I cannot complete that transfer; `&%s`@ may only receive up to `^%s`@ gold per day.`6\"",$row['name'],$maxtfer);
|
||||
}else if($row['transferredtoday']>=getsetting("transferreceive",3)){
|
||||
output("`@Elessa`6 shakes her head, \"`@I'm sorry, but I cannot complete that transfer; `&%s`@ has received too many transfers today, you will have to wait until tomorrow.`6\"",$row['name']);
|
||||
}else if($amt<(int)$session['user']['level']){
|
||||
output("`@Elessa`6 shakes her head, \"`@I'm sorry, but I cannot complete that transfer; you might want to send a worthwhile transfer, at least as much as your level.`6\"");
|
||||
}else if($row['acctid']==$session['user']['acctid']){
|
||||
output("`@Elessa`6 glares at you, her eyes flashing dangerously, \"`@You may not transfer money to yourself! That makes no sense!`6\"");
|
||||
}else{
|
||||
debuglog("transferred $amt gold to", $row['acctid']);
|
||||
$session['user']['gold']-=$amt;
|
||||
if ($session['user']['gold']<0){
|
||||
//withdraw in case they don't have enough on hand.
|
||||
$session['user']['goldinbank']+=$session['user']['gold'];
|
||||
$session['user']['gold']=0;
|
||||
}
|
||||
$session['user']['amountouttoday']+= $amt;
|
||||
$sql = "UPDATE ". db_prefix("accounts") . " SET goldinbank=goldinbank+$amt,transferredtoday=transferredtoday+1 WHERE acctid='{$row['acctid']}'";
|
||||
db_query($sql);
|
||||
output("`@Elessa`6 smiles, \"`@The transfer has been completed!`6\"");
|
||||
$subj = array("`^You have received a money transfer!`0");
|
||||
$body = array("`&%s`6 has transferred `^%s`6 gold to your bank account!",$session['user']['name'],$amt);
|
||||
systemmail($row['acctid'],$subj,$body);
|
||||
}
|
||||
}else{
|
||||
output("`@Elessa`6 looks up from her ledger with a bit of surprise on her face, \"`@I'm terribly sorry, but I seem to have run into an accounting error, would you please try telling me what you wish to transfer again?`6\"");
|
||||
}
|
||||
}
|
||||
}elseif($op=="deposit"){
|
||||
output("`0");
|
||||
rawoutput("<form action='bank.php?op=depositfinish' method='POST'>");
|
||||
$balance = translate_inline("`@Elessa`6 says, \"`@You have a balance of `^%s`@ gold in the bank.`6\"`n");
|
||||
$debt = translate_inline("`@Elessa`6 says, \"`@You have a `\$debt`@ of `^%s`@ gold to the bank.`6\"`n");
|
||||
output_notl($session['user']['goldinbank']>=0?$balance:$debt,abs($session['user']['goldinbank']));
|
||||
output("`6Searching through all your pockets and pouches, you calculate that you currently have `^%s`6 gold on hand.`n`n", $session['user']['gold']);
|
||||
$dep = translate_inline("`^Deposit how much?");
|
||||
$pay = translate_inline("`^Pay off how much?");
|
||||
output_notl($session['user']['goldinbank']>=0?$dep:$pay);
|
||||
$dep = translate_inline("Deposit");
|
||||
rawoutput(" <input id='input' name='amount' width=5 > <input type='submit' class='button' value='$dep'>");
|
||||
output("`n`iEnter 0 or nothing to deposit it all`i");
|
||||
rawoutput("</form>");
|
||||
rawoutput("<script language='javascript'>document.getElementById('input').focus();</script>",true);
|
||||
addnav("","bank.php?op=depositfinish");
|
||||
}elseif($op=="depositfinish"){
|
||||
$amount = abs((int)httppost('amount'));
|
||||
if ($amount==0){
|
||||
$amount=$session['user']['gold'];
|
||||
}
|
||||
$notenough = translate_inline("`\$ERROR: Not enough gold in hand to deposit.`n`n`^You plunk your `&%s`^ gold on the counter and declare that you would like to deposit all `&%s`^ gold of it.`n`n`@Elessa`6 stares blandly at you for a few seconds until you become self conscious and recount your money, realizing your mistake.");
|
||||
$depositdebt = translate_inline("`@Elessa`6 records your deposit of `^%s `6gold in her ledger. \"`@Thank you, `&%s`@. You now have a debt of `\$%s`@ gold to the bank and `^%s`@ gold in hand.`6\"");
|
||||
$depositbalance= translate_inline("`@Elessa`6 records your deposit of `^%s `6gold in her ledger. \"`@Thank you, `&%s`@. You now have a balance of `^%s`@ gold in the bank and `^%s`@ gold in hand.`6\"");
|
||||
if ($amount>$session['user']['gold']){
|
||||
output_notl($notenough,$session['user']['gold'],$amount);
|
||||
}else{
|
||||
debuglog("deposited " . $amount . " gold in the bank");
|
||||
$session['user']['goldinbank']+=$amount;
|
||||
$session['user']['gold']-=$amount;
|
||||
output_notl($session['user']['goldinbank']>=0?$depositbalance:$depositdebt,$amount,$session['user']['name'], abs($session['user']['goldinbank']),$session['user']['gold']);
|
||||
}
|
||||
}elseif($op=="borrow"){
|
||||
$maxborrow = $session['user']['level']*getsetting("borrowperlevel",20);
|
||||
$borrow = translate_inline("Borrow");
|
||||
$balance = translate_inline("`@Elessa`6 scans through her ledger, \"`@You have a balance of `^%s`@ gold in the bank.`6\"`n");
|
||||
$debt = translate_inline("`@Elessa`6 scans through her ledger, \"`@You have a `\$debt`@ of `^%s`@ gold to the bank.`6\"`n");
|
||||
rawoutput("<form action='bank.php?op=withdrawfinish' method='POST'>");
|
||||
output_notl($session['user']['goldinbank']>=0?$balance:$debt,abs($session['user']['goldinbank']));
|
||||
output("`6\"`@How much would you like to borrow `&%s`@? At your level, you may borrow up to a total of `^%s`@ from the bank.`6\"`n`n",$session['user']['name'], $maxborrow);
|
||||
rawoutput(" <input id='input' name='amount' width=5 > <input type='hidden' name='borrow' value='x'><input type='submit' class='button' value='$borrow'>");
|
||||
output("`n(Money will be withdrawn until you have none left, the remainder will be borrowed)");
|
||||
rawoutput("</form>");
|
||||
rawoutput("<script language='javascript'>document.getElementById('input').focus();</script>");
|
||||
addnav("","bank.php?op=withdrawfinish");
|
||||
}elseif($op=="withdraw"){
|
||||
$withdraw = translate_inline("Withdraw");
|
||||
$balance = translate_inline("`@Elessa`6 scans through her ledger, \"`@You have a balance of `^%s`@ gold in the bank.`6\"`n");
|
||||
$debt = translate_inline("`@Elessa`6 scans through her ledger, \"`@You have a `\$debt`@ of `^%s`@ gold in the bank.`6\"`n");
|
||||
rawoutput("<form action='bank.php?op=withdrawfinish' method='POST'>");
|
||||
output_notl($session['user']['goldinbank']>=0?$balance:$debt,abs($session['user']['goldinbank']));
|
||||
output("`6\"`@How much would you like to withdraw `&%s`@?`6\"`n`n",$session['user']['name']);
|
||||
rawoutput("<input id='input' name='amount' width=5 > <input type='submit' class='button' value='$withdraw'>");
|
||||
output("`n`iEnter 0 or nothing to withdraw it all`i");
|
||||
rawoutput("</form>");
|
||||
rawoutput("<script language='javascript'>document.getElementById('input').focus();</script>");
|
||||
addnav("","bank.php?op=withdrawfinish");
|
||||
}elseif($op=="withdrawfinish"){
|
||||
$amount=abs((int)httppost('amount'));
|
||||
if ($amount==0){
|
||||
$amount=abs($session['user']['goldinbank']);
|
||||
}
|
||||
if ($amount>$session['user']['goldinbank'] && httppost('borrow')=="") {
|
||||
output("`\$ERROR: Not enough gold in the bank to withdraw.`^`n`n");
|
||||
output("`6Having been informed that you have `^%s`6 gold in your account, you declare that you would like to withdraw all `^%s`6 of it.`n`n", $session['user']['goldinbank'], $amount);
|
||||
output("`@Elessa`6 looks at you for a few moments without blinking, then advises you to take basic arithmetic. You realize your folly and think you should try again.");
|
||||
}else if($amount>$session['user']['goldinbank']){
|
||||
$lefttoborrow = $amount;
|
||||
$didwithdraw = 0;
|
||||
$maxborrow = $session['user']['level']*getsetting("borrowperlevel",20);
|
||||
if ($lefttoborrow<=$session['user']['goldinbank']+$maxborrow){
|
||||
if ($session['user']['goldinbank']>0){
|
||||
output("`6You withdraw your remaining `^%s`6 gold.", $session['user']['goldinbank']);
|
||||
$lefttoborrow-=$session['user']['goldinbank'];
|
||||
$session['user']['gold']+=$session['user']['goldinbank'];
|
||||
$session['user']['goldinbank']=0;
|
||||
debuglog("withdrew $amount gold from the bank");
|
||||
$didwithdraw = 1;
|
||||
}
|
||||
if ($lefttoborrow-$session['user']['goldinbank'] > $maxborrow){
|
||||
if ($didwithdraw) {
|
||||
output("`6Additionally, you ask to borrow `^%s`6 gold.", $leftoborrow);
|
||||
} else {
|
||||
output("`6You ask to borrow `^%s`6 gold.", $lefttoborrow);
|
||||
}
|
||||
output("`@Elessa`6 looks up your account and informs you that you may only borrow up to `^%s`6 gold.", $maxborrow);
|
||||
}else{
|
||||
if ($didwithdraw) {
|
||||
output("`6Additionally, you borrow `^%s`6 gold.", $lefttoborrow);
|
||||
} else {
|
||||
output("`6You borrow `^%s`6 gold.", $lefttoborrow);
|
||||
}
|
||||
$session['user']['goldinbank']-=$lefttoborrow;
|
||||
$session['user']['gold']+=$lefttoborrow;
|
||||
debuglog("borrows $lefttoborrow gold from the bank");
|
||||
output("`@Elessa`6 records your withdrawal of `^%s `6gold in her ledger. \"`@Thank you, `&%s`@. You now have a debt of `\$%s`@ gold to the bank and `^%s`@ gold in hand.`6\"", $amount,$session['user']['name'], abs($session['user']['goldinbank']),$session['user']['gold']);
|
||||
}
|
||||
}else{
|
||||
output("`6Considering the `^%s`6 gold in your account, you ask to borrow `^%s`6. `@Elessa`6 peers through her ledger, runs a few calculations and then informs you that, at your level, you may only borrow up to a total of `^%s`6 gold.", $session['user']['goldinbank'], $lefttoborrow-$session['user']['goldinbank'], $maxborrow);
|
||||
}
|
||||
}else{
|
||||
$session['user']['goldinbank']-=$amount;
|
||||
$session['user']['gold']+=$amount;
|
||||
debuglog("withdrew $amount gold from the bank");
|
||||
output("`@Elessa`6 records your withdrawal of `^%s `6gold in her ledger. \"`@Thank you, `&%s`@. You now have a balance of `^%s`@ gold in the bank and `^%s`@ gold in hand.`6\"", $amount,$session['user']['name'], abs($session['user']['goldinbank']),$session['user']['gold']);
|
||||
}
|
||||
}
|
||||
villagenav();
|
||||
addnav("Money");
|
||||
if ($session['user']['goldinbank']>=0){
|
||||
addnav("W?Withdraw","bank.php?op=withdraw");
|
||||
addnav("D?Deposit","bank.php?op=deposit");
|
||||
if (getsetting("borrowperlevel",20)) addnav("L?Take out a Loan","bank.php?op=borrow");
|
||||
}else{
|
||||
addnav("D?Pay off Debt","bank.php?op=deposit");
|
||||
if (getsetting("borrowperlevel",20)) addnav("L?Borrow More","bank.php?op=borrow");
|
||||
}
|
||||
if (getsetting("allowgoldtransfer",1)){
|
||||
if ($session['user']['level']>=getsetting("mintransferlev",3) || $session['user']['dragonkills']>0){
|
||||
addnav("M?Transfer Money","bank.php?op=transfer");
|
||||
}
|
||||
}
|
||||
|
||||
page_footer();
|
||||
|
||||
?>
|
630
lotgd-web/lotgd/battle.php
Executable file
@ -0,0 +1,630 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
require_once("lib/bell_rand.php");
|
||||
require_once("common.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/battle-buffs.php");
|
||||
require_once("lib/battle-skills.php");
|
||||
require_once("lib/buffs.php");
|
||||
require_once("lib/extended-battle.php");
|
||||
|
||||
//just in case we're called from within a function.Yuck is this ugly.
|
||||
global $badguy,$enemies,$newenemies,$session,$creatureattack,$creatureatkmod, $beta;
|
||||
global $creaturedefmod,$adjustment,$defmod,$atkmod,$compdefmod,$compatkmod,$buffset,$atk,$def,$options;
|
||||
global $companions,$companion,$newcompanions,$count,$defended,$needtostopfighting,$roll;
|
||||
|
||||
tlschema("battle");
|
||||
|
||||
$newcompanions = array();
|
||||
$attackstack = @unserialize($session['user']['badguy']);
|
||||
if (isset($attackstack['enemies'])) $enemies = $attackstack['enemies'];
|
||||
if (isset($attackstack['options'])) $options = $attackstack['options'];
|
||||
|
||||
// Make the new battle script compatible with old, single enemy fights.
|
||||
if (isset($attackstack['creaturename']) && $attackstack['creaturename'] > "") {
|
||||
$safe = $attackstack;
|
||||
$enemies = array();
|
||||
$enemies[0]=$safe;
|
||||
unset($safe);
|
||||
} elseif (isset($attackstack[0]['creaturename']) && $attackstack['creaturename'] > "") {
|
||||
$enemies=$attackstack;
|
||||
}
|
||||
if (!isset($options)) {
|
||||
if (isset($enemies[0]['type'])) $options['type'] = $enemies[0]['type'];
|
||||
}
|
||||
|
||||
$options = prepare_fight($options);
|
||||
|
||||
$roundcounter=0;
|
||||
$adjustment = 1;
|
||||
|
||||
$count = 1;
|
||||
$auto = httpget('auto');
|
||||
if ($auto == 'full') {
|
||||
$count = -1;
|
||||
} else if ($auto == 'five') {
|
||||
$count = 5;
|
||||
} else if ($auto == 'ten') {
|
||||
$count = 10;
|
||||
}
|
||||
|
||||
$enemycounter = count($enemies);
|
||||
$enemies = autosettarget($enemies);
|
||||
|
||||
$op=httpget("op");
|
||||
$skill=httpget("skill");
|
||||
$l=httpget("l");
|
||||
$newtarget = httpget('newtarget');
|
||||
if ($newtarget != "") $op = "newtarget";
|
||||
//if (!$targetted) $op = "newtarget";
|
||||
|
||||
if ($op=="fight"){
|
||||
apply_skill($skill,$l);
|
||||
} else if ($op=="newtarget") {
|
||||
foreach ($enemies as $index=>$badguy){
|
||||
if ($index == (int)$newtarget) {
|
||||
if (!isset($badguy['cannotbetarget']) || $badguy['cannotbetarget'] === false) {
|
||||
$enemies[$index]['istarget'] = 1;
|
||||
}else{
|
||||
if (is_array($badguy['cannotbetarget'])) {
|
||||
$msg = sprintf_translate($badguy['cannotbetarget']);
|
||||
$msg = substitute($msg);
|
||||
output_notl($msg); //Here it's already translated
|
||||
}else{
|
||||
if ($badguy['cannotbetarget'] === true) {
|
||||
$msg = "{badguy} cannot be selected as target.";
|
||||
} else {
|
||||
$msg = $badguy['cannotbetarget'];
|
||||
}
|
||||
$msg = substitute_array("`5".$msg."`0`n");
|
||||
output($msg);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$enemies[$index]['istarget'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$victory = false;
|
||||
$defeat = false;
|
||||
|
||||
if ($enemycounter > 0) {
|
||||
output ("`\$`c`b~ ~ ~ Fight ~ ~ ~`b`c`0");
|
||||
modulehook("battle", $enemies);
|
||||
foreach ($enemies as $index=>$badguy) {
|
||||
if ($badguy['creaturehealth']>0 && $session['user']['hitpoints']>0) {
|
||||
output("`@You have encountered `^%s`@ which lunges at you with `%%s`@!`0`n",$badguy['creaturename'],$badguy['creatureweapon']);
|
||||
}
|
||||
}
|
||||
output_notl("`n");
|
||||
show_enemies($enemies);
|
||||
}
|
||||
|
||||
suspend_buffs((($options['type'] == 'pvp')?"allowinpvp":false));
|
||||
suspend_companions((($options['type'] == 'pvp')?"allowinpvp":false));
|
||||
|
||||
// Now that the bufflist is sane, see if we should add in the bodyguard.
|
||||
$inn = (int)httpget('inn');
|
||||
if ($options['type']=='pvp' && $inn==1) {
|
||||
apply_bodyguard($badguy['bodyguardlevel']);
|
||||
}
|
||||
|
||||
$surprised = false;
|
||||
if ($op != "run" && $op != "fight" && $op != "newtarget") {
|
||||
if (count($enemies) > 1) {
|
||||
$surprised = true;
|
||||
output("`b`^YOUR ENEMIES`\$ surprise you and get the first round of attack!`0`b`n`n");
|
||||
} else {
|
||||
// Let's try this instead.Biggest change is that it adds possibility of
|
||||
// being surprised to all fights.
|
||||
if (!array_key_exists('didsurprise',$options) || !$options['didsurprise']) {
|
||||
// By default, surprise is 50/50
|
||||
$surprised = e_rand(0, 1) ? true : false;
|
||||
// Now, adjust for slum/thrill
|
||||
$type = httpget('type');
|
||||
if ($type == 'slum' || $type == 'thrill') {
|
||||
$num = e_rand(0, 2);
|
||||
$surprised = true;
|
||||
if ($type == 'slum' && $num != 2)
|
||||
$surprised = false;
|
||||
if (($type == 'thrill' || $type=='suicide') && $num == 2)
|
||||
$surprised = false;
|
||||
}
|
||||
if (!$surprised) {
|
||||
output("`b`\$Your skill allows you to get the first attack!`0`b`n`n");
|
||||
} else {
|
||||
if ($options['type'] == 'pvp') {
|
||||
output("`b`^%s`\$'s skill allows them to get the first round of attack!`0`b`n`n",$badguy['creaturename']);
|
||||
}else{
|
||||
output("`b`^%s`\$ surprises you and gets the first round of attack!`0`b`n`n",$badguy['creaturename']);
|
||||
}
|
||||
$op = "run";
|
||||
}
|
||||
$options['didsurprise']=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$needtostopfighting = false;
|
||||
if ($op != "newtarget") {
|
||||
// Run through as many rounds as needed.
|
||||
do {
|
||||
//we need to restore and calculate here to reflect changes that happen throughout the course of multiple rounds.
|
||||
restore_buff_fields();
|
||||
calculate_buff_fields();
|
||||
prepare_companions();
|
||||
$newenemies = array();
|
||||
// Run the beginning of round buffs (this also calculates all modifiers)
|
||||
foreach ($enemies as $index=>$badguy) {
|
||||
if ($badguy['dead'] == false && $badguy['creaturehealth'] > 0) {
|
||||
if (isset($badguy['alwaysattacks']) && $badguy['alwaysattacks'] == true) {
|
||||
} else {
|
||||
$roundcounter++;
|
||||
}
|
||||
if (($roundcounter > $options['maxattacks']) && $badguy['istarget'] == false) {
|
||||
$newcompanions = $companions;
|
||||
} else {
|
||||
$buffset = activate_buffs("roundstart");
|
||||
if ($badguy['creaturehealth']<=0 || $session['user']['hitpoints']<=0){
|
||||
$creaturedmg = 0;
|
||||
$selfdmg = 0;
|
||||
if ($badguy['creaturehealth'] <= 0) {
|
||||
$badguy['dead'] = true;
|
||||
$badguy['istarget'] = false;
|
||||
$count = 1;
|
||||
$needtostopfighting = true;
|
||||
}
|
||||
if ($session['user']['hitpoints'] <= 0) {
|
||||
$count = 1;
|
||||
$needtostopfighting = true;
|
||||
}
|
||||
$newenemies[$index] = $badguy;
|
||||
$newcompanions = $companions;
|
||||
// No break here. It would break the foreach statement.
|
||||
} else {
|
||||
$creaturedefmod=$buffset['badguydefmod'];
|
||||
$creatureatkmod=$buffset['badguyatkmod'];
|
||||
$atkmod=$buffset['atkmod'];
|
||||
$defmod=$buffset['defmod'];
|
||||
$compatkmod=$buffset['compatkmod'];
|
||||
$compdefmod=$buffset['compdefmod'];
|
||||
if ($badguy['creaturehealth']>0 && $session['user']['hitpoints']>0 && $badguy['istarget']){
|
||||
if (is_array($companions)) {
|
||||
$newcompanions = array();
|
||||
foreach ($companions as $name=>$companion) {
|
||||
if ($companion['hitpoints'] > 0) {
|
||||
$buffer = report_companion_move($companion, "heal");
|
||||
if ($buffer !== false) {
|
||||
$newcompanions[$name] = $buffer;
|
||||
unset($buffer);
|
||||
} else {
|
||||
unset($companion);
|
||||
unset($newcompanions[$name]);
|
||||
}
|
||||
} else {
|
||||
$newcompanions[$name] = $companion;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$newcompanions = $companions;
|
||||
}
|
||||
$companions = $newcompanions;
|
||||
|
||||
if ($op=="fight" || $op=="run" || $surprised){
|
||||
// Grab an initial roll.
|
||||
$roll = rolldamage();
|
||||
if ($op=="fight" && !$surprised){
|
||||
$ggchancetodouble = $session['user']['dragonkills'];
|
||||
$bgchancetodouble = $session['user']['dragonkills'];
|
||||
|
||||
if ($badguy['creaturehealth']>0 && $session['user']['hitpoints']>0) {
|
||||
$buffset = activate_buffs("offense");
|
||||
if ($badguy['creaturehealth']>0 && $session['user']['hitpoints']>0 && $badguy['istarget']){
|
||||
if (is_array($companions)) {
|
||||
$newcompanions = array();
|
||||
foreach ($companions as $name=>$companion) {
|
||||
if ($companion['hitpoints'] > 0) {
|
||||
$buffer = report_companion_move($companion, "magic");
|
||||
if ($buffer !== false) {
|
||||
$newcompanions[$name] = $buffer;
|
||||
unset($buffer);
|
||||
} else {
|
||||
unset($companion);
|
||||
unset($newcompanions[$name]);
|
||||
}
|
||||
} else {
|
||||
$newcompanions[$name] = $companion;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$newcompanions = $companions;
|
||||
}
|
||||
$companions = $newcompanions;
|
||||
if ($badguy['creaturehealth']<=0 || $session['user']['hitpoints']<=0){
|
||||
$creaturedmg = 0;
|
||||
$selfdmg = 0;
|
||||
if ($badguy['creaturehealth'] <= 0) {
|
||||
$badguy['dead'] = true;
|
||||
$badguy['istarget'] = false;
|
||||
$count = 1;
|
||||
$needtostopfighting=true;
|
||||
}
|
||||
$newenemies[$index] = $badguy;
|
||||
$newcompanions = $companions;
|
||||
// No break here. It would break the foreach statement.
|
||||
} else if ($badguy['istarget'] == true) {
|
||||
do {
|
||||
if ($badguy['creaturehealth']<=0 || $session['user']['hitpoints']<=0){
|
||||
$creaturedmg = 0;
|
||||
$selfdmg = 0;
|
||||
$newenemies[$index] = $badguy;
|
||||
$newcompanions = $companions;
|
||||
$needtostopfighting = true;
|
||||
}else{
|
||||
$needtostopfighting = battle_player_attacks();
|
||||
}
|
||||
$r = mt_rand(0,100);
|
||||
if ($r < $ggchancetodouble && $badguy['creaturehealth']>0 && $session['user']['hitpoints']>0 && !$needtostopfighting){
|
||||
$additionalattack = true;
|
||||
$ggchancetodouble -= ($r+5);
|
||||
$roll = rolldamage();
|
||||
}else{
|
||||
$additionalattack = false;
|
||||
}
|
||||
} while($additionalattack && !$needtostopfighting);
|
||||
if ($needtostopfighting) {
|
||||
$newcompanions = $companions;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}else if($op=="run" && !$surprised){
|
||||
output("`4You are too busy trying to run away like a cowardly dog to try to fight `^%s`4.`n",$badguy['creaturename']);
|
||||
}
|
||||
|
||||
//Need to insert this here because of auto-fighting!
|
||||
if ($op != "newtarget") $op = "fight";
|
||||
|
||||
// We need to check both user health and creature health. Otherwise
|
||||
// the user can win a battle by a RIPOSTE after he has gone <= 0 HP.
|
||||
//-- Gunnar Kreitz
|
||||
if ($badguy['creaturehealth']>0 && $session['user']['hitpoints']>0 && $roundcounter <= $options['maxattacks']){
|
||||
$buffset = activate_buffs("defense");
|
||||
do {
|
||||
$defended = false;
|
||||
$needtostopfighting = battle_badguy_attacks();
|
||||
$r = mt_rand(0,100);
|
||||
if (!isset($bgchancetodouble)) $bgchancetodouble = 0;
|
||||
if ($r < $bgchancetodouble && $badguy['creaturehealth']>0 && $session['user']['hitpoints']>0 && !$needtostopfighting){
|
||||
$additionalattack = true;
|
||||
$bgchancetodouble -= ($r+5);
|
||||
$roll = rolldamage();
|
||||
}else{
|
||||
$additionalattack = false;
|
||||
}
|
||||
} while ($additionalattack && !$defended);
|
||||
}
|
||||
$companions = $newcompanions;
|
||||
if ($badguy['creaturehealth']>0 && $session['user']['hitpoints']>0 && $badguy['istarget']){
|
||||
if (is_array($companions)) {
|
||||
foreach ($companions as $name=>$companion) {
|
||||
if ($companion['hitpoints'] > 0) {
|
||||
$buffer = report_companion_move($companion, "fight");
|
||||
if ($buffer !== false) {
|
||||
$newcompanions[$name] = $buffer;
|
||||
unset($buffer);
|
||||
} else {
|
||||
unset($companion);
|
||||
unset($newcompanions[$name]);
|
||||
}
|
||||
} else {
|
||||
$newcompanions[$name] = $companion;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$newcompanions = $companions;
|
||||
}
|
||||
} else {
|
||||
$newcompanions = $companions;
|
||||
}
|
||||
if($badguy['dead'] == false && isset($badguy['creatureaiscript']) && $badguy['creatureaiscript'] > "") {
|
||||
global $unsetme;
|
||||
execute_ai_script($badguy['creatureaiscript']);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$newcompanions = $companions;
|
||||
}
|
||||
// Copy the companions back so in the next round (multiple rounds) they can be used again.
|
||||
// We will also delete the now old set of companions. Just in case.
|
||||
$companions = $newcompanions;
|
||||
unset($newcompanions);
|
||||
|
||||
// If any A.I. script wants the current enemy to be deleted completely, we will obey.
|
||||
// For multiple rounds/multiple A.I. scripts we will although unset this order.
|
||||
|
||||
if (isset($unsetme) && $unsetme === true) {
|
||||
$unsetme = false;
|
||||
unset($unsetme);
|
||||
} else {
|
||||
$newenemies[$index] = $badguy;
|
||||
}
|
||||
}
|
||||
expire_buffs();
|
||||
$creaturedmg=0;
|
||||
$selfdmg=0;
|
||||
|
||||
if (($count != 1 || ($needtostopfighting && $count > 1)) && $session['user']['hitpoints'] > 0 && count($enemies) > 0) {
|
||||
output("`2`bNext round:`b`n");
|
||||
}
|
||||
|
||||
if (count($newenemies) > 0) {
|
||||
$verynewenemies = array();
|
||||
$alive = 0;
|
||||
$fleeable = 0;
|
||||
$leaderisdead = false;
|
||||
foreach ($newenemies as $index => $badguy) {
|
||||
if ($badguy['dead'] == true || $badguy['creaturehealth'] <= 0){
|
||||
if (isset($badguy['essentialleader']) && $badguy['essentialleader'] == true) {
|
||||
$defeat = false;
|
||||
$victory = true;
|
||||
$needtostopfighting = true;
|
||||
$leaderisdead = true;
|
||||
}
|
||||
$badguy['istarget'] = false;
|
||||
// We'll either add the experience right away or store it in a seperate array.
|
||||
// If through any script enemies are added during the fight, the amount of
|
||||
// experience would stay the same
|
||||
// We'll also check if the user is actually alive. If we didn't, we would hand out
|
||||
// experience for graveyard fights.
|
||||
if (getsetting("instantexp",false) == true && $session['user']['alive'] && $options['type'] != "pvp" && $options['type'] != "train") {
|
||||
if (!isset($badguy['expgained']) || $badguy['expgained'] == false) {
|
||||
if (!isset($badguy['creatureexp'])) $badguy['creatureexp'] = 0;
|
||||
$session['user']['experience'] += round($badguy['creatureexp']/count($newenemies));
|
||||
output("`#You receive `^%s`# experience!`n`0",round($badguy['creatureexp']/count($newenemies)));
|
||||
$options['experience'][$index] = $badguy['creatureexp'];
|
||||
$options['experiencegained'][$index] = round($badguy['creatureexp']/count($newenemies));
|
||||
$badguy['expgained']=true;
|
||||
}
|
||||
} else {
|
||||
$options['experience'][$index] = $badguy['creatureexp'];
|
||||
}
|
||||
}else{
|
||||
$alive++;
|
||||
if (isset($badguy['fleesifalone']) && $badguy['fleesifalone'] == true) $fleeable++;
|
||||
if ($session['user']['hitpoints']<=0){
|
||||
$defeat=true;
|
||||
$victory=false;
|
||||
break;
|
||||
}else if(!$leaderisdead) {
|
||||
$defeat=false;
|
||||
$victory=false;
|
||||
}
|
||||
}
|
||||
$verynewenemies[$index] = $badguy;
|
||||
}
|
||||
$enemiesflown = false;
|
||||
if ($alive == $fleeable && $session['user']['hitpoints'] > 0) {
|
||||
$defeat=false;
|
||||
$victory=true;
|
||||
$enemiesflown=true;
|
||||
$needtostopfighting=true;
|
||||
}
|
||||
if (getsetting("instantexp",false) == true) {
|
||||
$newenemies = $verynewenemies;
|
||||
}
|
||||
}
|
||||
if ($alive == 0) {
|
||||
$defeat=false;
|
||||
$victory=true;
|
||||
$needtostopfighting=true;
|
||||
}
|
||||
if ($count != -1) $count--;
|
||||
if ($needtostopfighting) $count = 0;
|
||||
if ($enemiesflown) {
|
||||
foreach ($newenemies as $index => $badguy) {
|
||||
if (isset($badguy['fleesifalone']) && $badguy['fleesifalone'] == true) {
|
||||
if (is_array($badguy['fleesifalone'])) {
|
||||
$msg = sprintf_translate($badguy['fleesifalone']);
|
||||
$msg = substitute($msg);
|
||||
output_notl($msg); //Here it's already translated
|
||||
}else{
|
||||
if ($badguy['fleesifalone'] === true) {
|
||||
$msg = "{badguy} flees in panic.";
|
||||
} else {
|
||||
$msg = $badguy['fleesifalone'];
|
||||
}
|
||||
$msg = substitute_array("`5".$msg."`0`n");
|
||||
output($msg);
|
||||
}
|
||||
} else {
|
||||
$newenemies[$index]=$badguy;
|
||||
}
|
||||
}
|
||||
} else if ($leaderisdead) {
|
||||
if (is_array($badguy['essentialleader'])) {
|
||||
$msg = sprintf_translate($badguy['essentialleader']);
|
||||
$msg = substitute($msg);
|
||||
output_notl($msg); //Here it's already translated
|
||||
}else{
|
||||
if ($badguy['essentialleader'] === true) {
|
||||
$msg = "All other other enemies flee in panic as `^{badguy}`5 falls to the ground.";
|
||||
} else {
|
||||
$msg = $badguy['essentialleader'];
|
||||
}
|
||||
$msg = substitute_array("`5".$msg."`0`n");
|
||||
output($msg);
|
||||
}
|
||||
}
|
||||
if (is_array($newenemies)) {
|
||||
$enemies = $newenemies;
|
||||
}
|
||||
$roundcounter = 0;
|
||||
} while ($count > 0 || $count == -1);
|
||||
$newenemies = $enemies;
|
||||
} else {
|
||||
$newenemies = $enemies;
|
||||
}
|
||||
|
||||
$newenemies = autosettarget($newenemies);
|
||||
|
||||
if ($session['user']['hitpoints']>0 && count($newenemies)>0 && ($op=="fight" || $op=="run")){
|
||||
output("`2`bEnd of Round:`b`n");
|
||||
show_enemies($newenemies);
|
||||
}
|
||||
|
||||
if ($session['user']['hitpoints'] < 0) $session['user']['hitpoints'] = 0;
|
||||
|
||||
if ($victory || $defeat){
|
||||
// expire any buffs which cannot persist across fights and
|
||||
// unsuspend any suspended buffs
|
||||
unsuspend_buffs((($options['type']=='pvp')?"allowinpvp":false));
|
||||
if ($session['user']['alive']) {
|
||||
unsuspend_companions((($options['type']=='pvp')?"allowinpvp":false));
|
||||
}
|
||||
foreach($companions as $index => $companion) {
|
||||
if(isset($companion['expireafterfight']) && $companion['expireafterfight']) {
|
||||
unset($companions[$index]);
|
||||
}
|
||||
}
|
||||
if (is_array($newenemies)) {
|
||||
foreach ($newenemies as $index => $badguy) {
|
||||
global $output;
|
||||
$badguy['fightoutput'] = $output;
|
||||
// legacy support. Will be removed in one of the following versions!
|
||||
// Please update all modules, that use the following hook to use the
|
||||
// $options array instead of the $args array for their code.
|
||||
$badguy['type'] = $options['type'];
|
||||
|
||||
if ($victory) $badguy = modulehook("battle-victory",$badguy);
|
||||
if ($defeat) $badguy = modulehook("battle-defeat",$badguy);
|
||||
unset($badguy['fightoutput']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$attackstack = array('enemies'=>$newenemies, 'options'=>$options);
|
||||
$session['user']['badguy']=createstring($attackstack);
|
||||
$session['user']['companions']=createstring($companions);
|
||||
tlschema();
|
||||
|
||||
function battle_player_attacks() {
|
||||
global $badguy,$enemies,$newenemies,$session,$creatureattack,$creatureatkmod, $beta;
|
||||
global $creaturedefmod,$adjustment,$defmod,$atkmod,$compatkmod,$compdefmod,$buffset,$atk,$def,$options;
|
||||
global $companions,$companion,$newcompanions,$roll,$count,$needtostopfighting;
|
||||
|
||||
$break = false;
|
||||
$creaturedmg = $roll['creaturedmg'];
|
||||
if ($options['type'] != "pvp") {
|
||||
$creaturedmg = report_power_move($atk, $creaturedmg);
|
||||
}
|
||||
if ($creaturedmg==0){
|
||||
output("`4You try to hit `^%s`4 but `\$MISS!`n",$badguy['creaturename']);
|
||||
process_dmgshield($buffset['dmgshield'], 0);
|
||||
process_lifetaps($buffset['lifetap'], 0);
|
||||
}else if ($creaturedmg<0){
|
||||
output("`4You try to hit `^%s`4 but are `\$RIPOSTED `4for `\$%s`4 points of damage!`n",$badguy['creaturename'],(0-$creaturedmg));
|
||||
$badguy['diddamage']=1;
|
||||
$session['user']['hitpoints']+=$creaturedmg;
|
||||
if ($session['user']['hitpoints'] <= 0) {
|
||||
$badguy['killedplayer'] = true;
|
||||
$count = 1;
|
||||
$break = true;
|
||||
$needtostopfighting = true;
|
||||
}
|
||||
process_dmgshield($buffset['dmgshield'],-$creaturedmg);
|
||||
process_lifetaps($buffset['lifetap'],$creaturedmg);
|
||||
}else{
|
||||
output("`4You hit `^%s`4 for `^%s`4 points of damage!`n",$badguy['creaturename'],$creaturedmg);
|
||||
$badguy['creaturehealth']-=$creaturedmg;
|
||||
process_dmgshield($buffset['dmgshield'],-$creaturedmg);
|
||||
process_lifetaps($buffset['lifetap'],$creaturedmg);
|
||||
}
|
||||
if ($badguy['creaturehealth'] <= 0) {
|
||||
$badguy['dead'] = true;
|
||||
$badguy['istarget'] = false;
|
||||
$count = 1;
|
||||
$break = true;
|
||||
}
|
||||
return $break;
|
||||
}
|
||||
|
||||
function battle_badguy_attacks() {
|
||||
global $badguy,$enemies,$newenemies,$session,$creatureattack,$creatureatkmod, $beta;
|
||||
global $creaturedefmod,$adjustment,$defmod,$atkmod,$compatkmod,$compdefmod,$buffset,$atk,$def,$options;
|
||||
global $companions,$companion,$newcompanions,$roll,$count,$index,$defended,$needtostopfighting;
|
||||
|
||||
$break = false;
|
||||
$selfdmg = $roll['selfdmg'];
|
||||
if ($badguy['creaturehealth']<=0 && $session['user']['hitpoints']<=0){
|
||||
$creaturedmg = 0;
|
||||
$selfdmg = 0;
|
||||
if ($badguy['creaturehealth'] <= 0) {
|
||||
$badguy['dead'] = true;
|
||||
$badguy['istarget'] = false;
|
||||
$count = 1;
|
||||
$needtostopfighting = true;
|
||||
$break = true;
|
||||
}
|
||||
$newenemies[$index] = $badguy;
|
||||
$newcompanions = $companions;
|
||||
$break = true;
|
||||
}else{
|
||||
if ($badguy['creaturehealth']>0 && $session['user']['hitpoints']>0 && $badguy['istarget']){
|
||||
if (is_array($companions)) {
|
||||
foreach ($companions as $name=>$companion) {
|
||||
if ($companion['hitpoints'] > 0) {
|
||||
$buffer = report_companion_move($companion, "defend");
|
||||
if ($buffer !== false) {
|
||||
$newcompanions[$name] = $buffer;
|
||||
unset($buffer);
|
||||
} else {
|
||||
unset($companion);
|
||||
unset($newcompanions[$name]);
|
||||
}
|
||||
} else {
|
||||
$newcompanions[$name] = $companion;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$newcompanions = $companions;
|
||||
}
|
||||
$companions = $newcompanions;
|
||||
if ($defended == false) {
|
||||
if ($selfdmg==0){
|
||||
output("`^%s`4 tries to hit you but `^MISSES!`n",$badguy['creaturename']);
|
||||
process_dmgshield($buffset['dmgshield'], 0);
|
||||
process_lifetaps($buffset['lifetap'], 0);
|
||||
}else if ($selfdmg<0){
|
||||
output("`^%s`4 tries to hit you but you `^RIPOSTE`4 for `^%s`4 points of damage!`n",$badguy['creaturename'],(0-$selfdmg));
|
||||
$badguy['creaturehealth']+=$selfdmg;
|
||||
process_lifetaps($buffset['lifetap'], -$selfdmg);
|
||||
process_dmgshield($buffset['dmgshield'], $selfdmg);
|
||||
}else{
|
||||
output("`^%s`4 hits you for `\$%s`4 points of damage!`n",$badguy['creaturename'],$selfdmg);
|
||||
$session['user']['hitpoints']-=$selfdmg;
|
||||
if ($session['user']['hitpoints'] <= 0) {
|
||||
$badguy['killedplayer'] = true;
|
||||
$count = 1;
|
||||
}
|
||||
process_dmgshield($buffset['dmgshield'], $selfdmg);
|
||||
process_lifetaps($buffset['lifetap'], -$selfdmg);
|
||||
$badguy['diddamage']=1;
|
||||
}
|
||||
}
|
||||
if ($badguy['creaturehealth'] <= 0) {
|
||||
$badguy['dead'] = true;
|
||||
$badguy['istarget'] = false;
|
||||
$count = 1;
|
||||
$break = true;
|
||||
}
|
||||
}
|
||||
return $break;
|
||||
}
|
||||
?>
|
184
lotgd-web/lotgd/bio.php
Executable file
@ -0,0 +1,184 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/sanitize.php");
|
||||
|
||||
tlschema("bio");
|
||||
|
||||
checkday();
|
||||
|
||||
$ret = httpget('ret');
|
||||
if ($ret==""){
|
||||
$return = "/list.php";
|
||||
}else{
|
||||
$return = cmd_sanitize($ret);
|
||||
}
|
||||
|
||||
$char = httpget('char');
|
||||
//Legacy support
|
||||
if (is_numeric($char)){
|
||||
$where = "acctid = $char";
|
||||
} else {
|
||||
$where = "login = '$char'";
|
||||
}
|
||||
$sql = "SELECT login, name, level, sex, title, specialty, hashorse, acctid, resurrections, bio, dragonkills, race, clanname, clanshort, clanrank, ".db_prefix("accounts").".clanid, laston, loggedin FROM " . db_prefix("accounts") . " LEFT JOIN " . db_prefix("clans") . " ON " . db_prefix("accounts") . ".clanid = " . db_prefix("clans") . ".clanid WHERE $where";
|
||||
$result = db_query($sql);
|
||||
if ($target = db_fetch_assoc($result)) {
|
||||
$target['login'] = rawurlencode($target['login']);
|
||||
$id = $target['acctid'];
|
||||
$target['return_link']=$return;
|
||||
|
||||
page_header("Character Biography: %s", full_sanitize($target['name']));
|
||||
|
||||
tlschema("nav");
|
||||
addnav("Return");
|
||||
tlschema();
|
||||
|
||||
if ($session['user']['superuser'] & SU_EDIT_USERS){
|
||||
addnav("Superuser");
|
||||
addnav("Edit User","user.php?op=edit&userid=$id");
|
||||
}
|
||||
|
||||
modulehook("biotop", $target);
|
||||
|
||||
output("`^Biography for %s`^.",$target['name']);
|
||||
$write = translate_inline("Write Mail");
|
||||
if ($session['user']['loggedin'])
|
||||
rawoutput("<a href=\"mail.php?op=write&to={$target['login']}\" target=\"_blank\" onClick=\"".popup("mail.php?op=write&to={$target['login']}").";return false;\"><img src='images/newscroll.GIF' width='16' height='16' alt='$write' border='0'></a>");
|
||||
output_notl("`n`n");
|
||||
|
||||
if ($target['clanname']>"" && getsetting("allowclans",false)){
|
||||
$ranks = array(CLAN_APPLICANT=>"`!Applicant`0",CLAN_MEMBER=>"`#Member`0",CLAN_OFFICER=>"`^Officer`0",CLAN_LEADER=>"`&Leader`0", CLAN_FOUNDER=>"`\$Founder");
|
||||
$ranks = modulehook("clanranks", array("ranks"=>$ranks, "clanid"=>$target['clanid']));
|
||||
tlschema("clans"); //just to be in the right schema
|
||||
array_push($ranks['ranks'],"`\$Founder");
|
||||
$ranks = translate_inline($ranks['ranks']);
|
||||
tlschema();
|
||||
output("`@%s`2 is a %s`2 to `%%s`2`n", $target['name'], $ranks[$target['clanrank']], $target['clanname']);
|
||||
}
|
||||
|
||||
output("`^Title: `@%s`n",$target['title']);
|
||||
output("`^Level: `@%s`n",$target['level']);
|
||||
$loggedin = false;
|
||||
if ($target['loggedin'] &&
|
||||
(date("U") - strtotime($target['laston']) <
|
||||
getsetting("LOGINTIMEOUT", 900))) {
|
||||
$loggedin = true;
|
||||
}
|
||||
$status = translate_inline($loggedin?"`#Online`0":"`\$Offline`0");
|
||||
output("`^Status: %s`n",$status);
|
||||
|
||||
output("`^Resurrections: `@%s`n",$target['resurrections']);
|
||||
|
||||
$race = $target['race'];
|
||||
if (!$race) $race = RACE_UNKNOWN;
|
||||
tlschema("race");
|
||||
$race = translate_inline($race);
|
||||
tlschema();
|
||||
output("`^Race: `@%s`n",$race);
|
||||
|
||||
$genders = array("Male","Female");
|
||||
$genders = translate_inline($genders);
|
||||
output("`^Gender: `@%s`n",$genders[$target['sex']]);
|
||||
|
||||
$specialties = modulehook("specialtynames",
|
||||
array(""=>translate_inline("Unspecified")));
|
||||
if (isset($specialties[$target['specialty']])) {
|
||||
output("`^Specialty: `@%s`n",$specialties[$target['specialty']]);
|
||||
}
|
||||
$sql = "SELECT * FROM " . db_prefix("mounts") . " WHERE mountid='{$target['hashorse']}'";
|
||||
$result = db_query_cached($sql, "mountdata-{$target['hashorse']}", 3600);
|
||||
$mount = db_fetch_assoc($result);
|
||||
|
||||
$mount['acctid']=$target['acctid'];
|
||||
$mount = modulehook("bio-mount",$mount);
|
||||
$none = translate_inline("`iNone`i");
|
||||
if (!isset($mount['mountname']) || $mount['mountname']=="")
|
||||
$mount['mountname'] = $none;
|
||||
output("`^Creature: `@%s`0`n",$mount['mountname']);
|
||||
|
||||
modulehook("biostat", $target);
|
||||
|
||||
if ($target['dragonkills']>0)
|
||||
output("`^Dragon Kills: `@%s`n",$target['dragonkills']);
|
||||
|
||||
if ($target['bio']>"")
|
||||
output("`^Bio: `@`n%s`n",soap($target['bio']));
|
||||
|
||||
modulehook("bioinfo", $target);
|
||||
|
||||
output("`n`^Recent accomplishments (and defeats) of %s`^",$target['name']);
|
||||
$result = db_query("SELECT * FROM " . db_prefix("news") . " WHERE accountid={$target['acctid']} ORDER BY newsdate DESC,newsid ASC LIMIT 100");
|
||||
|
||||
$odate="";
|
||||
tlschema("news");
|
||||
while ($row = db_fetch_assoc($result)) {
|
||||
tlschema($row['tlschema']);
|
||||
if ($row['arguments'] > "") {
|
||||
$arguments = array();
|
||||
$base_arguments = unserialize($row['arguments']);
|
||||
array_push($arguments, $row['newstext']);
|
||||
while(list($key, $val) = each($base_arguments)) {
|
||||
array_push($arguments, $val);
|
||||
}
|
||||
$news = call_user_func_array("sprintf_translate", $arguments);
|
||||
rawoutput(tlbutton_clear());
|
||||
} else {
|
||||
$news = translate_inline($row['newstext']);
|
||||
rawoutput(tlbutton_clear());
|
||||
}
|
||||
tlschema();
|
||||
if ($odate!=$row['newsdate']){
|
||||
output_notl("`n`b`@%s`0`b`n",
|
||||
date("D, M d", strtotime($row['newsdate'])));
|
||||
$odate=$row['newsdate'];
|
||||
}
|
||||
output_notl("`@$news`0`n");
|
||||
}
|
||||
tlschema();
|
||||
|
||||
if ($ret==""){
|
||||
$return = substr($return,strrpos($return,"/")+1);
|
||||
tlschema("nav");
|
||||
addnav("Return");
|
||||
addnav("Return to the warrior list",$return);
|
||||
tlschema();
|
||||
}else{
|
||||
$return = substr($return,strrpos($return,"/")+1);
|
||||
tlschema("nav");
|
||||
addnav("Return");
|
||||
if ($return=="list.php") {
|
||||
addnav("Return to the warrior list",$return);
|
||||
} else {
|
||||
addnav("Return whence you came",$return);
|
||||
}
|
||||
tlschema();
|
||||
}
|
||||
|
||||
modulehook("bioend", $target);
|
||||
page_footer();
|
||||
} else {
|
||||
page_header("Character has been deleted");
|
||||
output("This character is already deleted.");
|
||||
if ($ret==""){
|
||||
$return = substr($return,strrpos($return,"/")+1);
|
||||
tlschema("nav");
|
||||
addnav("Return");
|
||||
addnav("Return to the warrior list",$return);
|
||||
tlschema();
|
||||
}else{
|
||||
$return = substr($return,strrpos($return,"/")+1);
|
||||
tlschema("nav");
|
||||
addnav("Return");
|
||||
if ($return=="list.php") {
|
||||
addnav("Return to the warrior list",$return);
|
||||
} else {
|
||||
addnav("Return whence you came",$return);
|
||||
}
|
||||
tlschema();
|
||||
}
|
||||
page_footer();
|
||||
}
|
||||
?>
|
66
lotgd-web/lotgd/bios.php
Executable file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/systemmail.php");
|
||||
require_once("lib/http.php");
|
||||
|
||||
tlschema("bio");
|
||||
check_su_access(SU_EDIT_COMMENTS);
|
||||
|
||||
$op = httpget('op');
|
||||
$userid = httpget('userid');
|
||||
if ($op=="block"){
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET bio='`iBlocked for inappropriate usage`i',biotime='9999-12-31 23:59:59' WHERE acctid='$userid'";
|
||||
$subj = array("Your bio has been blocked");
|
||||
$msg = array("The system administrators have decided that your bio entry is inappropriate, so it has been blocked.`n`nIf you wish to appeal this decision, you may do so with the petition link.");
|
||||
systemmail($userid, $subj, $msg);
|
||||
db_query($sql);
|
||||
}
|
||||
if ($op=="unblock"){
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET bio='',biotime='0000-00-00 00:00:00' WHERE acctid='$userid'";
|
||||
$subj = array("Your bio has been unblocked");
|
||||
$msg = array("The system administrators have decided to unblock your bio. You can once again enter a bio entry.");
|
||||
systemmail($userid,$subj,$msg);
|
||||
db_query($sql);
|
||||
}
|
||||
$sql = "SELECT name,acctid,bio,biotime FROM " . db_prefix("accounts") . " WHERE biotime<'9999-12-31' AND bio>'' ORDER BY biotime DESC LIMIT 100";
|
||||
$result = db_query($sql);
|
||||
page_header("User Bios");
|
||||
$block = translate_inline("Block");
|
||||
output("`b`&Player Bios:`0`b`n");
|
||||
$number=db_num_rows($result);
|
||||
for ($i=0;$i<$number;$i++){
|
||||
$row = db_fetch_assoc($result);
|
||||
if ($row['biotime']>$session['user']['recentcomments'])
|
||||
rawoutput("<img src='images/new.gif' alt='>' width='3' height='5' align='absmiddle'> ");
|
||||
output_notl("`![<a href='bios.php?op=block&userid={$row['acctid']}'>$block</a>]",true);
|
||||
addnav("","bios.php?op=block&userid={$row['acctid']}");
|
||||
output_notl("`&%s`0: `^%s`0`n", $row['name'], soap($row['bio']));
|
||||
}
|
||||
db_free_result($result);
|
||||
require_once("lib/superusernav.php");
|
||||
superusernav();
|
||||
|
||||
addnav("Moderation");
|
||||
|
||||
if ($session['user']['superuser'] & SU_EDIT_COMMENTS)
|
||||
addnav("Return to Comment Moderation","moderate.php");
|
||||
|
||||
addnav("Refresh","bios.php");
|
||||
$sql = "SELECT name,acctid,bio,biotime FROM " . db_prefix("accounts") . " WHERE biotime>'9000-01-01' AND bio>'' ORDER BY biotime DESC LIMIT 100";
|
||||
$result = db_query($sql);
|
||||
output("`n`n`b`&Blocked Bios:`0`b`n");
|
||||
$unblock = translate_inline("Unblock");
|
||||
$number=db_num_rows($result);
|
||||
for ($i=0;$i<$number;$i++){
|
||||
$row = db_fetch_assoc($result);
|
||||
|
||||
output_notl("`![<a href='bios.php?op=unblock&userid={$row['acctid']}'>$unblock</a>]",true);
|
||||
addnav("","bios.php?op=unblock&userid={$row['acctid']}");
|
||||
output_notl("`&%s`0: `^%s`0`n", $row['name'], soap($row['bio']));
|
||||
}
|
||||
db_free_result($result);
|
||||
page_footer();
|
||||
?>
|
61
lotgd-web/lotgd/clan.php
Executable file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/nltoappon.php");
|
||||
require_once("lib/commentary.php");
|
||||
require_once("lib/systemmail.php");
|
||||
require_once("lib/sanitize.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/villagenav.php");
|
||||
|
||||
tlschema("clans");
|
||||
|
||||
|
||||
addnav("Village");
|
||||
villagenav();
|
||||
addnav("Clan Options");
|
||||
addnav("C?List Clans","clan.php?op=list");
|
||||
addcommentary();
|
||||
$gold = getsetting("goldtostartclan",10000);
|
||||
$gems = getsetting("gemstostartclan",15);
|
||||
$ranks = array(CLAN_APPLICANT=>"`!Applicant`0",CLAN_MEMBER=>"`#Member`0",CLAN_OFFICER=>"`^Officer`0",CLAN_LEADER=>"`&Leader`0", CLAN_FOUNDER=>"`\$Founder");
|
||||
$args = modulehook("clanranks", array("ranks"=>$ranks, "clanid"=>$session['user']['clanid']));
|
||||
$ranks = translate_inline($args['ranks']);
|
||||
|
||||
$apply_short = "`@Clan App: `&%s`0";
|
||||
$apply_subj = array($apply_short, $session['user']['name']);
|
||||
|
||||
$op = httpget('op');
|
||||
|
||||
$detail = httpget('detail');
|
||||
if ($detail>0){
|
||||
require_once("lib/clan/detail.php");
|
||||
}elseif ($op=="list"){
|
||||
require_once("lib/clan/list.php");
|
||||
} elseif ($op == "waiting") {
|
||||
require_once("lib/clan/waiting.php");
|
||||
}elseif ($session['user']['clanrank']==CLAN_APPLICANT){
|
||||
require_once("lib/clan/applicant.php");
|
||||
}else{
|
||||
require_once("lib/clan/clan_start.php");
|
||||
}
|
||||
|
||||
|
||||
page_footer();
|
||||
|
||||
function clanform(){
|
||||
rawoutput("<form action='clan.php?op=new&apply=1' method='POST'>");
|
||||
addnav("","clan.php?op=new&apply=1");
|
||||
output("`b`cNew Clan Application Form`c`b");
|
||||
output("Clan Name: ");
|
||||
rawoutput("<input name='clanname' maxlength='50' value=\"".htmlentities(stripslashes(httppost('clanname')), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
|
||||
output("`nShort Name: ");
|
||||
rawoutput("<input name='clanshort' maxlength='5' size='5' value=\"".htmlentities(stripslashes(httppost('clanshort')), ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
|
||||
output("`nNote, color codes are permitted in neither clan names nor short names.");
|
||||
output("The clan name is shown on player bios and on clan overview pages while the short name is displayed next to players' names in comment areas and such.`n");
|
||||
$apply = translate_inline("Apply");
|
||||
rawoutput("<input type='submit' class='button' value='$apply'></form>");
|
||||
}
|
||||
?>
|
380
lotgd-web/lotgd/common.php
Executable file
359
lotgd-web/lotgd/companions.php
Executable file
@ -0,0 +1,359 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// mail ready
|
||||
// translator ready
|
||||
|
||||
// hilarious copy of mounts.php
|
||||
require_once("common.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/showform.php");
|
||||
|
||||
check_su_access(SU_EDIT_MOUNTS);
|
||||
|
||||
tlschema("companions");
|
||||
|
||||
page_header("Companion Editor");
|
||||
|
||||
require_once("lib/superusernav.php");
|
||||
superusernav();
|
||||
|
||||
addnav("Companion Editor");
|
||||
addnav("Add a companion","companions.php?op=add");
|
||||
|
||||
$op = httpget('op');
|
||||
$id = httpget('id');
|
||||
if ($op=="deactivate"){
|
||||
$sql = "UPDATE " . db_prefix("companions") . " SET companionactive=0 WHERE companionid='$id'";
|
||||
db_query($sql);
|
||||
$op="";
|
||||
httpset("op", "");
|
||||
invalidatedatacache("companionsdata-$id");
|
||||
} elseif ($op=="activate"){
|
||||
$sql = "UPDATE " . db_prefix("companions") . " SET companionactive=1 WHERE companionid='$id'";
|
||||
db_query($sql);
|
||||
$op="";
|
||||
httpset("op", "");
|
||||
invalidatedatacache("companiondata-$id");
|
||||
} elseif ($op=="del") {
|
||||
//drop the companion.
|
||||
$sql = "DELETE FROM " . db_prefix("companions") . " WHERE companionid='$id'";
|
||||
db_query($sql);
|
||||
module_delete_objprefs('companions', $id);
|
||||
$op = "";
|
||||
httpset("op", "");
|
||||
invalidatedatacache("companiondata-$id");
|
||||
} elseif ($op=="take"){
|
||||
$sql = "SELECT * FROM " . db_prefix("companions") . " WHERE companionid='$id'";
|
||||
$result = db_query($sql);
|
||||
if ($row = db_fetch_assoc($result)) {
|
||||
$row['attack'] = $row['attack'] + $row['attackperlevel'] * $session['user']['level'];
|
||||
$row['defense'] = $row['defense'] + $row['defenseperlevel'] * $session['user']['level'];
|
||||
$row['maxhitpoints'] = $row['maxhitpoints'] + $row['maxhitpointsperlevel'] * $session['user']['level'];
|
||||
$row['hitpoints'] = $row['maxhitpoints'];
|
||||
$row = modulehook("alter-companion", $row);
|
||||
$row['abilities'] = @unserialize($row['abilities']);
|
||||
require_once("lib/buffs.php");
|
||||
apply_companion($row['name'], $row);
|
||||
output("`\$Succesfully taken `^%s`\$ as companion.", $row['name']);
|
||||
}
|
||||
$op = "";
|
||||
httpset("op", "");
|
||||
} elseif ($op=="save"){
|
||||
$subop = httpget("subop");
|
||||
if ($subop == "") {
|
||||
$companion = httppost('companion');
|
||||
if ($companion) {
|
||||
if (!isset($companion['allowinshades'])) {
|
||||
$companion['allowinshades'] = 0;
|
||||
}
|
||||
if (!isset($companion['allowinpvp'])) {
|
||||
$companion['allowinpvp'] = 0;
|
||||
}
|
||||
if (!isset($companion['allowintrain'])) {
|
||||
$companion['allowintrain'] = 0;
|
||||
}
|
||||
if (!isset($companion['abilities']['fight'])) {
|
||||
$companion['abilities']['fight'] = false;
|
||||
}
|
||||
if (!isset($companion['abilities']['defend'])) {
|
||||
$companion['abilities']['defend'] = false;
|
||||
}
|
||||
if (!isset($companion['cannotdie'])) {
|
||||
$companion['cannotdie'] = false;
|
||||
}
|
||||
if (!isset($companion['cannotbehealed'])) {
|
||||
$companion['cannotbehealed'] = false;
|
||||
}
|
||||
$sql = "";
|
||||
$keys = "";
|
||||
$vals = "";
|
||||
$i = 0;
|
||||
while(list($key, $val) = each($companion)) {
|
||||
if (is_array($val)) $val = addslashes(serialize($val));
|
||||
$sql .= (($i > 0) ? ", " : "") . "$key='$val'";
|
||||
$keys .= (($i > 0) ? ", " : "") . "$key";
|
||||
$vals .= (($i > 0) ? ", " : "") . "'$val'";
|
||||
$i++;
|
||||
}
|
||||
if ($id>""){
|
||||
$sql="UPDATE " . db_prefix("companions") .
|
||||
" SET $sql WHERE companionid='$id'";
|
||||
}else{
|
||||
$sql="INSERT INTO " . db_prefix("companions") .
|
||||
" ($keys) VALUES ($vals)";
|
||||
}
|
||||
db_query($sql);
|
||||
invalidatedatacache("companiondata-$id");
|
||||
if (db_affected_rows()>0){
|
||||
output("`^Companion saved!`0`n`n");
|
||||
}else{
|
||||
// if (strlen($sql) > 400) $sql = substr($sql,0,200)." ... ".substr($sql,strlen($sql)-200);
|
||||
output("`^Companion `\$not`^ saved: `\$%s`0`n`n", $sql);
|
||||
}
|
||||
}
|
||||
} elseif ($subop=="module") {
|
||||
// Save modules settings
|
||||
$module = httpget("module");
|
||||
$post = httpallpost();
|
||||
reset($post);
|
||||
while(list($key, $val) = each($post)) {
|
||||
set_module_objpref("companions", $id, $key, $val, $module);
|
||||
}
|
||||
output("`^Saved!`0`n");
|
||||
}
|
||||
if ($id) {
|
||||
$op="edit";
|
||||
} else {
|
||||
$op = "";
|
||||
}
|
||||
httpset("op", $op);
|
||||
}
|
||||
|
||||
if ($op==""){
|
||||
$sql = "SELECT * FROM " . db_prefix("companions") . " ORDER BY category, name";
|
||||
$result = db_query($sql);
|
||||
|
||||
$ops = translate_inline("Ops");
|
||||
$name = translate_inline("Name");
|
||||
$cost = translate_inline("Cost");
|
||||
|
||||
$edit = translate_inline("Edit");
|
||||
$del = translate_inline("Del");
|
||||
$take = translate_inline("Take");
|
||||
$deac = translate_inline("Deactivate");
|
||||
$act = translate_inline("Activate");
|
||||
|
||||
rawoutput("<table border=0 cellpadding=2 cellspacing=1 bgcolor='#999999'>");
|
||||
rawoutput("<tr class='trhead'><td nowrap>$ops</td><td>$name</td><td>$cost</td></tr>");
|
||||
$cat = "";
|
||||
$count=0;
|
||||
|
||||
while ($row=db_fetch_assoc($result)) {
|
||||
if ($cat!=$row['category']){
|
||||
rawoutput("<tr class='trlight'><td colspan='5'>");
|
||||
output("Category: %s", $row['category']);
|
||||
rawoutput("</td></tr>");
|
||||
$cat = $row['category'];
|
||||
$count=0;
|
||||
}
|
||||
if (isset($companions[$row['companionid']])) {
|
||||
$companions[$row['companionid']] = (int)$companions[$row['companionid']];
|
||||
} else {
|
||||
$companions[$row['companionid']] = 0;
|
||||
}
|
||||
rawoutput("<tr class='".($count%2?"trlight":"trdark")."'>");
|
||||
rawoutput("<td nowrap>[ <a href='companions.php?op=edit&id={$row['companionid']}'>$edit</a> |");
|
||||
addnav("","companions.php?op=edit&id={$row['companionid']}");
|
||||
if ($row['companionactive']){
|
||||
rawoutput("$del |");
|
||||
}else{
|
||||
$mconf = sprintf($conf, $companions[$row['companionid']]);
|
||||
rawoutput("<a href='companions.php?op=del&id={$row['companionid']}'>$del</a> |");
|
||||
addnav("","companions.php?op=del&id={$row['companionid']}");
|
||||
}
|
||||
if ($row['companionactive']) {
|
||||
rawoutput("<a href='companions.php?op=deactivate&id={$row['companionid']}'>$deac</a> | ");
|
||||
addnav("","companions.php?op=deactivate&id={$row['companionid']}");
|
||||
}else{
|
||||
rawoutput("<a href='companions.php?op=activate&id={$row['companionid']}'>$act</a> | ");
|
||||
addnav("","companions.php?op=activate&id={$row['companionid']}");
|
||||
}
|
||||
rawoutput("<a href='companions.php?op=take&id={$row['companionid']}'>$take</a> ]</td>");
|
||||
addnav("", "companions.php?op=take&id={$row['companionid']}");
|
||||
rawoutput("<td>");
|
||||
output_notl("`&%s`0", $row['name']);
|
||||
rawoutput("</td><td>");
|
||||
output("`%%s gems`0, `^%s gold`0",$row['companioncostgems'], $row['companioncostgold']);
|
||||
rawoutput("</td></tr>");
|
||||
$count++;
|
||||
}
|
||||
rawoutput("</table>");
|
||||
output("`nIf you wish to delete a companion, you have to deactivate it first.");
|
||||
}elseif ($op=="add"){
|
||||
output("Add a companion:`n");
|
||||
addnav("Companion Editor Home","companions.php");
|
||||
companionform(array());
|
||||
}elseif ($op=="edit"){
|
||||
addnav("Companion Editor Home","companions.php");
|
||||
$sql = "SELECT * FROM " . db_prefix("companions") . " WHERE companionid='$id'";
|
||||
$result = db_query_cached($sql, "companiondata-$id", 3600);
|
||||
if (db_num_rows($result)<=0){
|
||||
output("`iThis companion was not found.`i");
|
||||
}else{
|
||||
addnav("Companion properties", "companions.php?op=edit&id=$id");
|
||||
module_editor_navs("prefs-companions", "companions.php?op=edit&subop=module&id=$id&module=");
|
||||
$subop=httpget("subop");
|
||||
if ($subop=="module") {
|
||||
$module = httpget("module");
|
||||
rawoutput("<form action='companions.php?op=save&subop=module&id=$id&module=$module' method='POST'>");
|
||||
module_objpref_edit("companions", $module, $id);
|
||||
rawoutput("</form>");
|
||||
addnav("", "companions.php?op=save&subop=module&id=$id&module=$module");
|
||||
} else {
|
||||
output("Companion Editor:`n");
|
||||
$row = db_fetch_assoc($result);
|
||||
$row['abilities'] = @unserialize($row['abilities']);
|
||||
companionform($row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function companionform($companion){
|
||||
// Let's sanitize the data
|
||||
if (!isset($companion['companionactive'])) $companion['companionactive'] = "";
|
||||
if (!isset($companion['name'])) $companion['name'] = "";
|
||||
if (!isset($companion['companionid'])) $companion['companionid'] = "";
|
||||
if (!isset($companion['description'])) $companion['description'] = "";
|
||||
if (!isset($companion['dyingtext'])) $companion['dyingtext'] = "";
|
||||
if (!isset($companion['jointext'])) $companion['jointext'] = "";
|
||||
if (!isset($companion['category'])) $companion['category'] = "";
|
||||
if (!isset($companion['companionlocation'])) $companion['companionlocation'] = 'all';
|
||||
if (!isset($companion['companioncostdks'])) $companion['companioncostdks'] = 0;
|
||||
|
||||
if (!isset($companion['companioncostgems'])) $companion['companioncostgems'] = 0;
|
||||
if (!isset($companion['companioncostgold'])) $companion['companioncostgold'] = 0;
|
||||
|
||||
if (!isset($companion['attack'])) $companion['attack'] = "";
|
||||
if (!isset($companion['attackperlevel'])) $companion['attackperlevel'] = "";
|
||||
if (!isset($companion['defense'])) $companion['defense'] = "";
|
||||
if (!isset($companion['defenseperlevel'])) $companion['defenseperlevel'] = "";
|
||||
if (!isset($companion['hitpoints'])) $companion['hitpoints'] = "";
|
||||
if (!isset($companion['maxhitpoints'])) $companion['maxhitpoints'] = "";
|
||||
if (!isset($companion['maxhitpointsperlevel'])) $companion['maxhitpointsperlevel'] = "";
|
||||
|
||||
if (!isset($companion['abilities']['fight'])) $companion['abilities']['fight'] = 0;
|
||||
if (!isset($companion['abilities']['defend'])) $companion['abilities']['defend'] = 0;
|
||||
if (!isset($companion['abilities']['heal'])) $companion['abilities']['heal'] = 0;
|
||||
if (!isset($companion['abilities']['magic'])) $companion['abilities']['magic'] = 0;
|
||||
|
||||
if (!isset($companion['cannotdie'])) $companion['cannotdie'] = 0;
|
||||
if (!isset($companion['cannotbehealed'])) $companion['cannotbehealed'] = 1;
|
||||
if (!isset($companion['allowinshades'])) $companion['allowinshades'] = 0;
|
||||
if (!isset($companion['allowinpvp'])) $companion['allowinpvp'] = 0;
|
||||
if (!isset($companion['allowintrain'])) $companion['allowintrain'] = 0;
|
||||
|
||||
rawoutput("<form action='companions.php?op=save&id={$companion['companionid']}' method='POST'>");
|
||||
rawoutput("<input type='hidden' name='companion[companionactive]' value=\"".$companion['companionactive']."\">");
|
||||
addnav("","companions.php?op=save&id={$companion['companionid']}");
|
||||
rawoutput("<table width='100%'>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Companion Name:");
|
||||
rawoutput("</td><td><input name='companion[name]' value=\"".htmlentities($companion['name'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\" maxlength='50'></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Companion Dyingtext:");
|
||||
rawoutput("</td><td><input name='companion[dyingtext]' value=\"".htmlentities($companion['dyingtext'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Companion Description:");
|
||||
rawoutput("</td><td><textarea cols='25' rows='5' name='companion[description]'>".htmlentities($companion['description'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</textarea></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Companion join text:");
|
||||
rawoutput("</td><td><textarea cols='25' rows='5' name='companion[jointext]'>".htmlentities($companion['jointext'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</textarea></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Companion Category:");
|
||||
rawoutput("</td><td><input name='companion[category]' value=\"".htmlentities($companion['category'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\" maxlength='50'></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Companion Availability:");
|
||||
rawoutput("</td><td nowrap>");
|
||||
// Run a modulehook to find out where camps are located. By default
|
||||
// they are located in 'Degolburg' (ie, getgamesetting('villagename'));
|
||||
// Some later module can remove them however.
|
||||
$vname = getsetting('villagename', LOCATION_FIELDS);
|
||||
$locs = array($vname => sprintf_translate("The Village of %s", $vname));
|
||||
$locs = modulehook("camplocs", $locs);
|
||||
$locs['all'] = translate_inline("Everywhere");
|
||||
ksort($locs);
|
||||
reset($locs);
|
||||
rawoutput("<select name='companion[companionlocation]'>");
|
||||
foreach($locs as $loc=>$name) {
|
||||
rawoutput("<option value='$loc'".($companion['companionlocation']==$loc?" selected":"").">$name</option>");
|
||||
}
|
||||
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Maxhitpoints / Bonus per level:");
|
||||
rawoutput("</td><td><input name='companion[maxhitpoints]' value=\"".htmlentities($companion['maxhitpoints'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"> / <input name='companion[maxhitpointsperlevel]' value=\"".htmlentities($companion['maxhitpointsperlevel'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Attack / Bonus per level:");
|
||||
rawoutput("</td><td><input name='companion[attack]' value=\"".htmlentities($companion['attack'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"> / <input name='companion[attackperlevel]' value=\"".htmlentities($companion['attackperlevel'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Defense / Bonus per level:");
|
||||
rawoutput("</td><td><input name='companion[defense]' value=\"".htmlentities($companion['defense'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"> / <input name='companion[defenseperlevel]' value=\"".htmlentities($companion['defenseperlevel'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"></td></tr>");
|
||||
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Fighter?:");
|
||||
rawoutput("</td><td><input id='fighter' type='checkbox' name='companion[abilities][fight]' value='1'".($companion['abilities']['fight']==true?" checked":"")." onClick='document.getElementById(\"defender\").disabled=document.getElementById(\"fighter\").checked; if(document.getElementById(\"defender\").disabled==true) document.getElementById(\"defender\").checked=false;'></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Defender?:");
|
||||
rawoutput("</td><td><input id='defender' type='checkbox' name='companion[abilities][defend]' value='1'".($companion['abilities']['defend']==true?" checked":"")." onClick='document.getElementById(\"fighter\").disabled=document.getElementById(\"defender\").checked; if(document.getElementById(\"fighter\").disabled==true) document.getElementById(\"fighter\").checked=false;'></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Healer level:");
|
||||
rawoutput("</td><td valign='top'><select name='companion[abilities][heal]'>");
|
||||
for($i=0;$i<=30;$i++) {
|
||||
rawoutput("<option value='$i'".($companion['abilities']['heal']==$i?" selected":"").">$i</option>");
|
||||
}
|
||||
rawoutput("</select></td></tr>");
|
||||
rawoutput("<tr><td colspan='2'>");
|
||||
output("`iThis value determines the maximum amount of HP healed per round`i");
|
||||
rawoutput("</td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Magician?:");
|
||||
rawoutput("</td><td valign='top'><select name='companion[abilities][magic]'>");
|
||||
for($i=0;$i<=30;$i++) {
|
||||
rawoutput("<option value='$i'".($companion['abilities']['magic']==$i?" selected":"").">$i</option>");
|
||||
}
|
||||
rawoutput("</select></td></tr>");
|
||||
rawoutput("<tr><td colspan='2'>");
|
||||
output("`iThis value determines the maximum amount of damage caused per round`i");
|
||||
rawoutput("</td></tr>");
|
||||
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Companion cannot die:");
|
||||
rawoutput("</td><td><input type='checkbox' name='companion[cannotdie]' value='1'".($companion['cannotdie']==true?" checked":"")."></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Companion cannot be healed:");
|
||||
rawoutput("</td><td><input type='checkbox' name='companion[cannotbehealed]' value='1'".($companion['cannotbehealed']==true?" checked":"")."></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
|
||||
output("Companion Cost (DKs):");
|
||||
rawoutput("</td><td><input name='companion[companioncostdks]' value=\"".htmlentities((int)$companion['companioncostdks'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Companion Cost (Gems):");
|
||||
rawoutput("</td><td><input name='companion[companioncostgems]' value=\"".htmlentities((int)$companion['companioncostgems'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Companion Cost (Gold):");
|
||||
rawoutput("</td><td><input name='companion[companioncostgold]' value=\"".htmlentities((int)$companion['companioncostgold'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\"></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Allow in shades:");
|
||||
rawoutput("</td><td><input type='checkbox' name='companion[allowinshades]' value='1'".($companion['allowinshades']==true?" checked":"")."></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Allow in PvP:");
|
||||
rawoutput("</td><td><input type='checkbox' name='companion[allowinpvp]' value='1'".($companion['allowinpvp']==true?" checked":"")."></td></tr>");
|
||||
rawoutput("<tr><td nowrap>");
|
||||
output("Allow in train:");
|
||||
rawoutput("</td><td><input type='checkbox' name='companion[allowintrain]' value='1'".($companion['allowintrain']==true?" checked":"")."></td></tr>");
|
||||
rawoutput("</table>");
|
||||
$save = translate_inline("Save");
|
||||
rawoutput("<input type='submit' class='button' value='$save'></form>");
|
||||
}
|
||||
|
||||
page_footer();
|
||||
?>
|
451
lotgd-web/lotgd/configuration.php
Executable file
@ -0,0 +1,451 @@
|
||||
<?php
|
||||
require_once("common.php");
|
||||
require_once("lib/showform.php");
|
||||
require_once("lib/http.php");
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
|
||||
check_su_access(SU_EDIT_CONFIG);
|
||||
|
||||
tlschema("configuration");
|
||||
|
||||
$op = httpget('op');
|
||||
$module=httpget('module');
|
||||
if ($op=="save"){
|
||||
include_once("lib/gamelog.php");
|
||||
//loadsettings();
|
||||
if ((int)httppost('blockdupemail') == 1 &&
|
||||
(int)httppost('requirevalidemail') != 1) {
|
||||
httppostset('requirevalidemail', "1");
|
||||
output("`brequirevalidemail has been set since blockdupemail was set.`b`n");
|
||||
}
|
||||
if ((int)httppost('requirevalidemail') == 1 &&
|
||||
(int)httppost('requireemail') != 1) {
|
||||
httppostset('requireemail', "1");
|
||||
output("`brequireemail has been set since requirevalidemail was set.`b`n");
|
||||
}
|
||||
$defsup = httppost("defaultsuperuser");
|
||||
if ($defsup != "") {
|
||||
$value = 0;
|
||||
while(list($k, $v)=each($defsup)) {
|
||||
if ($v) $value += (int)$k;
|
||||
}
|
||||
httppostset('defaultsuperuser', $value);
|
||||
}
|
||||
$tmp = stripslashes(httppost("villagename"));
|
||||
if ($tmp && $tmp != $settings['villagename']) {
|
||||
debug("Updating village name -- moving players");
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET location='".
|
||||
httppost("villagename") . "' WHERE location='" .
|
||||
addslashes($settings['villagename']) . "'";
|
||||
db_query($sql);
|
||||
if ($session['user']['location'] == $settings['villagename'])
|
||||
$session['user']['location'] =
|
||||
stripslashes(httppost('villagename'));
|
||||
debug("Moving companions");
|
||||
$sql = "UPDATE " . db_prefix("companions") . " SET companionlocation = '".
|
||||
httppost("villagename") . "' WHERE companionlocation = '".
|
||||
addslashes($settings['villagename']) . "'";
|
||||
db_query($sql);
|
||||
}
|
||||
$tmp = stripslashes(httppost("innname"));
|
||||
if ($tmp && $tmp != $settings['innname']) {
|
||||
debug("Updating inn name -- moving players");
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET location='".
|
||||
httppost("innname") . "' WHERE location='" .
|
||||
addslashes($settings['innname']) . "'";
|
||||
db_query($sql);
|
||||
if ($session['user']['location'] == $settings['innname'])
|
||||
$session['user']['location'] = stripslashes(httppost('innname'));
|
||||
}
|
||||
if (stripslashes(httppost("motditems")) != $settings['motditems']) {
|
||||
invalidatedatacache("motd");
|
||||
}
|
||||
$post = httpallpost();
|
||||
reset($post);
|
||||
$old=$settings;
|
||||
while (list($key,$val)=each($post)){
|
||||
if (!isset($settings[$key]) ||
|
||||
(stripslashes($val) != $settings[$key])) {
|
||||
if (!isset($old[$key]))
|
||||
$old[$key] = "";
|
||||
savesetting($key,stripslashes($val));
|
||||
output("Setting %s to %s`n", $key, stripslashes($val));
|
||||
gamelog("`@Changed core setting `^$key`@ from `#{$old[$key]}`@ to `&$val`0","settings");
|
||||
// Notify every module
|
||||
modulehook("changesetting",
|
||||
array("module"=>"core", "setting"=>$key,
|
||||
"old"=>$old[$key], "new"=>$val), true);
|
||||
}
|
||||
}
|
||||
output("`^Settings saved.`0");
|
||||
$op = "";
|
||||
httpset($op, "");
|
||||
}elseif($op=="modulesettings"){
|
||||
include_once("lib/gamelog.php");
|
||||
if (injectmodule($module,true)){
|
||||
$save = httpget('save');
|
||||
if ($save!=""){
|
||||
load_module_settings($module);
|
||||
$old = $module_settings[$module];
|
||||
$post = httpallpost();
|
||||
$post = modulehook("validatesettings", $post, true, $module);
|
||||
if (isset($post['validation_error'])) {
|
||||
$post['validation_error'] =
|
||||
translate_inline($post['validation_error']);
|
||||
output("Unable to change settings:`\$%s`0",
|
||||
$post['validation_error']);
|
||||
} else {
|
||||
reset($post);
|
||||
while (list($key,$val)=each($post)){
|
||||
$key = stripslashes($key);
|
||||
$val = stripslashes($val);
|
||||
set_module_setting($key,$val);
|
||||
if (!isset($old[$key]) || $old[$key] != $val) {
|
||||
output("Setting %s to %s`n", $key, $val);
|
||||
// Notify modules
|
||||
if($key == "villagename") {
|
||||
debug("Moving companions");
|
||||
$sql = "UPDATE " . db_prefix("companions") . " SET companionlocation = '".
|
||||
addslashes($val) . "' WHERE companionlocation = '".
|
||||
addslashes($old[$key]) . "'";
|
||||
db_query($sql);
|
||||
}
|
||||
$oldval = "";
|
||||
if (isset($old[$key])) $oldval = $old[$key];
|
||||
gamelog("`@Changed module(`5$module`@) setting `^$key`@ from `#$oldval`@ to `&$val`0","settings");
|
||||
modulehook("changesetting",
|
||||
array("module"=>$module, "setting"=>$key,
|
||||
"old"=>$oldval, "new"=>$val), true);
|
||||
}
|
||||
}
|
||||
output("`^Module %s settings saved.`0`n", $module);
|
||||
}
|
||||
$save = "";
|
||||
httpset('save', "");
|
||||
}
|
||||
if ($save == "") {
|
||||
$info = get_module_info($module);
|
||||
if (count($info['settings'])>0){
|
||||
load_module_settings($mostrecentmodule);
|
||||
$msettings=array();
|
||||
while (list($key,$val)=each($info['settings'])){
|
||||
if (is_array($val)) {
|
||||
$v = $val[0];
|
||||
$x = explode("|", $v);
|
||||
$val[0] = $x[0];
|
||||
$x[0] = $val;
|
||||
} else {
|
||||
$x = explode("|",$val);
|
||||
}
|
||||
$msettings[$key]=$x[0];
|
||||
if (!isset($module_settings[$mostrecentmodule][$key]) &&
|
||||
isset($x[1])) {
|
||||
$module_settings[$mostrecentmodule][$key]=$x[1];
|
||||
}
|
||||
}
|
||||
$msettings = modulehook("mod-dyn-settings", $msettings);
|
||||
if (is_module_active($module)){
|
||||
output("This module is currently active: ");
|
||||
$deactivate = translate_inline("Deactivate");
|
||||
rawoutput("<a href='modules.php?op=deactivate&module={$module}&cat={$info['category']}'>");
|
||||
output_notl($deactivate);
|
||||
rawoutput("</a>");
|
||||
addnav("","modules.php?op=deactivate&module={$module}&cat={$info['category']}");
|
||||
}else{
|
||||
output("This module is currently deactivated: ");
|
||||
$deactivate = translate_inline("Activate");
|
||||
rawoutput("<a href='modules.php?op=activate&module={$module}&cat={$info['category']}'>");
|
||||
output_notl($deactivate);
|
||||
rawoutput("</a>");
|
||||
addnav("","modules.php?op=activate&module={$module}&cat={$info['category']}");
|
||||
}
|
||||
rawoutput("<form action='configuration.php?op=modulesettings&module=$module&save=1' method='POST'>",true);
|
||||
addnav("","configuration.php?op=modulesettings&module=$module&save=1");
|
||||
tlschema("module-$module");
|
||||
showform($msettings,$module_settings[$mostrecentmodule]);
|
||||
tlschema();
|
||||
rawoutput("</form>",true);
|
||||
}else{
|
||||
output("The %s module does not appear to define any module settings.", $module);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
output("I was not able to inject the module %s. Sorry it didn't work out.", htmlentities($module, ENT_COMPAT, getsetting("charset", "ISO-8859-1")));
|
||||
}
|
||||
}
|
||||
|
||||
page_header("Game Settings");
|
||||
require_once("lib/superusernav.php");
|
||||
superusernav();
|
||||
addnav("Module Manager", "modules.php");
|
||||
if ($module) {
|
||||
$cat = $info['category'];
|
||||
addnav(array("Module Category - `^%s`0", translate_inline($cat)), "modules.php?cat=$cat");
|
||||
}
|
||||
|
||||
addnav("Game Settings");
|
||||
addnav("Standard settings", "configuration.php");
|
||||
addnav("",$REQUEST_URI);
|
||||
|
||||
module_editor_navs('settings', 'configuration.php?op=modulesettings&module=');
|
||||
|
||||
if ($op == "") {
|
||||
$enum="enumpretrans";
|
||||
require_once("lib/datetime.php");
|
||||
$details = gametimedetails();
|
||||
$offset = getsetting("gameoffsetseconds",0);
|
||||
for ($i=0;$i<=86400 / getsetting("daysperday",4);$i+=300){
|
||||
$off = ($details['realsecstotomorrow'] - ($offset - $i));
|
||||
if ($off < 0) $off += 86400;
|
||||
$x = strtotime("+".$off." secs");
|
||||
$str = sprintf_translate("In %s at %s (+%s)",
|
||||
reltime($x), date("h:i a", $x),date("H:i",$i));
|
||||
$enum.=",$i,$str";
|
||||
}
|
||||
rawoutput(tlbutton_clear());
|
||||
$setup = array(
|
||||
"Game Setup,title",
|
||||
"loginbanner"=>"Login Banner (under login prompt: 255 chars)",
|
||||
"maxonline"=>"Max # of players online (0 for unlimited), int",
|
||||
"allowcreation"=>"Allow creation of new characters,bool",
|
||||
"gameadminemail"=>"Admin Email",
|
||||
"emailpetitions"=>"Should submitted petitions be emailed to Admin Email address?,bool",
|
||||
"Enter languages here like this: `i(shortname 2 chars) comma (readable name of the language)`i and continue as long as you wish,note",
|
||||
"serverlanguages"=>"Languages available on this server",
|
||||
"defaultlanguage"=>"Default Language,enum,".getsetting("serverlanguages","en,English,fr,Fran<61>ais,dk,Danish,de,Deutsch,es,Espa<70>ol,it,Italian"),
|
||||
"edittitles"=>"Should DK titles be editable in user editor,bool",
|
||||
"motditems"=>"How many items should be shown on the motdlist,int",
|
||||
|
||||
"Main Page Display,title",
|
||||
"homeskinselect"=>"Should the skin selection widget be shown?,bool",
|
||||
"homecurtime"=>"Should the current realm time be shown?,bool",
|
||||
"homenewdaytime"=>"Should the time till newday be shown?,bool",
|
||||
"homenewestplayer"=>"Should the newest player be shown?,bool",
|
||||
"defaultskin"=>"What skin should be the default?,theme",
|
||||
"impressum"=>"Tell the world something about the person running this server. (e.g. name and address),textarea",
|
||||
|
||||
"Beta Setup,title",
|
||||
"beta"=>"Enable beta features for all players?,bool",
|
||||
"betaperplayer"=>"Enable beta features per player?,bool",
|
||||
|
||||
"Account Creation,title",
|
||||
"defaultsuperuser"=>
|
||||
"Flags automatically granted to new players,bitfield," .
|
||||
($session['user']['superuser'] | SU_ANYONE_CAN_SET)." ,".
|
||||
SU_INFINITE_DAYS.",Infinite Days,".
|
||||
SU_VIEW_SOURCE.",View Source Code,".
|
||||
SU_DEVELOPER.",Developer Super Powers (special inc list; god mode; auto defeat master; etc),".
|
||||
SU_DEBUG_OUTPUT. ",Debug Output",
|
||||
"newplayerstartgold"=>"Amount of gold to start a new character with,int",
|
||||
"maxrestartgold"=>"Maximum amount of gold a player will get after a dragonkill,int",
|
||||
"maxrestartgems"=>"Maximum number of gems a player will get after a dragonkill,int",
|
||||
"requireemail"=>"Require users to enter their email address,bool",
|
||||
"requirevalidemail"=>"Require users to validate their email address,bool",
|
||||
"blockdupeemail"=>"One account per email address,bool",
|
||||
"spaceinname"=>"Allow spaces in user names,bool",
|
||||
"allowoddadminrenames"=>"Allow admins to enter 'illegal' names in the user editor,bool",
|
||||
"selfdelete"=>"Allow player to delete their character,bool",
|
||||
|
||||
"Commentary/Chat,title",
|
||||
"soap"=>"Clean user posts (filters bad language and splits words over 45 chars long),bool",
|
||||
"maxcolors"=>"Max # of color changes usable in one comment,range,5,40,1",
|
||||
"postinglimit"=>"Limit posts to let one user post only up to 50% of the last posts (else turn it off),bool",
|
||||
|
||||
"Place names and People names,title",
|
||||
"villagename"=>"Name for the main village",
|
||||
"innname"=>"Name of the inn",
|
||||
"barkeep"=>"Name of the barkeep",
|
||||
"barmaid"=>"Name of the barmaid",
|
||||
"bard"=>"Name of the bard",
|
||||
"clanregistrar"=>"Name of the clan registrar",
|
||||
"deathoverlord"=>"Name of the death overlord",
|
||||
|
||||
"Referral Settings,title",
|
||||
"refereraward"=>"How many points will be awarded for a referral?,int",
|
||||
"referminlevel"=>"What level does the referral need to reach to credit the referer?,int",
|
||||
|
||||
"Random events,title",
|
||||
"forestchance"=>"Chance for Something Special in the Forest,range,0,100,1",
|
||||
"villagechance"=>"Chance for Something Special in any village,range,0,100,1",
|
||||
"innchance"=>"Chance for Something Special in the Inn,range,0,100,1",
|
||||
"gravechance"=>"Chance for Something Special in the Graveyard,range,0,100,1",
|
||||
"gardenchance"=>"Chance for Something Special in the Gardens,range,0,100,1",
|
||||
|
||||
"Paypal,title",
|
||||
"paypalemail"=>"Email address of Admin's paypal account",
|
||||
"paypalcurrency"=>"Currency type",
|
||||
"paypalcountry-code"=>"What country's predominant language do you wish to have displayed in your PayPal screen?,enum
|
||||
,US,United States,DE,Germany,AI,Anguilla,AR,Argentina,AU,Australia,AT,Austria,BE,Belgium,BR,Brazil,CA,Canada
|
||||
,CL,Chile,C2,China,CR,Costa Rica,CY,Cyprus,CZ,Czech Republic,DK,Denmark,DO,Dominican Republic
|
||||
,EC,Ecuador,EE,Estonia,FI,Finland,FR,France,GR,Greece,HK,Hong Kong,HU,Hungary,IS,Iceland,IN,India
|
||||
,IE,Ireland,IL,Israel,IT,Italy,JM,Jamaica,JP,Japan,LV,Latvia,LT,Lithuania,LU,Luxembourg,MY,Malaysia
|
||||
,MT,Malta,MX,Mexico,NL,Netherlands,NZ,New Zealand,NO,Norway,PL,Poland,PT,Portugal,SG,Singapore,SK,Slovakia
|
||||
,SI,Slovenia,ZA,South Africa,KR,South Korea,ES,Spain,SE,Sweden,CH,Switzerland,TW,Taiwan,TH,Thailand,TR,Turkey
|
||||
,GB,United Kingdom,UY,Uruguay,VE,Venezuela",
|
||||
"paypaltext"=>"What text should be displayed as item name in the donations screen(player name will be added after it)?",
|
||||
"(standard: 'Legend of the Green Dragon Site Donation from',note",
|
||||
|
||||
"General Combat,title",
|
||||
"autofight"=>"Allow fighting multiple rounds automatically,bool",
|
||||
"autofightfull"=>"Allow fighting until fight is over,enum,0,Never,1,Always,2,Only when not allowed to flee",
|
||||
|
||||
"Training,title",
|
||||
"automaster"=>"Masters hunt down truant students,bool",
|
||||
"multimaster"=>"Can players gain multiple levels (challenge multiple masters) per game day?,bool",
|
||||
"displaymasternews"=>"Display news if somebody fought his master?,bool",
|
||||
|
||||
"Clans,title",
|
||||
"allowclans"=>"Enable Clan System?,bool",
|
||||
"goldtostartclan"=>"Gold to start a clan,int",
|
||||
"gemstostartclan"=>"Gems to start a clan,int",
|
||||
"officermoderate"=>"Can clan officers who are also moderators moderate their own clan even if they cannot moderate all clans?,bool",
|
||||
|
||||
"New Days,title",
|
||||
"daysperday"=>"Game days per calendar day,range,1,6,1",
|
||||
"specialtybonus"=>"Extra daily uses in specialty area,range,0,5,1",
|
||||
"newdaycron"=>"Let the newday-runonce run via a cronjob,bool",
|
||||
"The directory is necessary! Do not forget to set the correct one in cron.php in your main game folder!!! ONLY experienced admins should use cron jobbing here,note",
|
||||
"`bAlso make sure you setup a cronjob on your machine using confixx/plesk/cpanel or any other admin panel pointing to the cron.php file in your main folder`b,note",
|
||||
"If you do not know what a Cronjob is... leave it turned off. If you want to know more... check out: <a href='http://wiki.dragonprime.net/index.php?title=Cronjob'>http://wiki.dragonprime.net/index.php?title=Cronjob</a>,note",
|
||||
"resurrectionturns"=>"Modify (+ or -) the number of turns deducted after a resurrection as an absolute (number) or relative (number followed by %),text",
|
||||
|
||||
"Forest,title",
|
||||
"turns"=>"Forest Fights per day,range,5,30,1",
|
||||
"dropmingold"=>"Forest Creatures drop at least 1/4 of max gold,bool",
|
||||
"suicide"=>"Allow players to Seek Suicidally?,bool",
|
||||
"suicidedk"=>"Minimum DKs before players can Seek Suicidally?,int",
|
||||
"forestgemchance"=>"Player will find a gem one in X times,range,10,100,1",
|
||||
"disablebonuses"=>"Should monsters which get buffed with extra HP/Att/Def get a gold+exp bonus?,bool",
|
||||
"forestexploss"=>"What percentage of experience should be lost?,range,10,100,1",
|
||||
|
||||
"Multiple Enemies,title",
|
||||
"multifightdk"=>"Multiple monsters will attack players above which amount of dragonkills?,range,8,50,1",
|
||||
"multichance"=>"The chance for an attack from multiple enemies is,range,0,100,1",
|
||||
"addexp"=>"Additional experience (%) per enemy during multifights?,range,0,15",
|
||||
"instantexp"=>"During multi-fights hand out experience instantly?,bool",
|
||||
"maxattacks"=>"How many enemies will attack per round (max. value),range,1,10",
|
||||
"allowpackofmonsters"=>"Allow multiple monsters of the same type to appear in a battle?,bool",
|
||||
"Random values for type of seeking is added to random base.,note",
|
||||
"multibasemin"=>"The base number of multiple enemies at minimum is,range,1,100,2",
|
||||
"multibasemax"=>"The base number of multiple enemies at maximum is,range,1,100,3",
|
||||
"multislummin"=>"The number of multiple enemies at minimum for slumming is,range,0,100,0",
|
||||
"multislummax"=>"The number of multiple enemies at maximum for slumming is,range,0,100,1",
|
||||
"multithrillmin"=>"The number of multiple enemies at minimum for thrill seeking is,range,0,100,1",
|
||||
"multithrillmax"=>"The number of multiple enemies at maximum for thrill seeking is,range,0,100,2",
|
||||
"multisuimin"=>"The number of multiple enemies at minimum for suicide is,range,0,100,2",
|
||||
"multisuimax"=>"The number of multiple enemies at maximum for suicide is,range,0,100,4",
|
||||
|
||||
"Stables,title",
|
||||
"allowfeed"=>"Does Merick have feed onhand for creatures,bool",
|
||||
|
||||
"Companions/Mercenaries,title",
|
||||
"enablecompanions"=>"Enable the usage of companions,bool",
|
||||
"companionsallowed"=>"How many companions are allowed per player,int",
|
||||
"Modules my alter this value on a per player basis!,note",
|
||||
"companionslevelup"=>"Are companions allowed to level up?,bool",
|
||||
|
||||
"Bank Settings,title",
|
||||
"fightsforinterest"=>"Max forest fights remaining to earn interest?,range,0,10,1",
|
||||
"maxinterest"=>"Max Interest Rate (%),range,5,10,1",
|
||||
"mininterest"=>"Min Interest Rate (%),range,0,5,1",
|
||||
"maxgoldforinterest"=>"Over what amount of gold does the bank cease paying interest? (0 for unlimited),int",
|
||||
"borrowperlevel"=>"Max player can borrow per level (val * level for max),range5,200,5",
|
||||
"allowgoldtransfer"=>"Allow players to transfer gold,bool",
|
||||
"transferperlevel"=>"Max player can receive from a transfer (val * level),range,5,100,5",
|
||||
"mintransferlev"=>"Min level a player (0 DK's) needs to transfer gold,range,1,5,1",
|
||||
"transferreceive"=>"Total transfers a player can receive in one day,range,0,5,1",
|
||||
"maxtransferout"=>"Amount player can transfer to others (val * level),range,5,100,5",
|
||||
"innfee"=>"Fee for express inn payment (x or x%),int",
|
||||
|
||||
"Mail Settings,title",
|
||||
"mailsizelimit"=>"Message size limit per message,int",
|
||||
"inboxlimit"=>"Limit # of messages in inbox,int",
|
||||
"oldmail"=>"Automatically delete old messages after (days),int",
|
||||
"superuseryommessage"=>"Warning to give when attempting to YoM an admin?",
|
||||
"onlyunreadmails"=>"Only unread mail count towards the inbox limit?,bool",
|
||||
|
||||
"PvP,title",
|
||||
"pvp"=>"Enable Slay Other Players,bool",
|
||||
"pvpday"=>"Player Fights per day,range,1,10,1",
|
||||
"pvpimmunity"=>"Days that new players are safe from PvP,range,1,5,1",
|
||||
"pvpminexp"=>"Experience below which player is safe from PvP,int",
|
||||
"pvpattgain"=>"Percent of victim experience attacker gains on win,floatrange,.25,20,.25",
|
||||
"pvpattlose"=>"Percent of experience attacker loses on loss,floatrange,.25,20,.25",
|
||||
"pvpdefgain"=>"Percent of attacker experience defender gains on win,floatrange,.25,20,.25",
|
||||
"pvpdeflose"=>"Percent of experience defender loses on loss,floatrange,.25,20,.25",
|
||||
|
||||
"Content Expiration,title",
|
||||
"expirecontent"=>"Days to keep comments and news? (0 = infinite),int",
|
||||
"expiretrashacct"=>"Days to keep never logged-in accounts? (0 = infinite),int",
|
||||
"expirenewacct"=>"Days to keep 1 level (0 dragon) accounts? (0 =infinite),int",
|
||||
"expireoldacct"=>"Days to keep all other accounts? (0 = infinite),int",
|
||||
"LOGINTIMEOUT"=>"Seconds of inactivity before auto-logoff,int",
|
||||
|
||||
"High Load Optimization,title",
|
||||
"This has been moved to the dbconnect.php,note",
|
||||
/*
|
||||
"usedatacache"=>"Use Data Caching,bool",
|
||||
"datacachepath"=>"Path to store data cache information`n`iNote`i when using in an environment where Safe Mode is enabled; this needs to be a path that has the same UID as the web server runs.",
|
||||
//this has been put to the dbconnect.php
|
||||
*/
|
||||
|
||||
"LoGDnet Setup,title",
|
||||
"(LoGDnet requires your PHP configuration to have file wrappers enabled!!),note",
|
||||
"logdnet"=>"Register with LoGDnet?,bool",
|
||||
"serverurl"=>"Server URL",
|
||||
"serverdesc"=>"Server Description (75 chars max)",
|
||||
"logdnetserver"=>"Master LoGDnet Server (default http://logdnet.logd.com/)",
|
||||
"curltimeout"=>"How long we wait for responses from logdnet.logd.com (in seconds),range,1,10,1|2",
|
||||
|
||||
"Game day Setup,title",
|
||||
"dayduration"=>"Day Duration,viewonly",
|
||||
"curgametime"=>"Current game time,viewonly",
|
||||
"curservertime"=>"Current Server Time,viewonly",
|
||||
"lastnewday"=>"Last new day,viewonly",
|
||||
"nextnewday"=>"Next new day,viewonly",
|
||||
"gameoffsetseconds"=>"Real time to offset new day,$enum",
|
||||
|
||||
"Translation Setup,title",
|
||||
"enabletranslation"=>"Enable the use of the translation engine,bool",
|
||||
"It is strongly recommended to leave this feature turned on.,note",
|
||||
"cachetranslations"=>"Cache the translations (datacache must be turned on)?,bool",
|
||||
"permacollect"=>"Permanently collect untranslated texts (overrides the next settings!),bool",
|
||||
"collecttexts"=>"Are we currently collecting untranslated texts?,viewonly",
|
||||
"tl_maxallowed"=>"Collect untranslated texts if you have fewer player than this logged in. (0 never collects),int",
|
||||
"charset"=>"Which charset should be used for htmlentities?",
|
||||
|
||||
"Error Notification,title",
|
||||
"Note: you MUST have data caching turned on if you want to use this feature. Also the first error within any 24 hour period will not generate a notice; I'm sorry: that's really just how it is for technical reasons.,note",
|
||||
"show_notices"=>"Show PHP Notice output?,bool",
|
||||
"notify_on_warn"=>"Send notification on site warnings?,bool",
|
||||
"notify_on_error"=>"Send notification on site errors?,bool",
|
||||
"notify_address"=>"Address to notify",
|
||||
"notify_every"=>"Only notify every how many minutes for each distinct error?,int",
|
||||
|
||||
"Miscellaneous Settings,title",
|
||||
"allowspecialswitch"=>"The Barkeeper may help you to switch your specialty?,bool",
|
||||
"maxlistsize"=>"Maximum number of items to be shown in the warrior list,int",
|
||||
);
|
||||
$secstonewday = secondstonextgameday($details);
|
||||
$useful_vals = array(
|
||||
"dayduration"=>round(($details['dayduration']/60/60),0)." hours",
|
||||
"curgametime"=>getgametime(),
|
||||
"curservertime"=>date("Y-m-d h:i:s a"),
|
||||
"lastnewday"=>date("h:i:s a",
|
||||
strtotime("-{$details['realsecssofartoday']} seconds")),
|
||||
"nextnewday"=>date("h:i:s a",
|
||||
strtotime("+{$details['realsecstotomorrow']} seconds"))." (".date("H\\h i\\m s\\s",$secstonewday).")"
|
||||
);
|
||||
|
||||
loadsettings();
|
||||
$vals = $settings + $useful_vals;
|
||||
|
||||
rawoutput("<form action='configuration.php?op=save' method='POST'>");
|
||||
addnav("","configuration.php?op=save");
|
||||
showform($setup,$vals);
|
||||
rawoutput("</form>");
|
||||
}
|
||||
page_footer();
|
||||
?>
|
317
lotgd-web/lotgd/create.php
Executable file
@ -0,0 +1,317 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
define("ALLOW_ANONYMOUS",true);
|
||||
require_once("common.php");
|
||||
require_once("lib/is_email.php");
|
||||
require_once("lib/checkban.php");
|
||||
require_once("lib/http.php");
|
||||
|
||||
tlschema("create");
|
||||
|
||||
$trash = getsetting("expiretrashacct",1);
|
||||
$new = getsetting("expirenewacct",10);
|
||||
$old = getsetting("expireoldacct",45);
|
||||
|
||||
checkban();
|
||||
$op = httpget('op');
|
||||
|
||||
if ($op=="val"){
|
||||
$id = httpget('id');
|
||||
$sql = "SELECT acctid,login,password,name FROM ". db_prefix("accounts") . " WHERE emailvalidation='$id' AND emailvalidation!=''";
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)>0) {
|
||||
$row = db_fetch_assoc($result);
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET emailvalidation='' WHERE emailvalidation='$id';";
|
||||
db_query($sql);
|
||||
output("`#`cYour email has been validated. You may now log in.`c`0");
|
||||
rawoutput("<form action='login.php' method='POST'>");
|
||||
rawoutput("<input name='name' value=\"{$row['login']}\" type='hidden'>");
|
||||
rawoutput("<input name='password' value=\"!md52!{$row['password']}\" type='hidden'>");
|
||||
rawoutput("<input name='force' value='1' type='hidden'>");
|
||||
output("Your email has been validated, your login name is `^%s`0.`n`n",
|
||||
$row['login']);
|
||||
$click = translate_inline("Click here to log in");
|
||||
rawoutput("<input type='submit' class='button' value='$click'></form>");
|
||||
output_notl("`n");
|
||||
if ($trash > 0) {
|
||||
output("`^Characters that have never been logged into will be deleted after %s day(s) of no activity.`n`0", $trash);
|
||||
}
|
||||
if ($new > 0) {
|
||||
output("`^Characters that have never reached level 2 will be deleted after %s days of no activity.`n`0", $new);
|
||||
}
|
||||
if ($old > 0) {
|
||||
output("`^Characters that have reached level 2 at least once will be deleted after %s days of no activity.`n`0", $old);
|
||||
}
|
||||
//only set this if they are not doing a forgotten password.
|
||||
if (substr($id,0,1)!="x") {
|
||||
savesetting("newestplayer", $row['acctid']);
|
||||
invalidatedatacache('newest');
|
||||
}
|
||||
}else{
|
||||
output("`#Your email could not be verified.");
|
||||
output("This may be because you already validated your email.");
|
||||
output("Try to log in, and if that doesn't help, use the petition link at the bottom of the page.");
|
||||
}
|
||||
}
|
||||
if ($op=="forgot"){
|
||||
$charname = httppost('charname');
|
||||
if ($charname!=""){
|
||||
$sql = "SELECT acctid,login,emailaddress,emailvalidation,password FROM " . db_prefix("accounts") . " WHERE login='$charname'";
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)>0){
|
||||
$row = db_fetch_assoc($result);
|
||||
if (trim($row['emailaddress'])!=""){
|
||||
if ($row['emailvalidation']==""){
|
||||
$row['emailvalidation']=substr("x".md5(date("Y-m-d H:i:s").$row['password']),0,32);
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET emailvalidation='{$row['emailvalidation']}' where login='{$row['login']}'";
|
||||
db_query($sql);
|
||||
}
|
||||
$subj = translate_mail("LoGD Account Verification",$row['acctid']);
|
||||
$msg = translate_mail(array("Someone from %s requested a forgotten password link for your account. If this was you, then here is your"
|
||||
." link, you may click it to log into your account and change your password from your preferences page in the village square.`n`n"
|
||||
."If you didn't request this email, then don't sweat it, you're the one who is receiving this email, not them."
|
||||
."`n`n http://%s?op=val&id=%s `n`n Thanks for playing!",
|
||||
$_SERVER['REMOTE_ADDR'],
|
||||
($_SERVER['SERVER_NAME'].($_SERVER['SERVER_PORT'] == 80?"":":".$_SERVER['SERVER_PORT']).$_SERVER['SCRIPT_NAME']),
|
||||
$row['emailvalidation']
|
||||
),$row['acctid']);
|
||||
mail($row['emailaddress'],$subj,str_replace("`n","\n",$msg),translate_inline("From:").getsetting("gameadminemail","postmaster@localhost.com"));
|
||||
output("`#Sent a new validation email to the address on file for that account.");
|
||||
output("You may use the validation email to log in and change your password.");
|
||||
}else{
|
||||
output("`#We're sorry, but that account does not have an email address associated with it, and so we cannot help you with your forgotten password.");
|
||||
output("Use the Petition for Help link at the bottom of the page to request help with resolving your problem.");
|
||||
}
|
||||
}else{
|
||||
output("`#Could not locate a character with that name.");
|
||||
output("Look at the List Warriors page off the login page to make sure that the character hasn't expired and been deleted.");
|
||||
}
|
||||
}else{
|
||||
rawoutput("<form action='create.php?op=forgot' method='POST'>");
|
||||
output("`bForgotten Passwords:`b`n`n");
|
||||
output("Enter your character's name: ");
|
||||
rawoutput("<input name='charname'>");
|
||||
output_notl("`n");
|
||||
$send = translate_inline("Email me my password");
|
||||
rawoutput("<input type='submit' class='button' value='$send'>");
|
||||
rawoutput("</form>");
|
||||
}
|
||||
}
|
||||
page_header("Create A Character");
|
||||
if (getsetting("allowcreation",1)==0){
|
||||
output("`\$Creation of new accounts is disabled on this server.");
|
||||
output("You may try it again another day or contact an administrator.");
|
||||
}else{
|
||||
if ($op=="create"){
|
||||
$emailverification="";
|
||||
$shortname = sanitize_name(getsetting("spaceinname", 0), httppost('name'));
|
||||
|
||||
if (soap($shortname)!=$shortname){
|
||||
output("`\$Error`^: Bad language was found in your name, please consider revising it.`n");
|
||||
$op="";
|
||||
}else{
|
||||
$blockaccount=false;
|
||||
$email = httppost('email');
|
||||
$pass1= httppost('pass1');
|
||||
$pass2= httppost('pass2');
|
||||
if (getsetting("blockdupeemail",0)==1 && getsetting("requireemail",0)==1){
|
||||
$sql = "SELECT login FROM " . db_prefix("accounts") . " WHERE emailaddress='$email'";
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)>0){
|
||||
$blockaccount=true;
|
||||
$msg.= translate_inline("You may have only one account.`n");
|
||||
}
|
||||
}
|
||||
|
||||
$passlen = (int)httppost("passlen");
|
||||
if (substr($pass1, 0, 5) != "!md5!" &&
|
||||
substr($pass1, 0, 6) != "!md52!") {
|
||||
$passlen = strlen($pass1);
|
||||
}
|
||||
if ($passlen<=3){
|
||||
$msg.=translate_inline("Your password must be at least 4 characters long.`n");
|
||||
$blockaccount=true;
|
||||
}
|
||||
if ($pass1!=$pass2){
|
||||
$msg.=translate_inline("Your passwords do not match.`n");
|
||||
$blockaccount=true;
|
||||
}
|
||||
if (strlen($shortname)<3){
|
||||
$msg.=translate_inline("Your name must be at least 3 characters long.`n");
|
||||
$blockaccount=true;
|
||||
}
|
||||
if (strlen($shortname)>25){
|
||||
$msg.=translate_inline("Your character's name cannot exceed 25 characters.`n");
|
||||
$blockaccount=true;
|
||||
}
|
||||
if (getsetting("requireemail",0)==1 && is_email($email) || getsetting("requireemail",0)==0){
|
||||
}else{
|
||||
$msg.=translate_inline("You must enter a valid email address.`n");
|
||||
$blockaccount=true;
|
||||
}
|
||||
$args = modulehook("check-create", httpallpost());
|
||||
if(isset($args['blockaccount']) && $args['blockaccount']) {
|
||||
$msg .= $args['msg'];
|
||||
$blockaccount = true;
|
||||
}
|
||||
|
||||
if (!$blockaccount){
|
||||
$shortname = preg_replace("/\s+/", " ", $shortname);
|
||||
$sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE login='$shortname'";
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)>0){
|
||||
output("`\$Error`^: Someone is already known by that name in this realm, please try again.");
|
||||
$op="";
|
||||
}else{
|
||||
$sex = (int)httppost('sex');
|
||||
// Inserted the following line to prevent hacking
|
||||
// Reported by Eliwood
|
||||
if ($sex <> SEX_MALE) $sex = SEX_FEMALE;
|
||||
require_once("lib/titles.php");
|
||||
$title = get_dk_title(0, $sex);
|
||||
if (getsetting("requirevalidemail",0)){
|
||||
$emailverification=md5(date("Y-m-d H:i:s").$email);
|
||||
}
|
||||
$refer = httpget('r');
|
||||
if ($refer>""){
|
||||
$sql = "SELECT acctid FROM " . db_prefix("accounts") . " WHERE login='$refer'";
|
||||
$result = db_query($sql);
|
||||
$ref = db_fetch_assoc($result);
|
||||
$referer=$ref['acctid'];
|
||||
}else{
|
||||
$referer=0;
|
||||
}
|
||||
$dbpass = "";
|
||||
if (substr($pass1, 0, 5) == "!md5!") {
|
||||
$dbpass = md5(substr($pass1, 5));
|
||||
} else {
|
||||
$dbpass = md5(md5($pass1));
|
||||
}
|
||||
$sql = "INSERT INTO " . db_prefix("accounts") . "
|
||||
(name, superuser, title, password, sex, login, laston, uniqueid, lastip, gold, emailaddress, emailvalidation, referer, regdate)
|
||||
VALUES
|
||||
('$title $shortname', '".getsetting("defaultsuperuser",0)."', '$title', '$dbpass', '$sex', '$shortname', '".date("Y-m-d H:i:s",strtotime("-1 day"))."', '".$_COOKIE['lgi']."', '".$_SERVER['REMOTE_ADDR']."', ".getsetting("newplayerstartgold",50).", '$email', '$emailverification', '$referer', NOW())";
|
||||
db_query($sql);
|
||||
if (db_affected_rows(LINK)<=0){
|
||||
output("`\$Error`^: Your account was not created for an unknown reason, please try again. ");
|
||||
}else{
|
||||
$sql = "SELECT acctid FROM " . db_prefix("accounts") . " WHERE login='$shortname'";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
$args = httpallpost();
|
||||
$args['acctid'] = $row['acctid'];
|
||||
//insert output
|
||||
$sql_output = "INSERT INTO " . db_prefix("accounts_output") . " VALUES ({$row['acctid']},'');";
|
||||
db_query($sql_output);
|
||||
//end
|
||||
modulehook("process-create", $args);
|
||||
if ($emailverification!=""){
|
||||
$subj = translate_mail("LoGD Account Verification",0);
|
||||
$msg = translate_mail(array("Login name: %s `n`nIn order to verify your account, you will need to click on the link below.`n`n http://%s?op=val&id=%s `n`nThanks for playing!",$shortname,
|
||||
($_SERVER['SERVER_NAME'].($_SERVER['SERVER_PORT'] == 80?"":":".$_SERVER['SERVER_PORT']).$_SERVER['SCRIPT_NAME']),
|
||||
$emailverification),
|
||||
0);
|
||||
mail($email,$subj,str_replace("`n","\n",$msg),"From: ".getsetting("gameadminemail","postmaster@localhost.com"));
|
||||
output("`4An email was sent to `\$%s`4 to validate your address. Click the link in the email to activate your account.`0`n`n", $email);
|
||||
}else{
|
||||
rawoutput("<form action='login.php' method='POST'>");
|
||||
rawoutput("<input name='name' value=\"$shortname\" type='hidden'>");
|
||||
rawoutput("<input name='password' value=\"$pass1\" type='hidden'>");
|
||||
output("Your account was created, your login name is `^%s`0.`n`n", $shortname);
|
||||
$click = translate_inline("Click here to log in");
|
||||
rawoutput("<input type='submit' class='button' value='$click'>");
|
||||
rawoutput("</form>");
|
||||
output_notl("`n");
|
||||
if ($trash > 0) {
|
||||
output("`^Characters that have never been logged into will be deleted after %s day(s) of no activity.`n`0", $trash);
|
||||
}
|
||||
if ($new > 0) {
|
||||
output("`^Characters that have never reached level 2 will be deleted after %s days of no activity.`n`0",$new);
|
||||
}
|
||||
if ($old > 0) {
|
||||
output("`^Characters that have reached level 2 at least once will be deleted after %s days of no activity.`n`0", $old);
|
||||
}
|
||||
savesetting("newestplayer", $row['acctid']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
output("`\$Error`^:`n%s", $msg);
|
||||
$op="";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($op==""){
|
||||
output("`&`c`bCreate a Character`b`c`0");
|
||||
$refer=httpget('r');
|
||||
if ($refer) $refer = "&r=".htmlentities($refer, ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
|
||||
|
||||
rawoutput("<script language='JavaScript' src='lib/md5.js'></script>");
|
||||
rawoutput("<script language='JavaScript'>
|
||||
<!--
|
||||
function md5pass(){
|
||||
// encode passwords
|
||||
var plen = document.getElementById('passlen');
|
||||
var pass1 = document.getElementById('pass1');
|
||||
plen.value = pass1.value.length;
|
||||
|
||||
if(pass1.value.substring(0, 5) != '!md5!') {
|
||||
pass1.value = '!md5!'+hex_md5(pass1.value);
|
||||
}
|
||||
var pass2 = document.getElementById('pass2');
|
||||
if(pass2.value.substring(0, 5) != '!md5!') {
|
||||
pass2.value = '!md5!'+hex_md5(pass2.value);
|
||||
}
|
||||
|
||||
}
|
||||
//-->
|
||||
</script>");
|
||||
rawoutput("<form action=\"create.php?op=create$refer\" method='POST' onSubmit=\"md5pass();\">");
|
||||
// this is the first thing a new player will se, so let's make it look
|
||||
// better
|
||||
rawoutput("<input type='hidden' name='passlen' id='passlen' value='0'>");
|
||||
rawoutput("<table><tr valign='top'><td>");
|
||||
output("How will you be known to this world? ");
|
||||
rawoutput("</td><td><input name='name'></td></tr><tr valign='top'><td>");
|
||||
output("Enter a password: ");
|
||||
rawoutput("</td><td><input type='password' name='pass1' id='pass1'></td></tr><tr valign='top'><td>");
|
||||
output("Re-enter it for confirmation: ");
|
||||
rawoutput("</td><td><input type='password' name='pass2' id='pass2'></td></tr><tr valign='top'><td>");
|
||||
output("Enter your email address: ");
|
||||
$r1 = translate_inline("`^(optional -- however, if you choose not to enter one, there will be no way that you can reset your password if you forget it!)`0");
|
||||
$r2 = translate_inline("`\$(required)`0");
|
||||
$r3 = translate_inline("`\$(required, an email will be sent to this address to verify it before you can log in)`0");
|
||||
if (getsetting("requireemail", 0) == 0) {
|
||||
$req = $r1;
|
||||
} elseif (getsetting("requirevalidemail", 0) == 0) {
|
||||
$req = $r2;
|
||||
} else {
|
||||
$req = $r3;
|
||||
}
|
||||
rawoutput("</td><td><input name='email'>");
|
||||
output_notl("%s", $req);
|
||||
rawoutput("</td></tr></table>");
|
||||
output("`nAnd are you a %s Female or a %s Male?`n",
|
||||
"<input type='radio' name='sex' value='1'>",
|
||||
"<input type='radio' name='sex' value='0' checked>",true);
|
||||
modulehook("create-form");
|
||||
$createbutton = translate_inline("Create your character");
|
||||
rawoutput("<input type='submit' class='button' value='$createbutton'>");
|
||||
output_notl("`n`n");
|
||||
if ($trash > 0) {
|
||||
output("`^Characters that have never been logged into will be deleted after %s day(s) of no activity.`n`0", $trash);
|
||||
}
|
||||
if ($new > 0) {
|
||||
output("`^Characters that have never reached level 2 will be deleted after %s days of no activity.`n`0",$new);
|
||||
}
|
||||
if ($old > 0) {
|
||||
output("`^Characters that have reached level 2 at least once will be deleted after %s days of no activity.`n`0", $old);
|
||||
}
|
||||
rawoutput("</form>");
|
||||
}
|
||||
}
|
||||
addnav("Login","index.php");
|
||||
page_footer();
|
||||
?>
|
248
lotgd-web/lotgd/creatures.php
Executable file
@ -0,0 +1,248 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/http.php");
|
||||
|
||||
check_su_access(SU_EDIT_CREATURES);
|
||||
|
||||
tlschema("creatures");
|
||||
|
||||
$creaturestats = array();
|
||||
|
||||
require_once 'lib/creatures.php';
|
||||
for ($i=1;$i<18;$i++){
|
||||
$creaturestats[$i] = creature_stats($i);
|
||||
}
|
||||
|
||||
page_header("Creature Editor");
|
||||
|
||||
require_once("lib/superusernav.php");
|
||||
superusernav();
|
||||
|
||||
$op = httpget("op");
|
||||
$subop = httpget("subop");
|
||||
if ($op == "save"){
|
||||
$forest = (int)(httppost('forest'));
|
||||
$grave = (int)(httppost('graveyard'));
|
||||
$id = httppost('creatureid');
|
||||
if (!$id) $id = httpget("creatureid");
|
||||
if ($subop == "") {
|
||||
$post = httpallpost();
|
||||
$lev = (int)httppost('creaturelevel');
|
||||
if ($id){
|
||||
$sql = "";
|
||||
reset($post);
|
||||
while (list($key,$val)=each($post)){
|
||||
if (substr($key,0,8)=="creature") $sql.="$key = '$val', ";
|
||||
}
|
||||
reset($creaturestats[$lev]);
|
||||
while (list($key,$val)=each($creaturestats[$lev])){
|
||||
if ( $key!="creaturelevel" && substr($key,0,8)=="creature"){
|
||||
$sql.="$key = \"".addslashes($val)."\", ";
|
||||
}
|
||||
}
|
||||
$sql.=" forest='$forest', ";
|
||||
$sql.=" graveyard='$grave' ";
|
||||
$sql="UPDATE " . db_prefix("creatures") . " SET " . $sql . " WHERE creatureid='$id'";
|
||||
db_query($sql) or output("`\$".db_error(LINK)."`0`n`#$sql`0`n");
|
||||
}else{
|
||||
$cols = array();
|
||||
$vals = array();
|
||||
|
||||
reset($post);
|
||||
while (list($key,$val)=each($post)){
|
||||
if (substr($key,0,8)=="creature") {
|
||||
array_push($cols,$key);
|
||||
array_push($vals,$val);
|
||||
}
|
||||
}
|
||||
array_push($cols, "forest");
|
||||
array_push($vals, $forest);
|
||||
array_push($cols, "graveyard");
|
||||
array_push($vals, $grave);
|
||||
reset($creaturestats[$lev]);
|
||||
while (list($key,$val)=each($creaturestats[$lev])){
|
||||
if ($key!="creaturelevel"&& substr($key,0,8)=="creature"){
|
||||
array_push($cols,$key);
|
||||
array_push($vals,$val);
|
||||
}
|
||||
}
|
||||
$sql="INSERT INTO " . db_prefix("creatures") . " (".join(",",$cols).",createdby) VALUES (\"".join("\",\"",$vals)."\",\"".addslashes($session['user']['login'])."\")";
|
||||
db_query($sql);
|
||||
$id = db_insert_id();
|
||||
}
|
||||
if (db_affected_rows()) {
|
||||
output("`^Creature saved!`0`n");
|
||||
} else {
|
||||
output("`^Creature `\$not`^ saved!`0`n");
|
||||
}
|
||||
} elseif ($subop == "module") {
|
||||
// Save module settings
|
||||
$module = httpget("module");
|
||||
$post = httpallpost();
|
||||
reset($post);
|
||||
while(list($key, $val) = each($post)) {
|
||||
set_module_objpref("creatures", $id, $key, $val, $module);
|
||||
}
|
||||
output("`^Saved!`0`n");
|
||||
}
|
||||
// Set the httpget id so that we can do the editor once we save
|
||||
httpset("creatureid", $id, true);
|
||||
// Set the httpget op so we drop back into the editor
|
||||
httpset("op", "edit");
|
||||
}
|
||||
|
||||
$op = httpget('op');
|
||||
$id = httpget('creatureid');
|
||||
if ($op=="del"){
|
||||
$sql = "DELETE FROM " . db_prefix("creatures") . " WHERE creatureid = '$id'";
|
||||
db_query($sql);
|
||||
if (db_affected_rows()>0){
|
||||
output("Creature deleted`n`n");
|
||||
}else{
|
||||
output("Creature not deleted: %s", db_error(LINK));
|
||||
}
|
||||
$op="";
|
||||
httpset('op', "");
|
||||
}
|
||||
if ($op=="" || $op=="search"){
|
||||
$level = httpget("level");
|
||||
if (!$level) $level = 1;
|
||||
$q = httppost("q");
|
||||
if ($q) {
|
||||
$where = "creaturename LIKE '%$q%' OR creatureweapon LIKE '%$q%' OR creaturelose LIKE '%$q%' OR createdby LIKE '%$q%'";
|
||||
} else {
|
||||
$where = "creaturelevel='$level'";
|
||||
}
|
||||
$sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE $where ORDER BY creaturelevel,creaturename";
|
||||
$result = db_query($sql);
|
||||
// Search form
|
||||
$search = translate_inline("Search");
|
||||
rawoutput("<form action='creatures.php?op=search' method='POST'>");
|
||||
output("Search by field: ");
|
||||
rawoutput("<input name='q' id='q'>");
|
||||
rawoutput("<input type='submit' class='button' value='$search'>");
|
||||
rawoutput("</form>");
|
||||
rawoutput("<script language='JavaScript'>document.getElementById('q').focus();</script>",true);
|
||||
addnav("","creatures.php?op=search");
|
||||
|
||||
addnav("Levels");
|
||||
$sql1 = "SELECT count(creatureid) AS n,creaturelevel FROM " . db_prefix("creatures") . " group by creaturelevel order by creaturelevel";
|
||||
$result1 = db_query($sql1);
|
||||
while ($row = db_fetch_assoc($result1)) {
|
||||
addnav(array("Level %s: (%s creatures)", $row['creaturelevel'], $row['n']),
|
||||
"creatures.php?level={$row['creaturelevel']}");
|
||||
}
|
||||
// There is no reason to allow players to add creatures to level 17 and 18.
|
||||
// Players aren't supposed to stay at level 15 at all.
|
||||
if ($level <= 16) {
|
||||
addnav("Edit");
|
||||
addnav("Add a creature","creatures.php?op=add&level=$level");
|
||||
}
|
||||
$opshead = translate_inline("Ops");
|
||||
$idhead = translate_inline("ID");
|
||||
$name = translate_inline("Name");
|
||||
$lev = translate_inline("Level");
|
||||
$weapon = translate_inline("Weapon");
|
||||
$winmsg = translate_inline("Win");
|
||||
$diemsg = translate_inline("Die");
|
||||
$author = translate_inline("Author");
|
||||
$edit = translate_inline("Edit");
|
||||
$confirm = translate_inline("Are you sure you wish to delete this creature?");
|
||||
$del = translate_inline("Del");
|
||||
|
||||
rawoutput("<table border=0 cellpadding=2 cellspacing=1 bgcolor='#999999'>");
|
||||
rawoutput("<tr class='trhead'>");
|
||||
rawoutput("<td>$opshead</td><td>$idhead</td><td>$name</td><td>$lev</td><td>$weapon</td><td>$winmsg</td><td>$diemsg</td><td>$author</td></tr>");
|
||||
addnav("","creatures.php");
|
||||
$number=db_num_rows($result);
|
||||
for ($i=0;$i<$number;$i++){
|
||||
$row = db_fetch_assoc($result);
|
||||
rawoutput("<tr class='".($i%2==0?"trdark":"trlight")."'>", true);
|
||||
rawoutput("<td>[ <a href='creatures.php?op=edit&creatureid={$row['creatureid']}'>");
|
||||
output_notl("%s", $edit);
|
||||
rawoutput("</a> | <a href='creatures.php?op=del&creatureid={$row['creatureid']}&level={$row['creaturelevel']}' onClick='return confirm(\"$confirm\");'>");
|
||||
output_notl("%s", $del);
|
||||
rawoutput("</a> ]</td><td>");
|
||||
addnav("","creatures.php?op=edit&creatureid={$row['creatureid']}");
|
||||
addnav("","creatures.php?op=del&creatureid={$row['creatureid']}&level={$row['creaturelevel']}");
|
||||
output_notl("%s", $row['creatureid']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl("%s", $row['creaturename']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl("%s", $row['creaturelevel']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl("%s", $row['creatureweapon']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl("%s", $row['creaturewin']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl("%s", $row['creaturelose']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl("%s", $row['createdby']);
|
||||
rawoutput("</td></tr>");
|
||||
}
|
||||
rawoutput("</table>");
|
||||
}else{
|
||||
$level = httpget('level');
|
||||
if (!$level) $level = 1;
|
||||
if ($op=="edit" || $op=="add"){
|
||||
require_once("lib/showform.php");
|
||||
addnav("Edit");
|
||||
addnav("Creature properties", "creatures.php?op=edit&creatureid=$id");
|
||||
addnav("Add");
|
||||
addnav("Add Another Creature", "creatures.php?op=add&level=$level");
|
||||
module_editor_navs("prefs-creatures", "creatures.php?op=edit&subop=module&creatureid=$id&module=");
|
||||
if ($subop == "module") {
|
||||
$module = httpget("module");
|
||||
rawoutput("<form action='creatures.php?op=save&subop=module&creatureid=$id&module=$module' method='POST'>");
|
||||
module_objpref_edit("creatures", $module, $id);
|
||||
rawoutput("</form>");
|
||||
addnav("", "creatures.php?op=save&subop=module&creatureid=$id&module=$module");
|
||||
} else {
|
||||
if ($op=="edit" && $id!=""){
|
||||
$sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE creatureid=$id";
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)<>1){
|
||||
output("`4Error`0, that creature was not found!");
|
||||
}else{
|
||||
$row = db_fetch_assoc($result);
|
||||
}
|
||||
$level = $row['creaturelevel'];
|
||||
} else {
|
||||
$row = array("creatureid"=>0,"creaturelevel"=>$level);
|
||||
}
|
||||
$form = array(
|
||||
"Creature Properties,title",
|
||||
"creatureid"=>"Creature id,hidden",
|
||||
"creaturename"=>"Creature Name",
|
||||
"creatureweapon"=>"Weapon",
|
||||
"creaturewin"=>"Win Message (Displayed when the creature kills the player)",
|
||||
"creaturelose"=>"Death Message (Displayed when the creature is killed by the player)",
|
||||
// 18 to make a non-forest available monster
|
||||
// (ie, graveyard only)_
|
||||
"creaturelevel"=>"Level,range,1,18,1",
|
||||
"forest"=>"Creature is in forest?,bool",
|
||||
"graveyard"=>"Creature is in graveyard?,bool",
|
||||
);
|
||||
if ($session['user']['superuser'] & SU_MEGAUSER || $session['user']['superuser'] & SU_RAW_SQL) {
|
||||
$form["creatureaiscript"] = "Creature's A.I.,textarearesizeable";
|
||||
}
|
||||
rawoutput("<form action='creatures.php?op=save' method='POST'>");
|
||||
showform($form, $row);
|
||||
rawoutput("</form>");
|
||||
addnav("","creatures.php?op=save");
|
||||
}
|
||||
}else{
|
||||
$module = httpget("module");
|
||||
rawoutput("<form action='mounts.php?op=save&subop=module&creatureid=$id&module=$module' method='POST'>");
|
||||
module_objpref_edit("creatures", $module, $id);
|
||||
rawoutput("</form>");
|
||||
addnav("", "creatures.php?op=save&subop=module&creatureid=$id&module=$module");
|
||||
}
|
||||
addnav("Navigation");
|
||||
addnav("Return to the creature editor","creatures.php?level=$level");
|
||||
}
|
||||
page_footer();
|
||||
?>
|
15
lotgd-web/lotgd/cron.php
Executable file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
define("ALLOW_ANONYMOUS",true);
|
||||
//enter your directory HERE! i.e. /home/myname/lotgd
|
||||
$dir='/yourdir';
|
||||
//end of admin modifications
|
||||
chdir($dir);
|
||||
require_once("common.php");
|
||||
savesetting("newdaySemaphore",gmdate("Y-m-d H:i:s"));
|
||||
if ($dir!='') {
|
||||
require("lib/newday/newday_runonce.php");
|
||||
}
|
||||
/* Prevent execution if no value has been entered... if it is a wrong value, it will still break!*/
|
||||
|
||||
?>
|
10
lotgd-web/lotgd/dbconnect.php
Executable file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
//This file automatically created by installer.php on Aug 13, 2020 03:53 am
|
||||
$DB_HOST = 'lotgd-db';
|
||||
$DB_USER = 'root';
|
||||
$DB_PASS = 'lotgd';
|
||||
$DB_NAME = 'lotgd';
|
||||
$DB_PREFIX = '';
|
||||
$DB_USEDATACACHE = 0;
|
||||
$DB_DATACACHEPATH = '';
|
||||
?>
|
172
lotgd-web/lotgd/donators.php
Executable file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/systemmail.php");
|
||||
|
||||
check_su_access(SU_EDIT_DONATIONS);
|
||||
|
||||
tlschema("donation");
|
||||
|
||||
page_header("Donator's Page");
|
||||
require_once("lib/superusernav.php");
|
||||
superusernav();
|
||||
|
||||
|
||||
$ret=httpget('ret');
|
||||
$return = cmd_sanitize($ret);
|
||||
$return = substr($return,strrpos($return,"/")+1);
|
||||
tlschema("nav");
|
||||
addnav("Return whence you came",$return);
|
||||
tlschema();
|
||||
|
||||
$add = translate_inline("Add Donation");
|
||||
rawoutput("<form action='donators.php?op=add1&ret=".rawurlencode($ret)."' method='POST'>");
|
||||
addnav("","donators.php?op=add1&ret=".rawurlencode($ret)."");
|
||||
$name = httppost("name");
|
||||
if ($name=="") $name = httpget("name");
|
||||
$amt = httppost("amt");
|
||||
if ($amt=="") $amt = httpget("amt");
|
||||
$reason = httppost("reason");
|
||||
if ($reason=="") $reason = httpget("reason");
|
||||
$txnid = httppost("txnid");
|
||||
if ($txnid=="") $txnid = httpget("txnid");
|
||||
if ($reason == "") $reason = translate_inline("manual donation entry");
|
||||
|
||||
|
||||
output("`bAdd Donation Points:`b`n");
|
||||
output("Character: ");
|
||||
rawoutput("<input name='name' value=\"".htmlentities($name, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
|
||||
output("`nPoints: ");
|
||||
rawoutput("<input name='amt' size='3' value=\"".htmlentities($amt, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
|
||||
output("`nReason: ");
|
||||
rawoutput("<input name='reason' size='30' value=\"".htmlentities($reason, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
|
||||
rawoutput("<input type='hidden' name='txnid' value=\"".htmlentities($txnid, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\">");
|
||||
output_notl("`n");
|
||||
if ($txnid>"") output("For transaction: %s`n",$txnid);
|
||||
rawoutput("<input type='submit' class='button' value='$add'>");
|
||||
rawoutput("</form>");
|
||||
|
||||
addnav("Donations");
|
||||
if (($session['user']['superuser'] & SU_EDIT_PAYLOG) &&
|
||||
file_exists("paylog.php")){
|
||||
addnav("Payment Log","paylog.php");
|
||||
}
|
||||
$op = httpget('op');
|
||||
if ($op=="add2"){
|
||||
$id = httpget('id');
|
||||
$amt = httpget('amt');
|
||||
$reason = httpget('reason');
|
||||
|
||||
$sql="SELECT name FROM ".db_prefix("accounts")." WHERE acctid=$id;";
|
||||
$result=db_query($sql);
|
||||
$row=db_fetch_assoc($result);
|
||||
output("%s donation points added to %s`0, reason: `^%s`0",$amt,$row['name'],$reason);
|
||||
|
||||
$txnid = httpget("txnid");
|
||||
$ret = httpget('ret');
|
||||
if ($id==$session['user']['acctid']){
|
||||
$session['user']['donation']+=$amt;
|
||||
}
|
||||
if ($txnid > ""){
|
||||
$result = modulehook("donation_adjustments",array("points"=>$amt,"amount"=>$amt/100,"acctid"=>$id,"messages"=>array()));
|
||||
$points = $result['points'];
|
||||
if (!is_array($result['messages'])){
|
||||
$result['messages'] = array($result['messages']);
|
||||
}
|
||||
foreach($result['messages'] as $messageid=>$message){
|
||||
debuglog($message,false,$id,"donation",0,false);
|
||||
}
|
||||
}else{
|
||||
$points = $amt;
|
||||
}
|
||||
// ok to execute when this is the current user, they'll overwrite the
|
||||
// value at the end of their page hit, and this will allow the display
|
||||
// table to update in real time.
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET donation=donation+'$points' WHERE acctid='$id'";
|
||||
db_query($sql);
|
||||
modulehook("donation", array("id"=>$id, "amt"=>$points, "manual"=>($txnid>""?false:true)));
|
||||
|
||||
if ($txnid>""){
|
||||
$sql = "UPDATE ".db_prefix("paylog")." SET acctid='$id', processed=1 WHERE txnid='$txnid'";
|
||||
db_query($sql);
|
||||
debuglog("Received donator points for donating -- Credited manually [$reason]",false,$id,"donation",$points,false);
|
||||
redirect("paylog.php");
|
||||
}else{
|
||||
debuglog("Received donator points -- Manually assigned, not based on a known dollar donation [$reason]",false,$id,"donation",$amt,false);
|
||||
}
|
||||
if ($points == 1) {
|
||||
systemmail($id,array("Donation Point Added"),array("`2You have received a donation point for %s.",$reason));
|
||||
}else {
|
||||
systemmail($id,array("Donation Points Added"),array("`2You have received %d donation points for %s.",$points,$reason));
|
||||
}
|
||||
httpset('op', "");
|
||||
$op = "";
|
||||
}
|
||||
|
||||
if ($op==""){
|
||||
$sql = "SELECT name,donation,donationspent FROM " . db_prefix("accounts") . " WHERE donation>0 ORDER BY donation DESC LIMIT 25";
|
||||
$result = db_query($sql);
|
||||
|
||||
$name = translate_inline("Name");
|
||||
$points = translate_inline("Points");
|
||||
$spent = translate_inline("Spent");
|
||||
|
||||
rawoutput("<table border='0' cellpadding='3' cellspacing='1' bgcolor='#999999'>");
|
||||
rawoutput("<tr class='trhead'><td>$name</td><td>$points</td><td>$spent</td></tr>");
|
||||
$number=db_num_rows($result);
|
||||
for ($i=0;$i<$number;$i++){
|
||||
$row = db_fetch_assoc($result);
|
||||
rawoutput("<tr class='".($i%2?"trlight":"trdark")."'>");
|
||||
rawoutput("<td>");
|
||||
output_notl("`^%s`0",$row['name']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl("`@%s`0", number_format($row['donation']));
|
||||
rawoutput("</td><td>");
|
||||
output_notl("`%%s`0", number_format($row['donationspent']));
|
||||
rawoutput("</td>");
|
||||
rawoutput("</tr>");
|
||||
}
|
||||
rawoutput("</table>",true);
|
||||
}else if ($op=="add1"){
|
||||
$search="%";
|
||||
$name = httppost('name');
|
||||
if ($name=='') $name = httpget('name');
|
||||
for ($i=0;$i<strlen($name);$i++){
|
||||
$z = substr($name, $i, 1);
|
||||
if ($z == "'") $z = "\\'";
|
||||
$search.=$z."%";
|
||||
}
|
||||
$sql = "SELECT name,acctid,donation,donationspent FROM " . db_prefix("accounts") . " WHERE login LIKE '$search' or name LIKE '$search' LIMIT 100";
|
||||
$result = db_query($sql);
|
||||
$ret = httpget('ret');
|
||||
$amt = httppost('amt');
|
||||
if ($amt=='') $amt = httpget("amt");
|
||||
$reason = httppost("reason");
|
||||
if ($reason=="") $reason = httpget("reason");
|
||||
$txnid = httppost('txnid');
|
||||
if ($txnid=='') $txnid = httpget("txnid");
|
||||
output("Confirm the addition of %s points to:`n",$amt);
|
||||
if ($reason) output("(Reason: `^`b`i%s`i`b`0)`n`n",$reason);
|
||||
$number=db_num_rows($result);
|
||||
for ($i=0;$i<$number;$i++){
|
||||
$row = db_fetch_assoc($result);
|
||||
if ($ret!=""){
|
||||
rawoutput("<a href='donators.php?op=add2&id={$row['acctid']}&amt=$amt&ret=".rawurlencode($ret)."&reason=".rawurlencode($reason)."'>");
|
||||
}else{
|
||||
rawoutput("<a href='donators.php?op=add2&id={$row['acctid']}&amt=$amt&reason=".rawurlencode($reason)."&txnid=$txnid'>");
|
||||
}
|
||||
output_notl("%s (%s/%s)", $row['name'], $row['donation'], $row['donationspent']);
|
||||
rawoutput("</a>");
|
||||
output_notl("`n");
|
||||
if ($ret!=""){
|
||||
addnav("","donators.php?op=add2&id={$row['acctid']}&amt=$amt&ret=".rawurlencode($ret)."&reason=".rawurlencode($reason));
|
||||
}else{
|
||||
addnav("","donators.php?op=add2&id={$row['acctid']}&amt=$amt&reason=".rawurlencode($reason)."&txnid=$txnid");
|
||||
}
|
||||
}
|
||||
}
|
||||
page_footer();
|
||||
?>
|
300
lotgd-web/lotgd/dragon.php
Executable file
@ -0,0 +1,300 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/fightnav.php");
|
||||
require_once("lib/titles.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/buffs.php");
|
||||
require_once("lib/taunt.php");
|
||||
require_once("lib/names.php");
|
||||
|
||||
tlschema("dragon");
|
||||
$battle = false;
|
||||
page_header("The Green Dragon!");
|
||||
$op = httpget('op');
|
||||
if ($op==""){
|
||||
if (!httpget('nointro')) {
|
||||
output("`\$Fighting down every urge to flee, you cautiously enter the cave entrance, intent on catching the great green dragon sleeping, so that you might slay it with a minimum of pain.");
|
||||
output("Sadly, this is not to be the case, for as you round a corner within the cave you discover the great beast sitting on its haunches on a huge pile of gold, picking its teeth with a rib.");
|
||||
}
|
||||
$badguy = array(
|
||||
"creaturename"=>translate_inline("`@The Green Dragon`0"),
|
||||
"creaturelevel"=>18,
|
||||
"creatureweapon"=>translate_inline("Great Flaming Maw"),
|
||||
"creatureattack"=>45,
|
||||
"creaturedefense"=>25,
|
||||
"creaturehealth"=>300,
|
||||
"diddamage"=>0,
|
||||
"type"=>"dragon");
|
||||
|
||||
//toughen up each consecutive dragon.
|
||||
// First, find out how each dragonpoint has been spent and count those
|
||||
// used on attack and defense.
|
||||
// Coded by JT, based on collaboration with MightyE
|
||||
$points = 0;
|
||||
restore_buff_fields();
|
||||
reset($session['user']['dragonpoints']);
|
||||
while(list($key,$val)=each($session['user']['dragonpoints'])){
|
||||
if ($val=="at" || $val == "de") $points++;
|
||||
}
|
||||
|
||||
// Now, add points for hitpoint buffs that have been done by the dragon
|
||||
// or by potions!
|
||||
$points += (int)(($session['user']['maxhitpoints'] - 150)/5);
|
||||
|
||||
$points = round($points*.75,0);
|
||||
|
||||
$atkflux = e_rand(0, $points);
|
||||
$defflux = e_rand(0,$points-$atkflux);
|
||||
|
||||
$hpflux = ($points - ($atkflux+$defflux)) * 5;
|
||||
debug("DEBUG: $points modification points total.`0`n");
|
||||
debug("DEBUG: +$atkflux allocated to attack.`n");
|
||||
debug("DEBUG: +$defflux allocated to defense.`n");
|
||||
debug("DEBUG: +". ($hpflux/5) . "*5 to hitpoints.`0`n");
|
||||
calculate_buff_fields();
|
||||
$badguy['creatureattack']+=$atkflux;
|
||||
$badguy['creaturedefense']+=$defflux;
|
||||
$badguy['creaturehealth']+=$hpflux;
|
||||
|
||||
$badguy = modulehook("buffdragon", $badguy);
|
||||
|
||||
$session['user']['badguy']=createstring($badguy);
|
||||
$battle=true;
|
||||
}elseif($op=="prologue1"){
|
||||
output("`@Victory!`n`n");
|
||||
$flawless = (int)(httpget('flawless'));
|
||||
if ($flawless) {
|
||||
output("`b`c`&~~ Flawless Fight ~~`0`c`b`n`n");
|
||||
}
|
||||
output("`2Before you, the great dragon lies immobile, its heavy breathing like acid to your lungs.");
|
||||
output("You are covered, head to toe, with the foul creature's thick black blood.");
|
||||
output("The great beast begins to move its mouth. You spring back, angry at yourself for having been fooled by its ploy of death, and watch for its huge tail to come sweeping your way.");
|
||||
output("But it does not.");
|
||||
output("Instead the dragon begins to speak.`n`n");
|
||||
output("\"`^Why have you come here mortal? What have I done to you?`2\" it says with obvious effort.");
|
||||
output("\"`^Always my kind are sought out to be destroyed. Why? Because of stories from distant lands that tell of dragons preying on the weak? I tell you that these stories come only from misunderstanding of us, and not because we devour your children.`2\"");
|
||||
output("The beast pauses, breathing heavily before continuing, \"`^I will tell you a secret. Behind me now are my eggs. They will hatch, and the young will battle each other. Only one will survive, but she will be the strongest. She will quickly grow, and be as powerful as me.`2\"");
|
||||
output("Breath comes shorter and shallower for the great beast.`n`n");
|
||||
output("\"`#Why do you tell me this? Don't you know that I will destroy your eggs?`2\" you ask.`n`n");
|
||||
output("\"`^No, you will not, for I know of one more secret that you do not.`2\"`n`n");
|
||||
output("\"`#Pray tell oh mighty beast!`2\"`n`n");
|
||||
output("The great beast pauses, gathering the last of its energy. \"`^Your kind cannot tolerate the blood of my kind. Even if you survive, you will be a feeble creature, barely able to hold a weapon, your mind blank of all that you have learned. No, you are no threat to my children, for you are already dead!`2\"`n`n");
|
||||
output("Realizing that already the edges of your vision are a little dim, you flee from the cave, bound to reach the healer's hut before it is too late.");
|
||||
output("Somewhere along the way you lose your weapon, and finally you trip on a stone in a shallow stream, sight now limited to only a small circle that seems to float around your head.");
|
||||
output("As you lay, staring up through the trees, you think that nearby you can hear the sounds of the village.");
|
||||
output("Your final thought is that although you defeated the dragon, you reflect on the irony that it defeated you.`n`n");
|
||||
output("As your vision winks out, far away in the dragon's lair, an egg shuffles to its side, and a small crack appears in its thick leathery skin.");
|
||||
|
||||
if ($flawless) {
|
||||
output("`n`nYou fall forward, and remember at the last moment that you at least managed to grab some of the dragon's treasure, so maybe it wasn't all a total loss.");
|
||||
}
|
||||
addnav("It is a new day","news.php");
|
||||
strip_all_buffs();
|
||||
$sql = "DESCRIBE " . db_prefix("accounts");
|
||||
$result = db_query($sql);
|
||||
|
||||
reset($session['user']['dragonpoints']);
|
||||
$dkpoints = 0;
|
||||
while(list($key,$val)=each($session['user']['dragonpoints'])){
|
||||
if ($val=="hp") $dkpoints+=5;
|
||||
}
|
||||
|
||||
restore_buff_fields();
|
||||
$hpgain = array(
|
||||
'total' => $session['user']['maxhitpoints'],
|
||||
'dkpoints' => $dkpoints,
|
||||
'extra' => $session['user']['maxhitpoints'] - $dkpoints -
|
||||
($session['user']['level']*10),
|
||||
'base' => $dkpoints + ($session['user']['level'] * 10),
|
||||
);
|
||||
$hpgain = modulehook("hprecalc", $hpgain);
|
||||
calculate_buff_fields();
|
||||
|
||||
$nochange=array("acctid"=>1
|
||||
,"name"=>1
|
||||
,"sex"=>1
|
||||
,"password"=>1
|
||||
,"marriedto"=>1
|
||||
,"title"=>1
|
||||
,"login"=>1
|
||||
,"dragonkills"=>1
|
||||
,"locked"=>1
|
||||
,"loggedin"=>1
|
||||
,"superuser"=>1
|
||||
,"gems"=>1
|
||||
,"hashorse"=>1
|
||||
,"gentime"=>1
|
||||
,"gentimecount"=>1
|
||||
,"lastip"=>1
|
||||
,"uniqueid"=>1
|
||||
,"dragonpoints"=>1
|
||||
,"laston"=>1
|
||||
,"prefs"=>1
|
||||
,"lastmotd"=>1
|
||||
,"emailaddress"=>1
|
||||
,"emailvalidation"=>1
|
||||
,"gensize"=>1
|
||||
,"bestdragonage"=>1
|
||||
,"dragonage"=>1
|
||||
,"donation"=>1
|
||||
,"donationspent"=>1
|
||||
,"donationconfig"=>1
|
||||
,"bio"=>1
|
||||
,"charm"=>1
|
||||
,"banoverride"=>1
|
||||
,"referer"=>1
|
||||
,"refererawarded"=>1
|
||||
,"ctitle"=>1
|
||||
,"beta"=>1
|
||||
,"clanid"=>1
|
||||
,"clanrank"=>1
|
||||
,"clanjoindate"=>1
|
||||
,"regdate"=>1);
|
||||
|
||||
$nochange = modulehook("dk-preserve", $nochange);
|
||||
$session['user']['dragonkills']++;
|
||||
|
||||
$session['user']['dragonage'] = $session['user']['age'];
|
||||
if ($session['user']['dragonage'] < $session['user']['bestdragonage'] ||
|
||||
$session['user']['bestdragonage'] == 0) {
|
||||
$session['user']['bestdragonage'] = $session['user']['dragonage'];
|
||||
}
|
||||
$number=db_num_rows($result);
|
||||
for ($i=0;$i<$number;$i++){
|
||||
$row = db_fetch_assoc($result);
|
||||
if (array_key_exists($row['Field'],$nochange) &&
|
||||
$nochange[$row['Field']]){
|
||||
}elseif($row['Field'] == "location"){
|
||||
$session['user'][$row['Field']] = getsetting("villagename", LOCATION_FIELDS);
|
||||
}else{
|
||||
$session['user'][$row['Field']] = $row["Default"];
|
||||
}
|
||||
}
|
||||
$session['user']['gold'] = getsetting("newplayerstartgold",50);
|
||||
|
||||
$newtitle = get_dk_title($session['user']['dragonkills'], $session['user']['sex']);
|
||||
|
||||
$restartgold = $session['user']['gold'] +
|
||||
getsetting("newplayerstartgold", 50)*$session['user']['dragonkills'];
|
||||
$restartgems = 0;
|
||||
if ($restartgold > getsetting("maxrestartgold", 300)) {
|
||||
$restartgold = getsetting("maxrestartgold", 300);
|
||||
$restartgems = max(0,($session['user']['dragonkills'] -
|
||||
(getsetting("maxrestartgold", 300)/
|
||||
getsetting("newplayerstartgold", 50)) - 1));
|
||||
if ($restartgems > getsetting("maxrestartgems", 10)) {
|
||||
$restartgems = getsetting("maxrestartgems", 10);
|
||||
}
|
||||
}
|
||||
$session['user']['gold'] = $restartgold;
|
||||
$session['user']['gems'] += $restartgems;
|
||||
|
||||
if ($flawless) {
|
||||
$session['user']['gold'] += 3*getsetting("newplayerstartgold",50);
|
||||
$session['user']['gems'] += 1;
|
||||
}
|
||||
|
||||
$session['user']['maxhitpoints'] = 10 + $hpgain['dkpoints'] +
|
||||
$hpgain['extra'];
|
||||
$session['user']['hitpoints']=$session['user']['maxhitpoints'];
|
||||
|
||||
// Sanity check
|
||||
if ($session['user']['maxhitpoints'] < 1) {
|
||||
// Yes, this is a freaking hack.
|
||||
die("ACK!! Somehow this user would end up perma-dead.. Not allowing DK to proceed! Notify admin and figure out why this would happen so that it can be fixed before DK can continue.");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Set the new title.
|
||||
$newname = change_player_title($newtitle);
|
||||
$session['user']['title'] = $newtitle;
|
||||
$session['user']['name'] = $newname;
|
||||
|
||||
reset($session['user']['dragonpoints']);
|
||||
while(list($key,$val)=each($session['user']['dragonpoints'])){
|
||||
if ($val=="at"){
|
||||
$session['user']['attack']++;
|
||||
}
|
||||
if ($val=="de"){
|
||||
$session['user']['defense']++;
|
||||
}
|
||||
}
|
||||
$session['user']['laston']=date("Y-m-d H:i:s",strtotime("-1 day"));
|
||||
$session['user']['slaydragon'] = 1;
|
||||
$companions = array();
|
||||
$session['user']['companions'] = array();
|
||||
|
||||
output("`n`nYou wake up in the midst of some trees. Nearby you hear the sounds of a village.");
|
||||
output("Dimly you remember that you are a new warrior, and something of a dangerous Green Dragon that is plaguing the area. You decide you would like to earn a name for yourself by perhaps some day confronting this vile creature.");
|
||||
|
||||
// allow explanative text as well.
|
||||
modulehook("dragonkilltext");
|
||||
|
||||
$regname = get_player_basename();
|
||||
output("`n`n`^You are now known as `&%s`^!!",$session['user']['name']);
|
||||
if ($session['user']['dragonkills'] == 1) {
|
||||
addnews("`#%s`# has earned the title `&%s`# for having slain the `@Green Dragon`& `^%s`# time!",$regname,$session['user']['title'],$session['user']['dragonkills']);
|
||||
output("`n`n`&Because you have slain the dragon %s time, you start with some extras. You also keep additional permanent hitpoints you've earned.`n",$session['user']['dragonkills']);
|
||||
} else {
|
||||
addnews("`#%s`# has earned the title `&%s`# for having slain the `@Green Dragon`& `^%s`# times!",$regname,$session['user']['title'],$session['user']['dragonkills']);
|
||||
output("`n`n`&Because you have slain the dragon %s times, you start with some extras. You also keep additional permanent hitpoints you've earned.`n",$session['user']['dragonkills']);
|
||||
}
|
||||
$session['user']['charm']+=5;
|
||||
output("`^You gain FIVE charm points for having defeated the dragon!`n");
|
||||
debuglog("slew the dragon and starts with {$session['user']['gold']} gold and {$session['user']['gems']} gems");
|
||||
|
||||
// Moved this hear to make some things easier.
|
||||
modulehook("dragonkill", array());
|
||||
invalidatedatacache("list.php-warsonline");
|
||||
}
|
||||
|
||||
if ($op=="run"){
|
||||
output("The creature's tail blocks the only exit to its lair!");
|
||||
$op="fight";
|
||||
httpset('op', 'fight');
|
||||
}
|
||||
if ($op=="fight" || $op=="run"){
|
||||
$battle=true;
|
||||
}
|
||||
if ($battle){
|
||||
require_once("battle.php");
|
||||
|
||||
if ($victory){
|
||||
$flawless = 0;
|
||||
if ($badguy['diddamage'] != 1) $flawless = 1;
|
||||
// $session['user']['dragonkills']++;
|
||||
output("`&With a mighty final blow, `@The Green Dragon`& lets out a tremendous bellow and falls at your feet, dead at last.");
|
||||
addnews("`&%s has slain the hideous creature known as `@The Green Dragon`&. All across the land, people rejoice!",$session['user']['name']);
|
||||
tlschema("nav");
|
||||
addnav("Continue","dragon.php?op=prologue1&flawless=$flawless");
|
||||
tlschema();
|
||||
}else{
|
||||
if($defeat){
|
||||
tlschema("nav");
|
||||
addnav("Daily news","news.php");
|
||||
tlschema();
|
||||
$taunt = select_taunt_array();
|
||||
if ($session['user']['sex']){
|
||||
addnews("`%%s`5 has been slain when she encountered `@The Green Dragon`5!!! Her bones now litter the cave entrance, just like the bones of those who came before.`n%s",$session['user']['name'],$taunt);
|
||||
}else{
|
||||
addnews("`%%s`5 has been slain when he encountered `@The Green Dragon`5!!! His bones now litter the cave entrance, just like the bones of those who came before.`n%s",$session['user']['name'],$taunt);
|
||||
}
|
||||
$session['user']['alive']=false;
|
||||
debuglog("lost {$session['user']['gold']} gold when they were slain");
|
||||
$session['user']['gold']=0;
|
||||
$session['user']['hitpoints']=0;
|
||||
output("`b`&You have been slain by `@The Green Dragon`&!!!`n");
|
||||
output("`4All gold on hand has been lost!`n");
|
||||
output("You may begin fighting again tomorrow.");
|
||||
|
||||
page_footer();
|
||||
}else{
|
||||
fightnav(true,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
page_footer();
|
||||
?>
|
BIN
lotgd-web/lotgd/favicon.ico
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
lotgd-web/lotgd/favicon.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
310
lotgd-web/lotgd/forest.php
Executable file
@ -0,0 +1,310 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/forest.php");
|
||||
require_once("lib/fightnav.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/taunt.php");
|
||||
require_once("lib/events.php");
|
||||
require_once("lib/battle-skills.php");
|
||||
|
||||
tlschema("forest");
|
||||
|
||||
$fight = false;
|
||||
page_header("The Forest");
|
||||
$dontdisplayforestmessage=handle_event("forest");
|
||||
|
||||
$op = httpget("op");
|
||||
|
||||
$battle = false;
|
||||
|
||||
if ($op=="run"){
|
||||
if (e_rand()%3 == 0){
|
||||
output ("`c`b`&You have successfully fled your opponent!`0`b`c`n");
|
||||
$op="";
|
||||
httpset('op', "");
|
||||
unsuspend_buffs();
|
||||
foreach($companions as $index => $companion) {
|
||||
if(isset($companion['expireafterfight']) && $companion['expireafterfight']) {
|
||||
unset($companions[$index]);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
output("`c`b`\$You failed to flee your opponent!`0`b`c");
|
||||
}
|
||||
}
|
||||
|
||||
if ($op=="dragon"){
|
||||
require_once("lib/partner.php");
|
||||
addnav("Enter the cave","dragon.php");
|
||||
addnav("Run away like a baby","inn.php?op=fleedragon");
|
||||
output("`\$You approach the blackened entrance of a cave deep in the forest, though the trees are scorched to stumps for a hundred yards all around.");
|
||||
output("A thin tendril of smoke escapes the roof of the cave's entrance, and is whisked away by a suddenly cold and brisk wind.");
|
||||
output("The mouth of the cave lies up a dozen feet from the forest floor, set in the side of a cliff, with debris making a conical ramp to the opening.");
|
||||
output("Stalactites and stalagmites near the entrance trigger your imagination to inspire thoughts that the opening is really the mouth of a great leech.`n`n");
|
||||
output("You cautiously approach the entrance of the cave, and as you do, you hear, or perhaps feel a deep rumble that lasts thirty seconds or so, before silencing to a breeze of sulfur-air which wafts out of the cave.");
|
||||
output("The sound starts again, and stops again in a regular rhythm.`n`n");
|
||||
output("You clamber up the debris pile leading to the mouth of the cave, your feet crunching on the apparent remains of previous heroes, or perhaps hors d'oeuvres.`n`n");
|
||||
output("Every instinct in your body wants to run, and run quickly, back to the warm inn, and the even warmer %s`\$.", get_partner());
|
||||
output("What do you do?`0");
|
||||
$session['user']['seendragon']=1;
|
||||
}
|
||||
|
||||
if ($op=="search"){
|
||||
checkday();
|
||||
if ($session['user']['turns']<=0){
|
||||
output("`\$`bYou are too tired to search the forest any longer today. Perhaps tomorrow you will have more energy.`b`0");
|
||||
$op="";
|
||||
httpset('op', "");
|
||||
}else{
|
||||
modulehook("forestsearch", array());
|
||||
$args = array(
|
||||
'soberval'=>0.9,
|
||||
'sobermsg'=>"`&Faced with the prospect of death, you sober up a little.`n",
|
||||
'schema'=>'forest');
|
||||
modulehook("soberup", $args);
|
||||
if (module_events("forest", getsetting("forestchance", 15)) != 0) {
|
||||
if (!checknavs()) {
|
||||
// If we're showing the forest, make sure to reset the special
|
||||
// and the specialmisc
|
||||
$session['user']['specialinc'] = "";
|
||||
$session['user']['specialmisc'] = "";
|
||||
$dontdisplayforestmessage=true;
|
||||
$op = "";
|
||||
httpset("op", "");
|
||||
} else {
|
||||
page_footer();
|
||||
}
|
||||
}else{
|
||||
$session['user']['turns']--;
|
||||
$battle=true;
|
||||
if (e_rand(0,2)==1){
|
||||
$plev = (e_rand(1,5)==1?1:0);
|
||||
$nlev = (e_rand(1,3)==1?1:0);
|
||||
}else{
|
||||
$plev=0;
|
||||
$nlev=0;
|
||||
}
|
||||
$type = httpget('type');
|
||||
if ($type=="slum"){
|
||||
$nlev++;
|
||||
output("`\$You head for the section of forest you know to contain foes that you're a bit more comfortable with.`0`n");
|
||||
}
|
||||
if ($type=="thrill"){
|
||||
$plev++;
|
||||
output("`\$You head for the section of forest which contains creatures of your nightmares, hoping to find one of them injured.`0`n");
|
||||
}
|
||||
$extrabuff = 0;
|
||||
if ($type=="suicide"){
|
||||
if ($session['user']['level'] <= 7) {
|
||||
$plev += 1;
|
||||
$extrabuf = .25;
|
||||
} elseif ($session['user']['level'] < 14) {
|
||||
$plev+=2;
|
||||
$extrabuf = 0;
|
||||
} else {
|
||||
$plev++;
|
||||
$extrabuff = .4;
|
||||
}
|
||||
output("`\$You head for the section of forest which contains creatures of your nightmares, looking for the biggest and baddest ones there.`0`n");
|
||||
}
|
||||
$multi = 1;
|
||||
$targetlevel = ($session['user']['level'] + $plev - $nlev );
|
||||
$mintargetlevel = $targetlevel;
|
||||
if (getsetting("multifightdk", 10) <= $session['user']['dragonkills']) {
|
||||
if (e_rand(1,100) <= getsetting("multichance", 25)) {
|
||||
$multi = e_rand(getsetting("multibasemin", 2),getsetting("multibasemax", 3));
|
||||
if ($type=="slum") {
|
||||
$multi -= e_rand(getsetting("multislummin", 0),getsetting("multislummax", 1));
|
||||
if (e_rand(0,1)) {
|
||||
$mintargetlevel = $targetlevel - 1;
|
||||
} else {
|
||||
$mintargetlevel = $targetlevel - 2;
|
||||
}
|
||||
} else if ($type == "thrill") {
|
||||
$multi += e_rand(getsetting("multithrillmin", 1),getsetting("multithrillmax", 2));
|
||||
if (e_rand(0,1)) {
|
||||
$targetlevel++;
|
||||
$mintargetlevel = $targetlevel - 1;
|
||||
} else {
|
||||
$mintargetlevel = $targetlevel-1;
|
||||
}
|
||||
} else if ($type == "suicide") {
|
||||
$multi += e_rand(getsetting("multisuimin", 2),getsetting("multisuimax", 4));
|
||||
if (e_rand(0,1)) {
|
||||
$mintargetlevel = $targetlevel - 1;
|
||||
} else {
|
||||
$targetlevel++;
|
||||
$mintargetlevel = $targetlevel - 1;
|
||||
}
|
||||
}
|
||||
$multi = min($multi, $session['user']['level']);
|
||||
}
|
||||
} else {
|
||||
$multi = 1;
|
||||
}
|
||||
$multi = max(1, $multi);
|
||||
if ($targetlevel<1) $targetlevel=1;
|
||||
if ($mintargetlevel<1) $mintargetlevel=1;
|
||||
if ($mintargetlevel > $targetlevel) $mintargetlevel = $targetlevel;
|
||||
if ($targetlevel>17) {
|
||||
$multi += $targetlevel - 17;
|
||||
$targetlevel=17;
|
||||
}
|
||||
debug("Creatures: $multi Targetlevel: $targetlevel Mintargetlevel: $mintargetlevel");
|
||||
if ($multi > 1) {
|
||||
$packofmonsters = (bool)(e_rand(0,5) == 0 && getsetting("allowpackofmonsters", true)); // true or false
|
||||
switch($packofmonsters) {
|
||||
case false:
|
||||
$sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE creaturelevel <= $targetlevel AND creaturelevel >= $mintargetlevel AND forest=1 ORDER BY rand(".e_rand().") LIMIT $multi";
|
||||
break;
|
||||
case true:
|
||||
$sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE creaturelevel <= $targetlevel AND creaturelevel >= $mintargetlevel AND forest=1 ORDER BY rand(".e_rand().") LIMIT 1";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE creaturelevel <= $targetlevel AND creaturelevel >= $mintargetlevel AND forest=1 ORDER BY rand(".e_rand().") LIMIT 1";
|
||||
$packofmonsters = 0;
|
||||
}
|
||||
$result = db_query($sql);
|
||||
restore_buff_fields();
|
||||
if (db_num_rows($result) == 0) {
|
||||
// There is nothing in the database to challenge you, let's
|
||||
// give you a doppleganger.
|
||||
$badguy = array();
|
||||
$badguy['creaturename']=
|
||||
"An evil doppleganger of ".$session['user']['name'];
|
||||
$badguy['creatureweapon']=$session['user']['weapon'];
|
||||
$badguy['creaturelevel']=$session['user']['level'];
|
||||
$badguy['creaturegold']=0;
|
||||
$badguy['creatureexp'] =
|
||||
round($session['user']['experience']/10, 0);
|
||||
$badguy['creaturehealth']=$session['user']['maxhitpoints'];
|
||||
$badguy['creatureattack']=$session['user']['attack'];
|
||||
$badguy['creaturedefense']=$session['user']['defense'];
|
||||
$stack[] = $badguy;
|
||||
} else {
|
||||
require_once("lib/forestoutcomes.php");
|
||||
if ($packofmonsters == true) {
|
||||
$initialbadguy = db_fetch_assoc($result);
|
||||
$prefixs = array("Elite","Dangerous","Lethal","Savage","Deadly","Malevolent","Malignant");
|
||||
for($i=0;$i<$multi;$i++) {
|
||||
$initialbadguy['creaturelevel'] = e_rand($mintargetlevel, $targetlevel);
|
||||
$initialbadguy['playerstarthp']=$session['user']['hitpoints'];
|
||||
$initialbadguy['diddamage']=0;
|
||||
$badguy = buffbadguy($initialbadguy);
|
||||
if ($type == "thrill") {
|
||||
// 10% more experience
|
||||
$badguy['creatureexp'] = round($badguy['creatureexp']*1.1, 0);
|
||||
// 10% more gold
|
||||
$badguy['creaturegold'] = round($badguy['creaturegold']*1.1, 0);
|
||||
}
|
||||
if ($type == "suicide") {
|
||||
// Okay, suicide fights give even more rewards, but
|
||||
// are much harder
|
||||
// 25% more experience
|
||||
$badguy['creatureexp'] = round($badguy['creatureexp']*1.25, 0);
|
||||
// 25% more gold
|
||||
$badguy['creaturegold'] = round($badguy['creaturegold']*1.25, 0);
|
||||
// Now, make it tougher.
|
||||
$mul = 1.25 + $extrabuff;
|
||||
$badguy['creatureattack'] = round($badguy['creatureattack']*$mul, 0);
|
||||
$badguy['creaturedefense'] = round($badguy['creaturedefense']*$mul, 0);
|
||||
$badguy['creaturehealth'] = round($badguy['creaturehealth']*$mul, 0);
|
||||
// And mark it as an 'elite' troop.
|
||||
$prefixs = translate_inline($prefixs);
|
||||
$key = array_rand($prefixs);
|
||||
$prefix = $prefixs[$key];
|
||||
$badguy['creaturename'] = $prefix . " " . $badguy['creaturename'];
|
||||
}
|
||||
$stack[$i] = $badguy;
|
||||
}
|
||||
if ($multi > 1) {
|
||||
output("`2You encounter a group of `^%i`2 %s`2.`n`n", $multi, $badguy['creaturename']);
|
||||
}
|
||||
} else {
|
||||
while ($badguy = db_fetch_assoc($result)) {
|
||||
$badguy['playerstarthp']=$session['user']['hitpoints'];
|
||||
$badguy['diddamage']=0;
|
||||
$badguy = buffbadguy($badguy);
|
||||
// Okay, they are thrillseeking, let's give them a bit extra
|
||||
// exp and gold.
|
||||
if ($type == "thrill") {
|
||||
// 10% more experience
|
||||
$badguy['creatureexp'] = round($badguy['creatureexp']*1.1, 0);
|
||||
// 10% more gold
|
||||
$badguy['creaturegold'] = round($badguy['creaturegold']*1.1, 0);
|
||||
}
|
||||
if ($type == "suicide") {
|
||||
// Okay, suicide fights give even more rewards, but
|
||||
// are much harder
|
||||
// 25% more experience
|
||||
$badguy['creatureexp'] = round($badguy['creatureexp']*1.25, 0);
|
||||
// 25% more gold
|
||||
$badguy['creaturegold'] = round($badguy['creaturegold']*1.25, 0);
|
||||
// Now, make it tougher.
|
||||
$mul = 1.25 + $extrabuff;
|
||||
$badguy['creatureattack'] = round($badguy['creatureattack']*$mul, 0);
|
||||
$badguy['creaturedefense'] = round($badguy['creaturedefense']*$mul, 0);
|
||||
$badguy['creaturehealth'] = round($badguy['creaturehealth']*$mul, 0);
|
||||
// And mark it as an 'elite' troop.
|
||||
$prefixs = array("Elite","Dangerous","Lethal","Savage","Deadly","Malevolent","Malignant");
|
||||
$prefixs = translate_inline($prefixs);
|
||||
$key = array_rand($prefixs);
|
||||
$prefix = $prefixs[$key];
|
||||
$badguy['creaturename'] = $prefix . " " . $badguy['creaturename'];
|
||||
}
|
||||
$stack[] = $badguy;
|
||||
}
|
||||
}
|
||||
}
|
||||
calculate_buff_fields();
|
||||
$attackstack = array(
|
||||
"enemies"=>$stack,
|
||||
"options"=>array(
|
||||
"type"=>"forest"
|
||||
)
|
||||
);
|
||||
$session['user']['badguy']=createstring($attackstack);
|
||||
// If someone for any reason wanted to add a nav where the user cannot choose the number of rounds anymore
|
||||
// because they are already set in the nav itself, we need this here.
|
||||
// It will not break anything else. I hope.
|
||||
if(httpget('auto') != "") {
|
||||
httpset('op', 'fight');
|
||||
$op = 'fight';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($op=="fight" || $op=="run" || $op == "newtarget"){
|
||||
$battle=true;
|
||||
}
|
||||
|
||||
if ($battle){
|
||||
|
||||
require_once("battle.php");
|
||||
|
||||
if ($victory){
|
||||
require_once("lib/forestoutcomes.php");
|
||||
$op="";
|
||||
httpset('op', "");
|
||||
forestvictory($newenemies,isset($options['denyflawless'])?$options['denyflawless']:false);
|
||||
$dontdisplayforestmessage=true;
|
||||
}elseif($defeat){
|
||||
require_once("lib/forestoutcomes.php");
|
||||
forestdefeat($newenemies);
|
||||
}else{
|
||||
fightnav();
|
||||
}
|
||||
}
|
||||
|
||||
if ($op==""){
|
||||
// Need to pass the variable here so that we show the forest message
|
||||
// sometimes, but not others.
|
||||
forest($dontdisplayforestmessage);
|
||||
}
|
||||
page_footer();
|
||||
?>
|
71
lotgd-web/lotgd/gamelog.php
Executable file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
|
||||
// Written by Christian Rutsch
|
||||
|
||||
require_once("common.php");
|
||||
require_once("lib/http.php");
|
||||
|
||||
check_su_access(SU_EDIT_CONFIG);
|
||||
|
||||
tlschema("gamelog");
|
||||
|
||||
page_header("Game Log");
|
||||
addnav("Navigation");
|
||||
require_once("lib/superusernav.php");
|
||||
superusernav();
|
||||
|
||||
$category = httpget('cat');
|
||||
if ($category > "") {
|
||||
$cat = "&cat=$category";
|
||||
$sqlcat = "WHERE ".db_prefix("gamelog").".category = '$category'";
|
||||
} else {
|
||||
$cat='';
|
||||
$sqlcat='';
|
||||
}
|
||||
|
||||
$sql = "SELECT count(logid) AS c FROM ".db_prefix("gamelog")." $sqlcat";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
$max = $row['c'];
|
||||
|
||||
$start = (int)httpget('start');
|
||||
$sql = "SELECT ".db_prefix("gamelog").".*, ".db_prefix("accounts").".name AS name FROM ".db_prefix("gamelog")." LEFT JOIN ".db_prefix("accounts")." ON ".db_prefix("gamelog").".who = ".db_prefix("accounts").".acctid $sqlcat LIMIT $start,500";
|
||||
$next = $start+500;
|
||||
$prev = $start-500;
|
||||
addnav("Operations");
|
||||
addnav("Refresh", "gamelog.php?start=$start$cat");
|
||||
if ($category > "") addnav("View all", "gamelog.php");
|
||||
addnav("Game Log");
|
||||
if ($next < $max) {
|
||||
addnav("Next page","gamelog.php?start=$next$cat");
|
||||
}
|
||||
if ($start > 0) {
|
||||
addnav("Previous page", "gamelog.php?start=$prev$cat");
|
||||
}
|
||||
$result = db_query($sql);
|
||||
$odate = "";
|
||||
$categories = array();
|
||||
|
||||
$i=0;
|
||||
while ($row = db_fetch_assoc($result)) {
|
||||
$dom = date("D, M d",strtotime($row['date']));
|
||||
if ($odate != $dom){
|
||||
output_notl("`n`b`@%s`0`b`n", $dom);
|
||||
$odate = $dom;
|
||||
}
|
||||
$time = date("H:i:s", strtotime($row['date']))." (".reltime(strtotime($row['date'])).")";
|
||||
output_notl("`7(%s) %s `7(`&%s`7)", $row['category'], $row['message'], $row['name']);
|
||||
if (!isset($categories[$row['category']]) && $category == "") {
|
||||
addnav("Operations");
|
||||
addnav(array("View by `i%s`i", $row['category']), "gamelog.php?cat=".$row['category']);
|
||||
$categories[$row['category']] = 1;
|
||||
}
|
||||
output_notl("`n");
|
||||
}
|
||||
|
||||
page_footer();
|
||||
|
||||
?>
|
55
lotgd-web/lotgd/gardens.php
Executable file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/commentary.php");
|
||||
require_once("lib/villagenav.php");
|
||||
require_once("lib/events.php");
|
||||
require_once("lib/http.php");
|
||||
|
||||
tlschema("gardens");
|
||||
|
||||
page_header("The Gardens");
|
||||
|
||||
addcommentary();
|
||||
$skipgardendesc = handle_event("gardens");
|
||||
$op = httpget('op');
|
||||
$com = httpget('comscroll');
|
||||
$refresh = httpget("refresh");
|
||||
$commenting = httpget("commenting");
|
||||
$comment = httppost('insertcommentary');
|
||||
// Don't give people a chance at a special event if they are just browsing
|
||||
// the commentary (or talking) or dealing with any of the hooks in the village.
|
||||
if (!$op && $com=="" && !$comment && !$refresh && !$commenting) {
|
||||
if (module_events("gardens", getsetting("gardenchance", 0)) != 0) {
|
||||
if (checknavs()) {
|
||||
page_footer();
|
||||
} else {
|
||||
// Reset the special for good.
|
||||
$session['user']['specialinc'] = "";
|
||||
$session['user']['specialmisc'] = "";
|
||||
$skipgardendesc=true;
|
||||
$op = "";
|
||||
httpset("op", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$skipgardendesc) {
|
||||
checkday();
|
||||
|
||||
output("`b`c`2The Gardens`0`c`b");
|
||||
|
||||
output("`n`nYou walk through a gate and on to one of the many winding paths that makes its way through the well-tended gardens.");
|
||||
output("From the flowerbeds that bloom even in darkest winter, to the hedges whose shadows promise forbidden secrets, these gardens provide a refuge for those seeking out the Green Dragon; a place where they can forget their troubles for a while and just relax.`n`n");
|
||||
output("One of the fairies buzzing about the garden flies up to remind you that the garden is a place for roleplaying and peaceful conversation, and to confine out-of-character comments to the other areas of the game.`n`n");
|
||||
}
|
||||
|
||||
villagenav();
|
||||
modulehook("gardens", array());
|
||||
|
||||
commentdisplay("", "gardens","Whisper here",30,"whispers");
|
||||
|
||||
module_display_events("gardens", "gardens.php");
|
||||
page_footer();
|
||||
?>
|
132
lotgd-web/lotgd/graveyard.php
Executable file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
// addnews ready.
|
||||
// translator ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/buffs.php");
|
||||
require_once("lib/events.php");
|
||||
|
||||
tlschema("graveyard");
|
||||
|
||||
page_header("The Graveyard");
|
||||
$skipgraveyardtext = handle_event("graveyard");
|
||||
$deathoverlord=getsetting('deathoverlord','`$Ramius');
|
||||
if (!$skipgraveyardtext) {
|
||||
if ($session['user']['alive']) {
|
||||
redirect("village.php");
|
||||
}
|
||||
|
||||
checkday();
|
||||
}
|
||||
$battle = false;
|
||||
strip_all_buffs();
|
||||
|
||||
$op = httpget('op');
|
||||
switch ($op) {
|
||||
case "search":
|
||||
require_once("lib/graveyard/case_battle_search.php");
|
||||
break;
|
||||
case "run":
|
||||
if (e_rand(0,2)==1) {
|
||||
output("`\$%s`) curses you for your cowardice.`n`n",$deathoverlord);
|
||||
$favor = 5 + e_rand(0, $session['user']['level']);
|
||||
if ($favor > $session['user']['deathpower'])
|
||||
$favor = $session['user']['deathpower'];
|
||||
if ($favor > 0) {
|
||||
output("`)You have `\$LOST `^%s`) favor with `\$%s`).",$favor,$deathoverlord);
|
||||
$session['user']['deathpower']-=$favor;
|
||||
}
|
||||
tlschema("nav");
|
||||
addnav("G?Return to the Graveyard","graveyard.php");
|
||||
tlschema();
|
||||
} else {
|
||||
output("`)As you try to flee, you are summoned back to the fight!`n`n");
|
||||
$battle=true;
|
||||
}
|
||||
break;
|
||||
case "fight":
|
||||
$battle = true;
|
||||
|
||||
}
|
||||
|
||||
if ($battle){
|
||||
//make some adjustments to the user to put them on mostly even ground
|
||||
//with the undead guy.
|
||||
$originalhitpoints = $session['user']['hitpoints'];
|
||||
$session['user']['hitpoints'] = $session['user']['soulpoints'];
|
||||
$originalattack = $session['user']['attack'];
|
||||
$originaldefense = $session['user']['defense'];
|
||||
$session['user']['attack'] =
|
||||
10 + round(($session['user']['level'] - 1) * 1.5);
|
||||
$session['user']['defense'] =
|
||||
10 + round(($session['user']['level'] - 1) * 1.5);
|
||||
|
||||
require_once("battle.php");
|
||||
|
||||
//reverse those adjustments, battle calculations are over.
|
||||
$session['user']['attack'] = $originalattack;
|
||||
$session['user']['defense'] = $originaldefense;
|
||||
$session['user']['soulpoints'] = $session['user']['hitpoints'];
|
||||
$session['user']['hitpoints'] = $originalhitpoints;
|
||||
if ($victory || $defeat) $badguy = $newenemies[0]; // Only one badguy
|
||||
if ($victory) {
|
||||
tlschema("battle");
|
||||
$msg = translate_inline($badguy['creaturelose']);
|
||||
tlschema();
|
||||
output_notl("`b`&%s`0`b`n", $msg);
|
||||
output("`b`\$You have tormented %s!`0`b`n", $badguy['creaturename']);
|
||||
output("`#You receive `^%s`# favor with `\$%s`#!`n`0", $badguy['creatureexp'],$deathoverlord);
|
||||
$session['user']['deathpower']+=$badguy['creatureexp'];
|
||||
$op = "";
|
||||
httpset('op', "");
|
||||
$skipgraveyardtext=true;
|
||||
}else{
|
||||
if ($defeat){
|
||||
require_once("lib/taunt.php");
|
||||
$taunt = select_taunt_array();
|
||||
addnews("`)%s`) has been defeated in the graveyard by %s.`n%s",$session['user']['name'],$badguy['creaturename'],$taunt);
|
||||
output("`b`&You have been defeated by `%%s`&!!!`n", $badguy['creaturename']);
|
||||
output("You may not torment any more souls today.");
|
||||
$session['user']['gravefights']=0;
|
||||
tlschema("nav");
|
||||
addnav("G?Return to the Graveyard","graveyard.php");
|
||||
tlschema();
|
||||
}else{
|
||||
require_once("lib/fightnav.php");
|
||||
fightnav(false, true, "graveyard.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ($op) {
|
||||
case "search": case "run": case "fight":
|
||||
break;
|
||||
case "enter":
|
||||
require_once("lib/graveyard/case_enter.php");
|
||||
break;
|
||||
case "restore":
|
||||
require_once("lib/graveyard/case_restore.php");
|
||||
break;
|
||||
case "resurrection":
|
||||
require_once("lib/graveyard/case_resurrection.php");
|
||||
break;
|
||||
case "question":
|
||||
require_once("lib/graveyard/case_question.php");
|
||||
break;
|
||||
case "haunt":
|
||||
require_once("lib/graveyard/case_haunt.php");
|
||||
break;
|
||||
case "haunt2":
|
||||
require_once("lib/graveyard/case_haunt2.php");
|
||||
break;
|
||||
case "haunt3":
|
||||
require_once("lib/graveyard/case_haunt3.php");
|
||||
break;
|
||||
default:
|
||||
require_once("lib/graveyard/case_default.php");
|
||||
break;
|
||||
}
|
||||
|
||||
page_footer();
|
||||
?>
|
48
lotgd-web/lotgd/gypsy.php
Executable file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/commentary.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/villagenav.php");
|
||||
|
||||
tlschema("gypsy");
|
||||
|
||||
addcommentary();
|
||||
|
||||
$cost = $session['user']['level']*20;
|
||||
$op = httpget('op');
|
||||
|
||||
if ($op=="pay"){
|
||||
if ($session['user']['gold']>=$cost){ // Gunnar Kreitz
|
||||
$session['user']['gold']-=$cost;
|
||||
debuglog("spent $cost gold to speak to the dead");
|
||||
redirect("gypsy.php?op=talk");
|
||||
}else{
|
||||
page_header("Gypsy Seer's tent");
|
||||
villagenav();
|
||||
output("`5You offer the old gypsy woman your `^%s`5 gold for your gen-u-wine say-ance, however she informs you that the dead may be dead, but they ain't cheap.", $session['user']['gold']);
|
||||
}
|
||||
}elseif ($op=="talk"){
|
||||
page_header("In a deep trance, you talk with the shades");
|
||||
commentdisplay("`5While in a deep trance, you are able to talk with the dead:`n", "shade","Project",25,"projects");
|
||||
addnav("Snap out of your trance","gypsy.php");
|
||||
}else{
|
||||
checkday();
|
||||
page_header("Gypsy Seer's tent");
|
||||
output("`5You duck into a gypsy tent like many you have seen throughout the realm.");
|
||||
output("All of them promise to let you talk with the deceased, and most of them surprisingly seem to work.");
|
||||
output("There are also rumors that the gypsy have the power to speak over distances other than just those of the afterlife.");
|
||||
output("In typical gypsy style, the old woman sitting behind a somewhat smudgy crystal ball informs you that the dead only speak with the paying.");
|
||||
output("\"`!For you, %s, the price is a trifling `^%s`! gold.`5\", she rasps.", translate_inline($session['user']['sex']?"my pretty":"my handsome"), $cost);
|
||||
addnav("Seance");
|
||||
addnav(array("Pay to talk to the dead (%s gold)", $cost),"gypsy.php?op=pay");
|
||||
if ($session['user']['superuser'] & SU_EDIT_COMMENTS)
|
||||
addnav("Superuser Entry","gypsy.php?op=talk");
|
||||
addnav("Other");
|
||||
addnav("Forget it","village.php");
|
||||
modulehook("gypsy");
|
||||
}
|
||||
page_footer();
|
||||
?>
|
135
lotgd-web/lotgd/healer.php
Executable file
@ -0,0 +1,135 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/forest.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/villagenav.php");
|
||||
|
||||
tlschema("healer");
|
||||
|
||||
$config = unserialize($session['user']['donationconfig']);
|
||||
|
||||
$return = httpget("return");
|
||||
$returnline = $return>""?"&return=$return":"";
|
||||
|
||||
page_header("Healer's Hut");
|
||||
output("`#`b`cHealer's Hut`c`b`n");
|
||||
|
||||
$cost = log($session['user']['level']) * (($session['user']['maxhitpoints']-$session['user']['hitpoints']) + 10);
|
||||
$result=modulehook("healmultiply",array("alterpct"=>1.0));
|
||||
$cost*=$result['alterpct'];
|
||||
$cost = round($cost,0);
|
||||
|
||||
$op = httpget('op');
|
||||
if ($op==""){
|
||||
checkday();
|
||||
output("`3You duck into the small smoke-filled grass hut.");
|
||||
output("The pungent aroma makes you cough, attracting the attention of a grizzled old person that does a remarkable job of reminding you of a rock, which probably explains why you didn't notice them until now.");
|
||||
output("Couldn't be your failure as a warrior.");
|
||||
output("Nope, definitely not.`n`n");
|
||||
if ($session['user']['hitpoints'] < $session['user']['maxhitpoints']){
|
||||
output("\"`6See you, I do. Before you did see me, I think, hmm?`3\" the old thing remarks.");
|
||||
output("\"`6Know you, I do; healing you seek. Willing to heal am I, but only if willing to pay are you.`3\"`n`n");
|
||||
output("\"`5Uh, um. How much?`3\" you ask, ready to be rid of the smelly old thing.`n`n");
|
||||
output("The old being thumps your ribs with a gnarly staff. \"`6For you... `$`b%s`b`6 gold pieces for a complete heal!!`3\" it says as it bends over and pulls a clay vial from behind a pile of skulls sitting in the corner.", $cost);
|
||||
output("The view of the thing bending over to remove the vial almost does enough mental damage to require a larger potion.");
|
||||
output("\"`6I also have some, erm... 'bargain' potions available,`3\" it says as it gestures at a pile of dusty, cracked vials.");
|
||||
output("\"`6They'll heal a certain percent of your `idamage`i.`3\"");
|
||||
}elseif($session['user']['hitpoints'] == $session['user']['maxhitpoints']){
|
||||
output("`3The old creature grunts as it looks your way. \"`6Need a potion, you do not. Wonder why you bother me, I do.`3\" says the hideous thing.");
|
||||
output("The aroma of its breath makes you wish you hadn't come in here in the first place. You think you had best leave.");
|
||||
}else{
|
||||
output("`3The old creature glances at you, then in a `^whirlwind of movement`3 that catches you completely off guard, brings its gnarled staff squarely in contact with the back of your head.");
|
||||
output("You gasp as you collapse to the ground.`n`n");
|
||||
output("Slowly you open your eyes and realize the beast is emptying the last drops of a clay vial down your throat.`n`n");
|
||||
output("\"`6No charge for that potion.`3\" is all it has to say.");
|
||||
output("You feel a strong urge to leave as quickly as you can.");
|
||||
$session['user']['hitpoints'] = $session['user']['maxhitpoints'];
|
||||
}
|
||||
}elseif ($op=="buy"){
|
||||
$pct = httpget('pct');
|
||||
$newcost=round($pct*$cost/100,0);
|
||||
if ($session['user']['gold']>=$newcost){
|
||||
$session['user']['gold']-=$newcost;
|
||||
debuglog("spent gold on healing",false,false,"healing",$newcost);
|
||||
$diff = round(($session['user']['maxhitpoints']-$session['user']['hitpoints'])*$pct/100,0);
|
||||
$session['user']['hitpoints'] += $diff;
|
||||
output("`3With a grimace, you up-end the potion the creature hands you, and despite the foul flavor, you feel a warmth spreading through your veins as your muscles knit back together.");
|
||||
if($newcost){
|
||||
output("`3With a grimace, you up-end the potion the creature hands you, and despite the foul flavor, you feel a warmth spreading through your veins as your muscles knit back together.");
|
||||
output("Staggering some, you hand it your gold and are ready to be out of here.");
|
||||
}else{
|
||||
output("`3With a grimace, you up-end the potion the creature hands you, and despite the foul flavor, you feel a warmth spreading through your veins.");
|
||||
output("Staggering some you are ready to be out of here.");
|
||||
}
|
||||
if($diff == 1) {
|
||||
output("`n`n`#You have been healed for one point!", $diff);
|
||||
} else {
|
||||
output("`n`n`#You have been healed for %s points!", $diff);
|
||||
}
|
||||
}else{
|
||||
output("`3The old creature pierces you with a gaze hard and cruel.");
|
||||
output("Your lightning quick reflexes enable you to dodge the blow from its gnarled staff.");
|
||||
output("Perhaps you should get some more money before you attempt to engage in local commerce.`n`n");
|
||||
output("You recall that the creature had asked for `b`\$%s`3`b gold.", $newcost);
|
||||
}
|
||||
}elseif ($op=="companion"){
|
||||
$compcost = httpget('compcost');
|
||||
|
||||
if($session['user']['gold'] < $compcost){
|
||||
output("`3The old creature pierces you with a gaze hard and cruel.`n");
|
||||
output("Your lightning quick reflexes enable you to dodge the blow from its gnarled staff.`n");
|
||||
output("Perhaps you should get some more money before you attempt to engage in local commerce.`n`n");
|
||||
output("You recall that the creature had asked for `b`\$%s`3`b gold.", $compcost);
|
||||
}else{
|
||||
$name = stripslashes(rawurldecode(httpget('name')));
|
||||
$session['user']['gold'] -= $compcost;
|
||||
$companions[$name]['hitpoints'] = $companions[$name]['maxhitpoints'];
|
||||
output("`3With a grimace, %s`3 up-ends the potion from the creature.`n", $companions[$name]['name']);
|
||||
output("Muscles knit back together, cuts close and bruises fade. %s`3 is ready to battle once again!`n", $companions[$name]['name']);
|
||||
output("You hand the creature your gold and are ready to be out of here.");
|
||||
}
|
||||
}
|
||||
$playerheal = false;
|
||||
if($session['user']['hitpoints'] < $session['user']['maxhitpoints']){
|
||||
$playerheal = true;
|
||||
addnav("Potions");
|
||||
addnav("`^Complete Healing`0","healer.php?op=buy&pct=100$returnline");
|
||||
for ($i=90;$i>0;$i-=10){
|
||||
addnav(array("%s%% - %s gold", $i, round($cost*$i/100,0)),"healer.php?op=buy&pct=$i$returnline");
|
||||
}
|
||||
modulehook('potion');
|
||||
}
|
||||
addnav("`bHeal Companions`b");
|
||||
$compheal = false;
|
||||
foreach($companions as $name => $companion){
|
||||
if(isset($companion['cannotbehealed']) && $companion['cannotbehealed'] == true){
|
||||
}else{
|
||||
$points = $companion['maxhitpoints'] - $companion['hitpoints'];
|
||||
if($points > 0){
|
||||
$compcost = round(log($session['user']['level']+1) * ($points + 10)*1.33);
|
||||
addnav(array("%s`0 (`^%s Gold`0)", $companion['name'], $compcost), "healer.php?op=companion&name=".rawurlencode($name)."&compcost=$compcost$returnline");
|
||||
$compheal = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
tlschema("nav");
|
||||
addnav("`bReturn`b");
|
||||
if ($return==""){
|
||||
if($playerheal || $compheal){
|
||||
addnav("F?Back to the Forest", "forest.php");
|
||||
villagenav();
|
||||
}else{
|
||||
forest(true);
|
||||
}
|
||||
}elseif ($return=="village.php"){
|
||||
villagenav();
|
||||
}else{
|
||||
addnav("R?Return whence you came",$return);
|
||||
}
|
||||
tlschema();
|
||||
output_notl("`0");
|
||||
page_footer();
|
||||
?>
|
237
lotgd-web/lotgd/hof.php
Executable file
@ -0,0 +1,237 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
|
||||
// New Hall of Fame features by anpera
|
||||
// http://www.anpera.net/forum/viewforum.php?f=27
|
||||
|
||||
require_once("common.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/villagenav.php");
|
||||
|
||||
tlschema("hof");
|
||||
|
||||
$superusermask = SU_HIDE_FROM_LEADERBOARD;
|
||||
$standardwhere = "(locked=0 AND (superuser & $superusermask) = 0)";
|
||||
|
||||
page_header("Hall of Fame");
|
||||
checkday();
|
||||
|
||||
addnav("Other");
|
||||
villagenav();
|
||||
$playersperpage = 50;
|
||||
|
||||
$op = httpget('op');
|
||||
if ($op == "") $op = "kills";
|
||||
$subop = httpget('subop');
|
||||
if ($subop == "") $subop = "most";
|
||||
|
||||
$sql = "SELECT count(acctid) AS c FROM " . db_prefix("accounts") . " WHERE $standardwhere";
|
||||
$extra = "";
|
||||
if ($op == "kills") {
|
||||
$extra = " AND dragonkills > 0";
|
||||
} elseif ($op == "days") {
|
||||
$extra = " AND dragonkills > 0 AND bestdragonage > 0";
|
||||
}
|
||||
$result = db_query($sql.$extra);
|
||||
$row = db_fetch_assoc($result);
|
||||
$totalplayers = $row['c'];
|
||||
|
||||
$page = (int)httpget('page');
|
||||
if ($page == 0) $page = 1;
|
||||
$pageoffset = $page;
|
||||
if ($pageoffset > 0) $pageoffset--;
|
||||
$pageoffset *= $playersperpage;
|
||||
$from = $pageoffset+1;
|
||||
$to = min($pageoffset+$playersperpage, $totalplayers);
|
||||
$limit = "$pageoffset,$playersperpage";
|
||||
|
||||
addnav("Warrior Rankings");
|
||||
addnav("Dragon Kills", "hof.php?op=kills&subop=$subop&page=1");
|
||||
addnav("Gold", "hof.php?op=money&subop=$subop&page=1");
|
||||
addnav("Gems", "hof.php?op=gems&subop=$subop&page=1");
|
||||
addnav("Charm", "hof.php?op=charm&subop=$subop&page=1");
|
||||
addnav("Toughness", "hof.php?op=tough&subop=$subop&page=1");
|
||||
addnav("Resurrections", "hof.php?op=resurrects&subop=$subop&page=1");
|
||||
addnav("Dragon Kill Speed", "hof.php?op=days&subop=$subop&page=1");
|
||||
addnav("Sorting");
|
||||
addnav("Best", "hof.php?op=$op&subop=most&page=$page");
|
||||
addnav("Worst", "hof.php?op=$op&subop=least&page=$page");
|
||||
if ($totalplayers > $playersperpage) {
|
||||
addnav("Pages");
|
||||
for($i = 0; $i < $totalplayers; $i+= $playersperpage) {
|
||||
$pnum = ($i/$playersperpage+1);
|
||||
$min = ($i+1);
|
||||
$max = min($i+$playersperpage,$totalplayers);
|
||||
if ($page == $pnum) {
|
||||
addnav(array("`b`#Page %s`0 (%s-%s)`b", $pnum, $min, $max), "hof.php?op=$op&subop=$subop&page=$pnum");
|
||||
} else {
|
||||
addnav(array("Page %s (%s-%s)", $pnum, $min, $max), "hof.php?op=$op&subop=$subop&page=$pnum");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function display_table($title, $sql, $none=false, $foot=false,
|
||||
$data_header=false, $tag=false, $translate=false)
|
||||
{
|
||||
global $session, $from, $to, $page, $playersperpage, $totalplayers;
|
||||
|
||||
$title = translate_inline($title);
|
||||
if ($foot !== false) $foot = translate_inline($foot);
|
||||
if ($none !== false) $none = translate_inline($none);
|
||||
else $none = translate_inline("No players found.");
|
||||
if ($data_header !== false) {
|
||||
$data_header = translate_inline($data_header);
|
||||
reset ($data_header);
|
||||
}
|
||||
if ($tag !== false) $tag = translate_inline($tag);
|
||||
$rank = translate_inline("Rank");
|
||||
$name = translate_inline("Name");
|
||||
|
||||
if ($totalplayers > $playersperpage) {
|
||||
output("`c`b`^%s`0`b `7(Page %s: %s-%s of %s)`0`c`n", $title, $page, $from, $to, $totalplayers);
|
||||
} else {
|
||||
output("`c`b`^%s`0`b`c`n", $title);
|
||||
}
|
||||
rawoutput("<table cellspacing='0' cellpadding='2' align='center'>");
|
||||
rawoutput("<tr class='trhead'>");
|
||||
output_notl("<td>`b$rank`b</td><td>`b$name`b</td>", true);
|
||||
if ($data_header !== false) {
|
||||
for ($i = 0; $i < count($data_header); $i++) {
|
||||
output_notl("<td>`b{$data_header[$i]}`b</td>", true);
|
||||
}
|
||||
}
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)==0){
|
||||
$size = ($data_header === false) ? 2 : 2+count($data_header);
|
||||
output_notl("<tr class='trlight'><td colspan='$size' align='center'>`&$none`0</td></tr>",true);
|
||||
} else {
|
||||
$i=-1;
|
||||
while ($row = db_fetch_assoc($result)) {
|
||||
$i++;
|
||||
if ($row['name']==$session['user']['name']){
|
||||
rawoutput("<tr class='hilight'>");
|
||||
} else {
|
||||
rawoutput("<tr class='".($i%2?"trlight":"trdark")."'>");
|
||||
}
|
||||
output_notl("<td>%s</td><td>`&%s`0</td>",($i+$from), $row['name'], true);
|
||||
if ($data_header !== false) {
|
||||
for ($j = 0; $j < count($data_header); $j++) {
|
||||
$id = "data" . ($j+1);
|
||||
$val = $row[$id];
|
||||
if (isset($translate[$id]) &&
|
||||
$translate[$id] == 1 && !is_numeric($val)) {
|
||||
$val = translate_inline($val);
|
||||
}
|
||||
if ($tag !== false) $val = $val . " " . $tag[$j];
|
||||
output_notl("<td align='right'>%s</td>", $val, true);
|
||||
}
|
||||
}
|
||||
rawoutput("</tr>");
|
||||
}
|
||||
}
|
||||
rawoutput("</table>");
|
||||
if ($foot !== false) output_notl("`n`c%s`c", $foot);
|
||||
}
|
||||
|
||||
if ($op=="days") {
|
||||
if ($subop == "least") {
|
||||
$order = "DESC";
|
||||
$meop = ">=";
|
||||
}else{
|
||||
$order = "ASC";
|
||||
$meop = "<=";
|
||||
}
|
||||
} else {
|
||||
if ($subop == "least") {
|
||||
$order = "ASC";
|
||||
$meop = "<=";
|
||||
}else{
|
||||
$order = "DESC";
|
||||
$meop = ">=";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sexsel = "IF(sex,'`%Female`0','`!Male`0')";
|
||||
$racesel = "IF(race!='0' and race!='',race,'".RACE_UNKNOWN."')";
|
||||
|
||||
if ($op=="money"){
|
||||
$sql = "SELECT name,(CAST(gold as signed)+goldinbank+round((((rand()*10)-5)/100)*(CAST(gold as signed)+goldinbank))) AS data1 FROM " . db_prefix("accounts") . " WHERE $standardwhere ORDER BY data1 $order, level $order, experience $order, acctid $order LIMIT $limit";
|
||||
$me = "SELECT count(acctid) AS count FROM ".db_prefix("accounts")." WHERE $standardwhere AND (goldinbank+CAST(gold as signed)+round((((rand()*10)-5)/100)*(goldinbank+CAST(gold as signed)))) $meop ".($session['user']['goldinbank'] + $session['user']['gold']);
|
||||
$adverb = "richest";
|
||||
if ($subop == "least") $adverb = "poorest";
|
||||
$title = "The $adverb warriors in the land";
|
||||
$foot = "(Gold Amount is accurate to +/- 5%)";
|
||||
$headers = array("Estimated Gold");
|
||||
$tags = array("gold");
|
||||
$table = array($title, $sql, false, $foot, $headers, $tags);
|
||||
} elseif ($op == "gems") {
|
||||
$sql = "SELECT name FROM ". db_prefix("accounts") . " WHERE $standardwhere ORDER BY gems $order, level $order, experience $order, acctid $order LIMIT $limit";
|
||||
$me = "SELECT count(acctid) AS count FROM ".db_prefix("accounts")." WHERE $standardwhere AND gems $meop {$session['user']['gems']}";
|
||||
if ($subop == "least") $adverb = "least";
|
||||
else $adverb = "most";
|
||||
$title = "The warriors with the $adverb gems in the land";
|
||||
$table = array($title, $sql);
|
||||
} elseif ($op=="charm"){
|
||||
$sql = "SELECT name,$sexsel AS data1, $racesel AS data2 FROM " . db_prefix("accounts") . " WHERE $standardwhere ORDER BY charm $order, level $order, experience $order, acctid $order LIMIT $limit";
|
||||
$me = "SELECT count(acctid) AS count FROM ".db_prefix("accounts")." WHERE $standardwhere AND charm $meop {$session['user']['charm']}";
|
||||
$adverb = "most beautiful";
|
||||
if ($subop == "least") $adverb = "ugliest";
|
||||
$title = "The $adverb warriors in the land.";
|
||||
$headers = array("Gender", "Race");
|
||||
$translate = array("data1"=>1, "data2"=>1);
|
||||
$table = array($title, $sql, false, false, $headers, false, $translate);
|
||||
} elseif ($op=="tough"){
|
||||
$sql = "SELECT name,level AS data2 , $racesel as data1 FROM " . db_prefix("accounts") . " WHERE $standardwhere ORDER BY maxhitpoints $order, level $order, experience $order, acctid $order LIMIT $limit";
|
||||
$me = "SELECT count(acctid) AS count FROM ".db_prefix("accounts")." WHERE $standardwhere AND maxhitpoints $meop {$session['user']['maxhitpoints']}";
|
||||
$adverb = "toughest";
|
||||
if ($subop == "least") $adverb = "wimpiest";
|
||||
$title = "The $adverb warriors in the land";
|
||||
$headers = array("Race", "Level");
|
||||
$translate = array("data1"=>1);
|
||||
$table = array($title, $sql, false, false, $headers, false, $translate);
|
||||
} elseif ($op=="resurrects"){
|
||||
$sql = "SELECT name,level AS data1 FROM " . db_prefix("accounts") . " WHERE $standardwhere ORDER BY resurrections $order, level $order, experience $order, acctid $order LIMIT $limit";
|
||||
$me = "SELECT count(acctid) AS count FROM ".db_prefix("accounts")." WHERE $standardwhere AND resurrections $meop {$session['user']['resurrections']}";
|
||||
$adverb = "most suicidal";
|
||||
if ($subop == "least") $adverb = "least suicidal";
|
||||
$title = "The $adverb warriors in the land";
|
||||
$headers = array("Level");
|
||||
$table = array($title, $sql, false, false, $headers, false);
|
||||
} elseif ($op=="days") {
|
||||
$unk = translate_inline("Unknown");
|
||||
$sql = "SELECT name, IF(bestdragonage,bestdragonage,'$unk') AS data1 FROM " . db_prefix("accounts") . " WHERE $standardwhere $extra ORDER BY bestdragonage $order, level $order, experience $order, acctid $order LIMIT $limit";
|
||||
$me = "SELECT count(acctid) AS count FROM ".db_prefix("accounts")." WHERE $standardwhere $extra AND bestdragonage $meop {$session['user']['bestdragonage']}";
|
||||
$adverb = "fastest";
|
||||
if ($subop == "least") $adverb = "slowest";
|
||||
$title = "Heroes with the $adverb dragon kills in the land";
|
||||
$headers = array("Best Days");
|
||||
$none = "There are no heroes in the land.";
|
||||
$table = array($title, $sql, $none, false, $headers, false);
|
||||
} else {
|
||||
$unk = translate_inline("Unknown");
|
||||
$sql = "SELECT name,dragonkills AS data1,level AS data2,' ' AS data3, IF(dragonage,dragonage,'$unk') AS data4, ' ' AS data5, IF(bestdragonage,bestdragonage,'$unk') AS data6 FROM " . db_prefix("accounts") . " WHERE $standardwhere $extra ORDER BY dragonkills $order,level $order,experience $order, acctid $order LIMIT $limit";
|
||||
if ($session['user']['dragonkills']>0) $me = "SELECT count(acctid) AS count FROM ".db_prefix("accounts")." WHERE $standardwhere $extra AND dragonkills $meop {$session['user']['dragonkills']}";
|
||||
$adverb = "most";
|
||||
if ($subop == "least") $adverb = "least";
|
||||
$title = "Heroes with the $adverb dragon kills in the land";
|
||||
$headers = array("Kills", "Level", " ", "Days", " ", "Best Days");
|
||||
$none = "There are no heroes in the land.";
|
||||
$table = array($title, $sql, $none, false, $headers, false);
|
||||
}
|
||||
|
||||
if (isset($table) && is_array($table)){
|
||||
call_user_func_array("display_table",$table);
|
||||
if (isset($me) && $me>"" && $totalplayers){
|
||||
$meresult = db_query($me);
|
||||
$row = db_fetch_assoc($meresult);
|
||||
$pct = round(100*$row['count']/$totalplayers, 0);
|
||||
if ($pct < 1) $pct = 1;
|
||||
output("`c`7You rank within around the top `&%s`7%% in this listing.`0`c",$pct);
|
||||
}
|
||||
}
|
||||
|
||||
page_footer();
|
||||
?>
|
145
lotgd-web/lotgd/home.php
Executable file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
|
||||
if (isset($_POST['template'])){
|
||||
$skin = $_POST['template'];
|
||||
if ($skin > "") {
|
||||
setcookie("template",$skin ,strtotime("+45 days"));
|
||||
$_COOKIE['template']=$skin;
|
||||
}
|
||||
}
|
||||
|
||||
define("ALLOW_ANONYMOUS",true);
|
||||
require_once("common.php");
|
||||
require_once("lib/http.php");
|
||||
|
||||
|
||||
if (!isset($session['loggedin'])) $session['loggedin']=false;
|
||||
if ($session['loggedin']){
|
||||
redirect("badnav.php");
|
||||
}
|
||||
|
||||
tlschema("home");
|
||||
|
||||
$op = httpget('op');
|
||||
|
||||
page_header();
|
||||
output("`cWelcome to Legend of the Green Dragon, a browser based role playing game, based on Seth Able's Legend of the Red Dragon.`n");
|
||||
|
||||
if (getsetting("homecurtime", 1)) {
|
||||
output("`@The current time in %s is `%%s`@.`0`n", getsetting("villagename", LOCATION_FIELDS), getgametime());
|
||||
}
|
||||
|
||||
if (getsetting("homenewdaytime", 1)) {
|
||||
$secstonewday = secondstonextgameday();
|
||||
output("`@Next new game day in: `\$%s (real time)`0`n`n",
|
||||
date("G\\".translate_inline("h","datetime").", i\\".translate_inline("m","datetime").", s\\".translate_inline("s","datetime"),
|
||||
$secstonewday));
|
||||
}
|
||||
|
||||
if (getsetting("homenewestplayer", 1)) {
|
||||
$name = "";
|
||||
$newplayer = getsetting("newestplayer", "");
|
||||
if ($newplayer != 0) {
|
||||
$sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid='$newplayer'";
|
||||
$result = db_query_cached($sql, "newest");
|
||||
$row = db_fetch_assoc($result);
|
||||
$name = $row['name'];
|
||||
} else {
|
||||
$name = $newplayer;
|
||||
}
|
||||
if ($name != "") {
|
||||
output("`QThe newest resident of the realm is: `&%s`0`n`n", $name);
|
||||
}
|
||||
}
|
||||
|
||||
clearnav();
|
||||
addnav("New to LoGD?");
|
||||
addnav("Create a character","create.php");
|
||||
addnav("Game Functions");
|
||||
addnav("Forgotten Password","create.php?op=forgot");
|
||||
addnav("List Warriors","list.php");
|
||||
addnav("Daily News", "news.php");
|
||||
addnav("Other Info");
|
||||
addnav("About LoGD","about.php");
|
||||
addnav("Game Setup Info", "about.php?op=setup");
|
||||
addnav("LoGD Net","logdnet.php?op=list");
|
||||
|
||||
modulehook("index", array());
|
||||
|
||||
if (abs(getsetting("OnlineCountLast",0) - strtotime("now")) > 60){
|
||||
$sql="SELECT count(acctid) as onlinecount FROM " . db_prefix("accounts") . " WHERE locked=0 AND loggedin=1 AND laston>'".date("Y-m-d H:i:s",strtotime("-".getsetting("LOGINTIMEOUT",900)." seconds"))."'";
|
||||
$result = db_query($sql);
|
||||
$onlinecount = db_fetch_assoc($result);
|
||||
$onlinecount = $onlinecount ['onlinecount'];
|
||||
savesetting("OnlineCount",$onlinecount);
|
||||
savesetting("OnlineCountLast",strtotime("now"));
|
||||
}else{
|
||||
$onlinecount = getsetting("OnlineCount",0);
|
||||
}
|
||||
if ($onlinecount<getsetting("maxonline",0) || getsetting("maxonline",0)==0){
|
||||
output("Enter your name and password to enter the realm.`n");
|
||||
if ($op=="timeout"){
|
||||
$session['message'].= translate_inline(" Your session has timed out, you must log in again.`n");
|
||||
}
|
||||
if (!isset($_COOKIE['lgi'])){
|
||||
$session['message'].=translate_inline("It appears that you may be blocking cookies from this site. At least session cookies must be enabled in order to use this site.`n");
|
||||
$session['message'].=translate_inline("`b`#If you are not sure what cookies are, please <a href='http://en.wikipedia.org/wiki/WWW_browser_cookie'>read this article</a> about them, and how to enable them.`b`n");
|
||||
}
|
||||
if (isset($session['message']) && $session['message']>"")
|
||||
output_notl("`b`\$%s`b`n", $session['message'],true);
|
||||
rawoutput("<script language='JavaScript' src='lib/md5.js'></script>");
|
||||
rawoutput("<script language='JavaScript'>
|
||||
<!--
|
||||
function md5pass(){
|
||||
//encode passwords before submission to protect them even from network sniffing attacks.
|
||||
var passbox = document.getElementById('password');
|
||||
if (passbox.value.substring(0, 5) != '!md5!') {
|
||||
passbox.value = '!md5!' + hex_md5(passbox.value);
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>");
|
||||
$uname = translate_inline("<u>U</u>sername");
|
||||
$pass = translate_inline("<u>P</u>assword");
|
||||
$butt = translate_inline("Log in");
|
||||
rawoutput("<form action='login.php' method='POST' onSubmit=\"md5pass();\">".templatereplace("login",array("username"=>$uname,"password"=>$pass,"button"=>$butt))."</form>");
|
||||
output_notl("`c");
|
||||
addnav("","login.php");
|
||||
} else {
|
||||
output("`\$`bServer full!`b`n`^Please wait until some users have logged out.`n`n`0");
|
||||
if ($op=="timeout"){
|
||||
$session['message'].= translate_inline(" Your session has timed out, you must log in again.`n");
|
||||
}
|
||||
if (!isset($_COOKIE['lgi'])){
|
||||
$session['message'].=translate_inline("It appears that you may be blocking cookies from this site. At least session cookies must be enabled in order to use this site.`n");
|
||||
$session['message'].=translate_inline("`b`#If you are not sure what cookies are, please <a href='http://en.wikipedia.org/wiki/WWW_browser_cookie'>read this article</a> about them, and how to enable them.`b`n");
|
||||
}
|
||||
if ($session['message']>"") output("`b`\$%s`b`n", $session['message'],true);
|
||||
rawoutput(templatereplace("loginfull",array()));
|
||||
output_notl("`c");
|
||||
}
|
||||
|
||||
$msg = getsetting("loginbanner","*BETA* This is a BETA of this website, things are likely to change now and again, as it is under active development *BETA*");
|
||||
output_notl("`n`c`b`&%s`0`b`c`n", $msg);
|
||||
$session['message']="";
|
||||
output("`c`2Game server running version: `@%s`0`c", $logd_version);
|
||||
|
||||
if (getsetting("homeskinselect", 1)) {
|
||||
rawoutput("<form action='home.php' method='POST'>");
|
||||
rawoutput("<table align='center'><tr><td>");
|
||||
$form = array("template"=>"Choose a different display skin:,theme");
|
||||
$prefs['template'] = $_COOKIE['template'];
|
||||
if ($prefs['template'] == "")
|
||||
$prefs['template'] = getsetting("defaultskin", "jade.htm");
|
||||
require_once("lib/showform.php");
|
||||
showform($form, $prefs, true);
|
||||
$submit = translate_inline("Choose");
|
||||
rawoutput("</td><td><br> <input type='submit' class='button' value='$submit'></td>");
|
||||
rawoutput("</tr></table></form>");
|
||||
}
|
||||
|
||||
page_footer();
|
||||
?>
|
BIN
lotgd-web/lotgd/images/Medallion-Green.gif
Executable file
After Width: | Height: | Size: 13 KiB |
BIN
lotgd-web/lotgd/images/Medallion-Red.gif
Executable file
After Width: | Height: | Size: 13 KiB |
BIN
lotgd-web/lotgd/images/Medallion-Yellow.gif
Executable file
After Width: | Height: | Size: 13 KiB |
BIN
lotgd-web/lotgd/images/headbkg.GIF
Executable file
After Width: | Height: | Size: 20 KiB |
87
lotgd-web/lotgd/images/logdnet.php
Executable file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// mail ready
|
||||
// translator ready
|
||||
session_start();
|
||||
//unset($_SESSION['logdnet']);
|
||||
//session_register("session");
|
||||
if (isset($_GET['op']) && $_GET['op']=="register"){
|
||||
if (!isset($_SESSION['logdnet']) || !isset($_SESSION['logdnet']['']) ||
|
||||
$_SESSION['logdnet']['']==""){
|
||||
//register with LoGDnet
|
||||
$a = $_GET['a'];
|
||||
$c = $_GET['c'];
|
||||
$l = $_GET['l'];
|
||||
$d = $_GET['d'];
|
||||
$e = $_GET['e'];
|
||||
$v = $_GET['v'];
|
||||
$u = $_GET['u'];
|
||||
$url = $u. //central server
|
||||
"logdnet.php?". //logdnet script
|
||||
"addy=".rawurlencode($a). //server URL
|
||||
"&desc=".rawurlencode($d). //server description
|
||||
"&version=".rawurlencode($v). //game version
|
||||
"&admin=".rawurlencode($e). //admin email
|
||||
"&c=".$c. // player count (for my own records, this isn't used
|
||||
// in the sorting mechanism)
|
||||
"&v=2". // LoGDnet version.
|
||||
"&l=".$l. // primary language of this server -- you may change
|
||||
// this if it turns out to be inaccurate.
|
||||
"";
|
||||
require_once("../lib/pullurl.php");
|
||||
$info = @pullurl($url);
|
||||
if ($info !== false) {
|
||||
$info = base64_decode(join("",$info));
|
||||
$_SESSION['logdnet'] = unserialize($info);
|
||||
$_SESSION['logdnet']['when'] = date("Y-m-d H:i:s");
|
||||
$_SESSION['logdnet']['note'] = "\n// registered with logdnet successfully";
|
||||
$_SESSION['logdnet']['note'] .= "\n// ".$url;
|
||||
}else{
|
||||
$_SESSION['logdnet']['when'] = date("Y-m-d H:i:s");
|
||||
$_SESSION['logdnet']['note'] = "\n// There was trouble registering on logdnet.";
|
||||
$_SESSION['logdnet']['note'] .= "\n// ".$url;
|
||||
}
|
||||
} else {
|
||||
$info = true;
|
||||
}
|
||||
if ($info !== false) {
|
||||
require_once("../lib/sanitize.php");
|
||||
$o = addslashes($_SESSION['logdnet']['']);
|
||||
$o = str_replace("\n\r","\n",$o);
|
||||
$o = str_replace("\r","\n",$o);
|
||||
$o = str_replace("\n","\\n",$o);
|
||||
$refer = "";
|
||||
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
$refer = $_SERVER['HTTP_REFERER'];
|
||||
}
|
||||
if (isset($_SESSION['session']['user'])) {
|
||||
echo $_SESSION['logdnet']['note']."\n";
|
||||
echo "// At {$_SESSION['logdnet']['when']}\n";
|
||||
//require_once("../lib/dbwrapper.php");
|
||||
//require_once("../lib/settings.php");
|
||||
echo "document.write(\"".sprintf($o,full_sanitize($_SESSION['session']['user']['login']),
|
||||
htmlentities($_SESSION['session']['user']['login']).":".$_SERVER['HTTP_HOST'].$refer,ENT_COMPAT,"ISO-8859-1")."\");";
|
||||
} else {
|
||||
$image = join("",file("paypal1.gif"));
|
||||
header("Content-Type: image/gif");
|
||||
header("Content-Length: ".strlen($image));
|
||||
echo $image;
|
||||
}
|
||||
} else {
|
||||
// We failed to connect to central, just use our local image!
|
||||
$image = join("",file("paypal1.gif"));
|
||||
header("Content-Type: image/gif");
|
||||
header("Content-Length: ".strlen($image));
|
||||
echo $image;
|
||||
}
|
||||
}elseif (isset($_SESSION['logdnet'])){
|
||||
header("Content-Type: ".$_SESSION['logdnet']['content-type']);
|
||||
header("Content-Length: ".strlen($_SESSION['logdnet']['image']));
|
||||
echo $_SESSION['logdnet']['image'];
|
||||
}else{
|
||||
$image = join("",file("paypal1.gif"));
|
||||
header("Content-Type: image/gif");
|
||||
header("Content-Length: ".strlen($image));
|
||||
echo $image;
|
||||
}
|
||||
?>
|
BIN
lotgd-web/lotgd/images/logindragon.gif
Executable file
After Width: | Height: | Size: 23 KiB |
BIN
lotgd-web/lotgd/images/lscroll.GIF
Executable file
After Width: | Height: | Size: 874 B |
BIN
lotgd-web/lotgd/images/mightyesig.gif
Executable file
After Width: | Height: | Size: 273 B |
BIN
lotgd-web/lotgd/images/new.gif
Executable file
After Width: | Height: | Size: 54 B |
BIN
lotgd-web/lotgd/images/newscroll.GIF
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
lotgd-web/lotgd/images/oldscroll.GIF
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
lotgd-web/lotgd/images/paypal.gif
Executable file
After Width: | Height: | Size: 2.9 KiB |
BIN
lotgd-web/lotgd/images/paypal1.gif
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
lotgd-web/lotgd/images/paypal2.gif
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
lotgd-web/lotgd/images/paypal3.gif
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
lotgd-web/lotgd/images/rule.gif
Executable file
After Width: | Height: | Size: 332 B |
BIN
lotgd-web/lotgd/images/somerights20.gif
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
lotgd-web/lotgd/images/title.gif
Executable file
After Width: | Height: | Size: 7.2 KiB |
BIN
lotgd-web/lotgd/images/trans.gif
Executable file
After Width: | Height: | Size: 43 B |
BIN
lotgd-web/lotgd/images/uscroll.GIF
Executable file
After Width: | Height: | Size: 867 B |
6
lotgd-web/lotgd/index.php
Executable file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
header("Location: home.php?".$_SERVER['QUERY_STRING']);
|
||||
?>
|
70
lotgd-web/lotgd/inn.php
Executable file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
require_once("common.php");
|
||||
require_once("lib/commentary.php");
|
||||
require_once("lib/pvpwarning.php");
|
||||
require_once("lib/sanitize.php");
|
||||
require_once("lib/pvplist.php");
|
||||
require_once("lib/http.php");
|
||||
require_once("lib/buffs.php");
|
||||
require_once("lib/events.php");
|
||||
require_once("lib/villagenav.php");
|
||||
|
||||
tlschema("inn");
|
||||
|
||||
addcommentary();
|
||||
$iname = getsetting("innname", LOCATION_INN);
|
||||
$vname = getsetting("villagename", LOCATION_FIELDS);
|
||||
$barkeep = getsetting('barkeep','`tCedrik');
|
||||
|
||||
$op = httpget('op');
|
||||
// Correctly reset the location if they fleeing the dragon
|
||||
// This needs to be done up here because a special could alter your op.
|
||||
if ($op == "fleedragon") {
|
||||
$session['user']['location'] = $vname;
|
||||
}
|
||||
|
||||
page_header(array("%s",sanitize($iname)));
|
||||
$skipinndesc = handle_event("inn");
|
||||
|
||||
if (!$skipinndesc) {
|
||||
checkday();
|
||||
rawoutput("<span style='color: #9900FF'>");
|
||||
output_notl("`c`b");
|
||||
output($iname);
|
||||
output_notl("`b`c");
|
||||
}
|
||||
|
||||
$subop = httpget('subop');
|
||||
|
||||
$com = httpget('comscroll');
|
||||
$comment = httppost('insertcommentary');
|
||||
|
||||
require_once("lib/partner.php");
|
||||
$partner = get_partner();
|
||||
addnav("Other");
|
||||
villagenav();
|
||||
addnav("I?Return to the Inn","inn.php");
|
||||
|
||||
switch ($op) {
|
||||
case "": case "strolldown": case "fleedragon":
|
||||
require("lib/inn/inn_default.php");
|
||||
blocknav("inn.php");
|
||||
break;
|
||||
case "converse":
|
||||
commentdisplay("You stroll over to a table, place your foot up on the bench and listen in on the conversation:`n", "inn","Add to the conversation?",20);
|
||||
break;
|
||||
case "bartender":
|
||||
require("lib/inn/inn_bartender.php");
|
||||
break;
|
||||
case "room":
|
||||
require("lib/inn/inn_room.php");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$skipinndesc) rawoutput("</span>");
|
||||
|
||||
page_footer();
|
||||
?>
|
142
lotgd-web/lotgd/installer.php
Executable file
@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
//translator ready
|
||||
//addnews ready
|
||||
//mail ready
|
||||
|
||||
define("ALLOW_ANONYMOUS",true);
|
||||
define("OVERRIDE_FORCED_NAV",true);
|
||||
define("IS_INSTALLER",true);
|
||||
if (!file_exists("dbconnect.php")){
|
||||
define("DB_NODB",true);
|
||||
}
|
||||
require_once("common.php");
|
||||
if (file_exists("dbconnect.php")){
|
||||
require_once("dbconnect.php");
|
||||
}
|
||||
$noinstallnavs=false;
|
||||
|
||||
tlschema("installer");
|
||||
|
||||
$stages=array(
|
||||
"1. Introduction",
|
||||
"2. License Agreement",
|
||||
"3. I Agree",
|
||||
"4. Database Info",
|
||||
"5. Test Database",
|
||||
"6. Examine Database",
|
||||
"7. Write dbconnect file",
|
||||
"8. Install Type",
|
||||
"9. Set Up Modules",
|
||||
"10. Build Tables",
|
||||
"11. Admin Accounts",
|
||||
"12. Done!",
|
||||
);
|
||||
|
||||
$recommended_modules = array(
|
||||
"abigail",
|
||||
"breakin",
|
||||
"calendar",
|
||||
"cedrikspotions",
|
||||
// "cities", //I don't think this is good for most people.
|
||||
"collapse",
|
||||
"crazyaudrey",
|
||||
"crying",
|
||||
"dag",
|
||||
"darkhorse",
|
||||
"distress",
|
||||
"dragonattack",
|
||||
"drinks",
|
||||
"drunkard",
|
||||
"expbar",
|
||||
"fairy",
|
||||
"findgem",
|
||||
"findgold",
|
||||
"foilwench",
|
||||
"forestturn",
|
||||
"game_dice",
|
||||
"game_stones",
|
||||
"gardenparty",
|
||||
"ghosttown",
|
||||
"glowingstream",
|
||||
"goldmine",
|
||||
"grassyfield",
|
||||
"haberdasher",
|
||||
"healthbar",
|
||||
"innchat",
|
||||
"kitchen",
|
||||
"klutz",
|
||||
"lottery",
|
||||
"lovers",
|
||||
"newbieisland",
|
||||
"oldman",
|
||||
"outhouse",
|
||||
"peerpressure",
|
||||
"petra",
|
||||
"racedwarf",
|
||||
"raceelf",
|
||||
"racehuman",
|
||||
"racetroll",
|
||||
"riddles",
|
||||
"salesman",
|
||||
"sethsong",
|
||||
"smith",
|
||||
"soulgem",
|
||||
"spa",
|
||||
"specialtydarkarts",
|
||||
"specialtymysticpower",
|
||||
"specialtythiefskills",
|
||||
"statue",
|
||||
"stocks",
|
||||
"stonehenge",
|
||||
"strategyhut",
|
||||
"thieves",
|
||||
"tutor",
|
||||
"tynan",
|
||||
"waterfall",
|
||||
);
|
||||
|
||||
$DB_USEDATACACHE=0; //Necessary
|
||||
|
||||
|
||||
if ((int)httpget("stage")>0)
|
||||
$stage = (int)httpget("stage");
|
||||
else
|
||||
$stage = 0;
|
||||
if (!isset($session['stagecompleted'])) $session['stagecompleted']=-1;
|
||||
if ($stage > $session['stagecompleted']+1) $stage = $session['stagecompleted'];
|
||||
if (!isset($session['dbinfo'])) $session['dbinfo']=array("DB_HOST"=>"","DB_USER"=>"","DB_PASS"=>"","DB_NAME"=>"");
|
||||
if (file_exists("dbconnect.php") && (
|
||||
$stage==3 ||
|
||||
$stage==4 ||
|
||||
$stage==5
|
||||
)){
|
||||
output("`%This stage was completed during a previous installation.");
|
||||
output("`2If you wish to perform stages 4 through 6 again, please delete the file named \"dbconnect.php\" from your site.`n`n");
|
||||
$stage=6;
|
||||
}
|
||||
if ($stage > $session['stagecompleted']) $session['stagecompleted'] = $stage;
|
||||
|
||||
page_header("LoGD Installer — %s",$stages[$stage]);
|
||||
switch($stage) {
|
||||
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10:
|
||||
require_once("lib/installer/installer_stage_$stage.php");
|
||||
break;
|
||||
default:
|
||||
require_once("lib/installer/installer_stage_default.php");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!$noinstallnavs){
|
||||
if ($session['user']['loggedin']) addnav("Back to the game",$session['user']['restorepage']);
|
||||
addnav("Install Stages");
|
||||
|
||||
for ($x=0; $x<=min(count($stages)-1,$session['stagecompleted']+1); $x++){
|
||||
if ($x == $stage) $stages[$x]="`^{$stages[$x]} <----";
|
||||
addnav($stages[$x],"installer.php?stage=$x");
|
||||
}
|
||||
}
|
||||
page_footer(false);
|
||||
|
||||
?>
|
3
lotgd-web/lotgd/lib/.htaccess
Executable file
@ -0,0 +1,3 @@
|
||||
<Files *.php>
|
||||
deny from all
|
||||
</Files>
|
100
lotgd-web/lotgd/lib/about/about_default.php
Executable file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* Page explaining what LotGD is
|
||||
*
|
||||
* This page is part of the about page system
|
||||
* and is MightyE explaining what LotGD is. It
|
||||
* also contains a way in which a server admin
|
||||
* can display information about his/her server.
|
||||
*
|
||||
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
|
||||
* @version Lotgd 1.1.2 DragonPrime Edition
|
||||
* @package Core
|
||||
* @subpackage Library
|
||||
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
|
||||
*/
|
||||
$order=array("1","2");
|
||||
while (list($key,$val)=each($order)){
|
||||
switch($val){
|
||||
case "2":
|
||||
/* NOTICE
|
||||
* NOTICE Server admins may put their own information here,
|
||||
* NOTICE please leave the main about body untouched.
|
||||
* NOTICE
|
||||
*/
|
||||
rawoutput("<hr>");
|
||||
$impressum = getsetting("impressum", "");
|
||||
if ($impressum > "") {
|
||||
require_once("lib/nltoappon.php");
|
||||
output_notl("%s", nltoappon($impressum));
|
||||
}
|
||||
break;
|
||||
case "1":
|
||||
/* NOTICE
|
||||
* NOTICE This section may not be modified, please modify the
|
||||
* NOTICE Server Specific section above.
|
||||
* NOTICE
|
||||
*/
|
||||
output("`@Legend of the Green Dragon`nBy Eric Stevens & JT Traub`n`n");
|
||||
output("`cLoGD version ");
|
||||
output_notl("$logd_version`c");
|
||||
/*
|
||||
* This section may not be modified, please modify the Server
|
||||
* Specific section above.
|
||||
*/
|
||||
output("MightyE tells you, \"`2Legend of the Green Dragon is a remake of and homage to the classic BBS Door game, Legend of the Red Dragon (aka LoRD) by <a href='http://www.rtsoft.com' target='_blank'>Seth Able Robinson</a>.`@\"", true);
|
||||
output("`n`n`@\"`2LoRD is now owned by Gameport (<a href='http://www.gameport.com/bbs/lord.html' target='_blank'>http://www.gameport.com/bbs/lord.html</a>), and they retain exclusive rights to the LoRD name and game. ", true);
|
||||
output("That's why all content in Legend of the Green Dragon is new, with only a very few nods to the original game, such as the buxom barmaid, Violet, and the handsome bard, Seth.`@\"`n`n");
|
||||
/*
|
||||
* This section may not be modified, please modify the Server
|
||||
* Specific section above.
|
||||
*/
|
||||
output("`@\"`2Although serious effort was made to preserve the original feel of the game, numerous departures were taken from the original game to enhance playability, and to adapt it to the web.`@\"`n`n");
|
||||
/*
|
||||
* This section may not be modified, please modify the Server
|
||||
* Specific section above.
|
||||
*/
|
||||
output("`@\"`2LoGD (after version 0.9.7) is released under a <a href='http://creativecommons.org/licenses/by-nc-sa/2.0/' target='_blank'>Creative Commons License</a>, which essentially means that the source code to the game, and all derivatives of the game must remain open and available upon request.", true);
|
||||
output("Version 0.9.7 and before are still available under the <a href='http://www.gnu.org/licenses/gpl.html' target='_blank'>GNU General Public License</a> though 0.9.7 will be the last release under that license.", true);
|
||||
output("To use any of the new features requires using the 1.0.0 code. You may explicitly not place code from versions after 0.9.7 into 0.9.7 and release the combined derivative work under the GPL.`@\"`n`n", true);
|
||||
/*
|
||||
* This section may not be modified, please modify the Server
|
||||
* Specific section above.
|
||||
*/
|
||||
output("`@\"`2You may download the latest official version of LoGD at <a href='http://dragonprime.net/' target='_blank'>DragonPrime</a> and you can play the Classic version at <a href='http://lotgd.net/'>http://lotgd.net</a>.`@\"`n`n",true);
|
||||
//output("`@\"`2The most recent *UNSTABLE* pre-release snapshot is available from <a href='http://dragonprime.net/users/Kendaer/' target='_blank'>http://dragonprime.net/users/Kendaer/</a>.", true);
|
||||
output("You should attempt to use this code only if you are comfortable with PHP and MySQL and willing to manually keep your code up to date.`@\"`n`n");
|
||||
/*
|
||||
* This section may not be modified, please modify the Server
|
||||
* Specific section above.
|
||||
*/
|
||||
output("`@\"`2Additionally, there is an active modder community located at <a href='http://dragonprime.net' target='_blank'>DragonPrime</a> which may help you find additional features which you may wish to add to your game.", true);
|
||||
output("For these additional features you will find active support within the DragonPrime community.`@\"`n`n");
|
||||
/*
|
||||
* This section may not be modified, please modify the Server
|
||||
* Specific section above.
|
||||
*/
|
||||
output("`@\"`2LoGD is programmed in PHP with a MySQL backend.");
|
||||
output("It is known to run on Windows and Linux with appropriate setups.");
|
||||
output("The core code has been actively written by Eric Stevens and JT Traub, with some pieces by other authors (denoted in the source at these locations), and the code has been released under a <a href='http://creativecommons.org/licenses/by-nc-sa/2.0/' target='_blank'>Creative Commons License</a>.", true);
|
||||
output("Users of the source are bound to the terms therein.`n",true);
|
||||
output("The DragonPrime Development Team took over responsibility for code development on January 1<sup>st</sup>, 2006 and continues to maintain and add to features of the core code.`@\"`n`n",true);
|
||||
/*
|
||||
* This section may not be modified, please modify the Server
|
||||
* Specific section above.
|
||||
*/
|
||||
output("`@\"`2Users of the source are free to view and modify the source, but original copyright information, and original text from the about page must be preserved, though they may be added to.`@\"`n`n");
|
||||
output("`@\"`2We hope you enjoy the game!`@\"");
|
||||
/*
|
||||
* This section may not be modified, please modify the Server
|
||||
* Specific section above.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
addnav("About LoGD");
|
||||
addnav("Game Setup Info","about.php?op=setup");
|
||||
addnav("Module Info","about.php?op=listmodules");
|
||||
addnav("License Info", "about.php?op=license");
|
||||
modulehook("about");
|
||||
?>
|
37
lotgd-web/lotgd/lib/about/about_license.php
Executable file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Page explaining the LotGD license
|
||||
*
|
||||
* This page is part of the about system
|
||||
* and is MightyE explaining the new license
|
||||
* in an easy to understand way.
|
||||
*
|
||||
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
|
||||
* @version Lotgd 1.1.2 DragonPrime Edition
|
||||
* @package Core
|
||||
* @subpackage Library
|
||||
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
|
||||
*/
|
||||
addnav("About LoGD");
|
||||
addnav("About LoGD","about.php");
|
||||
addnav("Game Setup Info","about.php?op=setup");
|
||||
addnav("Module Info","about.php?op=listmodules");
|
||||
output("`@MightyE tells you, \"`2We're going to take a few moments to try and explain this new license and the reasons behind it in plain English.");
|
||||
output("The legalese for the license can be found online at <a href='http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode' target='_blank'>http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode</a> and should be read and understood in detail before you use this code.`@\"`n`n", true);
|
||||
output("`@\"`2This new license was chosen because of a failing with the GPL.");
|
||||
output("It only covered distribution of source if and only if binaries were distributed.`@\"`n`n");
|
||||
output("`@\"`2In a web environment, specifically an interpreted web environment such as PHP, merely installing a game does not constitute distribution, and therefore people were taking our work, making modifications to it and not releasing the source code to their modifications so that the entire community could benefit.");
|
||||
output("They worked with the letter but not the spirit of the law.`@\"`n`n");
|
||||
output("`@\"`2Investigation on the part of the authors however, led to the fact that the right of public performance was one of the rights normally restricted to copyright holders, AND that computer programs, specifically video games and interactive ones such as Legend of the Green Dragon were considered to be publically performed if run from a public server.`@\"`n`n");
|
||||
output("`@\"`2The new license restricts public performance of the work unless the source code of the modified work is made available on demand.`@\"`n`n");
|
||||
output("`@\"`2In plain English, this means that if you put this game on a web server and allow people 'outside of a normal circle of family and its social acquaintances' to play there, then you are publically performing this work and MUST either a) make any and ALL changes which you make to the game available on request (note this doesn't have to be available via the online source display link, but they must be able to ask you for the code AND receive a complete copy), b) make arrangements privately with the authors wherein they grant you a special license, or c) remove the code entirely from the machine.`@\"`n`n");
|
||||
output("`@\"`2We do recognize that people want to have areas of their game which are theirs and theirs alone.");
|
||||
output("To that end we will make the following exception to the normal requirements for source code distribution -- any module file which is not modified or derived from a module file included in the base distribution AND which does not require any other modules AND which does not require any modifications to the core code (code distributed with the base release) may be withheld at the authors discretion.`@\"`n`n");
|
||||
output("`@\"`2We also want to make very clear that version 0.9.7 (also known as version 0.9.7+jt) was the final version released under the GPL.");
|
||||
output("All versions, starting with the 0.9.8-prerelease code are only licensed under the Creative Commons license.");
|
||||
output("We EXPLICITLY deny the right to import any code from a 0.9.8-prerelease or later release into a 0.9.7 and earlier release.");
|
||||
output("Allowing this would cause that imported code to be released under the GPL and that is not something we wish to allow.");
|
||||
output("Authors of modifications to 0.9.7 will need to re-release their modifications as derivatives/modifications to 0.9.8 code and place them under the same Creative Commons license.");
|
||||
output("It must be done by the original author since only the original author has the right to change the copyright or license upon their work.");
|
||||
output("[Additionally, reworking the modifications will be a good idea anyway as the mechanism for making modifications is substantially cleaner/clearer starting with the 0.9.8-prerelease code.]`@\"");
|
||||
?>
|
77
lotgd-web/lotgd/lib/about/about_listmodules.php
Executable file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Page displaying active modules
|
||||
*
|
||||
* This page is part of the about system
|
||||
* and displays the name, version, author
|
||||
* and download location of all the active
|
||||
* modules on the server. Modules are sorted
|
||||
* by category, and are displayed in a table.
|
||||
*
|
||||
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
|
||||
* @version Lotgd 1.1.2 DragonPrime Edition
|
||||
* @package Core
|
||||
* @subpackage Library
|
||||
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
|
||||
*/
|
||||
addnav("About LoGD");
|
||||
addnav("About LoGD","about.php");
|
||||
addnav("Game Setup Info","about.php?op=setup");
|
||||
addnav("License Info", "about.php?op=license");
|
||||
$sql = "SELECT * from " . db_prefix("modules") . " WHERE active=1 ORDER BY category,formalname";
|
||||
$result = db_query($sql);
|
||||
$mname = translate_inline("Module Name");
|
||||
$mver = translate_inline("Version");
|
||||
$mauth = translate_inline("Module Author");
|
||||
$mdown = translate_inline("Download Location");
|
||||
rawoutput("<table border='0' cellpadding='2' cellspacing='1' bgcolor='#999999'>",true);
|
||||
rawoutput("<tr class='trhead'><td>$mname</td><td>$mver</td><td>$mauth</td><td>$mdown</td></tr>",true);
|
||||
if (db_num_rows($result) == 0) {
|
||||
rawoutput("<tr class='trlight'><td colspan='4' align='center'>");
|
||||
output("`i-- No modules installed --`i");
|
||||
rawoutput("</td></tr>");
|
||||
}
|
||||
$cat = "";
|
||||
$i=0;
|
||||
while ($row = db_fetch_assoc($result)) {
|
||||
$i++;
|
||||
if ($cat != $row['category']) {
|
||||
rawoutput("<tr class='trhead'><td colspan='4' align='left'>");
|
||||
output($row['category']);
|
||||
rawoutput(":</td></tr>");
|
||||
$cat = $row['category'];
|
||||
}
|
||||
|
||||
rawoutput("<tr class='".($i%2?"trlight":"trdark")."'>");
|
||||
rawoutput("<td valign='top'>");
|
||||
output_notl("`&%s`0", $row['formalname']);
|
||||
rawoutput("<td valign='top'>",true);
|
||||
output_notl("`^%s`0", $row['version']);
|
||||
rawoutput("</td><td valign='top'>");
|
||||
output_notl("`^%s`0", $row['moduleauthor'], true);
|
||||
rawoutput("</td><td nowrap valign='top'>");
|
||||
if ($row['download'] == "core_module") {
|
||||
rawoutput("<a href='http://dragonprime.net/index.php?module=Downloads;catd=4' target='_blank'>");
|
||||
output("Core Distribution");
|
||||
rawoutput("</a>");
|
||||
} elseif ($row['download']) {
|
||||
// We should check all legeal protocols
|
||||
$protocols = array("http","https","ftp","ftps");
|
||||
$protocol = explode(":",$row['download'],2);
|
||||
$protocol = $protocol[0];
|
||||
// This will take care of download strings such as: not publically released or contact admin
|
||||
if (!in_array($protocol,$protocols)){
|
||||
output("`\$Contact Admin for Release");
|
||||
}else{
|
||||
rawoutput("<a href='{$row['download']}' target='_blank'>");
|
||||
output("Download");
|
||||
rawoutput("</a>");
|
||||
}
|
||||
} else {
|
||||
output("`\$Not publically released.`0");
|
||||
}
|
||||
rawoutput("</td>");
|
||||
rawoutput("</tr>");
|
||||
}
|
||||
rawoutput("</table>");
|
||||
?>
|
88
lotgd-web/lotgd/lib/about/about_setup.php
Executable file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* Page displays some of the game settings
|
||||
*
|
||||
* This page is part of the about system
|
||||
* and displays some of the game settings
|
||||
* so that users know some details about
|
||||
* the server.
|
||||
*
|
||||
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
|
||||
* @version Lotgd 1.1.2 DragonPrime Edition
|
||||
* @package Core
|
||||
* @subpackage Library
|
||||
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
|
||||
*/
|
||||
addnav("About LoGD");
|
||||
addnav("About LoGD","about.php");
|
||||
addnav("Module Info","about.php?op=listmodules");
|
||||
addnav("License Info", "about.php?op=license");
|
||||
$setup = array(
|
||||
"Game Setup,title",
|
||||
"pvp"=>"Enable Slay Other Players,viewonly",
|
||||
"pvpday"=>"Player Fights per day,viewonly",
|
||||
"pvpimmunity"=>"Days that new players are safe from PvP,viewonly",
|
||||
"pvpminexp"=>"Amount of experience when players become killable in PvP,viewonly",
|
||||
"soap"=>"Clean user posts (filters bad language and splits words over 45 chars long),viewonly",
|
||||
"newplayerstartgold"=>"Amount of gold to start a new character with,viewonly",
|
||||
"New Days,title",
|
||||
"fightsforinterest"=>"Player must have fewer than how many forest fights to earn interest?,viewonly",
|
||||
"maxinterest"=>"Max Interest Rate (%),viewonly",
|
||||
"mininterest"=>"Min Interest Rate (%),viewonly",
|
||||
"daysperday"=>"Game days per calendar day,viewonly",
|
||||
"specialtybonus"=>"Extra daily uses in specialty area,viewonly",
|
||||
|
||||
"Bank settings,title",
|
||||
"borrowperlevel"=>"Max amount player can borrow per level,viewonly",
|
||||
"allowgoldtransfer"=>"Are players allowed to transfer gold,viewonly",
|
||||
"transferperlevel"=>"Max amount player can transfer per level of recipient (if transfers are enabled),viewonly",
|
||||
"mintransferlev"=>"Minimum level a player has to be before they can transfer gold (if transfers are enabled),viewonly",
|
||||
"transferreceive"=>"Total transfers a player can receive in one play day (if transfers are enabled),viewonly",
|
||||
"maxtransferout"=>"Max amount total a player can transfer to others per level (if transfers are enabled),viewonly",
|
||||
|
||||
"Forest,title",
|
||||
"turns"=>"Forest Fights per day,viewonly",
|
||||
"dropmingold"=>"Forest Creatures always drop at least 1/4 of possible gold,viewonly",
|
||||
|
||||
"Mail Settings,title",
|
||||
"mailsizelimit"=>"Message size limit per message,viewonly",
|
||||
"inboxlimit"=>"Limit # of messages in inbox,viewonly",
|
||||
"oldmail"=>"Automatically delete old messages after (days),viewonly",
|
||||
|
||||
"Content Expiration,title",
|
||||
"expirecontent"=>"Days to keep comments and news? (0 for infinite),viewonly",
|
||||
"expiretrashacct"=>"Days to keep accounts that were never logged in to? (0 for infinite),viewonly",
|
||||
"expirenewacct"=>"Days to keep level 1 accounts with no dragon kills? (0 for infinite),viewonly",
|
||||
"expireoldacct"=>"Days to keep all other accounts? (0 for infinite),viewonly",
|
||||
"LOGINTIMEOUT"=>"Seconds of inactivity before auto-logoff,viewonly"
|
||||
);
|
||||
|
||||
$useful = array(
|
||||
"Useful Information,title",
|
||||
"dayduration"=>"Day Duration,viewonly",
|
||||
"curgametime"=>"Current game time,viewonly",
|
||||
"curservertime"=>"Current Server Time,viewonly",
|
||||
"lastnewday"=>"Last new day,viewonly",
|
||||
"nextnewday"=>"Next new day,viewonly"
|
||||
);
|
||||
|
||||
$secstonextday = secondstonextgameday($details);
|
||||
$useful_vals = array(
|
||||
"dayduration"=>round(($details['dayduration']/60/60),0)." hours",
|
||||
"curgametime"=>getgametime(),
|
||||
"curservertime"=>date("Y-m-d h:i:s a"),
|
||||
"lastnewday"=>date("h:i:s a",strtotime("-{$details['realsecssofartoday']} seconds")),
|
||||
"nextnewday"=>date("h:i:s a",strtotime("+{$details['realsecstotomorrow']} seconds"))." (".date("H\\h i\\m s\\s",$secstonextday).")"
|
||||
);
|
||||
|
||||
output("`@<h3>Settings for this game</h3>`n`n",true);
|
||||
|
||||
$args = array('settings'=>array(),'values'=>array());
|
||||
$args = modulehook("showsettings", $args);
|
||||
|
||||
$form = array_merge($setup, $args['settings']);
|
||||
$form = array_merge($form, $useful);
|
||||
$vals = array_merge($settings, $args['values']);
|
||||
$vals = array_merge($vals, $useful_vals);
|
||||
showform($form,$vals,true);
|
||||
?>
|
87
lotgd-web/lotgd/lib/addnews.php
Executable file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
// addnews ready (duh ;))
|
||||
// translator ready
|
||||
// mail ready
|
||||
/**
|
||||
* News functions
|
||||
*
|
||||
* Contains functions for adding news
|
||||
* items.
|
||||
*
|
||||
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
|
||||
* @version Lotgd 1.1.2 DragonPrime Edition
|
||||
* @package Core
|
||||
* @subpackage Library
|
||||
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
|
||||
*/
|
||||
/**
|
||||
* Adds a news item for the current user
|
||||
*
|
||||
* @param $text The text of the news
|
||||
* @param $arguments... The sprintf style replacement
|
||||
* @param $hidefrombio Set to true to hide from bio
|
||||
* @return resource The result resource from the inserting query
|
||||
* @see addnews_for_user()
|
||||
* @uses addnews_for_user() Function actually adds the news item to the database
|
||||
*/
|
||||
function addnews(){
|
||||
// Format: addnews($text[, $sprintf_style_replacement1
|
||||
// [, $sprintf_style_replacement2...]]
|
||||
// [, $hidefrombio]);
|
||||
// We can pass arrays for the sprintf style replacements, which
|
||||
// represent separate translation sets in the same format as output().
|
||||
// Eg:
|
||||
// addnews("%s defeated %s in %s `n%s","Joe","Hank","the Inn",
|
||||
// array("\"Your mother smelt of elderberries,\" taunted %s.",
|
||||
// "Joe"));
|
||||
// Note that the sub-translation does need its own %s location in the
|
||||
// master output.
|
||||
global $session;
|
||||
$args = func_get_args();
|
||||
array_unshift($args, $session['user']['acctid']);
|
||||
return call_user_func_array("addnews_for_user", $args);
|
||||
}
|
||||
/**
|
||||
* Adds a news item for a user
|
||||
*
|
||||
* @param $user The id of the user for the news
|
||||
* @param $text The text of the news
|
||||
* @param $arguments... The sprintf style replacement
|
||||
* @param $hidefrombio Set to true to hide from bio
|
||||
* @return resource The result resource from the inserting query
|
||||
* @see addnews()
|
||||
*/
|
||||
function addnews_for_user()
|
||||
{
|
||||
global $translation_namespace;
|
||||
// this works just like addnews, except it can be used to add a message
|
||||
// to a different player other than the triggering player.
|
||||
$args = func_get_args();
|
||||
$user = array_shift($args);
|
||||
$news = array_shift($args);
|
||||
$hidefrombio = false;
|
||||
|
||||
if (count($args)>0){
|
||||
$arguments=array();
|
||||
foreach($args as $key=>$val){
|
||||
if ($key==count($args)-1 && $val===true){
|
||||
//if the last argument is true, we're hiding from bio;
|
||||
//don't put this in the array.
|
||||
$hidefrombio=true;
|
||||
}else{
|
||||
array_push($arguments,$val);
|
||||
}
|
||||
}
|
||||
$arguments = serialize($arguments);
|
||||
}else{
|
||||
$arguments="";
|
||||
}
|
||||
if ($hidefrombio === true) $user = 0;
|
||||
$sql = "INSERT INTO " . db_prefix("news") .
|
||||
" (newstext,newsdate,accountid,arguments,tlschema) VALUES ('" .
|
||||
addslashes($news) . "','" . date("Y-m-d H:i:s") . "'," .
|
||||
$user .",'".addslashes($arguments)."','".$translation_namespace."')";
|
||||
return db_query($sql);
|
||||
}
|
||||
|
||||
?>
|
1492
lotgd-web/lotgd/lib/all_tables.php
Executable file
54
lotgd-web/lotgd/lib/arraytourl.php
Executable file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
/**
|
||||
* URL <-> array functions
|
||||
*
|
||||
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
|
||||
* @version Lotgd 1.1.2 DragonPrime Edition
|
||||
* @package Core
|
||||
* @subpackage Library
|
||||
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
|
||||
*/
|
||||
/**
|
||||
* Turns an array into an URL argument string
|
||||
*
|
||||
* Takes an array and encodes it in key=val&key=val form.
|
||||
* Does not add starting ?
|
||||
*
|
||||
* @param array $array The array to turn into an URL
|
||||
* @return string The URL
|
||||
*/
|
||||
function arraytourl($array){
|
||||
//takes an array and encodes it in key=val&key=val form.
|
||||
$url="";
|
||||
$i=0;
|
||||
foreach($array as $key=>$val){
|
||||
if ($i>0) $url.="&";
|
||||
$i++;
|
||||
$url.=rawurlencode($key)."=".rawurlencode($val);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
/**
|
||||
* Takes an array and returns its arguments in an array
|
||||
*
|
||||
* @param string $url The URL
|
||||
* @return array The arguments from the URL
|
||||
*/
|
||||
function urltoarray($url){
|
||||
//takes a URL and returns its arguments in array form.
|
||||
if (strpos($url,"?")!==false){
|
||||
$url = substr($array,strpos($url,"?")+1);
|
||||
}
|
||||
$a = explode("&",$url);
|
||||
$array = array();
|
||||
foreach($a as $val){
|
||||
$b = explode("=",$val);
|
||||
$array[urldecode($b[0])] = urldecode($b[1]);
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
?>
|
39
lotgd-web/lotgd/lib/arrayutil.php
Executable file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
/**
|
||||
* Misc array functions
|
||||
*
|
||||
* Contains functions that perform
|
||||
* various functions on arrays.
|
||||
*
|
||||
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
|
||||
* @version Lotgd 1.1.2 DragonPrime Edition
|
||||
* @package Core
|
||||
* @subpackage Library
|
||||
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
|
||||
*/
|
||||
/**
|
||||
* Turns the given parameter into a string
|
||||
*
|
||||
* If the given parameter is an array or object,
|
||||
* it is serialized, and the serialized string is
|
||||
* return.
|
||||
*
|
||||
* Otherwise, the parameter is cast as a string
|
||||
* and returned.
|
||||
*
|
||||
* @param mixed $array
|
||||
* @return string The parameter converted to a string
|
||||
*/
|
||||
function createstring($array){
|
||||
if (is_array($array) || is_object($array)){
|
||||
$out = serialize($array);
|
||||
} else {
|
||||
$out = (string)$array;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
?>
|
348
lotgd-web/lotgd/lib/battle-buffs.php
Executable file
@ -0,0 +1,348 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
|
||||
* @version Lotgd 1.1.2 DragonPrime Edition
|
||||
* @package Core
|
||||
* @subpackage Library
|
||||
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
|
||||
*/
|
||||
|
||||
require_once("lib/substitute.php");
|
||||
|
||||
function activate_buffs($tag) {
|
||||
global $session, $badguy, $count;
|
||||
tlschema("buffs");
|
||||
$result = array();
|
||||
$result['invulnerable'] = 0;
|
||||
$result['dmgmod'] = 1;
|
||||
$result['compdmgmod'] = 1;
|
||||
$result['badguydmgmod'] = 1;
|
||||
$result['atkmod'] = 1;
|
||||
$result['compatkmod'] = 1;
|
||||
$result['badguyatkmod'] = 1;
|
||||
$result['defmod'] = 1;
|
||||
$result['compdefmod'] = 1;
|
||||
$result['badguydefmod'] = 1;
|
||||
$result['lifetap'] = array();
|
||||
$result['dmgshield'] = array();
|
||||
|
||||
foreach($session['bufflist'] as $key=>$buff) {
|
||||
if (array_key_exists('suspended',$buff) && $buff['suspended']) continue;
|
||||
if ($buff['schema']) tlschema($buff['schema']);
|
||||
if (isset($buff['startmsg'])) {
|
||||
if (is_array($buff['startmsg'])) {
|
||||
$buff['startmsg'] = str_replace("`%", "`%%", $buff['startmsg']);
|
||||
$msg = sprintf_translate($buff['startmsg']);
|
||||
$msg = substitute("`5".$msg."`0`n");
|
||||
output_notl($msg); //Here it's already translated
|
||||
}else{
|
||||
$msg = substitute_array("`5".$buff['startmsg']."`0`n");
|
||||
output($msg);
|
||||
}
|
||||
unset($session['bufflist'][$key]['startmsg']);
|
||||
}
|
||||
|
||||
// Figure out activate based on buff features
|
||||
$activate = false;
|
||||
if ($tag == "roundstart") {
|
||||
if (isset($buff['regen'])) $activate = true;
|
||||
if (isset($buff['minioncount'])) $activate = true;
|
||||
} else if ($tag == "offense") {
|
||||
if (isset($buff['invulnerable']) && $buff['invulnerable'])
|
||||
$activate = true;
|
||||
if (isset($buff['atkmod'])) $activate = true;
|
||||
if (isset($buff['dmgmod'])) $activate = true;
|
||||
if (isset($buff['badguydefmod'])) $activate = true;
|
||||
if (isset($buff['lifetap'])) $activate = true;
|
||||
if (isset($buff['damageshield'])) $activate = true;
|
||||
} else if ($tag == "defense") {
|
||||
if (isset($buff['invulnerable']) && $buff['invulnerable'])
|
||||
$activate = true;
|
||||
if (isset($buff['defmod'])) $activate = true;
|
||||
if (isset($buff['badguyatkmod'])) $activate = true;
|
||||
if (isset($buff['badguydmgmod'])) $activate = true;
|
||||
if (isset($buff['lifetap'])) $activate = true;
|
||||
if (isset($buff['damageshield'])) $activate = true;
|
||||
}
|
||||
|
||||
// If this should activate now and it hasn't already activated,
|
||||
// do the round message and mark it.
|
||||
if ($activate && (!array_key_exists('used',$buff) || !$buff['used'])) {
|
||||
// mark it used.
|
||||
$session['bufflist'][$key]['used'] = 1;
|
||||
// if it has a 'round message', run it.
|
||||
if (isset($buff['roundmsg'])) {
|
||||
if (is_array($buff['roundmsg'])) {
|
||||
$buff['roundmsg'] = str_replace("`%", "`%%", $buff['roundmsg']);
|
||||
$msg = sprintf_translate($buff['roundmsg']);
|
||||
$msg = substitute("`5".$msg."`0`n");
|
||||
output_notl($msg); //Here it's already translated
|
||||
}else{
|
||||
$msg = substitute_array("`5".$buff['roundmsg']."`0`n");
|
||||
output($msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now, calculate any effects and run them if needed.
|
||||
if (isset($buff['invulnerable']) && $buff['invulnerable']) {
|
||||
$result['invulnerable'] = 1;
|
||||
}
|
||||
if (isset($buff['atkmod'])) {
|
||||
$result['atkmod'] *= $buff['atkmod'];
|
||||
if (isset($buff['aura']) && $buff['aura']) {
|
||||
$result['compatkmod'] *= $buff['atkmod'];
|
||||
}
|
||||
}
|
||||
if (isset($buff['badguyatkmod'])) {
|
||||
$result['badguyatkmod'] *= $buff['badguyatkmod'];
|
||||
}
|
||||
if (isset($buff['defmod'])) {
|
||||
$result['defmod'] *= $buff['defmod'];
|
||||
if (isset($buff['aura']) && $buff['aura']) {
|
||||
$result['compdefmod'] *= $buff['defmod'];
|
||||
}
|
||||
}
|
||||
if (isset($buff['badguydefmod'])) {
|
||||
$result['badguydefmod'] *= $buff['badguydefmod'];
|
||||
}
|
||||
if (isset($buff['dmgmod'])) {
|
||||
$result['dmgmod'] *= $buff['dmgmod'];
|
||||
if (isset($buff['aura']) && $buff['aura']) {
|
||||
$result['compdmgmod'] *= $buff['dmgmod'];
|
||||
}
|
||||
}
|
||||
if (isset($buff['badguydmgmod'])) {
|
||||
$result['badguydmgmod'] *= $buff['badguydmgmod'];
|
||||
}
|
||||
if (isset($buff['lifetap'])) {
|
||||
array_push($result['lifetap'], $buff);
|
||||
}
|
||||
if (isset($buff['damageshield'])) {
|
||||
array_push($result['dmgshield'], $buff);
|
||||
}
|
||||
if (isset($buff['regen']) && $tag == "roundstart" && $badguy['istarget'] == true) {
|
||||
$hptoregen = (int)$buff['regen'];
|
||||
$hpdiff = $session['user']['maxhitpoints'] - $session['user']['hitpoints'];
|
||||
// Don't regen if we are above max hp
|
||||
if ($hpdiff < 0) $hpdiff = 0;
|
||||
if ($hpdiff < $hptoregen) $hptoregen = $hpdiff;
|
||||
$session['user']['hitpoints'] += $hptoregen;
|
||||
// Now, take abs value just incase this was a damaging buff
|
||||
$hptoregen = abs($hptoregen);
|
||||
if ($hptoregen == 0) $msg = $buff['effectnodmgmsg'];
|
||||
else $msg = $buff['effectmsg'];
|
||||
|
||||
if (is_array($msg)) {
|
||||
$msg = sprintf_translate($msg);
|
||||
$msg = substitute("`)".$msg."`0`n", array("{damage}"), array($hptoregen));
|
||||
output_notl($msg); //Here it's already translated
|
||||
}elseif ($msg!="") {
|
||||
$msg = substitute_array("`)".$msg."`0`n", array("{damage}"), array($hptoregen));
|
||||
output($msg);
|
||||
}
|
||||
if (isset($buff['aura']) && $buff['aura'] == true) {
|
||||
global $companions;
|
||||
$auraeffect = (int)round($buff['regen']/3);
|
||||
if (is_array($companions) && count($companions)>0 && $auraeffect != 0) {
|
||||
foreach ($companions as $name => $companion) {
|
||||
$unset = false;
|
||||
// Need this for <PHP 5 support
|
||||
$companion = &$companions[$name];
|
||||
// if a companion is damaged AND ( a companion ist still alive OR ( a companion is unconscious AND it's a healing effect))
|
||||
if ($companion['hitpoints'] < $companion['maxhitpoints'] && ($companion['hitpoints'] > 0 || ($companion['cannotdie'] == true && $auraeffect > 0))) {
|
||||
$hptoregen = min($auraeffect, $companion['maxhitpoints']-$companion['hitpoints']);
|
||||
$companion['hitpoints'] += $hptoregen;
|
||||
$msg = substitute_array("`)".$buff['auramsg']."`0`n", array("{damage}","{companion}"),array($hptoregen,$companion['name']));
|
||||
output($msg);
|
||||
if ($hptoregen < 0 && $companion['hitpoints'] <= 0) {
|
||||
if (isset($companion['dyingtext'])) {
|
||||
tlschema("battle");
|
||||
output($companion['dyingtext']);
|
||||
tlschema();
|
||||
}
|
||||
if (isset($companion['cannotdie']) && $companion['cannotdie'] == true) {
|
||||
$companion['hitpoints'] = 0;
|
||||
} else {
|
||||
$unset = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$unset) $newcompanions[$name] = $companion;
|
||||
}
|
||||
$companions = $newcompanions; // Seemed to need this...
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($buff['minioncount']) && $tag == "roundstart" && ((isset($buff['areadamage']) && $buff['areadamage'] == true) || $badguy['istarget'] == true) && $badguy['dead'] == false) {
|
||||
$who = -1;
|
||||
if (isset($buff['maxbadguydamage']) &&
|
||||
$buff['maxbadguydamage'] <> 0) {
|
||||
$max = $buff['maxbadguydamage'];
|
||||
$min = isset($buff['minbadguydamage'])?$buff['minbadguydamage']:0;
|
||||
$who = 0;
|
||||
} else {
|
||||
$max = isset($buff['maxgoodguydamage'])?$buff['maxgoodguydamage']:0;
|
||||
$min = isset($buff['mingoodguydamage'])?$buff['mingoodguydamage']:0;
|
||||
$who = 1;
|
||||
}
|
||||
$minioncounter = 1;
|
||||
while ($minioncounter <= $buff['minioncount'] && $who >= 0) {
|
||||
$damage = e_rand($min, $max);
|
||||
if ($who == 0) {
|
||||
$badguy['creaturehealth'] -= $damage;
|
||||
if ($badguy['creaturehealth'] <= 0) {
|
||||
$badguy['istarget'] = false;
|
||||
$badguy['dead'] = true;
|
||||
$count = 1;
|
||||
}
|
||||
} else if ($who == 1) {
|
||||
$session['user']['hitpoints'] -= $damage;
|
||||
}
|
||||
if ($damage < 0) {
|
||||
$msg = $buff['effectfailmsg'];
|
||||
} else if ($damage == 0) {
|
||||
$msg = $buff['effectnodmgmsg'];
|
||||
} else if ($damage > 0) {
|
||||
$msg = $buff['effectmsg'];
|
||||
}
|
||||
if (is_array($msg)) {
|
||||
$msg = sprintf_translate($msg);
|
||||
$msg = substitute("`)".$msg."`0`n", array("{damage}"), array(abs($damage)));
|
||||
output_notl($msg); //Here it's already translated
|
||||
}else if ($msg>"") {
|
||||
$msg = substitute_array("`)".$msg."`0`n", array("{damage}"), array(abs($damage)));
|
||||
output($msg);
|
||||
}
|
||||
if ($badguy['dead'] == true) break;
|
||||
$minioncounter++;
|
||||
}
|
||||
}
|
||||
if ($buff['schema']) tlschema();
|
||||
}
|
||||
tlschema();
|
||||
return $result;
|
||||
}
|
||||
|
||||
function process_lifetaps($ltaps, $damage) {
|
||||
global $session, $badguy;
|
||||
tlschema("buffs");
|
||||
foreach($ltaps as $buff) {
|
||||
if (isset($buff['suspended']) && $buff['suspended']) continue;
|
||||
if ($buff['schema']) tlschema($buff['schema']);
|
||||
$healhp = $session['user']['maxhitpoints'] - $session['user']['hitpoints'];
|
||||
if ($healhp < 0) {
|
||||
$healhp = 0;
|
||||
}
|
||||
if ($healhp == 0) {
|
||||
$msg = isset($buff['effectnodmgmsg'])?$buff['effectnodmgmsg']:"";
|
||||
} else {
|
||||
if ($healhp > $damage * $buff['lifetap']) {
|
||||
$healhp = round($damage * $buff['lifetap'], 0);
|
||||
}
|
||||
if ($healhp < 0) {
|
||||
$healhp = 0;
|
||||
}
|
||||
if ($healhp > 0) {
|
||||
$msg = isset($buff['effectmsg'])?$buff['effectmsg']:"";
|
||||
} else if ($healhp == 0) {
|
||||
$msg = isset($buff['effectfailmsg'])?$buff['effectfailmsg']:"";
|
||||
}
|
||||
}
|
||||
$session['user']['hitpoints'] += $healhp;
|
||||
if (is_array($msg)) {
|
||||
$msg = sprintf_translate($msg);
|
||||
$msg = substitute("`)".$msg."`0`n", array("{damage}"), array($healhp));
|
||||
output_notl($msg); //Here it's already translated
|
||||
}else if ($msg>"") {
|
||||
$msg = substitute_array("`)".$msg."`0`n", array("{damage}"), array($healhp));
|
||||
output($msg);
|
||||
}
|
||||
if ($buff['schema']) tlschema();
|
||||
}
|
||||
tlschema();
|
||||
}
|
||||
|
||||
function process_dmgshield($dshield, $damage) {
|
||||
global $session, $badguy;
|
||||
tlschema("buffs");
|
||||
foreach($dshield as $buff) {
|
||||
if (isset($buff['suspended']) && $buff['suspended']) {
|
||||
continue;
|
||||
}
|
||||
if ($buff['schema']) {
|
||||
tlschema($buff['schema']);
|
||||
}
|
||||
$realdamage = round($damage * $buff['damageshield'], 0);
|
||||
if ($realdamage < 0) {
|
||||
$realdamage = 0;
|
||||
}
|
||||
$msg = "";
|
||||
if ($realdamage > 0) {
|
||||
if (isset($buff['effectmsg'])) {
|
||||
$msg = $buff['effectmsg'];
|
||||
}
|
||||
} else if ($realdamage == 0) {
|
||||
if (isset($buff['effectfailmsg'])) {
|
||||
$msg = $buff['effectfailmsg'];
|
||||
}
|
||||
}
|
||||
$badguy['creaturehealth'] -= $realdamage;
|
||||
if ($badguy['creaturehealth'] <= 0) {
|
||||
$badguy['istarget'] = false;
|
||||
$badguy['dead'] = true;
|
||||
$count = 1;
|
||||
}
|
||||
if (is_array($msg)) {
|
||||
$msg = sprintf_translate($msg);
|
||||
$msg = substitute("`)".$msg."`0`n", array("{damage}"), array($realdamage));
|
||||
output_notl($msg); //Here it's already translated
|
||||
}else if ($msg>"") {
|
||||
$msg = substitute_array("`)".$msg."`0`n", array("{damage}"), array($realdamage));
|
||||
output($msg);
|
||||
}
|
||||
if ($buff['schema']) {
|
||||
tlschema();
|
||||
}
|
||||
}
|
||||
tlschema();
|
||||
}
|
||||
|
||||
function expire_buffs() {
|
||||
global $session, $badguy;
|
||||
tlschema("buffs");
|
||||
foreach($session['bufflist'] as $key=>$buff) {
|
||||
if (array_key_exists('suspended',$buff) && $buff['suspended']) continue;
|
||||
if ($buff['schema']) tlschema($buff['schema']);
|
||||
if (array_key_exists('used',$buff) && $buff['used']) {
|
||||
$session['bufflist'][$key]['used'] = 0;
|
||||
if ($session['bufflist'][$key]['rounds']>0) {
|
||||
$session['bufflist'][$key]['rounds']--;
|
||||
}
|
||||
if ((int)$session['bufflist'][$key]['rounds'] == 0) {
|
||||
if (isset($buff['wearoff']) && $buff['wearoff']) {
|
||||
if (is_array($buff['wearoff'])) {
|
||||
$buff['wearoff'] = str_replace("`%", "`%%", $buff['wearoff']);
|
||||
$msg = sprintf_translate($buff['wearoff']);
|
||||
$msg = substitute("`5".$msg."`0`n");
|
||||
output_notl($msg); //Here it's already translated
|
||||
}else{
|
||||
$msg = substitute_array("`5".$buff['wearoff']."`0`n");
|
||||
output($msg);
|
||||
}
|
||||
}
|
||||
//unset($session['bufflist'][$key]);
|
||||
strip_buff($key);
|
||||
}
|
||||
}
|
||||
if ($buff['schema']) tlschema();
|
||||
}
|
||||
tlschema();
|
||||
}
|
||||
|
||||
?>
|
279
lotgd-web/lotgd/lib/battle-skills.php
Executable file
@ -0,0 +1,279 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
require_once("lib/bell_rand.php");
|
||||
require_once("lib/e_rand.php");
|
||||
require_once("lib/buffs.php");
|
||||
|
||||
function rolldamage(){
|
||||
global $badguy,$session,$creatureattack,$creatureatkmod,$adjustment;
|
||||
global $creaturedefmod,$defmod,$atkmod,$buffset,$atk,$def,$options;
|
||||
|
||||
if ($badguy['creaturehealth']>0 && $session['user']['hitpoints']>0){
|
||||
if ($options['type']=='pvp') {
|
||||
$adjustedcreaturedefense = $badguy['creaturedefense'];
|
||||
} else {
|
||||
$adjustedcreaturedefense =
|
||||
($creaturedefmod*$badguy['creaturedefense'] /
|
||||
($adjustment*$adjustment));
|
||||
}
|
||||
|
||||
$creatureattack = $badguy['creatureattack']*$creatureatkmod;
|
||||
$adjustedselfdefense = ($session['user']['defense'] * $adjustment * $defmod);
|
||||
|
||||
/*
|
||||
debug("Base creature defense: " . $badguy['creaturedefense']);
|
||||
debug("Creature defense mod: $creaturedefmod");
|
||||
debug("Adjustment: $adjustment");
|
||||
debug("Adjusted creature defense: $adjustedcreaturedefense");
|
||||
debug("Adjusted creature attack: $creatureattack");
|
||||
debug("Adjusted self defense: $adjustedselfdefense");
|
||||
*/
|
||||
|
||||
while(!isset($creaturedmg) || !isset($selfdmg) || $creaturedmg==0 && $selfdmg==0){
|
||||
$atk = $session['user']['attack']*$atkmod;
|
||||
if (e_rand(1,20)==1 && $options['type'] != "pvp") $atk*=3;
|
||||
/*
|
||||
debug("Attack score: $atk");
|
||||
*/
|
||||
|
||||
$patkroll = bell_rand(0,$atk);
|
||||
/*
|
||||
debug("Player Attack roll: $patkroll");
|
||||
*/
|
||||
|
||||
// Set up for crit detection
|
||||
$atk = $patkroll;
|
||||
$catkroll = bell_rand(0,$adjustedcreaturedefense);
|
||||
/*
|
||||
debug("Creature defense roll: $catkroll");
|
||||
*/
|
||||
|
||||
$creaturedmg = 0-(int)($catkroll - $patkroll);
|
||||
if ($creaturedmg<0) {
|
||||
$creaturedmg = (int)($creaturedmg/2);
|
||||
$creaturedmg = round($buffset['badguydmgmod'] *
|
||||
$creaturedmg, 0);
|
||||
}
|
||||
if ($creaturedmg > 0) {
|
||||
$creaturedmg = round($buffset['dmgmod']*$creaturedmg,0);
|
||||
}
|
||||
$pdefroll = bell_rand(0,$adjustedselfdefense);
|
||||
$catkroll = bell_rand(0,$creatureattack);
|
||||
/*
|
||||
debug("Creature attack roll: $catkroll");
|
||||
debug("Player defense roll: $pdefroll");
|
||||
*/
|
||||
$selfdmg = 0-(int)($pdefroll - $catkroll);
|
||||
if ($selfdmg<0) {
|
||||
$selfdmg=(int)($selfdmg/2);
|
||||
$selfdmg = round($selfdmg*$buffset['dmgmod'], 0);
|
||||
}
|
||||
if ($selfdmg > 0) {
|
||||
$selfdmg = round($selfdmg*$buffset['badguydmgmod'], 0);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$creaturedmg=0;
|
||||
$selfdmg=0;
|
||||
}
|
||||
// Handle god mode's invulnerability
|
||||
if ($buffset['invulnerable']) {
|
||||
$creaturedmg = abs($creaturedmg);
|
||||
$selfdmg = -abs($selfdmg);
|
||||
}
|
||||
return array("creaturedmg"=>(isset($creaturedmg)?$creaturedmg:0),"selfdmg"=>(isset($selfdmg)?$selfdmg:0));
|
||||
}
|
||||
|
||||
function report_power_move($crit, $dmg) {
|
||||
global $session;
|
||||
$uatk = $session['user']['attack'];
|
||||
if ($crit > $uatk) {
|
||||
$power = 0;
|
||||
if ($crit > $uatk*4) {
|
||||
$msg = "`&`bYou execute a `%MEGA`& power move!!!`b`n";
|
||||
$power=1;
|
||||
|
||||
} elseif ($crit > $uatk*3) {
|
||||
$msg = "`&`bYou execute a `^DOUBLE`& power move!!!`b`n";
|
||||
$power=1;
|
||||
} elseif ($crit > $uatk*2) {
|
||||
$msg = "`&`bYou execute a power move!!!`b`0`n";
|
||||
$power=1;
|
||||
}elseif ($crit > ($uatk * 1.5)) {
|
||||
$msg = "`7`bYou execute a minor power move!`b`0`n";
|
||||
$power=1;
|
||||
}
|
||||
if ($power) {
|
||||
tlschema("battle");
|
||||
output($msg);
|
||||
tlschema();
|
||||
|
||||
$dmg += e_rand($crit/4, $crit/2);
|
||||
$dmg = max($dmg, 1);
|
||||
}
|
||||
}
|
||||
return $dmg;
|
||||
}
|
||||
|
||||
|
||||
function suspend_buffs($susp=false, $msg=false){
|
||||
global $session, $badguy;
|
||||
$suspendnotify = 0;
|
||||
reset($session['bufflist']);
|
||||
while (list($key,$buff)=each($session['bufflist'])){
|
||||
if (array_key_exists('suspended', $buff) && $buff['suspended'])
|
||||
continue;
|
||||
// Suspend non pvp allowed buffs when in pvp
|
||||
if ($susp && (!isset($buff[$susp]) || !$buff[$susp])) {
|
||||
$session['bufflist'][$key]['suspended'] = 1;
|
||||
$suspendnotify = 1;
|
||||
}
|
||||
// reset the 'used this round state'
|
||||
$buff['used']=0;
|
||||
}
|
||||
|
||||
if ($suspendnotify) {
|
||||
$schema = false;
|
||||
if ($msg === false) {
|
||||
$schema = "battle";
|
||||
$msg = "`&The gods have suspended some of your enhancements!`n";
|
||||
}
|
||||
if ($schema) tlschema($schema);
|
||||
output($msg);
|
||||
if ($schema) tlschema();
|
||||
}
|
||||
}
|
||||
|
||||
function suspend_buff_by_name($name, $msg=false) {
|
||||
global $session;
|
||||
// If it's not already suspended.
|
||||
if ($session['bufflist'][$name] &&
|
||||
!$session['bufflist'][$name]['suspended']) {
|
||||
$session['bufflist'][$name]['suspended'] = 1;
|
||||
|
||||
// And notify.
|
||||
$schema = false;
|
||||
if ($msg === false) {
|
||||
$schema = "battle";
|
||||
$msg = "`&The gods have suspended some of your enhancements!`n";
|
||||
}
|
||||
if ($schema) tlschema($schema);
|
||||
output($msg);
|
||||
if ($schema) tlschema();
|
||||
}
|
||||
}
|
||||
|
||||
function unsuspend_buff_by_name($name, $msg=false) {
|
||||
global $session;
|
||||
// If it's not already suspended.
|
||||
if ($session['bufflist'][$name] &&
|
||||
$session['bufflist'][$name]['suspended']) {
|
||||
$session['bufflist'][$name]['suspended'] = 0;
|
||||
|
||||
// And notify.
|
||||
$schema = false;
|
||||
if ($msg === false) {
|
||||
$schema = "battle";
|
||||
$msg = "`&The gods have restored all suspended enhancements.`n`n";
|
||||
}
|
||||
if ($schema) tlschema($schema);
|
||||
output($msg);
|
||||
if ($schema) tlschema();
|
||||
}
|
||||
}
|
||||
|
||||
function is_buff_active($name) {
|
||||
global $session;
|
||||
// If it's not already suspended.
|
||||
return (($session['bufflist'][$name] && !$session['bufflist'][$name]['suspended'])?1:0);
|
||||
}
|
||||
|
||||
|
||||
function unsuspend_buffs($susp=false,$msg=false) {
|
||||
global $session, $badguy;
|
||||
$unsuspendnotify = 0;
|
||||
reset($session['bufflist']);
|
||||
while (list($key,$buff)=each($session['bufflist'])){
|
||||
if (array_key_exists("expireafterfight",$buff) && $buff['expireafterfight']) unset($session['bufflist'][$key]);
|
||||
elseif (array_key_exists("suspended",$buff) && $buff['suspended'] && $susp && (!array_key_exists($susp, $buff) || !$buff[$susp])) {
|
||||
$session['bufflist'][$key]['suspended'] = 0;
|
||||
$unsuspendnotify=1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($unsuspendnotify) {
|
||||
$schema = false;
|
||||
if ($msg === false) {
|
||||
$schema = "battle";
|
||||
$msg = "`&The gods have restored all suspended enhancements.`n`n";
|
||||
}
|
||||
if ($schema) tlschema($schema);
|
||||
output($msg);
|
||||
if ($schema) tlschema();
|
||||
}
|
||||
}
|
||||
|
||||
function apply_bodyguard($level){
|
||||
global $session, $badguy;
|
||||
if (!isset($session['bufflist']['bodyguard'])) {
|
||||
switch($level){
|
||||
case 1:
|
||||
$badguyatkmod=1.05;
|
||||
$defmod=0.95;
|
||||
$rounds=-1;
|
||||
break;
|
||||
case 2:
|
||||
$badguyatkmod=1.1;
|
||||
$defmod=0.9;
|
||||
$rounds=-1;
|
||||
break;
|
||||
case 3:
|
||||
$badguyatkmod=1.2;
|
||||
$defmod=0.8;
|
||||
$rounds=-1;
|
||||
break;
|
||||
case 4:
|
||||
$badguyatkmod=1.3;
|
||||
$defmod=0.7;
|
||||
$rounds=-1;
|
||||
break;
|
||||
case 5:
|
||||
$badguyatkmod=1.4;
|
||||
$defmod=0.6;
|
||||
$rounds=-1;
|
||||
break;
|
||||
}
|
||||
apply_buff('bodyguard' , array(
|
||||
"startmsg"=>"`\${badguy}'s bodyguard protects them!",
|
||||
"name"=>"`&Bodyguard",
|
||||
"wearoff"=>"The bodyguard seems to have fallen asleep.",
|
||||
"badguyatkmod"=>$badguyatkmod,
|
||||
"defmod"=>$defmod,
|
||||
"rounds"=>$rounds,
|
||||
"allowinpvp"=>1,
|
||||
"expireafterfight"=>1,
|
||||
"schema"=>"pvp"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function apply_skill($skill,$l){
|
||||
global $session;
|
||||
if ($skill=="godmode"){
|
||||
apply_buff('godmode',array(
|
||||
"name"=>"`&GOD MODE",
|
||||
"rounds"=>1,
|
||||
"wearoff"=>"You feel mortal again.",
|
||||
"atkmod"=>25,
|
||||
"defmod"=>25,
|
||||
"invulnerable"=>1,
|
||||
"startmsg"=>"`&`bYou feel godlike.`b",
|
||||
"schema"=>"skill"
|
||||
));
|
||||
}
|
||||
modulehook("apply-specialties");
|
||||
}
|
||||
?>
|
630
lotgd-web/lotgd/lib/bell_rand.php
Executable file
@ -0,0 +1,630 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
$bell_curve=0;
|
||||
function bell_rand($min=false,$max=false){
|
||||
global $bell_curve;
|
||||
if ($min===false && $max===false) {
|
||||
//no value passed, assume 0 min, and 1 max.
|
||||
$min=0;
|
||||
$max=1;
|
||||
}
|
||||
if ($max===false){ // here got something mixed up in the previous versions
|
||||
//only one value passed, assume it is the max.
|
||||
$max = $min;
|
||||
$min = 0;
|
||||
}
|
||||
if($min>$max){
|
||||
//min is bigger than max, switch.
|
||||
$x = $max;
|
||||
$max = $min;
|
||||
$min = $x;
|
||||
}
|
||||
if (($min-$max)==0){
|
||||
//equal values, return one of them.
|
||||
return $min;
|
||||
}
|
||||
if (!is_array($bell_curve)){
|
||||
$bell_curve = array(
|
||||
3 => -0.716599,
|
||||
4 => -0.708501841,
|
||||
5 => -0.688258942,
|
||||
6 => -0.676113203,
|
||||
7 => -0.659918884,
|
||||
8 => -0.651821725,
|
||||
9 => -0.639675985,
|
||||
10 => -0.631578826,
|
||||
11 => -0.627530246,
|
||||
12 => -0.619433087,
|
||||
13 => -0.611335927,
|
||||
14 => -0.607287348,
|
||||
15 => -0.599190188,
|
||||
16 => -0.595141608,
|
||||
17 => -0.591093029,
|
||||
18 => -0.587044449,
|
||||
19 => -0.582995869,
|
||||
20 => -0.57894729,
|
||||
21 => -0.57489871,
|
||||
22 => -0.57085013,
|
||||
23 => -0.56680155,
|
||||
24 => -0.562752971,
|
||||
25 => -0.558704391,
|
||||
26 => -0.554655811,
|
||||
28 => -0.550607232,
|
||||
29 => -0.546558652,
|
||||
31 => -0.542510072,
|
||||
32 => -0.538461492,
|
||||
34 => -0.534412913,
|
||||
35 => -0.530364333,
|
||||
37 => -0.526315753,
|
||||
39 => -0.522267174,
|
||||
41 => -0.518218594,
|
||||
43 => -0.514170014,
|
||||
45 => -0.510121434,
|
||||
47 => -0.506072855,
|
||||
50 => -0.502024275,
|
||||
52 => -0.497975695,
|
||||
54 => -0.493927115,
|
||||
57 => -0.489878536,
|
||||
60 => -0.485829956,
|
||||
63 => -0.481781376,
|
||||
66 => -0.477732797,
|
||||
69 => -0.473684217,
|
||||
72 => -0.469635637,
|
||||
75 => -0.465587057,
|
||||
79 => -0.461538478,
|
||||
83 => -0.457489898,
|
||||
86 => -0.453441318,
|
||||
90 => -0.449392739,
|
||||
95 => -0.445344159,
|
||||
99 => -0.441295579,
|
||||
104 => -0.437246999,
|
||||
108 => -0.43319842,
|
||||
113 => -0.42914984,
|
||||
118 => -0.42510126,
|
||||
124 => -0.421052681,
|
||||
129 => -0.417004101,
|
||||
135 => -0.412955521,
|
||||
141 => -0.408906941,
|
||||
147 => -0.404858362,
|
||||
154 => -0.400809782,
|
||||
161 => -0.396761202,
|
||||
168 => -0.392712623,
|
||||
175 => -0.388664043,
|
||||
183 => -0.384615463,
|
||||
191 => -0.380566883,
|
||||
199 => -0.376518304,
|
||||
207 => -0.372469724,
|
||||
216 => -0.368421144,
|
||||
226 => -0.364372565,
|
||||
235 => -0.360323985,
|
||||
245 => -0.356275405,
|
||||
256 => -0.352226825,
|
||||
266 => -0.348178246,
|
||||
277 => -0.344129666,
|
||||
289 => -0.340081086,
|
||||
301 => -0.336032506,
|
||||
313 => -0.331983927,
|
||||
326 => -0.327935347,
|
||||
340 => -0.323886767,
|
||||
354 => -0.319838188,
|
||||
368 => -0.315789608,
|
||||
383 => -0.311741028,
|
||||
399 => -0.307692448,
|
||||
415 => -0.303643869,
|
||||
431 => -0.299595289,
|
||||
448 => -0.295546709,
|
||||
466 => -0.29149813,
|
||||
485 => -0.28744955,
|
||||
504 => -0.28340097,
|
||||
523 => -0.27935239,
|
||||
544 => -0.275303811,
|
||||
565 => -0.271255231,
|
||||
587 => -0.267206651,
|
||||
609 => -0.263158072,
|
||||
633 => -0.259109492,
|
||||
657 => -0.255060912,
|
||||
682 => -0.251012332,
|
||||
708 => -0.246963753,
|
||||
734 => -0.242915173,
|
||||
762 => -0.238866593,
|
||||
790 => -0.234818014,
|
||||
820 => -0.230769434,
|
||||
850 => -0.226720854,
|
||||
881 => -0.222672274,
|
||||
914 => -0.218623695,
|
||||
947 => -0.214575115,
|
||||
982 => -0.210526535,
|
||||
1017 => -0.206477955,
|
||||
1054 => -0.202429376,
|
||||
1091 => -0.198380796,
|
||||
1130 => -0.194332216,
|
||||
1171 => -0.190283637,
|
||||
1212 => -0.186235057,
|
||||
1255 => -0.182186477,
|
||||
1298 => -0.178137897,
|
||||
1344 => -0.174089318,
|
||||
1390 => -0.170040738,
|
||||
1438 => -0.165992158,
|
||||
1488 => -0.161943579,
|
||||
1539 => -0.157894999,
|
||||
1591 => -0.153846419,
|
||||
1645 => -0.149797839,
|
||||
1700 => -0.14574926,
|
||||
1757 => -0.14170068,
|
||||
1816 => -0.1376521,
|
||||
1876 => -0.133603521,
|
||||
1938 => -0.129554941,
|
||||
2002 => -0.125506361,
|
||||
2068 => -0.121457781,
|
||||
2135 => -0.117409202,
|
||||
2204 => -0.113360622,
|
||||
2275 => -0.109312042,
|
||||
2348 => -0.105263463,
|
||||
2423 => -0.101214883,
|
||||
2500 => -0.097166303,
|
||||
2579 => -0.093117723,
|
||||
2660 => -0.089069144,
|
||||
2743 => -0.085020564,
|
||||
2828 => -0.080971984,
|
||||
2916 => -0.076923405,
|
||||
3005 => -0.072874825,
|
||||
3097 => -0.068826245,
|
||||
3192 => -0.064777665,
|
||||
3288 => -0.060729086,
|
||||
3387 => -0.056680506,
|
||||
3489 => -0.052631926,
|
||||
3593 => -0.048583346,
|
||||
3700 => -0.044534767,
|
||||
3809 => -0.040486187,
|
||||
3920 => -0.036437607,
|
||||
4035 => -0.032389028,
|
||||
4152 => -0.028340448,
|
||||
4272 => -0.024291868,
|
||||
4394 => -0.020243288,
|
||||
4520 => -0.016194709,
|
||||
4648 => -0.012146129,
|
||||
4779 => -0.008097549,
|
||||
4913 => -0.00404897,
|
||||
5050 => 0, // 5th percentile
|
||||
5190 => 0.00404819,
|
||||
5334 => 0.00809677,
|
||||
5480 => 0.012145349,
|
||||
5629 => 0.016193929,
|
||||
5782 => 0.020242509,
|
||||
5938 => 0.024291088,
|
||||
6097 => 0.028339668,
|
||||
6260 => 0.032388248,
|
||||
6426 => 0.036436828,
|
||||
6595 => 0.040485407,
|
||||
6768 => 0.044533987,
|
||||
6944 => 0.048582567,
|
||||
7123 => 0.052631146,
|
||||
7307 => 0.056679726,
|
||||
7493 => 0.060728306,
|
||||
7684 => 0.064776886,
|
||||
7878 => 0.068825465,
|
||||
8076 => 0.072874045,
|
||||
8277 => 0.076922625,
|
||||
8482 => 0.080971205,
|
||||
8692 => 0.085019784,
|
||||
8904 => 0.089068364,
|
||||
9121 => 0.093116944,
|
||||
9342 => 0.097165523,
|
||||
9566 => 0.101214103,
|
||||
9795 => 0.105262683,
|
||||
10027 => 0.109311263,
|
||||
10264 => 0.113359842,
|
||||
10504 => 0.117408422,
|
||||
10749 => 0.121457002,
|
||||
10997 => 0.125505581,
|
||||
11250 => 0.129554161,
|
||||
11507 => 0.133602741,
|
||||
11768 => 0.137651321,
|
||||
12033 => 0.1416999,
|
||||
12302 => 0.14574848,
|
||||
12576 => 0.14979706,
|
||||
12854 => 0.153845639,
|
||||
13136 => 0.157894219,
|
||||
13422 => 0.161942799,
|
||||
13712 => 0.165991379,
|
||||
14007 => 0.170039958,
|
||||
14306 => 0.174088538,
|
||||
14609 => 0.178137118,
|
||||
14917 => 0.182185697,
|
||||
15229 => 0.186234277,
|
||||
15545 => 0.190282857,
|
||||
15866 => 0.194331437,
|
||||
16190 => 0.198380016,
|
||||
16519 => 0.202428596,
|
||||
16853 => 0.206477176,
|
||||
17190 => 0.210525755,
|
||||
17532 => 0.214574335,
|
||||
17879 => 0.218622915,
|
||||
18229 => 0.222671495,
|
||||
18584 => 0.226720074,
|
||||
18943 => 0.230768654,
|
||||
19306 => 0.234817234,
|
||||
19674 => 0.238865814,
|
||||
20045 => 0.242914393,
|
||||
20421 => 0.246962973,
|
||||
20801 => 0.251011553,
|
||||
21186 => 0.255060132,
|
||||
21574 => 0.259108712,
|
||||
21966 => 0.263157292,
|
||||
22363 => 0.267205872,
|
||||
22763 => 0.271254451,
|
||||
23168 => 0.275303031,
|
||||
23576 => 0.279351611,
|
||||
23989 => 0.28340019,
|
||||
24405 => 0.28744877,
|
||||
24825 => 0.29149735,
|
||||
25249 => 0.29554593,
|
||||
25677 => 0.299594509,
|
||||
26109 => 0.303643089,
|
||||
26544 => 0.307691669,
|
||||
26983 => 0.311740248,
|
||||
27425 => 0.315788828,
|
||||
27871 => 0.319837408,
|
||||
28321 => 0.323885988,
|
||||
28774 => 0.327934567,
|
||||
29230 => 0.331983147,
|
||||
29690 => 0.336031727,
|
||||
30153 => 0.340080306,
|
||||
30619 => 0.344128886,
|
||||
31089 => 0.348177466,
|
||||
31561 => 0.352226046,
|
||||
32037 => 0.356274625,
|
||||
32515 => 0.360323205,
|
||||
32997 => 0.364371785,
|
||||
33481 => 0.368420365,
|
||||
33968 => 0.372468944,
|
||||
34458 => 0.376517524,
|
||||
34950 => 0.380566104,
|
||||
35445 => 0.384614683,
|
||||
35942 => 0.388663263,
|
||||
36442 => 0.392711843,
|
||||
36944 => 0.396760423,
|
||||
37448 => 0.400809002,
|
||||
37955 => 0.404857582,
|
||||
38463 => 0.408906162,
|
||||
38974 => 0.412954741,
|
||||
39486 => 0.417003321,
|
||||
40001 => 0.421051901,
|
||||
40517 => 0.425100481,
|
||||
41034 => 0.42914906,
|
||||
41553 => 0.43319764,
|
||||
42074 => 0.43724622,
|
||||
42596 => 0.441294799,
|
||||
43119 => 0.445343379,
|
||||
43644 => 0.449391959,
|
||||
44170 => 0.453440539,
|
||||
44696 => 0.457489118,
|
||||
45224 => 0.461537698,
|
||||
45753 => 0.465586278,
|
||||
46282 => 0.469634857,
|
||||
46812 => 0.473683437,
|
||||
47342 => 0.477732017,
|
||||
47873 => 0.481780597,
|
||||
48405 => 0.485829176,
|
||||
48936 => 0.489877756,
|
||||
49468 => 0.493926336,
|
||||
50000 => 0.497974916,
|
||||
50532 => 0.502023495,
|
||||
51064 => 0.506072075,
|
||||
51595 => 0.510120655,
|
||||
52127 => 0.514169234,
|
||||
52658 => 0.518217814,
|
||||
53188 => 0.522266394,
|
||||
53718 => 0.526314974,
|
||||
54247 => 0.530363553,
|
||||
54776 => 0.534412133,
|
||||
55304 => 0.538460713,
|
||||
55830 => 0.542509292,
|
||||
56356 => 0.546557872,
|
||||
56881 => 0.550606452,
|
||||
57404 => 0.554655032,
|
||||
57926 => 0.558703611,
|
||||
58447 => 0.562752191,
|
||||
58966 => 0.566800771,
|
||||
59483 => 0.57084935,
|
||||
59999 => 0.57489793,
|
||||
60514 => 0.57894651,
|
||||
61026 => 0.58299509,
|
||||
61537 => 0.587043669,
|
||||
62045 => 0.591092249,
|
||||
62552 => 0.595140829,
|
||||
63056 => 0.599189408,
|
||||
63558 => 0.603237988,
|
||||
64058 => 0.607286568,
|
||||
64555 => 0.611335148,
|
||||
65050 => 0.615383727,
|
||||
65542 => 0.619432307,
|
||||
66032 => 0.623480887,
|
||||
66519 => 0.627529466,
|
||||
67003 => 0.631578046,
|
||||
67485 => 0.635626626,
|
||||
67963 => 0.639675206,
|
||||
68439 => 0.643723785,
|
||||
68911 => 0.647772365,
|
||||
69381 => 0.651820945,
|
||||
69847 => 0.655869525,
|
||||
70310 => 0.659918104,
|
||||
70770 => 0.663966684,
|
||||
71226 => 0.668015264,
|
||||
71679 => 0.672063843,
|
||||
72129 => 0.676112423,
|
||||
72575 => 0.680161003,
|
||||
73017 => 0.684209583,
|
||||
73456 => 0.688258162,
|
||||
73891 => 0.692306742,
|
||||
74323 => 0.696355322,
|
||||
74751 => 0.700403901,
|
||||
75175 => 0.704452481,
|
||||
75595 => 0.708501061,
|
||||
76011 => 0.712549641,
|
||||
76424 => 0.71659822,
|
||||
76832 => 0.7206468,
|
||||
77237 => 0.72469538,
|
||||
77637 => 0.728743959,
|
||||
78034 => 0.732792539,
|
||||
78426 => 0.736841119,
|
||||
78814 => 0.740889699,
|
||||
79199 => 0.744938278,
|
||||
79579 => 0.748986858,
|
||||
79955 => 0.753035438,
|
||||
80326 => 0.757084017,
|
||||
80694 => 0.761132597,
|
||||
81057 => 0.765181177,
|
||||
81416 => 0.769229757,
|
||||
81771 => 0.773278336,
|
||||
82121 => 0.777326916,
|
||||
82468 => 0.781375496,
|
||||
82810 => 0.785424076,
|
||||
83147 => 0.789472655,
|
||||
83481 => 0.793521235,
|
||||
83810 => 0.797569815,
|
||||
84134 => 0.801618394,
|
||||
84455 => 0.805666974,
|
||||
84771 => 0.809715554,
|
||||
85083 => 0.813764134,
|
||||
85391 => 0.817812713,
|
||||
85694 => 0.821861293,
|
||||
85993 => 0.825909873,
|
||||
86288 => 0.829958452,
|
||||
86578 => 0.834007032,
|
||||
86864 => 0.838055612,
|
||||
87146 => 0.842104192,
|
||||
87424 => 0.846152771,
|
||||
87698 => 0.850201351,
|
||||
87967 => 0.854249931,
|
||||
88232 => 0.85829851,
|
||||
88493 => 0.86234709,
|
||||
88750 => 0.86639567,
|
||||
89003 => 0.87044425,
|
||||
89251 => 0.874492829,
|
||||
89496 => 0.878541409,
|
||||
89736 => 0.882589989,
|
||||
89973 => 0.886638568,
|
||||
90205 => 0.890687148,
|
||||
90434 => 0.894735728,
|
||||
90658 => 0.898784308,
|
||||
90879 => 0.902832887,
|
||||
91096 => 0.906881467,
|
||||
91308 => 0.910930047,
|
||||
91518 => 0.914978626,
|
||||
91723 => 0.919027206,
|
||||
91924 => 0.923075786,
|
||||
92122 => 0.927124366,
|
||||
92316 => 0.931172945,
|
||||
92507 => 0.935221525,
|
||||
92693 => 0.939270105,
|
||||
92877 => 0.943318685,
|
||||
93056 => 0.947367264,
|
||||
93232 => 0.951415844,
|
||||
93405 => 0.955464424,
|
||||
93574 => 0.959513003,
|
||||
93740 => 0.963561583,
|
||||
93903 => 0.967610163,
|
||||
94062 => 0.971658743,
|
||||
94218 => 0.975707322,
|
||||
94371 => 0.979755902,
|
||||
94520 => 0.983804482,
|
||||
94666 => 0.987853061,
|
||||
94810 => 0.991901641,
|
||||
94950 => 0.995950221,
|
||||
95087 => 1, // 95th Percentile
|
||||
95221 => 1.00404738,
|
||||
95352 => 1.00809596,
|
||||
95480 => 1.01214454,
|
||||
95606 => 1.016193119,
|
||||
95728 => 1.020241699,
|
||||
95848 => 1.024290279,
|
||||
95965 => 1.028338859,
|
||||
96080 => 1.032387438,
|
||||
96191 => 1.036436018,
|
||||
96300 => 1.040484598,
|
||||
96407 => 1.044533177,
|
||||
96511 => 1.048581757,
|
||||
96613 => 1.052630337,
|
||||
96712 => 1.056678917,
|
||||
96808 => 1.060727496,
|
||||
96903 => 1.064776076,
|
||||
96995 => 1.068824656,
|
||||
97084 => 1.072873236,
|
||||
97172 => 1.076921815,
|
||||
97257 => 1.080970395,
|
||||
97340 => 1.085018975,
|
||||
97421 => 1.089067554,
|
||||
97500 => 1.093116134,
|
||||
97577 => 1.097164714,
|
||||
97652 => 1.101213294,
|
||||
97725 => 1.105261873,
|
||||
97796 => 1.109310453,
|
||||
97865 => 1.113359033,
|
||||
97932 => 1.117407612,
|
||||
97998 => 1.121456192,
|
||||
98062 => 1.125504772,
|
||||
98124 => 1.129553352,
|
||||
98184 => 1.133601931,
|
||||
98243 => 1.137650511,
|
||||
98300 => 1.141699091,
|
||||
98355 => 1.14574767,
|
||||
98409 => 1.14979625,
|
||||
98461 => 1.15384483,
|
||||
98512 => 1.15789341,
|
||||
98562 => 1.161941989,
|
||||
98610 => 1.165990569,
|
||||
98656 => 1.170039149,
|
||||
98702 => 1.174087728,
|
||||
98745 => 1.178136308,
|
||||
98788 => 1.182184888,
|
||||
98829 => 1.186233468,
|
||||
98870 => 1.190282047,
|
||||
98909 => 1.194330627,
|
||||
98946 => 1.198379207,
|
||||
98983 => 1.202427786,
|
||||
99018 => 1.206476366,
|
||||
99053 => 1.210524946,
|
||||
99086 => 1.214573526,
|
||||
99119 => 1.218622105,
|
||||
99150 => 1.222670685,
|
||||
99180 => 1.226719265,
|
||||
99210 => 1.230767845,
|
||||
99238 => 1.234816424,
|
||||
99266 => 1.238865004,
|
||||
99292 => 1.242913584,
|
||||
99318 => 1.246962163,
|
||||
99343 => 1.251010743,
|
||||
99367 => 1.255059323,
|
||||
99391 => 1.259107903,
|
||||
99413 => 1.263156482,
|
||||
99435 => 1.267205062,
|
||||
99456 => 1.271253642,
|
||||
99477 => 1.275302221,
|
||||
99496 => 1.279350801,
|
||||
99515 => 1.283399381,
|
||||
99534 => 1.287447961,
|
||||
99552 => 1.29149654,
|
||||
99569 => 1.29554512,
|
||||
99585 => 1.2995937,
|
||||
99601 => 1.303642279,
|
||||
99617 => 1.307690859,
|
||||
99632 => 1.311739439,
|
||||
99646 => 1.315788019,
|
||||
99660 => 1.319836598,
|
||||
99674 => 1.323885178,
|
||||
99687 => 1.327933758,
|
||||
99699 => 1.331982337,
|
||||
99711 => 1.336030917,
|
||||
99723 => 1.340079497,
|
||||
99734 => 1.344128077,
|
||||
99744 => 1.348176656,
|
||||
99755 => 1.352225236,
|
||||
99765 => 1.356273816,
|
||||
99774 => 1.360322396,
|
||||
99784 => 1.364370975,
|
||||
99793 => 1.368419555,
|
||||
99801 => 1.372468135,
|
||||
99809 => 1.376516714,
|
||||
99817 => 1.380565294,
|
||||
99825 => 1.384613874,
|
||||
99832 => 1.388662454,
|
||||
99839 => 1.392711033,
|
||||
99846 => 1.396759613,
|
||||
99853 => 1.400808193,
|
||||
99859 => 1.404856772,
|
||||
99865 => 1.408905352,
|
||||
99871 => 1.412953932,
|
||||
99876 => 1.417002512,
|
||||
99882 => 1.421051091,
|
||||
99887 => 1.425099671,
|
||||
99892 => 1.429148251,
|
||||
99896 => 1.43319683,
|
||||
99901 => 1.43724541,
|
||||
99905 => 1.44129399,
|
||||
99910 => 1.44534257,
|
||||
99914 => 1.449391149,
|
||||
99917 => 1.453439729,
|
||||
99921 => 1.457488309,
|
||||
99925 => 1.461536888,
|
||||
99928 => 1.465585468,
|
||||
99931 => 1.469634048,
|
||||
99934 => 1.473682628,
|
||||
99937 => 1.477731207,
|
||||
99940 => 1.481779787,
|
||||
99943 => 1.485828367,
|
||||
99946 => 1.489876946,
|
||||
99948 => 1.493925526,
|
||||
99950 => 1.497974106,
|
||||
99953 => 1.502022686,
|
||||
99955 => 1.506071265,
|
||||
99957 => 1.510119845,
|
||||
99959 => 1.514168425,
|
||||
99961 => 1.518217005,
|
||||
99963 => 1.522265584,
|
||||
99965 => 1.526314164,
|
||||
99966 => 1.530362744,
|
||||
99968 => 1.534411323,
|
||||
99969 => 1.538459903,
|
||||
99971 => 1.542508483,
|
||||
99972 => 1.546557063,
|
||||
99974 => 1.550605642,
|
||||
99975 => 1.554654222,
|
||||
99976 => 1.558702802,
|
||||
99977 => 1.562751381,
|
||||
99978 => 1.566799961,
|
||||
99979 => 1.570848541,
|
||||
99980 => 1.574897121,
|
||||
99981 => 1.5789457,
|
||||
99982 => 1.58299428,
|
||||
99983 => 1.58704286,
|
||||
99984 => 1.591091439,
|
||||
99985 => 1.595140019,
|
||||
99986 => 1.603237179,
|
||||
99987 => 1.607285758,
|
||||
99988 => 1.615382918,
|
||||
99989 => 1.623480077,
|
||||
99990 => 1.627528657,
|
||||
99991 => 1.635625816,
|
||||
99992 => 1.647771556,
|
||||
99993 => 1.655868715,
|
||||
99994 => 1.672063034,
|
||||
99995 => 1.684208773,
|
||||
99996 => 1.704451672,
|
||||
99997 => 1.712548831
|
||||
);
|
||||
}
|
||||
$r = mt_rand(0,100000);
|
||||
//echo $r." = ";
|
||||
reset($bell_curve);
|
||||
while (list($key,$val)=each($bell_curve)){
|
||||
if ($key>=$r) {
|
||||
return $min + $val * ($max-$min);
|
||||
}
|
||||
}
|
||||
//We're above 0.99997
|
||||
return $min + $val * ($max-$min);
|
||||
|
||||
//below optomizations don't work atm.
|
||||
echo $r." = ";
|
||||
$index="0.00000";
|
||||
for ($n = 0; $n<strlen($r); $n++){
|
||||
$f = substr($r,0,$n);
|
||||
if (isset($bell_curve[(float)$f])) $index = $f;
|
||||
}
|
||||
if (strlen($index)>=7){
|
||||
return $min + $bell_curve[(float)$f] * ($max-$min);
|
||||
}
|
||||
$o = strlen($f)-2;
|
||||
$o = pow(10,$o); // $o is orders of magnitude of our current closest index match
|
||||
for ($n = 0; $n<10000; $n++){
|
||||
$x = $n / $o;
|
||||
if (isset($bell_curve[(float)($f+$x)])) return $min + $bell_curve[(float)($f+$x)] * ($max-$min);
|
||||
if (isset($bell_curve[(float)($f-$x)])) return $min + $bell_curve[(float)($f-$x)] * ($max-$min);
|
||||
}
|
||||
echo "\n<br>Unable to locate random value, \$r was $r<br>\n";
|
||||
}
|
||||
|
||||
?>
|
212
lotgd-web/lotgd/lib/buffs.php
Executable file
@ -0,0 +1,212 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
|
||||
$buffreplacements = array();
|
||||
$debuggedbuffs = array();
|
||||
function calculate_buff_fields(){
|
||||
global $session, $badguy, $buffreplacements, $debuggedbuffs;
|
||||
if (!$session['bufflist']) return;
|
||||
|
||||
//run temp stats
|
||||
reset($session['bufflist']);
|
||||
while (list($buffname,$buff)=each($session['bufflist'])){
|
||||
if (!isset($buff['tempstats_calculated'])){
|
||||
while (list($property,$value)=each($buff)){
|
||||
if (substr($property,0,9)=='tempstat-'){
|
||||
apply_temp_stat(substr($property,9),$value);
|
||||
}
|
||||
}//end while
|
||||
$session['bufflist'][$buffname]['tempstats_calculated']=true;
|
||||
}//end if
|
||||
}//end while
|
||||
|
||||
//process calculated buff fields.
|
||||
reset($session['bufflist']);
|
||||
if (!is_array($buffreplacements)) $buffreplacements = array();
|
||||
while (list($buffname,$buff)=each($session['bufflist'])){
|
||||
if (!isset($buff['fields_calculated'])){
|
||||
while (list($property,$value)=each($buff)){
|
||||
//calculate dynamic buff fields
|
||||
$origstring = $value;
|
||||
//Simple <module|variable> replacements for get_module_pref('variable','module')
|
||||
$value = preg_replace("/<([A-Za-z0-9]+)\\|([A-Za-z0-9]+)>/","get_module_pref('\\2','\\1')",$value);
|
||||
//simple <variable> replacements for $session['user']['variable']
|
||||
$value = preg_replace("/<([A-Za-z0-9]+)>/","\$session['user']['\\1']",$value);
|
||||
|
||||
if (!defined("OLDSU")) {
|
||||
define("OLDSU", $session['user']['superuser']);
|
||||
}
|
||||
if ($value != $origstring){
|
||||
if (strtolower(substr($value,0,6))=="debug:"){
|
||||
$errors="";
|
||||
$origstring = substr($origstring,6);
|
||||
$value = substr($value,6);
|
||||
if (!isset($debuggedbuffs[$buffname])) $debuggedbuffs[$buffname]=array();
|
||||
|
||||
ob_start();
|
||||
$val = eval("return $value;");
|
||||
$errors = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
if (!isset($debuggedbuffs[$buffname][$property])){
|
||||
if ($errors==""){
|
||||
debug("Buffs[$buffname][$property] evaluates successfully to $val");
|
||||
}else{
|
||||
debug("Buffs[$buffname][$property] has an evaluation error<br>"
|
||||
.htmlentities($origstring, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))." becomes <br>"
|
||||
.htmlentities($value, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."<br>"
|
||||
.$errors);
|
||||
$val="";
|
||||
}
|
||||
$debuggedbuffs[$buffname][$property]=true;
|
||||
}
|
||||
|
||||
$origstring="debug:".$origstring;
|
||||
$value="debug".$value;
|
||||
}else{
|
||||
$val = eval("return $value;");
|
||||
}
|
||||
}else{
|
||||
$val = $value;
|
||||
}
|
||||
|
||||
$session['user']['superuser'] = OLDSU;
|
||||
|
||||
//Avoiding PHP bug 27646
|
||||
// (http://bugs.php.net/bug.php?id=27646&edit=2) -
|
||||
// Unserialize doesn't recognize NAN, -INF and INF
|
||||
if (function_exists('is_nan')) {
|
||||
if (is_numeric($val) &&
|
||||
(is_nan($val) || is_infinite($val)))
|
||||
$val=$value;
|
||||
} else {
|
||||
// We have an older version of PHP, so, let's try
|
||||
// something else.
|
||||
$l = strtolower("$val");
|
||||
if ((substr($l, 3) == "nan") || (substr($l, -3) == "inf"))
|
||||
$val = $value;
|
||||
}
|
||||
if (!isset($output)) $output = "";
|
||||
if ($output == "" && (string)$val != (string)$origstring){
|
||||
$buffreplacements[$buffname][$property] = $origstring;
|
||||
$session['bufflist'][$buffname][$property] = $val;
|
||||
}//end if
|
||||
unset($val);
|
||||
}//end while
|
||||
$session['bufflist'][$buffname]['fields_calculated']=true;
|
||||
}//end if
|
||||
}//end while
|
||||
|
||||
}//end function
|
||||
|
||||
function restore_buff_fields(){
|
||||
global $session, $buffreplacements;
|
||||
if (is_array($buffreplacements)){
|
||||
reset($buffreplacements);
|
||||
while (list($buffname,$val)=each($buffreplacements)){
|
||||
reset($val);
|
||||
while (list($property,$value)=each($val)){
|
||||
if (isset($session['bufflist'][$buffname])){
|
||||
$session['bufflist'][$buffname][$property] = $value;
|
||||
unset($session['bufflist'][$buffname]['fields_calculated']);
|
||||
}//end if
|
||||
}//end while
|
||||
unset($buffreplacements[$buffname]);
|
||||
}//end while
|
||||
}//end if
|
||||
|
||||
//restore temp stats
|
||||
if (!is_array($session['bufflist'])) $session['bufflist'] = array();
|
||||
reset($session['bufflist']);
|
||||
while (list($buffname,$buff)=each($session['bufflist'])){
|
||||
if (array_key_exists("tempstats_calculated",$buff) && $buff['tempstats_calculated']){
|
||||
reset($buff);
|
||||
while (list($property,$value)=each($buff)){
|
||||
if (substr($property,0,9)=='tempstat-'){
|
||||
apply_temp_stat(substr($property,9),-$value);
|
||||
}
|
||||
}//end while
|
||||
unset($session['bufflist'][$buffname]['tempstats_calculated']);
|
||||
}//end if
|
||||
}//end while
|
||||
}//end function
|
||||
|
||||
function apply_buff($name,$buff){
|
||||
global $session,$buffreplacements, $translation_namespace;
|
||||
|
||||
if (!isset($buff['schema']) || $buff['schema'] == "") {
|
||||
$buff['schema'] = $translation_namespace;
|
||||
}
|
||||
|
||||
if (isset($buffreplacements[$name])) unset($buffreplacements[$name]);
|
||||
if (isset($session['bufflist'][$name])){
|
||||
//we'll need to unapply buff fields before applying this buff since
|
||||
//it's already set.
|
||||
restore_buff_fields();
|
||||
}
|
||||
$buff = modulehook("modify-buff", array("name"=>$name, "buff"=>$buff));
|
||||
$session['bufflist'][$name] = $buff['buff'];
|
||||
calculate_buff_fields();
|
||||
}
|
||||
|
||||
function apply_companion($name,$companion,$ignorelimit=false){
|
||||
global $session, $companions;
|
||||
if (!is_array($companions)) {
|
||||
$companions = @unserialize($session['user']['companions']);
|
||||
}
|
||||
$companionsallowed = getsetting("companionsallowed", 1);
|
||||
$args = modulehook("companionsallowed", array("maxallowed"=>$companionsallowed));
|
||||
$companionsallowed = $args['maxallowed'];
|
||||
$current = 0;
|
||||
foreach ($companions as $thisname=>$thiscompanion) {
|
||||
if (isset($companion['ignorelimit']) && $companion['ignorelimit'] == true) {
|
||||
} else {
|
||||
if ($thisname != $name)
|
||||
++$current;
|
||||
}
|
||||
}
|
||||
if ($current < $companionsallowed || $ignorelimit == true) {
|
||||
if (isset($companions[$name])) {
|
||||
unset($companions[$name]);
|
||||
}
|
||||
if (!isset($companion['ignorelimit']) && $ignorelimit == true) {
|
||||
$companion['ignorelimit'] = true;
|
||||
}
|
||||
$companions[$name] = $companion;
|
||||
$session['user']['companions'] = createstring($companions);
|
||||
return true; // success!
|
||||
} else {
|
||||
debug("Failed to add companion due to restrictions regarding the maximum amount of companions allowed.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function strip_buff($name){
|
||||
global $session, $buffreplacements;
|
||||
restore_buff_fields();
|
||||
if (isset($session['bufflist'][$name]))
|
||||
unset($session['bufflist'][$name]);
|
||||
if (isset($buffreplacements[$name]))
|
||||
unset($buffreplacements[$name]);
|
||||
calculate_buff_fields();
|
||||
}
|
||||
|
||||
function strip_all_buffs(){
|
||||
global $session;
|
||||
$thebuffs = $session['bufflist'];
|
||||
reset($thebuffs);
|
||||
while (list($buffname,$buff)=each($thebuffs)){
|
||||
strip_buff($buffname);
|
||||
}
|
||||
}
|
||||
|
||||
function has_buff($name){
|
||||
global $session;
|
||||
if (isset($session['bufflist'][$name])) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
138
lotgd-web/lotgd/lib/censor.php
Executable file
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
function soap($input,$debug=false,$skiphook=false){
|
||||
global $session;
|
||||
require_once("lib/sanitize.php");
|
||||
$final_output = $input;
|
||||
// $output is the color code-less (fully sanitized) input against which
|
||||
// we search.
|
||||
$output = full_sanitize($input);
|
||||
// the mask of displayable chars that should be masked out;
|
||||
// X displays, _ masks.
|
||||
$mix_mask = str_pad("",strlen($output),"X");
|
||||
if (getsetting("soap",1)){
|
||||
$search = nasty_word_list();
|
||||
$exceptions = array_flip(good_word_list());
|
||||
$changed_content = false;
|
||||
while (list($key,$word)=each($search)){
|
||||
do {
|
||||
if ($word > "")
|
||||
$times = preg_match_all($word,$output,$matches);
|
||||
else
|
||||
$times = 0;
|
||||
for ($x=0; $x<$times; $x++){
|
||||
if (strlen($matches[0][$x]) < strlen($matches[1][$x])){
|
||||
$shortword = $matches[0][$x];
|
||||
$longword = $matches[1][$x];
|
||||
}else{
|
||||
$shortword = $matches[1][$x];
|
||||
$longword = $matches[0][$x];
|
||||
}
|
||||
if (isset($exceptions[strtolower($longword)])){
|
||||
$x--;
|
||||
$times--;
|
||||
if ($debug)
|
||||
output("This word is ok because it was caught by an exception: `b`^%s`7`b`n",$longword);
|
||||
}else{
|
||||
if ($debug)
|
||||
output("`7This word is not ok: \"`%%s`7\"; it blocks on the pattern `i%s`i at \"`\$%s`7\".`n",$longword,$word,$shortword);
|
||||
// if the word should be filtered, drop it from the
|
||||
// search terms ($output), and mask its bytes out of
|
||||
// the output mask.
|
||||
$len = strlen($shortword);
|
||||
$pad = str_pad("",$len,"_");
|
||||
//while (($p = strpos($output,$shortword))!==false){
|
||||
$p = strpos($output,$shortword);
|
||||
$output = substr($output,0,$p) . $pad .
|
||||
substr($output,$p+$len);
|
||||
$mix_mask = substr($mix_mask,0,$p) . $pad .
|
||||
substr($mix_mask,$p+$len);
|
||||
//}
|
||||
$changed_content = true;
|
||||
}//end if
|
||||
}//end for
|
||||
} while ($times > 0);
|
||||
}
|
||||
$y = 0; //position within final output
|
||||
$pad = '#@%$!';
|
||||
for ($x=0; $x<strlen($mix_mask); $x++){
|
||||
while (substr($final_output,$y,1)=="`"){
|
||||
$y+=2; //when encountering appo encoding, skip over it.
|
||||
}
|
||||
//this character should be masked out.
|
||||
if (substr($mix_mask,$x,1)=="_"){
|
||||
$final_output = substr($final_output,0,$y) .
|
||||
substr($pad,$x % strlen($pad),1) .
|
||||
substr($final_output,$y+1);
|
||||
}
|
||||
$y++;
|
||||
}
|
||||
if ($session['user']['superuser'] & SU_EDIT_COMMENTS &&
|
||||
$changed_content){
|
||||
output("`0The filter would have tripped on \"`#%s`0\" but since you're a moderator, I'm going to be lenient on you. The text would have read, \"`#%s`0\"`n`n",$input,$final_output);
|
||||
return $input;
|
||||
}else{
|
||||
if ($changed_content && !$skiphook)
|
||||
modulehook("censor", array("input"=>$input));
|
||||
return $final_output;
|
||||
}
|
||||
}else{
|
||||
return $final_output;
|
||||
}
|
||||
}
|
||||
|
||||
function good_word_list(){
|
||||
$sql = "SELECT * FROM " . db_prefix("nastywords") . " WHERE type='good'";
|
||||
$result = db_query_cached($sql,"goodwordlist");
|
||||
$row = db_fetch_assoc($result);
|
||||
return explode(" ",$row['words']);
|
||||
}
|
||||
|
||||
function nasty_word_list(){
|
||||
$search = datacache("nastywordlist",600);
|
||||
if ($search!==false && is_array($search)) return $search;
|
||||
|
||||
$sql = "SELECT * FROM " . db_prefix("nastywords") . " WHERE type='nasty'";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
$search = " ".$row['words']." ";
|
||||
$search = preg_replace('/(?<=.)(?<!\\\\)\'(?=.)/', '\\\'', $search);
|
||||
$search = str_replace("a",'[a4@<40><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]',$search);
|
||||
$search = str_replace("b",'[b<>]',$search);
|
||||
$search = str_replace("d",'[d<><64><EFBFBD>]',$search);
|
||||
$search = str_replace("e",'[e3<65><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]',$search);
|
||||
$search = str_replace("n",'[n<><6E>]',$search);
|
||||
$search = str_replace("o",'[o<><6F>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]',$search);
|
||||
$search = str_replace("p",'[p<><70><EFBFBD>]',$search);
|
||||
$search = str_replace("r",'[r<>]',$search);
|
||||
// $search = str_replace("s",'[sz$<24>]',$search);
|
||||
$search = preg_replace('/(?<!\\\\)s/','[sz$<24>]',$search);
|
||||
$search = str_replace("t",'[t7+]',$search);
|
||||
$search = str_replace("u",'[u<><75><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]',$search);
|
||||
$search = str_replace("x",'[xפ]',$search);
|
||||
$search = str_replace("y",'[yݥ<79><DDA5>]',$search);
|
||||
//these must happen in exactly this order:
|
||||
$search = str_replace("l",'[l1!<21>]',$search);
|
||||
$search = str_replace("i",'[li1!<21><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]',$search);
|
||||
$search = str_replace("k",'c',$search);
|
||||
$search = str_replace("c",'[c\\(k穢]',$search);
|
||||
$start = "'\\b";
|
||||
$end = "\\b'iU";
|
||||
$ws = "[^[:space:]\\t]*"; //whitespace (\w is not hungry enough)
|
||||
//space not preceeded by a star
|
||||
$search = preg_replace("'(?<!\\*) '",")+$end ",$search);
|
||||
//space not anteceeded by a star
|
||||
$search = preg_replace("' (?!\\*)'"," $start(",$search);
|
||||
//space preceeded by a star
|
||||
$search = str_replace("* ",")+$ws$end ",$search);
|
||||
//space anteceeded by a star
|
||||
$search = str_replace(" *"," $start$ws(",$search);
|
||||
$search = "$start(".trim($search).")+$end";
|
||||
$search = str_replace("$start()+$end","",$search);
|
||||
$search = explode(" ",$search);
|
||||
updatedatacache("nastywordlist",$search);
|
||||
return $search;
|
||||
}
|
||||
?>
|
65
lotgd-web/lotgd/lib/charcleanup.php
Executable file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
function char_cleanup($id, $type)
|
||||
{
|
||||
// this function handles the grunt work of character cleanup.
|
||||
|
||||
// Run any modules hooks who want to deal with character deletion, or stop it
|
||||
$return = modulehook("delete_character",
|
||||
array("acctid"=>$id, "deltype"=>$type, "dodel"=>true));
|
||||
|
||||
if(!$return['dodel']) return false;
|
||||
|
||||
// delete the output field from the accounts_output table introduced in 1.1.1
|
||||
|
||||
db_query("DELETE FROM " . db_prefix("accounts_output") . " WHERE acctid=$id;");
|
||||
|
||||
// delete the comments the user posted, necessary to have the systemcomments with acctid 0 working
|
||||
|
||||
db_query("DELETE FROM " . db_prefix("commentary") . " WHERE author=$id;");
|
||||
|
||||
// Clean up any clan positions held by this character
|
||||
$sql = "SELECT clanrank,clanid FROM " . db_prefix("accounts") .
|
||||
" WHERE acctid=$id";
|
||||
$res = db_query($sql);
|
||||
$row = db_fetch_assoc($res);
|
||||
if ($row['clanid'] != 0 && $row['clanrank'] == CLAN_LEADER) {
|
||||
$cid = $row['clanid'];
|
||||
// We need to auto promote or disband the clan.
|
||||
$sql = "SELECT name,acctid,clanrank FROM " . db_prefix("accounts") .
|
||||
" WHERE clanid=$cid AND clanrank > " . CLAN_APPLICANT . " AND acctid<>$id ORDER BY clanrank DESC, clanjoindate";
|
||||
$res = db_query($sql);
|
||||
if (db_num_rows($res)) {
|
||||
// Okay, we can promote if needed
|
||||
$row = db_fetch_assoc($res);
|
||||
if ($row['clanrank'] != CLAN_LEADER) {
|
||||
// No other leaders, promote this one
|
||||
$id1 = $row['acctid'];
|
||||
$sql = "UPDATE " . db_prefix("accounts") .
|
||||
" SET clanrank=" . CLAN_LEADER . " WHERE acctid=$id1";
|
||||
db_query($sql);
|
||||
}
|
||||
} else {
|
||||
// this clan needs to be disbanded.
|
||||
$sql = "DELETE FROM " . db_prefix("clans") . " WHERE clanid=$cid";
|
||||
db_query($sql);
|
||||
// And just in case we goofed, no players associated with a
|
||||
// deleted clan This shouldn't be important, but.
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET clanid=0,clanrank=0,clanjoindate='0000-00-00 00:00;00' WHERE clanid=$cid";
|
||||
db_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete any module user prefs
|
||||
module_delete_userprefs($id);
|
||||
|
||||
// Delete any mail to or from the user
|
||||
db_query('DELETE FROM ' . db_prefix('mail') . ' WHERE msgto=' . $id . ' OR msgfrom=' . $id);
|
||||
|
||||
// Delete any news from the user
|
||||
db_query('DELETE FROM ' . db_prefix('news') . ' WHERE accountid=' . $id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
48
lotgd-web/lotgd/lib/checkban.php
Executable file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
function checkban($login=false){
|
||||
global $session;
|
||||
if (isset($session['banoverride']) && $session['banoverride'])
|
||||
return false;
|
||||
if ($login===false){
|
||||
$ip=$_SERVER['REMOTE_ADDR'];
|
||||
$id=$_COOKIE['lgi'];
|
||||
}else{
|
||||
$sql = "SELECT lastip,uniqueid,banoverride,superuser FROM " . db_prefix("accounts") . " WHERE login='$login'";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
if ($row['banoverride'] || ($row['superuser'] &~ SU_DOESNT_GIVE_GROTTO)){
|
||||
$session['banoverride']=true;
|
||||
return false;
|
||||
}
|
||||
db_free_result($result);
|
||||
$ip=$row['lastip'];
|
||||
$id=$row['uniqueid'];
|
||||
}
|
||||
$sql = "SELECT * FROM " . db_prefix("bans") . " where ((substring('$ip',1,length(ipfilter))=ipfilter AND ipfilter<>'') OR (uniqueid='$id' AND uniqueid<>'')) AND (banexpire='0000-00-00' OR banexpire>='".date("Y-m-d")."')";
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)>0){
|
||||
$session=array();
|
||||
tlschema("ban");
|
||||
$session['message'].=translate_inline("`n`4You fall under a ban currently in place on this website:`n");
|
||||
while ($row = db_fetch_assoc($result)) {
|
||||
$session['message'].=$row['banreason']."`n";
|
||||
if ($row['banexpire']=='0000-00-00')
|
||||
$session['message'].=translate_inline(" `\$This ban is permanent!`0");
|
||||
else
|
||||
$session['message'].=sprintf_translate(" `^This ban will be removed `\$after`^ %s.`0",date("M d, Y",strtotime($row['banexpire'])));
|
||||
$sql = "UPDATE " . db_prefix("bans") . " SET lasthit='".date("Y-m-d H:i:s")."' WHERE ipfilter='{$row['ipfilter']}' AND uniqueid='{$row['uniqueidid']}'";
|
||||
db_query($sql);
|
||||
$session['message'].="`n";
|
||||
}
|
||||
$session['message'].=translate_inline("`4If you wish, you may appeal your ban with the petition link.");
|
||||
tlschema();
|
||||
header("Location: index.php");
|
||||
exit();
|
||||
}
|
||||
db_free_result($result);
|
||||
}
|
||||
|
||||
?>
|
46
lotgd-web/lotgd/lib/clan/applicant.php
Executable file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
page_header("Clan Halls");
|
||||
$registrar=getsetting('clanregistrar','`%Karissa');
|
||||
addnav("Clan Options");
|
||||
output("`b`c`&Clan Halls`c`b");
|
||||
if ($op=="apply"){
|
||||
require_once("lib/clan/applicant_apply.php");
|
||||
}elseif ($op=="new"){
|
||||
require_once("lib/clan/applicant_new.php");
|
||||
}else{
|
||||
output("`7You stand in the center of a great marble lobby filled with pillars.");
|
||||
output("All around the walls of the lobby are various doors which lead to various clan halls.");
|
||||
output("The doors each possess a variety of intricate mechanisms which are obviously elaborate locks designed to be opened only by those who have been educated on how to operate them.");
|
||||
output("Nearby, you watch another warrior glance about nervously to make sure no one is watching before touching various levers and knobs on the door.");
|
||||
output("With a large metallic \"Chunk\" the lock on the door disengages, and the door swings silently open, admitting the warrior before slamming shut.`n`n");
|
||||
output("In the center of the lobby sits a highly polished desk, behind which sits `%%s`7, the clan registrar.",$registrar);
|
||||
output("She can take your filing for a new clan, or accept your application to an existing clan.`n`n");
|
||||
/*//*/ modulehook("clan-enter");
|
||||
if ($op=="withdraw"){
|
||||
$session['user']['clanid']=0;
|
||||
$session['user']['clanrank']=CLAN_APPLICANT;
|
||||
$session['user']['clanjoindate']='0000-00-00 00:00:00';
|
||||
output("`7You tell `%%s`7 that you're no longer interested in joining %s.",$registrar, $claninfo['clanname']);
|
||||
output("She reaches into her desk, withdraws your application, and tears it up. \"`5You wouldn't have been happy there anyhow, I don't think,`7\" as she tosses the shreds in her trash can.");
|
||||
$claninfo = array();
|
||||
$sql = "DELETE FROM " . db_prefix("mail") . " WHERE msgfrom=0 AND seen=0 AND subject='".serialize($apply_subj)."'";
|
||||
db_query($sql);
|
||||
output("You are not a member of any clan.");
|
||||
addnav("Apply for Membership to a Clan","clan.php?op=apply");
|
||||
addnav("Apply for a New Clan","clan.php?op=new");
|
||||
}else{
|
||||
if (isset($claninfo['clanid']) && $claninfo["clanid"]>0){
|
||||
//applied for membership to a clan
|
||||
output("`7You approach `%%s`7 who smiles at you, but lets you know that your application to %s hasn't yet been accepted.",$registrar,$claninfo['clanname']);
|
||||
output("Perhaps you'd like to take a seat in the waiting area, she suggests.");
|
||||
addnav("Waiting Area","clan.php?op=waiting");
|
||||
addnav("Withdraw Application","clan.php?op=withdraw");
|
||||
}else{
|
||||
//hasn't applied for membership to any clan.
|
||||
output("You are not a member of any clan.");
|
||||
addnav("Apply for Membership to a Clan","clan.php?op=apply");
|
||||
addnav("Apply for a New Clan","clan.php?op=new");
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
72
lotgd-web/lotgd/lib/clan/applicant_apply.php
Executable file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
$to = (int)httpget('to');
|
||||
if ($to>0){
|
||||
output("`%%s`7 accepts your application, files it in her out box, and folds her hands on the desk, staring at you.",$registrar);
|
||||
output("You stand there staring blankly back at her for a few minutes before she suggests that perhaps you'd like to take a seat in the waiting area.");
|
||||
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
addnav("Waiting Area","clan.php?op=waiting");
|
||||
$session['user']['clanid']=$to;
|
||||
$session['user']['clanrank']=CLAN_APPLICANT;
|
||||
$session['user']['clanjoindate']=date("Y-m-d H:i:s");
|
||||
$sql = "SELECT acctid FROM " . db_prefix("accounts") . " WHERE clanid='{$session['user']['clanid']}' AND clanrank>=".CLAN_OFFICER;
|
||||
$result = db_query($sql);
|
||||
$sql = "DELETE FROM . ". db_prefix("mail") . " WHERE msgfrom=0 AND seen=0 AND subject='".serialize($apply_subj)."'";
|
||||
db_query($sql);
|
||||
while ($row = db_fetch_assoc($result)){
|
||||
$msg = array("`^You have a new clan applicant! `&%s`^ has completed a membership application for your clan!",$session['user']['name']);
|
||||
systemmail($row['acctid'],$apply_subj,$msg);
|
||||
}
|
||||
|
||||
// send reminder mail if clan of choice has a description
|
||||
|
||||
$sql = "SELECT * FROM " . db_prefix("clans") . " WHERE clanid='$to'";
|
||||
$res = db_query_cached($sql, "clandata-$to", 3600);
|
||||
$row = db_fetch_assoc($res);
|
||||
|
||||
if ( nltoappon($row['clandesc']) != "" ) {
|
||||
|
||||
$subject = "Clan Application Reminder";
|
||||
$mail = "`&Did you remember to read the description of the clan of your choice before applying? Note that some clans may have requirements that you have to fulfill before you can become a member. If you are not accepted into the clan of your choice anytime soon, it may be because you have not fulfilled these requirements. For your convenience, the description of the clan you are applying to is reproduced below.`n`n`c`#%s`@ <`^%s`@>`0`c`n%s";
|
||||
|
||||
systemmail($session['user']['acctid'],array($subject),array($mail, $row['clanname'], $row['clanshort'], nltoappon($row['clandesc'])));
|
||||
}
|
||||
}else{
|
||||
$sql = "SELECT MAX(" . db_prefix("clans") . ".clanid) AS clanid,MAX(clanname) AS clanname,count(" . db_prefix("accounts") . ".acctid) AS c FROM " . db_prefix("clans") . " INNER JOIN " . db_prefix("accounts") . " ON " . db_prefix("clans") . ".clanid=" . db_prefix("accounts") . ".clanid WHERE " . db_prefix("accounts") . ".clanrank > ".CLAN_APPLICANT." GROUP BY " . db_prefix("clans") . ".clanid ORDER BY c DESC";
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)>0){
|
||||
output("`7You ask %s`7 for a clan membership application form.",$registrar);
|
||||
output("She opens a drawer in her desk and pulls out a form. It contains only two lines: Name and Clan Name.");
|
||||
output("You furrow your brow, not sure if you really like having to deal with all this red tape, and get set to concentrate really hard in order to complete the form.");
|
||||
output("Noticing your attempt to write on the form with your %s, %s`7 claims the form back from you, writes %s`7 on the first line, and asks you the name of the clan that you'd like to join:`n`n",$session['user']['weapon'],$registrar,$session['user']['name']);
|
||||
for ($i=0;$i<db_num_rows($result);$i++){
|
||||
$row = db_fetch_assoc($result);
|
||||
if ($row['c']==0){
|
||||
$sql = "DELETE FROM " . db_prefix("clans") . " WHERE clanid={$row['clanid']}";
|
||||
db_query($sql);
|
||||
}else{
|
||||
/*//*/ $row = modulehook("clan-applymember", $row);
|
||||
/*//*/ if (isset($row['handled']) && $row['handled']) continue;
|
||||
$memb_n = translate_inline("(%s members)");
|
||||
$memb_1 = translate_inline("(%s member)");
|
||||
if ($row['c'] == 1) {
|
||||
$memb = sprintf($memb_1, $row['c']);
|
||||
} else {
|
||||
$memb = sprintf($memb_n, $row['c']);
|
||||
}
|
||||
output_notl("• <a href='clan.php?op=apply&to=%s'>%s</a> %s`n",
|
||||
$row['clanid'],
|
||||
full_sanitize(htmlentities($row['clanname'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))),
|
||||
$memb, true);
|
||||
addnav("","clan.php?op=apply&to={$row['clanid']}");
|
||||
}
|
||||
}
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
}else{
|
||||
output("`7You ask %s`7 for a clan membership application form.",$registrar);
|
||||
output("She stares at you blankly for a few moments, then says, \"`5Sorry pal, no one has had enough gumption to start up a clan yet. Maybe that should be you, eh?`7\"");
|
||||
addnav("Apply for a New Clan","clan.php?op=new");
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
}
|
||||
}
|
||||
?>
|
103
lotgd-web/lotgd/lib/clan/applicant_new.php
Executable file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
$apply = httpget('apply');
|
||||
if ($apply==1){
|
||||
$ocn = httppost('clanname');
|
||||
$ocs = httppost('clanshort');
|
||||
$clanname = stripslashes($ocn);
|
||||
$clanname = full_sanitize($clanname);
|
||||
$clanname = preg_replace("'[^[:alpha:] \\'-]'","",$clanname);
|
||||
$clanname = addslashes($clanname);
|
||||
httppostset('clanname', $clanname);
|
||||
$clanshort = full_sanitize($ocs);
|
||||
$clanshort = preg_replace("'[^[:alpha:]]'","",$clanshort);
|
||||
httppostset('clanshort', $clanshort);
|
||||
$sql = "SELECT * FROM " . db_prefix("clans") . " WHERE clanname='$clanname'";
|
||||
$result = db_query($sql);
|
||||
$e = array (translate_inline("%s`7 looks over your form but informs you that your clan name must consist only of letters, spaces, apostrophes, or dashes. Also, your short name can consist only of letters. She hands you a blank form."),
|
||||
translate_inline("%s`7 looks over your form but informs you that you must have at least 5 and no more than 50 characters in your clan's name (and they must consist only of letters, spaces, apostrophes, or dashes), then hands you a blank form."),
|
||||
translate_inline("%s`7 looks over your form but informs you that you must have at least 2 and no more than 5 characters in your clan's short name (and they must all be letters), then hands you a blank form."),
|
||||
translate_inline("%s`7 looks over your form but informs you that the clan name %s is already taken, and hands you a blank form."),
|
||||
translate_inline("%s`7 looks over your form but informs you that the short name %s is already taken, and hands you a blank form."),
|
||||
translate_inline("%s`7 asks for the %s gold to start the clan, but you seem to be unable to produce the fees."),
|
||||
translate_inline("%s`7 asks for the %s gold and %s gems to start the clan, but you seem to be unable to produce the fees."),
|
||||
translate_inline("%s`7 asks for the %s gems to start the clan, but you seem to be unable to produce the fees."),
|
||||
translate_inline("She takes your application, and stamps it \"`\$DENIED`7\"."),
|
||||
);
|
||||
if ($clanname!=$ocn || $clanshort!=$ocs){
|
||||
output_notl($e[0],$registrar);
|
||||
clanform();
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
}elseif (strlen($clanname)<5 || strlen($clanname)>50){
|
||||
output_notl($e[1],$registrar);
|
||||
clanform();
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
}elseif (strlen($clanshort)<2 || strlen($clanshort)>5){
|
||||
output_notl($e[2],$registrar);
|
||||
clanform();
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
}elseif (db_num_rows($result)>0){
|
||||
output_notl($e[3],$registrar,stripslashes($clanname));
|
||||
clanform();
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
}else{
|
||||
$sql = "SELECT * FROM " . db_prefix("clans") . " WHERE clanshort='$clanshort'";
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)>0){
|
||||
output_notl($e[4],$registrar,stripslashes($clanshort));
|
||||
clanform();
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
}else{
|
||||
if ($session['user']['gold']<$gold || $session['user']['gems']<$gems){
|
||||
if ($gold>0 && $gems<=0) output_notl($e[5],$registrar,$gold);
|
||||
elseif ($gems>0 && $gold<=0) output_notl($e[7],$registrar,$gems);
|
||||
else output_notl($e[6],$registrar,$gold,$gems);
|
||||
output_notl($e[8],$registrar);
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
}else{
|
||||
/*//*/ $args = array("ocn"=>$ocn, "ocs"=>$ocs, "clanname"=>$clanname, "clanshort"=>$clanshort);
|
||||
/*//*/ $args = modulehook("process-createclan", $args);
|
||||
/*//*/ if (isset($args['blocked']) && $args['blocked']){
|
||||
/*//*/ output_notl(sprintf_translate($args['blockmsg']));
|
||||
/*//*/ clanform();
|
||||
/*//*/ addnav("Return to the Lobby","clan.php");
|
||||
/*//*/ } else {
|
||||
$sql = "INSERT INTO " . db_prefix("clans") . " (clanname,clanshort) VALUES ('$clanname','$clanshort')";
|
||||
db_query($sql);
|
||||
$id = db_insert_id();
|
||||
$session['user']['clanid'] = $id;
|
||||
$session['user']['clanrank']=CLAN_LEADER+1; //+1 because he is the founder
|
||||
$session['user']['clanjoindate']=date("Y-m-d H:i:s");
|
||||
$session['user']['gold']-=$gold;
|
||||
$session['user']['gems']-=$gems;
|
||||
debuglog("has started a new clan (<$clanshort> $clanname) for $gold gold and $gems gems.");
|
||||
output("%s`7 looks over your form, and finding that everything seems to be in order, she takes your fees, stamps the form \"`\$APPROVED`7\" and files it in a drawer.`n`n",$registrar);
|
||||
output("Congratulations, you've created a new clan named %s!",stripslashes($clanname));
|
||||
addnav("Enter your clan hall","clan.php");
|
||||
/*//*/ }
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
output("`7You approach %s`7 and inquire about starting a new clan.",$registrar);
|
||||
output("She tells you that there are three requirements to starting a clan.");
|
||||
output("First, you have to decide on a full name for your clan.");
|
||||
output("Second, you have to decide on an abbreviation for your clan.");
|
||||
output("Third you have to decide on whether or not you're willing to give up the fees that are required to start the clan.");
|
||||
output("This fee is used to tailor the locks on your clan door to you and your members.`n");
|
||||
output("The fees are as follows:`nGold: `^%s`7`nGems: `%%s`7",$gold,$gems);
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
$e1 = translate_inline("`n`n\"`5Since you do not have enough gold with you, I cannot allow you to apply for a clan,`7\" she says.");
|
||||
$e2 = translate_inline("`n`n\"`5Since you do not have enough gems with you, I cannot allow you to apply for a clan,`7\" she says.");
|
||||
$e3 = translate_inline("`n`n\"`5If you're ok with these three requirements, please fill out the following form,`7\" she says, handing you a sheet of paper.");
|
||||
if ($session['user']['gold']<$gold){
|
||||
output_notl($e1);
|
||||
}else{
|
||||
if ($session['user']['gems']<$gems){
|
||||
output_notl($e2,$registrar);
|
||||
}else{
|
||||
output_notl($e3,$registrar);
|
||||
clanform();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
76
lotgd-web/lotgd/lib/clan/clan_default.php
Executable file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
modulehook("collapse{", array("name"=>"clanentry"));
|
||||
output("Having pressed the secret levers and turned the secret knobs on the lock of the door to your clan's hall, you gain entrance and chat with your clan mates.`n`n");
|
||||
modulehook("}collapse");
|
||||
|
||||
$sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid={$claninfo['motdauthor']}";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
$motdauthname = $row['name'];
|
||||
|
||||
$sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid={$claninfo['descauthor']}";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
$descauthname = $row['name'];
|
||||
|
||||
if ($claninfo['clanmotd'] != '') {
|
||||
rawoutput("<div style='margin-left: 15px; padding-left: 15px;'>");
|
||||
output("`&`bCurrent MoTD:`b `#by %s`2`n",$motdauthname);
|
||||
output_notl(nltoappon($claninfo['clanmotd'])."`n");
|
||||
rawoutput("</div>");
|
||||
output_notl("`n");
|
||||
}
|
||||
|
||||
commentdisplay("", "clan-{$claninfo['clanid']}","Speak",25,($claninfo['customsay']>''?$claninfo['customsay']:"says"));
|
||||
|
||||
modulehook("clanhall");
|
||||
|
||||
if ($claninfo['clandesc'] != '') {
|
||||
modulehook("collapse{", array("name"=>"collapsedesc"));
|
||||
output("`n`n`&`bCurrent Description:`b `#by %s`2`n",$descauthname);
|
||||
output_notl(nltoappon($claninfo['clandesc']));
|
||||
modulehook("}collapse");
|
||||
}
|
||||
$sql = "SELECT count(*) AS c, clanrank FROM " . db_prefix("accounts") . " WHERE clanid={$claninfo['clanid']} GROUP BY clanrank DESC";
|
||||
$result = db_query($sql);
|
||||
// begin collapse
|
||||
modulehook("collapse{", array("name"=>"clanmemberdet"));
|
||||
output("`n`n`bMembership Details:`b`n");
|
||||
$leaders = 0;
|
||||
while ($row = db_fetch_assoc($result)){
|
||||
output_notl($ranks[$row['clanrank']].": `0".$row['c']."`n");
|
||||
if ($row['clanrank']>CLAN_OFFICER) $leaders += $row['c'];
|
||||
}
|
||||
output("`n");
|
||||
$noleader = translate_inline("`^There is currently no leader! Promoting %s`^ to leader as they are the highest ranking member (or oldest member in the event of a tie).`n`n");
|
||||
if ($leaders==0){
|
||||
//There's no leader here, probably because the leader's account
|
||||
//expired.
|
||||
$sql = "SELECT name,acctid,clanrank FROM " . db_prefix("accounts") . " WHERE clanid={$session['user']['clanid']} AND clanrank > " . CLAN_APPLICANT . " ORDER BY clanrank DESC, clanjoindate";
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)) {
|
||||
$row = db_fetch_assoc($result);
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET clanrank=".CLAN_LEADER." WHERE acctid={$row['acctid']}";
|
||||
db_query($sql);
|
||||
output_notl($noleader,$row['name']);
|
||||
if ($row['acctid']==$session['user']['acctid']){
|
||||
//if it's the current user, we'll need to update their
|
||||
//session in order for the db write to take effect.
|
||||
$session['user']['clanrank']=CLAN_LEADER;
|
||||
}
|
||||
} else {
|
||||
// There are no viable leaders. But we cannot disband the clan
|
||||
// here.
|
||||
}
|
||||
}
|
||||
// end collapse
|
||||
modulehook("}collapse");
|
||||
|
||||
if ($session['user']['clanrank']>CLAN_MEMBER){
|
||||
addnav("Update MoTD / Clan Desc","clan.php?op=motd");
|
||||
}
|
||||
addnav("M?View Membership","clan.php?op=membership");
|
||||
addnav("Online Members","list.php?op=clan");
|
||||
addnav("Your Clan's Waiting Area","clan.php?op=waiting");
|
||||
addnav("Withdraw From Your Clan","clan.php?op=withdrawconfirm");
|
||||
?>
|
107
lotgd-web/lotgd/lib/clan/clan_membership.php
Executable file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
addnav("Clan Hall","clan.php");
|
||||
addnav("Clan Options");
|
||||
output("This is your current clan membership:`n");
|
||||
$setrank = httpget('setrank');
|
||||
$whoacctid = (int)httpget('whoacctid');
|
||||
if ($setrank>"") {
|
||||
$sql="SELECT name,login,clanrank FROM ".db_prefix("accounts")." WHERE acctid=$whoacctid LIMIT 1";
|
||||
$result=db_query($sql);
|
||||
$row=db_fetch_assoc($result);
|
||||
$who = $row['login'];
|
||||
$whoname = $row['name'];
|
||||
if ($setrank>""){
|
||||
$args = modulehook("clan-setrank", array("setrank"=>$setrank, "login"=>$who, "name"=>$whoname, "acctid"=>$whoacctid, "clanid"=>$session['user']['clanid'], "oldrank"=>$row['clanrank']));
|
||||
if (!(isset($args['handled']) && $args['handled'])) {
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET clanrank=GREATEST(0,least({$session['user']['clanrank']},$setrank)) WHERE login='$who'";
|
||||
db_query($sql);
|
||||
debuglog("Player {$session['user']['name']} changed rank of {$whoname} to {$setrank}.", $whoacctid);
|
||||
}
|
||||
}
|
||||
}
|
||||
$remove = httpget('remove');
|
||||
if ($remove>""){
|
||||
$sql = "SELECT name,login,clanrank FROM " . db_prefix("accounts") . " WHERE acctid='$remove'";
|
||||
$row = db_fetch_assoc(db_query($sql));
|
||||
$args = modulehook("clan-setrank", array("setrank"=>0, "login"=>$row['login'], "name"=>$row['name'], "acctid"=>$remove, "clanid"=>$session['user']['clanid'], "oldrank"=>$row['clanrank']));
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET clanrank=".CLAN_APPLICANT.",clanid=0,clanjoindate='0000-00-00 00:00:00' WHERE acctid='$remove' AND clanrank<={$session['user']['clanrank']}";
|
||||
db_query($sql);
|
||||
debuglog("Player {$session['user']['name']} removed player {$row['login']} from {$claninfo['clanname']}.", $remove);
|
||||
//delete unread application emails from this user.
|
||||
//breaks if the applicant has had their name changed via
|
||||
//dragon kill, superuser edit, or lodge color change
|
||||
require_once("lib/safeescape.php");
|
||||
$subj = safeescape(serialize(array($apply_short, $row['name'])));
|
||||
$sql = "DELETE FROM " . db_prefix("mail") . " WHERE msgfrom=0 AND seen=0 AND subject='$subj'";
|
||||
db_query($sql);
|
||||
}
|
||||
$sql = "SELECT name,login,acctid,clanrank,laston,clanjoindate,dragonkills,level FROM " . db_prefix("accounts") . " WHERE clanid={$claninfo['clanid']} ORDER BY clanrank DESC ,dragonkills DESC,level DESC,clanjoindate";
|
||||
$result = db_query($sql);
|
||||
rawoutput("<table border='0' cellpadding='2' cellspacing='0'>");
|
||||
$rank = translate_inline("Rank");
|
||||
$name = translate_inline("Name");
|
||||
$lev = translate_inline("Level");
|
||||
$dk = translate_inline("Dragon Kills");
|
||||
$jd = translate_inline("Join Date");
|
||||
$lo = translate_inline("Last On");
|
||||
$ops = translate_inline("Operations");
|
||||
$promote = translate_inline("Promote");
|
||||
$demote = translate_inline("Demote");
|
||||
$stepdown = translate_inline("`\$Step down as founder");
|
||||
$remove = translate_inline("Remove From Clan");
|
||||
$confirm = translate_inline("Are you sure you wish to remove this member from your clan?");
|
||||
rawoutput("<tr class='trhead'><td>$rank</td><td>$name</td><td>$lev</td><td>$dk</td><td>$jd</td><td>$lo</td>".($session['user']['clanrank']>CLAN_MEMBER?"<td>$ops</td>":"")."</tr>",true);
|
||||
$i=0;
|
||||
$tot = 0;
|
||||
require_once("lib/clan/func.php");
|
||||
while ($row=db_fetch_assoc($result)){
|
||||
$i++;
|
||||
$tot += $row['dragonkills'];
|
||||
rawoutput("<tr class='".($i%2?"trlight":"trdark")."'>");
|
||||
rawoutput("<td>");
|
||||
output_notl($ranks[$row['clanrank']]);
|
||||
rawoutput("</td><td>");
|
||||
$link = "bio.php?char=".$row['acctid']."&ret=".urlencode($_SERVER['REQUEST_URI']);
|
||||
rawoutput("<a href='$link'>", true);
|
||||
addnav("", $link);
|
||||
output_notl("`&%s`0", $row['name']);
|
||||
rawoutput("</a>");
|
||||
rawoutput("</td><td align='center'>");
|
||||
output_notl("`^%s`0",$row['level']);
|
||||
rawoutput("</td><td align='center'>");
|
||||
output_notl("`\$%s`0",$row['dragonkills']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl("`3%s`0",$row['clanjoindate']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl("`#%s`0",reltime(strtotime($row['laston'])));
|
||||
rawoutput("</td>");
|
||||
if ($session['user']['clanrank']>CLAN_MEMBER){
|
||||
rawoutput("<td>");
|
||||
if ($row['clanrank']<$session['user']['clanrank'] && $row['clanrank']<CLAN_FOUNDER){
|
||||
rawoutput("[ <a href='clan.php?op=membership&setrank=".clan_nextrank($ranks,$row['clanrank'])."&who=".rawurlencode($row['login'])."&whoname=".rawurlencode($row['name'])."&whoacctid=".$row['acctid']."'>$promote</a> | ");
|
||||
addnav("","clan.php?op=membership&setrank=".clan_nextrank($ranks,$row['clanrank'])."&who=".rawurlencode($row['login'])."&whoname=".rawurlencode($row['name'])."&whoacctid=".$row['acctid']);
|
||||
}else{
|
||||
output_notl("[ `)%s`0 | ", $promote);
|
||||
}
|
||||
if ($row['clanrank']<=$session['user']['clanrank'] && $row['clanrank']>CLAN_APPLICANT && $row['login']!=$session['user']['login'] && clan_previousrank($ranks,$row['clanrank']) > 0){
|
||||
rawoutput("<a href='clan.php?op=membership&setrank=".clan_previousrank($ranks,$row['clanrank'])."&whoacctid=".$row['acctid']."'>$demote</a> | ");
|
||||
addnav("","clan.php?op=membership&setrank=".clan_previousrank($ranks,$row['clanrank'])."&whoacctid=".$row['acctid']);
|
||||
}elseif ($row['clanrank']==CLAN_FOUNDER && $row['clanrank']>CLAN_APPLICANT && $row['login']==$session['user']['login']){
|
||||
output_notl("<a href='clan.php?op=membership&setrank=".clan_previousrank($ranks,$row['clanrank'])."&whoacctid=".$row['acctid']."'>$stepdown</a> | ",true);
|
||||
addnav("","clan.php?op=membership&setrank=".clan_previousrank($ranks,$row['clanrank'])."&whoacctid=".$row['acctid']);
|
||||
} else {
|
||||
output_notl("`)%s`0 | ", $demote);
|
||||
}
|
||||
if ($row['clanrank'] <= $session['user']['clanrank'] && $row['login']!=$session['user']['login']){
|
||||
rawoutput("<a href='clan.php?op=membership&remove=".$row['acctid']."' onClick=\"return confirm('$confirm');\">$remove</a> ]");
|
||||
addnav("","clan.php?op=membership&remove=".$row['acctid']);
|
||||
}else{
|
||||
output_notl("`)%s`0 ]", $remove);
|
||||
}
|
||||
rawoutput("</td>");
|
||||
}
|
||||
rawoutput("</tr>");
|
||||
}
|
||||
rawoutput("</table>");
|
||||
output("`n`n`^This clan has a total of `\$%s`^ dragon kills.",$tot);
|
||||
?>
|
71
lotgd-web/lotgd/lib/clan/clan_motd.php
Executable file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
page_header("Update Clan Description / MoTD");
|
||||
addnav("Clan Options");
|
||||
if ($session['user']['clanrank']>=CLAN_OFFICER){
|
||||
$clanmotd = substr(httppost('clanmotd'),0,4096);
|
||||
if (httppostisset('clanmotd') &&
|
||||
stripslashes($clanmotd)!=$claninfo['clanmotd']){
|
||||
$sql = "UPDATE " . db_prefix("clans") . " SET clanmotd='$clanmotd',motdauthor={$session['user']['acctid']} WHERE clanid={$claninfo['clanid']}";
|
||||
db_query($sql);
|
||||
invalidatedatacache("clandata-{$claninfo['clanid']}");
|
||||
$claninfo['clanmotd']=stripslashes($clanmotd);
|
||||
output("Updating MoTD`n");
|
||||
$claninfo['motdauthor']=$session['user']['acctid'];
|
||||
}
|
||||
$clandesc = httppost('clandesc');
|
||||
if (httppostisset('clandesc') &&
|
||||
stripslashes($clandesc)!=$claninfo['clandesc'] &&
|
||||
$claninfo['descauthor']!=4294967295){
|
||||
$sql = "UPDATE " . db_prefix("clans") . " SET clandesc='".addslashes(substr(stripslashes($clandesc),0,4096))."',descauthor={$session['user']['acctid']} WHERE clanid={$claninfo['clanid']}";
|
||||
db_query($sql);
|
||||
invalidatedatacache("clandata-{$claninfo['clanid']}");
|
||||
output("Updating description`n");
|
||||
$claninfo['clandesc']=stripslashes($clandesc);
|
||||
$claninfo['descauthor']=$session['user']['acctid'];
|
||||
}
|
||||
$customsay = httppost('customsay');
|
||||
if (httppostisset('customsay') && $customsay!=$claninfo['customsay'] && $session['user']['clanrank']>=CLAN_LEADER){
|
||||
$sql = "UPDATE " . db_prefix("clans") . " SET customsay='$customsay' WHERE clanid={$claninfo['clanid']}";
|
||||
db_query($sql);
|
||||
invalidatedatacache("clandata-{$claninfo['clanid']}");
|
||||
output("Updating custom say line`n");
|
||||
$claninfo['customsay']=stripslashes($customsay);
|
||||
}
|
||||
$sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid={$claninfo['motdauthor']}";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
$motdauthname = $row['name'];
|
||||
|
||||
$sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid={$claninfo['descauthor']}";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
$descauthname = $row['name'];
|
||||
|
||||
output("`&`bCurrent MoTD:`b `#by %s`2`n",$motdauthname);
|
||||
output_notl(nltoappon($claninfo['clanmotd'])."`n");
|
||||
output("`&`bCurrent Description:`b `#by %s`2`n",$descauthname);
|
||||
output_notl(nltoappon($claninfo['clandesc'])."`n");
|
||||
|
||||
rawoutput("<form action='clan.php?op=motd' method='POST'>");
|
||||
addnav("","clan.php?op=motd");
|
||||
output("`&`bMoTD:`b `7(4096 chars)`n");
|
||||
rawoutput("<textarea name='clanmotd' cols='50' rows='10' class='input' style='width: 66%'>".htmlentities($claninfo['clanmotd'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</textarea><br>");
|
||||
output("`n`&`bDescription:`b `7(4096 chars)`n");
|
||||
$blocked = translate_inline("Your clan has been blocked from posting a description.`n");
|
||||
if ($claninfo['descauthor']==INT_MAX){
|
||||
output_notl($blocked);
|
||||
}else{
|
||||
rawoutput("<textarea name='clandesc' cols='50' rows='10' class='input' style='width: 66%'>".htmlentities($claninfo['clandesc'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</textarea><br>");
|
||||
}
|
||||
if ($session['user']['clanrank']>=CLAN_LEADER){
|
||||
output("`n`&`bCustom Talk Line`b `7(blank means \"says\" -- 15 chars max)`n");
|
||||
rawoutput("<input name='customsay' value=\"".htmlentities($claninfo['customsay'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\" class='input' maxlength=\"15\"><br/>");
|
||||
}
|
||||
$save = translate_inline("Save");
|
||||
rawoutput("<input type='submit' class='button' value='$save'>");
|
||||
rawoutput("</form>");
|
||||
}else{
|
||||
output("You do not have authority to change your clan's motd or description.");
|
||||
}
|
||||
addnav("Return to your clan hall","clan.php");
|
||||
?>
|
19
lotgd-web/lotgd/lib/clan/clan_start.php
Executable file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
page_header("Clan Hall for %s", full_sanitize($claninfo['clanname']));
|
||||
addnav("Clan Options");
|
||||
if ($op==""){
|
||||
require_once("lib/clan/clan_default.php");
|
||||
}elseif ($op=="motd"){
|
||||
require_once("lib/clan/clan_motd.php");
|
||||
}elseif ($op=="membership"){
|
||||
require_once("lib/clan/clan_membership.php");
|
||||
}elseif ($op=="withdrawconfirm"){
|
||||
output("Are you sure you want to withdraw from your clan?");
|
||||
addnav("Withdraw?");
|
||||
addnav("No","clan.php");
|
||||
addnav("!?Yes","clan.php?op=withdraw");
|
||||
}elseif ($op=="withdraw"){
|
||||
require_once("lib/clan/clan_withdraw.php");
|
||||
}
|
||||
|
||||
?>
|
56
lotgd-web/lotgd/lib/clan/clan_withdraw.php
Executable file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
modulehook("clan-withdraw", array('clanid'=>$session['user']['clanid'], 'clanrank'=>$session['user']['clanrank'], 'acctid'=>$session['user']['acctid']));
|
||||
if ($session['user']['clanrank']>=CLAN_LEADER){
|
||||
//first test to see if we were the leader.
|
||||
$sql = "SELECT count(*) AS c FROM " . db_prefix("accounts") . " WHERE clanid={$session['user']['clanid']} AND clanrank>=".CLAN_LEADER." AND acctid<>{$session['user']['acctid']}";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
if ($row['c']==0){
|
||||
//we were the solitary leader.
|
||||
$sql = "SELECT name,acctid,clanrank FROM " . db_prefix("accounts") . " WHERE clanid={$session['user']['clanid']} AND clanrank > " . CLAN_APPLICANT . " AND acctid<>{$session['user']['acctid']} ORDER BY clanrank DESC, clanjoindate LIMIT 1";
|
||||
$result = db_query($sql);
|
||||
if ($row = db_fetch_assoc($result)){
|
||||
//there is no alternate leader, let's promote the
|
||||
//highest ranking member (or oldest member in the
|
||||
//event of a tie). This will capture even people
|
||||
//who applied for membership.
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET clanrank=".CLAN_LEADER." WHERE acctid={$row['acctid']}";
|
||||
db_query($sql);
|
||||
output("`^Promoting %s`^ to leader as they are the highest ranking member (or oldest member in the event of a tie).`n`n",$row['name']);
|
||||
}else{
|
||||
//There are no other members, we need to delete the clan.
|
||||
modulehook("clan-delete", array("clanid"=>$session['user']['clanid']));
|
||||
$sql = "DELETE FROM " . db_prefix("clans") . " WHERE clanid={$session['user']['clanid']}";
|
||||
db_query($sql);
|
||||
//just in case we goofed, we don't want to have to worry
|
||||
//about people being associated with a deleted clan.
|
||||
$sql = "UPDATE " . db_prefix("accounts") . " SET clanid=0,clanrank=".CLAN_APPLICANT.",clanjoindate='0000-00-00 00:00:00' WHERE clanid={$session['user']['clanid']}";
|
||||
db_query($sql);
|
||||
output("`^As you were the last member of this clan, it has been deleted.");
|
||||
}
|
||||
}else{
|
||||
//we don't have to do anything special with this clan as
|
||||
//although we were leader, there is another leader already
|
||||
//to take our place.
|
||||
}
|
||||
}else{
|
||||
//we don't have to do anything special with this clan as we were
|
||||
//not the leader, and so there should still be other members.
|
||||
}
|
||||
$sql = "SELECT acctid FROM " . db_prefix("accounts") . " WHERE clanid='{$session['user']['clanid']}' AND clanrank>=".CLAN_OFFICER." AND acctid<>'{$session['user']['acctid']}'";
|
||||
$result = db_query($sql);
|
||||
$withdraw_subj = array("`\$Clan Withdraw: `&%s`0",$session['user']['name']);
|
||||
$msg = array("`^One of your clan members has resigned their membership. `&%s`^ has surrendered their position within your clan!",$session['user']['name']);
|
||||
$sql = "DELETE FROM " . db_prefix("mail") . " WHERE msgfrom=0 AND seen=0 AND subject='".serialize($withdraw_subj)."'";
|
||||
db_query($sql);
|
||||
while ($row = db_fetch_assoc($result)){
|
||||
systemmail($row['acctid'],$withdraw_subj,$msg);
|
||||
}
|
||||
|
||||
$session['user']['clanid']=0;
|
||||
$session['user']['clanrank']=CLAN_APPLICANT;
|
||||
$session['user']['clanjoindate']="0000-00-00 00:00:00";
|
||||
output("`&You have withdrawn from your clan.");
|
||||
addnav("Clan Options");
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
?>
|
95
lotgd-web/lotgd/lib/clan/detail.php
Executable file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
if ($session['user']['superuser'] & SU_EDIT_COMMENTS){
|
||||
$clanname = httppost('clanname');
|
||||
if ($clanname) $clanname = full_sanitize($clanname);
|
||||
$clanshort = httppost('clanshort');
|
||||
if ($clanshort) $clanshort = full_sanitize($clanshort);
|
||||
if ($clanname>"" && $clanshort>""){
|
||||
$sql = "UPDATE " . db_prefix("clans") . " SET clanname='$clanname',clanshort='$clanshort' WHERE clanid='$detail'";
|
||||
output("Updating clan names`n");
|
||||
db_query($sql);
|
||||
invalidatedatacache("clandata-$detail");
|
||||
}
|
||||
if (httppost('block')>""){
|
||||
$blockdesc = translate_inline("Description blocked for inappropriate usage.");
|
||||
$sql = "UPDATE " . db_prefix("clans") . " SET descauthor=4294967295, clandesc='$blockdesc' where clanid='$detail'";
|
||||
output("Blocking public description`n");
|
||||
db_query($sql);
|
||||
invalidatedatacache("clandata-$detail");
|
||||
}elseif (httppost('unblock')>""){
|
||||
$sql = "UPDATE " . db_prefix("clans") . " SET descauthor=0, clandesc='' where clanid='$detail'";
|
||||
output("UNblocking public description`n");
|
||||
db_query($sql);
|
||||
invalidatedatacache("clandata-$detail");
|
||||
}
|
||||
}
|
||||
$sql = "SELECT * FROM " . db_prefix("clans") . " WHERE clanid='$detail'";
|
||||
$result1 = db_query_cached($sql, "clandata-$detail", 3600);
|
||||
$row1 = db_fetch_assoc($result1);
|
||||
if ($session['user']['superuser'] & SU_EDIT_COMMENTS){
|
||||
rawoutput("<div id='hidearea'>");
|
||||
rawoutput("<form action='clan.php?detail=$detail' method='POST'>");
|
||||
addnav("","clan.php?detail=$detail");
|
||||
output("Superuser / Moderator renaming:`n");
|
||||
output("Long Name: ");
|
||||
rawoutput("<input name='clanname' value=\"".htmlentities($row1['clanname'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\" maxlength=50 size=50>");
|
||||
output("`nShort Name: ");
|
||||
rawoutput("<input name='clanshort' value=\"".htmlentities($row1['clanshort'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."\" maxlength=5 size=5>");
|
||||
output_notl("`n");
|
||||
$save = translate_inline("Save");
|
||||
rawoutput("<input type='submit' class='button' value=\"$save\">");
|
||||
$snu = htmlentities(translate_inline("Save & UNblock public description"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
|
||||
$snb = htmlentities(translate_inline("Save & Block public description"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
|
||||
if ($row1['descauthor']=="4294967295")
|
||||
rawoutput("<input type='submit' name='unblock' value=\"$snu\" class='button'>");
|
||||
else
|
||||
rawoutput("<input type='submit' name='block' value=\"$snb\" class='button'>");
|
||||
rawoutput("</form>");
|
||||
rawoutput("</div>");
|
||||
rawoutput("<script language='JavaScript'>var hidearea = document.getElementById('hidearea');hidearea.style.visibility='hidden';hidearea.style.display='none';</script>",true);
|
||||
$e = translate_inline("Edit Clan Info");
|
||||
rawoutput("<a href='#' onClick='hidearea.style.visibility=\"visible\"; hidearea.style.display=\"inline\"; return false;'>$e</a>",true);
|
||||
output_notl("`n");
|
||||
}
|
||||
|
||||
output_notl(nltoappon($row1['clandesc']));
|
||||
if ( nltoappon($row1['clandesc']) != "" ) output ("`n`n");
|
||||
output("`0This is the current clan membership of %s < %s >:`n",$row1['clanname'],$row1['clanshort']);
|
||||
page_header("Clan Membership for %s <%s>", full_sanitize($row1['clanname']), full_sanitize($row1['clanshort']));
|
||||
addnav("Clan Options");
|
||||
$rank = translate_inline("Rank");
|
||||
$name = translate_inline("Name");
|
||||
$dk = translate_inline("Dragon Kills");
|
||||
$jd = translate_inline("Join Date");
|
||||
rawoutput("<table border='0' cellpadding='2' cellspacing='0'>");
|
||||
rawoutput("<tr class='trhead'><td>$rank</td><td>$name</td><td>$dk</td><td>$jd</td></tr>");
|
||||
$i=0;
|
||||
$sql = "SELECT acctid,name,login,clanrank,clanjoindate,dragonkills FROM " . db_prefix("accounts") . " WHERE clanid=$detail ORDER BY clanrank DESC,clanjoindate";
|
||||
$result = db_query($sql);
|
||||
$tot = 0;
|
||||
//little hack with the hook...can't think of any other way
|
||||
$ranks = array(CLAN_APPLICANT=>"`!Applicant`0",CLAN_MEMBER=>"`#Member`0",CLAN_OFFICER=>"`^Officer`0",CLAN_LEADER=>"`&Leader`0", CLAN_FOUNDER=>"`\$Founder");
|
||||
$args = modulehook("clanranks", array("ranks"=>$ranks, "clanid"=>$detail));
|
||||
$ranks = translate_inline($args['ranks']);
|
||||
//end
|
||||
while ($row=db_fetch_assoc($result)){
|
||||
$i++;
|
||||
$tot += $row['dragonkills'];
|
||||
rawoutput("<tr class='".($i%2?"trlight":"trdark")."'>");
|
||||
rawoutput("<td>");
|
||||
output_notl($ranks[$row['clanrank']]); //translated earlier
|
||||
rawoutput("</td><td>");
|
||||
$link = "bio.php?char=".$row['acctid']."&ret=".urlencode($_SERVER['REQUEST_URI']);
|
||||
rawoutput("<a href='$link'>");
|
||||
addnav("", $link);
|
||||
output_notl("`&%s`0", $row['name']);
|
||||
rawoutput("</a>");
|
||||
rawoutput("</td><td align='center'>");
|
||||
output_notl("`\$%s`0", $row['dragonkills']);
|
||||
rawoutput("</td><td>");
|
||||
output_notl("`3%s`0", $row['clanjoindate']);
|
||||
rawoutput("</td></tr>");
|
||||
}
|
||||
rawoutput("</table>");
|
||||
output("`n`n`^This clan has a total of `\$%s`^ dragon kills.",$tot);
|
||||
?>
|
49
lotgd-web/lotgd/lib/clan/func.php
Executable file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Clan functions
|
||||
*
|
||||
* This file contains functions
|
||||
* that are specific to the clan
|
||||
* system.
|
||||
*
|
||||
* @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2009, Dragonprime Development Team
|
||||
* @version Lotgd 1.1.2 DragonPrime Edition
|
||||
* @package Core
|
||||
* @subpackage Library
|
||||
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
|
||||
*/
|
||||
/**
|
||||
* Returns the numeric value of the next rank from the given array
|
||||
*
|
||||
* @param array $ranks The ranks
|
||||
* @param int $current The numeric value of the current rank
|
||||
* @return int The numeric value of the next rank
|
||||
*/
|
||||
function clan_nextrank($ranks,$current) {
|
||||
$temp=array_pop($ranks);
|
||||
$ranks=array_keys($ranks);
|
||||
while (count($ranks)>0) {
|
||||
$key=array_shift($ranks);
|
||||
if ($key>$current) return $key;
|
||||
}
|
||||
return 30;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the numeric value of the previous rank from the given array
|
||||
*
|
||||
* @param array $ranks The ranks
|
||||
* @param int $current The numeric value of the current rank
|
||||
* @return int The numeric value of the previous rank
|
||||
*/
|
||||
function clan_previousrank($ranks,$current) {
|
||||
$temp=array_pop($ranks);
|
||||
$ranks=array_keys($ranks);
|
||||
while (count($ranks)>0) {
|
||||
$key=array_pop($ranks);
|
||||
if ($key<$current) return $key;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
?>
|
43
lotgd-web/lotgd/lib/clan/list.php
Executable file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
page_header("Clan Listing");
|
||||
$registrar=getsetting('clanregistrar','`%Karissa');
|
||||
addnav("Clan Options");
|
||||
$sql = "SELECT MAX(" . db_prefix("clans") . ".clanid) AS clanid, MAX(clanshort) AS clanshort, MAX(clanname) AS clanname,count(" . db_prefix("accounts") . ".acctid) AS c FROM " . db_prefix("clans") . " LEFT JOIN " . db_prefix("accounts") . " ON " . db_prefix("clans") . ".clanid=" . db_prefix("accounts") . ".clanid AND clanrank>".CLAN_APPLICANT." GROUP BY " . db_prefix("clans") . ".clanid ORDER BY c DESC";
|
||||
$result = db_query($sql);
|
||||
if (db_num_rows($result)>0){
|
||||
output("`7You ask %s`7 for the clan listings. She points you toward a marquee board near the entrance of the lobby that lists the clans.`0`n`n",$registrar);
|
||||
$v = 0;
|
||||
$memb_n = translate_inline("(%s members)");
|
||||
$memb_1 = translate_inline("(%s member)");
|
||||
rawoutput('<table cellspacing="0" cellpadding="2" align="left">');
|
||||
while ($row = db_fetch_assoc($result)){
|
||||
if ($row['c']==0){
|
||||
$sql = "DELETE FROM " . db_prefix("clans") . " WHERE clanid={$row['clanid']}";
|
||||
db_query($sql);
|
||||
}else{
|
||||
rawoutput('<tr class="' . ($v%2?"trlight":"trdark").'"><td>', true);
|
||||
if ($row['c'] == 1) {
|
||||
$memb = sprintf($memb_1, $row['c']);
|
||||
} else {
|
||||
$memb = sprintf($memb_n, $row['c']);
|
||||
}
|
||||
output_notl("• <%s> <a href='clan.php?detail=%s'>%s</a> %s`n",
|
||||
$row['clanshort'],
|
||||
$row['clanid'],
|
||||
full_sanitize(htmlentities($row['clanname']), ENT_COMPAT, getsetting("charset", "ISO-8859-1")),
|
||||
$memb, true);
|
||||
rawoutput('</td></tr>');
|
||||
addnav("","clan.php?detail={$row['clanid']}");
|
||||
$v++;
|
||||
}
|
||||
}
|
||||
rawoutput("</table>", true);
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
}else{
|
||||
output("`7You ask %s`7 for the clan listings. She stares at you blankly for a few moments, then says, \"`5Sorry pal, no one has had enough gumption to start up a clan yet. Maybe that should be you, eh?`7\"",$registrar);
|
||||
addnav("Apply for a New Clan","clan.php?op=new");
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
}
|
||||
|
||||
page_footer();
|
||||
?>
|
14
lotgd-web/lotgd/lib/clan/waiting.php
Executable file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
page_header("Clan Halls");
|
||||
addnav("Clan Options");
|
||||
output("`b`c`&Clan Halls`c`b");
|
||||
output("You stroll off to the side where there are some plush leather chairs, and take a seat.");
|
||||
output("There are several other warriors sitting here talking amongst themselves.");
|
||||
output("Some Ye Olde Muzak is coming from a fake rock sitting at the base of a potted bush.`n`n");
|
||||
commentdisplay("", "waiting","Speak",25);
|
||||
if ($session['user']['clanrank']==CLAN_APPLICANT) {
|
||||
addnav("Return to the Lobby","clan.php");
|
||||
} else {
|
||||
addnav("Return to your Clan Rooms","clan.php");
|
||||
}
|
||||
?>
|
629
lotgd-web/lotgd/lib/commentary.php
Executable file
@ -0,0 +1,629 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
require_once("lib/datetime.php");
|
||||
require_once("lib/sanitize.php");
|
||||
require_once("lib/http.php");
|
||||
|
||||
$comsecs = array();
|
||||
function commentarylocs() {
|
||||
global $comsecs, $session;
|
||||
if (is_array($comsecs) && count($comsecs)) return $comsecs;
|
||||
|
||||
$vname = getsetting("villagename", LOCATION_FIELDS);
|
||||
$iname = getsetting("innname", LOCATION_INN);
|
||||
tlschema("commentary");
|
||||
$comsecs['village'] = sprintf_translate("%s Square", $vname);
|
||||
if ($session['user']['superuser'] & ~SU_DOESNT_GIVE_GROTTO) {
|
||||
$comsecs['superuser']=translate_inline("Grotto");
|
||||
}
|
||||
$comsecs['shade']=translate_inline("Land of the Shades");
|
||||
$comsecs['grassyfield']=translate_inline("Grassy Field");
|
||||
$comsecs['inn']="$iname";
|
||||
$comsecs['motd']=translate_inline("MotD");
|
||||
$comsecs['veterans']=translate_inline("Veterans Club");
|
||||
$comsecs['hunterlodge']=translate_inline("Hunter's Lodge");
|
||||
$comsecs['gardens']=translate_inline("Gardens");
|
||||
$comsecs['waiting']=translate_inline("Clan Hall Waiting Area");
|
||||
if (getsetting("betaperplayer", 1) == 1 && @file_exists("pavilion.php")) {
|
||||
$comsecs['beta']=translate_inline("Pavilion");
|
||||
}
|
||||
tlschema();
|
||||
// All of the ones after this will be translated in the modules.
|
||||
$comsecs = modulehook("moderate", $comsecs);
|
||||
rawoutput(tlbutton_clear());
|
||||
return $comsecs;
|
||||
}
|
||||
|
||||
function addcommentary() {
|
||||
global $session, $emptypost;
|
||||
$section = httppost('section');
|
||||
$talkline = httppost('talkline');
|
||||
$schema = httppost('schema');
|
||||
$comment = trim(httppost('insertcommentary'));
|
||||
$counter = httppost('counter');
|
||||
$remove = URLDecode(httpget('removecomment'));
|
||||
if ($remove>0) {
|
||||
$return = '/' . httpget('returnpath');
|
||||
$section = httpget('section');
|
||||
$sql = "SELECT " .
|
||||
db_prefix("commentary").".*,".db_prefix("accounts").".name,".
|
||||
db_prefix("accounts").".acctid, ".db_prefix("accounts").".clanrank,".
|
||||
db_prefix("clans").".clanshort FROM ".db_prefix("commentary").
|
||||
" INNER JOIN ".db_prefix("accounts")." ON ".
|
||||
db_prefix("accounts").".acctid = " . db_prefix("commentary").
|
||||
".author LEFT JOIN ".db_prefix("clans")." ON ".
|
||||
db_prefix("clans").".clanid=".db_prefix("accounts").
|
||||
".clanid WHERE commentid=$remove";
|
||||
$row = db_fetch_assoc(db_query($sql));
|
||||
$sql = "INSERT LOW_PRIORITY INTO ".db_prefix("moderatedcomments").
|
||||
" (moderator,moddate,comment) VALUES ('{$session['user']['acctid']}','".date("Y-m-d H:i:s")."','".addslashes(serialize($row))."')";
|
||||
db_query($sql);
|
||||
$sql = "DELETE FROM ".db_prefix("commentary")." WHERE commentid='$remove';";
|
||||
db_query($sql);
|
||||
invalidatedatacache("comments-$section");
|
||||
invalidatedatacache("comments-or11");
|
||||
$session['user']['specialinc']==''; //just to make sure he was not in a special
|
||||
$return = cmd_sanitize($return);
|
||||
$return = substr($return,strrpos($return,"/")+1);
|
||||
if (strpos($return,"?")===false && strpos($return,"&")!==false){
|
||||
$x = strpos($return,"&");
|
||||
$return = substr($return,0,$x-1)."?".substr($return,$x+1);
|
||||
}
|
||||
debug($return);
|
||||
redirect($return);
|
||||
}
|
||||
if (array_key_exists('commentcounter',$session) &&
|
||||
$session['commentcounter']==$counter) {
|
||||
if ($section || $talkline || $comment) {
|
||||
$tcom = color_sanitize($comment);
|
||||
if ($tcom == "" || $tcom == ":" || $tcom == "::" || $tcom == "/me")
|
||||
$emptypost = 1;
|
||||
else injectcommentary($section, $talkline, $comment, $schema);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function injectsystemcomment($section,$comment) {
|
||||
//function lets gamemasters put in comments without a user association...be careful, it is not trackable who posted it
|
||||
if (strncmp($comment, "/game", 5) !== 0) {
|
||||
$comment = "/game" . $comment;
|
||||
}
|
||||
injectrawcomment($section,0,$comment);
|
||||
}
|
||||
|
||||
function injectrawcomment($section, $author, $comment)
|
||||
{
|
||||
$sql = "INSERT INTO " . db_prefix("commentary") . " (postdate,section,author,comment) VALUES ('".date("Y-m-d H:i:s")."','$section',$author,\"$comment\")";
|
||||
db_query($sql);
|
||||
invalidatedatacache("comments-{$section}");
|
||||
// invalidate moderation screen also.
|
||||
invalidatedatacache("comments-or11");
|
||||
}
|
||||
|
||||
function injectcommentary($section, $talkline, $comment, $schema=false) {
|
||||
global $session,$doublepost, $translation_namespace;
|
||||
if ($schema===false) $schema=$translation_namespace;
|
||||
// Make the comment pristine so that we match on it correctly.
|
||||
$comment = stripslashes($comment);
|
||||
tlschema("commentary");
|
||||
$doublepost=0;
|
||||
$emptypost = 0;
|
||||
$colorcount = 0;
|
||||
if ($comment !="") {
|
||||
$commentary = str_replace("`n","",soap($comment));
|
||||
$y = strlen($commentary);
|
||||
for ($x=0;$x<$y;$x++){
|
||||
if (substr($commentary,$x,1)=="`"){
|
||||
$colorcount++;
|
||||
if ($colorcount>=getsetting("maxcolors",10)){
|
||||
$commentary = substr($commentary,0,$x).color_sanitize(substr($commentary,$x));
|
||||
$x=$y;
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
|
||||
$args = array('commentline'=>$commentary, 'commenttalk'=>$talkline);
|
||||
$args = modulehook("commentary", $args);
|
||||
$commentary = $args['commentline'];
|
||||
$talkline = $args['commenttalk'];
|
||||
tlschema($schema);
|
||||
$talkline = translate_inline($talkline);
|
||||
tlschema();
|
||||
|
||||
$commentary = preg_replace("'([^[:space:]]{45,45})([^[:space:]])'","\\1 \\2",$commentary);
|
||||
$commentary = addslashes($commentary);
|
||||
// do an emote if the area has a custom talkline and the user
|
||||
// isn't trying to emote already.
|
||||
if ($talkline!="says" && substr($commentary,0,1)!=":" &&
|
||||
substr($commentary,0,2)!="::" &&
|
||||
substr($commentary,0,3)!="/me" &&
|
||||
substr($commentary,0,5) != "/game") {
|
||||
$commentary = ":`3$talkline, \\\"`#$commentary`3\\\"";
|
||||
}
|
||||
if (substr($commentary,0,5)=="/game" && ($session['user']['superuser']&SU_IS_GAMEMASTER)==SU_IS_GAMEMASTER) {
|
||||
//handle game master inserts now, allow double posts
|
||||
injectsystemcomment($section,$commentary);
|
||||
} else {
|
||||
$sql = "SELECT comment,author FROM " . db_prefix("commentary") . " WHERE section='$section' ORDER BY commentid DESC LIMIT 1";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
db_free_result($result);
|
||||
if ($row['comment']!=stripslashes($commentary) ||
|
||||
$row['author']!=$session['user']['acctid']){
|
||||
injectrawcomment($section, $session['user']['acctid'],
|
||||
$commentary);
|
||||
$session['user']['laston']=date("Y-m-d H:i:s");
|
||||
} else {
|
||||
$doublepost = 1;
|
||||
}
|
||||
}
|
||||
tlschema();
|
||||
}
|
||||
}
|
||||
|
||||
function commentdisplay($intro, $section, $message="Interject your own commentary?",$limit=10,$talkline="says",$schema=false) {
|
||||
// Let's add a hook for modules to block commentary sections
|
||||
$args = modulehook("blockcommentarea", array("section"=>$section));
|
||||
if (isset($args['block']) && ($args['block'] == "yes"))
|
||||
return;
|
||||
|
||||
if ($intro) output($intro);
|
||||
viewcommentary($section, $message, $limit, $talkline, $schema);
|
||||
}
|
||||
|
||||
function viewcommentary($section,$message="Interject your own commentary?",$limit=10,$talkline="says",$schema=false) {
|
||||
global $session,$REQUEST_URI,$doublepost, $translation_namespace;
|
||||
global $emptypost;
|
||||
|
||||
rawoutput("<a name='$section'></a>");
|
||||
// Let's add a hook for modules to block commentary sections
|
||||
$args = modulehook("blockcommentarea", array("section"=>$section));
|
||||
if (isset($args['block']) && ($args['block'] == "yes"))
|
||||
return;
|
||||
|
||||
if ($schema === false)
|
||||
$schema=$translation_namespace;
|
||||
tlschema("commentary");
|
||||
|
||||
$nobios = array("motd.php"=>true);
|
||||
if (!array_key_exists(basename($_SERVER['SCRIPT_NAME']),$nobios)) $nobios[basename($_SERVER['SCRIPT_NAME'])] = false;
|
||||
if ($nobios[basename($_SERVER['SCRIPT_NAME'])])
|
||||
$linkbios=false;
|
||||
else
|
||||
$linkbios=true;
|
||||
|
||||
if ($message=="X") $linkbios=true;
|
||||
|
||||
if ($doublepost) output("`\$`bDouble post?`b`0`n");
|
||||
if ($emptypost) output("`\$`bWell, they say silence is a virtue.`b`0`n");
|
||||
|
||||
$clanrankcolors=array("`!","`#","`^","`&","`\$");
|
||||
|
||||
// Needs to be here because scrolling through the commentary pages, entering a bio, then scrolling again forward
|
||||
// then re-entering another bio will lead to $com being smaller than 0 and this will lead to an SQL error later on.
|
||||
$com=(int)httpget("comscroll");
|
||||
if ($com < 0) $com = 0;
|
||||
$cc = false;
|
||||
if (httpget("comscroll") !==false && (int)$session['lastcom']==$com+1)
|
||||
$cid = (int)$session['lastcommentid'];
|
||||
else
|
||||
$cid = 0;
|
||||
|
||||
$session['lastcom'] = $com;
|
||||
|
||||
if ($com > 0 || $cid > 0) {
|
||||
// Find newly added comments.
|
||||
$sql = "SELECT COUNT(commentid) AS newadded FROM " .
|
||||
db_prefix("commentary") . " LEFT JOIN " .
|
||||
db_prefix("accounts") . " ON " .
|
||||
db_prefix("accounts") . ".acctid = " .
|
||||
db_prefix("commentary"). ".author WHERE section='$section' AND " .
|
||||
"(".db_prefix("accounts").".locked=0 or ".db_prefix('accounts').".locked is null) AND commentid > '$cid'";
|
||||
$result = db_query($sql);
|
||||
$row = db_fetch_assoc($result);
|
||||
$newadded = $row['newadded'];
|
||||
} else {
|
||||
$newadded = 0;
|
||||
}
|
||||
|
||||
$commentbuffer = array();
|
||||
if ($cid == 0) {
|
||||
$sql = "SELECT ". db_prefix("commentary") . ".*, " .
|
||||
db_prefix("accounts").".name, " .
|
||||
db_prefix("accounts").".acctid, " .
|
||||
db_prefix("accounts").".clanrank, " .
|
||||
db_prefix("clans") . ".clanshort FROM " .
|
||||
db_prefix("commentary") . " LEFT JOIN " .
|
||||
db_prefix("accounts") . " ON " .
|
||||
db_prefix("accounts") . ".acctid = " .
|
||||
db_prefix("commentary"). ".author LEFT JOIN " .
|
||||
db_prefix("clans") . " ON " .
|
||||
db_prefix("clans") . ".clanid=" .
|
||||
db_prefix("accounts") .
|
||||
".clanid WHERE section = '$section' AND " .
|
||||
"( ".db_prefix("accounts") . ".locked=0 OR ".db_prefix("accounts") .".locked is null ) ".
|
||||
"ORDER BY commentid DESC LIMIT " .
|
||||
($com*$limit).",$limit";
|
||||
if ($com==0 && strstr( $_SERVER['REQUEST_URI'], "/moderate.php" ) !== $_SERVER['REQUEST_URI'] )
|
||||
$result = db_query_cached($sql,"comments-{$section}");
|
||||
else
|
||||
$result = db_query($sql);
|
||||
while($row = db_fetch_assoc($result)) $commentbuffer[] = $row;
|
||||
} else {
|
||||
$sql = "SELECT " . db_prefix("commentary") . ".*, " .
|
||||
db_prefix("accounts").".name, " .
|
||||
db_prefix("accounts").".acctid, " .
|
||||
db_prefix("accounts").".clanrank, " .
|
||||
db_prefix("clans").".clanshort FROM " .
|
||||
db_prefix("commentary") . " LEFT JOIN " .
|
||||
db_prefix("accounts") . " ON " .
|
||||
db_prefix("accounts") . ".acctid = " .
|
||||
db_prefix("commentary"). ".author LEFT JOIN " .
|
||||
db_prefix("clans") . " ON " . db_prefix("clans") . ".clanid=" .
|
||||
db_prefix("accounts") .
|
||||
".clanid WHERE section = '$section' AND " .
|
||||
"( ".db_prefix("accounts") . ".locked=0 OR ".db_prefix("accounts") .".locked is null ) ".
|
||||
"AND commentid > '$cid' " .
|
||||
"ORDER BY commentid ASC LIMIT $limit";
|
||||
$result = db_query($sql);
|
||||
while ($row = db_fetch_assoc($result)) $commentbuffer[] = $row;
|
||||
$commentbuffer = array_reverse($commentbuffer);
|
||||
}
|
||||
|
||||
$rowcount = count($commentbuffer);
|
||||
if ($rowcount > 0)
|
||||
$session['lastcommentid'] = $commentbuffer[0]['commentid'];
|
||||
|
||||
$counttoday=0;
|
||||
for ($i=0; $i < $rowcount; $i++){
|
||||
$row = $commentbuffer[$i];
|
||||
$row['comment'] = comment_sanitize($row['comment']);
|
||||
$commentids[$i] = $row['commentid'];
|
||||
if (date("Y-m-d",strtotime($row['postdate']))==date("Y-m-d")){
|
||||
if ($row['name']==$session['user']['name']) $counttoday++;
|
||||
}
|
||||
$x=0;
|
||||
$ft="";
|
||||
for ($x=0;strlen($ft)<5 && $x<strlen($row['comment']);$x++){
|
||||
if (substr($row['comment'],$x,1)=="`" && strlen($ft)==0) {
|
||||
$x++;
|
||||
}else{
|
||||
$ft.=substr($row['comment'],$x,1);
|
||||
}
|
||||
}
|
||||
|
||||
$link = "bio.php?char=" . $row['acctid'] .
|
||||
"&ret=".URLEncode($_SERVER['REQUEST_URI']);
|
||||
|
||||
if (substr($ft,0,2)=="::")
|
||||
$ft = substr($ft,0,2);
|
||||
elseif (substr($ft,0,1)==":")
|
||||
$ft = substr($ft,0,1);
|
||||
elseif (substr($ft,0,3)=="/me")
|
||||
$ft = substr($ft,0,3);
|
||||
|
||||
$row['comment'] = holidayize($row['comment'],'comment');
|
||||
$row['name'] = holidayize($row['name'],'comment');
|
||||
if ($row['clanrank']) {
|
||||
$row['name'] = ($row['clanshort']>""?"{$clanrankcolors[ceil($row['clanrank']/10)]}<`2{$row['clanshort']}{$clanrankcolors[ceil($row['clanrank']/10)]}> `&":"").$row['name'];
|
||||
}
|
||||
if ($ft=="::" || $ft=="/me" || $ft==":"){
|
||||
$x = strpos($row['comment'],$ft);
|
||||
if ($x!==false){
|
||||
if ($linkbios)
|
||||
$op[$i] = str_replace("&","&",HTMLEntities(substr($row['comment'],0,$x), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0<a href='$link' style='text-decoration: none'>\n`&{$row['name']}`0</a>\n`& ".str_replace("&","&",HTMLEntities(substr($row['comment'],$x+strlen($ft)), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`n";
|
||||
else
|
||||
$op[$i] = str_replace("&","&",HTMLEntities(substr($row['comment'],0,$x), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`&{$row['name']}`0`& ".str_replace("&","&",HTMLEntities(substr($row['comment'],$x+strlen($ft)), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`n";
|
||||
$rawc[$i] = str_replace("&","&",HTMLEntities(substr($row['comment'],0,$x), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`&{$row['name']}`0`& ".str_replace("&","&",HTMLEntities(substr($row['comment'],$x+strlen($ft)), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`n";
|
||||
}
|
||||
}
|
||||
if ($ft=="/game" && !$row['name']) {
|
||||
$x = strpos($row['comment'],$ft);
|
||||
if ($x!==false){
|
||||
$op[$i] = str_replace("&","&",HTMLEntities(substr($row['comment'],0,$x), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`&".str_replace("&","&",HTMLEntities(substr($row['comment'],$x+strlen($ft)), ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`0`n";
|
||||
}
|
||||
}
|
||||
if (!isset($op) || !is_array($op)) $op = array();
|
||||
if (!array_key_exists($i,$op) || $op[$i] == "") {
|
||||
if ($linkbios)
|
||||
$op[$i] = "`0<a href='$link' style='text-decoration: none'>`&{$row['name']}`0</a>`3 says, \"`#".str_replace("&","&",HTMLEntities($row['comment'], ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`3\"`0`n";
|
||||
elseif (substr($ft,0,5)=='/game' && !$row['name'])
|
||||
$op[$i] = str_replace("&","&",HTMLEntities($row['comment'], ENT_COMPAT, getsetting("charset", "ISO-8859-1")));
|
||||
else
|
||||
$op[$i] = "`&{$row['name']}`3 says, \"`#".str_replace("&","&",HTMLEntities($row['comment'], ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`3\"`0`n";
|
||||
$rawc[$i] = "`&{$row['name']}`3 says, \"`#".str_replace("&","&",HTMLEntities($row['comment'], ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`3\"`0`n";
|
||||
}
|
||||
|
||||
if (!array_key_exists('timestamp', $session['user']['prefs']))
|
||||
$session['user']['prefs']['timestamp'] = 0;
|
||||
|
||||
$session['user']['prefs']['timeoffset'] = round($session['user']['prefs']['timeoffset'],1);
|
||||
|
||||
if ($session['user']['prefs']['timestamp']==1) {
|
||||
if (!isset($session['user']['prefs']['timeformat'])) $session['user']['prefs']['timeformat'] = "[m/d h:ia]";
|
||||
$time = strtotime($row['postdate']) + ($session['user']['prefs']['timeoffset'] * 60 * 60);
|
||||
$s=date("`7" . $session['user']['prefs']['timeformat'] . "`0 ",$time);
|
||||
$op[$i] = $s.$op[$i];
|
||||
}elseif ($session['user']['prefs']['timestamp']==2) {
|
||||
$s=reltime(strtotime($row['postdate']));
|
||||
$op[$i] = "`7($s)`0 ".$op[$i];
|
||||
}
|
||||
if ($message=="X")
|
||||
$op[$i]="`0({$row['section']}) ".$op[$i];
|
||||
if ($row['postdate']>=$session['user']['recentcomments'])
|
||||
$op[$i]="<img src='images/new.gif' alt='>' width='3' height='5' align='absmiddle'> ".$op[$i];
|
||||
addnav("",$link);
|
||||
$auth[$i] = $row['author'];
|
||||
if (isset($rawc[$i])) {
|
||||
$rawc[$i] = full_sanitize($rawc[$i]);
|
||||
$rawc[$i] = htmlentities($rawc[$i], ENT_QUOTES, getsetting("charset", "ISO-8859-1"));
|
||||
}
|
||||
}
|
||||
$i--;
|
||||
$outputcomments=array();
|
||||
$sect="x";
|
||||
|
||||
$moderating=false;
|
||||
if (($session['user']['superuser'] & SU_EDIT_COMMENTS) && $message=="X")
|
||||
$moderating=true;
|
||||
|
||||
$del=translate_inline("Del");
|
||||
$scriptname=substr($_SERVER['SCRIPT_NAME'],strrpos($_SERVER['SCRIPT_NAME'],"/")+1);
|
||||
$pos=strpos($_SERVER['REQUEST_URI'],"?");
|
||||
$return=$scriptname.($pos==false?"":substr($_SERVER['REQUEST_URI'],$pos));
|
||||
$one=(strstr($return,"?")==false?"?":"&");
|
||||
|
||||
for (;$i>=0;$i--){
|
||||
$out="";
|
||||
if ($moderating){
|
||||
if ($session['user']['superuser'] & SU_EDIT_USERS){
|
||||
$out.="`0[ <input type='checkbox' name='comment[{$commentids[$i]}]'> | <a href='user.php?op=setupban&userid=".$auth[$i]."&reason=".rawurlencode($rawc[$i])."'>Ban</a> ] ";
|
||||
addnav("","user.php?op=setupban&userid=$auth[$i]&reason=".rawurlencode($rawc[$i]));
|
||||
}else{
|
||||
$out.="`0[ <input type='checkbox' name='comment[{$commentids[$i]}]'> ] ";
|
||||
}
|
||||
$matches=array();
|
||||
preg_match("/[(]([^)]*)[)]/",$op[$i],$matches);
|
||||
$sect=trim($matches[1]);
|
||||
if (substr($sect,0,5)!="clan-" || $sect==$section){
|
||||
if (substr($sect,0,4)!="pet-"){
|
||||
$out.=$op[$i];
|
||||
if (!isset($outputcomments[$sect]) ||
|
||||
!is_array($outputcomments[$sect]))
|
||||
$outputcomments[$sect]=array();
|
||||
array_push($outputcomments[$sect],$out);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if ($session['user']['superuser'] & SU_EDIT_COMMENTS) {
|
||||
$out.="`2[<a href='".$return.$one."removecomment={$commentids[$i]}§ion=$section&returnpath=".URLEncode($return)."'>$del</a>`2]`0 ";
|
||||
addnav("",$return.$one."removecomment={$commentids[$i]}§ion=$section&returnpath=".URLEncode($return)."");
|
||||
}
|
||||
$out.=$op[$i];
|
||||
if (!array_key_exists($sect,$outputcomments) || !is_array($outputcomments[$sect]))
|
||||
$outputcomments[$sect]=array();
|
||||
array_push($outputcomments[$sect],$out);
|
||||
}
|
||||
}
|
||||
|
||||
if ($moderating){
|
||||
$scriptname=substr($_SERVER['SCRIPT_NAME'],strrpos($_SERVER['SCRIPT_NAME'],"/")+1);
|
||||
addnav("","$scriptname?op=commentdelete&return=".URLEncode($_SERVER['REQUEST_URI']));
|
||||
$mod_Del1 = htmlentities(translate_inline("Delete Checked Comments"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
|
||||
$mod_Del2 = htmlentities(translate_inline("Delete Checked & Ban (3 days)"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
|
||||
$mod_Del_confirm = addslashes(htmlentities(translate_inline("Are you sure you wish to ban this user and have you specified the exact reason for the ban, i.e. cut/pasted their offensive comments?"), ENT_COMPAT, getsetting("charset", "ISO-8859-1")));
|
||||
$mod_reason = translate_inline("Reason:");
|
||||
$mod_reason_desc = htmlentities(translate_inline("Banned for comments you posted."), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
|
||||
|
||||
output_notl("<form action='$scriptname?op=commentdelete&return=".URLEncode($_SERVER['REQUEST_URI'])."' method='POST'>",true);
|
||||
output_notl("<input type='submit' class='button' value=\"$mod_Del1\">",true);
|
||||
output_notl("<input type='submit' class='button' name='delnban' value=\"$mod_Del2\" onClick=\"return confirm('$mod_Del_confirm');\">",true);
|
||||
output_notl("`n$mod_reason <input name='reason0' size='40' value=\"$mod_reason_desc\" onChange=\"document.getElementById('reason').value=this.value;\">",true);
|
||||
}
|
||||
|
||||
|
||||
//output the comments
|
||||
ksort($outputcomments);
|
||||
reset($outputcomments);
|
||||
$sections = commentarylocs();
|
||||
$needclose = 0;
|
||||
|
||||
while (list($sec,$v)=each($outputcomments)){
|
||||
if ($sec!="x") {
|
||||
if($needclose) modulehook("}collapse");
|
||||
output_notl("`n<hr><a href='moderate.php?area=%s'>`b`^%s`0`b</a>`n",
|
||||
$sec, isset($sections[$sec]) ? $sections[$sec] : "($sec)", true);
|
||||
addnav("", "moderate.php?area=$sec");
|
||||
modulehook("collapse{",array("name"=>"com-".$sec));
|
||||
$needclose = 1;
|
||||
} else {
|
||||
modulehook("collapse{",array("name"=>"com-".$section));
|
||||
$needclose = 1;
|
||||
}
|
||||
reset($v);
|
||||
while (list($key,$val)=each($v)){
|
||||
$args = array('commentline'=>$val);
|
||||
$args = modulehook("viewcommentary", $args);
|
||||
$val = $args['commentline'];
|
||||
output_notl($val, true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($moderating && $needclose) {
|
||||
modulehook("}collapse");
|
||||
$needclose = 0;
|
||||
}
|
||||
|
||||
if ($moderating){
|
||||
output_notl("`n");
|
||||
rawoutput("<input type='submit' class='button' value=\"$mod_Del1\">");
|
||||
rawoutput("<input type='submit' class='button' name='delnban' value=\"$mod_Del2\" onClick=\"return confirm('$mod_Del_confirm');\">");
|
||||
output_notl("`n%s ", $mod_reason);
|
||||
rawoutput("<input name='reason' size='40' id='reason' value=\"$mod_reason_desc\">");
|
||||
rawoutput("</form>");
|
||||
output_notl("`n");
|
||||
}
|
||||
|
||||
if ($session['user']['loggedin']) {
|
||||
$args = modulehook("insertcomment", array("section"=>$section));
|
||||
if (array_key_exists("mute",$args) && $args['mute'] &&
|
||||
!($session['user']['superuser'] & SU_EDIT_COMMENTS)) {
|
||||
output_notl("%s", $args['mutemsg']);
|
||||
} elseif ($counttoday<($limit/2) ||
|
||||
($session['user']['superuser']&~SU_DOESNT_GIVE_GROTTO)
|
||||
|| !getsetting('postinglimit',1)){
|
||||
if ($message!="X"){
|
||||
$message="`n`@$message`n";
|
||||
output($message);
|
||||
talkform($section,$talkline,$limit,$schema);
|
||||
}
|
||||
}else{
|
||||
$message="`n`@$message`n";
|
||||
output($message);
|
||||
output("Sorry, you've exhausted your posts in this section for now.`0`n");
|
||||
}
|
||||
}
|
||||
|
||||
$jump = false;
|
||||
if (!isset($session['user']['prefs']['nojump']) || $session['user']['prefs']['nojump'] == false) {
|
||||
$jump = true;
|
||||
}
|
||||
|
||||
$firstu = translate_inline("<< First Unseen");
|
||||
$prev = translate_inline("< Previous");
|
||||
$ref = translate_inline("Refresh");
|
||||
$next = translate_inline("Next >");
|
||||
$lastu = translate_inline("Last Page >>");
|
||||
if ($rowcount>=$limit || $cid>0){
|
||||
$sql = "SELECT count(commentid) AS c FROM " . db_prefix("commentary") . " WHERE section='$section' AND postdate > '{$session['user']['recentcomments']}'";
|
||||
$r = db_query($sql);
|
||||
$val = db_fetch_assoc($r);
|
||||
$val = round($val['c'] / $limit + 0.5,0) - 1;
|
||||
if ($val>0){
|
||||
$first = comscroll_sanitize($REQUEST_URI)."&comscroll=".($val);
|
||||
$first = str_replace("?&","?",$first);
|
||||
if (!strpos($first,"?")) $first = str_replace("&","?",$first);
|
||||
$first .= "&refresh=1";
|
||||
if ($jump) {
|
||||
$first .= "#$section";
|
||||
}
|
||||
output_notl("<a href=\"$first\">$firstu</a>",true);
|
||||
addnav("",$first);
|
||||
}else{
|
||||
output_notl($firstu,true);
|
||||
}
|
||||
$req = comscroll_sanitize($REQUEST_URI)."&comscroll=".($com+1);
|
||||
$req = str_replace("?&","?",$req);
|
||||
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
|
||||
$req .= "&refresh=1";
|
||||
if ($jump) {
|
||||
$req .= "#$section";
|
||||
}
|
||||
output_notl("<a href=\"$req\">$prev</a>",true);
|
||||
addnav("",$req);
|
||||
}else{
|
||||
output_notl("$firstu $prev",true);
|
||||
}
|
||||
$last = appendlink(comscroll_sanitize($REQUEST_URI),"refresh=1");
|
||||
|
||||
// Okay.. we have some smart-ass (or stupidass, you guess) players
|
||||
// who think that the auto-reload firefox plugin is a good way to
|
||||
// avoid our timeouts. Won't they be surprised when I take that little
|
||||
// hack away.
|
||||
$last = appendcount($last);
|
||||
|
||||
$last = str_replace("?&","?",$last);
|
||||
if ($jump) {
|
||||
$last .= "#$section";
|
||||
}
|
||||
//if (!strpos($last,"?")) $last = str_replace("&","?",$last);
|
||||
//debug($last);
|
||||
output_notl(" <a href=\"$last\">$ref</a> ",true);
|
||||
addnav("",$last);
|
||||
if ($com>0 || ($cid > 0 && $newadded > $limit)){
|
||||
$req = comscroll_sanitize($REQUEST_URI)."&comscroll=".($com-1);
|
||||
$req = str_replace("?&","?",$req);
|
||||
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
|
||||
$req .= "&refresh=1";
|
||||
if ($jump) {
|
||||
$req .= "#$section";
|
||||
}
|
||||
output_notl(" <a href=\"$req\">$next</a>",true);
|
||||
addnav("",$req);
|
||||
output_notl(" <a href=\"$last\">$lastu</a>",true);
|
||||
}else{
|
||||
output_notl("$next $lastu",true);
|
||||
}
|
||||
if (!$cc) db_free_result($result);
|
||||
tlschema();
|
||||
if ($needclose) modulehook("}collapse");
|
||||
}
|
||||
|
||||
function talkform($section,$talkline,$limit=10,$schema=false){
|
||||
require_once("lib/forms.php");
|
||||
global $REQUEST_URI,$session,$translation_namespace;
|
||||
if ($schema===false) $schema=$translation_namespace;
|
||||
tlschema("commentary");
|
||||
|
||||
$jump = false;
|
||||
if (isset($session['user']['prefs']['nojump']) && $session['user']['prefs']['nojump'] == true) {
|
||||
$jump = true;
|
||||
}
|
||||
|
||||
$counttoday=0;
|
||||
if (substr($section,0,5)!="clan-"){
|
||||
$sql = "SELECT author FROM " . db_prefix("commentary") . " WHERE section='$section' AND postdate>'".date("Y-m-d 00:00:00")."' ORDER BY commentid DESC LIMIT $limit";
|
||||
$result = db_query($sql);
|
||||
while ($row=db_fetch_assoc($result)){
|
||||
if ($row['author']==$session['user']['acctid']) $counttoday++;
|
||||
}
|
||||
if (round($limit/2,0)-$counttoday <= 0 && getsetting('postinglimit',1)){
|
||||
if ($session['user']['superuser']&~SU_DOESNT_GIVE_GROTTO){
|
||||
output("`n`)(You'd be out of posts if you weren't a superuser or moderator.)`n");
|
||||
}else{
|
||||
output("`n`)(You are out of posts for the time being. Once some of your existing posts have moved out of the comment area, you'll be allowed to post again.)`n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (translate_inline($talkline,$schema)!="says")
|
||||
$tll = strlen(translate_inline($talkline,$schema))+11;
|
||||
else $tll=0;
|
||||
$req = comscroll_sanitize($REQUEST_URI)."&comment=1";
|
||||
$req = str_replace("?&","?",$req);
|
||||
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
|
||||
if ($jump) {
|
||||
$req .= "#$section";
|
||||
}
|
||||
addnav("",$req);
|
||||
output_notl("<form action=\"$req\" method='POST' autocomplete='false'>",true);
|
||||
previewfield("insertcommentary", $session['user']['name'], $talkline, true, array("size"=>"40", "maxlength"=>200-$tll));
|
||||
rawoutput("<input type='hidden' name='talkline' value='$talkline'>");
|
||||
rawoutput("<input type='hidden' name='schema' value='$schema'>");
|
||||
rawoutput("<input type='hidden' name='counter' value='{$session['counter']}'>");
|
||||
$session['commentcounter'] = $session['counter'];
|
||||
if ($section=="X"){
|
||||
$vname = getsetting("villagename", LOCATION_FIELDS);
|
||||
$iname = getsetting("innname", LOCATION_INN);
|
||||
$sections = commentarylocs();
|
||||
reset ($sections);
|
||||
output_notl("<select name='section'>",true);
|
||||
while (list($key,$val)=each($sections)){
|
||||
output_notl("<option value='$key'>$val</option>",true);
|
||||
}
|
||||
output_notl("</select>",true);
|
||||
}else{
|
||||
output_notl("<input type='hidden' name='section' value='$section'>",true);
|
||||
}
|
||||
$add = htmlentities(translate_inline("Add"), ENT_QUOTES, getsetting("charset", "ISO-8859-1"));
|
||||
output_notl("<input type='submit' class='button' value='$add'>`n",true);
|
||||
if (round($limit/2,0)-$counttoday < 3 && getsetting('postinglimit',1)){
|
||||
output("`)(You have %s posts left today)`n`0",(round($limit/2,0)-$counttoday));
|
||||
}
|
||||
rawoutput("<div id='previewtext'></div></form>");
|
||||
tlschema();
|
||||
}
|
||||
?>
|
87
lotgd-web/lotgd/lib/constants.php
Executable file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
|
||||
$defines = array();
|
||||
function myDefine($name,$value){
|
||||
global $defines;
|
||||
define($name,$value);
|
||||
$defines[$name] = $value;
|
||||
}
|
||||
|
||||
//Superuser constants
|
||||
myDefine("SU_MEGAUSER",1);
|
||||
myDefine("SU_EDIT_MOUNTS",2);
|
||||
myDefine("SU_EDIT_CREATURES",4);
|
||||
myDefine("SU_EDIT_PETITIONS",8);
|
||||
myDefine("SU_EDIT_COMMENTS",16);
|
||||
myDefine("SU_EDIT_DONATIONS",32);
|
||||
myDefine("SU_EDIT_USERS",64);
|
||||
myDefine("SU_EDIT_CONFIG",128);
|
||||
myDefine("SU_INFINITE_DAYS",256);
|
||||
myDefine("SU_EDIT_EQUIPMENT",512);
|
||||
myDefine("SU_EDIT_PAYLOG",1024);
|
||||
myDefine("SU_DEVELOPER",2048);
|
||||
myDefine("SU_POST_MOTD",4096);
|
||||
myDefine("SU_DEBUG_OUTPUT",8192);
|
||||
myDefine("SU_MODERATE_CLANS",16384);
|
||||
myDefine("SU_EDIT_RIDDLES",32768);
|
||||
myDefine("SU_MANAGE_MODULES",65536);
|
||||
myDefine("SU_AUDIT_MODERATION",131072);
|
||||
myDefine("SU_IS_TRANSLATOR",262144);
|
||||
myDefine("SU_RAW_SQL", 524288);
|
||||
myDefine("SU_VIEW_SOURCE", 1048576);
|
||||
myDefine("SU_NEVER_EXPIRE", 2097152);
|
||||
myDefine("SU_EDIT_ITEMS", 4194304);
|
||||
myDefine("SU_GIVE_GROTTO", 8388608);
|
||||
myDefine("SU_OVERRIDE_YOM_WARNING", 16777216);
|
||||
myDefine("SU_SHOW_PHPNOTICE", 33554432);
|
||||
myDefine("SU_IS_GAMEMASTER", 67108864);
|
||||
|
||||
myDefine("SU_ANYONE_CAN_SET",SU_DEBUG_OUTPUT | SU_INFINITE_DAYS | SU_OVERRIDE_YOM_WARNING | SU_SHOW_PHPNOTICE);
|
||||
myDefine("SU_DOESNT_GIVE_GROTTO",SU_DEBUG_OUTPUT | SU_INFINITE_DAYS | SU_VIEW_SOURCE|SU_NEVER_EXPIRE);
|
||||
myDefine("SU_HIDE_FROM_LEADERBOARD",SU_MEGAUSER | SU_EDIT_DONATIONS | SU_EDIT_USERS | SU_EDIT_CONFIG | SU_INFINITE_DAYS | SU_DEVELOPER | SU_RAW_SQL);
|
||||
myDefine("NO_ACCOUNT_EXPIRATION", SU_HIDE_FROM_LEADERBOARD|SU_NEVER_EXPIRE);
|
||||
//likely privs which indicate a visible admin.
|
||||
myDefine("SU_GIVES_YOM_WARNING", SU_EDIT_COMMENTS | SU_EDIT_USERS | SU_EDIT_CONFIG | SU_POST_MOTD);
|
||||
|
||||
//Clan constants
|
||||
//Changed for v1.1.0 Dragonprime Edition to extend clan possibilities
|
||||
myDefine("CLAN_APPLICANT",0);
|
||||
myDefine("CLAN_MEMBER",10);
|
||||
myDefine("CLAN_OFFICER",20);
|
||||
myDefine("CLAN_LEADER",30);
|
||||
myDefine("CLAN_FOUNDER",31);
|
||||
|
||||
//Location Constants
|
||||
myDefine("LOCATION_FIELDS","Degolburg");
|
||||
myDefine("LOCATION_INN","The Boar's Head Inn");
|
||||
|
||||
//Gender Constants
|
||||
myDefine("SEX_MALE",0);
|
||||
myDefine("SEX_FEMALE",1);
|
||||
|
||||
//Miscellaneous
|
||||
myDefine("INT_MAX",4294967295);
|
||||
|
||||
myDefine("RACE_UNKNOWN","Horrible Gelatinous Blob");
|
||||
|
||||
//Character Deletion Types
|
||||
myDefine("CHAR_DELETE_AUTO",1);
|
||||
myDefine("CHAR_DELETE_MANUAL",2);
|
||||
myDefine("CHAR_DELETE_PERMADEATH",3); //reserved for the future -- I don't have any plans this way currently, but it seemed appropriate to have it here.
|
||||
myDefine("CHAR_DELETE_SUICIDE",4);
|
||||
|
||||
// Constants used in lib/modules - for providing more information about the
|
||||
// status of the module
|
||||
myDefine("MODULE_NO_INFO",0);
|
||||
myDefine("MODULE_INSTALLED",1);
|
||||
myDefine("MODULE_VERSION_OK",2);
|
||||
myDefine("MODULE_NOT_INSTALLED",4);
|
||||
myDefine("MODULE_FILE_NOT_PRESENT",8);
|
||||
myDefine("MODULE_VERSION_TOO_LOW",16);
|
||||
myDefine("MODULE_ACTIVE",32);
|
||||
myDefine("MODULE_INJECTED",64);
|
||||
|
||||
?>
|
158
lotgd-web/lotgd/lib/creatures.php
Executable file
@ -0,0 +1,158 @@
|
||||
<?php
|
||||
function creature_stats($level){
|
||||
$stats = array();
|
||||
$stats['creaturelevel'] = $level;
|
||||
$stats['creaturehealth'] = creature_health($level);
|
||||
$stats['creatureattack'] = creature_attack($level);
|
||||
$stats['creaturedefense'] = creature_defense($level);
|
||||
$stats['creatureexp'] = creature_exp($level);
|
||||
$stats['creaturegold'] = creature_gold($level);
|
||||
return $stats;
|
||||
}
|
||||
|
||||
function creature_health($level){
|
||||
switch ($level) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
$health = $level * 11 - 1;
|
||||
break;
|
||||
case 5:
|
||||
$health = 53;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
$health = $level * 10 + 4;
|
||||
break;
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
$health = $level * 10 + 5;
|
||||
break;
|
||||
case 16:
|
||||
$health = 166;
|
||||
break;
|
||||
case 17:
|
||||
$health = 178;
|
||||
break;
|
||||
case 18:
|
||||
$health = 190;
|
||||
break;
|
||||
}
|
||||
return $health;
|
||||
}
|
||||
|
||||
function creature_attack($level){
|
||||
$attack = 1;
|
||||
for($i=1;$i<$level;++$i){
|
||||
$attack+=2;
|
||||
}
|
||||
return $attack;
|
||||
}
|
||||
|
||||
function creature_defense($level){
|
||||
$defense = 0;
|
||||
switch ($level){
|
||||
// Always fall through
|
||||
case 18:
|
||||
++$defense;
|
||||
case 17:
|
||||
$defense+=2;
|
||||
case 16:
|
||||
++$defense;
|
||||
case 15:
|
||||
++$defense;
|
||||
case 14:
|
||||
$defense+=2;
|
||||
case 13:
|
||||
++$defense;
|
||||
case 12:
|
||||
$defense+=2;
|
||||
case 11:
|
||||
++$defense;
|
||||
case 10:
|
||||
++$defense;
|
||||
case 9:
|
||||
$defense+=2;
|
||||
case 8:
|
||||
++$defense;
|
||||
case 7:
|
||||
$defense+=2;
|
||||
case 6:
|
||||
++$defense;
|
||||
case 5:
|
||||
++$defense;
|
||||
case 4:
|
||||
$defense += 2;
|
||||
case 3:
|
||||
++$defense;
|
||||
case 2:
|
||||
$defense += 2;
|
||||
case 1:
|
||||
++$defense;
|
||||
}
|
||||
return $defense;
|
||||
}
|
||||
|
||||
function creature_exp($level){
|
||||
switch($level){
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
$exp = $level * 10 + 4;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
$exp = $level * 10 + 5;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
$exp = $level * 11;
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
$exp = $level * 12 - 7;
|
||||
break;
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
$exp = round(13.5*$level-21.17);
|
||||
break;
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
$exp = round(0.5*$level*$level+2.5*$level+39);
|
||||
break;
|
||||
default:
|
||||
$exp = 0;
|
||||
break;
|
||||
}
|
||||
return $exp;
|
||||
}
|
||||
|
||||
function creature_gold($level){
|
||||
switch($level){
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
$gold = round(-4.5*$level*$level*$level+22*$level*$level+26.5*$level-8);
|
||||
break;
|
||||
case 17:
|
||||
case 18:
|
||||
$gold = 0;
|
||||
break;
|
||||
default:
|
||||
$gold = round(-0.1673326*$level*$level+36.590909*$level+19.904594);
|
||||
break;
|
||||
}
|
||||
return $gold;
|
||||
}
|
||||
?>
|
138
lotgd-web/lotgd/lib/datacache.php
Executable file
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
// translator ready
|
||||
// addnews ready
|
||||
// mail ready
|
||||
//This is a data caching library intended to lighten the load on lotgd.net
|
||||
//use of this library is not recommended for most installations as it raises
|
||||
//the issue of some race conditions which are mitigated on high volume
|
||||
//sites but which could cause odd behavior on low volume sites, with out
|
||||
//offering much if any advantage.
|
||||
|
||||
//basically the idea behind this library is to provide a non-blocking
|
||||
//storage mechanism for non-critical data.
|
||||
|
||||
$datacache = array();
|
||||
$datacachefilepath = "";
|
||||
$checkedforolddatacaches = false;
|
||||
define("DATACACHE_FILENAME_PREFIX","datacache_");
|
||||
|
||||
function datacache($name,$duration=60){
|
||||
global $datacache;
|
||||
if (getsetting("usedatacache",0)){
|
||||
if (isset($datacache[$name])){
|
||||
// we've already loaded this data cache this page hit and we
|
||||
// can simply return it.
|
||||
return $datacache[$name];
|
||||
}else{
|
||||
//we haven't loaded this data cache this page hit.
|
||||
$fullname = makecachetempname($name);
|
||||
if (file_exists($fullname) &&
|
||||
filemtime($fullname) > strtotime("-$duration seconds")){
|
||||
//the cache file *does* exist, and is not overly old.
|
||||
$fullfile = @file_get_contents($fullname);
|
||||
if ($fullfile > ""){
|
||||
$datacache[$name] = @unserialize($fullfile);
|
||||
return $datacache[$name];
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// The field didn't exist, or it was too old.
|
||||
return false;
|
||||
}
|
||||
|
||||
//do NOT send simply a false value in to array or it will bork datacache in to
|
||||
//thinking that no data is cached or we are outside of the cache period.
|
||||
function updatedatacache($name,$data){
|
||||
global $datacache;
|
||||
if (getsetting("usedatacache",0)){
|
||||
$fullname = makecachetempname($name);
|
||||
$datacache[$name] = $data; //serialize($array);
|
||||
$fp = fopen($fullname,"w");
|
||||
if ($fp){
|
||||
if (!fwrite($fp,serialize($data))){
|
||||
}else{
|
||||
}
|
||||
fclose($fp);
|
||||
}else{
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//debug($datacache);
|
||||
return false;
|
||||
}
|
||||
|
||||
//we want to be able to invalidate data caches when we know we've done
|
||||
//something which would change the data.
|
||||
function invalidatedatacache($name,$full=false){
|
||||
global $datacache;
|
||||
if (getsetting("usedatacache",0)){
|
||||
if(!$full) $fullname = makecachetempname($name);
|
||||
else $fullname = $name;
|
||||
if (file_exists($fullname)) @unlink($fullname);
|
||||
unset($datacache[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Invalidates *all* caches, which contain $name at the beginning of their filename.
|
||||
function massinvalidate($name) {
|
||||
if (getsetting("usedatacache",0)){
|
||||
$name = DATACACHE_FILENAME_PREFIX.$name;
|
||||
global $datacachefilepath;
|
||||
if ($datacachefilepath=="")
|
||||
$datacachefilepath = getsetting("datacachepath","/tmp");
|
||||
$dir = @dir($datacachefilepath);
|
||||
if(is_object($dir)) {
|
||||
while(false !== ($file = $dir->read())) {
|
||||
if (strpos($file, $name) !== false) {
|
||||
invalidatedatacache($dir->path."/".$file,true);
|
||||
}
|
||||
}
|
||||
$dir->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function makecachetempname($name){
|
||||
//one place to sanitize names for data caches.
|
||||
global $datacache, $datacachefilepath,$checkedforolddatacaches;
|
||||
if ($datacachefilepath=="")
|
||||
$datacachefilepath = getsetting("datacachepath","/tmp");
|
||||
//let's make sure that someone can't trick us in to
|
||||
$name = DATACACHE_FILENAME_PREFIX.preg_replace("'[^A-Za-z0-9.-]'","",$name);
|
||||
$fullname = $datacachefilepath."/".$name;
|
||||
//clean out double slashes (this also blocks file wrappers woot)
|
||||
$fullname = preg_replace("'//'","/",$fullname);
|
||||
$fullname = preg_replace("'\\\\'","\\",$fullname);
|
||||
|
||||
|
||||
if ($checkedforolddatacaches==false){
|
||||
$checkedforolddatacaches=true;
|
||||
// we want this to be 1 in 100 chance per page hit, not per data
|
||||
// cache call.
|
||||
// Once a hundred page hits, we want to clean out old caches.
|
||||
// if (mt_rand(1,100)<2){
|
||||
// $handle = opendir($datacachefilepath);
|
||||
// while (($file = readdir($handle)) !== false) {
|
||||
// if (substr($file,0,strlen(DATACACHE_FILENAME_PREFIX)) ==
|
||||
// DATACACHE_FILENAME_PREFIX){
|
||||
// $fn = $datacachefilepath."/".$file;
|
||||
// $fn = preg_replace("'//'","/",$fn);
|
||||
// $fn = preg_replace("'\\\\'","\\",$fn);
|
||||
// if (is_file($fn) &&
|
||||
// filemtime($fn) < strtotime("-24 hours")){
|
||||
// unlink($fn);
|
||||
// }else{
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
return $fullname;
|
||||
}
|
||||
|
||||
?>
|
166
lotgd-web/lotgd/lib/datetime.php
Executable file
@ -0,0 +1,166 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
function reltime($date,$short=true){
|
||||
$now = strtotime("now");
|
||||
$x = abs($now - $date);
|
||||
$d = (int)($x/86400);
|
||||
$x = $x % 86400;
|
||||
$h = (int)($x/3600);
|
||||
$x = $x % 3600;
|
||||
$m = (int)($x/60);
|
||||
$x = $x % 60;
|
||||
$s = (int)($x);
|
||||
if ($short){
|
||||
$array=array("d"=>"d","h"=>"h","m"=>"m","s"=>"s");
|
||||
$array=translate_inline($array,"datetime");
|
||||
if ($d > 0)
|
||||
$o = $d.$array['d'].($h>0?$h.$array['h']:"");
|
||||
elseif ($h > 0)
|
||||
$o = $h.$array['h'].($m>0?$m.$array['m']:"");
|
||||
elseif ($m > 0)
|
||||
$o = $m.$array['m'].($s>0?$s.$array['s']:"");
|
||||
else
|
||||
$o = $s.$array['s'];
|
||||
|
||||
/* if ($d > 0)
|
||||
$o = sprintf("%3s%2s",$d.$array['d'],($h>0?$h.$array['h']:""));
|
||||
elseif ($h > 0)
|
||||
$o = sprintf("%3s%2s",$h.$array['h'],($m>0?$m.$array['m']:""));
|
||||
elseif ($m > 0)
|
||||
$o = sprintf("%3s%2s",$m.$array['m'],($s>0?$s.$array['s']:""));
|
||||
else
|
||||
$o = sprintf("%5s", $s.$array['s']);
|
||||
$o = str_replace(" ", " ", $o);*/
|
||||
}else{
|
||||
$array=array("day"=>"day","days"=>"days","hour"=>"hour","hours"=>"hours","minute"=>"minute","minutes"=>"minutes","second"=>"second","seconds"=>"second");
|
||||
$array=translate_inline($array,"datetime"); //translate it... tl-ready now
|
||||
if ($d > 0)
|
||||
$o = "$d ".($d>1?$array['days']:$array['day']).($h>0?", $h ".($h>1?$array['hours']:$array['hour']):"");
|
||||
elseif ($h > 0)
|
||||
$o = "$h ".($h>1?$array['hours']:$array['hour']).($m>0?", $m ".($m>1?$array['minutes']:$array['minute']):"");
|
||||
elseif ($m > 0)
|
||||
$o = "$m ".($m>1?$array['minutes']:$array['minute']).($s>0?", $s ".($s>1?$array['seconds']:$array['second']):"");
|
||||
else
|
||||
$o = "$s ".($s>0?$array['seconds']:$array['second']);
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
||||
function relativedate($indate){
|
||||
$laston = round((strtotime("now")-strtotime($indate)) / 86400,0) . " days";
|
||||
tlschema("datetime");
|
||||
if (substr($laston,0,2)=="1 ")
|
||||
$laston=translate_inline("1 day");
|
||||
elseif (date("Y-m-d",strtotime($laston)) == date("Y-m-d"))
|
||||
$laston=translate_inline("Today");
|
||||
elseif (date("Y-m-d",strtotime($laston)) == date("Y-m-d",strtotime("-1 day")))
|
||||
$laston=translate_inline("Yesterday");
|
||||
elseif (strpos($indate,"0000-00-00")!==false)
|
||||
$laston = translate_inline("Never");
|
||||
else {
|
||||
$laston= sprintf_translate("%s days", round((strtotime("now")-strtotime($indate)) / 86400,0));
|
||||
rawoutput(tlbutton_clear());
|
||||
}
|
||||
tlschema();
|
||||
return $laston;
|
||||
}
|
||||
|
||||
function checkday() {
|
||||
global $session,$revertsession,$REQUEST_URI;
|
||||
if ($session['user']['loggedin']){
|
||||
output_notl("<!--CheckNewDay()-->",true);
|
||||
if(is_new_day()){
|
||||
$post = $_POST;
|
||||
unset($post['i_am_a_hack']);
|
||||
if (count($post) > 0){
|
||||
$session['user']['lasthit'] = "0000-00-00 00:00:00";
|
||||
return;
|
||||
} else {
|
||||
$session=$revertsession;
|
||||
$session['user']['restorepage']=$REQUEST_URI;
|
||||
$session['allowednavs']=array();
|
||||
addnav("","newday.php");
|
||||
redirect("newday.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function is_new_day($now=0){
|
||||
global $session;
|
||||
|
||||
if ($session['user']['lasthit'] == "0000-00-00 00:00:00") {
|
||||
return true;
|
||||
}
|
||||
$t1 = gametime();
|
||||
$t2 = convertgametime(strtotime($session['user']['lasthit']." +0000"));
|
||||
$d1 = gmdate("Y-m-d",$t1);
|
||||
$d2 = gmdate("Y-m-d",$t2);
|
||||
|
||||
if ($d1!=$d2){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getgametime(){
|
||||
return gmdate("g:i a",gametime());
|
||||
}
|
||||
|
||||
function gametime(){
|
||||
$time = convertgametime(strtotime("now"));
|
||||
return $time;
|
||||
}
|
||||
|
||||
function convertgametime($intime,$debug=false){
|
||||
|
||||
//adjust the requested time by the game offset
|
||||
$intime -= getsetting("gameoffsetseconds",0);
|
||||
|
||||
// we know that strtotime gives us an identical timestamp for
|
||||
// everywhere in the world at the same time, if it is provided with
|
||||
// the GMT offset:
|
||||
$epoch = strtotime(getsetting("game_epoch",gmdate("Y-m-d 00:00:00 O",strtotime("-30 days"))));
|
||||
$now = strtotime(gmdate("Y-m-d H:i:s O",$intime));
|
||||
$logd_timestamp = ($now - $epoch) * getsetting("daysperday",4);
|
||||
if ($debug){
|
||||
echo "Game Timestamp: ".$logd_timestamp.", which makes it ".gmdate("Y-m-d H:i:s",$logd_timestamp)."<br>";
|
||||
}
|
||||
return $logd_timestamp;
|
||||
}
|
||||
|
||||
function gametimedetails(){
|
||||
$ret = array();
|
||||
$ret['now'] = date("Y-m-d 00:00:00");
|
||||
$ret['gametime'] = gametime();
|
||||
$ret['daysperday'] = getsetting("daysperday", 4);
|
||||
$ret['secsperday'] = 86400/$ret['daysperday'];
|
||||
$ret['today'] = strtotime(gmdate("Y-m-d 00:00:00 O", $ret['gametime']));
|
||||
$ret['tomorrow'] =
|
||||
strtotime(gmdate("Y-m-d H:i:s O",$ret['gametime'])." + 1 day");
|
||||
$ret['tomorrow'] = strtotime(gmdate("Y-m-d 00:00:00 O",$ret['tomorrow']));
|
||||
// Why isn't this
|
||||
// $ret['tomorrow'] =
|
||||
// strtotime(gmdate("Y-m-d 00:00:00 O",$ret['gametime'])." + 1 day");
|
||||
$ret['secssofartoday'] = $ret['gametime'] - $ret['today'];
|
||||
$ret['secstotomorrow'] = $ret['tomorrow']-$ret['gametime'];
|
||||
$ret['realsecssofartoday'] = $ret['secssofartoday'] / $ret['daysperday'];
|
||||
$ret['realsecstotomorrow'] = $ret['secstotomorrow'] / $ret['daysperday'];
|
||||
$ret['dayduration'] = ($ret['tomorrow']-$ret['today'])/$ret['daysperday'];
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function secondstonextgameday($details=false) {
|
||||
if ($details===false) $details = gametimedetails();
|
||||
return strtotime("{$details['now']} + {$details['realsecstotomorrow']} seconds");
|
||||
}
|
||||
|
||||
function getmicrotime(){
|
||||
list($usec, $sec) = explode(" ",microtime());
|
||||
return ((float)$usec + (float)$sec);
|
||||
}
|
||||
|
||||
|
||||
?>
|
33
lotgd-web/lotgd/lib/dbwrapper.php
Executable file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
require_once("lib/errorhandling.php");
|
||||
require_once("lib/datacache.php");
|
||||
|
||||
/* * * *
|
||||
* Avaiable values for DBTYPE:
|
||||
*
|
||||
* - mysql: The default value. Are you unsure take this.
|
||||
* - mysqli_oos: The MySQLi extension of PHP5, object oriented style
|
||||
* - mysqli_proc: The MySQLi extension of PHP5, procedural style
|
||||
*
|
||||
*/
|
||||
define('DBTYPE',"mysql");
|
||||
|
||||
$dbinfo = array();
|
||||
$dbinfo['queriesthishit']=0;
|
||||
|
||||
switch(DBTYPE) {
|
||||
case 'mysql':
|
||||
require('lib/dbwrapper_mysql.php');
|
||||
break;
|
||||
case 'mysqli_oos':
|
||||
require('lib/dbwrapper_mysqli_oos.php');
|
||||
break;
|
||||
case 'mysqli_proc':
|
||||
require('lib/dbwrapper_mysqli_proc.php');
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
197
lotgd-web/lotgd/lib/dbwrapper_mysql.php
Executable file
@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
function db_query($sql, $die=true){
|
||||
if (defined("DB_NODB") && !defined("LINK")) return array();
|
||||
global $session,$dbinfo;
|
||||
$dbinfo['queriesthishit']++;
|
||||
$fname = DBTYPE."_query";
|
||||
$starttime = getmicrotime();
|
||||
$r = $fname($sql, LINK);
|
||||
|
||||
if (!$r && $die === true) {
|
||||
if (defined("IS_INSTALLER")){
|
||||
return array();
|
||||
}else{
|
||||
if ($session['user']['superuser'] & SU_DEVELOPER || 1){
|
||||
require_once("lib/show_backtrace.php");
|
||||
die(
|
||||
"<pre>".HTMLEntities($sql, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</pre>"
|
||||
.db_error(LINK)
|
||||
.show_backtrace()
|
||||
);
|
||||
}else{
|
||||
die("A most bogus error has occurred. I apologise, but the page you were trying to access is broken. Please use your browser's back button and try again.");
|
||||
}
|
||||
}
|
||||
}
|
||||
$endtime = getmicrotime();
|
||||
if ($endtime - $starttime >= 1.00 && ($session['user']['superuser'] & SU_DEBUG_OUTPUT)){
|
||||
$s = trim($sql);
|
||||
if (strlen($s) > 800) $s = substr($s,0,400)." ... ".substr($s,strlen($s)-400);
|
||||
debug("Slow Query (".round($endtime-$starttime,2)."s): ".(HTMLEntities($s, ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`n");
|
||||
}
|
||||
unset($dbinfo['affected_rows']);
|
||||
$dbinfo['affected_rows']=db_affected_rows();
|
||||
$dbinfo['querytime'] += $endtime-$starttime;
|
||||
return $r;
|
||||
}
|
||||
|
||||
//& at the start returns a reference to the data array.
|
||||
//since it's possible this array is large, we'll save ourselves
|
||||
//the overhead of duplicating the array, then destroying the old
|
||||
//one by returning a reference instead.
|
||||
function &db_query_cached($sql,$name,$duration=900){
|
||||
//this function takes advantage of the data caching library to make
|
||||
//all of the other db_functions act just like MySQL queries but rely
|
||||
//instead on disk cached data.
|
||||
//if (getsetting("usedatacache", 0) == 1) debug("DataCache: $name");
|
||||
//standard is 15 minutes, als hooks don't need to be cached *that* often, normally you invalidate the cache properly
|
||||
global $dbinfo;
|
||||
$data = datacache($name,$duration);
|
||||
if (is_array($data)){
|
||||
reset($data);
|
||||
$dbinfo['affected_rows']=-1;
|
||||
return $data;
|
||||
}else{
|
||||
$result = db_query($sql);
|
||||
$data = array();
|
||||
while ($row = db_fetch_assoc($result)) {
|
||||
$data[] = $row;
|
||||
}
|
||||
updatedatacache($name,$data);
|
||||
reset($data);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists("lib/dbremote.php")) {
|
||||
require_once("lib/dbremote.php");
|
||||
}
|
||||
|
||||
function db_error($link=false){
|
||||
$fname = DBTYPE."_error";
|
||||
if ($link!==false)
|
||||
$r = @$fname($link);
|
||||
else
|
||||
$r = @$fname();
|
||||
if ($r=="" && defined("DB_NODB") && !defined("DB_INSTALLER_STAGE4")) return "The database connection was never established";
|
||||
return $r;
|
||||
}
|
||||
|
||||
function db_fetch_assoc(&$result){
|
||||
if (is_array($result)){
|
||||
//cached data
|
||||
if (list($key,$val)=each($result))
|
||||
return $val;
|
||||
else
|
||||
return false;
|
||||
}else{
|
||||
$fname = DBTYPE."_fetch_assoc";
|
||||
$r = $fname($result);
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
|
||||
function db_insert_id(){
|
||||
if (defined("DB_NODB") && !defined("LINK")) return -1;
|
||||
$fname = DBTYPE."_insert_id";
|
||||
$r = $fname(LINK);
|
||||
return $r;
|
||||
}
|
||||
|
||||
function db_num_rows($result){
|
||||
if (is_array($result)){
|
||||
return count($result);
|
||||
}else{
|
||||
if (defined("DB_NODB") && !defined("LINK")) return 0;
|
||||
$fname = DBTYPE."_num_rows";
|
||||
$r = @$fname($result); //Whyfor turn off error reporting here?
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
|
||||
function db_affected_rows($link=false){
|
||||
global $dbinfo;
|
||||
if (isset($dbinfo['affected_rows'])) {
|
||||
return $dbinfo['affected_rows'];
|
||||
}
|
||||
if (defined("DB_NODB") && !defined("LINK")) return 0;
|
||||
$fname = DBTYPE."_affected_rows";
|
||||
if ($link===false) {
|
||||
$r = $fname(LINK);
|
||||
}else{
|
||||
$r = $fname($link);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function db_pconnect($host,$user,$pass){
|
||||
$fname = DBTYPE."_pconnect";
|
||||
$r = $fname($host,$user,$pass);
|
||||
return $r;
|
||||
}
|
||||
|
||||
function db_connect($host,$user,$pass){
|
||||
$fname = DBTYPE."_connect";
|
||||
$r = $fname($host,$user,$pass);
|
||||
return $r;
|
||||
}
|
||||
|
||||
function db_get_server_version()
|
||||
{
|
||||
$fname = DBTYPE."_get_server_info";
|
||||
if (defined("LINK")) $r = $fname(LINK);
|
||||
else $r = $fname();
|
||||
return $r;
|
||||
}
|
||||
|
||||
function db_select_db($dbname){
|
||||
$fname = DBTYPE."_select_db";
|
||||
if(!defined("LINK")) $r = $fname($dbname);
|
||||
else $r = $fname($dbname, LINK);
|
||||
return $r;
|
||||
}
|
||||
function db_free_result($result){
|
||||
if (is_array($result)){
|
||||
//cached data
|
||||
unset($result);
|
||||
}else{
|
||||
if (defined("DB_NODB") && !defined("LINK")) return false;
|
||||
$fname = DBTYPE."_free_result";
|
||||
$r = $fname($result);
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
|
||||
function db_table_exists($tablename){
|
||||
if (defined("DB_NODB") && !defined("LINK")) return false;
|
||||
$fname = DBTYPE."_query";
|
||||
$exists = $fname("SELECT 1 FROM `$tablename` LIMIT 0");
|
||||
if ($exists) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function db_prefix($tablename, $force=false) {
|
||||
global $DB_PREFIX;
|
||||
|
||||
if ($force === false) {
|
||||
$special_prefixes = array();
|
||||
|
||||
// The following file should be used to override or modify the
|
||||
// special_prefixes array to be correct for your site. Do NOT
|
||||
// do this unles you know EXACTLY what this means to you, your
|
||||
// game, your county, your state, your nation, your planet and
|
||||
// your universe!
|
||||
if (file_exists("prefixes.php")) require_once("prefixes.php");
|
||||
|
||||
$prefix = $DB_PREFIX;
|
||||
if (isset($special_prefixes[$tablename])) {
|
||||
$prefix = $special_prefixes[$tablename];
|
||||
}
|
||||
} else {
|
||||
$prefix = $force;
|
||||
}
|
||||
return $prefix . $tablename;
|
||||
}
|
||||
|
||||
?>
|
210
lotgd-web/lotgd/lib/dbwrapper_mysqli_oos.php
Executable file
@ -0,0 +1,210 @@
|
||||
<?php
|
||||
// addnews ready
|
||||
// translator ready
|
||||
// mail ready
|
||||
|
||||
function db_query($sql, $die=true){
|
||||
if (defined("DB_NODB") && !defined("LINK")) return array();
|
||||
global $session,$dbinfo,$mysqli_resource;
|
||||
$dbinfo['queriesthishit']++;
|
||||
// $fname = DBTYPE."_query";
|
||||
$starttime = getmicrotime();
|
||||
//$r = $fname($sql);
|
||||
$r = $mysqli_resource->Query($sql);
|
||||
|
||||
if (!$r && $die === true) {
|
||||
if (defined("IS_INSTALLER")){
|
||||
return array();
|
||||
}else{
|
||||
if ($session['user']['superuser'] & SU_DEVELOPER || 1){
|
||||
require_once("lib/show_backtrace.php");
|
||||
die(
|
||||
"<pre>".HTMLEntities($sql, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</pre>"
|
||||
.db_error(LINK)
|
||||
.show_backtrace()
|
||||
);
|
||||
}else{
|
||||
die("A most bogus error has occurred. I apologise, but the page you were trying to access is broken. Please use your browser's back button and try again.");
|
||||
}
|
||||
}
|
||||
}
|
||||
$endtime = getmicrotime();
|
||||
if ($endtime - $starttime >= 1.00 && ($session['user']['superuser'] & SU_DEBUG_OUTPUT)){
|
||||
$s = trim($sql);
|
||||
if (strlen($s) > 800) $s = substr($s,0,400)." ... ".substr($s,strlen($s)-400);
|
||||
debug("Slow Query (".round($endtime-$starttime,2)."s): ".(HTMLEntities($s, ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`n");
|
||||
}
|
||||
unset($dbinfo['affected_rows']);
|
||||
$dbinfo['affected_rows']=db_affected_rows();
|
||||
$dbinfo['querytime'] += $endtime-$starttime;
|
||||
return $r;
|
||||
}
|
||||
|
||||
//& at the start returns a reference to the data array.
|
||||
//since it's possible this array is large, we'll save ourselves
|
||||
//the overhead of duplicating the array, then destroying the old
|
||||
//one by returning a reference instead.
|
||||
function &db_query_cached($sql,$name,$duration=900){
|
||||
//this function takes advantage of the data caching library to make
|
||||
//all of the other db_functions act just like MySQL queries but rely
|
||||
//instead on disk cached data.
|
||||
//if (getsetting("usedatacache", 0) == 1) debug("DataCache: $name");
|
||||
//standard is 15 minutes, als hooks don't need to be cached *that* often, normally you invalidate the cache properly
|
||||
global $dbinfo;
|
||||
$data = datacache($name,$duration);
|
||||
if (is_array($data)){
|
||||
reset($data);
|
||||
$dbinfo['affected_rows']=-1;
|
||||
return $data;
|
||||
}else{
|
||||
$result = db_query($sql);
|
||||
$data = array();
|
||||
while ($row = db_fetch_assoc($result)) {
|
||||
$data[] = $row;
|
||||
}
|
||||
updatedatacache($name,$data);
|
||||
reset($data);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists("lib/dbremote.php")) {
|
||||
require_once("lib/dbremote.php");
|
||||
}
|
||||
|
||||
function db_error(){
|
||||
global $mysqli_resource;
|
||||
$r = $mysqli_resource->error;
|
||||
if ($r=="" && defined("DB_NODB") && !defined("DB_INSTALLER_STAGE4")) return "The database connection was never established";
|
||||
return $r;
|
||||
}
|
||||
|
||||
function db_fetch_assoc(&$result){
|
||||
if (is_array($result)){
|
||||
//cached data
|
||||
if (list($key,$val)=each($result))
|
||||
return $val;
|
||||
else
|
||||
return false;
|
||||
}else{
|
||||
//$fname = DBTYPE."_fetch_assoc";
|
||||
//$r = $fname($result);
|
||||
$r = $result->Fetch_Assoc();
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
|
||||
function db_insert_id(){
|
||||
global $mysqli_resource;
|
||||
if (defined("DB_NODB") && !defined("LINK")) return -1;
|
||||
//$fname = DBTYPE."_insert_id";
|
||||
//$r = $fname();
|
||||
$r = $mysqli_resource->insert_id;
|
||||
return $r;
|
||||
}
|
||||
|
||||
function db_num_rows($result){
|
||||
if (is_array($result)){
|
||||
return count($result);
|
||||
}else{
|
||||
if (defined("DB_NODB") && !defined("LINK")) return 0;
|
||||
|
||||
$r = $result->num_rows;
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
|
||||
function db_affected_rows($link=false){
|
||||
global $dbinfo, $mysqli_resource;
|
||||
if (isset($dbinfo['affected_rows'])) {
|
||||
return $dbinfo['affected_rows'];
|
||||
}
|
||||
if (defined("DB_NODB") && !defined("LINK")) return 0;
|
||||
|
||||
$r = $mysqli_resource->affected_rows;
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
function db_pconnect($host,$user,$pass){
|
||||
global $mysqli_resource;
|
||||
|
||||
// Constants cannot be an object
|
||||
// MySQLi do not know a pconnect
|
||||
$mysqli_resource = New MySQLi($host, $user, $pass);
|
||||
|
||||
if($mysqli_resource) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function db_connect($host,$user,$pass){
|
||||
global $mysqli_resource;
|
||||
|
||||
// Constants cannot be an object
|
||||
$mysqli_resource = New MySQLi($host, $user, $pass);
|
||||
|
||||
if($mysqli_resource) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function db_get_server_version() {
|
||||
global $mysqli_resource;
|
||||
return $mysqli_resource->server_info;
|
||||
}
|
||||
|
||||
function db_select_db($dbname){
|
||||
global $mysqli_resource;
|
||||
$r = $mysqli_resource->select_db($dbname);
|
||||
return $r;
|
||||
}
|
||||
|
||||
function db_free_result($result){
|
||||
if (is_array($result)){
|
||||
//cached data
|
||||
unset($result);
|
||||
}else{
|
||||
if (defined("DB_NODB") && !defined("LINK")) return false;
|
||||
$result->Free();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function db_table_exists($tablename){
|
||||
global $mysqli_resource;
|
||||
if (defined("DB_NODB") && !defined("LINK")) return false;
|
||||
$exists = $mysqli_resource->Query("SELECT 1 FROM `$tablename` LIMIT 0");
|
||||
if ($exists) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function db_prefix($tablename, $force=false) {
|
||||
global $DB_PREFIX;
|
||||
|
||||
if ($force === false) {
|
||||
$special_prefixes = array();
|
||||
|
||||
// The following file should be used to override or modify the
|
||||
// special_prefixes array to be correct for your site. Do NOT
|
||||
// do this unles you know EXACTLY what this means to you, your
|
||||
// game, your county, your state, your nation, your planet and
|
||||
// your universe!
|
||||
if (file_exists("prefixes.php")) require_once("prefixes.php");
|
||||
|
||||
$prefix = $DB_PREFIX;
|
||||
if (isset($special_prefixes[$tablename])) {
|
||||
$prefix = $special_prefixes[$tablename];
|
||||
}
|
||||
} else {
|
||||
$prefix = $force;
|
||||
}
|
||||
return $prefix . $tablename;
|
||||
}
|
||||
?>
|