Ejemplo n.º 1
0
        public static void BlueprintUse(IBlueprintItem item, BlueprintDataBlock bdb)
        {
            Contract.Requires(item != null);
            Contract.Requires(bdb != null);

            if (item.controllable == null)
                throw new InvalidOperationException("IBlueprintItem's controllable is null.");

            if (item.controllable.playerClient == null)
                throw new InvalidOperationException("IBlueprintItem's playerClient is null.");

            Fougerite.Player player = Fougerite.Player.FindByPlayerClient(item.controllable.playerClient);
            if (player == null) return;

            BPUseEvent ae = new BPUseEvent(bdb);
            if (OnBlueprintUse != null)
                OnBlueprintUse(player, ae);
            if (ae.Cancel) return;

            PlayerInventory internalInventory = player.Inventory.InternalInventory as PlayerInventory;
            if (internalInventory.BindBlueprint(bdb))
            {
                int count = 1;
                if (item.Consume(ref count))
                {
                    internalInventory.RemoveItem(item.slot);
                }
                player.Notice("", "You can now craft: " + bdb.resultItem.name, 4f);
            }
            else
            {
                player.Notice("", "You already have this blueprint", 4f);
            }
        }
Ejemplo n.º 2
0
 public void OnBlueprintUse(Player player, BPUseEvent evt)
 {
     Invoke("On_BlueprintUse", player, evt);
 }
Ejemplo n.º 3
0
 void OnBlueprintUse(Fougerite.Player param0, BPUseEvent param1)
 {
     foreach (KeyValuePair<string, V8Plugin> plugin in plugins)
     {
         plugin.Value.Invoke("On_BlueprintUse", param0, param1); // Deprecated
         plugin.Value.Invoke("OnBlueprintUse", param0, param1);
     }
 }