7 | 8 | ||
---|---|---|---|
6 | using Trom.World; | 6 | using Trom.World; |
7 | using System.Runtime.CompilerServices; | 7 | using System.Runtime.CompilerServices; |
8 | using System.Timers; | 8 | using System.Timers; |
9 | using System.Threading; | ||
9 | 10 | ||
10 | namespace Trom.DataObject | 11 | namespace Trom.DataObject |
11 | { | 12 | { |
... | ... | ||
24 | private static Dictionary<int, List<SpellLevel>> mySpells = new Dictionary<int, List<SpellLevel>>(); | 25 | private static Dictionary<int, List<SpellLevel>> mySpells = new Dictionary<int, List<SpellLevel>>(); |
25 | private static Dictionary<long, ItemTemplate> myItemTemplates = new Dictionary<long, ItemTemplate>(); | 26 | private static Dictionary<long, ItemTemplate> myItemTemplates = new Dictionary<long, ItemTemplate>(); |
26 | private static Dictionary<int, Experience> myExperienceFloors = new Dictionary<int, Experience>(); | 27 | private static Dictionary<int, Experience> myExperienceFloors = new Dictionary<int, Experience>(); |
28 | private static Dictionary<int, Monster> myMonsters = new Dictionary<int, Monster>(); | ||
27 | private static Dictionary<string, Account> myAccountByName = new Dictionary<string, Account>(); | 29 | private static Dictionary<string, Account> myAccountByName = new Dictionary<string, Account>(); |
28 | private static Dictionary<int, Account> myAccountById = new Dictionary<int, Account>(); | 30 | private static Dictionary<int, Account> myAccountById = new Dictionary<int, Account>(); |
29 | private static List<Character> myCharacters = new List<Character>(); | 31 | private static List<Character> myCharacters = new List<Character>(); |
... | ... | ||
78 | myAccountByName.Add(Account.Name.ToLower(), Account); | 80 | myAccountByName.Add(Account.Name.ToLower(), Account); |
79 | } | 81 | } |
80 | 82 | ||
81 | var Timer = new Timer(60000); | 83 | foreach (var Monster in myEntities.Monster) |
84 | { | ||
85 | Monster.Initialize(); | ||
86 | myMonsters.Add(Monster.MONSTER_ID, Monster); | ||
87 | } | ||
88 | | ||
89 | var Timer = new System.Timers.Timer(1000 * 60 * 5); | ||
82 | Timer.Elapsed += delegate(object sender, ElapsedEventArgs e) | 90 | Timer.Elapsed += delegate(object sender, ElapsedEventArgs e) |
83 | { | 91 | { |
84 | Save(); | 92 | Save(); |
... | ... | ||
168 | } | 176 | } |
169 | 177 | ||
170 | /// <summary> | 178 | /// <summary> |
179 | /// Recuperation d'un monstre | ||
180 | /// </summary> | ||
181 | /// <param name="MonsterId"></param> | ||
182 | /// <returns></returns> | ||
183 | public static Monster GetMonster(int MonsterId) | ||
184 | { | ||
185 | Monster Monster; | ||
186 | myMonsters.TryGetValue(MonsterId, out Monster); | ||
187 | return Monster; | ||
188 | } | ||
189 | |||
190 | /// <summary> | ||
171 | /// Retourne le template d'item par son id | 191 | /// Retourne le template d'item par son id |
172 | /// </summary> | 192 | /// </summary> |
173 | /// <param name="Id"></param> | 193 | /// <param name="Id"></param> |