예제 #1
0
        public void RejectAdvertisement(Client sender, int id)
        {
            if (!FactionManager.IsPlayerInFaction(sender, 5) || API.shared.getEntityData(sender, "AdminLevel") >= 1)
            {
                var _adv = db_Adversitements.GetById(id);
                if (_adv != null)
                {
                    var player = db_Accounts.IsPlayerOnline(_adv.OwnerSocialClubId);
                    if (player != null)
                    {
                        string number = PhoneManager.GetPhoneNumbers(player).FirstOrDefault();
                        API.shared.sendChatMessageToPlayer(player, "~g~[WZReklam] ~s~Reklamınız onaylanmadı. Paranız banka hesabına geri yatırıldı.");
                        InventoryManager.AddMoneyToPlayerBank(player, 50);
                    }
                    else
                    {
                        InventoryManager.AddMoneyToOfflinePlayerBank(_adv.OwnerSocialClubId, 50);
                    }
                    API.shared.sendChatMessageToPlayer(sender, "~g~[WZReklam] ~s~Reklamı ~r~reddettiniz.");
                    db_Adversitements.Remove(_adv.AddvertisementID);
                }
            }

            else
            {
                API.shared.sendChatMessageToPlayer(sender, "~r~HATA: ~s~Bunun için yetkiniz yok.");
            }
        }
예제 #2
0
 public void ApproveAdvertisement(Client sender, int id)
 {
     if (FactionManager.IsPlayerInFaction(sender, 5) || API.shared.getEntityData(sender, "AdminLevel") >= 1)
     {
         var _adv = db_Adversitements.GetById(id);
         if (_adv != null)
         {
             var player = db_Accounts.IsPlayerOnline(_adv.OwnerSocialClubId);
             if (player != null)
             {
                 string number = PhoneManager.GetPhoneNumbers(player).FirstOrDefault();
                 API.shared.sendChatMessageToAll($"~g~[WZReklam] [{number}] {player.nametag}: {_adv.Text}");
             }
             else
             {
                 var    _player        = db_Accounts.GetOfflineUserDatas(_adv.OwnerSocialClubId);
                 var    _phone         = InventoryManager.GetItemFromOfflineUser(_adv.OwnerSocialClubId, Models.ItemType.Phone).FirstOrDefault().Item2;
                 var    specifiedValue = (SpecifiedValuePhone)API.fromJson(_phone.SpecifiedValue).ToObject <SpecifiedValuePhone>();
                 string number         = specifiedValue.PhoneNumber;
                 API.shared.sendChatMessageToAll($"~g~[WZReklam] [{number}]{_player.CharacterName}: {_adv.Text}");
             }
             db_Adversitements.Remove(_adv.AddvertisementID);
         }
     }
     else
     {
         API.shared.sendChatMessageToPlayer(sender, "~r~HATA: ~s~Bunun için yetkiniz yok.");
     }
 }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     phone      = PhoneManager.Instance;
     isFrozen   = false;
     thisCamera = GetComponent <Camera>();
     oldMask    = thisCamera.cullingMask;
 }
예제 #4
0
 // Use this for initialization
 void Start()
 {
     phone      = PhoneManager.Instance;
     lowSignal  = signals[0].GetComponent <Image>();
     medSignal  = signals[1].GetComponent <Image>();
     highSignal = signals[2].GetComponent <Image>();
 }
예제 #5
0
 // Use this for initialization
 void Start()
 {
     phone         = PhoneManager.Instance;
     manager       = EnemyManager.Instance;
     markedVisible = false;
     health        = 100;
 }
예제 #6
0
        public void AddPhoneNumber(
            int accountId,
            string phoneNumber,
            Phone.PhoneServiceTypes phoneServiceType,
            Phone.PhoneLocationTypes phoneLocationType,
            int slot,
            string phoneStatusId)
        {
            if (string.IsNullOrEmpty(phoneNumber))
            {
                throw new Exception("Phone number is empty");
            }

            var phone = new Phone
            {
                AccountId     = accountId,
                PhoneNumber   = phoneNumber,
                ServiceType   = phoneServiceType,
                LocationType  = phoneLocationType,
                PhoneSlot     = slot,
                PhoneStatusId = phoneStatusId
            };

            PhoneManager.SavePhone(phone, UserId, PositionId);
            var account = AccountManager.GetAccount(accountId);

            account.Phones.Add(phone);
        }
예제 #7
0
        public void ForceHangup()
        {
            Settings setting  = SimpleIoc.Default.GetInstance <Settings>();
            var      callType = setting.CallType;

            switch (callType)
            {
            case SettingsTable.CallTypeEnum.SkypeUser:
            {
                //TODO:
                break;
            }

            case SettingsTable.CallTypeEnum.SkypeOut:
            {
                //TODO:
                break;
            }

            case SettingsTable.CallTypeEnum.Phone:
            default:
            {
                using (PhoneManager phoneManager = new PhoneManager(this))
                {
                    phoneManager.EndCall();
                }
                break;
            }
            }
        }
예제 #8
0
 protected override void Initialize()
 {
     manager = new PhoneManager(mockUnitOfWork.Object, mockMapper.Object);
     item    = new Phone()
     {
         Id = 1, PhoneNumber = "+380661660777"
     };
     TestContext.WriteLine("Overrided");
 }
예제 #9
0
        public void Verify_The_Number_Of_Records_In_Account_Phones(int numberOfRecords)
        {
            _phones = PhoneManager.GetPhones(_testScope.accountId);

            _testScope.softAssert.Add(() =>
            {
                Assert.AreEqual(_phones.Count, numberOfRecords);
            });
        }
        public void PhoneManagerApp_ProcessAllPotentialCandidatePhoneNumbers_WithCookie_WithFoundPhoneNumberNoPersist_ReturnsCookie()
        {
            // Arrange
            // generate test data
            var dataModel = new PhoneManagerModel()
            {
                DefaultCampaignQueryStringKey = "fsource", DefaultPersistDurationInDays = 32
            };

            dataModel.PhoneManagerCampaignDetail = new List <PhoneManagerCampaignDetail>()
            {
                new PhoneManagerCampaignDetail()
                {
                    Id = "1201", TelephoneNumber = "0800 123 4567", CampaignCode = "testcode"
                }
            };
            var testPhoneManagerData = dataModel.ToXmlString();

            var _dataProvider = MockProviders.Repository(testPhoneManagerData);

            var foundRecord = new PhoneManagerCampaignDetail()
            {
                Id = "1201", TelephoneNumber = "FOUND PHONENUMBER"
            };

            var _cookie = new CookieHolder()
            {
                Model =
                    new OutputModel()
                {
                    Id = "1202",
                    TelephoneNumber = "9999 999 9999"
                }
            };

            // generate the required result
            var correctResult = new FinalResultModel()
            {
                OutputCookieHolder = new CookieHolder(),
                OutputModelResult  = new OutputModel()
                {
                    Id = "1202",
                    TelephoneNumber = "9999 999 9999"
                },
                OutputResultSource = OutputSource.ExisitingCookie
            };

            PhoneManager target = new PhoneManager(null, _dataProvider, null, null, null, null);

            //Act
            FinalResultModel retVal = target.ProcessAllPotentialCandidatePhoneNumbers(_cookie, foundRecord);

            //Assert
            Assert.AreEqual(retVal.OutputResultSource, correctResult.OutputResultSource);
            Assert.AreEqual(retVal.OutputModelResult.Id, correctResult.OutputModelResult.Id);
        }
        private void doPhoneManagerProcessing(object sender, EventArgs e)
        {
            var umbracoContext = UmbracoContext.Current;

            if (umbracoContext?.PageId == null)
            {
                return;
            }

            var phoneManagerResult = new PhoneManager().ProcessRequest();
        }
예제 #12
0
    // Use this for initialization
    void Start()
    {
        lm = FindObjectOfType <LevelManager>();
        bm = FindObjectOfType <BossManager>();
        lc = FindObjectOfType <LifeCounter>();
        pc = FindObjectOfType <PlayerController>();
        sm = FindObjectOfType <ScoreManager>();
        pm = FindObjectOfType <PhoneManager>();

        SpawnFormation();
    }
예제 #13
0
        public void Changing_All_Phones_To_Status(string phoneStatus)
        {
            var newStatus = _accountTest.GetPhoneStatusMapping(phoneStatus);
            var phones    = PhoneManager.GetPhones(_testScope.accountId);

            foreach (var phone in phones)
            {
                var newPhone = _accountTest.DuplicateThisPhone(phone);
                newPhone.PhoneStatusId = newStatus;
                _accountTest.UpdatePhone(newPhone, phone);
            }
        }
예제 #14
0
        private void API_onClientEventTrigger(Client sender, string eventName, params object[] arguments)
        {
            try
            {
                switch (eventName)
                {
                case "bank_withdraw":
                    BankWithdraw(sender, Convert.ToInt32(arguments[0]));
                    break;

                case "bank_deposit":
                    BankDeposit(sender, Convert.ToInt32(arguments[0]));
                    break;

                case "bank_createaccount":
                    CreateBankAccount(sender);
                    break;

                case "bank_transfer":
                    TransferMoney(sender, arguments[0].ToString(), arguments[1].ToString());
                    break;

                case "return_bank":
                    PhoneManager pMgr = new PhoneManager();
                    if (arguments[0].ToString() == "KONTOR YÜKLE")
                    {
                        try { Convert.ToInt32(arguments[2]); Convert.ToInt32(arguments[1]); } catch (Exception) { API.sendChatMessageToPlayer(sender, "~r~HATA: ~s~Parametreler sayı olmalıydı."); return; }
                        pMgr.BuyPhoneCredits(sender, Convert.ToInt32(arguments[2]), Convert.ToInt32(arguments[1]));
                    }
                    else
                    if (arguments[0].ToString() == "INTERNET YÜKLE")
                    {
                        try { Convert.ToInt32(arguments[2]); Convert.ToInt32(arguments[1]); } catch (Exception) { API.sendChatMessageToPlayer(sender, "~r~HATA: ~s~Parametreler sayı olmalıydı."); return; }
                        pMgr.BuyInternetCreditsForPhone(sender, Convert.ToInt32(arguments[2]), Convert.ToInt32(arguments[1]));
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                if (ex.GetType() == typeof(FormatException))
                {
                    API.sendChatMessageToPlayer(sender, "~r~HATA: ~s~Parametre hatalı girildi.");
                }
                else
                {
                    API.shared.consoleOutput(LogCat.Warn, ex.ToString());
                }
            }
        }
예제 #15
0
        public void OnPlayerLoggedIn(Client player)
        {
            LoadPlayerLastLocation(player);
            LoadApperance(player);
            LoadPlayerStats(player);

            TriggerUserMission(player);
            MedicalCommands.CheckIfPlayerIsDead(player);
            PoliceCommands.CheckPlayerCuffed(player);
            PhoneManager.UpdatePhoneNumbers(player);
            SecurityCheck(player);
            player.SetLoggedIn(true);
        }
예제 #16
0
        public void Changing_Phone_Service(string phoneNumber, Phone.PhoneServiceTypes service)
        {
            var phones   = PhoneManager.GetPhones(_testScope.accountId);
            var oldPhone = phones.SingleOrDefault(p => p.PhoneNumber == phoneNumber);

            if (oldPhone == null)
            {
                return;
            }
            var newPhone = _accountTest.DuplicateThisPhone(oldPhone);

            newPhone.ServiceType = service;
            _accountTest.UpdatePhone(newPhone, oldPhone);
        }
예제 #17
0
        public void Changing_Phone_Status(string phoneNumber, string phoneStatus)
        {
            var phones   = PhoneManager.GetPhones(_testScope.accountId);
            var oldPhone = phones.SingleOrDefault(p => p.PhoneNumber == phoneNumber);

            if (oldPhone == null)
            {
                return;
            }
            var newPhone  = _accountTest.DuplicateThisPhone(oldPhone);
            var newStatus = _accountTest.GetPhoneStatusMapping(phoneStatus);

            newPhone.PhoneStatusId = newStatus;
            _accountTest.UpdatePhone(newPhone, oldPhone);
        }
        public void PhoneManagerApp_ProcessRequest_WithNoInputsWithDefaultTelephoneNumber_ReturnsDefaultTelephoneNumber()
        {
            // Arrange
            // generate test data
            var dataModel = new PhoneManagerModel()
            {
                DefaultCampaignQueryStringKey = "fsource", DefaultPersistDurationInDays = 32
            };

            dataModel.PhoneManagerCampaignDetail =
                new List <PhoneManagerCampaignDetail>()
            {
                new PhoneManagerCampaignDetail()
                {
                    Id = "1201", TelephoneNumber = "0800 123 4567", CampaignCode = "testcode"
                },
                new PhoneManagerCampaignDetail()
                {
                    Id = "1202", TelephoneNumber = "0800 000 1111", CampaignCode = "testcode2"
                },
                new PhoneManagerCampaignDetail()
                {
                    Id = "1203", TelephoneNumber = "0800 999 9999", IsDefault = true
                }
            };
            var testPhoneManagerData = dataModel.ToXmlString();

            var AppParamHolder = new MockProviders.PhoneManagerAppParamHolder
                                 (
                new CookieHolder(),        // cookie
                testPhoneManagerData,      // repository data
                new NameValueCollection(), // querystring
                "",                        // referrer
                new OutputModel(),         // session
                ""                         // umbraco current page id
                                 );

            // generate the required result

            PhoneManager app = new PhoneManager(AppParamHolder.CookieProvider, AppParamHolder.RepositoryProvider, AppParamHolder.QueryStringProvider, AppParamHolder.ReferrerProvider, AppParamHolder.SessionProvider, AppParamHolder.UmbracoProvider);

            //Act
            OutputModel actualResult = app.ProcessRequest();

            //Assert
            Assert.IsNotNull(actualResult.Id);
            Assert.AreEqual("1203", actualResult.Id);
        }
예제 #19
0
    public void populate()
    {
        Manager manager = Object.FindObjectOfType <Manager>();

        // Get the semivowel phone pool from the manager
        PhoneManager phoneManager = manager.phoneManager;

        AccentPhone[] accentPhones = phoneManager.accentPool;

        // Populate the scroll view
        for (int i = 0; i < accentPhones.Length; i++)
        {
            GameObject oneItem = (GameObject)Instantiate(prefabedItem, transform);
            oneItem.transform.GetChild(0).GetComponent <Text>().text = accentPhones[i].IPA;
            oneItem.transform.GetComponent <AccentItem>().phone      = accentPhones[i];
        }
    }
예제 #20
0
        public void VerifyPhoneIsNotAddedToTheAccount(string phoneNumber)
        {
            _phones = PhoneManager.GetPhones(_testScope.accountId);
            var phone = _phones.FirstOrDefault(x => x.PhoneNumber == phoneNumber);

            if (phone == null)
            {
                return;
            }
            else
            {
                _testScope.softAssert.Add(() =>
                {
                    Assert.Fail("The phone is added, test fail");
                });
            }
        }
예제 #21
0
 void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(this.gameObject);
     }
     else if (Instance == null)
     {
         Instance      = this;
         localeManager = new LocaleManager();
         localeManager.initialize();
         phoneManager = new PhoneManager();
         phoneManager.loadIn(false);
         languageManager = new LanguageManager();
         DontDestroyOnLoad(this.gameObject);
     }
 }
예제 #22
0
        public void User_Adds_A_New_Phone_Number(
            string phoneNumber,
            string phoneStatus,
            Phone.PhoneLocationTypes location,
            Phone.PhoneServiceTypes service)
        {
            var accountPhones = PhoneManager.GetPhones(_testScope.accountId);

            if (accountPhones.FirstOrDefault(x => x.PhoneNumber == phoneNumber) != null)
            {
                throw new Exception("This number " + phoneNumber + " already existed on the account");
            }

            var status    = _accountTest.GetPhoneStatusMapping(phoneStatus);
            var phoneSlot = accountPhones.GetNextAvailableSlot();

            _accountTest.AddPhoneNumber(_testScope.accountId, phoneNumber, service, location, phoneSlot, status);
        }
    // Add the items onto the screen
    public void populate()
    {
        Manager manager = Object.FindObjectOfType <Manager>();

        // Get the semivowel phone pool from the manager
        PhoneManager phoneManager = manager.phoneManager;

        SemivowelPhone[] semivowelPhones = phoneManager.semivowelPool;
        // Debug.Log(semivowelPhones.Length);

        // Populate the scroll view
        for (int i = 0; i < semivowelPhones.Length; i++)
        {
            GameObject oneItem = (GameObject)Instantiate(prefabedItem, transform);
            oneItem.transform.GetChild(0).GetComponent <Text>().text     = semivowelPhones[i].IPA;
            oneItem.transform.GetComponent <SemivowelItemScript>().phone = semivowelPhones[i];
        }
    }
        public void PhoneManagerApp_ProcessAllPotentialCandidatePhoneNumbers_WithNoCookie_WithNoFoundPhoneNumber_WithNoDefaultPhonenumber_ReturnsLastResortPhoneNumber()
        {
            // Arrange
            // generate test data
            var dataModel = new PhoneManagerModel()
            {
                DefaultCampaignQueryStringKey = "fsource", DefaultPersistDurationInDays = 32
            };

            dataModel.PhoneManagerCampaignDetail = new List <PhoneManagerCampaignDetail>()
            {
                new PhoneManagerCampaignDetail()
                {
                    Id = "1201", TelephoneNumber = "0800 123 4567", CampaignCode = "testcode"
                }
            };
            var testPhoneManagerData = dataModel.ToXmlString();

            var _dataProvider = MockProviders.Repository(testPhoneManagerData);

            // generate the required result
            var correctResult = new FinalResultModel()
            {
                OutputCookieHolder = null,
                OutputModelResult  = new OutputModel()
                {
                    TelephoneNumber = AppConstants.LastResortPhoneNumberPlaceholder
                },
                OutputResultSource = OutputSource.LastResortPlaceholder
            };

            PhoneManager target = new PhoneManager(null, _dataProvider, null, null, null, null);
            //PrivateObject obj = new PrivateObject(target); // MS Test

            //Act
            FinalResultModel retVal = target.ProcessAllPotentialCandidatePhoneNumbers(new CookieHolder(), new PhoneManagerCampaignDetail());

            //FinalResultModel retVal = (FinalResultModel)obj.Invoke("ProcessAllPotentialCandidatePhoneNumbers", new object[] { new CookieHolder(), new PhoneManagerCampaignDetail() }); // MS Test

            //Assert
            Assert.AreEqual(retVal.OutputResultSource, correctResult.OutputResultSource);
            Assert.AreEqual(retVal.OutputModelResult.TelephoneNumber, correctResult.OutputModelResult.TelephoneNumber);
        }
예제 #25
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != null)
        {
            Destroy(this);
        }

        CurrentScreen = StartGameScreen;
        foreach (CanvasGroup g in this.GetComponentsInChildren <CanvasGroup>())
        {
            if (g.gameObject != StartGameScreen)
            {
                g.interactable   = false;
                g.blocksRaycasts = false;
                g.alpha          = 0;
            }
        }
    }
예제 #26
0
        public void VerifyThePhoneServiceType(int slot, Phone.PhoneServiceTypes serviceType)
        {
            if (slot == 0)
            {
                Assert.Fail("Slot = 0, please check the step");
            }
            _phones = PhoneManager.GetPhones(_testScope.accountId);
            var phone = _phones.FirstOrDefault(x => x.PhoneSlot == slot);

            if (phone == null)
            {
                _testScope.softAssert.Add(() => { Assert.Fail("Account has no phone to test"); });
            }

            else
            {
                _testScope.softAssert.Add(() =>
                {
                    Assert.AreEqual(serviceType, phone.ServiceType);
                });
            }
        }
예제 #27
0
        public void VerifyThePhoneStatus(int slot, string phoneStatus)
        {
            if (slot == 0)
            {
                Assert.Fail("Slot = 0, please check the step");
            }
            _phones = PhoneManager.GetPhones(_testScope.accountId);
            var phone = _phones.FirstOrDefault(x => x.PhoneSlot == slot);

            if (phone == null)
            {
                _testScope.softAssert.Add(() => { Assert.Fail("Account has no phone to test"); });
            }

            else
            {
                _testScope.softAssert.Add(() =>
                {
                    Assert.AreEqual(phoneStatus, phone.PhoneStatus.Description);
                });
            }
        }
예제 #28
0
        public void VerifyThePhoneConsentOnDialer(int slot, Phone.ConsentMode consentMode)
        {
            if (slot == 0)
            {
                Assert.Fail("Slot = 0, please check the step");
            }
            _phones = PhoneManager.GetPhones(_testScope.accountId);
            var phone = _phones.FirstOrDefault(x => x.PhoneSlot == slot);

            if (phone == null)
            {
                _testScope.softAssert.Add(() => { Assert.Fail("Account has no phone to test"); });
            }

            else
            {
                _testScope.softAssert.Add(() =>
                {
                    Assert.AreEqual(consentMode, phone.ConsentForAutomatedDialing);
                });
            }
        }
예제 #29
0
        public void PropertyBuyItem(Client sender, params object[] arguments)
        {
            Character character = sender.GetCharacter();
            var       prop      = PropertyManager.IsAtPropertyInteraction(sender);

            if (prop == null)
            {
                NAPI.Chat.SendChatMessageToPlayer(sender, "You aren't at a property or you moved away.");
                return;
            }

            var itemName = (string)arguments[0];

            string name  = "";
            int    price = prop.ItemPrices.SingleOrDefault(x => x.Key == itemName).Value;

            //Make sure has enough money.
            if (Money.GetCharacterMoney(sender.GetCharacter()) < price)
            {
                NAPI.Chat.SendChatMessageToPlayer(sender, "Not Enough Money");
                return;
            }

            if (prop.HasGarbagePoint)
            {
                prop.GarbageBags += 1;
                prop.UpdateMarkers();
                if (prop.GarbageBags >= 10)
                {
                    job_manager.garbageman.Garbageman.SendNotificationToGarbagemen("A business is overflowing with garbage. We need garbagemen on the streets right now!");
                }
            }

            if (prop.Supplies <= 0)
            {
                NAPI.Chat.SendChatMessageToPlayer(sender, "The business is out of supplies.");
                return;
            }

            IInventoryItem item = null;

            if (prop.Type == PropertyManager.PropertyTypes.TwentyFourSeven)
            {
                name = ItemManager.TwentyFourSevenItems.Single(x => x[0] == itemName)[1];
                switch (itemName)
                {
                case "sprunk":
                    item = new SprunkItem();
                    break;

                case "rope":
                    item = new RopeItem();
                    break;

                case "rags":
                    item = new RagsItem();
                    break;
                }
            }
            else if (prop.Type == PropertyManager.PropertyTypes.Hardware)
            {
                name = ItemManager.HardwareItems.Single(x => x[0] == itemName)[1];
                switch (itemName)
                {
                case "phone":
                    var number = PhoneManager.GetNewNumber();
                    var phone  = new Phone()
                    {
                        PhoneNumber = number,
                        PhoneName   = "default"
                    };
                    item = phone;
                    break;

                case "rope":
                    item = new RopeItem();
                    break;

                case "rags":
                    item = new RagsItem();
                    break;

                case "axe":
                    if (InventoryManager
                        .DoesInventoryHaveItem <Weapon>(character, x => x.WeaponHash == WeaponHash.Hatchet)
                        .Length > 0)
                    {
                        NAPI.Chat.SendChatMessageToPlayer(sender, "You already have that weapon.");
                        return;
                    }

                    WeaponManager.CreateWeapon(sender, WeaponHash.Hatchet, WeaponTint.Normal, true);
                    InventoryManager.DeleteInventoryItem(sender.GetCharacter(), typeof(Money), price);
                    prop.Supplies--;
                    NAPI.Chat.SendChatMessageToPlayer(sender,
                                                      $"[BUSINESS] You have sucessfully bought an ~g~Axe~w~ for ~g~${price}.");
                    LogManager.Log(LogManager.LogTypes.Stats, $"[Business] {sender.GetCharacter().CharacterName}[{sender.GetAccount().AccountName}] has bought an Axe for {price} from property ID {prop.Id}.");
                    return;

                case "scuba":
                    item = new ScubaItem();
                    break;

                case "engineparts":
                    item = new EngineParts();
                    break;

                case "spraypaint":
                    item = new SprayPaint();
                    break;

                case "crowbar":
                    item = new Crowbar();
                    break;
                }
            }
            else if (prop.Type == PropertyManager.PropertyTypes.Restaurant)
            {
                prop.Supplies--;
                switch (itemName)
                {
                case "sprunk":
                    name = "Sprunk";
                    item = new SprunkItem();
                    break;

                case "custom1":
                    InventoryManager.DeleteInventoryItem(sender.GetCharacter(), typeof(Money), price);
                    sender.Health += 15;
                    if (sender.Health > 100)
                    {
                        sender.Health = 100;
                    }
                    NAPI.Chat.SendChatMessageToPlayer(sender, $"[BUSINESS] You have sucessfully bought a ~g~{prop.RestaurantItems[0]}~w~ for ~g~${price}.");
                    InventoryManager.GiveInventoryItem(prop, new Money(), price);
                    LogManager.Log(LogManager.LogTypes.Stats, $"[Business] {sender.GetCharacter().CharacterName}[{sender.GetAccount().AccountName}] has bought a {prop.RestaurantItems[0]} for {price} from property ID {prop.Id}.");
                    return;

                case "custom2":
                    InventoryManager.DeleteInventoryItem(sender.GetCharacter(), typeof(Money), price);
                    sender.Health += 25;
                    if (sender.Health > 100)
                    {
                        sender.Health = 100;
                    }
                    NAPI.Chat.SendChatMessageToPlayer(sender, $"[BUSINESS] You have sucessfully bought a ~g~{prop.RestaurantItems[1]}~w~ for ~g~${price}.");
                    InventoryManager.GiveInventoryItem(prop, new Money(), price);
                    LogManager.Log(LogManager.LogTypes.Stats, $"[Business] {sender.GetCharacter().CharacterName}[{sender.GetAccount().AccountName}] has bought a {prop.RestaurantItems[1]} for {price} from property ID {prop.Id}.");
                    return;

                case "custom3":
                    InventoryManager.DeleteInventoryItem(sender.GetCharacter(), typeof(Money), price);
                    sender.Health += 25;
                    if (sender.Health > 100)
                    {
                        sender.Health = 100;
                    }
                    NAPI.Chat.SendChatMessageToPlayer(sender, $"[BUSINESS] You have sucessfully bought a ~g~{prop.RestaurantItems[2]}~w~ for ~g~${price}.");
                    InventoryManager.GiveInventoryItem(prop, new Money(), price);
                    LogManager.Log(LogManager.LogTypes.Stats, $"[Business] {sender.GetCharacter().CharacterName}[{sender.GetAccount().AccountName}] has bought a {prop.RestaurantItems[2]} for {price} from property ID {prop.Id}.");
                    return;

                case "custom4":
                    InventoryManager.DeleteInventoryItem(sender.GetCharacter(), typeof(Money), price);
                    sender.Health += 25;
                    if (sender.Health > 100)
                    {
                        sender.Health = 100;
                    }
                    NAPI.Chat.SendChatMessageToPlayer(sender, $"[BUSINESS] You have sucessfully bought a ~g~{prop.RestaurantItems[3]}~w~ for ~g~${price}.");
                    InventoryManager.GiveInventoryItem(prop, new Money(), price);
                    LogManager.Log(LogManager.LogTypes.Stats, $"[Business] {sender.GetCharacter().CharacterName}[{sender.GetAccount().AccountName}] has bought a {prop.RestaurantItems[3]} for {price} from property ID {prop.Id}.");
                    return;
                }
            }
            else if (prop.Type == PropertyManager.PropertyTypes.VIPLounge)
            {
                prop.Supplies--;

                if (NAPI.Player.GetPlayerCurrentWeapon(sender) == WeaponHash.Unarmed)
                {
                    sender.SendChatMessage("You must be holding the weapon you want to tint.");
                    return;
                }

                switch (itemName)
                {
                case "pink_tint":
                    WeaponManager.SetWeaponTint(sender, NAPI.Player.GetPlayerCurrentWeapon(sender), WeaponTint.Pink);
                    break;

                case "gold_tint":
                    if (sender.GetAccount().VipLevel < 3)
                    {
                        sender.SendChatMessage("You must be a gold VIP to buy a gold tint.");
                        return;
                    }
                    WeaponManager.SetWeaponTint(sender, NAPI.Player.GetPlayerCurrentWeapon(sender), WeaponTint.Gold);
                    break;

                case "green_tint":
                    WeaponManager.SetWeaponTint(sender, NAPI.Player.GetPlayerCurrentWeapon(sender), WeaponTint.Green);
                    break;

                case "orange_tint":
                    WeaponManager.SetWeaponTint(sender, NAPI.Player.GetPlayerCurrentWeapon(sender), WeaponTint.Orange);
                    break;

                case "platinum_tint":
                    WeaponManager.SetWeaponTint(sender, NAPI.Player.GetPlayerCurrentWeapon(sender), WeaponTint.Platinum);
                    break;
                }
                name = ItemManager.VIPItems.Single(x => x[0] == itemName)[1];

                NAPI.Chat.SendChatMessageToPlayer(sender, "[BUSINESSES] You have successfully bought a ~g~" + name + "~w~ weapon tint for ~g~" + price + "~w~.");
                LogManager.Log(LogManager.LogTypes.Stats, $"[Business] {sender.GetCharacter().CharacterName}[{sender.GetAccount().AccountName}] has bought a {name} for {price} from property ID {prop.Id}.");
                return;
            }
            else if (prop.Type == PropertyManager.PropertyTypes.LSNN)
            {
                switch (itemName)
                {
                case "lotto_ticket":
                    foreach (var i in GroupManager.Groups)
                    {
                        if (i.CommandType == Group.CommandTypeLsnn)
                        {
                            i.LottoSafe += price;
                        }
                    }
                    InventoryManager.DeleteInventoryItem(sender.GetCharacter(), typeof(Money), price);
                    InventoryManager.GiveInventoryItem(prop, new Money(), price);
                    character.HasLottoTicket = true;
                    NAPI.Chat.SendChatMessageToPlayer(sender, "You purchased a lottery ticket. Good luck!");
                    LogManager.Log(LogManager.LogTypes.Stats, $"[Business] {sender.GetCharacter().CharacterName}[{sender.GetAccount().AccountName}] has bought a lottery ticket for {price} from property ID {prop.Id}.");
                    return;
                }
                return;
            }
            else if (prop.Type == PropertyManager.PropertyTypes.HuntingStation)
            {
                HuntingTag boughtTag = null;

                switch (itemName)
                {
                case "deer_tag":
                {
                    if (sender.GetCharacter().LastRedeemedDeerTag == DateTime.Today.Date)
                    {
                        NAPI.Chat.SendChatMessageToPlayer(sender, Color.White,
                                                          "~r~[ERROR]~w~ You have already redeemed a deer tag today.");
                        return;
                    }

                    var tags = InventoryManager.DoesInventoryHaveItem(character, typeof(HuntingTag));
                    if (tags.Cast <HuntingTag>().Any(i => i.Type == HuntingManager.AnimalTypes.Deer))
                    {
                        NAPI.Chat.SendChatMessageToPlayer(sender, Color.White,
                                                          "~r~[ERROR]~w~ You have already purchased a deer tag. Please drop any old ones before buying a new one.");
                        return;
                    }

                    boughtTag = new HuntingTag
                    {
                        Type      = HuntingManager.AnimalTypes.Deer,
                        ValidDate = DateTime.Today
                    };
                    name = "Deer Tag";
                    WeaponManager.CreateWeapon(sender, WeaponHash.SniperRifle, WeaponTint.Normal, true);
                    break;
                }

                case "boar_tag":
                {
                    if (sender.GetCharacter().LastRedeemedBoarTag == DateTime.Today.Date)
                    {
                        NAPI.Chat.SendChatMessageToPlayer(sender, Color.White,
                                                          "~r~[ERROR]~w~ You have already redeemed a boar tag today.");
                        return;
                    }

                    var tags = InventoryManager.DoesInventoryHaveItem(character, typeof(HuntingTag));
                    if (tags.Cast <HuntingTag>().Any(i => i.Type == HuntingManager.AnimalTypes.Boar))
                    {
                        NAPI.Chat.SendChatMessageToPlayer(sender, Color.White,
                                                          "~r~[ERROR]~w~ You have already purchased a boar tag. Please drop any old ones before buying a new one.");
                        return;
                    }

                    boughtTag = new HuntingTag
                    {
                        Type      = HuntingManager.AnimalTypes.Boar,
                        ValidDate = DateTime.Today
                    };
                    name = "Boar Tag";
                    WeaponManager.CreateWeapon(sender, WeaponHash.SniperRifle, WeaponTint.Normal, true);
                    break;
                }

                case "ammo":
                {
                    switch (InventoryManager.GiveInventoryItem(sender.GetCharacter(), new AmmoItem()))
                    {
                    case InventoryManager.GiveItemErrors.Success:
                        InventoryManager.DeleteInventoryItem(sender.GetCharacter(), typeof(Money), price);
                        prop.Supplies--;
                        WeaponManager.CreateWeapon(sender, WeaponHash.SniperRifle, WeaponTint.Normal, true);
                        NAPI.Chat.SendChatMessageToPlayer(sender,
                                                          $"[BUSINESS] You have sucessfully bought a ~g~ 5.56 Bullet ~w~ for ~g~${price}.");
                        LogManager.Log(LogManager.LogTypes.Stats, $"[Business] {sender.GetCharacter().CharacterName}[{sender.GetAccount().AccountName}] has bought a 5.56 Bullet for {price} from property ID {prop.Id}.");
                        break;

                    case InventoryManager.GiveItemErrors.NotEnoughSpace:
                        NAPI.Chat.SendChatMessageToPlayer(sender,
                                                          $"[BUSINESS] You dont have enough space for that item. Need {new AmmoItem().AmountOfSlots} Slots.");
                        break;

                    case InventoryManager.GiveItemErrors.MaxAmountReached:
                        NAPI.Chat.SendChatMessageToPlayer(sender,
                                                          $"[BUSINESS] You have reached the maximum allowed ammount of that item.");
                        break;
                    }
                    break;
                }
                }
                if (boughtTag != null)
                {
                    switch (InventoryManager.GiveInventoryItem(sender.GetCharacter(), boughtTag))
                    {
                    case InventoryManager.GiveItemErrors.Success:
                        InventoryManager.DeleteInventoryItem(sender.GetCharacter(), typeof(Money), price);
                        InventoryManager.GiveInventoryItem(sender.GetCharacter(), new AmmoItem());
                        prop.Supplies--;
                        NAPI.Chat.SendChatMessageToPlayer(sender,
                                                          $"[BUSINESS] You have sucessfully bought a ~g~{name}~w~ for ~g~${price}.");
                        LogManager.Log(LogManager.LogTypes.Stats, $"[Business] {sender.GetCharacter().CharacterName}[{sender.GetAccount().AccountName}] has bought a {name} for {price} from property ID {prop.Id}.");
                        break;

                    case InventoryManager.GiveItemErrors.NotEnoughSpace:
                        NAPI.Chat.SendChatMessageToPlayer(sender,
                                                          $"[BUSINESS] You dont have enough space for that item. Need {boughtTag.AmountOfSlots} Slots.");
                        break;

                    case InventoryManager.GiveItemErrors.MaxAmountReached:
                        NAPI.Chat.SendChatMessageToPlayer(sender,
                                                          $"[BUSINESS] You have reached the maximum allowed amount of that item.");
                        break;
                    }
                    return;
                }
                else
                {
                    return;
                }
            }
            else if (prop.Type == PropertyManager.PropertyTypes.Government)
            {
                name = ItemManager.GovItems.Single(x => x[0] == itemName)[1];
                switch (itemName)
                {
                case "id":
                    item = new IdentificationItem();
                    break;
                }
            }

            if (item == null)
            {
                NAPI.Chat.SendChatMessageToPlayer(sender,
                                                  "Error finding the item you bought, report this as a bug report.");
                return;
            }

            //Send message.
            switch (InventoryManager.GiveInventoryItem(sender.GetCharacter(), item))
            {
            case InventoryManager.GiveItemErrors.Success:
                InventoryManager.DeleteInventoryItem(sender.GetCharacter(), typeof(Money), price);
                InventoryManager.GiveInventoryItem(prop, new Money(), price);

                if (item.GetType() == typeof(Phone))
                {
                    ((Phone)item).InsertNumber();
                    NAPI.Chat.SendChatMessageToPlayer(sender, "Your phone number is: ~g~" + ((Phone)item).PhoneNumber);
                }
                prop.Supplies--;
                NAPI.Chat.SendChatMessageToPlayer(sender,
                                                  $"[BUSINESS] You have sucessfully bought a ~g~{name}~w~ for ~g~${price}.");

                LogManager.Log(LogManager.LogTypes.Stats, $"[Business] {sender.GetCharacter().CharacterName}[{sender.GetAccount().AccountName}] has bought a {name} for {price} from property ID {prop.Id}.");
                break;

            case InventoryManager.GiveItemErrors.NotEnoughSpace:
                NAPI.Chat.SendChatMessageToPlayer(sender,
                                                  $"[BUSINESS] You dont have enough space for that item. Need {item.AmountOfSlots} Slots.");
                break;

            case InventoryManager.GiveItemErrors.MaxAmountReached:
                NAPI.Chat.SendChatMessageToPlayer(sender,
                                                  $"[BUSINESS] You have reached the maximum allowed amount of that item.");
                break;

            case InventoryManager.GiveItemErrors.HasSimilarItem:
                NAPI.Chat.SendChatMessageToPlayer(sender,
                                                  $"[BUSINESS] You already have a similar item.");
                break;
            }
        }
예제 #30
0
파일: MDC.cs 프로젝트: Yarpii/MTGRP
        public void MDCSearchForCitizen(Client player, params object[] arguments)
        {
            var name  = (string)arguments[0];
            var phone = (string)arguments[1];

            //First if online.


            Character foundPlayer = null;

            foreach (var playerfound in PlayerManager.Players)
            {
                if (playerfound == null)
                {
                    continue;
                }
                if (playerfound.CharacterName == name)
                {
                    foundPlayer = playerfound;
                    break;
                }
            }

            if (foundPlayer == null)
            {
                foundPlayer = PhoneManager.GetPlayerWithNumber(phone);
            }

            if (foundPlayer == null)
            {
                var filter = Builders <Character> .Filter.Eq(x => x.CharacterName, name) |
                             (Builders <Character> .Filter.Eq("Inventory.PhoneNumber", phone));

                //Not online.. check DB.
                var found = DatabaseManager.CharacterTable.Find(filter);
                if (found.Any())
                {
                    foundPlayer = found.First();
                }
            }

            //If still NULL
            if (foundPlayer == null)
            {
                NAPI.ClientEvent.TriggerClientEvent(player, "MDC_SHOW_CITIZEN_INFO", "", "", "", "", "");
                return;
            }

            //GET VEHICLES.
            var vehicles     = DatabaseManager.VehicleTable.Find(x => x.OwnerId == foundPlayer.Id).ToList();
            var vehiclesList = vehicles.Where(x => x.IsRegistered).Select(x => new[]
                                                                          { VehicleOwnership.returnCorrDisplayName(x.VehModel), x.LicensePlate }).ToArray();

            //Get amount of crimes.
            var amountOfPages = Math.Floor((foundPlayer.GetCrimesNumber() + 9d) / 10d);
            var crimes        = GetCrimeArray(foundPlayer);

            //Store character.
            player.SetData("MDC_LAST_CHECKED", foundPlayer);

            //Send Event
            NAPI.ClientEvent.TriggerClientEvent(player, "MDC_SHOW_CITIZEN_INFO", foundPlayer.rp_name(), foundPlayer.Birthday,
                                                NAPI.Util.ToJson(vehiclesList), NAPI.Util.ToJson(crimes), amountOfPages);
        }
예제 #31
0
 void Start()
 {
     root = GameObject.Find("UI Root");
     pm = root.transform.Find("Phone_Panel").gameObject.GetComponent<PhoneManager>();
 }