private void OnHeroSpawn(byte[] packet, Channel channel) { if (!_connected) { _connected = true; } var hero = Serialize <HeroSpawn>(packet); if (hero.Name == _myPlayer && _myNetId == 0) { _gameStarted = true; _gameStartTime = DateTime.Now; Log.Write("Hero:({0}) Player:({1}) Team:({2}) NetId:({3:X})", hero.Hero, hero.Name, _isOrder ? "ORDER" : "CHAOS", hero.NetId); _myNetId = hero.NetId; var purchase = BuyItem.Create(_myNetId, 0x3E9); // boots Send(Deserialize <BuyItem>(purchase)); purchase.ItemId = 0x7D3; // hp pot for (var i = 0; i < 4; ++i) { Send(Deserialize <BuyItem>(purchase)); } purchase.ItemId = 0xD0C; // trinket Send(Deserialize <BuyItem>(purchase)); } }
public static void SendSlotbars(GameSession gameSession) { var player = gameSession.Player; var gameHandler = gameSession.Client; var counterValue = 0; var categories = new List <SlotbarCategoryModule>(); var slotbarItemsTest = new List <SlotbarQuickslotItem> { new SlotbarQuickslotItem(1, "ammunition_laser_ucb-100"), new SlotbarQuickslotItem(2, "ammunition_laser_rsb-75"), new SlotbarQuickslotItem(3, "ammunition_laser_mcb-50"), new SlotbarQuickslotItem(4, "ammunition_laser_ucb-100"), new SlotbarQuickslotItem(5, "ammunition_laser_sab-50"), new SlotbarQuickslotItem(6, "ammunition_mine_smb-01"), new SlotbarQuickslotItem(7, "equipment_extra_cpu_ish-01"), new SlotbarQuickslotItem(8, "ammunition_specialammo_emp-01"), }; var premium = new List <SlotbarQuickslotItem> { new SlotbarQuickslotItem(1, "drone_formation_f-3d-rg"), new SlotbarQuickslotItem(2, "drone_formation_f-10-cr"), new SlotbarQuickslotItem(3, "drone_formation_f-09-mo") }; var slotbars = new List <SlotbarQuickslotModule> { new SlotbarQuickslotModule("standardSlotBar", slotbarItemsTest, "50,85|0,40", "0", true), new SlotbarQuickslotModule("premiumSlotBar", premium, "50,85|0,80", "0", true) }; var items = new List <SlotbarCategoryItemModule>(); //LASERS var maxCounter = 1000; foreach (var itemId in ItemStorage.LaserIds) { var item = new LaserItem( itemId, counterValue, maxCounter ); try { item.CounterValue = player.Hangar.Configurations[player.CurrentConfig].Consumables[itemId].Amount; } catch (Exception) { item.CounterValue = 0; } item.Create(); items.Add(item.Object); player.SlotbarItems[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("lasers", items)); //ROCKETS items = new List <SlotbarCategoryItemModule>(); maxCounter = 200; foreach (var itemId in ItemStorage.RocketIds) { var item = new RocketItem( itemId, counterValue, maxCounter ); item.Create(); items.Add(item.Object); player.SlotbarItems[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("rockets", items)); //ROCKET LAUNCHER items = new List <SlotbarCategoryItemModule>(); maxCounter = 200; foreach (var itemId in ItemStorage.RocketLauncherIds) { var item = new RocketLauncherItem( itemId, counterValue, maxCounter ); item.Create(); items.Add(item.Object); player.SlotbarItems[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("rocket_launchers", items)); //SPECIAL ITEMS items = new List <SlotbarCategoryItemModule>(); maxCounter = 100; foreach (var itemId in ItemStorage.SpecialItemsIds) { var item = new SpecialItem( itemId, counterValue, maxCounter ); try { item.CounterValue = player.Hangar.Configurations[player.CurrentConfig].Consumables[itemId].Amount; } catch (Exception) { item.CounterValue = 0; } item.Create(); items.Add(item.Object); player.SlotbarItems[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("special_items", items)); //MINES items = new List <SlotbarCategoryItemModule>(); maxCounter = 100; foreach (var itemId in ItemStorage.MinesIds) { var item = new MineItem( itemId, counterValue, maxCounter ); item.Create(); items.Add(item.Object); player.SlotbarItems[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("mines", items)); //CPUS items = new List <SlotbarCategoryItemModule>(); maxCounter = 0; foreach (var itemId in ItemStorage.CpusIds) { //TODO } categories.Add(new SlotbarCategoryModule("cpus", items)); //BUY NOW items = new List <SlotbarCategoryItemModule>(); maxCounter = 0; foreach (var itemId in ItemStorage.BuyNowIds) { var item = new BuyItem( itemId, counterValue, maxCounter ); item.Create(); items.Add(item.Object); player.SlotbarItems[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("buy_now", items)); //TECH ITEMS items = new List <SlotbarCategoryItemModule>(); maxCounter = 0; foreach (var itemId in ItemStorage.TechIds) { var item = new TechItem( itemId, counterValue, maxCounter ); item.Create(); items.Add(item.Object); player.SlotbarItems[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("tech_items", items)); //SHIP ABILITIES items = new List <SlotbarCategoryItemModule>(); maxCounter = 0; foreach (var itemId in ItemStorage.ShipAbilitiesIds) { var item = new ShipAbilityItem( itemId, counterValue, maxCounter ); item.Create(); items.Add(item.Object); player.SlotbarItems[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("ship_abilities", items)); //DRONE FORMATION items = new List <SlotbarCategoryItemModule>(); maxCounter = 0; foreach (var itemId in ItemStorage.FormationIds) { var item = new FormationItem( itemId, counterValue, maxCounter ); item.Create(); items.Add(item.Object); player.SlotbarItems[item.ClickedId] = item; } categories.Add(new SlotbarCategoryModule("drone_formations", items)); gameHandler.Send(new SlotbarsCommand(categories, "50,85", slotbars).getBytes()); }