Beispiel #1
0
 public function GetImprovedItemSource($itemID, $bossID)
 {
     $dungeonData = $this->aDB->selectRow("SELECT `instance_id`, `name_" . $this->_locale . "` AS `name`, `lootid_1`, `lootid_2`, `lootid_3`, `lootid_4` FROM `armory_instance_data` WHERE `id`=? OR `lootid_1`=? OR `lootid_2`=? OR `lootid_3`=? OR `lootid_4`=? OR `name_id`=? LIMIT 1", $bossID, $bossID, $bossID, $bossID, $bossID, $bossID);
     if (!$dungeonData) {
         $this->Log()->writeError('%s : dungeonData for lootid %d not found (current_locale: %s, locId: %d)', __METHOD__, $bossID, $this->_locale, $this->_loc);
         return false;
     }
     $difficulty_enum = array(1 => '10n', 2 => '25n', 3 => '10h', 4 => '25h');
     $heroic_string = Utils::GetArmoryString(19);
     $item_difficulty = null;
     for ($i = 1; $i < 5; $i++) {
         if (isset($dungeonData['lootid_' . $i]) && $dungeonData['lootid_' . $i] == $bossID && isset($difficulty_enum[$i])) {
             $item_difficulty = $difficulty_enum[$i];
         }
     }
     switch ($item_difficulty) {
         case '10n':
             if ($dungeonData['instance_id'] == 4812 || $dungeonData['instance_id'] == 4722 || $dungeonData['instance_id'] == 4987) {
                 $instance_data = $this->aDB->selectRow("SELECT `id` AS `areaId`, `name_" . $this->_locale . "` AS `areaName`, `is_heroic` FROM `armory_instance_template` WHERE `id`=? AND `partySize`=10 AND `is_heroic`=1", $dungeonData['instance_id']);
             } else {
                 $instance_data = $this->aDB->selectRow("SELECT `id` AS `areaId`, `name_" . $this->_locale . "` AS `areaName`, `is_heroic` FROM `armory_instance_template` WHERE `id`=?", $dungeonData['instance_id']);
             }
             if (!$instance_data) {
                 return false;
             }
             break;
         case '10h':
             if ($dungeonData['instance_id'] == 4812 || $dungeonData['instance_id'] == 4722 || $dungeonData['instance_id'] == 4987) {
                 $instance_data = $this->aDB->selectRow("SELECT `id` AS `areaId`, `name_" . $this->_locale . "` AS `areaName`, `is_heroic` FROM `armory_instance_template` WHERE `id`=? AND `partySize`=10 AND `is_heroic`=1", $dungeonData['instance_id']);
             } else {
                 $instance_data = $this->aDB->selectRow("SELECT `id` AS `areaId`, `name_" . $this->_locale . "` AS `areaName`, `is_heroic` FROM `armory_instance_template` WHERE `id`=?", $dungeonData['instance_id']);
             }
             if (!$instance_data) {
                 return false;
             }
             if ($heroic_string) {
                 $instance_data['areaName'] .= ' ' . $heroic_string;
             }
             break;
         case '25n':
             if ($dungeonData['instance_id'] == 4812 || $dungeonData['instance_id'] == 4722 || $dungeonData['instance_id'] == 4987) {
                 $instance_data = $this->aDB->selectRow("SELECT `id` AS `areaId`, `name_" . $this->_locale . "` AS `areaName`, `is_heroic` FROM `armory_instance_template` WHERE `id`=? AND `partySize`=25 AND `is_heroic`=1", $dungeonData['instance_id']);
             } else {
                 $instance_data = $this->aDB->selectRow("SELECT `id` AS `areaId`, `name_" . $this->_locale . "` AS `areaName`, `is_heroic` FROM `armory_instance_template` WHERE `id`=?", $dungeonData['instance_id']);
             }
             if (!$instance_data) {
                 return false;
             }
             if ($instance_data['is_heroic'] == 0) {
                 if ($heroic_string) {
                     $instance_data['areaName'] .= ' ' . $heroic_string;
                 } else {
                     $instance_data['areaName'] .= ' (25)';
                 }
             }
             break;
         case '25h':
             if ($dungeonData['instance_id'] == 4812 || $dungeonData['instance_id'] == 4722 || $dungeonData['instance_id'] == 4987) {
                 $instance_data = $this->aDB->selectRow("SELECT `id` AS `areaId`, `name_" . $this->_locale . "` AS `areaName`, `is_heroic` FROM `armory_instance_template` WHERE `id`=? AND `partySize`=25 AND `is_heroic`=1", $dungeonData['instance_id']);
             } else {
                 $instance_data = $this->aDB->selectRow("SELECT `id` AS `areaId`, `name_" . $this->_locale . "` AS `areaName`, `is_heroic` FROM `armory_instance_template` WHERE `id`=?", $dungeonData['instance_id']);
             }
             if (!$instance_data) {
                 return false;
             }
             if ($heroic_string) {
                 $instance_data['areaName'] .= ' ' . $heroic_string;
             }
             break;
     }
     if (!isset($instance_data)) {
         return false;
     }
     $instance_data['creatureId'] = $this->aDB->selectCell("SELECT `id` FROM `armory_instance_data` WHERE `id`=? OR `lootid_1`=? OR `lootid_2`=? OR `lootid_3`=? OR `lootid_4`=? OR `name_id`=? LIMIT 1", $bossID, $bossID, $bossID, $bossID, $bossID, $bossID);
     $instance_data['creatureName'] = $dungeonData['name'];
     if ($bossID > 100000) {
         // GameObject
         $drop_percent = Mangos::GenerateLootPercent($bossID, 'gameobject_loot_template', $itemID);
     } else {
         // Creature
         $drop_percent = Mangos::GenerateLootPercent($bossID, 'creature_loot_template', $itemID);
     }
     $instance_data['dropRate'] = Mangos::DropPercent($drop_percent);
     $instance_data['value'] = 'sourceType.creatureDrop';
     return $instance_data;
 }
Beispiel #2
0
 /**
  * Returns item source with area name, boss name, drop rate and area URL
  * @category Items class
  * @access   public
  * @param    int $itemID
  * @param    int $bossID
  * @param    bool $areaDataOnly = false
  * @return   array
  **/
 public function GetImprovedItemSource($itemID, $bossID, $areaDataOnly = false)
 {
     $dungeonData = $this->armory->aDB->selectRow("SELECT `instance_id`, `name_%s` AS `name`, `lootid_1`, `lootid_2`, `lootid_3`, `lootid_4` FROM `ARMORYDBPREFIX_instance_data` WHERE `id`=%d OR `lootid_1`=%d OR `lootid_2`=%d OR `lootid_3`=%d OR `lootid_4`=%d OR `name_id`=%d LIMIT 1", $this->armory->GetLocale(), $bossID, $bossID, $bossID, $bossID, $bossID, $bossID);
     if (!$dungeonData) {
         return false;
     }
     $difficulty_enum = array(1 => '10n', 2 => '25n', 3 => '10h', 4 => '25h');
     $heroic_string = Utils::GetArmoryString(19);
     $item_difficulty = null;
     for ($i = 1; $i < 5; $i++) {
         if (isset($dungeonData['lootid_' . $i]) && $dungeonData['lootid_' . $i] == $bossID && isset($difficulty_enum[$i])) {
             $item_difficulty = $difficulty_enum[$i];
         }
     }
     $instance_heroic = array(4812, 4722, 4987);
     switch ($item_difficulty) {
         case '10n':
             if (in_array($dungeonData['instance_id'], $instance_heroic)) {
                 $instance_data = $this->armory->aDB->selectRow("SELECT `id` AS `areaId`, `name_%s` AS `areaName`, `is_heroic`, `key` FROM `ARMORYDBPREFIX_instance_template` WHERE `id`=%d AND `partySize`=10 AND `is_heroic`=1", $this->armory->GetLocale(), $dungeonData['instance_id']);
             } else {
                 $instance_data = $this->armory->aDB->selectRow("SELECT `id` AS `areaId`, `name_%s` AS `areaName`, `is_heroic`, `key` FROM `ARMORYDBPREFIX_instance_template` WHERE `id`=%d", $this->armory->GetLocale(), $dungeonData['instance_id']);
             }
             if (!$instance_data) {
                 return false;
             }
             break;
         case '10h':
             if (in_array($dungeonData['instance_id'], $instance_heroic)) {
                 $instance_data = $this->armory->aDB->selectRow("SELECT `id` AS `areaId`, `name_%s` AS `areaName`, `is_heroic`, `key` FROM `ARMORYDBPREFIX_instance_template` WHERE `id`=%d AND `partySize`=10 AND `is_heroic`=1", $this->armory->GetLocale(), $dungeonData['instance_id']);
             } else {
                 $instance_data = $this->armory->aDB->selectRow("SELECT `id` AS `areaId`, `name_%s` AS `areaName`, `is_heroic`, `key` FROM `ARMORYDBPREFIX_instance_template` WHERE `id`=%d", $this->armory->GetLocale(), $dungeonData['instance_id']);
             }
             if (!$instance_data) {
                 return false;
             }
             if ($heroic_string) {
                 $instance_data['areaName'] .= ' ' . $heroic_string;
             }
             break;
         case '25n':
             if (in_array($dungeonData['instance_id'], $instance_heroic)) {
                 $instance_data = $this->armory->aDB->selectRow("SELECT `id` AS `areaId`, `name_%s` AS `areaName`, `is_heroic`, `key` FROM `ARMORYDBPREFIX_instance_template` WHERE `id`=%d AND `partySize`=25 AND `is_heroic`=1", $this->armory->GetLocale(), $dungeonData['instance_id']);
             } else {
                 $instance_data = $this->armory->aDB->selectRow("SELECT `id` AS `areaId`, `name_%s` AS `areaName`, `is_heroic`, `key` FROM `ARMORYDBPREFIX_instance_template` WHERE `id`=%d", $this->armory->GetLocale(), $dungeonData['instance_id']);
             }
             if (!$instance_data) {
                 return false;
             }
             if ($instance_data['is_heroic'] == 0) {
                 if ($heroic_string) {
                     $instance_data['areaName'] .= ' ' . $heroic_string;
                 } else {
                     $instance_data['areaName'] .= ' (25)';
                 }
             }
             break;
         case '25h':
             if (in_array($dungeonData['instance_id'], $instance_heroic)) {
                 $instance_data = $this->armory->aDB->selectRow("SELECT `id` AS `areaId`, `name_%s` AS `areaName`, `is_heroic`, `key` FROM `ARMORYDBPREFIX_instance_template` WHERE `id`=%d AND `partySize`=25 AND `is_heroic`=1", $this->armory->GetLocale(), $dungeonData['instance_id']);
             } else {
                 $instance_data = $this->armory->aDB->selectRow("SELECT `id` AS `areaId`, `name_%s` AS `areaName`, `is_heroic`, `key` FROM `ARMORYDBPREFIX_instance_template` WHERE `id`=%d", $this->armory->GetLocale(), $dungeonData['instance_id']);
             }
             if (!$instance_data) {
                 return false;
             }
             if ($heroic_string) {
                 $instance_data['areaName'] .= ' ' . $heroic_string;
             }
             break;
     }
     if (!isset($instance_data) || !is_array($instance_data)) {
         return false;
     }
     if ($areaDataOnly == true) {
         return array('areaName' => $instance_data['areaName'], 'areaUrl' => sprintf('source=dungeon&dungeon=%s&boss=all&difficulty=all', $instance_data['key']));
     }
     $instance_data['creatureId'] = $this->armory->aDB->selectCell("SELECT `id` FROM `ARMORYDBPREFIX_instance_data` WHERE `id`=%d OR `lootid_1`=%d OR `lootid_2`=%d OR `lootid_3`=%d OR `lootid_4`=%d OR `name_id`=%d LIMIT 1", $bossID, $bossID, $bossID, $bossID, $bossID, $bossID);
     $instance_data['creatureName'] = $dungeonData['name'];
     if ($bossID > 100000) {
         // GameObject
         $drop_percent = Mangos::GenerateLootPercent($bossID, 'gameobject_loot_template', $itemID);
     } else {
         // Creature
         $drop_percent = Mangos::GenerateLootPercent($bossID, 'creature_loot_template', $itemID);
     }
     $instance_data['dropRate'] = Mangos::GetDropRate($drop_percent);
     $instance_data['value'] = 'sourceType.creatureDrop';
     return $instance_data;
 }