void OnNpcConversationResponded(NPCTalking npcTalking, BasePlayer player, ConversationData conversationData, ConversationData.ResponseNode responseNode) { int ScrapAmount = GetScrapAmount(player, responseNode); if (ScrapAmount <= 0) { return; } var ScrapDifference = ItemManager.CreateByName("scrap", ScrapAmount, 0); if (ScrapDifference == null) { return; } player.inventory.GiveItem(ScrapDifference, player.inventory.containerMain); timer.Once((float)0.5, () => { player.inventory.Take(null, ScrapID, ScrapAmount); }); return; }
object OnNpcConversationRespond(NPCTalking npcTalking, BasePlayer player, ConversationData conversationData, ConversationData.ResponseNode responseNode) { switch (responseNode.responseTextLocalized.english) { case "[PAY 750]": if (config.MinicopterPrice < 750) { var ScrapDifference = ItemManager.CreateByName("scrap", 750 - config.MinicopterPrice, 0); if (ScrapDifference == null) { return(null); } player.inventory.GiveItem(ScrapDifference, player.inventory.containerMain); } if (config.MinicopterPrice > 750) { player.inventory.Take(null, ScrapID, config.MinicopterPrice - 750); } return(null); case "[PAY 1250]": if (config.ScrapHeliPrice < 1250) { var ScrapDifference = ItemManager.CreateByName("scrap", 1250 - config.ScrapHeliPrice, 0); if (ScrapDifference == null) { return(null); } player.inventory.GiveItem(ScrapDifference, player.inventory.containerMain); } if (config.ScrapHeliPrice > 1250) { player.inventory.Take(null, ScrapID, config.ScrapHeliPrice - 1250); } return(null); case "[PAY 125 SCRAP]": if (config.RowBoatPrice < 125) { var ScrapDifference = ItemManager.CreateByName("scrap", 125 - config.RowBoatPrice, 0); if (ScrapDifference == null) { return(null); } player.inventory.GiveItem(ScrapDifference, player.inventory.containerMain); } if (config.MinicopterPrice > 125) { player.inventory.Take(null, ScrapID, config.RowBoatPrice - 125); } return(null); case "[PAY 300 SCRAP]": if (config.RHIBPrice < 300) { var ScrapDifference = ItemManager.CreateByName("scrap", 300 - config.RHIBPrice, 0); if (ScrapDifference == null) { return(null); } player.inventory.GiveItem(ScrapDifference, player.inventory.containerMain); } if (config.RHIBPrice > 300) { player.inventory.Take(null, ScrapID, config.RHIBPrice - 300); } return(null); } return(null); }
int GetScrapAmount(BasePlayer player, ConversationData.ResponseNode responseNode) { switch (responseNode.resultingSpeechNode) { case "minicopterbuy": if (config.MinicopterPrice == 750) { return(0); } if (config.PermissionNeeded && !(permission.UserHasPermission(player.UserIDString, "vehiclevendorsettings.all") || permission.UserHasPermission(player.UserIDString, "vehiclevendorsettings.minicopter"))) { return(0); } if (player.inventory.GetAmount(ScrapID) < config.MinicopterPrice) { return(0); } return(750 - config.MinicopterPrice); case "transportbuy": if (config.ScrapHeliPrice == 1250) { return(0); } if (config.PermissionNeeded && !(permission.UserHasPermission(player.UserIDString, "vehiclevendorsettings.all") || permission.UserHasPermission(player.UserIDString, "vehiclevendorsettings.transportscraphelicopter"))) { return(0); } if (player.inventory.GetAmount(ScrapID) < config.ScrapHeliPrice) { return(0); } return(1250 - config.ScrapHeliPrice); case "pay_rowboat": if (config.RowBoatPrice == 125) { return(0); } if (player.inventory.GetAmount(ScrapID) < config.RowBoatPrice) { return(0); } if (config.PermissionNeeded && !(permission.UserHasPermission(player.UserIDString, "vehiclevendorsettings.all") || permission.UserHasPermission(player.UserIDString, "vehiclevendorsettings.rowboat"))) { return(0); } return(125 - config.RowBoatPrice); case "pay_rhib": if (config.RHIBPrice == 300) { return(0); } if (player.inventory.GetAmount(ScrapID) < config.RHIBPrice) { return(0); } if (config.PermissionNeeded && !(permission.UserHasPermission(player.UserIDString, "vehiclevendorsettings.all") || permission.UserHasPermission(player.UserIDString, "vehiclevendorsettings.rhib"))) { return(0); } return(300 - config.RHIBPrice); } return(0); }