- Joined
- Apr 8, 2011
- Messages
- 108
JASS:
library Inventory initializer Init requires GUI, Buttons, Sliders, MainEngine
// globals
private trigger Esc = CreateTrigger(), Selection = CreateTrigger()
public bool IsOpened = false
private bool SelectionMode = false, UseMode = false
public int CurrentCategory = 1
//private destructable HeroModel
private unit HeroModel
private timer HitTimer = CT, ParametersUpdateTimer = CT
private bool Click = false, DropFlag = false
private int LastClicked = 0, LastTracked = 0, LastStates = 1, CurrentSelectedItemButton = 0
private int DropItemButton, RegisterItemButton
public int EquipedSlot[10]
public item EquipedItem[10]
public item SlotItem[5][26]
private item CurrentSelectedItem = null
public int SlotButton[26]
public real Weight = 0., MaxWeight, WeightMod = 0.
private destructable Border[26], ChargeBorder[26], Stone[4]
private int Category[5]
private int StatesSlider, DropSlider
private texttag Description[16], ChargeText[25], StatesText[8], WeightText
private effect Attach[4]
define {
private HeroModelId = 'h003'
private ChargesId = 'B02P'
private BorderId = 'B023'
private EmptyStoneId = 'B02S'
private EmptySlot = 'B022'
private EmptySlot_Weapon = 'B024'
private EmptySlot_Chest = 'B025'
private EmptySlot_Head = 'B026'
private EmptySlot_Hands = 'B027'
private EmptySlot_Shoulders = 'B028'
private EmptySlot_Legs = 'B029'
private EmptySlot_Ring = 'B02A'
private EmptySlot_Necklace = 'B02B'
private WeaponsCategory = 'B02C'
private JewelryCategory = 'B02D'
private MagicCategory = 'B02E'
private PotionsCategory = 'B02F'
private MiscCategory = 0
private DropItemId = 'B02U'
private RegisterItemId = 'B02V'
}
//========================================================================
private void TimerDestroy(){ Click = false }
string GetRankColor(int rank){
if rank == COMMON_ITEM { return "|c00C8C8C8" }
elseif rank == MAGIC_ITEM { return "|c00C1C1FF" }
elseif rank == RARE_ITEM {return "|c00FFFF00" }
elseif rank == SET_ITEM { return "|c007DFF7D" }
elseif rank == UNIQUE_ITEM { return "|c008300C4" }
return "x"
}
string GetWeaponTypeName(WeaponItem i){
if i.weapon_type == BOW { return "Bow" }
elseif i.weapon_type == BLUNT { return "Mace" }
elseif i.weapon_type == GREATBLUNT { return "Greatmace" }
elseif i.weapon_type == SWORD { return "Sword" }
elseif i.weapon_type == GREATSWORD { return "Greatsword" }
elseif i.weapon_type == AXE { return "Axe" }
elseif i.weapon_type == GREATAXE { return "Greataxe" }
elseif i.weapon_type == DAGGER { return "Dagger" }
elseif i.weapon_type == STAFF { return "Staff" }
elseif i.weapon_type == POLE { return "Pole" }
return "x"
}
bool IsWeaponTwohanded(item i){
WeaponItem weapon = GetItemData(i)
return (weapon.weapon_type == BOW \\
or weapon.weapon_type == GREATBLUNT \\
or weapon.weapon_type == GREATSWORD \\
or weapon.weapon_type == GREATAXE \\
or weapon.weapon_type == STAFF \\
or weapon.weapon_type == POLE)
}
int CountFreeSlots(int where){
int count = 0, index = 0
while(index++ < 25){ if SlotItem[where][index] == null { count++ } }
return count
}
bool HeroHaveItemType(int item_id, int where){
int index = 0
while(index++ < 25){ if GetItemTypeId(SlotItem[where][index]) == item_id { return true } }
return false
}
void WeightChange(real amount, bool flag){
UD hero = GetData(Hero)
string s = "|c0000FF00"
if flag {
Weight += amount
if Weight > MaxWeight {
if WeightMod > 0. { hero.SetSpeedType1(1. - (WeightMod * 0.1), false)/*hero.SetSpeedType1(1. + (1. - (WeightMod * 0.1)), true)*/ }
WeightMod = Weight - MaxWeight
hero.SetSpeedType1(1. - (WeightMod * 0.1), true)
s = "|c00FF0000"
}
}
else {
Weight -= amount
if Weight <= MaxWeight {
hero.SetSpeedType1(1. - (WeightMod * 0.1), false)
WeightMod = 0.
}
else { s = "|c00FF0000" }
}
SetTextTagText(WeightText, "Weight: " + s + I2S(R2I(Weight)) + "|r"+"/"+I2S(R2I(MaxWeight))+" кг.", (8. * 0.023) / 10.)
}
void GiveItem(item i){
int id = GetItemTypeId(i), item_cell = GetItemCell(id), index = 0, item_category = ItemCategory[item_cell]
// --->
if GetItemType(i) == ITEM_TYPE_CHARGED {
while(index++ < 25) {
if id == GetItemTypeId(SlotItem[item_category][index]) {
SetItemCharges(SlotItem[item_category][index], GetItemCharges(i) + GetItemCharges(SlotItem[item_category][index]))
WeightChange(ItemWeight[item_cell] * GetItemCharges(i),true)
RemoveItem(i)
return
}
}
index = 0
}
while(index++ < 25) {
if SlotItem[item_category][index] == null {
SlotItem[item_category][index] = i
WeightChange(ItemWeight[item_cell], true)
SetItemVisible(i, false)
return
}
}
// <---
SimError("Not enought space")
}
void DropItem(item i){
int item_cell = GetItemCell(GetItemTypeId(i)), index = 0, item_category = ItemCategory[item_cell]
// --->
while(index++ < 25) {
if SlotItem[item_category][index] == i {
SlotItem[item_category][index] = null
SetItemVisible(i, true)
SetItemPosition(i, Gx(Hero) + Rx(RndR(0., 50.), RndAng), Gy(Hero) + Ry(RndR(0., 50.), RndAng))
WeightChange(ItemWeight[item_cell], false)
break
}
}
// <---
}
private void InitSound(item i, int item_type, bool b){
int cell
// weapon
if item_type == 1 {
cell = GetWeaponCell(GetItemTypeId(i))
if WeaponSoundVariation[cell] == SWORD_EQUIP {
if b { PlaySimpleSound("weapon_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == SWORD_FIRE {
if b { PlaySimpleSound("sword_fire_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == SWORD_SOULDRINKER {
if b { PlaySimpleSound("sword_souldrinker_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == DAGGER_EQUIP {
if b { PlaySimpleSound("dagger_equip.wav") }
else { PlaySimpleSound("dagger_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == DAGGER_ASHES {
if b { PlaySimpleSound("weapon_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == DAGGER_LIGHTNING {
if b { PlaySimpleSound("weapon_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == DAGGER_POISONED {
if b { PlaySimpleSound("weapon_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == DAGGER_POLAR {
if b { PlaySimpleSound("weapon_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == STAFF_EQUIP {
if b { PlaySimpleSound("weapon_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == STAFF_FIRE {
if b { PlaySimpleSound("weapon_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == STAFF_MANADRINKER {
if b { PlaySimpleSound("weapon_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == BOW_EQUIP {
if b { PlaySimpleSound("bow_equip.wav") }
else { PlaySimpleSound("bow_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == BOW_EXPLOSIVE {
if b { PlaySimpleSound("weapon_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == BOW_MASS {
if b { PlaySimpleSound("weapon_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == BOW_POISONED {
if b { PlaySimpleSound("weapon_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
elseif WeaponSoundVariation[cell] == BOW_POLAR {
if b { PlaySimpleSound("weapon_equip.wav") }
else { PlaySimpleSound("weapon_unequip.wav") }
}
}
// armor
elseif item_type == 2 {
cell = GetArmorCell(GetItemTypeId(i))
if ArmorSoundVariation[cell] == 1 {
if b { PlaySimpleSound("cloth_armor_equip.wav") }
else { PlaySimpleSound("cloth_armor_unequip.wav") }
}
else {
if b { PlaySimpleSound("chain_armor_equip.wav") }
else { PlaySimpleSound("chain_armor_unequip.wav") }
}
}
// jewelry
elseif item_type == 3 {
cell = GetJewelryCell(GetItemTypeId(i))
if JewelrySoundVariation[cell] == 1 {
if b { PlaySimpleSound("ring_equip.wav") }
else { PlaySimpleSound("ring_unequip.wav") }
}
}
elseif item_type == 4 {
if b { PlaySimpleSound("shield_equip.wav") }
else { PlaySimpleSound("shield_unequip.wav") }
}
elseif item_type == 5 {
if b { PlaySimpleSound("helmet_equip.wav") }
else { PlaySimpleSound("helmet_unequip.wav") }
}
}
private void ClearDescription(){
int index = 0
while(index++ < 16){ DestroyTextTag(Description[index]) }
RemoveDestructable(Stone[1]); RemoveDestructable(Stone[2])
RemoveDestructable(Stone[3]); RemoveDestructable(Stone[4])
}
private void UpdateParameters(){
UD hero = GetData(Hero)
//if R2I(Slider_Value[StatesSlider][3]) != LastStates {
//LastStates = R2I(Slider_Value[StatesSlider][3])
if (R2I(Slider_Value[StatesSlider][3]) + 1) == 1 {
SetTextTagText(StatesText[1], "Phys. Damage: " + I2S(hero.physical_attack), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[2], "Accuracy: " + I2S(hero.accuracy), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[3], "Critical Chance: " + I2S(R2I(hero.physical_critical_chance))+"%", (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[4], "Attack Speed: " + SubString(R2S(hero.attack_speed), 0, 3), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[5], "", 0.)
SetTextTagText(StatesText[6], "", 0.)
SetTextTagText(StatesText[7], "", 0.)
SetTextTagText(StatesText[8], "", 0.)
}
elseif (R2I(Slider_Value[StatesSlider][3]) + 1) == 2 {
SetTextTagText(StatesText[1], "Phys. Defence: " + I2S(hero.physical_defence), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[2], "Evade: " + I2S(hero.evade), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[3], "Parry: " + I2S(hero.parry), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[4], "Block: " + I2S(hero.block), (7.7 * 0.023) / 10.)
}
elseif (R2I(Slider_Value[StatesSlider][3]) + 1) == 3 {
SetTextTagText(StatesText[1], "Mag Attack: " + I2S(hero.magical_attack), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[2], "Mag Acc.: " + I2S(hero.magical_accuracy), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[3], "Mag Crit.: " + I2S(R2I(hero.magical_critical_chance))+"%", (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[4], "Casting: " + SubString(R2S(hero.casting_speed), 0, 3), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[5], "", 0.)
SetTextTagText(StatesText[6], "", 0.)
SetTextTagText(StatesText[7], "", 0.)
SetTextTagText(StatesText[8], "", 0.)
}
elseif (R2I(Slider_Value[StatesSlider][3]) + 1) == 4 {
SetTextTagText(StatesText[1], "Suppression: " + I2S(hero.magical_suppression), (7.8 * 0.023) / 10.)
SetTextTagText(StatesText[2], "Reflection: " + I2S(hero.magical_resist), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[3], "Fire Res.: " + I2S(R2I(hero.resist[FIRE])), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[4], "Water Res.: " + I2S(R2I(hero.resist[AQUA])), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[5], "Wind Res.: " + I2S(R2I(hero.resist[WIND])), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[6], "Earth Res.: " + I2S(R2I(hero.resist[EARTH])), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[7], "Darkness Res.: " + I2S(R2I(hero.resist[DARKNESS])), (7.7 * 0.023) / 10.)
SetTextTagText(StatesText[8], "Light Res.: " + I2S(R2I(hero.resist[HOLY])), (7.7 * 0.023) / 10.)
}
//}
}
void CloseInventory(){
int index = 0
GUI_DestroyInterface()
Buttons_RemoveAll()
IsOpened = false
ShowUnit(HeroModel, false)
SetTextTagVisibility(StatesText[1], false)
SetTextTagVisibility(StatesText[2], false)
SetTextTagVisibility(StatesText[3], false)
SetTextTagVisibility(StatesText[4], false)
SetTextTagVisibility(StatesText[5], false)
SetTextTagVisibility(StatesText[6], false)
SetTextTagVisibility(StatesText[7], false)
SetTextTagVisibility(StatesText[8], false)
SetTextTagVisibility(WeightText, false)
SelectionMode = false; UseMode = false
Sliders_Show(StatesSlider)
DisableTrigger(Selection)
ClearDescription()
PT(ParametersUpdateTimer)
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
while(index++ < 25)
{ ShowDestructable(Border[index], false); ShowDestructable(ChargeBorder[index], false); SetTextTagVisibility(ChargeText[index], false) }
}
private void ShowDescriptionOfItem(item i){
WeaponItem weapon = GetItemData(i)
ArmorItem armor = GetItemData(i)
JewelryItem jewelry = GetItemData(i)
ShieldItem shield = GetItemData(i)
int cell, id = GetItemTypeId(i), item_cell = GetItemCell(id), index = 0
real x = (GUI_X(17)) + 30., y = GUI_Y(10)
if ItemType[item_cell] == 1 {
Description[1] = AddTextEx(GetRankColor(weapon.rank) + GetItemName(i) + "|r", x, y, 8.95)
Description[2] = AddTextEx(GetWeaponTypeName(weapon), x, (y - 26.), 8.5)
Description[3] = AddTextEx("Damage: "+I2S(weapon.damage), x, (y - (26. * 2.)), 8.6)
Description[4] = AddTextEx("Mag Damage: "+I2S(weapon.magical_damage), x, (y - (26. * 3.)), 8.6)
Description[5] = AddTextEx("Accuracy: "+I2S(R2I(weapon.accuracy)), x, (y - (26. * 4.)), 8.6)
Description[6] = AddTextEx("Mag Accuracy: "+I2S(R2I(weapon.magical_accuracy)), x, (y - (26. * 5.)), 8.6)
// описание дополнительных хар-тик
while(index++ < 4) {
if weapon.which_state_bonus[index] > 0 {
if index == 1 { y = ((GUI_Y(10)) - (26. * 6.)) }
elseif index == 2 { x = GUI_X(20); y = ((GUI_Y(10)) - (26. * 6.)) }
elseif index == 3 { x = (GUI_X(17)) + 30.; y = ((GUI_Y(10)) - (26. * 7.)) }
elseif index == 4 { x = GUI_X(20); y = ((GUI_Y(10)) - (26. * 7.)) }
Description[6 + index] = AddTextEx(Parameter2String(weapon.which_state_bonus[index], weapon.which_state_value_bonus[index], true), x, y, 7.6)
}
}
// описание камней
if weapon.stones_cell > 0 {
index = 0
x = (GUI_X(17)) + 30.; y = GUI_Y(10)
Description[9] = AddTextEx("=======================", x, y - (26. * 9.), 7.6)
while (index++ < weapon.stones_cell) {
if GetGemCell(weapon.inserted_stone[index]) > 0 {
Stone[index] = CreateDestructable(GemIcon[Gem_lastFinded], x + 10., y - (26. * (9 + index)), 0., 0.32, 0)
Description[9 + index] = AddTextEx(Parameter2String(GemWeaponParameterType[Gem_lastFinded], GemWeaponParameterBonus[Gem_lastFinded], true), x + 35., y - ((26. * (9 + index)) + 10.), 7.6)
}
else {
Stone[index] = CreateDestructable(EmptyStoneId, x + 10., y - (26. * (9 + index)), 0., 0.32, 0)
}
}
Description[15] = AddTextEx("=======================", x, y - (26. * 15.), 7.6)
}
}
elseif ItemType[item_cell] == 2 {
Description[1] = AddTextEx(GetRankColor(armor.rank) + GetItemName(i) + "|r", x, y, 8.95)
Description[2] = AddTextEx("Defence: "+I2S(R2I(armor.defence)), x, (y - 26.), 8.6)
while(index++ < 4) {
if armor.which_state_bonus[index] > 0 {
if index == 1 { x = (GUI_X(17)) + 40.;y = ((GUI_Y(10)) - (26. * 6.)) }
elseif index == 2 { x = (GUI_X(20)) ; y = ((GUI_Y(10)) - (26. * 6.)) }
elseif index == 3 { x = (GUI_X(17)) + 40.; y = ((GUI_Y(10)) - (26. * 7.)) }
elseif index == 4 { x = (GUI_X(20)); y = ((GUI_Y(10)) - (26. * 7.)) }
Description[2 + index] = AddTextEx(Parameter2String(armor.which_state_bonus[index], armor.which_state_value_bonus[index], true), x, y, 7.6)
}
}
if armor.stones_cell > 0 {
index = 0
x = (GUI_X(17)) + 30.; y = GUI_Y(10)
Description[7] = AddTextEx("=======================", x, y - (26. * 7.), 7.6)
while (index++ < armor.stones_cell) {
if GetGemCell(armor.inserted_stone[index]) > 0 {
Stone[index] = CreateDestructable(GemIcon[Gem_lastFinded], x + 10., y - (26. * (index + 7)), 0., 0.35, 0)
Description[7 + index] = AddTextEx(Parameter2String(GemArmorParameterType[Gem_lastFinded], GemArmorParameterBonus[Gem_lastFinded], true), x + 40., y - ((26. * (7 + index)) + 10.), 7.6)
}
else {
Stone[index] = CreateDestructable(EmptyStoneId, x + 10., y - (26. * (index + 7)), 0., 0.32, 0)
}
}
Description[12] = AddTextEx("=======================", x, y - (26. * 12.), 7.6)
}
}
elseif ItemType[item_cell] == 3 {
Description[1] = AddTextEx(GetRankColor(jewelry.rank) + GetItemName(i) + "|r", x, y, 8.95)
Description[2] = AddTextEx("Suppression: "+I2S(R2I(jewelry.suppression)), x, (y - 26.), 8.6)
while(index++ < 4) {
if jewelry.which_state_bonus[index] > 0 {
if index == 1 { y = ((GUI_Y(10)) - (26. * 6.)) }
elseif index == 2 { x = GUI_X(20); y = ((GUI_Y(10)) - (26. * 6.)) }
elseif index == 3 { x = (GUI_X(17)) + 30.; y = ((GUI_Y(10)) - (26. * 7.)) }
elseif index == 4 { x = GUI_X(20); y = ((GUI_Y(10)) - (26. * 7.)) }
Description[2 + index] = AddTextEx(Parameter2String(jewelry.which_state_bonus[index], jewelry.which_state_value_bonus[index], true), x, y, 7.6)
}
}
if jewelry.stones_cell > 0 {
index = 0
x = (GUI_X(17)) + 30.; y = GUI_Y(10)
Description[7] = AddTextEx("=======================", x, y - (26. * 7.), 7.6)
while (index++ < jewelry.stones_cell) {
if GetGemCell(jewelry.inserted_stone[index]) > 0 {
Stone[index] = CreateDestructable(GemIcon[Gem_lastFinded], x + 10., y - (26. * (index + 7)), 0., 0.35, 0)
Description[7 + index] = AddTextEx(Parameter2String(GemJewelParameterType[Gem_lastFinded], GemJewelParameterBonus[Gem_lastFinded], true), x + 40., y - ((26. * (7 + index)) + 10.), 7.6)
}
else {
Stone[index] = CreateDestructable(EmptyStoneId, x + 10., y - (26. * (index + 7)), 0., 0.32, 0)
}
}
Description[12] = AddTextEx("=======================", x, y - (26. * 12.), 7.6)
}
}
elseif ItemType[item_cell] == 4 {
Description[1] = AddTextEx(GetRankColor(shield.rank) + GetItemName(i) + "|r", x, y, 8.95)
Description[2] = AddTextEx("Block: "+I2S(R2I(shield.block)), x, (y - 26.), 8.6)
while(index++ < 4) {
if shield.which_state_bonus[index] > 0 {
if index == 1 { y = ((GUI_Y(10)) - (26. * 6.)) }
elseif index == 2 { x = GUI_X(20); y = ((GUI_Y(10)) - (26. * 6.)) }
elseif index == 3 { x = (GUI_X(17)) + 30.; y = ((GUI_Y(10)) - (26. * 7.)) }
elseif index == 4 { x = GUI_X(20); y = ((GUI_Y(10)) - (26. * 7.)) }
Description[2 + index] = AddTextEx(Parameter2String(shield.which_state_bonus[index], shield.which_state_value_bonus[index], true), x, y, 7.6)
}
}
if shield.stones_cell > 0 {
index = 0
x = (GUI_X(17)) + 30.; y = GUI_Y(10)
Description[7] = AddTextEx("=======================", x, y - (26. * 7.), 7.6)
while (index++ < shield.stones_cell) {
if GetGemCell(shield.inserted_stone[index]) > 0 {
Stone[index] = CreateDestructable(GemIcon[Gem_lastFinded], x + 10., y - (26. * (index + 7)), 0., 0.32, 0)
Description[7 + index] = AddTextEx(Parameter2String(GemShieldParameterType[Gem_lastFinded], GemShieldParameterBonus[Gem_lastFinded], true), x + 40., y - ((26. * (7 + index)) + 10.), 7.6)
}
else {
Stone[index] = CreateDestructable(EmptyStoneId, x + 10., y - (26. * (index + 7)), 0., 0.32, 0)
}
}
Description[12] = AddTextEx("=======================", x, y - (26. * 12.), 7.6)
}
}
else {
Description[1] = AddTextEx(GetItemName(i), x, y, 8.95)
while(index++ < 6){
if StringLength(ItemDescription[item_cell][index]) > 0 {
Description[index + 1] = AddTextEx(ItemDescription[item_cell][index], x, (y - (26. * index)), 8.5)
}
}
}
}
public void RefreshPage(bool with_clean){
int index = 0
if with_clean {
while(index++ < 25){ Buttons_Remove(SlotButton[index]) }
ClearDescription()
index = 0
}
while(index++ < 25){
ShowDestructable(ChargeBorder[index], false)
SetTextTagVisibility(ChargeText[index], false)
if SlotItem[CurrentCategory][index] == null {
Buttons_SetAttachEx(SlotButton[index], index, EmptySlot)
}
else {
Buttons_SetAttachEx(SlotButton[index], index, ItemIcon[GetItemCell(GetItemTypeId(SlotItem[CurrentCategory][index]))])
if GetItemType(SlotItem[CurrentCategory][index]) == ITEM_TYPE_CHARGED {
SetTextTagText(ChargeText[index], I2S(GetItemCharges(SlotItem[CurrentCategory][index])), (7.6 * 0.023) / 10.)
SetTextTagVisibility(ChargeText[index], true)
ShowDestructable(ChargeBorder[index], true)
if IsItemInvulnerable(SlotItem[CurrentCategory][index]) { Buttons_AddSelectionEffect(SlotButton[index], 2) }
}
}
ShowDestructable(Border[index], true)
}
}
void SocketGem(item gem, item i){
WeaponItem weapon = GetItemData(i)
ArmorItem armor = GetItemData(i)
JewelryItem jewelry = GetItemData(i)
ShieldItem shield = GetItemData(i)
int item_cell = GetItemCell(GetItemTypeId(i)), index = 0
if ItemType[item_cell] == 1 {
if weapon.stones_cell > 0 {
while(index++ < weapon.stones_cell) {
if weapon.inserted_stone[index] == 1 {
if i == EquipedItem[1] {
EquipWeaponItem(Hero, EquipedItem[1], false)
}
elseif i == EquipedItem[2] {
EquipOffhandWeaponItem(Hero, EquipedItem[2], false)
}
weapon.inserted_stone[index] = GetItemTypeId(gem)
index = GemWeaponParameterType[GetGemCell(GetItemTypeId(gem))]
if (index >= FIRE_DAMAGE and index <= BLOOD_DAMAGE) {
if index == FIRE_DAMAGE { weapon.damage_attribute = FIRE }
elseif index == AQUA_DAMAGE { weapon.damage_attribute = AQUA }
elseif index == WIND_DAMAGE { weapon.damage_attribute = WIND }
elseif index == EARTH_DAMAGE { weapon.damage_attribute = EARTH }
elseif index == HOLY_DAMAGE { weapon.damage_attribute = HOLY }
elseif index == DARKNESS_DAMAGE { weapon.damage_attribute = DARKNESS }
elseif index == NATURE_DAMAGE { weapon.damage_attribute = NATURE }
elseif index == BLOOD_DAMAGE { weapon.damage_attribute = BLOOD }
}
if GetItemCharges(gem) == 1 {
SlotItem[3][Button[CurrentSelectedItemButton]] = null
}
else {
SetItemCharges(gem, GetItemCharges(gem) - 1)
}
if i == EquipedItem[1] {
EquipWeaponItem(Hero, EquipedItem[1], true)
}
elseif i == EquipedItem[2] {
EquipOffhandWeaponItem(Hero, EquipedItem[2], true)
}
break
}
}
}
}
elseif ItemType[item_cell] == 2 {
if armor.stones_cell > 0 {
while(index++ < armor.stones_cell) {
if armor.inserted_stone[index] == 1 {
if i == EquipedItem[3] {
EquipArmorItem(Hero, EquipedItem[3], false)
}
elseif i == EquipedItem[5] {
EquipArmorItem(Hero, EquipedItem[5], false)
}
elseif i == EquipedItem[6] {
EquipArmorItem(Hero, EquipedItem[6], false)
}
elseif i == EquipedItem[7] {
EquipArmorItem(Hero, EquipedItem[7], false)
}
elseif i == EquipedItem[8] {
EquipArmorItem(Hero, EquipedItem[8], false)
}
armor.inserted_stone[index] = GetItemTypeId(gem)
if GetItemCharges(gem) == 1 {
SlotItem[3][Button[CurrentSelectedItemButton]] = null
}
else {
SetItemCharges(gem, GetItemCharges(gem) - 1)
}
if i == EquipedItem[3] {
EquipArmorItem(Hero, EquipedItem[3], true)
}
elseif i == EquipedItem[5] {
EquipArmorItem(Hero, EquipedItem[5], true)
}
elseif i == EquipedItem[6] {
EquipArmorItem(Hero, EquipedItem[6], true)
}
elseif i == EquipedItem[7] {
EquipArmorItem(Hero, EquipedItem[7], true)
}
elseif i == EquipedItem[8] {
EquipArmorItem(Hero, EquipedItem[8], true)
}
break
}
}
}
}
elseif ItemType[item_cell] == 3 {
if jewelry.stones_cell > 0 {
while(index++ < jewelry.stones_cell) {
if jewelry.inserted_stone[index] == 1 {
if i == EquipedItem[4] {
EquipJewelryItem(Hero, EquipedItem[4], false)
}
elseif i == EquipedItem[9] {
EquipJewelryItem(Hero, EquipedItem[9], false)
}
elseif i == EquipedItem[10] {
EquipJewelryItem(Hero, EquipedItem[10], false)
}
jewelry.inserted_stone[index] = GetItemTypeId(gem)
if GetItemCharges(gem) == 1 {
SlotItem[3][Button[CurrentSelectedItemButton]] = null
}
else {
SetItemCharges(gem, GetItemCharges(gem) - 1)
}
if i == EquipedItem[4] {
EquipJewelryItem(Hero, EquipedItem[4], true)
}
elseif i == EquipedItem[9] {
EquipJewelryItem(Hero, EquipedItem[9], true)
}
elseif i == EquipedItem[10] {
EquipJewelryItem(Hero, EquipedItem[10], true)
}
break
}
}
}
}
elseif ItemType[item_cell] == 4 {
if shield.stones_cell > 0 {
while(index++ < shield.stones_cell) {
if shield.inserted_stone[index] == 1 {
shield.inserted_stone[index] = GetItemTypeId(gem)
if GetItemCharges(gem) == 1 {
SlotItem[3][Button[CurrentSelectedItemButton]] = null
}
else {
SetItemCharges(gem, GetItemCharges(gem) - 1)
}
if i == EquipedItem[2] {
EquipShieldItem(Hero, EquipedItem[2], false)
EquipShieldItem(Hero, EquipedItem[2], true)
}
break
}
}
}
}
}
private void TrackableClickAct(){
int button_id = Buttons_GetByTrackable(GetTriggeringTrackable()), index = 0, temp_int, free_count
if Button[button_id] == 0 { /*null button*/ }
elseif (button_id == Category[1] and CurrentCategory != 1) {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not UseMode { SelectionMode = false }
StartSound(GUI_ClickSound)
RemoveDestructable(Button_Selection[Category[CurrentCategory]])
CurrentCategory = 1
RefreshPage(true)
Buttons_AddSelectionEffect(Category[CurrentCategory], 1)
}
elseif (button_id == Category[2] and CurrentCategory != 2) {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not UseMode { SelectionMode = false }
StartSound(GUI_ClickSound)
RemoveDestructable(Button_Selection[Category[CurrentCategory]])
CurrentCategory = 2
RefreshPage(true)
Buttons_AddSelectionEffect(Category[CurrentCategory], 1)
}
elseif (button_id == Category[3] and CurrentCategory != 3) {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not UseMode { SelectionMode = false }
StartSound(GUI_ClickSound)
RemoveDestructable(Button_Selection[Category[CurrentCategory]])
CurrentCategory = 3
RefreshPage(true)
Buttons_AddSelectionEffect(Category[CurrentCategory], 1)
}
elseif (button_id == Category[4] and CurrentCategory != 4) {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not UseMode { SelectionMode = false }
StartSound(GUI_ClickSound)
RemoveDestructable(Button_Selection[Category[CurrentCategory]])
CurrentCategory = 4
Buttons_AddSelectionEffect(Category[CurrentCategory], 1)
RefreshPage(true)
}
elseif ((button_id >= EquipedSlot[1] and button_id <= EquipedSlot[10]) and UseMode){
while(index++ < 10){
if button_id == EquipedSlot[index] { break }
}
if (EquipedItem[index] != null and (GetItemLevel(CurrentSelectedItem) == 2 and GetItemType(CurrentSelectedItem) == ITEM_TYPE_CHARGED)) {
SocketGem(CurrentSelectedItem, EquipedItem[index])
RemoveDestructable(Button_Selection[CurrentSelectedItemButton])
RemoveDestructable(Button_Selection[LastTracked])
SelectionMode = false; UseMode = false
ClearDescription()
ShowDescriptionOfItem(EquipedItem[index])
}
}
// правая рука
elseif (button_id == EquipedSlot[1] and not UseMode) {
StartSound(GUI_ClickSound)
free_count = CountFreeSlots(1)
if (EquipedItem[1] == null and SelectionMode and ItemType[GetItemCell(GetItemTypeId(CurrentSelectedItem))] == 1) {
temp_int = Button[CurrentSelectedItemButton]
Buttons_Remove(EquipedSlot[1])
EquipedItem[1] = CurrentSelectedItem
Attach[1] = AddSpecialEffectTarget(WeaponAttachModel[GetWeaponCell(GetItemTypeId(EquipedItem[1]))], HeroModel, "hand")
Buttons_SetAttachEx(EquipedSlot[1], 1, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[1]))])
EquipWeaponItem(Hero, EquipedItem[1], true)
SelectionMode = false; UseMode = false
SlotItem[CurrentCategory][temp_int] = null
RemoveDestructable(Button_Selection[LastTracked])
ClearDescription()
RefreshPage(true)
InitSound(EquipedItem[1], 1, true)
}
else {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not Click {
if not IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
RemoveDestructable(Button_Selection[LastClicked])
}
if not (GetDestructableLife(Button_Selection[button_id]) > 0.45) {
Buttons_AddSelectionEffect(button_id, 5)
}
Click = true
TimerStart(HitTimer, 0.25, false, function TimerDestroy)
LastClicked = button_id
ClearDescription()
ShowDescriptionOfItem(EquipedItem[1])
}
elseif (LastClicked == button_id and Click and EquipedItem[1] != null and free_count >= 1) {
if EquipedItem[2] != null {
if free_count < 2 { return }
TempInt = GetItemTypeId(EquipedItem[2])
DestroyEffect(Attach[2])
if ItemType[GetItemCell(TempInt)] == 1 { EquipOffhandWeaponItem(Hero, EquipedItem[2], false) }
else { EquipShieldItem(Hero, EquipedItem[2], false) }
Buttons_Remove(EquipedSlot[2])
Buttons_SetAttachEx(EquipedSlot[2], 2, EmptySlot_Weapon)
Weight -= ItemWeight[GetItemCell(GetItemTypeId(EquipedItem[2]))]
GiveItem(EquipedItem[2])
EquipedItem[2] = null
}
DestroyEffect(Attach[1])
InitSound(EquipedItem[1], 1, false)
Buttons_Remove(button_id)
Buttons_SetAttachEx(EquipedSlot[1], 1, EmptySlot_Weapon)
EquipWeaponItem(Hero, EquipedItem[1], false)
Weight -= ItemWeight[GetItemCell(GetItemTypeId(EquipedItem[1]))]
GiveItem(EquipedItem[1])
EquipedItem[1] = null
RefreshPage(true)
}
}
}
// левая рука
elseif (button_id == EquipedSlot[2] and EquipedItem[1] != null and not UseMode) {
StartSound(GUI_ClickSound)
TempInt = GetItemTypeId(CurrentSelectedItem)
if (IsWeaponTwohanded(EquipedItem[1]) or IsWeaponTwohanded(EquipedItem[2])) { return }
elseif (EquipedItem[2] == null and SelectionMode and (ItemType[GetItemCell(TempInt)] == 1 or ItemType[GetItemCell(TempInt)] == 4)) {
temp_int = Button[CurrentSelectedItemButton]
Buttons_Remove(EquipedSlot[2])
EquipedItem[2] = CurrentSelectedItem
Buttons_SetAttachEx(EquipedSlot[2], 2, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[2]))])
if ItemType[GetItemCell(TempInt)] == 1 { EquipOffhandWeaponItem(Hero, EquipedItem[2], true); InitSound(EquipedItem[2], 1, true); Attach[2] = AddSpecialEffectTarget(WeaponAttachModel[GetWeaponCell(GetItemTypeId(EquipedItem[2]))], HeroModel, "hand left") }
else { EquipShieldItem(Hero, EquipedItem[2], true); InitSound(EquipedItem[2], 4, true); Attach[2] = AddSpecialEffectTarget(ShieldAttachModel[GetShieldCell(GetItemTypeId(EquipedItem[2]))], HeroModel, "weapon") }
SelectionMode = false; UseMode = false
SlotItem[CurrentCategory][temp_int] = null
RemoveDestructable(Button_Selection[LastTracked])
ClearDescription()
RefreshPage(true)
}
else {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not Click {
if not IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
RemoveDestructable(Button_Selection[LastClicked])
}
if not (GetDestructableLife(Button_Selection[button_id]) > 0.45) {
Buttons_AddSelectionEffect(button_id, 5)
}
Click = true
TimerStart(HitTimer, 0.25, false, function TimerDestroy)
LastClicked = button_id
ClearDescription()
ShowDescriptionOfItem(EquipedItem[2])
}
elseif (LastClicked == button_id and Click and EquipedItem[2] != null and CountFreeSlots(1) >= 1) {
DestroyEffect(Attach[2])
Buttons_Remove(button_id)
Buttons_SetAttachEx(EquipedSlot[2], 1, EmptySlot_Weapon)
if ItemType[GetItemCell(TempInt)] == 1 { EquipOffhandWeaponItem(Hero, EquipedItem[2], false); InitSound(EquipedItem[2], 1, false) }
else { EquipShieldItem(Hero, EquipedItem[2], false); InitSound(EquipedItem[2], 4, false) }
Weight -= ItemWeight[GetItemCell(GetItemTypeId(EquipedItem[2]))]
GiveItem(EquipedItem[2])
EquipedItem[2] = null
RefreshPage(true)
}
}
}
// шлем
elseif (button_id == EquipedSlot[3] and not UseMode) {
StartSound(GUI_ClickSound)
if (EquipedItem[3] == null and SelectionMode and ItemType[GetItemCell(GetItemTypeId(CurrentSelectedItem))] == 2 and ArmorPoint[GetArmorCell(GetItemTypeId(CurrentSelectedItem))] == HEAD) {
temp_int = Button[CurrentSelectedItemButton]
Buttons_Remove(EquipedSlot[3])
EquipedItem[3] = CurrentSelectedItem
Attach[3] = AddSpecialEffectTarget(ArmorAttachModel[GetArmorCell(GetItemTypeId(EquipedItem[3]))], HeroModel, "head")
Buttons_SetAttachEx(EquipedSlot[3], 3, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[3]))])
EquipArmorItem(Hero, EquipedItem[3], true)
SelectionMode = false; UseMode = false
SlotItem[CurrentCategory][temp_int] = null
RemoveDestructable(Button_Selection[LastTracked])
ClearDescription()
RefreshPage(true)
InitSound(null, 5, true)
}
else {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not Click {
if not IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
RemoveDestructable(Button_Selection[LastClicked])
}
if not (GetDestructableLife(Button_Selection[button_id]) > 0.45) {
Buttons_AddSelectionEffect(button_id, 5)
}
Click = true
TimerStart(HitTimer, 0.25, false, function TimerDestroy)
LastClicked = button_id
ClearDescription()
ShowDescriptionOfItem(EquipedItem[3])
}
elseif (LastClicked == button_id and Click and EquipedItem[3] != null and CountFreeSlots(1) >= 1) {
DestroyEffect(Attach[3])
InitSound(null, 5, false)
Buttons_Remove(button_id)
Buttons_SetAttachEx(EquipedSlot[3], 3, EmptySlot_Head)
EquipArmorItem(Hero, EquipedItem[3], false)
Weight -= ItemWeight[GetItemCell(GetItemTypeId(EquipedItem[3]))]
GiveItem(EquipedItem[3])
EquipedItem[3] = null
RefreshPage(true)
}
}
}
// ожерелье
elseif (button_id == EquipedSlot[4] and not UseMode) {
StartSound(GUI_ClickSound)
if (EquipedItem[4] == null and SelectionMode and ItemType[GetItemCell(GetItemTypeId(CurrentSelectedItem))] == 3 and JewelryPoint[GetJewelryCell(GetItemTypeId(CurrentSelectedItem))] == 2) {
temp_int = Button[CurrentSelectedItemButton]
Buttons_Remove(EquipedSlot[4])
EquipedItem[4] = CurrentSelectedItem
Buttons_SetAttachEx(EquipedSlot[4], 4, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[4]))])
EquipJewelryItem(Hero, EquipedItem[4], true)
SelectionMode = false; UseMode = false
SlotItem[CurrentCategory][temp_int] = null
RemoveDestructable(Button_Selection[LastTracked])
ClearDescription()
RefreshPage(true)
InitSound(EquipedItem[4], 3, true)
}
else {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not Click {
if not IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
RemoveDestructable(Button_Selection[LastClicked])
}
if not (GetDestructableLife(Button_Selection[button_id]) > 0.45) {
Buttons_AddSelectionEffect(button_id, 5)
}
Click = true
TimerStart(HitTimer, 0.25, false, function TimerDestroy)
LastClicked = button_id
ClearDescription()
ShowDescriptionOfItem(EquipedItem[4])
}
elseif (LastClicked == button_id and Click and EquipedItem[4] != null and CountFreeSlots(2) >= 1) {
InitSound(EquipedItem[4], 3, false)
Buttons_Remove(button_id)
Buttons_SetAttachEx(EquipedSlot[4], 4, EmptySlot_Necklace)
EquipJewelryItem(Hero, EquipedItem[4], false)
Weight -= ItemWeight[GetItemCell(GetItemTypeId(EquipedItem[4]))]
GiveItem(EquipedItem[4])
EquipedItem[4] = null
RefreshPage(true)
}
}
}
// грудь
elseif (button_id == EquipedSlot[5] and not UseMode) {
StartSound(GUI_ClickSound)
if (EquipedItem[5] == null and SelectionMode and ItemType[GetItemCell(GetItemTypeId(CurrentSelectedItem))] == 2 and ArmorPoint[GetArmorCell(GetItemTypeId(CurrentSelectedItem))] == CHEST) {
temp_int = Button[CurrentSelectedItemButton]
Buttons_Remove(EquipedSlot[5])
EquipedItem[5] = CurrentSelectedItem
SetTexture(HeroModel, ArmorTexture[GetArmorCell(GetItemTypeId(EquipedItem[5]))])
Buttons_SetAttachEx(EquipedSlot[5], 5, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[5]))])
EquipArmorItem(Hero, EquipedItem[5], true)
SelectionMode = false; UseMode = false
SlotItem[CurrentCategory][temp_int] = null
RemoveDestructable(Button_Selection[LastTracked])
ClearDescription()
RefreshPage(true)
InitSound(EquipedItem[5], 2, true)
}
else {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not Click {
if not IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
RemoveDestructable(Button_Selection[LastClicked])
}
if not (GetDestructableLife(Button_Selection[button_id]) > 0.45) {
Buttons_AddSelectionEffect(button_id, 5)
}
Click = true
TimerStart(HitTimer, 0.25, false, function TimerDestroy)
LastClicked = button_id
ClearDescription()
ShowDescriptionOfItem(EquipedItem[5])
}
elseif (LastClicked == button_id and Click and EquipedItem[5] != null and CountFreeSlots(1) >= 1) {
SetTexture(HeroModel, STANDART_TEXTURE)
InitSound(EquipedItem[5], 2, false)
Buttons_Remove(button_id)
Buttons_SetAttachEx(EquipedSlot[5], 5, EmptySlot_Chest)
EquipArmorItem(Hero, EquipedItem[5], false)
Weight -= ItemWeight[GetItemCell(GetItemTypeId(EquipedItem[5]))]
GiveItem(EquipedItem[5])
EquipedItem[5] = null
RefreshPage(true)
}
}
}
// плечи
elseif (button_id == EquipedSlot[6] and not UseMode) {
StartSound(GUI_ClickSound)
if (EquipedItem[6] == null and SelectionMode and ItemType[GetItemCell(GetItemTypeId(CurrentSelectedItem))] == 2 and ArmorPoint[GetArmorCell(GetItemTypeId(CurrentSelectedItem))] == SHOULDERS) {
temp_int = Button[CurrentSelectedItemButton]
Buttons_Remove(EquipedSlot[6])
EquipedItem[6] = CurrentSelectedItem
Attach[4] = AddSpecialEffectTarget(ArmorAttachModel[GetArmorCell(GetItemTypeId(EquipedItem[6]))], HeroModel, "chest")
Buttons_SetAttachEx(EquipedSlot[6], 6, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[6]))])
EquipArmorItem(Hero, EquipedItem[6], true)
SelectionMode = false; UseMode = false
SlotItem[CurrentCategory][temp_int] = null
RemoveDestructable(Button_Selection[LastTracked])
ClearDescription()
RefreshPage(true)
InitSound(EquipedItem[6], 2, true)
}
else {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not Click {
if not IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
RemoveDestructable(Button_Selection[LastClicked])
}
if not (GetDestructableLife(Button_Selection[button_id]) > 0.45) {
Buttons_AddSelectionEffect(button_id, 5)
}
Click = true
TimerStart(HitTimer, 0.25, false, function TimerDestroy)
LastClicked = button_id
ClearDescription()
ShowDescriptionOfItem(EquipedItem[6])
}
elseif (LastClicked == button_id and Click and EquipedItem[6] != null and CountFreeSlots(1) >= 1) {
DestroyEffect(Attach[4])
InitSound(EquipedItem[6], 2, false)
Buttons_Remove(button_id)
Buttons_SetAttachEx(EquipedSlot[6], 6, EmptySlot_Shoulders)
EquipArmorItem(Hero, EquipedItem[6], false)
Weight -= ItemWeight[GetItemCell(GetItemTypeId(EquipedItem[6]))]
GiveItem(EquipedItem[6])
EquipedItem[6] = null
RefreshPage(true)
}
}
}
// ноги
elseif (button_id == EquipedSlot[7] and not UseMode) {
StartSound(GUI_ClickSound)
if (EquipedItem[7] == null and SelectionMode and ItemType[GetItemCell(GetItemTypeId(CurrentSelectedItem))] == 2 and ArmorPoint[GetArmorCell(GetItemTypeId(CurrentSelectedItem))] == LEGS) {
temp_int = Button[CurrentSelectedItemButton]
Buttons_Remove(EquipedSlot[7])
EquipedItem[7] = CurrentSelectedItem
Buttons_SetAttachEx(EquipedSlot[7], 7, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[7]))])
EquipArmorItem(Hero, EquipedItem[7], true)
SelectionMode = false; UseMode = false
SlotItem[CurrentCategory][temp_int] = null
RemoveDestructable(Button_Selection[LastTracked])
ClearDescription()
RefreshPage(true)
InitSound(EquipedItem[7], 2, true)
}
else {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not Click {
if not IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
RemoveDestructable(Button_Selection[LastClicked])
}
if not (GetDestructableLife(Button_Selection[button_id]) > 0.45) {
Buttons_AddSelectionEffect(button_id, 5)
}
Click = true
TimerStart(HitTimer, 0.25, false, function TimerDestroy)
LastClicked = button_id
ClearDescription()
ShowDescriptionOfItem(EquipedItem[7])
}
elseif (LastClicked == button_id and Click and EquipedItem[7] != null and CountFreeSlots(1) >= 1) {
InitSound(EquipedItem[7], 2, false)
Buttons_Remove(button_id)
Buttons_SetAttachEx(EquipedSlot[7], 7, EmptySlot_Legs)
EquipArmorItem(Hero, EquipedItem[7], false)
Weight -= ItemWeight[GetItemCell(GetItemTypeId(EquipedItem[7]))]
GiveItem(EquipedItem[7])
EquipedItem[7] = null
RefreshPage(true)
}
}
}
// перчатки
elseif (button_id == EquipedSlot[8] and not UseMode) {
StartSound(GUI_ClickSound)
if (EquipedItem[8] == null and SelectionMode and ItemType[GetItemCell(GetItemTypeId(CurrentSelectedItem))] == 2 and ArmorPoint[GetArmorCell(GetItemTypeId(CurrentSelectedItem))] == HANDS) {
temp_int = Button[CurrentSelectedItemButton]
Buttons_Remove(EquipedSlot[8])
EquipedItem[8] = CurrentSelectedItem
Buttons_SetAttachEx(EquipedSlot[8], 8, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[8]))])
EquipArmorItem(Hero, EquipedItem[8], true)
SelectionMode = false; UseMode = false
SlotItem[CurrentCategory][temp_int] = null
RemoveDestructable(Button_Selection[LastTracked])
ClearDescription()
RefreshPage(true)
InitSound(EquipedItem[8], 2, true)
}
else {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not Click {
if not IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
RemoveDestructable(Button_Selection[LastClicked])
}
if not (GetDestructableLife(Button_Selection[button_id]) > 0.45) {
Buttons_AddSelectionEffect(button_id, 5)
}
Click = true
TimerStart(HitTimer, 0.25, false, function TimerDestroy)
LastClicked = button_id
ClearDescription()
ShowDescriptionOfItem(EquipedItem[8])
}
elseif (LastClicked == button_id and Click and EquipedItem[8] != null and CountFreeSlots(1) >= 1) {
InitSound(EquipedItem[8], 2, false)
Buttons_Remove(button_id)
Buttons_SetAttachEx(EquipedSlot[8], 8, EmptySlot_Hands)
EquipArmorItem(Hero, EquipedItem[8], false)
Weight -= ItemWeight[GetItemCell(GetItemTypeId(EquipedItem[8]))]
GiveItem(EquipedItem[8])
EquipedItem[8] = null
RefreshPage(true)
}
}
}
// кольцо 1
elseif (button_id == EquipedSlot[9] and not UseMode) {
StartSound(GUI_ClickSound)
if (EquipedItem[9] == null and SelectionMode and ItemType[GetItemCell(GetItemTypeId(CurrentSelectedItem))] == 3 and JewelryPoint[GetJewelryCell(GetItemTypeId(CurrentSelectedItem))] == 1) {
temp_int = Button[CurrentSelectedItemButton]
Buttons_Remove(EquipedSlot[9])
EquipedItem[9] = CurrentSelectedItem
Buttons_SetAttachEx(EquipedSlot[9], 9, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[9]))])
EquipJewelryItem(Hero, EquipedItem[9], true)
SelectionMode = false; UseMode = false
SlotItem[CurrentCategory][temp_int] = null
RemoveDestructable(Button_Selection[LastTracked])
ClearDescription()
RefreshPage(true)
InitSound(EquipedItem[9], 3, true)
}
else {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not Click {
if not IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
RemoveDestructable(Button_Selection[LastClicked])
}
if not (GetDestructableLife(Button_Selection[button_id]) > 0.45) {
Buttons_AddSelectionEffect(button_id, 5)
}
Click = true
TimerStart(HitTimer, 0.25, false, function TimerDestroy)
LastClicked = button_id
ClearDescription()
ShowDescriptionOfItem(EquipedItem[9])
}
elseif (LastClicked == button_id and Click and EquipedItem[9] != null and CountFreeSlots(2) >= 1) {
InitSound(EquipedItem[9], 3, false)
Buttons_Remove(button_id)
Buttons_SetAttachEx(EquipedSlot[9], 9, EmptySlot_Ring)
EquipJewelryItem(Hero, EquipedItem[9], false)
Weight -= ItemWeight[GetItemCell(GetItemTypeId(EquipedItem[9]))]
GiveItem(EquipedItem[9])
EquipedItem[9] = null
RefreshPage(true)
}
}
}
// кольцо 2
elseif (button_id == EquipedSlot[10] and not UseMode) {
StartSound(GUI_ClickSound)
if (EquipedItem[10] == null and SelectionMode and ItemType[GetItemCell(GetItemTypeId(CurrentSelectedItem))] == 3 and JewelryPoint[GetJewelryCell(GetItemTypeId(CurrentSelectedItem))] == 1) {
temp_int = Button[CurrentSelectedItemButton]
Buttons_Remove(EquipedSlot[10])
EquipedItem[10] = CurrentSelectedItem
Buttons_SetAttachEx(EquipedSlot[10], 10, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[10]))])
EquipJewelryItem(Hero, EquipedItem[10], true)
SelectionMode = false; UseMode = false
SlotItem[CurrentCategory][temp_int] = null
RemoveDestructable(Button_Selection[LastTracked])
ClearDescription()
RefreshPage(true)
InitSound(EquipedItem[10], 3, true)
}
else {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if not Click {
if not IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
RemoveDestructable(Button_Selection[LastClicked])
}
if not (GetDestructableLife(Button_Selection[button_id]) > 0.45) {
Buttons_AddSelectionEffect(button_id, 5)
}
Click = true
TimerStart(HitTimer, 0.25, false, function TimerDestroy)
LastClicked = button_id
ClearDescription()
ShowDescriptionOfItem(EquipedItem[10])
}
elseif (LastClicked == button_id and Click and EquipedItem[10] != null and CountFreeSlots(2) >= 1) {
InitSound(EquipedItem[10], 3, false)
Buttons_Remove(button_id)
Buttons_SetAttachEx(EquipedSlot[10], 10, EmptySlot_Ring)
EquipJewelryItem(Hero, EquipedItem[10], false)
Weight -= ItemWeight[GetItemCell(GetItemTypeId(EquipedItem[10]))]
GiveItem(EquipedItem[10])
EquipedItem[10] = null
RefreshPage(true)
}
}
}
// регистрация на панели
elseif button_id == RegisterItemButton {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
if GetItemType(SlotItem[CurrentCategory][Button[LastClicked]]) == ITEM_TYPE_CHARGED {
StartSound(GUI_ClickSound)
if GetItemLevel(SlotItem[CurrentCategory][Button[LastClicked]]) == 1 {
if not IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
if UnitInventoryCount(Hero) < 6 {
RemoveDestructable(Button_Selection[LastClicked])
Buttons_AddSelectionEffect(LastClicked, 2)
SetItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]], true)
UnitAddItem(Hero, SlotItem[CurrentCategory][Button[LastClicked]])
}
else { SimError("Fast panel limit reached") }
}
else {
RemoveDestructable(Button_Selection[LastClicked])
Buttons_AddSelectionEffect(LastClicked, 5)
SetItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]], false)
UnitRemoveItem(Hero, SlotItem[CurrentCategory][Button[LastClicked]])
SetItemVisible(SlotItem[CurrentCategory][Button[LastClicked]], false)
}
}
elseif GetItemLevel(SlotItem[CurrentCategory][Button[LastClicked]]) == 2 {
CurrentSelectedItemButton = LastClicked
CurrentSelectedItem = SlotItem[CurrentCategory][Button[LastClicked]]
UseMode = true
SelectionMode = true
}
}
}
// выкинуть предмет
elseif button_id == DropItemButton {
// с зарядами
if (GetItemType(SlotItem[CurrentCategory][Button[LastClicked]]) == ITEM_TYPE_CHARGED and GetItemCharges(SlotItem[CurrentCategory][Button[LastClicked]]) > 1) {
UseMode = false
// выкинуть, подсчитать сколько
if DropFlag {
DropFlag = false
Sliders_Show(DropSlider)
DestroyTextTag(Slider_Text[DropSlider])
WeightChange(ItemWeight[GetItemCell(GetItemTypeId(SlotItem[CurrentCategory][Button[LastClicked]]))] * R2I(Slider_Value[DropSlider][3]), false)
// выкинуть все заряды
if R2I(Slider_Value[DropSlider][3]) == GetItemCharges(SlotItem[CurrentCategory][Button[LastClicked]]) {
if IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
SetItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]], false)
UnitRemoveItem(Hero, SlotItem[CurrentCategory][Button[LastClicked]])
}
if GetDestructableLife(Button_Selection[LastClicked]) > 0.45 {
RemoveDestructable(Button_Selection[LastClicked])
}
SetItemVisible(SlotItem[CurrentCategory][Button[LastClicked]], true)
SetItemPosition(SlotItem[CurrentCategory][Button[LastClicked]], Gx(Hero) + Rx(RndR(0., 50.), RndAng), Gy(Hero) + Ry(RndR(0., 50.), RndAng))
SlotItem[CurrentCategory][Button[LastClicked]] = null
RefreshPage(true)
}
// разделяем
else {
bj_lastCreatedItem = CreateItem(GetItemTypeId(SlotItem[CurrentCategory][Button[LastClicked]]), Gx(Hero) + Rx(RndR(0., 50.), RndAng), Gy(Hero)+ Ry(RndR(0., 50.), RndAng))
SetItemCharges(bj_lastCreatedItem, R2I(Slider_Value[DropSlider][3]))
SetItemCharges(SlotItem[CurrentCategory][Button[LastClicked]], GetItemCharges(SlotItem[CurrentCategory][Button[LastClicked]]) - R2I(Slider_Value[DropSlider][3]))
RefreshPage(true)
}
}
// собираемся выкинуть, считаем сколько
else {
DropFlag = true
Sliders_SetMinMaxCurrentValue(DropSlider, 1, GetItemCharges(SlotItem[CurrentCategory][Button[LastClicked]]), 1)
Sliders_Show(DropSlider)
DestroyTextTag(Slider_Text[DropSlider])
Slider_Text[DropSlider] = AddTextEx(I2S(R2I(Slider_Value[DropSlider][3])), Slider_StartCoords[DropSlider][2] - (Slider_Length[DropSlider] * 0.6), Slider_StartCoords[DropSlider][3] + 10., 8.5)
Slider_TextSize[DropSlider] = 7.6
}
}
// просто выкидываем
else {
if (button_id >= EquipedSlot[1] and button_id <= EquipedSlot[10]) { SimError("Нельзя выкинуть одетые предметы"); return }
if GetDestructableLife(Button_Selection[LastClicked]) > 0.45 {
RemoveDestructable(Button_Selection[LastClicked])
}
DropItem(SlotItem[CurrentCategory][Button[LastClicked]])
RefreshPage(true)
}
}
else {
while(index++ < 25){
if SlotButton[index] == button_id {
if DropFlag { Sliders_Show(DropSlider); DropFlag = false }
// первый клик
if not Click {
StartSound(GUI_ClickSound)
// перемещение в пустой слот
if (SelectionMode and not UseMode and SlotItem[CurrentCategory][index] == null) {
SlotItem[CurrentCategory][index] = CurrentSelectedItem
SlotItem[CurrentCategory][Button[CurrentSelectedItemButton]] = null
RemoveDestructable(Button_Selection[CurrentSelectedItemButton])
RemoveDestructable(Button_Selection[LastTracked])
SelectionMode = false
RefreshPage(true)
}
// вставка камней
elseif (SelectionMode and UseMode) {
if (SlotItem[CurrentCategory][index] != null and (GetItemLevel(CurrentSelectedItem) == 2 and GetItemType(CurrentSelectedItem) == ITEM_TYPE_CHARGED)) {
SocketGem(CurrentSelectedItem, SlotItem[CurrentCategory][index])
RemoveDestructable(Button_Selection[CurrentSelectedItemButton])
RemoveDestructable(Button_Selection[LastTracked])
SelectionMode = false; UseMode = false
ClearDescription()
ShowDescriptionOfItem(SlotItem[CurrentCategory][index])
}
}
// не перемещение, просто клик
else {
Click = true
if not IsItemInvulnerable(SlotItem[CurrentCategory][Button[LastClicked]]) {
RemoveDestructable(Button_Selection[LastClicked])
}
if not (GetDestructableLife(Button_Selection[button_id]) > 0.45) {
Buttons_AddSelectionEffect(button_id, 5)
}
TimerStart(HitTimer, 0.25, false, function TimerDestroy)
LastClicked = button_id
ClearDescription()
ShowDescriptionOfItem(SlotItem[CurrentCategory][Button[button_id]])
}
}
// двойной клик, не перемещение
elseif (LastClicked == button_id and Click and not SelectionMode) {
CurrentSelectedItemButton = button_id
CurrentSelectedItem = SlotItem[CurrentCategory][index]
SelectionMode = true; UseMode = false
}
}
}
}
}
private bool TrackableClickCond(){ return IsOpened }
void OpenInventory(){
int index = 0
if not IsOpened {
EnableTrigger(Selection)
SetTextTagVisibility(StatesText[1], true)
SetTextTagVisibility(StatesText[2], true)
SetTextTagVisibility(StatesText[3], true)
SetTextTagVisibility(StatesText[4], true)
SetTextTagVisibility(StatesText[5], true)
SetTextTagVisibility(StatesText[6], true)
SetTextTagVisibility(StatesText[7], true)
SetTextTagVisibility(StatesText[8], true)
TimerStart(ParametersUpdateTimer, 0.2, true, function UpdateParameters)
IsOpened = true
GUI_BuildInterface(HUMAN_UI)
// герой
GUI_CreatePanel(2, 10, 3, 5, HUMAN_UI)
ShowUnit(HeroModel, true)
GUI_AddBackground(2, 10); GUI_AddBackground(2, 9); GUI_AddBackground(2, 8); GUI_AddBackground(2, 7)
GUI_AddBackground(3, 10); GUI_AddBackground(3, 9); GUI_AddBackground(3, 8); GUI_AddBackground(3, 7)
GUI_AddBackground(4, 10); GUI_AddBackground(4, 9); GUI_AddBackground(4, 8); GUI_AddBackground(4, 7)
GUI_AddBackground(2, 6); GUI_AddBackground(3, 6); GUI_AddBackground(4, 6); //GUI_AddBackground(4, 7)
// левое
GUI_CreatePanel(0, 10, 1, 1, HUMAN_UI); GUI_AddBackground(0, 10)
GUI_CreatePanel(0, 8, 1, 1, HUMAN_UI); GUI_AddBackground(0, 8)
GUI_CreatePanel(0, 6, 1, 1, HUMAN_UI); GUI_AddBackground(0, 6)
// правое
GUI_CreatePanel(6, 10, 1, 1, HUMAN_UI); GUI_AddBackground(6, 10)
GUI_CreatePanel(6, 8, 1, 1, HUMAN_UI); GUI_AddBackground(6, 8)
GUI_CreatePanel(6, 6, 1, 1, HUMAN_UI); GUI_AddBackground(6, 6)
// нижнее
GUI_CreatePanel(0, 4, 1, 1, HUMAN_UI); GUI_AddBackground(0, 4)
GUI_CreatePanel(2, 4, 1, 1, HUMAN_UI); GUI_AddBackground(2, 4)
GUI_CreatePanel(4, 4, 1, 1, HUMAN_UI); GUI_AddBackground(4, 4)
GUI_CreatePanel(6, 4, 1, 1, HUMAN_UI); GUI_AddBackground(6, 4)
GUI_CreatePanel(0, 2, 7, 3, HUMAN_UI)
GUI_AddBackground(0, 0); GUI_AddBackground(0, 1); GUI_AddBackground(0, 2)
GUI_AddBackground(1, 0); GUI_AddBackground(1, 1); GUI_AddBackground(1, 2)
GUI_AddBackground(2, 0); GUI_AddBackground(2, 1); GUI_AddBackground(2, 2)
GUI_AddBackground(3, 0); GUI_AddBackground(3, 1); GUI_AddBackground(3, 2)
GUI_AddBackground(4, 0); GUI_AddBackground(4, 1); GUI_AddBackground(4, 2)
GUI_AddBackground(5, 0); GUI_AddBackground(5, 1); GUI_AddBackground(5, 2)
GUI_AddBackground(6, 0); GUI_AddBackground(6, 1); GUI_AddBackground(6, 2)
// слоты
GUI_CreatePanel(8, 8, 9, 9, HUMAN_UI)
GUI_AddBackground(8, 8)
GUI_AddBackground(8, 7)
GUI_AddBackground(8, 6)
GUI_AddBackground(8, 5)
GUI_AddBackground(8, 4)
GUI_AddBackground(8, 3)
GUI_AddBackground(8, 2)
GUI_AddBackground(8, 1)
GUI_AddBackground(8, 0)
GUI_AddBackground(9, 8)
GUI_AddBackground(9, 7)
GUI_AddBackground(9, 6)
GUI_AddBackground(9, 5)
GUI_AddBackground(9, 4)
GUI_AddBackground(9, 3)
GUI_AddBackground(9, 2)
GUI_AddBackground(9, 1)
GUI_AddBackground(9, 0)
GUI_AddBackground(10, 8)
GUI_AddBackground(10, 7)
GUI_AddBackground(10, 6)
GUI_AddBackground(10, 5)
GUI_AddBackground(10, 4)
GUI_AddBackground(10, 3)
GUI_AddBackground(10, 2)
GUI_AddBackground(10, 1)
GUI_AddBackground(10, 0)
GUI_AddBackground(11, 8)
GUI_AddBackground(11, 7)
GUI_AddBackground(11, 6)
GUI_AddBackground(11, 5)
GUI_AddBackground(11, 4)
GUI_AddBackground(11, 3)
GUI_AddBackground(11, 2)
GUI_AddBackground(11, 1)
GUI_AddBackground(11, 0)
GUI_AddBackground(12, 8)
GUI_AddBackground(12, 7)
GUI_AddBackground(12, 6)
GUI_AddBackground(12, 5)
GUI_AddBackground(12, 4)
GUI_AddBackground(12, 3)
GUI_AddBackground(12, 2)
GUI_AddBackground(12, 1)
GUI_AddBackground(12, 0)
GUI_AddBackground(13, 8)
GUI_AddBackground(13, 7)
GUI_AddBackground(13, 6)
GUI_AddBackground(13, 5)
GUI_AddBackground(13, 4)
GUI_AddBackground(13, 3)
GUI_AddBackground(13, 2)
GUI_AddBackground(13, 1)
GUI_AddBackground(13, 0)
GUI_AddBackground(14, 8)
GUI_AddBackground(14, 7)
GUI_AddBackground(14, 6)
GUI_AddBackground(14, 5)
GUI_AddBackground(14, 4)
GUI_AddBackground(14, 3)
GUI_AddBackground(14, 2)
GUI_AddBackground(14, 1)
GUI_AddBackground(14, 0)
GUI_AddBackground(15, 8)
GUI_AddBackground(15, 7)
GUI_AddBackground(15, 6)
GUI_AddBackground(15, 5)
GUI_AddBackground(15, 4)
GUI_AddBackground(15, 3)
GUI_AddBackground(15, 2)
GUI_AddBackground(15, 1)
GUI_AddBackground(15, 0)
GUI_AddBackground(16, 8)
GUI_AddBackground(16, 7)
GUI_AddBackground(16, 6)
GUI_AddBackground(16, 5)
GUI_AddBackground(16, 4)
GUI_AddBackground(16, 3)
GUI_AddBackground(16, 2)
GUI_AddBackground(16, 1)
GUI_AddBackground(16, 0)
GUI_CreatePanel(8, 10, 1, 1, HUMAN_UI); GUI_AddBackground(8, 10)
GUI_CreatePanel(10, 10, 1, 1, HUMAN_UI); GUI_AddBackground(10, 10)
GUI_CreatePanel(12, 10, 1, 1, HUMAN_UI); GUI_AddBackground(12, 10)
GUI_CreatePanel(14, 10, 1, 1, HUMAN_UI); GUI_AddBackground(14, 10)
GUI_CreatePanel(16, 10, 1, 1, HUMAN_UI); GUI_AddBackground(16, 10)
GUI_CreatePanel(18, 10, 5, 8, HUMAN_UI)
GUI_AddBackground(18, 10); GUI_AddBackground(19, 10)
GUI_AddBackground(18, 9); GUI_AddBackground(19, 9)
GUI_AddBackground(18, 8); GUI_AddBackground(19, 8)
GUI_AddBackground(18, 7); GUI_AddBackground(19, 7)
GUI_AddBackground(18, 6); GUI_AddBackground(19, 6)
GUI_AddBackground(18, 5); GUI_AddBackground(19, 5)
GUI_AddBackground(18, 4); GUI_AddBackground(19, 4)
GUI_AddBackground(20, 10); GUI_AddBackground(21, 10)
GUI_AddBackground(20, 9); GUI_AddBackground(21, 9)
GUI_AddBackground(20, 8); GUI_AddBackground(21, 8)
GUI_AddBackground(20, 7); GUI_AddBackground(21, 7)
GUI_AddBackground(20, 6); GUI_AddBackground(21, 6)
GUI_AddBackground(20, 5); GUI_AddBackground(21, 5)
GUI_AddBackground(20, 4); GUI_AddBackground(21, 4)
GUI_AddBackground(22, 10); GUI_AddBackground(22, 9)
GUI_AddBackground(22, 8); GUI_AddBackground(22, 7)
GUI_AddBackground(22, 6); GUI_AddBackground(22, 5)
GUI_AddBackground(22, 4)
GUI_AddBackground(18, 3); GUI_AddBackground(19, 3); GUI_AddBackground(20, 3)
GUI_AddBackground(21, 3); GUI_AddBackground(22, 3)
// ~~~
GUI_CreatePanel(18, 1, 5, 2, HUMAN_UI)
Sliders_Show(StatesSlider)
//GUI_CreatePanel(18, 0, 1, 1, HUMAN_UI)
GUI_AddBackground(18, 0)
GUI_AddBackground(19, 0)
GUI_AddBackground(20, 0)
GUI_AddBackground(21, 0)
GUI_AddBackground(22, 0)
GUI_AddBackground(18, 1)
GUI_AddBackground(19, 1)
GUI_AddBackground(20, 1)
GUI_AddBackground(21, 1)
GUI_AddBackground(22, 1)
//GUI_AddBackground(18, 2)
//GUI_AddBackground(19, 2)
//GUI_AddBackground(20, 2)
//GUI_AddBackground(21, 2)
GUI_CreatePanel(20, 0, 1, 1, HUMAN_UI)
GUI_AddBackground(20, 0)
GUI_CreatePanel(22, 0, 1, 1, HUMAN_UI)
GUI_AddBackground(22, 0)
// одеваемые слоты
if EquipedItem[1] == null { Buttons_SetAttachEx(EquipedSlot[1], 1, EmptySlot_Weapon) }
else {
Buttons_SetAttachEx(EquipedSlot[1], 1, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[1]))])
}
if EquipedItem[2] == null { Buttons_SetAttachEx(EquipedSlot[2], 2, EmptySlot_Weapon) }
else {
Buttons_SetAttachEx(EquipedSlot[2], 2, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[2]))])
}
if EquipedItem[3] == null { Buttons_SetAttachEx(EquipedSlot[3], 3, EmptySlot_Head) }
else {
Buttons_SetAttachEx(EquipedSlot[3], 3, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[3]))])
}
if EquipedItem[4] == null { Buttons_SetAttachEx(EquipedSlot[4], 4, EmptySlot_Necklace) }
else {
Buttons_SetAttachEx(EquipedSlot[4], 4, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[4]))])
}
if EquipedItem[5] == null { Buttons_SetAttachEx(EquipedSlot[5], 5, EmptySlot_Chest) }
else {
Buttons_SetAttachEx(EquipedSlot[5], 5, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[5]))])
}
if EquipedItem[6] == null { Buttons_SetAttachEx(EquipedSlot[6], 6, EmptySlot_Shoulders) }
else {
Buttons_SetAttachEx(EquipedSlot[6], 6, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[6]))])
}
if EquipedItem[7] == null { Buttons_SetAttachEx(EquipedSlot[7], 7, EmptySlot_Legs) }
else {
Buttons_SetAttachEx(EquipedSlot[7], 7, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[7]))])
}
if EquipedItem[8] == null { Buttons_SetAttachEx(EquipedSlot[8], 8, EmptySlot_Hands) }
else {
Buttons_SetAttachEx(EquipedSlot[8], 8, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[8]))])
}
if EquipedItem[9] == null { Buttons_SetAttachEx(EquipedSlot[9], 9, EmptySlot_Ring) }
else {
Buttons_SetAttachEx(EquipedSlot[9], 9, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[9]))])
}
if EquipedItem[10] == null { Buttons_SetAttachEx(EquipedSlot[10], 10, EmptySlot_Ring) }
else {
Buttons_SetAttachEx(EquipedSlot[10], 10, ItemIcon[GetItemCell(GetItemTypeId(EquipedItem[10]))])
}
SetTextTagVisibility(WeightText, true)
RefreshPage(false)
Buttons_SetAttachEx(Category[1], 1, WeaponsCategory)
Buttons_SetAttachEx(Category[2], 2, JewelryCategory)
Buttons_SetAttachEx(Category[3], 3, MagicCategory)
Buttons_SetAttachEx(Category[4], 4, PotionsCategory)
//Buttons_SetAssociate(Category[5], 5, MiscCategory)
Buttons_SetAttachEx(DropItemButton, 1, DropItemId)
Buttons_SetAttachEx(RegisterItemButton, 2, RegisterItemId)
Buttons_AddSelectionEffect(Category[CurrentCategory], 1)
}
}
private void TimedInit(){
UD hero = GetData(Hero)
int index = 0, limit = 0, x = 0, y = 0
HeroModel = CreateUnit(Pass, HeroModelId, (GUI_X(3)) + 12., (GUI_Y(6)) - 50., 270.)
ShowUnit(HeroModel, false)
StatesSlider = Sliders_AddByX_EX((GUI_X(0)) + 35., (GUI_Y(2)) + 22., 12, 0.6, 1)
Sliders_SetMinMaxCurrentValue(StatesSlider, 0, 4, 0)
Sliders_Show(StatesSlider)
DropSlider = Sliders_AddByX_EX((GUI_X(17)) + 56., (GUI_Y(1)) + 16., 10, 0.6, 1)
Sliders_Show(DropSlider)
// слоты оружия
EquipedSlot[1] = Buttons_Add(0, 4, gg_trg_Inventory)
EquipedSlot[2] = Buttons_Add(6, 4, gg_trg_Inventory)
TriggerRegisterTrackableTrackEvent(Selection, Button_Trackable[EquipedSlot[1]])
TriggerRegisterTrackableTrackEvent(Selection, Button_Trackable[EquipedSlot[2]])
// шлем и ожерелье
EquipedSlot[3] = Buttons_Add(0, 10, gg_trg_Inventory)
EquipedSlot[4] = Buttons_Add(6, 10, gg_trg_Inventory)
TriggerRegisterTrackableTrackEvent(Selection, Button_Trackable[EquipedSlot[3]])
TriggerRegisterTrackableTrackEvent(Selection, Button_Trackable[EquipedSlot[4]])
// грудь и плечи
EquipedSlot[5] = Buttons_Add(0, 8, gg_trg_Inventory)
EquipedSlot[6] = Buttons_Add(6, 8, gg_trg_Inventory)
TriggerRegisterTrackableTrackEvent(Selection, Button_Trackable[EquipedSlot[5]])
TriggerRegisterTrackableTrackEvent(Selection, Button_Trackable[EquipedSlot[6]])
// ноги и перчатки
EquipedSlot[7] = Buttons_Add(0, 6, gg_trg_Inventory)
EquipedSlot[8] = Buttons_Add(6, 6, gg_trg_Inventory)
TriggerRegisterTrackableTrackEvent(Selection, Button_Trackable[EquipedSlot[7]])
TriggerRegisterTrackableTrackEvent(Selection, Button_Trackable[EquipedSlot[8]])
// кольца
EquipedSlot[9] = Buttons_Add(2, 4, gg_trg_Inventory)
EquipedSlot[10] = Buttons_Add(4, 4, gg_trg_Inventory)
TriggerRegisterTrackableTrackEvent(Selection, Button_Trackable[EquipedSlot[9]])
TriggerRegisterTrackableTrackEvent(Selection, Button_Trackable[EquipedSlot[10]])
Category[1] = Buttons_Add(8, 10, gg_trg_Inventory)
Category[2] = Buttons_Add(10, 10, gg_trg_Inventory)
Category[3] = Buttons_Add(12, 10, gg_trg_Inventory)
Category[4] = Buttons_Add(14, 10, gg_trg_Inventory)
DropItemButton = Buttons_Add(22, 0, gg_trg_Inventory)
RegisterItemButton = Buttons_Add(20, 0, gg_trg_Inventory)
while(index++ < 25){
SlotButton[index] = Buttons_Add((8 + x), (8 - y), gg_trg_Inventory)
Border[index] = CreateDestructable(BorderId, GUI_X((8 + x)) , GUI_Y((8 - y)), 0., 1.1, 0)
ChargeBorder[index] = CreateDestructable(ChargesId, (GUI_X((8 + x))) + 32., (GUI_Y((8 - y))) - 32., 0., 1.15, 0)
ChargeText[index] = CreateTextTag()
SetTextTagPos(ChargeText[index], (GUI_X((8 + x))) + 30., (GUI_Y((8 - y))) - 42., 40.)
SetTextTagColor(ChargeText[index], 255, 255, 255, 0)
ShowDestructable(Border[index], false)
ShowDestructable(ChargeBorder[index], false)
TriggerRegisterTrackableTrackEvent(Selection, Button_Trackable[SlotButton[index]])
limit++
x += 2
if limit == 5 { limit = 0; x = 0; y += 2 }
}
StatesText[1] = CreateTextTag()
SetTextTagPos(StatesText[1], (GUI_X(0)) - 42., GUI_Y(1), 10.)
SetTextTagColor(StatesText[1], 255, 255, 255, 0)
StatesText[2] = CreateTextTag()
SetTextTagPos(StatesText[2], (GUI_X(0)) - 42., (GUI_Y(1)) - 26., 10.)
SetTextTagColor(StatesText[2], 255, 255, 255, 0)
StatesText[3] = CreateTextTag()
SetTextTagPos(StatesText[3], (GUI_X(0)) - 42., (GUI_Y(1)) - (26. * 2.), 10.)
SetTextTagColor(StatesText[3], 255, 255, 255, 0)
StatesText[4] = CreateTextTag()
SetTextTagPos(StatesText[4], (GUI_X(0)) - 42., (GUI_Y(1)) - (26. * 3.), 10.)
SetTextTagColor(StatesText[4], 255, 255, 255, 0)
StatesText[5] = CreateTextTag()
SetTextTagPos(StatesText[5], (GUI_X(4)) - 28., GUI_Y(1), 10.)
SetTextTagColor(StatesText[5], 255, 255, 255, 0)
StatesText[6] = CreateTextTag()
SetTextTagPos(StatesText[6], (GUI_X(4)) - 28., (GUI_Y(1)) - 26., 10.)
SetTextTagColor(StatesText[6], 255, 255, 255, 0)
StatesText[7] = CreateTextTag()
SetTextTagPos(StatesText[7], (GUI_X(4)) - 28., (GUI_Y(1)) - (26. * 2.), 10.)
SetTextTagColor(StatesText[7], 255, 255, 255, 0)
StatesText[8] = CreateTextTag()
SetTextTagPos(StatesText[8], (GUI_X(4)) - 28., (GUI_Y(1)) - (26. * 3.), 10.)
SetTextTagColor(StatesText[8], 255, 255, 255, 0)
//Category[5] = Buttons_Add(16, 10, gg_trg_Inventory)
MaxWeight = (hero.STR + 21.) * GetBonus_STR(hero.STR)
Weight = 0.
WeightText = AddTextEx("Weight: "+"|c0000FF00"+I2S(R2I(Weight))+"|r"+"/"+I2S(R2I(MaxWeight))+" кг.", (GUI_X(4)), (GUI_Y(0)) - 40., 8.)
SetTextTagVisibility(WeightText, false)
DT(GetExpiredTimer())
}
private void Selection_Act(){
if SelectionMode {
if LastTracked != CurrentSelectedItemButton {
RemoveDestructable(Button_Selection[LastTracked])
}
LastTracked = Buttons_GetByTrackable(GetTriggeringTrackable())
if not (GetDestructableLife(Button_Selection[LastTracked]) > 0.45) {
Buttons_AddSelectionEffect(LastTracked, 4)
}
}
}
private void Esc_Act(){
if SelectionMode {
SelectionMode = false
UseMode = false
RemoveDestructable(Button_Selection[LastTracked])
}
elseif DropFlag {
DropFlag = false
Sliders_Show(DropSlider)
}
}
private void Init(){
int c = 0
gg_trg_Inventory = CreateTrigger()
TriggerAddCondition(gg_trg_Inventory, Condition(function TrackableClickCond))
TriggerAddAction(gg_trg_Inventory, function TrackableClickAct)
TriggerRegisterPlayerEvent(Esc, Player(0), EVENT_PLAYER_END_CINEMATIC)
TriggerAddAction(Esc, function Esc_Act)
TriggerAddAction(Selection, function Selection_Act)
TimerStart(CT, 0.13, false, function TimedInit)
while(c++ < 10){ EquipedItem[c] = null }
}
endlibrary