public string UpdatePlayScene(string message) { SessionUpdate upd = new SessionUpdate(message); Account acct = Account.LoadAccount(upd.UserId); Character ch = acct.LoadCharacter(upd.CharacterName); string ip = (OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty).Address; if (acct.SessionId != upd.SessionId || acct.Address != ip) { return "Error: incorrect address or session Id"; } acct.KeepAlive(); if (!Map.LoadedMaps.ContainsKey(ch.Map)) { return "False"; } Map currentMap = Map.LoadedMaps[ch.Map]; if(!currentMap.MapDeltas.ContainsKey(ch)) { return String.Empty; } string ret = String.Empty; lock (currentMap.MapDeltas[ch]) { ret = currentMap.MapDeltas[ch].ToString(); currentMap.MapDeltas[ch].AddedCharacters.Clear(); currentMap.MapDeltas[ch].AddedTiles.Clear(); currentMap.MapDeltas[ch].ChangedCharacters.Clear(); currentMap.MapDeltas[ch].RemovedCharacters.Clear(); currentMap.MapDeltas[ch].RemovedTiles.Clear(); } return ret; }
public static string UpdatePlayScene(string account, string character) { SessionUpdate req = new SessionUpdate() { CharacterName = character, SessionId = SessionId, UserId = account, }; try { string wrURI = baseServerTarget + "updateplayscene"; string msg = req.ToString(); WebRequest wreq = WebRequest.Create(wrURI + "?message=" + msg); wreq.Method = "POST"; wreq.ContentLength = 0; WebResponse wresp = wreq.GetResponse(); using (TextReader sr = new StreamReader(wresp.GetResponseStream())) { XmlSerializer xml = new XmlSerializer(typeof(string), StringNamespace); string resp = (string)xml.Deserialize(sr); return resp; } } catch { } return String.Empty; }
public string Update(string message) { SessionUpdate upd = new SessionUpdate(message); Account acct = Account.LoadAccount(upd.UserId); string ip = (OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty).Address; if(acct.SessionId != upd.SessionId || acct.Address != ip) { return "Error: incorrect address or session Id"; } acct.KeepAlive(); return String.Empty; }