public void Unlock(UnlockType unlockType) { if(unlockType != UnlockType.NONE) { radialMenuPortions.Where(p => p.animal.Equals(unlockType)).FirstOrDefault().Unlock(); } }
public MyoResult Unlock64(IntPtr myo, UnlockType type, out IntPtr error) { // Contract.Requires<ArgumentException>(myo != IntPtr.Zero, "The pointer to Myo event must be set."); error = default(IntPtr); return(default(MyoResult)); }
public override int GetHashCode() { int hash = 1; if (Enabled != false) { hash ^= Enabled.GetHashCode(); } if (AvatarType != 0) { hash ^= AvatarType.GetHashCode(); } hash ^= slot_.GetHashCode(); if (BundleName.Length != 0) { hash ^= BundleName.GetHashCode(); } if (AssetName.Length != 0) { hash ^= AssetName.GetHashCode(); } if (GroupName.Length != 0) { hash ^= GroupName.GetHashCode(); } if (SortOrder != 0) { hash ^= SortOrder.GetHashCode(); } if (UnlockType != 0) { hash ^= UnlockType.GetHashCode(); } hash ^= promoType_.GetHashCode(); if (UnlockBadgeType != 0) { hash ^= UnlockBadgeType.GetHashCode(); } if (IapSku.Length != 0) { hash ^= IapSku.GetHashCode(); } if (UnlockBadgeLevel != 0) { hash ^= UnlockBadgeLevel.GetHashCode(); } if (IconName.Length != 0) { hash ^= IconName.GetHashCode(); } if (UnlockPlayerLevel != 0) { hash ^= UnlockPlayerLevel.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public void RebuildTexts() { string arg = string.Empty; string text = string.Format("[snout] {0}", this.cost); UnlockType unlockType = this.unlockType; if (unlockType != SpecialSandboxUnlockDialog.UnlockType.Skull) { if (unlockType == SpecialSandboxUnlockDialog.UnlockType.Statue) { arg = "[statue]"; } } else { arg = "[skull]"; } string text2 = string.Format("{0} {1}/{2}", arg, this.collected, this.required); for (int i = 0; i < this.collectedTexts.Length; i++) { this.collectedTexts[i].text = text2; TextMeshSpriteIcons.EnsureSpriteIcon(this.collectedTexts[i]); } this.costTextDisabled.text = text; TextMeshSpriteIcons.EnsureSpriteIcon(this.costTextDisabled); this.costTextEnabled.text = text; TextMeshSpriteIcons.EnsureSpriteIcon(this.costTextEnabled); }
public void UnlockAll(UnlockType type) { foreach (var myo in Myos) { myo.Unlock(type); } }
void SetStatus(UnlockType type, int value, string stoneName) { RawImage stoneImage = content.Find(stoneName).GetComponent <RawImage>(); stoneImage.color = Color.white; if (PlayerPrefs.GetInt(stoneName, 0) == 1) { return; } if (type == UnlockType.ChallengeCount) { // 回数超えてなかったらダメ判定 if (PlayerPrefs.GetInt("ChallengeCount", 0) < value) { float hard = 0.2f; stoneImage.color *= hard; return; } } else if (type == UnlockType.HighScore) { // 回数超えてなかったらダメ判定 if (PlayerPrefs.GetInt("HighScore", 0) < value) { float hard = 0.2f; stoneImage.color *= hard; return; } } PlayerPrefs.SetInt(stoneName, 1); }
public void Unlock(UnlockType type, int myoId = 0) { if (myoId < 0 || myoId >= Myos.Count) { return; } Myos.ElementAt(myoId).Unlock(type); }
public SaveData(int index, string id, string name, string description = "", bool isSelected = false, bool isUnlocked = false, int unlockPrice = 1, UnlockType unlockType = UnlockType.Star) { this.index = index; this.name = name; this.description = description; this.id = id; this.isUnlocked = isUnlocked; this.isSelected = isSelected; this.unlockPrice = unlockPrice; this.unlockType = unlockType; }
/// <summary> /// Causes the Myo to unlock. /// </summary> /// <param name="type">The type of unlock.</param> public void Unlock(UnlockType type) { if (PlatformInvocation.Running32Bit) { unlock_32(_handle, type, IntPtr.Zero); } else { unlock_64(_handle, type, IntPtr.Zero); } }
private static bool ShouldDo(Unlock unlock, Dictionary <string, ParsedArg> config, Dictionary <string, TagExpectedValue> tags, Type unlockType) { UnlockType type = Unlock.GetUnlockType(unlockType); string typeLower = type.ToString().ToLowerInvariant(); if (config == null) { return(unlock.Type == type); } return(unlock.Type == type && config.ContainsKey(typeLower) && config[typeLower].ShouldDo(unlock.GetName(), tags)); }
public static List <UnlockData> GetUnlocks(UnlockType type) { if (type == UnlockType.Any) { return(new List <UnlockData>((IEnumerable <UnlockData>)Unlocks._allUnlocks)); } List <UnlockData> unlockDataList = new List <UnlockData>(); foreach (UnlockData allUnlock in Unlocks._allUnlocks) { if (allUnlock.type == type) { unlockDataList.Add(allUnlock); } } return(unlockDataList); }
/// <inheritdoc /> public void Unlock(UnlockType type) { var command = MyoCommand.Create( _myoErrorHandlerDriver, () => { IntPtr errorHandle; var result = PlatformInvocation.Running32Bit ? _myoDeviceBridge.Unlock32(_handle, type, out errorHandle) : _myoDeviceBridge.Unlock64(_handle, type, out errorHandle); return(MyoCommandResult.Create( result, errorHandle)); }); command.Execute(); }
public void RebuildIcons() { if (Singleton <RuntimeSpriteDatabase> .Instance != null) { RuntimeSpriteDatabase instance = Singleton <RuntimeSpriteDatabase> .Instance; UnlockType unlockType = this.unlockType; if (unlockType != SpecialSandboxUnlockDialog.UnlockType.Skull) { if (unlockType == SpecialSandboxUnlockDialog.UnlockType.Statue) { this.sandboxLogo.SelectSprite(instance.Find(TextDialog.LocalizeSprite.GetLocalizedSprite(this.statueEpisodeIcon, Singleton <Localizer> .Instance.CurrentLocale)), true); } } else { this.sandboxLogo.SelectSprite(instance.Find(TextDialog.LocalizeSprite.GetLocalizedSprite(this.skullEpisodeIcon, Singleton <Localizer> .Instance.CurrentLocale)), true); } } }
private Sprite GetImage(UnlockType unlockType) { switch (unlockType) { case UnlockType.BOAR: return(boarIcon); case UnlockType.SQUIRREL: return(squirrelIcon); case UnlockType.CHAMELEON: return(chameleonIcon); case UnlockType.NONE: return(invisibleIcon); default: return(null); } }
public IEnumerable <Unlock> GetUnlocksOfType(UnlockType type) { var @return = new List <Unlock>(); if (OtherUnlocks != null) { @return.AddRange(OtherUnlocks?.Where(x => x.Type == type)); } if (UnknownUnlocks != null) { @return.AddRange(UnknownUnlocks?.Where(x => x.Type == type)); } if (LevelUnlocks != null) { foreach (var levelUnlocks in LevelUnlocks) { if (levelUnlocks?.Unlocks == null) { continue; } @return.AddRange(levelUnlocks?.Unlocks.Where(x => x.Type == type)); } } if (LootBoxesUnlocks != null) { foreach (var lootBoxesUnlock in LootBoxesUnlocks) { if (lootBoxesUnlock?.Unlocks == null) { continue; } @return.AddRange(lootBoxesUnlock?.Unlocks.Where(x => x.Type == type)); } } return(@return); }
public void SetInfoLabel(UnlockType infoType) { if (this.timerInfos == null) { return; } for (int i = 0; i < this.timerInfos.Length; i++) { if (this.timerInfos[i] != null) { this.timerInfos[i].SetActive(i == (int)infoType); } } if (this.openNowControls != null) { this.openNowControls.SetActive(infoType <= UnlockLootCrateSlotDialog.UnlockType.PurchaseInactiveCrate); } if (this.unlockNowControls != null) { this.unlockNowControls.SetActive(infoType == UnlockLootCrateSlotDialog.UnlockType.StartUnlocking); } }
// Given the type of unlock condition, check if the condition is satisfied bool ConditionIsSatisfied(UnlockType ut) { switch (ut) { case UnlockType.DefeatAll: return(DefeatAllIsSatisfied()); case UnlockType.DefeatSpecific: break; case UnlockType.CollectAll: break; case UnlockType.CollectSpecific: break; case UnlockType.InteractAll: break; case UnlockType.InteractSpecific: break; } return(false); }
/// <inheritdoc /> public void Unlock(UnlockType type) { var command = MyoCommand.Create( _myoErrorHandlerDriver, () => { IntPtr errorHandle; var result = PlatformInvocation.Running32Bit ? _myoDeviceBridge.Unlock32(_handle, type, out errorHandle) : _myoDeviceBridge.Unlock64(_handle, type, out errorHandle); return MyoCommandResult.Create( result, errorHandle); }); command.Execute(); }
public void Unlock(UnlockType type) { libmyo.myo_unlock(_handle, (libmyo.UnlockType)type, IntPtr.Zero); }
public void Unlock(UnlockType type) { #if !UNITY_ANDROID || UNITY_EDITOR libmyo.myo_unlock(_handle, (libmyo.UnlockType)type, IntPtr.Zero); #endif }
private static extern void unlock_64(IntPtr myo, UnlockType type, IntPtr error);
public UnlockEventArgs(TSPlayer player, DPoint location, UnlockType unlockType) : base(player, location) { this.UnlockType = unlockType; }
public static extern void myo_unlock(IntPtr myo, UnlockType unlockType, IntPtr error);
public MyoResult Unlock64(IntPtr myo, UnlockType type, out IntPtr error) { Contract.Requires<ArgumentException>(myo != IntPtr.Zero, "The pointer to Myo event must be set."); error = default(IntPtr); return default(MyoResult); }
public void IssueCommand_Unlock (UnlockType unlock) { this.IssueCommand (new ProtocolCommandUnlockType ((ProtocolUnlockMode) unlock)); }
// Given the type of unlock condition, set up the room accordingly void SetUpRoom(UnlockType ut) { }
public void OnDeserialize(BinaryReader reader) { type = (UnlockType)reader.ReadByte(); x = reader.ReadInt16(); y = reader.ReadInt16(); }
/// <inheritdoc /> public void Unlock(UnlockType type) { _myoDeviceDriver.Unlock(type); }
public void Unlock(UnlockType type) { }
public void SetNewItemNotif(int p_itemType, UnlockType p_type) { if (p_type == UnlockType.Flavor) { List <Flavors> flavor = Utilities.GetFlavor(p_itemType); switch (flavor[0]) { case Flavors.Vanilla: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_flavor_vanilla"); break; case Flavors.Chocolate: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_flavor_chocolate"); break; case Flavors.Strawberry: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_flavor_strawberry"); break; case Flavors.Bubblegum: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_flavor_bubblegum"); break; case Flavors.GreenTea: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_flavor_greentea"); break; } m_notifBoardText.text = "You have unlocked a new flavor!"; } else if (p_type == UnlockType.Topping) { List <Toppings> topping = Utilities.GetToppings(p_itemType); switch (topping[0]) { case Toppings.CrushedOreos: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_toppings_oreo"); break; case Toppings.GummyWorms: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_toppings_gummypets"); break; case Toppings.RainbowSprinkles: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_toppings_sprinkles"); break; case Toppings.RiceKrispies: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_toppings_ricekrispies"); break; case Toppings.TinyMarshmallow: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_toppings_marshmallow"); break; } m_notifBoardText.text = "You have unlocked a new topping!"; } else if (p_type == UnlockType.Syrup) { List <Syrups> syrup = Utilities.GetSyrups(p_itemType); switch (syrup[0]) { case Syrups.Blueberry: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_syrup_blueberry"); break; case Syrups.Caramel: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_syrup_caramel"); break; case Syrups.Chocolate: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_syrup_chocolate"); break; case Syrups.Honey: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_syrup_honey"); break; case Syrups.Strawberry: m_notifBoardImage.sprite = AssetArchive.Instance.GetSpriteIcon("ICON_syrup_strawberry"); break; } m_notifBoardText.text = "You have unlocked a new syrup!"; } }
private void NetHooks_GetData(GetDataEventArgs e) { if (e == null || this.isDisposed || e.Handled) { return; } TSPlayer player = TShock.Players[e.Msg.whoAmI]; if (player == null) { return; } try { switch (e.MsgID) { case PacketTypes.Tile: { if (this.TileEdit == null) { break; } int editType = e.Msg.readBuffer[e.Index]; int x = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 1); int y = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 3); if (!TerrariaUtils.Tiles.IsValidCoord(x, y) || editType > 14) { return; } int blockType = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 5); int objectStyle = e.Msg.readBuffer[e.Index + 7]; e.Handled = this.OnTileEdit( new TileEditEventArgs(player, (TileEditType)editType, new DPoint(x, y), (BlockType)blockType, objectStyle )); break; } case PacketTypes.PlaceObject: { if (this.ObjectPlacement == null && this.TileEdit == null) { break; } int x = BitConverter.ToInt16(e.Msg.readBuffer, e.Index); int y = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 2); if (!TerrariaUtils.Tiles.IsValidCoord(x, y)) { return; } int blockType = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 4); int objectStyle = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 6); int alternative = e.Msg.readBuffer[e.Index + 8]; int random = ((sbyte)e.Msg.readBuffer[e.Index + 9]); bool direction = BitConverter.ToBoolean(e.Msg.readBuffer, e.Index + 10); if (this.InvokeTileOnObjectPlacement) { e.Handled = this.OnTileEdit( new TileEditEventArgs(player, TileEditType.PlaceTile, new DPoint(x, y), (BlockType)blockType, objectStyle )); } if (!e.Handled) { e.Handled = this.OnObjectPlacement( new ObjectPlacementEventArgs(player, new DPoint(x, y), (BlockType)blockType, objectStyle, alternative, random, direction )); } break; } // Note: As for TileKill and TileKillNoItem, blockId will be of "1" if the player attempted to destroy // a tile but didn't succeed yet, and will be of "0" as the tile is actually destroyed. // However, there's one exception with Chests, they will never send their actual destroy packet, except a hack // tool is used, it seems. case PacketTypes.TileKill: { int type = e.Msg.readBuffer[e.Index]; int x = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 1); int y = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 3); if (!TerrariaUtils.Tiles.IsValidCoord(x, y)) { break; } int style = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 5); if (type == 0 || type == 2) // Chest placement / Dresser Placement { e.Handled = this.OnChestPlace(new ChestPlaceEventArgs(player, new DPoint(x, y), type, style)); } else // Chest kill { int tileType = TerrariaUtils.Tiles[x, y].type; if (tileType != TileID.Containers && tileType != TileID.Dressers) { break; } if (this.InvokeTileEditOnChestKill) { e.Handled = this.OnTileEdit(new TileEditEventArgs(player, TileEditType.TileKill, new DPoint(x, y), 0, 0)); } if (!e.Handled) { e.Handled = this.OnChestKill(new TileLocationEventArgs(player, new DPoint(x, y))); } } break; } case PacketTypes.ChestOpen: { if (this.ChestOpen == null && this.ChestRename == null) { break; } int chestIndex = BitConverter.ToInt16(e.Msg.readBuffer, e.Index); int x = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 2); int y = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 4); if (!TerrariaUtils.Tiles.IsValidCoord(x, y)) { break; } int nameLength = e.Msg.readBuffer[e.Index + 6]; string newName = string.Empty; if ((nameLength > 0 && nameLength <= 20) || nameLength == 255) // Name change requested? { if (nameLength != 255) { newName = Encoding.UTF8.GetString(e.Msg.readBuffer, e.Index + 8, nameLength); } e.Handled = this.OnChestRename(new ChestRenameEventArgs(player, chestIndex, newName)); } if (!e.Handled) { e.Handled = this.OnChestOpen(new ChestOpenEventArgs(player, chestIndex, new DPoint(x, y))); } break; } case PacketTypes.ChestGetContents: { if (this.ChestGetContents == null) { break; } int x = BitConverter.ToInt16(e.Msg.readBuffer, e.Index); int y = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 2); if (!TerrariaUtils.Tiles.IsValidCoord(x, y) || !Main.tile[x, y].active()) { return; } e.Handled = this.OnChestGetContents(new TileLocationEventArgs(player, new DPoint(x, y))); break; } case PacketTypes.ChestItem: { if (this.ChestModifySlot == null) { break; } int chestIndex = BitConverter.ToInt16(e.Msg.readBuffer, e.Index); int slotIndex = e.Msg.readBuffer[e.Index + 2]; int itemStackSize = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 3); ItemPrefix itemPrefix = (ItemPrefix)e.Msg.readBuffer[e.Index + 5]; ItemType itemType = (ItemType)BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 6); if (chestIndex >= Main.chest.Length || slotIndex > 39) { break; } e.Handled = this.OnChestModifySlot(new ChestModifySlotEventArgs( player, chestIndex, slotIndex, new ItemData(itemPrefix, itemType, itemStackSize) )); break; } case PacketTypes.SignNew: { if (this.SignEdit == null) { break; } int signIndex = BitConverter.ToInt16(e.Msg.readBuffer, e.Index); int x = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 2); int y = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 4); string newText; using (MemoryStream stream = new MemoryStream(e.Msg.readBuffer, e.Index + 6, e.Length - 7)) newText = new BinaryReader(stream).ReadString(); if (!TerrariaUtils.Tiles.IsValidCoord(x, y) || !Main.tile[x, y].active()) { return; } e.Handled = this.OnSignEdit(new SignEditEventArgs(player, signIndex, new DPoint(x, y), newText)); break; } case PacketTypes.SignRead: { if (this.SignRead == null) { break; } int x = BitConverter.ToInt16(e.Msg.readBuffer, e.Index); int y = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 2); if (!TerrariaUtils.Tiles.IsValidCoord(x, y)) { break; } e.Handled = this.OnSignRead(new TileLocationEventArgs(player, new DPoint(x, y))); break; } case PacketTypes.HitSwitch: { if (this.HitSwitch == null) { break; } int x = BitConverter.ToInt16(e.Msg.readBuffer, e.Index); int y = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 2); if (!TerrariaUtils.Tiles.IsValidCoord(x, y) || !Main.tile[x, y].active()) { return; } // For some reason, TShock doesn't handle this packet so we just do our own checks. if (TShock.CheckIgnores(player)) { return; } if (TShock.CheckRangePermission(player, x, y, 32)) { return; } e.Handled = this.OnHitSwitch(new TileLocationEventArgs(player, new DPoint(x, y))); break; } case PacketTypes.SpawnBossorInvasion: { if (this.BossSpawn == null) { break; } //int playerIndex = BitConverter.ToInt32(e.Msg.readBuffer, e.Index); int bossType = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 2); e.Handled = this.OnBossSpawn(new BossSpawnEventArgs(player, (BossType)bossType)); break; } case PacketTypes.ItemDrop: case PacketTypes.UpdateItemDrop: { // ItemDrop2 if (this.ItemUpdate == null) { break; } int itemIndex = BitConverter.ToInt16(e.Msg.readBuffer, e.Index); float x = BitConverter.ToSingle(e.Msg.readBuffer, e.Index + 2); float y = BitConverter.ToSingle(e.Msg.readBuffer, e.Index + 6); float velocityX = BitConverter.ToSingle(e.Msg.readBuffer, e.Index + 10); float velocityY = BitConverter.ToSingle(e.Msg.readBuffer, e.Index + 14); int itemStackSize = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 18); ItemPrefix itemPrefix = (ItemPrefix)e.Msg.readBuffer[e.Index + 20]; bool noDelay = (e.Msg.readBuffer[e.Index + 21] != 0); ItemType itemType = (ItemType)BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 22); // If it is actually an item pick up, then ensure a valid item index. if (itemType == 0 && (itemIndex < 0 || itemIndex >= Main.item.Length)) { break; } e.Handled = this.OnItemUpdate(new ItemUpdateEventArgs( player, itemIndex, new Vector2(x, y), new Vector2(velocityX, velocityY), noDelay, new ItemData(itemPrefix, itemType, itemStackSize) )); break; } case PacketTypes.ItemOwner: { if (this.ItemOwner == null) { break; } int itemIndex = BitConverter.ToInt16(e.Msg.readBuffer, e.Index); int newOwnerPlayerIndex = e.Msg.readBuffer[e.Index + 2]; TSPlayer newOwner; if (newOwnerPlayerIndex < 255) { newOwner = TShock.Players[newOwnerPlayerIndex]; } else { break; } e.Handled = this.OnItemOwner(new ItemOwnerEventArgs(player, itemIndex, newOwner)); break; } case PacketTypes.ForceItemIntoNearestChest: { // QuickStackNearby if (this.QuickStackNearby == null) { break; } int slotIndex = e.Msg.readBuffer[e.Index]; if (slotIndex >= TSPlayer.Server.TPlayer.inventory.Length) { break; } e.Handled = this.OnQuickStackNearby(new PlayerSlotEventArgs(player, slotIndex)); break; } case PacketTypes.PlayerSlot: { if (this.PlayerModifySlot == null) { break; } //byte playerIndex = e.Msg.readBuffer[e.Index]; int slotIndex = e.Msg.readBuffer[e.Index + 1]; int itemStackSize = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 2); ItemPrefix itemPrefix = (ItemPrefix)e.Msg.readBuffer[e.Index + 4]; ItemType itemType = (ItemType)BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 5); Player tServerPlayer = TSPlayer.Server.TPlayer; if (slotIndex >= tServerPlayer.inventory.Length + tServerPlayer.bank.item.Length + tServerPlayer.bank2.item.Length) { break; } e.Handled = this.OnPlayerModifySlot(new PlayerModifySlotEventArgs( player, slotIndex, new ItemData(itemPrefix, itemType, itemStackSize) )); break; } case PacketTypes.LiquidSet: { if (this.LiquidSet == null) { break; } int x = BitConverter.ToInt16(e.Msg.readBuffer, e.Index); int y = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 2); if (!TerrariaUtils.Tiles.IsValidCoord(x, y)) { break; } int liquidAmount = e.Msg.readBuffer[e.Index + 4]; LiquidKind liquidKind = (LiquidKind)e.Msg.readBuffer[e.Index + 5]; e.Handled = this.OnLiquidSet(new LiquidSetEventArgs(player, new DPoint(x, y), liquidAmount, liquidKind)); break; } case PacketTypes.DoorUse: { if (this.DoorUse == null) { break; } byte action = e.Msg.readBuffer[e.Index]; int x = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 1); int y = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 3); if (!TerrariaUtils.Tiles.IsValidCoord(x, y)) { break; } int direction = e.Msg.readBuffer[e.Index + 5]; Direction actualDirection = Direction.Right; if (direction == 0) { actualDirection = Direction.Left; } e.Handled = this.OnDoorUse(new DoorUseEventArgs(player, new DPoint(x, y), (DoorAction)action, actualDirection)); break; } case PacketTypes.PlayerSpawn: { if (this.PlayerSpawn == null) { break; } int playerIndex = e.Msg.readBuffer[e.Index]; int spawnX = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 1); int spawnY = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 3); if (!TerrariaUtils.Tiles.IsValidCoord(spawnX, spawnY)) { break; } e.Handled = this.OnPlayerSpawn(new PlayerSpawnEventArgs(player, new DPoint(spawnX, spawnY))); break; } // Note: Also door unlock case PacketTypes.ChestUnlock: { if (this.ChestUnlock == null) { break; } UnlockType unlockType = (UnlockType)e.Msg.readBuffer[e.Index]; int chestX = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 1); int chestY = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 3); if (!TerrariaUtils.Tiles.IsValidCoord(chestX, chestY)) { break; } e.Handled = this.OnChestUnlock(new UnlockEventArgs(player, new DPoint(chestX, chestY), unlockType)); break; } case PacketTypes.ChatText: { if (this.ChatText == null) { break; } short playerIndex = e.Msg.readBuffer[e.Index]; if (playerIndex != e.Msg.whoAmI) { break; } int colorR = e.Msg.readBuffer[e.Index + 1]; int colorG = e.Msg.readBuffer[e.Index + 2]; int colorB = e.Msg.readBuffer[e.Index + 3]; string text = Encoding.UTF8.GetString(e.Msg.readBuffer, e.Index + 4, e.Length - 5); e.Handled = this.OnChatText(new ChatTextEventArgs(player, new Color(colorR, colorG, colorB), text)); break; } case PacketTypes.TileSendSquare: { if (this.SendTileSquare == null) { break; } int size = BitConverter.ToInt16(e.Msg.readBuffer, e.Index); int tileX = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 2); int tileY = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 4); if (!TerrariaUtils.Tiles.IsValidCoord(tileX, tileY)) { break; } e.Handled = this.OnSendTileSquare(new SendTileSquareEventArgs(player, new DPoint(tileX, tileY), size)); break; } case PacketTypes.PaintTile: { if (this.TilePaint == null) { break; } int tileX = BitConverter.ToInt16(e.Msg.readBuffer, e.Index); int tileY = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 2); if (!TerrariaUtils.Tiles.IsValidCoord(tileX, tileY)) { break; } int color = e.Msg.readBuffer[e.Index + 8]; e.Handled = this.OnTilePaint(new TilePaintEventArgs(player, new DPoint(tileX, tileY), (PaintColor)color)); break; } case PacketTypes.PlayerKillMe: { if (this.PlayerDeath == null) { break; } int playerIndex = e.Msg.readBuffer[e.Index]; int direction = e.Msg.readBuffer[e.Index + 1]; int dmg = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 2); bool pvp = e.Msg.readBuffer[e.Index + 4] != 0; string deathText = Encoding.UTF8.GetString(e.Msg.readBuffer, e.Index + 6, e.Length - 7); e.Handled = this.OnPlayerDeath(new PlayerDeathEventArgs(player, direction, dmg, pvp, deathText)); break; } case PacketTypes.Teleport: { if (this.Teleport == null) { break; } BitsByte flags = e.Msg.readBuffer[e.Index]; int playerIndex = BitConverter.ToInt16(e.Msg.readBuffer, e.Index + 1); float x = BitConverter.ToSingle(e.Msg.readBuffer, e.Index + 3); float y = BitConverter.ToSingle(e.Msg.readBuffer, e.Index + 7); Vector2 destLocation = new Vector2(x, y); TeleportType tpType = TeleportType.PlayerToPos; if (flags[0]) { tpType = TeleportType.NpcToPos; } if (flags[1]) { if (flags[0]) { tpType = TeleportType.Unknown; } else { tpType = TeleportType.PlayerNearPlayerWormhole; } } e.Handled = this.OnTeleport(new TeleportEventArgs(player, destLocation, tpType)); break; } } } catch (Exception ex) { ServerApi.LogWriter.PluginWriteLine( this.Plugin, string.Format("Internal error on handling data packet {0}. Exception details: \n{1}", e.MsgID, ex), TraceLevel.Error ); } }
public void IssueCommand_Unlock(UnlockType unlock) { this.IssueCommand(new ProtocolCommandUnlockType((ProtocolUnlockMode)unlock)); }
public void Unlock(UnlockType type) { Handler.Call("myoUnlock", type.ToString()); }
/// <inheritdoc /> public MyoResult Unlock64(IntPtr myo, UnlockType type, out IntPtr error) { return(unlock_64(myo, type, out error)); }
private static extern MyoResult unlock_64(IntPtr myo, UnlockType type, out IntPtr error);