// Drag and Drop Component Edition
// ================================
// By: Michael Burbea (weaaddar)
// Email address: [email protected]
// Preface:
// -------
// Drag and Drop project started almost a year ago. It has
// been in beta for the majority of its timeframe and featured
// mainly the bag that everyone thought was cool, and the much
// less popular attributer and spellbook. It also has been not worked on
// for 99% of the time it existed.
// Around beta 2, I decided to add the spellbook. The spellbook
// was an idea that Vexorian gave me. Many people wanted a system
// that allowed them to add spells to the poorman's spellbook
// included in warcraft III:TFT. My solution was somewhat wild.
// It took until beta3 before the spellbook started become more
// then a pile of crap. Unfortuantly, by the time I completely lost
// interest in the project, it was about as good as the spellbook
// was going to get. The spellbook I included was at least as good
// if not better then the one included in the game. However, with
// Patch 1.17 the spellbook can truly become better. But, through
// polling I found few people actually liked the spellbook. It was bulky
// confusing and not complete. This is the reason it is currently
// not in this collection.
// I also found that most people did not want a spellbook, an attributer
// and a backpack. They just wanted a backpack or an attributer or a spellbook.
// I would reply to these people that "All you have to do is just
// not give him a spellbook if you don't want him to have one" or
// "Don't give him a bag" or "Set his stats per level to 0", but people
// are idiots and decided that "durrr, I don't want a bag I'll just
// delete the class"
//
// Drag and Drop+=2/RC3, the last version that was publicly released
// was a composite version. Composite meaning that each featured
// was woven to only work if all other objects were there. Features
// could be disabled, but they couldn't be deleted. This also meant that
// adding new objects was very painful, as you had to account for old objects
// in existant. This made it very difficult to work with. As routing one
// problem may mean you have to edit another classes functionality.
//
// This edition is a component edition. This means that component
// features do not and cannot know of the existance of other component
// features. This also means that each component has its own triggers.
// Instead of the composite mess that was drag and drops triggers.
// This also means that if you would like to get rid of the attributer
// you can feel free to delete the attributers classes and triggers.
// It also means that writing your own components is easier.
//
// There is a drawback to this component system. It means that each feature
// needs its own set of triggers. Meaning there are more triggers running.
// Problems also include the fact that hero's methods are no longer
// fixed to one singular file.
//
// There are so many changes between this and drag and drop +=2 that I really
// couldn't possibly keep a changelist. I will however list new improvements
// below.
//
// Revisions and Notes.
// --------------------
// This is not D+D RC4. RC4 is no more, sorry. For those expecting
// spellbook upgrades (all 0 of you), you'll have to wait until I
// or somebody else (who am I kidding?) writes a spellbook component.
// This is the first release of Drag and Drop Component Edition.
// This is an alpha edition, if things do not work please respond
// to the thread at wc3campaigns.
// Here are non-technical revisions to classes:
// --------------------------------------------
// -You can now define multiple bag types. See BT class for more information
// -Bags now store items by handle, not by item type and charge.
// --This means that items are not destroyed, but preserved.
// --You can store bags in bag.
// --Inside a bag you can add items to bags inside it. But you can't open those bags.
// -Bag is now a component class. You can remove the class and triggers.
// -Attribute now retains its objects and they are never destroyed.
// -Attribute is now a component class. You can remove the class and triggers.
// Here is some techno bable for the four jass monkeys:
//-----------------------------------------------------
// -There is now one gamecache for all objects.
// -Memory leaks should be nonexistant. Prove me wrong :)
// -New use of helper classes like vector and IV:
// --Means less repetition of code.
// --Allows easier understanding of code
// -A lot of changes to triggers.
// Commentary.
//===========================================================================
// Return Bug exploiters:
// =====================
// The jass parser only checks that the last return statements type is of the
// one specified. This is often labelled as the return bug.
// Another return bug, though intentionally built-in to the parser, is any
// return statement expecting a handle inheriting class, will accept any handle
// I exploit the former. No explanation needed.
//==========================================================================
function H2I takes handle h returns integer
return h
return 0
endfunction
//==========================================================================
// Item Type functions:
// ===================
// These functions return an item type. They exist so that the developer
// can easily modify these values to the ones present in his map.
// IDBlank--Blank item
// IDCancel--cancel item
// IDNext--Next page item
// IDAttr--Attribute Ability (must be a replenish family type)
// IDStr--Str item
// IDAgi--Agi item
// IDInt--int item
//==========================================================================
function IDEqp takes nothing returns integer
return 'A000'
endfunction
function IDNoItem takes integer i returns integer
if(i==2)then
return 'I007'
elseif(i==3)then
return 'I00A'
else
return 'I00B'
endif
endfunction
function IDBlank takes nothing returns integer
return 'I004'
endfunction
function IDCancel takes nothing returns integer
return 'I003'
endfunction
function IDNext takes nothing returns integer
return 'I005'
endfunction
function IDAttr takes nothing returns integer
return 'A001'
endfunction
function IDStr takes nothing returns integer
return 'I000'
endfunction
function IDAgi takes nothing returns integer
return 'I001'
endfunction
function IDInt takes nothing returns integer
return 'I002'
endfunction
function IDAtr takes nothing returns integer
return 'I006'
endfunction
//==========================================================================
// Gamecache Object:
// ================
// Since you can't declare a gamecache before a gamestarts, and calling
// Initgamecache creates a new gamecache handle. This exists so that you have
// easy access to the obj variable and insure that it already is defined to
// a cache.
//==========================================================================
function objects takes nothing returns gamecache
if(udg_obj==null)then
set udg_obj=InitGameCache("obj.w3v")
endif
return udg_obj
endfunction
//==========================================================================
// Basic Utility functions:
// =======================
// Below are two basic functions that really should be part of common.j
// The first is written by me, and the second by vexorian.
// GetItemSlot returns the position of the item in a hero's inventory.
// --it returns -1 if the item was not found.
// --The function uses a sequiential search.
// SimError emulates the error messages used in the game.
//==========================================================================
function GetItemSlot takes unit hero, item it returns integer
local integer i=0
loop
exitwhen i==6
if(UnitItemInSlot(hero,i)==it)then
return i
endif
set i=i+1
endloop
return -1
endfunction
function SimError takes player ForPlayer, string msg returns nothing
local sound error=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
if (GetLocalPlayer() == ForPlayer) then
call ClearTextMessages()
call StartSound( error )
call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
endif
call KillSoundWhenDone(error)
set error=null
endfunction
function AbilityGetMaxLevel takes integer abil returns integer
local unit hero
local integer max=GetStoredInteger(objects(),I2S(abil),"m_maxlvl")
if(abil==0)then
return 0
endif
if(max==0)then
set hero=CreateUnit(Player(15),'hfoo',0,0,0)
call UnitAddAbility(hero,abil)
call SetUnitAbilityLevel(hero,abil,100)
set max=GetUnitAbilityLevel(hero,abil)
call StoreInteger(objects(),I2S(abil),"m_maxlvl",max)
call RemoveUnit(hero)
set hero=null
endif
return max
endfunction
Name | Type | is_array | initial_value |
BnsBit | integer | Yes | |
CamAOA | real | No | 340.00 |
CamDistance | real | No | 475.00 |
CamHeight | real | No | 140.00 |
canbeattacked | boolean | No | |
currentbuff | buffcode | No | |
currentspell | string | No | |
dmgend | real | No | |
dmgstart | real | No | |
downpressed | boolean | No | |
experienceText | texttag | No | |
fireballactive | boolean | No | |
fireballart | effect | No | |
fireballimpactsound | integer | No | |
fireblstactive | boolean | No | |
fireloop | sound | No | |
HeroAngle | real | No | |
JainaHealth | real | No | |
JainaMana | real | No | |
leftpressed | boolean | No | |
obj | gamecache | No | |
rightpressed | boolean | No | |
RotationInOnePlace | real | No | 35.00 |
selectedunit | unit | No | |
selectioneffect | effect | No | |
summonFoodActive | boolean | No | |
target | string | No | |
targethealth | real | No | |
TurningMoveDeg | real | No | |
unitcontrolled | unit | No | |
uppressed | boolean | No | |
v | unitcode | No |