private void ShowLoadWeaponOptions() { PCWeapon entity = GetPlayerWeapons(GetPC()) ?? new PCWeapon(); ClearPageResponses("LoadWeaponPage"); if (entity.Weapon1 != null) { AddResponseToPage("LoadWeaponPage", "Load from Slot 1", true, 1); } if (entity.Weapon2 != null) { AddResponseToPage("LoadWeaponPage", "Load from Slot 2", true, 2); } if (entity.Weapon3 != null) { AddResponseToPage("LoadWeaponPage", "Load from Slot 3", true, 3); } if (entity.Weapon4 != null) { AddResponseToPage("LoadWeaponPage", "Load from Slot 4", true, 4); } if (entity.Weapon5 != null) { AddResponseToPage("LoadWeaponPage", "Load from Slot 5", true, 5); } if (entity.Weapon6 != null) { AddResponseToPage("LoadWeaponPage", "Load from Slot 6", true, 6); } if (entity.Weapon7 != null) { AddResponseToPage("LoadWeaponPage", "Load from Slot 7", true, 7); } if (entity.Weapon8 != null) { AddResponseToPage("LoadWeaponPage", "Load from Slot 8", true, 8); } if (entity.Weapon9 != null) { AddResponseToPage("LoadWeaponPage", "Load from Slot 9", true, 9); } if (entity.Weapon10 != null) { AddResponseToPage("LoadWeaponPage", "Load from Slot 10", true, 10); } }
private void ShowSaveWeaponOptions() { PCWeapon entity = GetPlayerWeapons(GetPC()) ?? new PCWeapon(); ClearPageResponses("SaveWeaponPage"); string responseText = entity.Weapon1 == null?ColorTokenService.Red("Save in Slot 1") : ColorTokenService.Green("Save in Slot 1"); AddResponseToPage("SaveWeaponPage", responseText); responseText = entity.Weapon2 == null?ColorTokenService.Red("Save in Slot 2") : ColorTokenService.Green("Save in Slot 2"); AddResponseToPage("SaveWeaponPage", responseText); responseText = entity.Weapon3 == null?ColorTokenService.Red("Save in Slot 3") : ColorTokenService.Green("Save in Slot 3"); AddResponseToPage("SaveWeaponPage", responseText); responseText = entity.Weapon4 == null?ColorTokenService.Red("Save in Slot 4") : ColorTokenService.Green("Save in Slot 4"); AddResponseToPage("SaveWeaponPage", responseText); responseText = entity.Weapon5 == null?ColorTokenService.Red("Save in Slot 5") : ColorTokenService.Green("Save in Slot 5"); AddResponseToPage("SaveWeaponPage", responseText); responseText = entity.Weapon6 == null?ColorTokenService.Red("Save in Slot 6") : ColorTokenService.Green("Save in Slot 6"); AddResponseToPage("SaveWeaponPage", responseText); responseText = entity.Weapon7 == null?ColorTokenService.Red("Save in Slot 7") : ColorTokenService.Green("Save in Slot 7"); AddResponseToPage("SaveWeaponPage", responseText); responseText = entity.Weapon8 == null?ColorTokenService.Red("Save in Slot 8") : ColorTokenService.Green("Save in Slot 8"); AddResponseToPage("SaveWeaponPage", responseText); responseText = entity.Weapon9 == null?ColorTokenService.Red("Save in Slot 9") : ColorTokenService.Green("Save in Slot 9"); AddResponseToPage("SaveWeaponPage", responseText); responseText = entity.Weapon10 == null?ColorTokenService.Red("Save in Slot 10") : ColorTokenService.Green("Save in Slot 10"); AddResponseToPage("SaveWeaponPage", responseText); }
void Start() { WeaponCollider = GetComponent <CapsuleCollider>(); Instance = this; }
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 HandleSaveWeapon(int responseID) { NWPlayer oPC = GetPC(); NWItem oClothes = (GetItemInSlot(InventorySlot.RightHand, oPC.Object)); if (!CanModifyWeapon()) { oPC.FloatingText("You cannot save your currently equipped Weapon."); return; } PCWeapon entity = GetPlayerWeapons(oPC); var action = DatabaseActionType.Update; if (entity == null) { entity = new PCWeapon { PlayerID = oPC.GlobalID }; action = DatabaseActionType.Insert; } if (!oClothes.IsValid) { oPC.FloatingText(ColorTokenService.Red("You do not have a Weapon equipped")); return; } string clothesData = SerializationService.Serialize(oClothes); if (responseID == 1) { entity.Weapon1 = clothesData; } else if (responseID == 2) { entity.Weapon2 = clothesData; } else if (responseID == 3) { entity.Weapon3 = clothesData; } else if (responseID == 4) { entity.Weapon4 = clothesData; } else if (responseID == 5) { entity.Weapon5 = clothesData; } else if (responseID == 6) { entity.Weapon6 = clothesData; } else if (responseID == 7) { entity.Weapon7 = clothesData; } else if (responseID == 8) { entity.Weapon8 = clothesData; } else if (responseID == 9) { entity.Weapon9 = clothesData; } else if (responseID == 10) { entity.Weapon10 = clothesData; } DataService.SubmitDataChange(entity, action); ShowSaveWeaponOptions(); }