public Task <IObjectImpl> GetInRangeObject(ObjectGUID guid) { IObjectImpl ret = null; _inrangeObjects.TryGetValue(guid, out ret); return(Task.FromResult(ret)); }
public CreatureEntity(ObjectGUID objectGUID, creature creature, VanillaWorld vanillaWorld) : base(objectGUID) { this.VanillaWorld = vanillaWorld; this.Creature = creature; this.Template = CreatureTemplateDatabase.SingleOrDefault(ct => ct.Entry == creature.id); }
public Task <IObjectImpl> GetObject(ObjectGUID guid) { IObjectImpl retval; _objectCache.TryGetValue(guid, out retval); return(Task.FromResult(retval)); }
public PSForceRunSpeedChange(ObjectGUID GUID, float speed) : base(WorldOpcodes.SMSG_FORCE_RUN_SPEED_CHANGE) { this.Write(GUID.RawGUID); this.Write((uint)0); this.Write(speed); }
public async Task SetGUID(ObjectGUID guid) { await SetGUID(EObjectFields.OBJECT_FIELD_GUID, guid); oGUID = guid; pGUID = new PackedGUID(guid); }
public GameObjectInfo(ObjectGUID guid, gameobject gameObject, gameobject_template template) : base(guid) { DisplayID = template.displayId; Flags = (int)template.flags; TypeID = template.type; State = gameObject.state; X = gameObject.position_x; Y = gameObject.position_y; Z = gameObject.position_z; Rotation0 = gameObject.rotation0; Rotation1 = gameObject.rotation1; Orientation = gameObject.orientation; if (gameObject.rotation2 == 0 && gameObject.rotation3 == 0) { gameObject.rotation2 = (float)Math.Sin(gameObject.orientation / 2); gameObject.rotation3 = (float)Math.Cos(gameObject.orientation / 2); } Rotation2 = gameObject.rotation2; Rotation3 = gameObject.rotation3; Type |= (int)TypeMask.TYPEMASK_GAMEOBJECT; }
private Task <ObjectGUID> GeneratePlayerGUID() { var guid = new ObjectGUID(State.MaxPlayerGUID | (UInt64)HighGuid.HIGHGUID_PLAYER); State.MaxPlayerGUID += 1; return(Task.FromResult(guid)); }
public PlayerEntity(ObjectGUID objectGUID, character databaseCharacter, WorldSession session) : base(objectGUID) { this.Character = databaseCharacter; this.Session = session; this.SpellCollection = new SpellCollection(this); this.ActionButtonCollection = new ActionButtonCollection(this); }
public void AddCreatureEntity(creature creature) { var guid = new ObjectGUID((ulong)creature.guid, TypeID.TYPEID_UNIT); var creatureEntity = new CreatureEntity(guid, creature, vanillaWorld); CreatureEntities.Add(creatureEntity); creatureEntity.Setup(); }
public async Task RemoveInRangeObject(ObjectGUID guid, IObjectImpl obj, bool remove_other = true) { RemoveInRangeObjectImpl(guid, obj); if (remove_other) { await obj.RemoveInRangeObject(oGUID, this, false); } }
public PlayerEntity AddPlayerEntity(character character, WorldSession session) { ObjectGUID guid = new ObjectGUID((ulong)character.guid, TypeID.TYPEID_PLAYER); PlayerEntity playerEntity = new PlayerEntity(guid, character, session); PlayerEntities.Add(playerEntity); playerEntity.Setup(); return(playerEntity); }
public void AddGameObjectEntity(gameobject gameObject) { var guid = new ObjectGUID((ulong)gameObject.guid, TypeID.TYPEID_GAMEOBJECT); var template = vanillaWorld.WorldDatabase.GetRepository <gameobject_template>().SingleOrDefault(t => t.entry == gameObject.id); var gameObjectEntity = new GameObjectEntity(guid, gameObject, template); GameObjectEntities.Add(gameObjectEntity); gameObjectEntity.Setup(); }
protected void RemoveInRangeObjectImpl(ObjectGUID guid, IObjectImpl obj) { State.InRangeObjects.Remove(guid); _inrangeObjects.Remove(guid); if (obj is IPlayer) { _inrangePlayers.Remove(guid); } }
public async Task <bool> SetPlayer(IPlayer plr) { ObjectGUID plrGUID = new ObjectGUID((UInt64)plr.GetPrimaryKeyLong()); if (State.GUID != 0) { return(false); } State.GUID = plrGUID; await Save(); return(true); }
public UnitInfo(ObjectGUID guid) : base(guid) { Health = 1; MaxHealth = 100; DisplayID = NativeDisplayID = 1; StandState = 0; StandStateFlags = 0; Power = 3; Type |= (int)TypeMask.TYPEMASK_UNIT; Mana = MaxMana = MaxRage = 1000; WalkSpeed = 2.5f; }
public CreatureInfo(ObjectGUID objectGUID, creature creature, creature_template template) : base(objectGUID) { DisplayID = NativeDisplayID = creature.modelid; Health = (int)creature.curhealth; MaxHealth = (int)template.MaxLevelHealth; Level = template.MaxLevel; NPCFlags = (int)template.NpcFlags; DynamicFlags = (int)template.DynamicFlags; UnitFlag = (int)template.UnitFlags; FactionTemplate = (uint)template.FactionAlliance; Entry = template.Entry; //Used to set the creature name. CombatReach = 30f; }
public async Task RemoveObject(ObjectGUID guid, IObjectImpl obj) { State.ObjectList.Remove(guid); State.ActiveObjects.Remove(guid); State.UpdatedObjects.Remove(guid); _objectCache.Remove(guid); bool activator = await obj.IsCellActivator(); if (activator) { var posx = await obj.GetPositionX(); var posy = await obj.GetPositionY(); await DecRefCells(posx, posy); } }
public async Task AddInRangeObject(ObjectGUID guid, IObjectImpl obj, bool add_other = true) { if (guid == oGUID) //Cannot be inrange of self { return; } if (_inrangeObjects.ContainsKey(guid)) { return; //already inrange } AddInRangeObjectImpl(guid, obj); await OnAddInRangeObject(guid, obj); if (add_other) { await obj.AddInRangeObject(oGUID, this, false); } }
public static IObjectImpl GetObject(IGrainFactory factory, ObjectGUID guid) { var highguid = guid.ToHighGUID(); switch (highguid) { case HighGuid.HIGHGUID_UNIT: { return(factory.GetGrain <ICreature>(guid.ToInt64())); } case HighGuid.HIGHGUID_PLAYER: { return(factory.GetGrain <IPlayer>(guid.ToInt64())); } } return(factory.GetGrain <IObject>(0)); }
protected void AddInRangeObjectImpl(ObjectGUID guid, IObjectImpl obj) { if (guid == oGUID) //Cannot be inrange of self { return; } if (!State.InRangeObjects.Contains(guid)) { State.InRangeObjects.Add(guid); } if (!_inrangeObjects.ContainsKey(guid)) { _inrangeObjects.Add(guid, obj); if (obj is IPlayer) { _inrangePlayers.Add(guid, obj); } } if (_inrangeObjectTracker != null) { _inrangeObjectTracker.Add(guid, obj); } }
public async Task RemoveObject(ObjectGUID guid, IObjectImpl obj) { State.Objects.Remove(guid); _objectCache.Remove(guid); await obj.SetCell(0); }
public async Task AddObject(ObjectGUID guid, IObjectImpl obj) { State.Objects.Add(guid); _objectCache.Add(guid, obj); await obj.SetCell((UInt64) this.GetPrimaryKeyLong()); }
public ObjectInfo(ObjectGUID guid) { GUID = guid.RawGUID; Type = (int)TypeMask.TYPEMASK_OBJECT; Scale = 1; }
public PlayerInfo(ObjectGUID guid, character databaseCharacter, ChrRaces race, ChrClasses chrClass) : base(guid) { this.Class = chrClass; this.ClassID = this.Class.ClassID; this.Gender = databaseCharacter.gender; this.Power = (byte)this.Class.PowerType; this.Race = race; this.RaceID = race.RaceID; this.FactionTemplate = race.FactionID; this.DisplayID = this.NativeDisplayID = (int)(this.Gender == 0 ? race.ModelM : race.ModelF); this.Health = (int)databaseCharacter.health; //Level = databaseCharacter.Level; this.XP = (int)databaseCharacter.xp; this.NextLevelXP = 400; Byte[] playerBytes = BitConverter.GetBytes(databaseCharacter.playerBytes); Byte[] playerBytes2 = BitConverter.GetBytes(databaseCharacter.playerBytes2); this.Skin = playerBytes[0]; this.Face = playerBytes[1]; this.HairStyle = playerBytes[2]; this.HairColor = playerBytes[3]; this.Accessory = playerBytes2[0]; FactionTemplate = race.FactionID; UnitFlag = (int)UnitFlags.UNIT_FLAG_PVP; FlagUnk = 0x08 | 0x20; WatchedFactionIndex = (int)databaseCharacter.watchedFaction; this.Money = (int)databaseCharacter.money; /* item_template[] equipment = ItemUtils.GenerateInventoryByIDs(Utils.CSVStringToIntArray(databaseCharacter.equipmentCache)); VisualItems = new Item[19]; for (byte itemSlot = 0; itemSlot < 19; itemSlot++) { if (equipment == null) return; if (equipment[itemSlot] != null) { VisualItems[itemSlot] = new Item() { Creator = guid.RawGUID, EnchantmentIDs = new[] { 0, 0 }, Entry = equipment[itemSlot].entry, RandomPropertyID = equipment[itemSlot].RandomProperty, ItemSuffixFactor = 3 }; } else { VisualItems[itemSlot] = new Item() { Creator = 0, EnchantmentIDs = new[] { 0, 0 }, Entry = 0, RandomPropertyID = 0, ItemSuffixFactor = 0 }; } }*/ Type |= (int)TypeMask.TYPEMASK_PLAYER; }
public Item() { GUID = new ObjectGUID(TypeID.TYPEID_ITEM, HighGUID.HIGHGUID_ITEM); }
public override async Task OnAddInRangeObject(ObjectGUID guid, IObjectImpl obj) { await BuildCreateUpdateForObject(obj); }
public virtual Task OnAddInRangeObject(ObjectGUID guid, IObjectImpl obj) { return(TaskDone.Done); }
public ObjectEntity(ObjectGUID objectGUID) : base(objectGUID) { this.Location = new Location(); }
protected UnitEntity(ObjectGUID objectGUID) : base(objectGUID) { }
public PlayerInfo(ObjectGUID guid, character databaseCharacter, ChrRaces race, ChrClasses chrClass) : base(guid) { this.Class = chrClass; this.ClassID = this.Class.ClassID; this.Gender = databaseCharacter.gender; this.Power = (byte)this.Class.PowerType; this.Race = race; this.RaceID = race.RaceID; this.FactionTemplate = race.FactionID; this.DisplayID = this.NativeDisplayID = (int)(this.Gender == 0 ? race.ModelM : race.ModelF); this.Health = (int)databaseCharacter.health; //Level = databaseCharacter.Level; this.XP = (int)databaseCharacter.xp; this.NextLevelXP = 400; Byte[] playerBytes = BitConverter.GetBytes(databaseCharacter.playerBytes); Byte[] playerBytes2 = BitConverter.GetBytes(databaseCharacter.playerBytes2); this.Skin = playerBytes[0]; this.Face = playerBytes[1]; this.HairStyle = playerBytes[2]; this.HairColor = playerBytes[3]; this.Accessory = playerBytes2[0]; FactionTemplate = race.FactionID; UnitFlag = (int)UnitFlags.UNIT_FLAG_PVP; FlagUnk = 0x08 | 0x20; WatchedFactionIndex = (int)databaseCharacter.watchedFaction; this.Money = (int)databaseCharacter.money; /* * * item_template[] equipment = ItemUtils.GenerateInventoryByIDs(Utils.CSVStringToIntArray(databaseCharacter.equipmentCache)); * VisualItems = new Item[19]; * for (byte itemSlot = 0; itemSlot < 19; itemSlot++) * { * if (equipment == null) return; * if (equipment[itemSlot] != null) * { * VisualItems[itemSlot] = new Item() * { * Creator = guid.RawGUID, * EnchantmentIDs = new[] { 0, 0 }, * Entry = equipment[itemSlot].entry, * RandomPropertyID = equipment[itemSlot].RandomProperty, * ItemSuffixFactor = 3 * }; * * } * else * { * VisualItems[itemSlot] = new Item() * { * Creator = 0, * EnchantmentIDs = new[] { 0, 0 }, * Entry = 0, * RandomPropertyID = 0, * ItemSuffixFactor = 0 * }; * } * }*/ Type |= (int)TypeMask.TYPEMASK_PLAYER; }
public GameObjectEntity(ObjectGUID objectGUID, gameobject databaseGameObject, gameobject_template template) : base(objectGUID) { this.Template = template; this.GameObject = databaseGameObject; }