public bool GotoMap(GameClient client, int toMapCode, int toPosX = -1, int toPosY = -1, int direction = -1) { bool ret = false; if (null != client) { if (client.ClientData.CurrentLifeV <= 0) { return(ret); } int oldMapCode = client.ClientData.MapCode; if (JunQiManager.GetLingDiIDBy2MapCode(client.ClientData.MapCode) == 2) { HuangChengManager.HandleLeaveMapHuangDiRoleChanging(client); } if (!Global.CanEnterIfMapIsGuMu(client, toMapCode)) { return(false); } if (toMapCode < 0) { GameManager.ClientMgr.NotifyOthersGoBack(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, toPosX, toPosY, direction); } else { bool execGoToMap = true; if (JunQiManager.GetLingDiIDBy2MapCode(toMapCode) > 0 && toMapCode != GameManager.MainMapCode) { } if (execGoToMap) { GameMap gameMap = null; if (GameManager.MapMgr.DictMaps.TryGetValue(toMapCode, out gameMap)) { ret = true; if (oldMapCode != toMapCode) { GameManager.ClientMgr.NotifyChangeMap(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, toMapCode, toPosX, toPosY, direction, 0); } else { client.ClientData.CurrentAction = 0; GameManager.ClientMgr.NotifyOthersGoBack(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, toPosX, toPosY, direction); } Global.UpdateDayActivityEnterCountToDB(client, client.ClientData.RoleID, TimeUtil.NowDateTime().DayOfYear, 6, 1); } } } } return(ret); }
/// <summary> /// 传送到地图,toMapCode 小于0 或者等于当前地图id,则进行本地图移动 /// </summary> /// <param name="client"></param> /// <param name="toMapCode"></param> /// <returns></returns> public Boolean GotoMap(GameClient client, int toMapCode, int toPosX = -1, int toPosY = -1, int direction = -1) { Boolean ret = false; //传送到某个地图上去 if (null != client) { if (client.ClientData.CurrentLifeV <= 0) //如果已经死亡,则不允许传送 { return(ret); } int oldMapCode = client.ClientData.MapCode; if (JunQiManager.GetLingDiIDBy2MapCode(client.ClientData.MapCode) == (int)LingDiIDs.HuangCheng) //如果现在是皇城,则判断是否收回舍利 { //处理拥有皇帝特效的角色离开皇城地图,而失去皇帝特效的事件 HuangChengManager.HandleLeaveMapHuangDiRoleChanging(client); } if (!Global.CanEnterIfMapIsGuMu(client, toMapCode))//古墓挂机地图过滤判断 { return(false); } //如果小于0,则回到当前地图 if (toMapCode < 0) //回当前图 { GameManager.ClientMgr.NotifyOthersGoBack(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, toPosX, toPosY, direction); } else { bool execGoToMap = true; if (JunQiManager.GetLingDiIDBy2MapCode(toMapCode) > 0 && toMapCode != GameManager.MainMapCode) //如果是要进入领地的地图 { /* * if (Global.GetBangHuiFightingLineID() != GameManager.ServerLineID) * { * execGoToMap = false; * * string mapName = Global.GetMapName(toMapCode); * GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, * client, StringUtil.substitute(Global.GetLang("只有从『{0}』线才能进入『{1}』地图"), Global.GetBangHuiFightingLineID(), mapName), * GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox); * } */ } if (execGoToMap) { GameMap gameMap = null; if (GameManager.MapMgr.DictMaps.TryGetValue(toMapCode, out gameMap)) //确认地图编号是否有效 { ret = true; //如果不同地图,就进行地图切换传送 if (oldMapCode != toMapCode) { GameManager.ClientMgr.NotifyChangeMap(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, toMapCode, toPosX, toPosY, direction); } else { //如果在同一个地图,就进行位置移动 GameManager.ClientMgr.NotifyOthersGoBack(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, toPosX, toPosY, direction); } //保存到数据库 Global.UpdateDayActivityEnterCountToDB(client, client.ClientData.RoleID, DateTime.Now.DayOfYear, (int)SpecialActivityTypes.OldBattlefield, 1); } } } } return(ret); }