Exemple #1
0
 public void OnBlueprintUse(BPUseEvent ae)
 {
     if (!this.blueprintsKnown.ContainsKey(ae.DataBlock.uniqueID))
     {
         this.blueprintsKnown.Add(ae.DataBlock.uniqueID, ae.DataBlock.name);
     }
 }
Exemple #2
0
 public static void BlueprintUse(IBlueprintItem item, BlueprintDataBlock bdb)
 {
     //Fougerite.Player player = Fougerite.Player.FindByPlayerClient(item.controllable.playerClient);
     Fougerite.Player player = Fougerite.Server.Cache[item.controllable.playerClient.userID];
     if (player != null)
     {
         BPUseEvent ae = new BPUseEvent(bdb, item);
         if (OnBlueprintUse != null)
         {
             OnBlueprintUse(player, ae);
         }
         if (!ae.Cancel)
         {
             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);
             }
         }
     }
 }
 public void OnBlueprintUse(Player p, BPUseEvent ae)
 {
     this.Invoke("On_BlueprintUse", new object[]
     {
         p,
         ae
     });
 }
Exemple #4
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);
     }
 }
Exemple #5
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);
            }
        }
Exemple #6
0
 public static bool BlueprintUse(IBlueprintItem item, BlueprintDataBlock bdb)
 {
     Magma.Player player = Magma.Player.FindByPlayerClient(item.controllable.playerClient);
     if (player != null)
     {
         BPUseEvent ae = new BPUseEvent(bdb);
         if (OnBlueprintUse != null)
         {
             OnBlueprintUse(player, ae);
         }
         if (!ae.Cancel)
         {
             return(true);
         }
     }
     return(false);
 }
        public static bool BlueprintUse(IBlueprintItem item, BlueprintDataBlock bdb)
        {
            Player player = Player.FindByPlayerClient(item.controllable.playerClient);
            bool   result;

            if (player != null)
            {
                BPUseEvent bPUseEvent = new BPUseEvent(bdb);
                if (Hooks.OnBlueprintUse != null)
                {
                    Hooks.OnBlueprintUse(player, bPUseEvent);
                }
                if (!bPUseEvent.Cancel)
                {
                    result = true;
                    return(result);
                }
            }
            result = false;
            return(result);
        }
Exemple #8
0
 public void OnBlueprintUse(Fougerite.Player player, BPUseEvent evt)
 {
     this.Invoke("On_BlueprintUse", new object[] { player, evt });
 }
Exemple #9
0
 public void OnBlueprintUse(Player player, BPUseEvent evt)
 {
     Invoke("On_BlueprintUse", player, evt);
 }