private void InitStats() { ExperienceBoost = 0; Online = TimeSpan.Zero; Gold = 0; Level = 1; Exp = 0; ExpPrevious = 0; ExpNext = 100; StatPoints = 0; Map = MobMap.Lorencia; if (Class == HeroClass.Elf) { //Map = "noria.map"; Str = 22; Agi = 25; Vit = 20; Ene = 15; } else if (Class == HeroClass.Knight) { Str = 28; Agi = 20; Vit = 25; Ene = 10; } else if (Class == HeroClass.Wizard) { Str = 18; Agi = 18; Vit = 15; Ene = 30; } }
private void TransferClient(ServerClient c, MobMap dst) { ClientMutex.WaitOne(); c.Room.Clients.Remove(c); c.Room = Rooms[dst]; Rooms[dst].Clients.Add(c); ClientMutex.ReleaseMutex(); }
public static Mob MobServer(MobClass mobclass, MobMap map, Vector2 pos) { Mob m = new Mob(); m.Target = m.Position = new Vector3(pos, ZLayer.Npc); m.Map = map; m.Netid = NextNetid++; m.Class = mobclass; m.StartRoaming(); m.StartUpdatingPos(); return(m); }
public Mob SpawnMob(MobClass mobclas, MobMap map, Vector2 pos) { Mob m = Mob.MobServer(mobclas, map, pos); m.Position = new Vector3(pos, ZLayer.Npc); MapRoom room = Rooms[map]; room.Mobs.Add(m); m.Room = room; foreach (ServerClient c in room.Clients) { c.SendNewMob(m); } return(m); }
/// <summary> /// Sends newly connected client data about players, monsters and items on the ground /// </summary> /// <param name="c"></param> private void InitNewPlayer(ServerClient client, byte[] rawData) { var data = Functions.GetData(rawData); client.Hero.Name = data[0] as string; client.Hero.Class = (HeroClass)Convert.ToChar(data[1]); MobMap heroMap = (MobMap)Convert.ToChar(data[2]); TransferClient(client, heroMap); client.Hero.Position = new Vector3(0, 0, 0); //tell old players about new player and new player about old players foreach (var c in client.Room.Clients.Where(c1 => c1 != client)) { client.SendAddPlayer(c.Hero); c.SendAddPlayer(client.Hero); } //send mob data foreach (Mob m in client.Room.Mobs) { client.SendNewMob(m); } }
public static string MobmapToString(this MobMap map) { switch (map) { case MobMap.Lorencia: return("lorencia.map"); case MobMap.Noria: return("noria.map"); case MobMap.Dungeon: return("dungeon.map"); case MobMap.Devias: return("devias.map"); case MobMap.LostTower: return("losttower.map"); default: throw new NotImplementedException("This map is not implemented"); } }
private void TransferClient(ServerClient c, MobMap dst) { ClientMutex.WaitOne(); c.Room.Clients.Remove(c); c.Room = Rooms[dst]; Rooms[dst].Clients.Add(c); ClientMutex.ReleaseMutex(); }
public MapRoom(MobMap map) { Map = map; Clients = new List <ServerClient>(); Mobs = new PositionedObjectList <Mob>(); }
private void InitStats() { ExperienceBoost = 0; Online = TimeSpan.Zero; Gold = 0; Level = 1; Exp = 0; ExpPrevious = 0; ExpNext = 100; StatPoints = 0; Map = MobMap.Lorencia; if (Class == HeroClass.Elf) { //Map = "noria.map"; Str = 22; Agi = 25; Vit = 20; Ene = 15; } else if (Class == HeroClass.Knight) { Str = 28; Agi = 20; Vit = 25; Ene = 10; } else if (Class == HeroClass.Wizard) { Str = 18; Agi = 18; Vit = 15; Ene = 30; } }
public Mob SpawnMob(MobClass mobclas, MobMap map, Vector2 pos) { Mob m = Mob.MobServer(mobclas, map, pos); m.Position = new Vector3(pos, ZLayer.Npc); MapRoom room = Rooms[map]; room.Mobs.Add(m); m.Room = room; foreach (ServerClient c in room.Clients) c.SendNewMob(m); return m; }
public MapRoom(MobMap map) { Map = map; Clients = new List<ServerClient>(); Mobs = new PositionedObjectList<Mob>(); }
public static Mob MobServer(MobClass mobclass, MobMap map, Vector2 pos) { Mob m = new Mob(); m.Target = m.Position = new Vector3(pos, ZLayer.Npc); m.Map = map; m.Netid = NextNetid++; m.Class = mobclass; m.StartRoaming(); m.StartUpdatingPos(); return m; }