Exemplo n.º 1
0
 private static Spell registerSpell(Spell h)
 {
     if (h == null) return null;
     lock (SpellLock) {
         if (_spellIdMap.ContainsKey(h.id)) {
             h.image.Dispose();
             return _spellIdMap[h.id];
         }
         _spellIdMap.Add(h.id, h);
         string name = h.name.ToLower();
         if (!_spellNameMap.ContainsKey(name)) {
             _spellNameMap.Add(h.name.ToLower(), h);
         }
     }
     return h;
 }
Exemplo n.º 2
0
        public static void ShowSpellNotification(Spell spell, int initialVocation, string comm)
        {
            SpellForm f = new SpellForm(spell, initialVocation);

            ShowNotification(f, comm);
        }
Exemplo n.º 3
0
        private static Spell createSpell(SQLiteDataReader reader)
        {
            SQLiteCommand command;

            if (!reader.Read()) {
                return null;
            }

            Spell spell = new Spell();
            spell.permanent = true;
            spell.id = reader.GetInt32(0);
            spell.name = reader["name"].ToString();
            spell.words = reader["words"].ToString();
            spell.element = reader.IsDBNull(3) ? "Unknown" : reader.GetString(3);
            spell.cooldown = reader.IsDBNull(4) ? DATABASE_NULL : reader.GetInt32(4);
            spell.premium = reader.GetBoolean(5);
            spell.promotion = reader.GetBoolean(6);
            spell.levelrequired = reader.GetInt32(7);
            spell.goldcost = reader.GetInt32(8);
            spell.manacost = reader.GetInt32(9);
            spell.knight = reader.GetBoolean(10);
            spell.paladin = reader.GetBoolean(11);
            spell.sorcerer = reader.GetBoolean(12);
            spell.druid = reader.GetBoolean(13);
            spell.image = Image.FromStream(reader.GetStream(14));

            command = new SQLiteCommand(String.Format("SELECT npcid, knight, druid, paladin, sorcerer FROM SpellNPCs WHERE spellid={0}", spell.id), mainForm.conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                SpellTaught t = new SpellTaught();
                t.npcid = reader.GetInt32(0);
                t.spellid = spell.id;
                t.knight = reader.GetBoolean(1);
                t.druid = reader.GetBoolean(2);
                t.paladin = reader.GetBoolean(3);
                t.sorcerer = reader.GetBoolean(4);
                spell.teachNPCs.Add(t);
            }
            return spell;
        }
Exemplo n.º 4
0
 public SpellForm(Spell spell, int initialVocation)
 {
     this.InitializeComponent();
     this.spell = spell;
     this.currentVocation = initialVocation;
 }