diff --git a/.gitignore b/.gitignore index c02062f..e40df02 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ src/Properties __pycache__/ sodoff.db sodoff.db-shm -sodoff.db-wal +sodoff.db-wal \ No newline at end of file diff --git a/src/Controllers/Common/ProfileController.cs b/src/Controllers/Common/ProfileController.cs index 44f8652..18dc8d2 100644 --- a/src/Controllers/Common/ProfileController.cs +++ b/src/Controllers/Common/ProfileController.cs @@ -13,14 +13,16 @@ public class ProfileController : Controller { private readonly DBContext ctx; private AchievementService achievementService; + private AchievementStoreSingleton achievementStore; private ProfileService profileService; private readonly IOptions config; - public ProfileController(DBContext ctx, AchievementService achievementService, ProfileService profileService, IOptions config) { + public ProfileController(DBContext ctx, AchievementService achievementService, AchievementStoreSingleton achievementStoreSingleton, ProfileService profileService, IOptions config) { this.ctx = ctx; this.achievementService = achievementService; this.profileService = profileService; this.config = config; + achievementStore = achievementStoreSingleton; } [HttpPost] @@ -112,6 +114,12 @@ public class ProfileController : Controller { } } + // get playerxp, if null than its 0 + AchievementPoints? achievementPoints = viking.AchievementPoints.FirstOrDefault(e => e.Type == (int)AchievementPointTypes.PlayerXP); + int playerxp = 0; + + if (achievementPoints != null) playerxp = achievementPoints.Value; + // Build the AvatarDisplayData AvatarDisplayData avatar = new AvatarDisplayData { AvatarData = avatarData, @@ -140,7 +148,7 @@ public class ProfileController : Controller { SubscriptionID = -3, // placeholder IsActive = true, // placeholder }, - RankID = 0, // placeholder + RankID = achievementStore.GetRankFromXP(playerxp, AchievementPointTypes.PlayerXP, viking.GameVersion ?? ClientVersion.Min_SoD), // placeholder AchievementInfo = null, // placeholder Achievements = new UserAchievementInfo[] { achievementService.CreateUserAchievementInfo(viking, AchievementPointTypes.PlayerXP), diff --git a/src/Services/AchievementService.cs b/src/Services/AchievementService.cs index 0bda589..9007b8f 100644 --- a/src/Services/AchievementService.cs +++ b/src/Services/AchievementService.cs @@ -19,19 +19,19 @@ namespace sodoff.Services { this.ctx = ctx; } - public UserAchievementInfo CreateUserAchievementInfo(Guid userId, int? value, AchievementPointTypes type) { + public UserAchievementInfo CreateUserAchievementInfo(Guid userId, int? value, AchievementPointTypes type, uint gameVersion = ClientVersion.Min_SoD) { if (value is null) value = 0; return new UserAchievementInfo { UserID = userId, AchievementPointTotal = value, - RankID = achievementStore.GetRankFromXP(value, type), + RankID = achievementStore.GetRankFromXP(value, type, gameVersion), PointTypeID = type }; } public UserAchievementInfo CreateUserAchievementInfo(Viking viking, AchievementPointTypes type) { - return CreateUserAchievementInfo(viking.Uid, viking.AchievementPoints.FirstOrDefault(a => a.Type == (int)type)?.Value, type); + return CreateUserAchievementInfo(viking.Uid, viking.AchievementPoints.FirstOrDefault(a => a.Type == (int)type)?.Value, type, viking.GameVersion ?? ClientVersion.Min_SoD); } public void DragonLevelUpOnAgeUp(Dragon dragon, RaisedPetGrowthState oldGrowthState, RaisedPetGrowthState newGrowthState) { @@ -98,11 +98,26 @@ namespace sodoff.Services { ctx.SaveChanges(); - return new AchievementReward{ + AchievementReward achievementReward = new AchievementReward + { EntityID = viking.Uid, PointTypeID = type, Amount = value }; + + if(viking.GameVersion <= ClientVersion.WoJS && xpPoints.Type == (int)AchievementPointTypes.PlayerXP) + { + int initialRank = achievementStore.GetRankFromXP(initialPoints, AchievementPointTypes.PlayerXP, viking.GameVersion.Value); + int newRank = achievementStore.GetRankFromXP(xpPoints.Value, AchievementPointTypes.PlayerXP, viking.GameVersion.Value); + // wojs shows level up screen when a message of type rank is posted to their message board + if(newRank > initialRank) + { + // player leveled up, post message + messagingService.AddMessageToViking(null, viking, MessageType.Data, MessageTypeID.Rank, MessageLevel.WhiteList, "[[Line3]]=[[Congratulations Jumpee, You Leveled Up!]][[Prefab]]=[[RS_DATA/PfLevelUpRoom.unity3d/PfLevelUpRoom]]", "[[Line3]]=[[Congratulations Jumpee, You Leveled Up!]][[Prefab]]=[[RS_DATA/PfLevelUpRoom.unity3d/PfLevelUpRoom]]", "[[Line3]]=[[Congratulations Jumpee, You Leveled Up!]][[Prefab]]=[[RS_DATA/PfLevelUpRoom.unity3d/PfLevelUpRoom]]", isPrivate: true); + } + } + + return achievementReward; } return null; } diff --git a/src/Services/AchievementStoreSingleton.cs b/src/Services/AchievementStoreSingleton.cs index 17a02f1..8cdcc99 100644 --- a/src/Services/AchievementStoreSingleton.cs +++ b/src/Services/AchievementStoreSingleton.cs @@ -60,7 +60,8 @@ namespace sodoff.Services { dragonTitanMinXP = ranks[AchievementPointTypes.DragonXP][20].Value; } - public int GetRankFromXP(int? xpPoints, AchievementPointTypes type) { + public int GetRankFromXP(int? xpPoints, AchievementPointTypes type, uint gameVersion = ClientVersion.Min_SoD) { + if (gameVersion <= ClientVersion.WoJS) return ranks[type].Count(r => r.Value <= xpPoints) - 1; // still kind of a shitty fix but hey it fixed sod :) return ranks[type].Count(r => r.Value <= xpPoints); } diff --git a/src/Services/MessagingService.cs b/src/Services/MessagingService.cs index e3f7f11..ef08233 100644 --- a/src/Services/MessagingService.cs +++ b/src/Services/MessagingService.cs @@ -271,9 +271,13 @@ public class MessagingService MessageTypeID = (int?)message.MessageTypeID, Data = message.Data ?? "NoData", MemberMessage = message.MemberMessage ?? "NoMessage", - NonMemberMessage = message.NonMemberMessage ?? "NoMessage" + NonMemberMessage = message.NonMemberMessage ?? "NoMessage", + MemberAudioUrl = "", + NonMemberAudioUrl = "", + MemberImageUrl = "", + NonMemberImageUrl = "" }; - + messageInfos.Add(messageInfo); } diff --git a/src/assets/conf/WIN/3.31.0/DWADragonsMain.xml b/src/assets/conf/WIN/3.31.0/DWADragonsMain.xml deleted file mode 100644 index fa60723..0000000 --- a/src/assets/conf/WIN/3.31.0/DWADragonsMain.xml +++ /dev/null @@ -1,222 +0,0 @@ - - - - - http://localhost:5000/ContentWebService.asmx/ - http://localhost:5000/V2/ContentWebService.asmx/ - http://localhost:5000/v3/ContentWebService.asmx/ - http://localhost:5000/V4/ContentWebService.asmx/ - http://localhost:5000/ContentWebService.asmx/ - - http://localhost:5000/ItemStoreWebService.asmx/ - http://localhost:5000/AchievementWebService.asmx/ - http://localhost:5000/V2/AchievementWebService.asmx/ - - http://localhost:5000/MembershipWebService.asmx/ - http://localhost:5000/AuthenticationWebService.asmx/ - http://localhost:5000/v3/AuthenticationWebService.asmx/ - http://localhost:5000/v3/RegistrationWebService.asmx/ - http://localhost:5000/V4/RegistrationWebService.asmx/ - http://localhost:5000/ProfileWebService.asmx/ - - http://localhost:5000/ConfigurationWebService.asmx/ - http://localhost:5000/V2/Ratingwebservice.asmx/ - http://localhost:5000/ChallengeWebService.asmx/ - http://localhost:5000/MessagingWebService.asmx/ - - - http://localhost:5000/GroupWebService.asmx/ - http://localhost:5000/V2/GroupWebService.asmx/ - http://localhost:5000/MessageWebService.asmx/ - http://localhost:5000/v2/MessageWebService.asmx/ - http://localhost:5000/v3/MessageWebService.asmx/ - http://localhost:5000/v2/InviteFriendWebService.asmx/ - http://localhost:5000/ChatWebService.asmx/ - - - http://localhost/AnalyticsWebService.asmx/ - http://localhost/MissionWebService.asmx/ - http://localhost/AvatarWebService.asmx/ - http://localhost/RatingWebService.asmx/ - http://localhost/ScoreWebService.asmx/ - http://localhost/MobileStoreWebService.asmx/ - http://localhost/SubscriptionWebService.asmx/ - http://localhost/PaymentWebService.asmx/ - http://localhost/V2/PaymentWebService.asmx/ - http://localhost/PrizeCodeWebService.asmx/ - http://localhost/Common/V2/PrizeCodeWebService.asmx/ - http://localhost/ContentServer/CalendarWebService.asmx/ - http://localhost/RegistrationWebService.asmx/ - http://localhost/LocaleService.asmx/ - http://localhost/V2/LocaleWebService.asmx/ - http://localhost/launch.aspx - - - - localhost - 9933 - - S2X - 240 - false - 8080 - false - 500 - 500 - 300000 - - - - http://localhost:5001/.com/DWADragonsUnity/WIN/{Version}/Mid/ - http://localhost:5001/.com/DWADragonsUnity/WIN/{Version}/Mid/contentdata - http://localhost:5001/.com/DWADragonsUnity/WIN/{Version}/Mid/data - http://localhost:5001/.com/DWADragonsUnity/WIN/{Version}/Mid/scene - http://localhost:5001/.com/DWADragonsUnity/WIN/{Version}/Mid/shareddata - http://localhost:5001/.com/DWADragonsUnity/WIN/{Version}/Mid/sound - http://localhost:5001/.com/DWADragonsUnity/WIN/{Version}/Mid/movies - - . - ./contentdata - ./data - ./scene - ./shareddata - ./sound - ./movies - - . - - - 127.0.0.1 - - 6c955c0b5efd67396e950f56542e86b6 - 2000000000 - dwavatar - false - - - Your Viking is now idle. Click on the OK button to reconnect. - 42286 - - - You have been logged out because you have signed in from another computer or device. - 9000 - - - Your Viking is now idle. Click on the OK button to reconnect. - 9001 - - - Notification - 10674 - - - Download failed, please retry! Possible invalid DES secret in client! - 42287 - - - - - - - Mid - Low,Mid,High - - - High - Off,Low,Mid,High - - - Low - Off,Low,Mid,High - - - 128 - - - - en-US - - - es-MX - es - es-ES - es-LA - es-US - es_ES - es_LA - es_MX - es_US - spanish - - - pt-BR - pt - pt-PT - pt_BR - pt_PT - brazilian - - - zh-CN - zh - zh-Hans - zh_CN - zh_Hans - schinese - - - de-DE - de - de-CH - de_DE - de_CH - german - - - fr-CA - fr - fr-FR - fr-CH - fr_CA - fr_FR - fr_CH - french - - - ko-KR - ko - ko_KR - koreana - - - ru-RU - ru - ru_RU - russian - - - th-TH - th - th-TH - th_TH - - - ar-EG - ar - ar-DZ - ar-BH - ar-IQ - ar-JO - ar-KW - ar-LB - ar-LY - ar-MA - ar-OM - ar-QA - ar-SA - ar-SY - ar-TN - ar-AE - ar-YE - -