rectangle2d chatbar::bounds() { vector2d absp = position - vector2d(512, 84); return rectangle2d(absp, absp + dimensions); }
rectangle2d textfield::bounds(vector2d parentpos) { vector2d absp = position + parentpos; return rectangle2d(absp, absp + vector2d(14 * maxlength, 24)); }
void playfield::useattack(int skillid) { attackinfo attack; attacktype type = ATT_NONE; if (skillid > 0) { skilldata* touse = cache.getskills()->getskill(skillid); char skill_l = playerchar.getskills()->getlevel(skillid); if (skill_l > 0) { skillinfo info = touse->getlevel(skill_l); bool allowed = playerchar.tryattack(&attack, skillid, info.hpcost, info.mpcost); if (allowed) { bool left = playerchar.getleft(); bool twoh = playerchar.getlook()->getcloth(EQL_WEAPON)->istwo_h(); touse->addeffects(playerchar.geteffects(), !left, 16.0f / playerchar.getattspeed(), twoh); playerchar.setaction(touse->getaction(twoh)); if (touse->isattack()) { attack.maxattacked = info.mobs; attack.numdamage = info.attacks; attack.stance = 1; attack.charge = 0; attack.display = 50; attack.skillmult = info.damage; vector2d lt = info.range.first; vector2d rb = info.range.second; vector2d plpos = playerchar.getposition(); if (left) { lt = plpos + lt; rb = plpos + rb; } else { int left = lt.x(); int right = rb.x(); lt = vector2d(plpos.x() - right, plpos.y() + lt.y()); rb = vector2d(plpos.x() - left, plpos.y() + rb.y()); } mobs.sendattack(&attack, rectangle2d(lt, rb)); packet_c.close_attack(attack); } } } } else { bool allowed = playerchar.tryattack(&attack, skillid, 0, 0); if (allowed) { clothing* weapon = playerchar.getlook()->getcloth(EQL_WEAPON); rectangle2d range = weapon->getrange(); vector2d plpos = playerchar.getposition(); bool left = playerchar.getleft(); if (left) { range.shift(plpos); } else { vector2d lt = range.getlt(); vector2d rb = range.getrb(); range.setlt(vector2d(plpos.x() - rb.x(), plpos.y() + lt.y())); range.setrb(vector2d(plpos.x() - lt.x(), plpos.y() + rb.y())); } attack.maxattacked = 1; attack.display = 50; attack.charge = 0; attack.numdamage = 1; attack.skillmult = 1.0f; mobs.sendattack(&attack, range); switch (weapon->getweptype()) { case WEP_1H_SWORD: case WEP_1H_AXE: case WEP_1H_MACE: case WEP_SPEAR: case WEP_POLEARM: case WEP_DAGGER: case WEP_KNUCKLE: type = ATT_CLOSE; break; case WEP_BOW: case WEP_CROSSBOW: case WEP_CLAW: case WEP_GUN: type = ATT_RANGED; break; case WEP_WAND: case WEP_STAFF: type = ATT_MAGIC; break; } } } switch (type) { case ATT_CLOSE: packet_c.close_attack(attack); break; } }
rectangle2d statsinfo::dragarea() { return rectangle2d(position, position + vector2d(212, 20)); }