Example #1
0
        private UpdatefieldFlags[] GetFlagVisibility()
        {
            TypeID myType = State.MyType;

            switch (myType)
            {
            case TypeID.TYPEID_CORPSE:
                return(UpdateVisibility.CorpseUpdateFieldFlags);

            case TypeID.TYPEID_DYNAMICOBJECT:
                return(UpdateVisibility.DynamicObjectUpdateFieldFlags);

            case TypeID.TYPEID_CONTAINER:
            case TypeID.TYPEID_ITEM:
                return(UpdateVisibility.ItemUpdateFieldFlags);

            case TypeID.TYPEID_UNIT:
                return(UpdateVisibility.UnitUpdateFieldFlags);

            case TypeID.TYPEID_PLAYER:
                return(UpdateVisibility.UnitUpdateFieldFlags);

            default:
                return(null);
            }
        }
Example #2
0
 public MissingObjectInfo(AssetArchive archive, long id, TypeID typeId) : base(archive)
 {
     this.ID     = id;
     this.TypeID = typeId;
     this.IsPotentialRedundancy = false;
     this.fingerprint           = new IdentifierFingerprint(this.ID, this.Archive == null ? "" : this.Archive.Name);
 }
Example #3
0
        void Update()
        {
            //if (Input.GetKeyDown(KeyCode.C))
            //{
            //    StartCoroutine(Start());
            //}
            //if (Input.GetKeyDown(KeyCode.S))
            //{
            //    SaveLevel();
            //}
            if (null == HeroTransform)
            {
                TypeID      entityType      = TypeID.TYPEID_BOX;
                Int64       uid             = PlayerManager.Instance.FindHeroDataModel().UID;
                EntityModel HeroEntityModel = EntityController.Instance.GetEntityModel(uid, out entityType);
                if (HeroEntityModel != null && HeroEntityModel.GO != null)
                {
                    HeroTransform = HeroEntityModel.GO.transform;
                }
            }

            if (IsShow && null != HeroTransform)
            {
                Vector3 ShowPosition = PopupTextController.GetPopupPos(HeroTransform.position + Vector3.up * 18, UICamera.mainCamera);
                CreatTipsPoint.position = ShowPosition;
            }
        }
Example #4
0
        IEnumerator Start()
        {
            yield return(null);

            //TraceUtil.Log("检测是否升级");
            TypeID      entityType      = TypeID.TYPEID_BOX;
            Int64       uid             = PlayerManager.Instance.FindHeroDataModel().UID;
            EntityModel HeroEntityModel = EntityController.Instance.GetEntityModel(uid, out entityType);

            if (HeroEntityModel != null && HeroEntityModel.GO != null && HeroUpgradeLevelData.Instance.GetLevel() != 0)
            {
                HeroTransform = HeroEntityModel.GO.transform;
                int LastLevel    = HeroUpgradeLevelData.Instance.GetLevel();
                int currentLevel = PlayerManager.Instance.FindHeroDataModel().UnitValues.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_LEVEL;
                //int currentLevel = LastLevel + 5;

                int showUpdateLevel = CommonDefineManager.Instance.CommonDefineFile._dataTable.UpgradeAnimationStartLevel;

                if (currentLevel != LastLevel && currentLevel >= showUpdateLevel)
                {
                    UIEventManager.Instance.TriggerUIEvent(UIEventType.ShowMissionFailPanelLate, null);
                    GetRoleBaseValue(LastLevel, currentLevel);
                    StartCoroutine(ShowUpGradeTipsTitle());
                }
            }
        }
Example #5
0
        /// <summary>
        /// 添加一个信息体
        /// </summary>
        /// <param name="io">信息体对象</param>
        public void AddInformationObject(InformationObject io)
        {
            if (informationObjects == null)
            {
                informationObjects = new List <InformationObject>();
            }

            if (hasTypeId)
            {
                //类型标识不同的,直接异常,不予以添加
                if (io.Type != typeId)
                {
                    throw new ArgumentException("Invalid information object type: expected " + typeId.ToString() + " was " + io.Type.ToString());
                }
            }
            else
            {
                //初始化的时候没有设置类型标识,则在赋值的时候确认类型标识
                typeId    = io.Type;
                hasTypeId = true;
            }

            //增加对象
            informationObjects.Add(io);

            //修改数量
            vsq = (byte)((vsq & 0x80) | informationObjects.Count);
        }
 public Tag(TypeID tagType, string tagName, byte[] tagData, Tag[] children)
 {
     TagType  = tagType;
     TagName  = tagName;
     TagData  = tagData;
     Children = children;
 }
Example #7
0
        /// <summary>
        /// Adds an information object to the ASDU.
        /// </summary>
        /// This function add an information object (InformationObject) to the ASDU. NOTE: that all information objects
        /// have to be of the same type. Otherwise an ArgumentException will be thrown.
        /// The function returns true when the information object has been added to the ASDU. The function returns false if
        /// there is no space left in the ASDU to add the information object, or when object cannot be added to a sequence
        /// because the IOA does not match.
        /// <returns><c>true</c>, if information object was added, <c>false</c> otherwise.</returns>
        /// <param name="io">The information object to add</param>
        public bool AddInformationObject(InformationObject io)
        {
            if (informationObjects == null)
            {
                informationObjects = new List <InformationObject>();
            }

            if (hasTypeId)
            {
                if (io.Type != typeId)
                {
                    throw new ArgumentException("Invalid information object type: expected " + typeId.ToString() + " was " + io.Type.ToString());
                }
            }
            else
            {
                typeId    = io.Type;
                hasTypeId = true;
            }

            if (informationObjects.Count >= 0x7f)
            {
                return(false);
            }

            int objectSize = io.GetEncodedSize();

            if (IsSequence == false)
            {
                objectSize += parameters.SizeOfIOA;
            }
            else
            {
                if (informationObjects.Count == 0) // is first object?
                {
                    objectSize += parameters.SizeOfIOA;
                }
                else
                {
                    if (io.ObjectAddress != (informationObjects[0].ObjectAddress + informationObjects.Count))
                    {
                        return(false);
                    }
                }
            }

            if (objectSize <= spaceLeft)
            {
                spaceLeft -= objectSize;
                informationObjects.Add(io);

                vsq = (byte)((vsq & 0x80) | informationObjects.Count);

                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #8
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((Id.GetHashCode() * 397) ^ TypeID.GetHashCode());
     }
 }
Example #9
0
 public static AgentEvent Create(TypeID _typeID)
 {
     return(new AgentEvent()
     {
         typeid = _typeID
     });
 }
Example #10
0
        public ObjectBase CreateOrGetObject(WoWGuid guid, TypeID typeid)
        {
            var key = guid.Full;
            ObjectBase obj = null;


            if (Objects[CurrentPlayerMapID].TryGetValue(key, out obj))
                return obj;
            else
            {
                switch (typeid)
                {
                    case TypeID.TYPEID_CORPSE: obj = new Corpse(this, guid, typeid); break;
                    case TypeID.TYPEID_OBJECT: obj = new GenericObject(this, guid, typeid); break;
                    case TypeID.TYPEID_ITEM: obj = new Item(this, guid, typeid); break;
                    case TypeID.TYPEID_CONTAINER: obj = new Container(this, guid, typeid); break;
                    case TypeID.TYPEID_UNIT: obj = new Unit(this, guid, typeid); break;
                    case TypeID.TYPEID_PLAYER: obj = new Player(this, guid, typeid); break;
                    case TypeID.TYPEID_GAMEOBJECT: obj = new GameObject(this, guid, typeid); break;
                    case TypeID.TYPEID_DYNAMICOBJECT: obj = new DynamicObject(this, guid, typeid); break;
                    case TypeID.TYPEID_AIGROUP: obj = new AIGroup(this, guid, typeid); break;
                    case TypeID.TYPEID_AREATRIGGER: obj = new Areatrigger(this, guid, typeid); break;
                }

                Objects[CurrentPlayerMapID].Add(key, obj);
                return obj;
            }
        }
Example #11
0
 public static AgentEvent Create(TypeID _typeID, Int64 _p1, Int64 _p2)
 {
     return(new AgentEvent()
     {
         typeid = _typeID, param1 = _p1, param2 = _p2
     });
 }
        public float TypeModifier(TypeID attacking, TypeID defending, float weakMult, float resMult)
        {
            float modifier = 1;

            if (attacking == TypeID.Typeless || defending == TypeID.Typeless)
            {
                return(modifier);
            }

            var defendingType = database[defending];

            if (defendingType._immunities.Contains(attacking))
            {
                return(0);
            }
            if (defendingType._weaknesses.Contains(attacking))
            {
                modifier *= weakMult;
            }
            if (defendingType._resistances.Contains(attacking))
            {
                modifier *= resMult;
            }

            return(modifier);
        }
Example #13
0
 public ObjectBase(Core core, WoWGuid guid, TypeID typeid)
 {
     Core = core;
     Guid = guid;
     TypeID = typeid;
     UpdateFields = new Dictionary<int, UpdateField>();
 }
Example #14
0
        public ASDU(ConnectionParameters parameters, byte[] msg, int bufPos, int msgLength)
        {
            this.parameters = parameters;

            int asduHeaderSize = 2 + parameters.SizeOfCOT + parameters.SizeOfCA;

            if ((msgLength - bufPos) < asduHeaderSize)
            {
                throw new ASDUParsingException("Message header too small");
            }

            typeId = (TypeID)msg [bufPos++];
            vsq    = msg [bufPos++];

            this.hasTypeId = true;

            byte cotByte = msg [bufPos++];

            if ((cotByte & 0x80) != 0)
            {
                isTest = true;
            }
            else
            {
                isTest = false;
            }

            if ((cotByte & 0x40) != 0)
            {
                isNegative = true;
            }
            else
            {
                isNegative = false;
            }

            cot = (CauseOfTransmission)(cotByte & 0x3f);

            if (parameters.SizeOfCOT == 2)
            {
                oa = msg [bufPos++];
            }

            ca = msg [bufPos++];

            if (parameters.SizeOfCA > 1)
            {
                ca += (msg [bufPos++] * 0x100);
            }

            int payloadSize = msgLength - bufPos;

            //TODO add plausibility check for payload length (using TypeID, SizeOfIOA, and VSQ)

            payload = new byte[payloadSize];

            /* save payload */
            Buffer.BlockCopy(msg, bufPos, payload, 0, payloadSize);
        }
Example #15
0
        public ISK GetPrice(TypeID typeId)
        {
            if (cache.ContainsKey(typeId)) return cache[typeId];

            var result = baseProvider.GetPrice(typeId);
            cache[typeId] = result;
            return result;
        }
 public ICommandProcessMessage Find(TypeID type)
 {
     if (_dictionary.ContainsKey(type))
     {
         return(_dictionary[type]);
     }
     return(null);
 }
Example #17
0
 public BuiltinObjectInfo(BuiltinArchive archive, long id, TypeID typeId, UnityEngine.Object obj) : base(archive)
 {
     this.ID     = id;
     this.TypeID = typeId;
     this.IsPotentialRedundancy = false;
     this.obj         = obj;
     this.fingerprint = new IdentifierFingerprint(this.ID, this.Archive.Name);
 }
Example #18
0
        public override int GetHashCode()
        {
            var hashCode = 969184184;

            hashCode = hashCode * -1521134295 + TypeID.GetHashCode();
            hashCode = hashCode * -1521134295 + Angle.GetHashCode();
            return(hashCode);
        }
Example #19
0
        public async Task<ISK> GetPriceAsync(TypeID typeId)
		{
            if (cache.ContainsKey(typeId)) return cache[typeId];

            var result = await baseProvider.GetPriceAsync(typeId);
            cache[typeId] = result;
            return result;
		}
Example #20
0
 public static float GetDangerValue(TypeID local, TypeID other)
 {
     if (other == TypeID.Wolf && local == TypeID.Rabbit)
     {
         return(1);
     }
     return(0);
 }
Example #21
0
        public void SendControlCommand(TypeID typeId, CauseOfTransmission cot, int ca, InformationObject sc)
        {
            ASDU controlCommand = new ASDU(parameters, cot, false, false, (byte)parameters.OriginatorAddress, ca, false);

            controlCommand.AddInformationObject(sc);

            SendASDUInternal(controlCommand);
        }
        internal IPrivateIOFactory GetFactory(TypeID typeId)
        {
            IPrivateIOFactory factory = null;

            privateTypes.TryGetValue(typeId, out factory);

            return(factory);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            TypeID typeID = db.TypeIDs.Find(id);

            db.TypeIDs.Remove(typeID);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #24
0
        public ObjectBase(Core core, WoWGuid guid, TypeID typeid)
        {
            Core = core;
            Guid = guid;
            TypeID = typeid;
            Fields = new Dictionary<int, uint>();
            MovementInfo = new MovementInfo();

        }
    public void SendEvent(object invoker, object args)
    {
        GameEvent e;

        if (eventLookup.TryGetValue(TypeID.GetID(args), out e))
        {
            e.Invoke(invoker, args);
        }
    }
Example #26
0
 public NullObjectInfo(TypeID typeId) : base(null)
 {
     this.TypeID                = typeId;
     this.ID                    = 0;
     this.IsStreamed            = false;
     this.IsBuiltin             = false;
     this.IsPotentialRedundancy = false;
     this.fingerprint           = new IdentifierFingerprint(0, "");
 }
Example #27
0
        private static uint GetIndex(TypeID type)
        {
            if (!Indexes.ContainsKey(type))
            {
                Indexes.Add(type, 1);
            }

            return(Indexes[type]++);
        }
Example #28
0
        public ObjectGUID(uint index, TypeID type, HighGUID high)
        {
            TypeID   = type;
            HighGUID = high;

            RawGUID = (ulong)((ulong)index |
                              ((ulong)type << 24) |
                              ((ulong)high << 48));
        }
Example #29
0
        public ObjectGUID(uint index, TypeID type, HighGUID high)
        {
            TypeID = type;
            HighGUID = high;

            RawGUID = (ulong)((ulong)index |
                      ((ulong)type << 24) |
                      ((ulong)high << 48));
        }
Example #30
0
        /// <summary>
        /// 使用buff初始化一个ASDU,相当于解析
        /// </summary>
        /// <param name="parameters">链接参数</param>
        /// <param name="msg">接收到的消息内容(整个报文)里面自动跳掉头了。。</param>
        /// <param name="msgLength">消息长度(整个报文的长度,包括报文头)</param>
        public ASDU(ConnectionParameters parameters, byte[] msg, int msgLength)
        {
            //保存链接参数
            this.parameters = parameters.clone();

            //跳过报文头,68H+长度(2)+68H + 链路控制域(1) + 链路地址(2)
            int bufPos = 7;

            typeId = (TypeID)msg[bufPos++];     //类型标识

            vsq = msg[bufPos++];                //可变结构限定词

            this.hasTypeId = true;

            byte cotByte = msg[bufPos++];       //传送原因

            //测试标志--0 未试验(false),1  试验(true)
            if ((cotByte & 0x80) != 0)
            {
                isTest = true;
            }
            else
            {
                isTest = false;
            }

            //确认标志,0  肯定确认(false) ,1 否定确认(true)
            if ((cotByte & 0x40) != 0)
            {
                isNegative = true;
            }
            else
            {
                isNegative = false;
            }

            //传送原因
            cot = (CauseOfTransmission)(cotByte & 0x3f);

            //电能量数据终端设备地址(2字节)
            ca = msg[bufPos++];
            if (parameters.SizeOfCA > 1)
            {
                ca += (msg[bufPos++] * 0x100);
            }

            //记录地址
            ra = (RecordAddress)msg[bufPos++];        //类型标识

            int payloadSize = msgLength - bufPos - 2; //把最后的和校验和结束符去掉

            payload = new byte[payloadSize];

            /* save payload */
            Buffer.BlockCopy(msg, bufPos, payload, 0, payloadSize);
        }
Example #31
0
 public TypeTree(ObjectArchive archive, int id, TypeID typeId, short scriptIndex, Hash128 hash, Hash128 propertiesHash) : base(null)
 {
     this.Root           = this;
     this.Archive        = archive;
     this.ID             = id;
     this.TypeID         = typeId;
     this.ScriptIndex    = scriptIndex;
     this.Hash           = hash;
     this.PropertiesHash = propertiesHash;
 }
Example #32
0
    public EntityModel GetEntityModel(Int64 uid, TypeID typeID)
    {
        EntityModel entityModel = null;

        if (m_typeMapManager.ContainsKey(typeID))
        {
            entityModel = m_typeMapManager [typeID].GetEntityMode(uid);
        }
        return(entityModel);
    }
 public ActionResult Edit([Bind(Include = "ID_Type,TypeID_name,TypeID_Description,ID_Number")] TypeID typeID)
 {
     if (ModelState.IsValid)
     {
         db.Entry(typeID).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(typeID));
 }
        object ISerializationSurrogate.SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
        {
            TypeID eid = (TypeID)info.GetValue("typeID", typeof(TypeID));

            if (eid == TypeID.Guid)
            {
                return(new Guid(info.GetValue("bits", typeof(byte[])) as byte[]));
            }
            return(null);
        }
Example #35
0
        void ReadValidTypeID(TypeID wantedTypeID)
        {
            var typeID = (TypeID)this.Reader.ReadByte();

            if (typeID != wantedTypeID)
            {
                throw new InvalidOperationException(
                          string.Format("Cannot read {0} as {1}", typeID, wantedTypeID)
                          );
            }
        }
Example #36
0
 public IParameter GetParameter(TypeID ID)
 {
     foreach (IParameter p in _parameter)
     {
         if (p.Type == ID)
         {
             return(p);
         }
     }
     return(null);
 }
        public sxPropertyDefinition(IPropertyTemplate pt)
        {
            m_def = null;
            m_desc = null;
            m_temp = pt;

            m_id = m_temp.Id.ToString();
            m_displayName = m_temp.DisplayName;
            m_name = m_temp.SymbolicName;
            m_cardinality = m_temp.Cardinality;
            m_choiceList = m_temp.ChoiceList;
            m_typeID = m_temp.DataType;
            m_hidden = m_temp.IsHidden;
            m_required = m_temp.IsValueRequired;
        }
Example #38
0
        public static string ValidateMaxUpdateFieldCount(int currentcount, TypeID typeid, ClientBuild clientbuild)
        {
            var max = 0u;
            var msg = string.Empty;
            const string msgformat = "{0} was exceeded with {1} > {2}  for build {3}";

            switch (typeid)
            {
                case TypeID.TYPEID_OBJECT:
                case TypeID.TYPEID_AIGROUP:
                case TypeID.TYPEID_AREATRIGGER:
                    {
                        max = 7;
                    } break;
                case TypeID.TYPEID_CONTAINER:
                case TypeID.TYPEID_ITEM:
                    {
                        max = GetItemUpdateFieldMax(clientbuild);
                        msg = string.Format(msgformat, "ItemUpdateFieldMax", currentcount, max, clientbuild);

                    } break;
                case TypeID.TYPEID_CORPSE:
                    {
                        max = GetCorpseUpdateFieldMax(clientbuild);
                        msg = string.Format(msgformat, "CorpseUpdateFieldMax", currentcount, max, clientbuild);

                    } break;
                case TypeID.TYPEID_DYNAMICOBJECT:
                    {
                        max = GetDynamicObjectUpdateFieldMax(clientbuild);
                        msg = string.Format(msgformat, "DynamicObjectUpdateFieldMax", currentcount, max, clientbuild);

                    } break;
                case TypeID.TYPEID_GAMEOBJECT:
                    {
                        max = GetGameObjectUpdateFieldMax(clientbuild);
                        msg = string.Format(msgformat, "GameObjectUpdateFieldMax", currentcount, max, clientbuild);
                    } break;
                case TypeID.TYPEID_UNIT:
                case TypeID.TYPEID_PLAYER:
                    {
                        max = GetUnitUpdateFieldMax(clientbuild);
                        msg = string.Format(msgformat, "UnitUpdateFieldMax", currentcount, max, clientbuild);
                    } break;
            }

            return msg;
        }
        public static List<AttributeValue> GetAttributesForType(TypeID typeId)
        {
            var query = @"
            SELECT ta.attributeID, valueInt, valueFloat, attributeName, at.description, at.displayName, at.categoryID, u.unitID, u.unitName, u.displayName, u.description
            FROM dgmTypeAttributes AS ta
            INNER JOIN dgmAttributeTypes AS at ON ta.attributeID = at.attributeID
            INNER JOIN eveUnits AS u ON at.unitID = u.unitID
            WHERE ta.typeID = "+typeId.ToInt()+@"
            LIMIT 100
            ";
            using (var cnn = new SQLiteConnection(DefaultDatabase.dbConnection))
            {
                cnn.Open();

                var reader = DefaultDatabase.RunSQLTableQuery(query, cnn);
                var results = new List<AttributeValue>();
                while (reader.Read())
                {
                    // todo: referencing columns by name doesn't seem to support names like at.description. There must be a better workaround for that
                    var unitDesc = reader[10];
                    var unitDispName = reader[9];
                    var unit = Unit.Get(new UnitID((byte)reader[7]),
                        (string)reader[8],
                        unitDispName is DBNull ? "" : (string)unitDispName,
                        unitDesc     is DBNull ? "" : (string)unitDesc);
                    var attrDispName = reader[5];
                    var attribute = new Attribute(new AttributeID((short)reader[0]),
                        (string)reader[3],
                        attrDispName is DBNull ? "" : (string)attrDispName,
                        (string)reader[4],
                        unit,
                        AttributeCategory.Get((byte)reader[6]));

                    AttributeValue value;
                    if (reader["valueFloat"] is DBNull)
                    {
                        value = new AttributeValue(attribute, (int)reader[1]);
                    }
                    else
                    {
                        value = new AttributeValue(attribute, (float)(double)reader[2]);
                    }
                    results.Add(value);
                }
                return results;
            }
        }
Example #40
0
        public static uint GetUpdateFieldMax(TypeID typeid, ClientBuild clientbuild)
        {
            uint max = 7;

            switch (typeid)
            {
                //case TypeID.TYPEID_OBJECT:
                //case TypeID.TYPEID_AIGROUP:
                //case TypeID.TYPEID_AREATRIGGER:
                //    {
                //        max = 7;
                //    } break;
                case TypeID.TYPEID_CONTAINER:
                case TypeID.TYPEID_ITEM:
                    {
                        max = GetItemUpdateFieldMax(clientbuild);


                    } break;
                case TypeID.TYPEID_CORPSE:
                    {
                        max = GetCorpseUpdateFieldMax(clientbuild);


                    } break;
                case TypeID.TYPEID_DYNAMICOBJECT:
                    {
                        max = GetDynamicObjectUpdateFieldMax(clientbuild);


                    } break;
                case TypeID.TYPEID_GAMEOBJECT:
                    {
                        max = GetGameObjectUpdateFieldMax(clientbuild);

                    } break;
                case TypeID.TYPEID_UNIT:
                case TypeID.TYPEID_PLAYER:
                    {
                        max = GetUnitUpdateFieldMax(clientbuild);

                    } break;
            }
            return max;
        }
Example #41
0
 public Unit(Core core, WoWGuid guid, TypeID typeid)
     : base(core, guid, typeid)
 {
     FactionInfoList = new Dictionary<int, FactionInfo>();
     AuraSpellIdList = new List<uint>();
 }
Example #42
0
        public Player(Core core, WoWGuid guid, TypeID typeid)
            : base(core, guid, typeid)
        {

        }
 public EveItem(string name, TypeID typeId)
     : this()
 {
     Name = name;
     TypeID = typeId;
 }
Example #44
0
        public WoWObjectBase CreateOrGetObject(UInt64 guid, TypeID typeid)
        {
            var createdObject = GetObject(guid);

            if (createdObject == null)
            {
                switch (typeid)
                {
                    case TypeID.TYPEID_ITEM:
                        createdObject = new WoWObjectItem(this, guid, typeid);
                        break;
                    case TypeID.TYPEID_CONTAINER:
                        createdObject = new WoWObjectContainer(this, guid, typeid);
                        break;
                    case TypeID.TYPEID_UNIT:
                        createdObject = new WoWObjectUnit(this, guid, typeid);
                        break;
                    case TypeID.TYPEID_PLAYER:
                        createdObject = new WoWObjectPlayer(this, guid, typeid);
                        break;
                    case TypeID.TYPEID_GAMEOBJECT:
                        createdObject = new WoWObjectGameObject(this, guid, typeid);
                        break;
                    case TypeID.TYPEID_CORPSE:
                        createdObject = new WoWObjectCorpse(this, guid, typeid);
                        break;
                    case TypeID.TYPEID_DYNAMICOBJECT:
                        createdObject = new WoWObjectDynamicObject(this, guid, typeid);
                        break;
                    default:
                        throw new Exception(string.Format("CreateOrGetObject Unknown TypeID {0}.", typeid));
                }

                ObjList.Add(guid, createdObject);

            }
            return createdObject;
        }
Example #45
0
 public GameObject(Core core, WoWGuid guid, TypeID typeid)
     : base(core, guid, typeid)
 {
 }
Example #46
0
 public Container(Core core, WoWGuid guid, TypeID typeid)
     : base(core, guid, typeid)
 {
 }
 private void UpdateMovement(int index, TypeID typeid, WoWGuid guid)
 {
     var obj = Core.GetObjectByWoWGuid(guid);
     UpdateMovement(index, obj, typeid);
 }
Example #48
0
 public Unit(Core core, WoWGuid guid, TypeID typeid)
     : base(core, guid, typeid)
 {
     PhaseMask = core.CurrentPlayerPhaseMask;
     FactionInfos = new Dictionary<int, CacheObjects.FactionInfo>();
 }
Example #49
0
            public void HandleUpdatePacket(InPacket packet)
            {
                blockCount = packet.ReadUInt32();
                for (int blockIndex = 0; blockIndex < blockCount; blockIndex++)
                {
                    ResetData();

                    updateType = (ObjectUpdateType)packet.ReadByte();

                    switch (updateType)
                    {
                        case ObjectUpdateType.UPDATETYPE_VALUES:
                            guid = packet.ReadPackedGuid();
                            ReadValuesUpdateData(packet);
                            break;
                        case ObjectUpdateType.UPDATETYPE_MOVEMENT:
                            guid = packet.ReadPackedGuid();
                            ReadMovementUpdateData(packet);
                            break;
                        case ObjectUpdateType.UPDATETYPE_CREATE_OBJECT:
                        case ObjectUpdateType.UPDATETYPE_CREATE_OBJECT2:
                            guid = packet.ReadPackedGuid();
                            objectType = (TypeID)packet.ReadByte();
                            ReadMovementUpdateData(packet);
                            ReadValuesUpdateData(packet);
                            break;
                        case ObjectUpdateType.UPDATETYPE_OUT_OF_RANGE_OBJECTS:
                            var guidCount = packet.ReadUInt32();
                            for (var guidIndex = 0; guidIndex < guidCount; guidIndex++)
                                outOfRangeGuids.Add(packet.ReadPackedGuid());
                            break;
                        case ObjectUpdateType.UPDATETYPE_NEAR_OBJECTS:
                            break;
                    }

                    HandleUpdateData();
                }
            }
 public static string GetTypeDescription(TypeID typeId)
 {
     var query = @"select description from invTypes where typeID = " + typeId + ";";
     return DefaultDatabase.RunSQLStringQuery(query);
 }
Example #51
0
 public Item(Core core, WoWGuid guid, TypeID typeid)
     : base(core, guid, typeid)
 {
 }
 public static string GetTypeName(TypeID typeId)
 {
     var query = @"select typeName from invTypes where typeID = " + typeId + ";";
     return DefaultDatabase.RunSQLStringQuery(query);
 }
Example #53
0
 public Areatrigger(Core core, WoWGuid guid, TypeID typeid)
     : base(core, guid, typeid)
 {
 }
Example #54
0
 private static IHtspType ParseField(TypeID fType, byte[] bin, int offset, int valLen)
 {
     switch(fType) {
         case TypeID.MAP: {
             byte[] bVal = new byte[valLen];
             Buffer.BlockCopy(bin, offset, bVal, 0, valLen);
             Message msg = new Message(bVal, 0, valLen);
             return new HtspType<Message>(msg);
         }
         case TypeID.S64: {
             return new HtspType<long>(ParseIntField(bin, offset, valLen));
         }
         case TypeID.STR: {
             return new HtspType<string>(Encoding.UTF8.GetString(bin,offset,valLen));
         }
         case TypeID.BIN: {
             byte[] bVal = new byte[valLen];
             Buffer.BlockCopy(bin, offset, bVal, 0, valLen);
             return new HtspType<byte[]>(bVal);
         }
         case TypeID.LIST: {
             HtspListType<IHtspBaseType> list = new HtspListType<IHtspBaseType>(16);
             int lOffset = 0;
             while (lOffset < valLen) {
                 TypeID lfType = (TypeID)bin[offset + lOffset++];
                 int lNameLen = bin[offset + lOffset++];
                 int lValLen = ParseValueLength(bin, offset + lOffset);
                 lOffset += 4;
                 // listfields dont have a name! we should probaly check that.
                 //string name = Encoding.UTF8.GetString(bin,offset + lOffset,nameLen);
                 lOffset += lNameLen;
                 list.Add((IHtspBaseType)ParseField(lfType, bin, offset + lOffset, lValLen));
                 lOffset += lValLen;
             }
             return list;
         }
         default: {
             Console.WriteLine("MessageType ({0}) not implented yet!", fType);
             /*
             byte[] bVal = new byte[valLen];
             Buffer.BlockCopy(bin, offset, bVal, 0, valLen);
             Console.WriteLine(BitConverter.ToString(bVal));
             */
             return null;
         }
     }
 }
        private void UpdateMovement(int index, ObjectBase obj, TypeID typeid)
        {
            #if DEBUG
            SetBookmarkPosition();

            GotoBookmarkPosition();
            #endif
            if (obj.MovementInfo == null) obj.MovementInfo = new MovementInfo();

            if (ClientBuildAmount > 9551)
            {
                obj.MovementInfo.UpdateFlags = ReadUInt16_OBJECT_UPDATE_FLAGS(index, "UpdateFlags");
            }
            else
            {
                obj.MovementInfo.UpdateFlags = ReadByte_OBJECT_UPDATE_FLAGS(index, "UpdateFlags");
            }

            // 0x20
            if ((obj.MovementInfo.UpdateFlags & OBJECT_UPDATE_FLAGS.UPDATEFLAG_LIVING) != 0)
            {
                obj.MovementInfo.MoveFlag = ReadUInt32_MoveFlag(index, "MoveFlag");

                if (ClientBuildAmount >= 7561 && ClientBuildAmount < 9183)
                {
                    obj.MovementInfo.MoveFlagExtra = ReadByte_MoveFlagExtra(index, "MoveFlagExtra");   // unk 2.3.0
                }
                else if (ClientBuildAmount >= 9183)
                {
                    obj.MovementInfo.MoveFlagExtra = ReadUInt16_MoveFlagExtra(index, "MoveFlagExtra");
                }

                obj.MovementInfo.TimeStamp = ReadUInt32(index, "TimeStamp");

                obj.MovementInfo.PositionInfo = ReadVector4(index, "PositionInfo");

                if ((obj.MovementInfo.MoveFlag & MoveFlag.OnTransport) != 0)
                {
                    obj.MovementInfo.TransportInfo = ReadMovementTransport(index, "OnTransport", obj.MovementInfo.MoveFlagExtra.Value.HasFlag(MoveFlagExtra.InterpolatedPlayerMovement));
                }

                if (obj.MovementInfo.MoveFlag.Value.HasAnyFlag(MoveFlag.Swimming | MoveFlag.Flying) || obj.MovementInfo.MoveFlagExtra.Value.HasFlag(MoveFlagExtra.AlwaysAllowPitching))
                {
                    obj.MovementInfo.SwimPitch = ReadFloat(index, "SwimPitch");
                }

                obj.MovementInfo.FallTime = ReadUInt32(index, "FallTime");

                if (obj.MovementInfo.MoveFlag.Value.HasFlag(MoveFlag.Falling))
                {
                    obj.MovementInfo.JumpInfo = ReadMovementJump(index, "FallingJumpInfo");
                }

                if (obj.MovementInfo.MoveFlag.Value.HasFlag(MoveFlag.SplineElevation))
                {
                    obj.MovementInfo.SplineElevation = ReadFloat(index, "SplineElevation");
                }

                if (ClientBuildAmount >= 9183)
                    obj.MovementInfo.Speeds = new SortedList<string, float>(9);
                else
                    obj.MovementInfo.Speeds = new SortedList<string, float>(8);

                for (byte i = 0; i < obj.MovementInfo.Speeds.Capacity; ++i)
                    obj.MovementInfo.Speeds.Add(i.ToString(), ReadFloat(index, i, "Speed"));

                if (obj.MovementInfo.MoveFlag.Value.HasFlag(MoveFlag.SplineEnabled))
                {
                    obj.MovementInfo.SplineInfo.SplineFlags = ReadInt32_SplineFlags(index, "SplineFlags");

                    if (obj.MovementInfo.SplineInfo.SplineFlags.HasFlag(SplineFlag.FinalPoint))
                    {
                        obj.MovementInfo.SplineInfo.SplinePoint = ReadVector3(index, "SplinePoint");
                    }

                    if (obj.MovementInfo.SplineInfo.SplineFlags.HasFlag(SplineFlag.FinalTarget))
                    {
                        obj.MovementInfo.SplineInfo.SplineFinalTargetGuid = ReadInt64(index, "SplineFinalTargetGuid");
                    }

                    if (obj.MovementInfo.SplineInfo.SplineFlags.HasFlag(SplineFlag.FinalOrientation))
                    {
                        obj.MovementInfo.SplineInfo.SplineRotation = ReadFloat(index, "splineRotation");
                    }

                    if (obj.MovementInfo.SplineInfo.SplineFlags.HasFlag(SplineFlag.CatmullRom))
                    {
                        obj.MovementInfo.SplineInfo.SplineRotation = ReadFloat(index, "splineRotation");
                    }

                    obj.MovementInfo.SplineInfo.SplineCurTime = ReadUInt32(index, "splineCurTime");
                    obj.MovementInfo.SplineInfo.SplineFullTime = ReadUInt32(index, "splineFullTime");
                    obj.MovementInfo.SplineInfo.SplineUnk1 = ReadUInt32(index, "splineUnk1");

                    if (ClientBuildAmount >= 9767)
                    {

                        obj.MovementInfo.SplineInfo.SplineDurationMultiplier = ReadFloat(index, "splineDurationMultiplier");//3.1
                        obj.MovementInfo.SplineInfo.SplineUnitInterval = ReadFloat(index, "splineUnitInterval");//3.1
                        obj.MovementInfo.SplineInfo.SplineUnkFloat2 = ReadFloat(index, "splineUnkFloat2");//3.1
                        obj.MovementInfo.SplineInfo.SplineHeightTime = ReadUInt32(index, "splineHeightTime"); //3.1
                    }
                    else
                    {
                        if (obj.MovementInfo.SplineInfo.SplineFlags.HasFlag(SplineFlag.FinalOrientation))
                        {
                            obj.MovementInfo.SplineInfo.SplineUnkFloat2 = ReadFloat(index, "splineUnkFloat2");
                        }
                    }

                    obj.MovementInfo.SplineInfo.SplineCount = ReadUInt32(index, "splineCount");
                    obj.MovementInfo.SplineInfo.Splines = new SortedList<int, Vector3>();

                    for (int i = 0; i < obj.MovementInfo.SplineInfo.SplineCount; ++i)
                    {
                        obj.MovementInfo.SplineInfo.Splines.Add(i, ReadVector3(index, i, "Spline"));
                    }

                    if (ClientBuildAmount >= 9464)
                    {
                        obj.MovementInfo.SplineInfo.SplineMode = ReadByte_SplineMode(index, "SplineMode");  // added in 3.0.8
                    }

                    obj.MovementInfo.SplineInfo.SplineEndPoint = ReadVector3(index, "SplineEndPoint");
                }
            }
            else
            {
                // 0x100
                if ((obj.MovementInfo.UpdateFlags & OBJECT_UPDATE_FLAGS.UPDATEFLAG_POSITION) != 0)
                {
                    obj.MovementInfo.Guid_0x100 = ReadPackedWoWGuid(index, "Guid_0x100");
                    obj.MovementInfo.PositionInfo_0x100 = ReadVector3(index, "PositionInfo_0x100");
                    obj.MovementInfo.PositionInfo_0x100_2 = ReadVector4(index, "PositionInfo_0x100_2");
                    obj.MovementInfo.UnknownFloat_0x100 = ReadFloat(index, "UnknownFloat_0x100");
                }
                else
                {
                    // 0x40
                    if ((obj.MovementInfo.UpdateFlags & OBJECT_UPDATE_FLAGS.UPDATEFLAG_HAS_POSITION) != 0)
                    {
                        obj.MovementInfo.PositionInfo_0x40 = ReadVector4(index, "PositionInfo_0x40");
                    }
                }
            }

            if ((obj.MovementInfo.UpdateFlags & OBJECT_UPDATE_FLAGS.UPDATEFLAG_LOWGUID) != 0)
            {
                obj.MovementInfo.LowGuid = ReadInt32(index, "LowGuid");
            }

            if ((obj.MovementInfo.UpdateFlags & OBJECT_UPDATE_FLAGS.UPDATEFLAG_HIGHGUID) != 0)
            {
                obj.MovementInfo.HighGuid = ReadInt32(index, "HighGuid");
            }

            if ((obj.MovementInfo.UpdateFlags & OBJECT_UPDATE_FLAGS.UPDATEFLAG_HAS_TARGET) != 0)
            {
                obj.MovementInfo.FullGuid = ReadPackedWoWGuid(index, "FullGuid");
            }

            if ((obj.MovementInfo.UpdateFlags & OBJECT_UPDATE_FLAGS.UPDATEFLAG_TRANSPORT) != 0)
            {
                obj.MovementInfo.TransportTime = ReadUInt32(index, "TransportTime");
            }

            if (ClientBuildAmount >= 9183 && (obj.MovementInfo.UpdateFlags & OBJECT_UPDATE_FLAGS.UPDATEFLAG_VEHICLE) != 0)
            {
                obj.MovementInfo.VehicleId = ReadInt32(index, "VehicleId");
                obj.MovementInfo.FacingAdjustement = ReadFloat(index, "FacingAdjustement");
            }

            if ((obj.MovementInfo.UpdateFlags & OBJECT_UPDATE_FLAGS.UPDATEFLAG_ROTATION) != 0)
            {
                obj.MovementInfo.GameObjectRotation = ReadPackedQuaternion(index, "GameObjectRotation");
            }
        }
Example #56
0
 public ObjectGUID(TypeID type, HighGUID high)
     : this(GetIndex(type), type, high)
 {
 }
Example #57
0
 public DynamicObject(Core core, WoWGuid guid, TypeID typeid)
     : base(core, guid, typeid)
 {
 }
Example #58
0
 public GameObject(Core core, WoWGuid guid, TypeID typeid)
     : base(core, guid, typeid)
 {
     PhaseMask = core.CurrentPlayerPhaseMask;
     MapID = core.CurrentPlayerMapID;
 }
Example #59
0
        private static uint GetIndex(TypeID type)
        {
            if (!Indexes.ContainsKey(type)) Indexes.Add(type, 1);

            return Indexes[type]++;
        }
Example #60
0
 public ObjectGUID(ulong GUID, TypeID type)
 {
     RawGUID = GUID;
     TypeID = type;
 }