Stránka 1 z 1

Scrolling Combat Text

Napsal: 07.02.2012 12:12:35
od Rob
behem hry to ukazuje nad hlavy statistiku jako u World of Warcraft

Kód: Vybrat vše

/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Scrolling Combat Text
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// ,exec combat_text - pusti script
/////////////////////////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Text;
using Phoenix;
using Phoenix.WorldData;
using System.Linq;
using Phoenix.Communication;
using Phoenix.Runtime;
using Phoenix.Runtime.Reflection;

namespace Phoenix.Scripts
{       
	public class Shokarta_Combat_Text
	{

		[RuntimeObject]
		public void Combat_Text()
		{
			// ZACATEK NASTAVENI
			int pauza = 300 + Core.Latency;

			ushort[][] settings =		// 0 - Nezobrazovat, 1 - Zobrazovat
			{ 
				new ushort[] {1, 1},	// Zmena +STR, Zmena -STR
				new ushort[] {1, 1},	// Zmena +DEX, Zmena -DEX
				new ushort[] {1, 1},	// Zmena +INT, Zmena -INT
				new ushort[] {2},		// O kolik zobrazovat zmenu Armoru (0 - Nezobrazovat)
				new ushort[] {5},		// O kolik zobrazovat zmenu HP (0 - Nezobrazovat)
				new ushort[] {40},		// Pocet u malo zivota (0 - Nezobrazovat, N - U kolika hlasit)
				new ushort[] {30},		// Pocet u malo many (0 - Nezobrazovat, N - U kolika hlasit)
				new ushort[] {30},		// Pocet u malo staminy (0 - Nezobrazovat, N - U kolika hlasit)
				new ushort[] {1},		// Otraven (0 - Nezobrazovat, 1 - Zobrazovat)
				new ushort[] {1},		// Parovan (0 - Nezobrazovat, 1 - Zobrazovat)
				new ushort[] {0},		// Blokovat (0 - Nezobrazovat, 1 - Zobrazovat)
				new ushort[] {0, 0},	// Ty mines (0 - Nezobrazovat, 1 - Zobrazovat), Tebe minou (0 - Nezobrazovat, 1 - Zobrazovat)
				new ushort[] {1},		// Resist (0 - Nezobrazovat, 1 - Zobrazovat)
			};

			string[] settings_hlasky = 
			{
				"LOW HEALTH",
				"LOW MANA",
				"LOW STAMINA",
				"POISONED",
				"PARALYZED",
				"BLOCKED",
				"MISSED",
				"ABSORBED",
				"CURED",
				"DODGED",
			};

			ushort color_damage = 0x0025;
			ushort color_miss = 0x0061;
			ushort color_parry = 0x0004;
			ushort color_heal = 0x0099;
			ushort color_resist = 0x0013;
			ushort color_poisoned = 0x0045;
			ushort color_paralized = 0x0386;
			ushort color_ar_plus = 0x03e9;
			ushort color_ar_minus = 0x03e5;
			ushort color_str_plus = 0x0035;
			ushort color_str_minus = 0x0037;
			ushort color_dex_plus = 0x002a;
			ushort color_dex_minus = 0x002d;
			ushort color_int_plus = 0x0063;
			ushort color_int_minus = 0x0065;
			ushort color_low_hp = 0x0028;
			ushort color_low_mana = 0x0005;
			ushort color_low_stamina = 0x002c;
			// KONEC NASTAVENI

			string prepocet;

			int low_hp_hlasit = 1;
			int low_mana_hlasit = 1;
			int low_stamina_hlasit = 1;

			int str = World.Player.Strenght;
			int dex = World.Player.Dexterity;
			int intl = World.Player.Intelligence;

			int hits = World.Player.Hits;
			int mana = World.Player.Mana;
			int stamina = World.Player.Stamina;

			int ar = World.Player.Armor;

			
			while (!World.Player.Dead)
			{
				// Health
				if (settings[3][0] > 0)
				{
					if (World.Player.Hits > (hits + settings[3][0]))
					{
						prepocet = "+" + (World.Player.Hits - hits) +" Health";
						World.Player.Print(color_heal, prepocet);
					}
					else if (World.Player.Hits < (hits - settings[3][0]))
					{
						// Resist
						if (UO.InJournal("You feel yourself resisting magic") && UO.InJournal("You parry the blow"))
						{
							prepocet = "-" + (hits - World.Player.Hits) +" HP (Resist & Block)";
							World.Player.Print(color_dex_plus, prepocet);	
						}
						else if (UO.InJournal("You feel yourself resisting magic"))
						{
							prepocet = "-" + (hits - World.Player.Hits) +" Health (Resisted)";
							World.Player.Print(color_resist, prepocet);	
						}
						else if (UO.InJournal("You parry the blow"))
						{
							prepocet = "-" + (hits - World.Player.Hits) +" Health (Blocked)";
							World.Player.Print(color_parry, prepocet);	
						}
						else
						{
							prepocet = "-" + (hits - World.Player.Hits) +" Health";
							World.Player.Print(color_damage, prepocet);	
						}
					}
					else if (World.Player.Hits == hits)
					{
						if (UO.InJournal("You feel yourself resisting magic") && (!UO.InJournal("You have been poisoned")))
						{
							if (settings[12][0] > 0)
							{
								World.Player.Print(color_resist, settings_hlasky[7]);
							}
						}
						else if (UO.InJournal("You parry the blow"))
						{
							if (settings[10][0] > 0)
							{
								World.Player.Print(color_parry, settings_hlasky[5]);
							}
						}
					}
				}

				// Strenght
				if (settings[0][0] > 0)
				{
					if (World.Player.Strenght > str)
					{
						prepocet = "+" + (World.Player.Strenght - str) +" Stength (" + World.Player.Strenght +" Max)";
						World.Player.Print(color_str_plus, prepocet);
					}
				}
				if (settings[0][1] > 0)
				{
					if (World.Player.Strenght < (str - 1))
					{
						prepocet = "-" + (str - World.Player.Strenght) +" Stength (" + World.Player.Strenght +" Max)";
						World.Player.Print(color_str_minus, prepocet);						
					}
				}

				// Dexterity
				if (settings[1][0] > 0)
				{
					if (World.Player.Dexterity > dex)
					{
						prepocet = "+" + (World.Player.Dexterity - dex) +" Dexterity (" + World.Player.Dexterity +" Max)";
						World.Player.Print(color_dex_plus, prepocet);
					}
				}
				if (settings[1][1] > 0)
				{
					if (World.Player.Dexterity < (dex - 1))
					{
						prepocet = "-" + (dex - World.Player.Dexterity) +" Dexterity (" + World.Player.Dexterity +" Max)";
						World.Player.Print(color_dex_minus, prepocet);						
					}
				}

				// Intelligence
				if (settings[2][0] > 0)
				{
					if (World.Player.Intelligence > intl)
					{
						prepocet = "+" + (World.Player.Intelligence - intl) +" Intelligence (" + World.Player.Intelligence +" Max)";
						World.Player.Print(color_int_plus, prepocet);
					}
				}
				if (settings[2][1] > 0)
				{
					if (World.Player.Intelligence < (intl - 1))
					{
						prepocet = "-" + (intl - World.Player.Intelligence) +" Intelligence (" + World.Player.Intelligence +" Max)";
						World.Player.Print(color_int_minus, prepocet);						
					}
				}

				// Armor
				if (settings[3][0] > 0)
				{
					if (World.Player.Armor > (ar + settings[3][0]))
					{
						prepocet = "+" + (World.Player.Armor - ar) +" Armor";
						World.Player.Print(color_ar_plus, prepocet);
					}
					if (World.Player.Armor < (ar - settings[3][0]))
					{
						prepocet = "-" + (ar - World.Player.Armor) +" Armor";
						World.Player.Print(color_ar_minus, prepocet);						
					}
				}

				// Low HP
				if (settings[5][0] > 0)
				{
					if ((World.Player.Hits < settings[5][0]) && low_hp_hlasit==1)
					{
						World.Player.Print(color_low_hp, settings_hlasky[0]);
						low_hp_hlasit = 0;
					}
					if ((World.Player.Hits > settings[5][0]) && low_hp_hlasit==0)
					{
						low_hp_hlasit = 1;
					}
				}

				// Low Mana
				if (settings[6][0] > 0)
				{
					if ((World.Player.Mana < settings[6][0]) && low_mana_hlasit==1)
					{
						World.Player.Print(color_low_mana, settings_hlasky[1]);
						low_mana_hlasit = 0;
					}
					if ((World.Player.Mana > settings[6][0]) && low_mana_hlasit==0)
					{
						low_mana_hlasit = 1;
					}
				}

				// Low Stamina
				if (settings[7][0] > 0)
				{
					if ((World.Player.Stamina < settings[7][0]) && low_stamina_hlasit==1)
					{
						World.Player.Print(color_low_stamina, settings_hlasky[2]);
						low_stamina_hlasit = 0;
					}
					if ((World.Player.Stamina > settings[7][0]) && low_stamina_hlasit==0)
					{
						low_stamina_hlasit = 1;
					}
				}

				// Poisoned
				if (settings[8][0] > 0)
				{
					if (UO.InJournal("You have been poisoned"))
					{
							World.Player.Print(color_poisoned, settings_hlasky[3]);
					}
				}

				// Paralized
				if (settings[9][0] > 0)
				{
					if (UO.InJournal("You are frozen and can not move"))
					{
						World.Player.Print(color_paralized, settings_hlasky[4]);
					}
				}

				// Miss
				if (settings[11][0] > 0)
				{
					if (UO.InJournal("You Miss"))
					{
						World.Player.Print(color_miss, settings_hlasky[6]);
					}
				}
				if (settings[11][1] > 0)
				{
					if (UO.InJournal("missed you"))
					{
						World.Player.Print(color_miss, settings_hlasky[9]);
					}
				}
			
				str = World.Player.Strenght;
				dex = World.Player.Dexterity;
				intl = World.Player.Intelligence;

				hits = World.Player.Hits;
				mana = World.Player.Mana;
				stamina = World.Player.Stamina;

				ar = World.Player.Armor;

				UO.DeleteJournal();

				UO.Wait(pauza);
			}
		}
	}
}