Ejemplo n.º 1
0
    public static OtherBase GetItem(long objNo)
    {
        TableOtherData data = Array.Find(Table, i => i.ObjNo == objNo);
        OtherBase      item = new OtherBase();

        item.Initialize();
        item.ObjNo          = data.ObjNo;
        item.DisplayName    = data.DisplayName;
        item.ThrowDexterity = data.ThrowDexterity;
        item.Description    = data.Description;
        return(item);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// アイテムを入れる
    /// </summary>
    public BaseItem PutinItem(int itype, BaseItem target, PlayerCharacter player)
    {
        //サウンドを鳴らす
        SoundInformation.Sound.Play(SoundInformation.SoundType.Putin);

        DisplayInformation.Info.AddMessage(string.Format(CommonConst.Message.PutinAction, target.DisplayNameInMessage, this.DisplayNameInMessage));

        switch (BgType)
        {
        //保存
        case BagType.Save:

            BagItems.Add(target);
            target.InDrive = this;
            return(target);

            break;

        //Recycle
        case BagType.Recycle:

            //ターゲットが別のバッグに入っていたら取り出しておく
            if (target.IsDrive == true)
            {
                BagBase bag = target.InDrive;
                bag.PutoutItem(target);
            }

            OtherBase d = TableOther.GetItem(CommonConst.ObjNo.Dollar);
            d.Initialize();
            d.SellingPrice = target.SellingPrice;

            player.RecoverHp(999);
            EffectDamage dm = EffectDamage.CreateObject(player);
            dm.SetText("999", AttackState.Heal);
            dm.Play();
            SoundInformation.Sound.Play(SoundInformation.SoundType.Recover);

            BagItems.Add(d);
            d.InDrive = this;

            return(d);

            break;

        //変化
        case BagType.Change:
            //ターゲットが別のバッグに入っていたら取り出しておく
            if (target.IsDrive == true)
            {
                BagBase bag = target.InDrive;
                bag.PutoutItem(target);
            }
            //uintの乱数を取得
            uint     rand = CommonFunction.GetRandomUInt32();
            BaseItem ch   = TableItemIncidence.GetItem(itype, rand, true);
            if (CommonFunction.IsNull(ch) == true)
            {
                return(null);
            }
            int stopper = 0;
            while (ch.IType == ItemType.Bag || ch.IType == ItemType.Material)
            {
                if (stopper > 30)
                {
                    return(null);
                }
                stopper++;
                rand = CommonFunction.GetRandomUInt32();
                ch   = TableItemIncidence.GetItem(itype, rand, true);
            }

            ch.IsAnalyse = DungeonInformation.Info.IsAnalyze == false;
            BagItems.Add(ch);
            ch.InDrive = this;

            //PlayerCharacter.RemoveItem(target);
            //player.AddItem(ch, DateTime.Now.Ticks);

            return(ch);

            break;

        //コロッケ
        case BagType.Food:
            //ターゲットが別のバッグに入っていたら取り出しておく
            if (target.IsDrive == true)
            {
                BagBase bag = target.InDrive;
                bag.PutoutItem(target);
            }
            BaseItem tar = TableItemIncidence.GetTypeItemRandom(itype, ItemType.Food, true);
            if (CommonFunction.IsNull(tar) == true)
            {
                return(null);
            }
            BagItems.Add(tar);
            tar.InDrive = this;

            //PlayerCharacter.RemoveItem(target);
            //player.AddItem(tar, DateTime.Now.Ticks);

            return(tar);

            break;

        //普通
        case BagType.Normal:

            BagItems.Add(target);
            target.InDrive = this;
            return(target);

            break;
        }

        return(target);
    }