public ISprite CreateBowItem(SpriteBatch spriteBatch, Vector2 startingPos, bool kept, bool resetKept) { IItem add = new BowItem(spriteBatch, textures["bow"], startingPos, kept, resetKept); RoomItems.Instance.AddItem(add); return(add); }
static BowItem() { string bowUiLink = new BowItem().UILink(); caloriesBurn = CreateCalorieValue(20, typeof(HuntingSkill), typeof(BowItem), new LocString(bowUiLink)); Damage = CreateDamageValue(1, typeof(HuntingSkill), typeof(BowItem), new LocString(bowUiLink)); }
internal override void Export(string table) { base.Export(table); table = GetType().Name; var vals = new List <object> { Id, HfId.DBExport(), HfId_Slayer.DBExport(), SlayerRace.DBExport(), SlayerCaste.DBExport(HistoricalFigure.Castes), ArtifiactId_SlayerItem.DBExport(), ArtifactId_SlayerShooterItem.DBExport(), Cause.DBExport(Causes), SiteId.DBExport(), SubregionId.DBExport(), FeatureLayerId.DBExport(), ItemID.DBExport(), ArtifactId.DBExport(), ItemType.DBExport(Item.ItemTypes), ItemSubType.DBExport(Item.ItemSubTypes), Mat.DBExport(Item.Materials), BowItem.DBExport(), BowArtifactId.DBExport(), BowItemType.DBExport(Item.ItemTypes), BowItemSubType.DBExport(Item.ItemSubTypes), BowMat.DBExport(Item.Materials) }; Database.ExportWorldItem(table, vals); }
void FillAmmo(PlayerSession player) { if (!player.IsLoaded || !player.Player.isConnected) { return; } NetworkEntityComponentBase netEntity = player.WorldPlayerEntity.GetComponent <NetworkEntityComponentBase>(); if (netEntity == null) { return; } EquippedHandlerBase equippedHandler = netEntity.GetComponent <EquippedHandlerBase>(); if (equippedHandler == null) { return; } EquippedHandlerServer equippedHandlerServer = equippedHandler as EquippedHandlerServer; if (equippedHandlerServer == null) { return; } ItemInstance equippedItem = equippedHandler.GetEquippedItem(); if (equippedItem == null) { return; } GunItem gunItem = equippedItem.Item as GunItem; BowItem bowItem = equippedItem.Item as BowItem; if ((bowItem != null || gunItem != null) && equippedHandlerServer != null) { if (gunItem != null) { AutomaticGunItem aGunItem = gunItem as AutomaticGunItem; GunItemEquippedState gunEquipState = gunItem.EquippedState(equippedHandler); equippedItem.AuxData = Convert.ToByte(gunItem.GetClipSize()); equippedHandlerServer.AuxSync(); } else { PlayerInventory inventory = player.WorldPlayerEntity.GetComponent <PlayerInventory>(); if (!inventory.HasItem(bowItem.GetAmmoType().ItemId, 1)) { GiveItem(player, bowItem.GetAmmoType(), 1); } } } }
public void Init(PlayerModel model) { playerModel = model; for (int i = 1; i <= 45; i++) { items.Add(i, null); } items[1] = new BowItem() { Count = 1 }; items[2] = new BackswordItem() { Count = 1 }; items[3] = new GrenadeItem() { Count = 999 }; items[4] = new PickItem() { Count = 1 }; items[5] = new TorchItem() { Count = 100 }; items[6] = new BlowBlockItem(0, 2) { Count = 10 }; items[7] = new AxeItem() { Count = 1 }; items[8] = new BlowBlockItem(0, (short)TileTypeEnum.Brick) { Count = 100 }; items[9] = new BlowBlockItem(0, (short)TileTypeEnum.Stairs) { Count = 1000 }; items[10] = new BlowBlockItem(0, (short)TileTypeEnum.Iron) { Count = 100 }; items[11] = new BlowBlockItem(0, (short)TileTypeEnum.Meat) { Count = 100 }; items[12] = new BlowBlockItem(0, (short)TileTypeEnum.Med) { Count = 100 }; items[13] = new BlowBlockItem(0, (short)TileTypeEnum.Bone) { Count = 100 }; RootContext.Instance.Player.UpdateBag(this); }
private static void SpawnFromString(IRoom room, SpriteBatch spriteBatch, string spawnType, int offsetX, int offsetY, int gridX, int gridY) { int posX = offsetX + gridX * RoomConstants.TileLength; int posY = offsetY + gridY * RoomConstants.TileLength; Point position = new Point(posX, posY); IBlock blockType; INpc npcType; IItem itemType; IBackground backgroundType; switch (spawnType) { //Blocks case RoomConstants.Block: blockType = new Square(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.BrickTile: blockType = new BrickTile(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.GapTile: blockType = new GapTile(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.Fire: position.X += RoomConstants.TileLength / 2; blockType = new Fire(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.LadderTile: backgroundType = new LadderTile(spriteBatch, position); room.AllObjects.Spawn(backgroundType); break; case RoomConstants.Stairs: blockType = new Stairs(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.FishStatue: blockType = new FishStatues(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.DragonStatue: blockType = new DragonStatues(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.BlueGrass: backgroundType = new TileBlueGrass(spriteBatch, position); room.AllObjects.Spawn(backgroundType); break; case RoomConstants.Water: blockType = new TileWater(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.MovableBlock: blockType = new MovableSquare(spriteBatch, position); ((RoomWithMovableSquare)room).AddMovableSquare((MovableSquare)blockType); room.AllObjects.Spawn(blockType); break; //Npcs case RoomConstants.Aquamentus: position.Y += RoomConstants.TileLength / 2; npcType = new Aquamentus(spriteBatch, position, room.AllObjects); room.AllObjects.Spawn(npcType); break; case RoomConstants.Bat: npcType = new Bat(spriteBatch, position); room.AllObjects.Spawn(npcType); break; case RoomConstants.Goriya: npcType = new Goriya(spriteBatch, position, room.AllObjects); room.AllObjects.Spawn(npcType); break; case RoomConstants.Hand: npcType = new Hand(spriteBatch, position, ((RoomWallMaster)room).GetWallMasterRoomToJumpTo()); room.AllObjects.Spawn(npcType); break; case RoomConstants.Jelly: npcType = new Jelly(spriteBatch, position); room.AllObjects.Spawn(npcType); break; case RoomConstants.OldMan: position.X += RoomConstants.TileLength / 2; npcType = new OldMan(spriteBatch, position); room.AllObjects.Spawn(npcType); break; case RoomConstants.Skeleton: npcType = new Skeleton(spriteBatch, position); room.AllObjects.Spawn(npcType); break; case RoomConstants.SpikeTrap: npcType = new SpikeTrap(spriteBatch, position, room.AllObjects.GetPlayer(0)); room.AllObjects.Spawn(npcType); break; //Items case RoomConstants.Compass: itemType = new CompassItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; case RoomConstants.Heart: position.X += (int)(4 * RoomConstants.SpriteMultiplier); position.Y += (int)(4 * RoomConstants.SpriteMultiplier); itemType = new HeartItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; case RoomConstants.Key: itemType = new KeyItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; case RoomConstants.Map: itemType = new MapItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; case RoomConstants.Triforce: position.X += (int)(12 * RoomConstants.SpriteMultiplier); position.Y += (int)(2 * RoomConstants.SpriteMultiplier); itemType = new TriforceItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; case RoomConstants.HeartContainer: itemType = new HeartContainerItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; case RoomConstants.Bow: itemType = new BowItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; default: break; } }
void addItem(String line) { String[] split = line.Split(','); IObject item; float x = ((Int32.Parse(split[1]) - 1) * blockBaseDimension * blockSizeMod) + screenX + (2 * blockBaseDimension * blockSizeMod); float y = ((Int32.Parse(split[2]) - 1) * blockBaseDimension * blockSizeMod) + screenY + (2 * blockBaseDimension * blockSizeMod); switch (split[0]) { case "bomb": item = new BombItem(sprites["itemset"], new Vector2(x, y)); break; case "boomerang": item = new BoomerangItem(sprites["itemset"], new Vector2(x, y)); break; case "bow": item = new BowItem(sprites["itemset"], new Vector2(x, y)); break; case "clock": item = new ClockItem(sprites["itemset"], new Vector2(x, y)); break; case "compass": item = new CompassItem(sprites["itemset"], new Vector2(x, y)); break; case "fairy": item = new FairyItem(sprites["itemset"], new Vector2(x, y)); break; case "heart": item = new HeartItem(sprites["itemset"], new Vector2(x, y)); break; case "key": item = new KeyItem(sprites["itemset"], new Vector2(x, y)); break; case "map": item = new MapItem(sprites["itemset"], new Vector2(x, y)); break; case "permanentheart": item = new PermanentHeartItem(sprites["itemset"], new Vector2(x, y)); break; case "rupee": item = new RupeeItem(sprites["itemset"], new Vector2(x, y)); break; case "triforce": item = new TriforceItem(sprites["itemset"], new Vector2(x + 24, y + 8)); break; default: item = null; break; } Items.Add(item); }
public void BuildBlocks(string input) { if (Room.Id == 13) { buildblocks13(input); return; } switch (input) { //BLOCKS case "TILE": IBlock tile = new FloorBlock(Position); Room.blocks.Add(tile); break; case "BLOK": IBlock blok = new RegularBlock(Position); Room.blocks.Add(blok); break; case "RFSH": IBlock rfsh = new Face1Block(Position); Room.blocks.Add(rfsh); break; case "LFSH": IBlock lfsh = new Face2Block(Position); Room.blocks.Add(lfsh); break; case "SPOT": IBlock spot = new SpottedBlock(Position); Room.blocks.Add(spot); break; case "BLCK": IBlock blck = new BlackBlock(Position); Room.blocks.Add(blck); break; case "BRIK": IBlock brik = new BrickBlock(Position); Room.blocks.Add(brik); break; case "DARK": IBlock dark = new DarkBlueBlock(Position); Room.blocks.Add(dark); break; case "STAR": IBlock star = new StairsBlock(Position); Room.blocks.Add(star); break; case "STIP": IBlock stip = new StripeBlock(Position); Room.blocks.Add(stip); break; case "MVBK": IBlock mvbk = new MovingVertBlock(Position); Room.blocks.Add(mvbk); break; case "MLBK": IBlock mlbk = new MovingLeftBlock(Position); Room.blocks.Add(mlbk); break; //ENEMIES case "BBAT": IEntity bat = new BlueBatEnemy(Position); Room.enemies.Add(enemyID, bat); enemyID++; break; case "SKLN": IEntity skel = new SkeletonEnemy(Position); Room.enemies.Add(enemyID, skel); enemyID++; break; case "BOSS": IAttack up = new FireAttack(1); IAttack center = new FireAttack(0); IAttack down = new FireAttack(2); Room.enemies.Add(enemyID, up); enemyID++; Room.enemies.Add(enemyID, down); enemyID++; Room.enemies.Add(enemyID, center); enemyID++; Room.enemies.Add(enemyID, new FinalBossEnemy(Position, up, center, down)); enemyID++; break; case "FIRE": IEntity fire = new FireEnemy(Position); Room.enemies.Add(enemyID, fire); enemyID++; break; case "GELY": IEntity gel = new GelEnemy(Position); gel.X = gel.Position.X + FOUR * Global.Var.SCALE; gel.Y = gel.Position.Y + FOUR * Global.Var.SCALE; Room.enemies.Add(enemyID, gel); enemyID++; break; case "GORY": IBoomerang goriyaBoomerang = new BoomerangItem(); IEntity goriya = new GoriyaEnemy(goriyaBoomerang, Position); Room.enemyProj.Add(goriyaBoomerang); Room.enemies.Add(enemyID, goriya); enemyID++; break; case "HAND": IEntity hand = new HandEnemy(Position); Room.enemies.Add(enemyID, hand); enemyID++; break; case "OLDM": IEntity man = new OldManNPC(Position); man.X = man.Position.X + EIGHT * Global.Var.SCALE; Room.enemies.Add(enemyID, man); enemyID++; break; case "MNFR": IEntity fire1 = new FireEnemy(Position); IEntity fire2 = new FireEnemy(Position); Room.enemies.Add(enemyID, fire1); enemyID++; Room.enemies.Add(enemyID, fire2); enemyID++; IEntity manAndFire = new OldMan_FireEnemy(Position, fire1, fire2); manAndFire.X = manAndFire.Position.X + EIGHT * Global.Var.SCALE; Room.enemies.Add(enemyID, manAndFire); enemyID++; break; case "SPKE": IEntity spike = new SpikeEnemy(Position, spikeNum); Room.enemies.Add(enemyID, spike); enemyID++; spikeNum++; if (spikeNum > 4) { spikeNum = 1; } break; //ITEMS // Probably could use a static bomb and boomerang object now that I think of it. case "KEYI": IItem key = new KeyItem(Position); key.X = key.Position.X + FOUR * Global.Var.SCALE; Room.items.Add(key); break; case "BOWI": IItem bow = new BowItem(Position); Room.items.Add(bow); break; case "CLCK": IItem clock = new ClockItem(Position); Room.items.Add(clock); break; case "CMPS": IItem compass = new CompassItem(Position); compass.X = compass.Position.X + TWO * Global.Var.SCALE; compass.Y = compass.Position.Y + TWO * Global.Var.SCALE; Room.items.Add(compass); break; case "FARY": IItem fairy = new FairyItem(Position); Room.items.Add(fairy); break; case "HCON": IItem hcont = new HeartContainerItem(Position); hcont.X = hcont.Position.X + ONE * Global.Var.SCALE; hcont.Y = hcont.Position.Y + ONE * Global.Var.SCALE; Room.items.Add(hcont); break; case "HART": IItem heart = new HeartItem(Position); Room.items.Add(heart); break; case "MAPI": IItem map = new MapItem(Position); map.X = map.Position.X + FOUR * Global.Var.SCALE; Room.items.Add(map); break; case "RUPE": IItem rupee = new RupeeItem(Position); Room.items.Add(rupee); break; case "BOMB": IItem bomb = new BombStaticItem(Position); Room.items.Add(bomb); break; case "BMRG": IItem boom = new BoomerangStaticItem(Position); boom.X = boom.Position.X + BMRG_X_OFFSET * Global.Var.SCALE; boom.Y = boom.Position.Y + BMRG_Y_OFFSET * Global.Var.SCALE; Room.items.Add(boom); break; case "BRUP": IItem brup = new BlueRupeeItem(Position); Room.items.Add(brup); break; case "TRIF": IItem triforce = new TriforceItem(Position); triforce.X = triforce.Position.X + ELEVEN * Global.Var.SCALE; triforce.Y = triforce.Position.Y + ELEVEN * Global.Var.SCALE; Room.items.Add(triforce); break; } }
//////////////////////////////////////// /// Ammo Related //////////////////////////////////////// /*void OnWeaponFired(IItem item, EquippedHandlerBase handler) * { * }*/ void LoadAmmo(PlayerSession player) { if (!player.IsLoaded) { return; } NetworkEntityComponentBase netEntity = player.WorldPlayerEntity.GetComponent <NetworkEntityComponentBase>(); if (netEntity == null) { return; } EquippedHandlerBase equippedHandler = netEntity.GetComponent <EquippedHandlerBase>(); if (equippedHandler == null) { return; } EquippedHandlerServer equippedHandlerServer = equippedHandler as EquippedHandlerServer; if (equippedHandlerServer == null) { return; } ItemInstance equippedItem = equippedHandler.GetEquippedItem(); if (equippedItem == null) { return; } GunItem gunItem = equippedItem.Item as GunItem; BowItem bowItem = equippedItem.Item as BowItem; //PrintWarning($"Item: {equippedItem.Item.GetNameKey().Split('/').Last()}"); //PrintWarning($"Is Gun: {!(gunItem == null)}"); if ((bowItem != null || gunItem != null) && equippedHandlerServer != null) { if (gunItem != null) { AutomaticGunItem aGunItem = gunItem as AutomaticGunItem; GunItemEquippedState gunEquipState = gunItem.EquippedState(equippedHandler); //PrintWarning($"Is Automatic: {!(aGunItem == null)}"); //PrintWarning($"Clip Size: {gunItem.GetClipSize().ToString()}"); //PrintWarning($"Ammo Count: {equippedItem.AuxData.ToString()}"); //if (equippedItem.AuxData <= 1) //{ equippedItem.AuxData = Convert.ToByte(gunItem.GetClipSize()); equippedHandlerServer.AuxSync(); //} } else { PlayerInventory inventory = player.WorldPlayerEntity.GetComponent <PlayerInventory>(); //PrintWarning($"Has Ammo: {inventory.HasItem(bowItem.GetAmmoType().ItemId, 1)}"); if (!inventory.HasItem(bowItem.GetAmmoType().ItemId, 1)) { GiveItem(player, bowItem.GetAmmoType(), 1); } } } }
public BowItem(BowItem other) : base(other) { }
public void SetWepoanById(int id) { IItem item = null; switch (id) { case 0: break; case 1: item = new BackswordItem() { Count = 9999 }; break; //земля case 102: item = new BlowBlockItem(0, 2) { Count = 9999 }; break; //трава case 105: item = new BlowBlockItem(0, 5) { Count = 9999 }; break; //угаль case 101: item = new BlowBlockItem(0, 1) { Count = 9999 }; break; case 3: item = new BowItem() { Count = 9999 }; break; case 4: item = new GrenadeItem() { Count = 9999 }; break; case 5: item = new PickItem() { Count = 9999 }; break; case 6: item = new TorchItem() { Count = 9999 }; break; } if (item != null) { item.Use(this); } else { CurrentWeapon = null; ClearSlot(weaponSlo1); } }