public static string GetDescription(this PropertyInt prop) { var description = prop.GetAttributeOfType <DescriptionAttribute>(); return(description?.Description ?? prop.ToString()); }
public static string GetValueEnumName(this PropertyInt property, int value) { switch (property) { case PropertyInt.ActivationResponse: return(System.Enum.GetName(typeof(ActivationResponse), value)); case PropertyInt.AetheriaBitfield: return(System.Enum.GetName(typeof(AetheriaBitfield), value)); case PropertyInt.AttackHeight: return(System.Enum.GetName(typeof(AttackHeight), value)); case PropertyInt.AttackType: return(System.Enum.GetName(typeof(AttackType), value)); case PropertyInt.Attuned: return(System.Enum.GetName(typeof(AttunedStatus), value)); case PropertyInt.AmmoType: return(System.Enum.GetName(typeof(AmmoType), value)); case PropertyInt.Bonded: return(System.Enum.GetName(typeof(BondedStatus), value)); case PropertyInt.ChannelsActive: case PropertyInt.ChannelsAllowed: return(System.Enum.GetName(typeof(Channel), value)); case PropertyInt.CombatMode: return(System.Enum.GetName(typeof(CombatMode), value)); case PropertyInt.DefaultCombatStyle: case PropertyInt.AiAllowedCombatStyle: return(System.Enum.GetName(typeof(CombatStyle), value)); case PropertyInt.CombatUse: return(System.Enum.GetName(typeof(CombatUse), value)); case PropertyInt.ClothingPriority: return(System.Enum.GetName(typeof(CoverageMask), value)); case PropertyInt.CreatureType: case PropertyInt.SlayerCreatureType: case PropertyInt.FoeType: case PropertyInt.FriendType: return(System.Enum.GetName(typeof(CreatureType), value)); case PropertyInt.DamageType: return(System.Enum.GetName(typeof(DamageType), value)); case PropertyInt.CurrentWieldedLocation: case PropertyInt.ValidLocations: return(System.Enum.GetName(typeof(EquipMask), value)); case PropertyInt.EquipmentSetId: return(System.Enum.GetName(typeof(EquipmentSet), value)); case PropertyInt.Gender: return(System.Enum.GetName(typeof(Gender), value)); case PropertyInt.GeneratorDestructionType: case PropertyInt.GeneratorEndDestructionType: return(System.Enum.GetName(typeof(GeneratorDestruct), value)); case PropertyInt.GeneratorTimeType: return(System.Enum.GetName(typeof(GeneratorTimeType), value)); case PropertyInt.GeneratorType: return(System.Enum.GetName(typeof(GeneratorType), value)); case PropertyInt.HeritageGroup: return(System.Enum.GetName(typeof(HeritageGroup), value)); case PropertyInt.HookType: return(System.Enum.GetName(typeof(HookType), value)); case PropertyInt.HouseType: return(System.Enum.GetName(typeof(HouseType), value)); case PropertyInt.ImbuedEffect: case PropertyInt.ImbuedEffect2: case PropertyInt.ImbuedEffect3: case PropertyInt.ImbuedEffect4: case PropertyInt.ImbuedEffect5: return(System.Enum.GetName(typeof(ImbuedEffectType), value)); case PropertyInt.HookItemType: case PropertyInt.ItemType: case PropertyInt.MerchandiseItemTypes: case PropertyInt.TargetType: return(System.Enum.GetName(typeof(ItemType), value)); case PropertyInt.ItemXpStyle: return(System.Enum.GetName(typeof(ItemXpStyle), value)); case PropertyInt.MaterialType: return(System.Enum.GetName(typeof(MaterialType), value)); case PropertyInt.PaletteTemplate: return(System.Enum.GetName(typeof(PaletteTemplate), value)); case PropertyInt.PhysicsState: return(System.Enum.GetName(typeof(PhysicsState), value)); case PropertyInt.HookPlacement: case PropertyInt.Placement: return(System.Enum.GetName(typeof(Placement), value)); case PropertyInt.PortalBitmask: return(System.Enum.GetName(typeof(PortalBitmask), value)); case PropertyInt.PlayerKillerStatus: return(System.Enum.GetName(typeof(PlayerKillerStatus), value)); case PropertyInt.BoosterEnum: return(System.Enum.GetName(typeof(PropertyAttribute2nd), value)); case PropertyInt.ShowableOnRadar: return(System.Enum.GetName(typeof(RadarBehavior), value)); case PropertyInt.RadarBlipColor: return(System.Enum.GetName(typeof(RadarColor), value)); case PropertyInt.WeaponSkill: case PropertyInt.WieldSkillType: case PropertyInt.WieldSkillType2: case PropertyInt.WieldSkillType3: case PropertyInt.WieldSkillType4: return(System.Enum.GetName(typeof(Skill), value)); case PropertyInt.AccountRequirements: return(System.Enum.GetName(typeof(SubscriptionStatus), value)); case PropertyInt.SummoningMastery: return(System.Enum.GetName(typeof(SummoningMastery), value)); case PropertyInt.UiEffects: return(System.Enum.GetName(typeof(UiEffects), value)); case PropertyInt.ItemUseable: return(System.Enum.GetName(typeof(Usable), value)); case PropertyInt.WeaponType: return(System.Enum.GetName(typeof(WeaponType), value)); case PropertyInt.WieldRequirements: case PropertyInt.WieldRequirements2: case PropertyInt.WieldRequirements3: case PropertyInt.WieldRequirements4: return(System.Enum.GetName(typeof(WieldRequirement), value)); case PropertyInt.GeneratorStartTime: case PropertyInt.GeneratorEndTime: return(DateTimeOffset.FromUnixTimeSeconds(value).DateTime.ToUniversalTime().ToString(CultureInfo.InvariantCulture)); case PropertyInt.ArmorType: return(System.Enum.GetName(typeof(ArmorType), value)); case PropertyInt.ParentLocation: return(System.Enum.GetName(typeof(ParentLocation), value)); case PropertyInt.PlacementPosition: return(System.Enum.GetName(typeof(Placement), value)); case PropertyInt.HouseStatus: return(System.Enum.GetName(typeof(HouseStatus), value)); } return(null); }
public static int?GetProperty(this Weenie weenie, PropertyInt property) { return(weenie.WeeniePropertiesInt.FirstOrDefault(x => x.Type == (uint)property)?.Value); }
public static List <string> BuildScript(MutationFilter mutationFilter, int tSysMutationFilter) { var lines = new List <string>(); for (var mutationIdx = 0; mutationIdx < mutationFilter.Mutations.Count; mutationIdx++) { var mutation = mutationFilter.Mutations[mutationIdx]; lines.Add($"0x{tSysMutationFilter:X8} Mutation #{mutationIdx + 1}:"); lines.Add(""); lines.Add($"Tier chances: {string.Join(", ", mutation.Chances)}"); lines.Add(""); foreach (var outcome in mutation.Outcomes) { for (var effectListIdx = 0; effectListIdx < outcome.EffectLists.Count; effectListIdx++) { var effectList = outcome.EffectLists.ElementAt(effectListIdx); lines.Add($" - Chance {effectList.Chance}:"); for (var effectIdx = 0; effectIdx < effectList.Effects.Count; effectIdx++) { var effect = effectList.Effects.ElementAt(effectIdx); //lines.Add($" - EffectType: {(MutationEffectType)effect.EffectType}"); var curLine = ""; PropertyInt propInt = 0; var args = new List <EffectArgument>(); if (effect.Quality != null) { args.Add(effect.Quality); } if (effect.Arg1 != null) { args.Add(effect.Arg1); } if (effect.Arg2 != null) { args.Add(effect.Arg2); } for (var argIdx = 0; argIdx < args.Count; argIdx++) { var _arg = args.ElementAt(argIdx); if (argIdx == 0) { curLine += " "; } if (argIdx == 1) { switch (effect.Type) { case MutationEffectType.Assign: case MutationEffectType.AssignAdd: case MutationEffectType.AssignSubtract: case MutationEffectType.AssignMultiply: case MutationEffectType.AssignDivide: curLine += " = "; break; case MutationEffectType.Add: case MutationEffectType.AddMultiply: case MutationEffectType.AddDivide: curLine += " += "; break; case MutationEffectType.Subtract: case MutationEffectType.SubtractMultiply: case MutationEffectType.SubtractDivide: curLine += " -= "; break; case MutationEffectType.Multiply: curLine += " *= "; break; case MutationEffectType.Divide: curLine += " /= "; break; case MutationEffectType.AtLeastAdd: curLine += " >= "; break; case MutationEffectType.AtMostSubtract: curLine += " <= "; break; } } if (argIdx == 2) { switch (effect.Type) { case MutationEffectType.AssignAdd: curLine += " + "; break; case MutationEffectType.AssignSubtract: curLine += " - "; break; case MutationEffectType.AssignMultiply: case MutationEffectType.AddMultiply: case MutationEffectType.SubtractMultiply: curLine += " * "; break; case MutationEffectType.AssignDivide: case MutationEffectType.AddDivide: case MutationEffectType.SubtractDivide: curLine += " / "; break; case MutationEffectType.AtLeastAdd: curLine += ", add "; break; case MutationEffectType.AtMostSubtract: curLine += ", sub "; break; } } var arg = new EffectArgument(_arg); switch (arg.Type) { case EffectArgumentType.Int: if (argIdx == 1 && propInt == PropertyInt.WieldRequirements) { curLine += $"{(WieldRequirement)arg.IntVal}"; } else { curLine += $"{arg.IntVal}"; } break; case EffectArgumentType.Double: curLine += $"{arg.DoubleVal}"; break; case EffectArgumentType.Quality: switch (arg.StatType) { case StatType.Int: curLine += $"{(PropertyInt)arg.StatIdx}"; if (argIdx == 0) { propInt = (PropertyInt)arg.StatIdx; } break; case StatType.Bool: curLine += $"{(PropertyBool)arg.StatIdx}"; break; case StatType.Float: curLine += $"{(PropertyFloat)arg.StatIdx}"; break; case StatType.DID: curLine += $"{(PropertyDataId)arg.StatIdx}"; break; default: curLine += $"Unknown StatType: {arg.StatType}, StatIdx: {arg.StatIdx}"; break; } break; case EffectArgumentType.Random: curLine += $"Random({arg.MinVal}, {arg.MaxVal})"; break; case EffectArgumentType.Variable: curLine += $"Variable[{arg.IntVal}]"; break; default: curLine += $"Unknown EffectArgumentType: {arg.Type}"; break; } } lines.Add(curLine); } lines.Add(""); } } } return(lines); }
public byte[] GetNextSequence(SequenceType type, PropertyInt property) { return(GetSequence(type, (uint)property).NextBytes); }
public void SetPropertyInt(PropertyInt property, uint value) { Debug.Assert(property < PropertyInt.Count, "Invalid Property."); propertiesInt[property] = value; }
/// <summary> /// This is used to /// </summary> /// <param name="sequences"></param> /// <param name="sender"></param> /// <param name="property"></param> /// <param name="value"></param> public GameMessagePublicUpdatePropertyInt(SequenceManager sequences, ObjectGuid sender, PropertyInt property, uint value) : base(GameMessageOpcode.PublicUpdatePropertyInt, GameMessageGroup.Group09) { Writer.Write(sequences.GetNextSequence(SequenceType.PublicUpdatePropertyInt)); Writer.Write(sender.Full); Writer.Write((uint)property); Writer.Write(value); }
public void SetPropertyInt(PropertyInt property, uint value, bool packet = false) { Debug.Assert(property < PropertyInt.Count); propertiesInt[property] = value; }
public int?GetProperty(PropertyInt property) { return(Biota.GetProperty(property, BiotaDatabaseLock)); }
public static int? GetProperty(this Biota biota, PropertyInt property) { return biota.BiotaPropertiesInt.FirstOrDefault(x => x.Type == (uint)property)?.Value; }
public void ContributeValuesToTreeView(TreeNode rootNode) { switch (opcode) { case PacketOpcode.Evt_Qualities__PrivateUpdateInt_ID: case PacketOpcode.Evt_Qualities__UpdateInt_ID: PropertyInt.contributeToTreeNode(rootNode, this); break; case PacketOpcode.Evt_Qualities__PrivateUpdateInt64_ID: case PacketOpcode.Evt_Qualities__UpdateInt64_ID: rootNode.Nodes.Add("val = " + (long)val); ContextInfo.AddToList(new ContextInfo { Length = 8 }); break; case PacketOpcode.Evt_Qualities__PrivateUpdateBool_ID: case PacketOpcode.Evt_Qualities__UpdateBool_ID: rootNode.Nodes.Add("val = " + Convert.ToBoolean(val)); ContextInfo.AddToList(new ContextInfo { Length = 4 }); break; case PacketOpcode.Evt_Qualities__PrivateUpdateFloat_ID: case PacketOpcode.Evt_Qualities__UpdateFloat_ID: rootNode.Nodes.Add("val = " + (double)val); ContextInfo.AddToList(new ContextInfo { Length = 8 }); break; case PacketOpcode.Evt_Qualities__PrivateUpdateDataID_ID: case PacketOpcode.Evt_Qualities__UpdateDataID_ID: rootNode.Nodes.Add("val = " + Utility.FormatHex((uint)val)); ContextInfo.AddToList(new ContextInfo { Length = 4, DataType = DataType.DataID }); break; case PacketOpcode.Evt_Qualities__PrivateUpdateInstanceID_ID: case PacketOpcode.Evt_Qualities__UpdateInstanceID_ID: rootNode.Nodes.Add("val = " + Utility.FormatHex((uint)val)); ContextInfo.AddToList(new ContextInfo { Length = 4, DataType = DataType.ObjectID }); break; case PacketOpcode.Evt_Qualities__PrivateUpdateSkillLevel_ID: case PacketOpcode.Evt_Qualities__UpdateSkillLevel_ID: case PacketOpcode.Evt_Qualities__PrivateUpdateAttributeLevel_ID: case PacketOpcode.Evt_Qualities__UpdateAttributeLevel_ID: case PacketOpcode.Evt_Qualities__PrivateUpdateAttribute2ndLevel_ID: case PacketOpcode.Evt_Qualities__UpdateAttribute2ndLevel_ID: rootNode.Nodes.Add("val = " + (int)val); ContextInfo.AddToList(new ContextInfo { Length = 4 }); break; case PacketOpcode.Evt_Qualities__PrivateUpdateSkillAC_ID: case PacketOpcode.Evt_Qualities__UpdateSkillAC_ID: rootNode.Nodes.Add("val = " + val); ContextInfo.AddToList(new ContextInfo { Length = 4 }); break; default: var valNode = rootNode.Nodes.Add(val.GetType().Name + " = "); ContextInfo.AddToList(new ContextInfo { Length = valLength }, updateDataIndex: false); var methodInfo = val.GetType().GetMethod("contributeToTreeNode"); var args = new object[] { valNode }; methodInfo.Invoke(val, args); break; } }
public void SetProperty(PropertyInt propInt, int?value) { }
public int?GetProperty(PropertyInt propInt) { return(null); }
public static PersistedPropertyAttribute GetPersistedPropertyAttribute(this PropertyInt val) { return(Enum.EnumHelper.GetAttributeOfType <PersistedPropertyAttribute>(val)); }
public byte[] GetCurrentSequence(SequenceType type, PropertyInt property) { return(GetSequence(type, (uint)property).CurrentBytes); }
protected string GetValueEnumName(PropertyInt property, int value) { switch (property) { case PropertyInt.ActivationCreateClass: if (WeenieNames != null) { WeenieNames.TryGetValue((uint)value, out var propertyValueDescription); return(propertyValueDescription); } break; case PropertyInt.ActivationResponse: return(((ActivationResponse)value).ToString()); case PropertyInt.AetheriaBitfield: return(((AetheriaBitfield)value).ToString()); case PropertyInt.AiAllowedCombatStyle: return(((CombatStyle)value).ToString()); case PropertyInt.AttackType: return(((AttackType)value).ToString()); case PropertyInt.ChannelsActive: case PropertyInt.ChannelsAllowed: return(((Channel)value).ToString()); case PropertyInt.ClothingPriority: return(((CoverageMask)value).ToString()); case PropertyInt.CurrentWieldedLocation: return(((EquipMask)value).ToString()); case PropertyInt.DamageType: return(((DamageType)value).ToString()); case PropertyInt.DefaultCombatStyle: return(((CombatStyle)value).ToString()); case PropertyInt.HookType: return(((HookType)value).ToString()); case PropertyInt.ImbuedEffect: case PropertyInt.ImbuedEffect2: case PropertyInt.ImbuedEffect3: case PropertyInt.ImbuedEffect4: return(((ImbuedEffectType)value).ToString()); case PropertyInt.ItemUseable: return(((Usable)value).ToString()); case PropertyInt.MerchandiseItemTypes: return(((ItemType)value).ToString()); case PropertyInt.PhysicsState: return(((PhysicsState)value).ToString()); case PropertyInt.PortalBitmask: return(((PortalBitmask)value).ToString()); case PropertyInt.SlayerCreatureType: return(((CreatureType)value).ToString()); case PropertyInt.TargetType: return(((ItemType)value).ToString()); case PropertyInt.UiEffects: return(((UiEffects)value).ToString()); case PropertyInt.ValidLocations: return(((EquipMask)value).ToString()); case PropertyInt.WieldRequirements: case PropertyInt.WieldRequirements2: case PropertyInt.WieldRequirements3: case PropertyInt.WieldRequirements4: return(((WieldRequirement)value).ToString()); case PropertyInt.CombatTactic: case PropertyInt.HomesickTargetingTactic: case PropertyInt.TargetingTactic: return(((TargetingTactic)value).ToString()); case PropertyInt.Tolerance: return(((Tolerance)value).ToString()); case PropertyInt.AiOptions: return(((AiOption)value).ToString()); } return(property.GetValueEnumName(value)); }
public void RequireEnterGameServer(NFCoreEx.NFIDENTID objectID, string strAccount, string strRoleName, int nServerID) { NFMsg.ReqEnterGameServer xData = new NFMsg.ReqEnterGameServer(); xData.name = UnicodeEncoding.Default.GetBytes(strRoleName); xData.account = UnicodeEncoding.Default.GetBytes(strAccount); xData.game_id = nServerID; xData.id = NFToPB(objectID); MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ReqEnterGameServer>(stream, xData); SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_ENTER_GAME, stream); if (NFStart.Instance.bDebugMode) { //EGMI_ACK_OBJECT_ENTRY //property //EGMI_ACK_SWAP_SCENE //EGMI_ACK_OBJECT_ENTRY //property float fX = 0.0f; float fY = 0.0f; float fZ = 0.0f; NFIElement xElement = NFCElementManager.Instance.GetElement("1"); if (null != xElement) { string strRelivePos = xElement.QueryString("RelivePos"); string[] sArray = strRelivePos.Split(';'); if (sArray.Length > 0) { sArray = sArray[0].Split(','); } if (sArray.Length == 3) { fX = float.Parse(sArray[0]); fY = float.Parse(sArray[1]); fZ = float.Parse(sArray[2]); } } ///////////////////////////////////////////// //mainplayer NFMsg.AckPlayerEntryList xAckMainBodyData = new NFMsg.AckPlayerEntryList(); NFMsg.PlayerEntryInfo xInfo = new NFMsg.PlayerEntryInfo(); NFMsg.Ident xID = new NFMsg.Ident(); xInfo.object_guid = xID; xInfo.x = fX; xInfo.y = fY; xInfo.z = fZ; xInfo.career_type = 1; xInfo.player_state = 1; xInfo.config_id = UnicodeEncoding.Default.GetBytes(""); xInfo.scene_id = 1; xInfo.class_id = UnicodeEncoding.Default.GetBytes("Player"); xAckMainBodyData.object_list.Add(xInfo); MemoryStream xAckMianPlayerBodyStream = new MemoryStream(); Serializer.Serialize <NFMsg.AckPlayerEntryList>(xAckMianPlayerBodyStream, xAckMainBodyData); NFMsg.MsgBase xAckMianPlayerData = new NFMsg.MsgBase(); xAckMianPlayerData.player_id = xID; xAckMianPlayerData.msg_data = xAckMianPlayerBodyStream.ToArray(); MemoryStream xAckAllStream = new MemoryStream(); Serializer.Serialize <NFMsg.MsgBase>(xAckAllStream, xAckMianPlayerData); MsgHead head = new MsgHead(); head.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_OBJECT_ENTRY; head.unDataLen = (UInt32)xAckAllStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; xNet.mxBinMsgEvent.OnMessageEvent(head, xAckAllStream.ToArray()); ///////////////////////////////////////////// //property NFMsg.ObjectPropertyInt propertyData = new NFMsg.ObjectPropertyInt(); PropertyInt xPropertyInt = new PropertyInt(); xPropertyInt.property_name = UnicodeEncoding.Default.GetBytes("MOVE_SPEED"); xPropertyInt.data = 50000; propertyData.property_list.Add(xPropertyInt); propertyData.player_id = xID; MemoryStream xAckPropertyIntStream = new MemoryStream(); Serializer.Serialize <NFMsg.ObjectPropertyInt>(xAckPropertyIntStream, propertyData); NFMsg.MsgBase xPropertyIntMsg = new NFMsg.MsgBase(); xPropertyIntMsg.player_id = xID; xPropertyIntMsg.msg_data = xAckPropertyIntStream.ToArray(); MemoryStream xAckPropertyIntAllStream = new MemoryStream(); Serializer.Serialize <NFMsg.MsgBase>(xAckPropertyIntAllStream, xPropertyIntMsg); MsgHead xAckPropertyhead = new MsgHead(); xAckPropertyhead.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_INT; xAckPropertyhead.unDataLen = (UInt32)xAckPropertyIntAllStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; xNet.mxBinMsgEvent.OnMessageEvent(xAckPropertyhead, xAckPropertyIntAllStream.ToArray()); ///////////////////////////////////////////// xNet.mPlayerState = NFNet.PLAYER_STATE.E_PLAYER_GAMEING; //NFCRenderInterface.Instance.LoadScene(1, fX, fY, fZ); ///////////////////////////////////////////// //npc NFMsg.AckPlayerEntryList xAckNPCBodyData = new NFMsg.AckPlayerEntryList(); for (int i = 0; i < 5; ++i) { NFMsg.PlayerEntryInfo xNPCInfo = new NFMsg.PlayerEntryInfo(); NFMsg.Ident xNPCID = new NFMsg.Ident(); xNPCID.index = i + 10000; xNPCInfo.object_guid = xNPCID; xNPCInfo.x = fX + i; xNPCInfo.y = fY; xNPCInfo.z = fZ + i; xNPCInfo.career_type = 1; xNPCInfo.player_state = 1; xNPCInfo.config_id = UnicodeEncoding.Default.GetBytes(""); xNPCInfo.scene_id = 1; xNPCInfo.class_id = UnicodeEncoding.Default.GetBytes("Player"); xAckNPCBodyData.object_list.Add(xNPCInfo); } MemoryStream xAckNPCBodyStream = new MemoryStream(); Serializer.Serialize <NFMsg.AckPlayerEntryList>(xAckNPCBodyStream, xAckNPCBodyData); NFMsg.MsgBase xAckNPCrData = new NFMsg.MsgBase(); xAckNPCrData.player_id = xID; xAckNPCrData.msg_data = xAckNPCBodyStream.ToArray(); MemoryStream xAckAllNPCStream = new MemoryStream(); Serializer.Serialize <NFMsg.MsgBase>(xAckAllNPCStream, xAckNPCrData); MsgHead xNPCHead = new MsgHead(); xNPCHead.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_OBJECT_ENTRY; xNPCHead.unDataLen = (UInt32)xAckAllNPCStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; xNet.mxBinMsgEvent.OnMessageEvent(xNPCHead, xAckAllNPCStream.ToArray()); ////////////////////////////////////////////// } }