public static BattleGame StartBattleGame(List <IGamePlayer> red, ProxyRoom roomRed, List <IGamePlayer> blue, ProxyRoom roomBlue, int mapIndex, eRoomType roomType, eGameType gameType, int timeType) { try { int index = MapMgr.GetMapIndex(mapIndex, (byte)roomType, m_serverId); Map map = MapMgr.CloneMap(index); if (map != null) { BattleGame game = new BattleGame(m_gameId++, red, roomRed, blue, roomBlue, map, roomType, gameType, timeType); lock (m_games) { m_games.Add(game.Id, game); } game.Prepare(); SendStartMessage(game); return(game); } else { return(null); } } catch (Exception e) { log.Error("Create battle game error:", e); return(null); } }
private void HandlePlayerExit(GSPacketIn pkg) { BaseGame game = GameMgr.FindGame(pkg.ClientID); if (game != null) { Player player = game.FindPlayer(pkg.Parameter1); if (player != null) { GSPacketIn pkg1 = new GSPacketIn((byte)eFightPackageType.DISCONNECT, player.PlayerDetail.PlayerCharacter.ID); game.SendToAll(pkg1); game.RemovePlayer(player.PlayerDetail, false); ProxyRoom room = ProxyRoomMgr.GetRoomUnsafe((game as BattleGame).Red.RoomId); if (room != null) { if (!room.RemovePlayer(player.PlayerDetail)) { ProxyRoom room1 = ProxyRoomMgr.GetRoomUnsafe((game as BattleGame).Blue.RoomId); if (room1 != null) { room1.RemovePlayer(player.PlayerDetail); } } } } } }
public void HandleGameRoomCancel(GSPacketIn pkg) { ProxyRoom room = null; lock (m_rooms) { if (m_rooms.ContainsKey(pkg.Parameter1)) { room = m_rooms[pkg.Parameter1]; } } if (room != null) { ProxyRoomMgr.RemoveRoom(room); } }
public void RemoveRoom(int orientId, ProxyRoom room) { bool result = false; lock (m_rooms) { if (m_rooms.ContainsKey(orientId) && m_rooms[orientId] == room) { result = m_rooms.Remove(orientId); } } if (result) { SendRemoveRoom(orientId); } }
private void RepaintRoom(int minimapX, int minimapY, int mapX, int mapY) { if (mapY < 0 || mapY >= GameManager.Instance.Data.CurrentLevel.map.Count() || GameManager.Instance.Data.CurrentLevel.map[mapY] == null) { walls[6 * (minimapY * 3 + minimapX)].gameObject.SetActive(false); walls[6 * (minimapY * 3 + minimapX) + 1].gameObject.SetActive(false); walls[6 * (minimapY * 3 + minimapX) + 2].gameObject.SetActive(false); walls[6 * (minimapY * 3 + minimapX) + 3].gameObject.SetActive(false); walls[6 * (minimapY * 3 + minimapX) + 4].gameObject.SetActive(false); walls[6 * (minimapY * 3 + minimapX) + 5].gameObject.SetActive(false); return; } // When the map gets serialized, the 'empty' rooms become non null, because f**k me, right? if (mapX < 0 || mapX >= GameManager.Instance.Data.CurrentLevel.map[mapY].rooms.Count() || GameManager.Instance.Data.CurrentLevel.map[mapY].rooms[mapX] == null || string.IsNullOrWhiteSpace(GameManager.Instance.Data.CurrentLevel.map[mapY].rooms[mapX].left)) { walls[6 * (minimapY * 3 + minimapX)].gameObject.SetActive(false); walls[6 * (minimapY * 3 + minimapX) + 1].gameObject.SetActive(false); walls[6 * (minimapY * 3 + minimapX) + 2].gameObject.SetActive(false); walls[6 * (minimapY * 3 + minimapX) + 3].gameObject.SetActive(false); walls[6 * (minimapY * 3 + minimapX) + 4].gameObject.SetActive(false); walls[6 * (minimapY * 3 + minimapX) + 5].gameObject.SetActive(false); return; } ProxyRoom room = GameManager.Instance.Data.CurrentLevel.map[mapY].rooms[mapX]; Sprite blSprite = FindChunkObject("bl", room.left, room.bottom); Sprite brSprite = FindChunkObject("br", room.right, room.bottom); Sprite tlSprite = FindChunkObject("tl", room.left, room.top); Sprite trSprite = FindChunkObject("tr", room.right, room.top); //FIXME: Test for null walls[6 * (minimapY * 3 + minimapX)].sprite = tlSprite; walls[6 * (minimapY * 3 + minimapX)].gameObject.SetActive(true); walls[6 * (minimapY * 3 + minimapX) + 1].sprite = trSprite; walls[6 * (minimapY * 3 + minimapX) + 1].gameObject.SetActive(true); walls[6 * (minimapY * 3 + minimapX) + 2].sprite = blSprite; walls[6 * (minimapY * 3 + minimapX) + 2].gameObject.SetActive(true); walls[6 * (minimapY * 3 + minimapX) + 3].sprite = brSprite; walls[6 * (minimapY * 3 + minimapX) + 3].gameObject.SetActive(true); walls[6 * (minimapY * 3 + minimapX) + 4].gameObject.SetActive(GameManager.Instance.Data.CurrentLevel.map[mapY].rooms[mapX].isEntry); walls[6 * (minimapY * 3 + minimapX) + 5].gameObject.SetActive(GameManager.Instance.Data.CurrentLevel.map[mapY].rooms[mapX].isEnd); }
public static BattleGame StartBattleGame(List <IGamePlayer> red, ProxyRoom roomRed, List <IGamePlayer> blue, ProxyRoom roomBlue, int mapIndex, eRoomType roomType, eGameType gameType, int timeType) { BattleGame result; try { int index = MapMgr.GetMapIndex(mapIndex, (byte)roomType, GameMgr.m_serverId); Map map = MapMgr.AllocateMapInstance(index); if (map != null) { BattleGame game = new BattleGame(GameMgr.m_gameId++, red, roomRed, blue, roomBlue, map, roomType, gameType, timeType, 0); game.GameOverLog += new BaseGame.GameOverLogEventHandle(roomRed.LogFight); Dictionary <int, BaseGame> games; Monitor.Enter(games = GameMgr.m_games); try { GameMgr.m_games.Add(game.Id, game); } finally { Monitor.Exit(games); } game.Prepare(); GameMgr.SendStartMessage(game); GameMgr.SendBufferList(game); GameMgr.UpdatePlayerGameId(game); result = game; } else { result = null; } } catch (Exception e) { GameMgr.log.Error("Create battle game error:", e); result = null; } return(result); }
public void HandleGameRoomCancel(GSPacketIn pkg) { ProxyRoom room = null; Dictionary <int, ProxyRoom> rooms; Monitor.Enter(rooms = this.m_rooms); try { if (this.m_rooms.ContainsKey(pkg.Parameter1)) { room = this.m_rooms[pkg.Parameter1]; } } finally { Monitor.Exit(rooms); } if (room != null) { ProxyRoomMgr.RemoveRoom(room); } }
private void HandleChangeGameType(GSPacketIn pkg) { ProxyRoom room = null; Dictionary <int, ProxyRoom> rooms; Monitor.Enter(rooms = this.m_rooms); try { if (this.m_rooms.ContainsKey(pkg.Parameter1)) { room = this.m_rooms[pkg.Parameter1]; } } finally { Monitor.Exit(rooms); } if (room != null) { room.GameType = (eGameType)pkg.ReadInt(); } }
public void RemoveRoom(int orientId, ProxyRoom room) { bool flag = false; Dictionary <int, ProxyRoom> rooms; Monitor.Enter(rooms = this.m_rooms); try { if (this.m_rooms.ContainsKey(orientId) && this.m_rooms[orientId] == room) { flag = this.m_rooms.Remove(orientId); } } finally { Monitor.Exit(rooms); } if (flag) { this.SendRemoveRoom(orientId); } }
public void PickUpNPC(int orientId, ProxyRoom room) { bool result = false; Dictionary <int, ProxyRoom> rooms; Monitor.Enter(rooms = this.m_rooms); try { if (this.m_rooms.ContainsKey(orientId) && this.m_rooms[orientId] == room) { result = this.m_rooms.Remove(orientId); } } finally { Monitor.Exit(rooms); } if (result) { this.SendPickUpNPC(orientId, room.RoomId); } }
public static BattleGame StartBattleGame(List <IGamePlayer> red, ProxyRoom roomRed, List <IGamePlayer> blue, ProxyRoom roomBlue, int mapIndex, eRoomType roomType, eGameType gameType, int timeType) { BattleGame result; try { int mapIndex2 = MapMgr.GetMapIndex(mapIndex, (byte)roomType, GameMgr.m_serverId); Map map = MapMgr.CloneMap(mapIndex2); List <PetSkillElementInfo> gameNeedPetSkill = PetMgr.GameNeedPetSkill(); if (map != null) { BattleGame battleGame = new BattleGame(GameMgr.m_gameId++, red, roomRed, blue, roomBlue, map, roomType, gameType, timeType, gameNeedPetSkill); Dictionary <int, BaseGame> games; Monitor.Enter(games = GameMgr.m_games); try { GameMgr.m_games.Add(battleGame.Id, battleGame); } finally { Monitor.Exit(games); } battleGame.Prepare(); GameMgr.SendStartMessage(battleGame); result = battleGame; } else { result = null; } } catch (Exception exception) { GameMgr.log.Error("Create battle game error:", exception); result = null; } return(result); }
private void HandlePlayerExit(GSPacketIn pkg) { BaseGame baseGame = GameMgr.FindGame(pkg.ClientID); if (baseGame != null) { Player player = baseGame.FindPlayer(pkg.Parameter1); if (player != null) { GSPacketIn pkg2 = new GSPacketIn(83, player.PlayerDetail.PlayerCharacter.ID); baseGame.SendToAll(pkg2); baseGame.RemovePlayer(player.PlayerDetail, false); ProxyRoom roomUnsafe = ProxyRoomMgr.GetRoomUnsafe((baseGame as BattleGame).Red.RoomId); if (roomUnsafe != null && !roomUnsafe.RemovePlayer(player.PlayerDetail)) { ProxyRoom roomUnsafe2 = ProxyRoomMgr.GetRoomUnsafe((baseGame as BattleGame).Blue.RoomId); if (roomUnsafe2 != null) { roomUnsafe2.RemovePlayer(player.PlayerDetail); } } } } }
private void HandlerPickUpNPC(GSPacketIn pkg) { int roomid = pkg.ReadInt(); ProxyRoom room = null; Dictionary <int, ProxyRoom> rooms; Monitor.Enter(rooms = this.m_rooms); try { if (this.m_rooms.ContainsKey(roomid)) { room = this.m_rooms[roomid]; } } finally { Monitor.Exit(rooms); } if (room != null && room.PickUpCount >= 2) { Console.WriteLine("可以撮合NPC"); ProxyRoomMgr.FightWithNPC(room); } }
public BattleGame(int id, List <IGamePlayer> red, ProxyRoom roomRed, List <IGamePlayer> blue, ProxyRoom roomBlue, Map map, eRoomType roomType, eGameType gameType, int timeType, List <PetSkillElementInfo> gameNeedPetSkill) : base(id, roomBlue.RoomId, red, blue, map, roomType, gameType, timeType, gameNeedPetSkill) { this.m_roomRed = roomRed; this.m_roomBlue = roomBlue; }
public BattleGame(int id, List <IGamePlayer> red, ProxyRoom roomRed, List <IGamePlayer> blue, ProxyRoom roomBlue, Map map, eRoomType roomType, eGameType gameType, int timeType) : base(id, roomBlue.RoomId, red, blue, map, roomType, gameType, timeType) { m_roomRed = roomRed; m_roomBlue = roomBlue; }
public void HandleGameRoomCreate(GSPacketIn pkg) { int num = pkg.ReadInt(); int gameType = pkg.ReadInt(); int guildId = pkg.ReadInt(); int num2 = pkg.ReadInt(); int num3 = 0; IGamePlayer[] array = new IGamePlayer[num2]; for (int i = 0; i < num2; i++) { PlayerInfo playerInfo = new PlayerInfo(); playerInfo.ID = pkg.ReadInt(); playerInfo.NickName = pkg.ReadString(); playerInfo.Sex = pkg.ReadBoolean(); playerInfo.typeVIP = pkg.ReadByte(); playerInfo.VIPLevel = pkg.ReadInt(); playerInfo.Hide = pkg.ReadInt(); playerInfo.Style = pkg.ReadString(); playerInfo.Colors = pkg.ReadString(); playerInfo.Skin = pkg.ReadString(); playerInfo.Offer = pkg.ReadInt(); playerInfo.GP = pkg.ReadInt(); playerInfo.Grade = pkg.ReadInt(); playerInfo.Repute = pkg.ReadInt(); playerInfo.ConsortiaID = pkg.ReadInt(); playerInfo.ConsortiaName = pkg.ReadString(); playerInfo.ConsortiaLevel = pkg.ReadInt(); playerInfo.ConsortiaRepute = pkg.ReadInt(); playerInfo.badgeID = pkg.ReadInt(); playerInfo.weaklessGuildProgress = Base64.decodeToByteArray(pkg.ReadString()); playerInfo.Attack = pkg.ReadInt(); playerInfo.Defence = pkg.ReadInt(); playerInfo.Agility = pkg.ReadInt(); playerInfo.Luck = pkg.ReadInt(); playerInfo.hp = pkg.ReadInt(); playerInfo.FightPower = pkg.ReadInt(); playerInfo.IsMarried = pkg.ReadBoolean(); if (playerInfo.IsMarried) { playerInfo.SpouseID = pkg.ReadInt(); playerInfo.SpouseName = pkg.ReadString(); } ProxyPlayerInfo proxyPlayerInfo = new ProxyPlayerInfo(); proxyPlayerInfo.BaseAttack = pkg.ReadDouble(); proxyPlayerInfo.BaseDefence = pkg.ReadDouble(); proxyPlayerInfo.BaseAgility = pkg.ReadDouble(); proxyPlayerInfo.BaseBlood = pkg.ReadDouble(); proxyPlayerInfo.TemplateId = pkg.ReadInt(); proxyPlayerInfo.CanUserProp = pkg.ReadBoolean(); proxyPlayerInfo.SecondWeapon = pkg.ReadInt(); proxyPlayerInfo.StrengthLevel = pkg.ReadInt(); proxyPlayerInfo.GPAddPlus = pkg.ReadDouble(); proxyPlayerInfo.OfferAddPlus = pkg.ReadDouble(); proxyPlayerInfo.AntiAddictionRate = pkg.ReadDouble(); proxyPlayerInfo.ServerId = pkg.ReadInt(); UsersPetinfo usersPetinfo = new UsersPetinfo(); int num4 = pkg.ReadInt(); if (num4 == 1) { usersPetinfo.Place = pkg.ReadInt(); usersPetinfo.TemplateID = pkg.ReadInt(); usersPetinfo.ID = pkg.ReadInt(); usersPetinfo.Name = pkg.ReadString(); usersPetinfo.UserID = pkg.ReadInt(); usersPetinfo.Level = pkg.ReadInt(); usersPetinfo.Skill = pkg.ReadString(); usersPetinfo.SkillEquip = pkg.ReadString(); } else { usersPetinfo = null; } List <BufferInfo> list = new List <BufferInfo>(); int num5 = pkg.ReadInt(); for (int j = 0; j < num5; j++) { BufferInfo bufferInfo = new BufferInfo(); bufferInfo.Type = pkg.ReadInt(); bufferInfo.IsExist = pkg.ReadBoolean(); bufferInfo.BeginDate = pkg.ReadDateTime(); bufferInfo.ValidDate = pkg.ReadInt(); bufferInfo.Value = pkg.ReadInt(); bufferInfo.ValidCount = pkg.ReadInt(); if (playerInfo != null) { list.Add(bufferInfo); } } List <ItemInfo> list2 = new List <ItemInfo>(); int num6 = pkg.ReadInt(); for (int k = 0; k < num6; k++) { int templateId = pkg.ReadInt(); int hole = pkg.ReadInt(); ItemInfo itemInfo = ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(templateId), 1, 1); itemInfo.Hole1 = hole; list2.Add(itemInfo); } array[i] = new ProxyPlayer(this, playerInfo, proxyPlayerInfo, usersPetinfo, list, list2); array[i].CanUseProp = proxyPlayerInfo.CanUserProp; num3 += playerInfo.Grade; } ProxyRoom proxyRoom = new ProxyRoom(ProxyRoomMgr.NextRoomId(), num, array, this); proxyRoom.GuildId = guildId; proxyRoom.GameType = (eGameType)gameType; Dictionary <int, ProxyRoom> rooms; Monitor.Enter(rooms = this.m_rooms); try { if (!this.m_rooms.ContainsKey(num)) { this.m_rooms.Add(num, proxyRoom); } else { proxyRoom = null; } } finally { Monitor.Exit(rooms); } if (proxyRoom != null) { ProxyRoomMgr.AddRoom(proxyRoom); return; } ServerClient.log.ErrorFormat("Room already exists:{0}", num); }
public void HandleGameRoomCreate(GSPacketIn pkg) { int totalLevel = 0; int totalFightPower = 0; int roomId = pkg.ReadInt(); int gameType = pkg.ReadInt(); int guildId = pkg.ReadInt(); int areaId = pkg.ReadInt(); bool IsArea = pkg.ReadBoolean(); int count = pkg.ReadInt(); IGamePlayer[] players = new IGamePlayer[count]; for (int i = 0; i < count; i++) { PlayerInfo info = new PlayerInfo(); ProxyPlayerInfo proxyPlayerInfo = new ProxyPlayerInfo(); proxyPlayerInfo.m_AreaID = pkg.ReadInt(); proxyPlayerInfo.m_AreaName = pkg.ReadString(); info.ID = pkg.ReadInt(); info.NickName = pkg.ReadString(); info.Sex = pkg.ReadBoolean(); info.Hide = pkg.ReadInt(); info.Style = pkg.ReadString(); info.Colors = pkg.ReadString(); info.Skin = pkg.ReadString(); info.Offer = pkg.ReadInt(); info.GP = pkg.ReadInt(); info.Grade = pkg.ReadInt(); info.Repute = pkg.ReadInt(); info.Nimbus = pkg.ReadInt(); info.ConsortiaID = pkg.ReadInt(); info.ConsortiaName = pkg.ReadString(); info.ConsortiaLevel = pkg.ReadInt(); info.ConsortiaRepute = pkg.ReadInt(); info.Win = pkg.ReadInt(); info.Total = pkg.ReadInt(); info.Attack = pkg.ReadInt(); info.Defence = pkg.ReadInt(); info.Agility = pkg.ReadInt(); info.Luck = pkg.ReadInt(); info.FightPower = pkg.ReadInt(); info.IsMarried = pkg.ReadBoolean(); if (info.IsMarried) { info.SpouseID = pkg.ReadInt(); info.SpouseName = pkg.ReadString(); } totalFightPower += info.FightPower; proxyPlayerInfo.BaseAttack = pkg.ReadDouble(); proxyPlayerInfo.BaseDefence = pkg.ReadDouble(); proxyPlayerInfo.BaseAgility = pkg.ReadDouble(); proxyPlayerInfo.BaseBlood = pkg.ReadDouble(); proxyPlayerInfo.TemplateId = pkg.ReadInt(); proxyPlayerInfo.CanUserProp = pkg.ReadBoolean(); proxyPlayerInfo.SecondWeapon = pkg.ReadInt(); proxyPlayerInfo.StrengthLevel = pkg.ReadInt(); proxyPlayerInfo.GPAddPlus = pkg.ReadDouble(); proxyPlayerInfo.GMExperienceRate = pkg.ReadFloat(); proxyPlayerInfo.AuncherExperienceRate = pkg.ReadFloat(); proxyPlayerInfo.OfferAddPlus = pkg.ReadDouble(); proxyPlayerInfo.GMOfferRate = pkg.ReadFloat(); proxyPlayerInfo.AuncherOfferRate = pkg.ReadFloat(); proxyPlayerInfo.GMRichesRate = pkg.ReadFloat(); proxyPlayerInfo.AuncherRichesRate = pkg.ReadFloat(); proxyPlayerInfo.AntiAddictionRate = pkg.ReadDouble(); List <BufferInfo> infos = new List <BufferInfo>(); int buffercout = pkg.ReadInt(); for (int j = 0; j < buffercout; j++) { BufferInfo buffinfo = new BufferInfo(); buffinfo.Type = pkg.ReadInt(); buffinfo.IsExist = pkg.ReadBoolean(); buffinfo.BeginDate = pkg.ReadDateTime(); buffinfo.ValidDate = pkg.ReadInt(); buffinfo.Value = pkg.ReadInt(); if (info != null) { infos.Add(buffinfo); } } players[i] = new ProxyPlayer(this, info, proxyPlayerInfo, infos); players[i].CanUseProp = proxyPlayerInfo.CanUserProp; int ec = pkg.ReadInt(); for (int j = 0; j < ec; j++) { players[i].EquipEffect.Add(pkg.ReadInt()); } totalLevel += info.Grade; } if (players.Length != 0) { ProxyRoom room = new ProxyRoom(ProxyRoomMgr.NextRoomId(), roomId, players, this, totalLevel, totalFightPower, IsArea); room.GuildId = guildId; room.AreaID = areaId; room.GameType = (eGameType)gameType; ProxyRoom oldroom = null; Dictionary <int, ProxyRoom> rooms; Monitor.Enter(rooms = this.m_rooms); try { if (this.m_rooms.ContainsKey(roomId)) { oldroom = this.m_rooms[roomId]; this.m_rooms.Remove(roomId); } } finally { Monitor.Exit(rooms); } if (oldroom != null) { ProxyRoomMgr.RemoveRoom(oldroom); } Monitor.Enter(rooms = this.m_rooms); try { if (!this.m_rooms.ContainsKey(roomId)) { this.m_rooms.Add(roomId, room); this.SendFightRoomID(roomId, room.RoomId); } else { room = null; } } finally { Monitor.Exit(rooms); } if (room != null) { ProxyRoomMgr.AddRoom(room); } else { ServerClient.log.ErrorFormat("Room already exists:{0}", roomId); } } }
public void HandleGameRoomCreate(GSPacketIn pkg) { int roomId = pkg.ReadInt(); int gameType = pkg.ReadInt(); int guildId = pkg.ReadInt(); int count = pkg.ReadInt(); int totalLevel = 0; IGamePlayer[] players = new IGamePlayer[count]; for (int i = 0; i < count; i++) { PlayerInfo info = new PlayerInfo(); info.ID = pkg.ReadInt(); info.NickName = pkg.ReadString(); info.Sex = pkg.ReadBoolean(); info.Hide = pkg.ReadInt(); info.Style = pkg.ReadString(); info.Colors = pkg.ReadString(); info.Skin = pkg.ReadString(); info.Offer = pkg.ReadInt(); info.GP = pkg.ReadInt(); info.Grade = pkg.ReadInt(); info.Repute = pkg.ReadInt(); info.ConsortiaID = pkg.ReadInt(); info.ConsortiaName = pkg.ReadString(); info.ConsortiaLevel = pkg.ReadInt(); info.ConsortiaRepute = pkg.ReadInt(); info.Attack = pkg.ReadInt(); info.Defence = pkg.ReadInt(); info.Agility = pkg.ReadInt(); info.Luck = pkg.ReadInt(); double baseAttack = pkg.ReadDouble(); double baseDefence = pkg.ReadDouble(); double baseAgility = pkg.ReadDouble(); double baseBlood = pkg.ReadDouble(); int templateId = pkg.ReadInt(); bool canUserProp = pkg.ReadBoolean(); int secondWeapon = pkg.ReadInt(); int strengthLevel = pkg.ReadInt(); double gprate = pkg.ReadDouble(); double offerrate = pkg.ReadDouble(); double rate = pkg.ReadDouble(); int serverid = pkg.ReadInt(); ItemTemplateInfo itemTemplate = ItemMgr.FindItemTemplate(templateId); ItemInfo item = null; if (secondWeapon != 0) { ItemTemplateInfo secondWeaponTemp = ItemMgr.FindItemTemplate(secondWeapon); item = ItemInfo.CreateFromTemplate(secondWeaponTemp, 1, 1); item.StrengthenLevel = strengthLevel; } List <BufferInfo> infos = new List <BufferInfo>(); int buffercout = pkg.ReadInt(); for (int j = 0; j < buffercout; j++) { BufferInfo buffinfo = new BufferInfo(); buffinfo.Type = pkg.ReadInt(); buffinfo.IsExist = pkg.ReadBoolean(); buffinfo.BeginDate = pkg.ReadDateTime(); buffinfo.ValidDate = pkg.ReadInt(); buffinfo.Value = pkg.ReadInt(); if (info != null) { infos.Add(buffinfo); } } players[i] = new ProxyPlayer(this, info, itemTemplate, item, baseAttack, baseDefence, baseAgility, baseBlood, gprate, offerrate, rate, infos, serverid); players[i].CanUseProp = canUserProp; int ec = pkg.ReadInt(); for (int j = 0; j < ec; j++) { players[i].EquipEffect.Add(pkg.ReadInt()); } totalLevel += info.Grade; } ProxyRoom room = new ProxyRoom(ProxyRoomMgr.NextRoomId(), roomId, players, this); room.GuildId = guildId; room.GameType = (eGameType)gameType; lock (m_rooms) { if (!m_rooms.ContainsKey(roomId)) { m_rooms.Add(roomId, room); } else { room = null; } } if (room != null) { ProxyRoomMgr.AddRoom(room); } else { log.ErrorFormat("Room already exists:{0}", roomId); } }
public void OnAction(System.Collections.Hashtable parameters) { System.Console.WriteLine("This server GunnyII, edit and build by MrPhuong!"); System.Console.WriteLine("Starting FightingServer ... please wait a moment!"); FightServerConfig fightServerConfig = new FightServerConfig(); try { fightServerConfig.Load(); } catch (System.Exception ex) { System.Console.WriteLine(ex.Message); System.Console.ReadKey(); return; } FightServer.CreateInstance(fightServerConfig); FightServer.Instance.Start(); bool flag = true; while (flag) { try { System.Console.Write("> "); string text = System.Console.ReadLine(); string[] array = text.Split(new char[] { ' ' }); string a; if ((a = array[0].ToLower()) != null) { if (!(a == "clear")) { if (!(a == "list")) { if (a == "exit") { flag = false; } } else { if (array.Length > 1) { string a2; if ((a2 = array[1]) != null) { if (!(a2 == "-client")) { if (!(a2 == "-room")) { if (a2 == "-game") { System.Console.WriteLine("game list:"); System.Console.WriteLine("-------------------------------"); System.Collections.Generic.List <BaseGame> games = GameMgr.GetGames(); foreach (BaseGame current in games) { System.Console.WriteLine(current.ToString()); } System.Console.WriteLine("-------------------------------"); } } else { System.Console.WriteLine("room list:"); System.Console.WriteLine("-------------------------------"); ProxyRoom[] allRoom = ProxyRoomMgr.GetAllRoom(); ProxyRoom[] array2 = allRoom; for (int i = 0; i < array2.Length; i++) { ProxyRoom proxyRoom = array2[i]; System.Console.WriteLine(proxyRoom.ToString()); } System.Console.WriteLine("-------------------------------"); } } else { System.Console.WriteLine("server client list:"); System.Console.WriteLine("--------------------"); ServerClient[] allClients = FightServer.Instance.GetAllClients(); ServerClient[] array3 = allClients; for (int j = 0; j < array3.Length; j++) { ServerClient serverClient = array3[j]; System.Console.WriteLine(serverClient.ToString()); } System.Console.WriteLine("-------------------"); } } } else { System.Console.WriteLine("list [-client][-room][-game]"); System.Console.WriteLine(" -client:列出所有服务器对象"); System.Console.WriteLine(" -room:列出所有房间对象"); System.Console.WriteLine(" -game:列出所有游戏对象"); } } } else { System.Console.Clear(); } } } catch (System.Exception ex2) { System.Console.WriteLine("Error:" + ex2.ToString()); } } if (FightServer.Instance != null) { FightServer.Instance.Stop(); } }