Skip to content

Commit 7cc29ad

Browse files
author
magiclu550
committed
[proxy] a event handler
1 parent 2501aff commit 7cc29ad

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

jsmod2/NetworkHandler.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ static NetworkHandler()
8282
handlers.Add(180,new EventHandler());
8383
handlers.Add(181,new EventHandler());
8484
handlers.Add(182,new HandlePlayerContain106GetScp106s());
85+
handlers.Add(183,new HandlePlayerSetRoleItems());
8586
}
8687
public static void handleJsmod2(int id, String json,Dictionary<string,string> mapper,TcpClient client)
8788
{
@@ -217,6 +218,22 @@ public JsonSetting[] handle(object api, Dictionary<string, string> mapper)
217218
}
218219
}
219220

221+
public class HandlePlayerSetRoleItems : Handler
222+
{
223+
public JsonSetting[] handle(object api, Dictionary<string, string> mapper)
224+
{
225+
string[] strs = Lib.getArray(mapper["items"]);
226+
List<ItemType> types = new List<ItemType>();
227+
for (int i = 0; i < strs.Length; i++)
228+
{
229+
types.Add((ItemType)JsonConvert.DeserializeObject(strs[i],typeof(ItemType)));
230+
}
231+
PlayerSetRoleEvent e = api as PlayerSetRoleEvent;
232+
e.Items = types;
233+
return null;
234+
}
235+
}
236+
220237
public class EventHandler : Handler
221238
{
222239
public JsonSetting[] handle(object api, Dictionary<string, string> mapper)

0 commit comments

Comments
 (0)