Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.ACC.CSS
|
||||
{
|
||||
public abstract class BaseInitializer
|
||||
{
|
||||
public static void Register( Type type, string name, string desc, string regs, string info, int icon, int back, School flag )
|
||||
{
|
||||
SpellInfoRegistry.Register( type, name, desc, regs, info, icon, back, flag );
|
||||
}
|
||||
}
|
||||
}
|
||||
277
Scripts/SubSystem/ACC/Complete Spell System/-=+ 01 Core/CSS.cs
Normal file
277
Scripts/SubSystem/ACC/Complete Spell System/-=+ 01 Core/CSS.cs
Normal file
@@ -0,0 +1,277 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using Server.Commands;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.ACC.CSS.Modules;
|
||||
using Server.ACC.CM;
|
||||
|
||||
namespace Server.ACC.CSS
|
||||
{
|
||||
public class CSS : ACCSystem
|
||||
{
|
||||
private static int Version = 100;
|
||||
private static int PrevVersion;
|
||||
|
||||
public override string Name() { return "Complete Spell System"; }
|
||||
|
||||
private static Hashtable m_Loaded = new Hashtable();
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
ACC.RegisterSystem("Server.ACC.CSS.CSS");
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register("cast", AccessLevel.Player, new CommandEventHandler(CSSCast_OnCommand));
|
||||
}
|
||||
|
||||
[Usage("Cast <text>")]
|
||||
[Description("Casts the spell assigned to the given text. Great for macros or easyuo scripts.")]
|
||||
private static void CSSCast_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
if (e.Length == 1)
|
||||
{
|
||||
if (!CentralMemory.Running || !CSS.Running)
|
||||
{
|
||||
e.Mobile.SendMessage("The Central Memory is not running. This command is disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Multis.DesignContext.Check(e.Mobile))
|
||||
{
|
||||
e.Mobile.SendMessage("You cannot cast while customizing!");
|
||||
return;
|
||||
}
|
||||
|
||||
CastCommandsModule module = (CastCommandsModule)CentralMemory.GetModule(e.Mobile.Serial, typeof(CastCommandsModule));
|
||||
if (module == null)
|
||||
{
|
||||
e.Mobile.SendMessage("You do not have any commands to cast stored.");
|
||||
return;
|
||||
}
|
||||
|
||||
CastInfo info = module.Get(e.GetString(0));
|
||||
if (info == null)
|
||||
{
|
||||
e.Mobile.SendMessage("You have not assigned that command to any spells.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(e.Mobile, info.SpellType))
|
||||
{
|
||||
e.Mobile.SendMessage("You are not allowed to cast this spell.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CSpellbook.MobileHasSpell(e.Mobile, info.School, info.SpellType))
|
||||
{
|
||||
e.Mobile.SendMessage("You do not have this spell.");
|
||||
return;
|
||||
}
|
||||
|
||||
Spell spell = SpellInfoRegistry.NewSpell(info.SpellType, info.School, e.Mobile, null);
|
||||
if (spell != null)
|
||||
spell.Cast();
|
||||
else
|
||||
e.Mobile.SendMessage("This spell has been disabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Mobile.SendMessage("Format: Cast <text>");
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Running
|
||||
{
|
||||
get { return ACC.SysEnabled("Server.ACC.CSS.CSS"); }
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
Console.WriteLine("{0} has just been enabled!", Name());
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
Console.WriteLine("{0} has just been disabled!", Name());
|
||||
}
|
||||
|
||||
public override void Gump(Mobile from, Gump gump, ACCGumpParams subParams)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Help(Mobile from, Gump gump)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info, ACCGumpParams subParams)
|
||||
{
|
||||
}
|
||||
|
||||
private static void Refresh()
|
||||
{
|
||||
if (m_Loaded == null || m_Loaded.Count == 0)
|
||||
return;
|
||||
|
||||
Console.WriteLine("\n - Checking Spell Registry:");
|
||||
|
||||
ArrayList books;
|
||||
ArrayList oldsr;
|
||||
ArrayList newsr;
|
||||
bool changed;
|
||||
|
||||
foreach (DictionaryEntry de in m_Loaded)
|
||||
{
|
||||
changed = false;
|
||||
|
||||
oldsr = (ArrayList)de.Value;
|
||||
|
||||
newsr = SpellInfoRegistry.GetSpellsForSchool((School)de.Key);
|
||||
if (newsr == null)
|
||||
continue;
|
||||
|
||||
if (oldsr.Count != newsr.Count)
|
||||
changed = true;
|
||||
|
||||
for (int i = 0; i < oldsr.Count && !changed; i++)
|
||||
{
|
||||
if (((CSpellInfo)oldsr[i]).Type != (Type)newsr[i])
|
||||
changed = true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < oldsr.Count; i++)
|
||||
{
|
||||
if (!((CSpellInfo)oldsr[i]).Enabled)
|
||||
SpellInfoRegistry.DisEnable((School)de.Key, ((CSpellInfo)oldsr[i]).Type, false);
|
||||
}
|
||||
|
||||
if (!changed)
|
||||
continue;
|
||||
|
||||
Console.WriteLine(" - Changes in {0} detected - refreshing all books.", (School)de.Key);
|
||||
|
||||
books = new ArrayList();
|
||||
foreach (Item i in World.Items.Values)
|
||||
{
|
||||
if ((i is CSpellbook))
|
||||
{
|
||||
CSpellbook book = i as CSpellbook;
|
||||
if (book == null || book.Deleted || book.School != (School)de.Key)
|
||||
continue;
|
||||
books.Add(book);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < books.Count; i++)
|
||||
{
|
||||
if (((CSpellbook)books[i]).Full)
|
||||
{
|
||||
((CSpellbook)books[i]).Fill();
|
||||
continue;
|
||||
}
|
||||
|
||||
ulong oldcontent = ((CSpellbook)books[i]).Content;
|
||||
((CSpellbook)books[i]).Content = (ulong)0;
|
||||
|
||||
for (int j = 0; j < oldsr.Count; j++)
|
||||
{
|
||||
if ((oldcontent & ((ulong)1 << j)) != 0)
|
||||
((CSpellbook)books[i]).AddSpell(((CSpellInfo)oldsr[j]).Type);
|
||||
}
|
||||
|
||||
((CSpellbook)books[i]).InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
if (Version == 100)
|
||||
Console.WriteLine(" - Base Install");
|
||||
|
||||
else if (PrevVersion < Version)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public override void Save(GenericWriter idx, GenericWriter tdb, GenericWriter writer)
|
||||
{
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(SpellInfoRegistry.Registry.Count);
|
||||
foreach (DictionaryEntry de in SpellInfoRegistry.Registry)
|
||||
{
|
||||
writer.Write((int)de.Key);
|
||||
writer.Write((int)((ArrayList)de.Value).Count);
|
||||
foreach (CSpellInfo info in (ArrayList)de.Value)
|
||||
{
|
||||
info.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
writer.Write((int)Version);
|
||||
}
|
||||
|
||||
public override void Load(BinaryReader idx, BinaryReader tdb, BinaryFileReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Loaded = new Hashtable();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
int keys = reader.ReadInt();
|
||||
for (int i = 0; i < keys; i++)
|
||||
{
|
||||
School school = (School)reader.ReadInt();
|
||||
ArrayList valuelist = new ArrayList();
|
||||
|
||||
int values = reader.ReadInt();
|
||||
for (int j = 0; j < values; j++)
|
||||
{
|
||||
valuelist.Add(new CSpellInfo(reader));
|
||||
}
|
||||
|
||||
m_Loaded.Add(school, valuelist);
|
||||
}
|
||||
|
||||
PrevVersion = reader.ReadInt();
|
||||
|
||||
Refresh();
|
||||
Update();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
int keys = reader.ReadInt();
|
||||
for (int i = 0; i < keys; i++)
|
||||
{
|
||||
School school = (School)reader.ReadInt();
|
||||
ArrayList valuelist = new ArrayList();
|
||||
|
||||
int values = reader.ReadInt();
|
||||
for (int j = 0; j < values; j++)
|
||||
{
|
||||
valuelist.Add(new CSpellInfo(reader));
|
||||
}
|
||||
|
||||
m_Loaded.Add(school, valuelist);
|
||||
}
|
||||
|
||||
reader.ReadBool();
|
||||
PrevVersion = reader.ReadInt();
|
||||
|
||||
Refresh();
|
||||
Update();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Misc;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.ACC.CSS
|
||||
{
|
||||
public abstract class CSpell : Spell
|
||||
{
|
||||
public virtual double RequiredSkill { get{ return 0.0; } }
|
||||
public virtual int RequiredMana { get{ return 0; } }
|
||||
public virtual int RequiredHealth { get{ return 0; } }
|
||||
public virtual int RequiredTithing{ get{ return 0; } }
|
||||
public virtual double CastDelay { get{ return -1.0; } }
|
||||
|
||||
public CSpell( Mobile caster, Item scroll, SpellInfo info ) : base( caster, scroll, info )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if( SpellRestrictions.UseRestrictions )
|
||||
return SpellRestrictions.CheckRestrictions( Caster, this.GetType() );
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool CheckFizzle()
|
||||
{
|
||||
if( CSkillCheck.UseDefaultSkills )
|
||||
return CSkillCheck.CheckSkill( Caster, this.GetType() ) ? base.CheckFizzle() : false;
|
||||
else
|
||||
return CSkillCheck.CheckSkill( Caster, this.GetType() );
|
||||
}
|
||||
|
||||
public override TimeSpan GetCastDelay()
|
||||
{
|
||||
return CastDelay == -1 ? base.GetCastDelay() : TimeSpan.FromSeconds( CastDelay );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Items;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.ACC.CSS
|
||||
{
|
||||
public class CSpellScroll : Item
|
||||
{
|
||||
private Type m_SpellType;
|
||||
|
||||
public Type SpellType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SpellType;
|
||||
}
|
||||
}
|
||||
|
||||
public CSpellScroll(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public CSpellScroll(Type spellType, int itemID)
|
||||
: this(spellType, itemID, 1)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public CSpellScroll(Type spellType, int itemID, int amount)
|
||||
: base(itemID)
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 1.0;
|
||||
Amount = amount;
|
||||
|
||||
m_SpellType = spellType;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write((string)m_SpellType.Name);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_SpellType = ScriptCompiler.FindTypeByName(reader.ReadString());
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_SpellType = null;
|
||||
int bad = reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!Multis.DesignContext.Check(from))
|
||||
return; // They are customizing
|
||||
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
Spell spell = SpellInfoRegistry.NewSpell(m_SpellType, School.Invalid, from, this);
|
||||
|
||||
if (spell != null)
|
||||
spell.Cast();
|
||||
else
|
||||
from.SendLocalizedMessage(502345); // This spell has been temporarily disabled.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Commands;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.ACC.CSS
|
||||
{
|
||||
public class CSpellbook : Item
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register("FillBook", ACC.GlobalMinimumAccessLevel, new CommandEventHandler(FillBook_OnCommand));
|
||||
}
|
||||
|
||||
[Usage("FillBook")]
|
||||
[Description("Completely fills a targeted spellbook with scrolls.")]
|
||||
private static void FillBook_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
e.Mobile.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(FillBook_OnTarget));
|
||||
e.Mobile.SendMessage("Target the spellbook to fill.");
|
||||
}
|
||||
|
||||
private static void FillBook_OnTarget(Mobile from, object obj)
|
||||
{
|
||||
if (obj is CSpellbook)
|
||||
{
|
||||
CSpellbook book = (CSpellbook)obj;
|
||||
|
||||
if (book == null || book.Deleted)
|
||||
return;
|
||||
|
||||
book.Fill();
|
||||
book.Full = true;
|
||||
|
||||
from.SendMessage("The spellbook has been filled.");
|
||||
|
||||
CommandLogging.WriteLine(from, "{0} {1} filling spellbook {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(book));
|
||||
}
|
||||
else
|
||||
{
|
||||
from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(FillBook_OnTarget));
|
||||
from.SendMessage("That is not a spellbook. Try again.");
|
||||
}
|
||||
}
|
||||
|
||||
public override bool AllowEquipedCast(Mobile from) { return true; }
|
||||
public override bool DisplayLootType { get { return false; } }
|
||||
|
||||
public virtual School School { get { return School.Invalid; } }
|
||||
public virtual ArrayList SchoolSpells { get { return SpellInfoRegistry.GetSpellsForSchool(this.School); } }
|
||||
public virtual int BookCount { get { return SchoolSpells.Count; } }
|
||||
|
||||
private ulong m_Content;
|
||||
private int m_Count;
|
||||
private bool m_Full;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int SpellCount { get { return m_Count; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public ulong Content
|
||||
{
|
||||
get { return m_Content; }
|
||||
set
|
||||
{
|
||||
if (m_Content != value)
|
||||
{
|
||||
m_Content = value;
|
||||
|
||||
m_Count = 0;
|
||||
|
||||
while (value > 0)
|
||||
{
|
||||
m_Count += (int)(value & 0x1);
|
||||
value >>= 1;
|
||||
}
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public int Mark{ get{ return m_Mark; } set{ m_Mark = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Full { get { return m_Full; } set { m_Full = value; } }
|
||||
|
||||
public CSpellbook()
|
||||
: this((ulong)0, CSSettings.FullSpellbooks)
|
||||
{
|
||||
}
|
||||
|
||||
public CSpellbook(bool full)
|
||||
: this((ulong)0, full)
|
||||
{
|
||||
}
|
||||
|
||||
public CSpellbook(ulong content, bool full)
|
||||
: this(content, 0xEFA, full)
|
||||
{
|
||||
}
|
||||
|
||||
public CSpellbook(ulong content, int itemID, bool full)
|
||||
: base(itemID)
|
||||
{
|
||||
Name = "Arcane Tome";
|
||||
|
||||
Weight = 3.0;
|
||||
Layer = Layer.OneHanded;
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
Content = content;
|
||||
|
||||
if (full)
|
||||
Fill();
|
||||
}
|
||||
|
||||
public CSpellbook(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public void Fill()
|
||||
{
|
||||
m_Full = true;
|
||||
|
||||
if (this.BookCount == 64)
|
||||
this.Content = ulong.MaxValue;
|
||||
else
|
||||
this.Content = (1ul << this.BookCount) - 1;
|
||||
}
|
||||
|
||||
public bool AddSpell(Type type)
|
||||
{
|
||||
if (!SchoolSpells.Contains(type))
|
||||
return false;
|
||||
|
||||
m_Content |= (ulong)1 << SchoolSpells.IndexOf(type);
|
||||
++m_Count;
|
||||
|
||||
InvalidateProperties();
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool HasSpell(Type type)
|
||||
{
|
||||
if (SchoolSpells.Contains(type) && SpellInfoRegistry.CheckRegistry(this.School, type))
|
||||
return ((m_Content & ((ulong)1 << SchoolSpells.IndexOf(type))) != 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool MobileHasSpell(Mobile m, School school, Type type)
|
||||
{
|
||||
if (m == null || m.Deleted || m.Backpack == null || school == School.Invalid || type == null)
|
||||
return false;
|
||||
|
||||
foreach (Item i in m.Backpack.Items)
|
||||
{
|
||||
if (i is CSpellbook)
|
||||
{
|
||||
CSpellbook book = (CSpellbook)i;
|
||||
if (book.School == school && book.HasSpell(type))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Item layer = m.FindItemOnLayer(Layer.OneHanded);
|
||||
if (layer is CSpellbook)
|
||||
{
|
||||
CSpellbook book = (CSpellbook)layer;
|
||||
if (book.School == school && book.HasSpell(type))
|
||||
return true;
|
||||
}
|
||||
|
||||
layer = m.FindItemOnLayer(Layer.FirstValid);
|
||||
if (layer is CSpellbook)
|
||||
{
|
||||
CSpellbook book = (CSpellbook)layer;
|
||||
if (book.School == school && book.HasSpell(type))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
list.Add(1042886, m_Count.ToString()); // ~1_NUMBERS_OF_SPELLS~ Spells
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
this.LabelTo(from, 1042886, m_Count.ToString());
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (dropped is CSpellScroll && dropped.Amount == 1)
|
||||
{
|
||||
CSpellScroll scroll = (CSpellScroll)dropped;
|
||||
|
||||
if (!SchoolSpells.Contains(scroll.SpellType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (HasSpell(scroll.SpellType))
|
||||
{
|
||||
from.SendLocalizedMessage(500179); // That spell is already present in that spellbook.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
AddSpell(scroll.SpellType);
|
||||
scroll.Delete();
|
||||
|
||||
from.Send(new PlaySound(0x249, GetWorldLocation()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (dropped is SpellScroll && dropped.Amount == 1)
|
||||
{
|
||||
SpellScroll scroll = (SpellScroll)dropped;
|
||||
|
||||
Type type = SpellRegistry.Types[scroll.SpellID];
|
||||
|
||||
if (!SchoolSpells.Contains(type))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (HasSpell(type))
|
||||
{
|
||||
from.SendLocalizedMessage(500179); // That spell is already present in that spellbook.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
AddSpell(type);
|
||||
scroll.Delete();
|
||||
|
||||
from.Send(new PlaySound(0x249, GetWorldLocation()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write(m_Full);
|
||||
writer.Write(m_Content);
|
||||
writer.Write(m_Count);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Full = reader.ReadBool();
|
||||
m_Content = reader.ReadULong();
|
||||
m_Count = reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Spells;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.ACC.CSS
|
||||
{
|
||||
public abstract class CSpellbookGump : Gump
|
||||
{
|
||||
private CSpellbook m_Book;
|
||||
private ArrayList m_Spells;
|
||||
|
||||
private int Pages;
|
||||
private int CurrentPage;
|
||||
|
||||
public abstract string TextHue { get; }
|
||||
public abstract int BGImage { get; }
|
||||
public abstract int SpellBtn { get; }
|
||||
public abstract int SpellBtnP { get; }
|
||||
public abstract string Label1 { get; }
|
||||
public abstract string Label2 { get; }
|
||||
public abstract Type GumpType { get; }
|
||||
|
||||
public CSpellbookGump(CSpellbook book)
|
||||
: base(50, 100)
|
||||
{
|
||||
if (!CSS.Running)
|
||||
return;
|
||||
|
||||
m_Book = book;
|
||||
m_Spells = book.SchoolSpells;
|
||||
|
||||
Pages = (int)Math.Ceiling((book.SpellCount / 16.0));
|
||||
|
||||
/* if( Pages > 1 && book.Mark > 0 )
|
||||
{
|
||||
ArrayList temp = new ArrayList();
|
||||
for( int i = 0; i < book.Mark*16 && i < m_Spells.Count; i++ )
|
||||
temp.Add( m_Spells[i] );
|
||||
m_Spells.RemoveRange( 0, (book.Mark*16)-1 );
|
||||
m_Spells.AddRange( temp );
|
||||
}
|
||||
*/
|
||||
Closable = false;
|
||||
Dragable = true;
|
||||
|
||||
AddPage(0);
|
||||
AddImage(100, 100, BGImage);
|
||||
|
||||
CurrentPage = 1;
|
||||
|
||||
for (int i = 0; i < Pages; i++, CurrentPage++)
|
||||
{
|
||||
AddPage(CurrentPage);
|
||||
|
||||
//Hidden Buttons
|
||||
for (int j = (CurrentPage - 1) * 16, C = 0; j < CurrentPage * 16 && j < m_Spells.Count; j++, C++)
|
||||
{
|
||||
if (HasSpell((Type)m_Spells[j]))
|
||||
{
|
||||
AddButton((C > 7 ? 305 : 145), 142 + (C > 7 ? (C - 8) * 20 : C * 20), 2482, 2482, j + 1000, GumpButtonType.Reply, 0);
|
||||
}
|
||||
}
|
||||
AddImage(100, 100, BGImage);
|
||||
AddHtml(165, 107, 100, 20, String.Format("<basefont color=#{0}><Center>{1}</Center>", TextHue, Label1), false, false);
|
||||
AddHtml(285, 107, 100, 20, String.Format("<basefont color=#{0}><Center>{1}</Center>", TextHue, Label2), false, false);
|
||||
AddButton(404, 314, 4017, 4019, 0, GumpButtonType.Reply, 0);
|
||||
//End Hidden Buttons
|
||||
|
||||
//Prev/Next Buttons
|
||||
if (Pages > 1)
|
||||
{
|
||||
if (CurrentPage > 1)
|
||||
AddButton(122, 109, 2205, 2205, 0, GumpButtonType.Page, Pages - CurrentPage - 1);
|
||||
if (CurrentPage < Pages)
|
||||
AddButton(394, 104, 2206, 2206, 0, GumpButtonType.Page, CurrentPage + 1);
|
||||
}
|
||||
//End Prev/Next Buttons
|
||||
|
||||
//Spell Buttons/Labels
|
||||
for (int j = (CurrentPage - 1) * 16, C = 0; j < CurrentPage * 16 && j < m_Spells.Count; j++, C++)
|
||||
{
|
||||
if (HasSpell((Type)m_Spells[j]))
|
||||
{
|
||||
CSpellInfo info = SpellInfoRegistry.GetInfo(m_Book.School, (Type)m_Spells[j]);
|
||||
if (info == null)
|
||||
continue;
|
||||
|
||||
AddHtml((C > 7 ? 305 : 145), 140 + (C > 7 ? (C - 8) * 20 : C * 20), 120, 20, String.Format("<basefont color=#{0}>{1}</basefont>", TextHue, info.Name), false, false);
|
||||
AddButton((C > 7 ? 285 : 125), 143 + (C > 7 ? (C - 8) * 20 : C * 20), SpellBtn, SpellBtnP, j + 2000, GumpButtonType.Reply, 0);
|
||||
AddButton((C > 7 ? 410 : 250), 142 + (C > 7 ? (C - 8) * 20 : C * 20), 5411, 5411, j + 1000, GumpButtonType.Reply, 0);
|
||||
}
|
||||
}
|
||||
//End Spell Buttons/Labels
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasSpell(Type type)
|
||||
{
|
||||
return (m_Book != null && m_Book.HasSpell(type));
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 0 || !CSS.Running)
|
||||
return;
|
||||
|
||||
else if (info.ButtonID >= 1000 && info.ButtonID < (1000 + m_Spells.Count))
|
||||
{
|
||||
if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Book.School))
|
||||
{
|
||||
state.Mobile.SendMessage("You are not allowed to cast this spell.");
|
||||
return;
|
||||
}
|
||||
|
||||
CSpellInfo si = SpellInfoRegistry.GetInfo(m_Book.School, (Type)m_Spells[info.ButtonID - 1000]);
|
||||
if (si == null)
|
||||
{
|
||||
state.Mobile.SendMessage("That spell is disabled.");
|
||||
return;
|
||||
}
|
||||
state.Mobile.CloseGump(typeof(ScrollGump));
|
||||
state.Mobile.SendGump(new ScrollGump(m_Book, si, TextHue, state.Mobile));
|
||||
// m_Book.Mark = (info.ButtonID-1000)/16;
|
||||
// state.Mobile.SendMessage( "{0}", m_Book.Mark );
|
||||
}
|
||||
|
||||
else if (info.ButtonID >= 2000 && info.ButtonID < (2000 + m_Spells.Count))
|
||||
{
|
||||
if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Book.School))
|
||||
{
|
||||
state.Mobile.SendMessage("You are not allowed to cast this spell.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CSpellbook.MobileHasSpell(state.Mobile, m_Book.School, (Type)m_Spells[info.ButtonID - 2000]))
|
||||
{
|
||||
state.Mobile.SendMessage("You do not have this spell.");
|
||||
return;
|
||||
}
|
||||
|
||||
Spell spell = SpellInfoRegistry.NewSpell((Type)m_Spells[info.ButtonID - 2000], m_Book.School, state.Mobile, null);
|
||||
if (spell == null)
|
||||
state.Mobile.SendMessage("That spell is disabled.");
|
||||
else
|
||||
spell.Cast();
|
||||
// m_Book.Mark = (info.ButtonID-2000)/16;
|
||||
// state.Mobile.SendMessage( "{0}", m_Book.Mark );
|
||||
}
|
||||
|
||||
object[] Params = new object[1] { m_Book };
|
||||
CSpellbookGump gump = Activator.CreateInstance(GumpType, Params) as CSpellbookGump;
|
||||
if (gump != null)
|
||||
state.Mobile.SendGump(gump);
|
||||
|
||||
//GumpUpTimer
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.ACC.CM;
|
||||
|
||||
namespace Server.ACC.CSS.Modules
|
||||
{
|
||||
public class CastCommandsModule : Module
|
||||
{
|
||||
private Dictionary<string, CastInfo> m_CastCommands;
|
||||
public Dictionary<string, CastInfo> CastCommands { get { return m_CastCommands; } }
|
||||
|
||||
public override string Name() { return "Cast Commands"; }
|
||||
|
||||
public CastCommandsModule(Serial serial)
|
||||
: this(serial, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public CastCommandsModule(Serial serial, string castCommand, CastInfo info)
|
||||
: base(serial)
|
||||
{
|
||||
m_CastCommands = new Dictionary<string, CastInfo>();
|
||||
|
||||
Add(castCommand, info);
|
||||
}
|
||||
|
||||
public void Add(string castCommand, CastInfo info)
|
||||
{
|
||||
if (castCommand == null || castCommand.Length == 0 || info == null)
|
||||
return;
|
||||
|
||||
if (m_CastCommands.ContainsKey(castCommand.ToLower()))
|
||||
m_CastCommands[castCommand.ToLower()] = info;
|
||||
else
|
||||
m_CastCommands.Add(castCommand.ToLower(), info);
|
||||
}
|
||||
|
||||
public CastInfo Get(string castCommand)
|
||||
{
|
||||
|
||||
return Contains(castCommand) ? m_CastCommands[castCommand.ToLower()] : null;
|
||||
}
|
||||
|
||||
public string GetCommandForInfo(CastInfo castInfo)
|
||||
{
|
||||
foreach (KeyValuePair<string, CastInfo> kvp in m_CastCommands)
|
||||
{
|
||||
if (kvp.Value.SpellType == castInfo.SpellType)
|
||||
{
|
||||
return kvp.Key.ToLower();
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public bool Contains(string castCommand)
|
||||
{
|
||||
return m_CastCommands.ContainsKey(castCommand.ToLower());
|
||||
}
|
||||
|
||||
public void Remove(string castCommand)
|
||||
{
|
||||
m_CastCommands.Remove(castCommand.ToLower());
|
||||
|
||||
if (m_CastCommands.Count == 0)
|
||||
CentralMemory.RemoveModule(this.Owner, (Module)this);
|
||||
}
|
||||
|
||||
public void RemoveCommandByInfo(CastInfo castInfo)
|
||||
{
|
||||
string command = "";
|
||||
foreach (KeyValuePair<string, CastInfo> kvp in m_CastCommands)
|
||||
{
|
||||
if (kvp.Value.SpellType == castInfo.SpellType)
|
||||
{
|
||||
command = kvp.Key.ToLower();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (command.Length > 0)
|
||||
Remove(command);
|
||||
}
|
||||
|
||||
public override void Append(Module mod, bool negatively)
|
||||
{
|
||||
CastCommandsModule m = mod as CastCommandsModule;
|
||||
List<string> removeList = new List<string>();
|
||||
|
||||
foreach (KeyValuePair<string, CastInfo> kvp in m.CastCommands)
|
||||
{
|
||||
if (negatively)
|
||||
removeList.Add(kvp.Key);
|
||||
else
|
||||
Add(kvp.Key, kvp.Value);
|
||||
}
|
||||
|
||||
foreach (string s in removeList)
|
||||
{
|
||||
Remove(s);
|
||||
}
|
||||
removeList.Clear();
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(m_CastCommands.Count);
|
||||
foreach (KeyValuePair<string, CastInfo> kvp in m_CastCommands)
|
||||
{
|
||||
writer.Write(kvp.Key);
|
||||
kvp.Value.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_CastCommands = new Dictionary<string, CastInfo>();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
string s = reader.ReadString();
|
||||
CastInfo ii = new CastInfo(reader);
|
||||
if (ii.SpellType != null)
|
||||
m_CastCommands.Add(s, ii);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Spells;
|
||||
using Server.ACC.CM;
|
||||
|
||||
namespace Server.ACC.CSS.Modules
|
||||
{
|
||||
public class CastInfo
|
||||
{
|
||||
private Type m_SpellType;
|
||||
public Type SpellType { get { return m_SpellType; } set { m_SpellType = value; } }
|
||||
|
||||
private School m_School;
|
||||
public School School { get { return m_School; } set { m_School = value; } }
|
||||
|
||||
public CastInfo(Type type, School school)
|
||||
{
|
||||
m_SpellType = type;
|
||||
m_School = school;
|
||||
}
|
||||
|
||||
public CastInfo(GenericReader reader)
|
||||
{
|
||||
Deserialize(reader);
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write((int)0); //version
|
||||
|
||||
writer.Write((string)m_SpellType.Name);
|
||||
writer.Write((int)m_School);
|
||||
}
|
||||
|
||||
public void Deserialize(GenericReader reader)
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_SpellType = ScriptCompiler.FindTypeByName(reader.ReadString());
|
||||
m_School = (School)reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.ACC.CM;
|
||||
using Server.ACC.CSS.Modules;
|
||||
|
||||
namespace Server.ACC.CSS
|
||||
{
|
||||
public class IconPlacementGump : Gump
|
||||
{
|
||||
public CSpellbook m_Book;
|
||||
public Mobile m_From;
|
||||
|
||||
public int m_X;
|
||||
public int m_Y;
|
||||
public int m_I;
|
||||
public int m_Icon;
|
||||
public Type m_Spell;
|
||||
public int m_Background;
|
||||
public School m_School;
|
||||
|
||||
public IconPlacementGump( CSpellbook book, Mobile from, int x, int y, int i, int icon, Type spellType, int background, School school ) : base( 0, 0 )
|
||||
{
|
||||
m_Book = book;
|
||||
m_From = from;
|
||||
|
||||
m_X = x;
|
||||
m_Y = y;
|
||||
m_I = i;
|
||||
m_Icon = icon;
|
||||
m_Spell = spellType;
|
||||
m_Background = background;
|
||||
m_School = school;
|
||||
|
||||
string xtext = m_X.ToString();
|
||||
string ytext = m_Y.ToString();
|
||||
string itext = m_I.ToString();
|
||||
|
||||
Closable=true;
|
||||
Disposable=true;
|
||||
Dragable=false;
|
||||
Resizable=false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddImage( 260, 160, 5011 );
|
||||
AddLabel( 353, 230, 1153, "Icon Placement" );
|
||||
|
||||
CSpellInfo si = SpellInfoRegistry.GetInfo( m_School, m_Spell );
|
||||
if( si == null )
|
||||
return;
|
||||
|
||||
AddLabel( 338, 350, 1153, si.Name );
|
||||
|
||||
AddButton( 412, 288, 2444, 2443, 1, GumpButtonType.Reply, 0 );
|
||||
AddButton( 325, 288, 2444, 2443, 2, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 425, 290, 1153, "Apply" );
|
||||
AddLabel( 339, 290, 1153, "Move" );
|
||||
|
||||
AddButton( 377, 178, 4500, 4500, 3, GumpButtonType.Reply, 0 ); //Up
|
||||
AddButton( 474, 276, 4502, 4502, 4, GumpButtonType.Reply, 0 ); //Right
|
||||
AddButton( 377, 375, 4504, 4504, 5, GumpButtonType.Reply, 0 ); //Down
|
||||
AddButton( 278, 276, 4506, 4506, 6, GumpButtonType.Reply, 0 ); //Left
|
||||
|
||||
AddBackground( 348, 260, 105, 20, 9300 );
|
||||
AddBackground( 348, 318, 105, 20, 9300 );
|
||||
AddBackground( 388, 290, 25, 20, 9300 );
|
||||
|
||||
AddTextEntry( 348, 260, 105, 20, 1153, 7, "" + xtext );
|
||||
AddTextEntry( 348, 318, 105, 20, 1153, 8, "" + ytext );
|
||||
AddTextEntry( 388, 290, 25, 20, 1153, 9, "" + itext );
|
||||
|
||||
AddBackground( x, y, 54, 56, background );
|
||||
AddImage( x+45, y, 9008 );
|
||||
AddImage( x+5, y+5, icon );
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
switch( info.ButtonID )
|
||||
{
|
||||
//Apply
|
||||
case 1:
|
||||
{
|
||||
if( !CentralMemory.Running )
|
||||
{
|
||||
from.SendMessage( "There is no Central Memory! Please page an Admin to assist." );
|
||||
return;
|
||||
}
|
||||
|
||||
IconInfo ii = new IconInfo( m_Spell, m_Icon, m_X, m_Y, m_Background, m_School );
|
||||
|
||||
if( !CentralMemory.ContainsModule( from.Serial, typeof( IconsModule ) ) )
|
||||
CentralMemory.AddModule( from.Serial, typeof( IconsModule ) );
|
||||
|
||||
IconsModule im = new IconsModule( from.Serial );
|
||||
im.Add( ii );
|
||||
|
||||
CentralMemory.AppendModule( from.Serial, (Module)im, false );
|
||||
|
||||
from.SendGump( new SpellIconGump( ii ) );
|
||||
break;
|
||||
}
|
||||
|
||||
//Move
|
||||
case 2:
|
||||
{
|
||||
TextRelay xrelay = info.GetTextEntry( 7 );
|
||||
TextRelay yrelay = info.GetTextEntry( 8 );
|
||||
string xstring = ( xrelay == null ? null : xrelay.Text.Trim() );
|
||||
string ystring = ( yrelay == null ? null : yrelay.Text.Trim() );
|
||||
if( xstring == null || xstring.Length == 0 || ystring == null || ystring.Length == 0 )
|
||||
{
|
||||
from.SendMessage( "Please enter a X coordinate in the top box and a Y coordinate in the bottom box" );
|
||||
}
|
||||
else
|
||||
{
|
||||
int x = m_X;
|
||||
int y = m_Y;
|
||||
try
|
||||
{
|
||||
x = Int32.Parse(xstring);
|
||||
y = Int32.Parse(ystring);
|
||||
m_X = x;
|
||||
m_Y = y;
|
||||
}
|
||||
catch
|
||||
{
|
||||
from.SendMessage( "Please enter a X coordinate in the top box and a Y coordinate in the bottom box" );
|
||||
}
|
||||
}
|
||||
if( m_X < 0 )
|
||||
{
|
||||
m_X = 0;
|
||||
from.SendMessage( "You cannot go any farther left" );
|
||||
}
|
||||
if( m_Y < 0 )
|
||||
{
|
||||
m_Y = 0;
|
||||
from.SendMessage( "You cannot go any farther up" );
|
||||
}
|
||||
|
||||
from.CloseGump( typeof( IconPlacementGump ) );
|
||||
from.SendGump(new IconPlacementGump( m_Book, from, m_X, m_Y, m_I, m_Icon, m_Spell, m_Background, m_School ) );
|
||||
break;
|
||||
}
|
||||
|
||||
//Up
|
||||
case 3:
|
||||
{
|
||||
MakeI(info);
|
||||
from.CloseGump( typeof( IconPlacementGump ) );
|
||||
if( (m_Y-m_I) < 0 )
|
||||
{
|
||||
m_Y = 0;
|
||||
from.SendMessage( "You cannot go any farther up" );
|
||||
from.SendGump( new IconPlacementGump( m_Book, from, m_X, m_Y, m_I, m_Icon, m_Spell, m_Background, m_School ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump( new IconPlacementGump( m_Book, from, m_X, (m_Y-m_I), m_I, m_Icon, m_Spell, m_Background, m_School ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//Right
|
||||
case 4:
|
||||
{
|
||||
MakeI(info);
|
||||
from.CloseGump( typeof( IconPlacementGump ) );
|
||||
from.SendGump( new IconPlacementGump( m_Book, from, (m_X+m_I), m_Y, m_I, m_Icon, m_Spell, m_Background, m_School ) );
|
||||
break;
|
||||
}
|
||||
|
||||
//Down
|
||||
case 5:
|
||||
{
|
||||
MakeI(info);
|
||||
from.CloseGump( typeof( IconPlacementGump ) );
|
||||
from.SendGump( new IconPlacementGump( m_Book, from, m_X, (m_Y+m_I), m_I, m_Icon, m_Spell, m_Background, m_School ) );
|
||||
break;
|
||||
}
|
||||
|
||||
//Left
|
||||
case 6:
|
||||
{
|
||||
MakeI(info);
|
||||
from.CloseGump( typeof( IconPlacementGump ) );
|
||||
if( (m_X-m_I) < 0 )
|
||||
{
|
||||
m_X = 0;
|
||||
from.SendMessage( "You cannot go any farther left" );
|
||||
from.SendGump( new IconPlacementGump( m_Book, from, m_X, m_Y, m_I, m_Icon, m_Spell, m_Background, m_School ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump( new IconPlacementGump( m_Book, from, (m_X-m_I), m_Y, m_I, m_Icon, m_Spell, m_Background, m_School ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void MakeI(RelayInfo info)
|
||||
{
|
||||
TextRelay irelay = info.GetTextEntry( 9 );
|
||||
string istring = ( irelay == null ? null : irelay.Text.Trim() );
|
||||
if( istring == null || istring.Length == 0 )
|
||||
{
|
||||
m_From.SendMessage( "Please enter an integer in the middle text field." );
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = m_I;
|
||||
try
|
||||
{
|
||||
i = Int32.Parse(istring);
|
||||
m_I = i;
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_From.SendMessage( "Please enter an integer in the middle text field." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.ACC.CM;
|
||||
|
||||
namespace Server.ACC.CSS.Modules
|
||||
{
|
||||
public class ApplyIcons
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
EventSink.Login += new LoginEventHandler(EventSink_Login);
|
||||
}
|
||||
|
||||
private static void EventSink_Login(LoginEventArgs args)
|
||||
{
|
||||
if (!CentralMemory.Running || !CSS.Running)
|
||||
return;
|
||||
|
||||
Mobile m = args.Mobile;
|
||||
|
||||
IconsModule im = (IconsModule)CentralMemory.GetModule(m.Serial, typeof(IconsModule));
|
||||
if (im == null)
|
||||
return;
|
||||
|
||||
IconsModule imRemove = new IconsModule(m.Serial);
|
||||
|
||||
foreach (KeyValuePair<Type, IconInfo> kvp in im.Icons)
|
||||
{
|
||||
IconInfo ii = kvp.Value;
|
||||
if (ii == null)
|
||||
{
|
||||
imRemove.Add(ii);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ii.SpellType == null || ii.School == School.Invalid)
|
||||
{
|
||||
imRemove.Add(ii);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(m, ii.School))
|
||||
{
|
||||
imRemove.Add(ii);
|
||||
continue;
|
||||
}
|
||||
|
||||
m.SendGump(new SpellIconGump(ii));
|
||||
}
|
||||
|
||||
if (im.Icons.Count > 0)
|
||||
CentralMemory.AppendModule(m.Serial, (Module)imRemove, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Spells;
|
||||
using Server.ACC.CM;
|
||||
|
||||
namespace Server.ACC.CSS.Modules
|
||||
{
|
||||
public class IconInfo
|
||||
{
|
||||
private Type m_SpellType;
|
||||
public Type SpellType{ get{ return m_SpellType; } set{ m_SpellType = value; } }
|
||||
|
||||
private int m_Icon;
|
||||
public int Icon{ get{ return m_Icon; } set{ m_Icon = value; } }
|
||||
|
||||
private Point3D m_Location;
|
||||
public Point3D Location{ get{ return m_Location; } set{ m_Location = value; } }
|
||||
|
||||
private School m_School;
|
||||
public School School{ get{ return m_School; } set{ m_School = value; } }
|
||||
|
||||
public IconInfo( Type type, int icon, int x, int y, int back, School school )
|
||||
{
|
||||
m_SpellType = type;
|
||||
m_Icon = icon;
|
||||
m_Location = new Point3D( x, y, back );
|
||||
m_School = school;
|
||||
}
|
||||
|
||||
public IconInfo( GenericReader reader )
|
||||
{
|
||||
Deserialize( reader );
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( (int)1 ); //version
|
||||
|
||||
writer.Write( (string)m_SpellType.Name );
|
||||
writer.Write( (int)m_Icon );
|
||||
writer.Write( (Point3D)m_Location );
|
||||
writer.Write( (int)m_School );
|
||||
}
|
||||
|
||||
public void Deserialize( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
switch( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_SpellType = ScriptCompiler.FindTypeByName(reader.ReadString());
|
||||
m_Icon = reader.ReadInt();
|
||||
m_Location = reader.ReadPoint3D();
|
||||
m_School = (School)reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
int bad = reader.ReadInt();
|
||||
m_Icon = reader.ReadInt();
|
||||
m_Location = reader.ReadPoint3D();
|
||||
|
||||
m_SpellType = null;
|
||||
m_School = School.Invalid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.ACC.CM;
|
||||
|
||||
namespace Server.ACC.CSS.Modules
|
||||
{
|
||||
public class IconsModule : Module
|
||||
{
|
||||
private Dictionary<Type, IconInfo> m_Icons;
|
||||
public Dictionary<Type, IconInfo> Icons { get { return m_Icons; } }
|
||||
//private Hashtable m_Icons;
|
||||
//public Hashtable Icons{ get{ return m_Icons; } }
|
||||
|
||||
public override string Name() { return "Spell Icons"; }
|
||||
|
||||
public IconsModule(Serial serial)
|
||||
: this(serial, null)
|
||||
{
|
||||
}
|
||||
|
||||
public IconsModule(Serial serial, IconInfo info)
|
||||
: base(serial)
|
||||
{
|
||||
//m_Icons = new Hashtable();
|
||||
m_Icons = new Dictionary<Type, IconInfo>();
|
||||
|
||||
Add(info);
|
||||
}
|
||||
|
||||
public void Add(IconInfo info)
|
||||
{
|
||||
if (info == null)
|
||||
return;
|
||||
|
||||
if (m_Icons.ContainsKey(info.SpellType))
|
||||
m_Icons[info.SpellType] = info;
|
||||
|
||||
else
|
||||
m_Icons.Add(info.SpellType, info);
|
||||
}
|
||||
|
||||
public IconInfo Get(Type type)
|
||||
{
|
||||
return m_Icons[type];
|
||||
}
|
||||
|
||||
public bool Contains(Type type)
|
||||
{
|
||||
return m_Icons.ContainsKey(type);
|
||||
}
|
||||
|
||||
public void Remove(Type type)
|
||||
{
|
||||
m_Icons.Remove(type);
|
||||
|
||||
if (m_Icons.Count == 0)
|
||||
CentralMemory.RemoveModule(this.Owner, (Module)this);
|
||||
}
|
||||
|
||||
public override void Append(Module mod, bool negatively)
|
||||
{
|
||||
IconsModule im = mod as IconsModule;
|
||||
List<Type> removeList = new List<Type>();
|
||||
|
||||
foreach (KeyValuePair<Type,IconInfo> kvp in im.Icons)
|
||||
{
|
||||
if (negatively)
|
||||
removeList.Add(kvp.Value.SpellType);
|
||||
else
|
||||
Add(kvp.Value);
|
||||
}
|
||||
|
||||
foreach (Type t in removeList)
|
||||
{
|
||||
Remove(t);
|
||||
}
|
||||
removeList.Clear();
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(m_Icons.Count);
|
||||
foreach (KeyValuePair<Type,IconInfo> kvp in m_Icons)
|
||||
{
|
||||
kvp.Value.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Icons = new Dictionary<Type, IconInfo>();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
IconInfo ii = new IconInfo(reader);
|
||||
if (ii.SpellType != null)
|
||||
m_Icons.Add(ii.SpellType, ii);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.ACC.CSS
|
||||
{
|
||||
public class ScrollBag : Bag
|
||||
{
|
||||
public ScrollBag()
|
||||
{
|
||||
}
|
||||
|
||||
public void PlaceItemIn( int x, int y, Item item )
|
||||
{
|
||||
AddItem( item );
|
||||
item.Location = new Point3D( x, y, 0 );
|
||||
}
|
||||
|
||||
public ScrollBag( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.ACC.CM;
|
||||
using Server.ACC.CSS.Modules;
|
||||
|
||||
namespace Server.ACC.CSS
|
||||
{
|
||||
public class ScrollGump : Gump
|
||||
{
|
||||
private CSpellInfo m_Info;
|
||||
private string m_TextHue;
|
||||
private CSpellbook m_Book;
|
||||
private CastInfo m_CastInfo;
|
||||
private CastCommandsModule m_CastCommandModule;
|
||||
|
||||
public ScrollGump(CSpellbook book, CSpellInfo info, string textHue, Mobile sender)
|
||||
: base(485, 175)
|
||||
{
|
||||
if (info == null || book == null || !CSS.Running)
|
||||
return;
|
||||
|
||||
m_Info = info;
|
||||
m_Book = book;
|
||||
m_TextHue = textHue;
|
||||
m_CastInfo = new CastInfo(info.Type, info.School);
|
||||
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Dragable = true;
|
||||
Resizable = false;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 200, 265, 9380);
|
||||
|
||||
if (info.Name != null)
|
||||
AddHtml(30, 3, 140, 20, String.Format("<basefont color=#{0}><center>{1}</center></font>", textHue, info.Name), false, false);
|
||||
|
||||
AddButton(30, 40, info.Icon, info.Icon, 3, GumpButtonType.Reply, 0);
|
||||
|
||||
AddButton(90, 40, 2331, 2338, 1, GumpButtonType.Reply, 0); //Cast
|
||||
AddLabel(120, 38, 0, "Cast");
|
||||
|
||||
//AddButton( 90, 65, 2338, 2331, 2, GumpButtonType.Reply, 0 ); //Scribe
|
||||
//AddLabel( 120, 63, 0, "Scribe" );
|
||||
|
||||
//Info
|
||||
string InfoString = "";
|
||||
if (info.Desc != null)
|
||||
InfoString += String.Format("<basefont color=black>{0}</font><br><br>", info.Desc);
|
||||
|
||||
if (info.Regs != null)
|
||||
{
|
||||
string[] Regs = info.Regs.Split(';');
|
||||
InfoString += String.Format("<basefont color=black>Reagents :</font><br><basefont color=#{0}>", textHue);
|
||||
foreach (string r in Regs)
|
||||
InfoString += String.Format("-{0}<br>", r.TrimStart());
|
||||
InfoString += "</font><br>";
|
||||
}
|
||||
|
||||
if (info.Info != null)
|
||||
{
|
||||
string[] Info = info.Info.Split(';');
|
||||
InfoString += String.Format("<basefont color=#{0}>", textHue);
|
||||
foreach (string s in Info)
|
||||
InfoString += String.Format("{0}<br>", s.TrimStart());
|
||||
InfoString += "</font><br>";
|
||||
}
|
||||
AddHtml(30, 95, 140, 130, InfoString, false, true);
|
||||
//End Info
|
||||
|
||||
#region CastInfo
|
||||
if (CentralMemory.Running)
|
||||
{
|
||||
m_CastCommandModule = (CastCommandsModule)CentralMemory.GetModule(sender.Serial, typeof(CastCommandsModule));
|
||||
|
||||
AddLabel(25, 242, 0, "Key :");
|
||||
if (m_CastCommandModule == null)
|
||||
AddTextEntry(70, 242, 100, 20, 0, 5, ""); //Key
|
||||
else
|
||||
AddTextEntry(70, 242, 100, 20, 0, 5, m_CastCommandModule.GetCommandForInfo(m_CastInfo)); //Key
|
||||
AddButton(175, 247, 2103, 2104, 4, GumpButtonType.Reply, 0); //KeyButton
|
||||
}
|
||||
#endregion //CastInfo
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 0 || !CSS.Running)
|
||||
return;
|
||||
|
||||
else if (info.ButtonID == 1)
|
||||
{
|
||||
if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Info.School))
|
||||
{
|
||||
state.Mobile.SendMessage("You are not allowed to cast this spell.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CSpellbook.MobileHasSpell(state.Mobile, m_Info.School, m_Info.Type))
|
||||
{
|
||||
state.Mobile.SendMessage("You do not have this spell.");
|
||||
return;
|
||||
}
|
||||
|
||||
Spell spell = SpellInfoRegistry.NewSpell(m_Info.Type, m_Info.School, state.Mobile, null);
|
||||
if (spell == null)
|
||||
state.Mobile.SendMessage("That spell is disabled.");
|
||||
else
|
||||
spell.Cast();
|
||||
}
|
||||
|
||||
else if (info.ButtonID == 2)
|
||||
{
|
||||
//Scribe
|
||||
}
|
||||
|
||||
else if (info.ButtonID == 3)
|
||||
{
|
||||
if (!CentralMemory.Running)
|
||||
return;
|
||||
|
||||
if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Info.School))
|
||||
return;
|
||||
|
||||
state.Mobile.SendGump(new IconPlacementGump(m_Book, state.Mobile, 100, 100, 10, m_Info.Icon, m_Info.Type, m_Info.Back, m_Book.School));
|
||||
}
|
||||
|
||||
else if (info.ButtonID == 4)
|
||||
{
|
||||
if (!CentralMemory.Running)
|
||||
return;
|
||||
|
||||
string command = info.GetTextEntry(5).Text;
|
||||
|
||||
if (command == null || command.Length == 0)
|
||||
{
|
||||
if (m_CastCommandModule == null)
|
||||
{
|
||||
state.Mobile.SendGump(new ScrollGump(m_Book, m_Info, m_TextHue, state.Mobile));
|
||||
return;
|
||||
}
|
||||
|
||||
m_CastCommandModule.RemoveCommandByInfo(m_CastInfo);
|
||||
state.Mobile.SendGump(new ScrollGump(m_Book, m_Info, m_TextHue, state.Mobile));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_CastCommandModule == null)
|
||||
{
|
||||
CentralMemory.AddModule(new CastCommandsModule(state.Mobile.Serial, command, m_CastInfo));
|
||||
state.Mobile.SendGump(new ScrollGump(m_Book, m_Info, m_TextHue, state.Mobile));
|
||||
return;
|
||||
}
|
||||
|
||||
m_CastCommandModule.Add(command, m_CastInfo);
|
||||
state.Mobile.SendGump(new ScrollGump(m_Book, m_Info, m_TextHue, state.Mobile));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
using Server.ACC.CM;
|
||||
using Server.ACC.CSS.Modules;
|
||||
|
||||
namespace Server.ACC.CSS
|
||||
{
|
||||
public class SpellIconGump : Gump
|
||||
{
|
||||
private IconInfo m_Info;
|
||||
|
||||
public SpellIconGump(IconInfo info)
|
||||
: base(((Point3D)info.Location).X, ((Point3D)info.Location).Y)
|
||||
{
|
||||
m_Info = info;
|
||||
|
||||
Closable = false;
|
||||
Disposable = false;
|
||||
Dragable = false;
|
||||
Resizable = false;
|
||||
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 54, 54, ((Point3D)info.Location).Z);
|
||||
AddButton(45, 0, 9008, 9010, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(5, 5, m_Info.Icon, m_Info.Icon, 2, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (!CSS.Running || !CentralMemory.Running)
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
IconsModule mod = new IconsModule(state.Mobile.Serial, m_Info);
|
||||
CentralMemory.AppendModule(state.Mobile.Serial, (Module)mod, true);
|
||||
state.Mobile.SendMessage("That icon has been removed and will not open again.");
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
if (!Multis.DesignContext.Check(state.Mobile))
|
||||
{
|
||||
state.Mobile.SendMessage("You cannot cast while customizing!");
|
||||
state.Mobile.SendGump(new SpellIconGump(m_Info));
|
||||
return;
|
||||
}
|
||||
if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(state.Mobile, m_Info.SpellType))
|
||||
{
|
||||
state.Mobile.SendMessage("You are not allowed to cast this spell.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CSpellbook.MobileHasSpell(state.Mobile, m_Info.School, m_Info.SpellType))
|
||||
{
|
||||
state.Mobile.SendMessage("You do not have this spell.");
|
||||
goto case 1;
|
||||
}
|
||||
|
||||
Spell spell = SpellInfoRegistry.NewSpell(m_Info.SpellType, m_Info.School, state.Mobile, null);
|
||||
if (spell != null)
|
||||
spell.Cast();
|
||||
else
|
||||
{
|
||||
state.Mobile.SendMessage("This spell has been disabled.");
|
||||
goto case 1;
|
||||
}
|
||||
|
||||
state.Mobile.SendGump(new SpellIconGump(m_Info));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Server.Items;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.ACC.CSS
|
||||
{
|
||||
public class SpellInfoRegistry
|
||||
{
|
||||
private static Hashtable m_Registry = new Hashtable();
|
||||
public static Hashtable Registry{ get{ return m_Registry; } set{ m_Registry = value; } }
|
||||
|
||||
public static void Register( Type type, string name, string desc, string regs, string info, int icon, int back, School school )
|
||||
{
|
||||
if( !m_Registry.ContainsKey( school ) )
|
||||
m_Registry.Add( school, new ArrayList() );
|
||||
|
||||
if( ((ArrayList)m_Registry[school]).Count < 64 )
|
||||
{
|
||||
CSpellInfo inf = new CSpellInfo( type, name, desc, regs, info, icon, back, school, true );
|
||||
|
||||
((ArrayList)m_Registry[school]).Add( inf );
|
||||
}
|
||||
else
|
||||
Console.WriteLine( "You cannot register more than 64 spells to the {0} school.", school );
|
||||
}
|
||||
|
||||
public static void DisEnable( School school, Type type, bool enabled )
|
||||
{
|
||||
foreach( CSpellInfo info in (ArrayList)m_Registry[school] )
|
||||
{
|
||||
if( info.Type == type )
|
||||
info.Enabled = enabled;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckRegistry( School school, Type type )
|
||||
{
|
||||
if( !CSS.Running )
|
||||
return false;
|
||||
|
||||
if( school == School.Invalid )
|
||||
return true;
|
||||
|
||||
if( m_Registry.ContainsKey( school ) )
|
||||
{
|
||||
foreach( CSpellInfo info in (ArrayList)m_Registry[school] )
|
||||
{
|
||||
if( info.Type == type && info.Enabled )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool CheckBooksForSchool( Mobile mobile, Type type )
|
||||
{
|
||||
Item item = mobile.FindItemOnLayer( Layer.OneHanded );
|
||||
if( item is CSpellbook && CheckRegistry( ((CSpellbook)item).School, type ) )
|
||||
return true;
|
||||
|
||||
Container pack = mobile.Backpack;
|
||||
if( pack == null )
|
||||
return false;
|
||||
|
||||
for( int i = 0; i < pack.Items.Count; i++ )
|
||||
{
|
||||
item = (Item)pack.Items[i];
|
||||
if( item is CSpellbook && CheckRegistry( ((CSpellbook)item).School, type ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static CSpellInfo GetInfo( School school, Type type )
|
||||
{
|
||||
if( m_Registry.ContainsKey( school ) )
|
||||
{
|
||||
foreach( CSpellInfo info in (ArrayList)m_Registry[school] )
|
||||
{
|
||||
if( info.Type == type && info.Enabled )
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ArrayList GetSpellsForSchool( School school )
|
||||
{
|
||||
ArrayList ret = new ArrayList();
|
||||
if( m_Registry.ContainsKey( school ) )
|
||||
{
|
||||
foreach( CSpellInfo info in (ArrayList)m_Registry[school] )
|
||||
{
|
||||
ret.Add( info.Type );
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static object[] m_Params = new object[2];
|
||||
|
||||
public static Spell NewSpell( Type type, School school, Mobile caster, Item scroll )
|
||||
{
|
||||
if( !CSS.Running )
|
||||
return null;
|
||||
else if( school == School.Invalid && scroll == null && !CheckBooksForSchool( caster, type ) )
|
||||
return null;
|
||||
else if( !CheckRegistry( school, type ) )
|
||||
return null;
|
||||
else if( !SpellRestrictions.UseRestrictions && SpellRestrictions.CheckRestrictions( caster, type ) )
|
||||
return null;
|
||||
|
||||
m_Params[0] = caster;
|
||||
m_Params[1] = scroll;
|
||||
|
||||
return (Spell)Activator.CreateInstance( type, m_Params );;
|
||||
}
|
||||
}
|
||||
|
||||
public class CSpellInfo
|
||||
{
|
||||
private Type m_Type;
|
||||
private string m_Name;
|
||||
private string m_Desc;
|
||||
private string m_Regs;
|
||||
private string m_Info;
|
||||
private int m_Icon;
|
||||
private int m_Back;
|
||||
private School m_School;
|
||||
private bool m_Enabled;
|
||||
|
||||
public Type Type { get{ return m_Type; } }
|
||||
public string Name { get{ return m_Name; } }
|
||||
public string Desc { get{ return m_Desc; } }
|
||||
public string Regs { get{ return m_Regs; } }
|
||||
public string Info { get{ return m_Info; } }
|
||||
public int Icon { get{ return m_Icon; } }
|
||||
public int Back { get{ return m_Back; } }
|
||||
public School School { get{ return m_School; } }
|
||||
public bool Enabled{ get{ return m_Enabled; } set{ m_Enabled = value; } }
|
||||
|
||||
public CSpellInfo( Type type, string name, string desc, string regs, string info, int icon, int back, School school, bool enabled )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Name = name;
|
||||
m_Desc = desc;
|
||||
m_Regs = regs;
|
||||
m_Info = info;
|
||||
m_Icon = icon;
|
||||
m_Back = back;
|
||||
m_School = school;
|
||||
m_Enabled = enabled;
|
||||
}
|
||||
|
||||
public CSpellInfo( GenericReader reader )
|
||||
{
|
||||
Deserialize( reader );
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( (int)0 ); //version
|
||||
|
||||
writer.Write( (string)m_Type.Name );
|
||||
writer.Write( (int)m_School );
|
||||
writer.Write( (bool)m_Enabled );
|
||||
}
|
||||
|
||||
public void Deserialize( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Type = ScriptCompiler.FindTypeByName(reader.ReadString());
|
||||
m_School = (School)reader.ReadInt();
|
||||
m_Enabled = reader.ReadBool();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user