//This enumerator checks every second for damage taken and sends a different gameplay update with the damage taken. private IEnumerator PvPHitTaken() { for (;;) { if (((SFSMultiplayer)GameObject.Find("SmartFoxObject").GetComponent(typeof(SFSMultiplayer))).UsersInInstance.Count > 0 && !DF34_6d6b8d6e9c7a8c0b2348af0e038e8df6d0752dd4.DF34_830bbe668bdf0a93412e1253e38b452f191dac88("GameplayStats_Health").Equals("-1")) { //Initialization if (this.lastHP == 0) { this.lastHP = int.Parse(DF34_6d6b8d6e9c7a8c0b2348af0e038e8df6d0752dd4.DF34_830bbe668bdf0a93412e1253e38b452f191dac88("GameplayStats_Health")) + int.Parse(DF34_6d6b8d6e9c7a8c0b2348af0e038e8df6d0752dd4.DF34_830bbe668bdf0a93412e1253e38b452f191dac88("GameplayStats_Armour")); } else { //Calculate current total health by adding HP + Armour together. int current = int.Parse(DF34_6d6b8d6e9c7a8c0b2348af0e038e8df6d0752dd4.DF34_830bbe668bdf0a93412e1253e38b452f191dac88("GameplayStats_Health")) + int.Parse(DF34_6d6b8d6e9c7a8c0b2348af0e038e8df6d0752dd4.DF34_830bbe668bdf0a93412e1253e38b452f191dac88("GameplayStats_Armour")); if (this.lastHP != current) { //Send the damage taken and the current player position since we're going to display a damage number where the hit actually occurred. string text = (this.lastHP - current).ToString(); string text2 = string.Concat(new object[] { "(", this.mainPlayer.transform.position.x, ",", 2, ",", this.mainPlayer.transform.position.z, ")" }); //PvPHit is the header for this one, carrot character to split again. this.SendUpdate(string.Concat(new string[] { "PvPHit^", text, "^", text2 })); //Update lastHP after the update was sent out. this.lastHP = current; } } } yield return(new WaitForSeconds(1f)); } yield break; }
//Checks for health change every 2 minutes and prepare a SmartFox game update to send that change since damage dealt between the two clients is not accurate. private IEnumerator PvPHPUpdate() { for (;;) { //Check for other users and ensure the player data is properly loaded since this script is loaded on startup. if (((SFSMultiplayer)GameObject.Find("SmartFoxObject").GetComponent(typeof(SFSMultiplayer))).UsersInInstance.Count > 0 && !DF34_6d6b8d6e9c7a8c0b2348af0e038e8df6d0752dd4.DF34_830bbe668bdf0a93412e1253e38b452f191dac88("GameplayStats_Health").Equals("-1")) { //These two obfuscated integers are the percentage value for health and armour, we send these to display the bars. string text = DFHUD.DF34_7c1c08c1eb7fe9f98e5219e85a2b812c6285fce0.ToString(); string text2 = DFHUD.DF34_1da8681ac7ff0526a20a20c66866e6b3b21216db.ToString(); //Separator is a carror, PvPUpdate is the header the Smartfox parser checks for our special gameplay update. this.SendUpdate(string.Concat(new string[] { "PvPUpdate^", text, "^", text2 })); //I don't believe I use this, reminder to delete later. this.lastUpdateValues[0] = text; this.lastUpdateValues[1] = text2; } yield return(new WaitForSeconds(2f)); } yield break; }