Skip to content

Commit

Permalink
Merge branch 'dev' into initial-raid
Browse files Browse the repository at this point in the history
  • Loading branch information
seionmoya committed Oct 13, 2024
2 parents f0f1e78 + 6a4545d commit b979d59
Show file tree
Hide file tree
Showing 24 changed files with 144 additions and 87 deletions.
7 changes: 4 additions & 3 deletions Fuyu.Backend.BSG/DTO/Items/ItemInstance.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
using System.Runtime.Serialization;
using Fuyu.Common.Hashing;

namespace Fuyu.Backend.EFT.DTO.Items
{
[DataContract]
public class ItemInstance
{
[DataMember]
public string _id;
public MongoId _id;

[DataMember]
public string _tpl;
public MongoId _tpl;

// emits when 'null'
[DataMember(EmitDefaultValue = false)]
public string parentId;
public MongoId parentId;

// emits when 'null'
[DataMember(EmitDefaultValue = false)]
Expand Down
17 changes: 9 additions & 8 deletions Fuyu.Backend.BSG/DTO/Profiles/BonusInfo.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
using System.Runtime.Serialization;
using Newtonsoft.Json.Converters;
using Fuyu.Backend.BSG.DTO.Profiles.Bonusses;
using Fuyu.Common.Hashing;

namespace Fuyu.Backend.BSG.DTO.Profiles
{
[DataContract]
public class BonusInfo
{
[DataMember]
public string id;
public MongoId id;

[DataMember(EmitDefaultValue = true)]
[DataMember(EmitDefaultValue = false)]
public string icon;

[DataMember]
Expand All @@ -20,19 +21,19 @@ public class BonusInfo
[DataMember]
public float value;

[DataMember(EmitDefaultValue = true)]
public string templateId;
[DataMember(EmitDefaultValue = false)]
public MongoId templateId;

[DataMember]
public bool passive;

[DataMember]
public bool visible;

[DataMember]
public bool production;
[DataMember(EmitDefaultValue = false)]
public bool production;

[DataMember(EmitDefaultValue = true)]
public string[] filter;
[DataMember(EmitDefaultValue = false)]
public MongoId[] filter;
}
}
9 changes: 5 additions & 4 deletions Fuyu.Backend.BSG/DTO/Profiles/CustomizationInfo.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
using System.Runtime.Serialization;
using Fuyu.Common.Hashing;

namespace Fuyu.Backend.BSG.DTO.Profiles
{
[DataContract]
public class CustomizationInfo
{
[DataMember]
public string Head;
public MongoId Head;

[DataMember]
public string Body;
public MongoId Body;

[DataMember]
public string Feet;
public MongoId Feet;

[DataMember]
public string Hands;
public MongoId Hands;
}
}
5 changes: 3 additions & 2 deletions Fuyu.Backend.BSG/DTO/Profiles/InsuredItem.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using System.Runtime.Serialization;
using Fuyu.Common.Hashing;

namespace Fuyu.Backend.BSG.DTO.Profiles
{
[DataContract]
public class InsuredItem
{
[DataMember]
public string tid;
public MongoId tid;

[DataMember]
public string itemId;
public MongoId itemId;
}
}
17 changes: 9 additions & 8 deletions Fuyu.Backend.BSG/DTO/Profiles/InventoryInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using Fuyu.Backend.EFT.DTO.Items;
using Fuyu.Common.Hashing;

namespace Fuyu.Backend.BSG.DTO.Profiles
{
Expand All @@ -11,29 +12,29 @@ public class InventoryInfo
public ItemInstance[] items;

[DataMember]
public string equipment;
public MongoId equipment;

[DataMember]
public string stash;
public MongoId stash;

[DataMember]
public string sortingTable;
public MongoId sortingTable;

[DataMember]
public string questRaidItems;
public MongoId questRaidItems;

[DataMember]
public string questStashItems;
public MongoId questStashItems;

// TODO: proper type
[DataMember]
public object fastPanel;
public Dictionary<string, MongoId> fastPanel;

[DataMember]
public Dictionary<string, string> hideoutAreaStashes;
public Dictionary<string, MongoId> hideoutAreaStashes;

// TODO: proper type
[DataMember]
public object[] favoriteItems;
public MongoId[] favoriteItems;
}
}
13 changes: 7 additions & 6 deletions Fuyu.Backend.BSG/DTO/Profiles/Profile.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using Fuyu.Common.Hashing;

namespace Fuyu.Backend.BSG.DTO.Profiles
{
Expand All @@ -8,13 +9,13 @@ namespace Fuyu.Backend.BSG.DTO.Profiles
public class Profile
{
[DataMember]
public string _id;
public MongoId _id;

[DataMember]
public int aid;

[DataMember]
public string savage;
[DataMember(EmitDefaultValue = false)]
public MongoId savage;

[DataMember]
public ProfileInfo Info;
Expand All @@ -35,7 +36,7 @@ public class Profile
public StatsInfo Stats;

[DataMember]
public Dictionary<string, bool> Encyclopedia;
public Dictionary<MongoId, bool> Encyclopedia;

[DataMember]
public Dictionary<string, ConditionCounter> TaskConditionCounters;
Expand All @@ -61,13 +62,13 @@ public class Profile

// TODO: proper type
[DataMember]
public Dictionary<string, string> Achievements;
public Dictionary<MongoId, int> Achievements;

[DataMember]
public RagfairInfo RagfairInfo;

[DataMember]
public Dictionary<string, TraderInfo> TradersInfo;
public Dictionary<MongoId, TraderInfo> TradersInfo;

[DataMember]
public UnlockedInfo UnlockedInfo;
Expand Down
3 changes: 2 additions & 1 deletion Fuyu.Backend.BSG/DTO/Profiles/QuestInfo.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using Fuyu.Backend.BSG.DTO.Profiles.Quests;
using Fuyu.Common.Hashing;

namespace Fuyu.Backend.BSG.DTO.Profiles
{
[DataContract]
public class QuestInfo
{
[DataMember]
public string qid;
public MongoId qid;

[DataMember]
public long startTime;
Expand Down
9 changes: 4 additions & 5 deletions Fuyu.Backend.Core/Controllers/AccountLoginController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@

namespace Fuyu.Backend.Core.Controllers
{
public class AccountLoginController : HttpController
public class AccountLoginController : HttpController<AccountLoginRequest>
{
public AccountLoginController() : base("/account/login")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context, AccountLoginRequest body)
{
var request = await context.GetJsonAsync<AccountLoginRequest>();
var response = AccountService.LoginAccount(request.Username, request.Password);
var response = AccountService.LoginAccount(body.Username, body.Password);

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
7 changes: 3 additions & 4 deletions Fuyu.Backend.Core/Controllers/AccountRegisterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@

namespace Fuyu.Backend.Core.Controllers
{
public class AccountRegisterController : HttpController
public class AccountRegisterController : HttpController<AccountRegisterRequest>
{
public AccountRegisterController() : base("/account/register")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context, AccountRegisterRequest request)
{
var request = await context.GetJsonAsync<AccountRegisterRequest>();
var result = AccountService.RegisterAccount(request.Username, request.Password);
var response = new AccountRegisterResponse()
{
Status = result
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@

namespace Fuyu.Backend.Core.Controllers
{
public class AccountRegisterGameController : HttpController
{
public class AccountRegisterGameController : HttpController<AccountRegisterGameRequest>
{
public AccountRegisterGameController() : base("/account/register/game")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context, AccountRegisterGameRequest request)
{
var request = await context.GetJsonAsync<AccountRegisterGameRequest>();
var sessionId = context.GetSessionId();
var result = AccountService.RegisterGame(sessionId, request.Game, request.Edition);

await context.SendJsonAsync(Json.Stringify(result));
return context.SendJsonAsync(Json.Stringify(result));
}
}
}
7 changes: 3 additions & 4 deletions Fuyu.Backend.EFT/Controllers/FuyuGameLoginController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@

namespace Fuyu.Backend.EFT.Controllers
{
public class FuyuGameLoginController : HttpController
public class FuyuGameLoginController : HttpController<FuyuGameLoginRequest>
{
public FuyuGameLoginController() : base("/fuyu/game/login")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context, FuyuGameLoginRequest request)
{
var request = await context.GetJsonAsync<FuyuGameLoginRequest>();
var sessionId = AccountService.LoginAccount(request.AccountId);
var response = new FuyuGameLoginResponse()
{
SessionId = sessionId
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
7 changes: 3 additions & 4 deletions Fuyu.Backend.EFT/Controllers/FuyuGameRegisterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@

namespace Fuyu.Backend.EFT.Controllers
{
public class FuyuGameRegisterController : HttpController
public class FuyuGameRegisterController : HttpController<FuyuGameRegisterRequest>
{
public FuyuGameRegisterController() : base("/fuyu/game/register")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context, FuyuGameRegisterRequest request)
{
var request = await context.GetJsonAsync<FuyuGameRegisterRequest>();
var accountId = AccountService.RegisterAccount(request.Username, request.Edition);
var response = new FuyuGameRegisterResponse()
{
AccountId = accountId
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
7 changes: 3 additions & 4 deletions Fuyu.Backend.EFT/Controllers/GameBotGenerateController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@

namespace Fuyu.Backend.EFT.Controllers
{
public class GameBotGenerateController : HttpController
public class GameBotGenerateController : HttpController<GameBotGenerateRequest>
{
public GameBotGenerateController() : base("/client/game/bot/generate")
{
}

public override async Task RunAsync(HttpContext context)
public override Task RunAsync(HttpContext context, GameBotGenerateRequest request)
{
var request = await context.GetJsonAsync<GameBotGenerateRequest>();
var profiles = BotService.GetBots(request.conditions);
var response = new ResponseBody<Profile[]>()
{
data = profiles
};

await context.SendJsonAsync(Json.Stringify(response));
return context.SendJsonAsync(Json.Stringify(response));
}
}
}
Loading

0 comments on commit b979d59

Please sign in to comment.