• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Mobile GoddessKiss [Mobile Game]

Newbie Spellweaver
Joined
Feb 9, 2022
Messages
6
Reaction score
1
Im trying to create a Emulator for the Mobile Game GoddessKiss, it got shutdown like 6 months ago.

I didnt start early enough when the Server was still alive so i can only respond with sample Data for now.

So i started running into this Issue here.

When you start the Game first its requesting the GetRegion Packet.

I respond with Sample Data, its proccessing it then Crashes the App since it gets a "NullReferenceException".

Im not sure why it does that, so i need a bit of a push in the right direction.

Also since im unable to really credit Zorno(https://forum.ragezone.com/members/817966.html) , since i used a Portion of his Security Class Code for this game.
Im doing it now, thank you for posting that code and letting People use it.


Code:
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
    public class RequestAttribute : Attribute
    {
        public RequestAttribute(string url, string method, bool wrapParams = true, bool shouldLockUiCamera = true)
        {
            this.url = url;
            this.method = method;
            this.wrapParams = wrapParams;
            this.shouldLockUiCamera = shouldLockUiCamera;
            if (method == "sendMsg" || method == "wait" || method == "waitChannel" || method == "waitGuild" || method == "checkMsg")
            {
                this.url = RemoteObjectManager.instance.ChattingServerUrl;
            }
            else
            {
                this.url = RemoteObjectManager.instance.GameServerUrl;
            }
        }

  [JsonRpcClient.RequestAttribute("http://gk.flerogames.com/checkData.php", "1000", true, true)]
    public void GetRegion()
    {
    }
    
    this is the request ->
    
  {"id":"927b4510","method":1000,"params":{}}

  and response should be this ->

  // crafted response
  {"id":"927b4510",result":{"openDt":0,"maxLv":90,"maxSt":"18-20","plcnt":"1","svcnt":"1"}}
               

     private IEnumerator _SendRequests(string url, bool isfirstPacket, params JsonRpcClient.Request[] requests)
    {
        JsonRpcClient.netStateIdle = false;
        this._LockUiCamera(requests);
        string domain = new Uri(url).Host;
        string value = this._GetSessionId(domain);
        Dictionary<string, JsonRpcClient.Request> requestDict = new Dictionary<string, JsonRpcClient.Request>();
        foreach (JsonRpcClient.Request request in requests)
        {
            requestDict.Add(request.id, request);
        }
        string text = this._ConvertRequestBatchToJsonString(requests);
        LoggerHelper.Error(text, true);
        text = Program.newEncrypt(text);
        JObject[] responses = new JObject[0];
        byte[] array = Encoding.UTF8.GetBytes(text);
        bool isChattingReq = url == RemoteObjectManager.instance.ChattingServerUrl;
        if (url != RemoteObjectManager.instance.ChattingServerUrl)
        {
            this.networkingCount++;
        }
        if (this.networkingCount > 0)
        {
            NetworkAnimation.Instance.On();
        }
        HTTPRequest httprequest = new HTTPRequest(new Uri(url), HTTPMethods.Post, delegate(HTTPRequest req, HTTPResponse resp)
        {
            HTTPRequestStates state = req.State;
            if (state != HTTPRequestStates.Finished)
            {
                if (state - HTTPRequestStates.Error <= 3)
                {
                    UISimplePopup uisimplePopup = UISimplePopup.CreateBool(false, Localization.Get("19303"), Localization.Get("19304"), string.Empty, Localization.Get("1001"), Localization.Get("1000"));
                    bool needReSend = false;
                    uisimplePopup.onClick = delegate(GameObject sender)
                    {
                        if (sender.name == "OK")
                        {
                            needReSend = true;
                        }
                    };
                    uisimplePopup.onClose = delegate()
                    {
                        if (needReSend)
                        {
                            JsonRpcClient.netStateIdle = false;
                            this._LockUiCamera(requests);
                            byte[] array3 = GZipStream.UncompressBuffer(req.RawData);
                            string text3 = Encoding.UTF8.GetString(array3);
                            text3 = Program.newDecrypt(text3);
                            array3 = Encoding.UTF8.GetBytes(text3);
                            JObject[] array4 = this._ConvertResponseBatchToJsonObjects(array3);
                            if (array4.Length != 0)
                            {
                                if (array4[0].Property("reload") == null)
                                {
                                    array4[0].Add("reload", 1);
                                }
                                if (array4.Length == 1)
                                {
                                    text3 = array4[0].ToString(Formatting.None, new JsonConverter[0]);
                                }
                                else
                                {
                                    JArray jarray = new JArray();
                                    foreach (JObject item in array4)
                                    {
                                        jarray.Add(item);
                                    }
                                    text3 = jarray.ToString(Formatting.None, new JsonConverter[0]);
                                }
                            }
                            text3 = Program.newEncrypt(text3);
                            array3 = Encoding.UTF8.GetBytes(text3);
                            array3 = GZipStream.CompressBuffer(array3);
                            req.SetHeader("Content-Length", array3.Length.ToString());
                            req.RawData = array3;
                            if (url != RemoteObjectManager.instance.ChattingServerUrl)
                            {
                                this.networkingCount++;
                            }
                            if (this.networkingCount > 0)
                            {
                                NetworkAnimation.Instance.On();
                            }
                            req.Send();
                            return;
                        }
                        Application.Quit();
                    };
                }
            }
            else if (resp.IsSuccess)
            {
                string text2 = resp.DataAsText;
                byte[] bytes = resp.Data;
                string firstHeaderValue = resp.GetFirstHeaderValue("SET-COOKIE");
                if (!string.IsNullOrEmpty(firstHeaderValue))
                {
                    this._sessionIdDict[domain] = firstHeaderValue;
                }
                text2 = Program.newDecrypt(text2);
                bytes = Encoding.UTF8.GetBytes(text2);
                JObject[] responses = this._ConvertResponseBatchToJsonObjects(bytes);
                JsonRpcClient.Request request2 = null;
                string input = JsonConvert.SerializeObject(responses, Formatting.Indented);
                Program.AddTx("json", input, true);
                foreach (JObject jobject in responses)
                {
                    JToken jtoken;
                    if (jobject.TryGetValue("id", out jtoken))
                    {
                        if (!requestDict.ContainsKey(jtoken.ToString()))
                        {
                            if (jtoken.ToString() == "system" && jobject.TryGetValue("result", out jtoken))
                            {
                                this.systemRequestName = string.Empty;
                                if (request2 != null)
                                {
                                    this.systemRequestName = request2.methodInfo.Name;
                                }
                                this._StartSystemCoroutine(RemoteObjectManager.instance, jtoken);
                            }
                        }
                        else
                        {
                            JsonRpcClient.Request request3 = requestDict[jtoken.ToString()];
                            if (jobject.TryGetValue("error", out jtoken))
                            {
                                this._StartErrorCoroutine(request3, jtoken);
                            }
                            else if (jobject.TryGetValue("result", out jtoken))
                            {
                                this._StartResultCoroutine(request3, jtoken);
                            }
                        }
                    }
                }
            }
            else if (!isChattingReq)
            {
                JToken args = JsonRpcClient._MakeInternalError(resp.Message)["error"];
                foreach (object sender2 in JsonRpcClient._FindSendersOfRequests(requests))
                {
                    this._StartErrorCoroutine(sender2, args);
                }
            }
            this._UnlockUiCamera(requests);
            if (url != RemoteObjectManager.instance.ChattingServerUrl)
            {
                this.networkingCount--;
            }
            if (this.networkingCount <= 0)
            {
                this.networkingCount = 0;
                NetworkAnimation.Instance.Off();
            }
            JsonRpcClient.netStateIdle = true;
        });
        if (!string.IsNullOrEmpty(value))
        {
            httprequest.SetHeader("Cookie", value);
        }
        httprequest.SetHeader("Content-Type", "application/json");
        httprequest.SetHeader("Accept-Encoding", "gzip, deflate");
        array = GZipStream.CompressBuffer(array);
        httprequest.SetHeader("Content-Length", array.Length.ToString());
        httprequest.RawData = array;
        httprequest.Send();
        yield break;
    }


    [JsonObject(MemberSerialization.OptIn)]
    public class ChannelData
    {
        [JsonProperty("openDt")]
        public double openTime { get; set; }
        [JsonProperty("maxLv")]
        public int maxLevel { get; set; }
        [JsonProperty("maxSt")]
        public string maxStage { get; set; }
        [JsonProperty("plcnt")]
        public string commanderCount { get; set; }
        [JsonProperty("svcnt")]
        public string serverCount { get; set; }
    }
     
     private IEnumerator GetRegionResult(JsonRpcClient.Request request, Dictionary<string, Protocols.ChannelData> result)
    {
        M00_Init m00_Init = UnityEngine.Object.FindObjectOfType(typeof(M00_Init)) as M00_Init;
        if (m00_Init != null)
        {
            m00_Init.SelectLangeAndVersinonCheck(result);
        }
        yield break;
    }


    public void SelectLangeAndVersinonCheck(Dictionary<string, Protocols.ChannelData> channel)
    {
        this.dicChannel = channel;
        if (string.IsNullOrEmpty(PlayerPrefs.GetString("Language")))
        {
            this.SelectLanguage.SetActive(true);
        }
        else if (string.IsNullOrEmpty(PlayerPrefs.GetString("PermissionCheck")))
        {
            this.PermissionCheck.SetActive(true);
        }
        else if (!PlayerPrefs.HasKey("Channel"))
        {
            this.channelListView.InitChannel(this.dicChannel, "Channel-");
            this.SelectChannel.SetActive(true);
        }
        else
        {
            base.StartCoroutine(RemoteObjectManager.instance.GameVersionInfo());
        }
    }

Error is this
Code:
11-19 22:20:56.477  3848  3869 E Unity   : NullReferenceException: Object reference not set to an instance of an object
11-19 22:20:56.477  3848  3869 E Unity   :   at UIDefaultListView.InitChannel (System.Collections.Generic.Dictionary`2 list, System.String idPrefix) [0x00000] in <filename unknown>:0 
11-19 22:20:56.477  3848  3869 E Unity   :   at M00_Init.SelectLangeAndVersinonCheck (System.Collections.Generic.Dictionary`2 channel) [0x00000] in <filename unknown>:0 
11-19 22:20:56.477  3848  3869 E Unity   :   at RemoteObjectManager+<GetRegionResult>c__Iterator79.MoveNext () [0x00000] in <filename unknown>:0 
11-19 22:20:56.477  3848  3869 E Unity   :   at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0 
11-19 22:20:56.477  3848  3869 E Unity   : UnityEngine.MonoBehaviour:StartCoroutine_Auto_Internal(IEnumerator)
11-19 22:20:56.477  3848  3869 E Unity   : UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
11-19 22:20:56.477  3848  3869 E Unity   : JsonRpcClient:_StartResultCoroutine(Request, JToken)
11-19 22:20:56.477  3848  3869 E Unity   : <>c__DisplayClass0_0__6:<_SendRequests>b__0(HTTPRequest, HTTPResponse)
11-19 22:20:56.477  3848  3869 E Unity   : BestHTTP.HTTPRequest:CallCallback()
11-19 22:20:56.477  3848  3869 E Unity   : BestHTTP.ConnectionBase:HandleCallback()
11-19 22:20:56.477  3848  3869 E Unity   : BestHTTP.HTTPManager:OnUpdate()
11-19 22:20:56.477  3848  3869 E Unity   : BestHTTP.HTTPUpdateDelegator:Update()
11-19 22:20:56.477  3848  3869 E Unity   :  
11-19 22:20:56.477  3848  3869 E Unity   : (Filename:  Line: -1)
11-19 22:20:56.477  3848  3869 E Unity   : 
11-19 22:20:56.518  3848  3869 E Unity   : Ex [HTTPRequest]: CallCallback - Message: 1: Object reference not set to an instance of an object   at JsonRpcClient+<>c__DisplayClass0_0__6.<_SendRequests>b__0 (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse resp) [0x00000] in <filename unknown>:0 
11-19 22:20:56.518  3848  3869 E Unity   :   at BestHTTP.HTTPRequest.CallCallback () [0x00000] in <filename unknown>:0   StackTrace:   at JsonRpcClient+<>c__DisplayClass0_0__6.<_SendRequests>b__0 (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse resp) [0x00000] in <filename unknown>:0 
11-19 22:20:56.518  3848  3869 E Unity   :   at BestHTTP.HTTPRequest.CallCallback () [0x00000] in <filename unknown>:0 
11-19 22:20:56.518  3848  3869 E Unity   :  
11-19 22:20:56.518  3848  3869 E Unity   : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
11-19 22:20:56.518  3848  3869 E Unity   :
 
Back
Top