public static void removeVob(Vob vob) { if (vob == null) { throw new ArgumentNullException("AddVob: Vob can't be null!"); } if (vob.ID == 0) { throw new ArgumentException("AddVob: Vob.ID can't be null!"); } if (!VobDict.ContainsKey(vob.ID)) { throw new ArgumentException("AddVob: Vob.ID is not in the list: " + vob.ID + " " + vob.VobType + " " + vob); } #if D_CLIENT if (vob.Address != 0) { sWorld.SpawnedVobDict.Remove(vob.Address); vob.Address = 0; } #endif vob.IsSpawned = false; vob.Created = false; if (vob.Map != null && vob.Map.Length != 0) { sWorld.getWorld(vob.Map).removeVob(vob); } VobDict.Remove(vob.ID); vob.Created = false; }
public static void addVob(Vob vob) { if (vob == null) { throw new ArgumentNullException("AddVob: Vob can't be null!"); } if (vob.ID == 0) { throw new ArgumentException("AddVob: Vob.ID can't be null!"); } VobDict.Add(vob.ID, vob); if (!(vob is NPCProto) && !(vob is Item)) { VobList.Add(vob); } if (vob is NPCProto) { addPlayer((NPCProto)vob); } else if (vob is Item) { addItem((Item)vob); } }
public void addVob(Vob vob) { if (vob.Map != null && vob.Map.Length != 0) { sWorld.getWorld(vob.Map).removeVob(vob); } vob.Map = this.Map; vob.IsSpawned = true; #if D_SERVER this.setVobPosition(null, vob.Pos, vob); #endif if (!(vob is NPCProto) && !(vob is Item)) { VobList.Add(vob); } if (vob is NPCProto) { pAddPlayer((NPCProto)vob); } else if (vob is Item) { pAddItem((Item)vob); } }
public static void WriteThrow(Vob vob, Vec3f velocity) { PacketWriter stream = GameServer.SetupStream(ServerMessages.VobThrowMessage); stream.Write((ushort)vob.ID); stream.Write(velocity); vob.ForEachVisibleClient(client => client.Send(stream, NetPriority.Medium, NetReliability.ReliableOrdered, 'W')); }
internal Vob(GUC.WorldObjects.Vob vob, String visual, bool cdDyn, bool cdStatic, bool useCreate) : this(vob) { this.vob.ScriptingVob = this; this.Visual = visual; this.vob.CDDyn = cdDyn; this.vob.CDStatic = cdStatic; if (useCreate) { CreateVob(); } }
public static Vob createVob(VobType vt) { Vob v = null; if (vt == VobType.Npc) { v = new NPC(); } else if (vt == VobType.Player) { v = new Player(); } else if (vt == VobType.Item) { v = new Item(); } else if (vt == VobType.Vob) { v = new Vob(); } else if (vt == VobType.MobInter) { v = new MobInter(); } else if (vt == VobType.MobBed) { v = new MobBed(); } else if (vt == VobType.MobContainer) { v = new MobContainer(); } else if (vt == VobType.MobDoor) { v = new MobDoor(); } else if (vt == VobType.MobSwitch) { v = new MobSwitch(); } if (v != null) { v.VobType = vt; } return(v); }
public void removeVob(Vob vob) { #if D_SERVER this.setVobPosition(vob.Pos, null, vob); #endif if (vob is NPCProto) { pRemovePlayer((NPCProto)vob); } else if (vob is Item) { pRemoveItem((Item)vob); } vob.Map = null; }
public static void addVob(Vob vob) { if (vob == null) { throw new ArgumentNullException("AddVob: Vob can't be null!"); } if (vob.ID == 0) { throw new ArgumentException("AddVob: Vob.ID can't be null!"); } if (VobDict.ContainsKey(vob.ID)) { throw new ArgumentException("AddVob: Vob.ID is already in the list: " + vob.ID + " " + vob.VobType + " " + vob); } VobDict.Add(vob.ID, vob); vob.Created = true; }
public static void removeVob(Vob vob) { if (vob == null) { throw new ArgumentNullException("Vob can't be null!"); } if (vob.ID == 0) { throw new ArgumentException("Vob.ID can't be null!"); } VobDict.Remove(vob.ID); if (vob is NPCProto) { removePlayer((NPCProto)vob); } else if (vob is Item) { removeItem((Item)vob); } }
internal Vob(GUC.WorldObjects.Vob vob) { this.vob = vob; }
public void setVobPosition(float[] oldPos, float[] newPos, Vob vob) { if (!vob.IsSpawned) { newPos = null; } uint oldKey = getKeyByPosition(oldPos); uint newKey = getKeyByPosition(newPos); if (oldPos != null && VobPositionList.ContainsKey(oldKey) && VobPositionList[oldKey].Contains(vob))//Needs to delete! { VobPositionList[oldKey].Remove(vob); if (VobPositionList[oldKey].Count == 0) { VobPositionList.Remove(oldKey); } if (vob is Item) { ItemPositionList[oldKey].Remove((Item)vob); if (ItemPositionList[oldKey].Count == 0) { ItemPositionList.Remove(oldKey); } } else if (vob is NPCProto) { NPCPositionList[oldKey].Remove((NPCProto)vob); if (NPCPositionList[oldKey].Count == 0) { NPCPositionList.Remove(oldKey); } if (vob is Player) { PlayerPositionList[oldKey].Remove((Player)vob); if (PlayerPositionList[oldKey].Count == 0) { PlayerPositionList.Remove(oldKey); } } } else if (vob is Mobs.MobInter) { MobInterPositionList[oldKey].Remove((Mobs.MobInter)vob); if (MobInterPositionList[oldKey].Count == 0) { MobInterPositionList.Remove(oldKey); } } } if (newPos != null) { if (!VobPositionList.ContainsKey(newKey)) { VobPositionList.Add(newKey, new List <Vob>()); } VobPositionList[newKey].Add(vob); if (vob is Item) { if (!ItemPositionList.ContainsKey(newKey)) { ItemPositionList.Add(newKey, new List <Item>()); } ItemPositionList[newKey].Add((Item)vob); } else if (vob is NPCProto) { if (!NPCPositionList.ContainsKey(newKey)) { NPCPositionList.Add(newKey, new List <NPCProto>()); } NPCPositionList[newKey].Add((NPCProto)vob); if (vob is Player) { if (!PlayerPositionList.ContainsKey(newKey)) { PlayerPositionList.Add(newKey, new List <Player>()); } PlayerPositionList[newKey].Add((Player)vob); } } else if (vob is Mobs.MobInter) { if (!MobInterPositionList.ContainsKey(newKey)) { MobInterPositionList.Add(newKey, new List <Mobs.MobInter>()); } MobInterPositionList[newKey].Add((Mobs.MobInter)vob); } } }
public static void removeVob(Vob vob) { }
public void Read(BitStream stream) { stream.Read(out this.mapName); int ilc = 0; stream.Read(out ilc); for (int i = 0; i < ilc; i++) { int id; Vec3f pos, dir; stream.Read(out id); stream.Read(out pos); stream.Read(out dir); Vob v = sWorld.VobDict[id]; v.Position = pos; v.Direction = dir; addVob(v); v.Spawn(this.Map, v.Position, v.Direction); } int vlc = 0; stream.Read(out vlc); for (int i = 0; i < vlc; i++) { int id; Vec3f pos, dir; stream.Read(out id); stream.Read(out pos); stream.Read(out dir); Vob v = sWorld.VobDict[id]; v.Position = pos; v.Direction = dir; addVob(v); v.Spawn(this.Map, v.Position, v.Direction); } int nlc = 0; stream.Read(out nlc); for (int i = 0; i < nlc; i++) { int id; Vec3f pos, dir; stream.Read(out id); stream.Read(out pos); stream.Read(out dir); if (id == Player.Hero.ID) { continue; } Vob v = sWorld.VobDict[id]; v.Position = pos; v.Direction = dir; addVob(v); v.Spawn(this.Map, v.Position, v.Direction); //((NPCProto)v).Disable(); } }