Esempio n. 1
0
        // sub_54EC1
        internal static bool CanSellDropTradeItem(Item item)
        {
            bool canSellDropTradeItem = false;

            if (item.readied)
            {
                ovr025.string_print01("Must be unreadied");
            }
            else if (item.IsScroll() == false)
            {
                canSellDropTradeItem = true;
            }
            else if ((int)item.affect_1 > 0x7F || (int)item.affect_2 > 0x7F || (int)item.affect_3 > 0x7F)
            {
                ovr025.displayPlayerName(false, 15, 1, gbl.SelectedPlayer);

                gbl.textXCol = gbl.SelectedPlayer.name.Length + 2;
                gbl.textYCol = 0x15;

                seg041.press_any_key(" was going to scribe from that scroll", false, 14, TextRegion.Normal2);
                if (ovr027.yes_no(gbl.defaultMenuColors, "is it Okay to lose it? ") == 'Y')
                {
                    canSellDropTradeItem = true;
                }
            }
            else
            {
                canSellDropTradeItem = true;
            }

            seg037.draw8x8_clear_area(TextRegion.Normal2);

            return canSellDropTradeItem;
        }
Esempio n. 2
0
        // sub_56478
        internal static void UseMagicItem(ref bool arg_0, Item item)
        {
            gbl.spell_from_item = false;
            int spellId = 0;

            if (item.IsScroll() == true)
            {
                gbl.currentScroll = item;

                bool dummy_bool;
                int dummy_index = -1;
                spellId = spell_menu2(out dummy_bool, ref dummy_index, SpellSource.Cast, SpellLoc.scroll);
            }
            else if (item.affect_2 > 0 && (int)item.affect_3 < 0x80)
            {
                gbl.spell_from_item = true;
                spellId = (int)item.affect_2 & 0x7F;
            }

            if (spellId == 0)
            {
                arg_0 = false;
            }
            else
            {
                if (gbl.game_state == GameState.Combat &&
                    gbl.SelectedPlayer.quick_fight == QuickFight.False)
                {
                    ovr025.RedrawCombatScreen();
                }

                if (gbl.spell_from_item == true)
                {
                    ovr025.DisplayPlayerStatusString(false, 10, "uses an item", gbl.SelectedPlayer);

                    if (gbl.game_state == GameState.Combat)
                    {
                        seg041.displayString("Item:", 0, 10, 0x17, 0);

                        ovr025.ItemDisplayNameBuild(true, false, 0x17, 5, item);
                    }
                    else
                    {
                        ovr025.ItemDisplayNameBuild(true, false, 0x16, 1, item);
                    }

                    seg041.GameDelay();
                    ovr025.ClearPlayerTextArea();
                }

                gbl.spell_from_item = true;

                if (item.IsScroll() == true)
                {
                    if (gbl.SelectedPlayer.SkillLevel(SkillType.MagicUser) > 0 ||
                        gbl.SelectedPlayer.SkillLevel(SkillType.Cleric) > 0)
                    {
                        ovr023.sub_5D2E1(ref arg_0, false, gbl.SelectedPlayer.quick_fight, spellId);
                    }
                    else if (gbl.SelectedPlayer.thief_lvl > 9 &&
                            ovr024.roll_dice(100, 1) <= 75)
                    {
                        ovr023.sub_5D2E1(ref arg_0, false, gbl.SelectedPlayer.quick_fight, spellId);
                    }
                    else
                    {
                        ovr025.DisplayPlayerStatusString(true, gbl.textYCol, "oops!", gbl.SelectedPlayer);
                    }
                }
                else
                {
                    ovr023.sub_5D2E1(ref arg_0, false, gbl.SelectedPlayer.quick_fight, spellId);
                }

                gbl.spell_from_item = false;

                if (gbl.game_state == GameState.Combat &&
                    gbl.spellCastingTable[spellId].whenCast != SpellWhen.Camp)
                {
                    arg_0 = true;
                    ovr025.clear_actions(gbl.SelectedPlayer);
                }
            }

            if (arg_0 == true)
            {
                if (item.IsScroll() == true)
                {
                    ovr023.remove_spell_from_scroll(spellId, item, gbl.SelectedPlayer);
                }
                else if (item.affect_1 > 0)
                {
                    if (item.count > 1)
                    {
                        item.count -= 1;
                    }
                    else
                    {
                        item.affect_1 -= 1;
                        if (item.affect_1 == 0)
                        {
                            ovr025.lose_item(item, gbl.SelectedPlayer);
                        }
                    }
                }
            }
        }