المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : مشكله رخمه في الوحوش الكبيره


AliNasser
2019-08-27, 08:32 PM
انا نفلت الوحوش من مكانها الاصلي وخلتها تطلع في المدن من خلال كلاس world

المشكله ان كل لما الوحوش تتقتل زي الدراجون او البانشي بتطلع تاني في نفس اللحظه مهما كانت عدد المرات التقتلت فيها

المشكله دي قبلتني لغايت دلوقتي في سورس فايتر وسورس خالد .......

محمد ياسر
2019-08-27, 08:33 PM
الوحوش مش بتتحط في world

Hassan Emprator
2019-08-27, 08:37 PM
حبي الوحوش مش بطلع من world عا فكهر

بتحركه بتخش النافي كات وبتحث عن ايدي الوحش بقا في الفايل دا

monsterSpwan هتلاقي فيه
الاماكت كلها بي الايدي

طيب عايز تنقل

bound.x دي معناها الي هوا x
bound.y معناها y

تعديل قصدك wold دي معناها انك عدلت ساعات الوحش لما بيطلع ودا مش هيفيدك في حاجه غير ساعت الطلوع بتاعه بس

لاكن تنقل زي ما انا قولتك فوق

Tefa
2019-08-27, 08:55 PM
وريني الكود الي انته بتطلع الوحوش بيه

AliNasser
2019-08-27, 09:11 PM
#region SnowBanshee
if (DateTime.Now.Minute == 20 && DateTime.Now.Second == 10)
{
ushort x = 0, y = 0;
ushort MapID = 1015;
y = 572;
x = 806;
uint id = 4171;
string name = "SnowBanshee";
if (Database.DMaps.LoadMap(MapID))
{
if (Program.SnowBa)
{
if (Kernel.Maps.ContainsKey(MapID))
{
var Map = Kernel.Maps[MapID];
if (Database.MonsterInformation.MonsterInformations.C ontainsKey(id))
{
Database.MonsterInformation mt = Database.MonsterInformation.MonsterInformations[id];
mt.BoundX = x;
Program.SnowBa = false;
mt.BoundY = y;
Entity entity = new Entity(EntityFlag.Monster, false);
entity.MapObjType = MapObjectType.Monster;
entity.MonsterInfo = mt.Copy();
entity.MonsterInfo.Owner = entity;
entity.Name = mt.Name;
entity.MinAttack = mt.MinAttack;
entity.MaxAttack = entity.MagicAttack = mt.MaxAttack;
entity.Hitpoints = entity.MaxHitpoints = mt.Hitpoints;
entity.Defence = mt.Defence;
entity.Body = mt.Mesh;
entity.Level = mt.Level;
entity.UID = Map.EntityUIDCounter.Next;
entity.MapID = MapID;
entity.X = x;
entity.Boss = 1;
entity.Y = y;
if (x == 0 || y == 0)
{
var cord = Map.RandomCoordinates();
entity.X = cord.Item1;
entity.Y = cord.Item2;
do
{
cord = Map.RandomCoordinates();
entity.X = cord.Item1;
entity.Y = cord.Item2;
}
while (!Map.Floor[entity.X, entity.Y, MapObjectType.Monster]);
}

Map.AddEntity(entity);
Network.GamePackets._String stringPacket =
new Network.GamePackets._String(true);
stringPacket.UID = entity.UID;
stringPacket.Type = Network.GamePackets._String.Effect;
stringPacket.Texts.Add("MBStandard");
Data data = new Data(true);
data.UID = entity.UID;
data.ID = Network.GamePackets.Data.AddEntity;
data.wParam1 = entity.X;
data.wParam2 = entity.Y;
foreach (Client.GameState clllient in Program.Values)
{
if (clllient.Map.ID == entity.MapID)
{
if (Kernel.GetDistance(clllient.Entity.X, clllient.Entity.Y, entity.X, entity.Y) <
Constants.nScreenDistance)
{
entity.SendSpawn(clllient, false);
clllient.Send(stringPacket);
clllient.Send(data);
if (entity.MaxHitpoints > 65535)
{
Update upd = new Update(true) { UID = entity.UID };
upd.Append(Update.MaxHitpoints, entity.MaxHitpoints);
upd.Append(Update.Hitpoints, entity.Hitpoints);
clllient.Send(upd);
}

}
}
}
foreach (var client10 in Program.Values)
{
client10.Entity.SendSysMessage(name + " has appeared. Hurry and go defeat the beast!");
client10.MessageBox("Hourly:" + name + " has appeared Would you Want to Kill-Monster? Prize: 50.000 cps & 1000 Treasury Points , Soul Or Materials",
(p) => { p.Entity.Teleport(MapID, x, y); }, null, 20);
}
}
}
}
}
}
#endregion

AliNasser
2019-08-27, 09:12 PM
اوك بس انا هجيب ايدي الوحوش منين انا بجيبه من monsterinfo
وبدور عليه في monsterspawns مش لاقيه ؟

حتي ايدي المابه القديمه بتاعته 39984 بحثت عليها في الملف ملقتهاش

علي فكره المشكله دي مش موجوده في كل الوحوش

الاسبوك مثلا بيموت عادي وبيطلعش تاني

AliNasser
2019-08-27, 09:49 PM
دا كلاس ماب شاكك ان المشكله منه


using System;
using System.IO;
using System.Drawing;
using System.Threading;
using System.Collections.Generic;
using KhaledMohamed.Interfaces;
using System.Text;
using System.Linq;
using KhaledMohamed.Network.GamePackets;
using System.Threading.Generic;
using KhaledMohamed.Client;
using System.Collections.Concurrent;
using KhaledMohamed.Database;

namespace KhaledMohamed.Game
{
public class Map
{
public Dictionary<uint, WindWalker.ThunderCloud> Clouds = new Dictionary<uint, WindWalker.ThunderCloud>();
public DMapPortal[] portals;
public SafeDictionary<uint, Entity> Companions;
[System.Runtime.InteropServices.StructLayout(System .Runtime.InteropServices.LayoutKind.Sequential)]
public struct DMapPortal
{
private ushort xCord;
private ushort yCord;
public ushort XCord
{
get
{
return this.xCord;
}
set
{
this.xCord = value;
}
}
public ushort YCord
{
get
{
return this.yCord;
}
set
{
this.yCord = value;
}
}
}
public void AddCloud(WindWalker.ThunderCloud entity)
{
try
{
if (!this.Clouds.ContainsKey(entity.UID))
this.Clouds.Add(entity.UID, entity);

}
catch (Exception e)
{
Console.WriteLine(e);
}
}

public void PopulatePortals(uint amount)
{
this.portals = new DMapPortal[amount];
}
public void SetPortal(int Position, DMapPortal portal)
{
this.portals[Position] = portal;
}

public static Counter DynamicIDs = new KhaledMohamed.Counter(11000)
{
Finish =
0
};

public static Enums.ConquerAngle[] Angles = new Enums.ConquerAngle[] {
Enums.ConquerAngle.SouthWest,
Enums.ConquerAngle.West,
Enums.ConquerAngle.NorthWest,
Enums.ConquerAngle.North,
Enums.ConquerAngle.NorthEast,
Enums.ConquerAngle.East,
Enums.ConquerAngle.SouthEast,
Enums.ConquerAngle.South };
public static Floor ArenaBaseFloor = null;
public Counter EntityUIDCounter = new KhaledMohamed.Counter(400000);
public Counter EntityUIDCounter2 = new KhaledMohamed.Counter(100000);
public Counter CloneCounter = new KhaledMohamed.Counter(700000);
public List<Zoning.Zone> Zones = new List<Zoning.Zone>();
public ushort ID;
public ushort BaseID;
public bool WasPKFree = false;
public Floor Floor;
public string Path;
public bool IsDynamic()
{
return BaseID != ID;
}
public SafeDictionary<uint, Entity> Entities;
public SafeDictionary<uint, Entity> AIs;
// public SafeDictionary<uint, Entity> Companions;
public Dictionary<uint, INpc> Npcs;
public Dictionary<uint, INpc> Statues = new Dictionary<uint, INpc>();
public Dictionary<uint, INpc> TempNpcs = new Dictionary<uint, INpc>();
// public Dictionary<uint, SobNpcSpawn> Furniture = new Dictionary<uint, SobNpcSpawn>();
public ConcurrentDictionary<uint, FloorItem> FloorItems;
public void AddPole(INpc npc)
{
Npcs[npc.UID] = npc;
Floor[npc.X, npc.Y, MapObjectType.InvalidCast, npc] = false;
}
public void AddMonesterTimer()
{
Timer = MonsterTimers.Add(this);
}
public void RemovePole(INpc npc)
{
Npcs.Remove(npc.UID);
Floor[npc.X, npc.Y, MapObjectType.InvalidCast, null] = true;
}
public void AddNpc(INpc npc, bool addquery = false)
{
if (Npcs.ContainsKey(npc.UID) == false || addquery)
{
if (!addquery)
Npcs.Add(npc.UID, npc);
#region Setting the near coords invalid to avoid unpickable items.
Floor[npc.X, npc.Y, MapObjectType.InvalidCast, npc] = false;
if (npc.Mesh / 10 != 108 && (byte)npc.Type < 10)
{
ushort X = npc.X, Y = npc.Y;
foreach (Enums.ConquerAngle angle in Angles)
{
ushort xX = X, yY = Y;
UpdateCoordonatesForAngle(ref xX, ref yY, angle);
Floor[xX, yY, MapObjectType.InvalidCast, null] = false;
}
}
#endregion
}
}
public void SpawnGoldBox(Client.GameState client, ushort ID, ushort x, ushort y)
{

MonsterInformation mt;
MonsterInformation.MonsterInformations.TryGetValue (7562, out mt);
if (mt == null) return;
mt.IsRespawnAble = false;
for (var i = 0; i < 1; i++)
{
var entity = new Entity(EntityFlag.Monster, false)
{
MapObjType = MapObjectType.Monster,
MonsterInfo = mt.Copy()
};
entity.MonsterInfo.Owner = entity;
entity.Name = string.Intern(mt.Name);
entity.MinAttack = mt.MinAttack;
entity.MaxAttack = entity.MagicAttack = mt.MaxAttack;
entity.Hitpoints = entity.MaxHitpoints = mt.Hitpoints;
entity.Body = mt.Mesh;
entity.Level = mt.Level;
entity.MapID = 3846;
entity.SendUpdates = true;
entity.UID = Kernel.Maps[3846].EntityUIDCounter.Next;
entity.X = (ushort)x;
entity.Y = (ushort)y;
Kernel.Maps[3846].AddEntity(entity);
}

}
public void AddEntity(Entity entity)
{
if (entity.UID < 800000 || entity.Body == 1003)
{
if (Entities.ContainsKey(entity.UID) == false)
{
Entities.Add(entity.UID, entity);
Floor[entity.X, entity.Y, MapObjectType.Monster, entity] = false;
}
}
}
public void AddAI(Entity entity)
{
if (!this.AIs.ContainsKey(entity.UID))
{
this.AIs.Add(entity.UID, entity);
this.Floor[entity.X, entity.Y, MapObjectType.Entity, entity] = false;
}
else
{
this.RemoveEntity(entity);
this.AIs.Add(entity.UID, entity);
this.Floor[entity.X, entity.Y, MapObjectType.Entity, entity] = false;
}
}
public void RemoveAI(Entity entity)
{
if (this.AIs.ContainsKey(entity.UID))
{
this.AIs.Remove(entity.UID);
this.Floor[entity.X, entity.Y, MapObjectType.Entity, entity] = true;
}
}
public void RemoveEntity(Entity entity)
{
if (Entities.ContainsKey(entity.UID) == true)
{
Entities.Remove(entity.UID);
Floor[entity.X, entity.Y, MapObjectType.Monster, entity] = true;
}
//if (Companions.ContainsKey(entity.UID) == true)
//{
// Companions.Remove(entity.UID);
// Floor[entity.X, entity.Y, MapObjectType.Monster, entity] = true;
//}
}
public void AddFloorItem(Network.GamePackets.FloorItem floorItem)
{
FloorItems.Add(floorItem.UID, floorItem);
Floor[floorItem.X, floorItem.Y, MapObjectType.Item, floorItem] = false;
}
public void RemoveFloorItem(Network.GamePackets.FloorItem floorItem)
{
FloorItems.Remove(floorItem.UID);
Floor[floorItem.X, floorItem.Y, MapObjectType.Item, floorItem] = true;
}

public bool SelectCoordonates(ref ushort X, ref ushort Y)
{
if (Floor[X, Y, MapObjectType.Item, null])
{
bool can = true;
if (Zones.Count != 0)
{
foreach (Zoning.Zone z in Zones)
{
if (z.IsPartOfRectangle(new Point() { X = X, Y = Y }))
{
can = false;
break;
}
}
}
if (can)
return true;
}

foreach (Enums.ConquerAngle angle in Angles)
{
ushort xX = X, yY = Y;
UpdateCoordonatesForAngle(ref xX, ref yY, angle);
if (Floor[xX, yY, MapObjectType.Item, null])
{
if (Zones.Count != 0)
{
bool can = true;
foreach (Zoning.Zone z in Zones)
{
if (z.IsPartOfRectangle(new Point() { X = xX, Y = yY })) { can = false; break; }
}
if (!can)
continue;
}
X = xX;
Y = yY;
return true;
}
}
return false;
}
public static void UpdateCoordonatesForAngle(ref ushort X, ref ushort Y, Enums.ConquerAngle angle)
{
sbyte xi = 0, yi = 0;
switch (angle)
{
case Enums.ConquerAngle.North: xi = -1; yi = -1; break;
case Enums.ConquerAngle.South: xi = 1; yi = 1; break;
case Enums.ConquerAngle.East: xi = 1; yi = -1; break;
case Enums.ConquerAngle.West: xi = -1; yi = 1; break;
case Enums.ConquerAngle.NorthWest: xi = -1; break;
case Enums.ConquerAngle.SouthWest: yi = 1; break;
case Enums.ConquerAngle.NorthEast: yi = -1; break;
case Enums.ConquerAngle.SouthEast: xi = 1; break;
}
X = (ushort)(X + xi);
Y = (ushort)(Y + yi);
}

public static void Pushback(ref ushort x, ref ushort y, Enums.ConquerAngle angle, int paces)
{
sbyte xi = 0, yi = 0;
for (int i = 0; i < paces; i++)
{
switch (angle)
{
case Enums.ConquerAngle.North: xi = -1; yi = -1; break;
case Enums.ConquerAngle.South: xi = 1; yi = 1; break;
case Enums.ConquerAngle.East: xi = 1; yi = -1; break;
case Enums.ConquerAngle.West: xi = -1; yi = 1; break;
case Enums.ConquerAngle.NorthWest: xi = -1; break;
case Enums.ConquerAngle.SouthWest: yi = 1; break;
case Enums.ConquerAngle.NorthEast: yi = -1; break;
case Enums.ConquerAngle.SouthEast: xi = 1; break;
}
x = (ushort)(x + xi);
y = (ushort)(y + yi);
}
}
#region Scenes
private SceneFile[] Scenes;
private static string NTString(string value)
{
value = value.Remove(value.IndexOf("\0"));
return value;
}
private SceneFile CreateSceneFile(BinaryReader Reader)
{
SceneFile file = new SceneFile();
file.SceneFileName = NTString(Program.Encoding.GetString(Reader.ReadByt es(260)));
file.Location = new Point(Reader.ReadInt32(), Reader.ReadInt32());
using (BinaryReader reader = new BinaryReader(new FileStream(Constants.DataHolderPath + file.SceneFileName, FileMode.Open)))
{
ScenePart[] partArray = new ScenePart[reader.ReadInt32()];
for (int i = 0; i < partArray.Length; i++)
{
reader.BaseStream.Seek(0x14cL, SeekOrigin.Current);
partArray[i].Size = new Size(reader.ReadInt32(), reader.ReadInt32());
reader.BaseStream.Seek(4L, SeekOrigin.Current);
partArray[i].StartPosition = new Point(reader.ReadInt32(), reader.ReadInt32());
reader.BaseStream.Seek(4L, SeekOrigin.Current);
partArray[i].NoAccess = new bool[partArray[i].Size.Width, partArray[i].Size.Height];
for (int j = 0; j < partArray[i].Size.Height; j++)
{
for (int k = 0; k < partArray[i].Size.Width; k++)
{
partArray[i].NoAccess[k, j] = reader.ReadInt32() == 0;
reader.BaseStream.Seek(8L, SeekOrigin.Current);
}
}
}
file.Parts = partArray;
}
return file;
}
public struct SceneFile
{
public string SceneFileName
{
get;
set;
}
public Point Location
{
get;
set;
}
public ScenePart[] Parts
{
get;
set;
}
}
public struct ScenePart
{
public string Animation;
public string PartFile;
public Point Offset;
public int aniInterval;
public System.Drawing.Size Size;
public int Thickness;
public Point StartPosition;
public bool[,] NoAccess;
}
#endregion

public Map(ushort id, string path)
{
if (!Kernel.Maps.ContainsKey(id))
Kernel.Maps.Add(id, this);
Npcs = new Dictionary<uint, INpc>();
Entities = new SafeDictionary<uint, Entity>();
AIs = new SafeDictionary<uint, Entity>();
FloorItems = new ConcurrentDictionary<uint, FloorItem>();
Floor = new Floor(0, 0, id);
// Companions = new SafeDictionary<uint, Entity>();
ID = id;
BaseID = id;
if (path == "") path = Database.DMaps.MapPaths[id];
Path = path;
#region Loading floor.
if (File.Exists(Constants.DMapsPath + "\\maps\\" + id.ToString() + ".map"))
{
// Console.WriteLine("Loading " + ID + " DMap : maps\\" + id.ToString() + ".map");
byte[] buff = File.ReadAllBytes(Constants.DMapsPath + "\\maps\\" + id.ToString() + ".map");
MemoryStream FS = new MemoryStream(buff);
BinaryReader BR = new BinaryReader(FS);
int Width = BR.ReadInt32();
int Height = BR.ReadInt32();
Floor = new Game.Floor(Width, Height, ID);
if (id == 700)
ArenaBaseFloor = new Game.Floor(Width, Height, ID);
for (ushort y = 0; y < Height; y = (ushort)(y + 1))
{
for (ushort x = 0; x < Width; x = (ushort)(x + 1))
{
bool walkable = !(BR.ReadByte() == 1 ? true : false);
Floor[x, y, MapObjectType.InvalidCast, null] = walkable;
if (id == 700)
ArenaBaseFloor[x, y, MapObjectType.InvalidCast, null] = walkable;
}
}

BR.Close();
FS.Close();
}
else
{
if (File.Exists(Constants.DMapsPath + Path))
{
// Console.WriteLine("Loading " + ID + " DMap : " + Path);
byte[] buff = File.ReadAllBytes(Constants.DMapsPath + Path);
MemoryStream FS = new MemoryStream(buff);
BinaryReader BR = new BinaryReader(FS);
BR.ReadBytes(268);
int Width = BR.ReadInt32();
int Height = BR.ReadInt32();
Floor = new Game.Floor(Width, Height, ID);
if (id == 700)
ArenaBaseFloor = new Game.Floor(Width, Height, ID);
for (ushort y = 0; y < Height; y = (ushort)(y + 1))
{
for (ushort x = 0; x < Width; x = (ushort)(x + 1))
{
bool walkable = !Convert.ToBoolean(BR.ReadUInt16());
Floor[x, y, MapObjectType.InvalidCast, null] = walkable;
if (id == 700)
ArenaBaseFloor[x, y, MapObjectType.InvalidCast, null] = walkable;
BR.BaseStream.Seek(4L, SeekOrigin.Current);
}
BR.BaseStream.Seek(4L, SeekOrigin.Current);
}
uint amount = BR.ReadUInt32();
PopulatePortals(amount);
for (ushort j = 0; j < amount; j = (ushort)(j + 1))
{
DMapPortal portal = new DMapPortal
{
XCord = (ushort)BR.ReadUInt32(),
YCord = (ushort)BR.ReadUInt32()
};
SetPortal(j, portal);
BR.BaseStream.Seek(4L, SeekOrigin.Current);
}
// BR.BaseStream.Seek(amount * 12, SeekOrigin.Current);
LoadMapObjects(BR);
MergeSceneToTextureArea();
BR.Close();
FS.Close();
SaveMap();
SavePortals();
}
}
#endregion
LoadNpcs();
LoadZones();
LoadMonsters();
LoadPortals();

}
public Map(ushort id, ushort baseid, string path)
{
if (!Kernel.Maps.ContainsKey(id))
Kernel.Maps.Add(id, this);
else
Kernel.Maps[id] = this;
Npcs = new Dictionary<uint, INpc>();
Entities = new SafeDictionary<uint, Entity>();
// Companions = new SafeDictionary<uint, Entity>();
FloorItems = new ConcurrentDictionary<uint, FloorItem>();
ID = id;
BaseID = baseid;
Path = path;
if (String.IsNullOrEmpty(path))
Path = path = Database.DMaps.MapPaths[baseid];
Floor = new Floor(0, 0, id);

#region Loading floor.
if (id != baseid && baseid == 700 && ArenaBaseFloor != null)
{
Floor = new Game.Floor(ArenaBaseFloor.Bounds.Width, ArenaBaseFloor.Bounds.Height, ID);
for (ushort y = 0; y < ArenaBaseFloor.Bounds.Height; y = (ushort)(y + 1))
{
for (ushort x = 0; x < ArenaBaseFloor.Bounds.Width; x = (ushort)(x + 1))
{
Floor[x, y, MapObjectType.InvalidCast, null] = !ArenaBaseFloor[x, y, MapObjectType.InvalidCast, null];
}
}
}
else
{
if (File.Exists(Constants.DMapsPath + "\\maps\\" + baseid.ToString() + ".map"))
{
// Console.WriteLine("Loading " + ID + " DMap : maps\\" + id.ToString() + ".map");
byte[] buff = File.ReadAllBytes(Constants.DMapsPath + "\\maps\\" + baseid.ToString() + ".map");
MemoryStream FS = new MemoryStream(buff);
BinaryReader BR = new BinaryReader(FS);
int Width = BR.ReadInt32();
int Height = BR.ReadInt32();

Floor = new Game.Floor(Width, Height, ID);

for (ushort y = 0; y < Height; y = (ushort)(y + 1))
{
for (ushort x = 0; x < Width; x = (ushort)(x + 1))
{
Floor[x, y, MapObjectType.InvalidCast, null] = !(BR.ReadByte() == 1 ? true : false);
}
}
BR.Close();
FS.Close();
}
else
{
if (File.Exists(Constants.DMapsPath + Path))
{
// Console.WriteLine("Loading "+ID+" DMap : " + Path);
FileStream FS = new FileStream(Constants.DMapsPath + Path, FileMode.Open);
BinaryReader BR = new BinaryReader(FS);
BR.ReadBytes(268);
int Width = BR.ReadInt32();
int Height = BR.ReadInt32();

Floor = new Game.Floor(Width, Height, ID);

for (ushort y = 0; y < Height; y = (ushort)(y + 1))
{
for (ushort x = 0; x < Width; x = (ushort)(x + 1))
{
Floor[x, y, MapObjectType.InvalidCast, null] = !Convert.ToBoolean(BR.ReadUInt16());

BR.BaseStream.Seek(4L, SeekOrigin.Current);
}
BR.BaseStream.Seek(4L, SeekOrigin.Current);
}
uint amount = BR.ReadUInt32();
PopulatePortals(amount);
for (ushort j = 0; j < amount; j = (ushort)(j + 1))
{
DMapPortal portal = new DMapPortal
{
XCord = (ushort)BR.ReadUInt32(),
YCord = (ushort)BR.ReadUInt32()
};
SetPortal(j, portal);
BR.BaseStream.Seek(4L, SeekOrigin.Current);
}
// BR.BaseStream.Seek(amount * 12, SeekOrigin.Current);

int num = BR.ReadInt32();
List<SceneFile> list = new List<SceneFile>();
for (int i = 0; i < num; i++)
{
switch (BR.ReadInt32())
{
case 10:
BR.BaseStream.Seek(0x48L, SeekOrigin.Current);
break;

case 15:
BR.BaseStream.Seek(0x114L, SeekOrigin.Current);
break;

case 1:
list.Add(this.CreateSceneFile(BR));
break;

case 4:
BR.BaseStream.Seek(0x1a0L, SeekOrigin.Current);
break;
}
}
Scenes = list.ToArray();

for (int i = 0; i < Scenes.Length; i++)
{
foreach (ScenePart part in Scenes[i].Parts)
{
for (int j = 0; j < part.Size.Width; j++)
{
for (int k = 0; k < part.Size.Height; k++)
{
Point point = new Point();
point.X = ((Scenes[i].Location.X + part.StartPosition.X) + j) - part.Size.Width;
point.Y = ((Scenes[i].Location.Y + part.StartPosition.Y) + k) - part.Size.Height;
Floor[(ushort)point.X, (ushort)point.Y, MapObjectType.InvalidCast, null] = part.NoAccess[j, k];
}
}
}
}

BR.Close();
FS.Close();
SaveMap();
SavePortals();
}
}
}
#endregion
LoadNpcs();
LoadZones();
LoadMonsters();
LoadPortals();


}

private void MergeSceneToTextureArea()
{
for (int i = 0; i < Scenes.Length; i++)
{
if (Scenes[i].Parts == null) return;
foreach (ScenePart part in Scenes[i].Parts)
{
for (int j = 0; j < part.Size.Width; j++)
{
for (int k = 0; k < part.Size.Height; k++)
{
Point point = new Point
{
X = ((Scenes[i].Location.X + part.StartPosition.X) - j),
Y = ((Scenes[i].Location.Y + part.StartPosition.Y) - k)
};
Floor[(ushort)point.X, (ushort)point.Y, MapObjectType.InvalidCast] = part.NoAccess[j, k];
}
}
}
}
}
private void LoadMapObjects(BinaryReader Reader)
{
int num = Reader.ReadInt32();
List<SceneFile> list = new List<SceneFile>();
for (int i = 0; i < num; i++)
{
int id = Reader.ReadInt32();
id = (byte)id;
switch (id)
{
case 10:
Reader.BaseStream.Seek(0x48L, SeekOrigin.Current);
break;

case 15:
Reader.BaseStream.Seek(0x114L, SeekOrigin.Current);
break;

case 1:
list.Add(this.CreateSceneFile(Reader));
break;

case 4:
Reader.BaseStream.Seek(0x1a0L, SeekOrigin.Current);
break;
}
}
Scenes = list.ToArray();
}
private void LoadPortals()
{
IniFile file = new KhaledMohamed.IniFile(Constants.PortalsPath);
ushort portalCount = file.ReadUInt16(BaseID.ToString(), "Count");

for (int i = 0; i < portalCount; i++)
{
string _PortalEnter = file.ReadString(BaseID.ToString(), "PortalEnter" + i.ToString());
string _PortalExit = file.ReadString(BaseID.ToString(), "PortalExit" + i.ToString());
string[] PortalEnter = _PortalEnter.Split(' ');
string[] PortalExit = _PortalExit.Split(' ');
Game.Portal portal = new KhaledMohamed.Game.Portal();
portal.CurrentMapID = Convert.ToUInt16(PortalEnter[0]);
portal.CurrentX = Convert.ToUInt16(PortalEnter[1]);
portal.CurrentY = Convert.ToUInt16(PortalEnter[2]);

if (PortalExit.Length == 3)
{
portal.DestinationMapID = Convert.ToUInt16(PortalExit[0]);
portal.DestinationX = Convert.ToUInt16(PortalExit[1]);
portal.DestinationY = Convert.ToUInt16(PortalExit[2]);
}
Portals.Add(portal);
}
}
public List<Game.Portal> Portals = new List<Game.Portal>();
private IDisposable Timer;

public static sbyte[] XDir = new sbyte[]
{
-1, -2, -2, -1, 1, 2, 2, 1,
0, -2, -2, -2, 0, 2, 2, 2,
-1, -2, -2, -1, 1, 2, 2, 1,
0, -1, -1, -1, 0, 1, 1, 1,
};
public static sbyte[] YDir = new sbyte[]
{
2, 1, -1, -2, -2, -1, 1, 2,
2, 2, 0, -2, -2, -2, 0, 2,
2, 1, -1, -2, -2, -1, 1, 2,
1, 1, 0, -1, -1, -1, 0, 1
};
public SafeConcurrentDictionary<uint, StaticEntity> StaticEntities = new SafeConcurrentDictionary<uint, StaticEntity>();
public void AddStaticEntity(StaticEntity item)
{
Floor[item.X, item.Y, MapObjectType.StaticEntity, null] = false;
StaticEntities[item.UID] = item;
}
public void RemoveStaticItem(StaticEntity item)
{
Floor[item.X, item.Y, MapObjectType.StaticEntity, null] = true;
StaticEntities.Remove(item.UID);
}
private void SaveMap()
{
if (!File.Exists(Constants.DMapsPath + "\\maps\\" + BaseID.ToString() + ".map"))
{
FileStream stream = new FileStream(Constants.DMapsPath + "\\maps\\" + BaseID.ToString() + ".map", FileMode.Create);
BinaryWriter writer = new BinaryWriter(stream);
writer.Write((uint)Floor.Bounds.Width);
writer.Write((uint)Floor.Bounds.Height);
for (int y = 0; y < Floor.Bounds.Height; y++)
{
for (int x = 0; x < Floor.Bounds.Width; x++)
{
writer.Write((byte)(Floor[x, y, MapObjectType.InvalidCast, null] == true ? 1 : 0));
}
}
writer.Close();
stream.Close();
}
}
private void SavePortals()
{
if (!File.Exists("portals.txt"))
{
File.Create("portals.txt");
}
string ConfigFileName = "portals.txt";
IniFile IniFile = new IniFile(ConfigFileName);
var id = ID.ToString();
for (int i = 0; i < portals.Length; i++)
{
IniFile.Write(id, "Count", portals.Length.ToString());
IniFile.Write(id, i.ToString(), string.Format("{0} {1} {2}", id, portals[i].XCord.ToString(), portals[i].YCord.ToString()));
}

}
private void LoadZones()
{
using (var command = new Database.MySqlCommand(Database.MySqlCommandType.SE LECT))
{
command.Select("notavailablepaths").Where("mapid", ID);

using (var reader = new Database.MySqlReader(command))
{
while (reader.Read())
{
Zoning.Zone zone = new Zoning.Zone(
new Point() { X = reader.ReadInt32("Point1_X"), Y = reader.ReadInt32("Point1_Y") },
new Point() { X = reader.ReadInt32("Point2_X"), Y = reader.ReadInt32("Point2_Y") },
new Point() { X = reader.ReadInt32("Point3_X"), Y = reader.ReadInt32("Point3_Y") },
new Point() { X = reader.ReadInt32("Point4_X"), Y = reader.ReadInt32("Point4_Y") }
);
Zones.Add(zone);
}
}
}
}
private void LoadNpcs()
{
using (var command = new Database.MySqlCommand(Database.MySqlCommandType.SE LECT))
{
command.Select("npcs").Where("mapid", ID);
using (var reader = new Database.MySqlReader(command))
{
while (reader.Read())
{
INpc npc = new Network.GamePackets.NpcSpawn();
npc.UID = reader.ReadUInt32("id");
npc.Name = reader.ReadString("name");
npc.Mesh = reader.ReadUInt16("lookface");
npc.Type = (Enums.NpcType)reader.ReadByte("type");
npc.X = reader.ReadUInt16("cellx");
npc.Y = reader.ReadUInt16("celly");
npc.effect = reader.ReadString("effect");
npc.MapID = ID;

AddNpc(npc);
}
}
}
using (var command = new Database.MySqlCommand(Database.MySqlCommandType.SE LECT))
{
command.Select("sobnpcs").Where("mapid", ID);
using (var reader = new Database.MySqlReader(command))
{
while (reader.Read())
{
Network.GamePackets.SobNpcSpawn npc = new Network.GamePackets.SobNpcSpawn();
npc.UID = reader.ReadUInt32("id");
npc.Mesh = reader.ReadUInt16("lookface");
if (ID == 1039)
npc.Mesh = (ushort)(npc.Mesh - npc.Mesh % 10 + 7);
npc.Type = (Enums.NpcType)reader.ReadByte("type");
npc.X = reader.ReadUInt16("cellx"); ;
npc.Y = reader.ReadUInt16("celly");
npc.MapID = reader.ReadUInt16("mapid");
npc.Sort = reader.ReadUInt16("sort");
npc.ShowName = true;
npc.Name = reader.ReadString("name");
npc.Hitpoints = reader.ReadUInt32("life");
npc.MaxHitpoints = reader.ReadUInt32("maxlife");
npc._isprize = reader.ReadBoolean("prize");
if (npc.UID >= 9994 && npc.UID <= 9997)
{
Database.GuildCondutors.GuildConductors.Add(npc.UI D, new Database.GuildCondutors.Conductor() { npc = npc });
Database.GuildCondutors.MoveNpc(npc.UID, npc.MapID, npc.X, npc.Y);
AddNpc(npc, true);
}
else
AddNpc(npc);
}
}
}
uint nextid = 100000;
using (var command = new Database.MySqlCommand(Database.MySqlCommandType.SE LECT))
{
command.Select("statues").Where("mapid", ID);
using (var reader = new Database.MySqlReader(command))
{
while (reader.Read())
{
Network.GamePackets.SobNpcSpawn npc = new Network.GamePackets.SobNpcSpawn();
npc.UID = reader.ReadUInt32("id");
if (npc.UID > nextid)
nextid = npc.UID;
npc.Mesh = reader.ReadUInt16("lookface");
npc.Type = (Enums.NpcType)reader.ReadByte("type");
npc.X = reader.ReadUInt16("cellx"); ;
npc.Y = reader.ReadUInt16("celly");
npc.MapID = reader.ReadUInt16("mapid");
npc.ShowName = true;
npc.Name = reader.ReadString("name");
npc.Hitpoints = reader.ReadUInt32("life");
npc.MaxHitpoints = reader.ReadUInt32("maxlife");
npc.SpawnPacket = reader.ReadBlob("SpawnPacket");
AddNpc(npc);
}
}
}
EntityUIDCounter2 = new Counter(nextid);
}
public bool FreezeMonsters = false;
public void LoadMonsters()
{
//Companions = new SafeDictionary<uint, Entity>();
using (var command = new Database.MySqlCommand(Database.MySqlCommandType.SE LECT))
{
command.Select("monsterspawns").Where("mapid", ID);
using (var reader = new Database.MySqlReader(command))
{
int mycount = 0;
try
{
while (reader.Read())
{
uint monsterID = reader.ReadUInt32("npctype");
ushort CircleDiameter = reader.ReadUInt16("maxnpc");
ushort X = reader.ReadUInt16("bound_x");
ushort Y = reader.ReadUInt16("bound_y");
ushort XPlus = reader.ReadUInt16("bound_cx");
ushort YPlus = reader.ReadUInt16("bound_cy");
ushort Amount = reader.ReadUInt16("max_per_gen");
int respawn = reader.ReadInt32("rest_secs");
if (Database.MonsterInformation.MonsterInformations.C ontainsKey(monsterID))
{
Database.MonsterInformation mt = Database.MonsterInformation.MonsterInformations[monsterID];
mt.RespawnTime = respawn + 5;
mt.BoundX = X;
mt.BoundY = Y;
mt.BoundCX = XPlus;
mt.BoundCY = YPlus;

bool more = true;
for (int count = 0; count < Amount; count++)
{
if (!more)
break;
Entity entity = new Entity(EntityFlag.Monster, false);
entity.MapObjType = MapObjectType.Monster;
entity.MonsterInfo = mt.Copy();
entity.MonsterInfo.Owner = entity;
entity.Name = mt.Name;
entity.MinAttack = mt.MinAttack;
entity.MaxAttack = entity.MagicAttack = mt.MaxAttack;
entity.Hitpoints = entity.MaxHitpoints = mt.Hitpoints;
entity.Defence = mt.Defence;
entity.Body = mt.Mesh;
entity.Level = mt.Level;
entity.UID = EntityUIDCounter.Next;
entity.MapID = ID;
entity.SendUpdates = true;
#region Guards

if (mt.Name == "Guard1" || mt.Name == "Guard2")
{
Network.Writer.Write((byte)255, 271, entity.SpawnPacket);//UNKNOWN
Network.Writer.Write((byte)16, 272, entity.SpawnPacket);//UNKNOWN
Network.Writer.Write((byte)Kernel.Random.Next(1, 7), Entity._Facing, entity.SpawnPacket);//RANDOM~FACING
}

#endregion Guards
entity.X = (ushort)(X + Kernel.Random.Next(0, XPlus));
entity.Y = (ushort)(Y + Kernel.Random.Next(0, YPlus));
for (int count2 = 0; count2 < 50; count2++)
{
if (!Floor[entity.X, entity.Y, MapObjectType.Monster, null])
{
entity.X = (ushort)(X + Kernel.Random.Next(0, XPlus));
entity.Y = (ushort)(Y + Kernel.Random.Next(0, YPlus));
if (count2 == 50)
more = false;
}
else
break;
}
if (more)
{
if (Floor[entity.X, entity.Y, MapObjectType.Monster, null])
{
mycount++;
AddEntity(entity);
}
}
}
}
}

}
catch (Exception e) { Program.SaveException(e); }
if (mycount != 0)
Timer = MonsterTimers.Add(this);
}
}
}

public Tuple<ushort, ushort> RandomCoordinates()
{
int times = 10000;
int x = Kernel.Random.Next(Floor.Bounds.Width), y = Kernel.Random.Next(Floor.Bounds.Height);
while (times-- > 0)
{
if (!Floor[x, y, MapObjectType.Entity, null])
{
x = Kernel.Random.Next(Floor.Bounds.Width);
y = Kernel.Random.Next(Floor.Bounds.Height);
}
else break;
}
return new Tuple<ushort, ushort>((ushort)x, (ushort)y);
}
public Tuple<ushort, ushort> RandomCoordinates(int _x, int _y, int radius)
{
int times = 10000;
int x = _x + Kernel.Random.Sign() * Kernel.Random.Next(radius),
y = _y + Kernel.Random.Sign() * Kernel.Random.Next(radius);
while (times-- > 0)
{
if (!Floor[x, y, MapObjectType.Entity, null])
{
x = _x + Kernel.Random.Sign() * Kernel.Random.Next(radius);
y = _y + Kernel.Random.Sign() * Kernel.Random.Next(radius);
}
else break;
}
return new Tuple<ushort, ushort>((ushort)x, (ushort)y);
}

private static TimerRule<Map> MonsterTimers;
public static void CreateTimerFactories()
{
MonsterTimers = new TimerRule<Map>(_timerCallBack, 500);
}

public Time32 LastReload = Time32.Now;
private static void _timerCallBack(Map map, int time)
{
//foreach (Entity monster in map.Companions.Values)
//{
// if (!monster.Owner.Socket.Alive)
// {
// map.RemoveEntity(monster);
// break;
// }
//}
Time32 now = new Time32(time);
foreach (Entity monster in map.Entities.Values.ToList())
{
if (monster == null || monster.Name == "Thundercloud") continue;

if (monster.Dead)
{
if (now > monster.DeathStamp.AddSeconds(monster.MonsterInfo. RespawnTime))
{
monster.X = (ushort)(monster.MonsterInfo.BoundX + Kernel.Random.Next(0, monster.MonsterInfo.BoundCX));
monster.Y = (ushort)(monster.MonsterInfo.BoundY + Kernel.Random.Next(0, monster.MonsterInfo.BoundCY));
for (int count = 0; count < monster.MonsterInfo.BoundCX * monster.MonsterInfo.BoundCY; count++)
{
if (!map.Floor[monster.X, monster.Y, MapObjectType.Monster, null])
{
monster.X = (ushort)(monster.MonsterInfo.BoundX + Kernel.Random.Next(0, monster.MonsterInfo.BoundCX));
monster.Y = (ushort)(monster.MonsterInfo.BoundY + Kernel.Random.Next(0, monster.MonsterInfo.BoundCY));
}
else
break;
}
if (map.Floor[monster.X, monster.Y, MapObjectType.Monster] || monster.X == monster.MonsterInfo.BoundX && monster.Y == monster.MonsterInfo.BoundY)
{
monster.Hitpoints = monster.MonsterInfo.Hitpoints;
monster.RemoveFlag(monster.StatusFlag);
var stringPacket = new _String(true);
stringPacket.UID = monster.UID;
stringPacket.Type = _String.Effect;
stringPacket.Texts.Add("MBStandard");
monster.StatusFlag = 0;
//if (monster.MonsterInfo.Type == 2)
//{
// var value = Update.Flags.BlackName;
// Network.Writer.WriteUInt64(value, 0x16 + 4, monster.SpawnPacket);

//}
//if (monster.MonsterInfo.Name == "Guard1")
//{
// monster.Action = (ushort)Kernel.Random.Next(1, 15);
//}
if (monster.Name == "WhiteTiger1" ) اسماء الوحوش الكان فيها مشكله كان هنا ومسحتو بس المشكله متحلتش بردو
{
foreach (Client.GameState client in Program.Values)
{
client.MessageBox(monster.Name + " has apeared , Who will Defeat it to Get [5.000.000] ConquerPoints & [2.000] BoundCps ", (p) => { p.Entity.Teleport(monster.MapID, (ushort)(monster.X + 3), (ushort)(monster.Y + 3), false); }, null);
}
KhaledMohamed.Kernel.SendWorldMessage(new KhaledMohamed.Network.GamePackets.Message(" Warrning " + monster.Name + " has Apeared in [" + monster.MapID.ToString() + "] at " + monster.X + ", " + monster.Y + " Who will Defeat it and get [5.000.000] ConquerPoints & [2.000] BoundCps ", System.Drawing.Color.White, KhaledMohamed.Network.GamePackets.Message.Center), Program.Values);
}
foreach (Client.GameState client in Program.Values)
{
if (client.Map.ID == map.ID)
{
if (Kernel.GetDistance(client.Entity.X, client.Entity.Y, monster.X, monster.Y) < Constants.nScreenDistance)
{
monster.CauseOfDeathIsMagic = false;
monster.SendSpawn(client, false);
client.Send(stringPacket);
if (monster.MaxHitpoints > 65535)
{
Update upd = new Update(true) { UID = monster.UID };
// upd.Append(Update.MaxHitpoints, monster.MaxHitpoints);
upd.Append(Update.Hitpoints, monster.Hitpoints);
client.Send(upd);
}
}
}
}
}
}
}
else
{
if (monster.ToxicFogLeft > 0)
{
if (monster.MonsterInfo.Boss)
{
monster.ToxicFogLeft = 0;
continue;
}
if (now > monster.ToxicFogStamp.AddSeconds(2))
{
monster.ToxicFogLeft--;
monster.ToxicFogStamp = now;
if (monster.Hitpoints > 1)
{
uint damage = Attacking.Calculate.Percent(monster, monster.ToxicFogPercent);
monster.Hitpoints -= damage;
var suse = new SpellUse(true);
suse.Attacker = monster.UID;
suse.SpellID = 10010;
suse.AddTarget(monster, damage, null);
monster.MonsterInfo.SendScreen(suse);
}
}
}
}
}
}
public void SpawnMonsterNearToHero(MonsterInformation mt, GameState client)
{
if (mt == null) return;
mt.RespawnTime = 36000;
KhaledMohamed.Game.Entity entity = new KhaledMohamed.Game.Entity(EntityFlag.Monster, false);
entity.MapObjType = MapObjectType.Monster;
entity.MonsterInfo = mt.Copy();
entity.MonsterInfo.Owner = entity;
entity.Name = mt.Name;
entity.MinAttack = mt.MinAttack;
entity.MaxAttack = entity.MagicAttack = mt.MaxAttack;
entity.Hitpoints = entity.MaxHitpoints = mt.Hitpoints;
entity.Body = mt.Mesh;
entity.Level = mt.Level;
entity.UID = EntityUIDCounter.Next;
entity.MapID = ID;
entity.SendUpdates = true;
entity.X = (ushort)(client.Entity.X + Kernel.Random.Next(5));
entity.Y = (ushort)(client.Entity.Y + Kernel.Random.Next(5));
AddEntity(entity);
entity.SendSpawn(client);
}
public void Spawnthis(MonsterInformation mt, ushort x, ushort y)
{
if (mt == null) return;
mt.RespawnTime = 5;
var entity = new Entity(EntityFlag.Monster, false);
entity.MapObjType = MapObjectType.Monster;
entity.MonsterInfo = mt.Copy();
entity.MonsterInfo.Owner = entity;
entity.Name = mt.Name;
entity.MinAttack = mt.MinAttack;
entity.MaxAttack = entity.MagicAttack = mt.MaxAttack;
entity.Hitpoints = entity.MaxHitpoints = mt.Hitpoints;
entity.Body = mt.Mesh;
entity.Level = mt.Level;
entity.UID = EntityUIDCounter.Next;
entity.MapID = this.ID;
entity.X = x;
entity.Y = y;
entity.SendUpdates = true;
AddEntity(entity);
foreach (var p in Program.GamePool.Where(z => z.Map.ID == this.ID && z.GetDistance(entity) <= Constants.pScreenDistance))
entity.SendSpawn(p);
}
public void Spawnthis(MonsterInformation mt, GameState client, ushort ID, ushort x, ushort y)
{
if (mt == null)
{
return;
}
mt.RespawnTime = 36000;
Entity entity = new Entity(EntityFlag.Monster, false);
entity.MapObjType = MapObjectType.Monster;
entity.MonsterInfo = mt.Copy();
entity.MonsterInfo.Owner = entity;
entity.Name = mt.Name;
entity.MinAttack = mt.MinAttack;
entity.MaxAttack = (entity.MagicAttack = mt.MaxAttack);
entity.Hitpoints = (entity.MaxHitpoints = mt.Hitpoints);
entity.Body = mt.Mesh;
entity.Level = mt.Level;
entity.UID = this.EntityUIDCounter.Next;
entity.MapID = ID;
entity.X = x;
entity.Y = y;
entity.SendUpdates = true;
this.AddEntity(entity);
entity.SendSpawn(client);
}
public Map MakeDynamicMap()
{
ushort id = (ushort)DynamicIDs.Next;
Map myDynamic = new Map(id, this.ID, this.Path);
return myDynamic;
}
bool disposed = false;
public void Dispose()
{
if (!disposed)
Kernel.Maps.Remove(ID);

disposed = true;
}

public void RemoveNpc(INpc npc, bool query = false)
{
if (Npcs.ContainsKey(npc.UID) || query)
{
if (!query)
Npcs.Remove(npc.UID);
#region Setting the near coords invalid to avoid unpickable items.
Floor[npc.X, npc.Y, MapObjectType.InvalidCast] = true;
if (npc.Mesh / 10 != 108 && (byte)npc.Type < 10)
{
ushort x = npc.X, Y = npc.Y;
foreach (Enums.ConquerAngle angle in Angles)
{
ushort xX = x, yY = Y;
UpdateCoordonatesForAngle(ref xX, ref yY, angle);
Floor[xX, yY, MapObjectType.InvalidCast] = true;
}
}
#endregion
}
}
public void Spawnthiskingdom(Database.MonsterInformation mt, ushort x, ushort y)
{
if (mt == null) return;
mt.RespawnTime = 5;
var entity = new Entity(EntityFlag.Monster, false);
entity.MapObjType = MapObjectType.Monster;
entity.MonsterInfo = mt.Copy();
entity.MonsterInfo.Owner = entity;
entity.Name = mt.Name;
entity.MinAttack = mt.MinAttack;
entity.MaxAttack = entity.MagicAttack = mt.MaxAttack;
entity.Hitpoints = entity.MaxHitpoints = mt.Hitpoints;
entity.Body = mt.Mesh;
entity.Level = mt.Level;
entity.UID = EntityUIDCounter.Next;
entity.MapID = this.ID;
entity.X = x;
entity.Y = y;
entity.SendUpdates = true;
AddEntity(entity);
foreach (var z in Program.GamePool)
if (z.Map.ID == this.ID && z.GetDistance(entity) <= Constants.pScreenDistance)
entity.SendSpawn(z);
}
}
public class Floor
{
[Flags]
public enum DMapPointFlag : byte
{
Invalid = 1,
Monster = 2,
Npc,
Item = 4,
RaceItem = 8
}
public class Size
{
public int Width, Height;
public Size(int width, int height)
{
Width = width;
Height = height;
}
public Size()
{
Width = 0;
Height = 0;
}
}
public Size Bounds;
public DMapPointFlag[,] Locations;
public uint FloorMapId;
public Floor(int width, int height, uint mapId)
{
FloorMapId = mapId;
Bounds = new Size(width, height);
Locations = new DMapPointFlag[width, height];
}

public ushort ID;
public Counter EntityUIDCounter = new Counter(400000);

private void AddEntity(Entity entity)
{
throw new NotImplementedException();
}
public bool this[int x, int y, MapObjectType type, object obj = null]
{
get
{
if (y >= Bounds.Height || x >= Bounds.Width || x < 0 || y < 0)
return false;

DMapPointFlag filltype = Locations[x, y];

if (type == MapObjectType.InvalidCast)
return (filltype & DMapPointFlag.Invalid) == DMapPointFlag.Invalid;
if ((filltype & DMapPointFlag.Invalid) == DMapPointFlag.Invalid)
return false;
if (type == MapObjectType.Entity)
return true;
else
{
if (type == MapObjectType.Npc)
return (filltype & DMapPointFlag.Npc) != DMapPointFlag.Npc;
if (type == MapObjectType.Monster)
return (filltype & DMapPointFlag.Monster) != DMapPointFlag.Monster;
if (type == MapObjectType.Item)
return (filltype & DMapPointFlag.Item) != DMapPointFlag.Item;
if (type == MapObjectType.StaticEntity)
return (filltype & DMapPointFlag.RaceItem) != DMapPointFlag.RaceItem;
}
return false;
}
set
{
if (y >= Bounds.Height || x >= Bounds.Width || x < 0 || y < 0)
return;
DMapPointFlag filltype = Locations[x, y];

if (value)
{
if (type == MapObjectType.InvalidCast)
TakeFlag(x, y, DMapPointFlag.Invalid);
if (type == MapObjectType.Item)
TakeFlag(x, y, DMapPointFlag.Item);
if (type == MapObjectType.Npc)
TakeFlag(x, y, DMapPointFlag.Npc);
if (type == MapObjectType.Monster)
TakeFlag(x, y, DMapPointFlag.Monster);
if (type == MapObjectType.StaticEntity)
TakeFlag(x, y, DMapPointFlag.RaceItem);
}
else
{
if (type == MapObjectType.InvalidCast)
AddFlag(x, y, DMapPointFlag.Invalid);
if (type == MapObjectType.Npc)
TakeFlag(x, y, DMapPointFlag.Npc);
if (type == MapObjectType.Item)
AddFlag(x, y, DMapPointFlag.Item);
if (type == MapObjectType.Monster)
AddFlag(x, y, DMapPointFlag.Monster);
if (type == MapObjectType.StaticEntity)
AddFlag(x, y, DMapPointFlag.RaceItem);
}
}
}
public DMapPointFlag AddFlag(int x, int y, DMapPointFlag extraFlag)
{
Locations[x, y] |= extraFlag;
return Locations[x, y];
}
public DMapPointFlag TakeFlag(int x, int y, DMapPointFlag extraFlag)
{
Locations[x, y] &= ~extraFlag;
return Locations[x, y];
}
}
public enum MapObjectType
{
SobNpc, Npc, Item, Monster, Entity, Nothing, InvalidCast, FloorSpell, StaticEntity
}
public class Portal
{
public Portal(ushort currentMapId, ushort currentX, ushort currentY, ushort destinationMapId, ushort destinationX, ushort destinationY)
{
CurrentMapID = currentMapId;
CurrentX = currentX;
CurrentY = currentY;
DestinationMapID = destinationMapId;
DestinationX = destinationX;
DestinationY = destinationY;
}
public Portal()
{

}
public ushort CurrentMapID
{
get;
set;
}
public ushort CurrentX
{
get;
set;
}
public ushort CurrentY
{
get;
set;
}
public ushort DestinationMapID
{
get;
set;
}
public ushort DestinationX
{
get;
set;
}
public ushort DestinationY
{
get;
set;
}
}
}

Users
2019-08-27, 09:54 PM
امسح الكود ده وغير اماكنها من القاعده زى ما قلك حسن ومش مهم الايدى اكتب الاسم

AliNasser
2019-08-27, 11:31 PM
امسح الكود ده وغير اماكنها من القاعده زى ما قلك حسن ومش مهم الايدى اكتب الاسم


اولا monsterspawns مهوش اسامي
ثانيا : انا جربت ارجع الوحوش للمابه القديمه قبل منقلهم ولقيت المشكله اتحلت
رجعت غيرت المابه لمابه الدراجون ايلند ملقتش مشكله تاني ....

Commander
2019-08-28, 05:07 AM
الكود الي في الورلد عادي مفهوش حاجه تمام مفيش حاجه انت بس كل الي هتعملو انك هتروح للكود المسئول عن الوحش لما يموت الي هو بيبقي فيه دروب الوحش وتحط فيه
Program.SnowBa = true;