public static string MoveCharacter(string account, string character, int x, int y, int z, Direction facing) { MoveRequest req = new MoveRequest() { AccountName = account, CharacterName = character, X = x, Y = y, Z = z, Facing = facing, }; try { string wrURI = baseServerTarget + "movecharacter"; 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 MoveCharacter(string message) { MoveRequest mv = new MoveRequest(message); Account acct = Account.LoadAccount(mv.AccountName); Character ch = acct.LoadCharacter(mv.CharacterName); if(!Map.LoadedMaps.ContainsKey(ch.Map)) { return "False"; } Map currentMap = Map.LoadedMaps[ch.Map]; if (currentMap.MoveCharacter(ch, mv.X, mv.Y, mv.Z, mv.Facing)) { acct.SaveCharacter(ch); 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; } else { return "False"; } }