// 0x2AE = CHARACTER_DEFINITION ? protected void PrepareCharInfo(Character Char, ref ISerializablePacket pck) { pck.AddField(12, EPacketFieldType.ByteArray, Char.Name); Realm realm_data = CharacterMgr.Instance.GetRealm((byte)Char.RealmId); realm_data.GenerateName(); pck.AddField(54, EPacketFieldType.Unsigned7BitEncoded, realm_data.RiftId); byte[] CustomData = Shared.NetWork.Marshal.StringToUTF8ByteArray(Char.Data); PacketInStream CustomStream = new PacketInStream(CustomData, CustomData.Length); pck.AddField(56, EPacketFieldType.Packet, PacketProcessor.ReadPacket(ref CustomStream) as CharacterCustom); // Field 60 // Character Specializations }
public bool HandleCommand(string command, List <string> args) { byte Id = byte.Parse(args[0]); byte Type = byte.Parse(args[1]); byte Lang = byte.Parse(args[2]); Realm Rm = CharacterMgr.Instance.GetRealm(Id); if (Rm != null) // Realm already registered { Log.Error("CreateRealm", "Realm id : " + Id + " already exist"); return(false); } Rm = new Realm(); Rm.RealmId = Id; Rm.Language = Lang; Rm.Online = 1; Rm.PVP = 0; Rm.RP = 0; Rm.GenerateName(); // Generate name by RealmId; if (Type == 1 || Type == 3) { Rm.PVP = 1; } if (Type == 2 || Type == 3) { Rm.RP = 1; } CharacterMgr.Instance.AddObject(Rm); CharacterMgr.Instance.LoadRealms(); Log.Success("CreateRealm", "Realm '" + Rm.Name + "' Successfully added to database."); return(true); }
public bool RegisterRealm(Realm Rm,RpcClientInfo Info) { Log.Debug("AccountMgr", "Realm Registering : " + Rm.Name); if (Rm == null) return false; Rm.GenerateName(); Realm Already = GetRealm(Rm.RealmId); if (Already == null) { Already = AccountDB.SelectObject<Realm>("RealmId=" + Rm.RealmId); if (Already == null) AccountDB.AddObject(Rm); } if (Already != null) { Rm.ObjectId = Already.ObjectId; Realms.Remove(Already); } Rm.RpcInfo = Info; Rm.Dirty = true; AccountDB.SaveObject(Rm); Realms.Add(Rm); if (Info != null) { Log.Success("AccountMgr", "Realm Online : " + Rm.Name); } else Log.Success("AccountMgr", "Realm loaded : " + Rm.Name); return true; }