private static NWItem CopyWeaponAppearance(NWPlayer oPC, NWItem oSource, NWItem oDest, bool copyPropsAndVars) { NWPlaceable oTempStorage = (GetObjectByTag("OUTFIT_BARREL")); oSource.SetLocalString("TEMP_OUTFIT_UUID", oPC.GlobalID.ToString()); uint oCopy = CopyItem(oDest.Object, oTempStorage.Object, true); oCopy = CopyItemAndModify(oCopy, ItemAppearanceType.WeaponModel, 0, (int)GetItemAppearance(oSource, ItemAppearanceType.WeaponModel, 0), true); oCopy = CopyItemAndModify(oCopy, ItemAppearanceType.WeaponColor, 0, (int)GetItemAppearance(oSource, ItemAppearanceType.WeaponColor, 0), true); oCopy = CopyItemAndModify(oCopy, ItemAppearanceType.WeaponModel, 1, (int)GetItemAppearance(oSource, ItemAppearanceType.WeaponModel, 1), true); oCopy = CopyItemAndModify(oCopy, ItemAppearanceType.WeaponColor, 1, (int)GetItemAppearance(oSource, ItemAppearanceType.WeaponColor, 1), true); oCopy = CopyItemAndModify(oCopy, ItemAppearanceType.WeaponModel, 2, (int)GetItemAppearance(oSource, ItemAppearanceType.WeaponModel, 2), true); oCopy = CopyItemAndModify(oCopy, ItemAppearanceType.WeaponColor, 2, (int)GetItemAppearance(oSource, ItemAppearanceType.WeaponColor, 2), true); SetName(oCopy, GetName(oSource)); SetDescription(oCopy, GetDescription(oSource)); //LocalVariableService.CopyVariables(oSource, oCopy); NWItem oFinal = (CopyItem(oCopy, oPC.Object, true)); oFinal.DeleteLocalString("TEMP_OUTFIT_UUID"); if (copyPropsAndVars) { // strip all item props from new item foreach (ItemProperty itemProp in oFinal.ItemProperties) { RemoveItemProperty(oFinal, itemProp); } // add all item props from original item to new item foreach (ItemProperty itemProp in oSource.ItemProperties) { AddItemProperty(DurationType.Permanent, itemProp, oFinal); } // finally, copy local vars LocalVariableService.CopyVariables(oSource, oFinal); } DestroyObject(oCopy); oDest.Destroy(); foreach (NWItem item in oTempStorage.InventoryItems) { if (item.GetLocalString("TEMP_OUTFIT_UUID") == oPC.GlobalID.ToString()) { item.Destroy(); } } return(oFinal); }
public bool Run(params object[] args) { int type = _.GetInventoryDisturbType(); if (type != INVENTORY_DISTURB_TYPE_ADDED) { return(true); } NWPlaceable device = Object.OBJECT_SELF; NWPlayer player = _.GetLastDisturbed(); NWItem item = _.GetInventoryDisturbItem(); var componentIP = item.ItemProperties.FirstOrDefault(x => _.GetItemPropertyType(x) == (int)CustomItemPropertyType.ComponentType); // Not a component. Return the item. if (componentIP == null) { ItemService.ReturnItem(player, item); player.FloatingText("You cannot scrap this item."); return(false); } // Item is a component but it was crafted. Cannot scrap crafted items. if (!string.IsNullOrWhiteSpace(item.GetLocalString("CRAFTER_PLAYER_ID"))) { ItemService.ReturnItem(player, item); player.FloatingText("You cannot scrap crafted items."); return(false); } // Remove the item properties foreach (var ip in item.ItemProperties) { var ipType = _.GetItemPropertyType(ip); if (ipType != (int)CustomItemPropertyType.ComponentType) { _.RemoveItemProperty(item, ip); } } // Remove local variables (except the global ID) int varCount = NWNXObject.GetLocalVariableCount(item); for (int index = varCount - 1; index >= 0; index--) { var localVar = NWNXObject.GetLocalVariable(item, index); if (localVar.Key != "GLOBAL_ID") { switch (localVar.Type) { case LocalVariableType.Int: item.DeleteLocalInt(localVar.Key); break; case LocalVariableType.Float: item.DeleteLocalFloat(localVar.Key); break; case LocalVariableType.String: item.DeleteLocalString(localVar.Key); break; case LocalVariableType.Object: item.DeleteLocalObject(localVar.Key); break; case LocalVariableType.Location: item.DeleteLocalLocation(localVar.Key); break; default: throw new ArgumentOutOfRangeException(); } } } if (!item.Name.Contains("(SCRAPPED)")) { item.Name = item.Name + " (SCRAPPED)"; } device.AssignCommand(() => { _.ActionGiveItem(item, player); }); return(true); }
private void HandleLoadOutfit(int responseID) { DialogResponse response = GetResponseByID("LoadOutfitPage", responseID); NWPlayer oPC = GetPC(); if (!CanModifyClothes()) { oPC.FloatingText("You cannot modify your currently equipped clothes."); return; } int outfitID = (int)response.CustomData; PCOutfit entity = GetPlayerOutfits(GetPC()); NWPlaceable oTempStorage = (_.GetObjectByTag("OUTFIT_BARREL")); NWItem oClothes = oPC.Chest; NWItem storedClothes = null; oClothes.SetLocalString("TEMP_OUTFIT_UUID", oPC.GlobalID.ToString()); if (outfitID == 1) { storedClothes = SerializationService.DeserializeItem(entity.Outfit1, oTempStorage); } else if (outfitID == 2) { storedClothes = SerializationService.DeserializeItem(entity.Outfit2, oTempStorage); } else if (outfitID == 3) { storedClothes = SerializationService.DeserializeItem(entity.Outfit3, oTempStorage); } else if (outfitID == 4) { storedClothes = SerializationService.DeserializeItem(entity.Outfit4, oTempStorage); } else if (outfitID == 5) { storedClothes = SerializationService.DeserializeItem(entity.Outfit5, oTempStorage); } else if (outfitID == 6) { storedClothes = SerializationService.DeserializeItem(entity.Outfit6, oTempStorage); } else if (outfitID == 7) { storedClothes = SerializationService.DeserializeItem(entity.Outfit7, oTempStorage); } else if (outfitID == 8) { storedClothes = SerializationService.DeserializeItem(entity.Outfit8, oTempStorage); } else if (outfitID == 9) { storedClothes = SerializationService.DeserializeItem(entity.Outfit9, oTempStorage); } else if (outfitID == 10) { storedClothes = SerializationService.DeserializeItem(entity.Outfit10, oTempStorage); } if (storedClothes == null) { throw new Exception("Unable to locate stored clothes."); } NWGameObject oCopy = _.CopyItem(oClothes.Object, oTempStorage.Object, TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LBICEP, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LBICEP), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LBICEP, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LBICEP), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_BELT, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_BELT), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_BELT, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_BELT), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LFOOT, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LFOOT), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LFOOT, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LFOOT), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LFOREARM, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LFOREARM), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LFOREARM, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LFOREARM), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LHAND, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LHAND), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LHAND, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LHAND), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LSHIN, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LSHIN), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LSHIN, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LSHIN), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LSHOULDER, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LSHOULDER), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LSHOULDER, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LSHOULDER), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LTHIGH, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_LTHIGH), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LTHIGH, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_LTHIGH), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_NECK, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_NECK), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_NECK, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_NECK), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_PELVIS, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_PELVIS), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_PELVIS, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_PELVIS), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RBICEP, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RBICEP), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RBICEP, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RBICEP), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RFOOT, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RFOOT), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RFOOT, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RFOOT), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RFOREARM, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RFOREARM), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RFOREARM, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RFOREARM), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RHAND, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RHAND), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RHAND, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RHAND), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_ROBE, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_ROBE), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_ROBE, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_ROBE), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RSHIN, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RSHIN), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RSHIN, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RSHIN), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RSHOULDER, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RSHOULDER), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RSHOULDER, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RSHOULDER), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RTHIGH, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RTHIGH), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RTHIGH, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_RTHIGH), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_TORSO, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_TORSO), TRUE); oCopy = _.CopyItemAndModify(oCopy, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_TORSO, _.GetItemAppearance(storedClothes.Object, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_MODEL_TORSO), TRUE); NWItem oFinal = (_.CopyItem(oCopy, oPC.Object, TRUE)); oFinal.DeleteLocalString("TEMP_OUTFIT_UUID"); _.DestroyObject(oCopy); oClothes.Destroy(); storedClothes.Destroy(); oPC.AssignCommand(() => _.ActionEquipItem(oFinal.Object, INVENTORY_SLOT_CHEST)); foreach (NWItem item in oTempStorage.InventoryItems) { if (item.GetLocalString("TEMP_OUTFIT_UUID") == oPC.GlobalID.ToString()) { item.Destroy(); } } ShowLoadOutfitOptions(); }
private void HandleLoadWeapon(int responseID) { DialogResponse response = GetResponseByID("LoadWeaponPage", responseID); NWPlayer oPC = GetPC(); if (!CanModifyWeapon()) { oPC.FloatingText("You cannot modify your currently equipped Weapon."); return; } int outfitID = (int)response.CustomData; PCWeapon entity = GetPlayerWeapons(GetPC()); if (entity == null) { return; } NWPlaceable oTempStorage = (GetObjectByTag("OUTFIT_BARREL")); NWItem oClothes = oPC.RightHand; NWItem storedClothes = null; oClothes.SetLocalString("TEMP_OUTFIT_UUID", oPC.GlobalID.ToString()); if (outfitID == 1) { storedClothes = SerializationService.DeserializeItem(entity.Weapon1, oTempStorage); } else if (outfitID == 2) { storedClothes = SerializationService.DeserializeItem(entity.Weapon2, oTempStorage); } else if (outfitID == 3) { storedClothes = SerializationService.DeserializeItem(entity.Weapon3, oTempStorage); } else if (outfitID == 4) { storedClothes = SerializationService.DeserializeItem(entity.Weapon4, oTempStorage); } else if (outfitID == 5) { storedClothes = SerializationService.DeserializeItem(entity.Weapon5, oTempStorage); } else if (outfitID == 6) { storedClothes = SerializationService.DeserializeItem(entity.Weapon6, oTempStorage); } else if (outfitID == 7) { storedClothes = SerializationService.DeserializeItem(entity.Weapon7, oTempStorage); } else if (outfitID == 8) { storedClothes = SerializationService.DeserializeItem(entity.Weapon8, oTempStorage); } else if (outfitID == 9) { storedClothes = SerializationService.DeserializeItem(entity.Weapon9, oTempStorage); } else if (outfitID == 10) { storedClothes = SerializationService.DeserializeItem(entity.Weapon10, oTempStorage); } if (storedClothes == null) { throw new Exception("Unable to locate stored Weapon."); } uint oCopy = CopyItem(oClothes.Object, oTempStorage.Object, true); var baseItemType = GetBaseItemType(oCopy); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.SimpleModel, 0, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.SimpleModel, 0), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.WeaponModel, 0, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.WeaponModel, 0), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.WeaponColor, 0, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.WeaponModel, 0), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.WeaponModel, 1, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.WeaponModel, 1), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.WeaponColor, 1, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.WeaponColor, 1), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.WeaponModel, 2, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.WeaponModel, 2), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.WeaponColor, 2, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.WeaponColor, 2), true); NWItem oFinal = (CopyItem(oCopy, oPC.Object, true)); oFinal.DeleteLocalString("TEMP_OUTFIT_UUID"); DestroyObject(oCopy); oClothes.Destroy(); storedClothes.Destroy(); oPC.AssignCommand(() => ActionEquipItem(oFinal.Object, InventorySlot.RightHand)); foreach (NWItem item in oTempStorage.InventoryItems) { if (item.GetLocalString("TEMP_OUTFIT_UUID") == oPC.GlobalID.ToString()) { item.Destroy(); } } ShowLoadWeaponOptions(); }
private void HandleLoadOutfit(int responseID) { DialogResponse response = GetResponseByID("LoadOutfitPage", responseID); NWPlayer oPC = GetPC(); if (!CanModifyClothes()) { oPC.FloatingText("You cannot modify your currently equipped clothes."); return; } int outfitID = (int)response.CustomData; PCOutfit entity = GetPlayerOutfits(GetPC()); if (entity == null) { return; } NWPlaceable oTempStorage = (GetObjectByTag("OUTFIT_BARREL")); NWItem oClothes = oPC.Chest; NWItem storedClothes = null; oClothes.SetLocalString("TEMP_OUTFIT_UUID", oPC.GlobalID.ToString()); if (outfitID == 1) { storedClothes = SerializationService.DeserializeItem(entity.Outfit1, oTempStorage); } else if (outfitID == 2) { storedClothes = SerializationService.DeserializeItem(entity.Outfit2, oTempStorage); } else if (outfitID == 3) { storedClothes = SerializationService.DeserializeItem(entity.Outfit3, oTempStorage); } else if (outfitID == 4) { storedClothes = SerializationService.DeserializeItem(entity.Outfit4, oTempStorage); } else if (outfitID == 5) { storedClothes = SerializationService.DeserializeItem(entity.Outfit5, oTempStorage); } else if (outfitID == 6) { storedClothes = SerializationService.DeserializeItem(entity.Outfit6, oTempStorage); } else if (outfitID == 7) { storedClothes = SerializationService.DeserializeItem(entity.Outfit7, oTempStorage); } else if (outfitID == 8) { storedClothes = SerializationService.DeserializeItem(entity.Outfit8, oTempStorage); } else if (outfitID == 9) { storedClothes = SerializationService.DeserializeItem(entity.Outfit9, oTempStorage); } else if (outfitID == 10) { storedClothes = SerializationService.DeserializeItem(entity.Outfit10, oTempStorage); } if (storedClothes == null) { throw new Exception("Unable to locate stored clothes."); } uint oCopy = CopyItem(oClothes.Object, oTempStorage.Object, true); oCopy = CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftBicep, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftBicep), true); oCopy = CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftBicep, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftBicep), true); oCopy = CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.Belt, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.Belt), true); oCopy = CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.Belt, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.Belt), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftFoot, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftFoot), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftFoot, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftFoot), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftForearm, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftForearm), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftForearm, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftForearm), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftHand, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftHand), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftHand, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftHand), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftShin, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftShin), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftShin, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftShin), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftShoulder, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftShoulder), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftShoulder, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftShoulder), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftThigh, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.LeftThigh), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftThigh, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.LeftThigh), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.Neck, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.Neck), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.Neck, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.Neck), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.Pelvis, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.Pelvis), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.Pelvis, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.Pelvis), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightBicep, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightBicep), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightBicep, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightBicep), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightFoot, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightFoot), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightFoot, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightFoot), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightForearm, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightForearm), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightForearm, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightForearm), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightHand, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightHand), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightHand, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightHand), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.Robe, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.Robe), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.Robe, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.Robe), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightShin, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightShin), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightShin, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightShin), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightShoulder, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightShoulder), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightShoulder, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightShoulder), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightThigh, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.RightThigh), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightThigh, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.RightThigh), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.Torso, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorModel, (int)AppearanceArmor.Torso), true); oCopy = _.CopyItemAndModify(oCopy, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.Torso, (int)GetItemAppearance(storedClothes.Object, ItemAppearanceType.ArmorColor, (int)AppearanceArmor.Torso), true); NWItem oFinal = (CopyItem(oCopy, oPC.Object, true)); oFinal.DeleteLocalString("TEMP_OUTFIT_UUID"); DestroyObject(oCopy); oClothes.Destroy(); storedClothes.Destroy(); oPC.AssignCommand(() => ActionEquipItem(oFinal.Object, InventorySlot.Chest)); foreach (NWItem item in oTempStorage.InventoryItems) { if (item.GetLocalString("TEMP_OUTFIT_UUID") == oPC.GlobalID.ToString()) { item.Destroy(); } } ShowLoadOutfitOptions(); }