public Player(GameClient Client,Character Info) : base() { Log.Success("Player", "Construction de " + Info.Name); _Client = Client; _Info = Info; _Value = Info.Value[0]; Name = Info.Name; SetFaction((byte)(8*(8*Info.Realm)+6)); EvtInterface = EventInterface.GetEventInterface((uint)_Info.CharacterId); SocInterface = new SocialInterface(this); TokInterface = new TokInterface(this); }
public Player(GameClient Client,Character Info) : base() { Log.Success("Player", "Construction de " + Info.Name); _Client = Client; _Info = Info; _Value = Info.Value[0]; Name = Info.Name; Realm = (GameData.Realms)Info.Realm; SetPvpFlag(false); EvtInterface = EventInterface.GetEventInterface((uint)_Info.CharacterId); SocInterface = new SocialInterface(this); TokInterface = new TokInterface(this); MlInterface = new MailInterface(this); }
public Player(GameClient Client,Character Info) : base() { _Client = Client; _Info = Info; _Value = Info.Value; Name = Info.Name; Realm = (GameData.Realms)Info.Realm; SetPVPFlag(false); EvtInterface = AddInterface(EventInterface.GetEventInterface((uint)_Info.CharacterId)) as EventInterface; SocInterface = AddInterface<SocialInterface>(); TokInterface = AddInterface<TokInterface>(); MlInterface = AddInterface<MailInterface>(); EvtInterface.AddEventNotify(EventName.ON_MOVE, CancelQuit); EvtInterface.AddEventNotify(EventName.ON_RECEIVE_DAMAGE, CancelQuit); EvtInterface.AddEventNotify(EventName.ON_DEAL_DAMAGE, CancelQuit); EvtInterface.AddEventNotify(EventName.ON_START_CASTING, CancelQuit); }
static public void F_CREATE_CHARACTER(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; CreateInfo Info; Info.slot = packet.GetUint8(); Info.race = packet.GetUint8(); Info.career = packet.GetUint8(); Info.sex = packet.GetUint8(); Info.model = packet.GetUint8(); Info.NameSize = packet.GetUint16(); packet.Skip(2); byte[] Traits = new byte[8]; packet.Read(Traits, 0, Traits.Length); packet.Skip(7); string Name = packet.GetString(Info.NameSize); if (Name.Length > 2 && !CharMgr.NameIsUsed(Name)) { CharacterInfo CharInfo = CharMgr.GetCharacterInfo(Info.career); if (CharInfo == null) { Log.Error("ON_CREATE", "Can not find career :" + Info.career); } else { Log.Success("OnCreate", "New Character : " + Name); Character Char = new Character(); Char.AccountId = cclient._Account.AccountId; Char.bTraits = Traits; Char.Career = Info.career; Char.CareerLine = CharInfo.CareerLine; Char.ModelId = Info.model; Char.Name = Name; Char.Race = Info.race; Char.Realm = CharInfo.Realm; Char.RealmId = Program.Rm.RealmId; Char.Sex = Info.sex; Char.FirstConnect = true; if (!CharMgr.CreateChar(Char)) { Log.Error("CreateCharacter", "Hack : can not create more than 10 characters!"); } else { Character_item Citm = null; List < CharacterInfo_item > Items = CharMgr.GetCharacterInfoItem(Char.CareerLine); foreach (CharacterInfo_item Itm in Items) { if (Itm == null) continue; Citm = new Character_item(); Citm.Counts = Itm.Count; Citm.CharacterId = Char.CharacterId; Citm.Entry = Itm.Entry; Citm.ModelId = Itm.ModelId; Citm.SlotId = Itm.SlotId; CharMgr.CreateItem(Citm); } Character_value CInfo = new Character_value(); CInfo.CharacterId = Char.CharacterId; CInfo.Level = 1; CInfo.Money = 0; CInfo.Online = false; CInfo.RallyPoint = CharInfo.RallyPt; CInfo.RegionId = CharInfo.Region; CInfo.Renown = 0; CInfo.RenownRank = 1; CInfo.RestXp = 0; CInfo.Skills = CharInfo.Skills; CInfo.Speed = 100; CInfo.WorldO = CharInfo.WorldO; CInfo.WorldX = CharInfo.WorldX; CInfo.WorldY = CharInfo.WorldY; CInfo.WorldZ = CharInfo.WorldZ; CInfo.Xp = 0; CInfo.ZoneId = CharInfo.ZoneId; CharMgr.Database.AddObject(CInfo); Program.AcctMgr.UpdateRealmCharacters(Program.Rm.RealmId, (uint)CharMgr.Database.GetObjectCount<Character>(" Realm=1"), (uint)CharMgr.Database.GetObjectCount<Character>(" Realm=2")); Char.Value = CInfo; PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_RESPONSE); Out.WritePascalString(cclient._Account.Username); cclient.SendPacket(Out); } } } else { PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_ERROR); Out.WritePascalString(cclient._Account.Username); cclient.SendPacket(Out); } }
public static void F_CREATE_CHARACTER(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; CreateInfo Info; Info.slot = packet.GetUint8(); Info.race = packet.GetUint8(); Info.career = packet.GetUint8(); Info.sex = packet.GetUint8(); Info.model = packet.GetUint8(); Info.NameSize = packet.GetUint16(); packet.Skip(2); byte[] Traits = new byte[8]; packet.Read(Traits, 0, Traits.Length); packet.Skip(7); string Name = packet.GetString(Info.NameSize); if (!CharMgr.NameIsUsed(Name)) { CharacterInfo CharInfo = CharMgr.GetCharacterInfo(Info.career); if (CharInfo == null) { Log.Error("ON_CREATE", "Can not find career :" + Info.career); return; } Log.Success("OnCreate", "Creating new Character : " + Name); Character Char = new Character(); Char.AccountId = cclient._Account.AccountId; Char.bTraits = Traits; Char.Career = Info.career; Char.CareerLine = CharInfo.CareerLine; Char.ModelId = Info.model; Char.Name = Name; Char.Race = Info.race; Char.Realm = CharInfo.Realm; Char.RealmId = Program.Rm.RealmId; Char.Sex = Info.sex; if (!CharMgr.CreateChar(Char)) { Log.Error("CreateCharacter", "Hack : can not create more than 10 characters!"); return; } Character_items Citm = null; CharacterInfo_item[] Items = CharMgr.GetCharacterInfoItem(Char.CareerLine); for (int i = 0; i < Items.Length; ++i) { if (Items[i] == null) continue; Citm = new Character_items(); Citm.Counts = Items[i].Count; Citm.CharacterId = Char.CharacterId; Citm.Entry = Items[i].Entry; Citm.ModelId = Items[i].ModelId; Citm.SlotId = Items[i].SlotId; CharMgr.CreateItem(Citm); } Character_value CInfo = new Character_value(); CInfo.CharacterId = Char.CharacterId; CInfo.Level = 1; CInfo.Money = 0; CInfo.Online = false; CInfo.RallyPoint = CharInfo.RallyPt; CInfo.RegionId = CharInfo.Region; CInfo.Renown = 0; CInfo.RenownRank = 1; CInfo.RestXp = 0; CInfo.Skills = CharInfo.Skills; CInfo.Speed = 100; CInfo.WorldO = CharInfo.WorldO; CInfo.WorldX = CharInfo.WorldX; CInfo.WorldY = CharInfo.WorldY; CInfo.WorldZ = CharInfo.WorldZ; CInfo.Xp = 0; CInfo.ZoneId = CharInfo.ZoneId; CharMgr.Database.AddObject(CInfo); Char.Value = new Character_value[1] { CInfo }; } PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_RESPONSE); Out.WritePascalString(cclient._Account.Username); cclient.SendTCP(Out); }