public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args) { if (!target.IsPlayer) { user.SendMessage("Only players may be targeted with this command."); return; } NWPlayer player = target.Object; var dbPlayer = DataService.Player.GetByID(player.GlobalID); int leaseRate = int.Parse(args[0]); dbPlayer.LeaseRate = leaseRate; DataService.SubmitDataChange(dbPlayer, DatabaseActionType.Update); user.SendMessage(player.Name + ": Lease rate set to " + dbPlayer.LeaseRate + "%"); if (leaseRate == 0) { player.FloatingText("Your lease rate has returned to normal."); } else if (leaseRate > 0) { player.FloatingText("Your lease rate has increased to " + dbPlayer.LeaseRate + "% of normal."); } else if (leaseRate < 0) { player.FloatingText("Your lease rate has decreased to " + dbPlayer.LeaseRate + "% of normal."); } }
public override void DoAction(NWPlayer player, string pageName, int responseID) { if (player.Gold < 50) { player.FloatingText("You don't have enough credits to retrieve that item."); return; } var response = GetResponseByID("MainPage", responseID); Guid pcImpoundedItemID = (Guid)response.CustomData; var item = DataService.PCImpoundedItem.GetByID(pcImpoundedItemID); if (item.DateRetrieved != null) { player.FloatingText("You have already retrieved that item."); return; } item.DateRetrieved = DateTime.UtcNow; DataService.SubmitDataChange(item, DatabaseActionType.Update); SerializationService.DeserializeItem(item.ItemObject, player); _.TakeGoldFromCreature(50, player, TRUE); LoadMainPage(); }
private void ChangeName() { NWPlayer player = GetPC(); // Player hasn't specified a new name for this item. string newName = player.GetLocalString("RENAMED_ITEM_NEW_NAME"); if (string.IsNullOrWhiteSpace(newName)) { player.FloatingText("Enter a new name into the chat box, select 'Refresh' then select 'Change Name'."); return; } NWItem item = player.GetLocalObject("ITEM_BEING_RENAMED"); // Item isn't in player's inventory. if (_.GetItemPossessor(item) != player.Object) { player.FloatingText("Item must be in your inventory in order to rename it."); return; } // Item's original name isn't being stored. Do that now. if (string.IsNullOrWhiteSpace(item.GetLocalString("RENAMED_ITEM_ORIGINAL_NAME"))) { item.SetLocalString("RENAMED_ITEM_ORIGINAL_NAME", item.Name); } item.Name = newName; player.FloatingText("Item renamed to '" + newName + "'."); EndConversation(); }
public void Main() { NWObject door = NWGameObject.OBJECT_SELF; NWArea area = door.Area; NWPlayer player = GetClickingObject(); if (!player.IsValid) { player = GetLastUsedBy(); } int remainingKeyCards = area.GetLocalInt("KEY_CARDS_REMAINING"); if (remainingKeyCards > 0) { player.FloatingText("You need " + remainingKeyCards + "x key card(s) to access this elevator."); } else { player.FloatingText("You access the elevator with the found key cards."); string destinationWPTag = door.GetLocalString("DESTINATION_WAYPOINT"); string destinationAreaTag = door.GetLocalString("DESTINATION_AREA_TAG"); NWArea destinationArea = area.GetLocalObject(destinationAreaTag); NWLocation destinationLocation = GetLocation(GetNearestObjectByTag(destinationWPTag, GetFirstObjectInArea(destinationArea))); player.AssignCommand(() => { ActionJumpToLocation(destinationLocation); }); } }
public bool Run(params object[] args) { NWPlaceable device = NWPlaceable.Wrap(Object.OBJECT_SELF); NWPlayer oPC = NWPlayer.Wrap(_.GetLastOpenedBy()); var model = _craft.GetPlayerCraftingData(oPC); if (model.Access != CraftingAccessType.None) { NWItem menuItem = NWItem.Wrap(_.CreateItemOnObject("cft_confirm", device.Object)); NWPlaceable storage = NWPlaceable.Wrap(_.GetObjectByTag("craft_temp_store")); var storageItems = storage.InventoryItems; List <NWItem> list = null; if (model.Access == CraftingAccessType.MainComponent) { menuItem.Name = "Confirm Main Components"; list = model.MainComponents; } else if (model.Access == CraftingAccessType.SecondaryComponent) { menuItem.Name = "Confirm Secondary Components"; list = model.SecondaryComponents; } else if (model.Access == CraftingAccessType.TertiaryComponent) { menuItem.Name = "Confirm Tertiary Components"; list = model.TertiaryComponents; } else if (model.Access == CraftingAccessType.Enhancement) { menuItem.Name = "Confirm Enhancement Components"; list = model.EnhancementComponents; } if (list == null) { oPC.FloatingText("Error locating component list. Notify an admin."); return(false); } foreach (var item in list) { NWItem storageItem = storageItems.Single(x => x.GlobalID == item.GlobalID); _.CopyItem(storageItem.Object, device.Object, TRUE); } oPC.FloatingText("Place the components inside the container and then click the item named '" + menuItem.Name + "' to continue."); } device.IsLocked = true; return(true); }
public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args) { if (ServerRestartProcessor.IsDisabled) { user.FloatingText("Server auto-restarts are currently disabled."); } else { DateTime now = DateTime.UtcNow; var delta = ServerRestartProcessor.RestartTime - now; string rebootString = TimeService.GetTimeLongIntervals(delta.Days, delta.Hours, delta.Minutes, delta.Seconds, false); string message = "Server will automatically reboot in " + rebootString; user.FloatingText(message); } }
public void JumpPCToBuildingInterior(NWPlayer player, NWArea area) { NWObject exit = null; NWObject @object = (_.GetFirstObjectInArea(area.Object)); while (@object.IsValid) { if (@object.Tag == "building_exit") { exit = @object; } @object = (_.GetNextObjectInArea(area.Object)); } if (exit == null) { player.FloatingText("ERROR: Couldn't find the building interior's exit. Inform an admin of this issue."); return; } _player.SaveLocation(player); exit.SetLocalLocation("PLAYER_HOME_EXIT_LOCATION", player.Location); exit.SetLocalInt("IS_BUILDING_DOOR", 1); Location location = area.GetLocalLocation("INSTANCE_ENTRANCE"); player.AssignCommand(() => { _.ActionJumpToLocation(location); }); }
public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args) { var lastSubmission = user.GetLocalString("RESTART_SERVER_LAST_SUBMISSION"); var isFirstSubmission = true; // Check for the last submission, if any. if (!string.IsNullOrWhiteSpace(lastSubmission)) { // Found one, parse it. var dateTime = DateTime.Parse(lastSubmission); if (DateTime.UtcNow <= dateTime.AddSeconds(15)) { // Player submitted a second request within 15 seconds of the last one. // This is a confirmation they want to restart. isFirstSubmission = false; } } // Player hasn't submitted or time has elapsed if (isFirstSubmission) { user.SetLocalString("RESTART_SERVER_LAST_SUBMISSION", DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)); user.FloatingText("Please confirm server reset by entering another \"/restartserver <CD Key>\" command within 15 seconds."); } else { foreach (var player in NWModule.Get().Players) { _.BootPC(player, $"A DM has restarted the server. Please reconnect shortly."); } NWNXAdmin.ShutdownServer(); } }
private void DoRotateConstructionSite(float rotation, bool isSet) { NWPlayer oPC = GetPC(); Model model = GetDialogCustomData <Model>(); if (!_structure.PlayerHasPermission(oPC, StructurePermission.CanRotateStructures, model.FlagID)) { oPC.FloatingText("You do not have permission to rotate structures."); BuildMainPage(); ChangePage("MainPage"); return; } int constructionSiteID = _structure.GetConstructionSiteID((NWPlaceable)GetDialogTarget()); Data.Entities.ConstructionSite entity = _structure.GetConstructionSiteByID(constructionSiteID); if (isSet) { entity.LocationOrientation = rotation; } else { entity.LocationOrientation = entity.LocationOrientation + rotation; } _structure.SaveChanges(); GetDialogTarget().Facing = (float)entity.LocationOrientation; }
private void DoEnterBuilding() { NWPlayer oPC = GetPC(); NWPlaceable door = GetDialogTarget().Object; string pcBaseStructureID = door.GetLocalString("PC_BASE_STRUCTURE_ID"); if (string.IsNullOrWhiteSpace(pcBaseStructureID)) { _.FloatingTextStringOnCreature("ERROR: Door doesn't have a structure ID assigned. Notify an admin about this issue.", oPC.Object, _.FALSE); return; } var structureID = new Guid(pcBaseStructureID); bool canEnterBuilding = BasePermissionService.HasStructurePermission(GetPC(), structureID, StructurePermission.CanEnterBuilding); if (!canEnterBuilding) { oPC.FloatingText("You don't have permission to enter that building."); return; } NWArea instance = BaseService.GetAreaInstance(structureID, false); if (instance == null) { instance = BaseService.CreateAreaInstance(oPC, structureID, false); } BaseService.JumpPCToBuildingInterior(oPC, instance); }
public void OnCorpseDisturb(NWPlaceable corpse) { NWPlayer oPC = NWPlayer.Wrap(_.GetLastDisturbed()); if (!oPC.IsPlayer && !oPC.IsDM) { return; } NWItem oItem = NWItem.Wrap(_.GetInventoryDisturbItem()); int disturbType = _.GetInventoryDisturbType(); if (disturbType == INVENTORY_DISTURB_TYPE_ADDED) { _.ActionGiveItem(oItem.Object, oPC.Object); oPC.FloatingText("You cannot put items into corpses."); } else { PCCorpseItem dbItem = _db.PCCorpseItems.SingleOrDefault(x => x.GlobalID == oItem.GlobalID); if (dbItem == null) { return; } _db.PCCorpseItems.Remove(dbItem); _db.SaveChanges(); } }
public bool Run(params object[] args) { NWPlayer player = _.GetLastOpenedBy(); player.FloatingText("Please insert an item you would like to reassemble."); return(true); }
/// <summary> /// Deletes a player's character. Player must submit the command twice within 30 seconds. /// </summary> /// <param name="user"></param> /// <param name="target"></param> /// <param name="targetLocation"></param> /// <param name="args"></param> public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args) { string lastSubmission = user.GetLocalString("DELETE_CHARACTER_LAST_SUBMISSION"); bool isFirstSubmission = true; // Check for the last submission, if any. if (!string.IsNullOrWhiteSpace(lastSubmission)) { // Found one, parse it. DateTime dateTime = DateTime.Parse(lastSubmission); if (DateTime.UtcNow <= dateTime.AddSeconds(30)) { // Player submitted a second request within 30 seconds of the last one. // This is a confirmation they want to delete. isFirstSubmission = false; } } // Player hasn't submitted or time has elapsed if (isFirstSubmission) { user.SetLocalString("DELETE_CHARACTER_LAST_SUBMISSION", DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)); user.FloatingText("Please confirm your deletion by entering another \"/delete <CD Key>\" command within 30 seconds."); } else { Player dbPlayer = DataService.Player.GetByID(user.GlobalID); dbPlayer.IsDeleted = true; DataService.SubmitDataChange(dbPlayer, DatabaseActionType.Update); NWNXAdmin.DeletePlayerCharacter(user, true, "Your character has been deleted."); } }
public void Main() { NWPlayer player = (_.GetLastUsedBy()); NWPlaceable device = (_.OBJECT_SELF); // If a structure ID is defined, we need to make sure the building is set to Workshop mode. string structureID = device.GetLocalString("PC_BASE_STRUCTURE_ID"); if (!string.IsNullOrWhiteSpace(structureID)) { Guid structureGuid = new Guid(structureID); var structure = DataService.PCBaseStructure.GetByID(structureGuid); // Workbenches and crafting devices can only be used inside // buildings set to "Workshop" mode. if (structure.ParentPCBaseStructureID != null) { var buildingStructure = DataService.PCBaseStructure.GetByID((Guid)structure.ParentPCBaseStructureID); var modeType = (StructureModeType)buildingStructure.StructureModeID; if (modeType != StructureModeType.Workshop) { player.FloatingText("Workbenches and crafting devices may only be used when the building is set to 'Workshop' mode."); return; } } } if (player.IsBusy) { player.SendMessage("You are too busy to do that right now."); return; } DialogService.StartConversation(player, device, "CraftingDevice"); }
public bool Run(params object[] args) { NWPlaceable container = Object.OBJECT_SELF; container.IsUseable = false; NWPlayer oPC = (_.GetLastOpenedBy()); int questID = container.GetLocalInt("QUEST_ID"); PCQuestStatus status = DataService.Single <PCQuestStatus>(x => x.PlayerID == oPC.GlobalID && x.QuestID == questID); oPC.FloatingText("Please place the items you would like to turn in for this quest into the container. If you want to cancel this process, move away from the container."); string text = "Required Items: \n\n"; var itemProgress = DataService.Where <PCQuestItemProgress>(x => x.PCQuestStatusID == status.ID); foreach (PCQuestItemProgress item in itemProgress) { ItemVO tempItemModel = QuestService.GetTempItemInformation(item.Resref, item.Remaining); text += tempItemModel.Quantity + "x " + tempItemModel.Name + "\n"; } oPC.SendMessage(text); return(true); }
/// <summary> /// Call this on the NWNX OnChat event (not the OnPlayerChat event provided by base NWN). /// If a player is currently setting a "Seller Note", look for the text and apply it to their /// temporary market data object. /// </summary> private static void OnModuleNWNXChat() { NWPlayer player = NWNXChat.GetSender(); if (!CanHandleChat(player)) { return; } var model = GetPlayerMarketData(player); // Is the player specifying a seller note? if (!model.IsSettingSellerNote) { return; } model.IsSettingSellerNote = false; var message = NWNXChat.GetMessage(); message = message.Truncate(1024); model.SellerNote = message; player.FloatingText("Seller note set! Please click 'Refresh' to see the changes."); NWNXChat.SkipMessage(); }
private static void OnModuleNWNXChat() { NWPlayer pc = NWNXChat.GetSender(); string newName = NWNXChat.GetMessage(); if (!CanHandleChat(pc)) { return; } NWNXChat.SkipMessage(); NWItem renameItem = pc.GetLocalObject("CRAFT_RENAMING_ITEM_OBJECT"); pc.DeleteLocalInt("CRAFT_RENAMING_ITEM"); pc.DeleteLocalObject("CRAFT_RENAMING_ITEM_OBJECT"); if (!renameItem.IsValid) { pc.SendMessage("Cannot find the item you were renaming."); return; } if (newName.Length < 3 || newName.Length > 64) { pc.SendMessage("Item names must be between 3 and 64 characters long."); return; } renameItem.Name = newName; pc.FloatingText("New name set!"); }
public bool Run(params object[] args) { NWPlayer oPC = (_.GetLastOpenedBy()); oPC.FloatingText("Any item placed inside this trash can will be destroyed permanently."); return(true); }
public void Main() { NWPlayer player = _.GetLastOpenedBy(); NWPlaceable container = NWGameObject.OBJECT_SELF; player.FloatingText("Components placed inside this container will have all bonuses stripped and their level will be reduced to zero."); container.IsLocked = true; container.IsUseable = false; }
private void BuildTurnOptions(NWPlayer pc) { // Draw a card. int score = pc == game.player1 ? game.player1Score : game.player2Score; int card = game.DrawCard(); score += card; game.lastCardPlayed = card; pc.FloatingText("You drew a " + card + " putting your score at " + score); if (pc == game.player1) { game.player1Score = score; } else { game.player2Score = score; } // Since we're having a turn, we can't be the one standing... bool bStand = game.player1Standing || game.player2Standing; string header = "Your score is at " + score + ". " + (bStand ? "The other player is standing. " : "") + "What do you want to do?"; SpeakString(pc.Name + " draws a " + card + " from the deck. Their score is now " + score); if (pc.GetLocalInt("PAZAAK_REMINDED") == 0) { pc.SendMessage("(Pazaak Rules Reminder: highest score under 21 wins, ending your turn at 21+ loses you the round. You may play up to one card from your hand each turn. A standing player does not get to play again, but ending your turn means you will have to draw at least one more card.)"); pc.SetLocalInt("PAZAAK_REMINDED", 1); } SetPageHeader("MainPage", header); ClearPageResponses("MainPage"); List <int> sideDeck = pc == game.player1 ? game.player1SideDeck : game.player2SideDeck; // Build options from the side deck. foreach (int sideCard in sideDeck) { if ((sideCard > 100 && sideCard < 107) || sideCard == 203) { // Card can be played either of two ways. AddResponseToPage("MainPage", "Play card from side deck: " + PazaakService.Display(sideCard) + " as positive", true, sideCard); AddResponseToPage("MainPage", "Play card from side deck: " + PazaakService.Display(sideCard) + " as negative", true, sideCard); } else { AddResponseToPage("MainPage", "Play card from side deck: " + PazaakService.Display(sideCard), true, sideCard); } } AddResponseToPage("MainPage", "End Turn", score < 21); AddResponseToPage("MainPage", "Stand"); }
public bool Run(params object[] args) { NWPlayer player = _.GetLastOpenedBy(); NWPlaceable container = Object.OBJECT_SELF; player.FloatingText("Components placed inside this container will have all bonuses stripped and their level will be reduced to zero."); container.IsLocked = true; container.IsUseable = false; return(true); }
private void OpenFuelBay(bool isStronidium) { NWPlayer oPC = GetPC(); NWArea area = oPC.Area; NWPlaceable bay = area.GetLocalObject("FUEL_BAY"); if (bay.IsValid) { NWObject accessor = bay.GetLocalObject("BAY_ACCESSOR"); if (!accessor.IsValid) { bay.Destroy(); } else { oPC.FloatingText("Someone else is already accessing that structure's inventory. Please wait."); return; } } Guid structureID = new Guid(_.GetLocalString(area, "PC_BASE_STRUCTURE_ID")); var structure = DataService.PCBaseStructure.GetByID(structureID); var pcBase = DataService.PCBase.GetByID(structure.PCBaseID); Location location = oPC.Location; bay = _.CreateObject(ObjectType.Placeable, "fuel_bay", location); bay.AssignCommand(() => _.SetFacingPoint(oPC.Position)); area.SetLocalObject("FUEL_BAY", bay.Object); bay.SetLocalString("PC_BASE_STRUCTURE_ID", structureID.ToString()); bay.SetLocalBool("SETUP", true); // Disable OnDisturbed events if (isStronidium) { bay.SetLocalInt("CONTROL_TOWER_FUEL_TYPE", 1); if (pcBase.ReinforcedFuel > 0) { _.CreateItemOnObject("stronidium", bay.Object, pcBase.ReinforcedFuel); } } else { if (pcBase.Fuel > 0) { _.CreateItemOnObject("fuel_cell", bay.Object, pcBase.Fuel); } } bay.SetLocalBool("SETUP", false); // Re-enable OnDisturbed events oPC.AssignCommand(() => _.ActionInteractObject(bay.Object)); }
public override void DoAction(NWPlayer player, string pageName, int responseID) { DialogResponse response = GetResponseByID("MainPage", responseID); int jukeboxSongID = (int)response.CustomData; JukeboxSong song = DataService.JukeboxSong.GetByID(jukeboxSongID); player.FloatingText("Song Selected: " + song.DisplayName); _.MusicBackgroundChangeDay(player.Area, song.AmbientMusicID); _.MusicBackgroundChangeNight(player.Area, song.AmbientMusicID); _.MusicBackgroundPlay(player.Area); }
private void OpenFuelBay(bool isStronidium) { NWPlaceable tower = (NWPlaceable)GetDialogTarget(); NWPlayer oPC = GetPC(); NWPlaceable bay = tower.GetLocalObject("CONTROL_TOWER_FUEL_BAY"); if (bay.IsValid) { NWObject accessor = bay.GetLocalObject("BAY_ACCESSOR"); if (!accessor.IsValid) { bay.Destroy(); } else { oPC.FloatingText("Someone else is already accessing that structure's inventory. Please wait."); return; } } var structureID = new Guid(tower.GetLocalString("PC_BASE_STRUCTURE_ID")); var structure = _data.Single <PCBaseStructure>(x => x.ID == structureID); var pcBase = _data.Get <PCBase>(structure.PCBaseID); Location location = oPC.Location; bay = _.CreateObject(OBJECT_TYPE_PLACEABLE, "fuel_bay", location); bay.AssignCommand(() => _.SetFacingPoint(oPC.Position)); tower.SetLocalObject("CONTROL_TOWER_FUEL_BAY", bay.Object); bay.SetLocalObject("CONTROL_TOWER_PARENT", tower.Object); bay.SetLocalString("PC_BASE_STRUCTURE_ID", structureID.ToString()); if (isStronidium) { if (pcBase.ReinforcedFuel > 0) { _.CreateItemOnObject("stronidium", bay.Object, pcBase.ReinforcedFuel); } bay.SetLocalInt("CONTROL_TOWER_FUEL_TYPE", 1); } else { if (pcBase.Fuel > 0) { _.CreateItemOnObject("fuel_cell", bay.Object, pcBase.Fuel); } } oPC.AssignCommand(() => _.ActionInteractObject(bay.Object)); }
public void Main() { NWPlaceable device = _.OBJECT_SELF; NWPlayer player = _.GetLastOpenedBy(); var model = MarketService.GetPlayerMarketData(player); if (model.IsSellingItem) { player.FloatingText("Please place an item you wish to sell inside of the terminal."); } device.IsLocked = true; }
public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args) { if (!target.IsValid || target.ObjectType != ObjectType.Creature) { user.SendMessage("Only creatures may be targeted with this command."); return; } NWPlayer player = target.Object; _.SetPortraitResRef(player, args[0]); player.FloatingText("Your portrait has been changed."); }
private void HandleAddItem() { NWPlayer player = _.GetLastDisturbed(); NWItem item = _.GetInventoryDisturbItem(); NWPlaceable device = Object.OBJECT_SELF; var model = MarketService.GetPlayerMarketData(player); // Serializing containers can be tricky so for the time being we'll leave them disabled. if (_.GetHasInventory(item) == TRUE) { ItemService.ReturnItem(player, item); player.SendMessage(ColorTokenService.Red("Containers cannot be sold on the market.")); return; } // If selling an item, serialize it and store its information in the player's temporary data. if (model.IsSellingItem) { // Check the item's category. If one cannot be determined, the player cannot put it on the market. int marketCategoryID = MarketService.DetermineMarketCategory(item); if (marketCategoryID <= 0) { ItemService.ReturnItem(player, item); player.FloatingText("This item cannot be placed on the market."); return; } model.ItemID = item.GlobalID; model.ItemName = item.Name; model.ItemRecommendedLevel = item.RecommendedLevel; model.ItemStackSize = item.StackSize; model.ItemTag = item.Tag; model.ItemResref = item.Resref; model.ItemMarketCategoryID = marketCategoryID; model.ItemObject = SerializationService.Serialize(item); model.SellPrice = 0; model.LengthDays = 7; item.Destroy(); device.DestroyAllInventoryItems(); device.IsLocked = false; model.IsReturningFromItemPicking = true; model.IsAccessingInventory = false; DialogService.StartConversation(player, device, "MarketTerminal"); } else { ItemService.ReturnItem(player, item); } }
public PlayerCharacter ApplyHungerPenalties(PlayerCharacter entity, NWPlayer pc) { int penalty = 0; if (entity.CurrentHunger >= 40 && entity.CurrentHunger <= 50) { pc.FloatingText("You are starving! You should eat soon."); } else if (entity.CurrentHunger >= 30 && entity.CurrentHunger < 40) { penalty = 1; pc.FloatingText("You are starving! You are suffering from starvation penalties."); } else if (entity.CurrentHunger >= 20 && entity.CurrentHunger < 30) { penalty = 2; pc.FloatingText("You are starving! You are suffering from starvation penalties."); } else if (entity.CurrentHunger >= 10 && entity.CurrentHunger < 20) { penalty = 3; pc.FloatingText("You are starving! You are suffering from starvation penalties."); } else if (entity.CurrentHunger < 10) { penalty = 4; pc.FloatingText(_color.Red("You are starving! You are about to starve to death!")); } var effects = pc.Effects; foreach (Effect effect in effects) { if (_.GetEffectTag(effect) == "EFFECT_HUNGER_PENALTIES") { _.RemoveEffect(pc.Object, effect); } } if (penalty > 0) { Effect effect = _.EffectAbilityDecrease(ABILITY_STRENGTH, penalty); effect = _.EffectLinkEffects(effect, _.EffectAbilityDecrease(ABILITY_DEXTERITY, penalty)); effect = _.EffectLinkEffects(effect, _.EffectAbilityDecrease(ABILITY_CONSTITUTION, penalty)); effect = _.TagEffect(effect, "EFFECT_HUNGER_PENALTIES"); _.ApplyEffectToObject(DURATION_TYPE_PERMANENT, effect, pc.Object); } if (entity.CurrentHunger <= 0) { _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDeath(), pc.Object); entity.CurrentHunger = 20; pc.FloatingText("You starved to death!"); } return(entity); }
public void Main() { NWPlayer oPC = (_.GetLastUsedBy()); NWPlaceable container = (_.OBJECT_SELF); Guid structureID = new Guid(container.GetLocalString("PC_BASE_STRUCTURE_ID")); if (!BasePermissionService.HasStructurePermission(oPC, structureID, StructurePermission.CanAccessStructureInventory)) { oPC.FloatingText("You do not have permission to access this structure."); return; } DialogService.StartConversation(oPC, container, "StructureStorage"); }
public bool IsPVPAttackAllowed(NWPlayer attacker, NWPlayer target) { // Check for sanctuary if this attack is PC versus PC if (target.IsPlayer && attacker.IsPlayer) { // Either the attacker or target has sanctuary - prevent combat from happening if (PlayerHasPVPSanctuary(attacker)) { attacker.FloatingText(_color.Red("You are under the effects of PVP sanctuary and cannot engage in PVP. To disable this feature permanently refer to the 'Disable PVP Sanctuary' option in your rest menu.")); attacker.DelayAssignCommand(() => attacker.ClearAllActions(), 0.0f); return(false); } else if (PlayerHasPVPSanctuary(target)) { attacker.FloatingText(_color.Red("Your target is under the effects of PVP sanctuary and cannot engage in PVP combat.")); attacker.DelayAssignCommand(() => attacker.ClearAllActions(), 0.0f); return(false); } } return(true); }