private static void ImportSpawner(XmlElement node, string mapa, string tipo) { int count = int.Parse(GetText(node["count"], "1")); int homeRange = int.Parse(GetText(node["homerange"], "4")); int team = int.Parse(GetText(node["team"], "0")); bool group = bool.Parse(GetText(node["group"], "False")); TimeSpan maxDelay = TimeSpan.Parse(GetText(node["maxdelay"], "10:00")); TimeSpan minDelay = TimeSpan.Parse(GetText(node["mindelay"], "05:00")); ArrayList creaturesName = LoadCreaturesName(node["creaturesname"]); string name = GetText(node["name"], "Spawner"); Point3D location = Point3D.Parse(GetText(node["location"], "Error")); Map map = Map.Parse(GetText(node["map"], "Error")); if (map.Name == mapa) { if (tipo == "odbc") { ODBCSpawner spawner = new ODBCSpawner(count, minDelay, maxDelay, team, homeRange, creaturesName); spawner.Name = name; spawner.MoveToWorld(location, map); if (spawner.Map == Map.Internal) { spawner.Delete(); throw new Exception("Spawner created on Internal map."); } spawner.Respawn(); } else { // Genova: necessário converter creaturesName para list<string>. List <string> listaCreaturesName = new List <string>(); listaCreaturesName.CopyTo(creaturesName.ToArray(typeof(string)) as string[]); Spawner spawner = new Spawner(count, minDelay, maxDelay, team, homeRange, listaCreaturesName); spawner.Name = name; spawner.MoveToWorld(location, map); if (spawner.Map == Map.Internal) { spawner.Delete(); throw new Exception("Spawner created on Internal map."); } spawner.Respawn(); } } }
public override void OnResponse(NetState state, RelayInfo info) { if (m_ODBCSpawner.Deleted) { return; } switch (info.ButtonID) { case 0: // Closed { break; } case 1: // Okay { m_ODBCSpawner.CreaturesName = CreateArray(info, state.Mobile); break; } case 2: // Bring everything home { m_ODBCSpawner.BringToHome(); break; } case 3: // Complete respawn { m_ODBCSpawner.Respawn(); break; } default: { int buttonID = info.ButtonID - 4; int index = buttonID / 2; int type = buttonID % 2; TextRelay entry = info.GetTextEntry(index); if (entry != null && entry.Text.Length > 0) { if (type == 0) // Spawn creature { m_ODBCSpawner.Spawn(entry.Text); } else // Remove creatures { m_ODBCSpawner.RemoveCreatures(entry.Text); } m_ODBCSpawner.CreaturesName = CreateArray(info, state.Mobile); } break; } } }
private static void ImportSpawner(XmlElement node, string mapa, string tipo) { int count = int.Parse(GetText(node["count"], "1")); int homeRange = int.Parse(GetText(node["homerange"], "4")); int team = int.Parse(GetText(node["team"], "0")); bool group = bool.Parse(GetText(node["group"], "False")); TimeSpan maxDelay = TimeSpan.Parse(GetText(node["maxdelay"], "10:00")); TimeSpan minDelay = TimeSpan.Parse(GetText(node["mindelay"], "05:00")); ArrayList creaturesName = LoadCreaturesName(node["creaturesname"]); string name = GetText(node["name"], "Spawner"); Point3D location = Point3D.Parse(GetText(node["location"], "Error")); Map map = Map.Parse(GetText(node["map"], "Error")); if (map.Name == mapa) { if (tipo == "odbc") { ODBCSpawner spawner = new ODBCSpawner(count, minDelay, maxDelay, team, homeRange, creaturesName); spawner.Name = name; spawner.MoveToWorld(location, map); if (spawner.Map == Map.Internal) { spawner.Delete(); throw new Exception("Spawner created on Internal map."); } spawner.Respawn(); } else { // Genova: necessário converter creaturesName para list<string>. List<string> listaCreaturesName = new List<string>(); listaCreaturesName.CopyTo(creaturesName.ToArray(typeof(string)) as string[]); Spawner spawner = new Spawner(count, minDelay, maxDelay, team, homeRange, listaCreaturesName); spawner.Name = name; spawner.MoveToWorld(location, map); if (spawner.Map == Map.Internal) { spawner.Delete(); throw new Exception("Spawner created on Internal map."); } spawner.Respawn(); } } }