Display
Datum: 20/06/2012 22:38:57
Staženo: 485x
Popis:
Lišta nahoru do Windows okna..
Příkazy:
- ,exec reagentscount
- ,exec potionscount
- ,exec otherscount
Kód:
using System;
using System.Collections.Generic;
using System.Text;
using Phoenix.WorldData;
using Phoenix;
namespace Scripts
{
public class Display
{
private string others = "";
private string potions = "";
private string reagents = "";
private string player = "";
private static Graphic[] reagentsTypes = new Graphic[] { 0x0F7B, 0x0F7A, 0x0F84, 0x0F85, 0x0F86, 0x0F88, 0x0F8C, 0x0F8D, 0x0F87, 0x0F7F, 0x0F7C };
private static string[] reagentsName = new string[] { "bm", "bp", "ga", "gs", "mr", "ns", "sa", "ss", "eon","bl", "br" };
private delegate void loadReagents();
private loadReagents spocitej;
long lastTime = 0;
//public Display()
//{
// lastTime = System.DateTime.Now.Second + (System.DateTime.Now.Minute * 60) + (System.DateTime.Now.Hour * 60 * 60) + (System.DateTime.Now.Day * 60 * 60 * 24) + (System.DateTime.Now.Month * 60 * 60 * 24 * 30);
// this.spocitej += reagentsCount;
// this.spocitej += potionsCount;
// this.spocitej += othersCount;
// if (Core.LoggedIn)
// {
// World.Player.Changed += new ObjectChangedEventHandler(Player_Changed);
// }
// Core.LoginComplete += new EventHandler(Core_LoginComplete);
// Core.Disconnected += new EventHandler(Core_Disconnected);
//}
void Core_Disconnected(object sender, EventArgs e)
{
World.Player.Changed -= new ObjectChangedEventHandler(Player_Changed);
}
void Core_LoginComplete(object sender, EventArgs e)
{
//World.Player.Backpack.Changed += new ObjectChangedEventHandler(Backpack_Changed);
World.Player.Changed += new ObjectChangedEventHandler(Player_Changed);
}
void Player_Changed(object sender, ObjectChangedEventArgs e)
{
player = "";
player = "hp: " + World.Player.Hits + "/" + World.Player.MaxHits + " m: " + World.Player.Mana + "/" + World.Player.MaxMana + " s: " + World.Player.Stamina + "/" + World.Player.MaxStamina + " ar: " + World.Player.Armor + " w: " + World.Player.Weight + "/" + World.Player.MaxWeight + " | ";
if (e.Type == ObjectChangeType.SubItemUpdated)
{
long now = System.DateTime.Now.Second + (System.DateTime.Now.Minute * 60) + (System.DateTime.Now.Hour * 60 * 60) + (System.DateTime.Now.Day * 60 * 60 * 24) + (System.DateTime.Now.Month * 60 * 60 * 24 * 30);
if (lastTime + 1 < now)
{
lastTime = now;
spocitej();
}
}
Client.Text = player + reagents + potions + others;
}
[Executable]
public void reagentsCount()
{
reagents = "";
for (int i = 0; i < reagentsTypes.Length; i++)
{
reagents += reagentsName[i] + ": " + World.Player.Backpack.AllItems.Count(reagentsTypes[i]) + " ";
}
reagents += "| ";
}
[Executable]
public void potionsCount()
{
potions = "";
potions += " gh:" + World.Player.Backpack.AllItems.Count(0x0F0C, 0x0000);
potions += " tmr:" + World.Player.Backpack.AllItems.Count(0x0F09, 0x0003);
potions += " tr:" + World.Player.Backpack.AllItems.Count(0x0F0B, 0x0000);
potions += " gs:" + World.Player.Backpack.AllItems.Count(0x0F09, 0x0000);
potions += " gc:" + World.Player.Backpack.AllItems.Count(0x0F07, 0x0000) + " | ";
}
[Executable]
public void othersCount()
{
others ="";
others += " b: " + World.Player.Backpack.AllItems.Count(0x0E21) + "(" + (World.Player.Backpack.AllItems.Count(0x0E20) + World.Player.Backpack.AllItems.Count(0x0E22)) + ")";
others += " ar:" + World.Player.Backpack.AllItems.Count(0x0F3F);
others += " bl:" + World.Player.Backpack.AllItems.Count(0x1BFB);
}
}
}

