public NetworkClient Client; //REPLACE WHEN MOVING OFF GONZONET!! public override bool Execute(VM vm) { Name = Name.Substring(0, Math.Min(Name.Length, 64)); var sim = vm.Context.CreateObjectInstance(VMAvatar.TEMPLATE_PERSON, LotTilePos.OUT_OF_WORLD, Direction.NORTH, false).Objects[0]; var mailbox = vm.Entities.FirstOrDefault(x => (x.Object.OBJ.GUID == 0xEF121974 || x.Object.OBJ.GUID == 0x1D95C9B0 || x.Object.OBJ.GUID == 0x865A6812)); LotTilePos pos = mailbox.Position; pos.x = (short)(mailbox.Position.x + 1); pos.y = (short)(mailbox.Position.y + 1); if (VM.UseWorld) { TSO.HIT.HITVM.Get().PlaySoundEvent("lot_enter"); } if (mailbox != null) { VMFindLocationFor.FindLocationFor(sim, mailbox, vm.Context); } ((VMAvatar)sim).Visitor = ActorUID == 0 ? true : false; sim.PersistID = ActorUID; VMAvatar avatar = (VMAvatar)sim; avatar.SkinTone = (Vitaboy.AppearanceType)SkinTone; avatar.SetPersonData(VMPersonDataVariable.Gender, (short)((Gender) ? 1 : 0)); avatar.DefaultSuits = new VMAvatarDefaultSuits(Gender); avatar.DefaultSuits.Daywear = BodyID; avatar.BodyOutfit = BodyID; avatar.HeadOutfit = HeadID; avatar.Name = Name; ((VMTSOAvatarState)avatar.TSOState).Budget.Value = 999999; ((VMTSOAvatarState)avatar.TSOState).Permissions = Permissions; avatar.SetPosition(pos, Direction.WEST, vm.Context); if (ActorUID == uint.MaxValue - 1) { avatar.SetValue(VMStackObjectVariable.Hidden, 1); avatar.SetPosition(LotTilePos.OUT_OF_WORLD, Direction.NORTH, vm.Context); avatar.SetFlag(VMEntityFlags.HasZeroExtent, true); avatar.SetPersonData(VMPersonDataVariable.IsGhost, 1); //oooooOOooooOo } if (RequesterID == vm.MyUID) { vm.MyUID = ActorUID; //we're this sim! try send commands as them. } vm.SignalChatEvent(new VMChatEvent(avatar.PersistID, VMChatEventType.Join, avatar.Name)); return(true); }
public VMAvatar CreateAvatar(uint guid, XmlCharacter xml, bool visitor, short id) { VMAvatar avatar = (VMAvatar)VM.Context.CreateObjectInstance(guid, LotTilePos.OUT_OF_WORLD, Direction.NORTH).Objects[0]; avatar.Visitor = visitor; var mailbox = VM.Entities.First(x => (x.Object.OBJ.GUID == 0xEF121974 || x.Object.OBJ.GUID == 0x1D95C9B0)); avatar.SetAvatarData(xml); LotTilePos pos = mailbox.Position; pos.x = (short)(mailbox.Position.x + 1); pos.y = (short)(mailbox.Position.y + id); avatar.SetPosition(pos, Direction.WEST, VM.Context); //VMFindLocationFor.FindLocationFor(avatar, mailbox, VM.Context); return(avatar); }
public NetworkClient Client; //REPLACE WHEN MOVING OFF GONZONET!! public override bool Execute(VM vm) { Name = Name.Substring(0, Math.Min(Name.Length, 64)); var sim = vm.Context.CreateObjectInstance(VMAvatar.TEMPLATE_PERSON, LotTilePos.OUT_OF_WORLD, Direction.NORTH, false).Objects[0]; var mailbox = vm.Entities.FirstOrDefault(x => (x.Object.OBJ.GUID == 0xEF121974 || x.Object.OBJ.GUID == 0x1D95C9B0 || x.Object.OBJ.GUID == 0x74E7FFA9)); if (VM.UseWorld) { TSO.HIT.HITVM.Get().PlaySoundEvent("lot_enter"); } if (mailbox != null) { VMFindLocationFor.FindLocationFor(sim, mailbox, vm.Context); } LotTilePos pos = mailbox.Position; pos.x = (short)(mailbox.Position.x + 1); pos.y = (short)(mailbox.Position.y + 1); sim.PersistID = ActorUID; VMAvatar avatar = (VMAvatar)sim; avatar.SkinTone = (Vitaboy.AppearanceType)SkinTone; avatar.SetPersonData(VMPersonDataVariable.Gender, (short)((Gender) ? 1 : 0)); avatar.BodyOutfit = BodyID; avatar.HeadOutfit = HeadID; avatar.Name = Name; ((VMTSOAvatarState)avatar.TSOState).Permissions = Permissions; avatar.SetPosition(pos, Direction.WEST, vm.Context); return(true); }
//variables used locally for deferred avatar loading public override bool Execute(VM vm) { if (vm.TS1) { if (vm.CurrentFamily == null) { return(true); } var gameState = Content.Content.Get().Neighborhood.GameState; var control = vm.Entities.FirstOrDefault(x => x is VMAvatar && !((VMAvatar)x).IsPet && ((VMAvatar)x).GetPersonData(VMPersonDataVariable.TS1FamilyNumber) == vm.CurrentFamily?.ChunkID); if (control == null) { control = vm.Context.CreateObjectInstance((gameState.DowntownSimGUID == 0)?0x32AA2056:gameState.DowntownSimGUID, LotTilePos.OUT_OF_WORLD, Direction.NORTH)?.BaseObject; control?.SetPosition(LotTilePos.FromBigTile(1, 1, 1), Direction.NORTH, vm.Context); } if (control != null) { var ava = (VMAvatar)control; ava.PersistID = ActorUID; ((VMTSOAvatarState)(ava.TSOState)).Permissions = VMTSOAvatarPermissions.Admin; ava.TSOState.Budget.Value = 1000000; vm.Context.ObjectQueries.RegisterAvatarPersist(ava, ava.PersistID); vm.SetGlobalValue(3, control.ObjectID); } return(true); } var name = AvatarState.Name.Substring(0, Math.Min(AvatarState.Name.Length, 64)); var sim = vm.Context.CreateObjectInstance(VMAvatar.TEMPLATE_PERSON, LotTilePos.OUT_OF_WORLD, Direction.NORTH).Objects[0]; var mailbox = vm.Entities.FirstOrDefault(x => (x.Object.OBJ.GUID == 0xEF121974 || x.Object.OBJ.GUID == 0x1D95C9B0)); if (VM.UseWorld) { FSO.HIT.HITVM.Get().PlaySoundEvent("lot_enter"); } if (mailbox != null) { VMFindLocationFor.FindLocationFor(sim, mailbox, vm.Context, VMPlaceRequestFlags.Default); } else { sim.SetPosition(LotTilePos.FromBigTile(3, 3, 1), Direction.NORTH, vm.Context); } sim.PersistID = ActorUID; VMAvatar avatar = (VMAvatar)sim; AvatarState.Apply(avatar); var oldRoomCount = vm.TSOState.Roommates.Count; //some off lot changes may have occurred. Keep things up to date if we're caught between database sync points (TODO: right now never, but should happen on every roomie change). if (AvatarState.Permissions > VMTSOAvatarPermissions.Visitor && AvatarState.Permissions < VMTSOAvatarPermissions.Admin) { if (!vm.TSOState.Roommates.Contains(AvatarState.PersistID)) { vm.TSOState.Roommates.Add(AvatarState.PersistID); if (AvatarState.Permissions > VMTSOAvatarPermissions.Roommate) { vm.TSOState.BuildRoommates.Add(AvatarState.PersistID); } else { vm.TSOState.BuildRoommates.Remove(AvatarState.PersistID); } VMBuildableAreaInfo.UpdateOverbudgetObjects(vm); } } else if (AvatarState.Permissions != VMTSOAvatarPermissions.Admin) { if (vm.TSOState.Roommates.Contains(AvatarState.PersistID)) { vm.TSOState.Roommates.Remove(AvatarState.PersistID); vm.TSOState.BuildRoommates.Remove(AvatarState.PersistID); VMBuildableAreaInfo.UpdateOverbudgetObjects(vm); } } if (oldRoomCount != vm.TSOState.Roommates.Count) { //mark objects not owned by roommates for inventory transfer foreach (var ent in vm.Entities) { if (ent is VMGameObject && ent.PersistID > 0 && ((VMTSOObjectState)ent.TSOState).OwnerID == avatar.PersistID) { var old = ((VMGameObject)ent).Disabled; if (AvatarState.Permissions < VMTSOAvatarPermissions.Roommate) { ((VMGameObject)ent).Disabled |= VMGameObjectDisableFlags.PendingRoommateDeletion; } else { ((VMGameObject)ent).Disabled &= ~VMGameObjectDisableFlags.PendingRoommateDeletion; } if (old != ((VMGameObject)ent).Disabled) { vm.Scheduler.RescheduleInterrupt(ent); } ((VMGameObject)ent).RefreshLight(); } } } vm.Context.ObjectQueries.RegisterAvatarPersist(avatar, avatar.PersistID); if (ActorUID == uint.MaxValue - 1) { avatar.SetValue(VMStackObjectVariable.Hidden, 1); avatar.SetPosition(LotTilePos.OUT_OF_WORLD, Direction.NORTH, vm.Context); avatar.SetFlag(VMEntityFlags.HasZeroExtent, true); avatar.SetPersonData(VMPersonDataVariable.IsGhost, 1); //oooooOOooooOo } vm.SignalChatEvent(new VMChatEvent(avatar.PersistID, VMChatEventType.Join, avatar.Name)); return(true); }