public bool Sleep(Player player) { if (House == null) { return(false); } if (SleeperGuid != 0) { return(false); } BedItem nextBedItem = GetNextBedItem(); InternalSetSleeper(player); if (nextBedItem != null) { nextBedItem.InternalSetSleeper(player); } // update the bedSleepersMap Game.SetBedSleeper(this, player.CharacterId); // make the player walk onto the bed Map.MoveCreature(player, Parent as Tile); // display 'Zzzz'/sleep effect Game.AddMagicEffect(player.GetPosition(), MagicEffects.Sleep); // kick player after he sees himself walk onto the bed and it change id uint playerId = player.Id; DispatcherManager.Scheduler.AddEvent(SchedulerTask.CreateSchedulerTask(SchedulerTask.SchedulerMinTicks, () => Game.KickPlayer(playerId, false))); // change self and partner's appearance UpdateAppearance(player); if (nextBedItem != null) { nextBedItem.UpdateAppearance(player); } return(true); }
private void WakeUp(Player player) { if (House == null) { return; } if (SleeperGuid != 0) { if (player == null) { //Player _player; //TODO: Player data save //if (IOLoginData::loadPlayerById(&_player, sleeperGUID)) { // regeneratePlayer(&_player); // IOLoginData::savePlayer(&_player); //} } else { RegeneratePlayer(player); Game.AddCreatureHealth(player); } } // update the bedSleepersMap Game.RemoveBedSleeper(SleeperGuid); BedItem nextBedItem = GetNextBedItem(); // unset sleep info InternalRemoveSleeper(); if (nextBedItem != null) { nextBedItem.InternalRemoveSleeper(); } // change self and partner's appearance UpdateAppearance(null); if (nextBedItem != null) { nextBedItem.UpdateAppearance(null); } }