forked from SoDOff-Project/sodoff
add message for earning xp (wojs)
This commit is contained in:
parent
7e29d5cd4a
commit
b090604bc1
@ -9,11 +9,13 @@ namespace sodoff.Services {
|
|||||||
public class AchievementService {
|
public class AchievementService {
|
||||||
private AchievementStoreSingleton achievementStore;
|
private AchievementStoreSingleton achievementStore;
|
||||||
private InventoryService inventoryService;
|
private InventoryService inventoryService;
|
||||||
|
private MessagingService messagingService;
|
||||||
public readonly DBContext ctx;
|
public readonly DBContext ctx;
|
||||||
|
|
||||||
public AchievementService(AchievementStoreSingleton achievementStore, InventoryService inventoryService, DBContext ctx) {
|
public AchievementService(AchievementStoreSingleton achievementStore, InventoryService inventoryService, MessagingService messagingService, DBContext ctx) {
|
||||||
this.achievementStore = achievementStore;
|
this.achievementStore = achievementStore;
|
||||||
this.inventoryService = inventoryService;
|
this.inventoryService = inventoryService;
|
||||||
|
this.messagingService = messagingService;
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +139,10 @@ namespace sodoff.Services {
|
|||||||
grantedRewards.Add(
|
grantedRewards.Add(
|
||||||
ApplyAchievementReward(viking, reward)
|
ApplyAchievementReward(viking, reward)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// add message for earning xp (wojs)
|
||||||
|
if (reward.PointTypeID == AchievementPointTypes.PlayerXP && viking.GameVersion <= ClientVersion.WoJS)
|
||||||
|
messagingService.AddMessageToViking(null, viking, MessageType.Data, MessageTypeID.Jumpstar, MessageLevel.WhiteList, $"[[Line1]]=[[Congratulations, You've Earned {reward.Amount} JumpStars!]]", $"[[Line1]]=[[Congratulations, You've Earned {reward.Amount} JumpStars!]]", $"[[Line1]]=[[Congratulations, You've Earned {reward.Amount} JumpStars!]]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ public class MessagingService
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.IsPrivate && (viking.Id != publicViking.Id)) continue;
|
if (message.IsPrivate && (viking.Id != publicViking.Id) || message.VikingId == -1) continue;
|
||||||
|
|
||||||
Viking? msgAuthor = ctx.Vikings.FirstOrDefault(e => e.Id == message.VikingId) ?? new Viking();
|
Viking? msgAuthor = ctx.Vikings.FirstOrDefault(e => e.Id == message.VikingId) ?? new Viking();
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ public class MessagingService
|
|||||||
{
|
{
|
||||||
Viking? msgAuthor = ctx.Vikings.FirstOrDefault(e => e.Id == message.VikingId) ?? new Viking();
|
Viking? msgAuthor = ctx.Vikings.FirstOrDefault(e => e.Id == message.VikingId) ?? new Viking();
|
||||||
|
|
||||||
if(message.IsDeleted) { ctx.Messages.Remove(message); continue; }
|
if(message.IsDeleted && !showDeletedMessages) { ctx.Messages.Remove(message); continue; }
|
||||||
if(DateTime.Compare(now, message.CreatedAt.AddMinutes(30)) > 0 && !showOldMessages) { message.IsNew = false; continue; } // sometimes clients won't set IsNew flag when updating messages, so do not add messages more than 30 minutes old to response
|
if(DateTime.Compare(now, message.CreatedAt.AddMinutes(30)) > 0 && !showOldMessages) { message.IsNew = false; continue; } // sometimes clients won't set IsNew flag when updating messages, so do not add messages more than 30 minutes old to response
|
||||||
if(!message.IsNew && !showOldMessages) continue;
|
if(!message.IsNew && !showOldMessages) continue;
|
||||||
messageInfos.Add(new MessageInfo
|
messageInfos.Add(new MessageInfo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user