public void BuildCharEquipaments(uint CharID) { var charEquips = CharDB.UserDataQuery("CALL `getCharacterEquipment`('{0}');", CharID); for (int i = 0; i < (int)EquipSlots.COUNT; i++) { bool found = false; // Check if exist any equip data in DB if (charEquips.Count > 0) { foreach (var e in charEquips) { if (Convert.ToInt32(e["Slot"]) == i) { // If Slot X is found in DB get data and set boolean found = true; SetInt(81 + (i * 7), Convert.ToUInt32(e["ItemID"])); SetByte(85 + (i * 7), Convert.ToByte(e["Rank"])); SetByte(86 + (i * 7), Convert.ToByte(e["Grade"])); SetByte(87 + (i * 7), Convert.ToByte(e["BattleAttribute"])); } } } if (!found) { // If Slot X is not found in DB fill with INVALID SetInt(81 + (i * 7), Definitions.INVALID_INT); SetByte(85 + (i * 7), Definitions.INVALID_BYTE); SetByte(86 + (i * 7), Definitions.INVALID_BYTE); SetByte(87 + (i * 7), Definitions.INVALID_BYTE); } } }
public void BuildCharList(uint AccountID, byte ServerID) { // Build Deletion List BuildCharDelInfo(AccountID, ServerID); var chars = CharDB.UserDataQuery("CALL `getAccountCharacters`('{0}','{1}');", AccountID, ServerID); CharacterCount = Convert.ToByte(chars.Count); if (CharacterCount > 0) { byte i = 0; foreach (var c in chars) { BuildCharEquipaments(Convert.ToUInt32(c["CharacterID"]), i); SetInt(69 + (i * blocksize), Convert.ToUInt32(c["CharacterID"])); SetString(73 + (i * blocksize), Convert.ToString(c["Name"]), 34); SetByte(107 + (i * blocksize), Convert.ToByte(c["RaceID"])); SetByte(108 + (i * blocksize), Convert.ToByte(c["ClassID"])); SetByte(109 + (i * blocksize), Convert.ToByte(c["IsAdult"])); SetByte(110 + (i * blocksize), Convert.ToByte(c["GenderID"])); SetByte(111 + (i * blocksize), Convert.ToByte(c["FaceID"])); SetByte(112 + (i * blocksize), Convert.ToByte(c["HairID"])); SetByte(113 + (i * blocksize), Convert.ToByte(c["HairColorID"])); SetByte(114 + (i * blocksize), Convert.ToByte(c["SkinColorID"])); SetByte(115 + (i * blocksize), Convert.ToByte(c["CurrentLevel"])); SetInt(116 + (i * blocksize), Convert.ToUInt32(c["WorldTableID"])); SetInt(120 + (i * blocksize), Convert.ToUInt32(c["WorldID"])); SetFloat(124 + (i * blocksize), (float)Convert.ToDouble(c["Position_X"])); SetFloat(128 + (i * blocksize), (float)Convert.ToDouble(c["Position_Y"])); SetFloat(132 + (i * blocksize), (float)Convert.ToDouble(c["Position_Z"])); SetInt(136 + (i * blocksize), Convert.ToUInt32(c["ZennyInventory"])); SetInt(140 + (i * blocksize), Convert.ToUInt32(c["ZennyBank"])); SetInt(263 + (i * blocksize), Convert.ToUInt32(c["MapInfoID"])); SetByte(267 + (i * blocksize), Convert.ToByte(c["IsTutorialDone"])); SetInt(268 + (i * blocksize), Convert.ToUInt32(c["Marking"])); SetByte(272 + (i * blocksize), Convert.ToByte(c["IsToRename"])); SetInt(273 + (i * blocksize), Convert.ToUInt32(c["GuildID"])); // TODO Add to DBs SetByte(277 + (i * blocksize), Definitions.INVALID_BYTE); //Guild Type? SetByte(278 + (i * blocksize), Definitions.INVALID_BYTE); //Guild Color SetByte(279 + (i * blocksize), Definitions.INVALID_BYTE); //Dojo Color // Need Discover this! SetBytes(280 + (i * blocksize), new byte[] { 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 }); i++; } } }
internal void SendCharacterAdd(byte[] data) { //TO DO UC_CHARACTER_ADD_REQ SysCons.LogInfo("UC_CHARACTER_ADD_REQ"); UC_CHARACTER_ADD_REQ iPkt = new UC_CHARACTER_ADD_REQ(); iPkt.SetData(data); SysCons.LogInfo( "UC_CHARACTER_ADD_REQ Name({0}) Race({1}) Class({2}) Gender({3}) Face({4}) Hair({5}) HairColor({6}) SkinColor({7}) Blood({8})", iPkt.Name, ((CharRaces)iPkt.Race).ToString(), ((CharClasses)iPkt.Class).ToString(), ((CharGenders)iPkt.Gender).ToString(), iPkt.Face, iPkt.Hair, iPkt.HairColor, iPkt.SkinColor, iPkt.Blood ); //dlaczego wczesniej bylo var ? CU_CHARACTER_ADD_RES oPkt = new CU_CHARACTER_ADD_RES(); oPkt.ResultCode = (ushort)CharDB.InsertCharacter(this.AccountID, this.ServerID, iPkt.Name, iPkt.Race, iPkt.Class, iPkt.Gender, iPkt.Face, iPkt.Hair, iPkt.HairColor, iPkt.SkinColor); oPkt.charID = 1; oPkt.Name = iPkt.Name; oPkt.Race = iPkt.Race; oPkt.Class = iPkt.Class; oPkt.Gender = iPkt.Gender; oPkt.Face = iPkt.Face; oPkt.Hair = iPkt.Hair; oPkt.Gender = iPkt.Gender; oPkt.HairColor = iPkt.HairColor; oPkt.SkinColor = iPkt.SkinColor; oPkt.worldTblidx = 1; oPkt.worldId = 1; oPkt.BuildPacket(); this.Client.Send(oPkt.Data); }