Beispiel #1
0
        public override void PerformArea()
        {
            base.PerformArea();

            if (!Account.Settings.PerformDungeons || DateTime.Now < Account.DungeonEndTime || Account.BackpackIsFull)
            {
                return;
            }

            if (!Account.QuestIsStarted && !Account.TownWatchIsStarted || Account.MirrorIsCompleted)
            {
                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                RaiseMessageEvent("Betrete Dungeonübersicht");
                string   s             = SendRequest(ActionTypes.JoinDungeon);
                string[] answerRequest = s.Split('/');

                int d1Lvl  = Convert.ToInt32(answerRequest[480]) - 1;
                int d2Lvl  = Convert.ToInt32(answerRequest[481]) - 1;
                int d3Lvl  = Convert.ToInt32(answerRequest[482]) - 1;
                int d4Lvl  = Convert.ToInt32(answerRequest[483]) - 1;
                int d5Lvl  = Convert.ToInt32(answerRequest[484]) - 1;
                int d6Lvl  = Convert.ToInt32(answerRequest[485]) - 1;
                int d7Lvl  = Convert.ToInt32(answerRequest[486]) - 1;
                int d8Lvl  = Convert.ToInt32(answerRequest[487]) - 1;
                int d9Lvl  = Convert.ToInt32(answerRequest[488]) - 1;
                int d10Lvl = Convert.ToInt32(answerRequest[489]) - 1;
                int d11Lvl = 0;                 // Convert.ToInt32(answerRequest[442 + 11 - 10 - 1 - 1]) - 1;  //nicht sicher
                int d12Lvl = 0;                 //Convert.ToInt32(answerRequest[491 - 121]) - 1; //nicht sicher, eventuell ist d12 und d13 vertauscht
                int d13Lvl = 0;                 // Convert.ToInt32(answerRequest[442 + 13 - 10 - 1 - 2]) - 1; //nicht sicher

                DungeonType nextDungeon;
                nextDungeon = FilterNextDungeon(d1Lvl, d2Lvl, d3Lvl, d4Lvl, d5Lvl, d6Lvl, d7Lvl, d8Lvl, d9Lvl, d10Lvl, d11Lvl, d12Lvl, d13Lvl);
                if (nextDungeon == null)
                {
                    Account.DungeonEndTime = DateTime.Now.AddHours(1);
                    throw new Exception("Keinen Dungeon gefunden");
                }
                RaiseMessageEvent(String.Concat("Es wird Dungeon ", nextDungeon.DungeonID, " mit der Ebene ", nextDungeon.DungeonEbene, " versucht (MonsterLvl ist ", nextDungeon.DungeonMonsterLvl, ")"));

                //sleep
                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                s = SendRequest(String.Concat(ActionTypes.DoDungeon, nextDungeon.DungeonID));
                //sleep
                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                s = SendRequest(ActionTypes.JoinCharacter);
                Account.DungeonEndTime = DateTime.Now.AddHours(1);
                //set 1h for next dungeon time

                CharScreenArea.UpdateAccountStats(s, Account);
            }
        }
Beispiel #2
0
        public string GetOneBackpackSlotTroughMagicShop()
        {
            RaiseMessageEvent("Betrete Zauberladen");
            ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
            string s = SendRequest(ActionTypes.JoinMagicshop);

            if (Account.BackpackItems.Where(b => b.SilverValue != 0 && b.Typ != ItemTypes.Buff && b.IsEpic == false).Count() > 0)
            {
                int backpackslotWithLowestItemValue = Account.BackpackItems.Where(b => b.SilverValue != 0 && b.Typ != ItemTypes.Buff && b.IsEpic == false).OrderBy(b => b.SilverValue).First().InventoryID;
                s = SellItemWithLowestValue(backpackslotWithLowestItemValue, s);
            }
            else
            {
                s = SellItemWithLowestValue(1, s);
            }

            CharScreenArea.UpdateAccountStats(s, Account);

            return(s);
        }
Beispiel #3
0
        public override void PerformArea()
        {
            base.PerformArea();

            //wenn Townwatch läuft tue nichts

            if (!Account.Settings.PerformTownwatch)
            {
                return;
            }

            string s;

            if ((Account.ALU_Seconds == 0 || !Account.Settings.PerformQuesten) && !Account.QuestIsStarted && !Account.TownWatchIsStarted)
            {
                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                RaiseMessageEvent("Betrete Stadtwache");
                s = SendRequest(ActionTypes.JoinTownWatch);

                s = DoWork(s);
            }
            else
            {
                if (DateTime.Now > Account.TownWatchEndTime && Account.TownWatchIsStarted)
                {
                    ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                    RaiseMessageEvent("Betrete Stadtwache");

                    s = SendRequest(ActionTypes.JoinTownWatch);
                    RaiseMessageEvent("Stadtwache beendet");
                    ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                    s = SendRequest(ActionTypes.JoinCharacter);
                    Account.TownWatchIsStarted = false;
                    CharScreenArea.UpdateAccountStats(s, Account);
                }
            }
        }
Beispiel #4
0
        public override void PerformArea()
        {
            base.PerformArea();

            if (Account.BackpackIsFull || !DateTime.Now.Hour.IsBetween(Account.Settings.TownWatchMinHourForShortWork, Account.Settings.TownWatchMaxHourForShortWork))
            {
                return;
            }

            string s;

            if (!Account.QuestIsStarted && !Account.TownWatchIsStarted)
            {
                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                RaiseMessageEvent("Betrete Taverne");
                s = SendRequest(ActionTypes.JoinTarvern);
                string[] answerTavern = s.Split('/');

                if (s.Substring(0, 4).Contains("103") || s.Substring(0, 4).Contains("106"))
                {
                    ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                    s = SendRequest(ActionTypes.JoinCharacter);
                    ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                    s            = SendRequest(ActionTypes.JoinTarvern);
                    answerTavern = s.Split('/');
                }
                int alu = Convert.ToInt32(answerTavern[456]);
                Account.ALU_Seconds = alu;

                if (Account.Settings.BuyBeer)
                {
                    //answerTarvern[457] //usedBeerAmount
                    //answerTarvern[108] //länge > 2 dann gibt es max 11 beer
                    int usedBeer = Convert.ToInt32(answerTavern[457]);
                    int maxBeer  = answerTavern[108].Length > 2 ? 11 : 10;
                    if (usedBeer < maxBeer && usedBeer < Account.Settings.MaxBeerToBuy && Account.ALU_Seconds <= 20 * 60)
                    {
                        while (Account.ALU_Seconds + 20 * 60 < 100 * 60 && Account.Mushroom > 1 && usedBeer < maxBeer)
                        {
                            ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                            SendRequest(ActionTypes.BuyBeer);
                            Account.ALU_Seconds += 20 * 60;
                            usedBeer            += 1;
                            Account.Mushroom    -= 1;
                            RaiseMessageEvent("Kaufe Bier " + usedBeer.ToString());
                        }
                    }
                }

                if (Account.ALU_Seconds == 0)
                {
                    RaiseMessageEvent("Keine Alu mehr");
                    return;
                }

                int quest1Duration = Convert.ToInt32(answerTavern[241]);
                int quest2Duration = Convert.ToInt32(answerTavern[242]);
                int quest3Duration = Convert.ToInt32(answerTavern[243]);

                if (Account.ALU_Seconds < quest1Duration && Account.ALU_Seconds < quest2Duration && Account.ALU_Seconds < quest3Duration)
                {
                    Account.ALU_Seconds = 0;
                    RaiseMessageEvent("Alu reicht für keine Quest mehr aus.");
                    return;
                }

                ItemTypes quest1ItemType = answerTavern[244].ToEnum <ItemTypes>();
                ItemTypes quest2ItemType = answerTavern[256].ToEnum <ItemTypes>();
                ItemTypes quest3ItemType = answerTavern[278].ToEnum <ItemTypes>();

                int quest1XP = Convert.ToInt32(answerTavern[280]);
                int quest2XP = Convert.ToInt32(answerTavern[281]);
                int quest3XP = Convert.ToInt32(answerTavern[282]);

                int quest1Gold = Convert.ToInt32(answerTavern[283]);
                int quest2Gold = Convert.ToInt32(answerTavern[284]);
                int quest3Gold = Convert.ToInt32(answerTavern[285]);

                // 30 - 42 => Spiegelstück
                // 1 - 10 => Dungeonschlüssel
                // 20 => Kloschlüssel
                int keyOrMirrorDescription = Convert.ToInt32(answerTavern[245]);

                if (Account.Settings.PerformQuesten)
                {
                    ThreadSleep(Account.Settings.minLongTime, Account.Settings.maxLongTime);
                    if (quest1ItemType == ItemTypes.SpiegelOderSchlüssel || quest2ItemType == ItemTypes.SpiegelOderSchlüssel || quest3ItemType == ItemTypes.SpiegelOderSchlüssel)
                    {
                        RaiseMessageEvent("Schlüssel oder Spiegelstück gefunden.");
                        if (quest1ItemType == ItemTypes.SpiegelOderSchlüssel)
                        {
                            s = SendRequest(ActionTypes.TakeQuest1);
                            Account.ALU_Seconds   -= quest1Duration;
                            Account.QuestIsStarted = true;
                            Account.QuestEndTime   = DateTime.Now.AddSeconds(quest1Duration);
                        }
                        else if (quest2ItemType == ItemTypes.SpiegelOderSchlüssel)
                        {
                            s = SendRequest(ActionTypes.TakeQuest2);
                            Account.ALU_Seconds   -= quest2Duration;
                            Account.QuestIsStarted = true;
                            Account.QuestEndTime   = DateTime.Now.AddSeconds(quest2Duration);
                        }
                        else if (quest3ItemType == ItemTypes.SpiegelOderSchlüssel)
                        {
                            s = SendRequest(ActionTypes.TakeQuest3);
                            Account.ALU_Seconds   -= quest3Duration;
                            Account.QuestIsStarted = true;
                            Account.QuestEndTime   = DateTime.Now.AddSeconds(quest3Duration);
                        }
                    }
                    else
                    {
                        switch (Account.Settings.QuestMode)
                        {
                        case AutoQuestMode.BestXP:
                            int xpSecondQuest1 = quest1XP / quest1Duration;
                            int xpSecondQuest2 = quest2XP / quest2Duration;
                            int xpSecondQuest3 = quest3XP / quest3Duration;
                            if (xpSecondQuest1 >= xpSecondQuest2 && xpSecondQuest1 >= xpSecondQuest3)
                            {
                                s = SendRequest(ActionTypes.TakeQuest1);
                                Account.ALU_Seconds   -= quest1Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest1Duration);
                            }
                            else if (xpSecondQuest2 >= xpSecondQuest1 && xpSecondQuest2 >= xpSecondQuest3)
                            {
                                s = SendRequest(ActionTypes.TakeQuest2);
                                Account.ALU_Seconds   -= quest2Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest2Duration);
                            }
                            else if (xpSecondQuest3 >= xpSecondQuest1 && xpSecondQuest3 >= xpSecondQuest2)
                            {
                                s = SendRequest(ActionTypes.TakeQuest3);
                                Account.ALU_Seconds   -= quest3Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest3Duration);
                            }
                            break;

                        case AutoQuestMode.BestGold:
                            int goldSecondQuest1 = quest1Gold / quest1Duration;
                            int goldSecondQuest2 = quest2Gold / quest2Duration;
                            int goldSecondQuest3 = quest3Gold / quest3Duration;
                            if (goldSecondQuest1 >= goldSecondQuest2 && goldSecondQuest1 >= goldSecondQuest3)
                            {
                                s = SendRequest(ActionTypes.TakeQuest1);
                                Account.ALU_Seconds   -= quest1Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest1Duration);
                            }
                            else if (goldSecondQuest2 >= goldSecondQuest1 && goldSecondQuest2 >= goldSecondQuest3)
                            {
                                s = SendRequest(ActionTypes.TakeQuest2);
                                Account.ALU_Seconds   -= quest2Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest2Duration);
                            }
                            else if (goldSecondQuest3 >= goldSecondQuest1 && goldSecondQuest3 >= goldSecondQuest2)
                            {
                                s = SendRequest(ActionTypes.TakeQuest3);
                                Account.ALU_Seconds   -= quest3Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest3Duration);
                            }
                            break;

                        case AutoQuestMode.BestTime:
                            if (quest1Duration <= quest2Duration && quest1Duration <= quest3Duration)
                            {
                                s = SendRequest(ActionTypes.TakeQuest1);
                                Account.ALU_Seconds   -= quest1Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest1Duration);
                            }
                            else if (quest2Duration <= quest1Duration && quest2Duration <= quest3Duration)
                            {
                                s = SendRequest(ActionTypes.TakeQuest2);
                                Account.ALU_Seconds   -= quest2Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest2Duration);
                            }
                            else if (quest3Duration <= quest1Duration && quest3Duration <= quest2Duration)
                            {
                                s = SendRequest(ActionTypes.TakeQuest3);
                                Account.ALU_Seconds   -= quest3Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest3Duration);
                            }
                            break;

                        case AutoQuestMode.HighstMountPerSecond:
                            int _xpSecondQuest1   = quest1XP / quest1Duration;
                            int _xpSecondQuest2   = quest2XP / quest2Duration;
                            int _xpSecondQuest3   = quest3XP / quest3Duration;
                            int _goldSecondQuest1 = quest1Gold / quest1Duration;
                            int _goldSecondQuest2 = quest2Gold / quest2Duration;
                            int _goldSecondQuest3 = quest3Gold / quest3Duration;
                            if (GreaterThen(_xpSecondQuest1, _xpSecondQuest1, _xpSecondQuest2, _xpSecondQuest3, _goldSecondQuest1, _goldSecondQuest2, _goldSecondQuest3))
                            {
                                s = SendRequest(ActionTypes.TakeQuest1);
                                Account.ALU_Seconds   -= quest1Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest1Duration);
                            }
                            else if (GreaterThen(_xpSecondQuest2, _xpSecondQuest1, _xpSecondQuest2, _xpSecondQuest3, _goldSecondQuest1, _goldSecondQuest2, _goldSecondQuest3))
                            {
                                s = SendRequest(ActionTypes.TakeQuest2);
                                Account.ALU_Seconds   -= quest2Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest2Duration);
                            }
                            else if (GreaterThen(_xpSecondQuest3, _xpSecondQuest1, _xpSecondQuest2, _xpSecondQuest3, _goldSecondQuest1, _goldSecondQuest2, _goldSecondQuest3))
                            {
                                s = SendRequest(ActionTypes.TakeQuest3);
                                Account.ALU_Seconds   -= quest3Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest3Duration);
                            }
                            else if (GreaterThen(_goldSecondQuest1, _xpSecondQuest1, _xpSecondQuest2, _xpSecondQuest3, _goldSecondQuest1, _goldSecondQuest2, _goldSecondQuest3))
                            {
                                s = SendRequest(ActionTypes.TakeQuest1);
                                Account.ALU_Seconds   -= quest1Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest1Duration);
                            }
                            else if (GreaterThen(_goldSecondQuest2, _xpSecondQuest1, _xpSecondQuest2, _xpSecondQuest3, _goldSecondQuest1, _goldSecondQuest2, _goldSecondQuest3))
                            {
                                s = SendRequest(ActionTypes.TakeQuest2);
                                Account.ALU_Seconds   -= quest2Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest2Duration);
                            }
                            else if (GreaterThen(_goldSecondQuest3, _xpSecondQuest1, _xpSecondQuest2, _xpSecondQuest3, _goldSecondQuest1, _goldSecondQuest2, _goldSecondQuest3))
                            {
                                s = SendRequest(ActionTypes.TakeQuest3);
                                Account.ALU_Seconds   -= quest3Duration;
                                Account.QuestIsStarted = true;
                                Account.QuestEndTime   = DateTime.Now.AddSeconds(quest3Duration);
                            }
                            break;
                        }
                    }
                    RaiseMessageEvent("Quest endet: " + Account.QuestEndTime.ToString());
                }
            }
            else
            {
                if (DateTime.Now > Account.QuestEndTime && Account.QuestIsStarted)
                {
                    ThreadSleep(Account.Settings.minLongTime, Account.Settings.maxLongTime);
                    string t = SendRequest(ActionTypes.JoinTarvern);
                    ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                    string returnString = SendRequest(ActionTypes.JoinCharacter);
                    Account.QuestIsStarted = false;
                    RaiseMessageEvent("Quest ist erledigt");

                    CharScreenArea.UpdateAccountStats(returnString, Account);
                }
            }
        }
Beispiel #5
0
        public override void PerformArea()
        {
            base.PerformArea();

            string s;

            if (Account.BackpackItems.Count == 0 || Account.InventoryItems.Count == 0)
            {
                RaiseMessageEvent("Charakterübersicht betreten");
                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                s = SendRequest(ActionTypes.JoinCharacter);
                CharScreenArea.UpdateAccountStats(s, Account);
            }

            if (Account.BackpackIsFull)
            {
                s = GetOneBackpackSlotTroughMagicShop();
            }

            if (Account.Settings.BuyItemsInMagicShop && Account.LastMagicShopBuyTime.IsOtherDay(DateTime.Now) && Account.ALU_Seconds == 0)               //betrette den shop um ein Item zu kaufen
            {
                Account.LastMagicShopBuyTime = DateTime.Now;

                bool checkForAnotherItem = true;

                while (checkForAnotherItem)
                {
                    RaiseMessageEvent("Betrete Zauberladen");
                    ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                    s = SendRequest(ActionTypes.JoinMagicshop);

                    List <Item> shopItems = new List <Item>();
                    for (int i = 0; i < ResponseTypes.ShopSize; i++)
                    {
                        shopItems.Add(new Item(s.Split('/'), ResponseTypes.FidgetFirstItemPosition + (i * ResponseTypes.ItemSize), ResponseTypes.MagicShopInventoryIDOffset));
                    }

                    string inventoryIDForBuying = GetInventoryIDFormMagicShopWithBetterItem(shopItems, Account.Settings.UseMushroomsForBuying);
                    bool   hasBuyedOneItem      = false;
                    if (Convert.ToInt32(inventoryIDForBuying) > 0)
                    {
                        ThreadSleep(Account.Settings.minLongTime, Account.Settings.maxLongTime);
                        s = SendRequest(string.Concat("5044", "%3B", inventoryIDForBuying, "%3B2%3B", Account.FreeBackpackInventoryID));
                        hasBuyedOneItem = true;
                        RaiseMessageEvent(string.Format("Es wurde Item {0} gekauft und in den Rucksackslot {1} verstaut", inventoryIDForBuying, Account.FreeBackpackInventoryID));
                    }

                    //goto charscreen um items auszurüsten
                    if (hasBuyedOneItem)
                    {
                        RaiseMessageEvent("Charakterübersicht betreten");
                        ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                        s = SendRequest(ActionTypes.JoinCharacter);
                        CharScreenArea.UpdateAccountStats(s, Account);
                        s = ItemsBuckleOn();

                        if (Account.BackpackIsFull)
                        {
                            s = GetOneBackpackSlotTroughMagicShop();
                        }
                    }
                    else
                    {
                        //check for next item to buy
                        checkForAnotherItem = false;
                    }
                }
            }
        }
Beispiel #6
0
        public override void PerformArea()
        {
            base.PerformArea();

            //wenn stadtwache läuft tue nichts
            string s;

            if ((Account.ALU_Seconds == 0 || !Account.Settings.PerformQuesten) && !Account.QuestIsStarted && !Account.TownWatchIsStarted)
            {
                RaiseMessageEvent("Betrete Charakterübersicht");
                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                s = SendRequest(ActionTypes.JoinCharacter);
                CharScreenArea.UpdateAccountStats(s, Account);

                #region ItemsAusrüsten
                RaiseMessageEvent("Gucke ob Items ausgerüstet werden können");
                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                s = ItemsBuckleOn();
                #endregion

                if (Account.Settings.PerformBuyStats && (!Account.Settings.SaveMoney || Account.Settings.SaveMoney && Account.Silver > Helper.GetGoldMountFromGoldCurve(Account.HighestBuyedStat) * Account.Settings.SaveMoneyFactor))
                {
                    bool canBuyStats = true;

                    while (canBuyStats)
                    {
                        bool haveBuy = false;

                        int sumStats = 0;
                        if (Account.Settings.StatStrFactor > 0f)
                        {
                            sumStats += Account.BaseStr;
                        }
                        if (Account.Settings.StatDexFactor > 0f)
                        {
                            sumStats += Account.BaseDex;
                        }
                        if (Account.Settings.StatIntFactor > 0f)
                        {
                            sumStats += Account.BaseInt;
                        }
                        if (Account.Settings.StatAusFactor > 0f)
                        {
                            sumStats += Account.BaseAus;
                        }
                        if (Account.Settings.StatLuckFactor > 0f)
                        {
                            sumStats += Account.BaseLuck;
                        }

                        int strLimit  = Convert.ToInt32(sumStats * Account.Settings.StatStrFactor);
                        int dexLimit  = Convert.ToInt32(sumStats * Account.Settings.StatDexFactor);
                        int intLimit  = Convert.ToInt32(sumStats * Account.Settings.StatIntFactor);
                        int ausLimit  = Convert.ToInt32(sumStats * Account.Settings.StatAusFactor);
                        int LuckLimit = Convert.ToInt32(sumStats * Account.Settings.StatLuckFactor);

                        if (Account.BaseStr <= strLimit && Account.Silver > Helper.GetGoldMountFromGoldCurve(Account.BuyedStr))
                        {
                            ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                            s = SendRequest(ActionTypes.BuyStatStr);
                            if (s.Split('/').Count() < 2)
                            {
                                canBuyStats = false;
                                break;
                            }
                            RaiseMessageEvent("Kaufe Stärke");
                            CharScreenArea.UpdateAccountStats(s, Account);
                            RaiseMessageEvent("Stats: Str: " + Account.BaseStr.ToString() + " Ges: " + Account.BaseDex.ToString() + " Int: " + Account.BaseInt.ToString() + " Aus: " + Account.BaseAus.ToString() + " Glück: " + Account.BaseLuck.ToString());
                            Account.BuyedStr += 1;
                            Account.BaseStr  += 1;
                            Account.Silver   -= Helper.GetGoldMountFromGoldCurve(Account.BuyedStr - 1);
                            haveBuy           = true;
                        }

                        if (Account.BaseDex <= dexLimit && Account.Silver > Helper.GetGoldMountFromGoldCurve(Account.BuyedDex))
                        {
                            ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                            s = SendRequest(ActionTypes.BuyStatDex);
                            if (s.Split('/').Count() < 2)
                            {
                                canBuyStats = false;
                                break;
                            }
                            RaiseMessageEvent("Kaufe Geschicklichkeit");
                            CharScreenArea.UpdateAccountStats(s, Account);
                            RaiseMessageEvent("Stats: Str: " + Account.BaseStr.ToString() + " Ges: " + Account.BaseDex.ToString() + " Int: " + Account.BaseInt.ToString() + " Aus: " + Account.BaseAus.ToString() + " Glück: " + Account.BaseLuck.ToString());
                            Account.BuyedDex += 1;
                            Account.BaseDex  += 1;
                            Account.Silver   -= Helper.GetGoldMountFromGoldCurve(Account.BuyedDex - 1);
                            haveBuy           = true;
                        }

                        if (Account.BaseInt <= intLimit && Account.Silver > Helper.GetGoldMountFromGoldCurve(Account.BuyedInt))
                        {
                            ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                            s = SendRequest(ActionTypes.BuyStatInt);
                            if (s.Split('/').Count() < 2)
                            {
                                canBuyStats = false;
                                break;
                            }
                            RaiseMessageEvent("Kaufe Intelligenz");
                            CharScreenArea.UpdateAccountStats(s, Account);
                            RaiseMessageEvent("Stats: Str: " + Account.BaseStr.ToString() + " Ges: " + Account.BaseDex.ToString() + " Int: " + Account.BaseInt.ToString() + " Aus: " + Account.BaseAus.ToString() + " Glück: " + Account.BaseLuck.ToString());
                            Account.BuyedInt += 1;
                            Account.BaseInt  += 1;
                            Account.Silver   -= Helper.GetGoldMountFromGoldCurve(Account.BuyedInt - 1);
                            haveBuy           = true;
                        }

                        if (Account.BaseAus <= ausLimit && Account.Silver > Helper.GetGoldMountFromGoldCurve(Account.BuyedAus))
                        {
                            ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                            s = SendRequest(ActionTypes.BuyStatAus);
                            if (s.Split('/').Count() < 2)
                            {
                                canBuyStats = false;
                                break;
                            }
                            RaiseMessageEvent("Kaufe Ausdauer");
                            CharScreenArea.UpdateAccountStats(s, Account);
                            RaiseMessageEvent("Stats: Str: " + Account.BaseStr.ToString() + " Ges: " + Account.BaseDex.ToString() + " Int: " + Account.BaseInt.ToString() + " Aus: " + Account.BaseAus.ToString() + " Glück: " + Account.BaseLuck.ToString());
                            Account.BuyedAus += 1;
                            Account.BaseAus  += 1;
                            Account.Silver   -= Helper.GetGoldMountFromGoldCurve(Account.BuyedAus - 1);
                            haveBuy           = true;
                        }

                        if (Account.BaseLuck <= LuckLimit && Account.Silver > Helper.GetGoldMountFromGoldCurve(Account.BuyedLuck))
                        {
                            ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                            s = SendRequest(ActionTypes.BuyStatLuck);
                            if (s.Split('/').Count() < 2)
                            {
                                canBuyStats = false;
                                break;
                            }
                            RaiseMessageEvent("Kaufe Glück");
                            CharScreenArea.UpdateAccountStats(s, Account);
                            RaiseMessageEvent("Stats: Str: " + Account.BaseStr.ToString() + " Ges: " + Account.BaseDex.ToString() + " Int: " + Account.BaseInt.ToString() + " Aus: " + Account.BaseAus.ToString() + " Glück: " + Account.BaseLuck.ToString());
                            Account.BuyedLuck += 1;
                            Account.BaseLuck  += 1;
                            Account.Silver    -= Helper.GetGoldMountFromGoldCurve(Account.BuyedLuck - 1);
                            haveBuy            = true;
                        }

                        if (!haveBuy)
                        {
                            canBuyStats = false;
                        }
                    }
                }
            }
        }
Beispiel #7
0
        public override void PerformArea()
        {
            base.PerformArea();

            //Wenn die Arena nicht genutzt werden soll, tue nichts.
            if (!Account.Settings.PerformArena)
            {
                return;
            }
            if ((Account.QuestIsStarted || Account.TownWatchIsStarted) && !Account.MirrorIsCompleted || DateTime.Now < Account.ArenaEndTime)
            {
                return;
            }

            List <string> guildFilter     = Account.Settings.IgnoreGuilds.Split('/').ToList <string>();
            List <string> playerFilter    = Account.Settings.IgnorePlayers.Split('/').ToList <string>();
            int           levelDifference = Account.Settings.LevelDifference;
            int           rang            = Account.Rang;
            int           maxRangeLimit   = rang + Account.Settings.UpperRangeLimit;
            int           minRangeLimit   = rang - Account.Settings.LowerRangeLimit;
            int           myLevel         = Account.Level;
            int           maxTries        = Account.Settings.MaxTriesToFindEnemy;

            string s;

            string[] fightAnswer;
            int      enemyLevel     = 0;
            string   enemyNick      = "";
            string   enemyGuildNick = "";

            RaiseMessageEvent("Betrete Arena");

            int tries = 1;

            do
            {
                if (tries > maxTries)
                {
                    break;
                } //else do nothing

                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                if (Account.Settings.AttackSuggestedEnemy)
                {
                    s = SendRequest(ActionTypes.JoinArena);
                    string[] arenaAnswer = s.Substring(4, s.Length - 5).Split(';');

                    if (arenaAnswer.Count() - 1 >= ResponseTypes.ArenaEnemyLevel && arenaAnswer.Count() - 1 >= ResponseTypes.ArenaEnemyNick && arenaAnswer.Count() - 1 >= ResponseTypes.ArenaGuildNick)
                    {
                        enemyLevel     = Convert.ToInt32(arenaAnswer[ResponseTypes.ArenaEnemyLevel]);
                        enemyNick      = arenaAnswer[ResponseTypes.ArenaEnemyNick];
                        enemyGuildNick = arenaAnswer[ResponseTypes.ArenaGuildNick];
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    Random random = new Random(System.Environment.TickCount);

                    s = SendRequest(string.Concat(ActionTypes.JoinHallOfFame, random.Next(minRangeLimit, maxRangeLimit))).Remove(0, 4);

                    int i = 0;
                    Dictionary <int, HoFCharacter> HoFCharacters = new Dictionary <int, HoFCharacter>();
                    while (i < (s.Split('/').Count() / 5))
                    {
                        HoFCharacters.Add(i, new HoFCharacter(s.Split('/'), i * ResponseTypes.HoFOffset));
                        i++;
                    }

                    int myRandomEnemy = -1;

                    if (Account.Settings.AttackEnemyBetweenRange)
                    {
                        try {
                            List <int> filteredEnemys = new List <int>();
                            foreach (KeyValuePair <int, HoFCharacter> id in HoFCharacters.Where(x => x.Value.Level >= myLevel - levelDifference && x.Value.Level <= myLevel + levelDifference))
                            {
                                filteredEnemys.Add(id.Key);
                            }
                            myRandomEnemy = filteredEnemys[random.Next(0, filteredEnemys.Count)];
                        } catch {
                            myRandomEnemy = -1;
                        }
                    }
                    else
                    {
                        myRandomEnemy = random.Next(0, HoFCharacters.Count());
                    }

                    if (myRandomEnemy >= 0 && HoFCharacters.Count - 1 > myRandomEnemy && HoFCharacters[myRandomEnemy] != null)
                    {
                        enemyLevel     = HoFCharacters[myRandomEnemy].Level;
                        enemyNick      = HoFCharacters[myRandomEnemy].CharacterNick;
                        enemyGuildNick = HoFCharacters[myRandomEnemy].GuildNick;
                    }
                }
                tries++;
            } while (playerFilter.Contains(enemyNick) ||
                     string.IsNullOrEmpty(enemyNick.Trim()) ||
                     Account.Settings.Username == enemyNick ||
                     guildFilter.Contains(enemyGuildNick) ||
                     (!enemyLevel.IsBetween(myLevel - levelDifference, myLevel + levelDifference) && Account.Settings.AttackEnemyBetweenRange));

            if (tries <= maxTries && !playerFilter.Contains(enemyNick) && !guildFilter.Contains(enemyGuildNick) && Account.Settings.Username != enemyNick)
            {
                RaiseMessageEvent(string.Format("Greife Spieler: {0} an.", enemyNick));
                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                s = SendRequest(string.Concat(ActionTypes.AttackEnemy, enemyNick.Escape()));

                fightAnswer = s.Split(';');

                Asserts.IsTrue(fightAnswer.Count() >= 8, "Unerwarteter Fehler im Arena-Bereich");

                bool   win         = Convert.ToInt32(fightAnswer[1].Split('/')[fightAnswer[1].Split('/').Length - 7]) > 0 ? true : false;
                int    honorChange = Convert.ToInt32(fightAnswer[7]);
                double goldChange  = Convert.ToDouble(fightAnswer[8]) / 100;

                if (win)
                {
                    RaiseMessageEvent(string.Format("Du hast gegen {0} gewonnen. Ehre: +{1} Gold: +{2}", enemyNick, honorChange, goldChange));
                }
                else
                {
                    RaiseMessageEvent(string.Format("Du hast gegen {0} verloren. Ehre: {1} Gold: {2}", enemyNick, honorChange, goldChange));
                }
                //Account Daten aktualisieren
                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                s = SendRequest(ActionTypes.JoinCharacter);
                if (s.Split('/').Count() < ResponseTypes.NextFreeDuellTimestamp)
                {
                    Account.ArenaEndTime = DateTime.Now.AddMinutes(10);
                    return;
                }
                CharScreenArea.UpdateAccountStats(s, Account);
                Account.ArenaEndTime = s.Split('/')[ResponseTypes.NextFreeDuellTimestamp].MillisecondsToDateTime();
            }
            else
            {
                RaiseMessageEvent("Es wurde kein passender Gegner gefunden.");
                Account.ArenaEndTime = DateTime.Now.AddMinutes(10);
                return;
            }
        }
Beispiel #8
0
        public override void PerformArea()
        {
            base.PerformArea();

            //Wenn das WC nicht genutzt werden soll, tue nichts.
            if (!Account.Settings.PerformToilet || Account.Level < 100 || Account.BackpackIsFull || !Account.BackpackHasToiletItem)
            {
                return;
            }
            if ((Account.QuestIsStarted || Account.TownWatchIsStarted) && !Account.MirrorIsCompleted || DateTime.Now < Account.ToiletEndTime)
            {
                return;
            }

            string s;

            if ((Account.Level >= 100 && Account.ToiletIsAvailable))
            {
                ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                RaiseMessageEvent("Betrete WC");
                s = SendRequest(ActionTypes.JoinToilet);
                string[] answerToilet = s.Split('/');
                answerToilet = answerToilet[answerToilet.Length - 1].Split(';');

                //Prüfung, ob das WC zur Verfügung steht und Speicherung für diese Ausführungszeit
                if (s.Substring(0, 4).Contains(ActionTypes.ResponseToiletLocked))
                {
                    RaiseMessageEvent("WC steht nicht zur Verfügung!");
                    Account.ToiletIsAvailable = false;
                }
                else
                {
                    Account.ToiletIsAvailable = true;

                    if (answerToilet[(int)ToiletAnswer.Status] == "1")
                    {
                        RaiseMessageEvent("WC wurde heute schon benutzt!");
                        Account.ToiletEndTime = (DateTime.Now - DateTime.Now.TimeOfDay).AddDays(1);
                        return;
                    }

                    s = CheckAndFlushToilette(s);

                    CharScreenArea.UpdateAccountStats(s, Account);

                    //Rucksackslotnummer mit dem niedrigsten Gold Wert
                    int backpackslotWithLowestItemValue = Account.BackpackItems.Where(
                        b =>
                        b.SilverValue != 0 &&
                        b.Typ != ItemTypes.Buff &&
                        b.Typ != ItemTypes.Leer &&
                        b.Typ != ItemTypes.SpiegelOderSchlüssel &&
                        b.Typ != ItemTypes.KeineAhnung2 &&
                        b.IsEpic == false
                        ).OrderBy(b => b.SilverValue).First().InventoryID;
                    if (backpackslotWithLowestItemValue == 0)
                    {
                        return;
                    }
                    ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                    RaiseMessageEvent(string.Format("Item im Slot {0}, wird in die Toilette geschmissen.", backpackslotWithLowestItemValue));
                    s                     = SendRequest(ActionTypes.ItemAction + backpackslotWithLowestItemValue + "%3B10%3B0");
                    answerToilet          = s.Split('/');
                    Account.ToiletEndTime = (DateTime.Now - DateTime.Now.TimeOfDay).AddDays(1);

                    if (Account.Settings.SellToiletItemIfNotEpic && !answerToilet[0].Contains("E"))
                    {
                        ThreadSleep(Account.Settings.minShortTime, Account.Settings.maxShortTime);
                        RaiseMessageEvent(string.Format("Item im Slot {0}, wird verkauft. Kein Epic.", backpackslotWithLowestItemValue));
                        s = SendRequest(ActionTypes.ItemAction + backpackslotWithLowestItemValue + "%3B0%3B0");
                    }
                    CharScreenArea.UpdateAccountStats(s, Account);
                }
            }
            else
            {
                if (Account.ToiletEndTime.IsOtherDay(DateTime.Now) && !Account.ToiletIsAvailable && Account.Level >= 100)
                {
                    Account.ToiletIsAvailable = true;
                }
            }
        }