Пример #1
0
        public static void TakeMoneyOcean()
        {
            int money = Count;

/*
 *          if (User.Data.skill_builder >= 2 && User.Data.skill_builder < 4)
 *              money = money * 2;
 *          else if (User.Data.skill_builder >= 4 && User.Data.skill_builder < 6)
 *              money = money * 3;
 *          else if (User.Data.skill_builder >= 6 && User.Data.skill_builder < 8)        //надо сделать когда будут навыки добавлены
 *              money = money * 4;
 *          else if (User.Data.skill_builder >= 8 && User.Data.skill_builder < 10)
 *              money = money * 5;
 *          else if (User.Data.skill_builder >= 10)
 *              money = money * 6;
 *          else */
            money = money * 3;

            money = money * User.Bonus;

            User.AddCashMoney(money);
            Coffer.RemoveMoney(money);

            Count = 0;
            Notification.SendWithTime(Lang.GetTextToPlayer("_lang_118", $"{money:#,#}"));
        }
Пример #2
0
        public static async void Buy(int item, int price, int count = 1)
        {
            await User.GetAllData();

            if (User.GetMoneyWithoutSync() < price * count)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                return;
            }

            int plId = User.GetServerId();

            int amount = await Managers.Inventory.GetInvAmount(User.Data.id, InventoryTypes.Player);

            if (amount + Inventory.GetItemAmountById(item) > User.Amount)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_60"));
                return;
            }
            Managers.Inventory.AddItemServer(item, count, InventoryTypes.Player, User.Data.id, 10, -1, -1, -1);

            Notification.SendWithTime(Lang.GetTextToPlayer("_lang_84", Inventory.GetItemNameById(item), count));
            User.RemoveMoney(price * count);
            Coffer.AddMoney(price * count);

            if (item == 155)
            {
                User.Data.allow_marg = false;
                Sync.Data.Set(User.GetServerId(), "allow_marg", false);
                Notification.SendWithTime("~b~Рецепт на лечебную марихуану был изъят");
            }

            Managers.Inventory.UpdateAmount(User.Data.id, InventoryTypes.Player);
        }
Пример #3
0
        public static void TakeMoney()
        {
            int money = Count;

            if (User.Data.skill_scrap >= 4 && User.Data.skill_scrap < 6)
            {
                money = money * 2;
            }
            else if (User.Data.skill_scrap >= 6 && User.Data.skill_scrap < 8)
            {
                money = money * 3;
            }
            else if (User.Data.skill_scrap >= 8 && User.Data.skill_scrap < 20)
            {
                money = money * 4;
            }
            else if (User.Data.skill_scrap >= 20)
            {
                money = money * 5;
            }

            money = money * User.Bonus;

            User.AddCashMoney(money);
            Coffer.RemoveMoney(money);

            Count = 0;
            Notification.SendWithTime(Lang.GetTextToPlayer("_lang_118", $"{money:#,#}"));
        }
Пример #4
0
        public static void DeleteVeh(int money, int vehicle)
        {
            var veh   = new CitizenFX.Core.Vehicle(NetToVeh(vehicle));
            var vehId = Managers.Vehicle.GetVehicleIdByNumber(GetVehicleNumberPlateText(veh.Handle));

            if (Main.GetDistanceToSquared(GetEntityCoords(GetPlayerPed(-1), true), GrSixMenuPos) > 50)
            {
                Notification.SendWithTime("~y~Транспорт можно сдать только на базе");
                User.SetWaypoint(-42, -664);
                return;
            }
            if (User.CanOpenVehicle(vehId, veh.Handle))
            {
                Notification.SendWithTime("~g~Вы сдали автомобиль ");
                Coffer.RemoveMoney(4500);

                Notification.SendWithTime($"~q~Вы окончили маршрут день и заработали: ${money}");

                User.AddMoney(money + 4500);

                Main.FindNearestVehicle().Delete();
                Characher.UpdateCloth(false);
                TriggerServerEvent("ARP:GrSix:ResetMoneyInCar", veh.NetworkId);
                MoneyInCar = 0;
            }
            else
            {
                Notification.SendWithTime("Не вы арендовали, не вам сдавать.");
                return;
            }
        }
Пример #5
0
        public static async void SellStock(StockInfoGlobalData h)
        {
            if (Screen.LoadingPrompt.IsActive)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_34"));
                return;
            }

            Client.Sync.Data.ShowSyncMessage = false;
            Screen.LoadingPrompt.Show("Обработка запроса, подождите");

            await User.GetAllData();

            var hData = await GetAllData(h.id);

            var playerId = User.GetServerId();

            if (hData.id == 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_35"));
                return;
            }

            if (User.Data.stock_id == 0)
            {
                Notification.SendWithTime("~r~У Вас нет недвижимости");
                return;
            }

            Client.Sync.Data.Set(playerId, "stock_id", 0);

            await Delay(200);

            if (await Client.Sync.Data.Get(playerId, "stock_id") != 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_32"));
                return;
            }

            var nalog = hData.price * (100 - Coffer.GetNalog()) / 100;

            User.AddMoney(nalog);
            Coffer.RemoveMoney(nalog);

            Main.SaveLog("BuySellStock", $"[SELL] {User.Data.id} {User.Data.rp_name} | {nalog} | {User.Data.stock_id}");

            User.Data.stock_id = 0;
            Notification.SendWithTime($"~g~{Coffer.GetNalog()}%\n~s~Получено: ~g~${nalog:#,#}");

            TriggerServerEvent("ARP:UpdateStockInfo", "", 0, hData.id);

            User.SaveAccount();
            MenuList.HideMenu();
            await User.GetAllData();

            Screen.LoadingPrompt.Hide();
            Client.Sync.Data.ShowSyncMessage = true;
        }
Пример #6
0
        public static async void Buy(int bId)
        {
            CurrentData = await GetAllData(bId);

            if (User.Data.age < 21 && Main.ServerName != "SunFlower")
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_26"));
                return;
            }

            if (!User.Data.biz_lic && Main.ServerName != "SunFlower")
            {
                Notification.SendWithTime("~r~У Вас нет лицензии на бизнес");
                return;
            }

            if (User.Data.money_bank < CurrentData.price)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_2"));
                return;
            }

            if (CurrentData.user_id != 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_30"));
                return;
            }

            if (User.Data.business_id != 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_31"));
                return;
            }

            Sync.Data.Set(User.GetServerId(), "business_id", CurrentData.id);

            await Delay(200);

            if (await Sync.Data.Get(User.GetServerId(), "business_id") == 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_32"));
                return;
            }


            User.RemoveBankMoney(CurrentData.price);
            Coffer.AddMoney(CurrentData.price + CurrentData.bank);
            Sync.Data.Set(-20000 + bId, "bank", 0);
            User.Data.business_id = CurrentData.id;
            Notification.SendWithTime(Lang.GetTextToPlayer("_lang_33"));

            Main.SaveLog("BuySellBizz", $"[BUY] {User.Data.id} {User.Data.rp_name} | {CurrentData.price} | {User.Data.business_id}");

            Sync.Data.Set(-20000 + bId, "user_id", User.Data.id);
            Sync.Data.Set(-20000 + bId, "user_name", User.Data.rp_name);
            User.SaveAccount();
            Save(CurrentData.id);
        }
Пример #7
0
        public static void TakeMoney()
        {
            int money = Count * 3 * User.Bonus;

            User.AddCashMoney(money);
            Coffer.RemoveMoney(money);

            Count = 0;
            Notification.SendWithTime(Lang.GetTextToPlayer("_lang_118", $"{money:#,#}"));
        }
Пример #8
0
        public static void NewCard(int bankId, int price)
        {
            if (User.Data.money < price)
            {
                Managers.Notification.SendWithTime(Lang.GetTextToPlayer("_lang_5"));
                return;
            }

            if (User.Data.bank_prefix > 0)
            {
                Managers.Notification.SendWithTime(Lang.GetTextToPlayer("_lang_8"));
                return;
            }

            Random rand   = new Random();
            int    prefix = 1111;

            switch (bankId)
            {
            case 1:
                prefix = 2222;
                break;

            case 2:
                prefix = 3333;
                break;

            case 108:
                prefix = 4444;
                break;
            }

            int plId = User.GetServerId();

            User.Data.bank_number = rand.Next(10000, 9999999);
            User.Data.bank_prefix = prefix;

            Sync.Data.Set(plId, "bank_prefix", prefix);
            Sync.Data.Set(plId, "bank_number", User.Data.bank_number);

            SendSmsBankOperationCreateCard();

            User.RemoveCashMoney(price);

            if (bankId == 0)
            {
                Coffer.AddMoney(price);
            }
            else
            {
                Business.AddMoney(bankId, price);
            }
        }
Пример #9
0
        public static async void Sell(int bId)
        {
            if (Screen.LoadingPrompt.IsActive)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_34"));
                return;
            }

            Client.Sync.Data.ShowSyncMessage = false;
            Screen.LoadingPrompt.Show(Lang.GetTextToPlayer("_lang_36"));

            CurrentData = await GetAllData(bId);

            if (CurrentData.id == 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_35"));
                return;
            }

            if (User.Data.business_id == 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_37"));
                return;
            }

            Sync.Data.Set(User.GetServerId(), "business_id", 0);

            await Delay(200);

            if (await Sync.Data.Get(User.GetServerId(), "business_id") != 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_32"));
                return;
            }

            var nalog = CurrentData.price * (100 - Coffer.GetNalog()) / 100;

            Main.SaveLog("BuySellBizz", $"[SELL] {User.Data.id} {User.Data.rp_name} | {nalog} | {User.Data.business_id}");

            User.AddBankMoney(nalog);
            Coffer.RemoveMoney(nalog);

            User.Data.business_id = 0;
            Notification.SendWithTime(Lang.GetTextToPlayer("_lang_38", nalog));

            Sync.Data.Set(-20000 + bId, "user_id", 0);
            Sync.Data.Set(-20000 + bId, "user_name", "");
            User.SaveAccount();
            Save(CurrentData.id);

            Screen.LoadingPrompt.Hide();
            Client.Sync.Data.ShowSyncMessage = true;
        }
Пример #10
0
 public static void Equip()
 {
     if (User.Data.money < 2250)
     {
         Notification.SendWithTime("~r~ Недостаточно денег");
         return;
     }
     User.GiveWeapon((uint)WeaponHash.SMG, 140, false, false);
     User.GiveWeapon((uint)WeaponHash.PistolMk2, 60, false, false);
     Notification.SendWithTime("~g~Вы взяли оружие");
     Sync.Data.SetLocally(User.GetServerId(), "GrSix:Equip", true);
     User.RemoveMoney(2500);
     Coffer.AddMoney(2500);
 }
Пример #11
0
        public static void BuyInterior(int bId, int id)
        {
            if (User.Data.money_bank < 50000)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_2"));
                return;
            }

            Sync.Data.Set(-20000 + bId, "interior", id);
            Notification.SendWithTime(Lang.GetTextToPlayer("_lang_29"));
            User.RemoveBankMoney(50000);
            Coffer.AddMoney(50000);
            Save(bId);
        }
Пример #12
0
        public static void UniformSet()
        {
            if (User.Data.money < 1000)
            {
                Notification.SendWithTime("~r~У вас недостаточно денег");
                return;
            }
            int Armor  = 50;
            int r      = 150;
            var coords = GetEntityCoords(GetPlayerPed(-1), true);

            Shared.TriggerEventToAllPlayers("ARP:GiveArmorMp", coords.X, coords.Y, coords.Z, r, Armor);
            Notification.SendWithTime("~b~Готово");
            if (User.Skin.SEX == 1)
            {
                SetPedComponentVariation(GetPlayerPed(-1), 3, 117, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 4, 32, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 5, 44, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 6, 25, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 8, 154, 1, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 11, 46, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 7, 0, 0, 2);
            }
            else
            {
                SetPedComponentVariation(GetPlayerPed(-1), 3, 107, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 4, 31, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 5, 44, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 6, 25, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 8, 124, 1, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 11, 53, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 7, 0, 0, 2);
            }
            Sync.Data.SetLocally(User.GetServerId(), "GrSix:Uniform", true);
            User.RemoveMoney(1000);
            Coffer.AddMoney(1000);
        }
Пример #13
0
        public static async void BuyHouse(CondoInfoGlobalData h)
        {
            await User.GetAllData();

            var hData = await GetAllData(h.id);

            var playerId = User.GetServerId();

            if (hData.id == 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_35"));
                return;
            }

            if (hData.id_user != 0)
            {
                Notification.SendWithTime("~r~Недвижимость уже куплена");
                return;
            }

            if (User.Data.condo_id != 0)
            {
                Notification.SendWithTime("~r~У Вас уже есть недвижимость");
                return;
            }

            if (User.GetMoneyWithoutSync() < hData.price)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_2"));
                return;
            }

            Client.Sync.Data.Set(playerId, "condo_id", hData.id);

            await Delay(200);

            if (await Client.Sync.Data.Get(playerId, "condo_id") == 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_32"));
                return;
            }

            User.RemoveMoney(hData.price);
            Coffer.AddMoney(hData.price);

            User.Data.condo_id = hData.id;

            Main.SaveLog("BuySellCondo", $"[BUY] {User.Data.id} {User.Data.rp_name} | {hData.price} | {User.Data.condo_id}");


            Notification.SendWithTime("~g~Поздравляем с покупкой недвижимости");

            if (User.Data.reg_status != 3)
            {
                Client.Sync.Data.Set(playerId, "reg_time", 372);
                Client.Sync.Data.Set(playerId, "reg_status", 2);
            }

            TriggerServerEvent("ARP:UpdateCondoInfo", User.Data.rp_name, User.Data.id, hData.id);

            User.SaveAccount();
            MenuList.HideMenu();

            await Delay(10000);

            await User.GetAllData();
        }
Пример #14
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                Item stolen = null;

                object root = toSteal.RootParent;

                StealableArtifactsSpawner.StealableInstance si = null;
                if (toSteal.Parent == null || !toSteal.Movable)
                {
                    si = StealableArtifactsSpawner.GetStealableInstance(toSteal);
                }

                if (toSteal is DungeonChest)
                {
                    DungeonChest dBox = (DungeonChest)toSteal;

                    if (m_Thief.Blessed)
                    {
                        m_Thief.SendMessage("You cannot steal while in this state.");
                    }
                    else if (dBox.ItemID == 0x3582 || dBox.ItemID == 0x3583 || dBox.ItemID == 0x35AD || dBox.ItemID == 0x3868 || (dBox.ItemID >= 0x4B5A && dBox.ItemID <= 0x4BAB) || (dBox.ItemID >= 0xECA && dBox.ItemID <= 0xED2))
                    {
                        m_Thief.SendMessage("It is best to leave the dead be.");
                    }
                    else if (dBox.ItemID == 0x3564 || dBox.ItemID == 0x3565)
                    {
                        m_Thief.SendMessage("You have not use for this broken golem thing.");
                    }
                    else
                    {
                        if (m_Thief.CheckSkill(SkillName.Stealing, 0, 125))
                        {
                            m_Thief.SendMessage("You dump out the entire contents while stealing the item.");
                            StolenChest sBox   = new StolenChest();
                            int         dValue = 0;

                            dValue               = (dBox.ContainerLevel + 1) * 50;
                            sBox.ContainerID     = dBox.ContainerID;
                            sBox.ContainerGump   = dBox.ContainerGump;
                            sBox.ContainerHue    = dBox.ContainerHue;
                            sBox.ContainerFlip   = dBox.ContainerFlip;
                            sBox.ContainerWeight = dBox.ContainerWeight;
                            sBox.ContainerName   = dBox.ContainerName;

                            sBox.ContainerValue = dValue;

                            Item iBox = (Item)sBox;

                            iBox.ItemID = sBox.ContainerID;
                            iBox.Hue    = sBox.ContainerHue;
                            iBox.Weight = sBox.ContainerWeight;
                            iBox.Name   = sBox.ContainerName;

                            Bag oBox = (Bag)iBox;

                            oBox.GumpID = sBox.ContainerGump;

                            m_Thief.AddToBackpack(oBox);

                            Titles.AwardFame(m_Thief, dValue, true);

                            LoggingFunctions.LogStandard(m_Thief, "has stolen a " + iBox.Name + "");
                        }
                        else
                        {
                            m_Thief.SendMessage("You were not quick enough to steal it.");
                            m_Thief.RevealingAction();                             // REVEALING ONLY WHEN FAILED
                        }

                        Item spawnBox = new DungeonChestSpawner(dBox.ContainerLevel, (double)(Utility.RandomMinMax(45, 105)));
                        spawnBox.MoveToWorld(new Point3D(dBox.X, dBox.Y, dBox.Z), dBox.Map);

                        toSteal.Delete();
                    }
                }
                else if (toSteal is LandChest && LandChest.isBody(toSteal.ItemID))
                {
                    m_Thief.SendMessage("It is best to leave the dead be.");
                }
                else if (toSteal is LandChest && !LandChest.isBody(toSteal.ItemID))
                {
                    m_Thief.SendMessage("You would be quite foolish looking stealing a wagon.");
                }
                else if (toSteal is SunkenShip)
                {
                    m_Thief.SendMessage("You are just not that strong.");
                }
                else if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendMessage("You cannot be wielding a weapon when trying to steal something.");
                }
                else if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005596);                       // You must be in the thieves guild to steal from other players.
                }
                else if (toSteal is Coffer)
                {
                    Coffer coffer = (Coffer)toSteal;
                    bool   Pilfer = true;

                    if (m_Thief.Backpack.FindItemByType(typeof(ThiefNote)) != null)
                    {
                        Item      mail     = m_Thief.Backpack.FindItemByType(typeof(ThiefNote));
                        ThiefNote envelope = (ThiefNote)mail;

                        if (envelope.NoteOwner == m_Thief)
                        {
                            if (envelope.NoteItemArea == Server.Misc.Worlds.GetRegionName(m_Thief.Map, m_Thief.Location) && envelope.NoteItemGot == 0 && envelope.NoteItemCategory == coffer.CofferType)
                            {
                                envelope.NoteItemGot = 1;
                                m_Thief.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found " + envelope.NoteItem + ".");
                                m_Thief.SendSound(0x3D);
                                envelope.InvalidateProperties();
                                Pilfer = false;
                            }
                        }
                    }

                    if (Pilfer)
                    {
                        if (coffer.CofferGold < 1)
                        {
                            m_Thief.SendMessage("There seems to be no gold in the coffer.");
                        }
                        else if (m_Thief.CheckSkill(SkillName.Stealing, 0, 100))
                        {
                            m_Thief.SendMessage("You slip out " + coffer.CofferGold + " gold from the coffer.");
                            m_Thief.SendSound(0x2E6);
                            m_Thief.AddToBackpack(new Gold(coffer.CofferGold));

                            Titles.AwardFame(m_Thief, (coffer.CofferGold * 2), true);
                            Titles.AwardKarma(m_Thief, -(coffer.CofferGold * 2), true);

                            coffer.CofferRobbed = 1;
                            coffer.CofferRobber = m_Thief.Name + " the " + Server.Misc.GetPlayerInfo.GetSkillTitle(m_Thief);
                            coffer.CofferGold   = 0;

                            LoggingFunctions.LogStandard(m_Thief, "has stolen " + coffer.CofferGold + " gold from a " + coffer.CofferType + " in " + Server.Misc.Worlds.GetRegionName(m_Thief.Map, m_Thief.Location) + "");
                        }
                        else
                        {
                            m_Thief.SendMessage("You fingers slip, causing you to get noticed!");
                            m_Thief.RevealingAction();                             // REVEALING ONLY WHEN FAILED

                            if (!m_Thief.CheckSkill(SkillName.Snooping, 0, 150))
                            {
                                List <Mobile> spotters = new List <Mobile>();
                                foreach (Mobile m in m_Thief.GetMobilesInRange(10))
                                {
                                    if (m is BaseVendor && m.CanSee(m_Thief) && m.InLOS(m_Thief))
                                    {
                                        m_Thief.CriminalAction(false);
                                        m.PublicOverheadMessage(MessageType.Regular, 0, false, string.Format("Stop! Thief!"));
                                    }
                                }
                            }
                        }
                    }
                }
                else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
                {
                    m_Thief.SendLocalizedMessage(1005598);                       // You can't steal from shopkeepers.
                }
                else if (root is PlayerVendor || root is PlayerBarkeeper)
                {
                    m_Thief.SendLocalizedMessage(502709);                       // You can't steal from vendors.
                }
                else if (!m_Thief.CanSee(toSteal))
                {
                    m_Thief.SendLocalizedMessage(500237);                       // Target can not be seen.
                }
                else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                {
                    m_Thief.SendLocalizedMessage(1048147);                       // Your backpack can't hold anything else.
                }
                else if (si == null && (toSteal.Parent == null || !toSteal.Movable))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (Core.AOS && si == null && toSteal is Container)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                {
                    m_Thief.SendLocalizedMessage(502703);                       // You must be standing next to an item to steal it.
                }
                else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0)
                {
                    m_Thief.SendLocalizedMessage(1060025, "", 0x66D);                       // You're not skilled enough to attempt the theft of this item.
                }
                else if (toSteal.Parent is Mobile)
                {
                    m_Thief.SendLocalizedMessage(1005585);                       // You cannot steal items which are equipped.
                }
                else if (root == m_Thief)
                {
                    m_Thief.SendLocalizedMessage(502704);                       // You catch yourself red-handed.
                }
                else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root))
                {
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (w > 10)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);

                            if (maxAmount < 1)
                            {
                                maxAmount = 1;
                            }
                            else if (maxAmount > toSteal.Amount)
                            {
                                maxAmount = toSteal.Amount;
                            }

                            int amount = Utility.RandomMinMax(1, maxAmount);

                            if (amount >= toSteal.Amount)
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = toSteal;
                                }
                            }
                            else
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount);

                                    if (stolen == null)
                                    {
                                        stolen = toSteal;
                                    }
                                }
                            }
                        }
                        else
                        {
                            int iw = (int)Math.Ceiling(w);
                            iw *= 10;

                            if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5))
                            {
                                stolen = toSteal;
                            }
                        }

                        if (stolen != null)
                        {
                            m_Thief.SendLocalizedMessage(502724);                               // You successfully steal the item.

                            Titles.AwardKarma(m_Thief, -1000, true);

                            if (si != null)
                            {
                                toSteal.Movable = true;
                                si.Item         = null;
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                  // You fail to steal the item.
                            m_Thief.RevealingAction();                             // REVEALING ONLY WHEN FAILED
                        }

                        caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150));
                    }
                }

                return(stolen);
            }
Пример #15
0
        public static async void BuyLic(int type)
        {
            if (User.Data.reg_status == 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_67"));
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_68"));
                return;
            }

            switch (type)
            {
            case 0:
                if (!User.Data.a_lic)
                {
                    if (User.GetMoneyWithoutSync() < 75)
                    {
                        Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                        return;
                    }

                    User.Data.a_lic = true;
                    Sync.Data.Set(User.GetServerId(), "a_lic", true);

                    User.RemoveMoney(75);
                    Coffer.AddMoney(75);

                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_69"));
                    break;
                }
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_70"));
                break;

            case 1:
                if (!User.Data.b_lic)
                {
                    if (User.GetMoneyWithoutSync() < 200)
                    {
                        Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                        return;
                    }

                    User.Data.b_lic = true;
                    Sync.Data.Set(User.GetServerId(), "b_lic", true);

                    User.RemoveMoney(200);
                    Coffer.AddMoney(200);

                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_69"));
                    break;
                }
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_70"));
                break;

            case 2:
                if (!User.Data.c_lic)
                {
                    if (User.GetMoneyWithoutSync() < 600)
                    {
                        Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                        return;
                    }

                    User.Data.c_lic = true;
                    Sync.Data.Set(User.GetServerId(), "c_lic", true);

                    User.RemoveMoney(600);
                    Coffer.AddMoney(600);

                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_69"));
                    break;
                }
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_70"));
                break;

            case 3:
                if (!User.Data.air_lic)
                {
                    if (User.GetMoneyWithoutSync() < 1200)
                    {
                        Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                        return;
                    }

                    User.Data.air_lic = true;
                    Sync.Data.Set(User.GetServerId(), "air_lic", true);

                    User.RemoveMoney(1200);
                    Coffer.AddMoney(1200);

                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_69"));
                    break;
                }
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_70"));
                break;

            case 4:
                if (!User.Data.ship_lic)
                {
                    if (User.GetMoneyWithoutSync() < 920)
                    {
                        Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                        return;
                    }

                    User.Data.ship_lic = true;
                    Sync.Data.Set(User.GetServerId(), "ship_lic", true);

                    User.RemoveMoney(920);
                    Coffer.AddMoney(920);

                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_69"));
                    break;
                }
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_70"));
                break;

            case 5:
                if (!User.Data.heli_lic)
                {
                    if (User.GetMoneyWithoutSync() < 1400)
                    {
                        Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                        return;
                    }

                    User.Data.heli_lic = true;
                    Sync.Data.Set(User.GetServerId(), "heli_lic", true);

                    User.RemoveMoney(1400);
                    Coffer.AddMoney(1400);

                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_69"));
                    break;
                }
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_70"));
                break;
            }
        }
Пример #16
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is Mobile)
                {
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 40.0, 100.0))
                    {
                        if (target is PlayerMobile && ((PlayerMobile)target).NpcGuild == NpcGuild.ThievesGuild)
                        {
                            from.SendLocalizedMessage(501004);                              //That individual is a thief!
                        }
                        else
                        {
                            from.SendLocalizedMessage(501003);                              //You notice nothing unusual.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);                          //You cannot determain anything useful.
                    }
                }
                else if (target is Coffer)
                {
                    Coffer coffer = (Coffer)target;

                    if (coffer.CofferRobbed > 0)
                    {
                        from.SendMessage("It seems that " + coffer.CofferRobber + " has robbed this coffer of it's gold!");
                    }
                    else
                    {
                        from.SendMessage("That coffer has not been emptied by thieves.");
                    }
                }
                else if (target is LandChest && LandChest.isBody(((Item)target).ItemID))
                {
                    from.SendMessage("This adventurer looks to have been slain by some wild animal.");
                }
                else if (target is LandChest && !LandChest.isBody(((Item)target).ItemID))
                {
                    from.SendMessage("For some reason, this wagon was left behind.");
                }
                else if (target is WaterChest)
                {
                    from.SendMessage("Maybe the owner of this boat fell into the sea and drowned.");
                }
                else if (target is SunkenShip)
                {
                    from.SendMessage("This ship looks as though it seen better days.");
                }
                else if (target is Corpse)
                {
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 0.0, 100.0))
                    {
                        Corpse c = (Corpse)target;

                        if (c.m_Forensicist != null)
                        {
                            from.SendLocalizedMessage(1042750, c.m_Forensicist);                                // The forensicist  ~1_NAME~ has already discovered that:
                        }
                        else
                        {
                            c.m_Forensicist = from.Name;
                        }

                        if (((Body)c.Amount).IsHuman)
                        {
                            from.SendLocalizedMessage(1042751, (c.Killer == null ? "no one" : c.Killer.Name));                                //This person was killed by ~1_KILLER_NAME~
                        }
                        if (c.Looters.Count > 0)
                        {
                            StringBuilder sb = new StringBuilder();
                            for (int i = 0; i < c.Looters.Count; i++)
                            {
                                if (i > 0)
                                {
                                    sb.Append(", ");
                                }
                                sb.Append(((Mobile)c.Looters[i]).Name);
                            }

                            from.SendLocalizedMessage(1042752, sb.ToString());                              //This body has been distrubed by ~1_PLAYER_NAMES~
                        }
                        else
                        {
                            from.SendLocalizedMessage(501002);                              //The corpse has not be desecrated.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);                          //You cannot determine anything useful.
                    }
                }
                else if (target is ILockpickable)
                {
                    ILockpickable p = (ILockpickable)target;
                    if (p.Picker != null)
                    {
                        from.SendLocalizedMessage(1042749, p.Picker.Name);                          //This lock was opened by ~1_PICKER_NAME~
                    }
                    else
                    {
                        from.SendLocalizedMessage(501003);                          //You notice nothing unusual.
                    }
                }
            }