Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.06 KB | None | 0 0
  1.         private void AEPotionDust(RealmTime time, Item item, Position target, ActivateEffect eff)
  2.         {
  3.             var gameData = Program.Resources.GameData;
  4.             var avaliableslot = Inventory.GetAvailableInventorySlot(item);
  5.             var avaliablecontainerslot = containerItem.Inventory.GetAvailableInventorySlot(item);
  6.             ushort itemValue;
  7.             var potionchance = Random.NextDouble();
  8.             if(potionchance <= 0.20)
  9.             {
  10.                 var lifemanapotionchance = Random.Next(0, 2);
  11.                 Console.WriteLine("Life Mana = " + lifemanapotionchance);
  12.                 switch (lifemanapotionchance)
  13.                 {
  14.                     case 0:
  15.                         itemValue = 0xae9; //Potion of Life
  16.                         if (containerItem != null)
  17.                             containerItem.Inventory[avaliablecontainerslot] = gameData.Items[itemValue];
  18.                         else
  19.                             Inventory[avaliableslot] = gameData.Items[itemValue];
  20.                         break;
  21.                     case 1:
  22.                         itemValue = 0xaea; //Potion of Mana
  23.                         if (containerItem != null)
  24.                             containerItem.Inventory[avaliablecontainerslot] = gameData.Items[itemValue];
  25.                         else
  26.                             Inventory[avaliableslot] = gameData.Items[itemValue];
  27.                         break;
  28.                 }
  29.             }
  30.             else
  31.             {
  32.                 var commonpotionchance = Random.Next(0, 6);
  33.                 Console.WriteLine("Common Potion = " + commonpotionchance);
  34.                 switch (commonpotionchance)
  35.                 {
  36.                     case 0:
  37.                         itemValue = 0xa4c; //Potion of Dexterity
  38.                         if (containerItem != null)
  39.                             containerItem.Inventory[avaliablecontainerslot] = gameData.Items[itemValue];
  40.                         else
  41.                             Inventory[avaliableslot] = gameData.Items[itemValue];
  42.                         break;
  43.                     case 1:
  44.                         itemValue = 0xa1f; //Potion of Attack
  45.                         if (containerItem != null)
  46.                             containerItem.Inventory[avaliablecontainerslot] = gameData.Items[itemValue];
  47.                         else
  48.                             Inventory[avaliableslot] = gameData.Items[itemValue];
  49.                         break;
  50.                     case 2:
  51.                         itemValue = 0xa20; //Potion of Defense
  52.                         if (containerItem != null)
  53.                             containerItem.Inventory[avaliablecontainerslot] = gameData.Items[itemValue];
  54.                         else
  55.                             Inventory[avaliableslot] = gameData.Items[itemValue];
  56.                         break;
  57.                     case 3:
  58.                         itemValue = 0xa35; //Potion of Wisdom
  59.                         if (containerItem != null)
  60.                             containerItem.Inventory[avaliablecontainerslot] = gameData.Items[itemValue];
  61.                         else
  62.                             Inventory[avaliableslot] = gameData.Items[itemValue];
  63.                         break;
  64.                     case 4:
  65.                         itemValue = 0xa34; //Potion of Vitality
  66.                         if (containerItem != null)
  67.                             containerItem.Inventory[avaliablecontainerslot] = gameData.Items[itemValue];
  68.                         else
  69.                             Inventory[avaliableslot] = gameData.Items[itemValue];
  70.                         break;
  71.                     case 5:
  72.                         itemValue = 0xa21; //Potion of Speed
  73.                         if (containerItem != null)
  74.                             containerItem.Inventory[avaliablecontainerslot] = gameData.Items[itemValue];
  75.                         else
  76.                             Inventory[avaliableslot] = gameData.Items[itemValue];
  77.                         break;
  78.                 }
  79.             }
  80.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement