public Conversation(string conversationId, ConversationNode rootNode, GameFlags gameFlags) : base(conversationId) { _conversationId = conversationId; _rootNode = rootNode; _gameFlags = gameFlags; }
// Token: 0x06001F7B RID: 8059 RVA: 0x000970A4 File Offset: 0x000952A4 public bool Shoot() { bool result = false; if (this.IsWeaponReady) { if (this.CheckAmmoCount()) { this._currentSlot.InputHandler.FireHandler.RegisterShot(); if (!GameFlags.IsFlagSet(GameFlags.GAME_FLAGS.QuickSwitch, GameState.Current.RoomData.GameFlags)) { this._holsterTime = WeaponConfigurationHelper.GetRateOfFire(this._currentSlot.View); } Ray ray = new Ray(GameState.Current.PlayerData.ShootingPoint + GameState.Current.Player.EyePosition, GameState.Current.PlayerData.ShootingDirection); CmunePairList <BaseGameProp, ShotPoint> cmunePairList; this._currentSlot.Logic.Shoot(ray, out cmunePairList); if (!this._currentSlot.Decorator.HasShootAnimation) { WeaponFeedbackManager.Instance.Fire(); } AmmoDepot.UseAmmoOfClass(this._currentSlot.View.ItemClass, this._currentSlot.Logic.AmmoCountPerShot); GameState.Current.PlayerData.WeaponFired.Value = this._currentSlot; result = true; } else { this._currentSlot.Decorator.PlayOutOfAmmoSound(); GameData.Instance.OnNotificationFull.Fire(string.Empty, "Out of ammo!", 1f); } } return(result); }
// Token: 0x06001A9B RID: 6811 RVA: 0x0008B208 File Offset: 0x00089408 private void ConfigureAvatar(GameActorInfo info, CharacterConfig character, bool isLocal) { if (character != null && info != null) { if (isLocal) { this.Player.SetCurrentCharacterConfig(character); this.Player.MoveController.IsLowGravity = GameFlags.IsFlagSet(GameFlags.GAME_FLAGS.LowGravity, this.RoomData.GameFlags); character.Initialize(this.PlayerData, this.Avatar); } else { global::Avatar avatar = new global::Avatar(new Loadout(info.Gear, info.Weapons), false); avatar.SetDecorator(global::AvatarBuilder.CreateRemoteAvatar(avatar.Loadout.GetAvatarGear(), info.SkinColor)); character.Initialize(this.RemotePlayerStates.GetState(info.PlayerId), avatar); GameData.Instance.OnHUDStreamMessage.Fire(info, LocalizedStrings.JoinedTheGame, null); } if (!info.IsAlive) { character.SetDead(Vector3.zero, BodyPart.Body, 0, UberstrikeItemClass.WeaponMachinegun); } } else { Debug.LogError(string.Format("OnAvatarLoaded failed because loaded Avatar is {0} and Info is {1}", character != null, info != null)); } }
protected override void OnPlayerTeamChanged(BasePlayer player, Team prevTeam, Team newTeam) { Console.Print(OutputLevel.Debug, "game", $"team join player={player.ClientId}:{Server.ClientName(player.ClientId)} team={newTeam}"); if (prevTeam != Team.Spectators || newTeam != Team.Spectators) { UnbalancedTick = BalanceCheck; } if (prevTeam != Team.Spectators) { TeamSize[(int)prevTeam]--; } if (newTeam != Team.Spectators) { TeamSize[(int)newTeam]++; if (GameState == GameState.WarmupGame && HasEnoughPlayers()) { SetGameState(GameState.WarmupGame, 0); } player.IsReadyToPlay = !IsPlayerReadyMode(); if (GameFlags.HasFlag(GameFlags.Survival)) { player.RespawnDisabled = GetRespawnDisabled(player); } } CheckReadyStates(); }
internal GameData(GameFlags gameFlags, Character clientCharacter) { if (clientCharacter == null) { throw new ArgumentNullException(nameof(clientCharacter)); } Flags = gameFlags; Act = new ActData(); ClientCharacter = clientCharacter; _walkingSpeedMultiplier = new Lazy <double>(() => { var walkingSpeedIncreasedMultiplier = 1.0; var speedItems = this.Items.Where(i => i.Value.Action == Action.Equip && i.Value.PlayerId == Me?.Id).Select(i => i.Value.GetValueOfStatType(StatType.FasterRunWalk)); if (speedItems.Any()) { walkingSpeedIncreasedMultiplier += speedItems.Aggregate((agg, frw) => agg + frw) / (double)100; } var increasedSpeedSkill = Me.Skills.GetValueOrDefault(Skill.IncreasedSpeed, 0); if (increasedSpeedSkill > 0) { walkingSpeedIncreasedMultiplier += (13 + 4 * increasedSpeedSkill) / (double)100; } var vigorSkill = Me.Skills.GetValueOrDefault(Skill.Vigor, 0); if (vigorSkill > 0) { walkingSpeedIncreasedMultiplier += (13 + 2.5 * vigorSkill) / (double)100; } return(walkingSpeedIncreasedMultiplier); }); }
// Methods public GameInfo(byte[] data) : base(data) { this.minLevel = -1; this.maxLevel = -1; this.requestID = BitConverter.ToUInt16(data, 1); this.flags = (GameFlags)BitConverter.ToUInt32(data, 3); this.uptime = new TimeSpan(BitConverter.ToUInt32(data, 7) * 0x989680L); this.creatorLevel = data[11]; this.levelRestriction = (sbyte)data[12]; if (data[12] != 0xff) { this.minLevel = Math.Max(1, data[11] - data[12]); this.maxLevel = Math.Min(0x63, data[11] + data[12]); } this.maxPlayers = data[13]; this.playerCount = data[14]; this.players = new CharacterBaseInfo[this.playerCount]; int offset = 0x30; for (int i = 0; i < this.playerCount; i++) { this.players[i] = new CharacterBaseInfo(ByteConverter.GetNullString(data, offset), data[15 + i], data[0x1f + i]); offset += this.players[i].Name.Length + 1; } }
private void Setup(GameFlags templateArg) { setFlags = new List <string>(); foreach (string iterFlag in templateArg.setFlags) { setFlags.Add(iterFlag); } }
void Start() { Screen.sleepTimeout = SleepTimeout.NeverSleep; Timeout.ResetValues(); GameFlags.ResetValues(); Scenes.ResetValues(); Help.ResetValues(); Sound.ResetValues(); }
public void Setup() { gameFlags = new GameFlags(); playableCharacterData = new List <CharacterData>(); partyInventory = new PartyInventory(); havenData = new HavenData(); }
public Room(string roomId, List <Command> commands, GameInfo gameInfo, GameFlags gameFlags) : base(roomId) { _roomId = roomId; _commands = commands; _gameInfo = gameInfo; _gameFlags = gameFlags; _random = new Random(); }
protected override void WincheckMatch() { if (IsTeamplay()) { if (GameInfo.ScoreLimit > 0 && ( TeamScore[(int)Team.Red] >= GameInfo.ScoreLimit || TeamScore[(int)Team.Blue] >= GameInfo.ScoreLimit) || GameInfo.TimeLimit > 0 && (Server.Tick - GameStartTick) >= GameInfo.TimeLimit * Server.TickSpeed * 60) { if (TeamScore[(int)Team.Red] != TeamScore[(int)Team.Blue] || GameFlags.HasFlag(GameFlags.Survival)) { EndMatch(); } else { SuddenDeath = true; } } } else { var topScore = 0; var topScoreCount = 0; for (var i = 0; i < GameContext.Players.Length; i++) { if (GameContext.Players[i] == null) { continue; } if (Score(i) > topScore) { topScore = Score(i); topScoreCount = 1; } else if (Score(i) == topScore) { topScoreCount++; } } if (GameInfo.ScoreLimit > 0 && topScore >= GameInfo.ScoreLimit || GameInfo.TimeLimit > 0 && Server.Tick - GameStartTick >= GameInfo.TimeLimit * Server.TickSpeed * 60) { if (topScoreCount == 1) { EndMatch(); } else { SuddenDeath = true; } } } }
public void Run(GameFlags flags = GameFlags.None, string[] args = null) { if (instance != null) { throw new InvalidOperationException("Cannot run a game while one instance is already running. If you wish to run multiple game instances - use AssemblyLoadContexts to isolate engine & same game assemblies from each other."); } instance = this; Flags = flags; StartArguments = Array.AsReadOnly(args); NoWindow = Flags.HasFlag(GameFlags.NoWindow); NoGraphics = Flags.HasFlag(GameFlags.NoGraphics); NoAudio = Flags.HasFlag(GameFlags.NoAudio); DllResolver.Init(); AssemblyCache.Init(); InitializeModules(); Debug.Log("Loading engine..."); //TODO: Move this. assetsPath = "Assets" + Path.DirectorySeparatorChar; if (args != null) { string joinedArgs = string.Join(" ", args); var matches = RegexCache.commandArguments.Matches(joinedArgs); var dict = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase); foreach (Match match in matches) { dict[match.Groups[1].Value] = match.Groups[2].Value; } if (dict.TryGetValue("assetspath", out string path)) { assetsPath = path ?? throw new ArgumentException("Expected a directory path after command line argument 'assetspath'."); } } assetsPath = Path.GetFullPath(assetsPath); AppDomain.CurrentDomain.ProcessExit += ApplicationQuit; moduleHooks.PreInit?.Invoke(); PreInit(); preInitDone = true; Init(); if (!Flags.HasFlag(GameFlags.ManualUpdate)) { UpdateLoop(); Dispose(); } }
public void GameFlagsPacket() { var bytes = new byte[] { 0x01, 0x02, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00 }; var packet = new GameFlags(new D2gsPacket(bytes)); Assert.Equal(Difficulty.Hell, packet.Difficulty); Assert.False(packet.Expansion); Assert.False(packet.Hardcore); Assert.False(packet.Ladder); }
public override void CompleteInteract() { if (!Flags.AcquireRod) { var storyOver = _gameFrameStory.GetVariableState <int>("acquire_rod") == 1; if (storyOver) { GameFlags.SetVariable("acquire_rod", true); } } }
public override GameFrameStory Interact() { if (StoryOver && !AcquireSword) { AcquireSword = true; GameFlags.SetVariable("acquire_sword", true); return(ReadStory("dojo_master_acquire_sword.ink")); } else { return(base.Interact()); } }
public override bool GetRespawnDisabled(BasePlayer player) { if (GameFlags.HasFlag(GameFlags.Survival)) { if (GameState == GameState.WarmupGame || GameState == GameState.WarmupUser || GameState == GameState.StartCountdown && GameStartTick == Server.Tick) { return(false); } return(true); } return(false); }
public override void Deserialize(int[] data, int dataOffset) { if (!RangeCheck(data, dataOffset)) { return; } GameFlags = (GameFlags)data[dataOffset + 0]; GameStateFlags = (GameStateFlags)data[dataOffset + 1]; RoundStartTick = data[dataOffset + 2]; WarmupTimer = data[dataOffset + 3]; ScoreLimit = data[dataOffset + 4]; TimeLimit = data[dataOffset + 5]; RoundNum = data[dataOffset + 6]; RoundCurrent = data[dataOffset + 7]; }
// Methods public GameList(byte[] data) : base(data) { this.requestID = BitConverter.ToUInt16(data, 1); this.index = BitConverter.ToUInt32(data, 3); this.playerCount = data[7]; this.flags = (GameFlags)BitConverter.ToUInt32(data, 8); if ((this.flags & GameFlags.Valid) == GameFlags.Valid) { this.name = ByteConverter.GetNullString(data, 12); if (data.Length > (14 + this.name.Length)) { this.description = ByteConverter.GetNullString(data, 13 + this.name.Length); } } }
private void Initialize(GameFlags packet) { Data = new GameData(packet, selectedCharacter); lastPing = DateTime.Now; lastPong = DateTime.Now; _gameServer.Ping(); chickenThread = new Thread(ChickenAndLifeManaThread) { Name = "GameClient Chicken Thread", IsBackground = true }; chickenThread.Start(); pingThread = new Thread(PingThread) { Name = "GameClient Ping Thread", IsBackground = true }; pingThread.Start(); }
public GameDialogSet(GameInfo gameInfo, GameFlags gameFlags, IStatePropertyAccessor <DialogState> dialogStateAccessor) : base(dialogStateAccessor) { var roomParser = new RoomParser(); var conversationParser = new ConversationParser(); foreach (var script in gameInfo.RoomScripts) { var commands = roomParser.Parse(script.Path); Add(new Room(script.Key, commands, gameInfo, gameFlags)); } foreach (var script in gameInfo.ConversationScripts) { var conversationRootNode = conversationParser.Parse(script.Path); Add(new Conversation(script.Key, conversationRootNode, gameFlags)); } }
public override GameFrameStory Interact() { GameStory = ReadStory("princess_pre_kidnapping.ink"); GameStory.ObserveVariable("move_bandit", (varName, newValue) => { var moveTo = PlayerEntity.Instance.Position.ToPoint(); MoveDelegate(_fakeGuard, moveTo); }); GameStory.ObserveVariable("fwacked", (varName, newValue) => { if (!Fwacked) { Fwacked = true; _removeEntity.Invoke(_fakeGuard); _removeEntity.Invoke(this); GameFlags.SetVariable("princess_kidnapped", true); } }); return(GameStory); }
public override GameFrameStory Interact() { GameFrameStory toReturn; if (Flags.AcquiredSword) { _complete = true; toReturn = ReadStory("sword_blocker_complete.ink"); GameFlags.SetVariable("sword_blocker_moved", true); } else if (!_moved) { toReturn = ReadStory("sword_blocker.ink"); } else { toReturn = ReadStory("sword_blocker_moved.ink"); } return(toReturn); }
protected override void OnCharacterDied(BaseCharacter victim, BasePlayer killer, Weapon weapon, ref int modespecial) { victim.Died -= OnCharacterDied; if (killer == null || weapon == BasePlayer.WeaponGame) { return; } if (killer == victim.Player) { Scores[killer.ClientId]--; } else { if (IsTeamplay() && victim.Player.Team == killer.Team) { Scores[killer.ClientId]--; } else { Scores[killer.ClientId]++; } } if (weapon == BasePlayer.WeaponSelf) { victim.Player.RespawnTick = Server.Tick + Server.TickSpeed * 3; } if (GameFlags.HasFlag(GameFlags.Survival)) { for (var i = 0; i < GameContext.Players.Length; i++) { if (GameContext.Players[i] != null && GameContext.Players[i].DeadSpectatorMode) { GameContext.Players[i].UpdateDeadSpecMode(); } } } }
protected override void OnCharacterSpawn(BasePlayer player, BaseCharacter character) { character.Died += OnCharacterDied; if (GameFlags.HasFlag(GameFlags.Survival)) { character.IncreaseHealth(10); character.IncreaseArmor(5); character.GiveWeapon(Weapon.Gun, 10); character.GiveWeapon(Weapon.Grenade, 10); character.GiveWeapon(Weapon.Shotgun, 10); character.GiveWeapon(Weapon.Laser, 5); player.RespawnDisabled = GetRespawnDisabled(player); } else { character.IncreaseHealth(10); character.GiveWeapon(Weapon.Gun, 10); } }
public override GameFrameStory Interact() { var scriptName = Flags.LearnedFight ? "north_guard_post_fight.ink" : "north_guard_pre_fight.ink"; GameStory = ReadStory(scriptName); if (Flags.LearnedFight) { GameStory.ChoosePathString("dialog"); CompleteEvent completeEvent = victory => { if (victory) { var collision = _collision.Invoke(Position.ToPoint(), EndPosition.ToPoint()); var endPoint = collision ? _alternativeEndPoint : EndPosition; MoveDelegate?.Invoke(this, endPoint.ToPoint()); GameFlags.SetVariable(FlagName, true); AlreadyMoved = true; } }; ReadStory(GameStory, completeEvent); } return(GameStory); }
/// <summary> /// Returns whether the given event passes the flag check based on given set flags. /// </summary> /// <param name="eventArg"></param> /// <param name="gameFlagsArg"></param> /// <returns></returns> private bool HaveRequiredFlags(HavenLocationEvent eventArg, GameFlags gameFlagsArg) { // if given event does NOT require flags if (!eventArg.RequiresFlag()) { // return that passed flag check return(true); } // loop through all given events needed flags foreach (string iterFlag in eventArg.GetAppropriateRequiredFlags(gameFlagsArg)) { // if given flags do NOT have the iterating needed flag if (!gameFlagsArg.IsFlagSet(iterFlag)) { // return that did NOT pass flag check return(false); } } // return that passed flag check return(true); }
public override void CompleteInteract() { if (Flags.PrincessKidnapped) { if (GaveFish) { var preStoryOver = StoryOver; base.CompleteInteract(); if (StoryOver && !preStoryOver) { GameFlags.SetVariable("learned_fight", true); } } else { GaveFish = GameStory.GetVariableState <int>(GaveFishVariable) == 1; if (GaveFish) { GameFlags.SetVariable(GaveFishVariable, GaveFish); Flags.FishCount -= 3; } } } }
/// <summary> /// Returns list of all flags needed for this event. /// </summary> /// <param name="gameFlagsArg"></param> /// <returns></returns> public List <string> GetAppropriateRequiredFlags(GameFlags gameFlagsArg) { // initialize return list as empty list List <string> appropriateFlags = new List <string>(); // add all the required flags to return list foreach (string iterFlag in requiredFlags) { appropriateFlags.Add(iterFlag); } // if need flag that denotes if waifu is sexually comfortable with MC if (requiresAssociatedWaifuSexuallyComfortable) { // get the waifu's char ID string waifuId = GeneralMethods.GetWaifuCharacterId(associatedWaifu); // add waifu's sex comfort flag appropriateFlags.Add(gameFlagsArg.GetSexuallyComfortableFlag(waifuId)); } // return the setup list of flags return(appropriateFlags); }
public override GameFrameStory Interact() { GameStory = ReadStory(ScriptName); GameStory.ChoosePathString("dialog"); CompleteEvent completeEvent = win => { if (win) { var collision = _collision.Invoke(Position.ToPoint(), EndPosition.ToPoint()); var endPoint = collision ? _alternativeEndPoint : EndPosition; MoveDelegate?.Invoke(this, endPoint.ToPoint()); GameFlags.SetVariable(FlagName, true); AlreadyMoved = true; } var dialog = win ? "victory.ink" : "defeat.ink"; var storyScript = StoryImporter.ReadStory(dialog); var newStory = new GameFrameStory(storyScript); newStory.Continue(); _say.Invoke(newStory); }; ReadStory(GameStory, completeEvent); return(GameStory); }
public override CommandActionResult Execute(DialogContext dc, IList <IActivity> activities, GameFlags flags) { activities.Add(CreateEventActivity(dc, "CloseUpClosed", JObject.FromObject(new { closeUpId = CloseUpId }))); return(CommandActionResult.None); }
/// <summary> /// /// </summary> /// <param name="staticMemoryAddr">Base of static memory.</param> /// <param name="highMemoryAddr">Base of high memory.</param> /// <param name="initProgramCounterAddr">Initial address of the program counter.</param> /// <param name="dictionaryAddr">Address of the dictionary table.</param> /// <param name="objectTableAddr">Address of the object table.</param> /// <param name="globalVariablesTableAddr">Address of the global variables table.</param> /// <param name="headerExtensionTableAddr">Address of the header extension table.</param> /// <param name="releaseNumber">Release number given to this story file.</param> public ZHeader(ushort staticMemoryAddr, ushort highMemoryAddr, ushort initProgramCounterAddr, ushort dictionaryAddr, ushort objectTableAddr, ushort globalVariablesTableAddr, ushort headerExtensionTableAddr, ushort releaseNumber) { _versionNumber = 0x08; // CodeGen supports version 8 only. _interpreterFlags = InterpreterFlags.None; // Flags set by the interpreter. Let it be zero for a new story file. _releaseNumber = releaseNumber; // Release Number of this story file. _highMemoryAddr = highMemoryAddr; // Base of high memory. 0xFFFF _initProgramCounterAddr = initProgramCounterAddr; // Initial value of program counter. 0x2000 _dictionaryAddr = dictionaryAddr; // Points to the Dictionary Table. 0x4000 _objectTableAddr = objectTableAddr; // Points to the Object Table. 0x0048 _globalVariablesTableAddr = globalVariablesTableAddr; // Points to the Global Variables Table. 0x0048 _staticMemoryAddr = staticMemoryAddr; // Base of static memory. 0x4000 _gameFlags = GameFlags.None; // Flags set by the game. Zero at start. _serialNumber = new byte[6]; // Let's ignore the serial number for now. _abbreviationsTableAddr = 0x0000; // Not supported yet. _lengthOfStoryFile = 0x0000; // Not supported yet. _checksumOfStoryFile = 0x0000; // Not supported yet. _interpreterNumber = 0x00; // Set by interpreter. _interpreterVersion = 0x00; // Set by interpreter. _screenHeightInLines = 0x00; // Set by interpreter. _screenWidthInChars = 0x00; // Set by interpreter. _screenWidthInUnits = 0x0000; // Set by interpreter. _screenHeightInUnits = 0x0000; // Set by interpreter. _fontHeightInUnits = 0x00; // Set by interpreter. _fontWidthInUnits = 0x00; // Set by interpreter. _routinesOffset = 0x0000; // Is this version 6 only? _staticStringsOffset = 0x0000; // Is this version 6 only? _defaultBackgroundColor = 0x00; // Set by interpreter. _defaultForegroundColor = 0x00; // Set by interpreter. _terminatingCharsTableAddr = 0x0000; // Not supported yet. _textWidthForOutputStream3 = 0x0000; // Is this version 6 only? _standardRevisionNumber = 0x0000; // Set by interpreter. _alphabetTableAddr = 0x0000; // Not supported yet. _headerExtensionTableAddr = headerExtensionTableAddr; // Points to Header Extension Table. 0x0040 }
// Methods public GameList(byte[] data) : base(data) { this.requestID = BitConverter.ToUInt16(data, 1); this.index = BitConverter.ToUInt32(data, 3); this.playerCount = data[7]; this.flags = (GameFlags)BitConverter.ToUInt32(data, 8); if ((this.flags & GameFlags.Valid) == GameFlags.Valid) { this.name = ByteConverter.GetNullString(data, 12); if (data.Length > (14 + this.name.Length)) { this.description = ByteConverter.GetNullString(data, 13 + this.name.Length); } } }
// Methods public GameInfo(byte[] data) : base(data) { this.minLevel = -1; this.maxLevel = -1; this.requestID = BitConverter.ToUInt16(data, 1); this.flags = (GameFlags)BitConverter.ToUInt32(data, 3); this.uptime = new TimeSpan(BitConverter.ToUInt32(data, 7) * 0x989680L); this.creatorLevel = data[11]; this.levelRestriction = (sbyte)data[12]; if (data[12] != 0xff) { this.minLevel = Math.Max(1, data[11] - data[12]); this.maxLevel = Math.Min(0x63, data[11] + data[12]); } this.maxPlayers = data[13]; this.playerCount = data[14]; this.players = new CharacterBaseInfo[this.playerCount]; int offset = 0x30; for (int i = 0; i < this.playerCount; i++) { this.players[i] = new CharacterBaseInfo(ByteConverter.GetNullString(data, offset), data[15 + i], data[0x1f + i]); offset += this.players[i].Name.Length + 1; } }