Renaming And Target Next
Datum: 27/07/2011 01:40:29
Staženo: 1022x
Popis:
Automatické přejmenování..
Aby bylo funkční, je potřeba změnit název profilu ve scriptu...
Příkazy:
- ,exec kill
- ,renaming
Kód:
using Phoenix;
using Phoenix.WorldData;
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Phoenix.Configuration;
using Phoenix.Communication;
using Scripts.DarkParadise;
namespace Scripts.Renaming
{
public class RenamingAndTargetNext
{
public static bool renamingZapnut;
public static List<Serial> inList = new List<Serial>();
public static List<Serial> prejmenovaniSummoni = new List<Serial>();
public static string[] jmena = new string[] {"jedna", "dva", "tri", "ctyri", "pet", "sest", "sedm", "osm", "devet", "deset" };
public RenamingAndTargetNext()
{
World.CharacterAppeared += new CharacterAppearedEventHandler(renaming_fce);
renamingZapnut = true;
}
[Command]
public void renaming()
{
if (renamingZapnut == true)
{
World.CharacterAppeared += new CharacterAppearedEventHandler(renaming_fce);
renamingZapnut = true;
UO.PrintInformation("Renaming zapnut");
}
else
{
World.CharacterAppeared -= renaming_fce;
renamingZapnut = true;
UO.PrintInformation("Renaming vypnut");
}
}
void renaming_fce(object sender, CharacterAppearedEventArgs e)
{
UOCharacter ch = World.GetCharacter(e.Serial);
if (check_character(ch) && !prejmenovaniSummoni.Contains(ch.Serial) && test_jmena(ch.Name))
{
if (!inList.Contains(e.Serial))
inList.Add(e.Serial);
ch.Changed += new ObjectChangedEventHandler(ch_Changed);
ch.RequestStatus(5000);
inList.Remove(e.Serial);
}
}
void ch_Changed(object sender, ObjectChangedEventArgs e)
{
UOCharacter ch = new UOCharacter(e.Serial);
if (!test_jmena(ch.Name))
{
ch.Changed -= new ObjectChangedEventHandler(ch_Changed);
return;
}
if (ch.Renamable)
{
for (int i = 0; i < 10; i++)
{
if (renaming_fce_check(jmena[i]))
{
ch.Rename(jmena[i]);
UO.PrintObject(ch.Serial, 0x0481, "[ renamed : {0} ]", jmena[i]);
prejmenovaniSummoni.Add(e.Serial);
ch.RequestStatus(5000);
inList.Remove(e.Serial);
ch.Changed -= new ObjectChangedEventHandler(ch_Changed);
return;
}
}
UO.PrintError("Moc summu !");
}
inList.Remove(e.Serial);
ch.Changed -= new ObjectChangedEventHandler(ch_Changed);
}
bool check_character(UOCharacter ch)
{
ushort[] summonGraphic = new ushort[20];
summonGraphic[0] = 0x00D4; // grizzly // RANGER
summonGraphic[1] = 0x00D3; // brown bear
summonGraphic[2] = 0x00E1; // wolf
summonGraphic[3] = 0x0005; // orel
summonGraphic[4] = 0x0015; // giant viper // MAGE
summonGraphic[5] = 0x0030; // giant scorpion
summonGraphic[6] = 0x001C; // giant spider
summonGraphic[7] = 0x000E; // earth elemental
summonGraphic[8] = 0x000D; // air elemental
summonGraphic[9] = 0x003C; // dragon
summonGraphic[10] = 0x003A; // spirit // Clerik
summonGraphic[11] = 0x003A; // spirit
summonGraphic[12] = 0x003A; // spirit
summonGraphic[13] = 0x0018; // liche // Necromancer
summonGraphic[14] = 0x0039; // skeleton sword & shield
summonGraphic[15] = 0x001A; // wraith
summonGraphic[16] = 0x0003; // mummy
summonGraphic[17] = 0x0003; // ghoul
summonGraphic[18] = 0x000D; // death vortex
summonGraphic[19] = 0x0018; // demiliche
ushort[] summonColor = new ushort[20];
summonColor[0] = 0x0712; // grizzly // RANGER
summonColor[1] = 0x0712; // brown bear
summonColor[2] = 0x0712; // wolf
summonColor[3] = 0x0712; // orel
summonColor[4] = 0x0757; // giant viper // MAGE
summonColor[5] = 0x0751; // giant scorpion
summonColor[6] = 0x0751; // giant spider
summonColor[7] = 0x0000; // earth elemental
summonColor[8] = 0x0000; // air elemental
summonColor[9] = 0x0751; // dragon
summonColor[10] = 0x0B87; // angel spirit // Clerik
summonColor[11] = 0x0000; // guardian bear
summonColor[12] = 0x084C; // awaken spirit
summonColor[13] = 0x0835; // liche // Necromancer
summonColor[14] = 0x0835; // skeleton sword & shield
summonColor[15] = 0x0835; // wraith
summonColor[16] = 0x0835; // mummy
summonColor[17] = 0x058D; // ghoul0b77
summonColor[18] = 0x0B77; // death vortex
summonColor[19] = 0x0837; // demiliche
switch (Config.Profile.ProfileName)
{
case "Ranger":
for (int i = 0; i < 4; i++)
{
if (ch.Model == summonGraphic[i] && ch.Color == summonColor[i])
{
return true;
}
}
return false;
case "Mage":
for (int i = 4; i < 10; i++)
{
if (ch.Model == summonGraphic[i] && ch.Color == summonColor[i])
{
return true;
}
}
return false;
case "Cleric":
for (int i = 10; i < 13; i++)
{
if (ch.Model == summonGraphic[i] && ch.Color == summonColor[i])
{
return true;
}
}
return false;
case "Necromancer":
for (int i = 13; i < 20; i++)
{
if (ch.Model == summonGraphic[i] && ch.Color == summonColor[i])
{
return true;
}
}
return false;
default:
return false;
}
}
bool renaming_fce_check(string name)
{
foreach (UOCharacter ch in World.Characters)
{
if (ch.Name == name)
{
return false;
}
}
return true;
}
bool test_jmena(string name)
{
for (int i = 0; i < 10; i++)
{
if (name == jmena[i])
{
return false;
}
}
return true;
}
[Executable]
public void kill()
{
UO.Print(0x0482, "Zamer cil");
UOCharacter target = World.GetCharacter(UIManager.TargetObject());
foreach (UOCharacter sum in World.Characters)
{
if (sum.Renamable)
{
UO.WaitTargetObject(target);
UO.Say("{0} kill", sum.Name);
UO.Wait(990);
}
}
UO.Print(0x0482, "Dokoncen KILL");
}
}
}

