mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00
implemented SetDisplayName
This commit is contained in:
parent
7e5a90ba87
commit
36d009dc3a
@ -90,6 +90,7 @@ Then run School of Dragons.
|
||||
- SetAchievementByEntityIDs
|
||||
- SetAvatar
|
||||
- SetCommonInventory
|
||||
- SetDisplayName (V2)
|
||||
- SetDragonXP (used by account import tools)
|
||||
- SetImage
|
||||
- SetKeyValuePair
|
||||
|
@ -86,6 +86,7 @@ methods = [
|
||||
'GetGameDataByGame',
|
||||
'GetGameDataByGameForDateRange',
|
||||
'GetTopAchievementPointUsers',
|
||||
'SetDisplayName',
|
||||
]
|
||||
|
||||
def routable(path):
|
||||
|
@ -102,6 +102,33 @@ public class ContentController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("/V2/ContentWebService.asmx/SetDisplayName")]
|
||||
[VikingSession]
|
||||
public IActionResult SetDisplayName(Viking viking, [FromForm] string request) {
|
||||
string newName = XmlUtil.DeserializeXml<SetDisplayNameRequest>(request).DisplayName;
|
||||
|
||||
if (String.IsNullOrWhiteSpace(newName) || ctx.Vikings.Count(e => e.Name == newName) > 0) {
|
||||
return Ok(new SetAvatarResult {
|
||||
Success = false,
|
||||
StatusCode = AvatarValidationResult.AvatarDisplayNameInvalid
|
||||
});
|
||||
}
|
||||
|
||||
viking.Name = newName;
|
||||
AvatarData avatarData = XmlUtil.DeserializeXml<AvatarData>(viking.AvatarSerialized);
|
||||
avatarData.DisplayName = newName;
|
||||
viking.AvatarSerialized = XmlUtil.SerializeXml(avatarData);
|
||||
ctx.SaveChanges();
|
||||
|
||||
return Ok(new SetAvatarResult {
|
||||
Success = true,
|
||||
DisplayName = viking.Name,
|
||||
StatusCode = AvatarValidationResult.Valid
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("ContentWebService.asmx/GetKeyValuePair")]
|
||||
|
16
src/Schema/SetDisplayNameRequest.cs
Normal file
16
src/Schema/SetDisplayNameRequest.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace sodoff.Schema;
|
||||
|
||||
[XmlRoot(ElementName = "sdnr", Namespace = "")]
|
||||
[Serializable]
|
||||
public class SetDisplayNameRequest {
|
||||
[XmlElement(ElementName = "dn")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "iid")]
|
||||
public int ItemID { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "sid")]
|
||||
public int StoreID { get; set; }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user