DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • April 21, 2019, 11:09:33 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Specialty Removal for modified servers  (Read 1238 times)
0 Members and 1 Guest are viewing this topic.
SaucyWench
Mod God
*****
Offline Offline

Posts: 2238


I'm a good girl.


View Profile WWW
« on: July 26, 2006, 02:43:55 AM »

Now since this one has redirects too (like the Race Removal file I wrote) I will post the code, not the file. Once someone with a better brain than me can figure out how to get it working without hacky redirects, I can host the file and we can think about it being in the downloads area.

I'm writing a non-LoGD based on the LoGD code, where where specialties won't be used, so I needed a way to mask the selection process.

This is intended for totally different games, for example the one GenmaC wrote, and for my "crimson room"-inspired game that is in progress now.

This file is NOT intended for your space / powerpuff / pirate / gangwar server that has only been using the translator, unless you want specialties to play no part in the game whatsoever. If you are just changing the theme and want to have say, Ninjas, Thumb Wrestlers and Sex Therapists instead of mystical powers/dark arts, you want to use the translator and install or write some specialties.

This module will automatically set Standard as their specialties (with NO benefits). During character creation you will see the race selection and then the confirm, and as soon as you go past this you hit the New Day screen. New Day will not add any specialty uses and you'll have none of them in your forest fights. If you install race remover as well, then as soon as they click "Click Here To Login", they get their first new day.

Please note that if you install modules that increment or decrement specialty uses (old man, foilwench etc) then you may have errors. The whole idea is that you're supposed to remove specialty-stuff from the game. I cannot know what other modules are going to do, so you as the admin need to check them over and make sure they aren't installed.

Code:
function specialtygeneric_getmoduleinfo(){
$info = array(
"name" => "Specialty - Generic",
"author" => "Shannon Brown",
"version" => "1.0",
"category"=>"Theming",
"download"=>"http://gemdust.com/module_download/"
);
return $info;
}

function specialtygeneric_install(){
$sql = "DESCRIBE " . db_prefix("accounts");
$result = db_query($sql);
$specialty="DA";
while($row = db_fetch_assoc($result)) {
// Convert the user over
if ($row['Field'] == "standard") {
debug("Migrating standard field");
$sql = "INSERT INTO " . db_prefix("module_userprefs") . " (modulename,setting,userid,value) SELECT 'specialtystandard', 'skill', acctid, standard FROM " . db_prefix("accounts");
db_query($sql);
debug("Dropping standard field from accounts table");
$sql = "ALTER TABLE " . db_prefix("accounts") . " DROP standard";
db_query($sql);
} elseif ($row['Field']=="standarduses") {
debug("Migrating standard uses field");
$sql = "INSERT INTO " . db_prefix("module_userprefs") . " (modulename,setting,userid,value) SELECT 'specialtystandard', 'uses', acctid, standarduses FROM " . db_prefix("accounts");
db_query($sql);
debug("Dropping standarduses field from accounts table");
$sql = "ALTER TABLE " . db_prefix("accounts") . " DROP standarduses";
db_query($sql);
}
}
debug("Migrating standard Specialty");
$sql = "UPDATE " . db_prefix("accounts") . " SET specialty='$specialty' WHERE specialty='1'";
db_query($sql);

module_addhook("choose-specialty");
module_addhook("set-specialty");
module_addhook("fightnav-specialties");
module_addhook("apply-specialties");
module_addhook("newday");
module_addhook("incrementspecialty");
module_addhook("specialtynames");
module_addhook("specialtymodules");
module_addhook("specialtycolor");
module_addhook("dragonkill");
return true;
}

function specialtygeneric_uninstall(){
$sql = "UPDATE " . db_prefix("accounts") . " SET specialty='' WHERE specialty='S'";
db_query($sql);
return true;
}

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

$spec = "S";
$name = "Standard";
$ccode = "`$";

switch ($hookname) {
case "dragonkill":
set_module_pref("uses", 0);
set_module_pref("skill", 0);
break;
case "choose-specialty":
redirect("newday.php?setspecialty=$spec$resline");
break;
case "set-specialty":
redirect("newday.php");
break;
case "specialtycolor":
$args[$spec] = $ccode;
break;
case "specialtynames":
$args[$spec] = translate_inline($name);
break;
case "specialtymodules":
$args[$spec] = "specialtygeneric";
break;
case "incrementspecialty":
break;
case "newday":
break;
case "fightnav-specialties":
break;
case "apply-specialties":
break;
}
return $args;
}

function specialtygeneric_run(){
}

?>
Logged

SaucyWench
Owner of GemDust.com and Darton City proudly hosted by LunarPages
Tela
Guest
« Reply #1 on: March 06, 2008, 10:05:37 PM »

Missing the opening PHP tag, but other than that, a year and a half later, this works perfectly on the 1.1.1 version. Smiley

I'm doing everything in my races (and calling them occupations), so this was a big help. It solved a few planning issues I was going to have in regard to specialties, and which races can use them, and why. With the ability to essentially clone the actions of a specialty within a race, they aren't strictly required. Smiley

I haven't heavily tested this code or anything, as my server is not open yet, but I haven't ran into any issues YET.  Grin
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
97 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search