public void NewInstance(string instanceName, Map initialMap) { if (instances.ContainsKey(instanceName)) { return; } initialMap.InstanceName = instanceName; instances.Add(instanceName, new List<Map>() { initialMap }); playerCounter.Add(instanceName, 0); }
private void ChangeArea(string[] args, int length, string full, Client client) { var name = args[1].Trim('\"'); var foundPlayer = false; var id = Helper.FindPlayerByUsername(name); if (id != -1) foundPlayer = true; // Couldn't find the username if (!foundPlayer) { Logger.WriteError("[CMD] Could not find user " + name); return; } Client context = PolarisApp.Instance.Server.Clients[id]; Map dstMap = null; if (!ZoneManager.Instance.InstanceExists(String.Format("tpinstance_{0}_{1}", Int32.Parse(args[3]), Int32.Parse(args[8])))) { dstMap = new Map("tpmap", Int32.Parse(args[3]), Int32.Parse(args[8]), (Map.MapType)Int32.Parse(args[2]), (Map.MapFlags)Int32.Parse(args[4])) { GenerationArgs = new Map.GenParam() { seed = Int32.Parse(args[5]), xsize = Int32.Parse(args[6]), ysize = Int32.Parse(args[7]) } }; ZoneManager.Instance.NewInstance(String.Format("tpinstance_{0}", Int32.Parse(args[3])), dstMap); } else { dstMap = ZoneManager.Instance.MapFromInstance("tpmap", String.Format("tpinstance_{0}_{1}", Int32.Parse(args[3]), Int32.Parse(args[8]))); } dstMap.SpawnClient(context, dstMap.GetDefaultLocation()); //PSOLocation destination = new PSOLocation(float.Parse(args[2]), float.Parse(args[3]), float.Parse(args[4]), float.Parse(args[5]),float.Parse(args[6]), float.Parse(args[7]), float.Parse(args[8])); //PolarisApp.Instance.Server.Clients[id].SendPacket(new TeleportTransferPacket(ObjectManager.Instance.getObjectByID("lobby", 443), destination)); context.SendPacket(0x8, 0xB, 0x0, ObjectManager.Instance.getObjectByID(443).GenerateSpawnBlob()); //var objects = ObjectManager.Instance.getObjectsForZone("casino").Values; //foreach (var obj in objects) //{ // context.SendPacket(0x8, 0xB, 0x0, obj.GenerateSpawnBlob()); //} context.SendPacket(new NoPayloadPacket(0x03, 0x2B)); }
public void AddMapToInstance(string instance, Map m) { List<Map> maps = instances[instance]; if (!maps.Contains(m)) maps.Add(m); }