/// <summary>
    /// 建立关系
    /// </summary>
    /// <param name="token">Hash 客户端信息</param>
    /// <param name="fromClientId">int 邀请人客户端编号</param>
    /// <param name="scene">int 来源场景</param>
    /// <param name="encryptedData">string 群标识加密信息</param>
    /// <param name="iv">string 群标识加密向量</param>
    /// <returns>Hash 返回结果</returns>
    public static Hash Create(Hash token, int fromClientId, int scene, string encryptedData, string iv)
    {
        if (fromClientId == 0)
        {
            return(new Hash((int)CodeType.ClientRelateRequired, "邀请人不存在"));
        }
        Hash shareTicket = new Hash();

        if (!Genre.IsNull(encryptedData) && !Genre.IsNull(iv) && !token.IsNull("sessionKey"))
        {
            ClientLogService.Append(encryptedData + " | " + iv + " | " + token.ToString("sessionKey"));
            shareTicket = API.GetEncryptedData(encryptedData, token.ToString("sessionKey"), iv);
        }
        if (shareTicket.IsNull("openGId"))
        {
            if (token.ToInt("clientId") != fromClientId)
            {
                ClientRelateData.Create(token.ToInt("clientId"), fromClientId, RelateType.FromFriend);
                ClientRelateData.Create(fromClientId, token.ToInt("clientId"), RelateType.FromFriend);
            }
        }
        else
        {
            ClientGroupData.Create(token.ToInt("clientId"), shareTicket.ToString("openGId"));
            ClientGroupData.Renovate(shareTicket.ToString("openGId"));
        }
        return(new Hash((int)CodeType.OK, "成功", shareTicket));
    }
    /// <summary>
    /// 建立客户端关系
    /// </summary>
    /// <param name="token">Hash 客户端信息</param>
    /// <param name="fromClientId">int 邀请人客户端编号</param>
    /// <param name="shareQuestionId">int 分享题目编号</param>
    /// <param name="scene">int 来源场景</param>
    /// <param name="encryptedData">string 群标识加密信息</param>
    /// <param name="iv">string 群标识加密向量</param>
    /// <returns>Hash 返回结果</returns>
    public static Hash Relation(Hash token, int fromClientId, int shareQuestionId, int scene, string encryptedData, string iv)
    {
        //  如果邀请人不存在,则跳出
        if (fromClientId == 0)
        {
            return(new Hash((int)CodeType.ClientRelateRequired, "邀请人不存在"));
        }

        //  初始化参数集合
        Hash data        = new Hash();
        Hash shareTicket = new Hash();
        Hash fromClient  = ClientData.GetByClientId(fromClientId);

        //  获取群标识
        if (!Genre.IsNull(encryptedData) && !Genre.IsNull(iv) && !token.IsNull("sessionKey"))
        {
            shareTicket = API.GetEncryptedData(encryptedData, token.ToString("sessionKey"), iv);
        }

        if (shareTicket.IsNull("openGId"))
        {
            //  如果不是来自群会话
            if (token.ToInt("clientId") != fromClientId)
            {
                ClientRelateData.Create(token.ToInt("clientId"), fromClientId, RelateType.FromFriend);
                ClientRelateData.Create(fromClientId, token.ToInt("clientId"), RelateType.FromFriend);
            }
        }
        else
        {
            //  如果来自群会话
            ClientGroupData.Create(token.ToInt("clientId"), shareTicket.ToString("openGId"));
            ClientGroupData.Renovate(shareTicket.ToString("openGId"));
        }

        //  初始化题目
        if (shareQuestionId > 0)
        {
            Hash question = ClientQuestionData.GetByClientIdAndQuestionId(token.ToInt("clientId"), shareQuestionId);
            if (question.ToInt("id") == 0)
            {
                ClientQuestionData.Ready(token.ToInt("clientId"), shareQuestionId);
            }
        }

        //  拼装结果信息
        data["openGId"]    = shareTicket.ToString("openGId");
        data["fromClient"] = fromClient;
        return(new Hash((int)CodeType.OK, "成功", data));
    }
        static bool Prefix(Equip __instance)
        {
            if (__instance.name == "Remove Character")
            {
                Dictionary <UIManager.Screen, List <ScreenBase> > openScreensByEnum = Traverse.Create(UIManager.Get()).Field("openScreensByEnum").GetValue <Dictionary <UIManager.Screen, List <ScreenBase> > >();

                //Closes Equip and Navbar to return to HUD
                if (UIManager.Get() != null && openScreensByEnum != null)
                {
                    foreach (KeyValuePair <UIManager.Screen, List <ScreenBase> > keyValuePair in openScreensByEnum)
                    {
                        if (keyValuePair.Value != null && keyValuePair.Value.Count >= 1)
                        {
                            List <ScreenBase> list = new List <ScreenBase>(keyValuePair.Value);
                            foreach (ScreenBase screenBase in list)
                            {
                                if (!(screenBase is TopLayer) && screenBase.name != "HUD(Clone)")
                                {
                                    UIManager.Close(screenBase);
                                }
                            }
                        }
                    }
                }

                //Clones "Giving up people" to simplify it and allow character to be removed without gaining items/rep with the slavyans
                AdvModule  advModule    = Array.Find <AdvModule>(AdventureLibrary.modules, (AdvModule o) => o.name == "Slavyan");
                AdvEvent[] advEventList = Array.FindAll <AdvEvent>(advModule.events, (AdvEvent o) => o.name == "Generic Remove Character");
                AdvEvent   advEvent;
                if (advEventList.GetLength(0) == 0)
                {
                    advEvent        = Array.FindAll <AdvEvent>(advModule.events, (AdvEvent o) => o.name == "Giving up people")[0].Clone();
                    advEvent.module = advModule;
                    advEvent.name   = "Generic Remove Character";
                    Array.Resize <AdvEvent>(ref advModule.events, advModule.events.Length + 1);
                    advModule.events[advModule.events.Length - 1] = advEvent;
                    //advEvent.uniqueID = advModule.GetNextEventIndex(); //Might not be necessary to add ID since it will be removed later
                    UnityEngine.Debug.Log("Equip_ButtonClick_Patch --------------------- making new event " + advEvent.name);
                }
                else
                {
                    //In case the temporary event already exists, but I'm removing them after the event ends
                    advEvent = advEventList[0];
                }

                //Modifies the event to make it more generic and simple
                AdvNode[] nodes = advEvent.nodes;
                foreach (AdvNode node in nodes)
                {
                    if (node is NodeAdventure)
                    {
                        (node as NodeAdventure).story = "You approach your group to decide if anyone should leave.";
                    }
                    List <AdvOutput> outputs = node.outputs;
                    if (outputs != null)
                    {
                        foreach (AdvOutput output in outputs)
                        {
                            if (output.name == "Wish them well and leave.")
                            {
                                output.name = "Send someone away.";
                            }
                            if (output.name == "Actually, ask them to stay with you!")
                            {
                                output.name = "Nevermind.";
                            }
                            if (output.name == "Confirm")
                            {
                                output.targetID = 5;
                            }
                            if (output.name == "Cancel")
                            {
                                output.targetID = 5;
                            }
                        }
                    }
                }

                //Run the new temporary event
                ClientGroupData    selectedGroup = GroupSelectionManager.Get().GetSelectedGroup();
                Thea2.Server.Group group         = null;
                if (selectedGroup != null)
                {
                    group = EntityManager.Get <Thea2.Server.Group>(selectedGroup.GetID(), true);
                }
                AdventureManager adventureManager = AdventureManager.TriggerEvent(group.ownerID, advEvent, group, null, -1, true);

                return(false);
            }

            return(true);
        }