public void SendToMap(Packets.Login.Get.SendToMap p) { string server = p.GetIPAddress() + ":" + p.GetPort().ToString(); this.serverIP = server; MapSession map; this.state = SESSION_STATE.REDIRECTING; Dictionary <string, MapSession> maps = Gateway.Maps; if (maps.ContainsKey(server)) { map = maps[server]; } else { map = new MapSession(p.GetIPAddress(), p.GetPort(), this.SessionID); maps.Add(server, map); } this.MapSession = map; map.NewSession(this, p.GetCharID(), p.GetValidationKey()); //this.MapSession = new MapSession(p.GetIPAddress(), p.GetPort(), p.GetCharID(), p.GetValidationKey(),this.SessionID,this); //this.MapSession.Connect(); //this.LogingSession.netIO.Disconnect(); }
public void OnSendUniversal(SagaGateway.Packets.Client.SendUniversal p) { //Logger.ShowInfo(string.Format("Redirecting Packet:{0:X4} of Session:{1} to ServerID:{2:X4}", p.ID, p.SessionID, p.ServerID),null); if (p.ServerID == 0x0301) { Gateway.Login.SendToLogin(p.GetData(), this.SessionID); } if (p.ServerID == 0x0501) { Dictionary <string, MapSession> list; list = Gateway.Maps; if (!list.ContainsKey(this.serverIP)) { string ip = this.serverIP.Substring(0, this.serverIP.IndexOf(":")); string port = this.serverIP.Substring(this.serverIP.IndexOf(":") + 1); MapSession map = new MapSession(ip, int.Parse(port), this.SessionID); list.Add(this.serverIP, map); } this.MapSession = list[this.serverIP]; this.MapSession.SendToMap(p.GetData(), this.SessionID); } }