public ActorPropertyPacketUtil(string firstTarget, Actor forActor, uint playerActorId) { currentActorPropertyPacket = new SetActorPropetyPacket(firstTarget); this.forActor = forActor; this.playerActorId = playerActorId; this.currentTarget = firstTarget; }
public override BasePacket getInitPackets(uint playerActorId) { SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init"); initProperties.addTarget(); return(BasePacket.createPacket(initProperties.buildPacket(playerActorId, actorId), true, false)); }
public override List <SubPacket> GetInitPackets() { List <SubPacket> subpackets = new List <SubPacket>(); SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init"); initProperties.AddTarget(); subpackets.Add(initProperties.BuildPacket(actorId)); return(subpackets); }
public virtual BasePacket getInitPackets(uint playerActorId) { SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init"); initProperties.addByte(0xE14B0CA8, 1); initProperties.addByte(0x2138FD71, 1); initProperties.addByte(0xFBFBCFB1, 1); initProperties.addTarget(); return(BasePacket.createPacket(initProperties.buildPacket(playerActorId, actorId), true, false)); }
public void addProperty(string property) { if (!currentActorPropertyPacket.addProperty(forActor, property)) { currentActorPropertyPacket.setIsMore(true); currentActorPropertyPacket.addTarget(); subPackets.Add(currentActorPropertyPacket.buildPacket(playerActorId, forActor.actorId)); currentActorPropertyPacket = new SetActorPropetyPacket(currentTarget); } }
public virtual List <SubPacket> GetInitPackets() { List <SubPacket> packets = new List <SubPacket>(); SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init"); initProperties.AddByte(0xE14B0CA8, 1); initProperties.AddByte(0x2138FD71, 1); initProperties.AddByte(0xFBFBCFB1, 1); initProperties.AddTarget(); packets.Add(initProperties.BuildPacket(actorId)); return(packets); }
public void changeProperty(uint id, uint value, string target) { SetActorPropetyPacket changeProperty = new SetActorPropetyPacket(target); changeProperty.setTarget(target); changeProperty.addInt(id, value); changeProperty.addTarget(); foreach (KeyValuePair <uint, ConnectedPlayer> entry in mConnectedPlayerList) { SubPacket changePropertyPacket = changeProperty.buildPacket((entry.Value.actorID), (entry.Value.actorID)); BasePacket packet = BasePacket.createPacket(changePropertyPacket, true, false); packet.debugPrintPacket(); entry.Value.queuePacket(packet); } }
public ActorPropertyPacketUtil(string firstTarget, Actor forActor) { currentActorPropertyPacket = new SetActorPropetyPacket(firstTarget); this.forActor = forActor; this.currentTarget = firstTarget; }
public void sendCharaExpInfo() { if (lastStep == 0) { int maxLength; if ((sizeof(short) * charaWork.battleSave.skillLevel.Length) - lastPosition < 0x5E) { maxLength = (sizeof(short) * charaWork.battleSave.skillLevel.Length) - lastPosition; } else { maxLength = 0x5E; } byte[] skillLevelBuffer = new byte[maxLength]; Buffer.BlockCopy(charaWork.battleSave.skillLevel, 0, skillLevelBuffer, 0, skillLevelBuffer.Length); SetActorPropetyPacket charaInfo1 = new SetActorPropetyPacket("charaWork/exp"); charaInfo1.setIsArrayMode(true); if (maxLength == 0x5E) { charaInfo1.addBuffer(Utils.MurmurHash2("charaWork.battleSave.skillLevel", 0), skillLevelBuffer, 0, skillLevelBuffer.Length, 0x0); lastPosition += maxLength; } else { charaInfo1.addBuffer(Utils.MurmurHash2("charaWork.battleSave.skillLevel", 0), skillLevelBuffer, 0, skillLevelBuffer.Length, 0x3); lastPosition = 0; lastStep++; } charaInfo1.addTarget(); queuePacket(charaInfo1.buildPacket(actorId, actorId)); } else if (lastStep == 1) { int maxLength; if ((sizeof(short) * charaWork.battleSave.skillLevelCap.Length) - lastPosition < 0x5E) { maxLength = (sizeof(short) * charaWork.battleSave.skillLevelCap.Length) - lastPosition; } else { maxLength = 0x5E; } byte[] skillCapBuffer = new byte[maxLength]; Buffer.BlockCopy(charaWork.battleSave.skillLevelCap, lastPosition, skillCapBuffer, 0, skillCapBuffer.Length); SetActorPropetyPacket charaInfo1 = new SetActorPropetyPacket("charaWork/exp"); if (maxLength == 0x5E) { charaInfo1.setIsArrayMode(true); charaInfo1.addBuffer(Utils.MurmurHash2("charaWork.battleSave.skillLevelCap", 0), skillCapBuffer, 0, skillCapBuffer.Length, 0x1); lastPosition += maxLength; } else { charaInfo1.setIsArrayMode(false); charaInfo1.addBuffer(Utils.MurmurHash2("charaWork.battleSave.skillLevelCap", 0), skillCapBuffer, 0, skillCapBuffer.Length, 0x3); lastStep = 0; lastPosition = 0; } charaInfo1.addTarget(); queuePacket(charaInfo1.buildPacket(actorId, actorId)); } }
public bool SetWorkValue(Player player, string name, string uiFunc, object value) { string[] split = name.Split('.'); int arrayIndex = 0; if (!(split[0].Equals("work") || split[0].Equals("charaWork") || split[0].Equals("playerWork") || split[0].Equals("npcWork"))) { return(false); } Object parentObj = null; Object curObj = this; for (int i = 0; i < split.Length; i++) { //For arrays if (split[i].Contains("[")) { if (split[i].LastIndexOf(']') - split[i].IndexOf('[') <= 0) { return(false); } arrayIndex = Convert.ToInt32(split[i].Substring(split[i].IndexOf('[') + 1, split[i].LastIndexOf(']') - split[i].LastIndexOf('[') - 1)); split[i] = split[i].Substring(0, split[i].IndexOf('[')); } FieldInfo field = curObj.GetType().GetField(split[i]); if (field == null) { return(false); } if (i == split.Length - 1) { parentObj = curObj; } curObj = field.GetValue(curObj); if (curObj == null) { return(false); } } if (curObj == null) { return(false); } else { //Array, we actually care whats inside if (curObj.GetType().IsArray) { if (((Array)curObj).Length <= arrayIndex) { return(false); } if (value.GetType() == ((Array)curObj).GetType().GetElementType() || TypeDescriptor.GetConverter(value.GetType()).CanConvertTo(((Array)curObj).GetType().GetElementType())) { if (value.GetType() == ((Array)curObj).GetType().GetElementType()) { ((Array)curObj).SetValue(value, arrayIndex); } else { ((Array)curObj).SetValue(TypeDescriptor.GetConverter(value.GetType()).ConvertTo(value, curObj.GetType().GetElementType()), arrayIndex); } SetActorPropetyPacket changeProperty = new SetActorPropetyPacket(uiFunc); changeProperty.AddProperty(this, name); changeProperty.AddTarget(); SubPacket subpacket = changeProperty.BuildPacket(player.actorId); player.playerSession.QueuePacket(subpacket); subpacket.DebugPrintSubPacket(); return(true); } } else { if (value.GetType() == curObj.GetType() || TypeDescriptor.GetConverter(value.GetType()).CanConvertTo(curObj.GetType())) { if (value.GetType() == curObj.GetType()) { parentObj.GetType().GetField(split[split.Length - 1]).SetValue(parentObj, value); } else { parentObj.GetType().GetField(split[split.Length - 1]).SetValue(parentObj, TypeDescriptor.GetConverter(value.GetType()).ConvertTo(value, curObj.GetType())); } SetActorPropetyPacket changeProperty = new SetActorPropetyPacket(uiFunc); changeProperty.AddProperty(this, name); changeProperty.AddTarget(); SubPacket subpacket = changeProperty.BuildPacket(player.actorId); player.playerSession.QueuePacket(subpacket); subpacket.DebugPrintSubPacket(); return(true); } } return(false); } }