private void GenerateWeapon(DropManager dropManager, int lootLevel, Workshop lootWorkshop, Difficulty d, ConcurrentDictionary <string, ServerInventoryItem> newObjects, float remapWeight) { ObjectColor color = resource.ColorRes.GenColor(ColoredObjectType.Weapon).color; WeaponDropper.WeaponDropParams weaponParams = new WeaponDropper.WeaponDropParams(resource, lootLevel, lootWorkshop, WeaponDamageType.damage, Difficulty.none); var weaponDropper = dropManager.GetWeaponDropper(weaponParams, remapWeight); IInventoryObject weaponObject = weaponDropper.Drop() as IInventoryObject; newObjects.TryAdd(weaponObject.Id, new ServerInventoryItem(weaponObject, 1)); //log.InfoFormat("weapon of level = {0} generated", weaponObject.Level); }
private ServerInventoryItem GiveWeaponReward(MmoActor player, ContractWeaponDataReward weaponReward) { var playerCharacter = player.GetComponent <CharacterObject>(); WeaponDropper.WeaponDropParams dropParams = new WeaponDropper.WeaponDropParams( player.resource, playerCharacter.level, (Workshop)playerCharacter.workshop, WeaponDamageType.damage, Difficulty.none ); ColorInfo colorInfo = player.resource.ColorRes.Color(ColoredObjectType.Weapon, weaponReward.color); DropManager dropManager = DropManager.Get(player.resource); WeaponDropper weaponDropper = dropManager.GetWeaponDropper(dropParams); WeaponObject weapon = weaponDropper.DropWeapon(colorInfo); return(new ServerInventoryItem(weapon, 1)); }
public override ServerInventoryItem Roll(IRes resource, int level, Workshop workshop) { DropManager dropManager = DropManager.Get(resource); var cl = resource.colorLists.GetList(colorList); ObjectColor color = cl.Roll(); WeaponDropper.WeaponDropParams dropParams = new WeaponDropper.WeaponDropParams( resource, level, workshop, WeaponDamageType.damage, Difficulty.none ); ColorInfo colorInfo = resource.ColorRes.Color(ColoredObjectType.Weapon, color); WeaponDropper weaponDropper = dropManager.GetWeaponDropper(dropParams); WeaponObject weapon = weaponDropper.DropWeapon(colorInfo); return(new ServerInventoryItem(weapon, 1)); }
private void GenerateNewWeapon(DropManager dropManager) { var character = GetComponent <CharacterObject>(); Workshop workshop = (Workshop)character.workshop; if (nebulaObject.tags.ContainsKey((byte)PlayerTags.Workshop)) { workshop = (Workshop)(byte)(int)nebulaObject.Tag((byte)PlayerTags.Workshop); log.InfoFormat("Found workshop tag = {0} yellow", workshop); } WeaponDropper.WeaponDropParams dropParams = new WeaponDropper.WeaponDropParams( nebulaObject.world.Resource(), character.level, workshop, WeaponDamageType.damage, Difficulty.none); var dropper = dropManager.GetWeaponDropper(dropParams); weaponObject = dropper.Drop() as WeaponObject; }
private void RewardItemImpl(InventoryItemQuestReward reward) { ServerInventoryItem targetItem = null; switch (reward.ObjectType) { case InventoryObjectType.Material: { MaterialItemQuestReward materialReward = reward as MaterialItemQuestReward; if (materialReward != null) { MaterialObject material = new MaterialObject(materialReward.OreId); targetItem = new ServerInventoryItem(material, materialReward.Count); } } break; case InventoryObjectType.Scheme: { SchemeItemQuestReward schemeReward = reward as SchemeItemQuestReward; if (schemeReward != null) { SchemeObject scheme = new SchemeObject(new SchemeObject.SchemeInitData( id: Guid.NewGuid().ToString(), name: string.Empty, level: PlayerLevel, workshop: PlayerWorkshop, templateModuleId: resource.ModuleTemplates.Module(PlayerWorkshop, schemeReward.Slot).Id, color: schemeReward.Color, craftingMaterials: new Dictionary <string, int>(), inSetID: string.Empty )); targetItem = new ServerInventoryItem(scheme, schemeReward.Count); } } break; case InventoryObjectType.Weapon: { WeaponItemQuestReward weaponReward = reward as WeaponItemQuestReward; if (weaponReward != null) { WeaponDropper.WeaponDropParams weaponDropParams = new WeaponDropper.WeaponDropParams( resource: resource, level: PlayerLevel, workshop: PlayerWorkshop, damageType: WeaponDamageType.damage, difficulty: Difficulty.none ); ColorInfo colorInfo = resource.ColorRes.Color(ColoredObjectType.Weapon, weaponReward.Color); DropManager dropManager = DropManager.Get(resource); WeaponDropper weaponDropper = dropManager.GetWeaponDropper(dropParams: weaponDropParams); WeaponObject weapon = weaponDropper.DropWeapon(colorInfo); targetItem = new ServerInventoryItem(weapon, weaponReward.Count); } } break; } if (targetItem != null) { GetComponent <MmoActor>()?.AddToStationInventory(item: targetItem, sendUpdateEvent: true); } }