public static PlayerLootModel Map(PlayerLoot player) => new PlayerLootModel { PlayerLootId = player.PlayerLootId, PlayerId = player.PlayerId, LootId = player.LootId, Quantity = player.Quantity, };
void OnPlayerLootEnd(PlayerLoot inventory) { BasePlayer player = inventory.GetComponent <BasePlayer>(); if (boxCreators.ContainsKey(player.userID)) { StoreBoxData(player); boxCreators.Remove(player.userID); } if (inventory.entitySource != null) { var box = inventory.entitySource; if (boxCache.ContainsKey(box)) { if (box is LootContainer) { return; } if (box is StorageContainer) { if ((box as StorageContainer).inventory.itemList.Count == 0) { box.KillMessage(); } } } } }
void OnPlayerLoot(PlayerLoot lootInventory, UnityEngine.Object entry) { BasePlayer looter = lootInventory.GetComponent("BasePlayer") as BasePlayer; if (looters.ContainsKey(looter)) { looters.Remove(looter); } if (entry is BasePlayer) { BasePlayer target = entry as BasePlayer; if (target.IsAlive() && !target.IsSleeping()) { looter.ChatMessage("Finish him before loot!"); looter.SendConsoleCommand("inventory.endloot"); looter.UpdateNetworkGroup(); looter.SendFullSnapshot(); } else if (target.IsSleeping()) { looters.Add(looter, target.userID.ToString()); } } }
private void OnPlayerLootEnd(PlayerLoot inventory) { BasePlayer player = inventory.GetComponent <BasePlayer>(); if (bountyCreator.ContainsKey(player.userID)) { StorageContainer container = inventory.entitySource.GetComponent <StorageContainer>(); if (container != null) { if (container.inventory.itemList.Count == 0) { SendReply(player, msg("no_items_deposited", player.userID)); } else { CreateNewBounty(player, bountyCreator[player.userID], 0, 0, container.inventory); } openContainers.Remove(container); ClearContainer(container.inventory); container.DieInstantly(); } bountyCreator.Remove(player.userID); } }
void OnPlayerLoot(PlayerLoot lootInventory, UnityEngine.Object entry) { if (entry is BasePlayer) { BasePlayer looter = lootInventory.GetComponent("BasePlayer") as BasePlayer; BasePlayer target = entry as BasePlayer; if (target == null || looter == null) { return; } string userID = target.userID.ToString(); if (protData.ContainsKey(userID)) { timer.Once(0.01f, () => { looter.EndLooting(); looter.StartSleeping(); }); timer.Once(0.2f, () => { looter.EndSleeping(); }); looter.ChatMessage(APHelper["LootAlert"]); } } }
void OnLootPlayer(PlayerLoot lootInventory, BasePlayer targetPlayer) { if (hasTag(targetPlayer, "noplayerloot")) { BasePlayer looter = lootInventory.GetComponent("BasePlayer") as BasePlayer; timer.Once(0.01f, () => looter.EndLooting()); } }
private void OnPlayerLootEnd(PlayerLoot inventory) { var player = inventory.GetComponent <BasePlayer>(); CuiHelper.DestroyUi(player, "BoxUIHeader"); CuiHelper.DestroyUi(player, "BoxUIContent"); CuiHelper.DestroyUi(player, "BoxUISort"); }
private void IOnLootEntity(PlayerLoot source, BaseEntity entity) { // Call hook Interface.CallHook("OnLootEntity", source.GetComponent <BasePlayer>(), entity); // Call depreated hook Interface.CallDeprecatedHook("OnPlayerLoot", source, entity); }
private void IOnLootPlayer(PlayerLoot source, BaseEntity target) { // Call hook Interface.CallHook("OnLootPlayer", source.GetComponent <BasePlayer>(), target); // Call depreated hook Interface.CallDeprecatedHook("OnPlayerLoot", source, target); }
private void IOnLootItem(PlayerLoot source, Item item) { // Call hook Interface.CallHook("OnLootItem", source.GetComponent <BasePlayer>(), item); // Call depreated hook Interface.CallDeprecatedHook("OnPlayerLoot", source, item); }
// PlayerLoot.StartLootingEntity() public static void StartLootingEntity(PlayerLoot playerLoot, BasePlayer looter, BaseEntity entity) { // not tested, what is a lootable entity anyway? var ele = new Events.EntityLootEvent(playerLoot, new Player(looter), new Entity(entity)); OnLootingEntity.OnNext(ele); }
public RustPlayerLootedItemEvent( RustPlayer player, PlayerLoot playerLoot, Item item) : base(player) { PlayerLoot = playerLoot; Item = item; }
private void IOnLootPlayer(PlayerLoot source, BasePlayer target) { // Call hook Interface.CallHook("OnLootPlayer", source.GetComponent <BasePlayer>(), target); // Call depreated hook Interface.CallDeprecatedHook("OnPlayerLoot", "OnLootPlayer", new DateTime(2016, 6, 3), source, target); }
// PlayerLoot.StartLootingItem() public static void StartLootingItem(PlayerLoot playerLoot, BasePlayer looter, Item item) { // works, event needed var ile = new Events.ItemLootEvent(playerLoot, new Player(looter), item); OnLootingItem.OnNext(ile); }
// PlayerLoot.StartLootingPlayer() public static void StartLootingPlayer(PlayerLoot playerLoot, BasePlayer looter, BasePlayer looted) { // not tested var ple = new Events.PlayerLootEvent(playerLoot, new Player(looter), new Player(looted)); OnLootingPlayer.OnNext(ple); }
void OnPlayerLootEnd(PlayerLoot loot) { var entity = loot.entitySource as SupplyDrop; if (entity?.inventory?.itemList?.Count == 0 && timers.ContainsKey(loot.entitySource)) { timers[loot.entitySource]?.Destroy(); } }
private void OnPlayerLootEnd(PlayerLoot inventory) { BasePlayer player = inventory.GetComponent <BasePlayer>(); if (player != null) { DestroyUi(player); } }
private void OnPlayerLootEnd(PlayerLoot playerLoot) { var player = (BasePlayer)playerLoot.gameObject.ToBaseEntity(); if (_openBackpacks.ContainsKey(player)) { _openBackpacks[player].OnClose(player); } }
private void Awake() { playerInput = GetComponent <PlayerInput>(); playerMovement = GetComponent <PlayerMovement>(); playerShoot = GetComponent <PlayerShoot>(); playerProjectileController = GetComponent <PlayerProjectileController>(); playerImmunity = GetComponent <PlayerImmunity>(); playerLoot = GetComponent <PlayerLoot>(); animator = GetComponent <Animator>(); }
///////////////////////////////////////// // OnPlayerLoot(PlayerLoot lootInventory, BasePlayer targetPlayer) // Called when a player tries to loot another player ///////////////////////////////////////// void OnPlayerLoot(PlayerLoot lootInventory, object target) { BasePlayer targetPlayer = target as BasePlayer; if (targetPlayer != null) { OnLootPlayer(lootInventory, targetPlayer); return; } OnLootBox(lootInventory.GetComponent("BasePlayer") as BasePlayer, target); }
void OnPlayerLootEnd(PlayerLoot inventory) { var player = inventory.GetComponent <BasePlayer>(); if (player == null) { return; } LiftTracker.HandlePlayerLootEnd(player); UIManager.DestroyPlayerUI(player); }
void OnTriggerEnter2D(Collider2D other) { Coin otherCoin = other.gameObject.GetComponent <Coin>(); if (otherCoin != null) { PlayerLoot lootEvent = new PlayerLoot(otherCoin.gameObject); Events.instance.Raise(lootEvent); otherCoin.isTook(); } }
// TODO: Inventory hook. // Figure out how to check if a player has their main inventory open, so we can do Looters.Add(player.userID) & GUIDestroy(player); private void OnPlayerLootEnd(PlayerLoot inventory) { if (Economics) { BasePlayer player = inventory.GetComponent <BasePlayer>(); if (player != null && Looters.Contains(player.userID)) { Looters.Remove(player.userID); GUICreate(player); } } }
private void OnPlayerLootEnd(PlayerLoot loot) { var player = loot.gameObject.GetComponent <BasePlayer>(); if (player != loot.entitySource) { return; } PrintDebug("OnLootEntityEnd: Closing container"); ContainerController.Find(player)?.Close(); }
// PlayerLoot.StartLootingItem() public static void On_LootingItem(PlayerLoot playerLoot) { BasePlayer looter = playerLoot.GetComponent <BasePlayer>(); var ile = new Events.ItemLootEvent(playerLoot, Server.GetPlayer(looter), playerLoot.itemSource); OnNext("On_LootingItem", ile); if (ile.Cancel) { playerLoot.Clear(); looter.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), ile.cancelReason)); } }
// PlayerLoot.StartLootingPlayer() public static void StartLootingPlayer(PlayerLoot playerLoot) { BasePlayer looter = playerLoot.GetComponent <BasePlayer>(); var ple = new Events.PlayerLootEvent(playerLoot, Server.GetPlayer(looter), Server.GetPlayer(playerLoot.entitySource as BasePlayer)); OnLootingPlayer.OnNext(ple); if (ple.Cancel) { playerLoot.Clear(); looter.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), ple.cancelReason)); } }
void OnPlayerLootEnd(PlayerLoot inventory) { var player = inventory.GetComponent <BasePlayer>(); if (player == null) { return; } if (player.IsAdmin || PermissionService.HasPermission(player.userID, permAccess)) { DestroyUI(player); } }
void OnPlayerLootEnd(PlayerLoot inventory) { var player = inventory.gameObject.ToBaseEntity(); if (player == null) { return; } var box = m_Boxes.Select(p => p.Value).FirstOrDefault(p => p.player1 == player || p.player2 == player); if (box != null) { OnDepositCanceled(box.guid); } }
void OnPlayerLoot(PlayerLoot lootInventory, object lootable) { var looter = lootInventory.GetComponent <BasePlayer>(); if (looter == null) { return; } BaseEntity container = lootable as BaseEntity; if (container == null) { return; } if (container.LookupShortPrefabName() != "box.wooden.large.prefab") { return; } string command = GetActiveCommand(looter); if (command == null) { var currentTradeList = GetActiveList(container); if (currentTradeList == "recycling") { looter.ChatMessage("You found a <color=yellow>Moegic Recycling Box!</color>!"); } else if (currentTradeList != null) { var list = GetList(currentTradeList); looter.ChatMessage("You found a <color=yellow>Moegic Tradebox</color>!" + list.ToString()); } return; } var sb = new StringBuilder(); ClearActiveCommand(looter); sb.Append($"<color=yellow>{command}</color> mode is now <color=red>OFF</color>"); looter.ChatMessage(sb.ToString()); RunCommand(looter, command, container); }
void OnPlayerLootEnd(PlayerLoot inventory) { BasePlayer player; if ((player = inventory.GetComponent <BasePlayer> ()) == null) { return; } if (onlinePlayers.ContainsKey(player) && onlinePlayers [player].View != null) { if (onlinePlayers [player].View == inventory.entitySource) { CloseBank(player, (StorageContainer)inventory.entitySource); } } }
public PlayerLootEvent(PlayerLoot playerLoot, Player looter, Player looted) : base(playerLoot, looter) { Target = looted; }
///////////////////////////////////////// // OnPlayerLoot(PlayerLoot lootInventory, BasePlayer targetPlayer) // Called when a player tries to loot another player ///////////////////////////////////////// void OnPlayerLoot(PlayerLoot lootInventory, object target) { BasePlayer targetPlayer = target as BasePlayer; if (targetPlayer != null) { OnLootPlayer( lootInventory, targetPlayer); return; } OnLootBox( lootInventory.GetComponent("BasePlayer") as BasePlayer, target); }
private void IOnLootEntity(PlayerLoot source, BaseEntity entity) => Interface.Call("OnLootEntity", source.GetComponent<BasePlayer>(), entity);
private void IOnLootItem(PlayerLoot source, Item item) => Interface.Call("OnLootItem", source.GetComponent<BasePlayer>(), item);
void OnLootPlayer(PlayerLoot lootInventory, BasePlayer targetPlayer) { if(hasTag(targetPlayer,"noplayerloot")) { BasePlayer looter = lootInventory.GetComponent("BasePlayer") as BasePlayer; timer.Once(0.01f, () => looter.EndLooting()); } }
public EntityLootEvent(PlayerLoot playerLoot, Player looter, Entity looted) : base(playerLoot, looter) { Target = looted; }
private void IOnLootPlayer(PlayerLoot source, BasePlayer target) => Interface.Call("OnLootPlayer", source.GetComponent<BasePlayer>(), target);
private void IOnLootItem(PlayerLoot source, Item item) { // Call hook Interface.CallHook("OnLootItem", source.GetComponent<BasePlayer>(), item); // Call depreated hook Interface.CallDeprecatedHook("OnPlayerLoot", source, item); }
private void IOnLootPlayer(PlayerLoot source, BaseEntity target) { // Call hook Interface.CallHook("OnLootPlayer", source.GetComponent<BasePlayer>(), target); // Call depreated hook Interface.CallDeprecatedHook("OnPlayerLoot", source, target); }
private void OnPlayerLoot(PlayerLoot inventory, BaseEntity entity) //private void OnPlayerLoot(PlayerLoot inventory, BasePlayer target) //private void OnPlayerLoot(PlayerLoot inventory, Item item) { HookCalled("OnPlayerLoot"); }
private void IOnLootEntity(PlayerLoot source, BaseEntity entity) { // Call hook Interface.CallHook("OnLootEntity", source.GetComponent<BasePlayer>(), entity); // Call depreated hook Interface.CallDeprecatedHook("OnPlayerLoot", source, entity); }
public LootEvent(PlayerLoot playerLoot, Player looter) { Looter = looter; pLoot = playerLoot; }
// PlayerLoot.StartLootingItem() public static void StartLootingItem(PlayerLoot playerLoot) { BasePlayer looter = playerLoot.GetComponent<BasePlayer>(); var ile = new Events.ItemLootEvent(playerLoot, Server.GetPlayer(looter), playerLoot.itemSource); OnLootingItem.OnNext(ile); if (ile.Cancel) { playerLoot.Clear(); looter.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), ile.cancelReason)); } }
public ItemLootEvent(PlayerLoot pl, Player looter, Item looted) : base(pl, looter) { Target = looted; }
/// <summary> /// Called from <c>PlayerLoot.StartLootingItem(BasePlayer)</c> . /// </summary> public static void On_LootingPlayer(PlayerLoot playerLoot) { BasePlayer looter = playerLoot.GetComponent<BasePlayer>(); var ple = new PlayerLootEvent(playerLoot, Server.GetPlayer(looter), Server.GetPlayer(playerLoot.entitySource as BasePlayer)); OnNext("On_LootingPlayer", ple); if (ple.Cancel) { playerLoot.Clear(); looter.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), ple.cancelReason)); } }
//private void OnPlayerLoot(PlayerLoot lootInventory, BasePlayer targetPlayer) //private void OnPlayerLoot(PlayerLoot lootInventory, Item targetItem) private void OnPlayerLoot(PlayerLoot lootInventory, BaseEntity targetEntity) { HookCalled("OnPlayerLoot"); }