Beispiel #1
0
        public static Phone GivePhone(Player sender, Player target)
        {
            if (!sender.AccountData.HavePerm("admin.cmds.give.phone"))
            {
                throw new Exception("Vous n'avez pas les permissions pour cela.");
            }

            Phone phone = PhoneHelper.CreatePhone();

            if (PhoneHelper.GetDefaultPhone(target.ActiveCharacter) == null)
            {
                phone.DefaultPhone = true;
            }

            try
            {
                InventoryHelper.AddItemToCharacter(target.ActiveCharacter, phone);

                ServerDbContext dbContext = ((GameMode)GameMode.Instance).DbContext;
                dbContext.SaveChanges();
                return(phone);
            }
            catch
            {
                PhoneHelper.DeletePhone(phone);
                throw new Exception("Le téléphone n'a pas pu être ajouté à l'utilisateur.");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Открывает инвентарь игрока
        /// </summary>
        private void ShowInventory(Client player, object[] args)
        {
            var inventory = GetInventory(player);
            var weight    = InventoryHelper.CalculateWeight(inventory);

            API.triggerClientEvent(player, ServerEvent.SHOW_INVENTORY, JsonConvert.SerializeObject(inventory), (int)weight);
        }
Beispiel #3
0
 void Attack()
 {
     Types.Items itemType = InventoryHelper.GetActiveItemType(playerInventory);
     // Only attack after the cooldown buffer time window has passed.
     if (Time.time > attackCooldown && itemType == Types.Items.Weapon)
     {
         Weapon          weapon       = InventoryHelper.GetActiveItem(playerInventory) as Weapon;
         List <Collider> localEnemies = LocateEnemyInWeaponRange(weapon.range);
         foreach (Collider enemyCol in localEnemies)
         {
             Health enemyHealth = enemyCol.gameObject.GetComponent <Health>();
             // Give the Infected weapon damage.
             enemyHealth.TakeDamage(weapon.damage);
             // Do the math to calculate the angle in which the target is from the enemy.
             Vector3 directionToTarget = enemyCol.transform.position - transform.position;
             // Normalize that Vector3 to get to direction only.
             directionToTarget.Normalize();
             // Create a new Throw class, giving it our two values.
             Types.Throw attackThrow = new Types.Throw(directionToTarget, weapon.force);
             // Give both of those values to the "GetThrown" in order to throw the enemy backware
             enemyHealth.GetThrown(attackThrow);
             // Create a buffer between attacks
             attackCooldown = Time.time + weapon.speed;
         }
     }
 }
Beispiel #4
0
 protected void AddStock(object parameter)
 {
     try
     {
         selling_history ob = new selling_history();
         ob.id               = 0;
         ob.dealer_id        = SelectedDealer.id;
         ob.product_id       = SelectedProduct.id;
         ob.quantity         = Quantity;
         ob.credit           = 0;
         ob.debit            = Amount;
         ob.transaction_type = (int)InventoryHelper.TransactionType.Debit;
         ob.customer_info    = "";
         ob.payment_type     = PaymentType == null ? "" : PaymentType.Content.ToString();
         ob.payment_date     = DateTime.Now;
         ob.customer_name    = "";
         ob.remarks          = Remarks;
         SellingHistoryServices.AddUpdateSellingHistory(ob);
         ProductServices.UpdateProductStock(ob.product_id);
         //MessageBox.Show("Stock Added");
         InventoryHelper.SuccessAlert("Success", "Stock Added");
         Initialize();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error Occurse::" + ex.ToString());
     }
 }
Beispiel #5
0
        public void ValidateClient(object parameter)
        {
            try
            {
                DataLayer.Constants.DynamicConnectionString = InventoryHelper.DynamicConnectionString;
                var passwordBox = (PasswordBox)parameter;
                Password = passwordBox.Password;
                bool flag = UserServices.CheckLogin(UserName, Password);
                if (flag == true)
                {
                    worker.DoWork             += worker_DoWork;
                    worker.RunWorkerCompleted += worker_RunWorkerCompleted;
                    worker.RunWorkerAsync();
                    // MessageBox.Show("Login Successful");
                    InventoryHelper.SuccessAlert("Success", "Login Successful.");

                    MainWindow ob = new MainWindow();
                    this.Close = true;
                    ob.ShowDialog();
                }
                else
                {
                    //MessageBox.Show("Fails");
                    InventoryHelper.growlNotifications.AddNotification(new Notification {
                        Title = "Warning", ImageUrl = "pack://application:,,,/Files/notification-icon.png", Message = "Login Fails."
                    });
                }
            }
            catch
            {
                InventoryHelper.SimpleAlert("Warning", " Please Check Configuration Settings");
            }
        }
Beispiel #6
0
    private void OnLevelEnd(bool has_won)
    {
        GameEventSystem.RaiseGameEvent(GAME_EVENT.GAME_PAUSED);
        int money_earned = 0;

        if (has_won)
        {
            Debug.Log("WON !");
            if (localLevelData != null)
            {
                money_earned = ScoreManager.GetTotalMoney(localLevelData.completed);
                LevelHelper.UpdateLevel(localLevelData.id, true, money_earned);
                LevelHelper.SaveLevelData();
                InventoryHelper.UpdateMoney(money_earned);
                InventoryHelper.SavePlayerData();
                PlayerPrefs.SetInt("last_level_id", localLevelData.id);
            }
            else
            {
                Debug.LogError("Cannot update level, levelData is null");
            }
        }
        else
        {
            playerGO.GetComponent <PlayerController>().OnPlayerDead();
            Debug.Log("LOST");
        }

        if (LevelUIManager.instance != null)
        {
            StartCoroutine(LevelUIManager.instance.ShowGameOverScreen(has_won, money_earned));
        }
    }
        public override void Read(PacketStream stream)
        {
            var cashShopItems = CashShopManager.Instance.GetCashShopItems();

            var numBuys = stream.ReadByte();

            for (var i = 0; i < numBuys; i++)
            {
                var cashShopId  = stream.ReadUInt32();
                var mainTab     = stream.ReadByte();
                var subTab      = stream.ReadByte();
                var detailIndex = stream.ReadByte();

                var cashItem = cashShopItems.Find(a => a.CashShopId == cashShopId);

                if (cashItem != null)
                {
                    var item = ItemManager.Instance.Create(cashItem.ItemTemplateId, 1, 0);
                    InventoryHelper.AddItemAndUpdateClient(Connection.ActiveChar, item);
                }
            }

            var receiverName = stream.ReadString();


            //_log.Warn("ICSBuyGood");

            Connection.ActiveChar.SendPacket(new SCICSBuyResultPacket(true, 1, "Test", 5555));
        }
        protected void AddSubCatagory(object parameter)
        {
            string  sub_category_name;
            TextBox tb = (TextBox)parameter;

            sub_category_name = tb.Text;
            if ((sub_category_name != "") && (SelectedCategory != null))
            {
                List <sub_category> temp_list = SubCategoryServices.GetAllSubCategoryByName(sub_category_name.Trim(), SelectedCategory.id);
                if (temp_list.Count == 0)
                {
                    sub_category ct = new sub_category();
                    ct.id = 0;
                    ct.subcategory_name = sub_category_name;
                    ct.category         = SelectedCategory.id;
                    int temp_SubCategory_id = SubCategoryServices.AddUpdateSubCategory(ct);
                    if (temp_SubCategory_id != 0)
                    {
                        // MessageBox.Show("Category " + sub_category_name + " is Created");
                        InventoryHelper.SuccessAlert("Success", "Category " + sub_category_name + " is Created");
                        BindGrid();
                    }
                }
            }
        }
        public void Execute(Unit caster, SkillCaster casterObj, BaseUnit target, SkillCastTarget targetObj,
                            CastAction castObj, Skill skill, SkillObject skillObject, DateTime time, int Value1, int Value2, int Value3,
                            int Value4)
        {
            var owner     = (Character)caster;
            var skillData = (SkillItem)casterObj;

            var itemInfo = owner.Inventory.GetItem(skillData.ItemId);

            if (itemInfo == null || itemInfo.Count <= 0)
            {
                return;
            }

            var tasks = new List <ItemTask>
            {
                InventoryHelper.GetTaskAndRemoveItem(owner, itemInfo, 1)
            };

            owner.BmPoint += Value1;
            owner.SendPacket(new SCBmPointPacket(owner.BmPoint));
            owner.SendPacket(new SCItemTaskSuccessPacket(ItemTaskType.SkillReagents, tasks, new List <ulong>()));

            // TODO - LOYALT IS ACCOUNT WIDE
        }
Beispiel #10
0
        public void AddCatagory(object parameter)
        {
            string  category_name;
            TextBox tb = (TextBox)parameter;

            category_name = tb.Text;
            if (category_name != "")
            {
                List <category> temp_list = CategoryServices.GetAllCategoryByName(category_name.Trim());
                if (temp_list.Count == 0)
                {
                    category ct = new category();
                    ct.id            = 0;
                    ct.category_name = category_name;
                    int temp_Category_id = CategoryServices.AddUpdateCategory(ct);
                    if (temp_Category_id != 0)
                    {
                        InventoryHelper.SuccessAlert("Success", "Category " + category_name + " is Created");
                        // MessageBox.Show("Category " + category_name + " is Created");
                        BindGrid();
                        RaisedPropertyChanged("Category");
                    }
                }
            }
        }
Beispiel #11
0
        public void TookLootDropItem(Character character, List <Item> lootDropItems, Item lootDropItem, int count)
        {
            var objId = (uint)(lootDropItem.Id >> 32);

            if (lootDropItem.TemplateId == 500)
            {
                character.Money += lootDropItem.Count;
                character.SendPacket(new SCItemTaskSuccessPacket(ItemTaskType.SkillEffectGainItem,
                                                                 new List <ItemTask> {
                    new MoneyChange(lootDropItem.Count)
                }, new List <ulong>()));
            }
            else
            {
                var item = ItemManager.Instance.Create(lootDropItem.TemplateId, count > lootDropItem.Count ? lootDropItem.Count : count, lootDropItem.Grade);
                InventoryHelper.AddItemAndUpdateClient(character, item);
            }

            lootDropItems.Remove(lootDropItem);
            if (lootDropItems.Count <= 0)
            {
                RemoveLootDropItems(objId);
                character.BroadcastPacket(new SCLootableStatePacket(objId, false), true);
            }
            character.SendPacket(new SCLootItemTookPacket(500, lootDropItem.Id, lootDropItem.Count));
        }
    public void Start()
    {
        if (interactText == null)
        {
            interactText = GameObject.Find("MiniGameClose").transform.Find("GUI").GetComponent <GuiDisplayer>().GetInteract();
        }

        // get reference for inventory manipulation
        if (hasItem)
        {
            inventory = Systems.Inventory;
        }

        // materials for material blinking
        if (BlinkWhenPlayerNear)
        {
            mat_original  = gameObject.GetComponent <MeshRenderer>().material;
            mat_blink     = Resources.Load("Materials/Transparent Object 1", typeof(Material)) as Material;
            _meshRenderer = GetComponent <MeshRenderer>();
        }
        if (BlinkOnInteract)
        {
            mat_original  = gameObject.GetComponent <MeshRenderer>().material;
            mat_blinkOnce = Resources.Load("Materials/Transparent Object 1", typeof(Material)) as Material; //pick another color (blue) how?
            _meshRenderer = GetComponent <MeshRenderer>();
        }
    }
Beispiel #13
0
    public MinesPage(AlmanacMenu menu, ModEntry mod) : base(menu, mod)
    {
        Seed = Mod.GetBaseWorldSeed();

        Sprites = new();

        Sprites[LevelType.Mushroom] = SpriteHelper.GetSprite(
            InventoryHelper.CreateItemById("(O)420", 1)             // Red Mushroom
            );

        Sprites[LevelType.InfestedMonster] = SpriteHelper.GetSprite(
            InventoryHelper.CreateItemById("(W)0", 1)             // Rusty Sword
            );

        Sprites[LevelType.InfestedSlime] = SpriteHelper.GetSprite(
            InventoryHelper.CreateItemById("(O)766", 1)             // Slime
            );

        Sprites[LevelType.Quarry] = new SpriteInfo(
            Mod.Helper.GameContent.Load <Texture2D>("Characters/Monsters/Haunted Skull"),
            new Rectangle(0, 0, 16, 16)
            );

        Sprites[LevelType.InfestedQuarry] = new SpriteInfo(
            Mod.Helper.GameContent.Load <Texture2D>("Characters/Monsters/Haunted Skull"),
            new Rectangle(0, 0, 16, 16)
            );

        Sprites[LevelType.Dino] = SpriteHelper.GetSprite(
            InventoryHelper.CreateItemById("(O)107", 1)             // Dino Egg
            );

        Update();
    }
    public int GetAvailableQuantity(Farmer who, IList <Item?>?items, IList <IInventory>?inventories, int max_quality)
    {
        int amount = 0;

        if (who != null)
        {
            foreach (var item in who.Items)
            {
                int quality = item is SObject obj ? obj.Quality : 0;
                if (quality <= max_quality && InventoryHelper.DoesItemMatchID(Index, item))
                {
                    amount += item.Stack;
                }
            }
        }

        if (items != null)
        {
            foreach (var item in items)
            {
                if (item is null)
                {
                    continue;
                }

                int quality = item is SObject obj ? obj.Quality : 0;
                if (quality <= max_quality && InventoryHelper.DoesItemMatchID(Index, item))
                {
                    amount += item.Stack;
                }
            }
        }

        return(amount);
    }
Beispiel #15
0
        protected bool ProcessRequiredItems(Object dropInItem, Farmer farmer)
        {
            var outputItem = GetOutputItem(dropInItem);

            if (dropInItem.Stack < outputItem.InputCount)
            {
                ShowRedMessage(farmer, $"Requires {outputItem.InputCount} {dropInItem.Name}");
                return(false);
            }

            var and = outputItem.And;

            if (and == null)
            {
                dropInItem.Stack -= (outputItem.InputCount - 1);
                return(true);
            }

            var andName     = new Object(and.ID, 1).Name;
            var actualCount = farmer.getTallyOfObject(and.ID, false);

            if (actualCount < and.Count)
            {
                ShowRedMessage(farmer, $"Requires {and.Count} {andName}");
                return(false);
            }
            else
            {
                dropInItem.Stack -= (outputItem.InputCount - 1);
                InventoryHelper.RemoveItem(and.ID, and.Count, farmer);
                return(true);
            }
        }
Beispiel #16
0
        public void AddDealer(object Parameter)
        {
            dealer ob = new dealer();

            ob.id             = 0;
            ob.dealer_address = DealerAddress;
            ob.dealer_name    = DealerName;
            List <dealer> temp = DelarServices.GetDelarByName(ob.dealer_name.Trim());

            if (temp.Count == 0)
            {
                int temp_dealerid = DelarServices.AddUpdateDealer(ob);
                if (temp_dealerid > 0)
                {
                    // MessageBox.Show("Dealer added successfully");
                    InventoryHelper.SuccessAlert("Success", "Dealer added successfully");
                    DealerAddress = "";
                    DealerName    = "";
                }
            }
            else
            {
                InventoryHelper.SimpleAlert("Warning", "Dealer Name already Exist");
                //MessageBox.Show("Dealer Name already Exist");
            }
        }
Beispiel #17
0
        public void DeleteDealer(object parameter)
        {
            bool    flag     = false;
            int     delar_id = 0;
            TextBox tb       = (TextBox)parameter;

            int.TryParse(tb.Text, out delar_id);
            try
            {
                if (delar_id > 0)
                {
                    flag = DelarServices.DeleteDealer(delar_id);
                }
                if (flag == true)
                {
                    BindGrid();
                    RaisedPropertyChanged("Delars");
                    InventoryHelper.SuccessAlert("Success", "Delar Deleted");
                }
            }
            catch
            {
                InventoryHelper.SimpleAlert("Warning", "Dealer associated with Products");
            }
        }
Beispiel #18
0
    // Start is called before the first frame update
    void Start()
    {
        instance        = this;
        inventoryHelper = new InventoryHelper();

        // Set Listener for buy amount text field
        if (buyInBulkPanel != null)
        {
            var eventListener = new InputField.SubmitEvent();
            buyAmountFieldObj = buyInBulkPanel.transform.GetChild(1).gameObject;
            buyInputField     = buyAmountFieldObj.GetComponent <InputField>();
            eventListener.AddListener(SetBuyAmount);
            buyInputField.onEndEdit = eventListener;
        }

        // Set Listener for sell amount text field
        if (sellInBulkPanel != null)
        {
            var eventListener = new InputField.SubmitEvent();
            sellAmountFieldObj = sellInBulkPanel.transform.GetChild(1).gameObject;
            sellInputField     = sellAmountFieldObj.GetComponent <InputField>();
            eventListener.AddListener(SetSellAmount);
            sellInputField.onEndEdit = eventListener;
        }
    }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Open the specified file.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void OpenFile(string filePath)
        {
            m_xmlFilePath = filePath;

            // Make sure the file exists
            if (!File.Exists(m_xmlFilePath))
            {
                string path = Utils.PrepFilePathForMsgBox(m_xmlFilePath);
                string msg  = string.Format(Properties.Resources.kstidIpaGridErrNoFile, path);
                Utils.MsgBox(msg);
                return;
            }

            InventoryHelper.Load();
            m_nonEditableSymbols = InventoryHelper.IPASymbolCache.Values.Where(x => x.Decimal < 0).ToList();
            m_symbols            = InventoryHelper.IPASymbolCache.Values.Where(x => x.Decimal > 0).ToList();

            BuildGrid();
            RenumberArticulators();

            // Allow users to addingChar records to the opened file
            btnAdd.Enabled    = true;
            btnModify.Enabled = true;
            btnDelete.Enabled = true;
        }
Beispiel #20
0
        //public static List<BrandModel> GetModelList()
        //{
        //    try
        //    {
        //        // models = (from md in _unitOfWork.BrandModel.GetAll()
        //        //          // join itmmst in _unitOfWork.ItemMaster.GetAll()
        //        //         //  on md.Code equals itmmst.Model
        //        //           select md),

        //        return GLHelper.GetModelList();
        //    }
        //    catch { throw; }
        //}
        public static List <ItemMaster> GetItemMasterList()
        {
            try
            {
                return(InventoryHelper.GetItemMasterList());
            }
            catch { throw; }
        }
Beispiel #21
0
    void Start()
    {
        _interact  = GetComponent <InteractWithObject>();
        _inventory = Systems.Inventory;

        Shovel = Resources.Load <Item>("Items/Shovel");
        Rope   = Resources.Load <Item>("Items/Rope");
    }
Beispiel #22
0
        //public static List<PartnerCreation> GetPartnerCreationList()
        //{
        //    try
        //    {
        //        // partnercreation = (from parttyp in _unitOfWork.PartnerType.GetAll()
        //        //                    join partcr in _unitOfWork.PartnerCreation.GetAll()
        //        //                    on parttyp.Code equals partcr.Partnertype
        //        //                    where parttyp.AccountType == NatureOfAccounts.TRADEVENDORS.ToString()
        //        //                    select partcr),
        //        var partnerCreationList = PartnerCreationHelper.GetList();
        //        var partnerTypeList = PartnerTypeHelper.GetPartnerTypeList();

        //        return (from parttyp in partnerTypeList
        //                join partcr in partnerCreationList
        //                on parttyp.Code equals partcr.Partnertype
        //                where parttyp.AccountType.Equals("TRADEVENDORS", StringComparison.OrdinalIgnoreCase)
        //                select partcr).ToList();
        //    }
        //    catch { throw; }
        //}
        public static List <Brand> GetBrandList()
        {
            try
            {
                return(InventoryHelper.GetBrandList());
            }
            catch { throw; }
        }
Beispiel #23
0
        public GridCargo ReadAllCargo()
        {
            var inventoryBlocks = GridBlocksHelper.Get(GTS).GetAllInventoryBlocks();
            var inventories     = inventoryBlocks.SelectMany(t => InventoryHelper.GetInventories(t));

            Items = CargoHelper.GetItemsInInventories(inventories);
            return(this);
        }
Beispiel #24
0
 void DropItem()
 {
     if (backpack[0] != null)
     {
         InventoryHelper.GetActiveItem(this).Drop();
         backpack.RemoveAt(0);
     }
 }
Beispiel #25
0
 public void LoadToPlayer(Player player, bool shouldClear)
 {
     if (shouldClear)
     {
         InventoryHelper.ClearPlayerInventory(player);
     }
     InventoryHelper.GiveInventoryItems(player, Items);
 }
Beispiel #26
0
 private void OnBuyCallback(int cost, int skillId)
 {
     currentMoney   -= cost;
     totalMoney.text = "$" + currentMoney.ToString();
     InventoryHelper.UpdateMoney(-cost);
     InventoryHelper.UpdateSkills(skillId, 1);
     moneyUsed = true;
 }
Beispiel #27
0
 public void ShowObject(object keyValue)
 {
     adjustment = new Adjustment {
         AdjustmentNo = InventoryHelper.GetNextAdjustmentNo()
     };
     adjustmentBindingSource.DataSource = adjustment;
     Loadlookup();
 }
Beispiel #28
0
    void Start()
    {
        logger     = GameObject.Find("Logger").GetComponent <LogToServer>();
        _interact  = GetComponent <InteractWithObject>();
        _inventory = Systems.Inventory;

        Wrench = Resources.Load <Item>("Items/Wrench");
        _inventory.CheckOnAdd.AddListener(UpdateConditions);
    }
Beispiel #29
0
    void Start()
    {
        _interact  = GetComponent <InteractWithObject>();
        _inventory = Systems.Inventory;

        Heater.SetActive(false);
        MustardWater = Resources.Load <Item>("Items/Jug");
        FilledWater  = Resources.Load <Item>("Items/DirtyMustardWater");
    }
Beispiel #30
0
    void Start()
    {
        _interact  = GetComponent <InteractWithObject>();
        _inventory = Systems.Inventory;


        Pot  = Resources.Load <Item>("Items/Pot");
        Wood = Resources.Load <Item>("Items/Wood");
    }