Exemplo n.º 1
0
 public EatResponse OnEvent(EventId id, object cookie)
 {
     if (id == EventId.LootCollected)
     {
         LootData     lootData     = cookie as LootData;
         int          num          = 0;
         CurrencyType currencyType = this.currencyType;
         if (currencyType != CurrencyType.Credits)
         {
             if (currencyType != CurrencyType.Materials)
             {
                 if (currencyType == CurrencyType.Contraband)
                 {
                     num = lootData.Contraband;
                 }
             }
             else
             {
                 num = lootData.Materials;
             }
         }
         else
         {
             num = lootData.Credits;
         }
         if (num > 0)
         {
             this.parent.ChildUpdated(this, num);
             this.IncrementCollection(num);
         }
     }
     return(EatResponse.NotEaten);
 }
Exemplo n.º 2
0
    public void Init(LootData _itemData, IMapController map, IEntityController entityController)
    {
        _map = map;
        _entityController = entityController;

        _entityController.OnMonsterKilled += OnMonsterKilled;
    }
        public EatResponse OnEvent(EventId id, object cookie)
        {
            if (id == EventId.LootCollected)
            {
                LootData lootData = cookie as LootData;
                int      num      = 0;
                switch (this.currencyType)
                {
                case CurrencyType.Credits:
                    num = lootData.Credits;
                    break;

                case CurrencyType.Materials:
                    num = lootData.Materials;
                    break;

                case CurrencyType.Contraband:
                    num = lootData.Contraband;
                    break;
                }
                if (num > 0)
                {
                    this.parent.ChildUpdated(this, num);
                    this.IncrementCollection(num);
                }
            }
            return(EatResponse.NotEaten);
        }
Exemplo n.º 4
0
        public Loot(LootData data, IItemRepository itemRepository,
                    ILootDataRepository lootDataRepository, IItemCategoryRepository itemCategoryRepository)
        {
            this.itemRepository         = itemRepository;
            this.lootDataRepository     = lootDataRepository;
            this.itemCategoryRepository = itemCategoryRepository;

            this.main = CreateTable(data, 0, true, true, true);
        }
Exemplo n.º 5
0
        public void AddLoot(Int32 gold, BaseItem item)
        {
            if (!enabled)
            {
                enabled = true;
            }
            LootData item2 = new LootData(gold, item);

            m_lootQueue.Enqueue(item2);
        }
Exemplo n.º 6
0
    public static LootData getCombatResults(string playerId, int gameId, int encounterId)
    {
        string url          = RestUtil.COMBAT_SERVER_URI + "endCombat/" + playerId + "/" + gameId + "/" + encounterId;
        string jsonResponse = RestUtil.Instance.Get(url);

        Debug.Log("Loot data response: " + jsonResponse);
        LootData lootData = JsonConvert.DeserializeObject <LootData>(jsonResponse);

        return(lootData);
    }
Exemplo n.º 7
0
    private void OnBarrelDeath(DeathEvent barrelDeathEvent)
    {
        LootData itemDropData = barrelDeathEvent.GetDrop();

        if (itemDropData == null)
        {
            return;
        }
        itemDropData.Initialize();
        SpawnDropItem(barrelDeathEvent.Position, itemDropData.Visual).GetComponent <Item>().SetDropItemData(itemDropData);
    }
Exemplo n.º 8
0
    private void GetOneLoot(List <LootObjData> dataList, LootData lootData)
    {
        LootWeight lootWeight = GetRandomLootWeight(lootData._lootList);

        if (lootWeight != null)
        {
            LootObjData lootObj = new LootObjData();
            lootObj._lootId    = lootWeight._itemId;
            lootObj._lootCount = UnityEngine.Random.Range(lootWeight._countMin, lootWeight._countMax);;
            dataList.Add(lootObj);
        }
    }
Exemplo n.º 9
0
    private void LootWithScore(List <LootObjData> dataList, LootData lootData, float score)
    {
        int count = 0;

        while (score > 0)
        {
            LootWeight lootWeight = GetRandomLootWeight(lootData._lootList);
            if (lootWeight != null)
            {
                int lootCount = UnityEngine.Random.Range(lootWeight._countMin, lootWeight._countMax);

                float lootScore = 0;
                if (lootWeight._itemId == "money")
                {
                    lootScore = lootCount;
                }
                else
                {
                    ItemData data = getItemData(lootWeight._itemId);

                    lootScore = lootCount * (data == null ? 0 : 0);
                }

                //Debug.Log("score: "+ score + "     :" + lootWeight._itemId + "    "+ lootCount + "    " +lootScore  +"    " + (lootScore < score * 2));


                if (lootScore < score * 2)
                {
                    score -= lootScore;
                    LootObjData lootObj = new LootObjData();
                    lootObj._lootId    = lootWeight._itemId;
                    lootObj._lootCount = lootCount;
                    dataList.Add(lootObj);
                }
            }

            count++;
            if (count >= _lootMax)
            {
                //Debug.LogWarning("CalLootWithScore:["+count+"]  totalScore:" + totalScore + " remainScore:"+ score);
                break;
            }
        }

        /*
         * string result = "result :   ";
         * foreach(LootObjData tmp in dataList)
         * {
         *  result +=  tmp._lootId +  "   ";
         * }
         * Debug.Log(result);
         */
    }
Exemplo n.º 10
0
 public LootData GetLoot(int id)
 {
     if (!_lootMap.TryGetValue(id, out var item))
     {
         _lootMap.Add(id, null);
         _lootMap[id] = item = LootData.Deserialize(_jsonDatabase.GetLoot(id), this);
     }
     if (item == null)
     {
         throw new DatabaseException(CircularDependencyText + "Loot_" + id);
     }
     return(item);
 }
Exemplo n.º 11
0
    public void SpawnDrop(GameObject spawnFrom)
    {
        for (int i = 0; i < _lootDropDataHolder.lootList.Length; i++)
        {
            LootData targetLootData = _lootDropDataHolder.lootList[i];

            targetLootData.overallDropChance = ChanceCalculater.RollChance(targetLootData.dropChance, targetLootData.overallDropChance);
            if (targetLootData.overallDropChance == 0)
            {
                SpawnItem(targetLootData.item, spawnFrom);
            }
        }
    }
Exemplo n.º 12
0
 protected override void Update()
 {
     base.Update();
     if (m_lootQueue.Count > 0)
     {
         if (m_lootQueue.Peek().m_gold > 0)
         {
             LootData lootData = m_lootQueue.Dequeue();
             if (ConfigManager.Instance.Options.IsLeftActionBarShowingArrows)
             {
                 m_isGoldShown = true;
                 m_lootGoldEntry.Init(null, lootData.m_gold);
                 if (m_audioObject == null || !m_audioObject.IsPlaying())
                 {
                     m_audioObject = AudioController.Play("Gold_loot");
                 }
             }
         }
         else
         {
             GameObject   gameObject = Helper.Instantiate <GameObject>(m_ItemEntryPrefab);
             HUDLootEntry component  = gameObject.GetComponent <HUDLootEntry>();
             AddEntry(component);
             LootData lootData2 = m_lootQueue.Dequeue();
             component.Init(lootData2.m_item, 0);
             if (m_audioObject == null || !m_audioObject.IsPlaying())
             {
                 m_audioObject = AudioController.Play("item_loot");
             }
         }
     }
     if (m_lootGoldEntry.IsUsed())
     {
         m_lootGoldEntry.UpdateEntry();
     }
     else if (m_isGoldShown)
     {
         m_lootGoldEntry.SetEnabledEntry(false);
         m_isGoldShown = false;
     }
     else if (!ConfigManager.Instance.Options.IsLeftActionBarShowingArrows && !m_isGoldEntryDisabled)
     {
         ENTRIES_ROOT.transform.localPosition = ENTRIES_ROOT.transform.localPosition - Vector3.up * (ENTRY_HEIGHT + ENTRY_HEIGHT_OFFSET);
         m_isGoldEntryDisabled = true;
     }
     else if (ConfigManager.Instance.Options.IsLeftActionBarShowingArrows && m_isGoldEntryDisabled)
     {
         ENTRIES_ROOT.transform.localPosition = ENTRIES_ROOT.transform.localPosition + Vector3.up * (ENTRY_HEIGHT + ENTRY_HEIGHT_OFFSET);
         m_isGoldEntryDisabled = false;
     }
 }
Exemplo n.º 13
0
        private void ToggleMenu(Message msg)
        {
            var lootItemHolders = ((ObjectData)msg.Data).Value as Dictionary <string, LootItemHolder>;

            int curSlotIndex = -1;

            if (lootItemHolders.ContainsKey(LootData.GetFullLootName(Bullets.API.BulletType.HEAVY)))
            {
                var itemHolder = lootItemHolders[LootData.GetFullLootName(Bullets.API.BulletType.HEAVY)];

                for (int i = 0; i < itemHolder.SlotAmount; ++i)
                {
                    curSlotIndex++;

                    var slot = _slots[curSlotIndex].GetComponent <BackpackSlot>();
                    slot.ItemIcon.gameObject.SetActive(true);

                    if (i == itemHolder.SlotAmount - 1)
                    {
                        slot.Amount.text = (itemHolder.Amount - (itemHolder.SlotAmount - 1) * itemHolder.MaxInSlot).ToString();
                    }
                    else
                    {
                        slot.Amount.text = itemHolder.MaxInSlot.ToString();
                    }
                }
            }

            if (lootItemHolders.ContainsKey(LootData.GetFullLootName(Bullets.API.BulletType.SHELLS)))
            {
                var itemHolder = lootItemHolders[LootData.GetFullLootName(Bullets.API.BulletType.SHELLS)];

                for (int i = 0; i < itemHolder.SlotAmount; ++i)
                {
                    curSlotIndex++;

                    var slot = _slots[curSlotIndex].GetComponent <BackpackSlot>();
                    slot.ItemIcon.gameObject.SetActive(true);

                    if (i == itemHolder.SlotAmount - 1)
                    {
                        slot.Amount.text = (itemHolder.Amount - (itemHolder.SlotAmount - 1) * itemHolder.MaxInSlot).ToString();
                    }
                    else
                    {
                        slot.Amount.text = itemHolder.MaxInSlot.ToString();
                    }
                }
            }
        }
Exemplo n.º 14
0
    private void OnDeathEvent(DeathEvent deathEvent)
    {
        if (deathEvent.DeathType == DeathType.ByDistance)
        {
            return;
        }

        LootData itemDropData = deathEvent.GetDrop();

        if (itemDropData == null)
        {
            return;
        }
        SpawnDropItem(deathEvent.Position, itemDropData.Visual).GetComponent <Item>().SetDropItemData(itemDropData);
        itemDropData.Initialize();
    }
Exemplo n.º 15
0
        public LootGump(Mobile m) : base(0, 0)
        {
            PlayerMobile mm          = m as PlayerMobile;
            LootData     lootoptions = (LootData)XmlAttach.FindAttachment(m, typeof(LootData));

            this.Closable   = true;
            this.Disposable = true;
            this.Dragable   = true;
            this.Resizable  = false;
            this.AddPage(0);
            this.AddBackground(0, 0, 368, 284, 9380);

            this.AddLabel(126, 7, 0, @"Oak's Loot Options");
            this.AddLabel(81, 34, 0, @"All Corpse Items");
            this.AddLabel(81, 64, 0, @"Hides/Scales");
            this.AddLabel(81, 94, 0, @"Just Artifacts");
            this.AddLabel(81, 124, 0, @"All Weapons");
            this.AddLabel(81, 154, 0, @"All Armor");
            this.AddLabel(81, 184, 0, @"Get Ground Items");

            this.AddLabel(259, 34, 0, @"Jewelry");
            this.AddLabel(259, 64, 0, @"Potions");
            this.AddLabel(259, 94, 0, @"Gems");
            this.AddLabel(259, 124, 0, @"Clothes");
            this.AddLabel(259, 154, 0, @"Food");
            this.AddLabel(259, 184, 0, @"Resources");

            this.AddLabel(113, 210, 0, @"*Gold is always looted*");

            this.AddCheck(60, 34, 210, 211, lootoptions.GetAll, 1);
            this.AddCheck(60, 64, 210, 211, lootoptions.GetHides, 2);
            this.AddCheck(60, 94, 210, 211, lootoptions.GetArtifacts, 3);
            this.AddCheck(60, 124, 210, 211, lootoptions.GetWeapons, 4);
            this.AddCheck(60, 154, 210, 211, lootoptions.GetArmor, 5);
            this.AddCheck(60, 184, 210, 211, lootoptions.GetGroundItems, 11);

            this.AddCheck(229, 34, 210, 211, lootoptions.GetJewelry, 6);
            this.AddCheck(229, 64, 210, 211, lootoptions.GetPotions, 7);
            this.AddCheck(229, 94, 210, 211, lootoptions.GetGems, 8);
            this.AddCheck(229, 124, 210, 211, lootoptions.GetClothes, 9);
            this.AddCheck(229, 154, 210, 211, lootoptions.GetFood, 10);
            this.AddCheck(229, 184, 210, 211, lootoptions.GetResources, 12);

            this.AddButton(67, 228, 247, 248, 1, GumpButtonType.Reply, 0);
            this.AddButton(244, 228, 241, 248, 0, GumpButtonType.Reply, 0);
        }
Exemplo n.º 16
0
 private void LootWithCount(List <LootObjData> dataList, LootData lootData, float count)
 {
     while (count > 0)
     {
         if (count > 1)
         {
             count -= 1;
             GetOneLoot(dataList, lootData);
         }
         else
         {
             if (IsHit(count))
             {
                 GetOneLoot(dataList, lootData);
             }
             break;
         }
     }
 }
        private static List <PickupObject> GenerateContents(LootData lootTable, LootData breakertronLootTable, PlayerController player, int tierShift, System.Random safeRandom = null)
        {
            List <PickupObject> list = new List <PickupObject>();

            if (lootTable.lootTable == null)
            {
                list.Add(GameManager.Instance.Dungeon.baseChestContents.SelectByWeight(false).GetComponent <PickupObject>());
            }
            else if (lootTable != null)
            {
                if (tierShift <= -1)
                {
                    if (breakertronLootTable.lootTable != null)
                    {
                        list = breakertronLootTable.GetItemsForPlayer(player, -1, null, safeRandom);
                    }
                    else
                    {
                        list = lootTable.GetItemsForPlayer(player, tierShift, null, safeRandom);
                    }
                }
                else
                {
                    list = lootTable.GetItemsForPlayer(player, tierShift, null, safeRandom);
                    if (lootTable.CompletesSynergy)
                    {
                        float num = Mathf.Clamp01(0.6f - 0.1f * (float)lootTable.LastGenerationNumSynergiesCalculated);
                        num = Mathf.Clamp(num, 0.2f, 1f);
                        if (num > 0f)
                        {
                            float num2 = (safeRandom == null) ? UnityEngine.Random.value : ((float)safeRandom.NextDouble());
                            if (num2 < num)
                            {
                                lootTable.CompletesSynergy = false;
                                list = lootTable.GetItemsForPlayer(player, tierShift, null, safeRandom);
                                lootTable.CompletesSynergy = true;
                            }
                        }
                    }
                }
            }
            return(list);
        }
Exemplo n.º 18
0
    protected virtual void OpenLootBox()
    {
        LootData lootData = lootBox.GetLoot();

        switch (lootData.lootType)
        {
        case LootType.Diamonds:
            DataManager.diamondsCount += lootData.count;
            break;

        case LootType.Lives:
            DataManager.livesCount += lootData.count;
            break;
        }

        rewardPanel.Open(lootData);

        OnOpen();
    }
Exemplo n.º 19
0
    void DropLoot()
    {
        Transform lootPost = this.transform;
        float     dropRNG  = Mathf.Round(Random.Range(0.0f, 1.0f) * 100f) / 100f;

        if (dropRNG <= dropChance)
        {
            GameObject newLoot = Instantiate(lootPrefab) as GameObject;
            newLoot.transform.position = lootPost.position;
            LootData loot = newLoot.GetComponent <LootData>();

            int lootTotal = npc.Loot.Count;
            int lootRNG   = (int)Mathf.Round(Random.Range(0, lootTotal));

            Debug.Log("LootRNG: " + lootRNG);

            loot.itemID = npc.Loot[lootRNG];
        }
    }
Exemplo n.º 20
0
    // Update is called once per frame
    void Update()
    {
        if (combatEnd)
        {
            return;
        }
        elapsedTime += Time.deltaTime;
        if (elapsedTime > updateTime && combatData.gameState.Equals("combat"))
        {
            elapsedTime = 0.0f;
            clearUnits();
            foreach (CombatDataUnit unit in combatData.dataUnits)
            {
                GetCellAt(unit.locX, unit.locY).dataUnit = unit;
            }
        }

        if (combatData.gameState.Equals("won"))
        {
            // todo: display won dialog and loot window
            LootData lootData = CombatService.getCombatResults(playerId, gameId, encounterId);
            gameController.combatWindow.SetActive(false);
            lootWindow.SetActive(true);
            earnedXp.text = lootData.xpEarned.ToString();
            earnedGp.text = lootData.gpEarned.ToString();
            earnedAp.text = lootData.apEarned.ToString();

            combatEnd = true;
            // remove encounter from game
            enemyManager.encounterObjects.TryGetValue(encounterId, out GameObject encGameObjectToDelete);
            if (encGameObjectToDelete != null)
            {
                Destroy(encGameObjectToDelete);
            }
        }
        else if (combatData.gameState.Equals("lost"))
        {
            // todo: display lost dialog and remove player from game
            combatEnd = true;
        }
    }
Exemplo n.º 21
0
        private IRandomizerTable CreateTable(
            LootData data, float probability, bool unique, bool guaranteed, bool enabled)
        {
            var table = new RandomizerTable(data.Count, probability, unique, guaranteed, enabled);

            foreach (var item in data.Items)
            {
                switch (item.Type)
                {
                case LootItemType.Null:
                    table.Contents.Add(new RandomizerNullValue(item.Probability));
                    break;

                case LootItemType.Table:
                    table.Contents.Add(
                        CreateTable(
                            this.lootDataRepository.FindOrFail(item.TableId),
                            item.Probability,
                            item.Unique,
                            item.Guaranteed,
                            item.Enabled
                            )
                        );
                    break;

                case LootItemType.Item:
                    table.Contents.Add(CreateItem(item));
                    break;

                case LootItemType.Random:
                    table.Contents.Add(CreateRandom(item));
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(item.Type), item.Type, null);
                }
            }

            return(table);
        }
Exemplo n.º 22
0
    public void Open(LootData lootData)
    {
        gameObject.SetActive(true);

        LootPanelData lootPanelData = null;

        for (int i = 0; i < lootPanelDatas.Length; i++)
        {
            if (lootPanelDatas[i].lootType == lootData.lootType)
            {
                lootPanelData = lootPanelDatas[i];
                break;
            }
        }

        if (lootPanelData == null)
        {
            return;
        }

        if (lootPanel != null)
        {
            Destroy(lootPanel.gameObject);
        }

        lootPanel      = Instantiate(lootPanelData.lootPanel, lootPanelParent.position, Quaternion.identity, lootPanelParent);
        lootPanel.icon = lootPanelData.icon;

        if (lootData.lootType == LootType.Diamonds || lootData.lootType == LootType.Lives)
        {
            lootPanel.text = Converter.ConvertToString(lootData.count);
        }
        else
        {
            lootPanel.text = lootPanelData.text;
        }
    }
Exemplo n.º 23
0
        public static void Grab_OnCommand(CommandEventArgs e)
        {
            //   Get LootData attachment
            LootData lootoptions = new LootData();

            // does player already have a lootdata attachment?
            if (XmlAttach.FindAttachment(e.Mobile, typeof(LootData)) == null)
            {
                XmlAttach.AttachTo(e.Mobile, lootoptions);
                // give them one free lootbag
                e.Mobile.AddToBackpack(new LootBag());
            }
            else
            {
                // they have the attachment, just load their options
                lootoptions = (LootData)XmlAttach.FindAttachment(e.Mobile, typeof(LootData));
            }

            //   Check args to see if they want to change loot options
            // if we have args after  "grab"
            if (e.Length != 0)
            {
                // we need to set the loot bag
                if (e.GetString(0) != "options")
                {
                    e.Mobile.SendMessage("Typing the command [grab  by itself loots corpses of your victims. [grab options will allow you to decide what you want to loot.");
                }
                // show loot options gump
                else if (e.GetString(0) == "options")
                {
                    e.Mobile.SendGump(new LootGump(e.Mobile));
                }
            }

            //   Check loot legalities
            Mobile from = e.Mobile;

            if (from.Alive == false)
            {
                from.PlaySound(1069);                   //hey
                from.SendMessage("You cannot do that while you are dead!");
                return;
            }
            //else if ( 0 != CompetitiveGrabRadius && BlockingMobilesInRange( from, GrabRadius ))
            //{
            //	from.PlaySound( 1069 ); //hey
            //	from.SendMessage( "You are too close to another player to do that!" );
            //	return;
            //}

            ArrayList grounditems = new ArrayList();
            ArrayList lootitems   = new ArrayList();
            ArrayList corpses     = new ArrayList();
            Container lootBag     = GetLootBag(from);

            // Gather lootable corpses and items into lists
            foreach (Item item in from.GetItemsInRange(GrabRadius))
            {
                if (!from.InLOS(item) || !item.IsAccessibleTo(from) || !(item.Movable || item is Corpse))
                {
                    continue;
                }

                // add to corpse list if corpse
                if (item is Corpse && CorpseIsLootable(from, item as Corpse, false))                     // && item.Killer == from
                {
                    Corpse deadbody = item as Corpse;
                    if (deadbody.Killer == null)
                    {
                        corpses.Add(item);
                    }
                    else if (deadbody.Killer == from)
                    {
                        corpses.Add(item);
                    }
                    else if (deadbody.Killer is BaseCreature && !(deadbody.Killer is PlayerMobile))
                    {
                        BaseCreature pet = deadbody.Killer as BaseCreature;
                        if (pet.ControlMaster == from || pet.ControlMaster == null)
                        {
                            corpses.Add(item);
                        }
                    }
                }

                // otherwise add to ground items list if loot options indicate
//ORIGINALY HERE-Trying to clear up yellow startup saying that item moble never is
//				else if ( !( item is PlayerMobile ) )
//				{
//					if(lootoptions.GetGroundItems)
//						if (!(item is Corpse))
//							grounditems.Add( item );
//				}
//END ORIGINALY HERE
                else
                if (lootoptions.GetGroundItems)
                {
                    if (!(item is Corpse))
                    {
                        grounditems.Add(item);
                    }
                }
            }

            // see if we really want any of the junk lying on the ground
            GetItems(lootoptions, from, grounditems);

            grounditems.Clear();

            // now inspect and loot appropriate items in corpses
            foreach (Item corpse in corpses)
            {
                Corpse       bod = corpse as Corpse;
                PlayerMobile pm  = from as PlayerMobile;
                //pm.PlayerLevel += 1;

                /*                                          // Uncomment for eventual modifications (not to allow grabbing certain bodies)
                 * Mobile own = bod.Owner as Mobile;
                 * if( (own is Mobile1) || (own is Mobile2) )  // Change mobile names according to what you want to get
                 */
                {
                    // if we are looting hides/scales/meat then carve the corpse
                    if (lootoptions.GetHides && !(bod.Owner is PlayerMobile))
                    {
                        bod.Carve(from, null);
                    }

                    //rummage through the corpse for good stuff
                    foreach (Item item in bod.Items)
                    {
                        lootitems.Add(item);
                    }

                    //  now see if we really want any of this junk
                    GetItems(lootoptions, from, lootitems);

                    // alrighty then, we have all the items we want, now award gold for this corpse, delete it and increment the body count
//                    AwardGold(from, bod, lootBag); //REMED OUT SO THAT REGULAR MOBS WONT GIVE GOLD WHEN USE GRAB COMMAND
                    bod.Delete();

                    // empty lootitems arraylist
                    lootitems.Clear();
                }
            }
        }
Exemplo n.º 24
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            PlayerMobile pm          = sender.Mobile as PlayerMobile;
            LootData     lootoptions = (LootData)XmlAttach.FindAttachment(pm, typeof(LootData));

            switch (info.ButtonID)
            {
            case 0:         // closed or cancel
            {
                break;
            }

            case 1:                         // OKAY button pressed
            {
                ArrayList Selections = new ArrayList(info.Switches);

                if (Selections.Contains(1) == true)
                {
                    lootoptions.GetAll = true;
                }
                else
                {
                    lootoptions.GetAll = false;
                }

                if (Selections.Contains(2) == true)
                {
                    lootoptions.GetArtifacts = true;
                }
                else
                {
                    lootoptions.GetArtifacts = false;
                }

                if (Selections.Contains(3) == true)
                {
                    lootoptions.GetWeapons = true;
                }
                else
                {
                    lootoptions.GetWeapons = false;
                }

                if (Selections.Contains(4) == true)
                {
                    lootoptions.GetArmor = true;
                }
                else
                {
                    lootoptions.GetArmor = false;
                }

                if (Selections.Contains(5) == true)
                {
                    lootoptions.GetClothing = true;
                }
                else
                {
                    lootoptions.GetClothing = false;
                }

                if (Selections.Contains(6) == true)
                {
                    lootoptions.GetJewelry = true;
                }
                else
                {
                    lootoptions.GetJewelry = false;
                }

                if (Selections.Contains(7) == true)
                {
                    lootoptions.GetGems = true;
                }
                else
                {
                    lootoptions.GetGems = false;
                }

                if (Selections.Contains(8) == true)
                {
                    lootoptions.GetArrows = true;
                }
                else
                {
                    lootoptions.GetArrows = false;
                }

                if (Selections.Contains(9) == true)
                {
                    lootoptions.GetFood = true;
                }
                else
                {
                    lootoptions.GetFood = false;
                }

                if (Selections.Contains(10) == true)
                {
                    lootoptions.GetHides = true;
                }
                else
                {
                    lootoptions.GetHides = false;
                }

                if (Selections.Contains(11) == true)
                {
                    lootoptions.GetScales = true;
                }
                else
                {
                    lootoptions.GetScales = false;
                }

                if (Selections.Contains(12) == true)
                {
                    lootoptions.GetWood = true;
                }
                else
                {
                    lootoptions.GetWood = false;
                }

                if (Selections.Contains(13) == true)
                {
                    lootoptions.GetOres = true;
                }
                else
                {
                    lootoptions.GetOres = false;
                }

                if (Selections.Contains(14) == true)
                {
                    lootoptions.GetReagents = true;
                }
                else
                {
                    lootoptions.GetReagents = false;
                }

                if (Selections.Contains(15) == true)
                {
                    lootoptions.GetPotions = true;
                }
                else
                {
                    lootoptions.GetPotions = false;
                }

                if (Selections.Contains(16) == true)
                {
                    lootoptions.GetOther = true;
                }
                else
                {
                    lootoptions.GetOther = false;
                }

                if (Selections.Contains(17) == true)
                {
                    lootoptions.GetGroundItems = true;
                }
                else
                {
                    lootoptions.GetGroundItems = false;
                }

                break;
            }
            }
        }
Exemplo n.º 25
0
        public LootGump(Mobile m) : base(200, 100)
        {
            LootData lootoptions = (LootData)XmlAttach.FindAttachment(m, typeof(LootData));


            this.Closable   = true;
            this.Disposable = true;
            this.Dragable   = true;
            this.Resizable  = false;

            AddPage(0);
            AddBackground(0, 0, 450, 511, 9380);

            AddLabel(166, 4, 0, @"Looting Options");
            AddLabel(108, 37, 233, @"Select what you want to be looted");

            AddLabel(40, 90, 0, @"All Items");
            AddCheck(160, 90, 1151, 1154, lootoptions.GetAll, 1);

            AddLabel(39, 130, 0, @"Artifacts");
            AddCheck(160, 130, 1151, 1154, lootoptions.GetArtifacts, 2);

            AddLabel(40, 170, 0, @"Weapons");
            AddCheck(160, 170, 1151, 1154, lootoptions.GetWeapons, 3);

            AddLabel(40, 210, 0, @"Armor");
            AddCheck(160, 210, 1151, 1154, lootoptions.GetArmor, 4);

            AddLabel(40, 250, 0, @"Clothing");
            AddCheck(160, 250, 1151, 1154, lootoptions.GetClothing, 5);

            AddLabel(40, 290, 0, @"Jewelry");
            AddCheck(160, 290, 1151, 1154, lootoptions.GetJewelry, 6);

            AddLabel(40, 330, 0, @"Gems");
            AddCheck(160, 330, 1151, 1154, lootoptions.GetGems, 7);

            AddLabel(40, 370, 0, @"Bolts/Arrows");
            AddCheck(160, 370, 1151, 1154, lootoptions.GetArrows, 8);

            AddLabel(270, 90, 0, @"Food");
            AddCheck(380, 90, 1151, 1154, lootoptions.GetFood, 9);

            AddLabel(270, 130, 0, @"Hides");
            AddCheck(380, 129, 1151, 1154, lootoptions.GetHides, 10);

            AddLabel(270, 170, 0, @"Scales");
            AddCheck(380, 170, 1151, 1154, lootoptions.GetScales, 11);

            AddLabel(270, 210, 0, @"Wood");
            AddCheck(380, 210, 1151, 1154, lootoptions.GetWood, 12);

            AddLabel(270, 250, 0, @"Ores");
            AddCheck(380, 250, 1151, 1154, lootoptions.GetOres, 13);

            AddLabel(270, 290, 0, @"Reagents");
            AddCheck(380, 290, 1151, 1154, lootoptions.GetReagents, 14);

            AddLabel(270, 330, 0, @"Potions");
            AddCheck(380, 330, 1151, 1154, lootoptions.GetPotions, 15);

            AddLabel(270, 370, 0, @"Other Things");
            AddCheck(380, 370, 1151, 1154, lootoptions.GetOther, 16);

            AddLabel(140, 410, 0, @"Get Ground Items");
            AddCheck(280, 410, 1151, 1154, lootoptions.GetGroundItems, 17);

            AddButton(349, 450, 247, 248, 1, GumpButtonType.Reply, 0);
            AddButton(30, 450, 241, 242, 0, GumpButtonType.Reply, 0);
        }
Exemplo n.º 26
0
        private static void GetItems(LootData lootoptions, Mobile from, ArrayList loothopefuls)
        {
            ArrayList itemstoloot = new ArrayList();

            Container lootBag = GetLootBag(from);

            foreach (Item item in loothopefuls)
            {
                if (item is Server.Items.Gold)
                {
                    itemstoloot.Add(item);
                }

                /*else if( !(item is xxx || item is yyy) ) // Uncomment for eventual customizations (not to allow grabbing certain items)
                 *   itemstoloot.Add(item);
                 */
                else if (lootoptions.GetAll)
                {
                    itemstoloot.Add(item);
                }
                else
                {
                    if ((IsArtifact(item)) && (lootoptions.GetArtifacts))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.BaseWeapon) && (lootoptions.GetWeapons))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.BaseArmor) && (lootoptions.GetArmor))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.BaseClothing || item is Server.Items.BaseShoes) && (lootoptions.GetClothing))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.BaseJewel) && (lootoptions.GetJewelry))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.Diamond || item is Server.Items.Amber || item is Server.Items.Amethyst || item is Server.Items.Citrine || item is Server.Items.Emerald || item is Server.Items.Ruby || item is Server.Items.Sapphire || item is Server.Items.StarSapphire || item is Server.Items.Tourmaline) && (lootoptions.GetGems))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.Arrow || item is Server.Items.Bolt) && (lootoptions.GetArrows))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.CookableFood || item is Server.Items.Food) && (lootoptions.GetFood))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.BaseHides) && (lootoptions.GetHides))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.BaseScales) && (lootoptions.GetScales))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.Board || item is Server.Items.Log || item is Server.Items.Shaft) && (lootoptions.GetWood))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.BaseIngot || item is Server.Items.BaseOre) && (lootoptions.GetOres))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.BaseReagent) && (lootoptions.GetReagents))
                    {
                        itemstoloot.Add(item);
                    }
                    else if ((item is Server.Items.BasePotion) && (lootoptions.GetPotions))
                    {
                        itemstoloot.Add(item);
                    }
                    else if (lootoptions.GetOther)
                    {
                        itemstoloot.Add(item);
                    }
                }


                // if we have any items
                if (itemstoloot != null)
                {
                    // Drop all of the items into player's bag/pack
                    foreach (Item itemx in itemstoloot)
                    {
                        if (!lootBag.TryDropItem(from, itemx, false))
                        {
                            lootBag.DropItem(itemx);
                        }
                        from.PlaySound(0x2E6);                           // drop gold sound
                    }
                    itemstoloot.Clear();
                }
            }
        }
Exemplo n.º 27
0
 public override void SetDropItemData(LootData data)
 {
     itemDropData = data as LootData_Money;
 }
Exemplo n.º 28
0
 public override void SetDropItemData(LootData data)
 {
     itemDropData = data as LootData_HomingMissile;
 }
Exemplo n.º 29
0
    public void OpenLootBox(LootBox lootBox)
    {
        LootData loot = lootBox.GetLoot();

        Debug.Log(loot);
    }
Exemplo n.º 30
0
 private void Awake()
 {
     _lootData = GetComponent <LootData>();
 }