public static void setCharacterLevel(Character chr, byte level) { OutPacket p = new OutPacket(40); p.WriteInt(40); p.WriteShort(0x05); p.WriteShort(0x20); p.WriteByte(0x01); p.WriteByte(0x39); p.WriteByte(0x07); p.WriteByte(0x08); p.WriteInt(chr.getuID()); p.WriteShort(level); p.WriteShort(chr.getStatPoints()); p.WriteInt(chr.getSkillPoints()); p.WriteInt(chr.getMaxHP()); p.WriteShort((short)chr.getMaxMP()); p.WriteShort(chr.getMaxSP()); chr.getAccount().mClient.WriteRawPacket(p.ToArray()); chr.setLevel(level); }
public static void releaseHealPacket(Character chr, int hpParam = 1000, short mpParam = 1000, short spParam = 1000) { if(hpParam > chr.getMaxHP()) { hpParam = chr.getMaxHP(); chr.setCurHP(chr.getMaxHP()); } else { chr.setCurHP(hpParam); } if(mpParam > chr.getMaxMP()) { mpParam = chr.getMaxMP(); chr.setCurMP(chr.getMaxMP()); } else { chr.setCurMP(mpParam); } if(spParam > chr.getMaxSP()) { spParam = chr.getMaxSP(); chr.setCurSP(chr.getMaxSP()); } else { chr.setCurSP(spParam); } OutPacket p = new OutPacket(32); p.WriteInt(32); p.WriteShort(0x05); p.WriteShort(0x35); p.WriteInt(1158393864); p.WriteInt(chr.getuID()); p.WriteInt(131076); p.WriteInt(); p.WriteInt(hpParam); p.WriteShort(mpParam); p.WriteShort(spParam); chr.getAccount().mClient.WriteRawPacket(p.ToArray()); }
public static void CreateNewCharacter(MartialClient c, InPacket p) { if(c.getAccount().activeCharacter != null) { Logger.LogCheat(Logger.HackTypes.CreateCharacter, c, "Attempted to create a character while being ingame."); c.Close(); return; } if(c.getAccount().characters.Count() == 5) { Logger.LogCheat(Logger.HackTypes.CreateCharacter, c, "Attempted to create a character while characters count is 5."); c.Close(); return; } string charName = MiscFunctions.obscureString(p.ReadString(18)); if(charName == null) { c.WriteRawPacket(Constants.createNCharNameTaken); return; } if(charName.Length < 3 || Regex.Replace(charName, "[^A-Za-z0-9]+", "") != charName || MySQLTool.NameTaken(charName)) { c.WriteRawPacket(Constants.createNCharNameTaken); return; } byte face = (byte)p.ReadShort(); if(face < 1 || face > 7) { Logger.LogCheat(Logger.HackTypes.CreateCharacter, c, "Attempted to create a character with face no {0}", face); c.WriteRawPacket(Constants.createNCharNameTaken); return; } short unknownShit = p.ReadShort(); // but let's check it if(unknownShit > 0) Logger.WriteLog(Logger.LogTypes.Debug, "Create character's shit: {0}", unknownShit); short unknownShit2 = p.ReadShort(); if(unknownShit2 > 0) Logger.WriteLog(Logger.LogTypes.Debug, "Create character's shit: {0}", unknownShit2); byte cClass = (byte)p.ReadShort(); if(cClass < 1 || cClass > 4) { Logger.LogCheat(Logger.HackTypes.CreateCharacter, c, "Attempted to create a character with class no {0}", cClass); c.WriteRawPacket(Constants.createNCharNameTaken); return; } byte[] stats = { (byte)p.ReadShort(), (byte)p.ReadShort(), (byte)p.ReadShort(), (byte)p.ReadShort(), (byte)p.ReadShort() }; byte statPoints = (byte)p.ReadShort(); if(stats[0] + stats[1] + stats[2] + stats[3] + stats[4] + statPoints > 55) { Logger.LogCheat(Logger.HackTypes.CreateCharacter, c, "Attempted to create a character with weird amount of attributes."); c.WriteRawPacket(Constants.createNCharNameTaken); return; } Character newChr = new Character(); newChr.setName(charName); newChr.setFace(face); newChr.setcClass(cClass); newChr.setStr(stats[0]); newChr.setDex(stats[1]); newChr.setVit(stats[2]); newChr.setAgi(stats[3]); newChr.setInt(stats[4]); newChr.setStatPoints(statPoints); newChr.setAccount(c.getAccount()); if (newChr.Create() == true) { CharacterFunctions.createEquipments(newChr); CharacterFunctions.createInventories(newChr); CharacterFunctions.calculateCharacterStatistics(newChr); newChr.setCurHP(newChr.getMaxHP()); newChr.setCurMP(newChr.getMaxMP()); newChr.setCurSP(newChr.getMaxSP()); c.getAccount().appendToCharacters(newChr); c.WriteRawPacket(Constants.createNewCharacter); return; } c.WriteRawPacket(Constants.createNCharNameTaken); return; }