mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00
ClientVersion.GetGameID to get internal game id
(without version / sub-app info)
This commit is contained in:
parent
bdf7707019
commit
00d4aa146a
@ -43,10 +43,10 @@ public class AchievementController : Controller {
|
||||
//[Produces("application/xml")]
|
||||
[Route("AchievementWebService.asmx/GetAllRanks")]
|
||||
public IActionResult GetAllRanks([FromForm] string apiKey) {
|
||||
uint gameVersion = ClientVersion.GetVersion(apiKey);
|
||||
if (gameVersion <= ClientVersion.Max_OldJS && (gameVersion & ClientVersion.WoJS) != 0)
|
||||
uint gameID = ClientVersion.GetGameID(apiKey);
|
||||
if (gameID == ClientVersion.WoJS)
|
||||
return Ok(XmlUtil.ReadResourceXmlString("ranks.allranks_wojs"));
|
||||
if (gameVersion == ClientVersion.MB)
|
||||
if (gameID == ClientVersion.MB)
|
||||
return Ok(XmlUtil.ReadResourceXmlString("ranks.allranks_mb"));
|
||||
return Ok(XmlUtil.ReadResourceXmlString("ranks.allranks_sod"));
|
||||
}
|
||||
|
@ -529,8 +529,7 @@ public class ContentController : Controller {
|
||||
raisedPetData.PetTypeID = petTypeID;
|
||||
raisedPetData.RaisedPetID = 0; // Initially make zero, so the db auto-fills
|
||||
raisedPetData.EntityID = Guid.Parse(dragonId);
|
||||
uint gameVersion = ClientVersion.GetVersion(apiKey);
|
||||
if (gameVersion > ClientVersion.Max_OldJS || (gameVersion & ClientVersion.WoJS) == 0)
|
||||
if (ClientVersion.GetGameID(apiKey) != ClientVersion.WoJS)
|
||||
raisedPetData.Name = string.Concat("Dragon-", dragonId.AsSpan(0, 8)); // Start off with a random name (if game isn't WoJS)
|
||||
raisedPetData.IsSelected = false; // The api returns false, not sure why
|
||||
raisedPetData.CreateDate = new DateTime(DateTime.Now.Ticks);
|
||||
@ -1428,14 +1427,14 @@ public class ContentController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
uint gameVersion = ClientVersion.GetVersion(apiKey);
|
||||
uint gameID = ClientVersion.GetGameID(apiKey);
|
||||
// Send only JumpStart parties to JumpStart
|
||||
if (gameVersion <= ClientVersion.Max_OldJS && (gameVersion & ClientVersion.WoJS) != 0
|
||||
if (gameID == ClientVersion.WoJS
|
||||
&& (party.Location == "MyNeighborhood"
|
||||
|| party.Location == "MyVIPRoomInt")) {
|
||||
userParties.Add(userParty);
|
||||
// Send only Math Blaster parties to Math Blaster
|
||||
} else if (gameVersion == ClientVersion.MB
|
||||
} else if (gameID == ClientVersion.MB
|
||||
&& party.Location == "MyPodInt") {
|
||||
userParties.Add(userParty);
|
||||
}
|
||||
|
@ -77,10 +77,10 @@ public class ItemStoreController : Controller {
|
||||
public IActionResult GetAnnouncements([FromForm] string apiKey, [FromForm] int worldObjectID) {
|
||||
// TODO: This is a placeholder, although this endpoint seems to be only used to send announcements to the user (such as the server shutdown), so this might be sufficient.
|
||||
|
||||
uint gameVersion = ClientVersion.GetVersion(apiKey);
|
||||
if (gameVersion <= ClientVersion.Max_OldJS && (gameVersion & ClientVersion.WoJS) != 0) {
|
||||
uint gameID = ClientVersion.GetGameID(apiKey);
|
||||
if (gameID == ClientVersion.WoJS) {
|
||||
return Ok(XmlUtil.DeserializeXml<AnnouncementList>(XmlUtil.ReadResourceXmlString("announcements_wojs")));
|
||||
} else if (gameVersion == ClientVersion.SS && worldObjectID == 6) {
|
||||
} else if (gameID == ClientVersion.SS && worldObjectID == 6) {
|
||||
return Ok(XmlUtil.DeserializeXml<AnnouncementList>(XmlUtil.ReadResourceXmlString("announcements_ss")));
|
||||
}
|
||||
|
||||
|
@ -73,14 +73,14 @@ namespace sodoff.Services {
|
||||
}
|
||||
|
||||
public ReadOnlyDictionary<int, int> GetAchievementsGroupIdToTaskId(uint gameVersion) {
|
||||
gameVersion = GameVersionForTasks(gameVersion);
|
||||
gameVersion = ClientVersion.GetGameID(gameVersion);
|
||||
if (achievementsTasks.ContainsKey(gameVersion))
|
||||
return achievementsTasks[gameVersion].achievementsGroupIdToTaskId;
|
||||
return new ReadOnlyDictionary<int, int>(new Dictionary<int, int>());
|
||||
}
|
||||
|
||||
public List<AchievementTaskInfo>? GetAllAchievementTaskInfo(int taskID, uint gameVersion) {
|
||||
gameVersion = GameVersionForTasks(gameVersion);
|
||||
gameVersion = ClientVersion.GetGameID(gameVersion);
|
||||
if (achievementsTasks.ContainsKey(gameVersion) && achievementsTasks[gameVersion].achievementsRewardByTask.ContainsKey(taskID)) {
|
||||
return achievementsTasks[gameVersion].achievementsRewardByTask[taskID];
|
||||
}
|
||||
@ -121,13 +121,5 @@ namespace sodoff.Services {
|
||||
}
|
||||
return dragonXP;
|
||||
}
|
||||
|
||||
private uint GameVersionForTasks(uint gameVersion) {
|
||||
// all SoD version of SoD using the same Tasks database
|
||||
if ((gameVersion & ClientVersion.Min_SoD) == 0xa0000000) return ClientVersion.Min_SoD;
|
||||
// all version of WoJS (including lands) using the same Tasks database
|
||||
if (gameVersion <= ClientVersion.Max_OldJS && (gameVersion & ClientVersion.WoJS) != 0) return ClientVersion.WoJS;
|
||||
return gameVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,17 @@ public class ClientVersion {
|
||||
public const uint WoJS_StoryLand = 0x01000400; // World of JumpStart -- Storyland
|
||||
public const uint WoJS_NewAvatar = 0x01010000; // World of JumpStart with new avatars (e.g. 1.21)
|
||||
|
||||
public static uint GetGameID(uint gameVersion) {
|
||||
if (gameVersion > ClientVersion.Max_OldJS)
|
||||
return gameVersion & 0xf0000000;
|
||||
else
|
||||
return gameVersion & 0x0f000000;
|
||||
}
|
||||
|
||||
public static uint GetGameID(string apiKey) {
|
||||
return GetGameID(GetVersion(apiKey));
|
||||
}
|
||||
|
||||
public static uint GetVersion(string apiKey) {
|
||||
if (
|
||||
apiKey == "b99f695c-7c6e-4e9b-b0f7-22034d799013" || // PC / Windows
|
||||
|
Loading…
x
Reference in New Issue
Block a user