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


[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Модератор форума: PUVer, SirNikolas, Ty3uK  
Конвертация из vJass в Jass2
[DUОS]Дата: Воскресенье, 03 Апреля 2011, 12:00:51 | Сообщение # 1
Группа: Заблокированные
Сообщений: 6279
Награды: 9
Репутация: 1708
Блокировки:
Я уже не знаю, что сделать с этой гадиной, с которой я мучаюсь уже вторую неделю fffuuu palevo
Вот ссылка на эту систему и на принцип её работы.
Моя задача - сконвертировать эту вот системку из vJass в Jass2. vJass я почти вообще не курю и очень прошу братьев-кодеров помочь мне в этом деле, из за которого у меня такой ступор facepalm

Я написал такой API:

Code
//=========================================================================================
//*                    [DUOS] Craft System                    *
//=========================================================================================
// IS_GetItemTypeSlot - Получает первый слот, в котором находится предмет типа iid.
//                      Если его нет, функция вернёт -1.
//
// IS_RecipeModifyNeededAmount - Изменяет кол-во предметов данного типа в рецепте на заданное.
//
// IS_AddRecipe - Добавляет рецепт в БД рецептов. Кол-во каждого компонента изначально равно 1.
//
// IS_GetRecComponents - Получает кол-во компонентов заданного рецепта.
//
// IS_AddItem - Добавляет предмет в БД предметов.
//              rit - Тип рунного предмета.
//              nit - Тип нормального предмета.
//              dit - Тип неактивного предмета.
//
// IS_GetItemIndex - Получает номер предмета в БД.
//  
// IS_GetRuneIT - Получает по номеру предмета в БД тип его рунной вариации.
//  
// IS_GetNormalIT - Получает по номеру предмета в БД тип его нормальной вариации.
//  
// IS_GetDisabledIT - Получает по номеру предмета в БД тип его неактивной вариации.
//
// IS_GetItemTypeAmount - Получает кол-во предметов заданного типа в инвентаре юнита.
//
// IS_CheckRecComp - Проверяет, есть ли все компоненты рецепта в инвентаре у юнита.
//                   Учитывает подобранный предмет (pit - его тип).
//                   Учитывает количество предметов, заданное в БД.
//
// IS_CraftRecipe - Собирает рецепт в инвентарь данного юнита.
//                  Учитывает подобранный предмет (pit - его тип).
//   
// IS_GiveItemToUnit - Даёт предмет юниту, принимая любой из его типов (руну, норм или диз).

function IS_GetItemTypeSlot takes unit u, integer iid returns integer
     local item it
     local integer i = 0
     loop
         exitwhen i > 5
         set it = UnitItemInSlot(u,i)
         if GetItemTypeId(it) == iid then
             set it = null
             return i
         endif
         set i = i + 1
     endloop
     set it = null
     return -1
endfunction

function IS_RecipeModifyNeededAmount takes integer rid, integer it, integer na returns nothing
     call SaveInteger(udg_RecBase,rid,it,na)     
endfunction

function IS_AddRecipe takes integer tit, integer it1, integer it2, integer it3, integer it4, integer it5, integer it6, integer it7 returns nothing  
     call SaveInteger(udg_RecBase,udg_CurrentIndex,0,tit)
     call SaveInteger(udg_RecBase,udg_CurrentIndex,1,it1)
     call SaveInteger(udg_RecBase,udg_CurrentIndex,2,it2)    
     call SaveInteger(udg_RecBase,udg_CurrentIndex,3,it3)
     call SaveInteger(udg_RecBase,udg_CurrentIndex,4,it4)
     call SaveInteger(udg_RecBase,udg_CurrentIndex,5,it5)
     call SaveInteger(udg_RecBase,udg_CurrentIndex,6,it6)
     call SaveInteger(udg_RecBase,udg_CurrentIndex,7,it7)
     call IS_RecipeModifyNeededAmount(udg_CurrentIndex,it1,1)
     call IS_RecipeModifyNeededAmount(udg_CurrentIndex,it2,1)
     call IS_RecipeModifyNeededAmount(udg_CurrentIndex,it3,1)
     call IS_RecipeModifyNeededAmount(udg_CurrentIndex,it4,1)
     call IS_RecipeModifyNeededAmount(udg_CurrentIndex,it5,1)
     call IS_RecipeModifyNeededAmount(udg_CurrentIndex,it6,1)
     call IS_RecipeModifyNeededAmount(udg_CurrentIndex,it7,1)
     set udg_CurrentIndex = udg_CurrentIndex + 1
endfunction

function IS_GetRecComponents takes integer ri returns integer
     local integer i = 1
     loop
         exitwhen i > 7
         if LoadInteger(udg_RecBase,ri,i) == 0 then
             return i
         endif
         set i = i + 1
     endloop
     return 7
endfunction

function IS_AddItem takes integer rit, integer nit, integer dit returns nothing
     if rit != 0 and nit != 0 and dit != 0 then
         call SaveInteger(udg_ItemBase,0,udg_CurItemIndex,rit)  
         call SaveInteger(udg_ItemBase,1,udg_CurItemIndex,nit)
         call SaveInteger(udg_ItemBase,2,udg_CurItemIndex,dit)
         set udg_CurItemIndex = udg_CurItemIndex + 1
     endif
endfunction

function IS_GetItemIndex takes integer iid returns integer
     local integer i = 0
     local integer rit
     local integer nit
     local integer dit
     loop
         exitwhen i > udg_CurItemIndex
         set rit = LoadInteger(udg_ItemBase,0,i)
         set nit = LoadInteger(udg_ItemBase,1,i)
         set dit = LoadInteger(udg_ItemBase,2,i)
         if iid == rit or iid == nit or iid == dit then
             return i
         endif
         set i = i + 1
     endloop
     return -1
endfunction

function IS_GetRuneIT takes integer index returns integer
     return LoadInteger(udg_ItemBase,0,index)
endfunction

function IS_GetNormalIT takes integer index returns integer
     return LoadInteger(udg_ItemBase,1,index)
endfunction

function IS_GetDisabledIT takes integer index returns integer
     return LoadInteger(udg_ItemBase,2,index)
endfunction

function IS_GetItemTypeAmount takes unit u, integer iid returns integer
     local item it
     local integer c = 0
     local integer i = 0
     loop
         exitwhen i > 5
         set it = UnitItemInSlot(u,i)
         if GetItemTypeId(it) == iid then
             set c = c + 1
         endif
         set i = i + 1
     endloop
     set it = null
     return c
endfunction

function IS_CheckRecComp takes integer rnum, unit u, integer pit returns boolean
     local integer rcid
     local integer amount
     local integer uamount
     local integer i = 1
     loop
         exitwhen i > IS_GetRecComponents(rnum)
         set rcid = LoadInteger(udg_RecBase,rnum,i)      
         set amount = LoadInteger(udg_RecBase,rnum,rcid)
         set uamount = IS_GetItemTypeAmount(u,rcid)
          
         if rcid == pit then
             set uamount = uamount + 1
         endif     
          
         if amount < uamount then   
             return false
         endif
          
         set i = i + 1
     endloop
     return true   
endfunction

function IS_RemoveITAmount takes unit u, integer iid, integer amount returns nothing
     local integer i = 0
     local integer ua = IS_GetItemTypeAmount(u,iid)
     local integer id = 0
     local item si
      
     if amount <= ua and amount > 0 then
         loop
             exitwhen i > 5
             if id == amount then
                 set i = 5
             else
                 set si = UnitItemInSlot(u,i)
                 if GetItemTypeId(si) == iid then
                     call UnitRemoveItem(u,si)
                     set id = id + 1
                     set si = null
                 endif     
             endif
             set i = i + 1
         endloop
     endif
      
endfunction

function IS_CraftRecipe takes integer rnum, unit u, integer pit returns nothing
     local integer rcid
     local integer amount
     local integer i = 1
     loop
         exitwhen i > IS_GetRecComponents(rnum)
         set rcid = LoadInteger(udg_RecBase,rnum,i)      
         set amount = LoadInteger(udg_RecBase,rnum,rcid)
          
         if rcid == pit then
             set amount = amount - 1
         endif     
          
         call IS_RemoveITAmount(u,rcid,amount)
          
         set i = i + 1
     endloop
      
     set rcid = LoadInteger(udg_RecBase,rnum,0)      
     call UnitAddItemById(u,IS_GetRuneIT(IS_GetItemIndex(rcid)))  
      
     call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl",GetWidgetX(u),GetWidgetY(u)))  
endfunction

function IS_GiveItemToUnit takes unit u, item pi returns boolean
     local integer i = 0
     local integer iid = GetItemTypeId(pi)
     local integer niid = IS_GetNormalIT(IS_GetItemIndex(iid))
     local integer rid
     local boolean b = false
     local item it
     local integer slot
      
     loop
         exitwhen i > udg_CurrentIndex
         set b = IS_CheckRecComp(i,u,niid)  
         if b then
             set rid = i
             set i = udg_CurrentIndex
         endif
         set i = i + 1
     endloop   
      
     if b then
         call IS_CraftRecipe(rid,u,niid)
         return true
     else
         set slot = IS_GetItemTypeSlot(u,niid)
         set it = UnitItemInSlot(u,slot)
         if slot > -1 and GetItemCharges(it) > 0 then
             call SetItemCharges(it,GetItemCharges(it) + GetItemCharges(pi))
             set it = null    
             return true
         elseif slot == -1 then
             if UnitInventoryCount(u) < 6 then
                 call UnitAddItemById(u,niid)  
                 set it = null    
                 return true
             else
                 call BJDebugMsg("Ошибка.")
             endif  
         endif
     endif   
     set it = null
     return false
endfunction

Однако он кривой.
Помогите мне разобраться, всем, кто дал хоть какой-то дельный совет - +9 в репутацию.


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


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

lawsonДата: Воскресенье, 03 Апреля 2011, 12:43:59 | Сообщение # 2
Группа: Проверенные
Сообщений: 3482
Награды: 0
Репутация: 974
Блокировки:
а че такое JASS2?

Nic nie wiem bo mam chuj.
редактирую посты! ВСЕ!
 

DreiiДата: Воскресенье, 03 Апреля 2011, 12:47:23 | Сообщение # 3
10 уровень
Группа: Проверенные
Сообщений: 4991
Награды: 0
Репутация: 603
Блокировки:
lawson, jASS

 

lawsonДата: Воскресенье, 03 Апреля 2011, 12:49:52 | Сообщение # 4
Группа: Проверенные
Сообщений: 3482
Награды: 0
Репутация: 974
Блокировки:
А чем он отличаеться от vJASS?

Nic nie wiem bo mam chuj.
редактирую посты! ВСЕ!
 

DreiiДата: Воскресенье, 03 Апреля 2011, 13:01:56 | Сообщение # 5
10 уровень
Группа: Проверенные
Сообщений: 4991
Награды: 0
Репутация: 603
Блокировки:
lawson, простой Jass от vJass?
Синтаксисом


 

[DUОS]Дата: Воскресенье, 03 Апреля 2011, 13:06:04 | Сообщение # 6
Группа: Заблокированные
Сообщений: 6279
Награды: 9
Репутация: 1708
Блокировки:
Quote (lawson)
А чем он отличаеться от vJASS?

vJass для новичков


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


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

DragoNДата: Воскресенье, 03 Апреля 2011, 14:15:14 | Сообщение # 7
Инквизитор
Группа: Стримеры
Сообщений: 4348
Награды: 7
Репутация: 2776
Блокировки:
Quote (|DUОS|)
Моя задача - сконвертировать эту вот системку из vJass в Jass2

ты чего курил? она и так на jass2 avtorklif


El Psy Congroo


Сообщение отредактировал DragoN - Воскресенье, 03 Апреля 2011, 14:16:53
 

DreiiДата: Воскресенье, 03 Апреля 2011, 14:33:12 | Сообщение # 8
10 уровень
Группа: Проверенные
Сообщений: 4991
Награды: 0
Репутация: 603
Блокировки:
DragoN, Он дал ссыльна ситсему которая на вЖ.
Потмо приложил код который писал сам,судя пов сему с тйо системы.


 

[DUОS]Дата: Воскресенье, 03 Апреля 2011, 14:43:59 | Сообщение # 9
Группа: Заблокированные
Сообщений: 6279
Награды: 9
Репутация: 1708
Блокировки:
Quote (DragoN)
она и так на jass2

Quote (|DUОS|)
Вот ссылка на эту систему и на принцип её работы.

Сам что вкурил, что не заметил ссылок? :)
Я только нерабочий (по какой-то причине) апи аналог выложил.


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


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

lawsonДата: Воскресенье, 03 Апреля 2011, 14:53:55 | Сообщение # 10
Группа: Проверенные
Сообщений: 3482
Награды: 0
Репутация: 974
Блокировки:
[DUОS],
Посвятишь меня в цели этой конвертации? Чем тебя это не устраивает?


Nic nie wiem bo mam chuj.
редактирую посты! ВСЕ!
 

DreiiДата: Воскресенье, 03 Апреля 2011, 15:42:18 | Сообщение # 11
10 уровень
Группа: Проверенные
Сообщений: 4991
Награды: 0
Репутация: 603
Блокировки:
lawson, Он не юзает JNGP xD

 

DragoNДата: Воскресенье, 03 Апреля 2011, 15:44:23 | Сообщение # 12
Инквизитор
Группа: Стримеры
Сообщений: 4348
Награды: 7
Репутация: 2776
Блокировки:
как вариант скомпилить в жнгп и посмотреть war3map.j
ну, я ссылок не увидел


El Psy Congroo
 

[DUОS]Дата: Воскресенье, 03 Апреля 2011, 15:51:56 | Сообщение # 13
Группа: Заблокированные
Сообщений: 6279
Награды: 9
Репутация: 1708
Блокировки:
Quote (lawson)
Чем тебя это не устраивает?

Не открывается в стандартном WE. ВСЁ. ЭТО главный аргумент.


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


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

DragoNДата: Воскресенье, 03 Апреля 2011, 19:13:21 | Сообщение # 14
Инквизитор
Группа: Стримеры
Сообщений: 4348
Награды: 7
Репутация: 2776
Блокировки:
Quote (|DUОS|)

Не открывается в стандартном WE. ВСЁ. ЭТО главный аргумент.

не агрись, деточка
напиши MF, может переведёт


El Psy Congroo
 

[DUОS]Дата: Понедельник, 04 Апреля 2011, 21:10:25 | Сообщение # 15
Группа: Заблокированные
Сообщений: 6279
Награды: 9
Репутация: 1708
Блокировки:
Даммит.
Ну так ап же.


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


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

  • Страница 1 из 1
  • 1
Поиск:

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