Сейчас 15:17:24 Вторник, 7 мая, 2024 год
[ x ] Главная ⇒ Форум ⇐ RSS Файлы Cтатьи Картинки В о й т и   или   з а р е г и с т р и р о в а т ь с я


[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Модератор форума: PUVer, SirNikolas, Ty3uK  
Форум о Warcraft 3 » Раздел для картостроителей » GUI / Jass » [DUOS] Item Functions Library v0.98a
[DUOS] Item Functions Library v0.98a
[DUОS]Дата: Вторник, 08 Июня 2010, 15:34:15 | Сообщение # 1
Группа: Заблокированные
Сообщений: 6279
Награды: 9
Репутация: 1708
Блокировки:
Code
function ItemInUnitSlot takes integer i, unit u returns integer
     local integer id = GetItemTypeId(UnitItemInSlot(u,i))
     if id == GetItemTypeId(UnitItemInSlot(u,0)) then  
         return 1
     elseif id == GetItemTypeId(UnitItemInSlot(u,1)) then
         return 2
     elseif id == GetItemTypeId(UnitItemInSlot(u,2)) then
         return 3
     elseif id == GetItemTypeId(UnitItemInSlot(u,3)) then
         return 4
     elseif id == GetItemTypeId(UnitItemInSlot(u,4)) then
         return 5
     elseif id == GetItemTypeId(UnitItemInSlot(u,5)) then
         return 6
     endif
     return 0
endfunction

function IsUnitItemSlotFilled takes unit hero, integer slot returns boolean
     if UnitItemInSlot(hero,slot) != null then
         return true
     else
         return false   
     endif   
endfunction

function IsUnitItemSlotEmpty takes unit hero, integer slot returns boolean
     return IsUnitItemSlotFilled(hero,slot) == false    
endfunction

function UnitGetItemSlotsRemaining takes unit hero returns integer
     local integer i = 0
     local integer count = 0
     loop
         exitwhen i > 6
         if UnitItemInSlot(hero,i) == null then
             set count = count + 1
         endif
         set i = i + 1
     endloop
     return count     
endfunction

function GetItemSlotsFilled takes unit hero returns integer
     local integer i = 0
     local integer count = 0
     loop
         exitwhen i > 6
         if UnitItemInSlot(hero,i) != null then
             set count = count + 1
         endif
         set i = i + 1
     endloop
     return count     
endfunction

function GetItemTypeCountUnit takes integer itemID, unit hero returns integer
     local integer i = 0
     local integer count = 0
     loop
         exitwhen i > 6
         if GetItemTypeId(UnitItemInSlot(hero,i)) == itemID then
             set count = count + 1
         endif
         set i = i + 1
     endloop
     return count
endfunction

function CombineSameItemTypeItems takes unit hero, integer howMany, integer itemID, integer targetItemID returns nothing
     local integer i = 0
     local integer count = GetItemTypeCountUnit(itemID,hero)
     if count != howMany then
         // If items needed aren't enough for the combination,
         // forget about it.
         return
     else
         // Combine items.
         loop
             exitwhen i > 6
             if GetItemTypeId(UnitItemInSlot(hero,i)) == itemID then
                 call RemoveItem(UnitItemInSlot(hero,i))
             endif
             set i = i + 1
         endloop
         call UnitAddItem(hero,CreateItem(targetItemID,GetUnitX(hero),GetUnitY(hero)))
     endif     
endfunction

function Recipe2 takes unit hero, integer item1ID, integer item2ID, integer targetItemID returns nothing
     if item1ID == item2ID then
         call CombineSameItemTypeItems(hero,2,item1ID,targetItemID)
     else
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item1ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item2ID,hero) - 1))
         call UnitAddItem(hero,CreateItem(targetItemID,GetUnitX(hero),GetUnitY(hero)))
     endif     
endfunction

function Recipe3 takes unit hero, integer item1ID, integer item2ID, integer item3ID, integer targetItemID returns nothing
     if item1ID == item2ID == item3ID then
         call CombineSameItemTypeItems(hero,3,item1ID,targetItemID)
     else
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item1ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item2ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item3ID,hero) - 1))
         call UnitAddItem(hero,CreateItem(targetItemID,GetUnitX(hero),GetUnitY(hero)))
     endif     
endfunction

function Recipe4 takes unit hero, integer item1ID, integer item2ID, integer item3ID, integer item4ID, integer targetItemID returns nothing
     if item1ID == item2ID == item3ID == item4ID then
         call CombineSameItemTypeItems(hero,4,item1ID,targetItemID)
     else
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item1ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item2ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item3ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item4ID,hero) - 1))
         call UnitAddItem(hero,CreateItem(targetItemID,GetUnitX(hero),GetUnitY(hero)))
     endif     
endfunction

function Recipe5 takes unit hero, integer item1ID, integer item2ID, integer item3ID, integer item4ID, integer item5ID, integer targetItemID returns nothing
     if item1ID == item2ID == item3ID == item4ID == item5ID then
         call CombineSameItemTypeItems(hero,5,item1ID,targetItemID)
     else
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item1ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item2ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item3ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item4ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item5ID,hero) - 1))
         call UnitAddItem(hero,CreateItem(targetItemID,GetUnitX(hero),GetUnitY(hero)))
     endif     
endfunction

function Recipe6 takes unit hero, integer item1ID, integer item2ID, integer item3ID, integer item4ID, integer item5ID, integer item6ID, integer targetItemID returns nothing
     if item1ID == item2ID == item3ID == item4ID == item5ID == item6ID then
         call CombineSameItemTypeItems(hero,5,item1ID,targetItemID)
     else
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item1ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item2ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item3ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item4ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item5ID,hero) - 1))
         call RemoveItem(UnitItemInSlot(hero,ItemInUnitSlot(item6ID,hero) - 1))
         call UnitAddItem(hero,CreateItem(targetItemID,GetUnitX(hero),GetUnitY(hero)))
     endif     
endfunction

Библиотека Jass-функций для работы с предметами и их скрещиванием. Умеет делать следующее:

- Подсчёт предметов одного типа у героя.
- Скрещивание n одинаковых предметов у героя.
- Скрещивание предметов разных типов в определённый.
- Определение, заполнен или свободен слот.

Оцениваем, критикуем, комментим.


НУ И ЧТО ТЕПЕРЬ?


Кликайте на дракошку ;)
 

MaSerДата: Вторник, 08 Июня 2010, 16:02:17 | Сообщение # 2
Котобог
Группа: Стримеры
Сообщений: 3574
Награды: 13
Блокировки:
Посмотрел первую функцию, разочаровался и вышел из темы.

 

[DUОS]Дата: Вторник, 08 Июня 2010, 16:02:46 | Сообщение # 3
Группа: Заблокированные
Сообщений: 6279
Награды: 9
Репутация: 1708
Блокировки:
MaSer,
Кривая?


НУ И ЧТО ТЕПЕРЬ?


Кликайте на дракошку ;)
 

EnforcerДата: Вторник, 08 Июня 2010, 16:32:14 | Сообщение # 4
Энф
Когда-то смотрел за порядком
Группа: Ветераны
Сообщений: 3127
Награды: 7
Репутация: 981
Блокировки:
К счастью мне уже не надо :)
Я свою сделал наработку.


 

[DUОS]Дата: Вторник, 08 Июня 2010, 16:34:17 | Сообщение # 5
Группа: Заблокированные
Сообщений: 6279
Награды: 9
Репутация: 1708
Блокировки:
Enforcer,
Видал на РМ. Видал)


НУ И ЧТО ТЕПЕРЬ?


Кликайте на дракошку ;)
 

windrunnerДата: Вторник, 08 Июня 2010, 16:46:43 | Сообщение # 6
10 уровень
Группа: Проверенные
Сообщений: 1259
Награды: 0
Репутация: 218
Блокировки:
мб вместо того,чтобы ядро оада выкладывать по отдельности мб открытый оад выложишь?=)

Добавлено (08-06-2010, 16:44)
---------------------------------------------

Quote (MaSer)
Посмотрел первую функцию, разочаровался и вышел из темы.

а ты бы как предложил?

Добавлено (08-06-2010, 16:44)
---------------------------------------------
Хотя там лучше циклом,чем так

Добавлено (08-06-2010, 16:46)
---------------------------------------------

Quote (|DUОS|)
function IsUnitItemSlotEmpty takes unit hero, integer slot returns boolean
return IsUnitItemSlotFilled(hero,slot) == false
endfunction

бж разводим да?=)


И в правду мир сошел с ума...
И до тех пор пока нас не обесточат
Пока не догорит аварийных фонарей заряд
Мы будем жечь тут электричество что есть мочи
Русский мапмейкинг - бессмысленный и беспощадный.xD
 

[DUОS]Дата: Вторник, 08 Июня 2010, 16:47:27 | Сообщение # 7
Группа: Заблокированные
Сообщений: 6279
Награды: 9
Репутация: 1708
Блокировки:
Quote (windrunner)
бж разводим да?=)

Для удобства)


НУ И ЧТО ТЕПЕРЬ?


Кликайте на дракошку ;)
 

Форум о Warcraft 3 » Раздел для картостроителей » GUI / Jass » [DUOS] Item Functions Library v0.98a
  • Страница 1 из 1
  • 1
Поиск:

Copyright © 2006 - 2024 Warcraft3FT.info При копировании материалов c сайта ставьте, пожалуйста, активную обратную ссылку на нас • Design by gReeB04ki ©
Хостинг от uCoz