예제 #1
0
 /// <summary>
 /// Constructs a new VanillaItemInfo based upon the given ID. Do not try to call this yourself - use <see cref="Wrap"/>
 /// </summary>
 /// <param name="ID">The vanilla ID to be wrapped.</param>
 /// <param name="WrapForTile">If true, the Tile property should not be set by this constructor, as it will be set later as part of a TileInfo's constructor.</param>
 protected VanillaItemInfo(int ID, bool WrapForTile) : base(ItemRegistry.GetDefaultTypeByID(ID), GadgetCoreAPI.GetItemName(ID), GadgetCoreAPI.GetItemDesc(ID), GadgetCoreAPI.GetItemMaterial(ID), -1, GadgetCoreAPI.GetTrueGearBaseStats(ID), GadgetCoreAPI.GetWeaponMaterial(ID), ID >= 1000 && ID < 2000 ? GadgetCoreAPI.GetDroidHeadMaterial(ID) : GadgetCoreAPI.GetHeadMaterial(ID), ID >= 1000 && ID < 2000 ? GadgetCoreAPI.GetDroidBodyMaterial(ID) : GadgetCoreAPI.GetBodyMaterial(ID), GadgetCoreAPI.GetArmMaterial(ID))
 {
     this.ID = ID;
     if ((Type & ItemType.EQUIP_MASK) == (ItemType.WEAPON & ItemType.EQUIP_MASK))
     {
         SetWeaponInfo(ItemRegistry.GetDefaultWeaponScalingByID(ID), GadgetCoreAPI.GetAttackSound(ID), ItemRegistry.GetDefaultCritChanceBonus(ID), ItemRegistry.GetDefaultCritPowerBonus(ID), ID);
         OnAttack += (script) => { Attacking = true; IEnumerator ie = script.Attack(); Attacking = false; return(ie); };
     }
     else if ((Type & ItemType.USABLE) == ItemType.USABLE)
     {
         OnUse += (slot) => { Using = true; InstanceTracker.GameScript.StartCoroutine(InstanceTracker.GameScript.UseItemFinal(slot)); return(false); };
     }
     if (!WrapForTile)
     {
         if (TileRegistry.Singleton.HasEntry(ID))
         {
             SetTile(TileRegistry.Singleton.GetEntry(ID));
         }
         else
         {
             SetTile(VanillaTileInfo.Wrap(ID, false));
         }
     }
 }