void CSS2Properties:: setProperty(const Core::String& n, const Core::String& v) { if (v.Empty()) { getRocket()->RemoveProperty(n); } else { getRocket()->SetProperty(n, v); } }
v8::Handle<v8::Value> HTMLDocument:: getElementsByTagName(const Core::String& tagname) { v8::HandleScope handle_scope; //FIXME: use overloaded create() v8::Handle<v8::Value> v8ElementList = JS::juice::create<JS::juice::HTMLElementList>(); { assert(!v8ElementList.IsEmpty()); //Retrieve the native pointer HTMLElementList* jsElementList = v8::juice::convert::CastFromJS<JS::juice::HTMLElementList>(v8ElementList); assert(jsElementList); //Retreive the native list, and fill it Core::ElementList elements; getRocket()->GetElementsByTagName(elements, tagname); *jsElementList = HTMLElementList(elements); } return handle_scope.Close(v8ElementList); }
v8::Handle<v8::Value> HTMLDocument:: createTextNode(const Core::String& text) { v8::HandleScope handle_scope; return handle_scope.Close(JS::juice::getV8HandleFromRocketWrapper(getRocket()->CreateTextNode(text), v8::Null())); }
v8::Handle<v8::Value> HTMLDocument:: createDocumentFragment() { v8::HandleScope handle_scope; return handle_scope.Close(JS::juice::getV8HandleFromRocketWrapper(getRocket()->CreateElement("div"), v8::Null())); }
Core::String CSS2Properties:: getProperty(const Core::String& v) { const Core::Property* p = getRocket()->GetLocalProperty(v); if (p) return p->ToString(); return Core::String(); }
v8::Handle<v8::Value> HTMLDocument::documentElement() { Core::Element* result = getRocket(); while ( result->GetParentNode() ) result = result->GetParentNode(); v8::HandleScope handle_scope; return handle_scope.Close(JS::juice::getV8HandleFromRocketWrapper(result, v8::Null())); }
v8::Handle<v8::Value> HTMLDocument:: createComment(const Core::String& comment) { v8::HandleScope handle_scope; //FIXME:?? return handle_scope.Close(JS::juice::getV8HandleFromRocketWrapper(getRocket()->CreateTextNode("<!-- " + comment + " -->"), v8::Null())); }
Weapon::WeaponI* Weapon::Armory::getLauncher(int level, int projLevel) { //Min level 0 int weaplv = std::max(0, std::min(level, 8)); //If -1, match weapon level (default behaviour) int projlv = (projLevel > -1 ? projLevel : level); Weapon::SemiMag* launcher = new Weapon::SemiMag(fireCallback_, getRocket(projlv), "launcher"); upgradeLauncher(launcher, weaplv, projLevel); return static_cast<Weapon::WeaponI*>(launcher); }
void Weapon::Armory::upgradeLauncher(Weapon::SemiMag* launcher, int level, int projLevel) { //Match weapon level if (projLevel > -1) launcher->setProjectile(getRocket(projLevel)); else launcher->setProjectile(getRocket(level)); launcher->setLevel(level); //Set base attributes launcher->setMagSize(4, true); launcher->setResetTime(800); launcher->setReloadTime(3000); //L1H : ReloadTime- if (level > 0) { launcher->setReloadTime(2500); } //L2B : ResetTime- if (level > 1) { launcher->setResetTime(600); } //L3F : Magsize+ if (level > 2) { launcher->setMagSize(8, true); } //L4S : ReestTime-- if (level > 3) { launcher->setResetTime(400); } //L5H : Magsize++ if (level > 4) { launcher->setMagSize(12, true); } //L6B : Reloadtime-- if (level > 5) { launcher->setReloadTime(2000); } //L7F : Magsize+++ if (level > 6) { launcher->setMagSize(16, true); } //L8S : ReloadTime-- if (level > 7) { launcher->setReloadTime(1500); } }
int Event::eventPhase() { switch( getRocket()->GetPhase() ) { case ( RocketT::PHASE_CAPTURE ): return CAPTURING_PHASE; case ( RocketT::PHASE_TARGET ): return AT_TARGET; case ( RocketT::PHASE_BUBBLE ): return BUBBLING_PHASE; case ( RocketT::PHASE_UNKNOWN ): throw std::runtime_error( "Event::eventPhase(): PHASE_UNKNOWN" ); default: throw std::runtime_error( "Event::eventPhase(): default" ); } }
v8::Handle<v8::Value> HTMLDocument::body() { v8::HandleScope handle_scope; return handle_scope.Close(JS::juice::getV8HandleFromRocketWrapper(getRocket(), v8::Null())); }
v8::Handle<v8::Value> HTMLDocument::getElementById(const Core::String& elementId) { v8::HandleScope handle_scope; return handle_scope.Close(JS::juice::getV8HandleFromRocketWrapper(getRocket()->GetElementById(elementId), v8::Null())); }
v8::Handle<v8::Value> Event::currentTarget() { v8::HandleScope handle_scope; return handle_scope.Close(JS::juice::getV8HandleFromRocketWrapper(getRocket()->GetCurrentElement(), v8::Null())); }
bool Event::bubbles() { //FIXME: ?? return getRocket()->GetPhase() == RocketT::PHASE_BUBBLE; }
void Event::stopPropagation() { return getRocket()->StopPropagation(); }
Core::String Event::type() { return getRocket()->GetType(); }