// SpellCreator.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <conio.h> //control input-output header
#include <stdio.h> //standard input-output header
#include <stdlib.h> //general purpose standard library
#include <string.h> //string-type function header
#include <time.h> //system time and date function
char SpellName[34][25] = {"Fireworks", "Glimmer", "Awaken", "Thunder",
"Weather", "Ignite", "Douse", "Locate", "AwakenAll", "DetectTrap", "GreatDouse",
"GreatIgnite", "Enchant", "FalseCoin", "GreatLight", "DestroyTrap",
"Sleep", "Swarm", "Peer", "Seance", "Charm", "Dance", "MassSleep",
"Clone", "CauseFear", "FireRing", "Tremor", "SleepField", "MassMight",
"MassCharm", "InvisibilityAll", "DeathVortex", "MassDeath", "Armageddon" };
char SpellNameSpace[34][45] = {"Fireworks", "Glimmer", "Awaken", "Thunder",
"Weather", "Ignite", "Douse", "Locate", "Awaken All", "Detect Trap", "Great Douse",
"Great Ignite", "Enchant", "False Coin", "Great Light", "Destroy Trap",
"Sleep", "Swarm", "Peer", "Seance", "Charm", "Dance", "Mass Sleep",
"Clone", "Cause Fear", "Fire Ring", "Tremor", "Sleep Field", "Mass Might",
"Mass Charm", "Invisibility All", "Death Vortex", "Mass Death", "Armageddon" };
struct SpellInfo
{
char Name[30];
char Mantra[30];
char Circle[30];
char Action[30];
char HandEffect[30];
char Reagent1[30];
char Reagent2[30];
char Reagent3[30];
char Reagent4[30];
char Reagent5[30];
double CastDelay;
double RequiredSkill;
int RequiredMana;
int RequiredHealth;
};
struct SpellInfo SInfo[2] = { //SpellCircle. Reagent.
{ "Awaken", "An Zu", "First", "218", "9002", "SulfurousAsh", "", "", "", "", 1.0, 0.0, 5, 0 },
{ "Awaken", "An Zu", "First", "218", "9002", "SulfurousAsh", "", "", "", "", 1.0, 0.0, 5, 0 }
};
//Changable variables. The rest can stay... pretty much.
char SpellType[] = "Ancient";
char CastSkill[] = "Magery";
char DamageSkill[] = "EvalInt";
int MaxSpellCount = 34;
int SpellOffset = 200;
char Base[100] = "G:\\";
char Scrolls[100] = "Scrolls\\";
char Spells[] = "Spells\\";
char ScrollCS[] = "Scroll.cs";
char SpellCS[] = "Scroll.cs";
char OtherCS[] = "Other.cs";
///////////////////////
/// main ///
///////////////////////
int main(void)
{
//Editable variables
char ScrollItemID[9] = "0x227C";
char SpellBookItemID[9] = "0xEFA";
char SpellBookHue[9] = "0x54B";
int GumpTextHue = 2307;
int GumpBGImage = 11010;
int GumpSpellBtn = 2362;
int GumpSpellBtnP = 2361;
char MLabName[15] = "Wizardry";
//Variables that can stay the way they are.
int Repeater = 0;
int ScrollHue = 0;
srand ( time(NULL) );
FILE *ScrollsFolder = NULL;
FILE *SpellsFolder = NULL;
FILE *OthersFolder = NULL;
char ScrollsFile[150];
char SpellsFile[150];
char OthersFile[150];
strcpy(Base, Base); //Copy Base overtop of ScrollsFile
strcat(Base, SpellType); //adds Scrolls onto it
strcat(Base, "\\");
int StartUp (FILE, FILE, FILE, char, char, char, int);
void DoScrolls (FILE, int, int, char);
void DoSpells (FILE, int);
void DoBaseSpell (FILE);
void DoInitalizer (FILE);
void DoBook (FILE, char, char);
void DoGump (FILE, int, int, int, int, char);
void DoBag (FILE, char);
void CloseDown (FILE, FILE, FILE);
do
{
ScrollHue = StartUp(*ScrollsFolder, *SpellsFolder, *OthersFolder, ScrollsFile[150], SpellsFile[150], OthersFile[150], Repeater);
DoScrolls(*ScrollsFolder, Repeater, ScrollHue, ScrollItemID[9]);
DoSpells(*SpellsFolder, Repeater);
if( Repeater == 0 )
{
DoBaseSpell(*OthersFolder);
DoInitalizer(*OthersFolder);
DoBook(*OthersFolder, SpellBookItemID[9], SpellBookHue[9]);
DoGump(*OthersFolder, GumpTextHue, GumpBGImage, GumpSpellBtn, GumpSpellBtnP, MLabName[15]);
DoBag(*OthersFolder, SpellBookHue[9]);
}
CloseDown(*ScrollsFolder, *SpellsFolder, *OthersFolder);
Repeater++;
printf("Saved %d: \"%s\", \"%s\", \"%s\".\n", Repeater, ScrollsFile, SpellsFile, OthersFile);
}while( Repeater < MaxSpellCount );
printf("\nWork complete...");
getch();
return 0;
}
///////////////////////
/// StartUp ///
///////////////////////
int StartUp( FILE *ScrollsFolder, FILE *SpellsFolder, FILE *OthersFolder, char ScrollsFile[150], char SpellsFile[150], char OthersFile[150], int Repeater )
{
strcpy(ScrollsFile, Base); //Copy Base overtop of ScrollsFile
strcat(ScrollsFile, Scrolls); //adds Scrolls onto it
strcat(ScrollsFile, SpellName[Repeater]);
strcat(ScrollsFile, ScrollCS);
do { ScrollsFolder = fopen(ScrollsFile, "w"); //OPENS
if( ScrollsFolder == NULL ) //NON EXISTANT?
{
printf("%s not found.", ScrollsFile);
getch();
} }while( ScrollsFolder == NULL);
strcpy(SpellsFile, Base); //Copy Base overtop of ScrollsFile
strcat(SpellsFile, Spells); //adds Spells onto it
strcat(SpellsFile, SpellName[Repeater]);
strcat(SpellsFile, SpellCS);
do { SpellsFolder = fopen(SpellsFile, "w"); //OPENS
if( SpellsFolder == NULL ) //NON EXISTANT?
{
printf("%s not found.", SpellsFile);
getch();
} }while( SpellsFolder == NULL);
strcpy(OthersFile, Base); //Copy Base overtop of ScrollsFile
strcat(OthersFile, OtherCS); //adds OtherCS onto it
do { OthersFolder = fopen(OthersFile, "w"); //OPENS
if( OthersFolder == NULL ) //NON EXISTANT?
{
printf("%s not found.", OthersFile);
getch();
} }while( OthersFolder == NULL);
int hue;
hue = rand()%11+1; //11 options, 1-11
if( hue == 1 )
hue = 1355;
else if( hue == 2 )
hue = 1356;
else if( hue == 3 )
hue = 1357;
else if( hue == 4 )
hue = 1358;
else if( hue == 5 )
hue = 1359;
else if( hue == 6 )
hue = 1360;
else if( hue == 7 )
hue = 147;
else if( hue == 8 )
hue = 148;
else if( hue == 9 )
hue = 149;
else if( hue == 10 )
hue = 150;
else if( hue == 11 )
hue = 151;
return (hue);
}
///////////////////////
/// DoScrolls ///
///////////////////////
void DoScrolls( FILE *ScrollsFolder, int Repeater, int ScrollHue, char ScrollItemID[9] )
{
fprintf(ScrollsFolder, "\nusing System;");
fprintf(ScrollsFolder, "\nusing Server;");
fprintf(ScrollsFolder, "\nusing Server.Items;");
fprintf(ScrollsFolder, "\n");
fprintf(ScrollsFolder, "\nnamespace Server.Items");
fprintf(ScrollsFolder, "\n{");
fprintf(ScrollsFolder, "\n\tpublic class %sScroll : SpellScroll", SpellName[Repeater]);
fprintf(ScrollsFolder, "\n\t{");
fprintf(ScrollsFolder, "\n\t\t[Constructable]");
fprintf(ScrollsFolder, "\n\t\tpublic %sScroll() : this( 1 )", SpellName[Repeater]);
fprintf(ScrollsFolder, "\n\t\t{");
fprintf(ScrollsFolder, "\n\t\t}");
fprintf(ScrollsFolder, "\n\t\t");
fprintf(ScrollsFolder, "\n\t\t[Constructable]");
fprintf(ScrollsFolder, "\n\t\tpublic %sScroll( int amount ) : base( %d, %s, amount )", SpellName[Repeater], (SpellOffset + Repeater), ScrollItemID );
fprintf(ScrollsFolder, "\n\t\t{");
fprintf(ScrollsFolder, "\n\t\t\tName = \"%s Scroll\";", SpellNameSpace[Repeater]);
fprintf(ScrollsFolder, "\n\t\t\tHue = %d;", ScrollHue);
fprintf(ScrollsFolder, "\n\t\t}");
fprintf(ScrollsFolder, "\n\t\t");
fprintf(ScrollsFolder, "\n\t\tpublic %sScroll( Serial serial ) : base( serial )", SpellName[Repeater]);
fprintf(ScrollsFolder, "\n\t\t{");
fprintf(ScrollsFolder, "\n\t\t}");
fprintf(ScrollsFolder, "\n\t\t");
fprintf(ScrollsFolder, "\n\t\tpublic override void Serialize( GenericWriter writer )");
fprintf(ScrollsFolder, "\n\t\t{");
fprintf(ScrollsFolder, "\n\t\t\tbase.Serialize( writer );");
fprintf(ScrollsFolder, "\n\t\t\twriter.Write( (int) 0 ); // version");
fprintf(ScrollsFolder, "\n\t\t}");
fprintf(ScrollsFolder, "\n\t\t");
fprintf(ScrollsFolder, "\n\t\tpublic override void Deserialize( GenericReader reader )");
fprintf(ScrollsFolder, "\n\t\t{");
fprintf(ScrollsFolder, "\n\t\t\tbase.Deserialize( reader );");
fprintf(ScrollsFolder, "\n\t\t\tint version = reader.ReadInt();");
fprintf(ScrollsFolder, "\n\t\t}");
fprintf(ScrollsFolder, "\n\t\t");
fprintf(ScrollsFolder, "\n\t\tpublic override Item Dupe( int amount )");
fprintf(ScrollsFolder, "\n\t\t{");
fprintf(ScrollsFolder, "\n\t\t\treturn base.Dupe( new %sScroll( amount ), amount );", SpellName[Repeater]);
fprintf(ScrollsFolder, "\n\t\t}");
fprintf(ScrollsFolder, "\n\t}");
fprintf(ScrollsFolder, "\n}");
return;
}
///////////////////////
/// DoSpells ///
///////////////////////
void DoSpells( FILE *SpellsFolder, int Repeater )
{
fprintf(SpellsFolder, "/nusing System;");
fprintf(SpellsFolder, "/nusing Server.Targeting;");
fprintf(SpellsFolder, "/nusing Server.Network;");
fprintf(SpellsFolder, "/n");
fprintf(SpellsFolder, "/nnamespace Server.Spells.%s", SpellType);
fprintf(SpellsFolder, "/n{");
fprintf(SpellsFolder, "/n/tpublic class %sSpell : %sSpell", SpellName[Repeater], SpellType);
fprintf(SpellsFolder, "/n/t{");
fprintf(SpellsFolder, "/n/t/tprivate static SpellInfo m_Info = new SpellInfo");
fprintf(SpellsFolder, "/n/t/t(");
fprintf(SpellsFolder, "/n/t/t/t\"%s\", \"%s\",", SInfo[Repeater].Name, SInfo[Repeater].Mantra);
fprintf(SpellsFolder, "/n/t/t/tSpellCircle.%s,", SInfo[Repeater].Circle);
fprintf(SpellsFolder, "/n/t/t/t%d,", SInfo[Repeater].Action);
fprintf(SpellsFolder, "/n/t/t/t%d,", SInfo[Repeater].HandEffect);
if( (strcmp (SInfo[Repeater].Reagent1,"") != 0) )
{
fprintf(SpellsFolder, "/n/t/t/tReagent.%s", SInfo[Repeater].Reagent1);
if( (strcmp (SInfo[Repeater].Reagent2,"") != 0) )
fprintf(SpellsFolder, ",");
}
if( (strcmp (SInfo[Repeater].Reagent2,"") != 0) )
{
fprintf(SpellsFolder, "/n/t/t/tReagent.%s", SInfo[Repeater].Reagent2);
if( (strcmp (SInfo[Repeater].Reagent3,"") != 0) )
fprintf(SpellsFolder, ",");
}
if( (strcmp (SInfo[Repeater].Reagent3,"") != 0) )
{
fprintf(SpellsFolder, "/n/t/t/tReagent.%s", SInfo[Repeater].Reagent3);
if( (strcmp (SInfo[Repeater].Reagent4,"") != 0) )
fprintf(SpellsFolder, ",");
}
if( (strcmp (SInfo[Repeater].Reagent4,"") != 0) )
{
fprintf(SpellsFolder, "/n/t/t/tReagent.%s", SInfo[Repeater].Reagent4);
if( (strcmp (SInfo[Repeater].Reagent5,"") != 0) )
fprintf(SpellsFolder, ",");
}
if( (strcmp (SInfo[Repeater].Reagent5,"") != 0) )
fprintf(SpellsFolder, "/n/t/t/tReagent.%s", SInfo[Repeater].Reagent5);
fprintf(SpellsFolder, "/n/t/t);");
fprintf(SpellsFolder, "/n");
fprintf(SpellsFolder, "/n/t/tpublic override double CastDelay{ get{ return %3.1f; } }", SInfo[Repeater].CastDelay);
fprintf(SpellsFolder, "/n/t/tpublic override double RequiredSkill{ get{ return %3.1f; } }", SInfo[Repeater].RequiredSkill);
fprintf(SpellsFolder, "/n/t/tpublic override int RequiredMana{ get{ return %d; } }", SInfo[Repeater].RequiredMana);
fprintf(SpellsFolder, "/n/t/tpublic override int RequiredHealth{ get{ return %d; } }", SInfo[Repeater].RequiredHealth);
fprintf(SpellsFolder, "/n/t/t");
fprintf(SpellsFolder, "/n/t/tpublic %sSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )", SpellName[Repeater]);
fprintf(SpellsFolder, "/n/t/t{");
fprintf(SpellsFolder, "/n/t/t}");
fprintf(SpellsFolder, "/n");
fprintf(SpellsFolder, "/n/t/tpublic override void OnCast()");
fprintf(SpellsFolder, "/n/t/t{");
fprintf(SpellsFolder, "/n/t/t/tCaster.Target = new InternalTarget( this );");
fprintf(SpellsFolder, "/n/t/t}");
fprintf(SpellsFolder, "/n");
fprintf(SpellsFolder, "/n/t/tpublic void Target( Mobile m )");
fprintf(SpellsFolder, "/n/t/t{");
fprintf(SpellsFolder, "/n/t/t/tif ( !Caster.CanSee( m ) )");
fprintf(SpellsFolder, "/n/t/t/t{");
fprintf(SpellsFolder, "/n/t/t/t/tCaster.SendLocalizedMessage( 500237 ); // Target can not be seen.");
fprintf(SpellsFolder, "/n/t/t/t}");
fprintf(SpellsFolder, "/n/t/t/telse if ( CheckHSequence( m ) )");
fprintf(SpellsFolder, "/n/t/t/t{");
fprintf(SpellsFolder, "/n/t/t/t/tMobile source = Caster;");
fprintf(SpellsFolder, "/n/t/t/t/tSpellHelper.Turn( source, m );");
fprintf(SpellsFolder, "/n/t/t/t/tSpellHelper.CheckReflect( (int)this.Circle, ref source, ref m );");
fprintf(SpellsFolder, "/n");
fprintf(SpellsFolder, "/n/t/t/t/tdouble damage = GetNewAosDamage( 10, 1, 4, Caster.Player && m.Player );");
fprintf(SpellsFolder, "/n");
fprintf(SpellsFolder, "/n/t/t/t/tsource.MovingParticles( m, 0x36E4, 5, 0, false, true, 3006, 4006, 0 );");
fprintf(SpellsFolder, "/n/t/t/t/tsource.PlaySound( 0x1E5 );");
fprintf(SpellsFolder, "/n");
fprintf(SpellsFolder, "/n/t/t/t/tSpellHelper.Damage( this, m, damage, 0, 100, 0, 0, 0 );");
fprintf(SpellsFolder, "/n/t/t/t}");
fprintf(SpellsFolder, "/n");
fprintf(SpellsFolder, "/n/t/t/tFinishSequence();");
fprintf(SpellsFolder, "/n/t/t}");
fprintf(SpellsFolder, "/n");
fprintf(SpellsFolder, "/n/t/tprivate class InternalTarget : Target");
fprintf(SpellsFolder, "/n/t/t{");
fprintf(SpellsFolder, "/n/t/t/tprivate %sSpell m_Owner;", SpellName[Repeater]);
fprintf(SpellsFolder, "/n");
fprintf(SpellsFolder, "/n/t/t/tpublic InternalTarget( %sSpell owner ) : base( 12, false, TargetFlags.Harmful )", SpellName[Repeater]);
fprintf(SpellsFolder, "/n/t/t/t{");
fprintf(SpellsFolder, "/n/t/t/t/tm_Owner = owner;");
fprintf(SpellsFolder, "/n/t/t/t}");
fprintf(SpellsFolder, "/n");
fprintf(SpellsFolder, "/n/t/t/tprotected override void OnTarget( Mobile from, object o )");
fprintf(SpellsFolder, "/n/t/t/t{");
fprintf(SpellsFolder, "/n/t/t/t/tif ( o is Mobile )");
fprintf(SpellsFolder, "/n/t/t/t/t{");
fprintf(SpellsFolder, "/n/t/t/t/t/tm_Owner.Target( (Mobile)o );");
fprintf(SpellsFolder, "/n/t/t/t/t}");
fprintf(SpellsFolder, "/n/t/t/t}");
fprintf(SpellsFolder, "/n");
fprintf(SpellsFolder, "/n/t/t/tprotected override void OnTargetFinish( Mobile from )");
fprintf(SpellsFolder, "/n/t/t/t{");
fprintf(SpellsFolder, "/n/t/t/t/tm_Owner.FinishSequence();");
fprintf(SpellsFolder, "/n/t/t/t}");
fprintf(SpellsFolder, "/n/t/t}");
fprintf(SpellsFolder, "/n/t}");
fprintf(SpellsFolder, "/n}");
return;
}
///////////////////////
/// DoBaseSpell ///
///////////////////////
void DoBaseSpell( FILE *OthersFolder )
{
fprintf(OthersFolder, "/nusing System;");
fprintf(OthersFolder, "/nusing Server;");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/nnamespace Server.Spells.%s", SpellType);
fprintf(OthersFolder, "/n{");
fprintf(OthersFolder, "/n/tpublic abstract class %sSpell : Spell", SpellType);
fprintf(OthersFolder, "/n/t{");
fprintf(OthersFolder, "/n/t/tpublic abstract double CastDelay{ get; }");
fprintf(OthersFolder, "/n/t/tpublic abstract double RequiredSkill{ get; }");
fprintf(OthersFolder, "/n/t/tpublic abstract int RequiredMana{ get; }");
fprintf(OthersFolder, "/n/t/tpublic abstract int RequiredHealth{ get; }");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic override SkillName CastSkill{ get{ return SkillName.%s; } }", CastSkill);
fprintf(OthersFolder, "/n/t/tpublic override SkillName DamageSkill{ get{ return SkillName.%s; } }", DamageSkill);
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic override bool ClearHandsOnCast{ get{ return false; } }");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic %sSpell( Mobile caster, Item scroll, SpellInfo info ) : base( caster, scroll, info )", SpellType);
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic override void GetCastSkills( out double min, out double max )");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tmin = RequiredSkill - 20.0;");
fprintf(OthersFolder, "/n/t/t/tmax = RequiredSkill + 20.0;");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n/t/t");
fprintf(OthersFolder, "/n/t/tpublic override bool ConsumeReagents()");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/treturn true;");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic override int GetMana()");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/treturn RequiredMana;");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n/t}");
fprintf(OthersFolder, "/n}");
return;
}
///////////////////////
/// DoInitalizer ///
///////////////////////
void DoInitalizer( FILE *OthersFolder )
{
fprintf(OthersFolder, "/nusing System;");
fprintf(OthersFolder, "/nusing Server;");
fprintf(OthersFolder, "/nusing Server.Spells;");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/nnamespace Server.Spells.%s", SpellType);
fprintf(OthersFolder, "/n{");
fprintf(OthersFolder, "/n/tpublic class %sInitializer", SpellType);
fprintf(OthersFolder, "/n/t{");
fprintf(OthersFolder, "/n/t/tpublic static void Initialize()");
fprintf(OthersFolder, "/n/t/t{");
for( int i = 0; i <= MaxSpellCount; i++ )
fprintf(OthersFolder, "/n/t/t/tRegister( %d, typeof( %sSpell ) );", (SpellOffset + i), SpellName[i]);
fprintf(OthersFolder, "/n/t/t/t");
fprintf(OthersFolder, "/n/t/t/t//RegDef( spellID, \"Name\", \"Description\", \"Reagent1; Reagent2; Reagentn\", \"Skill; Mana; Tithe; Etc\" );");
for( int j = 0; j <= MaxSpellCount; j++ )
{
fprintf(OthersFolder, "/n/t/t/tRegDef( %d, \"%s\", \"description\", \"", (SpellOffset + j), SInfo[j].Name );
if( (strcmp (SInfo[j].Reagent1,"") != 0) )
{
fprintf(OthersFolder, "%s", SInfo[j].Reagent1);
if( (strcmp (SInfo[j].Reagent2,"") != 0) )
fprintf(OthersFolder, "; ");
}
if( (strcmp (SInfo[j].Reagent2,"") != 0) )
{
fprintf(OthersFolder, "%s", SInfo[j].Reagent2);
if( (strcmp (SInfo[j].Reagent3,"") != 0) )
fprintf(OthersFolder, "; ");
}
if( (strcmp (SInfo[j].Reagent3,"") != 0) )
{
fprintf(OthersFolder, "%s", SInfo[j].Reagent3);
if( (strcmp (SInfo[j].Reagent4,"") != 0) )
fprintf(OthersFolder, "; ");
}
if( (strcmp (SInfo[j].Reagent4,"") != 0) )
{
fprintf(OthersFolder, "%s", SInfo[j].Reagent4);
if( (strcmp (SInfo[j].Reagent5,"") != 0) )
fprintf(OthersFolder, "; ");
}
if( (strcmp (SInfo[j].Reagent5,"") != 0) )
fprintf(OthersFolder, "%s", SInfo[j].Reagent5);
fprintf(OthersFolder, "\", \"Skill: %3.1f; Mana: %d; Health: %d\" );", SInfo[j].RequiredSkill, SInfo[j].RequiredMana, SInfo[j].RequiredHealth );
}
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n/t/t");
fprintf(OthersFolder, "/n/t/tpublic static void Register( int spellID, Type type )");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tSpellRegistry.Register( spellID, type );");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n/t/t");
fprintf(OthersFolder, "/n/t/tpublic static void RegDef( int spellID, string name, string des, string regs, string inf )");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tSpellDefRegistry.Register( spellID, name, des, regs, inf );");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n/t}");
fprintf(OthersFolder, "/n}");
return;
}
///////////////////////
/// DoBook ///
///////////////////////
void DoBook( FILE *OthersFolder, char SpellBookItemID[], char SpellBookHue[] )
{
fprintf(OthersFolder, "/nusing System;");
fprintf(OthersFolder, "/nusing Server.Network;");
fprintf(OthersFolder, "/nusing Server.Gumps;");
fprintf(OthersFolder, "/nusing Server.Spells;");
fprintf(OthersFolder, "/nusing Server.Spells.%s;", SpellType);
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/nnamespace Server.Items");
fprintf(OthersFolder, "/n{");
fprintf(OthersFolder, "/n/tpublic class %sSpellbook : Spellbook", SpellType);
fprintf(OthersFolder, "/n/t{");
fprintf(OthersFolder, "/n/t/tpublic override SpellbookType SpellbookType{ get{ return SpellbookType.%s; } }", SpellType);
fprintf(OthersFolder, "/n/t/tpublic override int BookOffset{ get{ return %d; } }", SpellOffset);
fprintf(OthersFolder, "/n/t/tpublic override int BookCount{ get{ return %d; } }", MaxSpellCount);
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic override Item Dupe( int amount )");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tSpellbook book = new %sSpellbook();", SpellType);
fprintf(OthersFolder, "/n/t/t/tbook.Content = this.Content;");
fprintf(OthersFolder, "/n/t/t/treturn base.Dupe( book, amount );");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/t[Constructable]");
fprintf(OthersFolder, "/n/t/tpublic %sSpellbook() : this( (ulong)0 )", SpellType);
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/t[Constructable]");
fprintf(OthersFolder, "/n/t/tpublic %sSpellbook( ulong content ) : base( content, %s )", SpellType, SpellBookItemID);
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tName = \"%s Spellbook\";", SpellType);
fprintf(OthersFolder, "/n/t/t/tHue = %s;", SpellBookHue);
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic override void OnDoubleClick( Mobile from )");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tContainer pack = from.Backpack;");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/t/tif ( !(Parent == from || ( pack != null && Parent == pack )) )");
fprintf(OthersFolder, "/n/t/t/t{");
fprintf(OthersFolder, "/n/t/t/t/tfrom.SendLocalizedMessage( 500207 ); // The spellbook must be in your backpack (and not in a container within) to open.");
fprintf(OthersFolder, "/n/t/t/t/treturn;");
fprintf(OthersFolder, "/n/t/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/t/tfrom.CloseGump( typeof( %sSpellbookGump ) );", SpellType);
fprintf(OthersFolder, "/n/t/t/tfrom.SendGump( new %sSpellbookGump( from, this ) );", SpellType);
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic PerkSpellbook( Serial serial ) : base( serial )");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic override void Serialize( GenericWriter writer )");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tbase.Serialize( writer );");
fprintf(OthersFolder, "/n/t/t/twriter.Write( (int) 0 ); // version");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic override void Deserialize( GenericReader reader )");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tbase.Deserialize( reader );");
fprintf(OthersFolder, "/n/t/t/tint version = reader.ReadInt();");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n/t}");
fprintf(OthersFolder, "/n}");
return;
}
///////////////////////
/// DoGump ///
///////////////////////
void DoGump( FILE *OthersFolder, int GumpTextHue, int GumpBGImage, int GumpSpellBtn, int GumpSpellBtnP, char MLabName[] )
{
fprintf(OthersFolder, "/nusing System;");
fprintf(OthersFolder, "/nusing Server;");
fprintf(OthersFolder, "/nusing Server.Items;");
fprintf(OthersFolder, "/nusing Server.Network;");
fprintf(OthersFolder, "/nusing Server.Spells;");
fprintf(OthersFolder, "/nusing Server.Gumps;");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/nnamespace Server.Spells.%s", SpellType);
fprintf(OthersFolder, "/n{");
fprintf(OthersFolder, "/n/tpublic class %sSpellbookGump : BaseCGumpII", SpellType);
fprintf(OthersFolder, "/n/t{");
fprintf(OthersFolder, "/n/t/tpublic override int TextHue{/tget{ return %d; } }", GumpTextHue);
fprintf(OthersFolder, "/n/t/tpublic override int BGImage{/tget{ return %d; } }", GumpBGImage);
fprintf(OthersFolder, "/n/t/tpublic override int SpellBtn{/tget{ return %d; } }", GumpSpellBtn);
fprintf(OthersFolder, "/n/t/tpublic override int SpellBtnP{/tget{ return %d; } }", GumpSpellBtnP);
fprintf(OthersFolder, "/n/t/tpublic override string MLab{/tget{ return \"%s %s\"; } }", SpellType, MLabName);
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic %sSpellbookGump( Mobile from, %sSpellbook book ) : base( from, book )", SpellType, SpellType);
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic override void OnResponse( NetState state, RelayInfo info )");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tMobile from = state.Mobile;");
fprintf(OthersFolder, "/n/t/t/tint BID = info.ButtonID;");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/t/tif( BID >= %d && BID <= %d )", SpellOffset, (SpellOffset + MaxSpellCount - 1));
fprintf(OthersFolder, "/n/t/t/t{");
fprintf(OthersFolder, "/n/t/t/t/tSpell spell = SpellRegistry.NewSpell( BID, from, null );");
fprintf(OthersFolder, "/n/t/t/t/tif( spell != null )");
fprintf(OthersFolder, "/n/t/t/t/t/tspell.Cast();");
fprintf(OthersFolder, "/n/t/t/t}");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n/t}");
fprintf(OthersFolder, "/n}");
return;
}
///////////////////////
/// DoBag ///
///////////////////////
void DoBag( FILE *OthersFolder, int SpellBookHue )
{
int x = 0;
int y = 0;
fprintf(OthersFolder, "/nusing System;");
fprintf(OthersFolder, "/nusing Server;");
fprintf(OthersFolder, "/nusing Server.Items;");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/nnamespace Server.Items");
fprintf(OthersFolder, "/n{");
fprintf(OthersFolder, "/n/tpublic class %sBag : Bag", SpellType);
fprintf(OthersFolder, "/n/t{");
fprintf(OthersFolder, "/n/t/t[Constructable]");
fprintf(OthersFolder, "/n/t/tpublic %sBag()", SpellType);
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tName = \"%s Scroll-Bag\";", SpellType);
fprintf(OthersFolder, "/n/t/t/tHue = %d;", SpellBookHue);
fprintf(OthersFolder, "/n/t/t/t");
for( int i = 0; i < MaxSpellCount; i++ )
{
x = x + 20;
if( x == 120 )
{
x = 0;
y = y + 20;
}
fprintf(OthersFolder, "/n/t/t/tPlaceItemIn( %d, %d, new %sScroll() );", x, y, SpellName[i]);
}
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tprivate void PlaceItemIn( int x, int y, Item item )");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tAddItem( item );");
fprintf(OthersFolder, "/n/t/t/titem.Location = new Point3D( x, y, 0 );");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic %sBag( Serial serial ) : base( serial )", SpellType);
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic override void Serialize( GenericWriter writer )");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tbase.Serialize( writer );");
fprintf(OthersFolder, "/n/t/t/twriter.Write( (int) 0 ); // version");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n");
fprintf(OthersFolder, "/n/t/tpublic override void Deserialize( GenericReader reader )");
fprintf(OthersFolder, "/n/t/t{");
fprintf(OthersFolder, "/n/t/t/tbase.Deserialize( reader );");
fprintf(OthersFolder, "/n/t/t/tint version = reader.ReadInt();");
fprintf(OthersFolder, "/n/t/t}");
fprintf(OthersFolder, "/n/t}");
fprintf(OthersFolder, "/n}");
return;
}
///////////////////////
/// CloseDown ///
///////////////////////
void CloseDown( FILE *ScrollsFolder, FILE *SpellsFolder, FILE *OthersFolder)
{
//END FILE
fclose(ScrollsFolder); //close the file
fclose(SpellsFolder); //close the file
fclose(OthersFolder); //close the file
return;
}