,mapy <tolerance> -tolerance je rozmezí u kterého se dávají k sobě pytlíky podobných souřadnic já dávám 50
třídí mapky podle souřadnic, musíte mít u sebe container package na pytlíky, mapky mějte někde mimo základní batoh, na zemi nebo v truhle, roztřízené mapky taky (takže máte truhlu kde máte pytlíky ve kterých máte mapky stejných souřadnic a pak máte jakékoliv kontejnery s neroztřízenýma mapkama). script nejdříve načte už roztřízené pytlíky a souřadnice a do nich zatřídí nové mapky. Pokud máte mapky nevyluštěné, tak se vám vyluští i zatřídí, přidal jsem tam upravu pro lidi co nemaj cartography ale to nemám na čem vyzkoušet, tak když tak reportněte jestli to jede nebo ne.
Kód: Vybrat vše
using System;
using Phoenix.Communication;
using System.Collections.Generic;
using System.Text;
using Phoenix;
using Phoenix.WorldData;
namespace Phoenix.Scripts.Raziel
{
public class Mapy
{
private const float MapSizeMultiplier = 3f;
private const ushort MapZoom = 720;
class Mapka{
public int x{get; set;}
public int y{get; set;}
public Serial pytel{get; set;}
}
public UOItem pytel=null;
[Command]
public void mapy(int tolerance){
//crafted by Raziel
String text;
UOItem batoh = new UOItem(Aliases.Backpack);
int refx, refy;
bool naslinasiradcove;
bool nacteno=false;
int pocetmapek=0, pocetrozlustenych=0, levelrozlustenych=0;
String pom;
UOItem mapka;
List<Mapka> listmap=new List<Mapka>();
if (UO.Count(0x0E3F)==0){
UO.Print("Nemas container package s pytlikama.");
return;
}
if (UO.Count(0x0E76)>0){
UO.Print("Vyhod vsechny pytliky.");
return;
}
UO.Print("Kde mas rozdelene mapky(taky kam hazet pytliky s mapama)?");
UOItem cilbatoh=new UOItem(UIManager.TargetObject());
do {
UO.Print("Kde jsou mapy?");
pytel=new UOItem(UIManager.TargetObject());
if ((pytel==null ||!pytel.Exist)) {
UO.Print("Mapek bylo celkem: "+pocetmapek);
UO.Print("Rozlustenych mapek bylo celkem: "+pocetrozlustenych);
UO.Print("Level rozlustenych mapek byl celkem: "+levelrozlustenych);
return;
}
if (!nacteno){
nactiRozdeleneMapky(listmap, cilbatoh);
nacteno=true;
}
pytel.Use();
UO.Wait(500);
while (!pytel.Opened)
UO.Wait(100);
do{
UO.DeleteJournal();
naslinasiradcove=false;
mapka=UO.FindType("mapky", 0x14EB, 0x0000, pytel.Serial);
if (mapka==null ||!mapka.Exist)
break;
pocetmapek++;
presunItem(mapka, Aliases.Backpack);
mapka.Use();
while (!UO.InJournal("Map is")&&!UO.InJournal("Rozlustil jsi")&&!UO.InJournal("Chybna mapa")&&!UO.InJournal("Nejsi") )
UO.Wait(500);
if (UO.InJournal("Rozlustil jsi")){
UO.Wait(500);
zvedniLevelRozlustenych(ref levelrozlustenych, ref pocetrozlustenych);
}
if (UO.InJournal("Nejsi")){
presunItem(mapka, cilbatoh);
continue;
}
if (!UO.InJournal("Map is")){
UO.DeleteJournal();
UO.Wait(100);
mapka=UO.FindType("mapky", 0x14EB, 0x0000, Aliases.Backpack);
mapka.Use();
while (!UO.InJournal("Map is")&&!UO.InJournal("Rozlustil jsi")&&!UO.InJournal("Chybna mapa")&&!UO.InJournal("Nejsi") )
UO.Wait(500);
}
if (UO.InJournal("Rozlustil jsi")){
UO.Wait(100);
zvedniLevelRozlustenych(ref levelrozlustenych, ref pocetrozlustenych);
}
if (UO.InJournal("Nejsi")){
presunItem(mapka, cilbatoh);
continue;
}
if (!UO.InJournal("Map is")){
UO.DeleteJournal();
mapka=UO.FindType("mapky", 0x14EB, 0x0000, Aliases.Backpack);
mapka.Use();
while (!UO.InJournal("Map is")&&!UO.InJournal("Rozlustil jsi")&&!UO.InJournal("Chybna mapa")&&!UO.InJournal("Nejsi") )
UO.Wait(500);
if (UO.InJournal("Nejsi")){
presunItem(mapka, cilbatoh);
continue;
}
if (UO.InJournal("Chybna mapa")) {
UO.Wait(500);
mapka=UO.FindType("mapky", 0x14EB, 0x0000, Aliases.Backpack);
mapka.Use();
}
if (UO.InJournal("Nejsi")){
presunItem(mapka, cilbatoh);
continue;
}
if (!UO.InJournal("Map is")){
UO.DeleteJournal();
mapka.Use();
}
}
Journal.WaitForText("Map is");
text=Journal.GetLine(Journal.Find("Map is")).Text;
pom=text.Substring(10);
String[] casti=pom.Split(',');
refx= Int32.Parse(casti[0]);
refy=Int32.Parse(casti[1]);
foreach (Mapka m in listmap){
if (((refx>=(m.x-tolerance))&&(refx<=(m.x+tolerance))) &&
((refy>=(m.y-tolerance))&&(refy<=(m.y+tolerance)))) {
UO.Print("vidite to ... jsou stejne");
presunItem(mapka, m.pytel);
naslinasiradcove=true;
break;
}
}
if (!naslinasiradcove) {
UO.Print("nenasli...");
UO.UseType(0x0E3F);
UO.WaitTargetSelf();
UO.Wait(500);
Journal.WaitForText("in your pack");
Mapka novamapka=new Mapka();
novamapka.x=refx;
novamapka.y=refy;
UO.Print("souradnice "+novamapka.x+" "+novamapka.y);
foreach (UOItem item in batoh.AllItems){
if ((item.Graphic==0x0E76)){
item.Use();
UO.Wait(500);
while (!item.Opened)
UO.Wait(100);
if (item.AllItems.CountItems()==0){
novamapka.pytel=item.Serial;
break;
}
}
}
presunItem(mapka, novamapka.pytel);
presunItem(new UOItem(novamapka.pytel), cilbatoh);
listmap.Add(novamapka);
}
UO.Wait(500);
}while (mapka!=null);
}while (mapka!=null);
}
private void presunItem(UOItem item, Serial kam)
{
Serial s=item.Container;
UO.MoveItem(item.Serial, 0, kam);
UO.Wait(500);
while (item.Container==s)
UO.Wait(100);
}
private void zvedniLevelRozlustenych(ref int levelrozlustenych, ref int pocetrozlustenych)
{
pocetrozlustenych++;
if (UO.InJournal("Level 1"))
levelrozlustenych+=1;
if (UO.InJournal("Level 2"))
levelrozlustenych+=2;
if (UO.InJournal("Level 3"))
levelrozlustenych+=3;
if (UO.InJournal("Level 4"))
levelrozlustenych+=4;
if (UO.InJournal("Level 5"))
levelrozlustenych+=5;
}
private void nactiRozdeleneMapky(List<Mapka> listmap, UOItem cilbatoh){
int pocitadlo=0;
cilbatoh.Use();
UO.Wait(500);
while (!cilbatoh.Opened)
UO.Wait(100);
foreach (UOItem item in cilbatoh.AllItems) {
if ((item.Graphic==0x0E76)){//je to pytlik
UO.DeleteJournal();
item.Use();
UO.Wait(500);
while (!item.Opened)
UO.Wait(100);
UOItem mapka=item.AllItems.FindType(0x14EB);
if (mapka==null ||!mapka.Exist){
UO.Wait(500);
//TODO prazdny pytlik do konteineru
UO.MoveItem(item.Serial, 0, UO.Backpack);
UO.Wait(500);
continue;
}
UO.MoveItem(mapka.Serial, 0, Aliases.Backpack);
UO.Wait(500);
mapka.Use();
UO.Wait(500);
if (UO.InJournal("Chybna mapa")) {
UO.Wait(500);
do {
mapka=item.AllItems.FindType(0x14EB);
if (mapka==null || !mapka.Exist) {
break;
}
UO.MoveItem(mapka.Serial, 0, pytel.Serial);
UO.Wait(500);
}
while (true);
UO.MoveItem(item.Serial, 0, UO.Backpack);
UO.Wait(500);
continue;
}
Journal.WaitForText("Map is");
String text=Journal.GetLine(Journal.Find("Map is")).Text;
Mapka novamapka=new Mapka();
String pom=text.Substring(10);
String[] casti=pom.Split(',');
novamapka.x= Int32.Parse(casti[0]);
novamapka.y=Int32.Parse(casti[1]);
novamapka.pytel=item.Serial;
listmap.Add(novamapka);
UO.MoveItem(mapka.Serial, 0, novamapka.pytel);
UO.Wait(500);
pocitadlo++;
if (pocitadlo==10){
cilbatoh.Use();
UO.Wait(500);
pocitadlo=0;
}
}
}
}
[Command]
public void Track()
{
Track(false, 0, 0);
}
[Command]
public void Track(ushort x, ushort y)
{
Track(true, x, y);
}
private void Track(bool enable, ushort x, ushort y)
{
PacketWriter writer = new PacketWriter(0xba);
writer.Write(enable ? (byte)0x1 : (byte)0x0);
writer.Write(x);
writer.Write(y);
Core.SendToClient(writer.GetBytes());
}
[ServerMessageHandler(0x90)]
public CallbackResult OnMapInfo(byte[] data, CallbackResult prevResult)
{
PacketReader reader = new PacketReader(data);
reader.Skip(1);
uint serial = reader.ReadUInt32();
ushort gump = reader.ReadUInt16();
ushort ux = reader.ReadUInt16();
ushort uy = reader.ReadUInt16();
ushort lx = reader.ReadUInt16();
ushort ly = reader.ReadUInt16();
ushort width = reader.ReadUInt16();
ushort height = reader.ReadUInt16();
ushort x = (ushort)(ux + 180 * (lx - ux > 361 ? -1 : 1));
ushort y = (ushort)(uy + 180 * (ly - uy > 361 ? -1 : 1));
UO.PrintInformation("Map is at {0},{1}", x, y);
Track(x, y);
PacketWriter writer = new PacketWriter(0x90);
writer.Write(serial);
writer.Write(gump);
writer.Write((ushort)(x - MapZoom));
writer.Write((ushort)(y - MapZoom));
writer.Write((ushort)(x + MapZoom));
writer.Write((ushort)(y + MapZoom));
writer.Write((ushort)(width * MapSizeMultiplier));
writer.Write((ushort)(height * MapSizeMultiplier));
Core.SendToClient(writer.GetBytes());
return CallbackResult.Sent;
}
[ServerMessageHandler(0x56)]
public CallbackResult OnPinInfo(byte[] data, CallbackResult prevResult)
{
if (data[5] > 4)
return prevResult;
ushort x = ByteConverter.BigEndian.ToUInt16(data, 7);
ushort y = ByteConverter.BigEndian.ToUInt16(data, 9);
Array.Copy(ByteConverter.BigEndian.GetBytes((ushort)(x * MapSizeMultiplier)), 0, data, 7, 2);
Array.Copy(ByteConverter.BigEndian.GetBytes((ushort)(y * MapSizeMultiplier)), 0, data, 9, 2);
return prevResult;
}
[ClientMessageHandler(0x56)]
public CallbackResult OnPinAction(byte[] data, CallbackResult prevResult)
{
if (data[5] > 4)
return prevResult;
ushort x = ByteConverter.BigEndian.ToUInt16(data, 7);
ushort y = ByteConverter.BigEndian.ToUInt16(data, 9);
Array.Copy(ByteConverter.BigEndian.GetBytes((ushort)(x / MapSizeMultiplier)), 0, data, 7, 2);
Array.Copy(ByteConverter.BigEndian.GetBytes((ushort)(y / MapSizeMultiplier)), 0, data, 9, 2);
return prevResult;
}
}
}