-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2238 from planetarium/feature/gql-aura-summon
Introduce auraSummon ActionQuery
- Loading branch information
Showing
4 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
Submodule Lib9c
updated
10 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
NineChronicles.Headless/GraphTypes/ActionQueryFields/Summon.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using GraphQL; | ||
using GraphQL.Types; | ||
using Libplanet.Crypto; | ||
using Libplanet.Explorer.GraphTypes; | ||
using Nekoyume.Action; | ||
|
||
namespace NineChronicles.Headless.GraphTypes; | ||
|
||
public partial class ActionQuery | ||
{ | ||
private void RegisterSummon() | ||
{ | ||
Field<NonNullGraphType<ByteStringType>>( | ||
"auraSummon", | ||
arguments: new QueryArguments( | ||
new QueryArgument<NonNullGraphType<AddressType>> | ||
{ | ||
Name = "avatarAddress", | ||
Description = "Avatar address to get summoned items" | ||
}, | ||
new QueryArgument<NonNullGraphType<IntGraphType>> | ||
{ | ||
Name = "groupId", | ||
Description = "Summon group id" | ||
}, | ||
new QueryArgument<NonNullGraphType<IntGraphType>> | ||
{ | ||
Name = "summonCount", | ||
Description = "Count to summon. Must between 1 and 10." | ||
} | ||
), | ||
resolve: context => | ||
{ | ||
var avatarAddr = context.GetArgument<Address>("avatarAddress"); | ||
var groupId = context.GetArgument<int>("groupId"); | ||
var summonCount = context.GetArgument<int>("summonCount"); | ||
|
||
ActionBase action = new AuraSummon(avatarAddr, groupId, summonCount); | ||
return Encode(context, action); | ||
} | ||
); | ||
} | ||
} |