Esempio n. 1
0
 public function build_end($town, $type, $subtype, $count, $start, $end)
 {
     //pobierz dane obiektu
     $object = get_row("\n\t\t\tselect * from game_objects_param \n\t\t\tleft join game_objects \n\t\t\ton go_t_id = " . $town . "\n\t\t\tand go_gop_id = gop_id\n\t\t\twhere gop_type = " . $type . " and gop_subtype = " . $subtype . "\n\t\t\tlimit 1\n\t\t");
     //jeżeli obiektu nie ma na liście obiektów wybudowanych, to bierz pod uwagę parametry startowe
     if (empty($object->go_id)) {
         $object->go_lvl = 0;
     }
     switch ($type) {
         case 1:
             switch ($subtype) {
                 case 1:
                     //tartak
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_wood_inc = t_wood_inc + 50 where t_id = {$town}");
                     } else {
                         call("update towns set t_wood_inc = t_wood_inc * 1.2 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 2:
                     //cegielnia
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_stone_inc = t_stone_inc + 50 where t_id = {$town}");
                     } else {
                         call("update towns set t_stone_inc = t_stone_inc * 1.2 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 3:
                     //Kopalnia złota
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_iron_inc = t_iron_inc + 50 where t_id = {$town}");
                     } else {
                         call("update towns set t_iron_inc = t_iron_inc * 1.2 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 4:
                     //młyn
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_pop_max = t_pop_max * 1.3  where t_id = {$town}");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         call("update towns set t_pop_max = t_pop_max * 1.3 where t_id = {$town}");
                         if ($object->go_lvl == 2) {
                             call("update town_objects set to_can = 1 where to_gop_id = 7 and to_t_id = {$town}");
                         }
                     }
                     break;
                 case 5:
                     //koszary
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 9 or to_gop_id = 21");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         switch ($object->go_lvl) {
                             case 2:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 10");
                                 break;
                             case 4:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 11 or to_gop_id = 22");
                                 break;
                             case 5:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 15");
                                 break;
                             case 6:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 12");
                                 break;
                             case 9:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 13 or to_gop_id = 23");
                                 break;
                             case 14:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 14");
                                 break;
                             default:
                                 break;
                         }
                     }
                     break;
                 case 7:
                     //ratusz
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id >= 16 and to_gop_id <= 20");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         if ($object->go_lvl == 2) {
                             call("update town_objects set to_can = 1 where to_gop_id = 6 and to_t_id = {$town}");
                         } elseif ($object->go_lvl == 1) {
                             call("update town_objects set to_can = 1 where to_gop_id = 5 and to_t_id = {$town}");
                         }
                     }
                     break;
                 case 8:
                     //magazyn
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_res_max = t_res_max * 1.3  where t_id = {$town}");
                     } else {
                         call("update towns set t_res_max = t_res_max * 1.3  where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 default:
                     //inne
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
             }
             break;
         case 2:
             switch ($subtype) {
                 case 1:
                     //Wycinka Drzew
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_wood_inc = t_wood_inc * 1.1 where t_id = {$town}");
                     } else {
                         call("update towns set t_wood_inc = t_wood_inc * 1.1 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 2:
                     //Wiedza o glebie
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_stone_inc = t_stone_inc * 1.1 where t_id = {$town}");
                     } else {
                         call("update towns set t_stone_inc = t_stone_inc * 1.1where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 3:
                     //Wiedza o skałach
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_iron_inc = t_iron_inc * 1.1 where t_id = {$town}");
                     } else {
                         call("update towns set t_iron_inc = t_iron_inc * 1.1 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 4:
                     //higiena
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_pop_max = t_pop_max * 1.1  where t_id = {$town}");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         call("update towns set t_pop_max = t_pop_max * 1.1  where t_id = {$town}");
                     }
                     break;
                 case 5:
                     //magazynynowanie
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_res_max = t_res_max * 1.2  where t_id = {$town}");
                     } else {
                         call("update towns set t_res_max = t_res_max * 1.2  where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
             }
             break;
         case 3:
             //units
             $is_unit = get_one("select go_id from game_objects where go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype} limit 1");
             if (empty($is_unit)) {
                 call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time, go_attack, go_defence, go_life, go_range, go_lvl)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} , {$object->gop_stone} , {$object->gop_iron}, {$object->gop_pop}, {$object->gop_time},{$object->gop_attack}, {$object->gop_defence}, {$object->gop_life}, {$object->gop_range}, {$count})");
             } else {
                 call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + {$count}\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
             }
             break;
         case 10:
             require_once 'functions/SpyMgr.php';
             $SpyMgr = new SpyMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $SpyMgr->spy_battle($config, $newevent);
             break;
         case 11:
             require_once 'functions/SpyMgr.php';
             $SpyMgr = new SpyMgr();
             $SpyMgr->spy_dismis($config, $town, $count);
             break;
         case 20:
             require_once 'functions/MarketMgr.php';
             $MarketMgr = new MarketMgr();
             $MarketMgr->caravan_unload($config, $subtype, $count);
             $back = $MarketMgr->caravan_back($config, $town, $count);
             break;
         case 21:
             require_once 'functions/MarketMgr.php';
             $MarketMgr = new MarketMgr();
             $MarketMgr->caravan_unload($config, $town, $count);
             $back = $MarketMgr->caravan_dismis($config, $count);
             break;
         case 30:
             require_once 'functions/ArmyMgr.php';
             $ArmyMgr = new ArmyMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $ArmyMgr->army_battle($config, $newevent);
             break;
         case 31:
             require_once 'functions/ArmyMgr.php';
             $ArmyMgr = new ArmyMgr();
             $ArmyMgr->army_dismis($config, $town, $count);
             break;
         case 70:
             require_once 'functions/ColectorsMgr.php';
             $ColectorsMgr = new ColectorsMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $ColectorsMgr->colectors_work($config, $newevent);
             break;
         case 71:
             require_once 'functions/ColectorsMgr.php';
             $ColectorsMgr = new ColectorsMgr();
             $back = $ColectorsMgr->colectors_dismis($config, $town, $count);
             break;
         case 80:
             require_once 'functions/ThiefsMgr.php';
             $ThiefsMgr = new ThiefsMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $ThiefsMgr->thiefs_work($config, $newevent);
             break;
         case 81:
             require_once 'functions/ThiefsMgr.php';
             $ThiefsMgr = new ThiefsMgr();
             $back = $ThiefsMgr->thiefs_dismis($config, $town, $count);
             break;
         case 90:
             require_once 'functions/AssasinsMgr.php';
             $AssasinsMgr = new AssasinsMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $AssasinsMgr->assasins_battle($config, $newevent);
             break;
         case 91:
             require_once 'functions/AssasinsMgr.php';
             $AssasinsMgr = new AssasinsMgr();
             $AssasinsMgr->assasins_dismis($config, $town, $count);
             break;
         default:
             break;
     }
 }