Exemple #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.GetGearBaseStats(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.WEAPON)
     {
         SetWeaponInfo(ItemRegistry.GetDefaultWeaponScalingByID(ID), GadgetCoreAPI.GetAttackSound(ID), ItemRegistry.GetDefaultCritChanceBonus(ID), ItemRegistry.GetDefaultCritPowerBonus(ID), ID);
         OnAttack += (script) => { Attacking = true; IEnumerator ie = AttackMethod.Invoke(script, new object[] { }) as IEnumerator; Attacking = false; return(ie); };
     }
     else if ((Type & ItemType.USABLE) == ItemType.USABLE)
     {
         OnUse += (slot) => { Using = true; InstanceTracker.GameScript.StartCoroutine(UseMethod.Invoke(InstanceTracker.GameScript, new object[] { slot }) as IEnumerator); return(false); };
     }
     if (!WrapForTile)
     {
         if (TileRegistry.GetSingleton().HasEntry(ID))
         {
             SetTile(TileRegistry.GetSingleton().GetEntry(ID));
         }
         else
         {
             SetTile(VanillaTileInfo.Wrap(ID, false));
         }
     }
 }