Potiont Manager
Datum: 22/11/2014 23:32:28
Staženo: 552x
Popis:
Nalejvani a sosani
Příkazy:
- ,fill "int count"
- ,fill "string type" " int count"
- ,use "string type"
Kód:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Phoenix;
using Phoenix.WorldData;
namespace Scripts
{
public class PotionManager
{
public struct PotionInfo
{
public string name;
public ushort cPotion;
public ushort tPotion;
public ushort cKeg;
public PotionInfo(string name, ushort cPotion, ushort tPotion, ushort cKeg)
{
this.name = name;
this.cPotion = cPotion;
this.tPotion = tPotion;
this.cKeg = cKeg;
}
}
public const ushort EmptyBottle = 0x0F0E;
public const ushort Keg = 0x1843;
private static Dictionary<string, PotionInfo> potions =
new Dictionary<string, PotionInfo>();
public PotionManager()
{
potions.Add("tmr", new PotionInfo("Total Mana Refresh", 0x0003, 0x0F09, 0x0003));
potions.Add("gh", new PotionInfo("Greater Heal", 0x0000, 0x0F0C, 0x08A7));
potions.Add("gs", new PotionInfo("Greater Strength", 0x0000, 0x0F09, 0x0481));
potions.Add("tr", new PotionInfo("Total Refresh", 0x0000, 0x0F0B, 0x014D));
potions.Add("gc", new PotionInfo("Greater Cure", 0x0000, 0x0F07, 0x0842));
potions.Add("shrink", new PotionInfo("Shrink", 0x045E, 0x0F09, 0x0724));
potions.Add("invis", new PotionInfo("Invisibility", 0x0B77, 0x0F09, 0x0B77));
potions.Add("lb", new PotionInfo("Lava Bomb", 0x000E, 0x0F0D, 0x000E));
potions.Add("gb", new PotionInfo("Greater Blood", 0x0025, 0x0F0C, 0x0025));
potions.Add("lp", new PotionInfo("Lesser Poison", 0x0000, 0x0F0A, 0x089F));
}
[Command("use")]
public void UsePotion(string type)
{
type = type.ToLower();
if (!potions.ContainsKey(type))
throw new ScriptErrorException("Neznamy typ potionu.");
Journal.Clear();
if (UO.Count(potions[type].tPotion, potions[type].cPotion) != 0 ||
UO.Count(Keg, potions[type].cKeg) != 0)
{
if (UO.Count(potions[type].tPotion, potions[type].cPotion) > 0)
UO.UseType(potions[type].tPotion, potions[type].cPotion);
else
if (UO.Count(EmptyBottle, 0x0000) > 0 && UO.Count(Keg, potions[type].cKeg) > 0)
{
UO.Warmode(false);
UO.WaitTargetType(EmptyBottle, 0x0000);
UO.UseType(Keg, potions[type].cKeg);
Journal.WaitForText("You put the {0} Potion in your pack.", potions[type].name);
UO.UseType(potions[type].tPotion, potions[type].cPotion);
}
else
throw new ScriptErrorException("Nemas prazdne lahvicky!");
UO.Wait(1000);
if (Journal.Contains("You can't drink another potion yet"))
return;
UO.Print("{0} : {1}.", potions[type].name, UO.Count(potions[type].tPotion, potions[type].cPotion)); ;
UO.Wait(14000);
UO.Print("JESTE 5 SUKUND.");
UO.Wait(5000);
UO.Print("UZ MUZES DALSIHO LAHVACE");
}
else
UO.Print("Nemas {0} potion!", potions[type].name);
}
[Command]
public void Fill(int count)
{
Fill(UIManager.TargetObject(), count);
}
[Command]
public void Fill(string type, int count)
{
if (!potions.ContainsKey(type))
throw new ScriptErrorException("Neznamy typ potionu.");
if (World.Player.Backpack.AllItems.Count(Keg, potions[type].cKeg) > 0)
{
Serial keg = World.Player.Backpack.AllItems.FindType(Keg, potions[type].cKeg).Serial;
Fill(keg, count);
}
else
UO.Print("Nemas kad.");
}
private void Fill(Serial keg, int count)
{
for (int i = 0; i < count; i++)
{
Journal.Clear();
if (UO.Count(EmptyBottle, 0x0000) == 0)
throw new ScriptErrorException("Nemas prazdne lahvicky!");
else
{
UO.Warmode(false);
UO.WaitTargetType(EmptyBottle, 0x0000);
UO.UseObject(keg);
Journal.WaitForText("You put");
UO.Wait(500);
}
}
UO.Print("Done!");
}
#region - Properties -
public static Dictionary<string, PotionInfo> Potions
{
get { return potions; }
}
#endregion
}
}


Discover licensed สล็อตpg casinos offering secure online พีจีสล๊อต slot experiences.