Пример #1
0
        public bool CallPostEJ(int index, double randomDiff = 0)
        {
            System.Diagnostics.Debug.WriteLine("index=" + index.ToString());

            EJ eventJoin = new EJ();

            // Introduce some variability - add or subtract Xms from the time.
            DateTime Now = new DateTime(DateTime.Now.Ticks);

            eventJoin.mobileTime = Now.AddMinutes(randomDiff).ToString();

            // Get next UL from stack and join show.
            string api    = "api/user_locations/" + ulStack[index] + "/event_joins";
            bool   result = MakeWebCall(api, true, null, eventJoin, index) != null;

            return(result);
        }
Пример #2
0
        static string MakeWebCall(string url, bool isPost = false, UL userLocationToRegister = null, EJ eventJoin = null, int index = 0)
        {
            try
            {
                using (var client = new WebClient())
                {
                    // New code:
                    //client.BaseAddress = new Uri("http://main-1156949061.us-west-2.elb.amazonaws.com/");
                    client.BaseAddress = "http://www.litewaveinc.com/";
                    //client.BaseAddress = "http://127.0.0.1:3000/";
                    //client.Headers.Add("Accept: application/json");
                    client.Headers.Add("Content-Type", "application/json");

                    string response = null;
                    if (isPost)
                    {
                        MemoryStream ms = new MemoryStream();
                        DataContractJsonSerializer jsonSer;
                        if (userLocationToRegister != null)
                        {
                            //Create a Json Serializer for our type
                            jsonSer = new DataContractJsonSerializer(typeof(UL));

                            // use the serializer to write the object to a MemoryStream
                            jsonSer.WriteObject(ms, userLocationToRegister);
                        }
                        else if (eventJoin != null)
                        {
                            //Create a Json Serializer for our type
                            jsonSer = new DataContractJsonSerializer(typeof(EJ));

                            // use the serializer to write the object to a MemoryStream
                            jsonSer.WriteObject(ms, eventJoin);
                        }
                        ms.Position = 0;

                        // use a Stream reader to construct the StringContent (Json)
                        StreamReader sr = new StreamReader(ms);
                        //StringContent theContent = new StringContent(sr.ReadToEnd(), System.Text.Encoding.UTF8, "application/json");

                        string data          = sr.ReadToEnd();
                        byte[] postArray     = Encoding.ASCII.GetBytes(data);
                        byte[] responseArray = client.UploadData(url, "POST", postArray);
                        response = Encoding.ASCII.GetString(responseArray);
                    }
                    else
                    {
                        Stream       data   = client.OpenRead(url);
                        StreamReader reader = new StreamReader(data);
                        response = reader.ReadToEnd();
                    }

                    if (response != null)
                    {
                        if (isPost && userLocationToRegister != null)
                        {
                            ULResult ulResult = new ULResult();
                            DataContractJsonSerializer jsonSer;
                            jsonSer = new DataContractJsonSerializer(typeof(ULResult));

                            byte[]       byteArray = Encoding.ASCII.GetBytes(response);
                            MemoryStream stream    = new MemoryStream(byteArray);
                            ulResult         = (ULResult)jsonSer.ReadObject(stream);
                            ulStack[ULCount] = ulResult._id;
                            ULCount++;
                        }
                        else if (isPost && eventJoin != null)
                        {
                            EventJoin ej = new EventJoin();
                            DataContractJsonSerializer jsonSer;
                            jsonSer = new DataContractJsonSerializer(typeof(EventJoin));

                            byte[]       byteArray = Encoding.ASCII.GetBytes(response);
                            MemoryStream stream    = new MemoryStream(byteArray);
                            ej = (EventJoin)jsonSer.ReadObject(stream);
                            commandsStack[index] = ej;
                            EJCount++;
                        }

                        return(response);
                    }
                }
            }
            catch (WebException webEx)
            {
                HttpWebResponse response = (System.Net.HttpWebResponse)webEx.Response;
                if (response.StatusCode == HttpStatusCode.NotFound)
                {
                    System.Diagnostics.Debug.WriteLine("Not found!");
                }
            }

            return(null);
        }
Пример #3
0
        public override Dictionary <string, string> GetCharacterDisplayCalculationValues()
        {
            Dictionary <string, string> dictValues = new Dictionary <string, string>();

            dictValues.Add("Status", string.Format("Overall: {0,-10} Fight: {1,-10} Burst: {2,-10}",
                                                   OverallPoints.ToString("N0"),
                                                   FightPoints.ToString("N0"),
                                                   BurstPoints.ToString("N0")));



            //Basic Stats
            dictValues["Health"]         = BasicStats.Health.ToString("N00");
            dictValues["Stamina"]        = BasicStats.Stamina.ToString("N00");
            dictValues["Mana"]           = BasicStats.Mana.ToString("N00");
            dictValues["Intellect"]      = BasicStats.Intellect.ToString("N00");
            dictValues["Spirit"]         = BasicStats.Spirit.ToString("N00");
            dictValues["Mastery Rating"] = string.Format("{0}*{1} Mastery Rating",
                                                         (8 + BasicStats.MasteryRating / 179.28f).ToString("N02"), BasicStats.MasteryRating);
            dictValues["Spell Power"]  = string.Format("{0}", SpellPowerTotal.ToString("N00"));
            dictValues["Mana Regen"]   = string.Format("{0}", ManaRegenRate.ToString("N00"));
            dictValues["Combat Regen"] = string.Format("{0}", CombatRegenRate.ToString("N00"));
            // dictValues["Mp5"] = BasicStats.Mp5.ToString("N00");
            dictValues["Spell Crit"]  = string.Format("{0}%*{1} Crit Rating", (BasicStats.SpellCrit * 100).ToString("N02"), BasicStats.CritRating);
            dictValues["Spell Haste"] = string.Format("{0}%*Haste breakdown:\nHaste Rating {1} gives {2} haste.\nTalent haste multipliers:\nSpeed of Light: {3}\nJudgements of the Pure: {4}\nOther Haste: {5} (probably from buffs)",
                                                      (BasicStats.SpellHaste * 100).ToString("N02"), BasicStats.HasteRating,
                                                      (BasicStats.RangedHaste * 100).ToString("N02"), HasteSoL.ToString("N02"), HasteJotP.ToString("N02"),
                                                      (((1f + BasicStats.SpellHaste) / (1f + BasicStats.PhysicalHaste) - 1f) * 100f).ToString("N02"));

            // Cycle Stats
            dictValues["Total Healed"] = string.Format("{0} healing", TotalHealed.ToString("N00"));
            dictValues["Total Mana"]   = string.Format("{0} mana *Mana Sources:\nBase Mana: {1} \nCombat Regen: {2}\nJudgements: {3}\nReplenishment: {4}\nDivine Plea: {5}\nArcane Torrent: {6}\nLay on Hands: {7}\nMP5: {8}\nMelee: {9}\nOther: {10}",
                                                       TotalMana.ToString("N00"), ManaBase.ToString("N00"), CombatRegenTotal.ToString("N00"), ManaJudgements.ToString("N00"),
                                                       ManaReplenishment.ToString("N00"), ManaDivinePlea.ToString("N00"), ManaArcaneTorrent.ToString("N00"),
                                                       ManaLayOnHands.ToString("N00"), ManaMp5.ToString("N00"), ManaMelee.ToString("N00"), ManaOther.ToString("N00"));

            dictValues["Average Healing per sec"]  = string.Format("{0} hps", AvgHPS.ToString("N00"));
            dictValues["Average Healing per mana"] = string.Format("{0} hpm", AvgHPM.ToString("N02"));
            dictValues["Fight Length"]             = string.Format("{0} sec *{1} Active Time \n{2} Total Cast Time",
                                                                   FightLength.ToString("N00"), ActiveTime.ToString("N00"), RotationTotal.ToString("N00"));


            // Healing Breakdown
            dictValues["Holy Light Healed"] = string.Format("{0} *Holy Light Information: \nNumber of Casts: {1}\nTotal cast time: {2} sec\nTotal mana used: {3}",
                                                            HealedHL.ToString("N00"), HLCasts.ToString("N01"), RotationHL.ToString("N02"), UsageHL.ToString("N00"));
            dictValues["Divine Light Healed"] = string.Format("{0} *Divine Light Information: \nNumber of Casts: {1}\nTotal cast time: {2} sec\nTotal mana used: {3}",
                                                              HealedDL.ToString("N00"), DLCasts.ToString("N01"), RotationDL.ToString("N02"), UsageDL.ToString("N00"));
            dictValues["Flash of Light Healed"] = string.Format("{0} *Flash of Light Information: \nNumber of Casts: {1}\nTotal cast time: {2} sec\nTotal mana used: {3}",
                                                                HealedFoL.ToString("N00"), FoLCasts.ToString("N01"), RotationFoL.ToString("N02"), UsageFoL.ToString("N00"));
            HSCasts = HS.Casts(); // I wasn't sure how to print this directly, so I made this variable to get it to work for now
            dictValues["Holy Shock Healed"] = string.Format("{0} *Holy Shock Information: \nNumber of Casts: {1}\nTotal cast time: {2} sec\nTotal mana used: {3}",
                                                            HealedHS.ToString("N00"), HSCasts.ToString("N00"), RotationHS.ToString("N02"), UsageHS.ToString("N00"));
            dictValues["Word of Glory Healed"] = string.Format("{0} *Word of Glory Information: \nNumber of Casts: {1}\nTotal cast time: {2} sec\nTotal mana used: {3}",
                                                               HealedWoG.ToString("N00"), WoGCasts.ToString("N00"), RotationWoG.ToString("N02"), UsageWoG.ToString("N00"));
            dictValues["Light of Dawn Healed"] = string.Format("{0} *Light of Dawn Information: \nNumber of Casts: {1}\nTotal cast time: {2} sec\nTotal mana used: {3}",
                                                               HealedLoD.ToString("N00"), LoDCasts.ToString("N00"), RotationLoD.ToString("N02"), UsageLoD.ToString("N00"));
            dictValues["Holy Radiance Healed"] = string.Format("{0} *Holy Radiance Information: \nNumber of Casts: {1}\nTotal cast time: {2} sec\nTotal mana used: {3}",
                                                               HealedHR.ToString("N00"), HRCasts.ToString("N00"), RotationHR.ToString("N02"), UsageHR.ToString("N00"));
            BoLCasts = BoL.Casts();  // I wasn't sure how to print this directly, so I made this variable to get it to work for now
            dictValues["Beacon of Light Healed"] = string.Format("{0} *Beacon of Light Information: \nNumber of Casts: {1}\nTotal cast time: {2} sec\nTotal mana used: {3}",
                                                                 HealedBoL.ToString("N00"), BoLCasts.ToString("N00"), RotationBoL.ToString("N02"), UsageBoL.ToString("N00"));
            LoHCasts = LoH.Casts();
            dictValues["Lay on Hands Healed"] = string.Format("{0} *Lay on Hands Information: \nNumber of Casts: {1}\nTotal cast time: {2} sec\nTotal mana used: {3}",
                                                              HealedLoH.ToString("N00"), LoHCasts.ToString("N00"), RotationLoH.ToString("N02"), UsageLoH.ToString("N00"));
            //dictValues["Glyph of HL Healed"] = string.Format("{0} ", HealedGHL.ToString("N00")); take this out, seems like this glyph no longer exists
            dictValues["Protector of the Innocent "] = string.Format("{0} *Protector of the Innocent Info:\nNumber of Casts: {1}",
                                                                     HealedPotI.ToString("N00"), PotICasts.ToString("N00"));
            dictValues["Enlightened Judgements "] = string.Format("{0} *Enlightened Judgements Info:\nNumber of Casts: {1}",
                                                                  HealedJudge.ToString("N00"), JudgeCasts.ToString("N00"));
            dictValues["Illuminated Healing"] = string.Format("{0} *These are from the absorb shields, and increase with Mastery stat.\nThe shields often expire or are overwritten.\nSee options tab to adjust the effective %.",
                                                              HealedIH.ToString("N00"));
            dictValues["Cleanse casting"] = string.Format("*Based on the settings from the options tab, you cast Cleanse {0} times, using up {1} mana.",
                                                          CleanseCasts.ToString("N00"), UsageCleanse.ToString("N00"));
            dictValues["Other Healed"] = string.Format("{0} ", HealedOther.ToString("N00"));

            //Spell Details
            dictValues["Holy Light"]     = "*" + HL.ToString();
            dictValues["Flash of Light"] = "*" + FoL.ToString();
            dictValues["Holy Shock"]     = "*" + HS.ToString();
            dictValues["Divine Light"]   = "*" + DL.ToString();
            dictValues["Word of Glory(3 holy power)"] = "*" + WoG.ToString();
            dictValues["LoD(3 hp, max targets)"]      = "*" + LoD.ToString();
            dictValues["Holy Radiance (max)"]         = "*" + HR.ToString();
            dictValues["Lay on Hands"] = "*" + LoH.ToString();
            dictValues["Protector of the Innocent"] = "*" + PotI.ToString();
            dictValues["Enlightened Judgements"]    = "*" + EJ.ToString();

            return(dictValues);
        }