Naruto Revolution
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Naruto Revolution

The community forum for NarutoRevolution
 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

 

 New Race module

Go down 
AuthorMessage
Ryan
Admin
Ryan


Posts : 12
Join date : 2010-12-06

New Race module Empty
PostSubject: New Race module   New Race module EmptyWed Dec 15, 2010 1:43 pm

function racevik_getmoduleinfo(){
$info = array(
"name"=>"Race – Leaf Ninja",
"version"=>"1.0",
"author"=>"`^Ryan Gallante",
"category"=>"Races",
"settings"=>array(
"Leaf Ninja Race Settings,title",
"minedeathchance"=>"Percent chance for Leaf Ninja to die in the mine,range,0,10,1|40",
"gemchance"=>"Percent chance for Leaf Ninja to find a gem on battle victory,range,25,100,1|5",
"gemmessage"=>"Message to display when finding a gem|`&The leaf ninja spies a a `%gem`&!",
"goldloss"=>"How much less gold (in percent) do the Leaf Ninja find?,range,0,10,1|15",
"mindk"=>"How many DKs do you need before the race is available?,int|0",
),
);
return $info;
}

function racevik_install(){

module_addhook("chooserace");
module_addhook("setrace");
module_addhook("newday");
module_addhook("charstats");
module_addhook("raceminedeath");
module_addhook("battle-victory");
module_addhook("creatureencounter");
module_addhook("pvpadjust");
module_addhook("racenames");
return true;
}

function racevik_uninstall(){
global $session;
$sql = "UPDATE " . db_prefix("accounts") . " SET race='" . RACE_UNKNOWN . "' WHERE race='Leaf Ninja'";
db_query($sql);
if ($session['user']['race'] == 'Leaf Ninja')
$session['user']['race'] = RACE_UNKNOWN;
return true;
}

function racevik_dohook($hookname,$args){
global $session,$resline;

if (is_module_active("racehuman")) {
$city = get_module_setting("villagename", "racehuman");
} else {
$city = getsetting("villagename", LOCATION_FIELDS);
}
$race = "Leaf ninja";
switch($hookname){
case "racenames":
$args[$race] = $race;
break;
case "pvpadjust":
if ($args['race'] == $race) {
$args['creaturedefense']+=(2+floor($args['creaturelevel']/5));
$args['creaturehealth']-= round($args['creaturehealth']*.03, 0);
}
break;
case "raceminedeath":
if ($session['user']['race'] == $race) {
$args['chance'] = get_module_setting("minedeathchance");
$args['racesave'] = "Fortunately your Will of fire once again lets you escape.`n";
$args['schema']="module-racevik";
}
break;
case "charstats":
if ($session['user']['race']==$race){
addcharstat("Vital Info");
addcharstat("Race", translate_inline($race));
}
break;
case "chooserace":
if ($session['user']['dragonkills'] < get_module_setting("mindk"))
break;
output("<a href='newday.php?setrace=Viking$resline'>From the shores of %s</a>, the city of men, your race of `@Leaf Ninja`0, from the north land of Konohagakure, who traveled far to reach this land. Your great strength and stature allows you to stand taller, stronger and be larger, something other races can only dream of.`n`n",$city, true);
addnav("`5Viking`0","newday.php?setrace=$race$resline");
addnav("","newday.php?setrace=$race$resline");
break;
case "setrace":
if ($session['user']['race']==$race){
output("`&As a leaf ninja, you attack quickly and without hesitation with your Kunai.`n");
output("You gain extra defense!`n");
output("Your keen eye for gems unusual for your race, but your childhood serving in your parents shops taught you to spot gems quickly.`n");
output("You gain extra gems from forest fights, but you also gain less gold!");
if (is_module_active("cities")) {
if ($session['user']['dragonkills']==0 &&
$session['user']['age']==0){
set_module_setting("newest-$city",
$session['user']['acctid'],"cities");
}
set_module_pref("homecity",$city,"cities");
if ($session['user']['age'] == 0)
$session['user']['location']=$city;
}
}
break;
case "battle-victory":
if ($session['user']['race'] != $race) break;
if ($args['type'] != "forest") break;
if ($session['user']['level'] <=15 &&
e_rand(1,100) <= get_module_setting("gemchance")) {
output(get_module_setting("gemmessage")."`n`0");
$session['user']['gems']+=2;
debuglog("found a gem when slaying a monster, for being a Leaf ninja.");
}
break;

case "creatureencounter":
if ($session['user']['race']==$race){
racevik_checkcity();
$loss = (100 - get_module_setting("goldloss"))/100;
$args['creaturegold']=round($args['creaturegold']*$loss,0);
}
break;
case "newday":
if ($session['user']['race']==$race){
racevik_checkcity();
apply_buff("racialbenefit",array(
"name"=>"`5Will of Fire`0",
"defmod"=>"(<defense>?(1+((2+floor(<level>/5))/<defense>)):0)",
"badguydmgmod"=>1.25,
"allowinpvp"=>1,
"allowintrain"=>1,
"rounds"=>120,
"schema"=>"module-racevik",
)
);
}
break;
}

return $args;
}

function racevik_checkcity(){
global $session;
$race="Viking";
if (is_module_active("racehuman")) {
$city = get_module_setting("villagename", "racehuman");
} else {
$city = getsetting("villagename", LOCATION_FIELDS);
}

if ($session['user']['race']==$race && is_module_active("cities")){
if (get_module_pref("homecity","cities")!=$city){
set_module_pref("homecity",$city,"cities");
}
}
return true;
}

function racevik_run(){
}
?>


This of course will be tested Smile. If successful i will do one for each village! Very Happy!
Back to top Go down
https://naruto-revolution.rpg-board.net
 
New Race module
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Naruto Revolution :: Basic Site Info :: Announcements-
Jump to: