6159 | | QueryResult *result = CharacterDatabase.PQuery("SELECT arenateamid FROM arena_team_member WHERE guid='%u'", GUID_LOPART(guid)); |
6160 | | if(result) |
6161 | | { |
6162 | | bool found = false; |
6163 | | // init id to find the type of the arenateam |
6164 | | uint32 id = (*result)[0].GetUInt32(); |
6165 | | do |
6166 | | { |
6167 | | QueryResult *result2 = CharacterDatabase.PQuery("SELECT type FROM arena_team WHERE arenateamid='%u'", id); |
6168 | | if(result2) |
6169 | | { |
6170 | | uint8 dbtype = (*result2)[0].GetUInt32(); |
6171 | | delete result2; |
6172 | | if(dbtype == type) |
6173 | | { |
6174 | | // if the type matches, we've found the id |
6175 | | found = true; |
6176 | | break; |
6177 | | } |
6178 | | } |
6179 | | } while(result->NextRow()); |
6180 | | delete result; |
6181 | | if(found) return id; |
6182 | | } |
6183 | | // no arenateam for the specified guid, return 0 |
6184 | | return 0; |
| 6155 | QueryResult *result = CharacterDatabase.PQuery("SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid='%u' AND type='%u' LIMIT 1", GUID_LOPART(guid), type); |
| 6156 | if(!result) |
| 6157 | return 0; |
| 6158 | |
| 6159 | return (*result)[0].GetUInt32(); |
| 8550 | return false; |
| 8551 | } |
| 8552 | |
| 8553 | bool Player::IsValidPos( uint8 bag, uint8 slot ) |
| 8554 | { |
| 8555 | // post selected |
| 8556 | if(bag == NULL_BAG) |
| 8557 | return true; |
| 8558 | |
| 8559 | if (bag == INVENTORY_SLOT_BAG_0) |
| 8560 | { |
| 8561 | // any post selected |
| 8562 | if (slot == NULL_SLOT) |
| 8563 | return true; |
| 8564 | |
| 8565 | // equipment |
| 8566 | if (slot < EQUIPMENT_SLOT_END) |
| 8567 | return true; |
| 8568 | |
| 8569 | // bag equip slots |
| 8570 | if (slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END) |
| 8571 | return true; |
| 8572 | |
| 8573 | // backpack slots |
| 8574 | if (slot >= INVENTORY_SLOT_ITEM_START && slot < INVENTORY_SLOT_ITEM_END) |
| 8575 | return true; |
| 8576 | |
| 8577 | // keyring slots |
| 8578 | if (slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_END) |
| 8579 | return true; |
| 8580 | |
| 8581 | // bank main slots |
| 8582 | if (slot >= BANK_SLOT_ITEM_START && slot < BANK_SLOT_ITEM_END) |
| 8583 | return true; |
| 8584 | |
| 8585 | // bank bag slots |
| 8586 | if (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END) |
| 8587 | return true; |
| 8588 | |
| 8589 | return false; |
| 8590 | } |
| 8591 | |
| 8592 | // bag content slots |
| 8593 | if (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END) |
| 8594 | { |
| 8595 | Bag* pBag = (Bag*)GetItemByPos (INVENTORY_SLOT_BAG_0, bag); |
| 8596 | if(!pBag) |
| 8597 | return false; |
| 8598 | |
| 8599 | // any post selected |
| 8600 | if (slot == NULL_SLOT) |
| 8601 | return true; |
| 8602 | |
| 8603 | return slot < pBag->GetBagSize(); |
| 8604 | } |
| 8605 | |
| 8606 | // bank bag content slots |
| 8607 | if( bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END ) |
| 8608 | { |
| 8609 | Bag* pBag = (Bag*)GetItemByPos (INVENTORY_SLOT_BAG_0, bag); |
| 8610 | if(!pBag) |
| 8611 | return false; |
| 8612 | |
| 8613 | // any post selected |
| 8614 | if (slot == NULL_SLOT) |
| 8615 | return true; |
| 8616 | |
| 8617 | return slot < pBag->GetBagSize(); |
| 8618 | } |
| 8619 | |
| 8620 | // where this? |