diff --git a/Modules/BindingsModule/BindingsCommon.as b/Modules/BindingsModule/BindingsCommon.as index 85a69a28..91fde3c7 100644 --- a/Modules/BindingsModule/BindingsCommon.as +++ b/Modules/BindingsModule/BindingsCommon.as @@ -16,7 +16,9 @@ string[] page_texts = Names::knightnmb, Names::archernmb, Names::buildernmb, - Names::quartersnmb + Names::quartersnmb, + Names::vehiclenmb, + Names::boatnmb }; string[][] button_texts = @@ -104,6 +106,18 @@ string[][] button_texts = Names::burgernmb, Names::pearnmb, Names::sleepnmb + }, + { // VEHICLE SHOP + Names::catapultnmb, + Names::ballistanmb, + Names::outpostnmb, + Names::boltsnmb, + Names::shellsnmb + }, + { // BOAT SHOP + Names::dinghynmb, + Names::longboatnmb, + Names::warboatnmb } }; @@ -194,6 +208,18 @@ string[][] button_file_names = "kfc_burger", "kfc_pear", "kfc_sleep" + }, + { + "vehicle_catapult", + "vehicle_ballista", + "vehicle_outpost", + "vehicle_bolts", + "vehicle_shells", + }, + { + "boat_dinghy", + "boat_longboat", + "boat_warboat" } }; @@ -1753,7 +1779,7 @@ class ClickableButtonGUI GUI::SetFont("menu"); Vec2f start_offset = Vec2f(50, 600); - Vec2f start_offset_p = Vec2f(60, 550); + Vec2f start_offset_p = Vec2f(70, 550); closebutton.Render(m_clickable_origin + Vec2f(1000 - 40, 0), Vec2f(40, 40)); @@ -1776,7 +1802,7 @@ class ClickableButtonGUI if (i == 5) { - start_offset_p = Vec2f(205, 600); + start_offset_p = Vec2f(70, 600); } } @@ -1824,7 +1850,7 @@ class ClickableButtonGUI u8 scale = screen_height / 720.0; Vec2f start_offset = Vec2f(50, 600); - Vec2f start_offset_p = Vec2f(60, 550); + Vec2f start_offset_p = Vec2f(70, 550); closebutton.Update(m_clickable_origin + Vec2f(1000 - 40, 0), Vec2f(40, 40)); @@ -1847,7 +1873,7 @@ class ClickableButtonGUI if (i == 5) { - start_offset_p = Vec2f(205, 600); + start_offset_p = Vec2f(70, 600); } } diff --git a/Modules/BindingsModule/BindingsSystem.as b/Modules/BindingsModule/BindingsSystem.as index 2b9c6299..9176e898 100644 --- a/Modules/BindingsModule/BindingsSystem.as +++ b/Modules/BindingsModule/BindingsSystem.as @@ -44,6 +44,7 @@ void onInit(CRules@ this) if (!file.exists("k_drill$2")) file.add_s32("k_drill$2", -1); if (!file.exists("k_satchel$1")) file.add_s32("k_satchel$1", 54); if (!file.exists("k_satchel$2")) file.add_s32("k_satchel$2", -1); + // builder shop if (!file.exists("b_drill$1")) file.add_s32("b_drill$1", 49); if (!file.exists("b_drill$2")) file.add_s32("b_drill$2", -1); @@ -65,6 +66,7 @@ void onInit(CRules@ this) if (!file.exists("b_crate_wood$1")) file.add_s32("b_crate_wood$2", -1); if (!file.exists("b_crate_coins$1")) file.add_s32("b_crate_coins$1", 48); if (!file.exists("b_crate_coins$1")) file.add_s32("b_crate_coins$2", -1); + // archer shop if (!file.exists("a_arrows$1")) file.add_s32("a_arrows$1", 49); if (!file.exists("a_arrows$2")) file.add_s32("a_arrows$2", -1); @@ -76,6 +78,7 @@ void onInit(CRules@ this) if (!file.exists("a_bombarrows$2")) file.add_s32("a_bombarrows$2", -1); if (!file.exists("a_blockarrows$1")) file.add_s32("a_blockarrows$1", 53); if (!file.exists("a_blockarrows$2")) file.add_s32("a_blockarrows$2", -1); + // kfc if (!file.exists("kfc_beer$1")) file.add_s32("kfc_beer$1", 49); if (!file.exists("kfc_beer$2")) file.add_s32("kfc_beer$2", -1); @@ -90,6 +93,26 @@ void onInit(CRules@ this) if (!file.exists("kfc_sleep$1")) file.add_s32("kfc_sleep$1", 54); if (!file.exists("kfc_sleep$2")) file.add_s32("kfc_sleep$2", -1); + // vehicle shop + if (!file.exists("vehicle_catapult$1")) file.add_s32("vehicle_catapult$1", 49); + if (!file.exists("vehicle_catapult$2")) file.add_s32("vehicle_catapult$2", -1); + if (!file.exists("vehicle_ballista$1")) file.add_s32("vehicle_ballista$1", 50); + if (!file.exists("vehicle_ballista$2")) file.add_s32("vehicle_ballista$2", -1); + if (!file.exists("vehicle_outpost$1")) file.add_s32("vehicle_outpost$1", 51); + if (!file.exists("vehicle_outpost$2")) file.add_s32("vehicle_outpost$2", -1); + if (!file.exists("vehicle_bolts$1")) file.add_s32("vehicle_bolts$1", 52); + if (!file.exists("vehicle_bolts$2")) file.add_s32("vehicle_bolts$2", -1); + if (!file.exists("vehicle_shells$1")) file.add_s32("vehicle_shells$1", 53); + if (!file.exists("vehicle_shells$2")) file.add_s32("vehicle_shells$2", -1); + + // boat shop + if (!file.exists("boat_dinghy$1")) file.add_s32("boat_dinghy$1", 49); + if (!file.exists("boat_dinghy$2")) file.add_s32("boat_dinghy$2", -1); + if (!file.exists("boat_longboat$1")) file.add_s32("boat_longboat$1", 50); + if (!file.exists("boat_longboat$2")) file.add_s32("boat_longboat$2", -1); + if (!file.exists("boat_warboat$1")) file.add_s32("boat_warboat$1", 51); + if (!file.exists("boat_warboat$2")) file.add_s32("boat_warboat$2", -1); + if(!file.saveFile(BINDINGSFILE + ".cfg")) { print("Failed to save GRUHSHA_playerbindings.cfg"); diff --git a/Modules/BindingsModule/NoMenuBuying.as b/Modules/BindingsModule/NoMenuBuying.as index b191f763..cddaa37d 100644 --- a/Modules/BindingsModule/NoMenuBuying.as +++ b/Modules/BindingsModule/NoMenuBuying.as @@ -5,16 +5,19 @@ void onTick(CBlob@ this) { // Shops! - bool overlapping_knightshop = false; bool overlapping_archershop = false; bool overlapping_buildershop = false; bool overlapping_kfc = false; + bool overlapping_vehicle = false; + bool overlapping_boat = false; CBlob@ theknightshop; CBlob@ thearchershop; CBlob@ thebuildershop; CBlob@ thekfc; + CBlob@ thevehicle; + CBlob@ theboat; bool dont_show_emotes = false; @@ -33,6 +36,12 @@ void onTick(CBlob@ this) { } else if (overlapping[i].getName() == "quarters") { overlapping_kfc = true; @thekfc = overlapping[i]; + } else if (overlapping[i].getName() == "vehicleshop") { + overlapping_vehicle = true; + @thevehicle = overlapping[i]; + } else if (overlapping[i].getName() == "boatshop") { + overlapping_boat = true; + @theboat = overlapping[i]; } } } @@ -370,6 +379,124 @@ void onTick(CBlob@ this) { } } } + + // Vehicle Shop + if (overlapping_vehicle && thevehicle !is null) { + ShopItem[]@ shopitems; + + if (thevehicle.get("shop array", @shopitems)) { + bool wanna_buy = false; + u8 item_id = 250; + + if (b_KeyJustPressed("vehicle_catapult")) { + wanna_buy = true; + item_id = 0; + } + if (b_KeyJustPressed("vehicle_ballista")) { + wanna_buy = true; + item_id = 1; + } + if (b_KeyJustPressed("vehicle_outpost")) { + wanna_buy = true; + item_id = 2; + } + if (b_KeyJustPressed("vehicle_bolts")) { + wanna_buy = true; + item_id = 3; + } + if (b_KeyJustPressed("vehicle_shells")) { + wanna_buy = true; + item_id = 4; + } + + // idk why it's duplicated, whatever + if (b_KeyJustPressed("vehicle_catapult")) { + wanna_buy = true; + item_id = 0; + } + if (b_KeyJustPressed("vehicle_ballista")) { + wanna_buy = true; + item_id = 1; + } + if (b_KeyJustPressed("vehicle_outpost")) { + wanna_buy = true; + item_id = 2; + } + if (b_KeyJustPressed("vehicle_bolts")) { + wanna_buy = true; + item_id = 3; + } + if (b_KeyJustPressed("vehicle_shells")) { + wanna_buy = true; + item_id = 4; + } + + if (wanna_buy) { + dont_show_emotes = true; + ShopItem @s_item = shopitems[item_id]; + + if (s_item !is null) { + CBitStream params; + + params.write_u8(u8(item_id)); + params.write_bool(true); //used hotkey? + + thevehicle.SendCommand(thevehicle.getCommandID("shop buy"), params); + } + } + } + } + + // Boat Shop + if (overlapping_boat && theboat !is null) { + ShopItem[]@ shopitems; + + if (theboat.get("shop array", @shopitems)) { + bool wanna_buy = false; + u8 item_id = 250; + + if (b_KeyJustPressed("boat_dinghy")) { + wanna_buy = true; + item_id = 0; + } + if (b_KeyJustPressed("boat_longboat")) { + wanna_buy = true; + item_id = 1; + } + if (b_KeyJustPressed("boat_warboat")) { + wanna_buy = true; + item_id = 2; + } + + // idk why it's duplicated, whatever + if (b_KeyJustPressed("boat_dinghy")) { + wanna_buy = true; + item_id = 0; + } + if (b_KeyJustPressed("boat_longboat")) { + wanna_buy = true; + item_id = 1; + } + if (b_KeyJustPressed("boat_warboat")) { + wanna_buy = true; + item_id = 2; + } + + if (wanna_buy) { + dont_show_emotes = true; + ShopItem @s_item = shopitems[item_id]; + + if (s_item !is null) { + CBitStream params; + + params.write_u8(u8(item_id)); + params.write_bool(true); //used hotkey? + + theboat.SendCommand(theboat.getCommandID("shop buy"), params); + } + } + } + } } if (getRules().get_string("dse_while_using_nomenu_buying") == "yes") { @@ -395,11 +522,15 @@ void onRender(CSprite@ this) { bool overlapping_archershop = false; bool overlapping_buildershop = false; bool overlapping_kfc = false; + bool overlapping_vehicle = false; + bool overlapping_boat = false; CBlob@ theknightshop; CBlob@ thearchershop; CBlob@ thebuildershop; CBlob@ thekfc; + CBlob@ thevehicle; + CBlob@ theboat; int swidth = getDriver().getScreenWidth(); int sheight = getDriver().getScreenHeight(); @@ -413,13 +544,18 @@ void onRender(CSprite@ this) { } else if (overlapping[i].getName() == "archershop") { overlapping_archershop = true; @thearchershop = overlapping[i]; - } - else if (overlapping[i].getName() == "buildershop") { + } else if (overlapping[i].getName() == "buildershop") { overlapping_buildershop = true; @thebuildershop = overlapping[i]; } else if (overlapping[i].getName() == "quarters") { overlapping_kfc = true; @thekfc = overlapping[i]; + } else if (overlapping[i].getName() == "vehicleshop") { + overlapping_vehicle = true; + @thevehicle = overlapping[i]; + } else if (overlapping[i].getName() == "boatshop") { + overlapping_boat = true; + @theboat = overlapping[i]; } } } @@ -514,7 +650,7 @@ void onRender(CSprite@ this) { }; if (thekfc.get("shop array", @shopitems)) { - for (int i=0; i < shopitems.length; ++i) { + for (int i = 0; i < shopitems.length; ++i) { s32 buttonwidth = advance_by.x; ShopItem @s_item = shopitems[i]; @@ -556,7 +692,7 @@ void onRender(CSprite@ this) { }; if (thebuildershop.get("shop array", @shopitems)) { - for (int i=0; i < 9; ++i) { + for (int i = 0; i < 10; ++i) { s32 buttonwidth = advance_by.x; ShopItem @s_item = shopitems[i]; @@ -590,4 +726,81 @@ void onRender(CSprite@ this) { } } } + + if (overlapping_vehicle) { + string[] items = { + "vehicle_catapult", + "vehicle_ballista", + "vehicle_outpost", + "vehicle_bolts", + "vehicle_shells" + }; + + if (thevehicle.get("shop array", @shopitems)) { + for (int i = 0; i < 5; ++i) { + s32 buttonwidth = advance_by.x; + s32 buttonheight = advance_by.y; + ShopItem @s_item = shopitems[i]; + + if (s_item.blobName == "catapult") { + buttonwidth = 72; + buttonheight = 64; + } + if (s_item.blobName == "ballista") { + buttonwidth = 72; + buttonheight = 64; + } + if (s_item.blobName == "outpost") { + buttonwidth = 72; + buttonheight = 64; + } + + string binding; + if (getRules().get_s32(items[i] + "$1") != -1) { + binding = getKeyName(getRules().get_s32(items[i] + "$1")); + + if (getRules().get_s32(items[i] + "$2") != -1) + { + binding += ("+" + getKeyName(getRules().get_s32(items[i] + "$2"))); + } + } + + GUI::DrawPane(start_drawing_here, start_drawing_here+Vec2f(buttonwidth, buttonheight)); + GUI::DrawIconByName(s_item.iconName, start_drawing_here + Vec2f(6, 6)); + GUI::DrawText(binding, start_drawing_here + Vec2f(0, 0), color_white); + start_drawing_here.x += buttonwidth; + } + } + } + + if (overlapping_boat) { + string[] items = { + "boat_dinghy", + "boat_longboat", + "boat_warboat" + }; + + if (theboat.get("shop array", @shopitems)) { + for (int i = 0; i < 3; ++i) { + s32 buttonwidth = 72; + s32 buttonheight = 64; + ShopItem @s_item = shopitems[i]; + + string binding; + if (getRules().get_s32(items[i] + "$1") != -1) { + binding = getKeyName(getRules().get_s32(items[i] + "$1")); + + if (getRules().get_s32(items[i] + "$2") != -1) + { + binding += ("+" + getKeyName(getRules().get_s32(items[i] + "$2"))); + } + } + + GUI::DrawPane(start_drawing_here, start_drawing_here+Vec2f(buttonwidth, buttonheight)); + GUI::DrawIconByName(s_item.iconName, start_drawing_here + Vec2f(6, 6)); + GUI::DrawText(binding, start_drawing_here + Vec2f(0, 0), color_white); + start_drawing_here.x += buttonwidth; + } + } + } } \ No newline at end of file diff --git a/Translations/TranslationsSystem.as b/Translations/TranslationsSystem.as index d79825df..d69f7f7b 100644 --- a/Translations/TranslationsSystem.as +++ b/Translations/TranslationsSystem.as @@ -117,6 +117,8 @@ namespace Names buildernmb = Translate(en::n_buildernmb+"\\"+ru::n_buildernmb), knightnmb = Translate(en::n_knightnmb+"\\"+ru::n_knightnmb), quartersnmb = Translate(en::n_quartersnmb+"\\"+ru::n_quartersnmb), + vehiclenmb = Translate(en::n_vehiclenmb+"\\"+ru::n_vehiclenmb), + boatnmb = Translate(en::n_boatnmb+"\\"+ru::n_boatnmb), settingsmenu = Translate(en::n_settingsmenu+"\\"+ru::n_settingsmenu), vsettingsmenu = Translate(en::n_vsettingsmenu+"\\"+ru::n_vsettingsmenu), tagwheel = Translate(en::n_tagwheel+"\\"+ru::n_tagwheel), @@ -178,6 +180,18 @@ namespace Names pearnmb = Translate(en::n_pearnmb+"\\"+ru::n_pearnmb), sleepnmb = Translate(en::n_sleepnmb+"\\"+ru::n_sleepnmb), + // Vehicle Shop + catapultnmb = Translate(en::n_catapultnmb+"\\"+ru::n_catapultnmb), + ballistanmb = Translate(en::n_ballistanmb+"\\"+ru::n_ballistanmb), + outpostnmb = Translate(en::n_outpostnmb+"\\"+ru::n_outpostnmb), + boltsnmb = Translate(en::n_boltsnmb+"\\"+ru::n_boltsnmb), + shellsnmb = Translate(en::n_shellsnmb+"\\"+ru::n_shellsnmb), + + // Boat Shop + dinghynmb = Translate(en::n_dinghynmb+"\\"+ru::n_dinghynmb), + longboatnmb = Translate(en::n_longboatnmb+"\\"+ru::n_longboatnmb), + warboatnmb = Translate(en::n_warboatnmb+"\\"+ru::n_warboatnmb), + // Settings buildmode = Translate(en::n_buildmode+"\\"+ru::n_buildmode), blockbar = Translate(en::n_blockbar+"\\"+ru::n_blockbar), diff --git a/Translations/language_en.as b/Translations/language_en.as index c7bb1b62..9bc18787 100644 --- a/Translations/language_en.as +++ b/Translations/language_en.as @@ -100,6 +100,8 @@ namespace en n_buildernmb = "Builder Shop\n (binds)", n_knightnmb = "Knight Shop\n (binds)", n_quartersnmb = "Quarters\n (binds)", + n_vehiclenmb = "Vehicle Shop\n (binds)", + n_boatnmb = "Boat Shop\n (binds)", n_settingsmenu = "Settings", n_vsettingsmenu = "Visual/Sound\n Settings", n_tagwheel = "Tag Wheel", @@ -161,6 +163,18 @@ namespace en n_pearnmb = "Pear", n_sleepnmb = "Sleep", + // Vehicle Shop + n_catapultnmb = "Catapult", + n_ballistanmb = "Ballista", + n_outpostnmb = "Outpost", + n_boltsnmb = "Ballista Bolts", + n_shellsnmb = "Ballista Shells", + + // Boat Shop + n_dinghynmb = "Dinghy", + n_longboatnmb = "Long Boat", + n_warboatnmb = "War Boat", + // Settings n_buildmode = "Build Mode", n_blockbar = "Show block bar HUD", diff --git a/Translations/language_ru.as b/Translations/language_ru.as index d4053b46..3e699a0c 100644 --- a/Translations/language_ru.as +++ b/Translations/language_ru.as @@ -100,6 +100,8 @@ namespace ru n_buildernmb = "Магазин строителя\n (бинды)", n_knightnmb = "Магазин рыцаря\n (бинды)", n_quartersnmb = "Магазин еды\n (бинды)", + n_vehiclenmb = "Магазин машин\n (бинды)", + n_boatnmb = "Магазин лодок\n (бинды)", n_settingsmenu = "Настройки", n_vsettingsmenu = "Настройки визуа-\n ла и звуков", n_tagwheel = "Колесо меток", @@ -161,6 +163,18 @@ namespace ru n_pearnmb = "Груша", n_sleepnmb = "Спать", + // Vehicle Shop + n_catapultnmb = "Катапульта", + n_ballistanmb = "Баллиста", + n_outpostnmb = "Аванпост", + n_boltsnmb = "Болты для баллисты", + n_shellsnmb = "Взрывные болты для баллисты", + + // Boat Shop + n_dinghynmb = "Шлюпка", + n_longboatnmb = "Большая лодка", + n_warboatnmb = "Военная лодка", + // Settings n_buildmode = "Режим строительства", n_blockbar = "Включить панель с блоками",